@leverege/imaginarium-ui 1.0.0-beta.5 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/lib/{Card-DSUIILAj.js → Card-JFmpTzpz.js} +9 -9
  2. package/lib/{Card-DSUIILAj.js.map → Card-JFmpTzpz.js.map} +1 -1
  3. package/lib/{ImaginariumApp-B-8UzTbq.js → ImaginariumApp-CwOYW6Jp.js} +2 -2
  4. package/lib/{ImaginariumApp-B-8UzTbq.js.map → ImaginariumApp-CwOYW6Jp.js.map} +1 -1
  5. package/lib/Label-BgvLHORr.cjs +2 -0
  6. package/lib/Label-BgvLHORr.cjs.map +1 -0
  7. package/lib/Label-CewJarON.js +112 -0
  8. package/lib/Label-CewJarON.js.map +1 -0
  9. package/lib/PluginSetup-DADMV3GR.cjs +2 -0
  10. package/lib/PluginSetup-DADMV3GR.cjs.map +1 -0
  11. package/lib/PluginSetup-DAgVBMVL.cjs +2 -0
  12. package/lib/PluginSetup-DAgVBMVL.cjs.map +1 -0
  13. package/lib/PluginSetup-JtjqdS0W.js +188 -0
  14. package/lib/PluginSetup-JtjqdS0W.js.map +1 -0
  15. package/lib/PluginSetup-dlG3KzZ8.js +546 -0
  16. package/lib/PluginSetup-dlG3KzZ8.js.map +1 -0
  17. package/lib/PluginSetup.d.ts.map +1 -1
  18. package/lib/index.cjs +1 -1
  19. package/lib/index.cjs.map +1 -1
  20. package/lib/index.d.ts +5 -0
  21. package/lib/index.d.ts.map +1 -1
  22. package/lib/index.js +122 -115
  23. package/lib/index.js.map +1 -1
  24. package/lib/secret/PluginSetup.d.ts +7 -0
  25. package/lib/secret/PluginSetup.d.ts.map +1 -0
  26. package/lib/secret/SecretNavItem.d.ts +9 -0
  27. package/lib/secret/SecretNavItem.d.ts.map +1 -0
  28. package/lib/secret/SecretPage.d.ts +8 -0
  29. package/lib/secret/SecretPage.d.ts.map +1 -0
  30. package/lib/secret/SecretView.d.ts +6 -0
  31. package/lib/secret/SecretView.d.ts.map +1 -0
  32. package/lib/secret/index.d.ts +6 -0
  33. package/lib/secret/index.d.ts.map +1 -0
  34. package/lib/secret/types.d.ts +23 -0
  35. package/lib/secret/types.d.ts.map +1 -0
  36. package/lib/secret.cjs +2 -0
  37. package/lib/secret.cjs.map +1 -0
  38. package/lib/secret.js +8 -0
  39. package/lib/secret.js.map +1 -0
  40. package/lib/shell.js +1 -1
  41. package/lib/system.cjs +1 -1
  42. package/lib/system.js +1 -1
  43. package/package.json +6 -1
  44. package/src/PluginSetup.ts +2 -0
  45. package/src/filters/FilterContext.tsx +1 -1
  46. package/src/index.ts +17 -0
  47. package/src/secret/PluginSetup.ts +13 -0
  48. package/src/secret/SecretNavItem.ts +9 -0
  49. package/src/secret/SecretPage.tsx +7 -0
  50. package/src/secret/SecretView.tsx +245 -0
  51. package/src/secret/index.ts +5 -0
  52. package/src/secret/types.ts +26 -0
  53. package/lib/PluginSetup-LcJcety2.js +0 -651
  54. package/lib/PluginSetup-LcJcety2.js.map +0 -1
  55. package/lib/PluginSetup-fU191MkB.cjs +0 -2
  56. package/lib/PluginSetup-fU191MkB.cjs.map +0 -1
@@ -178,15 +178,15 @@ export {
178
178
  R as B,
179
179
  J as C,
180
180
  q as I,
181
- B as a,
182
- z as b,
181
+ K as a,
182
+ $ as b,
183
183
  c,
184
- F as d,
185
- $ as e,
186
- k as f,
187
- O as g,
188
- Y as h,
184
+ k as d,
185
+ z as e,
186
+ B as f,
187
+ F as g,
188
+ O as h,
189
189
  V as t,
190
- K as u
190
+ Y as u
191
191
  };
