@engenty/wizards-runtime 0.0.0-stage → 0.7.5

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 (518) hide show
  1. package/LICENSE +110 -0
  2. package/README.md +214 -2
  3. package/apps/runtime/dist/agents/architect.js +444 -0
  4. package/apps/runtime/dist/agents/studio-assistant.js +883 -0
  5. package/apps/runtime/dist/agents/subscription.js +207 -0
  6. package/apps/runtime/dist/agents/thought.js +21 -0
  7. package/apps/runtime/dist/agents/website.js +480 -0
  8. package/apps/runtime/dist/app.js +359 -0
  9. package/apps/runtime/dist/apple/wizards-apple +0 -0
  10. package/apps/runtime/dist/assistant/browser.js +26 -0
  11. package/apps/runtime/dist/assistant/docs.js +158 -0
  12. package/apps/runtime/dist/assistant/knows.js +353 -0
  13. package/apps/runtime/dist/assistant/primer.js +26 -0
  14. package/apps/runtime/dist/assistant/runs.js +24 -0
  15. package/apps/runtime/dist/auth/account.js +175 -0
  16. package/apps/runtime/dist/auth/device.js +112 -0
  17. package/apps/runtime/dist/auth/index.js +358 -0
  18. package/apps/runtime/dist/auth/keys.js +55 -0
  19. package/apps/runtime/dist/auth/local-ticket.js +26 -0
  20. package/apps/runtime/dist/authoring/example.js +74 -0
  21. package/apps/runtime/dist/authoring/guide.js +433 -0
  22. package/apps/runtime/dist/authoring/ops.js +117 -0
  23. package/apps/runtime/dist/browser/fast/action-space.js +160 -0
  24. package/apps/runtime/dist/browser/fast/classifier.js +91 -0
  25. package/apps/runtime/dist/browser/fast/decide.js +171 -0
  26. package/apps/runtime/dist/browser/fast/driver.js +141 -0
  27. package/apps/runtime/dist/browser/fast/instructions.js +33 -0
  28. package/apps/runtime/dist/browser/fast/run.js +249 -0
  29. package/apps/runtime/dist/browser/fast/span-picker.js +153 -0
  30. package/apps/runtime/dist/browser/fast/text-helper.js +178 -0
  31. package/apps/runtime/dist/browser/snapshot.js +335 -0
  32. package/apps/runtime/dist/cli/account.js +385 -0
  33. package/apps/runtime/dist/cli/autostart.js +182 -0
  34. package/apps/runtime/dist/cli/autoupdate.js +221 -0
  35. package/apps/runtime/dist/cli/clients.js +44 -0
  36. package/apps/runtime/dist/cli/connect.js +540 -0
  37. package/apps/runtime/dist/cli/environment.js +93 -0
  38. package/apps/runtime/dist/cli/exec.js +45 -0
  39. package/apps/runtime/dist/cli/features.js +50 -0
  40. package/apps/runtime/dist/cli/home.js +88 -0
  41. package/apps/runtime/dist/cli/install-env.js +33 -0
  42. package/apps/runtime/dist/cli/machine.js +107 -0
  43. package/apps/runtime/dist/cli/main.js +222 -0
  44. package/apps/runtime/dist/cli/mcp.js +136 -0
  45. package/apps/runtime/dist/cli/menu.js +202 -0
  46. package/apps/runtime/dist/cli/processes.js +72 -0
  47. package/apps/runtime/dist/cli/report.js +66 -0
  48. package/apps/runtime/dist/cli/setup.js +335 -0
  49. package/apps/runtime/dist/cli/start.js +276 -0
  50. package/apps/runtime/dist/cli/status.js +203 -0
  51. package/apps/runtime/dist/cli/ui.js +59 -0
  52. package/apps/runtime/dist/cli/uninstall-main.js +20 -0
  53. package/apps/runtime/dist/cli/uninstall.js +231 -0
  54. package/apps/runtime/dist/cli/update.js +86 -0
  55. package/apps/runtime/dist/cli/validate.js +75 -0
  56. package/apps/runtime/dist/cli/versions.js +123 -0
  57. package/apps/runtime/dist/connectors/builtin.js +86 -0
  58. package/apps/runtime/dist/connectors/external.js +409 -0
  59. package/apps/runtime/dist/connectors/gmail.js +107 -0
  60. package/apps/runtime/dist/connectors/imap.js +261 -0
  61. package/apps/runtime/dist/connectors/index.js +325 -0
  62. package/apps/runtime/dist/connectors/mail.js +72 -0
  63. package/apps/runtime/dist/connectors/outlook.js +90 -0
  64. package/apps/runtime/dist/connectors/plugin-connections.js +343 -0
  65. package/apps/runtime/dist/connectors/via-account.js +65 -0
  66. package/apps/runtime/dist/credits/credits.js +100 -0
  67. package/apps/runtime/dist/credits/estimate.js +152 -0
  68. package/apps/runtime/dist/db/adopt.js +149 -0
  69. package/apps/runtime/dist/db/client.js +173 -0
  70. package/apps/runtime/dist/db/control-schema.js +133 -0
  71. package/apps/runtime/dist/db/migrations/control/0000_last_absorbing_man.sql +47 -0
  72. package/apps/runtime/dist/db/migrations/control/0001_gorgeous_nicolaos.sql +41 -0
  73. package/apps/runtime/dist/db/migrations/control/0002_secret_penance.sql +1 -0
  74. package/apps/runtime/dist/db/migrations/control/0003_nasty_mordo.sql +3 -0
  75. package/apps/runtime/dist/db/migrations/control/0004_breezy_eddie_brock.sql +6 -0
  76. package/apps/runtime/dist/db/migrations/control/0005_chilly_oracle.sql +1 -0
  77. package/apps/runtime/dist/db/migrations/control/0006_sleepy_mojo.sql +1 -0
  78. package/apps/runtime/dist/db/migrations/control/0007_common_the_hand.sql +15 -0
  79. package/apps/runtime/dist/db/migrations/control/0008_runner.sql +8 -0
  80. package/apps/runtime/dist/db/migrations/control/0009_plugin_claim.sql +9 -0
  81. package/apps/runtime/dist/db/migrations/control/0010_tan_snowbird.sql +6 -0
  82. package/apps/runtime/dist/db/migrations/control/meta/0000_snapshot.json +311 -0
  83. package/apps/runtime/dist/db/migrations/control/meta/0001_snapshot.json +599 -0
  84. package/apps/runtime/dist/db/migrations/control/meta/0002_snapshot.json +607 -0
  85. package/apps/runtime/dist/db/migrations/control/meta/0003_snapshot.json +311 -0
  86. package/apps/runtime/dist/db/migrations/control/meta/0004_snapshot.json +350 -0
  87. package/apps/runtime/dist/db/migrations/control/meta/0005_snapshot.json +358 -0
  88. package/apps/runtime/dist/db/migrations/control/meta/0006_snapshot.json +365 -0
  89. package/apps/runtime/dist/db/migrations/control/meta/0007_snapshot.json +460 -0
  90. package/apps/runtime/dist/db/migrations/control/meta/0008_snapshot.json +505 -0
  91. package/apps/runtime/dist/db/migrations/control/meta/0009_snapshot.json +561 -0
  92. package/apps/runtime/dist/db/migrations/control/meta/0010_snapshot.json +600 -0
  93. package/apps/runtime/dist/db/migrations/control/meta/_journal.json +83 -0
  94. package/apps/runtime/dist/db/migrations/tenant/0000_eminent_freak.sql +188 -0
  95. package/apps/runtime/dist/db/migrations/tenant/0001_salty_master_chief.sql +1 -0
  96. package/apps/runtime/dist/db/migrations/tenant/0002_cloudy_firebird.sql +1 -0
  97. package/apps/runtime/dist/db/migrations/tenant/0003_brown_warbound.sql +52 -0
  98. package/apps/runtime/dist/db/migrations/tenant/0004_romantic_nocturne.sql +6 -0
  99. package/apps/runtime/dist/db/migrations/tenant/0005_reflective_forgotten_one.sql +2 -0
  100. package/apps/runtime/dist/db/migrations/tenant/0006_hard_war_machine.sql +30 -0
  101. package/apps/runtime/dist/db/migrations/tenant/0007_space_data.sql +43 -0
  102. package/apps/runtime/dist/db/migrations/tenant/0008_run_event_note.sql +1 -0
  103. package/apps/runtime/dist/db/migrations/tenant/0009_knowledge.sql +104 -0
  104. package/apps/runtime/dist/db/migrations/tenant/0010_plugin_connection.sql +15 -0
  105. package/apps/runtime/dist/db/migrations/tenant/0011_runners.sql +2 -0
  106. package/apps/runtime/dist/db/migrations/tenant/0012_assistant_chat.sql +40 -0
  107. package/apps/runtime/dist/db/migrations/tenant/0013_run_origin.sql +1 -0
  108. package/apps/runtime/dist/db/migrations/tenant/0014_run_answer.sql +2 -0
  109. package/apps/runtime/dist/db/migrations/tenant/0015_device_calls.sql +13 -0
  110. package/apps/runtime/dist/db/migrations/tenant/0016_even_trish_tilby.sql +12 -0
  111. package/apps/runtime/dist/db/migrations/tenant/meta/0000_snapshot.json +1323 -0
  112. package/apps/runtime/dist/db/migrations/tenant/meta/0001_snapshot.json +1330 -0
  113. package/apps/runtime/dist/db/migrations/tenant/meta/0002_snapshot.json +1337 -0
  114. package/apps/runtime/dist/db/migrations/tenant/meta/0003_snapshot.json +1605 -0
  115. package/apps/runtime/dist/db/migrations/tenant/meta/0004_snapshot.json +1645 -0
  116. package/apps/runtime/dist/db/migrations/tenant/meta/0005_snapshot.json +1659 -0
  117. package/apps/runtime/dist/db/migrations/tenant/meta/0006_snapshot.json +1696 -0
  118. package/apps/runtime/dist/db/migrations/tenant/meta/0007_snapshot.json +2012 -0
  119. package/apps/runtime/dist/db/migrations/tenant/meta/0008_snapshot.json +2019 -0
  120. package/apps/runtime/dist/db/migrations/tenant/meta/0009_snapshot.json +2837 -0
  121. package/apps/runtime/dist/db/migrations/tenant/meta/0010_snapshot.json +2942 -0
  122. package/apps/runtime/dist/db/migrations/tenant/meta/0011_snapshot.json +2956 -0
  123. package/apps/runtime/dist/db/migrations/tenant/meta/0012_snapshot.json +3132 -0
  124. package/apps/runtime/dist/db/migrations/tenant/meta/0013_snapshot.json +3139 -0
  125. package/apps/runtime/dist/db/migrations/tenant/meta/0014_snapshot.json +3154 -0
  126. package/apps/runtime/dist/db/migrations/tenant/meta/0015_snapshot.json +3243 -0
  127. package/apps/runtime/dist/db/migrations/tenant/meta/0016_snapshot.json +3326 -0
  128. package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +125 -0
  129. package/apps/runtime/dist/db/schema.js +602 -0
  130. package/apps/runtime/dist/debug.js +196 -0
  131. package/apps/runtime/dist/docs/dev/index.md +41 -0
  132. package/apps/runtime/dist/docs/dev/meta.json +7 -0
  133. package/apps/runtime/dist/docs/dev/plugins/connections.md +74 -0
  134. package/apps/runtime/dist/docs/dev/plugins/events.md +89 -0
  135. package/apps/runtime/dist/docs/dev/plugins/examples.md +101 -0
  136. package/apps/runtime/dist/docs/dev/plugins/index.md +78 -0
  137. package/apps/runtime/dist/docs/dev/plugins/layout.md +90 -0
  138. package/apps/runtime/dist/docs/dev/plugins/meta.json +28 -0
  139. package/apps/runtime/dist/docs/dev/plugins/quick-start.md +94 -0
  140. package/apps/runtime/dist/docs/dev/plugins/reference.md +348 -0
  141. package/apps/runtime/dist/docs/dev/plugins/reloading.md +76 -0
  142. package/apps/runtime/dist/docs/dev/plugins/routes.md +185 -0
  143. package/apps/runtime/dist/docs/dev/plugins/runners.md +230 -0
  144. package/apps/runtime/dist/docs/dev/plugins/server.md +281 -0
  145. package/apps/runtime/dist/docs/dev/plugins/shipping.md +79 -0
  146. package/apps/runtime/dist/docs/dev/plugins/space.md +297 -0
  147. package/apps/runtime/dist/docs/dev/plugins/starters.md +70 -0
  148. package/apps/runtime/dist/docs/dev/plugins/studio.md +363 -0
  149. package/apps/runtime/dist/docs/dev/plugins/styling.md +129 -0
  150. package/apps/runtime/dist/docs/dev/plugins/tables.md +104 -0
  151. package/apps/runtime/dist/docs/dev/plugins/tools.md +139 -0
  152. package/apps/runtime/dist/docs/dev/wizard-format.md +125 -0
  153. package/apps/runtime/dist/docs/meta.json +3 -0
  154. package/apps/runtime/dist/docs/user/ai-apps.md +112 -0
  155. package/apps/runtime/dist/docs/user/assistant.md +77 -0
  156. package/apps/runtime/dist/docs/user/build-a-wizard.md +116 -0
  157. package/apps/runtime/dist/docs/user/command-line.md +83 -0
  158. package/apps/runtime/dist/docs/user/connectors.md +90 -0
  159. package/apps/runtime/dist/docs/user/create-account.md +52 -0
  160. package/apps/runtime/dist/docs/user/data.md +66 -0
  161. package/apps/runtime/dist/docs/user/first-start.md +60 -0
  162. package/apps/runtime/dist/docs/user/index.md +49 -0
  163. package/apps/runtime/dist/docs/user/install.md +123 -0
  164. package/apps/runtime/dist/docs/user/local-only.md +42 -0
  165. package/apps/runtime/dist/docs/user/meta.json +32 -0
  166. package/apps/runtime/dist/docs/user/models.md +156 -0
  167. package/apps/runtime/dist/docs/user/plugins.md +71 -0
  168. package/apps/runtime/dist/docs/user/run.md +98 -0
  169. package/apps/runtime/dist/docs/user/server.md +52 -0
  170. package/apps/runtime/dist/docs/user/space.md +126 -0
  171. package/apps/runtime/dist/docs/user/steps.md +220 -0
  172. package/apps/runtime/dist/docs/user/test-and-share.md +224 -0
  173. package/apps/runtime/dist/docs/user/troubleshooting.md +67 -0
  174. package/apps/runtime/dist/docs/user/wordpress.md +121 -0
  175. package/apps/runtime/dist/documents/parse.js +246 -0
  176. package/apps/runtime/dist/engenty/connections-external/build-connector.js +193 -0
  177. package/apps/runtime/dist/engenty/connections-external/errors.js +11 -0
  178. package/apps/runtime/dist/engenty/connections-external/import-service.js +270 -0
  179. package/apps/runtime/dist/engenty/connections-external/importer/classify.js +34 -0
  180. package/apps/runtime/dist/engenty/connections-external/importer/map-auth.js +185 -0
  181. package/apps/runtime/dist/engenty/connections-external/importer/normalize-mcp.js +63 -0
  182. package/apps/runtime/dist/engenty/connections-external/importer/normalize-openapi.js +130 -0
  183. package/apps/runtime/dist/engenty/connections-external/invoke/http-invoker.js +143 -0
  184. package/apps/runtime/dist/engenty/connections-external/invoke/mcp-client.js +143 -0
  185. package/apps/runtime/dist/engenty/connections-external/net/guarded-fetch.js +119 -0
  186. package/apps/runtime/dist/engenty/connections-external/oauth-dcr.js +88 -0
  187. package/apps/runtime/dist/engenty/connections-external/registry-client.js +336 -0
  188. package/apps/runtime/dist/engenty/connections-external/registry-source.js +82 -0
  189. package/apps/runtime/dist/engenty/connections-external/types.js +7 -0
  190. package/apps/runtime/dist/engenty/connections-github/connector.js +209 -0
  191. package/apps/runtime/dist/engenty/connections-google/connectors/calendar.js +381 -0
  192. package/apps/runtime/dist/engenty/connections-google/connectors/contacts.js +94 -0
  193. package/apps/runtime/dist/engenty/connections-google/connectors/drive.js +290 -0
  194. package/apps/runtime/dist/engenty/connections-google/connectors/gmail.js +567 -0
  195. package/apps/runtime/dist/engenty/connections-google/definitions.js +11 -0
  196. package/apps/runtime/dist/engenty/connections-google/shared.js +73 -0
  197. package/apps/runtime/dist/engenty/connections-hubspot/connector.js +140 -0
  198. package/apps/runtime/dist/engenty/connections-microsoft/action.js +17 -0
  199. package/apps/runtime/dist/engenty/connections-microsoft/graph.js +114 -0
  200. package/apps/runtime/dist/engenty/connections-microsoft/onedrive.js +286 -0
  201. package/apps/runtime/dist/engenty/connections-microsoft/outlook.js +492 -0
  202. package/apps/runtime/dist/engenty/connections-s3/s3.js +328 -0
  203. package/apps/runtime/dist/engenty/connections-sdk/files-capability.js +86 -0
  204. package/apps/runtime/dist/engenty/connections-sdk/oauth2.js +150 -0
  205. package/apps/runtime/dist/engenty/connections-sdk/registry.js +89 -0
  206. package/apps/runtime/dist/engenty/connections-sdk/storage-capability.js +84 -0
  207. package/apps/runtime/dist/engenty/connections-sdk/types.js +30 -0
  208. package/apps/runtime/dist/engenty/connections-slack/connector.js +360 -0
  209. package/apps/runtime/dist/engenty/csv-import/csv-matrix.js +178 -0
  210. package/apps/runtime/dist/engenty/csv-import/import-sources.js +87 -0
  211. package/apps/runtime/dist/engenty/csv-import/parse-csv.js +129 -0
  212. package/apps/runtime/dist/engenty/csv-import/serialize-csv.js +20 -0
  213. package/apps/runtime/dist/engenty/csv-import/types.js +1 -0
  214. package/apps/runtime/dist/engenty/csv-import/xlsx-workbook.js +159 -0
  215. package/apps/runtime/dist/engenty/doc-converter/interface.js +9 -0
  216. package/apps/runtime/dist/engenty/doc-converter/page-break.js +92 -0
  217. package/apps/runtime/dist/engenty/doc-converter/providers/local/index.js +72 -0
  218. package/apps/runtime/dist/engenty/document-scanner/schemas/classifier.js +30 -0
  219. package/apps/runtime/dist/engenty/document-scanner/schemas/index.js +4 -0
  220. package/apps/runtime/dist/engenty/document-scanner/schemas/invoice.js +73 -0
  221. package/apps/runtime/dist/engenty/document-scanner/schemas/receipt.js +63 -0
  222. package/apps/runtime/dist/engenty/document-scanner/schemas/shared.js +40 -0
  223. package/apps/runtime/dist/engenty/search-index/chunks.js +164 -0
  224. package/apps/runtime/dist/engenty/search-index/contracts.js +9 -0
  225. package/apps/runtime/dist/engenty/shims/connections-sdk.js +39 -0
  226. package/apps/runtime/dist/engenty/shims/plugin-sdk.js +1 -0
  227. package/apps/runtime/dist/engenty/shims/web-ingest.js +19 -0
  228. package/apps/runtime/dist/engenty/web-ingest/ssrf.js +277 -0
  229. package/apps/runtime/dist/engine/asks.js +82 -0
  230. package/apps/runtime/dist/engine/decide.js +82 -0
  231. package/apps/runtime/dist/engine/device.js +194 -0
  232. package/apps/runtime/dist/engine/events.js +128 -0
  233. package/apps/runtime/dist/engine/input.js +208 -0
  234. package/apps/runtime/dist/engine/owner.js +32 -0
  235. package/apps/runtime/dist/engine/prepare.js +90 -0
  236. package/apps/runtime/dist/engine/push.js +58 -0
  237. package/apps/runtime/dist/engine/requirements.js +355 -0
  238. package/apps/runtime/dist/engine/resources.js +198 -0
  239. package/apps/runtime/dist/engine/runner.js +970 -0
  240. package/apps/runtime/dist/engine/steps.js +1000 -0
  241. package/apps/runtime/dist/engine/surface.js +91 -0
  242. package/apps/runtime/dist/engine/template.js +240 -0
  243. package/apps/runtime/dist/engine/types.js +4 -0
  244. package/apps/runtime/dist/env.js +295 -0
  245. package/apps/runtime/dist/features.js +123 -0
  246. package/apps/runtime/dist/files/blobs.js +22 -0
  247. package/apps/runtime/dist/files/objects.js +86 -0
  248. package/apps/runtime/dist/files/storage.js +120 -0
  249. package/apps/runtime/dist/files/web-images.js +101 -0
  250. package/apps/runtime/dist/film/project.js +257 -0
  251. package/apps/runtime/dist/film/skills.js +91 -0
  252. package/apps/runtime/dist/film/sounds.js +122 -0
  253. package/apps/runtime/dist/film/step.js +289 -0
  254. package/apps/runtime/dist/film/tools.js +99 -0
  255. package/apps/runtime/dist/geocode.js +58 -0
  256. package/apps/runtime/dist/harness/antigravity.js +129 -0
  257. package/apps/runtime/dist/harness/apple.js +270 -0
  258. package/apps/runtime/dist/harness/claude.js +147 -0
  259. package/apps/runtime/dist/harness/codex.js +229 -0
  260. package/apps/runtime/dist/harness/cursor.js +93 -0
  261. package/apps/runtime/dist/harness/env.js +124 -0
  262. package/apps/runtime/dist/harness/index.js +95 -0
  263. package/apps/runtime/dist/harness/model.js +279 -0
  264. package/apps/runtime/dist/harness/prompt.js +121 -0
  265. package/apps/runtime/dist/harness/terminal.js +194 -0
  266. package/apps/runtime/dist/harness/types.js +7 -0
  267. package/apps/runtime/dist/index.js +113 -0
  268. package/apps/runtime/dist/limits.js +81 -0
  269. package/apps/runtime/dist/link-preview.js +60 -0
  270. package/apps/runtime/dist/log.js +106 -0
  271. package/apps/runtime/dist/manage.js +249 -0
  272. package/apps/runtime/dist/mcp/auth.js +161 -0
  273. package/apps/runtime/dist/mcp/bridge.js +59 -0
  274. package/apps/runtime/dist/mcp/flow-app.js +97 -0
  275. package/apps/runtime/dist/mcp/handler.js +54 -0
  276. package/apps/runtime/dist/mcp/scopes.js +14 -0
  277. package/apps/runtime/dist/mcp/seen.js +65 -0
  278. package/apps/runtime/dist/mcp/tools.js +572 -0
  279. package/apps/runtime/dist/media/conversation.js +167 -0
  280. package/apps/runtime/dist/media/ffmpeg.js +121 -0
  281. package/apps/runtime/dist/media/generate.js +120 -0
  282. package/apps/runtime/dist/media/marking.js +121 -0
  283. package/apps/runtime/dist/media/transcribe.js +198 -0
  284. package/apps/runtime/dist/model-errors.js +42 -0
  285. package/apps/runtime/dist/models.js +1164 -0
  286. package/apps/runtime/dist/plugin.js +61 -0
  287. package/apps/runtime/dist/plugins/channels.js +78 -0
  288. package/apps/runtime/dist/plugins/claims.js +56 -0
  289. package/apps/runtime/dist/plugins/discovery.js +155 -0
  290. package/apps/runtime/dist/plugins/events.js +63 -0
  291. package/apps/runtime/dist/plugins/jobs.js +64 -0
  292. package/apps/runtime/dist/plugins/loader.js +508 -0
  293. package/apps/runtime/dist/plugins/migrations.js +69 -0
  294. package/apps/runtime/dist/plugins/pro-keys.js +34 -0
  295. package/apps/runtime/dist/plugins/pro-state.js +83 -0
  296. package/apps/runtime/dist/plugins/pro.js +310 -0
  297. package/apps/runtime/dist/plugins/public.js +44 -0
  298. package/apps/runtime/dist/plugins/registry.js +122 -0
  299. package/apps/runtime/dist/plugins/runs.js +210 -0
  300. package/apps/runtime/dist/render/browser-path.js +54 -0
  301. package/apps/runtime/dist/render/chromium.js +98 -0
  302. package/apps/runtime/dist/render/convert.js +158 -0
  303. package/apps/runtime/dist/render/downloads.js +299 -0
  304. package/apps/runtime/dist/render/guard.js +25 -0
  305. package/apps/runtime/dist/render/shaped.js +137 -0
  306. package/apps/runtime/dist/routes/api.js +440 -0
  307. package/apps/runtime/dist/routes/debug.js +42 -0
  308. package/apps/runtime/dist/routes/delivery.js +90 -0
  309. package/apps/runtime/dist/routes/internal.js +81 -0
  310. package/apps/runtime/dist/routes/lang.js +25 -0
  311. package/apps/runtime/dist/routes/marketplace.js +43 -0
  312. package/apps/runtime/dist/routes/plugin-public.js +113 -0
  313. package/apps/runtime/dist/routes/plugins.js +212 -0
  314. package/apps/runtime/dist/routes/runs.js +1422 -0
  315. package/apps/runtime/dist/routes/studio.js +1629 -0
  316. package/apps/runtime/dist/routes/wizard-stream.js +30 -0
  317. package/apps/runtime/dist/running.js +39 -0
  318. package/apps/runtime/dist/sandbox/docker.js +75 -0
  319. package/apps/runtime/dist/sandbox/index.js +23 -0
  320. package/apps/runtime/dist/sandbox/types.js +1 -0
  321. package/apps/runtime/dist/secrets/crypto.js +28 -0
  322. package/apps/runtime/dist/secrets/signing.js +52 -0
  323. package/apps/runtime/dist/secrets/vault.js +59 -0
  324. package/apps/runtime/dist/services/access.js +88 -0
  325. package/apps/runtime/dist/services/api.js +248 -0
  326. package/apps/runtime/dist/services/architect.js +95 -0
  327. package/apps/runtime/dist/services/assistant-chats.js +311 -0
  328. package/apps/runtime/dist/services/brand.js +85 -0
  329. package/apps/runtime/dist/services/cloud.js +456 -0
  330. package/apps/runtime/dist/services/draft-events.js +27 -0
  331. package/apps/runtime/dist/services/engenty-shapes.js +71 -0
  332. package/apps/runtime/dist/services/errors.js +29 -0
  333. package/apps/runtime/dist/services/files.js +178 -0
  334. package/apps/runtime/dist/services/knowledge-model.js +559 -0
  335. package/apps/runtime/dist/services/knowledge.js +721 -0
  336. package/apps/runtime/dist/services/links.js +16 -0
  337. package/apps/runtime/dist/services/marketplace.js +492 -0
  338. package/apps/runtime/dist/services/onboarding.js +152 -0
  339. package/apps/runtime/dist/services/package-file.js +82 -0
  340. package/apps/runtime/dist/services/package.js +170 -0
  341. package/apps/runtime/dist/services/profile.js +51 -0
  342. package/apps/runtime/dist/services/project-files.js +439 -0
  343. package/apps/runtime/dist/services/project-index.js +707 -0
  344. package/apps/runtime/dist/services/projects.js +387 -0
  345. package/apps/runtime/dist/services/relevance.js +58 -0
  346. package/apps/runtime/dist/services/runners.js +178 -0
  347. package/apps/runtime/dist/services/runs.js +524 -0
  348. package/apps/runtime/dist/services/shares.js +130 -0
  349. package/apps/runtime/dist/services/site.js +270 -0
  350. package/apps/runtime/dist/services/space-categories.js +861 -0
  351. package/apps/runtime/dist/services/space-data.js +792 -0
  352. package/apps/runtime/dist/services/space-origin.js +207 -0
  353. package/apps/runtime/dist/services/spaces.js +656 -0
  354. package/apps/runtime/dist/services/translations.js +306 -0
  355. package/apps/runtime/dist/services/widgets.js +34 -0
  356. package/apps/runtime/dist/services/wizard-icon.js +157 -0
  357. package/apps/runtime/dist/services/wizards.js +420 -0
  358. package/apps/runtime/dist/settings.js +16 -0
  359. package/apps/runtime/dist/store/errors.js +4 -0
  360. package/apps/runtime/dist/store/index.js +299 -0
  361. package/apps/runtime/dist/store/shared-lists.js +123 -0
  362. package/apps/runtime/dist/tenants/control.js +238 -0
  363. package/apps/runtime/dist/tenants/tenant.js +26 -0
  364. package/apps/runtime/dist/texts.js +207 -0
  365. package/apps/runtime/dist/tools/browser.js +703 -0
  366. package/apps/runtime/dist/tools/connector.js +204 -0
  367. package/apps/runtime/dist/tools/index.js +291 -0
  368. package/apps/runtime/dist/tools/mail.js +104 -0
  369. package/apps/runtime/dist/tools/net-guard.js +170 -0
  370. package/apps/runtime/dist/tools/pages.js +81 -0
  371. package/apps/runtime/dist/tools/plugin.js +180 -0
  372. package/apps/runtime/dist/tools/project.js +154 -0
  373. package/apps/runtime/dist/tools/shared.js +69 -0
  374. package/apps/runtime/dist/tools/store.js +238 -0
  375. package/apps/runtime/dist/update.js +113 -0
  376. package/apps/runtime/dist/widgets/bundle.js +99 -0
  377. package/apps/runtime/dist/widgets/render.js +329 -0
  378. package/apps/runtime/dist/widgets/runtime.js +108 -0
  379. package/apps/runtime/dist/widgets/script.js +30 -0
  380. package/apps/runtime/dist/widgets/step.js +223 -0
  381. package/apps/web/dist/ai-labels/ai-black.svg +20 -0
  382. package/apps/web/dist/ai-labels/ai-generated-black.svg +31 -0
  383. package/apps/web/dist/ai-labels/ai-generated-white.svg +32 -0
  384. package/apps/web/dist/ai-labels/ai-modified-black.svg +30 -0
  385. package/apps/web/dist/ai-labels/ai-modified-white.svg +31 -0
  386. package/apps/web/dist/ai-labels/ai-white.svg +21 -0
  387. package/apps/web/dist/assets/AboutDialog-D4mvc-zu.js +1 -0
  388. package/apps/web/dist/assets/ChangelogDialog-DLqpJsF6.js +1 -0
  389. package/apps/web/dist/assets/ChatView-3laypRcE.js +10 -0
  390. package/apps/web/dist/assets/EditorPage-BalA5U2Y.js +3 -0
  391. package/apps/web/dist/assets/FlowPreview-CusP7ci9.js +1 -0
  392. package/apps/web/dist/assets/Harness-BrP-ENHg.css +1 -0
  393. package/apps/web/dist/assets/Harness-iYLtOLaK.js +16 -0
  394. package/apps/web/dist/assets/NewWizardChannels-CbwJ9A56.js +1 -0
  395. package/apps/web/dist/assets/NewWizardPage-BOBYiB9i.js +7 -0
  396. package/apps/web/dist/assets/OnboardingPage-CUwCiVIr.js +1 -0
  397. package/apps/web/dist/assets/ProjectPage-Bb16MdYG.js +1 -0
  398. package/apps/web/dist/assets/PublicRunner-BCt7Q6C-.js +1 -0
  399. package/apps/web/dist/assets/ReadOnly-kIHX2TEy.js +1 -0
  400. package/apps/web/dist/assets/RunDrawer-hZ9oeSXu.js +4 -0
  401. package/apps/web/dist/assets/RunnerView-DUS9fPmx.js +1 -0
  402. package/apps/web/dist/assets/SettingsPage-BzwR50fi.js +1 -0
  403. package/apps/web/dist/assets/SetupPage-gAp7rPxp.js +1 -0
  404. package/apps/web/dist/assets/SharePage-DqZWHva_.js +1 -0
  405. package/apps/web/dist/assets/changelog-DugmCNSf.js +1 -0
  406. package/apps/web/dist/assets/engenty-eXZ-EAwd.js +1 -0
  407. package/apps/web/dist/assets/esm-DXeMu8Lb.js +7 -0
  408. package/apps/web/dist/assets/fluffy-engenty-ClRou7yu.js +456 -0
  409. package/apps/web/dist/assets/index-AfUa8xKD.css +1 -0
  410. package/apps/web/dist/assets/index-C5Sm7tTR.js +14 -0
  411. package/apps/web/dist/assets/jsx-runtime-BNakU3Ej.js +1 -0
  412. package/apps/web/dist/assets/lock-R_CfU0Xo.js +1 -0
  413. package/apps/web/dist/assets/oss-credits-cZ9NUaLZ.js +1 -0
  414. package/apps/web/dist/assets/pdfmake-Cx9scTbD.js +228 -0
  415. package/apps/web/dist/assets/phone-CgrIS4_-.js +1 -0
  416. package/apps/web/dist/assets/preload-helper-CNEI7N0N.js +1 -0
  417. package/apps/web/dist/assets/qr-scanner-worker.min-CJaXo3yu.js +98 -0
  418. package/apps/web/dist/assets/qr-scanner.min-C_UI0gH-.js +1 -0
  419. package/apps/web/dist/assets/rolldown-runtime-hePW80VL.js +1 -0
  420. package/apps/web/dist/assets/settings-menu-2IMOOlLl.js +1 -0
  421. package/apps/web/dist/assets/ui-dzGvc3xk.js +137 -0
  422. package/apps/web/dist/assets/upload-BSuTilFF.js +1 -0
  423. package/apps/web/dist/assets/vfs_fonts-DllDSYt1.js +1 -0
  424. package/apps/web/dist/embed.js +266 -0
  425. package/apps/web/dist/favicon.svg +1 -0
  426. package/apps/web/dist/icons/apple-touch-icon.png +0 -0
  427. package/apps/web/dist/icons/icon-192.png +0 -0
  428. package/apps/web/dist/icons/icon-512.png +0 -0
  429. package/apps/web/dist/icons/icon-maskable-512.png +0 -0
  430. package/apps/web/dist/index.html +48 -0
  431. package/apps/web/dist/install.sh +577 -0
  432. package/apps/web/dist/manifest.webmanifest +21 -0
  433. package/apps/web/dist/mcp/flow.html +980 -0
  434. package/apps/web/dist/sw.js +15 -0
  435. package/bin/wizards.mjs +288 -0
  436. package/modules/README.md +15 -0
  437. package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +1150 -0
  438. package/node_modules/@engenty/wizards/dist/plugin/index.js +4 -0
  439. package/node_modules/@engenty/wizards/dist/plugin/studio.d.ts +322 -0
  440. package/node_modules/@engenty/wizards/dist/plugin/studio.js +4 -0
  441. package/node_modules/@engenty/wizards/dist/plugin/thread.d.ts +174 -0
  442. package/node_modules/@engenty/wizards/dist/plugin/thread.js +821 -0
  443. package/node_modules/@engenty/wizards/package.json +11 -0
  444. package/node_modules/@engenty-wizards/shared/dist/assistant.d.ts +174 -0
  445. package/node_modules/@engenty-wizards/shared/dist/assistant.js +65 -0
  446. package/node_modules/@engenty-wizards/shared/dist/changes.d.ts +22 -0
  447. package/node_modules/@engenty-wizards/shared/dist/changes.js +61 -0
  448. package/node_modules/@engenty-wizards/shared/dist/connectors.d.ts +77 -0
  449. package/node_modules/@engenty-wizards/shared/dist/connectors.js +2 -0
  450. package/node_modules/@engenty-wizards/shared/dist/decision.d.ts +76 -0
  451. package/node_modules/@engenty-wizards/shared/dist/decision.js +147 -0
  452. package/node_modules/@engenty-wizards/shared/dist/definition.d.ts +2922 -0
  453. package/node_modules/@engenty-wizards/shared/dist/definition.js +1920 -0
  454. package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-format.d.ts +5 -0
  455. package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-format.js +132 -0
  456. package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-value.d.ts +11 -0
  457. package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns-value.js +209 -0
  458. package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns.d.ts +532 -0
  459. package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns.js +217 -0
  460. package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/index.d.ts +3 -0
  461. package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/index.js +3 -0
  462. package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-lexical.d.ts +14 -0
  463. package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-lexical.js +166 -0
  464. package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-rank.d.ts +33 -0
  465. package/node_modules/@engenty-wizards/shared/dist/engenty/search-index/catalog-rank.js +99 -0
  466. package/node_modules/@engenty-wizards/shared/dist/feature-flags.d.ts +78 -0
  467. package/node_modules/@engenty-wizards/shared/dist/feature-flags.js +70 -0
  468. package/node_modules/@engenty-wizards/shared/dist/features.d.ts +41 -0
  469. package/node_modules/@engenty-wizards/shared/dist/features.js +89 -0
  470. package/node_modules/@engenty-wizards/shared/dist/fit.d.ts +71 -0
  471. package/node_modules/@engenty-wizards/shared/dist/fit.js +382 -0
  472. package/node_modules/@engenty-wizards/shared/dist/json-schema.d.ts +14 -0
  473. package/node_modules/@engenty-wizards/shared/dist/json-schema.js +66 -0
  474. package/node_modules/@engenty-wizards/shared/dist/knowledge.d.ts +199 -0
  475. package/node_modules/@engenty-wizards/shared/dist/knowledge.js +68 -0
  476. package/node_modules/@engenty-wizards/shared/dist/marketplace-entry.d.ts +35 -0
  477. package/node_modules/@engenty-wizards/shared/dist/marketplace-entry.js +107 -0
  478. package/node_modules/@engenty-wizards/shared/dist/marketplace-search.d.ts +20 -0
  479. package/node_modules/@engenty-wizards/shared/dist/marketplace-search.js +136 -0
  480. package/node_modules/@engenty-wizards/shared/dist/marketplace.d.ts +227 -0
  481. package/node_modules/@engenty-wizards/shared/dist/marketplace.js +354 -0
  482. package/node_modules/@engenty-wizards/shared/dist/merge.d.ts +7 -0
  483. package/node_modules/@engenty-wizards/shared/dist/merge.js +40 -0
  484. package/node_modules/@engenty-wizards/shared/dist/numbers.d.ts +24 -0
  485. package/node_modules/@engenty-wizards/shared/dist/numbers.js +54 -0
  486. package/node_modules/@engenty-wizards/shared/dist/projects.d.ts +224 -0
  487. package/node_modules/@engenty-wizards/shared/dist/projects.js +319 -0
  488. package/node_modules/@engenty-wizards/shared/dist/providers.d.ts +101 -0
  489. package/node_modules/@engenty-wizards/shared/dist/providers.js +390 -0
  490. package/node_modules/@engenty-wizards/shared/dist/run.d.ts +680 -0
  491. package/node_modules/@engenty-wizards/shared/dist/run.js +620 -0
  492. package/node_modules/@engenty-wizards/shared/dist/runner-texts.d.ts +546 -0
  493. package/node_modules/@engenty-wizards/shared/dist/runner-texts.js +523 -0
  494. package/node_modules/@engenty-wizards/shared/dist/runners.d.ts +93 -0
  495. package/node_modules/@engenty-wizards/shared/dist/runners.js +146 -0
  496. package/node_modules/@engenty-wizards/shared/dist/shape.d.ts +102 -0
  497. package/node_modules/@engenty-wizards/shared/dist/shape.js +318 -0
  498. package/node_modules/@engenty-wizards/shared/dist/space-data.d.ts +89 -0
  499. package/node_modules/@engenty-wizards/shared/dist/space-data.js +47 -0
  500. package/node_modules/@engenty-wizards/shared/dist/store.d.ts +117 -0
  501. package/node_modules/@engenty-wizards/shared/dist/store.js +81 -0
  502. package/node_modules/@engenty-wizards/shared/dist/surface.d.ts +115 -0
  503. package/node_modules/@engenty-wizards/shared/dist/surface.js +442 -0
  504. package/node_modules/@engenty-wizards/shared/dist/texts.d.ts +45 -0
  505. package/node_modules/@engenty-wizards/shared/dist/texts.js +54 -0
  506. package/node_modules/@engenty-wizards/shared/dist/translation.d.ts +23 -0
  507. package/node_modules/@engenty-wizards/shared/dist/translation.js +154 -0
  508. package/node_modules/@engenty-wizards/shared/dist/wizard-package.d.ts +48 -0
  509. package/node_modules/@engenty-wizards/shared/dist/wizard-package.js +49 -0
  510. package/node_modules/@engenty-wizards/shared/dist/workspace.d.ts +16 -0
  511. package/node_modules/@engenty-wizards/shared/dist/workspace.js +51 -0
  512. package/node_modules/@engenty-wizards/shared/package.json +10 -0
  513. package/package.json +77 -4
  514. package/plugin/.claude-plugin/plugin.json +9 -0
  515. package/plugin/.mcp.json +8 -0
  516. package/plugin/commands/wizard.md +8 -0
  517. package/plugin/skills/build-wizard/SKILL.md +27 -0
  518. package/plugin/skills/use-wizard/SKILL.md +18 -0
