@kyro-cms/core 0.12.41 → 0.12.43

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.
Files changed (68) hide show
  1. package/dist/api-handler-graphql.cjs +1 -1
  2. package/dist/api-handler-graphql.js +1 -1
  3. package/dist/api-handler-trpc.cjs +1 -1
  4. package/dist/api-handler-trpc.js +1 -1
  5. package/dist/api-handler.cjs +1 -1
  6. package/dist/api-handler.d.cts +1 -1
  7. package/dist/api-handler.d.ts +1 -1
  8. package/dist/api-handler.js +1 -1
  9. package/dist/bootstrap-ROSTPMVL.js +1 -0
  10. package/dist/bootstrap-WW5NJ6EB.cjs +1 -0
  11. package/dist/{chunk-RXZ3IUWM.cjs → chunk-3CVLI5C5.cjs} +2 -2
  12. package/dist/{chunk-65G73T7Z.cjs → chunk-4IGWJMBY.cjs} +2 -2
  13. package/dist/{chunk-NZ35PV5R.js → chunk-5B6X2GBJ.js} +2 -2
  14. package/dist/chunk-7IVN6TTY.js +133 -0
  15. package/dist/{chunk-7MBZYLME.js → chunk-B5XWYVWK.js} +1 -1
  16. package/dist/{chunk-5K4YG5DA.cjs → chunk-BGX27ZRG.cjs} +1 -1
  17. package/dist/{chunk-6J27P5D6.js → chunk-C2W5PSHC.js} +1 -1
  18. package/dist/chunk-CCUQZ66T.cjs +133 -0
  19. package/dist/chunk-EPMGPNBE.js +1 -0
  20. package/dist/chunk-FZ6Q2EBJ.cjs +20 -0
  21. package/dist/chunk-HQP2Y7QQ.js +251 -0
  22. package/dist/chunk-IFJ73O3A.cjs +1 -0
  23. package/dist/{chunk-HOP4D5XZ.cjs → chunk-J4252I5B.cjs} +5 -5
  24. package/dist/chunk-N5VNHUJS.cjs +4 -0
  25. package/dist/chunk-NZJAGASC.cjs +251 -0
  26. package/dist/{chunk-IKOXCJYO.js → chunk-Q2UYCYKV.js} +5 -5
  27. package/dist/{chunk-SZNM3F5V.js → chunk-QYFU5Y7S.js} +1 -1
  28. package/dist/{chunk-QBJT7XLN.cjs → chunk-TFBHE5FF.cjs} +1 -1
  29. package/dist/chunk-W7C6SJXZ.js +20 -0
  30. package/dist/chunk-ZIWJJRWQ.js +4 -0
  31. package/dist/cli/index.cjs +51 -90
  32. package/dist/cli/index.js +51 -90
  33. package/dist/drizzle/index.cjs +1 -1
  34. package/dist/drizzle/index.d.cts +3 -1
  35. package/dist/drizzle/index.d.ts +3 -1
  36. package/dist/drizzle/index.js +1 -1
  37. package/dist/graphql/index.d.cts +1 -1
  38. package/dist/graphql/index.d.ts +1 -1
  39. package/dist/{index-CqR97Q2L.d.ts → index-BeQtbl3z.d.ts} +2 -0
  40. package/dist/{index-DRNSjOte.d.cts → index-DTz6u7w9.d.cts} +2 -0
  41. package/dist/index.cjs +43 -25
  42. package/dist/index.d.cts +2 -2
  43. package/dist/index.d.ts +2 -2
  44. package/dist/index.js +43 -25
  45. package/dist/integration.cjs +1 -1
  46. package/dist/integration.js +1 -1
  47. package/dist/rest/index.cjs +1 -1
  48. package/dist/rest/index.d.cts +1 -1
  49. package/dist/rest/index.d.ts +1 -1
  50. package/dist/rest/index.js +1 -1
  51. package/dist/{sqlite-adapter-PLD57WOH.cjs → sqlite-adapter-GTTVSXRV.cjs} +1 -1
  52. package/dist/sqlite-adapter-UPANATIW.js +1 -0
  53. package/dist/templates/index.cjs +1 -1
  54. package/dist/templates/index.js +1 -1
  55. package/package.json +2 -2
  56. package/dist/bootstrap-BGO2NFKB.cjs +0 -1
  57. package/dist/bootstrap-VVIT6YBP.js +0 -1
  58. package/dist/chunk-2YRM7CZZ.cjs +0 -251
  59. package/dist/chunk-4DJYAD4L.js +0 -251
  60. package/dist/chunk-4KFXG5ZB.cjs +0 -21
  61. package/dist/chunk-5KSRMBEO.js +0 -133
  62. package/dist/chunk-DZMIMB5W.js +0 -21
  63. package/dist/chunk-FUWPXR6W.cjs +0 -133
  64. package/dist/chunk-KKIBNWRL.cjs +0 -1
  65. package/dist/chunk-LCXPMPBU.js +0 -1
  66. package/dist/chunk-PTG24TQS.js +0 -20
  67. package/dist/chunk-YKIO34KG.cjs +0 -20
  68. package/dist/sqlite-adapter-EXYRYZEV.js +0 -1
