@velastack/patterns 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/dist/chunks/{_layout-kkgN0IF7.js → _layout-D-FzWqn0.js} +2 -2
  2. package/dist/chunks/{_layout-kkgN0IF7.js.map → _layout-D-FzWqn0.js.map} +1 -1
  3. package/dist/chunks/_page-C7kGoW7_.js +6 -0
  4. package/dist/chunks/_page-C7kGoW7_.js.map +1 -0
  5. package/dist/chunks/_page-e_I-fdSR.js +6 -0
  6. package/dist/chunks/_page-e_I-fdSR.js.map +1 -0
  7. package/dist/chunks/auth-pages-B52ei-4z.js +291 -0
  8. package/dist/chunks/auth-pages-B52ei-4z.js.map +1 -0
  9. package/dist/chunks/{collections-Dz2fvKnz.js → collections-zzZ_HQxB.js} +2 -2
  10. package/dist/chunks/{collections-Dz2fvKnz.js.map → collections-zzZ_HQxB.js.map} +1 -1
  11. package/dist/chunks/{compose-handle-D_Rz3Fzo.js → compose-handle-BDlZ7Pif.js} +2 -2
  12. package/dist/chunks/{compose-handle-D_Rz3Fzo.js.map → compose-handle-BDlZ7Pif.js.map} +1 -1
  13. package/dist/chunks/{config-target-Dx3w6WSk.js → config-target-rHgjaA8u.js} +2 -2
  14. package/dist/chunks/{config-target-Dx3w6WSk.js.map → config-target-rHgjaA8u.js.map} +1 -1
  15. package/dist/chunks/{constants-BjyMU5s8.js → constants-Rq8SCXwH.js} +2 -2
  16. package/dist/chunks/{constants-BjyMU5s8.js.map → constants-Rq8SCXwH.js.map} +1 -1
  17. package/dist/chunks/dispatch-D4TN9pdW.js +6 -0
  18. package/dist/chunks/dispatch-D4TN9pdW.js.map +1 -0
  19. package/dist/chunks/{env-vars-C1NUX-bf.js → env-vars-CcE6ODqC.js} +4 -4
  20. package/dist/chunks/{env-vars-C1NUX-bf.js.map → env-vars-CcE6ODqC.js.map} +1 -1
  21. package/dist/chunks/{format-result-DZ8De8KY.js → format-result-BVoLVknk.js} +2 -2
  22. package/dist/chunks/format-result-BVoLVknk.js.map +1 -0
  23. package/dist/chunks/{generate-DeaBlnK6.js → generate-B6Odfk5f.js} +2 -2
  24. package/dist/chunks/{generate-DeaBlnK6.js.map → generate-B6Odfk5f.js.map} +1 -1
  25. package/dist/chunks/{generate-WMJo3QGZ.js → generate-Bg0E3eWm.js} +2 -2
  26. package/dist/chunks/{generate-WMJo3QGZ.js.map → generate-Bg0E3eWm.js.map} +1 -1
  27. package/dist/chunks/{generate-Gcc8iRkZ.js → generate-CFqpRi9D.js} +3 -3
  28. package/dist/chunks/{generate-Gcc8iRkZ.js.map → generate-CFqpRi9D.js.map} +1 -1
  29. package/dist/chunks/{generate-BW3l5Fxw.js → generate-CZGHByV3.js} +2 -2
  30. package/dist/chunks/{generate-BW3l5Fxw.js.map → generate-CZGHByV3.js.map} +1 -1
  31. package/dist/chunks/{generate.runtime-IlBCcXvv.js → generate.runtime-5rIc-RNL.js} +7 -7
  32. package/dist/chunks/{generate.runtime-IlBCcXvv.js.map → generate.runtime-5rIc-RNL.js.map} +1 -1
  33. package/dist/chunks/{generate.runtime-BgTz41Zg.js → generate.runtime-BK3mR0Rj.js} +92 -140
  34. package/dist/chunks/generate.runtime-BK3mR0Rj.js.map +1 -0
  35. package/dist/chunks/{generate.runtime-cwvAoKoH.js → generate.runtime-BpMN5Uq-.js} +3 -3
  36. package/dist/chunks/{generate.runtime-cwvAoKoH.js.map → generate.runtime-BpMN5Uq-.js.map} +1 -1
  37. package/dist/chunks/{generate.runtime-DD51OSuL.js → generate.runtime-CAn1qIQ_.js} +4 -4
  38. package/dist/chunks/{generate.runtime-DD51OSuL.js.map → generate.runtime-CAn1qIQ_.js.map} +1 -1
  39. package/dist/chunks/{generate.runtime-CuNhY5hn.js → generate.runtime-CEqLgLT9.js} +16 -11
  40. package/dist/chunks/generate.runtime-CEqLgLT9.js.map +1 -0
  41. package/dist/chunks/{generate.runtime-B1jVAnDI.js → generate.runtime-CK10Mum5.js} +8 -8
  42. package/dist/chunks/{generate.runtime-B1jVAnDI.js.map → generate.runtime-CK10Mum5.js.map} +1 -1
  43. package/dist/chunks/{generate.runtime-DqD3PW-W.js → generate.runtime-CZ46nkSL.js} +3 -3
  44. package/dist/chunks/{generate.runtime-DqD3PW-W.js.map → generate.runtime-CZ46nkSL.js.map} +1 -1
  45. package/dist/chunks/{generate.runtime-CslAvllQ.js → generate.runtime-CbE9RHcf.js} +5 -5
  46. package/dist/chunks/generate.runtime-CbE9RHcf.js.map +1 -0
  47. package/dist/chunks/{generate.runtime-CCr1lvo4.js → generate.runtime-CpMKXBkn.js} +7 -7
  48. package/dist/chunks/{generate.runtime-CCr1lvo4.js.map → generate.runtime-CpMKXBkn.js.map} +1 -1
  49. package/dist/chunks/{generate.runtime-6FXJM8hT.js → generate.runtime-CqncBFNg.js} +5 -5
  50. package/dist/chunks/{generate.runtime-6FXJM8hT.js.map → generate.runtime-CqncBFNg.js.map} +1 -1
  51. package/dist/chunks/generate.runtime-DG2z6kqH.js +68 -0
  52. package/dist/chunks/generate.runtime-DG2z6kqH.js.map +1 -0
  53. package/dist/chunks/{generate.runtime-C6bSvGMb.js → generate.runtime-DHHlYfTD.js} +6 -6
  54. package/dist/chunks/{generate.runtime-C6bSvGMb.js.map → generate.runtime-DHHlYfTD.js.map} +1 -1
  55. package/dist/chunks/generate.runtime-DJ9MVVPC.js +325 -0
  56. package/dist/chunks/generate.runtime-DJ9MVVPC.js.map +1 -0
  57. package/dist/chunks/{generate.runtime-CnPraLKv.js → generate.runtime-DVB7uuht.js} +4 -4
  58. package/dist/chunks/{generate.runtime-CnPraLKv.js.map → generate.runtime-DVB7uuht.js.map} +1 -1
  59. package/dist/chunks/{generate.runtime-kvxmTlQb.js → generate.runtime-Db0HZyj3.js} +3 -3
  60. package/dist/chunks/{generate.runtime-kvxmTlQb.js.map → generate.runtime-Db0HZyj3.js.map} +1 -1
  61. package/dist/chunks/{generate.runtime-D_sQOeQa.js → generate.runtime-Djas9UNy.js} +6 -6
  62. package/dist/chunks/{generate.runtime-D_sQOeQa.js.map → generate.runtime-Djas9UNy.js.map} +1 -1
  63. package/dist/chunks/{generate.runtime-Ce_rwzNa.js → generate.runtime-Dl6OQ7pe.js} +4 -4
  64. package/dist/chunks/{generate.runtime-Ce_rwzNa.js.map → generate.runtime-Dl6OQ7pe.js.map} +1 -1
  65. package/dist/chunks/{generate.runtime-1-91UmM8.js → generate.runtime-DoZJHtZh.js} +4 -4
  66. package/dist/chunks/{generate.runtime-1-91UmM8.js.map → generate.runtime-DoZJHtZh.js.map} +1 -1
  67. package/dist/chunks/generate.runtime-Dp7SsCQG.js +42 -0
  68. package/dist/chunks/generate.runtime-Dp7SsCQG.js.map +1 -0
  69. package/dist/chunks/{generate.runtime-C8zJRNYG.js → generate.runtime-E-zoeSKW.js} +5 -5
  70. package/dist/chunks/{generate.runtime-C8zJRNYG.js.map → generate.runtime-E-zoeSKW.js.map} +1 -1
  71. package/dist/chunks/{generate.runtime-pVLzzpUM.js → generate.runtime-EQnytCFL.js} +40 -40
  72. package/dist/chunks/generate.runtime-EQnytCFL.js.map +1 -0
  73. package/dist/chunks/generate.runtime-IWEhGhWY.js +218 -0
  74. package/dist/chunks/generate.runtime-IWEhGhWY.js.map +1 -0
  75. package/dist/chunks/{generate.runtime-CYagyR5c.js → generate.runtime-a3R4hqFy.js} +6 -6
  76. package/dist/chunks/{generate.runtime-CYagyR5c.js.map → generate.runtime-a3R4hqFy.js.map} +1 -1
  77. package/dist/chunks/{generate.runtime-zJpEufTc.js → generate.runtime-aQnBmH8D.js} +9 -9
  78. package/dist/chunks/generate.runtime-aQnBmH8D.js.map +1 -0
  79. package/dist/chunks/{generate.runtime-Dtgw9IQO.js → generate.runtime-axm9wcQv.js} +5 -5
  80. package/dist/chunks/{generate.runtime-Dtgw9IQO.js.map → generate.runtime-axm9wcQv.js.map} +1 -1
  81. package/dist/chunks/{generate.runtime-DHBRyMAq.js → generate.runtime-hTKzxH2M.js} +5 -5
  82. package/dist/chunks/{generate.runtime-DHBRyMAq.js.map → generate.runtime-hTKzxH2M.js.map} +1 -1
  83. package/dist/chunks/{generate.runtime-BA3tDKnn.js → generate.runtime-kciwaXxh.js} +5 -5
  84. package/dist/chunks/{generate.runtime-BA3tDKnn.js.map → generate.runtime-kciwaXxh.js.map} +1 -1
  85. package/dist/chunks/{generate.runtime-B_UVGa3q.js → generate.runtime-koQxLywh.js} +5 -5
  86. package/dist/chunks/{generate.runtime-B_UVGa3q.js.map → generate.runtime-koQxLywh.js.map} +1 -1
  87. package/dist/chunks/{generate.runtime-DM4o_QYY.js → generate.runtime-rs1ZOIET.js} +5 -5
  88. package/dist/chunks/{generate.runtime-DM4o_QYY.js.map → generate.runtime-rs1ZOIET.js.map} +1 -1
  89. package/dist/chunks/{generate.runtime-DV3WmZtb.js → generate.runtime-uLUiPgqx.js} +6 -6
  90. package/dist/chunks/{generate.runtime-DV3WmZtb.js.map → generate.runtime-uLUiPgqx.js.map} +1 -1
  91. package/dist/chunks/{modify-file-BlDeeurK.js → modify-file-DK-tCH9k.js} +3 -3
  92. package/dist/chunks/{modify-file-BlDeeurK.js.map → modify-file-DK-tCH9k.js.map} +1 -1
  93. package/dist/chunks/modify-nav-user-BLyrW2sK.js +71 -0
  94. package/dist/chunks/modify-nav-user-BLyrW2sK.js.map +1 -0
  95. package/dist/chunks/{modify-svelte-config-remote-p0TfVzxm.js → modify-svelte-config-remote-DhuRX4FI.js} +2 -2
  96. package/dist/chunks/{modify-svelte-config-remote-p0TfVzxm.js.map → modify-svelte-config-remote-DhuRX4FI.js.map} +1 -1
  97. package/dist/chunks/modify-user-signup-BbqTiUuA.js +54 -0
  98. package/dist/chunks/modify-user-signup-BbqTiUuA.js.map +1 -0
  99. package/dist/chunks/{pocketbase-Dry6ry17.js → pocketbase-CgwbH1gI.js} +2 -2
  100. package/dist/chunks/{pocketbase-Dry6ry17.js.map → pocketbase-CgwbH1gI.js.map} +1 -1
  101. package/dist/chunks/{shared-CZC4d7Uj.js → shared-Cc_ns5-y.js} +2 -2
  102. package/dist/chunks/{shared-CZC4d7Uj.js.map → shared-Cc_ns5-y.js.map} +1 -1
  103. package/dist/chunks/{site-BwCA18Sv.js → site-lj0CDdQ1.js} +2 -2
  104. package/dist/chunks/{site-BwCA18Sv.js.map → site-lj0CDdQ1.js.map} +1 -1
  105. package/dist/chunks/{table-core-AjBpYi-y.js → table-core-DhDqT03G.js} +2 -2
  106. package/dist/chunks/{table-core-AjBpYi-y.js.map → table-core-DhDqT03G.js.map} +1 -1
  107. package/dist/chunks/{test-setup-DEmWd9Ul.js → test-setup-B9fQ5L_-.js} +5 -5
  108. package/dist/chunks/{test-setup-DEmWd9Ul.js.map → test-setup-B9fQ5L_-.js.map} +1 -1
  109. package/dist/chunks/{ts-morph-helpers-CDW4lhox.js → ts-morph-helpers-Bepc-Es2.js} +27 -23
  110. package/dist/chunks/ts-morph-helpers-Bepc-Es2.js.map +1 -0
  111. package/dist/chunks/{ui-X698F10c.js → ui-CuCsupFq.js} +3 -3
  112. package/dist/chunks/{ui-X698F10c.js.map → ui-CuCsupFq.js.map} +1 -1
  113. package/dist/chunks/{unmodify-load-CyGzC1Hu.js → unmodify-load-Bl5vXQiL.js} +2 -2
  114. package/dist/chunks/{unmodify-load-CyGzC1Hu.js.map → unmodify-load-Bl5vXQiL.js.map} +1 -1
  115. package/dist/chunks/whatsapp-CguKGTtw.js +105 -0
  116. package/dist/chunks/whatsapp-CguKGTtw.js.map +1 -0
  117. package/dist/chunks/{write-result-B68lvI57.js → write-result-DiZsCS_y.js} +5 -5
  118. package/dist/chunks/{write-result-B68lvI57.js.map → write-result-DiZsCS_y.js.map} +1 -1
  119. package/dist/index.d.ts +133 -1
  120. package/dist/index.js +2240 -2005
  121. package/dist/index.js.map +1 -1
  122. package/package.json +2 -2
  123. package/dist/chunks/dispatch-CXOXPLFk.js +0 -6
  124. package/dist/chunks/dispatch-CXOXPLFk.js.map +0 -1
  125. package/dist/chunks/format-result-DZ8De8KY.js.map +0 -1
  126. package/dist/chunks/generate.runtime-BO778G0r.js +0 -188
  127. package/dist/chunks/generate.runtime-BO778G0r.js.map +0 -1
  128. package/dist/chunks/generate.runtime-BgTz41Zg.js.map +0 -1
  129. package/dist/chunks/generate.runtime-CexC1Oky.js +0 -269
  130. package/dist/chunks/generate.runtime-CexC1Oky.js.map +0 -1
  131. package/dist/chunks/generate.runtime-CslAvllQ.js.map +0 -1
  132. package/dist/chunks/generate.runtime-CuNhY5hn.js.map +0 -1
  133. package/dist/chunks/generate.runtime-pVLzzpUM.js.map +0 -1
  134. package/dist/chunks/generate.runtime-zJpEufTc.js.map +0 -1
  135. package/dist/chunks/nav-user-BRIHOOpG.js +0 -6
  136. package/dist/chunks/nav-user-BRIHOOpG.js.map +0 -1
  137. package/dist/chunks/ts-morph-helpers-CDW4lhox.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { n as e } from "./logger-CQONztPm.js";
