@velastack/patterns 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +4 -3
  2. package/dist/chunks/{_layout-Bsx3eNrC.js → _layout-DQhSAhfF.js} +2 -2
  3. package/dist/chunks/{_layout-Bsx3eNrC.js.map → _layout-DQhSAhfF.js.map} +1 -1
  4. package/dist/chunks/{collections-DrUG8ngq.js → collections-BYcVyY9O.js} +2 -2
  5. package/dist/chunks/{collections-DrUG8ngq.js.map → collections-BYcVyY9O.js.map} +1 -1
  6. package/dist/chunks/constants-Bdx8mp7v.js +6 -0
  7. package/dist/chunks/constants-Bdx8mp7v.js.map +1 -0
  8. package/dist/chunks/{env-vars-CdarYsrc.js → env-vars-0hvKe55u.js} +3 -3
  9. package/dist/chunks/{env-vars-CdarYsrc.js.map → env-vars-0hvKe55u.js.map} +1 -1
  10. package/dist/chunks/{generate-BxOzEdc_.js → generate-BOQA-Flq.js} +2 -2
  11. package/dist/chunks/{generate-BxOzEdc_.js.map → generate-BOQA-Flq.js.map} +1 -1
  12. package/dist/chunks/{generate-27CjLiGW.js → generate-CNabcEBx.js} +2 -2
  13. package/dist/chunks/{generate-27CjLiGW.js.map → generate-CNabcEBx.js.map} +1 -1
  14. package/dist/chunks/{generate-DdLwP0E7.js → generate-CO88bEvs.js} +2 -2
  15. package/dist/chunks/{generate-DdLwP0E7.js.map → generate-CO88bEvs.js.map} +1 -1
  16. package/dist/chunks/{generate-BFcy2wrS.js → generate-Df7t5Nbk.js} +3 -3
  17. package/dist/chunks/{generate-BFcy2wrS.js.map → generate-Df7t5Nbk.js.map} +1 -1
  18. package/dist/chunks/{generate-Cqwa8kD9.js → generate-DoHn_xJZ.js} +2 -2
  19. package/dist/chunks/{generate-Cqwa8kD9.js.map → generate-DoHn_xJZ.js.map} +1 -1
  20. package/dist/chunks/{generate-D3mSFPdT.js → generate-l2JZTRKb.js} +2 -2
  21. package/dist/chunks/{generate-D3mSFPdT.js.map → generate-l2JZTRKb.js.map} +1 -1
  22. package/dist/chunks/{generate.runtime-DMTAocSE.js → generate.runtime-1ldXcpiD.js} +3 -3
  23. package/dist/chunks/{generate.runtime-DMTAocSE.js.map → generate.runtime-1ldXcpiD.js.map} +1 -1
  24. package/dist/chunks/{generate.runtime-DIeAeOJg.js → generate.runtime-B53OTMcE.js} +4 -4
  25. package/dist/chunks/{generate.runtime-DIeAeOJg.js.map → generate.runtime-B53OTMcE.js.map} +1 -1
  26. package/dist/chunks/{generate.runtime-BJxM7FNA.js → generate.runtime-B84ymwlD.js} +4 -4
  27. package/dist/chunks/{generate.runtime-BJxM7FNA.js.map → generate.runtime-B84ymwlD.js.map} +1 -1
  28. package/dist/chunks/{generate.runtime-9KuMcI5r.js → generate.runtime-BOl3LpPB.js} +3 -3
  29. package/dist/chunks/{generate.runtime-9KuMcI5r.js.map → generate.runtime-BOl3LpPB.js.map} +1 -1
  30. package/dist/chunks/{generate.runtime-NxuWvkKt.js → generate.runtime-BP31tAcD.js} +4 -4
  31. package/dist/chunks/{generate.runtime-NxuWvkKt.js.map → generate.runtime-BP31tAcD.js.map} +1 -1
  32. package/dist/chunks/{generate.runtime-DlLwmjGF.js → generate.runtime-BoYwV0nt.js} +3 -3
  33. package/dist/chunks/{generate.runtime-DlLwmjGF.js.map → generate.runtime-BoYwV0nt.js.map} +1 -1
  34. package/dist/chunks/{generate.runtime-CIZO2XO9.js → generate.runtime-BqCbJ-No.js} +3 -3
  35. package/dist/chunks/{generate.runtime-CIZO2XO9.js.map → generate.runtime-BqCbJ-No.js.map} +1 -1
  36. package/dist/chunks/{generate.runtime-ww3-1FWf.js → generate.runtime-Bvjj3zn0.js} +3 -3
  37. package/dist/chunks/{generate.runtime-ww3-1FWf.js.map → generate.runtime-Bvjj3zn0.js.map} +1 -1
  38. package/dist/chunks/{generate.runtime-CK0MTeqc.js → generate.runtime-ByPcr9vJ.js} +3 -3
  39. package/dist/chunks/{generate.runtime-CK0MTeqc.js.map → generate.runtime-ByPcr9vJ.js.map} +1 -1
  40. package/dist/chunks/{generate.runtime-CMO-Skpk.js → generate.runtime-C4LUUuq7.js} +3 -3
  41. package/dist/chunks/{generate.runtime-CMO-Skpk.js.map → generate.runtime-C4LUUuq7.js.map} +1 -1
  42. package/dist/chunks/{generate.runtime-B10-KA87.js → generate.runtime-CGjDfO1P.js} +4 -4
  43. package/dist/chunks/{generate.runtime-B10-KA87.js.map → generate.runtime-CGjDfO1P.js.map} +1 -1
  44. package/dist/chunks/{generate.runtime-dFTOU_KE.js → generate.runtime-CHQ_MQJQ.js} +4 -4
  45. package/dist/chunks/{generate.runtime-dFTOU_KE.js.map → generate.runtime-CHQ_MQJQ.js.map} +1 -1
  46. package/dist/chunks/{generate.runtime-D5HxAups.js → generate.runtime-CHS5lyHL.js} +6 -6
  47. package/dist/chunks/{generate.runtime-D5HxAups.js.map → generate.runtime-CHS5lyHL.js.map} +1 -1
  48. package/dist/chunks/{generate.runtime-BdghkfNp.js → generate.runtime-CHUCMVa2.js} +2 -2
  49. package/dist/chunks/{generate.runtime-BdghkfNp.js.map → generate.runtime-CHUCMVa2.js.map} +1 -1
  50. package/dist/chunks/{generate.runtime-DtCaz98N.js → generate.runtime-CVWCUn52.js} +4 -4
  51. package/dist/chunks/{generate.runtime-DtCaz98N.js.map → generate.runtime-CVWCUn52.js.map} +1 -1
  52. package/dist/chunks/{generate.runtime-CbT-EbQT.js → generate.runtime-Cv3unKap.js} +3 -3
  53. package/dist/chunks/{generate.runtime-CbT-EbQT.js.map → generate.runtime-Cv3unKap.js.map} +1 -1
  54. package/dist/chunks/{generate.runtime-CVDb-yLt.js → generate.runtime-D677SB4v.js} +2 -2
  55. package/dist/chunks/{generate.runtime-CVDb-yLt.js.map → generate.runtime-D677SB4v.js.map} +1 -1
  56. package/dist/chunks/{generate.runtime-B_tWu-Bw.js → generate.runtime-DERcpgc-.js} +4 -4
  57. package/dist/chunks/{generate.runtime-B_tWu-Bw.js.map → generate.runtime-DERcpgc-.js.map} +1 -1
  58. package/dist/chunks/{generate.runtime-HSZD935T.js → generate.runtime-DJ5uF6EN.js} +2 -2
  59. package/dist/chunks/{generate.runtime-HSZD935T.js.map → generate.runtime-DJ5uF6EN.js.map} +1 -1
  60. package/dist/chunks/{generate.runtime-D6vhkGs8.js → generate.runtime-Dfz53sSK.js} +3 -3
  61. package/dist/chunks/{generate.runtime-D6vhkGs8.js.map → generate.runtime-Dfz53sSK.js.map} +1 -1
  62. package/dist/chunks/{generate.runtime-BGuXHl5o.js → generate.runtime-DiqfbDfk.js} +2 -2
  63. package/dist/chunks/{generate.runtime-BGuXHl5o.js.map → generate.runtime-DiqfbDfk.js.map} +1 -1
  64. package/dist/chunks/{generate.runtime-CEexT8cJ.js → generate.runtime-Dq6yS7tN.js} +5 -5
  65. package/dist/chunks/{generate.runtime-CEexT8cJ.js.map → generate.runtime-Dq6yS7tN.js.map} +1 -1
  66. package/dist/chunks/{generate.runtime-tGKorg85.js → generate.runtime-T7JLE4Wc.js} +3 -3
  67. package/dist/chunks/{generate.runtime-tGKorg85.js.map → generate.runtime-T7JLE4Wc.js.map} +1 -1
  68. package/dist/chunks/{generate.runtime-CbOMXQSo.js → generate.runtime-WPq7bHRA.js} +2 -2
  69. package/dist/chunks/{generate.runtime-CbOMXQSo.js.map → generate.runtime-WPq7bHRA.js.map} +1 -1
  70. package/dist/chunks/{generate.runtime-Cxr15Y5H.js → generate.runtime-WeDv05E2.js} +6 -6
  71. package/dist/chunks/{generate.runtime-Cxr15Y5H.js.map → generate.runtime-WeDv05E2.js.map} +1 -1
  72. package/dist/chunks/{generate.runtime-B8-GLMkk.js → generate.runtime-aKNvrk3M.js} +7 -7
  73. package/dist/chunks/{generate.runtime-B8-GLMkk.js.map → generate.runtime-aKNvrk3M.js.map} +1 -1
  74. package/dist/chunks/{generate.runtime-si5Za61F.js → generate.runtime-e_BkDyP0.js} +2 -2
  75. package/dist/chunks/{generate.runtime-si5Za61F.js.map → generate.runtime-e_BkDyP0.js.map} +1 -1
  76. package/dist/chunks/{generate.runtime-Blb6QPZn.js → generate.runtime-gZ4wfYBP.js} +6 -6
  77. package/dist/chunks/{generate.runtime-Blb6QPZn.js.map → generate.runtime-gZ4wfYBP.js.map} +1 -1
  78. package/dist/chunks/{generate.runtime-m0m43lkL.js → generate.runtime-oUJUQRdg.js} +6 -6
  79. package/dist/chunks/{generate.runtime-m0m43lkL.js.map → generate.runtime-oUJUQRdg.js.map} +1 -1
  80. package/dist/chunks/{generate.runtime-BWRtyQeD.js → generate.runtime-q17D7QUT.js} +3 -3
  81. package/dist/chunks/{generate.runtime-BWRtyQeD.js.map → generate.runtime-q17D7QUT.js.map} +1 -1
  82. package/dist/chunks/{generate.runtime-CyTxBcX3.js → generate.runtime-rLlDp4R6.js} +4 -4
  83. package/dist/chunks/{generate.runtime-CyTxBcX3.js.map → generate.runtime-rLlDp4R6.js.map} +1 -1
  84. package/dist/chunks/{generate.runtime-Nnk5E8Pi.js → generate.runtime-zr6uIHCd.js} +2 -2
  85. package/dist/chunks/{generate.runtime-Nnk5E8Pi.js.map → generate.runtime-zr6uIHCd.js.map} +1 -1
  86. package/dist/chunks/{modify-file-COBp4eCh.js → modify-file-B4uJzOEj.js} +2 -2
  87. package/dist/chunks/{modify-file-COBp4eCh.js.map → modify-file-B4uJzOEj.js.map} +1 -1
  88. package/dist/chunks/{package-imports-Dx05A-4S.js → package-imports-B9Asv3ZH.js} +2 -2
  89. package/dist/chunks/{package-imports-Dx05A-4S.js.map → package-imports-B9Asv3ZH.js.map} +1 -1
  90. package/dist/chunks/{pocketbase-DL02rq73.js → pocketbase-BtN-wL8f.js} +6 -6
  91. package/dist/chunks/{pocketbase-DL02rq73.js.map → pocketbase-BtN-wL8f.js.map} +1 -1
  92. package/dist/chunks/{providers-CAehyySB.js → providers-DRwJnSzb.js} +2 -2
  93. package/dist/chunks/{providers-CAehyySB.js.map → providers-DRwJnSzb.js.map} +1 -1
  94. package/dist/chunks/{shared-C_Fr8wph.js → shared-BbxLil4g.js} +2 -2
  95. package/dist/chunks/{shared-C_Fr8wph.js.map → shared-BbxLil4g.js.map} +1 -1
  96. package/dist/chunks/{site-BoujshKo.js → site-Dw2KIRJu.js} +2 -2
  97. package/dist/chunks/{site-BoujshKo.js.map → site-Dw2KIRJu.js.map} +1 -1
  98. package/dist/chunks/{table-core-BPv_RYgD.js → table-core-BHFT-uMX.js} +2 -2
  99. package/dist/chunks/{table-core-BPv_RYgD.js.map → table-core-BHFT-uMX.js.map} +1 -1
  100. package/dist/chunks/{test-setup-pYUIfWb2.js → test-setup-BVJwm22s.js} +3 -3
  101. package/dist/chunks/{test-setup-pYUIfWb2.js.map → test-setup-BVJwm22s.js.map} +1 -1
  102. package/dist/chunks/{ui-B2yn8c_-.js → ui-gG8i_Mzk.js} +3 -3
  103. package/dist/chunks/{ui-B2yn8c_-.js.map → ui-gG8i_Mzk.js.map} +1 -1
  104. package/dist/chunks/{whatsapp-5qJ_xCV1.js → whatsapp-DbjOxHaZ.js} +2 -2
  105. package/dist/chunks/{whatsapp-5qJ_xCV1.js.map → whatsapp-DbjOxHaZ.js.map} +1 -1
  106. package/dist/chunks/write-result-DcqMefuP.js +499 -0
  107. package/dist/chunks/write-result-DcqMefuP.js.map +1 -0
  108. package/dist/index.d.ts +11 -18
  109. package/dist/index.js +2135 -2135
  110. package/dist/index.js.map +1 -1
  111. package/package.json +1 -1
  112. package/dist/chunks/constants-iej3WkEa.js +0 -6
  113. package/dist/chunks/constants-iej3WkEa.js.map +0 -1
  114. package/dist/chunks/write-result-Bn4bnrBI.js +0 -481
  115. package/dist/chunks/write-result-Bn4bnrBI.js.map +0 -1