192
- //# sourceMappingURL=Card-DSUIILAj.js.map
192
+ //# sourceMappingURL=Card-JFmpTzpz.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Card-DSUIILAj.js","sources":["../src/lib/utils.ts","../src/components/ui/Button.tsx","../src/hooks/useToast.ts","../src/api/ImaginariumApiContext.tsx","../src/components/ui/Card.tsx"],"sourcesContent":["import { clsx, type ClassValue } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn( ...inputs: ClassValue[] ) {\n return twMerge( clsx( inputs ) )\n}\n","import * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../../lib/utils'\n\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover-elevate active-elevate-2',\n {\n variants: {\n variant: {\n default: 'bg-primary text-primary-foreground border border-primary-border',\n destructive: 'bg-destructive text-destructive-foreground border border-destructive-border',\n outline: 'border [border-color:var(--button-outline)] shadow-xs active:shadow-none',\n secondary: 'border bg-secondary text-secondary-foreground border-secondary-border',\n ghost: 'border border-transparent',\n },\n size: {\n default: 'min-h-9 px-4 py-2',\n sm: 'min-h-8 rounded-md px-3 text-xs',\n lg: 'min-h-10 rounded-md px-8',\n icon: 'h-9 w-9',\n },\n },\n defaultVariants: { variant: 'default', size: 'default' },\n },\n)\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ( { className, variant, size, asChild = false, ...props }, ref ) => {\n const Comp = asChild ? Slot : 'button'\n return (\n <Comp\n className={cn( buttonVariants( { variant, size, className } ) )}\n ref={ref}\n {...props}\n />\n )\n },\n)\nButton.displayName = 'Button'\n\nexport { Button, buttonVariants }\n","import * as React from 'react'\n\nimport type { ToastActionElement, ToastProps } from '../components/ui/Toast'\n\nconst TOAST_LIMIT = 1\nconst TOAST_REMOVE_DELAY = 1_000_000\n\ntype ToasterToast = ToastProps & {\n id: string\n title?: React.ReactNode\n description?: React.ReactNode\n action?: ToastActionElement\n}\n\nconst actionTypes = {\n ADD_TOAST: 'ADD_TOAST',\n UPDATE_TOAST: 'UPDATE_TOAST',\n DISMISS_TOAST: 'DISMISS_TOAST',\n REMOVE_TOAST: 'REMOVE_TOAST',\n} as const\n\nlet count = 0\nfunction genId() {\n count = ( count + 1 ) % Number.MAX_SAFE_INTEGER\n return count.toString()\n}\n\ntype ActionType = typeof actionTypes\ntype Action =\n | { type: ActionType['ADD_TOAST']; toast: ToasterToast }\n | { type: ActionType['UPDATE_TOAST']; toast: Partial<ToasterToast> }\n | { type: ActionType['DISMISS_TOAST']; toastId?: ToasterToast['id'] }\n | { type: ActionType['REMOVE_TOAST']; toastId?: ToasterToast['id'] }\n\ninterface State {\n toasts: ToasterToast[]\n}\n\nconst toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()\n\nconst addToRemoveQueue = ( toastId: string ) => {\n if ( toastTimeouts.has( toastId ) ) { return }\n const timeout = setTimeout( () => {\n toastTimeouts.delete( toastId )\n dispatch( { type: 'REMOVE_TOAST', toastId } )\n }, TOAST_REMOVE_DELAY )\n toastTimeouts.set( toastId, timeout )\n}\n\nexport const reducer = ( state: State, action: Action ): State => {\n switch ( action.type ) {\n case 'ADD_TOAST':\n return {\n ...state,\n toasts: [ action.toast, ...state.toasts ].slice( 0, TOAST_LIMIT ),\n }\n case 'UPDATE_TOAST':\n return {\n ...state,\n toasts: state.toasts.map( t => ( t.id === action.toast.id ? { ...t, ...action.toast } : t ) ),\n }\n case 'DISMISS_TOAST': {\n const { toastId } = action\n if ( toastId ) {\n addToRemoveQueue( toastId )\n } else {\n state.toasts.forEach( t => addToRemoveQueue( t.id ) )\n }\n return {\n ...state,\n toasts: state.toasts.map( t =>\n t.id === toastId || toastId === undefined ? { ...t, open: false } : t,\n ),\n }\n }\n case 'REMOVE_TOAST':\n if ( action.toastId === undefined ) {\n return { ...state, toasts: [] }\n }\n return { ...state, toasts: state.toasts.filter( t => t.id !== action.toastId ) }\n }\n}\n\nconst listeners: Array<( state: State ) => void> = []\nlet memoryState: State = { toasts: [] }\n\nfunction dispatch( action: Action ) {\n memoryState = reducer( memoryState, action )\n listeners.forEach( l => l( memoryState ) )\n}\n\ntype Toast = Omit<ToasterToast, 'id'>\n\nfunction toast( { ...props }: Toast ) {\n const id = genId()\n const update = ( p: ToasterToast ) =>\n dispatch( { type: 'UPDATE_TOAST', toast: { ...p, id } } )\n const dismiss = () => dispatch( { type: 'DISMISS_TOAST', toastId: id } )\n\n dispatch( {\n type: 'ADD_TOAST',\n toast: {\n ...props,\n id,\n open: true,\n onOpenChange: ( open ) => {\n if ( !open ) { dismiss() }\n },\n },\n } )\n return { id, dismiss, update }\n}\n\nfunction useToast() {\n const [ state, setState ] = React.useState<State>( memoryState )\n React.useEffect( () => {\n listeners.push( setState )\n return () => {\n const index = listeners.indexOf( setState )\n if ( index > -1 ) { listeners.splice( index, 1 ) }\n }\n }, [ state ] )\n return {\n ...state,\n toast,\n dismiss: ( toastId?: string ) => dispatch( { type: 'DISMISS_TOAST', toastId } ),\n }\n}\n\nexport { useToast, toast }\n","import { createContext, useContext, useMemo, type ReactNode } from 'react'\n\nexport interface ImaginariumApiContextValue {\n apiBaseUrl: string\n fetchJson: <T = unknown>( path: string, init?: RequestInit ) => Promise<T>\n buildUrl: ( path: string ) => string\n}\n\nconst Context = createContext<ImaginariumApiContextValue | null>( null )\n\nexport interface ImaginariumApiProviderProps {\n apiBaseUrl?: string\n children: ReactNode\n}\n\nexport function ImaginariumApiProvider( { apiBaseUrl = '/api', children }: ImaginariumApiProviderProps ) {\n const value = useMemo<ImaginariumApiContextValue>( () => {\n const base = apiBaseUrl.replace( /\\/$/, '' )\n const buildUrl = ( path: string ) => `${base}${path.startsWith( '/' ) ? path : `/${path}`}`\n\n const fetchJson = async <T = unknown>( path: string, init?: RequestInit ): Promise<T> => {\n const headers = new Headers( init?.headers )\n if ( init?.body && !headers.has( 'Content-Type' ) ) {\n headers.set( 'Content-Type', 'application/json' )\n }\n const res = await fetch( buildUrl( path ), {\n credentials: 'include',\n ...init,\n headers,\n } )\n const isJson = res.headers.get( 'content-type' )?.includes( 'application/json' )\n const body = isJson && res.status !== 204 ? await res.json() : undefined\n if ( !res.ok ) {\n const msg = ( body as { error?: string; message?: string } | undefined )?.error\n || ( body as { message?: string } | undefined )?.message\n || res.statusText\n throw new Error( msg )\n }\n return body as T\n }\n\n return { apiBaseUrl: base, buildUrl, fetchJson }\n }, [ apiBaseUrl ] )\n\n return <Context.Provider value={value}>{children}</Context.Provider>\n}\n\nexport function useImaginariumApi() {\n const ctx = useContext( Context )\n if ( !ctx ) {\n throw new Error( 'useImaginariumApi must be used within an ImaginariumApiProvider' )\n }\n return ctx\n}\n","import * as React from 'react'\n\nimport { cn } from '../../lib/utils'\n\nconst Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ( { className, ...props }, ref ) => (\n <div\n ref={ref}\n className={cn(\n 'shadcn-card rounded-xl border bg-card border-card-border text-card-foreground shadow-sm',\n className,\n )}\n {...props}\n />\n ),\n)\nCard.displayName = 'Card'\n\nconst CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ( { className, ...props }, ref ) => (\n <div ref={ref} className={cn( 'flex flex-col space-y-1.5 p-6', className )} {...props} />\n ),\n)\nCardHeader.displayName = 'CardHeader'\n\nconst CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ( { className, ...props }, ref ) => (\n <div\n ref={ref}\n className={cn( 'text-2xl font-semibold leading-none tracking-tight', className )}\n {...props}\n />\n ),\n)\nCardTitle.displayName = 'CardTitle'\n\nconst CardDescription = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ( { className, ...props }, ref ) => (\n <div ref={ref} className={cn( 'text-sm text-muted-foreground', className )} {...props} />\n ),\n)\nCardDescription.displayName = 'CardDescription'\n\nconst CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ( { className, ...props }, ref ) => (\n <div ref={ref} className={cn( 'p-6 pt-0', className )} {...props} />\n ),\n)\nCardContent.displayName = 'CardContent'\n\nconst CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ( { className, ...props }, ref ) => (\n <div ref={ref} className={cn( 'flex items-center p-6 pt-0', className )} {...props} />\n ),\n)\nCardFooter.displayName = 'CardFooter'\n\nexport { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }\n"],"names":["cn","inputs","twMerge","clsx","buttonVariants","cva","Button","React","className","variant","size","asChild","props","ref","jsx","Slot","TOAST_LIMIT","TOAST_REMOVE_DELAY","count","genId","toastTimeouts","addToRemoveQueue","toastId","timeout","dispatch","reducer","state","action","t","listeners","memoryState","l","toast","id","update","p","dismiss","open","useToast","setState","index","Context","createContext","ImaginariumApiProvider","apiBaseUrl","children","value","useMemo","base","buildUrl","path","init","headers","res","body","_a","msg","useImaginariumApi","ctx","useContext","Card","CardHeader","CardTitle","CardDescription","CardContent","CardFooter"],"mappings":";;;;;;;AAGO,SAASA,KAAOC,GAAuB;AAC5C,SAAOC,EAASC,EAAMF,CAAO,CAAE;AACjC;ACCA,MAAMG,IAAiBC;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,aAAa;AAAA,QACb,SAAS;AAAA,QACT,WAAW;AAAA,QACX,OAAO;AAAA,MAAA;AAAA,MAET,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAM;AAAA,MAAA;AAAA,IACR;AAAA,IAEF,iBAAiB,EAAE,SAAS,WAAW,MAAM,UAAA;AAAA,EAAU;AAE3D,GAQMC,IAASC,EAAM;AAAA,EACnB,CAAE,EAAE,WAAAC,GAAW,SAAAC,GAAS,MAAAC,GAAM,SAAAC,IAAU,IAAO,GAAGC,EAAA,GAASC,MAGvD,gBAAAC;AAAA,IAFWH,IAAUI,IAAO;AAAA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,CAAU,GAAI,GAAGI,EAAA,CAAO;AAEtE;AACAoD,EAAY,cAAc;AAE1B,MAAMC,IAAa1D,EAAM;AAAA,EACvB,CAAE,EAAE,WAAAC,GAAW,GAAGI,EAAA,GAASC,MACzB,gBAAAC,EAAC,OAAA,EAAI,KAAAD,GAAU,WAAWb,EAAI,8BAA8BQ,CAAU,GAAI,GAAGI,EAAA,CAAO;AAExF;AACAqD,EAAW,cAAc;"}
1
+ {"version":3,"file":"Card-JFmpTzpz.js","sources":["../src/lib/utils.ts","../src/components/ui/Button.tsx","../src/hooks/useToast.ts","../src/api/ImaginariumApiContext.tsx","../src/components/ui/Card.tsx"],"sourcesContent":["import { clsx, type ClassValue } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn( ...inputs: ClassValue[] ) {\n return twMerge( clsx( inputs ) )\n}\n","import * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../../lib/utils'\n\nconst buttonVariants = cva(\n 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover-elevate active-elevate-2',\n {\n variants: {\n variant: {\n default: 'bg-primary text-primary-foreground border border-primary-border',\n destructive: 'bg-destructive text-destructive-foreground border border-destructive-border',\n outline: 'border [border-color:var(--button-outline)] shadow-xs active:shadow-none',\n secondary: 'border bg-secondary text-secondary-foreground border-secondary-border',\n ghost: 'border border-transparent',\n },\n size: {\n default: 'min-h-9 px-4 py-2',\n sm: 'min-h-8 rounded-md px-3 text-xs',\n lg: 'min-h-10 rounded-md px-8',\n icon: 'h-9 w-9',\n },\n },\n defaultVariants: { variant: 'default', size: 'default' },\n },\n)\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ( { className, variant, size, asChild = false, ...props }, ref ) => {\n const Comp = asChild ? Slot : 'button'\n return (\n <Comp\n className={cn( buttonVariants( { variant, size, className } ) )}\n ref={ref}\n {...props}\n />\n )\n },\n)\nButton.displayName = 'Button'\n\nexport { Button, buttonVariants }\n","import * as React from 'react'\n\nimport type { ToastActionElement, ToastProps } from '../components/ui/Toast'\n\nconst TOAST_LIMIT = 1\nconst TOAST_REMOVE_DELAY = 1_000_000\n\ntype ToasterToast = ToastProps & {\n id: string\n title?: React.ReactNode\n description?: React.ReactNode\n action?: ToastActionElement\n}\n\nconst actionTypes = {\n ADD_TOAST: 'ADD_TOAST',\n UPDATE_TOAST: 'UPDATE_TOAST',\n DISMISS_TOAST: 'DISMISS_TOAST',\n REMOVE_TOAST: 'REMOVE_TOAST',\n} as const\n\nlet count = 0\nfunction genId() {\n count = ( count + 1 ) % Number.MAX_SAFE_INTEGER\n return count.toString()\n}\n\ntype ActionType = typeof actionTypes\ntype Action =\n | { type: ActionType['ADD_TOAST']; toast: ToasterToast }\n | { type: ActionType['UPDATE_TOAST']; toast: Partial<ToasterToast> }\n | { type: ActionType['DISMISS_TOAST']; toastId?: ToasterToast['id'] }\n | { type: ActionType['REMOVE_TOAST']; toastId?: ToasterToast['id'] }\n\ninterface State {\n toasts: ToasterToast[]\n}\n\nconst toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()\n\nconst addToRemoveQueue = ( toastId: string ) => {\n if ( toastTimeouts.has( toastId ) ) { return }\n const timeout = setTimeout( () => {\n toastTimeouts.delete( toastId )\n dispatch( { type: 'REMOVE_TOAST', toastId } )\n }, TOAST_REMOVE_DELAY )\n toastTimeouts.set( toastId, timeout )\n}\n\nexport const reducer = ( state: State, action: Action ): State => {\n switch ( action.type ) {\n case 'ADD_TOAST':\n return {\n ...state,\n toasts: [ action.toast, ...state.toasts ].slice( 0, TOAST_LIMIT ),\n }\n case 'UPDATE_TOAST':\n return {\n ...state,\n toasts: state.toasts.map( t => ( t.id === action.toast.id ? { ...t, ...action.toast } : t ) ),\n }\n case 'DISMISS_TOAST': {\n const { toastId } = action\n if ( toastId ) {\n addToRemoveQueue( toastId )\n } else {\n state.toasts.forEach( t => addToRemoveQueue( t.id ) )\n }\n return {\n ...state,\n toasts: state.toasts.map( t =>\n t.id === toastId || toastId === undefined ? { ...t, open: false } : t,\n ),\n }\n }\n case 'REMOVE_TOAST':\n if ( action.toastId === undefined ) {\n return { ...state, toasts: [] }\n }\n return { ...state, toasts: state.toasts.filter( t => t.id !== action.toastId ) }\n }\n}\n\nconst listeners: Array<( state: State ) => void> = []\nlet memoryState: State = { toasts: [] }\n\nfunction dispatch( action: Action ) {\n memoryState = reducer( memoryState, action )\n listeners.forEach( l => l( memoryState ) )\n}\n\ntype Toast = Omit<ToasterToast, 'id'>\n\nfunction toast( { ...props }: Toast ) {\n const id = genId()\n const update = ( p: ToasterToast ) =>\n dispatch( { type: 'UPDATE_TOAST', toast: { ...p, id } } )\n const dismiss = () => dispatch( { type: 'DISMISS_TOAST', toastId: id } )\n\n dispatch( {\n type: 'ADD_TOAST',\n toast: {\n ...props,\n id,\n open: true,\n onOpenChange: ( open ) => {\n if ( !open ) { dismiss() }\n },\n },\n } )\n return { id, dismiss, update }\n}\n\nfunction useToast() {\n const [ state, setState ] = React.useState<State>( memoryState )\n React.useEffect( () => {\n listeners.push( setState )\n return () => {\n const index = listeners.indexOf( setState )\n if ( index > -1 ) { listeners.splice( index, 1 ) }\n }\n }, [ state ] )\n return {\n ...state,\n toast,\n dismiss: ( toastId?: string ) => dispatch( { type: 'DISMISS_TOAST', toastId } ),\n }\n}\n\nexport { useToast, toast }\n","import { createContext, useContext, useMemo, type ReactNode } from 'react'\n\nexport interface ImaginariumApiContextValue {\n apiBaseUrl: string\n fetchJson: <T = unknown>( path: string, init?: RequestInit ) => Promise<T>\n buildUrl: ( path: string ) => string\n}\n\nconst Context = createContext<ImaginariumApiContextValue | null>( null )\n\nexport interface ImaginariumApiProviderProps {\n apiBaseUrl?: string\n children: ReactNode\n}\n\nexport function ImaginariumApiProvider( { apiBaseUrl = '/api', children }: ImaginariumApiProviderProps ) {\n const value = useMemo<ImaginariumApiContextValue>( () => {\n const base = apiBaseUrl.replace( /\\/$/, '' )\n const buildUrl = ( path: string ) => `${base}${path.startsWith( '/' ) ? path : `/${path}`}`\n\n const fetchJson = async <T = unknown>( path: string, init?: RequestInit ): Promise<T> => {\n const headers = new Headers( init?.headers )\n if ( init?.body && !headers.has( 'Content-Type' ) ) {\n headers.set( 'Content-Type', 'application/json' )\n }\n const res = await fetch( buildUrl( path ), {\n credentials: 'include',\n ...init,\n headers,\n } )\n const isJson = res.headers.get( 'content-type' )?.includes( 'application/json' )\n const body = isJson && res.status !== 204 ? await res.json() : undefined\n if ( !res.ok ) {\n const msg = ( body as { error?: string; message?: string } | undefined )?.error\n || ( body as { message?: string } | undefined )?.message\n || res.statusText\n throw new Error( msg )\n }\n return body as T\n }\n\n return { apiBaseUrl: base, buildUrl, fetchJson }\n }, [ apiBaseUrl ] )\n\n return <Context.Provider value={value}>{children}</Context.Provider>\n}\n\nexport function useImaginariumApi() {\n const ctx = useContext( Context )\n if ( !ctx ) {\n throw new Error( 'useImaginariumApi must be used within an ImaginariumApiProvider' )\n }\n return ctx\n}\n","import * as React from 'react'\n\nimport { cn } from '../../lib/utils'\n\nconst Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ( { className, ...props }, ref ) => (\n <div\n ref={ref}\n className={cn(\n 'shadcn-card rounded-xl border bg-card border-card-border text-card-foreground shadow-sm',\n className,\n )}\n {...props}\n />\n ),\n)\nCard.displayName = 'Card'\n\nconst CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ( { className, ...props }, ref ) => (\n <div ref={ref} className={cn( 'flex flex-col space-y-1.5 p-6', className )} {...props} />\n ),\n)\nCardHeader.displayName = 'CardHeader'\n\nconst CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ( { className, ...props }, ref ) => (\n <div\n ref={ref}\n className={cn( 'text-2xl font-semibold leading-none tracking-tight', className )}\n {...props}\n />\n ),\n)\nCardTitle.displayName = 'CardTitle'\n\nconst CardDescription = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ( { className, ...props }, ref ) => (\n <div ref={ref} className={cn( 'text-sm text-muted-foreground', className )} {...props} />\n ),\n)\nCardDescription.displayName = 'CardDescription'\n\nconst CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ( { className, ...props }, ref ) => (\n <div ref={ref} className={cn( 'p-6 pt-0', className )} {...props} />\n ),\n)\nCardContent.displayName = 'CardContent'\n\nconst CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ( { className, ...props }, ref ) => (\n <div ref={ref} className={cn( 'flex items-center p-6 pt-0', className )} {...props} />\n ),\n)\nCardFooter.displayName = 'CardFooter'\n\nexport { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }\n"],"names":["cn","inputs","twMerge","clsx","buttonVariants","cva","Button","React","className","variant","size","asChild","props","ref","jsx","Slot","TOAST_LIMIT","TOAST_REMOVE_DELAY","count","genId","toastTimeouts","addToRemoveQueue","toastId","timeout","dispatch","reducer","state","action","t","listeners","memoryState","l","toast","id","update","p","dismiss","open","useToast","setState","index","Context","createContext","ImaginariumApiProvider","apiBaseUrl","children","value","useMemo","base","buildUrl","path","init","headers","res","body","_a","msg","useImaginariumApi","ctx","useContext","Card","CardHeader","CardTitle","CardDescription","CardContent","CardFooter"],"mappings":";;;;;;;AAGO,SAASA,KAAOC,GAAuB;AAC5C,SAAOC,EAASC,EAAMF,CAAO,CAAE;AACjC;ACCA,MAAMG,IAAiBC;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,S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AA,MAC9E,GAAGI;AAAA,IAAA;AAAA,EAAA;AAGV;AACAkD,EAAU,cAAc;AAExB,MAAMC,IAAkBxD,EAAM;AAAA,EAC5B,CAAE,EAAE,WAAAC,GAAW,GAAGI,EAAA,GAASC,MACzB,gBAAAC,EAAC,OAAA,EAAI,KAAAD,GAAU,WAAWb,EAAI,iCAAiCQ,CAAU,GAAI,GAAGI,EAAA,CAAO;AAE3F;AACAmD,EAAgB,cAAc;AAE9B,MAAMC,IAAczD,EAAM;AAAA,EACxB,CAAE,EAAE,WAAAC,GAAW,GAAGI,EAAA,GAASC,MACzB,gBAAAC,EAAC,OAAA,EAAI,KAAAD,GAAU,WAAWb,EAAI,YAAYQ,CAAU,GAAI,GAAGI,EAAA,CAAO;AAEtE;AACAoD,EAAY,cAAc;AAE1B,MAAMC,IAAa1D,EAAM;AAAA,EACvB,CAAE,EAAE,WAAAC,GAAW,GAAGI,EAAA,GAASC,MACzB,gBAAAC,EAAC,OAAA,EAAI,KAAAD,GAAU,WAAWb,EAAI,8BAA8BQ,CAAU,GAAI,GAAGI,EAAA,CAAO;AAExF;AACAqD,EAAW,cAAc;"}
@@ -4,7 +4,7 @@ import { isValidElement as k, createElement as x, useMemo as S } from "react";
4
4
  import { useQuery as B, QueryClient as z, QueryClientProvider as E } from "@tanstack/react-query";
5
5
  import { Config as m } from "@leverege/plugin";
6
6
  import * as v from "@radix-ui/react-tooltip";
7
- import { B as w, c as f, h as L, C as V, e as $, f as j, b as q, a as F, u as M, I as G } from "./Card-DSUIILAj.js";
7
+ import { B as w, c as f, u as L, C as V, b as $, d as j, e as q, f as F, a as M, I as G } from "./Card-JFmpTzpz.js";
8
8
  import * as i from "@radix-ui/react-toast";
9
9
  import { cva as D } from "class-variance-authority";
10
10
  import { X as H } from "lucide-react";
@@ -287,4 +287,4 @@ export {
287
287
  ae as j,
288
288
  Ce as k
289
289
  };
