@velastack/patterns 0.15.1 → 0.15.2

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 (127) hide show
  1. package/dist/chunks/{_page-Cg7LjaOE.js → _page-BFUn0CG1.js} +2 -2
  2. package/dist/chunks/{_page-Cg7LjaOE.js.map → _page-BFUn0CG1.js.map} +1 -1
  3. package/dist/chunks/{auth-pages-DSBqKjO0.js → auth-pages-D8n8gfCL.js} +2 -2
  4. package/dist/chunks/{auth-pages-DSBqKjO0.js.map → auth-pages-D8n8gfCL.js.map} +1 -1
  5. package/dist/chunks/{collections-D2_2cxWD.js → collections-Daxlnbm0.js} +2 -2
  6. package/dist/chunks/{collections-D2_2cxWD.js.map → collections-Daxlnbm0.js.map} +1 -1
  7. package/dist/chunks/{constants-DbpctM1D.js → constants-E1I-__KI.js} +18 -18
  8. package/dist/chunks/{constants-DbpctM1D.js.map → constants-E1I-__KI.js.map} +1 -1
  9. package/dist/chunks/{currency.server-CFrwmYra.js → currency.server-BkzwY17R.js} +2 -2
  10. package/dist/chunks/{currency.server-CFrwmYra.js.map → currency.server-BkzwY17R.js.map} +1 -1
  11. package/dist/chunks/{env-vars-Dm3Xy4rl.js → env-vars-C3TSZc4f.js} +3 -3
  12. package/dist/chunks/{env-vars-Dm3Xy4rl.js.map → env-vars-C3TSZc4f.js.map} +1 -1
  13. package/dist/chunks/{generate-BMWoD9E2.js → generate-CAYM7OUF.js} +2 -2
  14. package/dist/chunks/{generate-BMWoD9E2.js.map → generate-CAYM7OUF.js.map} +1 -1
  15. package/dist/chunks/{generate-DZ9kT3iC.js → generate-CL7wG0ZC.js} +3 -3
  16. package/dist/chunks/{generate-DZ9kT3iC.js.map → generate-CL7wG0ZC.js.map} +1 -1
  17. package/dist/chunks/{generate-BRTIGlqT.js → generate-CbchamhA.js} +3 -3
  18. package/dist/chunks/{generate-BRTIGlqT.js.map → generate-CbchamhA.js.map} +1 -1
  19. package/dist/chunks/{generate-Cs_fdfD7.js → generate-DI58vuk1.js} +2 -2
  20. package/dist/chunks/{generate-Cs_fdfD7.js.map → generate-DI58vuk1.js.map} +1 -1
  21. package/dist/chunks/{generate-BvQ6VwYH.js → generate-DR2wkVPY.js} +2 -2
  22. package/dist/chunks/{generate-BvQ6VwYH.js.map → generate-DR2wkVPY.js.map} +1 -1
  23. package/dist/chunks/{generate.runtime-1eTnPFmA.js → generate.runtime-B11mOr45.js} +2 -2
  24. package/dist/chunks/{generate.runtime-1eTnPFmA.js.map → generate.runtime-B11mOr45.js.map} +1 -1
  25. package/dist/chunks/{generate.runtime-CjLath7N.js → generate.runtime-B1Y2JrGW.js} +5 -5
  26. package/dist/chunks/{generate.runtime-CjLath7N.js.map → generate.runtime-B1Y2JrGW.js.map} +1 -1
  27. package/dist/chunks/{generate.runtime-CnNtG_x5.js → generate.runtime-B7VubPTW.js} +3 -3
  28. package/dist/chunks/{generate.runtime-CnNtG_x5.js.map → generate.runtime-B7VubPTW.js.map} +1 -1
  29. package/dist/chunks/{generate.runtime-BvHK8IN-.js → generate.runtime-BCv4F1Wm.js} +5 -5
  30. package/dist/chunks/{generate.runtime-BvHK8IN-.js.map → generate.runtime-BCv4F1Wm.js.map} +1 -1
  31. package/dist/chunks/{generate.runtime-D8G8cwCr.js → generate.runtime-BEWp57Y7.js} +2 -2
  32. package/dist/chunks/{generate.runtime-D8G8cwCr.js.map → generate.runtime-BEWp57Y7.js.map} +1 -1
  33. package/dist/chunks/{generate.runtime-B4mQEW54.js → generate.runtime-BH6hHygm.js} +3 -3
  34. package/dist/chunks/{generate.runtime-B4mQEW54.js.map → generate.runtime-BH6hHygm.js.map} +1 -1
  35. package/dist/chunks/{generate.runtime-CfCDLJ6Y.js → generate.runtime-BL6DpWFI.js} +3 -3
  36. package/dist/chunks/{generate.runtime-CfCDLJ6Y.js.map → generate.runtime-BL6DpWFI.js.map} +1 -1
  37. package/dist/chunks/{generate.runtime-BJwSyslL.js → generate.runtime-BRV9hIl5.js} +2 -2
  38. package/dist/chunks/{generate.runtime-BJwSyslL.js.map → generate.runtime-BRV9hIl5.js.map} +1 -1
  39. package/dist/chunks/{generate.runtime-B9nVU5iO.js → generate.runtime-BRcP6sFt.js} +2 -2
  40. package/dist/chunks/{generate.runtime-B9nVU5iO.js.map → generate.runtime-BRcP6sFt.js.map} +1 -1
  41. package/dist/chunks/{generate.runtime-BC1GJUXE.js → generate.runtime-Bhs7ttZS.js} +2 -2
  42. package/dist/chunks/{generate.runtime-BC1GJUXE.js.map → generate.runtime-Bhs7ttZS.js.map} +1 -1
  43. package/dist/chunks/{generate.runtime-Bda2_WK7.js → generate.runtime-BjrtdoYE.js} +2 -2
  44. package/dist/chunks/{generate.runtime-Bda2_WK7.js.map → generate.runtime-BjrtdoYE.js.map} +1 -1
  45. package/dist/chunks/{generate.runtime-DBQvnQmR.js → generate.runtime-Bo_s7gYB.js} +2 -2
  46. package/dist/chunks/{generate.runtime-DBQvnQmR.js.map → generate.runtime-Bo_s7gYB.js.map} +1 -1
  47. package/dist/chunks/{generate.runtime-DQUZRJH8.js → generate.runtime-Bs77Oc8P.js} +3 -3
  48. package/dist/chunks/{generate.runtime-DQUZRJH8.js.map → generate.runtime-Bs77Oc8P.js.map} +1 -1
  49. package/dist/chunks/{generate.runtime-Cd742Yqf.js → generate.runtime-C3IswX7B.js} +2 -2
  50. package/dist/chunks/{generate.runtime-Cd742Yqf.js.map → generate.runtime-C3IswX7B.js.map} +1 -1
  51. package/dist/chunks/{generate.runtime-B-H2F-sH.js → generate.runtime-C90_2L-8.js} +3 -3
  52. package/dist/chunks/{generate.runtime-B-H2F-sH.js.map → generate.runtime-C90_2L-8.js.map} +1 -1
  53. package/dist/chunks/{generate.runtime-B4rG6gSK.js → generate.runtime-CDY0Ot_t.js} +6 -6
  54. package/dist/chunks/{generate.runtime-B4rG6gSK.js.map → generate.runtime-CDY0Ot_t.js.map} +1 -1
  55. package/dist/chunks/{generate.runtime-Doumu0TL.js → generate.runtime-CZMVPVjS.js} +6 -6
  56. package/dist/chunks/{generate.runtime-Doumu0TL.js.map → generate.runtime-CZMVPVjS.js.map} +1 -1
  57. package/dist/chunks/{generate.runtime-liAz2TOE.js → generate.runtime-C_hrLPD4.js} +3 -3
  58. package/dist/chunks/{generate.runtime-liAz2TOE.js.map → generate.runtime-C_hrLPD4.js.map} +1 -1
  59. package/dist/chunks/{generate.runtime-DE-vPcn4.js → generate.runtime-CdZ3GzPS.js} +6 -6
  60. package/dist/chunks/{generate.runtime-DE-vPcn4.js.map → generate.runtime-CdZ3GzPS.js.map} +1 -1
  61. package/dist/chunks/{generate.runtime-BkQPchHe.js → generate.runtime-ChSVP7cD.js} +6 -6
  62. package/dist/chunks/{generate.runtime-BkQPchHe.js.map → generate.runtime-ChSVP7cD.js.map} +1 -1
  63. package/dist/chunks/{generate.runtime-C1HlZnLC.js → generate.runtime-Cs73i6Zf.js} +2 -2
  64. package/dist/chunks/{generate.runtime-C1HlZnLC.js.map → generate.runtime-Cs73i6Zf.js.map} +1 -1
  65. package/dist/chunks/{generate.runtime-GmsldrGj.js → generate.runtime-D7KYlnvb.js} +3 -3
  66. package/dist/chunks/{generate.runtime-GmsldrGj.js.map → generate.runtime-D7KYlnvb.js.map} +1 -1
  67. package/dist/chunks/{generate.runtime-DFSsgOmB.js → generate.runtime-DG9LRwbt.js} +3 -3
  68. package/dist/chunks/{generate.runtime-DFSsgOmB.js.map → generate.runtime-DG9LRwbt.js.map} +1 -1
  69. package/dist/chunks/{generate.runtime-CIOi-XSm.js → generate.runtime-DKL7VAAd.js} +6 -6
  70. package/dist/chunks/{generate.runtime-CIOi-XSm.js.map → generate.runtime-DKL7VAAd.js.map} +1 -1
  71. package/dist/chunks/{generate.runtime-CQ_U4YTJ.js → generate.runtime-DP63Wwea.js} +4 -4
  72. package/dist/chunks/{generate.runtime-CQ_U4YTJ.js.map → generate.runtime-DP63Wwea.js.map} +1 -1
  73. package/dist/chunks/{generate.runtime-C62ChKGg.js → generate.runtime-DRPxOLnB.js} +4 -4
  74. package/dist/chunks/{generate.runtime-C62ChKGg.js.map → generate.runtime-DRPxOLnB.js.map} +1 -1
  75. package/dist/chunks/{generate.runtime-DQI69jkX.js → generate.runtime-DW9bqOtC.js} +2 -2
  76. package/dist/chunks/{generate.runtime-DQI69jkX.js.map → generate.runtime-DW9bqOtC.js.map} +1 -1
  77. package/dist/chunks/{generate.runtime-Dtum580c.js → generate.runtime-DdY44Ulv.js} +6 -6
  78. package/dist/chunks/{generate.runtime-Dtum580c.js.map → generate.runtime-DdY44Ulv.js.map} +1 -1
  79. package/dist/chunks/{generate.runtime-ufoTIUXA.js → generate.runtime-DjEj-n6m.js} +7 -7
  80. package/dist/chunks/{generate.runtime-ufoTIUXA.js.map → generate.runtime-DjEj-n6m.js.map} +1 -1
  81. package/dist/chunks/{generate.runtime-rxzMCECc.js → generate.runtime-DlAJQ5Js.js} +4 -4
  82. package/dist/chunks/{generate.runtime-rxzMCECc.js.map → generate.runtime-DlAJQ5Js.js.map} +1 -1
  83. package/dist/chunks/{generate.runtime-CZA46Ghe.js → generate.runtime-JftBoKYS.js} +5 -5
  84. package/dist/chunks/{generate.runtime-CZA46Ghe.js.map → generate.runtime-JftBoKYS.js.map} +1 -1
  85. package/dist/chunks/{generate.runtime-DNjyaFml.js → generate.runtime-_426A1Ij.js} +3 -3
  86. package/dist/chunks/{generate.runtime-DNjyaFml.js.map → generate.runtime-_426A1Ij.js.map} +1 -1
  87. package/dist/chunks/{generate.runtime-DR8z6DyZ.js → generate.runtime-fs6GEMx-.js} +5 -5
  88. package/dist/chunks/{generate.runtime-DR8z6DyZ.js.map → generate.runtime-fs6GEMx-.js.map} +1 -1
  89. package/dist/chunks/{generate.runtime-Diix70x4.js → generate.runtime-jIlQ2GMh.js} +2 -2
  90. package/dist/chunks/{generate.runtime-Diix70x4.js.map → generate.runtime-jIlQ2GMh.js.map} +1 -1
  91. package/dist/chunks/{generate.runtime-BuQASx9Y.js → generate.runtime-v3KCv1B6.js} +2 -2
  92. package/dist/chunks/{generate.runtime-BuQASx9Y.js.map → generate.runtime-v3KCv1B6.js.map} +1 -1
  93. package/dist/chunks/{generate.runtime-lP4eoera.js → generate.runtime-xrxAElb3.js} +3 -3
  94. package/dist/chunks/{generate.runtime-lP4eoera.js.map → generate.runtime-xrxAElb3.js.map} +1 -1
  95. package/dist/chunks/{gitignore-2XpeEFmr.js → gitignore-CBiWFRif.js} +3 -3
  96. package/dist/chunks/{gitignore-2XpeEFmr.js.map → gitignore-CBiWFRif.js.map} +1 -1
  97. package/dist/chunks/{i18n-CxT1kz8Y.js → i18n-Ho8H91Ze.js} +2 -2
  98. package/dist/chunks/{i18n-CxT1kz8Y.js.map → i18n-Ho8H91Ze.js.map} +1 -1
  99. package/dist/chunks/{modify-file-BX9-aZD1.js → modify-file-BOEKlIDw.js} +2 -2
  100. package/dist/chunks/{modify-file-BX9-aZD1.js.map → modify-file-BOEKlIDw.js.map} +1 -1
  101. package/dist/chunks/{pocketbase-Dq9UdK_j.js → pocketbase-B2ksFrvH.js} +2 -2
  102. package/dist/chunks/{pocketbase-Dq9UdK_j.js.map → pocketbase-B2ksFrvH.js.map} +1 -1
  103. package/dist/chunks/{providers-2UgxXRJW.js → providers-BEjDonyG.js} +2 -2
  104. package/dist/chunks/{providers-2UgxXRJW.js.map → providers-BEjDonyG.js.map} +1 -1
  105. package/dist/chunks/{route-BDhlro0V.js → route-9ZVJZkYu.js} +23 -19
  106. package/dist/chunks/route-9ZVJZkYu.js.map +1 -0
  107. package/dist/chunks/{schema-2frI_BS2.js → schema-DnMqw2Hn.js} +3 -3
  108. package/dist/chunks/{schema-2frI_BS2.js.map → schema-DnMqw2Hn.js.map} +1 -1
  109. package/dist/chunks/{shared-BOFCKWJs.js → shared-CSwGWMcN.js} +2 -2
  110. package/dist/chunks/{shared-BOFCKWJs.js.map → shared-CSwGWMcN.js.map} +1 -1
  111. package/dist/chunks/{shared-DJ4KvhTb.js → shared-Cdwm_-Nl.js} +40 -40
  112. package/dist/chunks/{shared-DJ4KvhTb.js.map → shared-Cdwm_-Nl.js.map} +1 -1
  113. package/dist/chunks/{site-qASrdyUt.js → site-B5zrFba9.js} +2 -2
  114. package/dist/chunks/{site-qASrdyUt.js.map → site-B5zrFba9.js.map} +1 -1
  115. package/dist/chunks/{table-core-s2xjYgRD.js → table-core-ux1xEJxN.js} +2 -2
  116. package/dist/chunks/{table-core-s2xjYgRD.js.map → table-core-ux1xEJxN.js.map} +1 -1
  117. package/dist/chunks/{ui-DZuwcswv.js → ui-CpjUq_lm.js} +3 -3
  118. package/dist/chunks/{ui-DZuwcswv.js.map → ui-CpjUq_lm.js.map} +1 -1
  119. package/dist/chunks/{whatsapp-BytvTPlS.js → whatsapp-DOSZ_zwn.js} +2 -2
  120. package/dist/chunks/{whatsapp-BytvTPlS.js.map → whatsapp-DOSZ_zwn.js.map} +1 -1
  121. package/dist/chunks/{write-result-BhfLWAXf.js → write-result-DlB-id5k.js} +50 -26
  122. package/dist/chunks/write-result-DlB-id5k.js.map +1 -0
  123. package/dist/index.js +1863 -1841
  124. package/dist/index.js.map +1 -1
  125. package/package.json +1 -1
  126. package/dist/chunks/route-BDhlro0V.js.map +0 -1
  127. package/dist/chunks/write-result-BhfLWAXf.js.map +0 -1
