@rizom/brain 0.2.0-alpha.140 → 0.2.0-alpha.141
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 +808 -808
- package/dist/entities.d.ts +2 -0
- package/dist/entities.js +2 -2
- package/dist/entities.js.map +4 -4
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/plugins.d.ts +2 -0
- package/dist/plugins.js +26 -26
- package/dist/plugins.js.map +4 -4
- package/dist/services.d.ts +2 -0
- package/dist/services.js +19 -19
- package/dist/services.js.map +4 -4
- package/dist/site.js +5 -5
- package/dist/site.js.map +4 -4
- package/package.json +1 -1
package/dist/site.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var el=Object.create;var{getPrototypeOf:wr,defineProperty:lG,getOwnPropertyNames:$r}=Object;var fr=Object.prototype.hasOwnProperty;function Xr(w){return this[w]}var Wr,Yr,x5=(w,$,f)=>{var X=w!=null&&typeof w==="object";if(X){var W=$?Wr??=new WeakMap:Yr??=new WeakMap,Y=W.get(w);if(Y)return Y}f=w!=null?el(wr(w)):{};let J=$||!w||!w.__esModule?lG(f,"default",{value:w,enumerable:!0}):f;for(let G of $r(w))if(!fr.call(J,G))lG(J,G,{get:Xr.bind(w,G),enumerable:!0});if(X)W.set(w,J);return J};var p=(w,$)=>()=>($||w(($={exports:{}}).exports,$),$.exports);var Jr=(w)=>w;function Gr(w,$){this[w]=Jr.bind(null,$)}var xf=(w,$)=>{for(var f in $)lG(w,f,{get:$[f],enumerable:!0,configurable:!0,set:Gr.bind($,f)})};var C=(w,$)=>()=>(w&&($=w(w=0)),$);var m0=import.meta.require;var J1,rG,Q0,Q3=(w)=>{switch(typeof w){case"undefined":return Q0.undefined;case"string":return Q0.string;case"number":return Number.isNaN(w)?Q0.nan:Q0.number;case"boolean":return Q0.boolean;case"function":return Q0.function;case"bigint":return Q0.bigint;case"symbol":return Q0.symbol;case"object":if(Array.isArray(w))return Q0.array;if(w===null)return Q0.null;if(w.then&&typeof w.then==="function"&&w.catch&&typeof w.catch==="function")return Q0.promise;if(typeof Map<"u"&&w instanceof Map)return Q0.map;if(typeof Set<"u"&&w instanceof Set)return Q0.set;if(typeof Date<"u"&&w instanceof Date)return Q0.date;return Q0.object;default:return Q0.unknown}};var l8=C(()=>{(function(w){w.assertEqual=(W)=>{};function $(W){}w.assertIs=$;function f(W){throw Error()}w.assertNever=f,w.arrayToEnum=(W)=>{let Y={};for(let J of W)Y[J]=J;return Y},w.getValidEnumValues=(W)=>{let Y=w.objectKeys(W).filter((G)=>typeof W[W[G]]!=="number"),J={};for(let G of Y)J[G]=W[G];return w.objectValues(J)},w.objectValues=(W)=>{return w.objectKeys(W).map(function(Y){return W[Y]})},w.objectKeys=typeof Object.keys==="function"?(W)=>Object.keys(W):(W)=>{let Y=[];for(let J in W)if(Object.prototype.hasOwnProperty.call(W,J))Y.push(J);return Y},w.find=(W,Y)=>{for(let J of W)if(Y(J))return J;return},w.isInteger=typeof Number.isInteger==="function"?(W)=>Number.isInteger(W):(W)=>typeof W==="number"&&Number.isFinite(W)&&Math.floor(W)===W;function X(W,Y=" | "){return W.map((J)=>typeof J==="string"?`'${J}'`:J).join(Y)}w.joinValues=X,w.jsonStringifyReplacer=(W,Y)=>{if(typeof Y==="bigint")return Y.toString();return Y}})(J1||(J1={}));(function(w){w.mergeShapes=($,f)=>{return{...$,...f}}})(rG||(rG={}));Q0=J1.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var H0,Ar=(w)=>{return JSON.stringify(w,null,2).replace(/"([^"]+)":/g,"$1:")},o2;var mf=C(()=>{l8();H0=J1.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);o2=class o2 extends Error{get errors(){return this.issues}constructor(w){super();this.issues=[],this.addIssue=(f)=>{this.issues=[...this.issues,f]},this.addIssues=(f=[])=>{this.issues=[...this.issues,...f]};let $=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,$);else this.__proto__=$;this.name="ZodError",this.issues=w}format(w){let $=w||function(W){return W.message},f={_errors:[]},X=(W)=>{for(let Y of W.issues)if(Y.code==="invalid_union")Y.unionErrors.map(X);else if(Y.code==="invalid_return_type")X(Y.returnTypeError);else if(Y.code==="invalid_arguments")X(Y.argumentsError);else if(Y.path.length===0)f._errors.push($(Y));else{let J=f,G=0;while(G<Y.path.length){let A=Y.path[G];if(G!==Y.path.length-1)J[A]=J[A]||{_errors:[]};else J[A]=J[A]||{_errors:[]},J[A]._errors.push($(Y));J=J[A],G++}}};return X(this),f}static assert(w){if(!(w instanceof o2))throw Error(`Not a ZodError: ${w}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,J1.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(w=($)=>$.message){let $={},f=[];for(let X of this.issues)if(X.path.length>0){let W=X.path[0];$[W]=$[W]||[],$[W].push(w(X))}else f.push(w(X));return{formErrors:f,fieldErrors:$}}get formErrors(){return this.flatten()}};o2.create=(w)=>{return new o2(w)}});var Hr=(w,$)=>{let f;switch(w.code){case H0.invalid_type:if(w.received===Q0.undefined)f="Required";else f=`Expected ${w.expected}, received ${w.received}`;break;case H0.invalid_literal:f=`Invalid literal value, expected ${JSON.stringify(w.expected,J1.jsonStringifyReplacer)}`;break;case H0.unrecognized_keys:f=`Unrecognized key(s) in object: ${J1.joinValues(w.keys,", ")}`;break;case H0.invalid_union:f="Invalid input";break;case H0.invalid_union_discriminator:f=`Invalid discriminator value. Expected ${J1.joinValues(w.options)}`;break;case H0.invalid_enum_value:f=`Invalid enum value. Expected ${J1.joinValues(w.options)}, received '${w.received}'`;break;case H0.invalid_arguments:f="Invalid function arguments";break;case H0.invalid_return_type:f="Invalid function return type";break;case H0.invalid_date:f="Invalid date";break;case H0.invalid_string:if(typeof w.validation==="object")if("includes"in w.validation){if(f=`Invalid input: must include "${w.validation.includes}"`,typeof w.validation.position==="number")f=`${f} at one or more positions greater than or equal to ${w.validation.position}`}else if("startsWith"in w.validation)f=`Invalid input: must start with "${w.validation.startsWith}"`;else if("endsWith"in w.validation)f=`Invalid input: must end with "${w.validation.endsWith}"`;else J1.assertNever(w.validation);else if(w.validation!=="regex")f=`Invalid ${w.validation}`;else f="Invalid";break;case H0.too_small:if(w.type==="array")f=`Array must contain ${w.exact?"exactly":w.inclusive?"at least":"more than"} ${w.minimum} element(s)`;else if(w.type==="string")f=`String must contain ${w.exact?"exactly":w.inclusive?"at least":"over"} ${w.minimum} character(s)`;else if(w.type==="number")f=`Number must be ${w.exact?"exactly equal to ":w.inclusive?"greater than or equal to ":"greater than "}${w.minimum}`;else if(w.type==="bigint")f=`Number must be ${w.exact?"exactly equal to ":w.inclusive?"greater than or equal to ":"greater than "}${w.minimum}`;else if(w.type==="date")f=`Date must be ${w.exact?"exactly equal to ":w.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(w.minimum))}`;else f="Invalid input";break;case H0.too_big:if(w.type==="array")f=`Array must contain ${w.exact?"exactly":w.inclusive?"at most":"less than"} ${w.maximum} element(s)`;else if(w.type==="string")f=`String must contain ${w.exact?"exactly":w.inclusive?"at most":"under"} ${w.maximum} character(s)`;else if(w.type==="number")f=`Number must be ${w.exact?"exactly":w.inclusive?"less than or equal to":"less than"} ${w.maximum}`;else if(w.type==="bigint")f=`BigInt must be ${w.exact?"exactly":w.inclusive?"less than or equal to":"less than"} ${w.maximum}`;else if(w.type==="date")f=`Date must be ${w.exact?"exactly":w.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(w.maximum))}`;else f="Invalid input";break;case H0.custom:f="Invalid input";break;case H0.invalid_intersection_types:f="Intersection results could not be merged";break;case H0.not_multiple_of:f=`Number must be a multiple of ${w.multipleOf}`;break;case H0.not_finite:f="Number must be finite";break;default:f=$.defaultError,J1.assertNever(w)}return{message:f}},m3;var pG=C(()=>{mf();l8();m3=Hr});function Ur(w){QM=w}function sw(){return QM}var QM;var lf=C(()=>{pG();QM=m3});function z0(w,$){let f=sw(),X=r8({issueData:$,data:w.data,path:w.path,errorMaps:[w.common.contextualErrorMap,w.schemaErrorMap,f,f===m3?void 0:m3].filter((W)=>!!W)});w.common.issues.push(X)}class q2{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(w,$){let f=[];for(let X of $){if(X.status==="aborted")return b0;if(X.status==="dirty")w.dirty();f.push(X.value)}return{status:w.value,value:f}}static async mergeObjectAsync(w,$){let f=[];for(let X of $){let W=await X.key,Y=await X.value;f.push({key:W,value:Y})}return q2.mergeObjectSync(w,f)}static mergeObjectSync(w,$){let f={};for(let X of $){let{key:W,value:Y}=X;if(W.status==="aborted")return b0;if(Y.status==="aborted")return b0;if(W.status==="dirty")w.dirty();if(Y.status==="dirty")w.dirty();if(W.value!=="__proto__"&&(typeof Y.value<"u"||X.alwaysSet))f[W.value]=Y.value}return{status:w.value,value:f}}}var r8=(w)=>{let{data:$,path:f,errorMaps:X,issueData:W}=w,Y=[...f,...W.path||[]],J={...W,path:Y};if(W.message!==void 0)return{...W,path:Y,message:W.message};let G="",A=X.filter((U)=>!!U).slice().reverse();for(let U of A)G=U(J,{data:$,defaultError:G}).message;return{...W,path:Y,message:G}},Kr,b0,C4=(w)=>({status:"dirty",value:w}),I2=(w)=>({status:"valid",value:w}),rf=(w)=>w.status==="aborted",pf=(w)=>w.status==="dirty",v6=(w)=>w.status==="valid",tw=(w)=>typeof Promise<"u"&&w instanceof Promise;var cG=C(()=>{lf();pG();Kr=[];b0=Object.freeze({status:"aborted"})});var ZM=()=>{};var k0;var MM=C(()=>{(function(w){w.errToObj=($)=>typeof $==="string"?{message:$}:$||{},w.toString=($)=>typeof $==="string"?$:$?.message})(k0||(k0={}))});class p5{constructor(w,$,f,X){this._cachedPath=[],this.parent=w,this.data=$,this._path=f,this._key=X}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function o0(w){if(!w)return{};let{errorMap:$,invalid_type_error:f,required_error:X,description:W}=w;if($&&(f||X))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if($)return{errorMap:$,description:W};return{errorMap:(J,G)=>{let{message:A}=w;if(J.code==="invalid_enum_value")return{message:A??G.defaultError};if(typeof G.data>"u")return{message:A??X??G.defaultError};if(J.code!=="invalid_type")return{message:G.defaultError};return{message:A??f??G.defaultError}},description:W}}class X1{get description(){return this._def.description}_getType(w){return Q3(w.data)}_getOrReturnCtx(w,$){return $||{common:w.parent.common,data:w.data,parsedType:Q3(w.data),schemaErrorMap:this._def.errorMap,path:w.path,parent:w.parent}}_processInputParams(w){return{status:new q2,ctx:{common:w.parent.common,data:w.data,parsedType:Q3(w.data),schemaErrorMap:this._def.errorMap,path:w.path,parent:w.parent}}}_parseSync(w){let $=this._parse(w);if(tw($))throw Error("Synchronous parse encountered promise.");return $}_parseAsync(w){let $=this._parse(w);return Promise.resolve($)}parse(w,$){let f=this.safeParse(w,$);if(f.success)return f.data;throw f.error}safeParse(w,$){let f={common:{issues:[],async:$?.async??!1,contextualErrorMap:$?.errorMap},path:$?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:w,parsedType:Q3(w)},X=this._parseSync({data:w,path:f.path,parent:f});return BM(f,X)}"~validate"(w){let $={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:w,parsedType:Q3(w)};if(!this["~standard"].async)try{let f=this._parseSync({data:w,path:[],parent:$});return v6(f)?{value:f.value}:{issues:$.common.issues}}catch(f){if(f?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;$.common={issues:[],async:!0}}return this._parseAsync({data:w,path:[],parent:$}).then((f)=>v6(f)?{value:f.value}:{issues:$.common.issues})}async parseAsync(w,$){let f=await this.safeParseAsync(w,$);if(f.success)return f.data;throw f.error}async safeParseAsync(w,$){let f={common:{issues:[],contextualErrorMap:$?.errorMap,async:!0},path:$?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:w,parsedType:Q3(w)},X=this._parse({data:w,path:f.path,parent:f}),W=await(tw(X)?X:Promise.resolve(X));return BM(f,W)}refine(w,$){let f=(X)=>{if(typeof $==="string"||typeof $>"u")return{message:$};else if(typeof $==="function")return $(X);else return $};return this._refinement((X,W)=>{let Y=w(X),J=()=>W.addIssue({code:H0.custom,...f(X)});if(typeof Promise<"u"&&Y instanceof Promise)return Y.then((G)=>{if(!G)return J(),!1;else return!0});if(!Y)return J(),!1;else return!0})}refinement(w,$){return this._refinement((f,X)=>{if(!w(f))return X.addIssue(typeof $==="function"?$(f,X):$),!1;else return!0})}_refinement(w){return new c5({schema:this,typeName:C0.ZodEffects,effect:{type:"refinement",refinement:w}})}superRefine(w){return this._refinement(w)}constructor(w){this.spa=this.safeParseAsync,this._def=w,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:($)=>this["~validate"]($)}}optional(){return r5.create(this,this._def)}nullable(){return r3.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return l5.create(this)}promise(){return x4.create(this,this._def)}or(w){return W9.create([this,w],this._def)}and(w){return Y9.create(this,w,this._def)}transform(w){return new c5({...o0(this._def),schema:this,typeName:C0.ZodEffects,effect:{type:"transform",transform:w}})}default(w){let $=typeof w==="function"?w:()=>w;return new H9({...o0(this._def),innerType:this,defaultValue:$,typeName:C0.ZodDefault})}brand(){return new df({typeName:C0.ZodBranded,type:this,...o0(this._def)})}catch(w){let $=typeof w==="function"?w:()=>w;return new U9({...o0(this._def),innerType:this,catchValue:$,typeName:C0.ZodCatch})}describe(w){return new this.constructor({...this._def,description:w})}pipe(w){return o8.create(this,w)}readonly(){return K9.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function RM(w){let $="[0-5]\\d";if(w.precision)$=`${$}\\.\\d{${w.precision}}`;else if(w.precision==null)$=`${$}(\\.\\d+)?`;let f=w.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${$})${f}`}function Lr(w){return new RegExp(`^${RM(w)}$`)}function NM(w){let $=`${zM}T${RM(w)}`,f=[];if(f.push(w.local?"Z?":"Z"),w.offset)f.push("([+-]\\d{2}:?\\d{2})");return $=`${$}(${f.join("|")})`,new RegExp(`^${$}$`)}function _r(w,$){if(($==="v4"||!$)&&Rr.test(w))return!0;if(($==="v6"||!$)&&qr.test(w))return!0;return!1}function Tr(w,$){if(!Mr.test(w))return!1;try{let[f]=w.split(".");if(!f)return!1;let X=f.replace(/-/g,"+").replace(/_/g,"/").padEnd(f.length+(4-f.length%4)%4,"="),W=JSON.parse(atob(X));if(typeof W!=="object"||W===null)return!1;if("typ"in W&&W?.typ!=="JWT")return!1;if(!W.alg)return!1;if($&&W.alg!==$)return!1;return!0}catch{return!1}}function Er(w,$){if(($==="v4"||!$)&&Nr.test(w))return!0;if(($==="v6"||!$)&&Dr.test(w))return!0;return!1}function br(w,$){let f=(w.toString().split(".")[1]||"").length,X=($.toString().split(".")[1]||"").length,W=f>X?f:X,Y=Number.parseInt(w.toFixed(W).replace(".","")),J=Number.parseInt($.toFixed(W).replace(".",""));return Y%J/10**W}function ew(w){if(w instanceof r1){let $={};for(let f in w.shape){let X=w.shape[f];$[f]=r5.create(ew(X))}return new r1({...w._def,shape:()=>$})}else if(w instanceof l5)return new l5({...w._def,type:ew(w.element)});else if(w instanceof r5)return r5.create(ew(w.unwrap()));else if(w instanceof r3)return r3.create(ew(w.unwrap()));else if(w instanceof M3)return M3.create(w.items.map(($)=>ew($)));else return w}function dG(w,$){let f=Q3(w),X=Q3($);if(w===$)return{valid:!0,data:w};else if(f===Q0.object&&X===Q0.object){let W=J1.objectKeys($),Y=J1.objectKeys(w).filter((G)=>W.indexOf(G)!==-1),J={...w,...$};for(let G of Y){let A=dG(w[G],$[G]);if(!A.valid)return{valid:!1};J[G]=A.data}return{valid:!0,data:J}}else if(f===Q0.array&&X===Q0.array){if(w.length!==$.length)return{valid:!1};let W=[];for(let Y=0;Y<w.length;Y++){let J=w[Y],G=$[Y],A=dG(J,G);if(!A.valid)return{valid:!1};W.push(A.data)}return{valid:!0,data:W}}else if(f===Q0.date&&X===Q0.date&&+w===+$)return{valid:!0,data:w};else return{valid:!1}}function qM(w,$){return new _6({values:w,typeName:C0.ZodEnum,...o0($)})}function VM(w,$){let f=typeof w==="function"?w($):typeof w==="string"?{message:w}:w;return typeof f==="string"?{message:f}:f}function DM(w,$={},f){if(w)return y4.create().superRefine((X,W)=>{let Y=w(X);if(Y instanceof Promise)return Y.then((J)=>{if(!J){let G=VM($,X),A=G.fatal??f??!0;W.addIssue({code:"custom",...G,fatal:A})}});if(!Y){let J=VM($,X),G=J.fatal??f??!0;W.addIssue({code:"custom",...J,fatal:G})}return});return y4.create()}var BM=(w,$)=>{if(v6($))return{success:!0,data:$.value};else{if(!w.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let f=new o2(w.common.issues);return this._error=f,this._error}}}},hr,Fr,Or,Qr,Zr,Mr,Br,Vr,zr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",iG,Rr,Nr,qr,Dr,vr,Pr,zM="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",kr,m5,k6,L6,$9,u4,p8,f9,X9,y4,P6,Z3,c8,l5,r1,W9,l3=(w)=>{if(w instanceof J9)return l3(w.schema);else if(w instanceof c5)return l3(w.innerType());else if(w instanceof G9)return[w.value];else if(w instanceof _6)return w.options;else if(w instanceof A9)return J1.objectValues(w.enum);else if(w instanceof H9)return l3(w._def.innerType);else if(w instanceof f9)return[void 0];else if(w instanceof X9)return[null];else if(w instanceof r5)return[void 0,...l3(w.unwrap())];else if(w instanceof r3)return[null,...l3(w.unwrap())];else if(w instanceof df)return l3(w.unwrap());else if(w instanceof K9)return l3(w.unwrap());else if(w instanceof U9)return l3(w._def.innerType);else return[]},cf,Y9,M3,i8,d8,g4,w9,J9,G9,_6,A9,x4,c5,r5,r3,H9,U9,n8,jr,df,o8,K9,Ir,C0,Sr=(w,$={message:`Input not instance of ${w.name}`})=>DM((f)=>f instanceof w,$),vM,PM,Cr,ur,kM,yr,gr,xr,mr,lr,rr,pr,cr,ir,dr,nr,or,ar,sr,tr,er,wp,$p,fp,Xp,Wp,Yp,Jp,Gp,Ap,Hp,Up,Kp,hp,Fp=()=>vM().optional(),Op=()=>PM().optional(),Qp=()=>kM().optional(),Zp,Mp;var LM=C(()=>{mf();lf();MM();cG();l8();hr=/^c[^\s-]{8,}$/i,Fr=/^[0-9a-z]+$/,Or=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Qr=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Zr=/^[a-z0-9_-]{21}$/i,Mr=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Br=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Vr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Rr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,qr=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Dr=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Pr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,kr=new RegExp(`^${zM}$`);m5=class m5 extends X1{_parse(w){if(this._def.coerce)w.data=String(w.data);if(this._getType(w)!==Q0.string){let W=this._getOrReturnCtx(w);return z0(W,{code:H0.invalid_type,expected:Q0.string,received:W.parsedType}),b0}let f=new q2,X=void 0;for(let W of this._def.checks)if(W.kind==="min"){if(w.data.length<W.value)X=this._getOrReturnCtx(w,X),z0(X,{code:H0.too_small,minimum:W.value,type:"string",inclusive:!0,exact:!1,message:W.message}),f.dirty()}else if(W.kind==="max"){if(w.data.length>W.value)X=this._getOrReturnCtx(w,X),z0(X,{code:H0.too_big,maximum:W.value,type:"string",inclusive:!0,exact:!1,message:W.message}),f.dirty()}else if(W.kind==="length"){let Y=w.data.length>W.value,J=w.data.length<W.value;if(Y||J){if(X=this._getOrReturnCtx(w,X),Y)z0(X,{code:H0.too_big,maximum:W.value,type:"string",inclusive:!0,exact:!0,message:W.message});else if(J)z0(X,{code:H0.too_small,minimum:W.value,type:"string",inclusive:!0,exact:!0,message:W.message});f.dirty()}}else if(W.kind==="email"){if(!Vr.test(w.data))X=this._getOrReturnCtx(w,X),z0(X,{validation:"email",code:H0.invalid_string,message:W.message}),f.dirty()}else if(W.kind==="emoji"){if(!iG)iG=new RegExp(zr,"u");if(!iG.test(w.data))X=this._getOrReturnCtx(w,X),z0(X,{validation:"emoji",code:H0.invalid_string,message:W.message}),f.dirty()}else if(W.kind==="uuid"){if(!Qr.test(w.data))X=this._getOrReturnCtx(w,X),z0(X,{validation:"uuid",code:H0.invalid_string,message:W.message}),f.dirty()}else if(W.kind==="nanoid"){if(!Zr.test(w.data))X=this._getOrReturnCtx(w,X),z0(X,{validation:"nanoid",code:H0.invalid_string,message:W.message}),f.dirty()}else if(W.kind==="cuid"){if(!hr.test(w.data))X=this._getOrReturnCtx(w,X),z0(X,{validation:"cuid",code:H0.invalid_string,message:W.message}),f.dirty()}else if(W.kind==="cuid2"){if(!Fr.test(w.data))X=this._getOrReturnCtx(w,X),z0(X,{validation:"cuid2",code:H0.invalid_string,message:W.message}),f.dirty()}else if(W.kind==="ulid"){if(!Or.test(w.data))X=this._getOrReturnCtx(w,X),z0(X,{validation:"ulid",code:H0.invalid_string,message:W.message}),f.dirty()}else if(W.kind==="url")try{new URL(w.data)}catch{X=this._getOrReturnCtx(w,X),z0(X,{validation:"url",code:H0.invalid_string,message:W.message}),f.dirty()}else if(W.kind==="regex"){if(W.regex.lastIndex=0,!W.regex.test(w.data))X=this._getOrReturnCtx(w,X),z0(X,{validation:"regex",code:H0.invalid_string,message:W.message}),f.dirty()}else if(W.kind==="trim")w.data=w.data.trim();else if(W.kind==="includes"){if(!w.data.includes(W.value,W.position))X=this._getOrReturnCtx(w,X),z0(X,{code:H0.invalid_string,validation:{includes:W.value,position:W.position},message:W.message}),f.dirty()}else if(W.kind==="toLowerCase")w.data=w.data.toLowerCase();else if(W.kind==="toUpperCase")w.data=w.data.toUpperCase();else if(W.kind==="startsWith"){if(!w.data.startsWith(W.value))X=this._getOrReturnCtx(w,X),z0(X,{code:H0.invalid_string,validation:{startsWith:W.value},message:W.message}),f.dirty()}else if(W.kind==="endsWith"){if(!w.data.endsWith(W.value))X=this._getOrReturnCtx(w,X),z0(X,{code:H0.invalid_string,validation:{endsWith:W.value},message:W.message}),f.dirty()}else if(W.kind==="datetime"){if(!NM(W).test(w.data))X=this._getOrReturnCtx(w,X),z0(X,{code:H0.invalid_string,validation:"datetime",message:W.message}),f.dirty()}else if(W.kind==="date"){if(!kr.test(w.data))X=this._getOrReturnCtx(w,X),z0(X,{code:H0.invalid_string,validation:"date",message:W.message}),f.dirty()}else if(W.kind==="time"){if(!Lr(W).test(w.data))X=this._getOrReturnCtx(w,X),z0(X,{code:H0.invalid_string,validation:"time",message:W.message}),f.dirty()}else if(W.kind==="duration"){if(!Br.test(w.data))X=this._getOrReturnCtx(w,X),z0(X,{validation:"duration",code:H0.invalid_string,message:W.message}),f.dirty()}else if(W.kind==="ip"){if(!_r(w.data,W.version))X=this._getOrReturnCtx(w,X),z0(X,{validation:"ip",code:H0.invalid_string,message:W.message}),f.dirty()}else if(W.kind==="jwt"){if(!Tr(w.data,W.alg))X=this._getOrReturnCtx(w,X),z0(X,{validation:"jwt",code:H0.invalid_string,message:W.message}),f.dirty()}else if(W.kind==="cidr"){if(!Er(w.data,W.version))X=this._getOrReturnCtx(w,X),z0(X,{validation:"cidr",code:H0.invalid_string,message:W.message}),f.dirty()}else if(W.kind==="base64"){if(!vr.test(w.data))X=this._getOrReturnCtx(w,X),z0(X,{validation:"base64",code:H0.invalid_string,message:W.message}),f.dirty()}else if(W.kind==="base64url"){if(!Pr.test(w.data))X=this._getOrReturnCtx(w,X),z0(X,{validation:"base64url",code:H0.invalid_string,message:W.message}),f.dirty()}else J1.assertNever(W);return{status:f.value,value:w.data}}_regex(w,$,f){return this.refinement((X)=>w.test(X),{validation:$,code:H0.invalid_string,...k0.errToObj(f)})}_addCheck(w){return new m5({...this._def,checks:[...this._def.checks,w]})}email(w){return this._addCheck({kind:"email",...k0.errToObj(w)})}url(w){return this._addCheck({kind:"url",...k0.errToObj(w)})}emoji(w){return this._addCheck({kind:"emoji",...k0.errToObj(w)})}uuid(w){return this._addCheck({kind:"uuid",...k0.errToObj(w)})}nanoid(w){return this._addCheck({kind:"nanoid",...k0.errToObj(w)})}cuid(w){return this._addCheck({kind:"cuid",...k0.errToObj(w)})}cuid2(w){return this._addCheck({kind:"cuid2",...k0.errToObj(w)})}ulid(w){return this._addCheck({kind:"ulid",...k0.errToObj(w)})}base64(w){return this._addCheck({kind:"base64",...k0.errToObj(w)})}base64url(w){return this._addCheck({kind:"base64url",...k0.errToObj(w)})}jwt(w){return this._addCheck({kind:"jwt",...k0.errToObj(w)})}ip(w){return this._addCheck({kind:"ip",...k0.errToObj(w)})}cidr(w){return this._addCheck({kind:"cidr",...k0.errToObj(w)})}datetime(w){if(typeof w==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:w});return this._addCheck({kind:"datetime",precision:typeof w?.precision>"u"?null:w?.precision,offset:w?.offset??!1,local:w?.local??!1,...k0.errToObj(w?.message)})}date(w){return this._addCheck({kind:"date",message:w})}time(w){if(typeof w==="string")return this._addCheck({kind:"time",precision:null,message:w});return this._addCheck({kind:"time",precision:typeof w?.precision>"u"?null:w?.precision,...k0.errToObj(w?.message)})}duration(w){return this._addCheck({kind:"duration",...k0.errToObj(w)})}regex(w,$){return this._addCheck({kind:"regex",regex:w,...k0.errToObj($)})}includes(w,$){return this._addCheck({kind:"includes",value:w,position:$?.position,...k0.errToObj($?.message)})}startsWith(w,$){return this._addCheck({kind:"startsWith",value:w,...k0.errToObj($)})}endsWith(w,$){return this._addCheck({kind:"endsWith",value:w,...k0.errToObj($)})}min(w,$){return this._addCheck({kind:"min",value:w,...k0.errToObj($)})}max(w,$){return this._addCheck({kind:"max",value:w,...k0.errToObj($)})}length(w,$){return this._addCheck({kind:"length",value:w,...k0.errToObj($)})}nonempty(w){return this.min(1,k0.errToObj(w))}trim(){return new m5({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new m5({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new m5({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((w)=>w.kind==="datetime")}get isDate(){return!!this._def.checks.find((w)=>w.kind==="date")}get isTime(){return!!this._def.checks.find((w)=>w.kind==="time")}get isDuration(){return!!this._def.checks.find((w)=>w.kind==="duration")}get isEmail(){return!!this._def.checks.find((w)=>w.kind==="email")}get isURL(){return!!this._def.checks.find((w)=>w.kind==="url")}get isEmoji(){return!!this._def.checks.find((w)=>w.kind==="emoji")}get isUUID(){return!!this._def.checks.find((w)=>w.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((w)=>w.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((w)=>w.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((w)=>w.kind==="cuid2")}get isULID(){return!!this._def.checks.find((w)=>w.kind==="ulid")}get isIP(){return!!this._def.checks.find((w)=>w.kind==="ip")}get isCIDR(){return!!this._def.checks.find((w)=>w.kind==="cidr")}get isBase64(){return!!this._def.checks.find((w)=>w.kind==="base64")}get isBase64url(){return!!this._def.checks.find((w)=>w.kind==="base64url")}get minLength(){let w=null;for(let $ of this._def.checks)if($.kind==="min"){if(w===null||$.value>w)w=$.value}return w}get maxLength(){let w=null;for(let $ of this._def.checks)if($.kind==="max"){if(w===null||$.value<w)w=$.value}return w}};m5.create=(w)=>{return new m5({checks:[],typeName:C0.ZodString,coerce:w?.coerce??!1,...o0(w)})};k6=class k6 extends X1{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(w){if(this._def.coerce)w.data=Number(w.data);if(this._getType(w)!==Q0.number){let W=this._getOrReturnCtx(w);return z0(W,{code:H0.invalid_type,expected:Q0.number,received:W.parsedType}),b0}let f=void 0,X=new q2;for(let W of this._def.checks)if(W.kind==="int"){if(!J1.isInteger(w.data))f=this._getOrReturnCtx(w,f),z0(f,{code:H0.invalid_type,expected:"integer",received:"float",message:W.message}),X.dirty()}else if(W.kind==="min"){if(W.inclusive?w.data<W.value:w.data<=W.value)f=this._getOrReturnCtx(w,f),z0(f,{code:H0.too_small,minimum:W.value,type:"number",inclusive:W.inclusive,exact:!1,message:W.message}),X.dirty()}else if(W.kind==="max"){if(W.inclusive?w.data>W.value:w.data>=W.value)f=this._getOrReturnCtx(w,f),z0(f,{code:H0.too_big,maximum:W.value,type:"number",inclusive:W.inclusive,exact:!1,message:W.message}),X.dirty()}else if(W.kind==="multipleOf"){if(br(w.data,W.value)!==0)f=this._getOrReturnCtx(w,f),z0(f,{code:H0.not_multiple_of,multipleOf:W.value,message:W.message}),X.dirty()}else if(W.kind==="finite"){if(!Number.isFinite(w.data))f=this._getOrReturnCtx(w,f),z0(f,{code:H0.not_finite,message:W.message}),X.dirty()}else J1.assertNever(W);return{status:X.value,value:w.data}}gte(w,$){return this.setLimit("min",w,!0,k0.toString($))}gt(w,$){return this.setLimit("min",w,!1,k0.toString($))}lte(w,$){return this.setLimit("max",w,!0,k0.toString($))}lt(w,$){return this.setLimit("max",w,!1,k0.toString($))}setLimit(w,$,f,X){return new k6({...this._def,checks:[...this._def.checks,{kind:w,value:$,inclusive:f,message:k0.toString(X)}]})}_addCheck(w){return new k6({...this._def,checks:[...this._def.checks,w]})}int(w){return this._addCheck({kind:"int",message:k0.toString(w)})}positive(w){return this._addCheck({kind:"min",value:0,inclusive:!1,message:k0.toString(w)})}negative(w){return this._addCheck({kind:"max",value:0,inclusive:!1,message:k0.toString(w)})}nonpositive(w){return this._addCheck({kind:"max",value:0,inclusive:!0,message:k0.toString(w)})}nonnegative(w){return this._addCheck({kind:"min",value:0,inclusive:!0,message:k0.toString(w)})}multipleOf(w,$){return this._addCheck({kind:"multipleOf",value:w,message:k0.toString($)})}finite(w){return this._addCheck({kind:"finite",message:k0.toString(w)})}safe(w){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:k0.toString(w)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:k0.toString(w)})}get minValue(){let w=null;for(let $ of this._def.checks)if($.kind==="min"){if(w===null||$.value>w)w=$.value}return w}get maxValue(){let w=null;for(let $ of this._def.checks)if($.kind==="max"){if(w===null||$.value<w)w=$.value}return w}get isInt(){return!!this._def.checks.find((w)=>w.kind==="int"||w.kind==="multipleOf"&&J1.isInteger(w.value))}get isFinite(){let w=null,$=null;for(let f of this._def.checks)if(f.kind==="finite"||f.kind==="int"||f.kind==="multipleOf")return!0;else if(f.kind==="min"){if($===null||f.value>$)$=f.value}else if(f.kind==="max"){if(w===null||f.value<w)w=f.value}return Number.isFinite($)&&Number.isFinite(w)}};k6.create=(w)=>{return new k6({checks:[],typeName:C0.ZodNumber,coerce:w?.coerce||!1,...o0(w)})};L6=class L6 extends X1{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(w){if(this._def.coerce)try{w.data=BigInt(w.data)}catch{return this._getInvalidInput(w)}if(this._getType(w)!==Q0.bigint)return this._getInvalidInput(w);let f=void 0,X=new q2;for(let W of this._def.checks)if(W.kind==="min"){if(W.inclusive?w.data<W.value:w.data<=W.value)f=this._getOrReturnCtx(w,f),z0(f,{code:H0.too_small,type:"bigint",minimum:W.value,inclusive:W.inclusive,message:W.message}),X.dirty()}else if(W.kind==="max"){if(W.inclusive?w.data>W.value:w.data>=W.value)f=this._getOrReturnCtx(w,f),z0(f,{code:H0.too_big,type:"bigint",maximum:W.value,inclusive:W.inclusive,message:W.message}),X.dirty()}else if(W.kind==="multipleOf"){if(w.data%W.value!==BigInt(0))f=this._getOrReturnCtx(w,f),z0(f,{code:H0.not_multiple_of,multipleOf:W.value,message:W.message}),X.dirty()}else J1.assertNever(W);return{status:X.value,value:w.data}}_getInvalidInput(w){let $=this._getOrReturnCtx(w);return z0($,{code:H0.invalid_type,expected:Q0.bigint,received:$.parsedType}),b0}gte(w,$){return this.setLimit("min",w,!0,k0.toString($))}gt(w,$){return this.setLimit("min",w,!1,k0.toString($))}lte(w,$){return this.setLimit("max",w,!0,k0.toString($))}lt(w,$){return this.setLimit("max",w,!1,k0.toString($))}setLimit(w,$,f,X){return new L6({...this._def,checks:[...this._def.checks,{kind:w,value:$,inclusive:f,message:k0.toString(X)}]})}_addCheck(w){return new L6({...this._def,checks:[...this._def.checks,w]})}positive(w){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:k0.toString(w)})}negative(w){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:k0.toString(w)})}nonpositive(w){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:k0.toString(w)})}nonnegative(w){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:k0.toString(w)})}multipleOf(w,$){return this._addCheck({kind:"multipleOf",value:w,message:k0.toString($)})}get minValue(){let w=null;for(let $ of this._def.checks)if($.kind==="min"){if(w===null||$.value>w)w=$.value}return w}get maxValue(){let w=null;for(let $ of this._def.checks)if($.kind==="max"){if(w===null||$.value<w)w=$.value}return w}};L6.create=(w)=>{return new L6({checks:[],typeName:C0.ZodBigInt,coerce:w?.coerce??!1,...o0(w)})};$9=class $9 extends X1{_parse(w){if(this._def.coerce)w.data=Boolean(w.data);if(this._getType(w)!==Q0.boolean){let f=this._getOrReturnCtx(w);return z0(f,{code:H0.invalid_type,expected:Q0.boolean,received:f.parsedType}),b0}return I2(w.data)}};$9.create=(w)=>{return new $9({typeName:C0.ZodBoolean,coerce:w?.coerce||!1,...o0(w)})};u4=class u4 extends X1{_parse(w){if(this._def.coerce)w.data=new Date(w.data);if(this._getType(w)!==Q0.date){let W=this._getOrReturnCtx(w);return z0(W,{code:H0.invalid_type,expected:Q0.date,received:W.parsedType}),b0}if(Number.isNaN(w.data.getTime())){let W=this._getOrReturnCtx(w);return z0(W,{code:H0.invalid_date}),b0}let f=new q2,X=void 0;for(let W of this._def.checks)if(W.kind==="min"){if(w.data.getTime()<W.value)X=this._getOrReturnCtx(w,X),z0(X,{code:H0.too_small,message:W.message,inclusive:!0,exact:!1,minimum:W.value,type:"date"}),f.dirty()}else if(W.kind==="max"){if(w.data.getTime()>W.value)X=this._getOrReturnCtx(w,X),z0(X,{code:H0.too_big,message:W.message,inclusive:!0,exact:!1,maximum:W.value,type:"date"}),f.dirty()}else J1.assertNever(W);return{status:f.value,value:new Date(w.data.getTime())}}_addCheck(w){return new u4({...this._def,checks:[...this._def.checks,w]})}min(w,$){return this._addCheck({kind:"min",value:w.getTime(),message:k0.toString($)})}max(w,$){return this._addCheck({kind:"max",value:w.getTime(),message:k0.toString($)})}get minDate(){let w=null;for(let $ of this._def.checks)if($.kind==="min"){if(w===null||$.value>w)w=$.value}return w!=null?new Date(w):null}get maxDate(){let w=null;for(let $ of this._def.checks)if($.kind==="max"){if(w===null||$.value<w)w=$.value}return w!=null?new Date(w):null}};u4.create=(w)=>{return new u4({checks:[],coerce:w?.coerce||!1,typeName:C0.ZodDate,...o0(w)})};p8=class p8 extends X1{_parse(w){if(this._getType(w)!==Q0.symbol){let f=this._getOrReturnCtx(w);return z0(f,{code:H0.invalid_type,expected:Q0.symbol,received:f.parsedType}),b0}return I2(w.data)}};p8.create=(w)=>{return new p8({typeName:C0.ZodSymbol,...o0(w)})};f9=class f9 extends X1{_parse(w){if(this._getType(w)!==Q0.undefined){let f=this._getOrReturnCtx(w);return z0(f,{code:H0.invalid_type,expected:Q0.undefined,received:f.parsedType}),b0}return I2(w.data)}};f9.create=(w)=>{return new f9({typeName:C0.ZodUndefined,...o0(w)})};X9=class X9 extends X1{_parse(w){if(this._getType(w)!==Q0.null){let f=this._getOrReturnCtx(w);return z0(f,{code:H0.invalid_type,expected:Q0.null,received:f.parsedType}),b0}return I2(w.data)}};X9.create=(w)=>{return new X9({typeName:C0.ZodNull,...o0(w)})};y4=class y4 extends X1{constructor(){super(...arguments);this._any=!0}_parse(w){return I2(w.data)}};y4.create=(w)=>{return new y4({typeName:C0.ZodAny,...o0(w)})};P6=class P6 extends X1{constructor(){super(...arguments);this._unknown=!0}_parse(w){return I2(w.data)}};P6.create=(w)=>{return new P6({typeName:C0.ZodUnknown,...o0(w)})};Z3=class Z3 extends X1{_parse(w){let $=this._getOrReturnCtx(w);return z0($,{code:H0.invalid_type,expected:Q0.never,received:$.parsedType}),b0}};Z3.create=(w)=>{return new Z3({typeName:C0.ZodNever,...o0(w)})};c8=class c8 extends X1{_parse(w){if(this._getType(w)!==Q0.undefined){let f=this._getOrReturnCtx(w);return z0(f,{code:H0.invalid_type,expected:Q0.void,received:f.parsedType}),b0}return I2(w.data)}};c8.create=(w)=>{return new c8({typeName:C0.ZodVoid,...o0(w)})};l5=class l5 extends X1{_parse(w){let{ctx:$,status:f}=this._processInputParams(w),X=this._def;if($.parsedType!==Q0.array)return z0($,{code:H0.invalid_type,expected:Q0.array,received:$.parsedType}),b0;if(X.exactLength!==null){let Y=$.data.length>X.exactLength.value,J=$.data.length<X.exactLength.value;if(Y||J)z0($,{code:Y?H0.too_big:H0.too_small,minimum:J?X.exactLength.value:void 0,maximum:Y?X.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:X.exactLength.message}),f.dirty()}if(X.minLength!==null){if($.data.length<X.minLength.value)z0($,{code:H0.too_small,minimum:X.minLength.value,type:"array",inclusive:!0,exact:!1,message:X.minLength.message}),f.dirty()}if(X.maxLength!==null){if($.data.length>X.maxLength.value)z0($,{code:H0.too_big,maximum:X.maxLength.value,type:"array",inclusive:!0,exact:!1,message:X.maxLength.message}),f.dirty()}if($.common.async)return Promise.all([...$.data].map((Y,J)=>{return X.type._parseAsync(new p5($,Y,$.path,J))})).then((Y)=>{return q2.mergeArray(f,Y)});let W=[...$.data].map((Y,J)=>{return X.type._parseSync(new p5($,Y,$.path,J))});return q2.mergeArray(f,W)}get element(){return this._def.type}min(w,$){return new l5({...this._def,minLength:{value:w,message:k0.toString($)}})}max(w,$){return new l5({...this._def,maxLength:{value:w,message:k0.toString($)}})}length(w,$){return new l5({...this._def,exactLength:{value:w,message:k0.toString($)}})}nonempty(w){return this.min(1,w)}};l5.create=(w,$)=>{return new l5({type:w,minLength:null,maxLength:null,exactLength:null,typeName:C0.ZodArray,...o0($)})};r1=class r1 extends X1{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let w=this._def.shape(),$=J1.objectKeys(w);return this._cached={shape:w,keys:$},this._cached}_parse(w){if(this._getType(w)!==Q0.object){let A=this._getOrReturnCtx(w);return z0(A,{code:H0.invalid_type,expected:Q0.object,received:A.parsedType}),b0}let{status:f,ctx:X}=this._processInputParams(w),{shape:W,keys:Y}=this._getCached(),J=[];if(!(this._def.catchall instanceof Z3&&this._def.unknownKeys==="strip")){for(let A in X.data)if(!Y.includes(A))J.push(A)}let G=[];for(let A of Y){let U=W[A],K=X.data[A];G.push({key:{status:"valid",value:A},value:U._parse(new p5(X,K,X.path,A)),alwaysSet:A in X.data})}if(this._def.catchall instanceof Z3){let A=this._def.unknownKeys;if(A==="passthrough")for(let U of J)G.push({key:{status:"valid",value:U},value:{status:"valid",value:X.data[U]}});else if(A==="strict"){if(J.length>0)z0(X,{code:H0.unrecognized_keys,keys:J}),f.dirty()}else if(A==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let A=this._def.catchall;for(let U of J){let K=X.data[U];G.push({key:{status:"valid",value:U},value:A._parse(new p5(X,K,X.path,U)),alwaysSet:U in X.data})}}if(X.common.async)return Promise.resolve().then(async()=>{let A=[];for(let U of G){let K=await U.key,h=await U.value;A.push({key:K,value:h,alwaysSet:U.alwaysSet})}return A}).then((A)=>{return q2.mergeObjectSync(f,A)});else return q2.mergeObjectSync(f,G)}get shape(){return this._def.shape()}strict(w){return k0.errToObj,new r1({...this._def,unknownKeys:"strict",...w!==void 0?{errorMap:($,f)=>{let X=this._def.errorMap?.($,f).message??f.defaultError;if($.code==="unrecognized_keys")return{message:k0.errToObj(w).message??X};return{message:X}}}:{}})}strip(){return new r1({...this._def,unknownKeys:"strip"})}passthrough(){return new r1({...this._def,unknownKeys:"passthrough"})}extend(w){return new r1({...this._def,shape:()=>({...this._def.shape(),...w})})}merge(w){return new r1({unknownKeys:w._def.unknownKeys,catchall:w._def.catchall,shape:()=>({...this._def.shape(),...w._def.shape()}),typeName:C0.ZodObject})}setKey(w,$){return this.augment({[w]:$})}catchall(w){return new r1({...this._def,catchall:w})}pick(w){let $={};for(let f of J1.objectKeys(w))if(w[f]&&this.shape[f])$[f]=this.shape[f];return new r1({...this._def,shape:()=>$})}omit(w){let $={};for(let f of J1.objectKeys(this.shape))if(!w[f])$[f]=this.shape[f];return new r1({...this._def,shape:()=>$})}deepPartial(){return ew(this)}partial(w){let $={};for(let f of J1.objectKeys(this.shape)){let X=this.shape[f];if(w&&!w[f])$[f]=X;else $[f]=X.optional()}return new r1({...this._def,shape:()=>$})}required(w){let $={};for(let f of J1.objectKeys(this.shape))if(w&&!w[f])$[f]=this.shape[f];else{let W=this.shape[f];while(W instanceof r5)W=W._def.innerType;$[f]=W}return new r1({...this._def,shape:()=>$})}keyof(){return qM(J1.objectKeys(this.shape))}};r1.create=(w,$)=>{return new r1({shape:()=>w,unknownKeys:"strip",catchall:Z3.create(),typeName:C0.ZodObject,...o0($)})};r1.strictCreate=(w,$)=>{return new r1({shape:()=>w,unknownKeys:"strict",catchall:Z3.create(),typeName:C0.ZodObject,...o0($)})};r1.lazycreate=(w,$)=>{return new r1({shape:w,unknownKeys:"strip",catchall:Z3.create(),typeName:C0.ZodObject,...o0($)})};W9=class W9 extends X1{_parse(w){let{ctx:$}=this._processInputParams(w),f=this._def.options;function X(W){for(let J of W)if(J.result.status==="valid")return J.result;for(let J of W)if(J.result.status==="dirty")return $.common.issues.push(...J.ctx.common.issues),J.result;let Y=W.map((J)=>new o2(J.ctx.common.issues));return z0($,{code:H0.invalid_union,unionErrors:Y}),b0}if($.common.async)return Promise.all(f.map(async(W)=>{let Y={...$,common:{...$.common,issues:[]},parent:null};return{result:await W._parseAsync({data:$.data,path:$.path,parent:Y}),ctx:Y}})).then(X);else{let W=void 0,Y=[];for(let G of f){let A={...$,common:{...$.common,issues:[]},parent:null},U=G._parseSync({data:$.data,path:$.path,parent:A});if(U.status==="valid")return U;else if(U.status==="dirty"&&!W)W={result:U,ctx:A};if(A.common.issues.length)Y.push(A.common.issues)}if(W)return $.common.issues.push(...W.ctx.common.issues),W.result;let J=Y.map((G)=>new o2(G));return z0($,{code:H0.invalid_union,unionErrors:J}),b0}}get options(){return this._def.options}};W9.create=(w,$)=>{return new W9({options:w,typeName:C0.ZodUnion,...o0($)})};cf=class cf extends X1{_parse(w){let{ctx:$}=this._processInputParams(w);if($.parsedType!==Q0.object)return z0($,{code:H0.invalid_type,expected:Q0.object,received:$.parsedType}),b0;let f=this.discriminator,X=$.data[f],W=this.optionsMap.get(X);if(!W)return z0($,{code:H0.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[f]}),b0;if($.common.async)return W._parseAsync({data:$.data,path:$.path,parent:$});else return W._parseSync({data:$.data,path:$.path,parent:$})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(w,$,f){let X=new Map;for(let W of $){let Y=l3(W.shape[w]);if(!Y.length)throw Error(`A discriminator value for key \`${w}\` could not be extracted from all schema options`);for(let J of Y){if(X.has(J))throw Error(`Discriminator property ${String(w)} has duplicate value ${String(J)}`);X.set(J,W)}}return new cf({typeName:C0.ZodDiscriminatedUnion,discriminator:w,options:$,optionsMap:X,...o0(f)})}};Y9=class Y9 extends X1{_parse(w){let{status:$,ctx:f}=this._processInputParams(w),X=(W,Y)=>{if(rf(W)||rf(Y))return b0;let J=dG(W.value,Y.value);if(!J.valid)return z0(f,{code:H0.invalid_intersection_types}),b0;if(pf(W)||pf(Y))$.dirty();return{status:$.value,value:J.data}};if(f.common.async)return Promise.all([this._def.left._parseAsync({data:f.data,path:f.path,parent:f}),this._def.right._parseAsync({data:f.data,path:f.path,parent:f})]).then(([W,Y])=>X(W,Y));else return X(this._def.left._parseSync({data:f.data,path:f.path,parent:f}),this._def.right._parseSync({data:f.data,path:f.path,parent:f}))}};Y9.create=(w,$,f)=>{return new Y9({left:w,right:$,typeName:C0.ZodIntersection,...o0(f)})};M3=class M3 extends X1{_parse(w){let{status:$,ctx:f}=this._processInputParams(w);if(f.parsedType!==Q0.array)return z0(f,{code:H0.invalid_type,expected:Q0.array,received:f.parsedType}),b0;if(f.data.length<this._def.items.length)return z0(f,{code:H0.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b0;if(!this._def.rest&&f.data.length>this._def.items.length)z0(f,{code:H0.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$.dirty();let W=[...f.data].map((Y,J)=>{let G=this._def.items[J]||this._def.rest;if(!G)return null;return G._parse(new p5(f,Y,f.path,J))}).filter((Y)=>!!Y);if(f.common.async)return Promise.all(W).then((Y)=>{return q2.mergeArray($,Y)});else return q2.mergeArray($,W)}get items(){return this._def.items}rest(w){return new M3({...this._def,rest:w})}};M3.create=(w,$)=>{if(!Array.isArray(w))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new M3({items:w,typeName:C0.ZodTuple,rest:null,...o0($)})};i8=class i8 extends X1{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(w){let{status:$,ctx:f}=this._processInputParams(w);if(f.parsedType!==Q0.object)return z0(f,{code:H0.invalid_type,expected:Q0.object,received:f.parsedType}),b0;let X=[],W=this._def.keyType,Y=this._def.valueType;for(let J in f.data)X.push({key:W._parse(new p5(f,J,f.path,J)),value:Y._parse(new p5(f,f.data[J],f.path,J)),alwaysSet:J in f.data});if(f.common.async)return q2.mergeObjectAsync($,X);else return q2.mergeObjectSync($,X)}get element(){return this._def.valueType}static create(w,$,f){if($ instanceof X1)return new i8({keyType:w,valueType:$,typeName:C0.ZodRecord,...o0(f)});return new i8({keyType:m5.create(),valueType:w,typeName:C0.ZodRecord,...o0($)})}};d8=class d8 extends X1{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(w){let{status:$,ctx:f}=this._processInputParams(w);if(f.parsedType!==Q0.map)return z0(f,{code:H0.invalid_type,expected:Q0.map,received:f.parsedType}),b0;let X=this._def.keyType,W=this._def.valueType,Y=[...f.data.entries()].map(([J,G],A)=>{return{key:X._parse(new p5(f,J,f.path,[A,"key"])),value:W._parse(new p5(f,G,f.path,[A,"value"]))}});if(f.common.async){let J=new Map;return Promise.resolve().then(async()=>{for(let G of Y){let A=await G.key,U=await G.value;if(A.status==="aborted"||U.status==="aborted")return b0;if(A.status==="dirty"||U.status==="dirty")$.dirty();J.set(A.value,U.value)}return{status:$.value,value:J}})}else{let J=new Map;for(let G of Y){let{key:A,value:U}=G;if(A.status==="aborted"||U.status==="aborted")return b0;if(A.status==="dirty"||U.status==="dirty")$.dirty();J.set(A.value,U.value)}return{status:$.value,value:J}}}};d8.create=(w,$,f)=>{return new d8({valueType:$,keyType:w,typeName:C0.ZodMap,...o0(f)})};g4=class g4 extends X1{_parse(w){let{status:$,ctx:f}=this._processInputParams(w);if(f.parsedType!==Q0.set)return z0(f,{code:H0.invalid_type,expected:Q0.set,received:f.parsedType}),b0;let X=this._def;if(X.minSize!==null){if(f.data.size<X.minSize.value)z0(f,{code:H0.too_small,minimum:X.minSize.value,type:"set",inclusive:!0,exact:!1,message:X.minSize.message}),$.dirty()}if(X.maxSize!==null){if(f.data.size>X.maxSize.value)z0(f,{code:H0.too_big,maximum:X.maxSize.value,type:"set",inclusive:!0,exact:!1,message:X.maxSize.message}),$.dirty()}let W=this._def.valueType;function Y(G){let A=new Set;for(let U of G){if(U.status==="aborted")return b0;if(U.status==="dirty")$.dirty();A.add(U.value)}return{status:$.value,value:A}}let J=[...f.data.values()].map((G,A)=>W._parse(new p5(f,G,f.path,A)));if(f.common.async)return Promise.all(J).then((G)=>Y(G));else return Y(J)}min(w,$){return new g4({...this._def,minSize:{value:w,message:k0.toString($)}})}max(w,$){return new g4({...this._def,maxSize:{value:w,message:k0.toString($)}})}size(w,$){return this.min(w,$).max(w,$)}nonempty(w){return this.min(1,w)}};g4.create=(w,$)=>{return new g4({valueType:w,minSize:null,maxSize:null,typeName:C0.ZodSet,...o0($)})};w9=class w9 extends X1{constructor(){super(...arguments);this.validate=this.implement}_parse(w){let{ctx:$}=this._processInputParams(w);if($.parsedType!==Q0.function)return z0($,{code:H0.invalid_type,expected:Q0.function,received:$.parsedType}),b0;function f(J,G){return r8({data:J,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,sw(),m3].filter((A)=>!!A),issueData:{code:H0.invalid_arguments,argumentsError:G}})}function X(J,G){return r8({data:J,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,sw(),m3].filter((A)=>!!A),issueData:{code:H0.invalid_return_type,returnTypeError:G}})}let W={errorMap:$.common.contextualErrorMap},Y=$.data;if(this._def.returns instanceof x4){let J=this;return I2(async function(...G){let A=new o2([]),U=await J._def.args.parseAsync(G,W).catch((O)=>{throw A.addIssue(f(G,O)),A}),K=await Reflect.apply(Y,this,U);return await J._def.returns._def.type.parseAsync(K,W).catch((O)=>{throw A.addIssue(X(K,O)),A})})}else{let J=this;return I2(function(...G){let A=J._def.args.safeParse(G,W);if(!A.success)throw new o2([f(G,A.error)]);let U=Reflect.apply(Y,this,A.data),K=J._def.returns.safeParse(U,W);if(!K.success)throw new o2([X(U,K.error)]);return K.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...w){return new w9({...this._def,args:M3.create(w).rest(P6.create())})}returns(w){return new w9({...this._def,returns:w})}implement(w){return this.parse(w)}strictImplement(w){return this.parse(w)}static create(w,$,f){return new w9({args:w?w:M3.create([]).rest(P6.create()),returns:$||P6.create(),typeName:C0.ZodFunction,...o0(f)})}};J9=class J9 extends X1{get schema(){return this._def.getter()}_parse(w){let{ctx:$}=this._processInputParams(w);return this._def.getter()._parse({data:$.data,path:$.path,parent:$})}};J9.create=(w,$)=>{return new J9({getter:w,typeName:C0.ZodLazy,...o0($)})};G9=class G9 extends X1{_parse(w){if(w.data!==this._def.value){let $=this._getOrReturnCtx(w);return z0($,{received:$.data,code:H0.invalid_literal,expected:this._def.value}),b0}return{status:"valid",value:w.data}}get value(){return this._def.value}};G9.create=(w,$)=>{return new G9({value:w,typeName:C0.ZodLiteral,...o0($)})};_6=class _6 extends X1{_parse(w){if(typeof w.data!=="string"){let $=this._getOrReturnCtx(w),f=this._def.values;return z0($,{expected:J1.joinValues(f),received:$.parsedType,code:H0.invalid_type}),b0}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(w.data)){let $=this._getOrReturnCtx(w),f=this._def.values;return z0($,{received:$.data,code:H0.invalid_enum_value,options:f}),b0}return I2(w.data)}get options(){return this._def.values}get enum(){let w={};for(let $ of this._def.values)w[$]=$;return w}get Values(){let w={};for(let $ of this._def.values)w[$]=$;return w}get Enum(){let w={};for(let $ of this._def.values)w[$]=$;return w}extract(w,$=this._def){return _6.create(w,{...this._def,...$})}exclude(w,$=this._def){return _6.create(this.options.filter((f)=>!w.includes(f)),{...this._def,...$})}};_6.create=qM;A9=class A9 extends X1{_parse(w){let $=J1.getValidEnumValues(this._def.values),f=this._getOrReturnCtx(w);if(f.parsedType!==Q0.string&&f.parsedType!==Q0.number){let X=J1.objectValues($);return z0(f,{expected:J1.joinValues(X),received:f.parsedType,code:H0.invalid_type}),b0}if(!this._cache)this._cache=new Set(J1.getValidEnumValues(this._def.values));if(!this._cache.has(w.data)){let X=J1.objectValues($);return z0(f,{received:f.data,code:H0.invalid_enum_value,options:X}),b0}return I2(w.data)}get enum(){return this._def.values}};A9.create=(w,$)=>{return new A9({values:w,typeName:C0.ZodNativeEnum,...o0($)})};x4=class x4 extends X1{unwrap(){return this._def.type}_parse(w){let{ctx:$}=this._processInputParams(w);if($.parsedType!==Q0.promise&&$.common.async===!1)return z0($,{code:H0.invalid_type,expected:Q0.promise,received:$.parsedType}),b0;let f=$.parsedType===Q0.promise?$.data:Promise.resolve($.data);return I2(f.then((X)=>{return this._def.type.parseAsync(X,{path:$.path,errorMap:$.common.contextualErrorMap})}))}};x4.create=(w,$)=>{return new x4({type:w,typeName:C0.ZodPromise,...o0($)})};c5=class c5 extends X1{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C0.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(w){let{status:$,ctx:f}=this._processInputParams(w),X=this._def.effect||null,W={addIssue:(Y)=>{if(z0(f,Y),Y.fatal)$.abort();else $.dirty()},get path(){return f.path}};if(W.addIssue=W.addIssue.bind(W),X.type==="preprocess"){let Y=X.transform(f.data,W);if(f.common.async)return Promise.resolve(Y).then(async(J)=>{if($.value==="aborted")return b0;let G=await this._def.schema._parseAsync({data:J,path:f.path,parent:f});if(G.status==="aborted")return b0;if(G.status==="dirty")return C4(G.value);if($.value==="dirty")return C4(G.value);return G});else{if($.value==="aborted")return b0;let J=this._def.schema._parseSync({data:Y,path:f.path,parent:f});if(J.status==="aborted")return b0;if(J.status==="dirty")return C4(J.value);if($.value==="dirty")return C4(J.value);return J}}if(X.type==="refinement"){let Y=(J)=>{let G=X.refinement(J,W);if(f.common.async)return Promise.resolve(G);if(G instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return J};if(f.common.async===!1){let J=this._def.schema._parseSync({data:f.data,path:f.path,parent:f});if(J.status==="aborted")return b0;if(J.status==="dirty")$.dirty();return Y(J.value),{status:$.value,value:J.value}}else return this._def.schema._parseAsync({data:f.data,path:f.path,parent:f}).then((J)=>{if(J.status==="aborted")return b0;if(J.status==="dirty")$.dirty();return Y(J.value).then(()=>{return{status:$.value,value:J.value}})})}if(X.type==="transform")if(f.common.async===!1){let Y=this._def.schema._parseSync({data:f.data,path:f.path,parent:f});if(!v6(Y))return b0;let J=X.transform(Y.value,W);if(J instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:$.value,value:J}}else return this._def.schema._parseAsync({data:f.data,path:f.path,parent:f}).then((Y)=>{if(!v6(Y))return b0;return Promise.resolve(X.transform(Y.value,W)).then((J)=>({status:$.value,value:J}))});J1.assertNever(X)}};c5.create=(w,$,f)=>{return new c5({schema:w,typeName:C0.ZodEffects,effect:$,...o0(f)})};c5.createWithPreprocess=(w,$,f)=>{return new c5({schema:$,effect:{type:"preprocess",transform:w},typeName:C0.ZodEffects,...o0(f)})};r5=class r5 extends X1{_parse(w){if(this._getType(w)===Q0.undefined)return I2(void 0);return this._def.innerType._parse(w)}unwrap(){return this._def.innerType}};r5.create=(w,$)=>{return new r5({innerType:w,typeName:C0.ZodOptional,...o0($)})};r3=class r3 extends X1{_parse(w){if(this._getType(w)===Q0.null)return I2(null);return this._def.innerType._parse(w)}unwrap(){return this._def.innerType}};r3.create=(w,$)=>{return new r3({innerType:w,typeName:C0.ZodNullable,...o0($)})};H9=class H9 extends X1{_parse(w){let{ctx:$}=this._processInputParams(w),f=$.data;if($.parsedType===Q0.undefined)f=this._def.defaultValue();return this._def.innerType._parse({data:f,path:$.path,parent:$})}removeDefault(){return this._def.innerType}};H9.create=(w,$)=>{return new H9({innerType:w,typeName:C0.ZodDefault,defaultValue:typeof $.default==="function"?$.default:()=>$.default,...o0($)})};U9=class U9 extends X1{_parse(w){let{ctx:$}=this._processInputParams(w),f={...$,common:{...$.common,issues:[]}},X=this._def.innerType._parse({data:f.data,path:f.path,parent:{...f}});if(tw(X))return X.then((W)=>{return{status:"valid",value:W.status==="valid"?W.value:this._def.catchValue({get error(){return new o2(f.common.issues)},input:f.data})}});else return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new o2(f.common.issues)},input:f.data})}}removeCatch(){return this._def.innerType}};U9.create=(w,$)=>{return new U9({innerType:w,typeName:C0.ZodCatch,catchValue:typeof $.catch==="function"?$.catch:()=>$.catch,...o0($)})};n8=class n8 extends X1{_parse(w){if(this._getType(w)!==Q0.nan){let f=this._getOrReturnCtx(w);return z0(f,{code:H0.invalid_type,expected:Q0.nan,received:f.parsedType}),b0}return{status:"valid",value:w.data}}};n8.create=(w)=>{return new n8({typeName:C0.ZodNaN,...o0(w)})};jr=Symbol("zod_brand");df=class df extends X1{_parse(w){let{ctx:$}=this._processInputParams(w),f=$.data;return this._def.type._parse({data:f,path:$.path,parent:$})}unwrap(){return this._def.type}};o8=class o8 extends X1{_parse(w){let{status:$,ctx:f}=this._processInputParams(w);if(f.common.async)return(async()=>{let W=await this._def.in._parseAsync({data:f.data,path:f.path,parent:f});if(W.status==="aborted")return b0;if(W.status==="dirty")return $.dirty(),C4(W.value);else return this._def.out._parseAsync({data:W.value,path:f.path,parent:f})})();else{let X=this._def.in._parseSync({data:f.data,path:f.path,parent:f});if(X.status==="aborted")return b0;if(X.status==="dirty")return $.dirty(),{status:"dirty",value:X.value};else return this._def.out._parseSync({data:X.value,path:f.path,parent:f})}}static create(w,$){return new o8({in:w,out:$,typeName:C0.ZodPipeline})}};K9=class K9 extends X1{_parse(w){let $=this._def.innerType._parse(w),f=(X)=>{if(v6(X))X.value=Object.freeze(X.value);return X};return tw($)?$.then((X)=>f(X)):f($)}unwrap(){return this._def.innerType}};K9.create=(w,$)=>{return new K9({innerType:w,typeName:C0.ZodReadonly,...o0($)})};Ir={object:r1.lazycreate};(function(w){w.ZodString="ZodString",w.ZodNumber="ZodNumber",w.ZodNaN="ZodNaN",w.ZodBigInt="ZodBigInt",w.ZodBoolean="ZodBoolean",w.ZodDate="ZodDate",w.ZodSymbol="ZodSymbol",w.ZodUndefined="ZodUndefined",w.ZodNull="ZodNull",w.ZodAny="ZodAny",w.ZodUnknown="ZodUnknown",w.ZodNever="ZodNever",w.ZodVoid="ZodVoid",w.ZodArray="ZodArray",w.ZodObject="ZodObject",w.ZodUnion="ZodUnion",w.ZodDiscriminatedUnion="ZodDiscriminatedUnion",w.ZodIntersection="ZodIntersection",w.ZodTuple="ZodTuple",w.ZodRecord="ZodRecord",w.ZodMap="ZodMap",w.ZodSet="ZodSet",w.ZodFunction="ZodFunction",w.ZodLazy="ZodLazy",w.ZodLiteral="ZodLiteral",w.ZodEnum="ZodEnum",w.ZodEffects="ZodEffects",w.ZodNativeEnum="ZodNativeEnum",w.ZodOptional="ZodOptional",w.ZodNullable="ZodNullable",w.ZodDefault="ZodDefault",w.ZodCatch="ZodCatch",w.ZodPromise="ZodPromise",w.ZodBranded="ZodBranded",w.ZodPipeline="ZodPipeline",w.ZodReadonly="ZodReadonly"})(C0||(C0={}));vM=m5.create,PM=k6.create,Cr=n8.create,ur=L6.create,kM=$9.create,yr=u4.create,gr=p8.create,xr=f9.create,mr=X9.create,lr=y4.create,rr=P6.create,pr=Z3.create,cr=c8.create,ir=l5.create,dr=r1.create,nr=r1.strictCreate,or=W9.create,ar=cf.create,sr=Y9.create,tr=M3.create,er=i8.create,wp=d8.create,$p=g4.create,fp=w9.create,Xp=J9.create,Wp=G9.create,Yp=_6.create,Jp=A9.create,Gp=x4.create,Ap=c5.create,Hp=r5.create,Up=r3.create,Kp=c5.createWithPreprocess,hp=o8.create,Zp={string:(w)=>m5.create({...w,coerce:!0}),number:(w)=>k6.create({...w,coerce:!0}),boolean:(w)=>$9.create({...w,coerce:!0}),bigint:(w)=>L6.create({...w,coerce:!0}),date:(w)=>u4.create({...w,coerce:!0})},Mp=b0});var F={};xf(F,{void:()=>cr,util:()=>J1,unknown:()=>rr,union:()=>or,undefined:()=>xr,tuple:()=>tr,transformer:()=>Ap,symbol:()=>gr,string:()=>vM,strictObject:()=>nr,setErrorMap:()=>Ur,set:()=>$p,record:()=>er,quotelessJson:()=>Ar,promise:()=>Gp,preprocess:()=>Kp,pipeline:()=>hp,ostring:()=>Fp,optional:()=>Hp,onumber:()=>Op,oboolean:()=>Qp,objectUtil:()=>rG,object:()=>dr,number:()=>PM,nullable:()=>Up,null:()=>mr,never:()=>pr,nativeEnum:()=>Jp,nan:()=>Cr,map:()=>wp,makeIssue:()=>r8,literal:()=>Wp,lazy:()=>Xp,late:()=>Ir,isValid:()=>v6,isDirty:()=>pf,isAsync:()=>tw,isAborted:()=>rf,intersection:()=>sr,instanceof:()=>Sr,getParsedType:()=>Q3,getErrorMap:()=>sw,function:()=>fp,enum:()=>Yp,effect:()=>Ap,discriminatedUnion:()=>ar,defaultErrorMap:()=>m3,datetimeRegex:()=>NM,date:()=>yr,custom:()=>DM,coerce:()=>Zp,boolean:()=>kM,bigint:()=>ur,array:()=>ir,any:()=>lr,addIssueToContext:()=>z0,ZodVoid:()=>c8,ZodUnknown:()=>P6,ZodUnion:()=>W9,ZodUndefined:()=>f9,ZodType:()=>X1,ZodTuple:()=>M3,ZodTransformer:()=>c5,ZodSymbol:()=>p8,ZodString:()=>m5,ZodSet:()=>g4,ZodSchema:()=>X1,ZodRecord:()=>i8,ZodReadonly:()=>K9,ZodPromise:()=>x4,ZodPipeline:()=>o8,ZodParsedType:()=>Q0,ZodOptional:()=>r5,ZodObject:()=>r1,ZodNumber:()=>k6,ZodNullable:()=>r3,ZodNull:()=>X9,ZodNever:()=>Z3,ZodNativeEnum:()=>A9,ZodNaN:()=>n8,ZodMap:()=>d8,ZodLiteral:()=>G9,ZodLazy:()=>J9,ZodIssueCode:()=>H0,ZodIntersection:()=>Y9,ZodFunction:()=>w9,ZodFirstPartyTypeKind:()=>C0,ZodError:()=>o2,ZodEnum:()=>_6,ZodEffects:()=>c5,ZodDiscriminatedUnion:()=>cf,ZodDefault:()=>H9,ZodDate:()=>u4,ZodCatch:()=>U9,ZodBranded:()=>df,ZodBoolean:()=>$9,ZodBigInt:()=>L6,ZodArray:()=>l5,ZodAny:()=>y4,Schema:()=>X1,ParseStatus:()=>q2,OK:()=>I2,NEVER:()=>Mp,INVALID:()=>b0,EMPTY_PATH:()=>Kr,DIRTY:()=>C4,BRAND:()=>jr});var nG=C(()=>{lf();cG();ZM();l8();LM();mf()});var G2=C(()=>{nG();nG()});var Z0=C(()=>{G2()});var oG=()=>{};var p3,Bp,h9,TM,Vp;var aG=C(()=>{Z0();oG();p3=F.enum(["anchor","trusted","public"]),Bp=F.enum(["create","update","delete","extract","publish"]),h9=F.enum(["never","anchor","trusted","public"]),TM=F.object({create:h9.optional(),update:h9.optional(),delete:h9.optional(),extract:h9.optional(),publish:h9.optional()}).strict(),Vp=F.record(F.string(),TM)});function EM(w,$){return(f)=>{let X=w.parse(f);return $(X)}}function E1(w){let{layout:$,schema:f,...X}=w,W={...X,schema:f};if($){if(W.layout={},$.component)W.layout.component=EM(f,$.component);if($.fullscreen!==void 0)W.layout.fullscreen=$.fullscreen}return W}var zp;var bM=C(()=>{Z0();aG();zp=F.object({name:F.string(),description:F.string(),schema:F.any(),basePrompt:F.string().optional(),useKnowledgeContext:F.boolean().optional(),requiredPermission:p3,formatter:F.any().optional(),layout:F.object({component:F.any(),fullscreen:F.boolean().optional()}).optional(),dataSourceId:F.string().optional()})});class a8{static canGenerate(w){return!!w.basePrompt&&!!w.dataSourceId&&w.dataSourceId.includes("ai-content")}static canFetch(w){return!!w.dataSourceId&&!this.canGenerate(w)}static canRender(w){return!!w.layout?.component}static isStaticOnly(w){return!this.canGenerate(w)&&!this.canFetch(w)}static getCapabilities(w){return{canGenerate:this.canGenerate(w),canFetch:this.canFetch(w),canRender:this.canRender(w),isStaticOnly:this.isStaticOnly(w)}}static validate(w){let $=[];if(w.dataSourceId?.includes("ai-content")&&!w.basePrompt)$.push(`Template "${w.name}" has AI-content dataSourceId but no basePrompt. AI generation requires a basePrompt.`);if(w.basePrompt&&(!w.dataSourceId||!w.dataSourceId.includes("ai-content")))$.push(`Template "${w.name}" has basePrompt but no AI-content dataSourceId. The basePrompt won't be used.`);return $}static logCapabilities(w,$){let f=this.getCapabilities(w),X=this.validate(w);if($)$.debug(`Template capabilities for "${w.name}":`,{...f,errors:X.length>0?X:void 0})}}var jM=()=>{};var Rp,IM,Np,qp,Dp;var SM=C(()=>{Z0();Rp=F.enum(["site-content-preview","site-content-production"]),IM=F.enum(["web","image","pdf"]),Np=F.object({name:F.string(),schema:F.any(),description:F.string().optional(),pluginId:F.string(),renderers:F.object({web:F.union([F.function(),F.string()]).optional(),image:F.union([F.function(),F.string()]).optional(),pdf:F.union([F.function(),F.string()]).optional()})}),qp=F.object({enableContentGeneration:F.boolean().default(!1),outputDir:F.string(),workingDir:F.string().optional(),environment:F.enum(["preview","production"]).default("preview"),siteConfig:F.object({title:F.string(),description:F.string(),url:F.string().optional()}).optional()}),Dp=F.object({success:F.boolean(),routesBuilt:F.number(),errors:F.array(F.string()).optional(),warnings:F.array(F.string()).optional()})});var j5=C(()=>{bM();jM();aG();oG();SM()});var uM,vp;var yM=C(()=>{G2();uM=F.object({type:F.literal("event"),event:F.string().min(1),fromState:F.string().min(1).optional()}),vp=F.object({conversationId:F.string().min(1),interfaceType:F.string().min(1),channelId:F.string().min(1).optional(),channelName:F.string().min(1),userPermissionLevel:F.enum(["anchor","trusted","public"]),action:uM})});var nf,of,F9,af,sf,O9,tf,ef,wX,$X,fX,XX,s8,WX,sG;var gM=C(()=>{G2();nf=F.object({id:F.string(),toolCallId:F.string().optional(),toolName:F.string(),summary:F.string(),completionSummary:F.string().optional(),preview:F.string().optional(),args:F.unknown()}),of=F.enum(["approval-requested","approval-responded","output-available","output-denied","output-error"]),F9=F.object({kind:F.literal("tool-approval"),id:F.string(),toolCallId:F.string().optional(),toolName:F.string(),input:F.record(F.unknown()).optional(),summary:F.string(),completionSummary:F.string().optional(),preview:F.string().optional(),state:of,output:F.unknown().optional(),error:F.string().optional()}),af=F.object({entityType:F.string().optional(),entityId:F.string().optional(),attachmentType:F.string().optional()}),sf=F.object({mediaType:F.string().min(1),url:F.string().min(1),downloadUrl:F.string().min(1).optional(),previewUrl:F.string().min(1).optional(),filename:F.string().min(1).optional(),sizeBytes:F.number().nonnegative().optional(),source:af.optional()}),O9=F.object({kind:F.literal("attachment"),id:F.string(),jobId:F.string().optional(),title:F.string(),description:F.string().optional(),attachment:sf}),tf=F.object({id:F.string().min(1),title:F.string().min(1).optional(),source:F.string().min(1),url:F.string().min(1).optional(),entityType:F.string().min(1).optional(),entityId:F.string().min(1).optional(),excerpt:F.string().min(1).optional(),provenance:F.record(F.unknown()).optional()}),ef=F.object({kind:F.literal("sources"),id:F.string().min(1),title:F.string().min(1).optional(),sources:F.array(tf).min(1)}),wX=F.object({type:F.literal("prompt"),id:F.string().min(1),label:F.string().min(1),prompt:F.string().min(1),description:F.string().min(1).optional()}),$X=F.object({type:F.literal("event"),id:F.string().min(1),label:F.string().min(1),event:F.string().min(1),fromState:F.string().min(1).optional(),description:F.string().min(1).optional()}),fX=F.discriminatedUnion("type",[wX,$X]),XX=F.object({kind:F.literal("actions"),id:F.string().min(1),title:F.string().min(1).optional(),defaultOpen:F.boolean().optional(),actions:F.array(fX).min(1)}),s8=F.discriminatedUnion("kind",[F9,O9,ef,XX]),WX=F.object({toolName:F.string(),args:F.record(F.unknown()).optional(),jobId:F.string().optional(),data:F.unknown().optional(),error:F.object({message:F.string(),code:F.string().optional()}).optional()}),sG=F.object({text:F.string(),toolResults:F.array(WX).optional(),cards:F.array(s8).optional(),pendingConfirmations:F.array(nf).optional(),usage:F.object({promptTokens:F.number(),completionTokens:F.number(),totalTokens:F.number()})})});var xM,Pp,mM,kp;var lM=C(()=>{G2();xM=F.enum(["anchor","trusted","public"]),Pp=F.object({conversationId:F.string().min(1),message:F.string(),interfaceType:F.string().min(1),channelId:F.string().optional(),channelName:F.string().optional(),userPermissionLevel:xM}),mM=F.object({id:F.string().min(1),source:F.string().min(1),title:F.string().optional(),content:F.string().min(1),provenance:F.record(F.string(),F.unknown()).optional()}),kp=F.object({items:F.array(mM).default([])})});var Lp;var rM=C(()=>{G2();Lp=F.object({url:F.string(),authToken:F.string().optional()})});var t8;var pM=C(()=>{G2();t8=F.object({success:F.boolean(),entityId:F.string().optional(),error:F.string().optional()})});var tG;var cM=C(()=>{tG={success(w){return{success:!0,...w}},failure(w){return{success:!1,error:w instanceof Error?w.message:String(w)}}}});var m4;var iM=C(()=>{G2();m4=F.enum(["user","assistant"])});var e8;var dM=C(()=>{e8={START:0,INIT:10,FETCH:20,PROCESS:40,GENERATE:50,EXTRACT:60,SAVE:80,COMPLETE:100}});var _p;var nM=C(()=>{G2();_p=F.object({id:F.string().min(1),trigger:F.string().min(1),playbookId:F.string().min(1),once:F.boolean().default(!0),starterText:F.string().min(1),description:F.string().min(1).optional(),starterPrompt:F.string().min(1)}).strict()});var eG,oM,wA,$A;var aM=C(()=>{G2();eG=F.object({message:F.string().describe("Natural language response to the query"),summary:F.string().optional().describe("Brief summary if applicable"),topics:F.array(F.string()).optional().describe("Related topics mentioned"),sources:F.array(F.object({id:F.string(),type:F.string(),excerpt:F.string().optional(),relevance:F.number().min(0).max(1).optional()})).optional().describe("Source entities used to answer the query"),metadata:F.record(F.string(),F.unknown()).optional()}).describe("defaultQueryResponse"),oM=F.object({message:F.string()}).describe("simpleTextResponse"),wA=F.object({success:F.boolean(),entityId:F.string().optional(),message:F.string()}).describe("createEntityResponse"),$A=F.object({success:F.boolean(),entityId:F.string(),changes:F.array(F.string()).optional(),message:F.string()}).describe("updateEntityResponse")});var i5=C(()=>{yM();gM();lM();rM();pM();cM();iM();dM();nM();aM()});var Ep,sM;var tM=C(()=>{Z0();Ep=F.object({status:F.enum(["healthy","warning","error","unknown"]),message:F.string().optional(),lastCheck:F.date().optional(),details:F.record(F.string(),F.unknown()).optional()}),sM=F.object({name:F.string(),pluginId:F.string(),status:F.string(),health:Ep.optional()})});var YX,eM,wB,$B,JX;var fA=C(()=>{Z0();YX=F.object({interfaceType:F.string(),userId:F.string(),conversationId:F.string().optional(),channelId:F.string().optional(),channelName:F.string().optional(),runId:F.string().optional(),toolCallId:F.string().optional(),userPermissionLevel:F.enum(["anchor","trusted","public"]).optional()}),eM=F.object({success:F.literal(!0),data:F.unknown(),message:F.string().optional(),cached:F.literal(!0).optional()}).strict().superRefine((w,$)=>{if(!Object.prototype.hasOwnProperty.call(w,"data"))$.addIssue({code:F.ZodIssueCode.custom,path:["data"],message:"Required"})}),wB=F.object({success:F.literal(!1),error:F.string(),code:F.string().optional()}).strict(),$B=F.object({needsConfirmation:F.literal(!0),toolName:F.string(),summary:F.string(),completionSummary:F.string().optional(),preview:F.string().optional(),args:F.unknown()}).strict(),JX=F.union([eM,wB,$B])});var cQ0;var XA=C(()=>{Z0();fA();cQ0=F.union([F.object({success:F.literal(!0),data:F.unknown()}).superRefine((w,$)=>{if(!Object.prototype.hasOwnProperty.call(w,"data"))$.addIssue({code:F.ZodIssueCode.custom,path:["data"],message:"Required"})}),F.object({success:F.literal(!1),error:F.string()})])});import{McpServer as sQ0,ResourceTemplate as tQ0}from"@modelcontextprotocol/sdk/server/mcp.js";var fB=C(()=>{j5();Z0();XA()});var XB=C(()=>{fB();XA()});function t1(w){return w instanceof Error?w.message:String(w)}function GX(w){return w instanceof Error?w:Error(String(w))}import{openSync as bp,writeSync as jp}from"fs";class S2{static instance=null;level;context;useStderr;format;logFile;fileHandle;constructor(w={},$){if(this.level=w.level??3,this.context=w.context??void 0,this.useStderr=w.useStderr??!1,this.format=w.format??"text",this.logFile=w.logFile,$!==void 0)this.fileHandle=$;else if(this.logFile)try{this.fileHandle=bp(this.logFile,"a")}catch{}}static getInstance(w){if(!S2.instance)S2.instance=new S2(w);else if(w?.useStderr!==void 0)S2.instance.useStderr=w.useStderr;return S2.instance}static resetInstance(){S2.instance=null}static createFresh(w){return new S2(w)}formatEntry(w,$,f){let X=new Date().toISOString();if(this.format==="json"){let W={ts:X,level:w,msg:$};if(this.context)W.ctx=this.context;if(f.length>0)W.data=f;return JSON.stringify(W)}return this.context?`[${X}] [${this.context}] ${$}`:`[${X}] ${$}`}write(w,$,f,X){if(this.format==="json")w(this.formatEntry($,f,X));else if(X.length>0)w(this.formatEntry($,f,[]),...X);else w(this.formatEntry($,f,[]));if(this.fileHandle!==void 0){let W=this.formatJsonEntry($,f,X);try{jp(this.fileHandle,W+`
|
|
3
|
-
`)}catch{}}}formatJsonEntry(w,$,f){let X={ts:new Date().toISOString(),level:w,msg:$};if(this.context)X.ctx=this.context;if(f.length>0)X.data=f;return JSON.stringify(X)}silly(w,...$){if(this.level<=0)this.write(console.debug.bind(console),"silly",w,$)}verbose(w,...$){if(this.level<=1)this.write(console.debug.bind(console),"verbose",w,$)}debug(w,...$){if(this.level<=2)this.write(console.debug.bind(console),"debug",w,$)}info(w,...$){if(this.level<=3){let f=this.useStderr?console.error.bind(console):console.info.bind(console);this.write(f,"info",w,$)}}warn(w,...$){if(this.level<=4)this.write(console.warn.bind(console),"warn",w,$)}error(w,...$){if(this.level<=5)this.write(console.error.bind(console),"error",w,$)}child(w){return new S2({level:this.level,context:w,useStderr:this.useStderr,format:this.format},this.fileHandle)}setUseStderr(w){this.useStderr=w}}var MZ0;var Q9=C(()=>{MZ0=S2.getInstance()});var WB;var YB=C(()=>{Z0();Q9();WB=F.union([F.object({success:F.literal(!0),data:F.unknown(),message:F.string().optional()}),F.object({success:F.literal(!1),error:F.string(),code:F.string().optional()})])});var JB=C(()=>{Z0()});var WA=C(()=>{XB();fA();YB();JB()});var gZ0,xZ0,AX,GB,AB,HX,YA,yp,gp;var UX=C(()=>{Z0();j5();i5();tM();WA();gZ0=F.object({id:F.string(),type:F.string(),version:F.string(),status:F.string()}),xZ0=F.object({name:F.string(),description:F.string()}),AX=F.object({label:F.string(),url:F.string(),pluginId:F.string(),priority:F.number().default(100),visibility:p3.default("public")}),GB=F.enum(["human","agent","admin","protocol"]),AB=F.enum(["available","coming-soon","disabled"]),HX=F.object({id:F.string(),label:F.string(),description:F.string().optional(),href:F.string(),kind:GB,pluginId:F.string(),priority:F.number().default(100),visibility:p3.default("public"),status:AB.default("available")}),YA=F.object({entityType:F.string(),count:F.number()}),yp=F.object({model:F.string(),version:F.string(),uptime:F.number(),entities:F.number(),entityCounts:F.array(YA),embeddings:F.number(),ai:F.object({model:F.string(),embeddingModel:F.string()}),daemons:F.array(sM),endpoints:F.array(AX),interactions:F.array(HX)}),gp=F.object({id:F.string(),version:F.string(),type:F.enum(["core","entity","service","interface"]),description:F.string().optional(),dependencies:F.array(F.string()).optional(),packageName:F.string()})});class l4{callback;heartbeatInterval;constructor(w){this.callback=w}static from(w){if(!w)return;return new l4(w)}createSub(w){let{scale:$}=w??{};if($){let{start:f,end:X}=$,W=X-f;return new l4(async(Y)=>{let J=f+Y.progress/(Y.total??100)*W;await this.callback({...Y,progress:J,total:100})})}return new l4(this.callback)}async report(w){await this.callback(w)}startHeartbeat(w,$=5000){this.stopHeartbeat(),this.heartbeatInterval=setInterval(()=>{this.report({message:w,progress:0}).catch(()=>{})},$)}stopHeartbeat(){if(this.heartbeatInterval)clearInterval(this.heartbeatInterval),this.heartbeatInterval=void 0}toCallback(){return this.callback}}class Z9{id;version;description;packageName;config;context;get logger(){return this.context?.logger??S2.createFresh({context:this.id})}constructor(w,$,f,X){this.id=w,this.packageName=$.name,this.version=$.version,this.description=$.description??`${$.name} plugin`,this.config=X.parse(f)}setupMessageHandlers(w){w.messaging.subscribe(`plugin:${this.id}:tool:execute`,async($)=>{try{let{toolName:f,args:X,progressToken:W,hasProgress:Y,interfaceType:J,userId:G,channelId:A,userPermissionLevel:U}=xp.parse($.payload),h=(await this.getTools()).find((V)=>V.name===f);if(!h)return{success:!1,error:`Tool not found: ${f}`};let O={interfaceType:J,userId:G,...A&&{channelId:A},...U&&{userPermissionLevel:U},...Y&&W!==void 0&&{progressToken:W,sendProgress:async(V)=>{await w.messaging.send({type:`plugin:${this.id}:progress`,payload:{progressToken:W,notification:V}})}}};return{success:!0,data:await h.handler(X,O)}}catch(f){if(f instanceof F.ZodError)return{success:!1,error:"Invalid tool execution request format"};return this.logger.error("Tool execution error",f),{success:!1,error:t1(f)}}}),w.messaging.subscribe(`plugin:${this.id}:resource:get`,async($)=>{try{let{resourceUri:f}=mp.parse($.payload),W=(await this.getResources()).find((J)=>J.uri===f);if(!W)return{success:!1,error:`Resource not found: ${f}`};return{success:!0,data:await W.handler()}}catch(f){if(f instanceof F.ZodError)return{success:!1,error:"Invalid resource get request format"};return this.logger.error("Resource fetch error",f),{success:!1,error:t1(f)}}})}async onRegister(w){}async onReady(w){}async ready(){await this.onReady(this.getContext())}async getCapabilities(){let w=await this.getInstructions();return{tools:await this.getTools(),resources:await this.getResources(),...w&&{instructions:w}}}async getTools(){return[]}async getResources(){return[]}async getInstructions(){return}async shutdown(){await this.onShutdown()}async onShutdown(){}getContext(){if(!this.context)throw Error(`Plugin ${this.id}: Plugin not registered yet`);return this.context}determineUserPermissionLevel(w){return"public"}createProgressBridge(w){if(!w)return;let $=this.context;if(!$)return;let f=this.id;return l4.from(async(X)=>{await $.messaging.send({type:`plugin:${f}:progress`,payload:{progressToken:w,notification:{progress:X.progress,total:X.total,message:X.message}}})})}}var xp,mp;var KX=C(()=>{UX();Q9();Z0();xp=F.object({toolName:F.string(),args:F.unknown(),progressToken:F.union([F.string(),F.number()]).optional(),hasProgress:F.boolean().optional(),...YX.shape}),mp=F.object({resourceUri:F.string()})});var HB,JA,UB,hX,KB,hB,FB,OB,FX;var GA=C(()=>{Z0();HB=F.object({id:F.string(),template:F.string(),content:F.unknown().optional(),dataQuery:F.object({entityType:F.string().optional(),template:F.string().optional(),query:F.object({id:F.string().optional(),limit:F.number().optional(),offset:F.number().optional()}).passthrough().optional()}).passthrough().optional(),order:F.number().optional()}),JA=["primary","secondary"],UB=F.object({show:F.boolean().default(!1),label:F.string().optional(),slot:F.enum(JA).default("primary"),priority:F.number().min(0).max(100).default(50)}).optional(),hX=F.object({id:F.string(),path:F.string(),title:F.string().default(""),pageLabel:F.string().optional(),description:F.string().default(""),sections:F.array(HB).default([]),layout:F.string().default("default"),fullscreen:F.boolean().optional(),pluginId:F.string().optional(),sourceEntityType:F.string().optional(),external:F.boolean().optional(),navigation:UB}),KB=F.object({routes:F.array(hX),pluginId:F.string()}),hB=F.object({paths:F.array(F.string()).optional(),pluginId:F.string().optional()}),FB=F.object({pluginId:F.string().optional()}),OB=F.object({path:F.string()}),FX=F.object({label:F.string(),href:F.string(),priority:F.number()})});var OX,QX,ZX,lp,rp;var QB=C(()=>{Z0();GA();OX=F.object({heading:F.string().describe("Main CTA heading text"),buttonText:F.string().describe("Call-to-action button text"),buttonLink:F.string().describe("URL or anchor for the CTA button")}),QX=F.object({blurb:F.string().optional().describe("Short italic subtitle under the section title")}),ZX=F.object({title:F.string().describe("The site's title"),description:F.string().describe("The site's description"),url:F.string().optional().describe("Canonical site URL"),copyright:F.string().optional().describe("Copyright notice text"),logo:F.boolean().optional().describe("Whether to display logo instead of title text in header"),themeMode:F.enum(["light","dark"]).optional().describe("Default theme mode"),analyticsScript:F.string().optional().describe("Analytics script HTML"),cta:OX.optional().describe("Call-to-action configuration"),sections:F.record(F.string(),QX).optional().describe("Optional per-section blurbs, keyed by section id (e.g. 'essays', 'presentations', 'about'). Used by homepage templates that render editorial section headers.")}),lp=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")}),rp=ZX.extend({navigation:F.object({primary:F.array(FX),secondary:F.array(FX)}),copyright:F.string(),socialLinks:F.array(lp).optional().describe("Social media links from profile metadata")})});function AA(w){return`preview.${w.trim().replace(/^https?:\/\//,"")}`}function e1(w){return w.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function ZB(w){let f=w.split(/\s+/).filter((X)=>X.length>0).length;return Math.max(1,Math.ceil(f/200))}var G5=()=>{};var MB=C(()=>{G5()});var cp,ip,dp,np,op;var BB=C(()=>{Z0();cp=F.string(),ip=F.object({id:F.string().min(1)}).passthrough(),dp=F.object({label:F.string().min(1)}).passthrough(),np=F.object({layouts:F.record(F.unknown()),plugin:F.function(),routes:F.array(ip),entityDisplay:F.record(dp),staticAssets:F.record(F.string()).optional()}).passthrough(),op=F.custom((w)=>np.safeParse(w).success)});var r4=C(()=>{GA();QB();MB();BB()});var VB="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";import{webcrypto as zB}from"crypto";function ep(w){if(w<0||w>1024)throw RangeError("Wrong ID size");if(!p4||p4.length<w)p4=Buffer.allocUnsafe(w*tp),zB.getRandomValues(p4),M9=0;else if(M9+w>p4.length)zB.getRandomValues(p4),M9=0;M9+=w}function RB(w=21){ep(w|=0);let $="";for(let f=M9-w;f<M9;f++)$+=VB[p4[f]&63];return $}var tp=128,p4,M9;var NB=()=>{};function T6(w=12){return RB(w)}var c4=C(()=>{NB()});var qB,DB,w7,NM0;var MX=C(()=>{Z0();qB=F.enum(["file_operations","content_operations","data_processing","batch_processing"]),DB=F.object({pluginId:F.string().optional(),progressToken:F.union([F.string(),F.number()]).optional(),operationType:qB,operationTarget:F.string().optional(),interfaceType:F.string().optional(),conversationId:F.string().optional(),channelId:F.string().optional(),silent:F.boolean().optional()}),w7=DB.extend({rootJobId:F.string()}),NM0=F.enum(["none","skip","replace","coalesce"])});var HA,vB,wc,$c,PB,UA;var E6=C(()=>{Z0();MX();HA=F.enum(["pending","processing","completed","failed"]),vB=F.enum(["completed","failed"]),wc=F.object({id:F.string(),type:F.string(),status:HA,data:F.unknown(),result:F.unknown().optional(),lastError:F.string().optional().nullable(),attempts:F.number(),maxRetries:F.number(),priority:F.number(),createdAt:F.date(),updatedAt:F.date(),processedAt:F.date().optional().nullable(),completedAt:F.date().optional().nullable(),failedAt:F.date().optional().nullable()}),$c=F.object({jobId:F.string(),type:F.string(),status:vB,result:F.unknown().optional(),error:F.string().optional()}),PB=F.object({success:F.literal(!1),error:F.string().optional()}),UA=F.object({id:F.string(),type:F.enum(["job","batch"]),status:HA,message:F.string().optional(),progress:F.object({current:F.number(),total:F.number(),percentage:F.number()}).optional(),aggregationKey:F.string().optional(),batchDetails:F.object({totalOperations:F.number(),completedOperations:F.number(),failedOperations:F.number(),currentOperation:F.string().optional(),errors:F.array(F.string()).optional()}).optional(),jobDetails:F.object({jobType:F.string(),priority:F.number(),retryCount:F.number()}).optional(),metadata:w7})});function c0(w,$){if(!w||typeof w!=="object")return!1;if(w instanceof $)return!0;if(!Object.prototype.hasOwnProperty.call($,K0))throw Error(`Class "${$.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let f=Object.getPrototypeOf(w).constructor;if(f)while(f){if(K0 in f&&f[K0]===$[K0])return!0;f=Object.getPrototypeOf(f)}return!1}var K0;var V1=C(()=>{K0=Symbol.for("drizzle:entityKind")});var A5;var b6=C(()=>{V1();A5=class A5{constructor(w,$){this.table=w,this.config=$,this.name=$.name,this.keyAsName=$.keyAsName,this.notNull=$.notNull,this.default=$.default,this.defaultFn=$.defaultFn,this.onUpdateFn=$.onUpdateFn,this.hasDefault=$.hasDefault,this.primary=$.primaryKey,this.isUnique=$.isUnique,this.uniqueName=$.uniqueName,this.uniqueType=$.uniqueType,this.dataType=$.dataType,this.columnType=$.columnType,this.generated=$.generated,this.generatedIdentity=$.generatedIdentity}static[K0]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(w){return w}mapToDriverValue(w){return w}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}});var KA;var hA=C(()=>{V1();KA=class KA{static[K0]="ColumnBuilder";config;constructor(w,$,f){this.config={name:w,keyAsName:w==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:$,columnType:f,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(w){return this.config.default=w,this.config.hasDefault=!0,this}$defaultFn(w){return this.config.defaultFn=w,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(w){return this.config.onUpdateFn=w,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(w){if(this.config.name!=="")return;this.config.name=w}}});var d5;var $7=C(()=>{d5=Symbol.for("drizzle:Name")});function kB(w,...$){return w(...$)}var LB=()=>{};function _B(w,$){return`${w[d5]}_${$.join("_")}_unique`}var TB=C(()=>{$7()});var f7,fc;var EB=C(()=>{b6();V1();TB();f7=class f7 extends A5{constructor(w,$){if(!$.uniqueName)$.uniqueName=_B(w,[$.name]);super(w,$);this.table=w}static[K0]="PgColumn"};fc=class fc extends f7{static[K0]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(w){return this.indexConfig.opClass=w,this}}});function jB(w){return!!w&&typeof w==="function"&&bB in w&&w[bB]===!0}var Xc,bB,Wc;var IB=C(()=>{V1();EB();Xc=class Xc extends f7{static[K0]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor(w,$){super(w,$);this.enum=$.enum}getSQLType(){return this.enum.enumName}};bB=Symbol.for("drizzle:isPgEnum");Wc=class Wc extends f7{static[K0]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(w,$){super(w,$);this.enum=$.enum}getSQLType(){return this.enum.enumName}}});var a2;var j6=C(()=>{V1();a2=class a2{static[K0]="Subquery";constructor(w,$,f,X=!1,W=[]){this._={brand:"Subquery",sql:w,selectedFields:$,alias:f,isWith:X,usedTables:W}}}});var SB="0.44.7";var CB=()=>{};var FA,OA,uB;var yB=C(()=>{LB();CB();uB={startActiveSpan(w,$){if(!FA)return $();if(!OA)OA=FA.trace.getTracer("drizzle-orm",SB);return kB((f,X)=>X.startActiveSpan(w,(W)=>{try{return $(W)}catch(Y){throw W.setStatus({code:f.SpanStatusCode.ERROR,message:Y instanceof Error?Y.message:"Unknown error"}),Y}finally{W.end()}}),FA,OA)}}});var w2;var I6=C(()=>{w2=Symbol.for("drizzle:ViewBaseConfig")});var QA,gB,xB,ZA,MA,X7,mB,Yc,w1;var c3=C(()=>{V1();$7();QA=Symbol.for("drizzle:Schema"),gB=Symbol.for("drizzle:Columns"),xB=Symbol.for("drizzle:ExtraConfigColumns"),ZA=Symbol.for("drizzle:OriginalName"),MA=Symbol.for("drizzle:BaseName"),X7=Symbol.for("drizzle:IsAlias"),mB=Symbol.for("drizzle:ExtraConfigBuilder"),Yc=Symbol.for("drizzle:IsDrizzleTable");w1=class w1{static[K0]="Table";static Symbol={Name:d5,Schema:QA,OriginalName:ZA,Columns:gB,ExtraConfigColumns:xB,BaseName:MA,IsAlias:X7,ExtraConfigBuilder:mB};[d5];[ZA];[QA];[gB];[xB];[MA];[X7]=!1;[Yc]=!0;[mB]=void 0;constructor(w,$,f){this[d5]=this[ZA]=w,this[QA]=$,this[MA]=f}}});function Jc(w){return w!==null&&w!==void 0&&typeof w.getSQL==="function"}function Gc(w){let $={sql:"",params:[]};for(let f of w)if($.sql+=f.sql,$.params.push(...f.params),f.typings?.length){if(!$.typings)$.typings=[];$.typings.push(...f.typings)}return $}function i4(w,...$){let f=[];if($.length>0||w.length>0&&w[0]!=="")f.push(new I5(w[0]));for(let[X,W]of $.entries())f.push(W,new I5(w[X+1]));return new F1(f)}var I5,F1,BX,lB,rB,GB0,zX,VX,Ac,B3;var S6=C(()=>{V1();IB();j6();yB();I6();b6();c3();I5=class I5{static[K0]="StringChunk";value;constructor(w){this.value=Array.isArray(w)?w:[w]}getSQL(){return new F1([this])}};F1=class F1{constructor(w){this.queryChunks=w;for(let $ of w)if(c0($,w1)){let f=$[w1.Symbol.Schema];this.usedTables.push(f===void 0?$[w1.Symbol.Name]:f+"."+$[w1.Symbol.Name])}}static[K0]="SQL";decoder=lB;shouldInlineParams=!1;usedTables=[];append(w){return this.queryChunks.push(...w.queryChunks),this}toQuery(w){return uB.startActiveSpan("drizzle.buildSQL",($)=>{let f=this.buildQueryFromSourceParams(this.queryChunks,w);return $?.setAttributes({"drizzle.query.text":f.sql,"drizzle.query.params":JSON.stringify(f.params)}),f})}buildQueryFromSourceParams(w,$){let f=Object.assign({},$,{inlineParams:$.inlineParams||this.shouldInlineParams,paramStartIndex:$.paramStartIndex||{value:0}}),{casing:X,escapeName:W,escapeParam:Y,prepareTyping:J,inlineParams:G,paramStartIndex:A}=f;return Gc(w.map((U)=>{if(c0(U,I5))return{sql:U.value.join(""),params:[]};if(c0(U,BX))return{sql:W(U.value),params:[]};if(U===void 0)return{sql:"",params:[]};if(Array.isArray(U)){let K=[new I5("(")];for(let[h,O]of U.entries())if(K.push(O),h<U.length-1)K.push(new I5(", "));return K.push(new I5(")")),this.buildQueryFromSourceParams(K,f)}if(c0(U,F1))return this.buildQueryFromSourceParams(U.queryChunks,{...f,inlineParams:G||U.shouldInlineParams});if(c0(U,w1)){let K=U[w1.Symbol.Schema],h=U[w1.Symbol.Name];return{sql:K===void 0||U[X7]?W(h):W(K)+"."+W(h),params:[]}}if(c0(U,A5)){let K=X.getColumnCasing(U);if($.invokeSource==="indexes")return{sql:W(K),params:[]};let h=U.table[w1.Symbol.Schema];return{sql:U.table[X7]||h===void 0?W(U.table[w1.Symbol.Name])+"."+W(K):W(h)+"."+W(U.table[w1.Symbol.Name])+"."+W(K),params:[]}}if(c0(U,B3)){let K=U[w2].schema,h=U[w2].name;return{sql:K===void 0||U[w2].isAlias?W(h):W(K)+"."+W(h),params:[]}}if(c0(U,zX)){if(c0(U.value,VX))return{sql:Y(A.value++,U),params:[U],typings:["none"]};let K=U.value===null?null:U.encoder.mapToDriverValue(U.value);if(c0(K,F1))return this.buildQueryFromSourceParams([K],f);if(G)return{sql:this.mapInlineParam(K,f),params:[]};let h=["none"];if(J)h=[J(U.encoder)];return{sql:Y(A.value++,K),params:[K],typings:h}}if(c0(U,VX))return{sql:Y(A.value++,U),params:[U],typings:["none"]};if(c0(U,F1.Aliased)&&U.fieldAlias!==void 0)return{sql:W(U.fieldAlias),params:[]};if(c0(U,a2)){if(U._.isWith)return{sql:W(U._.alias),params:[]};return this.buildQueryFromSourceParams([new I5("("),U._.sql,new I5(") "),new BX(U._.alias)],f)}if(jB(U)){if(U.schema)return{sql:W(U.schema)+"."+W(U.enumName),params:[]};return{sql:W(U.enumName),params:[]}}if(Jc(U)){if(U.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([U.getSQL()],f);return this.buildQueryFromSourceParams([new I5("("),U.getSQL(),new I5(")")],f)}if(G)return{sql:this.mapInlineParam(U,f),params:[]};return{sql:Y(A.value++,U),params:[U],typings:["none"]}}))}mapInlineParam(w,{escapeString:$}){if(w===null)return"null";if(typeof w==="number"||typeof w==="boolean")return w.toString();if(typeof w==="string")return $(w);if(typeof w==="object"){let f=w.toString();if(f==="[object Object]")return $(JSON.stringify(w));return $(f)}throw Error("Unexpected param value: "+w)}getSQL(){return this}as(w){if(w===void 0)return this;return new F1.Aliased(this,w)}mapWith(w){return this.decoder=typeof w==="function"?{mapFromDriverValue:w}:w,this}inlineParams(){return this.shouldInlineParams=!0,this}if(w){return w?this:void 0}};BX=class BX{constructor(w){this.value=w}static[K0]="Name";brand;getSQL(){return new F1([this])}};lB={mapFromDriverValue:(w)=>w},rB={mapToDriverValue:(w)=>w},GB0={...lB,...rB};zX=class zX{constructor(w,$=rB){this.value=w,this.encoder=$}static[K0]="Param";brand;getSQL(){return new F1([this])}};((w)=>{function $(){return new F1([])}w.empty=$;function f(A){return new F1(A)}w.fromList=f;function X(A){return new F1([new I5(A)])}w.raw=X;function W(A,U){let K=[];for(let[h,O]of A.entries()){if(h>0&&U!==void 0)K.push(U);K.push(O)}return new F1(K)}w.join=W;function Y(A){return new BX(A)}w.identifier=Y;function J(A){return new VX(A)}w.placeholder=J;function G(A,U){return new zX(A,U)}w.param=G})(i4||(i4={}));((w)=>{class ${constructor(f,X){this.sql=f,this.fieldAlias=X}static[K0]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new $(this.sql,this.fieldAlias)}}w.Aliased=$})(F1||(F1={}));VX=class VX{constructor(w){this.name=w}static[K0]="Placeholder";getSQL(){return new F1([this])}};Ac=Symbol.for("drizzle:IsDrizzleView");B3=class B3{static[K0]="View";[w2];[Ac]=!0;constructor({name:w,schema:$,selectedFields:f,query:X}){this[w2]={name:w,originalName:w,schema:$,selectedFields:f,query:X,isExisting:!X,isAlias:!1}}getSQL(){return new F1([this])}};A5.prototype.getSQL=function(){return new F1([this])};w1.prototype.getSQL=function(){return new F1([this])};a2.prototype.getSQL=function(){return new F1([this])}});function B9(w,$){return Object.entries(w).reduce((f,[X,W])=>{if(typeof X!=="string")return f;let Y=$?[...$,X]:[X];if(c0(W,A5)||c0(W,F1)||c0(W,F1.Aliased))f.push({path:Y,field:W});else if(c0(W,w1))f.push(...B9(W[w1.Symbol.Columns],Y));else f.push(...B9(W,Y));return f},[])}function BA(w,$){let f=Object.keys(w),X=Object.keys($);if(f.length!==X.length)return!1;for(let[W,Y]of f.entries())if(Y!==X[W])return!1;return!0}function pB(w,$){for(let f of $)for(let X of Object.getOwnPropertyNames(f.prototype)){if(X==="constructor")continue;Object.defineProperty(w.prototype,X,Object.getOwnPropertyDescriptor(f.prototype,X)||Object.create(null))}}function W7(w){return c0(w,a2)?w._.alias:c0(w,B3)?w[w2].name:c0(w,F1)?void 0:w[w1.Symbol.IsAlias]?w[w1.Symbol.Name]:w[w1.Symbol.BaseName]}function V3(w,$){return{name:typeof w==="string"&&w.length>0?w:"",config:typeof w==="object"?w:$}}var VA;var i3=C(()=>{b6();V1();S6();j6();c3();I6();VA=typeof TextDecoder>"u"?null:new TextDecoder});var cB=()=>{};var iB=()=>{};var dB=()=>{};var nB=C(()=>{iB();dB()});var oB=()=>{};var Y7,zA;var RA=C(()=>{b6();V1();c3();I6();Y7=class Y7{constructor(w){this.table=w}static[K0]="ColumnAliasProxyHandler";get(w,$){if($==="table")return this.table;return w[$]}};zA=class zA{constructor(w,$){this.alias=w,this.replaceOriginalName=$}static[K0]="TableAliasProxyHandler";get(w,$){if($===w1.Symbol.IsAlias)return!0;if($===w1.Symbol.Name)return this.alias;if(this.replaceOriginalName&&$===w1.Symbol.OriginalName)return this.alias;if($===w2)return{...w[w2],name:this.alias,isAlias:!0};if($===w1.Symbol.Columns){let X=w[w1.Symbol.Columns];if(!X)return X;let W={};return Object.keys(X).map((Y)=>{W[Y]=new Proxy(X[Y],new Y7(new Proxy(w,this)))}),W}let f=w[$];if(c0(f,A5))return new Proxy(f,new Y7(new Proxy(w,this)));return f}}});var H5;var NA=C(()=>{RA();b6();V1();S6();j6();I6();H5=class H5{static[K0]="SelectionProxyHandler";config;constructor(w){this.config={...w}}get(w,$){if($==="_")return{...w._,selectedFields:new Proxy(w._.selectedFields,this)};if($===w2)return{...w[w2],selectedFields:new Proxy(w[w2].selectedFields,this)};if(typeof $==="symbol")return w[$];let X=(c0(w,a2)?w._.selectedFields:c0(w,B3)?w[w2].selectedFields:w)[$];if(c0(X,F1.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!X.isSelectionField)return X.sql;let W=X.clone();return W.isSelectionField=!0,W}if(c0(X,F1)){if(this.config.sqlBehavior==="sql")return X;throw Error(`You tried to reference "${$}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}if(c0(X,A5)){if(this.config.alias)return new Proxy(X,new Y7(new Proxy(X.table,new zA(this.config.alias,this.config.replaceOriginalName??!1))));return X}if(typeof X!=="object"||X===null)return X;return new Proxy(X,new H5(this.config))}}});var J7;var RX=C(()=>{V1();J7=class J7{static[K0]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(w){return this.then(void 0,w)}finally(w){return this.then(($)=>{return w?.(),$},($)=>{throw w?.(),$})}then(w,$){return this.execute().then(w,$)}}});var qA,aB;var DA=C(()=>{V1();$7();qA=class qA{static[K0]="SQLiteForeignKeyBuilder";reference;_onUpdate;_onDelete;constructor(w,$){if(this.reference=()=>{let{name:f,columns:X,foreignColumns:W}=w();return{name:f,columns:X,foreignTable:W[0].table,foreignColumns:W}},$)this._onUpdate=$.onUpdate,this._onDelete=$.onDelete}onUpdate(w){return this._onUpdate=w,this}onDelete(w){return this._onDelete=w,this}build(w){return new aB(w,this)}};aB=class aB{constructor(w,$){this.table=w,this.reference=$.reference,this.onUpdate=$._onUpdate,this.onDelete=$._onDelete}static[K0]="SQLiteForeignKey";reference;onUpdate;onDelete;getName(){let{name:w,columns:$,foreignColumns:f}=this.reference(),X=$.map((J)=>J.name),W=f.map((J)=>J.name),Y=[this.table[d5],...X,f[0].table[d5],...W];return w??`${Y.join("_")}_fk`}}});function sB(w,$){return`${w[d5]}_${$.join("_")}_unique`}var vA=C(()=>{$7()});var O2,Q2;var C6=C(()=>{hA();b6();V1();DA();vA();O2=class O2 extends KA{static[K0]="SQLiteColumnBuilder";foreignKeyConfigs=[];references(w,$={}){return this.foreignKeyConfigs.push({ref:w,actions:$}),this}unique(w){return this.config.isUnique=!0,this.config.uniqueName=w,this}generatedAlwaysAs(w,$){return this.config.generated={as:w,type:"always",mode:$?.mode??"virtual"},this}buildForeignKeys(w,$){return this.foreignKeyConfigs.map(({ref:f,actions:X})=>{return((W,Y)=>{let J=new qA(()=>{let G=W();return{columns:[w],foreignColumns:[G]}});if(Y.onUpdate)J.onUpdate(Y.onUpdate);if(Y.onDelete)J.onDelete(Y.onDelete);return J.build($)})(f,X)})}};Q2=class Q2 extends A5{constructor(w,$){if(!$.uniqueName)$.uniqueName=sB(w,[$.name]);super(w,$);this.table=w}static[K0]="SQLiteColumn"}});function WV(w,$){let{name:f,config:X}=V3(w,$);if(X?.mode==="json")return new wV(f);if(X?.mode==="bigint")return new tB(f);return new fV(f)}var tB,eB,wV,$V,fV,XV;var PA=C(()=>{V1();i3();C6();tB=class tB extends O2{static[K0]="SQLiteBigIntBuilder";constructor(w){super(w,"bigint","SQLiteBigInt")}build(w){return new eB(w,this.config)}};eB=class eB extends Q2{static[K0]="SQLiteBigInt";getSQLType(){return"blob"}mapFromDriverValue(w){if(typeof Buffer<"u"&&Buffer.from){let $=Buffer.isBuffer(w)?w:w instanceof ArrayBuffer?Buffer.from(w):w.buffer?Buffer.from(w.buffer,w.byteOffset,w.byteLength):Buffer.from(w);return BigInt($.toString("utf8"))}return BigInt(VA.decode(w))}mapToDriverValue(w){return Buffer.from(w.toString())}};wV=class wV extends O2{static[K0]="SQLiteBlobJsonBuilder";constructor(w){super(w,"json","SQLiteBlobJson")}build(w){return new $V(w,this.config)}};$V=class $V extends Q2{static[K0]="SQLiteBlobJson";getSQLType(){return"blob"}mapFromDriverValue(w){if(typeof Buffer<"u"&&Buffer.from){let $=Buffer.isBuffer(w)?w:w instanceof ArrayBuffer?Buffer.from(w):w.buffer?Buffer.from(w.buffer,w.byteOffset,w.byteLength):Buffer.from(w);return JSON.parse($.toString("utf8"))}return JSON.parse(VA.decode(w))}mapToDriverValue(w){return Buffer.from(JSON.stringify(w))}};fV=class fV extends O2{static[K0]="SQLiteBlobBufferBuilder";constructor(w){super(w,"buffer","SQLiteBlobBuffer")}build(w){return new XV(w,this.config)}};XV=class XV extends Q2{static[K0]="SQLiteBlobBuffer";mapFromDriverValue(w){if(Buffer.isBuffer(w))return w;return Buffer.from(w)}getSQLType(){return"blob"}}});function NX(w){return($,f)=>{let{name:X,config:W}=V3($,f);return new YV(X,W,w)}}var YV,JV;var kA=C(()=>{V1();i3();C6();YV=class YV extends O2{static[K0]="SQLiteCustomColumnBuilder";constructor(w,$,f){super(w,"custom","SQLiteCustomColumn");this.config.fieldConfig=$,this.config.customTypeParams=f}build(w){return new JV(w,this.config)}};JV=class JV extends Q2{static[K0]="SQLiteCustomColumn";sqlName;mapTo;mapFrom;constructor(w,$){super(w,$);this.sqlName=$.customTypeParams.dataType($.fieldConfig),this.mapTo=$.customTypeParams.toDriver,this.mapFrom=$.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(w){return typeof this.mapFrom==="function"?this.mapFrom(w):w}mapToDriverValue(w){return typeof this.mapTo==="function"?this.mapTo(w):w}}});function s2(w,$){let{name:f,config:X}=V3(w,$);if(X?.mode==="timestamp"||X?.mode==="timestamp_ms")return new HV(f,X.mode);if(X?.mode==="boolean")return new KV(f,X.mode);return new GV(f)}var qX,DX,GV,AV,HV,UV,KV,hV;var LA=C(()=>{V1();S6();i3();C6();qX=class qX extends O2{static[K0]="SQLiteBaseIntegerBuilder";constructor(w,$,f){super(w,$,f);this.config.autoIncrement=!1}primaryKey(w){if(w?.autoIncrement)this.config.autoIncrement=!0;return this.config.hasDefault=!0,super.primaryKey()}};DX=class DX extends Q2{static[K0]="SQLiteBaseInteger";autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}};GV=class GV extends qX{static[K0]="SQLiteIntegerBuilder";constructor(w){super(w,"number","SQLiteInteger")}build(w){return new AV(w,this.config)}};AV=class AV extends DX{static[K0]="SQLiteInteger"};HV=class HV extends qX{static[K0]="SQLiteTimestampBuilder";constructor(w,$){super(w,"date","SQLiteTimestamp");this.config.mode=$}defaultNow(){return this.default(i4`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(w){return new UV(w,this.config)}};UV=class UV extends DX{static[K0]="SQLiteTimestamp";mode=this.config.mode;mapFromDriverValue(w){if(this.config.mode==="timestamp")return new Date(w*1000);return new Date(w)}mapToDriverValue(w){let $=w.getTime();if(this.config.mode==="timestamp")return Math.floor($/1000);return $}};KV=class KV extends qX{static[K0]="SQLiteBooleanBuilder";constructor(w,$){super(w,"boolean","SQLiteBoolean");this.config.mode=$}build(w){return new hV(w,this.config)}};hV=class hV extends DX{static[K0]="SQLiteBoolean";mode=this.config.mode;mapFromDriverValue(w){return Number(w)===1}mapToDriverValue(w){return w?1:0}}});function VV(w,$){let{name:f,config:X}=V3(w,$),W=X?.mode;return W==="number"?new QV(f):W==="bigint"?new MV(f):new FV(f)}var FV,OV,QV,ZV,MV,BV;var _A=C(()=>{V1();i3();C6();FV=class FV extends O2{static[K0]="SQLiteNumericBuilder";constructor(w){super(w,"string","SQLiteNumeric")}build(w){return new OV(w,this.config)}};OV=class OV extends Q2{static[K0]="SQLiteNumeric";mapFromDriverValue(w){if(typeof w==="string")return w;return String(w)}getSQLType(){return"numeric"}};QV=class QV extends O2{static[K0]="SQLiteNumericNumberBuilder";constructor(w){super(w,"number","SQLiteNumericNumber")}build(w){return new ZV(w,this.config)}};ZV=class ZV extends Q2{static[K0]="SQLiteNumericNumber";mapFromDriverValue(w){if(typeof w==="number")return w;return Number(w)}mapToDriverValue=String;getSQLType(){return"numeric"}};MV=class MV extends O2{static[K0]="SQLiteNumericBigIntBuilder";constructor(w){super(w,"bigint","SQLiteNumericBigInt")}build(w){return new BV(w,this.config)}};BV=class BV extends Q2{static[K0]="SQLiteNumericBigInt";mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return"numeric"}}});function NV(w){return new zV(w??"")}var zV,RV;var TA=C(()=>{V1();C6();zV=class zV extends O2{static[K0]="SQLiteRealBuilder";constructor(w){super(w,"number","SQLiteReal")}build(w){return new RV(w,this.config)}};RV=class RV extends Q2{static[K0]="SQLiteReal";getSQLType(){return"real"}}});function a0(w,$={}){let{name:f,config:X}=V3(w,$);if(X.mode==="json")return new vV(f);return new qV(f,X)}var qV,DV,vV,PV;var EA=C(()=>{V1();i3();C6();qV=class qV extends O2{static[K0]="SQLiteTextBuilder";constructor(w,$){super(w,"string","SQLiteText");this.config.enumValues=$.enum,this.config.length=$.length}build(w){return new DV(w,this.config)}};DV=class DV extends Q2{static[K0]="SQLiteText";enumValues=this.config.enumValues;length=this.config.length;constructor(w,$){super(w,$)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}};vV=class vV extends O2{static[K0]="SQLiteTextJsonBuilder";constructor(w){super(w,"json","SQLiteTextJson")}build(w){return new PV(w,this.config)}};PV=class PV extends Q2{static[K0]="SQLiteTextJson";getSQLType(){return"text"}mapFromDriverValue(w){return JSON.parse(w)}mapToDriverValue(w){return JSON.stringify(w)}}});function kV(){return{blob:WV,customType:NX,integer:s2,numeric:VV,real:NV,text:a0}}var LV=C(()=>{PA();kA();LA();_A();TA();EA()});function Hc(w,$,f,X,W=w){let Y=new z3(w,X,W),J=typeof $==="function"?$(kV()):$,G=Object.fromEntries(Object.entries(J).map(([U,K])=>{let h=K;h.setName(U);let O=h.build(Y);return Y[bA].push(...h.buildForeignKeys(O,Y)),[U,O]})),A=Object.assign(Y,G);if(A[w1.Symbol.Columns]=G,A[w1.Symbol.ExtraConfigColumns]=G,f)A[z3.Symbol.ExtraConfigBuilder]=f;return A}var bA,z3,R3=(w,$,f)=>{return Hc(w,$,f)};var G7=C(()=>{V1();c3();LV();bA=Symbol.for("drizzle:SQLiteInlineForeignKeys");z3=class z3 extends w1{static[K0]="SQLiteTable";static Symbol=Object.assign({},w1.Symbol,{InlineForeignKeys:bA});[w1.Symbol.Columns];[bA]=[];[w1.Symbol.ExtraConfigBuilder]=void 0}});function EV(w,$){return new _V(w,$)}var _V,TV;var bV=C(()=>{V1();_V=class _V{constructor(w,$){this.name=w,this.value=$}static[K0]="SQLiteCheckBuilder";brand;build(w){return new TV(w,this)}};TV=class TV{constructor(w,$){this.table=w,this.name=$.name,this.value=$.value}static[K0]="SQLiteCheck";name;value}});function n5(w){return new jV(w,!1)}var jV,IV,SV;var CV=C(()=>{V1();jV=class jV{constructor(w,$){this.name=w,this.unique=$}static[K0]="SQLiteIndexBuilderOn";on(...w){return new IV(this.name,w,this.unique)}};IV=class IV{static[K0]="SQLiteIndexBuilder";config;constructor(w,$,f){this.config={name:w,columns:$,unique:f,where:void 0}}where(w){return this.config.where=w,this}build(w){return new SV(this.config,w)}};SV=class SV{static[K0]="SQLiteIndex";config;constructor(w,$){this.config={...w,table:$}}}});function vX(...w){if(w[0].columns)return new jA(w[0].columns,w[0].name);return new jA(w)}var jA,uV;var yV=C(()=>{V1();G7();jA=class jA{static[K0]="SQLitePrimaryKeyBuilder";columns;name;constructor(w,$){this.columns=w,this.name=$}build(w){return new uV(w,this.columns,this.name)}};uV=class uV{constructor(w,$,f){this.table=w,this.columns=$,this.name=f}static[K0]="SQLitePrimaryKey";columns;name;getName(){return this.name??`${this.table[z3.Symbol.Name]}_${this.columns.map((w)=>w.name).join("_")}_pk`}}});function d4(w){if(c0(w,z3))return[`${w[w1.Symbol.BaseName]}`];if(c0(w,a2))return w._.usedTables??[];if(c0(w,F1))return w.usedTables??[];return[]}var PX=C(()=>{V1();S6();j6();c3();G7()});var gV=()=>{};var xV=()=>{};var mV=()=>{};var lV=()=>{};var rV=C(()=>{mV();lV()});var pV=C(()=>{nB();rV();S6()});var cV=C(()=>{PA();C6();kA();LA();_A();TA();EA()});var IA;var iV=C(()=>{V1();S6();IA=class IA extends B3{static[K0]="SQLiteViewBase"}});var dV=()=>{};var SA;var nV=C(()=>{V1();SA=class SA{static[K0]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}});function kX(w,$){return(f,X,...W)=>{let Y=[X,...W].map((J)=>({type:w,isAll:$,rightSelect:J}));for(let J of Y)if(!BA(f.getSelectedFields(),J.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return f.addSetOperators(Y)}}var oV,aV,Uc=()=>({union:Kc,unionAll:hc,intersect:Fc,except:Oc}),Kc,hc,Fc,Oc;var sV=C(()=>{V1();nV();RX();NA();S6();j6();c3();i3();I6();PX();oV=class oV extends SA{static[K0]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:w,fields:$,isPartialSelect:f,session:X,dialect:W,withList:Y,distinct:J}){super();this.config={withList:Y,table:w,fields:{...$},distinct:J,setOperators:[]},this.isPartialSelect=f,this.session=X,this.dialect=W,this._={selectedFields:$,config:this.config},this.tableName=W7(w),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{};for(let G of d4(w))this.usedTables.add(G)}getUsedTables(){return[...this.usedTables]}createJoin(w){return($,f)=>{let X=this.tableName,W=W7($);for(let Y of d4($))this.usedTables.add(Y);if(typeof W==="string"&&this.config.joins?.some((Y)=>Y.alias===W))throw Error(`Alias "${W}" is already used in this query`);if(!this.isPartialSelect){if(Object.keys(this.joinsNotNullableMap).length===1&&typeof X==="string")this.config.fields={[X]:this.config.fields};if(typeof W==="string"&&!c0($,F1)){let Y=c0($,a2)?$._.selectedFields:c0($,B3)?$[w2].selectedFields:$[w1.Symbol.Columns];this.config.fields[W]=Y}}if(typeof f==="function")f=f(new Proxy(this.config.fields,new H5({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));if(!this.config.joins)this.config.joins=[];if(this.config.joins.push({on:f,table:$,joinType:w,alias:W}),typeof W==="string")switch(w){case"left":{this.joinsNotNullableMap[W]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([Y])=>[Y,!1])),this.joinsNotNullableMap[W]=!0;break}case"cross":case"inner":{this.joinsNotNullableMap[W]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([Y])=>[Y,!1])),this.joinsNotNullableMap[W]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator(w,$){return(f)=>{let X=typeof f==="function"?f(Uc()):f;if(!BA(this.getSelectedFields(),X.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:w,isAll:$,rightSelect:X}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(w){return this.config.setOperators.push(...w),this}where(w){if(typeof w==="function")w=w(new Proxy(this.config.fields,new H5({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.where=w,this}having(w){if(typeof w==="function")w=w(new Proxy(this.config.fields,new H5({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.having=w,this}groupBy(...w){if(typeof w[0]==="function"){let $=w[0](new Proxy(this.config.fields,new H5({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray($)?$:[$]}else this.config.groupBy=w;return this}orderBy(...w){if(typeof w[0]==="function"){let $=w[0](new Proxy(this.config.fields,new H5({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),f=Array.isArray($)?$:[$];if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=f;else this.config.orderBy=f}else{let $=w;if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=$;else this.config.orderBy=$}return this}limit(w){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).limit=w;else this.config.limit=w;return this}offset(w){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).offset=w;else this.config.offset=w;return this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:w,...$}=this.dialect.sqlToQuery(this.getSQL());return $}as(w){let $=[];if($.push(...d4(this.config.table)),this.config.joins)for(let f of this.config.joins)$.push(...d4(f.table));return new Proxy(new a2(this.getSQL(),this.config.fields,w,!1,[...new Set($)]),new H5({alias:w,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new H5({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}};aV=class aV extends oV{static[K0]="SQLiteSelect";_prepare(w=!0){if(!this.session)throw Error("Cannot execute a query on a query builder. Please use a database instance instead.");let $=B9(this.config.fields),f=this.session[w?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),$,"all",!0,void 0,{type:"select",tables:[...this.usedTables]},this.cacheConfig);return f.joinsNotNullableMap=this.joinsNotNullableMap,f}$withCache(w){return this.cacheConfig=w===void 0?{config:{},enable:!0,autoInvalidate:!0}:w===!1?{enable:!1}:{enable:!0,autoInvalidate:!0,...w},this}prepare(){return this._prepare(!1)}run=(w)=>{return this._prepare().run(w)};all=(w)=>{return this._prepare().all(w)};get=(w)=>{return this._prepare().get(w)};values=(w)=>{return this._prepare().values(w)};async execute(){return this.all()}};pB(aV,[J7]);Kc=kX("union",!1),hc=kX("union",!0),Fc=kX("intersect",!1),Oc=kX("except",!1)});var tV=()=>{};var eV=()=>{};var Qc;var wz=C(()=>{V1();RX();NA();G7();j6();c3();i3();I6();PX();iV();Qc=class Qc extends J7{constructor(w,$,f,X,W){super();this.session=f,this.dialect=X,this.config={set:$,table:w,withList:W,joins:[]}}static[K0]="SQLiteUpdate";config;from(w){return this.config.from=w,this}createJoin(w){return($,f)=>{let X=W7($);if(typeof X==="string"&&this.config.joins.some((W)=>W.alias===X))throw Error(`Alias "${X}" is already used in this query`);if(typeof f==="function"){let W=this.config.from?c0($,z3)?$[w1.Symbol.Columns]:c0($,a2)?$._.selectedFields:c0($,IA)?$[w2].selectedFields:void 0:void 0;f=f(new Proxy(this.config.table[w1.Symbol.Columns],new H5({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),W&&new Proxy(W,new H5({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}return this.config.joins.push({on:f,table:$,joinType:w,alias:X}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(w){return this.config.where=w,this}orderBy(...w){if(typeof w[0]==="function"){let $=w[0](new Proxy(this.config.table[w1.Symbol.Columns],new H5({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),f=Array.isArray($)?$:[$];this.config.orderBy=f}else{let $=w;this.config.orderBy=$}return this}limit(w){return this.config.limit=w,this}returning(w=this.config.table[z3.Symbol.Columns]){return this.config.returning=B9(w),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:w,...$}=this.dialect.sqlToQuery(this.getSQL());return $}_prepare(w=!0){return this.session[w?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:d4(this.config.table)})}prepare(){return this._prepare(!1)}run=(w)=>{return this._prepare().run(w)};all=(w)=>{return this._prepare().all(w)};get=(w)=>{return this._prepare().get(w)};values=(w)=>{return this._prepare().values(w)};async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}});var $z=C(()=>{gV();eV();tV();sV();wz()});var fz=()=>{};var Xz=()=>{};var Wz=()=>{};var Yz=()=>{};var V9=C(()=>{Xz();bV();cV();fz();dV();DA();CV();yV();$z();Wz();G7();vA();PX();Yz()});var Jz;var CA=C(()=>{V9();c4();Jz=R3("job_queue",{id:a0("id").primaryKey().$defaultFn(()=>T6()),type:a0("type").notNull(),data:a0("data").notNull(),result:a0("result",{mode:"json"}),source:a0("source"),metadata:a0("metadata",{mode:"json"}).$type().notNull(),status:a0("status",{enum:["pending","processing","completed","failed"]}).notNull().default("pending"),priority:s2("priority").notNull().default(0),retryCount:s2("retryCount").notNull().default(0),maxRetries:s2("maxRetries").notNull().default(3),lastError:a0("lastError"),createdAt:s2("createdAt").notNull().$defaultFn(()=>Date.now()),scheduledFor:s2("scheduledFor").notNull().$defaultFn(()=>Date.now()),startedAt:s2("startedAt"),completedAt:s2("completedAt")},(w)=>({queueReadyIdx:n5("idx_job_queue_ready").on(w.status,w.priority,w.scheduledFor),jobTypeIdx:n5("idx_job_queue_type").on(w.type,w.status),jobSourceIdx:n5("idx_job_queue_source").on(w.source)}))});import{createClient as MR0}from"@libsql/client";var Gz=C(()=>{CA()});var Az=C(()=>{RA();hA();b6();V1();xV();cB();RX();oB();pV();j6();c3();i3();I6()});var Hz=C(()=>{CA();E6()});var Uz=C(()=>{E6()});var Kz=C(()=>{c4();Q9();E6();Gz();Hz();Uz()});var hz=C(()=>{E6();E6()});var Fz=C(()=>{E6()});var Oz=()=>{};class H7{logger;schema;jobTypeName;constructor(w,$){this.logger=w,this.schema=$.schema,this.jobTypeName=$.jobTypeName}validateAndParse(w){if(!this.schema)throw Error(`${this.jobTypeName}: No schema provided. Override validateAndParse() or provide a schema.`);try{let $=this.schema.parse(w);return this.logger.debug(`${this.jobTypeName} job data validation successful`,{data:this.summarizeDataForLog($)}),$}catch($){return this.logger.warn(`Invalid ${this.jobTypeName} job data`,{data:w,validationError:$ instanceof F.ZodError?$.issues:$}),null}}async onError(w,$,f,X){this.logger.error(`${this.jobTypeName} job error handler triggered`,{jobId:f,errorMessage:w.message,errorStack:w.stack,data:this.summarizeDataForLog($)})}async reportProgress(w,$){await w.report({progress:$.progress,total:$.total??100,message:$.message})}summarizeDataForLog(w){return w}}var Qz=C(()=>{Z0()});var Zc;var Zz=C(()=>{MX();Z0();Zc=F.object({id:F.string(),type:F.string(),data:F.string(),status:F.enum(["pending","processing","completed","failed"]),source:F.string().nullable(),priority:F.number(),retryCount:F.number(),maxRetries:F.number(),lastError:F.string().nullable(),createdAt:F.number(),scheduledFor:F.number(),startedAt:F.number().nullable(),completedAt:F.number().nullable(),metadata:w7,result:F.unknown().nullable().optional()})});function uA(w,$,f){return async(X)=>{let{type:W,data:Y,toolContext:J=null,options:G}=X,{metadata:A,...U}=G??{},K={source:$,...G?.rootJobId&&{rootJobId:G.rootJobId},...U,metadata:{operationType:"data_processing",pluginId:$,...J&&{interfaceType:J.interfaceType,channelId:J.channelId},...A}},h=f&&!W.includes(":")?`${$}:${W}`:W;return w.enqueue({type:h,data:Y,options:K})}}function yA(w,$){return async(f,X)=>{let W=T6(),Y=f.map((G)=>({...G,type:G.type.includes(":")?G.type:`${$}:${G.type}`})),J={...X,source:$,rootJobId:W,metadata:{...X?.metadata,operationType:"batch_processing",pluginId:$}};return await w.enqueueBatch(Y,J,W,$),W}}function gA(w,$){return(f,X)=>{let W=f.includes(":")?f:`${$}:${f}`;w.registerHandler(W,X,$)}}var Mz=C(()=>{c4()});var U7=C(()=>{Kz();hz();Fz();Oz();Qz();Zz();E6();MX();Mz()});function Bz(w){return Mc.safeParse(w).success}var Mc;var xA=C(()=>{Z0();Mc=F.object({name:F.string(),schema:F.custom((w)=>w instanceof F.ZodType)})});function Bc(w){if(!w)return;return{status:w.status,message:w.message,lastCheck:w.lastCheck?.toISOString(),details:w.details}}function Vz(w){return{model:w.model,version:w.version,uptime:w.uptime,entities:w.entities,entityCounts:w.entityCounts,embeddings:w.embeddings,ai:w.ai,daemons:w.daemons.map(($)=>({name:$.name,pluginId:$.pluginId,status:$.status,health:Bc($.health)})),endpoints:w.endpoints,interactions:w.interactions}}var K7;var mA=C(()=>{G2();K7=F.record(F.unknown())});var Vc,zc;var lA=C(()=>{G2();i5();mA();Vc=F.object({id:F.string(),sessionId:F.string(),interfaceType:F.string(),channelId:F.string(),channelName:F.string().optional(),startedAt:F.string(),lastActiveAt:F.string(),createdAt:F.string(),updatedAt:F.string(),metadata:K7}),zc=F.object({id:F.string(),conversationId:F.string(),role:m4,content:F.string(),timestamp:F.string(),metadata:K7})});function zz(w){if(!w)return{};try{let $=JSON.parse(w);if($&&typeof $==="object"&&!Array.isArray($))return $}catch{}return{}}function Rc(w){let $=m4.safeParse(w);return $.success?$.data:"user"}function LX(w){let $=zz(w.metadata),f=typeof $.channelName==="string"?$.channelName:void 0;return{id:w.id,sessionId:w.sessionId,interfaceType:w.interfaceType,channelId:w.channelId,channelName:f,startedAt:w.started,lastActiveAt:w.lastActive,createdAt:w.created,updatedAt:w.updated,metadata:$}}function Rz(w){return{id:w.id,conversationId:w.conversationId,role:Rc(w.role),content:w.content,timestamp:w.timestamp,metadata:zz(w.metadata)}}var Nz=C(()=>{lA()});var rA,pA;var cA=C(()=>{G2();rA=F.object({name:F.string(),role:F.string(),purpose:F.string(),values:F.array(F.string())}),pA=F.object({name:F.string(),kind:F.enum(["professional","team","collective"]),organization:F.string().optional(),description:F.string().optional(),avatar:F.string().optional(),website:F.string().optional(),email:F.string().optional(),socialLinks:F.array(F.object({platform:F.enum(["github","instagram","linkedin","email","website"]),url:F.string(),label:F.string().optional()})).optional()})});function qz(w){return rA.parse(w)}function Dz(w){return pA.parse(w)}var vz=C(()=>{cA()});function Pz(w){return async()=>{return Vz(await w.getAppInfo())}}function kz(w,$){return{get:()=>qz(w.getIdentity()),getProfile:()=>Dz(w.getProfile()),getAppInfo:$}}function Lz(w,$,f){let X=w.getMessageBus();return{send:async(Y)=>{return X.send({...Y,sender:$})},subscribe:(Y,J)=>{if(Bz(Y)){let G=Y,A=J,U=async(K)=>{let h=G.schema.safeParse(K.payload);if(!h.success)return f.warn(`Invalid payload for channel ${G.name}`,{error:h.error.message}),{noop:!0};let{payload:O,...Z}=K;return A(h.data,Z)};return X.subscribe(G.name,U)}return X.subscribe(Y,J)}}}function _z(w,$){let f=w.getJobQueueService();return{...w.jobs,enqueue:uA(f,$,!0),enqueueBatch:yA(w.jobs,$),registerHandler:gA(f,$)}}function Tz(w){let $=w.getPermissionService();return{assertEntityActionAllowed:(f,X,W)=>{$.assertEntityActionAllowed(f,X,W.userPermissionLevel)}}}function Ez(w){return{get:async($)=>{let X=await w.getConversationService().getConversation($);return X?LX(X):null},search:async($)=>{return(await w.getConversationService().searchConversations($)).map(LX)},list:async($)=>{return(await w.getConversationService().listConversations($)).map(LX)},getMessages:async($,f)=>{return(await w.getConversationService().getMessages($,f)).map(Rz)},countMessages:async($)=>{return w.getConversationService().countMessages($)}}}function bz(w,$){return{registerHandler:(f,X)=>{w.registerEvalHandler($,f,X)}}}function jz(w){return{register:($,f)=>{w.getInsightsRegistry().register($,f)}}}function Iz(w,$){return{register:(f)=>{w.registerEndpoint({...f,pluginId:$})}}}function Sz(w,$){return{register:(f)=>{w.registerInteraction({...f,pluginId:$})}}}var Cz=C(()=>{U7();xA();Nz();vz()});function z9(w,$,f){let X=w.getEntityService(),W=w.getLogger().child($),Y=w.getDomain(),J=w.getLocalSiteUrl(),G=w.shouldPreferLocalUrls(),A=w.getThemeCSS(),U=Pz(w),K=w.getAttachmentRegistry(),h=w.getRuntimeUploadRegistry(),O=w.getRuntimeState();return{pluginId:$,logger:W,entityService:X,identity:kz(w,U),appInfo:U,judge:(Z)=>w.judge(Z),domain:Y,siteUrl:Y?`https://${Y}`:void 0,localSiteUrl:J,previewUrl:Y?`https://${AA(Y)}`:void 0,preferLocalUrls:G,themeCSS:A,entityDisplay:f?.entityDisplay,spaces:w.getSpaces(),permissions:Tz(w),messaging:Lz(w,$,W),jobs:_z(w,$),attachments:K,uploads:h,runtimeState:O,conversations:Ez(w),dataDir:w.getDataDir(),eval:bz(w,$),insights:jz(w),endpoints:Iz(w,$),interactions:Sz(w,$)}}var h7=C(()=>{r4();Cz()});var _X;var F7=C(()=>{Az();V9();_X=R3("entities",{id:a0("id").notNull(),entityType:a0("entityType").notNull(),content:a0("content").notNull(),contentHash:a0("contentHash").notNull(),visibility:a0("visibility",{enum:["public","shared","restricted"]}).notNull().default("public"),metadata:a0("metadata",{mode:"json"}).$type().notNull().default(i4`'{}'`),created:s2("created").notNull().$defaultFn(()=>Date.now()),updated:s2("updated").notNull().$defaultFn(()=>Date.now())},(w)=>{return{pk:vX({columns:[w.id,w.entityType]}),visibilityCheck:EV("entities_visibility_check",i4`${w.visibility} IN ('public', 'shared', 'restricted')`)}})});import{createClient as Xq0}from"@libsql/client";var uz=C(()=>{F7()});var yz;var gz=C(()=>{V9();yz=NX({dataType(){return"F32_BLOB(1536)"},toDriver(w){return Buffer.from(w.buffer)},fromDriver(w){return new Float32Array(w.buffer,w.byteOffset,w.byteLength/4)}})});var TX;var O7=C(()=>{V9();gz();TX=R3("embeddings",{entityId:a0("entity_id").notNull(),entityType:a0("entity_type").notNull(),embedding:yz("embedding").notNull(),contentHash:a0("content_hash").notNull()},(w)=>{return{pk:vX({columns:[w.entityId,w.entityType]})}})});import{createClient as hq0}from"@libsql/client";var iA=C(()=>{O7()});var Nc,u6;var dA=C(()=>{Z0();Nc=F.enum(["public","shared","restricted"]),u6=F.union([Nc,F.literal("private")]).optional().transform((w)=>{if(w===void 0)return"public";if(w==="private")return"restricted";return w})});var C2,Dc;var y6=C(()=>{Z0();dA();dA();C2=F.object({id:F.string(),entityType:F.string(),content:F.string(),created:F.string().datetime(),updated:F.string().datetime(),visibility:u6,metadata:F.record(F.string(),F.unknown()),contentHash:F.string()}),Dc=F.object({mediaType:F.string(),url:F.string(),downloadUrl:F.string().optional(),previewUrl:F.string().optional(),filename:F.string().optional(),sizeBytes:F.number().optional(),source:F.object({entityType:F.string().optional(),entityId:F.string().optional(),attachmentType:F.string().optional()}).optional()})});var aA=C(()=>{y6()});function n4(w){return"restricted"}var kq0;var sA=C(()=>{Z0();Q9();kq0=F.object({id:F.string().min(1,"Entity ID is required"),entityType:F.string().min(1,"Entity type is required"),contentHash:F.string().min(1,"Content hash is required"),operation:F.enum(["create","update"])})});var bq0;var lz=C(()=>{y6();Z0();F7();bq0=F.object({limit:F.number().int().positive().optional().default(20),offset:F.number().int().min(0).optional().default(0),types:F.array(F.string()).optional().default([]),excludeTypes:F.array(F.string()).optional().default([]),weight:F.record(F.string(),F.number()).optional(),visibilityScope:F.enum(["public","shared","restricted"]).optional(),includeUngenerated:F.boolean().optional().default(!1)})});var Q7=p((Iq0,pz)=>{var vc=Object.prototype.toString;pz.exports=function($){if($===void 0)return"undefined";if($===null)return"null";var f=typeof $;if(f==="boolean")return"boolean";if(f==="string")return"string";if(f==="number")return"number";if(f==="symbol")return"symbol";if(f==="function")return Tc($)?"generatorfunction":"function";if(Pc($))return"array";if(jc($))return"buffer";if(bc($))return"arguments";if(Lc($))return"date";if(kc($))return"error";if(_c($))return"regexp";switch(rz($)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(Ec($))return"generator";switch(f=vc.call($),f){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return f.slice(8,-1).toLowerCase().replace(/\s/g,"")};function rz(w){return typeof w.constructor==="function"?w.constructor.name:null}function Pc(w){if(Array.isArray)return Array.isArray(w);return w instanceof Array}function kc(w){return w instanceof Error||typeof w.message==="string"&&w.constructor&&typeof w.constructor.stackTraceLimit==="number"}function Lc(w){if(w instanceof Date)return!0;return typeof w.toDateString==="function"&&typeof w.getDate==="function"&&typeof w.setDate==="function"}function _c(w){if(w instanceof RegExp)return!0;return typeof w.flags==="string"&&typeof w.ignoreCase==="boolean"&&typeof w.multiline==="boolean"&&typeof w.global==="boolean"}function Tc(w,$){return rz(w)==="GeneratorFunction"}function Ec(w){return typeof w.throw==="function"&&typeof w.return==="function"&&typeof w.next==="function"}function bc(w){try{if(typeof w.length==="number"&&typeof w.callee==="function")return!0}catch($){if($.message.indexOf("callee")!==-1)return!0}return!1}function jc(w){if(w.constructor&&typeof w.constructor.isBuffer==="function")return w.constructor.isBuffer(w);return!1}});var iz=p((Sq0,cz)=>{/*!
|
|
3
|
+
`)}catch{}}}formatJsonEntry(w,$,f){let X={ts:new Date().toISOString(),level:w,msg:$};if(this.context)X.ctx=this.context;if(f.length>0)X.data=f;return JSON.stringify(X)}silly(w,...$){if(this.level<=0)this.write(console.debug.bind(console),"silly",w,$)}verbose(w,...$){if(this.level<=1)this.write(console.debug.bind(console),"verbose",w,$)}debug(w,...$){if(this.level<=2)this.write(console.debug.bind(console),"debug",w,$)}info(w,...$){if(this.level<=3){let f=this.useStderr?console.error.bind(console):console.info.bind(console);this.write(f,"info",w,$)}}warn(w,...$){if(this.level<=4)this.write(console.warn.bind(console),"warn",w,$)}error(w,...$){if(this.level<=5)this.write(console.error.bind(console),"error",w,$)}child(w){return new S2({level:this.level,context:w,useStderr:this.useStderr,format:this.format},this.fileHandle)}setUseStderr(w){this.useStderr=w}}var MZ0;var Q9=C(()=>{MZ0=S2.getInstance()});var WB;var YB=C(()=>{Z0();Q9();WB=F.union([F.object({success:F.literal(!0),data:F.unknown(),message:F.string().optional()}),F.object({success:F.literal(!1),error:F.string(),code:F.string().optional()})])});var JB=C(()=>{Z0()});var WA=C(()=>{XB();fA();YB();JB()});var gZ0,xZ0,AX,GB,AB,HX,YA,yp,gp;var UX=C(()=>{Z0();j5();i5();tM();WA();gZ0=F.object({id:F.string(),type:F.string(),version:F.string(),status:F.string()}),xZ0=F.object({name:F.string(),description:F.string()}),AX=F.object({label:F.string(),url:F.string(),pluginId:F.string(),priority:F.number().default(100),visibility:p3.default("public")}),GB=F.enum(["human","agent","admin","protocol"]),AB=F.enum(["available","coming-soon","disabled"]),HX=F.object({id:F.string(),label:F.string(),description:F.string().optional(),href:F.string(),kind:GB,pluginId:F.string(),priority:F.number().default(100),visibility:p3.default("public"),status:AB.default("available")}),YA=F.object({entityType:F.string(),count:F.number()}),yp=F.object({model:F.string(),version:F.string(),uptime:F.number(),entities:F.number(),entityCounts:F.array(YA),embeddings:F.number(),ai:F.object({model:F.string(),embeddingModel:F.string()}),daemons:F.array(sM),endpoints:F.array(AX),interactions:F.array(HX)}),gp=F.object({id:F.string(),version:F.string(),type:F.enum(["core","entity","service","interface"]),description:F.string().optional(),dependencies:F.array(F.string()).optional(),packageName:F.string()})});class l4{callback;heartbeatInterval;constructor(w){this.callback=w}static from(w){if(!w)return;return new l4(w)}createSub(w){let{scale:$}=w??{};if($){let{start:f,end:X}=$,W=X-f;return new l4(async(Y)=>{let J=f+Y.progress/(Y.total??100)*W;await this.callback({...Y,progress:J,total:100})})}return new l4(this.callback)}async report(w){await this.callback(w)}startHeartbeat(w,$=5000){this.stopHeartbeat(),this.heartbeatInterval=setInterval(()=>{this.report({message:w,progress:0}).catch(()=>{})},$)}stopHeartbeat(){if(this.heartbeatInterval)clearInterval(this.heartbeatInterval),this.heartbeatInterval=void 0}toCallback(){return this.callback}}class Z9{id;version;description;packageName;config;context;get logger(){return this.context?.logger??S2.createFresh({context:this.id})}constructor(w,$,f,X){this.id=w,this.packageName=$.name,this.version=$.version,this.description=$.description??`${$.name} plugin`,this.config=X.parse(f)}setupMessageHandlers(w){w.messaging.subscribe(`plugin:${this.id}:tool:execute`,async($)=>{try{let{toolName:f,args:X,progressToken:W,hasProgress:Y,interfaceType:J,userId:G,channelId:A,userPermissionLevel:U}=xp.parse($.payload),h=(await this.getTools()).find((V)=>V.name===f);if(!h)return{success:!1,error:`Tool not found: ${f}`};let O={interfaceType:J,userId:G,...A&&{channelId:A},...U&&{userPermissionLevel:U},...Y&&W!==void 0&&{progressToken:W,sendProgress:async(V)=>{await w.messaging.send({type:`plugin:${this.id}:progress`,payload:{progressToken:W,notification:V}})}}};return{success:!0,data:await h.handler(X,O)}}catch(f){if(f instanceof F.ZodError)return{success:!1,error:"Invalid tool execution request format"};return this.logger.error("Tool execution error",f),{success:!1,error:t1(f)}}}),w.messaging.subscribe(`plugin:${this.id}:resource:get`,async($)=>{try{let{resourceUri:f}=mp.parse($.payload),W=(await this.getResources()).find((J)=>J.uri===f);if(!W)return{success:!1,error:`Resource not found: ${f}`};return{success:!0,data:await W.handler()}}catch(f){if(f instanceof F.ZodError)return{success:!1,error:"Invalid resource get request format"};return this.logger.error("Resource fetch error",f),{success:!1,error:t1(f)}}})}async onRegister(w){}async onReady(w){}async ready(){await this.onReady(this.getContext())}async getCapabilities(){let w=await this.getInstructions();return{tools:await this.getTools(),resources:await this.getResources(),...w&&{instructions:w}}}async getTools(){return[]}async getResources(){return[]}async getInstructions(){return}async shutdown(){await this.onShutdown()}async onShutdown(){}getContext(){if(!this.context)throw Error(`Plugin ${this.id}: Plugin not registered yet`);return this.context}determineUserPermissionLevel(w){return"public"}createProgressBridge(w){if(!w)return;let $=this.context;if(!$)return;let f=this.id;return l4.from(async(X)=>{await $.messaging.send({type:`plugin:${f}:progress`,payload:{progressToken:w,notification:{progress:X.progress,total:X.total,message:X.message}}})})}}var xp,mp;var KX=C(()=>{UX();Q9();Z0();xp=F.object({toolName:F.string(),args:F.unknown(),progressToken:F.union([F.string(),F.number()]).optional(),hasProgress:F.boolean().optional(),...YX.shape}),mp=F.object({resourceUri:F.string()})});var HB,JA,UB,hX,KB,hB,FB,OB,FX;var GA=C(()=>{Z0();HB=F.object({id:F.string(),template:F.string(),content:F.unknown().optional(),dataQuery:F.object({entityType:F.string().optional(),template:F.string().optional(),query:F.object({id:F.string().optional(),limit:F.number().optional(),offset:F.number().optional()}).passthrough().optional()}).passthrough().optional(),order:F.number().optional()}),JA=["primary","secondary"],UB=F.object({show:F.boolean().default(!1),label:F.string().optional(),slot:F.enum(JA).default("primary"),priority:F.number().min(0).max(100).default(50)}).optional(),hX=F.object({id:F.string(),path:F.string(),title:F.string().default(""),pageLabel:F.string().optional(),description:F.string().default(""),sections:F.array(HB).default([]),layout:F.string().default("default"),fullscreen:F.boolean().optional(),pluginId:F.string().optional(),sourceEntityType:F.string().optional(),external:F.boolean().optional(),navigation:UB}),KB=F.object({routes:F.array(hX),pluginId:F.string()}),hB=F.object({paths:F.array(F.string()).optional(),pluginId:F.string().optional()}),FB=F.object({pluginId:F.string().optional()}),OB=F.object({path:F.string()}),FX=F.object({label:F.string(),href:F.string(),priority:F.number()})});var OX,QX,ZX,lp,rp;var QB=C(()=>{Z0();GA();OX=F.object({heading:F.string().describe("Main CTA heading text"),buttonText:F.string().describe("Call-to-action button text"),buttonLink:F.string().describe("URL or anchor for the CTA button")}),QX=F.object({blurb:F.string().optional().describe("Short italic subtitle under the section title")}),ZX=F.object({title:F.string().describe("The site's title"),description:F.string().describe("The site's description"),url:F.string().optional().describe("Canonical site URL"),copyright:F.string().optional().describe("Copyright notice text"),logo:F.boolean().optional().describe("Whether to display logo instead of title text in header"),themeMode:F.enum(["light","dark"]).optional().describe("Default theme mode"),analyticsScript:F.string().optional().describe("Analytics script HTML"),cta:OX.optional().describe("Call-to-action configuration"),sections:F.record(F.string(),QX).optional().describe("Optional per-section blurbs, keyed by section id (e.g. 'essays', 'presentations', 'about'). Used by homepage templates that render editorial section headers.")}),lp=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")}),rp=ZX.extend({navigation:F.object({primary:F.array(FX),secondary:F.array(FX)}),copyright:F.string(),socialLinks:F.array(lp).optional().describe("Social media links from profile metadata")})});function AA(w){return`preview.${w.trim().replace(/^https?:\/\//,"")}`}function e1(w){return w.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function ZB(w){let f=w.split(/\s+/).filter((X)=>X.length>0).length;return Math.max(1,Math.ceil(f/200))}var G5=()=>{};var MB=C(()=>{G5()});var cp,ip,dp,np,op;var BB=C(()=>{Z0();cp=F.string(),ip=F.object({id:F.string().min(1)}).passthrough(),dp=F.object({label:F.string().min(1)}).passthrough(),np=F.object({layouts:F.record(F.unknown()),plugin:F.function(),routes:F.array(ip),entityDisplay:F.record(dp),staticAssets:F.record(F.string()).optional()}).passthrough(),op=F.custom((w)=>np.safeParse(w).success)});var r4=C(()=>{GA();QB();MB();BB()});var VB="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";import{webcrypto as zB}from"crypto";function ep(w){if(w<0||w>1024)throw RangeError("Wrong ID size");if(!p4||p4.length<w)p4=Buffer.allocUnsafe(w*tp),zB.getRandomValues(p4),M9=0;else if(M9+w>p4.length)zB.getRandomValues(p4),M9=0;M9+=w}function RB(w=21){ep(w|=0);let $="";for(let f=M9-w;f<M9;f++)$+=VB[p4[f]&63];return $}var tp=128,p4,M9;var NB=()=>{};function T6(w=12){return RB(w)}var c4=C(()=>{NB()});var qB,DB,w7,NM0;var MX=C(()=>{Z0();qB=F.enum(["file_operations","content_operations","data_processing","batch_processing"]),DB=F.object({pluginId:F.string().optional(),progressToken:F.union([F.string(),F.number()]).optional(),operationType:qB,operationTarget:F.string().optional(),interfaceType:F.string().optional(),conversationId:F.string().optional(),channelId:F.string().optional(),silent:F.boolean().optional()}),w7=DB.extend({rootJobId:F.string()}),NM0=F.enum(["none","skip","replace","coalesce"])});var HA,vB,wc,$c,PB,UA;var E6=C(()=>{Z0();MX();HA=F.enum(["pending","processing","completed","failed"]),vB=F.enum(["completed","failed"]),wc=F.object({id:F.string(),type:F.string(),status:HA,data:F.unknown(),result:F.unknown().optional(),lastError:F.string().optional().nullable(),attempts:F.number(),maxRetries:F.number(),priority:F.number(),createdAt:F.date(),updatedAt:F.date(),processedAt:F.date().optional().nullable(),completedAt:F.date().optional().nullable(),failedAt:F.date().optional().nullable()}),$c=F.object({jobId:F.string(),type:F.string(),status:vB,result:F.unknown().optional(),error:F.string().optional()}),PB=F.object({success:F.literal(!1),error:F.string().optional()}),UA=F.object({id:F.string(),type:F.enum(["job","batch"]),status:HA,message:F.string().optional(),progress:F.object({current:F.number(),total:F.number(),percentage:F.number()}).optional(),aggregationKey:F.string().optional(),batchDetails:F.object({totalOperations:F.number(),completedOperations:F.number(),failedOperations:F.number(),currentOperation:F.string().optional(),errors:F.array(F.string()).optional()}).optional(),jobDetails:F.object({jobType:F.string(),priority:F.number(),retryCount:F.number()}).optional(),metadata:w7})});function c0(w,$){if(!w||typeof w!=="object")return!1;if(w instanceof $)return!0;if(!Object.prototype.hasOwnProperty.call($,K0))throw Error(`Class "${$.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let f=Object.getPrototypeOf(w).constructor;if(f)while(f){if(K0 in f&&f[K0]===$[K0])return!0;f=Object.getPrototypeOf(f)}return!1}var K0;var V1=C(()=>{K0=Symbol.for("drizzle:entityKind")});var A5;var b6=C(()=>{V1();A5=class A5{constructor(w,$){this.table=w,this.config=$,this.name=$.name,this.keyAsName=$.keyAsName,this.notNull=$.notNull,this.default=$.default,this.defaultFn=$.defaultFn,this.onUpdateFn=$.onUpdateFn,this.hasDefault=$.hasDefault,this.primary=$.primaryKey,this.isUnique=$.isUnique,this.uniqueName=$.uniqueName,this.uniqueType=$.uniqueType,this.dataType=$.dataType,this.columnType=$.columnType,this.generated=$.generated,this.generatedIdentity=$.generatedIdentity}static[K0]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(w){return w}mapToDriverValue(w){return w}shouldDisableInsert(){return this.config.generated!==void 0&&this.config.generated.type!=="byDefault"}}});var KA;var hA=C(()=>{V1();KA=class KA{static[K0]="ColumnBuilder";config;constructor(w,$,f){this.config={name:w,keyAsName:w==="",notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:$,columnType:f,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(w){return this.config.default=w,this.config.hasDefault=!0,this}$defaultFn(w){return this.config.defaultFn=w,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(w){return this.config.onUpdateFn=w,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(w){if(this.config.name!=="")return;this.config.name=w}}});var d5;var $7=C(()=>{d5=Symbol.for("drizzle:Name")});function kB(w,...$){return w(...$)}var LB=()=>{};function _B(w,$){return`${w[d5]}_${$.join("_")}_unique`}var TB=C(()=>{$7()});var f7,fc;var EB=C(()=>{b6();V1();TB();f7=class f7 extends A5{constructor(w,$){if(!$.uniqueName)$.uniqueName=_B(w,[$.name]);super(w,$);this.table=w}static[K0]="PgColumn"};fc=class fc extends f7{static[K0]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(w){return this.indexConfig.opClass=w,this}}});function jB(w){return!!w&&typeof w==="function"&&bB in w&&w[bB]===!0}var Xc,bB,Wc;var IB=C(()=>{V1();EB();Xc=class Xc extends f7{static[K0]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor(w,$){super(w,$);this.enum=$.enum}getSQLType(){return this.enum.enumName}};bB=Symbol.for("drizzle:isPgEnum");Wc=class Wc extends f7{static[K0]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(w,$){super(w,$);this.enum=$.enum}getSQLType(){return this.enum.enumName}}});var a2;var j6=C(()=>{V1();a2=class a2{static[K0]="Subquery";constructor(w,$,f,X=!1,W=[]){this._={brand:"Subquery",sql:w,selectedFields:$,alias:f,isWith:X,usedTables:W}}}});var SB="0.44.7";var CB=()=>{};var FA,OA,uB;var yB=C(()=>{LB();CB();uB={startActiveSpan(w,$){if(!FA)return $();if(!OA)OA=FA.trace.getTracer("drizzle-orm",SB);return kB((f,X)=>X.startActiveSpan(w,(W)=>{try{return $(W)}catch(Y){throw W.setStatus({code:f.SpanStatusCode.ERROR,message:Y instanceof Error?Y.message:"Unknown error"}),Y}finally{W.end()}}),FA,OA)}}});var w2;var I6=C(()=>{w2=Symbol.for("drizzle:ViewBaseConfig")});var QA,gB,xB,ZA,MA,X7,mB,Yc,w1;var c3=C(()=>{V1();$7();QA=Symbol.for("drizzle:Schema"),gB=Symbol.for("drizzle:Columns"),xB=Symbol.for("drizzle:ExtraConfigColumns"),ZA=Symbol.for("drizzle:OriginalName"),MA=Symbol.for("drizzle:BaseName"),X7=Symbol.for("drizzle:IsAlias"),mB=Symbol.for("drizzle:ExtraConfigBuilder"),Yc=Symbol.for("drizzle:IsDrizzleTable");w1=class w1{static[K0]="Table";static Symbol={Name:d5,Schema:QA,OriginalName:ZA,Columns:gB,ExtraConfigColumns:xB,BaseName:MA,IsAlias:X7,ExtraConfigBuilder:mB};[d5];[ZA];[QA];[gB];[xB];[MA];[X7]=!1;[Yc]=!0;[mB]=void 0;constructor(w,$,f){this[d5]=this[ZA]=w,this[QA]=$,this[MA]=f}}});function Jc(w){return w!==null&&w!==void 0&&typeof w.getSQL==="function"}function Gc(w){let $={sql:"",params:[]};for(let f of w)if($.sql+=f.sql,$.params.push(...f.params),f.typings?.length){if(!$.typings)$.typings=[];$.typings.push(...f.typings)}return $}function i4(w,...$){let f=[];if($.length>0||w.length>0&&w[0]!=="")f.push(new I5(w[0]));for(let[X,W]of $.entries())f.push(W,new I5(w[X+1]));return new F1(f)}var I5,F1,BX,lB,rB,GB0,zX,VX,Ac,B3;var S6=C(()=>{V1();IB();j6();yB();I6();b6();c3();I5=class I5{static[K0]="StringChunk";value;constructor(w){this.value=Array.isArray(w)?w:[w]}getSQL(){return new F1([this])}};F1=class F1{constructor(w){this.queryChunks=w;for(let $ of w)if(c0($,w1)){let f=$[w1.Symbol.Schema];this.usedTables.push(f===void 0?$[w1.Symbol.Name]:f+"."+$[w1.Symbol.Name])}}static[K0]="SQL";decoder=lB;shouldInlineParams=!1;usedTables=[];append(w){return this.queryChunks.push(...w.queryChunks),this}toQuery(w){return uB.startActiveSpan("drizzle.buildSQL",($)=>{let f=this.buildQueryFromSourceParams(this.queryChunks,w);return $?.setAttributes({"drizzle.query.text":f.sql,"drizzle.query.params":JSON.stringify(f.params)}),f})}buildQueryFromSourceParams(w,$){let f=Object.assign({},$,{inlineParams:$.inlineParams||this.shouldInlineParams,paramStartIndex:$.paramStartIndex||{value:0}}),{casing:X,escapeName:W,escapeParam:Y,prepareTyping:J,inlineParams:G,paramStartIndex:A}=f;return Gc(w.map((U)=>{if(c0(U,I5))return{sql:U.value.join(""),params:[]};if(c0(U,BX))return{sql:W(U.value),params:[]};if(U===void 0)return{sql:"",params:[]};if(Array.isArray(U)){let K=[new I5("(")];for(let[h,O]of U.entries())if(K.push(O),h<U.length-1)K.push(new I5(", "));return K.push(new I5(")")),this.buildQueryFromSourceParams(K,f)}if(c0(U,F1))return this.buildQueryFromSourceParams(U.queryChunks,{...f,inlineParams:G||U.shouldInlineParams});if(c0(U,w1)){let K=U[w1.Symbol.Schema],h=U[w1.Symbol.Name];return{sql:K===void 0||U[X7]?W(h):W(K)+"."+W(h),params:[]}}if(c0(U,A5)){let K=X.getColumnCasing(U);if($.invokeSource==="indexes")return{sql:W(K),params:[]};let h=U.table[w1.Symbol.Schema];return{sql:U.table[X7]||h===void 0?W(U.table[w1.Symbol.Name])+"."+W(K):W(h)+"."+W(U.table[w1.Symbol.Name])+"."+W(K),params:[]}}if(c0(U,B3)){let K=U[w2].schema,h=U[w2].name;return{sql:K===void 0||U[w2].isAlias?W(h):W(K)+"."+W(h),params:[]}}if(c0(U,zX)){if(c0(U.value,VX))return{sql:Y(A.value++,U),params:[U],typings:["none"]};let K=U.value===null?null:U.encoder.mapToDriverValue(U.value);if(c0(K,F1))return this.buildQueryFromSourceParams([K],f);if(G)return{sql:this.mapInlineParam(K,f),params:[]};let h=["none"];if(J)h=[J(U.encoder)];return{sql:Y(A.value++,K),params:[K],typings:h}}if(c0(U,VX))return{sql:Y(A.value++,U),params:[U],typings:["none"]};if(c0(U,F1.Aliased)&&U.fieldAlias!==void 0)return{sql:W(U.fieldAlias),params:[]};if(c0(U,a2)){if(U._.isWith)return{sql:W(U._.alias),params:[]};return this.buildQueryFromSourceParams([new I5("("),U._.sql,new I5(") "),new BX(U._.alias)],f)}if(jB(U)){if(U.schema)return{sql:W(U.schema)+"."+W(U.enumName),params:[]};return{sql:W(U.enumName),params:[]}}if(Jc(U)){if(U.shouldOmitSQLParens?.())return this.buildQueryFromSourceParams([U.getSQL()],f);return this.buildQueryFromSourceParams([new I5("("),U.getSQL(),new I5(")")],f)}if(G)return{sql:this.mapInlineParam(U,f),params:[]};return{sql:Y(A.value++,U),params:[U],typings:["none"]}}))}mapInlineParam(w,{escapeString:$}){if(w===null)return"null";if(typeof w==="number"||typeof w==="boolean")return w.toString();if(typeof w==="string")return $(w);if(typeof w==="object"){let f=w.toString();if(f==="[object Object]")return $(JSON.stringify(w));return $(f)}throw Error("Unexpected param value: "+w)}getSQL(){return this}as(w){if(w===void 0)return this;return new F1.Aliased(this,w)}mapWith(w){return this.decoder=typeof w==="function"?{mapFromDriverValue:w}:w,this}inlineParams(){return this.shouldInlineParams=!0,this}if(w){return w?this:void 0}};BX=class BX{constructor(w){this.value=w}static[K0]="Name";brand;getSQL(){return new F1([this])}};lB={mapFromDriverValue:(w)=>w},rB={mapToDriverValue:(w)=>w},GB0={...lB,...rB};zX=class zX{constructor(w,$=rB){this.value=w,this.encoder=$}static[K0]="Param";brand;getSQL(){return new F1([this])}};((w)=>{function $(){return new F1([])}w.empty=$;function f(A){return new F1(A)}w.fromList=f;function X(A){return new F1([new I5(A)])}w.raw=X;function W(A,U){let K=[];for(let[h,O]of A.entries()){if(h>0&&U!==void 0)K.push(U);K.push(O)}return new F1(K)}w.join=W;function Y(A){return new BX(A)}w.identifier=Y;function J(A){return new VX(A)}w.placeholder=J;function G(A,U){return new zX(A,U)}w.param=G})(i4||(i4={}));((w)=>{class ${constructor(f,X){this.sql=f,this.fieldAlias=X}static[K0]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new $(this.sql,this.fieldAlias)}}w.Aliased=$})(F1||(F1={}));VX=class VX{constructor(w){this.name=w}static[K0]="Placeholder";getSQL(){return new F1([this])}};Ac=Symbol.for("drizzle:IsDrizzleView");B3=class B3{static[K0]="View";[w2];[Ac]=!0;constructor({name:w,schema:$,selectedFields:f,query:X}){this[w2]={name:w,originalName:w,schema:$,selectedFields:f,query:X,isExisting:!X,isAlias:!1}}getSQL(){return new F1([this])}};A5.prototype.getSQL=function(){return new F1([this])};w1.prototype.getSQL=function(){return new F1([this])};a2.prototype.getSQL=function(){return new F1([this])}});function B9(w,$){return Object.entries(w).reduce((f,[X,W])=>{if(typeof X!=="string")return f;let Y=$?[...$,X]:[X];if(c0(W,A5)||c0(W,F1)||c0(W,F1.Aliased))f.push({path:Y,field:W});else if(c0(W,w1))f.push(...B9(W[w1.Symbol.Columns],Y));else f.push(...B9(W,Y));return f},[])}function BA(w,$){let f=Object.keys(w),X=Object.keys($);if(f.length!==X.length)return!1;for(let[W,Y]of f.entries())if(Y!==X[W])return!1;return!0}function pB(w,$){for(let f of $)for(let X of Object.getOwnPropertyNames(f.prototype)){if(X==="constructor")continue;Object.defineProperty(w.prototype,X,Object.getOwnPropertyDescriptor(f.prototype,X)||Object.create(null))}}function W7(w){return c0(w,a2)?w._.alias:c0(w,B3)?w[w2].name:c0(w,F1)?void 0:w[w1.Symbol.IsAlias]?w[w1.Symbol.Name]:w[w1.Symbol.BaseName]}function V3(w,$){return{name:typeof w==="string"&&w.length>0?w:"",config:typeof w==="object"?w:$}}var VA;var i3=C(()=>{b6();V1();S6();j6();c3();I6();VA=typeof TextDecoder>"u"?null:new TextDecoder});var cB=()=>{};var iB=()=>{};var dB=()=>{};var nB=C(()=>{iB();dB()});var oB=()=>{};var Y7,zA;var RA=C(()=>{b6();V1();c3();I6();Y7=class Y7{constructor(w){this.table=w}static[K0]="ColumnAliasProxyHandler";get(w,$){if($==="table")return this.table;return w[$]}};zA=class zA{constructor(w,$){this.alias=w,this.replaceOriginalName=$}static[K0]="TableAliasProxyHandler";get(w,$){if($===w1.Symbol.IsAlias)return!0;if($===w1.Symbol.Name)return this.alias;if(this.replaceOriginalName&&$===w1.Symbol.OriginalName)return this.alias;if($===w2)return{...w[w2],name:this.alias,isAlias:!0};if($===w1.Symbol.Columns){let X=w[w1.Symbol.Columns];if(!X)return X;let W={};return Object.keys(X).map((Y)=>{W[Y]=new Proxy(X[Y],new Y7(new Proxy(w,this)))}),W}let f=w[$];if(c0(f,A5))return new Proxy(f,new Y7(new Proxy(w,this)));return f}}});var H5;var NA=C(()=>{RA();b6();V1();S6();j6();I6();H5=class H5{static[K0]="SelectionProxyHandler";config;constructor(w){this.config={...w}}get(w,$){if($==="_")return{...w._,selectedFields:new Proxy(w._.selectedFields,this)};if($===w2)return{...w[w2],selectedFields:new Proxy(w[w2].selectedFields,this)};if(typeof $==="symbol")return w[$];let X=(c0(w,a2)?w._.selectedFields:c0(w,B3)?w[w2].selectedFields:w)[$];if(c0(X,F1.Aliased)){if(this.config.sqlAliasedBehavior==="sql"&&!X.isSelectionField)return X.sql;let W=X.clone();return W.isSelectionField=!0,W}if(c0(X,F1)){if(this.config.sqlBehavior==="sql")return X;throw Error(`You tried to reference "${$}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}if(c0(X,A5)){if(this.config.alias)return new Proxy(X,new Y7(new Proxy(X.table,new zA(this.config.alias,this.config.replaceOriginalName??!1))));return X}if(typeof X!=="object"||X===null)return X;return new Proxy(X,new H5(this.config))}}});var J7;var RX=C(()=>{V1();J7=class J7{static[K0]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(w){return this.then(void 0,w)}finally(w){return this.then(($)=>{return w?.(),$},($)=>{throw w?.(),$})}then(w,$){return this.execute().then(w,$)}}});var qA,aB;var DA=C(()=>{V1();$7();qA=class qA{static[K0]="SQLiteForeignKeyBuilder";reference;_onUpdate;_onDelete;constructor(w,$){if(this.reference=()=>{let{name:f,columns:X,foreignColumns:W}=w();return{name:f,columns:X,foreignTable:W[0].table,foreignColumns:W}},$)this._onUpdate=$.onUpdate,this._onDelete=$.onDelete}onUpdate(w){return this._onUpdate=w,this}onDelete(w){return this._onDelete=w,this}build(w){return new aB(w,this)}};aB=class aB{constructor(w,$){this.table=w,this.reference=$.reference,this.onUpdate=$._onUpdate,this.onDelete=$._onDelete}static[K0]="SQLiteForeignKey";reference;onUpdate;onDelete;getName(){let{name:w,columns:$,foreignColumns:f}=this.reference(),X=$.map((J)=>J.name),W=f.map((J)=>J.name),Y=[this.table[d5],...X,f[0].table[d5],...W];return w??`${Y.join("_")}_fk`}}});function sB(w,$){return`${w[d5]}_${$.join("_")}_unique`}var vA=C(()=>{$7()});var O2,Q2;var C6=C(()=>{hA();b6();V1();DA();vA();O2=class O2 extends KA{static[K0]="SQLiteColumnBuilder";foreignKeyConfigs=[];references(w,$={}){return this.foreignKeyConfigs.push({ref:w,actions:$}),this}unique(w){return this.config.isUnique=!0,this.config.uniqueName=w,this}generatedAlwaysAs(w,$){return this.config.generated={as:w,type:"always",mode:$?.mode??"virtual"},this}buildForeignKeys(w,$){return this.foreignKeyConfigs.map(({ref:f,actions:X})=>{return((W,Y)=>{let J=new qA(()=>{let G=W();return{columns:[w],foreignColumns:[G]}});if(Y.onUpdate)J.onUpdate(Y.onUpdate);if(Y.onDelete)J.onDelete(Y.onDelete);return J.build($)})(f,X)})}};Q2=class Q2 extends A5{constructor(w,$){if(!$.uniqueName)$.uniqueName=sB(w,[$.name]);super(w,$);this.table=w}static[K0]="SQLiteColumn"}});function WV(w,$){let{name:f,config:X}=V3(w,$);if(X?.mode==="json")return new wV(f);if(X?.mode==="bigint")return new tB(f);return new fV(f)}var tB,eB,wV,$V,fV,XV;var PA=C(()=>{V1();i3();C6();tB=class tB extends O2{static[K0]="SQLiteBigIntBuilder";constructor(w){super(w,"bigint","SQLiteBigInt")}build(w){return new eB(w,this.config)}};eB=class eB extends Q2{static[K0]="SQLiteBigInt";getSQLType(){return"blob"}mapFromDriverValue(w){if(typeof Buffer<"u"&&Buffer.from){let $=Buffer.isBuffer(w)?w:w instanceof ArrayBuffer?Buffer.from(w):w.buffer?Buffer.from(w.buffer,w.byteOffset,w.byteLength):Buffer.from(w);return BigInt($.toString("utf8"))}return BigInt(VA.decode(w))}mapToDriverValue(w){return Buffer.from(w.toString())}};wV=class wV extends O2{static[K0]="SQLiteBlobJsonBuilder";constructor(w){super(w,"json","SQLiteBlobJson")}build(w){return new $V(w,this.config)}};$V=class $V extends Q2{static[K0]="SQLiteBlobJson";getSQLType(){return"blob"}mapFromDriverValue(w){if(typeof Buffer<"u"&&Buffer.from){let $=Buffer.isBuffer(w)?w:w instanceof ArrayBuffer?Buffer.from(w):w.buffer?Buffer.from(w.buffer,w.byteOffset,w.byteLength):Buffer.from(w);return JSON.parse($.toString("utf8"))}return JSON.parse(VA.decode(w))}mapToDriverValue(w){return Buffer.from(JSON.stringify(w))}};fV=class fV extends O2{static[K0]="SQLiteBlobBufferBuilder";constructor(w){super(w,"buffer","SQLiteBlobBuffer")}build(w){return new XV(w,this.config)}};XV=class XV extends Q2{static[K0]="SQLiteBlobBuffer";mapFromDriverValue(w){if(Buffer.isBuffer(w))return w;return Buffer.from(w)}getSQLType(){return"blob"}}});function NX(w){return($,f)=>{let{name:X,config:W}=V3($,f);return new YV(X,W,w)}}var YV,JV;var kA=C(()=>{V1();i3();C6();YV=class YV extends O2{static[K0]="SQLiteCustomColumnBuilder";constructor(w,$,f){super(w,"custom","SQLiteCustomColumn");this.config.fieldConfig=$,this.config.customTypeParams=f}build(w){return new JV(w,this.config)}};JV=class JV extends Q2{static[K0]="SQLiteCustomColumn";sqlName;mapTo;mapFrom;constructor(w,$){super(w,$);this.sqlName=$.customTypeParams.dataType($.fieldConfig),this.mapTo=$.customTypeParams.toDriver,this.mapFrom=$.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(w){return typeof this.mapFrom==="function"?this.mapFrom(w):w}mapToDriverValue(w){return typeof this.mapTo==="function"?this.mapTo(w):w}}});function s2(w,$){let{name:f,config:X}=V3(w,$);if(X?.mode==="timestamp"||X?.mode==="timestamp_ms")return new HV(f,X.mode);if(X?.mode==="boolean")return new KV(f,X.mode);return new GV(f)}var qX,DX,GV,AV,HV,UV,KV,hV;var LA=C(()=>{V1();S6();i3();C6();qX=class qX extends O2{static[K0]="SQLiteBaseIntegerBuilder";constructor(w,$,f){super(w,$,f);this.config.autoIncrement=!1}primaryKey(w){if(w?.autoIncrement)this.config.autoIncrement=!0;return this.config.hasDefault=!0,super.primaryKey()}};DX=class DX extends Q2{static[K0]="SQLiteBaseInteger";autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}};GV=class GV extends qX{static[K0]="SQLiteIntegerBuilder";constructor(w){super(w,"number","SQLiteInteger")}build(w){return new AV(w,this.config)}};AV=class AV extends DX{static[K0]="SQLiteInteger"};HV=class HV extends qX{static[K0]="SQLiteTimestampBuilder";constructor(w,$){super(w,"date","SQLiteTimestamp");this.config.mode=$}defaultNow(){return this.default(i4`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(w){return new UV(w,this.config)}};UV=class UV extends DX{static[K0]="SQLiteTimestamp";mode=this.config.mode;mapFromDriverValue(w){if(this.config.mode==="timestamp")return new Date(w*1000);return new Date(w)}mapToDriverValue(w){let $=w.getTime();if(this.config.mode==="timestamp")return Math.floor($/1000);return $}};KV=class KV extends qX{static[K0]="SQLiteBooleanBuilder";constructor(w,$){super(w,"boolean","SQLiteBoolean");this.config.mode=$}build(w){return new hV(w,this.config)}};hV=class hV extends DX{static[K0]="SQLiteBoolean";mode=this.config.mode;mapFromDriverValue(w){return Number(w)===1}mapToDriverValue(w){return w?1:0}}});function VV(w,$){let{name:f,config:X}=V3(w,$),W=X?.mode;return W==="number"?new QV(f):W==="bigint"?new MV(f):new FV(f)}var FV,OV,QV,ZV,MV,BV;var _A=C(()=>{V1();i3();C6();FV=class FV extends O2{static[K0]="SQLiteNumericBuilder";constructor(w){super(w,"string","SQLiteNumeric")}build(w){return new OV(w,this.config)}};OV=class OV extends Q2{static[K0]="SQLiteNumeric";mapFromDriverValue(w){if(typeof w==="string")return w;return String(w)}getSQLType(){return"numeric"}};QV=class QV extends O2{static[K0]="SQLiteNumericNumberBuilder";constructor(w){super(w,"number","SQLiteNumericNumber")}build(w){return new ZV(w,this.config)}};ZV=class ZV extends Q2{static[K0]="SQLiteNumericNumber";mapFromDriverValue(w){if(typeof w==="number")return w;return Number(w)}mapToDriverValue=String;getSQLType(){return"numeric"}};MV=class MV extends O2{static[K0]="SQLiteNumericBigIntBuilder";constructor(w){super(w,"bigint","SQLiteNumericBigInt")}build(w){return new BV(w,this.config)}};BV=class BV extends Q2{static[K0]="SQLiteNumericBigInt";mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return"numeric"}}});function NV(w){return new zV(w??"")}var zV,RV;var TA=C(()=>{V1();C6();zV=class zV extends O2{static[K0]="SQLiteRealBuilder";constructor(w){super(w,"number","SQLiteReal")}build(w){return new RV(w,this.config)}};RV=class RV extends Q2{static[K0]="SQLiteReal";getSQLType(){return"real"}}});function a0(w,$={}){let{name:f,config:X}=V3(w,$);if(X.mode==="json")return new vV(f);return new qV(f,X)}var qV,DV,vV,PV;var EA=C(()=>{V1();i3();C6();qV=class qV extends O2{static[K0]="SQLiteTextBuilder";constructor(w,$){super(w,"string","SQLiteText");this.config.enumValues=$.enum,this.config.length=$.length}build(w){return new DV(w,this.config)}};DV=class DV extends Q2{static[K0]="SQLiteText";enumValues=this.config.enumValues;length=this.config.length;constructor(w,$){super(w,$)}getSQLType(){return`text${this.config.length?`(${this.config.length})`:""}`}};vV=class vV extends O2{static[K0]="SQLiteTextJsonBuilder";constructor(w){super(w,"json","SQLiteTextJson")}build(w){return new PV(w,this.config)}};PV=class PV extends Q2{static[K0]="SQLiteTextJson";getSQLType(){return"text"}mapFromDriverValue(w){return JSON.parse(w)}mapToDriverValue(w){return JSON.stringify(w)}}});function kV(){return{blob:WV,customType:NX,integer:s2,numeric:VV,real:NV,text:a0}}var LV=C(()=>{PA();kA();LA();_A();TA();EA()});function Hc(w,$,f,X,W=w){let Y=new z3(w,X,W),J=typeof $==="function"?$(kV()):$,G=Object.fromEntries(Object.entries(J).map(([U,K])=>{let h=K;h.setName(U);let O=h.build(Y);return Y[bA].push(...h.buildForeignKeys(O,Y)),[U,O]})),A=Object.assign(Y,G);if(A[w1.Symbol.Columns]=G,A[w1.Symbol.ExtraConfigColumns]=G,f)A[z3.Symbol.ExtraConfigBuilder]=f;return A}var bA,z3,R3=(w,$,f)=>{return Hc(w,$,f)};var G7=C(()=>{V1();c3();LV();bA=Symbol.for("drizzle:SQLiteInlineForeignKeys");z3=class z3 extends w1{static[K0]="SQLiteTable";static Symbol=Object.assign({},w1.Symbol,{InlineForeignKeys:bA});[w1.Symbol.Columns];[bA]=[];[w1.Symbol.ExtraConfigBuilder]=void 0}});function EV(w,$){return new _V(w,$)}var _V,TV;var bV=C(()=>{V1();_V=class _V{constructor(w,$){this.name=w,this.value=$}static[K0]="SQLiteCheckBuilder";brand;build(w){return new TV(w,this)}};TV=class TV{constructor(w,$){this.table=w,this.name=$.name,this.value=$.value}static[K0]="SQLiteCheck";name;value}});function n5(w){return new jV(w,!1)}var jV,IV,SV;var CV=C(()=>{V1();jV=class jV{constructor(w,$){this.name=w,this.unique=$}static[K0]="SQLiteIndexBuilderOn";on(...w){return new IV(this.name,w,this.unique)}};IV=class IV{static[K0]="SQLiteIndexBuilder";config;constructor(w,$,f){this.config={name:w,columns:$,unique:f,where:void 0}}where(w){return this.config.where=w,this}build(w){return new SV(this.config,w)}};SV=class SV{static[K0]="SQLiteIndex";config;constructor(w,$){this.config={...w,table:$}}}});function vX(...w){if(w[0].columns)return new jA(w[0].columns,w[0].name);return new jA(w)}var jA,uV;var yV=C(()=>{V1();G7();jA=class jA{static[K0]="SQLitePrimaryKeyBuilder";columns;name;constructor(w,$){this.columns=w,this.name=$}build(w){return new uV(w,this.columns,this.name)}};uV=class uV{constructor(w,$,f){this.table=w,this.columns=$,this.name=f}static[K0]="SQLitePrimaryKey";columns;name;getName(){return this.name??`${this.table[z3.Symbol.Name]}_${this.columns.map((w)=>w.name).join("_")}_pk`}}});function d4(w){if(c0(w,z3))return[`${w[w1.Symbol.BaseName]}`];if(c0(w,a2))return w._.usedTables??[];if(c0(w,F1))return w.usedTables??[];return[]}var PX=C(()=>{V1();S6();j6();c3();G7()});var gV=()=>{};var xV=()=>{};var mV=()=>{};var lV=()=>{};var rV=C(()=>{mV();lV()});var pV=C(()=>{nB();rV();S6()});var cV=C(()=>{PA();C6();kA();LA();_A();TA();EA()});var IA;var iV=C(()=>{V1();S6();IA=class IA extends B3{static[K0]="SQLiteViewBase"}});var dV=()=>{};var SA;var nV=C(()=>{V1();SA=class SA{static[K0]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}});function kX(w,$){return(f,X,...W)=>{let Y=[X,...W].map((J)=>({type:w,isAll:$,rightSelect:J}));for(let J of Y)if(!BA(f.getSelectedFields(),J.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return f.addSetOperators(Y)}}var oV,aV,Uc=()=>({union:Kc,unionAll:hc,intersect:Fc,except:Oc}),Kc,hc,Fc,Oc;var sV=C(()=>{V1();nV();RX();NA();S6();j6();c3();i3();I6();PX();oV=class oV extends SA{static[K0]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:w,fields:$,isPartialSelect:f,session:X,dialect:W,withList:Y,distinct:J}){super();this.config={withList:Y,table:w,fields:{...$},distinct:J,setOperators:[]},this.isPartialSelect=f,this.session=X,this.dialect=W,this._={selectedFields:$,config:this.config},this.tableName=W7(w),this.joinsNotNullableMap=typeof this.tableName==="string"?{[this.tableName]:!0}:{};for(let G of d4(w))this.usedTables.add(G)}getUsedTables(){return[...this.usedTables]}createJoin(w){return($,f)=>{let X=this.tableName,W=W7($);for(let Y of d4($))this.usedTables.add(Y);if(typeof W==="string"&&this.config.joins?.some((Y)=>Y.alias===W))throw Error(`Alias "${W}" is already used in this query`);if(!this.isPartialSelect){if(Object.keys(this.joinsNotNullableMap).length===1&&typeof X==="string")this.config.fields={[X]:this.config.fields};if(typeof W==="string"&&!c0($,F1)){let Y=c0($,a2)?$._.selectedFields:c0($,B3)?$[w2].selectedFields:$[w1.Symbol.Columns];this.config.fields[W]=Y}}if(typeof f==="function")f=f(new Proxy(this.config.fields,new H5({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));if(!this.config.joins)this.config.joins=[];if(this.config.joins.push({on:f,table:$,joinType:w,alias:W}),typeof W==="string")switch(w){case"left":{this.joinsNotNullableMap[W]=!1;break}case"right":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([Y])=>[Y,!1])),this.joinsNotNullableMap[W]=!0;break}case"cross":case"inner":{this.joinsNotNullableMap[W]=!0;break}case"full":{this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([Y])=>[Y,!1])),this.joinsNotNullableMap[W]=!1;break}}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator(w,$){return(f)=>{let X=typeof f==="function"?f(Uc()):f;if(!BA(this.getSelectedFields(),X.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:w,isAll:$,rightSelect:X}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(w){return this.config.setOperators.push(...w),this}where(w){if(typeof w==="function")w=w(new Proxy(this.config.fields,new H5({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.where=w,this}having(w){if(typeof w==="function")w=w(new Proxy(this.config.fields,new H5({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})));return this.config.having=w,this}groupBy(...w){if(typeof w[0]==="function"){let $=w[0](new Proxy(this.config.fields,new H5({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray($)?$:[$]}else this.config.groupBy=w;return this}orderBy(...w){if(typeof w[0]==="function"){let $=w[0](new Proxy(this.config.fields,new H5({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),f=Array.isArray($)?$:[$];if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=f;else this.config.orderBy=f}else{let $=w;if(this.config.setOperators.length>0)this.config.setOperators.at(-1).orderBy=$;else this.config.orderBy=$}return this}limit(w){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).limit=w;else this.config.limit=w;return this}offset(w){if(this.config.setOperators.length>0)this.config.setOperators.at(-1).offset=w;else this.config.offset=w;return this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:w,...$}=this.dialect.sqlToQuery(this.getSQL());return $}as(w){let $=[];if($.push(...d4(this.config.table)),this.config.joins)for(let f of this.config.joins)$.push(...d4(f.table));return new Proxy(new a2(this.getSQL(),this.config.fields,w,!1,[...new Set($)]),new H5({alias:w,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new H5({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}};aV=class aV extends oV{static[K0]="SQLiteSelect";_prepare(w=!0){if(!this.session)throw Error("Cannot execute a query on a query builder. Please use a database instance instead.");let $=B9(this.config.fields),f=this.session[w?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),$,"all",!0,void 0,{type:"select",tables:[...this.usedTables]},this.cacheConfig);return f.joinsNotNullableMap=this.joinsNotNullableMap,f}$withCache(w){return this.cacheConfig=w===void 0?{config:{},enable:!0,autoInvalidate:!0}:w===!1?{enable:!1}:{enable:!0,autoInvalidate:!0,...w},this}prepare(){return this._prepare(!1)}run=(w)=>{return this._prepare().run(w)};all=(w)=>{return this._prepare().all(w)};get=(w)=>{return this._prepare().get(w)};values=(w)=>{return this._prepare().values(w)};async execute(){return this.all()}};pB(aV,[J7]);Kc=kX("union",!1),hc=kX("union",!0),Fc=kX("intersect",!1),Oc=kX("except",!1)});var tV=()=>{};var eV=()=>{};var Qc;var wz=C(()=>{V1();RX();NA();G7();j6();c3();i3();I6();PX();iV();Qc=class Qc extends J7{constructor(w,$,f,X,W){super();this.session=f,this.dialect=X,this.config={set:$,table:w,withList:W,joins:[]}}static[K0]="SQLiteUpdate";config;from(w){return this.config.from=w,this}createJoin(w){return($,f)=>{let X=W7($);if(typeof X==="string"&&this.config.joins.some((W)=>W.alias===X))throw Error(`Alias "${X}" is already used in this query`);if(typeof f==="function"){let W=this.config.from?c0($,z3)?$[w1.Symbol.Columns]:c0($,a2)?$._.selectedFields:c0($,IA)?$[w2].selectedFields:void 0:void 0;f=f(new Proxy(this.config.table[w1.Symbol.Columns],new H5({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),W&&new Proxy(W,new H5({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}return this.config.joins.push({on:f,table:$,joinType:w,alias:X}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(w){return this.config.where=w,this}orderBy(...w){if(typeof w[0]==="function"){let $=w[0](new Proxy(this.config.table[w1.Symbol.Columns],new H5({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),f=Array.isArray($)?$:[$];this.config.orderBy=f}else{let $=w;this.config.orderBy=$}return this}limit(w){return this.config.limit=w,this}returning(w=this.config.table[z3.Symbol.Columns]){return this.config.returning=B9(w),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){let{typings:w,...$}=this.dialect.sqlToQuery(this.getSQL());return $}_prepare(w=!0){return this.session[w?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:d4(this.config.table)})}prepare(){return this._prepare(!1)}run=(w)=>{return this._prepare().run(w)};all=(w)=>{return this._prepare().all(w)};get=(w)=>{return this._prepare().get(w)};values=(w)=>{return this._prepare().values(w)};async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}});var $z=C(()=>{gV();eV();tV();sV();wz()});var fz=()=>{};var Xz=()=>{};var Wz=()=>{};var Yz=()=>{};var V9=C(()=>{Xz();bV();cV();fz();dV();DA();CV();yV();$z();Wz();G7();vA();PX();Yz()});var Jz;var CA=C(()=>{V9();c4();Jz=R3("job_queue",{id:a0("id").primaryKey().$defaultFn(()=>T6()),type:a0("type").notNull(),data:a0("data").notNull(),result:a0("result",{mode:"json"}),source:a0("source"),metadata:a0("metadata",{mode:"json"}).$type().notNull(),status:a0("status",{enum:["pending","processing","completed","failed"]}).notNull().default("pending"),priority:s2("priority").notNull().default(0),retryCount:s2("retryCount").notNull().default(0),maxRetries:s2("maxRetries").notNull().default(3),lastError:a0("lastError"),createdAt:s2("createdAt").notNull().$defaultFn(()=>Date.now()),scheduledFor:s2("scheduledFor").notNull().$defaultFn(()=>Date.now()),startedAt:s2("startedAt"),completedAt:s2("completedAt")},(w)=>({queueReadyIdx:n5("idx_job_queue_ready").on(w.status,w.priority,w.scheduledFor),jobTypeIdx:n5("idx_job_queue_type").on(w.type,w.status),jobSourceIdx:n5("idx_job_queue_source").on(w.source)}))});import{createClient as MR0}from"@libsql/client";var Gz=C(()=>{CA()});var Az=C(()=>{RA();hA();b6();V1();xV();cB();RX();oB();pV();j6();c3();i3();I6()});var Hz=C(()=>{CA();E6()});var Uz=C(()=>{E6()});var Kz=C(()=>{c4();Q9();E6();Gz();Hz();Uz()});var hz=C(()=>{E6();E6()});var Fz=C(()=>{E6()});var Oz=()=>{};class H7{logger;schema;jobTypeName;constructor(w,$){this.logger=w,this.schema=$.schema,this.jobTypeName=$.jobTypeName}validateAndParse(w){if(!this.schema)throw Error(`${this.jobTypeName}: No schema provided. Override validateAndParse() or provide a schema.`);try{let $=this.schema.parse(w);return this.logger.debug(`${this.jobTypeName} job data validation successful`,{data:this.summarizeDataForLog($)}),$}catch($){return this.logger.warn(`Invalid ${this.jobTypeName} job data`,{data:w,validationError:$ instanceof F.ZodError?$.issues:$}),null}}async onError(w,$,f,X){this.logger.error(`${this.jobTypeName} job error handler triggered`,{jobId:f,errorMessage:w.message,errorStack:w.stack,data:this.summarizeDataForLog($)})}async reportProgress(w,$){await w.report({progress:$.progress,total:$.total??100,message:$.message})}summarizeDataForLog(w){return w}}var Qz=C(()=>{Z0()});var Zc;var Zz=C(()=>{MX();Z0();Zc=F.object({id:F.string(),type:F.string(),data:F.string(),status:F.enum(["pending","processing","completed","failed"]),source:F.string().nullable(),priority:F.number(),retryCount:F.number(),maxRetries:F.number(),lastError:F.string().nullable(),createdAt:F.number(),scheduledFor:F.number(),startedAt:F.number().nullable(),completedAt:F.number().nullable(),metadata:w7,result:F.unknown().nullable().optional()})});function uA(w,$,f){return async(X)=>{let{type:W,data:Y,toolContext:J=null,options:G}=X,{metadata:A,...U}=G??{},K={source:$,...G?.rootJobId&&{rootJobId:G.rootJobId},...U,metadata:{operationType:"data_processing",pluginId:$,...J&&{interfaceType:J.interfaceType,channelId:J.channelId},...A}},h=f&&!W.includes(":")?`${$}:${W}`:W;return w.enqueue({type:h,data:Y,options:K})}}function yA(w,$){return async(f,X)=>{let W=T6(),Y=f.map((G)=>({...G,type:G.type.includes(":")?G.type:`${$}:${G.type}`})),J={...X,source:$,rootJobId:W,metadata:{...X?.metadata,operationType:"batch_processing",pluginId:$}};return await w.enqueueBatch(Y,J,W,$),W}}function gA(w,$){return(f,X)=>{let W=f.includes(":")?f:`${$}:${f}`;w.registerHandler(W,X,$)}}var Mz=C(()=>{c4()});var U7=C(()=>{Kz();hz();Fz();Oz();Qz();Zz();E6();MX();Mz()});function Bz(w){return Mc.safeParse(w).success}var Mc;var xA=C(()=>{Z0();Mc=F.object({name:F.string(),schema:F.custom((w)=>w instanceof F.ZodType)})});function Bc(w){if(!w)return;return{status:w.status,message:w.message,lastCheck:w.lastCheck?.toISOString(),details:w.details}}function Vz(w){return{model:w.model,version:w.version,uptime:w.uptime,entities:w.entities,entityCounts:w.entityCounts,embeddings:w.embeddings,ai:w.ai,daemons:w.daemons.map(($)=>({name:$.name,pluginId:$.pluginId,status:$.status,health:Bc($.health)})),endpoints:w.endpoints,interactions:w.interactions}}var K7;var mA=C(()=>{G2();K7=F.record(F.unknown())});var Vc,zc;var lA=C(()=>{G2();i5();mA();Vc=F.object({id:F.string(),sessionId:F.string(),interfaceType:F.string(),channelId:F.string(),channelName:F.string().optional(),startedAt:F.string(),lastActiveAt:F.string(),createdAt:F.string(),updatedAt:F.string(),metadata:K7}),zc=F.object({id:F.string(),conversationId:F.string(),role:m4,content:F.string(),timestamp:F.string(),metadata:K7})});function zz(w){if(!w)return{};try{let $=JSON.parse(w);if($&&typeof $==="object"&&!Array.isArray($))return $}catch{}return{}}function Rc(w){let $=m4.safeParse(w);return $.success?$.data:"user"}function LX(w){let $=zz(w.metadata),f=typeof $.channelName==="string"?$.channelName:void 0;return{id:w.id,sessionId:w.sessionId,interfaceType:w.interfaceType,channelId:w.channelId,channelName:f,startedAt:w.started,lastActiveAt:w.lastActive,createdAt:w.created,updatedAt:w.updated,metadata:$}}function Rz(w){return{id:w.id,conversationId:w.conversationId,role:Rc(w.role),content:w.content,timestamp:w.timestamp,metadata:zz(w.metadata)}}var Nz=C(()=>{lA()});var rA,pA;var cA=C(()=>{G2();rA=F.object({name:F.string(),role:F.string(),purpose:F.string(),values:F.array(F.string())}),pA=F.object({name:F.string(),kind:F.enum(["professional","team","collective"]),organization:F.string().optional(),description:F.string().optional(),avatar:F.string().optional(),website:F.string().optional(),email:F.string().optional(),socialLinks:F.array(F.object({platform:F.enum(["github","instagram","linkedin","email","website"]),url:F.string(),label:F.string().optional()})).optional()})});function qz(w){return rA.parse(w)}function Dz(w){return pA.parse(w)}var vz=C(()=>{cA()});function Pz(w){return async()=>{return Vz(await w.getAppInfo())}}function kz(w,$){return{get:()=>qz(w.getIdentity()),getProfile:()=>Dz(w.getProfile()),getAppInfo:$}}function Lz(w,$,f){let X=w.getMessageBus();return{send:async(Y)=>{return X.send({...Y,sender:$})},subscribe:(Y,J)=>{if(Bz(Y)){let G=Y,A=J,U=async(K)=>{let h=G.schema.safeParse(K.payload);if(!h.success)return f.warn(`Invalid payload for channel ${G.name}`,{error:h.error.message}),{noop:!0};let{payload:O,...Z}=K;return A(h.data,Z)};return X.subscribe(G.name,U)}return X.subscribe(Y,J)}}}function _z(w,$){let f=w.getJobQueueService();return{...w.jobs,enqueue:uA(f,$,!0),enqueueBatch:yA(w.jobs,$),registerHandler:gA(f,$)}}function Tz(w){let $=w.getPermissionService();return{assertEntityActionAllowed:(f,X,W)=>{$.assertEntityActionAllowed(f,X,W.userPermissionLevel)}}}function Ez(w){return{get:async($)=>{let X=await w.getConversationService().getConversation($);return X?LX(X):null},search:async($)=>{return(await w.getConversationService().searchConversations($)).map(LX)},list:async($)=>{return(await w.getConversationService().listConversations($)).map(LX)},getMessages:async($,f)=>{return(await w.getConversationService().getMessages($,f)).map(Rz)},countMessages:async($)=>{return w.getConversationService().countMessages($)}}}function bz(w,$){return{registerHandler:(f,X)=>{w.registerEvalHandler($,f,X)}}}function jz(w){return{register:($,f)=>{w.getInsightsRegistry().register($,f)}}}function Iz(w,$){return{register:(f)=>{w.registerEndpoint({...f,pluginId:$})}}}function Sz(w,$){return{register:(f)=>{w.registerInteraction({...f,pluginId:$})}}}var Cz=C(()=>{U7();xA();Nz();vz()});function z9(w,$,f){let X=w.getEntityService(),W=w.getLogger().child($),Y=w.getDomain(),J=w.getLocalSiteUrl(),G=w.shouldPreferLocalUrls(),A=w.getThemeCSS(),U=Pz(w),K=w.getAttachmentRegistry(),h=w.getRuntimeUploadRegistry(),O=w.getRuntimeState();return{pluginId:$,logger:W,entityService:X,identity:kz(w,U),appInfo:U,judge:(Z)=>w.judge(Z),domain:Y,siteUrl:Y?`https://${Y}`:void 0,localSiteUrl:J,previewUrl:Y?`https://${AA(Y)}`:void 0,preferLocalUrls:G,themeCSS:A,entityDisplay:f?.entityDisplay,spaces:w.getSpaces(),permissions:Tz(w),messaging:Lz(w,$,W),jobs:_z(w,$),attachments:K,uploads:h,runtimeState:O,conversations:Ez(w),dataDir:w.getDataDir(),eval:bz(w,$),insights:jz(w),endpoints:Iz(w,$),interactions:Sz(w,$)}}var h7=C(()=>{r4();Cz()});var _X;var F7=C(()=>{Az();V9();_X=R3("entities",{id:a0("id").notNull(),entityType:a0("entityType").notNull(),content:a0("content").notNull(),contentHash:a0("contentHash").notNull(),visibility:a0("visibility",{enum:["public","shared","restricted"]}).notNull().default("public"),metadata:a0("metadata",{mode:"json"}).$type().notNull().default(i4`'{}'`),created:s2("created").notNull().$defaultFn(()=>Date.now()),updated:s2("updated").notNull().$defaultFn(()=>Date.now())},(w)=>{return{pk:vX({columns:[w.id,w.entityType]}),visibilityCheck:EV("entities_visibility_check",i4`${w.visibility} IN ('public', 'shared', 'restricted')`)}})});import{createClient as Xq0}from"@libsql/client";var uz=C(()=>{F7()});var yz;var gz=C(()=>{V9();yz=NX({dataType(){return"F32_BLOB(1536)"},toDriver(w){return Buffer.from(w.buffer)},fromDriver(w){return new Float32Array(w.buffer,w.byteOffset,w.byteLength/4)}})});var TX;var O7=C(()=>{V9();gz();TX=R3("embeddings",{entityId:a0("entity_id").notNull(),entityType:a0("entity_type").notNull(),embedding:yz("embedding").notNull(),contentHash:a0("content_hash").notNull()},(w)=>{return{pk:vX({columns:[w.entityId,w.entityType]})}})});import{createClient as hq0}from"@libsql/client";var iA=C(()=>{O7()});var Nc,u6;var dA=C(()=>{Z0();Nc=F.enum(["public","shared","restricted"]),u6=F.union([Nc,F.literal("private")]).optional().transform((w)=>{if(w===void 0)return"public";if(w==="private")return"restricted";return w})});var C2,Dc;var y6=C(()=>{Z0();dA();dA();C2=F.object({id:F.string(),entityType:F.string(),content:F.string(),created:F.string().datetime(),updated:F.string().datetime(),visibility:u6,metadata:F.record(F.string(),F.unknown()),contentHash:F.string()}),Dc=F.object({mediaType:F.string(),url:F.string(),downloadUrl:F.string().optional(),previewUrl:F.string().optional(),filename:F.string().optional(),sizeBytes:F.number().optional(),source:F.object({entityType:F.string().optional(),entityId:F.string().optional(),attachmentType:F.string().optional()}).optional()})});var aA=C(()=>{y6()});function n4(w){return"restricted"}var kq0;var sA=C(()=>{Z0();Q9();kq0=F.object({id:F.string().min(1,"Entity ID is required"),entityType:F.string().min(1,"Entity type is required"),contentHash:F.string().min(1,"Content hash is required"),operation:F.enum(["create","update"])})});var bq0;var lz=C(()=>{y6();Z0();F7();bq0=F.object({limit:F.number().int().positive().optional().default(20),offset:F.number().int().min(0).optional().default(0),types:F.array(F.string()).optional().default([]),excludeTypes:F.array(F.string()).optional().default([]),weight:F.record(F.string(),F.number()).optional(),visibilityScope:F.enum(["public","shared","restricted"]).optional(),includeUngenerated:F.boolean().optional().default(!1),minScore:F.number().min(0).optional()})});var Q7=p((Iq0,pz)=>{var vc=Object.prototype.toString;pz.exports=function($){if($===void 0)return"undefined";if($===null)return"null";var f=typeof $;if(f==="boolean")return"boolean";if(f==="string")return"string";if(f==="number")return"number";if(f==="symbol")return"symbol";if(f==="function")return Tc($)?"generatorfunction":"function";if(Pc($))return"array";if(jc($))return"buffer";if(bc($))return"arguments";if(Lc($))return"date";if(kc($))return"error";if(_c($))return"regexp";switch(rz($)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(Ec($))return"generator";switch(f=vc.call($),f){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return f.slice(8,-1).toLowerCase().replace(/\s/g,"")};function rz(w){return typeof w.constructor==="function"?w.constructor.name:null}function Pc(w){if(Array.isArray)return Array.isArray(w);return w instanceof Array}function kc(w){return w instanceof Error||typeof w.message==="string"&&w.constructor&&typeof w.constructor.stackTraceLimit==="number"}function Lc(w){if(w instanceof Date)return!0;return typeof w.toDateString==="function"&&typeof w.getDate==="function"&&typeof w.setDate==="function"}function _c(w){if(w instanceof RegExp)return!0;return typeof w.flags==="string"&&typeof w.ignoreCase==="boolean"&&typeof w.multiline==="boolean"&&typeof w.global==="boolean"}function Tc(w,$){return rz(w)==="GeneratorFunction"}function Ec(w){return typeof w.throw==="function"&&typeof w.return==="function"&&typeof w.next==="function"}function bc(w){try{if(typeof w.length==="number"&&typeof w.callee==="function")return!0}catch($){if($.message.indexOf("callee")!==-1)return!0}return!1}function jc(w){if(w.constructor&&typeof w.constructor.isBuffer==="function")return w.constructor.isBuffer(w);return!1}});var iz=p((Sq0,cz)=>{/*!
|
|
4
4
|
* is-extendable <https://github.com/jonschlinkert/is-extendable>
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2015, Jon Schlinkert.
|
|
@@ -1458,7 +1458,7 @@ ${$.join(`
|
|
|
1458
1458
|
letter-spacing: 0.02em;
|
|
1459
1459
|
}
|
|
1460
1460
|
.printable-footer a { color: inherit; text-decoration: none; overflow-wrap: anywhere; }
|
|
1461
|
-
`}},void 0,!1,void 0,this),E2("header",{className:"printable-hero",children:[E2("div",{className:"printable-masthead",children:$.brandLabel&&E2("p",{className:"printable-kicker",children:$.brandLabel},void 0,!1,void 0,this)},void 0,!1,void 0,this),E2("div",{children:[E2("h1",{className:"printable-title",children:$.title},void 0,!1,void 0,this),$.excerpt&&E2("p",{className:"printable-excerpt",children:$.excerpt},void 0,!1,void 0,this),E2("div",{className:"printable-meta",children:[$.author&&E2("span",{children:["By ",$.author]},void 0,!0,void 0,this),f&&E2("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&&E2("figure",{className:"printable-cover-wrap",children:E2("img",{className:"printable-cover",src:$.coverImageUrl,alt:""},void 0,!1,void 0,this)},void 0,!1,void 0,this),E2(A6,{markdown:$.body,className:"printable-body"},void 0,!1,void 0,this),(Boolean($.canonicalUrl)||Boolean($.brandLabel))&&E2("footer",{className:"printable-footer",children:[E2("span",{children:$.brandLabel??"Printable PDF"},void 0,!1,void 0,this),$.canonicalUrl&&E2("a",{href:$.canonicalUrl,children:$.canonicalUrl},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var DU0=26214400,vU0=60000;class OQ{context;metadata={outputEntityType:"document"};renderPdf;constructor(w,$={}){this.context=w;this.renderPdf=$.renderPdf??j$}async resolve(w){if(w.sourceEntityType!=="post"||w.attachmentType!==wG)return;let $=await this.context.entityService.getEntity({entityType:"post",id:w.sourceEntityId});if(!$)return;let f=PU0($,{brandLabel:this.resolveBrandLabel(),coverImageUrl:await this.resolveCoverImageUrl($)}),X=await zU0(qU0(NU0(),"brain-blog-printable-"));try{let W=await B6({outputDir:X,mediaPath:`/_media/printable/post/${$.id}`,template:Ux,format:"pdf",content:f,siteConfig:{title:f.title,themeMode:"light"},themeCSS:this.context.themeCSS}),Y=await V6({rootDir:X});try{return{type:"document",data:await this.renderPdf(Y.urlFor(W.urlPath),{maxBytes:DU0,timeoutMs:vU0,printBackground:!0,preferCSSPageSize:!0}),mimeType:"application/pdf",filename:`${kU0($)}-printable.pdf`}}finally{await Y.close()}}finally{await RU0(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:$}=K5(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 PU0(w,$={}){let{frontmatter:f,content:X}=K5(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 kU0(w){let $=w.metadata.slug;return $.length>0?$:e1(w.metadata.title)}import{mkdtemp as bU0,rm as jU0}from"fs/promises";import{tmpdir as IU0}from"os";import{join as SU0}from"path";o6();G5();R5();Z0();import{jsxDEV as EU0}from"preact/jsx-dev-runtime";var Mf="og-image",LU0="blog:og-image",Kx=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()}),hx={name:LU0,pluginId:"blog",schema:Kx,renderers:{image:TU0}};function _U0(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 TU0(w){let $=Kx.parse(w);return EU0(v$,{brandLabel:$.brandLabel??$.title,eyebrow:"Journal",title:$.title,subtitle:$.excerpt,meta:[$.author],tag:_U0($.publishedAt)},void 0,!1,void 0,this)}var CU0={width:1200,height:630},uU0=60000;class QQ{context;metadata={outputEntityType:"image",targetField:"ogImageId"};screenshotPng;constructor(w,$={}){this.context=w;this.screenshotPng=$.screenshotPng??b$}async resolve(w){if(w.sourceEntityType!=="post"||w.attachmentType!==Mf)return;let $=await this.context.entityService.getEntity({entityType:"post",id:w.sourceEntityId});if(!$)return;let f=yU0($,{brandLabel:this.resolveBrandLabel(),coverImageUrl:await this.resolveCoverImageUrl($)}),X=await bU0(SU0(IU0(),"brain-blog-og-image-"));try{let W=await B6({outputDir:X,mediaPath:`/_media/og/post/${$.id}`,template:hx,format:"image",content:f,siteConfig:{title:f.title,themeMode:"light"},themeCSS:this.context.themeCSS}),Y=await V6({rootDir:X});try{return{type:"image",data:await this.screenshotPng(Y.urlFor(W.urlPath),CU0,{timeoutMs:uU0,fullPage:!1,omitBackground:!1}),mimeType:"image/png",filename:`${gU0($)}-og.png`}}finally{await Y.close()}}finally{await jU0(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:$}=K5(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 yU0(w,$={}){let{frontmatter:f}=K5(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 gU0(w){let $=w.metadata.slug;return $.length>0?$:e1(w.metadata.title)}var Fx={name:"@brains/blog",private:!0,version:"0.2.0-alpha.140",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,.tsx --max-warnings 0","lint:fix":"eslint . --ext .ts,.tsx --max-warnings 0 --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 Mx extends a6{entityType=s3.entityType;schema=d9;adapter=s3;unregisterAtprotoProjection;unregisterPrintableAttachmentProvider;unregisterOgImageAttachmentProvider;constructor(w={}){super("blog",Fx,w,qK)}getEntityTypeConfig(){return{weight:2,publish:{publishStatuses:["queued","published"]}}}createGenerationHandler(w){return new DK(this.logger.child("BlogGenerationJobHandler"),w)}getTemplates(){return $j()}getDataSources(){return[new PK(this.logger.child("BlogDataSource"))]}async onRegister(w){let{RSSDataSource:$}=await Promise.resolve().then(() => (Zx(),Qx));w.entities.registerDataSource(new $(this.logger.child("RSSDataSource"))),fj(w,this.logger),Xj(w,this.logger),Yj(w,this.logger),Jj(w),this.unregisterPrintableAttachmentProvider=w.attachments.register("post",wG,new OQ(w)),this.unregisterOgImageAttachmentProvider=w.attachments.register("post",Mf,new QQ(w)),this.deferPublishAssetRegistration(w),this.unregisterAtprotoProjection=e6.getInstance().register(_F()),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:Mf,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}}R5();n9();A1();r4();Z0();A1();r4();var Bx=F.object({}),$G=C2.extend({id:F.literal("site-info"),entityType:F.literal("site-info"),metadata:Bx}),Bf=OX,L8=ZX.omit({url:!0,analyticsScript:!0});A1();class z6 extends $5{constructor(){super({entityType:"site-info",purpose:"Singleton configuration describing the published site.",schema:$G,frontmatterSchema:L8,isSingleton:!0,hasBody:!1})}createSiteInfoContent(w){let $=L8.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 z21=new z6;var b21=new z6;var pU0=new z6;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 pU0.parseSiteInfoBody(f.content)}function Vx(w,$){let f=w.metadata.publishedAt??w.created,X=$.metadata.publishedAt??$.created;return new Date(X).getTime()-new Date(f).getTime()}async function _8(w,$){return(await w.listEntities({entityType:$.entityType,options:{limit:20}})).sort(Vx).slice(0,$.count).map($.parse)}function Vf(w){if(!w)throw Error("CTA not configured in site-info");return w}Z0();var cU0=L8.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 fG=u7,N4=q3.extend(fG.shape);A1();class XG{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,N4),_8(X,{entityType:"post",count:6,parse:Uw}),xw(X)]),G={profile:W,posts:Y,postsListUrl:this.postsListUrl,cta:Vf(J.cta)};return $.parse(G)}}A1();class WG{id="personal:about";name="About Page DataSource";description="Fetches full profile data for the about page";async fetch(w,$,f){let W={profile:await D3(f.entityService,N4)};return $.parse(W)}}import{jsxDEV as W1,Fragment as zx}from"preact/jsx-dev-runtime";function iU0(w){return new Date(w).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function dU0(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 ZQ=({profile:w,posts:$,postsListUrl:f,cta:X})=>{let W=w.tagline??w.description,Y=w.name.split(" ")[0];return W1(zx,{children:[W1(f2,{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:dU0(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(zx,{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:iU0(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 b2,Fragment as nU0}from"preact/jsx-dev-runtime";var MQ=({profile:w})=>{let $=`About ${w.name}`,f=w.description??w.intro??"About page",X=Boolean(w.email??w.website);return b2(nU0,{children:[b2(f2,{title:$,description:f,ogType:"profile"},void 0,!1,void 0,this),b2("section",{className:"hero-decor bg-brand text-theme-inverse relative flex flex-col px-6 md:px-12 pt-32 pb-24",children:b2("div",{className:"w-full max-w-3xl mx-auto flex flex-col gap-6",children:[b2("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&&b2("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&&b2("section",{className:`py-24 px-6 md:px-12 bg-theme-subtle${X?"":" flex-grow"}`,children:b2("div",{className:"max-w-3xl mx-auto",children:b2(A6,{markdown:w.story},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),X&&b2("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:[b2("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),b2("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"," ",b2("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),b2("div",{className:"flex flex-wrap justify-center gap-3.5 mt-2",children:[w.email&&b2("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 ",b2("span",{"aria-hidden":"true",children:"\u2192"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w.website&&b2("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 Rx={name:"@brains/site-personal",private:!0,version:"0.2.0-alpha.140",description:"Personal site composition package",type:"module",exports:{".":"./src/index.ts"},files:["src"],scripts:{typecheck:"tsc --noEmit",lint:"eslint . --ext .ts,.tsx --max-warnings 0","lint:fix":"eslint . --ext .ts,.tsx --max-warnings 0 --fix"},dependencies:{"@brains/blog":"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 aU0=F.object({entityDisplay:F.object({post:F.object({label:F.string().default("Post"),pluralName:F.string().optional()}).default({})}).default({})});class BQ extends l9{dependencies=["blog"];constructor(w={}){super("personal-site",Rx,w,aU0)}async onRegister(w){w.entities.extendFrontmatterSchema("anchor-profile",fG);let $=this.config.entityDisplay.post,f=`/${$.pluralName??$.label.toLowerCase()+"s"}`,X=new XG(f);w.entities.registerDataSource(X);let W=new WG;w.entities.registerDataSource(W);let Y=F.object({profile:N4,posts:F.array(s5),postsListUrl:F.string(),cta:Bf}),J=F.object({profile:N4});w.templates.register({homepage:E1({name:"homepage",description:"Personal homepage with recent blog posts",schema:Y,dataSourceId:"personal:homepage",requiredPermission:"public",layout:{component:ZQ}}),about:E1({name:"about",description:"About page with profile",schema:J,dataSourceId:"personal:about",requiredPermission:"public",layout:{component:MQ}})}),this.logger.info("Personal site plugin registered successfully")}async getTools(){return[]}async getResources(){return[]}}function VQ(w){return new BQ(w??{})}var zQ=[{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 _5}from"preact/jsx-dev-runtime";function RQ({sections:w,siteInfo:$}){let f=[...$.navigation.primary,...$.navigation.secondary].filter((X)=>X.label!=="Home");return _5("div",{className:"flex flex-col min-h-screen bg-theme overflow-x-clip",children:[_5(D$,{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),_5("main",{className:"flex-grow flex flex-col",children:w},void 0,!1,void 0,this),_5("footer",{className:"bg-footer text-footer border-t border-theme",children:_5("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:[_5("div",{className:"flex flex-col gap-1 mb-4 md:mb-0",children:[_5("span",{className:"text-brand font-heading font-bold text-lg",children:$.title},void 0,!1,void 0,this),$.description&&_5("span",{className:"text-theme-muted text-xs",children:$.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_5("nav",{className:"flex flex-wrap justify-center gap-x-6 gap-y-2 mb-4 md:mb-0",children:f.map((X)=>_5("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),_5("div",{className:"flex items-center gap-4",children:[$.copyright&&_5("span",{className:"text-theme-light text-[11px]",children:$.copyright},void 0,!1,void 0,this),_5(f4,{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();Z0();j5();A1();Z0();A1();G5();Z0();A1();var sU0=F.enum(["generating","draft","queued","published","failed"]),Nx="publishedAt is required when deck status is published",qx=(w)=>w.status==="published"&&!w.publishedAt,NQ=(w)=>{if(qx(w))throw Error(Nx)},g5=F.object({title:F.string(),slug:F.string().optional(),description:F.string().optional(),author:F.string().optional(),status:sU0,publishedAt:F.string().datetime().optional(),event:F.string().optional(),coverImageId:F.string().optional(),ogImageId:F.string().optional()}),tU0=g5.pick({title:!0,description:!0,status:!0,publishedAt:!0,coverImageId:!0}).extend({slug:F.string(),error:F.string().optional()}).superRefine((w,$)=>{if(!qx(w))return;$.addIssue({code:F.ZodIssueCode.custom,path:["publishedAt"],message:Nx})}),T8=C2.extend({entityType:F.literal("deck"),metadata:tU0}),YG=T8.extend({frontmatter:g5,body:F.string(),ogImageUrl:F.string().optional()}),mw=YG.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 qQ extends $5{constructor(){super({entityType:"deck",purpose:"A slide-deck presentation.",schema:T8,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);NQ(f);let X={...f,slug:f.slug??w.metadata.slug};return this.buildMarkdown($,X)}fromMarkdown(w){let $=this.parseFrontmatter(w),f=this.extractBody(w);NQ($),this.validateSlideStructure(f);let X=$.slug??e1($.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(`---
|
|
1461
|
+
`}},void 0,!1,void 0,this),E2("header",{className:"printable-hero",children:[E2("div",{className:"printable-masthead",children:$.brandLabel&&E2("p",{className:"printable-kicker",children:$.brandLabel},void 0,!1,void 0,this)},void 0,!1,void 0,this),E2("div",{children:[E2("h1",{className:"printable-title",children:$.title},void 0,!1,void 0,this),$.excerpt&&E2("p",{className:"printable-excerpt",children:$.excerpt},void 0,!1,void 0,this),E2("div",{className:"printable-meta",children:[$.author&&E2("span",{children:["By ",$.author]},void 0,!0,void 0,this),f&&E2("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&&E2("figure",{className:"printable-cover-wrap",children:E2("img",{className:"printable-cover",src:$.coverImageUrl,alt:""},void 0,!1,void 0,this)},void 0,!1,void 0,this),E2(A6,{markdown:$.body,className:"printable-body"},void 0,!1,void 0,this),(Boolean($.canonicalUrl)||Boolean($.brandLabel))&&E2("footer",{className:"printable-footer",children:[E2("span",{children:$.brandLabel??"Printable PDF"},void 0,!1,void 0,this),$.canonicalUrl&&E2("a",{href:$.canonicalUrl,children:$.canonicalUrl},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var DU0=26214400,vU0=60000;class OQ{context;metadata={outputEntityType:"document"};renderPdf;constructor(w,$={}){this.context=w;this.renderPdf=$.renderPdf??j$}async resolve(w){if(w.sourceEntityType!=="post"||w.attachmentType!==wG)return;let $=await this.context.entityService.getEntity({entityType:"post",id:w.sourceEntityId});if(!$)return;let f=PU0($,{brandLabel:this.resolveBrandLabel(),coverImageUrl:await this.resolveCoverImageUrl($)}),X=await zU0(qU0(NU0(),"brain-blog-printable-"));try{let W=await B6({outputDir:X,mediaPath:`/_media/printable/post/${$.id}`,template:Ux,format:"pdf",content:f,siteConfig:{title:f.title,themeMode:"light"},themeCSS:this.context.themeCSS}),Y=await V6({rootDir:X});try{return{type:"document",data:await this.renderPdf(Y.urlFor(W.urlPath),{maxBytes:DU0,timeoutMs:vU0,printBackground:!0,preferCSSPageSize:!0}),mimeType:"application/pdf",filename:`${kU0($)}-printable.pdf`}}finally{await Y.close()}}finally{await RU0(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:$}=K5(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 PU0(w,$={}){let{frontmatter:f,content:X}=K5(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 kU0(w){let $=w.metadata.slug;return $.length>0?$:e1(w.metadata.title)}import{mkdtemp as bU0,rm as jU0}from"fs/promises";import{tmpdir as IU0}from"os";import{join as SU0}from"path";o6();G5();R5();Z0();import{jsxDEV as EU0}from"preact/jsx-dev-runtime";var Mf="og-image",LU0="blog:og-image",Kx=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()}),hx={name:LU0,pluginId:"blog",schema:Kx,renderers:{image:TU0}};function _U0(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 TU0(w){let $=Kx.parse(w);return EU0(v$,{brandLabel:$.brandLabel??$.title,eyebrow:"Journal",title:$.title,subtitle:$.excerpt,meta:[$.author],tag:_U0($.publishedAt)},void 0,!1,void 0,this)}var CU0={width:1200,height:630},uU0=60000;class QQ{context;metadata={outputEntityType:"image",targetField:"ogImageId"};screenshotPng;constructor(w,$={}){this.context=w;this.screenshotPng=$.screenshotPng??b$}async resolve(w){if(w.sourceEntityType!=="post"||w.attachmentType!==Mf)return;let $=await this.context.entityService.getEntity({entityType:"post",id:w.sourceEntityId});if(!$)return;let f=yU0($,{brandLabel:this.resolveBrandLabel(),coverImageUrl:await this.resolveCoverImageUrl($)}),X=await bU0(SU0(IU0(),"brain-blog-og-image-"));try{let W=await B6({outputDir:X,mediaPath:`/_media/og/post/${$.id}`,template:hx,format:"image",content:f,siteConfig:{title:f.title,themeMode:"light"},themeCSS:this.context.themeCSS}),Y=await V6({rootDir:X});try{return{type:"image",data:await this.screenshotPng(Y.urlFor(W.urlPath),CU0,{timeoutMs:uU0,fullPage:!1,omitBackground:!1}),mimeType:"image/png",filename:`${gU0($)}-og.png`}}finally{await Y.close()}}finally{await jU0(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:$}=K5(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 yU0(w,$={}){let{frontmatter:f}=K5(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 gU0(w){let $=w.metadata.slug;return $.length>0?$:e1(w.metadata.title)}var Fx={name:"@brains/blog",private:!0,version:"0.2.0-alpha.141",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,.tsx --max-warnings 0","lint:fix":"eslint . --ext .ts,.tsx --max-warnings 0 --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 Mx extends a6{entityType=s3.entityType;schema=d9;adapter=s3;unregisterAtprotoProjection;unregisterPrintableAttachmentProvider;unregisterOgImageAttachmentProvider;constructor(w={}){super("blog",Fx,w,qK)}getEntityTypeConfig(){return{weight:2,publish:{publishStatuses:["queued","published"]}}}createGenerationHandler(w){return new DK(this.logger.child("BlogGenerationJobHandler"),w)}getTemplates(){return $j()}getDataSources(){return[new PK(this.logger.child("BlogDataSource"))]}async onRegister(w){let{RSSDataSource:$}=await Promise.resolve().then(() => (Zx(),Qx));w.entities.registerDataSource(new $(this.logger.child("RSSDataSource"))),fj(w,this.logger),Xj(w,this.logger),Yj(w,this.logger),Jj(w),this.unregisterPrintableAttachmentProvider=w.attachments.register("post",wG,new OQ(w)),this.unregisterOgImageAttachmentProvider=w.attachments.register("post",Mf,new QQ(w)),this.deferPublishAssetRegistration(w),this.unregisterAtprotoProjection=e6.getInstance().register(_F()),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:Mf,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}}R5();n9();A1();r4();Z0();A1();r4();var Bx=F.object({}),$G=C2.extend({id:F.literal("site-info"),entityType:F.literal("site-info"),metadata:Bx}),Bf=OX,L8=ZX.omit({url:!0,analyticsScript:!0});A1();class z6 extends $5{constructor(){super({entityType:"site-info",purpose:"Singleton configuration describing the published site.",schema:$G,frontmatterSchema:L8,isSingleton:!0,hasBody:!1})}createSiteInfoContent(w){let $=L8.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 z21=new z6;var b21=new z6;var pU0=new z6;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 pU0.parseSiteInfoBody(f.content)}function Vx(w,$){let f=w.metadata.publishedAt??w.created,X=$.metadata.publishedAt??$.created;return new Date(X).getTime()-new Date(f).getTime()}async function _8(w,$){return(await w.listEntities({entityType:$.entityType,options:{limit:20}})).sort(Vx).slice(0,$.count).map($.parse)}function Vf(w){if(!w)throw Error("CTA not configured in site-info");return w}Z0();var cU0=L8.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 fG=u7,N4=q3.extend(fG.shape);A1();class XG{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,N4),_8(X,{entityType:"post",count:6,parse:Uw}),xw(X)]),G={profile:W,posts:Y,postsListUrl:this.postsListUrl,cta:Vf(J.cta)};return $.parse(G)}}A1();class WG{id="personal:about";name="About Page DataSource";description="Fetches full profile data for the about page";async fetch(w,$,f){let W={profile:await D3(f.entityService,N4)};return $.parse(W)}}import{jsxDEV as W1,Fragment as zx}from"preact/jsx-dev-runtime";function iU0(w){return new Date(w).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}function dU0(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 ZQ=({profile:w,posts:$,postsListUrl:f,cta:X})=>{let W=w.tagline??w.description,Y=w.name.split(" ")[0];return W1(zx,{children:[W1(f2,{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:dU0(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(zx,{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:iU0(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 b2,Fragment as nU0}from"preact/jsx-dev-runtime";var MQ=({profile:w})=>{let $=`About ${w.name}`,f=w.description??w.intro??"About page",X=Boolean(w.email??w.website);return b2(nU0,{children:[b2(f2,{title:$,description:f,ogType:"profile"},void 0,!1,void 0,this),b2("section",{className:"hero-decor bg-brand text-theme-inverse relative flex flex-col px-6 md:px-12 pt-32 pb-24",children:b2("div",{className:"w-full max-w-3xl mx-auto flex flex-col gap-6",children:[b2("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&&b2("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&&b2("section",{className:`py-24 px-6 md:px-12 bg-theme-subtle${X?"":" flex-grow"}`,children:b2("div",{className:"max-w-3xl mx-auto",children:b2(A6,{markdown:w.story},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),X&&b2("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:[b2("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),b2("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"," ",b2("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),b2("div",{className:"flex flex-wrap justify-center gap-3.5 mt-2",children:[w.email&&b2("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 ",b2("span",{"aria-hidden":"true",children:"\u2192"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),w.website&&b2("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 Rx={name:"@brains/site-personal",private:!0,version:"0.2.0-alpha.141",description:"Personal site composition package",type:"module",exports:{".":"./src/index.ts"},files:["src"],scripts:{typecheck:"tsc --noEmit",lint:"eslint . --ext .ts,.tsx --max-warnings 0","lint:fix":"eslint . --ext .ts,.tsx --max-warnings 0 --fix"},dependencies:{"@brains/blog":"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 aU0=F.object({entityDisplay:F.object({post:F.object({label:F.string().default("Post"),pluralName:F.string().optional()}).default({})}).default({})});class BQ extends l9{dependencies=["blog"];constructor(w={}){super("personal-site",Rx,w,aU0)}async onRegister(w){w.entities.extendFrontmatterSchema("anchor-profile",fG);let $=this.config.entityDisplay.post,f=`/${$.pluralName??$.label.toLowerCase()+"s"}`,X=new XG(f);w.entities.registerDataSource(X);let W=new WG;w.entities.registerDataSource(W);let Y=F.object({profile:N4,posts:F.array(s5),postsListUrl:F.string(),cta:Bf}),J=F.object({profile:N4});w.templates.register({homepage:E1({name:"homepage",description:"Personal homepage with recent blog posts",schema:Y,dataSourceId:"personal:homepage",requiredPermission:"public",layout:{component:ZQ}}),about:E1({name:"about",description:"About page with profile",schema:J,dataSourceId:"personal:about",requiredPermission:"public",layout:{component:MQ}})}),this.logger.info("Personal site plugin registered successfully")}async getTools(){return[]}async getResources(){return[]}}function VQ(w){return new BQ(w??{})}var zQ=[{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 _5}from"preact/jsx-dev-runtime";function RQ({sections:w,siteInfo:$}){let f=[...$.navigation.primary,...$.navigation.secondary].filter((X)=>X.label!=="Home");return _5("div",{className:"flex flex-col min-h-screen bg-theme overflow-x-clip",children:[_5(D$,{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),_5("main",{className:"flex-grow flex flex-col",children:w},void 0,!1,void 0,this),_5("footer",{className:"bg-footer text-footer border-t border-theme",children:_5("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:[_5("div",{className:"flex flex-col gap-1 mb-4 md:mb-0",children:[_5("span",{className:"text-brand font-heading font-bold text-lg",children:$.title},void 0,!1,void 0,this),$.description&&_5("span",{className:"text-theme-muted text-xs",children:$.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),_5("nav",{className:"flex flex-wrap justify-center gap-x-6 gap-y-2 mb-4 md:mb-0",children:f.map((X)=>_5("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),_5("div",{className:"flex items-center gap-4",children:[$.copyright&&_5("span",{className:"text-theme-light text-[11px]",children:$.copyright},void 0,!1,void 0,this),_5(f4,{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();Z0();j5();A1();Z0();A1();G5();Z0();A1();var sU0=F.enum(["generating","draft","queued","published","failed"]),Nx="publishedAt is required when deck status is published",qx=(w)=>w.status==="published"&&!w.publishedAt,NQ=(w)=>{if(qx(w))throw Error(Nx)},g5=F.object({title:F.string(),slug:F.string().optional(),description:F.string().optional(),author:F.string().optional(),status:sU0,publishedAt:F.string().datetime().optional(),event:F.string().optional(),coverImageId:F.string().optional(),ogImageId:F.string().optional()}),tU0=g5.pick({title:!0,description:!0,status:!0,publishedAt:!0,coverImageId:!0}).extend({slug:F.string(),error:F.string().optional()}).superRefine((w,$)=>{if(!qx(w))return;$.addIssue({code:F.ZodIssueCode.custom,path:["publishedAt"],message:Nx})}),T8=C2.extend({entityType:F.literal("deck"),metadata:tU0}),YG=T8.extend({frontmatter:g5,body:F.string(),ogImageUrl:F.string().optional()}),mw=YG.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 qQ extends $5{constructor(){super({entityType:"deck",purpose:"A slide-deck presentation.",schema:T8,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);NQ(f);let X={...f,slug:f.slug??w.metadata.slug};return this.buildMarkdown($,X)}fromMarkdown(w){let $=this.parseFrontmatter(w),f=this.extractBody(w);NQ($),this.validateSlideStructure(f);let X=$.slug??e1($.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(`---
|
|
1462
1462
|
`,$),metadata:{title:w.title,slug:w.id,status:"generating"}}}}var zf=new qQ;Z0();j5();var eU0=F.object({markdown:F.string().describe("Markdown content with slide separators (---)"),deck:mw.optional()}),DQ=E1({name:"deck-detail",description:"Render a presentation deck as Reveal.js slides",schema:eU0,dataSourceId:"decks:entities",requiredPermission:"public",layout:{component:KF,fullscreen:!0}});j5();Z0();var vQ=F.object({decks:F.array(YG)}),PQ=F.object({decks:F.array(mw),pageTitle:F.string().optional(),pageLabel:F.string().optional()});import{jsxDEV as kQ}from"preact/jsx-dev-runtime";var wK0="Presentations",LQ=({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 kQ("div",{className:"deck-list bg-theme",children:kQ("div",{className:"container mx-auto max-w-[1100px] px-6 py-16 md:px-12 md:py-24",children:kQ(P$,{label:$&&$!=="Decks"?$:wK0,items:f},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)};G2();var F31=F.object({message:F.string()});i5();i5();G2();qW();class JG{schema;config;processor=x9();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(`
|
|
1463
1463
|
`).trimEnd()+`
|
|
1464
1464
|
`}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((U,K)=>c2("section",{className:`deck-carousel-slide${K===0?" is-cover":""}`,children:[c2("header",{className:"deck-carousel-header",children:c2("span",{className:"deck-carousel-wordmark","aria-label":f??$,children:[c2("span",{className:"wm-primary",children:Y.primary},void 0,!1,void 0,this),Y.secondary!==void 0&&c2(SF0,{children:[c2("span",{className:"wm-dot",children:"."},void 0,!1,void 0,this),c2("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),c2("div",{className:"deck-carousel-body",children:c2("div",{className:"deck-carousel-content",dangerouslySetInnerHTML:{__html:A(U.markdown)}},void 0,!1,void 0,this)},void 0,!1,void 0,this),c2("footer",{className:"deck-carousel-footer",children:[c2("span",{className:"deck-carousel-footer-meta",children:X??$},void 0,!1,void 0,this),c2("span",{className:"deck-carousel-counter","aria-label":`Slide ${K+1} of ${J}`,children:[c2("span",{className:"deck-carousel-counter-current",children:String(K+1).padStart(2,"0")},void 0,!1,void 0,this)," / ",c2("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 CF0,rm as uF0}from"fs/promises";import{tmpdir as yF0}from"os";import{join as gF0}from"path";o6();G5();var xF0=26214400,mF0=60000,qm=20;class tQ{context;metadata={outputEntityType:"document"};renderPdf;getThemeMode;constructor(w,$={}){this.context=w;this.renderPdf=$.renderPdf??j$,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=lF0($,{brandLabel:this.resolveBrandLabel()});if(f.slides.length>qm)throw Error(`Refusing to render carousel with ${f.slides.length} slides; maxSlides=${qm}`);let X=await this.getThemeMode(),W=await CF0(gF0(yF0(),"brain-deck-carousel-"));try{let Y=await B6({outputDir:W,mediaPath:`/_media/carousel/${$.id}`,template:Nm,format:"pdf",content:f,siteConfig:{title:f.title,themeMode:X},themeCSS:this.context.themeCSS}),J=await V6({rootDir:W});try{return{type:"document",data:await this.renderPdf(J.urlFor(Y.urlPath),{maxBytes:xF0,timeoutMs:mF0,printBackground:!0,preferCSSPageSize:!0}),mimeType:"application/pdf",filename:`${rF0($)}-carousel.pdf`}}finally{await J.close()}}finally{await uF0(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 lF0(w,$={}){let{frontmatter:f,content:X}=K5(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 rF0(w){let $=w.metadata.slug;return $.length>0?$:e1(w.metadata.title)}Z0();import{jsxDEV as iF0}from"preact/jsx-dev-runtime";var ZG="og-image",pF0="decks:og-image",Dm=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:pF0,pluginId:"decks",schema:Dm,renderers:{image:cF0}};function cF0(w){let $=Dm.parse(w),f=$.slideCount?`${$.slideCount} slide${$.slideCount===1?"":"s"}`:void 0;return iF0(v$,{brandLabel:$.brandLabel??$.title,eyebrow:"Deck",title:$.title,subtitle:$.description,meta:[$.event],tag:f},void 0,!1,void 0,this)}o6();G5();class eQ{context;deps;metadata={outputEntityType:"image",targetField:"ogImageId"};constructor(w,$={}){this.context=w;this.deps=$}async resolve(w){if(w.sourceEntityType!=="deck"||w.attachmentType!==ZG)return;let $=await this.context.entityService.getEntity({entityType:"deck",id:w.sourceEntityId});if(!$)return;let{frontmatter:f,content:X}=K5($.content),W=g5.parse(f),Y=dF0(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 FQ({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:`${nF0($)}-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 dF0(w){return w.split(/^---$/gm).map(($)=>$.trim()).filter(($)=>$.length>0).length}function nF0(w){let $=w.metadata.slug;return $.length>0?$:e1(w.metadata.title)}A1();async function Pm({entity:w,config:$}){let f=T8.parse(w),X=P1(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 wZ(){return{entityType:"deck",collection:"ai.rizom.brain.deck",lexicon:f5["ai.rizom.brain.deck"],validate:!1,buildRecord:Pm}}var km={name:"@brains/decks",private:!0,version:"0.2.0-alpha.
|
|
1805
|
+
`}},void 0,!1,void 0,this),W.map((U,K)=>c2("section",{className:`deck-carousel-slide${K===0?" is-cover":""}`,children:[c2("header",{className:"deck-carousel-header",children:c2("span",{className:"deck-carousel-wordmark","aria-label":f??$,children:[c2("span",{className:"wm-primary",children:Y.primary},void 0,!1,void 0,this),Y.secondary!==void 0&&c2(SF0,{children:[c2("span",{className:"wm-dot",children:"."},void 0,!1,void 0,this),c2("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),c2("div",{className:"deck-carousel-body",children:c2("div",{className:"deck-carousel-content",dangerouslySetInnerHTML:{__html:A(U.markdown)}},void 0,!1,void 0,this)},void 0,!1,void 0,this),c2("footer",{className:"deck-carousel-footer",children:[c2("span",{className:"deck-carousel-footer-meta",children:X??$},void 0,!1,void 0,this),c2("span",{className:"deck-carousel-counter","aria-label":`Slide ${K+1} of ${J}`,children:[c2("span",{className:"deck-carousel-counter-current",children:String(K+1).padStart(2,"0")},void 0,!1,void 0,this)," / ",c2("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 CF0,rm as uF0}from"fs/promises";import{tmpdir as yF0}from"os";import{join as gF0}from"path";o6();G5();var xF0=26214400,mF0=60000,qm=20;class tQ{context;metadata={outputEntityType:"document"};renderPdf;getThemeMode;constructor(w,$={}){this.context=w;this.renderPdf=$.renderPdf??j$,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=lF0($,{brandLabel:this.resolveBrandLabel()});if(f.slides.length>qm)throw Error(`Refusing to render carousel with ${f.slides.length} slides; maxSlides=${qm}`);let X=await this.getThemeMode(),W=await CF0(gF0(yF0(),"brain-deck-carousel-"));try{let Y=await B6({outputDir:W,mediaPath:`/_media/carousel/${$.id}`,template:Nm,format:"pdf",content:f,siteConfig:{title:f.title,themeMode:X},themeCSS:this.context.themeCSS}),J=await V6({rootDir:W});try{return{type:"document",data:await this.renderPdf(J.urlFor(Y.urlPath),{maxBytes:xF0,timeoutMs:mF0,printBackground:!0,preferCSSPageSize:!0}),mimeType:"application/pdf",filename:`${rF0($)}-carousel.pdf`}}finally{await J.close()}}finally{await uF0(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 lF0(w,$={}){let{frontmatter:f,content:X}=K5(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 rF0(w){let $=w.metadata.slug;return $.length>0?$:e1(w.metadata.title)}Z0();import{jsxDEV as iF0}from"preact/jsx-dev-runtime";var ZG="og-image",pF0="decks:og-image",Dm=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:pF0,pluginId:"decks",schema:Dm,renderers:{image:cF0}};function cF0(w){let $=Dm.parse(w),f=$.slideCount?`${$.slideCount} slide${$.slideCount===1?"":"s"}`:void 0;return iF0(v$,{brandLabel:$.brandLabel??$.title,eyebrow:"Deck",title:$.title,subtitle:$.description,meta:[$.event],tag:f},void 0,!1,void 0,this)}o6();G5();class eQ{context;deps;metadata={outputEntityType:"image",targetField:"ogImageId"};constructor(w,$={}){this.context=w;this.deps=$}async resolve(w){if(w.sourceEntityType!=="deck"||w.attachmentType!==ZG)return;let $=await this.context.entityService.getEntity({entityType:"deck",id:w.sourceEntityId});if(!$)return;let{frontmatter:f,content:X}=K5($.content),W=g5.parse(f),Y=dF0(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 FQ({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:`${nF0($)}-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 dF0(w){return w.split(/^---$/gm).map(($)=>$.trim()).filter(($)=>$.length>0).length}function nF0(w){let $=w.metadata.slug;return $.length>0?$:e1(w.metadata.title)}A1();async function Pm({entity:w,config:$}){let f=T8.parse(w),X=P1(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 wZ(){return{entityType:"deck",collection:"ai.rizom.brain.deck",lexicon:f5["ai.rizom.brain.deck"],validate:!1,buildRecord:Pm}}var km={name:"@brains/decks",private:!0,version:"0.2.0-alpha.141",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,.tsx --max-warnings 0","lint:fix":"eslint . --ext .ts,.tsx --max-warnings 0 --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 Lm extends a6{deps;entityType=zf.entityType;schema=zf.schema;adapter=zf;unregisterCarouselAttachmentProvider;unregisterOgImageAttachmentProvider;unregisterAtprotoProjection;constructor(w={}){super("decks",km);this.deps=w}createGenerationHandler(w){return new sQ(this.logger.child("DeckGenerationJobHandler"),w)}getTemplates(){return{"deck-detail":DQ,"deck-list":cQ,generation:hm,description:Fm}}getDataSources(){return[new aQ(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=e6.getInstance().register(wZ()),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",zm,new tQ(w,$))}registerOgImageAttachmentProvider(w){this.unregisterOgImageAttachmentProvider=w.attachments.register("deck",ZG,new eQ(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"})})}}r4();A1();var P4=q3.extend(y7.shape);A1();class MG{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,P4),_8(X,{entityType:"post",count:3,parse:Uw}),_8(X,{entityType:"deck",count:3,parse:Pf}),xw(X)]),A={profile:W,posts:Y,decks:J,postsListUrl:this.postsListUrl,decksListUrl:this.decksListUrl,cta:Vf(G.cta),sections:G.sections??{}};return $.parse(A)}}A1();class BG{id="professional:about";name="About Page DataSource";description="Fetches full profile data for the about page";async fetch(w,$,f){let W={profile:await D3(f.entityService,P4)};return $.parse(W)}}import{jsxDEV as b1,Fragment as tF0}from"preact/jsx-dev-runtime";var aF0="grid md:grid-cols-[14rem_1px_1fr] gap-y-2 gap-x-0 md:gap-16 items-start",sF0="border-t md:border-t-0 md:border-l border-rule-strong md:self-stretch",$Z=({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:aF0,children:[b1(qF,{title:$,number:w,blurb:f},void 0,!1,void 0,this),b1("div",{className:sF0,"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),fZ=({profile:w,posts:$,decks:f,postsListUrl:X,decksListUrl:W,cta:Y,sections:J})=>{let G=w.tagline?.length?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})),U=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].find((Z)=>Z)??"Professional site",O=Boolean(w.description)||w.expertise!==void 0&&w.expertise.length>0;return b1(tF0,{children:[b1(f2,{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:yY(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:yY(w.intro,"italic text-accent")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),b1($Z,{number:"01",title:"Essays",blurb:J.essays?.blurb,children:b1(uY,{items:A,viewAllUrl:X,viewAllLabel:"View all essays"},void 0,!1,void 0,this)},void 0,!1,void 0,this),U.length>0&&b1($Z,{number:"02",title:"Presentations",blurb:J.presentations?.blurb,children:b1(uY,{items:U,viewAllUrl:W,viewAllLabel:"View all presentations"},void 0,!1,void 0,this)},void 0,!1,void 0,this),O&&b1($Z,{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(DF,{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(FF,{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 R1,Fragment as eF0}from"preact/jsx-dev-runtime";var XZ=({profile:w})=>{let $=`About ${w.name||"Me"}`,f=[w.description,w.intro].find((W)=>W)??"About page",X=w.expertise!==void 0&&w.expertise.length>0||Boolean(w.currentFocus)||Boolean(w.availability)||Boolean(w.email)||Boolean(w.website)||w.socialLinks!==void 0&&w.socialLinks.length>0;return R1(eF0,{children:[R1(f2,{title:$,description:f,ogType:"profile"},void 0,!1,void 0,this),R1("div",{className:"about-page bg-theme",children:[R1("header",{className:"hero-bg-pattern relative w-full py-16 md:py-24 px-6 md:px-12 bg-theme overflow-hidden",children:R1("div",{className:"relative z-10 max-w-4xl mx-auto",children:[R1("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&&R1("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),R1("div",{className:"container mx-auto px-6 md:px-12 max-w-4xl py-12 md:py-16",children:[w.story&&R1("section",{className:"content-section-reveal mb-20 md:mb-28",children:R1(A6,{markdown:w.story},void 0,!1,void 0,this)},void 0,!1,void 0,this),X&&R1("div",{className:"content-section-reveal grid md:grid-cols-2 gap-x-16 gap-y-12",children:[w.expertise&&w.expertise.length>0&&R1("section",{children:[R1("h2",{className:"text-sm tracking-widest uppercase text-theme-muted mb-6",children:"Expertise"},void 0,!1,void 0,this),R1("ul",{className:"flex flex-wrap gap-3",children:w.expertise.map((W,Y)=>R1("li",{className:VF({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&&R1("section",{children:[R1("h2",{className:"text-sm tracking-widest uppercase text-theme-muted mb-6",children:"Current Focus"},void 0,!1,void 0,this),R1("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&&R1("section",{children:[R1("h2",{className:"text-sm tracking-widest uppercase text-theme-muted mb-6",children:"Availability"},void 0,!1,void 0,this),R1("p",{className:"text-lg text-theme leading-relaxed",children:w.availability},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(Boolean(w.email)||Boolean(w.website)||w.socialLinks!==void 0&&w.socialLinks.length>0)&&R1("section",{children:[R1("h2",{className:"text-sm tracking-widest uppercase text-theme-muted mb-6",children:"Contact"},void 0,!1,void 0,this),R1("div",{className:"space-y-4",children:[w.email&&R1("p",{className:"text-lg",children:R1("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&&R1("p",{className:"text-lg",children:R1("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&&R1("div",{className:"flex flex-wrap gap-4 mt-4",children:w.socialLinks.map((W,Y)=>R1(t5,{href:W.url,external:!0,variant:"secondary",size:"md",children:W.label?.length?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 i2,Fragment as _m}from"preact/jsx-dev-runtime";var WZ=()=>{return i2(_m,{children:[i2(f2,{title:"Thanks for subscribing!",description:"You've successfully subscribed to the newsletter."},void 0,!1,void 0,this),i2("div",{className:"min-h-[60vh] flex items-center justify-center px-6",children:i2("div",{className:"text-center max-w-md",children:[i2("div",{className:"text-6xl mb-6",children:"\uD83C\uDF89"},void 0,!1,void 0,this),i2("h1",{className:"text-3xl font-semibold mb-4 text-heading",children:"Thanks for subscribing!"},void 0,!1,void 0,this),i2("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),i2(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)},YZ=()=>{return i2(_m,{children:[i2(f2,{title:"Subscription failed",description:"There was a problem with your subscription."},void 0,!1,void 0,this),i2("div",{className:"min-h-[60vh] flex items-center justify-center px-6",children:i2("div",{className:"text-center max-w-md",children:[i2("div",{className:"text-6xl mb-6",children:"\uD83D\uDE22"},void 0,!1,void 0,this),i2("h1",{className:"text-3xl font-semibold mb-4 text-heading",children:"Something went wrong"},void 0,!1,void 0,this),i2("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),i2(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)};Z0();var Tm=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')")}),Em=F.object({entityDisplay:F.object({post:Tm,deck:Tm}).describe("Display metadata for post and deck entity types (required for homepage)")});var bm={name:"@brains/site-professional",private:!0,version:"0.2.0-alpha.140",description:"Professional site composition package",type:"module",exports:{".":"./src/index.ts"},files:["src"],scripts:{typecheck:"tsc --noEmit",lint:"eslint . --ext .ts,.tsx --max-warnings 0","lint:fix":"eslint . --ext .ts,.tsx --max-warnings 0 --fix"},dependencies:{"@brains/blog":"workspace:*","@brains/decks":"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 JZ extends l9{dependencies=["blog","decks"];constructor(w){super("professional-site",bm,w,Em)}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 MG(X,W);w.entities.registerDataSource(Y);let J=new BG;w.entities.registerDataSource(J);let G=F.object({profile:P4,posts:F.array(s5),decks:F.array(mw),postsListUrl:F.string(),decksListUrl:F.string(),cta:Bf,sections:F.record(F.string(),QX)}),A=F.object({profile:P4}),U=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:fZ}}),about:E1({name:"about",description:"About page with full profile information",schema:A,dataSourceId:"professional:about",requiredPermission:"public",layout:{component:XZ}}),"subscribe-thanks":E1({name:"subscribe-thanks",description:"Newsletter subscription success page",schema:U,requiredPermission:"public",layout:{component:WZ}}),"subscribe-error":E1({name:"subscribe-error",description:"Newsletter subscription error page",schema:U,requiredPermission:"public",layout:{component:YZ}})}),this.logger.info("Professional site plugin registered successfully")}async getTools(){return[]}async getResources(){return[]}}function GZ(w){return new JZ(w??{})}var AZ=[{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 VG}from"preact/jsx-dev-runtime";function HZ({sections:w,siteInfo:$,slots:f,wordmark:X}){return VG("div",{className:"flex flex-col min-h-screen bg-theme overflow-x-clip",children:[VG(D$,{title:$.title,navigation:$.navigation.primary,showThemeToggle:!0,...$.logo!==void 0?{logo:$.logo}:{},...X!==void 0?{wordmark:X}:{}},void 0,!1,void 0,this),VG("main",{className:"flex-grow flex flex-col bg-theme",children:w},void 0,!1,void 0,this),VG(ZF,{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 jm(w){return{id:w.id,version:w.version,type:w.type,packageName:w.packageName}}var Q91=RQ;function Z91(w){return jm(VQ(w))}var $O0=zQ,M91=$O0,B91=HZ;function V91(w){return jm(GZ(w))}var z91=AZ;export{$O0 as routes,V91 as professionalSitePlugin,z91 as professionalRoutes,Z91 as personalSitePlugin,M91 as personalRoutes,B91 as ProfessionalLayout,Q91 as PersonalLayout};
|
|
1810
|
+
${f.content}`,templateName:"decks:description"})})}}r4();A1();var P4=q3.extend(y7.shape);A1();class MG{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,P4),_8(X,{entityType:"post",count:3,parse:Uw}),_8(X,{entityType:"deck",count:3,parse:Pf}),xw(X)]),A={profile:W,posts:Y,decks:J,postsListUrl:this.postsListUrl,decksListUrl:this.decksListUrl,cta:Vf(G.cta),sections:G.sections??{}};return $.parse(A)}}A1();class BG{id="professional:about";name="About Page DataSource";description="Fetches full profile data for the about page";async fetch(w,$,f){let W={profile:await D3(f.entityService,P4)};return $.parse(W)}}import{jsxDEV as b1,Fragment as tF0}from"preact/jsx-dev-runtime";var aF0="grid md:grid-cols-[14rem_1px_1fr] gap-y-2 gap-x-0 md:gap-16 items-start",sF0="border-t md:border-t-0 md:border-l border-rule-strong md:self-stretch",$Z=({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:aF0,children:[b1(qF,{title:$,number:w,blurb:f},void 0,!1,void 0,this),b1("div",{className:sF0,"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),fZ=({profile:w,posts:$,decks:f,postsListUrl:X,decksListUrl:W,cta:Y,sections:J})=>{let G=w.tagline?.length?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})),U=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].find((Z)=>Z)??"Professional site",O=Boolean(w.description)||w.expertise!==void 0&&w.expertise.length>0;return b1(tF0,{children:[b1(f2,{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:yY(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:yY(w.intro,"italic text-accent")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),b1($Z,{number:"01",title:"Essays",blurb:J.essays?.blurb,children:b1(uY,{items:A,viewAllUrl:X,viewAllLabel:"View all essays"},void 0,!1,void 0,this)},void 0,!1,void 0,this),U.length>0&&b1($Z,{number:"02",title:"Presentations",blurb:J.presentations?.blurb,children:b1(uY,{items:U,viewAllUrl:W,viewAllLabel:"View all presentations"},void 0,!1,void 0,this)},void 0,!1,void 0,this),O&&b1($Z,{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(DF,{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(FF,{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 R1,Fragment as eF0}from"preact/jsx-dev-runtime";var XZ=({profile:w})=>{let $=`About ${w.name||"Me"}`,f=[w.description,w.intro].find((W)=>W)??"About page",X=w.expertise!==void 0&&w.expertise.length>0||Boolean(w.currentFocus)||Boolean(w.availability)||Boolean(w.email)||Boolean(w.website)||w.socialLinks!==void 0&&w.socialLinks.length>0;return R1(eF0,{children:[R1(f2,{title:$,description:f,ogType:"profile"},void 0,!1,void 0,this),R1("div",{className:"about-page bg-theme",children:[R1("header",{className:"hero-bg-pattern relative w-full py-16 md:py-24 px-6 md:px-12 bg-theme overflow-hidden",children:R1("div",{className:"relative z-10 max-w-4xl mx-auto",children:[R1("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&&R1("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),R1("div",{className:"container mx-auto px-6 md:px-12 max-w-4xl py-12 md:py-16",children:[w.story&&R1("section",{className:"content-section-reveal mb-20 md:mb-28",children:R1(A6,{markdown:w.story},void 0,!1,void 0,this)},void 0,!1,void 0,this),X&&R1("div",{className:"content-section-reveal grid md:grid-cols-2 gap-x-16 gap-y-12",children:[w.expertise&&w.expertise.length>0&&R1("section",{children:[R1("h2",{className:"text-sm tracking-widest uppercase text-theme-muted mb-6",children:"Expertise"},void 0,!1,void 0,this),R1("ul",{className:"flex flex-wrap gap-3",children:w.expertise.map((W,Y)=>R1("li",{className:VF({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&&R1("section",{children:[R1("h2",{className:"text-sm tracking-widest uppercase text-theme-muted mb-6",children:"Current Focus"},void 0,!1,void 0,this),R1("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&&R1("section",{children:[R1("h2",{className:"text-sm tracking-widest uppercase text-theme-muted mb-6",children:"Availability"},void 0,!1,void 0,this),R1("p",{className:"text-lg text-theme leading-relaxed",children:w.availability},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(Boolean(w.email)||Boolean(w.website)||w.socialLinks!==void 0&&w.socialLinks.length>0)&&R1("section",{children:[R1("h2",{className:"text-sm tracking-widest uppercase text-theme-muted mb-6",children:"Contact"},void 0,!1,void 0,this),R1("div",{className:"space-y-4",children:[w.email&&R1("p",{className:"text-lg",children:R1("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&&R1("p",{className:"text-lg",children:R1("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&&R1("div",{className:"flex flex-wrap gap-4 mt-4",children:w.socialLinks.map((W,Y)=>R1(t5,{href:W.url,external:!0,variant:"secondary",size:"md",children:W.label?.length?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 i2,Fragment as _m}from"preact/jsx-dev-runtime";var WZ=()=>{return i2(_m,{children:[i2(f2,{title:"Thanks for subscribing!",description:"You've successfully subscribed to the newsletter."},void 0,!1,void 0,this),i2("div",{className:"min-h-[60vh] flex items-center justify-center px-6",children:i2("div",{className:"text-center max-w-md",children:[i2("div",{className:"text-6xl mb-6",children:"\uD83C\uDF89"},void 0,!1,void 0,this),i2("h1",{className:"text-3xl font-semibold mb-4 text-heading",children:"Thanks for subscribing!"},void 0,!1,void 0,this),i2("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),i2(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)},YZ=()=>{return i2(_m,{children:[i2(f2,{title:"Subscription failed",description:"There was a problem with your subscription."},void 0,!1,void 0,this),i2("div",{className:"min-h-[60vh] flex items-center justify-center px-6",children:i2("div",{className:"text-center max-w-md",children:[i2("div",{className:"text-6xl mb-6",children:"\uD83D\uDE22"},void 0,!1,void 0,this),i2("h1",{className:"text-3xl font-semibold mb-4 text-heading",children:"Something went wrong"},void 0,!1,void 0,this),i2("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),i2(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)};Z0();var Tm=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')")}),Em=F.object({entityDisplay:F.object({post:Tm,deck:Tm}).describe("Display metadata for post and deck entity types (required for homepage)")});var bm={name:"@brains/site-professional",private:!0,version:"0.2.0-alpha.141",description:"Professional site composition package",type:"module",exports:{".":"./src/index.ts"},files:["src"],scripts:{typecheck:"tsc --noEmit",lint:"eslint . --ext .ts,.tsx --max-warnings 0","lint:fix":"eslint . --ext .ts,.tsx --max-warnings 0 --fix"},dependencies:{"@brains/blog":"workspace:*","@brains/decks":"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 JZ extends l9{dependencies=["blog","decks"];constructor(w){super("professional-site",bm,w,Em)}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 MG(X,W);w.entities.registerDataSource(Y);let J=new BG;w.entities.registerDataSource(J);let G=F.object({profile:P4,posts:F.array(s5),decks:F.array(mw),postsListUrl:F.string(),decksListUrl:F.string(),cta:Bf,sections:F.record(F.string(),QX)}),A=F.object({profile:P4}),U=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:fZ}}),about:E1({name:"about",description:"About page with full profile information",schema:A,dataSourceId:"professional:about",requiredPermission:"public",layout:{component:XZ}}),"subscribe-thanks":E1({name:"subscribe-thanks",description:"Newsletter subscription success page",schema:U,requiredPermission:"public",layout:{component:WZ}}),"subscribe-error":E1({name:"subscribe-error",description:"Newsletter subscription error page",schema:U,requiredPermission:"public",layout:{component:YZ}})}),this.logger.info("Professional site plugin registered successfully")}async getTools(){return[]}async getResources(){return[]}}function GZ(w){return new JZ(w??{})}var AZ=[{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 VG}from"preact/jsx-dev-runtime";function HZ({sections:w,siteInfo:$,slots:f,wordmark:X}){return VG("div",{className:"flex flex-col min-h-screen bg-theme overflow-x-clip",children:[VG(D$,{title:$.title,navigation:$.navigation.primary,showThemeToggle:!0,...$.logo!==void 0?{logo:$.logo}:{},...X!==void 0?{wordmark:X}:{}},void 0,!1,void 0,this),VG("main",{className:"flex-grow flex flex-col bg-theme",children:w},void 0,!1,void 0,this),VG(ZF,{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 jm(w){return{id:w.id,version:w.version,type:w.type,packageName:w.packageName}}var Q91=RQ;function Z91(w){return jm(VQ(w))}var $O0=zQ,M91=$O0,B91=HZ;function V91(w){return jm(GZ(w))}var z91=AZ;export{$O0 as routes,V91 as professionalSitePlugin,z91 as professionalRoutes,Z91 as personalSitePlugin,M91 as personalRoutes,B91 as ProfessionalLayout,Q91 as PersonalLayout};
|
|
1811
1811
|
|
|
1812
|
-
//# debugId=
|
|
1812
|
+
//# debugId=9CEC125994B63EB964756E2164756E21
|
|
1813
1813
|
//# sourceMappingURL=site.js.map
|