@velastack/patterns 0.0.56 → 0.0.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{generate.runtime-CEtVUz4k.js → generate.runtime-D8RXOVVA.js} +2 -2
- package/dist/chunks/{generate.runtime-CEtVUz4k.js.map → generate.runtime-D8RXOVVA.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DQLmiRz6.js → generate.runtime-D_JOcL6A.js} +3 -3
- package/dist/chunks/generate.runtime-D_JOcL6A.js.map +1 -0
- package/dist/chunks/{write-result-I15cELAq.js → write-result-CLSL_F-E.js} +2 -2
- package/dist/chunks/{write-result-I15cELAq.js.map → write-result-CLSL_F-E.js.map} +1 -1
- package/dist/index.js +162 -162
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/generate.runtime-DQLmiRz6.js.map +0 -1
|
@@ -90,7 +90,7 @@ async function p(r) {
|
|
|
90
90
|
o.info("Reverting nav-user.svelte");
|
|
91
91
|
let e = s.join(r.root, "src", "lib", "components", "nav-user.svelte");
|
|
92
92
|
l(n(e, d(e))), o.info("Reverting signup +page.server.ts");
|
|
93
|
-
let t = s.join(r.root, "src", "routes", "(public)", "signup", "+page.server.ts");
|
|
93
|
+
let t = s.join(r.root, "src", "routes", "(public)", "(auth)", "signup", "+page.server.ts");
|
|
94
94
|
l(n(t, f(t)));
|
|
95
95
|
}
|
|
96
96
|
return {
|
|
@@ -113,4 +113,4 @@ async function p(r) {
|
|
|
113
113
|
//#endregion
|
|
114
114
|
export { p as generate };
|
|
115
115
|
|
|
116
|
-
//# sourceMappingURL=generate.runtime-
|
|
116
|
+
//# sourceMappingURL=generate.runtime-D8RXOVVA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-
|
|
1
|
+
{"version":3,"file":"generate.runtime-D8RXOVVA.js","names":[],"sources":["../../src/patterns/disable/payments/modifies/modify-nav-user.ts","../../src/patterns/disable/payments/modifies/modify-user-signup.ts","../../src/patterns/disable/payments/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport { removeNavItemFromScript } from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nexport function unmodifyNavUser(navUserPath: string): ModifyOutcome {\n if (!fs.existsSync(navUserPath)) {\n return { status: \"success\", changed: false };\n }\n\n const source = fs.readFileSync(navUserPath, \"utf8\");\n if (!source.includes(\"/billing\")) {\n return { status: \"success\", changed: false };\n }\n\n const file = new SvelteFile(source);\n let wasRemoved = false;\n\n const tryRemove = (run: (fn: (s: string) => string) => boolean) => {\n if (wasRemoved) return;\n run((src) => {\n const result = removeNavItemFromScript(\n src,\n \"Billing\",\n \"@lucide/svelte/icons/credit-card\",\n );\n if (result.wasRemoved) wasRemoved = true;\n return result.source;\n });\n };\n\n tryRemove((fn) => file.modifyModuleScript(fn));\n if (!wasRemoved) tryRemove((fn) => file.modifyScript(fn));\n\n if (!wasRemoved) {\n return { status: \"success\", changed: false };\n }\n\n fs.writeFileSync(navUserPath, file.toString(), \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nexport function unmodifyUserSignup(userSignupPath: string): ModifyOutcome {\n if (!fs.existsSync(userSignupPath)) {\n return { status: \"success\", changed: false };\n }\n\n const originalSource = fs.readFileSync(userSignupPath, \"utf8\");\n if (!originalSource.includes(\"linkStripeCustomer\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project({\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(userSignupPath);\n\n const stripeImport = sourceFile\n .getImportDeclarations()\n .find((d) => d.getModuleSpecifierValue() === \"$lib/stripe\");\n if (stripeImport) stripeImport.remove();\n\n const linkFn = sourceFile.getVariableStatement((s) =>\n s.getDeclarations().some((d) => d.getName() === \"linkStripeCustomer\"),\n );\n if (linkFn) linkFn.remove();\n\n const callStatements = sourceFile\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .filter((ce) => ce.getExpression().getText() === \"linkStripeCustomer\");\n for (const call of callStatements) {\n const stmt = call.getFirstAncestorByKind(SyntaxKind.ExpressionStatement);\n if (stmt) stmt.remove();\n }\n\n sourceFile.formatText();\n sourceFile.saveSync();\n\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== originalSource,\n };\n}\n","import path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifyEnvRemove, type EnvEdit } from \"../../../runtime/env\";\nimport { unmodifyNavUser } from \"./modifies/modify-nav-user\";\nimport { unmodifyUserSignup } from \"./modifies/modify-user-signup\";\nimport { planDropsForCollections } from \"../../destroy/shared\";\n\nexport async function generate(options: Options) {\n const isAppMode = options.features.auth;\n const logger = getLogger(options);\n const modifies: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Stripping Stripe credentials from .env\");\n const envEdits: EnvEdit[] = [\n { type: \"comment\", key: \"Stripe credentials\" },\n { type: \"var\", key: \"STRIPE_SECRET_KEY\" },\n { type: \"var\", key: \"PUBLIC_STRIPE_PUBLISHABLE_KEY\" },\n { type: \"var\", key: \"STRIPE_WEBHOOK_SECRET\" },\n { type: \"var\", key: \"INTERNAL_JOB_SECRET\" },\n ];\n const envPath = path.join(options.root, \".env\");\n pushResult(modifyOutcomeToFile(envPath, modifyEnvRemove(envPath, envEdits)));\n\n if (isAppMode) {\n logger.info(\"Reverting nav-user.svelte\");\n const navUserPath = path.join(\n options.root,\n \"src\",\n \"lib\",\n \"components\",\n \"nav-user.svelte\",\n );\n pushResult(modifyOutcomeToFile(navUserPath, unmodifyNavUser(navUserPath)));\n\n logger.info(\"Reverting signup +page.server.ts\");\n const userSignupPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(public)\",\n \"(auth)\",\n \"signup\",\n \"+page.server.ts\",\n );\n pushResult(\n modifyOutcomeToFile(userSignupPath, unmodifyUserSignup(userSignupPath)),\n );\n }\n\n const collectionNames = [\n \"transactions\",\n \"stripe_customers\",\n \"stripe_payment_methods\",\n \"stripe_prices\",\n \"stripe_products\",\n ];\n const collectionDrops = await planDropsForCollections(\n isAppMode ? collectionNames : [\"stripe_prices\", \"stripe_products\"],\n options,\n );\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops,\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;AAKA,SAAgB,EAAgB,GAAoC;AAClE,KAAI,CAAC,EAAG,WAAW,EAAY,CAC7B,QAAO;EAAE,QAAQ;EAAW,SAAS;EAAO;CAG9C,IAAM,IAAS,EAAG,aAAa,GAAa,OAAO;AACnD,KAAI,CAAC,EAAO,SAAS,WAAW,CAC9B,QAAO;EAAE,QAAQ;EAAW,SAAS;EAAO;CAG9C,IAAM,IAAO,IAAI,EAAW,EAAO,EAC/B,IAAa,IAEX,KAAa,MAAgD;AAC7D,OACJ,GAAK,MAAQ;GACX,IAAM,IAAS,EACb,GACA,WACA,mCACD;AAED,UADI,EAAO,eAAY,IAAa,KAC7B,EAAO;IACd;;AAWJ,QARA,GAAW,MAAO,EAAK,mBAAmB,EAAG,CAAC,EACzC,KAAY,GAAW,MAAO,EAAK,aAAa,EAAG,CAAC,EAEpD,KAIL,EAAG,cAAc,GAAa,EAAK,UAAU,EAAE,OAAO,EAC/C;EAAE,QAAQ;EAAW,SAAS;EAAM,IAJlC;EAAE,QAAQ;EAAW,SAAS;EAAO;;;;AC/BhD,SAAgB,EAAmB,GAAuC;AACxE,KAAI,CAAC,EAAG,WAAW,EAAe,CAChC,QAAO;EAAE,QAAQ;EAAW,SAAS;EAAO;CAG9C,IAAM,IAAiB,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A,EAAW,EAAoB,GAAS,EAAgB,GAAS,EAAS,CAAC,CAAC,EAExE,GAAW;AACb,IAAO,KAAK,4BAA4B;EACxC,IAAM,IAAc,EAAK,KACvB,EAAQ,MACR,OACA,OACA,cACA,kBACD;AAGD,EAFA,EAAW,EAAoB,GAAa,EAAgB,EAAY,CAAC,CAAC,EAE1E,EAAO,KAAK,mCAAmC;EAC/C,IAAM,IAAiB,EAAK,KAC1B,EAAQ,MACR,OACA,UACA,YACA,UACA,UACA,kBACD;AACD,IACE,EAAoB,GAAgB,EAAmB,EAAe,CAAC,CACxE;;AAeH,QAAO;EACL,SAAS,EAAE;EACX;EACA,SAAS,EAAE;EACX,YAAY,EAAE;EACd,UAAU,EAAE;EACZ,aAAa,EAAE;EACf,mBAAmB,EAAE;EACrB,iBAbsB,MAAM,EAC5B,IARsB;GACtB;GACA;GACA;GACA;GACA;GACD,GAE+B,CAAC,iBAAiB,kBAAkB,EAClE,EACD;EAWA"}
|
|
@@ -119,7 +119,7 @@ var w = e`
|
|
|
119
119
|
} catch {}
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
|
-
`, T = ["Could not locate the requestVerification call in signup +page.server.ts.", "Add a linkStripeCustomer helper and call it before requestVerification()."].join("\n"), E = ["Create src/routes/(public)/signup/+page.server.ts before enabling payments."].join("\n");
|
|
122
|
+
`, T = ["Could not locate the requestVerification call in signup +page.server.ts.", "Add a linkStripeCustomer helper and call it before requestVerification()."].join("\n"), E = ["Create src/routes/(public)/(auth)/signup/+page.server.ts before enabling payments."].join("\n");
|
|
123
123
|
function D(t) {
|
|
124
124
|
if (!f.existsSync(t)) return {
|
|
125
125
|
status: "not-found",
|
|
@@ -639,7 +639,7 @@ async function P(e) {
|
|
|
639
639
|
l.info("Modifying nav-user.svelte");
|
|
640
640
|
let t = p.join(e.root, "src", "lib", "components", "nav-user.svelte");
|
|
641
641
|
h(i(t, C(t))), l.info("Modifying signup +page.server.ts");
|
|
642
|
-
let n = p.join(e.root, "src", "routes", "(public)", "signup", "+page.server.ts");
|
|
642
|
+
let n = p.join(e.root, "src", "routes", "(public)", "(auth)", "signup", "+page.server.ts");
|
|
643
643
|
h(i(n, D(n)));
|
|
644
644
|
}
|
|
645
645
|
return {
|
|
@@ -656,4 +656,4 @@ async function P(e) {
|
|
|
656
656
|
//#endregion
|
|
657
657
|
export { P as generate };
|
|
658
658
|
|
|
659
|
-
//# sourceMappingURL=generate.runtime-
|
|
659
|
+
//# sourceMappingURL=generate.runtime-D_JOcL6A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.runtime-D_JOcL6A.js","names":[],"sources":["../../src/patterns/enable/payments/modifies/modify-nav-user.ts","../../src/patterns/enable/payments/modifies/modify-user-signup.ts","../../src/patterns/enable/payments/runtime/stripe.ts","../../src/patterns/enable/payments/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport { addNavItemToScript } from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst BILLING_NAV_SNIPPET = [\n \"import CreditCardIcon from '@lucide/svelte/icons/credit-card';\",\n \"\",\n \"// Add to your navUser array:\",\n \"{ title: 'Billing', url: '/billing', icon: CreditCardIcon }\",\n].join(\"\\n\");\n\nconst FAILURE_HINT = [\n \"Add a Billing nav item to nav-user.svelte:\",\n \"\",\n BILLING_NAV_SNIPPET,\n].join(\"\\n\");\n\nconst NOT_FOUND_HINT = [\n \"Create nav-user.svelte with a Billing entry:\",\n \"\",\n BILLING_NAV_SNIPPET,\n].join(\"\\n\");\n\nexport function addItemToNavUser(\n navUserSnippet: string,\n title: string,\n url: string,\n icon: string,\n iconImportPath: string,\n): { newNavUserSnippet: string; wasAdded: boolean } {\n const file = new SvelteFile(navUserSnippet);\n let wasAdded = false;\n\n const tryAdd = (run: (fn: (s: string) => string) => boolean) => {\n if (wasAdded) return;\n run((source) => {\n const result = addNavItemToScript(\n source,\n title,\n url,\n icon,\n iconImportPath,\n );\n if (result.wasAdded) wasAdded = true;\n return result.source;\n });\n };\n\n tryAdd((fn) => file.modifyModuleScript(fn));\n if (!wasAdded) tryAdd((fn) => file.modifyScript(fn));\n\n return { newNavUserSnippet: file.toString(), wasAdded };\n}\n\nexport function modifyNavUser(navUserPath: string): ModifyOutcome {\n if (!fs.existsSync(navUserPath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const navUserSnippet = fs.readFileSync(navUserPath, \"utf8\");\n if (navUserSnippet.includes(\"/billing\")) {\n return { status: \"success\", changed: false };\n }\n\n const { newNavUserSnippet, wasAdded } = addItemToNavUser(\n navUserSnippet,\n \"Billing\",\n \"/billing\",\n \"CreditCardIcon\",\n \"@lucide/svelte/icons/credit-card\",\n );\n\n if (!wasAdded) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n fs.writeFileSync(navUserPath, newNavUserSnippet, \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst LINK_STRIPE_CUSTOMER_SNIPPET = dedent`\n const linkStripeCustomer = async (email: string, user: { id: string }, locals: App.Locals) => {\n const matchingCustomer = await stripe.customers.list({\n email: email,\n limit: 1,\n expand: ['data.invoice_settings']\n });\n\n let customer;\n let isExistingCustomer = false;\n\n if (matchingCustomer.data.length > 0) {\n isExistingCustomer = true;\n customer = matchingCustomer.data[0];\n } else {\n customer = await stripe.customers.create({\n email: email\n });\n }\n\n await locals.admin.collection('stripe_customers').create({\n id: customer.id,\n user: user.id\n });\n\n if (!isExistingCustomer) {\n return;\n }\n\n const paymentMethods = await stripe.customers.listPaymentMethods(customer.id, {\n type: 'card',\n allow_redisplay: 'always'\n });\n\n for (const paymentMethod of paymentMethods.data) {\n if (paymentMethod.allow_redisplay === 'unspecified') {\n continue;\n }\n\n await locals.admin.collection('stripe_payment_methods').create({\n id: paymentMethod.id,\n customer: customer.id,\n brand: paymentMethod.card?.brand,\n last4: paymentMethod.card?.last4,\n exp_month: paymentMethod.card?.exp_month,\n exp_year: paymentMethod.card?.exp_year\n });\n }\n\n const defaultPaymentMethod = customer.invoice_settings?.default_payment_method;\n\n if (defaultPaymentMethod) {\n try {\n await locals.admin.collection('stripe_customers').update(customer.id, {\n default_payment_method: defaultPaymentMethod\n });\n } catch {}\n }\n };\n`;\n\nconst FAILURE_HINT = [\n \"Could not locate the requestVerification call in signup +page.server.ts.\",\n \"Add a linkStripeCustomer helper and call it before requestVerification().\",\n].join(\"\\n\");\n\nconst NOT_FOUND_HINT = [\n \"Create src/routes/(public)/(auth)/signup/+page.server.ts before enabling payments.\",\n].join(\"\\n\");\n\nexport function modifyUserSignup(userSignupPath: string): ModifyOutcome {\n if (!fs.existsSync(userSignupPath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const originalSource = fs.readFileSync(userSignupPath, \"utf8\");\n\n const project = new Project({\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(userSignupPath);\n\n const hasStripeImport = sourceFile\n .getImportDeclarations()\n .some((d) => d.getModuleSpecifierValue() === \"$lib/stripe\");\n\n if (hasStripeImport) {\n return { status: \"success\", changed: false };\n }\n\n sourceFile.addImportDeclaration({\n defaultImport: \"stripe\",\n moduleSpecifier: \"$lib/stripe\",\n });\n\n const requestVerificationCall = sourceFile\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .find((ce) => {\n const expr = ce.getExpression();\n return (\n expr.getKind() === SyntaxKind.PropertyAccessExpression &&\n expr.getText().includes(\"requestVerification\")\n );\n });\n\n if (!requestVerificationCall) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const statement = requestVerificationCall.getFirstAncestorByKind(\n SyntaxKind.ExpressionStatement,\n );\n\n if (!statement) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n sourceFile.addStatements(LINK_STRIPE_CUSTOMER_SNIPPET);\n\n const stripeCall = dedent`\n await linkStripeCustomer(form.data.email, user, locals);\n `;\n\n statement.replaceWithText(stripeCall + \"\\n\\n\" + statement.getText());\n\n sourceFile.formatText();\n sourceFile.saveSync();\n\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== originalSource,\n };\n}\n","import Stripe from \"stripe\";\nimport type PocketBase from \"pocketbase\";\nimport type { Logger } from \"../../../../core/logger\";\n\nexport interface StripeTestFixture {\n product: Stripe.Product;\n price: Stripe.Price;\n existing: boolean;\n}\n\nexport interface SyncUsersResult {\n total: number;\n linked: number;\n created: number;\n reused: number;\n skipped: number;\n}\n\nexport async function syncUsersToStripeCustomers(\n pb: PocketBase,\n stripeSecretKey: string,\n logger: Logger,\n): Promise<SyncUsersResult> {\n const stripe = new Stripe(stripeSecretKey);\n const users = await pb\n .collection(\"users\")\n .getFullList<{ id: string; email: string }>();\n\n const existing = await pb\n .collection(\"stripe_customers\")\n .getFullList<{ id: string; user: string }>();\n const linkedUserIds = new Set(existing.map((c) => c.user));\n\n const result: SyncUsersResult = {\n total: users.length,\n linked: linkedUserIds.size,\n created: 0,\n reused: 0,\n skipped: 0,\n };\n\n for (const user of users) {\n if (linkedUserIds.has(user.id)) {\n result.skipped += 1;\n continue;\n }\n\n if (!user.email) {\n logger.info(`Skipping user ${user.id} with no email`);\n result.skipped += 1;\n continue;\n }\n\n const matching = await stripe.customers.list({\n email: user.email,\n limit: 1,\n expand: [\"data.invoice_settings\"],\n });\n\n let customer: Stripe.Customer;\n let isExistingCustomer = false;\n\n if (matching.data.length > 0) {\n customer = matching.data[0];\n isExistingCustomer = true;\n result.reused += 1;\n logger.info(`Reusing Stripe customer ${customer.id} for ${user.email}`);\n } else {\n customer = await stripe.customers.create({ email: user.email });\n result.created += 1;\n logger.info(`Created Stripe customer ${customer.id} for ${user.email}`);\n }\n\n try {\n await pb.collection(\"stripe_customers\").create({\n id: customer.id,\n user: user.id,\n });\n } catch (error) {\n logger.info(\n `Failed to create stripe_customers row for ${user.email}: ${(error as Error).message}`,\n );\n continue;\n }\n\n if (!isExistingCustomer) {\n continue;\n }\n\n const paymentMethods = await stripe.customers.listPaymentMethods(\n customer.id,\n { type: \"card\", allow_redisplay: \"always\" },\n );\n\n for (const paymentMethod of paymentMethods.data) {\n if (paymentMethod.allow_redisplay === \"unspecified\") continue;\n try {\n await pb.collection(\"stripe_payment_methods\").create({\n id: paymentMethod.id,\n customer: customer.id,\n brand: paymentMethod.card?.brand,\n last4: paymentMethod.card?.last4,\n exp_month: paymentMethod.card?.exp_month,\n exp_year: paymentMethod.card?.exp_year,\n });\n } catch {}\n }\n\n const defaultPaymentMethod =\n customer.invoice_settings?.default_payment_method;\n if (defaultPaymentMethod) {\n try {\n await pb.collection(\"stripe_customers\").update(customer.id, {\n default_payment_method:\n typeof defaultPaymentMethod === \"string\"\n ? defaultPaymentMethod\n : defaultPaymentMethod.id,\n });\n } catch {}\n }\n }\n\n return result;\n}\n\nexport async function createTestProductAndPrice(\n stripeSecretKey: string,\n): Promise<StripeTestFixture> {\n const stripe = new Stripe(stripeSecretKey);\n\n const products = await stripe.products.search({\n query: `name:\"Test Product\" AND metadata[\"test\"]:\"true\"`,\n limit: 1,\n });\n\n if (products.data.length > 0) {\n const product = products.data[0];\n const prices = await stripe.prices.list({\n product: product.id,\n active: true,\n limit: 1,\n });\n if (prices.data.length > 0) {\n return { product, price: prices.data[0], existing: true };\n }\n }\n\n const product = await stripe.products.create({\n name: \"Test Product\",\n metadata: { test: \"true\" },\n });\n\n const price = await stripe.prices.create({\n product: product.id,\n unit_amount: 1000,\n currency: \"usd\",\n });\n\n return { product, price, existing: false };\n}\n\nexport async function getProductAndPriceById(\n stripeSecretKey: string,\n priceId: string,\n): Promise<StripeTestFixture> {\n const stripe = new Stripe(stripeSecretKey);\n const price = await stripe.prices.retrieve(priceId, { expand: [\"product\"] });\n const product =\n typeof price.product === \"string\"\n ? await stripe.products.retrieve(price.product)\n : (price.product as Stripe.Product);\n price.product = product.id;\n return { product, price, existing: true };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { randomBytes } from \"node:crypto\";\nimport dedent from \"dedent\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n getMigrationFile,\n migrationDelay,\n withPocketbase,\n} from \"../../../runtime/pocketbase\";\nimport { createCollectionIdempotent } from \"../../../runtime/collections\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifyNavUser } from \"./modifies/modify-nav-user\";\nimport { modifyUserSignup } from \"./modifies/modify-user-signup\";\nimport { modifyEnv, type EnvEdit } from \"./modifies/modify-env\";\nimport {\n createTestProductAndPrice,\n getProductAndPriceById,\n syncUsersToStripeCustomers,\n} from \"./runtime/stripe\";\n\nasync function pushMigrationCreates(\n creates: File[],\n collectionName: string,\n action: \"created\" | \"updated\",\n options: Options,\n created = true,\n) {\n if (!created) return;\n await migrationDelay();\n const migrationFile = getMigrationFile(collectionName, action, options);\n if (!migrationFile) return;\n creates.push({\n path: migrationFile,\n language: languageFromPath(migrationFile),\n content: fs.readFileSync(migrationFile, \"utf8\"),\n status: \"success\",\n });\n}\n\nfunction paymentPageSnippet(priceId: string): string {\n return dedent`\n <script lang=\"ts\">\n import PaymentButton from '$lib/components/payments/payment-button.svelte';\n </script>\n\n <section data-role=\"content\">\n <PaymentButton priceId=\"${priceId}\" />\n </section>\n `;\n}\n\nexport async function generate(options: Options) {\n const {\n stripeSecretKey,\n stripePublishableKey,\n stripeWebhookSecret,\n stripePriceId,\n } = options.input as {\n stripeSecretKey: string;\n stripePublishableKey: string;\n stripeWebhookSecret: string;\n stripePriceId?: string;\n };\n\n const isAppMode = options.features.auth;\n const logger = getLogger(options);\n const creates: File[] = [];\n const modifies: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Writing Stripe credentials to .env\");\n const internalJobSecret = randomBytes(16).toString(\"hex\");\n const envEdits: EnvEdit[] = [\n { type: \"comment\", key: \"Stripe credentials\" },\n { type: \"var\", key: \"STRIPE_SECRET_KEY\", value: stripeSecretKey },\n {\n type: \"var\",\n key: \"PUBLIC_STRIPE_PUBLISHABLE_KEY\",\n value: stripePublishableKey,\n },\n { type: \"var\", key: \"STRIPE_WEBHOOK_SECRET\", value: stripeWebhookSecret },\n { type: \"var\", key: \"INTERNAL_JOB_SECRET\", value: internalJobSecret },\n ];\n\n const envPath = path.join(options.root, \".env\");\n pushResult(modifyOutcomeToFile(envPath, modifyEnv(envPath, envEdits)));\n\n await withPocketbase(options.root, async (pb) => {\n const create = (spec: Parameters<typeof createCollectionIdempotent>[1]) =>\n createCollectionIdempotent(pb, spec, logger);\n\n logger.info(\"Creating stripe_products collection\");\n const productsResult = await create({\n name: \"stripe_products\",\n type: \"base\",\n fields: [\n {\n name: \"id\",\n pattern: \"^[a-zA-Z0-9_]+$\",\n primaryKey: true,\n required: true,\n system: true,\n type: \"text\",\n },\n { name: \"name\", required: false, type: \"text\" },\n { name: \"active\", required: false, type: \"text\" },\n { name: \"default_price\", required: false, type: \"text\" },\n { name: \"created\", onCreate: true, onUpdate: false, type: \"autodate\" },\n { name: \"updated\", onCreate: true, onUpdate: true, type: \"autodate\" },\n ],\n });\n await pushMigrationCreates(\n creates,\n \"stripe_products\",\n \"created\",\n options,\n productsResult.created,\n );\n\n logger.info(\"Creating stripe_prices collection\");\n const pricesResult = await create({\n name: \"stripe_prices\",\n type: \"base\",\n fields: [\n {\n name: \"id\",\n pattern: \"^[a-zA-Z0-9_]+$\",\n primaryKey: true,\n required: true,\n system: true,\n type: \"text\",\n },\n { name: \"billing_scheme\", required: false, type: \"text\" },\n { name: \"currency\", required: false, type: \"text\" },\n { name: \"product\", required: false, type: \"text\" },\n { name: \"recurring\", required: false, type: \"json\" },\n { name: \"type\", required: false, type: \"text\" },\n { name: \"unit_amount\", required: false, type: \"number\" },\n { name: \"active\", required: false, type: \"bool\" },\n { name: \"created\", onCreate: true, onUpdate: false, type: \"autodate\" },\n { name: \"updated\", onCreate: true, onUpdate: true, type: \"autodate\" },\n ],\n });\n await pushMigrationCreates(\n creates,\n \"stripe_prices\",\n \"created\",\n options,\n pricesResult.created,\n );\n\n if (isAppMode) {\n logger.info(\"Creating stripe_customers collection\");\n const customersResult = await create({\n name: \"stripe_customers\",\n type: \"base\",\n fields: [\n {\n name: \"id\",\n pattern: \"^[a-zA-Z0-9_]+$\",\n primaryKey: true,\n required: true,\n system: true,\n type: \"text\",\n },\n {\n collectionId: \"_pb_users_auth_\",\n maxSelect: 1,\n minSelect: 0,\n name: \"user\",\n required: true,\n type: \"relation\",\n },\n {\n name: \"created\",\n onCreate: true,\n onUpdate: false,\n type: \"autodate\",\n },\n {\n name: \"updated\",\n onCreate: true,\n onUpdate: true,\n type: \"autodate\",\n },\n ],\n });\n const stripeCustomersCollection = customersResult.collection;\n await pushMigrationCreates(\n creates,\n \"stripe_customers\",\n \"created\",\n options,\n customersResult.created,\n );\n\n logger.info(\"Creating stripe_payment_methods collection\");\n const paymentMethodsResult = await create({\n name: \"stripe_payment_methods\",\n type: \"base\",\n fields: [\n {\n name: \"id\",\n pattern: \"^[a-zA-Z0-9_]+$\",\n primaryKey: true,\n required: true,\n system: true,\n type: \"text\",\n },\n { name: \"brand\", required: true, type: \"text\" },\n { name: \"last4\", required: true, type: \"text\" },\n { name: \"exp_month\", required: true, type: \"number\" },\n { name: \"exp_year\", required: true, type: \"number\" },\n {\n collectionId: stripeCustomersCollection.id,\n maxSelect: 1,\n minSelect: 0,\n name: \"customer\",\n required: true,\n type: \"relation\",\n cascadeDelete: true,\n },\n {\n name: \"created\",\n onCreate: true,\n onUpdate: false,\n type: \"autodate\",\n },\n {\n name: \"updated\",\n onCreate: true,\n onUpdate: true,\n type: \"autodate\",\n },\n ],\n });\n const stripePaymentMethodsCollection = paymentMethodsResult.collection;\n await pushMigrationCreates(\n creates,\n \"stripe_payment_methods\",\n \"created\",\n options,\n paymentMethodsResult.created,\n );\n\n logger.info(\"Linking default_payment_method on stripe_customers\");\n await pb.collections.update(\"stripe_customers\", {\n fields: [\n {\n name: \"id\",\n pattern: \"^[a-zA-Z0-9_]+$\",\n primaryKey: true,\n required: true,\n system: true,\n type: \"text\",\n },\n {\n collectionId: \"_pb_users_auth_\",\n maxSelect: 1,\n minSelect: 0,\n name: \"user\",\n required: true,\n type: \"relation\",\n },\n {\n collectionId: stripePaymentMethodsCollection.id,\n maxSelect: 1,\n minSelect: 0,\n name: \"default_payment_method\",\n required: false,\n type: \"relation\",\n },\n {\n name: \"created\",\n onCreate: true,\n onUpdate: false,\n type: \"autodate\",\n },\n {\n name: \"updated\",\n onCreate: true,\n onUpdate: true,\n type: \"autodate\",\n },\n ],\n });\n await pushMigrationCreates(\n creates,\n \"stripe_customers\",\n \"updated\",\n options,\n );\n\n logger.info(\"Creating transactions collection\");\n const transactionsResult = await create({\n name: \"transactions\",\n type: \"base\",\n fields: [\n {\n autogeneratePattern: \"[a-z0-9]{15}\",\n max: 15,\n min: 15,\n name: \"id\",\n pattern: \"^[a-z0-9]+$\",\n primaryKey: true,\n required: true,\n system: true,\n type: \"text\",\n },\n { name: \"stripe_payment_intent\", required: true, type: \"text\" },\n { name: \"amount\", required: true, type: \"number\" },\n { name: \"currency\", required: true, type: \"text\" },\n { name: \"last4\", required: true, type: \"text\" },\n { name: \"brand\", required: true, type: \"text\" },\n { name: \"created\", required: true, type: \"date\" },\n { name: \"stripe_charge\", required: true, type: \"text\" },\n { name: \"stripe_customer\", required: true, type: \"text\" },\n {\n collectionId: \"_pb_users_auth_\",\n maxSelect: 1,\n minSelect: 0,\n name: \"user\",\n required: true,\n type: \"relation\",\n },\n { name: \"receipt_url\", required: true, type: \"url\" },\n ],\n });\n await pushMigrationCreates(\n creates,\n \"transactions\",\n \"created\",\n options,\n transactionsResult.created,\n );\n\n logger.info(\"Syncing existing PocketBase users to Stripe customers\");\n const syncResult = await syncUsersToStripeCustomers(\n pb,\n stripeSecretKey,\n logger,\n );\n logger.info(\n `Synced ${syncResult.total} users (created ${syncResult.created}, reused ${syncResult.reused}, skipped ${syncResult.skipped})`,\n );\n }\n });\n\n if (stripePriceId) {\n logger.info(`Fetching Stripe product/price ${stripePriceId}`);\n } else {\n logger.info(\"Creating test Stripe product and price\");\n }\n const { product, price, existing } = stripePriceId\n ? await getProductAndPriceById(stripeSecretKey, stripePriceId)\n : await createTestProductAndPrice(stripeSecretKey);\n\n if (existing) {\n logger.info(\"Stripe product/price already exists, skipping creation\");\n }\n\n logger.info(\"Seeding Stripe product/price records\");\n await withPocketbase(options.root, async (pb) => {\n try {\n await pb.collection(\"stripe_products\").getOne(product.id);\n } catch (error) {\n await pb.collection(\"stripe_products\").create({\n id: product.id,\n name: product.name,\n active: product.active,\n default_price: product.default_price,\n });\n }\n\n try {\n await pb.collection(\"stripe_prices\").getOne(price.id);\n } catch (error) {\n await pb.collection(\"stripe_prices\").create({\n id: price.id,\n billing_scheme: price.billing_scheme,\n currency: price.currency,\n product: price.product,\n recurring: price.recurring,\n type: price.type,\n unit_amount: price.unit_amount,\n active: price.active,\n });\n }\n });\n\n logger.info(\"Creating payment +page.svelte\");\n creates.push({\n path: \"src/routes/(public)/payment/+page.svelte\",\n language: \"svelte\",\n content: paymentPageSnippet(price.id),\n status: \"success\",\n });\n\n if (isAppMode) {\n logger.info(\"Modifying nav-user.svelte\");\n const navUserPath = path.join(\n options.root,\n \"src\",\n \"lib\",\n \"components\",\n \"nav-user.svelte\",\n );\n pushResult(modifyOutcomeToFile(navUserPath, modifyNavUser(navUserPath)));\n\n logger.info(\"Modifying signup +page.server.ts\");\n const userSignupPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(public)\",\n \"(auth)\",\n \"signup\",\n \"+page.server.ts\",\n );\n pushResult(\n modifyOutcomeToFile(userSignupPath, modifyUserSignup(userSignupPath)),\n );\n }\n\n return {\n creates,\n modifies,\n deletes: [],\n components: [],\n packages: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c } from "package-manager-detector";
|
|
|
5
5
|
import { resolveCommand as l } from "package-manager-detector/commands";
|
|
6
6
|
import u from "cross-spawn";
|
|
7
7
|
//#region src/ui/components/auth-menu/auth-menu-content.svelte?raw
|
|
8
|
-
var d = "<script lang=\"ts\">\n import { cn } from '$lib/utils';\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", f = "<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", p = "<script lang=\"ts\">\n import { goto } from '$app/navigation';\n import * as DropdownMenu from '$lib/components/ui/dropdown-menu';\n import { Button } from '$lib/components/ui/button';\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\n const handleClick = () => {\n if (restProps.onclick) {\n restProps.onclick();\n } else {\n if (href) {\n goto(href);\n }\n }\n };\n<\/script>\n\n{#if isDesktop}\n <DropdownMenu.Item {...restProps} onclick={handleClick}>\n {@render children?.()}\n </DropdownMenu.Item>\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", m = "<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", h = "<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", ee = "<script lang=\"ts\">\n import { cn } from '$lib/utils';\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", te = "<script lang=\"ts\">\n import { page } from '$app/state';\n import { browser } from '$app/environment';\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", g = "export type AuthMenuContext = {\n isDesktop: boolean;\n};\n\nexport const AUTH_MENU_CONTEXT_KEY = Symbol(\"auth-menu-context\");\n", _ = "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", ne = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", re = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", ie = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", ae = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", oe = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", se = "<script lang=\"ts\">\n import FileIcon from '@lucide/svelte/icons/file';\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", v = "<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';\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", y = "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", b = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", x = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", S = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", C = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { Badge } from '$lib/components/ui/badge';\n import { cn } from '$lib/utils';\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", w = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { Badge } from '$lib/components/ui/badge';\n import { cn } from '$lib/utils';\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", T = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", E = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", D = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import type { Column } from '@tanstack/table-core';\n import * as DropdownMenu from '$lib/components/ui/dropdown-menu';\n import { Button } from '$lib/components/ui/button';\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';\n\n let {\n column,\n title,\n class: className,\n ...restProps\n }: { column: Column<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", O = "export { default as ColumnHeader } from \"./column-header.svelte\";\n", k = "<script lang=\"ts\" generics=\"TData, TValue\">\n import type { Component } from 'svelte';\n import { SvelteSet } from 'svelte/reactivity';\n import type { Column } 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';\n import * as Popover from '$lib/components/ui/popover';\n import { Button } from '$lib/components/ui/button';\n import { Separator } from '$lib/components/ui/separator';\n import { Badge } from '$lib/components/ui/badge';\n import { cn } from '$lib/utils';\n\n let {\n column,\n title,\n options\n }: {\n column: Column<TData, TValue>;\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", A = "export { default as FacetedFilter } from \"./faceted-filter.svelte\";\n", j = "<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';\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", M = "<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';\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", N = "<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", P = "<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", F = "<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';\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", I = "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", L = "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", R = "<script lang=\"ts\">\n import { cn } from '$lib/utils';\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", z = "export { default as GeopointInput } from \"./input.svelte\";\n", B = "<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", V = "<script>\n import { Button } from '$lib/components/ui/button';\n import MapIcon from '@lucide/svelte/icons/map';\n import { getContext } from 'svelte';\n import { cn } from '$lib/utils';\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", H = "export { default as Leaflet } from \"./leaflet.svelte\";\n", U = "<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: '© <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", W = "<script lang=\"ts\">\n import type { Snippet } from 'svelte';\n import { cn } from '$lib/utils';\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", ce = "<script lang=\"ts\">\n import { Popover as PopoverPrimitive } from 'bits-ui';\n import * as Popover from '$lib/components/ui/popover';\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", G = "<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';\n import type { HTMLAttributes } from 'svelte/elements';\n import { setContext } from 'svelte';\n import * as Popover from '$lib/components/ui/popover';\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 } = 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 form,\n name,\n type,\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", le = "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", ue = "<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", de = "<script lang=\"ts\">\n import { getContext, type Snippet } from 'svelte';\n import { cn } from '$lib/utils';\n import { Command as CommandPrimitive } from 'bits-ui';\n import * as Command from '$lib/components/ui/command';\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", fe = "<script lang=\"ts\">\n import * as Popover from '$lib/components/ui/popover';\n import { Popover as PopoverPrimitive } from 'bits-ui';\n import { cn } from '$lib/utils';\n import { buttonVariants } from '$lib/components/ui/button';\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", pe = "export { default as Pagination } from \"./pagination.svelte\";\n", me = "<script lang=\"ts\">\n import * as Select from '$lib/components/ui/select';\n import { Button } from '$lib/components/ui/button';\n import ChevronsLeftIcon from '@lucide/svelte/icons/chevrons-left';\n import ChevronLeftIcon from '@lucide/svelte/icons/chevron-left';\n import ChevronRightIcon from '@lucide/svelte/icons/chevron-right';\n import ChevronsRightIcon from '@lucide/svelte/icons/chevrons-right';\n import type { Table as TableType } from '@tanstack/table-core';\n\n let { table }: { table: TableType<any> } = $props();\n<\/script>\n\n<div class=\"flex items-center justify-between px-2\">\n <div class=\"text-muted-foreground flex-1 text-sm\">\n {table.getFilteredSelectedRowModel().rows.length} of\n {table.getFilteredRowModel().rows.length} row(s) selected.\n </div>\n <div class=\"flex items-center space-x-6 lg:space-x-8\">\n <div class=\"flex items-center space-x-2\">\n <p class=\"text-sm font-medium\">Rows per page</p>\n <Select.Root\n allowDeselect={false}\n type=\"single\"\n value={`${table.getState().pagination.pageSize}`}\n onValueChange={(value) => {\n table.setPageSize(Number(value));\n }}\n >\n <Select.Trigger class=\"h-8 w-[70px]\">\n {String(table.getState().pagination.pageSize)}\n </Select.Trigger>\n <Select.Content side=\"top\">\n {#each [10, 20, 30, 40, 50] as pageSize (pageSize)}\n <Select.Item value={`${pageSize}`}>\n {pageSize}\n </Select.Item>\n {/each}\n </Select.Content>\n </Select.Root>\n </div>\n <div class=\"flex w-[100px] items-center justify-center text-sm font-medium\">\n Page {table.getState().pagination.pageIndex + 1} of\n {table.getPageCount()}\n </div>\n <div class=\"flex items-center space-x-2\">\n <Button\n variant=\"outline\"\n class=\"hidden size-8 p-0 lg:flex\"\n onclick={() => table.setPageIndex(0)}\n disabled={!table.getCanPreviousPage()}\n >\n <span class=\"sr-only\">Go to first page</span>\n <ChevronsLeftIcon />\n </Button>\n <Button\n variant=\"outline\"\n class=\"size-8 p-0\"\n onclick={() => table.previousPage()}\n disabled={!table.getCanPreviousPage()}\n >\n <span class=\"sr-only\">Go to previous page</span>\n <ChevronLeftIcon />\n </Button>\n <Button\n variant=\"outline\"\n class=\"size-8 p-0\"\n onclick={() => table.nextPage()}\n disabled={!table.getCanNextPage()}\n >\n <span class=\"sr-only\">Go to next page</span>\n <ChevronRightIcon />\n </Button>\n <Button\n variant=\"outline\"\n class=\"hidden size-8 p-0 lg:flex\"\n onclick={() => table.setPageIndex(table.getPageCount() - 1)}\n disabled={!table.getCanNextPage()}\n >\n <span class=\"sr-only\">Go to last page</span>\n <ChevronsRightIcon />\n </Button>\n </div>\n </div>\n</div>\n", he = "export { default as RowActions } from \"./row-actions.svelte\";\n", ge = "<script lang=\"ts\">\n import { goto } from '$app/navigation';\n import * as DropdownMenu from '$lib/components/ui/dropdown-menu';\n import { Button } from '$lib/components/ui/button';\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 onclick={() => goto(viewPath)}>View</DropdownMenu.Item>\n <DropdownMenu.Item onclick={() => goto(editPath)}>Edit</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", _e = {
|
|
8
|
+
var d = "<script lang=\"ts\">\n import { cn } from '$lib/utils';\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", f = "<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", p = "<script lang=\"ts\">\n import { goto } from '$app/navigation';\n import * as DropdownMenu from '$lib/components/ui/dropdown-menu';\n import { Button } from '$lib/components/ui/button';\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\n const handleClick = () => {\n if (restProps.onclick) {\n restProps.onclick();\n } else {\n if (href) {\n goto(href);\n }\n }\n };\n<\/script>\n\n{#if isDesktop}\n <DropdownMenu.Item {...restProps} onclick={handleClick}>\n {@render children?.()}\n </DropdownMenu.Item>\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", m = "<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", h = "<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", ee = "<script lang=\"ts\">\n import { cn } from '$lib/utils';\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", te = "<script lang=\"ts\">\n import { page } from '$app/state';\n import { browser } from '$app/environment';\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", g = "export type AuthMenuContext = {\n isDesktop: boolean;\n};\n\nexport const AUTH_MENU_CONTEXT_KEY = Symbol(\"auth-menu-context\");\n", _ = "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", ne = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", re = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", ie = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", ae = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", oe = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", se = "<script lang=\"ts\">\n import FileIcon from '@lucide/svelte/icons/file';\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", v = "<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';\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", y = "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", b = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", x = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", S = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", C = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { Badge } from '$lib/components/ui/badge';\n import { cn } from '$lib/utils';\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", w = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { Badge } from '$lib/components/ui/badge';\n import { cn } from '$lib/utils';\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", T = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", E = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import { cn } from '$lib/utils';\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", D = "<script lang=\"ts\">\n import type { HTMLAttributes } from 'svelte/elements';\n import type { Column } from '@tanstack/table-core';\n import * as DropdownMenu from '$lib/components/ui/dropdown-menu';\n import { Button } from '$lib/components/ui/button';\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';\n\n let {\n column,\n title,\n class: className,\n ...restProps\n }: { column: Column<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", O = "export { default as ColumnHeader } from \"./column-header.svelte\";\n", k = "<script lang=\"ts\" generics=\"TData, TValue\">\n import type { Component } from 'svelte';\n import { SvelteSet } from 'svelte/reactivity';\n import type { Column } 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';\n import * as Popover from '$lib/components/ui/popover';\n import { Button } from '$lib/components/ui/button';\n import { Separator } from '$lib/components/ui/separator';\n import { Badge } from '$lib/components/ui/badge';\n import { cn } from '$lib/utils';\n\n let {\n column,\n title,\n options\n }: {\n column: Column<TData, TValue>;\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", A = "export { default as FacetedFilter } from \"./faceted-filter.svelte\";\n", j = "<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';\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", M = "<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';\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", N = "<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", P = "<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", F = "<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';\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", I = "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", L = "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", R = "<script lang=\"ts\">\n import { cn } from '$lib/utils';\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", z = "export { default as GeopointInput } from \"./input.svelte\";\n", B = "<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", V = "<script>\n import { Button } from '$lib/components/ui/button';\n import MapIcon from '@lucide/svelte/icons/map';\n import { getContext } from 'svelte';\n import { cn } from '$lib/utils';\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", H = "export { default as Leaflet } from \"./leaflet.svelte\";\n", U = "<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: '© <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", W = "<script lang=\"ts\">\n import type { Snippet } from 'svelte';\n import { cn } from '$lib/utils';\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", ce = "<script lang=\"ts\">\n import { Popover as PopoverPrimitive } from 'bits-ui';\n import * as Popover from '$lib/components/ui/popover';\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", G = "<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';\n import type { HTMLAttributes } from 'svelte/elements';\n import { setContext } from 'svelte';\n import * as Popover from '$lib/components/ui/popover';\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", le = "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", ue = "<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", de = "<script lang=\"ts\">\n import { getContext, type Snippet } from 'svelte';\n import { cn } from '$lib/utils';\n import { Command as CommandPrimitive } from 'bits-ui';\n import * as Command from '$lib/components/ui/command';\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", fe = "<script lang=\"ts\">\n import * as Popover from '$lib/components/ui/popover';\n import { Popover as PopoverPrimitive } from 'bits-ui';\n import { cn } from '$lib/utils';\n import { buttonVariants } from '$lib/components/ui/button';\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", pe = "export { default as Pagination } from \"./pagination.svelte\";\n", me = "<script lang=\"ts\">\n import * as Select from '$lib/components/ui/select';\n import { Button } from '$lib/components/ui/button';\n import ChevronsLeftIcon from '@lucide/svelte/icons/chevrons-left';\n import ChevronLeftIcon from '@lucide/svelte/icons/chevron-left';\n import ChevronRightIcon from '@lucide/svelte/icons/chevron-right';\n import ChevronsRightIcon from '@lucide/svelte/icons/chevrons-right';\n import type { Table as TableType } from '@tanstack/table-core';\n\n let { table }: { table: TableType<any> } = $props();\n<\/script>\n\n<div class=\"flex items-center justify-between px-2\">\n <div class=\"text-muted-foreground flex-1 text-sm\">\n {table.getFilteredSelectedRowModel().rows.length} of\n {table.getFilteredRowModel().rows.length} row(s) selected.\n </div>\n <div class=\"flex items-center space-x-6 lg:space-x-8\">\n <div class=\"flex items-center space-x-2\">\n <p class=\"text-sm font-medium\">Rows per page</p>\n <Select.Root\n allowDeselect={false}\n type=\"single\"\n value={`${table.getState().pagination.pageSize}`}\n onValueChange={(value) => {\n table.setPageSize(Number(value));\n }}\n >\n <Select.Trigger class=\"h-8 w-[70px]\">\n {String(table.getState().pagination.pageSize)}\n </Select.Trigger>\n <Select.Content side=\"top\">\n {#each [10, 20, 30, 40, 50] as pageSize (pageSize)}\n <Select.Item value={`${pageSize}`}>\n {pageSize}\n </Select.Item>\n {/each}\n </Select.Content>\n </Select.Root>\n </div>\n <div class=\"flex w-[100px] items-center justify-center text-sm font-medium\">\n Page {table.getState().pagination.pageIndex + 1} of\n {table.getPageCount()}\n </div>\n <div class=\"flex items-center space-x-2\">\n <Button\n variant=\"outline\"\n class=\"hidden size-8 p-0 lg:flex\"\n onclick={() => table.setPageIndex(0)}\n disabled={!table.getCanPreviousPage()}\n >\n <span class=\"sr-only\">Go to first page</span>\n <ChevronsLeftIcon />\n </Button>\n <Button\n variant=\"outline\"\n class=\"size-8 p-0\"\n onclick={() => table.previousPage()}\n disabled={!table.getCanPreviousPage()}\n >\n <span class=\"sr-only\">Go to previous page</span>\n <ChevronLeftIcon />\n </Button>\n <Button\n variant=\"outline\"\n class=\"size-8 p-0\"\n onclick={() => table.nextPage()}\n disabled={!table.getCanNextPage()}\n >\n <span class=\"sr-only\">Go to next page</span>\n <ChevronRightIcon />\n </Button>\n <Button\n variant=\"outline\"\n class=\"hidden size-8 p-0 lg:flex\"\n onclick={() => table.setPageIndex(table.getPageCount() - 1)}\n disabled={!table.getCanNextPage()}\n >\n <span class=\"sr-only\">Go to last page</span>\n <ChevronsRightIcon />\n </Button>\n </div>\n </div>\n</div>\n", he = "export { default as RowActions } from \"./row-actions.svelte\";\n", ge = "<script lang=\"ts\">\n import { goto } from '$app/navigation';\n import * as DropdownMenu from '$lib/components/ui/dropdown-menu';\n import { Button } from '$lib/components/ui/button';\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 onclick={() => goto(viewPath)}>View</DropdownMenu.Item>\n <DropdownMenu.Item onclick={() => goto(editPath)}>Edit</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", _e = {
|
|
9
9
|
"file-form": ["input", "form"],
|
|
10
10
|
multiselect: [
|
|
11
11
|
"command",
|
|
@@ -255,4 +255,4 @@ async function De(t, r, a) {
|
|
|
255
255
|
//#endregion
|
|
256
256
|
export { De as writeResult };
|
|
257
257
|
|
|
258
|
-
//# sourceMappingURL=write-result-
|
|
258
|
+
//# sourceMappingURL=write-result-CLSL_F-E.js.map
|