@rizom/brain 0.2.0-alpha.132 → 0.2.0-alpha.134
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brain.js +496 -496
- package/dist/entities.d.ts +3 -0
- package/dist/entities.js.map +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/plugins.d.ts +3 -0
- package/dist/plugins.js.map +2 -2
- package/dist/seed-content/rover-seed-content-core/playbook/rover-first-knowledge-loop.md +89 -0
- package/dist/seed-content/rover-seed-content-core/playbook/rover-onboarding.md +9 -46
- package/dist/services.js.map +2 -2
- package/dist/site.js +4 -4
- package/dist/site.js.map +8 -8
- package/package.json +1 -1
package/dist/site.js
CHANGED
|
@@ -1489,7 +1489,7 @@ ${$.join(`
|
|
|
1489
1489
|
letter-spacing: 0.02em;
|
|
1490
1490
|
}
|
|
1491
1491
|
.printable-footer a { color: inherit; text-decoration: none; overflow-wrap: anywhere; }
|
|
1492
|
-
`}},void 0,!1,void 0,this),b2("header",{className:"printable-hero",children:[b2("div",{className:"printable-masthead",children:$.brandLabel&&b2("p",{className:"printable-kicker",children:$.brandLabel},void 0,!1,void 0,this)},void 0,!1,void 0,this),b2("div",{children:[b2("h1",{className:"printable-title",children:$.title},void 0,!1,void 0,this),$.excerpt&&b2("p",{className:"printable-excerpt",children:$.excerpt},void 0,!1,void 0,this),b2("div",{className:"printable-meta",children:[$.author&&b2("span",{children:["By ",$.author]},void 0,!0,void 0,this),f&&b2("span",{children:f},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.coverImageUrl&&b2("figure",{className:"printable-cover-wrap",children:b2("img",{className:"printable-cover",src:$.coverImageUrl,alt:""},void 0,!1,void 0,this)},void 0,!1,void 0,this),b2(H6,{markdown:$.body,className:"printable-body"},void 0,!1,void 0,this),($.canonicalUrl||$.brandLabel)&&b2("footer",{className:"printable-footer",children:[b2("span",{children:$.brandLabel??"Printable PDF"},void 0,!1,void 0,this),$.canonicalUrl&&b2("a",{href:$.canonicalUrl,children:$.canonicalUrl},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var lh0=26214400,rh0=60000;class qQ{context;renderPdf;constructor(w,$={}){this.context=w;this.renderPdf=$.renderPdf??C$}async resolve(w){if(w.sourceEntityType!=="post"||w.attachmentType!==XG)return;let $=await this.context.entityService.getEntity({entityType:"post",id:w.sourceEntityId});if(!$)return;let f=ph0($,{brandLabel:this.resolveBrandLabel(),coverImageUrl:await this.resolveCoverImageUrl($)}),X=await yh0(mh0(xh0(),"brain-blog-printable-"));try{let W=await V6({outputDir:X,mediaPath:`/_media/printable/post/${$.id}`,template:ox,format:"pdf",content:f,siteConfig:{title:f.title,themeMode:"light"},themeCSS:this.context.themeCSS}),Y=await N6({rootDir:X});try{return{type:"document",data:await this.renderPdf(Y.urlFor(W.urlPath),{maxBytes:lh0,timeoutMs:rh0,printBackground:!0,preferCSSPageSize:!0}),mimeType:"application/pdf",filename:`${ch0($)}-printable.pdf`}}finally{await Y.close()}}finally{await gh0(X,{recursive:!0,force:!0})}}resolveBrandLabel(){let w=this.context.domain?.trim();if(w&&w.length>0)return w;let $=this.context.identity.getProfile().name.trim();return $.length>0?$:void 0}async resolveCoverImageUrl(w){let{frontmatter:$}=e2(w.content),f=S1.parse($);if(!f.coverImageId)return;let X=await this.context.entityService.getEntity({entityType:"image",id:f.coverImageId});return X?.content.startsWith("data:image/")?X.content:void 0}}function ph0(w,$={}){let{frontmatter:f,content:X}=e2(w.content),W=S1.parse(f);return{title:W.title,body:X,...W.excerpt?{excerpt:W.excerpt}:{},...W.author?{author:W.author}:{},...W.publishedAt?{publishedAt:W.publishedAt}:{},...W.canonicalUrl?{canonicalUrl:W.canonicalUrl}:{},...$.coverImageUrl?{coverImageUrl:$.coverImageUrl}:{},...$.brandLabel?{brandLabel:$.brandLabel}:{}}}function ch0(w){let $=w.metadata.slug;return $.length>0?$:s1(w.metadata.title)}import{mkdtemp as ah0,rm as sh0}from"fs/promises";import{tmpdir as th0}from"os";import{join as eh0}from"path";G0();V5();G0();import{jsxDEV as oh0}from"preact/jsx-dev-runtime";var Vf="og-image",ih0="blog:og-image",ax=F.object({title:F.string().min(1),excerpt:F.string().optional(),author:F.string().optional(),publishedAt:F.string().optional(),brandLabel:F.string().optional(),coverImageUrl:F.string().optional()}),sx={name:ih0,pluginId:"blog",schema:ax,renderers:{image:nh0}};function dh0(w){if(!w)return;let $=new Date(w);if(Number.isNaN($.getTime()))return;return $.toLocaleDateString("en-GB",{year:"numeric",month:"short",day:"2-digit"})}function nh0(w){let $=ax.parse(w);return oh0(L$,{brandLabel:$.brandLabel??$.title,eyebrow:"Journal",title:$.title,subtitle:$.excerpt,meta:[$.author],tag:dh0($.publishedAt)},void 0,!1,void 0,this)}var wF0={width:1200,height:630},$F0=60000;class DQ{context;screenshotPng;constructor(w,$={}){this.context=w;this.screenshotPng=$.screenshotPng??S$}async resolve(w){if(w.sourceEntityType!=="post"||w.attachmentType!==Vf)return;let $=await this.context.entityService.getEntity({entityType:"post",id:w.sourceEntityId});if(!$)return;let f=fF0($,{brandLabel:this.resolveBrandLabel(),coverImageUrl:await this.resolveCoverImageUrl($)}),X=await ah0(eh0(th0(),"brain-blog-og-image-"));try{let W=await V6({outputDir:X,mediaPath:`/_media/og/post/${$.id}`,template:sx,format:"image",content:f,siteConfig:{title:f.title,themeMode:"light"},themeCSS:this.context.themeCSS}),Y=await N6({rootDir:X});try{return{type:"image",data:await this.screenshotPng(Y.urlFor(W.urlPath),wF0,{timeoutMs:$F0,fullPage:!1,omitBackground:!1}),mimeType:"image/png",filename:`${XF0($)}-og.png`}}finally{await Y.close()}}finally{await sh0(X,{recursive:!0,force:!0})}}resolveBrandLabel(){let w=this.context.domain?.trim();if(w&&w.length>0)return w;let $=this.context.identity.getProfile().name.trim();return $.length>0?$:void 0}async resolveCoverImageUrl(w){let{frontmatter:$}=e2(w.content),f=S1.parse($);if(!f.coverImageId)return;let X=await this.context.entityService.getEntity({entityType:"image",id:f.coverImageId});return X?.content.startsWith("data:image/")?X.content:void 0}}function fF0(w,$={}){let{frontmatter:f}=e2(w.content),X=S1.parse(f);return{title:X.title,...X.excerpt?{excerpt:X.excerpt}:{},...X.author?{author:X.author}:{},...X.publishedAt?{publishedAt:X.publishedAt}:{},...$.coverImageUrl?{coverImageUrl:$.coverImageUrl}:{},...$.brandLabel?{brandLabel:$.brandLabel}:{}}}function XF0(w){let $=w.metadata.slug;return $.length>0?$:s1(w.metadata.title)}var tx={name:"@brains/blog",private:!0,version:"0.2.0-alpha.132",description:"AI-powered blog post generation from existing brain content",type:"module",exports:{".":"./src/index.ts"},scripts:{typecheck:"tsc --noEmit",test:"bun test",lint:"eslint . --ext .ts","lint:fix":"eslint . --ext .ts --fix",eval:"cd evals && bun run brain-eval"},dependencies:{"@brains/atproto-contracts":"workspace:*","@brains/contracts":"workspace:*","@brains/media-page-composer":"workspace:*","@brains/media-renderer":"workspace:*","@brains/plugins":"workspace:*","@brains/ui-library":"workspace:*","@brains/utils":"workspace:*"},devDependencies:{"@brains/app":"workspace:*","@brains/eslint-config":"workspace:*","@brains/typescript-config":"workspace:*","@types/bun":"latest","bun-types":"latest",eslint:"^8.56.0",typescript:"^5.3.3"}};class fm extends e6{entityType=e3.entityType;schema=a9;adapter=e3;unregisterAtprotoProjection;unregisterPrintableAttachmentProvider;unregisterOgImageAttachmentProvider;constructor(w={}){super("blog",tx,w,bK)}getEntityTypeConfig(){return{weight:2,publish:{publishStatuses:["queued","published"]}}}createGenerationHandler(w){return new jK(this.logger.child("BlogGenerationJobHandler"),w)}getTemplates(){return xj()}getDataSources(){return[new SK(this.logger.child("BlogDataSource"))]}async onRegister(w){let{RSSDataSource:$}=await Promise.resolve().then(() => ($m(),wm));w.entities.registerDataSource(new $(this.logger.child("RSSDataSource"))),mj(w,this.logger),lj(w,this.logger),pj(w,this.logger),cj(w),this.unregisterPrintableAttachmentProvider=w.attachments.register("post",XG,new qQ(w)),this.unregisterOgImageAttachmentProvider=w.attachments.register("post",Vf,new DQ(w)),this.deferPublishAssetRegistration(w),this.unregisterAtprotoProjection=Uw.getInstance().register(yF()),this.logger.info("Blog plugin registered (routes auto-generated at /posts/)")}deferPublishAssetRegistration(w){w.messaging.subscribe("system:plugins:ready",async()=>{return await w.messaging.send({type:"publish-assets:register",payload:{entityType:"post",attachmentType:Vf,mediaEntityType:"image",targetEntityField:{location:"frontmatter",field:"ogImageId"},requiredWhen:{status:"published"},autoGenerate:!0,jobType:"image:image-render-source"}}),{success:!0}})}async onShutdown(){this.unregisterPrintableAttachmentProvider?.(),this.unregisterPrintableAttachmentProvider=void 0,this.unregisterOgImageAttachmentProvider?.(),this.unregisterOgImageAttachmentProvider=void 0,this.unregisterAtprotoProjection?.(),this.unregisterAtprotoProjection=void 0}}V5();s9();A1();Ww();G0();A1();Ww();var Xm=F.object({}),WG=m2.extend({id:F.literal("site-info"),entityType:F.literal("site-info"),metadata:Xm}),Nf=HW,E8=hW.omit({url:!0,analyticsScript:!0});A1();class R6 extends f5{constructor(){super({entityType:"site-info",purpose:"Singleton configuration describing the published site.",schema:WG,frontmatterSchema:E8,isSingleton:!0,hasBody:!1})}createSiteInfoContent(w){let $=E8.parse(w);return this.buildMarkdown("",$)}parseSiteInfoBody(w){return this.parseFrontmatter(w)}fromMarkdown(w){return{content:w,entityType:"site-info"}}extractMetadata(w){return{}}generateFrontMatter(w){let $=this.parseFrontmatter(w.content);return this.buildMarkdown("",$)}}var k21=new R6;var y21=new R6;var AF0=new R6;async function xw(w){let f=(await w.listEntities({entityType:"site-info",options:{limit:1}}))[0];if(!f)throw Error("Site info not found \u2014 create a site-info entity");return AF0.parseSiteInfoBody(f.content)}G0();var UF0=E8.extend({navigation:F.object({primary:F.array(F.object({label:F.string(),href:F.string(),priority:F.number()})),secondary:F.array(F.object({label:F.string(),href:F.string(),priority:F.number()}))}),copyright:F.string(),socialLinks:F.array(F.object({platform:F.enum(["github","instagram","linkedin","email","website"]).describe("Social media platform"),url:F.string().describe("Profile or contact URL"),label:F.string().optional().describe("Optional display label")})).optional().describe("Social media links from profile entity")});A1();var YG=x7,D4=v3.extend(YG.shape);A1();Aw();G0();var HF0=new S5;class JG{postsListUrl;id="personal:homepage";name="Personal Homepage DataSource";description="Fetches profile and blog posts for a personal homepage";constructor(w){this.postsListUrl=w}async fetch(w,$,f){let X=f.entityService,[W,Y,J]=await Promise.all([D3(X),X.listEntities({entityType:"post",options:{limit:20}}),xw(X)]),G=HF0.parseProfileBody(W,D4),A=Y.sort(R9).slice(0,6).map(Hw);if(!J.cta)throw Error("CTA not configured in site-info");let H={profile:G,posts:A,postsListUrl:this.postsListUrl,cta:J.cta};return $.parse(H)}}A1();Aw();var KF0=new S5;class GG{id="personal:about";name="About Page DataSource";description="Fetches full profile data for the about page";async fetch(w,$,f){let X=await D3(f.entityService),Y={profile:KF0.parseProfileBody(X,D4)};return $.parse(Y)}}import{jsxDEV as W1,Fragment as Wm}from"preact/jsx-dev-runtime";function hF0(w){return new Date(w).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function FF0(w){return w.split(/(\*[^*]+\*)/).map(($,f)=>{if($.startsWith("*")&&$.endsWith("*")&&$.length>2)return W1("em",{className:"font-sans italic font-medium text-theme-inverse tracking-[-0.015em] [font-variation-settings:'opsz'_72]",children:$.slice(1,-1)},f,!1,void 0,this);return $})}var vQ=({profile:w,posts:$,postsListUrl:f,cta:X})=>{let W=w.tagline??w.description,Y=w.name.split(" ")[0];return W1(Wm,{children:[W1(X2,{title:w.name,description:w.description??W??"Personal site",ogType:"website"},void 0,!1,void 0,this),W1("header",{className:"hero-decor bg-brand text-theme-inverse relative flex flex-col items-center justify-center px-6 md:px-12 pt-32 pb-24 gap-7",children:W1("div",{className:"w-full max-w-[1100px] mx-auto text-center flex flex-col items-center gap-7",children:[W&&W1("h1",{className:"font-heading font-bold text-[clamp(2.5rem,6vw,5rem)] leading-[1.05] tracking-[-0.035em] text-theme-inverse text-balance m-0 [font-variation-settings:'wdth'_90,'opsz'_96]",children:FF0(W)},void 0,!1,void 0,this),w.description&&W1("p",{className:"text-[clamp(1.0625rem,1.4vw,1.3125rem)] leading-[1.5] text-theme-inverse opacity-95 max-w-[600px] mx-auto m-0",children:w.description},void 0,!1,void 0,this),W1("div",{className:"flex flex-wrap justify-center gap-3.5 mt-2",children:[W1("a",{href:f,className:"inline-flex items-center gap-2 rounded-full py-3.5 px-7 bg-theme text-brand border-2 border-theme font-heading font-semibold text-[15px] hover:bg-theme-subtle hover:-translate-y-0.5 transition-all [font-variation-settings:'wdth'_92,'opsz'_18]",children:["Read the Blog ",W1("span",{"aria-hidden":"true",children:"\u2192"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W1("a",{href:"/about",className:"rounded-full py-3.5 px-7 border-2 border-theme-light text-theme-inverse font-heading font-semibold text-[15px] hover:bg-brand-dark hover:border-theme hover:-translate-y-0.5 transition-all [font-variation-settings:'wdth'_92,'opsz'_18]",children:["About ",Y]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.length>0&&W1("section",{className:"flex flex-col py-24 px-6 md:px-12 gap-11 bg-theme-subtle",children:[W1("div",{className:"flex justify-between items-end max-w-layout mx-auto w-full gap-6 flex-wrap",children:[W1("div",{children:[W1("span",{className:"block font-heading font-semibold text-[13px] uppercase tracking-[0.22em] text-brand mb-3 [font-variation-settings:'wdth'_85,'opsz'_12]",children:"The Archive"},void 0,!1,void 0,this),W1("h2",{className:"font-heading font-bold text-[clamp(2.25rem,5vw,3.75rem)] leading-none tracking-[-0.03em] text-heading m-0 [font-variation-settings:'wdth'_92,'opsz'_64]",children:["Recent"," ",W1("em",{className:"font-sans italic font-medium text-brand [font-variation-settings:'opsz'_60]",children:"posts"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W1("a",{href:f,className:"font-heading font-semibold text-[15px] text-brand inline-flex items-center gap-1.5 pb-1.5 border-b-2 border-current hover:text-brand-dark transition-colors [font-variation-settings:'wdth'_88,'opsz'_16]",children:["View the whole archive ",W1("span",{"aria-hidden":"true",children:"\u2192"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W1("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,320px),1fr))] gap-8 max-w-layout mx-auto w-full",children:$.map((J)=>W1("a",{href:J.url,className:"group flex flex-col bg-theme border border-theme rounded-md overflow-hidden hover:-translate-y-1 hover:border-brand/50 transition-all no-underline shadow-sm hover:shadow-lg",children:[J.coverImageUrl?W1("img",{src:J.coverImageUrl,alt:J.metadata.title,className:"w-full aspect-[16/10] object-cover bg-theme-muted"},void 0,!1,void 0,this):W1("div",{className:"w-full aspect-[16/10] bg-gradient-to-br from-brand to-accent","aria-hidden":"true"},void 0,!1,void 0,this),W1("div",{className:"flex flex-col gap-4 p-7 flex-1",children:[W1("div",{className:"flex flex-wrap items-center gap-3.5 font-heading text-[11px] font-semibold uppercase tracking-[0.18em] text-theme-muted [font-variation-settings:'wdth'_85,'opsz'_11]",children:[J.frontmatter.seriesName&&W1(Wm,{children:[W1("span",{className:"text-brand",children:J.frontmatter.seriesName},void 0,!1,void 0,this),W1("span",{className:"w-[3px] h-[3px] rounded-full bg-current opacity-50","aria-hidden":"true"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W1("time",{children:hF0(J.metadata.publishedAt??J.created)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W1("h3",{className:"font-sans font-semibold text-[clamp(1.375rem,1.8vw,1.625rem)] leading-[1.18] tracking-[-0.012em] text-heading m-0 text-balance",children:J.metadata.title},void 0,!1,void 0,this),J.frontmatter.excerpt&&W1("p",{className:"text-base leading-[1.55] text-theme-muted m-0 flex-1",children:J.frontmatter.excerpt},void 0,!1,void 0,this),W1("span",{className:"inline-flex items-center gap-1.5 font-heading font-semibold text-[13px] uppercase tracking-[0.14em] text-brand mt-1 [font-variation-settings:'wdth'_88,'opsz'_14]",children:["Read the post"," ",W1("span",{"aria-hidden":"true",className:"transition-transform group-hover:translate-x-1",children:"\u2192"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},J.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W1("section",{className:"cta-decor bg-theme-dark text-theme-on-dark flex-grow flex flex-col items-center justify-center py-24 px-6 md:px-12 gap-5",children:[W1("span",{className:"font-heading font-medium text-xs uppercase tracking-[0.24em] text-accent [font-variation-settings:'wdth'_85,'opsz'_12]",children:"Get in touch"},void 0,!1,void 0,this),W1("h2",{className:"text-center font-heading font-bold text-[clamp(2rem,4vw,3rem)] leading-none tracking-[-0.03em] text-theme-on-dark m-0 [font-variation-settings:'wdth'_90,'opsz'_64]",children:X.heading},void 0,!1,void 0,this),X.subtitle&&W1("p",{className:"text-center text-base leading-[1.55] text-theme-on-dark opacity-80 max-w-[480px] m-0",children:X.subtitle},void 0,!1,void 0,this),W1("a",{href:X.buttonLink,className:"inline-flex items-center gap-2 rounded-full py-3.5 px-7 bg-brand text-theme-inverse border-2 border-brand font-heading font-semibold text-[15px] hover:bg-brand-dark hover:-translate-y-0.5 transition-all mt-2 [font-variation-settings:'wdth'_92,'opsz'_18]",children:[X.buttonText," ",W1("span",{"aria-hidden":"true",children:"\u2192"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};import{jsxDEV as j2,Fragment as OF0}from"preact/jsx-dev-runtime";var kQ=({profile:w})=>{let $=`About ${w.name}`,f=w.description??w.intro??"About page",X=Boolean(w.email??w.website);return j2(OF0,{children:[j2(X2,{title:$,description:f,ogType:"profile"},void 0,!1,void 0,this),j2("section",{className:"hero-decor bg-brand text-theme-inverse relative flex flex-col px-6 md:px-12 pt-32 pb-24",children:j2("div",{className:"w-full max-w-3xl mx-auto flex flex-col gap-6",children:[j2("h1",{className:"font-heading font-bold text-[clamp(2.5rem,6vw,4.5rem)] leading-[1.05] tracking-[-0.035em] text-theme-inverse text-balance m-0 [font-variation-settings:'wdth'_90,'opsz'_96]",children:w.name},void 0,!1,void 0,this),w.description&&j2("p",{className:"text-[clamp(1.0625rem,1.4vw,1.25rem)] leading-[1.55] text-theme-inverse opacity-95 max-w-2xl m-0",children:w.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),w.story&&j2("section",{className:`py-24 px-6 md:px-12 bg-theme-subtle${X?"":" flex-grow"}`,children:j2("div",{className:"max-w-3xl mx-auto",children:j2(H6,{markdown:w.story},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),X&&j2("section",{className:"cta-decor bg-theme-dark text-theme-on-dark flex-grow flex flex-col items-center justify-center py-24 px-6 md:px-12 gap-5",children:[j2("span",{className:"font-heading font-medium text-xs uppercase tracking-[0.24em] text-accent [font-variation-settings:'wdth'_85,'opsz'_12]",children:"Get in touch"},void 0,!1,void 0,this),j2("h2",{className:"text-center font-heading font-bold text-[clamp(2rem,4vw,3rem)] leading-none tracking-[-0.03em] text-theme-on-dark m-0 [font-variation-settings:'wdth'_90,'opsz'_64]",children:["Say"," ",j2("em",{className:"font-sans italic font-medium text-accent [font-variation-settings:'opsz'_72]",children:"hi."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j2("div",{className:"flex flex-wrap justify-center gap-3.5 mt-2",children:[w.email&&j2("a",{href:`mailto:${w.email}`,className:"inline-flex items-center gap-2 rounded-full py-3.5 px-7 bg-brand text-theme-inverse border-2 border-brand font-heading font-semibold text-[15px] hover:bg-brand-dark hover:-translate-y-0.5 transition-all [font-variation-settings:'wdth'_92,'opsz'_18]",children:["Get in Touch ",j2("span",{"aria-hidden":"true",children:"\u2192"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w.website&&j2("a",{href:w.website,className:"rounded-full py-3.5 px-7 border-2 border-theme-light text-theme-on-dark font-heading font-semibold text-[15px] hover:bg-brand-dark hover:border-theme hover:-translate-y-0.5 transition-all [font-variation-settings:'wdth'_92,'opsz'_18]",children:"Website"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};var Ym={name:"@brains/site-personal",private:!0,version:"0.2.0-alpha.132",description:"Personal site composition package",type:"module",exports:{".":"./src/index.ts"},files:["src"],scripts:{typecheck:"tsc --noEmit",lint:"eslint . --ext .ts","lint:fix":"eslint . --ext .ts --fix"},dependencies:{"@brains/blog":"workspace:*","@brains/identity-service":"workspace:*","@brains/plugins":"workspace:*","@brains/site-composition":"workspace:*","@brains/site-engine":"workspace:*","@brains/site-info":"workspace:*","@brains/templates":"workspace:*","@brains/ui-library":"workspace:*","@brains/utils":"workspace:*",preact:"^10.27.2"},devDependencies:{"@brains/eslint-config":"workspace:*","@brains/typescript-config":"workspace:*","@types/bun":"latest","bun-types":"latest",eslint:"^8.56.0",typescript:"^5.3.3"}};var ZF0=F.object({entityDisplay:F.object({post:F.object({label:F.string().default("Post"),pluralName:F.string().optional()}).default({})}).default({})});class PQ extends i9{dependencies=["blog"];constructor(w={}){super("personal-site",Ym,w,ZF0)}async onRegister(w){w.entities.extendFrontmatterSchema("anchor-profile",YG);let $=this.config.entityDisplay.post,f=`/${$.pluralName??$.label.toLowerCase()+"s"}`,X=new JG(f);w.entities.registerDataSource(X);let W=new GG;w.entities.registerDataSource(W);let Y=F.object({profile:D4,posts:F.array(s5),postsListUrl:F.string(),cta:Nf}),J=F.object({profile:D4});w.templates.register({homepage:E1({name:"homepage",description:"Personal homepage with recent blog posts",schema:Y,dataSourceId:"personal:homepage",requiredPermission:"public",layout:{component:vQ}}),about:E1({name:"about",description:"About page with profile",schema:J,dataSourceId:"personal:about",requiredPermission:"public",layout:{component:kQ}})}),this.logger.info("Personal site plugin registered successfully")}async getTools(){return[]}async getResources(){return[]}}function LQ(w){return new PQ(w??{})}var _Q=[{id:"home",path:"/",title:"Home",description:"Personal site homepage",layout:"default",navigation:{show:!0,label:"Home",slot:"secondary",priority:10},sections:[{id:"homepage",template:"personal-site:homepage",dataQuery:{}}]},{id:"about",path:"/about",title:"About",description:"About page",layout:"default",navigation:{show:!0,label:"About",slot:"primary",priority:90},sections:[{id:"about",template:"personal-site:about",dataQuery:{}}]}];import{jsxDEV as L5}from"preact/jsx-dev-runtime";function TQ({sections:w,siteInfo:$}){let f=[...$.navigation.primary,...$.navigation.secondary].filter((X)=>X.label!=="Home");return L5("div",{className:"flex flex-col min-h-screen bg-theme overflow-x-clip",children:[L5(P$,{title:$.title,titleClassName:"font-heading font-bold text-2xl",navigation:$.navigation.primary,showThemeToggle:!0,themeToggleClassName:"bg-theme-toggle text-theme-toggle-icon hover:bg-theme-toggle-hover rounded-[10px]",...$.logo!==void 0?{logo:$.logo}:{}},void 0,!1,void 0,this),L5("main",{className:"flex-grow flex flex-col",children:w},void 0,!1,void 0,this),L5("footer",{className:"bg-footer text-footer border-t border-theme",children:L5("div",{className:"max-w-layout mx-auto flex flex-col md:flex-row justify-between items-center py-8 px-6 md:px-8",children:[L5("div",{className:"flex flex-col gap-1 mb-4 md:mb-0",children:[L5("span",{className:"text-brand font-heading font-bold text-lg",children:$.title},void 0,!1,void 0,this),$.description&&L5("span",{className:"text-theme-muted text-xs",children:$.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L5("nav",{className:"flex flex-wrap justify-center gap-x-6 gap-y-2 mb-4 md:mb-0",children:f.map((X)=>L5("a",{href:X.href,className:"text-theme-muted text-[13px] hover:text-brand transition-colors",children:X.label},X.href,!1,void 0,this))},void 0,!1,void 0,this),L5("div",{className:"flex items-center gap-4",children:[$.copyright&&L5("span",{className:"text-theme-light text-[11px]",children:$.copyright},void 0,!1,void 0,this),L5(W4,{variant:"footer",size:"sm"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}A1();G0();j5();A1();G0();A1();G0();G0();A1();var zF0=F.enum(["generating","draft","queued","published","failed"]),Jm="publishedAt is required when deck status is published",Gm=(w)=>w.status==="published"&&!w.publishedAt,EQ=(w)=>{if(Gm(w))throw Error(Jm)},g5=F.object({title:F.string(),slug:F.string().optional(),description:F.string().optional(),author:F.string().optional(),status:zF0,publishedAt:F.string().datetime().optional(),event:F.string().optional(),coverImageId:F.string().optional(),ogImageId:F.string().optional()}),MF0=g5.pick({title:!0,description:!0,status:!0,publishedAt:!0,coverImageId:!0}).extend({slug:F.string(),error:F.string().optional()}).superRefine((w,$)=>{if(!Gm(w))return;$.addIssue({code:F.ZodIssueCode.custom,path:["publishedAt"],message:Jm})}),b8=m2.extend({entityType:F.literal("deck"),metadata:MF0}),AG=b8.extend({frontmatter:g5,body:F.string(),ogImageUrl:F.string().optional()}),mw=AG.extend({url:F.string().optional(),typeLabel:F.string().optional(),listUrl:F.string().optional(),listLabel:F.string().optional(),coverImageUrl:F.string().optional(),ogImageUrl:F.string().optional(),coverImageWidth:F.number().optional(),coverImageHeight:F.number().optional()});class bQ extends f5{constructor(){super({entityType:"deck",purpose:"A slide-deck presentation.",schema:b8,frontmatterSchema:g5,supportsCoverImage:!0})}validateSlideStructure(w){if(!/^---$/gm.test(w))throw Error("Invalid deck: markdown must contain slide separators (---) to be a valid presentation")}toMarkdown(w){let $=this.extractBody(w.content);this.validateSlideStructure($);let f=this.parseFrontMatter(w.content,g5);EQ(f);let X={...f,slug:f.slug??w.metadata.slug};return this.buildMarkdown($,X)}fromMarkdown(w){let $=this.parseFrontmatter(w),f=this.extractBody(w);EQ($),this.validateSlideStructure(f);let X=$.slug??s1($.title),W=$.status;return{entityType:"deck",content:w,metadata:{slug:X,title:$.title,description:$.description,status:W,publishedAt:$.publishedAt,coverImageId:$.coverImageId}}}generateTitle(w){return w.metadata.title}generateSummary(w){if(w.metadata.description)return w.metadata.description;return`Presentation: ${w.metadata.title}`}generateFrontMatter(w){return this.toMarkdown(w)}buildStub(w){let $={title:w.title,slug:w.id,status:"generating"};return{content:this.buildMarkdown(`---
|
|
1492
|
+
`}},void 0,!1,void 0,this),b2("header",{className:"printable-hero",children:[b2("div",{className:"printable-masthead",children:$.brandLabel&&b2("p",{className:"printable-kicker",children:$.brandLabel},void 0,!1,void 0,this)},void 0,!1,void 0,this),b2("div",{children:[b2("h1",{className:"printable-title",children:$.title},void 0,!1,void 0,this),$.excerpt&&b2("p",{className:"printable-excerpt",children:$.excerpt},void 0,!1,void 0,this),b2("div",{className:"printable-meta",children:[$.author&&b2("span",{children:["By ",$.author]},void 0,!0,void 0,this),f&&b2("span",{children:f},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.coverImageUrl&&b2("figure",{className:"printable-cover-wrap",children:b2("img",{className:"printable-cover",src:$.coverImageUrl,alt:""},void 0,!1,void 0,this)},void 0,!1,void 0,this),b2(H6,{markdown:$.body,className:"printable-body"},void 0,!1,void 0,this),($.canonicalUrl||$.brandLabel)&&b2("footer",{className:"printable-footer",children:[b2("span",{children:$.brandLabel??"Printable PDF"},void 0,!1,void 0,this),$.canonicalUrl&&b2("a",{href:$.canonicalUrl,children:$.canonicalUrl},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var lh0=26214400,rh0=60000;class qQ{context;metadata={outputEntityType:"document"};renderPdf;constructor(w,$={}){this.context=w;this.renderPdf=$.renderPdf??C$}async resolve(w){if(w.sourceEntityType!=="post"||w.attachmentType!==XG)return;let $=await this.context.entityService.getEntity({entityType:"post",id:w.sourceEntityId});if(!$)return;let f=ph0($,{brandLabel:this.resolveBrandLabel(),coverImageUrl:await this.resolveCoverImageUrl($)}),X=await yh0(mh0(xh0(),"brain-blog-printable-"));try{let W=await V6({outputDir:X,mediaPath:`/_media/printable/post/${$.id}`,template:ox,format:"pdf",content:f,siteConfig:{title:f.title,themeMode:"light"},themeCSS:this.context.themeCSS}),Y=await N6({rootDir:X});try{return{type:"document",data:await this.renderPdf(Y.urlFor(W.urlPath),{maxBytes:lh0,timeoutMs:rh0,printBackground:!0,preferCSSPageSize:!0}),mimeType:"application/pdf",filename:`${ch0($)}-printable.pdf`}}finally{await Y.close()}}finally{await gh0(X,{recursive:!0,force:!0})}}resolveBrandLabel(){let w=this.context.domain?.trim();if(w&&w.length>0)return w;let $=this.context.identity.getProfile().name.trim();return $.length>0?$:void 0}async resolveCoverImageUrl(w){let{frontmatter:$}=e2(w.content),f=S1.parse($);if(!f.coverImageId)return;let X=await this.context.entityService.getEntity({entityType:"image",id:f.coverImageId});return X?.content.startsWith("data:image/")?X.content:void 0}}function ph0(w,$={}){let{frontmatter:f,content:X}=e2(w.content),W=S1.parse(f);return{title:W.title,body:X,...W.excerpt?{excerpt:W.excerpt}:{},...W.author?{author:W.author}:{},...W.publishedAt?{publishedAt:W.publishedAt}:{},...W.canonicalUrl?{canonicalUrl:W.canonicalUrl}:{},...$.coverImageUrl?{coverImageUrl:$.coverImageUrl}:{},...$.brandLabel?{brandLabel:$.brandLabel}:{}}}function ch0(w){let $=w.metadata.slug;return $.length>0?$:s1(w.metadata.title)}import{mkdtemp as ah0,rm as sh0}from"fs/promises";import{tmpdir as th0}from"os";import{join as eh0}from"path";G0();V5();G0();import{jsxDEV as oh0}from"preact/jsx-dev-runtime";var Vf="og-image",ih0="blog:og-image",ax=F.object({title:F.string().min(1),excerpt:F.string().optional(),author:F.string().optional(),publishedAt:F.string().optional(),brandLabel:F.string().optional(),coverImageUrl:F.string().optional()}),sx={name:ih0,pluginId:"blog",schema:ax,renderers:{image:nh0}};function dh0(w){if(!w)return;let $=new Date(w);if(Number.isNaN($.getTime()))return;return $.toLocaleDateString("en-GB",{year:"numeric",month:"short",day:"2-digit"})}function nh0(w){let $=ax.parse(w);return oh0(L$,{brandLabel:$.brandLabel??$.title,eyebrow:"Journal",title:$.title,subtitle:$.excerpt,meta:[$.author],tag:dh0($.publishedAt)},void 0,!1,void 0,this)}var wF0={width:1200,height:630},$F0=60000;class DQ{context;metadata={outputEntityType:"image",targetField:"ogImageId"};screenshotPng;constructor(w,$={}){this.context=w;this.screenshotPng=$.screenshotPng??S$}async resolve(w){if(w.sourceEntityType!=="post"||w.attachmentType!==Vf)return;let $=await this.context.entityService.getEntity({entityType:"post",id:w.sourceEntityId});if(!$)return;let f=fF0($,{brandLabel:this.resolveBrandLabel(),coverImageUrl:await this.resolveCoverImageUrl($)}),X=await ah0(eh0(th0(),"brain-blog-og-image-"));try{let W=await V6({outputDir:X,mediaPath:`/_media/og/post/${$.id}`,template:sx,format:"image",content:f,siteConfig:{title:f.title,themeMode:"light"},themeCSS:this.context.themeCSS}),Y=await N6({rootDir:X});try{return{type:"image",data:await this.screenshotPng(Y.urlFor(W.urlPath),wF0,{timeoutMs:$F0,fullPage:!1,omitBackground:!1}),mimeType:"image/png",filename:`${XF0($)}-og.png`}}finally{await Y.close()}}finally{await sh0(X,{recursive:!0,force:!0})}}resolveBrandLabel(){let w=this.context.domain?.trim();if(w&&w.length>0)return w;let $=this.context.identity.getProfile().name.trim();return $.length>0?$:void 0}async resolveCoverImageUrl(w){let{frontmatter:$}=e2(w.content),f=S1.parse($);if(!f.coverImageId)return;let X=await this.context.entityService.getEntity({entityType:"image",id:f.coverImageId});return X?.content.startsWith("data:image/")?X.content:void 0}}function fF0(w,$={}){let{frontmatter:f}=e2(w.content),X=S1.parse(f);return{title:X.title,...X.excerpt?{excerpt:X.excerpt}:{},...X.author?{author:X.author}:{},...X.publishedAt?{publishedAt:X.publishedAt}:{},...$.coverImageUrl?{coverImageUrl:$.coverImageUrl}:{},...$.brandLabel?{brandLabel:$.brandLabel}:{}}}function XF0(w){let $=w.metadata.slug;return $.length>0?$:s1(w.metadata.title)}var tx={name:"@brains/blog",private:!0,version:"0.2.0-alpha.134",description:"AI-powered blog post generation from existing brain content",type:"module",exports:{".":"./src/index.ts"},scripts:{typecheck:"tsc --noEmit",test:"bun test",lint:"eslint . --ext .ts","lint:fix":"eslint . --ext .ts --fix",eval:"cd evals && bun run brain-eval"},dependencies:{"@brains/atproto-contracts":"workspace:*","@brains/contracts":"workspace:*","@brains/media-page-composer":"workspace:*","@brains/media-renderer":"workspace:*","@brains/plugins":"workspace:*","@brains/ui-library":"workspace:*","@brains/utils":"workspace:*"},devDependencies:{"@brains/app":"workspace:*","@brains/eslint-config":"workspace:*","@brains/typescript-config":"workspace:*","@types/bun":"latest","bun-types":"latest",eslint:"^8.56.0",typescript:"^5.3.3"}};class fm extends e6{entityType=e3.entityType;schema=a9;adapter=e3;unregisterAtprotoProjection;unregisterPrintableAttachmentProvider;unregisterOgImageAttachmentProvider;constructor(w={}){super("blog",tx,w,bK)}getEntityTypeConfig(){return{weight:2,publish:{publishStatuses:["queued","published"]}}}createGenerationHandler(w){return new jK(this.logger.child("BlogGenerationJobHandler"),w)}getTemplates(){return xj()}getDataSources(){return[new SK(this.logger.child("BlogDataSource"))]}async onRegister(w){let{RSSDataSource:$}=await Promise.resolve().then(() => ($m(),wm));w.entities.registerDataSource(new $(this.logger.child("RSSDataSource"))),mj(w,this.logger),lj(w,this.logger),pj(w,this.logger),cj(w),this.unregisterPrintableAttachmentProvider=w.attachments.register("post",XG,new qQ(w)),this.unregisterOgImageAttachmentProvider=w.attachments.register("post",Vf,new DQ(w)),this.deferPublishAssetRegistration(w),this.unregisterAtprotoProjection=Uw.getInstance().register(yF()),this.logger.info("Blog plugin registered (routes auto-generated at /posts/)")}deferPublishAssetRegistration(w){w.messaging.subscribe("system:plugins:ready",async()=>{return await w.messaging.send({type:"publish-assets:register",payload:{entityType:"post",attachmentType:Vf,mediaEntityType:"image",targetEntityField:{location:"frontmatter",field:"ogImageId"},requiredWhen:{status:"published"},autoGenerate:!0,jobType:"image:image-render-source"}}),{success:!0}})}async onShutdown(){this.unregisterPrintableAttachmentProvider?.(),this.unregisterPrintableAttachmentProvider=void 0,this.unregisterOgImageAttachmentProvider?.(),this.unregisterOgImageAttachmentProvider=void 0,this.unregisterAtprotoProjection?.(),this.unregisterAtprotoProjection=void 0}}V5();s9();A1();Ww();G0();A1();Ww();var Xm=F.object({}),WG=m2.extend({id:F.literal("site-info"),entityType:F.literal("site-info"),metadata:Xm}),Nf=HW,E8=hW.omit({url:!0,analyticsScript:!0});A1();class R6 extends f5{constructor(){super({entityType:"site-info",purpose:"Singleton configuration describing the published site.",schema:WG,frontmatterSchema:E8,isSingleton:!0,hasBody:!1})}createSiteInfoContent(w){let $=E8.parse(w);return this.buildMarkdown("",$)}parseSiteInfoBody(w){return this.parseFrontmatter(w)}fromMarkdown(w){return{content:w,entityType:"site-info"}}extractMetadata(w){return{}}generateFrontMatter(w){let $=this.parseFrontmatter(w.content);return this.buildMarkdown("",$)}}var k21=new R6;var y21=new R6;var AF0=new R6;async function xw(w){let f=(await w.listEntities({entityType:"site-info",options:{limit:1}}))[0];if(!f)throw Error("Site info not found \u2014 create a site-info entity");return AF0.parseSiteInfoBody(f.content)}G0();var UF0=E8.extend({navigation:F.object({primary:F.array(F.object({label:F.string(),href:F.string(),priority:F.number()})),secondary:F.array(F.object({label:F.string(),href:F.string(),priority:F.number()}))}),copyright:F.string(),socialLinks:F.array(F.object({platform:F.enum(["github","instagram","linkedin","email","website"]).describe("Social media platform"),url:F.string().describe("Profile or contact URL"),label:F.string().optional().describe("Optional display label")})).optional().describe("Social media links from profile entity")});A1();var YG=x7,D4=v3.extend(YG.shape);A1();Aw();G0();var HF0=new S5;class JG{postsListUrl;id="personal:homepage";name="Personal Homepage DataSource";description="Fetches profile and blog posts for a personal homepage";constructor(w){this.postsListUrl=w}async fetch(w,$,f){let X=f.entityService,[W,Y,J]=await Promise.all([D3(X),X.listEntities({entityType:"post",options:{limit:20}}),xw(X)]),G=HF0.parseProfileBody(W,D4),A=Y.sort(R9).slice(0,6).map(Hw);if(!J.cta)throw Error("CTA not configured in site-info");let H={profile:G,posts:A,postsListUrl:this.postsListUrl,cta:J.cta};return $.parse(H)}}A1();Aw();var KF0=new S5;class GG{id="personal:about";name="About Page DataSource";description="Fetches full profile data for the about page";async fetch(w,$,f){let X=await D3(f.entityService),Y={profile:KF0.parseProfileBody(X,D4)};return $.parse(Y)}}import{jsxDEV as W1,Fragment as Wm}from"preact/jsx-dev-runtime";function hF0(w){return new Date(w).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function FF0(w){return w.split(/(\*[^*]+\*)/).map(($,f)=>{if($.startsWith("*")&&$.endsWith("*")&&$.length>2)return W1("em",{className:"font-sans italic font-medium text-theme-inverse tracking-[-0.015em] [font-variation-settings:'opsz'_72]",children:$.slice(1,-1)},f,!1,void 0,this);return $})}var vQ=({profile:w,posts:$,postsListUrl:f,cta:X})=>{let W=w.tagline??w.description,Y=w.name.split(" ")[0];return W1(Wm,{children:[W1(X2,{title:w.name,description:w.description??W??"Personal site",ogType:"website"},void 0,!1,void 0,this),W1("header",{className:"hero-decor bg-brand text-theme-inverse relative flex flex-col items-center justify-center px-6 md:px-12 pt-32 pb-24 gap-7",children:W1("div",{className:"w-full max-w-[1100px] mx-auto text-center flex flex-col items-center gap-7",children:[W&&W1("h1",{className:"font-heading font-bold text-[clamp(2.5rem,6vw,5rem)] leading-[1.05] tracking-[-0.035em] text-theme-inverse text-balance m-0 [font-variation-settings:'wdth'_90,'opsz'_96]",children:FF0(W)},void 0,!1,void 0,this),w.description&&W1("p",{className:"text-[clamp(1.0625rem,1.4vw,1.3125rem)] leading-[1.5] text-theme-inverse opacity-95 max-w-[600px] mx-auto m-0",children:w.description},void 0,!1,void 0,this),W1("div",{className:"flex flex-wrap justify-center gap-3.5 mt-2",children:[W1("a",{href:f,className:"inline-flex items-center gap-2 rounded-full py-3.5 px-7 bg-theme text-brand border-2 border-theme font-heading font-semibold text-[15px] hover:bg-theme-subtle hover:-translate-y-0.5 transition-all [font-variation-settings:'wdth'_92,'opsz'_18]",children:["Read the Blog ",W1("span",{"aria-hidden":"true",children:"\u2192"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W1("a",{href:"/about",className:"rounded-full py-3.5 px-7 border-2 border-theme-light text-theme-inverse font-heading font-semibold text-[15px] hover:bg-brand-dark hover:border-theme hover:-translate-y-0.5 transition-all [font-variation-settings:'wdth'_92,'opsz'_18]",children:["About ",Y]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),$.length>0&&W1("section",{className:"flex flex-col py-24 px-6 md:px-12 gap-11 bg-theme-subtle",children:[W1("div",{className:"flex justify-between items-end max-w-layout mx-auto w-full gap-6 flex-wrap",children:[W1("div",{children:[W1("span",{className:"block font-heading font-semibold text-[13px] uppercase tracking-[0.22em] text-brand mb-3 [font-variation-settings:'wdth'_85,'opsz'_12]",children:"The Archive"},void 0,!1,void 0,this),W1("h2",{className:"font-heading font-bold text-[clamp(2.25rem,5vw,3.75rem)] leading-none tracking-[-0.03em] text-heading m-0 [font-variation-settings:'wdth'_92,'opsz'_64]",children:["Recent"," ",W1("em",{className:"font-sans italic font-medium text-brand [font-variation-settings:'opsz'_60]",children:"posts"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W1("a",{href:f,className:"font-heading font-semibold text-[15px] text-brand inline-flex items-center gap-1.5 pb-1.5 border-b-2 border-current hover:text-brand-dark transition-colors [font-variation-settings:'wdth'_88,'opsz'_16]",children:["View the whole archive ",W1("span",{"aria-hidden":"true",children:"\u2192"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),W1("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,320px),1fr))] gap-8 max-w-layout mx-auto w-full",children:$.map((J)=>W1("a",{href:J.url,className:"group flex flex-col bg-theme border border-theme rounded-md overflow-hidden hover:-translate-y-1 hover:border-brand/50 transition-all no-underline shadow-sm hover:shadow-lg",children:[J.coverImageUrl?W1("img",{src:J.coverImageUrl,alt:J.metadata.title,className:"w-full aspect-[16/10] object-cover bg-theme-muted"},void 0,!1,void 0,this):W1("div",{className:"w-full aspect-[16/10] bg-gradient-to-br from-brand to-accent","aria-hidden":"true"},void 0,!1,void 0,this),W1("div",{className:"flex flex-col gap-4 p-7 flex-1",children:[W1("div",{className:"flex flex-wrap items-center gap-3.5 font-heading text-[11px] font-semibold uppercase tracking-[0.18em] text-theme-muted [font-variation-settings:'wdth'_85,'opsz'_11]",children:[J.frontmatter.seriesName&&W1(Wm,{children:[W1("span",{className:"text-brand",children:J.frontmatter.seriesName},void 0,!1,void 0,this),W1("span",{className:"w-[3px] h-[3px] rounded-full bg-current opacity-50","aria-hidden":"true"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W1("time",{children:hF0(J.metadata.publishedAt??J.created)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W1("h3",{className:"font-sans font-semibold text-[clamp(1.375rem,1.8vw,1.625rem)] leading-[1.18] tracking-[-0.012em] text-heading m-0 text-balance",children:J.metadata.title},void 0,!1,void 0,this),J.frontmatter.excerpt&&W1("p",{className:"text-base leading-[1.55] text-theme-muted m-0 flex-1",children:J.frontmatter.excerpt},void 0,!1,void 0,this),W1("span",{className:"inline-flex items-center gap-1.5 font-heading font-semibold text-[13px] uppercase tracking-[0.14em] text-brand mt-1 [font-variation-settings:'wdth'_88,'opsz'_14]",children:["Read the post"," ",W1("span",{"aria-hidden":"true",className:"transition-transform group-hover:translate-x-1",children:"\u2192"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},J.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W1("section",{className:"cta-decor bg-theme-dark text-theme-on-dark flex-grow flex flex-col items-center justify-center py-24 px-6 md:px-12 gap-5",children:[W1("span",{className:"font-heading font-medium text-xs uppercase tracking-[0.24em] text-accent [font-variation-settings:'wdth'_85,'opsz'_12]",children:"Get in touch"},void 0,!1,void 0,this),W1("h2",{className:"text-center font-heading font-bold text-[clamp(2rem,4vw,3rem)] leading-none tracking-[-0.03em] text-theme-on-dark m-0 [font-variation-settings:'wdth'_90,'opsz'_64]",children:X.heading},void 0,!1,void 0,this),X.subtitle&&W1("p",{className:"text-center text-base leading-[1.55] text-theme-on-dark opacity-80 max-w-[480px] m-0",children:X.subtitle},void 0,!1,void 0,this),W1("a",{href:X.buttonLink,className:"inline-flex items-center gap-2 rounded-full py-3.5 px-7 bg-brand text-theme-inverse border-2 border-brand font-heading font-semibold text-[15px] hover:bg-brand-dark hover:-translate-y-0.5 transition-all mt-2 [font-variation-settings:'wdth'_92,'opsz'_18]",children:[X.buttonText," ",W1("span",{"aria-hidden":"true",children:"\u2192"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};import{jsxDEV as j2,Fragment as OF0}from"preact/jsx-dev-runtime";var kQ=({profile:w})=>{let $=`About ${w.name}`,f=w.description??w.intro??"About page",X=Boolean(w.email??w.website);return j2(OF0,{children:[j2(X2,{title:$,description:f,ogType:"profile"},void 0,!1,void 0,this),j2("section",{className:"hero-decor bg-brand text-theme-inverse relative flex flex-col px-6 md:px-12 pt-32 pb-24",children:j2("div",{className:"w-full max-w-3xl mx-auto flex flex-col gap-6",children:[j2("h1",{className:"font-heading font-bold text-[clamp(2.5rem,6vw,4.5rem)] leading-[1.05] tracking-[-0.035em] text-theme-inverse text-balance m-0 [font-variation-settings:'wdth'_90,'opsz'_96]",children:w.name},void 0,!1,void 0,this),w.description&&j2("p",{className:"text-[clamp(1.0625rem,1.4vw,1.25rem)] leading-[1.55] text-theme-inverse opacity-95 max-w-2xl m-0",children:w.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),w.story&&j2("section",{className:`py-24 px-6 md:px-12 bg-theme-subtle${X?"":" flex-grow"}`,children:j2("div",{className:"max-w-3xl mx-auto",children:j2(H6,{markdown:w.story},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),X&&j2("section",{className:"cta-decor bg-theme-dark text-theme-on-dark flex-grow flex flex-col items-center justify-center py-24 px-6 md:px-12 gap-5",children:[j2("span",{className:"font-heading font-medium text-xs uppercase tracking-[0.24em] text-accent [font-variation-settings:'wdth'_85,'opsz'_12]",children:"Get in touch"},void 0,!1,void 0,this),j2("h2",{className:"text-center font-heading font-bold text-[clamp(2rem,4vw,3rem)] leading-none tracking-[-0.03em] text-theme-on-dark m-0 [font-variation-settings:'wdth'_90,'opsz'_64]",children:["Say"," ",j2("em",{className:"font-sans italic font-medium text-accent [font-variation-settings:'opsz'_72]",children:"hi."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),j2("div",{className:"flex flex-wrap justify-center gap-3.5 mt-2",children:[w.email&&j2("a",{href:`mailto:${w.email}`,className:"inline-flex items-center gap-2 rounded-full py-3.5 px-7 bg-brand text-theme-inverse border-2 border-brand font-heading font-semibold text-[15px] hover:bg-brand-dark hover:-translate-y-0.5 transition-all [font-variation-settings:'wdth'_92,'opsz'_18]",children:["Get in Touch ",j2("span",{"aria-hidden":"true",children:"\u2192"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w.website&&j2("a",{href:w.website,className:"rounded-full py-3.5 px-7 border-2 border-theme-light text-theme-on-dark font-heading font-semibold text-[15px] hover:bg-brand-dark hover:border-theme hover:-translate-y-0.5 transition-all [font-variation-settings:'wdth'_92,'opsz'_18]",children:"Website"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};var Ym={name:"@brains/site-personal",private:!0,version:"0.2.0-alpha.134",description:"Personal site composition package",type:"module",exports:{".":"./src/index.ts"},files:["src"],scripts:{typecheck:"tsc --noEmit",lint:"eslint . --ext .ts","lint:fix":"eslint . --ext .ts --fix"},dependencies:{"@brains/blog":"workspace:*","@brains/identity-service":"workspace:*","@brains/plugins":"workspace:*","@brains/site-composition":"workspace:*","@brains/site-engine":"workspace:*","@brains/site-info":"workspace:*","@brains/templates":"workspace:*","@brains/ui-library":"workspace:*","@brains/utils":"workspace:*",preact:"^10.27.2"},devDependencies:{"@brains/eslint-config":"workspace:*","@brains/typescript-config":"workspace:*","@types/bun":"latest","bun-types":"latest",eslint:"^8.56.0",typescript:"^5.3.3"}};var ZF0=F.object({entityDisplay:F.object({post:F.object({label:F.string().default("Post"),pluralName:F.string().optional()}).default({})}).default({})});class PQ extends i9{dependencies=["blog"];constructor(w={}){super("personal-site",Ym,w,ZF0)}async onRegister(w){w.entities.extendFrontmatterSchema("anchor-profile",YG);let $=this.config.entityDisplay.post,f=`/${$.pluralName??$.label.toLowerCase()+"s"}`,X=new JG(f);w.entities.registerDataSource(X);let W=new GG;w.entities.registerDataSource(W);let Y=F.object({profile:D4,posts:F.array(s5),postsListUrl:F.string(),cta:Nf}),J=F.object({profile:D4});w.templates.register({homepage:E1({name:"homepage",description:"Personal homepage with recent blog posts",schema:Y,dataSourceId:"personal:homepage",requiredPermission:"public",layout:{component:vQ}}),about:E1({name:"about",description:"About page with profile",schema:J,dataSourceId:"personal:about",requiredPermission:"public",layout:{component:kQ}})}),this.logger.info("Personal site plugin registered successfully")}async getTools(){return[]}async getResources(){return[]}}function LQ(w){return new PQ(w??{})}var _Q=[{id:"home",path:"/",title:"Home",description:"Personal site homepage",layout:"default",navigation:{show:!0,label:"Home",slot:"secondary",priority:10},sections:[{id:"homepage",template:"personal-site:homepage",dataQuery:{}}]},{id:"about",path:"/about",title:"About",description:"About page",layout:"default",navigation:{show:!0,label:"About",slot:"primary",priority:90},sections:[{id:"about",template:"personal-site:about",dataQuery:{}}]}];import{jsxDEV as L5}from"preact/jsx-dev-runtime";function TQ({sections:w,siteInfo:$}){let f=[...$.navigation.primary,...$.navigation.secondary].filter((X)=>X.label!=="Home");return L5("div",{className:"flex flex-col min-h-screen bg-theme overflow-x-clip",children:[L5(P$,{title:$.title,titleClassName:"font-heading font-bold text-2xl",navigation:$.navigation.primary,showThemeToggle:!0,themeToggleClassName:"bg-theme-toggle text-theme-toggle-icon hover:bg-theme-toggle-hover rounded-[10px]",...$.logo!==void 0?{logo:$.logo}:{}},void 0,!1,void 0,this),L5("main",{className:"flex-grow flex flex-col",children:w},void 0,!1,void 0,this),L5("footer",{className:"bg-footer text-footer border-t border-theme",children:L5("div",{className:"max-w-layout mx-auto flex flex-col md:flex-row justify-between items-center py-8 px-6 md:px-8",children:[L5("div",{className:"flex flex-col gap-1 mb-4 md:mb-0",children:[L5("span",{className:"text-brand font-heading font-bold text-lg",children:$.title},void 0,!1,void 0,this),$.description&&L5("span",{className:"text-theme-muted text-xs",children:$.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),L5("nav",{className:"flex flex-wrap justify-center gap-x-6 gap-y-2 mb-4 md:mb-0",children:f.map((X)=>L5("a",{href:X.href,className:"text-theme-muted text-[13px] hover:text-brand transition-colors",children:X.label},X.href,!1,void 0,this))},void 0,!1,void 0,this),L5("div",{className:"flex items-center gap-4",children:[$.copyright&&L5("span",{className:"text-theme-light text-[11px]",children:$.copyright},void 0,!1,void 0,this),L5(W4,{variant:"footer",size:"sm"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}A1();G0();j5();A1();G0();A1();G0();G0();A1();var zF0=F.enum(["generating","draft","queued","published","failed"]),Jm="publishedAt is required when deck status is published",Gm=(w)=>w.status==="published"&&!w.publishedAt,EQ=(w)=>{if(Gm(w))throw Error(Jm)},g5=F.object({title:F.string(),slug:F.string().optional(),description:F.string().optional(),author:F.string().optional(),status:zF0,publishedAt:F.string().datetime().optional(),event:F.string().optional(),coverImageId:F.string().optional(),ogImageId:F.string().optional()}),MF0=g5.pick({title:!0,description:!0,status:!0,publishedAt:!0,coverImageId:!0}).extend({slug:F.string(),error:F.string().optional()}).superRefine((w,$)=>{if(!Gm(w))return;$.addIssue({code:F.ZodIssueCode.custom,path:["publishedAt"],message:Jm})}),b8=m2.extend({entityType:F.literal("deck"),metadata:MF0}),AG=b8.extend({frontmatter:g5,body:F.string(),ogImageUrl:F.string().optional()}),mw=AG.extend({url:F.string().optional(),typeLabel:F.string().optional(),listUrl:F.string().optional(),listLabel:F.string().optional(),coverImageUrl:F.string().optional(),ogImageUrl:F.string().optional(),coverImageWidth:F.number().optional(),coverImageHeight:F.number().optional()});class bQ extends f5{constructor(){super({entityType:"deck",purpose:"A slide-deck presentation.",schema:b8,frontmatterSchema:g5,supportsCoverImage:!0})}validateSlideStructure(w){if(!/^---$/gm.test(w))throw Error("Invalid deck: markdown must contain slide separators (---) to be a valid presentation")}toMarkdown(w){let $=this.extractBody(w.content);this.validateSlideStructure($);let f=this.parseFrontMatter(w.content,g5);EQ(f);let X={...f,slug:f.slug??w.metadata.slug};return this.buildMarkdown($,X)}fromMarkdown(w){let $=this.parseFrontmatter(w),f=this.extractBody(w);EQ($),this.validateSlideStructure(f);let X=$.slug??s1($.title),W=$.status;return{entityType:"deck",content:w,metadata:{slug:X,title:$.title,description:$.description,status:W,publishedAt:$.publishedAt,coverImageId:$.coverImageId}}}generateTitle(w){return w.metadata.title}generateSummary(w){if(w.metadata.description)return w.metadata.description;return`Presentation: ${w.metadata.title}`}generateFrontMatter(w){return this.toMarkdown(w)}buildStub(w){let $={title:w.title,slug:w.id,status:"generating"};return{content:this.buildMarkdown(`---
|
|
1493
1493
|
`,$),metadata:{title:w.title,slug:w.id,status:"generating"}}}}var Rf=new bQ;G0();j5();var BF0=F.object({markdown:F.string().describe("Markdown content with slide separators (---)"),deck:mw.optional()}),jQ=E1({name:"deck-detail",description:"Render a presentation deck as Reveal.js slides",schema:BF0,dataSourceId:"decks:entities",requiredPermission:"public",layout:{component:VF,fullscreen:!0}});j5();G0();var IQ=F.object({decks:F.array(AG)}),SQ=F.object({decks:F.array(mw),pageTitle:F.string().optional(),pageLabel:F.string().optional()});import{jsxDEV as CQ}from"preact/jsx-dev-runtime";var VF0="Presentations",uQ=({decks:w,pageLabel:$})=>{let f=w.map((W)=>({id:W.id,url:W.url,title:W.frontmatter.title,date:W.frontmatter.publishedAt??W.created,description:W.frontmatter.description}));return CQ("div",{className:"deck-list bg-theme",children:CQ("div",{className:"container mx-auto max-w-[1100px] px-6 py-16 md:px-12 md:py-24",children:CQ(_$,{label:$&&$!=="Decks"?$:VF0,items:f},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)};Q2();var M31=F.object({message:F.string()});d5();d5();Q2();TX();class UG{schema;config;processor=Q9();constructor(w,$){this.schema=w;this.config=$}getLabels(){let w={};for(let $ of this.config.mappings)w[$.key]=$.label;return w}generateBodyTemplate(){if(this.config.mappings.length===0)return"";let w=[];for(let $ of this.config.mappings)w.push(`## ${$.label}`,"",`<!-- Write your ${$.label.toLowerCase()} here -->`,"");return w.join(`
|
|
1494
1494
|
`).trimEnd()+`
|
|
1495
1495
|
`}format(w){try{let $=[`# ${this.config.title}`,""];for(let f of this.config.mappings)this.formatField(w,f,$,2);return $.join(`
|
|
@@ -1802,12 +1802,12 @@ ${G}`,templateName:"decks:description"})).description,await this.reportProgress(
|
|
|
1802
1802
|
color: var(--carousel-accent);
|
|
1803
1803
|
font-weight: 600;
|
|
1804
1804
|
}
|
|
1805
|
-
`}},void 0,!1,void 0,this),W.map((H,K)=>i2("section",{className:`deck-carousel-slide${K===0?" is-cover":""}`,children:[i2("header",{className:"deck-carousel-header",children:i2("span",{className:"deck-carousel-wordmark","aria-label":f??$,children:[i2("span",{className:"wm-primary",children:Y.primary},void 0,!1,void 0,this),Y.secondary!==void 0&&i2(bF0,{children:[i2("span",{className:"wm-dot",children:"."},void 0,!1,void 0,this),i2("span",{className:"wm-secondary",children:Y.secondary},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),i2("div",{className:"deck-carousel-body",children:i2("div",{className:"deck-carousel-content",dangerouslySetInnerHTML:{__html:A(H.markdown)}},void 0,!1,void 0,this)},void 0,!1,void 0,this),i2("footer",{className:"deck-carousel-footer",children:[i2("span",{className:"deck-carousel-footer-meta",children:X??$},void 0,!1,void 0,this),i2("span",{className:"deck-carousel-counter","aria-label":`Slide ${K+1} of ${J}`,children:[i2("span",{className:"deck-carousel-counter-current",children:String(K+1).padStart(2,"0")},void 0,!1,void 0,this)," / ",i2("span",{children:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},K,!0,void 0,this))]},void 0,!0,void 0,this)}import{mkdtemp as jF0,rm as IF0}from"fs/promises";import{tmpdir as SF0}from"os";import{join as CF0}from"path";G0();var uF0=26214400,yF0=60000,Mm=20;class iQ{context;renderPdf;getThemeMode;constructor(w,$={}){this.context=w;this.renderPdf=$.renderPdf??C$,this.getThemeMode=$.getThemeMode??(async()=>"dark")}async resolve(w){if(w.sourceEntityType!=="deck")return;let $=await this.context.entityService.getEntity({entityType:"deck",id:w.sourceEntityId});if(!$)return;let f=gF0($,{brandLabel:this.resolveBrandLabel()});if(f.slides.length>Mm)throw Error(`Refusing to render carousel with ${f.slides.length} slides; maxSlides=${Mm}`);let X=await this.getThemeMode(),W=await jF0(CF0(SF0(),"brain-deck-carousel-"));try{let Y=await V6({outputDir:W,mediaPath:`/_media/carousel/${$.id}`,template:zm,format:"pdf",content:f,siteConfig:{title:f.title,themeMode:X},themeCSS:this.context.themeCSS}),J=await N6({rootDir:W});try{return{type:"document",data:await this.renderPdf(J.urlFor(Y.urlPath),{maxBytes:uF0,timeoutMs:yF0,printBackground:!0,preferCSSPageSize:!0}),mimeType:"application/pdf",filename:`${xF0($)}-carousel.pdf`}}finally{await J.close()}}finally{await IF0(W,{recursive:!0,force:!0})}}resolveBrandLabel(){let w=this.context.domain?.trim();if(w&&w.length>0)return w;let $=this.context.identity.getProfile().name;return $.length>0?$:void 0}}function gF0(w,$={}){let{frontmatter:f,content:X}=e2(w.content),W=typeof f.title==="string"?f.title:w.metadata.title,Y=typeof f.event==="string"&&f.event.length>0?f.event:void 0,J=X.split(/^---$/gm).map((G)=>G.trim()).filter((G)=>G.length>0).map((G)=>({markdown:G}));return{title:W,slides:J,...$.brandLabel?{brandLabel:$.brandLabel}:{},...Y?{eyebrow:Y}:{}}}function xF0(w){let $=w.metadata.slug;return $.length>0?$:s1(w.metadata.title)}G0();import{jsxDEV as rF0}from"preact/jsx-dev-runtime";var FG="og-image",mF0="decks:og-image",Bm=F.object({title:F.string().min(1),description:F.string().optional(),event:F.string().optional(),brandLabel:F.string().optional(),slideCount:F.number().int().positive().optional(),coverImageUrl:F.string().optional()}),Vm={name:mF0,pluginId:"decks",schema:Bm,renderers:{image:lF0}};function lF0(w){let $=Bm.parse(w),f=$.slideCount?`${$.slideCount} slide${$.slideCount===1?"":"s"}`:void 0;return rF0(L$,{brandLabel:$.brandLabel??$.title,eyebrow:"Deck",title:$.title,subtitle:$.description,meta:[$.event],tag:f},void 0,!1,void 0,this)}G0();class dQ{context;deps;constructor(w,$={}){this.context=w;this.deps=$}async resolve(w){if(w.sourceEntityType!=="deck"||w.attachmentType!==FG)return;let $=await this.context.entityService.getEntity({entityType:"deck",id:w.sourceEntityId});if(!$)return;let{frontmatter:f,content:X}=e2($.content),W=g5.parse(f),Y=pF0(X),J=this.resolveBrandLabel(),G=await this.resolveCoverImageUrl(W.coverImageId),A={title:W.title,...W.description?{description:W.description}:{},...W.event?{event:W.event}:{},...Y?{slideCount:Y}:{},...G?{coverImageUrl:G}:{},...J?{brandLabel:J}:{}};return{type:"image",data:await RQ({mediaPath:`/_media/og/deck/${$.id}`,template:Vm,content:A,title:A.title,themeMode:"dark",themeCSS:this.context.themeCSS,tmpPrefix:"brain-deck-og-image-",...this.deps.screenshotPng&&{screenshotPng:this.deps.screenshotPng}}),mimeType:"image/png",filename:`${cF0($)}-og.png`}}resolveBrandLabel(){let w=this.context.domain?.trim();if(w&&w.length>0)return w;let $=this.context.identity.getProfile().name.trim();return $.length>0?$:void 0}async resolveCoverImageUrl(w){if(!w)return;let $=await this.context.entityService.getEntity({entityType:"image",id:w});return $?.content.startsWith("data:image/")?$.content:void 0}}function pF0(w){return w.split(/^---$/gm).map(($)=>$.trim()).filter(($)=>$.length>0).length}function cF0(w){let $=w.metadata.slug;return $.length>0?$:s1(w.metadata.title)}A1();async function Nm({entity:w,config:$}){let f=b8.parse(w),X=k1(f.content,g5),W=X.metadata;return{$type:"ai.rizom.brain.deck",title:W.title,...W.slug&&{slug:W.slug},...W.description&&{description:W.description},body:X.content,format:"text/markdown",...W.author&&{author:W.author},...W.event&&{event:W.event},...W.publishedAt&&{publishedAt:W.publishedAt},...$.brainDid&&{brainDid:$.brainDid},...$.anchorDid&&{anchorDid:$.anchorDid},sourceEntityType:"deck",sourceEntityId:f.id,createdAt:f.created,...f.updated&&{updatedAt:f.updated}}}function nQ(){return{entityType:"deck",collection:"ai.rizom.brain.deck",lexicon:B5["ai.rizom.brain.deck"],validate:!1,buildRecord:Nm}}var Rm={name:"@brains/decks",private:!0,version:"0.2.0-alpha.
|
|
1805
|
+
`}},void 0,!1,void 0,this),W.map((H,K)=>i2("section",{className:`deck-carousel-slide${K===0?" is-cover":""}`,children:[i2("header",{className:"deck-carousel-header",children:i2("span",{className:"deck-carousel-wordmark","aria-label":f??$,children:[i2("span",{className:"wm-primary",children:Y.primary},void 0,!1,void 0,this),Y.secondary!==void 0&&i2(bF0,{children:[i2("span",{className:"wm-dot",children:"."},void 0,!1,void 0,this),i2("span",{className:"wm-secondary",children:Y.secondary},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),i2("div",{className:"deck-carousel-body",children:i2("div",{className:"deck-carousel-content",dangerouslySetInnerHTML:{__html:A(H.markdown)}},void 0,!1,void 0,this)},void 0,!1,void 0,this),i2("footer",{className:"deck-carousel-footer",children:[i2("span",{className:"deck-carousel-footer-meta",children:X??$},void 0,!1,void 0,this),i2("span",{className:"deck-carousel-counter","aria-label":`Slide ${K+1} of ${J}`,children:[i2("span",{className:"deck-carousel-counter-current",children:String(K+1).padStart(2,"0")},void 0,!1,void 0,this)," / ",i2("span",{children:G},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},K,!0,void 0,this))]},void 0,!0,void 0,this)}import{mkdtemp as jF0,rm as IF0}from"fs/promises";import{tmpdir as SF0}from"os";import{join as CF0}from"path";G0();var uF0=26214400,yF0=60000,Mm=20;class iQ{context;metadata={outputEntityType:"document"};renderPdf;getThemeMode;constructor(w,$={}){this.context=w;this.renderPdf=$.renderPdf??C$,this.getThemeMode=$.getThemeMode??(async()=>"dark")}async resolve(w){if(w.sourceEntityType!=="deck")return;let $=await this.context.entityService.getEntity({entityType:"deck",id:w.sourceEntityId});if(!$)return;let f=gF0($,{brandLabel:this.resolveBrandLabel()});if(f.slides.length>Mm)throw Error(`Refusing to render carousel with ${f.slides.length} slides; maxSlides=${Mm}`);let X=await this.getThemeMode(),W=await jF0(CF0(SF0(),"brain-deck-carousel-"));try{let Y=await V6({outputDir:W,mediaPath:`/_media/carousel/${$.id}`,template:zm,format:"pdf",content:f,siteConfig:{title:f.title,themeMode:X},themeCSS:this.context.themeCSS}),J=await N6({rootDir:W});try{return{type:"document",data:await this.renderPdf(J.urlFor(Y.urlPath),{maxBytes:uF0,timeoutMs:yF0,printBackground:!0,preferCSSPageSize:!0}),mimeType:"application/pdf",filename:`${xF0($)}-carousel.pdf`}}finally{await J.close()}}finally{await IF0(W,{recursive:!0,force:!0})}}resolveBrandLabel(){let w=this.context.domain?.trim();if(w&&w.length>0)return w;let $=this.context.identity.getProfile().name;return $.length>0?$:void 0}}function gF0(w,$={}){let{frontmatter:f,content:X}=e2(w.content),W=typeof f.title==="string"?f.title:w.metadata.title,Y=typeof f.event==="string"&&f.event.length>0?f.event:void 0,J=X.split(/^---$/gm).map((G)=>G.trim()).filter((G)=>G.length>0).map((G)=>({markdown:G}));return{title:W,slides:J,...$.brandLabel?{brandLabel:$.brandLabel}:{},...Y?{eyebrow:Y}:{}}}function xF0(w){let $=w.metadata.slug;return $.length>0?$:s1(w.metadata.title)}G0();import{jsxDEV as rF0}from"preact/jsx-dev-runtime";var FG="og-image",mF0="decks:og-image",Bm=F.object({title:F.string().min(1),description:F.string().optional(),event:F.string().optional(),brandLabel:F.string().optional(),slideCount:F.number().int().positive().optional(),coverImageUrl:F.string().optional()}),Vm={name:mF0,pluginId:"decks",schema:Bm,renderers:{image:lF0}};function lF0(w){let $=Bm.parse(w),f=$.slideCount?`${$.slideCount} slide${$.slideCount===1?"":"s"}`:void 0;return rF0(L$,{brandLabel:$.brandLabel??$.title,eyebrow:"Deck",title:$.title,subtitle:$.description,meta:[$.event],tag:f},void 0,!1,void 0,this)}G0();class dQ{context;deps;metadata={outputEntityType:"image",targetField:"ogImageId"};constructor(w,$={}){this.context=w;this.deps=$}async resolve(w){if(w.sourceEntityType!=="deck"||w.attachmentType!==FG)return;let $=await this.context.entityService.getEntity({entityType:"deck",id:w.sourceEntityId});if(!$)return;let{frontmatter:f,content:X}=e2($.content),W=g5.parse(f),Y=pF0(X),J=this.resolveBrandLabel(),G=await this.resolveCoverImageUrl(W.coverImageId),A={title:W.title,...W.description?{description:W.description}:{},...W.event?{event:W.event}:{},...Y?{slideCount:Y}:{},...G?{coverImageUrl:G}:{},...J?{brandLabel:J}:{}};return{type:"image",data:await RQ({mediaPath:`/_media/og/deck/${$.id}`,template:Vm,content:A,title:A.title,themeMode:"dark",themeCSS:this.context.themeCSS,tmpPrefix:"brain-deck-og-image-",...this.deps.screenshotPng&&{screenshotPng:this.deps.screenshotPng}}),mimeType:"image/png",filename:`${cF0($)}-og.png`}}resolveBrandLabel(){let w=this.context.domain?.trim();if(w&&w.length>0)return w;let $=this.context.identity.getProfile().name.trim();return $.length>0?$:void 0}async resolveCoverImageUrl(w){if(!w)return;let $=await this.context.entityService.getEntity({entityType:"image",id:w});return $?.content.startsWith("data:image/")?$.content:void 0}}function pF0(w){return w.split(/^---$/gm).map(($)=>$.trim()).filter(($)=>$.length>0).length}function cF0(w){let $=w.metadata.slug;return $.length>0?$:s1(w.metadata.title)}A1();async function Nm({entity:w,config:$}){let f=b8.parse(w),X=k1(f.content,g5),W=X.metadata;return{$type:"ai.rizom.brain.deck",title:W.title,...W.slug&&{slug:W.slug},...W.description&&{description:W.description},body:X.content,format:"text/markdown",...W.author&&{author:W.author},...W.event&&{event:W.event},...W.publishedAt&&{publishedAt:W.publishedAt},...$.brainDid&&{brainDid:$.brainDid},...$.anchorDid&&{anchorDid:$.anchorDid},sourceEntityType:"deck",sourceEntityId:f.id,createdAt:f.created,...f.updated&&{updatedAt:f.updated}}}function nQ(){return{entityType:"deck",collection:"ai.rizom.brain.deck",lexicon:B5["ai.rizom.brain.deck"],validate:!1,buildRecord:Nm}}var Rm={name:"@brains/decks",private:!0,version:"0.2.0-alpha.134",description:"Presentation decks plugin for creating and viewing slide presentations",type:"module",exports:{".":"./src/index.ts"},scripts:{typecheck:"tsc --noEmit",test:"bun test",lint:"eslint . --ext .ts","lint:fix":"eslint . --ext .ts --fix",eval:"cd evals && bun run brain-eval"},dependencies:{"@brains/atproto-contracts":"workspace:*","@brains/content-formatters":"workspace:*","@brains/contracts":"workspace:*","@brains/image":"workspace:*","@brains/media-page-composer":"workspace:*","@brains/media-renderer":"workspace:*","@brains/plugins":"workspace:*","@brains/site-info":"workspace:*","@brains/ui-library":"workspace:*","@brains/utils":"workspace:*"},devDependencies:{"@brains/app":"workspace:*","@brains/eslint-config":"workspace:*","@brains/typescript-config":"workspace:*","@types/bun":"latest","bun-types":"latest",eslint:"^8.56.0",typescript:"^5.3.3"}};class qm extends e6{deps;entityType=Rf.entityType;schema=Rf.schema;adapter=Rf;unregisterCarouselAttachmentProvider;unregisterOgImageAttachmentProvider;unregisterAtprotoProjection;constructor(w={}){super("decks",Rm);this.deps=w}createGenerationHandler(w){return new cQ(this.logger.child("DeckGenerationJobHandler"),w)}getTemplates(){return{"deck-detail":jQ,"deck-list":gQ,generation:Am,description:Um}}getDataSources(){return[new pQ(this.logger)]}getEntityTypeConfig(){return{weight:1.5}}async onRegister(w){this.deferPublishRegistration(w),this.subscribeToPublishExecute(w),this.registerCarouselAttachmentProvider(w),this.registerOgImageAttachmentProvider(w),this.registerEvalHandlers(w),this.unregisterAtprotoProjection=Uw.getInstance().register(nQ()),this.logger.info("Decks plugin registered")}async onShutdown(){this.unregisterCarouselAttachmentProvider?.(),this.unregisterCarouselAttachmentProvider=void 0,this.unregisterOgImageAttachmentProvider?.(),this.unregisterOgImageAttachmentProvider=void 0,this.unregisterAtprotoProjection?.(),this.unregisterAtprotoProjection=void 0}deferPublishRegistration(w){w.messaging.subscribe("system:plugins:ready",async()=>{return await w.messaging.send({type:"publish:register",payload:{entityType:"deck",provider:{name:"internal",publish:async()=>({id:"internal"})},config:{executionMode:"provider"}}}),{success:!0}})}subscribeToPublishExecute(w){w.messaging.subscribe("publish:execute",async($)=>{let{entityType:f,entityId:X}=$.payload;if(f!=="deck")return{success:!0};try{let W=await w.entityService.getEntity({entityType:"deck",id:X});if(!W)return await w.messaging.send({type:"publish:report:failure",payload:{entityType:f,entityId:X,error:`Deck not found: ${X}`}}),{success:!0};if(W.metadata.status==="published")return{success:!0};let Y=new Date().toISOString(),J={...W,metadata:{...W.metadata,status:"published",publishedAt:Y}};await w.entityService.updateEntity({entity:{...J,content:this.adapter.toMarkdown(J)}}),await w.messaging.send({type:"publish:report:success",payload:{entityType:f,entityId:X,result:{id:X}}})}catch(W){await w.messaging.send({type:"publish:report:failure",payload:{entityType:f,entityId:X,error:t1(W)}})}return{success:!0}})}registerCarouselAttachmentProvider(w){let $={...this.deps,getThemeMode:this.deps.getThemeMode??(async()=>{try{return(await xw(w.entityService)).themeMode??"dark"}catch{return"dark"}})};this.unregisterCarouselAttachmentProvider=w.attachments.register("deck",Qm,new iQ(w,$))}registerOgImageAttachmentProvider(w){this.unregisterOgImageAttachmentProvider=w.attachments.register("deck",FG,new dQ(w))}registerEvalHandlers(w){w.eval.registerHandler("generateDeck",async($)=>{let f=F.object({prompt:F.string(),event:F.string().optional()}).parse($);return w.ai.generate({prompt:`${f.prompt}${f.event?`
|
|
1806
1806
|
|
|
1807
1807
|
Note: This presentation is for "${f.event}".`:""}`,templateName:"decks:generation"})}),w.eval.registerHandler("generateDescription",async($)=>{let f=F.object({title:F.string(),content:F.string()}).parse($);return w.ai.generate({prompt:`Title: ${f.title}
|
|
1808
1808
|
|
|
1809
1809
|
Content:
|
|
1810
|
-
${f.content}`,templateName:"decks:description"})})}}Ww();A1();var v4=v3.extend(m7.shape);A1();Aw();G0();var dF0=new S5;class OG{postsListUrl;decksListUrl;id="professional:homepage-list";name="Homepage List DataSource";description="Fetches profile, blog posts, and presentation decks for homepage";constructor(w,$){this.postsListUrl=w;this.decksListUrl=$}async fetch(w,$,f){let X=f.entityService,[W,Y,J,G]=await Promise.all([D3(X),X.listEntities({entityType:"post",options:{limit:20}}),X.listEntities({entityType:"deck",options:{limit:20}}),xw(X)]),A=dF0.parseProfileBody(W,v4),H=Y.sort(R9).slice(0,3).map(Hw),K=J.sort(R9).slice(0,3).map(qf);if(!G.cta)throw Error("CTA not configured in site-info");let h={profile:A,posts:H,decks:K,postsListUrl:this.postsListUrl,decksListUrl:this.decksListUrl,cta:G.cta,sections:G.sections??{}};return $.parse(h)}}A1();Aw();var nF0=new S5;class QG{id="professional:about";name="About Page DataSource";description="Fetches full profile data for the about page";async fetch(w,$,f){let X=await D3(f.entityService),Y={profile:nF0.parseProfileBody(X,v4)};return $.parse(Y)}}import{jsxDEV as b1,Fragment as sF0}from"preact/jsx-dev-runtime";var oF0="grid md:grid-cols-[14rem_1px_1fr] gap-y-2 gap-x-0 md:gap-16 items-start",aF0="border-t md:border-t-0 md:border-l border-rule-strong md:self-stretch",oQ=({number:w,title:$,blurb:f,children:X})=>b1("section",{className:"py-20 border-b border-rule px-6 md:px-12",children:b1("div",{className:"max-w-6xl mx-auto",children:b1("div",{className:oF0,children:[b1(bF,{title:$,number:w,blurb:f},void 0,!1,void 0,this),b1("div",{className:aF0,"aria-hidden":"true"},void 0,!1,void 0,this),b1("div",{className:"mt-6 md:mt-0",children:X},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),aQ=({profile:w,posts:$,decks:f,postsListUrl:X,decksListUrl:W,cta:Y,sections:J})=>{let G=w.tagline||w.description,A=$.map((Z)=>({id:Z.id,url:Z.url,title:Z.metadata.title,date:Z.metadata.publishedAt||Z.created,description:Z.frontmatter.excerpt,series:Z.frontmatter.seriesName&&Z.frontmatter.seriesIndex?{name:Z.frontmatter.seriesName,index:Z.frontmatter.seriesIndex}:void 0})),H=f.map((Z)=>({id:Z.id,url:Z.url,title:Z.frontmatter.title||Z.id,date:Z.frontmatter.publishedAt??Z.created,description:Z.frontmatter.description})),K=w.name||"Home",h=w.intro||w.description||G||"Professional site",O=Boolean(w.description)||w.expertise!==void 0&&w.expertise.length>0;return b1(sF0,{children:[b1(X2,{title:K,description:h,ogType:"website"},void 0,!1,void 0,this),b1("div",{className:"homepage-list bg-theme",children:[b1("header",{className:"hero-bg-pattern relative w-full px-6 md:px-12 pt-28 pb-24 md:pt-28 md:pb-24 overflow-hidden border-b border-rule",children:b1("div",{className:"relative z-10 max-w-6xl mx-auto w-full",children:[w.name&&b1("div",{className:"flex items-center gap-[0.6rem] mb-6 font-mono text-[0.7rem] font-medium uppercase tracking-[0.22em] text-accent",children:[b1("span",{className:"w-[18px] h-px bg-accent","aria-hidden":"true"},void 0,!1,void 0,this),b1("span",{children:w.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G&&b1("h1",{className:"font-heading text-[clamp(2.75rem,6.5vw,5.5rem)] font-normal text-heading leading-[1.02] tracking-[-0.025em] max-w-[18ch] [font-variation-settings:'opsz'_144,'SOFT'_30]",children:mY(G,"italic font-normal text-accent [font-variation-settings:'opsz'_144,'SOFT'_80]")},void 0,!1,void 0,this),w.intro&&b1("p",{className:"font-heading font-light text-[clamp(1.1rem,1.8vw,1.4rem)] leading-[1.5] text-theme-muted max-w-[42ch] mt-8 [font-variation-settings:'opsz'_24]",children:mY(w.intro,"italic text-accent")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),b1(oQ,{number:"01",title:"Essays",blurb:J.essays?.blurb,children:b1(xY,{items:A,viewAllUrl:X,viewAllLabel:"View all essays"},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.length>0&&b1(oQ,{number:"02",title:"Presentations",blurb:J.presentations?.blurb,children:b1(xY,{items:H,viewAllUrl:W,viewAllLabel:"View all presentations"},void 0,!1,void 0,this)},void 0,!1,void 0,this),O&&b1(oQ,{number:"03",title:"About",blurb:J.about?.blurb,children:b1("div",{className:"flex flex-col gap-8",children:[w.description&&b1("p",{className:"font-heading font-light text-[1.25rem] leading-[1.55] text-theme max-w-[55ch] [font-variation-settings:'opsz'_24,'SOFT'_50]",children:w.description},void 0,!1,void 0,this),w.expertise&&w.expertise.length>0&&b1(jF,{subjects:w.expertise},void 0,!1,void 0,this),b1("a",{href:"/about",className:"mt-6 inline-flex items-center gap-2 font-mono text-[0.7rem] font-medium uppercase tracking-[0.18em] text-accent pb-1 relative before:content-[''] before:absolute before:left-0 before:right-full before:bottom-0 before:h-px before:bg-accent before:transition-[right] before:duration-300 hover:before:right-0",children:["Learn more",b1("span",{"aria-hidden":"true",children:"\u2192"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),b1(RF,{cta:Y,variant:"editorial",socialLinks:w.socialLinks},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};import{jsxDEV as N1,Fragment as tF0}from"preact/jsx-dev-runtime";var sQ=({profile:w})=>{let $=`About ${w.name||"Me"}`,f=w.description||w.intro||"About page",X=w.expertise&&w.expertise.length>0||w.currentFocus||w.availability||w.email||w.website||w.socialLinks&&w.socialLinks.length>0;return N1(tF0,{children:[N1(X2,{title:$,description:f,ogType:"profile"},void 0,!1,void 0,this),N1("div",{className:"about-page bg-theme",children:[N1("header",{className:"hero-bg-pattern relative w-full py-16 md:py-24 px-6 md:px-12 bg-theme overflow-hidden",children:N1("div",{className:"relative z-10 max-w-4xl mx-auto",children:[N1("h1",{className:"text-5xl md:text-6xl font-semibold mb-6 text-heading",children:["About ",w.name||"Me"]},void 0,!0,void 0,this),w.description&&N1("p",{className:"text-xl md:text-2xl text-theme-muted leading-relaxed",children:w.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),N1("div",{className:"container mx-auto px-6 md:px-12 max-w-4xl py-12 md:py-16",children:[w.story&&N1("section",{className:"content-section-reveal mb-20 md:mb-28",children:N1(H6,{markdown:w.story},void 0,!1,void 0,this)},void 0,!1,void 0,this),X&&N1("div",{className:"content-section-reveal grid md:grid-cols-2 gap-x-16 gap-y-12",children:[w.expertise&&w.expertise.length>0&&N1("section",{children:[N1("h2",{className:"text-sm tracking-widest uppercase text-theme-muted mb-6",children:"Expertise"},void 0,!1,void 0,this),N1("ul",{className:"flex flex-wrap gap-3",children:w.expertise.map((W,Y)=>N1("li",{className:LF({variant:"accent",size:"lg"}),children:W},Y,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w.currentFocus&&N1("section",{children:[N1("h2",{className:"text-sm tracking-widest uppercase text-theme-muted mb-6",children:"Current Focus"},void 0,!1,void 0,this),N1("p",{className:"text-lg text-theme leading-relaxed",children:w.currentFocus},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w.availability&&N1("section",{children:[N1("h2",{className:"text-sm tracking-widest uppercase text-theme-muted mb-6",children:"Availability"},void 0,!1,void 0,this),N1("p",{className:"text-lg text-theme leading-relaxed",children:w.availability},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(w.email||w.website||w.socialLinks&&w.socialLinks.length>0)&&N1("section",{children:[N1("h2",{className:"text-sm tracking-widest uppercase text-theme-muted mb-6",children:"Contact"},void 0,!1,void 0,this),N1("div",{className:"space-y-4",children:[w.email&&N1("p",{className:"text-lg",children:N1("a",{href:`mailto:${w.email}`,className:"text-brand hover:text-brand-dark transition-colors",children:w.email},void 0,!1,void 0,this)},void 0,!1,void 0,this),w.website&&N1("p",{className:"text-lg",children:N1("a",{href:w.website,target:"_blank",rel:"noopener noreferrer",className:"text-brand hover:text-brand-dark transition-colors",children:w.website},void 0,!1,void 0,this)},void 0,!1,void 0,this),w.socialLinks&&w.socialLinks.length>0&&N1("div",{className:"flex flex-wrap gap-4 mt-4",children:w.socialLinks.map((W,Y)=>N1(t5,{href:W.url,external:!0,variant:"secondary",size:"md",children:W.label||W.platform},Y,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};import{jsxDEV as d2,Fragment as Dm}from"preact/jsx-dev-runtime";var tQ=()=>{return d2(Dm,{children:[d2(X2,{title:"Thanks for subscribing!",description:"You've successfully subscribed to the newsletter."},void 0,!1,void 0,this),d2("div",{className:"min-h-[60vh] flex items-center justify-center px-6",children:d2("div",{className:"text-center max-w-md",children:[d2("div",{className:"text-6xl mb-6",children:"\uD83C\uDF89"},void 0,!1,void 0,this),d2("h1",{className:"text-3xl font-semibold mb-4 text-heading",children:"Thanks for subscribing!"},void 0,!1,void 0,this),d2("p",{className:"text-lg text-theme-muted mb-8",children:"You'll receive a confirmation email shortly. Check your inbox to confirm your subscription."},void 0,!1,void 0,this),d2(t5,{href:"/",variant:"primary",children:"Back to Home"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},eQ=()=>{return d2(Dm,{children:[d2(X2,{title:"Subscription failed",description:"There was a problem with your subscription."},void 0,!1,void 0,this),d2("div",{className:"min-h-[60vh] flex items-center justify-center px-6",children:d2("div",{className:"text-center max-w-md",children:[d2("div",{className:"text-6xl mb-6",children:"\uD83D\uDE22"},void 0,!1,void 0,this),d2("h1",{className:"text-3xl font-semibold mb-4 text-heading",children:"Something went wrong"},void 0,!1,void 0,this),d2("p",{className:"text-lg text-theme-muted mb-8",children:"We couldn't process your subscription. Please try again or contact us if the problem persists."},void 0,!1,void 0,this),d2(t5,{href:"/",variant:"primary",children:"Back to Home"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};G0();var vm=F.object({label:F.string().describe("Display label for entity type (e.g., 'Essay')"),pluralName:F.string().optional().describe("URL path segment (defaults to label.toLowerCase() + 's')")}),km=F.object({entityDisplay:F.object({post:vm,deck:vm}).describe("Display metadata for post and deck entity types (required for homepage)")});var Pm={name:"@brains/site-professional",private:!0,version:"0.2.0-alpha.132",description:"Professional site composition package",type:"module",exports:{".":"./src/index.ts"},files:["src"],scripts:{typecheck:"tsc --noEmit",lint:"eslint . --ext .ts","lint:fix":"eslint . --ext .ts --fix"},dependencies:{"@brains/blog":"workspace:*","@brains/decks":"workspace:*","@brains/identity-service":"workspace:*","@brains/plugins":"workspace:*","@brains/site-composition":"workspace:*","@brains/site-engine":"workspace:*","@brains/site-info":"workspace:*","@brains/templates":"workspace:*","@brains/ui-library":"workspace:*","@brains/utils":"workspace:*",preact:"^10.27.2"},devDependencies:{"@brains/eslint-config":"workspace:*","@brains/typescript-config":"workspace:*","@types/bun":"latest","bun-types":"latest",eslint:"^8.56.0",typescript:"^5.3.3"}};class wZ extends i9{dependencies=["blog","decks"];constructor(w){super("professional-site",Pm,w,km)}async onRegister(w){let $=this.config.entityDisplay.post,f=this.config.entityDisplay.deck,X=`/${$.pluralName??$.label.toLowerCase()+"s"}`,W=`/${f.pluralName??f.label.toLowerCase()+"s"}`,Y=new OG(X,W);w.entities.registerDataSource(Y);let J=new QG;w.entities.registerDataSource(J);let G=F.object({profile:v4,posts:F.array(s5),decks:F.array(mw),postsListUrl:F.string(),decksListUrl:F.string(),cta:Nf,sections:F.record(F.string(),KW)}),A=F.object({profile:v4}),H=F.object({});w.templates.register({"homepage-list":E1({name:"homepage-list",description:"Professional homepage with essays and presentations",schema:G,dataSourceId:"professional:homepage-list",requiredPermission:"public",layout:{component:aQ}}),about:E1({name:"about",description:"About page with full profile information",schema:A,dataSourceId:"professional:about",requiredPermission:"public",layout:{component:sQ}}),"subscribe-thanks":E1({name:"subscribe-thanks",description:"Newsletter subscription success page",schema:H,requiredPermission:"public",layout:{component:tQ}}),"subscribe-error":E1({name:"subscribe-error",description:"Newsletter subscription error page",schema:H,requiredPermission:"public",layout:{component:eQ}})}),this.logger.info("Professional site plugin registered successfully")}async getTools(){return[]}async getResources(){return[]}}function $Z(w){return new wZ(w??{})}var fZ=[{id:"home",path:"/",title:"Home",description:"Professional site homepage",layout:"default",navigation:{show:!0,label:"Home",slot:"secondary",priority:10},sections:[{id:"homepage",template:"professional-site:homepage-list",dataQuery:{}}]},{id:"about",path:"/about",title:"About",description:"About page",layout:"default",navigation:{show:!0,label:"About",slot:"primary",priority:90},sections:[{id:"about",template:"professional-site:about",dataQuery:{}}]},{id:"subscribe-thanks",path:"/subscribe/thanks",title:"Thanks for subscribing",description:"Newsletter subscription confirmation",layout:"default",navigation:{show:!1},sections:[{id:"subscribe-thanks",template:"professional-site:subscribe-thanks",dataQuery:{},content:{}}]},{id:"subscribe-error",path:"/subscribe/error",title:"Subscription failed",description:"Newsletter subscription error",layout:"default",navigation:{show:!1},sections:[{id:"subscribe-error",template:"professional-site:subscribe-error",dataQuery:{},content:{}}]}];import{jsxDEV as ZG}from"preact/jsx-dev-runtime";function XZ({sections:w,siteInfo:$,slots:f,wordmark:X}){return ZG("div",{className:"flex flex-col min-h-screen bg-theme overflow-x-clip",children:[ZG(P$,{title:$.title,navigation:$.navigation.primary,showThemeToggle:!0,...$.logo!==void 0?{logo:$.logo}:{},...X!==void 0?{wordmark:X}:{}},void 0,!1,void 0,this),ZG("main",{className:"flex-grow flex flex-col bg-theme",children:w},void 0,!1,void 0,this),ZG(DF,{primaryNavigation:$.navigation.primary,secondaryNavigation:$.navigation.secondary,copyright:$.copyright,socialLinks:$.socialLinks,title:$.title,tagline:$.description,children:f?.getSlot("footer-top").map((W)=>W.render())},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Lm(w){return{id:w.id,version:w.version,type:w.type,packageName:w.packageName}}var K91=TQ;function h91(w){return Lm(LQ(w))}var wO0=_Q,F91=wO0,O91=XZ;function Q91(w){return Lm($Z(w))}var Z91=fZ;export{wO0 as routes,Q91 as professionalSitePlugin,Z91 as professionalRoutes,h91 as personalSitePlugin,F91 as personalRoutes,O91 as ProfessionalLayout,K91 as PersonalLayout};
|
|
1810
|
+
${f.content}`,templateName:"decks:description"})})}}Ww();A1();var v4=v3.extend(m7.shape);A1();Aw();G0();var dF0=new S5;class OG{postsListUrl;decksListUrl;id="professional:homepage-list";name="Homepage List DataSource";description="Fetches profile, blog posts, and presentation decks for homepage";constructor(w,$){this.postsListUrl=w;this.decksListUrl=$}async fetch(w,$,f){let X=f.entityService,[W,Y,J,G]=await Promise.all([D3(X),X.listEntities({entityType:"post",options:{limit:20}}),X.listEntities({entityType:"deck",options:{limit:20}}),xw(X)]),A=dF0.parseProfileBody(W,v4),H=Y.sort(R9).slice(0,3).map(Hw),K=J.sort(R9).slice(0,3).map(qf);if(!G.cta)throw Error("CTA not configured in site-info");let h={profile:A,posts:H,decks:K,postsListUrl:this.postsListUrl,decksListUrl:this.decksListUrl,cta:G.cta,sections:G.sections??{}};return $.parse(h)}}A1();Aw();var nF0=new S5;class QG{id="professional:about";name="About Page DataSource";description="Fetches full profile data for the about page";async fetch(w,$,f){let X=await D3(f.entityService),Y={profile:nF0.parseProfileBody(X,v4)};return $.parse(Y)}}import{jsxDEV as b1,Fragment as sF0}from"preact/jsx-dev-runtime";var oF0="grid md:grid-cols-[14rem_1px_1fr] gap-y-2 gap-x-0 md:gap-16 items-start",aF0="border-t md:border-t-0 md:border-l border-rule-strong md:self-stretch",oQ=({number:w,title:$,blurb:f,children:X})=>b1("section",{className:"py-20 border-b border-rule px-6 md:px-12",children:b1("div",{className:"max-w-6xl mx-auto",children:b1("div",{className:oF0,children:[b1(bF,{title:$,number:w,blurb:f},void 0,!1,void 0,this),b1("div",{className:aF0,"aria-hidden":"true"},void 0,!1,void 0,this),b1("div",{className:"mt-6 md:mt-0",children:X},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),aQ=({profile:w,posts:$,decks:f,postsListUrl:X,decksListUrl:W,cta:Y,sections:J})=>{let G=w.tagline||w.description,A=$.map((Z)=>({id:Z.id,url:Z.url,title:Z.metadata.title,date:Z.metadata.publishedAt||Z.created,description:Z.frontmatter.excerpt,series:Z.frontmatter.seriesName&&Z.frontmatter.seriesIndex?{name:Z.frontmatter.seriesName,index:Z.frontmatter.seriesIndex}:void 0})),H=f.map((Z)=>({id:Z.id,url:Z.url,title:Z.frontmatter.title||Z.id,date:Z.frontmatter.publishedAt??Z.created,description:Z.frontmatter.description})),K=w.name||"Home",h=w.intro||w.description||G||"Professional site",O=Boolean(w.description)||w.expertise!==void 0&&w.expertise.length>0;return b1(sF0,{children:[b1(X2,{title:K,description:h,ogType:"website"},void 0,!1,void 0,this),b1("div",{className:"homepage-list bg-theme",children:[b1("header",{className:"hero-bg-pattern relative w-full px-6 md:px-12 pt-28 pb-24 md:pt-28 md:pb-24 overflow-hidden border-b border-rule",children:b1("div",{className:"relative z-10 max-w-6xl mx-auto w-full",children:[w.name&&b1("div",{className:"flex items-center gap-[0.6rem] mb-6 font-mono text-[0.7rem] font-medium uppercase tracking-[0.22em] text-accent",children:[b1("span",{className:"w-[18px] h-px bg-accent","aria-hidden":"true"},void 0,!1,void 0,this),b1("span",{children:w.name},void 0,!1,void 0,this)]},void 0,!0,void 0,this),G&&b1("h1",{className:"font-heading text-[clamp(2.75rem,6.5vw,5.5rem)] font-normal text-heading leading-[1.02] tracking-[-0.025em] max-w-[18ch] [font-variation-settings:'opsz'_144,'SOFT'_30]",children:mY(G,"italic font-normal text-accent [font-variation-settings:'opsz'_144,'SOFT'_80]")},void 0,!1,void 0,this),w.intro&&b1("p",{className:"font-heading font-light text-[clamp(1.1rem,1.8vw,1.4rem)] leading-[1.5] text-theme-muted max-w-[42ch] mt-8 [font-variation-settings:'opsz'_24]",children:mY(w.intro,"italic text-accent")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),b1(oQ,{number:"01",title:"Essays",blurb:J.essays?.blurb,children:b1(xY,{items:A,viewAllUrl:X,viewAllLabel:"View all essays"},void 0,!1,void 0,this)},void 0,!1,void 0,this),H.length>0&&b1(oQ,{number:"02",title:"Presentations",blurb:J.presentations?.blurb,children:b1(xY,{items:H,viewAllUrl:W,viewAllLabel:"View all presentations"},void 0,!1,void 0,this)},void 0,!1,void 0,this),O&&b1(oQ,{number:"03",title:"About",blurb:J.about?.blurb,children:b1("div",{className:"flex flex-col gap-8",children:[w.description&&b1("p",{className:"font-heading font-light text-[1.25rem] leading-[1.55] text-theme max-w-[55ch] [font-variation-settings:'opsz'_24,'SOFT'_50]",children:w.description},void 0,!1,void 0,this),w.expertise&&w.expertise.length>0&&b1(jF,{subjects:w.expertise},void 0,!1,void 0,this),b1("a",{href:"/about",className:"mt-6 inline-flex items-center gap-2 font-mono text-[0.7rem] font-medium uppercase tracking-[0.18em] text-accent pb-1 relative before:content-[''] before:absolute before:left-0 before:right-full before:bottom-0 before:h-px before:bg-accent before:transition-[right] before:duration-300 hover:before:right-0",children:["Learn more",b1("span",{"aria-hidden":"true",children:"\u2192"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),b1(RF,{cta:Y,variant:"editorial",socialLinks:w.socialLinks},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};import{jsxDEV as N1,Fragment as tF0}from"preact/jsx-dev-runtime";var sQ=({profile:w})=>{let $=`About ${w.name||"Me"}`,f=w.description||w.intro||"About page",X=w.expertise&&w.expertise.length>0||w.currentFocus||w.availability||w.email||w.website||w.socialLinks&&w.socialLinks.length>0;return N1(tF0,{children:[N1(X2,{title:$,description:f,ogType:"profile"},void 0,!1,void 0,this),N1("div",{className:"about-page bg-theme",children:[N1("header",{className:"hero-bg-pattern relative w-full py-16 md:py-24 px-6 md:px-12 bg-theme overflow-hidden",children:N1("div",{className:"relative z-10 max-w-4xl mx-auto",children:[N1("h1",{className:"text-5xl md:text-6xl font-semibold mb-6 text-heading",children:["About ",w.name||"Me"]},void 0,!0,void 0,this),w.description&&N1("p",{className:"text-xl md:text-2xl text-theme-muted leading-relaxed",children:w.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),N1("div",{className:"container mx-auto px-6 md:px-12 max-w-4xl py-12 md:py-16",children:[w.story&&N1("section",{className:"content-section-reveal mb-20 md:mb-28",children:N1(H6,{markdown:w.story},void 0,!1,void 0,this)},void 0,!1,void 0,this),X&&N1("div",{className:"content-section-reveal grid md:grid-cols-2 gap-x-16 gap-y-12",children:[w.expertise&&w.expertise.length>0&&N1("section",{children:[N1("h2",{className:"text-sm tracking-widest uppercase text-theme-muted mb-6",children:"Expertise"},void 0,!1,void 0,this),N1("ul",{className:"flex flex-wrap gap-3",children:w.expertise.map((W,Y)=>N1("li",{className:LF({variant:"accent",size:"lg"}),children:W},Y,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w.currentFocus&&N1("section",{children:[N1("h2",{className:"text-sm tracking-widest uppercase text-theme-muted mb-6",children:"Current Focus"},void 0,!1,void 0,this),N1("p",{className:"text-lg text-theme leading-relaxed",children:w.currentFocus},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w.availability&&N1("section",{children:[N1("h2",{className:"text-sm tracking-widest uppercase text-theme-muted mb-6",children:"Availability"},void 0,!1,void 0,this),N1("p",{className:"text-lg text-theme leading-relaxed",children:w.availability},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(w.email||w.website||w.socialLinks&&w.socialLinks.length>0)&&N1("section",{children:[N1("h2",{className:"text-sm tracking-widest uppercase text-theme-muted mb-6",children:"Contact"},void 0,!1,void 0,this),N1("div",{className:"space-y-4",children:[w.email&&N1("p",{className:"text-lg",children:N1("a",{href:`mailto:${w.email}`,className:"text-brand hover:text-brand-dark transition-colors",children:w.email},void 0,!1,void 0,this)},void 0,!1,void 0,this),w.website&&N1("p",{className:"text-lg",children:N1("a",{href:w.website,target:"_blank",rel:"noopener noreferrer",className:"text-brand hover:text-brand-dark transition-colors",children:w.website},void 0,!1,void 0,this)},void 0,!1,void 0,this),w.socialLinks&&w.socialLinks.length>0&&N1("div",{className:"flex flex-wrap gap-4 mt-4",children:w.socialLinks.map((W,Y)=>N1(t5,{href:W.url,external:!0,variant:"secondary",size:"md",children:W.label||W.platform},Y,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)};import{jsxDEV as d2,Fragment as Dm}from"preact/jsx-dev-runtime";var tQ=()=>{return d2(Dm,{children:[d2(X2,{title:"Thanks for subscribing!",description:"You've successfully subscribed to the newsletter."},void 0,!1,void 0,this),d2("div",{className:"min-h-[60vh] flex items-center justify-center px-6",children:d2("div",{className:"text-center max-w-md",children:[d2("div",{className:"text-6xl mb-6",children:"\uD83C\uDF89"},void 0,!1,void 0,this),d2("h1",{className:"text-3xl font-semibold mb-4 text-heading",children:"Thanks for subscribing!"},void 0,!1,void 0,this),d2("p",{className:"text-lg text-theme-muted mb-8",children:"You'll receive a confirmation email shortly. Check your inbox to confirm your subscription."},void 0,!1,void 0,this),d2(t5,{href:"/",variant:"primary",children:"Back to Home"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},eQ=()=>{return d2(Dm,{children:[d2(X2,{title:"Subscription failed",description:"There was a problem with your subscription."},void 0,!1,void 0,this),d2("div",{className:"min-h-[60vh] flex items-center justify-center px-6",children:d2("div",{className:"text-center max-w-md",children:[d2("div",{className:"text-6xl mb-6",children:"\uD83D\uDE22"},void 0,!1,void 0,this),d2("h1",{className:"text-3xl font-semibold mb-4 text-heading",children:"Something went wrong"},void 0,!1,void 0,this),d2("p",{className:"text-lg text-theme-muted mb-8",children:"We couldn't process your subscription. Please try again or contact us if the problem persists."},void 0,!1,void 0,this),d2(t5,{href:"/",variant:"primary",children:"Back to Home"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};G0();var vm=F.object({label:F.string().describe("Display label for entity type (e.g., 'Essay')"),pluralName:F.string().optional().describe("URL path segment (defaults to label.toLowerCase() + 's')")}),km=F.object({entityDisplay:F.object({post:vm,deck:vm}).describe("Display metadata for post and deck entity types (required for homepage)")});var Pm={name:"@brains/site-professional",private:!0,version:"0.2.0-alpha.134",description:"Professional site composition package",type:"module",exports:{".":"./src/index.ts"},files:["src"],scripts:{typecheck:"tsc --noEmit",lint:"eslint . --ext .ts","lint:fix":"eslint . --ext .ts --fix"},dependencies:{"@brains/blog":"workspace:*","@brains/decks":"workspace:*","@brains/identity-service":"workspace:*","@brains/plugins":"workspace:*","@brains/site-composition":"workspace:*","@brains/site-engine":"workspace:*","@brains/site-info":"workspace:*","@brains/templates":"workspace:*","@brains/ui-library":"workspace:*","@brains/utils":"workspace:*",preact:"^10.27.2"},devDependencies:{"@brains/eslint-config":"workspace:*","@brains/typescript-config":"workspace:*","@types/bun":"latest","bun-types":"latest",eslint:"^8.56.0",typescript:"^5.3.3"}};class wZ extends i9{dependencies=["blog","decks"];constructor(w){super("professional-site",Pm,w,km)}async onRegister(w){let $=this.config.entityDisplay.post,f=this.config.entityDisplay.deck,X=`/${$.pluralName??$.label.toLowerCase()+"s"}`,W=`/${f.pluralName??f.label.toLowerCase()+"s"}`,Y=new OG(X,W);w.entities.registerDataSource(Y);let J=new QG;w.entities.registerDataSource(J);let G=F.object({profile:v4,posts:F.array(s5),decks:F.array(mw),postsListUrl:F.string(),decksListUrl:F.string(),cta:Nf,sections:F.record(F.string(),KW)}),A=F.object({profile:v4}),H=F.object({});w.templates.register({"homepage-list":E1({name:"homepage-list",description:"Professional homepage with essays and presentations",schema:G,dataSourceId:"professional:homepage-list",requiredPermission:"public",layout:{component:aQ}}),about:E1({name:"about",description:"About page with full profile information",schema:A,dataSourceId:"professional:about",requiredPermission:"public",layout:{component:sQ}}),"subscribe-thanks":E1({name:"subscribe-thanks",description:"Newsletter subscription success page",schema:H,requiredPermission:"public",layout:{component:tQ}}),"subscribe-error":E1({name:"subscribe-error",description:"Newsletter subscription error page",schema:H,requiredPermission:"public",layout:{component:eQ}})}),this.logger.info("Professional site plugin registered successfully")}async getTools(){return[]}async getResources(){return[]}}function $Z(w){return new wZ(w??{})}var fZ=[{id:"home",path:"/",title:"Home",description:"Professional site homepage",layout:"default",navigation:{show:!0,label:"Home",slot:"secondary",priority:10},sections:[{id:"homepage",template:"professional-site:homepage-list",dataQuery:{}}]},{id:"about",path:"/about",title:"About",description:"About page",layout:"default",navigation:{show:!0,label:"About",slot:"primary",priority:90},sections:[{id:"about",template:"professional-site:about",dataQuery:{}}]},{id:"subscribe-thanks",path:"/subscribe/thanks",title:"Thanks for subscribing",description:"Newsletter subscription confirmation",layout:"default",navigation:{show:!1},sections:[{id:"subscribe-thanks",template:"professional-site:subscribe-thanks",dataQuery:{},content:{}}]},{id:"subscribe-error",path:"/subscribe/error",title:"Subscription failed",description:"Newsletter subscription error",layout:"default",navigation:{show:!1},sections:[{id:"subscribe-error",template:"professional-site:subscribe-error",dataQuery:{},content:{}}]}];import{jsxDEV as ZG}from"preact/jsx-dev-runtime";function XZ({sections:w,siteInfo:$,slots:f,wordmark:X}){return ZG("div",{className:"flex flex-col min-h-screen bg-theme overflow-x-clip",children:[ZG(P$,{title:$.title,navigation:$.navigation.primary,showThemeToggle:!0,...$.logo!==void 0?{logo:$.logo}:{},...X!==void 0?{wordmark:X}:{}},void 0,!1,void 0,this),ZG("main",{className:"flex-grow flex flex-col bg-theme",children:w},void 0,!1,void 0,this),ZG(DF,{primaryNavigation:$.navigation.primary,secondaryNavigation:$.navigation.secondary,copyright:$.copyright,socialLinks:$.socialLinks,title:$.title,tagline:$.description,children:f?.getSlot("footer-top").map((W)=>W.render())},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Lm(w){return{id:w.id,version:w.version,type:w.type,packageName:w.packageName}}var K91=TQ;function h91(w){return Lm(LQ(w))}var wO0=_Q,F91=wO0,O91=XZ;function Q91(w){return Lm($Z(w))}var Z91=fZ;export{wO0 as routes,Q91 as professionalSitePlugin,Z91 as professionalRoutes,h91 as personalSitePlugin,F91 as personalRoutes,O91 as ProfessionalLayout,K91 as PersonalLayout};
|
|
1811
1811
|
|
|
1812
|
-
//# debugId=
|
|
1812
|
+
//# debugId=838A96DF051B655364756E2164756E21
|
|
1813
1813
|
//# sourceMappingURL=site.js.map
|