@motionscript/code 0.1.0-alpha.0 → 0.1.0-alpha.10

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 (65) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/NOTICE +49 -0
  3. package/README.md +148 -50
  4. package/dist/browser/THIRD_PARTY_LICENSES.txt +431 -0
  5. package/dist/browser/index.js +10 -7
  6. package/dist/browser/index.js.map +3 -3
  7. package/dist/browser/manifest.json +85 -3
  8. package/dist/code-range.d.ts +7 -1
  9. package/dist/code-range.d.ts.map +1 -1
  10. package/dist/code-range.js +9 -1
  11. package/dist/code-range.js.map +1 -1
  12. package/dist/diff.d.ts +14 -0
  13. package/dist/diff.d.ts.map +1 -1
  14. package/dist/diff.js +134 -2
  15. package/dist/diff.js.map +1 -1
  16. package/dist/engine.d.ts +2 -2
  17. package/dist/engine.d.ts.map +1 -1
  18. package/dist/engine.js +4 -4
  19. package/dist/engine.js.map +1 -1
  20. package/dist/highlight.d.ts +10 -2
  21. package/dist/highlight.d.ts.map +1 -1
  22. package/dist/highlight.js +40 -6
  23. package/dist/highlight.js.map +1 -1
  24. package/dist/layout.d.ts +1 -1
  25. package/dist/layout.d.ts.map +1 -1
  26. package/dist/layout.js.map +1 -1
  27. package/dist/measure-cache.d.ts +2 -2
  28. package/dist/measure-cache.d.ts.map +1 -1
  29. package/dist/measure-cache.js +0 -0
  30. package/dist/measure-cache.js.map +1 -1
  31. package/dist/node.d.ts +275 -281
  32. package/dist/node.d.ts.map +1 -1
  33. package/dist/node.js +634 -700
  34. package/dist/node.js.map +1 -1
  35. package/dist/nodes.d.ts +6 -9
  36. package/dist/nodes.d.ts.map +1 -1
  37. package/dist/nodes.js +7 -9
  38. package/dist/nodes.js.map +1 -1
  39. package/dist/render.d.ts +10 -3
  40. package/dist/render.d.ts.map +1 -1
  41. package/dist/render.js +60 -1
  42. package/dist/render.js.map +1 -1
  43. package/dist/style.d.ts +3 -3
  44. package/dist/style.d.ts.map +1 -1
  45. package/dist/style.js +10 -6
  46. package/dist/style.js.map +1 -1
  47. package/dist/tokens.d.ts.map +1 -1
  48. package/dist/tokens.js +5 -1
  49. package/dist/tokens.js.map +1 -1
  50. package/dist/transitions.d.ts +19 -1
  51. package/dist/transitions.d.ts.map +1 -1
  52. package/dist/transitions.js.map +1 -1
  53. package/package.json +7 -4
  54. package/src/code-range.ts +10 -1
  55. package/src/diff.ts +137 -2
  56. package/src/engine.ts +5 -5
  57. package/src/highlight.ts +54 -5
  58. package/src/layout.ts +1 -1
  59. package/src/measure-cache.ts +0 -0
  60. package/src/node.ts +767 -747
  61. package/src/nodes.ts +8 -10
  62. package/src/render.ts +71 -3
  63. package/src/style.ts +11 -7
  64. package/src/tokens.ts +5 -1
  65. package/src/transitions.ts +21 -1
