@askrjs/askr 0.0.21 → 0.0.25

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 (294) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +160 -46
  3. package/dist/_virtual/___vite-browser-external.js +1 -0
  4. package/dist/_virtual/__vite-browser-external.js +1 -0
  5. package/dist/_virtual/_commonjsHelpers.js +1 -0
  6. package/dist/_virtual/main.js +1 -0
  7. package/dist/_virtual/preload-helper.js +1 -0
  8. package/dist/{benchmark.d.ts → bench/benchmark-entry.d.ts} +3 -3
  9. package/dist/bench/benchmark-entry.d.ts.map +1 -0
  10. package/dist/benchmark.js +1 -1
  11. package/dist/boot/index.d.ts +70 -0
  12. package/dist/boot/index.d.ts.map +1 -0
  13. package/dist/boot/index.js +2 -0
  14. package/dist/common/component.d.ts +16 -0
  15. package/dist/common/component.d.ts.map +1 -0
  16. package/dist/common/errors.d.ts +53 -0
  17. package/dist/common/errors.d.ts.map +1 -0
  18. package/dist/common/index.d.ts +14 -0
  19. package/dist/common/index.d.ts.map +1 -0
  20. package/dist/common/jsx.d.ts +17 -0
  21. package/dist/common/jsx.d.ts.map +1 -0
  22. package/dist/common/jsx.js +1 -0
  23. package/dist/{jsx-CPjsGyEg.d.ts → common/props.d.ts} +6 -18
  24. package/dist/common/props.d.ts.map +1 -0
  25. package/dist/{router-DaGtH1Sq.d.ts → common/router.d.ts} +10 -7
  26. package/dist/common/router.d.ts.map +1 -0
  27. package/dist/common/ssr-errors.d.ts +8 -0
  28. package/dist/common/ssr-errors.d.ts.map +1 -0
  29. package/dist/common/ssr-errors.js +1 -0
  30. package/dist/common/ssr.d.ts +17 -0
  31. package/dist/common/ssr.d.ts.map +1 -0
  32. package/dist/common/vnode.d.ts +17 -0
  33. package/dist/common/vnode.d.ts.map +1 -0
  34. package/dist/common/vnode.js +1 -0
  35. package/dist/components/link.d.ts +56 -0
  36. package/dist/components/link.d.ts.map +1 -0
  37. package/dist/components/link.js +1 -0
  38. package/dist/dev/invariant.d.ts +83 -0
  39. package/dist/dev/invariant.d.ts.map +1 -0
  40. package/dist/dev/invariant.js +2 -0
  41. package/dist/dev/logger.d.ts +13 -0
  42. package/dist/dev/logger.d.ts.map +1 -0
  43. package/dist/dev/logger.js +1 -0
  44. package/dist/dev/vite-plugin-askr.d.ts +18 -0
  45. package/dist/dev/vite-plugin-askr.d.ts.map +1 -0
  46. package/dist/dev/warnings.d.ts +5 -0
  47. package/dist/dev/warnings.d.ts.map +1 -0
  48. package/dist/for/for.d.ts +16 -0
  49. package/dist/for/for.d.ts.map +1 -0
  50. package/dist/for/for.js +1 -0
  51. package/dist/for/index.d.ts +2 -63
  52. package/dist/for/index.d.ts.map +1 -0
  53. package/dist/for/index.js +1 -1
  54. package/dist/foundations/core.d.ts +23 -0
  55. package/dist/foundations/core.d.ts.map +1 -0
  56. package/dist/foundations/core.js +1 -0
  57. package/dist/foundations/index.d.ts +3 -669
  58. package/dist/foundations/index.d.ts.map +1 -0
  59. package/dist/foundations/index.js +1 -1
  60. package/dist/foundations/interactions/dismissable.d.ts +58 -0
  61. package/dist/foundations/interactions/dismissable.d.ts.map +1 -0
  62. package/dist/foundations/interactions/dismissable.js +1 -0
  63. package/dist/foundations/interactions/focusable.d.ts +16 -0
  64. package/dist/foundations/interactions/focusable.d.ts.map +1 -0
  65. package/dist/foundations/interactions/focusable.js +1 -0
  66. package/dist/foundations/interactions/hoverable.d.ts +19 -0
  67. package/dist/foundations/interactions/hoverable.d.ts.map +1 -0
  68. package/dist/foundations/interactions/hoverable.js +1 -0
  69. package/dist/foundations/interactions/index.d.ts +5 -0
  70. package/dist/foundations/interactions/index.d.ts.map +1 -0
  71. package/dist/foundations/interactions/interaction-policy.d.ts +96 -0
  72. package/dist/foundations/interactions/interaction-policy.d.ts.map +1 -0
  73. package/dist/foundations/interactions/interaction-policy.js +1 -0
  74. package/dist/foundations/interactions/pressable.d.ts +54 -0
  75. package/dist/foundations/interactions/pressable.d.ts.map +1 -0
  76. package/dist/foundations/interactions/pressable.js +1 -0
  77. package/dist/foundations/interactions/roving-focus.d.ts +117 -0
  78. package/dist/foundations/interactions/roving-focus.d.ts.map +1 -0
  79. package/dist/foundations/interactions/roving-focus.js +1 -0
  80. package/dist/foundations/state/controllable.d.ts +53 -0
  81. package/dist/foundations/state/controllable.d.ts.map +1 -0
  82. package/dist/foundations/state/controllable.js +1 -0
  83. package/dist/foundations/state/index.d.ts +2 -0
  84. package/dist/foundations/state/index.d.ts.map +1 -0
  85. package/dist/foundations/structures/collection.d.ts +67 -0
  86. package/dist/foundations/structures/collection.d.ts.map +1 -0
  87. package/dist/foundations/structures/collection.js +1 -0
  88. package/dist/foundations/structures/index.d.ts +5 -0
  89. package/dist/foundations/structures/index.d.ts.map +1 -0
  90. package/dist/foundations/structures/layer.d.ts +102 -0
  91. package/dist/foundations/structures/layer.d.ts.map +1 -0
  92. package/dist/foundations/structures/layer.js +1 -0
  93. package/dist/{layout-BINPv-nz.d.ts → foundations/structures/layout.d.ts} +3 -4
  94. package/dist/foundations/structures/layout.d.ts.map +1 -0
  95. package/dist/foundations/structures/layout.js +1 -0
  96. package/dist/foundations/structures/portal.d.ts +33 -0
  97. package/dist/foundations/structures/portal.d.ts.map +1 -0
  98. package/dist/foundations/structures/portal.js +1 -0
  99. package/dist/foundations/structures/presence.d.ts +30 -0
  100. package/dist/foundations/structures/presence.d.ts.map +1 -0
  101. package/dist/foundations/structures/presence.js +1 -0
  102. package/dist/foundations/structures/slot.d.ts +31 -0
  103. package/dist/foundations/structures/slot.d.ts.map +1 -0
  104. package/dist/foundations/structures/slot.js +1 -0
  105. package/dist/foundations/structures.d.ts +14 -0
  106. package/dist/foundations/structures.d.ts.map +1 -0
  107. package/dist/foundations/structures.js +1 -0
  108. package/dist/foundations/utilities/aria.d.ts +13 -0
  109. package/dist/foundations/utilities/aria.d.ts.map +1 -0
  110. package/dist/foundations/utilities/aria.js +1 -0
  111. package/dist/foundations/utilities/compose-handlers.d.ts +34 -0
  112. package/dist/foundations/utilities/compose-handlers.d.ts.map +1 -0
  113. package/dist/foundations/utilities/compose-handlers.js +1 -0
  114. package/dist/foundations/utilities/compose-ref.d.ts +24 -0
  115. package/dist/foundations/utilities/compose-ref.d.ts.map +1 -0
  116. package/dist/foundations/utilities/compose-ref.js +1 -0
  117. package/dist/foundations/utilities/event-types.d.ts +17 -0
  118. package/dist/foundations/utilities/event-types.d.ts.map +1 -0
  119. package/dist/foundations/utilities/index.d.ts +7 -0
  120. package/dist/foundations/utilities/index.d.ts.map +1 -0
  121. package/dist/foundations/utilities/merge-props.d.ts +2 -0
  122. package/dist/foundations/utilities/merge-props.d.ts.map +1 -0
  123. package/dist/foundations/utilities/merge-props.js +1 -0
  124. package/dist/foundations/utilities/use-id.d.ts +29 -0
  125. package/dist/foundations/utilities/use-id.d.ts.map +1 -0
  126. package/dist/foundations/utilities/use-id.js +1 -0
  127. package/dist/fx/fx.d.ts +30 -0
  128. package/dist/fx/fx.d.ts.map +1 -0
  129. package/dist/fx/fx.js +1 -0
  130. package/dist/fx/index.d.ts +5 -184
  131. package/dist/fx/index.d.ts.map +1 -0
  132. package/dist/fx/index.js +1 -1
  133. package/dist/fx/noop.d.ts +12 -0
  134. package/dist/fx/noop.d.ts.map +1 -0
  135. package/dist/fx/noop.js +1 -0
  136. package/dist/fx/timing.d.ts +155 -0
  137. package/dist/fx/timing.d.ts.map +1 -0
  138. package/dist/fx/timing.js +1 -0
  139. package/dist/index.d.ts +18 -37
  140. package/dist/index.d.ts.map +1 -0
  141. package/dist/index.js +1 -1
  142. package/dist/jsx/index.d.ts +4 -0
  143. package/dist/jsx/index.d.ts.map +1 -0
  144. package/dist/jsx/index.js +1 -0
  145. package/dist/jsx/jsx-dev-runtime.d.ts +4 -0
  146. package/dist/jsx/jsx-dev-runtime.d.ts.map +1 -0
  147. package/dist/jsx/jsx-runtime.d.ts +10 -0
  148. package/dist/jsx/jsx-runtime.d.ts.map +1 -0
  149. package/dist/{types-BTT0Fc9S.d.ts → jsx/types.d.ts} +6 -3
  150. package/dist/jsx/types.d.ts.map +1 -0
  151. package/dist/jsx/types.js +1 -0
  152. package/dist/jsx/utils.d.ts +4 -0
  153. package/dist/jsx/utils.d.ts.map +1 -0
  154. package/dist/jsx/utils.js +1 -0
  155. package/dist/jsx-dev-runtime.js +1 -1
  156. package/dist/jsx-runtime.js +1 -1
  157. package/dist/node_modules/esbuild/lib/main.js +65 -0
  158. package/dist/renderer/cleanup.d.ts +25 -0
  159. package/dist/renderer/cleanup.d.ts.map +1 -0
  160. package/dist/renderer/cleanup.js +1 -0
  161. package/dist/renderer/dom.d.ts +44 -0
  162. package/dist/renderer/dom.d.ts.map +1 -0
  163. package/dist/renderer/dom.js +1 -0
  164. package/dist/renderer/evaluate.d.ts +4 -0
  165. package/dist/renderer/evaluate.d.ts.map +1 -0
  166. package/dist/renderer/evaluate.js +1 -0
  167. package/dist/renderer/fastpath.d.ts +7 -0
  168. package/dist/renderer/fastpath.d.ts.map +1 -0
  169. package/dist/renderer/fastpath.js +1 -0
  170. package/dist/renderer/index.d.ts +6 -0
  171. package/dist/renderer/index.d.ts.map +1 -0
  172. package/dist/renderer/index.js +1 -0
  173. package/dist/renderer/keyed.d.ts +23 -0
  174. package/dist/renderer/keyed.d.ts.map +1 -0
  175. package/dist/renderer/keyed.js +1 -0
  176. package/dist/renderer/reconcile.d.ts +88 -0
  177. package/dist/renderer/reconcile.d.ts.map +1 -0
  178. package/dist/renderer/reconcile.js +1 -0
  179. package/dist/renderer/types.d.ts +3 -0
  180. package/dist/renderer/types.d.ts.map +1 -0
  181. package/dist/renderer/types.js +1 -0
  182. package/dist/renderer/utils.d.ts +63 -0
  183. package/dist/renderer/utils.d.ts.map +1 -0
  184. package/dist/renderer/utils.js +1 -0
  185. package/dist/resources/index.d.ts +7 -22
  186. package/dist/resources/index.d.ts.map +1 -0
  187. package/dist/resources/index.js +1 -1
  188. package/dist/router/index.d.ts +8 -87
  189. package/dist/router/index.d.ts.map +1 -0
  190. package/dist/router/index.js +1 -1
  191. package/dist/router/match.d.ts +22 -0
  192. package/dist/router/match.d.ts.map +1 -0
  193. package/dist/router/match.js +1 -0
  194. package/dist/router/navigate.d.ts +20 -0
  195. package/dist/router/navigate.d.ts.map +1 -0
  196. package/dist/router/navigate.js +1 -0
  197. package/dist/router/route.d.ts +52 -0
  198. package/dist/router/route.d.ts.map +1 -0
  199. package/dist/router/route.js +1 -0
  200. package/dist/runtime/component.d.ts +123 -0
  201. package/dist/runtime/component.d.ts.map +1 -0
  202. package/dist/runtime/component.js +1 -0
  203. package/dist/runtime/context.d.ts +80 -0
  204. package/dist/runtime/context.d.ts.map +1 -0
  205. package/dist/runtime/context.js +1 -0
  206. package/dist/runtime/derive.d.ts +7 -0
  207. package/dist/runtime/derive.d.ts.map +1 -0
  208. package/dist/runtime/derive.js +1 -0
  209. package/dist/runtime/dev-namespace.d.ts +31 -0
  210. package/dist/runtime/dev-namespace.d.ts.map +1 -0
  211. package/dist/runtime/dev-namespace.js +1 -0
  212. package/dist/runtime/events.d.ts +52 -0
  213. package/dist/runtime/events.d.ts.map +1 -0
  214. package/dist/runtime/events.js +1 -0
  215. package/dist/runtime/execution-model.d.ts +4 -0
  216. package/dist/runtime/execution-model.d.ts.map +1 -0
  217. package/dist/runtime/execution-model.js +1 -0
  218. package/dist/runtime/fastlane.d.ts +27 -0
  219. package/dist/runtime/fastlane.d.ts.map +1 -0
  220. package/dist/runtime/fastlane.js +1 -0
  221. package/dist/runtime/for.d.ts +52 -0
  222. package/dist/runtime/for.d.ts.map +1 -0
  223. package/dist/runtime/for.js +1 -0
  224. package/dist/runtime/hydration.d.ts +25 -0
  225. package/dist/runtime/hydration.d.ts.map +1 -0
  226. package/dist/runtime/operations.d.ts +39 -0
  227. package/dist/runtime/operations.d.ts.map +1 -0
  228. package/dist/runtime/operations.js +1 -0
  229. package/dist/runtime/resource-cell.d.ts +35 -0
  230. package/dist/runtime/resource-cell.d.ts.map +1 -0
  231. package/dist/runtime/resource-cell.js +1 -0
  232. package/dist/runtime/scheduler.d.ts +48 -0
  233. package/dist/runtime/scheduler.d.ts.map +1 -0
  234. package/dist/runtime/scheduler.js +1 -0
  235. package/dist/runtime/snapshot.d.ts +25 -0
  236. package/dist/runtime/snapshot.d.ts.map +1 -0
  237. package/dist/runtime/ssr-bridge.d.ts +10 -0
  238. package/dist/runtime/ssr-bridge.d.ts.map +1 -0
  239. package/dist/runtime/ssr-bridge.js +1 -0
  240. package/dist/runtime/state.d.ts +56 -0
  241. package/dist/runtime/state.d.ts.map +1 -0
  242. package/dist/runtime/state.js +1 -0
  243. package/dist/ssr/attrs.d.ts +26 -0
  244. package/dist/ssr/attrs.d.ts.map +1 -0
  245. package/dist/ssr/attrs.js +1 -0
  246. package/dist/ssr/context.d.ts +47 -0
  247. package/dist/ssr/context.d.ts.map +1 -0
  248. package/dist/ssr/context.js +1 -0
  249. package/dist/ssr/create-ssr.d.ts +19 -0
  250. package/dist/ssr/create-ssr.d.ts.map +1 -0
  251. package/dist/ssr/errors.d.ts +6 -0
  252. package/dist/ssr/errors.d.ts.map +1 -0
  253. package/dist/ssr/errors.js +1 -0
  254. package/dist/ssr/escape.d.ts +38 -0
  255. package/dist/ssr/escape.d.ts.map +1 -0
  256. package/dist/ssr/escape.js +1 -0
  257. package/dist/ssr/index.d.ts +18 -94
  258. package/dist/ssr/index.d.ts.map +1 -0
  259. package/dist/ssr/index.js +1 -1
  260. package/dist/ssr/render-keys.d.ts +39 -0
  261. package/dist/ssr/render-keys.d.ts.map +1 -0
  262. package/dist/ssr/render-keys.js +1 -0
  263. package/dist/ssr/sink.d.ts +23 -0
  264. package/dist/ssr/sink.d.ts.map +1 -0
  265. package/dist/ssr/sink.js +1 -0
  266. package/dist/ssr/stream-render.d.ts +7 -0
  267. package/dist/ssr/stream-render.d.ts.map +1 -0
  268. package/dist/ssr/stream-render.js +1 -0
  269. package/dist/ssr/types.d.ts +21 -0
  270. package/dist/ssr/types.d.ts.map +1 -0
  271. package/dist/vite/index.js +3 -1
  272. package/package.json +11 -10
  273. package/dist/chunk-37RC6ZT3.js +0 -1
  274. package/dist/chunk-3L6PFAJ3.js +0 -1
  275. package/dist/chunk-47D5SNYH.js +0 -1
  276. package/dist/chunk-4RTKQ7SC.js +0 -1
  277. package/dist/chunk-5PLQPS3O.js +0 -1
  278. package/dist/chunk-62D2TNHX.js +0 -1
  279. package/dist/chunk-BP2CKUO6.js +0 -1
  280. package/dist/chunk-D2JSJKCW.js +0 -1
  281. package/dist/chunk-EQ5S5GU4.js +0 -1
  282. package/dist/chunk-HGMOQ3I7.js +0 -1
  283. package/dist/chunk-HZKAD5DE.js +0 -1
  284. package/dist/chunk-ILZCMHZM.js +0 -2
  285. package/dist/chunk-NL44ANML.js +0 -2
  286. package/dist/chunk-YRY4OLQF.js +0 -1
  287. package/dist/component-AJMg1Gmv.d.ts +0 -177
  288. package/dist/jsx-dev-runtime.d.ts +0 -7
  289. package/dist/jsx-runtime.d.ts +0 -14
  290. package/dist/logger-NGZDJLVS.js +0 -1
  291. package/dist/main-EPE35NMW.js +0 -65
  292. package/dist/navigate-4VAVLF3A.js +0 -1
  293. package/dist/route-IVG3V65Y.js +0 -1
  294. package/dist/vite/index.d.ts +0 -17