@@ -0,0 +1,456 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{a as r,i,l as a,n as o,o as s,r as c,s as l,t as u,u as d}from"./engenty-eXZ-EAwd.js";var f=e(t(),1),p=new Map,m=null,h=new WeakMap;function g(e){let t=p.get(e);if(t)return t;if(!m){let e=document.createElement(`canvas`);e.width=1,e.height=1,m=e.getContext(`2d`,{willReadFrequently:!0})}let n=[.5,.5,.5];if(m){m.clearRect(0,0,1,1),m.fillStyle=`#808080`,m.fillStyle=e,m.fillRect(0,0,1,1);let[t,r,i]=m.getImageData(0,0,1,1).data;n=[t/255,r/255,i/255]}return p.set(e,n),n}function _(e,t){let n=h.get(e);return n||(n=document.createElement(`span`),n.setAttribute(`aria-hidden`,`true`),n.style.cssText=`position:absolute;width:0;height:0;overflow:hidden;visibility:hidden`,e.appendChild(n),h.set(e,n)),n.style.color=``,n.style.color=t,g(getComputedStyle(n).color||`#808080`)}var v=(e,t,n)=>[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n];function ee(e,t){let n=_(e,a[d[t]]),r=Math.max(...n),i=[Math.min(1,n[0]+n[0]/(r||1)*.45),Math.min(1,n[1]+n[1]/(r||1)*.45),Math.min(1,n[2]+n[2]/(r||1)*.45)];return{body:v(n,[1,1,1],.12),deep:v(n,[.03,.02,.06],.62),tip:v(i,[1,1,1],.12)}}var y=`#version 300 es
2
+ precision highp float;
3
+ #define BLOBS ${c}
4
+ #define EXTRAS ${i}
5
+ #define VIEW ${152 .toFixed(1)}
6
+ #define ORIGIN ${(-16).toFixed(1)}
7
+ #define TAU 6.2831853
8
+ uniform vec2 uResolution;
9
+ uniform float uTime;
10
+ uniform vec4 uBlobs[BLOBS];
11
+ uniform float uFalloff;
12
+ uniform float uScale;
13
+ uniform float uFur;
14
+ uniform float uPeriod;
15
+ uniform float uInflate;
16
+ uniform float uDensity;
17
+ uniform float uThick;
18
+ uniform vec2 uLean;
19
+ uniform vec2 uTurn;
20
+ uniform float uGoggles;
21
+ uniform vec3 uLight;
22
+ uniform vec3 uBody;
23
+ uniform vec3 uDeep;
24
+ uniform vec3 uTip;
25
+ uniform vec3 uEye;
26
+ uniform float uWind;
27
+ uniform vec2 uGaze;
28
+ uniform vec4 uExtras[EXTRAS];
29
+ uniform vec4 uExtraMeta[EXTRAS];
30
+ uniform vec2 uWobble;
31
+ uniform float uClarity;
32
+ uniform float uSoftness;
33
+ uniform vec4 uPull;
34
+ #ifdef JELLY_COAT
35
+
36
+ vec3 deformJelly(vec3 p) {
37
+ vec3 q=p-vec3(60.0,60.0,0.0);
38
+ vec3 local=q/max(uScale,1.0);
39
+ float softness=clamp(uSoftness,0.0,1.5);
40
+ float phase=TAU*uTime/uPeriod;
41
+ vec2 lag=clamp(uWobble,vec2(-7.0),vec2(7.0));
42
+ float squash=softness*(sin(phase)*0.08+sin(phase*1.7)*0.012+lag.y*0.012);
43
+ q.xz*=inversesqrt(1.0+squash);
44
+ q.y*=1.0+squash;
45
+ float top=clamp(1.0-p.y/125.0,0.0,1.0);
46
+ q.x+=softness*(lag.x*1.15*top*top+sin(phase*0.8+local.y*2.5)*0.8);
47
+ float wave=sin(local.x*3.1+uTime*1.15)*sin(local.y*2.7-uTime*0.85)*sin(local.z*2.6+uTime*0.65);
48
+ vec3 d1=local-vec3(-0.42,-0.32,0.72);
49
+ vec3 d2=local-vec3(0.45,0.46,0.7);
50
+ float dents=-3.2*exp(-dot(d1,d1)*8.0)-2.1*exp(-dot(d2,d2)*9.0);
51
+ float face=1.0-0.8*exp(-dot(p.xy-uEye.xy,p.xy-uEye.xy)/(uEye.z*uEye.z*3.0));
52
+ q+=normalize(local+vec3(0.0,0.001,0.0))*softness*face*(wave*3.2+dents);
53
+ vec2 grab=(p.xy-uPull.xy)/max(uScale*0.65,1.0);
54
+ float influence=exp(-dot(grab,grab)*2.0)*smoothstep(-0.2,0.65,local.z);
55
+ q.xy+=uPull.zw*softness*influence;
56
+ q.z-=length(uPull.zw)*softness*influence*0.15;
57
+ return q+vec3(60.0,60.0,0.0);
58
+ }
59
+
60
+ #endif
61
+ vec2 eyeCentre() { return uEye.xy; }
62
+ float bodyK(vec2 p) {
63
+ float sum=0.0;
64
+ for(int i=0;i<BLOBS;i++){
65
+ vec4 b=uBlobs[i];if(b.z<=0.0)continue;
66
+ vec2 q=(p-b.xy)/b.zw;sum+=exp(-uFalloff*dot(q,q));
67
+ }
68
+ return sqrt(max(0.0,-log(max(sum,1e-8))/uFalloff));
69
+ }
70
+ float sdBody(vec2 p){return (bodyK(p)-1.0)*uScale;}
71
+ vec3 rotateCoat(vec3 p) {
72
+ vec3 q=vec3(p.x,cos(uTurn.y)*p.y-sin(uTurn.y)*p.z,sin(uTurn.y)*p.y+cos(uTurn.y)*p.z);
73
+ return vec3(cos(uTurn.x)*q.x+sin(uTurn.x)*q.z,q.y,-sin(uTurn.x)*q.x+cos(uTurn.x)*q.z);
74
+ }
75
+ vec3 bodyStretch(){float s=sin(TAU*uTime/uPeriod)*0.018;return vec3(1.0+s,1.0-s,1.0/(1.0-s*s));}
76
+ vec3 poseCoat(vec3 p) {
77
+ float w=TAU*uTime/uPeriod;
78
+ #ifdef JELLY_COAT
79
+ p=deformJelly(p);
80
+ #endif
81
+ vec3 q=(p-vec3(60.0,60.0,0.0))*bodyStretch();
82
+ q.xy+=uLean*(1.15-p.y/120.0)*0.3;
83
+
84
+ q=rotateCoat(q);
85
+ q.xy+=vec2(60.0+sin(w)*1.5,60.0+cos(w*0.8)*1.1);
86
+ return q;
87
+ }
88
+ vec3 poseNormal(vec3 p,vec3 normal){
89
+ #ifdef JELLY_COAT
90
+ vec3 tangent=normalize(cross(normal,abs(normal.y)>0.9?vec3(1.0,0.0,0.0):vec3(0.0,1.0,0.0)));
91
+ vec3 bitangent=cross(normal,tangent);
92
+ vec3 t=poseCoat(p+tangent*0.12)-poseCoat(p-tangent*0.12);
93
+ vec3 b=poseCoat(p+bitangent*0.12)-poseCoat(p-bitangent*0.12);
94
+ return normalize(cross(t,b));
95
+ #else
96
+ return rotateCoat(normalize(normal/bodyStretch()));
97
+ #endif
98
+ }
99
+ float coatZoom(){
100
+ float extent=0.0;
101
+ for(int i=0;i<BLOBS;i++){
102
+ vec4 b=uBlobs[i];if(b.z<=0.0)continue;
103
+ extent=max(extent,max(max(abs(b.x-60.0)+b.z,abs(b.y-60.0)+b.w),b.z*uInflate/30.0));
104
+ }
105
+ return min(1.0,65.0/(extent+uFur*1.2+3.0));
106
+ }
107
+ vec4 projectCoat(vec3 p){
108
+ float zoom=coatZoom();
109
+ vec2 screen=(p.xy-60.0)*zoom+60.0;
110
+ return vec4((screen.x-ORIGIN)/VIEW*2.0-1.0,1.0-(screen.y-ORIGIN)/VIEW*2.0,-p.z*zoom/150.0,1.0);
111
+ }
112
+ float sdArc(vec2 q,float r,float span){float a=clamp(atan(q.x,-q.y),-span,span);return length(q-vec2(sin(a),-cos(a))*r);}
113
+ vec4 extrasOver(vec2 p,vec3 ink,vec3 bodyCol,float aa){
114
+ vec4 acc=vec4(0.0);
115
+ for(int i=0;i<EXTRAS;i++){
116
+ vec4 m=uExtraMeta[i],g=uExtras[i];int kind=int(m.x+0.5);
117
+ if(kind==0||kind==2||(kind==3&&m.w>0.5))continue;
118
+ vec2 q=p-g.xy;float distance=1000.0,hw=m.z*0.5;
119
+ if(kind==1){distance=length(q)-g.z;hw=0.0;}
120
+ else if(kind==3)distance=sdArc(q,g.z,g.w);
121
+ else if(kind==4)distance=length(vec2(q.x,max(abs(q.y)-g.z,0.0)));
122
+ else if(kind==5){float x=clamp(q.x,0.0,g.z);distance=length(q-vec2(x,-g.w*sin(TAU*x/g.z)));}
123
+ float a=(1.0-smoothstep(hw-aa,hw+aa,distance))*m.y;
124
+ vec3 color=mix(ink,bodyCol*0.45,0.2);
125
+ acc=vec4(color*a,a)+acc*(1.0-a);
126
+ }
127
+ return acc;
128
+ }
129
+
130
+ vec4 gogglesOver(vec2 p, float aa, float front) {
131
+ if (uGoggles < 0.5) return vec4(0.0);
132
+ vec2 q = p - eyeCentre();
133
+ float er = uEye.z * 1.35;
134
+ float d = length(q);
135
+ float outer = er * 1.27;
136
+ float bandY = q.y + 1.7 * pow(q.x / max(uScale, 1.0), 2.0);
137
+ float band = 1.0 - smoothstep(uEye.z * 0.31 - aa, uEye.z * 0.31 + aa, abs(bandY));
138
+ // Taper into the surface; fine irregular coverage lets fur cover the strap ends.
139
+ float skin = -sdBody(p);
140
+ float grain = sin(p.x * 7.3 + sin(p.y * 4.1)) * 0.6;
141
+ float tuck = smoothstep(0.5, 6.0, skin + grain);
142
+ band *= tuck * mix(1.0, smoothstep(outer - aa, outer + aa, d), front);
143
+ float curve = clamp(skin / max(uScale, 1.0), 0.0, 1.0);
144
+ vec3 leather = mix(vec3(0.12, 0.055, 0.025), vec3(0.43, 0.24, 0.1), curve);
145
+ float seam = 1.0 - smoothstep(0.12, 0.35, abs(abs(bandY) - uEye.z * 0.22));
146
+ leather += vec3(0.11, 0.065, 0.025) * seam * step(0.4, fract(p.x * 0.65));
147
+ vec4 acc = vec4(leather * band, band);
148
+ return acc;
149
+ }
150
+
151
+ `;function b(e){let t=[];for(let n=0;n<e.extraMeta.length/4;n++){let[r,,i,a]=e.extraMeta.slice(n*4,n*4+4);if(r!==2&&!(r===3&&a>.5))continue;let[o,s,c,l]=e.extras.slice(n*4,n*4+4),u=r===2?16:32,d=(e,t)=>{let a=e/u*(r===2?Math.PI:l*2)-(r===2?0:l),d=t/16*Math.PI*2,f=r===2?[Math.sin(a)*Math.cos(d),-Math.cos(a),Math.sin(a)*Math.sin(d)]:[Math.sin(a)*Math.cos(d),-Math.cos(a)*Math.cos(d),Math.sin(d)],p=r===2?[o,s,0]:[o+Math.sin(a)*c,s-Math.cos(a)*c,0],m=r===2?c:i*.5;return[...p.map((e,t)=>e+f[t]*m),...f,n]},f=(e,n,r)=>{let i=n.map((t,n)=>t-e[n]),a=r.map((t,n)=>t-e[n]),o=[i[1]*a[2]-i[2]*a[1],i[2]*a[0]-i[0]*a[2],i[0]*a[1]-i[1]*a[0]].reduce((t,n,r)=>t+n*e[r+3],0)<0?[e,r,n]:[e,n,r];for(let e of o)t.push(...e)};for(let e=0;e<u;e++)for(let t=0;t<16;t++){let n=d(e,t),r=d(e+1,t),i=d(e+1,t+1),a=d(e,t+1);f(n,r,i),f(n,i,a)}}return new Float32Array(t)}function x(e,t){let n=new Map,r=[[`aPosition`,3,0],[`aNormal`,3,12],[`aExtra`,1,24]];return{draw(i){let a=`${i.extras.join(`,`)}:${i.extraMeta.join(`,`)}`,o=n.get(a);if(!o){let t=e.createBuffer();if(!t)throw Error(`engenty: accessory allocation failed`);let r=b(i);if(e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,r,e.STATIC_DRAW),o={buffer:t,count:r.length/7},n.set(a,o),n.size>24){let t=n.entries().next().value;t&&(e.deleteBuffer(t[1].buffer),n.delete(t[0]))}}e.bindBuffer(e.ARRAY_BUFFER,o.buffer);for(let[n,i,a]of r){let r=e.getAttribLocation(t,n);e.enableVertexAttribArray(r),e.vertexAttribPointer(r,i,e.FLOAT,!1,28,a)}e.drawArrays(e.TRIANGLES,0,o.count)},dispose(){for(let t of n.values())e.deleteBuffer(t.buffer);n.clear()}}}var S=`${y}
152
+ in vec3 aPosition;
153
+ in vec3 aNormal;
154
+ in float aExtra;
155
+ out vec3 vNormal;
156
+ out float vAlpha;
157
+ void main(){
158
+ int index=int(aExtra+0.5);
159
+ vec3 p=aPosition;
160
+ p.y+=sin(uTime*1.5+float(index)*1.7)*1.2;
161
+ p.x+=cos(uTime*1.1+float(index))*0.5;
162
+ vNormal=rotateCoat(aNormal);
163
+ vAlpha=mix(uExtraMeta[index].y,1.0,0.65);
164
+ gl_Position=projectCoat(poseCoat(p));
165
+ }
166
+ `,C=`${y}
167
+ in vec3 vNormal;
168
+ in float vAlpha;
169
+ out vec4 outColor;
170
+ void main(){
171
+ vec3 n=normalize(vNormal),light=normalize(uLight);
172
+ float diffuse=max(dot(n,light),0.0);
173
+ vec3 color=mix(uDeep,uBody,0.55+diffuse*0.45)*(0.7+diffuse*0.45);
174
+ vec3 halfLight=normalize(light+vec3(0.0,0.0,1.0));
175
+ color+=vec3(0.85)*pow(max(dot(n,halfLight),0.0),48.0);
176
+ color+=uTip*pow(1.0-abs(n.z),3.0)*0.2;
177
+ outColor=vec4(color*vAlpha,vAlpha);
178
+ }
179
+ `,w={inflate:27,softness:.05,clarity:.15},T=`uResolution.uTime.uBlobs.uFalloff.uScale.uFur.uPeriod.uInflate.uDensity.uThick.uLean.uLight.uBody.uDeep.uTip.uEye.uWind.uGaze.uTurn.uGoggles.uExtras.uExtraMeta.uWobble.uClarity.uSoftness.uPull`.split(`.`);function E(e,t,n){let r=e.createShader(t);if(!r)throw Error(`engenty fur: could not create shader`);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS)){let t=e.getShaderInfoLog(r);throw e.deleteShader(r),Error(`engenty fur: shader compile failed — ${t}`)}return r}function D(e,t,n){let r=e.getContext(`webgl2`,{alpha:!0,antialias:!0,depth:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,stencil:!1});if(!r)return null;let i=null;try{let e=E(r,r.VERTEX_SHADER,n.vertex),a=E(r,r.FRAGMENT_SHADER,t);if(i=r.createProgram(),!i)throw Error(`engenty fur: could not create program`);if(r.attachShader(i,e),r.attachShader(i,a),r.linkProgram(i),r.deleteShader(e),r.deleteShader(a),!r.getProgramParameter(i,r.LINK_STATUS))throw Error(`engenty fur: link failed — ${r.getProgramInfoLog(i)}`)}catch(e){return i&&r.deleteProgram(i),console.error(e),null}let a={};for(let e of T)a[e]=r.getUniformLocation(i,e);let o=r.createVertexArray();r.bindVertexArray(o);let s=n.geometry(r,i),c=r.useProgram.bind(r);r.enable(r.BLEND),r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA);let l=!1,u=1;return{dispose(){l||(l=!0,s.dispose(),r.deleteVertexArray(o),r.deleteProgram(i))},render(e){l||(c(i),r.bindVertexArray(o),r.uniform2f(a.uResolution,u,u),r.uniform1f(a.uTime,e.time),r.uniform4fv(a.uBlobs,e.blobs),r.uniform1f(a.uFalloff,e.falloff),r.uniform1f(a.uScale,e.scale),r.uniform1f(a.uFur,e.fur),r.uniform1f(a.uPeriod,e.period),r.uniform1f(a.uInflate,e.inflate),r.uniform1f(a.uDensity,e.density),r.uniform1f(a.uThick,e.thick),r.uniform1f(a.uClarity,e.clarity),r.uniform1f(a.uSoftness,e.softness??w.softness),r.uniform4fv(a.uPull,e.pull??[60,60,0,0]),r.uniform2fv(a.uLean,e.lean),r.uniform3fv(a.uLight,e.light),r.uniform3fv(a.uBody,e.body),r.uniform3fv(a.uDeep,e.deep),r.uniform3fv(a.uTip,e.tip),r.uniform3fv(a.uEye,e.eye),r.uniform1f(a.uWind,e.wind),r.uniform2fv(a.uGaze,e.gaze),r.uniform2fv(a.uTurn,e.turn??[0,0]),r.uniform1f(a.uGoggles,+!!e.goggles),r.uniform4fv(a.uExtras,e.extras),r.uniform4fv(a.uExtraMeta,e.extraMeta),r.uniform2fv(a.uWobble,e.wobble),r.enable(r.SCISSOR_TEST),r.scissor(0,0,u,u),r.enable(r.DEPTH_TEST),r.depthFunc(r.LEQUAL),r.depthMask(!0),r.frontFace(r.CW),n.doubleSided?r.disable(r.CULL_FACE):(r.enable(r.CULL_FACE),r.cullFace(r.BACK)),n.clear!==!1&&(r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT)),r.depthMask(n.depthWrite!==!1),s.draw(e))},viewport(e){l||(u=e,r.viewport(0,0,e,e))}}}var O=new Map,k=[[0,5,1,6],[0,1,2,6],[0,2,3,6],[0,3,7,6],[0,7,4,6],[0,4,5,6]];function A(e){return`${e.blobs.join(`,`)}:${e.falloff}:${e.inflate}`}function j(e,t){let n=0,r=[0,0,0];for(let i=0;i<t.blobs.length;i+=4){let a=t.blobs[i+2],o=t.blobs[i+3];if(a<=0||o<=0)continue;let s=a*t.inflate/30,c=e[0]-t.blobs[i],l=e[1]-t.blobs[i+1],u=e[2],d=Math.exp(-t.falloff*(c*c/(a*a)+l*l/(o*o)+u*u/(s*s)));n+=d,r[0]+=d*c/(a*a),r[1]+=d*l/(o*o),r[2]+=d*u/(s*s)}let i=Math.hypot(...r)||1;return{value:n,normal:[r[0]/i,r[1]/i,r[2]/i]}}function M(e){let t=A(e),n=O.get(t);if(n)return n;let r=[1/0,1/0,1/0],i=[-1/0,-1/0,-1/0];for(let t=0;t<e.blobs.length;t+=4){if(e.blobs[t+2]<=0)continue;let n=[e.blobs[t],e.blobs[t+1],0],a=[e.blobs[t+2],e.blobs[t+3],e.blobs[t+2]*e.inflate/30];for(let e=0;e<3;e++)r[e]=Math.min(r[e],n[e]-a[e]*1.5),i[e]=Math.max(i[e],n[e]+a[e]*1.5)}let a=2.7,[o,s,c]=i.map((e,t)=>Math.ceil((e-r[t])/a)+1),l=[],u=[];for(let t=0;t<c;t++)for(let n=0;n<s;n++)for(let i=0;i<o;i++){let o=[r[0]+i*a,r[1]+n*a,r[2]+t*a];l.push(o),u.push(j(o,e).value)}let d=Math.exp(-e.falloff),f=[],p=0,m=(e,t)=>{let n=(d-u[e])/(u[t]-u[e]);return[0,1,2].map(r=>l[e][r]+(l[t][r]-l[e][r])*n)},h=(t,n,r)=>{let i=n.map((e,n)=>e-t[n]),a=r.map((e,n)=>e-t[n]),o=[i[1]*a[2]-i[2]*a[1],i[2]*a[0]-i[0]*a[2],i[0]*a[1]-i[1]*a[0]],s=Math.hypot(...o)*.5;if(s<1e-9)return;let c=j(t,e).normal,l=o.reduce((e,t,n)=>e+t*c[n],0)<0?[t,r,n]:[t,n,r];for(let t of l)f.push(...t,...j(t,e).normal);p+=s};for(let e=0;e<c-1;e++)for(let t=0;t<s-1;t++)for(let n=0;n<o-1;n++){let r=n+o*(t+s*e),i=o*s,a=[r,r+1,r+o+1,r+o,r+i,r+i+1,r+i+o+1,r+i+o];if(!(a.every(e=>u[e]<d)||a.every(e=>u[e]>=d)))for(let e of k){let t=e.map(e=>a[e]).filter(e=>u[e]>=d),n=e.map(e=>a[e]).filter(e=>u[e]<d);if(t.length===1)h(...n.map(e=>m(t[0],e)));else if(t.length===3)h(...t.map(e=>m(n[0],e)));else if(t.length===2){let e=m(t[0],n[0]),r=m(t[0],n[1]),i=m(t[1],n[0]),a=m(t[1],n[1]);h(e,r,i),h(r,a,i)}}}let g={vertices:new Float32Array(f),area:p};if(O.set(t,g),O.size>24){let e=O.keys().next().value;e&&O.delete(e)}return g}function te(e,t,n){let r=0,i=200;for(let a=0;a<24;a++){let a=(r+i)/2,o=0;for(let r=0;r<e.blobs.length;r+=4){let[i,s,c,l]=e.blobs.slice(r,r+4);c<=0||(o+=Math.exp(-e.falloff*(((t-i)/c)**2+((n-s)/l)**2+(a/(c*e.inflate/30))**2)))}o>Math.exp(-e.falloff)?r=a:i=a}return(r+i)/2}function ne(e){let t=[],[n,r,i]=e.eye,a=i*1.35,o=te(e,n,r),s=(e,n,r)=>{let i=n.map((t,n)=>t-e[n]),a=r.map((t,n)=>t-e[n]),o=[i[1]*a[2]-i[2]*a[1],i[2]*a[0]-i[0]*a[2],i[0]*a[1]-i[1]*a[0]];for(let i of o.reduce((t,n,r)=>t+n*e[r+3],0)<0?[e,r,n]:[e,n,r])t.push(...i)},c=(e,t,n)=>{for(let r=0;r<e;r++)for(let i=0;i<t;i++){let a=n(r/e,i/t),o=n((r+1)/e,i/t),c=n((r+1)/e,(i+1)/t),l=n(r/e,(i+1)/t);s(a,o,c),s(a,c,l)}},l=(e,t,i,a,s)=>c(96,16,(c,l)=>{let u=c*Math.PI*2,d=l*Math.PI*2,f=Math.cos(u)*Math.cos(d)/t,p=Math.sin(u)*Math.cos(d)/t,m=Math.sin(d)/a,h=Math.hypot(f,p,m);return[n+Math.cos(u)*(e+Math.cos(d)*t),r+Math.sin(u)*(e+Math.cos(d)*t),o+i+Math.sin(d)*a,f/h,p/h,m/h,s]});l(a*1.14,a*.2,.3,1.5,0),l(a*1.13,a*.14,2.1,1.8,1);for(let e=0;e<4;e++){let t=Math.PI/4+e*Math.PI/2,i=n+Math.cos(t)*a*1.13,s=r+Math.sin(t)*a*1.13;c(10,12,(e,t)=>{let n=e*Math.PI,r=t*Math.PI*2,a=[Math.sin(n)*Math.cos(r),Math.sin(n)*Math.sin(r),Math.cos(n)];return[i+a[0]*.65,s+a[1]*.65,o+3.9+a[2]*.4,...a,2]})}return c(18,96,(e,t)=>{let i=t*Math.PI*2,s=Math.cos(i)*e,c=Math.sin(i)*e,l=[s*.45,c*.45,1],u=Math.hypot(...l);return[n+s*a,r+c*a,o+2.4+2.3*(1-e*e),l[0]/u,l[1]/u,l[2]/u,3]}),new Float32Array(t)}function re(e,t){let n=new Map,r=[[`aPosition`,3,0],[`aNormal`,3,12],[`aMaterial`,1,24]];return{draw(i){if(!i.goggles)return;let a=`${A(i)}:${i.eye.join(`,`)}`,o=n.get(a);if(!o){let t=e.createBuffer();if(!t)throw Error(`engenty: goggle allocation failed`);let r=ne(i);if(e.bindBuffer(e.ARRAY_BUFFER,t),e.bufferData(e.ARRAY_BUFFER,r,e.STATIC_DRAW),o={buffer:t,count:r.length/7},n.set(a,o),n.size>24){let t=n.entries().next().value;t&&(e.deleteBuffer(t[1].buffer),n.delete(t[0]))}}e.bindBuffer(e.ARRAY_BUFFER,o.buffer);for(let[n,i,a]of r){let r=e.getAttribLocation(t,n);e.enableVertexAttribArray(r),e.vertexAttribPointer(r,i,e.FLOAT,!1,28,a)}e.drawArrays(e.TRIANGLES,0,o.count)},dispose(){for(let{buffer:t}of n.values())e.deleteBuffer(t);n.clear()}}}var N=`${y}
180
+ in vec3 aPosition;
181
+ in vec3 aNormal;
182
+ in float aMaterial;
183
+ out vec3 vNormal;
184
+ flat out int vMaterial;
185
+ void main(){
186
+ vNormal=poseNormal(aPosition,aNormal);
187
+ vMaterial=int(aMaterial+0.5);
188
+ gl_Position=projectCoat(poseCoat(aPosition));
189
+ }
190
+ `,ie=`${y}
191
+ in vec3 vNormal;
192
+ flat in int vMaterial;
193
+ out vec4 outColor;
194
+ void main(){
195
+ vec3 n=normalize(vNormal),light=normalize(uLight),view=vec3(0.0,0.0,1.0);
196
+ float diffuse=max(dot(n,light),0.0);
197
+ float spec=pow(max(dot(n,normalize(light+view)),0.0),48.0);
198
+ if(vMaterial==3){
199
+ float fres=0.025+0.975*pow(1.0-max(dot(n,view),0.0),5.0);
200
+ float shine=pow(max(dot(n,normalize(light+view)),0.0),100.0);
201
+ float alpha=0.045+fres*0.3+shine*0.38;
202
+ vec3 glass=mix(vec3(0.35,0.65,0.73),vec3(1.0),clamp(shine*3.0,0.0,1.0));
203
+ outColor=vec4(glass*alpha,alpha);return;
204
+ }
205
+ vec3 base=vMaterial==0?vec3(0.1,0.065,0.04):vMaterial==2?vec3(0.3,0.18,0.07):vec3(0.68,0.4,0.12);
206
+ vec3 reflected=mix(vec3(0.1,0.065,0.04),vec3(1.0,0.85,0.52),smoothstep(-0.7,0.8,-reflect(-view,n).y));
207
+ vec3 color=base*(0.4+diffuse*0.75)+reflected*(vMaterial==0?0.04:0.27)+vec3(1.0,0.9,0.65)*spec*(vMaterial==0?0.1:0.8);
208
+ outColor=vec4(color,1.0);
209
+ }
210
+ `,P=`${y}
211
+ in vec3 aPosition;
212
+ in vec3 aNormal;
213
+ out vec3 vLocal;
214
+ out vec3 vNormal;
215
+ void main(){
216
+ vLocal=aPosition;
217
+ vNormal=poseNormal(aPosition,aNormal);
218
+ gl_Position=projectCoat(poseCoat(aPosition));
219
+ }
220
+ `,F=`
221
+ in vec3 vLocal;
222
+ in vec3 vNormal;
223
+ out vec4 outColor;
224
+ `,ae=`${y}${F}
225
+ void main(){
226
+ vec2 p=vLocal.xy;
227
+ vec3 n=normalize(vNormal),light=normalize(uLight);
228
+ float aa=max(fwidth(p.x),fwidth(p.y))*0.7;
229
+ float lit=max(dot(n,light),0.0);
230
+ vec3 color=mix(uDeep,uBody,0.48)*(0.65+0.5*lit);
231
+ float front=smoothstep(0.0,2.0,vLocal.z);
232
+ vec2 ep=p-uEye.xy;
233
+ float er=uEye.z*1.35;
234
+ color*=mix(0.7,1.0,smoothstep(er*0.9,er*1.35,length(ep))*front+(1.0-front));
235
+ float phase=fract(uTime/5.4);
236
+ float blink=smoothstep(0.955,0.972,phase)-smoothstep(0.972,0.99,phase);
237
+ ep.y/=max(1.0-blink,0.035);
238
+ float lens=(1.0-smoothstep(er-aa,er+aa,length(ep)))*front;
239
+ vec3 eyeNormal=rotateCoat(vec3(ep/er,sqrt(max(0.0,1.0-dot(ep,ep)/(er*er)))));
240
+ vec3 eyeColor=mix(vec3(0.78,0.83,0.92),vec3(1.0),0.5+max(dot(eyeNormal,light),0.0)*0.5);
241
+ vec2 pupil=ep-uGaze/max(1.0,length(uGaze))*er*0.42;
242
+ float iris=1.0-smoothstep(er*0.43-aa,er*0.43+aa,length(pupil));
243
+ eyeColor=mix(eyeColor,vec3(0.075,0.06,0.13),iris);
244
+ float glint=1.0-smoothstep(er*0.1,er*0.16,length(pupil+vec2(er*0.14,er*0.17)));
245
+ eyeColor=mix(eyeColor,vec3(1.0),glint*iris);
246
+ // Directional contact shade from the irregular fur fringe, strongest above.
247
+ float angle=atan(ep.y,ep.x);
248
+ float edge=length(ep)/er+sin(angle*19.0)*0.025+sin(angle*37.0)*0.015;
249
+ float contact=smoothstep(0.72,1.02,edge)*(0.25+0.3*clamp(-ep.y/er,0.0,1.0));
250
+ eyeColor*=1.0-contact;
251
+ color=mix(color,eyeColor,lens);
252
+ vec4 extras=extrasOver(p,uDeep*0.55,uBody,aa)*front*(1.0-lens);
253
+ color=color*(1.0-extras.a)+extras.rgb;
254
+ vec4 goggles=gogglesOver(p,aa,front);
255
+ outColor=vec4(goggles.rgb+color*(1.0-goggles.a),1.0);
256
+ }
257
+ `,I=`${y}${F}
258
+ /** Luminance, for turning a reflection into coverage. */
259
+ float lum(vec3 c) { return dot(c, vec3(0.2126, 0.7152, 0.0722)); }
260
+
261
+ /**
262
+ * Coverage of a soft rectangular window seen in direction \`r\`, sitting in
263
+ * the key direction \`w\`. \`soft\` is the blur of the lobe reflecting it.
264
+ */
265
+ float windowLobe(vec3 r, vec3 w, float soft, bool panes) {
266
+ float facing = dot(r, w);
267
+ if (facing <= 0.0) { return 0.0; }
268
+ // Tangent frame around the window direction.
269
+ vec3 ax = normalize(cross(w, vec3(0.0, 0.0, 1.0)));
270
+ vec3 ay = cross(w, ax);
271
+ vec2 q = vec2(dot(r, ax), dot(r, ay)) / facing;
272
+ vec2 half_ = vec2(0.26, 0.42);
273
+ vec2 cov = smoothstep(half_ + soft, half_ - soft, abs(q));
274
+ float win = cov.x * cov.y;
275
+ if (panes) {
276
+ // Mullions: two columns, three rows. The grid is what makes a bright
277
+ // patch read as a window and the surface as glass.
278
+ float bar = 0.018;
279
+ float mx = 1.0 - smoothstep(bar, bar + soft, abs(q.x));
280
+ float my = 1.0 - smoothstep(bar, bar + soft, abs(abs(q.y) - 0.14));
281
+ win *= 1.0 - 0.85 * max(mx, my);
282
+ }
283
+ return win;
284
+ }
285
+
286
+ void main(){
287
+ vec2 p=vLocal.xy;
288
+ vec3 n=normalize(vNormal);
289
+ float front=smoothstep(0.0,2.0,vLocal.z);
290
+ float aaPx=max(fwidth(p.x),fwidth(p.y))*0.75;
291
+ vec4 extras=extrasOver(p,uDeep*0.55,uBody,aaPx)*front;
292
+ vec3 light = normalize(uLight);
293
+ vec3 view = vec3(0.0, 0.0, 1.0);
294
+ // 1 at the thick centre, 0 at the rim.
295
+ float ndv = clamp(n.z, 0.0, 1.0);
296
+
297
+ // Wavelength-dependent absorption keeps thick gel saturated and its rim clear.
298
+ vec3 skin=mix(uBody,vec3(1.0),0.18);
299
+ vec3 sigma=-log(max(uBody,0.025)/max(skin,0.026));
300
+ float side=clamp(-dot(n.xy,light.xy),-1.0,1.0);
301
+ float chord=ndv*(1.3+0.4*side);
302
+ vec3 gel=skin*exp(-sigma*chord*1.6);
303
+ float wrap=clamp((dot(n,light)+0.6)/1.6,0.0,1.0);
304
+ vec3 col=mix(uDeep*0.5,gel,0.42+wrap*0.58)*(0.75+wrap*0.35);
305
+ // A soft transmitted lobe brightens the side opposite the key light.
306
+ float transmitted=pow(max(dot(n,normalize(vec3(-light.xy,0.45))),0.0),5.0);
307
+ col+=mix(uBody,uTip,0.4)*transmitted*(0.32+0.55*(1.0-ndv));
308
+ vec3 refracted=refract(-view,n,1.0/1.36);
309
+ float focus=pow(max(dot(normalize(vec3(-refracted.xy,ndv)),light),0.0),12.0);
310
+ col+=uBody*focus*0.28;
311
+
312
+ // Soft, restrained studio reflections follow the deformed surface normal.
313
+ float f0=0.023;
314
+ float fres=f0+(1.0-f0)*pow(1.0-ndv,5.0);
315
+ vec3 r=reflect(-view,n);
316
+ float windowHdr=5.0;
317
+ vec3 room=mix(vec3(0.075,0.07,0.1),vec3(0.65,0.68,0.73),smoothstep(-0.8,0.8,-r.y));
318
+ float key=windowLobe(r,light,0.11,false);
319
+ float fill=windowLobe(r,normalize(vec3(0.85,0.12,0.35)),0.14,false);
320
+ vec3 coat=vec3(1.0)*key*(0.12+fres*0.24);
321
+ vec3 reflection=room*fres*0.24+coat+vec3(0.65,0.84,1.0)*fill*(0.05+fres*0.12);
322
+ reflection+=uTip*pow(1.0-ndv,7.0)*0.06;
323
+ reflection=1.0-exp(-reflection*1.8);
324
+ col=col*(1.0-fres*0.45)+reflection;
325
+ // Approximate transmission into the host background; the shared canvas does
326
+ // not sample DOM pixels, so this deliberately avoids claiming scene refraction.
327
+ float clarity=mix(0.55,0.24,smoothstep(0.0,0.85,ndv))*uClarity;
328
+ float alpha=min(1.0,1.0-clarity+lum(reflection)*0.65);
329
+ vec4 acc=vec4(min(col,vec3(1.0))*alpha,alpha);
330
+
331
+ // ─── eye, in the gel ───────────────────────────────────────────────────────
332
+ float phase = fract(uTime / 5.4);
333
+ float blink = smoothstep(0.955, 0.972, phase) - smoothstep(0.972, 0.99, phase);
334
+ vec2 ep = p - eyeCentre();
335
+ ep.y /= max(1.0 - blink, 0.06);
336
+ float er = uEye.z * 1.35;
337
+ float aa = er * 0.06;
338
+ // A soft dark socket under the lens, as if it sits a little inside the gel.
339
+ acc.rgb *= mix(1.0, mix(0.7, 1.0, smoothstep(er * 0.95, er * 1.4, length(ep))), front);
340
+
341
+ float lens = smoothstep(er + aa, er - aa, length(ep)) * front;
342
+ if (lens > 0.0) {
343
+ // ─── glass eye ─────────────────────────────────────────────────────────
344
+ // The lens is a dome set into the gel and the pupil a dark glass bead on
345
+ // it: each has its own hemisphere normal and is shaded like the body —
346
+ // window reflection, Fresnel rim, a little light leaking through the
347
+ // bead's far side — rather than painted flat.
348
+ vec2 el = ep / er;
349
+ float ez = sqrt(max(0.0, 1.0 - dot(el, el)));
350
+ vec3 en = rotateCoat(vec3(el, ez));
351
+ float ndlE = max(dot(en, light), 0.0);
352
+ // Sclera: milky glass, darker where the dome meets the socket.
353
+ vec3 eyeCol = vec3(0.93, 0.94, 0.97) * (0.62 + 0.38 * ndlE) * mix(0.55, 1.0, smoothstep(0.0, 0.5, ez));
354
+
355
+ vec2 pupilAt = uGaze * er * 0.45;
356
+ float pr = er * 0.42;
357
+ vec2 pl = (ep - pupilAt) / pr;
358
+ float pz = sqrt(max(0.0, 1.0 - dot(pl, pl)));
359
+ vec3 pn = vec3(pl, pz);
360
+ float pupil = smoothstep(pr + aa, pr - aa, length(ep - pupilAt));
361
+ if (pupil > 0.0) {
362
+ vec3 bead = mix(vec3(0.05, 0.04, 0.10), vec3(0.16, 0.13, 0.24), pow(1.0 - pz, 2.0));
363
+ // The bead is transparent too: light entering at the top leaves at the
364
+ // bottom edge, warmed by the iris.
365
+ float leak = pow(max(dot(pn, normalize(vec3(-light.xy, 0.2))), 0.0), 4.0) * (1.0 - pz);
366
+ bead += mix(uTip, vec3(1.0), 0.4) * leak * 0.55;
367
+ vec3 pr_ = reflect(-view, pn);
368
+ float pf = 0.03 + 0.97 * pow(1.0 - pz, 5.0);
369
+ // A bead this small would show the window as a speck; a flatter
370
+ // reflection normal spreads it to the broad soft patch a glass eye has.
371
+ vec3 prw = reflect(-view, normalize(vec3(pl * 0.4, pz)));
372
+ vec3 pref = (mix(vec3(0.12), vec3(0.6), smoothstep(-0.7, 0.9, -pr_.y)) * pf * 2.0)
373
+ + vec3(1.0) * windowLobe(prw, light, 0.1, true) * windowHdr * (0.05 + pf * 0.5);
374
+ bead += 1.0 - exp(-pref);
375
+ eyeCol = mix(eyeCol, min(bead, vec3(1.0)), pupil);
376
+ }
377
+
378
+ // Wet skin over the whole lens.
379
+ vec3 er_ = reflect(-view, en);
380
+ float ef = 0.022 + 0.978 * pow(1.0 - ez, 5.0);
381
+ vec3 lensRef = vec3(0.7, 0.72, 0.8) * ef * 1.6
382
+ + vec3(1.0) * windowLobe(er_, light, 0.06, true) * windowHdr * (0.02 + ef * 0.3);
383
+ eyeCol += 1.0 - exp(-lensRef);
384
+
385
+ acc.rgb = acc.rgb * (1.0 - lens) + min(eyeCol, vec3(1.0)) * lens;
386
+ acc.a = acc.a * (1.0 - lens) + lens;
387
+ }
388
+
389
+ // Decals sit in the gel: slightly softened by the coat's own alpha, and the
390
+ // wet skin's reflection lies over them.
391
+ float da = extras.a * 0.92;
392
+ acc.rgb = acc.rgb * (1.0 - da) + (extras.rgb + coat * extras.a * 0.5) * 0.92;
393
+ acc.a = acc.a * (1.0 - da) + da;
394
+
395
+ vec4 goggles = gogglesOver(p, aaPx, front);
396
+ outColor = goggles + acc * (1.0 - goggles.a);
397
+ }
398
+ `,L=8,R=256;function oe(e,t,n,r,i){let a=-Math.sin(n[0]),o=Math.cos(n[0])*Math.sin(n[1]),s=Math.cos(n[0])*Math.cos(n[1]),c=1/0,l=-1/0;for(let t=0;t<e.length;t+=L){let n=e[t]*a+e[t+1]*o+e[t+2]*s;c=Math.min(c,n),l=Math.max(l,n)}i.fill(0);let u=255/Math.max(l-c,.001);for(let t=0;t<r.length;t++){let n=t*L,l=e[n]*a+e[n+1]*o+e[n+2]*s,d=Math.min(255,Math.max(0,Math.floor((l-c)*u)));r[t]=d,i[d]++}let d=0;for(let e=0;e<R;e++){let t=i[e];i[e]=d,d+=t}for(let n=0;n<r.length;n++){let a=i[r[n]]++*L;for(let r=0;r<L;r++)t[a+r]=e[n*L+r]}}function se(e){return{roots:e,sorted:new Float32Array(e.length),buckets:new Uint16Array(e.length/L),counts:new Uint32Array(R),yaw:NaN,pitch:NaN}}function ce(e){let t=M(e),n=781,r=()=>(n=(n*1664525+1013904223)%4294967296,n/4294967296),i=[],a=Math.min(200,Math.max(10,e.density))**2/4e3,o=t.vertices;for(let e=0;e<o.length;e+=18){let t=[o[e+6]-o[e],o[e+7]-o[e+1],o[e+8]-o[e+2]],n=[o[e+12]-o[e],o[e+13]-o[e+1],o[e+14]-o[e+2]],s=Math.hypot(t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0])*.5*a,c=Math.floor(s)+ +(r()<s%1);for(let t=0;t<c;t++){let t=Math.sqrt(r()),n=r(),a=[1-t,t*(1-n),t*n],s=Array.from({length:6},(t,n)=>a.reduce((t,r,i)=>t+r*o[e+i*6+n],0)),c=Math.hypot(s[3],s[4],s[5]);i.push(s[0],s[1],s[2],s[3]/c,s[4]/c,s[5]/c,r(),r())}}return new Float32Array(i)}function z(e,t){let n=new Map,r=e.getAttribLocation(t,`aRoot`),i=e.getAttribLocation(t,`aNormal`),a=e.getAttribLocation(t,`aRandom`);return{draw(t){let o=`${A(t)}:${t.density}`,s=n.get(o);if(!s){let r=e.createBuffer();if(!r)throw Error(`engenty: strand allocation failed`);let i=ce(t);if(e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,i,e.DYNAMIC_DRAW),s={buffer:r,count:i.length/8,order:se(i)},n.set(o,s),n.size>24){let t=n.entries().next().value;t&&(e.deleteBuffer(t[1].buffer),n.delete(t[0]))}}e.bindBuffer(e.ARRAY_BUFFER,s.buffer);let c=t.turn??[0,0],l=s.order;(l.yaw!==c[0]||l.pitch!==c[1])&&(oe(l.roots,l.sorted,c,l.buckets,l.counts),e.bufferSubData(e.ARRAY_BUFFER,0,l.sorted),l.yaw=c[0],l.pitch=c[1]);for(let[t,n,o]of[[r,3,0],[i,3,12],[a,2,24]])e.enableVertexAttribArray(t),e.vertexAttribPointer(t,n,e.FLOAT,!1,32,o),e.vertexAttribDivisor(t,1);e.drawArraysInstanced(e.TRIANGLE_STRIP,0,18,s.count)},dispose(){for(let t of n.values())e.deleteBuffer(t.buffer);n.clear()}}}var B=`${y}
399
+ in vec3 aRoot;
400
+ in vec3 aNormal;
401
+ in vec2 aRandom;
402
+ out vec3 vColor;
403
+ out float vAcross;
404
+ out float vCoverage;
405
+ void main(){
406
+ float t=float(gl_VertexID/2)/8.0;
407
+ float side=float(gl_VertexID%2)*2.0-1.0;
408
+ float eyeDistance=length(aRoot.xy-uEye.xy);
409
+ float front=smoothstep(0.0,2.0,aRoot.z);
410
+ float eyeAngle=atan(aRoot.y-uEye.y,aRoot.x-uEye.x);
411
+ float rim=uEye.z*1.35;
412
+ float fringe=sin(eyeAngle*19.0)*0.025+sin(eyeAngle*37.0)*0.015;
413
+ float socket=mix(1.0,smoothstep(rim*(0.88+fringe),rim*(1.08+fringe),eyeDistance),front);
414
+ socket=mix(socket,mix(1.0,smoothstep(rim*1.22,rim*1.4,eyeDistance),front),uGoggles);
415
+ float bandY=aRoot.y-uEye.y+1.7*pow((aRoot.x-uEye.x)/max(uScale,1.0),2.0);
416
+ float strap=(1.0-smoothstep(uEye.z*0.3,uEye.z*0.5,abs(bandY)))*uGoggles*smoothstep(0.5,6.0,-sdBody(aRoot.xy));
417
+ // Compress the pile only on the facing surface; side tufts cover strap ends.
418
+ strap*=smoothstep(0.45,0.8,abs(aNormal.z));
419
+ float underfur=1.0-step(0.36,aRandom.x);
420
+ float len=uFur*mix(0.55+aRandom.x*0.55,0.3+aRandom.x*0.5,underfur)*socket*(1.0-strap*0.75);
421
+ vec3 tangent=normalize(cross(aNormal,abs(aNormal.y)>0.9?vec3(1.0,0.0,0.0):vec3(0.0,1.0,0.0)));
422
+ vec3 flow=aNormal*0.95+tangent*(aRandom.y-0.5)*0.5+vec3(0.04,0.12,0.0);
423
+ float nearEye=front*(1.0-smoothstep(rim, rim*1.5,eyeDistance));
424
+ flow.xy-=normalize(aRoot.xy-uEye.xy+vec2(0.001))*nearEye*0.7;
425
+ float wave=sin(uTime*1.8+aRoot.y*0.09+aRandom.x*TAU);
426
+ vec3 bend=vec3(wave*uWind*0.12,0.07+aRandom.y*0.12,0.0);
427
+ vec3 centre=poseCoat(aRoot+len*(flow*t+bend*t*t));
428
+ vec3 direction=rotateCoat(flow+2.0*bend*t);
429
+ vec2 across=normalize(vec2(-direction.y,direction.x)+vec2(0.00001));
430
+ float radius=uThick*(0.1+aRandom.y*0.09)*mix(1.0,1.8,underfur)*pow(1.0-t,0.8);
431
+ float pixel=VIEW/uResolution.x/coatZoom();
432
+ centre.xy+=across*side*max(radius,pixel*0.7);
433
+ gl_Position=projectCoat(centre);
434
+ vec3 n=normalize(rotateCoat(aNormal/bodyStretch()));
435
+ float lit=max(dot(n,normalize(uLight)),0.0);
436
+ vColor=mix(uDeep,uBody,0.52+t*0.48)*(0.6+lit*0.65);
437
+ vColor+=uTip*pow(1.0-abs(n.z),3.0)*(0.08+t*0.22);
438
+ vColor*=0.82+aRandom.y*0.32;
439
+ vColor+=vec3(0.08)*pow(lit,12.0)*t;
440
+ vAcross=side;
441
+ vCoverage=min(1.0,radius/(pixel*0.7))*socket*(1.0-strap*0.85);
442
+ }
443
+ `,V=`#version 300 es
444
+ precision highp float;
445
+ in vec3 vColor;
446
+ in float vAcross;
447
+ in float vCoverage;
448
+ out vec4 outColor;
449
+ void main(){
450
+ float alpha=(1.0-smoothstep(0.35,1.0,abs(vAcross)))*vCoverage;
451
+ if(alpha<0.025)discard;
452
+ outColor=vec4(vColor*alpha,alpha);
453
+ }
454
+ `;function H(e,t){let n=new Map,r=e.getAttribLocation(t,`aPosition`),i=e.getAttribLocation(t,`aNormal`);return{draw(t){let a=A(t),o=n.get(a);if(!o){let r=e.createBuffer();if(!r)throw Error(`engenty: body allocation failed`);let i=M(t);if(e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,i.vertices,e.STATIC_DRAW),o={buffer:r,count:i.vertices.length/6},n.set(a,o),n.size>24){let t=n.entries().next().value;t&&(e.deleteBuffer(t[1].buffer),n.delete(t[0]))}}e.bindBuffer(e.ARRAY_BUFFER,o.buffer);for(let[t,n]of[[r,0],[i,12]])e.enableVertexAttribArray(t),e.vertexAttribPointer(t,3,e.FLOAT,!1,24,n);e.drawArrays(e.TRIANGLES,0,o.count)},dispose(){for(let t of n.values())e.deleteBuffer(t.buffer);n.clear()}}}function U(e,t){let n=D(e,t===`fur`?ae:I,{vertex:t===`fur`?P:P.replace(`#version 300 es`,`#version 300 es
455
+ #define JELLY_COAT`),geometry:H});if(!n)return null;let r=[n];if(t===`fur`){let t=D(e,V,{vertex:B,geometry:z,clear:!1,doubleSided:!0,depthWrite:!1});if(!t)return n.dispose(),null;r.push(t)}let i=D(e,C,{vertex:S,geometry:x,clear:!1});if(!i){for(let e of r)e.dispose();return null}r.push(i);let a=D(e,ie,{vertex:t===`jelly`?N.replace(`#version 300 es`,`#version 300 es
456
+ #define JELLY_COAT`):N,geometry:re,clear:!1});if(!a){for(let e of r)e.dispose();return null}return r.push(a),{render(e){for(let t of r)t.render(e)},viewport(e){for(let t of r)t.viewport(e)},dispose(){for(let e of r)e.dispose()}}}var W=new Map,G=new Set;function le(e){if(G.has(e)||typeof document>`u`)return null;let t=document.createElement(`canvas`);t.width=1,t.height=1;let n=U(t,e);return n?(t.addEventListener(`webglcontextlost`,t=>{t.preventDefault(),W.delete(e)}),{canvas:t,refs:0,renderer:n,size:0}):(G.add(e),null)}function ue(e=`fur`){let t=W.get(e);if(!t){let n=le(e);if(!n)return null;W.set(e,n),t=n}let n=t;n.refs+=1;let r=!1;return{drawInto(t,i,a){if(r||W.get(e)!==n)return;let o=i;o>n.size&&(n.size=o,n.canvas.width=o,n.canvas.height=o),n.renderer.viewport(o),n.renderer.render(a),t.clearRect(0,0,t.canvas.width,t.canvas.height),t.drawImage(n.canvas,0,n.canvas.height-o,o,o,0,0,t.canvas.width,t.canvas.height)},release(){r||(r=!0,--n.refs,n.refs<=0&&W.get(e)===n&&(n.renderer.dispose(),W.delete(e)))}}}var K=Math.PI/18;function q(e,t){let n=K/Math.max(1,Math.hypot(e,t));return[e*n,t===0?0:-t*n]}function J(e,t,n){if(n<=0)return;let r=3.8,i=Math.sqrt(110-r*r),a=Math.exp(-3.8*n),o=Math.cos(i*n),s=Math.sin(i*n);for(let[n,c,l]of[[`x`,`vx`,t[0]],[`y`,`vy`,t[1]]]){let t=e[n]-l,u=e[c];e[n]=l+a*(t*o+(u+r*t)/i*s),e[c]=a*(u*o-(r*u+110*t)/i*s)}}function de(e,t){let n={x:0,y:0,vx:0,vy:0},r=[60,60],i=null,a=[0,0],o=!1,s=n=>{if(!t()||n.button!==0||i!==null)return;let s=e.getBoundingClientRect(),c=(n.clientX-s.left)/s.width*152+-16,l=(n.clientY-s.top)/s.height*152+-16;Math.hypot(c-60,l-60)>48||(r[0]=c,r[1]=l,a=[n.clientX,n.clientY],i=n.pointerId,o=!1,e.setPointerCapture(i))},c=r=>{if(r.pointerId!==i)return;if(!t()){l(r);return}let s=e.getBoundingClientRect(),c=(r.clientX-a[0])/s.width*152,u=(r.clientY-a[1])/s.height*152,d=Math.min(1,18/(Math.hypot(c,u)||1));n.x=c*d,n.y=u*d,n.vx=0,n.vy=0,o||=Math.hypot(r.clientX-a[0],r.clientY-a[1])>4},l=t=>{t.pointerId===i&&(i=null,e.hasPointerCapture(t.pointerId)&&e.releasePointerCapture(t.pointerId))},u=e=>{o&&=(e.preventDefault(),e.stopPropagation(),!1)};return e.addEventListener(`pointerdown`,s),e.addEventListener(`pointermove`,c),e.addEventListener(`pointerup`,l),e.addEventListener(`pointercancel`,l),e.addEventListener(`lostpointercapture`,l),e.addEventListener(`click`,u,!0),{step(e){return i===null&&J(n,[0,0],e),[r[0],r[1],n.x,n.y]},dispose(){i!==null&&e.hasPointerCapture(i)&&e.releasePointerCapture(i),e.removeEventListener(`pointerdown`,s),e.removeEventListener(`pointermove`,c),e.removeEventListener(`pointerup`,l),e.removeEventListener(`pointercancel`,l),e.removeEventListener(`lostpointercapture`,l),e.removeEventListener(`click`,u,!0)}}}var Y={x:0,y:0},X=new Set,Z=!1;function fe(e){Y.x=e.clientX,Y.y=e.clientY;for(let e of X)e()}function pe(){return Y}function me(e){return!Z&&typeof window<`u`&&(Z=!0,Y.x=window.innerWidth*.62,Y.y=window.innerHeight*.28,window.addEventListener(`pointermove`,fe,{passive:!0})),X.add(e),()=>{X.delete(e)}}var Q=e(n(),1),he={high:{density:68,dprCap:2,thick:1},low:{density:40,dprCap:1,thick:1.15},medium:{density:55,dprCap:1.5,thick:1.05}},ge=1.7,$=0,_e=2.399963,ve=[-.42,-.72,.75],ye=30,be=.5,xe=e=>(e- -16)/152*100;function Se({className:e,motion:t=`auto`,animationSpeed:n=1,turn:i,coat:a=`fur`,goggles:c=!1,interactive:d=!0,look:p=null,kind:m=`round`,overrides:h,quality:g=`high`,size:_=260}){let v=(0,f.useRef)(null),y=(0,f.useRef)(null),b=(0,f.useRef)(0);b.current===0&&($+=1,b.current=$*_e);let x=(0,f.useRef)(null),[S,C]=(0,f.useState)(!0),T=o[m],E=(0,f.useMemo)(()=>s(T),[T]),D=(0,f.useMemo)(()=>l(T),[T]),O=(0,f.useMemo)(()=>r(T),[T]),k=(0,f.useRef)({animationSpeed:n,motion:t,turn:i,goggles:c,blobs:E,extras:D,form:T,interactive:d,kind:m,look:p,overrides:h,quality:g,scale:O,size:_});return k.current={animationSpeed:n,motion:t,turn:i,goggles:c,blobs:E,extras:D,form:T,interactive:d,kind:m,look:p,overrides:h,quality:g,scale:O,size:_},(0,f.useEffect)(()=>{v.current?.()},[m,h,g,_,d,p,c,t,n,i]),(0,f.useEffect)(()=>{let e=y.current,t=x.current;if(!(e&&t))return;let n=e.getContext(`2d`),r=n?ue(a):null;if(!(n&&r)){C(!1);return}let i=b.current,o=window.matchMedia(`(prefers-reduced-motion: reduce)`),s={x:0,y:0},c={x:0,y:0},l={vx:0,vy:0,x:0,y:0},u=0,d=!0,f=0,p=0,m=a===`jelly`?de(t,()=>k.current.interactive&&k.current.motion!==`pause`&&(k.current.motion===`play`||!o.matches)):null,h=g=>{u=0;let _=k.current,v=he[_.quality],y=_.motion===`pause`||_.motion===`auto`&&o.matches,b=y?0:Math.min((g-(p||g))/1e3,.1);f+=b*Math.max(.1,Math.min(2,_.animationSpeed)),p=g;let x=Math.min(window.devicePixelRatio||1,v.dprCap),S=Math.max(1,Math.round(_.size*x));e.width!==S&&(e.width=S,e.height=S);let C=120*S/(ge*152),T=_.overrides?.fur??_.form.fur;if((_.interactive||_.look)&&!y){let e,n,r,i;if(_.look)e=_.look.x,n=_.look.y,r=Math.hypot(e,n)||1,i=Math.min(1,r);else{let a=t.getBoundingClientRect(),o=pe();e=o.x-(a.left+a.width*.5),n=o.y-(a.top+a.height*.48),r=Math.hypot(e,n)||1,i=.35+Math.min(1,r/(a.width*2.4||1))*.65}s.x+=(e/r*5.5*i-s.x)*.16,s.y+=(n/r*3.5*i-s.y)*.16,c.x+=(e/r*i-c.x)*.24,c.y+=(n/r*.9*i-c.y)*.24}J(l,[s.x,s.y],b*Math.max(.1,Math.min(2,_.animationSpeed)));let E=ee(t,_.kind);r.drawInto(n,S,{blobs:_.blobs,clarity:_.overrides?.clarity??w.clarity,softness:_.overrides?.softness??w.softness,pull:m?.step(b*Math.max(.1,Math.min(2,_.animationSpeed))),body:E.body,deep:E.deep,density:Math.min(_.overrides?.density??v.density,C),extraMeta:_.extras.meta,extras:_.extras.geometry,eye:[_.form.eye.x,_.form.eye.y,_.form.eye.r],gaze:[c.x,c.y],goggles:_.goggles,turn:_.turn?q(_.turn.yaw/K,_.turn.pitch/K):q(c.x,c.y),fur:T,inflate:_.overrides?.inflate??(a===`jelly`?w.inflate:ye),lean:[s.x,s.y],light:ve,period:_.form.period,scale:_.scale,falloff:_.form.falloff,thick:_.overrides?.thick??v.thick,time:f+i,tip:E.tip,wind:_.overrides?.wind??be,wobble:[l.x-s.x,l.y-s.y]}),d&&!y&&(u=requestAnimationFrame(h))},g=()=>{u||=(p=0,requestAnimationFrame(h))},_=new IntersectionObserver(([e])=>{d=e?.isIntersecting??!0,d?g():u&&=(cancelAnimationFrame(u),0)},{rootMargin:`120px`});_.observe(t),v.current=g;let S=me(g);return o.addEventListener(`change`,g),g(),()=>{v.current=null,_.disconnect(),m?.dispose(),S(),o.removeEventListener(`change`,g),u&&cancelAnimationFrame(u),r.release()}},[a]),S?(0,Q.jsxs)(`div`,{"aria-hidden":`true`,className:e,ref:x,style:{height:_,position:`relative`,width:_},children:[(0,Q.jsx)(`div`,{style:{background:`radial-gradient(closest-side, rgb(0 0 0 / 0.2), transparent)`,filter:`blur(4px)`,height:`${T.shadowRx*50/152}%`,left:`50%`,position:`absolute`,top:`${xe(110)}%`,transform:`translate(-50%, -50%)`,width:`${T.shadowRx*2.5*100/152}%`}}),(0,Q.jsx)(`canvas`,{ref:y,style:{display:`block`,height:_,width:_,touchAction:a===`jelly`&&d&&t!==`pause`?`none`:void 0,cursor:a===`jelly`&&d?`grab`:void 0}})]}):(0,Q.jsx)(u,{className:e,goggles:c,kind:m,size:_})}export{Se as FluffyEngenty};