@@ -0,0 +1,431 @@
1
+ Third-party software bundled into @motionscript/code's browser build (dist/browser/).
2
+
3
+ @lezer/common 1.5.2
4
+ License: MIT
5
+
6
+ MIT License
7
+
8
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in
18
+ all copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26
+ THE SOFTWARE.
27
+
28
+ ------------------------------------------------------------------------------
29
+
30
+ @lezer/cpp 1.1.6
31
+ License: MIT
32
+
33
+ MIT License
34
+
35
+ Copyright (C) 2020 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
36
+
37
+ Permission is hereby granted, free of charge, to any person obtaining a copy
38
+ of this software and associated documentation files (the "Software"), to deal
39
+ in the Software without restriction, including without limitation the rights
40
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
41
+ copies of the Software, and to permit persons to whom the Software is
42
+ furnished to do so, subject to the following conditions:
43
+
44
+ The above copyright notice and this permission notice shall be included in
45
+ all copies or substantial portions of the Software.
46
+
47
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
48
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
49
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
50
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
51
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
52
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
53
+ THE SOFTWARE.
54
+
55
+ ------------------------------------------------------------------------------
56
+
57
+ @lezer/css 1.3.3
58
+ License: MIT
59
+
60
+ MIT License
61
+
62
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
63
+
64
+ Permission is hereby granted, free of charge, to any person obtaining a copy
65
+ of this software and associated documentation files (the "Software"), to deal
66
+ in the Software without restriction, including without limitation the rights
67
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
68
+ copies of the Software, and to permit persons to whom the Software is
69
+ furnished to do so, subject to the following conditions:
70
+
71
+ The above copyright notice and this permission notice shall be included in
72
+ all copies or substantial portions of the Software.
73
+
74
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
75
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
76
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
77
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
78
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
79
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
80
+ THE SOFTWARE.
81
+
82
+ ------------------------------------------------------------------------------
83
+
84
+ @lezer/go 1.0.1
85
+ License: MIT
86
+
87
+ MIT License
88
+
89
+ Copyright (C) 2020 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
90
+
91
+ Permission is hereby granted, free of charge, to any person obtaining a copy
92
+ of this software and associated documentation files (the "Software"), to deal
93
+ in the Software without restriction, including without limitation the rights
94
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
95
+ copies of the Software, and to permit persons to whom the Software is
96
+ furnished to do so, subject to the following conditions:
97
+
98
+ The above copyright notice and this permission notice shall be included in
99
+ all copies or substantial portions of the Software.
100
+
101
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
102
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
103
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
104
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
105
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
106
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
107
+ THE SOFTWARE.
108
+
109
+ ------------------------------------------------------------------------------
110
+
111
+ @lezer/highlight 1.2.3
112
+ License: MIT
113
+
114
+ MIT License
115
+
116
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
117
+
118
+ Permission is hereby granted, free of charge, to any person obtaining a copy
119
+ of this software and associated documentation files (the "Software"), to deal
120
+ in the Software without restriction, including without limitation the rights
121
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
122
+ copies of the Software, and to permit persons to whom the Software is
123
+ furnished to do so, subject to the following conditions:
124
+
125
+ The above copyright notice and this permission notice shall be included in
126
+ all copies or substantial portions of the Software.
127
+
128
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
129
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
130
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
131
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
132
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
133
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
134
+ THE SOFTWARE.
135
+
136
+ ------------------------------------------------------------------------------
137
+
138
+ @lezer/html 1.3.13
139
+ License: MIT
140
+
141
+ MIT License
142
+
143
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
144
+
145
+ Permission is hereby granted, free of charge, to any person obtaining a copy
146
+ of this software and associated documentation files (the "Software"), to deal
147
+ in the Software without restriction, including without limitation the rights
148
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
149
+ copies of the Software, and to permit persons to whom the Software is
150
+ furnished to do so, subject to the following conditions:
151
+
152
+ The above copyright notice and this permission notice shall be included in
153
+ all copies or substantial portions of the Software.
154
+
155
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
156
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
157
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
158
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
159
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
160
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
161
+ THE SOFTWARE.
162
+
163
+ ------------------------------------------------------------------------------
164
+
165
+ @lezer/java 1.1.3
166
+ License: MIT
167
+
168
+ MIT License
169
+
170
+ Copyright (C) 2020 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
171
+
172
+ Permission is hereby granted, free of charge, to any person obtaining a copy
173
+ of this software and associated documentation files (the "Software"), to deal
174
+ in the Software without restriction, including without limitation the rights
175
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
176
+ copies of the Software, and to permit persons to whom the Software is
177
+ furnished to do so, subject to the following conditions:
178
+
179
+ The above copyright notice and this permission notice shall be included in
180
+ all copies or substantial portions of the Software.
181
+
182
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
183
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
184
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
185
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
186
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
187
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
188
+ THE SOFTWARE.
189
+
190
+ ------------------------------------------------------------------------------
191
+
192
+ @lezer/javascript 1.5.4
193
+ License: MIT
194
+
195
+ MIT License
196
+
197
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
198
+
199
+ Permission is hereby granted, free of charge, to any person obtaining a copy
200
+ of this software and associated documentation files (the "Software"), to deal
201
+ in the Software without restriction, including without limitation the rights
202
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
203
+ copies of the Software, and to permit persons to whom the Software is
204
+ furnished to do so, subject to the following conditions:
205
+
206
+ The above copyright notice and this permission notice shall be included in
207
+ all copies or substantial portions of the Software.
208
+
209
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
210
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
211
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
212
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
213
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
214
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
215
+ THE SOFTWARE.
216
+
217
+ ------------------------------------------------------------------------------
218
+
219
+ @lezer/json 1.0.3
220
+ License: MIT
221
+
222
+ MIT License
223
+
224
+ Copyright (C) 2020 by Marijn Haverbeke <marijn@haverbeke.berlin>, Arun Srinivasan <rulfzid@gmail.com>, and others
225
+
226
+ Permission is hereby granted, free of charge, to any person obtaining a copy
227
+ of this software and associated documentation files (the "Software"), to deal
228
+ in the Software without restriction, including without limitation the rights
229
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
230
+ copies of the Software, and to permit persons to whom the Software is
231
+ furnished to do so, subject to the following conditions:
232
+
233
+ The above copyright notice and this permission notice shall be included in
234
+ all copies or substantial portions of the Software.
235
+
236
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
237
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
238
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
239
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
240
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
241
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
242
+ THE SOFTWARE.
243
+
244
+ ------------------------------------------------------------------------------
245
+
246
+ @lezer/lr 1.4.10
247
+ License: MIT
248
+
249
+ MIT License
250
+
251
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
252
+
253
+ Permission is hereby granted, free of charge, to any person obtaining a copy
254
+ of this software and associated documentation files (the "Software"), to deal
255
+ in the Software without restriction, including without limitation the rights
256
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
257
+ copies of the Software, and to permit persons to whom the Software is
258
+ furnished to do so, subject to the following conditions:
259
+
260
+ The above copyright notice and this permission notice shall be included in
261
+ all copies or substantial portions of the Software.
262
+
263
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
264
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
265
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
266
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
267
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
268
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
269
+ THE SOFTWARE.
270
+
271
+ ------------------------------------------------------------------------------
272
+
273
+ @lezer/markdown 1.6.4
274
+ License: MIT
275
+
276
+ MIT License
277
+
278
+ Copyright (C) 2020 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
279
+
280
+ Permission is hereby granted, free of charge, to any person obtaining a copy
281
+ of this software and associated documentation files (the "Software"), to deal
282
+ in the Software without restriction, including without limitation the rights
283
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
284
+ copies of the Software, and to permit persons to whom the Software is
285
+ furnished to do so, subject to the following conditions:
286
+
287
+ The above copyright notice and this permission notice shall be included in
288
+ all copies or substantial portions of the Software.
289
+
290
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
291
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
292
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
293
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
294
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
295
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
296
+ THE SOFTWARE.
297
+
298
+ ------------------------------------------------------------------------------
299
+
300
+ @lezer/php 1.0.5
301
+ License: MIT
302
+
303
+ MIT License
304
+
305
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
306
+
307
+ Permission is hereby granted, free of charge, to any person obtaining a copy
308
+ of this software and associated documentation files (the "Software"), to deal
309
+ in the Software without restriction, including without limitation the rights
310
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
311
+ copies of the Software, and to permit persons to whom the Software is
312
+ furnished to do so, subject to the following conditions:
313
+
314
+ The above copyright notice and this permission notice shall be included in
315
+ all copies or substantial portions of the Software.
316
+
317
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
318
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
319
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
320
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
321
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
322
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
323
+ THE SOFTWARE.
324
+
325
+ ------------------------------------------------------------------------------
326
+
327
+ @lezer/python 1.1.19
328
+ License: MIT
329
+
330
+ MIT License
331
+
332
+ Copyright (C) 2020 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
333
+
334
+ Permission is hereby granted, free of charge, to any person obtaining a copy
335
+ of this software and associated documentation files (the "Software"), to deal
336
+ in the Software without restriction, including without limitation the rights
337
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
338
+ copies of the Software, and to permit persons to whom the Software is
339
+ furnished to do so, subject to the following conditions:
340
+
341
+ The above copyright notice and this permission notice shall be included in
342
+ all copies or substantial portions of the Software.
343
+
344
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
345
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
346
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
347
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
348
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
349
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
350
+ THE SOFTWARE.
351
+
352
+ ------------------------------------------------------------------------------
353
+
354
+ @lezer/rust 1.0.2
355
+ License: MIT
356
+
357
+ MIT License
358
+
359
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
360
+
361
+ Permission is hereby granted, free of charge, to any person obtaining a copy
362
+ of this software and associated documentation files (the "Software"), to deal
363
+ in the Software without restriction, including without limitation the rights
364
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
365
+ copies of the Software, and to permit persons to whom the Software is
366
+ furnished to do so, subject to the following conditions:
367
+
368
+ The above copyright notice and this permission notice shall be included in
369
+ all copies or substantial portions of the Software.
370
+
371
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
372
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
373
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
374
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
375
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
376
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
377
+ THE SOFTWARE.
378
+
379
+ ------------------------------------------------------------------------------
380
+
381
+ @lezer/xml 1.0.6
382
+ License: MIT
383
+
384
+ MIT License
385
+
386
+ Copyright (C) 2018 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
387
+
388
+ Permission is hereby granted, free of charge, to any person obtaining a copy
389
+ of this software and associated documentation files (the "Software"), to deal
390
+ in the Software without restriction, including without limitation the rights
391
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
392
+ copies of the Software, and to permit persons to whom the Software is
393
+ furnished to do so, subject to the following conditions:
394
+
395
+ The above copyright notice and this permission notice shall be included in
396
+ all copies or substantial portions of the Software.
397
+
398
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
399
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
400
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
401
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
402
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
403
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
404
+ THE SOFTWARE.
405
+
406
+ ------------------------------------------------------------------------------
407
+
408
+ @lezer/yaml 1.0.4
409
+ License: MIT
410
+
411
+ MIT License
412
+
413
+ Copyright (C) 2024 by Marijn Haverbeke <marijnh@gmail.com> and others
414
+
415
+ Permission is hereby granted, free of charge, to any person obtaining a copy
416
+ of this software and associated documentation files (the "Software"), to deal
417
+ in the Software without restriction, including without limitation the rights
418
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
419
+ copies of the Software, and to permit persons to whom the Software is
420
+ furnished to do so, subject to the following conditions:
421
+
422
+ The above copyright notice and this permission notice shall be included in
423
+ all copies or substantial portions of the Software.
424
+
425
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
426
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
427
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
428
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
429
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
430
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
431
+ THE SOFTWARE.
@@ -1,8 +1,11 @@
1
- import{j as ct,k as lt,l as e}from"./chunks/chunk-SYZUZB3M.js";import{node as ie,Clip as re,Node2D as ae,property as N,insetsOps as Mt,lerpNumber as Ot,command as F,driveCommand as A}from"@motionscript/core";function Ft(n,t,o){if(o<=n[0])return t[0];if(o>=n[n.length-1])return t[t.length-1];for(let i=0;i<n.length-1;i++)if(o<=n[i+1]){let a=n[i+1]-n[i],s=a===0?0:(o-n[i])/a;return t[i]+(t[i+1]-t[i])*s}return t[t.length-1]}function G(n,t){if(!n)return 1;let[o,i]=n;return t<=o?0:t>=i||i===o?1:(t-o)/(i-o)}function zt(n){return n*n*(3-2*n)}function X(n,t){return{id:n,opacity:t.values,opacityKeys:t.keys}}function Et(n,t){return n&&t?{out:[0,.38],move:[.1,.68],in:[.52,1]}:n?{out:[0,.45],move:[.22,1],in:null}:t?{out:null,move:[0,.55],in:[.38,1]}:{out:null,move:[0,1],in:null}}var dt=Et;function K(n){return n?zt(G(n.phases.move,n.progress)):1}function ht(n,t,o,i){let a=new Map;if(o!==null){let s=o;for(let r of n)for(let c of r.tokens)a.set(c.id,{opacity:i.has(c.id)?1:s})}for(let s of t)if(s.kind==="dim")for(let r of s.tokens)a.set(r.id,{opacity:Ft(r.opacityKeys,r.opacity,s.progress)});return a}function W(n){let t=n.padding;return[n.fontSize,n.fontFamily,n.lineHeight,n.letterSpacing,t.left,t.right,t.top,t.bottom,n.showLineNumbers?1:0,n.lineNumberGap].join("|")}function Dt(n,t,o){return o.advance(n," ",t.fontSize,t.fontFamily,0)*t.lineNumberGap}function jt(n,t,o,i,a){if(!t.showLineNumbers)return 0;let s=String(Math.max(1,i));return o.advance(n,s,t.fontSize,t.fontFamily,0)+a}function B(n,t,o,i){let a=t.fontSize*t.lineHeight,s=t.showLineNumbers?Dt(i,t,o):0,r=jt(i,t,o,n.length,s),c=new Array(n.length),l=0;for(let b=0;b<n.length;b++){let m=0;for(let S of n[b].tokens)m+=o.advance(i,S.content,t.fontSize,t.fontFamily,t.letterSpacing);c[b]=m,m>l&&(l=m)}let d=l+r,h=n.length*a,f=d+t.padding.left+t.padding.right,u=h+t.padding.top+t.padding.bottom,g=-f/2+t.padding.left+r,k=u/2-t.padding.top,w=new Map,p=new Array(n.length),C=new Map;for(let b=0;b<n.length;b++){let m=k-b*a-a/2;p[b]=m,C.set(n[b].id,b);let S=g;for(let L of n[b].tokens)w.set(L.id,{x:S,y:m}),S+=o.advance(i,L.content,t.fontSize,t.fontFamily,t.letterSpacing)}return{tokens:w,lineY:p,lineW:c,lineIndex:C,gutter:r,gutterGap:s,innerW:d,innerH:h,blockW:f,blockH:u,startX:g}}import{Graphics2D as ft,parseColor as _t,lerpNumber as z}from"@motionscript/core";var Rt=[.82,.84,.86,1],Gt=[.45,.5,.55,1],ut=new Map;function J(n){if(!n)return Rt;let t=ut.get(n);return t||(t=_t(n),ut.set(n,t)),t}function Kt(n,t,o){return o<=0?n:o>=1?t:[n[0]+(t[0]-n[0])*o,n[1]+(t[1]-n[1])*o,n[2]+(t[2]-n[2])*o,n[3]+(t[3]-n[3])*o]}function Wt(n,t,o){if(!o)return 1;let i=1;for(let a of n.tokens){if(a.content.length===0)continue;let s=t.get(a.id)?.opacity??1;s<i&&(i=s)}return i}function Q(n,t){let{tokenLines:o,metrics:i,advanceCache:a,from:s,to:r,edit:c,tokenStates:l}=t,d=c?c.progress:1,h=c?G(c.phases.out,d):1,f=K(c),u=c?G(c.phases.in,d):1,g=c?z(s.blockW,r.blockW,f):r.blockW,k=c?z(s.gutter,r.gutter,f):r.gutter,w=r.gutterGap||s.gutterGap,p=-g/2+i.padding.left+k-w,C=(m,S,L)=>{if(L<=0)return;let I=a.advance(n,m,i.fontSize,i.fontFamily,0);n.draw(new ft().text({text:m,fontSize:i.fontSize,fontFamily:i.fontFamily,lineHeight:i.lineHeight,x:p-I/2,y:S,textAlign:"left"}).fill([{type:"solid",color:Gt,opacity:L}]))},b=(m,S,L,I,M)=>{if(M<=0||m.length===0)return;let T=a.advance(n,m,i.fontSize,i.fontFamily,i.letterSpacing);n.draw(new ft().text({text:m,fontSize:i.fontSize,fontFamily:i.fontFamily,lineHeight:i.lineHeight,letterSpacing:i.letterSpacing,x:S+T/2,y:L,textAlign:"left"}).fill([{type:"solid",color:I,opacity:M}]))};for(let m=0;m<o.length;m++){let S=o[m],L=r.lineIndex.get(S.id);if(L===void 0)continue;let I=r.lineY[L],M=c?.enteringLineIds.has(S.id)??!1,T=I,D=1;if(c&&M)D=u;else if(c){let v=s.lineIndex.get(S.id);v!==void 0&&(T=z(s.lineY[v],I,f))}for(let v of S.tokens){let V=r.tokens.get(v.id);if(!V)continue;let rt=V.x,at=D,q=J(v.color);if(c&&!M)if(c.addedIds.has(v.id))at=u;else{let st=s.tokens.get(v.id);st&&(rt=z(st.x,V.x,f)),c.fromColorById.has(v.id)&&(q=Kt(J(c.fromColorById.get(v.id)),q,f))}b(v.content,rt,T,q,at*(l.get(v.id)?.opacity??1))}}if(c&&h<1)for(let m=0;m<c.from.length;m++){let S=c.from[m],L=s.lineIndex.get(S.id);if(L===void 0)continue;let I=r.lineIndex.get(S.id),M=I===void 0?s.lineY[L]:z(s.lineY[L],r.lineY[I],f);for(let T of S.tokens){if(!c.removedIds.has(T.id))continue;let D=s.tokens.get(T.id);D&&b(T.content,D.x,M,J(T.color),1-h)}}i.showLineNumbers&&Bt(t,C,f,u,h)}function Bt(n,t,o,i,a){let{tokenLines:s,from:r,to:c,edit:l,tokenStates:d,highlightActive:h}=n,f=s.length,u=l?l.from.length:f;for(let g=0;g<Math.max(u,f);g++){let k=g<u,w=g<f,p=w?s[g]:l?.from[g],C=p?Wt(p,d,h):1;l?k&&w?t(String(g+1),z(r.lineY[g],c.lineY[g],o),C):w?t(String(g+1),c.lineY[g],i*C):t(String(g+1),r.lineY[g],(1-a)*C):t(String(g+1),c.lineY[g],C)}}function P(n){return n.content.trim().length}function gt(n){let t=0;for(let o of n.tokens)t+=P(o);return t}function Pt(n,t){let o=gt(n),i=gt(t);if(o===0&&i===0)return 1;if(o===0||i===0)return 0;let a=new Map;for(let r of n.tokens)P(r)!==0&&a.set(r.content,(a.get(r.content)??0)+1);let s=0;for(let r of t.tokens){let c=P(r);if(c===0)continue;let l=a.get(r.content)??0;l>0&&(a.set(r.content,l-1),s+=c)}return 2*s/(o+i)}function pt(n,t,o){let i=t+1,a=new Float64Array((n+1)*i),s=new Float64Array(n*t);for(let d=1;d<=n;d++)for(let h=1;h<=t;h++){let f=o(d-1,h-1);s[(d-1)*t+(h-1)]=f;let u=a[(d-1)*i+h],g=a[d*i+(h-1)],k=u>g?u:g;if(f>0){let w=a[(d-1)*i+(h-1)]+f;w>k&&(k=w)}a[d*i+h]=k}let r=[],c=n,l=t;for(;c>0&&l>0;){let d=s[(c-1)*t+(l-1)];d>0&&a[c*i+l]===a[(c-1)*i+(l-1)]+d?(r.push([c-1,l-1]),c--,l--):a[(c-1)*i+l]>=a[c*i+(l-1)]?c--:l--}return r.reverse(),r}function Yt(n,t){return pt(n.length,t.length,(o,i)=>n[o].content!==t[i].content?0:P(t[i])||.25)}function Z(n,t){let o=new Set,i=new Set,a=new Set,s=new Map,r=pt(n.length,t.length,(d,h)=>Pt(n[d],t[h])-.45),c=new Set,l=new Set;for(let[d,h]of r){l.add(d),c.add(h);let f=n[d],u=t[h];u.id=f.id;let g=Yt(f.tokens,u.tokens),k=new Set,w=new Set;for(let[p,C]of g){k.add(p),w.add(C);let b=f.tokens[p],m=u.tokens[C];m.id=b.id,b.color!==m.color&&s.set(b.id,b.color)}for(let p=0;p<f.tokens.length;p++)k.has(p)||o.add(f.tokens[p].id);for(let p=0;p<u.tokens.length;p++)w.has(p)||i.add(u.tokens[p].id)}for(let d=0;d<n.length;d++)if(!l.has(d))for(let h of n[d].tokens)o.add(h.id);for(let d=0;d<t.length;d++)if(!c.has(d)){a.add(t[d].id);for(let h of t[d].tokens)i.add(h.id)}return{lines:t,removedIds:o,addedIds:i,newLineIds:a,fromColorById:s}}var H={name:"motion-canvas-default",defaultColor:"#d8dee9",rules:[{tag:e.keyword,color:"#5e81ac"},{tag:[e.name,e.deleted,e.character,e.propertyName,e.macroName],color:"#88c0d0"},{tag:[e.variableName],color:"#8fbcbb"},{tag:[e.function(e.variableName)],color:"#8fbcbb"},{tag:[e.labelName],color:"#81a1c1"},{tag:[e.color,e.constant(e.name),e.standard(e.name)],color:"#5e81ac"},{tag:[e.definition(e.name),e.separator],color:"#a3be8c"},{tag:[e.brace],color:"#8fbcbb"},{tag:[e.annotation],color:"#d30102"},{tag:[e.number,e.changed,e.annotation,e.modifier,e.self,e.namespace],color:"#b48ead"},{tag:[e.typeName,e.className],color:"#ECEFF4"},{tag:[e.operator,e.operatorKeyword],color:"#a3be8c"},{tag:[e.tagName],color:"#b48ead"},{tag:[e.squareBracket],color:"#ECEFF4"},{tag:[e.angleBracket],color:"#ECEFF4"},{tag:[e.attributeName],color:"#eceff4"},{tag:[e.regexp],color:"#5e81ac"},{tag:[e.quote],color:"#b48ead"},{tag:[e.string],color:"#a3be8c"},{tag:e.link,color:"#a3be8c"},{tag:[e.url,e.escape,e.special(e.string)],color:"#8fbcbb"},{tag:[e.meta],color:"#88c0d0"},{tag:[e.monospace],color:"#d8dee9"},{tag:[e.comment],color:"#4c566a"},{tag:e.strong,color:"#5e81ac"},{tag:e.emphasis,color:"#5e81ac"},{tag:e.heading,color:"#5e81ac"},{tag:e.special(e.heading1),color:"#5e81ac"},{tag:e.heading1,color:"#5e81ac"},{tag:[e.heading2,e.heading3,e.heading4],color:"#5e81ac"},{tag:[e.heading5,e.heading6],color:"#5e81ac"},{tag:[e.atom,e.bool,e.special(e.variableName)],color:"#d08770"},{tag:[e.processingInstruction,e.inserted],color:"#8fbcbb"},{tag:[e.contentSeparator],color:"#ebcb8b"},{tag:e.invalid,color:"#434c5e"}]},yt={name:"github-dark",defaultColor:"#c9d1d9",rules:[{tag:[e.standard(e.tagName),e.tagName],color:"#7ee787"},{tag:[e.comment,e.bracket],color:"#8b949e"},{tag:[e.className,e.propertyName],color:"#d2a8ff"},{tag:[e.variableName,e.attributeName,e.number,e.operator],color:"#79c0ff"},{tag:[e.keyword,e.typeName,e.typeOperator],color:"#ff7b72"},{tag:[e.string,e.meta,e.regexp],color:"#a5d6ff"},{tag:[e.name,e.quote],color:"#7ee787"},{tag:[e.heading,e.strong],color:"#d2a8ff"},{tag:[e.emphasis],color:"#d2a8ff"},{tag:[e.deleted],color:"#ffdcd7"},{tag:[e.atom,e.bool,e.special(e.variableName)],color:"#ffab70"},{tag:e.invalid,color:"#f97583"}]},kt={name:"github-light",defaultColor:"#24292e",rules:[{tag:[e.standard(e.tagName),e.tagName],color:"#116329"},{tag:[e.comment,e.bracket],color:"#6a737d"},{tag:[e.className,e.propertyName],color:"#6f42c1"},{tag:[e.variableName,e.attributeName,e.number,e.operator],color:"#005cc5"},{tag:[e.keyword,e.typeName,e.typeOperator],color:"#d73a49"},{tag:[e.string,e.meta,e.regexp],color:"#032f62"},{tag:[e.name,e.quote],color:"#22863a"},{tag:[e.heading,e.strong],color:"#24292e"},{tag:[e.emphasis],color:"#24292e"},{tag:[e.deleted],color:"#b31d28"},{tag:[e.atom,e.bool,e.special(e.variableName)],color:"#e36209"},{tag:[e.url,e.escape,e.regexp,e.link],color:"#032f62"},{tag:e.invalid,color:"#cb2431"}]},bt={name:"vscode-dark",defaultColor:"#9cdcfe",rules:[{tag:[e.keyword,e.operatorKeyword,e.modifier,e.color,e.constant(e.name),e.standard(e.name),e.standard(e.tagName),e.special(e.brace),e.atom,e.bool,e.special(e.variableName)],color:"#569cd6"},{tag:[e.controlKeyword,e.moduleKeyword],color:"#c586c0"},{tag:[e.name,e.deleted,e.character,e.macroName,e.propertyName,e.variableName,e.labelName,e.definition(e.name)],color:"#9cdcfe"},{tag:e.heading,color:"#9cdcfe"},{tag:[e.typeName,e.className,e.tagName,e.changed,e.annotation,e.self,e.namespace],color:"#4ec9b0"},{tag:[e.function(e.variableName),e.function(e.propertyName)],color:"#dcdcaa"},{tag:[e.number],color:"#b5cea8"},{tag:[e.operator,e.punctuation,e.separator,e.url,e.escape],color:"#d4d4d4"},{tag:[e.regexp],color:"#d16969"},{tag:[e.special(e.string),e.processingInstruction,e.string,e.inserted],color:"#ce9178"},{tag:[e.angleBracket],color:"#808080"},{tag:[e.meta,e.comment],color:"#6a9955"},{tag:e.link,color:"#6a9955"},{tag:e.invalid,color:"#ff0000"}]},wt={name:"vscode-light",defaultColor:"#383a42",rules:[{tag:[e.keyword,e.operatorKeyword,e.modifier,e.color,e.constant(e.name),e.standard(e.name),e.standard(e.tagName),e.special(e.brace),e.atom,e.bool,e.special(e.variableName)],color:"#0000ff"},{tag:[e.moduleKeyword,e.controlKeyword],color:"#af00db"},{tag:[e.name,e.deleted,e.character,e.macroName,e.propertyName,e.variableName,e.labelName,e.definition(e.name)],color:"#0070c1"},{tag:e.heading,color:"#0070c1"},{tag:[e.typeName,e.className,e.tagName,e.changed,e.annotation,e.self,e.namespace],color:"#267f99"},{tag:[e.function(e.variableName),e.function(e.propertyName)],color:"#795e26"},{tag:[e.number],color:"#098658"},{tag:[e.operator,e.punctuation,e.separator,e.url,e.escape],color:"#383a42"},{tag:[e.regexp],color:"#af00db"},{tag:[e.special(e.string),e.processingInstruction,e.string,e.inserted],color:"#a31515"},{tag:[e.angleBracket],color:"#383a42"},{tag:[e.meta,e.comment],color:"#008000"},{tag:e.link,color:"#4078f2"},{tag:e.invalid,color:"#e45649"}]},tt={"motion-canvas-default":H,"github-dark":yt,"github-light":kt,"vscode-dark":bt,"vscode-light":wt},mt=new Map;function et(n){let t=mt.get(n.name);if(t)return t;let o=ct(n.rules.map(i=>({tag:i.tag,class:i.color})));return mt.set(n.name,o),o}var $t={typescript:async()=>(await import("./chunks/dist-B46VH2YP.js")).parser.configure({dialect:"ts"}),tsx:async()=>(await import("./chunks/dist-B46VH2YP.js")).parser.configure({dialect:"ts jsx"}),javascript:async()=>(await import("./chunks/dist-B46VH2YP.js")).parser,jsx:async()=>(await import("./chunks/dist-B46VH2YP.js")).parser.configure({dialect:"jsx"}),python:async()=>(await import("./chunks/dist-W5ZXIMV7.js")).parser,json:async()=>(await import("./chunks/dist-3F5TQHM6.js")).parser,html:async()=>(await import("./chunks/dist-OXJDTPQ6.js")).parser,css:async()=>(await import("./chunks/dist-N4CNBNHL.js")).parser,rust:async()=>(await import("./chunks/dist-GPNEVCJI.js")).parser,go:async()=>(await import("./chunks/dist-FQDUBZKU.js")).parser,java:async()=>(await import("./chunks/dist-AQRNACF3.js")).parser,cpp:async()=>(await import("./chunks/dist-3SIR23P4.js")).parser,php:async()=>(await import("./chunks/dist-LRSXSDHT.js")).parser,markdown:async()=>(await import("./chunks/dist-FH6BHJ6A.js")).parser,xml:async()=>(await import("./chunks/dist-SH7H4MRK.js")).parser,yaml:async()=>(await import("./chunks/dist-UG3NTKWL.js")).parser},Ut={ts:"typescript",js:"javascript",py:"python","c++":"cpp",md:"markdown",yml:"yaml",shell:"javascript"};function Y(n){let t=n.toLowerCase();return Ut[t]??t}var j=new Map,nt=new Map,ot=[H.name],xt=["typescript","javascript","json","python"],St=new Map(Object.entries(tt));function Vt(n){St.set(n.name,n)}function Ct(n){return typeof n!="string"?n:St.get(n)??H}function qt(n){return j.has(Y(n))}function E(n=ot,t=xt){let o=[];for(let i of t){let a=Y(i);if(j.has(a))continue;let s=$t[a];if(!s)continue;let r=nt.get(a);r||(r=s().then(c=>(j.set(a,c),c)).catch(()=>null).finally(()=>nt.delete(a)),nt.set(a,r)),o.push(r)}return o.length===0?Promise.resolve():Promise.all(o).then(()=>{})}async function Xt(n,t){await E(ot,[n])}async function Jt(n=ot,t=xt){await E(n,t)}function O(n,t){return qt(n)}function Lt(n,t){return`${n}:${t}`}function Qt(n,t,o){let i=j.get(Y(t));if(!i)return null;let a=i.parse(n),s=et(o),r=new Map;return lt(a,s,(c,l,d)=>{let h=d;if(!h)return;let f=a.cursorAt(c,1);do r.set(Lt(f.from,f.to),h);while(f.next()&&f.to<=l)}),{tree:a,code:n,colorLookup:r}}function Zt(n,t){let o=t.tree.resolveInner(n,1),i=t.colorLookup.get(Lt(o.from,o.to));return i?{color:i,skipAhead:o.to-n}:{color:null,skipAhead:o.firstChild?0:o.to-n}}function te(n,t){let o=j.get(Y(t));if(!o)return[n];let a=o.parse(n).cursor(),s=[],r=0;do a.node.firstChild||(a.from>r&&s.push(n.slice(r,a.from)),a.from<a.to&&s.push(n.slice(a.from,a.to)),r=a.to);while(a.next());return r<n.length&&s.push(n.slice(r)),s}function vt(n,t,o=H){let i=Ct(o),a=Qt(n,t,i),s=[[]],r=()=>s.push([]);if(!a)return n.split(`
2
- `).map(l=>[{content:l,color:i.defaultColor}]);let c=0;for(let l of te(n,t)){let d=0;for(;d<l.length;){let{color:h,skipAhead:f}=Zt(c+d,a),u=d+Math.max(f,1);u>l.length&&(u=l.length);let g=l.indexOf(`
3
- `,d);g!==-1&&g<u&&(u=g);let k=l.slice(d,u);k.length>0&&s[s.length-1].push({content:k,color:h??i.defaultColor}),g===u&&(r(),u+=1),d=u}c+=l.length}return s}var ee=1,ne=1;function Nt(n,t){return{id:ee++,content:n,color:t}}function It(n){return{id:ne++,tokens:n}}function $(n,t,o){return O(t,o)?vt(n,t,o).map(i=>It(i.map(a=>Nt(a.content,a.color)))):n.split(`
4
- `).map(i=>It([Nt(i,"#d1d5db")]))}var _=class{cache=new Map;sig="";signature(t,o){return`${t}|${o}`}sync(t){t!==this.sig&&(this.cache.clear(),this.sig=t)}advance(t,o,i,a,s){if(o.length===0)return 0;let r=`${o}\0${s}`,c=this.cache.get(r);if(c!==void 0)return c;let{width:l}=t.measureText(o,i,a,void 0,s);return this.cache.set(r,l),l}};function Tt(n,t,o){return{startLine:n,startCol:t,endLine:n,endCol:o===void 0?1/0:t+o}}function Ht(n,t){return{startLine:n,startCol:1,endLine:t??n,endCol:1/0}}var U=class n{list;constructor(t=[]){this.list=t}lines(t,o){return new n([...this.list,Ht(t,o)])}word(t,o,i){return new n([...this.list,Tt(t,o,i)])}*[Symbol.iterator](){yield*this.list}},oe=new U;function R(n,t){if(t.length===0)return{start:0,end:0};let o=new Array(t.length),i=0;for(let p=0;p<t.length;p++)o[p]=i,i+=t[p]+1;let a=i>0?i-1:0,s=p=>Math.max(0,Math.min(t.length-1,p-1)),r=n.endLine??1/0,c=n.endCol??1/0,l=s(n.startLine),d=s(r),h=t[l],f=t[d],u=Math.max(0,Math.min(h,n.startCol-1)),g=c===1/0?f:Math.max(0,Math.min(f,c-1)),k=Math.min(a,o[l]+u),w=Math.min(a,o[d]+g);return{start:Math.min(k,w),end:Math.max(k,w)}}function it(n,t,o){let i=0,a=1,s=1,r=1,c=1,l=!1;for(let d=0;d<o.length;d++){let h=i,f=i+o[d];if(!l&&n>=h&&n<=f&&(a=d+1,s=n-h+1,l=!0),t>=h&&t<=f){r=d+1,c=t-h+1;break}i=f+1}return{startLine:a,startCol:s,endLine:r,endCol:c}}var x=function(n,t,o,i){var a=arguments.length,s=a<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,o):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,t,o,i);else for(var c=n.length-1;c>=0;c--)(r=n[c])&&(s=(a<3?r(s):a>3?r(t,o,s):r(t,o))||s);return a>3&&s&&Object.defineProperty(t,o,s),s},y=class extends ae{tokenLines=[];tokenized=!1;transitions=[];advanceCache=new _;structureVersion=0;layoutCacheKey=null;layoutCache=null;highlightDimOpacity=null;highlightedIds=new Set;diffStrategy;phaseStrategy;constructor(t){super(t),this.diffStrategy=t.diffStrategy??Z,this.phaseStrategy=t.phaseStrategy??dt,this.applyProp("width",t.width??"hug"),this.applyProp("height",t.height??"hug"),E(void 0,[this.language]).catch(()=>{}),this.tokenize()}set(t){super.set(t),(t.code!==void 0||t.language!==void 0||t.theme!==void 0)&&(this.tokenized=!1)}tokenize(){this.setLines($(this.code,this.language,this.theme)),this.tokenized=O(this.language,this.theme)}setLines(t){this.tokenLines!==t&&(this.tokenLines=t,this.structureVersion++,this.layoutCache=null,this.layoutCacheKey=null)}declareAssets(t){super.declareAssets(t),t.font(this.fontFamily),t.loader(`shiki:lang:${this.language}`,ce(this.language),{gate:"layout"})}metrics(){return{fontSize:this.fontSize,fontFamily:this.fontFamily,lineHeight:this.lineHeight,letterSpacing:this.letterSpacing,padding:this.padding,showLineNumbers:this.showLineNumbers,lineNumberGap:this.lineNumberGap}}activeEdit(){for(let t=this.transitions.length-1;t>=0;t--){let o=this.transitions[t];if(o.kind==="structural")return o}return null}settledLayout(t,o){let i=`${this.structureVersion}|${W(t)}|${this.advanceCache.signature(t.fontSize,t.fontFamily)}`;if(this.layoutCache&&this.layoutCacheKey===i)return this.layoutCache;let a=B(this.tokenLines,t,this.advanceCache,o);return this.layoutCache=a,this.layoutCacheKey=i,a}frameLayout(t){let o=this.metrics(),i=this.activeEdit();if(!i){let s=this.settledLayout(o,t);return{from:s,to:s,edit:null}}let a=`${W(o)}|${this.advanceCache.signature(o.fontSize,o.fontFamily)}`;return(i.layoutKey!==a||!i.fromLayout||!i.toLayout)&&(i.fromLayout=B(i.from,o,this.advanceCache,t),i.toLayout=B(i.to,o,this.advanceCache,t),i.layoutKey=a),{from:i.fromLayout,to:i.toLayout,edit:i}}measure(t,o){this.advanceCache.sync(this.advanceCache.signature(this.fontSize,this.fontFamily));let i=this.width,a=this.height,{from:s,to:r,edit:c}=this.frameLayout(o),l=K(c),d=c?Ot(s.innerW,r.innerW,l):r.innerW,h=c?Ot(s.innerH,r.innerH,l):r.innerH,f=typeof i=="number"?i:i==="hug"?d+this.padding.left+this.padding.right:t.maxWidth??0,u=typeof a=="number"?a:a==="hug"?h+this.padding.top+this.padding.bottom:t.maxHeight??0;return{width:f,height:u}}renderContent(t){t.pushTextStyle(null);try{!this.tokenized&&!this.activeEdit()&&O(this.language,this.theme)&&this.tokenize(),super.renderContent(t)}finally{t.popTextStyle()}}renderSelf(t){this.drawSelf(t)}acceptsChild(t){return!1}clipSelf(){return new re().rect({width:this.layoutBounds.width,height:this.layoutBounds.height})}hitTestSelf(t,o){let i=this.hitLayout();if(!i)return super.hitTestSelf(t,o);if(!super.hitTestSelf(t,o))return!1;let a=this.fontSize*this.lineHeight/2,s=this.showLineNumbers?i.gutter:0,r=i.startX-s-o;for(let c=0;c<i.lineY.length;c++)if(!((i.lineW[c]??0)+s<=0)&&!(Math.abs(t.y-i.lineY[c])>a+o)&&t.x>=r&&t.x<=i.startX+(i.lineW[c]??0)+o)return!0;return!1}hitLayout(){if(!this.layoutCache||this.activeEdit())return null;let t=this.metrics(),o=`${this.structureVersion}|${W(t)}|${this.advanceCache.signature(t.fontSize,t.fontFamily)}`;return this.layoutCacheKey===o?this.layoutCache:null}append(t){let{code:o}=t.data;return this.editTo(this.joinedSource()+o,t.duration,t.easing)}prepend(t){let{code:o}=t.data;return this.editTo(o+this.joinedSource(),t.duration,t.easing)}insert(t){let{position:o,code:i}=t.data,a=this.joinedSource(),s=this.offsetAt(o);return this.editTo(a.slice(0,s)+i+a.slice(s),t.duration,t.easing)}erase(t){let{target:o}=t.data,{duration:i,easing:a}=t,s=this.joinedSource(),{start:r,end:c}=R(o,this.lineLengths()),l=r===0||s[r-1]===`
5
- `,d=c===s.length||s[c]===`
6
- `;if(l&&d)c<s.length?c+=1:r>0&&(r-=1);else if(c<=r)return A(i,()=>{});return c<=r?A(i,()=>{}):this.editTo(s.slice(0,r)+s.slice(c),i,a)}replace(t){let{target:o,replacement:i}=t.data,a=this.joinedSource(),{start:s,end:r}=R(o,this.lineLengths());return this.editTo(a.slice(0,s)+i+a.slice(r),t.duration,t.easing)}highlight(t){let{target:o,dim:i}=t.data,{duration:a,easing:s}=t,r=i??.4,c=this.tokenIdsInRanges(se(o));if(c.size===0)return A(a,()=>{});let l=this.highlightDimOpacity??1,d=this.highlightedIds.size>0,h=this.highlightedIds,f=[];for(let u of this.tokenLines)for(let g of u.tokens){let k=!d||h.has(g.id),w=c.has(g.id),p=k?1:l,C=w?1:r;p!==C&&f.push(X(g.id,{keys:[0,1],values:[p,C]}))}return this.runDim(f,a,s,u=>{this.highlightDimOpacity=u?r:d?l:null,this.highlightedIds=u?c:h})}resetHighlight(t){let{duration:o,easing:i}=t;if(this.highlightDimOpacity===null)return A(o,()=>{});let a=this.highlightDimOpacity,s=this.highlightedIds,r=[];for(let c of this.tokenLines)for(let l of c.tokens){let d=s.has(l.id)?1:a;d!==1&&r.push(X(l.id,{keys:[0,1],values:[d,1]}))}return this.runDim(r,o,i,c=>{this.highlightDimOpacity=c?null:a,this.highlightedIds=c?new Set:s})}editTo(t,o,i){let a=this.tokenLines,s=this.joinedSource();if(t===s)return A(o,()=>{});let r=this.diffStrategy(a,$(t,this.language,this.theme)),c={kind:"structural",from:a,to:r.lines,removedIds:r.removedIds,addedIds:r.addedIds,enteringLineIds:r.newLineIds,fromColorById:r.fromColorById,phases:this.phaseStrategy(r.removedIds.size>0,r.addedIds.size>0),progress:0,layoutKey:null,fromLayout:null,toLayout:null};return this.tokenized=O(this.language,this.theme),A(o,l=>{let d=l>0&&l<1,h=this.transitions.indexOf(c);d&&h<0?this.transitions.push(c):!d&&h>=0&&this.transitions.splice(h,1),c.progress=i?i(l):l,l<=0?(this.setLines(a),this._writeProp("code",s)):(this.setLines(r.lines),this._writeProp("code",t))})}runDim(t,o,i,a){let s={kind:"dim",tokens:t,progress:0};return A(o,r=>{let c=r>0&&r<1,l=this.transitions.indexOf(s);c&&l<0?this.transitions.push(s):!c&&l>=0&&this.transitions.splice(l,1),s.progress=i?i(r):r,a?.(r>=1)})}_prepareStep(t,o,i){let a=t.code;if(typeof a!="string"||a===this.joinedSource())return super._prepareStep(t,o,i);let s={...t};delete s.code;let r=super._prepareStep(s,o,i),c=this.editTo(a,o,i)._stepper();return{seek:l=>{r.seek(l),c.seek(l)},advance:l=>{let d=r.advance(l),h=c.advance(l);return d&&h}}}findAllRanges(t){let o=[];if(!t)return o;let i=this.joinedSource(),a=this.lineLengths(),s=0;for(;;){let r=i.indexOf(t,s);if(r===-1)break;o.push(it(r,r+t.length,a)),s=r+Math.max(1,t.length)}return o}findRangeAt(t,o){return this.findAllRanges(t)[o]??null}findFirstRange(t){return this.findRangeAt(t,0)}joinedSource(){return this.tokenLines.map(t=>t.tokens.map(o=>o.content).join("")).join(`
7
- `)}lineLengths(){return this.tokenLines.map(t=>t.tokens.reduce((o,i)=>o+i.content.length,0))}offsetAt(t){let o=this.lineLengths();if(o.length===0)return 0;let[i,a]=t,s=Math.max(0,Math.min(o.length-1,i-1)),r=0;for(let c=0;c<s;c++)r+=o[c]+1;return r+Math.max(0,Math.min(o[s],a-1))}tokenIdsInRanges(t){let o=new Set,i=this.lineLengths();if(i.length===0)return o;let a=t.map(r=>R(r,i)).filter(({start:r,end:c})=>c>r);if(a.length===0)return o;let s=0;for(let r=0;r<this.tokenLines.length;r++){let c=this.tokenLines[r];for(let l of c.tokens){let d=s,h=s+l.content.length;a.some(({start:f,end:u})=>h>f&&d<u)&&o.add(l.id),s=h}r<this.tokenLines.length-1&&(s+=1)}return o}drawSelf(t){this.advanceCache.sync(this.advanceCache.signature(this.fontSize,this.fontFamily)),Q(t,{tokenLines:this.tokenLines,metrics:this.metrics(),advanceCache:this.advanceCache,...this.frameLayout(t),tokenStates:ht(this.tokenLines,this.transitions,this.highlightDimOpacity,this.highlightedIds),highlightActive:this.highlightDimOpacity!==null||this.transitions.some(o=>o.kind==="dim")})}};x([N({default:""})],y.prototype,"code",void 0);x([N({default:"typescript"})],y.prototype,"language",void 0);x([N({default:"Fira Mono"})],y.prototype,"fontFamily",void 0);x([N({default:H.name})],y.prototype,"theme",void 0);x([N({default:16})],y.prototype,"fontSize",void 0);x([N({default:1.6})],y.prototype,"lineHeight",void 0);x([N({default:1.1})],y.prototype,"letterSpacing",void 0);x([N({default:!1})],y.prototype,"showLineNumbers",void 0);x([N({default:2})],y.prototype,"lineNumberGap",void 0);x([N({default:0,mapper:Mt.resolve,tween:Mt.lerp})],y.prototype,"padding",void 0);x([F({args:[{key:"code",kind:"text",multiline:!0}]})],y.prototype,"append",null);x([F({args:[{key:"code",kind:"text",multiline:!0}]})],y.prototype,"prepend",null);x([F({args:[{key:"position",kind:"point",properties:{line:{kind:"number",default:1,min:1,step:1},col:{kind:"number",default:1,min:1,step:1}}},{key:"code",kind:"text",default:"",multiline:!0}]})],y.prototype,"insert",null);x([F({key:"remove",args:[{key:"target",kind:"selector"}]})],y.prototype,"erase",null);x([F({args:[{key:"target",kind:"selector"},{key:"replacement",kind:"text",default:"",multiline:!0}]})],y.prototype,"replace",null);x([F({args:[{key:"target",kind:"selector"},{key:"dim",kind:"number",default:.4,min:0,max:1,step:.01,scale:100,unit:"%"}]})],y.prototype,"highlight",null);x([F()],y.prototype,"resetHighlight",null);y=x([ie({key:"code",parentKey:"node",forkable:!0,layout:{defaultWidthMode:"hug",defaultHeightMode:"hug",acceptsChildren:!1}})],y);function se(n){return typeof n[Symbol.iterator]=="function"?[...n]:[n]}var At=new Map;function ce(n){let t=At.get(n);return t===void 0&&(t=()=>E(void 0,[n]),At.set(n,t)),t}var le=[y];export{tt as BUILTIN_THEMES,y as Code,U as CodeRangeChain,oe as CodeRanges,H as DefaultHighlightStyle,yt as GithubDarkStyle,kt as GithubLightStyle,le as NODES,_ as TokenAdvanceCache,bt as VscodeDarkStyle,wt as VscodeLightStyle,O as canHighlight,it as charOffsetsToRange,et as compileStyle,Z as defaultCodeDiff,dt as defaultCodePhases,Q as drawCode,E as ensureHighlighter,Jt as initSyntaxHighlighter,B as layoutCode,Ht as lines,Xt as loadCodeLanguage,X as makeAnim,W as metricsSignature,K as moveProgress,Et as phasesFor,R as rangeToCharOffsets,Vt as registerCodeTheme,Ct as resolveTheme,ht as resolveTokenStates,Ft as sampleCurve,zt as smoothstep,$ as tokenizeCodeToIdLines,G as windowProgress,Tt as word};
1
+ import{j as St,k as Nt,l as n}from"./chunks/chunk-SYZUZB3M.js";import{Graphics2D as gt,Paint as je,Types as M,component2d as Re,lerpNumber as Vt}from"@motionscript/sdk";function ue(t,e,o){if(o<=t[0])return e[0];if(o>=t[t.length-1])return e[e.length-1];for(let i=0;i<t.length-1;i++)if(o<=t[i+1]){let r=t[i+1]-t[i],s=r===0?0:(o-t[i])/r;return e[i]+(e[i+1]-e[i])*s}return e[e.length-1]}function R(t,e){if(!t)return 1;let[o,i]=t;return e<=o?0:e>=i||i===o?1:(e-o)/(i-o)}function ge(t){return t*t*(3-2*t)}function et(t,e){return{id:t,opacity:e.values,opacityKeys:e.keys}}function he(t,e){return t&&e?{out:[0,.38],move:[.1,.68],in:[.52,1]}:t?{out:[0,.45],move:[.22,1],in:null}:e?{out:null,move:[0,.55],in:[.38,1]}:{out:null,move:[0,1],in:null}}var It=he;function B(t){return t?ge(R(t.phases.move,t.progress)):1}function Lt(t,e,o,i){let r=new Map;if(o!==null){let s=o;for(let a of t)for(let c of a.tokens)r.set(c.id,{opacity:i.has(c.id)?1:s})}for(let s of e)if(s.kind==="dim")for(let a of s.tokens)r.set(a.id,{opacity:ue(a.opacityKeys,a.opacity,s.progress)});return r}function Ct(t){let e=t.padding;return[t.fontSize,t.fontFamily,t.lineHeight,t.letterSpacing,e.left,e.right,e.top,e.bottom,t.showLineNumbers?1:0,t.lineNumberGap].join("|")}function pe(t,e,o){return o.advance(t," ",e.fontSize,e.fontFamily,0)*e.lineNumberGap}function me(t,e,o,i,r){if(!e.showLineNumbers)return 0;let s=String(Math.max(1,i));return o.advance(t,s,e.fontSize,e.fontFamily,0)+r}function W(t,e,o,i){let r=e.fontSize*e.lineHeight,s=e.showLineNumbers?pe(i,e,o):0,a=me(i,e,o,t.length,s),c=new Array(t.length),l=0;for(let b=0;b<t.length;b++){let w=0;for(let x of t[b].tokens)w+=o.advance(i,x.content,e.fontSize,e.fontFamily,e.letterSpacing);c[b]=w,w>l&&(l=w)}let f=l+a,u=t.length*r,d=f+e.padding.left+e.padding.right,h=u+e.padding.top+e.padding.bottom,p=-d/2+e.padding.left+a,g=h/2-e.padding.top,m=new Map,y=new Array(t.length),k=new Map;for(let b=0;b<t.length;b++){let w=g-b*r-r/2;y[b]=w,k.set(t[b].id,b);let x=p;for(let S of t[b].tokens)m.set(S.id,{x,y:w}),x+=o.advance(i,S.content,e.fontSize,e.fontFamily,e.letterSpacing)}return{tokens:m,lineY:y,lineW:c,lineIndex:k,gutter:a,gutterGap:s,innerW:f,innerH:u,blockW:d,blockH:h,startX:p}}import{Graphics2D as rt,parseColor as ye,lerpNumber as L}from"@motionscript/sdk";var we=[.82,.84,.86,1],ke=[.45,.5,.55,1],vt=new Map;function nt(t){if(!t)return we;let e=vt.get(t);return e||(e=ye(t),vt.set(t,e)),e}function Tt(t,e,o){return o<=0?t:o>=1?e:[t[0]+(e[0]-t[0])*o,t[1]+(e[1]-t[1])*o,t[2]+(e[2]-t[2])*o,t[3]+(e[3]-t[3])*o]}function be(t,e,o){if(!o)return 1;let i=1;for(let r of t.tokens){if(r.content.length===0)continue;let s=e.get(r.id)?.opacity??1;s<i&&(i=s)}return i}function it(t,e){let{tokenLines:o,metrics:i,advanceCache:r,from:s,to:a,edit:c,tokenStates:l}=e,f=c?c.progress:1,u=c?R(c.phases.out,f):1,d=B(c),h=c?R(c.phases.in,f):1,p=c?L(s.blockW,a.blockW,d):a.blockW,g=c?L(s.gutter,a.gutter,d):a.gutter,m=a.gutterGap||s.gutterGap,y=-p/2+i.padding.left+g-m;xe(t,e,Math.max(p,e.boxW??0),d);let k=(w,x,S)=>{if(S<=0)return;let C=r.advance(t,w,i.fontSize,i.fontFamily,0);t.draw(new rt().text({text:w,fontSize:i.fontSize,fontFamily:i.fontFamily,lineHeight:i.lineHeight,x:y-C/2,y:x,textAlign:"left"}).fill([{type:"solid",color:ke,opacity:S}]))},b=(w,x,S,C,A)=>{if(A<=0||w.length===0)return;let v=r.advance(t,w,i.fontSize,i.fontFamily,i.letterSpacing);t.draw(new rt().text({text:w,fontSize:i.fontSize,fontFamily:i.fontFamily,lineHeight:i.lineHeight,letterSpacing:i.letterSpacing,x:x+v/2,y:S,textAlign:"left"}).fill([{type:"solid",color:C,opacity:A}]))};for(let w=0;w<o.length;w++){let x=o[w],S=a.lineIndex.get(x.id);if(S===void 0)continue;let C=a.lineY[S],A=c?.enteringLineIds.has(x.id)??!1,v=C,F=1;if(c&&A)F=h;else if(c){let I=s.lineIndex.get(x.id);I!==void 0&&(v=L(s.lineY[I],C,d))}for(let I of x.tokens){let Z=a.tokens.get(I.id);if(!Z)continue;let kt=Z.x,bt=F,tt=nt(I.color);if(c&&!A)if(c.addedIds.has(I.id))bt=h;else{let xt=s.tokens.get(I.id);xt&&(kt=L(xt.x,Z.x,d)),c.fromColorById.has(I.id)&&(tt=Tt(nt(c.fromColorById.get(I.id)),tt,d))}b(I.content,kt,v,tt,bt*(l.get(I.id)?.opacity??1))}}if(c&&u<1)for(let w=0;w<c.from.length;w++){let x=c.from[w],S=s.lineIndex.get(x.id);if(S===void 0)continue;let C=a.lineIndex.get(x.id),A=C===void 0?s.lineY[S]:L(s.lineY[S],a.lineY[C],d);for(let v of x.tokens){if(!c.removedIds.has(v.id))continue;let F=s.tokens.get(v.id);F&&b(v.content,F.x,A,nt(v.color),1-u)}}i.showLineNumbers&&Se(e,k,d,h,u)}function ot(t,e,o){let{from:i,to:r,metrics:s}=e,a=s.fontSize*s.lineHeight/2,c=u=>{let d=r.lineIndex.get(u),h=i.lineIndex.get(u);return d!==void 0&&h!==void 0?L(i.lineY[h],r.lineY[d],o):d!==void 0?r.lineY[d]:h===void 0?null:i.lineY[h]},l=c(t.startId),f=c(t.endId);return l===null&&f===null?null:{top:(l??f)+a,bottom:(f??l)-a}}function xe(t,e,o,i){let{rowBands:r=[],rowsEdit:s=null}=e,a=(l,f,u,d,h)=>{h<=0||l<=f||t.draw(new rt().rect({x:0,y:(l+f)/2,width:o,height:l-f,cornerRadius:d}).fill([{type:"solid",color:u,opacity:h}]))};if(!s){for(let l of r){let f=ot(l,e,i);f&&a(f.top,f.bottom,l.color,l.radius,1)}return}let c=s.progress;for(let l=0;l<Math.max(s.from.length,s.to.length);l++){let f=s.from[l],u=s.to[l],d=f?ot(f,e,i):null,h=u?ot(u,e,i):null;d&&h?a(L(d.top,h.top,c),L(d.bottom,h.bottom,c),Tt(f.color,u.color,c),L(f.radius,u.radius,c),1):d?a(d.top,d.bottom,f.color,f.radius,1-c):h&&a(h.top,h.bottom,u.color,u.radius,c)}}function Se(t,e,o,i,r){let{tokenLines:s,from:a,to:c,edit:l,tokenStates:f,highlightActive:u}=t,d=s.length,h=l?l.from.length:d;for(let p=0;p<Math.max(h,d);p++){let g=p<h,m=p<d,y=m?s[p]:l?.from[p],k=y?be(y,f,u):1;l?g&&m?e(String(p+1),L(a.lineY[p],c.lineY[p],o),k):m?e(String(p+1),c.lineY[p],i*k):e(String(p+1),a.lineY[p],(1-r)*k):e(String(p+1),c.lineY[p],k)}}function $(t){return t.content.trim().length}function Mt(t){let e=0;for(let o of t.tokens)e+=$(o);return e}function Ne(t,e){let o=Mt(t),i=Mt(e);if(o===0&&i===0)return 1;if(o===0||i===0)return 0;let r=new Map;for(let a of t.tokens)$(a)!==0&&r.set(a.content,(r.get(a.content)??0)+1);let s=0;for(let a of e.tokens){let c=$(a);if(c===0)continue;let l=r.get(a.content)??0;l>0&&(r.set(a.content,l-1),s+=c)}return 2*s/(o+i)}function At(t,e,o){let i=e+1,r=new Float64Array((t+1)*i),s=new Float64Array(t*e);for(let f=1;f<=t;f++)for(let u=1;u<=e;u++){let d=o(f-1,u-1);s[(f-1)*e+(u-1)]=d;let h=r[(f-1)*i+u],p=r[f*i+(u-1)],g=h>p?h:p;if(d>0){let m=r[(f-1)*i+(u-1)]+d;m>g&&(g=m)}r[f*i+u]=g}let a=[],c=t,l=e;for(;c>0&&l>0;){let f=s[(c-1)*e+(l-1)];f>0&&r[c*i+l]===r[(c-1)*i+(l-1)]+f?(a.push([c-1,l-1]),c--,l--):r[(c-1)*i+l]>=r[c*i+(l-1)]?c--:l--}return a.reverse(),a}function Ie(t,e){return At(t.length,e.length,(o,i)=>t[o].content!==e[i].content?0:$(e[i])||.25)}function Le(t,e){if(t.tokens.length!==e.tokens.length)return!1;for(let o=0;o<t.tokens.length;o++)if(t.tokens[o].content!==e.tokens[o].content)return!1;return!0}function Et(t){let e="";for(let o of t.tokens)e+=o.content+"";return e}function Ce(t,e){let o=t.map(Et),i=e.map(Et),r=[],s=0;for(;s<t.length&&s<e.length&&o[s]===i[s];)r.push([s,s]),s++;let a=0;for(;a<t.length-s&&a<e.length-s&&o[t.length-1-a]===i[e.length-1-a];)a++;let c=ve(o,i,s,t.length-a,s,e.length-a),l=16e4,f=s,u=s;for(let[d,h]of[...c,[t.length-a,e.length-a]]){let p=d-f,g=h-u,m=p*g;if(m>0&&m<=4e4&&m<=l){l-=m;for(let[y,k]of At(p,g,(b,w)=>Ne(t[f+b],e[u+w])-.45))r.push([f+y,u+k])}d<t.length-a&&r.push([d,h]),f=d+1,u=h+1}for(let d=a;d>0;d--)r.push([t.length-d,e.length-d]);return r}function ve(t,e,o,i,r,s){let a=new Map,c=new Set;for(let g=o;g<i;g++){let m=t[g];c.has(m)?a.delete(m):a.set(m,g),c.add(m)}let l=new Map,f=new Set;for(let g=r;g<s;g++){let m=e[g];f.has(m)?l.delete(m):l.set(m,g),f.add(m)}let u=[];for(let g=r;g<s;g++){let m=a.get(e[g]);m!==void 0&&l.get(e[g])===g&&e[g].replaceAll("","").trim()!==""&&u.push([m,g])}let d=[],h=new Array(u.length).fill(-1);for(let g=0;g<u.length;g++){let m=0,y=d.length;for(;m<y;){let k=m+y>>1;u[d[k]][0]<u[g][0]?m=k+1:y=k}m>0&&(h[g]=d[m-1]),d[m]=g}let p=[];for(let g=d.length>0?d[d.length-1]:-1;g>=0;g=h[g])p.push(u[g]);return p.reverse()}function st(t,e){let o=new Set,i=new Set,r=new Set,s=new Map,a=Ce(t,e),c=new Set,l=new Set;for(let[f,u]of a){l.add(f),c.add(u);let d=t[f],h=e[u];h.id=d.id;let p=Le(d,h)?d.tokens.map((y,k)=>[k,k]):Ie(d.tokens,h.tokens),g=new Set,m=new Set;for(let[y,k]of p){g.add(y),m.add(k);let b=d.tokens[y],w=h.tokens[k];w.id=b.id,b.color!==w.color&&s.set(b.id,b.color)}for(let y=0;y<d.tokens.length;y++)g.has(y)||o.add(d.tokens[y].id);for(let y=0;y<h.tokens.length;y++)m.has(y)||i.add(h.tokens[y].id)}for(let f=0;f<t.length;f++)if(!l.has(f))for(let u of t[f].tokens)o.add(u.id);for(let f=0;f<e.length;f++)if(!c.has(f)){r.add(e[f].id);for(let u of e[f].tokens)i.add(u.id)}return{lines:e,removedIds:o,addedIds:i,newLineIds:r,fromColorById:s}}var T={name:"motion-canvas-default",defaultColor:"#d8dee9",rules:[{tag:n.keyword,color:"#5e81ac"},{tag:[n.name,n.deleted,n.character,n.propertyName,n.macroName],color:"#88c0d0"},{tag:[n.variableName],color:"#8fbcbb"},{tag:[n.function(n.variableName)],color:"#8fbcbb"},{tag:[n.labelName],color:"#81a1c1"},{tag:[n.color,n.constant(n.name),n.standard(n.name)],color:"#5e81ac"},{tag:[n.definition(n.name),n.separator],color:"#a3be8c"},{tag:[n.brace],color:"#8fbcbb"},{tag:[n.annotation],color:"#d30102"},{tag:[n.number,n.changed,n.annotation,n.modifier,n.self,n.namespace],color:"#b48ead"},{tag:[n.typeName,n.className],color:"#ECEFF4"},{tag:[n.operator,n.operatorKeyword],color:"#a3be8c"},{tag:[n.tagName],color:"#b48ead"},{tag:[n.squareBracket],color:"#ECEFF4"},{tag:[n.angleBracket],color:"#ECEFF4"},{tag:[n.attributeName],color:"#eceff4"},{tag:[n.regexp],color:"#5e81ac"},{tag:[n.quote],color:"#b48ead"},{tag:[n.string],color:"#a3be8c"},{tag:n.link,color:"#a3be8c"},{tag:[n.url,n.escape,n.special(n.string)],color:"#8fbcbb"},{tag:[n.meta],color:"#88c0d0"},{tag:[n.monospace],color:"#d8dee9"},{tag:[n.comment],color:"#4c566a"},{tag:n.strong,color:"#5e81ac"},{tag:n.emphasis,color:"#5e81ac"},{tag:n.heading,color:"#5e81ac"},{tag:n.special(n.heading1),color:"#5e81ac"},{tag:n.heading1,color:"#5e81ac"},{tag:[n.heading2,n.heading3,n.heading4],color:"#5e81ac"},{tag:[n.heading5,n.heading6],color:"#5e81ac"},{tag:[n.atom,n.bool,n.special(n.variableName)],color:"#d08770"},{tag:[n.processingInstruction,n.inserted],color:"#8fbcbb"},{tag:[n.contentSeparator],color:"#ebcb8b"},{tag:n.invalid,color:"#434c5e"}]},Ht={name:"github-dark",defaultColor:"#c9d1d9",rules:[{tag:[n.standard(n.tagName),n.tagName],color:"#7ee787"},{tag:[n.comment,n.bracket],color:"#8b949e"},{tag:[n.className,n.propertyName],color:"#d2a8ff"},{tag:[n.variableName,n.attributeName,n.number,n.operator],color:"#79c0ff"},{tag:[n.keyword,n.typeName,n.typeOperator],color:"#ff7b72"},{tag:[n.string,n.meta,n.regexp],color:"#a5d6ff"},{tag:[n.name,n.quote],color:"#7ee787"},{tag:[n.heading,n.strong],color:"#d2a8ff"},{tag:[n.emphasis],color:"#d2a8ff"},{tag:[n.deleted],color:"#ffdcd7"},{tag:[n.atom,n.bool,n.special(n.variableName)],color:"#ffab70"},{tag:n.invalid,color:"#f97583"}]},Ft={name:"github-light",defaultColor:"#24292e",rules:[{tag:[n.standard(n.tagName),n.tagName],color:"#116329"},{tag:[n.comment,n.bracket],color:"#6a737d"},{tag:[n.className,n.propertyName],color:"#6f42c1"},{tag:[n.variableName,n.attributeName,n.number,n.operator],color:"#005cc5"},{tag:[n.keyword,n.typeName,n.typeOperator],color:"#d73a49"},{tag:[n.string,n.meta,n.regexp],color:"#032f62"},{tag:[n.name,n.quote],color:"#22863a"},{tag:[n.heading,n.strong],color:"#24292e"},{tag:[n.emphasis],color:"#24292e"},{tag:[n.deleted],color:"#b31d28"},{tag:[n.atom,n.bool,n.special(n.variableName)],color:"#e36209"},{tag:[n.url,n.escape,n.regexp,n.link],color:"#032f62"},{tag:n.invalid,color:"#cb2431"}]},_t={name:"vscode-dark",defaultColor:"#9cdcfe",rules:[{tag:[n.keyword,n.operatorKeyword,n.modifier,n.color,n.constant(n.name),n.standard(n.name),n.standard(n.tagName),n.special(n.brace),n.atom,n.bool,n.special(n.variableName)],color:"#569cd6"},{tag:[n.controlKeyword,n.moduleKeyword],color:"#c586c0"},{tag:[n.name,n.deleted,n.character,n.macroName,n.propertyName,n.variableName,n.labelName,n.definition(n.name)],color:"#9cdcfe"},{tag:n.heading,color:"#9cdcfe"},{tag:[n.typeName,n.className,n.tagName,n.changed,n.annotation,n.self,n.namespace],color:"#4ec9b0"},{tag:[n.function(n.variableName),n.function(n.propertyName)],color:"#dcdcaa"},{tag:[n.number],color:"#b5cea8"},{tag:[n.operator,n.punctuation,n.separator,n.url,n.escape],color:"#d4d4d4"},{tag:[n.regexp],color:"#d16969"},{tag:[n.special(n.string),n.processingInstruction,n.string,n.inserted],color:"#ce9178"},{tag:[n.angleBracket],color:"#808080"},{tag:[n.meta,n.comment],color:"#6a9955"},{tag:n.link,color:"#6a9955"},{tag:n.invalid,color:"#ff0000"}]},Dt={name:"vscode-light",defaultColor:"#383a42",rules:[{tag:[n.keyword,n.operatorKeyword,n.modifier,n.color,n.constant(n.name),n.standard(n.name),n.standard(n.tagName),n.special(n.brace),n.atom,n.bool,n.special(n.variableName)],color:"#0000ff"},{tag:[n.moduleKeyword,n.controlKeyword],color:"#af00db"},{tag:[n.name,n.deleted,n.character,n.macroName,n.propertyName,n.variableName,n.labelName,n.definition(n.name)],color:"#0070c1"},{tag:n.heading,color:"#0070c1"},{tag:[n.typeName,n.className,n.tagName,n.changed,n.annotation,n.self,n.namespace],color:"#267f99"},{tag:[n.function(n.variableName),n.function(n.propertyName)],color:"#795e26"},{tag:[n.number],color:"#098658"},{tag:[n.operator,n.punctuation,n.separator,n.url,n.escape],color:"#383a42"},{tag:[n.regexp],color:"#af00db"},{tag:[n.special(n.string),n.processingInstruction,n.string,n.inserted],color:"#a31515"},{tag:[n.angleBracket],color:"#383a42"},{tag:[n.meta,n.comment],color:"#008000"},{tag:n.link,color:"#4078f2"},{tag:n.invalid,color:"#e45649"}]},Y={"motion-canvas-default":T,"github-dark":Ht,"github-light":Ft,"vscode-dark":_t,"vscode-light":Dt},Ot=new WeakMap;function at(t){let e=Ot.get(t);if(e)return e;let o=St(t.rules.map(i=>({tag:i.tag,class:i.color})));return Ot.set(t,o),o}var Gt={typescript:async()=>(await import("./chunks/dist-B46VH2YP.js")).parser.configure({dialect:"ts"}),tsx:async()=>(await import("./chunks/dist-B46VH2YP.js")).parser.configure({dialect:"ts jsx"}),javascript:async()=>(await import("./chunks/dist-B46VH2YP.js")).parser,jsx:async()=>(await import("./chunks/dist-B46VH2YP.js")).parser.configure({dialect:"jsx"}),python:async()=>(await import("./chunks/dist-W5ZXIMV7.js")).parser,json:async()=>(await import("./chunks/dist-3F5TQHM6.js")).parser,html:async()=>(await import("./chunks/dist-OXJDTPQ6.js")).parser,css:async()=>(await import("./chunks/dist-N4CNBNHL.js")).parser,rust:async()=>(await import("./chunks/dist-GPNEVCJI.js")).parser,go:async()=>(await import("./chunks/dist-FQDUBZKU.js")).parser,java:async()=>(await import("./chunks/dist-AQRNACF3.js")).parser,cpp:async()=>(await import("./chunks/dist-3SIR23P4.js")).parser,php:async()=>(await import("./chunks/dist-LRSXSDHT.js")).parser,markdown:async()=>(await import("./chunks/dist-FH6BHJ6A.js")).parser,xml:async()=>(await import("./chunks/dist-SH7H4MRK.js")).parser,yaml:async()=>(await import("./chunks/dist-UG3NTKWL.js")).parser},jt={ts:"typescript",js:"javascript",py:"python","c++":"cpp",md:"markdown",yml:"yaml",shell:"javascript"},Te=new Set(["","text","plaintext"]),zt=new Set;function lt(t,e,o){let i=`${t}:${e}`;zt.has(i)||(zt.add(i),console.warn(`[Code] ${o}`))}function N(t){return t.indexOf("\r")===-1?t:t.replace(/\r\n?/g,`
2
+ `)}function P(t){let e=t.toLowerCase();return jt[e]??e}var _=new Map,ct=new Map,ft=[T.name],Rt=["typescript","javascript","json","python"],Bt=new Map(Object.entries(Y));function Me(t){Bt.set(t.name,t)}function K(t){if(typeof t!="string")return t;let e=Bt.get(t);return e||(lt("theme",t,`unknown theme "${t}"; using "${T.name}". Built-in themes: ${Object.keys(Y).join(", ")}; register others with registerCodeTheme.`),T)}function Ee(t){return _.has(P(t))}function H(t=ft,e=Rt){let o=[];for(let i of e){let r=P(i);if(_.has(r))continue;let s=Gt[r];if(!s){Te.has(r)||lt("language",r,`no grammar for language "${i}"; drawing it as plain text. Supported: ${Object.keys(Gt).join(", ")} (aliases: ${Object.keys(jt).join(", ")}).`);continue}let a=ct.get(r);a||(a=s().then(c=>(_.set(r,c),c)).catch(c=>(lt("load",r,`could not load the "${i}" grammar; drawing it as plain text: ${c instanceof Error?c.message:String(c)}`),null)).finally(()=>ct.delete(r)),ct.set(r,a)),o.push(a)}return o.length===0?Promise.resolve():Promise.all(o).then(()=>{})}async function Ae(t,e){await H(ft,[t])}async function Oe(t=ft,e=Rt){await H(t,e)}function D(t,e){return Ee(t)}function Wt(t,e){return`${t}:${e}`}function He(t,e,o){let i=_.get(P(e));if(!i)return null;let r=i.parse(t),s=at(o),a=new Map;return Nt(r,s,(c,l,f)=>{let u=f;if(!u)return;let d=r.cursorAt(c,1);do a.set(Wt(d.from,d.to),u);while(d.next()&&d.to<=l)}),{tree:r,code:t,colorLookup:a}}function Fe(t,e){let o=e.tree.resolveInner(t,1),i=e.colorLookup.get(Wt(o.from,o.to));return i?{color:i,skipAhead:o.to-t}:{color:null,skipAhead:o.firstChild?0:o.to-t}}function _e(t,e){let o=_.get(P(e));if(!o)return[t];let r=o.parse(t).cursor(),s=[],a=0;do r.node.firstChild||(r.from>a&&s.push(t.slice(a,r.from)),r.from<r.to&&s.push(t.slice(r.from,r.to)),a=r.to);while(r.next());return a<t.length&&s.push(t.slice(a)),s}function $t(t,e,o=T){t=N(t);let i=K(o),r=He(t,e,i),s=[[]],a=()=>s.push([]);if(!r)return t.split(`
3
+ `).map(l=>[{content:l,color:i.defaultColor}]);let c=0;for(let l of _e(t,e)){let f=0;for(;f<l.length;){let{color:u,skipAhead:d}=Fe(c+f,r),h=f+Math.max(d,1);h>l.length&&(h=l.length);let p=l.indexOf(`
4
+ `,f);p!==-1&&p<h&&(h=p);let g=l.slice(f,h);g.length>0&&s[s.length-1].push({content:g,color:u??i.defaultColor}),p===h&&(a(),h+=1),f=h}c+=l.length}return s}var De=1,Ge=1;function Yt(t,e){return{id:De++,content:t,color:e}}function Pt(t){return{id:Ge++,tokens:t}}function dt(t,e,o){return t=N(t),D(e,o)?$t(t,e,o).map(i=>Pt(i.map(r=>Yt(r.content,r.color)))):(K(o),t.split(`
5
+ `).map(i=>Pt([Yt(i,"#d1d5db")])))}var G=class{cache=new Map;sig="";signature(e,o){return`${e}|${o}`}sync(e){e!==this.sig&&(this.cache.clear(),this.sig=e)}advance(e,o,i,r,s){if(o.length===0)return 0;let a=`${o}\0${s}`,c=this.cache.get(a);if(c!==void 0)return c;let{width:l}=e.measureText(o,i,r,void 0,s);return this.cache.set(a,l),l}};function Kt(t,e,o){return{startLine:t,startCol:e,endLine:t,endCol:o===void 0?1/0:e+o}}function Ut(t,e){return{startLine:t,startCol:1,endLine:e??t,endCol:1/0}}var U=class t{list;constructor(e=[]){this.list=e}lines(e,o){return new t([...this.list,Ut(e,o)])}word(e,o,i){return new t([...this.list,Kt(e,o,i)])}*[Symbol.iterator](){yield*this.list}toJSON(){return this.list}},ze=new U;function z(t,e){if(e.length===0)return{start:0,end:0};let o=new Array(e.length),i=0;for(let y=0;y<e.length;y++)o[y]=i,i+=e[y]+1;let r=i>0?i-1:0,s=y=>Math.max(0,Math.min(e.length-1,y-1)),a=t.endLine??1/0,c=t.endCol??1/0,l=s(t.startLine),f=s(a),u=e[l],d=e[f],h=Math.max(0,Math.min(u,t.startCol-1)),p=c===1/0?d:Math.max(0,Math.min(d,c-1)),g=Math.min(r,o[l]+h),m=Math.min(r,o[f]+p);return{start:Math.min(g,m),end:Math.max(g,m)}}function ut(t,e,o){let i=0,r=1,s=1,a=1,c=1,l=!1;for(let f=0;f<o.length;f++){let u=i,d=i+o[f];if(!l&&t>=u&&t<=d&&(r=f+1,s=t-u+1,l=!0),e>=u&&e<=d){a=f+1,c=e-u+1;break}i=d+1}return{startLine:r,startCol:s,endLine:a,endCol:c}}var Be="rgba(255, 255, 255, 0.12)",qt=6,ne=new WeakMap,oe={dim:null,ids:new Set,fade:null},We={bands:[],fade:null};function V(t){return M.custom(t,{private:!0})}var q=M.custom(void 0,{kind:"selector"}),X=M.text("",{multiline:!0});function $e(t={}){let e={diff:t.diffStrategy??st,phases:t.phaseStrategy??It,edits:new WeakMap},o=(r,s)=>s?r.animate(s):r.wait(0),i=Re({key:"code",state:{code:M.custom("",{lerp:Ue}),language:"typescript",fontFamily:"Fira Mono",theme:M.custom(T.name),fontSize:16,lineHeight:1.6,letterSpacing:1.1,showLineNumbers:!1,lineNumberGap:2,listing:V(null),edit:V(null),focus:V(oe),banding:V(We)},defaults:{width:"hug",height:"hug"},allowedChildren:[],load:(r,s)=>{r.font(s.fontFamily),r.task(`shiki:lang:${s.language}`,sn(s.language),{before:"layout"})},commands:{append:{args:{code:X},run:(r,s)=>{let a=E(s,e);return o(r,j(e,a,a.source+r.args.code,O(s)))}},prepend:{args:{code:X},run:(r,s)=>{let a=E(s,e);return o(r,j(e,a,r.args.code+a.source,O(s)))}},insert:{args:{position:M.custom(void 0,{kind:"point",properties:{line:{kind:"number",default:1,min:1,step:1},col:{kind:"number",default:1,min:1,step:1}}}),code:X},run:(r,s)=>{let a=E(s,e),c=nn(a.lines,r.args.position),l=a.source.slice(0,c)+r.args.code+a.source.slice(c);return o(r,j(e,a,l,O(s)))}},remove:{args:{target:q},run:(r,s)=>o(r,Ze(e,s,r.args.target))},replace:{args:{target:q,replacement:X},run:(r,s)=>{let a=E(s,e),{start:c,end:l}=z(r.args.target,Q(a.lines)),f=a.source.slice(0,c)+r.args.replacement+a.source.slice(l);return o(r,j(e,a,f,O(s)))}},highlight:{args:{target:q,dim:M.number(.4,{min:0,max:1,step:.01,scale:100,unit:"%"})},run:(r,s)=>o(r,tn(e,s,r.args.target,r.args.dim))},resetHighlight:(r,s)=>o(r,en(e,s)),highlightRows:{args:{target:q,color:M.color(Be),radius:M.number(qt,{min:0,step:1})},run:(r,s)=>{let a=E(s,e),c=rn(a.lines,ce(r.args.target),r.args.color,Math.max(0,r.args.radius??qt));return o(r,Zt(a,s.banding.bands,c))}},resetRowHighlight:(r,s)=>o(r,Zt(E(s,e),s.banding.bands,[]))},measure:(r,s)=>an(r,s,e),render:(r,s)=>r.textStyle(null,()=>fn(r,s,e))});return ne.set(i.node,e),i}var re=$e();function Rn(t){let e=ne.get(t.constructor);if(!e)throw new TypeError("listingOf takes a node a `Code` component built.");let o=pt(t,e);return{source:o.source,lines:o.lines,edit:ie(o)}}function Ye(t,e){let o=[];if(!e)return o;let i=N(J(t)),r=i.split(`
6
+ `).map(a=>a.length),s=0;for(;;){let a=i.indexOf(e,s);if(a===-1)break;o.push(ut(a,a+e.length,r)),s=a+Math.max(1,e.length)}return o}function Pe(t,e,o){return Ye(t,e)[o]??null}function Bn(t,e){return Pe(t,e,0)}function pt(t,e){let o=t.code;if(typeof o!="string"){let{transition:r}=se(ht(t,o.from,e),o.to,O(t),e);return{source:o.to,lines:r.to,transition:r,progress:o.t}}if(t.edit)return{source:N(o),lines:t.edit.transition.to,transition:t.edit.transition,progress:t.edit.progress};let i=ht(t,N(o),e);return{source:i.source,lines:i.lines,transition:null,progress:1}}function ie(t){return t.transition?{...t.transition,progress:t.progress}:null}function E(t,e){return ht(t,N(J(t.code)),e)}function ht(t,e,o){let i=O(t),r=t.listing;return r?r.source!==e?se(r,e,i,o).listing:Ke(r.basis,i)?r:r.basis.language===i.language&&r.basis.highlighted===i.highlighted?Xe(r,i):Xt(e,i):Xt(e,i)}function O(t){return{language:t.language,theme:t.theme,highlighted:D(t.language,t.theme)}}function Ke(t,e){return t.language===e.language&&t.theme===e.theme&&t.highlighted===e.highlighted}function J(t){return typeof t=="string"?t:t.to}function Ue(t,e,o){let i=J(t),r=J(e),s=N(i),a=N(r);return s===a?o>=1?r:i:o<=0?s:o>=1?a:{from:s,to:a,t:o}}var Ve=new Map,qe=256;function Xt(t,e){return wt(Ve,yt(e),t,qe,()=>({source:t,lines:mt(t,e),basis:e}))}var Jt=new WeakMap;function Xe(t,e){let o=Jt.get(t.lines);return o||Jt.set(t.lines,o=new Map),wt(o,yt(e),t.source,4,()=>{let i=mt(t.source,e);return Qe(t.lines,i),{source:t.source,lines:i,basis:e}})}function se(t,e,o,i){let r=i.edits.get(t.lines);return r||i.edits.set(t.lines,r=new Map),wt(r,yt(o),e,16,()=>ae(i,t.lines,e,o))}function ae(t,e,o,i){let r=t.diff(e,mt(o,i));return{transition:{kind:"structural",from:e,to:r.lines,removedIds:r.removedIds,addedIds:r.addedIds,enteringLineIds:r.newLineIds,fromColorById:r.fromColorById,phases:t.phases(r.removedIds.size>0,r.addedIds.size>0),progress:0,layoutKey:null,fromLayout:null,toLayout:null},listing:{source:o,lines:r.lines,basis:i}}}function mt(t,e){return e.highlighted||H(void 0,[e.language]).catch(()=>{}),dt(t,e.language,e.theme)}var Qt=new WeakMap,Je=1;function yt(t){let e;if(typeof t.theme=="string")e=`name:${t.theme}`;else{let o=Qt.get(t.theme);o===void 0&&Qt.set(t.theme,o=Je++),e=`style:${o}`}return`${t.language}
7
+ ${t.highlighted?1:0}
8
+ ${e}`}function wt(t,e,o,i,r){let s=t.get(e);s||t.set(e,s=new Map);let a=s.get(o);if(a!==void 0)return s.delete(o),s.set(o,a),a;let c=r();return s.set(o,c),s.size>i&&s.delete(s.keys().next().value),c}function Qe(t,e){if(t.length===e.length){for(let o=0;o<t.length;o++){let i=t[o].tokens,r=e[o].tokens;if(i.length!==r.length)return;for(let s=0;s<i.length;s++)if(i[s].content!==r[s].content)return}for(let o=0;o<t.length;o++){e[o].id=t[o].id;for(let i=0;i<t[o].tokens.length;i++)e[o].tokens[i].id=t[o].tokens[i].id}}}function j(t,e,o,i){let r=N(o);if(r===e.source)return null;let{transition:s,listing:a}=ae(t,e.lines,r,i);return c=>c<=0?{code:e.source,listing:e,edit:null}:c>=1?{code:r,listing:a,edit:null}:{code:r,listing:a,edit:{transition:s,progress:c}}}function Ze(t,e,o){let i=E(e,t),r=i.source,{start:s,end:a}=z(o,Q(i.lines)),c=s===0||r[s-1]===`
9
+ `,l=a===r.length||r[a]===`
10
+ `;if(c&&l)a<r.length?a+=1:s>0&&(s-=1);else if(a<=s)return null;return a<=s?null:j(t,i,r.slice(0,s)+r.slice(a),O(e))}function tn(t,e,o,i){let r=E(e,t),s=i??.4,a=on(r.lines,ce(o));if(a.size===0)return null;let c=e.focus,l=c.dim??1,f=c.ids.size>0,u=[];for(let p of r.lines)for(let g of p.tokens){let m=!f||c.ids.has(g.id)?1:l,y=a.has(g.id)?1:s;m!==y&&u.push(et(g.id,{keys:[0,1],values:[m,y]}))}let d={dim:f?l:null,ids:c.ids,fade:null},h={dim:s,ids:a,fade:null};return p=>({listing:r,focus:p<=0?d:p>=1?h:{...d,fade:{kind:"dim",tokens:u,progress:p}}})}function en(t,e){let o=e.focus;if(o.dim===null)return null;let i=E(e,t),r=o.dim,s=[];for(let c of i.lines)for(let l of c.tokens){let f=o.ids.has(l.id)?1:r;f!==1&&s.push(et(l.id,{keys:[0,1],values:[f,1]}))}let a={dim:r,ids:o.ids,fade:null};return c=>({listing:i,focus:c>=1?oe:c<=0?a:{...a,fade:{kind:"dim",tokens:s,progress:c}}})}function Zt(t,e,o){return e.length===0&&o.length===0?null:i=>({listing:t,banding:i>=1?{bands:o,fade:null}:i<=0?{bands:e,fade:null}:{bands:e,fade:{kind:"rows",from:e,to:o,progress:i}}})}function Q(t){return t.map(e=>e.tokens.reduce((o,i)=>o+i.content.length,0))}function nn(t,e){let o=Q(t);if(o.length===0)return 0;let[i,r]=e,s=Math.max(0,Math.min(o.length-1,i-1)),a=0;for(let c=0;c<s;c++)a+=o[c]+1;return a+Math.max(0,Math.min(o[s],r-1))}function on(t,e){let o=new Set,i=Q(t);if(i.length===0)return o;let r=e.map(a=>z(a,i)).filter(({start:a,end:c})=>c>a);if(r.length===0)return o;let s=0;for(let a=0;a<t.length;a++){for(let c of t[a].tokens){let l=s,f=s+c.content.length;r.some(({start:u,end:d})=>f>u&&l<d)&&o.add(c.id),s=f}a<t.length-1&&(s+=1)}return o}function rn(t,e,o,i){let r=t.length,s=[];for(let a of e){let c=Math.max(1,Math.round(a.startLine??1)),l=Math.min(r,a.endLine==null||a.endLine===1/0?r:Math.round(a.endLine));c>l||s.push({startId:t[c-1].id,endId:t[l-1].id,color:o,radius:i})}return s}function ce(t){if(typeof t[Symbol.iterator]=="function")return[...t];let o=t.list;return Array.isArray(o)?[...o]:[t]}var te=new Map;function sn(t){let e=te.get(t);return e===void 0&&(e=()=>H(void 0,[t]),te.set(t,e)),e}var ee=new WeakMap;function le(t){let e=ee.get(t);return e||ee.set(t,e={advances:new G,measurer:null,scope:null,settled:null,edit:null}),e}function fe(t){return{fontSize:t.fontSize,fontFamily:t.fontFamily,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing,padding:t.padding,showLineNumbers:t.showLineNumbers,lineNumberGap:t.lineNumberGap}}function de(t,e,o){let i=t.advances.signature(o.fontSize,o.fontFamily);t.advances.sync(i);let r=`${Ct(o)}|${i}`,s=t.scope;if(!e.transition){let l=t.settled;if(l&&l.lines===e.lines&&l.key===r)return{from:l.layout,to:l.layout};if(!s)return null;let f=W(e.lines,o,t.advances,s);return t.settled={lines:e.lines,key:r,layout:f},{from:f,to:f}}let a=t.edit;if(a&&a.transition===e.transition&&a.key===r)return a;if(!s)return null;let c={transition:e.transition,key:r,from:W(e.transition.from,o,t.advances,s),to:W(e.transition.to,o,t.advances,s)};return t.edit=c,c}function an(t,e,o){let i=le(e);i.measurer!==t&&(i.measurer=t,i.scope={measureText:(u,d,h,p,g)=>t.text(u,{fontFamily:h,fontSize:d,fontWeight:p,letterSpacing:g})});let r=pt(e,o),s=fe(e),a=de(i,r,s);if(!a)return{width:0,height:0};let c=B(r.transition?{phases:r.transition.phases,progress:r.progress}:null),l=r.transition?Vt(a.from.innerW,a.to.innerW,c):a.to.innerW,f=r.transition?Vt(a.from.innerH,a.to.innerH,c):a.to.innerH;return{width:l+s.padding.left+s.padding.right,height:f+s.padding.top+s.padding.bottom}}var cn={fill:[],stroke:[],shadow:[],overlay:[],start:0,end:1,clip:!1},ln=()=>{};function fn(t,e,o){let i=le(e),r=pt(e,o),s=fe(e),a=de(i,r,s);je.draw(t,cn,null,{clipShape:dn(r,a,s,t.size),children:ln});let c=i.scope;if(!a||!c)return;let{focus:l,banding:f}=e;it({draw:u=>t.draw(u),measureText:c.measureText},{tokenLines:r.lines,metrics:s,advanceCache:i.advances,from:a.from,to:a.to,edit:ie(r),tokenStates:Lt(r.lines,l.fade?[l.fade]:[],l.dim,l.ids),highlightActive:l.dim!==null||l.fade!==null,rowBands:f.bands,rowsEdit:f.fade,boxW:t.size.width})}function dn(t,e,o,i){let r={x:0,y:0,width:i.width,height:i.height};if(t.transition||!e)return new gt().rect(r);let s=e.to,a=o.fontSize*o.lineHeight/2,c=o.showLineNumbers?s.gutter:0,l=Math.max(s.startX-c,-i.width/2),f=new gt,u=0;for(let d=0;d<s.lineY.length;d++){let h=s.lineW[d]??0;if(h+c<=0)continue;let p=Math.min(s.startX+h,i.width/2),g=s.lineY[d],m=Math.min(g+a,i.height/2),y=Math.max(g-a,-i.height/2);if(p<l||m<y)continue;let k=m===g+a&&y===g-a;f.rect({x:(l+p)/2,y:k?g:(m+y)/2,width:p-l,height:k?2*a:m-y}),u++}return u>0?f:new gt().rect(r).rect(r).cut()}var un=[re];export{Y as BUILTIN_THEMES,re as Code,U as CodeRangeChain,ze as CodeRanges,T as DefaultHighlightStyle,Ht as GithubDarkStyle,Ft as GithubLightStyle,un as NODES,G as TokenAdvanceCache,_t as VscodeDarkStyle,Dt as VscodeLightStyle,D as canHighlight,ut as charOffsetsToRange,at as compileStyle,st as defaultCodeDiff,It as defaultCodePhases,$e as defineCode,it as drawCode,H as ensureHighlighter,Ye as findAllRanges,Bn as findFirstRange,Pe as findRangeAt,Oe as initSyntaxHighlighter,W as layoutCode,Ut as lines,Rn as listingOf,Ae as loadCodeLanguage,et as makeAnim,Ct as metricsSignature,B as moveProgress,N as normalizeSource,he as phasesFor,z as rangeToCharOffsets,Me as registerCodeTheme,K as resolveTheme,Lt as resolveTokenStates,ue as sampleCurve,ge as smoothstep,dt as tokenizeCodeToIdLines,R as windowProgress,Kt as word};
8
11
  //# sourceMappingURL=index.js.map