package/dist/index.js CHANGED
@@ -1,25 +1,43 @@
1
- export{a as RedisAuthAdapter}from'./chunk-QOCHBPMK.js';export{k as allGlobalSettings,q as blogCollections,l as coreGlobalSettings,V as createTemplateConfig,r as ecommerceCollections,s as ecommerceGlobals,t as kitchenSinkCollections,v as mediaCollections,a as minimalCollections,U as templateCollections}from'./chunk-SZNM3F5V.js';export{a as kyro}from'./chunk-PTG24TQS.js';export{s as AnalyticsPlugin,t as CommentsPlugin,a as ConfigValidationError,y as Kyro,p as KyroPlugin,A as LocalAdapter,q as PluginManager,l as Registry,u as ReviewsPlugin,r as SEOPlugin,v as WishlistPlugin,x as applyCollectionOverrides,h as collectionToCreateZod,i as collectionToUpdateZod,j as collectionToWhereZod,g as collectionToZod,z as createKyro,B as createLocalAdapter,o as createRegistry,f as fieldToZod,m as getRegistry,k as globalToZod,w as presetPlugins,n as resetRegistry,b as validateCollection,e as validateConfig,d as validateFields,c as validateGlobal}from'./chunk-DZMIMB5W.js';export{d as autoBootstrap,a as bootstrapAdmin,e as bootstrapWithRetry,c as getBootstrapFromEnv}from'./chunk-7MBZYLME.js';import'./chunk-NZ35PV5R.js';export{a as CSSGenerator,g as createAdminStyling,d as defaultDarkTheme,h as defaultFieldStyling,c as defaultLightTheme,e as ecommerce2026Theme,f as generateCSSVariables,b as generateTailwindConfig}from'./chunk-UHFDH3PG.js';export{q as ALL_FIELD_TYPES,n as COMPLEX_FIELD_TYPES,p as LAYOUT_FIELD_TYPES,m as PRIMITIVE_FIELD_TYPES,o as RELATIONAL_FIELD_TYPES,d as isArrayField,f as isBlocksField,e as isGroupField,h as isImageField,k as isLayoutField,b as isNumberField,c as isRelationshipField,i as isRichTextField,j as isSelectField,a as isTextField,g as isUploadField,t as normalizeRichTextValue,u as renderRichText,s as richTextStyles}from'./chunk-INB4LNA6.js';import'./chunk-5SEHX7ON.js';export{a as createContext,g as createCountProcedure,d as createCreateProcedure,f as createDeleteProcedure,h as createDynamicRouter,c as createFindByIDProcedure,b as createFindProcedure,i as createKyroServer,e as createUpdateProcedure}from'./chunk-LHW4R367.js';export{c as buildGraphQLSchema,d as createGraphQLSchema}from'./chunk-PP7W5UKL.js';import {l,n,m,p,q as q$1}from'./chunk-4DJYAD4L.js';export{n as AuditLogger,p as InMemoryAuditLogger,m as InMemoryRateLimiter,t as MediaService,o as createAuditContext,u as createHonoApp,e as createLocalStorage,v as createRESTAPI,i as getAppSecret,j as getEncryptionKey,k as getSessionConfig,s as isEdgeRuntime,h as loadSecrets,d as resolveProvider,g as setDbAdapter}from'./chunk-4DJYAD4L.js';import {k as k$1,l as l$1}from'./chunk-6J27P5D6.js';export{j as ConfigService,k as EmailTransport,l as PasswordPolicy,i as getEmailTemplates,g as renderAccountLocked,a as renderBaseLayout,f as renderMagicLink,e as renderPasswordChanged,c as renderResetPassword,h as renderUserInvite,b as renderVerifyEmail,d as renderWelcome}from'./chunk-6J27P5D6.js';import'./chunk-K6WUOU6P.js';import'./chunk-IETGL7WJ.js';import {a as a$2}from'./chunk-IKOXCJYO.js';export{a as SQLiteAuthAdapter}from'./chunk-IKOXCJYO.js';import'./chunk-NRLIGDYF.js';export{e as ALL_WEBHOOK_EVENTS,f as WEBHOOK_COLLECTION,g as WEBHOOK_DELIVERY_COLLECTION,d as WEBHOOK_EVENTS,n as WebhookService,l as buildDeliveryRecord,m as createTestPayload,o as createWebhookService,j as deliverWebhook,k as deliverWithRetry,i as generateWebhookSecret,h as signPayload}from'./chunk-FVZ5RFLO.js';export{a as evaluateAccess,c as getWhereClause,b as mergeWhereClauses}from'./chunk-HLSB2MCK.js';export{b as KyroPubSub,c as KyroWSServer,a as PubSub,d as createWSServer}from'./chunk-GKYEJ2UF.js';import'./chunk-PP5S2UBV.js';export{c as DrizzleAdapter,b as collectionToDrizzleSchema,f as createDatabase,d as createDrizzleAdapter,a as fieldToDrizzleType,g as runMigrations,h as seedDefaultRoles}from'./chunk-5KSRMBEO.js';import {a as a$3}from'./chunk-RHCWCG3O.js';export{a as PostgresAuthAdapter}from'./chunk-RHCWCG3O.js';import'./chunk-OG7CNQGU.js';export{a as MongoDBAdapter,b as createMongoDBAdapter}from'./chunk-VGQ4VUG6.js';import {a as a$1}from'./chunk-6ROHVUXF.js';export{a as MongoDBAuthAdapter}from'./chunk-6ROHVUXF.js';import {a as a$4}from'./chunk-5KOQYQEE.js';export{a as AbstractBaseAdapter}from'./chunk-5KOQYQEE.js';import {a}from'./chunk-6SPPR5JZ.js';import'./chunk-4RMFCTWH.js';import'./chunk-KDNYHLD2.js';import'./chunk-5J6HXUF6.js';import W,{randomBytes}from'crypto';import {readFileSync}from'fs';import Me,{join,resolve}from'path';import {z as z$1}from'zod';export{z}from'zod';import {createStorage}from'unstorage';import Jr from'unstorage/drivers/indexedb';import eo from'unstorage/drivers/fs';async function Re(s,e){let t=e.data;for(let r of s){let o=await r({...e,data:t});o!==void 0&&(t=o);}return t}async function Cr(s,e){return Re(s,e)}var R=class extends a$4{connectionString;constructor(e){super(),this.connectionString=e.connectionString;}async connect(){this.connected=true;}async disconnect(){this.connected=false;}async query(e,t=[]){if(!this.connectionString)throw new Error("NeonAdapter: Connection string is required.");try{let r=await fetch(`${this.connectionString}/sql`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,params:t})});return r.ok?(await r.json()).rows||[]:[]}catch{return []}}async find(e){return {docs:[],totalDocs:0,limit:e.limit||10,totalPages:1,page:e.page||1,hasNextPage:false,hasPrevPage:false}}async findByID(e){return null}async create(e){return e.data}async update(e){return e.data}async delete(e){return {success:true,id:e.id}}async count(e){return 0}async findOne(e){return null}async findVersions(e){return {docs:[],totalDocs:0,limit:10,totalPages:1,page:1,hasNextPage:false,hasPrevPage:false}}async findVersionByID(e){return null}async createVersion(e){return {id:"v1",parentId:e.documentId,version:e.version||1,snapshot:e.snapshot||{},createdAt:new Date().toISOString()}}async updateLatestVersion(e){return {id:"v1",parentId:e.documentId,version:e.version||1,snapshot:e.snapshot||{},createdAt:new Date().toISOString()}}async deleteVersions(e){}};function ve(s){return new R(s)}var v=class extends a$4{url;authToken;constructor(e){super(),this.url=e.url.replace(/^libsql:\/\//,"https://"),this.authToken=e.authToken;}async connect(){this.connected=true;}async disconnect(){this.connected=false;}async query(e,t=[]){if(!this.url)throw new Error("TursoAdapter: Database URL is required.");try{let r={"Content-Type":"application/json"};this.authToken&&(r.Authorization=`Bearer ${this.authToken}`);let o=await fetch(`${this.url}/v2/pipeline`,{method:"POST",headers:r,body:JSON.stringify({requests:[{type:"execute",stmt:{sql:e,args:t.map(c=>({type:"text",value:String(c)}))}},{type:"close"}]})});if(!o.ok)return [];let i=(await o.json())?.results?.[0]?.response?.result;if(!i||!i.rows)return [];let a=i.cols.map(c=>c.name);return i.rows.map(c=>{let l={};return a.forEach((d,u)=>{l[d]=c[u]?.value??null;}),l})}catch{return []}}async find(e){return {docs:[],totalDocs:0,limit:e.limit||10,totalPages:1,page:e.page||1,hasNextPage:false,hasPrevPage:false}}async findByID(e){return null}async create(e){return e.data}async update(e){return e.data}async delete(e){return {success:true,id:e.id}}async count(e){return 0}async findOne(e){return null}async findVersions(e){return {docs:[],totalDocs:0,limit:10,totalPages:1,page:1,hasNextPage:false,hasPrevPage:false}}async findVersionByID(e){return null}async createVersion(e){return {id:"v1",parentId:e.documentId,version:e.version||1,snapshot:e.snapshot||{},createdAt:new Date().toISOString()}}async updateLatestVersion(e){return {id:"v1",parentId:e.documentId,version:e.version||1,snapshot:e.snapshot||{},createdAt:new Date().toISOString()}}async deleteVersions(e){}};function De(s){return new v(s)}var Rr={maxAttempts:5,lockDuration:9e5,notifyUser:true,notifyAdmin:true,adminNotifyAfter:3},x=class{redis;prefix;config;constructor(e,t={},r="kyro:lockout:"){this.redis=e,this.prefix=r,this.config={...Rr,...t};}lockKey(e){return `${this.prefix}${e}`}historyKey(e){return `${this.prefix}${e}:history`}async checkLockout(e){let t=this.lockKey(e),r=await this.redis.hgetall(t);if(!r||Object.keys(r).length===0)return {locked:false,attemptsRemaining:this.config.maxAttempts,totalAttempts:0};let o=parseInt(r.attempts,10),n=r.lockedUntil?new Date(parseInt(r.lockedUntil,10)):void 0;return n&&n>new Date?{locked:true,attemptsRemaining:0,lockedUntil:n,totalAttempts:o}:n&&n<=new Date?(await this.unlockAccount(e),{locked:false,attemptsRemaining:this.config.maxAttempts,totalAttempts:0}):{locked:false,attemptsRemaining:Math.max(0,this.config.maxAttempts-o),totalAttempts:o}}async recordFailedAttempt(e){let t=this.lockKey(e),r=this.historyKey(e),o=Date.now(),n=await this.redis.hincrby(t,"attempts",1);if(await this.redis.hset(t,"lastAttempt",o.toString()),await this.redis.lpush(r,o.toString()),await this.redis.ltrim(r,0,99),n>=this.config.maxAttempts){let i=new Date(o+this.config.lockDuration);return await this.redis.hset(t,{lockedAt:o.toString(),lockedUntil:i.getTime().toString()}),await this.redis.expire(t,Math.ceil(this.config.lockDuration/1e3)+3600),{locked:true,attemptsRemaining:0,lockedUntil:i,totalAttempts:n}}return {locked:false,attemptsRemaining:Math.max(0,this.config.maxAttempts-n),totalAttempts:n}}async lockAccount(e,t){let r=this.lockKey(e),o=Date.now(),n=t||this.config.lockDuration,i=new Date(o+n),a=this.redis.pipeline();a.hset(r,{attempts:this.config.maxAttempts.toString(),lockedAt:o.toString(),lockedUntil:i.getTime().toString()}),a.expire(r,Math.ceil(n/1e3)+3600),await a.exec();}async unlockAccount(e){let t=this.lockKey(e);await this.redis.del(t);}async resetAttempts(e){let t=this.lockKey(e);(await this.redis.hgetall(t)).lockedAt?await this.redis.hset(t,{attempts:"0",lockedAt:"",lockedUntil:""}):await this.redis.del(t);}async getLockoutHistory(e,t=10){let r=this.historyKey(e);return (await this.redis.lrange(r,0,t-1)).map(n=>new Date(parseInt(n,10)))}async getLockoutStats(e){let t=this.historyKey(e),r=await this.redis.lrange(t,0,-1),o=r.filter((i,a)=>(a+1)%this.config.maxAttempts===0).length,n=await this.redis.hget(this.lockKey(e),"lockedAt");return {totalFailedAttempts:r.length,lockoutCount:o,lastLockout:n?new Date(parseInt(n,10)):null,averageAttemptsBeforeLockout:o>0?this.config.maxAttempts:0}}shouldNotifyAdmin(e){return this.config.notifyAdmin&&e>=this.config.adminNotifyAfter}getConfig(){return {...this.config}}setConfig(e){this.config={...this.config,...e};}};var vr={"auth:login":{window:9e5,max:5},"auth:register":{window:36e5,max:3},"auth:forgot":{window:36e5,max:3},"auth:reset":{window:36e5,max:5},"auth:verify":{window:36e5,max:5},"api:general":{window:6e4,max:100},"api:authenticated":{window:6e4,max:200}},P=class{redis;prefix;limits;userLimits;constructor(e,t,r,o="kyro:ratelimit:"){this.redis=e,this.prefix=o,this.limits={...vr,...t},this.userLimits=r||{"user:api":{window:6e4,max:500},"user:write":{window:36e5,max:100}};}getKey(e,t){return `${this.prefix}${e}:${t}`}async check(e,t){let r=this.limits[e]||this.limits["api:general"],o=this.getKey(e,t),n=Date.now(),i=n-r.window,a=this.redis.pipeline();a.zremrangebyscore(o,0,i),a.zcard(o),a.zadd(o,n,`${n}:${Math.random()}`),a.expire(o,Math.ceil(r.window/1e3)+1);let l=(await a.exec())?.[1]?.[1]||0;if(l>=r.max){let d=await this.redis.zrange(o,0,0,"WITHSCORES"),u=d.length>1?parseInt(d[1],10)+r.window:n+r.window;return {allowed:false,remaining:0,resetAt:u,retryAfter:Math.ceil((u-n)/1e3)}}return {allowed:true,remaining:r.max-l-1,resetAt:n+r.window}}async checkUser(e,t,r){let o=this.userLimits[e]||this.userLimits["user:api"],n=this.getKey(`user:${e}:${t}`,r),i=Date.now(),a=i-o.window,c=this.redis.pipeline();c.zremrangebyscore(n,0,a),c.zcard(n),c.zadd(n,i,`${i}:${Math.random()}`),c.expire(n,Math.ceil(o.window/1e3)+1);let d=(await c.exec())?.[1]?.[1]||0;if(d>=o.max){let u=await this.redis.zrange(n,0,0,"WITHSCORES"),p=u.length>1?parseInt(u[1],10)+o.window:i+o.window;return {allowed:false,remaining:0,resetAt:p,retryAfter:Math.ceil((p-i)/1e3)}}return {allowed:true,remaining:o.max-d-1,resetAt:i+o.window}}async reset(e,t){let r=this.getKey(e,t);await this.redis.del(r);}async resetUser(e,t,r){let o=this.getKey(`user:${e}:${t}`,r);await this.redis.del(o);}async getStatus(e,t){let r=this.limits[e]||this.limits["api:general"],o=this.getKey(e,t),n=Date.now(),i=n-r.window;await this.redis.zremrangebyscore(o,0,i);let a=await this.redis.zcard(o);return {count:a,limit:r.max,remaining:Math.max(0,r.max-a),resetAt:n+r.window}}setLimit(e,t){this.limits[e]=t;}setUserLimit(e,t){this.userLimits[e]=t;}};var T=class{users=new Map;sessions=new Map;refreshTokens=new Map;emailToUserId=new Map;passwordHistory=new Map;emailVerificationTokens=new Map;passwordResetTokens=new Map;auditLogs=[];externalDb=false;constructor(){}async connect(){}async disconnect(){this.users.clear(),this.sessions.clear(),this.refreshTokens.clear(),this.emailToUserId.clear(),this.passwordHistory.clear();}async createUser(e){let t=randomBytes(16).toString("hex"),r=new Date().toISOString(),o=await this.hashPassword(e.password),n={id:t,email:e.email.toLowerCase(),passwordHash:o,role:e.role||"customer",tenantId:e.tenantId,createdAt:r,updatedAt:r};return this.users.set(t,n),this.emailToUserId.set(e.email.toLowerCase(),t),this.passwordHistory.set(t,[]),n}async findUserByEmail(e){let t=this.emailToUserId.get(e.toLowerCase());return t?this.findUserById(t):null}async findUserById(e){return this.users.get(e)||null}async updateUser(e,t){let r=await this.findUserById(e);if(!r)return null;let o={...r,...t,id:e,updatedAt:new Date().toISOString()};return t.email&&t.email!==r.email&&(this.emailToUserId.delete(r.email.toLowerCase()),this.emailToUserId.set(t.email.toLowerCase(),e)),this.users.set(e,o),o}async deleteUser(e){let t=await this.findUserById(e);return t?(this.users.delete(e),this.emailToUserId.delete(t.email.toLowerCase()),this.refreshTokens.forEach((r,o)=>{this.sessions.get(r)?.userId===e&&(this.refreshTokens.delete(o),this.sessions.delete(r));}),this.passwordHistory.delete(e),this.sessions.forEach((r,o)=>{r.userId===e&&this.sessions.delete(o);}),true):false}async hashPassword(e){return (await import('bcryptjs')).default.hash(e,12)}async verifyPassword(e,t){let r=await this.findUserByEmail(e);return !r||!r.passwordHash?null:await(await import('bcryptjs')).default.compare(t,r.passwordHash)?r:null}async createSession(e,t={}){let r=randomBytes(32).toString("hex"),o=randomBytes(32).toString("base64url"),n=randomBytes(32).toString("base64url"),i=new Date,a={id:r,userId:e,token:o,refreshToken:n,expiresAt:new Date(i.getTime()+86400*1e3).toISOString(),createdAt:i.toISOString(),ipAddress:t.ipAddress,userAgent:t.userAgent};return this.sessions.set(r,a),this.refreshTokens.set(n,r),a}async findSessionByToken(e){return this.sessions.get(e)||null}async findSessionByRefreshToken(e){let t=this.refreshTokens.get(e);return t&&this.sessions.get(t)||null}async deleteSession(e){let t=this.sessions.get(e);return t?(t.refreshToken&&this.refreshTokens.delete(t.refreshToken),this.sessions.delete(e),true):false}async deleteUserSessions(e){let t=0;return this.sessions.forEach((r,o)=>{r.userId===e&&(r.refreshToken&&this.refreshTokens.delete(r.refreshToken),this.sessions.delete(o),t++);}),t}async addPasswordToHistory(e,t){let r=this.passwordHistory.get(e)||[];r.push(t),r.length>5&&r.splice(0,r.length-5),this.passwordHistory.set(e,r);}async getPasswordHistory(e,t=5){return this.passwordHistory.get(e)||[]}async isPasswordInHistory(e,t,r=5){let o=await this.getPasswordHistory(t,r),n=(await import('bcryptjs')).default;for(let i of o)if(await n.compare(e,i))return true;return false}async createEmailVerificationToken(e){let t=randomBytes(32).toString("hex"),r=new Date(Date.now()+1440*60*1e3);return this.emailVerificationTokens.set(t,{userId:e,expiresAt:r}),{token:t,expiresAt:r}}async verifyEmailToken(e){let t=this.emailVerificationTokens.get(e);return !t||t.expiresAt<new Date?(this.emailVerificationTokens.delete(e),{success:false,error:"Invalid or expired token"}):(this.emailVerificationTokens.delete(e),{success:true,userId:t.userId})}async createPasswordResetToken(e){let t=await this.findUserByEmail(e);if(!t)return {token:"",expiresAt:new Date,error:"User not found"};let r=randomBytes(32).toString("hex"),o=new Date(Date.now()+3600*1e3);return this.passwordResetTokens.set(r,{userId:t.id,expiresAt:o}),{token:r,expiresAt:o}}async resetPasswordWithToken(e,t){let r=this.passwordResetTokens.get(e);if(!r||r.expiresAt<new Date)return this.passwordResetTokens.delete(e),{success:false,error:"Invalid or expired token"};let o=await this.hashPassword(t);return await this.updateUser(r.userId,{passwordHash:o}),this.passwordResetTokens.delete(e),{success:true}}async hasAnyUsers(){return this.users.size>0}async findAuditLogs(e){let{limit:t=50,offset:r=0}=e,o=this.auditLogs.slice().reverse();return e.userId&&(o=o.filter(n=>n.userId===e.userId)),e.action&&(Array.isArray(e.action)?o=o.filter(n=>e.action.includes(String(n.action))):o=o.filter(n=>n.action===e.action)),e.resource&&(o=o.filter(n=>n.resource===e.resource)),e.success!==void 0&&(o=o.filter(n=>n.success===e.success)),{logs:o.slice(r,r+t),total:o.length}}async createAuditLog(e){let t=randomBytes(16).toString("hex"),o={...e,id:t,timestamp:new Date};return this.auditLogs.push(o),o}};var k=class{storage=new Map;history=new Map;config;constructor(e={}){this.config={maxAttempts:5,lockDuration:9e5,notifyUser:true,notifyAdmin:true,adminNotifyAfter:3,...e};}async checkLockout(e){let t=Date.now(),r=this.storage.get(e);if(r&&r.lockedUntil!==null&&r.lockedUntil<=t)return await this.resetAttempts(e),{locked:false,attemptsRemaining:this.config.maxAttempts,totalAttempts:0};if(!r)return {locked:false,attemptsRemaining:this.config.maxAttempts,totalAttempts:0};let{attempts:o,lockedUntil:n}=r;return n!==null&&n>t?{locked:true,attemptsRemaining:0,lockedUntil:new Date(n),totalAttempts:o}:{locked:false,attemptsRemaining:Math.max(0,this.config.maxAttempts-o),totalAttempts:o}}async recordFailedAttempt(e){let t=Date.now(),r=this.storage.get(e)||{attempts:0,lastAttempt:null,lockedAt:null,lockedUntil:null};r.attempts+=1,r.lastAttempt=t;let o=this.history.get(e)||[];if(o.push(t),o.length>100&&o.splice(0,o.length-100),this.history.set(e,o),this.storage.set(e,r),r.attempts>=this.config.maxAttempts){let n=new Date(t+this.config.lockDuration);return r.lockedAt=t,r.lockedUntil=n.getTime(),this.storage.set(e,r),{locked:true,attemptsRemaining:0,lockedUntil:n,totalAttempts:r.attempts}}return {locked:false,attemptsRemaining:Math.max(0,this.config.maxAttempts-r.attempts),totalAttempts:r.attempts}}async lockAccount(e,t){let r=Date.now(),o=t||this.config.lockDuration,n=new Date(r+o),i=this.storage.get(e)||{attempts:0,lastAttempt:null,lockedAt:null,lockedUntil:null};i.attempts=this.config.maxAttempts,i.lockedAt=r,i.lockedUntil=n.getTime(),this.storage.set(e,i);}async unlockAccount(e){await this.resetAttempts(e);}async resetAttempts(e){let t=this.storage.get(e);t&&(t.attempts=0,t.lockedAt=null,t.lockedUntil=null,this.storage.set(e,t)),this.history.delete(e);}async getLockoutHistory(e,t=10){return (this.history.get(e)||[]).slice(-t).reverse().map(o=>new Date(o))}async getLockoutStats(e){let r=(this.history.get(e)||[]).length,o=Math.floor(r/this.config.maxAttempts),n=null,i=this.storage.get(e);i&&i.lockedAt!==null&&(n=new Date(i.lockedAt));let a=o>0?this.config.maxAttempts:0;return {totalFailedAttempts:r,lockoutCount:o,lastLockout:n,averageAttemptsBeforeLockout:a}}shouldNotifyAdmin(e){return this.config.notifyAdmin&&e>=this.config.adminNotifyAfter}getConfig(){return {...this.config}}setConfig(e){this.config={...this.config,...e};}};function h(s,e=""){return process.env[s]||e}function A(s,e=false){let t=process.env[s];return t?t.toLowerCase()==="true":e}function g(s,e=0){let t=process.env[s];return t?parseInt(t,10):e}function Ie(){let s=process.env.KYRO_AUTH_DATABASE?.toLowerCase();if(s&&["sqlite","postgres","mongodb","memory"].includes(s))return s;try{let e=join(process.cwd(),"kyro.config.ts"),t=readFileSync(e,"utf8");if(t.includes("createLocalAdapter"))return "sqlite";if(t.includes("createDrizzleAdapter"))return t.includes("postgres")||t.includes("postgresql"),"postgres";if(t.includes("createMongoDBAdapter"))return "mongodb"}catch{}return "memory"}async function Lr(s){let e=process.cwd(),t=e.endsWith("admin")?join(e,".."):e,r=resolve(t,"data","auth.db");switch(s){case "sqlite":return new a$2({path:h("KYRO_AUTH_DB_PATH",r)});case "postgres":{let o=h("DATABASE_URL","");if(o){let n,i;try{n=(await import('drizzle-orm/postgres-js')).drizzle,i=await import('postgres');}catch{a(["postgres","drizzle-orm"]),n=(await import('drizzle-orm/postgres-js')).drizzle,i=await import('postgres');}let a$1=i.default(o,{onnotice:()=>{}}),c=n(a$1);return new a$3({db:c})}return new a$2({path:h("KYRO_AUTH_DB_PATH",r)})}case "mongodb":{let o=h("MONGODB_URI","");if(o){let n;try{n=(await import('mongodb')).MongoClient;}catch{a(["mongodb"]),n=(await import('mongodb')).MongoClient;}let i=new n(o);await i.connect();let c=new URL(o).pathname.replace(/^\//,"")||"kyro_cms",l=i.db(c);return new a$1({db:l})}return new a$2({path:h("KYRO_AUTH_DB_PATH",r)})}default:return new T}}async function $(s,e){let t=A("KYRO_DISTRIBUTED",false),r;if(t){let{RedisAuthAdapter:u}=await import('./redis-adapter-NN3H4GRX.js'),p=h("REDIS_URL","redis://localhost:6379"),y=A("REDIS_TLS",false),m=new u({url:p,tls:y});await m.connect?.(),r=m;}else {let u=s||Ie();r=await Lr(u),r.connect&&await r.connect();}let o=e?await k$1.fromConfig(e).catch(()=>null)||k$1.fromEnv()||void 0:k$1.fromEnv()||void 0,n$1=new l$1({minLength:g("PASSWORD_MIN_LENGTH",12),requireUppercase:A("PASSWORD_REQUIRE_UPPERCASE",true),requireLowercase:A("PASSWORD_REQUIRE_LOWERCASE",true),requireNumbers:A("PASSWORD_REQUIRE_NUMBERS",true),requireSpecialChars:A("PASSWORD_REQUIRE_SPECIAL",true),preventReuse:g("PASSWORD_PREVENT_REUSE",5),maxLength:g("PASSWORD_MAX_LENGTH",128)}),i,a,c;if(t){let p=r.redis;i=new x(p,{maxAttempts:g("LOCKOUT_MAX_ATTEMPTS",5),lockDuration:g("LOCKOUT_DURATION_MINUTES",15)*60*1e3}),a=new P(p,{"auth:login":{window:g("RATE_LIMIT_AUTH_WINDOW_MS",9e5),max:g("RATE_LIMIT_AUTH_MAX_REQUESTS",10)},"api:general":{window:g("RATE_LIMIT_WINDOW_MS",6e4),max:g("RATE_LIMIT_MAX_REQUESTS",100)}}),c=new n(p,g("AUDIT_LOG_RETENTION_DAYS",30));}else i=new k({maxAttempts:g("LOCKOUT_MAX_ATTEMPTS",5),lockDuration:g("LOCKOUT_DURATION_MINUTES",15)*60*1e3}),a=new m({"auth:login":{window:g("RATE_LIMIT_AUTH_WINDOW_MS",9e5),max:g("RATE_LIMIT_AUTH_MAX_REQUESTS",10)},"api:general":{window:g("RATE_LIMIT_WINDOW_MS",6e4),max:g("RATE_LIMIT_MAX_REQUESTS",100)}}),c=A("AUDIT_LOG_ENABLED",true)?new p(g("AUDIT_LOG_RETENTION_DAYS",30)):void 0;let l=new q$1({redis:r,email:o,jwtSecret:h("APP_SECRET","change-me"),jwtExpiresIn:h("JWT_EXPIRES_IN","24h"),jwtIssuer:h("JWT_ISSUER","kyro-cms"),jwtAudience:h("JWT_AUDIENCE","kyro-cms-client"),passwordPolicy:n$1,lockout:i,rateLimiter:a,auditLogger:c,baseUrl:h("EMAIL_BASE_URL","http://localhost:4321"),emailVerificationRequired:A("EMAIL_VERIFICATION_REQUIRED",true)}),d=t?"distributed":s||Ie();return {authAdapter:r,databaseType:d,email:o,passwordPolicy:n$1,lockout:i,rateLimiter:a,auditLogger:c,routes:l}}var Ee=$().catch(s=>(console.warn("[AuthConfig] Failed to initialize auth config:",s.message),null));var Er=12,Or="24h",Ur="7d",U=class{adapter;config;constructor(e,t){this.adapter=e,this.config={secret:t.secret,expiresIn:t.expiresIn??Or,refreshExpiresIn:t.refreshExpiresIn??Ur,issuer:t.issuer??"kyro-cms",audience:t.audience??[],saltRounds:t.saltRounds??Er};}async register(e){try{if(await this.adapter.findUserByEmail(e.email))return {success:!1,error:"Email already registered"};let r=await this.adapter.createUser({email:e.email,password:e.password,role:e.role??"customer",tenantId:e.tenantId});return this.createSessionForUser(r)}catch(t){return {success:false,error:String(t)}}}async login(e){try{let t=await this.adapter.verifyPassword(e.email,e.password);return t?this.createSessionForUser(t):{success:!1,error:"Invalid credentials"}}catch(t){return {success:false,error:String(t)}}}async logout(e){await this.adapter.deleteSession(e);}async refreshToken(e){try{let t=await this.adapter.findSessionByToken(e);if(!t||new Date(t.expiresAt)<new Date)return {success:!1,error:"Invalid or expired refresh token"};let r=await this.adapter.findUserById(t.userId);return r?(await this.adapter.deleteSession(e),this.createSessionForUser(r)):{success:!1,error:"User not found"}}catch(t){return {success:false,error:String(t)}}}async verifyToken(e){try{let{default:t}=await import('jsonwebtoken');return t.verify(e,this.config.secret,{issuer:this.config.issuer,audience:this.config.audience.length>0?this.config.audience[0]:void 0})}catch{return null}}async getUserFromToken(e){let t=await this.verifyToken(e);return t?this.adapter.findUserById(t.sub):null}async changePassword(e,t,r){try{let o=await this.adapter.findUserById(e);return o?await this.adapter.verifyPassword(o.email,t)?(await this.adapter.updateUser(e,{password:r}),await this.adapter.deleteUserSessions(e),{success:!0,user:o}):{success:!1,error:"Current password is incorrect"}:{success:!1,error:"User not found"}}catch(o){return {success:false,error:String(o)}}}async resetPassword(e,t){try{let r=await this.adapter.findUserByEmail(e);return r?(await this.adapter.updateUser(r.id,{password:t}),await this.adapter.deleteUserSessions(r.id),{success:!0,user:r}):{success:!1,error:"User not found"}}catch(r){return {success:false,error:String(r)}}}async sendEmailVerification(e){try{let{token:t,expiresAt:r}=await this.adapter.createEmailVerificationToken(e);return {success:!0}}catch(t){return {success:false,error:String(t)}}}async verifyEmail(e){try{return await this.adapter.verifyEmailToken(e)}catch(t){return {success:false,error:String(t)}}}async requestPasswordReset(e){try{let t=await this.adapter.createPasswordResetToken(e);return t.error?{success:!1,error:t.error}:{success:!0}}catch(t){return {success:false,error:String(t)}}}async resetPasswordWithToken(e,t){try{return await this.adapter.resetPasswordWithToken(e,t)}catch(r){return {success:false,error:String(r)}}}async deleteAccount(e){try{return await this.adapter.findUserById(e)?(await this.adapter.deleteUserSessions(e),await this.adapter.deleteUser(e),{success:!0}):{success:!1,error:"User not found"}}catch(t){return {success:false,error:String(t)}}}async createSessionForUser(e){let t=await this.generateToken(e),r=await this.adapter.createSession(e.id);return {success:true,user:e,session:r,token:t}}async generateToken(e){let{default:t}=await import('jsonwebtoken'),r={sub:e.id,email:e.email,role:e.role,tenantId:e.tenantId},o={expiresIn:this.parseExpiresIn(this.config.expiresIn)/1e3,issuer:this.config.issuer};return this.config.audience.length>0&&(o.audience=this.config.audience[0]),t.sign(r,this.config.secret,o)}async hashPassword(e){let{default:t}=await import('bcryptjs');return t.hash(e,this.config.saltRounds)}parseExpiresIn(e){if(typeof e=="number")return e;let t=e.match(/^(\d+)([smhd])$/);if(!t)return 864e5;let r=parseInt(t[1],10);switch(t[2]){case "s":return r*1e3;case "m":return r*6e4;case "h":return r*36e5;case "d":return r*864e5;default:return 864e5}}};function Vr(s,e){return new U(s,e)}function V(){return {enabled:true,draftsEnabled:true,publishEnabled:true,scheduleEnabled:false,versioningEnabled:true,maxVersionsPerDocument:50,autoPublish:false,requirePublishPermission:true}}var _=class{adapter;config;constructor(e,t){this.adapter=e,this.config={...V(),...t};}async createVersion(e){let r=((await this.adapter.getLatestVersion(e.collection,e.documentId))?.version??0)+1,o={...e,version:r},n=await this.adapter.createVersion(o);return this.config.maxVersionsPerDocument>0&&await this.pruneOldVersions(e.collection,e.documentId),n}async publishVersion(e){let t=await this.adapter.getVersion(e.collection,e.versionId);if(!t)throw new Error("Version not found");if(t.status==="published")throw new Error("Version is already published");await this.adapter.publishVersion(e);}async unpublishDocument(e,t){let r=await this.adapter.getVersions({collection:e,documentId:t,limit:1e3});for(let o of r)if(o.status==="published"){await this.createVersion({collection:e,documentId:t,data:o.data,status:"draft",createdBy:"system",changeDescription:"Unpublished document"});break}}async revertToVersion(e,t,r,o){if(!await this.adapter.getVersion(e,r))throw new Error("Version not found");return await this.adapter.revertToVersion({collection:e,documentId:t,versionId:r,userId:o})}async getVersionHistory(e,t,r=20,o=0){return this.adapter.getVersions({collection:e,documentId:t,limit:r,offset:o})}async compareTwoVersions(e,t,r,o){return this.adapter.compareVersions({collection:e,documentId:t,versionA:r,versionB:o})}async getLatestDraft(e,t){return this.adapter.getLatestVersion(e,t)}async getPublishedVersion(e,t){return this.adapter.getPublishedVersion(e,t)}async getVersion(e,t){return this.adapter.getVersion(e,t)}async schedulePublish(e,t,r,o){if(!this.config.scheduleEnabled)throw new Error("Scheduled publishing is not enabled");if(!await this.adapter.getVersion(e,r))throw new Error("Version not found")}async deleteVersionHistory(e,t){await this.adapter.deleteVersions(e,t);}async pruneOldVersions(e,t){let r=await this.adapter.getVersions({collection:e,documentId:t,limit:this.config.maxVersionsPerDocument+100});if(r.length<=this.config.maxVersionsPerDocument)return;r.slice(0,this.config.maxVersionsPerDocument);let n=r.slice(this.config.maxVersionsPerDocument);for(let i of n)if(i.status!=="published"){await this.adapter.deleteVersions(e,t);break}}};function _r(s,e){return new _(s,e)}function Mr(s){return s==="published"}function Hr(s){return s==="draft"}function Fr(s){return s==="archived"}function Nr(s){return s?Array.isArray(s)?s:Object.values(s):[]}function Br(s){return s?Array.isArray(s)?s:Object.values(s):[]}function Oe(s){return {collections:Nr(s.collections),globals:Br(s.globals),adapter:s.adapter,plugins:s.plugins,auth:s.auth,cors:s.cors,admin:s.admin,upload:s.upload,graphQL:s.graphQL,typescript:s.typescript,localization:s.localization,rateLimit:s.rateLimit,debug:s.debug}}var Kr=Oe;function $r(s){let{siteSettings:e,seoSettings:t,title:r,description:o,image:n,url:i}=s;if(!e)return "";let a=e.siteName||"",c=r||t?.defaultTitle||a,l=t?.titleTemplate,d=t?.separator||" | ",u=t?.siteNameInTitle!==false,p=l?l.replace(/\{\{title\}\}/g,c).replace(/\{\{siteName\}\}/g,u?a:"").replace(/\{\{separator\}\}/g,d).replace(/\s+/g," ").trim():c,y=o||t?.defaultDescription||e.siteDescription||"",m=n||e.siteOgImage?.url||"",D=i||e.siteUrl||"",f=`
1
+ export{a as RedisAuthAdapter}from'./chunk-QOCHBPMK.js';export{k as allGlobalSettings,q as blogCollections,l as coreGlobalSettings,V as createTemplateConfig,r as ecommerceCollections,s as ecommerceGlobals,t as kitchenSinkCollections,v as mediaCollections,a as minimalCollections,U as templateCollections}from'./chunk-QYFU5Y7S.js';export{a as kyro}from'./chunk-W7C6SJXZ.js';export{s as AnalyticsPlugin,t as CommentsPlugin,a as ConfigValidationError,y as Kyro,p as KyroPlugin,q as PluginManager,l as Registry,u as ReviewsPlugin,r as SEOPlugin,v as WishlistPlugin,x as applyCollectionOverrides,h as collectionToCreateZod,i as collectionToUpdateZod,j as collectionToWhereZod,g as collectionToZod,z as createKyro,o as createRegistry,f as fieldToZod,m as getRegistry,k as globalToZod,w as presetPlugins,n as resetRegistry,b as validateCollection,e as validateConfig,d as validateFields,c as validateGlobal}from'./chunk-ZIWJJRWQ.js';export{d as autoBootstrap,a as bootstrapAdmin,e as bootstrapWithRetry,c as getBootstrapFromEnv}from'./chunk-B5XWYVWK.js';import'./chunk-5B6X2GBJ.js';export{a as CSSGenerator,g as createAdminStyling,d as defaultDarkTheme,h as defaultFieldStyling,c as defaultLightTheme,e as ecommerce2026Theme,f as generateCSSVariables,b as generateTailwindConfig}from'./chunk-UHFDH3PG.js';export{q as ALL_FIELD_TYPES,n as COMPLEX_FIELD_TYPES,p as LAYOUT_FIELD_TYPES,m as PRIMITIVE_FIELD_TYPES,o as RELATIONAL_FIELD_TYPES,d as isArrayField,f as isBlocksField,e as isGroupField,h as isImageField,k as isLayoutField,b as isNumberField,c as isRelationshipField,i as isRichTextField,j as isSelectField,a as isTextField,g as isUploadField,t as normalizeRichTextValue,u as renderRichText,s as richTextStyles}from'./chunk-INB4LNA6.js';import'./chunk-5SEHX7ON.js';export{a as createContext,g as createCountProcedure,d as createCreateProcedure,f as createDeleteProcedure,h as createDynamicRouter,c as createFindByIDProcedure,b as createFindProcedure,i as createKyroServer,e as createUpdateProcedure}from'./chunk-LHW4R367.js';export{c as buildGraphQLSchema,d as createGraphQLSchema}from'./chunk-PP7W5UKL.js';import {l,n,m,p,q as q$1}from'./chunk-HQP2Y7QQ.js';export{n as AuditLogger,p as InMemoryAuditLogger,m as InMemoryRateLimiter,t as MediaService,o as createAuditContext,u as createHonoApp,e as createLocalStorage,v as createRESTAPI,i as getAppSecret,j as getEncryptionKey,k as getSessionConfig,s as isEdgeRuntime,h as loadSecrets,d as resolveProvider,g as setDbAdapter}from'./chunk-HQP2Y7QQ.js';import {k as k$1,l as l$1}from'./chunk-C2W5PSHC.js';export{j as ConfigService,k as EmailTransport,l as PasswordPolicy,i as getEmailTemplates,g as renderAccountLocked,a as renderBaseLayout,f as renderMagicLink,e as renderPasswordChanged,c as renderResetPassword,h as renderUserInvite,b as renderVerifyEmail,d as renderWelcome}from'./chunk-C2W5PSHC.js';import'./chunk-K6WUOU6P.js';import'./chunk-IETGL7WJ.js';import {a as a$2}from'./chunk-Q2UYCYKV.js';export{a as SQLiteAuthAdapter}from'./chunk-Q2UYCYKV.js';import'./chunk-NRLIGDYF.js';export{e as ALL_WEBHOOK_EVENTS,f as WEBHOOK_COLLECTION,g as WEBHOOK_DELIVERY_COLLECTION,d as WEBHOOK_EVENTS,n as WebhookService,l as buildDeliveryRecord,m as createTestPayload,o as createWebhookService,j as deliverWebhook,k as deliverWithRetry,i as generateWebhookSecret,h as signPayload}from'./chunk-FVZ5RFLO.js';export{a as evaluateAccess,c as getWhereClause,b as mergeWhereClauses}from'./chunk-HLSB2MCK.js';export{b as KyroPubSub,c as KyroWSServer,a as PubSub,d as createWSServer}from'./chunk-GKYEJ2UF.js';import'./chunk-PP5S2UBV.js';export{c as DrizzleAdapter,b as collectionToDrizzleSchema,f as createDatabase,d as createDrizzleAdapter,a as fieldToDrizzleType,g as runMigrations,h as seedDefaultRoles}from'./chunk-7IVN6TTY.js';import {a as a$3}from'./chunk-RHCWCG3O.js';export{a as PostgresAuthAdapter}from'./chunk-RHCWCG3O.js';import'./chunk-OG7CNQGU.js';export{a as MongoDBAdapter,b as createMongoDBAdapter}from'./chunk-VGQ4VUG6.js';import {a as a$1}from'./chunk-6ROHVUXF.js';export{a as MongoDBAuthAdapter}from'./chunk-6ROHVUXF.js';import {a as a$4,c,b,d}from'./chunk-5KOQYQEE.js';export{a as AbstractBaseAdapter}from'./chunk-5KOQYQEE.js';import {a}from'./chunk-6SPPR5JZ.js';import {a as a$5}from'./chunk-4RMFCTWH.js';import'./chunk-KDNYHLD2.js';import'./chunk-5J6HXUF6.js';import {createRequire}from'module';import ce,{randomBytes}from'crypto';import {readFileSync}from'fs';import Qe,{join,resolve}from'path';import {z as z$1}from'zod';export{z}from'zod';import {createStorage}from'unstorage';import fs from'unstorage/drivers/indexedb';import bs from'unstorage/drivers/fs';async function He(a,e){let t=e.data;for(let r of a){let s=await r({...e,data:t});s!==void 0&&(t=s);}return t}async function $r(a,e){return He(a,e)}var z;function Br(){return z||(z=createRequire("file:///")("node:sqlite").DatabaseSync,z)}function x(a){let e=[];for(let t of a)if(t.type==="tabs"&&"tabs"in t)for(let r of t.tabs)e.push(...x(r.fields));else t.type==="row"&&"fields"in t?e.push(...x(t.fields)):t.type==="collapsible"&&"fields"in t?e.push(...x(t.fields)):e.push(t);return e}function Kr(a,e){let t=e,r=a[t.name];if(t.type==="json"||t.type==="richtext"||t.type==="array"||t.type==="group"||t.type==="blocks"||t.type==="list"||t.type==="relationship-block")try{r=r?JSON.parse(r):null;}catch{r=null;}if(t.type==="checkbox"&&(r=!!r),t.type==="date"&&r)try{let s=new Date(r);isNaN(s.getTime())?r=null:r=s.toISOString();}catch{r=null;}if((t.type==="upload"||t.type==="image")&&r)try{let s=JSON.parse(r);Array.isArray(s)?r=s.map(n=>typeof n=="object"&&n!==null?n:{id:n}):r=typeof s=="object"?s:{id:s};}catch{r={id:r};}if(t.type==="relationship"&&r)try{let s=JSON.parse(r);Array.isArray(s),r=s;}catch{r={relationTo:Array.isArray(t.relationTo)?t.relationTo[0]:t.relationTo,value:r};}if(t.type==="list"&&r)try{let s=JSON.parse(r);r=Array.isArray(s)?s:[];}catch{r=[];}if(t.type==="relationship-block"&&r)try{let s=JSON.parse(r);r=Array.isArray(s)?s:[];}catch{r=[];}return r}function Be(a,e){return Array.isArray(a)?a.map(t=>{if(!t||typeof t!="object")return t;let r=t.data?{...t.data}:void 0;if(!r)return t;let s=e.find(n=>n.slug===t.type||n.slug===t.slug);if(!s||!Array.isArray(s.fields))return t;for(let n of s.fields){if(n.name&&(n.type==="upload"||n.type==="image")&&r[n.name]){let o=r[n.name];Array.isArray(o)?r[n.name]=o.map(i=>typeof i=="string"?{id:i}:i):typeof o=="string"&&(r[n.name]={id:o});}if(n.type==="blocks"&&n.name&&r[n.name]){let o=n.blocks||[];r[n.name]=Be(r[n.name],o);}}return {...t,data:r}}):a}function G(a,e){try{return a.prepare(`PRAGMA table_info(${e})`).all().map(r=>r.name)}catch{return []}}var k=class extends a$4{db;path;migrations=new Map;versionsTableName="kyro_versions";constructor(e){super(),this.path=e.path,e.db?this.db=e.db:this.db=null;}async connect(){if(this.db||(this.db=new(Br())(this.path||":memory:")),this.db&&typeof this.db.prepare=="function"&&!this.db.prepare.__wrapped){let e=this.db.prepare.bind(this.db),t=r=>{let s=e(r),n=o=>typeof o=="boolean"?o?1:0:o===void 0?null:o;return new Proxy(s,{get(o,i,c){if(i==="all")return (...d)=>o.all(...d.map(n));if(i==="get")return (...d)=>o.get(...d.map(n));if(i==="run")return (...d)=>o.run(...d.map(n));let l=Reflect.get(o,i,c);return typeof l=="function"?l.bind(o):l}})};t.__wrapped=true,this.db.prepare=t;}this.db.exec("PRAGMA journal_mode = WAL"),this.db.exec("PRAGMA foreign_keys = ON"),this.connected=true;}async disconnect(){this.db&&this.db.close(),this.connected=false;}ensureTable(e,t){let r=t||this.getTableNameFor(e.slug),s=["id TEXT PRIMARY KEY"];for(let i of x(e.fields)){if(!i.name||i.name==="id")continue;let c=this.fieldToSQL(i);c&&s.push(c);}let n=x(e.fields);n.some(i=>i.name==="createdAt")||s.push(`${this.col("createdAt")} TEXT DEFAULT (datetime('now'))`),n.some(i=>i.name==="updatedAt")||s.push(`${this.col("updatedAt")} TEXT DEFAULT (datetime('now'))`),n.some(i=>i.name==="status")||s.push("status TEXT DEFAULT 'draft'"),n.some(i=>i.name==="hasDraft")||s.push("hasDraft INTEGER DEFAULT 0"),e.tenantScoped&&s.push("tenant_id TEXT NOT NULL");let o=G(this.db,r);if(o.length===0){let i=`CREATE TABLE IF NOT EXISTS ${r} (${s.join(", ")})`;this.db.exec(i),this.db.exec(`CREATE INDEX IF NOT EXISTS idx_${r}_status ON ${r}(status)`);for(let c of x(e.fields))c.name&&c.indexed&&this.db.exec(`CREATE INDEX IF NOT EXISTS idx_${r}_${c.name} ON ${r}(${this.col(c.name)})`),c.name&&c.unique&&this.db.exec(`CREATE UNIQUE INDEX IF NOT EXISTS idx_${r}_${c.name}_unique ON ${r}(${this.col(c.name)})`);}else {let i=new Set(o);for(let c of s){let l=c.split(" ")[0].replace(/^"/,"").replace(/"$/,"");if(!i.has(l)&&l!=="id")try{l==="status"?this.db.exec(`ALTER TABLE ${r} ADD COLUMN ${this.col(l)} TEXT DEFAULT 'published'`):l==="hasDraft"?this.db.exec(`ALTER TABLE ${r} ADD COLUMN ${this.col(l)} INTEGER DEFAULT 0`):this.db.exec(`ALTER TABLE ${r} ADD COLUMN ${this.col(l)} TEXT`);}catch{}}}this.migrations.set(r,true);}ensureVersionsTable(){this.db.exec(`
2
+ CREATE TABLE IF NOT EXISTS ${this.versionsTableName} (
3
+ id TEXT PRIMARY KEY,
4
+ collection_slug TEXT NOT NULL,
5
+ document_id TEXT NOT NULL,
6
+ tenant_id TEXT,
7
+ version INTEGER NOT NULL,
8
+ status TEXT NOT NULL DEFAULT 'draft',
9
+ autosave INTEGER NOT NULL DEFAULT 0,
10
+ data TEXT NOT NULL,
11
+ created_by TEXT,
12
+ change_description TEXT,
13
+ published_at TEXT,
14
+ created_at TEXT DEFAULT (datetime('now')),
15
+ updated_at TEXT DEFAULT (datetime('now'))
16
+ )
17
+ `);try{this.db.exec(`ALTER TABLE ${this.versionsTableName} ADD COLUMN autosave INTEGER NOT NULL DEFAULT 0`);}catch{}this.db.exec(`CREATE INDEX IF NOT EXISTS idx_${this.versionsTableName}_doc ON ${this.versionsTableName}(collection_slug, document_id)`),this.db.exec(`CREATE INDEX IF NOT EXISTS idx_${this.versionsTableName}_status ON ${this.versionsTableName}(status)`),this.db.exec(`CREATE INDEX IF NOT EXISTS idx_${this.versionsTableName}_autosave ON ${this.versionsTableName}(autosave)`);}resolveCol(e,t){let r=t.replace(/^-/,""),s=G(this.db,e);if(!s.includes(r)){if(r==="created_at"&&s.includes("createdAt"))return '"createdAt"';if(r==="createdAt"&&s.includes("created_at"))return '"created_at"';if(r==="updated_at"&&s.includes("updatedAt"))return '"updatedAt"';if(r==="updatedAt"&&s.includes("updated_at"))return '"updated_at"'}return this.col(r)}col(e){return `"${e}"`}fieldToSQL(e){switch(e.type){case "text":case "email":case "password":case "textarea":case "color":case "icon":case "code":case "markdown":case "url":return this.col(e.name)+" TEXT";case "number":return this.col(e.name)+" REAL";case "checkbox":return this.col(e.name)+" INTEGER DEFAULT 0";case "date":return this.col(e.name)+" TEXT";case "select":case "radio":return this.col(e.name)+" TEXT";case "relationship":case "upload":return this.col(e.name)+" TEXT";case "json":case "richtext":case "array":case "group":case "blocks":return this.col(e.name)+" TEXT";default:return null}}parseGlobalsSlug(e){if(e.startsWith("_globals_")){let t=e.replace("_globals_","");return {isGlobal:true,globalSlug:t,tableName:`global_${t.replace(/-/g,"_")}`}}return {isGlobal:false,globalSlug:"",tableName:this.getTableNameFor(e)}}async find(e){let{collection:t,where:r={},sort:s,limit:n=10,page:o=1,tenantId:i,draft:c$1=false}=e,l=this.parseGlobalsSlug(t),d$1=l.isGlobal?this.globals.get(l.globalSlug):this.getCollection(t);this.ensureTable(d$1,l.tableName);let u=l.tableName,p=`SELECT * FROM ${u}`,m=[],g=[],h={...r};this.tenantContext&&d$1.tenantScoped&&(h=c({where:h},t,this.tenantContext,b).where||{});let y=d$1.fields.find(b=>b.name==="status"),f=y?.type==="select"&&Array.isArray(y.options)&&y.options.some(b=>b.value==="published");!c$1&&f&&(g.push("status = ?"),m.push("published")),i&&d$1.tenantScoped&&(g.push("tenant_id = ?"),m.push(i));for(let[b,T]of Object.entries(h)){if(b==="AND"||b==="OR")continue;let D=this.resolveCol(u,b);typeof T=="object"&&T!==null?(T.equals!==void 0&&(g.push(`${D} = ?`),m.push(T.equals)),T.in!==void 0&&(g.push(`${D} IN (${T.in.map(()=>"?").join(", ")})`),m.push(...T.in)),T.not_equals!==void 0&&(g.push(`${D} != ?`),m.push(T.not_equals))):(g.push(`${D} = ?`),m.push(T));}g.length>0&&(p+=` WHERE ${g.join(" AND ")}`);let N=s||"-createdAt",Q=this.resolveCol(u,N),Z=N.startsWith("-")?"DESC":"ASC";p+=` ORDER BY ${Q} ${Z}`;let et=p.replace("SELECT *","SELECT COUNT(*) as count"),F=this.db.prepare(et).get(...m)?.count||0;p+=" LIMIT ? OFFSET ?",m.push(n,(o-1)*n);let E=this.db.prepare(p).all(...m).map(b=>this.rowToDoc(b,d$1));return this.tenantContext&&!this.tenantContext.isSuperAdmin&&(E=E.filter(b$1=>d(b$1,t,this.tenantContext,b))),c$1&&(E=await Promise.all(E.map(async b=>{let T=this.db.prepare(`SELECT * FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? AND tenant_id IS NULL ORDER BY version DESC LIMIT 1`).get(t,b.id);if(T){let D=T.data?JSON.parse(T.data):{};return a$5({...b,...D,status:b.status})}return b}))),E=E.map(b=>a$5(b)),{docs:E,totalDocs:F,limit:n,totalPages:Math.ceil(F/n),page:o,pagingCounter:(o-1)*n+1,hasPrevPage:o>1,hasNextPage:o<Math.ceil(F/n),prevPage:o>1?o-1:null,nextPage:o<Math.ceil(F/n)?o+1:null}}async findByID(e){let{collection:t,id:r,tenantId:s,draft:n=false}=e,o=this.parseGlobalsSlug(t),i=o.isGlobal?this.globals.get(o.globalSlug):this.getCollection(t);this.ensureTable(i,o.tableName);let l=`SELECT * FROM ${o.tableName} WHERE id = ?`,d$1=[r];if(this.tenantContext&&i.tenantScoped){let h={id:r,tenant_id:this.tenantContext.tenantId};if(!d(h,t,this.tenantContext,b))return null}let u=i.fields.find(h=>h.name==="status"),p=u?.type==="select"&&Array.isArray(u.options)&&u.options.some(h=>h.value==="published");!n&&p&&(l+=" AND status = ?",d$1.push("published")),s&&i.tenantScoped&&(l+=" AND tenant_id = ?",d$1.push(s));let m=this.db.prepare(l).get(...d$1);if(!m)return null;let g=this.rowToDoc(m,i);if(n){let h=this.db.prepare(`SELECT * FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? AND tenant_id IS NULL ORDER BY version DESC LIMIT 1`).get(t,g.id);if(h){let y=h.data?JSON.parse(h.data):{};g={...g,...y,status:g.status};}}return a$5(g)}async create(e){let{collection:t,data:r,tenantId:s}=e,n=this.parseGlobalsSlug(t),o=n.isGlobal?this.globals.get(n.globalSlug):this.getCollection(t);this.ensureTable(o,n.tableName);let i=n.tableName,c=n.isGlobal?n.globalSlug:r.id||this.generateId(),l=this.prepareData(r,o);l.id=c,l.created_at=new Date().toISOString(),l.updated_at=new Date().toISOString(),s&&o.tenantScoped&&(l.tenant_id=s);let d=Object.keys(l),u=G(this.db,i),p={};for(let f of d)u.includes(f)&&(p[f]=l[f]);let m=Object.keys(p),g=m.map(f=>this.col(f)),h=m.map(()=>"?").join(", "),y=Object.values(p).map(f=>f!==null&&typeof f=="object"?JSON.stringify(f):f);return this.db.prepare(`INSERT OR REPLACE INTO ${i} (${g.join(", ")}) VALUES (${h})`).run(...y),this.ensureVersionsTable(),this.findByID({collection:t,id:c,tenantId:s,draft:true})}async update(e){let{collection:t,id:r,data:s,tenantId:n}=e,o=this.parseGlobalsSlug(t),i=o.isGlobal?this.globals.get(o.globalSlug):this.getCollection(t);this.ensureTable(i,o.tableName);let c=o.tableName,l=this.prepareData(s,i);l.updated_at=new Date().toISOString();let d=G(this.db,c),u={};for(let f of Object.keys(l))d.includes(f)&&(u[f]=l[f]);let m=Object.keys(u).map(f=>`${this.col(f)} = ?`).join(", "),g=Object.values(u).map(f=>f!==null&&typeof f=="object"?JSON.stringify(f):f),h=`UPDATE ${c} SET ${m} WHERE id = ?`,y=[...g,r];return n&&i.tenantScoped&&(h+=" AND tenant_id = ?",y.push(n)),this.db.prepare(h).run(...y),this.ensureVersionsTable(),this.findByID({collection:t,id:r,tenantId:n,draft:true})}async delete(e){let{collection:t,id:r,tenantId:s}=e,n=this.parseGlobalsSlug(t),o=n.isGlobal?this.globals.get(n.globalSlug):this.getCollection(t);this.ensureTable(o,n.tableName),this.ensureVersionsTable();let i=await this.findByID({collection:t,id:r,tenantId:s,draft:true});if(!i)throw new Error(`Document not found: ${t}/${r}`);let l=`DELETE FROM ${n.tableName} WHERE id = ?`,d=[r];return s&&o.tenantScoped&&(l+=" AND tenant_id = ?",d.push(s)),this.db.prepare(l).run(...d),i}async count(e){let{collection:t,tenantId:r}=e,s=this.parseGlobalsSlug(t),n=s.isGlobal?this.globals.get(s.globalSlug):this.getCollection(t);this.ensureTable(n,s.tableName);let i=`SELECT COUNT(*) as count FROM ${s.tableName}`,c=[];return r&&n.tenantScoped&&(i+=" WHERE tenant_id = ?",c.push(r)),this.db.prepare(i).get(...c)?.count||0}async findOne(e){let t=this.parseGlobalsSlug(e.collection);if(t.isGlobal){let s=this.globals.get(t.globalSlug);if(!s)throw new Error(`Global "${t.globalSlug}" not found in adapter`);this.ensureTable(s,t.tableName);let n=`SELECT * FROM ${t.tableName}`,o=[],i=[],c=s.fields.find(u=>u.name==="status"),l=c?.type==="select"&&Array.isArray(c.options)&&c.options.some(u=>u.value==="published");!e.draft&&s.versions&&l&&o.push("status = 'published'"),o.length>0&&(n+=` WHERE ${o.join(" AND ")}`),n+=" LIMIT 1";let d=this.db.prepare(n).get(...i);if(d){let u=this.rowToDoc(d,s);if(e.draft){let p=this.db.prepare(`SELECT * FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? AND tenant_id IS NULL ORDER BY version DESC LIMIT 1`).get(e.collection,t.globalSlug);if(p){let m=p.data?JSON.parse(p.data):{};u={...u,...m,status:u.status};}}return u}return null}return (await this.find({...e,limit:1})).docs[0]||null}async findVersions(e){this.ensureVersionsTable();let{collection:t,documentId:r,tenantId:s,limit:n=20,page:o=1}=e,i=["collection_slug = ?","document_id = ?","autosave = 0"],c=[t,r];s?(i.push("tenant_id = ?"),c.push(s)):i.push("tenant_id IS NULL");let l=`WHERE ${i.join(" AND ")}`,u=this.db.prepare(`SELECT COUNT(*) as count FROM ${this.versionsTableName} ${l}`).get(...c)?.count||0,p=(o-1)*n;return {docs:this.db.prepare(`SELECT * FROM ${this.versionsTableName} ${l} ORDER BY version DESC LIMIT ? OFFSET ?`).all(...c,n,p).map(h=>this.rowToVersion(h)),totalDocs:u,limit:n,totalPages:Math.ceil(u/n),page:o,pagingCounter:(o-1)*n+1,hasPrevPage:o>1,hasNextPage:o<Math.ceil(u/n),prevPage:o>1?o-1:null,nextPage:o<Math.ceil(u/n)?o+1:null}}async findVersionByID(e){this.ensureVersionsTable();let t=this.db.prepare(`SELECT * FROM ${this.versionsTableName} WHERE id = ? AND collection_slug = ? LIMIT 1`).get(e.versionId,e.collection);return t?this.rowToVersion(t):null}async createVersion(e){this.ensureVersionsTable();let t=new Date().toISOString();if(e.autosave){let i=`SELECT * FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? AND autosave = 1`,c=[e.collection,e.documentId];e.tenantId?(i+=" AND tenant_id = ?",c.push(e.tenantId)):i+=" AND tenant_id IS NULL",i+=" LIMIT 1";let l=this.db.prepare(i).get(...c);if(l){this.db.prepare(`UPDATE ${this.versionsTableName} SET data = ?, status = ?, updated_at = ? WHERE id = ?`).run(JSON.stringify(e.data),e.status,t,l.id);let d=await this.findVersionByID({collection:e.collection,versionId:l.id});if(d)return d}}let r=this.generateId(),n=(this.db.prepare(`SELECT version FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? AND autosave = 0 ORDER BY version DESC LIMIT 1`).get(e.collection,e.documentId)?.version??0)+1;if(this.db.prepare(`INSERT INTO ${this.versionsTableName} (
18
+ id, collection_slug, document_id, tenant_id, version, status, autosave, data, created_by, change_description, published_at, created_at, updated_at
19
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(r,e.collection,e.documentId,e.tenantId??null,n,e.status,e.autosave?1:0,JSON.stringify(e.data),e.createdBy??null,e.changeDescription??null,e.status==="published"?t:null,t,t),!e.autosave){let c=this.collections.get(e.collection)?.versions?.maxPerDoc;c&&c>0&&await this.deleteVersions({collection:e.collection,documentId:e.documentId,keepLatest:c,tenantId:e.tenantId});}return await this.findVersionByID({collection:e.collection,versionId:r})}async updateLatestVersion(e){return this.createVersion({...e,autosave:true})}async deleteVersions(e){this.ensureVersionsTable();let{collection:t,documentId:r,keepLatest:s,tenantId:n}=e;if(s&&s>0){let o=this.db.prepare(`SELECT id, status, autosave FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ? ORDER BY version DESC`).all(t,r),i=0,c=[];for(let l of o)l.status==="published"||l.autosave===1||(i++,i>s&&c.push(l.id));for(let l of c)this.db.prepare(`DELETE FROM ${this.versionsTableName} WHERE id = ?`).run(l);}else {let o=`DELETE FROM ${this.versionsTableName} WHERE collection_slug = ? AND document_id = ?`,i=[t,r];n&&(o+=" AND tenant_id = ?",i.push(n)),this.db.prepare(o).run(...i);}}rowToVersion(e){return {id:String(e.id),collection:e.collection_slug,documentId:e.document_id,version:e.version,status:e.status,data:e.data?JSON.parse(e.data):{},createdBy:e.created_by??void 0,changeDescription:e.change_description??void 0,publishedAt:e.published_at??null,createdAt:e.created_at,updatedAt:e.updated_at}}prepareData(e,t){let r={},s=x(t.fields),n=(o,i)=>{let c=o;if(c.type==="json"||c.type==="richtext"||c.type==="array"||c.type==="group"||c.type==="blocks"||c.type==="list"||c.type==="relationship-block")return i!=null?JSON.stringify(i):null;if(c.type==="checkbox")return i?1:0;if(c.type==="number")return i!==null&&i!==""?Number(i):null;if(c.type==="upload"||c.type==="image"){if(i==null)return null;if(Array.isArray(i)){let l=i.map(d=>typeof d=="string"?d:typeof d=="object"?d.id||d._id||d:String(d));return JSON.stringify(l)}return typeof i=="string"?i:typeof i=="object"?JSON.stringify(i):String(i)}else if(o.type==="relationship"){if(i==null)return null;if(Array.isArray(i)){let l=i.map(d=>typeof d=="string"?d:typeof d=="object"?JSON.stringify({relationTo:o.relationTo,value:d.id||d}):String(d));return JSON.stringify(l)}return typeof i=="string"?i:typeof i=="object"?JSON.stringify({relationTo:o.relationTo,value:i.id||i}):String(i)}return i};for(let o of s){if(!o.name||o.name==="id"||t.fields.some(l=>l.type==="tabs"&&l.name&&"tabs"in l&&l.tabs.some(d=>d.fields.some(u=>u.name===o.name))))continue;let c=e[o.name];c!==void 0&&(r[o.name]=n(o,c));}for(let o of t.fields)if(o.type==="tabs"&&"tabs"in o&&o.name){let i=e[o.name];if(i&&typeof i=="object"){for(let c of o.tabs)for(let l of c.fields)if(l.name&&l.name!=="id"){let d=i[l.name];d!==void 0&&(r[l.name]=n(l,d));}}}return r}rowToDoc(e,t){let r={id:e.id};for(let s of x(t.fields)){if(!s.name||s.name==="id")continue;let n=s,o=e[n.name];if(n.type==="json"||n.type==="richtext"||n.type==="array"||n.type==="group"||n.type==="blocks"||n.type==="list"||n.type==="relationship-block")try{o=o?JSON.parse(o):null;}catch{o=null;}if(n.type==="blocks"&&o&&Array.isArray(o)){let i=n.blocks||[];o=Be(o,i);}if(s.type==="checkbox"&&(o=!!o),s.type==="date"&&o)try{let i=new Date(o);isNaN(i.getTime())?(console.warn(`[LocalAdapter] Invalid date value for field "${s.name}":`,o),o=null):o=i.toISOString();}catch{o=null;}if((s.type==="upload"||s.type==="image")&&o)try{let i=JSON.parse(o);Array.isArray(i)?o=i.map(c=>typeof c=="object"&&c!==null?c:{id:c}):o=typeof i=="object"?i:{id:i};}catch{o={id:o};}if(s.type==="relationship"&&o)try{let i=JSON.parse(o);Array.isArray(i),o=i;}catch{o={relationTo:Array.isArray(s.relationTo)?s.relationTo[0]:s.relationTo,value:o};}r[s.name]=o;}for(let s of t.fields)if(!(!s.name||s.name==="id"||s.name==="row"||s.name==="collapsible")&&s.type==="tabs"&&"tabs"in s){let n={};for(let o of s.tabs)for(let i of o.fields)i.name&&i.name!=="id"&&(n[i.name]=Kr(e,i));r[s.name]=n;}if(t.timestamps){let s=e.createdAt||e.created_at,n=e.updatedAt||e.updated_at;if(s)try{let o=new Date(s);isNaN(o.getTime())||(r.createdAt=o.toISOString());}catch{}if(n)try{let o=new Date(n);isNaN(o.getTime())||(r.updatedAt=o.toISOString());}catch{}}t.tenantScoped&&(r.tenantId=e.tenant_id),r.status=e.status??"published",r.hasDraft=e.hasDraft?!!e.hasDraft:false;for(let s of Object.keys(r))/^\d+$/.test(s)&&delete r[s];return r}generateId(){let e=Date.now().toString(16).padStart(12,"0"),t=randomBytes(6).toString("hex");return e+t}getMediaById(e){try{let t=this.getTableNameFor("media"),r=this.db.prepare(`SELECT id, url, thumbnail_url FROM ${t} WHERE id = ?`).get(e);if(r)return {id:r.id,url:r.url,thumbnailUrl:r.thumbnail_url||r.url}}catch{}return null}getTableNameFor(e){return e.replace(/-/g,"_")}async migrate(){for(let e of this.collections.values())this.ensureTable(e);}async rollback(){}async transaction(e){return new Promise((t,r)=>{let s=this.db.transaction(async()=>e({db:this.db}));try{let n=s();t(n);}catch(n){r(n);}})}getDatabase(){return this.db}exec(e){this.db.exec(e);}prepare(e){return this.db.prepare(e)}};function ne(a){return new k(a||{})}var U=class extends a$4{connectionString;constructor(e){super(),this.connectionString=e.connectionString;}async connect(){this.connected=true;}async disconnect(){this.connected=false;}async query(e,t=[]){if(!this.connectionString)throw new Error("NeonAdapter: Connection string is required.");try{let r=await fetch(`${this.connectionString}/sql`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,params:t})});return r.ok?(await r.json()).rows||[]:[]}catch{return []}}async find(e){return {docs:[],totalDocs:0,limit:e.limit||10,totalPages:1,page:e.page||1,hasNextPage:false,hasPrevPage:false}}async findByID(e){return null}async create(e){return e.data}async update(e){return e.data}async delete(e){return {success:true,id:e.id}}async count(e){return 0}async findOne(e){return null}async findVersions(e){return {docs:[],totalDocs:0,limit:10,totalPages:1,page:1,hasNextPage:false,hasPrevPage:false}}async findVersionByID(e){return null}async createVersion(e){return {id:"v1",parentId:e.documentId,version:e.version||1,snapshot:e.snapshot||{},createdAt:new Date().toISOString()}}async updateLatestVersion(e){return {id:"v1",parentId:e.documentId,version:e.version||1,snapshot:e.snapshot||{},createdAt:new Date().toISOString()}}async deleteVersions(e){}};function je(a){return new U(a)}var V=class extends a$4{url;authToken;constructor(e){super(),this.url=e.url.replace(/^libsql:\/\//,"https://"),this.authToken=e.authToken;}async connect(){this.connected=true;}async disconnect(){this.connected=false;}async query(e,t=[]){if(!this.url)throw new Error("TursoAdapter: Database URL is required.");try{let r={"Content-Type":"application/json"};this.authToken&&(r.Authorization=`Bearer ${this.authToken}`);let s=await fetch(`${this.url}/v2/pipeline`,{method:"POST",headers:r,body:JSON.stringify({requests:[{type:"execute",stmt:{sql:e,args:t.map(c=>({type:"text",value:String(c)}))}},{type:"close"}]})});if(!s.ok)return [];let o=(await s.json())?.results?.[0]?.response?.result;if(!o||!o.rows)return [];let i=o.cols.map(c=>c.name);return o.rows.map(c=>{let l={};return i.forEach((d,u)=>{l[d]=c[u]?.value??null;}),l})}catch{return []}}async find(e){return {docs:[],totalDocs:0,limit:e.limit||10,totalPages:1,page:e.page||1,hasNextPage:false,hasPrevPage:false}}async findByID(e){return null}async create(e){return e.data}async update(e){return e.data}async delete(e){return {success:true,id:e.id}}async count(e){return 0}async findOne(e){return null}async findVersions(e){return {docs:[],totalDocs:0,limit:10,totalPages:1,page:1,hasNextPage:false,hasPrevPage:false}}async findVersionByID(e){return null}async createVersion(e){return {id:"v1",parentId:e.documentId,version:e.version||1,snapshot:e.snapshot||{},createdAt:new Date().toISOString()}}async updateLatestVersion(e){return {id:"v1",parentId:e.documentId,version:e.version||1,snapshot:e.snapshot||{},createdAt:new Date().toISOString()}}async deleteVersions(e){}};function Ke(a){return new V(a)}var Wr={maxAttempts:5,lockDuration:9e5,notifyUser:true,notifyAdmin:true,adminNotifyAfter:3},I=class{redis;prefix;config;constructor(e,t={},r="kyro:lockout:"){this.redis=e,this.prefix=r,this.config={...Wr,...t};}lockKey(e){return `${this.prefix}${e}`}historyKey(e){return `${this.prefix}${e}:history`}async checkLockout(e){let t=this.lockKey(e),r=await this.redis.hgetall(t);if(!r||Object.keys(r).length===0)return {locked:false,attemptsRemaining:this.config.maxAttempts,totalAttempts:0};let s=parseInt(r.attempts,10),n=r.lockedUntil?new Date(parseInt(r.lockedUntil,10)):void 0;return n&&n>new Date?{locked:true,attemptsRemaining:0,lockedUntil:n,totalAttempts:s}:n&&n<=new Date?(await this.unlockAccount(e),{locked:false,attemptsRemaining:this.config.maxAttempts,totalAttempts:0}):{locked:false,attemptsRemaining:Math.max(0,this.config.maxAttempts-s),totalAttempts:s}}async recordFailedAttempt(e){let t=this.lockKey(e),r=this.historyKey(e),s=Date.now(),n=await this.redis.hincrby(t,"attempts",1);if(await this.redis.hset(t,"lastAttempt",s.toString()),await this.redis.lpush(r,s.toString()),await this.redis.ltrim(r,0,99),n>=this.config.maxAttempts){let o=new Date(s+this.config.lockDuration);return await this.redis.hset(t,{lockedAt:s.toString(),lockedUntil:o.getTime().toString()}),await this.redis.expire(t,Math.ceil(this.config.lockDuration/1e3)+3600),{locked:true,attemptsRemaining:0,lockedUntil:o,totalAttempts:n}}return {locked:false,attemptsRemaining:Math.max(0,this.config.maxAttempts-n),totalAttempts:n}}async lockAccount(e,t){let r=this.lockKey(e),s=Date.now(),n=t||this.config.lockDuration,o=new Date(s+n),i=this.redis.pipeline();i.hset(r,{attempts:this.config.maxAttempts.toString(),lockedAt:s.toString(),lockedUntil:o.getTime().toString()}),i.expire(r,Math.ceil(n/1e3)+3600),await i.exec();}async unlockAccount(e){let t=this.lockKey(e);await this.redis.del(t);}async resetAttempts(e){let t=this.lockKey(e);(await this.redis.hgetall(t)).lockedAt?await this.redis.hset(t,{attempts:"0",lockedAt:"",lockedUntil:""}):await this.redis.del(t);}async getLockoutHistory(e,t=10){let r=this.historyKey(e);return (await this.redis.lrange(r,0,t-1)).map(n=>new Date(parseInt(n,10)))}async getLockoutStats(e){let t=this.historyKey(e),r=await this.redis.lrange(t,0,-1),s=r.filter((o,i)=>(i+1)%this.config.maxAttempts===0).length,n=await this.redis.hget(this.lockKey(e),"lockedAt");return {totalFailedAttempts:r.length,lockoutCount:s,lastLockout:n?new Date(parseInt(n,10)):null,averageAttemptsBeforeLockout:s>0?this.config.maxAttempts:0}}shouldNotifyAdmin(e){return this.config.notifyAdmin&&e>=this.config.adminNotifyAfter}getConfig(){return {...this.config}}setConfig(e){this.config={...this.config,...e};}};var zr={"auth:login":{window:9e5,max:5},"auth:register":{window:36e5,max:3},"auth:forgot":{window:36e5,max:3},"auth:reset":{window:36e5,max:5},"auth:verify":{window:36e5,max:5},"api:general":{window:6e4,max:100},"api:authenticated":{window:6e4,max:200}},v=class{redis;prefix;limits;userLimits;constructor(e,t,r,s="kyro:ratelimit:"){this.redis=e,this.prefix=s,this.limits={...zr,...t},this.userLimits=r||{"user:api":{window:6e4,max:500},"user:write":{window:36e5,max:100}};}getKey(e,t){return `${this.prefix}${e}:${t}`}async check(e,t){let r=this.limits[e]||this.limits["api:general"],s=this.getKey(e,t),n=Date.now(),o=n-r.window,i=this.redis.pipeline();i.zremrangebyscore(s,0,o),i.zcard(s),i.zadd(s,n,`${n}:${Math.random()}`),i.expire(s,Math.ceil(r.window/1e3)+1);let l=(await i.exec())?.[1]?.[1]||0;if(l>=r.max){let d=await this.redis.zrange(s,0,0,"WITHSCORES"),u=d.length>1?parseInt(d[1],10)+r.window:n+r.window;return {allowed:false,remaining:0,resetAt:u,retryAfter:Math.ceil((u-n)/1e3)}}return {allowed:true,remaining:r.max-l-1,resetAt:n+r.window}}async checkUser(e,t,r){let s=this.userLimits[e]||this.userLimits["user:api"],n=this.getKey(`user:${e}:${t}`,r),o=Date.now(),i=o-s.window,c=this.redis.pipeline();c.zremrangebyscore(n,0,i),c.zcard(n),c.zadd(n,o,`${o}:${Math.random()}`),c.expire(n,Math.ceil(s.window/1e3)+1);let d=(await c.exec())?.[1]?.[1]||0;if(d>=s.max){let u=await this.redis.zrange(n,0,0,"WITHSCORES"),p=u.length>1?parseInt(u[1],10)+s.window:o+s.window;return {allowed:false,remaining:0,resetAt:p,retryAfter:Math.ceil((p-o)/1e3)}}return {allowed:true,remaining:s.max-d-1,resetAt:o+s.window}}async reset(e,t){let r=this.getKey(e,t);await this.redis.del(r);}async resetUser(e,t,r){let s=this.getKey(`user:${e}:${t}`,r);await this.redis.del(s);}async getStatus(e,t){let r=this.limits[e]||this.limits["api:general"],s=this.getKey(e,t),n=Date.now(),o=n-r.window;await this.redis.zremrangebyscore(s,0,o);let i=await this.redis.zcard(s);return {count:i,limit:r.max,remaining:Math.max(0,r.max-i),resetAt:n+r.window}}setLimit(e,t){this.limits[e]=t;}setUserLimit(e,t){this.userLimits[e]=t;}};var L=class{users=new Map;sessions=new Map;refreshTokens=new Map;emailToUserId=new Map;passwordHistory=new Map;emailVerificationTokens=new Map;passwordResetTokens=new Map;auditLogs=[];externalDb=false;constructor(){}async connect(){}async disconnect(){this.users.clear(),this.sessions.clear(),this.refreshTokens.clear(),this.emailToUserId.clear(),this.passwordHistory.clear();}async createUser(e){let t=randomBytes(16).toString("hex"),r=new Date().toISOString(),s=await this.hashPassword(e.password),n={id:t,email:e.email.toLowerCase(),passwordHash:s,role:e.role||"customer",tenantId:e.tenantId,createdAt:r,updatedAt:r};return this.users.set(t,n),this.emailToUserId.set(e.email.toLowerCase(),t),this.passwordHistory.set(t,[]),n}async findUserByEmail(e){let t=this.emailToUserId.get(e.toLowerCase());return t?this.findUserById(t):null}async findUserById(e){return this.users.get(e)||null}async updateUser(e,t){let r=await this.findUserById(e);if(!r)return null;let s={...r,...t,id:e,updatedAt:new Date().toISOString()};return t.email&&t.email!==r.email&&(this.emailToUserId.delete(r.email.toLowerCase()),this.emailToUserId.set(t.email.toLowerCase(),e)),this.users.set(e,s),s}async deleteUser(e){let t=await this.findUserById(e);return t?(this.users.delete(e),this.emailToUserId.delete(t.email.toLowerCase()),this.refreshTokens.forEach((r,s)=>{this.sessions.get(r)?.userId===e&&(this.refreshTokens.delete(s),this.sessions.delete(r));}),this.passwordHistory.delete(e),this.sessions.forEach((r,s)=>{r.userId===e&&this.sessions.delete(s);}),true):false}async hashPassword(e){return (await import('bcryptjs')).default.hash(e,12)}async verifyPassword(e,t){let r=await this.findUserByEmail(e);return !r||!r.passwordHash?null:await(await import('bcryptjs')).default.compare(t,r.passwordHash)?r:null}async createSession(e,t={}){let r=randomBytes(32).toString("hex"),s=randomBytes(32).toString("base64url"),n=randomBytes(32).toString("base64url"),o=new Date,i={id:r,userId:e,token:s,refreshToken:n,expiresAt:new Date(o.getTime()+86400*1e3).toISOString(),createdAt:o.toISOString(),ipAddress:t.ipAddress,userAgent:t.userAgent};return this.sessions.set(r,i),this.refreshTokens.set(n,r),i}async findSessionByToken(e){return this.sessions.get(e)||null}async findSessionByRefreshToken(e){let t=this.refreshTokens.get(e);return t&&this.sessions.get(t)||null}async deleteSession(e){let t=this.sessions.get(e);return t?(t.refreshToken&&this.refreshTokens.delete(t.refreshToken),this.sessions.delete(e),true):false}async deleteUserSessions(e){let t=0;return this.sessions.forEach((r,s)=>{r.userId===e&&(r.refreshToken&&this.refreshTokens.delete(r.refreshToken),this.sessions.delete(s),t++);}),t}async addPasswordToHistory(e,t){let r=this.passwordHistory.get(e)||[];r.push(t),r.length>5&&r.splice(0,r.length-5),this.passwordHistory.set(e,r);}async getPasswordHistory(e,t=5){return this.passwordHistory.get(e)||[]}async isPasswordInHistory(e,t,r=5){let s=await this.getPasswordHistory(t,r),n=(await import('bcryptjs')).default;for(let o of s)if(await n.compare(e,o))return true;return false}async createEmailVerificationToken(e){let t=randomBytes(32).toString("hex"),r=new Date(Date.now()+1440*60*1e3);return this.emailVerificationTokens.set(t,{userId:e,expiresAt:r}),{token:t,expiresAt:r}}async verifyEmailToken(e){let t=this.emailVerificationTokens.get(e);return !t||t.expiresAt<new Date?(this.emailVerificationTokens.delete(e),{success:false,error:"Invalid or expired token"}):(this.emailVerificationTokens.delete(e),{success:true,userId:t.userId})}async createPasswordResetToken(e){let t=await this.findUserByEmail(e);if(!t)return {token:"",expiresAt:new Date,error:"User not found"};let r=randomBytes(32).toString("hex"),s=new Date(Date.now()+3600*1e3);return this.passwordResetTokens.set(r,{userId:t.id,expiresAt:s}),{token:r,expiresAt:s}}async resetPasswordWithToken(e,t){let r=this.passwordResetTokens.get(e);if(!r||r.expiresAt<new Date)return this.passwordResetTokens.delete(e),{success:false,error:"Invalid or expired token"};let s=await this.hashPassword(t);return await this.updateUser(r.userId,{passwordHash:s}),this.passwordResetTokens.delete(e),{success:true}}async hasAnyUsers(){return this.users.size>0}async findAuditLogs(e){let{limit:t=50,offset:r=0}=e,s=this.auditLogs.slice().reverse();return e.userId&&(s=s.filter(n=>n.userId===e.userId)),e.action&&(Array.isArray(e.action)?s=s.filter(n=>e.action.includes(String(n.action))):s=s.filter(n=>n.action===e.action)),e.resource&&(s=s.filter(n=>n.resource===e.resource)),e.success!==void 0&&(s=s.filter(n=>n.success===e.success)),{logs:s.slice(r,r+t),total:s.length}}async createAuditLog(e){let t=randomBytes(16).toString("hex"),s={...e,id:t,timestamp:new Date};return this.auditLogs.push(s),s}};var O=class{storage=new Map;history=new Map;config;constructor(e={}){this.config={maxAttempts:5,lockDuration:9e5,notifyUser:true,notifyAdmin:true,adminNotifyAfter:3,...e};}async checkLockout(e){let t=Date.now(),r=this.storage.get(e);if(r&&r.lockedUntil!==null&&r.lockedUntil<=t)return await this.resetAttempts(e),{locked:false,attemptsRemaining:this.config.maxAttempts,totalAttempts:0};if(!r)return {locked:false,attemptsRemaining:this.config.maxAttempts,totalAttempts:0};let{attempts:s,lockedUntil:n}=r;return n!==null&&n>t?{locked:true,attemptsRemaining:0,lockedUntil:new Date(n),totalAttempts:s}:{locked:false,attemptsRemaining:Math.max(0,this.config.maxAttempts-s),totalAttempts:s}}async recordFailedAttempt(e){let t=Date.now(),r=this.storage.get(e)||{attempts:0,lastAttempt:null,lockedAt:null,lockedUntil:null};r.attempts+=1,r.lastAttempt=t;let s=this.history.get(e)||[];if(s.push(t),s.length>100&&s.splice(0,s.length-100),this.history.set(e,s),this.storage.set(e,r),r.attempts>=this.config.maxAttempts){let n=new Date(t+this.config.lockDuration);return r.lockedAt=t,r.lockedUntil=n.getTime(),this.storage.set(e,r),{locked:true,attemptsRemaining:0,lockedUntil:n,totalAttempts:r.attempts}}return {locked:false,attemptsRemaining:Math.max(0,this.config.maxAttempts-r.attempts),totalAttempts:r.attempts}}async lockAccount(e,t){let r=Date.now(),s=t||this.config.lockDuration,n=new Date(r+s),o=this.storage.get(e)||{attempts:0,lastAttempt:null,lockedAt:null,lockedUntil:null};o.attempts=this.config.maxAttempts,o.lockedAt=r,o.lockedUntil=n.getTime(),this.storage.set(e,o);}async unlockAccount(e){await this.resetAttempts(e);}async resetAttempts(e){let t=this.storage.get(e);t&&(t.attempts=0,t.lockedAt=null,t.lockedUntil=null,this.storage.set(e,t)),this.history.delete(e);}async getLockoutHistory(e,t=10){return (this.history.get(e)||[]).slice(-t).reverse().map(s=>new Date(s))}async getLockoutStats(e){let r=(this.history.get(e)||[]).length,s=Math.floor(r/this.config.maxAttempts),n=null,o=this.storage.get(e);o&&o.lockedAt!==null&&(n=new Date(o.lockedAt));let i=s>0?this.config.maxAttempts:0;return {totalFailedAttempts:r,lockoutCount:s,lastLockout:n,averageAttemptsBeforeLockout:i}}shouldNotifyAdmin(e){return this.config.notifyAdmin&&e>=this.config.adminNotifyAfter}getConfig(){return {...this.config}}setConfig(e){this.config={...this.config,...e};}};function S(a,e=""){return process.env[a]||e}function P(a,e=false){let t=process.env[a];return t?t.toLowerCase()==="true":e}function A(a,e=0){let t=process.env[a];return t?parseInt(t,10):e}function We(){let a=process.env.KYRO_AUTH_DATABASE?.toLowerCase();if(a&&["sqlite","postgres","mongodb","memory"].includes(a))return a;try{let e=join(process.cwd(),"kyro.config.ts"),t=readFileSync(e,"utf8");if(t.includes("createLocalAdapter"))return "sqlite";if(t.includes("createDrizzleAdapter"))return t.includes("postgres")||t.includes("postgresql"),"postgres";if(t.includes("createMongoDBAdapter"))return "mongodb"}catch{}return "memory"}async function Xr(a$4){let e=process.cwd(),t=e.endsWith("admin")?join(e,".."):e,r=resolve(t,"data","auth.db");switch(a$4){case "sqlite":return new a$2({path:S("KYRO_AUTH_DB_PATH",r)});case "postgres":{let s=S("DATABASE_URL","");if(s){let n,o;try{n=(await import('drizzle-orm/postgres-js')).drizzle,o=await import('postgres');}catch{a(["postgres","drizzle-orm"]),n=(await import('drizzle-orm/postgres-js')).drizzle,o=await import('postgres');}let i=o.default(s,{onnotice:()=>{}}),c=n(i);return new a$3({db:c})}return new a$2({path:S("KYRO_AUTH_DB_PATH",r)})}case "mongodb":{let s=S("MONGODB_URI","");if(s){let n;try{n=(await import('mongodb')).MongoClient;}catch{a(["mongodb"]),n=(await import('mongodb')).MongoClient;}let o=new n(s);await o.connect();let c=new URL(s).pathname.replace(/^\//,"")||"kyro_cms",l=o.db(c);return new a$1({db:l})}return new a$2({path:S("KYRO_AUTH_DB_PATH",r)})}default:return new L}}async function oe(a,e){let t=P("KYRO_DISTRIBUTED",false),r;if(t){let{RedisAuthAdapter:u}=await import('./redis-adapter-NN3H4GRX.js'),p=S("REDIS_URL","redis://localhost:6379"),m=P("REDIS_TLS",false),g=new u({url:p,tls:m});await g.connect?.(),r=g;}else {let u=a||We();r=await Xr(u),r.connect&&await r.connect();}let s=e?await k$1.fromConfig(e).catch(()=>null)||k$1.fromEnv()||void 0:k$1.fromEnv()||void 0,n$1=new l$1({minLength:A("PASSWORD_MIN_LENGTH",12),requireUppercase:P("PASSWORD_REQUIRE_UPPERCASE",true),requireLowercase:P("PASSWORD_REQUIRE_LOWERCASE",true),requireNumbers:P("PASSWORD_REQUIRE_NUMBERS",true),requireSpecialChars:P("PASSWORD_REQUIRE_SPECIAL",true),preventReuse:A("PASSWORD_PREVENT_REUSE",5),maxLength:A("PASSWORD_MAX_LENGTH",128)}),o,i,c;if(t){let p=r.redis;o=new I(p,{maxAttempts:A("LOCKOUT_MAX_ATTEMPTS",5),lockDuration:A("LOCKOUT_DURATION_MINUTES",15)*60*1e3}),i=new v(p,{"auth:login":{window:A("RATE_LIMIT_AUTH_WINDOW_MS",9e5),max:A("RATE_LIMIT_AUTH_MAX_REQUESTS",10)},"api:general":{window:A("RATE_LIMIT_WINDOW_MS",6e4),max:A("RATE_LIMIT_MAX_REQUESTS",100)}}),c=new n(p,A("AUDIT_LOG_RETENTION_DAYS",30));}else o=new O({maxAttempts:A("LOCKOUT_MAX_ATTEMPTS",5),lockDuration:A("LOCKOUT_DURATION_MINUTES",15)*60*1e3}),i=new m({"auth:login":{window:A("RATE_LIMIT_AUTH_WINDOW_MS",9e5),max:A("RATE_LIMIT_AUTH_MAX_REQUESTS",10)},"api:general":{window:A("RATE_LIMIT_WINDOW_MS",6e4),max:A("RATE_LIMIT_MAX_REQUESTS",100)}}),c=P("AUDIT_LOG_ENABLED",true)?new p(A("AUDIT_LOG_RETENTION_DAYS",30)):void 0;let l=new q$1({redis:r,email:s,jwtSecret:S("APP_SECRET","change-me"),jwtExpiresIn:S("JWT_EXPIRES_IN","24h"),jwtIssuer:S("JWT_ISSUER","kyro-cms"),jwtAudience:S("JWT_AUDIENCE","kyro-cms-client"),passwordPolicy:n$1,lockout:o,rateLimiter:i,auditLogger:c,baseUrl:S("EMAIL_BASE_URL","http://localhost:4321"),emailVerificationRequired:P("EMAIL_VERIFICATION_REQUIRED",true)}),d=t?"distributed":a||We();return {authAdapter:r,databaseType:d,email:s,passwordPolicy:n$1,lockout:o,rateLimiter:i,auditLogger:c,routes:l}}var Ge=oe().catch(a=>(console.warn("[AuthConfig] Failed to initialize auth config:",a.message),null));var Jr=12,Yr="24h",Qr="7d",q=class{adapter;config;constructor(e,t){this.adapter=e,this.config={secret:t.secret,expiresIn:t.expiresIn??Yr,refreshExpiresIn:t.refreshExpiresIn??Qr,issuer:t.issuer??"kyro-cms",audience:t.audience??[],saltRounds:t.saltRounds??Jr};}async register(e){try{if(await this.adapter.findUserByEmail(e.email))return {success:!1,error:"Email already registered"};let r=await this.adapter.createUser({email:e.email,password:e.password,role:e.role??"customer",tenantId:e.tenantId});return this.createSessionForUser(r)}catch(t){return {success:false,error:String(t)}}}async login(e){try{let t=await this.adapter.verifyPassword(e.email,e.password);return t?this.createSessionForUser(t):{success:!1,error:"Invalid credentials"}}catch(t){return {success:false,error:String(t)}}}async logout(e){await this.adapter.deleteSession(e);}async refreshToken(e){try{let t=await this.adapter.findSessionByToken(e);if(!t||new Date(t.expiresAt)<new Date)return {success:!1,error:"Invalid or expired refresh token"};let r=await this.adapter.findUserById(t.userId);return r?(await this.adapter.deleteSession(e),this.createSessionForUser(r)):{success:!1,error:"User not found"}}catch(t){return {success:false,error:String(t)}}}async verifyToken(e){try{let{default:t}=await import('jsonwebtoken');return t.verify(e,this.config.secret,{issuer:this.config.issuer,audience:this.config.audience.length>0?this.config.audience[0]:void 0})}catch{return null}}async getUserFromToken(e){let t=await this.verifyToken(e);return t?this.adapter.findUserById(t.sub):null}async changePassword(e,t,r){try{let s=await this.adapter.findUserById(e);return s?await this.adapter.verifyPassword(s.email,t)?(await this.adapter.updateUser(e,{password:r}),await this.adapter.deleteUserSessions(e),{success:!0,user:s}):{success:!1,error:"Current password is incorrect"}:{success:!1,error:"User not found"}}catch(s){return {success:false,error:String(s)}}}async resetPassword(e,t){try{let r=await this.adapter.findUserByEmail(e);return r?(await this.adapter.updateUser(r.id,{password:t}),await this.adapter.deleteUserSessions(r.id),{success:!0,user:r}):{success:!1,error:"User not found"}}catch(r){return {success:false,error:String(r)}}}async sendEmailVerification(e){try{let{token:t,expiresAt:r}=await this.adapter.createEmailVerificationToken(e);return {success:!0}}catch(t){return {success:false,error:String(t)}}}async verifyEmail(e){try{return await this.adapter.verifyEmailToken(e)}catch(t){return {success:false,error:String(t)}}}async requestPasswordReset(e){try{let t=await this.adapter.createPasswordResetToken(e);return t.error?{success:!1,error:t.error}:{success:!0}}catch(t){return {success:false,error:String(t)}}}async resetPasswordWithToken(e,t){try{return await this.adapter.resetPasswordWithToken(e,t)}catch(r){return {success:false,error:String(r)}}}async deleteAccount(e){try{return await this.adapter.findUserById(e)?(await this.adapter.deleteUserSessions(e),await this.adapter.deleteUser(e),{success:!0}):{success:!1,error:"User not found"}}catch(t){return {success:false,error:String(t)}}}async createSessionForUser(e){let t=await this.generateToken(e),r=await this.adapter.createSession(e.id);return {success:true,user:e,session:r,token:t}}async generateToken(e){let{default:t}=await import('jsonwebtoken'),r={sub:e.id,email:e.email,role:e.role,tenantId:e.tenantId},s={expiresIn:this.parseExpiresIn(this.config.expiresIn)/1e3,issuer:this.config.issuer};return this.config.audience.length>0&&(s.audience=this.config.audience[0]),t.sign(r,this.config.secret,s)}async hashPassword(e){let{default:t}=await import('bcryptjs');return t.hash(e,this.config.saltRounds)}parseExpiresIn(e){if(typeof e=="number")return e;let t=e.match(/^(\d+)([smhd])$/);if(!t)return 864e5;let r=parseInt(t[1],10);switch(t[2]){case "s":return r*1e3;case "m":return r*6e4;case "h":return r*36e5;case "d":return r*864e5;default:return 864e5}}};function Zr(a,e){return new q(a,e)}function X(){return {enabled:true,draftsEnabled:true,publishEnabled:true,scheduleEnabled:false,versioningEnabled:true,maxVersionsPerDocument:50,autoPublish:false,requirePublishPermission:true}}var J=class{adapter;config;constructor(e,t){this.adapter=e,this.config={...X(),...t};}async createVersion(e){let r=((await this.adapter.getLatestVersion(e.collection,e.documentId))?.version??0)+1,s={...e,version:r},n=await this.adapter.createVersion(s);return this.config.maxVersionsPerDocument>0&&await this.pruneOldVersions(e.collection,e.documentId),n}async publishVersion(e){let t=await this.adapter.getVersion(e.collection,e.versionId);if(!t)throw new Error("Version not found");if(t.status==="published")throw new Error("Version is already published");await this.adapter.publishVersion(e);}async unpublishDocument(e,t){let r=await this.adapter.getVersions({collection:e,documentId:t,limit:1e3});for(let s of r)if(s.status==="published"){await this.createVersion({collection:e,documentId:t,data:s.data,status:"draft",createdBy:"system",changeDescription:"Unpublished document"});break}}async revertToVersion(e,t,r,s){if(!await this.adapter.getVersion(e,r))throw new Error("Version not found");return await this.adapter.revertToVersion({collection:e,documentId:t,versionId:r,userId:s})}async getVersionHistory(e,t,r=20,s=0){return this.adapter.getVersions({collection:e,documentId:t,limit:r,offset:s})}async compareTwoVersions(e,t,r,s){return this.adapter.compareVersions({collection:e,documentId:t,versionA:r,versionB:s})}async getLatestDraft(e,t){return this.adapter.getLatestVersion(e,t)}async getPublishedVersion(e,t){return this.adapter.getPublishedVersion(e,t)}async getVersion(e,t){return this.adapter.getVersion(e,t)}async schedulePublish(e,t,r,s){if(!this.config.scheduleEnabled)throw new Error("Scheduled publishing is not enabled");if(!await this.adapter.getVersion(e,r))throw new Error("Version not found")}async deleteVersionHistory(e,t){await this.adapter.deleteVersions(e,t);}async pruneOldVersions(e,t){let r=await this.adapter.getVersions({collection:e,documentId:t,limit:this.config.maxVersionsPerDocument+100});if(r.length<=this.config.maxVersionsPerDocument)return;r.slice(0,this.config.maxVersionsPerDocument);let n=r.slice(this.config.maxVersionsPerDocument);for(let o of n)if(o.status!=="published"){await this.adapter.deleteVersions(e,t);break}}};function es(a,e){return new J(a,e)}function ts(a){return a==="published"}function rs(a){return a==="draft"}function ss(a){return a==="archived"}function ns(a){return a?Array.isArray(a)?a:Object.values(a):[]}function os(a){return a?Array.isArray(a)?a:Object.values(a):[]}function qe(a){return {collections:ns(a.collections),globals:os(a.globals),adapter:a.adapter,plugins:a.plugins,auth:a.auth,cors:a.cors,admin:a.admin,upload:a.upload,graphQL:a.graphQL,typescript:a.typescript,localization:a.localization,rateLimit:a.rateLimit,debug:a.debug}}var is=qe;function as(a){let{siteSettings:e,seoSettings:t,title:r,description:s,image:n,url:o}=a;if(!e)return "";let i=e.siteName||"",c=r||t?.defaultTitle||i,l=t?.titleTemplate,d=t?.separator||" | ",u=t?.siteNameInTitle!==false,p=l?l.replace(/\{\{title\}\}/g,c).replace(/\{\{siteName\}\}/g,u?i:"").replace(/\{\{separator\}\}/g,d).replace(/\s+/g," ").trim():c,m=s||t?.defaultDescription||e.siteDescription||"",g=n||e.siteOgImage?.url||"",h=o||e.siteUrl||"",y=`
2
20
  <title>${p}</title>
3
- <meta name="description" content="${y}">
4
- `;e.siteFavicon?.url&&(f+=`
5
- <link rel="icon" type="${e.siteFavicon.mimeType||"image/x-icon"}" href="${e.siteFavicon.url}">`);let Q=t?.meta?.robots;Q&&(f+=`
6
- <meta name="robots" content="${Q}">`);let Y=t?.meta?.canonicalUrl||D;Y&&(f+=`
7
- <link rel="canonical" href="${Y}">`);let Fe=t?.meta?.ogType||"website";f+=`
8
- <meta property="og:type" content="${Fe}">
21
+ <meta name="description" content="${m}">
22
+ `;e.siteFavicon?.url&&(y+=`
23
+ <link rel="icon" type="${e.siteFavicon.mimeType||"image/x-icon"}" href="${e.siteFavicon.url}">`);let f=t?.meta?.robots;f&&(y+=`
24
+ <meta name="robots" content="${f}">`);let N=t?.meta?.canonicalUrl||h;N&&(y+=`
25
+ <link rel="canonical" href="${N}">`);let Q=t?.meta?.ogType||"website";y+=`
26
+ <meta property="og:type" content="${Q}">
9
27
  <meta property="og:title" content="${p}">
10
- <meta property="og:description" content="${y}">
11
- <meta property="og:site_name" content="${a}">
12
- `,D&&(f+=`
13
- <meta property="og:url" content="${D}">`),m&&(f+=`
14
- <meta property="og:image" content="${m}">`),t?.social?.fbAppId&&(f+=`
15
- <meta property="fb:app_id" content="${t.social.fbAppId}">`);let Ne=t?.social?.twitterCardType||"summary_large_image";return f+=`
16
- <meta name="twitter:card" content="${Ne}">
28
+ <meta property="og:description" content="${m}">
29
+ <meta property="og:site_name" content="${i}">
30
+ `,h&&(y+=`
31
+ <meta property="og:url" content="${h}">`),g&&(y+=`
32
+ <meta property="og:image" content="${g}">`),t?.social?.fbAppId&&(y+=`
33
+ <meta property="fb:app_id" content="${t.social.fbAppId}">`);let Z=t?.social?.twitterCardType||"summary_large_image";return y+=`
34
+ <meta name="twitter:card" content="${Z}">
17
35
  <meta name="twitter:title" content="${p}">
18
- <meta name="twitter:description" content="${y}">
19
- `,t?.social?.twitterHandle&&(f+=`
20
- <meta name="twitter:site" content="${t.social.twitterHandle}">`),m&&(f+=`
21
- <meta name="twitter:image" content="${m}">`),e.enableI18n&&e.i18n?.language&&(f+=`
22
- <meta http-equiv="content-language" content="${e.i18n.language}">`),f}function zr(s){if(!s||!s.analyticsEnabled||!s.analytics)return "";let{googleAnalyticsId:e,googleTagManagerId:t,plausibleDomain:r}=s.analytics,o="";return e&&(o+=`
36
+ <meta name="twitter:description" content="${m}">
37
+ `,t?.social?.twitterHandle&&(y+=`
38
+ <meta name="twitter:site" content="${t.social.twitterHandle}">`),g&&(y+=`
39
+ <meta name="twitter:image" content="${g}">`),e.enableI18n&&e.i18n?.language&&(y+=`
40
+ <meta http-equiv="content-language" content="${e.i18n.language}">`),y}function cs(a){if(!a||!a.analyticsEnabled||!a.analytics)return "";let{googleAnalyticsId:e,googleTagManagerId:t,plausibleDomain:r}=a.analytics,s="";return e&&(s+=`
23
41
  <!-- Google Analytics -->
24
42
  <script async src="https://www.googletagmanager.com/gtag/js?id=${e}"></script>
25
43
  <script>
@@ -28,7 +46,7 @@ export{a as RedisAuthAdapter}from'./chunk-QOCHBPMK.js';export{k as allGlobalSett
28
46
  gtag('js', new Date());
29
47
  gtag('config', '${e}');
30
48
  </script>
31
- `),t&&(o+=`
49
+ `),t&&(s+=`
32
50
  <!-- Google Tag Manager -->
33
51
  <script>
34
52
  (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
@@ -37,14 +55,14 @@ export{a as RedisAuthAdapter}from'./chunk-QOCHBPMK.js';export{k as allGlobalSett
37
55
  'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
38
56
  })(window,document,'script','dataLayer','${t}');
39
57
  </script>
40
- `),r&&(o+=`
58
+ `),r&&(s+=`
41
59
  <!-- Plausible Analytics -->
42
60
  <script defer data-domain="${r}" src="https://plausible.io/js/script.js"></script>
43
- `),o}var jr={facebook:{label:"Facebook"},twitter:{label:"Twitter / X"},instagram:{label:"Instagram"},linkedin:{label:"LinkedIn"},youtube:{label:"YouTube"},tiktok:{label:"TikTok"},pinterest:{label:"Pinterest"},discord:{label:"Discord"},twitch:{label:"Twitch"},github:{label:"GitHub"},mastodon:{label:"Mastodon"}},Wr=["facebook","twitter","instagram","linkedin","youtube","tiktok","pinterest","discord","twitch","github","mastodon"];function Ue(s){if(!s)return [];let e=s.showAll===true,t=[];for(let r of Wr){let o=s[r];if(!o||["tiktok","pinterest","discord","twitch","github","mastodon"].includes(r)&&!e)continue;let i=jr[r];t.push({platform:r,url:o,label:i?.label||r});}return t}async function qr(s,e){try{let t=await s.findOne({collection:"_globals_social-settings",where:{},draft:e?.draft??!1});return Ue(t)}catch{return []}}function Ve(s){return s?{storeName:s.storeName,storeEmail:s.storeEmail,storePhone:s.storePhone,address:s.address,currency:s.currency,tax:s.tax,shipping:s.shipping,orders:s.orders}:{}}async function Gr(s,e){try{let t=await s.findOne({collection:"_globals_store-settings",where:{},draft:e?.draft??!1});return Ve(t)}catch{return {}}}function _e(s){return s?{testMode:s.testMode,provider:s.provider,stripe:s.stripe,paypal:s.paypal,square:s.square,methods:s.methods,bankTransfer:s.bankTransfer}:{}}async function Qr(s,e){try{let t=await s.findOne({collection:"_globals_payment-settings",where:{},draft:e?.draft??!1});return _e(t)}catch{return {}}}async function z(s={}){let{namespace:e="kyro",ttl:t}=s,r=createStorage({driver:Jr({dbName:"kyro-cms",storeName:e})}),o=e?`${e}:`:"";return {storage:{getItem:async i=>{let a=`${o}${i}`,c=await r.getItem(a);if(c==null)return null;try{let l=JSON.parse(c);return l.expiry&&Date.now()>l.expiry?(await r.removeItem(a),null):l.value}catch{return c}},setItem:async(i,a)=>{let c=`${o}${i}`,l=JSON.stringify(t?{value:a,expiry:Date.now()+t}:{value:a});await r.setItem(c,l);},removeItem:async i=>{await r.removeItem(`${o}${i}`);}},cleanup:async()=>{await r.dispose?.();}}}function j(s){let e=s||process.env.APP_SECRET||process.env.AUTH_SECRET||"development-secret-key";return W.createHash("sha256").update(e).digest("hex")}function to(s,e){let t=W.randomBytes(16),r=W.createCipheriv("aes-256-gcm",Buffer.from(e,"hex").subarray(0,32),t),o=r.update(s,"utf8","hex");o+=r.final("hex");let n=r.getAuthTag().toString("hex");return `${t.toString("hex")}:${n}:${o}`}function ro(s,e){let[t,r,o]=s.split(":"),n=Buffer.from(t,"hex"),i=Buffer.from(r,"hex"),a=W.createDecipheriv("aes-256-gcm",Buffer.from(e,"hex").subarray(0,32),n);a.setAuthTag(i);let c=a.update(o,"hex","utf8");return c+=a.final("utf8"),c}async function q(s={}){let{namespace:e="kyro",ttl:t,encryption:r=true,secret:o,basePath:n}=s,i=n?Me.join(n,".astro","kyro.json"):Me.join(process.cwd(),".astro","kyro.json"),a=createStorage({driver:eo({base:i})}),c=r?j(o):null,l=e?`${e}:`:"";return {storage:{getItem:async d=>{let u=`${l}${d}`,p=await a.getItem(u);if(p==null)return null;try{let y=c?ro(p,c):p,m=JSON.parse(y);return m.expiry&&Date.now()>m.expiry?(await a.removeItem(u),null):m.value}catch{return p}},setItem:async(d,u)=>{let p=`${l}${d}`,y=JSON.stringify(t?{value:u,expiry:Date.now()+t}:{value:u});await a.setItem(p,c?to(y,c):y);},removeItem:async d=>{await a.removeItem(`${l}${d}`);}},cleanup:async()=>{await a.dispose?.();}}}async function G(s){let{environment:e,adapter:t,connectionString:r,encryption:o}=s,n=process.env.APP_SECRET||process.env.AUTH_SECRET,i={enabled:o?.enabled??true,algorithm:o?.algorithm};return e==="browser"?z({namespace:"kyro"}):q({namespace:"kyro",encryption:i.enabled,secret:n})}async function He(s){let e={...s,encryption:{enabled:true,algorithm:s.encryption?.algorithm}};return G(e)}l();function oo(s){return {name:"kyro-loader",load:async e=>{let{store:t,logger:r,parseData:o}=e;r.info(`Loading Kyro CMS collection: "${s.collection}"`);try{let n=[];t.clear();for(let i of n){let a=String(i.id||i._id),c=await o({id:a,data:i});t.set({id:a,data:c,digest:JSON.stringify(c)});}r.info(`Successfully synced ${n.length} entries for "${s.collection}" into Astro store.`);}catch(n){r.error(`Failed to load Kyro collection "${s.collection}": ${n.message}`);}},schema:z$1.object({id:z$1.string(),createdAt:z$1.string().optional(),updatedAt:z$1.string().optional()}).passthrough()}}function no(s){return {input:s.schema||z$1.object({}).passthrough(),handler:async(t,r)=>{try{return {success:!0,collection:s.collection,action:s.action,data:t,timestamp:new Date().toISOString()}}catch(o){return {success:false,error:o.message||"CMS Action Execution Failed"}}}}}function io(s={}){let e=s.protectedRoutes||[],t=s.loginPath||"/admin/login",r=s.cookieName||"kyro_session";return async(o,n)=>{let{request:i,cookies:a,redirect:c,locals:l}=o,d=new URL(i.url),u=a?.get?.(r)?.value||i.headers.get("authorization")?.replace("Bearer ",""),p=null;return u&&(p={id:"user_1",email:"admin@kyro-cms.com",role:"admin"}),l.kyroUser=p,e.some(m=>new RegExp("^"+m.replace(/\*/g,".*")+"$").test(d.pathname))&&!p?c(`${t}?redirect=${encodeURIComponent(d.pathname)}`):n()}}function ao(s){let e=s?.collections||[],t=`// Auto-generated by Kyro CMS
61
+ `),s}var ls={facebook:{label:"Facebook"},twitter:{label:"Twitter / X"},instagram:{label:"Instagram"},linkedin:{label:"LinkedIn"},youtube:{label:"YouTube"},tiktok:{label:"TikTok"},pinterest:{label:"Pinterest"},discord:{label:"Discord"},twitch:{label:"Twitch"},github:{label:"GitHub"},mastodon:{label:"Mastodon"}},ds=["facebook","twitter","instagram","linkedin","youtube","tiktok","pinterest","discord","twitch","github","mastodon"];function Xe(a){if(!a)return [];let e=a.showAll===true,t=[];for(let r of ds){let s=a[r];if(!s||["tiktok","pinterest","discord","twitch","github","mastodon"].includes(r)&&!e)continue;let o=ls[r];t.push({platform:r,url:s,label:o?.label||r});}return t}async function us(a,e){try{let t=await a.findOne({collection:"_globals_social-settings",where:{},draft:e?.draft??!1});return Xe(t)}catch{return []}}function Je(a){return a?{storeName:a.storeName,storeEmail:a.storeEmail,storePhone:a.storePhone,address:a.address,currency:a.currency,tax:a.tax,shipping:a.shipping,orders:a.orders}:{}}async function ps(a,e){try{let t=await a.findOne({collection:"_globals_store-settings",where:{},draft:e?.draft??!1});return Je(t)}catch{return {}}}function Ye(a){return a?{testMode:a.testMode,provider:a.provider,stripe:a.stripe,paypal:a.paypal,square:a.square,methods:a.methods,bankTransfer:a.bankTransfer}:{}}async function gs(a,e){try{let t=await a.findOne({collection:"_globals_payment-settings",where:{},draft:e?.draft??!1});return Ye(t)}catch{return {}}}async function ie(a={}){let{namespace:e="kyro",ttl:t}=a,r=createStorage({driver:fs({dbName:"kyro-cms",storeName:e})}),s=e?`${e}:`:"";return {storage:{getItem:async o=>{let i=`${s}${o}`,c=await r.getItem(i);if(c==null)return null;try{let l=JSON.parse(c);return l.expiry&&Date.now()>l.expiry?(await r.removeItem(i),null):l.value}catch{return c}},setItem:async(o,i)=>{let c=`${s}${o}`,l=JSON.stringify(t?{value:i,expiry:Date.now()+t}:{value:i});await r.setItem(c,l);},removeItem:async o=>{await r.removeItem(`${s}${o}`);}},cleanup:async()=>{await r.dispose?.();}}}function ae(a){let e=a||process.env.APP_SECRET||process.env.AUTH_SECRET||"development-secret-key";return ce.createHash("sha256").update(e).digest("hex")}function As(a,e){let t=ce.randomBytes(16),r=ce.createCipheriv("aes-256-gcm",Buffer.from(e,"hex").subarray(0,32),t),s=r.update(a,"utf8","hex");s+=r.final("hex");let n=r.getAuthTag().toString("hex");return `${t.toString("hex")}:${n}:${s}`}function Ts(a,e){let[t,r,s]=a.split(":"),n=Buffer.from(t,"hex"),o=Buffer.from(r,"hex"),i=ce.createDecipheriv("aes-256-gcm",Buffer.from(e,"hex").subarray(0,32),n);i.setAuthTag(o);let c=i.update(s,"hex","utf8");return c+=i.final("utf8"),c}async function le(a={}){let{namespace:e="kyro",ttl:t,encryption:r=true,secret:s,basePath:n}=a,o=n?Qe.join(n,".astro","kyro.json"):Qe.join(process.cwd(),".astro","kyro.json"),i=createStorage({driver:bs({base:o})}),c=r?ae(s):null,l=e?`${e}:`:"";return {storage:{getItem:async d=>{let u=`${l}${d}`,p=await i.getItem(u);if(p==null)return null;try{let m=c?Ts(p,c):p,g=JSON.parse(m);return g.expiry&&Date.now()>g.expiry?(await i.removeItem(u),null):g.value}catch{return p}},setItem:async(d,u)=>{let p=`${l}${d}`,m=JSON.stringify(t?{value:u,expiry:Date.now()+t}:{value:u});await i.setItem(p,c?As(m,c):m);},removeItem:async d=>{await i.removeItem(`${l}${d}`);}},cleanup:async()=>{await i.dispose?.();}}}async function de(a){let{environment:e,adapter:t,connectionString:r,encryption:s}=a,n=process.env.APP_SECRET||process.env.AUTH_SECRET,o={enabled:s?.enabled??true,algorithm:s?.algorithm};return e==="browser"?ie({namespace:"kyro"}):le({namespace:"kyro",encryption:o.enabled,secret:n})}async function Ze(a){let e={...a,encryption:{enabled:true,algorithm:a.encryption?.algorithm}};return de(e)}l();function Ss(a){return {name:"kyro-loader",load:async e=>{let{store:t,logger:r,parseData:s}=e;r.info(`Loading Kyro CMS collection: "${a.collection}"`);try{let n=[];t.clear();for(let o of n){let i=String(o.id||o._id),c=await s({id:i,data:o});t.set({id:i,data:c,digest:JSON.stringify(c)});}r.info(`Successfully synced ${n.length} entries for "${a.collection}" into Astro store.`);}catch(n){r.error(`Failed to load Kyro collection "${a.collection}": ${n.message}`);}},schema:z$1.object({id:z$1.string(),createdAt:z$1.string().optional(),updatedAt:z$1.string().optional()}).passthrough()}}function xs(a){return {input:a.schema||z$1.object({}).passthrough(),handler:async(t,r)=>{try{return {success:!0,collection:a.collection,action:a.action,data:t,timestamp:new Date().toISOString()}}catch(s){return {success:false,error:s.message||"CMS Action Execution Failed"}}}}}function Ps(a={}){let e=a.protectedRoutes||[],t=a.loginPath||"/admin/login",r=a.cookieName||"kyro_session";return async(s,n)=>{let{request:o,cookies:i,redirect:c,locals:l}=s,d=new URL(o.url),u=i?.get?.(r)?.value||o.headers.get("authorization")?.replace("Bearer ",""),p=null;return u&&(p={id:"user_1",email:"admin@kyro-cms.com",role:"admin"}),l.kyroUser=p,e.some(g=>new RegExp("^"+g.replace(/\*/g,".*")+"$").test(d.pathname))&&!p?c(`${t}?redirect=${encodeURIComponent(d.pathname)}`):n()}}function Es(a){let e=a?.collections||[],t=`// Auto-generated by Kyro CMS
44
62
  declare module 'kyro:collections' {
45
63
  export interface KyroCollections {
46
- `;for(let r of e){let o=r.name||r.slug;t+=` '${o}': Record<string, any>;
64
+ `;for(let r of e){let s=r.name||r.slug;t+=` '${s}': Record<string, any>;
47
65
  `;}return t+=` }
48
66
  }
49
- `,t}function co(s={}){return {APP_SECRET:{context:"server",access:"secret",type:"string",optional:false},DATABASE_URL:{context:"server",access:"secret",type:"string",optional:!s.requireDatabase},PUBLIC_KYRO_URL:{context:"client",access:"public",type:"string",optional:true,default:"http://localhost:4321"}}}function lo(s={}){return {name:"kyro-dev-toolbar-integration",hooks:{"astro:config:setup":({addDevToolbarApp:e})=>{s.enabled!==false&&typeof e=="function"&&e({id:"kyro-cms",name:"Kyro CMS",icon:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"/></svg>',entrypoint:"@kyro-cms/core/dev-toolbar-app"});}}}}
50
- export{x as AccountLockout,U as Auth,k as InMemoryAccountLockout,T as InMemoryAuthAdapter,R as NeonAdapter,P as RateLimiter,v as TursoAdapter,_ as VersionManager,Ee as authConfig,Vr as createAuth,$ as createAuthConfig,He as createAuthStorage,ve as createNeonAdapter,G as createStorage,De as createTursoAdapter,_r as createVersionManager,Oe as defineConfig,Kr as defineKyroConfig,zr as generateAnalyticsTags,ao as generateKyroAstroTypes,$r as generateSeoTags,V as getDefaultDraftPublishConfig,Qr as getPaymentConfig,_e as getPaymentConfigFromSettings,qr as getSocialLinks,Ue as getSocialLinksFromSettings,Gr as getStoreConfig,Ve as getStoreConfigFromSettings,Fr as isArchived,Hr as isDraft,Mr as isPublished,no as kyroAction,io as kyroAuthMiddleware,lo as kyroDevToolbarIntegration,co as kyroEnvSchema,oo as kyroLoader,Cr as runFieldHooks,Re as runHooks};
67
+ `,t}function Cs(a={}){return {APP_SECRET:{context:"server",access:"secret",type:"string",optional:false},DATABASE_URL:{context:"server",access:"secret",type:"string",optional:!a.requireDatabase},PUBLIC_KYRO_URL:{context:"client",access:"public",type:"string",optional:true,default:"http://localhost:4321"}}}function Ds(a={}){return {name:"kyro-dev-toolbar-integration",hooks:{"astro:config:setup":({addDevToolbarApp:e})=>{a.enabled!==false&&typeof e=="function"&&e({id:"kyro-cms",name:"Kyro CMS",icon:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"/></svg>',entrypoint:"@kyro-cms/core/dev-toolbar-app"});}}}}
68
+ export{I as AccountLockout,q as Auth,O as InMemoryAccountLockout,L as InMemoryAuthAdapter,k as LocalAdapter,U as NeonAdapter,v as RateLimiter,V as TursoAdapter,J as VersionManager,Ge as authConfig,Zr as createAuth,oe as createAuthConfig,Ze as createAuthStorage,ne as createLocalAdapter,je as createNeonAdapter,de as createStorage,Ke as createTursoAdapter,es as createVersionManager,qe as defineConfig,is as defineKyroConfig,cs as generateAnalyticsTags,Es as generateKyroAstroTypes,as as generateSeoTags,X as getDefaultDraftPublishConfig,gs as getPaymentConfig,Ye as getPaymentConfigFromSettings,us as getSocialLinks,Xe as getSocialLinksFromSettings,ps as getStoreConfig,Je as getStoreConfigFromSettings,ss as isArchived,rs as isDraft,ts as isPublished,xs as kyroAction,Ps as kyroAuthMiddleware,Ds as kyroDevToolbarIntegration,Cs as kyroEnvSchema,Ss as kyroLoader,$r as runFieldHooks,He as runHooks};
@@ -1 +1 @@
1
- 'use strict';var chunkYKIO34KG_cjs=require('./chunk-YKIO34KG.cjs');require('./chunk-AHSFSERC.cjs');module.exports=chunkYKIO34KG_cjs.a;
1
+ 'use strict';var chunkFZ6Q2EBJ_cjs=require('./chunk-FZ6Q2EBJ.cjs');require('./chunk-AHSFSERC.cjs');module.exports=chunkFZ6Q2EBJ_cjs.a;
@@ -1 +1 @@
1
- export{a as default}from'./chunk-PTG24TQS.js';import'./chunk-5J6HXUF6.js';
1
+ export{a as default}from'./chunk-W7C6SJXZ.js';import'./chunk-5J6HXUF6.js';
@@ -1 +1 @@
1
- 'use strict';var chunk2YRM7CZZ_cjs=require('../chunk-2YRM7CZZ.cjs');require('../chunk-5K4YG5DA.cjs'),require('../chunk-WIZ6C5QZ.cjs'),require('../chunk-GO34AOBZ.cjs'),require('../chunk-HOP4D5XZ.cjs'),require('../chunk-HVXO3OFB.cjs'),require('../chunk-ILEZ3NYX.cjs'),require('../chunk-NY47CFVP.cjs'),require('../chunk-FUWPXR6W.cjs'),require('../chunk-GYQMNXXW.cjs'),require('../chunk-MIOMMB23.cjs'),require('../chunk-QCA3AP3M.cjs'),require('../chunk-FHJJKFAU.cjs'),require('../chunk-D5P2IPGX.cjs'),require('../chunk-G7SSHELM.cjs'),require('../chunk-Q3Q7BJVQ.cjs'),require('../chunk-AHSFSERC.cjs');Object.defineProperty(exports,"createHonoApp",{enumerable:true,get:function(){return chunk2YRM7CZZ_cjs.u}});Object.defineProperty(exports,"createRESTAPI",{enumerable:true,get:function(){return chunk2YRM7CZZ_cjs.v}});
1
+ 'use strict';var chunkNZJAGASC_cjs=require('../chunk-NZJAGASC.cjs');require('../chunk-BGX27ZRG.cjs'),require('../chunk-WIZ6C5QZ.cjs'),require('../chunk-GO34AOBZ.cjs'),require('../chunk-J4252I5B.cjs'),require('../chunk-HVXO3OFB.cjs'),require('../chunk-ILEZ3NYX.cjs'),require('../chunk-NY47CFVP.cjs'),require('../chunk-CCUQZ66T.cjs'),require('../chunk-GYQMNXXW.cjs'),require('../chunk-MIOMMB23.cjs'),require('../chunk-QCA3AP3M.cjs'),require('../chunk-FHJJKFAU.cjs'),require('../chunk-D5P2IPGX.cjs'),require('../chunk-G7SSHELM.cjs'),require('../chunk-Q3Q7BJVQ.cjs'),require('../chunk-AHSFSERC.cjs');Object.defineProperty(exports,"createHonoApp",{enumerable:true,get:function(){return chunkNZJAGASC_cjs.u}});Object.defineProperty(exports,"createRESTAPI",{enumerable:true,get:function(){return chunkNZJAGASC_cjs.v}});
@@ -1,6 +1,6 @@
1
1
  import { Hono } from 'hono';
2
2
  import { B as BaseAdapter, k as User } from '../types-BjivdGbU.cjs';
3
- import { R as Registry } from '../index-DRNSjOte.cjs';
3
+ import { R as Registry } from '../index-DTz6u7w9.cjs';
4
4
  import { j as createWebhookService } from '../WebhookService-BBcCHBo8.cjs';
5
5
  import '../types-euTszc-1.cjs';
6
6
  import 'zod';
@@ -1,6 +1,6 @@
1
1
  import { Hono } from 'hono';
2
2
  import { B as BaseAdapter, k as User } from '../types-CaXXmV9h.js';
3
- import { R as Registry } from '../index-CqR97Q2L.js';
3
+ import { R as Registry } from '../index-BeQtbl3z.js';
4
4
  import { j as createWebhookService } from '../WebhookService-C19xR8qE.js';
5
5
  import '../types-euTszc-1.js';
6
6
  import 'zod';
@@ -1 +1 @@
1
- export{u as createHonoApp,v as createRESTAPI}from'../chunk-4DJYAD4L.js';import'../chunk-6J27P5D6.js';import'../chunk-K6WUOU6P.js';import'../chunk-IETGL7WJ.js';import'../chunk-IKOXCJYO.js';import'../chunk-NRLIGDYF.js';import'../chunk-FVZ5RFLO.js';import'../chunk-HLSB2MCK.js';import'../chunk-5KSRMBEO.js';import'../chunk-RHCWCG3O.js';import'../chunk-OG7CNQGU.js';import'../chunk-6ROHVUXF.js';import'../chunk-5KOQYQEE.js';import'../chunk-6SPPR5JZ.js';import'../chunk-4RMFCTWH.js';import'../chunk-KDNYHLD2.js';import'../chunk-5J6HXUF6.js';
1
+ export{u as createHonoApp,v as createRESTAPI}from'../chunk-HQP2Y7QQ.js';import'../chunk-C2W5PSHC.js';import'../chunk-K6WUOU6P.js';import'../chunk-IETGL7WJ.js';import'../chunk-Q2UYCYKV.js';import'../chunk-NRLIGDYF.js';import'../chunk-FVZ5RFLO.js';import'../chunk-HLSB2MCK.js';import'../chunk-7IVN6TTY.js';import'../chunk-RHCWCG3O.js';import'../chunk-OG7CNQGU.js';import'../chunk-6ROHVUXF.js';import'../chunk-5KOQYQEE.js';import'../chunk-6SPPR5JZ.js';import'../chunk-4RMFCTWH.js';import'../chunk-KDNYHLD2.js';import'../chunk-5J6HXUF6.js';
@@ -1 +1 @@
1
- 'use strict';var chunkHOP4D5XZ_cjs=require('./chunk-HOP4D5XZ.cjs');require('./chunk-AHSFSERC.cjs');Object.defineProperty(exports,"SQLiteAuthAdapter",{enumerable:true,get:function(){return chunkHOP4D5XZ_cjs.a}});
1
+ 'use strict';var chunkJ4252I5B_cjs=require('./chunk-J4252I5B.cjs');require('./chunk-AHSFSERC.cjs');Object.defineProperty(exports,"SQLiteAuthAdapter",{enumerable:true,get:function(){return chunkJ4252I5B_cjs.a}});
@@ -0,0 +1 @@
1
+ export{a as SQLiteAuthAdapter}from'./chunk-Q2UYCYKV.js';import'./chunk-5J6HXUF6.js';
@@ -1 +1 @@
1
- 'use strict';var chunkRXZ3IUWM_cjs=require('../chunk-RXZ3IUWM.cjs'),chunk65G73T7Z_cjs=require('../chunk-65G73T7Z.cjs'),chunkGO34AOBZ_cjs=require('../chunk-GO34AOBZ.cjs');require('../chunk-AHSFSERC.cjs');Object.defineProperty(exports,"accessSettingsGlobal",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.g}});Object.defineProperty(exports,"allGlobalSettings",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.k}});Object.defineProperty(exports,"blogCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.q}});Object.defineProperty(exports,"brandSettingsGlobal",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.e}});Object.defineProperty(exports,"brandsCollection",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.S}});Object.defineProperty(exports,"brandsCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.T}});Object.defineProperty(exports,"categoriesCollection",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.A}});Object.defineProperty(exports,"categoriesCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.B}});Object.defineProperty(exports,"coreGlobalSettings",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.l}});Object.defineProperty(exports,"couponsCollection",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.K}});Object.defineProperty(exports,"couponsCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.L}});Object.defineProperty(exports,"createTemplateConfig",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.V}});Object.defineProperty(exports,"customersCollection",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.G}});Object.defineProperty(exports,"customersCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.H}});Object.defineProperty(exports,"ecommerceCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.r}});Object.defineProperty(exports,"ecommerceGlobals",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.s}});Object.defineProperty(exports,"emailSettingsGlobal",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.f}});Object.defineProperty(exports,"formEntriesCollection",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.O}});Object.defineProperty(exports,"formEntriesCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.P}});Object.defineProperty(exports,"formsCollection",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.M}});Object.defineProperty(exports,"formsCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.N}});Object.defineProperty(exports,"getSettingsForTemplate",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.n}});Object.defineProperty(exports,"kitchenSinkCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.t}});Object.defineProperty(exports,"mediaCollection",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.u}});Object.defineProperty(exports,"mediaCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.v}});Object.defineProperty(exports,"menuCollection",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.w}});Object.defineProperty(exports,"menuCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.x}});Object.defineProperty(exports,"minimalCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.a}});Object.defineProperty(exports,"ordersCollection",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.I}});Object.defineProperty(exports,"ordersCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.J}});Object.defineProperty(exports,"pageCollection",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.y}});Object.defineProperty(exports,"pageCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.z}});Object.defineProperty(exports,"postsCollection",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.o}});Object.defineProperty(exports,"postsCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.p}});Object.defineProperty(exports,"productCategoriesCollection",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.C}});Object.defineProperty(exports,"productCategoriesCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.D}});Object.defineProperty(exports,"productsCollection",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.E}});Object.defineProperty(exports,"productsCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.F}});Object.defineProperty(exports,"reviewsCollection",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.Q}});Object.defineProperty(exports,"reviewsCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.R}});Object.defineProperty(exports,"seoSettingsGlobal",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.d}});Object.defineProperty(exports,"settingsBySlug",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.m}});Object.defineProperty(exports,"shippingSettingsGlobal",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.i}});Object.defineProperty(exports,"siteSettingsGlobal",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.c}});Object.defineProperty(exports,"starterCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.b}});Object.defineProperty(exports,"storeSettingsGlobal",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.h}});Object.defineProperty(exports,"systemSettingsGlobal",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.j}});Object.defineProperty(exports,"templateCollections",{enumerable:true,get:function(){return chunkRXZ3IUWM_cjs.U}});Object.defineProperty(exports,"storageSettingsGlobal",{enumerable:true,get:function(){return chunk65G73T7Z_cjs.a}});Object.defineProperty(exports,"authCollections",{enumerable:true,get:function(){return chunkGO34AOBZ_cjs.b}});
1
+ 'use strict';var chunk3CVLI5C5_cjs=require('../chunk-3CVLI5C5.cjs'),chunk4IGWJMBY_cjs=require('../chunk-4IGWJMBY.cjs'),chunkGO34AOBZ_cjs=require('../chunk-GO34AOBZ.cjs');require('../chunk-AHSFSERC.cjs');Object.defineProperty(exports,"accessSettingsGlobal",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.g}});Object.defineProperty(exports,"allGlobalSettings",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.k}});Object.defineProperty(exports,"blogCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.q}});Object.defineProperty(exports,"brandSettingsGlobal",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.e}});Object.defineProperty(exports,"brandsCollection",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.S}});Object.defineProperty(exports,"brandsCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.T}});Object.defineProperty(exports,"categoriesCollection",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.A}});Object.defineProperty(exports,"categoriesCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.B}});Object.defineProperty(exports,"coreGlobalSettings",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.l}});Object.defineProperty(exports,"couponsCollection",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.K}});Object.defineProperty(exports,"couponsCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.L}});Object.defineProperty(exports,"createTemplateConfig",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.V}});Object.defineProperty(exports,"customersCollection",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.G}});Object.defineProperty(exports,"customersCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.H}});Object.defineProperty(exports,"ecommerceCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.r}});Object.defineProperty(exports,"ecommerceGlobals",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.s}});Object.defineProperty(exports,"emailSettingsGlobal",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.f}});Object.defineProperty(exports,"formEntriesCollection",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.O}});Object.defineProperty(exports,"formEntriesCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.P}});Object.defineProperty(exports,"formsCollection",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.M}});Object.defineProperty(exports,"formsCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.N}});Object.defineProperty(exports,"getSettingsForTemplate",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.n}});Object.defineProperty(exports,"kitchenSinkCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.t}});Object.defineProperty(exports,"mediaCollection",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.u}});Object.defineProperty(exports,"mediaCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.v}});Object.defineProperty(exports,"menuCollection",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.w}});Object.defineProperty(exports,"menuCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.x}});Object.defineProperty(exports,"minimalCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.a}});Object.defineProperty(exports,"ordersCollection",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.I}});Object.defineProperty(exports,"ordersCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.J}});Object.defineProperty(exports,"pageCollection",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.y}});Object.defineProperty(exports,"pageCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.z}});Object.defineProperty(exports,"postsCollection",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.o}});Object.defineProperty(exports,"postsCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.p}});Object.defineProperty(exports,"productCategoriesCollection",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.C}});Object.defineProperty(exports,"productCategoriesCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.D}});Object.defineProperty(exports,"productsCollection",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.E}});Object.defineProperty(exports,"productsCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.F}});Object.defineProperty(exports,"reviewsCollection",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.Q}});Object.defineProperty(exports,"reviewsCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.R}});Object.defineProperty(exports,"seoSettingsGlobal",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.d}});Object.defineProperty(exports,"settingsBySlug",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.m}});Object.defineProperty(exports,"shippingSettingsGlobal",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.i}});Object.defineProperty(exports,"siteSettingsGlobal",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.c}});Object.defineProperty(exports,"starterCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.b}});Object.defineProperty(exports,"storeSettingsGlobal",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.h}});Object.defineProperty(exports,"systemSettingsGlobal",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.j}});Object.defineProperty(exports,"templateCollections",{enumerable:true,get:function(){return chunk3CVLI5C5_cjs.U}});Object.defineProperty(exports,"storageSettingsGlobal",{enumerable:true,get:function(){return chunk4IGWJMBY_cjs.a}});Object.defineProperty(exports,"authCollections",{enumerable:true,get:function(){return chunkGO34AOBZ_cjs.b}});
@@ -1 +1 @@
1
- export{g as accessSettingsGlobal,k as allGlobalSettings,q as blogCollections,e as brandSettingsGlobal,S as brandsCollection,T as brandsCollections,A as categoriesCollection,B as categoriesCollections,l as coreGlobalSettings,K as couponsCollection,L as couponsCollections,V as createTemplateConfig,G as customersCollection,H as customersCollections,r as ecommerceCollections,s as ecommerceGlobals,f as emailSettingsGlobal,O as formEntriesCollection,P as formEntriesCollections,M as formsCollection,N as formsCollections,n as getSettingsForTemplate,t as kitchenSinkCollections,u as mediaCollection,v as mediaCollections,w as menuCollection,x as menuCollections,a as minimalCollections,I as ordersCollection,J as ordersCollections,y as pageCollection,z as pageCollections,o as postsCollection,p as postsCollections,C as productCategoriesCollection,D as productCategoriesCollections,E as productsCollection,F as productsCollections,Q as reviewsCollection,R as reviewsCollections,d as seoSettingsGlobal,m as settingsBySlug,i as shippingSettingsGlobal,c as siteSettingsGlobal,b as starterCollections,h as storeSettingsGlobal,j as systemSettingsGlobal,U as templateCollections}from'../chunk-SZNM3F5V.js';export{a as storageSettingsGlobal}from'../chunk-NZ35PV5R.js';export{b as authCollections}from'../chunk-IETGL7WJ.js';import'../chunk-5J6HXUF6.js';
1
+ export{g as accessSettingsGlobal,k as allGlobalSettings,q as blogCollections,e as brandSettingsGlobal,S as brandsCollection,T as brandsCollections,A as categoriesCollection,B as categoriesCollections,l as coreGlobalSettings,K as couponsCollection,L as couponsCollections,V as createTemplateConfig,G as customersCollection,H as customersCollections,r as ecommerceCollections,s as ecommerceGlobals,f as emailSettingsGlobal,O as formEntriesCollection,P as formEntriesCollections,M as formsCollection,N as formsCollections,n as getSettingsForTemplate,t as kitchenSinkCollections,u as mediaCollection,v as mediaCollections,w as menuCollection,x as menuCollections,a as minimalCollections,I as ordersCollection,J as ordersCollections,y as pageCollection,z as pageCollections,o as postsCollection,p as postsCollections,C as productCategoriesCollection,D as productCategoriesCollections,E as productsCollection,F as productsCollections,Q as reviewsCollection,R as reviewsCollections,d as seoSettingsGlobal,m as settingsBySlug,i as shippingSettingsGlobal,c as siteSettingsGlobal,b as starterCollections,h as storeSettingsGlobal,j as systemSettingsGlobal,U as templateCollections}from'../chunk-QYFU5Y7S.js';export{a as storageSettingsGlobal}from'../chunk-5B6X2GBJ.js';export{b as authCollections}from'../chunk-IETGL7WJ.js';import'../chunk-5J6HXUF6.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kyro-cms/core",
3
- "version": "0.12.41",
3
+ "version": "0.12.43",
4
4
  "description": "Astro-native headless CMS with multi-database adapters, multi-protocol APIs, and multi-vendor support",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -191,7 +191,7 @@
191
191
  "ws": "^8.18.0",
192
192
  "zod": "^3.24.0",
193
193
  "zod-to-json-schema": "^3.25.2",
194
- "@kyro-cms/ai": "0.12.39"
194
+ "@kyro-cms/ai": "0.12.43"
195
195
  },