290
- //# sourceMappingURL=ImaginariumApp-B-8UzTbq.js.map
290
+ //# sourceMappingURL=ImaginariumApp-CwOYW6Jp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ImaginariumApp-B-8UzTbq.js","sources":["../src/shell/Shell.tsx","../src/shell/AppNav.tsx","../src/components/ui/Tooltip.tsx","../src/components/ui/Toast.tsx","../src/components/ui/Toaster.tsx","../src/auth/LoginPage.tsx","../src/auth/RequireAuth.tsx","../src/shell/ImaginariumApp.tsx"],"sourcesContent":["import { isValidElement, createElement, type ReactNode } from 'react'\nimport { Route, Switch } from 'wouter'\n\nimport { getPages } from '../plugins/registry'\nimport type { PagePlugin } from '../plugins/types'\n\nfunction renderPageElement( plugin: PagePlugin ): ReactNode {\n const { element } = plugin\n if ( isValidElement( element ) ) { return element }\n if ( typeof element === 'function' ) {\n return createElement( element as React.ComponentType )\n }\n return element as ReactNode\n}\n\nexport interface ShellProps {\n fallback?: ReactNode\n children?: ReactNode\n}\n\nexport function Shell( { fallback, children }: ShellProps ) {\n const pages = getPages()\n\n return (\n <main className=\"container mx-auto px-4 py-6\">\n {children}\n <Switch>\n {pages.map( ( page ) => (\n <Route key={page.path} path={page.path}>\n {renderPageElement( page )}\n </Route>\n ) )}\n <Route>{fallback ?? <div className=\"p-8 text-muted-foreground\">Not found</div>}</Route>\n </Switch>\n </main>\n )\n}\n","import type { ComponentType } from 'react'\nimport { Link, useLocation } from 'wouter'\n\nimport { Button } from '../components/ui/Button'\nimport { getNavItems, getTopBarItems } from '../plugins/registry'\n\n/**\n * Accepted icon forms (anywhere we render an inline icon):\n * - React component: `Settings` from lucide-react\n * - URL string: `/logo.png`, `https://...`, `data:image/...`, `blob:...`\n * - CSS class string: `fa-solid fa-gear`, `material-icons` (rendered on a <span>)\n */\nexport type IconRef = ComponentType<{ className?: string }> | string\n\nexport interface AppNavProps {\n title?: string\n titleIcon?: IconRef\n rightSlot?: React.ReactNode\n}\n\nconst URL_RE = /^(https?:|data:|blob:|\\/|\\.\\/|\\.\\.\\/)/\n\nfunction renderIcon( icon: IconRef | undefined, className: string ) {\n if ( !icon ) { return null }\n if ( typeof icon === 'string' ) {\n if ( URL_RE.test( icon ) ) {\n return <img src={icon} alt=\"\" className={className} />\n }\n return <span className={`${icon} ${className}`} aria-hidden=\"true\" />\n }\n const Icon = icon\n return <Icon className={className} />\n}\n\nexport function AppNav( { title = 'Imaginarium', titleIcon, rightSlot }: AppNavProps ) {\n const [ location ] = useLocation()\n const items = getNavItems()\n const topBarItems = getTopBarItems()\n const hasRight = rightSlot || topBarItems.length > 0\n\n return (\n <nav className=\"border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 sticky top-0 z-50\">\n <div className=\"container mx-auto flex h-14 items-center px-4\">\n <div className=\"mr-8 flex items-center gap-2 font-semibold text-lg\">\n {renderIcon( titleIcon, 'h-6 w-6' )}\n <span>{title}</span>\n </div>\n <div className=\"flex items-center gap-1\">\n {items.map( ( { label, path, icon: Icon } ) => {\n const isActive = location === path || location.startsWith( `${path}/` )\n return (\n <Link key={path} href={path}>\n <Button variant={isActive ? 'secondary' : 'ghost'} size=\"sm\" className=\"gap-2\">\n {Icon ? <Icon className=\"h-4 w-4\" /> : null}\n {label}\n </Button>\n </Link>\n )\n } )}\n </div>\n {hasRight ? (\n <div className=\"ml-auto flex items-center gap-2\">\n {rightSlot}\n {topBarItems.map( ( item ) => {\n const C = item.component\n return <C key={item.id} />\n } )}\n </div>\n ) : null}\n </div>\n </nav>\n )\n}\n","import * as React from 'react'\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\n\nimport { cn } from '../../lib/utils'\n\nconst TooltipProvider = TooltipPrimitive.Provider\nconst Tooltip = TooltipPrimitive.Root\nconst TooltipTrigger = TooltipPrimitive.Trigger\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>( ( { className, sideOffset = 4, ...props }, ref ) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',\n className,\n )}\n {...props}\n />\n) )\nTooltipContent.displayName = TooltipPrimitive.Content.displayName\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }\n","import * as React from 'react'\nimport * as ToastPrimitives from '@radix-ui/react-toast'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { X } from 'lucide-react'\n\nimport { cn } from '../../lib/utils'\n\nconst ToastProvider = ToastPrimitives.Provider\n\nconst ToastViewport = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Viewport>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>\n>( ( { className, ...props }, ref ) => (\n <ToastPrimitives.Viewport\n ref={ref}\n className={cn(\n 'fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]',\n className,\n )}\n {...props}\n />\n) )\nToastViewport.displayName = ToastPrimitives.Viewport.displayName\n\nconst toastVariants = cva(\n 'group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full',\n {\n variants: {\n variant: {\n default: 'border bg-background text-foreground',\n destructive: 'destructive group border-destructive bg-destructive text-destructive-foreground',\n },\n },\n defaultVariants: { variant: 'default' },\n },\n)\n\nconst Toast = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Root>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> & VariantProps<typeof toastVariants>\n>( ( { className, variant, ...props }, ref ) => (\n <ToastPrimitives.Root ref={ref} className={cn( toastVariants( { variant } ), className )} {...props} />\n) )\nToast.displayName = ToastPrimitives.Root.displayName\n\nconst ToastAction = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Action>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>\n>( ( { className, ...props }, ref ) => (\n <ToastPrimitives.Action\n ref={ref}\n className={cn(\n 'inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',\n className,\n )}\n {...props}\n />\n) )\nToastAction.displayName = ToastPrimitives.Action.displayName\n\nconst ToastClose = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Close>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>\n>( ( { className, ...props }, ref ) => (\n <ToastPrimitives.Close\n ref={ref}\n className={cn(\n 'absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100',\n className,\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"h-4 w-4\" />\n </ToastPrimitives.Close>\n) )\nToastClose.displayName = ToastPrimitives.Close.displayName\n\nconst ToastTitle = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Title>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>\n>( ( { className, ...props }, ref ) => (\n <ToastPrimitives.Title ref={ref} className={cn( 'text-sm font-semibold', className )} {...props} />\n) )\nToastTitle.displayName = ToastPrimitives.Title.displayName\n\nconst ToastDescription = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Description>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>\n>( ( { className, ...props }, ref ) => (\n <ToastPrimitives.Description ref={ref} className={cn( 'text-sm opacity-90', className )} {...props} />\n) )\nToastDescription.displayName = ToastPrimitives.Description.displayName\n\nexport type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>\nexport type ToastActionElement = React.ReactElement<typeof ToastAction>\n\nexport {\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction,\n}\n","import { useToast } from '../../hooks/useToast'\nimport {\n Toast,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport,\n} from './Toast'\n\nexport function Toaster() {\n const { toasts } = useToast()\n\n return (\n <ToastProvider>\n {toasts.map( ( { id, title, description, action, ...props } ) => (\n <Toast key={id} {...props}>\n <div className=\"grid gap-1\">\n {title && <ToastTitle>{title}</ToastTitle>}\n {description && <ToastDescription>{description}</ToastDescription>}\n </div>\n {action}\n <ToastClose />\n </Toast>\n ) )}\n <ToastViewport />\n </ToastProvider>\n )\n}\n","import { Button } from '../components/ui/Button'\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from '../components/ui/Card'\n\nexport interface LoginPageProps {\n loginPath: string\n title?: string\n subtitle?: string\n buttonLabel?: string\n /** URL of an image to show behind the sign-in card. Empty/null skips it. */\n backgroundUrl?: string\n /** Optional message shown above the button (e.g. an error from a failed prior attempt). */\n errorMessage?: string\n}\n\nfunction GoogleGlyph( { className }: { className?: string } ) {\n return (\n <svg viewBox=\"0 0 24 24\" className={className} aria-hidden=\"true\">\n <path fill=\"#4285F4\" d=\"M23.49 12.27c0-.79-.07-1.54-.19-2.27H12v4.51h6.16c-.27 1.4-1.04 2.59-2.21 3.41v2.77h3.59c2.08-1.92 3.95-4.74 3.95-8.42z\" />\n <path fill=\"#34A853\" d=\"M12 24c2.97 0 5.46-.98 7.28-2.66l-3.59-2.77c-.98.66-2.23 1.06-3.69 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 21.53 7.7 24 12 24z\" />\n <path fill=\"#FBBC05\" d=\"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z\" />\n <path fill=\"#EA4335\" d=\"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z\" />\n </svg>\n )\n}\n\nconst ERROR_MESSAGES: Record<string, string> = {\n auth_failed : 'Sign-in failed. Please try again.',\n}\n\nfunction readUrlError(): string | undefined {\n if ( typeof window === 'undefined' ) { \n return undefined \n }\n const code = new URLSearchParams( window.location.search ).get( 'error' )\n if ( !code ) { \n return undefined \n }\n return ERROR_MESSAGES[code] ?? `Sign-in error: ${code}`\n}\n\nexport function LoginPage( {\n loginPath,\n title = 'Sign in',\n subtitle,\n buttonLabel = 'Sign in with Google',\n backgroundUrl,\n errorMessage,\n}: LoginPageProps ) {\n const message = errorMessage ?? readUrlError()\n const hasBackground = Boolean( backgroundUrl )\n\n return (\n <div\n className=\"min-h-screen flex items-center justify-center bg-background bg-cover bg-center px-4\"\n style={hasBackground ? { backgroundImage: `url(${backgroundUrl})` } : undefined}\n >\n <Card className={`w-full max-w-md ${hasBackground ? 'backdrop-blur-sm bg-card/90' : ''}`}>\n <CardHeader className=\"text-center\">\n <CardTitle>{title}</CardTitle>\n {subtitle && <CardDescription>{subtitle}</CardDescription>}\n </CardHeader>\n <CardContent className=\"space-y-4\">\n {message && (\n <div className=\"rounded-md border border-destructive bg-destructive/10 px-4 py-2 text-sm text-destructive\">\n {message}\n </div>\n )}\n <Button\n className=\"w-full\"\n variant=\"outline\"\n onClick={() => { window.location.href = loginPath }}\n >\n <GoogleGlyph className=\"h-5 w-5 mr-2\" />\n {buttonLabel}\n </Button>\n </CardContent>\n </Card>\n </div>\n )\n}\n\nexport default LoginPage\n","import { createElement, type ComponentType, type ReactNode } from 'react'\nimport { useQuery } from '@tanstack/react-query'\nimport { Config } from '@leverege/plugin'\n\nimport { useImaginariumApi } from '../api/ImaginariumApiContext'\nimport { LoginPage, type LoginPageProps } from './LoginPage'\n\nexport interface RequireAuthProps {\n children: ReactNode\n}\n\n/**\n * Wraps `children` with an authentication gate. On mount, fetches\n * `Config.get('ImaginariumApp', 'userPath', '/auth/user')` from the configured\n * API base URL. While loading, renders a small placeholder. On error, renders\n * the configured login component (defaults to the bundled `LoginPage`). On\n * success, renders `children`.\n *\n * Recognized config keys (under `'ImaginariumApp'`):\n * - `userPath` endpoint to check (default `/auth/user`)\n * - `loginPath` URL the login button navigates to (default `/api/login`)\n * - `loginPage` component to render when unauthenticated\n * - `loginTitle` default page heading\n * - `loginSubtitle` default page subtitle\n * - `loginButtonLabel` default button label\n * - `loginBackgroundUrl` URL of an image to show behind the sign-in card\n */\nexport function RequireAuth( { children }: RequireAuthProps ) {\n const { fetchJson } = useImaginariumApi()\n const userPath = Config.get<string>( 'ImaginariumApp', 'userPath', '/auth/user' )\n\n const { isPending, isError } = useQuery( {\n queryKey: [ 'imaginarium', 'auth', 'user', userPath ],\n queryFn: () => fetchJson( userPath ),\n retry: false,\n refetchOnWindowFocus: false,\n } )\n\n if ( isPending ) {\n return <div className=\"p-8 text-muted-foreground\">Checking sign-in…</div>\n }\n\n if ( isError ) {\n const LoginComponent = Config.get<ComponentType<LoginPageProps>>(\n 'ImaginariumApp', 'loginPage', LoginPage,\n )\n const title = Config.get<string | undefined>( 'ImaginariumApp', 'loginTitle', undefined )\n const subtitle = Config.get<string | undefined>( 'ImaginariumApp', 'loginSubtitle', undefined )\n const buttonLabel = Config.get<string | undefined>(\n 'ImaginariumApp', 'loginButtonLabel', undefined,\n )\n const loginPath = Config.get<string>( 'ImaginariumApp', 'loginPath', '/api/login' )\n const backgroundUrl = Config.get<string | undefined>(\n 'ImaginariumApp', 'loginBackgroundUrl', undefined,\n )\n\n const appTitle = Config.get<string>( 'ImaginariumApp', 'title', 'Imaginarium' )\n const resolvedTitle = title ?? `Sign in to ${appTitle}`\n\n return createElement( LoginComponent, {\n loginPath,\n title: resolvedTitle,\n subtitle,\n buttonLabel,\n backgroundUrl,\n } )\n }\n\n return <>{children}</>\n}\n\nexport default RequireAuth\n","import { useMemo, type ReactNode } from 'react'\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { Config } from '@leverege/plugin'\n\nimport { TooltipProvider } from '../components/ui/Tooltip'\nimport { Toaster } from '../components/ui/Toaster'\nimport { ImaginariumApiProvider } from '../api/ImaginariumApiContext'\nimport { RequireAuth } from '../auth/RequireAuth'\nimport { getProviders } from '../plugins/registry'\nimport { AppNav, type AppNavProps, type IconRef } from './AppNav'\nimport { Shell, type ShellProps } from './Shell'\n\nfunction withProviders( tree: ReactNode ): ReactNode {\n const providers = getProviders()\n let wrapped = tree\n for ( const { component: Provider } of providers ) {\n wrapped = <Provider>{wrapped}</Provider>\n }\n return wrapped\n}\n\nexport interface ImaginariumAppProps {\n apiBaseUrl?: string\n queryClient?: QueryClient\n title?: string\n titleIcon?: IconRef\n navRightSlot?: AppNavProps['rightSlot']\n shellFallback?: ShellProps['fallback']\n children?: ReactNode\n}\n\nconst defaultQueryClient = new QueryClient( {\n defaultOptions: {\n queries: { retry: false, refetchOnWindowFocus: false },\n },\n} )\n\nfunction GatedShell( { title, titleIcon, navRightSlot, shellFallback, children }: {\n title?: string\n titleIcon?: IconRef\n navRightSlot?: AppNavProps['rightSlot']\n shellFallback?: ShellProps['fallback']\n children?: ReactNode\n} ) {\n return withProviders(\n <div className=\"min-h-screen bg-background text-foreground\">\n <AppNav title={title} titleIcon={titleIcon} rightSlot={navRightSlot} />\n <Shell fallback={shellFallback}>{children}</Shell>\n </div>,\n )\n}\n\nexport function ImaginariumApp( {\n apiBaseUrl = '/api',\n queryClient,\n title,\n titleIcon,\n navRightSlot,\n shellFallback,\n children,\n}: ImaginariumAppProps ) {\n const qc = useMemo( () => queryClient ?? defaultQueryClient, [ queryClient ] )\n const requireAuth = Config.get<boolean>( 'ImaginariumApp', 'requireAuth', true )\n const resolvedTitleIcon = titleIcon\n ?? Config.get<IconRef | undefined>( 'ImaginariumApp', 'titleIcon', undefined )\n\n const gated = (\n <GatedShell\n title={title}\n titleIcon={resolvedTitleIcon}\n navRightSlot={navRightSlot}\n shellFallback={shellFallback}\n >\n {children}\n </GatedShell>\n )\n\n return (\n <QueryClientProvider client={qc}>\n <TooltipProvider>\n <ImaginariumApiProvider apiBaseUrl={apiBaseUrl}>\n {requireAuth ? <RequireAuth>{gated}</RequireAuth> : gated}\n <Toaster />\n </ImaginariumApiProvider>\n </TooltipProvider>\n </QueryClientProvider>\n )\n}\n"],"names":["renderPageElement","plugin","element","isValidElement","createElement","Shell","fallback","children","pages","getPages","jsxs","Switch","page","jsx","Route","URL_RE","renderIcon","icon","className","AppNav","title","titleIcon","rightSlot","location","useLocation","items","getNavItems","topBarItems","getTopBarItems","hasRight","label","path","Icon","isActive","Link","Button","item","C","TooltipProvider","TooltipPrimitive","Tooltip","TooltipTrigger","TooltipContent","React","sideOffset","props","ref","cn","ToastProvider","ToastPrimitives","ToastViewport","toastVariants","cva","Toast","variant","ToastAction","ToastClose","X","ToastTitle","ToastDescription","Toaster","toasts","useToast","id","description","action","GoogleGlyph","ERROR_MESSAGES","readUrlError","code","LoginPage","loginPath","subtitle","buttonLabel","backgroundUrl","errorMessage","message","hasBackground","Card","CardHeader","CardTitle","CardDescription","CardContent","RequireAuth","fetchJson","useImaginariumApi","userPath","Config","isPending","isError","useQuery","LoginComponent","appTitle","resolvedTitle","withProviders","tree","providers","getProviders","wrapped","Provider","defaultQueryClient","QueryClient","GatedShell","navRightSlot","shellFallback","ImaginariumApp","apiBaseUrl","queryClient","qc","useMemo","requireAuth","resolvedTitleIcon","gated","QueryClientProvider","ImaginariumApiProvider"],"mappings":";;;;;;;;;;;;AAMA,SAASA,EAAmBC,GAAgC;AAC1D,QAAM,EAAE,SAAAC,M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AAS,MAAMF,KAAeP,IAAoB,CAAEO,CAAY,CAAE,GACvEG,IAAcvB,EAAO,IAAc,kBAAkB,eAAe,EAAK,GACzEwB,IAAoB1F,KACrBkE,EAAO,IAA0B,kBAAkB,aAAa,MAAU,GAEzEyB,IACJ,gBAAAnG;AAAA,IAACyF;AAAA,IAAA;AAAA,MACC,OAAAlF;AAAA,MACA,WAAW2F;AAAA,MACX,cAAAR;AAAA,MACA,eAAAC;AAAA,MAEC,UAAAjG;AAAA,IAAA;AAAA,EAAA;AAIL,SACE,gBAAAM,EAACoG,KAAoB,QAAQL,GAC3B,4BAACtE,IAAA,EACC,UAAA,gBAAA5B,EAACwG,KAAuB,YAAAR,GACrB,UAAA;AAAA,IAAAI,IAAc,gBAAAjG,EAACsE,IAAA,EAAa,UAAA6B,EAAA,CAAM,IAAiBA;AAAA,sBACnDpD,IAAA,CAAA,CAAQ;AAAA,EAAA,EAAA,CACX,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"ImaginariumApp-CwOYW6Jp.js","sources":["../src/shell/Shell.tsx","../src/shell/AppNav.tsx","../src/components/ui/Tooltip.tsx","../src/components/ui/Toast.tsx","../src/components/ui/Toaster.tsx","../src/auth/LoginPage.tsx","../src/auth/RequireAuth.tsx","../src/shell/ImaginariumApp.tsx"],"sourcesContent":["import { isValidElement, createElement, type ReactNode } from 'react'\nimport { Route, Switch } from 'wouter'\n\nimport { getPages } from '../plugins/registry'\nimport type { PagePlugin } from '../plugins/types'\n\nfunction renderPageElement( plugin: PagePlugin ): ReactNode {\n const { element } = plugin\n if ( isValidElement( element ) ) { return element }\n if ( typeof element === 'function' ) {\n return createElement( element as React.ComponentType )\n }\n return element as ReactNode\n}\n\nexport interface ShellProps {\n fallback?: ReactNode\n children?: ReactNode\n}\n\nexport function Shell( { fallback, children }: ShellProps ) {\n const pages = getPages()\n\n return (\n <main className=\"container mx-auto px-4 py-6\">\n {children}\n <Switch>\n {pages.map( ( page ) => (\n <Route key={page.path} path={page.path}>\n {renderPageElement( page )}\n </Route>\n ) )}\n <Route>{fallback ?? <div className=\"p-8 text-muted-foreground\">Not found</div>}</Route>\n </Switch>\n </main>\n )\n}\n","import type { ComponentType } from 'react'\nimport { Link, useLocation } from 'wouter'\n\nimport { Button } from '../components/ui/Button'\nimport { getNavItems, getTopBarItems } from '../plugins/registry'\n\n/**\n * Accepted icon forms (anywhere we render an inline icon):\n * - React component: `Settings` from lucide-react\n * - URL string: `/logo.png`, `https://...`, `data:image/...`, `blob:...`\n * - CSS class string: `fa-solid fa-gear`, `material-icons` (rendered on a <span>)\n */\nexport type IconRef = ComponentType<{ className?: string }> | string\n\nexport interface AppNavProps {\n title?: string\n titleIcon?: IconRef\n rightSlot?: React.ReactNode\n}\n\nconst URL_RE = /^(https?:|data:|blob:|\\/|\\.\\/|\\.\\.\\/)/\n\nfunction renderIcon( icon: IconRef | undefined, className: string ) {\n if ( !icon ) { return null }\n if ( typeof icon === 'string' ) {\n if ( URL_RE.test( icon ) ) {\n return <img src={icon} alt=\"\" className={className} />\n }\n return <span className={`${icon} ${className}`} aria-hidden=\"true\" />\n }\n const Icon = icon\n return <Icon className={className} />\n}\n\nexport function AppNav( { title = 'Imaginarium', titleIcon, rightSlot }: AppNavProps ) {\n const [ location ] = useLocation()\n const items = getNavItems()\n const topBarItems = getTopBarItems()\n const hasRight = rightSlot || topBarItems.length > 0\n\n return (\n <nav className=\"border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60 sticky top-0 z-50\">\n <div className=\"container mx-auto flex h-14 items-center px-4\">\n <div className=\"mr-8 flex items-center gap-2 font-semibold text-lg\">\n {renderIcon( titleIcon, 'h-6 w-6' )}\n <span>{title}</span>\n </div>\n <div className=\"flex items-center gap-1\">\n {items.map( ( { label, path, icon: Icon } ) => {\n const isActive = location === path || location.startsWith( `${path}/` )\n return (\n <Link key={path} href={path}>\n <Button variant={isActive ? 'secondary' : 'ghost'} size=\"sm\" className=\"gap-2\">\n {Icon ? <Icon className=\"h-4 w-4\" /> : null}\n {label}\n </Button>\n </Link>\n )\n } )}\n </div>\n {hasRight ? (\n <div className=\"ml-auto flex items-center gap-2\">\n {rightSlot}\n {topBarItems.map( ( item ) => {\n const C = item.component\n return <C key={item.id} />\n } )}\n </div>\n ) : null}\n </div>\n </nav>\n )\n}\n","import * as React from 'react'\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\n\nimport { cn } from '../../lib/utils'\n\nconst TooltipProvider = TooltipPrimitive.Provider\nconst Tooltip = TooltipPrimitive.Root\nconst TooltipTrigger = TooltipPrimitive.Trigger\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>( ( { className, sideOffset = 4, ...props }, ref ) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95',\n className,\n )}\n {...props}\n />\n) )\nTooltipContent.displayName = TooltipPrimitive.Content.displayName\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }\n","import * as React from 'react'\nimport * as ToastPrimitives from '@radix-ui/react-toast'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { X } from 'lucide-react'\n\nimport { cn } from '../../lib/utils'\n\nconst ToastProvider = ToastPrimitives.Provider\n\nconst ToastViewport = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Viewport>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>\n>( ( { className, ...props }, ref ) => (\n <ToastPrimitives.Viewport\n ref={ref}\n className={cn(\n 'fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]',\n className,\n )}\n {...props}\n />\n) )\nToastViewport.displayName = ToastPrimitives.Viewport.displayName\n\nconst toastVariants = cva(\n 'group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full',\n {\n variants: {\n variant: {\n default: 'border bg-background text-foreground',\n destructive: 'destructive group border-destructive bg-destructive text-destructive-foreground',\n },\n },\n defaultVariants: { variant: 'default' },\n },\n)\n\nconst Toast = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Root>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> & VariantProps<typeof toastVariants>\n>( ( { className, variant, ...props }, ref ) => (\n <ToastPrimitives.Root ref={ref} className={cn( toastVariants( { variant } ), className )} {...props} />\n) )\nToast.displayName = ToastPrimitives.Root.displayName\n\nconst ToastAction = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Action>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>\n>( ( { className, ...props }, ref ) => (\n <ToastPrimitives.Action\n ref={ref}\n className={cn(\n 'inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',\n className,\n )}\n {...props}\n />\n) )\nToastAction.displayName = ToastPrimitives.Action.displayName\n\nconst ToastClose = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Close>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>\n>( ( { className, ...props }, ref ) => (\n <ToastPrimitives.Close\n ref={ref}\n className={cn(\n 'absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100',\n className,\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"h-4 w-4\" />\n </ToastPrimitives.Close>\n) )\nToastClose.displayName = ToastPrimitives.Close.displayName\n\nconst ToastTitle = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Title>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>\n>( ( { className, ...props }, ref ) => (\n <ToastPrimitives.Title ref={ref} className={cn( 'text-sm font-semibold', className )} {...props} />\n) )\nToastTitle.displayName = ToastPrimitives.Title.displayName\n\nconst ToastDescription = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Description>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>\n>( ( { className, ...props }, ref ) => (\n <ToastPrimitives.Description ref={ref} className={cn( 'text-sm opacity-90', className )} {...props} />\n) )\nToastDescription.displayName = ToastPrimitives.Description.displayName\n\nexport type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>\nexport type ToastActionElement = React.ReactElement<typeof ToastAction>\n\nexport {\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction,\n}\n","import { useToast } from '../../hooks/useToast'\nimport {\n Toast,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport,\n} from './Toast'\n\nexport function Toaster() {\n const { toasts } = useToast()\n\n return (\n <ToastProvider>\n {toasts.map( ( { id, title, description, action, ...props } ) => (\n <Toast key={id} {...props}>\n <div className=\"grid gap-1\">\n {title && <ToastTitle>{title}</ToastTitle>}\n {description && <ToastDescription>{description}</ToastDescription>}\n </div>\n {action}\n <ToastClose />\n </Toast>\n ) )}\n <ToastViewport />\n </ToastProvider>\n )\n}\n","import { Button } from '../components/ui/Button'\nimport {\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from '../components/ui/Card'\n\nexport interface LoginPageProps {\n loginPath: string\n title?: string\n subtitle?: string\n buttonLabel?: string\n /** URL of an image to show behind the sign-in card. Empty/null skips it. */\n backgroundUrl?: string\n /** Optional message shown above the button (e.g. an error from a failed prior attempt). */\n errorMessage?: string\n}\n\nfunction GoogleGlyph( { className }: { className?: string } ) {\n return (\n <svg viewBox=\"0 0 24 24\" className={className} aria-hidden=\"true\">\n <path fill=\"#4285F4\" d=\"M23.49 12.27c0-.79-.07-1.54-.19-2.27H12v4.51h6.16c-.27 1.4-1.04 2.59-2.21 3.41v2.77h3.59c2.08-1.92 3.95-4.74 3.95-8.42z\" />\n <path fill=\"#34A853\" d=\"M12 24c2.97 0 5.46-.98 7.28-2.66l-3.59-2.77c-.98.66-2.23 1.06-3.69 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 21.53 7.7 24 12 24z\" />\n <path fill=\"#FBBC05\" d=\"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z\" />\n <path fill=\"#EA4335\" d=\"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z\" />\n </svg>\n )\n}\n\nconst ERROR_MESSAGES: Record<string, string> = {\n auth_failed : 'Sign-in failed. Please try again.',\n}\n\nfunction readUrlError(): string | undefined {\n if ( typeof window === 'undefined' ) { \n return undefined \n }\n const code = new URLSearchParams( window.location.search ).get( 'error' )\n if ( !code ) { \n return undefined \n }\n return ERROR_MESSAGES[code] ?? `Sign-in error: ${code}`\n}\n\nexport function LoginPage( {\n loginPath,\n title = 'Sign in',\n subtitle,\n buttonLabel = 'Sign in with Google',\n backgroundUrl,\n errorMessage,\n}: LoginPageProps ) {\n const message = errorMessage ?? readUrlError()\n const hasBackground = Boolean( backgroundUrl )\n\n return (\n <div\n className=\"min-h-screen flex items-center justify-center bg-background bg-cover bg-center px-4\"\n style={hasBackground ? { backgroundImage: `url(${backgroundUrl})` } : undefined}\n >\n <Card className={`w-full max-w-md ${hasBackground ? 'backdrop-blur-sm bg-card/90' : ''}`}>\n <CardHeader className=\"text-center\">\n <CardTitle>{title}</CardTitle>\n {subtitle && <CardDescription>{subtitle}</CardDescription>}\n </CardHeader>\n <CardContent className=\"space-y-4\">\n {message && (\n <div className=\"rounded-md border border-destructive bg-destructive/10 px-4 py-2 text-sm text-destructive\">\n {message}\n </div>\n )}\n <Button\n className=\"w-full\"\n variant=\"outline\"\n onClick={() => { window.location.href = loginPath }}\n >\n <GoogleGlyph className=\"h-5 w-5 mr-2\" />\n {buttonLabel}\n </Button>\n </CardContent>\n </Card>\n </div>\n )\n}\n\nexport default LoginPage\n","import { createElement, type ComponentType, type ReactNode } from 'react'\nimport { useQuery } from '@tanstack/react-query'\nimport { Config } from '@leverege/plugin'\n\nimport { useImaginariumApi } from '../api/ImaginariumApiContext'\nimport { LoginPage, type LoginPageProps } from './LoginPage'\n\nexport interface RequireAuthProps {\n children: ReactNode\n}\n\n/**\n * Wraps `children` with an authentication gate. On mount, fetches\n * `Config.get('ImaginariumApp', 'userPath', '/auth/user')` from the configured\n * API base URL. While loading, renders a small placeholder. On error, renders\n * the configured login component (defaults to the bundled `LoginPage`). On\n * success, renders `children`.\n *\n * Recognized config keys (under `'ImaginariumApp'`):\n * - `userPath` endpoint to check (default `/auth/user`)\n * - `loginPath` URL the login button navigates to (default `/api/login`)\n * - `loginPage` component to render when unauthenticated\n * - `loginTitle` default page heading\n * - `loginSubtitle` default page subtitle\n * - `loginButtonLabel` default button label\n * - `loginBackgroundUrl` URL of an image to show behind the sign-in card\n */\nexport function RequireAuth( { children }: RequireAuthProps ) {\n const { fetchJson } = useImaginariumApi()\n const userPath = Config.get<string>( 'ImaginariumApp', 'userPath', '/auth/user' )\n\n const { isPending, isError } = useQuery( {\n queryKey: [ 'imaginarium', 'auth', 'user', userPath ],\n queryFn: () => fetchJson( userPath ),\n retry: false,\n refetchOnWindowFocus: false,\n } )\n\n if ( isPending ) {\n return <div className=\"p-8 text-muted-foreground\">Checking sign-in…</div>\n }\n\n if ( isError ) {\n const LoginComponent = Config.get<ComponentType<LoginPageProps>>(\n 'ImaginariumApp', 'loginPage', LoginPage,\n )\n const title = Config.get<string | undefined>( 'ImaginariumApp', 'loginTitle', undefined )\n const subtitle = Config.get<string | undefined>( 'ImaginariumApp', 'loginSubtitle', undefined )\n const buttonLabel = Config.get<string | undefined>(\n 'ImaginariumApp', 'loginButtonLabel', undefined,\n )\n const loginPath = Config.get<string>( 'ImaginariumApp', 'loginPath', '/api/login' )\n const backgroundUrl = Config.get<string | undefined>(\n 'ImaginariumApp', 'loginBackgroundUrl', undefined,\n )\n\n const appTitle = Config.get<string>( 'ImaginariumApp', 'title', 'Imaginarium' )\n const resolvedTitle = title ?? `Sign in to ${appTitle}`\n\n return createElement( LoginComponent, {\n loginPath,\n title: resolvedTitle,\n subtitle,\n buttonLabel,\n backgroundUrl,\n } )\n }\n\n return <>{children}</>\n}\n\nexport default RequireAuth\n","import { useMemo, type ReactNode } from 'react'\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { Config } from '@leverege/plugin'\n\nimport { TooltipProvider } from '../components/ui/Tooltip'\nimport { Toaster } from '../components/ui/Toaster'\nimport { ImaginariumApiProvider } from '../api/ImaginariumApiContext'\nimport { RequireAuth } from '../auth/RequireAuth'\nimport { getProviders } from '../plugins/registry'\nimport { AppNav, type AppNavProps, type IconRef } from './AppNav'\nimport { Shell, type ShellProps } from './Shell'\n\nfunction withProviders( tree: ReactNode ): ReactNode {\n const providers = getProviders()\n let wrapped = tree\n for ( const { component: Provider } of providers ) {\n wrapped = <Provider>{wrapped}</Provider>\n }\n return wrapped\n}\n\nexport interface ImaginariumAppProps {\n apiBaseUrl?: string\n queryClient?: QueryClient\n title?: string\n titleIcon?: IconRef\n navRightSlot?: AppNavProps['rightSlot']\n shellFallback?: ShellProps['fallback']\n children?: ReactNode\n}\n\nconst defaultQueryClient = new QueryClient( {\n defaultOptions: {\n queries: { retry: false, refetchOnWindowFocus: false },\n },\n} )\n\nfunction GatedShell( { title, titleIcon, navRightSlot, shellFallback, children }: {\n title?: string\n titleIcon?: IconRef\n navRightSlot?: AppNavProps['rightSlot']\n shellFallback?: ShellProps['fallback']\n children?: ReactNode\n} ) {\n return withProviders(\n <div className=\"min-h-screen bg-background text-foreground\">\n <AppNav title={title} titleIcon={titleIcon} rightSlot={navRightSlot} />\n <Shell fallback={shellFallback}>{children}</Shell>\n </div>,\n )\n}\n\nexport function ImaginariumApp( {\n apiBaseUrl = '/api',\n queryClient,\n title,\n titleIcon,\n navRightSlot,\n shellFallback,\n children,\n}: ImaginariumAppProps ) {\n const qc = useMemo( () => queryClient ?? defaultQueryClient, [ queryClient ] )\n const requireAuth = Config.get<boolean>( 'ImaginariumApp', 'requireAuth', true )\n const resolvedTitleIcon = titleIcon\n ?? Config.get<IconRef | undefined>( 'ImaginariumApp', 'titleIcon', undefined )\n\n const gated = (\n <GatedShell\n title={title}\n titleIcon={resolvedTitleIcon}\n navRightSlot={navRightSlot}\n shellFallback={shellFallback}\n >\n {children}\n </GatedShell>\n )\n\n return (\n <QueryClientProvider client={qc}>\n <TooltipProvider>\n <ImaginariumApiProvider apiBaseUrl={apiBaseUrl}>\n {requireAuth ? <RequireAuth>{gated}</RequireAuth> : gated}\n <Toaster />\n </ImaginariumApiProvider>\n </TooltipProvider>\n </QueryClientProvider>\n )\n}\n"],"names":["renderPageElement","plugin","element","isValidElement","createElement","Shell","fallback","children","pages","getPages","jsxs","Switch","page","jsx","Route","URL_RE","renderIcon","icon","className","AppNav","title","titleIcon","rightSlot","location","useLocation","items","getNavItems","topBarItems","getTopBarItems","hasRight","label","path","Icon","isActive","Link","Button","item","C","TooltipProvider","TooltipPrimitive","Tooltip","TooltipTrigger","TooltipContent","React","sideOffset","props","ref","cn","ToastProvider","ToastPrimitives","ToastViewport","toastVariants","cva","Toast","variant","ToastAction","ToastClose","X","ToastTitle","ToastDescription","Toaster","toasts","useToast","id","description","action","GoogleGlyph","ERROR_MESSAGES","readUrlError","code","LoginPage","loginPath","subtitle","buttonLabel","backgroundUrl","errorMessage","message","hasBackground","Card","CardHeader","CardTitle","CardDescription","CardContent","RequireAuth","fetchJson","useImaginariumApi","userPath","Config","isPending","isError","useQuery","LoginComponent","appTitle","resolvedTitle","withProviders","tree","providers","getProviders","wrapped","Provider","defaultQueryClient","QueryClient","GatedShell","navRightSlot","shellFallback","ImaginariumApp","apiBaseUrl","queryClient","qc","useMemo","requireAuth","resolvedTitleIcon","gated","QueryClientProvider","ImaginariumApiProvider"],"mappings":";;;;;;;;;;;;AAMA,SAASA,EAAmBC,GAAgC;AAC1D,QAAM,EAAE,SAAAC,MAAYD;AACpB,SAAKE,EAAgBD,CAAQ,IAAaA,IACrC,OAAOA,KAAY,aACfE,EAAeF,CAA+B,IAEhDA;AACT;AAOO,SAASG,EAAO,EAAE,UAAAC,GAAU,UAAAC,KAAyB;AAC1D,QAAMC,IAAQC,EAAA;AAEd,SACE,gBAAAC,EAAC,QAAA,EAAK,WAAU,+BACb,UAAA;AAAA,IAAAH;AAAA,sBACAI,GAAA,EACE,UAAA;AAAA,MAAAH,EAAM,IAAK,CAAEI,MACZ,gBAAAC,EAACC,GAAA,EAAsB,MAAMF,EAAK,MAC/B,UAAAZ,EAAmBY,CAAK,EAAA,GADfA,EAAK,IAEjB,CACA;AAAA,MACF,gBAAAC,EAACC,KAAO,UAAAR,KAAY,gBAAAO,EAAC,SAAI,WAAU,6BAA4B,uBAAS,EAAA,CAAO;AAAA,IAAA,EAAA,CACjF;AAAA,EAAA,GACF;AAEJ;AChBA,MAAME,IAAS;AAEf,SAASC,GAAYC,GAA2BC,GAAoB;AAClE,SAAMD,IACD,OAAOA,KAAS,WACdF,EAAO,KAAME,CAAK,sBAC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og"),j=require("lucide-react"),i=require("./Card-Z-6q-k3a.cjs"),v=require("@radix-ui/react-label"),w=require("class-variance-authority");function r(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const l=r(D),s=r(N),d=r(v),R=s.Root,h=s.Trigger,g=s.Portal,C=s.Close,c=l.forwardRef(({className:e,...a},t)=>o.jsx(s.Overlay,{ref:t,className:i.cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...a}));c.displayName=s.Overlay.displayName;const f=l.forwardRef(({className:e,children:a,...t},n)=>o.jsxs(g,{children:[o.jsx(c,{}),o.jsxs(s.Content,{ref:n,className:i.cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",e),...t,children:[a,o.jsxs(s.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[o.jsx(j.X,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));f.displayName=s.Content.displayName;const u=({className:e,...a})=>o.jsx("div",{className:i.cn("flex flex-col space-y-1.5 text-center sm:text-left",e),...a});u.displayName="DialogHeader";const m=({className:e,...a})=>o.jsx("div",{className:i.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...a});m.displayName="DialogFooter";const p=l.forwardRef(({className:e,...a},t)=>o.jsx(s.Title,{ref:t,className:i.cn("text-lg font-semibold leading-none tracking-tight",e),...a}));p.displayName=s.Title.displayName;const x=l.forwardRef(({className:e,...a},t)=>o.jsx(s.Description,{ref:t,className:i.cn("text-sm text-muted-foreground",e),...a}));x.displayName=s.Description.displayName;const b=l.forwardRef(({className:e,type:a,...t},n)=>o.jsx("input",{type:a,className:i.cn("flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));b.displayName="Input";const O=w.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),y=l.forwardRef(({className:e,...a},t)=>o.jsx(d.Root,{ref:t,className:i.cn(O(),e),...a}));y.displayName=d.Root.displayName;exports.Dialog=R;exports.DialogClose=C;exports.DialogContent=f;exports.DialogDescription=x;exports.DialogFooter=m;exports.DialogHeader=u;exports.DialogOverlay=c;exports.DialogPortal=g;exports.DialogTitle=p;exports.DialogTrigger=h;exports.Input=b;exports.Label=y;
2
+ //# sourceMappingURL=Label-BgvLHORr.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Label-BgvLHORr.cjs","sources":["../src/components/ui/Dialog.tsx","../src/components/ui/Input.tsx","../src/components/ui/Label.tsx"],"sourcesContent":["import * as React from 'react'\nimport * as DialogPrimitive from '@radix-ui/react-dialog'\nimport { X } from 'lucide-react'\n\nimport { cn } from '../../lib/utils'\n\nconst Dialog = DialogPrimitive.Root\nconst DialogTrigger = DialogPrimitive.Trigger\nconst DialogPortal = DialogPrimitive.Portal\nconst DialogClose = DialogPrimitive.Close\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>( ( { className, ...props }, ref ) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n className,\n )}\n {...props}\n />\n) )\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>( ( { className, children, ...props }, ref ) => (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg',\n className,\n )}\n {...props}\n >\n {children}\n <DialogPrimitive.Close className=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground\">\n <X className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n </DialogPrimitive.Content>\n </DialogPortal>\n) )\nDialogContent.displayName = DialogPrimitive.Content.displayName\n\nconst DialogHeader = ( { className, ...props }: React.HTMLAttributes<HTMLDivElement> ) => (\n <div\n className={cn( 'flex flex-col space-y-1.5 text-center sm:text-left', className )}\n {...props}\n />\n)\nDialogHeader.displayName = 'DialogHeader'\n\nconst DialogFooter = ( { className, ...props }: React.HTMLAttributes<HTMLDivElement> ) => (\n <div\n className={cn(\n 'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',\n className,\n )}\n {...props}\n />\n)\nDialogFooter.displayName = 'DialogFooter'\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>( ( { className, ...props }, ref ) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn( 'text-lg font-semibold leading-none tracking-tight', className )}\n {...props}\n />\n) )\nDialogTitle.displayName = DialogPrimitive.Title.displayName\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>( ( { className, ...props }, ref ) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn( 'text-sm text-muted-foreground', className )}\n {...props}\n />\n) )\nDialogDescription.displayName = DialogPrimitive.Description.displayName\n\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogClose,\n DialogTrigger,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n}\n","import * as React from 'react'\n\nimport { cn } from '../../lib/utils'\n\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<'input'>>(\n ( { className, type, ...props }, ref ) => {\n return (\n <input\n type={type}\n className={cn(\n 'flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n className,\n )}\n ref={ref}\n {...props}\n />\n )\n },\n)\nInput.displayName = 'Input'\n\nexport { Input }\n","import * as React from 'react'\nimport * as LabelPrimitive from '@radix-ui/react-label'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../../lib/utils'\n\nconst labelVariants = cva(\n 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\n)\n\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & VariantProps<typeof labelVariants>\n>( ( { className, ...props }, ref ) => (\n <LabelPrimitive.Root ref={ref} className={cn( labelVariants(), className )} {...props} />\n) )\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n"],"names":["Dialog","DialogPrimitive","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","React","className","props","ref","jsx","cn","DialogContent","children","jsxs","X","DialogHeader","DialogFooter","DialogTitle","DialogDescription","Input","type","labelVariants","cva","Label","LabelPrimitive"],"mappings":"qhBAMMA,EAASC,EAAgB,KACzBC,EAAgBD,EAAgB,QAChCE,EAAeF,EAAgB,OAC/BG,EAAcH,EAAgB,MAE9BI,EAAgBC,EAAM,WAGzB,CAAE,CAAE,UAAAC,EAAW,GAAGC,CAAA,EAASC,IAC5BC,EAAAA,IAACT,EAAgB,QAAhB,CACC,IAAAQ,EACA,UAAWE,EAAAA,GACT,yJACAJ,CAAA,EAED,GAAGC,CAAA,CACN,CACA,EACFH,EAAc,YAAcJ,EAAgB,QAAQ,YAEpD,MAAMW,EAAgBN,EAAM,WAGzB,CAAE,CAAE,UAAAC,EAAW,SAAAM,EAAU,GAAGL,CAAA,EAASC,IACtCK,EAAAA,KAACX,EAAA,CACC,SAAA,CAAAO,EAAAA,IAACL,EAAA,EAAc,EACfS,EAAAA,KAACb,EAAgB,QAAhB,CACC,IAAAQ,EACA,UAAWE,EAAAA,GACT,sVACAJ,CAAA,EAED,GAAGC,EAEH,SAAA,CAAAK,EACDC,EAAAA,KAACb,EAAgB,MAAhB,CAAsB,UAAU,gRAC/B,SAAA,CAAAS,EAAAA,IAACK,EAAAA,EAAA,CAAE,UAAU,SAAA,CAAU,EACvBL,EAAAA,IAAC,OAAA,CAAK,UAAU,UAAU,SAAA,OAAA,CAAK,CAAA,CAAA,CACjC,CAAA,CAAA,CAAA,CACF,EACF,CACA,EACFE,EAAc,YAAcX,EAAgB,QAAQ,YAEpD,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AAI,GAAGC,EAAO,CACvF,EACFgB,EAAM,YAAcC,EAAe,KAAK"}
@@ -0,0 +1,112 @@
1
+ import { jsx as s, jsxs as n } from "react/jsx-runtime";
2
+ import * as l from "react";
3
+ import * as t from "@radix-ui/react-dialog";
4
+ import { X as m } from "lucide-react";
5
+ import { c as i } from "./Card-JFmpTzpz.js";
6
+ import * as d from "@radix-ui/react-label";
7
+ import { cva as f } from "class-variance-authority";
8
+ const k = t.Root, T = t.Trigger, p = t.Portal, z = t.Close, c = l.forwardRef(({ className: e, ...a }, o) => /* @__PURE__ */ s(
9
+ t.Overlay,
10
+ {
11
+ ref: o,
12
+ className: i(
13
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
14
+ e
15
+ ),
16
+ ...a
17
+ }
18
+ ));
19
+ c.displayName = t.Overlay.displayName;
20
+ const g = l.forwardRef(({ className: e, children: a, ...o }, r) => /* @__PURE__ */ n(p, { children: [
21
+ /* @__PURE__ */ s(c, {}),
22
+ /* @__PURE__ */ n(
23
+ t.Content,
24
+ {
25
+ ref: r,
26
+ className: i(
27
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",
28
+ e
29
+ ),
30
+ ...o,
31
+ children: [
32
+ a,
33
+ /* @__PURE__ */ n(t.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
34
+ /* @__PURE__ */ s(m, { className: "h-4 w-4" }),
35
+ /* @__PURE__ */ s("span", { className: "sr-only", children: "Close" })
36
+ ] })
37
+ ]
38
+ }
39
+ )
40
+ ] }));
41
+ g.displayName = t.Content.displayName;
42
+ const u = ({ className: e, ...a }) => /* @__PURE__ */ s(
43
+ "div",
44
+ {
45
+ className: i("flex flex-col space-y-1.5 text-center sm:text-left", e),
46
+ ...a
47
+ }
48
+ );
49
+ u.displayName = "DialogHeader";
50
+ const b = ({ className: e, ...a }) => /* @__PURE__ */ s(
51
+ "div",
52
+ {
53
+ className: i(
54
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
55
+ e
56
+ ),
57
+ ...a
58
+ }
59
+ );
60
+ b.displayName = "DialogFooter";
61
+ const x = l.forwardRef(({ className: e, ...a }, o) => /* @__PURE__ */ s(
62
+ t.Title,
63
+ {
64
+ ref: o,
65
+ className: i("text-lg font-semibold leading-none tracking-tight", e),
66
+ ...a
67
+ }
68
+ ));
69
+ x.displayName = t.Title.displayName;
70
+ const y = l.forwardRef(({ className: e, ...a }, o) => /* @__PURE__ */ s(
71
+ t.Description,
72
+ {
73
+ ref: o,
74
+ className: i("text-sm text-muted-foreground", e),
75
+ ...a
76
+ }
77
+ ));
78
+ y.displayName = t.Description.displayName;
79
+ const N = l.forwardRef(
80
+ ({ className: e, type: a, ...o }, r) => /* @__PURE__ */ s(
81
+ "input",
82
+ {
83
+ type: a,
84
+ className: i(
85
+ "flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
86
+ e
87
+ ),
88
+ ref: r,
89
+ ...o
90
+ }
91
+ )
92
+ );
93
+ N.displayName = "Input";
94
+ const D = f(
95
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
96
+ ), v = l.forwardRef(({ className: e, ...a }, o) => /* @__PURE__ */ s(d.Root, { ref: o, className: i(D(), e), ...a }));
97
+ v.displayName = d.Root.displayName;
98
+ export {
99
+ k as D,
100
+ N as I,
101
+ v as L,
102
+ g as a,
103
+ u as b,
104
+ x as c,
105
+ y as d,
106
+ b as e,
107
+ z as f,
108
+ c as g,
109
+ p as h,
110
+ T as i
111
+ };
112
+ //# sourceMappingURL=Label-CewJarON.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Label-CewJarON.js","sources":["../src/components/ui/Dialog.tsx","../src/components/ui/Input.tsx","../src/components/ui/Label.tsx"],"sourcesContent":["import * as React from 'react'\nimport * as DialogPrimitive from '@radix-ui/react-dialog'\nimport { X } from 'lucide-react'\n\nimport { cn } from '../../lib/utils'\n\nconst Dialog = DialogPrimitive.Root\nconst DialogTrigger = DialogPrimitive.Trigger\nconst DialogPortal = DialogPrimitive.Portal\nconst DialogClose = DialogPrimitive.Close\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>( ( { className, ...props }, ref ) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n className,\n )}\n {...props}\n />\n) )\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>( ( { className, children, ...props }, ref ) => (\n <DialogPortal>\n <DialogOverlay />\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg',\n className,\n )}\n {...props}\n >\n {children}\n <DialogPrimitive.Close className=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground\">\n <X className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n </DialogPrimitive.Content>\n </DialogPortal>\n) )\nDialogContent.displayName = DialogPrimitive.Content.displayName\n\nconst DialogHeader = ( { className, ...props }: React.HTMLAttributes<HTMLDivElement> ) => (\n <div\n className={cn( 'flex flex-col space-y-1.5 text-center sm:text-left', className )}\n {...props}\n />\n)\nDialogHeader.displayName = 'DialogHeader'\n\nconst DialogFooter = ( { className, ...props }: React.HTMLAttributes<HTMLDivElement> ) => (\n <div\n className={cn(\n 'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',\n className,\n )}\n {...props}\n />\n)\nDialogFooter.displayName = 'DialogFooter'\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>( ( { className, ...props }, ref ) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn( 'text-lg font-semibold leading-none tracking-tight', className )}\n {...props}\n />\n) )\nDialogTitle.displayName = DialogPrimitive.Title.displayName\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>( ( { className, ...props }, ref ) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn( 'text-sm text-muted-foreground', className )}\n {...props}\n />\n) )\nDialogDescription.displayName = DialogPrimitive.Description.displayName\n\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogClose,\n DialogTrigger,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n}\n","import * as React from 'react'\n\nimport { cn } from '../../lib/utils'\n\nconst Input = React.forwardRef<HTMLInputElement, React.ComponentProps<'input'>>(\n ( { className, type, ...props }, ref ) => {\n return (\n <input\n type={type}\n className={cn(\n 'flex h-9 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n className,\n )}\n ref={ref}\n {...props}\n />\n )\n },\n)\nInput.displayName = 'Input'\n\nexport { Input }\n","import * as React from 'react'\nimport * as LabelPrimitive from '@radix-ui/react-label'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from '../../lib/utils'\n\nconst labelVariants = cva(\n 'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\n)\n\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & VariantProps<typeof labelVariants>\n>( ( { className, ...props }, ref ) => (\n <LabelPrimitive.Root ref={ref} className={cn( labelVariants(), className )} {...props} />\n) )\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n"],"names":["Dialog","DialogPrimitive","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","React","className","props","ref","jsx","cn","DialogContent","children","jsxs","X","DialogHeader","DialogFooter","DialogTitle","DialogDescription","Input","type","labelVariants","cva","Label","LabelPrimitive"],"mappings":";;;;;;;AAMA,MAAMA,IAASC,EAAgB,MACzBC,IAAgBD,EAAgB,SAChCE,IAAeF,EAAgB,QAC/BG,IAAcH,EAAgB,OAE9BI,IAAgBC,EAAM,WAGzB,CAAE,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC5B,gBAAAC;AAAA,EAACT,EAAgB;AAAA,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EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC5B,gBAAAC;AAAA,EAACT,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAQ;AAAA,IACA,WAAWE,EAAI,qDAAqDJ,CAAU;AAAA,IAC7E,GAAGC;AAAA,EAAA;AACN,CACA;AACFU,EAAY,cAAcjB,EAAgB,MAAM;AAEhD,MAAMkB,IAAoBb,EAAM,WAG7B,CAAE,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC5B,gBAAAC;AAAA,EAACT,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAQ;AAAA,IACA,WAAWE,EAAI,iCAAiCJ,CAAU;AAAA,IACzD,GAAGC;AAAA,EAAA;AACN,CACA;AACFW,EAAkB,cAAclB,EAAgB,YAAY;ACvF5D,MAAMmB,IAAQd,EAAM;AAAA,EAClB,CAAE,EAAE,WAAAC,GAAW,MAAAc,GAAM,GAAGb,EAAA,GAASC,MAE7B,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAAW;AAAA,MACA,WAAWV;AAAA,QACT;AAAA,QACAJ;AAAA,MAAA;AAAA,MAEF,KAAAE;AAAA,MACC,GAAGD;AAAA,IAAA;AAAA,EAAA;AAIZ;AACAY,EAAM,cAAc;ACbpB,MAAME,IAAgBC;AAAA,EACpB;AACF,GAEMC,IAAQlB,EAAM,WAGjB,CAAE,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC5B,gBAAAC,EAACe,EAAe,MAAf,EAAoB,KAAAhB,GAAU,WAAWE,EAAIW,EAAA,GAAiBf,CAAU,GAAI,GAAGC,GAAO,CACvF;AACFgB,EAAM,cAAcC,EAAe,KAAK;"}
@@ -0,0 +1,2 @@
1
+ "use strict";const C=require("./PluginTypes-C4a2lmPj.cjs"),e=require("react/jsx-runtime"),N=require("react"),d=require("@tanstack/react-query"),n=require("lucide-react"),R=require("@leverege/plugin"),s=require("./Card-Z-6q-k3a.cjs"),r=require("./Label-BgvLHORr.cjs"),P={name:"",secret:"",description:""};function b({title:u="Secrets",subtitle:q="Manage encrypted secrets used by server-side services"}={}){const l=R.Config.get("Secret","apiPath","/secrets"),{toast:a}=s.useToast(),{fetchJson:m}=s.useImaginariumApi(),x=d.useQueryClient(),[D,h]=N.useState(!1),[c,g]=N.useState(null),[i,o]=N.useState(P),p=["imaginarium","secrets",l],{data:v,isLoading:I}=d.useQuery({queryKey:p,queryFn:async()=>{const t=await m(l);return Array.isArray(t)?t:(t==null?void 0:t.items)??[]}}),j=d.useMutation({mutationFn:t=>m(l,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{x.invalidateQueries({queryKey:p}),a({title:"Success",description:"Secret created"}),y()},onError:t=>{a({title:"Error",description:t.message,variant:"destructive"})}}),S=d.useMutation({mutationFn:({id:t,data:O})=>m(`${l}/${t}`,{method:"PATCH",body:JSON.stringify(O)}),onSuccess:()=>{x.invalidateQueries({queryKey:p}),a({title:"Success",description:"Secret updated"}),y()},onError:t=>{a({title:"Error",description:t.message,variant:"destructive"})}}),T=d.useMutation({mutationFn:t=>m(`${l}/${t}`,{method:"DELETE"}),onSuccess:()=>{x.invalidateQueries({queryKey:p}),a({title:"Success",description:"Secret deleted"})},onError:t=>{a({title:"Error",description:t.message,variant:"destructive"})}}),f=()=>{g(null),o(P),h(!0)},F=t=>{g(t),o({name:t.name,secret:"",description:t.description??""}),h(!0)},y=()=>{h(!1),g(null)},k=()=>{const t={name:i.name.trim(),description:i.description.trim()||null};return i.secret.trim()&&(t.secret=i.secret),t},M=()=>{const t=k();if(c)S.mutate({id:c.id,data:t});else{if(!t.secret){a({title:"Missing secret",description:"Secret value is required.",variant:"destructive"});return}j.mutate(t)}},A=t=>{window.confirm("Delete this secret?")&&T.mutate(t)},L=!!(i.name.trim()&&(c||i.secret.trim()));return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-semibold",children:u}),e.jsx("p",{className:"text-sm text-muted-foreground",children:q})]}),e.jsxs(s.Button,{onClick:f,children:[e.jsx(n.Plus,{className:"w-4 h-4 mr-2"}),"Add Secret"]})]}),I?e.jsx("div",{className:"text-center text-muted-foreground",children:"Loading…"}):v&&v.length>0?e.jsx("div",{className:"grid gap-4",children:v.map(t=>e.jsx(s.Card,{children:e.jsxs(s.CardHeader,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n.KeyRound,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(s.CardTitle,{children:t.name})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(s.Button,{variant:"ghost",size:"icon",onClick:()=>F(t),children:e.jsx(n.Pencil,{className:"w-4 h-4"})}),e.jsx(s.Button,{variant:"ghost",size:"icon",onClick:()=>A(t.id),children:e.jsx(n.Trash2,{className:"w-4 h-4"})})]})]}),t.description?e.jsx(s.CardDescription,{className:"ml-6",children:t.description}):null]})},t.id))}):e.jsx(s.Card,{children:e.jsxs(s.CardContent,{className:"py-12 text-center",children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:"No secrets yet"}),e.jsxs(s.Button,{onClick:f,children:[e.jsx(n.Plus,{className:"w-4 h-4 mr-2"}),"Add Your First Secret"]})]})}),e.jsx(r.Dialog,{open:D,onOpenChange:h,children:e.jsxs(r.DialogContent,{children:[e.jsxs(r.DialogHeader,{children:[e.jsx(r.DialogTitle,{children:c?`Edit ${c.name}`:"New Secret"}),e.jsx(r.DialogDescription,{children:"Secret values are encrypted at rest and never returned by the API."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(r.Label,{htmlFor:"secret-name",children:"Name"}),e.jsx(r.Input,{id:"secret-name",value:i.name,onChange:t=>o({...i,name:t.target.value}),placeholder:"SUPER_SECRET_API_KEY",className:"font-mono"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r.Label,{htmlFor:"secret-value",children:"Secret Value"}),e.jsx(r.Input,{id:"secret-value",type:"password",value:i.secret,onChange:t=>o({...i,secret:t.target.value}),placeholder:c?"Leave blank to keep current value":"Enter secret value",className:"font-mono"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:c?"Leave blank to keep the existing value.":"Stored encrypted; not retrievable via the API."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(r.Label,{htmlFor:"secret-description",children:"Description (Optional)"}),e.jsx(r.Input,{id:"secret-description",value:i.description,onChange:t=>o({...i,description:t.target.value}),placeholder:"What this secret is used for"})]})]}),e.jsxs(r.DialogFooter,{children:[e.jsxs(s.Button,{variant:"outline",onClick:y,children:[e.jsx(n.X,{className:"w-4 h-4 mr-2"}),"Cancel"]}),e.jsxs(s.Button,{onClick:M,disabled:!L||j.isPending||S.isPending,children:[e.jsx(n.Save,{className:"w-4 h-4 mr-2"}),j.isPending||S.isPending?"Saving…":"Save Secret"]})]})]})})]})}const E={id:"imaginarium.ui.SecretsPage",path:"/secrets",element:b},w={id:"imaginarium.ui.SecretsNavItem",path:"/secrets",label:"Secrets",icon:n.KeyRound,sort:200},B={install(u){u.addPlugin(C.PageType,E),u.addPlugin(C.NavItemType,w)}};exports.SecretNavItem=w;exports.SecretPage=E;exports.SecretPluginSetup=B;exports.SecretView=b;
2
+ //# sourceMappingURL=PluginSetup-DADMV3GR.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PluginSetup-DADMV3GR.cjs","sources":["../src/secret/SecretView.tsx","../src/secret/SecretPage.tsx","../src/secret/SecretNavItem.ts","../src/secret/PluginSetup.ts"],"sourcesContent":["import { useState } from 'react'\nimport { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'\nimport { Plus, Pencil, Trash2, Save, X, KeyRound } from 'lucide-react'\nimport { Config } from '@leverege/plugin'\n\nimport { Button } from '../components/ui/Button'\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '../components/ui/Card'\nimport {\n Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle,\n} from '../components/ui/Dialog'\nimport { Input } from '../components/ui/Input'\nimport { Label } from '../components/ui/Label'\nimport { useToast } from '../hooks/useToast'\nimport { useImaginariumApi } from '../api/ImaginariumApiContext'\nimport type { Secret, SecretListResponse } from './types'\n\ninterface SecretFormData {\n name: string\n secret: string\n description: string\n}\n\nconst EMPTY_FORM: SecretFormData = { name: '', secret: '', description: '' }\n\nexport interface SecretViewProps {\n title?: string\n subtitle?: string\n}\n\nexport default function SecretView( {\n title = 'Secrets',\n subtitle = 'Manage encrypted secrets used by server-side services',\n}: SecretViewProps = {} ) {\n const apiPath = Config.get<string>( 'Secret', 'apiPath', '/secrets' )\n const { toast } = useToast()\n const { fetchJson } = useImaginariumApi()\n const queryClient = useQueryClient()\n const [ isOpen, setIsOpen ] = useState( false )\n const [ editing, setEditing ] = useState<Secret | null>( null )\n const [ form, setForm ] = useState<SecretFormData>( EMPTY_FORM )\n\n const queryKey = [ 'imaginarium', 'secrets', apiPath ] as const\n\n const { data: secrets, isLoading } = useQuery<Secret[]>( {\n queryKey,\n queryFn: async () => {\n const res = await fetchJson<SecretListResponse | Secret[]>( apiPath )\n return Array.isArray( res ) ? res : ( res?.items ?? [] )\n },\n } )\n\n const createMutation = useMutation( {\n mutationFn: ( data: Record<string, unknown> ) =>\n fetchJson( apiPath, { method: 'POST', body: JSON.stringify( data ) } ),\n onSuccess: () => {\n queryClient.invalidateQueries( { queryKey } )\n toast( { title: 'Success', description: 'Secret created' } )\n close()\n },\n onError: ( error: Error ) => {\n toast( { title: 'Error', description: error.message, variant: 'destructive' } )\n },\n } )\n\n const updateMutation = useMutation( {\n mutationFn: ( { id, data }: { id: string; data: Record<string, unknown> } ) =>\n fetchJson( `${apiPath}/${id}`, { method: 'PATCH', body: JSON.stringify( data ) } ),\n onSuccess: () => {\n queryClient.invalidateQueries( { queryKey } )\n toast( { title: 'Success', description: 'Secret updated' } )\n close()\n },\n onError: ( error: Error ) => {\n toast( { title: 'Error', description: error.message, variant: 'destructive' } )\n },\n } )\n\n const deleteMutation = useMutation( {\n mutationFn: ( id: string ) => fetchJson( `${apiPath}/${id}`, { method: 'DELETE' } ),\n onSuccess: () => {\n queryClient.invalidateQueries( { queryKey } )\n toast( { title: 'Success', description: 'Secret deleted' } )\n },\n onError: ( error: Error ) => {\n toast( { title: 'Error', description: error.message, variant: 'destructive' } )\n },\n } )\n\n const openCreate = () => { setEditing( null ); setForm( EMPTY_FORM ); setIsOpen( true ) }\n const openEdit = ( s: Secret ) => {\n setEditing( s )\n setForm( { name: s.name, secret: '', description: s.description ?? '' } )\n setIsOpen( true )\n }\n const close = () => { setIsOpen( false ); setEditing( null ) }\n\n const buildPayload = (): Record<string, unknown> => {\n const payload: Record<string, unknown> = {\n name: form.name.trim(),\n description: form.description.trim() || null,\n }\n // Include secret only if user provided one; on edit, blank means \"keep existing\".\n if ( form.secret.trim() ) { payload.secret = form.secret }\n return payload\n }\n\n const handleSubmit = () => {\n const payload = buildPayload()\n if ( editing ) {\n updateMutation.mutate( { id: editing.id, data: payload } )\n } else {\n if ( !payload.secret ) {\n toast( { title: 'Missing secret', description: 'Secret value is required.', variant: 'destructive' } )\n return\n }\n createMutation.mutate( payload )\n }\n }\n\n const handleDelete = ( id: string ) => {\n if ( window.confirm( 'Delete this secret?' ) ) { deleteMutation.mutate( id ) }\n }\n\n const isValid = Boolean( form.name.trim() && ( editing || form.secret.trim() ) )\n\n return (\n <div className=\"space-y-6\">\n <div className=\"flex items-center justify-between\">\n <div>\n <h2 className=\"text-2xl font-semibold\">{title}</h2>\n <p className=\"text-sm text-muted-foreground\">{subtitle}</p>\n </div>\n <Button onClick={openCreate}>\n <Plus className=\"w-4 h-4 mr-2\" />\n Add Secret\n </Button>\n </div>\n\n {isLoading ? (\n <div className=\"text-center text-muted-foreground\">Loading…</div>\n ) : secrets && secrets.length > 0 ? (\n <div className=\"grid gap-4\">\n {secrets.map( ( s ) => (\n <Card key={s.id}>\n <CardHeader>\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-2\">\n <KeyRound className=\"w-4 h-4 text-muted-foreground\" />\n <CardTitle>{s.name}</CardTitle>\n </div>\n <div className=\"flex gap-2\">\n <Button variant=\"ghost\" size=\"icon\" onClick={() => openEdit( s )}>\n <Pencil className=\"w-4 h-4\" />\n </Button>\n <Button variant=\"ghost\" size=\"icon\" onClick={() => handleDelete( s.id )}>\n <Trash2 className=\"w-4 h-4\" />\n </Button>\n </div>\n </div>\n {s.description ? (\n <CardDescription className=\"ml-6\">{s.description}</CardDescription>\n ) : null}\n </CardHeader>\n </Card>\n ) )}\n </div>\n ) : (\n <Card>\n <CardContent className=\"py-12 text-center\">\n <p className=\"text-muted-foreground mb-4\">No secrets yet</p>\n <Button onClick={openCreate}>\n <Plus className=\"w-4 h-4 mr-2\" />\n Add Your First Secret\n </Button>\n </CardContent>\n </Card>\n )}\n\n <Dialog open={isOpen} onOpenChange={setIsOpen}>\n <DialogContent>\n <DialogHeader>\n <DialogTitle>{editing ? `Edit ${editing.name}` : 'New Secret'}</DialogTitle>\n <DialogDescription>\n Secret values are encrypted at rest and never returned by the API.\n </DialogDescription>\n </DialogHeader>\n\n <div className=\"space-y-4 py-4\">\n <div className=\"space-y-2\">\n <Label htmlFor=\"secret-name\">Name</Label>\n <Input\n id=\"secret-name\"\n value={form.name}\n onChange={( e ) => setForm( { ...form, name: e.target.value } )}\n placeholder=\"SUPER_SECRET_API_KEY\"\n className=\"font-mono\"\n />\n </div>\n\n <div className=\"space-y-2\">\n <Label htmlFor=\"secret-value\">Secret Value</Label>\n <Input\n id=\"secret-value\"\n type=\"password\"\n value={form.secret}\n onChange={( e ) => setForm( { ...form, secret: e.target.value } )}\n placeholder={editing ? 'Leave blank to keep current value' : 'Enter secret value'}\n className=\"font-mono\"\n />\n <p className=\"text-xs text-muted-foreground\">\n {editing\n ? 'Leave blank to keep the existing value.'\n : 'Stored encrypted; not retrievable via the API.'}\n </p>\n </div>\n\n <div className=\"space-y-2\">\n <Label htmlFor=\"secret-description\">Description (Optional)</Label>\n <Input\n id=\"secret-description\"\n value={form.description}\n onChange={( e ) => setForm( { ...form, description: e.target.value } )}\n placeholder=\"What this secret is used for\"\n />\n </div>\n </div>\n\n <DialogFooter>\n <Button variant=\"outline\" onClick={close}>\n <X className=\"w-4 h-4 mr-2\" />\n Cancel\n </Button>\n <Button\n onClick={handleSubmit}\n disabled={!isValid || createMutation.isPending || updateMutation.isPending}\n >\n <Save className=\"w-4 h-4 mr-2\" />\n {createMutation.isPending || updateMutation.isPending ? 'Saving…' : 'Save Secret'}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n </div>\n )\n}\n","import SecretView from './SecretView'\n\nexport default {\n id : 'imaginarium.ui.SecretsPage',\n path : '/secrets',\n element : SecretView,\n}\n","import { KeyRound } from 'lucide-react'\n\nexport default {\n id : 'imaginarium.ui.SecretsNavItem',\n path : '/secrets',\n label : 'Secrets',\n icon : KeyRound,\n sort : 200,\n}\n","import { PageType, NavItemType } from '../plugins/PluginTypes'\n\nimport SecretPage from './SecretPage'\nimport SecretNavItem from './SecretNavItem'\n\nexport const SecretPluginSetup = {\n install( plg: { addPlugin: ( type: string, p: unknown ) => void } ) {\n plg.addPlugin( PageType, SecretPage )\n plg.addPlugin( NavItemType, SecretNavItem )\n },\n}\n\nexport default SecretPluginSetup\n"],"names":["EMPTY_FORM","SecretView","title","subtitle","apiPath","Config","toast","useToast","fetchJson","useImaginariumApi","queryClient","useQueryClient","isOpen","setIsOpen","useState","editing","setEditing","form","setForm","queryKey","secrets","isLoading","useQuery","res","createMutation","useMutation","data","close","error","updateMutation","id","deleteMutation","openCreate","openEdit","s","buildPayload","payload","handleSubmit","handleDelete","isValid","jsxs","jsx","Button","Plus","Card","CardHeader","KeyRound","CardTitle","Pencil","Trash2","CardDescription","CardContent","Dialog","DialogContent","DialogHeader","DialogTitle","DialogDescription","Label","Input","e","DialogFooter","X","Save","SecretPage","SecretNavItem","SecretPluginSetup","plg","PageType","NavIt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AA,CAAe,EAC9BtC,EAAe,WAAaK,EAAe,UAAY,UAAY,aAAA,CAAA,CAAA,CACtE,CAAA,CACF,CAAA,CAAA,CACF,CAAA,CACF,CAAA,EACF,CAEJ,CClPA,MAAAkC,EAAe,CACb,GAAK,6BACL,KAAO,WACP,QAAU9D,CACZ,ECJA+D,EAAe,CACb,GAAK,gCACL,KAAO,WACP,MAAQ,UACR,KAAOlB,EAAAA,SACP,KAAO,GACT,ECHamB,EAAoB,CAC/B,QAASC,EAA2D,CAClEA,EAAI,UAAWC,EAAAA,SAAUJ,CAAW,EACpCG,EAAI,UAAWE,EAAAA,YAAaJ,CAAc,CAC5C,CACF"}
@@ -0,0 +1,2 @@
1
+ "use strict";const w=require("@leverege/plugin"),L=require("./PluginTypes-C4a2lmPj.cjs"),e=require("react/jsx-runtime"),o=require("react"),P=require("@tanstack/react-query"),j=require("lucide-react"),p=require("./Card-Z-6q-k3a.cjs"),c=require("./Label-BgvLHORr.cjs");function K({value:a,onChange:l,placeholder:d,id:i,className:n}){const[r,u]=o.useState(""),y=()=>{const s=r.trim();s&&(a.includes(s)||l([...a,s]),u(""))},h=s=>l(a.filter(g=>g!==s)),m=s=>{s.key==="Enter"||s.key===","?(s.preventDefault(),y()):s.key==="Backspace"&&r===""&&a.length>0&&h(a[a.length-1])};return e.jsxs("div",{className:p.cn("flex flex-wrap items-center gap-1.5 rounded-md border border-input bg-background px-2 py-1.5 text-sm focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",n),children:[a.map(s=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-sm bg-secondary px-2 py-0.5 text-secondary-foreground",children:[s,e.jsx("button",{type:"button",onClick:()=>h(s),"aria-label":`Remove tag ${s}`,className:"text-muted-foreground hover:text-foreground",children:e.jsx(j.X,{className:"h-3 w-3"})})]},s)),e.jsx("input",{id:i,value:r,onChange:s=>u(s.target.value),onKeyDown:m,onBlur:y,placeholder:a.length===0?d??"Add a tag…":"",className:"flex-1 min-w-32 bg-transparent outline-none placeholder:text-muted-foreground"})]})}const B=o.createContext(null);function O(a,l){const d=new Set(a);for(const n of l)n&&d.add(n);const i=Array.from(d).sort();return i.length===a.length&&i.every((n,r)=>n===a[r])?a:i}function A(a,l){const d=a.indexOf(l);if(d===-1){const i=[...a,l];return i.sort(),i}return a.filter((i,n)=>n!==d)}function _({children:a}){const[l,d]=o.useState(!0),[i,n]=o.useState([]),[r,u]=o.useState([]),[y,h]=o.useState([]),[m,s]=o.useState([]),[g,T]=o.useState(0),k=o.useCallback(x=>{n(f=>A(f,x))},[]),v=o.useCallback(x=>{u(f=>A(f,x))},[]),C=o.useCallback(x=>{h(f=>O(f,x))},[]),S=o.useCallback(x=>{s(f=>O(f,x))},[]),N=o.useCallback(()=>{n([]),u([])},[]),D=o.useMemo(()=>({showDev:l,setShowDev:d,hiddenSystemConfigTypes:i,toggleSystemConfigType:k,hiddenSystemConfigTags:r,toggleSystemConfigTag:v,knownSystemConfigTypes:y,registerSystemConfigTypes:C,knownSystemConfigTags:m,registerSystemConfigTags:S,filteredOutCount:g,setFilteredOutCount:T,clearHidden:N}),[l,i,k,r,v,y,C,m,S,g,N]);return e.jsx(B.Provider,{value:D,children:a})}function q(){const a=o.useContext(B);if(!a)throw new Error("useFilters must be used inside FilterProvider");return a}function J(a){const l=a.displayName.toLowerCase(),d=a.baseUrl.toLowerCase();return l.includes("dev")||l.includes("staging")||d.includes("dev-")||d.includes("stg-")}function U(a,l){const d=new Set(l.hiddenSystemConfigTypes),i=new Set(l.hiddenSystemConfigTags);return a.filter(n=>!(!l.showDev&&J(n)||n.type&&d.has(n.type)||n.tags&&n.tags.length>0&&n.tags.every(r=>i.has(r))))}const R=o.createContext(null);function G({children:a}){const{fetchJson:l}=p.useImaginariumApi(),d=w.Config.get("ImagineSystemConfig","apiPath","/configs"),i=o.useMemo(()=>["imaginarium","system-configs",d],[d]),n=q(),r=P.useQuery({queryKey:i,queryFn:async()=>{const m=await l(d);return Array.isArray(m)?m:(m==null?void 0:m.items)??[]}}),u=o.useMemo(()=>r.data??[],[r.data]),y=o.useMemo(()=>U(u,n),[u,n]);o.useEffect(()=>{n.registerSystemConfigTypes(u.map(m=>m.type)),n.registerSystemConfigTags(u.flatMap(m=>m.tags??[]))},[u,n.registerSystemConfigTypes,n.registerSystemConfigTags]),o.useEffect(()=>{n.setFilteredOutCount(u.length-y.length)},[u.length,y.length,n.setFilteredOutCount]),o.useEffect(()=>()=>n.setFilteredOutCount(0),[n.setFilteredOutCount]);const h=o.useMemo(()=>({configs:u,filtered:y,isLoading:r.isLoading,isError:r.isError,error:r.error,refetch:r.refetch,apiPath:d,queryKey:i}),[u,y,r.isLoading,r.isError,r.error,r.refetch,d,i]);return e.jsx(R.Provider,{value:h,children:a})}function H(){const a=o.useContext(R);if(!a)throw new Error("useSystemConfigs must be used inside SystemConfigsProvider");return a}const M={displayName:"",apiKey:"",secret:"",projectId:"",systemId:"",baseUrl:"",audience:"",type:"",tags:[],metadata:""};function Q({title:a="Imagine Systems",subtitle:l="Manage Imagine API configurations for different systems",dialogDescription:d="Configure your Imagine API credentials."}={}){const{toast:i}=p.useToast(),{fetchJson:n}=p.useImaginariumApi(),r=P.useQueryClient(),[u,y]=o.useState(!1),[h,m]=o.useState(null),[s,g]=o.useState(M),{filtered:T,isLoading:k,apiPath:v,queryKey:C}=H(),S=P.useMutation({mutationFn:t=>n(v,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{r.invalidateQueries({queryKey:C}),i({title:"Success",description:"System Configuration created successfully"}),E()},onError:t=>{i({title:"Error",description:t.message,variant:"destructive"})}}),N=P.useMutation({mutationFn:({id:t,data:I})=>n(`${v}/${t}`,{method:"PATCH",body:JSON.stringify(I)}),onSuccess:()=>{r.invalidateQueries({queryKey:C}),i({title:"Success",description:"System Configuration updated successfully"}),E()},onError:t=>{i({title:"Error",description:t.message,variant:"destructive"})}}),D=P.useMutation({mutationFn:t=>n(`${v}/${t}`,{method:"DELETE"}),onSuccess:()=>{r.invalidateQueries({queryKey:C}),i({title:"Success",description:"System Configuration deleted successfully"})},onError:t=>{i({title:"Error",description:t.message,variant:"destructive"})}}),x=()=>{m(null),g(M),y(!0)},f=t=>{m(t),g({displayName:t.displayName,apiKey:t.apiKey,secret:"",projectId:t.projectId,systemId:t.systemId,baseUrl:t.baseUrl,audience:t.audience??"",type:t.type??"",tags:t.tags??[],metadata:t.metadata?JSON.stringify(t.metadata,null,2):""}),y(!0)},E=()=>{y(!1),m(null)},$=()=>{const{metadata:t,type:I,tags:X,...Y}=s;return{...Y,type:I.trim()||null,tags:X,metadata:t.trim()?JSON.parse(t):null}},V=()=>{let t;try{t=$()}catch{i({title:"Invalid metadata",description:"Metadata must be valid JSON",variant:"destructive"});return}h?(s.secret.trim()||delete t.secret,N.mutate({id:h.id,data:t})):S.mutate(t)},z=t=>{window.confirm("Are you sure you want to delete this system configuration?")&&D.mutate(t)},W=!!(s.displayName.trim()&&s.apiKey.trim()&&(h||s.secret.trim())&&s.projectId.trim()&&s.systemId.trim()&&s.baseUrl.trim());return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-semibold",children:a}),e.jsx("p",{className:"text-sm text-muted-foreground",children:l})]}),e.jsxs(p.Button,{onClick:x,children:[e.jsx(j.Plus,{className:"w-4 h-4 mr-2"}),"Add System"]})]}),k?e.jsx("div",{className:"text-center text-muted-foreground",children:"Loading system configurations..."}):T.length>0?e.jsx("div",{className:"grid gap-4",children:T.map(t=>e.jsxs(p.Card,{children:[e.jsx(p.CardHeader,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(p.CardTitle,{children:t.displayName}),e.jsxs(p.CardDescription,{children:["Project: ",t.projectId," | System: ",t.systemId]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(p.Button,{variant:"ghost",size:"icon",onClick:()=>f(t),children:e.jsx(j.Pencil,{className:"w-4 h-4"})}),e.jsx(p.Button,{variant:"ghost",size:"icon",onClick:()=>z(t.id),children:e.jsx(j.Trash2,{className:"w-4 h-4"})})]})]})}),e.jsx(p.CardContent,{className:"space-y-2",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Base URL:"}),e.jsx("div",{className:"font-mono text-xs mt-1",children:t.baseUrl})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"API Key:"}),e.jsx("div",{className:"font-mono text-xs mt-1",children:t.apiKey})]}),t.audience&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Audience:"}),e.jsx("div",{className:"font-mono text-xs mt-1",children:t.audience})]}),t.type&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Type:"}),e.jsx("div",{className:"font-mono text-xs mt-1",children:t.type})]}),t.tags&&t.tags.length>0&&e.jsxs("div",{className:"col-span-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"Tags:"}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:t.tags.map(I=>e.jsx("span",{className:"inline-flex items-center rounded-sm bg-secondary px-2 py-0.5 text-xs text-secondary-foreground",children:I},I))})]}),t.metadata&&e.jsxs("div",{className:"col-span-2",children:[e.jsx("span",{className:"text-muted-foreground",children:"Metadata:"}),e.jsx("pre",{className:"font-mono text-xs mt-1 whitespace-pre-wrap",children:JSON.stringify(t.metadata,null,2)})]})]})})]},t.id))}):e.jsx(p.Card,{children:e.jsxs(p.CardContent,{className:"py-12 text-center",children:[e.jsx("p",{className:"text-muted-foreground mb-4",children:"No systems yet"}),e.jsxs(p.Button,{onClick:x,children:[e.jsx(j.Plus,{className:"w-4 h-4 mr-2"}),"Add Your First System"]})]})}),e.jsx(c.Dialog,{open:u,onOpenChange:y,children:e.jsxs(c.DialogContent,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(c.DialogHeader,{children:[e.jsx(c.DialogTitle,{children:h?"Edit System":"New System"}),e.jsx(c.DialogDescription,{children:d})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(c.Label,{htmlFor:"display-name",children:"Display Name"}),e.jsx(c.Input,{id:"display-name",value:s.displayName,onChange:t=>g({...s,displayName:t.target.value}),placeholder:"Production - Customer Name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c.Label,{htmlFor:"base-url",children:"Base URL"}),e.jsx(c.Input,{id:"base-url",type:"url",value:s.baseUrl,onChange:t=>g({...s,baseUrl:t.target.value}),placeholder:"https://prd-customer-imagine-api.leverege.com",className:"font-mono"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(c.Label,{htmlFor:"project-id",children:"Project ID"}),e.jsx(c.Input,{id:"project-id",value:s.projectId,onChange:t=>g({...s,projectId:t.target.value}),placeholder:"proj123",className:"font-mono"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c.Label,{htmlFor:"system-id",children:"System ID"}),e.jsx(c.Input,{id:"system-id",value:s.systemId,onChange:t=>g({...s,systemId:t.target.value}),placeholder:"sys456",className:"font-mono"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c.Label,{htmlFor:"api-key",children:"API Key"}),e.jsx(c.Input,{id:"api-key",value:s.apiKey,onChange:t=>g({...s,apiKey:t.target.value}),placeholder:"Enter API key (JWT issuer)",className:"font-mono"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This will be used as the JWT issuer (iss claim)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c.Label,{htmlFor:"secret",children:"API Secret"}),e.jsx(c.Input,{id:"secret",type:"password",value:s.secret,onChange:t=>g({...s,secret:t.target.value}),placeholder:h?"Leave blank to keep current secret":"Enter API secret",className:"font-mono"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["The Imagine API secret. It will be encrypted before storage.",h&&" Leave blank to keep the existing secret."]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c.Label,{htmlFor:"audience",children:"Audience (Optional)"}),e.jsx(c.Input,{id:"audience",value:s.audience,onChange:t=>g({...s,audience:t.target.value}),placeholder:"Auto-extracted from base URL if not provided",className:"font-mono"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c.Label,{htmlFor:"type",children:"Type (Optional)"}),e.jsx(c.Input,{id:"type",value:s.type,onChange:t=>g({...s,type:t.target.value}),placeholder:"imagine",className:"font-mono"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c.Label,{htmlFor:"tags",children:"Tags (Optional)"}),e.jsx(K,{id:"tags",value:s.tags,onChange:t=>g({...s,tags:t}),placeholder:"Press Enter to add"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Press Enter or comma to add. Backspace removes the last tag when the input is empty."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c.Label,{htmlFor:"metadata",children:"Metadata (Optional)"}),e.jsx("textarea",{id:"metadata",value:s.metadata,onChange:t=>g({...s,metadata:t.target.value}),placeholder:'{ "region": "us-central1" }',rows:5,className:"flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm font-mono ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"JSON object stored alongside the config. Leave empty to clear."})]})]}),e.jsxs(c.DialogFooter,{children:[e.jsxs(p.Button,{variant:"outline",onClick:E,children:[e.jsx(j.X,{className:"w-4 h-4 mr-2"}),"Cancel"]}),e.jsxs(p.Button,{onClick:V,disabled:!W||S.isPending||N.isPending,children:[e.jsx(j.Save,{className:"w-4 h-4 mr-2"}),S.isPending||N.isPending?"Saving...":"Save System"]})]})]})})]})}const F={id:"imaginarium.ImagineSystemPage",path:"/system-config",element:Q},b={id:"imaginarium.ImagineSystemNavItem",path:"/system-config",label:"Imagine Systems",sort:100,icon:j.Settings},Z=F.id,ee=b.id,te={install(a){const l=w.Config.get("ImagineSystemConfig","path",F.path),d=w.Config.get("ImagineSystemConfig","navLabel",b.label),i=w.Config.get("ImagineSystemConfig","navSort",b.sort),n=w.Config.get("ImagineSystemConfig","navIcon",b.icon),r=n===null?void 0:n;a.addPlugin(L.PageType,{...F,path:l}),a.addPlugin(L.NavItemType,{...b,path:l,label:d,sort:i,icon:r})}};exports.FilterProvider=_;exports.ImagineSystemNavItem=b;exports.ImagineSystemNavItemId=ee;exports.ImagineSystemPage=F;exports.ImagineSystemPageId=Z;exports.ImagineSystemView=Q;exports.SystemConfigsProvider=G;exports.SystemPluginSetup=te;exports.TagInput=K;exports.applyConfigFilters=U;exports.isDevConfig=J;exports.useFilters=q;exports.useSystemConfigs=H;
2
+ //# sourceMappingURL=PluginSetup-DAgVBMVL.cjs.map