@@ -2,8 +2,8 @@ import { n as e } from "./rolldown-runtime-CwxnZyOB.js";
2
2
  import { n as t, r as n, t as r } from "./errors-DdSUZI8f.js";
3
3
  import { n as i, t as a } from "./logger-t1HxmpG2.js";
4
4
  import { n as o } from "./format-result-CojavkIZ.js";
5
- import { g as s, m as c, o as l, p as u } from "./constants-DbpctM1D.js";
6
- import { a as d, i as f, n as p, o as m, s as h, t as g } from "./table-core-s2xjYgRD.js";
5
+ import { g as s, m as c, o as l, p as u } from "./constants-E1I-__KI.js";
6
+ import { a as d, i as f, n as p, o as m, s as h, t as g } from "./table-core-ux1xEJxN.js";
7
7
  import { cpSync as _, existsSync as v, mkdirSync as y, mkdtempSync as ee, readFileSync as b, readdirSync as x, rmSync as S, statSync as te, writeFileSync as C } from "node:fs";
8
8
  import w from "node:path";
9
9
  import { detect as ne } from "package-manager-detector";
@@ -13,9 +13,9 @@ import { createHash as ae } from "node:crypto";
13
13
  import oe from "node:os";
14
14
  // src/ui/components/auth-menu/auth-menu-content.svelte?raw