2
- import { t } from "./shared-CZC4d7Uj.js";
3
- import { f as n, o as r } from "./ts-morph-helpers-CDW4lhox.js";
4
- import { modifyOutcomeToFile as i } from "./modify-file-BlDeeurK.js";
2
+ import { t } from "./shared-Cc_ns5-y.js";
3
+ import { f as n, o as r } from "./ts-morph-helpers-Bepc-Es2.js";
4
+ import { modifyOutcomeToFile as i } from "./modify-file-DK-tCH9k.js";
5
5
  import { t as a } from "./svelte-file-B3RfgVdt.js";
6
6
  import o from "node:fs";
7
7
  import s from "node:path";
@@ -91,4 +91,4 @@ async function f(n) {
91
91
  //#endregion
92
92
  export { f as generate };
93
93
 
94
- //# sourceMappingURL=generate.runtime-Ce_rwzNa.js.map
94
+ //# sourceMappingURL=generate.runtime-Dl6OQ7pe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate.runtime-Ce_rwzNa.js","names":["apiObj","getLogger","removeNavItemFromScript","formatLikeSource","SvelteFile","fs","path","unmodifyHooksServer","hooksServerPath","originalSource","sourceFile","Project","callExpr","SyntaxKind","ce","firstArg","apiProp","apiInit","apiKeysProp","unmodifyNavUser","navUserPath","source","file","wasRemoved","tryRemove","run","result","src","fn","generate","logger","options","modifies","pushResult","modifyOutcomeToFile","planDropsForCollections"],"sources":["../../src/patterns/disable/api-keys/modifies/hooks.server.ts","../../src/patterns/disable/api-keys/modifies/nav-user.svelte.ts","../../src/patterns/disable/api-keys/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { Project, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nexport function unmodifyHooksServer(hooksServerPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n return { status: \"success\", changed: false };\n }\n\n const originalSource = fs.readFileSync(hooksServerPath, \"utf8\");\n const project = new Project();\n const sourceFile = project.addSourceFileAtPath(hooksServerPath);\n\n const callExpr = sourceFile\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .find((ce) => ce.getExpression().getText() === \"handlePocketbase\");\n if (!callExpr) return { status: \"success\", changed: false };\n\n const [firstArg] = callExpr.getArguments();\n if (!firstArg || firstArg.getKind() !== SyntaxKind.ObjectLiteralExpression) {\n return { status: \"success\", changed: false };\n }\n\n const optionsObj = firstArg.asKindOrThrow(SyntaxKind.ObjectLiteralExpression);\n const apiProp = optionsObj.getProperty(\"api\");\n if (!apiProp || apiProp.getKind() !== SyntaxKind.PropertyAssignment) {\n return { status: \"success\", changed: false };\n }\n\n const apiInit = (\n apiProp as import(\"ts-morph\").PropertyAssignment\n ).getInitializer();\n if (!apiInit || apiInit.getKind() !== SyntaxKind.ObjectLiteralExpression) {\n return { status: \"success\", changed: false };\n }\n\n const apiObj = apiInit as import(\"ts-morph\").ObjectLiteralExpression;\n const apiKeysProp = apiObj.getProperty(\"apiKeys\");\n if (!apiKeysProp) {\n return { status: \"success\", changed: false };\n }\n\n apiKeysProp.remove();\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== originalSource,\n };\n}\n","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(\"/api-keys\")) {\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 \"API Keys\",\n \"@lucide/svelte/icons/key-round\",\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 path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { unmodifyHooksServer } from \"./modifies/hooks.server\";\nimport { unmodifyNavUser } from \"./modifies/nav-user.svelte\";\nimport { planDropsForCollections } from \"../../destroy/shared\";\n\nexport async function generate(options: Options) {\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(\"Reverting hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n pushResult(\n modifyOutcomeToFile(hooksServerPath, unmodifyHooksServer(hooksServerPath)),\n );\n\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 const collectionDrops = await planDropsForCollections([\"api_keys\"], options);\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,SAAgBO,EAAoB,GAAwC;CAC1E,IAAI,CAACF,EAAG,WAAWG,CAAe,GAChC,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMC,IAAiBJ,EAAG,aAAaG,GAAiB,MAAM,GAExDE,IAAa,IADCC,EACD,CAAA,CAAQ,oBAAoBH,CAAe,GAExDI,IAAWF,EACd,qBAAqBG,EAAW,cAAc,CAAC,CAC/C,MAAM,MAAOC,EAAG,cAAc,CAAC,CAAC,QAAQ,MAAM,kBAAkB;CACnE,IAAI,CAACF,GAAU,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAE1D,IAAM,CAACG,KAAYH,EAAS,aAAa;CACzC,IAAI,CAACG,KAAYA,EAAS,QAAQ,MAAMF,EAAW,yBACjD,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAI7C,IAAMG,IADaD,EAAS,cAAcF,EAAW,uBACrC,CAAA,CAAW,YAAY,KAAK;CAC5C,IAAI,CAACG,KAAWA,EAAQ,QAAQ,MAAMH,EAAW,oBAC/C,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMI,IACJD,EACA,eAAe;CACjB,IAAI,CAACC,KAAWA,EAAQ,QAAQ,MAAMJ,EAAW,yBAC/C,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAI7C,IAAMK,IAAclB,EAAO,YAAY,SAAS;CAUhD,OATKkB,KAILA,EAAY,OAAO,GAEnBf,EAAiBO,CAAU,GAC3BA,EAAW,SAAS,GAEb;EACL,QAAQ;EACR,SAASA,EAAW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AAC,GAIlE;EACL,SAAS,CAAC;EACV;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAA,MAV4Be,EAAwB,CAAC,UAAU,GAAGJ,CAAO;CAW3E;AACF"}
1
+ {"version":3,"file":"generate.runtime-Dl6OQ7pe.js","names":["apiObj","getLogger","removeNavItemFromScript","formatLikeSource","SvelteFile","fs","path","unmodifyHooksServer","hooksServerPath","originalSource","sourceFile","Project","callExpr","SyntaxKind","ce","firstArg","apiProp","apiInit","apiKeysProp","unmodifyNavUser","navUserPath","source","file","wasRemoved","tryRemove","run","result","src","fn","generate","logger","options","modifies","pushResult","modifyOutcomeToFile","planDropsForCollections"],"sources":["../../src/patterns/disable/api-keys/modifies/hooks.server.ts","../../src/patterns/disable/api-keys/modifies/nav-user.svelte.ts","../../src/patterns/disable/api-keys/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { Project, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nexport function unmodifyHooksServer(hooksServerPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n return { status: \"success\", changed: false };\n }\n\n const originalSource = fs.readFileSync(hooksServerPath, \"utf8\");\n const project = new Project();\n const sourceFile = project.addSourceFileAtPath(hooksServerPath);\n\n const callExpr = sourceFile\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .find((ce) => ce.getExpression().getText() === \"handlePocketbase\");\n if (!callExpr) return { status: \"success\", changed: false };\n\n const [firstArg] = callExpr.getArguments();\n if (!firstArg || firstArg.getKind() !== SyntaxKind.ObjectLiteralExpression) {\n return { status: \"success\", changed: false };\n }\n\n const optionsObj = firstArg.asKindOrThrow(SyntaxKind.ObjectLiteralExpression);\n const apiProp = optionsObj.getProperty(\"api\");\n if (!apiProp || apiProp.getKind() !== SyntaxKind.PropertyAssignment) {\n return { status: \"success\", changed: false };\n }\n\n const apiInit = (\n apiProp as import(\"ts-morph\").PropertyAssignment\n ).getInitializer();\n if (!apiInit || apiInit.getKind() !== SyntaxKind.ObjectLiteralExpression) {\n return { status: \"success\", changed: false };\n }\n\n const apiObj = apiInit as import(\"ts-morph\").ObjectLiteralExpression;\n const apiKeysProp = apiObj.getProperty(\"apiKeys\");\n if (!apiKeysProp) {\n return { status: \"success\", changed: false };\n }\n\n apiKeysProp.remove();\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== originalSource,\n };\n}\n","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(\"/api-keys\")) {\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 \"API Keys\",\n \"@lucide/svelte/icons/key-round\",\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 path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { unmodifyHooksServer } from \"./modifies/hooks.server\";\nimport { unmodifyNavUser } from \"./modifies/nav-user.svelte\";\nimport { planDropsForCollections } from \"../../destroy/shared\";\n\nexport async function generate(options: Options) {\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(\"Reverting hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n pushResult(\n modifyOutcomeToFile(hooksServerPath, unmodifyHooksServer(hooksServerPath)),\n );\n\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 const collectionDrops = await planDropsForCollections([\"api_keys\"], options);\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,SAAgBO,EAAoB,GAAwC;CAC1E,IAAI,CAACF,EAAG,WAAWG,CAAe,GAChC,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMC,IAAiBJ,EAAG,aAAaG,GAAiB,MAAM,GAExDE,IAAa,IADCC,EACD,CAAA,CAAQ,oBAAoBH,CAAe,GAExDI,IAAWF,EACd,qBAAqBG,EAAW,cAAc,CAAC,CAC/C,MAAM,MAAOC,EAAG,cAAc,CAAC,CAAC,QAAQ,MAAM,kBAAkB;CACnE,IAAI,CAACF,GAAU,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAE1D,IAAM,CAACG,KAAYH,EAAS,aAAa;CACzC,IAAI,CAACG,KAAYA,EAAS,QAAQ,MAAMF,EAAW,yBACjD,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAI7C,IAAMG,IADaD,EAAS,cAAcF,EAAW,uBACrC,CAAA,CAAW,YAAY,KAAK;CAC5C,IAAI,CAACG,KAAWA,EAA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AAAIX,KAAMU,EAAS,KAAKV,CAAI;CAC9B;CAEA,EAAO,KAAK,2BAA2B;CACvC,IAAMd,IAAkBF,EAAK,KAAKyB,EAAQ,MAAM,OAAO,iBAAiB;CAKxE,AAJAE,EACEC,EAAoB1B,GAAiBD,EAAoBC,CAAe,CAAC,CAC3E,GAEAsB,EAAO,KAAK,2BAA2B;CACvC,IAAMV,IAAcd,EAAK,KACvByB,EAAQ,MACR,OACA,OACA,cACA,iBACF;CAKA,OAJAE,EAAWC,EAAoBd,GAAaD,EAAgBC,CAAW,CAAC,CAAC,GAIlE;EACL,SAAS,CAAC;EACV;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAA,MAV4Be,EAAwB,CAAC,UAAU,GAAGJ,CAAO;CAW3E;AACF"}
@@ -3,9 +3,9 @@ import { t as r } from "./dedent-Gq6Krl4n.js";
3
3
  import { n as i } from "./logger-CQONztPm.js";
4
4
  import { r as a, t as o } from "./generate-DetW_gbr.js";
5
5
  import { t as s } from "./env-BPfk1VAw.js";
6
- import { _ as c, r as l } from "./ts-morph-helpers-CDW4lhox.js";
7
- import { modifyOutcomeToFile as u } from "./modify-file-BlDeeurK.js";
8
- import { modifyEnvVarsFiles as d } from "./env-vars-C1NUX-bf.js";
6
+ import { _ as c, r as l } from "./ts-morph-helpers-Bepc-Es2.js";
7
+ import { modifyOutcomeToFile as u } from "./modify-file-DK-tCH9k.js";
8
+ import { modifyEnvVarsFiles as d } from "./env-vars-CcE6ODqC.js";
9
9
  import { t as f } from "./svelte-file-B3RfgVdt.js";
10
10
  import p from "node:fs";
11
11
  import m from "node:path";
@@ -82,4 +82,4 @@ async function x(r) {
82
82
  //#endregion
83
83
  export { x as generate };
84
84
 
85
- //# sourceMappingURL=generate.runtime-1-91UmM8.js.map
85
+ //# sourceMappingURL=generate.runtime-DoZJHtZh.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate.runtime-1-91UmM8.js","names":["providerEnvVars","resolveProvider","suppliedProviderEnv","dedent","getLogger","envEditsFor","META","modifyEnv","withInMemoryScript","ensureImports","SvelteFile","fs","path","MODULE_SPECIFIER","IMPORT_SNIPPET","MARKUP_SNIPPET","NOT_FOUND_HINT","FAILURE_HINT","modifyLayoutSvelte","layoutPath","file","out","source","sf","generate","logger","options","provider","creates","modifies","pushResult","modifyOutcomeToFile","envVars","modifyEnvVarsFiles","envPath"],"sources":["../../src/patterns/enable/analytics/modifies/layout.svelte.ts","../../src/patterns/enable/analytics/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureImports,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst MODULE_SPECIFIER = \"#lib/components/analytics/analytics.svelte\";\n\nconst IMPORT_SNIPPET = dedent`\n import Analytics from '${MODULE_SPECIFIER}';\n`;\n\nconst MARKUP_SNIPPET = \"\\n<Analytics />\\n\";\n\nconst NOT_FOUND_HINT = [\n \"Create the root src/routes/+layout.svelte and mount <Analytics /> inside it.\",\n \"\",\n \"Import for the <script> tag:\",\n \"\",\n IMPORT_SNIPPET,\n \"\",\n \"Markup to add at the top level of the layout, above {@render children()}:\",\n MARKUP_SNIPPET.trim(),\n].join(\"\\n\");\n\nconst FAILURE_HINT = [\n \"Mount <Analytics /> in the root src/routes/+layout.svelte.\",\n \"\",\n 'Import for a <script lang=\"ts\"> tag:',\n \"\",\n IMPORT_SNIPPET,\n \"\",\n \"Markup to add at the top level of the layout, above {@render children()}:\",\n MARKUP_SNIPPET.trim(),\n].join(\"\\n\");\n\n/**\n * Mounts `<Analytics />` at the top level of the root layout, ahead of\n * `{@render children()}`. The component is the same path for every provider,\n * so this modifier is provider-agnostic and a re-run with another provider\n * leaves the layout alone.\n */\nexport function modifyLayoutSvelte(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const file = SvelteFile.fromPath(layoutPath);\n if (file.hasElement(\"Analytics\")) {\n return { status: \"success\", changed: false };\n }\n if (!file.getScript()) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n ensureImports(sf, [\n { defaultImport: \"Analytics\", moduleSpecifier: MODULE_SPECIFIER },\n ]);\n });\n return out;\n });\n\n if (!file.insertBeforeChildren(MARKUP_SNIPPET)) {\n file.appendMarkup(MARKUP_SNIPPET);\n }\n file.writeTo(layoutPath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport {\n providerEnvVars,\n resolveProvider,\n suppliedProviderEnv,\n} from \"../../../core/providers\";\nimport { modifyEnvVarsFiles } from \"../../../runtime/env-vars\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifyEnv } from \"../../../runtime/env\";\nimport { envEditsFor, META } from \"./generate\";\nimport { modifyLayoutSvelte } from \"./modifies/layout.svelte\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const provider = resolveProvider(META, options);\n const creates: File[] = [];\n const modifies: File[] = [];\n\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Modifying src/routes/+layout.svelte\");\n const layoutPath = path.join(options.root, \"src\", \"routes\", \"+layout.svelte\");\n pushResult(modifyOutcomeToFile(layoutPath, modifyLayoutSvelte(layoutPath)));\n\n // SvelteKit 3 exposes only declared variables, and only `public: true`\n // ones through `$app/env/public`, where the component imports them.\n logger.info(\"Declaring the analytics variables in src/env.ts\");\n const envVars = modifyEnvVarsFiles(options.root, providerEnvVars(provider));\n if (envVars.create) creates.push(envVars.create);\n pushResult(envVars.modify);\n\n logger.info(\"Updating .env\");\n const envPath = path.join(options.root, \".env\");\n pushResult(\n modifyOutcomeToFile(\n envPath,\n modifyEnv(envPath, envEditsFor(provider, suppliedProviderEnv(options))),\n ),\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":";;;;;;;;;;;;AASA,IAAMa,IAAmB,8CAEnBC,IAAiB,CAAM;2BACFD,EAAiB;GAGtCE,IAAiB,qBAEjBC,IAAiB;CACrB;CACA;CACA;CACA;CACAF;CACA;CACA;CACAC,EAAe,KAAK;AACtB,CAAC,CAAC,KAAK,IAAI,GAELE,IAAe;CACnB;CACA;CACA;CACA;CACAH;CACA;CACA;CACAC,EAAe,KAAK;AACtB,CAAC,CAAC,KAAK,IAAI;AAQX,SAAgBG,EAAmB,GAAmC;CACpE,IAAI,CAACP,EAAG,WAAWQ,CAAU,GAC3B,OAAO;EAAE,QAAQ;EAAa,SAASH;CAAe;CAGxD,IAAMI,IAAOV,EAAW,SAASS,CAAU;CAqB3C,OApBIC,EAAK,WAAW,WAAW,IACtB;EAAE,QAAQ;EAAW,SAAS;CAAM,IAExCA,EAAK,UAAU,KAIpBA,EAAK,cAAc,MAAW;EAC5B,IAAM,EAAE,QAAQC,MAAQb,EAAmBc,IAAS,MAAO;GACzD,EAAcC,GAAI,CAChB;IAAE,eAAe;IAAa,iBAAiBV;GAAiB,CAClE,CAAC;EACH,CAAC;EACD,OAAOQ;CACT,CAAC,GAEID,EAAK,qBAAqBL,CAAc,KAC3CK,EAAK,aAAaL,CAAc,GAElCK,EAAK,QAAQD,CAAU,GAChB;EAAE,QAAQ;EAAW,SAASC,EAAK,WAAW;CAAE,KAhB9C;EAAE,QAAQ;EAAU,SAASH;CAAa;AAiBrD;;;AC1DA,eAAsBO,EAAS,GAAkB;CAC/C,IAAMC,IAASrB,EAAUsB,CAAO,GAC1BC,IAAW1B,EAAgBK,GAAMoB,CAAO,GACxCE,IAAkB,CAAC,GACnBC,IAAmB,CAAC,GAEpBC,KAAc,MAAsB;EACxC,AAAIV,KAAMS,EAAS,KAAKT,CAAI;CAC9B;CAEA,EAAO,KAAK,qCAAqC;CACjD,IAAMD,IAAaP,EAAK,KAAKc,EAAQ,MAAM,OAAO,UAAU,gBAAgB;CAK5E,AAJAI,EAAWC,EAAoBZ,GAAYD,EAAmBC,CAAU,CAAC,CAAC,GAI1EM,EAAO,KAAK,iDAAiD;CAC7D,IAAMO,IAAUC,EAAmBP,EAAQ,MAAM1B,EAAgB2B,CAAQ,CAAC;CAI1E,AAHIK,EAAQ,UAAQJ,EAAQ,KAAKI,EAAQ,MAAM,GAC/CF,EAAWE,EAAQ,MAAM,GAEzBP,EAAO,KAAK,eAAe;CAC3B,IAAMS,IAAUtB,EAAK,KAAKc,EAAQ,MAAM,MAAM;CAQ9C,OAPAI,EACEC,EACEG,GACA3B,EAAU2B,GAAS7B,EAAYsB,GAAUzB,EAAoBwB,CAAO,CAAC,CAAC,CACxE,CACF,GAEO;EACL;EACA;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
1
+ {"version":3,"file":"generate.runtime-DoZJHtZh.js","names":["providerEnvVars","resolveProvider","suppliedProviderEnv","dedent","getLogger","envEditsFor","META","modifyEnv","withInMemoryScript","ensureImports","SvelteFile","fs","path","MODULE_SPECIFIER","IMPORT_SNIPPET","MARKUP_SNIPPET","NOT_FOUND_HINT","FAILURE_HINT","modifyLayoutSvelte","layoutPath","file","out","source","sf","generate","logger","options","provider","creates","modifies","pushResult","modifyOutcomeToFile","envVars","modifyEnvVarsFiles","envPath"],"sources":["../../src/patterns/enable/analytics/modifies/layout.svelte.ts","../../src/patterns/enable/analytics/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n ensureImports,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst MODULE_SPECIFIER = \"#lib/components/analytics/analytics.svelte\";\n\nconst IMPORT_SNIPPET = dedent`\n import Analytics from '${MODULE_SPECIFIER}';\n`;\n\nconst MARKUP_SNIPPET = \"\\n<Analytics />\\n\";\n\nconst NOT_FOUND_HINT = [\n \"Create the root src/routes/+layout.svelte and mount <Analytics /> inside it.\",\n \"\",\n \"Import for the <script> tag:\",\n \"\",\n IMPORT_SNIPPET,\n \"\",\n \"Markup to add at the top level of the layout, above {@render children()}:\",\n MARKUP_SNIPPET.trim(),\n].join(\"\\n\");\n\nconst FAILURE_HINT = [\n \"Mount <Analytics /> in the root src/routes/+layout.svelte.\",\n \"\",\n 'Import for a <script lang=\"ts\"> tag:',\n \"\",\n IMPORT_SNIPPET,\n \"\",\n \"Markup to add at the top level of the layout, above {@render children()}:\",\n MARKUP_SNIPPET.trim(),\n].join(\"\\n\");\n\n/**\n * Mounts `<Analytics />` at the top level of the root layout, ahead of\n * `{@render children()}`. The component is the same path for every provider,\n * so this modifier is provider-agnostic and a re-run with another provider\n * leaves the layout alone.\n */\nexport function modifyLayoutSvelte(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const file = SvelteFile.fromPath(layoutPath);\n if (file.hasElement(\"Analytics\")) {\n return { status: \"success\", changed: false };\n }\n if (!file.getScript()) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n ensureImports(sf, [\n { defaultImport: \"Analytics\", moduleSpecifier: MODULE_SPECIFIER },\n ]);\n });\n return out;\n });\n\n if (!file.insertBeforeChildren(MARKUP_SNIPPET)) {\n file.appendMarkup(MARKUP_SNIPPET);\n }\n file.writeTo(layoutPath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport {\n providerEnvVars,\n resolveProvider,\n suppliedProviderEnv,\n} from \"../../../core/providers\";\nimport { modifyEnvVarsFiles } from \"../../../runtime/env-vars\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifyEnv } from \"../../../runtime/env\";\nimport { envEditsFor, META } from \"./generate\";\nimport { modifyLayoutSvelte } from \"./modifies/layout.svelte\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const provider = resolveProvider(META, options);\n const creates: File[] = [];\n const modifies: File[] = [];\n\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Modifying src/routes/+layout.svelte\");\n const layoutPath = path.join(options.root, \"src\", \"routes\", \"+layout.svelte\");\n pushResult(modifyOutcomeToFile(layoutPath, modifyLayoutSvelte(layoutPath)));\n\n // SvelteKit 3 exposes only declared variables, and only `public: true`\n // ones through `$app/env/public`, where the component imports them.\n logger.info(\"Declaring the analytics variables in src/env.ts\");\n const envVars = modifyEnvVarsFiles(options.root, providerEnvVars(provider));\n if (envVars.create) creates.push(envVars.create);\n pushResult(envVars.modify);\n\n logger.info(\"Updating .env\");\n const envPath = path.join(options.root, \".env\");\n pushResult(\n modifyOutcomeToFile(\n envPath,\n modifyEnv(envPath, envEditsFor(provider, suppliedProviderEnv(options))),\n ),\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":";;;;;;;;;;;;AASA,IAAMa,IAAmB,8CAEnBC,IAAiB,CAAM;2BACFD,EAAiB;GAGtCE,IAAiB,qBAEjBC,IAAiB;CACrB;CACA;CACA;CACA;CACAF;CACA;CACA;CACAC,EAAe,KAAK;AACtB,CAAC,CAAC,KAAK,IAAI,GAELE,IAAe;CACnB;CACA;CACA;CACA;CACAH;CACA;CACA;C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AK,eAAe;CAC3B,IAAMS,IAAUtB,EAAK,KAAKc,EAAQ,MAAM,MAAM;CAQ9C,OAPAI,EACEC,EACEG,GACA3B,EAAU2B,GAAS7B,EAAYsB,GAAUzB,EAAoBwB,CAAO,CAAC,CAAC,CACxE,CACF,GAEO;EACL;EACA;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
@@ -0,0 +1,42 @@
1
+ import { n as e } from "./logger-CQONztPm.js";
2
+ import { modifyOutcomeToFile as t } from "./modify-file-DK-tCH9k.js";
3
+ import { i as n, n as r } from "./pocketbase-CgwbH1gI.js";
4
+ import { i, n as a, o } from "./whatsapp-CguKGTtw.js";
5
+ import { swapAuthPages as s } from "./auth-pages-B52ei-4z.js";
6
+ import c from "node:fs";
7
+ import l from "node:path";
8
+ //#region src/patterns/disable/whatsapp/generate.runtime.ts
9
+ var u = "https://docs.velastack.dev/disable/whatsapp";
10
+ async function d(d) {
11
+ let f = e(d), p = [];
12
+ await n(d.root, async (e) => {
13
+ if (!await i(e)) return;
14
+ f.info("Turning off WhatsApp sign-in for users"), await a(e), await r();
15
+ let t = o(d, !1);
16
+ t && p.push({
17
+ path: t,
18
+ language: "js",
19
+ content: c.readFileSync(t, "utf8"),
20
+ status: "success"
21
+ });
22
+ }), f.info("Keeping the phone fields on users, and email optional: they hold your users' data"), f.info("Taking WhatsApp off the login and signup pages");
23
+ let m = [], h = await s(d.root, "disable", (e) => `${l.relative(d.root, e)} is not the page enable-whatsapp wrote, so it was left as it is. Take the WhatsApp option out of it by hand: ${u}`);
24
+ for (let [e, n] of h) {
25
+ let r = t(e, n);
26
+ r && m.push(r);
27
+ }
28
+ return {
29
+ creates: p,
30
+ modifies: m,
31
+ deletes: [],
32
+ components: [],
33
+ packages: [],
34
+ collections: [],
35
+ collectionPatches: [],
36
+ collectionDrops: []
37
+ };
38
+ }
39
+ //#endregion
40
+ export { d as generate };
41
+
42
+ //# sourceMappingURL=generate.runtime-Dp7SsCQG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.runtime-Dp7SsCQG.js","names":["getLogger","withPocketbase","migrationDelay","disableWhatsAppAuth","fs","path","DOCS_URL","generate","logger","options","creates","hasWhatsAppPlugin","pb","file","writeWhatsAppConfigMigration","modifies","outcomes","swapAuthPages","filePath","outcome","modifyOutcomeToFile"],"sources":["../../src/patterns/disable/whatsapp/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { migrationDelay, withPocketbase } from \"../../../runtime/pocketbase\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport {\n disableWhatsAppAuth,\n hasWhatsAppPlugin,\n writeWhatsAppConfigMigration,\n} from \"../../enable/whatsapp/runtime/whatsapp\";\nimport { swapAuthPages } from \"../../enable/whatsapp/modifies/auth-pages\";\n\nconst DOCS_URL = \"https://docs.velastack.dev/disable/whatsapp\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const creates: File[] = [];\n\n await withPocketbase(options.root, async (pb) => {\n // Without the plugin there is no WhatsApp sign-in to turn off.\n if (!(await hasWhatsAppPlugin(pb))) return;\n\n logger.info(\"Turning off WhatsApp sign-in for users\");\n await disableWhatsAppAuth(pb);\n await migrationDelay();\n const file = writeWhatsAppConfigMigration(options, false);\n if (!file) return;\n creates.push({\n path: file,\n language: \"js\",\n content: fs.readFileSync(file, \"utf8\"),\n status: \"success\",\n });\n });\n logger.info(\n \"Keeping the phone fields on users, and email optional: they hold your users' data\",\n );\n\n logger.info(\"Taking WhatsApp off the login and signup pages\");\n const modifies: File[] = [];\n const outcomes = await swapAuthPages(\n options.root,\n \"disable\",\n (filePath) =>\n `${path.relative(options.root, filePath)} is not the page enable-whatsapp wrote, so it was left as it is. Take the WhatsApp option out of it by hand: ${DOCS_URL}`,\n );\n for (const [filePath, outcome] of outcomes) {\n const file = modifyOutcomeToFile(filePath, outcome);\n if (file) modifies.push(file);\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":";;;;;;;;AAaA,IAAMM,IAAW;AAEjB,eAAsBC,EAAS,GAAkB;CAC/C,IAAMC,IAASR,EAAUS,CAAO,GAC1BC,IAAkB,CAAC;CAsBzB,AApBA,MAAMT,EAAeQ,EAAQ,MAAM,OAAO,MAAO;EAE/C,IAAI,CAAE,MAAME,EAAkBC,CAAE,GAAI;EAIpC,AAFAJ,EAAO,KAAK,wCAAwC,GACpD,MAAML,EAAoBS,CAAE,GAC5B,MAAMV,EAAe;EACrB,IAAMW,IAAOC,EAA6BL,GAAS,EAAK;EACxD,AAAKI,KACLH,EAAQ,KAAK;GACX,MAAMG;GACN,UAAU;GACV,SAAST,EAAG,aAAaS,GAAM,MAAM;GACrC,QAAQ;EACV,CAAC;CACH,CAAC,GACDL,EAAO,KACL,mFACF,GAEAA,EAAO,KAAK,gDAAgD;CAC5D,IAAMO,IAAmB,CAAC,GACpBC,IAAW,MAAMC,EACrBR,EAAQ,MACR,YACC,MACC,GAAGJ,EAAK,SAASI,EAAQ,MAAMS,CAAQ,EAAE,+GAA+GZ,GAC5J;CACA,KAAK,IAAM,CAACY,GAAUC,MAAYH,GAAU;EAC1C,IAAMH,IAAOO,EAAoBF,GAAUC,CAAO;EAClD,AAAIN,KAAME,EAAS,KAAKF,CAAI;CAC9B;CAEA,OAAO;EACL;EACA;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
@@ -1,11 +1,11 @@
1
1
  import { r as e, t } from "./lib-specifier-Cngo1zF_.js";
2
2
  import { t as n } from "./dedent-Gq6Krl4n.js";
3
3
  import { n as r } from "./logger-CQONztPm.js";
4
- import { n as i } from "./shared-CZC4d7Uj.js";
5
- import { _ as a, d as o, n as s, o as c, u as l } from "./ts-morph-helpers-CDW4lhox.js";
6
- import { modifyOutcomeToFile as u, revertOutcomeToFile as d } from "./modify-file-BlDeeurK.js";
4
+ import { n as i } from "./shared-Cc_ns5-y.js";
5
+ import { _ as a, d as o, n as s, o as c, u as l } from "./ts-morph-helpers-Bepc-Es2.js";
6
+ import { modifyOutcomeToFile as u, revertOutcomeToFile as d } from "./modify-file-DK-tCH9k.js";
7
7
  import { t as f } from "./svelte-file-B3RfgVdt.js";
8
- import { n as p } from "./compose-handle-D_Rz3Fzo.js";
8
+ import { n as p } from "./compose-handle-BDlZ7Pif.js";
9
9
  import m from "node:fs";
10
10
  import h from "node:path";
11
11
  import { Project as g, QuoteKind as _, SyntaxKind as v } from "ts-morph";
@@ -121,4 +121,4 @@ async function E(e) {
121
121
  //#endregion
122
122
  export { E as generate };
123
123
 
124
- //# sourceMappingURL=generate.runtime-C8zJRNYG.js.map
124
+ //# sourceMappingURL=generate.runtime-E-zoeSKW.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate.runtime-C8zJRNYG.js","names":["removeNegotiateImport","libModule","dedent","getLogger","toDeleteEntry","withInMemoryScript","removeNamedImportIfUnused","ensureBlankLineAfterImports","formatLikeSource","removeImportByModuleSpecifier","SvelteFile","removeHandle","fs","path","FAILURE_HINT","removeNegotiateImport$1","decl","sourceFile","isLibSpecifier","d","named","ni","unmodifyHooksServerNegotiate","hooksServerPath","original","Project","QuoteKind","removeNegotiateImport","isMeaningfullyEmpty","s","SyntaxKind","unmodifyHooksNegotiate","hooksPath","rerouteDecl","initText","hasI18nHelper","unmodifyRootLayoutNegotiate","layoutPath","file","hasElement","out","source","sf","generate","logger","options","modifies","deletes","pushResult","hooksServerRevert","revertOutcomeToFile","hooksOutcome","modifyOutcomeToFile","rootLayoutPath"],"sources":["../../src/patterns/disable/content-negotiation/modifies/hooks.server.ts","../../src/patterns/disable/content-negotiation/modifies/hooks.ts","../../src/patterns/disable/content-negotiation/modifies/root-layout.svelte.ts","../../src/patterns/disable/content-negotiation/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, type SourceFile } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { removeHandle } from \"../../../../runtime/compose-handle\";\nimport {\n ensureBlankLineAfterImports,\n removeNamedImportIfUnused,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport { isLibSpecifier } from \"../../../../runtime/lib-specifier\";\n\nconst FAILURE_HINT = dedent`\n Take handleNegotiate out of the exported handle in src/hooks.server.ts, then\n remove its import:\n\n import { handle as handleNegotiate } from '#lib/negotiate.js';\n`;\n\nfunction removeNegotiateImport(sourceFile: SourceFile): boolean {\n const decl = sourceFile\n .getImportDeclarations()\n .find((d) => isLibSpecifier(d.getModuleSpecifierValue(), \"negotiate\"));\n if (!decl) return false;\n\n const named = decl.getNamedImports().find((ni) => {\n return (\n ni.getName() === \"handle\" &&\n ni.getAliasNode()?.getText() === \"handleNegotiate\"\n );\n });\n\n if (!named) return false;\n\n if (decl.getNamedImports().length === 1 && !decl.getDefaultImport()) {\n decl.remove();\n } else {\n named.remove();\n }\n return true;\n}\n\n/**\n * Undo `modifyHooksServerNegotiate`: take `handleNegotiate` out of the\n * exported handle and drop its import. A file that held nothing else comes\n * out empty, for the caller to delete.\n */\nexport function unmodifyHooksServerNegotiate(\n hooksServerPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(hooksServerPath, \"utf8\");\n if (!original.includes(\"handleNegotiate\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project({\n compilerOptions: { allowJs: true },\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(hooksServerPath);\n\n const removed = removeHandle(sourceFile, \"handleNegotiate\");\n if (removed.status === \"unsupported\") {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n removeNegotiateImport(sourceFile);\n removeNamedImportIfUnused(sourceFile, \"@sveltejs/kit/hooks\", \"sequence\");\n formatLikeSource(sourceFile);\n ensureBlankLineAfterImports(sourceFile);\n sourceFile.saveSync();\n\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport { Project, QuoteKind, SyntaxKind, type SourceFile } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\nimport { isLibSpecifier } from \"../../../../runtime/lib-specifier\";\n\nfunction removeNegotiateImport(sourceFile: SourceFile): boolean {\n const decl = sourceFile\n .getImportDeclarations()\n .find((d) => isLibSpecifier(d.getModuleSpecifierValue(), \"negotiate\"));\n if (!decl) return false;\n\n const named = decl.getNamedImports().find((ni) => {\n return (\n ni.getName() === \"reroute\" &&\n ni.getAliasNode()?.getText() === \"negotiateReroute\"\n );\n });\n if (!named) return false;\n\n if (decl.getNamedImports().length === 1 && !decl.getDefaultImport()) {\n decl.remove();\n } else {\n named.remove();\n }\n return true;\n}\n\nfunction isMeaningfullyEmpty(sourceFile: SourceFile): boolean {\n return sourceFile\n .getStatements()\n .every((s) => s.getKind() === SyntaxKind.EmptyStatement);\n}\n\nexport function unmodifyHooksNegotiate(hooksPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(hooksPath, \"utf8\");\n if (!original.includes(\"negotiateReroute\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project({\n compilerOptions: { allowJs: true },\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(hooksPath);\n\n const rerouteDecl = sourceFile.getVariableDeclaration(\"reroute\");\n const init = rerouteDecl?.getInitializer();\n const initText = init?.getText() ?? \"\";\n\n const hasI18nHelper = sourceFile\n .getVariableDeclarations()\n .some((d) => d.getName() === \"rerouteDeLocalize\");\n\n if (\n rerouteDecl &&\n hasI18nHelper &&\n initText.includes(\"rerouteDeLocalize\") &&\n initText.includes(\"negotiateReroute\")\n ) {\n rerouteDecl.setInitializer(\"({ url }) => rerouteDeLocalize(url.pathname)\");\n } else if (rerouteDecl && initText.includes(\"negotiateReroute\")) {\n const stmt = rerouteDecl.getFirstAncestorByKind(\n SyntaxKind.VariableStatement,\n );\n stmt?.remove();\n }\n\n removeNegotiateImport(sourceFile);\n\n if (isMeaningfullyEmpty(sourceFile)) {\n // Emptied rather than removed: the runtime turns an empty hooks.ts into a\n // delete entry, so the removal is written and reported like any other.\n fs.writeFileSync(hooksPath, \"\", \"utf8\");\n return { status: \"success\", changed: true };\n }\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n removeImportByModuleSpecifier,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { libModule } from \"../../../../runtime/lib-specifier\";\n\nexport function unmodifyRootLayoutNegotiate(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const file = SvelteFile.fromPath(layoutPath);\n const hasElement = file.hasElement(\"Negotiate\");\n\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n removeImportByModuleSpecifier(sf, libModule(\"negotiate\"));\n });\n return out;\n });\n\n if (hasElement) {\n file.removeElement(\"Negotiate\");\n }\n\n file.writeTo(layoutPath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { toDeleteEntry } from \"../../destroy/shared\";\nimport { getLogger } from \"../../../core/logger\";\nimport {\n modifyOutcomeToFile,\n revertOutcomeToFile,\n} from \"../../../runtime/modify-file\";\nimport { unmodifyHooksServerNegotiate } from \"./modifies/hooks.server\";\nimport { unmodifyHooksNegotiate } from \"./modifies/hooks\";\nimport { unmodifyRootLayoutNegotiate } from \"./modifies/root-layout.svelte\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n const deletes: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Reverting hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n // Emptied once the negotiation handle was all it held, it goes.\n const hooksServerRevert = revertOutcomeToFile(\n hooksServerPath,\n unmodifyHooksServerNegotiate(hooksServerPath),\n );\n pushResult(hooksServerRevert.modify);\n if (hooksServerRevert.delete) deletes.push(hooksServerRevert.delete);\n\n logger.info(\"Reverting hooks.ts\");\n const hooksPath = path.join(options.root, \"src\", \"hooks.ts\");\n const hooksOutcome = unmodifyHooksNegotiate(hooksPath);\n if (\n fs.existsSync(hooksPath) &&\n fs.readFileSync(hooksPath, \"utf8\").trim() === \"\"\n ) {\n // The reroute was all it contained; the file goes with it.\n deletes.push(toDeleteEntry(hooksPath));\n } else {\n pushResult(modifyOutcomeToFile(hooksPath, hooksOutcome));\n }\n\n logger.info(\"Reverting src/routes/+layout.svelte\");\n const rootLayoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(\n rootLayoutPath,\n unmodifyRootLayoutNegotiate(rootLayoutPath),\n ),\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":";;;;;;;;;;;;AAYA,IAAMc,IAAe,CAAM;;;;;;AAO3B,SAASd,EAAsB,GAAiC;CAC9D,IAAMgB,IAAOC,EACV,sB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B,CAAS,CAAC,IAErCgB,EAAWI,EAAoBpB,GAAWmB,CAAY,CAAC,GAGzDP,EAAO,KAAK,qCAAqC;CACjD,IAAMS,IAAiBxC,EAAK,KAC1BgC,EAAQ,MACR,OACA,UACA,gBACF;CAQA,OAPAG,EACEI,EACEC,GACAjB,EAA4BiB,CAAc,CAC5C,CACF,GAEO;EACL,SAAS,CAAC;EACV;EACA;EACA,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
1
+ {"version":3,"file":"generate.runtime-E-zoeSKW.js","names":["removeNegotiateImport","libModule","dedent","getLogger","toDeleteEntry","withInMemoryScript","removeNamedImportIfUnused","ensureBlankLineAfterImports","formatLikeSource","removeImportByModuleSpecifier","SvelteFile","removeHandle","fs","path","FAILURE_HINT","removeNegotiateImport$1","decl","sourceFile","isLibSpecifier","d","named","ni","unmodifyHooksServerNegotiate","hooksServerPath","original","Project","QuoteKind","removeNegotiateImport","isMeaningfullyEmpty","s","SyntaxKind","unmodifyHooksNegotiate","hooksPath","rerouteDecl","initText","hasI18nHelper","unmodifyRootLayoutNegotiate","layoutPath","file","hasElement","out","source","sf","generate","logger","options","modifies","deletes","pushResult","hooksServerRevert","revertOutcomeToFile","hooksOutcome","modifyOutcomeToFile","rootLayoutPath"],"sources":["../../src/patterns/disable/content-negotiation/modifies/hooks.server.ts","../../src/patterns/disable/content-negotiation/modifies/hooks.ts","../../src/patterns/disable/content-negotiation/modifies/root-layout.svelte.ts","../../src/patterns/disable/content-negotiation/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport dedent from \"dedent\";\nimport { Project, QuoteKind, type SourceFile } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { removeHandle } from \"../../../../runtime/compose-handle\";\nimport {\n ensureBlankLineAfterImports,\n removeNamedImportIfUnused,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport { isLibSpecifier } from \"../../../../runtime/lib-specifier\";\n\nconst FAILURE_HINT = dedent`\n Take handleNegotiate out of the exported handle in src/hooks.server.ts, then\n remove its import:\n\n import { handle as handleNegotiate } from '#lib/negotiate.js';\n`;\n\nfunction removeNegotiateImport(sourceFile: SourceFile): boolean {\n const decl = sourceFile\n .getImportDeclarations()\n .find((d) => isLibSpecifier(d.getModuleSpecifierValue(), \"negotiate\"));\n if (!decl) return false;\n\n const named = decl.getNamedImports().find((ni) => {\n return (\n ni.getName() === \"handle\" &&\n ni.getAliasNode()?.getText() === \"handleNegotiate\"\n );\n });\n\n if (!named) return false;\n\n if (decl.getNamedImports().length === 1 && !decl.getDefaultImport()) {\n decl.remove();\n } else {\n named.remove();\n }\n return true;\n}\n\n/**\n * Undo `modifyHooksServerNegotiate`: take `handleNegotiate` out of the\n * exported handle and drop its import. A file that held nothing else comes\n * out empty, for the caller to delete.\n */\nexport function unmodifyHooksServerNegotiate(\n hooksServerPath: string,\n): ModifyOutcome {\n if (!fs.existsSync(hooksServerPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(hooksServerPath, \"utf8\");\n if (!original.includes(\"handleNegotiate\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project({\n compilerOptions: { allowJs: true },\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(hooksServerPath);\n\n const removed = removeHandle(sourceFile, \"handleNegotiate\");\n if (removed.status === \"unsupported\") {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n removeNegotiateImport(sourceFile);\n removeNamedImportIfUnused(sourceFile, \"@sveltejs/kit/hooks\", \"sequence\");\n formatLikeSource(sourceFile);\n ensureBlankLineAfterImports(sourceFile);\n sourceFile.saveSync();\n\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport { Project, QuoteKind, SyntaxKind, type SourceFile } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\nimport { isLibSpecifier } from \"../../../../runtime/lib-specifier\";\n\nfunction removeNegotiateImport(sourceFile: SourceFile): boolean {\n const decl = sourceFile\n .getImportDeclarations()\n .find((d) => isLibSpecifier(d.getModuleSpecifierValue(), \"negotiate\"));\n if (!decl) return false;\n\n const named = decl.getNamedImports().find((ni) => {\n return (\n ni.getName() === \"reroute\" &&\n ni.getAliasNode()?.getText() === \"negotiateReroute\"\n );\n });\n if (!named) return false;\n\n if (decl.getNamedImports().length === 1 && !decl.getDefaultImport()) {\n decl.remove();\n } else {\n named.remove();\n }\n return true;\n}\n\nfunction isMeaningfullyEmpty(sourceFile: SourceFile): boolean {\n return sourceFile\n .getStatements()\n .every((s) => s.getKind() === SyntaxKind.EmptyStatement);\n}\n\nexport function unmodifyHooksNegotiate(hooksPath: string): ModifyOutcome {\n if (!fs.existsSync(hooksPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(hooksPath, \"utf8\");\n if (!original.includes(\"negotiateReroute\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project({\n compilerOptions: { allowJs: true },\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(hooksPath);\n\n const rerouteDecl = sourceFile.getVariableDeclaration(\"reroute\");\n const init = rerouteDecl?.getInitializer();\n const initText = init?.getText() ?? \"\";\n\n const hasI18nHelper = sourceFile\n .getVariableDeclarations()\n .some((d) => d.getName() === \"rerouteDeLocalize\");\n\n if (\n rerouteDecl &&\n hasI18nHelper &&\n initText.includes(\"rerouteDeLocalize\") &&\n initText.includes(\"negotiateReroute\")\n ) {\n rerouteDecl.setInitializer(\"({ url }) => rerouteDeLocalize(url.pathname)\");\n } else if (rerouteDecl && initText.includes(\"negotiateReroute\")) {\n const stmt = rerouteDecl.getFirstAncestorByKind(\n SyntaxKind.VariableStatement,\n );\n stmt?.remove();\n }\n\n removeNegotiateImport(sourceFile);\n\n if (isMeaningfullyEmpty(sourceFile)) {\n // Emptied rather than removed: the runtime turns an empty hooks.ts into a\n // delete entry, so the removal is written and reported like any other.\n fs.writeFileSync(hooksPath, \"\", \"utf8\");\n return { status: \"success\", changed: true };\n }\n\n formatLikeSource(sourceFile);\n sourceFile.saveSync();\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== original,\n };\n}\n","import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n removeImportByModuleSpecifier,\n withInMemoryScript,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { libModule } from \"../../../../runtime/lib-specifier\";\n\nexport function unmodifyRootLayoutNegotiate(layoutPath: string): ModifyOutcome {\n if (!fs.existsSync(layoutPath)) {\n return { status: \"success\", changed: false };\n }\n\n const file = SvelteFile.fromPath(layoutPath);\n const hasElement = file.hasElement(\"Negotiate\");\n\n file.modifyScript((source) => {\n const { source: out } = withInMemoryScript(source, (sf) => {\n removeImportByModuleSpecifier(sf, libModule(\"negotiate\"));\n });\n return out;\n });\n\n if (hasElement) {\n file.removeElement(\"Negotiate\");\n }\n\n file.writeTo(layoutPath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { toDeleteEntry } from \"../../destroy/shared\";\nimport { getLogger } from \"../../../core/logger\";\nimport {\n modifyOutcomeToFile,\n revertOutcomeToFile,\n} from \"../../../runtime/modify-file\";\nimport { unmodifyHooksServerNegotiate } from \"./modifies/hooks.server\";\nimport { unmodifyHooksNegotiate } from \"./modifies/hooks\";\nimport { unmodifyRootLayoutNegotiate } from \"./modifies/root-layout.svelte\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n const deletes: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Reverting hooks.server.ts\");\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n // Emptied once the negotiation handle was all it held, it goes.\n const hooksServerRevert = revertOutcomeToFile(\n hooksServerPath,\n unmodifyHooksServerNegotiate(hooksServerPath),\n );\n pushResult(hooksServerRevert.modify);\n if (hooksServerRevert.delete) deletes.push(hooksServerRevert.delete);\n\n logger.info(\"Reverting hooks.ts\");\n const hooksPath = path.join(options.root, \"src\", \"hooks.ts\");\n const hooksOutcome = unmodifyHooksNegotiate(hooksPath);\n if (\n fs.existsSync(hooksPath) &&\n fs.readFileSync(hooksPath, \"utf8\").trim() === \"\"\n ) {\n // The reroute was all it contained; the file goes with it.\n deletes.push(toDeleteEntry(hooksPath));\n } else {\n pushResult(modifyOutcomeToFile(hooksPath, hooksOutcome));\n }\n\n logger.info(\"Reverting src/routes/+layout.svelte\");\n const rootLayoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(\n rootLayoutPath,\n unmodifyRootLayoutNegotiate(rootLayoutPath),\n ),\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":";;;;;;;;;;;;AAYA,IAAMc,IAAe,CAAM;;;;;;AAO3B,SAASd,EAAsB,GAAiC;CAC9D,IAAMgB,IAAOC,EACV,sBAAsB,CAAC,CACvB,MAAM,MAAMC,EAAeC,EAAE,wBAAwB,GAAG,WAAW,CAAC;CACvE,IAAI,CAACH,GAAM,OAAO;CAElB,IAAMI,IAAQJ,EAAK,gBAAgB,CAAC,CAAC,MAAM,MAEvCK,EAAG,QAAQ,MAAM,YACjBA,EAAG,aAAa,CAAC,EAAE,QAAQ,MAAM,iBAEpC;CASD,OAPKD,KAEDJ,EAAK,gBAAgB,CAAC,CAAC,WAAW,KAAK,CAACA,EAAK,iBAAiB,IAChEA,EAAK,OAAO,IAEZI,EAAM,OAA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@@ -1,33 +1,33 @@
1
1
  import { t as e } from "./lib-specifier-Cngo1zF_.js";
2
2
  import { n as t } from "./logger-CQONztPm.js";
3
- import { t as n } from "./shared-CZC4d7Uj.js";
3
+ import { t as n } from "./shared-Cc_ns5-y.js";
4
4
  import { n as r } from "./env-BPfk1VAw.js";
5
- import { f as i, o as a } from "./ts-morph-helpers-CDW4lhox.js";
6
- import { modifyOutcomeToFile as o } from "./modify-file-BlDeeurK.js";
7
- import { unmodifyEnvVarsFiles as s } from "./env-vars-C1NUX-bf.js";
8
- import { t as c } from "./svelte-file-B3RfgVdt.js";
9
- import { n as l } from "./env-vars-De0Xs0L2.js";
10
- import u from "node:fs";
11
- import d from "node:path";
12
- import { Project as f, QuoteKind as p, SyntaxKind as m } from "ts-morph";
5
+ import { f as i, m as a, n as o, o as s } from "./ts-morph-helpers-Bepc-Es2.js";
6
+ import { modifyOutcomeToFile as c } from "./modify-file-DK-tCH9k.js";
7
+ import { unmodifyEnvVarsFiles as l } from "./env-vars-CcE6ODqC.js";
8
+ import { t as u } from "./svelte-file-B3RfgVdt.js";
9
+ import { n as d } from "./env-vars-De0Xs0L2.js";
10
+ import f from "node:fs";
11
+ import p from "node:path";
12
+ import { Project as m, QuoteKind as h, SyntaxKind as g } from "ts-morph";
13
13
  //#region src/patterns/disable/payments/modifies/modify-nav-user.ts
14
- function h(e) {
15
- if (!u.existsSync(e)) return {
14
+ function _(e) {
15
+ if (!f.existsSync(e)) return {
16
16
  status: "success",
17
17
  changed: !1
18
18
  };
19
- let t = u.readFileSync(e, "utf8");
19
+ let t = f.readFileSync(e, "utf8");
20
20
  if (!t.includes("/billing")) return {
21
21
  status: "success",
22
22
  changed: !1
23
23
  };
24
- let n = new c(t), r = !1, a = (e) => {
24
+ let n = new u(t), r = !1, a = (e) => {
25
25
  r || e((e) => {
26
26
  let t = i(e, "Billing", "@lucide/svelte/icons/credit-card");
27
27
  return t.wasRemoved && (r = !0), t.source;
28
28
  });
29
29
  };
30
- return a((e) => n.modifyModuleScript(e)), r || a((e) => n.modifyScript(e)), r ? (u.writeFileSync(e, n.toString(), "utf8"), {
30
+ return a((e) => n.modifyModuleScript(e)), r || a((e) => n.modifyScript(e)), r ? (f.writeFileSync(e, n.toString(), "utf8"), {
31
31
  status: "success",
32
32
  changed: !0
33
33
  }) : {
@@ -37,42 +37,42 @@ function h(e) {
37
37
  }
38
38
  //#endregion
39
39
  //#region src/patterns/disable/payments/modifies/modify-user-signup.ts
40
- var g = /* @__PURE__ */ new Set(["linkStripeCustomer.run", "linkStripeCustomer"]);
41
- function _(t) {
42
- if (!u.existsSync(t)) return {
40
+ var v = /* @__PURE__ */ new Set(["linkStripeCustomer.run", "linkStripeCustomer"]);
41
+ function y(t) {
42
+ if (!f.existsSync(t)) return {
43
43
  status: "success",
44
44
  changed: !1
45
45
  };
46
- let n = u.readFileSync(t, "utf8");
46
+ let n = f.readFileSync(t, "utf8");
47
47
  if (!n.includes("linkStripeCustomer")) return {
48
48
  status: "success",
49
49
  changed: !1
50
50
  };
51
- let r = new f({ manipulationSettings: { quoteKind: p.Single } }).addSourceFileAtPath(t);
51
+ let r = new m({ manipulationSettings: { quoteKind: h.Single } }).addSourceFileAtPath(t);
52
52
  for (let t of ["workflows/link-stripe-customer", "stripe"]) {
53
53
  let n = r.getImportDeclarations().find((n) => e(n.getModuleSpecifierValue(), t));
54
54
  n && n.remove();
55
55
  }
56
56
  let i = r.getVariableStatement((e) => e.getDeclarations().some((e) => e.getName() === "linkStripeCustomer"));
57
57
  i && i.remove();
58
- let o = r.getDescendantsOfKind(m.CallExpression).filter((e) => g.has(e.getExpression().getText()));
59
- for (let e of o) {
60
- let t = e.getFirstAncestorByKind(m.ExpressionStatement);
61
- t && t.remove();
58
+ let c = r.getDescendantsOfKind(g.CallExpression).filter((e) => v.has(e.getExpression().getText()));
59
+ for (let e of c) {
60
+ let t = e.getFirstAncestorByKind(g.ExpressionStatement);
61
+ t && a(r, t);
62
62
  }
63
- return a(r), r.saveSync(), {
63
+ return s(r), o(r), r.saveSync(), {
64
64
  status: "success",
65
65
  changed: r.getFullText() !== n
66
66
  };
67
67
  }
68
68
  //#endregion
69
69
  //#region src/patterns/disable/payments/generate.runtime.ts
70
- async function v(e) {
71
- let i = e.features.auth, a = t(e), c = [], u = [], f = (e) => {
72
- e && c.push(e);
70
+ async function b(e) {
71
+ let i = e.features.auth, a = t(e), o = [], s = [], u = (e) => {
72
+ e && o.push(e);
73
73
  };
74
74
  a.info("Stripping Stripe credentials from .env");
75
- let p = [
75
+ let f = [
76
76
  {
77
77
  type: "comment",
78
78
  key: "Stripe credentials"
@@ -89,20 +89,20 @@ async function v(e) {
89
89
  type: "var",
90
90
  key: "STRIPE_WEBHOOK_SECRET"
91
91
  }
92
- ], m = d.join(e.root, ".env");
93
- f(o(m, r(m, p))), a.info("Removing Stripe variables from src/env.ts");
94
- let g = s(e.root, l);
95
- if (f(g.modify), g.delete && u.push(g.delete), i) {
92
+ ], m = p.join(e.root, ".env");
93
+ u(c(m, r(m, f))), a.info("Removing Stripe variables from src/env.ts");
94
+ let h = l(e.root, d);
95
+ if (u(h.modify), h.delete && s.push(h.delete), i) {
96
96
  a.info("Reverting nav-user.svelte");
97
- let t = d.join(e.root, "src", "lib", "components", "nav-user.svelte");
98
- f(o(t, h(t))), a.info("Reverting signup +page.server.ts");
99
- let n = d.join(e.root, "src", "routes", "(public)", "(auth)", "signup", "+page.server.ts");
100
- f(o(n, _(n)));
97
+ let t = p.join(e.root, "src", "lib", "components", "nav-user.svelte");
98
+ u(c(t, _(t))), a.info("Reverting signup +page.server.ts");
99
+ let n = p.join(e.root, "src", "routes", "(public)", "(auth)", "signup", "+page.server.ts");
100
+ u(c(n, y(n)));
101
101
  }
102
102
  return {
103
103
  creates: [],
104
- modifies: c,
105
- deletes: u,
104
+ modifies: o,
105
+ deletes: s,
106
106
  components: [],
107
107
  packages: [],
108
108
  collections: [],
@@ -117,6 +117,6 @@ async function v(e) {
117
117
  };
118
118
  }
119
119
  //#endregion
120
- export { v as generate };
120
+ export { b as generate };
121
121
 
122
- //# sourceMappingURL=generate.runtime-pVLzzpUM.js.map
122
+ //# sourceMappingURL=generate.runtime-EQnytCFL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.runtime-EQnytCFL.js","names":["isLibSpecifier","getLogger","planDropsForCollections","modifyEnvRemove","removeNavItemFromScript","removeStatementWithComments","ensureBlankLineAfterImports","formatLikeSource","SvelteFile","STRIPE_ENV_VAR_NAMES","fs","path","unmodifyNavUser","navUserPath","source","file","wasRemoved","tryRemove","run","result","src","fn","CALL_EXPRESSIONS","unmodifyUserSignup","userSignupPath","originalSource","sourceFile","Project","QuoteKind","module","decl","d","linkFn","s","callStatements","SyntaxKind","ce","call","stmt","generate","isAppMode","options","logger","modifies","deletes","pushResult","envEdits","envPath","modifyOutcomeToFile","envVars","unmodifyEnvVarsFiles"],"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\";\nimport {\n ensureBlankLineAfterImports,\n formatLikeSource,\n removeStatementWithComments,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport { isLibSpecifier } from \"../../../../runtime/lib-specifier\";\n\nconst CALL_EXPRESSIONS = new Set([\n \"linkStripeCustomer.run\",\n // Projects from before the workflow: an inline helper called directly.\n \"linkStripeCustomer\",\n]);\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 for (const module of [\"workflows/link-stripe-customer\", \"stripe\"]) {\n const decl = sourceFile\n .getImportDeclarations()\n .find((d) => isLibSpecifier(d.getModuleSpecifierValue(), module));\n if (decl) decl.remove();\n }\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) => CALL_EXPRESSIONS.has(ce.getExpression().getText()));\n for (const call of callStatements) {\n const stmt = call.getFirstAncestorByKind(SyntaxKind.ExpressionStatement);\n // With the two comment lines enable-payments put above it: left behind,\n // they keep the file from matching the stock signup, and enable-whatsapp\n // then refuses to swap it.\n if (stmt) removeStatementWithComments(sourceFile, stmt);\n }\n\n formatLikeSource(sourceFile);\n ensureBlankLineAfterImports(sourceFile);\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 { unmodifyEnvVarsFiles } from \"../../../runtime/env-vars\";\nimport { STRIPE_ENV_VAR_NAMES } from \"../../enable/payments/runtime/env-vars\";\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 deletes: 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 ];\n const envPath = path.join(options.root, \".env\");\n pushResult(modifyOutcomeToFile(envPath, modifyEnvRemove(envPath, envEdits)));\n\n logger.info(\"Removing Stripe variables from src/env.ts\");\n const envVars = unmodifyEnvVarsFiles(options.root, STRIPE_ENV_VAR_NAMES);\n pushResult(envVars.modify);\n if (envVars.delete) deletes.push(envVars.delete);\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,SAAgBY,EAAgB,GAAoC;CAClE,IAAI,CAACF,EAAG,WAAWG,CAAW,GAC5B,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMC,IAASJ,EAAG,aAAaG,GAAa,MAAM;CAClD,IAAI,CAACC,EAAO,SAAS,UAAU,GAC7B,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMC,IAAO,IAAIP,EAAWM,CAAM,GAC9BE,IAAa,IAEXC,KAAa,MAAgD;EACjE,AAAID,KACJE,GAAK,MAAQ;GACX,IAAMC,IAASf,EACbgB,GACA,WACA,kCACF;GAEA,OADID,EAAO,eAAY,IAAa,KAC7BA,EAAO;EAChB,CAAC;CACH;CAUA,OARAF,GAAW,MAAOF,EAAK,mBAAmBM,CAAE,CAAC,GACxCL,KAAYC,GAAW,MAAOF,EAAK,aAAaM,CAAE,CAAC,GAEnDL,KAILN,EAAG,cAAcG,GAAaE,EAAK,SAAS,GAAG,MAAM,GAC9C;EAAE,QAAQ;EAAW,SAAS;CAAK,KAJjC;EAAE,QAAQ;EAAW,SAAS;CAAM;AAK/C;;;AC9BA,IAAMO,oBAAmB,IAAI,IAAI,CAC/B,0BAEA,oBACF,CAAC;AAED,SAAgBC,EAAmB,GAAuC;CACxE,IAAI,CAACb,EAAG,WAAWc,CAAc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