@donotdev/core 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/functions/index.js +19 -19
- package/i18n/locales/eager/dndev_ar.json +2 -1
- package/i18n/locales/eager/dndev_da.json +2 -1
- package/i18n/locales/eager/dndev_de.json +2 -1
- package/i18n/locales/eager/dndev_en.json +2 -1
- package/i18n/locales/eager/dndev_es.json +2 -1
- package/i18n/locales/eager/dndev_fr.json +2 -1
- package/i18n/locales/eager/dndev_it.json +2 -1
- package/i18n/locales/eager/dndev_ja.json +2 -1
- package/i18n/locales/eager/dndev_ko.json +2 -1
- package/i18n/locales/eager/dndev_nl.json +2 -1
- package/i18n/locales/eager/dndev_pl.json +2 -1
- package/i18n/locales/eager/dndev_pt.json +2 -1
- package/i18n/locales/eager/dndev_zh.json +2 -1
- package/i18n/locales/lazy/auth_ar.json +25 -2
- package/i18n/locales/lazy/auth_da.json +28 -2
- package/i18n/locales/lazy/auth_de.json +25 -2
- package/i18n/locales/lazy/auth_en.json +25 -2
- package/i18n/locales/lazy/auth_es.json +25 -2
- package/i18n/locales/lazy/auth_fr.json +25 -2
- package/i18n/locales/lazy/auth_it.json +25 -2
- package/i18n/locales/lazy/auth_ja.json +25 -2
- package/i18n/locales/lazy/auth_ko.json +25 -2
- package/i18n/locales/lazy/auth_nl.json +28 -2
- package/i18n/locales/lazy/auth_pl.json +25 -2
- package/i18n/locales/lazy/auth_pt.json +25 -2
- package/i18n/locales/lazy/auth_zh.json +25 -2
- package/i18n/locales/lazy/crud_ar.json +3 -1
- package/i18n/locales/lazy/crud_da.json +3 -1
- package/i18n/locales/lazy/crud_de.json +3 -1
- package/i18n/locales/lazy/crud_en.json +3 -1
- package/i18n/locales/lazy/crud_es.json +3 -1
- package/i18n/locales/lazy/crud_fr.json +3 -1
- package/i18n/locales/lazy/crud_it.json +3 -1
- package/i18n/locales/lazy/crud_ja.json +3 -1
- package/i18n/locales/lazy/crud_ko.json +3 -1
- package/i18n/locales/lazy/crud_nl.json +3 -1
- package/i18n/locales/lazy/crud_pl.json +3 -1
- package/i18n/locales/lazy/crud_pt.json +3 -1
- package/i18n/locales/lazy/crud_zh.json +3 -1
- package/index.d.ts +455 -49
- package/index.js +5 -5
- package/next/index.d.ts +80 -10
- package/next/index.js +259 -216
- package/next/runtime.js +2 -2
- package/package.json +2 -2
- package/server.d.ts +323 -24
- package/shared.js +2 -2
- package/symbol-index.json +1 -1
- package/vite/index.d.ts +65 -1
- package/vite/index.js +113 -107
package/shared.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var nr=Object.defineProperty;var rr=(e,t,n)=>t in e?nr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var k=(e,t,n)=>rr(e,typeof t!="symbol"?t+"":t,n);var U={ANTHROPIC:"anthropic",OPENAI:"openai",GOOGLE:"google"},be={USER:"user",ASSISTANT:"assistant",SYSTEM:"system"},Go={[U.ANTHROPIC]:{default:"claude-sonnet-4-6",models:["claude-sonnet-4-6","claude-sonnet-4-20250514","claude-haiku-4-5-20251001","claude-opus-4-6","claude-opus-4-20250514"]},[U.OPENAI]:{default:"gpt-4o",models:["gpt-4o","gpt-4o-mini","gpt-4.1","gpt-4.1-mini","o3-mini"]},[U.GOOGLE]:{default:"gemini-2.0-flash",models:["gemini-2.0-flash","gemini-2.5-pro","gemini-2.5-flash"]}},Yo={maxTokens:4096,temperature:.7,stream:!0},zo={UNKNOWN:"unknown",UNAUTHENTICATED:"unauthenticated",INVALID_API_KEY:"invalid_api_key",RATE_LIMIT_EXCEEDED:"rate_limit_exceeded",PROVIDER_ERROR:"provider_error",TOKEN_LIMIT_EXCEEDED:"token_limit_exceeded",STREAM_INTERRUPTED:"stream_interrupted"},Xo={FAST:{id:"fast",defaultModel:"claude-haiku-4-5-20251001"},STANDARD:{id:"standard",defaultModel:"claude-sonnet-4-6"},PREMIUM:{id:"premium",defaultModel:"claude-opus-4-6"}},Qo=4,Zo={"claude-sonnet-4-6":{promptPer1M:3,completionPer1M:15,currency:"usd"},"claude-haiku-4-5-20251001":{promptPer1M:.8,completionPer1M:4,currency:"usd"},"claude-opus-4-6":{promptPer1M:15,completionPer1M:75,currency:"usd"},"claude-sonnet-4-20250514":{promptPer1M:3,completionPer1M:15,currency:"usd"},"claude-opus-4-20250514":{promptPer1M:15,completionPer1M:75,currency:"usd"},"gpt-4o":{promptPer1M:2.5,completionPer1M:10,currency:"usd"},"gpt-4o-mini":{promptPer1M:.15,completionPer1M:.6,currency:"usd"},"gpt-4.1":{promptPer1M:2,completionPer1M:8,currency:"usd"},"gpt-4.1-mini":{promptPer1M:.4,completionPer1M:1.6,currency:"usd"},"o3-mini":{promptPer1M:1.1,completionPer1M:4.4,currency:"usd"},"gemini-2.0-flash":{promptPer1M:.1,completionPer1M:.4,currency:"usd"},"gemini-2.5-pro":{promptPer1M:1.25,completionPer1M:10,currency:"usd"},"gemini-2.5-flash":{promptPer1M:.15,completionPer1M:.6,currency:"usd"}};import*as p from"valibot";var yt=p.object({role:p.picklist([be.USER,be.ASSISTANT,be.SYSTEM]),content:p.pipe(p.string(),p.minLength(1)),id:p.optional(p.string()),createdAt:p.optional(p.string())}),He=p.lazy(()=>p.object({type:p.picklist(["string","number","boolean","array","object"]),description:p.optional(p.string()),enum:p.optional(p.array(p.string())),items:p.optional(He),properties:p.optional(p.record(p.string(),He)),required:p.optional(p.array(p.string()))})),ir=p.object({description:p.pipe(p.string(),p.minLength(1)),parameters:p.object({type:p.literal("object"),properties:p.record(p.string(),He),required:p.optional(p.array(p.string()))})}),or=p.object({id:p.string(),name:p.string(),args:p.record(p.string(),p.unknown())}),sr=p.object({messages:p.pipe(p.array(yt),p.minLength(1)),provider:p.optional(p.picklist([U.ANTHROPIC,U.OPENAI,U.GOOGLE])),model:p.optional(p.string()),maxTokens:p.optional(p.pipe(p.number(),p.integer(),p.minValue(1))),temperature:p.optional(p.pipe(p.number(),p.minValue(0),p.maxValue(2))),systemPrompt:p.optional(p.string()),stream:p.optional(p.boolean()),tools:p.optional(p.record(p.string(),ir))}),ar=p.object({promptTokens:p.number(),completionTokens:p.number(),totalTokens:p.number()}),lr=p.object({message:yt,usage:p.optional(ar),finishReason:p.optional(p.string()),toolCalls:p.optional(p.array(or))}),ts=p.object({provider:p.picklist([U.ANTHROPIC,U.OPENAI,U.GOOGLE]),model:p.optional(p.string()),maxTokens:p.optional(p.pipe(p.number(),p.integer(),p.minValue(1))),temperature:p.optional(p.pipe(p.number(),p.minValue(0),p.maxValue(2))),systemPrompt:p.optional(p.string())});function ns(e){return p.safeParse(sr,e)}function rs(e){return p.safeParse(lr,e)}var Ee={ACTIVE:"active",CANCELED:"canceled",INCOMPLETE:"incomplete",INCOMPLETE_EXPIRED:"incomplete_expired",PAST_DUE:"past_due",TRIALING:"trialing",UNPAID:"unpaid"};function ur(e){Object.assign(Ee,e)}var Se={tier:"free",status:"active",subscriptionEnd:null,updatedAt:"1970-01-01T00:00:00.000Z",isDefault:!0,subscriptionId:null,customerId:null,cancelAtPeriodEnd:!1};function cr(e){return{...Se,updatedAt:new Date().toISOString()}}var Ke={free:{features:["basic-usage","limited-storage","standard-support"],level:0},pro:{features:["basic-usage","limited-storage","standard-support","cloud-sync","advanced-analytics","priority-support","custom-branding","team-collaboration"],level:1},ai:{features:["basic-usage","limited-storage","standard-support","cloud-sync","advanced-analytics","priority-support","custom-branding","team-collaboration","ai-assistant","custom-models","unlimited-generations","advanced-integrations"],level:2}},O={GUEST:"guest",USER:"user",ADMIN:"admin",SUPER:"super"};function us(e){Object.assign(O,e)}var dr={FREE:"free",PRO:"pro",PREMIUM:"premium"};function cs(e){Object.assign(dr,e)}var Ge={BASIC_ACCESS:"basic_access",ADVANCED_FEATURES:"advanced_features",API_ACCESS:"api_access",PRIORITY_SUPPORT:"priority_support"};function ds(e){Object.assign(Ge,e)}var Ye={READ_PUBLIC:"read_public",READ_OWN_DATA:"read_own_data",WRITE_OWN_DATA:"write_own_data",READ_ALL_DATA:"read_all_data",MANAGE_USERS:"manage_users"};function ps(e){Object.assign(Ye,e)}import*as u from"valibot";function ue(e){let[t,...n]=Object.values(e);if(t===void 0)throw new Error("picklistOptions: constant map has no values");return[t,...n]}var vt=u.object({id:u.string(),email:u.optional(u.nullable(u.pipe(u.string(),u.email()))),displayName:u.optional(u.nullable(u.string())),photoURL:u.optional(u.nullable(u.pipe(u.string(),u.url()))),emailVerified:u.optional(u.boolean()),lastLoginAt:u.optional(u.string()),providerData:u.optional(u.array(u.object({providerId:u.string(),uid:u.string(),email:u.optional(u.nullable(u.pipe(u.string(),u.email()))),displayName:u.optional(u.nullable(u.string())),photoURL:u.optional(u.nullable(u.pipe(u.string(),u.url()))),phoneNumber:u.optional(u.nullable(u.string()))}))),role:u.optional(u.picklist(ue(O))),customClaims:u.optional(u.record(u.string(),u.any()))}),B=u.object({tier:u.string(),status:u.string(),subscriptionEnd:u.nullable(u.pipe(u.string(),u.isoTimestamp())),updatedAt:u.pipe(u.string(),u.isoTimestamp()),isDefault:u.optional(u.boolean()),features:u.optional(u.array(u.string())),subscriptionId:u.optional(u.nullable(u.string())),customerId:u.optional(u.nullable(u.string())),cancelAtPeriodEnd:u.optional(u.boolean())}),bt=u.object({...B.entries,userId:u.string(),isActive:u.optional(u.boolean())}),Et=u.object({role:u.optional(u.picklist(ue(O))),subscription:u.optional(B),features:u.optional(u.array(u.picklist(ue(Ge)))),permissions:u.optional(u.array(u.picklist(ue(Ye)))),githubAccess:u.optional(u.object({username:u.optional(u.string()),teamAccess:u.optional(u.array(u.string())),repoAccess:u.optional(u.array(u.string()))}))});function ys(e){return u.safeParse(vt,e)}function vs(e){return u.safeParse(bt,e)}function bs(e){return u.safeParse(Et,e)}function pr(e){return u.safeParse(B,e)}function Es(){let e={authUser:u.safeParse(vt,{}),userSubscription:u.safeParse(bt,{}),customClaims:u.safeParse(Et,{}),getUserAuthStatus:u.safeParse(u.object({userId:u.pipe(u.string(),u.minLength(1))}),{}),getCustomClaims:u.safeParse(u.object({userId:u.pipe(u.string(),u.minLength(1)),claimKeys:u.optional(u.array(u.string()))}),{}),setCustomClaims:u.safeParse(u.object({userId:u.pipe(u.string(),u.minLength(1)),claims:u.record(u.string(),u.any()),merge:u.optional(u.boolean(),!1)}),{}),removeCustomClaims:u.safeParse(u.object({userId:u.pipe(u.string(),u.minLength(1)),claimKeys:u.pipe(u.array(u.string()),u.minLength(1))}),{})};return{success:Object.values(e).every(t=>t.success),results:e}}var xs={VERIFIED:"verified",PENDING:"pending",ERROR:"error"},Ts={IDLE:"idle",LOADING:"loading",ERROR:"error",AUTHENTICATED:"authenticated"};function Rs(e){return{userId:e,role:"user",preferences:{},metadata:{}}}var xe={PAYMENT:"payment",SUBSCRIPTION:"subscription"};function Ps(e){Object.assign(xe,e)}var Ds={ONE_MONTH:"1month",THREE_MONTHS:"3months",SIX_MONTHS:"6months",ONE_YEAR:"1year",TWO_YEARS:"2years",LIFETIME:"lifetime"};import*as o from"valibot";var St=100,mr=o.object({productId:o.pipe(o.string(),o.minLength(1),o.maxLength(200)),quantity:o.pipe(o.number(),o.integer(),o.minValue(1),o.maxValue(1e4))}),Rt=o.pipe(o.object({billingConfigKey:o.optional(o.pipe(o.string(),o.minLength(1))),lineItems:o.optional(o.pipe(o.array(mr),o.minLength(1,"At least one line item is required"),o.maxLength(St,`At most ${St} line items`))),successUrl:o.pipe(o.string(),o.url()),cancelUrl:o.pipe(o.string(),o.url()),customerEmail:o.optional(o.pipe(o.string(),o.email())),metadata:o.optional(o.record(o.string(),o.string())),allowPromotionCodes:o.optional(o.boolean()),userId:o.optional(o.string()),productId:o.optional(o.string()),priceId:o.optional(o.string()),currency:o.optional(o.pipe(o.string(),o.length(3,"Currency must be 3-letter ISO code"))),userEmail:o.optional(o.pipe(o.string(),o.email())),mode:o.optional(o.picklist([xe.PAYMENT,xe.SUBSCRIPTION]))}),o.rawTransform(({dataset:e,addIssue:t,NEVER:n})=>{let r=e.value,i=r.billingConfigKey||r.metadata?.billingConfigKey;return i?{...r,billingConfigKey:i,lineItems:r.lineItems??[{productId:i,quantity:1}]}:(t({message:"billingConfigKey is required"}),n)})),kt=o.object({sessionId:o.string(),sessionUrl:o.nullable(o.pipe(o.string(),o.url()))}),ce=o.pipe(o.string(),o.minLength(1),o.regex(/\S/)),fr=o.object({sessionId:ce,billingConfigKey:ce}),gr=o.object({sessionId:ce,orderId:ce,billingConfigKey:ce,sessionStatus:o.picklist(["open","complete","expired"]),paymentStatus:o.picklist(["paid","unpaid","no_payment_required"])});function Vs(e){return o.safeParse(fr,e)}function $s(e){return o.safeParse(gr,e)}var At=o.object({...B.entries,userId:o.string(),subscriptionId:o.nullable(o.string()),customerId:o.string(),cancelAtPeriodEnd:o.boolean()}),Ct=o.object({id:o.string(),type:o.string(),data:o.object({object:o.any()}),created:o.pipe(o.string(),o.isoTimestamp())}),It=o.looseObject({userId:o.optional(o.string()),firebaseUid:o.optional(o.string()),productType:o.optional(o.string())});function js(e){return o.safeParse(Rt,e)}function qs(e){return o.safeParse(kt,e)}function Ws(e){return o.safeParse(At,e)}function Hs(e){return o.safeParse(Ct,e)}function Ks(e){return o.safeParse(It,e)}var hr=o.object({type:o.literal("StripePayment"),name:o.pipe(o.string(),o.minLength(1,"Product name is required")),description:o.optional(o.string()),price:o.string(),currency:o.optional(o.pipe(o.string(),o.length(3,"Currency must be 3-letter ISO code")),"EUR"),priceId:o.optional(o.pipe(o.string(),o.minLength(1,"Stripe price ID is required"))),tier:o.pipe(o.string(),o.minLength(1,"Tier is required")),duration:o.pipe(o.string(),o.minLength(1,"Duration is required")),allowPromotionCodes:o.optional(o.boolean()),metadata:o.optional(o.record(o.string(),o.string()))}),yr=o.object({type:o.literal("StripeSubscription"),name:o.pipe(o.string(),o.minLength(1,"Product name is required")),description:o.optional(o.string()),price:o.string(),currency:o.optional(o.pipe(o.string(),o.length(3,"Currency must be 3-letter ISO code")),"EUR"),priceId:o.pipe(o.string(),o.minLength(1,"Stripe price ID is required")),tier:o.pipe(o.string(),o.minLength(1,"Tier is required")),duration:o.picklist(["1month","3months","6months","1year","2years","lifetime"]),allowPromotionCodes:o.optional(o.boolean()),metadata:o.optional(o.record(o.string(),o.string()))}),vr=o.variant("type",[hr,yr]),Gs=o.record(o.string(),vr),br=o.record(o.string(),o.object({name:o.string(),price:o.string(),currency:o.string(),description:o.optional(o.string()),features:o.optional(o.array(o.string())),priceId:o.optional(o.string()),allowPromotionCodes:o.optional(o.boolean())})),xt={name:o.string(),price:o.number(),currency:o.string(),priceId:o.optional(o.string()),tier:o.string(),duration:o.string(),description:o.optional(o.string()),metadata:o.optional(o.record(o.string(),o.string())),allowPromotionCodes:o.optional(o.boolean())},Er=o.variant("mode",[o.object({mode:o.literal("manual"),taxRateIds:o.pipe(o.array(o.pipe(o.string(),o.minLength(1))),o.minLength(1))}),o.object({mode:o.literal("automatic")})]),Tt=5,Sr=o.object({allowedCountries:o.pipe(o.array(o.pipe(o.string(),o.regex(/^[A-Z]{2}$/,"allowedCountries: uppercase ISO 3166-1 alpha-2 code expected (e.g. FR)"))),o.minLength(1)),shippingRateIds:o.optional(o.pipe(o.array(o.pipe(o.string(),o.minLength(1))),o.maxLength(Tt,`shippingRateIds: at most ${Tt} (Stripe limit)`)))}),xr=o.object({type:o.literal("StripeOrder"),name:o.string(),currency:o.pipe(o.string(),o.length(3)),description:o.optional(o.string()),metadata:o.optional(o.record(o.string(),o.string())),allowPromotionCodes:o.optional(o.boolean()),tax:Er,taxIdCollection:o.picklist(["disabled","optional","required"]),billingAddressCollection:o.picklist(["auto","required"]),shipping:o.optional(Sr),customerCreation:o.picklist(["always","if_required"]),invoiceCreation:o.boolean(),paymentMethodConfiguration:o.optional(o.pipe(o.string(),o.minLength(1)))}),Tr=o.record(o.string(),o.variant("type",[o.object({type:o.literal("StripePayment"),...xt}),o.object({type:o.literal("StripeSubscription"),...xt}),xr]));function Ys(e){return o.parse(br,e)}function zs(e){return o.parse(Tr,e)}function Xs(){let e={createCheckoutSessionRequest:o.safeParse(Rt,{}),createCheckoutSessionResponse:o.safeParse(kt,{}),subscriptionData:o.safeParse(At,{}),subscriptionClaims:o.safeParse(B,{}),webhookEvent:o.safeParse(Ct,{}),checkoutSessionMetadata:o.safeParse(It,{})};return{success:Object.values(e).every(t=>t.success),results:e}}var ra={VITE:"vite",NEXTJS:"nextjs",EXPO:"expo",REACT_NATIVE:"react-native",UNKNOWN:"unknown"},ia={DEVELOPMENT:"development",PRODUCTION:"production",TEST:"test"},oa={CLIENT:"client",SERVER:"server",BUILD:"build"},sa={HIGH:.95,MEDIUM:.8,LOW:.7,MINIMUM:.3},aa={INITIALIZING:"initializing",READY:"ready",DEGRADED:"degraded",ERROR:"error"},la={LOCAL:"localStorage",SESSION:"sessionStorage",INDEXED_DB:"indexedDB",MEMORY:"memory"},ua={USER:"user",GLOBAL:"global",SESSION:"session"},ca={STANDALONE:"standalone",FULLSCREEN:"fullscreen",MINIMAL_UI:"minimal-ui",BROWSER:"browser"},da={MANIFEST:"manifest",SERVICE_WORKER:"service-worker",ICON:"icon"},pa={AUTO:"auto-discovery",MANUAL:"manual",HYBRID:"hybrid"};var fa={GUEST:"guest",USER:"user",ADMIN:"admin",SUPER:"super",TECHNICAL:"technical",HIDDEN:"hidden",OWNER:"owner"},q={TRUE:!0,FALSE:!1,USER:"user",ADMIN:"admin",SUPER:"super",CREATE_ONLY:"create-only",GENERATED:"generated",COMPUTED:"computed"},ze={create:"admin",read:"guest",update:"admin",delete:"admin"},V={draft:{read:"admin",saveIncomplete:!0,holdIncomplete:!0,isDefault:!1,isRemoved:!1},available:{read:"guest",saveIncomplete:!1,holdIncomplete:!1,isDefault:!0,isRemoved:!1},deleted:{read:"admin",saveIncomplete:!1,holdIncomplete:!0,isDefault:!1,isRemoved:!0}},wt=V.available,J=Object.keys(V);function Ot(e){let t=J.filter(n=>V[n][e]);if(t.length!==1)throw new Error(`[dndev] STATUS_MATRIX: exactly one status must have ${e}`);return t[0]}var Te=Ot("isDefault"),Xe=Ot("isRemoved"),Rr=J.filter(e=>V[e].read!=="guest"),de=["id","createdAt","updatedAt","createdById","updatedById"],K={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">=",IN:"in",NOT_IN:"not-in",ARRAY_CONTAINS:"array-contains",ARRAY_CONTAINS_ANY:"array-contains-any"},ga={ASC:"asc",DESC:"desc"},ha={LIST:"list",LIST_CARD:"listCard"},Pt=["address","array","avatar","badge","boolean","checkbox","color","combobox","date","datetime-local","document","documents","duration","email","field-array","file","files","gdprConsent","geopoint","hidden","iban","image","images","map","month","multiselect","number","currency","price","password","radio","reference","range","rating","reset","richtext","select","submit","switch","tel","text","textarea","time","timestamp","url","week","year"];var ba={COUNT:"count",SUM:"sum",AVG:"avg",MIN:"min",MAX:"max"},Ea={EQ:K.EQ,NEQ:K.NEQ,LT:K.LT,LTE:K.LTE,GT:K.GT,GTE:K.GTE};var Dt=class extends Error{constructor(n,r,i){super(n,{cause:i});k(this,"outcome");this.name="AtomicBulkError",this.outcome=r}},Ft=class extends Error{constructor(n,r){super(`BulkCollisionError: ${n.length} id(s) appear in both "${r.replace("-",'" and "')}" \u2014 ${n.join(", ")}`);k(this,"collidingIds");k(this,"where");this.name="BulkCollisionError",this.collidingIds=n,this.where=r}},Nt=class extends Error{constructor(n){super(`[dndev] bulkAcross: circular dependency: ${n.join(" \u2192 ")}`);k(this,"cycle");this.name="BulkAcrossCycleError",this.cycle=n}},_t=class extends Error{constructor(n){super(`BulkNotImplementedError: adapter "${n}" has not implemented bulk() yet`);k(this,"adapterName");this.name="BulkNotImplementedError",this.adapterName=n}};import*as h from"valibot";var Ia=h.object({collection:h.pipe(h.string(),h.minLength(1,"Collection name is required")),data:h.record(h.string(),h.unknown()),idempotencyKey:h.optional(h.string())}),wa=h.object({collection:h.pipe(h.string(),h.minLength(1,"Collection name is required")),id:h.pipe(h.string(),h.minLength(1,"Entity ID is required"))}),Oa=h.object({collection:h.pipe(h.string(),h.minLength(1,"Collection name is required")),id:h.pipe(h.string(),h.minLength(1,"Entity ID is required")),data:h.record(h.string(),h.unknown()),merge:h.optional(h.boolean(),!1)}),Pa=h.object({collection:h.pipe(h.string(),h.minLength(1,"Collection name is required")),id:h.pipe(h.string(),h.minLength(1,"Entity ID is required"))}),Da=h.object({collection:h.pipe(h.string(),h.minLength(1,"Collection name is required")),limit:h.optional(h.pipe(h.number(),h.minValue(1),h.maxValue(1e3)),1e3),offset:h.optional(h.pipe(h.number(),h.minValue(0)),0),orderBy:h.optional(h.string()),orderDirection:h.optional(h.picklist(["asc","desc"]),"desc"),where:h.optional(h.array(h.object({field:h.string(),operator:h.picklist(["==","!=","<","<=",">",">=","array-contains","in","not-in"]),value:h.unknown()})))});var Wa={RESEND:"resend"},Ha={UNKNOWN:"unknown",UNAUTHENTICATED:"unauthenticated",INVALID_REQUEST:"invalid_request",PROVIDER_ERROR:"provider_error",TEMPLATE_NOT_FOUND:"template_not_found",RATE_LIMIT_EXCEEDED:"rate_limit_exceeded",MISSING_API_KEY:"missing_api_key"};import*as E from"valibot";var kr=E.object({templateId:E.pipe(E.string(),E.minLength(1)),to:E.pipe(E.string(),E.email()),data:E.record(E.string(),E.unknown()),locale:E.optional(E.pipe(E.string(),E.minLength(2),E.maxLength(5)),"fr"),from:E.optional(E.string()),replyTo:E.optional(E.string())}),Ar=E.object({success:E.boolean(),messageId:E.optional(E.string()),error:E.optional(E.string())});function Ga(e){return E.safeParse(kr,e)}function Ya(e){return E.safeParse(Ar,e)}var pe={ALREADY_EXISTS:"already-exists",CANCELLED:"cancelled",DEADLINE_EXCEEDED:"deadline-exceeded",DELETE_ACCOUNT_REQUIRES_SERVER:"DELETE_ACCOUNT_REQUIRES_SERVER",INTERNAL:"internal",INVALID_ARGUMENT:"invalid-argument",NOT_FOUND:"not-found",PERMISSION_DENIED:"permission-denied",RATE_LIMIT_EXCEEDED:"rate-limit-exceeded",TIMEOUT:"timeout",UNAUTHENTICATED:"unauthenticated",UNAVAILABLE:"unavailable",UNIMPLEMENTED:"unimplemented",UNKNOWN:"unknown",VALIDATION_FAILED:"validation-failed"},el={ERROR:"error",WARNING:"warning",INFO:"info",SUCCESS:"success"},Re={INTERNAL_ERROR:"INTERNAL_ERROR",VALIDATION_ERROR:"VALIDATION_ERROR",PERMISSION_DENIED:"PERMISSION_DENIED",NOT_FOUND:"NOT_FOUND",ALREADY_EXISTS:"ALREADY_EXISTS",NETWORK_ERROR:"NETWORK_ERROR"},Qe={[pe.PERMISSION_DENIED]:{type:Re.PERMISSION_DENIED,message:"You do not have permission to perform this action"},[pe.NOT_FOUND]:{type:Re.NOT_FOUND,message:"The requested resource was not found"},[pe.ALREADY_EXISTS]:{type:Re.ALREADY_EXISTS,message:"The resource already exists"},[pe.INVALID_ARGUMENT]:{type:Re.VALIDATION_ERROR,message:"Invalid argument provided"}},Ut=class extends Error{constructor(n,r,i){super(r);k(this,"type");k(this,"originalError");this.name="EntityHookError",this.type=n,this.originalError=i}},tl={AUTH:"auth",OAUTH:"oauth",FIREBASE:"firebase",API:"api",VALIDATION:"validation",ENTITY:"entity",UI:"ui",UNKNOWN:"unknown"};function Cr(e){return"captureStackTrace"in e&&typeof e.captureStackTrace=="function"}var R=class e extends Error{constructor(n,r=pe.INTERNAL,i){super(n);k(this,"code");k(this,"details");k(this,"source");k(this,"originalError");k(this,"context");k(this,"displayable");k(this,"userMessageProvided");Object.setPrototypeOf(this,e.prototype),this.code=r,this.details=i?.details,this.source=i?.source,this.originalError=i?.originalError,this.context=i?.context,this.displayable=i?.displayable??!0,this.userMessageProvided=i?.userMessageProvided,this.name=this.constructor.name,Cr(Error)&&Error.captureStackTrace(this,this.constructor)}toString(){return`${this.name} [${this.code}]: ${this.message}`}toJSON(){return{name:this.name,code:this.code,message:this.message,details:this.details,source:this.source,originalError:this.originalError,context:this.context,displayable:this.displayable,userMessageProvided:this.userMessageProvided}}};var sl={AUTH_STATE_CHANGED:"auth.state.changed",USER_SIGNED_IN:"auth.user.signed_in",USER_SIGNED_OUT:"auth.user.signed_out",USER_UPDATED:"auth.user.updated",TOKEN_REFRESHED:"auth.token.refreshed",SUBSCRIPTION_UPDATED:"auth.subscription.updated",SUBSCRIPTION_CHANGED:"auth.subscription.changed",SUBSCRIPTION_CANCELLED:"auth.subscription.cancelled",SUBSCRIPTION_EXPIRED:"auth.subscription.expired",PERMISSIONS_UPDATED:"auth.permissions.updated",ACCOUNT_LINKED:"auth.account.linked",ACCOUNT_UNLINKED:"auth.account.unlinked",ACCOUNT_LINKING_REQUIRED:"auth.account.linking_required",AUTH_SUCCESS:"auth.success",EMAIL_VERIFICATION_SENT:"auth.email.verification_sent",PASSWORD_RESET_SENT:"auth.password.reset_sent",AUTH_ERROR:"auth.error"};var ll={BILLING_INITIALIZED:"billing.initialized",BILLING_ERROR:"billing.error",CHECKOUT_SESSION_CREATED:"billing.checkout_session.created",CHECKOUT_SESSION_FAILED:"billing.checkout_session.failed",SUBSCRIPTION_CREATED:"billing.subscription.created",SUBSCRIPTION_UPDATED:"billing.subscription.updated",SUBSCRIPTION_CANCELLED:"billing.subscription.cancelled",SUBSCRIPTION_RENEWED:"billing.subscription.renewed",SUBSCRIPTION_EXPIRED:"billing.subscription.expired",SUBSCRIPTION_TRIAL_ENDED:"billing.subscription.trial_ended",PAYMENT_SUCCEEDED:"billing.payment.succeeded",PAYMENT_FAILED:"billing.payment.failed",PAYMENT_REFUNDED:"billing.payment.refunded",PAYMENT_METHOD_ADDED:"billing.payment_method.added",PAYMENT_METHOD_UPDATED:"billing.payment_method.updated",PAYMENT_METHOD_REMOVED:"billing.payment_method.removed",PAYMENT_METHOD_DEFAULT_CHANGED:"billing.payment_method.default_changed",INVOICE_CREATED:"billing.invoice.created",INVOICE_UPDATED:"billing.invoice.updated",INVOICE_PAID:"billing.invoice.paid",INVOICE_FAILED:"billing.invoice.failed",WEBHOOK_RECEIVED:"billing.webhook.received",WEBHOOK_PROCESSED:"billing.webhook.processed",WEBHOOK_ERROR:"billing.webhook.error"};var cl={OAUTH_STARTED:"oauth.started",OAUTH_SUCCESS:"oauth.success",OAUTH_ERROR:"oauth.error",OAUTH_CANCELLED:"oauth.cancelled",OAUTH_TOKEN_EXCHANGED:"oauth.token.exchanged",OAUTH_TOKEN_REFRESHED:"oauth.token.refreshed",OAUTH_PARTNER_LINKED:"oauth.partner.linked",OAUTH_PARTNER_UNLINKED:"oauth.partner.unlinked"};var pl={DOCUMENT_CREATED:"payload.document.created",DOCUMENT_UPDATED:"payload.document.updated",DOCUMENT_DELETED:"payload.document.deleted",MEDIA_CREATED:"payload.media.created",MEDIA_UPDATED:"payload.media.updated",MEDIA_DELETED:"payload.media.deleted",GLOBAL_UPDATED:"payload.global.updated",USER_CREATED:"payload.user.created",USER_UPDATED:"payload.user.updated",USER_DELETED:"payload.user.deleted",CACHE_INVALIDATED:"payload.cache.invalidated",PAGE_REGENERATED:"payload.page.regenerated"};var fl={PAYMENT_INTENT_SUCCEEDED:"stripe.payment_intent.succeeded",PAYMENT_INTENT_FAILED:"stripe.payment_intent.payment_failed",CHECKOUT_SESSION_COMPLETED:"stripe.checkout.session.completed",CUSTOMER_CREATED:"stripe.customer.created",CUSTOMER_UPDATED:"stripe.customer.updated",CUSTOMER_DELETED:"stripe.customer.deleted",INVOICE_CREATED:"stripe.invoice.created",INVOICE_PAID:"stripe.invoice.paid",INVOICE_PAYMENT_FAILED:"stripe.invoice.payment_failed",SUBSCRIPTION_CREATED:"stripe.subscription.created",SUBSCRIPTION_UPDATED:"stripe.subscription.updated",SUBSCRIPTION_DELETED:"stripe.subscription.deleted"};import"valibot";var Ze={mobile:0,tablet:768,laptop:1024,desktop:1440},Ir={mobile:{min:0,max:767},tablet:{min:768,max:1023},laptop:{min:1024,max:1439},desktop:{min:1440,max:1/0}};function wr(e){return e>=Ze.desktop?"desktop":e>=Ze.laptop?"laptop":e>=Ze.tablet?"tablet":"mobile"}function Cl(e,t){let n=Ir[t];return e>=n.min&&e<=n.max}function Il(e,t){let n=wr(e);return{current:n,width:e,height:t,isMobile:n==="mobile",isTablet:n==="tablet",isLaptop:n==="laptop",isDesktop:n==="desktop",isMobileOrTablet:n==="mobile"||n==="tablet",isLaptopOrDesktop:n==="laptop"||n==="desktop"}}var Or="landing",Pr="/og-image.png",Dr={FIXED:"fixed",SCROLL:"scroll"},Fr={ADMIN:"admin",BLOG:"blog",DOCS:"docs",GAME:"game",LANDING:"landing",MOOLTI:"moolti",PLAIN:"plain"};var Mt=["pull","push","admin","maintain","triage"];import"valibot";import*as g from"valibot";var Je=g.object({owner:g.pipe(g.string(),g.minLength(1,"Repository owner is required")),repo:g.pipe(g.string(),g.minLength(1,"Repository name is required"))}),Nr=g.picklist([...Mt]),$l=g.object({userId:g.pipe(g.string(),g.minLength(1,"User ID is required")),githubUsername:g.pipe(g.string(),g.minLength(1,"GitHub username is required")),repoConfig:Je,permission:g.optional(Nr,"push"),customClaims:g.optional(g.record(g.string(),g.any()))}),jl=g.object({userId:g.pipe(g.string(),g.minLength(1,"User ID is required")),githubUsername:g.pipe(g.string(),g.minLength(1,"GitHub username is required")),repoConfig:Je}),ql=g.object({userId:g.pipe(g.string(),g.minLength(1,"User ID is required")),githubUsername:g.pipe(g.string(),g.minLength(1,"GitHub username is required")),repoConfig:Je}),Wl=g.object({provider:g.string(),purpose:g.picklist(["authentication","api-access"]),code:g.pipe(g.string(),g.minLength(1,"Authorization code is required")),redirectUri:g.pipe(g.string(),g.url("Valid redirect URI is required")),codeVerifier:g.optional(g.string()),state:g.optional(g.string()),instance:g.optional(g.pipe(g.string(),g.url()))}),Hl=g.object({provider:g.string(),refreshToken:g.pipe(g.string(),g.minLength(1,"Refresh token is required")),redirectUri:g.pipe(g.string(),g.url("Valid redirect URI is required"))}),Kl=g.object({provider:g.string()}),Gl=g.object({userId:g.pipe(g.string(),g.minLength(1,"User ID is required"))});var Jl={apple:"apple",discord:"discord",emailLink:"emailLink",facebook:"facebook",github:"github",google:"google",linkedin:"linkedin",microsoft:"microsoft",password:"password",reddit:"reddit",spotify:"spotify",twitch:"twitch",twitter:"twitter",yahoo:"yahoo",notion:"notion",slack:"slack",medium:"medium",mastodon:"mastodon",youtube:"youtube"};import*as v from"valibot";var Lt=v.object({name:v.string(),color:v.string(),icon:v.string(),customParameters:v.optional(v.record(v.string(),v.string())),button:v.object({backgroundColor:v.string(),textColor:v.string(),borderColor:v.string(),hoverBackgroundColor:v.string(),focusOutlineColor:v.string(),fontWeight:v.optional(v.string(),"500"),textKey:v.optional(v.string())})}),_r=v.object({...Lt.entries,type:v.picklist(["auth","both"]),scopes:v.optional(v.array(v.string())),firebaseProviderId:v.optional(v.string())}),ke=v.union([v.literal(""),v.pipe(v.string(),v.url())]),Ur=v.object({authUrl:ke,tokenUrl:ke,profileUrl:ke,revokeUrl:v.optional(ke)}),Mr=v.object({authentication:v.optional(v.array(v.string())),"api-access":v.array(v.string())}),Lr=v.optional(v.object({pkce:v.optional(v.boolean(),!1),codeChallengeMethod:v.optional(v.picklist(["S256","plain"]),"S256")})),Br=v.object({...Lt.entries,type:v.picklist(["oauth","both"]),scopes:Mr,endpoints:Ur,capabilities:Lr}),Bt={apple:{name:"Apple",color:"#000000",icon:"apple",type:"both",scopes:["email","name"],firebaseProviderId:"apple.com",customParameters:{prompt:"login"},button:{backgroundColor:"#000000",textColor:"#ffffff",borderColor:"#000000",hoverBackgroundColor:"#1a1a1a",focusOutlineColor:"#333333",fontWeight:"500",textKey:"buttons.apple"}},discord:{name:"Discord",color:"#5865F2",icon:"discord",type:"both",scopes:["identify","email"],firebaseProviderId:"discord.com",customParameters:{prompt:"consent"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.discord"}},emailLink:{name:"Email Link",color:"#10B981",icon:"emailLink",type:"auth",scopes:[],firebaseProviderId:"emailLink",customParameters:{},button:{backgroundColor:"#10B981",textColor:"#ffffff",borderColor:"#10B981",hoverBackgroundColor:"#059669",focusOutlineColor:"#059669",fontWeight:"500",textKey:"buttons.emailLink"}},facebook:{name:"Facebook",color:"#1877F2",icon:"facebook",type:"both",scopes:["email","public_profile"],firebaseProviderId:"facebook.com",customParameters:{auth_type:"reauthenticate"},button:{backgroundColor:"#1877F2",textColor:"#ffffff",borderColor:"#1877F2",hoverBackgroundColor:"#166FE5",focusOutlineColor:"#166FE5",fontWeight:"600",textKey:"buttons.facebook"}},github:{name:"GitHub",color:"#24292E",icon:"github",type:"both",scopes:["read:user","user:email"],firebaseProviderId:"github.com",customParameters:{allow_signup:"true"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.github"}},google:{name:"Google",color:"#4285F4",icon:"google",type:"both",scopes:["email","profile"],firebaseProviderId:"google.com",customParameters:{prompt:"select_account"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.google"}},linkedin:{name:"LinkedIn",color:"#0077B5",icon:"linkedin",type:"both",scopes:["r_liteprofile","r_emailaddress"],firebaseProviderId:"linkedin.com",customParameters:{prompt:"consent"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.linkedin"}},microsoft:{name:"Microsoft",color:"#00A4EF",icon:"microsoft",type:"both",scopes:["openid","email","profile"],firebaseProviderId:"microsoft.com",customParameters:{prompt:"select_account"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.microsoft"}},password:{name:"Email & Password",color:"#6B7280",icon:"password",type:"auth",scopes:[],firebaseProviderId:"password",customParameters:{},button:{backgroundColor:"#ffffff",textColor:"#374151",borderColor:"#D1D5DB",hoverBackgroundColor:"#F9FAFB",focusOutlineColor:"#3B82F6",fontWeight:"500",textKey:"buttons.password"}},reddit:{name:"Reddit",color:"#FF4500",icon:"reddit",type:"both",scopes:["identity"],firebaseProviderId:"reddit.com",customParameters:{duration:"permanent"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.reddit"}},spotify:{name:"Spotify",color:"#1DB954",icon:"spotify",type:"both",scopes:["user-read-email","user-read-private"],firebaseProviderId:"spotify.com",customParameters:{show_dialog:"true"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.spotify"}},twitch:{name:"Twitch",color:"#9146FF",icon:"twitch",type:"both",scopes:["user:read:email"],firebaseProviderId:"twitch.tv",customParameters:{force_verify:"true"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.twitch"}},twitter:{name:"X",color:"#000000",icon:"twitter",type:"both",scopes:[],firebaseProviderId:"twitter.com",customParameters:{force_login:"true"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.twitter"}},yahoo:{name:"Yahoo",color:"#5F01D1",icon:"yahoo",type:"both",scopes:["openid","email","profile"],firebaseProviderId:"yahoo.com",customParameters:{prompt:"select_account"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.yahoo"}}},Vt={google:{name:"Google",color:"#4285F4",icon:"google",type:"both",scopes:{authentication:["openid","profile","email"],"api-access":["https://www.googleapis.com/auth/drive.readonly","https://www.googleapis.com/auth/userinfo.profile","https://www.googleapis.com/auth/calendar.readonly","https://www.googleapis.com/auth/gmail.readonly"]},endpoints:{authUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",profileUrl:"https://www.googleapis.com/oauth2/v3/userinfo",revokeUrl:"https://oauth2.googleapis.com/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},github:{name:"GitHub",color:"#24292E",icon:"github",type:"both",scopes:{authentication:["read:user","user:email"],"api-access":["repo","user","read:org","gist","notifications"]},endpoints:{authUrl:"https://github.com/login/oauth/authorize",tokenUrl:"https://github.com/login/oauth/access_token",profileUrl:"https://api.github.com/user",revokeUrl:"https://api.github.com/applications/CLIENT_ID/token"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},discord:{name:"Discord",color:"#5865F2",icon:"discord",type:"both",scopes:{authentication:["identify","email"],"api-access":["guilds","guilds.members.read","bot","messages.read"]},endpoints:{authUrl:"https://discord.com/api/oauth2/authorize",tokenUrl:"https://discord.com/api/oauth2/token",profileUrl:"https://discord.com/api/users/@me",revokeUrl:"https://discord.com/api/oauth2/token/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},spotify:{name:"Spotify",color:"#1DB954",icon:"spotify",type:"both",scopes:{authentication:["user-read-email","user-read-private"],"api-access":["user-read-playback-state","user-modify-playback-state","user-read-currently-playing","playlist-read-private","playlist-modify-public","user-library-read"]},endpoints:{authUrl:"https://accounts.spotify.com/authorize",tokenUrl:"https://accounts.spotify.com/api/token",profileUrl:"https://api.spotify.com/v1/me",revokeUrl:"https://accounts.spotify.com/api/token"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},twitch:{name:"Twitch",color:"#9146FF",icon:"twitch",type:"both",scopes:{authentication:["user:read:email"],"api-access":["channel:read:subscriptions","bits:read","channel:manage:broadcast","channel:read:stream_key","user:read:follows"]},endpoints:{authUrl:"https://id.twitch.tv/oauth2/authorize",tokenUrl:"https://id.twitch.tv/oauth2/token",profileUrl:"https://api.twitch.tv/helix/users",revokeUrl:"https://id.twitch.tv/oauth2/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},reddit:{name:"Reddit",color:"#FF4500",icon:"reddit",type:"both",scopes:{authentication:["identity"],"api-access":["read","submit","vote","mysubreddits","subscribe"]},endpoints:{authUrl:"https://www.reddit.com/api/v1/authorize",tokenUrl:"https://www.reddit.com/api/v1/access_token",profileUrl:"https://oauth.reddit.com/api/v1/me",revokeUrl:"https://www.reddit.com/api/v1/revoke_token"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},linkedin:{name:"LinkedIn",color:"#0077B5",icon:"linkedin",type:"oauth",scopes:{"api-access":["r_liteprofile","r_emailaddress","w_member_social","r_organization_social"]},endpoints:{authUrl:"https://www.linkedin.com/oauth/v2/authorization",tokenUrl:"https://www.linkedin.com/oauth/v2/accessToken",profileUrl:"https://api.linkedin.com/v2/me",revokeUrl:"https://www.linkedin.com/oauth/v2/revoke"},capabilities:{pkce:!1},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},slack:{name:"Slack",color:"#E01E5A",icon:"slack",type:"oauth",scopes:{"api-access":["channels:read","chat:write","users:read","files:read","im:read"]},endpoints:{authUrl:"https://slack.com/oauth/v2/authorize",tokenUrl:"https://slack.com/api/oauth.v2.access",profileUrl:"https://slack.com/api/users.identity",revokeUrl:"https://slack.com/api/auth.revoke"},capabilities:{pkce:!1},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},notion:{name:"Notion",color:"#000000",icon:"notion",type:"oauth",scopes:{"api-access":["read","write"]},endpoints:{authUrl:"https://api.notion.com/v1/oauth/authorize",tokenUrl:"https://api.notion.com/v1/oauth/token",profileUrl:"https://api.notion.com/v1/users/me",revokeUrl:"https://api.notion.com/v1/oauth/revoke"},capabilities:{pkce:!1},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},medium:{name:"Medium",color:"#000000",icon:"medium",type:"oauth",scopes:{"api-access":["basicProfile","publishPost","listPublications"]},endpoints:{authUrl:"https://medium.com/m/oauth/authorize",tokenUrl:"https://medium.com/v1/tokens",profileUrl:"https://medium.com/v1/me",revokeUrl:"https://medium.com/v1/tokens/revoke"},capabilities:{pkce:!1},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},twitter:{name:"X",color:"#000000",icon:"twitter",type:"oauth",scopes:{"api-access":["tweet.read","users.read","follows.read","tweet.write","like.write"]},endpoints:{authUrl:"https://twitter.com/i/oauth2/authorize",tokenUrl:"https://api.twitter.com/2/oauth2/token",profileUrl:"https://api.twitter.com/2/users/me",revokeUrl:"https://api.twitter.com/2/oauth2/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},mastodon:{name:"Mastodon",color:"#6364FF",icon:"mastodon",type:"oauth",scopes:{"api-access":["read","write","follow","push"]},endpoints:{authUrl:"",tokenUrl:"",profileUrl:"",revokeUrl:""},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},youtube:{name:"YouTube",color:"#FF0000",icon:"youtube",type:"oauth",scopes:{"api-access":["https://www.googleapis.com/auth/youtube.readonly","https://www.googleapis.com/auth/youtube.upload","https://www.googleapis.com/auth/youtube.force-ssl"]},endpoints:{authUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",profileUrl:"https://www.googleapis.com/youtube/v3/channels",revokeUrl:"https://oauth2.googleapis.com/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},supabase:{name:"Supabase",color:"#3ECF8E",icon:"supabase",type:"oauth",scopes:{"api-access":["auth:read","auth:write","database:read","database:write","domains:read","domains:write","edge_functions:read","edge_functions:write","environment:read","environment:write","organizations:read","projects:read","projects:write","rest:read","rest:write","secrets:read","secrets:write","storage:read"]},endpoints:{authUrl:"https://api.supabase.com/v1/oauth/authorize",tokenUrl:"https://api.supabase.com/v1/oauth/token",profileUrl:"",revokeUrl:""},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#F1F3F5",textColor:"#11181C",borderColor:"#E6E8EB",hoverBackgroundColor:"#E6E8EB",focusOutlineColor:"#3ECF8E",fontWeight:"500"}},vercel:{name:"Vercel",color:"#000000",icon:"vercel",type:"oauth",scopes:{authentication:["openid","email","profile","offline_access"],"api-access":["project","project-env-vars","deployment","team","user"]},endpoints:{authUrl:"https://vercel.com/oauth/authorize",tokenUrl:"https://api.vercel.com/login/oauth/token",profileUrl:"https://api.vercel.com/login/oauth/userinfo",revokeUrl:"https://api.vercel.com/login/oauth/token/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}}},Vr=v.record(v.string(),_r),$r=v.record(v.string(),Br);function tu(){return v.safeParse(Vr,Bt)}function nu(){return v.safeParse($r,Vt)}function ru(e){return e in Bt}function iu(e){return e in Vt}var $t={NECESSARY:"necessary",FUNCTIONAL:"functional",ANALYTICS:"analytics",MARKETING:"marketing"},fu={COMPACT:"compact",STANDARD:"standard",EXPRESSIVE:"expressive"},gu={auth:{requiresConsent:null},oauth:{requiresConsent:null},billing:{requiresConsent:null},analytics:{requiresConsent:$t.ANALYTICS},marketing:{requiresConsent:$t.MARKETING}};function Hu(e,t){return Object.assign(e,{metadata:t})}import*as oe from"valibot";import*as c from"valibot";function jt(e){return e instanceof Error&&"source"in e&&typeof e.source=="string"?e.source:typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&e.code.startsWith("auth/")?"auth":typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&e.code.startsWith("oauth/")?"oauth":typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&["permission-denied","unavailable","not-found","already-exists","unauthenticated","invalid-argument","failed-precondition","resource-exhausted"].includes(e.code)?"firebase":typeof e=="object"&&e!==null&&"issues"in e&&Array.isArray(e.issues)&&"name"in e&&e.name==="ValiError"?"validation":e instanceof Error&&e.name==="EntityHookError"?"entity":typeof e=="object"&&e!==null&&("response"in e||"status"in e||"statusText"in e)?"api":typeof e=="object"&&e!==null&&"componentStack"in e?"ui":"unknown"}import*as Wt from"valibot";function $(e){return(t,n)=>{if(t instanceof R)return t;if(typeof t!="object"||t===null){let l=typeof t=="string"?t:e.defaultErrorMessage;return new R(n||l,e.defaultErrorCode,{details:{originalError:t},source:e.errorSource})}let r;e.extractErrorCode?r=e.extractErrorCode(t):"code"in t&&typeof t.code=="string"&&(r=t.code);let i=e.defaultErrorCode;r&&e.errorCodeMapping&&r in e.errorCodeMapping&&(i=e.errorCodeMapping[r]);let s;e.extractErrorMessage?s=e.extractErrorMessage(t):("message"in t&&typeof t.message=="string"||t instanceof Error)&&(s=t.message),r&&e.friendlyMessageMapping&&r in e.friendlyMessageMapping&&(s=e.friendlyMessageMapping[r]),s||(s=e.defaultErrorMessage);let a;return e.processMetadata?a=e.processMetadata(t):(a={originalError:t},r&&(a.originalCode=r)),"originalError"in a||(a.originalError=t),new R(n||s,i,{details:a,source:e.errorSource})}}var Ae={"permission-denied":"permission-denied",unavailable:"unavailable","not-found":"not-found","already-exists":"already-exists",unauthenticated:"unauthenticated","invalid-argument":"invalid-argument","failed-precondition":"invalid-argument","resource-exhausted":"rate-limit-exceeded","deadline-exceeded":"timeout",cancelled:"cancelled","not-implemented":"unimplemented"};var ee={"already-exists":"The resource already exists.",cancelled:"The operation was cancelled.","deadline-exceeded":"The operation timed out.",DELETE_ACCOUNT_REQUIRES_SERVER:"Account deletion requires a server endpoint. Configure a callable provider or deploy a delete-account Edge Function.",internal:"An internal error occurred.","invalid-argument":"Invalid argument provided.","not-found":"The requested resource was not found.","permission-denied":"You do not have permission to perform this action.","rate-limit-exceeded":"Too many requests. Please try again later.",timeout:"The operation timed out.",unauthenticated:"Authentication is required for this action.",unavailable:"The service is currently unavailable.",unimplemented:"This feature is not implemented.",unknown:"An unknown error occurred.","validation-failed":"Validation failed."},jr={400:"invalid-argument",401:"unauthenticated",403:"permission-denied",404:"not-found",409:"already-exists",422:"validation-failed",429:"rate-limit-exceeded",500:"internal",501:"unimplemented",502:"unavailable",503:"unavailable",504:"timeout"},et={INTERNAL_ERROR:"internal",VALIDATION_ERROR:"validation-failed",PERMISSION_DENIED:"permission-denied",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",NETWORK_ERROR:"unavailable"};function qr(e){return e in et}var W={auth:{errorSource:"auth",defaultErrorCode:"unknown",defaultErrorMessage:"An authentication error occurred",errorCodeMapping:{"auth/user-not-found":"not-found","auth/wrong-password":"invalid-argument","auth/email-already-in-use":"already-exists","auth/weak-password":"validation-failed","auth/invalid-email":"validation-failed","auth/account-exists-with-different-credential":"already-exists","auth/credential-already-in-use":"already-exists","auth/requires-recent-login":"unauthenticated","auth/user-disabled":"permission-denied","auth/too-many-requests":"rate-limit-exceeded","auth/network-request-failed":"unavailable","auth/popup-blocked":"unavailable","auth/popup-closed-by-user":"invalid-argument","auth/cancelled-popup-request":"invalid-argument","auth/operation-not-allowed":"unimplemented","auth/invalid-credential":"invalid-argument","auth/invalid-verification-code":"invalid-argument","auth/captcha-check-failed":"validation-failed","auth/invalid-phone-number":"validation-failed","auth/missing-phone-number":"invalid-argument","auth/quota-exceeded":"rate-limit-exceeded","auth/timeout":"unavailable","auth/web-storage-unsupported":"unavailable","auth/unauthorized-domain":"permission-denied","auth/internal-error":"internal","auth/invalid-action-code":"invalid-argument","auth/invalid-continue-uri":"invalid-argument","auth/missing-continue-uri":"invalid-argument","auth/missing-ios-bundle-id":"invalid-argument","auth/missing-android-pkg-name":"invalid-argument","auth/unauthorized-continue-uri":"permission-denied","auth/invalid-dynamic-link-domain":"invalid-argument","auth/invalid-tenant-id":"invalid-argument","auth/tenant-id-mismatch":"invalid-argument","auth/provider-already-linked":"already-exists","auth/invalid-persistence-type":"invalid-argument","auth/unsupported-persistence-type":"unimplemented","auth/invalid-provider":"invalid-argument","auth/invalid-client-id":"invalid-argument","oauth/unauthorized-app":"permission-denied","auth/provider-not-enabled":"unimplemented","auth/unknown-provider":"invalid-argument","auth/missing-provider":"invalid-argument","auth/no-user-signed-in":"unauthenticated",DELETE_ACCOUNT_REQUIRES_SERVER:"DELETE_ACCOUNT_REQUIRES_SERVER",...Ae},friendlyMessageMapping:{"auth/user-not-found":"No account found with this email address.","auth/wrong-password":"Incorrect password. Please try again.","auth/email-already-in-use":"An account with this email already exists.","auth/weak-password":"Password is too weak. It should be at least 6 characters.","auth/invalid-email":"Please enter a valid email address.","auth/account-exists-with-different-credential":"An account already exists with the same email but different sign-in method.","auth/credential-already-in-use":"This credential is already associated with a different user account.","auth/requires-recent-login":"This operation requires you to sign in again for security reasons.","auth/user-disabled":"This account has been disabled.","auth/too-many-requests":"Too many sign-in attempts. Please try again later.","auth/network-request-failed":"Network connection error. Please check your internet connection.","auth/popup-blocked":"Sign-in popup was blocked. Please allow popups for this site.","auth/popup-closed-by-user":"Sign-in popup was closed before completion.","auth/operation-not-allowed":"This sign-in method is not enabled for this project.","auth/internal-error":"An internal authentication error occurred. Please try again.","auth/invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","auth/invalid-continue-uri":"The continue URL provided is invalid.","auth/missing-continue-uri":"A continue URL must be provided in the request.","auth/missing-ios-bundle-id":"An iOS Bundle ID must be provided in the request.","auth/missing-android-pkg-name":"An Android package name must be provided in the request.","auth/unauthorized-continue-uri":"The domain of the continue URL is not allowlisted.","auth/invalid-dynamic-link-domain":"The provided dynamic link domain is not authorized.","auth/invalid-tenant-id":"The provided tenant ID is invalid.","auth/tenant-id-mismatch":"The tenant ID of the provider does not match the tenant ID of the current user.","auth/provider-already-linked":"This authentication provider is already linked to the account.","auth/invalid-persistence-type":"The specified persistence type is invalid.","auth/unsupported-persistence-type":"The current environment does not support the specified persistence type.","auth/invalid-provider":"The specified authentication provider is invalid.","auth/invalid-client-id":"The authentication client ID provided is invalid.","oauth/unauthorized-app":"This application is not authorized to use OAuth with the provided client ID.","auth/provider-not-enabled":"This authentication provider is not enabled.","auth/unknown-provider":"Unknown authentication provider.","auth/missing-provider":"No authentication provider specified in the request.","auth/no-user-signed-in":"No user is currently signed in."}},oauth:{errorSource:"oauth",defaultErrorCode:"unknown",defaultErrorMessage:"An OAuth error occurred",errorCodeMapping:{"oauth/invalid-request":"invalid-argument","oauth/invalid-client":"invalid-argument","oauth/invalid-grant":"invalid-argument","oauth/unauthorized-client":"permission-denied","oauth/unsupported-grant-type":"unimplemented","oauth/invalid-scope":"invalid-argument","oauth/insufficient-scope":"permission-denied","oauth/invalid-token":"unauthenticated","oauth/expired-token":"unauthenticated","oauth/redirect-uri-mismatch":"invalid-argument","oauth/access-denied":"permission-denied","oauth/server-error":"unavailable","oauth/temporarily-unavailable":"unavailable","oauth/state-mismatch":"invalid-argument","oauth/invalid-callback":"invalid-argument","oauth/client-secret-mismatch":"permission-denied","oauth/unauthorized-scope":"permission-denied","oauth/rate-limit-exceeded":"rate-limit-exceeded","oauth/token-expired":"unauthenticated","oauth/missing-token":"invalid-argument","oauth/invalid-code":"invalid-argument","oauth/invalid-redirect":"invalid-argument","oauth/provider-error":"unavailable","oauth/invalid-response":"unavailable","oauth/unauthorized-access":"permission-denied",...Ae},friendlyMessageMapping:{"oauth/invalid-request":"The OAuth request was invalid or missing parameters.","oauth/invalid-client":"Client authentication failed.","oauth/invalid-grant":"The provided authorization grant is invalid.","oauth/unauthorized-client":"The client is not authorized to use this grant type.","oauth/unsupported-grant-type":"The requested grant type is not supported.","oauth/invalid-scope":"The requested scope is invalid or unknown.","oauth/insufficient-scope":"The token does not have the required scope for this resource.","oauth/invalid-token":"The access token is invalid.","oauth/expired-token":"The access token has expired.","oauth/redirect-uri-mismatch":"The redirect URI does not match the registered URI.","oauth/access-denied":"The resource owner denied the request.","oauth/server-error":"The authorization server encountered an unexpected error.","oauth/temporarily-unavailable":"The authorization server is temporarily unavailable.","oauth/state-mismatch":"Invalid state parameter. This could be a security issue.","oauth/invalid-callback":"The callback URL is invalid or not registered.","oauth/client-secret-mismatch":"The client secret does not match the registered secret.","oauth/unauthorized-scope":"The requested scope is not authorized for this client.","oauth/rate-limit-exceeded":"Too many requests. Please try again later.","oauth/token-expired":"The OAuth token has expired and needs to be refreshed.","oauth/missing-token":"No OAuth token was provided in the request.","oauth/invalid-code":"The authorization code is invalid or expired.","oauth/invalid-redirect":"The redirect URL is invalid or does not match the registered redirect URL.","oauth/provider-error":"The OAuth provider returned an error.","oauth/invalid-response":"The response from the OAuth provider was invalid.","oauth/unauthorized-access":"Unauthorized access to OAuth resources."}},api:{errorSource:"api",defaultErrorCode:"unknown",defaultErrorMessage:"API request failed",errorCodeMapping:Object.fromEntries(Object.entries(jr).map(([e,t])=>[e,t])),friendlyMessageMapping:{},extractErrorCode:e=>{if(typeof e!="object"||e===null)return;let t;return"response"in e&&e.response&&"status"in e.response?t=e.response.status:"status"in e&&typeof e.status=="number"&&(t=e.status),t?.toString()},processMetadata:e=>{let t={originalError:e};if(typeof e!="object"||e===null)return t;if("response"in e&&e.response){let n=e.response;"status"in n&&(t.statusCode=n.status),"data"in n&&(t.responseData=n.data)}else"status"in e&&(t.statusCode=e.status);return t}},firebase:{errorSource:"firebase",defaultErrorCode:"unknown",defaultErrorMessage:"A Firebase error occurred",errorCodeMapping:Ae,friendlyMessageMapping:{}},ui:{errorSource:"ui",defaultErrorCode:"internal",defaultErrorMessage:ee.internal,errorCodeMapping:{},friendlyMessageMapping:{},processMetadata:e=>{let t={originalError:e};return typeof e=="object"&&e!==null&&"componentStack"in e&&(t.componentStack=e.componentStack),t}},validation:{errorSource:"validation",defaultErrorCode:"validation-failed",defaultErrorMessage:ee["validation-failed"],errorCodeMapping:{},friendlyMessageMapping:{}},entity:{errorSource:"entity",defaultErrorCode:"unknown",defaultErrorMessage:"An entity operation error occurred",errorCodeMapping:{},friendlyMessageMapping:{}},unknown:{errorSource:"unknown",defaultErrorCode:"unknown",defaultErrorMessage:ee.unknown,errorCodeMapping:{TypeError:"invalid-argument",ReferenceError:"internal",RangeError:"invalid-argument"},friendlyMessageMapping:{},extractErrorCode:e=>{if(e instanceof Error)return e.name}}},Wr=e=>e instanceof Wt.ValiError?new R(ee["validation-failed"],"validation-failed",{details:{validationErrors:e.issues.map(t=>({path:t.path.join("."),message:t.message})),originalError:e},source:"validation"}):$(W.validation)(e),Hr=e=>{if(e instanceof Error&&"type"in e&&typeof e.type=="string"&&qr(e.type)){let t=et[e.type]||"unknown";return new R(e.message||ee[t],t,{details:{originalError:e},source:"entity"})}if(typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&Qe[e.code]){let t=Qe[e.code];if(t){let n=et[t.type]||"unknown";return new R(t.message||ee[n],n,{details:{originalCode:e.code,originalError:e},source:"entity"})}}return $(W.entity)(e)},qt={auth:$(W.auth),oauth:$(W.oauth),api:$(W.api),firebase:$(W.firebase),ui:$(W.ui),validation:Wr,entity:Hr,unknown:$(W.unknown)};function te(e,t,n){return e instanceof R?e:(qt[t]||qt.unknown)(e,n)}function Ht(e,t,n={}){let r=globalThis.Sentry;r&&r.withScope(i=>{i.setTag("errorSource",t),i.setTag("errorCode",e.code),e.details&&Object.entries(e.details).forEach(([s,a])=>{if(typeof a!="function"&&s!=="originalError")try{i.setExtra(s,a)}catch{i.setExtra(s,`[${typeof a}]`)}}),Object.entries(n).forEach(([s,a])=>{if(typeof a!="function")try{i.setExtra(`context.${s}`,a)}catch{i.setExtra(`context.${s}`,`[${typeof a}]`)}}),(e.details?.userId||n.userId)&&i.setUser({id:e.details?.userId||n.userId,email:e.details?.userEmail||n.userEmail}),r.captureException(e)})}function Kr(){return typeof import.meta<"u"&&import.meta.env&&(import.meta.env.DEV===!0||import.meta.env.MODE&&import.meta.env.MODE!=="production")?!0:typeof process<"u"&&process.env?(process.env.NODE_ENV||"development").toLowerCase()!=="production":!1}function A(e,t){let n=typeof t=="string"?{userMessage:t}:t||{},{userMessage:r,context:i={},log:s=!0,reportToSentry:a=!0,showNotification:l=!1,severity:d="error"}=n,m=jt(e),f=e instanceof R?e:te(e,m,r);if(r&&!f.userMessageProvided&&(f.message.includes("Error")||f.message.includes("Failed")||f.message.length<10?f=new R(r,f.code,{details:{...f.details,originalMessage:f.message},source:m,userMessageProvided:!0}):f=new R(f.message,f.code,{details:{...f.details,userMessage:r},source:m,userMessageProvided:!0})),s){let S=Kr()||typeof window<"u"&&window.__DNDEV_DEBUG,P={code:f.code,message:f.message,source:m};switch(d){case"warning":break;case"info":break;case"success":break;default:}}return a&&Ht(f,m,i),f}function ac(e,t){return async(...n)=>{try{return await e(...n)}catch(r){throw A(r,t)}}}function lc(e,t="info",n){let r=Date.now().toString();return r}function vc(e,t,n,r,i){if(e instanceof R)return e;let{code:s}=te(e,"api");return new R("Request failed.",s,{source:"api",details:{context:`${t}.${n}(${r}${i?`, ${i}`:""})`,originalMessage:tt(e),originalError:e}})}function bc(e,t,n,r){let i=`${t}.${n}(${r})`;return te(e,"api",`${i}: ${tt(e)}`)}function Ec(e,t,n,r){let i=r?` ${JSON.stringify(r)}`:"",s=`${t}.${n}(${i})`,a=te(e,"auth",`${s}: ${tt(e)}`);return typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&a.code==="unknown"&&e.code!=="unknown"?new R(a.message,a.code,{details:{...a.details,originalCode:e.code},source:a.source}):a}function tt(e){return e instanceof Error?e.message:typeof e=="string"?e:String(e)}import*as me from"valibot";function Tc(e,t,n){try{return me.parse(e,t)}catch(r){throw r instanceof me.ValiError?new R(`Validation failed in ${n}: ${r.message}`,"validation-failed",{details:{issues:r.issues,input:t},source:"validation"}):new R(`Unexpected validation error in ${n}: ${Gr(r)}`,"validation-failed",{originalError:r instanceof Error?r:new Error(String(r)),source:"validation"})}}function Rc(e,t){try{return me.parse(e,t)}catch{return null}}function kc(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{value:e}}function Gr(e){return e instanceof Error?e.message:typeof e=="string"?e:String(e)}function Kt(e,t,n,r={}){let{minLength:i=0,excludeEmpty:s=!0,customFilter:a}=r;return Array.from({length:n},(l,d)=>{let m=`${t}.${d}`;return e(m)}).filter((l,d)=>{let m=`${t}.${d}`;return!(l===m||s&&l.trim()===""||l.length<i||a&&!a(l,d))})}function Oc(e,t,n,r){return Array.from({length:n},(i,s)=>{let a=`${t}.${s}.${String(r[0])}`;if(e(a)===a)return null;let d={};for(let m of r){let f=`${t}.${s}.${String(m)}`;d[m]=e(f)}return d}).filter(i=>i!==null)}function Pc(e,t,n,r,i={}){let{minLength:s=0,excludeEmpty:a=!0,customFilter:l}=i;return Array.from({length:r-n},(d,m)=>{let f=n+m,S=`${t}.${f}`;return e(S)}).filter((d,m)=>{let f=n+m,S=`${t}.${f}`;return!(d===S||a&&d.trim()===""||d.length<s||l&&!l(d,f))})}function Dc(e,t,n,r={}){let{minLength:i=0,excludeEmpty:s=!0,customFilter:a}=r;return Array.from({length:n},(l,d)=>{let m=`${t}.${d}`;return{item:e(m),originalIndex:d}}).filter(({item:l,originalIndex:d})=>{let m=`${t}.${d}`;return!(l===m||s&&l.trim()===""||l.length<i||a&&!a(l,d))})}var Yr=/^---\r?\n([\s\S]*?)\r?\n---/,zr=/^\r?\n/;function Nc(e){let t=e.match(Yr);if(!t)return{meta:{},content:e};let n={};for(let r of(t[1]??"").split(`
|
|
2
|
-
`)){let i=r.indexOf(":");if(i===-1)continue;let s=r.slice(0,i).trim();if(!s)continue;let a=r.slice(i+1).trim();(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))&&(a=a.slice(1,-1)),n[s]=a}return{meta:n,content:e.slice(t[0].length).replace(zr,"")}}function Uc(e){let t=new Date().toISOString();return{createdAt:t,updatedAt:t,createdById:e,updatedById:e}}var Gt={AED:{locale:"ar-AE",symbol:"\u062F.\u0625"},ARS:{locale:"es-AR",symbol:"$"},AUD:{locale:"en-AU",symbol:"$"},BDT:{locale:"bn-BD",symbol:"\u09F3"},BGN:{locale:"bg-BG",symbol:"\u043B\u0432"},BHD:{locale:"ar-BH",symbol:"\u062F.\u0628"},BRL:{locale:"pt-BR",symbol:"R$"},CAD:{locale:"en-CA",symbol:"$"},CHF:{locale:"fr-CH",symbol:"CHF"},CLP:{locale:"es-CL",symbol:"$"},CNY:{locale:"zh-CN",symbol:"\xA5"},COP:{locale:"es-CO",symbol:"$"},CZK:{locale:"cs-CZ",symbol:"K\u010D"},DKK:{locale:"da-DK",symbol:"kr"},EGP:{locale:"ar-EG",symbol:"E\xA3"},EUR:{locale:"fr-FR",symbol:"\u20AC"},GBP:{locale:"en-GB",symbol:"\xA3"},HKD:{locale:"zh-HK",symbol:"$"},HUF:{locale:"hu-HU",symbol:"Ft"},IDR:{locale:"id-ID",symbol:"Rp"},ILS:{locale:"he-IL",symbol:"\u20AA"},INR:{locale:"en-IN",symbol:"\u20B9"},JOD:{locale:"ar-JO",symbol:"\u062F.\u0623"},JPY:{locale:"ja-JP",symbol:"\xA5"},KES:{locale:"sw-KE",symbol:"KSh"},KRW:{locale:"ko-KR",symbol:"\u20A9"},KWD:{locale:"ar-KW",symbol:"\u062F.\u0643"},LKR:{locale:"si-LK",symbol:"Rs"},MXN:{locale:"es-MX",symbol:"$"},MYR:{locale:"ms-MY",symbol:"RM"},NGN:{locale:"en-NG",symbol:"\u20A6"},NOK:{locale:"nb-NO",symbol:"kr"},NZD:{locale:"en-NZ",symbol:"$"},OMR:{locale:"ar-OM",symbol:"\u0631.\u0639."},PEN:{locale:"es-PE",symbol:"S/."},PHP:{locale:"en-PH",symbol:"\u20B1"},PKR:{locale:"ur-PK",symbol:"\u20A8"},PLN:{locale:"pl-PL",symbol:"z\u0142"},QAR:{locale:"ar-QA",symbol:"\u0631.\u0642"},RON:{locale:"ro-RO",symbol:"lei"},RUB:{locale:"ru-RU",symbol:"\u20BD"},SAR:{locale:"ar-SA",symbol:"\u0631.\u0633"},SEK:{locale:"sv-SE",symbol:"kr"},SGD:{locale:"en-SG",symbol:"$"},THB:{locale:"th-TH",symbol:"\u0E3F"},TRY:{locale:"tr-TR",symbol:"\u20BA"},TWD:{locale:"zh-TW",symbol:"$"},UAH:{locale:"uk-UA",symbol:"\u20B4"},USD:{locale:"en-US",symbol:"$"},UYU:{locale:"es-UY",symbol:"$"},VND:{locale:"vi-VN",symbol:"\u20AB"},ZAR:{locale:"en-ZA",symbol:"R"}};function Xr(e){return Gt[e]?.locale??"en-US"}function Lc(e){return!e||typeof e!="string"?e??"":Gt[e]?.symbol??e}function Ce(e,t,n={}){if(e==null||isNaN(e))return"";let r=Xr(t);return new Intl.NumberFormat(r,{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:2,currencyDisplay:"symbol",...n}).format(e)}function Yt(e){let t=e.match(/^(\d{4})(\d{2})(\d{2}):(\d{2})(\d{2})$/);if(!t||t.length<6)throw new Error(`Invalid compact date format. Expected YYYYMMDD:HHMM, got: ${e}`);let n=t[1],r=t[2],i=t[3],s=t[4],a=t[5],l=new Date(parseInt(n,10),parseInt(r,10)-1,parseInt(i,10),parseInt(s,10),parseInt(a,10));if(isNaN(l.getTime()))throw new Error(`Invalid date values in compact format: ${e}`);return l.toISOString()}function Vc(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`Invalid ISO date string: ${e}`);let n=t.getUTCFullYear(),r=String(t.getUTCMonth()+1).padStart(2,"0"),i=String(t.getUTCDate()).padStart(2,"0"),s=String(t.getUTCHours()).padStart(2,"0"),a=String(t.getUTCMinutes()).padStart(2,"0");return`${n}${r}${i}:${s}${a}`}function zt(e){return/^\d{4}\d{2}\d{2}:\d{2}\d{2}$/.test(e)}function $c(e){if(!e)return new Date().toISOString();if(e instanceof Date){if(isNaN(e.getTime()))throw new Error("Invalid Date object");return e.toISOString()}if(typeof e=="string"){if(zt(e))return Yt(e);let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`Invalid date string: ${e}`);return t.toISOString()}if(typeof e=="number"){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`Invalid timestamp: ${e}`);return t.toISOString()}if(typeof e=="object"&&e!==null&&"toDate"in e&&typeof e.toDate=="function")return e.toDate().toISOString();throw new Error(`Unsupported date type: ${typeof e}`)}function jc(){return new Date().toISOString()}function qc(e){return e.toISOString()}function Wc(e){return new Date(e).toISOString()}function Hc(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`Invalid ISO date string: ${e}`);let n=new Date(t.getFullYear(),0,1),r=Math.floor((t.getTime()-n.getTime())/(1440*60*1e3));return`Week ${Math.ceil((r+n.getDay()+1)/7)}, ${t.getFullYear()}`}var D={SECOND:1,MINUTE:60,HOUR:3600,DAY:86400,WEEK:604800,MONTH:2592e3,YEAR:31536e3};function Kc(e,t="en",n={}){if(!e)return"";let{style:r="long",numeric:i="auto",fallbackThreshold:s=D.WEEK}=n,a;if(e instanceof Date)a=e;else if(typeof e=="string")a=new Date(e);else if(typeof e=="number")a=new Date(e);else if(typeof e=="object"&&"toDate"in e)a=e.toDate();else return"";if(isNaN(a.getTime()))return"";let l=new Date,d=a.getTime()-l.getTime(),m=Math.round(d/1e3),f=Math.abs(m);if(f>s)return Zr(a.toISOString(),t);let S=new Intl.RelativeTimeFormat(t,{style:r,numeric:i});return f<D.MINUTE?S.format(m,"second"):f<D.HOUR?S.format(Math.round(m/D.MINUTE),"minute"):f<D.DAY?S.format(Math.round(m/D.HOUR),"hour"):f<D.WEEK?S.format(Math.round(m/D.DAY),"day"):f<D.MONTH?S.format(Math.round(m/D.WEEK),"week"):f<D.YEAR?S.format(Math.round(m/D.MONTH),"month"):S.format(Math.round(m/D.YEAR),"year")}function Qr(e){switch(e){case"full":return{weekday:"long",year:"numeric",month:"long",day:"numeric"};case"long":return{year:"numeric",month:"long",day:"numeric"};case"medium":return{year:"numeric",month:"short",day:"numeric"};case"short":return{year:"2-digit",month:"numeric",day:"numeric"};case"date-only":return{year:"numeric",month:"2-digit",day:"2-digit"};case"time-only":return{hour:"2-digit",minute:"2-digit"};case"datetime":return{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};default:return{year:"numeric",month:"long",day:"numeric"}}}function Zr(e,t="en",n="long"){if(!e)return"";let r;if(e instanceof Date)r=e;else if(typeof e=="string")r=new Date(e);else if(typeof e=="number")r=new Date(e);else if(typeof e=="object"&&"toDate"in e)r=e.toDate();else return"";if(isNaN(r.getTime()))return"";let i=typeof n=="string"?Qr(n):n;return new Intl.DateTimeFormat(t,i).format(r)}function Xt(e){if(e!=null){if(e instanceof Date)return isNaN(e.getTime())?void 0:e.toISOString();if(typeof e=="string"){let t=e.trim();if(!t)return;if(zt(t))try{return Yt(t)}catch{return}let n=new Date(t);return isNaN(n.getTime())?void 0:n.toISOString()}if(typeof e=="number"){if(!Number.isFinite(e))return;let t=new Date(e);return isNaN(t.getTime())?void 0:t.toISOString()}if(typeof e=="object"&&e!==null&&"toDate"in e&&typeof e.toDate=="function")try{let t=e.toDate();return isNaN(t.getTime())?void 0:t.toISOString()}catch{return}if(typeof e=="object"&&e!==null&&"seconds"in e&&typeof e.seconds=="number"){let t=e,n=t.seconds*1e3+(t.nanoseconds||0)/1e6,r=new Date(n);return isNaN(r.getTime())?void 0:r.toISOString()}}}function Gc(e){let t=Xt(e);if(!t)return;let n=new Date(t);return n.setUTCHours(12,0,0,0),n.toISOString()}function Yc(e){let t=Xt(e);return t&&t.split("T")[0]||""}function en(e){return e==null||e===""}function nt(e,t){if(!e.includes(":"))return t(e);let[n,r=e]=e.split(":");if(r.startsWith("status.")){let i=t(r);if(i!==r&&i!==`${n}:${r}`)return i}return t(r,{ns:n})}function it(e){return e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim()}function tn(e){let t=e.validation?.options;return Array.isArray(t)?t:void 0}function Ie(e,t,n){let r=tn(t)?.find(i=>i.value===e)?.label;return r?nt(r,n):String(e)}function rt(e){return e instanceof Date?e:new Date(e)}var Qt=(e,t,n,{locale:r})=>rt(e).toLocaleString(r),M=e=>String(e),Zt=e=>e?"Yes":"No",Jt=(e,t,n,{locale:r})=>typeof e=="number"?e.toLocaleString(r):String(e),Jr={timestamp:Qt,"datetime-local":Qt,date:(e,t,n,{locale:r})=>rt(e).toLocaleDateString(r),time:(e,t,n,{locale:r})=>rt(e).toLocaleTimeString(r),week:M,month:M,boolean:Zt,checkbox:Zt,switch:(e,t,n)=>{let r=t.options?.fieldSpecific;if(r){let i=r.uncheckedValue??!1,s=r.checkedValue??!0;if(e===s&&r.checkedLabel)return nt(r.checkedLabel,n);if(e===i&&r.uncheckedLabel)return nt(r.uncheckedLabel,n)}return e?"Yes":"No"},year:M,number:Jt,range:Jt,currency:(e,t)=>{if(Number.isNaN(Number(e)))return"";let n=t.options?.fieldSpecific;return Ce(Number(e),n?.currency||"EUR")},price:(e,t,n)=>{let r=typeof e=="number"?{amount:e,currency:"EUR",vatIncluded:!0,discountPercent:0}:e;if(!r||typeof r!="object")return"";let i=r.amount;if(en(i)||Number.isNaN(Number(i)))return"";let s=r.currency||"EUR",a=r.discountPercent??0,l=r.vatIncluded??!0?` ${n("crud:price.vatIncluded",{defaultValue:"VAT Incl."})}`:"";if(a>0){let d=Number(i)*(1-a/100),m=` ${n("crud:price.discountPercent",{percent:Math.round(a),defaultValue:"-{{percent}}%"})}`;return`${Ce(d,s)}${l}${m}`}return`${Ce(Number(i),s)}${l}`},duration:(e,t,n)=>{let r=typeof e=="number"?e:parseInt(String(e),10);if(Number.isNaN(r))return"";if(r===0)return n("crud:duration.zero",{defaultValue:"\u2014"});if(r<60)return n("crud:duration.minutes",{count:r,defaultValue:`${r} min`});let i=Math.floor(r/60),s=r%60;return n("crud:duration.hoursMinutes",{hours:i,minutes:s,defaultValue:s===0?`${i}h`:`${i}h ${s}min`})},gdprConsent:(e,t,n,{locale:r})=>{if(!e||typeof e!="object")return"";let i=e;if(i.gdprConsent!==!0)return n("crud:gdprConsent.display.no",{defaultValue:"Not consented"});let s=[n("crud:gdprConsent.display.yes",{defaultValue:"Consented"})];return i.gdprConsentDate&&s.push(new Date(i.gdprConsentDate).toLocaleDateString(r)),i.gdprConsentVersion&&s.push(`v${i.gdprConsentVersion}`),s.join(" \xB7 ")},select:Ie,radio:Ie,combobox:Ie,multiselect:(e,t,n)=>Array.isArray(e)&&tn(t)?e.map(r=>Ie(r,t,n)).join(", "):String(e),reference:e=>{if(e&&typeof e=="object"){let t=e;return String(t.displayName||t.name||t.id||e)}return String(e)},geopoint:e=>{if(e&&typeof e=="object"&&"lat"in e&&"lng"in e){let{lat:t,lng:n}=e;return`${t.toFixed(6)}, ${n.toFixed(6)}`}return""},address:e=>e&&typeof e=="object"&&"formatted_address"in e?String(e.formatted_address):String(e),array:e=>Array.isArray(e)?e.join(", "):"","field-array":(e,t)=>{if(!Array.isArray(e))return"";let n=t.options?.fieldSpecific?.fields;return e.map(r=>{if(typeof r!="object"||r==null)return"";let i=r;return(n?n.map(a=>a.name):Object.keys(i)).map(a=>i[a]).filter(a=>a!=null&&a!=="").map(a=>typeof a=="object"?JSON.stringify(a):String(a)).join(" \xB7 ")}).filter(Boolean).join(", ")},password:()=>"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",text:M,textarea:M,email:M,tel:M,url:M,color:M,iban:M,richtext:e=>it(String(e))};function nn(e,t,n,r={}){let i=t.options?.displayValue;if(i&&r.item)return i(e,r.item,n);if(en(e))return null;let s=r.formatter??Jr[t.type],a=s?s(e,t,n,{locale:r.locale}):typeof e=="object"?null:String(e);if(a===null||a==="")return null;let l=t.options?.displayKey;if(!l)return a;let d=(Array.isArray(l)?l:[l]).map(m=>m.replace("{{value}}",a));return n(d,{value:a})}var ei=160,rn="EUR",ti=new Set(["textarea","richtext"]),sn=new Set(["image","images"]),ni=new Set(["price","currency"]),ri=" \xB7 ",ii={available:"InStock"};function G(e){return typeof e=="string"&&e.trim()!==""?e.trim():void 0}function oi(e,t){if(e.length<=t)return e;let n=e.slice(0,t-1),r=n.lastIndexOf(" ");return`${(r>t/2?n.slice(0,r):n).trimEnd()}\u2026`}function on(e){return(Array.isArray(e)?e:[e]).map(n=>{if(typeof n=="string")return G(n);if(n&&typeof n=="object"&&"fullUrl"in n)return G(n.fullUrl)}).filter(n=>n!==void 0)}function an(e){let t=e.listCardFields,n=t?Array.isArray(t)?t:[...t.title??[],...t.subtitle??[],...t.content??[],...t.footer??[]]:[];return[...new Set([...n,...Object.keys(e.fields)])]}function we(e,t,n,r){return n.flatMap(i=>{let s=e.fields[i];if(!s||sn.has(s.type))return[];let a=nn(t[i],s,r.t,{item:t,locale:r.locale});return a?[a]:[]})}function si(e,t,n){let r=e.seo?.title;if(r)return G(r(t,n.t));let i=e.listCardFields;if(i&&!Array.isArray(i)&&i.title?.length){let a=we(e,t,i.title,n);return a.length>0?a.join(i.titleSeparator??" "):void 0}let s=an(e).find(a=>e.fields[a]?.type==="text");return s?G(we(e,t,[s],n)[0]):void 0}function ai(e,t,n,r){let i=e.seo?.description;if(i)return G(i(t,r.t));let s=n.find(m=>ti.has(e.fields[m]?.type??"")&&G(t[m])!==void 0);if(s)return it(String(t[s]));let a=e.listCardFields;if(!a||Array.isArray(a))return;let d=[we(e,t,a.subtitle??[],r).join(" "),...we(e,t,a.content??[],r)].filter(Boolean);return d.length>0?d.join(ri):void 0}function li(e,t){if(typeof t.status!="string")return;let r={...ii,...e.seo?.availability}[t.status];return r?`https://schema.org/${r}`:void 0}function ui(e,t){if(e.type==="price"&&t&&typeof t=="object"){let{amount:i,currency:s}=t;return typeof i=="number"&&i>0?{amount:i,currency:G(s)??rn}:void 0}let n=typeof t=="string"?Number(t):t;if(typeof n!="number"||!(n>0))return;let r=e.options?.fieldSpecific;return{amount:n,currency:r?.currency??rn}}function Jc(e,t,n){let r=an(e),i=f=>e.fields[f],s=ai(e,t,r,n),a=s?oi(s,ei):void 0,l=r.find(f=>sn.has(i(f)?.type??"")&&on(t[f]).length>0),d=l?on(t[l]):[],m;for(let f of r){let S=i(f);if(!(!S||!ni.has(S.type))&&(m=ui(S,t[f]),m))break}return{title:si(e,t,n),description:a||void 0,image:d[0],images:d,price:m,availability:li(e,t)}}function ed(e,t){return e.title?{"@context":"https://schema.org","@type":"Product",name:e.title,...e.description&&{description:e.description},...e.images.length>0&&{image:e.images},url:t,...e.price&&{offers:{"@type":"Offer",price:e.price.amount,priceCurrency:e.price.currency,...e.availability&&{availability:e.availability},url:t}}}:null}function ci(e){return typeof e=="string"?`'${e.replace(/'/g,"\\'")}'`:typeof e=="boolean"?e?"true":"false":String(e)}function di(e){let t=`resource.data.${e.field}`,n=ci(e.value);return`${t} ${e.op} ${n}`}function nd(e){let t=[];if(e.publicCondition&&e.publicCondition.length>0){let n=e.publicCondition.map(di).join(" && ");t.push(`(${n})`)}for(let n of e.ownerFields)t.push(`request.auth.uid == resource.data.${n}`);return t.length===0?"false":t.join(" || ")}function id(e,t){return t?!t.includes(".")&&!t.includes(":")?t:e(t):""}var ad="dndev-prerendered-head",pi="/logo.svg";function mi(e){return JSON.stringify(e).replace(/</g,"\\u003c")}var x=(e,t,n)=>({tag:"meta",attributes:{[e]:t,content:n}}),ot=e=>({tag:"script",attributes:{type:"application/ld+json"},text:mi(e)});function ld(e,t,n,r){let i=e.split("/").filter(Boolean),s=[{"@type":"ListItem",position:1,name:t,item:n("/")}],a="";return i.forEach((l,d)=>{a+=`/${l}`;let m=d===i.length-1;s.push({"@type":"ListItem",position:d+2,name:m&&r?r:l.split("-").map(f=>f.charAt(0).toUpperCase()+f.slice(1)).join(" "),item:n(a)})}),{"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:s}}function ud(e){let{title:t,description:n,image:r,type:i,jsonLd:s,breadcrumb:a}=e,l=[{tag:"title",attributes:{},text:t}];return n&&l.push(x("name","description",n)),l.push(x("property","og:title",t)),n&&l.push(x("property","og:description",n)),l.push(x("property","og:type",i)),r&&l.push(x("property","og:image",r)),r&&l.push(x("name","twitter:card","summary_large_image")),l.push(x("name","twitter:title",t)),n&&l.push(x("name","twitter:description",n)),r&&l.push(x("name","twitter:image",r)),s&&l.push(ot(s)),a&&l.push(ot(a)),l}function cd(e){let t=[];if(e.url&&(t.push({tag:"link",attributes:{rel:"canonical",href:e.url}}),t.push(x("property","og:url",e.url))),t.push(x("property","og:site_name",e.siteName)),e.alternates){for(let[r,i]of Object.entries(e.alternates))t.push({tag:"link",attributes:{rel:"alternate",hreflang:r,href:i}});let n=e.alternates[e.defaultLanguage];n&&t.push({tag:"link",attributes:{rel:"alternate",hreflang:"x-default",href:n}})}return t}var fi=20,ln={defaultValue:""};function un(e,t,n){if(e!==null)return e!==void 0?e:n(t,ln)||void 0}function cn(e,t){let n=(s=>e(s,ln)),r=s=>n(`${t}:meta.${s}`)||void 0,i=Kt(n,`${t}:meta.keywords`,fi);return{fullTitle:r("fullTitle"),image:r("image"),type:r("type"),keywords:i.length>0?i:void 0,author:r("author")}}function gi(e,t){return e===!0?"noindex, nofollow":e===!1?null:t?"noindex":null}function hi(e){let{meta:t,ns:n,defaultNs:r,t:i,siteName:s}=e,a=t.seo;if(!n&&!r)return{title:a?.fullTitle||s};let l=n?un(a?.title,`${n}:title`,i):a?.title??void 0;return{title:a?.fullTitle||(n?cn(i,n).fullTitle:void 0)||(l?`${l} | ${s}`:s),...l&&{pageTitle:l}}}function dd(e){let{meta:t,ns:n,defaultNs:r,t:i,siteName:s,baseUrl:a,url:l,defaultImage:d}=e,m=t.seo,f=n??r,S=f?cn(i,f):null,{title:P}=hi({meta:t,ns:n,defaultNs:r,t:i,siteName:s}),_=f?un(m?.description,`${f}:description`,i):void 0,T=m?.image||S?.image||d||void 0,L=m?.keywords||S?.keywords,ve=t.author||S?.author;return{title:P,..._&&{description:_},...T&&{image:T.startsWith("http")?T:`${a}${T}`},url:l,type:m?.type||S?.type||"website",robots:gi(m?.noindex??t.noindex,e.authOnly),...L&&{keywords:L},...ve&&{author:ve},...t.publishDate&&{publishDate:t.publishDate},...t.modifiedDate&&{modifiedDate:t.modifiedDate}}}function pd(e,t){let{title:n,description:r,image:i,type:s,keywords:a,author:l}=e,d=[{tag:"title",attributes:{},text:n}];return r&&d.push(x("name","description",r)),a&&d.push(x("name","keywords",a.join(", "))),l&&d.push(x("name","author",l)),e.robots&&d.push(x("name","robots",e.robots)),d.push(x("property","og:title",n)),r&&d.push(x("property","og:description",r)),d.push(x("property","og:type",s)),i&&(d.push(x("property","og:image",i)),d.push(x("property","og:image:width","1200")),d.push(x("property","og:image:height","630"))),s==="article"&&(l&&d.push(x("property","article:author",l)),e.publishDate&&d.push(x("property","article:published_time",e.publishDate)),e.modifiedDate&&d.push(x("property","article:modified_time",e.modifiedDate))),d.push(x("name","twitter:card","summary_large_image")),d.push(x("name","twitter:title",n)),r&&d.push(x("name","twitter:description",r)),i&&d.push(x("name","twitter:image",i)),l&&d.push(x("name","twitter:creator",l)),i?.startsWith("http")&&d.push({tag:"link",attributes:{rel:"dns-prefetch",href:new URL(i).origin}}),e.url&&d.push(ot({"@context":"https://schema.org","@type":s==="article"?"Article":"WebPage",name:n,...r&&{description:r},url:e.url,...i&&{image:i},...s==="article"&&{...l&&{author:{"@type":"Person",name:l}},...e.publishDate&&{datePublished:e.publishDate},...e.modifiedDate&&{dateModified:e.modifiedDate}},publisher:{"@type":"Organization",name:t.siteName,logo:{"@type":"ImageObject",url:`${t.baseUrl}${pi}`}}})),d}var md={enabled:!0,themeColor:"#2563eb",backgroundColor:"#ffffff",includeManifestIcons:!0,includeMSIcons:!1};function fd(e){let t=n=>e(n)?n:void 0;return{svg:t("/favicon.svg"),ico:t("/favicon.ico"),png16:t("/favicon-16x16.png"),png32:t("/favicon-32x32.png"),apple180:t("/apple-touch-icon.png"),android192:t("/icon-192x192.png"),android512:t("/icon-512x512.png")}}var ne=(e,t,n)=>({tag:"link",attributes:{rel:"icon",type:t,...n&&{sizes:n},href:e}});function gd(e,t){let{enabled:n,appName:r,themeColor:i,includeManifestIcons:s,includeMSIcons:a}=t;if(n===!1)return[];let l=[];return e.svg&&l.push(ne(e.svg,"image/svg+xml")),e.ico&&l.push(ne(e.ico,"image/x-icon")),e.png16&&l.push(ne(e.png16,"image/png","16x16")),e.png32&&l.push(ne(e.png32,"image/png","32x32")),e.apple180&&(l.push({tag:"link",attributes:{rel:"apple-touch-icon",sizes:"180x180",href:e.apple180}}),r&&l.push(x("name","apple-mobile-web-app-title",r))),s&&(e.android192&&l.push(ne(e.android192,"image/png","192x192")),e.android512&&l.push(ne(e.android512,"image/png","512x512"))),a&&e.png32&&(l.push(x("name","msapplication-TileImage",e.png32)),i&&l.push(x("name","msapplication-TileColor",i))),i&&l.push(x("name","theme-color",i)),l.push(x("name","color-scheme","light dark")),l}function yi(){let e=new Uint8Array(32);return crypto.getRandomValues(e),dn(e)}async function vi(e){let n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n);return dn(new Uint8Array(r))}async function yd(){let e=yi(),t=await vi(e);return{codeVerifier:e,codeChallenge:t}}function dn(e){return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function vd(){return typeof window<"u"&&typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof crypto.getRandomValues<"u"}function bd(e){return e.length<43||e.length>128?!1:/^[A-Za-z0-9\-._~]+$/.test(e)}function Ed(e){return e.length<43||e.length>128?!1:/^[A-Za-z0-9\-._~]+$/.test(e)}async function xd(e,t,n){try{return await e()}catch{return t(),!1}}var Oe=new Map;function Rd(e,t){if(Oe.has(t))return Oe.get(t);let n=e().catch(r=>{throw Oe.delete(t),r});return Oe.set(t,n),n}var pn={[O.GUEST]:0,[O.USER]:1,[O.ADMIN]:2,[O.SUPER]:3};function Y(e,t){if(!e)return!1;let n=pn[e]??-1,r=pn[t]??1/0;return n>=r}function Cd(e){return e?e.role===O.SUPER||e.isSuper===!0?O.SUPER:e.role===O.ADMIN||e.isAdmin===!0?O.ADMIN:e.role===O.USER?O.USER:e.role||O.USER:O.USER}function Od(e,t,n){if(!e)return!1;let r=n??Ke,i=r[e]?.level??-1,s=r[t]?.level??1/0;return i>=s}var mn="__DNDEV_SINGLETONS__";function fn(){if(typeof globalThis<"u"){let e=globalThis,t=e[mn];if(t)return t;let n=new Map;return e[mn]=n,n}return new Map}function Pe(e,t){let n=fn();return n.has(e)||n.set(e,t()),n.get(e)}function Dd(e){fn().delete(e)}function Fd(e,...t){let n=null,r=!1;return function(){if(n!==null)return n;if(r)throw new Error("Circular dependency detected in singleton initialization");r=!0;try{return typeof e=="function"&&e.prototype?n=new e(...t):n=e(),n}finally{r=!1}}}function Nd(e){let t=null,n=!1;return function(...i){if(t!==null)return t;if(n)throw new Error("Circular dependency detected in singleton initialization");n=!0;try{return typeof e=="function"&&e.prototype?t=new e(...i):t=e(...i),t}finally{n=!1}}}function _d(e){let t=null,n=!1,r=null;return async function(){if(t!==null)return t;if(n&&r)return r;if(n)throw new Error("Circular dependency detected in async singleton initialization");n=!0;try{return r=e(),t=await r,t}finally{n=!1,r=null}}}function Ud(e,t){return new Proxy({},{get(n,r){if(t.includes(r)){let s=e(),a=s[r];return typeof a=="function"?a.bind(s):a}return e()[r]}})}var fe=class{static async getOrCreate(t,n,r={}){if(this.instances.has(t))return this.instances.get(t);if(this.initialized.has(t))return this.instances.get(t);if(this.initializing.has(t))throw new Error(`Circular dependency detected for singleton: ${t}`);if(r.ssrSafe===!1&&typeof window>"u"){if(typeof process<"u"&&process.env.NODE_ENV,r.fallbackFactory){let i=r.fallbackFactory();return this.instances.set(t,i),this.initialized.add(t),i}throw new Error(`Singleton ${t} requires client-side environment`)}this.initializing.add(t);try{let i=await n();return this.instances.set(t,i),this.initialized.add(t),i}catch(i){if(typeof process<"u"&&process.env.NODE_ENV,r.cacheFailures&&this.initialized.add(t),r.fallbackFactory){let s=r.fallbackFactory();return this.instances.set(t,s),this.initialized.add(t),s}throw i}finally{this.initializing.delete(t)}}static isInitialized(t){return this.initialized.has(t)}static clear(t){this.instances.delete(t),this.initialized.delete(t),this.initializing.delete(t)}static clearAll(){this.instances.clear(),this.initialized.clear(),this.initializing.clear()}};k(fe,"instances",new Map),k(fe,"initializing",new Set),k(fe,"initialized",new Set);function De(){return Pe("providers",()=>({providers:null}))}function Vd(e){let t=De();t.providers,t.providers=e}function $d(e){let{providers:t}=De();if(!t)throw new Error(`[dndev] Provider "${e}" not available. Call configureProviders() at app startup.`);let n=t[e];if(!n)throw new Error(`[dndev] Provider "${e}" not configured. Pass it to configureProviders().`);return n}function jd(e){return!!De().providers?.[e]}function qd(){De().providers=null}var st=["text","textarea","richtext","field-array"];function ge(e){return`${e}I18n`}function Hd(e){return Object.keys(e).filter(t=>e[t]?.i18n===!0)}function bi(e){return e==null?!1:typeof e=="string"?e.trim().length>0:Array.isArray(e)?e.length>0:!0}function Kd(e,t,n){let r=null;for(let i of t){let s=e[ge(i)];if(!s||typeof s!="object")continue;let a=s[n];bi(a)&&(r??(r={...e}),r[i]=a)}return r??e}var Yd="dndev-lang";function zd(e,t){if(!e)return null;for(let n of e.split(";")){let r=n.indexOf("=");if(r!==-1&&n.slice(0,r).trim()===t)try{return decodeURIComponent(n.slice(r+1).trim())}catch{return null}}return null}function Xd(e){return e?e.split(",").map((t,n)=>{let[r="",...i]=t.trim().split(";"),s=i.find(l=>l.trim().startsWith("q=")),a=s?Number(s.trim().slice(2)):1;return{tag:r.trim(),quality:Number.isFinite(a)?a:0,index:n}}).filter(t=>t.tag!==""&&t.tag!=="*"&&t.quality>0).sort((t,n)=>n.quality-t.quality||t.index-n.index).map(t=>t.tag):[]}function gn({supported:e,fallback:t,stored:n,preferred:r}){if(n&&e.includes(n))return n;for(let i of r??[]){if(e.includes(i))return i;let s=i.split("-")[0];if(s&&e.includes(s))return s}return t}function at(e){return e.length>1}var Ei="dndev-session",Si="/index";function Jd(e){let t=e.split("/"),n=t.indexOf(Ei);(n===1||n===2)&&t.splice(n,1);let r=t.join("/")||"/";return r===Si?"/":r}function ep(e){return e.replace(/\/+$/,"")||"/"}function xi(e,t){if(!t)return e;let n=e.search(/[?#]/),r=n===-1?e:e.slice(0,n),i=n===-1?"":e.slice(n);return r.endsWith("/")||r.slice(r.lastIndexOf("/")+1).includes(".")?e:`${r}/${i}`}function hn(e,t){let n={language:t.defaultLanguage,path:e,prefixed:!1};if(!at(t.languages))return n;let r=e.indexOf("/",1),i=r===-1?e.slice(1):e.slice(1,r);return t.languages.includes(i)?{language:i,path:r===-1?"/":e.slice(r),prefixed:!0}:n}function yn(e,t,n){if(!e.startsWith("/")||e.startsWith("//")||!at(n.languages))return e;let r=e.search(/[?#]/),i=r===-1?e:e.slice(0,r),s=r===-1?"":e.slice(r),a=hn(i,n),l=a.prefixed?a.language:t;return l===n.defaultLanguage?`${a.path}${s}`:`/${l}${a.path==="/"?"":a.path}${s}`}function Ti(e,t,n,r,i){return`${n}${xi(yn(e,t,r),i)}`}function tp(e,t,n,r){return Object.fromEntries(n.languages.map(i=>[i,Ti(e,i,t,n,r)]))}function np(e,t,n){let r=hn(e,n);if(!at(n.languages))return{type:"pass",language:r.language,path:r.path};if(r.prefixed)return r.language===n.defaultLanguage?{type:"redirect",language:r.language,path:r.path,location:r.path,permanent:!0}:{type:"pass",language:r.language,path:r.path};let i=gn({supported:n.languages,fallback:n.defaultLanguage,stored:t.stored,preferred:t.preferred});return i!==n.defaultLanguage?{type:"redirect",language:i,path:r.path,location:yn(r.path,i,n),permanent:!1}:{type:"rewrite",language:n.defaultLanguage,path:r.path,destination:`/${n.defaultLanguage}${r.path==="/"?"":r.path}`}}var Fe=e=>e.split("/").filter(Boolean);function vn(e){return e==="*"||e.endsWith("/*")}function Ri(e){try{return decodeURIComponent(e)}catch{return e}}function bn(e,t){let n={};return e.forEach((r,i)=>{r.startsWith(":")&&t[i]!==void 0&&(n[r.slice(1)]=Ri(t[i]))}),n}function ip(e,t){let n=Fe(t),r=n.join("/"),i=e.find(l=>typeof l.path=="string"&&Fe(l.path).join("/")===r);if(i)return{route:i,params:{}};let s=null;for(let l of e){if(typeof l.path!="string"||!l.path.includes(":")||vn(l.path))continue;let d=Fe(l.path);d.length===n.length&&d.every((m,f)=>m.startsWith(":")||m===n[f])&&(!s||l.path.length>s.route.path.length)&&(s={route:l,pattern:d})}if(s)return{route:s.route,params:bn(s.pattern,n)};let a=null;for(let l of e){if(typeof l.path!="string"||!vn(l.path))continue;let d=Fe(l.path).slice(0,-1);if(n.length<d.length)continue;let m=0,f=!0;for(let P=0;P<d.length;P++){let _=d[P];if(!_.startsWith(":")){if(_!==n[P]){f=!1;break}m++}}if(!f)continue;let S=[d.length,m];(!a||S[0]>a.score[0]||S[0]===a.score[0]&&S[1]>a.score[1])&&(a={route:l,prefix:d,score:S})}return a?{route:a.route,params:bn(a.prefix,n)}:null}function sp(e){return{updatedAt:new Date().toISOString(),updatedById:e}}function ki(e){return typeof e=="object"&&e!==null&&"visibility"in e&&typeof e.visibility=="string"}function Ai(e){if(ki(e))return e.visibility}function Ci(e,t){let n=e??"guest";return n==="hidden"?!1:n==="technical"?Y(t,"admin"):n==="owner"?!1:Y(t,n)}function Ii(e,t,n){for(let r of n.ownerFields)if(e[r]===t)return!0;return!1}function En(e,t,n){if(!e||typeof e!="object"||!("entries"in e)||!e.entries)return[];let r=e.entries,i=[],{documentData:s,uid:a,ownership:l}=n??{},d=l&&a!=null&&s&&Ii(s,a,l);for(let[m,f]of Object.entries(r)){let S=Ai(f);if(S==="owner"){d&&i.push(m);continue}Ci(S,t)&&i.push(m)}return i}function dp(e,t,n,r){if(!e)return{};let i=r?.uid!=null&&r?.ownership!=null?{documentData:r.documentData??e,uid:r.uid,ownership:r.ownership}:void 0,s=En(t,n,i),a={};for(let l of s)Object.prototype.hasOwnProperty.call(e,l)&&(a[l]=e[l]);return a}function Ne(e){let t=e.listCardFields;if(t){if(Array.isArray(t))return t;let n=t,r=[...n.title??[],...n.subtitle??[],...n.content??[],...n.footer??[]];return[...new Set(r)]}return e.listFields&&e.listFields.length>0?e.listFields:e.fields?Object.keys(e.fields):[]}function Sn(e){return typeof e=="object"&&e!==null}function _e(e){if(Sn(e)){if(Sn(e.entries))return e.entries;if(Array.isArray(e.pipe))for(let t of e.pipe){let n=_e(t);if(n)return n}if(e.wrapped)return _e(e.wrapped);if(Array.isArray(e.options))for(let t of e.options){let n=_e(t);if(n)return n}}}function fp(e){let t=_e(e);if(!t)return!1;for(let n of Object.values(t)){let r=n?.visibility;if(r!==void 0&&r!=="guest")return!0}return!1}import*as xn from"valibot";function wi(e,t){let n=xn.parse(B,t??Se);return{...n,userId:e,isActive:n.status===Ee.ACTIVE,features:n.features??[]}}var lt=class{constructor(t={}){k(this,"store",new Map);k(this,"maxAttempts");k(this,"lockoutMs");k(this,"sessionTimeoutMs");this.maxAttempts=t.maxAttempts??5,this.lockoutMs=t.lockoutMs??900*1e3,this.sessionTimeoutMs=t.sessionTimeoutMs??480*60*1e3}checkLockout(t){let n=this.store.get(t);if(n?.lockedUntil){if(Date.now()<n.lockedUntil){let r=Math.ceil((n.lockedUntil-Date.now())/6e4);throw new Error(`Account temporarily locked after too many failed attempts. Try again in ${r} minute${r===1?"":"s"}.`)}this.store.delete(t)}}recordFailure(t){let n=Date.now();!this.store.has(t)&&this.store.size>=1e4&&this._evictExpired(n);let r=this.store.get(t)??{attempts:0,lastAttempt:0,lockedUntil:null};return r.attempts+=1,r.lastAttempt=n,r.attempts>=this.maxAttempts&&(r.lockedUntil=n+this.lockoutMs),this.store.set(t,r),{attempts:r.attempts,locked:r.lockedUntil!==null&&Date.now()<r.lockedUntil,lockedUntil:r.lockedUntil}}_evictExpired(t){for(let[n,r]of this.store)r.lockedUntil!==null&&t>r.lockedUntil?this.store.delete(n):r.lockedUntil===null&&t-r.lastAttempt>this.lockoutMs&&this.store.delete(n)}recordSuccess(t){this.store.delete(t)}isSessionExpired(t){return Date.now()-t>this.sessionTimeoutMs}getEntry(t){return this.store.get(t)}};function Oi(e,t){if(t.includes(".")){let n=t.split("."),r=e;for(let i of n){if(r==null||typeof r!="object")return;r=r[i]}return r}return e[t]}function Pi(e,t){let n=Oi(t,e.field);switch(e.operator){case"equals":return n===e.value;case"notEquals":return n!==e.value;case"in":return Array.isArray(e.value)&&e.value.includes(n);case"notIn":return Array.isArray(e.value)&&!e.value.includes(n);case"greaterThan":return typeof n=="number"&&typeof e.value=="number"&&n>e.value;case"lessThan":return typeof n=="number"&&typeof e.value=="number"&&n<e.value;case"greaterThanOrEqual":return typeof n=="number"&&typeof e.value=="number"&&n>=e.value;case"lessThanOrEqual":return typeof n=="number"&&typeof e.value=="number"&&n<=e.value;case"exists":return n!=null&&n!==""&&n!==!1;case"notExists":return n==null||n===""||n===!1;case"contains":return typeof n=="string"&&typeof e.value=="string"||Array.isArray(n)?n.includes(e.value):!1;default:return!1}}function Di(e){return e instanceof he||"expression"in e?e.expression:e}function re(e,t){let n=Di(e);if(n.type==="condition")return Pi(n,t);let{logic:r,conditions:i}=n;return r==="and"?i.every(s=>re(s,t)):i.some(s=>re(s,t))}function Ip(e,t){return e?{visible:e.visible?re(e.visible,t):!0,disabled:e.disabled?re(e.disabled,t):!1,required:e.required?re(e.required,t):!1,readonly:e.readonly?re(e.readonly,t):!1}:{visible:!0,disabled:!1,required:!1,readonly:!1}}var he=class e{constructor(t){k(this,"expression");this.expression=t}get type(){return this.expression.type}or(t){let n=t instanceof e?t.expression:t,r=this.expression;return r.type==="group"&&r.logic==="or"?new e({type:"group",logic:"or",conditions:[...r.conditions,n]}):new e({type:"group",logic:"or",conditions:[r,n]})}and(t){let n=t instanceof e?t.expression:t,r=this.expression;return r.type==="group"&&r.logic==="and"?new e({type:"group",logic:"and",conditions:[...r.conditions,n]}):new e({type:"group",logic:"and",conditions:[r,n]})}};function wp(e){function t(n,r){return new he({type:"condition",field:e,operator:n,value:r})}return{equals:n=>t("equals",n),notEquals:n=>t("notEquals",n),in:n=>t("in",n),notIn:n=>t("notIn",n),greaterThan:n=>t("greaterThan",n),lessThan:n=>t("lessThan",n),greaterThanOrEqual:n=>t("greaterThanOrEqual",n),lessThanOrEqual:n=>t("lessThanOrEqual",n),exists:()=>t("exists"),notExists:()=>t("notExists"),contains:n=>t("contains",n)}}function Op(e){let t=e instanceof he?e.expression:e,n=new Set;function r(i){if(i.type==="condition")n.add(i.field);else for(let s of i.conditions)r(s)}return r(t),n}var Fi=new Set(["http:","https:","mailto:","tel:","blob:"]);function Fp(e){if(!e||typeof e!="string")return"";let t=e.trim();if(/^[/.?#]/.test(t))return t;try{let n=new URL(t);if(Fi.has(n.protocol))return t}catch{return t}return""}function _p(){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,n=>n.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}var Mp=3e4,Lp=15e3;function Bp(e,t,n){if(n?.aborted)return Promise.reject(Tn(n.reason));let r=t>0;return!r&&!n?e:new Promise((i,s)=>{let a=!1,l;function d(){a=!0,l!==void 0&&(clearTimeout(l),l=void 0),n&&n.removeEventListener("abort",m)}function m(){a||(d(),s(Tn(n?.reason)))}n&&n.addEventListener("abort",m,{once:!0}),r&&(l=setTimeout(()=>{a||(d(),s(Ni(t)))},t)),e.then(f=>{a||(d(),i(f))},f=>{a||(d(),s(f))})})}function Ni(e){let t=new Error(`Operation timed out after ${e}ms`);return t.name="TimeoutError",t}function Tn(e){if(e instanceof Error){let n=new Error(e.message);return n.name="AbortError",n}let t=new Error(typeof e=="string"?e:"Operation was aborted");return t.name="AbortError",t}var ut=J.map(e=>({value:e,label:`crud:status.${e}`})),Cm=Te;var _i=[...de,"status"];function Im(e){return _i.some(t=>t===e)}function Rn(e){return de.some(t=>t===e)}var I={status:{name:"status",type:"select",visibility:"admin",label:"crud:fields.status",editable:"admin",validation:{required:!0,options:[...ut]}},id:{name:"id",type:"text",visibility:"hidden",label:"crud:fields.id",validation:{required:!0}},createdAt:{name:"createdAt",type:"timestamp",visibility:"technical",label:"crud:fields.createdAt",validation:{}},updatedAt:{name:"updatedAt",type:"timestamp",visibility:"technical",label:"crud:fields.updatedAt",validation:{}},createdById:{name:"createdById",type:"reference",visibility:"technical",label:"crud:fields.createdById",validation:{}},updatedById:{name:"updatedById",type:"reference",visibility:"technical",label:"crud:fields.updatedById",validation:{}}};var Ue=e=>{let t=[];return e.validation?.minLength!==void 0&&t.push(c.minLength(e.validation.minLength,`Must be at least ${e.validation.minLength} characters`)),e.validation?.maxLength!==void 0&&t.push(c.maxLength(e.validation.maxLength,`Must be at most ${e.validation.maxLength} characters`)),e.validation?.pattern&&t.push(c.regex(new RegExp(e.validation.pattern),"Invalid format")),t.length>0?c.pipe(c.string(),...t):c.string()},Ui=()=>c.pipe(c.string(),c.email("Invalid email address")),Mi=e=>e.validation?.minLength!==void 0?c.pipe(c.string(),c.minLength(e.validation.minLength,`Must be at least ${e.validation.minLength} characters`)):c.string(),Li=()=>c.pipe(c.string(),c.url("Invalid URL")),ie=e=>{let t=[];return e.validation?.min!==void 0&&t.push(c.minValue(e.validation.min,`Must be at least ${e.validation.min}`)),e.validation?.max!==void 0&&t.push(c.maxValue(e.validation.max,`Must be at most ${e.validation.max}`)),t.length>0?c.pipe(c.number(),...t):c.number()},kn=()=>c.boolean(),ct=()=>c.pipe(c.string(),c.check(e=>!isNaN(new Date(e).getTime()),"Invalid date format")),Bi=/^(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)?$/,Vi=/^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/,$i=/^\d{4}-(?:0[1-9]|1[0-2])$/,ji=()=>c.pipe(c.string(),c.regex(Bi,"Invalid time format")),qi=()=>c.pipe(c.string(),c.regex(Vi,"Invalid week format")),Wi=()=>c.pipe(c.string(),c.regex($i,"Invalid month format")),Nn=c.object({url:c.string(),filename:c.string(),size:c.number(),mimeType:c.nullish(c.string()),uploadedAt:c.nullish(c.string())}),An=()=>Nn,Cn=()=>c.array(Nn),_n=c.object({fullUrl:c.string(),thumbUrl:c.string()}),Hi=()=>c.union([c.string(),_n]),Ki=()=>c.array(c.union([c.string(),_n])),Gi=()=>c.object({lat:c.number(),lng:c.number()}),Yi=()=>c.object({formatted_address:c.string(),latitude:c.number(),longitude:c.number(),street_number:c.nullish(c.string()),route:c.nullish(c.string()),locality:c.nullish(c.string()),administrative_area_level_1:c.nullish(c.string()),administrative_area_level_2:c.nullish(c.string()),country:c.nullish(c.string()),postal_code:c.nullish(c.string())}),zi=()=>c.record(c.string(),c.unknown()),Xi=()=>c.array(c.unknown()),Qi=()=>c.array(c.record(c.string(),c.unknown())),dt=e=>{let t=e.validation?.options;return Array.isArray(t)&&t.length>0?c.picklist(t.map(n=>n.value)):c.union([c.string(),c.number()])},Zi=e=>{let t=e.validation?.options;return Array.isArray(t)&&t.length>0?c.array(c.picklist(t.map(n=>n.value))):c.array(c.string())},Un=()=>c.pipe(c.string(),c.minLength(1,"Invalid ID format")),pt=()=>c.string(),Ji=/^(?:\+[1-9](?:[ .-]?\d){7,14}|0[1-9](?:[ .-]?\d{2}){4})$/,eo=e=>{let t=e.validation?.pattern?new RegExp(e.validation.pattern):Ji;return c.pipe(c.string(),c.regex(t,"Invalid phone number"))},to=e=>{let t=e.validation?.minLength??15,n=e.validation?.maxLength??34,r=e.validation?.pattern??"^[A-Z]{2}[0-9]{2}[A-Z0-9]{4,34}$";return c.pipe(c.string(),c.minLength(t,`IBAN must be at least ${t} characters`),c.maxLength(n,`IBAN must not exceed ${n} characters`),c.regex(new RegExp(r),"Invalid IBAN format"))},In=()=>c.never();function Mn(e){let t=e.options?.fieldSpecific;if(t?.checkedValue&&t?.uncheckedValue)return[t.checkedValue,t.uncheckedValue]}var no=e=>{let t=Mn(e);return t?c.picklist(t):c.boolean()},wn=c.looseObject({gdprConsent:c.literal(!0),gdprConsentDate:c.optional(c.string()),gdprConsentVersion:c.optional(c.string())},"GDPR consent must be given"),ro=e=>e.validation?.required?wn:c.union([c.literal(!1),wn]),io=()=>c.object({amount:c.number(),currency:c.optional(c.string()),vatIncluded:c.optional(c.boolean()),discountPercent:c.optional(c.pipe(c.number(),c.minValue(0),c.maxValue(100)))}),Ln={text:{schema:Ue,kind:"text"},textarea:{schema:Ue,kind:"text"},richtext:{schema:Ue,kind:"text"},color:{schema:Ue,kind:"text"},email:{schema:Ui,kind:"text"},password:{schema:Mi,kind:"text"},url:{schema:Li,kind:"text"},tel:{schema:eo,kind:"text"},iban:{schema:to,kind:"text"},number:{schema:ie,kind:"number"},currency:{schema:ie,kind:"number"},range:{schema:ie,kind:"number"},year:{schema:ie,kind:"number"},rating:{schema:ie,kind:"number"},duration:{schema:ie,kind:"number"},price:{schema:io,kind:"json"},boolean:{schema:kn,kind:"boolean"},checkbox:{schema:kn,kind:"boolean"},switch:{schema:no,kind:e=>Mn(e)?"text":"boolean"},gdprConsent:{schema:ro,kind:"json"},date:{schema:ct,kind:"date"},"datetime-local":{schema:ct,kind:"timestamp"},timestamp:{schema:ct,kind:"timestamp"},time:{schema:ji,kind:"time"},week:{schema:qi,kind:"text"},month:{schema:Wi,kind:"text"},file:{schema:An,kind:"json"},files:{schema:Cn,kind:"json"},document:{schema:An,kind:"json"},documents:{schema:Cn,kind:"json"},image:{schema:Hi,kind:"json"},images:{schema:Ki,kind:"json"},geopoint:{schema:Gi,kind:"json"},address:{schema:Yi,kind:"json"},map:{schema:zi,kind:"json"},array:{schema:Xi,kind:"json"},"field-array":{schema:Qi,kind:"json"},select:{schema:dt,kind:"text"},radio:{schema:dt,kind:"text"},combobox:{schema:dt,kind:"text"},multiselect:{schema:Zi,kind:"json"},reference:{schema:Un,kind:"ref"},hidden:{schema:pt,kind:"text"},avatar:{schema:pt,kind:"text"},badge:{schema:pt,kind:"text"},submit:{schema:In,kind:"text"},reset:{schema:In,kind:"text"}},oo=new Set(Pt);function so(e){return oo.has(e)}var ao=new Set(["optional","exact_optional","nullable","nullish","undefinedable","non_nullable","non_nullish","non_optional"]),lo=new Set(["object","loose_object","strict_object","object_with_rest","record","array","tuple","loose_tuple","strict_tuple","tuple_with_rest","intersect"]),uo=new Set(["trim","trim_start","trim_end","to_lower_case","to_upper_case","to_min_value","to_max_value","normalize","brand","flavor","readonly"]),co={iso_date:"date",iso_time:"time",iso_time_second:"time",iso_date_time:"timestamp",iso_timestamp:"timestamp"};function j(e,t){return t in e?Reflect.get(e,t):void 0}function On(e){if(typeof e=="string")return"text";if(typeof e=="number")return"number";if(typeof e=="boolean")return"boolean"}function Pn(e){if(e.length===0||e.some(n=>n===void 0))return;let t=new Set(e);return t.size===1?e[0]:t.has("json")?"json":void 0}function Me(e){if(typeof e!="object"||e===null)return;let t=j(e,"type");if(typeof t!="string")return;let n=po(e,t),r=j(e,"pipe");if(Array.isArray(r))for(let i of r.slice(1)){if(typeof i!="object"||i===null)continue;let s=j(i,"kind"),a=j(i,"type");if(typeof a=="string"){if(s==="schema")n=Me(i);else if(s==="transformation")uo.has(a)||(n=void 0);else if(s==="validation"){a==="integer"&&n==="number"&&(n="integer");let l=co[a];l&&n==="text"&&(n=l)}}}return n}function po(e,t){if(ao.has(t))return Me(j(e,"wrapped"));if(lo.has(t))return"json";switch(t){case"string":return"text";case"number":return"number";case"bigint":return"integer";case"boolean":return"boolean";case"date":return"timestamp";case"literal":return On(j(e,"literal"));case"picklist":case"enum":{let n=j(e,"options");return Array.isArray(n)?Pn(n.map(On)):void 0}case"union":case"variant":{let n=j(e,"options");if(!Array.isArray(n))return;let r=n.filter(i=>{let s=typeof i=="object"&&i!==null?j(i,"type"):void 0;return s!=="null"&&s!=="undefined"});return Pn(r.map(Me))}default:return}}function Dn(e,t){let{kind:n}=Ln[e];return typeof n=="function"?n(t):n}function mt(e,t=e.name){let n=e.validation?.reference,r=n?{ref:n}:{},i=e.type,s=so(i)?i:void 0,a=e.validation?.schema;if(a){let l=(n?"ref":void 0)??Me(a)??(s?Dn(s,e):void 0);if(!l)throw new Error(`Field '${t}' (custom type '${i}'): the storage kind of its validation.schema cannot be read. Root the schema on a Valibot string, number, boolean, picklist, object or array schema, or set validation.reference.`);return{schema:a,kind:l,...r}}if(n)return{schema:Un(),kind:"ref",...r};if(s)return{schema:Ln[s].schema(e),kind:Dn(s,e)};throw new Error(`Field '${t}' has custom type '${i}' and no value shape. Add validation.schema (a Valibot schema of the stored value) or validation.reference (the referenced collection) to the field, or use a built-in type.`)}function mo(e){return e.validation?.required===!0?"always":e.conditions?.required!==void 0?"conditional":"never"}function fo(e,t){return t.visibility==="hidden"||t.editable===q.GENERATED||Rn(e)?"never":t.editable===q.FALSE?"program":t.editable===q.COMPUTED?"derived":"user"}function go(e,t){return(n,r)=>{if(t!=="user")return!1;let i=e.editable;return i===void 0||i===q.TRUE?e.visibility!=="technical":i===q.CREATE_ONLY?r==="create":typeof i=="string"?Y(n,i):!1}}function ho(e,t,n){let r=fo(e,t);return{value:mt(t,`${n}.${e}`),required:mo(t),write:r,editableFor:go(t,r),visibleAt:t.visibility,...t.i18n===!0&&{companion:ge(e)}}}var Fn=new WeakMap;function Le(e){let t=Fn.get(e);if(t)return t;let n={};for(let[i,s]of Object.entries(e.fields))n[i]=ho(i,s,e.name);let r={name:e.name,collection:e.collection,fields:n};return Fn.set(e,r),r}function yo(e,t){return t?oe.pipe(e,oe.check(n=>n!=="","Required")):oe.nullish(e)}function z(e){return yo(mt(e).schema,e.validation?.required)}var Bn=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/;function Vn(e){return typeof e=="string"&&e.length>=19&&e.includes("-")&&e.includes(":")}function $n(e){return typeof e=="object"&&e!==null}function Be(e,t=""){if(Array.isArray(e))e.forEach((n,r)=>{let i=`${t}[${r}]`;if(typeof n=="string"&&Vn(n)){if(!Bn.test(n))throw A(new Error(`Invalid date format for ${i}. Expected ISO string (YYYY-MM-DDTHH:mm:ss.sssZ). Received: "${n}"`),{userMessage:`Invalid date format for ${i}. Expected ISO string (YYYY-MM-DDTHH:mm:ss.sssZ). Received: "${n}"`,context:{field:i,value:n},severity:"error"})}else $n(n)&&Be(n,i)});else if(typeof e=="object"&&e!==null)for(let[n,r]of Object.entries(e)){let i=t?`${t}.${n}`:n;if(typeof r=="string"&&Vn(r)){if(!Bn.test(r))throw A(new Error(`Invalid date format for field "${i}". Expected ISO string (YYYY-MM-DDTHH:mm:ss.sssZ). Received: "${r}"`),{userMessage:`Invalid date format for field "${i}". Expected ISO string (YYYY-MM-DDTHH:mm:ss.sssZ). Received: "${r}"`,context:{field:i,value:r},severity:"error"})}else $n(r)&&Be(r,i)}}import*as qn from"valibot";var ft={};function Bm(e){ft.uniqueConstraintValidator=e}async function jn(e,t,n){let{uniqueFields:r=[],collection:i}=e.metadata;if(r.length!==0){if(!ft.uniqueConstraintValidator){process.env.NODE_ENV;return}await Promise.all(r.map(async({field:s,errorMessage:a})=>{let l=t[s];if(l==null)return;if(await ft.uniqueConstraintValidator.checkDuplicate(i,s,l,n))throw A(new Error(a||`${s} must be unique`),{userMessage:a||`${s} must be unique`,context:{field:s}})}))}}async function qm(e,t,n,r){qn.parse(e,t),Be(t),await jn(e,t,r),e.metadata.customValidate&&await e.metadata.customValidate(t,n)}function vo(e){return e!=null&&typeof e=="object"&&"metadata"in e&&typeof e.metadata=="object"&&e.metadata!==null}function Zm(e){if(!vo(e)){let t=e,n=t&&typeof t=="object"&&"constructor"in t&&t.constructor&&t.constructor.name||"unknown";throw A(new Error("Schema does not have metadata"),{userMessage:"Invalid schema: missing collection metadata",severity:"error",context:{schemaType:n}})}return e.metadata.collection}var Wn=()=>Pe("entity-registry",()=>new Map);function Hn(e){Wn().set(e.collection,e)}function bo(e){return Wn().get(e)}var Eo=new Set(["__proto__","constructor","prototype"]);function So(e){for(let t of Object.keys(e.fields))if(Eo.has(t))throw A(new Error(`Field name '${t}' in entity '${e.name}' is a reserved JavaScript property and cannot be used as a field name.`),{userMessage:`Field name '${t}' in entity '${e.name}' is a reserved JavaScript property and cannot be used as a field name.`,context:{entityName:e.name,fieldName:t,operation:"defineEntity"},severity:"error"})}function xo(e){let t=e.field.endsWith("Id")?e.field.slice(0,-2):e.field,n=e.collection||(t.endsWith("y")?t.slice(0,-1)+"ies":t+"s");return{name:e.field,label:`crud:fields.${e.field}`,type:"reference",visibility:"technical",editable:q.CREATE_ONLY,validation:{required:!0,reference:n}}}function To(e,t){if(!t||t.length===0)return e.map(i=>({value:i.value,label:i.label}));let n=e.map(i=>({value:i.value,label:i.label})),r=new Set(e.map(i=>i.value));for(let i of t)r.has(i.value)||n.push(i);return n}function Ro(e,t){if(!(!e.uniqueKeys||e.uniqueKeys.length===0))for(let n=0;n<e.uniqueKeys.length;n++){let r=e.uniqueKeys[n];if(!r)continue;if(!r.fields||r.fields.length===0)throw A(new Error(`uniqueKeys[${n}] for entity '${e.name}' must have at least one field`),{userMessage:`uniqueKeys[${n}] for entity '${e.name}' must have at least one field`,context:{entityName:e.name,uniqueKeyIndex:n},severity:"error"});let i=r.fields.filter(s=>!t.has(s));if(i.length>0)throw A(new Error(`uniqueKeys[${n}] for entity '${e.name}' references non-existent fields: ${i.join(", ")}`),{userMessage:`uniqueKeys[${n}] for entity '${e.name}' references non-existent fields: ${i.join(", ")}`,context:{entityName:e.name,uniqueKeyIndex:n,invalidFields:i},severity:"error"})}}function ko(e){let{form:t,fields:n}=e,r=Object.keys(n);if(t){if(t.type==="multi-step"||t.type==="wizard"){if(!t.steps||t.steps.length===0)throw A(new Error(`Multi-step form for entity '${e.name}' must have at least one step`),{userMessage:`Multi-step form for entity '${e.name}' must have at least one step`,context:{entityName:e.name,operation:"validateFormConfig"},severity:"error"});let i=t.steps.flatMap(d=>d.fields),s=i.filter(d=>!r.includes(d));if(s.length>0)throw A(new Error(`Multi-step form for entity '${e.name}' references non-existent fields: ${s.join(", ")}`),{userMessage:`Multi-step form for entity '${e.name}' references non-existent fields: ${s.join(", ")}`,context:{entityName:e.name,invalidFields:s,operation:"validateFormConfig"},severity:"error"});let a=new Set(i);r.filter(d=>!a.has(d)).length>0&&process.env.NODE_ENV}t.rules&&t.rules.forEach((i,s)=>{let l=(Array.isArray(i.condition)?i.condition.map(f=>f.field):[i.condition.field]).filter(f=>!r.includes(f));if(l.length>0)throw A(new Error(`Dynamic form rule ${s} for entity '${e.name}' references non-existent condition fields: ${l.join(", ")}`),{userMessage:`Dynamic form rule ${s} for entity '${e.name}' references non-existent condition fields: ${l.join(", ")}`,context:{entityName:e.name,ruleIndex:s,invalidFields:l,operation:"validateFormConfig"},severity:"error"});let m=[...i.showFields||[],...i.hideFields||[],...i.disableFields||[],...i.enableFields||[]].filter(f=>!r.includes(f));if(m.length>0)throw A(new Error(`Dynamic form rule ${s} for entity '${e.name}' references non-existent affected fields: ${m.join(", ")}`),{userMessage:`Dynamic form rule ${s} for entity '${e.name}' references non-existent affected fields: ${m.join(", ")}`,context:{entityName:e.name,ruleIndex:s,invalidFields:m,operation:"validateFormConfig"},severity:"error"})}),Object.entries(n).forEach(([i,s])=>{if(s.dependsOn&&!r.includes(s.dependsOn.field))throw A(new Error(`Field '${i}' in entity '${e.name}' depends on non-existent field: ${s.dependsOn.field}`),{userMessage:`Field '${i}' in entity '${e.name}' depends on non-existent field: ${s.dependsOn.field}`,context:{entityName:e.name,fieldName:i,dependsOnField:s.dependsOn.field,operation:"validateFormConfig"},severity:"error"})})}}function Ao(e){return e.form?{type:"single",behavior:{showProgress:!1,allowStepNavigation:!0,validateOnStepChange:!0,showStepNumbers:!0},layout:{columns:1,showLabels:!0,showHints:!0},...e.form}:{type:"single",behavior:{showProgress:!1,allowStepNavigation:!0,validateOnStepChange:!0,showStepNumbers:!0},layout:{columns:1,showLabels:!0,showHints:!0}}}function lf(e){let t=e;try{So(t),ko(t);let n=Ao(t),r={...t.fields,...I,...t.fields.createdAt&&{createdAt:{...I.createdAt,...t.fields.createdAt,type:I.createdAt.type,visibility:I.createdAt.visibility}},...t.fields.updatedAt&&{updatedAt:{...I.updatedAt,...t.fields.updatedAt,type:I.updatedAt.type,visibility:I.updatedAt.visibility}},...t.fields.createdById&&{createdById:{...I.createdById,...t.fields.createdById,type:I.createdById.type,visibility:I.createdById.visibility}},...t.fields.updatedById&&{updatedById:{...I.updatedById,...t.fields.updatedById,type:I.updatedById.type,visibility:I.updatedById.visibility}},...t.fields.status&&{status:{...I.status,...t.fields.status,validation:{...I.status.validation,...t.fields.status.validation,options:To(ut,t.fields.status.validation?.options)}}},...t.scope&&{[t.scope.field]:xo(t.scope)}};if(t.listFields){let l=new Set(Object.keys(r)),d=t.listFields.filter(m=>!l.has(m));if(d.length>0)throw A(new Error(`Entity '${t.name}' defines listFields that do not exist: ${d.join(", ")}`),{userMessage:`Entity '${t.name}' defines listFields that do not exist: ${d.join(", ")}`,context:{entityName:t.name,invalidFields:d,operation:"defineEntity"},severity:"error"})}if(t.listCardFields){let l=new Set(Object.keys(r)),m=Ne(t).filter(f=>!l.has(f));if(m.length>0)throw A(new Error(`Entity '${t.name}' defines listCardFields that do not exist: ${m.join(", ")}`),{userMessage:`Entity '${t.name}' defines listCardFields that do not exist: ${m.join(", ")}`,context:{entityName:t.name,invalidFields:m,operation:"defineEntity"},severity:"error"})}if(t.uniqueKeys){let l=new Set(Object.keys(r));Ro(t,l)}let i={...ze,...t.access||{}},s=t.namespace||`entity-${t.name.toLowerCase()}`,a={...t,form:n,fields:r,access:i,namespace:s,...t.search&&{search:t.search},...t.defaultSort&&{defaultSort:t.defaultSort}};try{Le(a)}catch(l){let d=l instanceof Error?l.message:String(l);throw A(new Error(d),{userMessage:d,context:{entityName:t.name,operation:"defineEntity"},severity:"error"})}return Hn(a),a}catch(n){throw A(n,{userMessage:`Failed to define entity '${t.name}'`,context:{entityName:t.name,operation:"defineEntity"},severity:"error"})}}import*as w from"valibot";function N(e){let t=e?.status;return typeof t=="string"?t:null}function $e({op:e,status:t,storedStatus:n}){return Ve(t??n,"saveIncomplete")?"draft":e==="create"?"create":"update"}function Kn({op:e,status:t,storedStatus:n}){if(e!=="update")return!1;let r=t??n;return r==null||r===n?!1:Ve(n,"holdIncomplete")&&!Ve(r,"holdIncomplete")}function Gn(e){return e!=null&&Object.hasOwn(V,e)?V[e]:wt}function Ve(e,t){return Gn(e)[t]}function je(e,t){let n=Gn(e).read;return n==="guest"||Y(t,n)}function gt(e){return Object.keys(V).filter(t=>V[t][e])}function Q(e,t){return Object.assign(e,{visibility:t})}function X(e,t){return Object.assign(e,{metadata:{collection:t.collection,entity:t.name,...t.uniqueKeys&&{uniqueKeys:t.uniqueKeys},...t.security&&{security:t.security}}})}function Co(e){let t=z(e);return Q(t,e.visibility)}function Io(e,t){if(!st.includes(t.type))throw new Error(`Field '${e}' has i18n: true but type '${t.type}'. Translatable types: ${st.join(", ")}.`);let n=z({...t,validation:{...t.validation,required:!1}});return Q(w.optional(w.nullable(w.record(w.string(),n))),t.visibility)}function se(e,t){for(let n of Object.keys(e)){let r=t[n];r?.i18n===!0&&(e[ge(n)]=Io(n,r))}return e}function ht(e){let t=z({...e,validation:{...e.validation,required:!1}});return Q(t,e.visibility)}function wo(e){return e.validation?.required?Q(w.optional(z(e)),e.visibility):ht(e)}function vf(e){let t=e.fields,n=Le(e).fields,r=C=>n[C]?.write==="never",i={};for(let[C,F]of Object.entries(t))n[C]?.visibleAt!=="hidden"&&(i[C]=ht(F));let s=X(w.object(se({...i},t)),e),a={};for(let[C,F]of Object.entries(t))r(C)||(a[C]=Co(F));let l=X(w.object(se({...a},t)),e),d={};for(let[C,F]of Object.entries(t))if(!r(C))if(C==="status"){let H=w.picklist(gt("saveIncomplete"));d[C]=Q(H,F.visibility)}else d[C]=ht(F);let m=X(w.object(se({...d},t)),e),f={};for(let[C,F]of Object.entries(t))r(C)||(f[C]=wo(F));f.id=Q(z(I.id),"technical");let S=X(w.object(se({...f},t)),e),P;if(e.listFields&&e.listFields.length>0){let C=["id","status"],F=[...new Set([...C,...e.listFields])];P={};for(let H of F){let le=i[H];le&&(P[H]=le)}}else P=i;let _=X(w.object(se({...P},t)),e),T,L=Ne(e);if(L.length>0){let C=["id","status"],F=[...new Set([...C,...L])];T={};for(let H of F){let le=i[H];le&&(T[H]=le)}}else T=i;let ve=X(w.object(se({...T},t)),e),tr=X(w.object({id:Q(z(I.id),"technical")}),e);return{create:l,draft:m,update:S,get:s,list:_,listCard:ve,delete:tr}}function Ef(e,t,n=1,r=!1){let i=[];if(r)for(let s=t;s>=e;s-=n)i.push({value:String(s),label:String(s)});else for(let s=e;s<=t;s+=n)i.push({value:String(s),label:String(s)});return i}var Z=new Map;function xf(e,t){Z.has(e)&&process.env.NODE_ENV,Z.set(e,t)}function Tf(e){Z.delete(e)}function Rf(e){let t=Z.get(e);return t?t():(process.env.NODE_ENV,null)}function kf(e){return Z.has(e)}function Af(){return Array.from(Z.keys())}function Cf(){Z.clear()}import*as y from"valibot";var Oo=y.record(y.string(),y.unknown()),Po=y.object({id:y.string(),patch:y.record(y.string(),y.unknown())}),Do=y.string(),wf=y.object({inserts:y.optional(y.array(Oo)),updates:y.optional(y.array(Po)),deletes:y.optional(y.array(Do))}),Fo=y.object({insertedIds:y.array(y.string()),updatedIds:y.array(y.string()),deletedIds:y.array(y.string())}),No=y.variant("op",[y.object({op:y.literal("insert"),index:y.pipe(y.number(),y.integer(),y.minValue(0)),id:y.optional(y.string()),error:y.string()}),y.object({op:y.literal("update"),id:y.string(),index:y.optional(y.pipe(y.number(),y.integer(),y.minValue(0))),error:y.string()}),y.object({op:y.literal("delete"),id:y.string(),index:y.optional(y.pipe(y.number(),y.integer(),y.minValue(0))),error:y.string()})]),_o=y.object({...Fo.entries,failed:y.optional(y.array(No),()=>[])});function Of(e,t){let n=y.parse(_o,t),r=l=>{throw new Error(`Invalid bulk acknowledgement: ${l}`)},i=e.inserts??[],s=new Set;for(let l of n.failed){if(l.op!=="insert")continue;(l.index>=i.length||s.has(l.index))&&r("unknown or duplicate insert index");let d=i[l.index];l.id!==void 0&&l.id!==d.id&&r("contradictory insert identity"),s.add(l.index)}n.insertedIds.length+s.size!==i.length&&r("missing or extra insert outcomes"),new Set(n.insertedIds).size!==n.insertedIds.length&&r("duplicate inserted ID");let a=new Set([...s].map(l=>i[l].id).filter(l=>typeof l=="string"));n.insertedIds.some(l=>a.has(l))&&r("insert ID both successful and failed");for(let l of["update","delete"]){let d=l==="update"?(e.updates??[]).map(({id:T})=>T):e.deletes??[],m=l==="update"?n.updatedIds:n.deletedIds,f=new Map;for(let T of d)f.set(T,(f.get(T)??0)+1);let S=new Map,P=new Set;for(let T of n.failed)T.op===l&&((!f.has(T.id)||T.index!==void 0&&d[T.index]!==T.id)&&r(`unknown or contradictory ${l} identity`),T.index!==void 0&&(P.has(T.index)&&r(`duplicate ${l} failure index`),P.add(T.index)),S.set(T.id,(S.get(T.id)??0)+1));let _=d.filter(T=>!S.has(T));for(let[T,L]of S)L!==f.get(T)&&r(`duplicate or ambiguous ${l} failures`);(_.length!==m.length||_.some((T,L)=>m[L]!==T))&&r(`missing, duplicate, unknown or contradictory ${l} outcomes`)}return n}function Pf(e){let t=new Set((e.updates??[]).map(a=>a.id)),n=e.deletes??[],r=[];for(let a of n)t.has(a)&&r.push(a);if(r.length>0)return{collisions:r,where:"updates-deletes"};let i=e.inserts??[],s=[];for(let a of i)typeof a.id=="string"&&t.has(a.id)&&s.push(a.id);return s.length>0?{collisions:s,where:"inserts-updates"}:{collisions:[],where:null}}import*as Yn from"valibot";function Uo(e,t){if(e.ok)return e.written;let n=e.issues.map(r=>`${r.path?.map(i=>String(i.key)).join(".")||"root"}: ${r.message}`).join("; ");throw new R(`Validation failed in ${t}: ${n}`,"validation-failed",{details:{issues:e.issues},source:"validation"})}function zn(e){let t=e.entries;if(!t||typeof t!="object")throw new R("CRUD write rules: a write schema must be an object schema (createSchemas(entity))","internal");return Object.keys(t)}function qe(e,t){let n=[e.create,e.draft,e.update].filter(i=>i!==void 0);if(n.some(i=>i.type==="loose_object"))return[];let r=new Set([...n.flatMap(zn),...de]);return Object.keys(t).filter(i=>!r.has(i))}function Xn(e,t){let n={};for(let r of zn(t))n[r]=null;for(let[r,i]of Object.entries(e))i!==void 0&&(n[r]=i);return n}function ye(e,t,n,r,i){let s=Yn.safeParse(t,n);if(!s.success)return{ok:!1,schemaKey:e,issues:[...s.issues],unknownKeys:i};let a=s.output,l={};for(let d of Object.keys(r))d!=="id"&&Object.hasOwn(a,d)&&(l[d]=a[d]);return{ok:!0,schemaKey:e,written:l,unknownKeys:i}}function Qn(e){return N(e)??Te}function Mo(e,t){let n=Qn(t),r=$e({op:"create",status:n}),i={...t,status:n},s=ye(r,r==="draft"?e.draft:e.create,i,i,qe(e,t));return s.ok?{...s,written:{...s.written,status:n}}:s}function Zn(e){return N(e)!==Xe}function Jn(e,t){let n={op:"update",status:N(e),storedStatus:N(t)};return{schemaKey:$e(n)==="draft"?"draft":"update",whole:Kn(n)}}function er(e,{id:t,patch:n,stored:r}){let i=N(n);if(!r&&Zn(n))throw new R(`CRUD update rules: row "${t}" needs its stored row (the row's status${i===null?"":" and the publish check"} come from it); read it before the update.`,"internal");let{schemaKey:s,whole:a}=Jn(n,r),l=qe(e,n);if(r&&a)return ye(s,e.update,Xn({...r,...n,id:t},e.update),n,l);let d=s==="draft"?{...n,status:N(n)??N(r),id:t}:{...n,id:t};return ye(s,s==="draft"?e.draft:e.update,d,n,l)}function Lo(e,t){return er(e,{id:t,patch:{status:Xe}})}function Bo(e){return J.filter(t=>!je(t,e))}function Vo(e,t){return je(N(e),t)}import*as b from"valibot";var Jf=b.pipe(b.string(),b.check(e=>e.startsWith("/proxy/")||e.startsWith("data:image/"),"Image URL must be box-proxied (/proxy/...) or an inline data:image URI.")),$o=b.picklist(["ephemeral","session","persistent"]),jo=b.object({title:b.optional(b.string()),pinnable:b.optional(b.boolean()),preferredHeight:b.optional(b.pipe(b.number(),b.minValue(0)))}),qo=b.object({id:b.pipe(b.string(),b.minLength(1)),kind:b.pipe(b.string(),b.minLength(1)),lifetime:b.optional($o,"ephemeral"),metadata:b.optional(jo),payload:b.unknown()}),Wo=b.object({widgetId:b.pipe(b.string(),b.minLength(1)),action:b.pipe(b.string(),b.minLength(1)),payload:b.unknown()}),ae=new Map;function eg(e){if(ae.has(e.kind))throw new Error(`[canvas] Widget kind "${e.kind}" already registered.`);ae.set(e.kind,e)}function tg(e){return ae.get(e)}function ng(){return Array.from(ae.values())}function rg(e,t){let n=b.safeParse(qo,e);if(!n.success)return{ok:!1,reason:`Invalid canvas block envelope: ${We(n.issues)}`};let r=ae.get(n.output.kind);if(!r)return{ok:!1,reason:`Unknown widget kind: "${n.output.kind}"`};let i=b.safeParse(r.schema,n.output.payload);if(!i.success)return{ok:!1,reason:`Payload rejected by "${n.output.kind}" schema: ${We(i.issues)}`};if(t?.caller!==void 0){let a=t.caller.access;if(!Ho(r.surface,a))return{ok:!1,reason:`surface_forbidden: widget "${n.output.kind}" surface=${r.surface} not reachable by caller access=${a===null?"null":a}`}}return{ok:!0,value:{...n.output,payload:i.output},widget:r}}function Ho(e,t){return e==="meta"?!0:e==="household"||e==="private"?t==="admin"||t==="member":!1}function ig(e,t){let n=b.safeParse(Wo,e);if(!n.success)return{ok:!1,reason:`Invalid canvas event envelope: ${We(n.issues)}`};let r=ae.get(t);if(!r)return{ok:!1,reason:`Unknown widget kind: "${t}"`};let i=r.actions[n.output.action];if(!i)return{ok:!1,reason:`Widget "${t}" has no action "${n.output.action}"`};let s=b.safeParse(i,n.output.payload);return s.success?{ok:!0,value:{...n.output,payload:s.output},widget:r}:{ok:!1,reason:`Payload rejected by "${t}.${n.output.action}" schema: ${We(s.issues)}`}}function We(e){return e.map(t=>{let n=t.path?.map(r=>String(r.key)).join(".")??"";return n?`${n}: ${t.message}`:t.message}).join("; ")}export{Ea as AGGREGATE_FILTER_OPERATORS,ba as AGGREGATE_OPERATIONS,sr as AIChatRequestSchema,lr as AIChatResponseSchema,yt as AIMessageSchema,ts as AIProviderConfigSchema,or as AIToolCallSchema,ir as AIToolDefinitionSchema,ar as AIUsageSchema,zo as AI_ERROR_CODES,Go as AI_MODELS,U as AI_PROVIDERS,be as AI_ROLES,Xo as AI_TIERS,Zo as AI_TOKEN_PRICING,sl as AUTH_EVENTS,Bt as AUTH_PARTNERS,Ts as AUTH_PARTNER_STATE,Dt as AtomicBulkError,lt as AuthHardening,vt as AuthUserSchema,de as BACKEND_GENERATED_FIELD_NAMES,ll as BILLING_EVENTS,Ir as BREAKPOINT_RANGES,Ze as BREAKPOINT_THRESHOLDS,Ln as BUILTIN_VALUES,J as BUILT_IN_STATUSES,Nt as BulkAcrossCycleError,Ft as BulkCollisionError,Do as BulkDeleteIdSchema,Oo as BulkInsertSchema,_t as BulkNotImplementedError,No as BulkOutcomeFailureSchema,_o as BulkOutcomeSchema,wf as BulkRequestSchema,Fo as BulkResponseSchema,Po as BulkUpdateSchema,Ke as COMMON_TIER_CONFIGS,sa as CONFIDENCE_LEVELS,$t as CONSENT_CATEGORY,oa as CONTEXTS,K as CRUD_OPERATORS,Gt as CURRENCY_MAP,wt as CUSTOM_STATUS,qo as CanvasBlockSchema,Wo as CanvasEventSchema,$o as CanvasLifetimeSchema,jo as CanvasWidgetMetadataSchema,mr as CheckoutLineItemInputSchema,It as CheckoutSessionMetadataSchema,he as ConditionBuilder,Rt as CreateCheckoutSessionRequestSchema,kt as CreateCheckoutSessionResponseSchema,Et as CustomClaimsSchema,Yo as DEFAULT_AI_CONFIG,Qo as DEFAULT_AI_MARKUP,Lp as DEFAULT_CRUD_TIMEOUT,ze as DEFAULT_ENTITY_ACCESS,ee as DEFAULT_ERROR_MESSAGES,Or as DEFAULT_LAYOUT_PRESET,Pr as DEFAULT_OG_IMAGE,Te as DEFAULT_STATUS,ut as DEFAULT_STATUS_OPTIONS,Cm as DEFAULT_STATUS_VALUE,Se as DEFAULT_SUBSCRIPTION,Mp as DEFAULT_UPLOAD_TIMEOUT,fu as DENSITY,R as DoNotDevError,q as EDITABLE,Ha as EMAIL_ERROR_CODES,Wa as EMAIL_PROVIDERS,xs as EMAIL_VERIFICATION_STATUS,Re as ENTITY_HOOK_ERRORS,ia as ENVIRONMENTS,pe as ERROR_CODES,el as ERROR_SEVERITY,tl as ERROR_SOURCE,Ut as EntityHookError,md as FAVICON_DEFAULTS,Ge as FEATURES,gu as FEATURE_CONSENT_MATRIX,aa as FEATURE_STATUS,Jr as FIELD_TEXT_FORMATTERS,Pt as FIELD_TYPES,Qe as FIREBASE_ERROR_MAP,Dr as FOOTER_MODE,Mt as GITHUB_PERMISSION_LEVELS,Rr as HIDDEN_STATUSES,Yd as LANGUAGE_COOKIE,Fr as LAYOUT_PRESET,ha as LIST_SCHEMA_TYPE,St as MAX_CHECKOUT_LINE_ITEMS,Tt as MAX_SHIPPING_RATE_IDS,cl as OAUTH_EVENTS,Vt as OAUTH_PARTNERS,ga as ORDER_DIRECTION,Jl as PARTNER_ICONS,pl as PAYLOAD_EVENTS,Ye as PERMISSIONS,ra as PLATFORMS,ad as PRERENDERED_HEAD_ELEMENT_ID,da as PWA_ASSET_TYPES,ca as PWA_DISPLAY_MODES,vr as ProductDeclarationSchema,Gs as ProductDeclarationsSchema,Jf as ProxiedImageUrlSchema,Xe as REMOVED_STATUS,pa as ROUTE_SOURCES,Ei as SESSION_RENDER_SEGMENT,pi as SITE_LOGO_PATH,V as STATUS_MATRIX,ua as STORAGE_SCOPES,la as STORAGE_TYPES,fl as STRIPE_EVENTS,xe as STRIPE_MODES,Ds as SUBSCRIPTION_DURATIONS,Ee as SUBSCRIPTION_STATUS,dr as SUBSCRIPTION_TIERS,kr as SendEmailRequestSchema,Ar as SendEmailResponseSchema,fe as SingletonManager,Tr as StripeBackConfigSchema,br as StripeFrontConfigSchema,xr as StripeOrderBackSchema,Sr as StripeOrderShippingSchema,Er as StripeOrderTaxSchema,hr as StripePaymentSchema,yr as StripeSubscriptionSchema,B as SubscriptionClaimsSchema,At as SubscriptionDataSchema,_i as TECHNICAL_FIELD_NAMES,st as TRANSLATABLE_FIELD_TYPES,O as USER_ROLES,bt as UserSubscriptionSchema,fa as VISIBILITY,fr as VerifyOrderCheckoutRequestSchema,gr as VerifyOrderCheckoutResultSchema,Ct as WebhookEventSchema,Uo as assertWrite,I as baseFields,ld as buildBreadcrumbJsonLd,ed as buildProductJsonLd,Ht as captureErrorToSentry,ql as checkGitHubAccessSchema,Dd as clearGlobalSingleton,Cf as clearScopeProviders,Ae as commonErrorCodeMappings,Yt as compactToISOString,Vd as configureProviders,_d as createAsyncSingleton,cr as createDefaultSubscriptionClaims,Rs as createDefaultUserProfile,Ia as createEntitySchema,$ as createErrorHandler,Uc as createMetadata,Ud as createMethodProxy,vf as createSchemas,Fd as createSingleton,Nd as createSingletonWithParams,Qn as createStatus,lf as defineEntity,Pa as deleteEntitySchema,Jc as deriveEntitySeo,Le as describeEntity,ho as describeField,Pf as detectBulkCollisions,jt as detectErrorSource,Kl as disconnectOAuthSchema,Hu as enhanceSchema,kc as ensureSpreadable,re as evaluateCondition,Ip as evaluateFieldConditions,Wl as exchangeTokenSchema,gd as faviconHeadTags,dp as filterVisibleFields,Ce as formatCurrency,Zr as formatDate,nn as formatFieldText,Kc as formatRelativeTime,xi as formatTrailingSlash,vi as generateCodeChallenge,yi as generateCodeVerifier,nd as generateFirestoreRuleCondition,yd as generatePKCEPair,_p as generateUUID,wr as getBreakpointFromWidth,Il as getBreakpointUtils,Zm as getCollectionName,Op as getConditionDependencies,Gl as getConnectionsSchema,Xr as getCurrencyLocale,Lc as getCurrencySymbol,jc as getCurrentTimestamp,bo as getEntityByCollection,wa as getEntitySchema,Pe as getGlobalSingleton,Ne as getListCardFieldNames,$d as getProvider,Af as getRegisteredScopeProviders,Cd as getRoleFromClaims,z as getSchemaType,Rf as getScopeValue,Hd as getTranslatedFieldNames,En as getVisibleFields,Hc as getWeekFromISOString,tg as getWidget,Nr as githubPermissionSchema,Je as githubRepoConfigSchema,$l as grantGitHubAccessSchema,A as handleError,vo as hasMetadata,jd as hasProvider,fp as hasRestrictedVisibility,Y as hasRoleAccess,kf as hasScopeProvider,Od as hasTierAccess,Bo as hiddenStatusesFor,ge as i18nFieldName,ru as isAuthPartnerId,Rn as isBackendGeneratedField,Cl as isBreakpoint,zt as isCompactDateString,en as isEmptyFieldValue,Ci as isFieldVisible,Im as isFrameworkField,at as isMultilingual,iu as isOAuthPartnerId,vd as isPKCESupported,Vo as isReadableBy,Vc as isoToCompactString,mi as jsonScriptText,Ti as languageUrl,tp as languageUrls,Rd as lazyImport,Da as listEntitiesSchema,ng as listWidgets,yn as localizePath,te as mapToDoNotDevError,ip as matchRoute,id as maybeTranslate,$c as normalizeToISOString,ds as overrideFeatures,Ps as overridePaymentModes,ps as overridePermissions,ur as overrideSubscriptionStatus,cs as overrideSubscriptionTiers,us as overrideUserRoles,Xd as parseAcceptLanguage,Nc as parseBlogFrontmatter,Xt as parseDate,Gc as parseDateToNoonUTC,Mo as prepareCreate,Lo as prepareRemove,er as prepareUpdate,Jd as publicPathname,Ef as rangeOptions,zd as readCookieValue,cn as readI18nSeoMeta,ud as recordHeadTags,Hl as refreshTokenSchema,xf as registerScopeProvider,Bm as registerUniqueConstraintValidator,eg as registerWidget,qd as resetProviders,fd as resolveFaviconFiles,mt as resolveFieldValue,gn as resolveLanguage,np as resolveLanguageRoute,un as resolveSeoField,wi as resolveUserSubscription,jl as revokeGitHubAccessSchema,gi as robotsContent,pd as routeHeadTags,dd as routeSeo,hi as routeTitle,Rc as safeValidate,Fp as sanitizeHref,lc as showNotification,cd as siteHeadTags,hn as splitLanguagePath,Ve as statusCan,N as statusOf,je as statusReadableBy,gt as statusesThat,it as stripHtmlTags,ep as stripTrailingSlash,Wc as timestampToISOString,Yc as toDateOnly,qc as toISOString,Kt as translateArray,Pc as translateArrayRange,Dc as translateArrayWithIndices,nt as translateEntityLabel,Oc as translateObjectArray,Kd as translateRow,Tf as unregisterScopeProvider,Jn as updateCheck,Oa as updateEntitySchema,sp as updateMetadata,Zn as updateNeedsStored,ns as validateAIChatRequest,rs as validateAIChatResponse,tu as validateAuthPartners,Es as validateAuthSchemas,ys as validateAuthUser,Xs as validateBillingSchemas,rg as validateBlock,Of as validateBulkOutcome,Ks as validateCheckoutSessionMetadata,Ed as validateCodeChallenge,bd as validateCodeVerifier,js as validateCreateCheckoutSessionRequest,qs as validateCreateCheckoutSessionResponse,bs as validateCustomClaims,Be as validateDates,qm as validateDocument,ig as validateEvent,nu as validateOAuthPartners,Ga as validateSendEmailRequest,Ya as validateSendEmailResponse,zs as validateStripeBackConfig,Ys as validateStripeFrontConfig,pr as validateSubscriptionClaims,Ws as validateSubscriptionData,jn as validateUniqueFields,vs as validateUserSubscription,Vs as validateVerifyOrderCheckoutRequest,$s as validateVerifyOrderCheckoutResult,Hs as validateWebhookEvent,Tc as validateWithSchema,wp as when,ac as withErrorHandling,xd as withGracefulDegradation,Bp as withTimeout,Ec as wrapAuthError,vc as wrapCrudError,bc as wrapStorageError};
|
|
1
|
+
var sr=Object.defineProperty;var ar=(e,t,n)=>t in e?sr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var k=(e,t,n)=>ar(e,typeof t!="symbol"?t+"":t,n);var U={ANTHROPIC:"anthropic",OPENAI:"openai",GOOGLE:"google"},Se={USER:"user",ASSISTANT:"assistant",SYSTEM:"system"},Ji={[U.ANTHROPIC]:{default:"claude-sonnet-4-6",models:["claude-sonnet-4-6","claude-sonnet-4-20250514","claude-haiku-4-5-20251001","claude-opus-4-6","claude-opus-4-20250514"]},[U.OPENAI]:{default:"gpt-4o",models:["gpt-4o","gpt-4o-mini","gpt-4.1","gpt-4.1-mini","o3-mini"]},[U.GOOGLE]:{default:"gemini-2.0-flash",models:["gemini-2.0-flash","gemini-2.5-pro","gemini-2.5-flash"]}},es={maxTokens:4096,temperature:.7,stream:!0},ts={UNKNOWN:"unknown",UNAUTHENTICATED:"unauthenticated",INVALID_API_KEY:"invalid_api_key",RATE_LIMIT_EXCEEDED:"rate_limit_exceeded",PROVIDER_ERROR:"provider_error",TOKEN_LIMIT_EXCEEDED:"token_limit_exceeded",STREAM_INTERRUPTED:"stream_interrupted"},ns={FAST:{id:"fast",defaultModel:"claude-haiku-4-5-20251001"},STANDARD:{id:"standard",defaultModel:"claude-sonnet-4-6"},PREMIUM:{id:"premium",defaultModel:"claude-opus-4-6"}},rs=4,os={"claude-sonnet-4-6":{promptPer1M:3,completionPer1M:15,currency:"usd"},"claude-haiku-4-5-20251001":{promptPer1M:.8,completionPer1M:4,currency:"usd"},"claude-opus-4-6":{promptPer1M:15,completionPer1M:75,currency:"usd"},"claude-sonnet-4-20250514":{promptPer1M:3,completionPer1M:15,currency:"usd"},"claude-opus-4-20250514":{promptPer1M:15,completionPer1M:75,currency:"usd"},"gpt-4o":{promptPer1M:2.5,completionPer1M:10,currency:"usd"},"gpt-4o-mini":{promptPer1M:.15,completionPer1M:.6,currency:"usd"},"gpt-4.1":{promptPer1M:2,completionPer1M:8,currency:"usd"},"gpt-4.1-mini":{promptPer1M:.4,completionPer1M:1.6,currency:"usd"},"o3-mini":{promptPer1M:1.1,completionPer1M:4.4,currency:"usd"},"gemini-2.0-flash":{promptPer1M:.1,completionPer1M:.4,currency:"usd"},"gemini-2.5-pro":{promptPer1M:1.25,completionPer1M:10,currency:"usd"},"gemini-2.5-flash":{promptPer1M:.15,completionPer1M:.6,currency:"usd"}};import*as p from"valibot";var Et=p.object({role:p.picklist([Se.USER,Se.ASSISTANT,Se.SYSTEM]),content:p.pipe(p.string(),p.minLength(1)),id:p.optional(p.string()),createdAt:p.optional(p.string())}),Ge=p.lazy(()=>p.object({type:p.picklist(["string","number","boolean","array","object"]),description:p.optional(p.string()),enum:p.optional(p.array(p.string())),items:p.optional(Ge),properties:p.optional(p.record(p.string(),Ge)),required:p.optional(p.array(p.string()))})),lr=p.object({description:p.pipe(p.string(),p.minLength(1)),parameters:p.object({type:p.literal("object"),properties:p.record(p.string(),Ge),required:p.optional(p.array(p.string()))})}),ur=p.object({id:p.string(),name:p.string(),args:p.record(p.string(),p.unknown())}),cr=p.object({messages:p.pipe(p.array(Et),p.minLength(1)),provider:p.optional(p.picklist([U.ANTHROPIC,U.OPENAI,U.GOOGLE])),model:p.optional(p.string()),maxTokens:p.optional(p.pipe(p.number(),p.integer(),p.minValue(1))),temperature:p.optional(p.pipe(p.number(),p.minValue(0),p.maxValue(2))),systemPrompt:p.optional(p.string()),stream:p.optional(p.boolean()),tools:p.optional(p.record(p.string(),lr))}),dr=p.object({promptTokens:p.number(),completionTokens:p.number(),totalTokens:p.number()}),pr=p.object({message:Et,usage:p.optional(dr),finishReason:p.optional(p.string()),toolCalls:p.optional(p.array(ur))}),as=p.object({provider:p.picklist([U.ANTHROPIC,U.OPENAI,U.GOOGLE]),model:p.optional(p.string()),maxTokens:p.optional(p.pipe(p.number(),p.integer(),p.minValue(1))),temperature:p.optional(p.pipe(p.number(),p.minValue(0),p.maxValue(2))),systemPrompt:p.optional(p.string())});function ls(e){return p.safeParse(cr,e)}function us(e){return p.safeParse(pr,e)}var xe={ACTIVE:"active",CANCELED:"canceled",INCOMPLETE:"incomplete",INCOMPLETE_EXPIRED:"incomplete_expired",PAST_DUE:"past_due",TRIALING:"trialing",UNPAID:"unpaid"};function mr(e){Object.assign(xe,e)}var Te={tier:"free",status:"active",subscriptionEnd:null,updatedAt:"1970-01-01T00:00:00.000Z",isDefault:!0,subscriptionId:null,customerId:null,cancelAtPeriodEnd:!1};function fr(e){return{...Te,updatedAt:new Date().toISOString()}}var Ye={free:{features:["basic-usage","limited-storage","standard-support"],level:0},pro:{features:["basic-usage","limited-storage","standard-support","cloud-sync","advanced-analytics","priority-support","custom-branding","team-collaboration"],level:1},ai:{features:["basic-usage","limited-storage","standard-support","cloud-sync","advanced-analytics","priority-support","custom-branding","team-collaboration","ai-assistant","custom-models","unlimited-generations","advanced-integrations"],level:2}},D={GUEST:"guest",USER:"user",ADMIN:"admin",SUPER:"super"};function gs(e){Object.assign(D,e)}var gr={FREE:"free",PRO:"pro",PREMIUM:"premium"};function hs(e){Object.assign(gr,e)}var ze={BASIC_ACCESS:"basic_access",ADVANCED_FEATURES:"advanced_features",API_ACCESS:"api_access",PRIORITY_SUPPORT:"priority_support"};function ys(e){Object.assign(ze,e)}var Xe={READ_PUBLIC:"read_public",READ_OWN_DATA:"read_own_data",WRITE_OWN_DATA:"write_own_data",READ_ALL_DATA:"read_all_data",MANAGE_USERS:"manage_users"};function vs(e){Object.assign(Xe,e)}import*as u from"valibot";function ue(e){let[t,...n]=Object.values(e);if(t===void 0)throw new Error("picklistOptions: constant map has no values");return[t,...n]}var St=u.object({id:u.string(),email:u.optional(u.nullable(u.pipe(u.string(),u.email()))),displayName:u.optional(u.nullable(u.string())),photoURL:u.optional(u.nullable(u.pipe(u.string(),u.url()))),emailVerified:u.optional(u.boolean()),lastLoginAt:u.optional(u.string()),providerData:u.optional(u.array(u.object({providerId:u.string(),uid:u.string(),email:u.optional(u.nullable(u.pipe(u.string(),u.email()))),displayName:u.optional(u.nullable(u.string())),photoURL:u.optional(u.nullable(u.pipe(u.string(),u.url()))),phoneNumber:u.optional(u.nullable(u.string()))}))),role:u.optional(u.picklist(ue(D))),customClaims:u.optional(u.record(u.string(),u.any()))}),B=u.object({tier:u.string(),status:u.string(),subscriptionEnd:u.nullable(u.pipe(u.string(),u.isoTimestamp())),updatedAt:u.pipe(u.string(),u.isoTimestamp()),isDefault:u.optional(u.boolean()),features:u.optional(u.array(u.string())),subscriptionId:u.optional(u.nullable(u.string())),customerId:u.optional(u.nullable(u.string())),cancelAtPeriodEnd:u.optional(u.boolean())}),xt=u.object({...B.entries,userId:u.string(),isActive:u.optional(u.boolean())}),Tt=u.object({role:u.optional(u.picklist(ue(D))),subscription:u.optional(B),features:u.optional(u.array(u.picklist(ue(ze)))),permissions:u.optional(u.array(u.picklist(ue(Xe)))),githubAccess:u.optional(u.object({username:u.optional(u.string()),teamAccess:u.optional(u.array(u.string())),repoAccess:u.optional(u.array(u.string()))}))});function Ts(e){return u.safeParse(St,e)}function Rs(e){return u.safeParse(xt,e)}function ks(e){return u.safeParse(Tt,e)}function hr(e){return u.safeParse(B,e)}function As(){let e={authUser:u.safeParse(St,{}),userSubscription:u.safeParse(xt,{}),customClaims:u.safeParse(Tt,{}),getUserAuthStatus:u.safeParse(u.object({userId:u.pipe(u.string(),u.minLength(1))}),{}),getCustomClaims:u.safeParse(u.object({userId:u.pipe(u.string(),u.minLength(1)),claimKeys:u.optional(u.array(u.string()))}),{}),setCustomClaims:u.safeParse(u.object({userId:u.pipe(u.string(),u.minLength(1)),claims:u.record(u.string(),u.any()),merge:u.optional(u.boolean(),!1)}),{}),removeCustomClaims:u.safeParse(u.object({userId:u.pipe(u.string(),u.minLength(1)),claimKeys:u.pipe(u.array(u.string()),u.minLength(1))}),{})};return{success:Object.values(e).every(t=>t.success),results:e}}var Is={VERIFIED:"verified",PENDING:"pending",ERROR:"error"},ws={IDLE:"idle",LOADING:"loading",ERROR:"error",AUTHENTICATED:"authenticated"};function Os(e){return{userId:e,role:"user",preferences:{},metadata:{}}}var Re={PAYMENT:"payment",SUBSCRIPTION:"subscription"};function Ms(e){Object.assign(Re,e)}var Ls={ONE_MONTH:"1month",THREE_MONTHS:"3months",SIX_MONTHS:"6months",ONE_YEAR:"1year",TWO_YEARS:"2years",LIFETIME:"lifetime"};import*as i from"valibot";var Rt=100,yr=i.object({productId:i.pipe(i.string(),i.minLength(1),i.maxLength(200)),quantity:i.pipe(i.number(),i.integer(),i.minValue(1),i.maxValue(1e4))}),Ct=i.pipe(i.object({billingConfigKey:i.optional(i.pipe(i.string(),i.minLength(1))),lineItems:i.optional(i.pipe(i.array(yr),i.minLength(1,"At least one line item is required"),i.maxLength(Rt,`At most ${Rt} line items`))),successUrl:i.pipe(i.string(),i.url()),cancelUrl:i.pipe(i.string(),i.url()),customerEmail:i.optional(i.pipe(i.string(),i.email())),metadata:i.optional(i.record(i.string(),i.string())),allowPromotionCodes:i.optional(i.boolean()),userId:i.optional(i.string()),productId:i.optional(i.string()),priceId:i.optional(i.string()),currency:i.optional(i.pipe(i.string(),i.length(3,"Currency must be 3-letter ISO code"))),userEmail:i.optional(i.pipe(i.string(),i.email())),mode:i.optional(i.picklist([Re.PAYMENT,Re.SUBSCRIPTION]))}),i.rawTransform(({dataset:e,addIssue:t,NEVER:n})=>{let r=e.value,o=r.billingConfigKey||r.metadata?.billingConfigKey;return o?{...r,billingConfigKey:o,lineItems:r.lineItems??[{productId:o,quantity:1}]}:(t({message:"billingConfigKey is required"}),n)})),It=i.object({sessionId:i.string(),sessionUrl:i.nullable(i.pipe(i.string(),i.url()))}),ce=i.pipe(i.string(),i.minLength(1),i.regex(/\S/)),vr=i.object({sessionId:ce,billingConfigKey:ce}),br=i.object({sessionId:ce,orderId:ce,billingConfigKey:ce,sessionStatus:i.picklist(["open","complete","expired"]),paymentStatus:i.picklist(["paid","unpaid","no_payment_required"])});function Ks(e){return i.safeParse(vr,e)}function Gs(e){return i.safeParse(br,e)}var wt=i.object({...B.entries,userId:i.string(),subscriptionId:i.nullable(i.string()),customerId:i.string(),cancelAtPeriodEnd:i.boolean()}),Ot=i.object({id:i.string(),type:i.string(),data:i.object({object:i.any()}),created:i.pipe(i.string(),i.isoTimestamp())}),Pt=i.looseObject({userId:i.optional(i.string()),firebaseUid:i.optional(i.string()),productType:i.optional(i.string())});function Ys(e){return i.safeParse(Ct,e)}function zs(e){return i.safeParse(It,e)}function Xs(e){return i.safeParse(wt,e)}function Qs(e){return i.safeParse(Ot,e)}function Zs(e){return i.safeParse(Pt,e)}var Er=i.object({type:i.literal("StripePayment"),name:i.pipe(i.string(),i.minLength(1,"Product name is required")),description:i.optional(i.string()),price:i.string(),currency:i.optional(i.pipe(i.string(),i.length(3,"Currency must be 3-letter ISO code")),"EUR"),priceId:i.optional(i.pipe(i.string(),i.minLength(1,"Stripe price ID is required"))),tier:i.pipe(i.string(),i.minLength(1,"Tier is required")),duration:i.pipe(i.string(),i.minLength(1,"Duration is required")),allowPromotionCodes:i.optional(i.boolean()),metadata:i.optional(i.record(i.string(),i.string()))}),Sr=i.object({type:i.literal("StripeSubscription"),name:i.pipe(i.string(),i.minLength(1,"Product name is required")),description:i.optional(i.string()),price:i.string(),currency:i.optional(i.pipe(i.string(),i.length(3,"Currency must be 3-letter ISO code")),"EUR"),priceId:i.pipe(i.string(),i.minLength(1,"Stripe price ID is required")),tier:i.pipe(i.string(),i.minLength(1,"Tier is required")),duration:i.picklist(["1month","3months","6months","1year","2years","lifetime"]),allowPromotionCodes:i.optional(i.boolean()),metadata:i.optional(i.record(i.string(),i.string()))}),xr=i.variant("type",[Er,Sr]),Js=i.record(i.string(),xr),Tr=i.record(i.string(),i.object({name:i.string(),price:i.string(),currency:i.string(),description:i.optional(i.string()),features:i.optional(i.array(i.string())),priceId:i.optional(i.string()),allowPromotionCodes:i.optional(i.boolean())})),kt={name:i.string(),price:i.number(),currency:i.string(),priceId:i.optional(i.string()),tier:i.string(),duration:i.string(),description:i.optional(i.string()),metadata:i.optional(i.record(i.string(),i.string())),allowPromotionCodes:i.optional(i.boolean())},Rr=i.variant("mode",[i.object({mode:i.literal("manual"),taxRateIds:i.pipe(i.array(i.pipe(i.string(),i.minLength(1))),i.minLength(1))}),i.object({mode:i.literal("automatic")})]),At=5,kr=i.object({allowedCountries:i.pipe(i.array(i.pipe(i.string(),i.regex(/^[A-Z]{2}$/,"allowedCountries: uppercase ISO 3166-1 alpha-2 code expected (e.g. FR)"))),i.minLength(1)),shippingRateIds:i.optional(i.pipe(i.array(i.pipe(i.string(),i.minLength(1))),i.maxLength(At,`shippingRateIds: at most ${At} (Stripe limit)`)))}),Ar=i.object({type:i.literal("StripeOrder"),name:i.string(),currency:i.pipe(i.string(),i.length(3)),description:i.optional(i.string()),metadata:i.optional(i.record(i.string(),i.string())),allowPromotionCodes:i.optional(i.boolean()),tax:Rr,taxIdCollection:i.picklist(["disabled","optional","required"]),billingAddressCollection:i.picklist(["auto","required"]),shipping:i.optional(kr),customerCreation:i.picklist(["always","if_required"]),invoiceCreation:i.boolean(),paymentMethodConfiguration:i.optional(i.pipe(i.string(),i.minLength(1)))}),Cr=i.record(i.string(),i.variant("type",[i.object({type:i.literal("StripePayment"),...kt}),i.object({type:i.literal("StripeSubscription"),...kt}),Ar]));function ea(e){return i.parse(Tr,e)}function ta(e){return i.parse(Cr,e)}function na(){let e={createCheckoutSessionRequest:i.safeParse(Ct,{}),createCheckoutSessionResponse:i.safeParse(It,{}),subscriptionData:i.safeParse(wt,{}),subscriptionClaims:i.safeParse(B,{}),webhookEvent:i.safeParse(Ot,{}),checkoutSessionMetadata:i.safeParse(Pt,{})};return{success:Object.values(e).every(t=>t.success),results:e}}var ua={VITE:"vite",NEXTJS:"nextjs",EXPO:"expo",REACT_NATIVE:"react-native",UNKNOWN:"unknown"},ca={DEVELOPMENT:"development",PRODUCTION:"production",TEST:"test"},da={CLIENT:"client",SERVER:"server",BUILD:"build"},pa={HIGH:.95,MEDIUM:.8,LOW:.7,MINIMUM:.3},ma={INITIALIZING:"initializing",READY:"ready",DEGRADED:"degraded",ERROR:"error"},fa={LOCAL:"localStorage",SESSION:"sessionStorage",INDEXED_DB:"indexedDB",MEMORY:"memory"},ga={USER:"user",GLOBAL:"global",SESSION:"session"},ha={STANDALONE:"standalone",FULLSCREEN:"fullscreen",MINIMAL_UI:"minimal-ui",BROWSER:"browser"},ya={MANIFEST:"manifest",SERVICE_WORKER:"service-worker",ICON:"icon"},va={AUTO:"auto-discovery",MANUAL:"manual",HYBRID:"hybrid"};var Ea={GUEST:"guest",USER:"user",ADMIN:"admin",SUPER:"super",TECHNICAL:"technical",HIDDEN:"hidden",OWNER:"owner"},q={TRUE:!0,FALSE:!1,USER:"user",ADMIN:"admin",SUPER:"super",CREATE_ONLY:"create-only",GENERATED:"generated",COMPUTED:"computed"},Qe={create:"admin",read:"guest",update:"admin",delete:"admin"},V={draft:{read:"admin",saveIncomplete:!0,holdIncomplete:!0,isDefault:!1,isRemoved:!1},available:{read:"guest",saveIncomplete:!1,holdIncomplete:!1,isDefault:!0,isRemoved:!1},deleted:{read:"admin",saveIncomplete:!1,holdIncomplete:!0,isDefault:!1,isRemoved:!0}},Dt=V.available,J=Object.keys(V);function Ft(e){let t=J.filter(n=>V[n][e]);if(t.length!==1)throw new Error(`[dndev] STATUS_MATRIX: exactly one status must have ${e}`);return t[0]}var ke=Ft("isDefault"),Ze=Ft("isRemoved"),Ir=J.filter(e=>V[e].read!=="guest"),de=["id","createdAt","updatedAt","createdById","updatedById"],K={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">=",IN:"in",NOT_IN:"not-in",ARRAY_CONTAINS:"array-contains",ARRAY_CONTAINS_ANY:"array-contains-any"},Sa={ASC:"asc",DESC:"desc"},xa={LIST:"list",LIST_CARD:"listCard"},Nt=["address","array","avatar","badge","boolean","checkbox","color","combobox","date","datetime-local","document","documents","duration","email","field-array","file","files","gdprConsent","geopoint","hidden","iban","image","images","map","month","multiselect","number","currency","price","password","radio","reference","range","rating","reset","richtext","select","submit","switch","tel","text","textarea","time","timestamp","url","week","year"];var ka={COUNT:"count",SUM:"sum",AVG:"avg",MIN:"min",MAX:"max"},Aa={EQ:K.EQ,NEQ:K.NEQ,LT:K.LT,LTE:K.LTE,GT:K.GT,GTE:K.GTE};var _t=class extends Error{constructor(n,r,o){super(n,{cause:o});k(this,"outcome");this.name="AtomicBulkError",this.outcome=r}},Ut=class extends Error{constructor(n,r){super(`BulkCollisionError: ${n.length} id(s) appear in both "${r.replace("-",'" and "')}" \u2014 ${n.join(", ")}`);k(this,"collidingIds");k(this,"where");this.name="BulkCollisionError",this.collidingIds=n,this.where=r}},Mt=class extends Error{constructor(n){super(`[dndev] bulkAcross: circular dependency: ${n.join(" \u2192 ")}`);k(this,"cycle");this.name="BulkAcrossCycleError",this.cycle=n}},Lt=class extends Error{constructor(n){super(`BulkNotImplementedError: adapter "${n}" has not implemented bulk() yet`);k(this,"adapterName");this.name="BulkNotImplementedError",this.adapterName=n}};import*as h from"valibot";var Na=h.object({collection:h.pipe(h.string(),h.minLength(1,"Collection name is required")),data:h.record(h.string(),h.unknown()),idempotencyKey:h.optional(h.string())}),_a=h.object({collection:h.pipe(h.string(),h.minLength(1,"Collection name is required")),id:h.pipe(h.string(),h.minLength(1,"Entity ID is required"))}),Ua=h.object({collection:h.pipe(h.string(),h.minLength(1,"Collection name is required")),id:h.pipe(h.string(),h.minLength(1,"Entity ID is required")),data:h.record(h.string(),h.unknown()),merge:h.optional(h.boolean(),!1)}),Ma=h.object({collection:h.pipe(h.string(),h.minLength(1,"Collection name is required")),id:h.pipe(h.string(),h.minLength(1,"Entity ID is required"))}),La=h.object({collection:h.pipe(h.string(),h.minLength(1,"Collection name is required")),limit:h.optional(h.pipe(h.number(),h.minValue(1),h.maxValue(1e3)),1e3),offset:h.optional(h.pipe(h.number(),h.minValue(0)),0),orderBy:h.optional(h.string()),orderDirection:h.optional(h.picklist(["asc","desc"]),"desc"),where:h.optional(h.array(h.object({field:h.string(),operator:h.picklist(["==","!=","<","<=",">",">=","array-contains","in","not-in"]),value:h.unknown()})))});var Xa={RESEND:"resend"},Qa={UNKNOWN:"unknown",UNAUTHENTICATED:"unauthenticated",INVALID_REQUEST:"invalid_request",PROVIDER_ERROR:"provider_error",TEMPLATE_NOT_FOUND:"template_not_found",RATE_LIMIT_EXCEEDED:"rate_limit_exceeded",MISSING_API_KEY:"missing_api_key"};import*as S from"valibot";var wr=S.object({templateId:S.pipe(S.string(),S.minLength(1)),to:S.pipe(S.string(),S.email()),data:S.record(S.string(),S.unknown()),locale:S.optional(S.pipe(S.string(),S.minLength(2),S.maxLength(5)),"fr"),from:S.optional(S.string()),replyTo:S.optional(S.string())}),Or=S.object({success:S.boolean(),messageId:S.optional(S.string()),error:S.optional(S.string())});function Ja(e){return S.safeParse(wr,e)}function el(e){return S.safeParse(Or,e)}var pe={ALREADY_EXISTS:"already-exists",CANCELLED:"cancelled",DEADLINE_EXCEEDED:"deadline-exceeded",DELETE_ACCOUNT_REQUIRES_SERVER:"DELETE_ACCOUNT_REQUIRES_SERVER",INTERNAL:"internal",INVALID_ARGUMENT:"invalid-argument",NOT_FOUND:"not-found",PERMISSION_DENIED:"permission-denied",RATE_LIMIT_EXCEEDED:"rate-limit-exceeded",TIMEOUT:"timeout",UNAUTHENTICATED:"unauthenticated",UNAVAILABLE:"unavailable",UNIMPLEMENTED:"unimplemented",UNKNOWN:"unknown",VALIDATION_FAILED:"validation-failed"},sl={ERROR:"error",WARNING:"warning",INFO:"info",SUCCESS:"success"},Ae={INTERNAL_ERROR:"INTERNAL_ERROR",VALIDATION_ERROR:"VALIDATION_ERROR",PERMISSION_DENIED:"PERMISSION_DENIED",NOT_FOUND:"NOT_FOUND",ALREADY_EXISTS:"ALREADY_EXISTS",NETWORK_ERROR:"NETWORK_ERROR"},Je={[pe.PERMISSION_DENIED]:{type:Ae.PERMISSION_DENIED,message:"You do not have permission to perform this action"},[pe.NOT_FOUND]:{type:Ae.NOT_FOUND,message:"The requested resource was not found"},[pe.ALREADY_EXISTS]:{type:Ae.ALREADY_EXISTS,message:"The resource already exists"},[pe.INVALID_ARGUMENT]:{type:Ae.VALIDATION_ERROR,message:"Invalid argument provided"}},Bt=class extends Error{constructor(n,r,o){super(r);k(this,"type");k(this,"originalError");this.name="EntityHookError",this.type=n,this.originalError=o}},al={AUTH:"auth",OAUTH:"oauth",FIREBASE:"firebase",API:"api",VALIDATION:"validation",ENTITY:"entity",UI:"ui",UNKNOWN:"unknown"};function Pr(e){return"captureStackTrace"in e&&typeof e.captureStackTrace=="function"}var R=class e extends Error{constructor(n,r=pe.INTERNAL,o){super(n);k(this,"code");k(this,"details");k(this,"source");k(this,"originalError");k(this,"context");k(this,"displayable");k(this,"userMessageProvided");Object.setPrototypeOf(this,e.prototype),this.code=r,this.details=o?.details,this.source=o?.source,this.originalError=o?.originalError,this.context=o?.context,this.displayable=o?.displayable??!0,this.userMessageProvided=o?.userMessageProvided,this.name=this.constructor.name,Pr(Error)&&Error.captureStackTrace(this,this.constructor)}toString(){return`${this.name} [${this.code}]: ${this.message}`}toJSON(){return{name:this.name,code:this.code,message:this.message,details:this.details,source:this.source,originalError:this.originalError,context:this.context,displayable:this.displayable,userMessageProvided:this.userMessageProvided}}};var pl={AUTH_STATE_CHANGED:"auth.state.changed",USER_SIGNED_IN:"auth.user.signed_in",USER_SIGNED_OUT:"auth.user.signed_out",USER_UPDATED:"auth.user.updated",TOKEN_REFRESHED:"auth.token.refreshed",SUBSCRIPTION_UPDATED:"auth.subscription.updated",SUBSCRIPTION_CHANGED:"auth.subscription.changed",SUBSCRIPTION_CANCELLED:"auth.subscription.cancelled",SUBSCRIPTION_EXPIRED:"auth.subscription.expired",PERMISSIONS_UPDATED:"auth.permissions.updated",ACCOUNT_LINKED:"auth.account.linked",ACCOUNT_UNLINKED:"auth.account.unlinked",ACCOUNT_LINKING_REQUIRED:"auth.account.linking_required",AUTH_SUCCESS:"auth.success",EMAIL_VERIFICATION_SENT:"auth.email.verification_sent",PASSWORD_RESET_SENT:"auth.password.reset_sent",AUTH_ERROR:"auth.error"};var fl={BILLING_INITIALIZED:"billing.initialized",BILLING_ERROR:"billing.error",CHECKOUT_SESSION_CREATED:"billing.checkout_session.created",CHECKOUT_SESSION_FAILED:"billing.checkout_session.failed",SUBSCRIPTION_CREATED:"billing.subscription.created",SUBSCRIPTION_UPDATED:"billing.subscription.updated",SUBSCRIPTION_CANCELLED:"billing.subscription.cancelled",SUBSCRIPTION_RENEWED:"billing.subscription.renewed",SUBSCRIPTION_EXPIRED:"billing.subscription.expired",SUBSCRIPTION_TRIAL_ENDED:"billing.subscription.trial_ended",PAYMENT_SUCCEEDED:"billing.payment.succeeded",PAYMENT_FAILED:"billing.payment.failed",PAYMENT_REFUNDED:"billing.payment.refunded",PAYMENT_METHOD_ADDED:"billing.payment_method.added",PAYMENT_METHOD_UPDATED:"billing.payment_method.updated",PAYMENT_METHOD_REMOVED:"billing.payment_method.removed",PAYMENT_METHOD_DEFAULT_CHANGED:"billing.payment_method.default_changed",INVOICE_CREATED:"billing.invoice.created",INVOICE_UPDATED:"billing.invoice.updated",INVOICE_PAID:"billing.invoice.paid",INVOICE_FAILED:"billing.invoice.failed",WEBHOOK_RECEIVED:"billing.webhook.received",WEBHOOK_PROCESSED:"billing.webhook.processed",WEBHOOK_ERROR:"billing.webhook.error"};var hl={OAUTH_STARTED:"oauth.started",OAUTH_SUCCESS:"oauth.success",OAUTH_ERROR:"oauth.error",OAUTH_CANCELLED:"oauth.cancelled",OAUTH_TOKEN_EXCHANGED:"oauth.token.exchanged",OAUTH_TOKEN_REFRESHED:"oauth.token.refreshed",OAUTH_PARTNER_LINKED:"oauth.partner.linked",OAUTH_PARTNER_UNLINKED:"oauth.partner.unlinked"};var vl={DOCUMENT_CREATED:"payload.document.created",DOCUMENT_UPDATED:"payload.document.updated",DOCUMENT_DELETED:"payload.document.deleted",MEDIA_CREATED:"payload.media.created",MEDIA_UPDATED:"payload.media.updated",MEDIA_DELETED:"payload.media.deleted",GLOBAL_UPDATED:"payload.global.updated",USER_CREATED:"payload.user.created",USER_UPDATED:"payload.user.updated",USER_DELETED:"payload.user.deleted",CACHE_INVALIDATED:"payload.cache.invalidated",PAGE_REGENERATED:"payload.page.regenerated"};var El={PAYMENT_INTENT_SUCCEEDED:"stripe.payment_intent.succeeded",PAYMENT_INTENT_FAILED:"stripe.payment_intent.payment_failed",CHECKOUT_SESSION_COMPLETED:"stripe.checkout.session.completed",CUSTOMER_CREATED:"stripe.customer.created",CUSTOMER_UPDATED:"stripe.customer.updated",CUSTOMER_DELETED:"stripe.customer.deleted",INVOICE_CREATED:"stripe.invoice.created",INVOICE_PAID:"stripe.invoice.paid",INVOICE_PAYMENT_FAILED:"stripe.invoice.payment_failed",SUBSCRIPTION_CREATED:"stripe.subscription.created",SUBSCRIPTION_UPDATED:"stripe.subscription.updated",SUBSCRIPTION_DELETED:"stripe.subscription.deleted"};import"valibot";var et={mobile:0,tablet:768,laptop:1024,desktop:1440},Dr={mobile:{min:0,max:767},tablet:{min:768,max:1023},laptop:{min:1024,max:1439},desktop:{min:1440,max:1/0}};function Fr(e){return e>=et.desktop?"desktop":e>=et.laptop?"laptop":e>=et.tablet?"tablet":"mobile"}function Fl(e,t){let n=Dr[t];return e>=n.min&&e<=n.max}function Nl(e,t){let n=Fr(e);return{current:n,width:e,height:t,isMobile:n==="mobile",isTablet:n==="tablet",isLaptop:n==="laptop",isDesktop:n==="desktop",isMobileOrTablet:n==="mobile"||n==="tablet",isLaptopOrDesktop:n==="laptop"||n==="desktop"}}var Nr="landing",_r="/og-image.png",Ur={FIXED:"fixed",SCROLL:"scroll"},Mr={ADMIN:"admin",BLOG:"blog",DOCS:"docs",GAME:"game",LANDING:"landing",MOOLTI:"moolti",PLAIN:"plain"};var Vt=["pull","push","admin","maintain","triage"];import"valibot";import*as g from"valibot";var tt=g.object({owner:g.pipe(g.string(),g.minLength(1,"Repository owner is required")),repo:g.pipe(g.string(),g.minLength(1,"Repository name is required"))}),Lr=g.picklist([...Vt]),Gl=g.object({userId:g.pipe(g.string(),g.minLength(1,"User ID is required")),githubUsername:g.pipe(g.string(),g.minLength(1,"GitHub username is required")),repoConfig:tt,permission:g.optional(Lr,"push"),customClaims:g.optional(g.record(g.string(),g.any()))}),Yl=g.object({userId:g.pipe(g.string(),g.minLength(1,"User ID is required")),githubUsername:g.pipe(g.string(),g.minLength(1,"GitHub username is required")),repoConfig:tt}),zl=g.object({userId:g.pipe(g.string(),g.minLength(1,"User ID is required")),githubUsername:g.pipe(g.string(),g.minLength(1,"GitHub username is required")),repoConfig:tt}),Xl=g.object({provider:g.string(),purpose:g.picklist(["authentication","api-access"]),code:g.pipe(g.string(),g.minLength(1,"Authorization code is required")),redirectUri:g.pipe(g.string(),g.url("Valid redirect URI is required")),codeVerifier:g.optional(g.string()),state:g.optional(g.string()),instance:g.optional(g.pipe(g.string(),g.url()))}),Ql=g.object({provider:g.string(),refreshToken:g.pipe(g.string(),g.minLength(1,"Refresh token is required")),redirectUri:g.pipe(g.string(),g.url("Valid redirect URI is required"))}),Zl=g.object({provider:g.string()}),Jl=g.object({userId:g.pipe(g.string(),g.minLength(1,"User ID is required"))});var iu={apple:"apple",discord:"discord",emailLink:"emailLink",facebook:"facebook",github:"github",google:"google",linkedin:"linkedin",microsoft:"microsoft",password:"password",reddit:"reddit",spotify:"spotify",twitch:"twitch",twitter:"twitter",yahoo:"yahoo",notion:"notion",slack:"slack",medium:"medium",mastodon:"mastodon",youtube:"youtube"};import*as v from"valibot";var $t=v.object({name:v.string(),color:v.string(),icon:v.string(),customParameters:v.optional(v.record(v.string(),v.string())),button:v.object({backgroundColor:v.string(),textColor:v.string(),borderColor:v.string(),hoverBackgroundColor:v.string(),focusOutlineColor:v.string(),fontWeight:v.optional(v.string(),"500"),textKey:v.optional(v.string())})}),Br=v.object({...$t.entries,type:v.picklist(["auth","both"]),scopes:v.optional(v.array(v.string())),firebaseProviderId:v.optional(v.string())}),Ce=v.union([v.literal(""),v.pipe(v.string(),v.url())]),Vr=v.object({authUrl:Ce,tokenUrl:Ce,profileUrl:Ce,revokeUrl:v.optional(Ce)}),$r=v.object({authentication:v.optional(v.array(v.string())),"api-access":v.array(v.string())}),jr=v.optional(v.object({pkce:v.optional(v.boolean(),!1),codeChallengeMethod:v.optional(v.picklist(["S256","plain"]),"S256")})),qr=v.object({...$t.entries,type:v.picklist(["oauth","both"]),scopes:$r,endpoints:Vr,capabilities:jr}),jt={apple:{name:"Apple",color:"#000000",icon:"apple",type:"both",scopes:["email","name"],firebaseProviderId:"apple.com",customParameters:{prompt:"login"},button:{backgroundColor:"#000000",textColor:"#ffffff",borderColor:"#000000",hoverBackgroundColor:"#1a1a1a",focusOutlineColor:"#333333",fontWeight:"500",textKey:"buttons.apple"}},discord:{name:"Discord",color:"#5865F2",icon:"discord",type:"both",scopes:["identify","email"],firebaseProviderId:"discord.com",customParameters:{prompt:"consent"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.discord"}},emailLink:{name:"Email Link",color:"#10B981",icon:"emailLink",type:"auth",scopes:[],firebaseProviderId:"emailLink",customParameters:{},button:{backgroundColor:"#10B981",textColor:"#ffffff",borderColor:"#10B981",hoverBackgroundColor:"#059669",focusOutlineColor:"#059669",fontWeight:"500",textKey:"buttons.emailLink"}},facebook:{name:"Facebook",color:"#1877F2",icon:"facebook",type:"both",scopes:["email","public_profile"],firebaseProviderId:"facebook.com",customParameters:{auth_type:"reauthenticate"},button:{backgroundColor:"#1877F2",textColor:"#ffffff",borderColor:"#1877F2",hoverBackgroundColor:"#166FE5",focusOutlineColor:"#166FE5",fontWeight:"600",textKey:"buttons.facebook"}},github:{name:"GitHub",color:"#24292E",icon:"github",type:"both",scopes:["read:user","user:email"],firebaseProviderId:"github.com",customParameters:{allow_signup:"true"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.github"}},google:{name:"Google",color:"#4285F4",icon:"google",type:"both",scopes:["email","profile"],firebaseProviderId:"google.com",customParameters:{prompt:"select_account"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.google"}},linkedin:{name:"LinkedIn",color:"#0077B5",icon:"linkedin",type:"both",scopes:["r_liteprofile","r_emailaddress"],firebaseProviderId:"linkedin.com",customParameters:{prompt:"consent"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.linkedin"}},microsoft:{name:"Microsoft",color:"#00A4EF",icon:"microsoft",type:"both",scopes:["openid","email","profile"],firebaseProviderId:"microsoft.com",customParameters:{prompt:"select_account"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.microsoft"}},password:{name:"Email & Password",color:"#6B7280",icon:"password",type:"auth",scopes:[],firebaseProviderId:"password",customParameters:{},button:{backgroundColor:"#ffffff",textColor:"#374151",borderColor:"#D1D5DB",hoverBackgroundColor:"#F9FAFB",focusOutlineColor:"#3B82F6",fontWeight:"500",textKey:"buttons.password"}},reddit:{name:"Reddit",color:"#FF4500",icon:"reddit",type:"both",scopes:["identity"],firebaseProviderId:"reddit.com",customParameters:{duration:"permanent"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.reddit"}},spotify:{name:"Spotify",color:"#1DB954",icon:"spotify",type:"both",scopes:["user-read-email","user-read-private"],firebaseProviderId:"spotify.com",customParameters:{show_dialog:"true"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.spotify"}},twitch:{name:"Twitch",color:"#9146FF",icon:"twitch",type:"both",scopes:["user:read:email"],firebaseProviderId:"twitch.tv",customParameters:{force_verify:"true"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.twitch"}},twitter:{name:"X",color:"#000000",icon:"twitter",type:"both",scopes:[],firebaseProviderId:"twitter.com",customParameters:{force_login:"true"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.twitter"}},yahoo:{name:"Yahoo",color:"#5F01D1",icon:"yahoo",type:"both",scopes:["openid","email","profile"],firebaseProviderId:"yahoo.com",customParameters:{prompt:"select_account"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500",textKey:"buttons.yahoo"}}},qt={google:{name:"Google",color:"#4285F4",icon:"google",type:"both",scopes:{authentication:["openid","profile","email"],"api-access":["https://www.googleapis.com/auth/drive.readonly","https://www.googleapis.com/auth/userinfo.profile","https://www.googleapis.com/auth/calendar.readonly","https://www.googleapis.com/auth/gmail.readonly"]},endpoints:{authUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",profileUrl:"https://www.googleapis.com/oauth2/v3/userinfo",revokeUrl:"https://oauth2.googleapis.com/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},github:{name:"GitHub",color:"#24292E",icon:"github",type:"both",scopes:{authentication:["read:user","user:email"],"api-access":["repo","user","read:org","gist","notifications"]},endpoints:{authUrl:"https://github.com/login/oauth/authorize",tokenUrl:"https://github.com/login/oauth/access_token",profileUrl:"https://api.github.com/user",revokeUrl:"https://api.github.com/applications/CLIENT_ID/token"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},discord:{name:"Discord",color:"#5865F2",icon:"discord",type:"both",scopes:{authentication:["identify","email"],"api-access":["guilds","guilds.members.read","bot","messages.read"]},endpoints:{authUrl:"https://discord.com/api/oauth2/authorize",tokenUrl:"https://discord.com/api/oauth2/token",profileUrl:"https://discord.com/api/users/@me",revokeUrl:"https://discord.com/api/oauth2/token/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},spotify:{name:"Spotify",color:"#1DB954",icon:"spotify",type:"both",scopes:{authentication:["user-read-email","user-read-private"],"api-access":["user-read-playback-state","user-modify-playback-state","user-read-currently-playing","playlist-read-private","playlist-modify-public","user-library-read"]},endpoints:{authUrl:"https://accounts.spotify.com/authorize",tokenUrl:"https://accounts.spotify.com/api/token",profileUrl:"https://api.spotify.com/v1/me",revokeUrl:"https://accounts.spotify.com/api/token"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},twitch:{name:"Twitch",color:"#9146FF",icon:"twitch",type:"both",scopes:{authentication:["user:read:email"],"api-access":["channel:read:subscriptions","bits:read","channel:manage:broadcast","channel:read:stream_key","user:read:follows"]},endpoints:{authUrl:"https://id.twitch.tv/oauth2/authorize",tokenUrl:"https://id.twitch.tv/oauth2/token",profileUrl:"https://api.twitch.tv/helix/users",revokeUrl:"https://id.twitch.tv/oauth2/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},reddit:{name:"Reddit",color:"#FF4500",icon:"reddit",type:"both",scopes:{authentication:["identity"],"api-access":["read","submit","vote","mysubreddits","subscribe"]},endpoints:{authUrl:"https://www.reddit.com/api/v1/authorize",tokenUrl:"https://www.reddit.com/api/v1/access_token",profileUrl:"https://oauth.reddit.com/api/v1/me",revokeUrl:"https://www.reddit.com/api/v1/revoke_token"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},linkedin:{name:"LinkedIn",color:"#0077B5",icon:"linkedin",type:"oauth",scopes:{"api-access":["r_liteprofile","r_emailaddress","w_member_social","r_organization_social"]},endpoints:{authUrl:"https://www.linkedin.com/oauth/v2/authorization",tokenUrl:"https://www.linkedin.com/oauth/v2/accessToken",profileUrl:"https://api.linkedin.com/v2/me",revokeUrl:"https://www.linkedin.com/oauth/v2/revoke"},capabilities:{pkce:!1},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},slack:{name:"Slack",color:"#E01E5A",icon:"slack",type:"oauth",scopes:{"api-access":["channels:read","chat:write","users:read","files:read","im:read"]},endpoints:{authUrl:"https://slack.com/oauth/v2/authorize",tokenUrl:"https://slack.com/api/oauth.v2.access",profileUrl:"https://slack.com/api/users.identity",revokeUrl:"https://slack.com/api/auth.revoke"},capabilities:{pkce:!1},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},notion:{name:"Notion",color:"#000000",icon:"notion",type:"oauth",scopes:{"api-access":["read","write"]},endpoints:{authUrl:"https://api.notion.com/v1/oauth/authorize",tokenUrl:"https://api.notion.com/v1/oauth/token",profileUrl:"https://api.notion.com/v1/users/me",revokeUrl:"https://api.notion.com/v1/oauth/revoke"},capabilities:{pkce:!1},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},medium:{name:"Medium",color:"#000000",icon:"medium",type:"oauth",scopes:{"api-access":["basicProfile","publishPost","listPublications"]},endpoints:{authUrl:"https://medium.com/m/oauth/authorize",tokenUrl:"https://medium.com/v1/tokens",profileUrl:"https://medium.com/v1/me",revokeUrl:"https://medium.com/v1/tokens/revoke"},capabilities:{pkce:!1},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},twitter:{name:"X",color:"#000000",icon:"twitter",type:"oauth",scopes:{"api-access":["tweet.read","users.read","follows.read","tweet.write","like.write"]},endpoints:{authUrl:"https://twitter.com/i/oauth2/authorize",tokenUrl:"https://api.twitter.com/2/oauth2/token",profileUrl:"https://api.twitter.com/2/users/me",revokeUrl:"https://api.twitter.com/2/oauth2/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},mastodon:{name:"Mastodon",color:"#6364FF",icon:"mastodon",type:"oauth",scopes:{"api-access":["read","write","follow","push"]},endpoints:{authUrl:"",tokenUrl:"",profileUrl:"",revokeUrl:""},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},youtube:{name:"YouTube",color:"#FF0000",icon:"youtube",type:"oauth",scopes:{"api-access":["https://www.googleapis.com/auth/youtube.readonly","https://www.googleapis.com/auth/youtube.upload","https://www.googleapis.com/auth/youtube.force-ssl"]},endpoints:{authUrl:"https://accounts.google.com/o/oauth2/v2/auth",tokenUrl:"https://oauth2.googleapis.com/token",profileUrl:"https://www.googleapis.com/youtube/v3/channels",revokeUrl:"https://oauth2.googleapis.com/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}},supabase:{name:"Supabase",color:"#3ECF8E",icon:"supabase",type:"oauth",scopes:{"api-access":["auth:read","auth:write","database:read","database:write","domains:read","domains:write","edge_functions:read","edge_functions:write","environment:read","environment:write","organizations:read","projects:read","projects:write","rest:read","rest:write","secrets:read","secrets:write","storage:read"]},endpoints:{authUrl:"https://api.supabase.com/v1/oauth/authorize",tokenUrl:"https://api.supabase.com/v1/oauth/token",profileUrl:"",revokeUrl:""},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#F1F3F5",textColor:"#11181C",borderColor:"#E6E8EB",hoverBackgroundColor:"#E6E8EB",focusOutlineColor:"#3ECF8E",fontWeight:"500"}},vercel:{name:"Vercel",color:"#000000",icon:"vercel",type:"oauth",scopes:{authentication:["openid","email","profile","offline_access"],"api-access":["project","project-env-vars","deployment","team","user"]},endpoints:{authUrl:"https://vercel.com/oauth/authorize",tokenUrl:"https://api.vercel.com/login/oauth/token",profileUrl:"https://api.vercel.com/login/oauth/userinfo",revokeUrl:"https://api.vercel.com/login/oauth/token/revoke"},capabilities:{pkce:!0,codeChallengeMethod:"S256"},button:{backgroundColor:"#ffffff",textColor:"#000000",borderColor:"#d1d5db",hoverBackgroundColor:"#f9fafb",focusOutlineColor:"#3b82f6",fontWeight:"500"}}},Wr=v.record(v.string(),Br),Hr=v.record(v.string(),qr);function au(){return v.safeParse(Wr,jt)}function lu(){return v.safeParse(Hr,qt)}function uu(e){return e in jt}function cu(e){return e in qt}var Wt={NECESSARY:"necessary",FUNCTIONAL:"functional",ANALYTICS:"analytics",MARKETING:"marketing"},Eu={COMPACT:"compact",STANDARD:"standard",EXPRESSIVE:"expressive"},Su={auth:{requiresConsent:null},oauth:{requiresConsent:null},billing:{requiresConsent:null},analytics:{requiresConsent:Wt.ANALYTICS},marketing:{requiresConsent:Wt.MARKETING}};function Qu(e,t){return Object.assign(e,{metadata:t})}import*as ie from"valibot";import*as c from"valibot";function Ht(e){return e instanceof Error&&"source"in e&&typeof e.source=="string"?e.source:typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&e.code.startsWith("auth/")?"auth":typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&e.code.startsWith("oauth/")?"oauth":typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&["permission-denied","unavailable","not-found","already-exists","unauthenticated","invalid-argument","failed-precondition","resource-exhausted"].includes(e.code)?"firebase":typeof e=="object"&&e!==null&&"issues"in e&&Array.isArray(e.issues)&&"name"in e&&e.name==="ValiError"?"validation":e instanceof Error&&e.name==="EntityHookError"?"entity":typeof e=="object"&&e!==null&&("response"in e||"status"in e||"statusText"in e)?"api":typeof e=="object"&&e!==null&&"componentStack"in e?"ui":"unknown"}import*as Gt from"valibot";function $(e){return(t,n)=>{if(t instanceof R)return t;if(typeof t!="object"||t===null){let l=typeof t=="string"?t:e.defaultErrorMessage;return new R(n||l,e.defaultErrorCode,{details:{originalError:t},source:e.errorSource})}let r;e.extractErrorCode?r=e.extractErrorCode(t):"code"in t&&typeof t.code=="string"&&(r=t.code);let o=e.defaultErrorCode;r&&e.errorCodeMapping&&r in e.errorCodeMapping&&(o=e.errorCodeMapping[r]);let s;e.extractErrorMessage?s=e.extractErrorMessage(t):("message"in t&&typeof t.message=="string"||t instanceof Error)&&(s=t.message),r&&e.friendlyMessageMapping&&r in e.friendlyMessageMapping&&(s=e.friendlyMessageMapping[r]),s||(s=e.defaultErrorMessage);let a;return e.processMetadata?a=e.processMetadata(t):(a={originalError:t},r&&(a.originalCode=r)),"originalError"in a||(a.originalError=t),new R(n||s,o,{details:a,source:e.errorSource})}}var Ie={"permission-denied":"permission-denied",unavailable:"unavailable","not-found":"not-found","already-exists":"already-exists",unauthenticated:"unauthenticated","invalid-argument":"invalid-argument","failed-precondition":"invalid-argument","resource-exhausted":"rate-limit-exceeded","deadline-exceeded":"timeout",cancelled:"cancelled","not-implemented":"unimplemented"};var ee={"already-exists":"The resource already exists.",cancelled:"The operation was cancelled.","deadline-exceeded":"The operation timed out.",DELETE_ACCOUNT_REQUIRES_SERVER:"Account deletion requires a server endpoint. Configure a callable provider or deploy a delete-account Edge Function.",internal:"An internal error occurred.","invalid-argument":"Invalid argument provided.","not-found":"The requested resource was not found.","permission-denied":"You do not have permission to perform this action.","rate-limit-exceeded":"Too many requests. Please try again later.",timeout:"The operation timed out.",unauthenticated:"Authentication is required for this action.",unavailable:"The service is currently unavailable.",unimplemented:"This feature is not implemented.",unknown:"An unknown error occurred.","validation-failed":"Validation failed."},Kr={400:"invalid-argument",401:"unauthenticated",403:"permission-denied",404:"not-found",409:"already-exists",422:"validation-failed",429:"rate-limit-exceeded",500:"internal",501:"unimplemented",502:"unavailable",503:"unavailable",504:"timeout"},nt={INTERNAL_ERROR:"internal",VALIDATION_ERROR:"validation-failed",PERMISSION_DENIED:"permission-denied",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",NETWORK_ERROR:"unavailable"};function Gr(e){return e in nt}var W={auth:{errorSource:"auth",defaultErrorCode:"unknown",defaultErrorMessage:"An authentication error occurred",errorCodeMapping:{"auth/user-not-found":"not-found","auth/wrong-password":"invalid-argument","auth/email-already-in-use":"already-exists","auth/weak-password":"validation-failed","auth/invalid-email":"validation-failed","auth/account-exists-with-different-credential":"already-exists","auth/credential-already-in-use":"already-exists","auth/requires-recent-login":"unauthenticated","auth/user-disabled":"permission-denied","auth/too-many-requests":"rate-limit-exceeded","auth/network-request-failed":"unavailable","auth/popup-blocked":"unavailable","auth/popup-closed-by-user":"invalid-argument","auth/cancelled-popup-request":"invalid-argument","auth/operation-not-allowed":"unimplemented","auth/invalid-credential":"invalid-argument","auth/invalid-verification-code":"invalid-argument","auth/captcha-check-failed":"validation-failed","auth/invalid-phone-number":"validation-failed","auth/missing-phone-number":"invalid-argument","auth/quota-exceeded":"rate-limit-exceeded","auth/timeout":"unavailable","auth/web-storage-unsupported":"unavailable","auth/unauthorized-domain":"permission-denied","auth/internal-error":"internal","auth/invalid-action-code":"invalid-argument","auth/invalid-continue-uri":"invalid-argument","auth/missing-continue-uri":"invalid-argument","auth/missing-ios-bundle-id":"invalid-argument","auth/missing-android-pkg-name":"invalid-argument","auth/unauthorized-continue-uri":"permission-denied","auth/invalid-dynamic-link-domain":"invalid-argument","auth/invalid-tenant-id":"invalid-argument","auth/tenant-id-mismatch":"invalid-argument","auth/provider-already-linked":"already-exists","auth/invalid-persistence-type":"invalid-argument","auth/unsupported-persistence-type":"unimplemented","auth/invalid-provider":"invalid-argument","auth/invalid-client-id":"invalid-argument","oauth/unauthorized-app":"permission-denied","auth/provider-not-enabled":"unimplemented","auth/unknown-provider":"invalid-argument","auth/missing-provider":"invalid-argument","auth/no-user-signed-in":"unauthenticated",DELETE_ACCOUNT_REQUIRES_SERVER:"DELETE_ACCOUNT_REQUIRES_SERVER",...Ie},friendlyMessageMapping:{"auth/user-not-found":"No account found with this email address.","auth/wrong-password":"Incorrect password. Please try again.","auth/email-already-in-use":"An account with this email already exists.","auth/weak-password":"Password is too weak. It should be at least 6 characters.","auth/invalid-email":"Please enter a valid email address.","auth/account-exists-with-different-credential":"An account already exists with the same email but different sign-in method.","auth/credential-already-in-use":"This credential is already associated with a different user account.","auth/requires-recent-login":"This operation requires you to sign in again for security reasons.","auth/user-disabled":"This account has been disabled.","auth/too-many-requests":"Too many sign-in attempts. Please try again later.","auth/network-request-failed":"Network connection error. Please check your internet connection.","auth/popup-blocked":"Sign-in popup was blocked. Please allow popups for this site.","auth/popup-closed-by-user":"Sign-in popup was closed before completion.","auth/operation-not-allowed":"This sign-in method is not enabled for this project.","auth/internal-error":"An internal authentication error occurred. Please try again.","auth/invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","auth/invalid-continue-uri":"The continue URL provided is invalid.","auth/missing-continue-uri":"A continue URL must be provided in the request.","auth/missing-ios-bundle-id":"An iOS Bundle ID must be provided in the request.","auth/missing-android-pkg-name":"An Android package name must be provided in the request.","auth/unauthorized-continue-uri":"The domain of the continue URL is not allowlisted.","auth/invalid-dynamic-link-domain":"The provided dynamic link domain is not authorized.","auth/invalid-tenant-id":"The provided tenant ID is invalid.","auth/tenant-id-mismatch":"The tenant ID of the provider does not match the tenant ID of the current user.","auth/provider-already-linked":"This authentication provider is already linked to the account.","auth/invalid-persistence-type":"The specified persistence type is invalid.","auth/unsupported-persistence-type":"The current environment does not support the specified persistence type.","auth/invalid-provider":"The specified authentication provider is invalid.","auth/invalid-client-id":"The authentication client ID provided is invalid.","oauth/unauthorized-app":"This application is not authorized to use OAuth with the provided client ID.","auth/provider-not-enabled":"This authentication provider is not enabled.","auth/unknown-provider":"Unknown authentication provider.","auth/missing-provider":"No authentication provider specified in the request.","auth/no-user-signed-in":"No user is currently signed in."}},oauth:{errorSource:"oauth",defaultErrorCode:"unknown",defaultErrorMessage:"An OAuth error occurred",errorCodeMapping:{"oauth/invalid-request":"invalid-argument","oauth/invalid-client":"invalid-argument","oauth/invalid-grant":"invalid-argument","oauth/unauthorized-client":"permission-denied","oauth/unsupported-grant-type":"unimplemented","oauth/invalid-scope":"invalid-argument","oauth/insufficient-scope":"permission-denied","oauth/invalid-token":"unauthenticated","oauth/expired-token":"unauthenticated","oauth/redirect-uri-mismatch":"invalid-argument","oauth/access-denied":"permission-denied","oauth/server-error":"unavailable","oauth/temporarily-unavailable":"unavailable","oauth/state-mismatch":"invalid-argument","oauth/invalid-callback":"invalid-argument","oauth/client-secret-mismatch":"permission-denied","oauth/unauthorized-scope":"permission-denied","oauth/rate-limit-exceeded":"rate-limit-exceeded","oauth/token-expired":"unauthenticated","oauth/missing-token":"invalid-argument","oauth/invalid-code":"invalid-argument","oauth/invalid-redirect":"invalid-argument","oauth/provider-error":"unavailable","oauth/invalid-response":"unavailable","oauth/unauthorized-access":"permission-denied",...Ie},friendlyMessageMapping:{"oauth/invalid-request":"The OAuth request was invalid or missing parameters.","oauth/invalid-client":"Client authentication failed.","oauth/invalid-grant":"The provided authorization grant is invalid.","oauth/unauthorized-client":"The client is not authorized to use this grant type.","oauth/unsupported-grant-type":"The requested grant type is not supported.","oauth/invalid-scope":"The requested scope is invalid or unknown.","oauth/insufficient-scope":"The token does not have the required scope for this resource.","oauth/invalid-token":"The access token is invalid.","oauth/expired-token":"The access token has expired.","oauth/redirect-uri-mismatch":"The redirect URI does not match the registered URI.","oauth/access-denied":"The resource owner denied the request.","oauth/server-error":"The authorization server encountered an unexpected error.","oauth/temporarily-unavailable":"The authorization server is temporarily unavailable.","oauth/state-mismatch":"Invalid state parameter. This could be a security issue.","oauth/invalid-callback":"The callback URL is invalid or not registered.","oauth/client-secret-mismatch":"The client secret does not match the registered secret.","oauth/unauthorized-scope":"The requested scope is not authorized for this client.","oauth/rate-limit-exceeded":"Too many requests. Please try again later.","oauth/token-expired":"The OAuth token has expired and needs to be refreshed.","oauth/missing-token":"No OAuth token was provided in the request.","oauth/invalid-code":"The authorization code is invalid or expired.","oauth/invalid-redirect":"The redirect URL is invalid or does not match the registered redirect URL.","oauth/provider-error":"The OAuth provider returned an error.","oauth/invalid-response":"The response from the OAuth provider was invalid.","oauth/unauthorized-access":"Unauthorized access to OAuth resources."}},api:{errorSource:"api",defaultErrorCode:"unknown",defaultErrorMessage:"API request failed",errorCodeMapping:Object.fromEntries(Object.entries(Kr).map(([e,t])=>[e,t])),friendlyMessageMapping:{},extractErrorCode:e=>{if(typeof e!="object"||e===null)return;let t;return"response"in e&&e.response&&"status"in e.response?t=e.response.status:"status"in e&&typeof e.status=="number"&&(t=e.status),t?.toString()},processMetadata:e=>{let t={originalError:e};if(typeof e!="object"||e===null)return t;if("response"in e&&e.response){let n=e.response;"status"in n&&(t.statusCode=n.status),"data"in n&&(t.responseData=n.data)}else"status"in e&&(t.statusCode=e.status);return t}},firebase:{errorSource:"firebase",defaultErrorCode:"unknown",defaultErrorMessage:"A Firebase error occurred",errorCodeMapping:Ie,friendlyMessageMapping:{}},ui:{errorSource:"ui",defaultErrorCode:"internal",defaultErrorMessage:ee.internal,errorCodeMapping:{},friendlyMessageMapping:{},processMetadata:e=>{let t={originalError:e};return typeof e=="object"&&e!==null&&"componentStack"in e&&(t.componentStack=e.componentStack),t}},validation:{errorSource:"validation",defaultErrorCode:"validation-failed",defaultErrorMessage:ee["validation-failed"],errorCodeMapping:{},friendlyMessageMapping:{}},entity:{errorSource:"entity",defaultErrorCode:"unknown",defaultErrorMessage:"An entity operation error occurred",errorCodeMapping:{},friendlyMessageMapping:{}},unknown:{errorSource:"unknown",defaultErrorCode:"unknown",defaultErrorMessage:ee.unknown,errorCodeMapping:{TypeError:"invalid-argument",ReferenceError:"internal",RangeError:"invalid-argument"},friendlyMessageMapping:{},extractErrorCode:e=>{if(e instanceof Error)return e.name}}},Yr=e=>e instanceof Gt.ValiError?new R(ee["validation-failed"],"validation-failed",{details:{validationErrors:e.issues.map(t=>({path:t.path.join("."),message:t.message})),originalError:e},source:"validation"}):$(W.validation)(e),zr=e=>{if(e instanceof Error&&"type"in e&&typeof e.type=="string"&&Gr(e.type)){let t=nt[e.type]||"unknown";return new R(e.message||ee[t],t,{details:{originalError:e},source:"entity"})}if(typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&Je[e.code]){let t=Je[e.code];if(t){let n=nt[t.type]||"unknown";return new R(t.message||ee[n],n,{details:{originalCode:e.code,originalError:e},source:"entity"})}}return $(W.entity)(e)},Kt={auth:$(W.auth),oauth:$(W.oauth),api:$(W.api),firebase:$(W.firebase),ui:$(W.ui),validation:Yr,entity:zr,unknown:$(W.unknown)};function te(e,t,n){return e instanceof R?e:(Kt[t]||Kt.unknown)(e,n)}function Yt(e,t,n={}){let r=globalThis.Sentry;r&&r.withScope(o=>{o.setTag("errorSource",t),o.setTag("errorCode",e.code),e.details&&Object.entries(e.details).forEach(([s,a])=>{if(typeof a!="function"&&s!=="originalError")try{o.setExtra(s,a)}catch{o.setExtra(s,`[${typeof a}]`)}}),Object.entries(n).forEach(([s,a])=>{if(typeof a!="function")try{o.setExtra(`context.${s}`,a)}catch{o.setExtra(`context.${s}`,`[${typeof a}]`)}}),(e.details?.userId||n.userId)&&o.setUser({id:e.details?.userId||n.userId,email:e.details?.userEmail||n.userEmail}),r.captureException(e)})}function Xr(){return typeof import.meta<"u"&&import.meta.env&&(import.meta.env.DEV===!0||import.meta.env.MODE&&import.meta.env.MODE!=="production")?!0:typeof process<"u"&&process.env?(process.env.NODE_ENV||"development").toLowerCase()!=="production":!1}function A(e,t){let n=typeof t=="string"?{userMessage:t}:t||{},{userMessage:r,context:o={},log:s=!0,reportToSentry:a=!0,showNotification:l=!1,severity:d="error"}=n,f=Ht(e),m=e instanceof R?e:te(e,f,r);if(r&&!m.userMessageProvided&&(m.message.includes("Error")||m.message.includes("Failed")||m.message.length<10?m=new R(r,m.code,{details:{...m.details,originalMessage:m.message},source:f,userMessageProvided:!0}):m=new R(m.message,m.code,{details:{...m.details,userMessage:r},source:f,userMessageProvided:!0})),s){let E=Xr()||typeof window<"u"&&window.__DNDEV_DEBUG,C={code:m.code,message:m.message,source:f};switch(d){case"warning":break;case"info":break;case"success":break;default:}}return a&&Yt(m,f,o),m}function mc(e,t){return async(...n)=>{try{return await e(...n)}catch(r){throw A(r,t)}}}function fc(e,t="info",n){let r=Date.now().toString();return r}function Rc(e,t,n,r,o){if(e instanceof R)return e;let{code:s}=te(e,"api");return new R("Request failed.",s,{source:"api",details:{context:`${t}.${n}(${r}${o?`, ${o}`:""})`,originalMessage:rt(e),originalError:e}})}function kc(e,t,n,r){let o=`${t}.${n}(${r})`;return te(e,"api",`${o}: ${rt(e)}`)}function Ac(e,t,n,r){let o=r?` ${JSON.stringify(r)}`:"",s=`${t}.${n}(${o})`,a=te(e,"auth",`${s}: ${rt(e)}`);return typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"&&a.code==="unknown"&&e.code!=="unknown"?new R(a.message,a.code,{details:{...a.details,originalCode:e.code},source:a.source}):a}function rt(e){return e instanceof Error?e.message:typeof e=="string"?e:String(e)}import*as me from"valibot";function wc(e,t,n){try{return me.parse(e,t)}catch(r){throw r instanceof me.ValiError?new R(`Validation failed in ${n}: ${r.message}`,"validation-failed",{details:{issues:r.issues,input:t},source:"validation"}):new R(`Unexpected validation error in ${n}: ${Qr(r)}`,"validation-failed",{originalError:r instanceof Error?r:new Error(String(r)),source:"validation"})}}function Oc(e,t){try{return me.parse(e,t)}catch{return null}}function Pc(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{value:e}}function Qr(e){return e instanceof Error?e.message:typeof e=="string"?e:String(e)}function zt(e,t,n,r={}){let{minLength:o=0,excludeEmpty:s=!0,customFilter:a}=r;return Array.from({length:n},(l,d)=>{let f=`${t}.${d}`;return e(f)}).filter((l,d)=>{let f=`${t}.${d}`;return!(l===f||s&&l.trim()===""||l.length<o||a&&!a(l,d))})}function Uc(e,t,n,r){return Array.from({length:n},(o,s)=>{let a=`${t}.${s}.${String(r[0])}`;if(e(a)===a)return null;let d={};for(let f of r){let m=`${t}.${s}.${String(f)}`;d[f]=e(m)}return d}).filter(o=>o!==null)}function Mc(e,t,n,r,o={}){let{minLength:s=0,excludeEmpty:a=!0,customFilter:l}=o;return Array.from({length:r-n},(d,f)=>{let m=n+f,E=`${t}.${m}`;return e(E)}).filter((d,f)=>{let m=n+f,E=`${t}.${m}`;return!(d===E||a&&d.trim()===""||d.length<s||l&&!l(d,m))})}function Lc(e,t,n,r={}){let{minLength:o=0,excludeEmpty:s=!0,customFilter:a}=r;return Array.from({length:n},(l,d)=>{let f=`${t}.${d}`;return{item:e(f),originalIndex:d}}).filter(({item:l,originalIndex:d})=>{let f=`${t}.${d}`;return!(l===f||s&&l.trim()===""||l.length<o||a&&!a(l,d))})}var Zr=/^---\r?\n([\s\S]*?)\r?\n---/,Jr=/^\r?\n/;function Vc(e){let t=e.match(Zr);if(!t)return{meta:{},content:e};let n={};for(let r of(t[1]??"").split(`
|
|
2
|
+
`)){let o=r.indexOf(":");if(o===-1)continue;let s=r.slice(0,o).trim();if(!s)continue;let a=r.slice(o+1).trim();(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))&&(a=a.slice(1,-1)),n[s]=a}return{meta:n,content:e.slice(t[0].length).replace(Jr,"")}}function jc(e){let t=new Date().toISOString();return{createdAt:t,updatedAt:t,createdById:e,updatedById:e}}var Xt={AED:{locale:"ar-AE",symbol:"\u062F.\u0625"},ARS:{locale:"es-AR",symbol:"$"},AUD:{locale:"en-AU",symbol:"$"},BDT:{locale:"bn-BD",symbol:"\u09F3"},BGN:{locale:"bg-BG",symbol:"\u043B\u0432"},BHD:{locale:"ar-BH",symbol:"\u062F.\u0628"},BRL:{locale:"pt-BR",symbol:"R$"},CAD:{locale:"en-CA",symbol:"$"},CHF:{locale:"fr-CH",symbol:"CHF"},CLP:{locale:"es-CL",symbol:"$"},CNY:{locale:"zh-CN",symbol:"\xA5"},COP:{locale:"es-CO",symbol:"$"},CZK:{locale:"cs-CZ",symbol:"K\u010D"},DKK:{locale:"da-DK",symbol:"kr"},EGP:{locale:"ar-EG",symbol:"E\xA3"},EUR:{locale:"fr-FR",symbol:"\u20AC"},GBP:{locale:"en-GB",symbol:"\xA3"},HKD:{locale:"zh-HK",symbol:"$"},HUF:{locale:"hu-HU",symbol:"Ft"},IDR:{locale:"id-ID",symbol:"Rp"},ILS:{locale:"he-IL",symbol:"\u20AA"},INR:{locale:"en-IN",symbol:"\u20B9"},JOD:{locale:"ar-JO",symbol:"\u062F.\u0623"},JPY:{locale:"ja-JP",symbol:"\xA5"},KES:{locale:"sw-KE",symbol:"KSh"},KRW:{locale:"ko-KR",symbol:"\u20A9"},KWD:{locale:"ar-KW",symbol:"\u062F.\u0643"},LKR:{locale:"si-LK",symbol:"Rs"},MXN:{locale:"es-MX",symbol:"$"},MYR:{locale:"ms-MY",symbol:"RM"},NGN:{locale:"en-NG",symbol:"\u20A6"},NOK:{locale:"nb-NO",symbol:"kr"},NZD:{locale:"en-NZ",symbol:"$"},OMR:{locale:"ar-OM",symbol:"\u0631.\u0639."},PEN:{locale:"es-PE",symbol:"S/."},PHP:{locale:"en-PH",symbol:"\u20B1"},PKR:{locale:"ur-PK",symbol:"\u20A8"},PLN:{locale:"pl-PL",symbol:"z\u0142"},QAR:{locale:"ar-QA",symbol:"\u0631.\u0642"},RON:{locale:"ro-RO",symbol:"lei"},RUB:{locale:"ru-RU",symbol:"\u20BD"},SAR:{locale:"ar-SA",symbol:"\u0631.\u0633"},SEK:{locale:"sv-SE",symbol:"kr"},SGD:{locale:"en-SG",symbol:"$"},THB:{locale:"th-TH",symbol:"\u0E3F"},TRY:{locale:"tr-TR",symbol:"\u20BA"},TWD:{locale:"zh-TW",symbol:"$"},UAH:{locale:"uk-UA",symbol:"\u20B4"},USD:{locale:"en-US",symbol:"$"},UYU:{locale:"es-UY",symbol:"$"},VND:{locale:"vi-VN",symbol:"\u20AB"},ZAR:{locale:"en-ZA",symbol:"R"}};function eo(e){return Xt[e]?.locale??"en-US"}function Wc(e){return!e||typeof e!="string"?e??"":Xt[e]?.symbol??e}function we(e,t,n={}){if(e==null||isNaN(e))return"";let r=eo(t);return new Intl.NumberFormat(r,{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:2,currencyDisplay:"symbol",...n}).format(e)}function Qt(e){let t=e.match(/^(\d{4})(\d{2})(\d{2}):(\d{2})(\d{2})$/);if(!t||t.length<6)throw new Error(`Invalid compact date format. Expected YYYYMMDD:HHMM, got: ${e}`);let n=t[1],r=t[2],o=t[3],s=t[4],a=t[5],l=new Date(parseInt(n,10),parseInt(r,10)-1,parseInt(o,10),parseInt(s,10),parseInt(a,10));if(isNaN(l.getTime()))throw new Error(`Invalid date values in compact format: ${e}`);return l.toISOString()}function Kc(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`Invalid ISO date string: ${e}`);let n=t.getUTCFullYear(),r=String(t.getUTCMonth()+1).padStart(2,"0"),o=String(t.getUTCDate()).padStart(2,"0"),s=String(t.getUTCHours()).padStart(2,"0"),a=String(t.getUTCMinutes()).padStart(2,"0");return`${n}${r}${o}:${s}${a}`}function Zt(e){return/^\d{4}\d{2}\d{2}:\d{2}\d{2}$/.test(e)}function Gc(e){if(!e)return new Date().toISOString();if(e instanceof Date){if(isNaN(e.getTime()))throw new Error("Invalid Date object");return e.toISOString()}if(typeof e=="string"){if(Zt(e))return Qt(e);let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`Invalid date string: ${e}`);return t.toISOString()}if(typeof e=="number"){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`Invalid timestamp: ${e}`);return t.toISOString()}if(typeof e=="object"&&e!==null&&"toDate"in e&&typeof e.toDate=="function")return e.toDate().toISOString();throw new Error(`Unsupported date type: ${typeof e}`)}function Yc(){return new Date().toISOString()}function zc(e){return e.toISOString()}function Xc(e){return new Date(e).toISOString()}function Qc(e){let t=new Date(e);if(isNaN(t.getTime()))throw new Error(`Invalid ISO date string: ${e}`);let n=new Date(t.getFullYear(),0,1),r=Math.floor((t.getTime()-n.getTime())/(1440*60*1e3));return`Week ${Math.ceil((r+n.getDay()+1)/7)}, ${t.getFullYear()}`}var F={SECOND:1,MINUTE:60,HOUR:3600,DAY:86400,WEEK:604800,MONTH:2592e3,YEAR:31536e3};function Zc(e,t="en",n={}){if(!e)return"";let{style:r="long",numeric:o="auto",fallbackThreshold:s=F.WEEK}=n,a;if(e instanceof Date)a=e;else if(typeof e=="string")a=new Date(e);else if(typeof e=="number")a=new Date(e);else if(typeof e=="object"&&"toDate"in e)a=e.toDate();else return"";if(isNaN(a.getTime()))return"";let l=new Date,d=a.getTime()-l.getTime(),f=Math.round(d/1e3),m=Math.abs(f);if(m>s)return no(a.toISOString(),t);let E=new Intl.RelativeTimeFormat(t,{style:r,numeric:o});return m<F.MINUTE?E.format(f,"second"):m<F.HOUR?E.format(Math.round(f/F.MINUTE),"minute"):m<F.DAY?E.format(Math.round(f/F.HOUR),"hour"):m<F.WEEK?E.format(Math.round(f/F.DAY),"day"):m<F.MONTH?E.format(Math.round(f/F.WEEK),"week"):m<F.YEAR?E.format(Math.round(f/F.MONTH),"month"):E.format(Math.round(f/F.YEAR),"year")}function to(e){switch(e){case"full":return{weekday:"long",year:"numeric",month:"long",day:"numeric"};case"long":return{year:"numeric",month:"long",day:"numeric"};case"medium":return{year:"numeric",month:"short",day:"numeric"};case"short":return{year:"2-digit",month:"numeric",day:"numeric"};case"date-only":return{year:"numeric",month:"2-digit",day:"2-digit"};case"time-only":return{hour:"2-digit",minute:"2-digit"};case"datetime":return{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};default:return{year:"numeric",month:"long",day:"numeric"}}}function no(e,t="en",n="long"){if(!e)return"";let r;if(e instanceof Date)r=e;else if(typeof e=="string")r=new Date(e);else if(typeof e=="number")r=new Date(e);else if(typeof e=="object"&&"toDate"in e)r=e.toDate();else return"";if(isNaN(r.getTime()))return"";let o=typeof n=="string"?to(n):n;return new Intl.DateTimeFormat(t,o).format(r)}function Jt(e){if(e!=null){if(e instanceof Date)return isNaN(e.getTime())?void 0:e.toISOString();if(typeof e=="string"){let t=e.trim();if(!t)return;if(Zt(t))try{return Qt(t)}catch{return}let n=new Date(t);return isNaN(n.getTime())?void 0:n.toISOString()}if(typeof e=="number"){if(!Number.isFinite(e))return;let t=new Date(e);return isNaN(t.getTime())?void 0:t.toISOString()}if(typeof e=="object"&&e!==null&&"toDate"in e&&typeof e.toDate=="function")try{let t=e.toDate();return isNaN(t.getTime())?void 0:t.toISOString()}catch{return}if(typeof e=="object"&&e!==null&&"seconds"in e&&typeof e.seconds=="number"){let t=e,n=t.seconds*1e3+(t.nanoseconds||0)/1e6,r=new Date(n);return isNaN(r.getTime())?void 0:r.toISOString()}}}function Jc(e){let t=Jt(e);if(!t)return;let n=new Date(t);return n.setUTCHours(12,0,0,0),n.toISOString()}function ed(e){let t=Jt(e);return t&&t.split("T")[0]||""}function rn(e){return e==null||e===""}function ot(e,t){if(!e.includes(":"))return t(e);let[n,r=e]=e.split(":");if(r.startsWith("status.")){let o=t(r);if(o!==r&&o!==`${n}:${r}`)return o}return t(r,{ns:n})}function st(e){return e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim()}function on(e){let t=e.validation?.options;return Array.isArray(t)?t:void 0}function Oe(e,t,n){let r=on(t)?.find(o=>o.value===e)?.label;return r?ot(r,n):String(e)}function it(e){return e instanceof Date?e:new Date(e)}var en=(e,t,n,{locale:r})=>it(e).toLocaleString(r),M=e=>String(e),tn=e=>e?"Yes":"No",nn=(e,t,n,{locale:r})=>typeof e=="number"?e.toLocaleString(r):String(e),ro={timestamp:en,"datetime-local":en,date:(e,t,n,{locale:r})=>it(e).toLocaleDateString(r),time:(e,t,n,{locale:r})=>it(e).toLocaleTimeString(r),week:M,month:M,boolean:tn,checkbox:tn,switch:(e,t,n)=>{let r=t.options?.fieldSpecific;if(r){let o=r.uncheckedValue??!1,s=r.checkedValue??!0;if(e===s&&r.checkedLabel)return ot(r.checkedLabel,n);if(e===o&&r.uncheckedLabel)return ot(r.uncheckedLabel,n)}return e?"Yes":"No"},year:M,number:nn,range:nn,currency:(e,t)=>{if(Number.isNaN(Number(e)))return"";let n=t.options?.fieldSpecific;return we(Number(e),n?.currency||"EUR")},price:(e,t,n)=>{let r=typeof e=="number"?{amount:e,currency:"EUR",vatIncluded:!0,discountPercent:0}:e;if(!r||typeof r!="object")return"";let o=r.amount;if(rn(o)||Number.isNaN(Number(o)))return"";let s=r.currency||"EUR",a=r.discountPercent??0,l=r.vatIncluded??!0?` ${n("crud:price.vatIncluded",{defaultValue:"VAT Incl."})}`:"";if(a>0){let d=Number(o)*(1-a/100),f=` ${n("crud:price.discountPercent",{percent:Math.round(a),defaultValue:"-{{percent}}%"})}`;return`${we(d,s)}${l}${f}`}return`${we(Number(o),s)}${l}`},duration:(e,t,n)=>{let r=typeof e=="number"?e:parseInt(String(e),10);if(Number.isNaN(r))return"";if(r===0)return n("crud:duration.zero",{defaultValue:"\u2014"});if(r<60)return n("crud:duration.minutes",{count:r,defaultValue:`${r} min`});let o=Math.floor(r/60),s=r%60;return n("crud:duration.hoursMinutes",{hours:o,minutes:s,defaultValue:s===0?`${o}h`:`${o}h ${s}min`})},gdprConsent:(e,t,n,{locale:r})=>{if(!e||typeof e!="object")return"";let o=e;if(o.gdprConsent!==!0)return n("crud:gdprConsent.display.no",{defaultValue:"Not consented"});let s=[n("crud:gdprConsent.display.yes",{defaultValue:"Consented"})];return o.gdprConsentDate&&s.push(new Date(o.gdprConsentDate).toLocaleDateString(r)),o.gdprConsentVersion&&s.push(`v${o.gdprConsentVersion}`),s.join(" \xB7 ")},select:Oe,radio:Oe,combobox:Oe,multiselect:(e,t,n)=>Array.isArray(e)&&on(t)?e.map(r=>Oe(r,t,n)).join(", "):String(e),reference:e=>{if(e&&typeof e=="object"){let t=e;return String(t.displayName||t.name||t.id||e)}return String(e)},geopoint:e=>{if(e&&typeof e=="object"&&"lat"in e&&"lng"in e){let{lat:t,lng:n}=e;return`${t.toFixed(6)}, ${n.toFixed(6)}`}return""},address:e=>e&&typeof e=="object"&&"formatted_address"in e?String(e.formatted_address):String(e),array:e=>Array.isArray(e)?e.join(", "):"","field-array":(e,t)=>{if(!Array.isArray(e))return"";let n=t.options?.fieldSpecific?.fields;return e.map(r=>{if(typeof r!="object"||r==null)return"";let o=r;return(n?n.map(a=>a.name):Object.keys(o)).map(a=>o[a]).filter(a=>a!=null&&a!=="").map(a=>typeof a=="object"?JSON.stringify(a):String(a)).join(" \xB7 ")}).filter(Boolean).join(", ")},password:()=>"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",text:M,textarea:M,email:M,tel:M,url:M,color:M,iban:M,richtext:e=>st(String(e))};function sn(e,t,n,r={}){let o=t.options?.displayValue;if(o&&r.item)return o(e,r.item,n);if(rn(e))return null;let s=r.formatter??ro[t.type],a=s?s(e,t,n,{locale:r.locale}):typeof e=="object"?null:String(e);if(a===null||a==="")return null;let l=t.options?.displayKey;if(!l)return a;let d=(Array.isArray(l)?l:[l]).map(f=>f.replace("{{value}}",a));return n(d,{value:a})}var oo=160,an="EUR",io=new Set(["textarea","richtext"]),un=new Set(["image","images"]),so=new Set(["price","currency"]),ao=" \xB7 ",lo={available:"InStock"};function G(e){return typeof e=="string"&&e.trim()!==""?e.trim():void 0}function uo(e,t){if(e.length<=t)return e;let n=e.slice(0,t-1),r=n.lastIndexOf(" ");return`${(r>t/2?n.slice(0,r):n).trimEnd()}\u2026`}function ln(e){return(Array.isArray(e)?e:[e]).map(n=>{if(typeof n=="string")return G(n);if(n&&typeof n=="object"&&"fullUrl"in n)return G(n.fullUrl)}).filter(n=>n!==void 0)}function cn(e){let t=e.listCardFields,n=t?Array.isArray(t)?t:[...t.title??[],...t.subtitle??[],...t.content??[],...t.footer??[]]:[];return[...new Set([...n,...Object.keys(e.fields)])]}function Pe(e,t,n,r){return n.flatMap(o=>{let s=e.fields[o];if(!s||un.has(s.type))return[];let a=sn(t[o],s,r.t,{item:t,locale:r.locale});return a?[a]:[]})}function co(e,t,n){let r=e.seo?.title;if(r)return G(r(t,n.t));let o=e.listCardFields;if(o&&!Array.isArray(o)&&o.title?.length){let a=Pe(e,t,o.title,n);return a.length>0?a.join(o.titleSeparator??" "):void 0}let s=cn(e).find(a=>e.fields[a]?.type==="text");return s?G(Pe(e,t,[s],n)[0]):void 0}function po(e,t,n,r){let o=e.seo?.description;if(o)return G(o(t,r.t));let s=n.find(f=>io.has(e.fields[f]?.type??"")&&G(t[f])!==void 0);if(s)return st(String(t[s]));let a=e.listCardFields;if(!a||Array.isArray(a))return;let d=[Pe(e,t,a.subtitle??[],r).join(" "),...Pe(e,t,a.content??[],r)].filter(Boolean);return d.length>0?d.join(ao):void 0}function mo(e,t){if(typeof t.status!="string")return;let r={...lo,...e.seo?.availability}[t.status];return r?`https://schema.org/${r}`:void 0}function fo(e,t){if(e.type==="price"&&t&&typeof t=="object"){let{amount:o,currency:s}=t;return typeof o=="number"&&o>0?{amount:o,currency:G(s)??an}:void 0}let n=typeof t=="string"?Number(t):t;if(typeof n!="number"||!(n>0))return;let r=e.options?.fieldSpecific;return{amount:n,currency:r?.currency??an}}function id(e,t,n){let r=cn(e),o=m=>e.fields[m],s=po(e,t,r,n),a=s?uo(s,oo):void 0,l=r.find(m=>un.has(o(m)?.type??"")&&ln(t[m]).length>0),d=l?ln(t[l]):[],f;for(let m of r){let E=o(m);if(!(!E||!so.has(E.type))&&(f=fo(E,t[m]),f))break}return{title:co(e,t,n),description:a||void 0,image:d[0],images:d,price:f,availability:mo(e,t)}}function sd(e,t){return e.title?{"@context":"https://schema.org","@type":"Product",name:e.title,...e.description&&{description:e.description},...e.images.length>0&&{image:e.images},url:t,...e.price&&{offers:{"@type":"Offer",price:e.price.amount,priceCurrency:e.price.currency,...e.availability&&{availability:e.availability},url:t}}}:null}function go(e){return typeof e=="string"?`'${e.replace(/'/g,"\\'")}'`:typeof e=="boolean"?e?"true":"false":String(e)}function ho(e){let t=`resource.data.${e.field}`,n=go(e.value);return`${t} ${e.op} ${n}`}function ld(e){let t=[];if(e.publicCondition&&e.publicCondition.length>0){let n=e.publicCondition.map(ho).join(" && ");t.push(`(${n})`)}for(let n of e.ownerFields)t.push(`request.auth.uid == resource.data.${n}`);return t.length===0?"false":t.join(" || ")}function cd(e,t){return t?!t.includes(".")&&!t.includes(":")?t:e(t):""}var De=e=>e.split("/").filter(Boolean);function dn(e){return e==="*"||e.endsWith("/*")}function yo(e){try{return decodeURIComponent(e)}catch{return e}}function pn(e,t){let n={};return e.forEach((r,o)=>{r.startsWith(":")&&t[o]!==void 0&&(n[r.slice(1)]=yo(t[o]))}),n}function fe(e,t){let n=De(t),r=n.join("/"),o=e.find(l=>typeof l.path=="string"&&De(l.path).join("/")===r);if(o)return{route:o,params:{}};let s=null;for(let l of e){if(typeof l.path!="string"||!l.path.includes(":")||dn(l.path))continue;let d=De(l.path);d.length===n.length&&d.every((f,m)=>f.startsWith(":")||f===n[m])&&(!s||l.path.length>s.route.path.length)&&(s={route:l,pattern:d})}if(s)return{route:s.route,params:pn(s.pattern,n)};let a=null;for(let l of e){if(typeof l.path!="string"||!dn(l.path))continue;let d=De(l.path).slice(0,-1);if(n.length<d.length)continue;let f=0,m=!0;for(let C=0;C<d.length;C++){let P=d[C];if(!P.startsWith(":")){if(P!==n[C]){m=!1;break}f++}}if(!m)continue;let E=[d.length,f];(!a||E[0]>a.score[0]||E[0]===a.score[0]&&E[1]>a.score[1])&&(a={route:l,prefix:d,score:E})}return a?{route:a.route,params:pn(a.prefix,n)}:null}function vo(e){let t=[],n="";for(let r of e.split("/").filter(Boolean))n+=`/${r}`,t.push(n);return t}var ge=e=>`/${e.split("/").filter(Boolean).join("/")}`,bo=e=>!e.split("/").some(t=>t.startsWith(":")||t==="*");function at(e,t){let n=new Map;for(let l of t)typeof l.path=="string"&&bo(l.path)&&n.set(ge(l.path),l);let r=(l,d)=>{let f=vo(l).slice(0,-1),m=f.at(-1),E=m===void 0?void 0:n.get(m);if(E)return E;let C=d?.meta?.parent;if(C!==void 0){if(ge(C)==="/")return null;let P=n.get(ge(C));if(!P)throw new Error(`[dndev] ${d?.path}: PageMeta parent ${JSON.stringify(C)} is not a static route path of the app.`);return P}for(let P=f.length-2;P>=0;P--){let x=n.get(f[P]);if(x)return x}return null},o=[],s=new Set([ge(e)]),a=r(e,fe(t,e)?.route);for(;a;){let l=ge(a.path);if(s.has(l))throw new Error(`[dndev] PageMeta parent loop: ${[...s,l].join(" \u2192 ")}. Each page needs one parent chain up to home.`);s.add(l),o.unshift(a),a=r(l,a)}return o}var vd="dndev-prerendered-head",Eo="/logo.svg";function So(e){return JSON.stringify(e).replace(/</g,"\\u003c")}var T=(e,t,n)=>({tag:"meta",attributes:{[e]:t,content:n}}),lt=e=>({tag:"script",attributes:{type:"application/ld+json"},text:So(e)});function bd(e){let{title:t,description:n,image:r,type:o,jsonLd:s,breadcrumb:a}=e,l=[{tag:"title",attributes:{},text:t}];return n&&l.push(T("name","description",n)),l.push(T("property","og:title",t)),n&&l.push(T("property","og:description",n)),l.push(T("property","og:type",o)),r&&l.push(T("property","og:image",r)),r&&l.push(T("name","twitter:card","summary_large_image")),l.push(T("name","twitter:title",t)),n&&l.push(T("name","twitter:description",n)),r&&l.push(T("name","twitter:image",r)),s&&l.push(lt(s)),a&&l.push(lt(a)),l}function Ed(e){let t=[];if(e.url&&(t.push({tag:"link",attributes:{rel:"canonical",href:e.url}}),t.push(T("property","og:url",e.url))),t.push(T("property","og:site_name",e.siteName)),e.alternates){for(let[r,o]of Object.entries(e.alternates))t.push({tag:"link",attributes:{rel:"alternate",hreflang:r,href:o}});let n=e.alternates[e.defaultLanguage];n&&t.push({tag:"link",attributes:{rel:"alternate",hreflang:"x-default",href:n}})}return t}var xo=20,mn={defaultValue:""};function fn(e,t,n){if(e!==null)return e!==void 0?e:n(t,mn)||void 0}function gn(e,t){let n=(s=>e(s,mn)),r=s=>n(`${t}:meta.${s}`)||void 0,o=zt(n,`${t}:meta.keywords`,xo);return{fullTitle:r("fullTitle"),image:r("image"),type:r("type"),keywords:o.length>0?o:void 0,author:r("author")}}function To(e,t){return e===!0?"noindex, nofollow":e===!1?null:t?"noindex":null}function hn(e){let{meta:t,ns:n,defaultNs:r,t:o,siteName:s}=e,a=t.seo;if(!n&&!r)return{title:a?.fullTitle||s};let l=n?fn(a?.title,`${n}:title`,o):a?.title??void 0;return{title:a?.fullTitle||(n?gn(o,n).fullTitle:void 0)||(l?`${l} | ${s}`:s),...l&&{pageTitle:l}}}function Ro(e,t){let n=e.meta??{},{title:r,pageTitle:o}=hn({meta:n,ns:n.namespace||null,defaultNs:t.defaultNs,t:t.t,siteName:t.siteName});return o??r}function Sd(e,t){let n=fe(t,e)?.route,o=[...at(e,t),...n?[n]:[]].flatMap(s=>s.meta?.namespace?[s.meta.namespace]:[]);return[...new Set(o)]}function xd(e){let{pathname:t,routes:n,siteName:r,pageUrl:o,lastName:s}=e,a=m=>Ro(m,e),l=at(t,n).map(m=>({name:a(m),path:m.path})),d=fe(n,t)?.route,f=s||(d?a(d):void 0);return f&&l.push({name:f,path:t}),{"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:r,item:o("/")},...l.map((m,E)=>({"@type":"ListItem",position:E+2,name:m.name,item:o(m.path)}))]}}function Td(e){let{meta:t,ns:n,defaultNs:r,t:o,siteName:s,baseUrl:a,url:l,defaultImage:d}=e,f=t.seo,m=n??r,E=m?gn(o,m):null,{title:C}=hn({meta:t,ns:n,defaultNs:r,t:o,siteName:s}),P=m?fn(f?.description,`${m}:description`,o):void 0,x=f?.image||E?.image||d||void 0,L=f?.keywords||E?.keywords,Ee=t.author||E?.author;return{title:C,...P&&{description:P},...x&&{image:x.startsWith("http")?x:`${a}${x}`},url:l,type:f?.type||E?.type||"website",robots:To(f?.noindex??t.noindex,e.authOnly),...L&&{keywords:L},...Ee&&{author:Ee},...t.publishDate&&{publishDate:t.publishDate},...t.modifiedDate&&{modifiedDate:t.modifiedDate}}}function Rd(e,t){let{title:n,description:r,image:o,type:s,keywords:a,author:l}=e,d=[{tag:"title",attributes:{},text:n}];return r&&d.push(T("name","description",r)),a&&d.push(T("name","keywords",a.join(", "))),l&&d.push(T("name","author",l)),e.robots&&d.push(T("name","robots",e.robots)),d.push(T("property","og:title",n)),r&&d.push(T("property","og:description",r)),d.push(T("property","og:type",s)),o&&(d.push(T("property","og:image",o)),d.push(T("property","og:image:width","1200")),d.push(T("property","og:image:height","630"))),s==="article"&&(l&&d.push(T("property","article:author",l)),e.publishDate&&d.push(T("property","article:published_time",e.publishDate)),e.modifiedDate&&d.push(T("property","article:modified_time",e.modifiedDate))),d.push(T("name","twitter:card","summary_large_image")),d.push(T("name","twitter:title",n)),r&&d.push(T("name","twitter:description",r)),o&&d.push(T("name","twitter:image",o)),l&&d.push(T("name","twitter:creator",l)),o?.startsWith("http")&&d.push({tag:"link",attributes:{rel:"dns-prefetch",href:new URL(o).origin}}),e.url&&d.push(lt({"@context":"https://schema.org","@type":s==="article"?"Article":"WebPage",name:n,...r&&{description:r},url:e.url,...o&&{image:o},...s==="article"&&{...l&&{author:{"@type":"Person",name:l}},...e.publishDate&&{datePublished:e.publishDate},...e.modifiedDate&&{dateModified:e.modifiedDate}},publisher:{"@type":"Organization",name:t.siteName,logo:{"@type":"ImageObject",url:`${t.baseUrl}${Eo}`}}})),d}var kd={enabled:!0,themeColor:"#2563eb",backgroundColor:"#ffffff",includeManifestIcons:!0,includeMSIcons:!1};function Ad(e){let t=n=>e(n)?n:void 0;return{svg:t("/favicon.svg"),ico:t("/favicon.ico"),png16:t("/favicon-16x16.png"),png32:t("/favicon-32x32.png"),apple180:t("/apple-touch-icon.png"),android192:t("/icon-192x192.png"),android512:t("/icon-512x512.png")}}var ne=(e,t,n)=>({tag:"link",attributes:{rel:"icon",type:t,...n&&{sizes:n},href:e}});function Cd(e,t){let{enabled:n,appName:r,themeColor:o,includeManifestIcons:s,includeMSIcons:a}=t;if(n===!1)return[];let l=[];return e.svg&&l.push(ne(e.svg,"image/svg+xml")),e.ico&&l.push(ne(e.ico,"image/x-icon")),e.png16&&l.push(ne(e.png16,"image/png","16x16")),e.png32&&l.push(ne(e.png32,"image/png","32x32")),e.apple180&&(l.push({tag:"link",attributes:{rel:"apple-touch-icon",sizes:"180x180",href:e.apple180}}),r&&l.push(T("name","apple-mobile-web-app-title",r))),s&&(e.android192&&l.push(ne(e.android192,"image/png","192x192")),e.android512&&l.push(ne(e.android512,"image/png","512x512"))),a&&e.png32&&(l.push(T("name","msapplication-TileImage",e.png32)),o&&l.push(T("name","msapplication-TileColor",o))),o&&l.push(T("name","theme-color",o)),l.push(T("name","color-scheme","light dark")),l}var Id="dndev-fonts";function wd(e){return e.map(t=>({tag:"link",attributes:{rel:"preload",as:"font",type:"font/woff2",href:t,crossorigin:"anonymous"}}))}function ko(){let e=new Uint8Array(32);return crypto.getRandomValues(e),yn(e)}async function Ao(e){let n=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",n);return yn(new Uint8Array(r))}async function Pd(){let e=ko(),t=await Ao(e);return{codeVerifier:e,codeChallenge:t}}function yn(e){return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Dd(){return typeof window<"u"&&typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof crypto.getRandomValues<"u"}function Fd(e){return e.length<43||e.length>128?!1:/^[A-Za-z0-9\-._~]+$/.test(e)}function Nd(e){return e.length<43||e.length>128?!1:/^[A-Za-z0-9\-._~]+$/.test(e)}async function Ud(e,t,n){try{return await e()}catch{return t(),!1}}var Fe=new Map;function Ld(e,t){if(Fe.has(t))return Fe.get(t);let n=e().catch(r=>{throw Fe.delete(t),r});return Fe.set(t,n),n}var vn={[D.GUEST]:0,[D.USER]:1,[D.ADMIN]:2,[D.SUPER]:3};function Y(e,t){if(!e)return!1;let n=vn[e]??-1,r=vn[t]??1/0;return n>=r}function $d(e){return e?e.role===D.SUPER||e.isSuper===!0?D.SUPER:e.role===D.ADMIN||e.isAdmin===!0?D.ADMIN:e.role===D.USER?D.USER:e.role||D.USER:D.USER}function Wd(e,t,n){if(!e)return!1;let r=n??Ye,o=r[e]?.level??-1,s=r[t]?.level??1/0;return o>=s}var bn="__DNDEV_SINGLETONS__";function En(){if(typeof globalThis<"u"){let e=globalThis,t=e[bn];if(t)return t;let n=new Map;return e[bn]=n,n}return new Map}function Ne(e,t){let n=En();return n.has(e)||n.set(e,t()),n.get(e)}function Kd(e){En().delete(e)}function Gd(e,...t){let n=null,r=!1;return function(){if(n!==null)return n;if(r)throw new Error("Circular dependency detected in singleton initialization");r=!0;try{return typeof e=="function"&&e.prototype?n=new e(...t):n=e(),n}finally{r=!1}}}function Yd(e){let t=null,n=!1;return function(...o){if(t!==null)return t;if(n)throw new Error("Circular dependency detected in singleton initialization");n=!0;try{return typeof e=="function"&&e.prototype?t=new e(...o):t=e(...o),t}finally{n=!1}}}function zd(e){let t=null,n=!1,r=null;return async function(){if(t!==null)return t;if(n&&r)return r;if(n)throw new Error("Circular dependency detected in async singleton initialization");n=!0;try{return r=e(),t=await r,t}finally{n=!1,r=null}}}function Xd(e,t){return new Proxy({},{get(n,r){if(t.includes(r)){let s=e(),a=s[r];return typeof a=="function"?a.bind(s):a}return e()[r]}})}var he=class{static async getOrCreate(t,n,r={}){if(this.instances.has(t))return this.instances.get(t);if(this.initialized.has(t))return this.instances.get(t);if(this.initializing.has(t))throw new Error(`Circular dependency detected for singleton: ${t}`);if(r.ssrSafe===!1&&typeof window>"u"){if(typeof process<"u"&&process.env.NODE_ENV,r.fallbackFactory){let o=r.fallbackFactory();return this.instances.set(t,o),this.initialized.add(t),o}throw new Error(`Singleton ${t} requires client-side environment`)}this.initializing.add(t);try{let o=await n();return this.instances.set(t,o),this.initialized.add(t),o}catch(o){if(typeof process<"u"&&process.env.NODE_ENV,r.cacheFailures&&this.initialized.add(t),r.fallbackFactory){let s=r.fallbackFactory();return this.instances.set(t,s),this.initialized.add(t),s}throw o}finally{this.initializing.delete(t)}}static isInitialized(t){return this.initialized.has(t)}static clear(t){this.instances.delete(t),this.initialized.delete(t),this.initializing.delete(t)}static clearAll(){this.instances.clear(),this.initialized.clear(),this.initializing.clear()}};k(he,"instances",new Map),k(he,"initializing",new Set),k(he,"initialized",new Set);function _e(){return Ne("providers",()=>({providers:null}))}function ep(e){let t=_e();t.providers,t.providers=e}function tp(e){let{providers:t}=_e();if(!t)throw new Error(`[dndev] Provider "${e}" not available. Call configureProviders() at app startup.`);let n=t[e];if(!n)throw new Error(`[dndev] Provider "${e}" not configured. Pass it to configureProviders().`);return n}function np(e){return!!_e().providers?.[e]}function rp(){_e().providers=null}var ut=["text","textarea","richtext","field-array"];function ye(e){return`${e}I18n`}function ip(e){return Object.keys(e).filter(t=>e[t]?.i18n===!0)}function Co(e){return e==null?!1:typeof e=="string"?e.trim().length>0:Array.isArray(e)?e.length>0:!0}function sp(e,t,n){let r=null;for(let o of t){let s=e[ye(o)];if(!s||typeof s!="object")continue;let a=s[n];Co(a)&&(r??(r={...e}),r[o]=a)}return r??e}var lp="dndev-lang";function up(e,t){if(!e)return null;for(let n of e.split(";")){let r=n.indexOf("=");if(r!==-1&&n.slice(0,r).trim()===t)try{return decodeURIComponent(n.slice(r+1).trim())}catch{return null}}return null}function cp(e){return e?e.split(",").map((t,n)=>{let[r="",...o]=t.trim().split(";"),s=o.find(l=>l.trim().startsWith("q=")),a=s?Number(s.trim().slice(2)):1;return{tag:r.trim(),quality:Number.isFinite(a)?a:0,index:n}}).filter(t=>t.tag!==""&&t.tag!=="*"&&t.quality>0).sort((t,n)=>n.quality-t.quality||t.index-n.index).map(t=>t.tag):[]}function Sn({supported:e,fallback:t,stored:n,preferred:r}){if(n&&e.includes(n))return n;for(let o of r??[]){if(e.includes(o))return o;let s=o.split("-")[0];if(s&&e.includes(s))return s}return t}function ct(e){return e.length>1}var Io="dndev-session",wo="/index";function mp(e){let t=e.split("/"),n=t.indexOf(Io);(n===1||n===2)&&t.splice(n,1);let r=t.join("/")||"/";return r===wo?"/":r}function fp(e){return e.replace(/\/+$/,"")||"/"}function Oo(e,t){if(!t)return e;let n=e.search(/[?#]/),r=n===-1?e:e.slice(0,n),o=n===-1?"":e.slice(n);return r.endsWith("/")||r.slice(r.lastIndexOf("/")+1).includes(".")?e:`${r}/${o}`}function xn(e,t){let n={language:t.defaultLanguage,path:e,prefixed:!1};if(!ct(t.languages))return n;let r=e.indexOf("/",1),o=r===-1?e.slice(1):e.slice(1,r);return t.languages.includes(o)?{language:o,path:r===-1?"/":e.slice(r),prefixed:!0}:n}function Tn(e,t,n){if(!e.startsWith("/")||e.startsWith("//")||!ct(n.languages))return e;let r=e.search(/[?#]/),o=r===-1?e:e.slice(0,r),s=r===-1?"":e.slice(r),a=xn(o,n),l=a.prefixed?a.language:t;return l===n.defaultLanguage?`${a.path}${s}`:`/${l}${a.path==="/"?"":a.path}${s}`}function Po(e,t,n,r,o){return`${n}${Oo(Tn(e,t,r),o)}`}function gp(e,t,n,r){return Object.fromEntries(n.languages.map(o=>[o,Po(e,o,t,n,r)]))}function hp(e,t,n){let r=xn(e,n);if(!ct(n.languages))return{type:"pass",language:r.language,path:r.path};if(r.prefixed)return r.language===n.defaultLanguage?{type:"redirect",language:r.language,path:r.path,location:r.path,permanent:!0}:{type:"pass",language:r.language,path:r.path};let o=Sn({supported:n.languages,fallback:n.defaultLanguage,stored:t.stored,preferred:t.preferred});return o!==n.defaultLanguage?{type:"redirect",language:o,path:r.path,location:Tn(r.path,o,n),permanent:!1}:{type:"rewrite",language:n.defaultLanguage,path:r.path,destination:`/${n.defaultLanguage}${r.path==="/"?"":r.path}`}}function vp(e){return{updatedAt:new Date().toISOString(),updatedById:e}}function Do(e){return typeof e=="object"&&e!==null&&"visibility"in e&&typeof e.visibility=="string"}function Fo(e){if(Do(e))return e.visibility}function No(e,t){let n=e??"guest";return n==="hidden"?!1:n==="technical"?Y(t,"admin"):n==="owner"?!1:Y(t,n)}function _o(e,t,n){for(let r of n.ownerFields)if(e[r]===t)return!0;return!1}function Rn(e,t,n){if(!e||typeof e!="object"||!("entries"in e)||!e.entries)return[];let r=e.entries,o=[],{documentData:s,uid:a,ownership:l}=n??{},d=l&&a!=null&&s&&_o(s,a,l);for(let[f,m]of Object.entries(r)){let E=Fo(m);if(E==="owner"){d&&o.push(f);continue}No(E,t)&&o.push(f)}return o}function Tp(e,t,n,r){if(!e)return{};let o=r?.uid!=null&&r?.ownership!=null?{documentData:r.documentData??e,uid:r.uid,ownership:r.ownership}:void 0,s=Rn(t,n,o),a={};for(let l of s)Object.prototype.hasOwnProperty.call(e,l)&&(a[l]=e[l]);return a}function Ue(e){let t=e.listCardFields;if(t){if(Array.isArray(t))return t;let n=t,r=[...n.title??[],...n.subtitle??[],...n.content??[],...n.footer??[]];return[...new Set(r)]}return e.listFields&&e.listFields.length>0?e.listFields:e.fields?Object.keys(e.fields):[]}function kn(e){return typeof e=="object"&&e!==null}function Me(e){if(kn(e)){if(kn(e.entries))return e.entries;if(Array.isArray(e.pipe))for(let t of e.pipe){let n=Me(t);if(n)return n}if(e.wrapped)return Me(e.wrapped);if(Array.isArray(e.options))for(let t of e.options){let n=Me(t);if(n)return n}}}function Ap(e){let t=Me(e);if(!t)return!1;for(let n of Object.values(t)){let r=n?.visibility;if(r!==void 0&&r!=="guest")return!0}return!1}import*as An from"valibot";function Uo(e,t){let n=An.parse(B,t??Te);return{...n,userId:e,isActive:n.status===xe.ACTIVE,features:n.features??[]}}var dt=class{constructor(t={}){k(this,"store",new Map);k(this,"maxAttempts");k(this,"lockoutMs");k(this,"sessionTimeoutMs");this.maxAttempts=t.maxAttempts??5,this.lockoutMs=t.lockoutMs??900*1e3,this.sessionTimeoutMs=t.sessionTimeoutMs??480*60*1e3}checkLockout(t){let n=this.store.get(t);if(n?.lockedUntil){if(Date.now()<n.lockedUntil){let r=Math.ceil((n.lockedUntil-Date.now())/6e4);throw new Error(`Account temporarily locked after too many failed attempts. Try again in ${r} minute${r===1?"":"s"}.`)}this.store.delete(t)}}recordFailure(t){let n=Date.now();!this.store.has(t)&&this.store.size>=1e4&&this._evictExpired(n);let r=this.store.get(t)??{attempts:0,lastAttempt:0,lockedUntil:null};return r.attempts+=1,r.lastAttempt=n,r.attempts>=this.maxAttempts&&(r.lockedUntil=n+this.lockoutMs),this.store.set(t,r),{attempts:r.attempts,locked:r.lockedUntil!==null&&Date.now()<r.lockedUntil,lockedUntil:r.lockedUntil}}_evictExpired(t){for(let[n,r]of this.store)r.lockedUntil!==null&&t>r.lockedUntil?this.store.delete(n):r.lockedUntil===null&&t-r.lastAttempt>this.lockoutMs&&this.store.delete(n)}recordSuccess(t){this.store.delete(t)}isSessionExpired(t){return Date.now()-t>this.sessionTimeoutMs}getEntry(t){return this.store.get(t)}};function Mo(e,t){if(t.includes(".")){let n=t.split("."),r=e;for(let o of n){if(r==null||typeof r!="object")return;r=r[o]}return r}return e[t]}function Lo(e,t){let n=Mo(t,e.field);switch(e.operator){case"equals":return n===e.value;case"notEquals":return n!==e.value;case"in":return Array.isArray(e.value)&&e.value.includes(n);case"notIn":return Array.isArray(e.value)&&!e.value.includes(n);case"greaterThan":return typeof n=="number"&&typeof e.value=="number"&&n>e.value;case"lessThan":return typeof n=="number"&&typeof e.value=="number"&&n<e.value;case"greaterThanOrEqual":return typeof n=="number"&&typeof e.value=="number"&&n>=e.value;case"lessThanOrEqual":return typeof n=="number"&&typeof e.value=="number"&&n<=e.value;case"exists":return n!=null&&n!==""&&n!==!1;case"notExists":return n==null||n===""||n===!1;case"contains":return typeof n=="string"&&typeof e.value=="string"||Array.isArray(n)?n.includes(e.value):!1;default:return!1}}function Bo(e){return e instanceof ve||"expression"in e?e.expression:e}function re(e,t){let n=Bo(e);if(n.type==="condition")return Lo(n,t);let{logic:r,conditions:o}=n;return r==="and"?o.every(s=>re(s,t)):o.some(s=>re(s,t))}function Vp(e,t){return e?{visible:e.visible?re(e.visible,t):!0,disabled:e.disabled?re(e.disabled,t):!1,required:e.required?re(e.required,t):!1,readonly:e.readonly?re(e.readonly,t):!1}:{visible:!0,disabled:!1,required:!1,readonly:!1}}var ve=class e{constructor(t){k(this,"expression");this.expression=t}get type(){return this.expression.type}or(t){let n=t instanceof e?t.expression:t,r=this.expression;return r.type==="group"&&r.logic==="or"?new e({type:"group",logic:"or",conditions:[...r.conditions,n]}):new e({type:"group",logic:"or",conditions:[r,n]})}and(t){let n=t instanceof e?t.expression:t,r=this.expression;return r.type==="group"&&r.logic==="and"?new e({type:"group",logic:"and",conditions:[...r.conditions,n]}):new e({type:"group",logic:"and",conditions:[r,n]})}};function $p(e){function t(n,r){return new ve({type:"condition",field:e,operator:n,value:r})}return{equals:n=>t("equals",n),notEquals:n=>t("notEquals",n),in:n=>t("in",n),notIn:n=>t("notIn",n),greaterThan:n=>t("greaterThan",n),lessThan:n=>t("lessThan",n),greaterThanOrEqual:n=>t("greaterThanOrEqual",n),lessThanOrEqual:n=>t("lessThanOrEqual",n),exists:()=>t("exists"),notExists:()=>t("notExists"),contains:n=>t("contains",n)}}function jp(e){let t=e instanceof ve?e.expression:e,n=new Set;function r(o){if(o.type==="condition")n.add(o.field);else for(let s of o.conditions)r(s)}return r(t),n}var Vo=new Set(["http:","https:","mailto:","tel:","blob:"]);function Hp(e){if(!e||typeof e!="string")return"";let t=e.trim();if(/^[/.?#]/.test(t))return t;try{let n=new URL(t);if(Vo.has(n.protocol))return t}catch{return t}return""}function Gp(){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,n=>n.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}var zp=3e4,Xp=15e3;function Qp(e,t,n){if(n?.aborted)return Promise.reject(Cn(n.reason));let r=t>0;return!r&&!n?e:new Promise((o,s)=>{let a=!1,l;function d(){a=!0,l!==void 0&&(clearTimeout(l),l=void 0),n&&n.removeEventListener("abort",f)}function f(){a||(d(),s(Cn(n?.reason)))}n&&n.addEventListener("abort",f,{once:!0}),r&&(l=setTimeout(()=>{a||(d(),s($o(t)))},t)),e.then(m=>{a||(d(),o(m))},m=>{a||(d(),s(m))})})}function $o(e){let t=new Error(`Operation timed out after ${e}ms`);return t.name="TimeoutError",t}function Cn(e){if(e instanceof Error){let n=new Error(e.message);return n.name="AbortError",n}let t=new Error(typeof e=="string"?e:"Operation was aborted");return t.name="AbortError",t}var pt=J.map(e=>({value:e,label:`crud:status.${e}`})),Vm=ke;var jo=[...de,"status"];function $m(e){return jo.some(t=>t===e)}function In(e){return de.some(t=>t===e)}var w={status:{name:"status",type:"select",visibility:"admin",label:"crud:fields.status",editable:"admin",validation:{required:!0,options:[...pt]}},id:{name:"id",type:"text",visibility:"hidden",label:"crud:fields.id",validation:{required:!0}},createdAt:{name:"createdAt",type:"timestamp",visibility:"technical",label:"crud:fields.createdAt",validation:{}},updatedAt:{name:"updatedAt",type:"timestamp",visibility:"technical",label:"crud:fields.updatedAt",validation:{}},createdById:{name:"createdById",type:"reference",visibility:"technical",label:"crud:fields.createdById",validation:{}},updatedById:{name:"updatedById",type:"reference",visibility:"technical",label:"crud:fields.updatedById",validation:{}}};var Le=e=>{let t=[];return e.validation?.minLength!==void 0&&t.push(c.minLength(e.validation.minLength,`Must be at least ${e.validation.minLength} characters`)),e.validation?.maxLength!==void 0&&t.push(c.maxLength(e.validation.maxLength,`Must be at most ${e.validation.maxLength} characters`)),e.validation?.pattern&&t.push(c.regex(new RegExp(e.validation.pattern),"Invalid format")),t.length>0?c.pipe(c.string(),...t):c.string()},qo=()=>c.pipe(c.string(),c.email("Invalid email address")),Wo=e=>e.validation?.minLength!==void 0?c.pipe(c.string(),c.minLength(e.validation.minLength,`Must be at least ${e.validation.minLength} characters`)):c.string(),Ho=()=>c.pipe(c.string(),c.url("Invalid URL")),oe=e=>{let t=[];return e.validation?.min!==void 0&&t.push(c.minValue(e.validation.min,`Must be at least ${e.validation.min}`)),e.validation?.max!==void 0&&t.push(c.maxValue(e.validation.max,`Must be at most ${e.validation.max}`)),t.length>0?c.pipe(c.number(),...t):c.number()},wn=()=>c.boolean(),mt=()=>c.pipe(c.string(),c.check(e=>!isNaN(new Date(e).getTime()),"Invalid date format")),Ko=/^(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)?$/,Go=/^\d{4}-W(?:0[1-9]|[1-4]\d|5[0-3])$/,Yo=/^\d{4}-(?:0[1-9]|1[0-2])$/,zo=()=>c.pipe(c.string(),c.regex(Ko,"Invalid time format")),Xo=()=>c.pipe(c.string(),c.regex(Go,"Invalid week format")),Qo=()=>c.pipe(c.string(),c.regex(Yo,"Invalid month format")),Ln=c.object({url:c.string(),filename:c.string(),size:c.number(),mimeType:c.nullish(c.string()),uploadedAt:c.nullish(c.string())}),On=()=>Ln,Pn=()=>c.array(Ln),Bn=c.object({fullUrl:c.string(),thumbUrl:c.string()}),Zo=()=>c.union([c.string(),Bn]),Jo=()=>c.array(c.union([c.string(),Bn])),ei=()=>c.object({lat:c.number(),lng:c.number()}),ti=()=>c.object({formatted_address:c.string(),latitude:c.number(),longitude:c.number(),street_number:c.nullish(c.string()),route:c.nullish(c.string()),locality:c.nullish(c.string()),administrative_area_level_1:c.nullish(c.string()),administrative_area_level_2:c.nullish(c.string()),country:c.nullish(c.string()),postal_code:c.nullish(c.string())}),ni=()=>c.record(c.string(),c.unknown()),ri=()=>c.array(c.unknown()),oi=()=>c.array(c.record(c.string(),c.unknown())),ft=e=>{let t=e.validation?.options;return Array.isArray(t)&&t.length>0?c.picklist(t.map(n=>n.value)):c.union([c.string(),c.number()])},ii=e=>{let t=e.validation?.options;return Array.isArray(t)&&t.length>0?c.array(c.picklist(t.map(n=>n.value))):c.array(c.string())},Vn=()=>c.pipe(c.string(),c.minLength(1,"Invalid ID format")),gt=()=>c.string(),si=/^(?:\+[1-9](?:[ .-]?\d){7,14}|0[1-9](?:[ .-]?\d{2}){4})$/,ai=e=>{let t=e.validation?.pattern?new RegExp(e.validation.pattern):si;return c.pipe(c.string(),c.regex(t,"Invalid phone number"))},li=e=>{let t=e.validation?.minLength??15,n=e.validation?.maxLength??34,r=e.validation?.pattern??"^[A-Z]{2}[0-9]{2}[A-Z0-9]{4,34}$";return c.pipe(c.string(),c.minLength(t,`IBAN must be at least ${t} characters`),c.maxLength(n,`IBAN must not exceed ${n} characters`),c.regex(new RegExp(r),"Invalid IBAN format"))},Dn=()=>c.never();function $n(e){let t=e.options?.fieldSpecific;if(t?.checkedValue&&t?.uncheckedValue)return[t.checkedValue,t.uncheckedValue]}var ui=e=>{let t=$n(e);return t?c.picklist(t):c.boolean()},Fn=c.looseObject({gdprConsent:c.literal(!0),gdprConsentDate:c.optional(c.string()),gdprConsentVersion:c.optional(c.string())},"GDPR consent must be given"),ci=e=>e.validation?.required?Fn:c.union([c.literal(!1),Fn]),di=()=>c.object({amount:c.number(),currency:c.optional(c.string()),vatIncluded:c.optional(c.boolean()),discountPercent:c.optional(c.pipe(c.number(),c.minValue(0),c.maxValue(100)))}),jn={text:{schema:Le,kind:"text"},textarea:{schema:Le,kind:"text"},richtext:{schema:Le,kind:"text"},color:{schema:Le,kind:"text"},email:{schema:qo,kind:"text"},password:{schema:Wo,kind:"text"},url:{schema:Ho,kind:"text"},tel:{schema:ai,kind:"text"},iban:{schema:li,kind:"text"},number:{schema:oe,kind:"number"},currency:{schema:oe,kind:"number"},range:{schema:oe,kind:"number"},year:{schema:oe,kind:"number"},rating:{schema:oe,kind:"number"},duration:{schema:oe,kind:"number"},price:{schema:di,kind:"json"},boolean:{schema:wn,kind:"boolean"},checkbox:{schema:wn,kind:"boolean"},switch:{schema:ui,kind:e=>$n(e)?"text":"boolean"},gdprConsent:{schema:ci,kind:"json"},date:{schema:mt,kind:"date"},"datetime-local":{schema:mt,kind:"timestamp"},timestamp:{schema:mt,kind:"timestamp"},time:{schema:zo,kind:"time"},week:{schema:Xo,kind:"text"},month:{schema:Qo,kind:"text"},file:{schema:On,kind:"json"},files:{schema:Pn,kind:"json"},document:{schema:On,kind:"json"},documents:{schema:Pn,kind:"json"},image:{schema:Zo,kind:"json"},images:{schema:Jo,kind:"json"},geopoint:{schema:ei,kind:"json"},address:{schema:ti,kind:"json"},map:{schema:ni,kind:"json"},array:{schema:ri,kind:"json"},"field-array":{schema:oi,kind:"json"},select:{schema:ft,kind:"text"},radio:{schema:ft,kind:"text"},combobox:{schema:ft,kind:"text"},multiselect:{schema:ii,kind:"json"},reference:{schema:Vn,kind:"ref"},hidden:{schema:gt,kind:"text"},avatar:{schema:gt,kind:"text"},badge:{schema:gt,kind:"text"},submit:{schema:Dn,kind:"text"},reset:{schema:Dn,kind:"text"}},pi=new Set(Nt);function mi(e){return pi.has(e)}var fi=new Set(["optional","exact_optional","nullable","nullish","undefinedable","non_nullable","non_nullish","non_optional"]),gi=new Set(["object","loose_object","strict_object","object_with_rest","record","array","tuple","loose_tuple","strict_tuple","tuple_with_rest","intersect"]),hi=new Set(["trim","trim_start","trim_end","to_lower_case","to_upper_case","to_min_value","to_max_value","normalize","brand","flavor","readonly"]),yi={iso_date:"date",iso_time:"time",iso_time_second:"time",iso_date_time:"timestamp",iso_timestamp:"timestamp"};function j(e,t){return t in e?Reflect.get(e,t):void 0}function Nn(e){if(typeof e=="string")return"text";if(typeof e=="number")return"number";if(typeof e=="boolean")return"boolean"}function _n(e){if(e.length===0||e.some(n=>n===void 0))return;let t=new Set(e);return t.size===1?e[0]:t.has("json")?"json":void 0}function Be(e){if(typeof e!="object"||e===null)return;let t=j(e,"type");if(typeof t!="string")return;let n=vi(e,t),r=j(e,"pipe");if(Array.isArray(r))for(let o of r.slice(1)){if(typeof o!="object"||o===null)continue;let s=j(o,"kind"),a=j(o,"type");if(typeof a=="string"){if(s==="schema")n=Be(o);else if(s==="transformation")hi.has(a)||(n=void 0);else if(s==="validation"){a==="integer"&&n==="number"&&(n="integer");let l=yi[a];l&&n==="text"&&(n=l)}}}return n}function vi(e,t){if(fi.has(t))return Be(j(e,"wrapped"));if(gi.has(t))return"json";switch(t){case"string":return"text";case"number":return"number";case"bigint":return"integer";case"boolean":return"boolean";case"date":return"timestamp";case"literal":return Nn(j(e,"literal"));case"picklist":case"enum":{let n=j(e,"options");return Array.isArray(n)?_n(n.map(Nn)):void 0}case"union":case"variant":{let n=j(e,"options");if(!Array.isArray(n))return;let r=n.filter(o=>{let s=typeof o=="object"&&o!==null?j(o,"type"):void 0;return s!=="null"&&s!=="undefined"});return _n(r.map(Be))}default:return}}function Un(e,t){let{kind:n}=jn[e];return typeof n=="function"?n(t):n}function ht(e,t=e.name){let n=e.validation?.reference,r=n?{ref:n}:{},o=e.type,s=mi(o)?o:void 0,a=e.validation?.schema;if(a){let l=(n?"ref":void 0)??Be(a)??(s?Un(s,e):void 0);if(!l)throw new Error(`Field '${t}' (custom type '${o}'): the storage kind of its validation.schema cannot be read. Root the schema on a Valibot string, number, boolean, picklist, object or array schema, or set validation.reference.`);return{schema:a,kind:l,...r}}if(n)return{schema:Vn(),kind:"ref",...r};if(s)return{schema:jn[s].schema(e),kind:Un(s,e)};throw new Error(`Field '${t}' has custom type '${o}' and no value shape. Add validation.schema (a Valibot schema of the stored value) or validation.reference (the referenced collection) to the field, or use a built-in type.`)}function bi(e){return e.validation?.required===!0?"always":e.conditions?.required!==void 0?"conditional":"never"}function Ei(e,t){return t.visibility==="hidden"||t.editable===q.GENERATED||In(e)?"never":t.editable===q.FALSE?"program":t.editable===q.COMPUTED?"derived":"user"}function Si(e,t){return(n,r)=>{if(t!=="user")return!1;let o=e.editable;return o===void 0||o===q.TRUE?e.visibility!=="technical":o===q.CREATE_ONLY?r==="create":typeof o=="string"?Y(n,o):!1}}function xi(e,t,n){let r=Ei(e,t);return{value:ht(t,`${n}.${e}`),required:bi(t),write:r,editableFor:Si(t,r),visibleAt:t.visibility,...t.i18n===!0&&{companion:ye(e)}}}var Mn=new WeakMap;function Ve(e){let t=Mn.get(e);if(t)return t;let n={};for(let[o,s]of Object.entries(e.fields))n[o]=xi(o,s,e.name);let r={name:e.name,collection:e.collection,fields:n};return Mn.set(e,r),r}function Ti(e,t){return t?ie.pipe(e,ie.check(n=>n!=="","Required")):ie.nullish(e)}function z(e){return Ti(ht(e).schema,e.validation?.required)}var qn=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/;function Wn(e){return typeof e=="string"&&e.length>=19&&e.includes("-")&&e.includes(":")}function Hn(e){return typeof e=="object"&&e!==null}function $e(e,t=""){if(Array.isArray(e))e.forEach((n,r)=>{let o=`${t}[${r}]`;if(typeof n=="string"&&Wn(n)){if(!qn.test(n))throw A(new Error(`Invalid date format for ${o}. Expected ISO string (YYYY-MM-DDTHH:mm:ss.sssZ). Received: "${n}"`),{userMessage:`Invalid date format for ${o}. Expected ISO string (YYYY-MM-DDTHH:mm:ss.sssZ). Received: "${n}"`,context:{field:o,value:n},severity:"error"})}else Hn(n)&&$e(n,o)});else if(typeof e=="object"&&e!==null)for(let[n,r]of Object.entries(e)){let o=t?`${t}.${n}`:n;if(typeof r=="string"&&Wn(r)){if(!qn.test(r))throw A(new Error(`Invalid date format for field "${o}". Expected ISO string (YYYY-MM-DDTHH:mm:ss.sssZ). Received: "${r}"`),{userMessage:`Invalid date format for field "${o}". Expected ISO string (YYYY-MM-DDTHH:mm:ss.sssZ). Received: "${r}"`,context:{field:o,value:r},severity:"error"})}else Hn(r)&&$e(r,o)}}import*as Gn from"valibot";var yt={};function Zm(e){yt.uniqueConstraintValidator=e}async function Kn(e,t,n){let{uniqueFields:r=[],collection:o}=e.metadata;if(r.length!==0){if(!yt.uniqueConstraintValidator){process.env.NODE_ENV;return}await Promise.all(r.map(async({field:s,errorMessage:a})=>{let l=t[s];if(l==null)return;if(await yt.uniqueConstraintValidator.checkDuplicate(o,s,l,n))throw A(new Error(a||`${s} must be unique`),{userMessage:a||`${s} must be unique`,context:{field:s}})}))}}async function nf(e,t,n,r){Gn.parse(e,t),$e(t),await Kn(e,t,r),e.metadata.customValidate&&await e.metadata.customValidate(t,n)}function Ri(e){return e!=null&&typeof e=="object"&&"metadata"in e&&typeof e.metadata=="object"&&e.metadata!==null}function pf(e){if(!Ri(e)){let t=e,n=t&&typeof t=="object"&&"constructor"in t&&t.constructor&&t.constructor.name||"unknown";throw A(new Error("Schema does not have metadata"),{userMessage:"Invalid schema: missing collection metadata",severity:"error",context:{schemaType:n}})}return e.metadata.collection}var Yn=()=>Ne("entity-registry",()=>new Map);function zn(e){Yn().set(e.collection,e)}function ki(e){return Yn().get(e)}var Ai=new Set(["__proto__","constructor","prototype"]);function Ci(e){for(let t of Object.keys(e.fields))if(Ai.has(t))throw A(new Error(`Field name '${t}' in entity '${e.name}' is a reserved JavaScript property and cannot be used as a field name.`),{userMessage:`Field name '${t}' in entity '${e.name}' is a reserved JavaScript property and cannot be used as a field name.`,context:{entityName:e.name,fieldName:t,operation:"defineEntity"},severity:"error"})}function Ii(e){let t=e.field.endsWith("Id")?e.field.slice(0,-2):e.field,n=e.collection||(t.endsWith("y")?t.slice(0,-1)+"ies":t+"s");return{name:e.field,label:`crud:fields.${e.field}`,type:"reference",visibility:"technical",editable:q.CREATE_ONLY,validation:{required:!0,reference:n}}}function wi(e,t){if(!t||t.length===0)return e.map(o=>({value:o.value,label:o.label}));let n=e.map(o=>({value:o.value,label:o.label})),r=new Set(e.map(o=>o.value));for(let o of t)r.has(o.value)||n.push(o);return n}function Oi(e,t){if(!(!e.uniqueKeys||e.uniqueKeys.length===0))for(let n=0;n<e.uniqueKeys.length;n++){let r=e.uniqueKeys[n];if(!r)continue;if(!r.fields||r.fields.length===0)throw A(new Error(`uniqueKeys[${n}] for entity '${e.name}' must have at least one field`),{userMessage:`uniqueKeys[${n}] for entity '${e.name}' must have at least one field`,context:{entityName:e.name,uniqueKeyIndex:n},severity:"error"});let o=r.fields.filter(s=>!t.has(s));if(o.length>0)throw A(new Error(`uniqueKeys[${n}] for entity '${e.name}' references non-existent fields: ${o.join(", ")}`),{userMessage:`uniqueKeys[${n}] for entity '${e.name}' references non-existent fields: ${o.join(", ")}`,context:{entityName:e.name,uniqueKeyIndex:n,invalidFields:o},severity:"error"})}}function Pi(e){let{form:t,fields:n}=e,r=Object.keys(n);if(t){if(t.type==="multi-step"||t.type==="wizard"){if(!t.steps||t.steps.length===0)throw A(new Error(`Multi-step form for entity '${e.name}' must have at least one step`),{userMessage:`Multi-step form for entity '${e.name}' must have at least one step`,context:{entityName:e.name,operation:"validateFormConfig"},severity:"error"});let o=t.steps.flatMap(d=>d.fields),s=o.filter(d=>!r.includes(d));if(s.length>0)throw A(new Error(`Multi-step form for entity '${e.name}' references non-existent fields: ${s.join(", ")}`),{userMessage:`Multi-step form for entity '${e.name}' references non-existent fields: ${s.join(", ")}`,context:{entityName:e.name,invalidFields:s,operation:"validateFormConfig"},severity:"error"});let a=new Set(o);r.filter(d=>!a.has(d)).length>0&&process.env.NODE_ENV}t.rules&&t.rules.forEach((o,s)=>{let l=(Array.isArray(o.condition)?o.condition.map(m=>m.field):[o.condition.field]).filter(m=>!r.includes(m));if(l.length>0)throw A(new Error(`Dynamic form rule ${s} for entity '${e.name}' references non-existent condition fields: ${l.join(", ")}`),{userMessage:`Dynamic form rule ${s} for entity '${e.name}' references non-existent condition fields: ${l.join(", ")}`,context:{entityName:e.name,ruleIndex:s,invalidFields:l,operation:"validateFormConfig"},severity:"error"});let f=[...o.showFields||[],...o.hideFields||[],...o.disableFields||[],...o.enableFields||[]].filter(m=>!r.includes(m));if(f.length>0)throw A(new Error(`Dynamic form rule ${s} for entity '${e.name}' references non-existent affected fields: ${f.join(", ")}`),{userMessage:`Dynamic form rule ${s} for entity '${e.name}' references non-existent affected fields: ${f.join(", ")}`,context:{entityName:e.name,ruleIndex:s,invalidFields:f,operation:"validateFormConfig"},severity:"error"})}),Object.entries(n).forEach(([o,s])=>{if(s.dependsOn&&!r.includes(s.dependsOn.field))throw A(new Error(`Field '${o}' in entity '${e.name}' depends on non-existent field: ${s.dependsOn.field}`),{userMessage:`Field '${o}' in entity '${e.name}' depends on non-existent field: ${s.dependsOn.field}`,context:{entityName:e.name,fieldName:o,dependsOnField:s.dependsOn.field,operation:"validateFormConfig"},severity:"error"})})}}function Di(e){return e.form?{type:"single",behavior:{showProgress:!1,allowStepNavigation:!0,validateOnStepChange:!0,showStepNumbers:!0},layout:{columns:1,showLabels:!0,showHints:!0},...e.form}:{type:"single",behavior:{showProgress:!1,allowStepNavigation:!0,validateOnStepChange:!0,showStepNumbers:!0},layout:{columns:1,showLabels:!0,showHints:!0}}}function Sf(e){let t=e;try{Ci(t),Pi(t);let n=Di(t),r={...t.fields,...w,...t.fields.createdAt&&{createdAt:{...w.createdAt,...t.fields.createdAt,type:w.createdAt.type,visibility:w.createdAt.visibility}},...t.fields.updatedAt&&{updatedAt:{...w.updatedAt,...t.fields.updatedAt,type:w.updatedAt.type,visibility:w.updatedAt.visibility}},...t.fields.createdById&&{createdById:{...w.createdById,...t.fields.createdById,type:w.createdById.type,visibility:w.createdById.visibility}},...t.fields.updatedById&&{updatedById:{...w.updatedById,...t.fields.updatedById,type:w.updatedById.type,visibility:w.updatedById.visibility}},...t.fields.status&&{status:{...w.status,...t.fields.status,validation:{...w.status.validation,...t.fields.status.validation,options:wi(pt,t.fields.status.validation?.options)}}},...t.scope&&{[t.scope.field]:Ii(t.scope)}};if(t.listFields){let l=new Set(Object.keys(r)),d=t.listFields.filter(f=>!l.has(f));if(d.length>0)throw A(new Error(`Entity '${t.name}' defines listFields that do not exist: ${d.join(", ")}`),{userMessage:`Entity '${t.name}' defines listFields that do not exist: ${d.join(", ")}`,context:{entityName:t.name,invalidFields:d,operation:"defineEntity"},severity:"error"})}if(t.listCardFields){let l=new Set(Object.keys(r)),f=Ue(t).filter(m=>!l.has(m));if(f.length>0)throw A(new Error(`Entity '${t.name}' defines listCardFields that do not exist: ${f.join(", ")}`),{userMessage:`Entity '${t.name}' defines listCardFields that do not exist: ${f.join(", ")}`,context:{entityName:t.name,invalidFields:f,operation:"defineEntity"},severity:"error"})}if(t.uniqueKeys){let l=new Set(Object.keys(r));Oi(t,l)}let o={...Qe,...t.access||{}},s=t.namespace||`entity-${t.name.toLowerCase()}`,a={...t,form:n,fields:r,access:o,namespace:s,...t.search&&{search:t.search},...t.defaultSort&&{defaultSort:t.defaultSort}};try{Ve(a)}catch(l){let d=l instanceof Error?l.message:String(l);throw A(new Error(d),{userMessage:d,context:{entityName:t.name,operation:"defineEntity"},severity:"error"})}return zn(a),a}catch(n){throw A(n,{userMessage:`Failed to define entity '${t.name}'`,context:{entityName:t.name,operation:"defineEntity"},severity:"error"})}}import*as O from"valibot";function _(e){let t=e?.status;return typeof t=="string"?t:null}function qe({op:e,status:t,storedStatus:n}){return je(t??n,"saveIncomplete")?"draft":e==="create"?"create":"update"}function Xn({op:e,status:t,storedStatus:n}){if(e!=="update")return!1;let r=t??n;return r==null||r===n?!1:je(n,"holdIncomplete")&&!je(r,"holdIncomplete")}function Qn(e){return e!=null&&Object.hasOwn(V,e)?V[e]:Dt}function je(e,t){return Qn(e)[t]}function We(e,t){let n=Qn(e).read;return n==="guest"||Y(t,n)}function vt(e){return Object.keys(V).filter(t=>V[t][e])}function Q(e,t){return Object.assign(e,{visibility:t})}function X(e,t){return Object.assign(e,{metadata:{collection:t.collection,entity:t.name,...t.uniqueKeys&&{uniqueKeys:t.uniqueKeys},...t.security&&{security:t.security}}})}function Fi(e){let t=z(e);return Q(t,e.visibility)}function Ni(e,t){if(!ut.includes(t.type))throw new Error(`Field '${e}' has i18n: true but type '${t.type}'. Translatable types: ${ut.join(", ")}.`);let n=z({...t,validation:{...t.validation,required:!1}});return Q(O.optional(O.nullable(O.record(O.string(),n))),t.visibility)}function se(e,t){for(let n of Object.keys(e)){let r=t[n];r?.i18n===!0&&(e[ye(n)]=Ni(n,r))}return e}function bt(e){let t=z({...e,validation:{...e.validation,required:!1}});return Q(t,e.visibility)}function _i(e){return e.validation?.required?Q(O.optional(z(e)),e.visibility):bt(e)}function Pf(e){let t=e.fields,n=Ve(e).fields,r=I=>n[I]?.write==="never",o={};for(let[I,N]of Object.entries(t))n[I]?.visibleAt!=="hidden"&&(o[I]=bt(N));let s=X(O.object(se({...o},t)),e),a={};for(let[I,N]of Object.entries(t))r(I)||(a[I]=Fi(N));let l=X(O.object(se({...a},t)),e),d={};for(let[I,N]of Object.entries(t))if(!r(I))if(I==="status"){let H=O.picklist(vt("saveIncomplete"));d[I]=Q(H,N.visibility)}else d[I]=bt(N);let f=X(O.object(se({...d},t)),e),m={};for(let[I,N]of Object.entries(t))r(I)||(m[I]=_i(N));m.id=Q(z(w.id),"technical");let E=X(O.object(se({...m},t)),e),C;if(e.listFields&&e.listFields.length>0){let I=["id","status"],N=[...new Set([...I,...e.listFields])];C={};for(let H of N){let le=o[H];le&&(C[H]=le)}}else C=o;let P=X(O.object(se({...C},t)),e),x,L=Ue(e);if(L.length>0){let I=["id","status"],N=[...new Set([...I,...L])];x={};for(let H of N){let le=o[H];le&&(x[H]=le)}}else x=o;let Ee=X(O.object(se({...x},t)),e),ir=X(O.object({id:Q(z(w.id),"technical")}),e);return{create:l,draft:f,update:E,get:s,list:P,listCard:Ee,delete:ir}}function Ff(e,t,n=1,r=!1){let o=[];if(r)for(let s=t;s>=e;s-=n)o.push({value:String(s),label:String(s)});else for(let s=e;s<=t;s+=n)o.push({value:String(s),label:String(s)});return o}var Z=new Map;function _f(e,t){Z.has(e)&&process.env.NODE_ENV,Z.set(e,t)}function Uf(e){Z.delete(e)}function Mf(e){let t=Z.get(e);return t?t():(process.env.NODE_ENV,null)}function Lf(e){return Z.has(e)}function Bf(){return Array.from(Z.keys())}function Vf(){Z.clear()}import*as y from"valibot";var Ui=y.record(y.string(),y.unknown()),Mi=y.object({id:y.string(),patch:y.record(y.string(),y.unknown())}),Li=y.string(),jf=y.object({inserts:y.optional(y.array(Ui)),updates:y.optional(y.array(Mi)),deletes:y.optional(y.array(Li))}),Bi=y.object({insertedIds:y.array(y.string()),updatedIds:y.array(y.string()),deletedIds:y.array(y.string())}),Vi=y.variant("op",[y.object({op:y.literal("insert"),index:y.pipe(y.number(),y.integer(),y.minValue(0)),id:y.optional(y.string()),error:y.string()}),y.object({op:y.literal("update"),id:y.string(),index:y.optional(y.pipe(y.number(),y.integer(),y.minValue(0))),error:y.string()}),y.object({op:y.literal("delete"),id:y.string(),index:y.optional(y.pipe(y.number(),y.integer(),y.minValue(0))),error:y.string()})]),$i=y.object({...Bi.entries,failed:y.optional(y.array(Vi),()=>[])});function qf(e,t){let n=y.parse($i,t),r=l=>{throw new Error(`Invalid bulk acknowledgement: ${l}`)},o=e.inserts??[],s=new Set;for(let l of n.failed){if(l.op!=="insert")continue;(l.index>=o.length||s.has(l.index))&&r("unknown or duplicate insert index");let d=o[l.index];l.id!==void 0&&l.id!==d.id&&r("contradictory insert identity"),s.add(l.index)}n.insertedIds.length+s.size!==o.length&&r("missing or extra insert outcomes"),new Set(n.insertedIds).size!==n.insertedIds.length&&r("duplicate inserted ID");let a=new Set([...s].map(l=>o[l].id).filter(l=>typeof l=="string"));n.insertedIds.some(l=>a.has(l))&&r("insert ID both successful and failed");for(let l of["update","delete"]){let d=l==="update"?(e.updates??[]).map(({id:x})=>x):e.deletes??[],f=l==="update"?n.updatedIds:n.deletedIds,m=new Map;for(let x of d)m.set(x,(m.get(x)??0)+1);let E=new Map,C=new Set;for(let x of n.failed)x.op===l&&((!m.has(x.id)||x.index!==void 0&&d[x.index]!==x.id)&&r(`unknown or contradictory ${l} identity`),x.index!==void 0&&(C.has(x.index)&&r(`duplicate ${l} failure index`),C.add(x.index)),E.set(x.id,(E.get(x.id)??0)+1));let P=d.filter(x=>!E.has(x));for(let[x,L]of E)L!==m.get(x)&&r(`duplicate or ambiguous ${l} failures`);(P.length!==f.length||P.some((x,L)=>f[L]!==x))&&r(`missing, duplicate, unknown or contradictory ${l} outcomes`)}return n}function Wf(e){let t=new Set((e.updates??[]).map(a=>a.id)),n=e.deletes??[],r=[];for(let a of n)t.has(a)&&r.push(a);if(r.length>0)return{collisions:r,where:"updates-deletes"};let o=e.inserts??[],s=[];for(let a of o)typeof a.id=="string"&&t.has(a.id)&&s.push(a.id);return s.length>0?{collisions:s,where:"inserts-updates"}:{collisions:[],where:null}}import*as Zn from"valibot";function ji(e,t){if(e.ok)return e.written;let n=e.issues.map(r=>`${r.path?.map(o=>String(o.key)).join(".")||"root"}: ${r.message}`).join("; ");throw new R(`Validation failed in ${t}: ${n}`,"validation-failed",{details:{issues:e.issues},source:"validation"})}function Jn(e){let t=e.entries;if(!t||typeof t!="object")throw new R("CRUD write rules: a write schema must be an object schema (createSchemas(entity))","internal");return Object.keys(t)}function He(e,t){let n=[e.create,e.draft,e.update].filter(o=>o!==void 0);if(n.some(o=>o.type==="loose_object"))return[];let r=new Set([...n.flatMap(Jn),...de]);return Object.keys(t).filter(o=>!r.has(o))}function er(e,t){let n={};for(let r of Jn(t))n[r]=null;for(let[r,o]of Object.entries(e))o!==void 0&&(n[r]=o);return n}function be(e,t,n,r,o){let s=Zn.safeParse(t,n);if(!s.success)return{ok:!1,schemaKey:e,issues:[...s.issues],unknownKeys:o};let a=s.output,l={};for(let d of Object.keys(r))d!=="id"&&Object.hasOwn(a,d)&&(l[d]=a[d]);return{ok:!0,schemaKey:e,written:l,unknownKeys:o}}function tr(e){return _(e)??ke}function qi(e,t){let n=tr(t),r=qe({op:"create",status:n}),o={...t,status:n},s=be(r,r==="draft"?e.draft:e.create,o,o,He(e,t));return s.ok?{...s,written:{...s.written,status:n}}:s}function nr(e){return _(e)!==Ze}function rr(e,t){let n={op:"update",status:_(e),storedStatus:_(t)};return{schemaKey:qe(n)==="draft"?"draft":"update",whole:Xn(n)}}function or(e,{id:t,patch:n,stored:r}){let o=_(n);if(!r&&nr(n))throw new R(`CRUD update rules: row "${t}" needs its stored row (the row's status${o===null?"":" and the publish check"} come from it); read it before the update.`,"internal");let{schemaKey:s,whole:a}=rr(n,r),l=He(e,n);if(r&&a)return be(s,e.update,er({...r,...n,id:t},e.update),n,l);let d=s==="draft"?{...n,status:_(n)??_(r),id:t}:{...n,id:t};return be(s,s==="draft"?e.draft:e.update,d,n,l)}function Wi(e,t){return or(e,{id:t,patch:{status:Ze}})}function Hi(e){return J.filter(t=>!We(t,e))}function Ki(e,t){return We(_(e),t)}import*as b from"valibot";var pg=b.pipe(b.string(),b.check(e=>e.startsWith("/proxy/")||e.startsWith("data:image/"),"Image URL must be box-proxied (/proxy/...) or an inline data:image URI.")),Gi=b.picklist(["ephemeral","session","persistent"]),Yi=b.object({title:b.optional(b.string()),pinnable:b.optional(b.boolean()),preferredHeight:b.optional(b.pipe(b.number(),b.minValue(0)))}),zi=b.object({id:b.pipe(b.string(),b.minLength(1)),kind:b.pipe(b.string(),b.minLength(1)),lifetime:b.optional(Gi,"ephemeral"),metadata:b.optional(Yi),payload:b.unknown()}),Xi=b.object({widgetId:b.pipe(b.string(),b.minLength(1)),action:b.pipe(b.string(),b.minLength(1)),payload:b.unknown()}),ae=new Map;function mg(e){if(ae.has(e.kind))throw new Error(`[canvas] Widget kind "${e.kind}" already registered.`);ae.set(e.kind,e)}function fg(e){return ae.get(e)}function gg(){return Array.from(ae.values())}function hg(e,t){let n=b.safeParse(zi,e);if(!n.success)return{ok:!1,reason:`Invalid canvas block envelope: ${Ke(n.issues)}`};let r=ae.get(n.output.kind);if(!r)return{ok:!1,reason:`Unknown widget kind: "${n.output.kind}"`};let o=b.safeParse(r.schema,n.output.payload);if(!o.success)return{ok:!1,reason:`Payload rejected by "${n.output.kind}" schema: ${Ke(o.issues)}`};if(t?.caller!==void 0){let a=t.caller.access;if(!Qi(r.surface,a))return{ok:!1,reason:`surface_forbidden: widget "${n.output.kind}" surface=${r.surface} not reachable by caller access=${a===null?"null":a}`}}return{ok:!0,value:{...n.output,payload:o.output},widget:r}}function Qi(e,t){return e==="meta"?!0:e==="household"||e==="private"?t==="admin"||t==="member":!1}function yg(e,t){let n=b.safeParse(Xi,e);if(!n.success)return{ok:!1,reason:`Invalid canvas event envelope: ${Ke(n.issues)}`};let r=ae.get(t);if(!r)return{ok:!1,reason:`Unknown widget kind: "${t}"`};let o=r.actions[n.output.action];if(!o)return{ok:!1,reason:`Widget "${t}" has no action "${n.output.action}"`};let s=b.safeParse(o,n.output.payload);return s.success?{ok:!0,value:{...n.output,payload:s.output},widget:r}:{ok:!1,reason:`Payload rejected by "${t}.${n.output.action}" schema: ${Ke(s.issues)}`}}function Ke(e){return e.map(t=>{let n=t.path?.map(r=>String(r.key)).join(".")??"";return n?`${n}: ${t.message}`:t.message}).join("; ")}export{Aa as AGGREGATE_FILTER_OPERATORS,ka as AGGREGATE_OPERATIONS,cr as AIChatRequestSchema,pr as AIChatResponseSchema,Et as AIMessageSchema,as as AIProviderConfigSchema,ur as AIToolCallSchema,lr as AIToolDefinitionSchema,dr as AIUsageSchema,ts as AI_ERROR_CODES,Ji as AI_MODELS,U as AI_PROVIDERS,Se as AI_ROLES,ns as AI_TIERS,os as AI_TOKEN_PRICING,pl as AUTH_EVENTS,jt as AUTH_PARTNERS,ws as AUTH_PARTNER_STATE,_t as AtomicBulkError,dt as AuthHardening,St as AuthUserSchema,de as BACKEND_GENERATED_FIELD_NAMES,fl as BILLING_EVENTS,Dr as BREAKPOINT_RANGES,et as BREAKPOINT_THRESHOLDS,jn as BUILTIN_VALUES,J as BUILT_IN_STATUSES,Mt as BulkAcrossCycleError,Ut as BulkCollisionError,Li as BulkDeleteIdSchema,Ui as BulkInsertSchema,Lt as BulkNotImplementedError,Vi as BulkOutcomeFailureSchema,$i as BulkOutcomeSchema,jf as BulkRequestSchema,Bi as BulkResponseSchema,Mi as BulkUpdateSchema,Ye as COMMON_TIER_CONFIGS,pa as CONFIDENCE_LEVELS,Wt as CONSENT_CATEGORY,da as CONTEXTS,K as CRUD_OPERATORS,Xt as CURRENCY_MAP,Dt as CUSTOM_STATUS,zi as CanvasBlockSchema,Xi as CanvasEventSchema,Gi as CanvasLifetimeSchema,Yi as CanvasWidgetMetadataSchema,yr as CheckoutLineItemInputSchema,Pt as CheckoutSessionMetadataSchema,ve as ConditionBuilder,Ct as CreateCheckoutSessionRequestSchema,It as CreateCheckoutSessionResponseSchema,Tt as CustomClaimsSchema,es as DEFAULT_AI_CONFIG,rs as DEFAULT_AI_MARKUP,Xp as DEFAULT_CRUD_TIMEOUT,Qe as DEFAULT_ENTITY_ACCESS,ee as DEFAULT_ERROR_MESSAGES,Nr as DEFAULT_LAYOUT_PRESET,_r as DEFAULT_OG_IMAGE,ke as DEFAULT_STATUS,pt as DEFAULT_STATUS_OPTIONS,Vm as DEFAULT_STATUS_VALUE,Te as DEFAULT_SUBSCRIPTION,zp as DEFAULT_UPLOAD_TIMEOUT,Eu as DENSITY,R as DoNotDevError,q as EDITABLE,Qa as EMAIL_ERROR_CODES,Xa as EMAIL_PROVIDERS,Is as EMAIL_VERIFICATION_STATUS,Ae as ENTITY_HOOK_ERRORS,ca as ENVIRONMENTS,pe as ERROR_CODES,sl as ERROR_SEVERITY,al as ERROR_SOURCE,Bt as EntityHookError,kd as FAVICON_DEFAULTS,ze as FEATURES,Su as FEATURE_CONSENT_MATRIX,ma as FEATURE_STATUS,ro as FIELD_TEXT_FORMATTERS,Nt as FIELD_TYPES,Je as FIREBASE_ERROR_MAP,Id as FONT_STYLE_ID,Ur as FOOTER_MODE,Vt as GITHUB_PERMISSION_LEVELS,Ir as HIDDEN_STATUSES,lp as LANGUAGE_COOKIE,Mr as LAYOUT_PRESET,xa as LIST_SCHEMA_TYPE,Rt as MAX_CHECKOUT_LINE_ITEMS,At as MAX_SHIPPING_RATE_IDS,hl as OAUTH_EVENTS,qt as OAUTH_PARTNERS,Sa as ORDER_DIRECTION,iu as PARTNER_ICONS,vl as PAYLOAD_EVENTS,Xe as PERMISSIONS,ua as PLATFORMS,vd as PRERENDERED_HEAD_ELEMENT_ID,ya as PWA_ASSET_TYPES,ha as PWA_DISPLAY_MODES,xr as ProductDeclarationSchema,Js as ProductDeclarationsSchema,pg as ProxiedImageUrlSchema,Ze as REMOVED_STATUS,va as ROUTE_SOURCES,Io as SESSION_RENDER_SEGMENT,Eo as SITE_LOGO_PATH,V as STATUS_MATRIX,ga as STORAGE_SCOPES,fa as STORAGE_TYPES,El as STRIPE_EVENTS,Re as STRIPE_MODES,Ls as SUBSCRIPTION_DURATIONS,xe as SUBSCRIPTION_STATUS,gr as SUBSCRIPTION_TIERS,wr as SendEmailRequestSchema,Or as SendEmailResponseSchema,he as SingletonManager,Cr as StripeBackConfigSchema,Tr as StripeFrontConfigSchema,Ar as StripeOrderBackSchema,kr as StripeOrderShippingSchema,Rr as StripeOrderTaxSchema,Er as StripePaymentSchema,Sr as StripeSubscriptionSchema,B as SubscriptionClaimsSchema,wt as SubscriptionDataSchema,jo as TECHNICAL_FIELD_NAMES,ut as TRANSLATABLE_FIELD_TYPES,D as USER_ROLES,xt as UserSubscriptionSchema,Ea as VISIBILITY,vr as VerifyOrderCheckoutRequestSchema,br as VerifyOrderCheckoutResultSchema,Ot as WebhookEventSchema,ji as assertWrite,w as baseFields,Sd as breadcrumbNamespaces,xd as buildBreadcrumbJsonLd,sd as buildProductJsonLd,Yt as captureErrorToSentry,zl as checkGitHubAccessSchema,Kd as clearGlobalSingleton,Vf as clearScopeProviders,Ie as commonErrorCodeMappings,Qt as compactToISOString,ep as configureProviders,zd as createAsyncSingleton,fr as createDefaultSubscriptionClaims,Os as createDefaultUserProfile,Na as createEntitySchema,$ as createErrorHandler,jc as createMetadata,Xd as createMethodProxy,Pf as createSchemas,Gd as createSingleton,Yd as createSingletonWithParams,tr as createStatus,Sf as defineEntity,Ma as deleteEntitySchema,id as deriveEntitySeo,Ve as describeEntity,xi as describeField,Wf as detectBulkCollisions,Ht as detectErrorSource,Zl as disconnectOAuthSchema,Qu as enhanceSchema,Pc as ensureSpreadable,re as evaluateCondition,Vp as evaluateFieldConditions,Xl as exchangeTokenSchema,Cd as faviconHeadTags,Tp as filterVisibleFields,wd as fontPreloadHeadTags,we as formatCurrency,no as formatDate,sn as formatFieldText,Zc as formatRelativeTime,Oo as formatTrailingSlash,Ao as generateCodeChallenge,ko as generateCodeVerifier,ld as generateFirestoreRuleCondition,Pd as generatePKCEPair,Gp as generateUUID,Fr as getBreakpointFromWidth,Nl as getBreakpointUtils,pf as getCollectionName,jp as getConditionDependencies,Jl as getConnectionsSchema,eo as getCurrencyLocale,Wc as getCurrencySymbol,Yc as getCurrentTimestamp,ki as getEntityByCollection,_a as getEntitySchema,Ne as getGlobalSingleton,Ue as getListCardFieldNames,vo as getPathPrefixes,tp as getProvider,Bf as getRegisteredScopeProviders,$d as getRoleFromClaims,z as getSchemaType,Mf as getScopeValue,ip as getTranslatedFieldNames,Rn as getVisibleFields,Qc as getWeekFromISOString,fg as getWidget,Lr as githubPermissionSchema,tt as githubRepoConfigSchema,Gl as grantGitHubAccessSchema,A as handleError,Ri as hasMetadata,np as hasProvider,Ap as hasRestrictedVisibility,Y as hasRoleAccess,Lf as hasScopeProvider,Wd as hasTierAccess,Hi as hiddenStatusesFor,ye as i18nFieldName,uu as isAuthPartnerId,In as isBackendGeneratedField,Fl as isBreakpoint,Zt as isCompactDateString,rn as isEmptyFieldValue,No as isFieldVisible,$m as isFrameworkField,ct as isMultilingual,cu as isOAuthPartnerId,Dd as isPKCESupported,Ki as isReadableBy,Kc as isoToCompactString,So as jsonScriptText,Po as languageUrl,gp as languageUrls,Ld as lazyImport,La as listEntitiesSchema,gg as listWidgets,Tn as localizePath,te as mapToDoNotDevError,fe as matchRoute,cd as maybeTranslate,Gc as normalizeToISOString,ys as overrideFeatures,Ms as overridePaymentModes,vs as overridePermissions,mr as overrideSubscriptionStatus,hs as overrideSubscriptionTiers,gs as overrideUserRoles,cp as parseAcceptLanguage,Vc as parseBlogFrontmatter,Jt as parseDate,Jc as parseDateToNoonUTC,qi as prepareCreate,Wi as prepareRemove,or as prepareUpdate,mp as publicPathname,Ff as rangeOptions,up as readCookieValue,gn as readI18nSeoMeta,bd as recordHeadTags,Ql as refreshTokenSchema,_f as registerScopeProvider,Zm as registerUniqueConstraintValidator,mg as registerWidget,rp as resetProviders,Ad as resolveFaviconFiles,ht as resolveFieldValue,Sn as resolveLanguage,hp as resolveLanguageRoute,fn as resolveSeoField,Uo as resolveUserSubscription,Yl as revokeGitHubAccessSchema,To as robotsContent,at as routeAncestors,Rd as routeHeadTags,Ro as routeLabel,Td as routeSeo,hn as routeTitle,Oc as safeValidate,Hp as sanitizeHref,fc as showNotification,Ed as siteHeadTags,xn as splitLanguagePath,je as statusCan,_ as statusOf,We as statusReadableBy,vt as statusesThat,st as stripHtmlTags,fp as stripTrailingSlash,Xc as timestampToISOString,ed as toDateOnly,zc as toISOString,zt as translateArray,Mc as translateArrayRange,Lc as translateArrayWithIndices,ot as translateEntityLabel,Uc as translateObjectArray,sp as translateRow,Uf as unregisterScopeProvider,rr as updateCheck,Ua as updateEntitySchema,vp as updateMetadata,nr as updateNeedsStored,ls as validateAIChatRequest,us as validateAIChatResponse,au as validateAuthPartners,As as validateAuthSchemas,Ts as validateAuthUser,na as validateBillingSchemas,hg as validateBlock,qf as validateBulkOutcome,Zs as validateCheckoutSessionMetadata,Nd as validateCodeChallenge,Fd as validateCodeVerifier,Ys as validateCreateCheckoutSessionRequest,zs as validateCreateCheckoutSessionResponse,ks as validateCustomClaims,$e as validateDates,nf as validateDocument,yg as validateEvent,lu as validateOAuthPartners,Ja as validateSendEmailRequest,el as validateSendEmailResponse,ta as validateStripeBackConfig,ea as validateStripeFrontConfig,hr as validateSubscriptionClaims,Xs as validateSubscriptionData,Kn as validateUniqueFields,Rs as validateUserSubscription,Ks as validateVerifyOrderCheckoutRequest,Gs as validateVerifyOrderCheckoutResult,Qs as validateWebhookEvent,wc as validateWithSchema,$p as when,mc as withErrorHandling,Ud as withGracefulDegradation,Qp as withTimeout,Ac as wrapAuthError,Rc as wrapCrudError,kc as wrapStorageError};
|