@@ -0,0 +1,65 @@
1
+ import"../../../_virtual/_commonjsHelpers.js";import ie from"../../../_virtual/___vite-browser-external.js";var qe,pt;function dr(){if(pt)return qe;pt=1;var Ne={},wt=Object.create,Pe=Object.defineProperty,yt=Object.getOwnPropertyDescriptor,bt=Object.getOwnPropertyNames,vt=Object.getPrototypeOf,xt=Object.prototype.hasOwnProperty,$t=(e,t)=>{for(var r in t)Pe(e,r,{get:t[r],enumerable:!0})},Je=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of bt(t))!xt.call(e,l)&&l!==r&&Pe(e,l,{get:()=>t[l],enumerable:!(n=yt(t,l))||n.enumerable});return e},ur=(e,t,r)=>(r=e!=null?wt(vt(e)):{},Je(t||!e||!e.__esModule?Pe(r,"default",{value:e,enumerable:!0}):r,e)),Et=e=>Je(Pe({},"__esModule",{value:!0}),e),xe={};$t(xe,{analyzeMetafile:()=>Xt,analyzeMetafileSync:()=>rr,build:()=>Ht,buildSync:()=>Zt,context:()=>Kt,default:()=>ar,formatMessages:()=>Gt,formatMessagesSync:()=>tr,initialize:()=>ir,stop:()=>nr,transform:()=>Qt,transformSync:()=>er,version:()=>Yt}),qe=Et(xe);function Ve(e){let t=n=>{if(n===null)r.write8(0);else if(typeof n=="boolean")r.write8(1),r.write8(+n);else if(typeof n=="number")r.write8(2),r.write32(n|0);else if(typeof n=="string")r.write8(3),r.write(re(n));else if(n instanceof Uint8Array)r.write8(4),r.write(n);else if(n instanceof Array){r.write8(5),r.write32(n.length);for(let l of n)t(l)}else{let l=Object.keys(n);r.write8(6),r.write32(l.length);for(let s of l)r.write(re(s)),t(n[s])}},r=new Ye;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),Ue(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function kt(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return pe(r.read());case 4:return r.read();case 5:{let a=r.read32(),h=[];for(let o=0;o<a;o++)h.push(t());return h}case 6:{let a=r.read32(),h={};for(let o=0;o<a;o++)h[pe(r.read())]=t();return h}default:throw new Error("Invalid packet")}},r=new Ye(e),n=r.read32(),l=(n&1)===0;n>>>=1;let s=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:n,isRequest:l,value:s}}var Ye=class{constructor(e=new Uint8Array(1024)){this.buf=e,this.len=0,this.ptr=0}_write(e){if(this.len+e>this.buf.length){let t=new Uint8Array((this.len+e)*2);t.set(this.buf),this.buf=t}return this.len+=e,this.len-e}write8(e){let t=this._write(1);this.buf[t]=e}write32(e){let t=this._write(4);Ue(this.buf,e,t)}write(e){let t=this._write(4+e.length);Ue(this.buf,e.length,t),this.buf.set(e,t+4)}_read(e){if(this.ptr+e>this.buf.length)throw new Error("Invalid packet");return this.ptr+=e,this.ptr-e}read8(){return this.buf[this._read(1)]}read32(){return He(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),r=this._read(t.length);return t.set(this.buf.subarray(r,r+e)),t}},re,pe,Re;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;re=r=>e.encode(r),pe=r=>t.decode(r),Re='new TextEncoder().encode("")'}else if(typeof Buffer<"u")re=e=>Buffer.from(e),pe=e=>{let{buffer:t,byteOffset:r,byteLength:n}=e;return Buffer.from(t,r,n).toString()},Re='Buffer.from("")';else throw new Error("No UTF-8 codec found");if(!(re("")instanceof Uint8Array))throw new Error(`Invariant violation: "${Re} instanceof Uint8Array" is incorrectly false
2
+
3
+ This indicates that your JavaScript environment is broken. You cannot use
4
+ esbuild in this environment because esbuild relies on this invariant. This
5
+ is not a problem with esbuild. You need to fix your environment instead.
6
+ `);function He(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function Ue(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}var V=JSON.stringify,Ke="warning",Qe="silent";function we(e,t){const r=[];for(const n of e){if(Q(n,t),n.indexOf(",")>=0)throw new Error(`Invalid ${t}: ${n}`);r.push(n)}return r.join(",")}var je=()=>null,U=e=>typeof e=="boolean"?null:"a boolean",y=e=>typeof e=="string"?null:"a string",Oe=e=>e instanceof RegExp?null:"a RegExp object",ce=e=>typeof e=="number"&&e===(e|0)?null:"an integer",St=e=>typeof e=="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",Ge=e=>typeof e=="function"?null:"a function",le=e=>Array.isArray(e)?null:"an array",K=e=>Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"an array of strings",X=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",At=e=>typeof e=="object"&&e!==null?null:"an array or an object",Pt=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Xe=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Ze=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",jt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",et=e=>typeof e=="string"||Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"a string or an array of strings",tt=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",Ot=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function i(e,t,r,n){let l=e[r];if(t[r+""]=!0,l===void 0)return;let s=n(l);if(s!==null)throw new Error(`${V(r)} must be ${s}`);return l}function q(e,t,r){for(let n in e)if(!(n in t))throw new Error(`Invalid option ${r}: ${V(n)}`)}function Dt(e){let t=Object.create(null),r=i(e,t,"wasmURL",Ot),n=i(e,t,"wasmModule",Pt),l=i(e,t,"worker",U);return q(e,t,"in initialize() call"),{wasmURL:r,wasmModule:n,worker:l}}function rt(e){let t;if(e!==void 0){t=Object.create(null);for(let r in e){let n=e[r];if(typeof n=="string"||n===!1)t[r]=n;else throw new Error(`Expected ${V(r)} in mangle cache to map to either a string or false`)}}return t}function De(e,t,r,n,l){let s=i(t,r,"color",U),a=i(t,r,"logLevel",y),h=i(t,r,"logLimit",ce);s!==void 0?e.push(`--color=${s}`):n&&e.push("--color=true"),e.push(`--log-level=${a||l}`),e.push(`--log-limit=${h||0}`)}function Q(e,t,r){if(typeof e!="string")throw new Error(`Expected value for ${t}${r!==void 0?" "+V(r):""} to be a string, got ${typeof e} instead`);return e}function nt(e,t,r){let n=i(t,r,"legalComments",y),l=i(t,r,"sourceRoot",y),s=i(t,r,"sourcesContent",U),a=i(t,r,"target",et),h=i(t,r,"format",y),o=i(t,r,"globalName",y),w=i(t,r,"mangleProps",Oe),g=i(t,r,"reserveProps",Oe),$=i(t,r,"mangleQuoted",U),I=i(t,r,"minify",U),_=i(t,r,"minifySyntax",U),B=i(t,r,"minifyWhitespace",U),N=i(t,r,"minifyIdentifiers",U),L=i(t,r,"lineLimit",ce),W=i(t,r,"drop",K),z=i(t,r,"dropLabels",K),x=i(t,r,"charset",y),p=i(t,r,"treeShaking",U),d=i(t,r,"ignoreAnnotations",U),u=i(t,r,"jsx",y),E=i(t,r,"jsxFactory",y),S=i(t,r,"jsxFragment",y),D=i(t,r,"jsxImportSource",y),A=i(t,r,"jsxDev",U),f=i(t,r,"jsxSideEffects",U),c=i(t,r,"define",X),v=i(t,r,"logOverride",X),j=i(t,r,"supported",X),C=i(t,r,"pure",K),P=i(t,r,"keepNames",U),k=i(t,r,"platform",y),O=i(t,r,"tsconfigRaw",jt),R=i(t,r,"absPaths",K);if(n&&e.push(`--legal-comments=${n}`),l!==void 0&&e.push(`--source-root=${l}`),s!==void 0&&e.push(`--sources-content=${s}`),a&&e.push(`--target=${we(Array.isArray(a)?a:[a],"target")}`),h&&e.push(`--format=${h}`),o&&e.push(`--global-name=${o}`),k&&e.push(`--platform=${k}`),O&&e.push(`--tsconfig-raw=${typeof O=="string"?O:JSON.stringify(O)}`),I&&e.push("--minify"),_&&e.push("--minify-syntax"),B&&e.push("--minify-whitespace"),N&&e.push("--minify-identifiers"),L&&e.push(`--line-limit=${L}`),x&&e.push(`--charset=${x}`),p!==void 0&&e.push(`--tree-shaking=${p}`),d&&e.push("--ignore-annotations"),W)for(let m of W)e.push(`--drop:${Q(m,"drop")}`);if(z&&e.push(`--drop-labels=${we(z,"drop label")}`),R&&e.push(`--abs-paths=${we(R,"abs paths")}`),w&&e.push(`--mangle-props=${Le(w)}`),g&&e.push(`--reserve-props=${Le(g)}`),$!==void 0&&e.push(`--mangle-quoted=${$}`),u&&e.push(`--jsx=${u}`),E&&e.push(`--jsx-factory=${E}`),S&&e.push(`--jsx-fragment=${S}`),D&&e.push(`--jsx-import-source=${D}`),A&&e.push("--jsx-dev"),f&&e.push("--jsx-side-effects"),c)for(let m in c){if(m.indexOf("=")>=0)throw new Error(`Invalid define: ${m}`);e.push(`--define:${m}=${Q(c[m],"define",m)}`)}if(v)for(let m in v){if(m.indexOf("=")>=0)throw new Error(`Invalid log override: ${m}`);e.push(`--log-override:${m}=${Q(v[m],"log override",m)}`)}if(j)for(let m in j){if(m.indexOf("=")>=0)throw new Error(`Invalid supported: ${m}`);const F=j[m];if(typeof F!="boolean")throw new Error(`Expected value for supported ${V(m)} to be a boolean, got ${typeof F} instead`);e.push(`--supported:${m}=${F}`)}if(C)for(let m of C)e.push(`--pure:${Q(m,"pure")}`);P&&e.push("--keep-names")}function Ct(e,t,r,n,l){var s;let a=[],h=[],o=Object.create(null),w=null,g=null;De(a,t,o,r,n),nt(a,t,o);let $=i(t,o,"sourcemap",Ze),I=i(t,o,"bundle",U),_=i(t,o,"splitting",U),B=i(t,o,"preserveSymlinks",U),N=i(t,o,"metafile",U),L=i(t,o,"outfile",y),W=i(t,o,"outdir",y),z=i(t,o,"outbase",y),x=i(t,o,"tsconfig",y),p=i(t,o,"resolveExtensions",K),d=i(t,o,"nodePaths",K),u=i(t,o,"mainFields",K),E=i(t,o,"conditions",K),S=i(t,o,"external",K),D=i(t,o,"packages",y),A=i(t,o,"alias",X),f=i(t,o,"loader",X),c=i(t,o,"outExtension",X),v=i(t,o,"publicPath",y),j=i(t,o,"entryNames",y),C=i(t,o,"chunkNames",y),P=i(t,o,"assetNames",y),k=i(t,o,"inject",K),O=i(t,o,"banner",X),R=i(t,o,"footer",X),m=i(t,o,"entryPoints",At),F=i(t,o,"absWorkingDir",y),T=i(t,o,"stdin",X),M=(s=i(t,o,"write",U))!=null?s:l,G=i(t,o,"allowOverwrite",U),J=i(t,o,"mangleCache",X);if(o.plugins=!0,q(t,o,`in ${e}() call`),$&&a.push(`--sourcemap${$===!0?"":`=${$}`}`),I&&a.push("--bundle"),G&&a.push("--allow-overwrite"),_&&a.push("--splitting"),B&&a.push("--preserve-symlinks"),N&&a.push("--metafile"),L&&a.push(`--outfile=${L}`),W&&a.push(`--outdir=${W}`),z&&a.push(`--outbase=${z}`),x&&a.push(`--tsconfig=${x}`),D&&a.push(`--packages=${D}`),p&&a.push(`--resolve-extensions=${we(p,"resolve extension")}`),v&&a.push(`--public-path=${v}`),j&&a.push(`--entry-names=${j}`),C&&a.push(`--chunk-names=${C}`),P&&a.push(`--asset-names=${P}`),u&&a.push(`--main-fields=${we(u,"main field")}`),E&&a.push(`--conditions=${we(E,"condition")}`),S)for(let b of S)a.push(`--external:${Q(b,"external")}`);if(A)for(let b in A){if(b.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${b}`);a.push(`--alias:${b}=${Q(A[b],"alias",b)}`)}if(O)for(let b in O){if(b.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${b}`);a.push(`--banner:${b}=${Q(O[b],"banner",b)}`)}if(R)for(let b in R){if(b.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${b}`);a.push(`--footer:${b}=${Q(R[b],"footer",b)}`)}if(k)for(let b of k)a.push(`--inject:${Q(b,"inject")}`);if(f)for(let b in f){if(b.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${b}`);a.push(`--loader:${b}=${Q(f[b],"loader",b)}`)}if(c)for(let b in c){if(b.indexOf("=")>=0)throw new Error(`Invalid out extension: ${b}`);a.push(`--out-extension:${b}=${Q(c[b],"out extension",b)}`)}if(m)if(Array.isArray(m))for(let b=0,se=m.length;b<se;b++){let ee=m[b];if(typeof ee=="object"&&ee!==null){let ne=Object.create(null),ue=i(ee,ne,"in",y),te=i(ee,ne,"out",y);if(q(ee,ne,"in entry point at index "+b),ue===void 0)throw new Error('Missing property "in" for entry point at index '+b);if(te===void 0)throw new Error('Missing property "out" for entry point at index '+b);h.push([te,ue])}else h.push(["",Q(ee,"entry point at index "+b)])}else for(let b in m)h.push([b,Q(m[b],"entry point",b)]);if(T){let b=Object.create(null),se=i(T,b,"contents",tt),ee=i(T,b,"resolveDir",y),ne=i(T,b,"sourcefile",y),ue=i(T,b,"loader",y);q(T,b,'in "stdin" object'),ne&&a.push(`--sourcefile=${ne}`),ue&&a.push(`--loader=${ue}`),ee&&(g=ee),typeof se=="string"?w=re(se):se instanceof Uint8Array&&(w=se)}let oe=[];if(d)for(let b of d)b+="",oe.push(b);return{entries:h,flags:a,write:M,stdinContents:w,stdinResolveDir:g,absWorkingDir:F,nodePaths:oe,mangleCache:rt(J)}}function Mt(e,t,r,n){let l=[],s=Object.create(null);De(l,t,s,r,n),nt(l,t,s);let a=i(t,s,"sourcemap",Ze),h=i(t,s,"sourcefile",y),o=i(t,s,"loader",y),w=i(t,s,"banner",y),g=i(t,s,"footer",y),$=i(t,s,"mangleCache",X);return q(t,s,`in ${e}() call`),a&&l.push(`--sourcemap=${a===!0?"external":a}`),h&&l.push(`--sourcefile=${h}`),o&&l.push(`--loader=${o}`),w&&l.push(`--banner=${w}`),g&&l.push(`--footer=${g}`),{flags:l,mangleCache:rt($)}}function it(e){const t={},r={didClose:!1,reason:""};let n={},l=0,s=0,a=new Uint8Array(16*1024),h=0,o=x=>{let p=h+x.length;if(p>a.length){let u=new Uint8Array(p*2);u.set(a),a=u}a.set(x,h),h+=x.length;let d=0;for(;d+4<=h;){let u=He(a,d);if(d+4+u>h)break;d+=4,B(a.subarray(d,d+u)),d+=u}d>0&&(a.copyWithin(0,d,h),h-=d)},w=x=>{r.didClose=!0,x&&(r.reason=": "+(x.message||x));const p="The service was stopped"+r.reason;for(let d in n)n[d](p,null);n={}},g=(x,p,d)=>{if(r.didClose)return d("The service is no longer running"+r.reason,null);let u=l++;n[u]=(E,S)=>{try{d(E,S)}finally{x&&x.unref()}},x&&x.ref(),e.writeToStdin(Ve({id:u,isRequest:!0,value:p}))},$=(x,p)=>{if(r.didClose)throw new Error("The service is no longer running"+r.reason);e.writeToStdin(Ve({id:x,isRequest:!1,value:p}))},I=async(x,p)=>{try{if(p.command==="ping"){$(x,{});return}if(typeof p.key=="number"){const d=t[p.key];if(!d)return;const u=d[p.command];if(u){await u(x,p);return}}throw new Error("Invalid command: "+p.command)}catch(d){const u=[de(d,e,null,void 0,"")];try{$(x,{errors:u})}catch{}}},_=!0,B=x=>{if(_){_=!1;let d=String.fromCharCode(...x);if(d!=="0.27.3")throw new Error(`Cannot start service: Host version "0.27.3" does not match binary version ${V(d)}`);return}let p=kt(x);if(p.isRequest)I(p.id,p.value);else{let d=n[p.id];delete n[p.id],p.value.error?d(p.value.error,{}):d(null,p.value)}};return{readFromStdout:o,afterClose:w,service:{buildOrContext:({callName:x,refs:p,options:d,isTTY:u,defaultWD:E,callback:S})=>{let D=0;const A=s++,f={},c={ref(){++D===1&&p&&p.ref()},unref(){--D===0&&(delete t[A],p&&p.unref())}};t[A]=f,c.ref(),Lt(x,A,g,$,c,e,f,d,u,E,(v,j)=>{try{S(v,j)}finally{c.unref()}})},transform:({callName:x,refs:p,input:d,options:u,isTTY:E,fs:S,callback:D})=>{const A=lt();let f=c=>{try{if(typeof d!="string"&&!(d instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:v,mangleCache:j}=Mt(x,u,E,Qe),C={command:"transform",flags:v,inputFS:c!==null,input:c!==null?re(c):typeof d=="string"?re(d):d};j&&(C.mangleCache=j),g(p,C,(P,k)=>{if(P)return D(new Error(P),null);let O=ye(k.errors,A),R=ye(k.warnings,A),m=1,F=()=>{if(--m===0){let T={warnings:R,code:k.code,map:k.map,mangleCache:void 0,legalComments:void 0};"legalComments"in k&&(T.legalComments=k?.legalComments),k.mangleCache&&(T.mangleCache=k?.mangleCache),D(null,T)}};if(O.length>0)return D($e("Transform failed",O,R),null);k.codeFS&&(m++,S.readFile(k.code,(T,M)=>{T!==null?D(T,null):(k.code=M,F())})),k.mapFS&&(m++,S.readFile(k.map,(T,M)=>{T!==null?D(T,null):(k.map=M,F())})),F()})}catch(v){let j=[];try{De(j,u,{},E,Qe)}catch{}const C=de(v,e,A,void 0,"");g(p,{command:"error",flags:j,error:C},()=>{C.detail=A.load(C.detail),D($e("Transform failed",[C],[]),null)})}};if((typeof d=="string"||d instanceof Uint8Array)&&d.length>1024*1024){let c=f;f=()=>S.writeFile(d,c)}f(null)},formatMessages:({callName:x,refs:p,messages:d,options:u,callback:E})=>{if(!u)throw new Error(`Missing second argument in ${x}() call`);let S={},D=i(u,S,"kind",y),A=i(u,S,"color",U),f=i(u,S,"terminalWidth",ce);if(q(u,S,`in ${x}() call`),D===void 0)throw new Error(`Missing "kind" in ${x}() call`);if(D!=="error"&&D!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${x}() call`);let c={command:"format-msgs",messages:ae(d,"messages",null,"",f),isWarning:D==="warning"};A!==void 0&&(c.color=A),f!==void 0&&(c.terminalWidth=f),g(p,c,(v,j)=>{if(v)return E(new Error(v),null);E(null,j.messages)})},analyzeMetafile:({callName:x,refs:p,metafile:d,options:u,callback:E})=>{u===void 0&&(u={});let S={},D=i(u,S,"color",U),A=i(u,S,"verbose",U);q(u,S,`in ${x}() call`);let f={command:"analyze-metafile",metafile:d};D!==void 0&&(f.color=D),A!==void 0&&(f.verbose=A),g(p,f,(c,v)=>{if(c)return E(new Error(c),null);E(null,v.result)})}}}}function Lt(e,t,r,n,l,s,a,h,o,w,g){const $=lt(),I=e==="context",_=(L,W)=>{const z=[];try{De(z,h,{},o,Ke)}catch{}const x=de(L,s,$,void 0,W);r(l,{command:"error",flags:z,error:x},()=>{x.detail=$.load(x.detail),g($e(I?"Context failed":"Build failed",[x],[]),null)})};let B;if(typeof h=="object"){const L=h.plugins;if(L!==void 0){if(!Array.isArray(L))return _(new Error('"plugins" must be an array'),"");B=L}}if(B&&B.length>0){if(s.isSync)return _(new Error("Cannot use plugins in synchronous API calls"),"");Tt(t,r,n,l,s,a,h,B,$).then(L=>{if(!L.ok)return _(L.error,L.pluginName);try{N(L.requestPlugins,L.runOnEndCallbacks,L.scheduleOnDisposeCallbacks)}catch(W){_(W,"")}},L=>_(L,""));return}try{N(null,(L,W)=>W([],[]),()=>{})}catch(L){_(L,"")}function N(L,W,z){const x=s.hasFS,{entries:p,flags:d,write:u,stdinContents:E,stdinResolveDir:S,absWorkingDir:D,nodePaths:A,mangleCache:f}=Ct(e,h,o,Ke,x);if(u&&!s.hasFS)throw new Error('The "write" option is unavailable in this environment');const c={command:"build",key:t,entries:p,flags:d,write:u,stdinContents:E,stdinResolveDir:S,absWorkingDir:D||w,nodePaths:A,context:I};L&&(c.plugins=L),f&&(c.mangleCache=f);const v=(P,k)=>{const O={errors:ye(P.errors,$),warnings:ye(P.warnings,$),outputFiles:void 0,metafile:void 0,mangleCache:void 0},R=O.errors.slice(),m=O.warnings.slice();P.outputFiles&&(O.outputFiles=P.outputFiles.map(_t)),P.metafile&&(O.metafile=JSON.parse(P.metafile)),P.mangleCache&&(O.mangleCache=P.mangleCache),P.writeToStdout!==void 0&&console.log(pe(P.writeToStdout).replace(/\n$/,"")),W(O,(F,T)=>{if(R.length>0||F.length>0){const M=$e("Build failed",R.concat(F),m.concat(T));return k(M,null,F,T)}k(null,O,F,T)})};let j,C;I&&(a["on-end"]=(P,k)=>new Promise(O=>{v(k,(R,m,F,T)=>{const M={errors:F,warnings:T};C&&C(R,m),j=void 0,C=void 0,n(P,M),O()})})),r(l,c,(P,k)=>{if(P)return g(new Error(P),null);if(!I)return v(k,(m,F)=>(z(),g(m,F)));if(k.errors.length>0)return g($e("Context failed",k.errors,k.warnings),null);let O=!1;const R={rebuild:()=>(j||(j=new Promise((m,F)=>{let T;C=(G,J)=>{T||(T=()=>G?F(G):m(J))};const M=()=>{r(l,{command:"rebuild",key:t},(J,oe)=>{J?F(new Error(J)):T?T():M()})};M()})),j),watch:(m={})=>new Promise((F,T)=>{if(!s.hasFS)throw new Error('Cannot use the "watch" API in this environment');const M={},G=i(m,M,"delay",ce);q(m,M,"in watch() call");const J={command:"watch",key:t};G&&(J.delay=G),r(l,J,oe=>{oe?T(new Error(oe)):F(void 0)})}),serve:(m={})=>new Promise((F,T)=>{if(!s.hasFS)throw new Error('Cannot use the "serve" API in this environment');const M={},G=i(m,M,"port",St),J=i(m,M,"host",y),oe=i(m,M,"servedir",y),b=i(m,M,"keyfile",y),se=i(m,M,"certfile",y),ee=i(m,M,"fallback",y),ne=i(m,M,"cors",X),ue=i(m,M,"onRequest",Ge);q(m,M,"in serve() call");const te={command:"serve",key:t,onRequest:!!ue};if(G!==void 0&&(te.port=G),J!==void 0&&(te.host=J),oe!==void 0&&(te.servedir=oe),b!==void 0&&(te.keyfile=b),se!==void 0&&(te.certfile=se),ee!==void 0&&(te.fallback=ee),ne){const Ae={},ve=i(ne,Ae,"origin",et);q(ne,Ae,'on "cors" object'),Array.isArray(ve)?te.corsOrigin=ve:ve!==void 0&&(te.corsOrigin=[ve])}r(l,te,(Ae,ve)=>{if(Ae)return T(new Error(Ae));ue&&(a["serve-request"]=(or,sr)=>{ue(sr.args),n(or,{})}),F(ve)})}),cancel:()=>new Promise(m=>{if(O)return m();r(l,{command:"cancel",key:t},()=>{m()})}),dispose:()=>new Promise(m=>{if(O)return m();O=!0,r(l,{command:"dispose",key:t},()=>{m(),z(),l.unref()})})};l.ref(),g(null,R)})}}var Tt=async(e,t,r,n,l,s,a,h,o)=>{let w=[],g=[],$={},I={},_=[],B=0,N=0,L=[],W=!1;h=[...h];for(let p of h){let d={};if(typeof p!="object")throw new Error(`Plugin at index ${N} must be an object`);const u=i(p,d,"name",y);if(typeof u!="string"||u==="")throw new Error(`Plugin at index ${N} is missing a name`);try{let E=i(p,d,"setup",Ge);if(typeof E!="function")throw new Error("Plugin is missing a setup function");q(p,d,`on plugin ${V(u)}`);let S={name:u,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};N++;let A=E({initialOptions:a,resolve:(f,c={})=>{if(!W)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof f!="string")throw new Error("The path to resolve must be a string");let v=Object.create(null),j=i(c,v,"pluginName",y),C=i(c,v,"importer",y),P=i(c,v,"namespace",y),k=i(c,v,"resolveDir",y),O=i(c,v,"kind",y),R=i(c,v,"pluginData",je),m=i(c,v,"with",X);return q(c,v,"in resolve() call"),new Promise((F,T)=>{const M={command:"resolve",path:f,key:e,pluginName:u};if(j!=null&&(M.pluginName=j),C!=null&&(M.importer=C),P!=null&&(M.namespace=P),k!=null&&(M.resolveDir=k),O!=null)M.kind=O;else throw new Error('Must specify "kind" when calling "resolve"');R!=null&&(M.pluginData=o.store(R)),m!=null&&(M.with=Ft(m,"with")),t(n,M,(G,J)=>{G!==null?T(new Error(G)):F({errors:ye(J.errors,o),warnings:ye(J.warnings,o),path:J.path,external:J.external,sideEffects:J.sideEffects,namespace:J.namespace,suffix:J.suffix,pluginData:o.load(J.pluginData)})})})},onStart(f){let c='This error came from the "onStart" callback registered here:',v=Ce(new Error(c),l,"onStart");w.push({name:u,callback:f,note:v}),S.onStart=!0},onEnd(f){let c='This error came from the "onEnd" callback registered here:',v=Ce(new Error(c),l,"onEnd");g.push({name:u,callback:f,note:v}),S.onEnd=!0},onResolve(f,c){let v='This error came from the "onResolve" callback registered here:',j=Ce(new Error(v),l,"onResolve"),C={},P=i(f,C,"filter",Oe),k=i(f,C,"namespace",y);if(q(f,C,`in onResolve() call for plugin ${V(u)}`),P==null)throw new Error("onResolve() call is missing a filter");let O=B++;$[O]={name:u,callback:c,note:j},S.onResolve.push({id:O,filter:Le(P),namespace:k||""})},onLoad(f,c){let v='This error came from the "onLoad" callback registered here:',j=Ce(new Error(v),l,"onLoad"),C={},P=i(f,C,"filter",Oe),k=i(f,C,"namespace",y);if(q(f,C,`in onLoad() call for plugin ${V(u)}`),P==null)throw new Error("onLoad() call is missing a filter");let O=B++;I[O]={name:u,callback:c,note:j},S.onLoad.push({id:O,filter:Le(P),namespace:k||""})},onDispose(f){_.push(f)},esbuild:l.esbuild});A&&await A,L.push(S)}catch(E){return{ok:!1,error:E,pluginName:u}}}s["on-start"]=async(p,d)=>{o.clear();let u={errors:[],warnings:[]};await Promise.all(w.map(async({name:E,callback:S,note:D})=>{try{let A=await S();if(A!=null){if(typeof A!="object")throw new Error(`Expected onStart() callback in plugin ${V(E)} to return an object`);let f={},c=i(A,f,"errors",le),v=i(A,f,"warnings",le);q(A,f,`from onStart() callback in plugin ${V(E)}`),c!=null&&u.errors.push(...ae(c,"errors",o,E,void 0)),v!=null&&u.warnings.push(...ae(v,"warnings",o,E,void 0))}}catch(A){u.errors.push(de(A,l,o,D&&D(),E))}})),r(p,u)},s["on-resolve"]=async(p,d)=>{let u={},E="",S,D;for(let A of d.ids)try{({name:E,callback:S,note:D}=$[A]);let f=await S({path:d.path,importer:d.importer,namespace:d.namespace,resolveDir:d.resolveDir,kind:d.kind,pluginData:o.load(d.pluginData),with:d.with});if(f!=null){if(typeof f!="object")throw new Error(`Expected onResolve() callback in plugin ${V(E)} to return an object`);let c={},v=i(f,c,"pluginName",y),j=i(f,c,"path",y),C=i(f,c,"namespace",y),P=i(f,c,"suffix",y),k=i(f,c,"external",U),O=i(f,c,"sideEffects",U),R=i(f,c,"pluginData",je),m=i(f,c,"errors",le),F=i(f,c,"warnings",le),T=i(f,c,"watchFiles",K),M=i(f,c,"watchDirs",K);q(f,c,`from onResolve() callback in plugin ${V(E)}`),u.id=A,v!=null&&(u.pluginName=v),j!=null&&(u.path=j),C!=null&&(u.namespace=C),P!=null&&(u.suffix=P),k!=null&&(u.external=k),O!=null&&(u.sideEffects=O),R!=null&&(u.pluginData=o.store(R)),m!=null&&(u.errors=ae(m,"errors",o,E,void 0)),F!=null&&(u.warnings=ae(F,"warnings",o,E,void 0)),T!=null&&(u.watchFiles=Me(T,"watchFiles")),M!=null&&(u.watchDirs=Me(M,"watchDirs"));break}}catch(f){u={id:A,errors:[de(f,l,o,D&&D(),E)]};break}r(p,u)},s["on-load"]=async(p,d)=>{let u={},E="",S,D;for(let A of d.ids)try{({name:E,callback:S,note:D}=I[A]);let f=await S({path:d.path,namespace:d.namespace,suffix:d.suffix,pluginData:o.load(d.pluginData),with:d.with});if(f!=null){if(typeof f!="object")throw new Error(`Expected onLoad() callback in plugin ${V(E)} to return an object`);let c={},v=i(f,c,"pluginName",y),j=i(f,c,"contents",tt),C=i(f,c,"resolveDir",y),P=i(f,c,"pluginData",je),k=i(f,c,"loader",y),O=i(f,c,"errors",le),R=i(f,c,"warnings",le),m=i(f,c,"watchFiles",K),F=i(f,c,"watchDirs",K);q(f,c,`from onLoad() callback in plugin ${V(E)}`),u.id=A,v!=null&&(u.pluginName=v),j instanceof Uint8Array?u.contents=j:j!=null&&(u.contents=re(j)),C!=null&&(u.resolveDir=C),P!=null&&(u.pluginData=o.store(P)),k!=null&&(u.loader=k),O!=null&&(u.errors=ae(O,"errors",o,E,void 0)),R!=null&&(u.warnings=ae(R,"warnings",o,E,void 0)),m!=null&&(u.watchFiles=Me(m,"watchFiles")),F!=null&&(u.watchDirs=Me(F,"watchDirs"));break}}catch(f){u={id:A,errors:[de(f,l,o,D&&D(),E)]};break}r(p,u)};let z=(p,d)=>d([],[]);g.length>0&&(z=(p,d)=>{(async()=>{const u=[],E=[];for(const{name:S,callback:D,note:A}of g){let f,c;try{const v=await D(p);if(v!=null){if(typeof v!="object")throw new Error(`Expected onEnd() callback in plugin ${V(S)} to return an object`);let j={},C=i(v,j,"errors",le),P=i(v,j,"warnings",le);q(v,j,`from onEnd() callback in plugin ${V(S)}`),C!=null&&(f=ae(C,"errors",o,S,void 0)),P!=null&&(c=ae(P,"warnings",o,S,void 0))}}catch(v){f=[de(v,l,o,A&&A(),S)]}if(f){u.push(...f);try{p.errors.push(...f)}catch{}}if(c){E.push(...c);try{p.warnings.push(...c)}catch{}}}d(u,E)})()});let x=()=>{for(const p of _)setTimeout(()=>p(),0)};return W=!0,{ok:!0,requestPlugins:L,runOnEndCallbacks:z,scheduleOnDisposeCallbacks:x}};function lt(){const e=new Map;let t=0;return{clear(){e.clear()},load(r){return e.get(r)},store(r){if(r===void 0)return-1;const n=t++;return e.set(n,r),n}}}function Ce(e,t,r){let n,l=!1;return()=>{if(l)return n;l=!0;try{let s=(e.stack+"").split(`
7
+ `);s.splice(1,1);let a=at(t,s,r);if(a)return n={text:e.message,location:a},n}catch{}}}function de(e,t,r,n,l){let s="Internal error",a=null;try{s=(e&&e.message||e)+""}catch{}try{a=at(t,(e.stack+"").split(`
8
+ `),"")}catch{}return{id:"",pluginName:l,text:s,location:a,notes:n?[n]:[],detail:r?r.store(e):-1}}function at(e,t,r){let n=" at ";if(e.readFileSync&&!t[0].startsWith(n)&&t[1].startsWith(n))for(let l=1;l<t.length;l++){let s=t[l];if(s.startsWith(n))for(s=s.slice(n.length);;){let a=/^(?:new |async )?\S+ \((.*)\)$/.exec(s);if(a){s=a[1];continue}if(a=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(s),a){s=a[1];continue}if(a=/^(\S+):(\d+):(\d+)$/.exec(s),a){let h;try{h=e.readFileSync(a[1],"utf8")}catch{break}let o=h.split(/\r\n|\r|\n|\u2028|\u2029/)[+a[2]-1]||"",w=+a[3]-1,g=o.slice(w,w+r.length)===r?r.length:0;return{file:a[1],namespace:"file",line:+a[2],column:re(o.slice(0,w)).length,length:re(o.slice(w,w+g)).length,lineText:o+`
9
+ `+t.slice(1).join(`
10
+ `),suggestion:""}}break}}return null}function $e(e,t,r){let n=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,n+1).map((s,a)=>{if(a===n)return`
11
+ ...`;if(!s.location)return`
12
+ error: ${s.text}`;let{file:h,line:o,column:w}=s.location,g=s.pluginName?`[plugin: ${s.pluginName}] `:"";return`
13
+ ${h}:${o}:${w}: ERROR: ${g}${s.text}`}).join("");let l=new Error(e);for(const[s,a]of[["errors",t],["warnings",r]])Object.defineProperty(l,s,{configurable:!0,enumerable:!0,get:()=>a,set:h=>Object.defineProperty(l,s,{configurable:!0,enumerable:!0,value:h})});return l}function ye(e,t){for(const r of e)r.detail=t.load(r.detail);return e}function ot(e,t,r){if(e==null)return null;let n={},l=i(e,n,"file",y),s=i(e,n,"namespace",y),a=i(e,n,"line",ce),h=i(e,n,"column",ce),o=i(e,n,"length",ce),w=i(e,n,"lineText",y),g=i(e,n,"suggestion",y);if(q(e,n,t),w){const $=w.slice(0,(h&&h>0?h:0)+(o&&o>0?o:0)+(r&&r>0?r:80));!/[\x7F-\uFFFF]/.test($)&&!/\n/.test(w)&&(w=$)}return{file:l||"",namespace:s||"",line:a||0,column:h||0,length:o||0,lineText:w||"",suggestion:g||""}}function ae(e,t,r,n,l){let s=[],a=0;for(const h of e){let o={},w=i(h,o,"id",y),g=i(h,o,"pluginName",y),$=i(h,o,"text",y),I=i(h,o,"location",Xe),_=i(h,o,"notes",le),B=i(h,o,"detail",je),N=`in element ${a} of "${t}"`;q(h,o,N);let L=[];if(_)for(const W of _){let z={},x=i(W,z,"text",y),p=i(W,z,"location",Xe);q(W,z,N),L.push({text:x||"",location:ot(p,N,l)})}s.push({id:w||"",pluginName:g||n,text:$||"",location:ot(I,N,l),notes:L,detail:r?r.store(B):-1}),a++}return s}function Me(e,t){const r=[];for(const n of e){if(typeof n!="string")throw new Error(`${V(t)} must be an array of strings`);r.push(n)}return r}function Ft(e,t){const r=Object.create(null);for(const n in e){const l=e[n];if(typeof l!="string")throw new Error(`key ${V(n)} in object ${V(t)} must be a string`);r[n]=l}return r}function _t({path:e,contents:t,hash:r}){let n=null;return{path:e,contents:t,hash:r,get text(){const l=this.contents;return(n===null||l!==t)&&(t=l,n=pe(l)),n}}}function Le(e){let t=e.source;return e.flags&&(t=`(?${e.flags})${t}`),t}var fe=ie,st=ie,Z=ie,be=Ne.ESBUILD_BINARY_PATH||be,Bt=e=>!!e&&e!=="/usr/bin/esbuild",ut="@esbuild/darwin-arm64",ft="@esbuild/darwin-x64",Te={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},Fe={"aix ppc64 BE":"@esbuild/aix-ppc64","android arm64 LE":"@esbuild/android-arm64","darwin arm64 LE":"@esbuild/darwin-arm64","darwin x64 LE":"@esbuild/darwin-x64","freebsd arm64 LE":"@esbuild/freebsd-arm64","freebsd x64 LE":"@esbuild/freebsd-x64","linux arm LE":"@esbuild/linux-arm","linux arm64 LE":"@esbuild/linux-arm64","linux ia32 LE":"@esbuild/linux-ia32","linux mips64el LE":"@esbuild/linux-mips64el","linux ppc64 LE":"@esbuild/linux-ppc64","linux riscv64 LE":"@esbuild/linux-riscv64","linux s390x BE":"@esbuild/linux-s390x","linux x64 LE":"@esbuild/linux-x64","linux loong64 LE":"@esbuild/linux-loong64","netbsd arm64 LE":"@esbuild/netbsd-arm64","netbsd x64 LE":"@esbuild/netbsd-x64","openbsd arm64 LE":"@esbuild/openbsd-arm64","openbsd x64 LE":"@esbuild/openbsd-x64","sunos x64 LE":"@esbuild/sunos-x64"},ct={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function It(){let e,t,r=!1,n=`${process.platform} ${st.arch()} ${st.endianness()}`;if(n in Te)e=Te[n],t="esbuild.exe";else if(n in Fe)e=Fe[n],t="bin/esbuild";else if(n in ct)e=ct[n],t="bin/esbuild",r=!0;else throw new Error(`Unsupported platform: ${n}`);return{pkg:e,subpath:t,isWASM:r}}function Nt(){const e=require.resolve("esbuild"),t=Z.dirname(Z.dirname(Z.dirname(e)));if(Z.basename(t)==="node_modules"){for(const r in Fe)try{const n=Fe[r];if(fe.existsSync(Z.join(t,n)))return n}catch{}for(const r in Te)try{const n=Te[r];if(fe.existsSync(Z.join(t,n)))return n}catch{}}return null}function Rt(e,t){const r=Z.dirname(require.resolve("esbuild"));return Z.join(r,`downloaded-${e.replace("/","-")}-${Z.basename(t)}`)}function Ut(){if(Bt(be))if(!fe.existsSync(be))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${be}`);else return{binPath:be,isWASM:!1};const{pkg:e,subpath:t,isWASM:r}=It();let n;try{n=require.resolve(`${e}/${t}`)}catch(l){if(n=Rt(e,t),!fe.existsSync(n)){try{require.resolve(e)}catch{const s=Nt();if(s){let a=`
14
+ Specifically the "${s}" package is present but this platform
15
+ needs the "${e}" package instead. People often get into this
16
+ situation by installing esbuild on Windows or macOS and copying "node_modules"
17
+ into a Docker image that runs Linux, or by copying "node_modules" between
18
+ Windows and WSL environments.
19
+
20
+ If you are installing with npm, you can try not copying the "node_modules"
21
+ directory when you copy the files over, and running "npm ci" or "npm install"
22
+ on the destination platform after the copy. Or you could consider using yarn
23
+ instead of npm which has built-in support for installing a package on multiple
24
+ platforms simultaneously.
25
+
26
+ If you are installing with yarn, you can try listing both this platform and the
27
+ other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
28
+ feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
29
+ Keep in mind that this means multiple copies of esbuild will be present.
30
+ `;throw(e===ft&&s===ut||e===ut&&s===ft)&&(a=`
31
+ Specifically the "${s}" package is present but this platform
32
+ needs the "${e}" package instead. People often get into this
33
+ situation by installing esbuild with npm running inside of Rosetta 2 and then
34
+ trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
35
+ 2 is Apple's on-the-fly x86_64-to-arm64 translation service).
36
+
37
+ If you are installing with npm, you can try ensuring that both npm and node are
38
+ not running under Rosetta 2 and then reinstalling esbuild. This likely involves
39
+ changing how you installed npm and/or node. For example, installing node with
40
+ the universal installer here should work: https://nodejs.org/en/download/. Or
41
+ you could consider using yarn instead of npm which has built-in support for
42
+ installing a package on multiple platforms simultaneously.
43
+
44
+ If you are installing with yarn, you can try listing both "arm64" and "x64"
45
+ in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
46
+ https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
47
+ Keep in mind that this means multiple copies of esbuild will be present.
48
+ `),new Error(`
49
+ You installed esbuild for another platform than the one you're currently using.
50
+ This won't work because esbuild is written with native code and needs to
51
+ install a platform-specific binary executable.
52
+ ${a}
53
+ Another alternative is to use the "esbuild-wasm" package instead, which works
54
+ the same way on all platforms. But it comes with a heavy performance cost and
55
+ can sometimes be 10x slower than the "esbuild" package, so you may also not
56
+ want to do that.
57
+ `)}throw new Error(`The package "${e}" could not be found, and is needed by esbuild.
58
+
59
+ If you are installing esbuild with npm, make sure that you don't specify the
60
+ "--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
61
+ of "package.json" is used by esbuild to install the correct binary executable
62
+ for your current platform.`)}throw l}}if(/\.zip\//.test(n)){let l;try{l=require("pnpapi")}catch{}if(l){const s=l.getPackageInformation(l.topLevel).packageLocation,a=Z.join(s,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.27.3-${Z.basename(t)}`);return fe.existsSync(a)||(fe.mkdirSync(Z.dirname(a),{recursive:!0}),fe.copyFileSync(n,a),fe.chmodSync(a,493)),{binPath:a,isWASM:r}}}return{binPath:n,isWASM:r}}var dt=ie,Wt=ie,We=ie,he=ie,zt=ie,qt=ie,Y;if(Ne.ESBUILD_WORKER_THREADS!=="0"){try{Y=ie}catch{}let[e,t]=process.versions.node.split(".");(+e<12||+e==12&&+t<17||+e==13&&+t<13)&&(Y=void 0)}var ht,Ee=((ht=Y?.workerData)==null?void 0:ht.esbuildVersion)==="0.27.3",mt=()=>{if(!be&&(We.basename(__filename)!=="main.js"||We.basename(__dirname)!=="lib"))throw new Error(`The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
63
+
64
+ More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`);{const{binPath:e,isWASM:t}=Ut();return t?["node",[e]]:[e,[]]}},ke=()=>qt.isatty(2),Jt={readFile(e,t){try{let r=he.readFileSync(e,"utf8");try{he.unlinkSync(e)}catch{}t(null,r)}catch(r){t(r,null)}},writeFile(e,t){try{let r=gt();he.writeFileSync(r,e),t(r)}catch{t(null)}}},Vt={readFile(e,t){try{he.readFile(e,"utf8",(r,n)=>{try{he.unlink(e,()=>t(r,n))}catch{t(r,n)}})}catch(r){t(r,null)}},writeFile(e,t){try{let r=gt();he.writeFile(r,e,n=>t(n!==null?null:r))}catch{t(null)}}},Yt="0.27.3",Ht=e=>ge().build(e),Kt=e=>ge().context(e),Qt=(e,t)=>ge().transform(e,t),Gt=(e,t)=>ge().formatMessages(e,t),Xt=(e,t)=>ge().analyzeMetafile(e,t),Zt=e=>{if(Y&&!Ee)return H||(H=Ie(Y)),H.buildSync(e);let t;return Be(r=>r.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:ke(),defaultWD:me,callback:(n,l)=>{if(n)throw n;t=l}})),t},er=(e,t)=>{if(Y&&!Ee)return H||(H=Ie(Y)),H.transformSync(e,t);let r;return Be(n=>n.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:ke(),fs:Jt,callback:(l,s)=>{if(l)throw l;r=s}})),r},tr=(e,t)=>{if(Y&&!Ee)return H||(H=Ie(Y)),H.formatMessagesSync(e,t);let r;return Be(n=>n.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(l,s)=>{if(l)throw l;r=s}})),r},rr=(e,t)=>{if(Y&&!Ee)return H||(H=Ie(Y)),H.analyzeMetafileSync(e,t);let r;return Be(n=>n.analyzeMetafile({callName:"analyzeMetafileSync",refs:null,metafile:typeof e=="string"?e:JSON.stringify(e),options:t,callback:(l,s)=>{if(l)throw l;r=s}})),r},nr=()=>(_e&&_e(),H&&H.stop(),Promise.resolve()),ze=!1,ir=e=>{if(e=Dt(e||{}),e.wasmURL)throw new Error('The "wasmURL" option only works in the browser');if(e.wasmModule)throw new Error('The "wasmModule" option only works in the browser');if(e.worker)throw new Error('The "worker" option only works in the browser');if(ze)throw new Error('Cannot call "initialize" more than once');return ge(),ze=!0,Promise.resolve()},me=process.cwd(),Se,_e,ge=()=>{if(Se)return Se;let[e,t]=mt(),r=dt.spawn(e,t.concat("--service=0.27.3","--ping"),{windowsHide:!0,stdio:["pipe","pipe","inherit"],cwd:me}),{readFromStdout:n,afterClose:l,service:s}=it({writeToStdin(g){r.stdin.write(g,$=>{$&&l($)})},readFileSync:he.readFileSync,isSync:!1,hasFS:!0,esbuild:xe});r.stdin.on("error",l),r.on("error",l);const a=r.stdin,h=r.stdout;h.on("data",n),h.on("end",l),_e=()=>{a.destroy(),h.destroy(),r.kill(),ze=!1,Se=void 0,_e=void 0};let o=0;r.unref(),a.unref&&a.unref(),h.unref&&h.unref();const w={ref(){++o===1&&r.ref()},unref(){--o===0&&r.unref()}};return Se={build:g=>new Promise(($,I)=>{s.buildOrContext({callName:"build",refs:w,options:g,isTTY:ke(),defaultWD:me,callback:(_,B)=>_?I(_):$(B)})}),context:g=>new Promise(($,I)=>s.buildOrContext({callName:"context",refs:w,options:g,isTTY:ke(),defaultWD:me,callback:(_,B)=>_?I(_):$(B)})),transform:(g,$)=>new Promise((I,_)=>s.transform({callName:"transform",refs:w,input:g,options:$||{},isTTY:ke(),fs:Vt,callback:(B,N)=>B?_(B):I(N)})),formatMessages:(g,$)=>new Promise((I,_)=>s.formatMessages({callName:"formatMessages",refs:w,messages:g,options:$,callback:(B,N)=>B?_(B):I(N)})),analyzeMetafile:(g,$)=>new Promise((I,_)=>s.analyzeMetafile({callName:"analyzeMetafile",refs:w,metafile:typeof g=="string"?g:JSON.stringify(g),options:$,callback:(B,N)=>B?_(B):I(N)}))},Se},Be=e=>{let[t,r]=mt(),n=new Uint8Array,{readFromStdout:l,afterClose:s,service:a}=it({writeToStdin(o){if(n.length!==0)throw new Error("Must run at most one command");n=o},isSync:!0,hasFS:!0,esbuild:xe});e(a);let h=dt.execFileSync(t,r.concat("--service=0.27.3"),{cwd:me,windowsHide:!0,input:n,maxBuffer:+Ne.ESBUILD_MAX_BUFFER||16*1024*1024});l(h),s(null)},gt=()=>We.join(zt.tmpdir(),`esbuild-${Wt.randomBytes(32).toString("hex")}`),H=null,Ie=e=>{let{port1:t,port2:r}=new e.MessageChannel,n=new e.Worker(__filename,{workerData:{workerPort:r,defaultWD:me,esbuildVersion:"0.27.3"},transferList:[r],execArgv:[]}),l=0,s=w=>{let g=new Error(`Build failed with 1 error:
65
+ error: ${w}`),$=[{id:"",pluginName:"",text:w,location:null,notes:[],detail:void 0}];return g.errors=$,g.warnings=[],g},a=w=>{if(!w)return;let g=w.plugins;if(g&&g.length>0)throw s("Cannot use plugins in synchronous API calls")},h=(w,g)=>{for(let $ in g)w[$]=g[$]},o=(w,g)=>{let $=l++,I=new SharedArrayBuffer(8),_=new Int32Array(I),B={sharedBuffer:I,id:$,command:w,args:g};n.postMessage(B);let N=Atomics.wait(_,0,0);if(N!=="ok"&&N!=="not-equal")throw new Error("Internal error: Atomics.wait() failed: "+N);let{message:{id:L,resolve:W,reject:z,properties:x}}=e.receiveMessageOnPort(t);if($!==L)throw new Error(`Internal error: Expected id ${$} but got id ${L}`);if(z)throw h(z,x),z;return W};return n.unref(),{buildSync(w){return a(w),o("build",[w])},transformSync(w,g){return o("transform",[w,g])},formatMessagesSync(w,g){return o("formatMessages",[w,g])},analyzeMetafileSync(w,g){return o("analyzeMetafile",[w,g])},stop(){n.terminate(),H=null}}},lr=()=>{let e=Y.workerData.workerPort,t=Y.parentPort,r=n=>{let l={};if(n&&typeof n=="object")for(let s in n)l[s]=n[s];return l};try{let n=ge();me=Y.workerData.defaultWD,t.on("message",l=>{(async()=>{let{sharedBuffer:s,id:a,command:h,args:o}=l,w=new Int32Array(s);try{switch(h){case"build":e.postMessage({id:a,resolve:await n.build(o[0])});break;case"transform":e.postMessage({id:a,resolve:await n.transform(o[0],o[1])});break;case"formatMessages":e.postMessage({id:a,resolve:await n.formatMessages(o[0],o[1])});break;case"analyzeMetafile":e.postMessage({id:a,resolve:await n.analyzeMetafile(o[0],o[1])});break;default:throw new Error(`Invalid command: ${h}`)}}catch(g){e.postMessage({id:a,reject:g,properties:r(g)})}Atomics.add(w,0,1),Atomics.notify(w,0,1/0)})()})}catch(n){t.on("message",l=>{let{sharedBuffer:s,id:a}=l,h=new Int32Array(s);e.postMessage({id:a,reject:n,properties:r(n)}),Atomics.add(h,0,1),Atomics.notify(h,0,1/0)})}};Ee&&lr();var ar=xe;return qe}export{dr as __require};
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Clean up component instance attached to a DOM node
3
+ * Accepts an optional `opts.strict` flag to surface errors instead of swallowing them.
4
+ */
5
+ export declare function cleanupInstanceIfPresent(node: Node | null, opts?: {
6
+ strict?: boolean;
7
+ }): void;
8
+ export declare function cleanupInstancesUnder(node: Node | null, opts?: {
9
+ strict?: boolean;
10
+ }): void;
11
+ export interface ListenerMapEntry {
12
+ handler: EventListener;
13
+ original: EventListener;
14
+ options?: boolean | AddEventListenerOptions;
15
+ isDelegated?: boolean;
16
+ }
17
+ export declare const elementListeners: WeakMap<Element, Map<string, ListenerMapEntry>>;
18
+ export declare const elementReactivePropsCleanup: WeakMap<Element, Map<string, {
19
+ cleanup: () => void;
20
+ fnRef: () => unknown;
21
+ }>>;
22
+ export declare function removeElementReactiveProps(element: Element): void;
23
+ export declare function removeElementListeners(element: Element): void;
24
+ export declare function removeAllListeners(root: Element | null): void;
25
+ //# sourceMappingURL=cleanup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../../src/renderer/cleanup.ts"],"names":[],"mappings":"AAoEA;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,GAAG,IAAI,EACjB,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1B,IAAI,CAwCN;AAKD,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,IAAI,GAAG,IAAI,EACjB,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1B,IAAI,CAEN;AAGD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,aAAa,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAAC;IAC5C,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AACD,eAAO,MAAM,gBAAgB,iDAG1B,CAAC;AAGJ,eAAO,MAAM,2BAA2B;aAEf,MAAM,IAAI;WAAS,MAAM,OAAO;GACtD,CAAC;AAEJ,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAYjE;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgB7D;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAa7D"}
@@ -0,0 +1 @@
1
+ import{cleanupComponent as m}from"../runtime/component.js";import{logger as s}from"../dev/logger.js";import{removeDelegatedListener as I,clearDelegatedHandlersForElement as d}from"../runtime/events.js";function i(e,t,r){const n=e.__ASKR_INSTANCE;if(n){try{m(n)}catch(c){r?t.push(c):s.warn("[Askr] cleanupComponent failed:",c)}try{delete e.__ASKR_INSTANCE}catch(c){r&&t.push(c)}}}function h(e,t){try{const n=e.ownerDocument,c=n?.createTreeWalker;if(typeof c=="function"){const a=c.call(n,e,1);let l=a.firstChild();for(;l;)t(l),l=a.nextNode();return}}catch{}const r=e.querySelectorAll("*");for(let n=0;n<r.length;n++)t(r[n])}function g(e,t){if(!e||!(e instanceof Element))return;const r=t?.strict??!1,n=r?[]:null;try{i(e,n,r)}catch(c){r?n.push(c):s.warn("[Askr] cleanupInstanceIfPresent failed:",c)}try{h(e,c=>{try{i(c,n,r)}catch(a){r?n.push(a):s.warn("[Askr] cleanupInstanceIfPresent descendant cleanup failed:",a)}})}catch(c){r?n.push(c):s.warn("[Askr] cleanupInstanceIfPresent descendant query failed:",c)}if(n&&n.length>0)throw new AggregateError(n,"cleanupInstanceIfPresent failed")}function A(e,t){g(e,t)}const o=new WeakMap,f=new WeakMap;function p(e){const t=f.get(e);if(t){for(const r of t.values())try{r.cleanup()}catch(n){s.warn("[Askr] reactive prop cleanup failed:",n)}f.delete(e)}}function u(e){const t=o.get(e);if(t){for(const[r,n]of t)n.isDelegated?I(e,r):n.options!==void 0?e.removeEventListener(r,n.handler,n.options):e.removeEventListener(r,n.handler);o.delete(e)}d(e)}function E(e){e&&(u(e),p(e),h(e,t=>{u(t),p(t),d(t)}))}export{g as cleanupInstanceIfPresent,A as cleanupInstancesUnder,o as elementListeners,f as elementReactivePropsCleanup,E as removeAllListeners,u as removeElementListeners,p as removeElementReactiveProps};
@@ -0,0 +1,44 @@
1
+ import { type VNode } from './types';
2
+ export declare const IS_DOM_AVAILABLE: boolean;
3
+ /**
4
+ * Create a DOM node from a VNode
5
+ */
6
+ export declare function createDOMNode(node: unknown): Node | null;
7
+ /**
8
+ * Update an existing element's attributes and children from vnode
9
+ */
10
+ export declare function updateElementFromVnode(el: Element, vnode: VNode, updateChildren?: boolean): void;
11
+ export declare function updateElementChildren(el: Element, children: VNode | VNode[] | undefined): void;
12
+ export declare function updateUnkeyedChildren(parent: Element, newChildren: unknown[]): void;
13
+ /**
14
+ * Positional update for keyed lists where keys changed en-masse but structure
15
+ * (element tags and simple text children) remains identical. This updates
16
+ * text content in-place and remaps the `data-key` attribute to the new key so
17
+ * subsequent updates can find elements by their data-key.
18
+ */
19
+ export declare function performBulkPositionalKeyedTextUpdate(parent: Element, keyedVnodes: Array<{
20
+ key: string | number;
21
+ vnode: VNode;
22
+ }>): {
23
+ readonly n: number;
24
+ readonly reused: number;
25
+ readonly updatedKeys: number;
26
+ readonly t: number;
27
+ };
28
+ export declare function performBulkTextReplace(parent: Element, newChildren: VNode[]): {
29
+ readonly n: number;
30
+ readonly reused: number;
31
+ readonly created: number;
32
+ readonly tBuild: number;
33
+ readonly tCommit: number;
34
+ };
35
+ /**
36
+ * Heuristic to detect large bulk text-dominant updates eligible for fast-path.
37
+ * Conditions:
38
+ * - total children >= threshold
39
+ * - majority of children are simple text (string/number) or intrinsic elements
40
+ * with a single primitive child
41
+ * - conservative: avoid when component children or complex shapes present
42
+ */
43
+ export declare function isBulkTextFastPathEligible(parent: Element, newChildren: VNode[]): boolean;
44
+ //# sourceMappingURL=dom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/renderer/dom.ts"],"names":[],"mappings":"AA6BA,OAAO,EAAkC,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AAgCrE,eAAO,MAAM,gBAAgB,SAAkC,CAAC;AAudhE;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAkExD;AAmPD;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,OAAO,EACX,KAAK,EAAE,KAAK,EACZ,cAAc,UAAO,GACpB,IAAI,CA+LN;AAED,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,OAAO,EACX,QAAQ,EAAE,KAAK,GAAG,KAAK,EAAE,GAAG,SAAS,GACpC,IAAI,CAuDN;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,EACf,WAAW,EAAE,OAAO,EAAE,GACrB,IAAI,CA+JN;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,OAAO,EACf,WAAW,EAAE,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;;;;;EAgE3D;AA4MD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE;;;;;;EA6B3E;AA6GD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,OAAO,EACf,WAAW,EAAE,KAAK,EAAE,WAyCrB"}
@@ -0,0 +1 @@
1
+ import{logger as Oe}from"../dev/logger.js";import"../jsx-runtime.js";import{CONTEXT_FRAME_SYMBOL as re,getCurrentContextFrame as oe,withContext as K}from"../runtime/context.js";import{getCurrentInstance as V,setCurrentComponentInstance as x,createComponentInstance as ie,renderComponentInline as se,mountInstanceInline as U}from"../runtime/component.js";import{elementListeners as y,elementReactivePropsCleanup as A,cleanupInstanceIfPresent as h,removeAllListeners as C}from"./cleanup.js";import{incDevCounter as q,getDevValue as ce,setDevValue as D}from"../runtime/dev-namespace.js";import"./types.js";import{__FOR_BOUNDARY__ as j,_isDOMElement as g}from"../common/vnode.js";import{evaluateForState as z}from"../runtime/for.js";import{keyedElements as E}from"./keyed.js";import{reconcileKeyedChildren as ae}from"./reconcile.js";import{createWrappedHandler as G,getPassiveOptions as X,isSkippedProp as $,parseEventName as Y,now as F,logFastPathDebug as I,recordFastPathStats as fe,hasNonTrivialProps as B,recordDOMReplace as le}from"./utils.js";import{globalScheduler as O}from"../runtime/scheduler.js";import{isEventDelegationEnabled as W,isDelegatedEvent as J,addDelegatedListener as Q,getDelegatedHandlersForElement as ue,removeDelegatedListener as k}from"../runtime/events.js";import{Fragment as de}from"../common/jsx.js";var P={};const pe=typeof document<"u";let H=0;function me(){const e="__COMPONENT_INSTANCE_ID";try{q(e);const t=ce(e);if(typeof t=="number"&&Number.isFinite(t))return`comp-${t}`}catch{}return H++,`comp-${H}`}function ye(e,t,n){const o=W()&&J(t);o&&Q(e,t,n,n,void 0);const r=G(n,!0),c=X(t);o||(c!==void 0?e.addEventListener(t,r,c):e.addEventListener(t,r)),y.has(e)||y.set(e,new Map),y.get(e).set(t,{handler:Z(o,e,t,r),original:n,options:c,isDelegated:o})}function Z(e,t,n,o){if(!e)return o;const r=ue(t);if(r){const c=r.get(n);if(c)return c.handler}return o}const v=new Set;let d=null,N=!1;function ge(){if(!d){d={id:"reactive-props-coordinator",lastRenderToken:0,hasPendingUpdate:!1,notifyUpdate:null,abortController:new AbortController};const e=()=>{if(!N)return;N=!1;const t=V();try{for(const n of v){if(!n.isActive)continue;for(const c of n.readStates)c._readers&&c._readers.delete(d);n.readStates.clear();const o=new Set,r={_pendingReadStates:o,_currentRenderToken:d.lastRenderToken};x(r);try{const c=n.propFn();te(n.el,n.propName,c,n.tagName),n.readStates=o}catch{}}d&&(d.lastRenderToken=(d.lastRenderToken??0)+1);for(const n of v)if(n.isActive)for(const o of n.readStates)o._readers||(o._readers=new Map),o._readers.set(d,d.lastRenderToken??0)}finally{x(t)}};d.notifyUpdate=()=>{N||(N=!0,O.isExecuting()?e():O.enqueue(e))},d._pendingFlushTask=()=>{d.hasPendingUpdate=!1,d.notifyUpdate()}}return d}function ee(e,t,n,o){const r=ge(),c={el:e,propName:t,propFn:n,tagName:o,readStates:new Set,isActive:!0};v.add(c);const s=V(),i=new Set,f={_pendingReadStates:i,_currentRenderToken:r.lastRenderToken};x(f);try{const a=n();te(e,t,a,o),c.readStates=i;for(const l of i)l._readers||(l._readers=new Map),l._readers.set(r,r.lastRenderToken??0)}finally{x(s)}return()=>{if(c.isActive=!1,v.delete(c),d)for(const a of c.readStates)a._readers&&a._readers.delete(d);c.readStates.clear(),v.size===0&&d&&(d.abortController.abort(),d=null)}}function te(e,t,n,o){if(n==null||n===!1){t==="class"||t==="className"?e.className="":e.removeAttribute(t);return}t==="class"||t==="className"?e.className=String(n):t==="value"||t==="checked"?ne(e,t,n,o):e.setAttribute(t,String(n))}function he(e,t,n){for(const o in t){const r=t[o];if(o==="ref"){Ae(e,r);continue}if($(o)||r==null||r===!1)continue;const c=Y(o);if(c){ye(e,c,r);continue}if(typeof r=="function"&&!c&&o!=="ref"){const s=ee(e,o,r,n);A.has(e)||A.set(e,new Map),A.get(e).set(o,{cleanup:s,fnRef:r});continue}o==="class"||o==="className"?e.className=String(r):o==="value"||o==="checked"?ne(e,o,r,n):e.setAttribute(o,String(r))}}function Ae(e,t){const n=t;if(n){if(typeof n=="function"){n(e);return}Object.isExtensible(n)&&(n.current=e)}}function ne(e,t,n,o){t==="value"?((b(o,"input")||b(o,"textarea")||b(o,"select"))&&(e.value=String(n)),e.setAttribute("value",String(n))):t==="checked"&&(b(o,"input")&&(e.checked=!!n),e.setAttribute("checked",String(!!n)))}function R(e,t,n){const o=t.key??n?.key;o!==void 0&&e.setAttribute("data-key",String(o))}function p(e){if(!pe)return null;if(typeof e=="string")return document.createTextNode(e);if(typeof e=="number")return document.createTextNode(String(e));if(!e)return null;if(Array.isArray(e)){const t=document.createDocumentFragment();for(const n of e){const o=p(n);o&&t.appendChild(o)}return t}if(typeof e=="object"&&e!==null&&"type"in e){const t=e.type,n=e.props||{};if(typeof t=="string")return Se(e,t,n);if(typeof t=="function")return Te(e,t,n);if(t===j)return be(e,n);if(typeof t=="symbol"&&(t===de||String(t)==="Symbol(Fragment)"))return _e(e,n)}return null}function Se(e,t,n){const o=document.createElement(t);R(o,e,n),he(o,n,t);const r=n.children??e.children;if(r!=null)if(Array.isArray(r)){for(const c of r){const s=p(c);s&&o.appendChild(s)}}else{const c=p(r);c&&o.appendChild(c)}return o}function Te(e,t,n){const r=e[re]||oe(),c=t;if(c.constructor.name==="AsyncFunction")throw new Error("Async components are not supported. Use resource() for async work.");let i=e.__instance;i||(i=ie(me(),c,n||{},null),e.__instance=i),r&&(i.ownerFrame=r);const f=K(r,()=>se(i));if(f instanceof Promise)throw new Error("Async components are not supported. Components must return synchronously.");const a=K(r,()=>p(f));if(a instanceof Element)return U(i,a),R(a,e,n),a;if(!a){const u=document.createComment("");return i._placeholder=u,i.mounted=!0,i.notifyUpdate=i._enqueueRun,u}const l=document.createElement("div");return l.appendChild(a),U(i,l),R(l,e,n),l}function _e(e,t){const n=document.createDocumentFragment(),o=t.children||e.children;if(o)if(Array.isArray(o))for(const r of o){const c=p(r);c&&n.appendChild(c)}else{const r=p(o);r&&n.appendChild(r)}return n}function Ce(e,t){if(!g(t)||!(e instanceof Element))return!0;const n=t.type;return typeof n!="string"?!0:e.tagName.toLowerCase()!==n.toLowerCase()}function be(e,t){const n=e._forState;if(!n)return document.createDocumentFragment();const o=t.source,r=z(n,o),c=document.createDocumentFragment();for(let s=0;s<r.length;s++){const i=r[s],f=n.orderedKeys[s],a=f!=null?n.items.get(f):null;let l=null;if(a&&a._dom){const u=a._dom;Ce(u,i)||(l=u)}l||(l=p(i),a&&(a._dom=l??void 0)),l&&(l instanceof Element&&S(l,i,!0),c.appendChild(l))}return c}function S(e,t,n=!0){if(!g(t))return;const o=t.props||{};R(e,t,o);const r=y.get(e);let c=null;for(const s in o){const i=o[s];if($(s))continue;const f=Y(s);if(i==null||i===!1){if(s==="class"||s==="className")e.className="";else if(f&&r?.has(f)){const a=r.get(f);a.isDelegated?k(e,f):a.options!==void 0?e.removeEventListener(f,a.handler,a.options):e.removeEventListener(f,a.handler),r.delete(f)}else e.removeAttribute(s);continue}if(typeof i=="function"&&!f&&s!=="ref"){const l=A.get(e)?.get(s);if(l&&l.fnRef===i)continue;l&&l.cleanup();const u=ee(e,s,i,t.type);A.has(e)||A.set(e,new Map),A.get(e).set(s,{cleanup:u,fnRef:i});continue}if(s==="class"||s==="className")e.className=String(i);else if(s==="value"||s==="checked")e[s]=i;else if(f){r&&r.size>0&&(c??=new Set).add(f);const a=W()&&J(f),l=r?.get(f);if(l&&l.original===i)continue;l&&(l.isDelegated?k(e,f):l.options!==void 0?e.removeEventListener(f,l.handler,l.options):e.removeEventListener(f,l.handler)),a&&Q(e,f,i,i,void 0);const u=G(i,!0),m=X(f);a||(m!==void 0?e.addEventListener(f,u,m):e.addEventListener(f,u)),y.has(e)||y.set(e,new Map),y.get(e).set(f,{handler:Z(a,e,f,u),original:i,options:m,isDelegated:a})}else e.setAttribute(s,String(i))}if(r&&r.size>0)if(c===null){for(const[s,i]of r)i.isDelegated?k(e,s):i.options!==void 0?e.removeEventListener(s,i.handler,i.options):e.removeEventListener(s,i.handler);y.delete(e)}else{for(const[s,i]of r)c.has(s)||(i.isDelegated?k(e,s):i.options!==void 0?e.removeEventListener(s,i.handler,i.options):e.removeEventListener(s,i.handler),r.delete(s));r.size===0&&y.delete(e)}if(n){const s=t.children||o.children;ve(e,s)}}function ve(e,t){if(t==null){e.textContent="";return}if(!Array.isArray(t)&&(typeof t=="string"||typeof t=="number")){e.childNodes.length===1&&e.firstChild?.nodeType===3?e.firstChild.data=String(t):e.textContent=String(t);return}if(Array.isArray(t)&&t.length===1&&g(t[0])&&t[0].type===j){const o=t[0],r=o._forState;if(!r)throw new Error("[updateElementChildren] For boundary missing _forState");const c=(o.props||{}).source,s=z(r,c),i=E.get(e),f=ae(e,s,i||new Map);E.set(e,f);return}if(Array.isArray(t)){Ee(e,t);return}e.textContent="";const n=p(t);n&&e.appendChild(n)}function Ee(e,t){const n=Array.from(e.children),o=t.some(s=>typeof s=="string"||typeof s=="number"),r=t.some(s=>g(s));if(o&&r){const s=Array.from(e.childNodes),i=Math.max(s.length,t.length);for(let f=0;f<i;f++){const a=s[f],l=t[f];if(l===void 0&&a){a.nodeType===1&&h(a),a.remove();continue}if(!a&&l!==void 0){const u=p(l);u&&e.appendChild(u);continue}if(!(!a||l===void 0)){if(typeof l=="string"||typeof l=="number")if(a.nodeType===3)a.data=String(l);else{const u=document.createTextNode(String(l));e.replaceChild(u,a)}else if(g(l))if(a.nodeType===1){const u=a;if(typeof l.type=="string")if(_(u.tagName,l.type))S(u,l);else{const m=p(l);m&&(C(u),h(u),e.replaceChild(m,a))}}else{const u=p(l);u&&e.replaceChild(u,a)}}}return}if(t.length===1&&n.length===0&&e.childNodes.length===1){const s=t[0],i=e.firstChild;if((typeof s=="string"||typeof s=="number")&&i?.nodeType===3){i.data=String(s);return}}n.length===0&&e.childNodes.length>0&&(e.textContent="");const c=Math.max(n.length,t.length);for(let s=0;s<c;s++){const i=n[s],f=t[s];if(f===void 0&&i){h(i),i.remove();continue}if(!i&&f!==void 0){const a=p(f);a&&e.appendChild(a);continue}if(!(!i||f===void 0))if(typeof f=="string"||typeof f=="number")i.textContent=String(f);else if(g(f))if(typeof f.type=="string")if(_(i.tagName,f.type))S(i,f);else{const a=p(f);a&&(i instanceof Element&&C(i),h(i),e.replaceChild(a,i))}else{const a=p(f);a&&(i instanceof Element&&C(i),h(i),e.replaceChild(a,i))}else{const a=p(f);a&&(i instanceof Element&&C(i),h(i),e.replaceChild(a,i))}}}function tt(e,t){const n=t.length;let o=0,r=0;const c=F(),s=P.ASKR_FASTPATH_DEBUG==="1"||P.ASKR_FASTPATH_DEBUG==="true";for(let a=0;a<n;a++){const{key:l,vnode:u}=t[a],m=e.children[a];if(m&&g(u)&&typeof u.type=="string"){const L=u.type;if(_(m.tagName,L)){const w=u.children||u.props?.children;s&&I("positional idx",a,{chTag:m.tagName,vnodeType:L,chChildNodes:m.childNodes.length,childrenType:Array.isArray(w)?"array":typeof w}),ke(m,w,u),De(m,l,()=>r++),o++;continue}else s&&I("positional tag mismatch",a,{chTag:m.tagName,vnodeType:L})}else s&&I("positional missing or invalid",a,{ch:!!m});Fe(e,a,u)}const i=F()-c;Pe(e,t);const f={n,reused:o,updatedKeys:r,t:i};return fe(f,"bulkKeyedPositionalHits"),f}function ke(e,t,n){typeof t=="string"||typeof t=="number"?(T(e,String(t)),n.props&&B(n.props)&&S(e,n,!1)):Array.isArray(t)&&t.length===1&&(typeof t[0]=="string"||typeof t[0]=="number")?(T(e,String(t[0])),n.props&&B(n.props)&&S(e,n,!1)):Ne(e,n)||S(e,n)}function Ne(e,t){const n=t.children||t.props?.children;if(!Array.isArray(n)||n.length!==2)return!1;const o=n[0],r=n[1];if(!g(o)||!g(r)||typeof o.type!="string"||typeof r.type!="string")return!1;const c=e.children[0],s=e.children[1];if(!c||!s||!_(c.tagName,o.type)||!_(s.tagName,r.type))return!1;const i=o.children||o.props?.children,f=r.children||r.props?.children;if(typeof i=="string"||typeof i=="number")T(c,String(i));else if(Array.isArray(i)&&i.length===1&&(typeof i[0]=="string"||typeof i[0]=="number"))T(c,String(i[0]));else return!1;if(typeof f=="string"||typeof f=="number")T(s,String(f));else if(Array.isArray(f)&&f.length===1&&(typeof f[0]=="string"||typeof f[0]=="number"))T(s,String(f[0]));else return!1;return!0}function T(e,t){e.childNodes.length===1&&e.firstChild?.nodeType===3?e.firstChild.data=t:e.textContent=t}function De(e,t,n){try{const o=String(t);if(e.getAttribute("data-key")===o)return;e.setAttribute("data-key",o),n()}catch{}}function xe(e){switch(e){case"div":return"DIV";case"span":return"SPAN";case"p":return"P";case"a":return"A";case"button":return"BUTTON";case"input":return"INPUT";case"ul":return"UL";case"ol":return"OL";case"li":return"LI";default:return null}}function b(e,t){if(e===t)return!0;const n=e.length;if(n!==t.length)return!1;for(let o=0;o<n;o++){const r=e.charCodeAt(o),c=t.charCodeAt(o);if(r===c)continue;const s=r>=65&&r<=90?r+32:r,i=c>=65&&c<=90?c+32:c;if(s!==i)return!1}return!0}function _(e,t){const n=xe(t);return n!==null&&e===n?!0:b(e,t)}function Fe(e,t,n){const o=p(n);if(o){const r=e.children[t];r?(h(r),e.replaceChild(o,r)):e.appendChild(o)}}function Pe(e,t){try{const n=E.get(e),o=n?(n.clear(),n):new Map;for(let r=0;r<t.length;r++){const c=t[r].key,s=e.children[r];s&&o.set(c,s)}E.set(e,o)}catch{}}function nt(e,t){const n=F(),o=Array.from(e.childNodes),r=[];let c=0,s=0;for(let l=0;l<t.length;l++){const u=Re(t[l],o[l],r);u==="reused"?c++:u==="created"&&s++}const i=F()-n,f=Ie(e,r);E.delete(e);const a={n:t.length,reused:c,created:s,tBuild:i,tCommit:f};return Me(a),a}function Re(e,t,n){return typeof e=="string"||typeof e=="number"?Le(String(e),t,n):typeof e=="object"&&e!==null&&"type"in e?we(e,t,n):"skipped"}function Le(e,t,n){return t&&t.nodeType===3?(t.data=e,n.push(t),"reused"):(n.push(document.createTextNode(e)),"created")}function we(e,t,n){const o=e;if(typeof o.type=="string"){const c=o.type;if(t&&t.nodeType===1&&_(t.tagName,c))return S(t,e),n.push(t),"reused"}const r=p(e);return r?(n.push(r),"created"):"skipped"}function Ie(e,t){const n=Date.now(),o=document.createDocumentFragment();for(let r=0;r<t.length;r++)o.appendChild(t[r]);try{for(let r=e.firstChild;r;){const c=r.nextSibling;r instanceof Element&&C(r),h(r),r=c}}catch{}return le("bulk-text-replace"),e.replaceChildren(o),Date.now()-n}function Me(e){try{D("__LAST_BULK_TEXT_FASTPATH_STATS",e),D("__LAST_FASTPATH_STATS",e),D("__LAST_FASTPATH_COMMIT_COUNT",1),q("bulkTextFastpathHits")}catch{}}function rt(e,t){const n=Number(P.ASKR_BULK_TEXT_THRESHOLD)||1024,o=.8,r=Array.isArray(t)?t.length:0;if(r<n)return M({phase:"bulk-unkeyed-eligible",reason:"too-small",total:r,threshold:n}),!1;const c=Ke(t);if(c.componentFound!==void 0)return M({phase:"bulk-unkeyed-eligible",reason:"component-child",index:c.componentFound}),!1;const s=c.simple/r,i=s>=o&&e.childNodes.length>=r;return M({phase:"bulk-unkeyed-eligible",total:r,simple:c.simple,fraction:s,requiredFraction:o,eligible:i}),i}function Ke(e){let t=0;for(let n=0;n<e.length;n++){const o=e[n];if(typeof o=="string"||typeof o=="number"){t++;continue}if(typeof o=="object"&&o!==null&&"type"in o){const r=o;if(typeof r.type=="function")return{simple:t,componentFound:n};typeof r.type=="string"&&Ue(r)&&t++}}return{simple:t}}function Ue(e){const t=e.children||e.props?.children;return!!(t==null||typeof t=="string"||typeof t=="number"||Array.isArray(t)&&t.length===1&&(typeof t[0]=="string"||typeof t[0]=="number"))}function M(e){if(P.ASKR_FASTPATH_DEBUG==="1")try{D("__BULK_DIAG",e)}catch{}}export{pe as IS_DOM_AVAILABLE,p as createDOMNode,rt as isBulkTextFastPathEligible,tt as performBulkPositionalKeyedTextUpdate,nt as performBulkTextReplace,ve as updateElementChildren,S as updateElementFromVnode,Ee as updateUnkeyedChildren};
@@ -0,0 +1,4 @@
1
+ export declare const IS_DOM_AVAILABLE: boolean;
2
+ export declare function evaluate(node: unknown, target: Element | null, context?: object): void;
3
+ export declare function clearDOMRange(context: object): void;
4
+ //# sourceMappingURL=evaluate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../src/renderer/evaluate.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,gBAAgB,SAAkC,CAAC;AAshBhE,wBAAgB,QAAQ,CACtB,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,OAAO,GAAG,IAAI,EACtB,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CA8IN;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEnD"}
@@ -0,0 +1 @@
1
+ import{logger as S}from"../dev/logger.js";import{elementListeners as d,removeAllListeners as M}from"./cleanup.js";import{keyedElements as f}from"./keyed.js";import{reconcileKeyedChildren as y}from"./reconcile.js";import"./types.js";import{_isDOMElement as a,__FOR_BOUNDARY__ as m}from"../common/vnode.js";import{evaluateForState as N}from"../runtime/for.js";import{performBulkPositionalKeyedTextUpdate as b,isBulkTextFastPathEligible as C,performBulkTextReplace as B,updateUnkeyedChildren as D,createDOMNode as u,updateElementFromVnode as _}from"./dom.js";import{setDevValue as T,incDevCounter as P}from"../runtime/dev-namespace.js";import{Fragment as R}from"../common/jsx.js";import{extractKey as w,parseEventName as O,createWrappedHandler as U,getPassiveOptions as H}from"./utils.js";var l={};const oe=typeof document<"u",p=new WeakMap;function A(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){const r=e.charCodeAt(n),i=t.charCodeAt(n);if(r===i)continue;const s=r>=65&&r<=90?r+32:r,o=i>=65&&i<=90?i+32:i;if(s!==o)return!1}return!0}function L(e){if(Array.isArray(e)){if(e.length===1){const t=e[0];if(typeof t=="string"||typeof t=="number")return{isSimple:!0,text:String(t)}}}else if(typeof e=="string"||typeof e=="number")return{isSimple:!0,text:String(e)};return{isSimple:!1}}function I(e,t){return e.childNodes.length===1&&e.firstChild?.nodeType===3?(e.firstChild.data=t,!0):!1}function E(e){const t=new Map;for(let n=e.firstElementChild;n;n=n.nextElementSibling){const r=n.getAttribute("data-key");if(r!==null){t.set(r,n);const i=Number(r);Number.isNaN(i)||t.set(i,n)}}return t}function K(e){let t=f.get(e);return t||(t=E(e),t.size>0&&f.set(e,t)),t.size>0?t:void 0}function x(e){for(let t=0;t<e.length;t++)if(w(e[t])!==void 0)return!0;return!1}function F(e,t,n){if(l.ASKR_FORCE_BULK_POSREUSE==="1"&&V(e,t))return;const r=y(e,t,n);f.set(e,r)}function V(e,t){try{const n=[];for(const s of t)a(s)&&s.key!==void 0&&n.push({key:s.key,vnode:s});if(n.length===0||n.length!==t.length)return!1;(l.ASKR_FASTPATH_DEBUG==="1"||l.ASKR_FASTPATH_DEBUG==="true")&&S.warn("[Askr][FASTPATH] forced positional bulk keyed reuse (evaluate-level)");const r=b(e,n);if(l.ASKR_FASTPATH_DEBUG==="1")try{T("__LAST_FASTPATH_STATS",r),T("__LAST_FASTPATH_COMMIT_COUNT",1),P("bulkKeyedPositionalForced")}catch{}const i=E(e);return f.set(e,i),!0}catch(n){return(l.ASKR_FASTPATH_DEBUG==="1"||l.ASKR_FASTPATH_DEBUG==="true")&&S.warn("[Askr][FASTPATH] forced bulk path failed, falling back",n),!1}}function v(e,t){if(C(e,t)){const n=B(e,t);}else D(e,t);f.delete(e)}function g(e,t){const n=t._forState;if(!n)return;const r=(t.props||{}).source,i=N(n,r);if(i.length>0){const s=K(e);try{F(e,i,s)}catch{const o=y(e,i,s);f.set(e,o)}}else e.textContent="",f.delete(e)}function k(e,t){if(t==null){e.textContent="",f.delete(e);return}if(!Array.isArray(t)&&a(t)&&t.type===m){g(e,t);return}if(!Array.isArray(t)){e.textContent="";const n=u(t);n&&e.appendChild(n),f.delete(e);return}if(t.length===1&&a(t[0])&&t[0].type===m){g(e,t[0]);return}if(x(t)){const n=K(e);try{F(e,t,n)}catch{const r=y(e,t,n);f.set(e,r)}}else v(e,t)}function h(e,t){let n=t.children||t.props?.children;if(n&&a(n)&&n.type===m){k(e,n),_(e,t,!1);return}n&&!Array.isArray(n)&&(n=[n]);const r=L(n);r.isSimple&&I(e,r.text)||k(e,n),_(e,t,!1)}function G(e,t){let n=e.firstElementChild;for(let r=0;r<t.length;r++){const i=t[r],s=n?n.nextElementSibling:null;if(n&&a(i)&&typeof i.type=="string"&&A(n.tagName,i.type)){h(n,i),n=s;continue}const o=u(i);o&&(n?e.replaceChild(o,n):e.appendChild(o)),n=s}for(;n;){const r=n.nextElementSibling;e.removeChild(n),n=r}}function W(e,t){for(const[n,r]of Object.entries(t)){if(n==="children"||n==="key"||r==null||r===!1)continue;if(n==="ref"){z(e,r);continue}const i=O(n);if(i){const s=U(r,!0),o=H(i);o!==void 0?e.addEventListener(i,s,o):e.addEventListener(i,s),d.has(e)||d.set(e,new Map),d.get(e).set(i,{handler:s,original:r,options:o});continue}n==="class"||n==="className"?e.className=String(r):n==="value"||n==="checked"?e[n]=r:e.setAttribute(n,String(r))}}function z(e,t){const n=t;if(n){if(typeof n=="function"){n(e);return}try{n.current=e}catch{}}}function j(e,t){const n=t.children;if(!Array.isArray(n)||!x(n))return!1;const r=document.createElement(t.type);e.appendChild(r),W(r,t.props||{});const i=y(r,n,void 0);return f.set(r,i),!0}function q(e){return a(e)&&typeof e.type=="symbol"&&(e.type===R||String(e.type)==="Symbol(askr.fragment)")}function X(e){const t=e.props?.children||e.children||[];return Array.isArray(t)?t:[t]}function ce(e,t,n){if(t&&!(typeof document>"u"))if(n&&p.has(n)){const r=p.get(n);let i=r.start.nextSibling;for(;i&&i!==r.end;){const o=i.nextSibling;i.remove(),i=o}const s=u(e);s&&t.insertBefore(s,r.end)}else if(n){const r=document.createComment("component-start"),i=document.createComment("component-end");t.appendChild(r),t.appendChild(i),p.set(n,{start:r,end:i});const s=u(e);s&&t.insertBefore(s,i)}else{let r=e;if(q(r)){const c=X(r);if(c.length===1&&a(c[0])&&typeof c[0].type=="string")r=c[0];else{G(t,c);return}}const s=t.__ASKR_INSTANCE;if(s&&s.target===t)if(a(r)&&typeof r.type=="string"&&A(t.tagName,r.type)){h(t,r);return}else{const c=u(r);if(c&&t.parentNode){c instanceof Element&&(c.__ASKR_INSTANCE=s,s.target=c),M(t),t.parentNode.replaceChild(c,t);return}}const o=t.children[0];if(o&&a(r)&&typeof r.type=="string"&&A(o.tagName,r.type))h(o,r);else{if(t.textContent="",a(r)&&typeof r.type=="string"&&j(t,r))return;const c=u(r);c&&t.appendChild(c)}}}function fe(e){p.delete(e)}export{oe as IS_DOM_AVAILABLE,fe as clearDOMRange,ce as evaluate};
@@ -0,0 +1,7 @@
1
+ import type { VNode } from './types';
2
+ export declare const IS_DOM_AVAILABLE: boolean;
3
+ export declare function applyRendererFastPath(parent: Element, keyedVnodes: Array<{
4
+ key: string | number;
5
+ vnode: VNode;
6
+ }>, oldKeyMap?: Map<string | number, Element>, unkeyedVnodes?: VNode[]): Map<string | number, Element> | null;
7
+ //# sourceMappingURL=fastpath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fastpath.d.ts","sourceRoot":"","sources":["../../src/renderer/fastpath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AASrC,eAAO,MAAM,gBAAgB,SAAkC,CAAC;AAMhE,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,EACf,WAAW,EAAE,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC,EAC1D,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,EACzC,aAAa,CAAC,EAAE,KAAK,EAAE,GACtB,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAkMtC"}
@@ -0,0 +1 @@
1
+ import{createDOMNode as S}from"./dom.js";import{_reconcilerRecordedParents as C}from"./keyed.js";import{logger as v}from"../dev/logger.js";import{removeAllListeners as P,cleanupInstanceIfPresent as D}from"./cleanup.js";import{incDevCounter as E,setDevValue as d}from"../runtime/dev-namespace.js";import{isSchedulerExecuting as F}from"../runtime/scheduler.js";import{isBulkCommitActive as k,markFastPathApplied as w}from"../runtime/fastlane.js";var y={};const x=typeof document<"u";function I(l,a,g,f){if(typeof document>"u")return null;const A=a.length;if(A===0&&(!f||f.length===0))return null;F()||v.warn("[Askr][FASTPATH][DEV] Fast-path reconciliation invoked outside scheduler execution");let c,m;if(A<=20)try{const e=l.children;c=new Array(e.length);for(let n=0;n<e.length;n++)c[n]=e[n]}catch(e){c=void 0}else{m=new Map;try{for(let e=l.firstElementChild;e;e=e.nextElementSibling){const n=e.getAttribute("data-key");if(n!==null){m.set(n,e);const r=Number(n);Number.isNaN(r)||m.set(r,e)}}}catch(e){m=void 0}}const s=[];let T=0,h=0,_=0;for(let e=0;e<a.length;e++){const{key:n,vnode:r}=a[e];T++;let o;if(A<=20&&c){const t=String(n);for(let i=0;i<c.length;i++){const u=c[i],p=u.getAttribute("data-key");if(p!==null&&(p===t||Number(p)===n)){o=u;break}}o||(o=g?.get(n))}else o=m?.get(n)??g?.get(n);if(o)s.push(o),_++;else{const t=S(r);t&&(s.push(t),h++)}}if(f&&f.length)for(const e of f){const n=S(e);n&&(s.push(n),h++)}try{const e=Date.now(),n=document.createDocumentFragment();let r=0;for(let t=0;t<s.length;t++)n.appendChild(s[t]),r++;try{for(let t=l.firstChild;t;){const i=t.nextSibling;t instanceof Element&&P(t),D(t),t=i}}catch(t){}try{E("__DOM_REPLACE_COUNT"),d("__LAST_DOM_REPLACE_STACK_FASTPATH",new Error().stack)}catch(t){}l.replaceChildren(n);try{d("__LAST_FASTPATH_COMMIT_COUNT",1)}catch(t){}try{k()&&w(l)}catch(t){}const o=new Map;for(let t=0;t<a.length;t++){const i=a[t].key,u=s[t];u instanceof Element&&o.set(i,u)}try{const t={n:A,moves:0,lisLen:0,t_lookup:0,t_fragment:Date.now()-e,t_commit:0,t_bookkeeping:0,fragmentAppendCount:r,mapLookups:T,createdNodes:h,reusedCount:_};typeof globalThis<"u"&&(d("__LAST_FASTPATH_STATS",t),d("__LAST_FASTPATH_REUSED",_>0),E("fastpathHistoryPush")),(y.ASKR_FASTPATH_DEBUG==="1"||y.ASKR_FASTPATH_DEBUG==="true")&&v.warn("[Askr][FASTPATH]",JSON.stringify({n:A,createdNodes:h,reusedCount:_}))}catch(t){}try{C.add(l)}catch(t){}return o}catch(e){return null}}export{x as IS_DOM_AVAILABLE,I as applyRendererFastPath};
@@ -0,0 +1,6 @@
1
+ export * from './types';
2
+ export * from './cleanup';
3
+ export * from './keyed';
4
+ export * from './dom';
5
+ export { evaluate, clearDOMRange } from './evaluate';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/renderer/index.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1 @@
1
+ import"./types.js";import{cleanupInstanceIfPresent as i,cleanupInstancesUnder as s,elementListeners as d,elementReactivePropsCleanup as c,removeAllListeners as u,removeElementListeners as E,removeElementReactiveProps as f}from"./cleanup.js";import{getKeyMapForElement as t,isKeyedReorderFastPathEligible as r}from"./keyed.js";import{_reconcilerRecordedParents as x,keyedElements as g,populateKeyMapForElement as v}from"./keyed.js";import{IS_DOM_AVAILABLE as P,createDOMNode as _,isBulkTextFastPathEligible as h,performBulkPositionalKeyedTextUpdate as k,performBulkTextReplace as A,updateElementChildren as F,updateElementFromVnode as I,updateUnkeyedChildren as K}from"./dom.js";import{evaluate as o}from"./evaluate.js";import{clearDOMRange as M}from"./evaluate.js";if(typeof globalThis<"u"){const e=globalThis;e.__ASKR_RENDERER={evaluate:o,isKeyedReorderFastPathEligible:r,getKeyMapForElement:t}}export{P as IS_DOM_AVAILABLE,x as _reconcilerRecordedParents,i as cleanupInstanceIfPresent,s as cleanupInstancesUnder,M as clearDOMRange,_ as createDOMNode,d as elementListeners,c as elementReactivePropsCleanup,o as evaluate,t as getKeyMapForElement,h as isBulkTextFastPathEligible,r as isKeyedReorderFastPathEligible,g as keyedElements,k as performBulkPositionalKeyedTextUpdate,A as performBulkTextReplace,v as populateKeyMapForElement,u as removeAllListeners,E as removeElementListeners,f as removeElementReactiveProps,F as updateElementChildren,I as updateElementFromVnode,K as updateUnkeyedChildren};
@@ -0,0 +1,23 @@
1
+ import type { VNode } from './types';
2
+ export declare const keyedElements: WeakMap<Element, Map<string | number, Element>>;
3
+ /**
4
+ * Retrieve existing keyed map for a parent element (runtime use)
5
+ */
6
+ export declare function getKeyMapForElement(el: Element): Map<string | number, Element> | undefined;
7
+ /**
8
+ * Populate a keyed map for an element by scanning its immediate children
9
+ * for `data-key` attributes. Proactive initialization for runtime layers.
10
+ */
11
+ export declare function populateKeyMapForElement(parent: Element): void;
12
+ export declare const _reconcilerRecordedParents: WeakSet<Element>;
13
+ /**
14
+ * Determine if keyed reorder fast-path should be used
15
+ */
16
+ export declare function isKeyedReorderFastPathEligible(parent: Element, newChildren: VNode[], oldKeyMap: Map<string | number, Element> | undefined): {
17
+ readonly useFastPath: boolean;
18
+ readonly totalKeyed: number;
19
+ readonly moveCount: number;
20
+ readonly lisLen: number;
21
+ readonly hasPropChanges: boolean;
22
+ };
23
+ //# sourceMappingURL=keyed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyed.d.ts","sourceRoot":"","sources":["../../src/renderer/keyed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAarC,eAAO,MAAM,aAAa,iDAGvB,CAAC;AAEJ;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,OAAO,6CAE9C;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAwB9D;AAKD,eAAO,MAAM,0BAA0B,kBAAyB,CAAC;AAiFjE;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,OAAO,EACf,WAAW,EAAE,KAAK,EAAE,EACpB,SAAS,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;;;;;;EAuDrD"}
@@ -0,0 +1 @@
1
+ import{buildKeyMapFromChildren as E,extractKey as O,hasNonTrivialProps as k,isIgnoredForPropChanges as _,hasPropChanged as P}from"./utils.js";const h=new WeakMap;function L(o){return h.get(o)}function C(o){try{if(h.has(o))return;let e=E(o);if(e.size===0){e=new Map;const n=Array.from(o.children);for(const t of n){const r=(t.textContent||"").trim();if(r){e.set(r,t);const s=Number(r);Number.isNaN(s)||e.set(s,t)}}}e.size>0&&h.set(o,e)}catch{}}const R=new WeakSet;function S(o){const e=[];for(const n of o){const t=O(n);t!==void 0&&e.push({key:t,vnode:n})}return e}function v(o){const e=[];for(const n of o){if(n===-1)continue;let t=0,r=e.length;for(;t<r;){const s=t+r>>1;e[s]<n?t=s+1:r=s}t===e.length?e.push(n):e[t]=n}return e.length}function F(o){for(const{vnode:e}of o){if(typeof e!="object"||e===null)continue;const n=e;if(n.props&&k(n.props))return!0}return!1}function T(o,e){for(const{key:n,vnode:t}of o){const r=e?.get(n);if(!r||typeof t!="object"||t===null)continue;const f=t.props||{};for(const i of Object.keys(f))if(!_(i)&&P(r,i,f[i]))return!0}return!1}function V(o,e,n){const t=S(e),r=t.length,s=t.map(c=>c.key),f=n?Array.from(n.keys()):[];let i=0;for(let c=0;c<s.length;c++){const l=s[c];(c>=f.length||f[c]!==l||!n?.has(l))&&i++}const g=r>=128&&f.length>0&&i>Math.max(64,Math.floor(r*.1));let u=!1,a=0;if(r>=128){const c=Array.from(o.children),l=t.map(({key:y})=>{const p=n?.get(y);return p?.parentElement===o?c.indexOf(p):-1});a=v(l),u=a<Math.floor(r*.5)}const m=F(t),d=T(t,n);return{useFastPath:(g||u)&&!d&&!m,totalKeyed:r,moveCount:i,lisLen:a,hasPropChanges:d}}export{R as _reconcilerRecordedParents,L as getKeyMapForElement,V as isKeyedReorderFastPathEligible,h as keyedElements,C as populateKeyMapForElement};
@@ -0,0 +1,88 @@
1
+ /**
2
+ * ─────────────────────────────────────────────────────────────────────────────
3
+ * RENDERER & RECONCILIATION INVARIANTS (LOCKED)
4
+ * ─────────────────────────────────────────────────────────────────────────────
5
+ *
6
+ * These invariants are NON-NEGOTIABLE. Any optimization or fast-path MUST
7
+ * preserve them. Violations WILL produce incorrect DOM.
8
+ *
9
+ * 1. DOM ORDER DERIVES ONLY FROM CURRENT VNODE ORDER
10
+ * --------------------------------------------------
11
+ * - Final DOM child order MUST be reconstructed from the current vnode list.
12
+ * - Reusing an existing DOM node does NOT imply it stays in the same position.
13
+ * - Appending an existing Node to a DocumentFragment is the ONLY valid way
14
+ * to express reordering (it moves the node).
15
+ *
16
+ * ❌ NEVER skip fragment insertion because a node already has a parent.
17
+ * ✅ ALWAYS append reused nodes into the fragment to establish order.
18
+ *
19
+ *
20
+ * 2. VNODE IDENTITY ≠ VNODE STABILITY
21
+ * ----------------------------------
22
+ * - VNodes are mutable.
23
+ * - `vnodeA === vnodeB` does NOT imply semantic equality.
24
+ * - DOM reuse MUST NOT be gated on vnode identity alone.
25
+ *
26
+ * DOM reuse is allowed ONLY when:
27
+ * - element type is unchanged
28
+ * - structural shape is compatible
29
+ * - updates are applied explicitly via updateElementFromVnode
30
+ *
31
+ * ❌ NEVER assume "same object" means "no changes".
32
+ *
33
+ *
34
+ * 3. KEYED RECONCILIATION IS ELEMENT-ONLY
35
+ * --------------------------------------
36
+ * - Keyed reconciliation assumes ELEMENT nodes, not Text or Comment nodes.
37
+ * - Any fast-path using `parent.children[i]` MUST prove:
38
+ * - all children are elements
39
+ * - no text nodes are present
40
+ *
41
+ * ❌ NEVER index `parent.children` when text nodes may exist.
42
+ * ✅ Use `parent.childNodes` or bail out to full reconciliation.
43
+ *
44
+ *
45
+ * 4. PRIMITIVES MAP TO TEXT NODES
46
+ * -------------------------------
47
+ * - string/number children represent Text nodes, not Elements.
48
+ * - Reconciliation MUST attempt Text-to-Text reuse before replacement.
49
+ *
50
+ * ❌ NEVER update element.textContent as a substitute for text reconciliation
51
+ * unless the shape is explicitly guaranteed.
52
+ *
53
+ *
54
+ * 5. FAST-PATHS MUST BE STRICTLY SAFE
55
+ * ----------------------------------
56
+ * - Fast-paths are OPTIONAL.
57
+ * - Correctness always beats performance.
58
+ *
59
+ * A fast-path MUST:
60
+ * - prove its eligibility
61
+ * - fall back cleanly on ANY ambiguity
62
+ * - never partially apply
63
+ *
64
+ *
65
+ * 6. CLEANUP IS POSITION-INDEPENDENT
66
+ * ---------------------------------
67
+ * - Cleanup is based on removal from the DOM, not vnode position.
68
+ * - Any node removed or replaced MUST:
69
+ * - remove listeners
70
+ * - cleanup component instances
71
+ *
72
+ *
73
+ * 7. FOR-BOUNDARY & KEYED LISTS OBEY THE SAME RULES
74
+ * ------------------------------------------------
75
+ * - For-boundaries are NOT special in ordering semantics.
76
+ * - Cached DOM nodes MUST still be reordered via fragment insertion.
77
+ * - Cache is an optimization, not an ownership claim.
78
+ *
79
+ *
80
+ * If you are unsure whether an optimization preserves these invariants:
81
+ * DO NOT APPLY IT.
82
+ *
83
+ * ─────────────────────────────────────────────────────────────────────────────
84
+ */
85
+ import type { VNode } from './types';
86
+ export declare const IS_DOM_AVAILABLE: boolean;
87
+ export declare function reconcileKeyedChildren(parent: Element, newChildren: VNode[], oldKeyMap: Map<string | number, Element> | undefined): Map<string | number, Element>;
88
+ //# sourceMappingURL=reconcile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reconcile.d.ts","sourceRoot":"","sources":["../../src/renderer/reconcile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAqBrC,eAAO,MAAM,gBAAgB,SAAkC,CAAC;AAoBhE,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,WAAW,EAAE,KAAK,EAAE,EACpB,SAAS,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACnD,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,CA0B/B"}
@@ -0,0 +1 @@
1
+ import{performBulkPositionalKeyedTextUpdate as d,updateElementFromVnode as a,createDOMNode as y}from"./dom.js";import{isKeyedReorderFastPathEligible as p,keyedElements as s}from"./keyed.js";import{removeAllListeners as b,cleanupInstanceIfPresent as N}from"./cleanup.js";import{isBulkCommitActive as C}from"../runtime/fastlane.js";import{applyRendererFastPath as k}from"./fastpath.js";import{extractKey as h,recordFastPathStats as A,checkPropChanges as P,recordDOMReplace as S}from"./utils.js";const X=typeof document<"u";function l(e,r){if(e===r)return!0;if(e.length!==r.length)return!1;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t),o=r.charCodeAt(t);if(n===o)continue;const i=n>=65&&n<=90?n+32:n,c=o>=65&&o<=90?o+32:o;if(i!==c)return!1}return!0}function Y(e,r,t){const{keyedVnodes:n,unkeyedVnodes:o}=E(r),i=t||R(e),c=F(e,r,n,o,i);return c||B(e,r,n,i)}function R(e){const r=new Map;try{for(let t=e.firstElementChild;t;t=t.nextElementSibling){const n=t.getAttribute("data-key");if(n!==null){r.set(n,t);const o=Number(n);Number.isNaN(o)||r.set(o,t)}}}catch{}return r}function E(e){const r=[],t=[];for(let n=0;n<e.length;n++){const o=e[n],i=h(o);i!==void 0?r.push({key:i,vnode:o}):t.push(o)}return{keyedVnodes:r,unkeyedVnodes:t}}function F(e,r,t,n,o){try{const i=v(e,r,t,n,o);if(i)return i;const c=x(e,t);if(c)return c}catch{}return null}function v(e,r,t,n,o){if(p(e,r,o).useFastPath&&t.length>=128||C())try{const c=k(e,t,o,n);if(c)return s.set(e,c),c}catch{}return null}function x(e,r){const t=r.length;if(t<10||e.children.length!==t)return null;const n=K(e,r),o=n/t;if(r.length>0){if(n!==t&&o>=.1)return null}else if(o<.9)return null;if(M(e,r))return null;try{const i=d(e,r);return A(i,"bulkKeyedPositionalHits"),j(e),s.get(e)}catch{return null}}function K(e,r){let t=0;try{for(let n=0;n<r.length;n++){const o=r[n].vnode,i=r[n].key;if(!o||typeof o!="object"||typeof o.type!="string")continue;const c=e.children[n];if(c&&l(c.tagName,o.type)){const u=c.getAttribute("data-key");(u===String(i)||u!==null&&!Number.isNaN(Number(u))&&Number(u)===i)&&t++}}}catch{}return t}function M(e,r){try{for(let t=0;t<r.length;t++){const n=r[t].vnode,o=e.children[t];if(!(!o||!n||typeof n!="object")&&P(o,n.props||{}))return!0}}catch{return!0}return!1}function j(e){try{const r=new Map;for(let t=e.firstElementChild;t;t=t.nextElementSibling){const n=t.getAttribute("data-key");if(n!==null){r.set(n,t);const o=Number(n);Number.isNaN(o)||r.set(o,t)}}s.set(e,r)}catch{}}function B(e,r,t,n){const o=new Map,i=[],c=new WeakSet,u=D(e,n,c);for(let f=0;f<r.length;f++){const g=r[f],m=U(g,f,e,u,c,o);m&&i.push(m)}return typeof document>"u"||(W(e,i),s.delete(e)),o}function D(e,r,t){return n=>{if(!r)return;const o=r.get(n);if(o&&!t.has(o))return t.add(o),o;const i=String(n),c=r.get(i);if(c&&!t.has(c))return t.add(c),c;const u=Number(i);if(!Number.isNaN(u)){const f=r.get(u);if(f&&!t.has(f))return t.add(f),f}return I(e,n,i,t)}}function I(e,r,t,n){try{for(let o=e.firstElementChild;o;o=o.nextElementSibling){if(n.has(o))continue;const i=o.getAttribute("data-key");if(i===t)return n.add(o),o;if(i!==null){const c=Number(i);if(!Number.isNaN(c)&&c===r)return n.add(o),o}}}catch{}}function U(e,r,t,n,o,i){const c=h(e);return c!==void 0?L(e,c,t,n,i):T(e,r,t,o)}function L(e,r,t,n,o){const i=n(r);if(i&&i.parentElement===t)try{const u=e;if(u&&typeof u=="object"&&typeof u.type=="string"&&l(i.tagName,u.type))return a(i,e),o.set(r,i),i}catch{}const c=y(e);return c?(c instanceof Element&&o.set(r,c),c):null}function T(e,r,t,n){try{const i=t.childNodes[r];if((typeof e=="string"||typeof e=="number")&&i&&i.nodeType===3)return i.data=String(e),n.add(i),i;if(i instanceof Element&&_(i,e))return a(i,e),n.add(i),i;const c=q(t,n);if(c){const u=H(c,e,n);if(u)return u}}catch{}return y(e)}function _(e,r){if(!e||typeof r!="object"||r===null||!("type"in r))return!1;const t=r,n=e.getAttribute("data-key");return n==null&&typeof t.type=="string"&&l(e.tagName,t.type)}function q(e,r){for(let t=e.firstElementChild;t;t=t.nextElementSibling)if(!r.has(t)&&t.getAttribute("data-key")===null)return t}function H(e,r,t){if(typeof r=="string"||typeof r=="number")return e.textContent=String(r),t.add(e),e;if(typeof r=="object"&&r!==null&&"type"in r){const n=r;if(typeof n.type=="string"&&l(e.tagName,n.type))return a(e,r),t.add(e),e}return null}function W(e,r){const t=document.createDocumentFragment();for(let n=0;n<r.length;n++)t.appendChild(r[n]);try{for(let n=e.firstChild;n;){const o=n.nextSibling;n instanceof Element&&b(n),N(n),n=o}}catch{}S("reconcile"),e.replaceChildren(t)}export{X as IS_DOM_AVAILABLE,Y as reconcileKeyedChildren};
@@ -0,0 +1,3 @@
1
+ export type { DOMElement, VNode } from '../common/vnode';
2
+ export { _isDOMElement } from '../common/vnode';
3
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/renderer/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1 @@
1
+ import{_isDOMElement as o}from"../common/vnode.js";export{o as _isDOMElement};
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Shared utilities for the renderer module.
3
+ * Consolidates common patterns to reduce code duplication.
4
+ */
5
+ export interface ListenerEntry {
6
+ handler: EventListener;
7
+ original: EventListener;
8
+ options?: boolean | AddEventListenerOptions;
9
+ }
10
+ /**
11
+ * Parse an event prop name (e.g., 'onClick') to its DOM event name (e.g., 'click')
12
+ */
13
+ export declare function parseEventName(propName: string): string | null;
14
+ /**
15
+ * Get default event listener options for passive events
16
+ */
17
+ export declare function getPassiveOptions(eventName: string): AddEventListenerOptions | undefined;
18
+ /**
19
+ * Create a wrapped event handler that integrates with the scheduler
20
+ * Uses caching to avoid recreating wrappers for the same handler
21
+ */
22
+ export declare function createWrappedHandler(handler: EventListener, flushAfter?: boolean): EventListener;
23
+ /** Props that should be skipped during attribute processing */
24
+ export declare function isSkippedProp(key: string): boolean;
25
+ /** Check if prop should be ignored for prop-change detection */
26
+ export declare function isIgnoredForPropChanges(key: string): boolean;
27
+ /**
28
+ * Check if an element's current attribute value differs from vnode value
29
+ */
30
+ export declare function hasPropChanged(el: Element, key: string, value: unknown): boolean;
31
+ /**
32
+ * Check if a vnode has non-trivial props (excluding events and data-*)
33
+ */
34
+ export declare function hasNonTrivialProps(props: Record<string, unknown>): boolean;
35
+ /**
36
+ * Check for prop changes between vnode and existing element
37
+ */
38
+ export declare function checkPropChanges(el: Element, props: Record<string, unknown>): boolean;
39
+ /**
40
+ * Extract key from a vnode object
41
+ */
42
+ export declare function extractKey(vnode: unknown): string | number | undefined;
43
+ /**
44
+ * Build a key map from element's children
45
+ */
46
+ export declare function buildKeyMapFromChildren(parent: Element): Map<string | number, Element>;
47
+ /**
48
+ * Record DOM replace operation for diagnostics
49
+ */
50
+ export declare function recordDOMReplace(source: string): void;
51
+ /**
52
+ * Record fast-path stats for diagnostics
53
+ */
54
+ export declare function recordFastPathStats(stats: Record<string, unknown>, counterName?: string): void;
55
+ /**
56
+ * Conditionally log debug info for fast-path operations
57
+ */
58
+ export declare function logFastPathDebug(message: string, indexOrData?: number | unknown, data?: unknown): void;
59
+ /**
60
+ * Get current high-resolution timestamp
61
+ */
62
+ export declare function now(): number;
63
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/renderer/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,aAAa,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAAC;CAC7C;AAYD;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK9D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,GAChB,uBAAuB,GAAG,SAAS,CASrC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,aAAa,EACtB,UAAU,UAAQ,GACjB,aAAa,CAmDf;AAMD,+DAA+D;AAC/D,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAElD;AAED,gEAAgE;AAChE,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAK5D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,OAAO,GACb,OAAO,CAgBT;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAM1E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,OAAO,EACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,CAQT;AAMD;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAStE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,OAAO,GACd,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,CAW/B;AAMD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAOrD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,WAAW,CAAC,EAAE,MAAM,GACnB,IAAI,CAUN;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,EAC9B,IAAI,CAAC,EAAE,OAAO,GACb,IAAI,CAaN;AAMD;;GAEG;AACH,wBAAgB,GAAG,IAAI,MAAM,CAI5B"}
@@ -0,0 +1 @@
1
+ import{globalScheduler as c}from"../runtime/scheduler.js";import{logger as u}from"../dev/logger.js";import{incDevCounter as h,setDevValue as f}from"../runtime/dev-namespace.js";var a={};const s=new WeakMap;let l=0;const _=1e3;function g(t){return!t.startsWith("on")||t.length<=2?null:t.slice(2).charAt(0).toLowerCase()+t.slice(3).toLowerCase()}function w(t){if(t==="wheel"||t==="scroll"||t.startsWith("touch"))return{passive:!0}}function C(t,r=!1){const e=s.get(t);if(e){const i=e.get(r);if(i)return i}const n=i=>{c.setInHandler(!0);try{t(i)}catch(o){u.error("[Askr] Event handler error:",o)}finally{if(c.setInHandler(!1),r)try{const o=c.getState();(o.queueLength??0)>0&&!o.running&&(c.isExecuting()||c.flush())}catch(o){queueMicrotask(()=>{throw o})}}};try{s.has(t)||l>=_||(l++,s.set(t,new Map)),s.get(t)?.set(r,n)}catch{}return n}function P(t){return t==="children"||t==="key"||t==="ref"}function A(t){return!!(t==="children"||t==="key"||t.startsWith("on")&&t.length>2||t.startsWith("data-"))}function d(t,r,e){try{if(r==="class"||r==="className")return t.className!==String(e);if(r==="value"||r==="checked")return t[r]!==e;const n=t.getAttribute(r);return e==null||e===!1?n!==null:String(e)!==n}catch{return!0}}function E(t){for(const r of Object.keys(t))if(!A(r))return!0;return!1}function b(t,r){for(const e of Object.keys(r))if(!A(e)&&d(t,e,r[e]))return!0;return!1}function F(t){if(typeof t!="object"||t===null)return;const r=t,e=r.key??r.props?.key;if(e!==void 0)return typeof e=="symbol"?String(e):e}function m(t){const r=new Map;for(let e=t.firstElementChild;e;e=e.nextElementSibling){const n=e.getAttribute("data-key");if(n!==null){r.set(n,e);const i=Number(n);Number.isNaN(i)||r.set(i,e)}}return r}function y(t){try{h("__DOM_REPLACE_COUNT"),f(`__LAST_DOM_REPLACE_STACK_${t}`,new Error().stack)}catch{}}function H(t,r){try{f("__LAST_FASTPATH_STATS",t),f("__LAST_FASTPATH_COMMIT_COUNT",1),r&&h(r)}catch{}}function M(t,r,e){(a.ASKR_FASTPATH_DEBUG==="1"||a.ASKR_FASTPATH_DEBUG==="true")&&(e!==void 0?u.warn(`[Askr][FASTPATH] ${t}`,r,e):r!==void 0?u.warn(`[Askr][FASTPATH] ${t}`,r):u.warn(`[Askr][FASTPATH] ${t}`))}function k(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}export{m as buildKeyMapFromChildren,b as checkPropChanges,C as createWrappedHandler,F as extractKey,w as getPassiveOptions,E as hasNonTrivialProps,d as hasPropChanged,A as isIgnoredForPropChanges,P as isSkippedProp,M as logFastPathDebug,k as now,g as parseEventName,y as recordDOMReplace,H as recordFastPathStats};