@@ -0,0 +1,499 @@
1
+ import { n as e } from "./rolldown-runtime-5HNE8Q1r.js";
2
+ import { n as t, r as n, t as r } from "./errors-DR3gF_7a.js";
3
+ import { d as i, f as a, o } from "./constants-Bdx8mp7v.js";
4
+ import { n as s } from "./format-result-BVoLVknk.js";
5
+ import { n as c, t as l } from "./logger-CQONztPm.js";
6
+ import { a as u, i as d, r as f, t as p } from "./table-core-BHFT-uMX.js";
7
+ import { cpSync as m, existsSync as h, mkdirSync as g, mkdtempSync as _, readFileSync as v, readdirSync as y, rmSync as b, statSync as x, writeFileSync as S } from "node:fs";
8
+ import C from "node:path";
9
+ import { detect as w } from "package-manager-detector";
10
+ import { resolveCommand as T } from "package-manager-detector/commands";
11
+ import E from "cross-spawn";
12
+ import ee from "node:os";
13
+ //#region src/ui/components/auth-menu/auth-menu-content.svelte?raw
14
+ var te = "<script lang=\"ts\">\n import { cn } from '#lib/utils.js';\n import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';\n import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';\n import { getContext } from 'svelte';\n import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\n\n let {\n children,\n class: className,\n ...restProps\n }: DropdownMenuPrimitive.ContentProps & {\n portalProps?: DropdownMenuPrimitive.PortalProps;\n } = $props();\n\n let { isDesktop } =\n getContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\n<\/script>\n\n{#if isDesktop}\n <DropdownMenu.Content class={className} {...restProps}>\n {@render children?.()}\n </DropdownMenu.Content>\n{:else}\n <div class={cn('flex flex-col w-full', className)}>\n {@render children?.()}\n </div>\n{/if}\n", ne = "<script lang=\"ts\">\n import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';\n import { getContext } from 'svelte';\n import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\n let { isDesktop } =\n getContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\n let { children, ...restProps } = $props();\n<\/script>\n\n{#if isDesktop}\n <DropdownMenu.Group {...restProps}>\n {@render children?.()}\n </DropdownMenu.Group>\n{:else}\n {@render children?.()}\n{/if}\n", re = "<script lang=\"ts\">\n import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';\n import { Button } from '#lib/components/ui/button/index.js';\n import { getContext } from 'svelte';\n import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\n let { children, href = undefined, ...restProps } = $props();\n\n const { isDesktop } =\n getContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\n<\/script>\n\n{#if isDesktop}\n {#if href && !restProps.onclick}\n <!-- A link rather than goto(), which rejects any URL that is not a page of\n the app: SvelteKit still routes app pages, and the browser loads the rest. -->\n <DropdownMenu.Item {...restProps}>\n {#snippet child({ props })}\n <a {href} {...props}>\n {@render children?.()}\n </a>\n {/snippet}\n </DropdownMenu.Item>\n {:else}\n <DropdownMenu.Item {...restProps}>\n {@render children?.()}\n </DropdownMenu.Item>\n {/if}\n{:else}\n <Button\n class=\"w-full justify-start md:justify-center md:w-auto\"\n variant=\"ghost\"\n {href}\n {...restProps}\n >\n {@render children?.()}\n </Button>\n{/if}\n", ie = "<script lang=\"ts\">\n import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';\n import { getContext } from 'svelte';\n import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\n const { isDesktop } =\n getContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\n let { children, ...restProps } = $props();\n<\/script>\n\n{#if isDesktop}\n <DropdownMenu.Label {...restProps}>\n {@render children?.()}\n </DropdownMenu.Label>\n{/if}\n", ae = "<script lang=\"ts\">\n import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';\n import { getContext } from 'svelte';\n import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\n const { isDesktop } =\n getContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\n let restProps = $props();\n<\/script>\n\n{#if isDesktop}\n <DropdownMenu.Separator {...restProps} />\n{/if}\n", oe = "<script lang=\"ts\">\n import { cn } from '#lib/utils.js';\n import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';\n import { getContext } from 'svelte';\n import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\n let { class: className = '', ...restProps } = $props();\n\n const { isDesktop } =\n getContext<AuthMenuContext>(AUTH_MENU_CONTEXT_KEY) ?? ({ isDesktop: false } as AuthMenuContext);\n<\/script>\n\n{#if isDesktop}\n <DropdownMenu.Trigger class={cn('inline-flex', className)} {...restProps} />\n{/if}\n", se = "<script lang=\"ts\">\n import { page } from '$app/state';\n import { browser } from '$app/env';\n import { onMount, setContext } from 'svelte';\n import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';\n import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';\n\n let { user, guest } = $props();\n\n const breakpoint = 768;\n const breakpointQuery = `(min-width: ${breakpoint}px)`;\n\n let hasMounted = $state(false);\n let authMenuContext = $state<AuthMenuContext>({ isDesktop: true });\n\n setContext(AUTH_MENU_CONTEXT_KEY, authMenuContext);\n\n function updateIsDesktop() {\n if (!browser) return;\n authMenuContext.isDesktop = window.matchMedia(breakpointQuery).matches;\n }\n\n onMount(() => {\n updateIsDesktop();\n hasMounted = true;\n const mq = window.matchMedia(breakpointQuery);\n const listener = () => (authMenuContext.isDesktop = mq.matches);\n mq.addEventListener('change', listener);\n return () => mq.removeEventListener('change', listener);\n });\n<\/script>\n\n{#if page.data.user}\n {#if authMenuContext.isDesktop}\n <DropdownMenu.Root>\n {@render user?.()}\n </DropdownMenu.Root>\n {:else}\n <!-- This prevents the menu from being rendered twice before we know if we're on desktop or not -->\n {#if hasMounted}\n {@render user?.()}\n {/if}\n {/if}\n{:else}\n {@render guest?.()}\n{/if}\n", ce = "export type AuthMenuContext = {\n isDesktop: boolean;\n};\n\nexport const AUTH_MENU_CONTEXT_KEY = Symbol(\"auth-menu-context\");\n", le = "import Root from \"./auth-menu.svelte\";\nimport Content from \"./auth-menu-content.svelte\";\nimport Trigger from \"./auth-menu-trigger.svelte\";\nimport Group from \"./auth-menu-group.svelte\";\nimport Label from \"./auth-menu-label.svelte\";\nimport Separator from \"./auth-menu-separator.svelte\";\nimport Item from \"./auth-menu-item.svelte\";\n\nexport { Root, Content, Trigger, Group, Label, Separator, Item };\n", ue = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '#lib/utils.js';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: string | undefined } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {#if value}\n {new Date(value).toLocaleDateString()}\n {/if}\n</div>\n", de = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '#lib/utils.js';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: boolean | undefined } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {value ? 'Yes' : 'No'}\n</div>\n", fe = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '#lib/utils.js';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: string | undefined } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {#if value}\n {new Date(value).toLocaleDateString()}\n {/if}\n</div>\n", pe = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '#lib/utils.js';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: string | undefined } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {value}\n</div>\n", me = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '#lib/utils.js';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: string | undefined } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {value}\n</div>\n", he = "<script lang=\"ts\">\n import FileIcon from '@lucide/svelte/icons/file';\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '#lib/utils.js';\n\n let {\n value,\n collectionId,\n id,\n class: className,\n ...restProps\n }: {\n value: string[] | string | undefined;\n collectionId: string;\n id: string;\n } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {#if value}\n {#if Array.isArray(value)}\n {#each value.slice(0, 2) as filename}\n {#if ['.jpg', '.png', '.jpeg', '.webp', '.gif'].some((ext) => filename.endsWith(ext))}\n <img\n src=\"/api/files/{collectionId}/{id}/{filename}\"\n class=\"w-8 h-8 rounded-sm object-cover inline-block mr-2\"\n alt={filename}\n title={filename}\n />\n {:else}\n <div\n class=\"inline-flex items-center justify-center w-8 h-8 bg-muted rounded-sm mr-2\"\n title={filename}\n >\n <FileIcon class=\"w-4 h-4\" />\n </div>\n {/if}\n {/each}\n {#if value.length > 2}\n and {value.length - 2} more files\n {/if}\n {:else if ['.jpg', '.png', '.jpeg', '.webp', '.gif'].some((ext) => value.endsWith(ext))}\n <img\n src=\"/api/files/{collectionId}/{id}/{value}\"\n class=\"w-8 h-8 rounded-sm object-cover\"\n alt={value}\n title={value}\n />\n {:else}\n <div\n class=\"inline-flex items-center justify-center w-8 h-8 bg-muted rounded-sm\"\n title={value}\n >\n <FileIcon class=\"w-4 h-4\" />\n </div>\n {/if}\n {/if}\n</div>\n", ge = "<script lang=\"ts\">\n import MapPinIcon from '@lucide/svelte/icons/map-pin';\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '#lib/utils.js';\n\n let {\n value,\n class: className,\n ...restProps\n }: {\n value: { lat: number; lon: number } | undefined;\n } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center space-x-1', className)} {...restProps}>\n {#if value}\n <MapPinIcon class=\"inline-block w-4 h-4 text-muted-foreground\" />\n <span>{value.lat.toFixed(6)}, {value.lon.toFixed(6)}</span>\n {/if}\n</div>\n", _e = "export { default as AutodateCell } from \"./autodate.svelte\";\nexport { default as BoolCell } from \"./bool.svelte\";\nexport { default as DateCell } from \"./date.svelte\";\nexport { default as EditorCell } from \"./editor.svelte\";\nexport { default as EmailCell } from \"./email.svelte\";\nexport { default as FileCell } from \"./file.svelte\";\nexport { default as GeoPointCell } from \"./geoPoint.svelte\";\nexport { default as JsonCell } from \"./json.svelte\";\nexport { default as NumberCell } from \"./number.svelte\";\nexport { default as PasswordCell } from \"./password.svelte\";\nexport { default as RelationCell } from \"./relation.svelte\";\nexport { default as SelectCell } from \"./select.svelte\";\nexport { default as TextCell } from \"./text.svelte\";\nexport { default as UrlCell } from \"./url.svelte\";\n", ve = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '#lib/utils.js';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: any } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {#if value !== undefined}\n {JSON.stringify(value)}\n {/if}\n</div>\n", ye = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '#lib/utils.js';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: number | undefined } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {value}\n</div>\n", be = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '#lib/utils.js';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: string | undefined } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>********</div>\n", xe = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { Badge } from '#lib/components/ui/badge/index.js';\n import { cn } from '#lib/utils.js';\n\n let {\n value,\n expanded,\n displayField = 'id',\n class: className,\n ...restProps\n }: {\n value: string[] | string | undefined;\n expanded: any;\n displayField?: string;\n } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {#if expanded}\n {#if Array.isArray(expanded)}\n {#each expanded.slice(0, 2) as item}\n <Badge variant=\"outline\" class=\"mr-1\">\n {item[displayField]}\n </Badge>\n {/each}\n {#if expanded.length > 2}\n <Badge variant=\"secondary\" class=\"mr-1\">\n +{expanded.length - 2}\n </Badge>\n {/if}\n {:else}\n <Badge variant=\"outline\" class=\"mr-1\">\n {expanded[displayField]}\n </Badge>\n {/if}\n {/if}\n</div>\n", Se = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { Badge } from '#lib/components/ui/badge/index.js';\n import { cn } from '#lib/utils.js';\n\n let {\n value,\n options,\n class: className,\n ...restProps\n }: {\n value: string[] | string | undefined;\n options: Record<string, { label: string; value: string }>;\n } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {#if value}\n {#if Array.isArray(value)}\n {#each value.slice(0, 2) as item}\n <Badge variant=\"outline\" class=\"mr-1\">\n {options[item].label}\n </Badge>\n {/each}\n {:else}\n {options[value].label}\n {/if}\n {/if}\n</div>\n", Ce = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '#lib/utils.js';\n\n let {\n value,\n class: className,\n ...restProps\n }: { value: string | undefined } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {value}\n</div>\n", D = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '#lib/utils.js';\n\n let {\n value,\n class: className,\n target = '_blank',\n rel = 'noopener noreferrer',\n ...restProps\n }: {\n value: string | undefined;\n target?: string;\n rel?: string;\n } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n<div class={cn('flex items-center', className)} {...restProps}>\n {#if value}\n <a href={value} {target} {rel}>{value}</a>\n {/if}\n</div>\n", O = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import type { Column_RowSorting } from '@tanstack/table-core';\n import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';\n import { Button } from '#lib/components/ui/button/index.js';\n import ArrowUpIcon from '@lucide/svelte/icons/arrow-up';\n import ArrowDownIcon from '@lucide/svelte/icons/arrow-down';\n import ChevronsUpDownIcon from '@lucide/svelte/icons/chevrons-up-down';\n import { cn } from '#lib/utils.js';\n\n let {\n column,\n title,\n class: className,\n ...restProps\n }: { column: Column_RowSorting<any, any>; title: string } & HTMLAttributes<HTMLDivElement> = $props();\n<\/script>\n\n{#if !column?.getCanSort()}\n <div class={className} {...restProps}>\n {title}\n </div>\n{:else}\n <div class={cn('flex items-center', className)} {...restProps}>\n <DropdownMenu.Root>\n <DropdownMenu.Trigger>\n {#snippet child({ props })}\n <Button\n {...props}\n variant=\"ghost\"\n size=\"sm\"\n class=\"data-[state=open]:bg-accent -ml-3 h-8\"\n >\n <span>\n {title}\n </span>\n {#if column.getIsSorted() === 'desc'}\n <ArrowDownIcon />\n {:else if column.getIsSorted() === 'asc'}\n <ArrowUpIcon />\n {:else}\n <ChevronsUpDownIcon />\n {/if}\n </Button>\n {/snippet}\n </DropdownMenu.Trigger>\n <DropdownMenu.Content align=\"start\">\n <DropdownMenu.Item onclick={() => column.toggleSorting(false)}>\n <ArrowUpIcon class=\"text-muted-foreground/70 mr-2 size-3.5\" />\n Asc\n </DropdownMenu.Item>\n <DropdownMenu.Item onclick={() => column.toggleSorting(true)}>\n <ArrowDownIcon class=\"text-muted-foreground/70 mr-2 size-3.5\" />\n Desc\n </DropdownMenu.Item>\n </DropdownMenu.Content>\n </DropdownMenu.Root>\n </div>\n{/if}\n", k = "export { default as ColumnHeader } from \"./column-header.svelte\";\n", A = "import {\n type CellData,\n type RowData,\n type Table,\n type TableFeatures,\n type TableOptions,\n constructTable,\n} from \"@tanstack/table-core\";\nimport type {\n TableAtomOptions,\n TableReactivityBindings,\n} from \"@tanstack/table-core/reactivity\";\nimport { storeReactivityBindings } from \"@tanstack/table-core/store-reactivity-bindings\";\nimport { untrack } from \"svelte\";\n\ndeclare module \"@tanstack/table-core\" {\n interface ColumnMeta<\n in out TFeatures extends TableFeatures,\n in out TData extends RowData,\n TValue extends CellData = CellData,\n > {\n /** Classes for the column's header and body cells; pages read `columnDef.meta?.class`. */\n class?: string;\n }\n}\n\n/**\n * Creates a reactive TanStack Table (v9) for Svelte 5.\n *\n * A local copy of `createTable` from `@tanstack/svelte-table`, so a project\n * needs only `@tanstack/table-core`. Table APIs and `table.atoms.<slice>.get()`\n * reads are reactive in templates, `$derived` and `$effect`; pass rune values\n * such as `data` through getters so the table sees their changes.\n *\n * @example\n * ```svelte\n * <script lang=\"ts\">\n * const features = tableFeatures({ rowSortingFeature, sortedRowModel: createSortedRowModel() });\n * const table = createTable({\n * features,\n * columns,\n * get data() {\n * return data.items;\n * },\n * });\n * <\/script>\n *\n * <table>\n * <thead>\n * {#each table.getHeaderGroups() as headerGroup (headerGroup.id)}\n * <tr>\n * {#each headerGroup.headers as header (header.id)}\n * <th colspan={header.colSpan}><FlexRender {header} /></th>\n * {/each}\n * </tr>\n * {/each}\n * </thead>\n * <!-- ... -->\n * </table>\n * ```\n */\nexport function createTable<\n TFeatures extends TableFeatures,\n TData extends RowData,\n>(tableOptions: TableOptions<TFeatures, TData>): Table<TFeatures, TData> {\n const mergedOptions = mergeObjects(tableOptions, {\n features: {\n coreReactivityFeature: svelteReactivity(),\n ...tableOptions.features,\n },\n });\n\n const resolvedOptions = mergeObjects(\n {\n mergeOptions: (\n defaultOptions: TableOptions<TFeatures, TData>,\n newOptions: Partial<TableOptions<TFeatures, TData>>,\n ) => flatMerge(defaultOptions, newOptions),\n },\n mergedOptions,\n );\n\n const table = constructTable(resolvedOptions);\n\n // Getters are resolved outside `untrack` so rune-backed `data`, columns and\n // controlled state become dependencies; `setOptions` runs inside it so the\n // write does not subscribe this effect to the table's own atoms. `pre`, so\n // `getRowModel()` sees the new options before the DOM updates.\n $effect.pre(() => {\n const nextOptions = flatMerge(mergedOptions);\n const state = nextOptions.state as Record<string, unknown> | undefined;\n if (state) {\n for (const key in state) {\n void state[key];\n }\n }\n untrack(() => {\n table.setOptions((prev) => flatMerge(prev, nextOptions));\n });\n });\n\n return table;\n}\n\ntype Observer<T> = ((value: T) => void) | { next?: (value: T) => void };\n\nconst OPTIONS_STORE = \"table/optionsStore\";\n\nfunction subscribeToRune<T>(getValue: () => T, observer: Observer<T>) {\n const callback =\n typeof observer === \"function\"\n ? observer\n : (value: T) => observer.next?.(value);\n const unsubscribe = $effect.root(() => {\n $effect(() => {\n const value = getValue();\n untrack(() => callback(value));\n });\n });\n return { unsubscribe };\n}\n\n/**\n * The table's atoms are TanStack Store atoms (table-core's own copy, so they\n * share its dependency tracking); readonly ones are bridged into runes so a\n * `.get()` in a template or `$derived` re-runs when the atom changes. The\n * options store is a plain rune, since row models read `table.options` during\n * render.\n */\nfunction svelteReactivity(): TableReactivityBindings {\n const store = storeReactivityBindings();\n\n function createReadonlyAtom<T>(\n fn: () => T,\n options?: TableAtomOptions<T>,\n ): ReturnType<typeof store.createReadonlyAtom<T>> {\n const atom = store.createReadonlyAtom(fn, options);\n let version = $state(0);\n $effect(() => {\n const subscription = atom.subscribe(() => {\n version += 1;\n });\n return () => subscription.unsubscribe();\n });\n const value = $derived.by(() => {\n void version;\n return atom.get();\n });\n\n return {\n // Both reads matter: the atom read keeps store-level tracking between\n // table atoms, and `value` registers the current Svelte scope.\n get: () => {\n const current = atom.get();\n void value;\n return current;\n },\n subscribe: ((observer: Observer<T>) =>\n subscribeToRune(() => value, observer)) as typeof atom.subscribe,\n };\n }\n\n function createWritableAtom<T>(\n initialValue: T,\n options?: TableAtomOptions<T>,\n ): ReturnType<typeof store.createWritableAtom<T>> {\n if (options?.debugName !== OPTIONS_STORE) {\n return store.createWritableAtom(initialValue, options);\n }\n let value = $state(initialValue);\n return {\n get: () => value,\n set: (updater: T | ((prev: T) => T)) => {\n value =\n typeof updater === \"function\"\n ? (updater as (prev: T) => T)(value)\n : updater;\n },\n subscribe: ((observer: Observer<T>) =>\n subscribeToRune(() => value, observer)) as ReturnType<\n typeof store.createWritableAtom<T>\n >[\"subscribe\"],\n };\n }\n\n return { ...store, untrack, createReadonlyAtom, createWritableAtom };\n}\n\ntype MaybeThunk<T extends object> = T | (() => T | null | undefined);\ntype Intersection<T extends readonly unknown[]> = (T extends [\n infer H,\n ...infer R,\n]\n ? H & Intersection<R>\n : unknown) & {};\n\n/**\n * Merges objects while keeping their getters alive: every key reads through\n * to the last source that defines it.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function mergeObjects<Sources extends readonly MaybeThunk<any>[]>(\n ...sources: Sources\n): Intersection<{ [K in keyof Sources]: Sources[K] }> {\n const target = {};\n for (let source of sources) {\n if (typeof source === \"function\") source = source();\n if (!source) continue;\n for (const key of Object.keys(Object.getOwnPropertyDescriptors(source))) {\n if (key in target) continue;\n Object.defineProperty(target, key, {\n enumerable: true,\n get() {\n for (let i = sources.length - 1; i >= 0; i--) {\n let s = sources[i];\n if (typeof s === \"function\") s = s();\n const v = (s || {})[key];\n if (v !== undefined) return v;\n }\n },\n });\n }\n }\n return target as Intersection<{ [K in keyof Sources]: Sources[K] }>;\n}\n\n/**\n * Merges objects by reading every value once, so repeated merges inside the\n * sync effect do not build ever-longer getter chains. Later sources win;\n * `undefined` never overrides.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function flatMerge<Sources extends readonly MaybeThunk<any>[]>(\n ...sources: Sources\n): Intersection<{ [K in keyof Sources]: Sources[K] }> {\n const result: Record<PropertyKey, unknown> = {};\n for (let source of sources) {\n if (typeof source === \"function\") source = source();\n if (!source) continue;\n for (const key of Reflect.ownKeys(source)) {\n const value = source[key];\n if (value !== undefined) result[key] = value;\n }\n }\n return result as Intersection<{ [K in keyof Sources]: Sources[K] }>;\n}\n", we = "<script\n lang=\"ts\"\n generics=\"TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData\"\n>\n import type {\n Cell,\n CellContext,\n CellData,\n ColumnDefTemplate,\n Header,\n HeaderContext,\n RowData,\n TableFeatures\n } from '@tanstack/table-core';\n import { RenderComponentConfig, RenderSnippetConfig } from './render-helpers.js';\n\n type Context = HeaderContext<TFeatures, TData, TValue> | CellContext<TFeatures, TData, TValue>;\n\n type Props =\n | {\n /** The `header`/`cell` template of a column definition. */\n content?: ColumnDefTemplate<Context>;\n /** What the header's or cell's `getContext()` returned. */\n context: Context;\n cell?: never;\n header?: never;\n footer?: never;\n }\n | { cell: Cell<TFeatures, TData, TValue>; content?: never; context?: never; header?: never; footer?: never }\n | { header: Header<TFeatures, TData, TValue>; content?: never; context?: never; cell?: never; footer?: never }\n | { footer: Header<TFeatures, TData, TValue>; content?: never; context?: never; cell?: never; header?: never };\n\n let props: Props = $props();\n\n const resolved = $derived.by(() => {\n if (props.cell) {\n return { content: props.cell.column.columnDef.cell, context: props.cell.getContext() };\n }\n if (props.header) {\n return { content: props.header.column.columnDef.header, context: props.header.getContext() };\n }\n if (props.footer) {\n return { content: props.footer.column.columnDef.footer, context: props.footer.getContext() };\n }\n return { content: props.content, context: props.context };\n });\n\n const result = $derived(\n typeof resolved.content === 'function'\n ? // A header template never receives a cell context and vice versa.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (resolved.content as (context: any) => unknown)(resolved.context)\n : undefined\n );\n<\/script>\n\n{#if typeof resolved.content === 'string'}\n {resolved.content}\n{:else if result instanceof RenderComponentConfig}\n <result.component {...result.props} />\n{:else if result instanceof RenderSnippetConfig}\n {@render result.snippet(result.params)}\n{:else if result !== undefined && result !== null}\n {result}\n{/if}\n", Te = "export { default as FlexRender } from \"./flex-render.svelte\";\nexport { renderComponent, renderSnippet } from \"./render-helpers.js\";\nexport { createTable } from \"./data-table.svelte.js\";\n", Ee = "import type { Component, ComponentProps, Snippet } from \"svelte\";\n\n/**\n * A helper class to make it easy to identify Svelte components in\n * `columnDef.cell` and `columnDef.header` properties.\n *\n * > NOTE: This class should only be used internally by the adapter. If you're\n * reading this and you don't know what this is for, you probably don't need it.\n *\n * @example\n * ```svelte\n * {@const result = content(context as any)}\n * {#if result instanceof RenderComponentConfig}\n * {@const { component: Component, props } = result}\n * <Component {...props} />\n * {/if}\n * ```\n */\nexport class RenderComponentConfig<TComponent extends Component> {\n component: TComponent;\n props: ComponentProps<TComponent> | Record<string, never>;\n constructor(\n component: TComponent,\n props: ComponentProps<TComponent> | Record<string, never> = {},\n ) {\n this.component = component;\n this.props = props;\n }\n}\n\n/**\n * A helper class to make it easy to identify Svelte Snippets in `columnDef.cell` and `columnDef.header` properties.\n *\n * > NOTE: This class should only be used internally by the adapter. If you're\n * reading this and you don't know what this is for, you probably don't need it.\n *\n * @example\n * ```svelte\n * {@const result = content(context as any)}\n * {#if result instanceof RenderSnippetConfig}\n * {@const { snippet, params } = result}\n * {@render snippet(params)}\n * {/if}\n * ```\n */\nexport class RenderSnippetConfig<TProps> {\n snippet: Snippet<[TProps]>;\n params: TProps;\n constructor(snippet: Snippet<[TProps]>, params: TProps) {\n this.snippet = snippet;\n this.params = params;\n }\n}\n\n/**\n * A helper function to help create cells from Svelte components through ColumnDef's `cell` and `header` properties.\n *\n * This is only to be used with Svelte Components - use `renderSnippet` for Svelte Snippets.\n *\n * @param component A Svelte component\n * @param props The props to pass to `component`\n * @returns A `RenderComponentConfig` object that helps svelte-table know how to render the header/cell component.\n * @example\n * ```ts\n * // +page.svelte\n * const defaultColumns = [\n * columnHelper.accessor('name', {\n * header: header => renderComponent(SortHeader, { label: 'Name', header }),\n * }),\n * columnHelper.accessor('state', {\n * header: header => renderComponent(SortHeader, { label: 'State', header }),\n * }),\n * ]\n * ```\n * @see {@link https://tanstack.com/table/latest/docs/guide/column-defs}\n */\nexport function renderComponent<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends Component<any>,\n Props extends ComponentProps<T>,\n>(component: T, props: Props = {} as Props) {\n return new RenderComponentConfig(component, props);\n}\n\n/**\n * A helper function to help create cells from Svelte Snippets through ColumnDef's `cell` and `header` properties.\n *\n * The snippet must only take one parameter.\n *\n * This is only to be used with Snippets - use `renderComponent` for Svelte Components.\n *\n * @param snippet\n * @param params\n * @returns - A `RenderSnippetConfig` object that helps svelte-table know how to render the header/cell snippet.\n * @example\n * ```ts\n * // +page.svelte\n * const defaultColumns = [\n * columnHelper.accessor('name', {\n * cell: cell => renderSnippet(nameSnippet, { name: cell.row.name }),\n * }),\n * columnHelper.accessor('state', {\n * cell: cell => renderSnippet(stateSnippet, { state: cell.row.state }),\n * }),\n * ]\n * ```\n * @see {@link https://tanstack.com/table/latest/docs/guide/column-defs}\n */\nexport function renderSnippet<TProps>(\n snippet: Snippet<[TProps]>,\n params: TProps = {} as TProps,\n) {\n return new RenderSnippetConfig(snippet, params);\n}\n", De = "<script lang=\"ts\">\n import type { Component } from 'svelte';\n import { SvelteSet } from 'svelte/reactivity';\n import type { Column_ColumnFaceting, Column_ColumnFiltering } from '@tanstack/table-core';\n import CirclePlusIcon from '@lucide/svelte/icons/circle-plus';\n import CheckIcon from '@lucide/svelte/icons/check';\n import * as Command from '#lib/components/ui/command/index.js';\n import * as Popover from '#lib/components/ui/popover/index.js';\n import { Button } from '#lib/components/ui/button/index.js';\n import { Separator } from '#lib/components/ui/separator/index.js';\n import { Badge } from '#lib/components/ui/badge/index.js';\n import { cn } from '#lib/utils.js';\n\n let {\n column,\n title,\n options\n }: {\n column: Column_ColumnFiltering<any, any> & Column_ColumnFaceting<any, any>;\n title: string;\n options: {\n label: string;\n value: string;\n icon?: Component;\n }[];\n } = $props();\n\n const facets = $derived(column?.getFacetedUniqueValues());\n const selectedValues = $derived(new SvelteSet(column?.getFilterValue() as string[]));\n<\/script>\n\n<Popover.Root>\n <Popover.Trigger>\n {#snippet child({ props })}\n <Button {...props} variant=\"outline\" size=\"sm\" class=\"h-8 border-dashed\">\n <CirclePlusIcon />\n {title}\n {#if selectedValues.size > 0}\n <Separator orientation=\"vertical\" class=\"mx-2 h-4\" />\n <Badge variant=\"secondary\" class=\"rounded-sm px-1 font-normal lg:hidden\">\n {selectedValues.size}\n </Badge>\n <div class=\"hidden space-x-1 lg:flex\">\n {#if selectedValues.size > 2}\n <Badge variant=\"secondary\" class=\"rounded-sm px-1 font-normal\">\n {selectedValues.size} selected\n </Badge>\n {:else}\n {#each options.filter((opt) => selectedValues.has(opt.value)) as option (option)}\n <Badge variant=\"secondary\" class=\"rounded-sm px-1 font-normal\">\n {option.label}\n </Badge>\n {/each}\n {/if}\n </div>\n {/if}\n </Button>\n {/snippet}\n </Popover.Trigger>\n <Popover.Content class=\"w-[200px] p-0\" align=\"start\">\n <Command.Root>\n <Command.Input placeholder={title} />\n <Command.List>\n <Command.Empty>No results found.</Command.Empty>\n <Command.Group>\n {#each options as option (option)}\n {@const isSelected = selectedValues.has(option.value)}\n <Command.Item\n onSelect={() => {\n if (isSelected) {\n selectedValues.delete(option.value);\n } else {\n selectedValues.add(option.value);\n }\n const filterValues = Array.from(selectedValues);\n column?.setFilterValue(filterValues.length ? filterValues : undefined);\n }}\n >\n <div\n class={cn(\n 'border-primary mr-2 flex size-4 items-center justify-center rounded-sm border',\n isSelected ? 'bg-primary text-primary-foreground' : 'opacity-50 [&_svg]:invisible'\n )}\n >\n <CheckIcon class=\"size-4\" />\n </div>\n {#if option.icon}\n {@const Icon = option.icon}\n <Icon class=\"text-muted-foreground\" />\n {/if}\n\n <span>{option.label}</span>\n {#if facets?.get(option.value)}\n <span class=\"ml-auto flex size-4 items-center justify-center font-mono text-xs\">\n {facets.get(option.value)}\n </span>\n {/if}\n </Command.Item>\n {/each}\n </Command.Group>\n {#if selectedValues.size > 0}\n <Command.Separator />\n <Command.Group>\n <Command.Item\n onSelect={() => column?.setFilterValue(undefined)}\n class=\"justify-center text-center\"\n >\n Clear filters\n </Command.Item>\n </Command.Group>\n {/if}\n </Command.List>\n </Command.Root>\n </Popover.Content>\n</Popover.Root>\n", Oe = "export { default as FacetedFilter } from \"./faceted-filter.svelte\";\n", ke = "<script lang=\"ts\" generics=\"T extends Record<string, unknown>, U extends FormPath<T>\">\n import * as FormPrimitive from 'formsnap';\n import type { FormPath } from 'sveltekit-superforms';\n import { cn, type WithElementRef, type WithoutChildren } from '#lib/utils.js';\n import type { HTMLAttributes } from 'svelte/elements';\n import { setContext } from 'svelte';\n\n let {\n ref = $bindable(null),\n class: className,\n form,\n name,\n children: childrenProp,\n ...restProps\n }: FormPrimitive.FieldProps<T, U> &\n WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>> = $props();\n\n setContext('file-field', {\n get form() {\n return form;\n },\n get name() {\n return name;\n }\n });\n<\/script>\n\n<FormPrimitive.Field {form} {name}>\n {#snippet children({ constraints, errors, tainted, value })}\n <div bind:this={ref} data-slot=\"form-item\" class={cn('space-y-2', className)} {...restProps}>\n {@render childrenProp?.({ constraints, errors, tainted, value: value as T[U] })}\n </div>\n {/snippet}\n</FormPrimitive.Field>\n", Ae = "<script lang=\"ts\">\n import { getContext } from 'svelte';\n import { fileProxy, filesProxy, type SuperForm } from 'sveltekit-superforms';\n import { Input } from '#lib/components/ui/input/index.js';\n\n const ctx = getContext<{ form: SuperForm<any, any>; name: string }>('file-field');\n const { multiple } = getContext<{ multiple: boolean }>('file-field-multiple');\n\n const files = multiple ? filesProxy(ctx.form, `${ctx.name}+`) : fileProxy(ctx.form, ctx.name);\n const { form: formData, reset } = ctx.form;\n\n const { ...props } = $props();\n\n const onchange = () => {\n reset({\n data: $formData\n });\n };\n<\/script>\n\n{#if !multiple}\n {#if $formData[ctx.name]}\n {#if typeof $formData[ctx.name] === 'string'}\n <input type=\"text\" name={ctx.name} value={$formData[ctx.name]} class=\"hidden\" />\n {:else}\n <input type=\"file\" name={ctx.name} files={$files} class=\"hidden\" />\n {/if}\n {:else}\n <input type=\"text\" name={ctx.name} value=\"\" class=\"hidden\" />\n {/if}\n{/if}\n\n<Input\n type=\"file\"\n bind:files={$files}\n {multiple}\n {onchange}\n {...props}\n name={multiple ? `${ctx.name}+` : ''}\n/>\n", je = "<script lang=\"ts\">\n import { setContext, getContext } from 'svelte';\n import { type SuperForm } from 'sveltekit-superforms';\n import { getName } from './shared';\n\n const ctx = getContext<{ form: SuperForm<any, any>; name: string }>('file-field');\n const {\n display,\n input\n }: {\n display: (props: {\n file: File | string;\n filename: string;\n onremove: (file: File | string) => void;\n }) => any;\n input: () => any;\n } = $props();\n\n setContext('file-field-multiple', { multiple: true });\n\n const { form: formData, reset } = ctx.form;\n\n let removed = $state<string[]>([]);\n\n const onremove = (file: File | string) => {\n if (typeof file === 'string') {\n removed.push(file);\n } else {\n if (Array.isArray($formData[`${ctx.name}+`])) {\n reset({\n data: {\n ...$formData,\n [`${ctx.name}+`]: $formData[`${ctx.name}+`].filter((f: File | string) => f !== file) as\n | File[]\n | undefined\n }\n });\n }\n }\n };\n\n const initialFiles = $formData[ctx.name] || [];\n<\/script>\n\n{#if initialFiles}\n {#each initialFiles as file}\n {#if !removed.includes(file)}\n {@render display({ file, filename: getName(file), onremove })}\n {/if}\n {/each}\n{/if}\n\n{#each $formData[`${ctx.name}+`] as file}\n {#if file && typeof file !== 'string'}\n {@render display({ file, filename: getName(file), onremove })}\n {/if}\n{/each}\n\n{#each removed as removedFile}\n <input type=\"text\" name={`${ctx.name}-`} value={removedFile} class=\"hidden\" />\n{/each}\n\n{@render input()}\n", Me = "<script lang=\"ts\">\n import { setContext, getContext } from 'svelte';\n import { type SuperForm } from 'sveltekit-superforms';\n import { getName } from './shared';\n\n const ctx = getContext<{ form: SuperForm<any, any>; name: string }>('file-field');\n const {\n display,\n input\n }: {\n display: (props: {\n file: File | string;\n filename: string;\n onremove: (file: File | string) => void;\n }) => any;\n input: () => any;\n } = $props();\n\n const { form: formData, reset } = ctx.form;\n\n setContext('file-field-multiple', { multiple: false });\n\n const onremove = () => {\n reset({\n data: {\n ...$formData,\n [ctx.name]: ''\n }\n });\n };\n<\/script>\n\n{#if $formData[ctx.name]}\n {@render display({ file: $formData[ctx.name], filename: getName($formData[ctx.name]), onremove })}\n{/if}\n\n{@render input()}\n", Ne = "<script lang=\"ts\">\n import { getContext } from 'svelte';\n import { type SuperForm } from 'sveltekit-superforms';\n import FileIcon from '@lucide/svelte/icons/file';\n import ImageIcon from '@lucide/svelte/icons/image';\n import { cn } from '#lib/utils.js';\n import type { HTMLAttributes } from 'svelte/elements';\n\n const ctx = getContext<{ form: SuperForm<any, any>; name: string }>('file-field');\n const { form: formData } = ctx.form;\n\n const {\n file,\n filename,\n collectionId,\n id,\n thumb = '50x50',\n class: className,\n type = 'image',\n ...props\n }: {\n file: File | string;\n filename: string;\n collectionId?: string;\n id?: string;\n thumb?: string;\n class?: string;\n type?: 'image' | 'file';\n } & HTMLAttributes<HTMLImageElement> = $props();\n\n const isImage = $derived(\n type === 'image' ||\n filename.toLowerCase().endsWith('.png') ||\n filename.toLowerCase().endsWith('.jpg') ||\n filename.toLowerCase().endsWith('.jpeg') ||\n filename.toLowerCase().endsWith('.gif') ||\n filename.toLowerCase().endsWith('.webp')\n );\n\n function getUrl(file: string) {\n return `/api/files/${collectionId ?? $formData.collectionId}/${id ?? $formData.id}/${file}?thumb=${thumb}`;\n }\n<\/script>\n\n{#if typeof file === 'string'}\n {#if (id ?? $formData.collectionId) && (id ?? $formData.id) && isImage}\n <img src={getUrl(file)} alt={filename} class={className} {...props} />\n {:else}\n <div\n class={cn('flex items-center justify-center w-full h-full bg-muted rounded-md', className)}\n {...props as HTMLAttributes<HTMLDivElement>}\n >\n {#if isImage}\n <ImageIcon class=\"w-4 h-4\" />\n {:else}\n <FileIcon class=\"w-4 h-4\" />\n {/if}\n </div>\n {/if}\n{:else if isImage}\n <img src={URL.createObjectURL(file)} alt={filename} class={className} {...props} />\n{:else}\n <div\n class={cn('flex items-center justify-center w-full h-full bg-muted rounded-md', className)}\n {...props as HTMLAttributes<HTMLDivElement>}\n >\n <FileIcon class=\"w-4 h-4\" />\n </div>\n{/if}\n", Pe = "export { default as Field } from \"./file-field.svelte\";\nexport { default as Single } from \"./file-single.svelte\";\nexport { default as Multiple } from \"./file-multiple.svelte\";\nexport { default as Input } from \"./file-input.svelte\";\nexport { default as Thumb } from \"./file-thumb.svelte\";\n", Fe = "export function getUrl(\n file: File | string,\n collectionId: string,\n recordId: string,\n thumb: string,\n) {\n return typeof file === \"string\"\n ? `/api/files/${collectionId}/${recordId}/${file}?thumb=${thumb}`\n : URL.createObjectURL(file);\n}\n\nexport function getName(file: File | string) {\n return typeof file === \"string\" ? (file.split(\"/\").pop() ?? \"\") : file.name;\n}\n", Ie = "<script lang=\"ts\">\n import { cn } from '#lib/utils.js';\n\n let {\n value = $bindable(),\n id,\n label,\n shortLabel,\n mapOpen\n }: {\n value: number;\n id: string;\n label: string;\n shortLabel: string;\n mapOpen: boolean;\n } = $props();\n<\/script>\n\n<div\n class={cn(\n 'border-input bg-background selection:bg-primary dark:bg-input/30 selection:text-primary-foreground ring-offset-background placeholder:text-muted-foreground shadow-xs flex h-9 w-full min-w-0 rounded-md border px-3 py-1 text-base outline-none transition-[color,box-shadow] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n 'focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]',\n 'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive',\n 'pr-0 flex items-center',\n label === 'Latitude' && 'rounded-r-none',\n label === 'Longitude' && 'rounded-none -ml-px',\n mapOpen && 'rounded-b-none'\n )}\n>\n <label for={id} class=\"text-muted-foreground mr-2\">\n <span class=\"hidden md:block\">{label}</span>\n <span class=\"block md:hidden\">{shortLabel}</span>\n </label>\n\n <input\n bind:value\n type=\"number\"\n class=\"border-none outline-none min-w-0 w-full pr-2\"\n {id}\n step=\"0.000001\"\n />\n</div>\n", Le = "export { default as GeopointInput } from \"./input.svelte\";\n", Re = "<script lang=\"ts\">\n import { setContext } from 'svelte';\n import ToggleMap from './toggle-map.svelte';\n import Coordinate from './coordinate.svelte';\n\n let {\n name,\n value = $bindable()\n }: {\n name: string;\n value: string | undefined;\n } = $props();\n\n const geopoint = $state(value ? JSON.parse(value) : { lat: 0, lon: 0 });\n const map = $state({ open: false });\n\n setContext('geopoint', {\n geopoint,\n map\n });\n\n $effect(() => {\n if (value) {\n const parsed = JSON.parse(value);\n\n if (typeof parsed === 'object' && parsed !== null && 'lat' in parsed && 'lon' in parsed) {\n geopoint.lat = parsed.lat.toFixed(6);\n geopoint.lon = parsed.lon.toFixed(6);\n }\n }\n });\n\n const stringValue = $derived(\n JSON.stringify({ lat: parseFloat(geopoint.lat), lon: parseFloat(geopoint.lon) })\n );\n<\/script>\n\n<input type=\"hidden\" {name} value={stringValue} />\n\n<div class=\"w-full\">\n <div class=\"w-full flex\">\n <Coordinate\n id=\"latitude\"\n label=\"Latitude\"\n shortLabel=\"Lat\"\n bind:value={geopoint.lat}\n mapOpen={map.open}\n />\n <Coordinate\n id=\"longitude\"\n label=\"Longitude\"\n shortLabel=\"Lon\"\n bind:value={geopoint.lon}\n mapOpen={map.open}\n />\n <ToggleMap />\n </div>\n\n {#if map.open}\n {#await import('#lib/components/ui/leaflet/leaflet.svelte')}\n <div class=\"h-[225px] w-full bg-input rounded-b-md\"></div>\n {:then { default: Leaflet }}\n <Leaflet height={225} point={geopoint} class=\"rounded-b-md overflow-hidden\" />\n {/await}\n {/if}\n</div>\n", ze = "<script>\n import { Button } from '#lib/components/ui/button/index.js';\n import MapIcon from '@lucide/svelte/icons/map';\n import { getContext } from 'svelte';\n import { cn } from '#lib/utils.js';\n\n let { map } = getContext('geopoint');\n<\/script>\n\n<Button\n variant=\"outline\"\n size=\"icon\"\n class={cn('w-10 rounded-none rounded-r-md border-l-0', map.open && 'rounded-b-none')}\n onclick={() => (map.open = !map.open)}\n>\n <MapIcon class=\"w-4 h-4\" />\n</Button>\n", Be = "export { default as Leaflet } from \"./leaflet.svelte\";\n", Ve = "<script lang=\"ts\">\n import { onMount } from 'svelte';\n import L from 'leaflet';\n import 'leaflet/dist/leaflet.css';\n\n // manually load the markers so that they can be embedded in the prod bundle\n import markerIconUrl from 'leaflet/dist/images/marker-icon.png';\n import markerIconRetinaUrl from 'leaflet/dist/images/marker-icon-2x.png';\n import markerShadowUrl from 'leaflet/dist/images/marker-shadow.png';\n\n let { height = 225, point = $bindable(), readonly = false, ...props } = $props();\n\n let map: L.Map;\n let mapEl: HTMLElement;\n let marker: L.Marker;\n let panTimeoutId: ReturnType<typeof setTimeout>;\n\n const defaultZoomLevel = 8;\n\n $effect(() => {\n if (point.lat && point.lon) {\n panInside();\n }\n });\n\n function normalizeCoordinate(coord: any) {\n return +(+coord).toFixed(6);\n }\n\n function panInside(debounce = 200) {\n clearTimeout(panTimeoutId);\n panTimeoutId = setTimeout(() => {\n marker?.setLatLng([point.lat, point.lon]);\n map?.panInside([point.lat, point.lon], { padding: [20, 40] });\n }, debounce);\n }\n\n function initMap() {\n const latlon = [\n normalizeCoordinate(point.lat),\n normalizeCoordinate(point.lon)\n ] as L.LatLngTuple;\n\n map = L.map(mapEl, {\n zoomControl: false,\n maxBounds: [\n [-90, -180],\n [90, 180]\n ],\n minZoom: 2\n }).setView(latlon, defaultZoomLevel);\n\n if (readonly) {\n map.dragging.disable();\n map.touchZoom.disable();\n map.doubleClickZoom.disable();\n map.scrollWheelZoom.disable();\n map.boxZoom.disable();\n map.keyboard.disable();\n }\n\n L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {\n attribution: '&copy; <a href=\"https://www.openstreetmap.org/copyright\">OSM</a>',\n noWrap: true\n }).addTo(map);\n\n map.attributionControl.setPrefix('');\n\n // reassign the default marker images with the loaded ones\n // (https://leafletjs.com/reference.html#icon-default-option)\n L.Icon.Default.prototype.options.iconUrl = markerIconUrl;\n L.Icon.Default.prototype.options.iconRetinaUrl = markerIconRetinaUrl;\n L.Icon.Default.prototype.options.shadowUrl = markerShadowUrl;\n L.Icon.Default.imagePath = '';\n\n marker = L.marker(latlon, {\n draggable: true,\n autoPan: true\n }).addTo(map);\n\n marker.bindTooltip('drag or right click anywhere on the map to move');\n\n marker.on('moveend', (e) => {\n if (e.sourceTarget?._latlng) {\n select(e.sourceTarget._latlng.lat, e.sourceTarget._latlng.lng, false);\n }\n });\n\n map.on('contextmenu', (e) => {\n select(e.latlng.lat, e.latlng.lng, false);\n });\n }\n\n function destroyMap() {\n marker?.remove();\n map?.remove();\n }\n\n function select(lat: number, lon: number, centerMap = true) {\n point.lat = normalizeCoordinate(lat);\n point.lon = normalizeCoordinate(lon);\n\n // center the map\n if (centerMap) {\n marker?.setLatLng([point.lat, point.lon]); // optimistic marker update\n map?.panTo([point.lat, point.lon], { animate: false });\n }\n }\n\n onMount(() => {\n initMap();\n\n return () => {\n destroyMap();\n };\n });\n<\/script>\n\n<div class=\"map-wrapper\" style=\"{height ? `height:${height}px` : null};\" {...props}>\n <div bind:this={mapEl} class=\"map-box\"></div>\n</div>\n\n<style>\n .map-wrapper {\n position: relative;\n display: block;\n height: 100%;\n width: 100%;\n }\n .map-box {\n z-index: 1;\n height: 100%;\n width: 100%;\n }\n</style>\n", He = "<script lang=\"ts\">\n import type { Snippet } from 'svelte';\n import { cn } from '#lib/utils.js';\n\n let { children, class: className }: { children: Snippet; class?: string } = $props();\n<\/script>\n\n<span class={cn('bg-secondary text-secondary-foreground px-2 py-1 rounded-sm text-sm', className)}>\n {@render children?.()}\n</span>\n", Ue = "<script lang=\"ts\">\n import { Popover as PopoverPrimitive } from 'bits-ui';\n import * as Popover from '#lib/components/ui/popover/index.js';\n\n let {\n children,\n ...props\n }: PopoverPrimitive.ContentProps & {\n portalProps?: PopoverPrimitive.PortalProps;\n } = $props();\n<\/script>\n\n<Popover.Content {...props}>\n {@render children?.()}\n</Popover.Content>\n", We = "<script lang=\"ts\" generics=\"T extends Record<string, unknown>, U extends FormPath<T>\">\n import * as FormPrimitive from 'formsnap';\n import type { FormPath } from 'sveltekit-superforms';\n import { cn, type WithElementRef, type WithoutChildren } from '#lib/utils.js';\n import type { HTMLAttributes } from 'svelte/elements';\n import { setContext } from 'svelte';\n import * as Popover from '#lib/components/ui/popover/index.js';\n\n let {\n ref = $bindable(null),\n class: className,\n type,\n form,\n name,\n required,\n children: childrenProp,\n ...restProps\n }: FormPrimitive.FieldProps<T, U> & {\n type: 'multiple' | 'single';\n required?: boolean;\n } & WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>> = $props();\n\n const { form: formData } = $derived(form);\n\n const toggleSelected = (value: string) => {\n if (type === 'single') {\n if (!required && $formData[name] === value) {\n $formData[name] = undefined as T[U];\n } else {\n $formData[name] = value as T[U];\n }\n } else if (type === 'multiple') {\n if (!$formData[name]) {\n $formData[name] = [] as T[U];\n }\n\n const currentValue = $formData[name] as string[];\n const index = currentValue.indexOf(value);\n\n if (index > -1) {\n $formData[name] = currentValue.filter((id) => id !== value) as T[U];\n } else {\n $formData[name] = [...currentValue, value] as T[U];\n }\n }\n };\n\n const isSelected = (value: string) => {\n if (type === 'single') {\n return $formData[name] === value;\n } else if (type === 'multiple') {\n return ($formData[name] as string[])?.includes(value) ?? false;\n }\n };\n\n setContext('multiselect-field', {\n get form() {\n return form;\n },\n get name() {\n return name;\n },\n get type() {\n return type;\n },\n toggleSelected,\n isSelected\n });\n<\/script>\n\n<Popover.Root>\n <FormPrimitive.Field {form} {name}>\n {#snippet children({ constraints, errors, tainted, value })}\n <div bind:this={ref} data-slot=\"form-item\" class={cn('space-y-2', className)} {...restProps}>\n {@render childrenProp?.({ constraints, errors, tainted, value: value as T[U] })}\n </div>\n {/snippet}\n </FormPrimitive.Field>\n</Popover.Root>\n", Ge = "export { default as Field } from \"./field.svelte\";\nexport { default as Trigger } from \"./trigger.svelte\";\nexport { default as Input } from \"./input.svelte\";\nexport { default as Content } from \"./content.svelte\";\nexport { default as Item } from \"./item.svelte\";\nexport { default as Chip } from \"./chip.svelte\";\n", Ke = "<script lang=\"ts\" generics=\"T extends string\">\n import type { SuperForm } from 'sveltekit-superforms';\n import { getContext, type Snippet } from 'svelte';\n\n const { form, type } = getContext<{ form: SuperForm<any, any>; type: 'single' | 'multiple' }>(\n 'multiselect-field'\n );\n const { form: formData } = form;\n\n let {\n children,\n placeholder,\n name,\n value = $bindable()\n }: {\n children: Snippet<[{ selected: T[] }]>;\n placeholder?: string;\n name: string;\n value: T[] | T | undefined;\n } = $props();\n<\/script>\n\n{#if value && value.length > 0}\n {@render children?.({ selected: type === 'single' ? [$formData[name]] : $formData[name] })}\n {#if type === 'multiple'}\n {#each value as v}\n <input type=\"hidden\" {name} value={v} />\n {/each}\n {:else}\n <input type=\"hidden\" {name} {value} />\n {/if}\n{:else}\n {placeholder}\n{/if}\n", j = "<script lang=\"ts\">\n import { getContext, type Snippet } from 'svelte';\n import { cn } from '#lib/utils.js';\n import { Command as CommandPrimitive } from 'bits-ui';\n import * as Command from '#lib/components/ui/command/index.js';\n import CheckIcon from '@lucide/svelte/icons/check';\n\n let {\n children,\n value,\n label,\n class: className,\n ...props\n }: CommandPrimitive.ItemProps & {\n value: string;\n label: string | undefined;\n children?: Snippet;\n class?: string;\n } = $props();\n\n const { toggleSelected, isSelected } = getContext<{\n toggleSelected: (value: string) => void;\n isSelected: (value: string) => boolean;\n }>('multiselect-field');\n\n const handleSelect = () => {\n toggleSelected(value);\n };\n<\/script>\n\n<Command.Item\n class={cn('cursor-pointer', className)}\n {...props}\n value={label}\n onSelect={handleSelect}\n>\n {label}\n <CheckIcon class={cn('ml-auto', !isSelected(value) && 'text-transparent')} />\n</Command.Item>\n", qe = "<script lang=\"ts\">\n import * as Popover from '#lib/components/ui/popover/index.js';\n import { Popover as PopoverPrimitive } from 'bits-ui';\n import { cn } from '#lib/utils.js';\n import { buttonVariants } from '#lib/components/ui/button/index.js';\n import ChevronDownIcon from '@lucide/svelte/icons/chevron-down';\n\n let { children, class: className, ...props }: PopoverPrimitive.TriggerProps = $props();\n<\/script>\n\n<Popover.Trigger\n class={cn(buttonVariants({ variant: 'outline' }), className)}\n role=\"combobox\"\n {...props}\n>\n {@render children?.()}\n <ChevronDownIcon class=\"size-4 opacity-50\" />\n</Popover.Trigger>\n", Je = "export { default as Pagination } from \"./pagination.svelte\";\n", Ye = "<script lang=\"ts\">\n import * as Select from '#lib/components/ui/select/index.js';\n import { Button } from '#lib/components/ui/button/index.js';\n import ChevronsLeftIcon from '@lucide/svelte/icons/chevrons-left';\n import ChevronLeftIcon from '@lucide/svelte/icons/chevron-left';\n import ChevronRightIcon from '@lucide/svelte/icons/chevron-right';\n import ChevronsRightIcon from '@lucide/svelte/icons/chevrons-right';\n import type {\n PaginationState,\n Table_RowModels_Filtered,\n Table_RowPagination,\n Table_RowSelection\n } from '@tanstack/table-core';\n\n let {\n table\n }: {\n // Any table with the pagination, row selection and column filtering features.\n table: Table_RowPagination<any, any> &\n Table_RowSelection<any, any> &\n Table_RowModels_Filtered<any, any> & { atoms: { pagination: { get(): PaginationState } } };\n } = $props();\n\n const pagination = $derived(table.atoms.pagination.get());\n<\/script>\n\n<div class=\"flex items-center justify-between px-2\">\n <div class=\"text-muted-foreground flex-1 text-sm\">\n {table.getFilteredSelectedRowModel().rows.length} of\n {table.getFilteredRowModel().rows.length} row(s) selected.\n </div>\n <div class=\"flex items-center space-x-6 lg:space-x-8\">\n <div class=\"flex items-center space-x-2\">\n <p class=\"text-sm font-medium\">Rows per page</p>\n <Select.Root\n allowDeselect={false}\n type=\"single\"\n value={`${pagination.pageSize}`}\n onValueChange={(value) => {\n table.setPageSize(Number(value));\n }}\n >\n <Select.Trigger class=\"h-8 w-[70px]\">\n {String(pagination.pageSize)}\n </Select.Trigger>\n <Select.Content side=\"top\">\n {#each [10, 20, 30, 40, 50] as pageSize (pageSize)}\n <Select.Item value={`${pageSize}`}>\n {pageSize}\n </Select.Item>\n {/each}\n </Select.Content>\n </Select.Root>\n </div>\n <div class=\"flex w-[100px] items-center justify-center text-sm font-medium\">\n Page {pagination.pageIndex + 1} of\n {Math.max(table.getPageCount(), 1)}\n </div>\n <div class=\"flex items-center space-x-2\">\n <Button\n variant=\"outline\"\n class=\"hidden size-8 p-0 lg:flex\"\n onclick={() => table.firstPage()}\n disabled={!table.getCanPreviousPage()}\n >\n <span class=\"sr-only\">Go to first page</span>\n <ChevronsLeftIcon />\n </Button>\n <Button\n variant=\"outline\"\n class=\"size-8 p-0\"\n onclick={() => table.previousPage()}\n disabled={!table.getCanPreviousPage()}\n >\n <span class=\"sr-only\">Go to previous page</span>\n <ChevronLeftIcon />\n </Button>\n <Button\n variant=\"outline\"\n class=\"size-8 p-0\"\n onclick={() => table.nextPage()}\n disabled={!table.getCanNextPage()}\n >\n <span class=\"sr-only\">Go to next page</span>\n <ChevronRightIcon />\n </Button>\n <Button\n variant=\"outline\"\n class=\"hidden size-8 p-0 lg:flex\"\n onclick={() => table.lastPage()}\n disabled={!table.getCanNextPage()}\n >\n <span class=\"sr-only\">Go to last page</span>\n <ChevronsRightIcon />\n </Button>\n </div>\n </div>\n</div>\n", Xe = "export { default as RowActions } from \"./row-actions.svelte\";\n", Ze = "<script lang=\"ts\">\n import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';\n import { Button } from '#lib/components/ui/button/index.js';\n import EllipsisIcon from '@lucide/svelte/icons/ellipsis';\n\n let {\n viewPath,\n editPath,\n deletePath\n }: {\n viewPath: string;\n editPath: string;\n deletePath: string;\n } = $props();\n<\/script>\n\n<DropdownMenu.Root>\n <DropdownMenu.Trigger>\n {#snippet child({ props })}\n <Button {...props} variant=\"ghost\" class=\"data-[state=open]:bg-muted flex h-8 w-8 p-0\">\n <EllipsisIcon />\n <span class=\"sr-only\">Open Menu</span>\n </Button>\n {/snippet}\n </DropdownMenu.Trigger>\n <DropdownMenu.Content class=\"w-[160px]\" align=\"end\">\n <DropdownMenu.Item>\n {#snippet child({ props })}\n <a href={viewPath} {...props}>View</a>\n {/snippet}\n </DropdownMenu.Item>\n <DropdownMenu.Item>\n {#snippet child({ props })}\n <a href={editPath} {...props}>Edit</a>\n {/snippet}\n </DropdownMenu.Item>\n <DropdownMenu.Item>\n <form method=\"POST\" action={deletePath}>\n <button type=\"submit\" class=\"contents\">Delete</button>\n </form>\n </DropdownMenu.Item>\n </DropdownMenu.Content>\n</DropdownMenu.Root>\n", Qe = /* @__PURE__ */ e({
15
+ ensureSvelteKitSync: () => U,
16
+ executeCommand: () => R,
17
+ formatPaths: () => Z,
18
+ getAllCustomComponents: () => N,
19
+ installComponents: () => $,
20
+ installedComponents: () => Q,
21
+ installedPackagesFromProject: () => z,
22
+ isCustomComponent: () => X,
23
+ isExactSpec: () => V,
24
+ packageName: () => B,
25
+ resolveUiDir: () => u,
26
+ restoreDowngradedDependencies: () => q,
27
+ writeResult: () => mt
28
+ }), $e = {
29
+ "file-form": ["input"],
30
+ multiselect: [
31
+ "command",
32
+ "popover",
33
+ "button"
34
+ ],
35
+ geopoint: ["button", "leaflet"],
36
+ cells: ["badge"],
37
+ "data-table": [],
38
+ "column-header": ["dropdown-menu", "button"],
39
+ "faceted-filter": [
40
+ "command",
41
+ "popover",
42
+ "button",
43
+ "separator",
44
+ "badge"
45
+ ],
46
+ pagination: ["button", "select"],
47
+ "row-actions": ["dropdown-menu", "button"],
48
+ leaflet: [],
49
+ "auth-menu": ["dropdown-menu", "button"]
50
+ }, et = {
51
+ "file-form": [o],
52
+ multiselect: [o],
53
+ geopoint: [],
54
+ cells: [],
55
+ "data-table": [a],
56
+ "column-header": [a],
57
+ "faceted-filter": [a],
58
+ pagination: [a],
59
+ "row-actions": [],
60
+ leaflet: ["leaflet", "@types/leaflet"]
61
+ }, M = /* #__PURE__ */ Object.assign({
62
+ "../ui/components/auth-menu/auth-menu-content.svelte": te,
63
+ "../ui/components/auth-menu/auth-menu-group.svelte": ne,
64
+ "../ui/components/auth-menu/auth-menu-item.svelte": re,
65
+ "../ui/components/auth-menu/auth-menu-label.svelte": ie,
66
+ "../ui/components/auth-menu/auth-menu-separator.svelte": ae,
67
+ "../ui/components/auth-menu/auth-menu-trigger.svelte": oe,
68
+ "../ui/components/auth-menu/auth-menu.svelte": se,
69
+ "../ui/components/auth-menu/context.ts": ce,
70
+ "../ui/components/auth-menu/index.ts": le,
71
+ "../ui/components/cells/autodate.svelte": ue,
72
+ "../ui/components/cells/bool.svelte": de,
73
+ "../ui/components/cells/date.svelte": fe,
74
+ "../ui/components/cells/editor.svelte": pe,
75
+ "../ui/components/cells/email.svelte": me,
76
+ "../ui/components/cells/file.svelte": he,
77
+ "../ui/components/cells/geoPoint.svelte": ge,
78
+ "../ui/components/cells/index.ts": _e,
79
+ "../ui/components/cells/json.svelte": ve,
80
+ "../ui/components/cells/number.svelte": ye,
81
+ "../ui/components/cells/password.svelte": be,
82
+ "../ui/components/cells/relation.svelte": xe,
83
+ "../ui/components/cells/select.svelte": Se,
84
+ "../ui/components/cells/text.svelte": Ce,
85
+ "../ui/components/cells/url.svelte": D,
86
+ "../ui/components/column-header/column-header.svelte": O,
87
+ "../ui/components/column-header/index.ts": k,
88
+ "../ui/components/data-table/data-table.svelte.ts": A,
89
+ "../ui/components/data-table/flex-render.svelte": we,
90
+ "../ui/components/data-table/index.ts": Te,
91
+ "../ui/components/data-table/render-helpers.ts": Ee,
92
+ "../ui/components/faceted-filter/faceted-filter.svelte": De,
93
+ "../ui/components/faceted-filter/index.ts": Oe,
94
+ "../ui/components/file-form/file-field.svelte": ke,
95
+ "../ui/components/file-form/file-input.svelte": Ae,
96
+ "../ui/components/file-form/file-multiple.svelte": je,
97
+ "../ui/components/file-form/file-single.svelte": Me,
98
+ "../ui/components/file-form/file-thumb.svelte": Ne,
99
+ "../ui/components/file-form/index.ts": Pe,
100
+ "../ui/components/file-form/shared.ts": Fe,
101
+ "../ui/components/geopoint/coordinate.svelte": Ie,
102
+ "../ui/components/geopoint/index.ts": Le,
103
+ "../ui/components/geopoint/input.svelte": Re,
104
+ "../ui/components/geopoint/toggle-map.svelte": ze,
105
+ "../ui/components/leaflet/index.ts": Be,
106
+ "../ui/components/leaflet/leaflet.svelte": Ve,
107
+ "../ui/components/multiselect/chip.svelte": He,
108
+ "../ui/components/multiselect/content.svelte": Ue,
109
+ "../ui/components/multiselect/field.svelte": We,
110
+ "../ui/components/multiselect/index.ts": Ge,
111
+ "../ui/components/multiselect/input.svelte": Ke,
112
+ "../ui/components/multiselect/item.svelte": j,
113
+ "../ui/components/multiselect/trigger.svelte": qe,
114
+ "../ui/components/pagination/index.ts": Je,
115
+ "../ui/components/pagination/pagination.svelte": Ye,
116
+ "../ui/components/row-actions/index.ts": Xe,
117
+ "../ui/components/row-actions/row-actions.svelte": Ze
118
+ });
119
+ function N() {
120
+ return [...new Set(Object.keys(M).map(P))].filter(Boolean).sort();
121
+ }
122
+ function P(e) {
123
+ let t = e.split("/");
124
+ return t[t.indexOf("components") + 1] ?? "";
125
+ }
126
+ function tt(e) {
127
+ let t = e.split("/"), n = t.indexOf("components");
128
+ return t.slice(n + 2).join("/");
129
+ }
130
+ function F(e, t) {
131
+ return C.isAbsolute(t) ? t : C.join(e, t);
132
+ }
133
+ function I(e, t) {
134
+ return C.isAbsolute(t) ? C.relative(e, t) : t;
135
+ }
136
+ function L(e, t) {
137
+ g(C.dirname(e), { recursive: !0 }), S(e, t, "utf8");
138
+ }
139
+ function nt(e, t) {
140
+ h(e) && (b(e, {
141
+ force: !0,
142
+ recursive: !0
143
+ }), rt(C.dirname(e), t));
144
+ }
145
+ function rt(e, t) {
146
+ let n = C.resolve(t), r = C.resolve(e);
147
+ for (; r !== n && r.startsWith(n);) {
148
+ if (!h(r) || y(r).length > 0) return;
149
+ b(r, {
150
+ recursive: !0,
151
+ force: !0
152
+ }), r = C.dirname(r);
153
+ }
154
+ }
155
+ var it = {
156
+ npm: "--save-exact",
157
+ pnpm: "--save-exact",
158
+ yarn: "--exact",
159
+ bun: "--exact"
160
+ };
161
+ async function at(e, t, n, r = {}) {
162
+ let i = (await w({ cwd: e }))?.name ?? "npm", a = T(i, t === "install" && n.length > 0 ? "add" : t, n);
163
+ if (!a) throw Error(`Unable to resolve ${t} command for ${i}`);
164
+ let o = [...a.args];
165
+ i === "npm" && o.unshift("--yes");
166
+ let s = it[i];
167
+ r.exact && s && o.push(s), await new Promise((t, n) => {
168
+ let r = E(a.command, o, {
169
+ cwd: e,
170
+ stdio: "inherit"
171
+ });
172
+ r.on("error", n), r.on("exit", (e) => {
173
+ e === 0 ? t() : n(/* @__PURE__ */ Error(`${a.command} exited with code ${e ?? "unknown"}`));
174
+ });
175
+ });
176
+ }
177
+ async function R(e, t, n, r, i) {
178
+ let a = t === "execute" ? null : ot(e);
179
+ try {
180
+ if (r?.executeCommand) {
181
+ await (i ? r.executeCommand(e, t, n, i) : r.executeCommand(e, t, n));
182
+ return;
183
+ }
184
+ await at(e, t, n, i);
185
+ } finally {
186
+ a?.();
187
+ }
188
+ }
189
+ function z(e) {
190
+ let t = C.join(e, "package.json");
191
+ if (!h(t)) return /* @__PURE__ */ new Set();
192
+ let n = JSON.parse(v(t, "utf8"));
193
+ return /* @__PURE__ */ new Set([
194
+ ...Object.keys(n.dependencies ?? {}),
195
+ ...Object.keys(n.devDependencies ?? {}),
196
+ ...Object.keys(n.optionalDependencies ?? {}),
197
+ ...Object.keys(n.peerDependencies ?? {})
198
+ ]);
199
+ }
200
+ function B(e) {
201
+ let t = e.indexOf("@", +!!e.startsWith("@"));
202
+ return t === -1 ? e : e.slice(0, t);
203
+ }
204
+ function V(e) {
205
+ let t = B(e);
206
+ return /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(e.slice(t.length + 1));
207
+ }
208
+ function H(e, t, n, r) {
209
+ let a = new Set(n.map(B)), s = a.has("formsnap") || t.has("formsnap"), c = a.has("formsnap") || a.has("sveltekit-superforms");
210
+ if (!s || !c) return;
211
+ let l = C.join(e, "package.json");
212
+ if (!h(l)) return;
213
+ let u = v(l, "utf8"), d = JSON.parse(u), f = [], p = o.slice(B(o).length + 1), m = G(p);
214
+ for (let e of W) {
215
+ let t = d[e];
216
+ if (!t) continue;
217
+ t["sveltekit-superforms"]?.startsWith("3.0.0-") && (t["sveltekit-superforms"] = i, f.push(`sveltekit-superforms → ${i}`));
218
+ let n = t.formsnap === void 0 ? null : G(t.formsnap);
219
+ n && K(n, m) < 0 && (t.formsnap = p, f.push(`formsnap → ${p}`));
220
+ }
221
+ let g = d.overrides, _ = g?.formsnap;
222
+ if (typeof _ == "object" && _ && "sveltekit-superforms" in _) {
223
+ let { "sveltekit-superforms": e, ...t } = _, { formsnap: n, ...r } = g, i = Object.keys(t).length > 0 ? {
224
+ ...r,
225
+ formsnap: t
226
+ } : r;
227
+ Object.keys(i).length > 0 ? d.overrides = i : delete d.overrides, f.push("dropped the overrides entry formsnap 2.0 needed");
228
+ }
229
+ if (f.length === 0) return;
230
+ let y = u.match(/^[{]\s*\n([\t ]+)/)?.[1] ?? " ";
231
+ S(l, `${JSON.stringify(d, null, y)}\n`, "utf8"), r.info(`formsnap 2.1 peers superforms 3: ${f.join(", ")}`);
232
+ }
233
+ function ot(e) {
234
+ let t = C.join(e, "node_modules", "$app");
235
+ if (!h(t)) return null;
236
+ let n = _(C.join(ee.tmpdir(), "vela-app-types-"));
237
+ return m(t, C.join(n, "$app"), { recursive: !0 }), () => {
238
+ try {
239
+ !h(t) && h(C.join(e, "node_modules")) && m(C.join(n, "$app"), t, { recursive: !0 });
240
+ } finally {
241
+ b(n, {
242
+ recursive: !0,
243
+ force: !0
244
+ });
245
+ }
246
+ };
247
+ }
248
+ async function U(e, t, n = l) {
249
+ if (!h(C.join(e, "node_modules", "@sveltejs", "kit")) || h(C.join(e, "node_modules", "$app", "tsconfig.json"))) return !1;
250
+ try {
251
+ return await R(e, "execute", ["svelte-kit", "sync"], t), !0;
252
+ } catch (e) {
253
+ return n.info(`svelte-kit sync failed (${e instanceof Error ? e.message : String(e)}); node_modules/$app is missing`), !1;
254
+ }
255
+ }
256
+ var W = [
257
+ "dependencies",
258
+ "devDependencies",
259
+ "optionalDependencies"
260
+ ];
261
+ function G(e) {
262
+ let t = e.trim().match(/^(?:[\^~=v]|>=?)?\s*(\d+)(?:\.(\d+|[xX*]))?(?:\.(\d+|[xX*]))?(-[0-9A-Za-z.-]+)?$/);
263
+ if (!t) return null;
264
+ let n = (e) => e === void 0 || /[xX*]/.test(e) ? 0 : Number(e);
265
+ return [
266
+ n(t[1]),
267
+ n(t[2]),
268
+ n(t[3]),
269
+ +!t[4]
270
+ ];
271
+ }
272
+ function K(e, t) {
273
+ for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return e[n] - t[n];
274
+ return 0;
275
+ }
276
+ function q(e, t) {
277
+ let n = { ...t }, r = [], i = /* @__PURE__ */ new Map();
278
+ for (let t of W) for (let [n, r] of Object.entries(e[t] ?? {})) i.set(n, r);
279
+ for (let e of W) {
280
+ let a = t[e];
281
+ if (a) for (let [t, o] of Object.entries(a)) {
282
+ let a = i.get(t);
283
+ if (a === void 0 || a === o) continue;
284
+ let s = G(a), c = G(o);
285
+ s !== null && c !== null && K(c, s) >= 0 || (n[e] = {
286
+ ...n[e],
287
+ [t]: a
288
+ }, r.push(`${t}@${a}`));
289
+ }
290
+ }
291
+ return {
292
+ pkg: n,
293
+ restored: r
294
+ };
295
+ }
296
+ function J(e) {
297
+ let t = C.join(e, "package.json");
298
+ return h(t) ? JSON.parse(v(t, "utf8")) : null;
299
+ }
300
+ async function Y(e, t, n, r = l) {
301
+ if (t.length === 0) return [];
302
+ let i = z(e), a = [...new Set(t)].filter((e) => !i.has(B(e)));
303
+ if (a.length === 0) return [];
304
+ H(e, i, a, r), r.info(`Installing packages: ${a.join(", ")}`);
305
+ let o = a.filter(V), s = a.filter((e) => !V(e));
306
+ return o.length > 0 && await R(e, "install", o, n, { exact: !0 }), s.length > 0 && await R(e, "install", s, n), a;
307
+ }
308
+ async function st(e, t, n, r = l) {
309
+ if (t.length === 0) return [];
310
+ let i = z(e), a = [...new Set(t.map(B))].filter((e) => i.has(e));
311
+ return a.length === 0 ? [] : (r.info(`Removing packages: ${a.join(", ")}`), await R(e, "uninstall", a, n), a);
312
+ }
313
+ function X(e) {
314
+ return N().includes(e);
315
+ }
316
+ function ct(e) {
317
+ return [...new Set(e.flatMap((e) => et[e] ?? []))];
318
+ }
319
+ function lt(e, t) {
320
+ let n = C.join(t, e);
321
+ g(n, { recursive: !0 });
322
+ for (let [t, r] of Object.entries(M)) {
323
+ if (P(t) !== e) continue;
324
+ let i = tt(t);
325
+ if (!i) continue;
326
+ let a = C.join(n, i);
327
+ g(C.dirname(a), { recursive: !0 }), S(a, r, "utf8");
328
+ }
329
+ }
330
+ var ut = /* @__PURE__ */ new Set([
331
+ ".ts",
332
+ ".js",
333
+ ".svelte",
334
+ ".json",
335
+ ".css"
336
+ ]);
337
+ function* dt(e) {
338
+ if (!h(e)) return;
339
+ if (x(e).isFile()) {
340
+ yield e;
341
+ return;
342
+ }
343
+ let t = y(e, {
344
+ recursive: !0,
345
+ withFileTypes: !0
346
+ });
347
+ for (let e of t) e.isFile() && (yield C.join(e.parentPath, e.name));
348
+ }
349
+ async function Z(e, t) {
350
+ let n = {
351
+ env: "runtime",
352
+ root: e
353
+ }, r = [];
354
+ for (let i of t) for (let t of dt(F(e, i))) {
355
+ if (!ut.has(C.extname(t))) continue;
356
+ let i = v(t, "utf8"), a = await s(i, t, n);
357
+ a !== i && (S(t, a, "utf8"), r.push(C.relative(e, t)));
358
+ }
359
+ return r;
360
+ }
361
+ function Q(e) {
362
+ let t = u(e);
363
+ return h(t) ? y(t, { withFileTypes: !0 }).filter((e) => e.isDirectory()).map((e) => e.name).sort() : [];
364
+ }
365
+ var ft = /^[a-z0-9][a-z0-9-]*$/i;
366
+ async function pt(e, t, i, a) {
367
+ let o = t.filter((e) => ft.test(e));
368
+ if (o.length === 0) return;
369
+ let s;
370
+ try {
371
+ let t = await f(e, { runtime: i });
372
+ s = new Set(t.map((e) => e.name));
373
+ } catch (e) {
374
+ if (!(e instanceof n)) throw e;
375
+ a.info(`${e.message}; leaving component names to shadcn-svelte`);
376
+ return;
377
+ }
378
+ let c = o.filter((e) => !s.has(e));
379
+ if (c.length === 0) return;
380
+ let { style: l } = d(e), u = c.map((e) => `"${e}"`).join(", ");
381
+ throw new r(`Unknown component${c.length > 1 ? "s" : ""} ${u} for style ${l}. Run \`vela ui list\` to see what is available.`);
382
+ }
383
+ async function $(e, n) {
384
+ let { root: r, components: i, overwrite: a = !1 } = e, o = c(e), s = [...new Set(i)];
385
+ if (s.length === 0) return {
386
+ installed: [],
387
+ skipped: [],
388
+ packages: []
389
+ };
390
+ if (!h(C.join(r, "components.json"))) throw new t(`Adding ${s.length > 1 ? "components" : "a component"} (${s.join(", ")})`);
391
+ let l = u(r);
392
+ g(l, { recursive: !0 });
393
+ let d = (e) => h(C.join(l, e)), f = a ? [] : s.filter(d), m = s.filter((e) => !f.includes(e));
394
+ if (f.length > 0 && o.info(`Already present: ${f.join(", ")}`), m.length === 0) return {
395
+ installed: [],
396
+ skipped: f,
397
+ packages: []
398
+ };
399
+ let _ = new Set(m.filter(X)), y = new Set(m.filter((e) => !X(e)));
400
+ for (let e of [..._]) for (let t of $e[e] ?? []) d(t) || (X(t) ? _.add(t) : y.add(t));
401
+ p(r, [..._]);
402
+ let b = [], x = [..._].sort();
403
+ x.length > 0 && o.info(`Installing custom components: ${x.join(", ")}`);
404
+ for (let e of x) lt(e, l), b.push(e), y.delete(e);
405
+ let w = await Y(r, ct(x), n, o), T = [...y].sort();
406
+ if (T.length > 0) {
407
+ await pt(r, T, n, o), o.info(`Installing shadcn-svelte components: ${T.join(", ")}`), await U(r, n, o);
408
+ let e = J(r);
409
+ await R(r, "execute", [
410
+ "shadcn-svelte",
411
+ "add",
412
+ "--yes",
413
+ "--overwrite",
414
+ "--no-deps-install",
415
+ ...T
416
+ ], n), b.push(...T);
417
+ let t = J(r);
418
+ if (e && t && JSON.stringify(e) !== JSON.stringify(t)) {
419
+ let { pkg: i, restored: a } = q(e, t);
420
+ if (a.length > 0) {
421
+ o.info(`Kept ${a.join(", ")} (shadcn-svelte asked for an older range)`);
422
+ let e = C.join(r, "package.json"), t = v(e, "utf8").match(/^[{]\s*\n([\t ]+)/)?.[1] ?? " ";
423
+ S(e, `${JSON.stringify(i, null, t)}\n`, "utf8");
424
+ }
425
+ let s = (e) => new Set(W.flatMap((t) => Object.keys(e[t] ?? {}))), c = s(e);
426
+ H(r, c, [...s(t)].filter((e) => !c.has(e)), o), await R(r, "install", [], n);
427
+ }
428
+ }
429
+ let E = [...new Set(b)].sort();
430
+ return await Z(r, E.map((e) => C.join(l, e))), {
431
+ installed: E,
432
+ skipped: f,
433
+ packages: w
434
+ };
435
+ }
436
+ async function mt(e, t, n) {
437
+ let r = c(t), i = {
438
+ creates: [],
439
+ modifies: [],
440
+ deletes: [],
441
+ components: [],
442
+ packages: [],
443
+ collections: [],
444
+ collectionPatches: [],
445
+ collectionDrops: []
446
+ }, a = [];
447
+ if (e.collectionDrops.length > 0) {
448
+ let { dropCollections: n } = await import("./collections-BYcVyY9O.js").then((e) => e.n);
449
+ a = await n(e.collectionDrops, t);
450
+ }
451
+ let o = C.resolve(t.root, "package.json"), s = (e) => e.status === "success" && C.resolve(F(t.root, e.path)) === o;
452
+ for (let t of e.modifies.filter(s)) L(o, t.content);
453
+ let l = await Y(t.root, e.packages, n, r), u = await $({
454
+ root: t.root,
455
+ components: e.components,
456
+ logger: r
457
+ }, n), d = await st(t.root, e.uninstalls ?? [], n, r);
458
+ for (let n of [...e.creates, ...a]) {
459
+ if (n.status !== "success") {
460
+ i.creates.push({
461
+ ...n,
462
+ path: I(t.root, n.path)
463
+ });
464
+ continue;
465
+ }
466
+ let e = F(t.root, n.path);
467
+ h(e) ? v(e, "utf8") !== n.content && (L(e, n.content), i.modifies.push({
468
+ ...n,
469
+ path: I(t.root, n.path)
470
+ })) : (L(e, n.content), i.creates.push({
471
+ ...n,
472
+ path: I(t.root, n.path)
473
+ }));
474
+ }
475
+ for (let n of e.modifies) s(n) || n.status === "success" && L(F(t.root, n.path), n.content), i.modifies.push({
476
+ ...n,
477
+ path: I(t.root, n.path)
478
+ });
479
+ for (let n of e.deletes) n.status === "success" ? h(F(t.root, n.path)) && (nt(F(t.root, n.path), t.root), i.deletes.push({
480
+ ...n,
481
+ path: I(t.root, n.path)
482
+ })) : i.deletes.push({
483
+ ...n,
484
+ path: I(t.root, n.path)
485
+ });
486
+ return {
487
+ ...e,
488
+ creates: i.creates,
489
+ modifies: i.modifies,
490
+ deletes: i.deletes,
491
+ components: u.installed,
492
+ packages: [.../* @__PURE__ */ new Set([...l, ...u.packages])],
493
+ ...d.length > 0 ? { uninstalls: d } : {}
494
+ };
495
+ }
496
+ //#endregion
497
+ export { Q as a, B as c, $ as i, Qe as l, Z as n, z as o, N as r, X as s, R as t };
498
+
499
+ //# sourceMappingURL=write-result-DcqMefuP.js.map