196
196
  "devDependencies": {
197
197
  "@tailwindcss/vite": "^4.0.0",
@@ -1 +0,0 @@
1
- 'use strict';var chunkQBJT7XLN_cjs=require('./chunk-QBJT7XLN.cjs');require('./chunk-5K4YG5DA.cjs'),require('./chunk-WIZ6C5QZ.cjs'),require('./chunk-HOP4D5XZ.cjs'),require('./chunk-AHSFSERC.cjs');Object.defineProperty(exports,"autoBootstrap",{enumerable:true,get:function(){return chunkQBJT7XLN_cjs.d}});Object.defineProperty(exports,"bootstrapAdmin",{enumerable:true,get:function(){return chunkQBJT7XLN_cjs.a}});Object.defineProperty(exports,"bootstrapWithRetry",{enumerable:true,get:function(){return chunkQBJT7XLN_cjs.e}});Object.defineProperty(exports,"checkBootstrapRequired",{enumerable:true,get:function(){return chunkQBJT7XLN_cjs.b}});Object.defineProperty(exports,"getBootstrapFromEnv",{enumerable:true,get:function(){return chunkQBJT7XLN_cjs.c}});
@@ -1 +0,0 @@
1
- export{d as autoBootstrap,a as bootstrapAdmin,e as bootstrapWithRetry,b as checkBootstrapRequired,c as getBootstrapFromEnv}from'./chunk-7MBZYLME.js';import'./chunk-6J27P5D6.js';import'./chunk-K6WUOU6P.js';import'./chunk-IKOXCJYO.js';import'./chunk-5J6HXUF6.js';