@aglyn/plugins-ai 1.0.0-beta.291 → 1.0.0-beta.293

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 (149) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-site-import-job.component.js +5 -4
  3. package/src/lib/components/ai-site-import-job.component.js.map +1 -1
  4. package/src/lib/components/ai-site-import-start.component.js +3 -3
  5. package/src/lib/components/ai-site-import-start.component.js.map +1 -1
  6. package/src/lib/components/ai-site-start-card.component.d.ts +1 -1
  7. package/src/lib/components/ai-site-start-card.component.js +129 -29
  8. package/src/lib/components/ai-site-start-card.component.js.map +1 -1
  9. package/src/lib/components/ai-site-start-steps.component.d.ts +15 -3
  10. package/src/lib/components/ai-site-start-steps.component.js +42 -25
  11. package/src/lib/components/ai-site-start-steps.component.js.map +1 -1
  12. package/src/lib/components/ai-site-style-previews.d.ts +17 -0
  13. package/src/lib/components/ai-site-style-previews.js +26 -95
  14. package/src/lib/components/ai-site-style-previews.js.map +1 -1
  15. package/src/lib/declarations.server.js +22 -0
  16. package/src/lib/declarations.server.js.map +1 -1
  17. package/src/lib/jobs/ai-job-import-step.d.ts +21 -2
  18. package/src/lib/jobs/ai-job-import-step.js +179 -49
  19. package/src/lib/jobs/ai-job-import-step.js.map +1 -1
  20. package/src/lib/jobs/ai-job-layout-language.d.ts +27 -3
  21. package/src/lib/jobs/ai-job-layout-language.js +156 -113
  22. package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
  23. package/src/lib/jobs/ai-job-layout-step.js +56 -17
  24. package/src/lib/jobs/ai-job-layout-step.js.map +1 -1
  25. package/src/lib/jobs/ai-job-page-language.d.ts +25 -15
  26. package/src/lib/jobs/ai-job-page-language.js +120 -66
  27. package/src/lib/jobs/ai-job-page-language.js.map +1 -1
  28. package/src/lib/jobs/ai-job-page-step.js +27 -7
  29. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  30. package/src/lib/jobs/ai-job-site-datasets.d.ts +12 -4
  31. package/src/lib/jobs/ai-job-site-datasets.js +36 -16
  32. package/src/lib/jobs/ai-job-site-datasets.js.map +1 -1
  33. package/src/lib/jobs/ai-jobs.js +6 -2
  34. package/src/lib/jobs/ai-jobs.js.map +1 -1
  35. package/src/lib/jobs/ai-layout-stock-photos.d.ts +50 -1
  36. package/src/lib/jobs/ai-layout-stock-photos.js +586 -35
  37. package/src/lib/jobs/ai-layout-stock-photos.js.map +1 -1
  38. package/src/lib/jobs/ai-site-import-compile.d.ts +147 -0
  39. package/src/lib/jobs/ai-site-import-compile.js +1143 -0
  40. package/src/lib/jobs/ai-site-import-compile.js.map +1 -0
  41. package/src/lib/jobs/ai-site-import-document.d.ts +9 -36
  42. package/src/lib/jobs/ai-site-import-document.js +23 -489
  43. package/src/lib/jobs/ai-site-import-document.js.map +1 -1
  44. package/src/lib/jobs/ai-site-import-look.d.ts +54 -7
  45. package/src/lib/jobs/ai-site-import-look.js +163 -52
  46. package/src/lib/jobs/ai-site-import-look.js.map +1 -1
  47. package/src/lib/jobs/ai-site-import-publish.d.ts +7 -1
  48. package/src/lib/jobs/ai-site-import-publish.js +19 -5
  49. package/src/lib/jobs/ai-site-import-publish.js.map +1 -1
  50. package/src/lib/jobs/ai-site-late-photos.js +4 -2
  51. package/src/lib/jobs/ai-site-late-photos.js.map +1 -1
  52. package/src/lib/jobs/ai-site-publish.d.ts +10 -1
  53. package/src/lib/jobs/ai-site-publish.js +8 -3
  54. package/src/lib/jobs/ai-site-publish.js.map +1 -1
  55. package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-1029-recordings.d.ts +23 -0
  56. package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-1029-recordings.js +677 -0
  57. package/src/lib/jobs/fixtures/ai-stock-photo-agl4092-1029-recordings.js.map +1 -0
  58. package/src/lib/layout-language/ai-layout-compiler.d.ts +26 -0
  59. package/src/lib/layout-language/ai-layout-compiler.js +677 -33
  60. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  61. package/src/lib/layout-language/ai-layout-frame-hollows.js +5 -1
  62. package/src/lib/layout-language/ai-layout-frame-hollows.js.map +1 -1
  63. package/src/lib/layout-language/ai-layout-frame-source.d.ts +196 -0
  64. package/src/lib/layout-language/ai-layout-frame-source.js +726 -0
  65. package/src/lib/layout-language/ai-layout-frame-source.js.map +1 -0
  66. package/src/lib/layout-language/ai-layout-frame.d.ts +22 -0
  67. package/src/lib/layout-language/ai-layout-frame.js +121 -29
  68. package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
  69. package/src/lib/layout-language/ai-layout-language.d.ts +103 -37
  70. package/src/lib/layout-language/ai-layout-language.js +85 -120
  71. package/src/lib/layout-language/ai-layout-language.js.map +1 -1
  72. package/src/lib/model/ai-credit-estimate.d.ts +11 -7
  73. package/src/lib/model/ai-credit-estimate.js +11 -7
  74. package/src/lib/model/ai-credit-estimate.js.map +1 -1
  75. package/src/lib/model/ai-site-import.d.ts +307 -13
  76. package/src/lib/model/ai-site-import.js +227 -19
  77. package/src/lib/model/ai-site-import.js.map +1 -1
  78. package/src/lib/model/ai-site-look.d.ts +65 -1
  79. package/src/lib/model/ai-site-look.js +141 -23
  80. package/src/lib/model/ai-site-look.js.map +1 -1
  81. package/src/lib/model/ai-site-photos.d.ts +2 -0
  82. package/src/lib/model/ai-site-photos.js.map +1 -1
  83. package/src/lib/model/ai-site-start-steps.d.ts +4 -3
  84. package/src/lib/model/ai-site-start-steps.js +11 -3
  85. package/src/lib/model/ai-site-start-steps.js.map +1 -1
  86. package/src/lib/model/ai-site-start.d.ts +23 -2
  87. package/src/lib/model/ai-site-start.js +25 -3
  88. package/src/lib/model/ai-site-start.js.map +1 -1
  89. package/src/lib/providers/routing.d.ts +11 -0
  90. package/src/lib/providers/routing.js +23 -0
  91. package/src/lib/providers/routing.js.map +1 -1
  92. package/src/lib/runtime/ai-doctrine-validators.d.ts +4 -2
  93. package/src/lib/runtime/ai-doctrine-validators.js +7 -2
  94. package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
  95. package/src/lib/runtime/ai-icon-library.d.ts +4 -0
  96. package/src/lib/runtime/ai-icon-library.js +4 -0
  97. package/src/lib/runtime/ai-icon-library.js.map +1 -1
  98. package/src/lib/runtime/ai-node-tree.js +5 -1
  99. package/src/lib/runtime/ai-node-tree.js.map +1 -1
  100. package/src/lib/runtime/ai-palette.d.ts +2 -0
  101. package/src/lib/runtime/ai-palette.generated.js +19 -3
  102. package/src/lib/runtime/ai-palette.generated.js.map +1 -1
  103. package/src/lib/runtime/ai-palette.js +2 -1
  104. package/src/lib/runtime/ai-palette.js.map +1 -1
  105. package/src/lib/site-import/fixtures/site-layout-recordings.d.ts +50 -0
  106. package/src/lib/site-import/fixtures/site-layout-recordings.js +86 -0
  107. package/src/lib/site-import/fixtures/site-layout-recordings.js.map +1 -0
  108. package/src/lib/site-import/site-import-crawl.d.ts +18 -1
  109. package/src/lib/site-import/site-import-crawl.js +70 -10
  110. package/src/lib/site-import/site-import-crawl.js.map +1 -1
  111. package/src/lib/site-import/site-import-css.d.ts +110 -0
  112. package/src/lib/site-import/site-import-css.js +826 -0
  113. package/src/lib/site-import/site-import-css.js.map +1 -0
  114. package/src/lib/site-import/site-import-html.d.ts +116 -1
  115. package/src/lib/site-import/site-import-html.js +538 -46
  116. package/src/lib/site-import/site-import-html.js.map +1 -1
  117. package/src/lib/site-import/site-import-layout.d.ts +79 -0
  118. package/src/lib/site-import/site-import-layout.js +1608 -0
  119. package/src/lib/site-import/site-import-layout.js.map +1 -0
  120. package/src/lib/site-import/site-import-nav.d.ts +40 -0
  121. package/src/lib/site-import/site-import-nav.js +437 -0
  122. package/src/lib/site-import/site-import-nav.js.map +1 -0
  123. package/src/lib/site-import/site-import-page.d.ts +8 -1
  124. package/src/lib/site-import/site-import-page.js +24 -2
  125. package/src/lib/site-import/site-import-page.js.map +1 -1
  126. package/src/lib/assets/site-styles/beauty.webp +0 -0
  127. package/src/lib/assets/site-styles/blog.webp +0 -0
  128. package/src/lib/assets/site-styles/business.webp +0 -0
  129. package/src/lib/assets/site-styles/coming-soon.webp +0 -0
  130. package/src/lib/assets/site-styles/education.webp +0 -0
  131. package/src/lib/assets/site-styles/events.webp +0 -0
  132. package/src/lib/assets/site-styles/fitness.webp +0 -0
  133. package/src/lib/assets/site-styles/landing.webp +0 -0
  134. package/src/lib/assets/site-styles/music.webp +0 -0
  135. package/src/lib/assets/site-styles/nonprofit.webp +0 -0
  136. package/src/lib/assets/site-styles/personal.webp +0 -0
  137. package/src/lib/assets/site-styles/photography.webp +0 -0
  138. package/src/lib/assets/site-styles/portfolio.webp +0 -0
  139. package/src/lib/assets/site-styles/professional.webp +0 -0
  140. package/src/lib/assets/site-styles/realestate.webp +0 -0
  141. package/src/lib/assets/site-styles/restaurant.webp +0 -0
  142. package/src/lib/assets/site-styles/store.webp +0 -0
  143. package/src/lib/assets/site-styles/studio.webp +0 -0
  144. package/src/lib/assets/site-styles/trades.webp +0 -0
  145. package/src/lib/assets/site-styles/wellness.webp +0 -0
  146. package/src/lib/assets/site-styles/yoga.webp +0 -0
  147. package/src/lib/site-import/site-import-review.d.ts +0 -40
  148. package/src/lib/site-import/site-import-review.js +0 -149
  149. package/src/lib/site-import/site-import-review.js.map +0 -1
@@ -281,3 +281,7 @@ export declare const AI_ICON_WORDS: AiIconWord[];
281
281
  export declare function aiIconOfWord(word: unknown): AiIconLibraryEntry | null;
282
282
  /** The library entry a stored icon id names; `null` for an id the library does not hold. */
283
283
  export declare function aiIconOfId(id: unknown): AiIconLibraryEntry | null;