15
15
  var se = "<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", ce = "<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", le = "<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", ue = "<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", de = "<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", fe = "<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", pe = "<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", me = "export type AuthMenuContext = {\n isDesktop: boolean;\n};\n\nexport const AUTH_MENU_CONTEXT_KEY = Symbol(\"auth-menu-context\");\n", he = "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", ge = "<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", _e = "<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", 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: 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", 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: string | 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}>\n {value}\n</div>\n", xe = "<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", Se = "<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", Ce = "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", we = "<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", Te = "<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", Ee = "<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", T = "<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", E = "<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", 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 ...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", 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 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", Oe = "<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", ke = "export { default as ColumnHeader } from \"./column-header.svelte\";\n", Ae = "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", je = "<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", Me = "export { default as FlexRender } from \"./flex-render.svelte\";\nexport { renderComponent, renderSnippet } from \"./render-helpers.js\";\nexport { createTable } from \"./data-table.svelte.js\";\n", Ne = "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", Pe = "<script lang=\"ts\">\n import * as Pagination from '#lib/components/ui/pagination/index.js';\n import * as Select from '#lib/components/ui/select/index.js';\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 const rows = $derived(table.getFilteredRowModel().rows.length);\n<\/script>\n\n<div class=\"flex flex-wrap items-center justify-between gap-x-6 gap-y-2 px-2\">\n <div class=\"text-muted-foreground flex-1 text-sm whitespace-nowrap\">\n {table.getFilteredSelectedRowModel().rows.length} of\n {rows} row(s) selected.\n </div>\n <div class=\"flex items-center space-x-2\">\n <p class=\"text-sm font-medium whitespace-nowrap\">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 <!-- The table owns the page: shadcn-svelte's pagination shows it and asks for another. -->\n <Pagination.Root\n class=\"mx-0 w-auto\"\n count={rows}\n perPage={pagination.pageSize}\n page={pagination.pageIndex + 1}\n onPageChange={(page) => table.setPageIndex(page - 1)}\n >\n {#snippet children({ pages, currentPage })}\n <Pagination.Content>\n <Pagination.Item>\n <Pagination.Previous />\n </Pagination.Item>\n {#each pages as page (page.key)}\n <Pagination.Item>\n {#if page.type === 'ellipsis'}\n <Pagination.Ellipsis />\n {:else}\n <Pagination.Link {page} isActive={currentPage === page.value} />\n {/if}\n </Pagination.Item>\n {/each}\n <Pagination.Item>\n <Pagination.Next />\n </Pagination.Item>\n </Pagination.Content>\n {/snippet}\n </Pagination.Root>\n</div>\n", Fe = "export { default as DataTablePagination } from \"./data-table-pagination.svelte\";\n", Ie = "<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", Le = "export { default as FacetedFilter } from \"./faceted-filter.svelte\";\n", Re = "<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", ze = "<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", Be = "<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", Ve = "<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", He = "<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", Ue = "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", We = "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", Ge = "<script lang=\"ts\">\n import { Button, type ButtonProps } from '#lib/components/ui/button/index.js';\n\n let { ref = $bindable(null), ...restProps }: ButtonProps = $props();\n<\/script>\n\n<Button bind:ref type=\"submit\" {...restProps} />\n", Ke = "<script lang=\"ts\">\n import * as FormPrimitive from 'formsnap';\n import { cn, type WithoutChild } from '#lib/utils.js';\n\n let {\n ref = $bindable(null),\n class: className,\n ...restProps\n }: WithoutChild<FormPrimitive.DescriptionProps> = $props();\n<\/script>\n\n<FormPrimitive.Description\n bind:ref\n data-slot=\"form-description\"\n class={cn('text-muted-foreground text-sm', className)}\n {...restProps}\n/>\n", qe = "<script lang=\"ts\" generics=\"T extends Record<string, unknown>, U extends FormPathLeaves<T>\">\n import * as FormPrimitive from 'formsnap';\n import type { FormPathLeaves } from 'sveltekit-superforms';\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn, type WithElementRef, type WithoutChildren } from '#lib/utils.js';\n\n let {\n ref = $bindable(null),\n class: className,\n form,\n name,\n children: childrenProp,\n ...restProps\n }: WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>> &\n FormPrimitive.ElementFieldProps<T, U> = $props();\n<\/script>\n\n<FormPrimitive.ElementField {form} {name}>\n {#snippet children({ constraints, errors, tainted, value })}\n <div bind:this={ref} class={cn('space-y-2', className)} {...restProps}>\n {@render childrenProp?.({ constraints, errors, tainted, value: value as T[U] })}\n </div>\n {/snippet}\n</FormPrimitive.ElementField>\n", Je = "<script lang=\"ts\">\n import * as FormPrimitive from 'formsnap';\n import { cn, type WithoutChild } from '#lib/utils.js';\n\n let {\n ref = $bindable(null),\n class: className,\n errorClasses,\n children: childrenProp,\n ...restProps\n }: WithoutChild<FormPrimitive.FieldErrorsProps> & {\n errorClasses?: string | undefined | null;\n } = $props();\n<\/script>\n\n<FormPrimitive.FieldErrors\n bind:ref\n class={cn('text-destructive text-sm font-medium', className)}\n {...restProps}\n>\n {#snippet children({ errors, errorProps })}\n {#if childrenProp}\n {@render childrenProp({ errors, errorProps })}\n {:else}\n {#each errors as error (error)}\n <div {...errorProps} class={cn(errorClasses)}>{error}</div>\n {/each}\n {/if}\n {/snippet}\n</FormPrimitive.FieldErrors>\n", Ye = "<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\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<\/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", Xe = "<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 WithoutChild } from '#lib/utils.js';\n\n let {\n ref = $bindable(null),\n class: className,\n form,\n name,\n ...restProps\n }: WithoutChild<FormPrimitive.FieldsetProps<T, U>> = $props();\n<\/script>\n\n<FormPrimitive.Fieldset bind:ref {form} {name} class={cn('space-y-2', className)} {...restProps} />\n", Ze = "<script lang=\"ts\">\n import * as FormPrimitive from 'formsnap';\n import { Label } from '#lib/components/ui/label/index.js';\n import { cn, type WithoutChild } from '#lib/utils.js';\n\n let {\n ref = $bindable(null),\n children,\n class: className,\n ...restProps\n }: WithoutChild<FormPrimitive.LabelProps> = $props();\n<\/script>\n\n<FormPrimitive.Label {...restProps} bind:ref>\n {#snippet child({ props })}\n <Label\n {...props}\n data-slot=\"form-label\"\n class={cn('data-[fs-error]:text-destructive', className)}\n >\n {@render children?.()}\n </Label>\n {/snippet}\n</FormPrimitive.Label>\n", Qe = "<script lang=\"ts\">\n import * as FormPrimitive from 'formsnap';\n import { cn, type WithoutChild } from '#lib/utils.js';\n\n let {\n ref = $bindable(null),\n class: className,\n ...restProps\n }: WithoutChild<FormPrimitive.LegendProps> = $props();\n<\/script>\n\n<FormPrimitive.Legend\n bind:ref\n class={cn('data-[fs-error]:text-destructive text-sm leading-none font-medium', className)}\n {...restProps}\n/>\n", $e = "import * as FormPrimitive from \"formsnap\";\nimport Description from \"./form-description.svelte\";\nimport Label from \"./form-label.svelte\";\nimport FieldErrors from \"./form-field-errors.svelte\";\nimport Field from \"./form-field.svelte\";\nimport Fieldset from \"./form-fieldset.svelte\";\nimport Legend from \"./form-legend.svelte\";\nimport ElementField from \"./form-element-field.svelte\";\nimport Button from \"./form-button.svelte\";\n\nconst Control = FormPrimitive.Control;\n\nexport {\n Field,\n Control,\n Label,\n Button,\n FieldErrors,\n Description,\n Fieldset,\n Legend,\n ElementField,\n //\n Field as FormField,\n Control as FormControl,\n Description as FormDescription,\n Label as FormLabel,\n FieldErrors as FormFieldErrors,\n Fieldset as FormFieldset,\n Legend as FormLegend,\n ElementField as FormElementField,\n Button as FormButton,\n};\n", et = "<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", tt = "export { default as GeopointInput } from \"./input.svelte\";\n", nt = "<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", rt = "<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", it = "export { default as Leaflet } from \"./leaflet.svelte\";\n", at = "<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", ot = "<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", st = "<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", ct = "<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", lt = "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", ut = "<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", dt = "<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", ft = "<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", pt = "export { default as RowActions } from \"./row-actions.svelte\";\n", mt = "<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", ht = /* @__PURE__ */ e({
16
- assertComponentsAvailable: () => Pt,
16
+ assertComponentsAvailable: () => It,
17
17
  installComponents: () => Q,
18
- writeResult: () => Ft
18
+ writeResult: () => Lt
19
19
  }), gt = {
20
20
  "file-form": ["input"],
21
21
  form: ["label", "button"],
@@ -299,15 +299,39 @@ function H(e) {
299
299
  let t = w.join(e, "package.json");
300
300
  return v(t) ? JSON.parse(b(t, "utf8")) : null;
301
301
  }
302
+ var Et = /* @__PURE__ */ new Set(["@velastack/pocketbase"]);
303
+ function Dt(e, t) {
304
+ let n = I(t);
305
+ if (!Et.has(n)) return !1;
306
+ let r = B(t.slice(n.length + 1));
307
+ if (!r) return !1;
308
+ let i = null, a = w.join(e, "node_modules", ...n.split("/"), "package.json");
309
+ if (v(a)) try {
310
+ let { version: e } = JSON.parse(b(a, "utf8"));
311
+ i = typeof e == "string" ? B(e) : null;
312
+ } catch {
313
+ i = null;
314
+ }
315
+ else {
316
+ let t = JSON.parse(b(w.join(e, "package.json"), "utf8")), r = [
317
+ "dependencies",
318
+ "devDependencies",
319
+ "optionalDependencies",
320
+ "peerDependencies"
321
+ ].map((e) => t[e]?.[n]).find((e) => typeof e == "string");
322
+ i = r ? B(r) : null;
323
+ }
324
+ return i !== null && V(i, r) < 0;
325
+ }
302
326
  async function U(e, t, n, r = a) {
303
327
  if (t.length === 0) return [];
304
- let i = F(e), o = [...new Set(t)].filter((e) => !i.has(I(e)));
328
+ let i = F(e), o = [...new Set(t)].filter((t) => !i.has(I(t)) || Dt(e, t));
305
329
  if (o.length === 0) return [];
306
330
  R(e, i, o, r), r.info(`Installing packages: ${o.join(", ")}`);
307
331
  let s = o.filter(L), c = o.filter((e) => !L(e));
308
332
  return s.length > 0 && await P(e, "install", s, n, { exact: !0 }), c.length > 0 && await P(e, "install", c, n), o;
309
333
  }
310
- async function Et(e, t, n, r = a) {
334
+ async function Ot(e, t, n, r = a) {
311
335
  if (t.length === 0) return [];
312
336
  let i = F(e), o = [...new Set(t.map(I))].filter((e) => i.has(e));
313
337
  return o.length === 0 ? [] : (r.info(`Removing packages: ${o.join(", ")}`), await P(e, "uninstall", o, n), o);
@@ -315,10 +339,10 @@ async function Et(e, t, n, r = a) {
315
339
  function W(e) {
316
340
  return k().includes(e);
317
341
  }
318
- function Dt(e) {
342
+ function kt(e) {
319
343
  return [...new Set(e.flatMap((e) => _t[e] ?? []))];
320
344
  }
321
- function Ot(e, t) {
345
+ function At(e, t) {
322
346
  let n = w.join(t, e);
323
347
  y(n, { recursive: !0 });
324
348
  for (let [t, r] of Object.entries(O)) {
@@ -329,7 +353,7 @@ function Ot(e, t) {
329
353
  y(w.dirname(a), { recursive: !0 }), C(a, r, "utf8");
330
354
  }
331
355
  }
332
- var kt = /* @__PURE__ */ new Set([
356
+ var jt = /* @__PURE__ */ new Set([
333
357
  ".ts",
334
358
  ".js",
335
359
  ".svelte",
@@ -354,7 +378,7 @@ async function K(e, t) {
354
378
  root: e
355
379
  }, r = [];
356
380
  for (let i of t) for (let t of G(j(e, i))) {
357
- if (!kt.has(w.extname(t))) continue;
381
+ if (!jt.has(w.extname(t))) continue;
358
382
  let i = b(t, "utf8"), a = await o(i, t, n);
359
383
  a !== i && (C(t, a, "utf8"), r.push(w.relative(e, t)));
360
384
  }
@@ -365,19 +389,19 @@ function q(e) {
365
389
  for (let n of e) for (let e of G(n)) t.set(e, ae("sha1").update(b(e)).digest("hex"));
366
390
  return t;
367
391
  }
368
- function At(e, t) {
392
+ function J(e, t) {
369
393
  return [...q(t)].filter(([t, n]) => e.get(t) !== n).map(([e]) => e);
370
394
  }
371
- function jt(e) {
395
+ function Mt(e) {
372
396
  let t = h(e);
373
397
  return v(t) ? x(t, { withFileTypes: !0 }).filter((e) => e.isDirectory()).map((e) => e.name).sort() : [];
374
398
  }
375
- var J = /^[a-z0-9][a-z0-9-]*$/i, Mt = 3e4, Y = /* @__PURE__ */ new WeakMap();
376
- async function Nt(e, t, i, a) {
377
- let o = t.filter((e) => J.test(e));
399
+ var Nt = /^[a-z0-9][a-z0-9-]*$/i, Pt = 3e4, Y = /* @__PURE__ */ new WeakMap();
400
+ async function Ft(e, t, i, a) {
401
+ let o = t.filter((e) => Nt.test(e));
378
402
  if (o.length === 0) return;
379
403
  let s = d(e), c = m(s.registry, s.style), l = i?.fetch ?? globalThis.fetch, u = Y.get(l)?.get(c);
380
- if (u !== void 0 && Date.now() - u < Mt) return;
404
+ if (u !== void 0 && Date.now() - u < Pt) return;
381
405
  let p;
382
406
  try {
383
407
  let t = await f(e, { runtime: i });
@@ -411,9 +435,9 @@ function X(e, n, r) {
411
435
  };
412
436
  }
413
437
  async function Z(e, t, n, r) {
414
- p(e, t.custom), t.custom.includes("data-table-pagination") && g(e), await Nt(e, t.registry, n, r);
438
+ p(e, t.custom), t.custom.includes("data-table-pagination") && g(e), await Ft(e, t.registry, n, r);
415
439
  }
416
- async function Pt(e, t, n = {}, r) {
440
+ async function It(e, t, n = {}, r) {
417
441
  await Z(e, X(e, t, n.overwrite ?? !1), r, i(n));
418
442
  }
419
443
  async function Q(e, t) {
@@ -429,11 +453,11 @@ async function $(e, t, n, r) {
429
453
  };
430
454
  let s = h(e);
431
455
  y(s, { recursive: !0 });
432
- let c = [], l = [], u = [w.join(e, "src", "lib"), s], d, f = () => K(e, [.../* @__PURE__ */ new Set([...c.map((e) => w.join(s, e)), ...d ? At(d, u) : []])]);
456
+ let c = [], l = [], u = [w.join(e, "src", "lib"), s], d, f = () => K(e, [.../* @__PURE__ */ new Set([...c.map((e) => w.join(s, e)), ...d ? J(d, u) : []])]);
433
457
  try {
434
458
  a.length > 0 && r.info(`Installing custom components: ${a.join(", ")}`);
435
- for (let e of a) Ot(e, s), c.push(e);
436
- if (l = await U(e, Dt(a), n, r), d = o.length > 0 ? q(u) : void 0, o.length > 0) {
459
+ for (let e of a) At(e, s), c.push(e);
460
+ if (l = await U(e, kt(a), n, r), d = o.length > 0 ? q(u) : void 0, o.length > 0) {
437
461
  r.info(`Installing shadcn-svelte components: ${o.join(", ")}`), await wt(e, n, r);
438
462
  let t = H(e);
439
463
  await P(e, "execute", [
@@ -465,7 +489,7 @@ async function $(e, t, n, r) {
465
489
  packages: l
466
490
  };
467
491
  }
468
- async function Ft(e, t, n) {
492
+ async function Lt(e, t, n) {
469
493
  let r = i(t), a = {
470
494
  creates: [],
471
495
  modifies: [],
@@ -479,7 +503,7 @@ async function Ft(e, t, n) {
479
503
  await Z(t.root, s, n, r);
480
504
  let c = [];
481
505
  if (e.collectionDrops.length > 0) {
482
- let { dropCollections: n } = await import("./collections-D2_2cxWD.js").then((e) => e.n);
506
+ let { dropCollections: n } = await import("./collections-Daxlnbm0.js").then((e) => e.n);
483
507
  c = await Promise.all((await n(e.collectionDrops, t)).map(async (e) => ({
484
508
  ...e,
485
509
  content: await o(e.content, e.path, t, { created: !0 })
@@ -487,7 +511,7 @@ async function Ft(e, t, n) {
487
511
  }
488
512
  let l = w.resolve(t.root, "package.json"), u = (e) => e.status === "success" && w.resolve(j(t.root, e.path)) === l;
489
513
  for (let t of e.modifies.filter(u)) N(l, t.content);
490
- let d = await U(t.root, e.packages, n, r), f = await $(t.root, s, n, r), p = await Et(t.root, e.uninstalls ?? [], n, r);
514
+ let d = await U(t.root, e.packages, n, r), f = await $(t.root, s, n, r), p = await Ot(t.root, e.uninstalls ?? [], n, r);
491
515
  for (let n of [...e.creates, ...c]) {
492
516
  if (n.status !== "success") {
493
517
  a.creates.push({
@@ -534,6 +558,6 @@ async function Ft(e, t, n) {
534
558
  ...p.length > 0 ? { uninstalls: p } : {}
535
559
  };
536
560
  }
537
- export { jt as a, I as c, Q as i, ht as l, K as n, F as o, k as r, W as s, P as t };
561
+ export { Mt as a, I as c, Q as i, ht as l, K as n, F as o, k as r, W as s, P as t };
538
562
 
539
- //# sourceMappingURL=write-result-BhfLWAXf.js.map
563
+ //# sourceMappingURL=write-result-DlB-id5k.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write-result-DlB-id5k.js","names":["__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__0_4_","__import_glob__0_5_","__import_glob__0_6_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","__import_glob__0_15_","__import_glob__0_16_","__import_glob__0_17_","__import_glob__0_18_","__import_glob__0_19_","__import_glob__0_20_","__import_glob__0_21_","__import_glob__0_22_","__import_glob__0_23_","__import_glob__0_24_","__import_glob__0_25_","__import_glob__0_26_","__import_glob__0_27_","__import_glob__0_28_","__import_glob__0_29_","__import_glob__0_30_","__import_glob__0_31_","__import_glob__0_32_","__import_glob__0_33_","__import_glob__0_34_","__import_glob__0_35_","__import_glob__0_36_","__import_glob__0_37_","__import_glob__0_38_","__import_glob__0_39_","__import_glob__0_40_","__import_glob__0_41_","__import_glob__0_42_","__import_glob__0_43_","__import_glob__0_44_","__import_glob__0_45_","__import_glob__0_46_","__import_glob__0_47_","__import_glob__0_48_","__import_glob__0_49_","__import_glob__0_50_","__import_glob__0_51_","__import_glob__0_52_","__import_glob__0_53_","__import_glob__0_54_","__import_glob__0_55_","__import_glob__0_56_","__import_glob__0_57_","__import_glob__0_58_","__import_glob__0_59_","__import_glob__0_60_","__import_glob__0_61_","__import_glob__0_62_","__import_glob__0_63_","__import_glob__0_64_","__exportAll","MissingShadcnError","RegistryUnavailableError","InvalidArgumentError","getLogger","NOOP_LOGGER","formatSource","TANSTACK_TABLE_CORE","SUPERFORMS_VERSION","FORMSNAP","SUPERFORMS","readComponentsConfig","fetchRegistryIndex","assertTableCorePackage","registryIndexUrl","resolveUiDir","assertRegistryPagination","path","spawn","os","auth_menu_content_default","auth_menu_group_default","auth_menu_item_default","auth_menu_label_default","auth_menu_separator_default","auth_menu_trigger_default","auth_menu_default$1","context_default","auth_menu_default","autodate_default","bool_default","date_default","editor_default","email_default","file_default","geoPoint_default","cells_default","json_default","number_default","password_default","relation_default","select_default","text_default","url_default","column_header_default$1","column_header_default","data_table_svelte_default","flex_render_default","data_table_default","render_helpers_default","data_table_pagination_default$1","data_table_pagination_default","faceted_filter_default$1","faceted_filter_default","file_field_default","file_input_default","file_multiple_default","file_single_default","file_thumb_default","file_form_default","shared_default","form_button_default","form_description_default","form_element_field_default","form_field_errors_default","form_field_default","form_fieldset_default","form_label_default","form_legend_default","form_default","coordinate_default","geopoint_default","input_default$1","toggle_map_default","leaflet_default$1","leaflet_default","chip_default","content_default","field_default","multiselect_default","input_default","item_default","trigger_default","row_actions_default$1","row_actions_default","write_result_exports","assertComponentsAvailable","installComponents","writeResult","customDependencies","customNpmPackages","customComponentAssets","getAllCustomComponents","componentNameFromAssetPath","parts","assetPath","componentRelativeAssetPath","index","toTargetPath","filePath","root","toRelativePath","writeFile","mkdirSync","writeFileSync","content","removeFile","existsSync","rmSync","pruneEmptyDirectories","stop","current","dir","readdirSync","EXACT_FLAG","executeWithDetectedPackageManager","packageManager","detect","resolved","resolveCommand","operation","args","commandArgs","exactFlag","options","child","reject","code","resolve","executeCommand","restoreTypes","preserveSvelteKitTypes","cwd","runtime","installedPackagesFromProject","packageJsonPath","packageJson","readFileSync","packageName","at","spec","isExactSpec","name","reconcileFormsnap","names","toInstall","formsnap","installed","touched","file","text","pkg","changed","formsnapRange","wantedFloor","rangeFloor","block","DEPENDENCY_BLOCKS","deps","floor","compareFloors","overrides","entry","_","rest","__","others","next","indent","logger","appDir","saved","mkdtempSync","cpSync","ensureSvelteKitSync","error","match","part","value","i","a","b","restoreDowngradedDependencies","after","restored","previous","before","entries","old","oldFloor","newFloor","readPackageJson","FLOOR_ENFORCED","isBelowFloor","wanted","have","installedManifest","version","manifest","range","installPackages","packages","exact","ranged","uninstallPackages","toRemove","isCustomComponent","component","customNpmPackagesFor","components","copyCustomComponent","targetDir","targetComponentsDir","relativePath","outputPath","FORMATTABLE_EXTENSIONS","filesUnder","target","statSync","formatPaths","context","paths","formatted","fileDigests","digests","dirs","createHash","filesWrittenSince","digest","installedComponents","uiDir","BARE_ITEM_NAME","REGISTRY_RETRY_MS","registryUnavailableAt","assertKnownRegistryItems","bare","config","url","fetchImpl","failedAt","known","item","failures","unknown","planComponentInstall","requested","componentsDir","isPresent","skipped","overwrite","customToInstall","publicToInstall","dependency","assertPlanInstallable","plan","applyComponentPlan","customList","publicList","shadcnDirs","beforeShadcn","formatWritten","recorded","had","writtenResult","componentPlan","result","dropMigrationCreates","n","dropCollections","isPackageJson","packageInstalls","componentInstalls","packageUninstalls","_written","reported"],"sources":["../../src/runtime/write-result.ts"],"sourcesContent":["import {\n cpSync,\n existsSync,\n mkdirSync,\n mkdtempSync,\n readdirSync,\n readFileSync,\n rmSync,\n statSync,\n writeFileSync,\n} from \"node:fs\";\nimport { createHash } from \"node:crypto\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { detect } from \"package-manager-detector\";\nimport { resolveCommand } from \"package-manager-detector/commands\";\nimport spawn from \"cross-spawn\";\nimport type {\n Component,\n ExecuteCommandOptions,\n InstallComponentsOptions,\n InstallComponentsResult,\n Options,\n PackageManagerOperation,\n Result,\n WriteResultRuntime,\n} from \"../core/types\";\nimport {\n InvalidArgumentError,\n MissingShadcnError,\n RegistryUnavailableError,\n} from \"../core/errors\";\nimport { getLogger, NOOP_LOGGER, type Logger } from \"../core/logger\";\nimport { formatSource } from \"../core/format-result\";\nimport {\n FORMSNAP,\n SUPERFORMS,\n SUPERFORMS_VERSION,\n TANSTACK_TABLE_CORE,\n} from \"../core/constants\";\nimport {\n fetchRegistryIndex,\n readComponentsConfig,\n registryIndexUrl,\n resolveUiDir,\n} from \"./registry\";\nimport { assertRegistryPagination, assertTableCorePackage } from \"./table-core\";\n\nexport { resolveUiDir };\n\ntype CustomNpmPackages = Record<string, string[]>;\n\n/**\n * The components under `src/ui/components` are copied into a project rather\n * than fetched from the shadcn-svelte registry, so their dependencies have to\n * be declared here: every shadcn-svelte component a bundled one imports\n * (`#lib/components/ui/<x>/index.js`) must appear in `customDependencies`, and\n * every npm package that no shadcn item installs for it must appear in\n * `customNpmPackages`.\n *\n * `form` is shadcn-svelte's own formsnap wrapper as it last shipped it: the\n * registry dropped the item from every style on 2026-11-24\n * (huntabyte/shadcn-svelte#2989), and the superforms pages the patterns\n * generate are built on it.\n */\nexport const customDependencies: Record<string, string[]> = {\n \"file-form\": [\"input\"],\n form: [\"label\", \"button\"],\n multiselect: [\"command\", \"popover\", \"button\"],\n geopoint: [\"button\", \"leaflet\"],\n cells: [\"badge\"],\n \"data-table\": [],\n \"column-header\": [\"dropdown-menu\", \"button\"],\n \"faceted-filter\": [\"command\", \"popover\", \"button\", \"separator\", \"badge\"],\n \"data-table-pagination\": [\"pagination\", \"select\"],\n \"row-actions\": [\"dropdown-menu\", \"button\"],\n leaflet: [],\n \"auth-menu\": [\"dropdown-menu\", \"button\"],\n};\n\nconst customNpmPackages: CustomNpmPackages = {\n \"file-form\": [FORMSNAP],\n // What the registry item used to record. Superforms is named because the\n // field components import its path types.\n form: [FORMSNAP, SUPERFORMS],\n multiselect: [FORMSNAP],\n geopoint: [],\n cells: [],\n // shadcn-svelte >= 1.2.0 resolves items from the style-scoped registry\n // (/registry/styles/<style>/), which has no `data-table` item, so the\n // TanStack helpers ship from here instead.\n \"data-table\": [TANSTACK_TABLE_CORE],\n \"column-header\": [TANSTACK_TABLE_CORE],\n \"faceted-filter\": [TANSTACK_TABLE_CORE],\n \"data-table-pagination\": [TANSTACK_TABLE_CORE],\n \"row-actions\": [],\n leaflet: [\"leaflet\", \"@types/leaflet\"],\n};\n\nconst customComponentAssets = import.meta.glob<string>(\"../ui/components/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\n/** The components this package ships, by directory name, sorted. */\nexport function getAllCustomComponents(): Component[] {\n return [\n ...new Set(\n Object.keys(customComponentAssets).map(componentNameFromAssetPath),\n ),\n ]\n .filter(Boolean)\n .sort();\n}\n\nfunction componentNameFromAssetPath(assetPath: string): string {\n const parts = assetPath.split(\"/\");\n const index = parts.indexOf(\"components\");\n return parts[index + 1] ?? \"\";\n}\n\nfunction componentRelativeAssetPath(assetPath: string): string {\n const parts = assetPath.split(\"/\");\n const index = parts.indexOf(\"components\");\n return parts.slice(index + 2).join(\"/\");\n}\n\nfunction toTargetPath(root: string, filePath: string): string {\n if (path.isAbsolute(filePath)) {\n return filePath;\n }\n return path.join(root, filePath);\n}\n\nfunction toRelativePath(root: string, filePath: string): string {\n if (path.isAbsolute(filePath)) {\n return path.relative(root, filePath);\n }\n return filePath;\n}\n\nfunction writeFile(filePath: string, content: string): void {\n mkdirSync(path.dirname(filePath), { recursive: true });\n writeFileSync(filePath, content, \"utf8\");\n}\n\nfunction removeFile(filePath: string, root: string): void {\n if (!existsSync(filePath)) {\n return;\n }\n\n rmSync(filePath, { force: true, recursive: true });\n pruneEmptyDirectories(path.dirname(filePath), root);\n}\n\n/**\n * Deleting a feature's files must also delete the directories it added, up\n * to the first one that still has content. The CLI detects features by\n * directory (`src/routes/(app)` means auth is on), so an empty leftover\n * directory keeps a disabled feature \"enabled\".\n */\nfunction pruneEmptyDirectories(dir: string, root: string): void {\n const stop = path.resolve(root);\n let current = path.resolve(dir);\n while (current !== stop && current.startsWith(stop)) {\n if (!existsSync(current) || readdirSync(current).length > 0) {\n return;\n }\n rmSync(current, { recursive: true, force: true });\n current = path.dirname(current);\n }\n}\n\n/** Each package manager's flag for saving the exact version instead of a range. */\nconst EXACT_FLAG: Record<string, string> = {\n npm: \"--save-exact\",\n pnpm: \"--save-exact\",\n yarn: \"--exact\",\n bun: \"--exact\",\n};\n\nasync function executeWithDetectedPackageManager(\n cwd: string,\n operation: PackageManagerOperation,\n args: string[],\n options: ExecuteCommandOptions = {},\n): Promise<void> {\n const packageManager = (await detect({ cwd }))?.name ?? \"npm\";\n // Adding named packages is `add` (`npm i`, `pnpm add`, `yarn add`):\n // `yarn install <pkg>` is an error.\n const resolved = resolveCommand(\n packageManager,\n operation === \"install\" && args.length > 0 ? \"add\" : operation,\n args,\n );\n if (!resolved) {\n throw new Error(\n `Unable to resolve ${operation} command for ${packageManager}`,\n );\n }\n\n const commandArgs = [...resolved.args];\n if (packageManager === \"npm\") {\n commandArgs.unshift(\"--yes\");\n }\n const exactFlag = EXACT_FLAG[packageManager];\n if (options.exact && exactFlag) {\n commandArgs.push(exactFlag);\n }\n\n await new Promise<void>((resolve, reject) => {\n const child = spawn(resolved.command, commandArgs, {\n cwd,\n stdio: \"inherit\",\n });\n child.on(\"error\", reject);\n child.on(\"exit\", (code) => {\n if (code === 0) {\n resolve();\n return;\n }\n reject(\n new Error(`${resolved.command} exited with code ${code ?? \"unknown\"}`),\n );\n });\n });\n}\n\nexport async function executeCommand(\n cwd: string,\n operation: PackageManagerOperation,\n args: string[],\n runtime?: WriteResultRuntime,\n options?: ExecuteCommandOptions,\n): Promise<void> {\n const restoreTypes =\n operation === \"execute\" ? null : preserveSvelteKitTypes(cwd);\n try {\n if (runtime?.executeCommand) {\n await (options\n ? runtime.executeCommand(cwd, operation, args, options)\n : runtime.executeCommand(cwd, operation, args));\n return;\n }\n\n await executeWithDetectedPackageManager(cwd, operation, args, options);\n } finally {\n restoreTypes?.();\n }\n}\n\n/** Package names `package.json` records, whichever dependency block they sit in. */\nexport function installedPackagesFromProject(root: string): Set<string> {\n const packageJsonPath = path.join(root, \"package.json\");\n if (!existsSync(packageJsonPath)) {\n return new Set();\n }\n\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n optionalDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n };\n\n return new Set([\n ...Object.keys(packageJson.dependencies ?? {}),\n ...Object.keys(packageJson.devDependencies ?? {}),\n ...Object.keys(packageJson.optionalDependencies ?? {}),\n ...Object.keys(packageJson.peerDependencies ?? {}),\n ]);\n}\n\n/**\n * Splits an npm install spec into its package name, dropping any range.\n * `wuchale@^0.26.3` -> `wuchale`, `@wuchale/svelte@^0.21.1` -> `@wuchale/svelte`.\n *\n * The name is what `package.json` records, so it -- not the full spec -- is what\n * the already-installed check has to compare against.\n */\nexport function packageName(spec: string): string {\n const at = spec.indexOf(\"@\", spec.startsWith(\"@\") ? 1 : 0);\n return at === -1 ? spec : spec.slice(0, at);\n}\n\n/**\n * A spec naming one exact version (`sveltekit-superforms@3.0.0`),\n * which is saved as written. Package managers otherwise save a caret, and a\n * caret on a prerelease follows every later `next` build.\n */\nexport function isExactSpec(spec: string): boolean {\n const name = packageName(spec);\n return /^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?$/.test(\n spec.slice(name.length + 1),\n );\n}\n\n/**\n * formsnap 2.1 is the first release whose superforms peer admits 3.x, and\n * npm reads that `^3.0.0` peer as excluding `3.0.0-next.*`. Before an install\n * brings formsnap or superforms in next to the other, package.json is moved\n * to what resolves: a `3.0.0-next` superforms pin to the release, a formsnap\n * range below 2.1 to `FORMSNAP`, and the `overrides` entry earlier releases\n * wrote for formsnap 2.0 goes. Left as it is, `npm install` either stops with\n * ERESOLVE or keeps the formsnap 2.0 its lockfile holds, whose peer\n * superforms 3 does not meet.\n */\nfunction reconcileFormsnap(\n root: string,\n installed: Set<string>,\n toInstall: string[],\n logger: Logger,\n): void {\n const names = new Set(toInstall.map(packageName));\n const formsnap = names.has(\"formsnap\") || installed.has(\"formsnap\");\n const touched = names.has(\"formsnap\") || names.has(\"sveltekit-superforms\");\n if (!formsnap || !touched) {\n return;\n }\n const file = path.join(root, \"package.json\");\n if (!existsSync(file)) {\n return;\n }\n const text = readFileSync(file, \"utf8\");\n const pkg = JSON.parse(text) as Record<string, unknown>;\n const changed: string[] = [];\n\n const formsnapRange = FORMSNAP.slice(packageName(FORMSNAP).length + 1);\n const wantedFloor = rangeFloor(formsnapRange)!;\n for (const block of DEPENDENCY_BLOCKS) {\n const deps = pkg[block] as Record<string, string> | undefined;\n if (!deps) {\n continue;\n }\n if (deps[\"sveltekit-superforms\"]?.startsWith(\"3.0.0-\")) {\n deps[\"sveltekit-superforms\"] = SUPERFORMS_VERSION;\n changed.push(`sveltekit-superforms → ${SUPERFORMS_VERSION}`);\n }\n const floor =\n deps.formsnap === undefined ? null : rangeFloor(deps.formsnap);\n if (floor && compareFloors(floor, wantedFloor) < 0) {\n deps.formsnap = formsnapRange;\n changed.push(`formsnap → ${formsnapRange}`);\n }\n }\n\n const overrides = pkg.overrides as Record<string, unknown> | undefined;\n const entry = overrides?.formsnap;\n if (\n typeof entry === \"object\" &&\n entry !== null &&\n \"sveltekit-superforms\" in entry\n ) {\n const { \"sveltekit-superforms\": _, ...rest } = entry as Record<\n string,\n unknown\n >;\n const { formsnap: __, ...others } = overrides!;\n const next =\n Object.keys(rest).length > 0 ? { ...others, formsnap: rest } : others;\n if (Object.keys(next).length > 0) {\n pkg.overrides = next;\n } else {\n delete pkg.overrides;\n }\n changed.push(\"dropped the overrides entry formsnap 2.0 needed\");\n }\n\n if (changed.length === 0) {\n return;\n }\n const indent = text.match(/^[{]\\s*\\n([\\t ]+)/)?.[1] ?? \"\\t\";\n writeFileSync(file, `${JSON.stringify(pkg, null, indent)}\\n`, \"utf8\");\n logger.info(`formsnap 2.1 peers superforms 3: ${changed.join(\", \")}`);\n}\n\n/**\n * SvelteKit 3's tsconfig extends `$app/tsconfig`, which `svelte-kit sync`\n * writes to `node_modules/$app`. A package-manager install prunes that folder\n * (it is no package) and only an argument-less npm install's `prepare` writes\n * it back, so after `npm install <pkg>` every tool that reads the tsconfig\n * (shadcn-svelte, svelte-check without sync, the editor) fails on the missing\n * `extends`. Syncing again is no fix mid-pattern: it loads vite.config, which\n * may already name a plugin whose own config the pattern has not written yet.\n * So the folder is copied aside before an install and put back after.\n */\nfunction preserveSvelteKitTypes(root: string): (() => void) | null {\n const appDir = path.join(root, \"node_modules\", \"$app\");\n if (!existsSync(appDir)) {\n return null;\n }\n const saved = mkdtempSync(path.join(os.tmpdir(), \"vela-app-types-\"));\n cpSync(appDir, path.join(saved, \"$app\"), { recursive: true });\n return () => {\n try {\n if (!existsSync(appDir) && existsSync(path.join(root, \"node_modules\"))) {\n cpSync(path.join(saved, \"$app\"), appDir, { recursive: true });\n }\n } finally {\n rmSync(saved, { recursive: true, force: true });\n }\n };\n}\n\n/**\n * Run `svelte-kit sync` when SvelteKit is installed but `node_modules/$app`\n * is missing (a fresh copy of `node_modules`, or an install made outside\n * vela), so shadcn-svelte can read the tsconfig. Best effort: a sync that\n * fails is reported and left to shadcn-svelte to complain about.\n */\nexport async function ensureSvelteKitSync(\n root: string,\n runtime?: WriteResultRuntime,\n logger: Logger = NOOP_LOGGER,\n): Promise<boolean> {\n if (!existsSync(path.join(root, \"node_modules\", \"@sveltejs\", \"kit\"))) {\n return false;\n }\n if (existsSync(path.join(root, \"node_modules\", \"$app\", \"tsconfig.json\"))) {\n return false;\n }\n try {\n await executeCommand(root, \"execute\", [\"svelte-kit\", \"sync\"], runtime);\n return true;\n } catch (error) {\n logger.info(\n `svelte-kit sync failed (${error instanceof Error ? error.message : String(error)}); node_modules/$app is missing`,\n );\n return false;\n }\n}\n\ntype DependencyBlocks = Record<string, Record<string, string> | undefined>;\n\nconst DEPENDENCY_BLOCKS = [\n \"dependencies\",\n \"devDependencies\",\n \"optionalDependencies\",\n] as const;\n\n/** The lowest version a range names, as numbers, or null when it is no semver range. */\nfunction rangeFloor(spec: string): number[] | null {\n const match = spec\n .trim()\n .match(\n /^(?:[\\^~=v]|>=?)?\\s*(\\d+)(?:\\.(\\d+|[xX*]))?(?:\\.(\\d+|[xX*]))?(-[0-9A-Za-z.-]+)?$/,\n );\n if (!match) {\n return null;\n }\n const part = (value: string | undefined) =>\n value === undefined || /[xX*]/.test(value) ? 0 : Number(value);\n // A prerelease sorts below its release.\n return [part(match[1]), part(match[2]), part(match[3]), match[4] ? 0 : 1];\n}\n\nfunction compareFloors(a: number[], b: number[]): number {\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return a[i]! - b[i]!;\n }\n }\n return 0;\n}\n\n/**\n * The dependency entries `shadcn-svelte add` changed that have to go back:\n * shadcn replaces any range its registry item's own range does not cover,\n * downgrades included. The form item asked for `sveltekit-superforms` ^2,\n * which SvelteKit 3 cannot install, over the project's 3.x pin (the item is\n * gone from the registry and `form` ships from this package now, but any\n * item may do the same to another package). So an\n * entry the project already had is restored when shadcn moved it below\n * where it was, or when it is not a semver range at all (file:, git,\n * workspace:). A raised floor and every new entry are kept.\n */\nexport function restoreDowngradedDependencies(\n before: DependencyBlocks,\n after: DependencyBlocks,\n): { pkg: DependencyBlocks; restored: string[] } {\n const pkg: DependencyBlocks = { ...after };\n const restored: string[] = [];\n const previous = new Map<string, string>();\n for (const block of DEPENDENCY_BLOCKS) {\n for (const [name, spec] of Object.entries(before[block] ?? {})) {\n previous.set(name, spec);\n }\n }\n for (const block of DEPENDENCY_BLOCKS) {\n const entries = after[block];\n if (!entries) {\n continue;\n }\n for (const [name, spec] of Object.entries(entries)) {\n const old = previous.get(name);\n if (old === undefined || old === spec) {\n continue;\n }\n const oldFloor = rangeFloor(old);\n const newFloor = rangeFloor(spec);\n const keep =\n oldFloor !== null &&\n newFloor !== null &&\n compareFloors(newFloor, oldFloor) >= 0;\n if (keep) {\n continue;\n }\n pkg[block] = { ...(pkg[block] as Record<string, string>), [name]: old };\n restored.push(`${name}@${old}`);\n }\n }\n return { pkg, restored };\n}\n\nfunction readPackageJson(root: string): Record<string, unknown> | null {\n const file = path.join(root, \"package.json\");\n if (!existsSync(file)) {\n return null;\n }\n return JSON.parse(readFileSync(file, \"utf8\")) as Record<string, unknown>;\n}\n\n/**\n * Packages a project is brought up to, not just given when it has none: what\n * the generated code imports from them did not exist in earlier releases.\n * Any other package is left at whatever version the project has, since a\n * floor in `versions.json` rises every week and a generator should not move\n * a project's dependencies each time it runs.\n */\nconst FLOOR_ENFORCED = new Set<string>([\n // `requireUser` in `@velastack/pocketbase/auth` is new in 0.5.3.\n \"@velastack/pocketbase\",\n]);\n\n/**\n * Whether the project has `spec`'s package at a version below the one the\n * spec starts at, for the packages in `FLOOR_ENFORCED`. The version is the\n * installed one when there is a `node_modules`, since a range such as\n * `^0.5.1` says nothing about which release the lockfile holds; without one,\n * the floor of the range in `package.json`.\n */\nfunction isBelowFloor(root: string, spec: string): boolean {\n const name = packageName(spec);\n if (!FLOOR_ENFORCED.has(name)) return false;\n const wanted = rangeFloor(spec.slice(name.length + 1));\n if (!wanted) return false;\n\n let have: number[] | null = null;\n const installedManifest = path.join(\n root,\n \"node_modules\",\n ...name.split(\"/\"),\n \"package.json\",\n );\n if (existsSync(installedManifest)) {\n try {\n const { version } = JSON.parse(readFileSync(installedManifest, \"utf8\"));\n have = typeof version === \"string\" ? rangeFloor(version) : null;\n } catch {\n have = null;\n }\n } else {\n const manifest = JSON.parse(\n readFileSync(path.join(root, \"package.json\"), \"utf8\"),\n ) as Record<string, Record<string, string> | undefined>;\n const range = [\n \"dependencies\",\n \"devDependencies\",\n \"optionalDependencies\",\n \"peerDependencies\",\n ]\n .map((block) => manifest[block]?.[name])\n .find((value) => typeof value === \"string\");\n have = range ? rangeFloor(range) : null;\n }\n // Something that is not a plain version (a workspace or git dependency) is\n // the project's own business.\n return have !== null && compareFloors(have, wanted) < 0;\n}\n\nasync function installPackages(\n root: string,\n packages: string[],\n runtime?: WriteResultRuntime,\n logger: Logger = NOOP_LOGGER,\n): Promise<string[]> {\n if (packages.length === 0) {\n return [];\n }\n\n const installed = installedPackagesFromProject(root);\n const toInstall = [...new Set(packages)].filter(\n (pkg) => !installed.has(packageName(pkg)) || isBelowFloor(root, pkg),\n );\n if (toInstall.length === 0) {\n return [];\n }\n\n reconcileFormsnap(root, installed, toInstall, logger);\n\n logger.info(`Installing packages: ${toInstall.join(\", \")}`);\n // `--save-exact` applies to a whole command, so exact pins go in their own.\n const exact = toInstall.filter(isExactSpec);\n const ranged = toInstall.filter((spec) => !isExactSpec(spec));\n if (exact.length > 0) {\n await executeCommand(root, \"install\", exact, runtime, { exact: true });\n }\n if (ranged.length > 0) {\n await executeCommand(root, \"install\", ranged, runtime);\n }\n return toInstall;\n}\n\n/**\n * `npm uninstall` for the listed packages that `package.json` records. The\n * inverse of `installPackages`: names not present are skipped, so a disable\n * pattern can name everything its enable counterpart installed.\n */\nasync function uninstallPackages(\n root: string,\n packages: string[],\n runtime?: WriteResultRuntime,\n logger: Logger = NOOP_LOGGER,\n): Promise<string[]> {\n if (packages.length === 0) {\n return [];\n }\n\n const installed = installedPackagesFromProject(root);\n const toRemove = [...new Set(packages.map(packageName))].filter((pkg) =>\n installed.has(pkg),\n );\n if (toRemove.length === 0) {\n return [];\n }\n\n logger.info(`Removing packages: ${toRemove.join(\", \")}`);\n await executeCommand(root, \"uninstall\", toRemove, runtime);\n return toRemove;\n}\n\nexport function isCustomComponent(component: string): boolean {\n return getAllCustomComponents().includes(component);\n}\n\nfunction customNpmPackagesFor(components: string[]): string[] {\n return [\n ...new Set(\n components.flatMap((component) => customNpmPackages[component] ?? []),\n ),\n ];\n}\n\nfunction copyCustomComponent(\n component: string,\n targetComponentsDir: string,\n): void {\n const targetDir = path.join(targetComponentsDir, component);\n mkdirSync(targetDir, { recursive: true });\n\n for (const [assetPath, content] of Object.entries(customComponentAssets)) {\n if (componentNameFromAssetPath(assetPath) !== component) {\n continue;\n }\n const relativePath = componentRelativeAssetPath(assetPath);\n if (!relativePath) {\n continue;\n }\n\n const outputPath = path.join(targetDir, relativePath);\n mkdirSync(path.dirname(outputPath), { recursive: true });\n writeFileSync(outputPath, content, \"utf8\");\n }\n}\n\nconst FORMATTABLE_EXTENSIONS = new Set([\n \".ts\",\n \".js\",\n \".svelte\",\n \".json\",\n \".css\",\n]);\n\nfunction* filesUnder(target: string): Generator<string> {\n if (!existsSync(target)) {\n return;\n }\n if (statSync(target).isFile()) {\n yield target;\n return;\n }\n const entries = readdirSync(target, { recursive: true, withFileTypes: true });\n for (const entry of entries) {\n if (entry.isFile()) {\n yield path.join(entry.parentPath, entry.name);\n }\n }\n}\n\n/**\n * `shadcn-svelte add` and `apply` write files in the registry's style and the\n * bundled components carry this repo's; the project's `npm run lint` expects\n * its own. Runs the project's prettier over the given files and directories\n * (relative to the root or absolute) and returns the relative paths it\n * changed. Paths that do not exist are skipped.\n */\nexport async function formatPaths(\n root: string,\n paths: string[],\n): Promise<string[]> {\n const context = { env: \"runtime\" as const, root };\n const changed: string[] = [];\n for (const target of paths) {\n for (const filePath of filesUnder(toTargetPath(root, target))) {\n if (!FORMATTABLE_EXTENSIONS.has(path.extname(filePath))) {\n continue;\n }\n const content = readFileSync(filePath, \"utf8\");\n const formatted = await formatSource(content, filePath, context);\n if (formatted !== content) {\n writeFileSync(filePath, formatted, \"utf8\");\n changed.push(path.relative(root, filePath));\n }\n }\n }\n return changed;\n}\n\n/**\n * A digest of every file under the given directories. Content, not mtime: a\n * file rewritten within the filesystem's timestamp tick keeps its mtime.\n */\nfunction fileDigests(dirs: string[]): Map<string, string> {\n const digests = new Map<string, string>();\n for (const dir of dirs) {\n for (const filePath of filesUnder(dir)) {\n digests.set(\n filePath,\n createHash(\"sha1\").update(readFileSync(filePath)).digest(\"hex\"),\n );\n }\n }\n return digests;\n}\n\n/** The files under the directories that are new or changed since `before`. */\nfunction filesWrittenSince(\n before: Map<string, string>,\n dirs: string[],\n): string[] {\n return [...fileDigests(dirs)]\n .filter(([filePath, digest]) => before.get(filePath) !== digest)\n .map(([filePath]) => filePath);\n}\n\n/** The component directories a project has, sorted. */\nexport function installedComponents(root: string): Component[] {\n const uiDir = resolveUiDir(root);\n if (!existsSync(uiDir)) {\n return [];\n }\n return readdirSync(uiDir, { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry) => entry.name)\n .sort();\n}\n\n/** Bare item names are checked against the index; URLs and `@scope/item` are shadcn's to resolve. */\nconst BARE_ITEM_NAME = /^[a-z0-9][a-z0-9-]*$/i;\n\n/**\n * How long an unreachable registry is left alone. One command checks the\n * names up to three times (a pattern's preflight, `writeResult`,\n * `installComponents`); offline, only the first should wait out the timeout\n * and say so. Short, so a long-lived caller asks again once it may be online.\n */\nconst REGISTRY_RETRY_MS = 30_000;\n\nconst registryUnavailableAt = new WeakMap<typeof fetch, Map<string, number>>();\n\n/**\n * A name the style's registry does not list would otherwise reach\n * `shadcn-svelte add`, which fails after a fetch with a message that never\n * mentions the style. Skipped when the registry cannot be read: shadcn will\n * report that itself.\n */\nasync function assertKnownRegistryItems(\n root: string,\n components: Component[],\n runtime: WriteResultRuntime | undefined,\n logger: Logger,\n): Promise<void> {\n const bare = components.filter((component) => BARE_ITEM_NAME.test(component));\n if (bare.length === 0) {\n return;\n }\n const config = readComponentsConfig(root);\n const url = registryIndexUrl(config.registry, config.style);\n const fetchImpl = runtime?.fetch ?? globalThis.fetch;\n const failedAt = registryUnavailableAt.get(fetchImpl)?.get(url);\n if (failedAt !== undefined && Date.now() - failedAt < REGISTRY_RETRY_MS) {\n return;\n }\n let known: Set<string>;\n try {\n const index = await fetchRegistryIndex(root, { runtime });\n known = new Set(index.map((item) => item.name));\n } catch (error) {\n if (!(error instanceof RegistryUnavailableError)) throw error;\n logger.info(`${error.message}; leaving component names to shadcn-svelte`);\n let failures = registryUnavailableAt.get(fetchImpl);\n if (!failures) {\n failures = new Map();\n registryUnavailableAt.set(fetchImpl, failures);\n }\n failures.set(url, Date.now());\n return;\n }\n const unknown = bare.filter((component) => !known.has(component));\n if (unknown.length === 0) {\n return;\n }\n const names = unknown.map((component) => `\"${component}\"`).join(\", \");\n throw new InvalidArgumentError(\n `Unknown component${unknown.length > 1 ? \"s\" : \"\"} ${names} for style ${config.style}. Run \\`vela ui list\\` to see what is available.`,\n );\n}\n\n/** What one `installComponents` call will do, worked out without touching the project. */\ninterface ComponentPlan {\n /** Requested but already in the project, and so left alone. */\n skipped: Component[];\n /** Copied from this package: the requested ones and the bundled components they build on, sorted. */\n custom: Component[];\n /** Handed to `shadcn-svelte add`: the requested ones and what the bundled components import, sorted. */\n registry: Component[];\n}\n\nfunction planComponentInstall(\n root: string,\n components: Component[],\n overwrite: boolean,\n): ComponentPlan {\n const requested = [...new Set(components)];\n if (requested.length === 0) {\n return { skipped: [], custom: [], registry: [] };\n }\n\n // `shadcn-svelte add` exits 1 without a `components.json`, after the custom\n // components and their packages are already in. Checked first, so a project\n // without shadcn-svelte is refused whole rather than left half-written.\n if (!existsSync(path.join(root, \"components.json\"))) {\n throw new MissingShadcnError(\n `Adding ${requested.length > 1 ? \"components\" : \"a component\"} (${requested.join(\", \")})`,\n );\n }\n\n const componentsDir = resolveUiDir(root);\n const isPresent = (component: string) =>\n existsSync(path.join(componentsDir, component));\n\n const skipped = overwrite ? [] : requested.filter(isPresent);\n const toInstall = requested.filter(\n (component) => !skipped.includes(component),\n );\n\n const customToInstall = new Set(toInstall.filter(isCustomComponent));\n const publicToInstall = new Set(\n toInstall.filter((component) => !isCustomComponent(component)),\n );\n\n // Dependencies are added only when missing, even under `overwrite`:\n // re-adding `button` because `pagination` was re-added would clobber edits\n // the user never asked to lose.\n for (const component of [...customToInstall]) {\n for (const dependency of customDependencies[component] ?? []) {\n if (isPresent(dependency)) {\n continue;\n }\n if (isCustomComponent(dependency)) {\n customToInstall.add(dependency);\n } else {\n publicToInstall.add(dependency);\n }\n }\n }\n\n return {\n skipped,\n custom: [...customToInstall].sort(),\n registry: [...publicToInstall].sort(),\n };\n}\n\n/**\n * Every reason an install would be refused, checked before it writes\n * anything: copying a bundled component, installing its packages and\n * spawning `shadcn-svelte add` all come after.\n */\nasync function assertPlanInstallable(\n root: string,\n plan: ComponentPlan,\n runtime: WriteResultRuntime | undefined,\n logger: Logger,\n): Promise<void> {\n // `installPackages` keeps an existing @tanstack/table-core whatever its range.\n assertTableCorePackage(root, plan.custom);\n if (plan.custom.includes(\"data-table-pagination\")) {\n assertRegistryPagination(root);\n }\n await assertKnownRegistryItems(root, plan.registry, runtime, logger);\n}\n\nexport interface AssertComponentsAvailableOptions {\n /** As for `installComponents`: also check the named components that are already present. */\n overwrite?: boolean;\n logger?: Logger;\n}\n\n/**\n * The preflight for `installComponents`: throws what it would throw for\n * these components, and changes nothing. `MissingShadcnError` without a\n * `components.json`, `InvalidArgumentError` for a name the style's registry\n * does not list (or a project whose table helpers are a major behind).\n * Components already in the project are not checked, as they are not\n * installed.\n *\n * For a caller with side effects of its own ahead of the install. A pattern\n * creates its collections first, and PocketBase writes each one's migration\n * file as it does, so a component the registry has dropped used to leave a\n * migration (and the bundled components, and their packages) behind a run\n * that then failed. `writeResult` and `installComponents` run the same\n * checks before their first write.\n *\n * A registry that cannot be read (offline, a timeout, an HTTP error) does not\n * fail the preflight: the names go unchecked, a line is logged, and\n * `shadcn-svelte add` reports the problem if it is still there at install\n * time, as it did before there was a preflight. The failure is remembered for\n * 30 seconds so the later checks of the same run neither wait nor repeat it.\n */\nexport async function assertComponentsAvailable(\n root: string,\n components: Component[],\n options: AssertComponentsAvailableOptions = {},\n runtime?: WriteResultRuntime,\n): Promise<void> {\n const plan = planComponentInstall(\n root,\n components,\n options.overwrite ?? false,\n );\n await assertPlanInstallable(root, plan, runtime, getLogger(options));\n}\n\nexport async function installComponents(\n options: InstallComponentsOptions,\n runtime?: WriteResultRuntime,\n): Promise<InstallComponentsResult> {\n const { root, components, overwrite = false } = options;\n const logger = getLogger(options);\n const plan = planComponentInstall(root, components, overwrite);\n await assertPlanInstallable(root, plan, runtime, logger);\n return applyComponentPlan(root, plan, runtime, logger);\n}\n\n/** Carries out a plan `assertPlanInstallable` has passed. */\nasync function applyComponentPlan(\n root: string,\n plan: ComponentPlan,\n runtime: WriteResultRuntime | undefined,\n logger: Logger,\n): Promise<InstallComponentsResult> {\n const { skipped, custom: customList, registry: publicList } = plan;\n if (skipped.length > 0) {\n logger.info(`Already present: ${skipped.join(\", \")}`);\n }\n if (customList.length === 0 && publicList.length === 0) {\n return { installed: [], skipped, packages: [] };\n }\n\n const componentsDir = resolveUiDir(root);\n mkdirSync(componentsDir, { recursive: true });\n\n const installed: string[] = [];\n let packages: string[] = [];\n const shadcnDirs = [path.join(root, \"src\", \"lib\"), componentsDir];\n let beforeShadcn: Map<string, string> | undefined;\n\n // The bundled components carry this repo's style and shadcn-svelte's files\n // the registry's. Whatever reached the project is formatted, whether or not\n // the install got to its end: a package install or `shadcn-svelte add` that\n // fails after the components were copied used to leave them as they came,\n // for the project's `prettier --check` to trip over.\n const formatWritten = () =>\n formatPaths(root, [\n ...new Set([\n ...installed.map((component) => path.join(componentsDir, component)),\n ...(beforeShadcn ? filesWrittenSince(beforeShadcn, shadcnDirs) : []),\n ]),\n ]);\n\n try {\n if (customList.length > 0) {\n logger.info(`Installing custom components: ${customList.join(\", \")}`);\n }\n for (const component of customList) {\n copyCustomComponent(component, componentsDir);\n installed.push(component);\n }\n\n packages = await installPackages(\n root,\n customNpmPackagesFor(customList),\n runtime,\n logger,\n );\n\n // `shadcn-svelte add` writes more than the items it is given: each one's\n // registry dependencies too (`command` brings `dialog` and `input-group`),\n // over a copy the project already has, and hooks and utils beside the\n // components. All of it arrives in the registry's style.\n beforeShadcn = publicList.length > 0 ? fileDigests(shadcnDirs) : undefined;\n\n if (publicList.length > 0) {\n logger.info(\n `Installing shadcn-svelte components: ${publicList.join(\", \")}`,\n );\n // shadcn-svelte reads the tsconfig, whose `extends` an install may have pruned.\n await ensureSvelteKitSync(root, runtime, logger);\n // shadcn only records its packages; they are installed below, once any\n // pin it moved backwards is put back.\n const before = readPackageJson(root);\n await executeCommand(\n root,\n \"execute\",\n [\n \"shadcn-svelte\",\n \"add\",\n \"--yes\",\n \"--overwrite\",\n \"--no-deps-install\",\n ...publicList,\n ],\n runtime,\n );\n installed.push(...publicList);\n const after = readPackageJson(root);\n if (before && after && JSON.stringify(before) !== JSON.stringify(after)) {\n const { pkg, restored } = restoreDowngradedDependencies(\n before as DependencyBlocks,\n after as DependencyBlocks,\n );\n if (restored.length > 0) {\n logger.info(\n `Kept ${restored.join(\", \")} (shadcn-svelte asked for an older range)`,\n );\n const file = path.join(root, \"package.json\");\n const indent =\n readFileSync(file, \"utf8\").match(/^[{]\\s*\\n([\\t ]+)/)?.[1] ?? \"\\t\";\n writeFileSync(file, `${JSON.stringify(pkg, null, indent)}\\n`, \"utf8\");\n }\n const recorded = (pkg: Record<string, unknown>) =>\n new Set(\n DEPENDENCY_BLOCKS.flatMap((block) =>\n Object.keys((pkg[block] as Record<string, string>) ?? {}),\n ),\n );\n const had = recorded(before);\n const added = [...recorded(after)].filter((name) => !had.has(name));\n reconcileFormsnap(root, had, added, logger);\n await executeCommand(root, \"install\", [], runtime);\n }\n }\n } catch (error) {\n // The install's error is the one to report.\n await formatWritten().catch(() => {});\n throw error;\n }\n await formatWritten();\n\n const installedList = [...new Set(installed)].sort();\n return { installed: installedList, skipped, packages };\n}\n\nexport async function writeResult(\n result: Result,\n options: Options,\n runtime?: WriteResultRuntime,\n): Promise<Result> {\n const logger = getLogger(options);\n\n const writtenResult: Result = {\n creates: [],\n modifies: [],\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n };\n\n // Before anything is dropped, written or installed: a component that\n // cannot be installed refuses the whole result.\n const componentPlan = planComponentInstall(\n options.root,\n result.components,\n false,\n );\n await assertPlanInstallable(options.root, componentPlan, runtime, logger);\n\n let dropMigrationCreates: Result[\"creates\"] = [];\n if (result.collectionDrops.length > 0) {\n const { dropCollections } = await import(\"./collections\");\n // PocketBase writes these while the collections drop, after the result\n // was formatted, so they still carry its own style.\n dropMigrationCreates = await Promise.all(\n (await dropCollections(result.collectionDrops, options)).map(\n async (file) => ({\n ...file,\n content: await formatSource(file.content, file.path, options, {\n created: true,\n }),\n }),\n ),\n );\n }\n\n // A package.json edit lands before the package manager runs, so the install\n // builds on it. Written after, its content (read before the install) would\n // take back every dependency the install just recorded.\n const packageJsonPath = path.resolve(options.root, \"package.json\");\n const isPackageJson = (file: Result[\"modifies\"][number]) =>\n file.status === \"success\" &&\n path.resolve(toTargetPath(options.root, file.path)) === packageJsonPath;\n for (const file of result.modifies.filter(isPackageJson)) {\n writeFile(packageJsonPath, file.content);\n }\n\n const packageInstalls = await installPackages(\n options.root,\n result.packages,\n runtime,\n logger,\n );\n\n const componentInstalls = await applyComponentPlan(\n options.root,\n componentPlan,\n runtime,\n logger,\n );\n\n const packageUninstalls = await uninstallPackages(\n options.root,\n result.uninstalls ?? [],\n runtime,\n logger,\n );\n\n for (const file of [...result.creates, ...dropMigrationCreates]) {\n if (file.status !== \"success\") {\n // A modifier that could not recognise the file it was asked to edit\n // reports `failed` / `not-found` with a paste-ready remediation snippet.\n // Nothing is written, but the entry has to survive into the result: this\n // loop used to `continue` before pushing, so the entry never reached the\n // caller at all and the snippet was lost. The pattern reported success\n // and simply said nothing about the file it had given up on.\n writtenResult.creates.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n continue;\n }\n const target = toTargetPath(options.root, file.path);\n if (!existsSync(target)) {\n writeFile(target, file.content);\n writtenResult.creates.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n continue;\n }\n // A `written` file is the run's own (a migration PocketBase wrote and\n // `readMigration` formatted), reported even when there is nothing left\n // to write: the CLI lists a new migration from this entry.\n const changed = readFileSync(target, \"utf8\") !== file.content;\n if (changed) {\n writeFile(target, file.content);\n }\n if (changed || file.written) {\n // The marker is this module's and `readMigration`'s; callers get the\n // entry in the shape it always had.\n const { written: _written, ...reported } = file;\n writtenResult.modifies.push({\n ...reported,\n path: toRelativePath(options.root, file.path),\n });\n }\n }\n\n for (const file of result.modifies) {\n if (isPackageJson(file)) {\n writtenResult.modifies.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n continue;\n }\n if (file.status !== \"success\") {\n // Carried through unwritten, so the caller can report the failure. See\n // the note in the creates loop above.\n writtenResult.modifies.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n continue;\n }\n writeFile(toTargetPath(options.root, file.path), file.content);\n writtenResult.modifies.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n }\n\n for (const file of result.deletes) {\n if (file.status !== \"success\") {\n writtenResult.deletes.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n continue;\n }\n if (existsSync(toTargetPath(options.root, file.path))) {\n removeFile(toTargetPath(options.root, file.path), options.root);\n writtenResult.deletes.push({\n ...file,\n path: toRelativePath(options.root, file.path),\n });\n }\n }\n\n return {\n ...result,\n creates: writtenResult.creates,\n modifies: writtenResult.modifies,\n deletes: writtenResult.deletes,\n components: componentInstalls.installed,\n packages: [...new Set([...packageInstalls, ...componentInstalls.packages])],\n ...(packageUninstalls.length > 0 ? { uninstalls: packageUninstalls } : {}),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;A,IAiEa0J,KAA+C;CAC1D,aAAa,CAAC,OAAO;CACrB,MAAM,CAAC,SAAS,QAAQ;CACxB,aAAa;EAAC;EAAW;EAAW;CAAQ;CAC5C,UAAU,CAAC,UAAU,SAAS;CAC9B,OAAO,CAAC,OAAO;CACf,cAAc,CAAC;CACf,iBAAiB,CAAC,iBAAiB,QAAQ;CAC3C,kBAAkB;EAAC;EAAW;EAAW;EAAU;EAAa;CAAO;CACvE,yBAAyB,CAAC,cAAc,QAAQ;CAChD,eAAe,CAAC,iBAAiB,QAAQ;CACzC,SAAS,CAAC;CACV,aAAa,CAAC,iBAAiB,QAAQ;AACzC,GAEMC,KAAuC;CAC3C,aAAa,CAACjF,CAAQ;CAGtB,MAAM,CAACA,GAAUC,CAAU;CAC3B,aAAa,CAACD,CAAQ;CACtB,UAAU,CAAC;CAC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