@donotdev/ui 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- "use client";import{a as Xe,b as oe,c as ua,d as N,e as Fp,f as Bp,g as xe,h as tn,i as Op}from"./chunk-3CIZFGST.js";import{a as ne,b as on,c as nn,d as rn,e as an,f as sn,g as ln,h as cn,i as Et,j as dn,k as lt,l as to,m as un,n as oo,o as pn,p as mn,q as ct,r as fn,s as gn,t as dt,u as no,v as ut,w as ro,x as hn,y as vn,z as yn}from"./chunk-LHMKU342.js";import{a as Tt}from"./chunk-O2XFH626.js";import{User as tl}from"lucide-react";import{Suspense as So,lazy as jn,useState as ol}from"react";import{Button as nl,BUTTON_VARIANT as Zn,DropdownMenu as rl,Dialog as al,DISPLAY as il}from"@donotdev/components";import{useTranslation as sl}from"@donotdev/core";import{useAuthConfig as ll}from"@donotdev/core";import{getEnabledAuthPartners as cl}from"@donotdev/core";import{User as Bs,LogOut as Os,Settings as gt,UserCheck as Ms,Trash2 as zs}from"lucide-react";import{useMemo as Us,lazy as Kn,Suspense as Gn}from"react";import{Avatar as Vs,Button as _s,BUTTON_VARIANT as Hs,DropdownMenu as $s,Text as Ws,DISPLAY as Gs}from"@donotdev/components";import{useTranslation as Ks}from"@donotdev/core";import{getEnabledAuthPartners as qs,useAuthConfig as Ys}from"@donotdev/core";import{useBreakpoint as js}from"@donotdev/core";import{useNavigate as Zs}from"@donotdev/ui/routing/hooks";import{Link as Rt}from"lucide-react";import"@donotdev/components";import{useConsent as pa}from"@donotdev/core";import{useLocalizedPath as ma,useNavigate as fa}from"@donotdev/ui/routing/hooks";import{Fragment as ga,jsx as Fe,jsxs as bn}from"react/jsx-runtime";var D=({path:e,replace:t,prefetch:o=!0,children:n,icon:r,iconEnd:a=!1,label:i,onClick:s,className:l,"aria-label":c,"aria-describedby":d,target:p,rel:h,...f})=>{let m=fa(),u=ma(),g=pa("showCookieBanner");if(e==="#cookie-settings")return bn("a",{href:"#cookie-settings",onClick:b=>{if(b.metaKey||b.ctrlKey||b.shiftKey||b.altKey||b.button!==0){s&&s(b);return}b.preventDefault(),b.stopPropagation();try{g()}catch{}s&&s(b)},className:l,style:{display:r&&(i||n)?"flex":void 0,alignItems:r&&(i||n)?"center":void 0,gap:r&&(i||n)?"var(--gap-sm)":void 0,...f.style},"aria-label":c||i||"Cookie Settings","aria-describedby":d,...f,children:[r&&!a&&Fe(oe,{icon:r,fallback:Rt}),i&&Fe("span",{children:i}),n,r&&a&&Fe(oe,{icon:r,fallback:Rt})]});let y=e.startsWith("http://")||e.startsWith("https://")||e.startsWith("mailto:")||e.startsWith("tel:"),x=P=>{if(y){s&&s(P);return}if(P.metaKey||P.ctrlKey||P.shiftKey||P.altKey||P.button!==0){s&&s(P);return}P.preventDefault(),s&&s(P);let b=e.startsWith("/")||e.startsWith(".")?e:`/${e}`;m(b,{replace:t})},C={"aria-label":c||i,"aria-describedby":d},k=bn(ga,{children:[r&&!a&&Fe(oe,{icon:r,fallback:Rt}),i&&Fe("span",{children:i}),n,r&&a&&Fe(oe,{icon:r,fallback:Rt})]});return y?Fe("a",{href:e,onClick:x,target:p||"_blank",rel:h||"noopener noreferrer",className:l,style:{display:r&&(i||n)?"flex":void 0,alignItems:r&&(i||n)?"center":void 0,gap:r&&(i||n)?"var(--gap-sm)":void 0},...C,...f,children:k}):Fe("a",{href:u(e),onClick:x,className:l,style:{display:r&&(i||n)?"flex":void 0,alignItems:r&&(i||n)?"center":void 0,gap:r&&(i||n)?"var(--gap-sm)":void 0},...C,...f,children:k})};import{useEffect as ha}from"react";import{Spinner as Sn}from"@donotdev/components";import{FEATURE_STATUS as va,USER_ROLES as Pt,SUBSCRIPTION_TIERS as ao,isClient as ya,safeSessionStorage as wn}from"@donotdev/core";import{useRedirectGuard as ba,useNavigate as Sa}from"@donotdev/ui/routing/hooks";import{Fragment as Cn,jsx as He}from"react/jsx-runtime";function wa({auth:e,children:t,fallback:o=()=>He(Sn,{overlay:!0})}){let n=Sa(),r=N("user"),a=N("status"),{shouldRedirect:i,redirectTo:s,isChecking:l}=ba({auth:e});return ha(()=>{i&&s&&(!r&&ya()&&(wn.setItem("dndev.auth.returnTo",window.location.pathname+window.location.search),wn.setItem("dndev.auth.guardToast","1")),n(s,{replace:!0}))},[i,s,n,r]),e===!1?He(Cn,{children:t}):i||l?He(Sn,{overlay:!0}):a===va.INITIALIZING?He(o,{}):He(Cn,{children:t})}function Zp(e){return N("can")?.navigate(e)??!1}function Jp(){return N("user")?.role||Pt.GUEST}function Qp(e){return N("user")?.role===e}function Xp(){let e=N("user"),t=N("userSubscription"),o=N("loading");return{authenticated:!!e,role:e?.role,tier:t?.tier||"free",loading:o,userId:e?.id}}function em(e,t){return n=>He(wa,{auth:t,children:He(e,{...n})})}var tm={public:()=>!1,required:()=>({required:!0}),user:()=>({required:!0,role:Pt.USER}),admin:()=>({required:!0,role:Pt.ADMIN}),tier:e=>({required:!0,tier:e}),pro:()=>({required:!0,tier:ao.PRO}),premium:()=>({required:!0,tier:ao.PREMIUM}),adminPro:()=>({required:!0,role:Pt.ADMIN,tier:ao.PRO}),custom:e=>({required:!0,validate:e})};import{ArrowLeft as Ha,Lock as $a}from"lucide-react";import{Suspense as Wa,lazy as Ga}from"react";import{Card as Ka,Button as qa,Separator as Ya,Stack as tt,cn as ja}from"@donotdev/components";import{useTranslation as Za}from"@donotdev/core";import"@donotdev/core";import{useBack as Ja}from"@donotdev/ui/routing/hooks";import{Suspense as Ua}from"react";import{cn as Va}from"@donotdev/components";import{Component as Ca}from"react";import{handleError as ka}from"@donotdev/core";var io=class extends Ca{constructor(o){super(o);Tt(this,"resetError",()=>{this.setState({hasError:!1,error:null})});this.state={hasError:!1,error:null}}static getDerivedStateFromError(o){return{hasError:!0,error:o}}componentDidCatch(o,n){ka(o,{userMessage:`A ${this.props.level||"component"} error occurred`,context:{errorInfo:n,component:"DnDevErrorBoundary",level:this.props.level||"component"},showNotification:!1})}render(){return this.state.hasError?this.props.fallback({error:this.state.error,resetError:this.resetError,componentStack:null,eventId:null}):this.props.children}},kn=io;import{AlertTriangle as xa,Home as Ta,ArrowLeft as Ea,RotateCw as Ra,Copy as Pa,Check as Aa}from"lucide-react";import{useEffect as Ia,useState as La}from"react";import{Button as At,BUTTON_VARIANT as It,Card as xn,CARD_VARIANT as Tn,Alert as Na,ALERT_VARIANT as Da,Stack as et}from"@donotdev/components";import{handleError as Fa,useTranslation as Ba}from"@donotdev/core";import{useBack as Oa,useRoutePath as Ma}from"@donotdev/ui/routing/hooks";import{jsx as J,jsxs as $e}from"react/jsx-runtime";var za=({error:e,resetError:t,componentStack:o,eventId:n})=>{let{t:r}=Ba("dndev"),[a,i]=La(!1),s=Oa(),l=Ma(),c=e instanceof Error?e.message:"Unknown error",d=e instanceof Error?e.stack:void 0,p=!1;Ia(()=>{try{Fa(e,{userMessage:"Page encountered an error",context:{component:"RouteErrorFallback",location:l}})}catch{}},[e,l]);let h=async()=>{if(!d)return;let u=[`Error: ${c}`,`Timestamp: ${new Date().toISOString()}`,`User Agent: ${navigator.userAgent}`,n?`Event ID: ${n}`:null,`Path: ${l}`,"","Stack Trace:",d,o?`
1
+ "use client";import{a as Xe,b as oe,c as ua,d as N,e as Up,f as Vp,g as xe,h as on,i as _p}from"./chunk-3CIZFGST.js";import{a as ne,b as nn,c as rn,d as an,e as sn,f as ln,g as cn,h as dn,i as Rt,j as un,k as lt,l as oo,m as pn,n as no,o as mn,p as fn,q as ct,r as gn,s as hn,t as dt,u as ro,v as ut,w as ao,x as vn,y as yn,z as bn}from"./chunk-LHMKU342.js";import{a as Et}from"./chunk-O2XFH626.js";import{User as tl}from"lucide-react";import{Suspense as wo,lazy as Zn,useState as ol}from"react";import{Button as nl,BUTTON_VARIANT as Jn,DropdownMenu as rl,Dialog as al,DISPLAY as il}from"@donotdev/components";import{useTranslation as sl}from"@donotdev/core";import{useAuthConfig as ll}from"@donotdev/core";import{getEnabledAuthPartners as cl}from"@donotdev/core";import{User as Bs,LogOut as Os,Settings as gt,UserCheck as Ms,Trash2 as zs}from"lucide-react";import{useMemo as Us,lazy as qn,Suspense as Kn}from"react";import{Avatar as Vs,Button as _s,BUTTON_VARIANT as Hs,DropdownMenu as $s,Text as Ws,DISPLAY as Gs}from"@donotdev/components";import{useTranslation as Ks}from"@donotdev/core";import{getEnabledAuthPartners as qs,useAuthConfig as Ys}from"@donotdev/core";import{useBreakpoint as js}from"@donotdev/core";import{useNavigate as Zs}from"@donotdev/ui/routing/hooks";import{Link as Pt}from"lucide-react";import"@donotdev/components";import{useConsent as pa}from"@donotdev/core";import{useLocalizedPath as ma,useNavigate as fa}from"@donotdev/ui/routing/hooks";import{Fragment as ga,jsx as Fe,jsxs as Sn}from"react/jsx-runtime";var D=({path:e,replace:t,prefetch:o=!0,children:n,icon:r,iconEnd:a=!1,label:i,onClick:s,className:l,"aria-label":c,"aria-describedby":d,target:p,rel:h,...f})=>{let m=fa(),u=ma(),g=pa("showCookieBanner");if(e==="#cookie-settings")return Sn("a",{href:"#cookie-settings",onClick:b=>{if(b.metaKey||b.ctrlKey||b.shiftKey||b.altKey||b.button!==0){s&&s(b);return}b.preventDefault(),b.stopPropagation();try{g()}catch{}s&&s(b)},className:l,style:{display:r&&(i||n)?"flex":void 0,alignItems:r&&(i||n)?"center":void 0,gap:r&&(i||n)?"var(--gap-sm)":void 0,...f.style},"aria-label":c||i||"Cookie Settings","aria-describedby":d,...f,children:[r&&!a&&Fe(oe,{icon:r,fallback:Pt}),i&&Fe("span",{children:i}),n,r&&a&&Fe(oe,{icon:r,fallback:Pt})]});let y=e.startsWith("http://")||e.startsWith("https://")||e.startsWith("mailto:")||e.startsWith("tel:"),x=P=>{if(y){s&&s(P);return}if(P.metaKey||P.ctrlKey||P.shiftKey||P.altKey||P.button!==0){s&&s(P);return}P.preventDefault(),s&&s(P);let b=e.startsWith("/")||e.startsWith(".")?e:`/${e}`;m(b,{replace:t})},C={"aria-label":c||i,"aria-describedby":d},k=Sn(ga,{children:[r&&!a&&Fe(oe,{icon:r,fallback:Pt}),i&&Fe("span",{children:i}),n,r&&a&&Fe(oe,{icon:r,fallback:Pt})]});return y?Fe("a",{href:e,onClick:x,target:p||"_blank",rel:h||"noopener noreferrer",className:l,style:{display:r&&(i||n)?"flex":void 0,alignItems:r&&(i||n)?"center":void 0,gap:r&&(i||n)?"var(--gap-sm)":void 0},...C,...f,children:k}):Fe("a",{href:u(e),onClick:x,className:l,style:{display:r&&(i||n)?"flex":void 0,alignItems:r&&(i||n)?"center":void 0,gap:r&&(i||n)?"var(--gap-sm)":void 0},...C,...f,children:k})};import{useEffect as ha}from"react";import{Spinner as wn}from"@donotdev/components";import{FEATURE_STATUS as va,USER_ROLES as At,SUBSCRIPTION_TIERS as io,isClient as ya,safeSessionStorage as Cn}from"@donotdev/core";import{useRedirectGuard as ba,useNavigate as Sa}from"@donotdev/ui/routing/hooks";import{Fragment as kn,jsx as He}from"react/jsx-runtime";function wa({auth:e,children:t,fallback:o=()=>He(wn,{overlay:!0})}){let n=Sa(),r=N("user"),a=N("status"),{shouldRedirect:i,redirectTo:s,isChecking:l}=ba({auth:e});return ha(()=>{i&&s&&(!r&&ya()&&(Cn.setItem("dndev.auth.returnTo",window.location.pathname+window.location.search),Cn.setItem("dndev.auth.guardToast","1")),n(s,{replace:!0}))},[i,s,n,r]),e===!1?He(kn,{children:t}):i||l?He(wn,{overlay:!0}):a===va.INITIALIZING?He(o,{}):He(kn,{children:t})}function tm(e){return N("can")?.navigate(e)??!1}function om(){return N("user")?.role||At.GUEST}function nm(e){return N("user")?.role===e}function rm(){let e=N("user"),t=N("userSubscription"),o=N("loading");return{authenticated:!!e,role:e?.role,tier:t?.tier||"free",loading:o,userId:e?.id}}function am(e,t){return n=>He(wa,{auth:t,children:He(e,{...n})})}var im={public:()=>!1,required:()=>({required:!0}),user:()=>({required:!0,role:At.USER}),admin:()=>({required:!0,role:At.ADMIN}),tier:e=>({required:!0,tier:e}),pro:()=>({required:!0,tier:io.PRO}),premium:()=>({required:!0,tier:io.PREMIUM}),adminPro:()=>({required:!0,role:At.ADMIN,tier:io.PRO}),custom:e=>({required:!0,validate:e})};import{ArrowLeft as Ha,Lock as $a}from"lucide-react";import{Suspense as Wa,lazy as Ga}from"react";import{Card as Ka,Button as qa,Separator as Ya,Stack as tt,cn as ja}from"@donotdev/components";import{useTranslation as Za}from"@donotdev/core";import"@donotdev/core";import{useBack as Ja}from"@donotdev/ui/routing/hooks";import{Suspense as Ua}from"react";import{cn as Va}from"@donotdev/components";import{Component as Ca}from"react";import{handleError as ka}from"@donotdev/core";var so=class extends Ca{constructor(o){super(o);Et(this,"resetError",()=>{this.setState({hasError:!1,error:null})});this.state={hasError:!1,error:null}}static getDerivedStateFromError(o){return{hasError:!0,error:o}}componentDidCatch(o,n){ka(o,{userMessage:`A ${this.props.level||"component"} error occurred`,context:{errorInfo:n,component:"DnDevErrorBoundary",level:this.props.level||"component"},showNotification:!1})}render(){return this.state.hasError?this.props.fallback({error:this.state.error,resetError:this.resetError,componentStack:null,eventId:null}):this.props.children}},xn=so;import{AlertTriangle as xa,Home as Ta,ArrowLeft as Ea,RotateCw as Ra,Copy as Pa,Check as Aa}from"lucide-react";import{useEffect as Ia,useState as La}from"react";import{Button as It,BUTTON_VARIANT as Lt,Card as Tn,CARD_VARIANT as En,Alert as Na,ALERT_VARIANT as Da,Stack as et}from"@donotdev/components";import{handleError as Fa,useTranslation as Ba}from"@donotdev/core";import{useBack as Oa,useRoutePath as Ma}from"@donotdev/ui/routing/hooks";import{jsx as J,jsxs as $e}from"react/jsx-runtime";var za=({error:e,resetError:t,componentStack:o,eventId:n})=>{let{t:r}=Ba("dndev"),[a,i]=La(!1),s=Oa(),l=Ma(),c=e instanceof Error?e.message:"Unknown error",d=e instanceof Error?e.stack:void 0,p=!1;Ia(()=>{try{Fa(e,{userMessage:"Page encountered an error",context:{component:"RouteErrorFallback",location:l}})}catch{}},[e,l]);let h=async()=>{if(!d)return;let u=[`Error: ${c}`,`Timestamp: ${new Date().toISOString()}`,`User Agent: ${navigator.userAgent}`,n?`Event ID: ${n}`:null,`Path: ${l}`,"","Stack Trace:",d,o?`
2
2
  Component Stack:`:null,o||null].filter(Boolean).join(`
3
- `);try{await navigator.clipboard.writeText(u),i(!0),setTimeout(()=>i(!1),2e3)}catch{}},f=()=>{try{t()}catch{typeof window<"u"&&window.location.reload()}},m=()=>{try{s()}catch{typeof window<"u"&&window.history.back()}};return J("div",{className:"dndev-container","data-variant":"standard","data-centered":"true",children:J(xn,{variant:Tn.DEFAULT,elevated:!0,className:"dndev-w-full",style:{maxWidth:"65ch",margin:"0 auto"},children:$e(et,{gap:"large",align:"center",className:"dndev-text-center",children:[J(et,{align:"center",justify:"center",style:{width:"5rem",height:"5rem",backgroundColor:"rgba(220, 38, 38, 0.1)",borderRadius:"50%",border:"1px solid var(--destructive)"},children:J(xa,{style:{width:"2.5rem",height:"2.5rem",color:"var(--destructive)"},"aria-hidden":"true"})}),$e(et,{children:[J("h1",{className:"dndev-text-base","data-level":"h1",style:{fontSize:"var(--font-size-2xl)",fontWeight:"var(--font-weight-bold)",margin:0},children:r("routeError.title","Something went wrong")}),J("p",{className:"dndev-text-base",style:{fontSize:"var(--font-size-lg)",color:"var(--muted-foreground)",margin:0},children:r("routeError.description","We encountered an error while loading this page.")}),J(Na,{variant:Da.INFO,hideIcon:!0,children:J("div",{style:{fontSize:"var(--font-size-sm)",textAlign:"center"},children:r("routeError.dataSafe","Don't worry, your data is safe.")})})]}),n&&$e("code",{style:{padding:"var(--gap-sm) var(--gap-md)",background:"var(--muted)",borderRadius:"var(--radius-full)",fontSize:"var(--font-size-xs)",fontFamily:"var(--font-mono)",color:"var(--foreground)"},children:[r("routeError.errorId","Error ID"),": ",n]}),p&&c&&$e(xn,{variant:Tn.MUTED,className:"dndev-w-full",children:[$e(et,{direction:"row",align:"center",justify:"between",children:[J("span",{className:"dndev-text-base",style:{fontSize:"var(--font-size-sm)",fontWeight:"var(--font-weight-semibold)",color:"var(--destructive)"},children:"Error Message:"}),J(At,{variant:It.GHOST,icon:a?Aa:Pa,onClick:h,disabled:a,children:a?r("routeError.copied","Copied"):r("routeError.copyDetails","Copy Details")})]}),J("pre",{style:{fontSize:"var(--font-size-xs)",fontFamily:"var(--font-mono)",wordBreak:"break-word",whiteSpace:"pre-wrap",color:"var(--foreground)",margin:0,marginTop:"var(--gap-sm)"},children:c})]}),$e(et,{className:"dndev-w-full",children:[J(At,{variant:It.DESTRUCTIVE,icon:Ra,onClick:f,fullWidth:!0,children:r("routeError.tryAgain","Try Again")}),$e(et,{direction:"row",justify:"center",children:[J(D,{path:"/",children:J(At,{variant:It.DEFAULT,icon:Ta,fullWidth:!0,children:r("routeError.goHome","Go Home")})}),J(At,{variant:It.OUTLINE,icon:Ea,onClick:m,fullWidth:!0,children:r("routeError.goBack","Go Back")})]})]}),J("p",{className:"dndev-text-base",style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)",margin:0},children:r("routeError.contactSupport","If the problem persists, please contact support.")})]})})})},En=za;import{jsx as pt}from"react/jsx-runtime";function _a(e){return pt(Ua,{fallback:pt("div",{children:"Loading error fallback..."}),children:pt(En,{...e})})}var Lt=({variant:e="standard",density:t,className:o,children:n,centered:r=!0,gapFirst:a=!1})=>pt(kn,{level:"route",fallback:_a,children:pt("div",{className:Va("dndev-container",o),"data-variant":e,"data-density":t,"data-centered":r?"true":"false","data-gap-first":a?"true":void 0,children:n})});import{Fragment as Xa,jsx as W,jsxs as mt}from"react/jsx-runtime";var Qa=Ga(()=>import("@donotdev/auth").then(e=>({default:e.MultipleAuthProviders})));function Dm({title:e,description:t,showBackButton:o=!0,onBack:n,className:r=""}){let{t:a}=Za(["auth","common"]),i=Ja(),s=()=>{n?n():i()};return W(Lt,{variant:"docs",children:W(tt,{align:"center",justify:"center",className:ja("dndev-min-h-60",r),style:{paddingTop:"var(--gap-lg)",paddingBottom:"var(--gap-lg)"},children:W(Ka,{className:"dndev-w-full",style:{maxWidth:"28rem",border:"none",boxShadow:"var(--shadow-xl)"},title:mt(tt,{children:[W(tt,{justify:"center",children:W("div",{style:{borderRadius:"9999px",backgroundColor:"color-mix(in oklab, var(--primary) 10%, transparent)",padding:"var(--gap-md)"},children:W($a,{className:"dndev-size-touch",style:{color:"var(--primary)"}})})}),W("div",{style:{fontSize:"var(--font-size-2xl)",fontWeight:700},children:a("auth.fallback.title","Authentication Required")}),W("p",{style:{color:"var(--muted-foreground)"},children:a("auth.fallback.description","Please sign in to access this page")})]}),children:mt(tt,{children:[mt(tt,{gap:"large",children:[W("div",{children:W("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:a("auth.fallback.chooseProvider")})}),W(Wa,{fallback:W("div",{children:"Loading providers..."}),children:W(Qa,{layout:"vertical",spacing:"tight",fullWidth:!0,ariaLabel:a("auth.fallback.authOptions")})})]}),o&&mt(Xa,{children:[W(Ya,{}),W("div",{children:W(qa,{onClick:s,className:"dndev-gap-sm",icon:Ha,children:a("common.back")})})]}),mt(tt,{gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:[W("p",{children:a("auth.fallback.secure")}),W("p",{children:a("auth.fallback.terms")})]})]})})})})}import{useEffect as Rn}from"react";import{useToast as ei}from"@donotdev/components";import{isClient as Pn,safeSessionStorage as Nt,useTranslation as ti}from"@donotdev/core";import{useNavigate as oi}from"@donotdev/ui/routing/hooks";function ni(e){return e.startsWith("/")&&!e.startsWith("//")&&!e.startsWith("/\\")}function ri(){let e=N("user"),t=oi(),{t:o}=ti("dndev"),{toast:n}=ei();return Rn(()=>{!Pn()||!Nt.getItem("dndev.auth.guardToast")||(Nt.removeItem("dndev.auth.guardToast"),n("warning",o("guard.signInRequired","Please sign in to access this page")))},[]),Rn(()=>{if(!e||!Pn())return;let r=new URLSearchParams(window.location.search).get("returnTo"),a=Nt.getItem("dndev.auth.returnTo")??(r&&ni(r)?r:null);a&&(Nt.removeItem("dndev.auth.returnTo"),a!==window.location.pathname&&t(a,{replace:!0}))},[e,t]),null}import{useEffect as ai}from"react";import{isClient as ii,safeSessionStorage as si}from"@donotdev/core";import{useNavigate as li}from"@donotdev/ui/routing/hooks";import{Fragment as di,jsx as ui}from"react/jsx-runtime";function ci({to:e,children:t}){let o=N("user"),n=li();return ai(()=>{!o||!ii()||new URLSearchParams(window.location.search).has("returnTo")||si.getItem("dndev.auth.returnTo")||n(e,{replace:!0})},[o,e,n]),ui(di,{children:t})}import{Search as pi}from"lucide-react";import{Button as mi,BUTTON_VARIANT as fi,DISPLAY as gi}from"@donotdev/components";import{useOverlayStore as hi,useTranslation as vi}from"@donotdev/core";import{jsx as bi,jsxs as Si}from"react/jsx-runtime";function yi(e){return e.userAgentData?.platform}var Jm=({display:e=gi.AUTO,className:t,onOpen:o})=>{let{t:n}=vi("dndev"),r=hi(l=>l.openCommandDialog),i=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(yi(navigator)??navigator.platform)?"\u2318K":"Ctrl+K",s=()=>{r(),o?.()};return Si(mi,{variant:fi.OUTLINE,display:e,icon:pi,onClick:s,className:t,"aria-label":n("goTo.ariaLabel","Go to page"),children:[n("goTo.label","Go to"),bi("kbd",{style:{marginInlineStart:"var(--gap-sm)",padding:"0.125rem 0.375rem",fontSize:"var(--font-size-xs)",fontFamily:"var(--font-mono)",opacity:.5},children:i})]})};import{Suspense as wi,lazy as Ci}from"react";import{useEventListener as ki,useOverlayStore as xi}from"@donotdev/core";import{jsx as An}from"react/jsx-runtime";var Ti=Ci(()=>import("./GoToDialog-XBK5EZF4.js")),Ei=()=>{let e=xi(t=>t.openCommandDialog);return ki("keydown",t=>{if((t.metaKey||t.ctrlKey)&&t.key==="k"){let o=t.target;if(o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.isContentEditable)return;t.preventDefault(),e()}},{target:typeof document<"u"?document:void 0,options:{passive:!1,capture:!1}}),An(wi,{fallback:null,children:An(Ti,{})})},Ri=Ei;import{Search as Pi}from"lucide-react";import{useEffect as Ai,useState as Ii,useRef as Li}from"react";import{Stack as Ni}from"@donotdev/components";import{useOverlayStore as so}from"@donotdev/core";import{useTranslation as Di}from"@donotdev/core";import{jsx as Dt,jsxs as Mi}from"react/jsx-runtime";var Fi=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent),Bi=()=>{let{t:e}=Di("dndev"),[t,o]=Ii(""),n=Li(null),r=so(s=>s.isCommandDialogOpen);return Ai(()=>{r||o("")},[r]),Mi(Ni,{direction:"row",align:"center",className:"dndev-relative dndev-w-full dndev-max-w-sm",role:"search",children:[Dt(Pi,{className:"dndev-absolute dndev-size-md",style:{insetInlineStart:"0.75rem",opacity:.5},"aria-hidden":"true"}),Dt("input",{ref:n,type:"text",value:t,onChange:s=>o(s.target.value),onFocus:()=>{so.getState().openCommandDialog(t)},onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),so.getState().openCommandDialog(t))},placeholder:e("globalGoTo.searchPlaceholder","Search pages..."),className:"dndev-input dndev-w-full",style:{paddingInlineStart:"2.5rem",paddingInlineEnd:"5rem"},"aria-label":e("globalGoTo.ariaLabel","Search navigation")}),Dt("div",{className:"dndev-absolute dndev-flex dndev-items-center dndev-text-sm",style:{insetInlineEnd:"0.75rem",gap:"0.25rem",opacity:.5},"aria-hidden":"true",children:Dt("kbd",{style:{padding:"0.25rem 0.5rem",fontSize:"var(--font-size-xs)",fontFamily:"var(--font-mono)",borderRadius:"var(--radius-sm)"},children:Fi?"\u2318K":"Ctrl+K"})})]})},Oi=Bi;import{MoreHorizontal as zi,Link as In}from"lucide-react";import{useState as Ui,useEffect as Ln,useRef as Vi,useMemo as _i}from"react";import{NavigationMenu as Nn,NavigationMenuListPrimitive as Hi,NavigationMenuItemPrimitive as Dn,Button as $i,DropdownMenu as Wi,cn as Ft,DISPLAY as Gi}from"@donotdev/components";import{useTranslation as Ki}from"@donotdev/core";import{jsx as ge,jsxs as lo}from"react/jsx-runtime";var Fn=({routes:e,vertical:t=!1,display:o=Gi.AUTO,overflowDetection:n=!1,showIcons:r=!0,className:a,style:i})=>{let{t:s}=Ki("dndev"),l=xe(),c=e??l,d=Vi(null),[p,h]=Ui(c.length),f=_i(()=>c.map(m=>({label:m.label,path:m.path,icon:ge(oe,{icon:m.icon,fallback:In}),children:m.children?m.children.map(u=>({label:u.label,path:u.path,icon:ge(oe,{icon:u.icon,fallback:In})})):void 0})),[c]);if(Ln(()=>{if(!n||c.length===0||t)return;let m=()=>{let g=d.current;if(!g)return;let y=g.getBoundingClientRect(),x=g.querySelectorAll("[data-nav-item]"),C=g.querySelector("[data-more-button]"),k=0,P=C?.offsetWidth||0;for(let b=0;b<x.length;b++){let A=x[b];if(!A)break;if(A.getBoundingClientRect().right-y.left+(b===x.length-1&&C?P:0)<=y.width)k=b+1;else break}h(Math.max(0,k))},u=new ResizeObserver(m);return d.current&&u.observe(d.current),setTimeout(m,0),()=>u.disconnect()},[n,c.length,t]),Ln(()=>{n&&!t&&h(c.length)},[c.length,n,t]),c.length===0)return null;if(n&&!t){let m=Math.min(p,f.length),u=f.slice(0,m),g=f.slice(m);return ge(Nn,{className:Ft(a),style:i||{flex:1},children:lo(Hi,{ref:d,"data-vertical":"false",style:{display:"flex",alignItems:"center",gap:"var(--gap-sm)",flexWrap:"nowrap",overflow:"hidden"},children:[u.filter(y=>y.path).map((y,x)=>ge(Dn,{"data-nav-item":!0,children:lo(D,{path:y.path,className:Ft("dndev-interactive"),"data-role":"nav-trigger",children:[r&&y.icon,ge("span",{className:"dndev-interactive-label",children:y.label})]})},y.path||x)),g.length>0&&ge(Dn,{"data-more-button":!0,children:ge(Wi,{trigger:ge($i,{className:"dndev-size-touch",style:{flexShrink:0},"aria-label":s("navigation.more","More"),children:ge(zi,{className:"dndev-size-md"})}),items:g.filter(y=>y.path).map(y=>({label:y.label,children:lo(D,{path:y.path,className:Ft("dndev-interactive"),"data-role":"menu-item",children:[r&&y.icon,ge("span",{className:"dndev-interactive-label",children:y.label})]}),asChild:!0})),contentWidth:"14rem",contentAlign:"end"})})]})})}return ge(Nn,{items:f,vertical:t,display:o,className:Ft(a,t&&"dndev-sidebar-nav-menu"),LinkComponent:D})};import{Home as qi,ArrowLeft as Yi,Link as ji}from"lucide-react";import{useMemo as Zi}from"react";import{Button as co,BUTTON_VARIANT as uo,Stack as ft,Text as po}from"@donotdev/components";import{useTranslation as Ji}from"@donotdev/core";import{useNavigate as Qi,useRoutePath as Xi}from"@donotdev/ui/routing/hooks";import{jsx as ce,jsxs as Bt}from"react/jsx-runtime";function Bn({showRequestedPath:e=!0}={}){let{t}=Ji("dndev"),o=Xi(),n=Qi(),r=xe(),a=Zi(()=>r.filter(s=>!s.path.includes(":")&&s.path!=="/").slice(0,4),[r]),i=()=>{n("back")};return ce(Lt,{variant:"docs",centered:!0,children:Bt(ft,{gap:"large",align:"center",justify:"center",children:[Bt(ft,{align:"center",children:[ce(po,{level:"h1",style:{fontSize:"clamp(4rem, 12vw, 8rem)",fontWeight:"var(--font-weight-bold)",lineHeight:1,letterSpacing:"-0.02em",background:"linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text",margin:0},children:"404"}),ce(po,{level:"h2",style:{fontSize:"var(--font-size-2xl)",fontWeight:"var(--font-weight-semibold)",margin:0},children:t("errors.notFound.title","Page Not Found")}),ce(po,{style:{fontSize:"var(--font-size-lg)",color:"var(--muted-foreground)",textAlign:"center",margin:0},children:t("errors.notFound.description","The page you're looking for doesn't exist or has been moved.")}),e&&o&&ce("code",{style:{padding:"var(--gap-sm) var(--gap-md)",background:"var(--muted)",borderRadius:"var(--radius-md)",fontSize:"var(--font-size-sm)",fontFamily:"var(--font-mono)",color:"var(--foreground)",wordBreak:"break-all",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",border:"1px solid var(--border-hairline)"},children:o})]}),a.length>0&&Bt(ft,{align:"center",children:[ce("p",{className:"dndev-text-base",style:{fontSize:"var(--font-size-md)",fontWeight:"var(--font-weight-semibold)",margin:0,color:"var(--muted-foreground)"},children:t("errors.notFound.suggestions","You might be looking for:")}),ce(ft,{direction:"row",wrap:"wrap",justify:"center",gap:"tight",children:a.map(s=>ce(D,{path:s.path,replace:!0,children:ce(co,{variant:uo.OUTLINE,icon:ce(oe,{icon:s.icon,fallback:ji}),"aria-label":t("errors.notFound.navigateTo",`Navigate to ${s.label}`,{label:s.label}),children:s.label})},s.path))})]}),Bt(ft,{direction:"row",wrap:"wrap",justify:"center",children:[ce(D,{path:"/",replace:!0,children:ce(co,{variant:uo.DEFAULT,icon:qi,"aria-label":t("errors.notFound.goHome","Go to home page"),children:t("errors.notFound.goHome","Go Home")})}),ce(co,{variant:uo.OUTLINE,icon:Yi,onClick:i,"aria-label":t("errors.notFound.goBack","Go back to previous page"),children:t("errors.notFound.goBack","Go Back")})]})]})})}import{useNavigate as We,useBack as Wf,useRefresh as Gf,usePrefetch as Kf,useLocation as qf,useRoutePath as Yf,useParams as jf,useRouteParam as Zf,useSearchParams as Jf,useMatch as Qf,useQueryParams as Xf,useRedirectGuard as eg,useLocalizedPath as tg,useUrlLanguage as og}from"@donotdev/ui/routing/hooks";import{getDndevConfig as mo,isClient as Ge,isDev as On}from"@donotdev/core";var re=class{static getBrowserSupport(){if(!Ge())return{svg:!0,webp:!1,avif:!1};let t=this.cache.get("browser-support");if(t)return t;let o={svg:!0,webp:!1,avif:!1};try{let n=document.createElement("canvas");n.width=1,n.height=1,o.webp=n.toDataURL("image/webp").indexOf("data:image/webp")===0}catch{o.webp=!1}try{let n=document.createElement("canvas");n.width=1,n.height=1,o.avif=n.toDataURL("image/avif").indexOf("data:image/avif")===0}catch{o.avif=!1}return this.cache.set("browser-support",o),o}static extractStringValues(t){let o=[];if(t==null)return o;if(typeof t=="string")o.push(t);else if(Array.isArray(t))for(let n of t)o.push(...this.extractStringValues(n));else if(typeof t=="object")for(let n of Object.values(t))o.push(...this.extractStringValues(n));return o}static assetExists(t){if(!Ge())return!1;let o=this.getAssetManifest();return o?this.extractStringValues(o).includes(t):!1}static getAssetManifest(){return Ge()&&mo()?.assets?.mapping||null}static getLogoSvgContent(){return mo()?.assets?.logoSvgContent||null}static resolveLogo(t){if(t)return t;let o="logo";if(this.cache.has(o))return this.cache.get(o);let r=this.getAssetManifest()?.logo?.optimal||"/logo.svg";return this.cache.set(o,r),r}static directAssetCheck(t){if(!Ge())return!1;try{let o=new Image;return o.src=t,!0}catch{return!1}}static resolveFaviconSet(){let t="favicon-set";if(this.cache.has(t))return this.cache.get(t);let o=this.getAssetManifest();if(o?.favicon?.set){let a=o.favicon.set,i=this.assetExists("/icon-512x512.png")?"/icon-512x512.png":this.assetExists("/icon-192x192.png")?"/icon-192x192.png":"/logo.svg",s={svg:a.svg||"/favicon.svg",ico:a.ico||"/favicon.ico",png16:a.png16||i,png32:a.png32||i,apple180:a.apple180||i,android192:a.android192||i,android512:a.android512||i};return this.cache.set(t,s),s}let n=this.assetExists("/icon-512x512.png")?"/icon-512x512.png":this.assetExists("/icon-192x192.png")?"/icon-192x192.png":"/logo.svg",r={svg:this.assetExists("/favicon.svg")?"/favicon.svg":"/logo.svg",ico:this.assetExists("/favicon.ico")?"/favicon.ico":"/favicon.svg",png16:this.assetExists("/favicon-16x16.png")?"/favicon-16x16.png":n,png32:this.assetExists("/favicon-32x32.png")?"/favicon-32x32.png":n,apple180:this.assetExists("/apple-touch-icon.png")?"/apple-touch-icon.png":n,android192:this.assetExists("/icon-192x192.png")?"/icon-192x192.png":n,android512:this.assetExists("/icon-512x512.png")?"/icon-512x512.png":n};return this.cache.set(t,r),r}static resolveFavicon(){let t=this.getAssetManifest();if(t?.favicon?.optimal)return t.favicon.optimal;let o=["/favicon.svg","/favicon.ico","/favicon.png","/logo.svg"];for(let n of o)if(this.assetExists(n))return n;return"/favicon.svg"}static clearCache(){this.cache.clear(),On()&&Ge()}static getDebugInfo(){return{browserSupport:this.getBrowserSupport(),detectedAssets:Ge()?mo()?.assets?.mapping:null,assetManifest:this.getAssetManifest(),cache:Object.fromEntries(this.cache)}}};Tt(re,"cache",new Map);function ig(e){return re.resolveLogo(e)}function sg(){return re.resolveFaviconSet()}On()&&(re.clearCache(),Ge()&&window.addEventListener("DOMContentLoaded",()=>{re.clearCache()}));import*as es from"@donotdev/crud";var Mn={forms:{},startSubmit:()=>{},setUploading:()=>{},setValidating:()=>{},setSubmitting:()=>{},setSuccess:()=>{},setError:()=>{},reset:()=>{},cleanup:()=>{},setIsDirty:(e,t)=>{},hasDirtyForms:()=>!1,getDirtyFormIds:()=>[],getStatus:()=>"idle",isLoading:()=>!1,getUploadProgress:()=>0,getError:()=>null,getIsDirty:()=>!1},ot=es?.useFormStore,dg=typeof ot=="function";function ts(e){return ot?ot(e):e(Mn)}ts.getState=()=>ot&&typeof ot.getState=="function"?ot.getState():Mn;import{useMemo as os}from"react";function Ot(){let e=N("status"),t=N("isAvailable"),o=N("user");return os(()=>({shouldHide:e!=="ready"||!t,isLoading:e==="initializing",isReady:e==="ready"&&t,isAuthenticated:!!o}),[e,t,o])}import*as ns from"@donotdev/billing";import{DEGRADED_BILLING_API as rs}from"@donotdev/core";var fo=ns?.useStripeBilling;function as(e){return rs[e]}function go(e,t){return fo?fo(e,t):as(e)}var hg=typeof fo=="function";function Sg(){let e=N("user"),t=N("status"),o={user:e,status:t},n=go("status",o),r=go("isAvailable",o);return{shouldHide:!r,isLoading:n==="initializing",isReady:r&&n==="ready"}}import{DEGRADED_CRUD_API as is}from"@donotdev/core";import*as ss from"@donotdev/crud";var ho=ss?.useCrud;function ls(){return is}function kg(e,t={}){return ho?ho(e,t):ls()}var xg=typeof ho=="function";import{DEGRADED_OAUTH_API as cs}from"@donotdev/core";import*as ds from"@donotdev/oauth";var vo=ds?.useOAuth;function us(e){return cs[e]}function Rg(e){return vo?vo(e):us(e)}var Pg=typeof vo=="function";import{CheckCircle as ps}from"lucide-react";import{List as ms}from"@donotdev/components";import{translateArray as fs}from"@donotdev/core";import{jsx as zn}from"react/jsx-runtime";var gs=ps,hs=16;function Dg(e,t,o,n=gs,r=hs){let a=n;return zn(ms,{icon:a?zn(a,{size:r}):void 0,items:fs(e,t,o),style:{listStyle:"none",paddingInlineStart:0}})}var vs=/<script[\s\S]*?<\/script>/gi,ys=/<foreignObject[\s\S]*?<\/foreignObject>/gi,bs=/\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,Ss=/\s+(?:xlink:)?href\s*=\s*["']\s*javascript:[^"']*["']/gi,ws=/\s+(?:xlink:)?href\s*=\s*["']\s*data:(?!image\/(?:png|jpe?g|gif|webp|svg\+xml))[^"']*["']/gi;function nt(e){return e.replace(vs,"").replace(ys,"").replace(bs,"").replace(Ss,"").replace(ws,"")}import{buildProductJsonLd as xs,deriveEntitySeo as Ts,getPlatformEnvVar as Es,useAppConfig as Rs,useTranslation as Ps}from"@donotdev/core";import{useLocalizedPath as As,useRoutePath as Is}from"@donotdev/ui/routing/hooks";import{Helmet as Cs}from"react-helmet-async";import{isNextJs as ks}from"@donotdev/core";import{Fragment as Un,jsx as yo}from"react/jsx-runtime";function Vn({children:e}){return typeof document>"u"?yo(Un,{children:e}):ks()?yo(Un,{children:e}):yo(Cs,{children:e})}import{jsx as G,jsxs as Ns}from"react/jsx-runtime";function _n(e,t){return e.startsWith("/")&&t?`${t}${e}`:e}function Ls({title:e,fullTitle:t,description:o,image:n,type:r="website",keywords:a,noindex:i,canonicalUrl:s,publishDate:l,modifiedDate:c,entity:d,data:p}){let h=Rs("name")||"",f=Is(),m=As(),u=Es("APP_URL")||"",{t:g,language:y}=Ps(d?[d.namespace,"crud"]:void 0),x=d&&p?Ts(d,p,{t:g,locale:y}):null,C=e??x?.title,k=o??x?.description,P=n??x?.image,b=P?_n(P,u):void 0,A=s??`${u}${m(f)}`,B=t||(C?`${C} | ${h}`:h),S=r==="product"?xs({title:C??void 0,description:k??void 0,image:b,images:b?[b,...(x?.images??[]).map(F=>_n(F,u)).filter(F=>F!==b)]:[],price:x?.price,availability:x?.availability},A):null,w=[];if(k&&w.push(G("meta",{name:"description",content:k},"description"),G("meta",{property:"og:description",content:k},"og:description"),G("meta",{name:"twitter:description",content:k},"twitter:description")),b&&w.push(G("meta",{property:"og:image",content:b},"og:image"),G("meta",{name:"twitter:image",content:b},"twitter:image"),G("meta",{name:"twitter:card",content:"summary_large_image"},"twitter:card")),r&&w.push(G("meta",{property:"og:type",content:r},"og:type")),a&&a.length>0){let F=Array.isArray(a)?a.join(", "):a;w.push(G("meta",{name:"keywords",content:F},"keywords"))}return i&&w.push(G("meta",{name:"robots",content:"noindex, nofollow"},"robots")),r==="article"&&(l&&w.push(G("meta",{property:"article:published_time",content:l},"article:published_time")),c&&w.push(G("meta",{property:"article:modified_time",content:c},"article:modified_time"))),w.push(G("meta",{property:"og:title",content:B},"og:title"),G("meta",{name:"twitter:title",content:B},"twitter:title")),Ns(Vn,{children:[G("title",{children:B}),s&&G("link",{rel:"canonical",href:s}),w,S&&G("script",{type:"application/ld+json",children:JSON.stringify(S)})]})}function Wg(e){return e===null?()=>null:()=>G(Ls,{...e})}import{buildProductJsonLd as ih,deriveEntitySeo as sh}from"@donotdev/core";import*as Ds from"@donotdev/auth";var Hn=Ds?.useDeleteAccount,$n=()=>{},Fs={showConfirmDialog:!1,showPasswordDialog:!1,isDeleting:!1,error:null,startDeleteFlow:$n,confirmDelete:async()=>{},cancel:$n};function Wn(){return Hn?Hn():Fs}import{Fragment as Xs,jsx as Be,jsxs as el}from"react/jsx-runtime";var qn=()=>null,Js=Kn(async()=>{try{return{default:(await import("@donotdev/auth")).ReauthDialog}}catch{return{default:qn}}}),Qs=Kn(async()=>{try{return{default:(await import("@donotdev/auth")).ConfirmDeleteDialog}}catch{return{default:qn}}}),Mt=e=>{if(!e)return gt;if(typeof e=="function")return e;let t=e.replace(/['"]/g,""),o=Xe(t);return o||gt},bo=({loginPath:e,display:t=Gs.AUTO,"no-tooltip":o=!1,customItems:n=[],className:r,style:a})=>{let{t:i}=Ks("dndev"),{shouldHide:s,isReady:l,isAuthenticated:c}=Ot(),d=Ys(),p=N("user"),h=N("signOut"),f=js("isLaptop"),m=xe(),u=Zs(),g=d.profilePath,y=d.authMenuItems||[],x=p?.role,C=Wn(),k=()=>p&&(p.displayName||p.email?.split("@")[0])||"User",P=()=>k().split(" ").map(w=>w.charAt(0)).slice(0,2).join("").toUpperCase(),b=()=>{if(!p)return i("auth.userMenu",{defaultValue:"User menu"});let S=[k()];return p.email&&S.push(p.email),x&&x!=="guest"&&S.push(`Role: ${x}`),S.join(`
3
+ `);try{await navigator.clipboard.writeText(u),i(!0),setTimeout(()=>i(!1),2e3)}catch{}},f=()=>{try{t()}catch{typeof window<"u"&&window.location.reload()}},m=()=>{try{s()}catch{typeof window<"u"&&window.history.back()}};return J("div",{className:"dndev-container","data-variant":"standard","data-centered":"true",children:J(Tn,{variant:En.DEFAULT,elevated:!0,className:"dndev-w-full",style:{maxWidth:"65ch",margin:"0 auto"},children:$e(et,{gap:"large",align:"center",className:"dndev-text-center",children:[J(et,{align:"center",justify:"center",style:{width:"5rem",height:"5rem",backgroundColor:"rgba(220, 38, 38, 0.1)",borderRadius:"50%",border:"1px solid var(--destructive)"},children:J(xa,{style:{width:"2.5rem",height:"2.5rem",color:"var(--destructive)"},"aria-hidden":"true"})}),$e(et,{children:[J("h1",{className:"dndev-text-base","data-level":"h1",style:{fontSize:"var(--font-size-2xl)",fontWeight:"var(--font-weight-bold)",margin:0},children:r("routeError.title","Something went wrong")}),J("p",{className:"dndev-text-base",style:{fontSize:"var(--font-size-lg)",color:"var(--muted-foreground)",margin:0},children:r("routeError.description","We encountered an error while loading this page.")}),J(Na,{variant:Da.INFO,hideIcon:!0,children:J("div",{style:{fontSize:"var(--font-size-sm)",textAlign:"center"},children:r("routeError.dataSafe","Don't worry, your data is safe.")})})]}),n&&$e("code",{style:{padding:"var(--gap-sm) var(--gap-md)",background:"var(--muted)",borderRadius:"var(--radius-full)",fontSize:"var(--font-size-xs)",fontFamily:"var(--font-mono)",color:"var(--foreground)"},children:[r("routeError.errorId","Error ID"),": ",n]}),p&&c&&$e(Tn,{variant:En.MUTED,className:"dndev-w-full",children:[$e(et,{direction:"row",align:"center",justify:"between",children:[J("span",{className:"dndev-text-base",style:{fontSize:"var(--font-size-sm)",fontWeight:"var(--font-weight-semibold)",color:"var(--destructive)"},children:"Error Message:"}),J(It,{variant:Lt.GHOST,icon:a?Aa:Pa,onClick:h,disabled:a,children:a?r("routeError.copied","Copied"):r("routeError.copyDetails","Copy Details")})]}),J("pre",{style:{fontSize:"var(--font-size-xs)",fontFamily:"var(--font-mono)",wordBreak:"break-word",whiteSpace:"pre-wrap",color:"var(--foreground)",margin:0,marginTop:"var(--gap-sm)"},children:c})]}),$e(et,{className:"dndev-w-full",children:[J(It,{variant:Lt.DESTRUCTIVE,icon:Ra,onClick:f,fullWidth:!0,children:r("routeError.tryAgain","Try Again")}),$e(et,{direction:"row",justify:"center",children:[J(D,{path:"/",children:J(It,{variant:Lt.DEFAULT,icon:Ta,fullWidth:!0,children:r("routeError.goHome","Go Home")})}),J(It,{variant:Lt.OUTLINE,icon:Ea,onClick:m,fullWidth:!0,children:r("routeError.goBack","Go Back")})]})]}),J("p",{className:"dndev-text-base",style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)",margin:0},children:r("routeError.contactSupport","If the problem persists, please contact support.")})]})})})},Rn=za;import{jsx as pt}from"react/jsx-runtime";function _a(e){return pt(Ua,{fallback:pt("div",{children:"Loading error fallback..."}),children:pt(Rn,{...e})})}var Nt=({variant:e="standard",density:t,className:o,children:n,centered:r=!0,gapFirst:a=!1})=>pt(xn,{level:"route",fallback:_a,children:pt("div",{className:Va("dndev-container",o),"data-variant":e,"data-density":t,"data-centered":r?"true":"false","data-gap-first":a?"true":void 0,children:n})});import{Fragment as Xa,jsx as W,jsxs as mt}from"react/jsx-runtime";var Qa=Ga(()=>import("@donotdev/auth").then(e=>({default:e.MultipleAuthProviders})));function zm({title:e,description:t,showBackButton:o=!0,onBack:n,className:r=""}){let{t:a}=Za(["auth","common"]),i=Ja(),s=()=>{n?n():i()};return W(Nt,{variant:"docs",children:W(tt,{align:"center",justify:"center",className:ja("dndev-min-h-60",r),style:{paddingTop:"var(--gap-lg)",paddingBottom:"var(--gap-lg)"},children:W(Ka,{className:"dndev-w-full",style:{maxWidth:"28rem",border:"none",boxShadow:"var(--shadow-xl)"},title:mt(tt,{children:[W(tt,{justify:"center",children:W("div",{style:{borderRadius:"9999px",backgroundColor:"color-mix(in oklab, var(--primary) 10%, transparent)",padding:"var(--gap-md)"},children:W($a,{className:"dndev-size-touch",style:{color:"var(--primary)"}})})}),W("div",{style:{fontSize:"var(--font-size-2xl)",fontWeight:700},children:a("auth.fallback.title","Authentication Required")}),W("p",{style:{color:"var(--muted-foreground)"},children:a("auth.fallback.description","Please sign in to access this page")})]}),children:mt(tt,{children:[mt(tt,{gap:"large",children:[W("div",{children:W("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:a("auth.fallback.chooseProvider")})}),W(Wa,{fallback:W("div",{children:"Loading providers..."}),children:W(Qa,{layout:"vertical",spacing:"tight",fullWidth:!0,ariaLabel:a("auth.fallback.authOptions")})})]}),o&&mt(Xa,{children:[W(Ya,{}),W("div",{children:W(qa,{onClick:s,className:"dndev-gap-sm",icon:Ha,children:a("common.back")})})]}),mt(tt,{gap:"tight",style:{fontSize:"var(--font-size-xs)",color:"var(--muted-foreground)"},children:[W("p",{children:a("auth.fallback.secure")}),W("p",{children:a("auth.fallback.terms")})]})]})})})})}import{useEffect as Pn}from"react";import{useToast as ei}from"@donotdev/components";import{isClient as An,safeSessionStorage as Dt,useTranslation as ti}from"@donotdev/core";import{useNavigate as oi}from"@donotdev/ui/routing/hooks";function ni(e){return e.startsWith("/")&&!e.startsWith("//")&&!e.startsWith("/\\")}function ri(){let e=N("user"),t=oi(),{t:o}=ti("dndev"),{toast:n}=ei();return Pn(()=>{!An()||!Dt.getItem("dndev.auth.guardToast")||(Dt.removeItem("dndev.auth.guardToast"),n("warning",o("guard.signInRequired","Please sign in to access this page")))},[]),Pn(()=>{if(!e||!An())return;let r=new URLSearchParams(window.location.search).get("returnTo"),a=Dt.getItem("dndev.auth.returnTo")??(r&&ni(r)?r:null);a&&(Dt.removeItem("dndev.auth.returnTo"),a!==window.location.pathname&&t(a,{replace:!0}))},[e,t]),null}import{useEffect as ai}from"react";import{isClient as ii,safeSessionStorage as si}from"@donotdev/core";import{useNavigate as li}from"@donotdev/ui/routing/hooks";import{Fragment as di,jsx as ui}from"react/jsx-runtime";function ci({to:e,children:t}){let o=N("user"),n=li();return ai(()=>{!o||!ii()||new URLSearchParams(window.location.search).has("returnTo")||si.getItem("dndev.auth.returnTo")||n(e,{replace:!0})},[o,e,n]),ui(di,{children:t})}import{Search as pi}from"lucide-react";import{Button as mi,BUTTON_VARIANT as fi,DISPLAY as gi}from"@donotdev/components";import{useOverlayStore as hi,useTranslation as vi}from"@donotdev/core";import{jsx as bi,jsxs as Si}from"react/jsx-runtime";function yi(e){return e.userAgentData?.platform}var of=({display:e=gi.AUTO,className:t,onOpen:o})=>{let{t:n}=vi("dndev"),r=hi(l=>l.openCommandDialog),i=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(yi(navigator)??navigator.platform)?"\u2318K":"Ctrl+K",s=()=>{r(),o?.()};return Si(mi,{variant:fi.OUTLINE,display:e,icon:pi,onClick:s,className:t,"aria-label":n("goTo.ariaLabel","Go to page"),children:[n("goTo.label","Go to"),bi("kbd",{style:{marginInlineStart:"var(--gap-sm)",padding:"0.125rem 0.375rem",fontSize:"var(--font-size-xs)",fontFamily:"var(--font-mono)",opacity:.5},children:i})]})};import{Suspense as wi,lazy as Ci}from"react";import{useEventListener as ki,useOverlayStore as xi}from"@donotdev/core";import{jsx as In}from"react/jsx-runtime";var Ti=Ci(()=>import("./GoToDialog-XBK5EZF4.js")),Ei=()=>{let e=xi(t=>t.openCommandDialog);return ki("keydown",t=>{if((t.metaKey||t.ctrlKey)&&t.key==="k"){let o=t.target;if(o.tagName==="INPUT"||o.tagName==="TEXTAREA"||o.isContentEditable)return;t.preventDefault(),e()}},{target:typeof document<"u"?document:void 0,options:{passive:!1,capture:!1}}),In(wi,{fallback:null,children:In(Ti,{})})},Ri=Ei;import{Search as Pi}from"lucide-react";import{useEffect as Ai,useState as Ii,useRef as Li}from"react";import{Stack as Ni}from"@donotdev/components";import{useOverlayStore as lo}from"@donotdev/core";import{useTranslation as Di}from"@donotdev/core";import{jsx as Ft,jsxs as Mi}from"react/jsx-runtime";var Fi=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent),Bi=()=>{let{t:e}=Di("dndev"),[t,o]=Ii(""),n=Li(null),r=lo(s=>s.isCommandDialogOpen);return Ai(()=>{r||o("")},[r]),Mi(Ni,{direction:"row",align:"center",className:"dndev-relative dndev-w-full dndev-max-w-sm",role:"search",children:[Ft(Pi,{className:"dndev-absolute dndev-size-md",style:{insetInlineStart:"0.75rem",opacity:.5},"aria-hidden":"true"}),Ft("input",{ref:n,type:"text",value:t,onChange:s=>o(s.target.value),onFocus:()=>{lo.getState().openCommandDialog(t)},onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),lo.getState().openCommandDialog(t))},placeholder:e("globalGoTo.searchPlaceholder","Search pages..."),className:"dndev-input dndev-w-full",style:{paddingInlineStart:"2.5rem",paddingInlineEnd:"5rem"},"aria-label":e("globalGoTo.ariaLabel","Search navigation")}),Ft("div",{className:"dndev-absolute dndev-flex dndev-items-center dndev-text-sm",style:{insetInlineEnd:"0.75rem",gap:"0.25rem",opacity:.5},"aria-hidden":"true",children:Ft("kbd",{style:{padding:"0.25rem 0.5rem",fontSize:"var(--font-size-xs)",fontFamily:"var(--font-mono)",borderRadius:"var(--radius-sm)"},children:Fi?"\u2318K":"Ctrl+K"})})]})},Oi=Bi;import{MoreHorizontal as zi,Link as Ln}from"lucide-react";import{useState as Ui,useEffect as Nn,useRef as Vi,useMemo as _i}from"react";import{NavigationMenu as Dn,NavigationMenuListPrimitive as Hi,NavigationMenuItemPrimitive as Fn,Button as $i,DropdownMenu as Wi,cn as Bt,DISPLAY as Gi}from"@donotdev/components";import{useTranslation as Ki}from"@donotdev/core";import{jsx as ge,jsxs as co}from"react/jsx-runtime";var Bn=({routes:e,vertical:t=!1,display:o=Gi.AUTO,overflowDetection:n=!1,showIcons:r=!0,className:a,style:i})=>{let{t:s}=Ki("dndev"),l=xe(),c=e??l,d=Vi(null),[p,h]=Ui(c.length),f=_i(()=>c.map(m=>({label:m.label,path:m.path,icon:ge(oe,{icon:m.icon,fallback:Ln}),children:m.children?m.children.map(u=>({label:u.label,path:u.path,icon:ge(oe,{icon:u.icon,fallback:Ln})})):void 0})),[c]);if(Nn(()=>{if(!n||c.length===0||t)return;let m=()=>{let g=d.current;if(!g)return;let y=g.getBoundingClientRect(),x=g.querySelectorAll("[data-nav-item]"),C=g.querySelector("[data-more-button]"),k=0,P=C?.offsetWidth||0;for(let b=0;b<x.length;b++){let A=x[b];if(!A)break;if(A.getBoundingClientRect().right-y.left+(b===x.length-1&&C?P:0)<=y.width)k=b+1;else break}h(Math.max(0,k))},u=new ResizeObserver(m);return d.current&&u.observe(d.current),setTimeout(m,0),()=>u.disconnect()},[n,c.length,t]),Nn(()=>{n&&!t&&h(c.length)},[c.length,n,t]),c.length===0)return null;if(n&&!t){let m=Math.min(p,f.length),u=f.slice(0,m),g=f.slice(m);return ge(Dn,{className:Bt(a),style:i||{flex:1},children:co(Hi,{ref:d,"data-vertical":"false",style:{display:"flex",alignItems:"center",gap:"var(--gap-sm)",flexWrap:"nowrap",overflow:"hidden"},children:[u.filter(y=>y.path).map((y,x)=>ge(Fn,{"data-nav-item":!0,children:co(D,{path:y.path,className:Bt("dndev-interactive"),"data-role":"nav-trigger",children:[r&&y.icon,ge("span",{className:"dndev-interactive-label",children:y.label})]})},y.path||x)),g.length>0&&ge(Fn,{"data-more-button":!0,children:ge(Wi,{trigger:ge($i,{className:"dndev-size-touch",style:{flexShrink:0},"aria-label":s("navigation.more","More"),children:ge(zi,{className:"dndev-size-md"})}),items:g.filter(y=>y.path).map(y=>({label:y.label,children:co(D,{path:y.path,className:Bt("dndev-interactive"),"data-role":"menu-item",children:[r&&y.icon,ge("span",{className:"dndev-interactive-label",children:y.label})]}),asChild:!0})),contentWidth:"14rem",contentAlign:"end"})})]})})}return ge(Dn,{items:f,vertical:t,display:o,className:Bt(a,t&&"dndev-sidebar-nav-menu"),LinkComponent:D})};import{Home as qi,ArrowLeft as Yi,Link as ji}from"lucide-react";import{useMemo as Zi}from"react";import{Button as uo,BUTTON_VARIANT as po,Stack as ft,Text as mo}from"@donotdev/components";import{useTranslation as Ji}from"@donotdev/core";import{useNavigate as Qi,useRoutePath as Xi}from"@donotdev/ui/routing/hooks";import{jsx as ce,jsxs as Ot}from"react/jsx-runtime";function On({showRequestedPath:e=!0}={}){let{t}=Ji("dndev"),o=Xi(),n=Qi(),r=xe(),a=Zi(()=>r.filter(s=>!s.path.includes(":")&&s.path!=="/").slice(0,4),[r]),i=()=>{n("back")};return ce(Nt,{variant:"docs",centered:!0,children:Ot(ft,{gap:"large",align:"center",justify:"center",children:[Ot(ft,{align:"center",children:[ce(mo,{level:"h1",style:{fontSize:"clamp(4rem, 12vw, 8rem)",fontWeight:"var(--font-weight-bold)",lineHeight:1,letterSpacing:"-0.02em",background:"linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text",margin:0},children:"404"}),ce(mo,{level:"h2",style:{fontSize:"var(--font-size-2xl)",fontWeight:"var(--font-weight-semibold)",margin:0},children:t("errors.notFound.title","Page Not Found")}),ce(mo,{style:{fontSize:"var(--font-size-lg)",color:"var(--muted-foreground)",textAlign:"center",margin:0},children:t("errors.notFound.description","The page you're looking for doesn't exist or has been moved.")}),e&&o&&ce("code",{style:{padding:"var(--gap-sm) var(--gap-md)",background:"var(--muted)",borderRadius:"var(--radius-md)",fontSize:"var(--font-size-sm)",fontFamily:"var(--font-mono)",color:"var(--foreground)",wordBreak:"break-all",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",border:"1px solid var(--border-hairline)"},children:o})]}),a.length>0&&Ot(ft,{align:"center",children:[ce("p",{className:"dndev-text-base",style:{fontSize:"var(--font-size-md)",fontWeight:"var(--font-weight-semibold)",margin:0,color:"var(--muted-foreground)"},children:t("errors.notFound.suggestions","You might be looking for:")}),ce(ft,{direction:"row",wrap:"wrap",justify:"center",gap:"tight",children:a.map(s=>ce(D,{path:s.path,replace:!0,children:ce(uo,{variant:po.OUTLINE,icon:ce(oe,{icon:s.icon,fallback:ji}),"aria-label":t("errors.notFound.navigateTo",`Navigate to ${s.label}`,{label:s.label}),children:s.label})},s.path))})]}),Ot(ft,{direction:"row",wrap:"wrap",justify:"center",children:[ce(D,{path:"/",replace:!0,children:ce(uo,{variant:po.DEFAULT,icon:qi,"aria-label":t("errors.notFound.goHome","Go to home page"),children:t("errors.notFound.goHome","Go Home")})}),ce(uo,{variant:po.OUTLINE,icon:Yi,onClick:i,"aria-label":t("errors.notFound.goBack","Go back to previous page"),children:t("errors.notFound.goBack","Go Back")})]})]})})}import{useNavigate as We,useBack as jf,useRefresh as Zf,usePrefetch as Jf,useLocation as Qf,useRoutePath as Xf,useParams as eg,useRouteParam as tg,useSearchParams as og,useMatch as ng,useQueryParams as rg,useRedirectGuard as ag,useLocalizedPath as ig,useUrlLanguage as sg}from"@donotdev/ui/routing/hooks";import{getDndevConfig as fo,isClient as Ge,isDev as Mn}from"@donotdev/core";var re=class{static getBrowserSupport(){if(!Ge())return{svg:!0,webp:!1,avif:!1};let t=this.cache.get("browser-support");if(t)return t;let o={svg:!0,webp:!1,avif:!1};try{let n=document.createElement("canvas");n.width=1,n.height=1,o.webp=n.toDataURL("image/webp").indexOf("data:image/webp")===0}catch{o.webp=!1}try{let n=document.createElement("canvas");n.width=1,n.height=1,o.avif=n.toDataURL("image/avif").indexOf("data:image/avif")===0}catch{o.avif=!1}return this.cache.set("browser-support",o),o}static extractStringValues(t){let o=[];if(t==null)return o;if(typeof t=="string")o.push(t);else if(Array.isArray(t))for(let n of t)o.push(...this.extractStringValues(n));else if(typeof t=="object")for(let n of Object.values(t))o.push(...this.extractStringValues(n));return o}static assetExists(t){if(!Ge())return!1;let o=this.getAssetManifest();return o?this.extractStringValues(o).includes(t):!1}static getAssetManifest(){return Ge()&&fo()?.assets?.mapping||null}static getLogoSvgContent(){return fo()?.assets?.logoSvgContent||null}static resolveLogo(t){if(t)return t;let o="logo";if(this.cache.has(o))return this.cache.get(o);let r=this.getAssetManifest()?.logo?.optimal||"/logo.svg";return this.cache.set(o,r),r}static directAssetCheck(t){if(!Ge())return!1;try{let o=new Image;return o.src=t,!0}catch{return!1}}static resolveFaviconSet(){let t="favicon-set";if(this.cache.has(t))return this.cache.get(t);let o=this.getAssetManifest();if(o?.favicon?.set){let a=o.favicon.set,i=this.assetExists("/icon-512x512.png")?"/icon-512x512.png":this.assetExists("/icon-192x192.png")?"/icon-192x192.png":"/logo.svg",s={svg:a.svg||"/favicon.svg",ico:a.ico||"/favicon.ico",png16:a.png16||i,png32:a.png32||i,apple180:a.apple180||i,android192:a.android192||i,android512:a.android512||i};return this.cache.set(t,s),s}let n=this.assetExists("/icon-512x512.png")?"/icon-512x512.png":this.assetExists("/icon-192x192.png")?"/icon-192x192.png":"/logo.svg",r={svg:this.assetExists("/favicon.svg")?"/favicon.svg":"/logo.svg",ico:this.assetExists("/favicon.ico")?"/favicon.ico":"/favicon.svg",png16:this.assetExists("/favicon-16x16.png")?"/favicon-16x16.png":n,png32:this.assetExists("/favicon-32x32.png")?"/favicon-32x32.png":n,apple180:this.assetExists("/apple-touch-icon.png")?"/apple-touch-icon.png":n,android192:this.assetExists("/icon-192x192.png")?"/icon-192x192.png":n,android512:this.assetExists("/icon-512x512.png")?"/icon-512x512.png":n};return this.cache.set(t,r),r}static resolveFavicon(){let t=this.getAssetManifest();if(t?.favicon?.optimal)return t.favicon.optimal;let o=["/favicon.svg","/favicon.ico","/favicon.png","/logo.svg"];for(let n of o)if(this.assetExists(n))return n;return"/favicon.svg"}static clearCache(){this.cache.clear(),Mn()&&Ge()}static getDebugInfo(){return{browserSupport:this.getBrowserSupport(),detectedAssets:Ge()?fo()?.assets?.mapping:null,assetManifest:this.getAssetManifest(),cache:Object.fromEntries(this.cache)}}};Et(re,"cache",new Map);function ug(e){return re.resolveLogo(e)}function pg(){return re.resolveFaviconSet()}Mn()&&(re.clearCache(),Ge()&&window.addEventListener("DOMContentLoaded",()=>{re.clearCache()}));import*as es from"@donotdev/crud";var zn={forms:{},startSubmit:()=>{},setUploading:()=>{},setValidating:()=>{},setSubmitting:()=>{},setSuccess:()=>{},setError:()=>{},reset:()=>{},cleanup:()=>{},setIsDirty:(e,t)=>{},hasDirtyForms:()=>!1,getDirtyFormIds:()=>[],getStatus:()=>"idle",isLoading:()=>!1,getUploadProgress:()=>0,getError:()=>null,getIsDirty:()=>!1},ot=es?.useFormStore,gg=typeof ot=="function";function ts(e){return ot?ot(e):e(zn)}ts.getState=()=>ot&&typeof ot.getState=="function"?ot.getState():zn;import{useMemo as os}from"react";function Mt(){let e=N("status"),t=N("isAvailable"),o=N("user");return os(()=>({shouldHide:e!=="ready"||!t,isLoading:e==="initializing",isReady:e==="ready"&&t,isAuthenticated:!!o}),[e,t,o])}import*as ns from"@donotdev/billing";import{DEGRADED_BILLING_API as rs}from"@donotdev/core";var go=ns?.useStripeBilling;function as(e){return rs[e]}function ho(e,t){return go?go(e,t):as(e)}var wg=typeof go=="function";function Tg(){let e=N("user"),t=N("status"),o={user:e,status:t},n=ho("status",o),r=ho("isAvailable",o);return{shouldHide:!r,isLoading:n==="initializing",isReady:r&&n==="ready"}}import{DEGRADED_CRUD_API as is}from"@donotdev/core";import*as ss from"@donotdev/crud";var vo=ss?.useCrud;function ls(){return is}function Pg(e,t={}){return vo?vo(e,t):ls()}var Ag=typeof vo=="function";import{DEGRADED_OAUTH_API as cs}from"@donotdev/core";import*as ds from"@donotdev/oauth";var yo=ds?.useOAuth;function us(e){return cs[e]}function Ng(e){return yo?yo(e):us(e)}var Dg=typeof yo=="function";import{CheckCircle as ps}from"lucide-react";import{List as ms}from"@donotdev/components";import{translateArray as fs}from"@donotdev/core";import{jsx as Un}from"react/jsx-runtime";var gs=ps,hs=16;function zg(e,t,o,n=gs,r=hs){let a=n;return Un(ms,{icon:a?Un(a,{size:r}):void 0,items:fs(e,t,o),style:{listStyle:"none",paddingInlineStart:0}})}var vs=/<script[\s\S]*?<\/script>/gi,ys=/<foreignObject[\s\S]*?<\/foreignObject>/gi,bs=/\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,Ss=/\s+(?:xlink:)?href\s*=\s*["']\s*javascript:[^"']*["']/gi,ws=/\s+(?:xlink:)?href\s*=\s*["']\s*data:(?!image\/(?:png|jpe?g|gif|webp|svg\+xml))[^"']*["']/gi;function nt(e){return e.replace(vs,"").replace(ys,"").replace(bs,"").replace(Ss,"").replace(ws,"")}import{buildProductJsonLd as xs,deriveEntitySeo as Ts,getPlatformEnvVar as Es,useAppConfig as Rs,useTranslation as Ps}from"@donotdev/core";import{useLocalizedPath as As,useRoutePath as Is}from"@donotdev/ui/routing/hooks";import{Helmet as Cs}from"react-helmet-async";import{isNextJs as ks}from"@donotdev/core";import{Fragment as Vn,jsx as bo}from"react/jsx-runtime";function _n({children:e}){return typeof document>"u"?bo(Vn,{children:e}):ks()?bo(Vn,{children:e}):bo(Cs,{children:e})}import{jsx as G,jsxs as Ns}from"react/jsx-runtime";function Hn(e,t){return e.startsWith("/")&&t?`${t}${e}`:e}function Ls({title:e,fullTitle:t,description:o,image:n,type:r="website",keywords:a,noindex:i,canonicalUrl:s,publishDate:l,modifiedDate:c,entity:d,data:p}){let h=Rs("name")||"",f=Is(),m=As(),u=Es("APP_URL")||"",{t:g,language:y}=Ps(d?[d.namespace,"crud"]:void 0),x=d&&p?Ts(d,p,{t:g,locale:y}):null,C=e??x?.title,k=o??x?.description,P=n??x?.image,b=P?Hn(P,u):void 0,A=s??`${u}${m(f)}`,B=t||(C?`${C} | ${h}`:h),S=r==="product"?xs({title:C??void 0,description:k??void 0,image:b,images:b?[b,...(x?.images??[]).map(F=>Hn(F,u)).filter(F=>F!==b)]:[],price:x?.price,availability:x?.availability},A):null,w=[];if(k&&w.push(G("meta",{name:"description",content:k},"description"),G("meta",{property:"og:description",content:k},"og:description"),G("meta",{name:"twitter:description",content:k},"twitter:description")),b&&w.push(G("meta",{property:"og:image",content:b},"og:image"),G("meta",{name:"twitter:image",content:b},"twitter:image"),G("meta",{name:"twitter:card",content:"summary_large_image"},"twitter:card")),r&&w.push(G("meta",{property:"og:type",content:r},"og:type")),a&&a.length>0){let F=Array.isArray(a)?a.join(", "):a;w.push(G("meta",{name:"keywords",content:F},"keywords"))}return i&&w.push(G("meta",{name:"robots",content:"noindex, nofollow"},"robots")),r==="article"&&(l&&w.push(G("meta",{property:"article:published_time",content:l},"article:published_time")),c&&w.push(G("meta",{property:"article:modified_time",content:c},"article:modified_time"))),w.push(G("meta",{property:"og:title",content:B},"og:title"),G("meta",{name:"twitter:title",content:B},"twitter:title")),Ns(_n,{children:[G("title",{children:B}),s&&G("link",{rel:"canonical",href:s}),w,S&&G("script",{type:"application/ld+json",children:JSON.stringify(S)})]})}function jg(e){return e===null?()=>null:()=>G(Ls,{...e})}import{buildProductJsonLd as uh,deriveEntitySeo as ph}from"@donotdev/core";import*as Ds from"@donotdev/auth";var $n=Ds?.useDeleteAccount,Wn=()=>{},Fs={showConfirmDialog:!1,showPasswordDialog:!1,isDeleting:!1,error:null,startDeleteFlow:Wn,confirmDelete:async()=>{},cancel:Wn};function Gn(){return $n?$n():Fs}import{Fragment as Xs,jsx as Be,jsxs as el}from"react/jsx-runtime";var Yn=()=>null,Js=qn(async()=>{try{return{default:(await import("@donotdev/auth")).ReauthDialog}}catch{return{default:Yn}}}),Qs=qn(async()=>{try{return{default:(await import("@donotdev/auth")).ConfirmDeleteDialog}}catch{return{default:Yn}}}),zt=e=>{if(!e)return gt;if(typeof e=="function")return e;let t=e.replace(/['"]/g,""),o=Xe(t);return o||gt},So=({loginPath:e,display:t=Gs.AUTO,"no-tooltip":o=!1,customItems:n=[],className:r,style:a})=>{let{t:i}=Ks("dndev"),{shouldHide:s,isReady:l,isAuthenticated:c}=Mt(),d=Ys(),p=N("user"),h=N("signOut"),f=js("isLaptop"),m=xe(),u=Zs(),g=d.profilePath,y=d.authMenuItems||[],x=p?.role,C=Gn(),k=()=>p&&(p.displayName||p.email?.split("@")[0])||"User",P=()=>k().split(" ").map(w=>w.charAt(0)).slice(0,2).join("").toUpperCase(),b=()=>{if(!p)return i("auth.userMenu",{defaultValue:"User menu"});let S=[k()];return p.email&&S.push(p.email),x&&x!=="guest"&&S.push(`Role: ${x}`),S.join(`
4
4
  `)},A=Us(()=>{let S=[];return!f&&p&&S.push({children:Be(Ws,{variant:"muted",as:"span",children:`${k()}${p.email?`
5
- ${p.email}`:""}`}),disabled:!0}),g&&S.push({label:i("auth.profile",{defaultValue:"Profile"}),icon:Bs,onClick:()=>u(g)}),y.forEach(w=>{let F=m.find(q=>q.path===w.path),ae=w.label||F?.label||w.path.split("/").pop()||"Menu",ie=w.icon?Mt(w.icon):F?.icon&&(typeof F.icon=="string"||typeof F.icon=="function")?Mt(F.icon):gt;S.push({label:ae,icon:ie,onClick:()=>u(w.path)})}),n.forEach(w=>{if(w.path){let F=m.find(q=>q.path===w.path),ae=w.label||F?.label||w.path.split("/").pop()||"Menu",ie=w.icon?Mt(w.icon):gt;S.push({label:ae,icon:ie,onClick:()=>u(w.path),disabled:w.disabled,style:w.style})}else if(w.onClick){let F=w.icon?Mt(w.icon):gt;S.push({label:w.label,icon:F,onClick:w.onClick,disabled:w.disabled,style:w.style})}}),S.push({label:i("auth.deleteAccount.label",{defaultValue:"Delete Account"}),icon:zs,onClick:C.startDeleteFlow,variant:"destructive"}),S.push({label:i("auth.signOut",{defaultValue:"Sign Out"}),icon:Os,onClick:()=>h(),variant:"destructive"}),S},[g,y,n,h,C,i,m,f,p,x,k,u]);return qs().length===0||s||!l||!c?null:el(Xs,{children:[Be(Gn,{fallback:null,children:Be(Js,{open:C.showPasswordDialog,isLoading:C.isDeleting,error:C.error,onReauth:S=>C.confirmDelete(S),onCancel:C.cancel})}),Be(Gn,{fallback:null,children:Be(Qs,{open:C.showConfirmDialog,isLoading:C.isDeleting,error:C.error,onConfirm:()=>C.confirmDelete(),onCancel:C.cancel})}),Be($s,{trigger:Be(_s,{variant:Hs.OUTLINE,icon:p?Be(Vs,{src:p.photoURL??void 0,fallback:P(),alt:k(),style:{margin:"-4px 0"}}):Ms,display:t,"aria-label":i("auth.userMenu",{defaultValue:"User menu"}),tooltip:!o&&f&&p?b():o?void 0:i("auth.userMenu",{defaultValue:"User menu"}),className:r,style:a,children:k()}),items:A,contentAlign:"end"})]})};import{jsx as K}from"react/jsx-runtime";var Jn=()=>null;function zt({display:e,variant:t=Zn.OUTLINE,signInLabel:o,className:n,style:r,children:a,...i}){return K(nl,{variant:t,icon:tl,display:e,tooltip:o,className:n,style:r,...i,children:a??o})}var dl=jn(async()=>{try{return{default:(await import("@donotdev/auth")).AuthPartnerButton}}catch{return{default:Jn}}}),Yn=jn(async()=>{try{return{default:(await import("@donotdev/auth")).MultipleAuthProviders}}catch{return{default:Jn}}}),wo=({display:e=il.AUTO,variant:t=Zn.OUTLINE,className:o,style:n})=>{let{t:r}=sl("dndev"),{shouldHide:a,isLoading:i,isReady:s,isAuthenticated:l}=Ot(),c=ll(),d=cl(),[p,h]=ol(!1),f=c.loginPath,m=r("auth.signIn",{defaultValue:"Sign In"}),u=r("auth.loading",{defaultValue:"Loading..."}),g=d.includes("password")||d.includes("emailLink");if(a||!s)return null;if(!l){if(f!==void 0)return K(D,{path:f,prefetch:!0,children:K(zt,{display:e,variant:t,signInLabel:m,className:o,style:n})});let y=d[0];return g?K(al,{trigger:K(zt,{display:e,signInLabel:m,className:o,style:n}),title:m,open:p,onOpenChange:h,"data-content-size":"form",children:K(So,{fallback:K("div",{style:{padding:"var(--gap-md)",fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:u}),children:K(Yn,{spacing:"medium",onSuccess:()=>h(!1)})})}):d.length>1?K(rl,{trigger:K(zt,{display:e,signInLabel:m,className:o,style:n}),children:K(So,{fallback:K("div",{style:{padding:"var(--gap-md)",fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:u}),children:K(Yn,{spacing:"tight"})})}):K(So,{fallback:K(zt,{display:e,signInLabel:m,className:o,style:n,disabled:i,tooltip:i?u:m,children:i?u:m}),children:K(dl,{partnerId:y,display:e,className:o,style:n})})}return K(bo,{display:e,loginPath:f,className:o,style:n})};import{AlertCircle as ul,RefreshCw as pl,Mail as ml,Cookie as fl}from"lucide-react";import{Card as gl,Button as Co,BUTTON_VARIANT as ko,Stack as Qn}from"@donotdev/components";import{useTranslation as hl}from"@donotdev/core";import{jsx as ht,jsxs as Ut}from"react/jsx-runtime";function vl({featureName:e,title:t,description:o,showReviewCookies:n=!1,showContactSupport:r=!0,showRetry:a=!1,supportEmail:i="support@example.com",onRetry:s,onReviewCookies:l,customActions:c,className:d=""}){let{t:p}=hl("ui"),h=o||p("featureDisabled.description","{featureName} is not available. This may be due to missing configuration or disabled features.",{featureName:e}),f=()=>{if(l)l();else{let u=new CustomEvent("openCookieConsent");window.dispatchEvent(u)}},m=()=>{window.location.href=`mailto:${i}?subject=${encodeURIComponent(`Feature Unavailable: ${e}`)}&body=${encodeURIComponent(`I'm experiencing an issue with ${e} not being available.`)}`};return Ut(gl,{className:d,title:Ut(Qn,{direction:"row",align:"center",gap:"tight",children:[ht(ul,{className:"dndev-size-md",style:{color:"var(--destructive)"}}),t||e]}),subtitle:h,children:[" ",Ut("div",{style:{display:"grid",gap:"var(--gap-md)"},children:[(n||r||a||c)&&Ut(Qn,{direction:"row",wrap:"wrap",gap:"tight",children:[n&&ht(Co,{variant:ko.OUTLINE,onClick:f,icon:fl,children:p("featureDisabled.reviewCookies","Review Cookies")}),r&&ht(Co,{variant:ko.OUTLINE,onClick:m,icon:ml,children:p("featureDisabled.contactSupport","Contact Support")}),a&&ht(Co,{variant:ko.OUTLINE,onClick:s,icon:pl,children:p("featureDisabled.retry","Retry")}),c]}),ht("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:p("featureDisabled.helpText","If you believe this is an error, please contact support or try refreshing the page.")})]})]})}var yl=vl;import{Lock as Vt,Shield as Xn}from"lucide-react";import{useEffect as xo,useRef as er,useCallback as bl}from"react";import{Portal as Sl,Spinner as wl,Stack as Cl,Text as vt,Button as kl}from"@donotdev/components";import{useTranslation as xl,useOverlay as Ie}from"@donotdev/core";import{jsx as Te,jsxs as or}from"react/jsx-runtime";var tr={connecting:0,preparing:2e3,redirecting:5e3},Tl=1e4;function El(e,t){return t==="none"?null:t==="shield"?Xn:t==="lock"?Vt:e?e.startsWith("stripe-")||e.includes("payment")||e.includes("checkout")?Vt:e.startsWith("oauth-")||e.startsWith("auth-")?Xn:Vt:Vt}function Rl(e){return e||"default"}function Pl(){let{t:e}=xl("dndev"),t=Ie("isRedirectOverlayOpen"),o=Ie("redirectOperation"),n=Ie("redirectPhase"),r=Ie("showCancelButton"),a=Ie("redirectConfig"),i=Ie("redirectStartTime"),s=Ie("setRedirectPhase"),l=Ie("setShowCancelButton"),c=Ie("hideRedirectOverlay"),d=er([]),p=er(null),h=bl(()=>{c()},[c]);if(xo(()=>{if(!t||!i)return;let k=a?.cancelTimeout??Tl,P=Date.now()-i;d.current.forEach(clearTimeout),d.current=[],p.current&&(clearTimeout(p.current),p.current=null);let b=(B,S)=>{let w=Math.max(0,S-P);if(w>0){let F=setTimeout(()=>{s(B)},w);d.current.push(F)}else s(B)};b("preparing",tr.preparing),b("redirecting",tr.redirecting);let A=Math.max(0,k-P);return p.current=setTimeout(()=>{l(!0),s("timeout")},A),()=>{d.current.forEach(clearTimeout),d.current=[],p.current&&(clearTimeout(p.current),p.current=null)}},[t,i,a?.cancelTimeout,s,l]),xo(()=>{if(!t)return;let k=()=>{c()};return window.addEventListener("popstate",k),()=>window.removeEventListener("popstate",k)},[t,c]),xo(()=>{if(!t)return;let k=()=>{};return document.addEventListener("visibilitychange",k),()=>document.removeEventListener("visibilitychange",k)},[t]),!t)return null;let f=Rl(o),m=a?.title??e(`redirectOverlay.${f}.title`,{defaultValue:e("redirectOverlay.default.title")}),u=a?.message??e(`redirectOverlay.${f}.message`,{defaultValue:e("redirectOverlay.default.message")}),g=a?.subtitle??e(`redirectOverlay.${f}.subtitle`,{defaultValue:e("redirectOverlay.default.subtitle")}),y=e(`redirectOverlay.${f}.ariaLabel`,{defaultValue:e("redirectOverlay.default.ariaLabel")}),x=e(`redirectOverlay.phases.${n}`),C=El(o,a?.icon);return Te(Sl,{children:Te("div",{className:"dndev-spinner-overlay",role:"status","aria-busy":"true","aria-label":y,style:{zIndex:"var(--z-overlay, 9999)"},children:or("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"var(--gap-md)",textAlign:"center",maxWidth:"400px",padding:"var(--gap-lg)"},children:[or(Cl,{direction:"row",align:"center",children:[C&&Te(C,{style:{width:"1.5rem",height:"1.5rem",color:"var(--primary)"},"aria-hidden":"true"}),Te(wl,{variant:"primary"})]}),Te(vt,{as:"h3",style:{color:"var(--foreground)",margin:0},children:m}),Te(vt,{variant:"muted",style:{color:"var(--foreground)",minHeight:"1.5em"},children:x}),Te(vt,{variant:"muted",level:"small",style:{opacity:.8},children:u}),Te(vt,{variant:"muted",level:"small",style:{opacity:.6},children:g}),Te(vt,{variant:"muted",level:"small",style:{opacity:.5,marginTop:"var(--gap-sm)"},children:e("redirectOverlay.doNotRefresh")}),r&&Te(kl,{variant:"ghost",onClick:h,style:{marginTop:"var(--gap-md)"},children:e("redirectOverlay.cancel")})]})})})}import{useEffect as To,useState as nr}from"react";import{cn as Al}from"@donotdev/components";import{jsx as rr}from"react/jsx-runtime";var Il=({isActive:e=!1,progress:t,useFakeProgress:o=!0,duration:n=2e3,className:r,show:a=!0})=>{let[i,s]=nr(0),[l,c]=nr(!1);To(()=>{if(!e||!o||t!==void 0)return;c(!0),s(0);let p=Date.now(),h=setInterval(()=>{let f=Date.now()-p,m=Math.min(f/n*90,90);s(m)},16);return()=>{clearInterval(h)}},[e,o,t,n]),To(()=>{t!==void 0&&c(t>0&&t<100)},[t]),To(()=>{if(!e){let p=setTimeout(()=>{c(!1),s(0)},300);return()=>clearTimeout(p)}},[e]);let d=t??i;return!a||!l?null:rr("div",{className:Al(r),style:{position:"fixed",insetInlineStart:0,insetInlineEnd:0,zIndex:9999,height:"4px",backgroundColor:"transparent",top:"var(--header-height, 0px)"},role:"progressbar","aria-valuenow":Math.round(d),"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Page loading progress",children:rr("div",{style:{height:"100%",width:`${d}%`,background:"linear-gradient(to right, var(--primary), color-mix(in srgb, var(--primary) 80%, transparent), color-mix(in srgb, var(--primary) 60%, transparent))",transition:e?"width 0.3s ease-out":"width 0.2s ease-in",boxShadow:"var(--shadow-sm)"}})})},Ll=Il;import{cn as _t,Stack as Nl}from"@donotdev/components";import{jsx as yt,jsxs as ov}from"react/jsx-runtime";var Dl=({variant:e="text",width:t,height:o,lines:n=1,show:r=!0,className:a,animation:i="pulse",style:s})=>{if(!r)return null;let l={backgroundColor:"var(--muted)",opacity:"var(--opacity-muted)",borderRadius:"var(--radius)",animation:i==="pulse"||i==="wave"?"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite":"none",...i==="wave"&&{background:"linear-gradient(to right, color-mix(in srgb, var(--muted) 50%, transparent), color-mix(in srgb, var(--muted) 30%, transparent), color-mix(in srgb, var(--muted) 50%, transparent))"}},c=()=>{let d={};return t&&(d.width=typeof t=="number"?`${t}px`:t),o&&(d.height=typeof o=="number"?`${o}px`:o),d};return e==="text"?yt(Nl,{gap:"tight",children:Array.from({length:n}).map((d,p)=>yt("div",{className:_t("dndev-skeleton",a),style:{...l,height:"var(--gap-md)",width:p===n-1?"75%":"100%",...c(),...s}},p))}):e==="circular"?yt("div",{className:_t("dndev-skeleton",a),style:{...l,borderRadius:"var(--radius-full)",width:t||o||"40px",height:o||t||"40px",...c(),...s}}):e==="rectangular"?yt("div",{className:_t("dndev-skeleton",a),style:{...l,width:t||"100%",height:o||"200px",...c(),...s}}):yt("div",{className:_t("dndev-skeleton",a),style:{...l,borderRadius:"var(--radius-lg)",width:t||"100%",height:o||"20px",...c(),...s}})};var Fl=Dl;import{Card as Bl,IconBox as Ol,Stack as Ml,Text as Eo,renderCardContent as zl}from"@donotdev/components";import{jsx as Ee,jsxs as ar}from"react/jsx-runtime";var Ul=({icon:e,title:t,subtitle:o,content:n,href:r,variant:a,elevated:i,onClick:s,className:l,footer:c,style:d,clickable:p,maxLines:h=2,...f})=>{let m=zl(n),u=h,g=u<=0?"auto":`calc(var(--font-size-lg) * var(--line-height) * ${u} + var(--gap-md))`,y=u<=0?"auto":`calc(var(--font-size-base) * var(--line-height) * ${u} + var(--gap-md))`,x=`${g} ${y} 1fr${c?" auto":""}`,C=B=>B<=0?{display:"block",overflow:"visible",wordBreak:"break-word",lineHeight:"var(--line-height)",WebkitLineClamp:"unset",WebkitBoxOrient:"unset"}:{display:"-webkit-box",WebkitLineClamp:B,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",lineHeight:"var(--line-height)"},k={...C(u),fontSize:"var(--font-size-lg)",fontWeight:600,color:"inherit",margin:0,textAlign:"start",flex:1,minWidth:0},P={...C(u),fontSize:"var(--font-size-base)",fontWeight:u<=0?500:600,color:"var(--muted-foreground)",margin:0},b=e?ar(Ml,{direction:"row",align:u<=0?"start":"center",style:{width:"100%"},children:[Ee(Ol,{icon:e}),Ee(Eo,{as:"div",level:"h3",style:k,children:t})]}):Ee(Eo,{as:"div",level:"h3",style:k,children:t}),A=Ee(Bl,{variant:a,elevated:i,onClick:s,className:l,"data-clickable":r||s||p?"true":void 0,style:{paddingInlineStart:"var(--gap-md)",paddingInlineEnd:"var(--gap-md)",gap:"var(--gap-md)",height:"100%",textAlign:"start",...d},...f,children:ar("div",{style:{display:"grid",gridTemplateRows:x,gap:"var(--gap-md)",width:"100%"},children:[Ee("div",{style:{display:"flex",alignItems:u<=0?"flex-start":"center",justifyContent:"flex-start"},children:b}),Ee("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"flex-start"},children:Ee(Eo,{as:"div",level:"body",style:P,children:o})}),Ee("div",{children:m}),c&&Ee("div",{children:c})]})});return r&&!s?Ee(D,{path:r,style:{display:"block",textDecoration:"none",height:"100%"},"aria-label":t?`Learn more about ${t}`:void 0,children:A}):A},Vl=Ul;import{useState as Ql}from"react";import{Bento as Xl,Card as ec,Section as tc,Stack as oc,Text as nc,TONE as rc,cn as ac}from"@donotdev/components";var _l='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#3178C6" d="M1.125 0C.502 0 0 .502 0 1.125v21.75C0 23.498.502 24 1.125 24h21.75c.623 0 1.125-.502 1.125-1.125V1.125C24 .502 23.498 0 22.875 0zm17.363 9.75c.612 0 1.154.037 1.627.111a6.38 6.38 0 0 1 1.306.34v2.458a3.95 3.95 0 0 0-.643-.361 5.093 5.093 0 0 0-.717-.26 5.453 5.453 0 0 0-1.426-.2c-.3 0-.573.028-.819.086a2.1 2.1 0 0 0-.623.242c-.17.104-.3.229-.393.374a.888.888 0 0 0-.14.49c0 .196.053.373.156.529.104.156.252.304.443.444s.423.276.696.41c.273.135.582.274.926.416.47.197.892.407 1.266.628.374.222.695.473.963.753.268.279.472.598.614.957.142.359.214.776.214 1.253 0 .657-.125 1.21-.373 1.656a3.033 3.033 0 0 1-1.012 1.085 4.38 4.38 0 0 1-1.487.596c-.566.12-1.163.18-1.79.18a9.916 9.916 0 0 1-1.84-.164 5.544 5.544 0 0 1-1.512-.493v-2.63a5.033 5.033 0 0 0 3.237 1.2c.333 0 .624-.03.872-.09.249-.06.456-.144.623-.25.166-.108.29-.234.373-.38a1.023 1.023 0 0 0-.074-1.089 2.12 2.12 0 0 0-.537-.5 5.597 5.597 0 0 0-.807-.444 27.72 27.72 0 0 0-1.007-.436c-.918-.383-1.602-.852-2.053-1.405-.45-.553-.676-1.222-.676-2.005 0-.614.123-1.141.369-1.582.246-.441.58-.804 1.004-1.089a4.494 4.494 0 0 1 1.47-.629 7.536 7.536 0 0 1 1.77-.201zm-15.113.188h9.563v2.166H9.506v9.646H6.789v-9.646H3.375z"/></svg>',Hl='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#61DAFB" d="M14.23 12.004a2.236 2.236 0 0 1-2.235 2.236 2.236 2.236 0 0 1-2.236-2.236 2.236 2.236 0 0 1 2.235-2.236 2.236 2.236 0 0 1 2.236 2.236zm2.648-10.69c-1.346 0-3.107.96-4.888 2.622-1.78-1.653-3.542-2.602-4.887-2.602-.41 0-.783.093-1.106.278-1.375.793-1.683 3.264-.973 6.365C1.98 8.917 0 10.42 0 12.004c0 1.59 1.99 3.097 5.043 4.03-.704 3.113-.39 5.588.988 6.38.32.187.69.275 1.102.275 1.345 0 3.107-.96 4.888-2.624 1.78 1.654 3.542 2.603 4.887 2.603.41 0 .783-.09 1.106-.275 1.374-.792 1.683-3.263.973-6.365C22.02 15.096 24 13.59 24 12.004c0-1.59-1.99-3.097-5.043-4.032.704-3.11.39-5.587-.988-6.38-.318-.184-.688-.277-1.092-.278zm-.005 1.09v.006c.225 0 .406.044.558.127.666.382.955 1.835.73 3.704-.054.46-.142.945-.25 1.44-.96-.236-2.006-.417-3.107-.534-.66-.905-1.345-1.727-2.035-2.447 1.592-1.48 3.087-2.292 4.105-2.295zm-9.77.02c1.012 0 2.514.808 4.11 2.28-.686.72-1.37 1.537-2.02 2.442-1.107.117-2.154.298-3.113.538-.112-.49-.195-.964-.254-1.42-.23-1.868.054-3.32.714-3.707.19-.09.4-.127.563-.132zm4.882 3.05c.455.468.91.992 1.36 1.564-.44-.02-.89-.034-1.345-.034-.46 0-.915.01-1.36.034.44-.572.895-1.096 1.345-1.565zM12 8.1c.74 0 1.477.034 2.202.093.406.582.802 1.203 1.183 1.86.372.64.71 1.29 1.018 1.946-.308.655-.646 1.31-1.013 1.95-.38.66-.773 1.288-1.18 1.87-.728.063-1.466.098-2.21.098-.74 0-1.477-.035-2.202-.093-.406-.582-.802-1.204-1.183-1.86-.372-.64-.71-1.29-1.018-1.946.303-.657.646-1.313 1.013-1.954.38-.66.773-1.286 1.18-1.868.728-.064 1.466-.098 2.21-.098zm-3.635.254c-.24.377-.48.763-.704 1.16-.225.39-.435.782-.635 1.174-.265-.656-.49-1.31-.676-1.947.64-.15 1.315-.283 2.015-.386zm7.26 0c.695.103 1.365.23 2.006.387-.18.632-.405 1.282-.66 1.933-.2-.39-.41-.783-.64-1.174-.225-.392-.465-.774-.705-1.146zm3.063.675c.484.15.944.317 1.375.498 1.732.74 2.852 1.708 2.852 2.476-.005.768-1.125 1.74-2.857 2.475-.42.18-.88.342-1.355.493-.28-.958-.646-1.956-1.1-2.98.45-1.017.81-2.01 1.085-2.964zm-13.395.004c.278.96.645 1.957 1.1 2.98-.45 1.017-.812 2.01-1.086 2.964-.484-.15-.944-.318-1.37-.5-1.732-.737-2.852-1.706-2.852-2.474 0-.768 1.12-1.742 2.852-2.476.42-.18.88-.342 1.356-.494zm11.678 4.28c.265.657.49 1.312.676 1.948-.64.157-1.316.29-2.016.39.24-.375.48-.762.705-1.158.225-.39.435-.788.636-1.18zm-9.945.02c.2.392.41.783.64 1.175.23.39.465.772.705 1.143-.695-.102-1.365-.23-2.006-.386.18-.63.406-1.282.66-1.933zM17.92 16.32c.112.493.2.968.254 1.423.23 1.868-.054 3.32-.714 3.708-.147.09-.338.128-.563.128-1.012 0-2.514-.807-4.11-2.28.686-.72 1.37-1.536 2.02-2.44 1.107-.118 2.154-.3 3.113-.54zm-11.83.01c.96.234 2.006.415 3.107.532.66.905 1.345 1.727 2.035 2.446-1.595 1.483-3.092 2.295-4.11 2.295-.22-.005-.406-.05-.553-.132-.666-.38-.955-1.834-.73-3.703.054-.46.142-.944.25-1.438zm4.56.64c.44.02.89.034 1.345.034.46 0 .915-.01 1.36-.034-.44.572-.895 1.095-1.345 1.565-.455-.47-.91-.993-1.36-1.565z"/></svg>',$l='<svg role="img" viewBox="0 0 410 404" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="vite-a" x1="6" y1="33" x2="235" y2="344" gradientUnits="userSpaceOnUse"><stop stop-color="#41D1FF"/><stop offset="1" stop-color="#BD34FE"/></linearGradient><linearGradient id="vite-b" x1="195" y1="9" x2="236" y2="293" gradientUnits="userSpaceOnUse"><stop stop-color="#FFEA83"/><stop offset=".08" stop-color="#FFDD35"/><stop offset="1" stop-color="#FFA800"/></linearGradient></defs><path fill="url(#vite-a)" d="M399.641 59.525 215.643 388.545c-3.799 6.793-13.559 6.833-17.415.073L10.582 59.556c-4.201-7.366 2.098-16.29 10.446-14.797l184.195 32.923c1.175.21 2.378.208 3.553-.006l180.343-32.87c8.32-1.517 14.649 7.337 10.522 14.72z"/><path fill="url(#vite-b)" d="M292.965 1.574 156.801 28.255c-2.238.439-3.895 2.335-4.03 4.611l-8.376 141.465c-.197 3.332 2.863 5.918 6.115 5.168l37.91-8.749c3.547-.818 6.752 2.306 6.023 5.873l-11.263 55.153c-.758 3.712 2.727 6.886 6.352 5.785l23.415-7.114c3.63-1.102 7.118 2.081 6.35 5.796l-17.899 86.633c-1.12 5.42 6.088 8.374 9.094 3.728l2.008-3.103 110.954-221.428c1.858-3.707-1.346-7.935-5.418-7.15l-39.022 7.532c-3.667.707-6.787-2.708-5.752-6.296l25.469-88.291c1.036-3.594-2.095-6.612-5.764-5.891z"/></svg>',Wl='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M18.665 21.978C16.758 23.255 14.465 24 12 24 5.377 24 0 18.623 0 12S5.377 0 12 0s12 5.377 12 12c0 3.583-1.574 6.801-4.067 9.001L9.219 7.2H7.2v9.596h1.615V9.251l9.85 12.727Zm-3.332-8.533 1.6 2.061V7.2h-1.6v6.245Z"/></svg>',Gl='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#339933" d="M11.998,24c-0.321,0-0.641-0.084-0.922-0.247l-2.936-1.737c-0.438-0.245-0.224-0.332-0.08-0.383 c0.585-0.203,0.703-0.25,1.328-0.604c0.065-0.037,0.151-0.023,0.218,0.017l2.256,1.339c0.082,0.045,0.197,0.045,0.272,0l8.795-5.076 c0.082-0.047,0.134-0.141,0.134-0.238V6.921c0-0.099-0.053-0.192-0.137-0.242l-8.791-5.072c-0.081-0.047-0.189-0.047-0.271,0 L3.075,6.68C2.99,6.729,2.936,6.825,2.936,6.921v10.15c0,0.097,0.054,0.189,0.139,0.235l2.409,1.392 c1.307,0.654,2.108-0.116,2.108-0.89V7.787c0-0.142,0.114-0.253,0.256-0.253h1.115c0.139,0,0.255,0.112,0.255,0.253v10.021 c0,1.745-0.95,2.745-2.604,2.745c-0.508,0-0.909,0-2.026-0.551L2.28,18.675c-0.57-0.329-0.922-0.945-0.922-1.604V6.921 c0-0.659,0.353-1.275,0.922-1.603l8.795-5.082c0.557-0.315,1.296-0.315,1.848,0l8.794,5.082c0.57,0.329,0.924,0.944,0.924,1.603 v10.15c0,0.659-0.354,1.273-0.924,1.604l-8.794,5.078C12.643,23.916,12.324,24,11.998,24z M19.099,13.993 c0-1.9-1.284-2.406-3.987-2.763c-2.731-0.361-3.009-0.548-3.009-1.187c0-0.528,0.235-1.233,2.258-1.233 c1.807,0,2.473,0.389,2.747,1.607c0.024,0.115,0.129,0.199,0.247,0.199h1.141c0.071,0,0.138-0.031,0.186-0.081 c0.048-0.054,0.074-0.123,0.067-0.196c-0.177-2.098-1.571-3.076-4.388-3.076c-2.508,0-4.004,1.058-4.004,2.833 c0,1.925,1.488,2.457,3.895,2.695c2.88,0.282,3.103,0.703,3.103,1.269c0,0.983-0.789,1.402-2.642,1.402 c-2.327,0-2.839-0.584-3.011-1.742c-0.02-0.124-0.126-0.215-0.253-0.215h-1.137c-0.141,0-0.254,0.112-0.254,0.253 c0,1.482,0.806,3.248,4.655,3.248C17.501,17.007,19.099,15.91,19.099,13.993z"/></svg>',Kl='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#DD2C00" d="M19.455 8.369c-.538-.748-1.778-2.285-3.681-4.569-.826-.991-1.535-1.832-1.884-2.245a146 146 0 0 0-.488-.576l-.207-.245-.113-.133-.022-.032-.01-.005L12.57 0l-.609.488c-1.555 1.246-2.828 2.851-3.681 4.64-.523 1.064-.864 2.105-1.043 3.176-.047.241-.088.489-.121.738-.209-.017-.421-.028-.632-.033-.018-.001-.035-.002-.059-.003a7.46 7.46 0 0 0-2.28.274l-.317.089-.163.286c-.765 1.342-1.198 2.869-1.252 4.416-.07 2.01.477 3.954 1.583 5.625 1.082 1.633 2.61 2.882 4.42 3.611l.236.095.071.025.003-.001a9.59 9.59 0 0 0 2.941.568q.171.006.342.006c1.273 0 2.513-.249 3.69-.742l.008.004.313-.145a9.63 9.63 0 0 0 3.927-3.335c1.01-1.49 1.577-3.234 1.641-5.042.075-2.161-.643-4.304-2.133-6.371m-7.083 6.695c.328 1.244.264 2.44-.191 3.558-1.135-1.12-1.967-2.352-2.475-3.665-.543-1.404-.87-2.74-.974-3.975.48.157.922.366 1.315.622 1.132.737 1.914 1.902 2.325 3.461zm.207 6.022c.482.368.99.712 1.513 1.028-.771.21-1.565.302-2.369.273a8 8 0 0 1-.373-.022c.458-.394.869-.823 1.228-1.279zm1.347-6.431c-.516-1.957-1.527-3.437-3.002-4.398-.647-.421-1.385-.741-2.194-.95.011-.134.026-.268.043-.4.014-.113.03-.216.046-.313.133-.689.332-1.37.589-2.025.099-.25.206-.499.321-.74l.004-.008c.177-.358.376-.719.61-1.105l.092-.152-.003-.001c.544-.851 1.197-1.627 1.942-2.311l.288.341c.672.796 1.304 1.548 1.878 2.237 1.291 1.549 2.966 3.583 3.612 4.48 1.277 1.771 1.893 3.579 1.83 5.375-.049 1.395-.461 2.755-1.195 3.933-.694 1.116-1.661 2.05-2.8 2.708-.636-.318-1.559-.839-2.539-1.599.79-1.575.952-3.28.479-5.072zm-2.575 5.397c-.725.939-1.587 1.55-2.09 1.856-.081-.029-.163-.06-.243-.093l-.065-.026c-1.49-.616-2.747-1.656-3.635-3.01-.907-1.384-1.356-2.993-1.298-4.653.041-1.19.338-2.327.882-3.379.316-.07.638-.114.96-.131l.084-.002c.162-.003.324-.003.478 0 .227.011.454.035.677.07.073 1.513.445 3.145 1.105 4.852.637 1.644 1.694 3.162 3.144 4.515z"/></svg>',ql='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="m12 1.608 12 20.784H0Z"/></svg>',Yl='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#635BFF" d="M13.976 9.15c-2.172-.806-3.356-1.426-3.356-2.409 0-.831.683-1.305 1.901-1.305 2.227 0 4.515.858 6.09 1.631l.89-5.494C18.252.975 15.697 0 12.165 0 9.667 0 7.589.654 6.104 1.872 4.56 3.147 3.757 4.992 3.757 7.218c0 4.039 2.467 5.76 6.476 7.219 2.585.92 3.445 1.574 3.445 2.583 0 .98-.84 1.545-2.354 1.545-1.875 0-4.965-.921-6.99-2.109l-.9 5.555C5.175 22.99 8.385 24 11.714 24c2.641 0 4.843-.624 6.328-1.813 1.664-1.305 2.525-3.236 2.525-5.732 0-4.128-2.524-5.851-6.594-7.305h.003z"/></svg>',jl='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><defs><linearGradient id="vb-a" x1="0.414" y1="0.255" x2="0" y2="0.932" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#eab308"/><stop offset="1" stop-color="#ca8a04"/></linearGradient><linearGradient id="vb-b" x1="0.338" y1="0.02" x2="0.664" y2="0.966" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#fde68a"/><stop offset="1" stop-color="#fbbf24"/></linearGradient><linearGradient id="vb-c" y1="0.5" x2="1" y2="0.5" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#7dd3fc"/><stop offset="1" stop-color="#0ea5e9"/></linearGradient></defs><g transform="translate(-2056 -1899)"><path d="M742.271,987.024c-66.706,0-119.121,54.673-121.874,126.408l-2.551,95.471c-3.967,78.653,71.961,105.52,126.936,105.52Z" transform="translate(1463.458 1004.277)" fill="url(#vb-a)"/><path d="M92.616.01H319.894c54.53-.8,95.624,40.1,98.381,93.335l6.144,135.76c.732,67.368-48.116,94.95-104.525,95.335L92.616,327.374C34.061,327.8-1.063,283.663.022,229.105l3.8-135.76C7.41,33.54,33.3,1.093,92.616.01Z" transform="translate(2118.42 1991.302)" fill="url(#vb-b)"/><path d="M86.844.009H299.958c51.132-.746,89.665,37.307,92.25,86.824l5.761,126.29c.686,62.669-45.117,88.326-98.011,88.685L86.844,304.537C31.938,304.933-1,263.875.02,213.123L3.58,86.834C6.948,31.2,31.222,1.016,86.844.009Z" transform="translate(2136.977 2001.737)" fill="#111827"/><circle cx="27.626" cy="27.626" r="27.626" transform="translate(2421.148 2104.357)" fill="url(#vb-c)"/><circle cx="27.626" cy="27.626" r="27.626" transform="translate(2208.034 2104.357)" fill="url(#vb-c)"/></g></svg>',Zl='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#3FCF8E" d="M11.9 1.036c-.015-.986-1.26-1.41-1.874-.637L.764 12.05C-.33 13.427.65 15.455 2.409 15.455h9.579l.113 7.51c.014.985 1.259 1.408 1.873.636l9.262-11.653c1.093-1.375.113-3.403-1.645-3.403h-9.642z"/></svg>',Jl='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#FBF0DF" d="M12 22.596c6.628 0 12-4.338 12-9.688 0-3.318-2.057-6.248-5.219-7.986-1.286-.715-2.297-1.357-3.139-1.89C14.058 2.025 13.08 1.404 12 1.404c-1.097 0-2.334.785-3.966 1.821a49.92 49.92 0 0 1-2.816 1.697C2.057 6.66 0 9.59 0 12.908c0 5.35 5.372 9.687 12 9.687v.001ZM10.599 4.715c.334-.759.503-1.58.498-2.409 0-.145.202-.187.23-.029.658 2.783-.902 4.162-2.057 4.624-.124.048-.199-.121-.103-.209a5.763 5.763 0 0 0 1.432-1.977Zm2.058-.102a5.82 5.82 0 0 0-.782-2.306v-.016c-.069-.123.086-.263.185-.172 1.962 2.111 1.307 4.067.556 5.051-.082.103-.23-.003-.189-.126a5.85 5.85 0 0 0 .23-2.431Zm1.776-.561a5.727 5.727 0 0 0-1.612-1.806v-.014c-.112-.085-.024-.274.114-.218 2.595 1.087 2.774 3.18 2.459 4.407a.116.116 0 0 1-.049.071.11.11 0 0 1-.153-.026.122.122 0 0 1-.022-.083a5.891 5.891 0 0 0-.737-2.331Zm-5.087.561c-.617.546-1.282.76-2.063 1-.117 0-.195-.078-.156-.181 1.752-.909 2.376-1.649 2.999-2.778 0 0 .155-.118.188.085 0 .304-.349 1.329-.968 1.874Zm4.945 11.237a2.957 2.957 0 0 1-.937 1.553c-.346.346-.8.565-1.286.62a2.178 2.178 0 0 1-1.327-.62 2.955 2.955 0 0 1-.925-1.553.244.244 0 0 1 .064-.198.234.234 0 0 1 .193-.069h3.965a.226.226 0 0 1 .19.07c.05.053.073.125.063.197Zm-5.458-2.176a1.862 1.862 0 0 1-2.384-.245 1.98 1.98 0 0 1-.233-2.447c.207-.319.503-.566.848-.713a1.84 1.84 0 0 1 1.092-.11c.366.075.703.261.967.531a1.98 1.98 0 0 1 .408 2.114 1.931 1.931 0 0 1-.698.869v.001Zm8.495.005a1.86 1.86 0 0 1-2.381-.253 1.964 1.964 0 0 1-.547-1.366c0-.384.11-.76.32-1.079.207-.319.503-.567.849-.713a1.844 1.844 0 0 1 1.093-.108c.367.076.704.262.968.534a1.98 1.98 0 0 1 .4 2.117 1.932 1.932 0 0 1-.702.868Z"/></svg>',Ro={bun:{svg:`data:image/svg+xml,${encodeURIComponent(Jl)}`,color:"#FBF0DF",name:"Bun"},typescript:{svg:`data:image/svg+xml,${encodeURIComponent(_l)}`,color:"#3178C6",name:"TypeScript"},react:{svg:`data:image/svg+xml,${encodeURIComponent(Hl)}`,color:"#61DAFB",name:"React"},vite:{svg:`data:image/svg+xml,${encodeURIComponent($l)}`,color:"#BD34FE",name:"Vite"},nextjs:{svg:`data:image/svg+xml,${encodeURIComponent(Wl)}`,color:"var(--foreground, #000000)",name:"Next.js"},nodejs:{svg:`data:image/svg+xml,${encodeURIComponent(Gl)}`,color:"#339933",name:"Node.js"},firebase:{svg:`data:image/svg+xml,${encodeURIComponent(Kl)}`,color:"#DD2C00",name:"Firebase"},supabase:{svg:`data:image/svg+xml,${encodeURIComponent(Zl)}`,color:"#3FCF8E",name:"Supabase"},vercel:{svg:`data:image/svg+xml,${encodeURIComponent(ql)}`,color:"var(--foreground, #000000)",name:"Vercel"},stripe:{svg:`data:image/svg+xml,${encodeURIComponent(Yl)}`,color:"#635BFF",name:"Stripe"},valibot:{svg:`data:image/svg+xml,${encodeURIComponent(jl)}`,color:"#FBBF24",name:"Valibot"}};import{jsx as Ke,jsxs as cc}from"react/jsx-runtime";function ic({techKey:e,variant:t}){let o=Ro[e],[n,r]=Ql(!1);if(!o)return null;let a=decodeURIComponent(o.svg.replace("data:image/svg+xml,","")),i=nt(a);return Ke(ec,{variant:t,className:"dndev-tech-card",style:{"--tech-color":o.color},"data-hover":n,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:cc(oc,{direction:"column",align:"center",gap:"tight",children:[Ke("div",{className:"dndev-tech-card-logo","data-tech":e,dangerouslySetInnerHTML:{__html:i}}),Ke(nc,{as:"span",level:"small",children:o.name})]})})}function sc({title:e,techs:t,cols:o=3,gap:n="medium",separator:r=!1,tone:a=rc.GHOST,align:i,collapsible:s,open:l,onOpenChange:c,defaultOpen:d,className:p}){let h=typeof o=="number"?{mobile:o,tablet:o,desktop:o,wide:o}:{mobile:o[0],tablet:o[1],desktop:o[2],wide:o[3]},f=g=>{if(g==="long")return{cols:2,rows:1};if(g==="high")return{cols:1,rows:2};if(g==="huge")return{cols:2,rows:2}},m=t.filter(g=>Ro[g.name]).map(g=>({id:g.name,content:Ke(ic,{techKey:g.name,variant:g.variant}),span:f(g.size)})),u=Ke(Xl,{items:m,columns:h,gap:n,ariaLabel:"Technology stack"});return Ke(tc,{title:e,separator:r,tone:a,align:i,collapsible:s,open:l,onOpenChange:c,defaultOpen:d,className:ac("dndev-tech-bento",p),children:Ke("div",{className:"dndev-tech-bento-grid",children:u})})}var lc=sc;import{Suspense as dc,lazy as uc}from"react";import{useConsent as ir}from"@donotdev/core";import{jsx as sr}from"react/jsx-runtime";var pc=uc(()=>import("./CookieConsent-QOUAY6B4.js"));function Tv(){let e=ir("hasConsented"),t=ir("showBanner");return e&&!t?null:sr(dc,{fallback:null,children:sr(pc,{})})}import{useLayoutEffect as mc}from"react";import{useLayout as lr}from"@donotdev/core";function Iv({hideBreadcrumbs:e,preset:t}){let o=lr("setRouteHideBreadcrumbs"),n=lr("setRoutePresetOverride");return mc(()=>(e!=null&&o(e),t!=null&&n(t),()=>{o(!1),n(null)}),[e,t,o,n]),null}import{Button as cr,ScrollArea as fc}from"@donotdev/components";import{cn as dr}from"@donotdev/components";import{jsx as Le,jsxs as gc}from"react/jsx-runtime";function Fv({content:e,cta:t,align:o="center",justify:n="center",disableScrollArea:r=!1,contentVariant:a="narrow",contentClassName:i,ctaClassName:s}){let c=a==="narrow"?a==="narrow"&&Le("div",{className:"dndev-game-container__content-narrow",children:e}):e,d=r?Le("div",{style:{overflow:"auto",overscrollBehavior:"contain",height:"100%"},children:c}):Le(fc,{className:"dndev-game-container__scroll",children:c});return gc("div",{className:"dndev-game-container",children:[Le("div",{className:dr("dndev-game-container__content",i),"data-align":o,"data-justify":n,"data-content-variant":a,children:Le("div",{className:"dndev-game-container__scroll-wrapper",children:d})}),t&&Le("div",{className:dr("dndev-game-container__cta",s),children:Array.isArray(t)?Le("div",{className:"dndev-game-container__cta-buttons",children:t.map((p,h)=>Le(cr,{onClick:p.onClick,disabled:p.disabled??!1,variant:p.variant??"default",className:"dndev-game-container__cta-button",fullWidth:!0,children:p.label},h))}):Le(cr,{onClick:t.onClick,disabled:t.disabled??!1,variant:t.variant??"default",className:"dndev-game-container__cta-button",children:t.label})})]})}import{useEffect as hc,Suspense as vc,lazy as yc}from"react";import{jsx as Po}from"react/jsx-runtime";var ur=new Set,pr=new Map;function bc(e,t){let o=pr.get(e);if(o)return o;let n=t[e];if(!n)return null;let r=yc(n);return pr.set(e,r),r}function zv({screenRegistry:e,currentScreen:t,nextScreen:o,fallback:n=null}){hc(()=>{if(o&&!ur.has(o)){ur.add(o);let a=e[o];a&&a().catch(()=>{})}},[o,e]);let r=t?bc(t,e):null;return!t||!r?null:Po("div",{style:{height:"100%"},children:Po(vc,{fallback:n,children:Po(r,{})})})}import{cn as Sc,DISPLAY as Ao}from"@donotdev/components";import{useAppConfig as mr}from"@donotdev/core";import{jsx as Ht,jsxs as kc}from"react/jsx-runtime";var wc=({display:e=Ao.AUTO,linkToHome:t=!0,className:o})=>{let n=mr("name"),a=mr("shortName")||n||"App",i=re.getLogoSvgContent(),s=re.resolveLogo(),l=e===Ao.FULL||e===Ao.AUTO,c=i?Ht("div",{className:"app-branding-logo",role:"img","aria-label":a,dangerouslySetInnerHTML:{__html:nt(i)}}):re.assetExists(s)?Ht("img",{src:s,alt:a,className:"app-branding-logo"}):null,d=l&&Ht("span",{className:"app-branding-title","data-display":e,children:a}),p=kc("div",{className:Sc("app-branding",o),"data-display":e,children:[c,d]});return t?Ht(D,{path:"/",className:"app-branding-link",children:p}):p},Cc=wc;import{cn as fr}from"@donotdev/components";import{useAppConfig as gr}from"@donotdev/core";import{jsx as vr}from"react/jsx-runtime";var hr={sm:{width:"var(--icon-md)",height:"var(--icon-md)"},md:{width:"var(--icon-touch)",height:"var(--icon-touch)"},lg:{width:"var(--icon-touch)",height:"var(--icon-touch)"},xl:{width:"var(--touch-target)",height:"var(--touch-target)"},header:{height:"var(--icon-touch)",width:"auto"}},xc=({alt:e,size:t="header",className:o})=>{let n=gr("name"),r=gr("shortName"),a=e||n||r||"App",i=re.getLogoSvgContent(),s=re.resolveLogo(),l=typeof t=="string"&&t in hr?hr[t]:typeof t=="string"?{}:{width:t,height:t};return i?vr("div",{className:fr("app-icon-header",o),style:{display:"inline-flex",...l},role:"img","aria-label":a,dangerouslySetInnerHTML:{__html:nt(i)}}):vr("img",{src:s,alt:a,className:fr(o),style:{objectFit:"contain",...l}})},Tc=xc;import{cn as yr}from"@donotdev/components";import{useAppConfig as br,useBreakpoint as Ec}from"@donotdev/core";import{jsx as Sr}from"react/jsx-runtime";var Rc=({title:e,className:t,linkToHome:o=!0})=>{let n=Ec("isMobileOrTablet"),r=br("name"),a=br("shortName"),i=e||n&&a||r||"App",s=Sr("div",{className:yr("dndev-text-base",t),style:{fontSize:"var(--font-size-xl)",fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},children:i});return o?Sr(D,{path:"/",className:yr("dndev-inline-block",t),children:s}):s},Pc=Rc;import{ChevronRight as Fc}from"lucide-react";import{useMemo as Bc}from"react";import{cn as Oc}from"@donotdev/components";import{useLayout as Mc,useTranslation as zc}from"@donotdev/core";import{useRoutePath as Uc}from"@donotdev/ui/routing/hooks";function wr(e){let t=[],o="";for(let n of e.split("/").filter(Boolean))o+=`/${n}`,t.push(o);return t}import{useMemo as Cr}from"react";import{useNavigationStore as l1,filterNavigationRoutes as c1,getRoutes as Ac,getRouteManifest as d1}from"@donotdev/core";function Ic(){return Cr(()=>{try{let e=Ac();return!e||e.length===0?[]:Lc(e)}catch{return[]}},[])}function kr(){let e=Ic();return Cr(()=>e.flatMap(t=>t.routes),[e])}function Lc(e){let t=new Map;return e.forEach(o=>{let n=typeof o.path=="string"?o.path:String(o.path);if(!n||n==="undefined"||n==="null")return;let r=o.meta?.entity||Nc(n)||"other",a={path:n,label:o.meta?.title||Dc(n),icon:o.meta?.icon,component:o.component,importPath:o.importPath,exportName:o.exportName,auth:o.auth,meta:o.meta};t.has(r)||t.set(r,{label:r.charAt(0).toUpperCase()+r.slice(1),routes:[]}),t.get(r)?.routes.push(a)}),Array.from(t.values())}function Nc(e){return e.split("/").filter(Boolean)[0]||null}function Dc(e){let t=e.split("/").filter(Boolean),o=t[t.length-1];return o?o.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "):"Home"}import{jsx as bt,jsxs as Hc}from"react/jsx-runtime";var Vc=({items:e,separator:t=Fc,showHome:o=!0,homeHref:n="/",variant:r="default",className:a})=>{let{t:i}=zc("dndev"),s=Uc(),l=kr(),c=Mc("routeRecordLabel"),d=Bc(()=>new Set(l.map(f=>f.path)),[l]),p=e||(()=>{let f=s.split("/").filter(Boolean),m=wr(s),u=[];return f.forEach((g,y)=>{let x=m[y]??"",C=c&&decodeURIComponent(g)===c.id?c.label:g.split("-").map(P=>P.charAt(0).toUpperCase()+P.slice(1)).join(" "),k=d.has(x)?x:void 0;u.push({label:C,href:k})}),u})(),h=o?[{label:i("navigation.home","Home"),href:n},...p]:p;return r==="smart"&&s.split("/").filter(Boolean).length<2?null:bt("nav",{role:"navigation","aria-label":"Breadcrumb navigation",className:Oc("breadcrumbs",a),children:h.map((f,m)=>{let g=m===h.length-1||!f.href;return Hc("span",{className:"breadcrumb-item",children:[m>0&&bt(t,{className:"dndev-size-md separator"}),f.icon&&bt(f.icon,{className:"dndev-size-md icon"}),f.href&&!g?bt(D,{path:f.href,className:"breadcrumb-link",children:f.label}):bt("span",{className:"breadcrumb-label",children:f.label})]},m)})})},_c=Vc;import{useTranslation as $c,maybeTranslate as xr,useLayout as Io,useAppConfig as Wc}from"@donotdev/core";import{jsx as rt,jsxs as Kc}from"react/jsx-runtime";var Gc=({asLink:e=!1,className:t})=>{let o=Wc("app"),n=Io("gameTitle"),r=Io("gameSubtitle"),a=Io("gameNamespace"),{t:i}=$c(a||"dndev"),s=xr(i,n??void 0),l=xr(i,r??void 0),c=o?.name||"Game";if(s)return rt("div",{className:t,children:Kc("div",{style:{textAlign:"center"},children:[rt("h2",{style:{fontSize:"var(--font-size-lg)",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s}),l&&rt("p",{style:{color:"var(--muted-foreground)",fontSize:"var(--font-size-sm)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l})]})});let d=rt("h2",{style:{fontSize:"var(--font-size-lg)",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c});return e?rt(D,{path:"/",className:t,style:{fontSize:"var(--font-size-2xl)",fontWeight:700,transition:"color var(--dur-fast) ease-out"},onMouseEnter:p=>p.currentTarget.style.color="var(--primary)",onMouseLeave:p=>p.currentTarget.style.color="var(--foreground)",children:c}):rt("div",{className:t,children:d})};import{Trash2 as qc}from"lucide-react";import{useState as Tr}from"react";import{Button as Yc,BUTTON_VARIANT as jc,Checkbox as Zc,Stack as Lo,useToast as Jc}from"@donotdev/components";import{useTranslation as Qc}from"@donotdev/core";import{useRefresh as Xc}from"@donotdev/ui/routing/hooks";import{jsx as Wt,jsxs as Er}from"react/jsx-runtime";var $t=globalThis;function ed(){let{t:e}=Qc("dndev"),{toast:t}=Jc(),[o,n]=Tr(!1),r=Xc(),[a,i]=Tr({localStorage:!0,sessionStorage:!0,applicationCache:!0,serviceWorker:!0,cookies:!0,indexedDB:!0,webSQL:!0,memoryCache:!0}),s=async()=>{try{n(!0);let l=[];if(a.localStorage&&typeof window<"u")try{localStorage.clear(),l.push("localStorage")}catch{}if(a.sessionStorage&&typeof window<"u")try{sessionStorage.clear(),l.push("sessionStorage")}catch{}if(a.indexedDB&&typeof window<"u"&&"indexedDB"in window)try{if("databases"in indexedDB){let d=await indexedDB.databases();await Promise.all(d.map(async p=>{if(p.name){let h=indexedDB.deleteDatabase(p.name);await new Promise((f,m)=>{h.onsuccess=()=>f(void 0),h.onerror=()=>m(h.error)})}}))}l.push("IndexedDB")}catch{}if(a.webSQL&&typeof window<"u"&&"openDatabase"in window&&typeof $t.openDatabase=="function")try{let d=$t.openDatabase("","","","");d&&d.transaction&&d.transaction(p=>{p.executeSql('SELECT name FROM sqlite_master WHERE type="table"',[],(h,f)=>{for(let m=0;m<f.rows.length;m++){let u=f.rows.item(m).name;/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)&&h.executeSql(`DROP TABLE IF EXISTS ${u}`)}})}),l.push("WebSQL")}catch{}if(a.applicationCache&&typeof window<"u"&&"caches"in window)try{let d=await caches.keys();await Promise.all(d.map(async p=>{try{await caches.delete(p)}catch{}})),l.push("Application Cache")}catch{}if(a.serviceWorker&&"serviceWorker"in navigator)try{let d=await navigator.serviceWorker.getRegistrations();await Promise.all(d.map(async p=>{try{await p.unregister()}catch{}})),l.push("Service Workers")}catch{}if(a.cookies)try{document.cookie.split(";").forEach(d=>{let p=d.indexOf("="),h=p>-1?d.slice(0,p):d;document.cookie=`${h.trim()}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`,document.cookie=`${h.trim()}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=${window.location.hostname}`,document.cookie=`${h.trim()}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=.${window.location.hostname}`}),l.push("Cookies")}catch{}if(a.memoryCache)try{"gc"in window&&typeof $t.gc=="function"&&$t.gc(),l.push("Memory Cache")}catch{}let c=l.length>0?e("settings.clearCache.success","Cache cleared successfully: {{items}}",{items:l.join(", ")}):e("settings.clearCache.noItemsCleared","No cache items were cleared");t("success",c),l.length>0&&setTimeout(()=>{typeof globalThis<"u"&&globalThis._DNDEV_STORES_&&(globalThis._DNDEV_STORES_={}),typeof window<"u"?window.location.href=window.location.href:r()},1e3)}catch{t("error",e("settings.clearCache.error","Error clearing cache"))}finally{n(!1)}};return Er(Lo,{children:[Wt(Lo,{children:Object.entries(a).map(([l,c])=>Er(Lo,{direction:"row",align:"center",gap:"tight",children:[Wt(Zc,{id:l,checked:c,onCheckedChange:d=>i(p=>({...p,[l]:!!d}))}),Wt("label",{htmlFor:l,style:{fontSize:"var(--font-size-sm)",fontWeight:500,lineHeight:1,cursor:"pointer"},children:e(`settings.clearCache.${l}`,l.charAt(0).toUpperCase()+l.slice(1))})]},l))}),Wt(Yc,{variant:jc.DESTRUCTIVE,style:{margin:"0 auto"},disabled:o||!Object.values(a).some(Boolean),onClick:s,icon:qc,children:o?e("settings.clearCache.clearing","Clearing..."):e("settings.clearCache.button","Clear Cache")})]})}var No=ed;import{DropdownMenu as rd,Button as Do,Stack as ad}from"@donotdev/components";import{Link as td}from"lucide-react";import{navigationMenuTriggerStylePrimitive as od}from"@donotdev/components";import{jsx as Rr,jsxs as nd}from"react/jsx-runtime";var Gt=({path:e,route:t,showIcons:o=!0})=>{let n=xe(),r=t??n.find(s=>s.path===e);if(!r)return null;let a=o&&!!r.icon,i=!!r.label;return nd(D,{path:r.path,className:od(),...a&&!i&&{"data-display":"compact"},children:[o&&Rr(oe,{icon:r.icon,fallback:td}),Rr("span",{children:r.label})]})};import{jsx as qe}from"react/jsx-runtime";var id=({navigation:e,className:t})=>qe(ad,{role:"navigation",direction:"row",align:"center",className:t,style:{gap:"var(--gap-sm)"},children:e.map((o,n)=>o.routes&&o.routes.length>0?qe(rd,{trigger:qe(Do,{icon:o.icon,children:o.label}),items:o.routes.map(r=>({label:r.label,children:qe(Gt,{route:r}),asChild:!!r.path})),contentAlign:"start"},o.label+n):o.path?qe(Do,{icon:o.icon,"aria-label":o.label,render:({children:r,...a})=>qe(D,{path:o.path,...a,children:r}),children:o.label},o.label+n):qe(Do,{icon:o.icon,disabled:!0,"aria-label":o.label,children:o.label},o.label+n))}),sd=id;import{Card as ld,cn as cd}from"@donotdev/components";import{jsx as Fo}from"react/jsx-runtime";var dd=({languages:e,currentLanguage:t,onLanguageChange:o,className:n})=>Fo(ld,{className:cd("dndev-z-modal",n),style:{position:"fixed",bottom:"var(--gap-md)",insetInlineEnd:"var(--gap-md)",display:"flex",alignItems:"center",gap:"var(--gap-sm)",transition:"var(--dur-fast) ease-out"},role:"region","aria-label":"Language selector","data-role":"floating",children:Fo("select",{style:{backgroundColor:"transparent",outline:"none",fontSize:"var(--font-size-base)",cursor:"pointer"},value:t,onChange:r=>o?.(r.target.value),"aria-label":"Select language",children:e.map(r=>Fo("option",{value:r,children:r},r))})}),ud=dd;import{MoreHorizontal as pd}from"lucide-react";import{Button as md,BUTTON_VARIANT as fd,DropdownMenu as gd}from"@donotdev/components";import{jsx as Pr}from"react/jsx-runtime";var hd=({children:e,className:t})=>Pr(gd,{trigger:Pr(md,{variant:fd.GHOST,icon:pd,"aria-label":"Menu",className:t}),contentAlign:"end",children:e}),vd=hd;import{MoreHorizontal as yd}from"lucide-react";import{Link as bd}from"lucide-react";import{DISPLAY as St,DropdownMenu as Sd,Button as Ar}from"@donotdev/components";import{cn as wd}from"@donotdev/components";import{useBreakpoint as Ir,useTranslation as Cd}from"@donotdev/core";import{jsx as Ye}from"react/jsx-runtime";var kd=({className:e="",showIcons:t=!0,display:o=St.AUTO,path:n})=>{let{t:r}=Cd("dndev"),a=Ir("isMobile"),i=Ir("isTablet"),s=xe(),l=tn(n??"");return n?l?Ye(Ar,{variant:"ghost",display:o,icon:t?Ye(oe,{icon:l.icon,fallback:bd}):void 0,className:e,render:({children:d,...p})=>Ye(D,{path:l.path,...p,children:d}),children:l.label}):null:(o===St.AUTO?a||i?St.COMPACT:St.FULL:o)===St.COMPACT?Ye(Sd,{trigger:Ye(Ar,{variant:"ghost",icon:yd,"aria-label":r("navigation.menu","Navigation"),className:e}),contentAlign:"end",items:s.map(d=>({label:d.label,children:Ye(Gt,{route:d,showIcons:t}),asChild:!0}))}):Ye(Fn,{overflowDetection:!0,showIcons:t,className:wd(e),style:{flex:1}})},xd=kd;import{Bell as Td}from"lucide-react";import{useMemo as Ed,useEffect as Rd,useRef as Pd}from"react";import{Button as Ad,cn as Id,toast as Ld,Stack as Nd}from"@donotdev/components";import{jsx as Bo}from"react/jsx-runtime";var Dd={sm:{button:{width:"var(--icon-md)",height:"var(--icon-md)"},icon:{width:"var(--icon-md)",height:"var(--icon-md)"},badge:{width:"var(--icon-md)",height:"var(--icon-md)",fontSize:"var(--font-size-xs)"}},md:{button:{width:"var(--touch-target)",height:"var(--touch-target)"},icon:{width:"var(--icon-md)",height:"var(--icon-md)"},badge:{width:"var(--icon-md)",height:"var(--icon-md)",fontSize:"var(--font-size-xs)"}},lg:{button:{width:"var(--touch-target)",height:"var(--touch-target)"},icon:{width:"var(--icon-touch)",height:"var(--icon-touch)"},badge:{width:"var(--icon-touch)",height:"var(--icon-touch)",fontSize:"var(--font-size-sm)"}}},Fd=({notifications:e=[],count:t=0,loading:o=!1,onNotificationClick:n,onDropdownOpen:r,className:a,maxVisible:i=10,alwaysShow:s=!1,size:l="md",disabled:c=!1})=>{let d=Dd[l],p=Pd(new Set),h=Ed(()=>t===0?null:t>99?"99+":t.toString(),[t]),f=t>0||s;return Rd(()=>{e.forEach(m=>{if(!p.current.has(m.id)){p.current.add(m.id);let u=m.type==="error"?"error":m.type==="warning"?"warning":m.type==="success"?"success":"info";Ld({title:m.title,description:m.message,toastType:u,duration:0,onDismiss:()=>{p.current.delete(m.id),n&&n(m)}})}})},[e,n]),f?Bo("div",{className:Id(a),style:{position:"relative"},children:Bo(Ad,{disabled:c,style:{...d.button,position:"relative"},onClick:()=>{r?.()},onFocus:m=>{m.currentTarget.style.outline="2px solid var(--ring)",m.currentTarget.style.outlineOffset="2px"},onBlur:m=>{m.currentTarget.style.outline="none"},"aria-label":`${t} notification${t!==1?"s":""}`,icon:Td,children:h&&Bo(Nd,{align:"center",justify:"center",style:{position:"absolute",top:"-0.25rem",insetInlineEnd:"-0.25rem",backgroundColor:"var(--destructive)",color:"var(--destructive-foreground)",borderRadius:"var(--radius-full)",fontWeight:600,lineHeight:1,minWidth:0,...d.badge},"aria-hidden":"true",children:h})})}):null},Bd=Fd;import{Settings as Od,Check as Md}from"lucide-react";import*as Mo from"lucide-react";import{Button as zd,BUTTON_VARIANT as Ud,DropdownMenu as Vd,Stack as _d,DISPLAY as Hd}from"@donotdev/components";import{useTranslation as $d}from"@donotdev/core";import{useLanguageSelector as Wd,useTheme as Oo,Flag as Gd}from"@donotdev/core";import{jsx as Oe,jsxs as Yd}from"react/jsx-runtime";function Kd({variant:e=Ud.OUTLINE}={}){let{t}=$d("dndev"),{languages:o,currentLanguage:n,changeLanguage:r,isLoading:a}=Wd(),i=Oo("availableThemes"),s=Oo("currentTheme"),l=Oo("setTheme"),c=f=>{if(!f)return Mo.Palette;let m=f.replace(/['"]/g,"");return Xe(m)||Mo.Palette},d=i.map(f=>{let m=c(f.meta?.icon),u=f.name===s;return{label:f.displayName||f.name,icon:m,onClick:()=>l(f.name),checked:u}}),p=o.map(f=>{let m=f.id===n;return{label:f.nativeName,onClick:()=>r(f.id),disabled:a,checked:m,className:m?"bg-accent":void 0,iconEnd:m&&!a?Md:void 0,children:Yd(_d,{direction:"row",align:"center",gap:"tight",children:[Oe(Gd,{code:f.flagCode||f.id,title:f.nativeName}),Oe("span",{children:f.nativeName}),a&&m&&Oe("div",{style:{marginInlineStart:"auto"},children:Oe("div",{style:{width:"0.5rem",height:"0.5rem",borderRadius:"50%",backgroundColor:"var(--primary)"}})})]})}}),h=[{label:t("auth.title","Authentication"),subContent:Oe(wo,{display:Hd.COMPACT})},{label:t("settings.theme","Theme"),subItems:d},{label:t("settings.language","Language"),subItems:p},{label:t("settings.clearCache.title","Clear Cache"),subContent:Oe(No,{})}];return Oe(Vd,{trigger:Oe(zd,{variant:e,"aria-label":t("settings.title","Settings"),icon:Od}),items:h,contentWidth:"14rem",contentAlign:"end"})}var qd=Kd;import*as _o from"lucide-react";import{Button as Lr,BUTTON_VARIANT as jd,DropdownMenu as Zd,DISPLAY as Jd}from"@donotdev/components";import{useTranslation as Qd}from"@donotdev/core";import{useTheme as zo}from"@donotdev/core";import{jsx as Vo}from"react/jsx-runtime";var Uo=e=>{if(!e)return _o.Palette;let t=e.replace(/['"]/g,"");return Xe(t)||_o.Palette},Xd=({display:e=Jd.AUTO,"no-tooltip":t=!1})=>{let{t:o}=Qd("dndev"),n=zo("availableThemes"),r=zo("currentTheme"),a=zo("setTheme");if(n.length<=1)return null;let i=n.find(y=>y.name===r)||n[0],s=n.length===2?n.find(y=>y.name!==i?.name)||n[0]:null,l=i?Uo(i.meta?.icon):null,c=s?Uo(s.meta?.icon):null,d=i?.displayName||i?.name||"Theme",p=s?.displayName||s?.name||"Theme",h=n.length===2&&s&&c,f=h?c:l,m=h?t?void 0:o("common.themeSelector.tooltipWithNext","Change Theme: Switch to {{next}}",{next:s?.displayName||s?.name}):t?void 0:o("common.themeSelector.changeTheme","Change Theme"),u={variant:jd.OUTLINE,"aria-label":o("common.themeSelector.changeTheme","Change Theme"),tooltip:m,icon:f,display:e};if(h&&s)return Vo(Lr,{...u,onClick:()=>a(s.name),children:p});if(!i||!l)return null;let g=n.map(y=>{let x=Uo(y.meta?.icon),C=y.name===r;return{label:y.displayName||y.name,icon:x,onClick:()=>a(y.name),checked:C}});return Vo(Zd,{trigger:Vo(Lr,{...u,children:d}),items:g,contentWidth:"10rem"})},eu=Xd;import{ExternalLink as tu}from"lucide-react";import{getPlatformEnvVar as ou}from"@donotdev/core";import{jsx as nu,jsxs as ru}from"react/jsx-runtime";var Ho=({className:e})=>{let o=ou("APP_URL")==="https://donotdev.com";return ru("a",{href:o?"https://www.ambroise-park.com":"https://donotdev.com",target:"_blank",rel:"noopener noreferrer",className:e,style:{display:"inline-flex",alignItems:"center",gap:"var(--gap-sm)",fontSize:"var(--font-size-xs)"},children:[o?"AMBROISE-PARK":"DoNotDev",nu(tu,{style:{width:"12px",height:"12px"},"aria-hidden":"true"})]})};import{cn as au}from"@donotdev/components";import{useTranslation as iu,useAppConfig as su}from"@donotdev/core";import{jsxs as cu}from"react/jsx-runtime";var lu=({appName:e,year:t=new Date().getFullYear(),className:o})=>{let{t:n}=iu("dndev"),r=su("app"),a=e||r?.name||"App";return r?.footer===null?null:cu("span",{className:au(o),style:{flexShrink:0,color:"var(--muted-foreground)",fontSize:"var(--font-size-xs)"},children:["\xA9 ",t," ",a,". ",n("footer.legal.allRightsReserved")]})};import{Stack as uu}from"@donotdev/components";import{useTranslation as pu,maybeTranslate as mu,useAppConfig as fu}from"@donotdev/core";var du=[{path:"#cookie-settings",label:"footer.legal.cookieSettings"},{label:"footer.legal.privacyPolicy",path:"/privacy"},{label:"footer.legal.termsOfService",path:"/terms"}],Nr=e=>e===null||e?.legalLinks===null?[]:e?.legalLinks??du;import{jsx as Dr,jsxs as hu}from"react/jsx-runtime";var gu=({app:e,direction:t="column",gap:o="tight",align:n="stretch"})=>{let{t:r}=pu("dndev"),a=fu("app"),s=Nr((e||a||{}).footer),l={transition:"color var(--dur-fast) ease-out",textDecoration:"underline",textUnderlineOffset:"2px",color:"var(--muted-foreground)",fontSize:"var(--font-size-xs)"};return s.length===0?null:hu(uu,{direction:t,gap:o,align:n,children:[s.map(c=>Dr(D,{path:c.path,style:l,onMouseEnter:d=>d.currentTarget.style.color="var(--primary)",onMouseLeave:d=>d.currentTarget.style.color="var(--muted-foreground)",children:mu(r,c.label)},c.path)),Dr(Ho,{})]})};import{useMemo as wu}from"react";import{Stack as $o,Spinner as Cu}from"@donotdev/components";import{useTranslation as Br,isFieldVisible as ku}from"@donotdev/core";import{useEffect as vu,useRef as yu}from"react";import{deriveEntitySeo as bu,useLayout as Fr,useTranslation as Su}from"@donotdev/core";function Kt(e,t){let o=Fr("setRouteRecordLabel"),n=Fr("routeRecordLabel"),r=yu(n);r.current=n;let a=typeof t?.id=="string"?t.id:void 0,{t:i,language:s}=Su([e.namespace,"crud"]),l=t?bu(e,t,{t:i,locale:s}).title:void 0;vu(()=>{if(!(!a||!l))return o({id:a,label:l}),()=>{let c=r.current;c?.id===a&&c.label===l&&o(null)}},[a,l,o])}import{jsx as je,jsxs as Tu}from"react/jsx-runtime";function xu({entity:e,id:t,t:o,className:n="",loadingMessage:r,notFoundMessage:a,viewerRole:i,excludeFields:s,preview:l}){if(!ne)return null;let c=!!l,d=N("userRole"),p=i??(c?"super":d),{data:h,loading:f,error:m,notFound:u}=cn(e,t,{enabled:!c}),{t:g}=Br([e.namespace,"crud"]),{t:y}=Br("crud"),x=o||g,C=c?l:h;Kt(e,c?null:C);let k=c?null:m,P=c?!1:f||!t,b=wu(()=>C?Object.entries(e.fields).filter(([A,B])=>{if(s?.includes(A)||!ku(B.visibility,p)||B.visibility==="hidden")return!1;let S=C[A];return!(S==null||typeof S=="string"&&S.trim()===""||Array.isArray(S)&&S.length===0||typeof S=="object"&&!Array.isArray(S)&&S!==null&&Object.keys(S).length===0)}):[],[e.fields,p,C,s]);return P?je("div",{style:{position:"relative",width:"100%",gridColumn:"1 / -1",display:"contents"},className:n,children:je(Cu,{overlay:!0,"aria-label":r||y("form.loading")})}):!C&&!k&&!u?null:k||!C?je($o,{align:"center",justify:"center",style:{padding:"var(--gap-lg)",textAlign:"center"},className:n,children:Tu($o,{direction:"column",gap:"tight",children:[je("h3",{style:{color:"var(--muted-foreground)"},children:a||y("errors.notFound",{entity:g("name",{defaultValue:e.name})})}),k&&je("p",{style:{color:"var(--destructive)",fontSize:"var(--font-size-sm)"},children:k instanceof Error?k.message:String(k)})]})}):je($o,{direction:"column",className:n,children:b.map(([A,B])=>je(ct,{name:A,config:B,value:C[A],t:x},A))})}import{Search as _r,Undo2 as Hr}from"lucide-react";import{Suspense as Au,lazy as Iu,useCallback as Lu,useState as he}from"react";import{DataTable as $r,Button as ve,Stack as Ne,ActionButton as Nu,Section as wt,Input as Wr,Alert as Gr,Text as Ko}from"@donotdev/components";import{describeEntity as Du,getEntityByCollection as Fu,useTranslation as Ct}from"@donotdev/core";import{describeEntity as Eu}from"@donotdev/core";var Ru=new Set(["text","email","url","tel","textarea"]),Pu=new Set(["select","radio"]);function Wo(e,t,o,n,r){let a=e.fields[t],i=Eu(e).fields[t];if(!a||!i)throw new Error(`cellEditFor: entity "${e.name}" has no field "${t}".`);if(!i.editableFor(o,"edit"))return;let{value:s}=i;if(s.kind==="ref"&&s.ref!==void 0){let c=n[s.ref];return c?{type:"select",options:Object.entries(c).map(([d,p])=>({value:d,label:p})).sort((d,p)=>d.label.localeCompare(p.label))}:void 0}let{type:l}=a;if(Ru.has(l))return{type:"text"};if(l==="number")return{type:"number"};if(Pu.has(l)){let c=a.validation?.options,d=typeof c=="function"?c():c;return Array.isArray(d)?{type:"select",options:d.map(p=>({value:String(p.value),label:hn(p.label,r)}))}:void 0}}import{describeEntity as Or}from"@donotdev/core";var Mr=/^[A-Za-z0-9_-]{1,128}$/,zr=(e,t)=>{let o=Object.hasOwn(e.fields,t)?Or(e).fields[t]?.value:void 0;return o?.kind==="ref"&&o.ref!==void 0};function Ur(e,t){if(!zr(e,t.field))throw new Error(`EntityList: parent.field "${t.field}" is not a reference field of entity "${e.name}".`);if(t.value!==null&&!Mr.test(t.value))throw new Error(`EntityList: parent.value "${t.value}" is not a record id.`)}function Go(e,t){let o=new URLSearchParams({[t.field]:t.value});return`${e}/new?${o.toString()}`}function Vr(e,t,o){let n={};for(let[r,a]of t.entries())Object.hasOwn(e.fields,r)&&zr(e,r)&&Mr.test(a)&&Or(e).fields[r]?.editableFor(o,"create")===!0&&(n[r]=a);return n}import{Fragment as Zr,jsx as R,jsxs as Me}from"react/jsx-runtime";var Bu=Iu(()=>import("./ChildRowsPicker-PQFE6NCR.js")),Kr=[0,1,2,3,4].map(e=>({display:"grid",gridTemplateColumns:["1fr",...Array(e).fill("auto")].join(" ")}));function qr(e,t,o){let{t:n,viewerRole:r,referenceData:a,editing:i,interactive:s}=o;return t.map(l=>{let c=e.fields[l];if(!c)return null;let d=ut(l,c,n),p=c.type;return{key:l,title:d,dataIndex:l,sortable:s,filterable:s,align:p==="number"||p==="range"?"end":"start",...i&&{edit:Wo(e,l,r,a,n)},render:(m,u)=>ro(m,c,n,{compact:!0,referenceData:a,item:u})}}).filter(Boolean)}function Yr(e,t){return(e??[]).map(o=>({key:o.key,title:o.title,align:o.align??"start",render:(n,r)=>o.render(t(r))}))}function jr({actions:e}){return R(Ne,{direction:"row",gap:"tight",align:"center",children:e})}function Ou(e){if(!ne)return null;let{entity:t,parent:o,preview:n,tone:r,editable:a=!0}=e;o&&Ur(t,o);let i=mn(t,o);if(o&&o.value===null)return R(Mu,{entity:t,tone:r});let s=o&&o.value!==null?{field:o.field,value:o.value}:void 0;return!n&&(e.extend||i&&s&&a)?R(Vu,{...e,parent:s}):R(zu,{...e,parent:s})}function Mu({entity:e,tone:t}){let{t:o}=Ct([e.namespace,"crud"]);return R(wt,{tone:t,children:R(Ko,{level:"body",children:o("crud:childRows.createFirst",{entity:o("name",{defaultValue:e.name})})})})}function zu({entity:e,basePath:t,onClick:o,hideFilters:n=!1,pagination:r="auto",pageSize:a,queryOptions:i,exportable:s=!0,editable:l=!0,parent:c,preview:d,tone:p,extraColumns:h,actions:f}){let m=!!d,u=We(),g=t??`/${e.collection}`,y=oo(e,!m),[x,C]=he(1),{pageSize:k,setPageSize:P}=to({collection:e.collection,...a!=null&&{defaultPageSize:a}}),[b,A]=he(""),{filters:B}=lt({collection:e.collection}),S=Object.keys(B).length>0,{data:w,items:F,processed:ae,loading:ie,mutate:q,effectiveMode:$}=ln(e,{enabled:!m,pagination:r,searchQuery:b,...(i||c)&&{queryOptions:c?{...i,where:[...i?.where??[],{field:c.field,operator:"==",value:c.value}]}:i},...(r==="server"||r==="auto")&&{page:x,pageSize:k}}),I=m?d:ae,U=m?!1:ie,{bulk:Y}=sn(e),de=l&&!m,Q=N("userRole"),[z,X]=he({}),[ye,te]=he([]),ue=new Set(I.map(E=>E.id)),j=ye.filter(E=>ue.has(E)),[Re,Qe]=he(!1),[Ue,Z]=he(0),be=Object.values(z).reduce((E,V)=>E+Object.keys(V).length,0),Ve=async()=>{Qe(!0),Z(0);try{let{failed:E}=await Y({updates:Object.entries(z).map(([me,eo])=>({id:me,patch:eo}))}),V=new Set(E.map(me=>me.id));X(Object.fromEntries(Object.entries(z).filter(([me])=>V.has(me)))),Z(V.size)}catch{Z(Object.keys(z).length)}finally{Qe(!1)}},{t:L}=Ct("crud"),{t:_e}=Ct([e.namespace,"crud"]),Pe=async()=>{await q()},De=Lu(E=>{m||(o?o(E):u(`${g}/${E}`))},[g,u,o,m]),v=async()=>{if(m)return;Z(0);let{failed:E}=await Y({deletes:j}),V=new Set(E.map(me=>me.id));te(j.filter(me=>V.has(me))),Z(V.size)},O=(e.listFields||Object.keys(e.fields)).filter(E=>E!==c?.field),Ae=[...qr(e,O,{t:_e,viewerRole:Q,referenceData:y,editing:de,interactive:!m}),...Yr(h,E=>({...E,...z[E.id]}))],Se=_e("name",{defaultValue:e.name}),pe=I.length;return Me(Zr,{children:[!n&&R(wt,{title:L("filters.title",{entity:Se}),collapsible:!0,defaultOpen:S,tone:p,children:R(dt,{entity:e,data:F,fieldsToFilter:O,viewerRole:Q})}),R(wt,{title:U?L("results.title.fetching"):L("results.title.count",{count:pe}),tone:p,children:Me(Ne,{children:[Me(Ne,{direction:"row",gap:"tight",align:"center",className:"dndev-w-full",style:Kr[1+(l?1:0)+(f?1:0)],children:[R(Wr,{placeholder:L("actions.searchPlaceholder"),value:b,onChange:E=>A(E.target.value),icon:_r,className:"dndev-w-full",disabled:m}),R(ve,{intent:"reload",variant:"outline",onClick:Pe,disabled:m||U,display:"compact","aria-label":L("actions.refresh")}),l?m?R(ve,{intent:"add",display:"compact",disabled:!0,children:L("addNew")}):R(ve,{intent:"add",display:"compact",render:({children:E,...V})=>R(D,{path:c?Go(g,c):`${g}/new`,...V,children:E}),children:L("addNew")}):null,f&&R(jr,{actions:f})]}),de&&be>0&&Me(Ne,{direction:"row",gap:"tight",align:"center",wrap:"wrap",children:[R(Ko,{level:"body",children:L("bulkEdit.pending",{count:be})}),R(ve,{intent:"save",display:"compact",onClick:Ve,disabled:Re,children:L(Re?"form.saving":"actions.save")}),R(ve,{icon:Hr,variant:"outline",display:"compact",onClick:()=>{X({}),Z(0)},disabled:Re,children:L("bulkEdit.discard")})]}),Ue>0&&R(Gr,{variant:"error",title:L("bulkEdit.failed",{count:Ue})}),!m&&l&&j.length>0&&R(Ne,{direction:"row",gap:"tight",align:"center",wrap:"wrap",children:R(Nu,{action:v,confirmTitle:L("delete.titleSelected",{count:j.length}),confirmText:L("delete.confirmSelected",{count:j.length}),confirmLabel:L("actions.delete"),cancelLabel:L("actions.cancel"),variant:"outline",intent:"delete",display:"compact",children:L("bulkEdit.deleteSelected",{count:j.length})})}),R($r,{data:I,columns:Ae,sortable:!m,searchable:!1,pagination:!0,loading:U,onRowClick:m?void 0:E=>De(E.id),selectable:!m&&l,getRowId:E=>E.id,onSelect:E=>te(E.map(V=>V.id)),openLabel:L("actions.open"),...!m&&(o?{onRowOpen:E=>o(E.id)}:{getRowHref:E=>`${g}/${E.id}`}),...de&&{editable:!0,pendingChanges:z,onPendingChange:X,editLabels:{selected:L("bulkEdit.selected"),field:L("bulkEdit.field"),value:L("bulkEdit.value"),apply:L("bulkEdit.apply")}},showingLabel:L("pagination.showing"),paginationPreviousLabel:L("pagination.previous"),paginationNextLabel:L("pagination.next"),paginationItemsPerPagePlaceholder:L("pagination.itemsPerPagePlaceholder"),pageSize:k,onPageSizeChange:P,...!m&&$==="server"&&{currentPage:x,total:w?.total,onPageChange:C},exportable:m?!1:s,exportFilename:`${e.collection}-export`,exportLabel:L("export")})]})})]})}function Uu(e,t){let o=Object.entries(Du(e).fields).filter(([n,{value:r}])=>n!==t&&r.kind==="ref"&&r.ref!==void 0);return o.length===1?o[0][0]:null}function Vu({entity:e,basePath:t,onClick:o,hideFilters:n=!1,pageSize:r,exportable:a=!0,editable:i=!0,parent:s,tone:l,extraColumns:c,actions:d,extend:p}){let h=We(),f=t??`/${e.collection}`,m=N("userRole"),u=pn(e,s,{viewerRole:m,...p&&{extend:p}}),g=u.joined&&i,y=oo(e),{pageSize:x,setPageSize:C}=to({collection:e.collection,...r!=null&&{defaultPageSize:r}}),[k,P]=he(""),{filters:b}=lt({collection:e.collection}),A=Object.keys(b).length>0,[B,S]=he([]),[w,F]=he(!1),[ae,ie]=he(!1),[q,$]=he(null),{t:I}=Ct("crud"),{t:U}=Ct([e.namespace,"crud"]),Y=s&&g?Uu(e,s.field):null,de=Y?e.fields[Y]?.validation?.reference:void 0,Q=typeof de=="string"?Fu(de):void 0;if(de&&!Q)throw new Error(`EntityList: no entity defines collection "${String(de)}" (the other side of link table "${e.collection}"). Define it with defineEntity().`);let z=new Set(Y?u.items.flatMap(v=>{let O=v[Y];return typeof O=="string"?[O]:[]}):[]),X=new Map(u.base.map(v=>[v.id,v])),ye=new Set(u.edits.added.map(v=>v.id)),te=g?null:new Set(yn(vn(u.items,b,e),k,e).map(v=>v.id)),ue=te?u.base.filter(v=>te.has(v.id)):u.base,j=B.filter(v=>X.has(v)),Re=i&&(u.access.update||u.extensionFields.some(v=>v.editable)),Qe=v=>{let O=u.edits.changes;for(let ee of new Set([...Object.keys(O),...Object.keys(v)])){let Ae=X.get(ee);if(!Ae)continue;let Se=O[ee]??{},pe=v[ee]??{},E={};for(let V of new Set([...Object.keys(Se),...Object.keys(pe)]))V in pe?(!(V in Se)||Se[V]!==pe[V])&&(E[V]=pe[V]):E[V]=Ae[V];Object.keys(E).length>0&&u.update(ee,E)}},Ue=v=>{ye.has(v)||(o?o(v):h(`${f}/${v}`))},Z=async()=>{ie(!0),$(null);try{await u.save()}catch(v){$(v instanceof Error?v.message:I("form.saveFailed"))}finally{ie(!1)}},be=(e.listFields||Object.keys(e.fields)).filter(v=>v!==s?.field),Ve=u.extensionFields.filter(v=>{let O=v.scope?p?.[v.scope]:void 0,ee=v.name.slice((v.scope??"").length+1);return!O?.entity.listFields||O.entity.listFields.includes(ee)}).map(v=>{let{scope:O}=v,ee=O?p?.[O]:void 0;if(!O||!ee)throw new Error(`EntityList: extension field "${v.name}" has no extension "${O}".`);let Ae=v.name.slice(O.length+1),Se=v.config.type==="number"||v.config.type==="range";return{key:v.name,title:ut(v.name,v.config,U),dataIndex:v.name,sortable:!0,filterable:!g,align:Se?"end":"start",...Re&&v.editable&&{edit:Wo(ee.entity,Ae,m,y,U)},render:(pe,E)=>ro(pe,v.config,U,{compact:!0,referenceData:y,item:E})}}),L=[...qr(e,be,{t:U,viewerRole:m,referenceData:y,editing:Re&&u.access.update,interactive:!0}),...Ve,...Yr(c,v=>({...v,...u.edits.changes[v.id]}))],_e=U("name",{defaultValue:e.name}),Pe=i&&u.access.create,De=1+(Pe?1:0)+(d?1:0);return Me(Zr,{children:[!g&&!n&&R(wt,{title:I("filters.title",{entity:_e}),collapsible:!0,defaultOpen:A,tone:l,children:R(dt,{entity:e,data:u.items,fieldsToFilter:be,viewerRole:m})}),R(wt,{title:u.loading?I("results.title.fetching"):I("results.title.count",{count:ue.length}),tone:l,children:Me(Ne,{children:[Me(Ne,{direction:"row",gap:"tight",align:"center",className:"dndev-w-full",style:Kr[g?De-1:De],children:[!g&&R(Wr,{placeholder:I("actions.searchPlaceholder"),value:k,onChange:v=>P(v.target.value),icon:_r,className:"dndev-w-full"}),R(ve,{intent:"reload",variant:"outline",onClick:()=>{u.refresh()},disabled:u.loading,display:"compact","aria-label":I("actions.refresh")}),Pe&&(g?R(ve,{type:"button",intent:"add",display:"compact",onClick:()=>Y?F(!0):u.add([{}]),disabled:u.loading,children:I("addNew")}):R(ve,{intent:"add",display:"compact",render:({children:v,...O})=>R(D,{path:s?Go(f,s):`${f}/new`,...O,children:v}),children:I("addNew")})),d&&R(jr,{actions:d})]}),u.pendingCount>0&&Me(Ne,{direction:"row",gap:"tight",align:"center",wrap:"wrap",children:[R(Ko,{level:"body",children:I("bulkEdit.pending",{count:u.pendingCount})}),!g&&R(ve,{type:"button",intent:"save",display:"compact",onClick:()=>{Z()},disabled:ae,children:I(ae?"form.saving":"actions.save")}),R(ve,{type:"button",icon:Hr,variant:"outline",display:"compact",onClick:()=>{u.discard(),$(null)},disabled:ae,children:I("bulkEdit.discard")})]}),q&&R(Gr,{variant:"error",title:q}),i&&j.length>0&&(u.access.delete||j.every(v=>ye.has(v)))&&R(Ne,{direction:"row",gap:"tight",align:"center",wrap:"wrap",children:R(ve,{type:"button",variant:"outline",intent:"delete",display:"compact",onClick:()=>{u.remove(j),S([])},children:I("bulkEdit.deleteSelected",{count:j.length})})}),R($r,{data:ue,columns:L,sortable:!0,searchable:!1,pagination:!g,loading:u.loading,onRowClick:v=>Ue(v.id),selectable:i,getRowId:v=>v.id,onSelect:v=>S(v.map(O=>O.id)),openLabel:I("actions.open"),onRowOpen:v=>Ue(v.id),cellErrors:u.errors,...Re&&{editable:!0,pendingChanges:u.edits.changes,onPendingChange:Qe,editLabels:{selected:I("bulkEdit.selected"),field:I("bulkEdit.field"),value:I("bulkEdit.value"),apply:I("bulkEdit.apply")}},showingLabel:I("pagination.showing"),paginationPreviousLabel:I("pagination.previous"),paginationNextLabel:I("pagination.next"),paginationItemsPerPagePlaceholder:I("pagination.itemsPerPagePlaceholder"),pageSize:x,onPageSizeChange:C,exportable:!g&&a,exportFilename:`${e.collection}-export`,exportLabel:I("export")})]})}),w&&Y&&Q&&R(Au,{fallback:null,children:R(Bu,{entity:Q,viewerRole:m,excludedIds:z,onPick:v=>u.add(v.map(O=>({[Y]:O}))),onClose:()=>F(!1)})})]})}import{Heart as Qr}from"lucide-react";import{useMemo as _u,useCallback as Hu}from"react";import{Card as ta,Grid as oa,Stack as Yt,Text as Ze,Skeleton as at,Section as Xr,Button as $u}from"@donotdev/components";import{useTranslation as ea,getListCardFieldNames as na,useBreakpoint as Wu}from"@donotdev/core";import{jsx as Jr}from"react/jsx-runtime";function qt({detailHref:e,onClick:t,...o}){return ne?e?Jr(no,{...o,href:e}):Jr(no,{...o,onClick:t}):null}import{Fragment as ju,jsx as M,jsxs as kt}from"react/jsx-runtime";function Gu(e){let t=e.listCardFields;if(t&&!Array.isArray(t)){let i=t;return{titleFields:i.title??[],subtitleFields:i.subtitle??[],contentFields:i.content??[],footerFields:i.footer??[]}}let o=na(e),n=i=>{let s=e.fields[i]?.type;return s==="image"||s==="images"},r=o.filter(i=>!n(i)),a=o.filter(n);return{titleFields:r.length>0?[r[0]]:[],subtitleFields:[],contentFields:[...r.slice(1,4),...a],footerFields:[]}}var Ku={mobile:0,tablet:1,laptop:2,desktop:3};function qu({cols:e,entity:t}){let o=Gu(t),n=Wu("current"),a=((Array.isArray(e)?e[Ku[n]??3]:e)??1)*3,i=c=>{let d=t.fields[c]?.type;return d==="image"||d==="images"},s=o.contentFields.length>0?M(Yt,{direction:"column",gap:"tight",children:o.contentFields.map(c=>i(c)?M(at,{height:120},c):kt("div",{children:[M(Ze,{level:"small",variant:"muted",children:M(at,{})}),M(Ze,{children:M(at,{})})]},c))}):void 0,l=o.footerFields.length>0?M(Ze,{level:"small",children:M(at,{})}):void 0;return M(oa,{cols:e,children:Array.from({length:a},(c,d)=>M(ta,{title:M(at,{}),subtitle:o.subtitleFields.length>0?M(at,{}):void 0,content:s,footer:l,elevated:!0},d))})}function Yu({entity:e,basePath:t,onClick:o,cols:n=[1,2,3,4],staleTime:r=1e3*60*30,queryOptions:a,filter:i,hideFilters:s=!1,resultLabel:l,tone:c,renderCardOverlay:d,clientSort:p,collapsible:h=!1,defaultOpen:f,preview:m}){if(!ne)return null;let u=!!m,g=We(),y=N("userRole"),x=t??`/${e.collection}`,{items:C,processed:k,loading:P,error:b}=Et(e,{enabled:!u,staleTime:r,queryOptions:a,clientSort:p}),A=u?!1:P,{isFavorite:B,toggleFavorite:S,favoritesFilter:w}=dn({collection:e.collection}),{showFavoritesOnly:F,setShowFavoritesOnly:ae,filters:ie,setFilters:q}=lt({collection:e.collection}),$=u?m:k;u||(F&&($=$.filter(w)),i&&($=$.filter(i)),$=$.toSorted((z,X)=>{let ye=B(String(z.id))?0:1,te=B(String(X.id))?0:1;return ye-te}));let{t:I}=ea([e.namespace,"crud"]),{t:U}=ea("crud"),Y=Hu(z=>{u||(o?o(z):g(`${x}/${z}`))},[x,g,o,u]),de=_u(()=>na(e),[e]),Q=I("name",{defaultValue:e.name});return kt(ju,{children:[!s&&M(Xr,{title:U("filters.title",{entity:Q}),collapsible:h,defaultOpen:f,tone:c,children:M(ta,{children:kt(Yt,{direction:"column",children:[M($u,{variant:!u&&F?"primary":"outline",icon:M(Qr,{size:18}),onClick:()=>ae(!F),disabled:u,children:U(F?"favorites.showAll":"favorites.showFavorites")}),!u&&M(dt,{entity:e,data:C,fieldsToFilter:de,viewerRole:y})]})})}),M(Xr,{title:A?U("results.title.fetching"):l?l($.length):U("results.title.count",{count:$.length}),collapsible:h,defaultOpen:h?!0:void 0,tone:c,children:A?M(qu,{cols:n,entity:e}):b?kt(Yt,{align:"center",justify:"center",style:{padding:"var(--gap-lg)",textAlign:"center"},children:[M(Ze,{level:"h3",style:{color:"var(--destructive)"},children:U("errors.fetchFailed",{entity:Q})}),M(Ze,{level:"small",style:{color:"var(--destructive)"},children:b instanceof Error?b.message:String(b)})]}):$.length===0?kt(Yt,{align:"center",justify:"center",style:{padding:"var(--gap-lg)",textAlign:"center"},children:[M(Ze,{level:"h3",style:{color:"var(--muted-foreground)"},children:U("emptyState.title")}),M(Ze,{style:{color:"var(--muted-foreground)"},children:U("emptyState.description")})]}):M(oa,{cols:n,children:$.map(z=>{let X=B(z.id),ye=u||o?void 0:`${x}/${z.id}`;return M(qt,{item:z,entity:e,detailHref:ye,onClick:u?void 0:o?()=>Y(z.id):void 0,renderOverlay:d?.(z),renderActions:M(Qr,{fill:X?"#ef4444":"#ffffff",stroke:X?"#ef4444":"var(--muted-foreground)",onClick:te=>{te.preventDefault(),te.stopPropagation(),u||S(z.id)},style:{cursor:u?"default":"pointer",width:"var(--icon-md)",height:"var(--icon-md)",transition:"fill 0.2s, stroke 0.2s",opacity:u?.5:1},"aria-label":U(X?"favorites.remove":"favorites.add")})},z.id)})})})]})}import{useEffect as qo,useMemo as Yo,useRef as jt,useState as Zu}from"react";import{FormProvider as Ju,useWatch as Qu}from"react-hook-form";import{Alert as Xu,Badge as ep,Button as Zt,DropdownMenu as tp,Grid as op,Stack as np,Spinner as rp}from"@donotdev/components";import{hasRoleAccess as ap,useTranslation as ra}from"@donotdev/core";import{jsx as H,jsxs as xt}from"react/jsx-runtime";var ip={gridColumn:"1 / -1",width:"100%"};function aa(e){return!e||typeof e!="object"?[]:Object.entries(e).flatMap(([t,o])=>t==="message"&&typeof o=="string"?[o]:t==="ref"||t==="types"?[]:aa(o))}function sp({name:e,config:t,control:o,t:n}){let r=Qu({control:o,name:e});return H(ct,{name:e,config:t,value:r,t:n})}function lp(e,t){let o=t.indexOf(".");if(o===-1)return e?.[t];let n=e?.[t.slice(0,o)];return typeof n=="object"&&n!==null?n[t.slice(o+1)]:void 0}function jo(e){let{instanceKey:t,...o}=e;return H(cp,{...o},t)}function cp({entity:e,onSubmit:t,t:o,className:n="",submitText:r,loading:a=!1,defaultValues:i,submitVariant:s="primary",secondaryButtonText:l,secondaryButtonVariant:c="outline",onSecondarySubmit:d,viewerRole:p,operation:h,formId:f,cancelText:m,cancelPath:u,successPath:g,onCancel:y,hideVisibilityInfo:x=!1}){if(!ne)return null;let C=h??(i?"edit":"create"),k=We(),P=N("userRole"),b=p??P,A=f??`entity-form-${e.name}`,{t:B}=ra([e.namespace,"crud"]),{t:S}=ra("crud"),w=o||B,ae=!x&&(b==="admin"||b==="super"),ie=!x&&(b==="user"||b==="admin"||b==="super"),[q,$]=Zu(b==="admin"||b==="super"||b==="user"?b:"guest"),I={guest:"muted",user:"secondary",admin:"warning",super:"destructive",technical:"accent",owner:"secondary"},U=["guest","user","admin","super"],Y={guest:"Guest",user:"User",admin:"Admin",super:"Super",technical:"System"},de=Yo(()=>U.filter(T=>ap(b,T)).map(T=>({label:Y[T],checked:q===T,onClick:()=>$(T)})),[q,b]);Kt(e,C==="edit"?i:void 0);let Q=on(e,{formId:A,operation:C,defaultValues:i,viewerRole:b,t:w,loading:a,successPath:g}),{control:z,setValue:X,handleSubmit:ye,fields:te,formStatus:ue,uploadProgress:j,isDirty:Re,hasUserInteracted:Qe,resetForm:Ue}=Q,Z=rn(A),{errors:be,submitCount:Ve}=Q.formState,L=jt(null),_e=jt(null),Pe=Object.keys(be).filter(T=>T!=="root"),De=aa(be.root),v=Pe.length>0||De.length>0||!!Z,O=jt({submitCount:0,rootKey:"",submissionError:null}),ee=JSON.stringify(De);qo(()=>{let T=O.current;O.current={submitCount:Ve,rootKey:ee,submissionError:Z};let _=Ve>T.submitCount,le=ee!==T.rootKey&&ee!=="[]"||!!Z&&Z!==T.submissionError;if(!_&&!le)return;let we=_e.current,Ce=L.current;if(!we||!Ce)return;let it=Object.keys(be).filter(ke=>ke!=="root");Array.from(Ce.querySelectorAll("input, textarea, select, button, [tabindex]")).some(ke=>{let st=ke.getAttribute("name");if(!(ke.getAttribute("aria-invalid")==="true"||st!==null&&it.some(fe=>st===fe||st.startsWith(`${fe}.`)))||ke.matches(':disabled, input[type="hidden"]')||ke.closest('[hidden], [inert], [aria-hidden="true"]')||ke.getClientRects().length===0)return!1;for(let fe=ke;fe;fe=fe.parentElement){let en=getComputedStyle(fe);if(en.display==="none"||en.visibility==="hidden")return!1;if(fe===Ce)break}return!0})||(we.focus({preventScroll:!0}),we.scrollIntoView({block:"center",behavior:"smooth"}))},[be,Ve,Z,ee]);let Ae=Re&&Qe,Se=jt(!1);qo(()=>{if(C!=="create"||Se.current)return;Se.current=!0;let T=Vr(e,new URLSearchParams(window.location.search),b);for(let[_,le]of Object.entries(T))X(_,le)},[C,e,b,X]);let pe=Yo(()=>{if(!ie)return te;let T=U.indexOf(q);return te.filter(({config:_})=>{let le=_.visibility;return le==="hidden"?!1:le==="technical"?!0:U.indexOf(le)<=T})},[te,ie,q]),E=an(pe,z);qo(()=>{A&&nn.getState().setIsDirty(A,Ae)},[A,Ae]);let V=()=>{Ue(),y?y():k(u||"back")},me=t?async T=>{await t(T)}:void 0,eo=m!==null,Zo=m??S("form.cancel"),Jo={gridColumn:"1 / -1",position:"sticky",bottom:0,backgroundColor:"var(--background)",borderTop:"1px solid var(--border)",paddingTop:"var(--gap-md)",paddingBottom:"var(--gap-md)",zIndex:10,marginTop:"var(--gap-lg)"},da=a||C==="edit"&&!i,se=Yo(()=>ue==="uploading"?{loading:!0,loadingText:j<100?S("form.uploading",{progress:Math.round(j)}):S("form.processing"),progress:j}:ue==="validating"?{loading:!0,loadingText:S("form.validating")}:ue==="submitting"?{loading:!0,loadingText:S("form.saving")}:ue==="success"?{loading:!1,successText:S("form.saved")}:ue==="error"?{loading:!1,errorText:S("form.error")}:{loading:!1},[ue,j,S]);return H(Ju,{...Q,children:H(gn,{formId:A,children:xt("div",{style:{position:"relative",width:"100%",gridColumn:"1 / -1",display:"contents"},children:[da&&H(rp,{overlay:!0}),xt("form",{ref:L,id:A,onSubmit:T=>{ye(me)(T).catch(()=>{})},noValidate:!0,className:n,style:{width:"100%",gridColumn:"1 / -1",display:"contents"},children:[v&&H("div",{ref:_e,tabIndex:-1,"aria-label":S("form.error"),style:ip,children:xt(Xu,{variant:"error",title:S(Pe.length>0?"form.validationFailed":"form.error"),children:[Pe.length>0&&H("p",{children:S("form.fixFields",{fields:Pe.map(T=>ut(T,e.fields[T],w)).join(", ")})}),De.map((T,_)=>H("p",{children:w(T)},_)),Z&&H("p",{children:w(Z)})]})}),pe.map(({name:T,config:_,editable:le,written:we})=>{let Ce=E[T];if(Ce&&!Ce.visible)return null;let it=Ce&&_.conditions?.required!==void 0?{..._,validation:{..._.validation,required:Ce.required}}:_,Qo=le&&!Ce?.disabled&&!Ce?.readonly,ke=ae&&_.visibility!=="guest",st=_.visibility!=="hidden"?I[_.visibility]:void 0,Xo=Y[_.visibility]??_.visibility,fe=Qo?H(fn,{name:T,config:it,control:z,t:w},T):we?H(sp,{name:T,config:it,control:z,t:w},T):H(ct,{name:T,config:it,value:lp(Q.record,T),t:w},T);return ke?xt("div",{style:{position:"relative"},children:[H(ep,{as:"span",variant:st,style:{position:"absolute",top:0,insetInlineEnd:0,fontSize:"var(--font-size-xs)",zIndex:1},children:Xo}),fe]},T):fe}),(()=>{let T=[];if(eo&&Zo&&T.push(H(Zt,{type:"button",intent:"cancel",onClick:V,disabled:se.loading,variant:"outline",className:"dndev-w-full",children:Zo},"cancel")),ie){let we=I[q]||"muted";T.push(H(tp,{trigger:xt(Zt,{type:"button",intent:"preview",variant:we,disabled:se.loading,className:"dndev-w-full",children:[S("visibility.preview"),": ",Y[q]]}),items:de},"preview"))}l&&T.push(H(Zt,{type:"button",onClick:()=>{if(d){let we=Q.getValues();d(we)}},loading:se.loading,loadingText:se.loadingText,progress:se.progress,variant:c,className:"dndev-w-full",children:l},"secondary")),T.push(H(Zt,{type:"submit",intent:"save",loading:se.loading,loadingText:se.loadingText,progress:se.progress,variant:se.successText?"success":se.errorText?"destructive":s,disabled:!!se.successText,className:"dndev-w-full",children:se.successText||se.errorText||r||S("form.submit")},"submit"));let _=T.length;if(_===1)return H(np,{direction:"column",gap:"tight",style:Jo,children:T[0]});let le=_===2?"1fr 2fr":_===3?"1fr 1fr 2fr":"1fr 1fr 1fr 2fr";return H(op,{cols:["1fr",le,le,le],gap:"tight",style:Jo,children:T})})()]})]})})})}import{Card as dp,Section as up,Skeleton as Jt,Stack as pp}from"@donotdev/components";import{useTranslation as mp,useBreakpoint as fp}from"@donotdev/core";import{jsx as Je,jsxs as hp}from"react/jsx-runtime";function gp({entity:e,queryOptions:t,title:o,basePath:n,cols:r=[1,1,3,3],tone:a,className:i}){if(!ne)return null;let{t:s}=mp([e.namespace,"crud"]),{items:l,loading:c}=Et(e,{queryOptions:t}),d=fp("current");if(!c&&l.length===0)return null;let p=n??`/${e.collection}`,h=o??s("recommendations.title"),f={mobile:0,tablet:1,laptop:2,desktop:3},m=(Array.isArray(r)?r[f[d]??3]:typeof r=="number"?r:3)??1,u=(typeof m=="number"?m:3)*3;return Je(up,{title:h,gridCols:r,tone:a,className:i,children:c?Array.from({length:u},(g,y)=>Je(dp,{title:Je(Jt,{width:"60%"}),subtitle:Je(Jt,{width:"40%"}),content:hp(pp,{direction:"column",gap:"tight",children:[Je(Jt,{width:"80%"}),Je(Jt,{width:"50%"})]}),elevated:!0},y)):l.map(g=>Je(qt,{item:g,entity:e,detailHref:`${p}/${g.id}`},g.id))})}import{Button as vp,Stack as yp,Stepper as bp}from"@donotdev/components";import{useTranslation as Sp}from"@donotdev/core";import{Fragment as Cp,jsx as Qt,jsxs as kp}from"react/jsx-runtime";function wp({workflow:e,onComplete:t,onStepChange:o,defaultValues:n,viewerRole:r,children:a,className:i}){if(!ne)return null;let{t:s}=Sp("crud"),l=un(e,{onComplete:t,onStepChange:o,defaultValues:n});if(a)return Qt(Cp,{children:a(l)});let{currentStep:c,currentStepIndex:d,visibleSteps:p,isFirst:h,isLast:f,isSubmitting:m,stepData:u}=l,g=p.map((y,x)=>({number:x+1,title:y.title,content:null}));return kp(yp,{className:i,gap:"large",children:[Qt(bp,{steps:g,activeStep:d,showStepNumbers:!0,onStepChange:y=>{y<=d&&l.goToStep(y)}}),c.custom?c.custom(l.allData):c.entity?Qt(jo,{entity:c.entity,operation:"create",viewerRole:r,defaultValues:{...u[c.id],...!f&&{status:"draft"}},onSubmit:async y=>{await l.goNext(y)},successPath:null,submitText:s(f?"workflow.submit":"workflow.next"),cancelText:h?null:s("workflow.previous"),onCancel:h?void 0:l.goPrevious,loading:m,hideVisibilityInfo:!0}):null,c.allowSkip&&!f&&Qt(vp,{variant:"ghost",onClick:l.skipStep,className:"dndev-w-full",children:s("workflow.skip")})]})}import{createContext as sa,useId as xp,use as ia}from"react";import{Controller as Tp,FormProvider as Ep,useFormContext as Rp}from"react-hook-form";import{Label as Pp,Slot as Ap,cn as Ip,Stack as Lp}from"@donotdev/components";import{jsx as ze}from"react/jsx-runtime";var k2=Ep,la=sa({}),x2=({...e})=>ze(la.Provider,{value:{name:e.name},children:ze(Tp,{...e})}),ca=sa({}),T2=({className:e,children:t,...o})=>{let n=xp();return ze(ca.Provider,{value:{id:n},children:ze(Lp,{className:e,...o,children:t})})},Xt=()=>{let e=ia(la);if(!e||!e.name)return null;let t=ia(ca);if(!t)return null;let{getFieldState:o,formState:n}=Rp(),r=o(e.name,n),{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...r}},E2=({className:e,...t})=>{let o=Xt();if(!o)return null;let{error:n,formItemId:r}=o;return ze(Pp,{className:Ip(n&&"text-destructive",e),htmlFor:r,...t})},R2=({...e})=>{let t=Xt();if(!t)return null;let{error:o,formItemId:n,formDescriptionId:r,formMessageId:a}=t;return ze(Ap,{id:n,"aria-describedby":o?`${r} ${a}`:`${r}`,"aria-invalid":!!o,...e})},P2=({className:e,...t})=>{let o=Xt();if(!o)return null;let{formDescriptionId:n}=o;return ze("p",{id:n,className:e,style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},...t})},A2=({className:e,children:t,...o})=>{let n=Xt();if(!n)return null;let{error:r,formMessageId:a}=n,i=r?String(r?.message):t;return i?ze("p",{id:a,className:e,style:{fontSize:"var(--font-size-sm)",fontWeight:500,color:"var(--destructive)"},...o,children:i}):null};var Np={layoutContainer:"dndev-layout",sidebar:"sidebar",sidebarTop:"sidebar-top",sidebarContent:"sidebar-content",sidebarBottom:"sidebar-bottom",sidebarResizeHandle:"dndev-sidebar-resize-handle",header:"header",main:"main",footer:"footer",container:"dndev-container",pageContainer:"dndev-container",breadcrumbsContainer:"breadcrumbs-container"},Dp={zHeader:"dndev-z-header",zSidebar:"dndev-z-sidebar",zOverlay:"dndev-z-overlay",zModal:"dndev-z-modal",zTooltip:"dndev-z-tooltip",zToast:"dndev-z-toast"},V2={...Np,...Dp},_2={headerHeight:"--header-height",headerPadding:"--header-padding",headerIconSize:"--header-icon-size",headerLogoMaxHeight:"--header-logo-max-height",sidebarWidth:"--sidebar-width",sidebarPadding:"--sidebar-padding",mainPadding:"--main-padding",mainMaxWidth:"--main-max-width",contentWidth:"--content-width",contentPadding:"--content-padding",footerHeight:"--footer-height",footerPadding:"--footer-padding",zHeader:"--z-header",zSidebar:"--z-sidebar",zFooter:"--z-footer",zOverlay:"--z-overlay",zModal:"--z-modal",zTooltip:"--z-tooltip",zToast:"--z-toast"},H2={headerHeight:"--header-height",headerPadding:"--header-padding",logoSize:"--logo-size",sidebarWidth:"--sidebar-width",sidebarPadding:"--sidebar-padding",footerHeight:"--footer-height",footerPadding:"--footer-padding",layoutGap:"--layout-gap",sectionGap:"--gap-lg",contentGap:"--content-gap",zHeader:"--z-header",zSidebar:"--z-sidebar",zFooter:"--z-footer",zModal:"--z-modal",zTooltip:"--z-tooltip"};export{Cc as AppBranding,Tc as AppIcon,Pc as AppTitle,re as AssetResolver,wa as AuthGuard,Dm as AuthGuardFallback,wo as AuthHeader,bo as AuthMenu,ri as AuthReturnTo,_c as Breadcrumbs,No as CacheSettings,Tv as ConsentBanner,Fn as DnDevNavigationMenu,sd as DropdownNavigation,Yu as EntityCardList,xu as EntityDisplayRenderer,jo as EntityFormRenderer,Ou as EntityList,gp as EntityRecommendations,wp as EntityWorkflow,Vl as FeatureCard,yl as FeatureDisabled,ud as FloatingLanguageSwitcher,Ho as FooterBranding,lu as FooterCopyright,gu as FooterLegalLinks,k2 as Form,R2 as FormControl,P2 as FormDescription,x2 as FormField,T2 as FormItem,E2 as FormLabel,A2 as FormMessage,Fv as GameContainer,zv as GameFlow,Gc as GameTitle,Jm as GoTo,Oi as GoToInput,Ri as GoToWrapper,vd as HeaderMenu,xd as HeaderNavigation,ua as Icon,D as Link,Bn as NotFoundPage,Bd as Notifications,Iv as PageConfig,Lt as PageContainer,Bp as PasswordResetCallback,Ll as ProgressBar,Pl as RedirectOverlay,Ls as Seo,qd as SettingsMenu,ci as SignedInRedirect,Fl as Skeleton,lc as TechBento,eu as ThemeToggle,V2 as allLayoutClasses,ih as buildProductJsonLd,tm as createAuthConfig,H2 as cssVariables,sh as deriveEntitySeo,Fp as isAuthAvailable,hg as isBillingAvailable,xg as isCrudAvailable,dg as isFormStoreAvailable,Pg as isOAuthAvailable,Np as layoutClasses,Dp as layoutUtilities,_2 as layoutVariables,sg as resolveFaviconSet,ig as resolveLogo,nt as sanitizeSvg,Dg as tList,Ro as techLogos,N as useAuthSafe,Xp as useAuthState,Ot as useAuthVisibility,Wf as useBack,Sg as useBillingVisibility,Zp as useCanNavigate,kg as useCrudSafe,Xt as useFormField,ts as useFormStoreSafe,Op as useGoTo,Qp as useHasRole,tg as useLocalizedPath,qf as useLocation,Qf as useMatch,We as useNavigate,xe as useNavigationItems,tn as useNavigationRoute,Rg as useOAuthSafe,jf as useParams,Kf as usePrefetch,Xf as useQueryParams,eg as useRedirectGuard,Gf as useRefresh,Zf as useRouteParam,Yf as useRoutePath,Jf as useSearchParams,Wg as useSeo,go as useStripeBillingSafe,og as useUrlLanguage,Jp as useUserRole,em as withAuth};
5
+ ${p.email}`:""}`}),disabled:!0}),g&&S.push({label:i("auth.profile",{defaultValue:"Profile"}),icon:Bs,onClick:()=>u(g)}),y.forEach(w=>{let F=m.find(q=>q.path===w.path),ae=w.label||F?.label||w.path.split("/").pop()||"Menu",ie=w.icon?zt(w.icon):F?.icon&&(typeof F.icon=="string"||typeof F.icon=="function")?zt(F.icon):gt;S.push({label:ae,icon:ie,onClick:()=>u(w.path)})}),n.forEach(w=>{if(w.path){let F=m.find(q=>q.path===w.path),ae=w.label||F?.label||w.path.split("/").pop()||"Menu",ie=w.icon?zt(w.icon):gt;S.push({label:ae,icon:ie,onClick:()=>u(w.path),disabled:w.disabled,style:w.style})}else if(w.onClick){let F=w.icon?zt(w.icon):gt;S.push({label:w.label,icon:F,onClick:w.onClick,disabled:w.disabled,style:w.style})}}),S.push({label:i("auth.deleteAccount.label",{defaultValue:"Delete Account"}),icon:zs,onClick:C.startDeleteFlow,variant:"destructive"}),S.push({label:i("auth.signOut",{defaultValue:"Sign Out"}),icon:Os,onClick:()=>h(),variant:"destructive"}),S},[g,y,n,h,C,i,m,f,p,x,k,u]);return qs().length===0||s||!l||!c?null:el(Xs,{children:[Be(Kn,{fallback:null,children:Be(Js,{open:C.showPasswordDialog,isLoading:C.isDeleting,error:C.error,onReauth:S=>C.confirmDelete(S),onCancel:C.cancel})}),Be(Kn,{fallback:null,children:Be(Qs,{open:C.showConfirmDialog,isLoading:C.isDeleting,error:C.error,onConfirm:()=>C.confirmDelete(),onCancel:C.cancel})}),Be($s,{trigger:Be(_s,{variant:Hs.OUTLINE,icon:p?Be(Vs,{src:p.photoURL??void 0,fallback:P(),alt:k(),style:{margin:"-4px 0"}}):Ms,display:t,"aria-label":i("auth.userMenu",{defaultValue:"User menu"}),tooltip:!o&&f&&p?b():o?void 0:i("auth.userMenu",{defaultValue:"User menu"}),className:r,style:a,children:k()}),items:A,contentAlign:"end"})]})};import{jsx as K}from"react/jsx-runtime";var Qn=()=>null;function Ut({display:e,variant:t=Jn.OUTLINE,signInLabel:o,className:n,style:r,children:a,...i}){return K(nl,{variant:t,icon:tl,display:e,tooltip:o,className:n,style:r,...i,children:a??o})}var dl=Zn(async()=>{try{return{default:(await import("@donotdev/auth")).AuthPartnerButton}}catch{return{default:Qn}}}),jn=Zn(async()=>{try{return{default:(await import("@donotdev/auth")).MultipleAuthProviders}}catch{return{default:Qn}}}),Co=({display:e=il.AUTO,variant:t=Jn.OUTLINE,className:o,style:n})=>{let{t:r}=sl("dndev"),{shouldHide:a,isLoading:i,isReady:s,isAuthenticated:l}=Mt(),c=ll(),d=cl(),[p,h]=ol(!1),f=c.loginPath,m=r("auth.signIn",{defaultValue:"Sign In"}),u=r("auth.loading",{defaultValue:"Loading..."}),g=d.includes("password")||d.includes("emailLink");if(a||!s)return null;if(!l){if(f!==void 0)return K(D,{path:f,prefetch:!0,children:K(Ut,{display:e,variant:t,signInLabel:m,className:o,style:n})});let y=d[0];return g?K(al,{trigger:K(Ut,{display:e,signInLabel:m,className:o,style:n}),title:m,open:p,onOpenChange:h,"data-content-size":"form",children:K(wo,{fallback:K("div",{style:{padding:"var(--gap-md)",fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:u}),children:K(jn,{spacing:"medium",onSuccess:()=>h(!1)})})}):d.length>1?K(rl,{trigger:K(Ut,{display:e,signInLabel:m,className:o,style:n}),children:K(wo,{fallback:K("div",{style:{padding:"var(--gap-md)",fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:u}),children:K(jn,{spacing:"tight"})})}):K(wo,{fallback:K(Ut,{display:e,signInLabel:m,className:o,style:n,disabled:i,tooltip:i?u:m,children:i?u:m}),children:K(dl,{partnerId:y,display:e,className:o,style:n})})}return K(So,{display:e,loginPath:f,className:o,style:n})};import{AlertCircle as ul,RefreshCw as pl,Mail as ml,Cookie as fl}from"lucide-react";import{Card as gl,Button as ko,BUTTON_VARIANT as xo,Stack as Xn}from"@donotdev/components";import{useTranslation as hl}from"@donotdev/core";import{jsx as ht,jsxs as Vt}from"react/jsx-runtime";function vl({featureName:e,title:t,description:o,showReviewCookies:n=!1,showContactSupport:r=!0,showRetry:a=!1,supportEmail:i="support@example.com",onRetry:s,onReviewCookies:l,customActions:c,className:d=""}){let{t:p}=hl("ui"),h=o||p("featureDisabled.description","{featureName} is not available. This may be due to missing configuration or disabled features.",{featureName:e}),f=()=>{if(l)l();else{let u=new CustomEvent("openCookieConsent");window.dispatchEvent(u)}},m=()=>{window.location.href=`mailto:${i}?subject=${encodeURIComponent(`Feature Unavailable: ${e}`)}&body=${encodeURIComponent(`I'm experiencing an issue with ${e} not being available.`)}`};return Vt(gl,{className:d,title:Vt(Xn,{direction:"row",align:"center",gap:"tight",children:[ht(ul,{className:"dndev-size-md",style:{color:"var(--destructive)"}}),t||e]}),subtitle:h,children:[" ",Vt("div",{style:{display:"grid",gap:"var(--gap-md)"},children:[(n||r||a||c)&&Vt(Xn,{direction:"row",wrap:"wrap",gap:"tight",children:[n&&ht(ko,{variant:xo.OUTLINE,onClick:f,icon:fl,children:p("featureDisabled.reviewCookies","Review Cookies")}),r&&ht(ko,{variant:xo.OUTLINE,onClick:m,icon:ml,children:p("featureDisabled.contactSupport","Contact Support")}),a&&ht(ko,{variant:xo.OUTLINE,onClick:s,icon:pl,children:p("featureDisabled.retry","Retry")}),c]}),ht("p",{style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},children:p("featureDisabled.helpText","If you believe this is an error, please contact support or try refreshing the page.")})]})]})}var yl=vl;import{Lock as _t,Shield as er}from"lucide-react";import{useEffect as To,useRef as tr,useCallback as bl}from"react";import{Portal as Sl,Spinner as wl,Stack as Cl,Text as vt,Button as kl}from"@donotdev/components";import{useTranslation as xl,useOverlay as Ie}from"@donotdev/core";import{jsx as Te,jsxs as nr}from"react/jsx-runtime";var or={connecting:0,preparing:2e3,redirecting:5e3},Tl=1e4;function El(e,t){return t==="none"?null:t==="shield"?er:t==="lock"?_t:e?e.startsWith("stripe-")||e.includes("payment")||e.includes("checkout")?_t:e.startsWith("oauth-")||e.startsWith("auth-")?er:_t:_t}function Rl(e){return e||"default"}function Pl(){let{t:e}=xl("dndev"),t=Ie("isRedirectOverlayOpen"),o=Ie("redirectOperation"),n=Ie("redirectPhase"),r=Ie("showCancelButton"),a=Ie("redirectConfig"),i=Ie("redirectStartTime"),s=Ie("setRedirectPhase"),l=Ie("setShowCancelButton"),c=Ie("hideRedirectOverlay"),d=tr([]),p=tr(null),h=bl(()=>{c()},[c]);if(To(()=>{if(!t||!i)return;let k=a?.cancelTimeout??Tl,P=Date.now()-i;d.current.forEach(clearTimeout),d.current=[],p.current&&(clearTimeout(p.current),p.current=null);let b=(B,S)=>{let w=Math.max(0,S-P);if(w>0){let F=setTimeout(()=>{s(B)},w);d.current.push(F)}else s(B)};b("preparing",or.preparing),b("redirecting",or.redirecting);let A=Math.max(0,k-P);return p.current=setTimeout(()=>{l(!0),s("timeout")},A),()=>{d.current.forEach(clearTimeout),d.current=[],p.current&&(clearTimeout(p.current),p.current=null)}},[t,i,a?.cancelTimeout,s,l]),To(()=>{if(!t)return;let k=()=>{c()};return window.addEventListener("popstate",k),()=>window.removeEventListener("popstate",k)},[t,c]),To(()=>{if(!t)return;let k=()=>{};return document.addEventListener("visibilitychange",k),()=>document.removeEventListener("visibilitychange",k)},[t]),!t)return null;let f=Rl(o),m=a?.title??e(`redirectOverlay.${f}.title`,{defaultValue:e("redirectOverlay.default.title")}),u=a?.message??e(`redirectOverlay.${f}.message`,{defaultValue:e("redirectOverlay.default.message")}),g=a?.subtitle??e(`redirectOverlay.${f}.subtitle`,{defaultValue:e("redirectOverlay.default.subtitle")}),y=e(`redirectOverlay.${f}.ariaLabel`,{defaultValue:e("redirectOverlay.default.ariaLabel")}),x=e(`redirectOverlay.phases.${n}`),C=El(o,a?.icon);return Te(Sl,{children:Te("div",{className:"dndev-spinner-overlay",role:"status","aria-busy":"true","aria-label":y,style:{zIndex:"var(--z-overlay, 9999)"},children:nr("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"var(--gap-md)",textAlign:"center",maxWidth:"400px",padding:"var(--gap-lg)"},children:[nr(Cl,{direction:"row",align:"center",children:[C&&Te(C,{style:{width:"1.5rem",height:"1.5rem",color:"var(--primary)"},"aria-hidden":"true"}),Te(wl,{variant:"primary"})]}),Te(vt,{as:"h3",style:{color:"var(--foreground)",margin:0},children:m}),Te(vt,{variant:"muted",style:{color:"var(--foreground)",minHeight:"1.5em"},children:x}),Te(vt,{variant:"muted",level:"small",style:{opacity:.8},children:u}),Te(vt,{variant:"muted",level:"small",style:{opacity:.6},children:g}),Te(vt,{variant:"muted",level:"small",style:{opacity:.5,marginTop:"var(--gap-sm)"},children:e("redirectOverlay.doNotRefresh")}),r&&Te(kl,{variant:"ghost",onClick:h,style:{marginTop:"var(--gap-md)"},children:e("redirectOverlay.cancel")})]})})})}import{useEffect as Eo,useState as rr}from"react";import{cn as Al}from"@donotdev/components";import{jsx as ar}from"react/jsx-runtime";var Il=({isActive:e=!1,progress:t,useFakeProgress:o=!0,duration:n=2e3,className:r,show:a=!0})=>{let[i,s]=rr(0),[l,c]=rr(!1);Eo(()=>{if(!e||!o||t!==void 0)return;c(!0),s(0);let p=Date.now(),h=setInterval(()=>{let f=Date.now()-p,m=Math.min(f/n*90,90);s(m)},16);return()=>{clearInterval(h)}},[e,o,t,n]),Eo(()=>{t!==void 0&&c(t>0&&t<100)},[t]),Eo(()=>{if(!e){let p=setTimeout(()=>{c(!1),s(0)},300);return()=>clearTimeout(p)}},[e]);let d=t??i;return!a||!l?null:ar("div",{className:Al(r),style:{position:"fixed",insetInlineStart:0,insetInlineEnd:0,zIndex:9999,height:"4px",backgroundColor:"transparent",top:"var(--header-height, 0px)"},role:"progressbar","aria-valuenow":Math.round(d),"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Page loading progress",children:ar("div",{style:{height:"100%",width:`${d}%`,background:"linear-gradient(to right, var(--primary), color-mix(in srgb, var(--primary) 80%, transparent), color-mix(in srgb, var(--primary) 60%, transparent))",transition:e?"width 0.3s ease-out":"width 0.2s ease-in",boxShadow:"var(--shadow-sm)"}})})},Ll=Il;import{cn as Ht,Stack as Nl}from"@donotdev/components";import{jsx as yt,jsxs as sv}from"react/jsx-runtime";var Dl=({variant:e="text",width:t,height:o,lines:n=1,show:r=!0,className:a,animation:i="pulse",style:s})=>{if(!r)return null;let l={backgroundColor:"var(--muted)",opacity:"var(--opacity-muted)",borderRadius:"var(--radius)",animation:i==="pulse"||i==="wave"?"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite":"none",...i==="wave"&&{background:"linear-gradient(to right, color-mix(in srgb, var(--muted) 50%, transparent), color-mix(in srgb, var(--muted) 30%, transparent), color-mix(in srgb, var(--muted) 50%, transparent))"}},c=()=>{let d={};return t&&(d.width=typeof t=="number"?`${t}px`:t),o&&(d.height=typeof o=="number"?`${o}px`:o),d};return e==="text"?yt(Nl,{gap:"tight",children:Array.from({length:n}).map((d,p)=>yt("div",{className:Ht("dndev-skeleton",a),style:{...l,height:"var(--gap-md)",width:p===n-1?"75%":"100%",...c(),...s}},p))}):e==="circular"?yt("div",{className:Ht("dndev-skeleton",a),style:{...l,borderRadius:"var(--radius-full)",width:t||o||"40px",height:o||t||"40px",...c(),...s}}):e==="rectangular"?yt("div",{className:Ht("dndev-skeleton",a),style:{...l,width:t||"100%",height:o||"200px",...c(),...s}}):yt("div",{className:Ht("dndev-skeleton",a),style:{...l,borderRadius:"var(--radius-lg)",width:t||"100%",height:o||"20px",...c(),...s}})};var Fl=Dl;import{Card as Bl,IconBox as Ol,Stack as Ml,Text as Ro,renderCardContent as zl}from"@donotdev/components";import{jsx as Ee,jsxs as ir}from"react/jsx-runtime";var Ul=({icon:e,title:t,subtitle:o,content:n,href:r,variant:a,elevated:i,onClick:s,className:l,footer:c,style:d,clickable:p,maxLines:h=2,...f})=>{let m=zl(n),u=h,g=u<=0?"auto":`calc(var(--font-size-lg) * var(--line-height) * ${u} + var(--gap-md))`,y=u<=0?"auto":`calc(var(--font-size-base) * var(--line-height) * ${u} + var(--gap-md))`,x=`${g} ${y} 1fr${c?" auto":""}`,C=B=>B<=0?{display:"block",overflow:"visible",wordBreak:"break-word",lineHeight:"var(--line-height)",WebkitLineClamp:"unset",WebkitBoxOrient:"unset"}:{display:"-webkit-box",WebkitLineClamp:B,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",lineHeight:"var(--line-height)"},k={...C(u),fontSize:"var(--font-size-lg)",fontWeight:600,color:"inherit",margin:0,textAlign:"start",flex:1,minWidth:0},P={...C(u),fontSize:"var(--font-size-base)",fontWeight:u<=0?500:600,color:"var(--muted-foreground)",margin:0},b=e?ir(Ml,{direction:"row",align:u<=0?"start":"center",style:{width:"100%"},children:[Ee(Ol,{icon:e}),Ee(Ro,{as:"div",level:"h3",style:k,children:t})]}):Ee(Ro,{as:"div",level:"h3",style:k,children:t}),A=Ee(Bl,{variant:a,elevated:i,onClick:s,className:l,"data-clickable":r||s||p?"true":void 0,style:{paddingInlineStart:"var(--gap-md)",paddingInlineEnd:"var(--gap-md)",gap:"var(--gap-md)",height:"100%",textAlign:"start",...d},...f,children:ir("div",{style:{display:"grid",gridTemplateRows:x,gap:"var(--gap-md)",width:"100%"},children:[Ee("div",{style:{display:"flex",alignItems:u<=0?"flex-start":"center",justifyContent:"flex-start"},children:b}),Ee("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"flex-start"},children:Ee(Ro,{as:"div",level:"body",style:P,children:o})}),Ee("div",{children:m}),c&&Ee("div",{children:c})]})});return r&&!s?Ee(D,{path:r,style:{display:"block",textDecoration:"none",height:"100%"},"aria-label":t?`Learn more about ${t}`:void 0,children:A}):A},Vl=Ul;import{useState as Ql}from"react";import{Bento as Xl,Card as ec,Section as tc,Stack as oc,Text as nc,TONE as rc,cn as ac}from"@donotdev/components";var _l='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#3178C6" d="M1.125 0C.502 0 0 .502 0 1.125v21.75C0 23.498.502 24 1.125 24h21.75c.623 0 1.125-.502 1.125-1.125V1.125C24 .502 23.498 0 22.875 0zm17.363 9.75c.612 0 1.154.037 1.627.111a6.38 6.38 0 0 1 1.306.34v2.458a3.95 3.95 0 0 0-.643-.361 5.093 5.093 0 0 0-.717-.26 5.453 5.453 0 0 0-1.426-.2c-.3 0-.573.028-.819.086a2.1 2.1 0 0 0-.623.242c-.17.104-.3.229-.393.374a.888.888 0 0 0-.14.49c0 .196.053.373.156.529.104.156.252.304.443.444s.423.276.696.41c.273.135.582.274.926.416.47.197.892.407 1.266.628.374.222.695.473.963.753.268.279.472.598.614.957.142.359.214.776.214 1.253 0 .657-.125 1.21-.373 1.656a3.033 3.033 0 0 1-1.012 1.085 4.38 4.38 0 0 1-1.487.596c-.566.12-1.163.18-1.79.18a9.916 9.916 0 0 1-1.84-.164 5.544 5.544 0 0 1-1.512-.493v-2.63a5.033 5.033 0 0 0 3.237 1.2c.333 0 .624-.03.872-.09.249-.06.456-.144.623-.25.166-.108.29-.234.373-.38a1.023 1.023 0 0 0-.074-1.089 2.12 2.12 0 0 0-.537-.5 5.597 5.597 0 0 0-.807-.444 27.72 27.72 0 0 0-1.007-.436c-.918-.383-1.602-.852-2.053-1.405-.45-.553-.676-1.222-.676-2.005 0-.614.123-1.141.369-1.582.246-.441.58-.804 1.004-1.089a4.494 4.494 0 0 1 1.47-.629 7.536 7.536 0 0 1 1.77-.201zm-15.113.188h9.563v2.166H9.506v9.646H6.789v-9.646H3.375z"/></svg>',Hl='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#61DAFB" d="M14.23 12.004a2.236 2.236 0 0 1-2.235 2.236 2.236 2.236 0 0 1-2.236-2.236 2.236 2.236 0 0 1 2.235-2.236 2.236 2.236 0 0 1 2.236 2.236zm2.648-10.69c-1.346 0-3.107.96-4.888 2.622-1.78-1.653-3.542-2.602-4.887-2.602-.41 0-.783.093-1.106.278-1.375.793-1.683 3.264-.973 6.365C1.98 8.917 0 10.42 0 12.004c0 1.59 1.99 3.097 5.043 4.03-.704 3.113-.39 5.588.988 6.38.32.187.69.275 1.102.275 1.345 0 3.107-.96 4.888-2.624 1.78 1.654 3.542 2.603 4.887 2.603.41 0 .783-.09 1.106-.275 1.374-.792 1.683-3.263.973-6.365C22.02 15.096 24 13.59 24 12.004c0-1.59-1.99-3.097-5.043-4.032.704-3.11.39-5.587-.988-6.38-.318-.184-.688-.277-1.092-.278zm-.005 1.09v.006c.225 0 .406.044.558.127.666.382.955 1.835.73 3.704-.054.46-.142.945-.25 1.44-.96-.236-2.006-.417-3.107-.534-.66-.905-1.345-1.727-2.035-2.447 1.592-1.48 3.087-2.292 4.105-2.295zm-9.77.02c1.012 0 2.514.808 4.11 2.28-.686.72-1.37 1.537-2.02 2.442-1.107.117-2.154.298-3.113.538-.112-.49-.195-.964-.254-1.42-.23-1.868.054-3.32.714-3.707.19-.09.4-.127.563-.132zm4.882 3.05c.455.468.91.992 1.36 1.564-.44-.02-.89-.034-1.345-.034-.46 0-.915.01-1.36.034.44-.572.895-1.096 1.345-1.565zM12 8.1c.74 0 1.477.034 2.202.093.406.582.802 1.203 1.183 1.86.372.64.71 1.29 1.018 1.946-.308.655-.646 1.31-1.013 1.95-.38.66-.773 1.288-1.18 1.87-.728.063-1.466.098-2.21.098-.74 0-1.477-.035-2.202-.093-.406-.582-.802-1.204-1.183-1.86-.372-.64-.71-1.29-1.018-1.946.303-.657.646-1.313 1.013-1.954.38-.66.773-1.286 1.18-1.868.728-.064 1.466-.098 2.21-.098zm-3.635.254c-.24.377-.48.763-.704 1.16-.225.39-.435.782-.635 1.174-.265-.656-.49-1.31-.676-1.947.64-.15 1.315-.283 2.015-.386zm7.26 0c.695.103 1.365.23 2.006.387-.18.632-.405 1.282-.66 1.933-.2-.39-.41-.783-.64-1.174-.225-.392-.465-.774-.705-1.146zm3.063.675c.484.15.944.317 1.375.498 1.732.74 2.852 1.708 2.852 2.476-.005.768-1.125 1.74-2.857 2.475-.42.18-.88.342-1.355.493-.28-.958-.646-1.956-1.1-2.98.45-1.017.81-2.01 1.085-2.964zm-13.395.004c.278.96.645 1.957 1.1 2.98-.45 1.017-.812 2.01-1.086 2.964-.484-.15-.944-.318-1.37-.5-1.732-.737-2.852-1.706-2.852-2.474 0-.768 1.12-1.742 2.852-2.476.42-.18.88-.342 1.356-.494zm11.678 4.28c.265.657.49 1.312.676 1.948-.64.157-1.316.29-2.016.39.24-.375.48-.762.705-1.158.225-.39.435-.788.636-1.18zm-9.945.02c.2.392.41.783.64 1.175.23.39.465.772.705 1.143-.695-.102-1.365-.23-2.006-.386.18-.63.406-1.282.66-1.933zM17.92 16.32c.112.493.2.968.254 1.423.23 1.868-.054 3.32-.714 3.708-.147.09-.338.128-.563.128-1.012 0-2.514-.807-4.11-2.28.686-.72 1.37-1.536 2.02-2.44 1.107-.118 2.154-.3 3.113-.54zm-11.83.01c.96.234 2.006.415 3.107.532.66.905 1.345 1.727 2.035 2.446-1.595 1.483-3.092 2.295-4.11 2.295-.22-.005-.406-.05-.553-.132-.666-.38-.955-1.834-.73-3.703.054-.46.142-.944.25-1.438zm4.56.64c.44.02.89.034 1.345.034.46 0 .915-.01 1.36-.034-.44.572-.895 1.095-1.345 1.565-.455-.47-.91-.993-1.36-1.565z"/></svg>',$l='<svg role="img" viewBox="0 0 410 404" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="vite-a" x1="6" y1="33" x2="235" y2="344" gradientUnits="userSpaceOnUse"><stop stop-color="#41D1FF"/><stop offset="1" stop-color="#BD34FE"/></linearGradient><linearGradient id="vite-b" x1="195" y1="9" x2="236" y2="293" gradientUnits="userSpaceOnUse"><stop stop-color="#FFEA83"/><stop offset=".08" stop-color="#FFDD35"/><stop offset="1" stop-color="#FFA800"/></linearGradient></defs><path fill="url(#vite-a)" d="M399.641 59.525 215.643 388.545c-3.799 6.793-13.559 6.833-17.415.073L10.582 59.556c-4.201-7.366 2.098-16.29 10.446-14.797l184.195 32.923c1.175.21 2.378.208 3.553-.006l180.343-32.87c8.32-1.517 14.649 7.337 10.522 14.72z"/><path fill="url(#vite-b)" d="M292.965 1.574 156.801 28.255c-2.238.439-3.895 2.335-4.03 4.611l-8.376 141.465c-.197 3.332 2.863 5.918 6.115 5.168l37.91-8.749c3.547-.818 6.752 2.306 6.023 5.873l-11.263 55.153c-.758 3.712 2.727 6.886 6.352 5.785l23.415-7.114c3.63-1.102 7.118 2.081 6.35 5.796l-17.899 86.633c-1.12 5.42 6.088 8.374 9.094 3.728l2.008-3.103 110.954-221.428c1.858-3.707-1.346-7.935-5.418-7.15l-39.022 7.532c-3.667.707-6.787-2.708-5.752-6.296l25.469-88.291c1.036-3.594-2.095-6.612-5.764-5.891z"/></svg>',Wl='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M18.665 21.978C16.758 23.255 14.465 24 12 24 5.377 24 0 18.623 0 12S5.377 0 12 0s12 5.377 12 12c0 3.583-1.574 6.801-4.067 9.001L9.219 7.2H7.2v9.596h1.615V9.251l9.85 12.727Zm-3.332-8.533 1.6 2.061V7.2h-1.6v6.245Z"/></svg>',Gl='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#339933" d="M11.998,24c-0.321,0-0.641-0.084-0.922-0.247l-2.936-1.737c-0.438-0.245-0.224-0.332-0.08-0.383 c0.585-0.203,0.703-0.25,1.328-0.604c0.065-0.037,0.151-0.023,0.218,0.017l2.256,1.339c0.082,0.045,0.197,0.045,0.272,0l8.795-5.076 c0.082-0.047,0.134-0.141,0.134-0.238V6.921c0-0.099-0.053-0.192-0.137-0.242l-8.791-5.072c-0.081-0.047-0.189-0.047-0.271,0 L3.075,6.68C2.99,6.729,2.936,6.825,2.936,6.921v10.15c0,0.097,0.054,0.189,0.139,0.235l2.409,1.392 c1.307,0.654,2.108-0.116,2.108-0.89V7.787c0-0.142,0.114-0.253,0.256-0.253h1.115c0.139,0,0.255,0.112,0.255,0.253v10.021 c0,1.745-0.95,2.745-2.604,2.745c-0.508,0-0.909,0-2.026-0.551L2.28,18.675c-0.57-0.329-0.922-0.945-0.922-1.604V6.921 c0-0.659,0.353-1.275,0.922-1.603l8.795-5.082c0.557-0.315,1.296-0.315,1.848,0l8.794,5.082c0.57,0.329,0.924,0.944,0.924,1.603 v10.15c0,0.659-0.354,1.273-0.924,1.604l-8.794,5.078C12.643,23.916,12.324,24,11.998,24z M19.099,13.993 c0-1.9-1.284-2.406-3.987-2.763c-2.731-0.361-3.009-0.548-3.009-1.187c0-0.528,0.235-1.233,2.258-1.233 c1.807,0,2.473,0.389,2.747,1.607c0.024,0.115,0.129,0.199,0.247,0.199h1.141c0.071,0,0.138-0.031,0.186-0.081 c0.048-0.054,0.074-0.123,0.067-0.196c-0.177-2.098-1.571-3.076-4.388-3.076c-2.508,0-4.004,1.058-4.004,2.833 c0,1.925,1.488,2.457,3.895,2.695c2.88,0.282,3.103,0.703,3.103,1.269c0,0.983-0.789,1.402-2.642,1.402 c-2.327,0-2.839-0.584-3.011-1.742c-0.02-0.124-0.126-0.215-0.253-0.215h-1.137c-0.141,0-0.254,0.112-0.254,0.253 c0,1.482,0.806,3.248,4.655,3.248C17.501,17.007,19.099,15.91,19.099,13.993z"/></svg>',Kl='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#DD2C00" d="M19.455 8.369c-.538-.748-1.778-2.285-3.681-4.569-.826-.991-1.535-1.832-1.884-2.245a146 146 0 0 0-.488-.576l-.207-.245-.113-.133-.022-.032-.01-.005L12.57 0l-.609.488c-1.555 1.246-2.828 2.851-3.681 4.64-.523 1.064-.864 2.105-1.043 3.176-.047.241-.088.489-.121.738-.209-.017-.421-.028-.632-.033-.018-.001-.035-.002-.059-.003a7.46 7.46 0 0 0-2.28.274l-.317.089-.163.286c-.765 1.342-1.198 2.869-1.252 4.416-.07 2.01.477 3.954 1.583 5.625 1.082 1.633 2.61 2.882 4.42 3.611l.236.095.071.025.003-.001a9.59 9.59 0 0 0 2.941.568q.171.006.342.006c1.273 0 2.513-.249 3.69-.742l.008.004.313-.145a9.63 9.63 0 0 0 3.927-3.335c1.01-1.49 1.577-3.234 1.641-5.042.075-2.161-.643-4.304-2.133-6.371m-7.083 6.695c.328 1.244.264 2.44-.191 3.558-1.135-1.12-1.967-2.352-2.475-3.665-.543-1.404-.87-2.74-.974-3.975.48.157.922.366 1.315.622 1.132.737 1.914 1.902 2.325 3.461zm.207 6.022c.482.368.99.712 1.513 1.028-.771.21-1.565.302-2.369.273a8 8 0 0 1-.373-.022c.458-.394.869-.823 1.228-1.279zm1.347-6.431c-.516-1.957-1.527-3.437-3.002-4.398-.647-.421-1.385-.741-2.194-.95.011-.134.026-.268.043-.4.014-.113.03-.216.046-.313.133-.689.332-1.37.589-2.025.099-.25.206-.499.321-.74l.004-.008c.177-.358.376-.719.61-1.105l.092-.152-.003-.001c.544-.851 1.197-1.627 1.942-2.311l.288.341c.672.796 1.304 1.548 1.878 2.237 1.291 1.549 2.966 3.583 3.612 4.48 1.277 1.771 1.893 3.579 1.83 5.375-.049 1.395-.461 2.755-1.195 3.933-.694 1.116-1.661 2.05-2.8 2.708-.636-.318-1.559-.839-2.539-1.599.79-1.575.952-3.28.479-5.072zm-2.575 5.397c-.725.939-1.587 1.55-2.09 1.856-.081-.029-.163-.06-.243-.093l-.065-.026c-1.49-.616-2.747-1.656-3.635-3.01-.907-1.384-1.356-2.993-1.298-4.653.041-1.19.338-2.327.882-3.379.316-.07.638-.114.96-.131l.084-.002c.162-.003.324-.003.478 0 .227.011.454.035.677.07.073 1.513.445 3.145 1.105 4.852.637 1.644 1.694 3.162 3.144 4.515z"/></svg>',ql='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="m12 1.608 12 20.784H0Z"/></svg>',Yl='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#635BFF" d="M13.976 9.15c-2.172-.806-3.356-1.426-3.356-2.409 0-.831.683-1.305 1.901-1.305 2.227 0 4.515.858 6.09 1.631l.89-5.494C18.252.975 15.697 0 12.165 0 9.667 0 7.589.654 6.104 1.872 4.56 3.147 3.757 4.992 3.757 7.218c0 4.039 2.467 5.76 6.476 7.219 2.585.92 3.445 1.574 3.445 2.583 0 .98-.84 1.545-2.354 1.545-1.875 0-4.965-.921-6.99-2.109l-.9 5.555C5.175 22.99 8.385 24 11.714 24c2.641 0 4.843-.624 6.328-1.813 1.664-1.305 2.525-3.236 2.525-5.732 0-4.128-2.524-5.851-6.594-7.305h.003z"/></svg>',jl='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><defs><linearGradient id="vb-a" x1="0.414" y1="0.255" x2="0" y2="0.932" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#eab308"/><stop offset="1" stop-color="#ca8a04"/></linearGradient><linearGradient id="vb-b" x1="0.338" y1="0.02" x2="0.664" y2="0.966" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#fde68a"/><stop offset="1" stop-color="#fbbf24"/></linearGradient><linearGradient id="vb-c" y1="0.5" x2="1" y2="0.5" gradientUnits="objectBoundingBox"><stop offset="0" stop-color="#7dd3fc"/><stop offset="1" stop-color="#0ea5e9"/></linearGradient></defs><g transform="translate(-2056 -1899)"><path d="M742.271,987.024c-66.706,0-119.121,54.673-121.874,126.408l-2.551,95.471c-3.967,78.653,71.961,105.52,126.936,105.52Z" transform="translate(1463.458 1004.277)" fill="url(#vb-a)"/><path d="M92.616.01H319.894c54.53-.8,95.624,40.1,98.381,93.335l6.144,135.76c.732,67.368-48.116,94.95-104.525,95.335L92.616,327.374C34.061,327.8-1.063,283.663.022,229.105l3.8-135.76C7.41,33.54,33.3,1.093,92.616.01Z" transform="translate(2118.42 1991.302)" fill="url(#vb-b)"/><path d="M86.844.009H299.958c51.132-.746,89.665,37.307,92.25,86.824l5.761,126.29c.686,62.669-45.117,88.326-98.011,88.685L86.844,304.537C31.938,304.933-1,263.875.02,213.123L3.58,86.834C6.948,31.2,31.222,1.016,86.844.009Z" transform="translate(2136.977 2001.737)" fill="#111827"/><circle cx="27.626" cy="27.626" r="27.626" transform="translate(2421.148 2104.357)" fill="url(#vb-c)"/><circle cx="27.626" cy="27.626" r="27.626" transform="translate(2208.034 2104.357)" fill="url(#vb-c)"/></g></svg>',Zl='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#3FCF8E" d="M11.9 1.036c-.015-.986-1.26-1.41-1.874-.637L.764 12.05C-.33 13.427.65 15.455 2.409 15.455h9.579l.113 7.51c.014.985 1.259 1.408 1.873.636l9.262-11.653c1.093-1.375.113-3.403-1.645-3.403h-9.642z"/></svg>',Jl='<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path fill="#FBF0DF" d="M12 22.596c6.628 0 12-4.338 12-9.688 0-3.318-2.057-6.248-5.219-7.986-1.286-.715-2.297-1.357-3.139-1.89C14.058 2.025 13.08 1.404 12 1.404c-1.097 0-2.334.785-3.966 1.821a49.92 49.92 0 0 1-2.816 1.697C2.057 6.66 0 9.59 0 12.908c0 5.35 5.372 9.687 12 9.687v.001ZM10.599 4.715c.334-.759.503-1.58.498-2.409 0-.145.202-.187.23-.029.658 2.783-.902 4.162-2.057 4.624-.124.048-.199-.121-.103-.209a5.763 5.763 0 0 0 1.432-1.977Zm2.058-.102a5.82 5.82 0 0 0-.782-2.306v-.016c-.069-.123.086-.263.185-.172 1.962 2.111 1.307 4.067.556 5.051-.082.103-.23-.003-.189-.126a5.85 5.85 0 0 0 .23-2.431Zm1.776-.561a5.727 5.727 0 0 0-1.612-1.806v-.014c-.112-.085-.024-.274.114-.218 2.595 1.087 2.774 3.18 2.459 4.407a.116.116 0 0 1-.049.071.11.11 0 0 1-.153-.026.122.122 0 0 1-.022-.083a5.891 5.891 0 0 0-.737-2.331Zm-5.087.561c-.617.546-1.282.76-2.063 1-.117 0-.195-.078-.156-.181 1.752-.909 2.376-1.649 2.999-2.778 0 0 .155-.118.188.085 0 .304-.349 1.329-.968 1.874Zm4.945 11.237a2.957 2.957 0 0 1-.937 1.553c-.346.346-.8.565-1.286.62a2.178 2.178 0 0 1-1.327-.62 2.955 2.955 0 0 1-.925-1.553.244.244 0 0 1 .064-.198.234.234 0 0 1 .193-.069h3.965a.226.226 0 0 1 .19.07c.05.053.073.125.063.197Zm-5.458-2.176a1.862 1.862 0 0 1-2.384-.245 1.98 1.98 0 0 1-.233-2.447c.207-.319.503-.566.848-.713a1.84 1.84 0 0 1 1.092-.11c.366.075.703.261.967.531a1.98 1.98 0 0 1 .408 2.114 1.931 1.931 0 0 1-.698.869v.001Zm8.495.005a1.86 1.86 0 0 1-2.381-.253 1.964 1.964 0 0 1-.547-1.366c0-.384.11-.76.32-1.079.207-.319.503-.567.849-.713a1.844 1.844 0 0 1 1.093-.108c.367.076.704.262.968.534a1.98 1.98 0 0 1 .4 2.117 1.932 1.932 0 0 1-.702.868Z"/></svg>',Po={bun:{svg:`data:image/svg+xml,${encodeURIComponent(Jl)}`,color:"#FBF0DF",name:"Bun"},typescript:{svg:`data:image/svg+xml,${encodeURIComponent(_l)}`,color:"#3178C6",name:"TypeScript"},react:{svg:`data:image/svg+xml,${encodeURIComponent(Hl)}`,color:"#61DAFB",name:"React"},vite:{svg:`data:image/svg+xml,${encodeURIComponent($l)}`,color:"#BD34FE",name:"Vite"},nextjs:{svg:`data:image/svg+xml,${encodeURIComponent(Wl)}`,color:"var(--foreground, #000000)",name:"Next.js"},nodejs:{svg:`data:image/svg+xml,${encodeURIComponent(Gl)}`,color:"#339933",name:"Node.js"},firebase:{svg:`data:image/svg+xml,${encodeURIComponent(Kl)}`,color:"#DD2C00",name:"Firebase"},supabase:{svg:`data:image/svg+xml,${encodeURIComponent(Zl)}`,color:"#3FCF8E",name:"Supabase"},vercel:{svg:`data:image/svg+xml,${encodeURIComponent(ql)}`,color:"var(--foreground, #000000)",name:"Vercel"},stripe:{svg:`data:image/svg+xml,${encodeURIComponent(Yl)}`,color:"#635BFF",name:"Stripe"},valibot:{svg:`data:image/svg+xml,${encodeURIComponent(jl)}`,color:"#FBBF24",name:"Valibot"}};import{jsx as Ke,jsxs as cc}from"react/jsx-runtime";function ic({techKey:e,variant:t}){let o=Po[e],[n,r]=Ql(!1);if(!o)return null;let a=decodeURIComponent(o.svg.replace("data:image/svg+xml,","")),i=nt(a);return Ke(ec,{variant:t,className:"dndev-tech-card",style:{"--tech-color":o.color},"data-hover":n,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:cc(oc,{direction:"column",align:"center",gap:"tight",children:[Ke("div",{className:"dndev-tech-card-logo","data-tech":e,dangerouslySetInnerHTML:{__html:i}}),Ke(nc,{as:"span",level:"small",children:o.name})]})})}function sc({title:e,techs:t,cols:o=3,gap:n="medium",separator:r=!1,tone:a=rc.GHOST,align:i,collapsible:s,open:l,onOpenChange:c,defaultOpen:d,className:p}){let h=typeof o=="number"?{mobile:o,tablet:o,desktop:o,wide:o}:{mobile:o[0],tablet:o[1],desktop:o[2],wide:o[3]},f=g=>{if(g==="long")return{cols:2,rows:1};if(g==="high")return{cols:1,rows:2};if(g==="huge")return{cols:2,rows:2}},m=t.filter(g=>Po[g.name]).map(g=>({id:g.name,content:Ke(ic,{techKey:g.name,variant:g.variant}),span:f(g.size)})),u=Ke(Xl,{items:m,columns:h,gap:n,ariaLabel:"Technology stack"});return Ke(tc,{title:e,separator:r,tone:a,align:i,collapsible:s,open:l,onOpenChange:c,defaultOpen:d,className:ac("dndev-tech-bento",p),children:Ke("div",{className:"dndev-tech-bento-grid",children:u})})}var lc=sc;import{Suspense as dc,lazy as uc}from"react";import{useConsent as sr}from"@donotdev/core";import{jsx as lr}from"react/jsx-runtime";var pc=uc(()=>import("./CookieConsent-QOUAY6B4.js"));function Iv(){let e=sr("hasConsented"),t=sr("showBanner");return e&&!t?null:lr(dc,{fallback:null,children:lr(pc,{})})}import{useLayoutEffect as mc}from"react";import{useLayout as cr}from"@donotdev/core";function Bv({hideBreadcrumbs:e,preset:t}){let o=cr("setRouteHideBreadcrumbs"),n=cr("setRoutePresetOverride");return mc(()=>(e!=null&&o(e),t!=null&&n(t),()=>{o(!1),n(null)}),[e,t,o,n]),null}import{Button as dr,ScrollArea as fc}from"@donotdev/components";import{cn as ur}from"@donotdev/components";import{jsx as Le,jsxs as gc}from"react/jsx-runtime";function Uv({content:e,cta:t,align:o="center",justify:n="center",disableScrollArea:r=!1,contentVariant:a="narrow",contentClassName:i,ctaClassName:s}){let c=a==="narrow"?a==="narrow"&&Le("div",{className:"dndev-game-container__content-narrow",children:e}):e,d=r?Le("div",{style:{overflow:"auto",overscrollBehavior:"contain",height:"100%"},children:c}):Le(fc,{className:"dndev-game-container__scroll",children:c});return gc("div",{className:"dndev-game-container",children:[Le("div",{className:ur("dndev-game-container__content",i),"data-align":o,"data-justify":n,"data-content-variant":a,children:Le("div",{className:"dndev-game-container__scroll-wrapper",children:d})}),t&&Le("div",{className:ur("dndev-game-container__cta",s),children:Array.isArray(t)?Le("div",{className:"dndev-game-container__cta-buttons",children:t.map((p,h)=>Le(dr,{onClick:p.onClick,disabled:p.disabled??!1,variant:p.variant??"default",className:"dndev-game-container__cta-button",fullWidth:!0,children:p.label},h))}):Le(dr,{onClick:t.onClick,disabled:t.disabled??!1,variant:t.variant??"default",className:"dndev-game-container__cta-button",children:t.label})})]})}import{useEffect as hc,Suspense as vc,lazy as yc}from"react";import{jsx as Ao}from"react/jsx-runtime";var pr=new Set,mr=new Map;function bc(e,t){let o=mr.get(e);if(o)return o;let n=t[e];if(!n)return null;let r=yc(n);return mr.set(e,r),r}function $v({screenRegistry:e,currentScreen:t,nextScreen:o,fallback:n=null}){hc(()=>{if(o&&!pr.has(o)){pr.add(o);let a=e[o];a&&a().catch(()=>{})}},[o,e]);let r=t?bc(t,e):null;return!t||!r?null:Ao("div",{style:{height:"100%"},children:Ao(vc,{fallback:n,children:Ao(r,{})})})}import{cn as Sc,DISPLAY as Io}from"@donotdev/components";import{useAppConfig as fr}from"@donotdev/core";import{jsx as $t,jsxs as kc}from"react/jsx-runtime";var wc=({display:e=Io.AUTO,linkToHome:t=!0,className:o})=>{let n=fr("name"),a=fr("shortName")||n||"App",i=re.getLogoSvgContent(),s=re.resolveLogo(),l=e===Io.FULL||e===Io.AUTO,c=i?$t("div",{className:"app-branding-logo",role:"img","aria-label":a,dangerouslySetInnerHTML:{__html:nt(i)}}):re.assetExists(s)?$t("img",{src:s,alt:a,className:"app-branding-logo"}):null,d=l&&$t("span",{className:"app-branding-title","data-display":e,children:a}),p=kc("div",{className:Sc("app-branding",o),"data-display":e,children:[c,d]});return t?$t(D,{path:"/",className:"app-branding-link",children:p}):p},Cc=wc;import{cn as gr}from"@donotdev/components";import{useAppConfig as hr}from"@donotdev/core";import{jsx as yr}from"react/jsx-runtime";var vr={sm:{width:"var(--icon-md)",height:"var(--icon-md)"},md:{width:"var(--icon-touch)",height:"var(--icon-touch)"},lg:{width:"var(--icon-touch)",height:"var(--icon-touch)"},xl:{width:"var(--touch-target)",height:"var(--touch-target)"},header:{height:"var(--icon-touch)",width:"auto"}},xc=({alt:e,size:t="header",className:o})=>{let n=hr("name"),r=hr("shortName"),a=e||n||r||"App",i=re.getLogoSvgContent(),s=re.resolveLogo(),l=typeof t=="string"&&t in vr?vr[t]:typeof t=="string"?{}:{width:t,height:t};return i?yr("div",{className:gr("app-icon-header",o),style:{display:"inline-flex",...l},role:"img","aria-label":a,dangerouslySetInnerHTML:{__html:nt(i)}}):yr("img",{src:s,alt:a,className:gr(o),style:{objectFit:"contain",...l}})},Tc=xc;import{cn as br}from"@donotdev/components";import{useAppConfig as Sr,useBreakpoint as Ec}from"@donotdev/core";import{jsx as wr}from"react/jsx-runtime";var Rc=({title:e,className:t,linkToHome:o=!0})=>{let n=Ec("isMobileOrTablet"),r=Sr("name"),a=Sr("shortName"),i=e||n&&a||r||"App",s=wr("div",{className:br("dndev-text-base",t),style:{fontSize:"var(--font-size-xl)",fontWeight:700,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"100%"},children:i});return o?wr(D,{path:"/",className:br("dndev-inline-block",t),children:s}):s},Pc=Rc;import{ChevronRight as Fc}from"lucide-react";import{useMemo as Bc}from"react";import{cn as Oc}from"@donotdev/components";import{useLayout as Mc,useTranslation as zc}from"@donotdev/core";import{useRoutePath as Uc}from"@donotdev/ui/routing/hooks";function Cr(e){let t=[],o="";for(let n of e.split("/").filter(Boolean))o+=`/${n}`,t.push(o);return t}import{useMemo as kr}from"react";import{useNavigationStore as m1,filterNavigationRoutes as f1,getRoutes as Ac,getRouteManifest as g1}from"@donotdev/core";function Ic(){return kr(()=>{try{let e=Ac();return!e||e.length===0?[]:Lc(e)}catch{return[]}},[])}function xr(){let e=Ic();return kr(()=>e.flatMap(t=>t.routes),[e])}function Lc(e){let t=new Map;return e.forEach(o=>{let n=typeof o.path=="string"?o.path:String(o.path);if(!n||n==="undefined"||n==="null")return;let r=o.meta?.entity||Nc(n)||"other",a={path:n,label:o.meta?.title||Dc(n),icon:o.meta?.icon,component:o.component,importPath:o.importPath,exportName:o.exportName,auth:o.auth,meta:o.meta};t.has(r)||t.set(r,{label:r.charAt(0).toUpperCase()+r.slice(1),routes:[]}),t.get(r)?.routes.push(a)}),Array.from(t.values())}function Nc(e){return e.split("/").filter(Boolean)[0]||null}function Dc(e){let t=e.split("/").filter(Boolean),o=t[t.length-1];return o?o.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "):"Home"}import{jsx as bt,jsxs as Hc}from"react/jsx-runtime";var Vc=({items:e,separator:t=Fc,showHome:o=!0,homeHref:n="/",variant:r="default",className:a})=>{let{t:i}=zc("dndev"),s=Uc(),l=xr(),c=Mc("routeRecordLabel"),d=Bc(()=>new Set(l.map(f=>f.path)),[l]),p=e||(()=>{let f=s.split("/").filter(Boolean),m=Cr(s),u=[];return f.forEach((g,y)=>{let x=m[y]??"",C=c&&decodeURIComponent(g)===c.id?c.label:g.split("-").map(P=>P.charAt(0).toUpperCase()+P.slice(1)).join(" "),k=d.has(x)?x:void 0;u.push({label:C,href:k})}),u})(),h=o?[{label:i("navigation.home","Home"),href:n},...p]:p;return r==="smart"&&s.split("/").filter(Boolean).length<2?null:bt("nav",{role:"navigation","aria-label":"Breadcrumb navigation",className:Oc("breadcrumbs",a),children:h.map((f,m)=>{let g=m===h.length-1||!f.href;return Hc("span",{className:"breadcrumb-item",children:[m>0&&bt(t,{className:"dndev-size-md separator"}),f.icon&&bt(f.icon,{className:"dndev-size-md icon"}),f.href&&!g?bt(D,{path:f.href,className:"breadcrumb-link",children:f.label}):bt("span",{className:"breadcrumb-label",children:f.label})]},m)})})},_c=Vc;import{useTranslation as $c,maybeTranslate as Tr,useLayout as Lo,useAppConfig as Wc}from"@donotdev/core";import{jsx as rt,jsxs as Kc}from"react/jsx-runtime";var Gc=({asLink:e=!1,className:t})=>{let o=Wc("app"),n=Lo("gameTitle"),r=Lo("gameSubtitle"),a=Lo("gameNamespace"),{t:i}=$c(a||"dndev"),s=Tr(i,n??void 0),l=Tr(i,r??void 0),c=o?.name||"Game";if(s)return rt("div",{className:t,children:Kc("div",{style:{textAlign:"center"},children:[rt("h2",{style:{fontSize:"var(--font-size-lg)",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s}),l&&rt("p",{style:{color:"var(--muted-foreground)",fontSize:"var(--font-size-sm)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l})]})});let d=rt("h2",{style:{fontSize:"var(--font-size-lg)",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c});return e?rt(D,{path:"/",className:t,style:{fontSize:"var(--font-size-2xl)",fontWeight:700,transition:"color var(--dur-fast) ease-out"},onMouseEnter:p=>p.currentTarget.style.color="var(--primary)",onMouseLeave:p=>p.currentTarget.style.color="var(--foreground)",children:c}):rt("div",{className:t,children:d})};import{Trash2 as qc}from"lucide-react";import{useState as Er}from"react";import{Button as Yc,BUTTON_VARIANT as jc,Checkbox as Zc,Stack as No,useToast as Jc}from"@donotdev/components";import{useTranslation as Qc}from"@donotdev/core";import{useRefresh as Xc}from"@donotdev/ui/routing/hooks";import{jsx as Gt,jsxs as Rr}from"react/jsx-runtime";var Wt=globalThis;function ed(){let{t:e}=Qc("dndev"),{toast:t}=Jc(),[o,n]=Er(!1),r=Xc(),[a,i]=Er({localStorage:!0,sessionStorage:!0,applicationCache:!0,serviceWorker:!0,cookies:!0,indexedDB:!0,webSQL:!0,memoryCache:!0}),s=async()=>{try{n(!0);let l=[];if(a.localStorage&&typeof window<"u")try{localStorage.clear(),l.push("localStorage")}catch{}if(a.sessionStorage&&typeof window<"u")try{sessionStorage.clear(),l.push("sessionStorage")}catch{}if(a.indexedDB&&typeof window<"u"&&"indexedDB"in window)try{if("databases"in indexedDB){let d=await indexedDB.databases();await Promise.all(d.map(async p=>{if(p.name){let h=indexedDB.deleteDatabase(p.name);await new Promise((f,m)=>{h.onsuccess=()=>f(void 0),h.onerror=()=>m(h.error)})}}))}l.push("IndexedDB")}catch{}if(a.webSQL&&typeof window<"u"&&"openDatabase"in window&&typeof Wt.openDatabase=="function")try{let d=Wt.openDatabase("","","","");d&&d.transaction&&d.transaction(p=>{p.executeSql('SELECT name FROM sqlite_master WHERE type="table"',[],(h,f)=>{for(let m=0;m<f.rows.length;m++){let u=f.rows.item(m).name;/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(u)&&h.executeSql(`DROP TABLE IF EXISTS ${u}`)}})}),l.push("WebSQL")}catch{}if(a.applicationCache&&typeof window<"u"&&"caches"in window)try{let d=await caches.keys();await Promise.all(d.map(async p=>{try{await caches.delete(p)}catch{}})),l.push("Application Cache")}catch{}if(a.serviceWorker&&"serviceWorker"in navigator)try{let d=await navigator.serviceWorker.getRegistrations();await Promise.all(d.map(async p=>{try{await p.unregister()}catch{}})),l.push("Service Workers")}catch{}if(a.cookies)try{document.cookie.split(";").forEach(d=>{let p=d.indexOf("="),h=p>-1?d.slice(0,p):d;document.cookie=`${h.trim()}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`,document.cookie=`${h.trim()}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=${window.location.hostname}`,document.cookie=`${h.trim()}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=.${window.location.hostname}`}),l.push("Cookies")}catch{}if(a.memoryCache)try{"gc"in window&&typeof Wt.gc=="function"&&Wt.gc(),l.push("Memory Cache")}catch{}let c=l.length>0?e("settings.clearCache.success","Cache cleared successfully: {{items}}",{items:l.join(", ")}):e("settings.clearCache.noItemsCleared","No cache items were cleared");t("success",c),l.length>0&&setTimeout(()=>{typeof globalThis<"u"&&globalThis._DNDEV_STORES_&&(globalThis._DNDEV_STORES_={}),typeof window<"u"?window.location.href=window.location.href:r()},1e3)}catch{t("error",e("settings.clearCache.error","Error clearing cache"))}finally{n(!1)}};return Rr(No,{children:[Gt(No,{children:Object.entries(a).map(([l,c])=>Rr(No,{direction:"row",align:"center",gap:"tight",children:[Gt(Zc,{id:l,checked:c,onCheckedChange:d=>i(p=>({...p,[l]:!!d}))}),Gt("label",{htmlFor:l,style:{fontSize:"var(--font-size-sm)",fontWeight:500,lineHeight:1,cursor:"pointer"},children:e(`settings.clearCache.${l}`,l.charAt(0).toUpperCase()+l.slice(1))})]},l))}),Gt(Yc,{variant:jc.DESTRUCTIVE,style:{margin:"0 auto"},disabled:o||!Object.values(a).some(Boolean),onClick:s,icon:qc,children:o?e("settings.clearCache.clearing","Clearing..."):e("settings.clearCache.button","Clear Cache")})]})}var Do=ed;import{DropdownMenu as rd,Button as Fo,Stack as ad}from"@donotdev/components";import{Link as td}from"lucide-react";import{navigationMenuTriggerStylePrimitive as od}from"@donotdev/components";import{jsx as Pr,jsxs as nd}from"react/jsx-runtime";var Kt=({path:e,route:t,showIcons:o=!0})=>{let n=xe(),r=t??n.find(s=>s.path===e);if(!r)return null;let a=o&&!!r.icon,i=!!r.label;return nd(D,{path:r.path,className:od(),...a&&!i&&{"data-display":"compact"},children:[o&&Pr(oe,{icon:r.icon,fallback:td}),Pr("span",{children:r.label})]})};import{jsx as qe}from"react/jsx-runtime";var id=({navigation:e,className:t})=>qe(ad,{role:"navigation",direction:"row",align:"center",className:t,style:{gap:"var(--gap-sm)"},children:e.map((o,n)=>o.routes&&o.routes.length>0?qe(rd,{trigger:qe(Fo,{icon:o.icon,children:o.label}),items:o.routes.map(r=>({label:r.label,children:qe(Kt,{route:r}),asChild:!!r.path})),contentAlign:"start"},o.label+n):o.path?qe(Fo,{icon:o.icon,"aria-label":o.label,render:({children:r,...a})=>qe(D,{path:o.path,...a,children:r}),children:o.label},o.label+n):qe(Fo,{icon:o.icon,disabled:!0,"aria-label":o.label,children:o.label},o.label+n))}),sd=id;import{Card as ld,cn as cd}from"@donotdev/components";import{jsx as Bo}from"react/jsx-runtime";var dd=({languages:e,currentLanguage:t,onLanguageChange:o,className:n})=>Bo(ld,{className:cd("dndev-z-modal",n),style:{position:"fixed",bottom:"var(--gap-md)",insetInlineEnd:"var(--gap-md)",display:"flex",alignItems:"center",gap:"var(--gap-sm)",transition:"var(--dur-fast) ease-out"},role:"region","aria-label":"Language selector","data-role":"floating",children:Bo("select",{style:{backgroundColor:"transparent",outline:"none",fontSize:"var(--font-size-base)",cursor:"pointer"},value:t,onChange:r=>o?.(r.target.value),"aria-label":"Select language",children:e.map(r=>Bo("option",{value:r,children:r},r))})}),ud=dd;import{Menu as pd}from"lucide-react";import{useState as md}from"react";import{Button as fd,BUTTON_VARIANT as gd,Popover as hd,Stack as vd}from"@donotdev/components";import{Fragment as wd,jsx as St,jsxs as Cd}from"react/jsx-runtime";function yd({target:e,currentTarget:t}){return!(e instanceof Element)||e.closest("[aria-expanded]")?!1:t.contains(e)?!0:!e.closest('[role="dialog"], [role="alertdialog"]')}var bd=({children:e,className:t})=>{let[o,n]=md(!1),r=a=>{yd(a)&&n(!1)};return Cd(wd,{children:[St("div",{className:"dndev-header-menu-inline",children:e}),St("div",{className:"dndev-header-menu-burger",children:St(hd,{open:o,onOpenChange:n,align:"end",className:"dndev-menu-content dndev-header-menu-panel",trigger:St(fd,{variant:gd.GHOST,icon:pd,"aria-label":"Menu",className:t}),children:St(vd,{gap:"none",onClick:r,children:e})})})]})},Sd=bd;import{MoreHorizontal as kd}from"lucide-react";import{Link as xd}from"lucide-react";import{DISPLAY as wt,DropdownMenu as Td,Button as Ar}from"@donotdev/components";import{cn as Ed}from"@donotdev/components";import{useBreakpoint as Ir,useTranslation as Rd}from"@donotdev/core";import{jsx as Ye}from"react/jsx-runtime";var Pd=({className:e="",showIcons:t=!0,display:o=wt.AUTO,path:n})=>{let{t:r}=Rd("dndev"),a=Ir("isMobile"),i=Ir("isTablet"),s=xe(),l=on(n??"");return n?l?Ye(Ar,{variant:"ghost",display:o,icon:t?Ye(oe,{icon:l.icon,fallback:xd}):void 0,className:e,render:({children:d,...p})=>Ye(D,{path:l.path,...p,children:d}),children:l.label}):null:(o===wt.AUTO?a||i?wt.COMPACT:wt.FULL:o)===wt.COMPACT?Ye(Td,{trigger:Ye(Ar,{variant:"ghost",icon:kd,"aria-label":r("navigation.menu","Navigation"),className:e}),contentAlign:"end",items:s.map(d=>({label:d.label,children:Ye(Kt,{route:d,showIcons:t}),asChild:!0}))}):Ye(Bn,{overflowDetection:!0,showIcons:t,className:Ed(e),style:{flex:1}})},Ad=Pd;import{Bell as Id}from"lucide-react";import{useMemo as Ld,useEffect as Nd,useRef as Dd}from"react";import{Button as Fd,cn as Bd,toast as Od,Stack as Md}from"@donotdev/components";import{jsx as Oo}from"react/jsx-runtime";var zd={sm:{button:{width:"var(--icon-md)",height:"var(--icon-md)"},icon:{width:"var(--icon-md)",height:"var(--icon-md)"},badge:{width:"var(--icon-md)",height:"var(--icon-md)",fontSize:"var(--font-size-xs)"}},md:{button:{width:"var(--touch-target)",height:"var(--touch-target)"},icon:{width:"var(--icon-md)",height:"var(--icon-md)"},badge:{width:"var(--icon-md)",height:"var(--icon-md)",fontSize:"var(--font-size-xs)"}},lg:{button:{width:"var(--touch-target)",height:"var(--touch-target)"},icon:{width:"var(--icon-touch)",height:"var(--icon-touch)"},badge:{width:"var(--icon-touch)",height:"var(--icon-touch)",fontSize:"var(--font-size-sm)"}}},Ud=({notifications:e=[],count:t=0,loading:o=!1,onNotificationClick:n,onDropdownOpen:r,className:a,maxVisible:i=10,alwaysShow:s=!1,size:l="md",disabled:c=!1})=>{let d=zd[l],p=Dd(new Set),h=Ld(()=>t===0?null:t>99?"99+":t.toString(),[t]),f=t>0||s;return Nd(()=>{e.forEach(m=>{if(!p.current.has(m.id)){p.current.add(m.id);let u=m.type==="error"?"error":m.type==="warning"?"warning":m.type==="success"?"success":"info";Od({title:m.title,description:m.message,toastType:u,duration:0,onDismiss:()=>{p.current.delete(m.id),n&&n(m)}})}})},[e,n]),f?Oo("div",{className:Bd(a),style:{position:"relative"},children:Oo(Fd,{disabled:c,style:{...d.button,position:"relative"},onClick:()=>{r?.()},onFocus:m=>{m.currentTarget.style.outline="2px solid var(--ring)",m.currentTarget.style.outlineOffset="2px"},onBlur:m=>{m.currentTarget.style.outline="none"},"aria-label":`${t} notification${t!==1?"s":""}`,icon:Id,children:h&&Oo(Md,{align:"center",justify:"center",style:{position:"absolute",top:"-0.25rem",insetInlineEnd:"-0.25rem",backgroundColor:"var(--destructive)",color:"var(--destructive-foreground)",borderRadius:"var(--radius-full)",fontWeight:600,lineHeight:1,minWidth:0,...d.badge},"aria-hidden":"true",children:h})})}):null},Vd=Ud;import{Settings as _d,Check as Hd}from"lucide-react";import*as zo from"lucide-react";import{Button as $d,BUTTON_VARIANT as Wd,DropdownMenu as Gd,Stack as Kd,DISPLAY as qd}from"@donotdev/components";import{useTranslation as Yd}from"@donotdev/core";import{useLanguageSelector as jd,useTheme as Mo,Flag as Zd}from"@donotdev/core";import{jsx as Oe,jsxs as Xd}from"react/jsx-runtime";function Jd({variant:e=Wd.OUTLINE}={}){let{t}=Yd("dndev"),{languages:o,currentLanguage:n,changeLanguage:r,isLoading:a}=jd(),i=Mo("availableThemes"),s=Mo("currentTheme"),l=Mo("setTheme"),c=f=>{if(!f)return zo.Palette;let m=f.replace(/['"]/g,"");return Xe(m)||zo.Palette},d=i.map(f=>{let m=c(f.meta?.icon),u=f.name===s;return{label:f.displayName||f.name,icon:m,onClick:()=>l(f.name),checked:u}}),p=o.map(f=>{let m=f.id===n;return{label:f.nativeName,onClick:()=>r(f.id),disabled:a,checked:m,className:m?"bg-accent":void 0,iconEnd:m&&!a?Hd:void 0,children:Xd(Kd,{direction:"row",align:"center",gap:"tight",children:[Oe(Zd,{code:f.flagCode||f.id,title:f.nativeName}),Oe("span",{children:f.nativeName}),a&&m&&Oe("div",{style:{marginInlineStart:"auto"},children:Oe("div",{style:{width:"0.5rem",height:"0.5rem",borderRadius:"50%",backgroundColor:"var(--primary)"}})})]})}}),h=[{label:t("auth.title","Authentication"),subContent:Oe(Co,{display:qd.COMPACT})},{label:t("settings.theme","Theme"),subItems:d},{label:t("settings.language","Language"),subItems:p},{label:t("settings.clearCache.title","Clear Cache"),subContent:Oe(Do,{})}];return Oe(Gd,{trigger:Oe($d,{variant:e,"aria-label":t("settings.title","Settings"),icon:_d}),items:h,contentWidth:"14rem",contentAlign:"end"})}var Qd=Jd;import*as Ho from"lucide-react";import{Button as Lr,BUTTON_VARIANT as eu,DropdownMenu as tu,DISPLAY as ou}from"@donotdev/components";import{useTranslation as nu}from"@donotdev/core";import{useTheme as Uo}from"@donotdev/core";import{jsx as _o}from"react/jsx-runtime";var Vo=e=>{if(!e)return Ho.Palette;let t=e.replace(/['"]/g,"");return Xe(t)||Ho.Palette},ru=({display:e=ou.AUTO,"no-tooltip":t=!1})=>{let{t:o}=nu("dndev"),n=Uo("availableThemes"),r=Uo("currentTheme"),a=Uo("setTheme");if(n.length<=1)return null;let i=n.find(y=>y.name===r)||n[0],s=n.length===2?n.find(y=>y.name!==i?.name)||n[0]:null,l=i?Vo(i.meta?.icon):null,c=s?Vo(s.meta?.icon):null,d=i?.displayName||i?.name||"Theme",p=s?.displayName||s?.name||"Theme",h=n.length===2&&s&&c,f=h?c:l,m=h?t?void 0:o("common.themeSelector.tooltipWithNext","Change Theme: Switch to {{next}}",{next:s?.displayName||s?.name}):t?void 0:o("common.themeSelector.changeTheme","Change Theme"),u={variant:eu.OUTLINE,"aria-label":o("common.themeSelector.changeTheme","Change Theme"),tooltip:m,icon:f,display:e};if(h&&s)return _o(Lr,{...u,onClick:()=>a(s.name),children:p});if(!i||!l)return null;let g=n.map(y=>{let x=Vo(y.meta?.icon),C=y.name===r;return{label:y.displayName||y.name,icon:x,onClick:()=>a(y.name),checked:C}});return _o(tu,{trigger:_o(Lr,{...u,children:d}),items:g,contentWidth:"10rem"})},au=ru;import{ExternalLink as iu}from"lucide-react";import{getPlatformEnvVar as su}from"@donotdev/core";import{jsx as lu,jsxs as cu}from"react/jsx-runtime";var $o=({className:e})=>{let o=su("APP_URL")==="https://donotdev.com";return cu("a",{href:o?"https://www.ambroise-park.com":"https://donotdev.com",target:"_blank",rel:"noopener noreferrer",className:e,style:{display:"inline-flex",alignItems:"center",gap:"var(--gap-sm)",fontSize:"var(--font-size-xs)"},children:[o?"AMBROISE-PARK":"DoNotDev",lu(iu,{style:{width:"12px",height:"12px"},"aria-hidden":"true"})]})};import{cn as du}from"@donotdev/components";import{useTranslation as uu,useAppConfig as pu}from"@donotdev/core";import{jsxs as fu}from"react/jsx-runtime";var mu=({appName:e,year:t=new Date().getFullYear(),className:o})=>{let{t:n}=uu("dndev"),r=pu("app"),a=e||r?.name||"App";return r?.footer===null?null:fu("span",{className:du(o),style:{flexShrink:0,color:"var(--muted-foreground)",fontSize:"var(--font-size-xs)"},children:["\xA9 ",t," ",a,". ",n("footer.legal.allRightsReserved")]})};import{Stack as hu}from"@donotdev/components";import{useTranslation as vu,maybeTranslate as yu,useAppConfig as bu}from"@donotdev/core";var gu=[{path:"#cookie-settings",label:"footer.legal.cookieSettings"},{label:"footer.legal.privacyPolicy",path:"/privacy"},{label:"footer.legal.termsOfService",path:"/terms"}],Nr=e=>e===null||e?.legalLinks===null?[]:e?.legalLinks??gu;import{jsx as Dr,jsxs as wu}from"react/jsx-runtime";var Su=({app:e,direction:t="column",gap:o="tight",align:n="stretch"})=>{let{t:r}=vu("dndev"),a=bu("app"),s=Nr((e||a||{}).footer),l={transition:"color var(--dur-fast) ease-out",textDecoration:"underline",textUnderlineOffset:"2px",color:"var(--muted-foreground)",fontSize:"var(--font-size-xs)"};return s.length===0?null:wu(hu,{direction:t,gap:o,align:n,children:[s.map(c=>Dr(D,{path:c.path,style:l,onMouseEnter:d=>d.currentTarget.style.color="var(--primary)",onMouseLeave:d=>d.currentTarget.style.color="var(--muted-foreground)",children:yu(r,c.label)},c.path)),Dr($o,{})]})};import{useMemo as Eu}from"react";import{Stack as Wo,Spinner as Ru}from"@donotdev/components";import{useTranslation as Br,isFieldVisible as Pu}from"@donotdev/core";import{useEffect as Cu,useRef as ku}from"react";import{deriveEntitySeo as xu,useLayout as Fr,useTranslation as Tu}from"@donotdev/core";function qt(e,t){let o=Fr("setRouteRecordLabel"),n=Fr("routeRecordLabel"),r=ku(n);r.current=n;let a=typeof t?.id=="string"?t.id:void 0,{t:i,language:s}=Tu([e.namespace,"crud"]),l=t?xu(e,t,{t:i,locale:s}).title:void 0;Cu(()=>{if(!(!a||!l))return o({id:a,label:l}),()=>{let c=r.current;c?.id===a&&c.label===l&&o(null)}},[a,l,o])}import{jsx as je,jsxs as Iu}from"react/jsx-runtime";function Au({entity:e,id:t,t:o,className:n="",loadingMessage:r,notFoundMessage:a,viewerRole:i,excludeFields:s,preview:l}){if(!ne)return null;let c=!!l,d=N("userRole"),p=i??(c?"super":d),{data:h,loading:f,error:m,notFound:u}=dn(e,t,{enabled:!c}),{t:g}=Br([e.namespace,"crud"]),{t:y}=Br("crud"),x=o||g,C=c?l:h;qt(e,c?null:C);let k=c?null:m,P=c?!1:f||!t,b=Eu(()=>C?Object.entries(e.fields).filter(([A,B])=>{if(s?.includes(A)||!Pu(B.visibility,p)||B.visibility==="hidden")return!1;let S=C[A];return!(S==null||typeof S=="string"&&S.trim()===""||Array.isArray(S)&&S.length===0||typeof S=="object"&&!Array.isArray(S)&&S!==null&&Object.keys(S).length===0)}):[],[e.fields,p,C,s]);return P?je("div",{style:{position:"relative",width:"100%",gridColumn:"1 / -1",display:"contents"},className:n,children:je(Ru,{overlay:!0,"aria-label":r||y("form.loading")})}):!C&&!k&&!u?null:k||!C?je(Wo,{align:"center",justify:"center",style:{padding:"var(--gap-lg)",textAlign:"center"},className:n,children:Iu(Wo,{direction:"column",gap:"tight",children:[je("h3",{style:{color:"var(--muted-foreground)"},children:a||y("errors.notFound",{entity:g("name",{defaultValue:e.name})})}),k&&je("p",{style:{color:"var(--destructive)",fontSize:"var(--font-size-sm)"},children:k instanceof Error?k.message:String(k)})]})}):je(Wo,{direction:"column",className:n,children:b.map(([A,B])=>je(ct,{name:A,config:B,value:C[A],t:x},A))})}import{Search as _r,Undo2 as Hr}from"lucide-react";import{Suspense as Fu,lazy as Bu,useCallback as Ou,useState as he}from"react";import{DataTable as $r,Button as ve,Stack as Ne,ActionButton as Mu,Section as Ct,Input as Wr,Alert as Gr,Text as qo}from"@donotdev/components";import{describeEntity as zu,getEntityByCollection as Uu,useTranslation as kt}from"@donotdev/core";import{describeEntity as Lu}from"@donotdev/core";var Nu=new Set(["text","email","url","tel","textarea"]),Du=new Set(["select","radio"]);function Go(e,t,o,n,r){let a=e.fields[t],i=Lu(e).fields[t];if(!a||!i)throw new Error(`cellEditFor: entity "${e.name}" has no field "${t}".`);if(!i.editableFor(o,"edit"))return;let{value:s}=i;if(s.kind==="ref"&&s.ref!==void 0){let c=n[s.ref];return c?{type:"select",options:Object.entries(c).map(([d,p])=>({value:d,label:p})).sort((d,p)=>d.label.localeCompare(p.label))}:void 0}let{type:l}=a;if(Nu.has(l))return{type:"text"};if(l==="number")return{type:"number"};if(Du.has(l)){let c=a.validation?.options,d=typeof c=="function"?c():c;return Array.isArray(d)?{type:"select",options:d.map(p=>({value:String(p.value),label:vn(p.label,r)}))}:void 0}}import{describeEntity as Or}from"@donotdev/core";var Mr=/^[A-Za-z0-9_-]{1,128}$/,zr=(e,t)=>{let o=Object.hasOwn(e.fields,t)?Or(e).fields[t]?.value:void 0;return o?.kind==="ref"&&o.ref!==void 0};function Ur(e,t){if(!zr(e,t.field))throw new Error(`EntityList: parent.field "${t.field}" is not a reference field of entity "${e.name}".`);if(t.value!==null&&!Mr.test(t.value))throw new Error(`EntityList: parent.value "${t.value}" is not a record id.`)}function Ko(e,t){let o=new URLSearchParams({[t.field]:t.value});return`${e}/new?${o.toString()}`}function Vr(e,t,o){let n={};for(let[r,a]of t.entries())Object.hasOwn(e.fields,r)&&zr(e,r)&&Mr.test(a)&&Or(e).fields[r]?.editableFor(o,"create")===!0&&(n[r]=a);return n}import{Fragment as Zr,jsx as R,jsxs as Me}from"react/jsx-runtime";var Vu=Bu(()=>import("./ChildRowsPicker-PQFE6NCR.js")),Kr=[0,1,2,3,4].map(e=>({display:"grid",gridTemplateColumns:["1fr",...Array(e).fill("auto")].join(" ")}));function qr(e,t,o){let{t:n,viewerRole:r,referenceData:a,editing:i,interactive:s}=o;return t.map(l=>{let c=e.fields[l];if(!c)return null;let d=ut(l,c,n),p=c.type;return{key:l,title:d,dataIndex:l,sortable:s,filterable:s,align:p==="number"||p==="range"?"end":"start",...i&&{edit:Go(e,l,r,a,n)},render:(m,u)=>ao(m,c,n,{compact:!0,referenceData:a,item:u})}}).filter(Boolean)}function Yr(e,t){return(e??[]).map(o=>({key:o.key,title:o.title,align:o.align??"start",render:(n,r)=>o.render(t(r))}))}function jr({actions:e}){return R(Ne,{direction:"row",gap:"tight",align:"center",children:e})}function _u(e){if(!ne)return null;let{entity:t,parent:o,preview:n,tone:r,editable:a=!0}=e;o&&Ur(t,o);let i=fn(t,o);if(o&&o.value===null)return R(Hu,{entity:t,tone:r});let s=o&&o.value!==null?{field:o.field,value:o.value}:void 0;return!n&&(e.extend||i&&s&&a)?R(Gu,{...e,parent:s}):R($u,{...e,parent:s})}function Hu({entity:e,tone:t}){let{t:o}=kt([e.namespace,"crud"]);return R(Ct,{tone:t,children:R(qo,{level:"body",children:o("crud:childRows.createFirst",{entity:o("name",{defaultValue:e.name})})})})}function $u({entity:e,basePath:t,onClick:o,hideFilters:n=!1,pagination:r="auto",pageSize:a,queryOptions:i,exportable:s=!0,editable:l=!0,parent:c,preview:d,tone:p,extraColumns:h,actions:f}){let m=!!d,u=We(),g=t??`/${e.collection}`,y=no(e,!m),[x,C]=he(1),{pageSize:k,setPageSize:P}=oo({collection:e.collection,...a!=null&&{defaultPageSize:a}}),[b,A]=he(""),{filters:B}=lt({collection:e.collection}),S=Object.keys(B).length>0,{data:w,items:F,processed:ae,loading:ie,mutate:q,effectiveMode:$}=cn(e,{enabled:!m,pagination:r,searchQuery:b,...(i||c)&&{queryOptions:c?{...i,where:[...i?.where??[],{field:c.field,operator:"==",value:c.value}]}:i},...(r==="server"||r==="auto")&&{page:x,pageSize:k}}),I=m?d:ae,U=m?!1:ie,{bulk:Y}=ln(e),de=l&&!m,Q=N("userRole"),[z,X]=he({}),[ye,te]=he([]),ue=new Set(I.map(E=>E.id)),j=ye.filter(E=>ue.has(E)),[Re,Qe]=he(!1),[Ue,Z]=he(0),be=Object.values(z).reduce((E,V)=>E+Object.keys(V).length,0),Ve=async()=>{Qe(!0),Z(0);try{let{failed:E}=await Y({updates:Object.entries(z).map(([me,to])=>({id:me,patch:to}))}),V=new Set(E.map(me=>me.id));X(Object.fromEntries(Object.entries(z).filter(([me])=>V.has(me)))),Z(V.size)}catch{Z(Object.keys(z).length)}finally{Qe(!1)}},{t:L}=kt("crud"),{t:_e}=kt([e.namespace,"crud"]),Pe=async()=>{await q()},De=Ou(E=>{m||(o?o(E):u(`${g}/${E}`))},[g,u,o,m]),v=async()=>{if(m)return;Z(0);let{failed:E}=await Y({deletes:j}),V=new Set(E.map(me=>me.id));te(j.filter(me=>V.has(me))),Z(V.size)},O=(e.listFields||Object.keys(e.fields)).filter(E=>E!==c?.field),Ae=[...qr(e,O,{t:_e,viewerRole:Q,referenceData:y,editing:de,interactive:!m}),...Yr(h,E=>({...E,...z[E.id]}))],Se=_e("name",{defaultValue:e.name}),pe=I.length;return Me(Zr,{children:[!n&&R(Ct,{title:L("filters.title",{entity:Se}),collapsible:!0,defaultOpen:S,tone:p,children:R(dt,{entity:e,data:F,fieldsToFilter:O,viewerRole:Q})}),R(Ct,{title:U?L("results.title.fetching"):L("results.title.count",{count:pe}),tone:p,children:Me(Ne,{children:[Me(Ne,{direction:"row",gap:"tight",align:"center",className:"dndev-w-full",style:Kr[1+(l?1:0)+(f?1:0)],children:[R(Wr,{placeholder:L("actions.searchPlaceholder"),value:b,onChange:E=>A(E.target.value),icon:_r,className:"dndev-w-full",disabled:m}),R(ve,{intent:"reload",variant:"outline",onClick:Pe,disabled:m||U,display:"compact","aria-label":L("actions.refresh")}),l?m?R(ve,{intent:"add",display:"compact",disabled:!0,children:L("addNew")}):R(ve,{intent:"add",display:"compact",render:({children:E,...V})=>R(D,{path:c?Ko(g,c):`${g}/new`,...V,children:E}),children:L("addNew")}):null,f&&R(jr,{actions:f})]}),de&&be>0&&Me(Ne,{direction:"row",gap:"tight",align:"center",wrap:"wrap",children:[R(qo,{level:"body",children:L("bulkEdit.pending",{count:be})}),R(ve,{intent:"save",display:"compact",onClick:Ve,disabled:Re,children:L(Re?"form.saving":"actions.save")}),R(ve,{icon:Hr,variant:"outline",display:"compact",onClick:()=>{X({}),Z(0)},disabled:Re,children:L("bulkEdit.discard")})]}),Ue>0&&R(Gr,{variant:"error",title:L("bulkEdit.failed",{count:Ue})}),!m&&l&&j.length>0&&R(Ne,{direction:"row",gap:"tight",align:"center",wrap:"wrap",children:R(Mu,{action:v,confirmTitle:L("delete.titleSelected",{count:j.length}),confirmText:L("delete.confirmSelected",{count:j.length}),confirmLabel:L("actions.delete"),cancelLabel:L("actions.cancel"),variant:"outline",intent:"delete",display:"compact",children:L("bulkEdit.deleteSelected",{count:j.length})})}),R($r,{data:I,columns:Ae,sortable:!m,searchable:!1,pagination:!0,loading:U,onRowClick:m?void 0:E=>De(E.id),selectable:!m&&l,getRowId:E=>E.id,onSelect:E=>te(E.map(V=>V.id)),openLabel:L("actions.open"),...!m&&(o?{onRowOpen:E=>o(E.id)}:{getRowHref:E=>`${g}/${E.id}`}),...de&&{editable:!0,pendingChanges:z,onPendingChange:X,editLabels:{selected:L("bulkEdit.selected"),field:L("bulkEdit.field"),value:L("bulkEdit.value"),apply:L("bulkEdit.apply")}},showingLabel:L("pagination.showing"),paginationPreviousLabel:L("pagination.previous"),paginationNextLabel:L("pagination.next"),paginationItemsPerPagePlaceholder:L("pagination.itemsPerPagePlaceholder"),pageSize:k,onPageSizeChange:P,...!m&&$==="server"&&{currentPage:x,total:w?.total,onPageChange:C},exportable:m?!1:s,exportFilename:`${e.collection}-export`,exportLabel:L("export")})]})})]})}function Wu(e,t){let o=Object.entries(zu(e).fields).filter(([n,{value:r}])=>n!==t&&r.kind==="ref"&&r.ref!==void 0);return o.length===1?o[0][0]:null}function Gu({entity:e,basePath:t,onClick:o,hideFilters:n=!1,pageSize:r,exportable:a=!0,editable:i=!0,parent:s,tone:l,extraColumns:c,actions:d,extend:p}){let h=We(),f=t??`/${e.collection}`,m=N("userRole"),u=mn(e,s,{viewerRole:m,...p&&{extend:p}}),g=u.joined&&i,y=no(e),{pageSize:x,setPageSize:C}=oo({collection:e.collection,...r!=null&&{defaultPageSize:r}}),[k,P]=he(""),{filters:b}=lt({collection:e.collection}),A=Object.keys(b).length>0,[B,S]=he([]),[w,F]=he(!1),[ae,ie]=he(!1),[q,$]=he(null),{t:I}=kt("crud"),{t:U}=kt([e.namespace,"crud"]),Y=s&&g?Wu(e,s.field):null,de=Y?e.fields[Y]?.validation?.reference:void 0,Q=typeof de=="string"?Uu(de):void 0;if(de&&!Q)throw new Error(`EntityList: no entity defines collection "${String(de)}" (the other side of link table "${e.collection}"). Define it with defineEntity().`);let z=new Set(Y?u.items.flatMap(v=>{let O=v[Y];return typeof O=="string"?[O]:[]}):[]),X=new Map(u.base.map(v=>[v.id,v])),ye=new Set(u.edits.added.map(v=>v.id)),te=g?null:new Set(bn(yn(u.items,b,e),k,e).map(v=>v.id)),ue=te?u.base.filter(v=>te.has(v.id)):u.base,j=B.filter(v=>X.has(v)),Re=i&&(u.access.update||u.extensionFields.some(v=>v.editable)),Qe=v=>{let O=u.edits.changes;for(let ee of new Set([...Object.keys(O),...Object.keys(v)])){let Ae=X.get(ee);if(!Ae)continue;let Se=O[ee]??{},pe=v[ee]??{},E={};for(let V of new Set([...Object.keys(Se),...Object.keys(pe)]))V in pe?(!(V in Se)||Se[V]!==pe[V])&&(E[V]=pe[V]):E[V]=Ae[V];Object.keys(E).length>0&&u.update(ee,E)}},Ue=v=>{ye.has(v)||(o?o(v):h(`${f}/${v}`))},Z=async()=>{ie(!0),$(null);try{await u.save()}catch(v){$(v instanceof Error?v.message:I("form.saveFailed"))}finally{ie(!1)}},be=(e.listFields||Object.keys(e.fields)).filter(v=>v!==s?.field),Ve=u.extensionFields.filter(v=>{let O=v.scope?p?.[v.scope]:void 0,ee=v.name.slice((v.scope??"").length+1);return!O?.entity.listFields||O.entity.listFields.includes(ee)}).map(v=>{let{scope:O}=v,ee=O?p?.[O]:void 0;if(!O||!ee)throw new Error(`EntityList: extension field "${v.name}" has no extension "${O}".`);let Ae=v.name.slice(O.length+1),Se=v.config.type==="number"||v.config.type==="range";return{key:v.name,title:ut(v.name,v.config,U),dataIndex:v.name,sortable:!0,filterable:!g,align:Se?"end":"start",...Re&&v.editable&&{edit:Go(ee.entity,Ae,m,y,U)},render:(pe,E)=>ao(pe,v.config,U,{compact:!0,referenceData:y,item:E})}}),L=[...qr(e,be,{t:U,viewerRole:m,referenceData:y,editing:Re&&u.access.update,interactive:!0}),...Ve,...Yr(c,v=>({...v,...u.edits.changes[v.id]}))],_e=U("name",{defaultValue:e.name}),Pe=i&&u.access.create,De=1+(Pe?1:0)+(d?1:0);return Me(Zr,{children:[!g&&!n&&R(Ct,{title:I("filters.title",{entity:_e}),collapsible:!0,defaultOpen:A,tone:l,children:R(dt,{entity:e,data:u.items,fieldsToFilter:be,viewerRole:m})}),R(Ct,{title:u.loading?I("results.title.fetching"):I("results.title.count",{count:ue.length}),tone:l,children:Me(Ne,{children:[Me(Ne,{direction:"row",gap:"tight",align:"center",className:"dndev-w-full",style:Kr[g?De-1:De],children:[!g&&R(Wr,{placeholder:I("actions.searchPlaceholder"),value:k,onChange:v=>P(v.target.value),icon:_r,className:"dndev-w-full"}),R(ve,{intent:"reload",variant:"outline",onClick:()=>{u.refresh()},disabled:u.loading,display:"compact","aria-label":I("actions.refresh")}),Pe&&(g?R(ve,{type:"button",intent:"add",display:"compact",onClick:()=>Y?F(!0):u.add([{}]),disabled:u.loading,children:I("addNew")}):R(ve,{intent:"add",display:"compact",render:({children:v,...O})=>R(D,{path:s?Ko(f,s):`${f}/new`,...O,children:v}),children:I("addNew")})),d&&R(jr,{actions:d})]}),u.pendingCount>0&&Me(Ne,{direction:"row",gap:"tight",align:"center",wrap:"wrap",children:[R(qo,{level:"body",children:I("bulkEdit.pending",{count:u.pendingCount})}),!g&&R(ve,{type:"button",intent:"save",display:"compact",onClick:()=>{Z()},disabled:ae,children:I(ae?"form.saving":"actions.save")}),R(ve,{type:"button",icon:Hr,variant:"outline",display:"compact",onClick:()=>{u.discard(),$(null)},disabled:ae,children:I("bulkEdit.discard")})]}),q&&R(Gr,{variant:"error",title:q}),i&&j.length>0&&(u.access.delete||j.every(v=>ye.has(v)))&&R(Ne,{direction:"row",gap:"tight",align:"center",wrap:"wrap",children:R(ve,{type:"button",variant:"outline",intent:"delete",display:"compact",onClick:()=>{u.remove(j),S([])},children:I("bulkEdit.deleteSelected",{count:j.length})})}),R($r,{data:ue,columns:L,sortable:!0,searchable:!1,pagination:!g,loading:u.loading,onRowClick:v=>Ue(v.id),selectable:i,getRowId:v=>v.id,onSelect:v=>S(v.map(O=>O.id)),openLabel:I("actions.open"),onRowOpen:v=>Ue(v.id),cellErrors:u.errors,...Re&&{editable:!0,pendingChanges:u.edits.changes,onPendingChange:Qe,editLabels:{selected:I("bulkEdit.selected"),field:I("bulkEdit.field"),value:I("bulkEdit.value"),apply:I("bulkEdit.apply")}},showingLabel:I("pagination.showing"),paginationPreviousLabel:I("pagination.previous"),paginationNextLabel:I("pagination.next"),paginationItemsPerPagePlaceholder:I("pagination.itemsPerPagePlaceholder"),pageSize:x,onPageSizeChange:C,exportable:!g&&a,exportFilename:`${e.collection}-export`,exportLabel:I("export")})]})}),w&&Y&&Q&&R(Fu,{fallback:null,children:R(Vu,{entity:Q,viewerRole:m,excludedIds:z,onPick:v=>u.add(v.map(O=>({[Y]:O}))),onClose:()=>F(!1)})})]})}import{Heart as Qr}from"lucide-react";import{useMemo as Ku,useCallback as qu}from"react";import{Card as ta,Grid as oa,Stack as jt,Text as Ze,Skeleton as at,Section as Xr,Button as Yu}from"@donotdev/components";import{useTranslation as ea,getListCardFieldNames as na,useBreakpoint as ju}from"@donotdev/core";import{jsx as Jr}from"react/jsx-runtime";function Yt({detailHref:e,onClick:t,...o}){return ne?e?Jr(ro,{...o,href:e}):Jr(ro,{...o,onClick:t}):null}import{Fragment as ep,jsx as M,jsxs as xt}from"react/jsx-runtime";function Zu(e){let t=e.listCardFields;if(t&&!Array.isArray(t)){let i=t;return{titleFields:i.title??[],subtitleFields:i.subtitle??[],contentFields:i.content??[],footerFields:i.footer??[]}}let o=na(e),n=i=>{let s=e.fields[i]?.type;return s==="image"||s==="images"},r=o.filter(i=>!n(i)),a=o.filter(n);return{titleFields:r.length>0?[r[0]]:[],subtitleFields:[],contentFields:[...r.slice(1,4),...a],footerFields:[]}}var Ju={mobile:0,tablet:1,laptop:2,desktop:3};function Qu({cols:e,entity:t}){let o=Zu(t),n=ju("current"),a=((Array.isArray(e)?e[Ju[n]??3]:e)??1)*3,i=c=>{let d=t.fields[c]?.type;return d==="image"||d==="images"},s=o.contentFields.length>0?M(jt,{direction:"column",gap:"tight",children:o.contentFields.map(c=>i(c)?M(at,{height:120},c):xt("div",{children:[M(Ze,{level:"small",variant:"muted",children:M(at,{})}),M(Ze,{children:M(at,{})})]},c))}):void 0,l=o.footerFields.length>0?M(Ze,{level:"small",children:M(at,{})}):void 0;return M(oa,{cols:e,children:Array.from({length:a},(c,d)=>M(ta,{title:M(at,{}),subtitle:o.subtitleFields.length>0?M(at,{}):void 0,content:s,footer:l,elevated:!0},d))})}function Xu({entity:e,basePath:t,onClick:o,cols:n=[1,2,3,4],staleTime:r=1e3*60*30,queryOptions:a,filter:i,hideFilters:s=!1,resultLabel:l,tone:c,renderCardOverlay:d,clientSort:p,collapsible:h=!1,defaultOpen:f,preview:m}){if(!ne)return null;let u=!!m,g=We(),y=N("userRole"),x=t??`/${e.collection}`,{items:C,processed:k,loading:P,error:b}=Rt(e,{enabled:!u,staleTime:r,queryOptions:a,clientSort:p}),A=u?!1:P,{isFavorite:B,toggleFavorite:S,favoritesFilter:w}=un({collection:e.collection}),{showFavoritesOnly:F,setShowFavoritesOnly:ae,filters:ie,setFilters:q}=lt({collection:e.collection}),$=u?m:k;u||(F&&($=$.filter(w)),i&&($=$.filter(i)),$=$.toSorted((z,X)=>{let ye=B(String(z.id))?0:1,te=B(String(X.id))?0:1;return ye-te}));let{t:I}=ea([e.namespace,"crud"]),{t:U}=ea("crud"),Y=qu(z=>{u||(o?o(z):g(`${x}/${z}`))},[x,g,o,u]),de=Ku(()=>na(e),[e]),Q=I("name",{defaultValue:e.name});return xt(ep,{children:[!s&&M(Xr,{title:U("filters.title",{entity:Q}),collapsible:h,defaultOpen:f,tone:c,children:M(ta,{children:xt(jt,{direction:"column",children:[M(Yu,{variant:!u&&F?"primary":"outline",icon:M(Qr,{size:18}),onClick:()=>ae(!F),disabled:u,children:U(F?"favorites.showAll":"favorites.showFavorites")}),!u&&M(dt,{entity:e,data:C,fieldsToFilter:de,viewerRole:y})]})})}),M(Xr,{title:A?U("results.title.fetching"):l?l($.length):U("results.title.count",{count:$.length}),collapsible:h,defaultOpen:h?!0:void 0,tone:c,children:A?M(Qu,{cols:n,entity:e}):b?xt(jt,{align:"center",justify:"center",style:{padding:"var(--gap-lg)",textAlign:"center"},children:[M(Ze,{level:"h3",style:{color:"var(--destructive)"},children:U("errors.fetchFailed",{entity:Q})}),M(Ze,{level:"small",style:{color:"var(--destructive)"},children:b instanceof Error?b.message:String(b)})]}):$.length===0?xt(jt,{align:"center",justify:"center",style:{padding:"var(--gap-lg)",textAlign:"center"},children:[M(Ze,{level:"h3",style:{color:"var(--muted-foreground)"},children:U("emptyState.title")}),M(Ze,{style:{color:"var(--muted-foreground)"},children:U("emptyState.description")})]}):M(oa,{cols:n,children:$.map(z=>{let X=B(z.id),ye=u||o?void 0:`${x}/${z.id}`;return M(Yt,{item:z,entity:e,detailHref:ye,onClick:u?void 0:o?()=>Y(z.id):void 0,renderOverlay:d?.(z),renderActions:M(Qr,{fill:X?"#ef4444":"#ffffff",stroke:X?"#ef4444":"var(--muted-foreground)",onClick:te=>{te.preventDefault(),te.stopPropagation(),u||S(z.id)},style:{cursor:u?"default":"pointer",width:"var(--icon-md)",height:"var(--icon-md)",transition:"fill 0.2s, stroke 0.2s",opacity:u?.5:1},"aria-label":U(X?"favorites.remove":"favorites.add")})},z.id)})})})]})}import{useEffect as Yo,useMemo as jo,useRef as Zt,useState as tp}from"react";import{FormProvider as op,useWatch as np}from"react-hook-form";import{Alert as rp,Badge as ap,Button as Jt,DropdownMenu as ip,Grid as sp,Stack as lp,Spinner as cp}from"@donotdev/components";import{hasRoleAccess as dp,useTranslation as ra}from"@donotdev/core";import{jsx as H,jsxs as Tt}from"react/jsx-runtime";var up={gridColumn:"1 / -1",width:"100%"};function aa(e){return!e||typeof e!="object"?[]:Object.entries(e).flatMap(([t,o])=>t==="message"&&typeof o=="string"?[o]:t==="ref"||t==="types"?[]:aa(o))}function pp({name:e,config:t,control:o,t:n}){let r=np({control:o,name:e});return H(ct,{name:e,config:t,value:r,t:n})}function mp(e,t){let o=t.indexOf(".");if(o===-1)return e?.[t];let n=e?.[t.slice(0,o)];return typeof n=="object"&&n!==null?n[t.slice(o+1)]:void 0}function Zo(e){let{instanceKey:t,...o}=e;return H(fp,{...o},t)}function fp({entity:e,onSubmit:t,t:o,className:n="",submitText:r,loading:a=!1,defaultValues:i,submitVariant:s="primary",secondaryButtonText:l,secondaryButtonVariant:c="outline",onSecondarySubmit:d,viewerRole:p,operation:h,formId:f,cancelText:m,cancelPath:u,successPath:g,onCancel:y,hideVisibilityInfo:x=!1}){if(!ne)return null;let C=h??(i?"edit":"create"),k=We(),P=N("userRole"),b=p??P,A=f??`entity-form-${e.name}`,{t:B}=ra([e.namespace,"crud"]),{t:S}=ra("crud"),w=o||B,ae=!x&&(b==="admin"||b==="super"),ie=!x&&(b==="user"||b==="admin"||b==="super"),[q,$]=tp(b==="admin"||b==="super"||b==="user"?b:"guest"),I={guest:"muted",user:"secondary",admin:"warning",super:"destructive",technical:"accent",owner:"secondary"},U=["guest","user","admin","super"],Y={guest:"Guest",user:"User",admin:"Admin",super:"Super",technical:"System"},de=jo(()=>U.filter(T=>dp(b,T)).map(T=>({label:Y[T],checked:q===T,onClick:()=>$(T)})),[q,b]);qt(e,C==="edit"?i:void 0);let Q=nn(e,{formId:A,operation:C,defaultValues:i,viewerRole:b,t:w,loading:a,successPath:g}),{control:z,setValue:X,handleSubmit:ye,fields:te,formStatus:ue,uploadProgress:j,isDirty:Re,hasUserInteracted:Qe,resetForm:Ue}=Q,Z=an(A),{errors:be,submitCount:Ve}=Q.formState,L=Zt(null),_e=Zt(null),Pe=Object.keys(be).filter(T=>T!=="root"),De=aa(be.root),v=Pe.length>0||De.length>0||!!Z,O=Zt({submitCount:0,rootKey:"",submissionError:null}),ee=JSON.stringify(De);Yo(()=>{let T=O.current;O.current={submitCount:Ve,rootKey:ee,submissionError:Z};let _=Ve>T.submitCount,le=ee!==T.rootKey&&ee!=="[]"||!!Z&&Z!==T.submissionError;if(!_&&!le)return;let we=_e.current,Ce=L.current;if(!we||!Ce)return;let it=Object.keys(be).filter(ke=>ke!=="root");Array.from(Ce.querySelectorAll("input, textarea, select, button, [tabindex]")).some(ke=>{let st=ke.getAttribute("name");if(!(ke.getAttribute("aria-invalid")==="true"||st!==null&&it.some(fe=>st===fe||st.startsWith(`${fe}.`)))||ke.matches(':disabled, input[type="hidden"]')||ke.closest('[hidden], [inert], [aria-hidden="true"]')||ke.getClientRects().length===0)return!1;for(let fe=ke;fe;fe=fe.parentElement){let tn=getComputedStyle(fe);if(tn.display==="none"||tn.visibility==="hidden")return!1;if(fe===Ce)break}return!0})||(we.focus({preventScroll:!0}),we.scrollIntoView({block:"center",behavior:"smooth"}))},[be,Ve,Z,ee]);let Ae=Re&&Qe,Se=Zt(!1);Yo(()=>{if(C!=="create"||Se.current)return;Se.current=!0;let T=Vr(e,new URLSearchParams(window.location.search),b);for(let[_,le]of Object.entries(T))X(_,le)},[C,e,b,X]);let pe=jo(()=>{if(!ie)return te;let T=U.indexOf(q);return te.filter(({config:_})=>{let le=_.visibility;return le==="hidden"?!1:le==="technical"?!0:U.indexOf(le)<=T})},[te,ie,q]),E=sn(pe,z);Yo(()=>{A&&rn.getState().setIsDirty(A,Ae)},[A,Ae]);let V=()=>{Ue(),y?y():k(u||"back")},me=t?async T=>{await t(T)}:void 0,to=m!==null,Jo=m??S("form.cancel"),Qo={gridColumn:"1 / -1",position:"sticky",bottom:0,backgroundColor:"var(--background)",borderTop:"1px solid var(--border)",paddingTop:"var(--gap-md)",paddingBottom:"var(--gap-md)",zIndex:10,marginTop:"var(--gap-lg)"},da=a||C==="edit"&&!i,se=jo(()=>ue==="uploading"?{loading:!0,loadingText:j<100?S("form.uploading",{progress:Math.round(j)}):S("form.processing"),progress:j}:ue==="validating"?{loading:!0,loadingText:S("form.validating")}:ue==="submitting"?{loading:!0,loadingText:S("form.saving")}:ue==="success"?{loading:!1,successText:S("form.saved")}:ue==="error"?{loading:!1,errorText:S("form.error")}:{loading:!1},[ue,j,S]);return H(op,{...Q,children:H(hn,{formId:A,children:Tt("div",{style:{position:"relative",width:"100%",gridColumn:"1 / -1",display:"contents"},children:[da&&H(cp,{overlay:!0}),Tt("form",{ref:L,id:A,onSubmit:T=>{ye(me)(T).catch(()=>{})},noValidate:!0,className:n,style:{width:"100%",gridColumn:"1 / -1",display:"contents"},children:[v&&H("div",{ref:_e,tabIndex:-1,"aria-label":S("form.error"),style:up,children:Tt(rp,{variant:"error",title:S(Pe.length>0?"form.validationFailed":"form.error"),children:[Pe.length>0&&H("p",{children:S("form.fixFields",{fields:Pe.map(T=>ut(T,e.fields[T],w)).join(", ")})}),De.map((T,_)=>H("p",{children:w(T)},_)),Z&&H("p",{children:w(Z)})]})}),pe.map(({name:T,config:_,editable:le,written:we})=>{let Ce=E[T];if(Ce&&!Ce.visible)return null;let it=Ce&&_.conditions?.required!==void 0?{..._,validation:{..._.validation,required:Ce.required}}:_,Xo=le&&!Ce?.disabled&&!Ce?.readonly,ke=ae&&_.visibility!=="guest",st=_.visibility!=="hidden"?I[_.visibility]:void 0,en=Y[_.visibility]??_.visibility,fe=Xo?H(gn,{name:T,config:it,control:z,t:w},T):we?H(pp,{name:T,config:it,control:z,t:w},T):H(ct,{name:T,config:it,value:mp(Q.record,T),t:w},T);return ke?Tt("div",{style:{position:"relative"},children:[H(ap,{as:"span",variant:st,style:{position:"absolute",top:0,insetInlineEnd:0,fontSize:"var(--font-size-xs)",zIndex:1},children:en}),fe]},T):fe}),(()=>{let T=[];if(to&&Jo&&T.push(H(Jt,{type:"button",intent:"cancel",onClick:V,disabled:se.loading,variant:"outline",className:"dndev-w-full",children:Jo},"cancel")),ie){let we=I[q]||"muted";T.push(H(ip,{trigger:Tt(Jt,{type:"button",intent:"preview",variant:we,disabled:se.loading,className:"dndev-w-full",children:[S("visibility.preview"),": ",Y[q]]}),items:de},"preview"))}l&&T.push(H(Jt,{type:"button",onClick:()=>{if(d){let we=Q.getValues();d(we)}},loading:se.loading,loadingText:se.loadingText,progress:se.progress,variant:c,className:"dndev-w-full",children:l},"secondary")),T.push(H(Jt,{type:"submit",intent:"save",loading:se.loading,loadingText:se.loadingText,progress:se.progress,variant:se.successText?"success":se.errorText?"destructive":s,disabled:!!se.successText,className:"dndev-w-full",children:se.successText||se.errorText||r||S("form.submit")},"submit"));let _=T.length;if(_===1)return H(lp,{direction:"column",gap:"tight",style:Qo,children:T[0]});let le=_===2?"1fr 2fr":_===3?"1fr 1fr 2fr":"1fr 1fr 1fr 2fr";return H(sp,{cols:["1fr",le,le,le],gap:"tight",style:Qo,children:T})})()]})]})})})}import{Card as gp,Section as hp,Skeleton as Qt,Stack as vp}from"@donotdev/components";import{useTranslation as yp,useBreakpoint as bp}from"@donotdev/core";import{jsx as Je,jsxs as wp}from"react/jsx-runtime";function Sp({entity:e,queryOptions:t,title:o,basePath:n,cols:r=[1,1,3,3],tone:a,className:i}){if(!ne)return null;let{t:s}=yp([e.namespace,"crud"]),{items:l,loading:c}=Rt(e,{queryOptions:t}),d=bp("current");if(!c&&l.length===0)return null;let p=n??`/${e.collection}`,h=o??s("recommendations.title"),f={mobile:0,tablet:1,laptop:2,desktop:3},m=(Array.isArray(r)?r[f[d]??3]:typeof r=="number"?r:3)??1,u=(typeof m=="number"?m:3)*3;return Je(hp,{title:h,gridCols:r,tone:a,className:i,children:c?Array.from({length:u},(g,y)=>Je(gp,{title:Je(Qt,{width:"60%"}),subtitle:Je(Qt,{width:"40%"}),content:wp(vp,{direction:"column",gap:"tight",children:[Je(Qt,{width:"80%"}),Je(Qt,{width:"50%"})]}),elevated:!0},y)):l.map(g=>Je(Yt,{item:g,entity:e,detailHref:`${p}/${g.id}`},g.id))})}import{Button as Cp,Stack as kp,Stepper as xp}from"@donotdev/components";import{useTranslation as Tp}from"@donotdev/core";import{Fragment as Rp,jsx as Xt,jsxs as Pp}from"react/jsx-runtime";function Ep({workflow:e,onComplete:t,onStepChange:o,defaultValues:n,viewerRole:r,children:a,className:i}){if(!ne)return null;let{t:s}=Tp("crud"),l=pn(e,{onComplete:t,onStepChange:o,defaultValues:n});if(a)return Xt(Rp,{children:a(l)});let{currentStep:c,currentStepIndex:d,visibleSteps:p,isFirst:h,isLast:f,isSubmitting:m,stepData:u}=l,g=p.map((y,x)=>({number:x+1,title:y.title,content:null}));return Pp(kp,{className:i,gap:"large",children:[Xt(xp,{steps:g,activeStep:d,showStepNumbers:!0,onStepChange:y=>{y<=d&&l.goToStep(y)}}),c.custom?c.custom(l.allData):c.entity?Xt(Zo,{entity:c.entity,operation:"create",viewerRole:r,defaultValues:{...u[c.id],...!f&&{status:"draft"}},onSubmit:async y=>{await l.goNext(y)},successPath:null,submitText:s(f?"workflow.submit":"workflow.next"),cancelText:h?null:s("workflow.previous"),onCancel:h?void 0:l.goPrevious,loading:m,hideVisibilityInfo:!0}):null,c.allowSkip&&!f&&Xt(Cp,{variant:"ghost",onClick:l.skipStep,className:"dndev-w-full",children:s("workflow.skip")})]})}import{createContext as sa,useId as Ap,use as ia}from"react";import{Controller as Ip,FormProvider as Lp,useFormContext as Np}from"react-hook-form";import{Label as Dp,Slot as Fp,cn as Bp,Stack as Op}from"@donotdev/components";import{jsx as ze}from"react/jsx-runtime";var A2=Lp,la=sa({}),I2=({...e})=>ze(la.Provider,{value:{name:e.name},children:ze(Ip,{...e})}),ca=sa({}),L2=({className:e,children:t,...o})=>{let n=Ap();return ze(ca.Provider,{value:{id:n},children:ze(Op,{className:e,...o,children:t})})},eo=()=>{let e=ia(la);if(!e||!e.name)return null;let t=ia(ca);if(!t)return null;let{getFieldState:o,formState:n}=Np(),r=o(e.name,n),{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...r}},N2=({className:e,...t})=>{let o=eo();if(!o)return null;let{error:n,formItemId:r}=o;return ze(Dp,{className:Bp(n&&"text-destructive",e),htmlFor:r,...t})},D2=({...e})=>{let t=eo();if(!t)return null;let{error:o,formItemId:n,formDescriptionId:r,formMessageId:a}=t;return ze(Fp,{id:n,"aria-describedby":o?`${r} ${a}`:`${r}`,"aria-invalid":!!o,...e})},F2=({className:e,...t})=>{let o=eo();if(!o)return null;let{formDescriptionId:n}=o;return ze("p",{id:n,className:e,style:{fontSize:"var(--font-size-sm)",color:"var(--muted-foreground)"},...t})},B2=({className:e,children:t,...o})=>{let n=eo();if(!n)return null;let{error:r,formMessageId:a}=n,i=r?String(r?.message):t;return i?ze("p",{id:a,className:e,style:{fontSize:"var(--font-size-sm)",fontWeight:500,color:"var(--destructive)"},...o,children:i}):null};var Mp={layoutContainer:"dndev-layout",sidebar:"sidebar",sidebarTop:"sidebar-top",sidebarContent:"sidebar-content",sidebarBottom:"sidebar-bottom",sidebarResizeHandle:"dndev-sidebar-resize-handle",header:"header",main:"main",footer:"footer",container:"dndev-container",pageContainer:"dndev-container",breadcrumbsContainer:"breadcrumbs-container"},zp={zHeader:"dndev-z-header",zSidebar:"dndev-z-sidebar",zOverlay:"dndev-z-overlay",zModal:"dndev-z-modal",zTooltip:"dndev-z-tooltip",zToast:"dndev-z-toast"},K2={...Mp,...zp},q2={headerHeight:"--header-height",headerPadding:"--header-padding",headerIconSize:"--header-icon-size",headerLogoMaxHeight:"--header-logo-max-height",sidebarWidth:"--sidebar-width",sidebarPadding:"--sidebar-padding",mainPadding:"--main-padding",mainMaxWidth:"--main-max-width",contentWidth:"--content-width",contentPadding:"--content-padding",footerHeight:"--footer-height",footerPadding:"--footer-padding",zHeader:"--z-header",zSidebar:"--z-sidebar",zFooter:"--z-footer",zOverlay:"--z-overlay",zModal:"--z-modal",zTooltip:"--z-tooltip",zToast:"--z-toast"},Y2={headerHeight:"--header-height",headerPadding:"--header-padding",logoSize:"--logo-size",sidebarWidth:"--sidebar-width",sidebarPadding:"--sidebar-padding",footerHeight:"--footer-height",footerPadding:"--footer-padding",layoutGap:"--layout-gap",sectionGap:"--gap-lg",contentGap:"--content-gap",zHeader:"--z-header",zSidebar:"--z-sidebar",zFooter:"--z-footer",zModal:"--z-modal",zTooltip:"--z-tooltip"};export{Cc as AppBranding,Tc as AppIcon,Pc as AppTitle,re as AssetResolver,wa as AuthGuard,zm as AuthGuardFallback,Co as AuthHeader,So as AuthMenu,ri as AuthReturnTo,_c as Breadcrumbs,Do as CacheSettings,Iv as ConsentBanner,Bn as DnDevNavigationMenu,sd as DropdownNavigation,Xu as EntityCardList,Au as EntityDisplayRenderer,Zo as EntityFormRenderer,_u as EntityList,Sp as EntityRecommendations,Ep as EntityWorkflow,Vl as FeatureCard,yl as FeatureDisabled,ud as FloatingLanguageSwitcher,$o as FooterBranding,mu as FooterCopyright,Su as FooterLegalLinks,A2 as Form,D2 as FormControl,F2 as FormDescription,I2 as FormField,L2 as FormItem,N2 as FormLabel,B2 as FormMessage,Uv as GameContainer,$v as GameFlow,Gc as GameTitle,of as GoTo,Oi as GoToInput,Ri as GoToWrapper,Sd as HeaderMenu,Ad as HeaderNavigation,ua as Icon,D as Link,On as NotFoundPage,Vd as Notifications,Bv as PageConfig,Nt as PageContainer,Vp as PasswordResetCallback,Ll as ProgressBar,Pl as RedirectOverlay,Ls as Seo,Qd as SettingsMenu,ci as SignedInRedirect,Fl as Skeleton,lc as TechBento,au as ThemeToggle,K2 as allLayoutClasses,uh as buildProductJsonLd,im as createAuthConfig,Y2 as cssVariables,ph as deriveEntitySeo,Up as isAuthAvailable,wg as isBillingAvailable,Ag as isCrudAvailable,gg as isFormStoreAvailable,Dg as isOAuthAvailable,Mp as layoutClasses,zp as layoutUtilities,q2 as layoutVariables,pg as resolveFaviconSet,ug as resolveLogo,nt as sanitizeSvg,zg as tList,Po as techLogos,N as useAuthSafe,rm as useAuthState,Mt as useAuthVisibility,jf as useBack,Tg as useBillingVisibility,tm as useCanNavigate,Pg as useCrudSafe,eo as useFormField,ts as useFormStoreSafe,_p as useGoTo,nm as useHasRole,ig as useLocalizedPath,Qf as useLocation,ng as useMatch,We as useNavigate,xe as useNavigationItems,on as useNavigationRoute,Ng as useOAuthSafe,eg as useParams,Jf as usePrefetch,rg as useQueryParams,ag as useRedirectGuard,Zf as useRefresh,tg as useRouteParam,Xf as useRoutePath,og as useSearchParams,jg as useSeo,ho as useStripeBillingSafe,sg as useUrlLanguage,om as useUserRole,am as withAuth};