284
+ /** The most characters an icon's own drawing may hold (AGL-4107): a page brought in carries its source's icons. */
285
+ export declare const AI_ICON_PATH_MAX_CHARS = 8192;
286
+ /** Whether a value is SVG path data and nothing else: commands, numbers and their separators. */
287
+ export declare function aiIsIconPathData(value: unknown): value is string;
@@ -277,5 +277,9 @@ const BY_ID = new Map(Object.values(ALL_ICONS).map((entry)=>[
277
277
  var _BY_ID_get;
278
278
  return typeof id === 'string' ? (_BY_ID_get = BY_ID.get(id)) != null ? _BY_ID_get : null : null;
279
279
  }
280
+ /** The most characters an icon's own drawing may hold (AGL-4107): a page brought in carries its source's icons. */ export const AI_ICON_PATH_MAX_CHARS = 8192;
281
+ /** Whether a value is SVG path data and nothing else: commands, numbers and their separators. */ export function aiIsIconPathData(value) {
282
+ return typeof value === 'string' && value.length > 0 && value.length <= AI_ICON_PATH_MAX_CHARS && /^[MmZzLlHhVvCcSsQqTtAa0-9eE.,\s+-]+$/.test(value) && /^\s*[Mm]/.test(value);
283
+ }
280
284
 
281
285
  //# sourceMappingURL=ai-icon-library.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/runtime/ai-icon-library.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The icons a page built by the platform's own code may draw (AGL-3660).\n *\n * An icon element draws the path its picker stores beside the id, which a\n * model can never supply, so a tree a model writes keeps no icon\n * (`ai-node-tree.ts` drops the id). The layout language compiler is code: the\n * model names one of these by its word, and the compiler writes the Material\n * Design Icons id and the path copied here, exactly as the icon picker stores\n * them — so the published page draws it without loading the icon catalog.\n *\n * Paths are Material Design Icons 6.5.95 (Apache-2.0), the same set the\n * picker offers (`@aglyn/shared-data-mdi`). The words are the vocabulary the\n * language's schema enumerates; a word added here is a word the model may\n * write.\n */\n\n/** The palette element an icon is drawn with. */\nexport const AI_ICON_COMPONENT_ID = 'icon'\n\nexport interface AiIconLibraryEntry {\n /** The id the icon picker stores. */\n id: string\n /** The SVG path the picker stores beside it. */\n path: string\n}\n\nexport const AI_ICON_LIBRARY = {\n check: {\n id: 'check-circle-outline',\n path: 'M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M12 20C7.59 20 4 16.41 4 12S7.59 4 12 4 20 7.59 20 12 16.41 20 12 20M16.59 7.58L10 14.17L7.41 11.59L6 13L10 17L18 9L16.59 7.58Z',\n },\n star: {\n id: 'star-outline',\n path: 'M12,15.39L8.24,17.66L9.23,13.38L5.91,10.5L10.29,10.13L12,6.09L13.71,10.13L18.09,10.5L14.77,13.38L15.76,17.66M22,9.24L14.81,8.63L12,2L9.19,8.63L2,9.24L7.45,13.97L5.82,21L12,17.27L18.18,21L16.54,13.97L22,9.24Z',\n },\n heart: {\n id: 'heart-outline',\n path: 'M12.1,18.55L12,18.65L11.89,18.55C7.14,14.24 4,11.39 4,8.5C4,6.5 5.5,5 7.5,5C9.04,5 10.54,6 11.07,7.36H12.93C13.46,6 14.96,5 16.5,5C18.5,5 20,6.5 20,8.5C20,11.39 16.86,14.24 12.1,18.55M16.5,3C14.76,3 13.09,3.81 12,5.08C10.91,3.81 9.24,3 7.5,3C4.42,3 2,5.41 2,8.5C2,12.27 5.4,15.36 10.55,20.03L12,21.35L13.45,20.03C18.6,15.36 22,12.27 22,8.5C22,5.41 19.58,3 16.5,3Z',\n },\n clock: {\n id: 'clock-outline',\n path: 'M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z',\n },\n calendar: {\n id: 'calendar-check-outline',\n path: 'M19,4H18V2H16V4H8V2H6V4H5A2,2 0 0,0 3,6V20A2,2 0 0,0 5,22H19A2,2 0 0,0 21,20V6A2,2 0 0,0 19,4M19,20H5V10H19V20M5,8V6H19V8H5M10.56,18.46L16.5,12.53L15.43,11.47L10.56,16.34L8.45,14.23L7.39,15.29L10.56,18.46Z',\n },\n location: {\n id: 'map-marker-outline',\n path: 'M12,6.5A2.5,2.5 0 0,1 14.5,9A2.5,2.5 0 0,1 12,11.5A2.5,2.5 0 0,1 9.5,9A2.5,2.5 0 0,1 12,6.5M12,2A7,7 0 0,1 19,9C19,14.25 12,22 12,22C12,22 5,14.25 5,9A7,7 0 0,1 12,2M12,4A5,5 0 0,0 7,9C7,10 7,12 12,18.71C17,12 17,10 17,9A5,5 0 0,0 12,4Z',\n },\n shield: {\n id: 'shield-check-outline',\n path: 'M21,11C21,16.55 17.16,21.74 12,23C6.84,21.74 3,16.55 3,11V5L12,1L21,5V11M12,21C15.75,20 19,15.54 19,11.22V6.3L12,3.18L5,6.3V11.22C5,15.54 8.25,20 12,21M10,17L6,13L7.41,11.59L10,14.17L16.59,7.58L18,9',\n },\n leaf: {\n id: 'leaf',\n path: 'M17,8C8,10 5.9,16.17 3.82,21.34L5.71,22L6.66,19.7C7.14,19.87 7.64,20 8,20C19,20 22,3 22,3C21,5 14,5.25 9,6.25C4,7.25 2,11.5 2,13.5C2,15.5 3.75,17.25 3.75,17.25C7,8 17,8 17,8Z',\n },\n home: {\n id: 'home-outline',\n path: 'M12 5.69L17 10.19V18H15V12H9V18H7V10.19L12 5.69M12 3L2 12H5V20H11V14H13V20H19V12H22L12 3Z',\n },\n tools: {\n id: 'tools',\n path: 'M21.71 20.29L20.29 21.71A1 1 0 0 1 18.88 21.71L7 9.85A3.81 3.81 0 0 1 6 10A4 4 0 0 1 2.22 4.7L4.76 7.24L5.29 6.71L6.71 5.29L7.24 4.76L4.7 2.22A4 4 0 0 1 10 6A3.81 3.81 0 0 1 9.85 7L21.71 18.88A1 1 0 0 1 21.71 20.29M2.29 18.88A1 1 0 0 0 2.29 20.29L3.71 21.71A1 1 0 0 0 5.12 21.71L10.59 16.25L7.76 13.42M20 2L16 4V6L13.83 8.17L15.83 10.17L18 8H20L22 4Z',\n },\n paw: {\n id: 'paw',\n path: 'M8.35,3C9.53,2.83 10.78,4.12 11.14,5.9C11.5,7.67 10.85,9.25 9.67,9.43C8.5,9.61 7.24,8.32 6.87,6.54C6.5,4.77 7.17,3.19 8.35,3M15.5,3C16.69,3.19 17.35,4.77 17,6.54C16.62,8.32 15.37,9.61 14.19,9.43C13,9.25 12.35,7.67 12.72,5.9C13.08,4.12 14.33,2.83 15.5,3M3,7.6C4.14,7.11 5.69,8 6.5,9.55C7.26,11.13 7,12.79 5.87,13.28C4.74,13.77 3.2,12.89 2.41,11.32C1.62,9.75 1.9,8.08 3,7.6M21,7.6C22.1,8.08 22.38,9.75 21.59,11.32C20.8,12.89 19.26,13.77 18.13,13.28C17,12.79 16.74,11.13 17.5,9.55C18.31,8 19.86,7.11 21,7.6M19.33,18.38C19.37,19.32 18.65,20.36 17.79,20.75C16,21.57 13.88,19.87 11.89,19.87C9.9,19.87 7.76,21.64 6,20.75C5,20.26 4.31,18.96 4.44,17.88C4.62,16.39 6.41,15.59 7.47,14.5C8.88,13.09 9.88,10.44 11.89,10.44C13.89,10.44 14.95,13.05 16.3,14.5C17.41,15.72 19.26,16.75 19.33,18.38Z',\n },\n tooth: {\n id: 'tooth-outline',\n path: 'M7,2C4,2 2,5 2,8C2,10.11 3,13 4,14C5,15 6,22 8,22C12.54,22 10,15 12,15C14,15 11.46,22 16,22C18,22 19,15 20,14C21,13 22,10.11 22,8C22,5 20,2 17,2C14,2 14,3 12,3C10,3 10,2 7,2M7,4C9,4 10,5 12,5C14,5 15,4 17,4C18.67,4 20,6 20,8C20,9.75 19.14,12.11 18.19,13.06C17.33,13.92 16.06,19.94 15.5,19.94C15.29,19.94 15,18.88 15,17.59C15,15.55 14.43,13 12,13C9.57,13 9,15.55 9,17.59C9,18.88 8.71,19.94 8.5,19.94C7.94,19.94 6.67,13.92 5.81,13.06C4.86,12.11 4,9.75 4,8C4,6 5.33,4 7,4Z',\n },\n coffee: {\n id: 'coffee-outline',\n path: 'M2,21V19H20V21H2M20,8V5H18V8H20M20,3A2,2 0 0,1 22,5V8A2,2 0 0,1 20,10H18V13A4,4 0 0,1 14,17H8A4,4 0 0,1 4,13V3H20M16,5H6V13A2,2 0 0,0 8,15H14A2,2 0 0,0 16,13V5Z',\n },\n yoga: {\n id: 'meditation',\n path: 'M12 4C13.11 4 14 4.89 14 6S13.11 8 12 8 10 7.11 10 6 10.9 4 12 4M21 16V14C18.76 14 16.84 13.04 15.4 11.32L14.06 9.72C13.68 9.26 13.12 9 12.53 9H11.5C10.89 9 10.33 9.26 9.95 9.72L8.61 11.32C7.16 13.04 5.24 14 3 14V16C5.77 16 8.19 14.83 10 12.75V15L6.12 16.55C5.45 16.82 5 17.5 5 18.21C5 19.2 5.8 20 6.79 20H9V19.5C9 18.12 10.12 17 11.5 17H14.5C14.78 17 15 17.22 15 17.5S14.78 18 14.5 18H11.5C10.67 18 10 18.67 10 19.5V20H17.21C18.2 20 19 19.2 19 18.21C19 17.5 18.55 16.82 17.88 16.55L14 15V12.75C15.81 14.83 18.23 16 21 16Z',\n },\n law: {\n id: 'scale-balance',\n path: 'M12,3C10.73,3 9.6,3.8 9.18,5H3V7H4.95L2,14C1.53,16 3,17 5.5,17C8,17 9.56,16 9,14L6.05,7H9.17C9.5,7.85 10.15,8.5 11,8.83V20H2V22H22V20H13V8.82C13.85,8.5 14.5,7.85 14.82,7H17.95L15,14C14.53,16 16,17 18.5,17C21,17 22.56,16 22,14L19.05,7H21V5H14.83C14.4,3.8 13.27,3 12,3M12,5A1,1 0 0,1 13,6A1,1 0 0,1 12,7A1,1 0 0,1 11,6A1,1 0 0,1 12,5M5.5,10.25L7,14H4L5.5,10.25M18.5,10.25L20,14H17L18.5,10.25Z',\n },\n roof: {\n id: 'home-roof',\n path: 'M19 16H22L12 7L2 16H5L12 9.69L19 16M7 8.81V7H4V11.5L7 8.81Z',\n },\n people: {\n id: 'account-group-outline',\n path: 'M12,5A3.5,3.5 0 0,0 8.5,8.5A3.5,3.5 0 0,0 12,12A3.5,3.5 0 0,0 15.5,8.5A3.5,3.5 0 0,0 12,5M12,7A1.5,1.5 0 0,1 13.5,8.5A1.5,1.5 0 0,1 12,10A1.5,1.5 0 0,1 10.5,8.5A1.5,1.5 0 0,1 12,7M5.5,8A2.5,2.5 0 0,0 3,10.5C3,11.44 3.53,12.25 4.29,12.68C4.65,12.88 5.06,13 5.5,13C5.94,13 6.35,12.88 6.71,12.68C7.08,12.47 7.39,12.17 7.62,11.81C6.89,10.86 6.5,9.7 6.5,8.5C6.5,8.41 6.5,8.31 6.5,8.22C6.2,8.08 5.86,8 5.5,8M18.5,8C18.14,8 17.8,8.08 17.5,8.22C17.5,8.31 17.5,8.41 17.5,8.5C17.5,9.7 17.11,10.86 16.38,11.81C16.5,12 16.63,12.15 16.78,12.3C16.94,12.45 17.1,12.58 17.29,12.68C17.65,12.88 18.06,13 18.5,13C18.94,13 19.35,12.88 19.71,12.68C20.47,12.25 21,11.44 21,10.5A2.5,2.5 0 0,0 18.5,8M12,14C9.66,14 5,15.17 5,17.5V19H19V17.5C19,15.17 14.34,14 12,14M4.71,14.55C2.78,14.78 0,15.76 0,17.5V19H3V17.07C3,16.06 3.69,15.22 4.71,14.55M19.29,14.55C20.31,15.22 21,16.06 21,17.07V19H24V17.5C24,15.76 21.22,14.78 19.29,14.55M12,16C13.53,16 15.24,16.5 16.23,17H7.77C8.76,16.5 10.47,16 12,16Z',\n },\n chat: {\n id: 'message-text-outline',\n path: 'M20,2A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H6L2,22V4C2,2.89 2.9,2 4,2H20M4,4V17.17L5.17,16H20V4H4M6,7H18V9H6V7M6,11H15V13H6V11Z',\n },\n fast: {\n id: 'lightning-bolt-outline',\n path: 'M11 9.47V11H14.76L13 14.53V13H9.24L11 9.47M13 1L6 15H11V23L18 9H13V1Z',\n },\n sparkle: {\n id: 'creation',\n path: 'M19,1L17.74,3.75L15,5L17.74,6.26L19,9L20.25,6.26L23,5L20.25,3.75M9,4L6.5,9.5L1,12L6.5,14.5L9,20L11.5,14.5L17,12L11.5,9.5M19,15L17.74,17.74L15,19L17.74,20.25L19,23L20.25,20.25L23,19L20.25,17.74',\n },\n care: {\n id: 'hand-heart-outline',\n path: 'M16 3.23C16.71 2.41 17.61 2 18.7 2C19.61 2 20.37 2.33 21 3C21.63 3.67 21.96 4.43 22 5.3C22 6 21.67 6.81 21 7.76S19.68 9.5 19.03 10.15C18.38 10.79 17.37 11.74 16 13C14.61 11.74 13.59 10.79 12.94 10.15S11.63 8.71 10.97 7.76C10.31 6.81 10 6 10 5.3C10 4.39 10.32 3.63 10.97 3C11.62 2.37 12.4 2.04 13.31 2C14.38 2 15.27 2.41 16 3.23M22 19V20L14 22.5L7 20.56V22H1V11H8.97L15.13 13.3C16.25 13.72 17 14.8 17 16H19C20.66 16 22 17.34 22 19M5 20V13H3V20H5M19.9 18.57C19.74 18.24 19.39 18 19 18H13.65C13.11 18 12.58 17.92 12.07 17.75L9.69 16.96L10.32 15.06L12.7 15.85C13 15.95 15 16 15 16C15 15.63 14.77 15.3 14.43 15.17L8.61 13H7V18.5L13.97 20.41L19.9 18.57Z',\n },\n award: {\n id: 'medal-outline',\n path: 'M14.94 19.5L12 17.77L9.06 19.5L9.84 16.16L7.25 13.92L10.66 13.63L12 10.5L13.34 13.63L16.75 13.92L14.16 16.16M20 2H4V4L8.86 7.64A8 8 0 1 0 15.14 7.64L20 4M18 15A6 6 0 1 1 10.82 9.12A5.86 5.86 0 0 1 13.18 9.12A6 6 0 0 1 18 15M12.63 7H11.37L7.37 4H16.71Z',\n },\n truck: {\n id: 'truck-outline',\n path: 'M18 18.5C18.83 18.5 19.5 17.83 19.5 17C19.5 16.17 18.83 15.5 18 15.5C17.17 15.5 16.5 16.17 16.5 17C16.5 17.83 17.17 18.5 18 18.5M19.5 9.5H17V12H21.46L19.5 9.5M6 18.5C6.83 18.5 7.5 17.83 7.5 17C7.5 16.17 6.83 15.5 6 15.5C5.17 15.5 4.5 16.17 4.5 17C4.5 17.83 5.17 18.5 6 18.5M20 8L23 12V17H21C21 18.66 19.66 20 18 20C16.34 20 15 18.66 15 17H9C9 18.66 7.66 20 6 20C4.34 20 3 18.66 3 17H1V6C1 4.89 1.89 4 3 4H17V8H20M3 6V15H3.76C4.31 14.39 5.11 14 6 14C6.89 14 7.69 14.39 8.24 15H15V6H3Z',\n },\n learn: {\n id: 'school-outline',\n path: 'M12 3L1 9L5 11.18V17.18L12 21L19 17.18V11.18L21 10.09V17H23V9L12 3M18.82 9L12 12.72L5.18 9L12 5.28L18.82 9M17 16L12 18.72L7 16V12.27L12 15L17 12.27V16Z',\n },\n camera: {\n id: 'camera-outline',\n path: 'M20,4H16.83L15,2H9L7.17,4H4A2,2 0 0,0 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6A2,2 0 0,0 20,4M20,18H4V6H8.05L9.88,4H14.12L15.95,6H20V18M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7M12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15Z',\n },\n design: {\n id: 'palette-outline',\n path: 'M12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2C17.5,2 22,6 22,11A6,6 0 0,1 16,17H14.2C13.9,17 13.7,17.2 13.7,17.5C13.7,17.6 13.8,17.7 13.8,17.8C14.2,18.3 14.4,18.9 14.4,19.5C14.5,20.9 13.4,22 12,22M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C12.3,20 12.5,19.8 12.5,19.5C12.5,19.3 12.4,19.2 12.4,19.1C12,18.6 11.8,18.1 11.8,17.5C11.8,16.1 12.9,15 14.3,15H16A4,4 0 0,0 20,11C20,7.1 16.4,4 12,4M6.5,10C7.3,10 8,10.7 8,11.5C8,12.3 7.3,13 6.5,13C5.7,13 5,12.3 5,11.5C5,10.7 5.7,10 6.5,10M9.5,6C10.3,6 11,6.7 11,7.5C11,8.3 10.3,9 9.5,9C8.7,9 8,8.3 8,7.5C8,6.7 8.7,6 9.5,6M14.5,6C15.3,6 16,6.7 16,7.5C16,8.3 15.3,9 14.5,9C13.7,9 13,8.3 13,7.5C13,6.7 13.7,6 14.5,6M17.5,10C18.3,10 19,10.7 19,11.5C19,12.3 18.3,13 17.5,13C16.7,13 16,12.3 16,11.5C16,10.7 16.7,10 17.5,10Z',\n },\n spa: {\n id: 'spa-outline',\n path: 'M15.5,9.63C14.21,10.32 13.03,11.2 12,12.26C10.97,11.19 9.79,10.31 8.5,9.63C8.74,6.86 9.92,4.14 12.06,2C14.18,4.12 15.31,6.84 15.5,9.63M12,15.45C14.15,12.17 17.82,10 22,10C22,20 12.68,21.88 12,22C11.32,21.89 2,20 2,10C6.18,10 9.85,12.17 12,15.45M12.05,5.19C11.39,6.23 10.93,7.38 10.68,8.58L12,9.55L13.35,8.57C13.12,7.37 12.68,6.22 12.05,5.19M12,19.97C12,19.97 18,19 19.74,12.25C14,14 12,19.1 12,19.1C12,19.1 9,13 4.26,12.26C6,19 12,19.97 12,19.97Z',\n },\n fitness: {\n id: 'dumbbell',\n path: 'M20.57,14.86L22,13.43L20.57,12L17,15.57L8.43,7L12,3.43L10.57,2L9.14,3.43L7.71,2L5.57,4.14L4.14,2.71L2.71,4.14L4.14,5.57L2,7.71L3.43,9.14L2,10.57L3.43,12L7,8.43L15.57,17L12,20.57L13.43,22L14.86,20.57L16.29,22L18.43,19.86L19.86,21.29L21.29,19.86L19.86,18.43L22,16.29L20.57,14.86Z',\n },\n phone: {\n id: 'phone-outline',\n path: 'M20,15.5C18.8,15.5 17.5,15.3 16.4,14.9C16.3,14.9 16.2,14.9 16.1,14.9C15.8,14.9 15.6,15 15.4,15.2L13.2,17.4C10.4,15.9 8,13.6 6.6,10.8L8.8,8.6C9.1,8.3 9.2,7.9 9,7.6C8.7,6.5 8.5,5.2 8.5,4C8.5,3.5 8,3 7.5,3H4C3.5,3 3,3.5 3,4C3,13.4 10.6,21 20,21C20.5,21 21,20.5 21,20V16.5C21,16 20.5,15.5 20,15.5M5,5H6.5C6.6,5.9 6.8,6.8 7,7.6L5.8,8.8C5.4,7.6 5.1,6.3 5,5M19,19C17.7,18.9 16.4,18.6 15.2,18.2L16.4,17C17.2,17.2 18.1,17.4 19,17.4V19Z',\n },\n mail: {\n id: 'email-outline',\n path: 'M22 6C22 4.9 21.1 4 20 4H4C2.9 4 2 4.9 2 6V18C2 19.1 2.9 20 4 20H20C21.1 20 22 19.1 22 18V6M20 6L12 11L4 6H20M20 18H4V8L12 13L20 8V18Z',\n },\n money: {\n id: 'cash-multiple',\n path: 'M5,6H23V18H5V6M14,9A3,3 0 0,1 17,12A3,3 0 0,1 14,15A3,3 0 0,1 11,12A3,3 0 0,1 14,9M9,8A2,2 0 0,1 7,10V14A2,2 0 0,1 9,16H19A2,2 0 0,1 21,14V10A2,2 0 0,1 19,8H9M1,10H3V20H19V22H1V10Z',\n },\n chart: {\n id: 'chart-line',\n path: 'M16,11.78L20.24,4.45L21.97,5.45L16.74,14.5L10.23,10.75L5.46,19H22V21H2V3H4V17.54L9.5,8L16,11.78Z',\n },\n lock: {\n id: 'lock-outline',\n path: 'M12,17C10.89,17 10,16.1 10,15C10,13.89 10.89,13 12,13A2,2 0 0,1 14,15A2,2 0 0,1 12,17M18,20V10H6V20H18M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V10C4,8.89 4.89,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z',\n },\n smile: {\n id: 'emoticon-happy-outline',\n path: 'M20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12M22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,12M10,9.5C10,10.3 9.3,11 8.5,11C7.7,11 7,10.3 7,9.5C7,8.7 7.7,8 8.5,8C9.3,8 10,8.7 10,9.5M17,9.5C17,10.3 16.3,11 15.5,11C14.7,11 14,10.3 14,9.5C14,8.7 14.7,8 15.5,8C16.3,8 17,8.7 17,9.5M12,17.23C10.25,17.23 8.71,16.5 7.81,15.42L9.23,14C9.68,14.72 10.75,15.23 12,15.23C13.25,15.23 14.32,14.72 14.77,14L16.19,15.42C15.29,16.5 13.75,17.23 12,17.23Z',\n },\n car: {\n id: 'car-outline',\n path: 'M18.9 6C18.7 5.4 18.1 5 17.5 5H6.5C5.8 5 5.3 5.4 5.1 6L3 12V20C3 20.5 3.5 21 4 21H5C5.6 21 6 20.5 6 20V19H18V20C18 20.5 18.5 21 19 21H20C20.5 21 21 20.5 21 20V12L18.9 6M6.8 7H17.1L18.2 10H5.8L6.8 7M19 17H5V12H19V17M7.5 13C8.3 13 9 13.7 9 14.5S8.3 16 7.5 16 6 15.3 6 14.5 6.7 13 7.5 13M16.5 13C17.3 13 18 13.7 18 14.5S17.3 16 16.5 16C15.7 16 15 15.3 15 14.5S15.7 13 16.5 13Z',\n },\n food: {\n id: 'silverware-fork-knife',\n path: 'M11,9H9V2H7V9H5V2H3V9C3,11.12 4.66,12.84 6.75,12.97V22H9.25V12.97C11.34,12.84 13,11.12 13,9V2H11V9M16,6V14H18.5V22H21V2C18.24,2 16,4.24 16,6Z',\n },\n cake: {\n id: 'cake-variant-outline',\n path: 'M12 6C13.11 6 14 5.1 14 4C14 3.62 13.9 3.27 13.71 2.97L12 0L10.29 2.97C10.1 3.27 10 3.62 10 4C10 5.1 10.9 6 12 6M18 9H13V7H11V9H6C4.34 9 3 10.34 3 12V21C3 21.55 3.45 22 4 22H20C20.55 22 21 21.55 21 21V12C21 10.34 19.66 9 18 9M19 20H5V17C5.9 17 6.76 16.63 7.4 16L8.5 14.92L9.56 16C10.87 17.3 13.15 17.29 14.45 16L15.53 14.92L16.6 16C17.24 16.63 18.1 17 19 17V20M19 15.5C18.5 15.5 18 15.3 17.65 14.93L15.5 12.8L13.38 14.93C12.64 15.67 11.35 15.67 10.61 14.93L8.5 12.8L6.34 14.93C6 15.29 5.5 15.5 5 15.5V12C5 11.45 5.45 11 6 11H18C18.55 11 19 11.45 19 12V15.5Z',\n },\n cut: {\n id: 'content-cut',\n path: 'M19,3L13,9L15,11L22,4V3M12,12.5A0.5,0.5 0 0,1 11.5,12A0.5,0.5 0 0,1 12,11.5A0.5,0.5 0 0,1 12.5,12A0.5,0.5 0 0,1 12,12.5M6,20A2,2 0 0,1 4,18C4,16.89 4.9,16 6,16A2,2 0 0,1 8,18C8,19.11 7.1,20 6,20M6,8A2,2 0 0,1 4,6C4,4.89 4.9,4 6,4A2,2 0 0,1 8,6C8,7.11 7.1,8 6,8M9.64,7.64C9.87,7.14 10,6.59 10,6A4,4 0 0,0 6,2A4,4 0 0,0 2,6A4,4 0 0,0 6,10C6.59,10 7.14,9.87 7.64,9.64L10,12L7.64,14.36C7.14,14.13 6.59,14 6,14A4,4 0 0,0 2,18A4,4 0 0,0 6,22A4,4 0 0,0 10,18C10,17.41 9.87,16.86 9.64,16.36L12,14L19,21H22V20L9.64,7.64Z',\n },\n brush: {\n id: 'brush-variant',\n path: 'M8 3C5.79 3 4 4.79 4 7V14C4 15.1 4.9 16 6 16H9V20C9 21.1 9.9 22 11 22H13C14.1 22 15 21.1 15 20V16H18C19.1 16 20 15.1 20 14V3H8M8 5H12V7H14V5H15V9H17V5H18V10H6V7C6 5.9 6.9 5 8 5M6 14V12H18V14H6Z',\n },\n hammer: {\n id: 'hammer-wrench',\n path: 'M13.78 15.3L19.78 21.3L21.89 19.14L15.89 13.14L13.78 15.3M17.5 10.1C17.11 10.1 16.69 10.05 16.36 9.91L4.97 21.25L2.86 19.14L10.27 11.74L8.5 9.96L7.78 10.66L6.33 9.25V12.11L5.63 12.81L2.11 9.25L2.81 8.55H5.62L4.22 7.14L7.78 3.58C8.95 2.41 10.83 2.41 12 3.58L9.89 5.74L11.3 7.14L10.59 7.85L12.38 9.63L14.2 7.75C14.06 7.42 14 7 14 6.63C14 4.66 15.56 3.11 17.5 3.11C18.09 3.11 18.61 3.25 19.08 3.53L16.41 6.2L17.91 7.7L20.58 5.03C20.86 5.5 21 6 21 6.63C21 8.55 19.45 10.1 17.5 10.1Z',\n },\n water: {\n id: 'water-outline',\n path: 'M12,3.77L11.25,4.61C11.25,4.61 9.97,6.06 8.68,7.94C7.39,9.82 6,12.07 6,14.23A6,6 0 0,0 12,20.23A6,6 0 0,0 18,14.23C18,12.07 16.61,9.82 15.32,7.94C14.03,6.06 12.75,4.61 12.75,4.61L12,3.77M12,6.9C12.44,7.42 12.84,7.85 13.68,9.07C14.89,10.83 16,13.07 16,14.23C16,16.45 14.22,18.23 12,18.23C9.78,18.23 8,16.45 8,14.23C8,13.07 9.11,10.83 10.32,9.07C11.16,7.85 11.56,7.42 12,6.9Z',\n },\n sun: {\n id: 'white-balance-sunny',\n path: 'M3.55,18.54L4.96,19.95L6.76,18.16L5.34,16.74M11,22.45C11.32,22.45 13,22.45 13,22.45V19.5H11M12,5.5A6,6 0 0,0 6,11.5A6,6 0 0,0 12,17.5A6,6 0 0,0 18,11.5C18,8.18 15.31,5.5 12,5.5M20,12.5H23V10.5H20M17.24,18.16L19.04,19.95L20.45,18.54L18.66,16.74M20.45,4.46L19.04,3.05L17.24,4.84L18.66,6.26M13,0.55H11V3.5H13M4,10.5H1V12.5H4M6.76,4.84L4.96,3.05L3.55,4.46L5.34,6.26L6.76,4.84Z',\n },\n book: {\n id: 'book-open-page-variant-outline',\n path: 'M19 1L14 6V17L19 12.5V1M21 5V18.5C19.9 18.15 18.7 18 17.5 18C15.8 18 13.35 18.65 12 19.5V6C10.55 4.9 8.45 4.5 6.5 4.5C4.55 4.5 2.45 4.9 1 6V20.65C1 20.9 1.25 21.15 1.5 21.15C1.6 21.15 1.65 21.1 1.75 21.1C3.1 20.45 5.05 20 6.5 20C8.45 20 10.55 20.4 12 21.5C13.35 20.65 15.8 20 17.5 20C19.15 20 20.85 20.3 22.25 21.05C22.35 21.1 22.4 21.1 22.5 21.1C22.75 21.1 23 20.85 23 20.6V6C22.4 5.55 21.75 5.25 21 5M10 18.41C8.75 18.09 7.5 18 6.5 18C5.44 18 4.18 18.19 3 18.5V7.13C3.91 6.73 5.14 6.5 6.5 6.5C7.86 6.5 9.09 6.73 10 7.13V18.41Z',\n },\n briefcase: {\n id: 'briefcase-outline',\n path: 'M20,6C20.58,6 21.05,6.2 21.42,6.59C21.8,7 22,7.45 22,8V19C22,19.55 21.8,20 21.42,20.41C21.05,20.8 20.58,21 20,21H4C3.42,21 2.95,20.8 2.58,20.41C2.2,20 2,19.55 2,19V8C2,7.45 2.2,7 2.58,6.59C2.95,6.2 3.42,6 4,6H8V4C8,3.42 8.2,2.95 8.58,2.58C8.95,2.2 9.42,2 10,2H14C14.58,2 15.05,2.2 15.42,2.58C15.8,2.95 16,3.42 16,4V6H20M4,8V19H20V8H4M14,6V4H10V6H14Z',\n },\n gift: {\n id: 'gift-outline',\n path: 'M22,12V20A2,2 0 0,1 20,22H4A2,2 0 0,1 2,20V12A1,1 0 0,1 1,11V8A2,2 0 0,1 3,6H6.17C6.06,5.69 6,5.35 6,5A3,3 0 0,1 9,2C10,2 10.88,2.5 11.43,3.24V3.23L12,4L12.57,3.23V3.24C13.12,2.5 14,2 15,2A3,3 0 0,1 18,5C18,5.35 17.94,5.69 17.83,6H21A2,2 0 0,1 23,8V11A1,1 0 0,1 22,12M4,20H11V12H4V20M20,20V12H13V20H20M9,4A1,1 0 0,0 8,5A1,1 0 0,0 9,6A1,1 0 0,0 10,5A1,1 0 0,0 9,4M15,4A1,1 0 0,0 14,5A1,1 0 0,0 15,6A1,1 0 0,0 16,5A1,1 0 0,0 15,4M3,8V10H11V8H3M13,8V10H21V8H13Z',\n },\n music: {\n id: 'music-note-outline',\n path: 'M12 3V13.55A4 4 0 1 0 14 17V7H18V3M10 19A2 2 0 1 1 12 17A2 2 0 0 1 10 19Z',\n },\n plant: {\n id: 'sprout-outline',\n path: 'M23,4.1V2.3L21.2,2.1C21.1,2.1 20.5,2 19.5,2C15.4,2 12.4,3.2 10.7,5.3C9.4,4.5 7.6,4 5.5,4C4.5,4 3.8,4.1 3.8,4.1L1.9,4.4L2,6.1C2.1,9.1 3.6,14.8 8.8,14.8C8.9,14.8 8.9,14.8 9,14.8V18.2C5.2,18.7 2,20 2,20V22H22V20C22,20 18.8,18.7 15,18.2V15C21.3,14.9 23,7.8 23,4.1M12,18C11.7,18 11.3,18 11,18V12.4C11,12.4 10.8,9 8,9C8,9 9.5,9.8 9.9,12.7C9.5,12.8 9.1,12.8 8.8,12.8C4.2,12.8 4,6.1 4,6.1C4,6.1 4.6,6 5.5,6C7.4,6 10.5,6.4 11.4,9.1C11.9,4.6 17,4 19.5,4C20.4,4 21,4.1 21,4.1C21,4.1 21,13.1 14.7,13.1C14.5,13.1 14.2,13.1 14,13.1C14,11.1 16,8.1 16,8.1C13,9.1 13,13 13,13V18C12.7,18 12.3,18 12,18Z',\n },\n medical: {\n id: 'medical-bag',\n path: 'M10,3L8,5V7H5C3.85,7 3.12,8 3,9L2,19C1.88,20 2.54,21 4,21H20C21.46,21 22.12,20 22,19L21,9C20.88,8 20.06,7 19,7H16V5L14,3H10M10,5H14V7H10V5M11,10H13V13H16V15H13V18H11V15H8V13H11V10Z',\n },\n recycle: {\n id: 'recycle',\n path: 'M21.82,15.42L19.32,19.75C18.83,20.61 17.92,21.06 17,21H15V23L12.5,18.5L15,14V16H17.82L15.6,12.15L19.93,9.65L21.73,12.77C22.25,13.54 22.32,14.57 21.82,15.42M9.21,3.06H14.21C15.19,3.06 16.04,3.63 16.45,4.45L17.45,6.19L19.18,5.19L16.54,9.6L11.39,9.69L13.12,8.69L11.71,6.24L9.5,10.09L5.16,7.59L6.96,4.47C7.37,3.64 8.22,3.06 9.21,3.06M5.05,19.76L2.55,15.43C2.06,14.58 2.13,13.56 2.64,12.79L3.64,11.06L1.91,10.06L7.05,10.14L9.7,14.56L7.97,13.56L6.56,16H11V21H7.4C6.47,21.07 5.55,20.61 5.05,19.76Z',\n },\n globe: {\n id: 'earth',\n path: 'M17.9,17.39C17.64,16.59 16.89,16 16,16H15V13A1,1 0 0,0 14,12H8V10H10A1,1 0 0,0 11,9V7H13A2,2 0 0,0 15,5V4.59C17.93,5.77 20,8.64 20,12C20,14.08 19.2,15.97 17.9,17.39M11,19.93C7.05,19.44 4,16.08 4,12C4,11.38 4.08,10.78 4.21,10.21L9,15V16A2,2 0 0,0 11,18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z',\n },\n idea: {\n id: 'lightbulb-on-outline',\n path: 'M20,11H23V13H20V11M1,11H4V13H1V11M13,1V4H11V1H13M4.92,3.5L7.05,5.64L5.63,7.05L3.5,4.93L4.92,3.5M16.95,5.63L19.07,3.5L20.5,4.93L18.37,7.05L16.95,5.63M12,6A6,6 0 0,1 18,12C18,14.22 16.79,16.16 15,17.2V19A1,1 0 0,1 14,20H10A1,1 0 0,1 9,19V17.2C7.21,16.16 6,14.22 6,12A6,6 0 0,1 12,6M14,21V22A1,1 0 0,1 13,23H11A1,1 0 0,1 10,22V21H14M11,18H13V15.87C14.73,15.43 16,13.86 16,12A4,4 0 0,0 12,8A4,4 0 0,0 8,12C8,13.86 9.27,15.43 11,15.87V18Z',\n },\n quote: {\n id: 'format-quote-open',\n path: 'M10,7L8,11H11V17H5V11L7,7H10M18,7L16,11H19V17H13V11L15,7H18Z',\n },\n} as const satisfies Record<string, AiIconLibraryEntry>\n\n/**\n * Icons the compiler draws from what an item says (AGL-4065) — the languages\n * a business works in, a race, a sponsor or a partner, a price or an\n * estimate — that the language's schema does not list for the model: a word\n * added to the schema is a word in every cached page and frame prompt, and\n * these are the compiler's to pick (`aiStorefrontItemIcons`). A stored id of\n * one is read back like any other (`aiIconOfId`).\n */\nexport const AI_ICON_DRAWN = {\n translate: {\n id: 'translate',\n path: 'M12.87,15.07L10.33,12.56L10.36,12.53C12.1,10.59 13.34,8.36 14.07,6H17V4H10V2H8V4H1V6H12.17C11.5,7.92 10.44,9.75 9,11.35C8.07,10.32 7.3,9.19 6.69,8H4.69C5.42,9.63 6.42,11.17 7.67,12.56L2.58,17.58L4,19L9,14L12.11,17.11L12.87,15.07M18.5,10H16.5L12,22H14L15.12,19H19.87L21,22H23L18.5,10M15.88,17L17.5,12.67L19.12,17H15.88Z',\n },\n flag: {\n id: 'flag-checkered',\n path: 'M14.4,6H20V16H13L12.6,14H7V21H5V4H14L14.4,6M14,14H16V12H18V10H16V8H14V10L13,8V6H11V8H9V6H7V8H9V10H7V12H9V10H11V12H13V10L14,12V14M11,10V8H13V10H11M14,10H16V12H14V10Z',\n },\n handshake: {\n id: 'handshake-outline',\n path: 'M21.71 8.71C22.96 7.46 22.39 6 21.71 5.29L18.71 2.29C17.45 1.04 16 1.61 15.29 2.29L13.59 4H11C9.1 4 8 5 7.44 6.15L3 10.59V14.59L2.29 15.29C1.04 16.55 1.61 18 2.29 18.71L5.29 21.71C5.83 22.25 6.41 22.45 6.96 22.45C7.67 22.45 8.32 22.1 8.71 21.71L11.41 19H15C16.7 19 17.56 17.94 17.87 16.9C19 16.6 19.62 15.74 19.87 14.9C21.42 14.5 22 13.03 22 12V9H21.41L21.71 8.71M20 12C20 12.45 19.81 13 19 13L18 13L18 14C18 14.45 17.81 15 17 15L16 15L16 16C16 16.45 15.81 17 15 17H10.59L7.31 20.28C7 20.57 6.82 20.4 6.71 20.29L3.72 17.31C3.43 17 3.6 16.82 3.71 16.71L5 15.41V11.41L7 9.41V11C7 12.21 7.8 14 10 14S13 12.21 13 11H20V12M20.29 7.29L18.59 9H11V11C11 11.45 10.81 12 10 12S9 11.45 9 11V8C9 7.54 9.17 6 11 6H14.41L16.69 3.72C17 3.43 17.18 3.6 17.29 3.71L20.28 6.69C20.57 7 20.4 7.18 20.29 7.29Z',\n },\n receipt: {\n id: 'receipt',\n path: 'M3,22L4.5,20.5L6,22L7.5,20.5L9,22L10.5,20.5L12,22L13.5,20.5L15,22L16.5,20.5L18,22L19.5,20.5L21,22V2L19.5,3.5L18,2L16.5,3.5L15,2L13.5,3.5L12,2L10.5,3.5L9,2L7.5,3.5L6,2L4.5,3.5L3,2M18,9H6V7H18M18,13H6V11H18M18,17H6V15H18V17Z',\n },\n} as const satisfies Record<string, AiIconLibraryEntry>\n\n/** A word the layout language may name an icon by. */\nexport type AiIconWord = keyof typeof AI_ICON_LIBRARY\n\n/** Every icon word, in the order the schema lists them. */\nexport const AI_ICON_WORDS = Object.keys(AI_ICON_LIBRARY) as AiIconWord[]\n\n/** Every icon the platform's code draws: the schema's words and the compiler's own. */\nconst ALL_ICONS: Readonly<Record<string, AiIconLibraryEntry>> = { ...AI_ICON_LIBRARY, ...AI_ICON_DRAWN }\n\nconst BY_ID: ReadonlyMap<string, AiIconLibraryEntry> = new Map(\n Object.values(ALL_ICONS).map((entry) => [entry.id, entry]),\n)\n\n/** The library entry an icon word names, the schema's or the compiler's own; `null` for any other value. */\nexport function aiIconOfWord(word: unknown): AiIconLibraryEntry | null {\n return typeof word === 'string' &&\n Object.prototype.hasOwnProperty.call(ALL_ICONS, word)\n ? (ALL_ICONS[word] as AiIconLibraryEntry)\n : null\n}\n\n/** The library entry a stored icon id names; `null` for an id the library does not hold. */\nexport function aiIconOfId(id: unknown): AiIconLibraryEntry | null {\n return typeof id === 'string' ? (BY_ID.get(id) ?? null) : null\n}\n"],"names":["AI_ICON_COMPONENT_ID","AI_ICON_LIBRARY","check","id","path","star","heart","clock","calendar","location","shield","leaf","home","tools","paw","tooth","coffee","yoga","law","roof","people","chat","fast","sparkle","care","award","truck","learn","camera","design","spa","fitness","phone","mail","money","chart","lock","smile","car","food","cake","cut","brush","hammer","water","sun","book","briefcase","gift","music","plant","medical","recycle","globe","idea","quote","AI_ICON_DRAWN","translate","flag","handshake","receipt","AI_ICON_WORDS","Object","keys","ALL_ICONS","BY_ID","Map","values","map","entry","aiIconOfWord","word","prototype","hasOwnProperty","call","aiIconOfId","get"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;CAcC,GAED,+CAA+C,GAC/C,OAAO,MAAMA,uBAAuB,OAAM;AAS1C,OAAO,MAAMC,kBAAkB;IAC7BC,OAAO;QACLC,IAAI;QACJC,MAAM;IACR;IACAC,MAAM;QACJF,IAAI;QACJC,MAAM;IACR;IACAE,OAAO;QACLH,IAAI;QACJC,MAAM;IACR;IACAG,OAAO;QACLJ,IAAI;QACJC,MAAM;IACR;IACAI,UAAU;QACRL,IAAI;QACJC,MAAM;IACR;IACAK,UAAU;QACRN,IAAI;QACJC,MAAM;IACR;IACAM,QAAQ;QACNP,IAAI;QACJC,MAAM;IACR;IACAO,MAAM;QACJR,IAAI;QACJC,MAAM;IACR;IACAQ,MAAM;QACJT,IAAI;QACJC,MAAM;IACR;IACAS,OAAO;QACLV,IAAI;QACJC,MAAM;IACR;IACAU,KAAK;QACHX,IAAI;QACJC,MAAM;IACR;IACAW,OAAO;QACLZ,IAAI;QACJC,MAAM;IACR;IACAY,QAAQ;QACNb,IAAI;QACJC,MAAM;IACR;IACAa,MAAM;QACJd,IAAI;QACJC,MAAM;IACR;IACAc,KAAK;QACHf,IAAI;QACJC,MAAM;IACR;IACAe,MAAM;QACJhB,IAAI;QACJC,MAAM;IACR;IACAgB,QAAQ;QACNjB,IAAI;QACJC,MAAM;IACR;IACAiB,MAAM;QACJlB,IAAI;QACJC,MAAM;IACR;IACAkB,MAAM;QACJnB,IAAI;QACJC,MAAM;IACR;IACAmB,SAAS;QACPpB,IAAI;QACJC,MAAM;IACR;IACAoB,MAAM;QACJrB,IAAI;QACJC,MAAM;IACR;IACAqB,OAAO;QACLtB,IAAI;QACJC,MAAM;IACR;IACAsB,OAAO;QACLvB,IAAI;QACJC,MAAM;IACR;IACAuB,OAAO;QACLxB,IAAI;QACJC,MAAM;IACR;IACAwB,QAAQ;QACNzB,IAAI;QACJC,MAAM;IACR;IACAyB,QAAQ;QACN1B,IAAI;QACJC,MAAM;IACR;IACA0B,KAAK;QACH3B,IAAI;QACJC,MAAM;IACR;IACA2B,SAAS;QACP5B,IAAI;QACJC,MAAM;IACR;IACA4B,OAAO;QACL7B,IAAI;QACJC,MAAM;IACR;IACA6B,MAAM;QACJ9B,IAAI;QACJC,MAAM;IACR;IACA8B,OAAO;QACL/B,IAAI;QACJC,MAAM;IACR;IACA+B,OAAO;QACLhC,IAAI;QACJC,MAAM;IACR;IACAgC,MAAM;QACJjC,IAAI;QACJC,MAAM;IACR;IACAiC,OAAO;QACLlC,IAAI;QACJC,MAAM;IACR;IACAkC,KAAK;QACHnC,IAAI;QACJC,MAAM;IACR;IACAmC,MAAM;QACJpC,IAAI;QACJC,MAAM;IACR;IACAoC,MAAM;QACJrC,IAAI;QACJC,MAAM;IACR;IACAqC,KAAK;QACHtC,IAAI;QACJC,MAAM;IACR;IACAsC,OAAO;QACLvC,IAAI;QACJC,MAAM;IACR;IACAuC,QAAQ;QACNxC,IAAI;QACJC,MAAM;IACR;IACAwC,OAAO;QACLzC,IAAI;QACJC,MAAM;IACR;IACAyC,KAAK;QACH1C,IAAI;QACJC,MAAM;IACR;IACA0C,MAAM;QACJ3C,IAAI;QACJC,MAAM;IACR;IACA2C,WAAW;QACT5C,IAAI;QACJC,MAAM;IACR;IACA4C,MAAM;QACJ7C,IAAI;QACJC,MAAM;IACR;IACA6C,OAAO;QACL9C,IAAI;QACJC,MAAM;IACR;IACA8C,OAAO;QACL/C,IAAI;QACJC,MAAM;IACR;IACA+C,SAAS;QACPhD,IAAI;QACJC,MAAM;IACR;IACAgD,SAAS;QACPjD,IAAI;QACJC,MAAM;IACR;IACAiD,OAAO;QACLlD,IAAI;QACJC,MAAM;IACR;IACAkD,MAAM;QACJnD,IAAI;QACJC,MAAM;IACR;IACAmD,OAAO;QACLpD,IAAI;QACJC,MAAM;IACR;AACF,EAAuD;AAEvD;;;;;;;CAOC,GACD,OAAO,MAAMoD,gBAAgB;IAC3BC,WAAW;QACTtD,IAAI;QACJC,MAAM;IACR;IACAsD,MAAM;QACJvD,IAAI;QACJC,MAAM;IACR;IACAuD,WAAW;QACTxD,IAAI;QACJC,MAAM;IACR;IACAwD,SAAS;QACPzD,IAAI;QACJC,MAAM;IACR;AACF,EAAuD;AAKvD,yDAAyD,GACzD,OAAO,MAAMyD,gBAAgBC,OAAOC,IAAI,CAAC9D,iBAAgC;AAEzE,qFAAqF,GACrF,MAAM+D,YAA0D,aAAK/D,iBAAoBuD;AAEzF,MAAMS,QAAiD,IAAIC,IACzDJ,OAAOK,MAAM,CAACH,WAAWI,GAAG,CAAC,CAACC,QAAU;QAACA,MAAMlE,EAAE;QAAEkE;KAAM;AAG3D,0GAA0G,GAC1G,OAAO,SAASC,aAAaC,IAAa;IACxC,OAAO,OAAOA,SAAS,YACrBT,OAAOU,SAAS,CAACC,cAAc,CAACC,IAAI,CAACV,WAAWO,QAC7CP,SAAS,CAACO,KAAK,GAChB;AACN;AAEA,0FAA0F,GAC1F,OAAO,SAASI,WAAWxE,EAAW;QACH8D;IAAjC,OAAO,OAAO9D,OAAO,YAAY8D,aAAAA,MAAMW,GAAG,CAACzE,eAAV8D,aAAiB,OAAQ;AAC5D"}
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/runtime/ai-icon-library.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The icons a page built by the platform's own code may draw (AGL-3660).\n *\n * An icon element draws the path its picker stores beside the id, which a\n * model can never supply, so a tree a model writes keeps no icon\n * (`ai-node-tree.ts` drops the id). The layout language compiler is code: the\n * model names one of these by its word, and the compiler writes the Material\n * Design Icons id and the path copied here, exactly as the icon picker stores\n * them — so the published page draws it without loading the icon catalog.\n *\n * Paths are Material Design Icons 6.5.95 (Apache-2.0), the same set the\n * picker offers (`@aglyn/shared-data-mdi`). The words are the vocabulary the\n * language's schema enumerates; a word added here is a word the model may\n * write.\n */\n\n/** The palette element an icon is drawn with. */\nexport const AI_ICON_COMPONENT_ID = 'icon'\n\nexport interface AiIconLibraryEntry {\n /** The id the icon picker stores. */\n id: string\n /** The SVG path the picker stores beside it. */\n path: string\n}\n\nexport const AI_ICON_LIBRARY = {\n check: {\n id: 'check-circle-outline',\n path: 'M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M12 20C7.59 20 4 16.41 4 12S7.59 4 12 4 20 7.59 20 12 16.41 20 12 20M16.59 7.58L10 14.17L7.41 11.59L6 13L10 17L18 9L16.59 7.58Z',\n },\n star: {\n id: 'star-outline',\n path: 'M12,15.39L8.24,17.66L9.23,13.38L5.91,10.5L10.29,10.13L12,6.09L13.71,10.13L18.09,10.5L14.77,13.38L15.76,17.66M22,9.24L14.81,8.63L12,2L9.19,8.63L2,9.24L7.45,13.97L5.82,21L12,17.27L18.18,21L16.54,13.97L22,9.24Z',\n },\n heart: {\n id: 'heart-outline',\n path: 'M12.1,18.55L12,18.65L11.89,18.55C7.14,14.24 4,11.39 4,8.5C4,6.5 5.5,5 7.5,5C9.04,5 10.54,6 11.07,7.36H12.93C13.46,6 14.96,5 16.5,5C18.5,5 20,6.5 20,8.5C20,11.39 16.86,14.24 12.1,18.55M16.5,3C14.76,3 13.09,3.81 12,5.08C10.91,3.81 9.24,3 7.5,3C4.42,3 2,5.41 2,8.5C2,12.27 5.4,15.36 10.55,20.03L12,21.35L13.45,20.03C18.6,15.36 22,12.27 22,8.5C22,5.41 19.58,3 16.5,3Z',\n },\n clock: {\n id: 'clock-outline',\n path: 'M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z',\n },\n calendar: {\n id: 'calendar-check-outline',\n path: 'M19,4H18V2H16V4H8V2H6V4H5A2,2 0 0,0 3,6V20A2,2 0 0,0 5,22H19A2,2 0 0,0 21,20V6A2,2 0 0,0 19,4M19,20H5V10H19V20M5,8V6H19V8H5M10.56,18.46L16.5,12.53L15.43,11.47L10.56,16.34L8.45,14.23L7.39,15.29L10.56,18.46Z',\n },\n location: {\n id: 'map-marker-outline',\n path: 'M12,6.5A2.5,2.5 0 0,1 14.5,9A2.5,2.5 0 0,1 12,11.5A2.5,2.5 0 0,1 9.5,9A2.5,2.5 0 0,1 12,6.5M12,2A7,7 0 0,1 19,9C19,14.25 12,22 12,22C12,22 5,14.25 5,9A7,7 0 0,1 12,2M12,4A5,5 0 0,0 7,9C7,10 7,12 12,18.71C17,12 17,10 17,9A5,5 0 0,0 12,4Z',\n },\n shield: {\n id: 'shield-check-outline',\n path: 'M21,11C21,16.55 17.16,21.74 12,23C6.84,21.74 3,16.55 3,11V5L12,1L21,5V11M12,21C15.75,20 19,15.54 19,11.22V6.3L12,3.18L5,6.3V11.22C5,15.54 8.25,20 12,21M10,17L6,13L7.41,11.59L10,14.17L16.59,7.58L18,9',\n },\n leaf: {\n id: 'leaf',\n path: 'M17,8C8,10 5.9,16.17 3.82,21.34L5.71,22L6.66,19.7C7.14,19.87 7.64,20 8,20C19,20 22,3 22,3C21,5 14,5.25 9,6.25C4,7.25 2,11.5 2,13.5C2,15.5 3.75,17.25 3.75,17.25C7,8 17,8 17,8Z',\n },\n home: {\n id: 'home-outline',\n path: 'M12 5.69L17 10.19V18H15V12H9V18H7V10.19L12 5.69M12 3L2 12H5V20H11V14H13V20H19V12H22L12 3Z',\n },\n tools: {\n id: 'tools',\n path: 'M21.71 20.29L20.29 21.71A1 1 0 0 1 18.88 21.71L7 9.85A3.81 3.81 0 0 1 6 10A4 4 0 0 1 2.22 4.7L4.76 7.24L5.29 6.71L6.71 5.29L7.24 4.76L4.7 2.22A4 4 0 0 1 10 6A3.81 3.81 0 0 1 9.85 7L21.71 18.88A1 1 0 0 1 21.71 20.29M2.29 18.88A1 1 0 0 0 2.29 20.29L3.71 21.71A1 1 0 0 0 5.12 21.71L10.59 16.25L7.76 13.42M20 2L16 4V6L13.83 8.17L15.83 10.17L18 8H20L22 4Z',\n },\n paw: {\n id: 'paw',\n path: 'M8.35,3C9.53,2.83 10.78,4.12 11.14,5.9C11.5,7.67 10.85,9.25 9.67,9.43C8.5,9.61 7.24,8.32 6.87,6.54C6.5,4.77 7.17,3.19 8.35,3M15.5,3C16.69,3.19 17.35,4.77 17,6.54C16.62,8.32 15.37,9.61 14.19,9.43C13,9.25 12.35,7.67 12.72,5.9C13.08,4.12 14.33,2.83 15.5,3M3,7.6C4.14,7.11 5.69,8 6.5,9.55C7.26,11.13 7,12.79 5.87,13.28C4.74,13.77 3.2,12.89 2.41,11.32C1.62,9.75 1.9,8.08 3,7.6M21,7.6C22.1,8.08 22.38,9.75 21.59,11.32C20.8,12.89 19.26,13.77 18.13,13.28C17,12.79 16.74,11.13 17.5,9.55C18.31,8 19.86,7.11 21,7.6M19.33,18.38C19.37,19.32 18.65,20.36 17.79,20.75C16,21.57 13.88,19.87 11.89,19.87C9.9,19.87 7.76,21.64 6,20.75C5,20.26 4.31,18.96 4.44,17.88C4.62,16.39 6.41,15.59 7.47,14.5C8.88,13.09 9.88,10.44 11.89,10.44C13.89,10.44 14.95,13.05 16.3,14.5C17.41,15.72 19.26,16.75 19.33,18.38Z',\n },\n tooth: {\n id: 'tooth-outline',\n path: 'M7,2C4,2 2,5 2,8C2,10.11 3,13 4,14C5,15 6,22 8,22C12.54,22 10,15 12,15C14,15 11.46,22 16,22C18,22 19,15 20,14C21,13 22,10.11 22,8C22,5 20,2 17,2C14,2 14,3 12,3C10,3 10,2 7,2M7,4C9,4 10,5 12,5C14,5 15,4 17,4C18.67,4 20,6 20,8C20,9.75 19.14,12.11 18.19,13.06C17.33,13.92 16.06,19.94 15.5,19.94C15.29,19.94 15,18.88 15,17.59C15,15.55 14.43,13 12,13C9.57,13 9,15.55 9,17.59C9,18.88 8.71,19.94 8.5,19.94C7.94,19.94 6.67,13.92 5.81,13.06C4.86,12.11 4,9.75 4,8C4,6 5.33,4 7,4Z',\n },\n coffee: {\n id: 'coffee-outline',\n path: 'M2,21V19H20V21H2M20,8V5H18V8H20M20,3A2,2 0 0,1 22,5V8A2,2 0 0,1 20,10H18V13A4,4 0 0,1 14,17H8A4,4 0 0,1 4,13V3H20M16,5H6V13A2,2 0 0,0 8,15H14A2,2 0 0,0 16,13V5Z',\n },\n yoga: {\n id: 'meditation',\n path: 'M12 4C13.11 4 14 4.89 14 6S13.11 8 12 8 10 7.11 10 6 10.9 4 12 4M21 16V14C18.76 14 16.84 13.04 15.4 11.32L14.06 9.72C13.68 9.26 13.12 9 12.53 9H11.5C10.89 9 10.33 9.26 9.95 9.72L8.61 11.32C7.16 13.04 5.24 14 3 14V16C5.77 16 8.19 14.83 10 12.75V15L6.12 16.55C5.45 16.82 5 17.5 5 18.21C5 19.2 5.8 20 6.79 20H9V19.5C9 18.12 10.12 17 11.5 17H14.5C14.78 17 15 17.22 15 17.5S14.78 18 14.5 18H11.5C10.67 18 10 18.67 10 19.5V20H17.21C18.2 20 19 19.2 19 18.21C19 17.5 18.55 16.82 17.88 16.55L14 15V12.75C15.81 14.83 18.23 16 21 16Z',\n },\n law: {\n id: 'scale-balance',\n path: 'M12,3C10.73,3 9.6,3.8 9.18,5H3V7H4.95L2,14C1.53,16 3,17 5.5,17C8,17 9.56,16 9,14L6.05,7H9.17C9.5,7.85 10.15,8.5 11,8.83V20H2V22H22V20H13V8.82C13.85,8.5 14.5,7.85 14.82,7H17.95L15,14C14.53,16 16,17 18.5,17C21,17 22.56,16 22,14L19.05,7H21V5H14.83C14.4,3.8 13.27,3 12,3M12,5A1,1 0 0,1 13,6A1,1 0 0,1 12,7A1,1 0 0,1 11,6A1,1 0 0,1 12,5M5.5,10.25L7,14H4L5.5,10.25M18.5,10.25L20,14H17L18.5,10.25Z',\n },\n roof: {\n id: 'home-roof',\n path: 'M19 16H22L12 7L2 16H5L12 9.69L19 16M7 8.81V7H4V11.5L7 8.81Z',\n },\n people: {\n id: 'account-group-outline',\n path: 'M12,5A3.5,3.5 0 0,0 8.5,8.5A3.5,3.5 0 0,0 12,12A3.5,3.5 0 0,0 15.5,8.5A3.5,3.5 0 0,0 12,5M12,7A1.5,1.5 0 0,1 13.5,8.5A1.5,1.5 0 0,1 12,10A1.5,1.5 0 0,1 10.5,8.5A1.5,1.5 0 0,1 12,7M5.5,8A2.5,2.5 0 0,0 3,10.5C3,11.44 3.53,12.25 4.29,12.68C4.65,12.88 5.06,13 5.5,13C5.94,13 6.35,12.88 6.71,12.68C7.08,12.47 7.39,12.17 7.62,11.81C6.89,10.86 6.5,9.7 6.5,8.5C6.5,8.41 6.5,8.31 6.5,8.22C6.2,8.08 5.86,8 5.5,8M18.5,8C18.14,8 17.8,8.08 17.5,8.22C17.5,8.31 17.5,8.41 17.5,8.5C17.5,9.7 17.11,10.86 16.38,11.81C16.5,12 16.63,12.15 16.78,12.3C16.94,12.45 17.1,12.58 17.29,12.68C17.65,12.88 18.06,13 18.5,13C18.94,13 19.35,12.88 19.71,12.68C20.47,12.25 21,11.44 21,10.5A2.5,2.5 0 0,0 18.5,8M12,14C9.66,14 5,15.17 5,17.5V19H19V17.5C19,15.17 14.34,14 12,14M4.71,14.55C2.78,14.78 0,15.76 0,17.5V19H3V17.07C3,16.06 3.69,15.22 4.71,14.55M19.29,14.55C20.31,15.22 21,16.06 21,17.07V19H24V17.5C24,15.76 21.22,14.78 19.29,14.55M12,16C13.53,16 15.24,16.5 16.23,17H7.77C8.76,16.5 10.47,16 12,16Z',\n },\n chat: {\n id: 'message-text-outline',\n path: 'M20,2A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H6L2,22V4C2,2.89 2.9,2 4,2H20M4,4V17.17L5.17,16H20V4H4M6,7H18V9H6V7M6,11H15V13H6V11Z',\n },\n fast: {\n id: 'lightning-bolt-outline',\n path: 'M11 9.47V11H14.76L13 14.53V13H9.24L11 9.47M13 1L6 15H11V23L18 9H13V1Z',\n },\n sparkle: {\n id: 'creation',\n path: 'M19,1L17.74,3.75L15,5L17.74,6.26L19,9L20.25,6.26L23,5L20.25,3.75M9,4L6.5,9.5L1,12L6.5,14.5L9,20L11.5,14.5L17,12L11.5,9.5M19,15L17.74,17.74L15,19L17.74,20.25L19,23L20.25,20.25L23,19L20.25,17.74',\n },\n care: {\n id: 'hand-heart-outline',\n path: 'M16 3.23C16.71 2.41 17.61 2 18.7 2C19.61 2 20.37 2.33 21 3C21.63 3.67 21.96 4.43 22 5.3C22 6 21.67 6.81 21 7.76S19.68 9.5 19.03 10.15C18.38 10.79 17.37 11.74 16 13C14.61 11.74 13.59 10.79 12.94 10.15S11.63 8.71 10.97 7.76C10.31 6.81 10 6 10 5.3C10 4.39 10.32 3.63 10.97 3C11.62 2.37 12.4 2.04 13.31 2C14.38 2 15.27 2.41 16 3.23M22 19V20L14 22.5L7 20.56V22H1V11H8.97L15.13 13.3C16.25 13.72 17 14.8 17 16H19C20.66 16 22 17.34 22 19M5 20V13H3V20H5M19.9 18.57C19.74 18.24 19.39 18 19 18H13.65C13.11 18 12.58 17.92 12.07 17.75L9.69 16.96L10.32 15.06L12.7 15.85C13 15.95 15 16 15 16C15 15.63 14.77 15.3 14.43 15.17L8.61 13H7V18.5L13.97 20.41L19.9 18.57Z',\n },\n award: {\n id: 'medal-outline',\n path: 'M14.94 19.5L12 17.77L9.06 19.5L9.84 16.16L7.25 13.92L10.66 13.63L12 10.5L13.34 13.63L16.75 13.92L14.16 16.16M20 2H4V4L8.86 7.64A8 8 0 1 0 15.14 7.64L20 4M18 15A6 6 0 1 1 10.82 9.12A5.86 5.86 0 0 1 13.18 9.12A6 6 0 0 1 18 15M12.63 7H11.37L7.37 4H16.71Z',\n },\n truck: {\n id: 'truck-outline',\n path: 'M18 18.5C18.83 18.5 19.5 17.83 19.5 17C19.5 16.17 18.83 15.5 18 15.5C17.17 15.5 16.5 16.17 16.5 17C16.5 17.83 17.17 18.5 18 18.5M19.5 9.5H17V12H21.46L19.5 9.5M6 18.5C6.83 18.5 7.5 17.83 7.5 17C7.5 16.17 6.83 15.5 6 15.5C5.17 15.5 4.5 16.17 4.5 17C4.5 17.83 5.17 18.5 6 18.5M20 8L23 12V17H21C21 18.66 19.66 20 18 20C16.34 20 15 18.66 15 17H9C9 18.66 7.66 20 6 20C4.34 20 3 18.66 3 17H1V6C1 4.89 1.89 4 3 4H17V8H20M3 6V15H3.76C4.31 14.39 5.11 14 6 14C6.89 14 7.69 14.39 8.24 15H15V6H3Z',\n },\n learn: {\n id: 'school-outline',\n path: 'M12 3L1 9L5 11.18V17.18L12 21L19 17.18V11.18L21 10.09V17H23V9L12 3M18.82 9L12 12.72L5.18 9L12 5.28L18.82 9M17 16L12 18.72L7 16V12.27L12 15L17 12.27V16Z',\n },\n camera: {\n id: 'camera-outline',\n path: 'M20,4H16.83L15,2H9L7.17,4H4A2,2 0 0,0 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6A2,2 0 0,0 20,4M20,18H4V6H8.05L9.88,4H14.12L15.95,6H20V18M12,7A5,5 0 0,0 7,12A5,5 0 0,0 12,17A5,5 0 0,0 17,12A5,5 0 0,0 12,7M12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15Z',\n },\n design: {\n id: 'palette-outline',\n path: 'M12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2C17.5,2 22,6 22,11A6,6 0 0,1 16,17H14.2C13.9,17 13.7,17.2 13.7,17.5C13.7,17.6 13.8,17.7 13.8,17.8C14.2,18.3 14.4,18.9 14.4,19.5C14.5,20.9 13.4,22 12,22M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C12.3,20 12.5,19.8 12.5,19.5C12.5,19.3 12.4,19.2 12.4,19.1C12,18.6 11.8,18.1 11.8,17.5C11.8,16.1 12.9,15 14.3,15H16A4,4 0 0,0 20,11C20,7.1 16.4,4 12,4M6.5,10C7.3,10 8,10.7 8,11.5C8,12.3 7.3,13 6.5,13C5.7,13 5,12.3 5,11.5C5,10.7 5.7,10 6.5,10M9.5,6C10.3,6 11,6.7 11,7.5C11,8.3 10.3,9 9.5,9C8.7,9 8,8.3 8,7.5C8,6.7 8.7,6 9.5,6M14.5,6C15.3,6 16,6.7 16,7.5C16,8.3 15.3,9 14.5,9C13.7,9 13,8.3 13,7.5C13,6.7 13.7,6 14.5,6M17.5,10C18.3,10 19,10.7 19,11.5C19,12.3 18.3,13 17.5,13C16.7,13 16,12.3 16,11.5C16,10.7 16.7,10 17.5,10Z',\n },\n spa: {\n id: 'spa-outline',\n path: 'M15.5,9.63C14.21,10.32 13.03,11.2 12,12.26C10.97,11.19 9.79,10.31 8.5,9.63C8.74,6.86 9.92,4.14 12.06,2C14.18,4.12 15.31,6.84 15.5,9.63M12,15.45C14.15,12.17 17.82,10 22,10C22,20 12.68,21.88 12,22C11.32,21.89 2,20 2,10C6.18,10 9.85,12.17 12,15.45M12.05,5.19C11.39,6.23 10.93,7.38 10.68,8.58L12,9.55L13.35,8.57C13.12,7.37 12.68,6.22 12.05,5.19M12,19.97C12,19.97 18,19 19.74,12.25C14,14 12,19.1 12,19.1C12,19.1 9,13 4.26,12.26C6,19 12,19.97 12,19.97Z',\n },\n fitness: {\n id: 'dumbbell',\n path: 'M20.57,14.86L22,13.43L20.57,12L17,15.57L8.43,7L12,3.43L10.57,2L9.14,3.43L7.71,2L5.57,4.14L4.14,2.71L2.71,4.14L4.14,5.57L2,7.71L3.43,9.14L2,10.57L3.43,12L7,8.43L15.57,17L12,20.57L13.43,22L14.86,20.57L16.29,22L18.43,19.86L19.86,21.29L21.29,19.86L19.86,18.43L22,16.29L20.57,14.86Z',\n },\n phone: {\n id: 'phone-outline',\n path: 'M20,15.5C18.8,15.5 17.5,15.3 16.4,14.9C16.3,14.9 16.2,14.9 16.1,14.9C15.8,14.9 15.6,15 15.4,15.2L13.2,17.4C10.4,15.9 8,13.6 6.6,10.8L8.8,8.6C9.1,8.3 9.2,7.9 9,7.6C8.7,6.5 8.5,5.2 8.5,4C8.5,3.5 8,3 7.5,3H4C3.5,3 3,3.5 3,4C3,13.4 10.6,21 20,21C20.5,21 21,20.5 21,20V16.5C21,16 20.5,15.5 20,15.5M5,5H6.5C6.6,5.9 6.8,6.8 7,7.6L5.8,8.8C5.4,7.6 5.1,6.3 5,5M19,19C17.7,18.9 16.4,18.6 15.2,18.2L16.4,17C17.2,17.2 18.1,17.4 19,17.4V19Z',\n },\n mail: {\n id: 'email-outline',\n path: 'M22 6C22 4.9 21.1 4 20 4H4C2.9 4 2 4.9 2 6V18C2 19.1 2.9 20 4 20H20C21.1 20 22 19.1 22 18V6M20 6L12 11L4 6H20M20 18H4V8L12 13L20 8V18Z',\n },\n money: {\n id: 'cash-multiple',\n path: 'M5,6H23V18H5V6M14,9A3,3 0 0,1 17,12A3,3 0 0,1 14,15A3,3 0 0,1 11,12A3,3 0 0,1 14,9M9,8A2,2 0 0,1 7,10V14A2,2 0 0,1 9,16H19A2,2 0 0,1 21,14V10A2,2 0 0,1 19,8H9M1,10H3V20H19V22H1V10Z',\n },\n chart: {\n id: 'chart-line',\n path: 'M16,11.78L20.24,4.45L21.97,5.45L16.74,14.5L10.23,10.75L5.46,19H22V21H2V3H4V17.54L9.5,8L16,11.78Z',\n },\n lock: {\n id: 'lock-outline',\n path: 'M12,17C10.89,17 10,16.1 10,15C10,13.89 10.89,13 12,13A2,2 0 0,1 14,15A2,2 0 0,1 12,17M18,20V10H6V20H18M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V10C4,8.89 4.89,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z',\n },\n smile: {\n id: 'emoticon-happy-outline',\n path: 'M20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12M22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,12M10,9.5C10,10.3 9.3,11 8.5,11C7.7,11 7,10.3 7,9.5C7,8.7 7.7,8 8.5,8C9.3,8 10,8.7 10,9.5M17,9.5C17,10.3 16.3,11 15.5,11C14.7,11 14,10.3 14,9.5C14,8.7 14.7,8 15.5,8C16.3,8 17,8.7 17,9.5M12,17.23C10.25,17.23 8.71,16.5 7.81,15.42L9.23,14C9.68,14.72 10.75,15.23 12,15.23C13.25,15.23 14.32,14.72 14.77,14L16.19,15.42C15.29,16.5 13.75,17.23 12,17.23Z',\n },\n car: {\n id: 'car-outline',\n path: 'M18.9 6C18.7 5.4 18.1 5 17.5 5H6.5C5.8 5 5.3 5.4 5.1 6L3 12V20C3 20.5 3.5 21 4 21H5C5.6 21 6 20.5 6 20V19H18V20C18 20.5 18.5 21 19 21H20C20.5 21 21 20.5 21 20V12L18.9 6M6.8 7H17.1L18.2 10H5.8L6.8 7M19 17H5V12H19V17M7.5 13C8.3 13 9 13.7 9 14.5S8.3 16 7.5 16 6 15.3 6 14.5 6.7 13 7.5 13M16.5 13C17.3 13 18 13.7 18 14.5S17.3 16 16.5 16C15.7 16 15 15.3 15 14.5S15.7 13 16.5 13Z',\n },\n food: {\n id: 'silverware-fork-knife',\n path: 'M11,9H9V2H7V9H5V2H3V9C3,11.12 4.66,12.84 6.75,12.97V22H9.25V12.97C11.34,12.84 13,11.12 13,9V2H11V9M16,6V14H18.5V22H21V2C18.24,2 16,4.24 16,6Z',\n },\n cake: {\n id: 'cake-variant-outline',\n path: 'M12 6C13.11 6 14 5.1 14 4C14 3.62 13.9 3.27 13.71 2.97L12 0L10.29 2.97C10.1 3.27 10 3.62 10 4C10 5.1 10.9 6 12 6M18 9H13V7H11V9H6C4.34 9 3 10.34 3 12V21C3 21.55 3.45 22 4 22H20C20.55 22 21 21.55 21 21V12C21 10.34 19.66 9 18 9M19 20H5V17C5.9 17 6.76 16.63 7.4 16L8.5 14.92L9.56 16C10.87 17.3 13.15 17.29 14.45 16L15.53 14.92L16.6 16C17.24 16.63 18.1 17 19 17V20M19 15.5C18.5 15.5 18 15.3 17.65 14.93L15.5 12.8L13.38 14.93C12.64 15.67 11.35 15.67 10.61 14.93L8.5 12.8L6.34 14.93C6 15.29 5.5 15.5 5 15.5V12C5 11.45 5.45 11 6 11H18C18.55 11 19 11.45 19 12V15.5Z',\n },\n cut: {\n id: 'content-cut',\n path: 'M19,3L13,9L15,11L22,4V3M12,12.5A0.5,0.5 0 0,1 11.5,12A0.5,0.5 0 0,1 12,11.5A0.5,0.5 0 0,1 12.5,12A0.5,0.5 0 0,1 12,12.5M6,20A2,2 0 0,1 4,18C4,16.89 4.9,16 6,16A2,2 0 0,1 8,18C8,19.11 7.1,20 6,20M6,8A2,2 0 0,1 4,6C4,4.89 4.9,4 6,4A2,2 0 0,1 8,6C8,7.11 7.1,8 6,8M9.64,7.64C9.87,7.14 10,6.59 10,6A4,4 0 0,0 6,2A4,4 0 0,0 2,6A4,4 0 0,0 6,10C6.59,10 7.14,9.87 7.64,9.64L10,12L7.64,14.36C7.14,14.13 6.59,14 6,14A4,4 0 0,0 2,18A4,4 0 0,0 6,22A4,4 0 0,0 10,18C10,17.41 9.87,16.86 9.64,16.36L12,14L19,21H22V20L9.64,7.64Z',\n },\n brush: {\n id: 'brush-variant',\n path: 'M8 3C5.79 3 4 4.79 4 7V14C4 15.1 4.9 16 6 16H9V20C9 21.1 9.9 22 11 22H13C14.1 22 15 21.1 15 20V16H18C19.1 16 20 15.1 20 14V3H8M8 5H12V7H14V5H15V9H17V5H18V10H6V7C6 5.9 6.9 5 8 5M6 14V12H18V14H6Z',\n },\n hammer: {\n id: 'hammer-wrench',\n path: 'M13.78 15.3L19.78 21.3L21.89 19.14L15.89 13.14L13.78 15.3M17.5 10.1C17.11 10.1 16.69 10.05 16.36 9.91L4.97 21.25L2.86 19.14L10.27 11.74L8.5 9.96L7.78 10.66L6.33 9.25V12.11L5.63 12.81L2.11 9.25L2.81 8.55H5.62L4.22 7.14L7.78 3.58C8.95 2.41 10.83 2.41 12 3.58L9.89 5.74L11.3 7.14L10.59 7.85L12.38 9.63L14.2 7.75C14.06 7.42 14 7 14 6.63C14 4.66 15.56 3.11 17.5 3.11C18.09 3.11 18.61 3.25 19.08 3.53L16.41 6.2L17.91 7.7L20.58 5.03C20.86 5.5 21 6 21 6.63C21 8.55 19.45 10.1 17.5 10.1Z',\n },\n water: {\n id: 'water-outline',\n path: 'M12,3.77L11.25,4.61C11.25,4.61 9.97,6.06 8.68,7.94C7.39,9.82 6,12.07 6,14.23A6,6 0 0,0 12,20.23A6,6 0 0,0 18,14.23C18,12.07 16.61,9.82 15.32,7.94C14.03,6.06 12.75,4.61 12.75,4.61L12,3.77M12,6.9C12.44,7.42 12.84,7.85 13.68,9.07C14.89,10.83 16,13.07 16,14.23C16,16.45 14.22,18.23 12,18.23C9.78,18.23 8,16.45 8,14.23C8,13.07 9.11,10.83 10.32,9.07C11.16,7.85 11.56,7.42 12,6.9Z',\n },\n sun: {\n id: 'white-balance-sunny',\n path: 'M3.55,18.54L4.96,19.95L6.76,18.16L5.34,16.74M11,22.45C11.32,22.45 13,22.45 13,22.45V19.5H11M12,5.5A6,6 0 0,0 6,11.5A6,6 0 0,0 12,17.5A6,6 0 0,0 18,11.5C18,8.18 15.31,5.5 12,5.5M20,12.5H23V10.5H20M17.24,18.16L19.04,19.95L20.45,18.54L18.66,16.74M20.45,4.46L19.04,3.05L17.24,4.84L18.66,6.26M13,0.55H11V3.5H13M4,10.5H1V12.5H4M6.76,4.84L4.96,3.05L3.55,4.46L5.34,6.26L6.76,4.84Z',\n },\n book: {\n id: 'book-open-page-variant-outline',\n path: 'M19 1L14 6V17L19 12.5V1M21 5V18.5C19.9 18.15 18.7 18 17.5 18C15.8 18 13.35 18.65 12 19.5V6C10.55 4.9 8.45 4.5 6.5 4.5C4.55 4.5 2.45 4.9 1 6V20.65C1 20.9 1.25 21.15 1.5 21.15C1.6 21.15 1.65 21.1 1.75 21.1C3.1 20.45 5.05 20 6.5 20C8.45 20 10.55 20.4 12 21.5C13.35 20.65 15.8 20 17.5 20C19.15 20 20.85 20.3 22.25 21.05C22.35 21.1 22.4 21.1 22.5 21.1C22.75 21.1 23 20.85 23 20.6V6C22.4 5.55 21.75 5.25 21 5M10 18.41C8.75 18.09 7.5 18 6.5 18C5.44 18 4.18 18.19 3 18.5V7.13C3.91 6.73 5.14 6.5 6.5 6.5C7.86 6.5 9.09 6.73 10 7.13V18.41Z',\n },\n briefcase: {\n id: 'briefcase-outline',\n path: 'M20,6C20.58,6 21.05,6.2 21.42,6.59C21.8,7 22,7.45 22,8V19C22,19.55 21.8,20 21.42,20.41C21.05,20.8 20.58,21 20,21H4C3.42,21 2.95,20.8 2.58,20.41C2.2,20 2,19.55 2,19V8C2,7.45 2.2,7 2.58,6.59C2.95,6.2 3.42,6 4,6H8V4C8,3.42 8.2,2.95 8.58,2.58C8.95,2.2 9.42,2 10,2H14C14.58,2 15.05,2.2 15.42,2.58C15.8,2.95 16,3.42 16,4V6H20M4,8V19H20V8H4M14,6V4H10V6H14Z',\n },\n gift: {\n id: 'gift-outline',\n path: 'M22,12V20A2,2 0 0,1 20,22H4A2,2 0 0,1 2,20V12A1,1 0 0,1 1,11V8A2,2 0 0,1 3,6H6.17C6.06,5.69 6,5.35 6,5A3,3 0 0,1 9,2C10,2 10.88,2.5 11.43,3.24V3.23L12,4L12.57,3.23V3.24C13.12,2.5 14,2 15,2A3,3 0 0,1 18,5C18,5.35 17.94,5.69 17.83,6H21A2,2 0 0,1 23,8V11A1,1 0 0,1 22,12M4,20H11V12H4V20M20,20V12H13V20H20M9,4A1,1 0 0,0 8,5A1,1 0 0,0 9,6A1,1 0 0,0 10,5A1,1 0 0,0 9,4M15,4A1,1 0 0,0 14,5A1,1 0 0,0 15,6A1,1 0 0,0 16,5A1,1 0 0,0 15,4M3,8V10H11V8H3M13,8V10H21V8H13Z',\n },\n music: {\n id: 'music-note-outline',\n path: 'M12 3V13.55A4 4 0 1 0 14 17V7H18V3M10 19A2 2 0 1 1 12 17A2 2 0 0 1 10 19Z',\n },\n plant: {\n id: 'sprout-outline',\n path: 'M23,4.1V2.3L21.2,2.1C21.1,2.1 20.5,2 19.5,2C15.4,2 12.4,3.2 10.7,5.3C9.4,4.5 7.6,4 5.5,4C4.5,4 3.8,4.1 3.8,4.1L1.9,4.4L2,6.1C2.1,9.1 3.6,14.8 8.8,14.8C8.9,14.8 8.9,14.8 9,14.8V18.2C5.2,18.7 2,20 2,20V22H22V20C22,20 18.8,18.7 15,18.2V15C21.3,14.9 23,7.8 23,4.1M12,18C11.7,18 11.3,18 11,18V12.4C11,12.4 10.8,9 8,9C8,9 9.5,9.8 9.9,12.7C9.5,12.8 9.1,12.8 8.8,12.8C4.2,12.8 4,6.1 4,6.1C4,6.1 4.6,6 5.5,6C7.4,6 10.5,6.4 11.4,9.1C11.9,4.6 17,4 19.5,4C20.4,4 21,4.1 21,4.1C21,4.1 21,13.1 14.7,13.1C14.5,13.1 14.2,13.1 14,13.1C14,11.1 16,8.1 16,8.1C13,9.1 13,13 13,13V18C12.7,18 12.3,18 12,18Z',\n },\n medical: {\n id: 'medical-bag',\n path: 'M10,3L8,5V7H5C3.85,7 3.12,8 3,9L2,19C1.88,20 2.54,21 4,21H20C21.46,21 22.12,20 22,19L21,9C20.88,8 20.06,7 19,7H16V5L14,3H10M10,5H14V7H10V5M11,10H13V13H16V15H13V18H11V15H8V13H11V10Z',\n },\n recycle: {\n id: 'recycle',\n path: 'M21.82,15.42L19.32,19.75C18.83,20.61 17.92,21.06 17,21H15V23L12.5,18.5L15,14V16H17.82L15.6,12.15L19.93,9.65L21.73,12.77C22.25,13.54 22.32,14.57 21.82,15.42M9.21,3.06H14.21C15.19,3.06 16.04,3.63 16.45,4.45L17.45,6.19L19.18,5.19L16.54,9.6L11.39,9.69L13.12,8.69L11.71,6.24L9.5,10.09L5.16,7.59L6.96,4.47C7.37,3.64 8.22,3.06 9.21,3.06M5.05,19.76L2.55,15.43C2.06,14.58 2.13,13.56 2.64,12.79L3.64,11.06L1.91,10.06L7.05,10.14L9.7,14.56L7.97,13.56L6.56,16H11V21H7.4C6.47,21.07 5.55,20.61 5.05,19.76Z',\n },\n globe: {\n id: 'earth',\n path: 'M17.9,17.39C17.64,16.59 16.89,16 16,16H15V13A1,1 0 0,0 14,12H8V10H10A1,1 0 0,0 11,9V7H13A2,2 0 0,0 15,5V4.59C17.93,5.77 20,8.64 20,12C20,14.08 19.2,15.97 17.9,17.39M11,19.93C7.05,19.44 4,16.08 4,12C4,11.38 4.08,10.78 4.21,10.21L9,15V16A2,2 0 0,0 11,18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z',\n },\n idea: {\n id: 'lightbulb-on-outline',\n path: 'M20,11H23V13H20V11M1,11H4V13H1V11M13,1V4H11V1H13M4.92,3.5L7.05,5.64L5.63,7.05L3.5,4.93L4.92,3.5M16.95,5.63L19.07,3.5L20.5,4.93L18.37,7.05L16.95,5.63M12,6A6,6 0 0,1 18,12C18,14.22 16.79,16.16 15,17.2V19A1,1 0 0,1 14,20H10A1,1 0 0,1 9,19V17.2C7.21,16.16 6,14.22 6,12A6,6 0 0,1 12,6M14,21V22A1,1 0 0,1 13,23H11A1,1 0 0,1 10,22V21H14M11,18H13V15.87C14.73,15.43 16,13.86 16,12A4,4 0 0,0 12,8A4,4 0 0,0 8,12C8,13.86 9.27,15.43 11,15.87V18Z',\n },\n quote: {\n id: 'format-quote-open',\n path: 'M10,7L8,11H11V17H5V11L7,7H10M18,7L16,11H19V17H13V11L15,7H18Z',\n },\n} as const satisfies Record<string, AiIconLibraryEntry>\n\n/**\n * Icons the compiler draws from what an item says (AGL-4065) — the languages\n * a business works in, a race, a sponsor or a partner, a price or an\n * estimate — that the language's schema does not list for the model: a word\n * added to the schema is a word in every cached page and frame prompt, and\n * these are the compiler's to pick (`aiStorefrontItemIcons`). A stored id of\n * one is read back like any other (`aiIconOfId`).\n */\nexport const AI_ICON_DRAWN = {\n translate: {\n id: 'translate',\n path: 'M12.87,15.07L10.33,12.56L10.36,12.53C12.1,10.59 13.34,8.36 14.07,6H17V4H10V2H8V4H1V6H12.17C11.5,7.92 10.44,9.75 9,11.35C8.07,10.32 7.3,9.19 6.69,8H4.69C5.42,9.63 6.42,11.17 7.67,12.56L2.58,17.58L4,19L9,14L12.11,17.11L12.87,15.07M18.5,10H16.5L12,22H14L15.12,19H19.87L21,22H23L18.5,10M15.88,17L17.5,12.67L19.12,17H15.88Z',\n },\n flag: {\n id: 'flag-checkered',\n path: 'M14.4,6H20V16H13L12.6,14H7V21H5V4H14L14.4,6M14,14H16V12H18V10H16V8H14V10L13,8V6H11V8H9V6H7V8H9V10H7V12H9V10H11V12H13V10L14,12V14M11,10V8H13V10H11M14,10H16V12H14V10Z',\n },\n handshake: {\n id: 'handshake-outline',\n path: 'M21.71 8.71C22.96 7.46 22.39 6 21.71 5.29L18.71 2.29C17.45 1.04 16 1.61 15.29 2.29L13.59 4H11C9.1 4 8 5 7.44 6.15L3 10.59V14.59L2.29 15.29C1.04 16.55 1.61 18 2.29 18.71L5.29 21.71C5.83 22.25 6.41 22.45 6.96 22.45C7.67 22.45 8.32 22.1 8.71 21.71L11.41 19H15C16.7 19 17.56 17.94 17.87 16.9C19 16.6 19.62 15.74 19.87 14.9C21.42 14.5 22 13.03 22 12V9H21.41L21.71 8.71M20 12C20 12.45 19.81 13 19 13L18 13L18 14C18 14.45 17.81 15 17 15L16 15L16 16C16 16.45 15.81 17 15 17H10.59L7.31 20.28C7 20.57 6.82 20.4 6.71 20.29L3.72 17.31C3.43 17 3.6 16.82 3.71 16.71L5 15.41V11.41L7 9.41V11C7 12.21 7.8 14 10 14S13 12.21 13 11H20V12M20.29 7.29L18.59 9H11V11C11 11.45 10.81 12 10 12S9 11.45 9 11V8C9 7.54 9.17 6 11 6H14.41L16.69 3.72C17 3.43 17.18 3.6 17.29 3.71L20.28 6.69C20.57 7 20.4 7.18 20.29 7.29Z',\n },\n receipt: {\n id: 'receipt',\n path: 'M3,22L4.5,20.5L6,22L7.5,20.5L9,22L10.5,20.5L12,22L13.5,20.5L15,22L16.5,20.5L18,22L19.5,20.5L21,22V2L19.5,3.5L18,2L16.5,3.5L15,2L13.5,3.5L12,2L10.5,3.5L9,2L7.5,3.5L6,2L4.5,3.5L3,2M18,9H6V7H18M18,13H6V11H18M18,17H6V15H18V17Z',\n },\n} as const satisfies Record<string, AiIconLibraryEntry>\n\n/** A word the layout language may name an icon by. */\nexport type AiIconWord = keyof typeof AI_ICON_LIBRARY\n\n/** Every icon word, in the order the schema lists them. */\nexport const AI_ICON_WORDS = Object.keys(AI_ICON_LIBRARY) as AiIconWord[]\n\n/** Every icon the platform's code draws: the schema's words and the compiler's own. */\nconst ALL_ICONS: Readonly<Record<string, AiIconLibraryEntry>> = { ...AI_ICON_LIBRARY, ...AI_ICON_DRAWN }\n\nconst BY_ID: ReadonlyMap<string, AiIconLibraryEntry> = new Map(\n Object.values(ALL_ICONS).map((entry) => [entry.id, entry]),\n)\n\n/** The library entry an icon word names, the schema's or the compiler's own; `null` for any other value. */\nexport function aiIconOfWord(word: unknown): AiIconLibraryEntry | null {\n return typeof word === 'string' &&\n Object.prototype.hasOwnProperty.call(ALL_ICONS, word)\n ? (ALL_ICONS[word] as AiIconLibraryEntry)\n : null\n}\n\n/** The library entry a stored icon id names; `null` for an id the library does not hold. */\nexport function aiIconOfId(id: unknown): AiIconLibraryEntry | null {\n return typeof id === 'string' ? (BY_ID.get(id) ?? null) : null\n}\n\n/** The most characters an icon's own drawing may hold (AGL-4107): a page brought in carries its source's icons. */\nexport const AI_ICON_PATH_MAX_CHARS = 8_192\n\n/** Whether a value is SVG path data and nothing else: commands, numbers and their separators. */\nexport function aiIsIconPathData(value: unknown): value is string {\n return (\n typeof value === 'string' &&\n value.length > 0 &&\n value.length <= AI_ICON_PATH_MAX_CHARS &&\n /^[MmZzLlHhVvCcSsQqTtAa0-9eE.,\\s+-]+$/.test(value) &&\n /^\\s*[Mm]/.test(value)\n )\n}\n"],"names":["AI_ICON_COMPONENT_ID","AI_ICON_LIBRARY","check","id","path","star","heart","clock","calendar","location","shield","leaf","home","tools","paw","tooth","coffee","yoga","law","roof","people","chat","fast","sparkle","care","award","truck","learn","camera","design","spa","fitness","phone","mail","money","chart","lock","smile","car","food","cake","cut","brush","hammer","water","sun","book","briefcase","gift","music","plant","medical","recycle","globe","idea","quote","AI_ICON_DRAWN","translate","flag","handshake","receipt","AI_ICON_WORDS","Object","keys","ALL_ICONS","BY_ID","Map","values","map","entry","aiIconOfWord","word","prototype","hasOwnProperty","call","aiIconOfId","get","AI_ICON_PATH_MAX_CHARS","aiIsIconPathData","value","length","test"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;CAcC,GAED,+CAA+C,GAC/C,OAAO,MAAMA,uBAAuB,OAAM;AAS1C,OAAO,MAAMC,kBAAkB;IAC7BC,OAAO;QACLC,IAAI;QACJC,MAAM;IACR;IACAC,MAAM;QACJF,IAAI;QACJC,MAAM;IACR;IACAE,OAAO;QACLH,IAAI;QACJC,MAAM;IACR;IACAG,OAAO;QACLJ,IAAI;QACJC,MAAM;IACR;IACAI,UAAU;QACRL,IAAI;QACJC,MAAM;IACR;IACAK,UAAU;QACRN,IAAI;QACJC,MAAM;IACR;IACAM,QAAQ;QACNP,IAAI;QACJC,MAAM;IACR;IACAO,MAAM;QACJR,IAAI;QACJC,MAAM;IACR;IACAQ,MAAM;QACJT,IAAI;QACJC,MAAM;IACR;IACAS,OAAO;QACLV,IAAI;QACJC,MAAM;IACR;IACAU,KAAK;QACHX,IAAI;QACJC,MAAM;IACR;IACAW,OAAO;QACLZ,IAAI;QACJC,MAAM;IACR;IACAY,QAAQ;QACNb,IAAI;QACJC,MAAM;IACR;IACAa,MAAM;QACJd,IAAI;QACJC,MAAM;IACR;IACAc,KAAK;QACHf,IAAI;QACJC,MAAM;IACR;IACAe,MAAM;QACJhB,IAAI;QACJC,MAAM;IACR;IACAgB,QAAQ;QACNjB,IAAI;QACJC,MAAM;IACR;IACAiB,MAAM;QACJlB,IAAI;QACJC,MAAM;IACR;IACAkB,MAAM;QACJnB,IAAI;QACJC,MAAM;IACR;IACAmB,SAAS;QACPpB,IAAI;QACJC,MAAM;IACR;IACAoB,MAAM;QACJrB,IAAI;QACJC,MAAM;IACR;IACAqB,OAAO;QACLtB,IAAI;QACJC,MAAM;IACR;IACAsB,OAAO;QACLvB,IAAI;QACJC,MAAM;IACR;IACAuB,OAAO;QACLxB,IAAI;QACJC,MAAM;IACR;IACAwB,QAAQ;QACNzB,IAAI;QACJC,MAAM;IACR;IACAyB,QAAQ;QACN1B,IAAI;QACJC,MAAM;IACR;IACA0B,KAAK;QACH3B,IAAI;QACJC,MAAM;IACR;IACA2B,SAAS;QACP5B,IAAI;QACJC,MAAM;IACR;IACA4B,OAAO;QACL7B,IAAI;QACJC,MAAM;IACR;IACA6B,MAAM;QACJ9B,IAAI;QACJC,MAAM;IACR;IACA8B,OAAO;QACL/B,IAAI;QACJC,MAAM;IACR;IACA+B,OAAO;QACLhC,IAAI;QACJC,MAAM;IACR;IACAgC,MAAM;QACJjC,IAAI;QACJC,MAAM;IACR;IACAiC,OAAO;QACLlC,IAAI;QACJC,MAAM;IACR;IACAkC,KAAK;QACHnC,IAAI;QACJC,MAAM;IACR;IACAmC,MAAM;QACJpC,IAAI;QACJC,MAAM;IACR;IACAoC,MAAM;QACJrC,IAAI;QACJC,MAAM;IACR;IACAqC,KAAK;QACHtC,IAAI;QACJC,M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,IAAI,CAACV,WAAWO,QAC7CP,SAAS,CAACO,KAAK,GAChB;AACN;AAEA,0FAA0F,GAC1F,OAAO,SAASI,WAAWxE,EAAW;QACH8D;IAAjC,OAAO,OAAO9D,OAAO,YAAY8D,aAAAA,MAAMW,GAAG,CAACzE,eAAV8D,aAAiB,OAAQ;AAC5D;AAEA,iHAAiH,GACjH,OAAO,MAAMY,yBAAyB,KAAK;AAE3C,+FAA+F,GAC/F,OAAO,SAASC,iBAAiBC,KAAc;IAC7C,OACE,OAAOA,UAAU,YACjBA,MAAMC,MAAM,GAAG,KACfD,MAAMC,MAAM,IAAIH,0BAChB,uCAAuCI,IAAI,CAACF,UAC5C,WAAWE,IAAI,CAACF;AAEpB"}
@@ -24,7 +24,7 @@ import { COMPONENT_PROP_NAME_PATTERN, REUSABLE_INSTANCE_COMPONENT_ID, REUSABLE_I
24
24
  import { createIdUrlSafe } from "@aglyn/aglyn/foundation/constants/app";
25
25
  import { CANVAS_ROOT_ELEMENT_ID } from "@aglyn/aglyn/foundation/constants/canvas";
26
26
  import { NodeType } from "@aglyn/aglyn/types/nodes";
27
- import { AI_ICON_COMPONENT_ID, aiIconOfId } from "./ai-icon-library.js";
27
+ import { AI_ICON_COMPONENT_ID, aiIconOfId, aiIsIconPathData } from "./ai-icon-library.js";
28
28
  import { AI_COMPONENT_VISIBILITY_PROPS, isAiComponentPropToken } from "./ai-component-bindings.js";
29
29
  import { sanitizePortableDefinition } from "@aglyn/aglyn/app-utils/node-definition-sanitizer";
30
30
  /**
@@ -772,12 +772,16 @@ function validate(input, surface, context) {
772
772
  "iconId"
773
773
  ]);
774
774
  const rest = _extends({}, props);
775
+ const drawn = rest['iconPath'];
775
776
  delete rest['iconPath'];
776
777
  const icon = aiIconOfId(iconId);
777
778
  if (icon) iconByNodeId.set(id, {
778
779
  iconId: icon.id,
779
780
  iconPath: icon.path
780
781
  });
782
+ else if (aiIsIconPathData(drawn)) iconByNodeId.set(id, {
783
+ iconPath: drawn
784
+ });
781
785
  forSanitizer[id] = _extends({}, node, {
782
786
  props: rest
783
787
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/runtime/ai-node-tree.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n AI_TEXT_LIMITS,\n isHeadlineVariant,\n nodeCapabilityProps,\n type AiPaletteEntry,\n type AiPropSchema,\n type AiSurface,\n} from './ai-palette'\nimport {\n AI_NODE_CAPABILITIES,\n AI_PALETTE,\n AI_SURFACES,\n AI_SX_TOKENS,\n} from './ai-palette.generated'\nimport { linealRelationshipPermits } from '@aglyn/aglyn/app-utils/lineal-order'\nimport {\n NODE_MAP_MAX_BYTES,\n nodeMapBytes,\n} from '@aglyn/aglyn/app-utils/measure-node-map'\nimport { parseMediaRef } from '@aglyn/aglyn/app-utils/media-ref'\nimport {\n COMPONENT_PROP_NAME_PATTERN,\n REUSABLE_INSTANCE_COMPONENT_ID,\n REUSABLE_INSTANCE_PROP_VALUES_KEY,\n} from '@aglyn/aglyn/app-utils/reusable-component-keys'\nimport { createIdUrlSafe } from '@aglyn/aglyn/foundation/constants/app'\nimport { CANVAS_ROOT_ELEMENT_ID } from '@aglyn/aglyn/foundation/constants/canvas'\nimport { NodeType, type NodesMap } from '@aglyn/aglyn/types/nodes'\nimport type { AiComponentPropTypes } from '../model/ai-site-inventory'\nimport { AI_ICON_COMPONENT_ID, aiIconOfId } from './ai-icon-library'\nimport {\n AI_COMPONENT_VISIBILITY_PROPS,\n isAiComponentPropToken,\n} from './ai-component-bindings'\n\nimport { sanitizePortableDefinition } from '@aglyn/aglyn/app-utils/node-definition-sanitizer'\n\n/**\n * The one path an AI-emitted node tree takes into storage (AGL-2905).\n *\n * A model answers with a flat node map in the shape the canvas persists.\n * Nothing about that map is trusted: the component ids, the parent/child\n * pairs, every prop and every `sx` key are what the model chose to write,\n * and the renderer spreads props onto the DOM. So the tree is first held to\n * the same sanitizer a marketplace install passes — reachability from the\n * root, the surface's component allowlist, the persisted node keys, `href`\n * and `src` protocols, a size cap — and then to what a listing never needed\n * checking because a human authored it in the editor:\n *\n * - the parent/child restrictions the besigner enforces on drop\n * (`restrictChildren` / `restrictParent`), and whether an element can hold\n * children at all;\n * - every prop against the generated palette's schema — unknown props are\n * dropped, enum values coerced case-insensitively, a required prop that is\n * missing refuses the tree;\n * - `sx` against a fixed key set and a value grammar of theme tokens, numbers\n * and CSS lengths or keywords, with nothing that can reach a URL or a\n * stylesheet;\n * - copy length by role — a headline, a paragraph, a button label;\n * - links to a screen the host has, a root-relative path or an `https:` URL,\n * and media to a DAM reference or an `https:` URL;\n * - the stored-node-map byte ceiling, measured the way the save measures it.\n *\n * ## The site's own records, when the caller names them (AGL-2935)\n *\n * A reusable-component instance, a form picked on the Forms page and a\n * dataset are each \"a reference into another document\", which is why the\n * palette leaves them off: from a description alone a model can only invent\n * an id. A generator that has read the site's inventory can name real ones,\n * and the building doctrine requires it to — a repeat is placed as\n * instances of one component, and a form is bound by id rather than drawn\n * inline. So the three are admitted exactly as screen links are: only\n * against the ids the caller supplies. With no `componentIds` an instance is\n * still refused; with no `formIds` or `datasetIds` the binding is dropped.\n *\n * What comes out is the flat `NodesMap` `encodeStoredNodes` takes, with every\n * id minted fresh the way a preset graft mints them, so nothing the model\n * wrote can collide with a node already on the canvas. `sourceIds` maps each\n * minted id back to the id the model wrote, so a caller can quote a refused\n * subtree in the model's own words. Every drop is listed in `repairs`; every\n * refusal names its `code`. The function never throws.\n */\n\nexport type AiNodeTreeRefusalCode =\n /** Not an object with a `rootId` and a `nodes` map, or an unknown surface. */\n | 'invalid-input'\n /** The root node carries a component the surface does not start with. */\n | 'root'\n /** A structural failure the sanitizer named: missing node, empty tree. */\n | 'structure'\n /** A component id outside the surface's allowlist. */\n | 'component'\n /** A parent/child pair the besigner would refuse on drop. */\n | 'lineage'\n /** A prop the palette marks required is absent. */\n | 'required-prop'\n /** Over the sanitizer's or the stored-node-map's byte ceiling. */\n | 'too-large'\n /** A component instance naming a component the site does not have. */\n | 'reference'\n\nexport type AiNodeTreeResult =\n | {\n ok: true\n rootId: string\n nodes: NodesMap\n repairs: string[]\n /** Each minted id → the id the model wrote for that node. */\n sourceIds: Record<string, string>\n }\n | { ok: false; error: string; code: AiNodeTreeRefusalCode }\n\nexport interface AiNodeTreeContext {\n /** Screen ids a `screen` prop may name. Absent: any well-formed id. */\n screenIds?: Iterable<string>\n /** DAM media ids a `media` prop may reference. Absent: any well-formed reference. */\n assetIds?: Iterable<string>\n /**\n * Reusable components an instance may place. Absent: no instance is\n * admitted, which is the palette's own rule for a tree nobody grounded.\n */\n componentIds?: Iterable<string>\n /** Declared props per component id, which an instance's values are held to. */\n componentProps?: Record<string, AiComponentPropTypes>\n /** Forms on the Forms page a Form element may bind by `formId`. */\n formIds?: Iterable<string>\n /** Datasets a Form element may write to by `datasetId`. */\n datasetIds?: Iterable<string>\n /**\n * Binding tokens a `url` or `media` prop may hold whole — an Image whose\n * `src` is `{{entry.coverImage}}` on a page template, filled per record\n * when the page renders (AGL-2909). Absent: a token in either role is\n * dropped like any other value that is not an address.\n */\n bindingTokens?: Iterable<string>\n /**\n * The tree defines a reusable component (AGL-2908). A field that is not\n * copy — a switch, a dropdown, a screen, an address, a picture, a number —\n * and the `hideIf` and `hideUnless` directives may then hold one of the\n * component's own `{{prop.<name>}}` tokens as their whole value, and a\n * placed component may be handed one in its `propValues`; each is kept as\n * written. Which property a token names, and whether its kind binds to that\n * field, is the component step's check (`ai-component-bindings.ts`).\n * Absent: such a token is dropped like any value the field cannot hold.\n */\n definesComponent?: boolean\n /**\n * The tree was composed by the platform's own code — the layout language\n * compiler (AGL-3660) — and not written by a model. The surface's code-only\n * elements are then admitted (an Icon, and a layout's Drawer with its Menu\n * Button), and an Icon keeps the id and the path the icon library gives\n * the id it names (`ai-icon-library.ts`): the path is the library's, never\n * the tree's. Absent: a model's tree, held to the surface's catalog.\n */\n codeBuilt?: boolean\n}\n\n/**\n * `sx` keys a model may set: spacing, color, typography, layout, borders,\n * display, flex and grid. Fixed rather than derived — MUI's system accepts\n * far more (pseudo-selectors, nested selectors, arbitrary CSS properties)\n * and every one of those is a way to reach outside the element.\n */\nexport const AI_SX_ALLOWED_KEYS: ReadonlySet<string> = new Set([\n // spacing\n 'm',\n 'mt',\n 'mr',\n 'mb',\n 'ml',\n 'mx',\n 'my',\n 'margin',\n 'marginTop',\n 'marginRight',\n 'marginBottom',\n 'marginLeft',\n 'p',\n 'pt',\n 'pr',\n 'pb',\n 'pl',\n 'px',\n 'py',\n 'padding',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'gap',\n 'rowGap',\n 'columnGap',\n // color\n 'color',\n 'bgcolor',\n 'backgroundColor',\n 'borderColor',\n 'opacity',\n // typography\n 'typography',\n 'fontSize',\n 'fontWeight',\n 'fontFamily',\n 'fontStyle',\n 'lineHeight',\n 'letterSpacing',\n 'textAlign',\n 'textTransform',\n 'textDecoration',\n 'whiteSpace',\n 'textOverflow',\n 'overflowWrap',\n 'wordBreak',\n // layout\n 'width',\n 'minWidth',\n 'maxWidth',\n 'height',\n 'minHeight',\n 'maxHeight',\n 'boxSizing',\n 'overflow',\n 'overflowX',\n 'overflowY',\n 'position',\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'zIndex',\n 'aspectRatio',\n 'objectFit',\n // borders\n 'border',\n 'borderTop',\n 'borderRight',\n 'borderBottom',\n 'borderLeft',\n 'borderWidth',\n 'borderStyle',\n 'borderRadius',\n 'boxShadow',\n // display\n 'display',\n 'visibility',\n // flex\n 'flexDirection',\n 'flexWrap',\n 'justifyContent',\n 'alignItems',\n 'alignContent',\n 'alignSelf',\n 'justifySelf',\n 'flex',\n 'flexGrow',\n 'flexShrink',\n 'flexBasis',\n 'order',\n // grid\n 'gridTemplateColumns',\n 'gridTemplateRows',\n 'gridColumn',\n 'gridRow',\n 'gridArea',\n 'gridAutoFlow',\n 'gridAutoColumns',\n 'gridAutoRows',\n 'justifyItems',\n 'placeItems',\n 'placeContent',\n])\n\n/**\n * Substrings no string a model wrote may carry, in a prop or an `sx` value.\n * Exported for the theme tool's component style values (AGL-2938), which are\n * the same kind of CSS value written into a theme instead of a node.\n */\nexport const HOSTILE_TEXT =\n /<\\s*\\/?\\s*(script|iframe|object|embed|svg|style|link|meta|base|frame|form|input|img)\\b|javascript:|vbscript:|data:text\\/html|expression\\s*\\(|url\\s*\\(|@import|!important|\\bon[a-z]+\\s*=/i\n\n/**\n * A CSS value a model may write into `sx`: lengths, numbers, keywords,\n * shorthands (`1px solid`), functions with plain arguments (`repeat(3, 1fr)`,\n * `rgba(0, 0, 0, 0.2)`), hex colors and theme tokens. No quotes, no\n * semicolons, no braces, no angle brackets, no colons — which is what keeps\n * a `url(`, a selector or a second declaration out.\n */\nexport const SX_VALUE = /^[A-Za-z0-9#.,%()\\s\\-_/+*]{1,100}$/\n\n/**\n * Node fields the sanitizer strips that a model has no business writing —\n * each is a way to reach past the node's own box, and each is named in\n * `repairs` so a route can tell the model what it lost.\n */\nconst STRIPPED_NODE_KEYS = [\n 'className',\n 'interactions',\n 'styleOverrides',\n 'attrOverrides',\n 'presetRef',\n] as const\n\nconst SCREEN_ID = /^[A-Za-z0-9_-]{1,64}$/\n/** The field an icon is picked with; its value carries a drawing no model can write. */\nconst ICON_PICKER_FIELD = 'icon-picker'\nconst MAX_SX_KEYS = 40\n/** A string prop with no role of its own — a color, a CSS length, an icon id. */\nconst PLAIN_STRING_MAX = 500\n\nconst paletteTokens = new Set<string>(AI_SX_TOKENS.palette)\nconst breakpoints = new Set<string>(AI_SX_TOKENS.breakpoints)\nconst typographyVariants = new Set<string>(AI_SX_TOKENS.typographyVariants)\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/** An `https:` address that parses as one. */\nexport function isHttpsUrl(value: string): boolean {\n if (!/^https:\\/\\//i.test(value)) return false\n try {\n return new URL(value).protocol === 'https:'\n } catch {\n return false\n }\n}\n\n/**\n * A link that calls or writes (AGL-3979): `tel:` and a phone number's digits,\n * a `+` only first, or `mailto:` and one address with nothing after it. The\n * number or address itself is held to the facts the job was given by the\n * layout's own contact check, which reads every prop.\n */\nexport function isContactHref(value: string): boolean {\n return /^tel:\\+?\\d{7,15}$/.test(value) || /^mailto:[^\\s@<>?#\"]+@[^\\s@<>?#\"]+\\.[^\\s@<>?#\".]{2,}$/i.test(value)\n}\n\n/** A path on this site: one leading slash, never a scheme-relative `//`. */\nexport function isRootRelativePath(value: string): boolean {\n return /^\\/(?!\\/)[^\\s<>\"'`\\\\]*$/.test(value)\n}\n\nfunction sxValueAllowed(key: string, value: unknown): boolean {\n if (typeof value === 'number') return Number.isFinite(value)\n if (typeof value !== 'string') return false\n const trimmed = value.trim()\n if (!trimmed || HOSTILE_TEXT.test(trimmed)) return false\n if (paletteTokens.has(trimmed)) return true\n if (key === 'typography' && typographyVariants.has(trimmed)) return true\n return SX_VALUE.test(trimmed)\n}\n\n/**\n * The allowed slice of an `sx` object, with a line per key or value dropped.\n * Responsive objects keep only breakpoint keys; anything deeper — a\n * pseudo-selector, a nested selector, an array — is not a value at all.\n */\nfunction sanitizeSx(\n nodeId: string,\n sx: unknown,\n repairs: string[],\n): Record<string, unknown> | undefined {\n if (!isRecord(sx)) {\n if (sx !== undefined)\n repairs.push(`${nodeId}: sx is not an object; dropped`)\n return undefined\n }\n const out: Record<string, unknown> = {}\n let kept = 0\n for (const [key, value] of Object.entries(sx)) {\n if (!AI_SX_ALLOWED_KEYS.has(key)) {\n repairs.push(`${nodeId}: sx.${key} is not an allowed style; dropped`)\n continue\n }\n if (kept >= MAX_SX_KEYS) {\n repairs.push(\n `${nodeId}: sx.${key} is past the ${MAX_SX_KEYS}-key ceiling; dropped`,\n )\n continue\n }\n if (isRecord(value)) {\n const responsive: Record<string, unknown> = {}\n for (const [breakpoint, inner] of Object.entries(value)) {\n if (!breakpoints.has(breakpoint)) {\n repairs.push(\n `${nodeId}: sx.${key}.${breakpoint} is not a breakpoint; dropped`,\n )\n continue\n }\n if (!sxValueAllowed(key, inner)) {\n repairs.push(\n `${nodeId}: sx.${key}.${breakpoint} is not an allowed value; dropped`,\n )\n continue\n }\n responsive[breakpoint] =\n typeof inner === 'string' ? inner.trim() : inner\n }\n if (Object.keys(responsive).length) {\n out[key] = responsive\n kept += 1\n }\n continue\n }\n if (!sxValueAllowed(key, value)) {\n repairs.push(`${nodeId}: sx.${key} is not an allowed value; dropped`)\n continue\n }\n out[key] = typeof value === 'string' ? value.trim() : value\n kept += 1\n }\n return kept ? out : undefined\n}\n\nfunction coerceEnum(schema: AiPropSchema, value: unknown): string | undefined {\n if (typeof value !== 'string' || !schema.enum) return undefined\n const wanted = value.trim().toLowerCase()\n return schema.enum.find((option) => option.toLowerCase() === wanted)\n}\n\nfunction coerceBoolean(value: unknown): boolean | undefined {\n if (typeof value === 'boolean') return value\n if (value === 'true') return true\n if (value === 'false') return false\n return undefined\n}\n\nfunction coerceNumber(\n schema: AiPropSchema,\n value: unknown,\n): number | undefined {\n const parsed =\n typeof value === 'number'\n ? value\n : typeof value === 'string' && value.trim() !== ''\n ? Number(value)\n : NaN\n if (!Number.isFinite(parsed)) return undefined\n if (schema.type === 'integer' && !Number.isInteger(parsed)) return undefined\n if (schema.minimum !== undefined && parsed < schema.minimum) return undefined\n if (schema.maximum !== undefined && parsed > schema.maximum) return undefined\n return parsed\n}\n\nfunction textLimitFor(\n entry: AiPaletteEntry,\n name: string,\n props: Record<string, unknown>,\n): number {\n const declared = entry.textLimits[name]\n // A heading's copy is held to the headline ceiling, decided by the variant\n // the same node carries; anything else keeps the ceiling the palette\n // assigned to the prop.\n if (name === 'children' && isHeadlineVariant(props.variant)) {\n return Math.min(declared ?? AI_TEXT_LIMITS.body, AI_TEXT_LIMITS.headline)\n }\n return declared ?? AI_TEXT_LIMITS.body\n}\n\n/**\n * One string prop against its role. Returns the value to store, or\n * `undefined` with the reason pushed to `repairs`. A binding token the\n * caller admitted passes a `url` or `media` role whole.\n */\nfunction sanitizeString(\n nodeId: string,\n entry: AiPaletteEntry,\n name: string,\n schema: AiPropSchema,\n raw: string,\n props: Record<string, unknown>,\n screenIds: Set<string> | null,\n assetIds: Set<string> | null,\n repairs: string[],\n bindingTokens: ReadonlySet<string> | null = null,\n): string | undefined {\n let value = raw.trim()\n if (HOSTILE_TEXT.test(value)) {\n repairs.push(`${nodeId}.${name} carried markup or script; dropped`)\n return undefined\n }\n // An icon is drawn from the path its picker stores beside the id, which a\n // model can never supply, so an icon a model names draws nothing where the\n // page is published (AGL-3054). The site owner picks it.\n if (entry.propFields[name] === ICON_PICKER_FIELD) {\n repairs.push(`${nodeId}.${name} is an icon, which the site owner picks from the library; dropped`)\n return undefined\n }\n const role = entry.propRoles[name]\n switch (role) {\n case 'text': {\n const limit = textLimitFor(entry, name, props)\n if (value.length > limit) {\n value = value.slice(0, limit).trimEnd()\n repairs.push(\n `${nodeId}.${name} was over ${limit} characters; truncated`,\n )\n }\n break\n }\n case 'url': {\n if (bindingTokens?.has(value)) break\n if (!isHttpsUrl(value) && !isRootRelativePath(value) && !isContactHref(value)) {\n repairs.push(\n `${nodeId}.${name} is neither an https: URL nor a path on this site; dropped`,\n )\n return undefined\n }\n break\n }\n case 'screen': {\n if (screenIds ? !screenIds.has(value) : !SCREEN_ID.test(value)) {\n repairs.push(\n `${nodeId}.${name} names a page this site does not have; dropped`,\n )\n return undefined\n }\n break\n }\n case 'media': {\n if (bindingTokens?.has(value)) break\n if (isHttpsUrl(value)) break\n const ref = parseMediaRef(value)\n if (!ref || (assetIds && !assetIds.has(ref.mediaId))) {\n repairs.push(\n `${nodeId}.${name} is neither a media reference this site holds nor an https: URL; dropped`,\n )\n return undefined\n }\n break\n }\n default: {\n if (value.length > PLAIN_STRING_MAX) {\n repairs.push(\n `${nodeId}.${name} is over ${PLAIN_STRING_MAX} characters; dropped`,\n )\n return undefined\n }\n }\n }\n if (schema.pattern && !new RegExp(schema.pattern).test(value)) {\n repairs.push(`${nodeId}.${name} does not match its pattern; dropped`)\n return undefined\n }\n if (schema.minLength !== undefined && value.length < schema.minLength) {\n repairs.push(\n `${nodeId}.${name} is shorter than ${schema.minLength} characters; dropped`,\n )\n return undefined\n }\n if (schema.maxLength !== undefined && value.length > schema.maxLength) {\n value = value.slice(0, schema.maxLength).trimEnd()\n repairs.push(\n `${nodeId}.${name} was over ${schema.maxLength} characters; truncated`,\n )\n }\n return value\n}\n\n/**\n * The element's own declarations plus the node capabilities every element\n * carries (AGL-3156) — repeating, today. Two shapes only, so they are built\n * once each rather than per node: a capability prop is the same on every\n * element with the same child contract.\n *\n * The element wins a name collision. A component that declared a prop of its\n * own under a capability's name would be describing its own attribute, and the\n * validator has to hold it to that.\n */\nconst CAPABLE_ENTRIES = new WeakMap<AiPaletteEntry, AiPaletteEntry>()\n\nfunction withNodeCapabilities(entry: AiPaletteEntry): AiPaletteEntry {\n const cached = CAPABLE_ENTRIES.get(entry)\n if (cached) return cached\n const capability = nodeCapabilityProps(\n AI_NODE_CAPABILITIES,\n entry.acceptsChildren,\n )\n const merged: AiPaletteEntry = {\n ...entry,\n propsSchema: {\n ...entry.propsSchema,\n properties: {\n ...capability.properties,\n ...entry.propsSchema.properties,\n },\n },\n propRoles: { ...capability.propRoles, ...entry.propRoles },\n textLimits: { ...capability.textLimits, ...entry.textLimits },\n }\n CAPABLE_ENTRIES.set(entry, merged)\n return merged\n}\n\n/**\n * Plugins whose elements play audio (AGL-3716): the Music player. A model\n * never sources a recording and never vouches for one, so on their elements\n * `rightsConfirmed` is always dropped and `src` is kept only as a reference\n * to a file in the site's own library (which the asset check grounds) or a\n * binding. Named by plugin id, as the listings name their elements: a plugin\n * never imports another.\n */\nexport const AI_OWNER_AUDIO_PLUGIN_IDS: ReadonlySet<string> = new Set(['music'])\n\n/** Why an audio element's prop a model wrote is dropped, or null to keep it. */\nexport function aiOwnerAudioRefusal(\n pluginId: string | undefined,\n name: string,\n value: unknown,\n bindingTokens: ReadonlySet<string> | null = null,\n): string | null {\n if (!pluginId || !AI_OWNER_AUDIO_PLUGIN_IDS.has(pluginId)) return null\n if (name === 'rightsConfirmed') {\n return 'only the site owner can confirm they hold the rights to a recording'\n }\n if (name !== 'src') return null\n const text = typeof value === 'string' ? value.trim() : ''\n if (!text || parseMediaRef(text) || bindingTokens?.has(text)) return null\n return 'a player plays only audio from the owner’s own media library, never a recording from elsewhere'\n}\n\nfunction sanitizeProps(\n nodeId: string,\n paletteEntry: AiPaletteEntry,\n raw: unknown,\n screenIds: Set<string> | null,\n assetIds: Set<string> | null,\n repairs: string[],\n bindingTokens: ReadonlySet<string> | null = null,\n): { props: Record<string, unknown> } | { missing: string } {\n const entry = withNodeCapabilities(paletteEntry)\n const source = isRecord(raw) ? raw : {}\n const props: Record<string, unknown> = {}\n const declared = entry.propsSchema.properties\n for (const [name, value] of Object.entries(source)) {\n // `sx` is read off the node instead; a model that put it here meant the\n // same thing, and the caller has already moved it.\n if (name === 'sx' || value === undefined || value === null) continue\n // Audio is the owner's own, always (AGL-3716).\n const audioRefusal = aiOwnerAudioRefusal(entry.pluginId, name, value, bindingTokens)\n if (audioRefusal) {\n repairs.push(`${nodeId}.${name}: ${audioRefusal}; dropped`)\n continue\n }\n const schema = declared[name]\n if (!schema) {\n repairs.push(\n `${nodeId}.${name} is not a prop of ${entry.displayName}; dropped`,\n )\n continue\n }\n if (schema.enum) {\n const coerced = coerceEnum(schema, value)\n if (coerced === undefined) {\n repairs.push(\n `${nodeId}.${name} is not one of ${schema.enum.join('|')}; dropped`,\n )\n continue\n }\n if (coerced !== value) {\n repairs.push(\n `${nodeId}.${name} was spelled \"${String(value)}\"; normalized to \"${coerced}\"`,\n )\n }\n props[name] = coerced\n continue\n }\n switch (schema.type) {\n case 'boolean': {\n const coerced = coerceBoolean(value)\n if (coerced === undefined) {\n repairs.push(`${nodeId}.${name} is not a boolean; dropped`)\n continue\n }\n props[name] = coerced\n break\n }\n case 'number':\n case 'integer': {\n const coerced = coerceNumber(schema, value)\n if (coerced === undefined) {\n repairs.push(`${nodeId}.${name} is not a number in range; dropped`)\n continue\n }\n props[name] = coerced\n break\n }\n default: {\n const text =\n typeof value === 'string'\n ? value\n : typeof value === 'number' || typeof value === 'boolean'\n ? String(value)\n : undefined\n if (text === undefined) {\n repairs.push(`${nodeId}.${name} is not text; dropped`)\n continue\n }\n const cleaned = sanitizeString(\n nodeId,\n entry,\n name,\n schema,\n text,\n source,\n screenIds,\n assetIds,\n repairs,\n bindingTokens,\n )\n if (cleaned === undefined) continue\n props[name] = cleaned\n }\n }\n }\n for (const name of entry.propsSchema.required) {\n if (props[name] === undefined) return { missing: name }\n }\n return { props }\n}\n\n/** Surfaces that compose page elements, and so may place a component instance. */\nconst INSTANCE_SURFACES: ReadonlySet<AiSurface> = new Set([\n 'screen',\n 'layout',\n 'component',\n])\n\nconst FORM_COMPONENT_ID = 'form'\n\n/** The prop a repeat over a dataset is stored under (the data plugin's `repeatDataset`). Persisted — never rename. */\nexport const AI_REPEAT_DATASET_PROP = 'repeatDataset'\n\n/** The instance prop naming the component it places; stored on every instance node. */\nexport const AI_INSTANCE_REF_PROP = 'refId'\n\ninterface ReferenceSets {\n componentIds: Set<string> | null\n componentProps: Record<string, AiComponentPropTypes>\n formIds: Set<string> | null\n datasetIds: Set<string> | null\n assetIds: Set<string> | null\n /** The tree defines a reusable component, which may hand its own property tokens on. */\n definesComponent: boolean\n}\n\n/**\n * One value an instance fills in for a declared prop, held to what the\n * declaration's type can hold: a picture from the library, a link, a number,\n * a switch, or copy.\n */\nfunction instancePropValue(\n nodeId: string,\n name: string,\n type: string,\n raw: unknown,\n assetIds: Set<string> | null,\n repairs: string[],\n): unknown {\n if (type === 'number') {\n const parsed = typeof raw === 'number' ? raw : Number(raw)\n if (raw === '' || !Number.isFinite(parsed)) {\n repairs.push(`${nodeId}.propValues.${name} is not a number; dropped`)\n return undefined\n }\n return parsed\n }\n if (type === 'boolean') {\n const coerced = coerceBoolean(raw)\n if (coerced === undefined) {\n repairs.push(`${nodeId}.propValues.${name} is not a boolean; dropped`)\n }\n return coerced\n }\n if (type === 'icon') {\n // A page cannot fill an icon: the pick is an id and the path drawn from\n // it, and a word in its place draws nothing (AGL-3054). The property is\n // left for the site owner to pick.\n repairs.push(`${nodeId}.propValues.${name} is an icon, which the site owner picks from the library; dropped`)\n return undefined\n }\n if (typeof raw !== 'string' && typeof raw !== 'number' && typeof raw !== 'boolean') {\n repairs.push(`${nodeId}.propValues.${name} is not a value; dropped`)\n return undefined\n }\n const value = String(raw).trim()\n if (HOSTILE_TEXT.test(value)) {\n repairs.push(`${nodeId}.propValues.${name} carried markup or script; dropped`)\n return undefined\n }\n if (type === 'image') {\n if (isHttpsUrl(value)) return value\n const ref = parseMediaRef(value)\n if (!ref || (assetIds && !assetIds.has(ref.mediaId))) {\n repairs.push(\n `${nodeId}.propValues.${name} is neither a media reference this site holds nor an https: URL; dropped`,\n )\n return undefined\n }\n return value\n }\n if (type === 'href') {\n if (isHttpsUrl(value) || isRootRelativePath(value)) return value\n repairs.push(\n `${nodeId}.propValues.${name} is neither an https: URL nor a path on this site; dropped`,\n )\n return undefined\n }\n if (value.length > AI_TEXT_LIMITS.body) {\n repairs.push(\n `${nodeId}.propValues.${name} was over ${AI_TEXT_LIMITS.body} characters; truncated`,\n )\n return value.slice(0, AI_TEXT_LIMITS.body).trimEnd()\n }\n return value\n}\n\n/**\n * The site-record props of one node — an instance's `refId` and\n * `propValues`, a Form's `formId` and `datasetId` — checked against the ids\n * the caller supplied. They leave `props` before the palette pass, which\n * would drop them as undeclared, and come back in `kept` once checked.\n */\nfunction sanitizeReferenceProps(\n nodeId: string,\n componentId: string,\n props: Record<string, unknown>,\n refs: ReferenceSets,\n repairs: string[],\n): { props: Record<string, unknown>; kept: Record<string, unknown> } | { refusal: string } {\n const rest: Record<string, unknown> = { ...props }\n const kept: Record<string, unknown> = {}\n // A repeat over one of the site's datasets (AGL-3616), on any element: the\n // platform's own repeat, admitted against the datasets the caller supplies,\n // as a Form's dataset binding is. The palette leaves it off, since from a\n // description alone a model can only invent a dataset's id.\n if (AI_REPEAT_DATASET_PROP in rest) {\n const raw = rest[AI_REPEAT_DATASET_PROP]\n delete rest[AI_REPEAT_DATASET_PROP]\n const id = typeof raw === 'string' ? raw.trim() : ''\n if (id && refs.datasetIds?.has(id)) {\n kept[AI_REPEAT_DATASET_PROP] = id\n } else if (raw !== undefined && raw !== null && raw !== '') {\n repairs.push(`${nodeId}.${AI_REPEAT_DATASET_PROP} names a dataset this site does not have; dropped`)\n }\n }\n if (componentId === REUSABLE_INSTANCE_COMPONENT_ID) {\n const refId = typeof rest[AI_INSTANCE_REF_PROP] === 'string' ? String(rest[AI_INSTANCE_REF_PROP]).trim() : ''\n delete rest[AI_INSTANCE_REF_PROP]\n if (!refId || !refs.componentIds?.has(refId)) {\n return {\n refusal: `Reusable Component (${nodeId}) names a component this site does not have`,\n }\n }\n kept[AI_INSTANCE_REF_PROP] = refId\n const rawValues = rest[REUSABLE_INSTANCE_PROP_VALUES_KEY]\n delete rest[REUSABLE_INSTANCE_PROP_VALUES_KEY]\n if (rawValues !== undefined && !isRecord(rawValues)) {\n repairs.push(`${nodeId}.propValues is not an object; dropped`)\n }\n const declared = refs.componentProps[refId]\n const values: Record<string, unknown> = {}\n for (const [name, raw] of Object.entries(isRecord(rawValues) ? rawValues : {})) {\n if (raw === undefined || raw === null) continue\n if (!COMPONENT_PROP_NAME_PATTERN.test(name)) {\n repairs.push(`${nodeId}.propValues.${name} is not a prop name; dropped`)\n continue\n }\n if (declared && !(name in declared)) {\n repairs.push(`${nodeId}.propValues.${name} is not a prop of that component; dropped`)\n continue\n }\n if (refs.definesComponent && isAiComponentPropToken(raw)) {\n // A property of the component being defined, handed on whole; the\n // component step's check holds it to the kind this prop declares.\n values[name] = raw.trim()\n continue\n }\n const value = instancePropValue(\n nodeId,\n name,\n declared?.[name] ?? 'text',\n raw,\n refs.assetIds,\n repairs,\n )\n if (value !== undefined) values[name] = value\n }\n if (Object.keys(values).length) kept[REUSABLE_INSTANCE_PROP_VALUES_KEY] = values\n return { props: rest, kept }\n }\n if (componentId === FORM_COMPONENT_ID) {\n const bindings: Array<[prop: string, ids: Set<string> | null, record: string]> = [\n ['formId', refs.formIds, 'form'],\n ['datasetId', refs.datasetIds, 'dataset'],\n ]\n for (const [prop, ids, record] of bindings) {\n const raw = rest[prop]\n delete rest[prop]\n if (raw === undefined || raw === null || raw === '') continue\n const id = typeof raw === 'string' ? raw.trim() : ''\n if (id && ids?.has(id)) {\n kept[prop] = id\n } else {\n repairs.push(`${nodeId}.${prop} names a ${record} this site does not have; dropped`)\n }\n }\n }\n return { props: rest, kept }\n}\n\nfunction refusalCode(error: string): AiNodeTreeRefusalCode {\n if (/too large/i.test(error)) return 'too-large'\n if (/cannot be published/i.test(error)) return 'component'\n return 'structure'\n}\n\n/**\n * Whether the root the model wrote is the surface's root: the canvas wrapper\n * for a document surface (which the sanitizer exempts by the same shape), or\n * the named component otherwise.\n */\nfunction rootMatches(surfaceRoot: string, componentId: unknown): boolean {\n if (surfaceRoot === 'div') {\n return componentId == null || componentId === '' || componentId === 'div'\n }\n return componentId === surfaceRoot\n}\n\nexport function validateAiNodeTree(\n input: unknown,\n surface: AiSurface,\n context?: AiNodeTreeContext,\n): AiNodeTreeResult {\n try {\n return validate(input, surface, context)\n } catch (error) {\n return {\n ok: false,\n code: 'invalid-input',\n error: `The tree could not be read: ${error instanceof Error ? error.message : String(error)}`,\n }\n }\n}\n\nexport type AiNodePatchResult =\n | {\n ok: true\n props: Record<string, unknown>\n sx: Record<string, unknown> | undefined\n repairs: string[]\n }\n | { ok: false; error: string; code: AiNodeTreeRefusalCode }\n\n/**\n * One element's prop and style patch, held to the rules `validateAiNodeTree`\n * holds an element it places — for an edit to an element already on the\n * canvas, where there is no tree to validate.\n *\n * The same passes run: unknown props dropped, enums coerced, every string\n * held to its role and screened for markup, `sx` held to the key set and the\n * value grammar. The one difference is `required`: a patch is merged over the\n * props the element already has, so a required prop the patch does not name\n * is not missing.\n */\nexport function validateAiNodePatch(\n componentId: string,\n patch: { props?: unknown; sx?: unknown },\n context?: AiNodeTreeContext,\n): AiNodePatchResult {\n const entry = AI_PALETTE[componentId]\n if (!entry) {\n return {\n ok: false,\n code: 'component',\n error: `Component \"${componentId}\" is not in the palette`,\n }\n }\n const repairs: string[] = []\n const props = sanitizeProps(\n componentId,\n { ...entry, propsSchema: { ...entry.propsSchema, required: [] } },\n patch.props,\n context?.screenIds ? new Set(context.screenIds) : null,\n context?.assetIds ? new Set(context.assetIds) : null,\n repairs,\n )\n const sx =\n patch.sx === undefined ? undefined : sanitizeSx(componentId, patch.sx, repairs)\n return {\n ok: true,\n props: 'props' in props ? props.props : {},\n sx,\n repairs,\n }\n}\n\nfunction validate(\n input: unknown,\n surface: AiSurface,\n context: AiNodeTreeContext | undefined,\n): AiNodeTreeResult {\n const definition = AI_SURFACES[surface]\n if (!definition) {\n return {\n ok: false,\n code: 'invalid-input',\n error: `Unknown surface \"${surface}\"`,\n }\n }\n if (\n !isRecord(input) ||\n typeof input.rootId !== 'string' ||\n !isRecord(input.nodes)\n ) {\n return {\n ok: false,\n code: 'invalid-input',\n error: 'Expected an object with a string rootId and a nodes map',\n }\n }\n const rootId = input.rootId\n const nodes = input.nodes as Record<string, unknown>\n const root = nodes[rootId]\n if (!isRecord(root)) {\n return {\n ok: false,\n code: 'structure',\n error: 'Definition has no root node',\n }\n }\n if (!rootMatches(definition.root, root.componentId)) {\n return {\n ok: false,\n code: 'root',\n error: `A ${surface} starts with ${definition.root === 'div' ? 'the document wrapper' : `\"${definition.root}\"`}, not \"${String(root.componentId)}\"`,\n }\n }\n\n // The sanitizer keeps only the persisted node keys, and `sx` is not one of\n // them for a listing. Read it off every node first — from the node field\n // or from `props.sx`, which a model writes just as readily — and put it\n // back, checked, on the nodes that survive.\n const sxByNodeId = new Map<string, unknown>()\n const hiddenByNodeId = new Set<string>()\n for (const [id, node] of Object.entries(nodes)) {\n if (!isRecord(node)) continue\n const sx =\n node.sx !== undefined\n ? node.sx\n : isRecord(node.props)\n ? node.props.sx\n : undefined\n if (sx !== undefined) sxByNodeId.set(id, sx)\n if (node.hidden === true) hiddenByNodeId.add(id)\n }\n\n // A DAM reference (a `media:` value) is not a URL the sanitizer's\n // `src` policy admits — a listing must not carry another tenant's asset —\n // but on the tenant's own page it is exactly what an image should name.\n // Lift those values out before sanitizing and hand them back to the prop\n // pass, which holds them to the asset set the caller supplied.\n // A binding token the caller admitted (AGL-2909) is lifted the same way:\n // `{{entry.coverImage}}` is no address the sanitizer knows, and the prop\n // pass holds it to the tokens the caller named.\n const bindingTokens = context?.bindingTokens ? new Set(context.bindingTokens) : null\n // A reusable component's own property tokens (AGL-2908) are lifted too, and\n // kept as written rather than handed back to the prop pass: `{{prop.variant}}`\n // is no value a dropdown, a switch, an address or a visibility directive\n // admits. Copy keeps its tokens without lifting, as the text they are.\n const definesComponent = context?.definesComponent === true\n const codeBuilt = context?.codeBuilt === true\n const mediaByNodeId = new Map<string, Record<string, string>>()\n const boundByNodeId = new Map<string, Record<string, string>>()\n // A code-built Icon's drawing, from the library by the id it names (AGL-3660).\n const iconByNodeId = new Map<string, { iconId: string; iconPath: string }>()\n const forSanitizer: Record<string, unknown> = {}\n for (const [id, node] of Object.entries(nodes)) {\n if (!isRecord(node) || !isRecord(node.props)) {\n forSanitizer[id] = node\n continue\n }\n if (codeBuilt && node.componentId === AI_ICON_COMPONENT_ID) {\n const { iconId, ...props } = node.props\n const rest = { ...props }\n delete rest['iconPath']\n const icon = aiIconOfId(iconId)\n if (icon) iconByNodeId.set(id, { iconId: icon.id, iconPath: icon.path })\n forSanitizer[id] = { ...node, props: rest }\n continue\n }\n const entry = AI_PALETTE[String(node.componentId)]\n const roles = entry?.propRoles ?? {}\n const props: Record<string, unknown> = { ...node.props }\n const lifted: Record<string, string> = {}\n const bound: Record<string, string> = {}\n for (const [key, value] of Object.entries(props)) {\n if (typeof value !== 'string') continue\n const role = roles[key]\n if (\n definesComponent &&\n isAiComponentPropToken(value) &&\n (AI_COMPONENT_VISIBILITY_PROPS.includes(key) ||\n (entry?.propsSchema.properties[key] !== undefined && role !== 'text'))\n ) {\n bound[key] = value.trim()\n delete props[key]\n continue\n }\n if (\n (role === 'media' && parseMediaRef(value.trim())) ||\n ((role === 'media' || role === 'url') && bindingTokens?.has(value.trim()))\n ) {\n lifted[key] = value\n delete props[key]\n }\n }\n if (Object.keys(lifted).length) mediaByNodeId.set(id, lifted)\n if (Object.keys(bound).length) boundByNodeId.set(id, bound)\n forSanitizer[id] = { ...node, props }\n }\n\n const refs: ReferenceSets = {\n componentIds: context?.componentIds ? new Set(context.componentIds) : null,\n componentProps: context?.componentProps ?? {},\n formIds: context?.formIds ? new Set(context.formIds) : null,\n datasetIds: context?.datasetIds ? new Set(context.datasetIds) : null,\n assetIds: context?.assetIds ? new Set(context.assetIds) : null,\n definesComponent,\n }\n // An instance is admitted only where the caller grounded it in the site's\n // components; the reference itself is checked on the node below.\n const surfaceAllow = codeBuilt ? [...definition.allow, ...(definition.codeOnly ?? [])] : definition.allow\n const allow =\n refs.componentIds && INSTANCE_SURFACES.has(surface)\n ? [...surfaceAllow, REUSABLE_INSTANCE_COMPONENT_ID]\n : surfaceAllow\n const sanitized = sanitizePortableDefinition(\n { rootId, nodes: forSanitizer },\n { componentIds: allow },\n )\n if (sanitized.ok === false) {\n return {\n ok: false,\n code: refusalCode(sanitized.error),\n error: sanitized.error,\n }\n }\n\n const screenIds = context?.screenIds ? new Set(context.screenIds) : null\n const assetIds = refs.assetIds\n const repairs: string[] = []\n const output: NodesMap = {}\n const rootIsWrapper =\n rootMatches('div', root.componentId) && definition.root === 'div'\n const minted = new Map<string, string>()\n const mint = (id: string): string => {\n const fresh =\n id === rootId && rootIsWrapper\n ? CANVAS_ROOT_ELEMENT_ID\n : createIdUrlSafe()\n minted.set(id, fresh)\n return fresh\n }\n\n /** Each visited node's parent by the model's own ids, for the parentId check. */\n const parentOf = new Map<string, string>()\n const queue: Array<{ id: string; parentId: string | null }> = [\n { id: rootId, parentId: null },\n ]\n mint(rootId)\n while (queue.length) {\n const { id, parentId } = queue.shift() as {\n id: string\n parentId: string | null\n }\n const node = sanitized.nodes[id]\n const entry = AI_PALETTE[node.componentId]\n if (!entry) {\n return {\n ok: false,\n code: 'component',\n error: `Component \"${node.componentId}\" is not in the palette`,\n }\n }\n const newId = minted.get(id) as string\n const raw = nodes[id]\n if (isRecord(raw)) {\n // The sanitizer drops silently; the model is told what went.\n for (const key of STRIPPED_NODE_KEYS) {\n if (raw[key] !== undefined) {\n repairs.push(\n `${id}.${key} is not something a generated node may set; dropped`,\n )\n }\n }\n if (raw.hidden !== undefined && typeof raw.hidden !== 'boolean') {\n repairs.push(`${id}.hidden is not a boolean; dropped`)\n }\n if (raw.nodes !== undefined && !Array.isArray(raw.nodes)) {\n repairs.push(\n `${id}.nodes is not a list of child ids; its children were dropped`,\n )\n }\n if (\n raw.parentId !== undefined &&\n raw.parentId !== null &&\n raw.parentId !== (parentId === null ? null : parentOf.get(id))\n ) {\n repairs.push(\n `${id}.parentId disagreed with where the tree places it; recomputed`,\n )\n }\n if (isRecord(raw.props)) {\n const lifted = mediaByNodeId.get(id) ?? {}\n const kept = boundByNodeId.get(id) ?? {}\n for (const key of Object.keys(raw.props)) {\n if (iconByNodeId.has(id) && (key === 'iconId' || key === 'iconPath')) continue\n if (\n key !== 'sx' &&\n lifted[key] === undefined &&\n kept[key] === undefined &&\n node.props?.[key] === undefined &&\n raw.props[key] !== undefined\n ) {\n repairs.push(\n `${id}.${key} was an unsafe handler, address or markup; dropped`,\n )\n }\n }\n }\n }\n const children: string[] = []\n for (const childId of node.nodes ?? []) {\n if (minted.has(childId)) {\n repairs.push(\n `${childId} was listed under more than one parent; the later listing was dropped`,\n )\n continue\n }\n const child = sanitized.nodes[childId]\n if (!child) continue\n const childEntry = AI_PALETTE[child.componentId]\n if (!childEntry) {\n return {\n ok: false,\n code: 'component',\n error: `Component \"${child.componentId}\" is not in the palette`,\n }\n }\n if (!entry.acceptsChildren) {\n return {\n ok: false,\n code: 'lineage',\n error: `${entry.displayName} (${id}) cannot hold other elements, but lists ${childId}`,\n }\n }\n if (\n !linealRelationshipPermits(\n {\n componentId: child.componentId,\n pluginId: childEntry.pluginId,\n restrictParent: childEntry.restrictParent,\n },\n {\n componentId: node.componentId,\n pluginId: entry.pluginId,\n restrictChildren: entry.restrictChildren,\n },\n )\n ) {\n return {\n ok: false,\n code: 'lineage',\n error: `${childEntry.displayName} (${childId}) cannot be placed inside ${entry.displayName} (${id})`,\n }\n }\n children.push(mint(childId))\n parentOf.set(childId, id)\n queue.push({ id: childId, parentId: newId })\n }\n\n const reference = sanitizeReferenceProps(\n id,\n node.componentId,\n { ...node.props, ...mediaByNodeId.get(id) },\n refs,\n repairs,\n )\n if ('refusal' in reference) {\n return { ok: false, code: 'reference', error: reference.refusal }\n }\n // A required prop the component binds is present: its value is the token.\n const boundProps = boundByNodeId.get(id)\n const propsResult = sanitizeProps(\n id,\n boundProps\n ? {\n ...entry,\n propsSchema: {\n ...entry.propsSchema,\n required: entry.propsSchema.required.filter((name) => boundProps[name] === undefined),\n },\n }\n : entry,\n reference.props,\n screenIds,\n assetIds,\n repairs,\n bindingTokens,\n )\n if ('missing' in propsResult) {\n return {\n ok: false,\n code: 'required-prop',\n error: `${entry.displayName} (${id}) is missing its required \"${propsResult.missing}\" prop`,\n }\n }\n const sx = sanitizeSx(id, sxByNodeId.get(id), repairs)\n output[newId] = {\n $id: newId,\n type: NodeType.NODE,\n componentId: node.componentId,\n pluginId: entry.pluginId,\n parentId,\n nodes: children,\n props: { ...propsResult.props, ...reference.kept, ...boundProps, ...iconByNodeId.get(id) },\n ...(sx ? { sx } : {}),\n ...(hiddenByNodeId.has(id) ? { hidden: true } : {}),\n }\n }\n\n // The save's own measurement (msgpack), not a JSON string length: the\n // ceiling is stated in those bytes, and a UTF-16 length reads multi-byte\n // copy as smaller than the document the save will refuse.\n const bytes = nodeMapBytes(output)\n if (bytes > NODE_MAP_MAX_BYTES) {\n return {\n ok: false,\n code: 'too-large',\n error: `The tree is ${bytes} bytes; the stored ceiling is ${NODE_MAP_MAX_BYTES}`,\n }\n }\n const sourceIds: Record<string, string> = {}\n for (const [source, fresh] of minted) sourceIds[fresh] = source\n return {\n ok: true,\n rootId: minted.get(rootId) as string,\n nodes: output,\n repairs,\n sourceIds,\n }\n}\n"],"names":["AI_TEXT_LIMITS","isHeadlineVariant","nodeCapabilityProps","AI_NODE_CAPABILITIES","AI_PALETTE","AI_SURFACES","AI_SX_TOKENS","linealRelationshipPermits","NODE_MAP_MAX_BYTES","nodeMapBytes","parseMediaRef","COMPONENT_PROP_NAME_PATTERN","REUSABLE_INSTANCE_COMPONENT_ID","REUSABLE_INSTANCE_PROP_VALUES_KEY","createIdUrlSafe","CANVAS_ROOT_ELEMENT_ID","NodeType","AI_ICON_COMPONENT_ID","aiIconOfId","AI_COMPONENT_VISIBILITY_PROPS","isAiComponentPropToken","sanitizePortableDefinition","AI_SX_ALLOWED_KEYS","Set","HOSTILE_TEXT","SX_VALUE","STRIPPED_NODE_KEYS","SCREEN_ID","ICON_PICKER_FIELD","MAX_SX_KEYS","PLAIN_STRING_MAX","paletteTokens","palette","breakpoints","typographyVariants","isRecord","value","Array","isArray","isHttpsUrl","test","URL","protocol","isContactHref","isRootRelativePath","sxValueAllowed","key","Number","isFinite","trimmed","trim","has","sanitizeSx","nodeId","sx","repairs","undefined","push","out","kept","Object","entries","responsive","breakpoint","inner","keys","length","coerceEnum","schema","enum","wanted","toLowerCase","find","option","coerceBoolean","coerceNumber","parsed","NaN","type","isInteger","minimum","maximum","textLimitFor","entry","name","props","declared","textLimits","variant","Math","min","body","headline","sanitizeString","raw","screenIds","assetIds","bindingTokens","propFields","role","propRoles","limit","slice","trimEnd","ref","mediaId","pattern","RegExp","minLength","maxLength","CAPABLE_ENTRIES","WeakMap","withNodeCapabilities","cached","get","capability","acceptsChildren","merged","propsSchema","properties","set","AI_OWNER_AUDIO_PLUGIN_IDS","aiOwnerAudioRefusal","pluginId","text","sanitizeProps","paletteEntry","source","audioRefusal","displayName","coerced","join","String","cleaned","required","missing","INSTANCE_SURFACES","FORM_COMPONENT_ID","AI_REPEAT_DATASET_PROP","AI_INSTANCE_REF_PROP","instancePropValue","sanitizeReferenceProps","componentId","refs","rest","id","datasetIds","refId","componentIds","refusal","rawValues","componentProps","values","definesComponent","bindings","formIds","prop","ids","record","refusalCode","error","rootMatches","surfaceRoot","validateAiNodeTree","input","surface","context","validate","ok","code","Error","message","validateAiNodePatch","patch","definition","rootId","nodes","root","sxByNodeId","Map","hiddenByNodeId","node","hidden","add","codeBuilt","mediaByNodeId","boundByNodeId","iconByNodeId","forSanitizer","iconId","icon","iconPath","path","roles","lifted","bound","includes","surfaceAllow","allow","codeOnly","sanitized","output","rootIsWrapper","minted","mint","fresh","parentOf","queue","parentId","shift","newId","children","childId","child","childEntry","restrictParent","restrictChildren","reference","boundProps","propsResult","filter","$id","NODE","bytes","sourceIds"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,cAAc,EACdC,iBAAiB,EACjBC,mBAAmB,QAId,kBAAc;AACrB,SACEC,oBAAoB,EACpBC,UAAU,EACVC,WAAW,EACXC,YAAY,QACP,4BAAwB;AAC/B,SAASC,yBAAyB,QAAQ,sCAAqC;AAC/E,SACEC,kBAAkB,EAClBC,YAAY,QACP,0CAAyC;AAChD,SAASC,aAAa,QAAQ,mCAAkC;AAChE,SACEC,2BAA2B,EAC3BC,8BAA8B,EAC9BC,iCAAiC,QAC5B,iDAAgD;AACvD,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,sBAAsB,QAAQ,2CAA0C;AACjF,SAASC,QAAQ,QAAuB,2BAA0B;AAElE,SAASC,oBAAoB,EAAEC,UAAU,QAAQ,uBAAmB;AACpE,SACEC,6BAA6B,EAC7BC,sBAAsB,QACjB,6BAAyB;AAEhC,SAASC,0BAA0B,QAAQ,mDAAkD;AA0H7F;;;;;CAKC,GACD,OAAO,MAAMC,qBAA0C,IAAIC,IAAI;IAC7D,UAAU;IACV;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,QAAQ;IACR;IACA;IACA;IACA;IACA;IACA,aAAa;IACb;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,SAAS;IACT;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,UAAU;IACV;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,UAAU;IACV;IACA;IACA,OAAO;IACP;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,OAAO;IACP;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAC;AAEF;;;;CAIC,GACD,OAAO,MAAMC,eACX,2LAA0L;AAE5L;;;;;;CAMC,GACD,OAAO,MAAMC,WAAW,qCAAoC;AAE5D;;;;CAIC,GACD,MAAMC,qBAAqB;IACzB;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,YAAY;AAClB,sFAAsF,GACtF,MAAMC,oBAAoB;AAC1B,MAAMC,cAAc;AACpB,+EAA+E,GAC/E,MAAMC,mBAAmB;AAEzB,MAAMC,gBAAgB,IAAIR,IAAYjB,aAAa0B,OAAO;AAC1D,MAAMC,cAAc,IAAIV,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UAAUpI,KAAK,EACfU,WACAC,UACAzC,SACA0C;QAEF,IAAI,aAAa0H,aAAa;YAC5B,OAAO;gBACLnD,IAAI;gBACJC,MAAM;gBACNT,OAAO,GAAG7E,MAAM8C,WAAW,CAAC,EAAE,EAAEgB,GAAG,2BAA2B,EAAE0E,YAAYpF,OAAO,CAAC,MAAM,CAAC;YAC7F;QACF;QACA,MAAMjF,KAAKF,WAAW6F,IAAIiC,WAAWhE,GAAG,CAAC+B,KAAK1F;QAC9CkJ,MAAM,CAACS,MAAM,GAAG;YACdW,KAAKX;YACLpI,MAAM9D,SAAS8M,IAAI;YACnBhF,aAAauC,KAAKvC,WAAW;YAC7BnB,UAAUxC,MAAMwC,QAAQ;YACxBqF;YACAhC,OAAOmC;YACP9H,OAAO,aAAKsI,YAAYtI,KAAK,EAAKoI,UAAU9J,IAAI,EAAK+J,YAAe/B,aAAazE,GAAG,CAAC+B;WACjF3F,KAAK;YAAEA;QAAG,IAAI,CAAC,GACf8H,eAAejI,GAAG,CAAC8F,MAAM;YAAEqC,QAAQ;QAAK,IAAI,CAAC;IAErD;IAEA,sEAAsE;IACtE,yEAAyE;IACzE,0DAA0D;IAC1D,MAAMyC,QAAQtN,aAAagM;IAC3B,IAAIsB,QAAQvN,oBAAoB;QAC9B,OAAO;YACLgK,IAAI;YACJC,MAAM;YACNT,OAAO,CAAC,YAAY,EAAE+D,MAAM,8BAA8B,EAAEvN,oBAAoB;QAClF;IACF;IACA,MAAMwN,YAAoC,CAAC;IAC3C,KAAK,MAAM,CAACjG,QAAQ8E,MAAM,IAAIF,OAAQqB,SAAS,CAACnB,MAAM,GAAG9E;IACzD,OAAO;QACLyC,IAAI;QACJO,QAAQ4B,OAAOzF,GAAG,CAAC6D;QACnBC,OAAOyB;QACPlJ;QACAyK;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/runtime/ai-node-tree.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n AI_TEXT_LIMITS,\n isHeadlineVariant,\n nodeCapabilityProps,\n type AiPaletteEntry,\n type AiPropSchema,\n type AiSurface,\n} from './ai-palette'\nimport {\n AI_NODE_CAPABILITIES,\n AI_PALETTE,\n AI_SURFACES,\n AI_SX_TOKENS,\n} from './ai-palette.generated'\nimport { linealRelationshipPermits } from '@aglyn/aglyn/app-utils/lineal-order'\nimport {\n NODE_MAP_MAX_BYTES,\n nodeMapBytes,\n} from '@aglyn/aglyn/app-utils/measure-node-map'\nimport { parseMediaRef } from '@aglyn/aglyn/app-utils/media-ref'\nimport {\n COMPONENT_PROP_NAME_PATTERN,\n REUSABLE_INSTANCE_COMPONENT_ID,\n REUSABLE_INSTANCE_PROP_VALUES_KEY,\n} from '@aglyn/aglyn/app-utils/reusable-component-keys'\nimport { createIdUrlSafe } from '@aglyn/aglyn/foundation/constants/app'\nimport { CANVAS_ROOT_ELEMENT_ID } from '@aglyn/aglyn/foundation/constants/canvas'\nimport { NodeType, type NodesMap } from '@aglyn/aglyn/types/nodes'\nimport type { AiComponentPropTypes } from '../model/ai-site-inventory'\nimport { AI_ICON_COMPONENT_ID, aiIconOfId, aiIsIconPathData } from './ai-icon-library'\nimport {\n AI_COMPONENT_VISIBILITY_PROPS,\n isAiComponentPropToken,\n} from './ai-component-bindings'\n\nimport { sanitizePortableDefinition } from '@aglyn/aglyn/app-utils/node-definition-sanitizer'\n\n/**\n * The one path an AI-emitted node tree takes into storage (AGL-2905).\n *\n * A model answers with a flat node map in the shape the canvas persists.\n * Nothing about that map is trusted: the component ids, the parent/child\n * pairs, every prop and every `sx` key are what the model chose to write,\n * and the renderer spreads props onto the DOM. So the tree is first held to\n * the same sanitizer a marketplace install passes — reachability from the\n * root, the surface's component allowlist, the persisted node keys, `href`\n * and `src` protocols, a size cap — and then to what a listing never needed\n * checking because a human authored it in the editor:\n *\n * - the parent/child restrictions the besigner enforces on drop\n * (`restrictChildren` / `restrictParent`), and whether an element can hold\n * children at all;\n * - every prop against the generated palette's schema — unknown props are\n * dropped, enum values coerced case-insensitively, a required prop that is\n * missing refuses the tree;\n * - `sx` against a fixed key set and a value grammar of theme tokens, numbers\n * and CSS lengths or keywords, with nothing that can reach a URL or a\n * stylesheet;\n * - copy length by role — a headline, a paragraph, a button label;\n * - links to a screen the host has, a root-relative path or an `https:` URL,\n * and media to a DAM reference or an `https:` URL;\n * - the stored-node-map byte ceiling, measured the way the save measures it.\n *\n * ## The site's own records, when the caller names them (AGL-2935)\n *\n * A reusable-component instance, a form picked on the Forms page and a\n * dataset are each \"a reference into another document\", which is why the\n * palette leaves them off: from a description alone a model can only invent\n * an id. A generator that has read the site's inventory can name real ones,\n * and the building doctrine requires it to — a repeat is placed as\n * instances of one component, and a form is bound by id rather than drawn\n * inline. So the three are admitted exactly as screen links are: only\n * against the ids the caller supplies. With no `componentIds` an instance is\n * still refused; with no `formIds` or `datasetIds` the binding is dropped.\n *\n * What comes out is the flat `NodesMap` `encodeStoredNodes` takes, with every\n * id minted fresh the way a preset graft mints them, so nothing the model\n * wrote can collide with a node already on the canvas. `sourceIds` maps each\n * minted id back to the id the model wrote, so a caller can quote a refused\n * subtree in the model's own words. Every drop is listed in `repairs`; every\n * refusal names its `code`. The function never throws.\n */\n\nexport type AiNodeTreeRefusalCode =\n /** Not an object with a `rootId` and a `nodes` map, or an unknown surface. */\n | 'invalid-input'\n /** The root node carries a component the surface does not start with. */\n | 'root'\n /** A structural failure the sanitizer named: missing node, empty tree. */\n | 'structure'\n /** A component id outside the surface's allowlist. */\n | 'component'\n /** A parent/child pair the besigner would refuse on drop. */\n | 'lineage'\n /** A prop the palette marks required is absent. */\n | 'required-prop'\n /** Over the sanitizer's or the stored-node-map's byte ceiling. */\n | 'too-large'\n /** A component instance naming a component the site does not have. */\n | 'reference'\n\nexport type AiNodeTreeResult =\n | {\n ok: true\n rootId: string\n nodes: NodesMap\n repairs: string[]\n /** Each minted id → the id the model wrote for that node. */\n sourceIds: Record<string, string>\n }\n | { ok: false; error: string; code: AiNodeTreeRefusalCode }\n\nexport interface AiNodeTreeContext {\n /** Screen ids a `screen` prop may name. Absent: any well-formed id. */\n screenIds?: Iterable<string>\n /** DAM media ids a `media` prop may reference. Absent: any well-formed reference. */\n assetIds?: Iterable<string>\n /**\n * Reusable components an instance may place. Absent: no instance is\n * admitted, which is the palette's own rule for a tree nobody grounded.\n */\n componentIds?: Iterable<string>\n /** Declared props per component id, which an instance's values are held to. */\n componentProps?: Record<string, AiComponentPropTypes>\n /** Forms on the Forms page a Form element may bind by `formId`. */\n formIds?: Iterable<string>\n /** Datasets a Form element may write to by `datasetId`. */\n datasetIds?: Iterable<string>\n /**\n * Binding tokens a `url` or `media` prop may hold whole — an Image whose\n * `src` is `{{entry.coverImage}}` on a page template, filled per record\n * when the page renders (AGL-2909). Absent: a token in either role is\n * dropped like any other value that is not an address.\n */\n bindingTokens?: Iterable<string>\n /**\n * The tree defines a reusable component (AGL-2908). A field that is not\n * copy — a switch, a dropdown, a screen, an address, a picture, a number —\n * and the `hideIf` and `hideUnless` directives may then hold one of the\n * component's own `{{prop.<name>}}` tokens as their whole value, and a\n * placed component may be handed one in its `propValues`; each is kept as\n * written. Which property a token names, and whether its kind binds to that\n * field, is the component step's check (`ai-component-bindings.ts`).\n * Absent: such a token is dropped like any value the field cannot hold.\n */\n definesComponent?: boolean\n /**\n * The tree was composed by the platform's own code — the layout language\n * compiler (AGL-3660) — and not written by a model. The surface's code-only\n * elements are then admitted (an Icon, and a layout's Drawer with its Menu\n * Button), and an Icon keeps the id and the path the icon library gives\n * the id it names (`ai-icon-library.ts`): the path is the library's, never\n * the tree's. Absent: a model's tree, held to the surface's catalog.\n */\n codeBuilt?: boolean\n}\n\n/**\n * `sx` keys a model may set: spacing, color, typography, layout, borders,\n * display, flex and grid. Fixed rather than derived — MUI's system accepts\n * far more (pseudo-selectors, nested selectors, arbitrary CSS properties)\n * and every one of those is a way to reach outside the element.\n */\nexport const AI_SX_ALLOWED_KEYS: ReadonlySet<string> = new Set([\n // spacing\n 'm',\n 'mt',\n 'mr',\n 'mb',\n 'ml',\n 'mx',\n 'my',\n 'margin',\n 'marginTop',\n 'marginRight',\n 'marginBottom',\n 'marginLeft',\n 'p',\n 'pt',\n 'pr',\n 'pb',\n 'pl',\n 'px',\n 'py',\n 'padding',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'gap',\n 'rowGap',\n 'columnGap',\n // color\n 'color',\n 'bgcolor',\n 'backgroundColor',\n 'borderColor',\n 'opacity',\n // typography\n 'typography',\n 'fontSize',\n 'fontWeight',\n 'fontFamily',\n 'fontStyle',\n 'lineHeight',\n 'letterSpacing',\n 'textAlign',\n 'textTransform',\n 'textDecoration',\n 'whiteSpace',\n 'textOverflow',\n 'overflowWrap',\n 'wordBreak',\n // layout\n 'width',\n 'minWidth',\n 'maxWidth',\n 'height',\n 'minHeight',\n 'maxHeight',\n 'boxSizing',\n 'overflow',\n 'overflowX',\n 'overflowY',\n 'position',\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'zIndex',\n 'aspectRatio',\n 'objectFit',\n // borders\n 'border',\n 'borderTop',\n 'borderRight',\n 'borderBottom',\n 'borderLeft',\n 'borderWidth',\n 'borderStyle',\n 'borderRadius',\n 'boxShadow',\n // display\n 'display',\n 'visibility',\n // flex\n 'flexDirection',\n 'flexWrap',\n 'justifyContent',\n 'alignItems',\n 'alignContent',\n 'alignSelf',\n 'justifySelf',\n 'flex',\n 'flexGrow',\n 'flexShrink',\n 'flexBasis',\n 'order',\n // grid\n 'gridTemplateColumns',\n 'gridTemplateRows',\n 'gridColumn',\n 'gridRow',\n 'gridArea',\n 'gridAutoFlow',\n 'gridAutoColumns',\n 'gridAutoRows',\n 'justifyItems',\n 'placeItems',\n 'placeContent',\n])\n\n/**\n * Substrings no string a model wrote may carry, in a prop or an `sx` value.\n * Exported for the theme tool's component style values (AGL-2938), which are\n * the same kind of CSS value written into a theme instead of a node.\n */\nexport const HOSTILE_TEXT =\n /<\\s*\\/?\\s*(script|iframe|object|embed|svg|style|link|meta|base|frame|form|input|img)\\b|javascript:|vbscript:|data:text\\/html|expression\\s*\\(|url\\s*\\(|@import|!important|\\bon[a-z]+\\s*=/i\n\n/**\n * A CSS value a model may write into `sx`: lengths, numbers, keywords,\n * shorthands (`1px solid`), functions with plain arguments (`repeat(3, 1fr)`,\n * `rgba(0, 0, 0, 0.2)`), hex colors and theme tokens. No quotes, no\n * semicolons, no braces, no angle brackets, no colons — which is what keeps\n * a `url(`, a selector or a second declaration out.\n */\nexport const SX_VALUE = /^[A-Za-z0-9#.,%()\\s\\-_/+*]{1,100}$/\n\n/**\n * Node fields the sanitizer strips that a model has no business writing —\n * each is a way to reach past the node's own box, and each is named in\n * `repairs` so a route can tell the model what it lost.\n */\nconst STRIPPED_NODE_KEYS = [\n 'className',\n 'interactions',\n 'styleOverrides',\n 'attrOverrides',\n 'presetRef',\n] as const\n\nconst SCREEN_ID = /^[A-Za-z0-9_-]{1,64}$/\n/** The field an icon is picked with; its value carries a drawing no model can write. */\nconst ICON_PICKER_FIELD = 'icon-picker'\nconst MAX_SX_KEYS = 40\n/** A string prop with no role of its own — a color, a CSS length, an icon id. */\nconst PLAIN_STRING_MAX = 500\n\nconst paletteTokens = new Set<string>(AI_SX_TOKENS.palette)\nconst breakpoints = new Set<string>(AI_SX_TOKENS.breakpoints)\nconst typographyVariants = new Set<string>(AI_SX_TOKENS.typographyVariants)\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/** An `https:` address that parses as one. */\nexport function isHttpsUrl(value: string): boolean {\n if (!/^https:\\/\\//i.test(value)) return false\n try {\n return new URL(value).protocol === 'https:'\n } catch {\n return false\n }\n}\n\n/**\n * A link that calls or writes (AGL-3979): `tel:` and a phone number's digits,\n * a `+` only first, or `mailto:` and one address with nothing after it. The\n * number or address itself is held to the facts the job was given by the\n * layout's own contact check, which reads every prop.\n */\nexport function isContactHref(value: string): boolean {\n return /^tel:\\+?\\d{7,15}$/.test(value) || /^mailto:[^\\s@<>?#\"]+@[^\\s@<>?#\"]+\\.[^\\s@<>?#\".]{2,}$/i.test(value)\n}\n\n/** A path on this site: one leading slash, never a scheme-relative `//`. */\nexport function isRootRelativePath(value: string): boolean {\n return /^\\/(?!\\/)[^\\s<>\"'`\\\\]*$/.test(value)\n}\n\nfunction sxValueAllowed(key: string, value: unknown): boolean {\n if (typeof value === 'number') return Number.isFinite(value)\n if (typeof value !== 'string') return false\n const trimmed = value.trim()\n if (!trimmed || HOSTILE_TEXT.test(trimmed)) return false\n if (paletteTokens.has(trimmed)) return true\n if (key === 'typography' && typographyVariants.has(trimmed)) return true\n return SX_VALUE.test(trimmed)\n}\n\n/**\n * The allowed slice of an `sx` object, with a line per key or value dropped.\n * Responsive objects keep only breakpoint keys; anything deeper — a\n * pseudo-selector, a nested selector, an array — is not a value at all.\n */\nfunction sanitizeSx(\n nodeId: string,\n sx: unknown,\n repairs: string[],\n): Record<string, unknown> | undefined {\n if (!isRecord(sx)) {\n if (sx !== undefined)\n repairs.push(`${nodeId}: sx is not an object; dropped`)\n return undefined\n }\n const out: Record<string, unknown> = {}\n let kept = 0\n for (const [key, value] of Object.entries(sx)) {\n if (!AI_SX_ALLOWED_KEYS.has(key)) {\n repairs.push(`${nodeId}: sx.${key} is not an allowed style; dropped`)\n continue\n }\n if (kept >= MAX_SX_KEYS) {\n repairs.push(\n `${nodeId}: sx.${key} is past the ${MAX_SX_KEYS}-key ceiling; dropped`,\n )\n continue\n }\n if (isRecord(value)) {\n const responsive: Record<string, unknown> = {}\n for (const [breakpoint, inner] of Object.entries(value)) {\n if (!breakpoints.has(breakpoint)) {\n repairs.push(\n `${nodeId}: sx.${key}.${breakpoint} is not a breakpoint; dropped`,\n )\n continue\n }\n if (!sxValueAllowed(key, inner)) {\n repairs.push(\n `${nodeId}: sx.${key}.${breakpoint} is not an allowed value; dropped`,\n )\n continue\n }\n responsive[breakpoint] =\n typeof inner === 'string' ? inner.trim() : inner\n }\n if (Object.keys(responsive).length) {\n out[key] = responsive\n kept += 1\n }\n continue\n }\n if (!sxValueAllowed(key, value)) {\n repairs.push(`${nodeId}: sx.${key} is not an allowed value; dropped`)\n continue\n }\n out[key] = typeof value === 'string' ? value.trim() : value\n kept += 1\n }\n return kept ? out : undefined\n}\n\nfunction coerceEnum(schema: AiPropSchema, value: unknown): string | undefined {\n if (typeof value !== 'string' || !schema.enum) return undefined\n const wanted = value.trim().toLowerCase()\n return schema.enum.find((option) => option.toLowerCase() === wanted)\n}\n\nfunction coerceBoolean(value: unknown): boolean | undefined {\n if (typeof value === 'boolean') return value\n if (value === 'true') return true\n if (value === 'false') return false\n return undefined\n}\n\nfunction coerceNumber(\n schema: AiPropSchema,\n value: unknown,\n): number | undefined {\n const parsed =\n typeof value === 'number'\n ? value\n : typeof value === 'string' && value.trim() !== ''\n ? Number(value)\n : NaN\n if (!Number.isFinite(parsed)) return undefined\n if (schema.type === 'integer' && !Number.isInteger(parsed)) return undefined\n if (schema.minimum !== undefined && parsed < schema.minimum) return undefined\n if (schema.maximum !== undefined && parsed > schema.maximum) return undefined\n return parsed\n}\n\nfunction textLimitFor(\n entry: AiPaletteEntry,\n name: string,\n props: Record<string, unknown>,\n): number {\n const declared = entry.textLimits[name]\n // A heading's copy is held to the headline ceiling, decided by the variant\n // the same node carries; anything else keeps the ceiling the palette\n // assigned to the prop.\n if (name === 'children' && isHeadlineVariant(props.variant)) {\n return Math.min(declared ?? AI_TEXT_LIMITS.body, AI_TEXT_LIMITS.headline)\n }\n return declared ?? AI_TEXT_LIMITS.body\n}\n\n/**\n * One string prop against its role. Returns the value to store, or\n * `undefined` with the reason pushed to `repairs`. A binding token the\n * caller admitted passes a `url` or `media` role whole.\n */\nfunction sanitizeString(\n nodeId: string,\n entry: AiPaletteEntry,\n name: string,\n schema: AiPropSchema,\n raw: string,\n props: Record<string, unknown>,\n screenIds: Set<string> | null,\n assetIds: Set<string> | null,\n repairs: string[],\n bindingTokens: ReadonlySet<string> | null = null,\n): string | undefined {\n let value = raw.trim()\n if (HOSTILE_TEXT.test(value)) {\n repairs.push(`${nodeId}.${name} carried markup or script; dropped`)\n return undefined\n }\n // An icon is drawn from the path its picker stores beside the id, which a\n // model can never supply, so an icon a model names draws nothing where the\n // page is published (AGL-3054). The site owner picks it.\n if (entry.propFields[name] === ICON_PICKER_FIELD) {\n repairs.push(`${nodeId}.${name} is an icon, which the site owner picks from the library; dropped`)\n return undefined\n }\n const role = entry.propRoles[name]\n switch (role) {\n case 'text': {\n const limit = textLimitFor(entry, name, props)\n if (value.length > limit) {\n value = value.slice(0, limit).trimEnd()\n repairs.push(\n `${nodeId}.${name} was over ${limit} characters; truncated`,\n )\n }\n break\n }\n case 'url': {\n if (bindingTokens?.has(value)) break\n if (!isHttpsUrl(value) && !isRootRelativePath(value) && !isContactHref(value)) {\n repairs.push(\n `${nodeId}.${name} is neither an https: URL nor a path on this site; dropped`,\n )\n return undefined\n }\n break\n }\n case 'screen': {\n if (screenIds ? !screenIds.has(value) : !SCREEN_ID.test(value)) {\n repairs.push(\n `${nodeId}.${name} names a page this site does not have; dropped`,\n )\n return undefined\n }\n break\n }\n case 'media': {\n if (bindingTokens?.has(value)) break\n if (isHttpsUrl(value)) break\n const ref = parseMediaRef(value)\n if (!ref || (assetIds && !assetIds.has(ref.mediaId))) {\n repairs.push(\n `${nodeId}.${name} is neither a media reference this site holds nor an https: URL; dropped`,\n )\n return undefined\n }\n break\n }\n default: {\n if (value.length > PLAIN_STRING_MAX) {\n repairs.push(\n `${nodeId}.${name} is over ${PLAIN_STRING_MAX} characters; dropped`,\n )\n return undefined\n }\n }\n }\n if (schema.pattern && !new RegExp(schema.pattern).test(value)) {\n repairs.push(`${nodeId}.${name} does not match its pattern; dropped`)\n return undefined\n }\n if (schema.minLength !== undefined && value.length < schema.minLength) {\n repairs.push(\n `${nodeId}.${name} is shorter than ${schema.minLength} characters; dropped`,\n )\n return undefined\n }\n if (schema.maxLength !== undefined && value.length > schema.maxLength) {\n value = value.slice(0, schema.maxLength).trimEnd()\n repairs.push(\n `${nodeId}.${name} was over ${schema.maxLength} characters; truncated`,\n )\n }\n return value\n}\n\n/**\n * The element's own declarations plus the node capabilities every element\n * carries (AGL-3156) — repeating, today. Two shapes only, so they are built\n * once each rather than per node: a capability prop is the same on every\n * element with the same child contract.\n *\n * The element wins a name collision. A component that declared a prop of its\n * own under a capability's name would be describing its own attribute, and the\n * validator has to hold it to that.\n */\nconst CAPABLE_ENTRIES = new WeakMap<AiPaletteEntry, AiPaletteEntry>()\n\nfunction withNodeCapabilities(entry: AiPaletteEntry): AiPaletteEntry {\n const cached = CAPABLE_ENTRIES.get(entry)\n if (cached) return cached\n const capability = nodeCapabilityProps(\n AI_NODE_CAPABILITIES,\n entry.acceptsChildren,\n )\n const merged: AiPaletteEntry = {\n ...entry,\n propsSchema: {\n ...entry.propsSchema,\n properties: {\n ...capability.properties,\n ...entry.propsSchema.properties,\n },\n },\n propRoles: { ...capability.propRoles, ...entry.propRoles },\n textLimits: { ...capability.textLimits, ...entry.textLimits },\n }\n CAPABLE_ENTRIES.set(entry, merged)\n return merged\n}\n\n/**\n * Plugins whose elements play audio (AGL-3716): the Music player. A model\n * never sources a recording and never vouches for one, so on their elements\n * `rightsConfirmed` is always dropped and `src` is kept only as a reference\n * to a file in the site's own library (which the asset check grounds) or a\n * binding. Named by plugin id, as the listings name their elements: a plugin\n * never imports another.\n */\nexport const AI_OWNER_AUDIO_PLUGIN_IDS: ReadonlySet<string> = new Set(['music'])\n\n/** Why an audio element's prop a model wrote is dropped, or null to keep it. */\nexport function aiOwnerAudioRefusal(\n pluginId: string | undefined,\n name: string,\n value: unknown,\n bindingTokens: ReadonlySet<string> | null = null,\n): string | null {\n if (!pluginId || !AI_OWNER_AUDIO_PLUGIN_IDS.has(pluginId)) return null\n if (name === 'rightsConfirmed') {\n return 'only the site owner can confirm they hold the rights to a recording'\n }\n if (name !== 'src') return null\n const text = typeof value === 'string' ? value.trim() : ''\n if (!text || parseMediaRef(text) || bindingTokens?.has(text)) return null\n return 'a player plays only audio from the owner’s own media library, never a recording from elsewhere'\n}\n\nfunction sanitizeProps(\n nodeId: string,\n paletteEntry: AiPaletteEntry,\n raw: unknown,\n screenIds: Set<string> | null,\n assetIds: Set<string> | null,\n repairs: string[],\n bindingTokens: ReadonlySet<string> | null = null,\n): { props: Record<string, unknown> } | { missing: string } {\n const entry = withNodeCapabilities(paletteEntry)\n const source = isRecord(raw) ? raw : {}\n const props: Record<string, unknown> = {}\n const declared = entry.propsSchema.properties\n for (const [name, value] of Object.entries(source)) {\n // `sx` is read off the node instead; a model that put it here meant the\n // same thing, and the caller has already moved it.\n if (name === 'sx' || value === undefined || value === null) continue\n // Audio is the owner's own, always (AGL-3716).\n const audioRefusal = aiOwnerAudioRefusal(entry.pluginId, name, value, bindingTokens)\n if (audioRefusal) {\n repairs.push(`${nodeId}.${name}: ${audioRefusal}; dropped`)\n continue\n }\n const schema = declared[name]\n if (!schema) {\n repairs.push(\n `${nodeId}.${name} is not a prop of ${entry.displayName}; dropped`,\n )\n continue\n }\n if (schema.enum) {\n const coerced = coerceEnum(schema, value)\n if (coerced === undefined) {\n repairs.push(\n `${nodeId}.${name} is not one of ${schema.enum.join('|')}; dropped`,\n )\n continue\n }\n if (coerced !== value) {\n repairs.push(\n `${nodeId}.${name} was spelled \"${String(value)}\"; normalized to \"${coerced}\"`,\n )\n }\n props[name] = coerced\n continue\n }\n switch (schema.type) {\n case 'boolean': {\n const coerced = coerceBoolean(value)\n if (coerced === undefined) {\n repairs.push(`${nodeId}.${name} is not a boolean; dropped`)\n continue\n }\n props[name] = coerced\n break\n }\n case 'number':\n case 'integer': {\n const coerced = coerceNumber(schema, value)\n if (coerced === undefined) {\n repairs.push(`${nodeId}.${name} is not a number in range; dropped`)\n continue\n }\n props[name] = coerced\n break\n }\n default: {\n const text =\n typeof value === 'string'\n ? value\n : typeof value === 'number' || typeof value === 'boolean'\n ? String(value)\n : undefined\n if (text === undefined) {\n repairs.push(`${nodeId}.${name} is not text; dropped`)\n continue\n }\n const cleaned = sanitizeString(\n nodeId,\n entry,\n name,\n schema,\n text,\n source,\n screenIds,\n assetIds,\n repairs,\n bindingTokens,\n )\n if (cleaned === undefined) continue\n props[name] = cleaned\n }\n }\n }\n for (const name of entry.propsSchema.required) {\n if (props[name] === undefined) return { missing: name }\n }\n return { props }\n}\n\n/** Surfaces that compose page elements, and so may place a component instance. */\nconst INSTANCE_SURFACES: ReadonlySet<AiSurface> = new Set([\n 'screen',\n 'layout',\n 'component',\n])\n\nconst FORM_COMPONENT_ID = 'form'\n\n/** The prop a repeat over a dataset is stored under (the data plugin's `repeatDataset`). Persisted — never rename. */\nexport const AI_REPEAT_DATASET_PROP = 'repeatDataset'\n\n/** The instance prop naming the component it places; stored on every instance node. */\nexport const AI_INSTANCE_REF_PROP = 'refId'\n\ninterface ReferenceSets {\n componentIds: Set<string> | null\n componentProps: Record<string, AiComponentPropTypes>\n formIds: Set<string> | null\n datasetIds: Set<string> | null\n assetIds: Set<string> | null\n /** The tree defines a reusable component, which may hand its own property tokens on. */\n definesComponent: boolean\n}\n\n/**\n * One value an instance fills in for a declared prop, held to what the\n * declaration's type can hold: a picture from the library, a link, a number,\n * a switch, or copy.\n */\nfunction instancePropValue(\n nodeId: string,\n name: string,\n type: string,\n raw: unknown,\n assetIds: Set<string> | null,\n repairs: string[],\n): unknown {\n if (type === 'number') {\n const parsed = typeof raw === 'number' ? raw : Number(raw)\n if (raw === '' || !Number.isFinite(parsed)) {\n repairs.push(`${nodeId}.propValues.${name} is not a number; dropped`)\n return undefined\n }\n return parsed\n }\n if (type === 'boolean') {\n const coerced = coerceBoolean(raw)\n if (coerced === undefined) {\n repairs.push(`${nodeId}.propValues.${name} is not a boolean; dropped`)\n }\n return coerced\n }\n if (type === 'icon') {\n // A page cannot fill an icon: the pick is an id and the path drawn from\n // it, and a word in its place draws nothing (AGL-3054). The property is\n // left for the site owner to pick.\n repairs.push(`${nodeId}.propValues.${name} is an icon, which the site owner picks from the library; dropped`)\n return undefined\n }\n if (typeof raw !== 'string' && typeof raw !== 'number' && typeof raw !== 'boolean') {\n repairs.push(`${nodeId}.propValues.${name} is not a value; dropped`)\n return undefined\n }\n const value = String(raw).trim()\n if (HOSTILE_TEXT.test(value)) {\n repairs.push(`${nodeId}.propValues.${name} carried markup or script; dropped`)\n return undefined\n }\n if (type === 'image') {\n if (isHttpsUrl(value)) return value\n const ref = parseMediaRef(value)\n if (!ref || (assetIds && !assetIds.has(ref.mediaId))) {\n repairs.push(\n `${nodeId}.propValues.${name} is neither a media reference this site holds nor an https: URL; dropped`,\n )\n return undefined\n }\n return value\n }\n if (type === 'href') {\n if (isHttpsUrl(value) || isRootRelativePath(value)) return value\n repairs.push(\n `${nodeId}.propValues.${name} is neither an https: URL nor a path on this site; dropped`,\n )\n return undefined\n }\n if (value.length > AI_TEXT_LIMITS.body) {\n repairs.push(\n `${nodeId}.propValues.${name} was over ${AI_TEXT_LIMITS.body} characters; truncated`,\n )\n return value.slice(0, AI_TEXT_LIMITS.body).trimEnd()\n }\n return value\n}\n\n/**\n * The site-record props of one node — an instance's `refId` and\n * `propValues`, a Form's `formId` and `datasetId` — checked against the ids\n * the caller supplied. They leave `props` before the palette pass, which\n * would drop them as undeclared, and come back in `kept` once checked.\n */\nfunction sanitizeReferenceProps(\n nodeId: string,\n componentId: string,\n props: Record<string, unknown>,\n refs: ReferenceSets,\n repairs: string[],\n): { props: Record<string, unknown>; kept: Record<string, unknown> } | { refusal: string } {\n const rest: Record<string, unknown> = { ...props }\n const kept: Record<string, unknown> = {}\n // A repeat over one of the site's datasets (AGL-3616), on any element: the\n // platform's own repeat, admitted against the datasets the caller supplies,\n // as a Form's dataset binding is. The palette leaves it off, since from a\n // description alone a model can only invent a dataset's id.\n if (AI_REPEAT_DATASET_PROP in rest) {\n const raw = rest[AI_REPEAT_DATASET_PROP]\n delete rest[AI_REPEAT_DATASET_PROP]\n const id = typeof raw === 'string' ? raw.trim() : ''\n if (id && refs.datasetIds?.has(id)) {\n kept[AI_REPEAT_DATASET_PROP] = id\n } else if (raw !== undefined && raw !== null && raw !== '') {\n repairs.push(`${nodeId}.${AI_REPEAT_DATASET_PROP} names a dataset this site does not have; dropped`)\n }\n }\n if (componentId === REUSABLE_INSTANCE_COMPONENT_ID) {\n const refId = typeof rest[AI_INSTANCE_REF_PROP] === 'string' ? String(rest[AI_INSTANCE_REF_PROP]).trim() : ''\n delete rest[AI_INSTANCE_REF_PROP]\n if (!refId || !refs.componentIds?.has(refId)) {\n return {\n refusal: `Reusable Component (${nodeId}) names a component this site does not have`,\n }\n }\n kept[AI_INSTANCE_REF_PROP] = refId\n const rawValues = rest[REUSABLE_INSTANCE_PROP_VALUES_KEY]\n delete rest[REUSABLE_INSTANCE_PROP_VALUES_KEY]\n if (rawValues !== undefined && !isRecord(rawValues)) {\n repairs.push(`${nodeId}.propValues is not an object; dropped`)\n }\n const declared = refs.componentProps[refId]\n const values: Record<string, unknown> = {}\n for (const [name, raw] of Object.entries(isRecord(rawValues) ? rawValues : {})) {\n if (raw === undefined || raw === null) continue\n if (!COMPONENT_PROP_NAME_PATTERN.test(name)) {\n repairs.push(`${nodeId}.propValues.${name} is not a prop name; dropped`)\n continue\n }\n if (declared && !(name in declared)) {\n repairs.push(`${nodeId}.propValues.${name} is not a prop of that component; dropped`)\n continue\n }\n if (refs.definesComponent && isAiComponentPropToken(raw)) {\n // A property of the component being defined, handed on whole; the\n // component step's check holds it to the kind this prop declares.\n values[name] = raw.trim()\n continue\n }\n const value = instancePropValue(\n nodeId,\n name,\n declared?.[name] ?? 'text',\n raw,\n refs.assetIds,\n repairs,\n )\n if (value !== undefined) values[name] = value\n }\n if (Object.keys(values).length) kept[REUSABLE_INSTANCE_PROP_VALUES_KEY] = values\n return { props: rest, kept }\n }\n if (componentId === FORM_COMPONENT_ID) {\n const bindings: Array<[prop: string, ids: Set<string> | null, record: string]> = [\n ['formId', refs.formIds, 'form'],\n ['datasetId', refs.datasetIds, 'dataset'],\n ]\n for (const [prop, ids, record] of bindings) {\n const raw = rest[prop]\n delete rest[prop]\n if (raw === undefined || raw === null || raw === '') continue\n const id = typeof raw === 'string' ? raw.trim() : ''\n if (id && ids?.has(id)) {\n kept[prop] = id\n } else {\n repairs.push(`${nodeId}.${prop} names a ${record} this site does not have; dropped`)\n }\n }\n }\n return { props: rest, kept }\n}\n\nfunction refusalCode(error: string): AiNodeTreeRefusalCode {\n if (/too large/i.test(error)) return 'too-large'\n if (/cannot be published/i.test(error)) return 'component'\n return 'structure'\n}\n\n/**\n * Whether the root the model wrote is the surface's root: the canvas wrapper\n * for a document surface (which the sanitizer exempts by the same shape), or\n * the named component otherwise.\n */\nfunction rootMatches(surfaceRoot: string, componentId: unknown): boolean {\n if (surfaceRoot === 'div') {\n return componentId == null || componentId === '' || componentId === 'div'\n }\n return componentId === surfaceRoot\n}\n\nexport function validateAiNodeTree(\n input: unknown,\n surface: AiSurface,\n context?: AiNodeTreeContext,\n): AiNodeTreeResult {\n try {\n return validate(input, surface, context)\n } catch (error) {\n return {\n ok: false,\n code: 'invalid-input',\n error: `The tree could not be read: ${error instanceof Error ? error.message : String(error)}`,\n }\n }\n}\n\nexport type AiNodePatchResult =\n | {\n ok: true\n props: Record<string, unknown>\n sx: Record<string, unknown> | undefined\n repairs: string[]\n }\n | { ok: false; error: string; code: AiNodeTreeRefusalCode }\n\n/**\n * One element's prop and style patch, held to the rules `validateAiNodeTree`\n * holds an element it places — for an edit to an element already on the\n * canvas, where there is no tree to validate.\n *\n * The same passes run: unknown props dropped, enums coerced, every string\n * held to its role and screened for markup, `sx` held to the key set and the\n * value grammar. The one difference is `required`: a patch is merged over the\n * props the element already has, so a required prop the patch does not name\n * is not missing.\n */\nexport function validateAiNodePatch(\n componentId: string,\n patch: { props?: unknown; sx?: unknown },\n context?: AiNodeTreeContext,\n): AiNodePatchResult {\n const entry = AI_PALETTE[componentId]\n if (!entry) {\n return {\n ok: false,\n code: 'component',\n error: `Component \"${componentId}\" is not in the palette`,\n }\n }\n const repairs: string[] = []\n const props = sanitizeProps(\n componentId,\n { ...entry, propsSchema: { ...entry.propsSchema, required: [] } },\n patch.props,\n context?.screenIds ? new Set(context.screenIds) : null,\n context?.assetIds ? new Set(context.assetIds) : null,\n repairs,\n )\n const sx =\n patch.sx === undefined ? undefined : sanitizeSx(componentId, patch.sx, repairs)\n return {\n ok: true,\n props: 'props' in props ? props.props : {},\n sx,\n repairs,\n }\n}\n\nfunction validate(\n input: unknown,\n surface: AiSurface,\n context: AiNodeTreeContext | undefined,\n): AiNodeTreeResult {\n const definition = AI_SURFACES[surface]\n if (!definition) {\n return {\n ok: false,\n code: 'invalid-input',\n error: `Unknown surface \"${surface}\"`,\n }\n }\n if (\n !isRecord(input) ||\n typeof input.rootId !== 'string' ||\n !isRecord(input.nodes)\n ) {\n return {\n ok: false,\n code: 'invalid-input',\n error: 'Expected an object with a string rootId and a nodes map',\n }\n }\n const rootId = input.rootId\n const nodes = input.nodes as Record<string, unknown>\n const root = nodes[rootId]\n if (!isRecord(root)) {\n return {\n ok: false,\n code: 'structure',\n error: 'Definition has no root node',\n }\n }\n if (!rootMatches(definition.root, root.componentId)) {\n return {\n ok: false,\n code: 'root',\n error: `A ${surface} starts with ${definition.root === 'div' ? 'the document wrapper' : `\"${definition.root}\"`}, not \"${String(root.componentId)}\"`,\n }\n }\n\n // The sanitizer keeps only the persisted node keys, and `sx` is not one of\n // them for a listing. Read it off every node first — from the node field\n // or from `props.sx`, which a model writes just as readily — and put it\n // back, checked, on the nodes that survive.\n const sxByNodeId = new Map<string, unknown>()\n const hiddenByNodeId = new Set<string>()\n for (const [id, node] of Object.entries(nodes)) {\n if (!isRecord(node)) continue\n const sx =\n node.sx !== undefined\n ? node.sx\n : isRecord(node.props)\n ? node.props.sx\n : undefined\n if (sx !== undefined) sxByNodeId.set(id, sx)\n if (node.hidden === true) hiddenByNodeId.add(id)\n }\n\n // A DAM reference (a `media:` value) is not a URL the sanitizer's\n // `src` policy admits — a listing must not carry another tenant's asset —\n // but on the tenant's own page it is exactly what an image should name.\n // Lift those values out before sanitizing and hand them back to the prop\n // pass, which holds them to the asset set the caller supplied.\n // A binding token the caller admitted (AGL-2909) is lifted the same way:\n // `{{entry.coverImage}}` is no address the sanitizer knows, and the prop\n // pass holds it to the tokens the caller named.\n const bindingTokens = context?.bindingTokens ? new Set(context.bindingTokens) : null\n // A reusable component's own property tokens (AGL-2908) are lifted too, and\n // kept as written rather than handed back to the prop pass: `{{prop.variant}}`\n // is no value a dropdown, a switch, an address or a visibility directive\n // admits. Copy keeps its tokens without lifting, as the text they are.\n const definesComponent = context?.definesComponent === true\n const codeBuilt = context?.codeBuilt === true\n const mediaByNodeId = new Map<string, Record<string, string>>()\n const boundByNodeId = new Map<string, Record<string, string>>()\n // A code-built Icon's drawing, from the library by the id it names (AGL-3660).\n const iconByNodeId = new Map<string, { iconId?: string; iconPath: string }>()\n const forSanitizer: Record<string, unknown> = {}\n for (const [id, node] of Object.entries(nodes)) {\n if (!isRecord(node) || !isRecord(node.props)) {\n forSanitizer[id] = node\n continue\n }\n if (codeBuilt && node.componentId === AI_ICON_COMPONENT_ID) {\n const { iconId, ...props } = node.props\n const rest = { ...props }\n const drawn = rest['iconPath']\n delete rest['iconPath']\n const icon = aiIconOfId(iconId)\n if (icon) iconByNodeId.set(id, { iconId: icon.id, iconPath: icon.path })\n // A page brought in draws the source's own icon (AGL-4107): its shape as\n // one path on the icon's 24-unit square, path data and nothing else.\n else if (aiIsIconPathData(drawn)) iconByNodeId.set(id, { iconPath: drawn })\n forSanitizer[id] = { ...node, props: rest }\n continue\n }\n const entry = AI_PALETTE[String(node.componentId)]\n const roles = entry?.propRoles ?? {}\n const props: Record<string, unknown> = { ...node.props }\n const lifted: Record<string, string> = {}\n const bound: Record<string, string> = {}\n for (const [key, value] of Object.entries(props)) {\n if (typeof value !== 'string') continue\n const role = roles[key]\n if (\n definesComponent &&\n isAiComponentPropToken(value) &&\n (AI_COMPONENT_VISIBILITY_PROPS.includes(key) ||\n (entry?.propsSchema.properties[key] !== undefined && role !== 'text'))\n ) {\n bound[key] = value.trim()\n delete props[key]\n continue\n }\n if (\n (role === 'media' && parseMediaRef(value.trim())) ||\n ((role === 'media' || role === 'url') && bindingTokens?.has(value.trim()))\n ) {\n lifted[key] = value\n delete props[key]\n }\n }\n if (Object.keys(lifted).length) mediaByNodeId.set(id, lifted)\n if (Object.keys(bound).length) boundByNodeId.set(id, bound)\n forSanitizer[id] = { ...node, props }\n }\n\n const refs: ReferenceSets = {\n componentIds: context?.componentIds ? new Set(context.componentIds) : null,\n componentProps: context?.componentProps ?? {},\n formIds: context?.formIds ? new Set(context.formIds) : null,\n datasetIds: context?.datasetIds ? new Set(context.datasetIds) : null,\n assetIds: context?.assetIds ? new Set(context.assetIds) : null,\n definesComponent,\n }\n // An instance is admitted only where the caller grounded it in the site's\n // components; the reference itself is checked on the node below.\n const surfaceAllow = codeBuilt ? [...definition.allow, ...(definition.codeOnly ?? [])] : definition.allow\n const allow =\n refs.componentIds && INSTANCE_SURFACES.has(surface)\n ? [...surfaceAllow, REUSABLE_INSTANCE_COMPONENT_ID]\n : surfaceAllow\n const sanitized = sanitizePortableDefinition(\n { rootId, nodes: forSanitizer },\n { componentIds: allow },\n )\n if (sanitized.ok === false) {\n return {\n ok: false,\n code: refusalCode(sanitized.error),\n error: sanitized.error,\n }\n }\n\n const screenIds = context?.screenIds ? new Set(context.screenIds) : null\n const assetIds = refs.assetIds\n const repairs: string[] = []\n const output: NodesMap = {}\n const rootIsWrapper =\n rootMatches('div', root.componentId) && definition.root === 'div'\n const minted = new Map<string, string>()\n const mint = (id: string): string => {\n const fresh =\n id === rootId && rootIsWrapper\n ? CANVAS_ROOT_ELEMENT_ID\n : createIdUrlSafe()\n minted.set(id, fresh)\n return fresh\n }\n\n /** Each visited node's parent by the model's own ids, for the parentId check. */\n const parentOf = new Map<string, string>()\n const queue: Array<{ id: string; parentId: string | null }> = [\n { id: rootId, parentId: null },\n ]\n mint(rootId)\n while (queue.length) {\n const { id, parentId } = queue.shift() as {\n id: string\n parentId: string | null\n }\n const node = sanitized.nodes[id]\n const entry = AI_PALETTE[node.componentId]\n if (!entry) {\n return {\n ok: false,\n code: 'component',\n error: `Component \"${node.componentId}\" is not in the palette`,\n }\n }\n const newId = minted.get(id) as string\n const raw = nodes[id]\n if (isRecord(raw)) {\n // The sanitizer drops silently; the model is told what went.\n for (const key of STRIPPED_NODE_KEYS) {\n if (raw[key] !== undefined) {\n repairs.push(\n `${id}.${key} is not something a generated node may set; dropped`,\n )\n }\n }\n if (raw.hidden !== undefined && typeof raw.hidden !== 'boolean') {\n repairs.push(`${id}.hidden is not a boolean; dropped`)\n }\n if (raw.nodes !== undefined && !Array.isArray(raw.nodes)) {\n repairs.push(\n `${id}.nodes is not a list of child ids; its children were dropped`,\n )\n }\n if (\n raw.parentId !== undefined &&\n raw.parentId !== null &&\n raw.parentId !== (parentId === null ? null : parentOf.get(id))\n ) {\n repairs.push(\n `${id}.parentId disagreed with where the tree places it; recomputed`,\n )\n }\n if (isRecord(raw.props)) {\n const lifted = mediaByNodeId.get(id) ?? {}\n const kept = boundByNodeId.get(id) ?? {}\n for (const key of Object.keys(raw.props)) {\n if (iconByNodeId.has(id) && (key === 'iconId' || key === 'iconPath')) continue\n if (\n key !== 'sx' &&\n lifted[key] === undefined &&\n kept[key] === undefined &&\n node.props?.[key] === undefined &&\n raw.props[key] !== undefined\n ) {\n repairs.push(\n `${id}.${key} was an unsafe handler, address or markup; dropped`,\n )\n }\n }\n }\n }\n const children: string[] = []\n for (const childId of node.nodes ?? []) {\n if (minted.has(childId)) {\n repairs.push(\n `${childId} was listed under more than one parent; the later listing was dropped`,\n )\n continue\n }\n const child = sanitized.nodes[childId]\n if (!child) continue\n const childEntry = AI_PALETTE[child.componentId]\n if (!childEntry) {\n return {\n ok: false,\n code: 'component',\n error: `Component \"${child.componentId}\" is not in the palette`,\n }\n }\n if (!entry.acceptsChildren) {\n return {\n ok: false,\n code: 'lineage',\n error: `${entry.displayName} (${id}) cannot hold other elements, but lists ${childId}`,\n }\n }\n if (\n !linealRelationshipPermits(\n {\n componentId: child.componentId,\n pluginId: childEntry.pluginId,\n restrictParent: childEntry.restrictParent,\n },\n {\n componentId: node.componentId,\n pluginId: entry.pluginId,\n restrictChildren: entry.restrictChildren,\n },\n )\n ) {\n return {\n ok: false,\n code: 'lineage',\n error: `${childEntry.displayName} (${childId}) cannot be placed inside ${entry.displayName} (${id})`,\n }\n }\n children.push(mint(childId))\n parentOf.set(childId, id)\n queue.push({ id: childId, parentId: newId })\n }\n\n const reference = sanitizeReferenceProps(\n id,\n node.componentId,\n { ...node.props, ...mediaByNodeId.get(id) },\n refs,\n repairs,\n )\n if ('refusal' in reference) {\n return { ok: false, code: 'reference', error: reference.refusal }\n }\n // A required prop the component binds is present: its value is the token.\n const boundProps = boundByNodeId.get(id)\n const propsResult = sanitizeProps(\n id,\n boundProps\n ? {\n ...entry,\n propsSchema: {\n ...entry.propsSchema,\n required: entry.propsSchema.required.filter((name) => boundProps[name] === undefined),\n },\n }\n : entry,\n reference.props,\n screenIds,\n assetIds,\n repairs,\n bindingTokens,\n )\n if ('missing' in propsResult) {\n return {\n ok: false,\n code: 'required-prop',\n error: `${entry.displayName} (${id}) is missing its required \"${propsResult.missing}\" prop`,\n }\n }\n const sx = sanitizeSx(id, sxByNodeId.get(id), repairs)\n output[newId] = {\n $id: newId,\n type: NodeType.NODE,\n componentId: node.componentId,\n pluginId: entry.pluginId,\n parentId,\n nodes: children,\n props: { ...propsResult.props, ...reference.kept, ...boundProps, ...iconByNodeId.get(id) },\n ...(sx ? { sx } : {}),\n ...(hiddenByNodeId.has(id) ? { hidden: true } : {}),\n }\n }\n\n // The save's own measurement (msgpack), not a JSON string length: the\n // ceiling is stated in those bytes, and a UTF-16 length reads multi-byte\n // copy as smaller than the document the save will refuse.\n const bytes = nodeMapBytes(output)\n if (bytes > NODE_MAP_MAX_BYTES) {\n return {\n ok: false,\n code: 'too-large',\n error: `The tree is ${bytes} bytes; the stored ceiling is ${NODE_MAP_MAX_BYTES}`,\n }\n }\n const sourceIds: Record<string, string> = {}\n for (const [source, fresh] of minted) sourceIds[fresh] = source\n return {\n ok: true,\n rootId: minted.get(rootId) as string,\n nodes: output,\n repairs,\n sourceIds,\n }\n}\n"],"names":["AI_TEXT_LIMITS","isHeadlineVariant","nodeCapabilityProps","AI_NODE_CAPABILITIES","AI_PALETTE","AI_SURFACES","AI_SX_TOKENS","linealRelationshipPermits","NODE_MAP_MAX_BYTES","nodeMapBytes","parseMediaRef","COMPONENT_PROP_NAME_PATTERN","REUSABLE_INSTANCE_COMPONENT_ID","REUSABLE_INSTANCE_PROP_VALUES_KEY","createIdUrlSafe","CANVAS_ROOT_ELEMENT_ID","NodeType","AI_ICON_COMPONENT_ID","aiIconOfId","aiIsIconPathData","AI_COMPONENT_VISIBILITY_PROPS","isAiComponentPropToken","sanitizePortableDefinition","AI_SX_ALLOWED_KEYS","Set","HOSTILE_TEXT","SX_VALUE","STRIPPED_NODE_KEYS","SCREEN_ID","ICON_PICKER_FIELD","MAX_SX_KEYS","PLAIN_STRING_MAX","paletteTokens","palette","breakpoints","typographyVariants","isRecord","value","Array","isArray","isHttpsUrl","test","URL","protocol","isContactHref","isRootRelativePath","sxValueAllowed","key","Number","isFinite","trimmed","trim","has","sanitizeSx","nodeId","sx","repairs","undefined","push","out","kept","Object","entries","responsive","breakpoint","inner","keys","length","coerceEnum","schema","enum","wanted","toLowerCase","find","option","coerceBoolean","coerceNumber","parsed","NaN","type","isInteger","minimum","maximum","textLimitFor","entry","name","props","declared","textLimits","variant","Math","min","body","headline","sanitizeString","raw","screenIds","assetIds","bindingTokens","propFields","role","propRoles","limit","slice","trimEnd","ref","mediaId","pattern","RegExp","minLength","maxLength","CAPABLE_ENTRIES","WeakMap","withNodeCapabilities","cached","get","capability","acceptsChildren","merged","propsSchema","properties","set","AI_OWNER_AUDIO_PLUGIN_IDS","aiOwnerAudioRefusal","pluginId","text","sanitizeProps","paletteEntry","source","audioRefusal","displayName","coerced","join","String","cleaned","required","missing","INSTANCE_SURFACES","FORM_COMPONENT_ID","AI_REPEAT_DATASET_PROP","AI_INSTANCE_REF_PROP","instancePropValue","sanitizeReferenceProps","componentId","refs","rest","id","datasetIds","refId","componentIds","refusal","rawValues","componentProps","values","definesComponent","bindings","formIds","prop","ids","record","refusalCode","error","rootMatches","surfaceRoot","validateAiNodeTree","input","surface","context","validate","ok","code","Error","message","validateAiNodePatch","patch","definition","rootId","nodes","root","sxByNodeId","Map","hiddenByNodeId","node","hidden","add","codeBuilt","mediaByNodeId","boundByNodeId","iconByNodeId","forSanitizer","iconId","drawn","icon","iconPath","path","roles","lifted","bound","includes","surfaceAllow","allow","codeOnly","sanitized","output","rootIsWrapper","minted","mint","fresh","parentOf","queue","parentId","shift","newId","children","childId","child","childEntry","restrictParent","restrictChildren","reference","boundProps","propsResult","filter","$id","NODE","bytes","sourceIds"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,cAAc,EACdC,iBAAiB,EACjBC,mBAAmB,QAId,kBAAc;AACrB,SACEC,oBAAoB,EACpBC,UAAU,EACVC,WAAW,EACXC,YAAY,QACP,4BAAwB;AAC/B,SAASC,yBAAyB,QAAQ,sCAAqC;AAC/E,SACEC,kBAAkB,EAClBC,YAAY,QACP,0CAAyC;AAChD,SAASC,aAAa,QAAQ,mCAAkC;AAChE,SACEC,2BAA2B,EAC3BC,8BAA8B,EAC9BC,iCAAiC,QAC5B,iDAAgD;AACvD,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,sBAAsB,QAAQ,2CAA0C;AACjF,SAASC,QAAQ,QAAuB,2BAA0B;AAElE,SAASC,oBAAoB,EAAEC,UAAU,EAAEC,gBAAgB,QAAQ,uBAAmB;AACtF,SACEC,6BAA6B,EAC7BC,sBAAsB,QACjB,6BAAyB;AAEhC,SAASC,0BAA0B,QAAQ,mDAAkD;AA0H7F;;;;;CAKC,GACD,OAAO,MAAMC,qBAA0C,IAAIC,IAAI;IAC7D,UAAU;IACV;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,QAAQ;IACR;IACA;IACA;IACA;IACA;IACA,aAAa;IACb;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,SAAS;IACT;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,UAAU;IACV;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,UAAU;IACV;IACA;IACA,OAAO;IACP;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,OAAO;IACP;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAC;AAEF;;;;CAIC,GACD,OAAO,MAAMC,eACX,2LAA0L;AAE5L;;;;;;CAMC,GACD,OAAO,MAAMC,WAAW,qCAAoC;AAE5D;;;;CAIC,GACD,MAAMC,qBAAqB;IACzB;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,YAAY;AAClB,sFAAsF,GACtF,MAAMC,oBAAoB;AAC1B,MAAMC,cAAc;AACpB,+EAA+E,GAC/E,MAAMC,mBAAmB;AAEzB,MAAMC,gBAAgB,IAAIR,IAAYlB,aAAa2B,OAAO;AAC1D,MAAMC,cAAc,IAAIV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F"}
@@ -184,6 +184,8 @@ export declare const AI_TEXT_LIMITS: {
184
184
  readonly button: 40;
185
185
  /** A short label, title or caption. */
186
186
  readonly label: 200;
187
+ /** A table's grid, every cell's words (AGL-4107): a page brought in carries its source's tables whole. */
188
+ readonly table: 20000;
187
189
  };
188
190
  /**
189
191
  * Prompt budget per surface catalog, in characters at four per token.