@glissade/browser 0.17.0-pre.0

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.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # @glissade/browser
2
+
3
+ A single-file IIFE bundle of glissade's realtime browser embed path — core, scene, Canvas2D backend, player, and the `<gs-player>` element — for `<script src>` / no-build use. Everything lands on `window.glissade.*`, and loading the script auto-registers `<gs-player>`.
4
+
5
+ ```html
6
+ <script src="glissade.browser.js"></script>
7
+ <script>
8
+ const G = window.glissade;
9
+ const scene = G.createScene({ size: { w: 640, h: 360 } });
10
+ const backend = new G.Canvas2DBackend(document.querySelector('canvas'));
11
+ scene.setTextMeasurer(backend);
12
+ // ...own rAF loop: backend.render(G.evaluate(scene, timeline, t))
13
+ </script>
14
+ ```
15
+
16
+ What's included: the realtime embed surface only — core (`evaluate`, signals, timeline builder, easings, springs, seeded RNG), scene (node tree + `DisplayList`), the Canvas2D backend, the player (`mount`, drivers), and `<gs-player>`. Not included: the CLI, the Skia backend, the video export path, studio, and `effects-webgpu` — those are export/desktop-only and don't affect realtime authoring.
17
+
18
+ See the [browser guide](https://tyevco.github.io/glissade/browser) for the full standalone walkthrough, including the FOUT caveat for own-rAF consumers.
19
+
20
+ Apache-2.0.
@@ -0,0 +1,14 @@
1
+ "use strict";var glissade=(()=>{var de=Object.defineProperty,ki=Object.defineProperties,vi=Object.getOwnPropertyDescriptor,xi=Object.getOwnPropertyDescriptors,Mi=Object.getOwnPropertyNames,fe=Object.getOwnPropertySymbols;var rs=Object.prototype.hasOwnProperty,Sn=Object.prototype.propertyIsEnumerable;var Tn=t=>{throw TypeError(t)};var ns=(t,e,s)=>e in t?de(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,E=(t,e)=>{for(var s in e||(e={}))rs.call(e,s)&&ns(t,s,e[s]);if(fe)for(var s of fe(e))Sn.call(e,s)&&ns(t,s,e[s]);return t},D=(t,e)=>ki(t,xi(e));var En=t=>typeof t=="symbol"?t:t+"",pe=(t,e)=>{var s={};for(var n in t)rs.call(t,n)&&e.indexOf(n)<0&&(s[n]=t[n]);if(t!=null&&fe)for(var n of fe(t))e.indexOf(n)<0&&Sn.call(t,n)&&(s[n]=t[n]);return s};var Si=(t,e)=>{for(var s in e)de(t,s,{get:e[s],enumerable:!0})},Ti=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Mi(e))!rs.call(t,r)&&r!==s&&de(t,r,{get:()=>e[r],enumerable:!(n=vi(e,r))||n.enumerable});return t};var Ei=t=>Ti(de({},"__esModule",{value:!0}),t);var x=(t,e,s)=>ns(t,typeof e!="symbol"?e+"":e,s),is=(t,e,s)=>e.has(t)||Tn("Cannot "+s);var P=(t,e,s)=>(is(t,e,"read from private field"),s?s.call(t):e.get(t)),H=(t,e,s)=>e.has(t)?Tn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),_=(t,e,s,n)=>(is(t,e,"write to private field"),n?n.call(t,s):e.set(t,s),s),N=(t,e,s)=>(is(t,e,"access private method"),s);var ea={};Si(ea,{ALL_FILTER_KINDS:()=>fn,BakeError:()=>Re,BindTypeMismatchError:()=>dr,Canvas2DBackend:()=>Ze,Circle:()=>Fr,CircularDependencyError:()=>sr,ColdAssetError:()=>oe,ColorParseError:()=>gs,Custom:()=>Or,DEFAULT_EASE:()=>zn,DL_SNAPSHOT_VERSION:()=>Er,DeterminismViolationError:()=>Zr,DlSnapshotError:()=>_e,DuplicateNodeIdError:()=>ti,EachError:()=>Nt,FilterValidationError:()=>$t,FollowPath:()=>ri,FontValidationError:()=>ar,Group:()=>xt,GsPlayerElement:()=>mi,Highlight:()=>Kr,IDENTITY:()=>vt,Image:()=>Lr,ImageNode:()=>Lr,LayoutEngineMissingError:()=>on,MEASURE_QUANTUM_PX:()=>je,MESH_DOWNSCALE:()=>_o,MESH_SHEPARD_POWER:()=>jo,MESH_SIGMA:()=>un,NODE_TAXONOMY:()=>fo,Node:()=>G,Path:()=>rn,PositionError:()=>Rs,Raster2D:()=>pn,Rect:()=>zr,ReservedNodeIdError:()=>ei,ShaderEffect:()=>Ro,SidecarVersionError:()=>Os,SketchValidationError:()=>ft,TARGET_PATH:()=>Ut,TargetOverlapError:()=>fi,Text:()=>Ue,TextCursor:()=>Qr,TimelineValidationError:()=>Z,TokenHighlight:()=>ii,TokenMatchError:()=>le,TrackValidationError:()=>gt,UnboundTargetError:()=>fr,UnknownEasingError:()=>fs,UnknownValueTypeError:()=>ys,UnresolvableTargetError:()=>xe,ValueTypeInferenceError:()=>Es,Video:()=>Rr,WriteDuringEvaluationError:()=>Fe,applyToPoint:()=>Sr,arcLength:()=>Zs,assignKeyIds:()=>zs,audioOffsetSamples:()=>Hn,auditCacheCold:()=>$o,bake:()=>no,bakeCheckpointed:()=>ro,batch:()=>Gi,beginReadPhase:()=>nr,bindScene:()=>ni,bindTimeline:()=>Ws,booleanType:()=>Ms,breakLines:()=>ot,buildFontRegistry:()=>Zt,buildTimeline:()=>ur,clockDriver:()=>ui,collapseReplacer:()=>Lt,collectLocalizedTextUsages:()=>Lo,collectTextUsages:()=>oi,colorType:()=>vs,compileTimeline:()=>tt,computed:()=>Jt,createDisplayListBuilder:()=>ne,createPlayer:()=>di,createPlayhead:()=>Ve,createScene:()=>Io,cubicBezier:()=>hs,cubicBezierDerivative:()=>us,defineGsPlayer:()=>bi,deleteSidecarTrack:()=>Jn,diffDisplayLists:()=>Ys,drawOn:()=>Jr,drawOnEach:()=>So,each:()=>Mo,easingDerivatives:()=>ke,easings:()=>ls,emitDevWarning:()=>q,emptySidecar:()=>Kn,endReadPhase:()=>rr,estimatingMeasurer:()=>Us,evaluate:()=>ae,evaluateAt:()=>Bs,filtersToCanvasFilter:()=>He,flatten:()=>re,followPath:()=>Oo,fontString:()=>Je,formatColor:()=>Se,formatDisplayDiff:()=>Tr,fromTRS:()=>Hs,getLayoutEngine:()=>qr,getTimelineCallbacks:()=>eo,getValueType:()=>Ht,glow:()=>Cr,hachureLines:()=>en,hashKeys:()=>Oe,highlight:()=>po,inReadPhase:()=>Ui,inferValueType:()=>Ie,invert:()=>Mr,isDurationEditable:()=>Gn,isEditableNodeId:()=>Kt,isExemptFamily:()=>cr,key:()=>nt,lerpColor:()=>lt,matEquals:()=>kt,matchTokenRun:()=>hn,mediaPrefersReducedMotion:()=>gi,mergeSidecar:()=>Zn,mergeSidecarDetailed:()=>Fs,meshRasterSize:()=>ci,migrateSidecar:()=>Ds,motionPath:()=>ce,mount:()=>gn,multiply:()=>ee,namedEasing:()=>_t,normalizeEditedKeys:()=>tr,numberType:()=>ws,oklabToRgba:()=>At,paintType:()=>Ts,parseCmap:()=>Ae,parseColor:()=>ht,parseDisplaySnapshot:()=>$r,pathFromSegs:()=>Dr,pathLength:()=>Po,pathType:()=>Ss,planReducedMotion:()=>pi,pointAtLength:()=>Ao,quantize:()=>X,random:()=>it,rasterizeMesh:()=>ai,registerValueType:()=>rt,reprOf:()=>Te,requireLayoutEngine:()=>Wr,resolveAnchor:()=>Ks,resolveEase:()=>Is,resolveEaseDerivative:()=>$s,resolveSketch:()=>Js,resolveTweenTarget:()=>Pe,revealSchedule:()=>Nr,rgbaToOklab:()=>Tt,roughen:()=>Ge,roundedRectSegs:()=>Rt,sampleTrack:()=>Ce,scrollDriver:()=>Jo,segmentGraphemes:()=>bt,segmentWords:()=>Ye,serializeDisplayList:()=>Ir,setDefaultMeasurer:()=>Pr,setDevWarning:()=>Vn,setLayoutEngine:()=>Vr,setScheduler:()=>ji,setShaderRunner:()=>hi,setSidecarTrack:()=>Qn,signal:()=>$,sketchStrokes:()=>Ar,spring:()=>mt,springEasing:()=>ds,springEasingDerivative:()=>ps,springPresets:()=>Rn,springTo:()=>Wn,stagger:()=>$e,stringType:()=>xs,swapOnHmr:()=>Zo,synchronousScheduler:()=>Ns,targetNodeId:()=>Ot,textCursor:()=>go,timeline:()=>so,tokenHighlight:()=>Do,track:()=>Gt,typewriter:()=>wo,untracked:()=>Ki,validateFilters:()=>Gs,validateFonts:()=>qs,validateHachure:()=>tn,validateSceneFonts:()=>dn,validateSketch:()=>Qs,validateTrack:()=>Yt,vec2ArcType:()=>ks,vec2Equals:()=>Ee,vec2Signal:()=>zt,vec2Type:()=>bs,velocityAt:()=>Cs,withDeterminismGuards:()=>Eo});var we=2.5949095,be=2.70158,Pt=2*Math.PI/3,Bt=2*Math.PI/4.5;function ge(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}var ls={linear:t=>t,easeInQuad:t=>t*t,easeOutQuad:t=>1-(1-t)*(1-t),easeInOutQuad:t=>t<.5?2*t*t:1-(-2*t+2)**2/2,easeInCubic:t=>t**3,easeOutCubic:t=>1-(1-t)**3,easeInOutCubic:t=>t<.5?4*t**3:1-(-2*t+2)**3/2,easeInQuart:t=>t**4,easeOutQuart:t=>1-(1-t)**4,easeInOutQuart:t=>t<.5?8*t**4:1-(-2*t+2)**4/2,easeInQuint:t=>t**5,easeOutQuint:t=>1-(1-t)**5,easeInOutQuint:t=>t<.5?16*t**5:1-(-2*t+2)**5/2,easeInSine:t=>1-Math.cos(t*Math.PI/2),easeOutSine:t=>Math.sin(t*Math.PI/2),easeInOutSine:t=>-(Math.cos(Math.PI*t)-1)/2,easeInExpo:t=>t===0?0:2**(10*t-10),easeOutExpo:t=>t===1?1:1-2**(-10*t),easeInOutExpo:t=>t===0?0:t===1?1:t<.5?2**(20*t-10)/2:(2-2**(-20*t+10))/2,easeInCirc:t=>1-Math.sqrt(1-t*t),easeOutCirc:t=>Math.sqrt(1-(t-1)*(t-1)),easeInOutCirc:t=>t<.5?(1-Math.sqrt(1-(2*t)**2))/2:(Math.sqrt(1-(-2*t+2)**2)+1)/2,easeInBack:t=>be*t**3-1.70158*t*t,easeOutBack:t=>1+be*(t-1)**3+1.70158*(t-1)**2,easeInOutBack:t=>t<.5?(2*t)**2*(3.5949095*2*t-we)/2:((2*t-2)**2*(3.5949095*(t*2-2)+we)+2)/2,easeInElastic:t=>t===0?0:t===1?1:-(2**(10*t-10))*Math.sin((t*10-10.75)*Pt),easeOutElastic:t=>t===0?0:t===1?1:2**(-10*t)*Math.sin((t*10-.75)*Pt)+1,easeInOutElastic:t=>t===0?0:t===1?1:t<.5?-(2**(20*t-10)*Math.sin((20*t-11.125)*Bt))/2:2**(-20*t+10)*Math.sin((20*t-11.125)*Bt)/2+1,easeInBounce:t=>1-ge(1-t),easeOutBounce:ge,easeInOutBounce:t=>t<.5?(1-ge(1-2*t))/2:(1+ge(2*t-1))/2};function me(t){return t<1/2.75?2*7.5625*t:t<2/2.75?2*7.5625*(t-1.5/2.75):t<2.5/2.75?2*7.5625*(t-2.25/2.75):2*7.5625*(t-2.625/2.75)}var pt=Math.LN2,ke={linear:()=>1,easeInQuad:t=>2*t,easeOutQuad:t=>2*(1-t),easeInOutQuad:t=>t<.5?4*t:4*(1-t),easeInCubic:t=>3*t**2,easeOutCubic:t=>3*(1-t)**2,easeInOutCubic:t=>t<.5?12*t**2:12*(1-t)**2,easeInQuart:t=>4*t**3,easeOutQuart:t=>4*(1-t)**3,easeInOutQuart:t=>t<.5?32*t**3:32*(1-t)**3,easeInQuint:t=>5*t**4,easeOutQuint:t=>5*(1-t)**4,easeInOutQuint:t=>t<.5?80*t**4:80*(1-t)**4,easeInSine:t=>Math.PI/2*Math.sin(t*Math.PI/2),easeOutSine:t=>Math.PI/2*Math.cos(t*Math.PI/2),easeInOutSine:t=>Math.PI/2*Math.sin(Math.PI*t),easeInExpo:t=>t===0?0:10*pt*2**(10*t-10),easeOutExpo:t=>t===1?0:10*pt*2**(-10*t),easeInOutExpo:t=>t===0||t===1?0:t<.5?10*pt*2**(20*t-10):10*pt*2**(-20*t+10),easeInCirc:t=>t/Math.sqrt(1-t*t),easeOutCirc:t=>(1-t)/Math.sqrt(1-(t-1)*(t-1)),easeInOutCirc:t=>t<.5?2*t/Math.sqrt(1-4*t*t):(2-2*t)/Math.sqrt(1-(-2*t+2)**2),easeInBack:t=>3*be*t**2-2*1.70158*t,easeOutBack:t=>3*be*(t-1)**2+2*1.70158*(t-1),easeInOutBack:t=>t<.5?12*3.5949095*t**2-4*we*t:3*3.5949095*(2*t-2)**2+2*we*(2*t-2),easeInElastic:t=>{if(t===0||t===1)return 0;let e=(t*10-10.75)*Pt,s=2**(10*t-10);return-(10*pt*s*Math.sin(e)+s*10*Pt*Math.cos(e))},easeOutElastic:t=>{if(t===0||t===1)return 0;let e=(t*10-.75)*Pt,s=2**(-10*t);return-10*pt*s*Math.sin(e)+s*10*Pt*Math.cos(e)},easeInOutElastic:t=>{if(t===0||t===1)return 0;let e=(20*t-11.125)*Bt;if(t<.5){let n=2**(20*t-10);return-(20*pt*n*Math.sin(e)+n*20*Bt*Math.cos(e))/2}let s=2**(-20*t+10);return(-20*pt*s*Math.sin(e)+s*20*Bt*Math.cos(e))/2},easeInBounce:t=>me(1-t),easeOutBounce:me,easeInOutBounce:t=>t<.5?me(1-2*t):me(2*t-1)},zn="easeInOutCubic";function Fn(t,e,s,n){let r=3*t-3*s+1,i=3*s-6*t,o=3*t,a=3*e-3*n+1,h=3*n-6*e,c=3*e,l=p=>((r*p+i)*p+o)*p,u=p=>((a*p+h)*p+c)*p,f=p=>(3*r*p+2*i)*p+o;return{sampleY:u,sampleDX:f,sampleDY:p=>(3*a*p+2*h)*p+c,solveU:p=>{let v=p;for(let g=0;g<8;g++){let b=l(v)-p;if(Math.abs(b)<1e-7)return v;let T=f(v);if(Math.abs(T)<1e-6)break;v-=b/T}let k=0,m=1;for(v=p;m-k>1e-7;)l(v)<p?k=v:m=v,v=(k+m)/2;return v}}}function hs(t,e,s,n){let r=Fn(t,e,s,n);return i=>i<=0?0:i>=1?1:r.sampleY(r.solveU(i))}function us(t,e,s,n){let r=Fn(t,e,s,n);return i=>{let o=r.solveU(Math.min(1,Math.max(0,i))),a=r.sampleDX(o);return Math.abs(a)<1e-9?0:r.sampleDY(o)/a}}var fs=class extends Error{constructor(t){super(`unknown easing '${t}'; register it via easings or use cubicBezier/spring`),this.name="UnknownEasingError"}};function _t(t){let e=ls[t];if(!e)throw new fs(t);return e}var Ii=.005;function Xt(t){var s;let e=(s=t.mass)!=null?s:1;if(!(t.stiffness>0)||!(t.damping>0)||!(e>0))throw new RangeError("spring stiffness, damping, and mass must all be > 0");return{w0:Math.sqrt(t.stiffness/e),zeta:t.damping/(2*Math.sqrt(t.stiffness*e))}}function $i(t,e){if(e<=0)return 0;let{w0:s,zeta:n}=Xt(t);if(Math.abs(n-1)<1e-9)return s*s*e*Math.exp(-s*e);if(n<1){let a=s*Math.sqrt(1-n*n);return Math.exp(-n*s*e)*(s*s/a)*Math.sin(a*e)}let r=Math.sqrt(n*n-1),i=-s*(n-r),o=-s*(n+r);return i*o*(Math.exp(i*e)-Math.exp(o*e))/(i-o)}function jt(t,e){if(e<=0)return 0;let{w0:s,zeta:n}=Xt(t);if(Math.abs(n-1)<1e-9)return 1-Math.exp(-s*e)*(1+s*e);if(n<1){let a=s*Math.sqrt(1-n*n);return 1-Math.exp(-n*s*e)*(Math.cos(a*e)+n*s/a*Math.sin(a*e))}let r=Math.sqrt(n*n-1),i=-s*(n-r),o=-s*(n+r);return 1+(o*Math.exp(i*e)-i*Math.exp(o*e))/(i-o)}function Me(t,e){var a;let s=(a=e==null?void 0:e.settleTolerance)!=null?a:Ii,{w0:n,zeta:r}=Xt(t);if(r<1){let h=n*Math.sqrt(1-r*r),c=Math.sqrt(1+(r*n/h)**2);return Math.log(c/s)/(r*n)}let i=1/n;for(;1-jt(t,i)>s;)i*=2;let o=0;for(let h=0;h<64&&i-o>1e-9;h++){let c=(o+i)/2;1-jt(t,c)>s?o=c:i=c}return i}function Ln(t,e,s){let n=Me(t,s);return jt(t,Math.min(e,n))/jt(t,n)}function Ci(t,e,s){let{w0:n,zeta:r}=Xt(t),i,o,a;if(Math.abs(r-1)<1e-9){let c=s+n*e;i=l=>l<=0?e:Math.exp(-n*l)*(e+c*l),o=l=>l<=0?s:Math.exp(-n*l)*(s-n*c*l),a=l=>Math.exp(-n*l)*(Math.abs(e)+Math.abs(c)*l)}else if(r<1){let c=n*Math.sqrt(1-r*r),l=(s+r*n*e)/c,u=Math.hypot(e,l);i=f=>f<=0?e:Math.exp(-r*n*f)*(e*Math.cos(c*f)+l*Math.sin(c*f)),o=f=>f<=0?s:Math.exp(-r*n*f)*(s*Math.cos(c*f)-(n*n*e+r*n*s)/c*Math.sin(c*f)),a=f=>Math.exp(-r*n*f)*u}else{let c=Math.sqrt(r*r-1),l=n*(-r+c),u=n*(-r-c),f=(s-u*e)/(l-u),d=(l*e-s)/(l-u);i=y=>y<=0?e:f*Math.exp(l*y)+d*Math.exp(u*y),o=y=>y<=0?s:f*l*Math.exp(l*y)+d*u*Math.exp(u*y),a=y=>Math.abs(f)*Math.exp(l*y)+Math.abs(d)*Math.exp(u*y)}return{value:i,velocity:o,settleTime:c=>{let l=c!=null?c:Math.abs(e)*.005+1e-6;if(a(0)<=l&&Math.abs(s)<1e-12)return 0;let u=1/n,f=0;for(;a(u)>l&&f++<64;)u*=2;let d=0;for(let y=0;y<64&&u-d>1e-9;y++){let p=(d+u)/2;Math.max(a(p),a(p*1.05+1e-6))>l?d=p:u=p}return u}}}var mt=Object.assign(t=>{var e;return Xt(t),{kind:"spring",stiffness:t.stiffness,damping:t.damping,mass:(e=t.mass)!=null?e:1}},{duration:Me,value:Ln,retarget:Ci}),Rn={default:{stiffness:170,damping:26},gentle:{stiffness:120,damping:14},wobbly:{stiffness:180,damping:12},stiff:{stiffness:210,damping:20},slow:{stiffness:280,damping:60},molasses:{stiffness:280,damping:120}};function ds(t){let e=Me(t);return s=>Ln(t,s*e)}function ps(t){let e=Me(t),s=e/jt(t,e);return n=>n>=1?0:$i(t,n*e)*s}var Nn=t=>{var e;(e=globalThis.console)==null||e.warn(`[glissade] ${t}`)};function Vn(t){Nn=t}function q(t){Nn(t)}var Pi=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Ai=/^rgba?\(\s*([\d.]+)\s*[, ]\s*([\d.]+)\s*[, ]\s*([\d.]+)\s*(?:[,/]\s*([\d.]+%?)\s*)?\)$/i,gs=class extends Error{constructor(t){super(`cannot parse color '${t}' (supported: #rgb[a], #rrggbb[aa], rgb()/rgba())`),this.name="ColorParseError"}};function ht(t){let e=Pi.exec(t);if(e){let n=e[1];n.length<=4&&(n=[...n].map(i=>i+i).join(""));let r=parseInt(n,16);return n.length===6?{r:r>>16,g:r>>8&255,b:r&255,a:1}:{r:r>>>24&255,g:r>>>16&255,b:r>>>8&255,a:(r&255)/255}}let s=Ai.exec(t);if(s){let n=s[4],r=n===void 0?1:n.endsWith("%")?parseFloat(n)/100:parseFloat(n);return{r:parseFloat(s[1]),g:parseFloat(s[2]),b:parseFloat(s[3]),a:r}}throw new gs(t)}function Se(t){let e=i=>Math.min(255,Math.max(0,Math.round(i))),s=i=>e(i).toString(16).padStart(2,"0"),n=`#${s(t.r)}${s(t.g)}${s(t.b)}`,r=Math.min(1,Math.max(0,t.a));return r>=1?n:`${n}${s(r*255)}`}function os(t){let e=t/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function as(t){return(t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055)*255}function Tt(t){let e=os(t.r),s=os(t.g),n=os(t.b),r=Math.cbrt(.4122214708*e+.5363325363*s+.0514459929*n),i=Math.cbrt(.2119034982*e+.6806995451*s+.1073969566*n),o=Math.cbrt(.0883024619*e+.2817188376*s+.6299787005*n);return{L:.2104542553*r+.793617785*i-.0040720468*o,a:1.9779984951*r-2.428592205*i+.4505937099*o,b:.0259040371*r+.7827717662*i-.808675766*o,alpha:t.a}}function At(t){let e=(t.L+.3963377774*t.a+.2158037573*t.b)**3,s=(t.L-.1055613458*t.a-.0638541728*t.b)**3,n=(t.L-.0894841775*t.a-1.291485548*t.b)**3;return{r:as(4.0767416621*e-3.3077115913*s+.2309699292*n),g:as(-1.2684380046*e+2.6097574011*s-.3413193965*n),b:as(-.0041960863*e-.7034186147*s+1.707614701*n),a:t.alpha}}function lt(t,e,s){let n=Tt(ht(t)),r=Tt(ht(e)),i=(o,a)=>o+(a-o)*s;return Se(At({L:i(n.L,r.L),a:i(n.a,r.a),b:i(n.b,r.b),alpha:i(n.alpha,r.alpha)}))}var ms=new Map;function rt(t){ms.set(t.id,t)}var ys=class extends Error{constructor(t){super(`unknown value type '${t}'; register it via registerValueType()`),this.name="UnknownValueTypeError"}};function Ht(t){let e=ms.get(t);if(!e)throw new ys(t);return e}function Te(t){var e,s;return(s=(e=ms.get(t))==null?void 0:e.repr)!=null?s:t}var ws={id:"number",lerp:(t,e,s)=>t+(e-t)*s,extrapolates:!0,equals:Object.is,add:(t,e)=>t+e,sub:(t,e)=>t-e,scale:(t,e)=>t*e,defaultHandoff:"spring"},Ee=(t,e)=>t[0]===e[0]&&t[1]===e[1],bs={id:"vec2",lerp:(t,e,s)=>[t[0]+(e[0]-t[0])*s,t[1]+(e[1]-t[1])*s],extrapolates:!0,equals:Ee,add:(t,e)=>[t[0]+e[0],t[1]+e[1]],sub:(t,e)=>[t[0]-e[0],t[1]-e[1]],scale:(t,e)=>[t[0]*e,t[1]*e],defaultHandoff:"spring"},ks={id:"vec2-arc",repr:"vec2",lerp:(t,e,s)=>{let n=Math.hypot(t[0],t[1]),r=Math.hypot(e[0],e[1]),i=Math.atan2(t[1],t[0]),o=Math.atan2(e[1],e[0])-i;for(;o>Math.PI;)o-=2*Math.PI;for(;o<-Math.PI;)o+=2*Math.PI;let a=n+(r-n)*s,h=i+o*s;return[a*Math.cos(h),a*Math.sin(h)]},extrapolates:!0,equals:Ee,defaultHandoff:"blend-from-frozen"},vs={id:"color",lerp:lt,extrapolates:!0,equals:(t,e)=>t===e,defaultHandoff:"blend-from-frozen"};function qn(t){return{id:t,lerp:(e,s,n)=>n>=1?s:e,extrapolates:!1,equals:(e,s)=>Object.is(e,s),defaultHandoff:"cut"}}var xs=qn("string"),Ms=qn("boolean"),cs=(t,e,s)=>[t[0]+(e[0]-t[0])*s,t[1]+(e[1]-t[1])*s];function In(t,e){if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++){let n=t[s],r=e[s];if(n.closed!==r.closed||n.v.length!==r.v.length)return!1}return!0}var $n=!1,Ss={id:"path",lerp:(t,e,s)=>In(t,e)?t.map((n,r)=>{let i=e[r];return{closed:n.closed,v:n.v.map((o,a)=>cs(o,i.v[a],s)),in:n.in.map((o,a)=>cs(o,i.in[a],s)),out:n.out.map((o,a)=>cs(o,i.out[a],s))}}):($n||($n=!0,q("path lerp with mismatched topology (contour/vertex counts or closed flags differ): snapping instead of morphing \u2014 supply matched vertex counts (\xA72.2)")),s>=1?e:t),extrapolates:!1,equals:(t,e)=>{if(t===e)return!0;if(!In(t,e))return!1;let s=(n,r)=>n[0]===r[0]&&n[1]===r[1];return t.every((n,r)=>{let i=e[r];return n.v.every((o,a)=>s(o,i.v[a]))&&n.in.every((o,a)=>s(o,i.in[a]))&&n.out.every((o,a)=>s(o,i.out[a]))})},defaultHandoff:"blend-from-frozen"},ve=(t,e,s)=>t+(e-t)*s,ye=(t,e,s)=>[ve(t[0],e[0],s),ve(t[1],e[1],s)];function Cn(t){try{return Se(D(E({},ht(t)),{a:0}))}catch(e){return t}}function Oi(t,e,s){try{return lt(t,e,s)}catch(n){return s>=1?e:t}}function Pn(t,e){let s=e.stops.map(r=>({offset:r.offset,color:t})),n=e.interpolation?{interpolation:e.interpolation}:{};return e.kind==="radial"?E(E(E({kind:"radial",stops:s},e.center?{center:e.center}:{}),e.radius!==void 0?{radius:e.radius}:{}),n):E(E(E({kind:"linear",stops:s},e.from?{from:e.from}:{}),e.to?{to:e.to}:{}),n)}var An=!1;function Wt(t,e,s,n="paint lerp across mismatched gradient shapes (different kind or stop count): snapping instead of interpolating \u2014 match the kind + stop count on both keyframes (\xA72.2)"){return An||(An=!0,q(n)),t>=1?s:e}var Di=(t,e)=>t.length===e.length&&t.every((s,n)=>s.offset===e[n].offset&&s.color===e[n].color),Ts={id:"paint",lerp:(t,e,s)=>{var a,h,c,l;if(t.kind==="color"&&e.kind==="color")return{kind:"color",color:lt(t.color,e.color,s)};if(t.kind==="mesh"&&e.kind==="mesh"){if(t.points.length!==e.points.length)return Wt(s,t,e);if(t.interpolation!==e.interpolation)return Wt(s,t,e,`paint lerp across mismatched mesh interpolation modes ('${(a=t.interpolation)!=null?a:"smooth"}' \u2192 '${(h=e.interpolation)!=null?h:"smooth"}'): snapping instead of interpolating \u2014 the blend kernel is discrete, so it switches once at the boundary; match \`interpolation\` on both keyframes to morph the points (\xA73 Paint)`);let u=t.points.map((d,y)=>{let p=e.points[y];return{pos:ye(d.pos,p.pos,s),color:lt(d.color,p.color,s)}}),f=t.bg!==void 0||e.bg!==void 0?{bg:Oi((c=t.bg)!=null?c:Cn(e.bg),(l=e.bg)!=null?l:Cn(t.bg),s)}:{};return E(E({kind:"mesh",points:u},t.interpolation?{interpolation:t.interpolation}:{}),f)}if(t.kind==="mesh"||e.kind==="mesh")return Wt(s,t,e);let n=t,r=e;if(n.kind==="color"&&r.kind!=="color"?n=Pn(n.color,r):r.kind==="color"&&n.kind!=="color"&&(r=Pn(r.color,n)),n.kind==="color"||r.kind==="color"||n.kind!==r.kind||n.stops.length!==r.stops.length)return Wt(s,t,e);let i=n.stops.map((u,f)=>({offset:ve(u.offset,r.stops[f].offset,s),color:lt(u.color,r.stops[f].color,s)})),o=n.interpolation?{interpolation:n.interpolation}:{};return n.kind==="radial"&&r.kind==="radial"?E(E(E({kind:"radial",stops:i},n.center&&r.center?{center:ye(n.center,r.center,s)}:n.center?{center:n.center}:{}),n.radius!==void 0&&r.radius!==void 0?{radius:ve(n.radius,r.radius,s)}:n.radius!==void 0?{radius:n.radius}:{}),o):n.kind==="linear"&&r.kind==="linear"?E(E(E({kind:"linear",stops:i},n.from&&r.from?{from:ye(n.from,r.from,s)}:n.from?{from:n.from}:{}),n.to&&r.to?{to:ye(n.to,r.to,s)}:n.to?{to:n.to}:{}),o):Wt(s,t,e)},extrapolates:!1,equals:(t,e)=>t===e?!0:t.kind!==e.kind?!1:t.kind==="color"?e.kind==="color"&&t.color===e.color:t.kind==="mesh"?e.kind!=="mesh"||t.interpolation!==e.interpolation||t.bg!==e.bg||t.points.length!==e.points.length?!1:t.points.every((s,n)=>{let r=e.points[n];return s.color===r.color&&s.pos[0]===r.pos[0]&&s.pos[1]===r.pos[1]}):e.kind==="color"||e.kind==="mesh"||!Di(t.stops,e.stops)||t.interpolation!==e.interpolation?!1:t.kind==="radial"&&e.kind==="radial"?JSON.stringify(t.center)===JSON.stringify(e.center)&&t.radius===e.radius:t.kind==="linear"&&e.kind==="linear"?JSON.stringify(t.from)===JSON.stringify(e.from)&&JSON.stringify(t.to)===JSON.stringify(e.to):!1,defaultHandoff:"blend-from-frozen"},Es=class extends Error{constructor(t){super(`cannot infer a value type for ${JSON.stringify(t)}; register a custom type`),this.name="ValueTypeInferenceError"}},zi=t=>typeof t=="object"&&t!==null&&typeof t.closed=="boolean"&&Array.isArray(t.v)&&Array.isArray(t.in)&&Array.isArray(t.out),Fi=t=>typeof t=="object"&&t!==null&&(t.kind==="color"||t.kind==="linear"||t.kind==="radial"||t.kind==="mesh");function Ie(t){if(typeof t=="number")return"number";if(typeof t=="boolean")return"boolean";if(Fi(t))return"paint";if(Array.isArray(t)&&t.length===2&&t.every(e=>typeof e=="number"))return"vec2";if(Array.isArray(t)&&t.length>0&&t.every(zi))return"path";if(typeof t=="string")try{return ht(t),"color"}catch(e){return"string"}throw new Es(t)}rt(ws);rt(bs);rt(ks);rt(vs);rt(xs);rt(Ms);rt(Ss);rt(Ts);var gt=class extends Error{constructor(t,e){super(`track '${t}': ${e}`),this.name="TrackValidationError"}};function Yt(t){let e=Ht(t.type);if(t.keys.length===0)throw new gt(t.target,"must have at least one key");if(e.defaultHandoff==="cut")for(let s of t.keys)s.interp!=="hold"&&(s.interp="hold");for(let s=1;s<t.keys.length;s++){let n=t.keys[s-1],r=t.keys[s];if(r.t<=n.t)throw new gt(t.target,`keys must be strictly increasing in t (key[${s}] at t=${r.t} after t=${n.t})`)}if(!/^[^/]+\/.+$/.test(t.target))throw new gt(t.target,"target must be '<nodeId>/<prop.path>' (e.g. 'circle/opacity')")}function nt(t,e,s){if(s===void 0)return{t,value:e};if(typeof s=="string"||"kind"in s)return{t,value:e,ease:s};let n=s,r={t,value:e};return n.ease!==void 0&&(r.ease=n.ease),n.interp!==void 0&&(r.interp=n.interp),n.id!==void 0&&(r.id=n.id),n.derived!==void 0&&(r.derived=n.derived),r}function Wn(t,e,s,n){let r=mt.duration(n);if(t-r<0)throw new gt("springTo",`this spring needs ${r.toFixed(3)}s to settle \u2014 endT must be \u2265 its duration (got ${t})`);return[nt(t-r,e),nt(t,s,mt(n))]}function $e(t,e){let s=typeof e=="function"?e:n=>n*e;return t.map((n,r)=>{let i=s(r);return D(E({},n),{keys:n.keys.map(o=>D(E({},o),{t:o.t+i}))})})}function Gt(t,e,s,n){let r={target:t,type:e,keys:s};return(n==null?void 0:n.editable)!==void 0&&(r.editable=n.editable),Yt(r),r}function Is(t){return t===void 0?_t("linear"):typeof t=="string"?_t(t):t.kind==="cubicBezier"?hs(...t.pts):ds(t)}var On=new Set;function $s(t){if(t===void 0)return ke.linear;if(typeof t=="string"){let e=ke[t];if(e)return e;let s=_t(t);On.has(t)||(On.add(t),q(`easing '${t}' has no registered derivative; velocity uses a numeric fallback \u2014 register one in easingDerivatives for exact interruption handoff`));let n=1/1024;return r=>(s(Math.min(1,r+n))-s(Math.max(0,r-n)))/(Math.min(1,r+n)-Math.max(0,r-n))}return t.kind==="cubicBezier"?us(...t.pts):ps(t)}var Dn=new WeakMap;function Bn(t){let e=Dn.get(t);return e||(e={cursor:1,easeCache:new Array(t.keys.length)},Dn.set(t,e)),e}function _n(t,e,s){let n=e.easeCache[s];return n||(n=Is(t.keys[s].ease),e.easeCache[s]=n),n}function jn(t,e,s){let n=t.length;for(let o=Math.max(1,s-1);o<=Math.min(n-1,s+1);o++)if(t[o-1].t<=e&&e<t[o].t)return o;if(e<t[0].t)return 0;if(e>=t[n-1].t)return n;let r=1,i=n-1;for(;r<i;){let o=r+i>>1;t[o].t<=e?r=o+1:i=o}return r}function Cs(t,e){let s=Ht(t.type);if(!s.sub||!s.scale)return null;let n=t.keys,r=n.length,i=Bn(t),o=jn(n,e,i.cursor),a=s.scale(s.sub(n[0].value,n[0].value),0);if(o===0||o>=r)return a;let h=n[o];if(h.interp==="hold")return a;let c=n[o-1],l=h.t-c.t,u=(e-c.t)/l;if(!s.extrapolates){let d=_n(t,i,o)(u);if(d<0||d>1)return a}let f=$s(h.ease)(u);return s.scale(s.sub(h.value,c.value),f/l)}function Ce(t,e){let s=t.keys,n=s.length,r=Bn(t),i=jn(s,e,r.cursor);if(i===0)return s[0].value;if(i>=n)return s[n-1].value;r.cursor=i;let o=s[i],a=s[i-1];if(o.interp==="hold")return a.value;let h=Ht(t.type),c=(e-a.t)/(o.t-a.t),l=_n(t,r,i)(c);return!h.extrapolates&&(l<0||l>1)&&(r.warnedClamp||(r.warnedClamp=!0,q(`track '${t.target}' (type '${t.type}') clamped an out-of-range eased value \u2014 non-extrapolating types can't overshoot, so a spring/overshooting ease on this track is flattened`)),l=Math.min(1,Math.max(0,l))),h.lerp(a.value,o.value,l)}var Ut=Symbol.for("glissade.targetPath"),xe=class extends Error{constructor(t){super(t!=null?t:'tween target is not addressable: pass a target string ("node/prop") or a property signal of a node that has an explicit id (\xA73.1 \u2014 anonymous nodes cannot be track targets)'),this.name="UnresolvableTargetError"}};function Ot(t){let e=t.indexOf("/");return e<0?t:t.slice(0,e)}function Kt(t){return typeof t=="string"&&t.length>0&&t!=="__root"&&!t.startsWith("~")}function Pe(t){let e=typeof t=="string"?t:t[Ut];if(typeof e!="string")throw new xe;if(Ot(e).startsWith("~"))throw new xe(`'${e}': structural ids (~Type.ordinal) are inspection-only and cannot be track targets (\xA76.5) \u2014 give the node an explicit id`);return e}function J(t,e){return e+2<=t.byteLength?t.getUint16(e):0}function ut(t,e){return e+4<=t.byteLength?t.getUint32(e):0}function Li(t,e){return t===3&&e===10||t===0&&e>=4?5:t===3&&e===1||t===0?3:0}function Ri(t,e,s){let n=J(t,e+6),r=n>>1,i=e+14,o=i+n+2,a=o+n,h=a+n;for(let c=0;c<r;c++){let l=J(t,i+c*2),u=J(t,o+c*2);if(u>l)continue;let f=J(t,a+c*2),d=J(t,h+c*2);for(let y=u;y<=l;y++){if(y===65535)continue;let p;if(d===0)p=y+f&65535;else{let v=J(t,h+c*2+d+(y-u)*2);p=v===0?0:v+f&65535}p!==0&&s.add(y)}}}function Ni(t,e,s){let n=ut(t,e+12),r=Math.max(0,Math.floor((t.byteLength-(e+16))/12)),i=Math.min(n,r),o=e+16;for(let a=0;a<i;a++,o+=12){let h=ut(t,o),c=ut(t,o+4),l=ut(t,o+8);if(!(h>c)&&!(c-h>2097152))for(let u=h;u<=c;u++)l+(u-h)!==0&&s.add(u)}}function Ae(t){let e=new Set;try{let s=ArrayBuffer.isView(t)?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(t);if(s.byteLength<12)return e;let n=0;ut(s,0)===1953784678&&(n=ut(s,12));let r=J(s,n+4),i=0;for(let l=0;l<r;l++){let u=n+12+l*16;if(ut(s,u)===1668112752){i=ut(s,u+8);break}}if(i===0)return e;let o=J(s,i+2),a=0,h=-1;for(let l=0;l<o;l++){let u=i+4+l*8,f=J(s,u),d=J(s,u+2),y=i+ut(s,u+4),p=Li(f,d);p>h&&y+2<=s.byteLength&&(h=p,a=y)}if(h<0)return e;let c=J(s,a);c===4?Ri(s,a,e):c===12&&Ni(s,a,e)}catch(s){return e}return e}function Ps(t){var s;let e={version:1,tracks:(s=t.tracks)!=null?s:[]};return t.duration!==void 0&&(e.duration=t.duration),t.editableDuration!==void 0&&(e.editableDuration=t.editableDuration),t.fps!==void 0&&(e.fps=t.fps),t.posterTime!==void 0&&(e.posterTime=t.posterTime),t.labels!==void 0&&(e.labels=t.labels),t.markers!==void 0&&(e.markers=t.markers),t.children!==void 0&&(e.children=t.children),t.audio!==void 0&&(e.audio=t.audio),t.assets!==void 0&&(e.assets=t.assets),e}var Z=class extends Error{constructor(t){super(t),this.name="TimelineValidationError"}};function Vi(t){for(let e=1;e<t.keys.length;e++){let s=t.keys[e];if(s.ease&&typeof s.ease=="object"&&s.ease.kind==="spring"){let n=t.keys[e-1].t+mt.duration(s.ease);if(Math.abs(s.t-n)>1e-6)throw new Z(`track '${t.target}': spring-eased key at t=${s.t} must sit at prev.t + spring.duration (${n.toFixed(6)}); the builder computes this automatically`)}}}function Hn(t,e=48e3){return Math.round(t*e)}function qi(t,e,s){return t.map(n=>D(E({},n),{t:e+n.t/s}))}function Yn(t,e,s,n,r,i){var o,a;for(let h of t.tracks)Yt(h),Vi(h),r.push({track:D(E({},h),{keys:qi(h.keys,e,s)}),unit:n});for(let h of(o=t.children)!=null?o:[]){let c=h.mode==="sync"&&(a=h.timeScale)!=null?a:1;if(h.mode==="add"&&h.timeScale!==void 0)throw new Z("timeScale is only valid on mode:'sync' children (\xA72.3)");if(c<=0)throw new Z("sync timeScale must be > 0");let l=h.mode==="sync"?++i.n:n;Yn(h.timeline,e+h.at/s,s*c,l,r,i)}}function Wi(t){let e=new Map;for(let{track:n,unit:r}of t){let i=e.get(n.target);if(!i){e.set(n.target,{track:D(E({},n),{keys:[...n.keys]}),unit:r});continue}if(i.unit!==r)throw new Z(`target '${n.target}' is animated by a sync (opaque) child and another timeline unit; sync children must own disjoint targets (no last-writer-wins across the sync boundary, \xA72.3)`);if(i.track.type!==n.type)throw new Z(`target '${n.target}' has conflicting value types '${i.track.type}' and '${n.type}'`);let o=n.keys[0].t,a=n.keys[n.keys.length-1].t,h=i.track.keys[0].t,c=i.track.keys[i.track.keys.length-1].t,l=i.track.keys.filter(u=>u.t<o||u.t>a);h<=a&&o<=c&&q(`overlapping tracks for '${n.target}' in [${o}, ${a}]: later insertion wins (${i.track.keys.length-l.length} earlier key(s) dropped)`),i.track.keys=[...l,...n.keys].sort((u,f)=>u.t-f.t)}let s=new Map;for(let[n,{track:r}]of e)s.set(n,r);return s}function Gn(t){return t.editableDuration===!0}function Bi(t){var s;let e=t.mode==="sync"&&(s=t.timeScale)!=null?s:1;return t.at+Un(t.timeline)/e}function Un(t){var s,n;if(t.duration!==void 0)return t.duration;let e=0;for(let r of t.tracks){let i=r.keys[r.keys.length-1];i&&(e=Math.max(e,i.t))}for(let r of(s=t.markers)!=null?s:[])e=Math.max(e,r.t);for(let r of(n=t.children)!=null?n:[])e=Math.max(e,Bi(r));return e}function tt(t){var a,h;if(t.version!==1)throw new Z(`unsupported timeline document version ${String(t.version)}`);let e=[];Yn(t,0,1,0,e,{n:0});let s=Wi(e),n=E({},t.labels),r=[...(a=t.markers)!=null?a:[]],i=[...(h=t.audio)!=null?h:[]],o=(c,l,u)=>{var f,d,y,p,v;for(let k of c!=null?c:[]){let m=l+k.at/u,g=u*(k.mode==="sync"&&(f=k.timeScale)!=null?f:1);for(let[b,T]of Object.entries((d=k.timeline.labels)!=null?d:{}))b in n||(n[b]=m+T/g);for(let b of(y=k.timeline.markers)!=null?y:[])r.push(D(E({},b),{t:m+b.t/g}));for(let b of(p=k.timeline.audio)!=null?p:[])i.push(E(D(E({},b),{at:m+b.at/g}),g!==1?{playbackRate:((v=b.playbackRate)!=null?v:1)*g}:{}));o(k.timeline.children,m,g)}};return o(t.children,0,1),r.sort((c,l)=>c.t-l.t),i.sort((c,l)=>c.at-l.at),{duration:Un(t),labels:n,markers:r,tracks:s,audio:i}}var As="main",Os=class extends Error{constructor(t){super(`unsupported sidecar version ${String(t)}; this build reads sidecarVersion 1 or 2`),this.name="SidecarVersionError"}};function Kn(){return{sidecarVersion:2,timelines:{[As]:{tracks:{}}}}}function Ds(t){if(!t)return null;if(t.sidecarVersion===2)return t;if(t.sidecarVersion===1){let e={};for(let n of t.tracks)e[n.target]={type:n.type,baseHash:null,keys:n.keys};let s={tracks:e};return t.labels&&(s.labels=t.labels),{sidecarVersion:2,timelines:{[As]:s}}}throw new Os(t.sidecarVersion)}function Oe(t){let e=JSON.stringify(t.map(n=>{var r,i;return[n.t,n.value,(r=n.ease)!=null?r:null,(i=n.interp)!=null?i:null]})),s=2166136261;for(let n=0;n<e.length;n++)s^=e.charCodeAt(n),s=Math.imul(s,16777619);return(s>>>0).toString(16)}function zs(t){let e=-1;for(let s of t){let n=s.id?/^k(\d+)$/.exec(s.id):null;n&&(e=Math.max(e,Number(n[1])))}return t.map(s=>s.id?E({},s):D(E({},s),{id:`k${++e}`}))}function Qn(t,e,s,n,r,i){var h;if(!Kt(Ot(s)))throw new gt(s,"structural/un-id'd nodes cannot host editor tracks (\xA76.5) \u2014 only nodes with an explicit id");let o=(h=t.timelines[e])!=null?h:{tracks:{}},a={type:n,baseHash:i?Oe(i):null,keys:zs(r)};return D(E({},t),{timelines:D(E({},t.timelines),{[e]:D(E({},o),{tracks:D(E({},o.tracks),{[s]:a})})})})}function Jn(t,e,s){let n=t.timelines[e];if(!n||!(s in n.tracks))return t;let o=n.tracks,{[s]:r}=o,i=pe(o,[En(s)]);return D(E({},t),{timelines:D(E({},t.timelines),{[e]:D(E({},n),{tracks:i})})})}function Xn(t){return t.some(e=>e.derived)?t.map((e,s)=>e.derived&&s>0?D(E({},e),{value:t[s-1].value}):e):t}function Fs(t,e){var c,l,u;let s=Ds(e);if(!s)return{timeline:t,drift:[],orphans:{}};let n=(c=s.timelines[As])!=null?c:{tracks:{}},r=new Map(Object.entries(n.tracks)),i=[],o=E({},(l=n.orphans)!=null?l:{}),a=t.tracks.map(f=>{let d=r.get(f.target);return d?(r.delete(f.target),d.type!==f.type?(o[f.target]={type:d.type,keys:d.keys,reason:"type-changed"},f):(d.baseHash!==null&&d.baseHash!==Oe(f.keys)&&i.push(f.target),D(E({},f),{keys:Xn(d.keys.map(y=>E({},y))),editable:!0}))):f});for(let[f,d]of r)d.baseHash!==null?o[f]={type:d.type,keys:d.keys,reason:"prop-missing"}:a.push({target:f,type:d.type,keys:Xn(d.keys.map(y=>E({},y))),editable:!0});let h=D(E({},t),{tracks:a});if(n.labels&&Object.keys(n.labels).length>0){let f=(u=t.labels)!=null?u:{},d=Object.keys(n.labels).filter(y=>y in f);d.length&&q(`sidecar label(s) ${d.join(", ")} collide with code labels; code wins (\xA76.2)`),h.labels=E(E({},n.labels),f)}return i.length&&q(`sidecar: code baseline changed beneath edits on ${i.join(", ")} (\xA76.2)`),{timeline:h,drift:i,orphans:o}}function Zn(t,e){return Fs(t,e).timeline}function tr(t){let e=t.map(s=>E({},s)).sort((s,n)=>s.t-n.t);for(let s=0;s<2;s++){for(let n=1;n<e.length;n++){let r=e[n].ease;r&&typeof r=="object"&&r.kind==="spring"&&(e[n].t=e[n-1].t+mt.duration(r))}e.sort((n,r)=>n.t-r.t)}for(let s=1;s<e.length;s++)e[s].t<=e[s-1].t&&(e[s].t=e[s-1].t+.001);return e}var Ns=t=>t(),Ls=Ns,Et=new Set,Le=0,Dt=!1,Qt=!1,_i=1e3;function ji(t){let e=Ls;return Ls=t!=null?t:Ns,Qt&&!Dt&&(Qt=!1,Et.size>0&&Vs()),e}function Xi(t){Et.add(t),Vs()}function Vs(){Le>0||Dt||Qt||(Qt=!0,Ls(Hi))}function Hi(){Qt=!1,!Dt&&Yi()}function Yi(){if(Dt)return;Dt=!0;let t;try{let e=0;for(;Et.size>0;){if(++e>_i)throw Et.clear(),new Error("signal notification flush did not settle within 1000 passes: a subscriber is writing to a signal it observes (DESIGN.md \xA76.1).");let s=[...Et];Et.clear();for(let n of s)try{n()}catch(r){t!=null||(t={err:r})}}}finally{Dt=!1}if(t)throw t.err}function De(){Le++}function ze(){Le--,Le===0&&Et.size>0&&Vs()}function Gi(t){De();try{return t()}finally{ze()}}var yt=null,It=0,Fe=class extends Error{constructor(){super("signal.set() during evaluation: the read phase is pure (DESIGN.md \xA72.1). Drivers write the playhead before evaluation begins; stateful animation belongs in bake()."),this.name="WriteDuringEvaluationError"}},sr=class extends Error{constructor(){super("circular signal dependency detected"),this.name="CircularDependencyError"}};function nr(){It++}function rr(){if(It===0)throw new Error("endReadPhase() without matching beginReadPhase()");It--}function Ui(){return It>0}var ir=class{constructor(t){x(this,"value");x(this,"fn");x(this,"equals");x(this,"version",0);x(this,"state");x(this,"computing",!1);x(this,"deps",[]);x(this,"depVersions",[]);x(this,"dependents",new Set);x(this,"subscribers",new Set);var e,s;this.fn=(e=t.fn)!=null?e:null,this.value=t.value,this.equals=(s=t.equals)!=null?s:Object.is,this.state=this.fn?2:0}get(){return yt&&yt.addDep(this),this.updateIfNecessary(),this.value}peek(){return this.updateIfNecessary(),this.value}set(t){if(It>0)throw new Fe;De();try{this.fn&&this.detachFn(),this.writeValue(t)}finally{ze()}}forceSet(t){De();try{this.fn&&this.detachFn(),this.writeValue(t)}finally{ze()}}bindSource(t){if(It>0)throw new Fe;De();try{this.fn=t,this.state=2,this.invalidateDependents(2)}finally{ze()}}unbindSource(){if(It>0)throw new Fe;this.fn&&(this.updateIfNecessary(),this.detachFn())}get isBound(){return this.fn!==null}subscribe(t){return this.subscribers.add(t),()=>this.subscribers.delete(t)}addDep(t){this.deps[this.deps.length-1]!==t&&(this.deps.push(t),this.depVersions.push(-1),t.dependents.add(this))}detachFn(){this.fn=null,this.clearDeps(),this.state=0}writeValue(t){(this.version>0||this.value!==void 0)&&this.equals(this.value,t)||(this.value=t,this.version++,this.invalidateDependents(2))}invalidateDependents(t){for(let e of[...this.dependents])e.markStale(t);if(this.subscribers.size>0)for(let e of[...this.subscribers])Xi(e)}markStale(t){if(this.state>=t)return;let e=this.state===0;this.state=t,e&&this.invalidateDependents(1)}updateIfNecessary(){if(!(this.fn===null||this.state===0)){if(this.computing)throw new sr;if(this.state===1){this.state=0;for(let t=0;t<this.deps.length;t++){let e=this.deps[t];if(e.updateIfNecessary(),e.version!==this.depVersions[t]){this.state=2;break}}}this.state===2&&this.recompute(),this.state=0}}recompute(){this.clearDeps();let t=yt;yt=this,this.computing=!0;let e;try{e=this.fn()}finally{this.computing=!1,yt=t}for(let s=0;s<this.deps.length;s++)this.depVersions[s]=this.deps[s].version;(!(this.version>0||this.value!==void 0)||!this.equals(this.value,e))&&(this.value=e,this.version++)}clearDeps(){for(let t of this.deps)t.dependents.delete(this);this.deps=[],this.depVersions=[]}};function or(t,e){let s=(()=>t.get());return s.peek=()=>t.peek(),s.subscribe=n=>t.subscribe(n),e(s),s}function $(t,e){let s=new ir({value:t,equals:e==null?void 0:e.equals});return or(s,n=>{n.set=r=>s.set(r),n.forceSet=r=>s.forceSet(r),n.bindSource=r=>s.bindSource(r),n.unbindSource=()=>s.unbindSource(),Object.defineProperty(n,"isBound",{get:()=>s.isBound})})}function Jt(t,e){return or(new ir({fn:t,equals:e==null?void 0:e.equals}),()=>{})}function Ki(t){let e=yt;yt=null;try{return t()}finally{yt=e}}function zt(t){let[e,s]=Array.isArray(t)?t:[t.x,t.y],n=$(e),r=$(s);n.expects="number",r.expects="number";let i=$(null,{equals:(l,u)=>l===null||u===null?l===u:l[0]===u[0]&&l[1]===u[1]}),o=$(e),a=$(s);n.bindSource(()=>{let l=i();return l===null?o():l[0]}),r.bindSource(()=>{let l=i();return l===null?a():l[1]});let h=Jt(()=>[n(),r()],{equals:(l,u)=>l[0]===u[0]&&l[1]===u[1]}),c=(()=>h());return c.peek=()=>h.peek(),c.subscribe=l=>h.subscribe(l),c.set=l=>{i.set(null),o.set(l[0]),a.set(l[1])},c.bindSource=l=>i.bindSource(()=>l()),c.unbindSource=()=>{i.unbindSource(),i.set(null)},c.expects="vec2",Object.defineProperty(c,"x",{value:n,enumerable:!0}),Object.defineProperty(c,"y",{value:r,enumerable:!0}),c}function Qi(t,e){return e.faces&&e.faces.length>0?e.faces.map(s=>{var n,r;return{family:t,url:s.url,weight:(n=s.weight)!=null?n:400,style:(r=s.style)!=null?r:"normal"}}):[{family:t,url:e.url,weight:400,style:"normal"}]}function Ji(t,e){let s,n=Number.POSITIVE_INFINITY;for(let r of t){let i=Math.abs(r.weight-e);(i<n||i===n&&s!==void 0&&r.weight<s.weight)&&(s=r,n=i)}return s}function Zt(t){let e=new Map;for(let[s,n]of Object.entries(t!=null?t:{}))n.kind==="font"&&e.set(s,{faces:Qi(s,n),fallback:n.fallback?[...n.fallback]:[]});return{has(s){return e.has(s)},faces(){let s=[];for(let n of e.values())s.push(...n.faces);return s},resolveFace(s,n=400,r="normal"){let i=e.get(s);if(!i)return;let o=i.faces.filter(a=>a.style===r);return Ji(o.length>0?o:i.faces,n)},fallbackChain(s){let n=e.get(s);return n?[s,...n.fallback]:[s]}}}var ar=class extends Error{constructor(e){super(lr(e));x(this,"report");this.name="FontValidationError",this.report=e}},Zi=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","math","emoji","fangsong"]);function cr(t,e){var n;let s=t.trim().toLowerCase();return Zi.has(s)?!0:(n=e==null?void 0:e.has(s))!=null?n:!1}function to(t){let e=[];for(let s of t){let n=s.codePointAt(0);n!==void 0&&e.push(n)}return e}function lr(t){let e=[];t.unregistered.length>0&&e.push(`unregistered font ${t.unregistered.length===1?"family":"families"}: ${t.unregistered.join(", ")}`);for(let s of t.missingGlyphs){let n=s.codePoints.map(r=>"U+"+r.toString(16).toUpperCase().padStart(4,"0")).join(", ");e.push(`family '${s.family}' is missing glyphs for ${n}`)}return"font validation failed (\xA73.6): "+e.join("; ")+" \u2014 register the family with its faces/fallback, or supply covering glyphs"}function qs(t,e,s,n,r={}){let i=new Set,o=new Map;for(let h of t){let c=h.family,l=cr(c,r.osFamilies);if(!e.has(c)){l||i.add(c);continue}let u=e.fallbackChain(c);for(let f of to(h.text))if(!u.some(d=>{var y,p;return(p=(y=s.get(d))==null?void 0:y.has(f))!=null?p:!1})){let d=o.get(c);d||(d=new Set,o.set(c,d)),d.add(f)}}let a={unregistered:[...i].sort(),missingGlyphs:[...o.entries()].map(([h,c])=>({family:h,codePoints:[...c].sort((l,u)=>l-u)})).sort((h,c)=>h.family<c.family?-1:h.family>c.family?1:0)};if(!(a.unregistered.length===0&&a.missingGlyphs.length===0)){if(n==="strict")throw new ar(a);q(lr(a))}return a}var Rs=class extends Error{constructor(t,e){super(`invalid position '${t}': ${e}`),this.name="PositionError"}};function er(t){return typeof t!="string"&&typeof t.peek=="function"?t.peek():void 0}var hr=new WeakMap;function eo(t){var e;return(e=hr.get(t))!=null?e:new Map}function ur(t,e={}){var v;let s=[],n=E({},e.labels),r=[],i=[],o=new Map,a=!1,h=0,c=0,l=0;function u(k){if(k===void 0)return c;if(typeof k=="number")return k;if(k==="<")return h;if(k===">")return c;let m=/^([+-])=([\d.]+)$/.exec(k);if(m)return c+(m[1]==="+"?1:-1)*parseFloat(m[2]);let g=/^([^+\-=]+?)(?:([+-])=([\d.]+))?$/.exec(k);if(g){let b=g[1];if(!(b in n))throw new Rs(k,`unknown label '${b}' (labels must be declared before use)`);let T=g[2]?(g[2]==="+"?1:-1)*parseFloat(g[3]):0;return n[b]+T}throw new Rs(k,"expected a number, '<', '>', '+=x', '-=x', or 'label[+=x]'")}let f={to(k,m,g={}){var S,C;let b=(S=g.ease)!=null?S:"easeInOutCubic",T=typeof b=="object"&&b.kind==="spring",I=T?mt.duration(b):(C=g.duration)!=null?C:1;if(T&&g.duration!==void 0)throw new Z("a spring ease determines its duration (spring.duration(cfg)); do not pass duration with a spring");let w=u(g.at),M={kind:"tween",target:Pe(k),value:m,duration:I,ease:b,at:g.at,baseValue:er(k),editable:!1,start:w};return g.from!==void 0&&(M.explicitFrom=g.from),s.push(M),h=w,c=w+I,f},fromTo(k,m,g,b={}){return f.to(k,g,b),s[s.length-1].explicitFrom=m,f},set(k,m,g={}){let b=u(g.at);return s.push({kind:"set",target:Pe(k),value:m,duration:0,ease:"linear",at:g.at,baseValue:er(k),editable:!1,start:b}),h=b,c=b,f},label(k,m){return n[k]=m===void 0?c:u(m),f},add(k,m,g={}){var M,S;let b=m===void 0?c:u(m),T=(M=g.mode)!=null?M:"add",I={timeline:k,at:b,mode:T,_pos:m};g.timeScale!==void 0&&(I.timeScale=g.timeScale),r.push(I);let w=T==="sync"&&(S=g.timeScale)!=null?S:1;return h=b,c=b+tt(k).duration/w,f},call(k,m){let g=m===void 0?c:u(m),b=`call:${l++}`;return i.push({t:g,name:b}),o.set(b,k),f},cue(k,m,g){let b=g!=null&&typeof g=="object"&&!Array.isArray(g)?E({kind:"cue"},g):{kind:"cue"};return i.push({t:u(k),name:m,data:b}),f},adBreak(k,m={}){var b;let g=E({kind:"ad-break"},m.duration!==void 0?{duration:m.duration}:{});return i.push({t:u(k),name:(b=m.id)!=null?b:"ad-break",data:g}),f},editable(){let k=s[s.length-1];if(!k)throw new Z(".editable() requires a preceding insertion");let m=Ot(k.target);if(!Kt(m))throw new Z(`.editable() needs a node with an explicit id; '${m}' is not an editable host (\xA76.4)`);return k.editable=!0,f},editableDuration(){return a=!0,f}};t(f);let d=new Map;for(let k of s){let m=d.get(k.target);m||(m=[],d.set(k.target,m)),m.push(k)}let y=[];for(let[k,m]of d){m.sort((S,C)=>S.start-C.start);let g=[],b=m.some(S=>S.editable),T=(v=m.find(S=>S.baseValue!==void 0))==null?void 0:v.baseValue,I=m[0];I.kind==="tween"&&I.explicitFrom===void 0&&T===void 0&&q(`'${k}': first tween has no resolvable from-value (string targets have no base) \u2014 the track sits at its end state before the tween. Anchor it with { from }, fromTo(), or set(..., { at: 0 }).`);for(let S of m){if(S.kind==="set"){g.push({t:S.start,value:S.value,interp:"hold"}),T=S.value;continue}let C=S.explicitFrom!==void 0?S.explicitFrom:T,L=g[g.length-1];if(C!==void 0&&(!L||L.t<S.start)){let R={t:S.start,value:C};S.explicitFrom===void 0&&(R.derived=!0),(!L||S.start>L.t)&&g.push(R)}g.push({t:S.start+S.duration,value:S.value,ease:S.ease}),T=S.value}let w=[];for(let S of g.sort((C,L)=>C.t-L.t)){let C=w[w.length-1];C&&C.t===S.t?w[w.length-1]=S:w.push(S)}let M={target:k,type:Ie(m[0].value),keys:w};b&&(M.editable=!0),y.push(M)}let p=Ps(E(E(E(D(E({},e),{tracks:y,labels:n}),a?{editableDuration:!0}:{}),i.length?{markers:i}:{}),r.length?{children:r.map(g=>{var b=g,{_pos:k}=b,m=pe(b,["_pos"]);return m})}:{}));return o.size&&hr.set(p,o),p}function so(t,e){return typeof t=="function"?ur(t,e):Ps(t)}function Ve(t=0){return $(t)}var fr=class extends Error{constructor(t){super(`timeline targets '${t}' but no property signal resolves to it`),this.name="UnboundTargetError"}},dr=class extends Error{constructor(e,s,n){let r=e.slice(e.lastIndexOf("/")+1),i=[n].flat(),o=s==="number"&&i.includes("vec2")?`; target '${r}.x'/'${r}.y' or author a vec2 track`:"";super(`track '${e}' is '${s}' but '${r}' expects '${i.join("'|'")}' (would silently NaN evaluation)${o}`);x(this,"target");x(this,"got");x(this,"expected");this.target=e,this.got=s,this.name="BindTypeMismatchError",this.expected=n}};function Ws(t,e,s=Ve()){let n=[],r=new Map;for(let[i,o]of t.tracks){let a=e(i);if(!a)throw new fr(i);let h=o.type,c=a.expects;if(c!==void 0){let l=Te(h);if(!(Array.isArray(c)?c:[c]).some(u=>Te(u)===l))throw new dr(i,h,c)}a.bindSource(()=>Ce(o,s())),n.push(a),r.set(i,{track:o,value:l=>Ce(o,l),velocity:l=>Cs(o,l)})}return{playhead:s,samplers:r,unbind:()=>{for(let i of n)i.unbindSource()}}}function Bs(t,e,s){t.forceSet(e),nr();try{return s()}finally{rr()}}function it(t){let e=t>>>0;return()=>{e=e+2654435769|0;let s=e^e>>>16;return s=Math.imul(s,569420461),s=s^s>>>15,s=Math.imul(s,1935289751),s=s^s>>>15,(s>>>0)/4294967296}}var Re=class extends Error{constructor(t){super(`bake(): ${t}`),this.name="BakeError"}};function Ne(t,e,s){for(let[n,r]of Object.entries(e)){let i=t.get(n);i||(i={keys:[],type:Ie(r)},t.set(n,i)),i.keys.push({t:s,value:r})}}function pr(t){return[...t.entries()].map(([e,s])=>({target:e,type:s.type,keys:s.keys}))}function no(t){var o,a;if(!(t.fps>0)||!(t.duration>=0))throw new Re("fps must be > 0 and duration >= 0");let e=it((o=t.seed)!=null?o:0),s=1/t.fps,n=Math.round(t.duration*t.fps),r=t.setup(e),i=new Map;Ne(i,t.sample(r),0);for(let h=1;h<=n;h++)r=(a=t.step(r,s,e))!=null?a:r,Ne(i,t.sample(r),h*s);return pr(i)}function ro(t){var u;if(!(t.every>=1))throw new Re("checkpoint interval `every` must be >= 1 frame");let e=1/t.fps,s=Math.round(t.duration*t.fps),n=0,r=it((u=t.seed)!=null?u:0),i=()=>(n++,r()),o=f=>{var y;let d=it((y=t.seed)!=null?y:0);for(let p=0;p<f;p++)d();return d},a=t.setup(i),h=[{snap:t.snapshot(a),rngDraws:n}],c=0;function l(f){var d;for(;c<Math.min(f,s);)a=(d=t.step(a,e,i))!=null?d:a,c++,c%t.every===0&&h.push({snap:t.snapshot(a),rngDraws:n})}return{frames:s,bakeRange(f,d){var b;if(f<0||d>s||f>d)throw new Re(`range ${f}..${d} outside 0..${s}`);let y=Math.floor(f/t.every)*t.every;l(y);let p=h[y/t.every],v=t.restore(p.snap),k=o(p.rngDraws),m=y,g=new Map;for(m>=f&&Ne(g,t.sample(v),m*e);m<d;)v=(b=t.step(v,e,k))!=null?b:v,m++,m>=f&&Ne(g,t.sample(v),m*e);return pr(g)}}}var vt=[1,0,0,1,0,0],W=t=>t===0?0:t;function ee(t,e){let[s,n,r,i,o,a]=t,[h,c,l,u,f,d]=e;return[W(s*h+r*c),W(n*h+i*c),W(s*l+r*u),W(n*l+i*u),W(s*f+r*d+o),W(n*f+i*d+a)]}function Hs(t,e,s){let n=e*Math.PI/180,r=Math.cos(n),i=Math.sin(n),[o,a]=s;return[W(r*o),W(i*o),W(-i*a),W(r*a),W(t[0]),W(t[1])]}function Mr(t){let[e,s,n,r,i,o]=t,a=e*r-s*n;if(a===0)return null;let h=r/a,c=-s/a,l=-n/a,u=e/a;return[W(h),W(c),W(l),W(u),W(-(h*i+l*o)),W(-(c*i+u*o))]}function Sr(t,e){return[t[0]*e[0]+t[2]*e[1]+t[4],t[1]*e[0]+t[3]*e[1]+t[5]]}function kt(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]}function Lt(t,e){if(e instanceof ArrayBuffer)return`ab:${e.byteLength}`;if(ArrayBuffer.isView(e))return`view:${e.byteLength}`;if(typeof e!="function")return typeof e=="number"&&!Number.isFinite(e)?Number.isNaN(e)?"NaN":e>0?"Infinity":"-Infinity":e}function gr(t,e){let s={};for(let[n,r]of Object.entries(t))s[n]=r;return t.op==="clip"||t.op==="fillPath"||t.op==="strokePath"?s.path=e[t.path]:t.op==="drawImage"&&(s.image=e[t.image]),s}var Ft=t=>JSON.stringify(t,Lt);function io(t,e){let s=[],n=new Set([...Object.keys(t),...Object.keys(e)]);for(let r of n)r!=="op"&&Ft(t[r])!==Ft(e[r])&&s.push({path:r,from:t[r],to:e[r]});return s}function Ys(t,e){let s=[],n=Math.max(t.commands.length,e.commands.length);for(let i=0;i<n;i++){let o=t.commands[i],a=e.commands[i];if(o!==void 0&&a!==void 0){let h=gr(o,t.resources),c=gr(a,e.resources);if(Ft(h)===Ft(c))continue;o.op!==a.op?s.push({index:i,kind:"change",opA:o.op,opB:a.op,fields:[{path:"op",from:o.op,to:a.op}]}):s.push({index:i,kind:"change",opA:o.op,opB:a.op,fields:io(h,c)})}else a!==void 0?s.push({index:i,kind:"add",opB:a.op,fields:[]}):o!==void 0&&s.push({index:i,kind:"remove",opA:o.op,fields:[]})}let r=t.size.w!==e.size.w||t.size.h!==e.size.h;return E({equal:s.length===0&&!r,deltas:s},r?{size:{from:t.size,to:e.size}}:{})}function Tr(t){var s,n,r,i;if(t.equal)return"DisplayLists are identical.";let e=[];t.size&&e.push(`size ${t.size.from.w}x${t.size.from.h} -> ${t.size.to.w}x${t.size.to.h}`);for(let o of t.deltas)if(o.kind==="add")e.push(`+ [${o.index}] add ${(s=o.opB)!=null?s:"?"}`);else if(o.kind==="remove")e.push(`- [${o.index}] remove ${(n=o.opA)!=null?n:"?"}`);else{let a=o.opA===o.opB?o.opA:`${(r=o.opA)!=null?r:"?"} -> ${(i=o.opB)!=null?i:"?"}`;e.push(`~ [${o.index}] ${a}`);for(let h of o.fields)e.push(` ${h.path}: ${Ft(h.from)} -> ${Ft(h.to)}`)}return e.join(`
2
+ `)}var Er=1;function Ir(t){let e={dlSnapshotVersion:1,size:t.size,commands:t.commands,resources:t.resources};return JSON.stringify(e,Lt,2)}var _e=class extends Error{constructor(t){super(t),this.name="DlSnapshotError"}};function $r(t){let e=JSON.parse(t);if(e.dlSnapshotVersion!==1)throw new _e(`unsupported dlSnapshotVersion ${String(e.dlSnapshotVersion)}; this build reads 1`);if(!e.size||!Array.isArray(e.commands)||!Array.isArray(e.resources))throw new _e("malformed .dl.json snapshot (need size, commands[], resources[])");return{size:e.size,commands:e.commands,resources:e.resources}}var $t=class extends Error{constructor(t){super(t),this.name="FilterValidationError"}},mr=new Set(["blur","drop-shadow","brightness","contrast","saturate"]);function Gs(t){for(let e of t){if(!mr.has(e.kind))throw new $t(`unknown filter kind '${String(e.kind)}' (have: ${[...mr].join(", ")})`);if(e.kind==="blur"&&!(Number.isFinite(e.radius)&&e.radius>=0))throw new $t(`blur radius must be \u2265 0, got ${String(e.radius)}`);if(e.kind==="drop-shadow"){if(![e.dx,e.dy,e.blur].every(Number.isFinite)||e.blur<0)throw new $t("drop-shadow needs finite dx/dy and blur \u2265 0");if(typeof e.color!="string"||e.color.length===0)throw new $t("drop-shadow needs a color string")}if((e.kind==="brightness"||e.kind==="contrast"||e.kind==="saturate")&&!(Number.isFinite(e.amount)&&e.amount>=0))throw new $t(`${e.kind} amount must be \u2265 0, got ${String(e.amount)}`)}}function He(t){return t.length===0?"none":t.map(e=>{switch(e.kind){case"blur":return`blur(${e.radius}px)`;case"drop-shadow":return`drop-shadow(${e.dx}px ${e.dy}px ${e.blur}px ${e.color})`;default:return`${e.kind}(${e.amount})`}}).join(" ")}function Cr(t,e=16,s=2){let n=[];for(let r=0;r<Math.max(1,s);r++)n.push({kind:"drop-shadow",dx:0,dy:0,blur:e*(1+r*1.5),color:t});return n}function oo(t){switch(t.op){case"clip":case"fillPath":case"strokePath":return[t.path];case"drawImage":return[t.image];default:return[]}}function ao(t){let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return(e>>>0).toString(16).padStart(8,"0")}function ne(t){let e=[],s=[],n=new Map;return{push:r=>{r.op==="pushGroup"&&r.filters.length>0&&Gs(r.filters),e.push(r)},resource:r=>{let i=JSON.stringify(r),o=n.get(i);if(o!==void 0)return o;let a=s.length;return s.push(r),n.set(i,a),a},mark:()=>e.length,cacheKey:(r,i)=>{if(i<=r)return;let o=new Map,a=[],h=l=>{let u=o.get(l);return u===void 0&&(u=o.size,o.set(l,u),a.push(s[l])),u},c=e.slice(r,i).map(l=>oo(l).length===0?l:l.op==="drawImage"?D(E({},l),{image:h(l.image)}):D(E({},l),{path:h(l.path)}));return ao(JSON.stringify({c,r:a},Lt))},patchCacheKey:(r,i)=>{let o=e[r];o&&o.op==="pushGroup"&&(o.cacheKey=i)},finish:()=>({commands:e,resources:s,size:t})}}var je=.5;function X(t){return Math.round(t/je)*je}var Be=null;function Pr(t){Be=t}function Y(){return Be!=null?Be:Us}var Us={measureText(t,e){return{width:t.length*e.size*.52,ascent:e.size*.8,descent:e.size*.2}}},qe;function Ye(t){if(qe===void 0&&(qe=typeof Intl!="undefined"&&"Segmenter"in Intl?new Intl.Segmenter(void 0,{granularity:"word"}):null),qe){let e=[...qe.segment(t)].map(n=>n.segment),s=[];for(let n of e)s.length>0&&/^[^\p{L}\p{N}\s]+$/u.test(n)?s[s.length-1]+=n:s.push(n);return s}return t.split(/(\s+)/).filter(e=>e.length>0)}var We;function bt(t){return We===void 0&&(We=typeof Intl!="undefined"&&"Segmenter"in Intl?new Intl.Segmenter(void 0,{granularity:"grapheme"}):null),We?[...We.segment(t)].map(e=>e.segment):Array.from(t)}function ot(t,e,s,n){let r=t.split(`
3
+ `);if(s===void 0||s<=0)return r;let i=[];for(let o of r){let a=Ye(o),h="";for(let c of a){let l=h+c;h!==""&&X(n.measureText(l.trimEnd(),e).width)>s?(i.push(h.trimEnd()),h=c.trimStart()===""?"":c):h=l}i.push(h.trimEnd())}return i}var co={center:[.5,.5],"top-left":[0,0],top:[.5,0],"top-right":[1,0],left:[0,.5],right:[1,.5],"bottom-left":[0,1],bottom:[.5,1],"bottom-right":[1,1]};function Ks(t){if(typeof t=="string"){let e=co[t];if(!e)throw new Error(`unknown anchor '${t}' (use a preset like 'top-left' or a [ax, ay] pair)`);return e}return[t[0],t[1]]}function te(t,e){return typeof e=="function"?t.bindSource(e):e!==void 0&&t.set(e),t}function yr(t,e){return typeof e=="function"?t.bindSource(e):e!==void 0&&t.set(e),t}var se,vr,G=(vr=class{constructor(t={}){x(this,"id");x(this,"position");x(this,"rotation");x(this,"scale");x(this,"opacity");x(this,"blend");x(this,"zIndex");x(this,"filters");x(this,"anchor");x(this,"hasAnchor");x(this,"cache");x(this,"parent",null);H(this,se,!1);x(this,"interactive",!1);x(this,"interactiveChildren",!0);x(this,"hitArea");x(this,"measurerSource",null);x(this,"localMatrix");x(this,"worldMatrix");x(this,"targets",new Map);var e;this.id=t.id,this.position=yr(zt([0,0]),t.position),this.rotation=te($(0),t.rotation),this.scale=yr(zt([1,1]),t.scale),this.opacity=te($(1),t.opacity),this.blend=te($("source-over"),t.blend),this.zIndex=te($(0),t.zIndex),this.filters=te($([]),t.filters),this.hasAnchor=t.anchor!==void 0,this.anchor=Ks((e=t.anchor)!=null?e:"center"),this.cache=t.cache===!0,this.localMatrix=Jt(()=>{let s=Hs(this.position(),this.rotation(),this.scale()),[n,r]=this.anchorShift();return n===0&&r===0?s:ee(s,[1,0,0,1,n,r])},{equals:kt}),this.worldMatrix=Jt(()=>this.parent?ee(this.parent.worldMatrix(),this.localMatrix()):this.localMatrix(),{equals:kt}),this.registerTarget("position",this.position,"vec2"),this.registerTarget("position.x",this.position.x,"number"),this.registerTarget("position.y",this.position.y,"number"),this.registerTarget("rotation",this.rotation,"number"),this.registerTarget("scale",this.scale,"vec2"),this.registerTarget("scale.x",this.scale.x,"number"),this.registerTarget("scale.y",this.scale.y,"number"),this.registerTarget("opacity",this.opacity,"number"),this.registerTarget("zIndex",this.zIndex,"number")}registerTarget(t,e,s){e.expects=s,this.targets.set(t,e),this.id!==void 0&&(e[Ut]=`${this.id}/${t}`)}resolveTarget(t){return this.targets.get(t)}intrinsicSize(t){return null}drawOffset(t){var n,r,i;let e=(r=t!=null?t:(n=this.measurerSource)==null?void 0:n.call(this))!=null?r:Y(),s=(i=this.intrinsicSize(e))!=null?i:{w:0,h:0};return{x:-s.w/2,y:-s.h/2}}flowOffset(t){var i,o;let e=(o=t!=null?t:(i=this.measurerSource)==null?void 0:i.call(this))!=null?o:Y(),s=this.drawOffset(e),[n,r]=this.anchorShift(e);return{x:s.x+n,y:s.y+r}}anchorShift(t){var h,c;if(!this.hasAnchor)return[0,0];let[e,s]=this.anchor,n=(c=t!=null?t:(h=this.measurerSource)==null?void 0:h.call(this))!=null?c:Y(),r=this.intrinsicSize(n);if(!r)return P(this,se)||(_(this,se,!0),q(`anchor set on a node without an intrinsic box${this.id?` ('${this.id}')`:""} \u2014 ignored (give it a sized node, or position children explicitly)`)),[0,0];let i=this.drawOffset(n),o=-(i.x+e*r.w),a=-(i.y+s*r.h);return[o===0?0:o,a===0?0:a]}requiresGroup(){return this.opacity()<1||this.blend()!=="source-over"||this.filters().length>0}groupShader(){}emit(t,e){let s=this.opacity();if(s<=0)return;let n=this.localMatrix(),r=kt(n,vt),i=this.groupShader(),o=this.requiresGroup()||i!==void 0||this.cache,a=this.cache&&t.mark!==void 0;t.push({op:"save"}),r||t.push({op:"transform",m:n});let h=-1;o&&(a&&(h=t.mark()),t.push(E({op:"pushGroup",opacity:s,blend:this.blend(),filters:this.filters()},i!==void 0?{shader:i}:{})));let c=a?t.mark():-1;if(this.draw(t,e),o){if(a){let l=t.cacheKey(c,t.mark());l!==void 0&&t.patchCacheKey(h,l)}t.push({op:"popGroup"})}t.push({op:"restore"})}},se=new WeakMap,vr),wr=["marker","crayon","pencil","ink","chalk"],ft=class extends Error{constructor(t){super(t),this.name="SketchValidationError"}};function Qs(t){if(!wr.includes(t.kind))throw new ft(`unknown sketch kind '${String(t.kind)}' (have: ${wr.join(", ")})`);if(t.width!==void 0&&!(t.width>0))throw new ft(`sketch width must be > 0, got ${String(t.width)}`);if(t.roughness!==void 0&&!(t.roughness>=0))throw new ft(`sketch roughness must be \u2265 0, got ${String(t.roughness)}`);if((t.kind==="crayon"||t.kind==="pencil")&&t.passes!==void 0&&!(t.passes>=1))throw new ft(`sketch passes must be \u2265 1, got ${String(t.passes)}`);if(t.kind==="chalk"&&t.dash!==void 0&&(!Array.isArray(t.dash)||t.dash.some(e=>!(e>=0))))throw new ft("sketch chalk dash must be an array of non-negative numbers")}function Js(t){var e,s,n,r,i,o,a,h,c,l,u,f,d;switch(t.kind){case"marker":return{width:(e=t.width)!=null?e:8,roughness:(s=t.roughness)!=null?s:1.2,passes:2};case"crayon":return{width:(n=t.width)!=null?n:4,roughness:(r=t.roughness)!=null?r:2.4,passes:(i=t.passes)!=null?i:3};case"pencil":return{width:(o=t.width)!=null?o:1.5,roughness:(a=t.roughness)!=null?a:1,passes:(h=t.passes)!=null?h:2};case"ink":return{width:(c=t.width)!=null?c:2.5,roughness:(l=t.roughness)!=null?l:.8,passes:1};case"chalk":return{width:(u=t.width)!=null?u:3,roughness:(f=t.roughness)!=null?f:1.6,passes:1,dash:(d=t.dash)!=null?d:[6,5]}}}var lo=(t,e,s,n,r)=>{let i=1-r,o=i*i*i,a=3*i*i*r,h=3*i*r*r,c=r*r*r;return[o*t[0]+a*e[0]+h*s[0]+c*n[0],o*t[1]+a*e[1]+h*s[1]+c*n[1]]},ho=(t,e,s,n)=>{let r=1-n;return[r*r*t[0]+2*r*n*e[0]+n*n*s[0],r*r*t[1]+2*r*n*e[1]+n*n*s[1]]},_s=(t,e,s,n,r,i)=>{let o=s*Math.cos(i),a=n*Math.sin(i),h=Math.cos(r),c=Math.sin(r);return[t+o*h-a*c,e+o*c+a*h]};function re(t,e=16){let s=[],n=null,r=0,i=0,o=0,a=0,h=(c,l)=>(n||(n={points:[[c,l]],closed:!1},s.push(n),o=c,a=l),n);for(let c of t)switch(c[0]){case"M":n={points:[[c[1],c[2]]],closed:!1},s.push(n),r=o=c[1],i=a=c[2];break;case"L":h(r,i).points.push([c[1],c[2]]),r=c[1],i=c[2];break;case"C":{let l=h(r,i);for(let u=1;u<=e;u++)l.points.push(lo([r,i],[c[1],c[2]],[c[3],c[4]],[c[5],c[6]],u/e));r=c[5],i=c[6];break}case"Q":{let l=h(r,i);for(let u=1;u<=e;u++)l.points.push(ho([r,i],[c[1],c[2]],[c[3],c[4]],u/e));r=c[3],i=c[4];break}case"E":{let[,l,u,f,d,y,p,v]=c,k=_s(l,u,f,d,y,p),m=h(k[0],k[1]);for(let b=1;b<=e;b++)m.points.push(_s(l,u,f,d,y,p+(v-p)*(b/e)));let g=_s(l,u,f,d,y,v);r=g[0],i=g[1];break}case"Z":n&&(n.points.push([o,a]),n.closed=!0,r=o,i=a);break}return s.filter(c=>c.points.length>0)}function Zs(t){let e=0;for(let s=1;s<t.points.length;s++)e+=Math.hypot(t.points[s][0]-t.points[s-1][0],t.points[s][1]-t.points[s-1][1]);return e}function tn(t){if(!(t.gap>0))throw new ft(`hachure gap must be > 0, got ${String(t.gap)}`);if(t.roughness!==void 0&&!(t.roughness>=0))throw new ft(`hachure roughness must be \u2265 0, got ${String(t.roughness)}`)}function en(t,e,s){var I;let n=re(t),r=1/0,i=1/0,o=-1/0,a=-1/0;for(let w of n)for(let[M,S]of w.points)M<r&&(r=M),S<i&&(i=S),M>o&&(o=M),S>a&&(a=S);if(!Number.isFinite(r))return[];let h=(r+o)/2,c=(i+a)/2,l=Math.cos(e.angleRad),u=Math.sin(e.angleRad),f=(w,M)=>[(w-h)*l+(M-c)*u,-(w-h)*u+(M-c)*l],d=(w,M)=>[h+w*l-M*u,c+w*u+M*l],y=1/0,p=1/0,v=-1/0,k=-1/0,m=[[r,i],[o,i],[o,a],[r,a]];for(let[w,M]of m){let[S,C]=f(w,M);S<y&&(y=S),C<p&&(p=C),S>v&&(v=S),C>k&&(k=C)}let g=(I=e.roughness)!=null?I:1,b=()=>(s()*2-1)*g,T=[];for(let w=p+e.gap/2;w<k;w+=e.gap){let M=d(y,w+b()),S=d(v,w+b());T.push(["M",M[0],M[1]],["L",S[0],S[1]])}return T}function Ge(t,e,s){let n=Js(e),r=re(t),i=()=>(s()*2-1)*n.roughness,o=[];for(let a=0;a<n.passes;a++){let h=[];for(let c of r){let l=c.points;if(l.length<2)continue;let u=l[0][0]+i(),f=l[0][1]+i();h.push(["M",u,f]);for(let d=1;d<l.length;d++){let y=l[d][0]+i(),p=l[d][1]+i(),v=y-u,k=p-f,m=Math.hypot(v,k)||1,g=i()*.5,b=(u+y)/2+-k/m*g,T=(f+p)/2+v/m*g;h.push(["Q",b,T,y,p]),u=y,f=p}}o.push(h)}return{strokes:o,resolved:n}}function sn(t){let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return e>>>0}function Ar(t,e,s){return Ge(t,e,it(s>>>0)).strokes}var Or=class extends G{};function Rt(t,e,s,n,r){if(r<=0)return[["M",t,e],["L",t+s,e],["L",t+s,e+n],["L",t,e+n],["Z"]];let i=Math.PI/2;return[["M",t+r,e],["L",t+s-r,e],["E",t+s-r,e+r,r,r,0,-i,0],["L",t+s,e+n-r],["E",t+s-r,e+n-r,r,r,0,0,i],["L",t+r,e+n],["E",t+r,e+n-r,r,r,0,i,Math.PI],["L",t,e+r],["E",t+r,e+r,r,r,0,Math.PI,Math.PI+i],["Z"]]}var wt,xr,xt=(xr=class extends G{constructor(e={}){var s;super(e);x(this,"children");H(this,wt,$(0));this.children=(s=e.children)!=null?s:[];for(let n of this.children)n.parent=this}trackStructure(){P(this,wt).call(this)}add(e){return e.parent=this,this.children.push(e),P(this,wt).set(P(this,wt).peek()+1),this}remove(e){let s=this.children.indexOf(e);return s>=0&&(this.children.splice(s,1),e.parent===this&&(e.parent=null),P(this,wt).set(P(this,wt).peek()+1)),this}draw(e,s){let n=this.children.map((r,i)=>({node:r,i})).sort((r,i)=>r.node.zIndex()-i.node.zIndex()||r.i-i.i).map(r=>r.node);for(let r of n)r.emit(e,s)}},wt=new WeakMap,xr);function br(t){return typeof t=="string"?{kind:"color",color:t}:t}var nn=class extends G{constructor(e={}){var s;super(e);x(this,"fill");x(this,"stroke");x(this,"strokeWidth");x(this,"sketch");x(this,"sketchFill");x(this,"sketchSeed");x(this,"reveal");this.fill=B($(""),e.fill),this.stroke=B($(""),e.stroke),this.strokeWidth=B($(0),e.strokeWidth),this.reveal=B($(1),e.reveal),this.registerTarget("fill",this.fill,["color","paint"]),this.registerTarget("stroke",this.stroke,"color"),this.registerTarget("strokeWidth",this.strokeWidth,"number"),this.registerTarget("reveal",this.reveal,"number"),e.sketch&&Qs(e.sketch),e.sketchFill&&tn(e.sketchFill),e.sketchFill&&!e.sketch&&q(`${this.id!==void 0?`'${this.id}': `:""}sketchFill is ignored without sketch \u2014 hachure fill is drawn only by the sketch renderer. Set a sketch style (e.g. { kind: 'pencil' }) to see it.`),this.sketch=e.sketch,this.sketchFill=e.sketchFill,this.sketchSeed=(s=e.sketchSeed)!=null?s:this.id!==void 0?sn(this.id):0}draw(e){let s=this.pathSegs();if(this.sketch)return this.drawSketch(e,s);let n=e.resource({kind:"path",segs:s}),r=this.fill();r&&e.push({op:"fillPath",path:n,paint:br(r)});let i=this.stroke(),o=this.strokeWidth();if(i&&o>0){let a=this.reveal();a<1?kr(e,s,{kind:"color",color:i},{width:o},a):e.push({op:"strokePath",path:n,paint:{kind:"color",color:i},stroke:{width:o}})}}drawSketch(e,s){let n=it(this.sketchSeed>>>0),r=this.fill();if(r){let l=e.resource({kind:"path",segs:s});e.push({op:"fillPath",path:l,paint:br(r)})}let{strokes:i,resolved:o}=Ge(s,this.sketch,n),a=this.stroke()||(typeof r=="string"?r:"")||"#000000";if(this.sketchFill){let l=e.resource({kind:"path",segs:s});e.push({op:"save"}),e.push({op:"clip",path:l,rule:"nonzero"});let u=en(s,this.sketchFill,n);if(u.length>0){let f=e.resource({kind:"path",segs:u});e.push({op:"strokePath",path:f,paint:{kind:"color",color:a},stroke:{width:Math.max(1,o.width*.5),cap:"round"}})}e.push({op:"restore"})}let h=this.reveal(),c=h<1;for(let l of i){if(l.length===0)continue;if(c){kr(e,l,{kind:"color",color:a},{width:o.width,cap:"round",join:"round"},h);continue}let u=e.resource({kind:"path",segs:l});e.push({op:"strokePath",path:u,paint:{kind:"color",color:a},stroke:E({width:o.width,cap:"round",join:"round"},o.dash?{dash:o.dash}:{})})}}};function B(t,e){return typeof e=="function"?t.bindSource(e):e!==void 0&&t.set(e),t}function uo(t){let e=[],s=null;for(let n of t)n[0]==="M"?(s=[n],e.push(s)):s&&s.push(n);return e}function kr(t,e,s,n,r){for(let i of uo(e)){let o=re(i).reduce((h,c)=>h+Zs(c),0),a=t.resource({kind:"path",segs:i});t.push({op:"strokePath",path:a,paint:s,stroke:D(E({},n),{dash:[o,o],dashOffset:o*(1-r)})})}}function Dr(t){let e=[],s=null,n=(i,o=[0,0],a=[0,0])=>{s.v.push(i),s.in.push(o),s.out.push(a)},r=()=>s.v[s.v.length-1];for(let i of t)switch(i[0]){case"M":s={closed:!1,v:[[i[1],i[2]]],in:[[0,0]],out:[[0,0]]},e.push(s);break;case"L":s&&n([i[1],i[2]]);break;case"C":if(s){let o=r();s.out[s.out.length-1]=[i[1]-o[0],i[2]-o[1]],n([i[5],i[6]],[i[3]-i[5],i[4]-i[6]])}break;case"Q":if(s){let o=r(),a=i[1],h=i[2],c=i[3],l=i[4];s.out[s.out.length-1]=[2/3*(a-o[0]),2/3*(h-o[1])],n([c,l],[2/3*(a-c),2/3*(h-l)])}break;case"E":if(s){let[,o,a,h,c,l,u,f]=i,d=Math.cos(l),y=Math.sin(l);for(let p=1;p<=16;p++){let v=u+(f-u)*(p/16),k=h*Math.cos(v),m=c*Math.sin(v);n([o+k*d-m*y,a+k*y+m*d])}}break;case"Z":if(s){s.closed=!0;let o=s.v[0],a=r();s.v.length>1&&Math.abs(o[0]-a[0])<1e-9&&Math.abs(o[1]-a[1])<1e-9&&(s.in[0]=s.in[s.in.length-1],s.v.pop(),s.in.pop(),s.out.pop())}break}return e}var zr=class extends nn{constructor(e={}){super(e);x(this,"width");x(this,"height");x(this,"cornerRadius");this.width=B($(0),e.width),this.height=B($(0),e.height),this.cornerRadius=B($(0),e.cornerRadius),this.registerTarget("width",this.width,"number"),this.registerTarget("height",this.height,"number"),this.registerTarget("cornerRadius",this.cornerRadius,"number")}intrinsicSize(){return{w:this.width(),h:this.height()}}pathSegs(){let e=this.width(),s=this.height(),n=Math.min(Math.max(0,this.cornerRadius()),e/2,s/2);return Rt(-e/2,-s/2,e,s,n)}},Fr=class extends nn{constructor(e={}){super(e);x(this,"radius");this.radius=B($(0),e.radius),this.registerTarget("radius",this.radius,"number")}intrinsicSize(){let e=this.radius()*2;return{w:e,h:e}}pathSegs(){let e=this.radius();return[["E",0,0,e,e,0,0,Math.PI*2],["Z"]]}},rn=class extends nn{constructor(e={}){super(e);x(this,"data");this.data=B($([]),e.data),this.registerTarget("d",this.data,"path")}bounds(){let e=1/0,s=1/0,n=-1/0,r=-1/0;for(let i of this.data())for(let o=0;o<i.v.length;o++){let a=i.v[o][0],h=i.v[o][1],c=[[a,h],[a+i.in[o][0],h+i.in[o][1]],[a+i.out[o][0],h+i.out[o][1]]];for(let l of c)l[0]<e&&(e=l[0]),l[1]<s&&(s=l[1]),l[0]>n&&(n=l[0]),l[1]>r&&(r=l[1])}return e>n?{minX:0,minY:0,maxX:0,maxY:0}:{minX:e,minY:s,maxX:n,maxY:r}}intrinsicSize(){let e=this.bounds();return{w:e.maxX-e.minX,h:e.maxY-e.minY}}drawOffset(){let e=this.bounds();return{x:e.minX,y:e.minY}}pathSegs(){let e=[];for(let s of this.data()){let n=s.v.length;if(n!==0){e.push(["M",s.v[0][0],s.v[0][1]]);for(let r=0;r<n-1;r++)e.push(["C",s.v[r][0]+s.out[r][0],s.v[r][1]+s.out[r][1],s.v[r+1][0]+s.in[r+1][0],s.v[r+1][1]+s.in[r+1][1],s.v[r+1][0],s.v[r+1][1]]);s.closed&&n>1&&(e.push(["C",s.v[n-1][0]+s.out[n-1][0],s.v[n-1][1]+s.out[n-1][1],s.v[0][0]+s.in[0][0],s.v[0][1]+s.in[0][1],s.v[0][0],s.v[0][1]]),e.push(["Z"]))}}return e}},js,Lr=(js=class extends G{constructor(e){super(e);x(this,"assetId");x(this,"width");x(this,"height");this.assetId=e.assetId,this.width=B($(0),e.width),this.height=B($(0),e.height),this.registerTarget("width",this.width,"number"),this.registerTarget("height",this.height,"number")}intrinsicSize(){return{w:this.width(),h:this.height()}}draw(e){let s=this.width(),n=this.height();if(s<=0||n<=0)return;let r=e.resource({kind:"image",assetId:this.assetId});e.push({op:"drawImage",image:r,dst:{x:-s/2,y:-n/2,w:s,h:n}})}},x(js,"assetKind","image"),js),Xs,Rr=(Xs=class extends G{constructor(e){var s,n,r;super(e);x(this,"assetId");x(this,"at");x(this,"trimStart");x(this,"playbackRate");x(this,"clipDuration");x(this,"sourceFps");x(this,"width");x(this,"height");this.assetId=e.assetId,this.at=(s=e.at)!=null?s:0,this.trimStart=(n=e.trimStart)!=null?n:0,this.playbackRate=(r=e.playbackRate)!=null?r:1,this.clipDuration=e.clipDuration,this.sourceFps=e.sourceFps,this.width=B($(0),e.width),this.height=B($(0),e.height),this.registerTarget("width",this.width,"number"),this.registerTarget("height",this.height,"number")}mediaTime(e){let s=(e-this.at)*this.playbackRate;if(s<0||this.clipDuration!==void 0&&e-this.at>=this.clipDuration)return null;let n=this.trimStart+s;return this.sourceFps!==void 0?Math.floor(n*this.sourceFps+1e-9)/this.sourceFps:n}draw(e,s){let n=this.mediaTime(s.time);if(n===null)return;let r=this.width(),i=this.height();if(r<=0||i<=0)return;let o=e.resource({kind:"videoFrame",assetId:this.assetId,mediaT:n});e.push({op:"drawImage",image:o,dst:{x:-r/2,y:-i/2,w:r,h:i}})}},x(Xs,"assetKind","video"),Xs),Ue=class extends G{constructor(e={}){var s,n,r,i,o;super(e);x(this,"text");x(this,"fill");x(this,"fontSize");x(this,"fontFamily");x(this,"fontWeight");x(this,"fontStyle");x(this,"align");x(this,"width");x(this,"lineHeight");x(this,"reveal");this.text=B($(""),e.text),this.fill=B($("#000000"),e.fill),this.fontSize=B($(16),e.fontSize),this.fontFamily=(s=e.fontFamily)!=null?s:"sans-serif",this.fontWeight=(n=e.fontWeight)!=null?n:400,this.fontStyle=(r=e.fontStyle)!=null?r:"normal",this.align=(i=e.align)!=null?i:"left",this.width=B($(0),e.width),this.lineHeight=(o=e.lineHeight)!=null?o:1.25,this.reveal=B($(Number.POSITIVE_INFINITY),e.reveal),this.registerTarget("width",this.width,"number"),this.registerTarget("text",this.text,"string"),this.registerTarget("fill",this.fill,"color"),this.registerTarget("fontSize",this.fontSize,"number"),this.registerTarget("reveal",this.reveal,"number")}intrinsicSize(e){let s=this.text();if(!s)return{w:0,h:0};let n=E({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),r=this.width(),i=ot(s,n,r>0?r:void 0,e),o=Math.max(...i.map(a=>X(e.measureText(a,n).width)),0);return{w:r>0?r:o,h:X(n.size*this.lineHeight)*i.length}}drawOffset(e){var a,h,c;let s=(h=e!=null?e:(a=this.measurerSource)==null?void 0:a.call(this))!=null?h:Y(),n=this.intrinsicSize(s),r=E({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=(c=ot(this.text(),r,this.width()>0?this.width():void 0,s)[0])!=null?c:"",o=s.measureText(i,r).ascent;return{x:this.align==="left"?0:this.align==="center"?-n.w/2:-n.w,y:-o}}measuredSize(e){var s,n;return this.intrinsicSize((n=e!=null?e:(s=this.measurerSource)==null?void 0:s.call(this))!=null?n:Y())}lineBoxes(e){var c,l;let s=(l=e!=null?e:(c=this.measurerSource)==null?void 0:c.call(this))!=null?l:Y(),n=this.text();if(!n)return[];let r=E({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=ot(n,r,i>0?i:void 0,s),a=X(r.size*this.lineHeight),h=[];for(let u=0;u<o.length;u++){let f=o[u];if(!f)continue;let d=s.measureText(f,r),y=X(d.width),p=this.align==="left"?0:this.align==="center"?-y/2:-y;h.push({text:f,x:p,y:u*a-d.ascent,w:y,h:d.ascent+d.descent})}return h}wordBoxes(e){var c,l;let s=(l=e!=null?e:(c=this.measurerSource)==null?void 0:c.call(this))!=null?l:Y(),n=this.text();if(!n)return[];let r=E({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=ot(n,r,i>0?i:void 0,s),a=X(r.size*this.lineHeight),h=[];for(let u=0;u<o.length;u++){let f=o[u];if(!f)continue;let d=s.measureText(f,r),y=X(d.width),p=this.align==="left"?0:this.align==="center"?-y/2:-y,v=u*a-d.ascent,k=d.ascent+d.descent,m="";for(let g of Ye(f)){let b=m;m+=g;let T=g.trim();if(T==="")continue;let I=g.length-g.trimStart().length,w=s.measureText(b+g.slice(0,I),r).width,M=s.measureText(b+g.trimEnd(),r).width;h.push({text:T,line:u,x:p+w,y:v,w:M-w,h:k})}}return h}graphemes(e){var h,c;let s=(c=e!=null?e:(h=this.measurerSource)==null?void 0:h.call(this))!=null?c:Y(),n=this.text();if(!n)return[];let r=E({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=ot(n,r,i>0?i:void 0,s),a=[];for(let l of o)for(let u of bt(l))a.push(u);return a}revealHead(e){var f,d,y;let s=(d=e!=null?e:(f=this.measurerSource)==null?void 0:f.call(this))!=null?d:Y(),n=E({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),r=this.width(),i=ot(this.text(),n,r>0?r:void 0,s),o=X(n.size*this.lineHeight),a=i.reduce((p,v)=>p+bt(v).length,0),h=this.reveal(),c=Math.max(0,Math.min(Number.isFinite(h)?Math.floor(h):a,a)),l=c,u={x:0,y:0,h:0,line:0,index:c};for(let p=0;p<i.length;p++){let v=(y=i[p])!=null?y:"",k=s.measureText(v,n),m=X(k.width),g=this.align==="left"?0:this.align==="center"?-m/2:-m,b=p*o-k.ascent,T=k.ascent+k.descent,I=bt(v);if(l<=I.length)return{x:g+(l<=0?0:s.measureText(I.slice(0,l).join(""),n).width),y:b,h:T,line:p,index:c};l-=I.length,u={x:g+k.width,y:b,h:T,line:p,index:c}}return u}draw(e,s){let n=this.text();if(!n)return;let r=E({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=ot(n,r,i>0?i:void 0,s.measurer),a=X(r.size*this.lineHeight),h=this.reveal(),c=Number.isFinite(h),l=c?Math.max(0,Math.floor(h)):0;for(let u=0;u<o.length;u++){let f=o[u];if(!f)continue;if(!c){e.push(E({op:"fillText",text:f,font:r,paint:{kind:"color",color:this.fill()},x:0,y:u*a},this.align!=="left"?{align:this.align}:{}));continue}if(l<=0)break;let d=bt(f),y=Math.min(l,d.length);if(l-=y,y===d.length)e.push(E({op:"fillText",text:f,font:r,paint:{kind:"color",color:this.fill()},x:0,y:u*a},this.align!=="left"?{align:this.align}:{}));else{let p=X(s.measurer.measureText(f,r).width),v=this.align==="left"?0:this.align==="center"?-p/2:-p;e.push({op:"fillText",text:d.slice(0,y).join(""),font:r,paint:{kind:"color",color:this.fill()},x:v,y:u*a})}}}};function Nr(t,e,s){var f,d;let n=(d=s!=null?s:(f=t.measurerSource)==null?void 0:f.call(t))!=null?d:Y(),r=t.text();if(!r)return[];let i=E({family:t.fontFamily,size:t.fontSize(),weight:t.fontWeight},t.fontStyle==="italic"?{style:"italic"}:{}),o=t.width(),a=ot(r,i,o>0?o:void 0,n),h=X(i.size*t.lineHeight),c=e.keys,l=[],u=0;for(let y=0;y<a.length;y++){let p=a[y];if(!p)continue;let v=n.measureText(p,i),k=X(v.width),m=t.align==="left"?0:t.align==="center"?-k/2:-k,g=y*h-v.ascent,b="";for(let T of bt(p)){b+=T;let I=u+1,w=Number.POSITIVE_INFINITY;for(let M of c)if(M.value>=I){w=M.t;break}Number.isFinite(w)&&l.push({charIndex:u,grapheme:T,time:w,x:m+n.measureText(b,i).width,y:g,line:y}),u++}}return l}var on=class extends Error{constructor(){super("a Layout node was evaluated but no LayoutEngine is registered \u2014 await loadYogaLayoutEngine() from '@glissade/scene/layout' before mounting/rendering (the engine is wasm and loads async; evaluate() never awaits, \xA72.5)"),this.name="LayoutEngineMissingError"}},Xe=null;function Vr(t){Xe=t}function qr(){return Xe}function Wr(){if(!Xe)throw new on;return Xe}var fo=["Group","Rect","Circle","Path","Text","Image","Video","Layout","Custom"],Kr=class extends G{constructor(e){var s,n;super(e);x(this,"target");x(this,"color");x(this,"progress");x(this,"padding");x(this,"cornerRadius");this.target=e.text,this.color=Br($("#ffe066"),e.color),this.progress=Br($(1),e.progress),this.padding=(s=e.padding)!=null?s:[4,2],this.cornerRadius=(n=e.cornerRadius)!=null?n:4,this.registerTarget("progress",this.progress,"number"),this.registerTarget("color",this.color,"color")}draw(e,s){let n=Math.min(1,Math.max(0,this.progress()));if(n<=0)return;let[r,i]=this.padding,o=this.target.lineBoxes(s.measurer).map(u=>({x:u.x-r,y:u.y-i,w:u.w+2*r,h:u.h+2*i})),a=o.reduce((u,f)=>u+f.w,0);if(a<=0)return;let h=this.target.localMatrix();kt(h,vt)||e.push({op:"transform",m:h});let c=this.color(),l=n*a;for(let u of o){let f=Math.min(u.w,l);if(l-=f,f<=0)break;let d=Math.min(this.cornerRadius,f/2,u.h/2),y=e.resource({kind:"path",segs:Rt(u.x,u.y,f,u.h,d)});if(e.push({op:"fillPath",path:y,paint:{kind:"color",color:c}}),l<=0)break}}};function po(t,e={}){return new Kr(D(E({},e),{text:t}))}function Br(t,e){return typeof e=="function"?t.bindSource(e):e!==void 0&&t.set(e),t}var Qr=class extends G{constructor(e){var s,n,r,i;super(e);x(this,"target");x(this,"blinkPeriod");x(this,"blinkPhase");x(this,"solidWhileTyping");x(this,"caretWidth");x(this,"fill");this.target=e.text,this.blinkPeriod=(s=e.blinkPeriod)!=null?s:1.06,this.blinkPhase=(n=e.blinkPhase)!=null?n:0,this.solidWhileTyping=(r=e.solidWhileTyping)!=null?r:!0,this.caretWidth=(i=e.width)!=null?i:2,this.fill=mo($(""),e.fill),this.registerTarget("fill",this.fill,"color")}draw(e,s){let n=this.target.revealHead(s.measurer);if(n.h<=0)return;let r=!0,i=this.target.graphemes(s.measurer).length,o=n.index<i;if(!(this.solidWhileTyping&&o)){let l=this.blinkPeriod>0?this.blinkPeriod:1;r=((s.time-this.blinkPhase)%l+l)%l<l/2}if(!r)return;let a=this.target.localMatrix();kt(a,vt)||e.push({op:"transform",m:a});let h=this.fill()||this.target.fill(),c=e.resource({kind:"path",segs:Rt(n.x,n.y,this.caretWidth,n.h,0)});e.push({op:"fillPath",path:c,paint:{kind:"color",color:h}})}};function go(t,e={}){return new Qr(D(E({},e),{text:t}))}function mo(t,e){return typeof e=="function"?t.bindSource(e):e!==void 0&&t.set(e),t}var yo=.06;function wo(t,e,s={}){var u,f,d,y;let n=(u=s.start)!=null?u:0,r=(f=s.perChar)!=null?f:yo,i=(d=s.gap)!=null?d:0,o=n,a=[],h=[nt(n,"",{interp:"hold"})],c=[],l=[];for(let p=0;p<e.length;p++){let v=e[p],k=o,m=(y=v.perChar)!=null?y:r;if(v.type!==void 0)for(let g of bt(v.type)){o+=m,a.push(g);let b=a.join("");h.push(nt(o,b,{interp:"hold"})),c.push({time:o,kind:"insert",grapheme:g,value:b})}if(v.delete!==void 0)for(let g=0;g<v.delete&&a.length>0;g++){o+=m;let b=a.pop(),T=a.join("");h.push(nt(o,T,{interp:"hold"})),c.push({time:o,kind:"delete",grapheme:b,value:T})}v.hold!==void 0&&(o+=v.hold),l.push({index:p,start:k,end:o,value:a.join("")}),i>0&&p<e.length-1&&(o+=i)}return{track:Gt(t,"string",h),marks:c,steps:l,duration:o}}var Nt=class extends Error{constructor(t){super(t),this.name="EachError"}};function an(t,e){let s=(t^Math.imul(e+1,2654435769))>>>0;return s=Math.imul(s^s>>>16,569420461),s=Math.imul(s^s>>>15,1935289751),(s^s>>>15)>>>0}var bo=1779033703;function ko(t,e,s){var n,r,i,o,a,h,c,l,u,f,d,y;if(typeof t=="function")return t(e,s);switch(t.kind){case"row":{let p=(n=t.gap)!=null?n:s>1?1/(s-1):0,v=(r=t.align)!=null?r:.5,k=.5-p*(s-1)/2;return[s===1?.5:k+p*e,v]}case"column":{let p=(i=t.gap)!=null?i:s>1?1/(s-1):0,v=(o=t.align)!=null?o:.5,k=.5-p*(s-1)/2;return[v,s===1?.5:k+p*e]}case"grid":{let p=t.cols;if(!(p>=1))throw new Nt(`grid layout needs cols >= 1 (got ${p})`);let v=(a=t.rows)!=null?a:Math.ceil(s/p),k=(h=t.order)!=null?h:"row",m=k==="row"?e%p:Math.floor(e/v),g=k==="row"?Math.floor(e/p):e%v,b=(c=t.gapX)!=null?c:p>1?1/(p-1):0,T=(l=t.gapY)!=null?l:v>1?1/(v-1):0,I=b*(p-1),w=T*(v-1);return[p===1?.5:.5-I/2+b*m,v===1?.5:.5-w/2+T*g]}case"ring":{let p=(u=t.radius)!=null?u:.5,[v,k]=(f=t.center)!=null?f:[.5,.5],m=((d=t.startAngle)!=null?d:-Math.PI/2)+((y=t.sweep)!=null?y:Math.PI*2)*(s===0?0:e/s);return[v+p*Math.cos(m),k+p*Math.sin(m)]}}}function vo(t,e,s){let n=(s-1)/2;switch(t){case"from-center":return r=>Math.abs(r-n)*e;case"from-edges":return r=>(n-Math.abs(r-n))*e;case"delay":return r=>r*e}}function xo(t,e){var n,r;let s=(n=t.stagger)!=null?n:0;return typeof s=="function"?s:vo((r=t.distribute)!=null?r:"delay",s,e)}function Mo(t,e,s){var d,y,p,v,k,m;if(!Number.isInteger(t)||t<0)throw new Nt(`each() count must be a non-negative integer (got ${t})`);let n=((d=s.seed)!=null?d:sn(s.id))>>>0,r=s.box,[i,o]=(y=r==null?void 0:r.origin)!=null?y:[0,0],a=[],h=[],c=new Set;for(let g=0;g<t;g++){let b=`${s.id}/${g}`,T=ko(s.layout,g,t),I={i:g,n:t,id:b,place:T,rng:it(an(n,g)),seed:n},w=e(g,I);if(!(w instanceof G))throw new Nt(`each() factory must return a Node for index ${g} (got ${typeof w})`);if(c.has(w))throw new Nt(`each() factory returned the same Node instance for index ${g} \u2014 the factory must construct a new node per index (it is called once per clone)`);if(c.add(w),w.id===void 0)w.id=b;else if(w.id!==b)throw new Nt(`each() factory set id '${w.id}' on index ${g}, but each owns the id namespace \u2014 leave it unset so it becomes '${b}'`);a.push(w),h.push(r?{frac:T,px:[i+T[0]*r.w,o+T[1]*r.h]}:{frac:T})}let l=new xt({id:s.id,children:a}),u=[],f=(v=(p=s.motion)==null?void 0:p.startSec)!=null?v:0;if(s.motion){let g=s.motion,b=(k=g.startSec)!=null?k:0,T=xo(g,t);for(let I=0;I<t;I++){let w=it(an(an(n,I),bo)),M=(m=g.jitter)==null?void 0:m.call(g,I,w,t),S=E(E({},M!==void 0?{overrides:M}:{}),g.speed!==void 0?{speed:g.speed}:{}),C=g.clip.apply(`${s.id}/${I}`,b+T(I),S);u.push(...C.tracks),C.end>f&&(f=C.end)}}return{node:l,children:a,tracks:u,end:f,places:h}}function Jr(t,e={}){var i,o,a;let s=(i=e.start)!=null?i:0,n=(o=e.duration)!=null?o:1,r=(a=e.ease)!=null?a:"easeInOutCubic";return Gt(`${t}/reveal`,"number",[nt(s,0),nt(s+n,1,r)])}function So(t,e={}){var n,r;let s=(r=e.delay)!=null?r:((n=e.duration)!=null?n:1)*.6;return $e(t.map(i=>Jr(i,e)),s)}var Zr=class extends Error{constructor(t){super(`'${t}' was called inside evaluate() \u2014 scene code must be a pure function of time (\xA75.5). Read ctx.time/frame, use the seeded random(seed) from @glissade/core, and resolve assets before rendering.`),this.name="DeterminismViolationError"}};function To(){let t=globalThis,e=[{target:Math,key:"random",label:"Math.random"},{target:Date,key:"now",label:"Date.now"},{target:t,key:"setTimeout",label:"setTimeout"},{target:t,key:"setInterval",label:"setInterval"}];return typeof performance!="undefined"&&e.push({target:performance,key:"now",label:"performance.now"}),typeof t.requestAnimationFrame=="function"&&e.push({target:t,key:"requestAnimationFrame",label:"requestAnimationFrame"}),e}function Eo(t,e){if(t==="off")return e();let s=To(),n=s.map(i=>i.target[i.key]),r=new Set;s.forEach((i,o)=>{i.target[i.key]=(...a)=>{if(t==="throw")throw new Zr(i.label);return r.has(i.label)||(r.add(i.label),q(`${i.label} called inside evaluate() \u2014 nondeterministic, not reproducible on export (\xA75.5)`)),n[o].apply(i.target,a)}});try{return e()}finally{s.forEach((i,o)=>{i.target[i.key]=n[o]})}}var ti=class extends Error{constructor(t){super(`duplicate node id '${t}' \u2014 explicit ids must be unique (\xA73.1/\xA76.5)`),this.name="DuplicateNodeIdError"}},ei=class extends Error{constructor(t){super(`node id '${t}' uses the reserved '~' prefix \u2014 that namespace is for structural fallback ids (\xA76.5), which are inspection-only and never track targets; choose another id`),this.name="ReservedNodeIdError"}};function si(t,e,s){if(t.measurerSource=s,t.id!==void 0){if(t.id.startsWith("~"))throw new ei(t.id);if(e.has(t.id))throw new ti(t.id);e.set(t.id,t)}if(t instanceof xt)for(let n of t.children)si(n,e,s)}function Io(t){let e=new xt({id:"__root",children:t.children}),s=new Map,n=Ve(),r=$(null);return si(e,s,()=>{var i;return(i=r())!=null?i:Y()}),{root:e,nodes:s,size:t.size,playhead:n,resolveTarget:i=>{for(let o=i.lastIndexOf("/");o>0;o=i.lastIndexOf("/",o-1)){let a=s.get(i.slice(0,o));if(a)return a.resolveTarget(i.slice(o+1))}},setTextMeasurer:i=>{r.set(i)},get textMeasurer(){var i;return(i=r.peek())!=null?i:Y()}}}var _r=new WeakMap;function ni(t,e){let s=_r.get(t);s||(s=new WeakMap,_r.set(t,s));let n=s.get(e);if(!n){let r=tt(e);n={compiled:r,bound:Ws(r,t.resolveTarget,t.playhead)},s.set(e,n)}return n}function ae(t,e,s){ni(t,e);let n=e.fps,r={time:s,frame:n!==void 0?Math.round(s*n):-1,measurer:t.textMeasurer};return Bs(t.playhead,s,()=>{let i=ne(t.size);return t.root.emit(i,r),i.finish()})}function Ke(t){return JSON.stringify(t,Lt)}function $o(t,e,s){let n=t(),r=t(),i=ae(n,e,s),o=ae(r,e,s);if(Ke(i)===Ke(o))return{ok:!0};let a=e.fps!==void 0?Math.round(s*e.fps):-1,h={time:s,frame:a,measurer:n.textMeasurer},c={time:s,frame:a,measurer:r.textMeasurer},l;for(let[u,f]of n.nodes){let d=r.nodes.get(u);if(!d)return{ok:!1,node:u};let y=ne(n.size);f.emit(y,h);let p=ne(r.size);d.emit(p,c);let v=y.finish(),k=p.finish();if(Ke(v)===Ke(k))continue;if(f instanceof xt){l!=null||(l=u);continue}let m=Ys(v,k).deltas[0];return E({ok:!1,node:u},m!==void 0?{delta:m}:{})}return E({ok:!1},l!==void 0?{node:l}:{})}var fn=new Set(["blur","drop-shadow","brightness","contrast","saturate"]),jr=t=>t<0?0:t>1?1:t;function Xr(t,e,s,n,r){let i=1-r,o=i*i*i,a=3*i*i*r,h=3*i*r*r,c=r*r*r;return[o*t[0]+a*e[0]+h*s[0]+c*n[0],o*t[1]+a*e[1]+h*s[1]+c*n[1]]}function Co(t){let e=[];for(let s of t){let n=s.v.length;for(let r=0;r<n-1;r++)e.push([s.v[r],[s.v[r][0]+s.out[r][0],s.v[r][1]+s.out[r][1]],[s.v[r+1][0]+s.in[r+1][0],s.v[r+1][1]+s.in[r+1][1]],s.v[r+1]]);s.closed&&n>1&&e.push([s.v[n-1],[s.v[n-1][0]+s.out[n-1][0],s.v[n-1][1]+s.out[n-1][1]],[s.v[0][0]+s.in[0][0],s.v[0][1]+s.in[0][1]],s.v[0]])}return e}function ce(t,e={}){var l,u;let s=Math.max(1,Math.floor((l=e.samplesPerSegment)!=null?l:32)),n=Co(t),r=[],i=[];if(n.length>0){let f=Xr(...n[0],0);r.push(f),i.push(0);let d=0;for(let y of n)for(let p=1;p<=s;p++){let v=Xr(...y,p/s);d+=Math.hypot(v[0]-f[0],v[1]-f[1]),r.push(v),i.push(d),f=v}}else{let f=(u=t[0])==null?void 0:u.v[0];r.push(f?[f[0],f[1]]:[0,0]),i.push(0)}let o=i[i.length-1],a=f=>{if(o<=0||f<=0)return{i:0,f:0};if(f>=o)return{i:r.length-2,f:1};let d=0;for(;d<i.length-1&&i[d+1]<f;)d++;let y=i[d+1]-i[d];return{i:d,f:y>0?(f-i[d])/y:0}},h=f=>{if(r.length===1)return[r[0][0],r[0][1]];let{i:d,f:y}=a(f),p=r[d],v=r[d+1];return[p[0]+(v[0]-p[0])*y,p[1]+(v[1]-p[1])*y]},c=f=>{if(r.length===1)return[1,0];let{i:d}=a(f),y=r[d],p=r[d+1],v=p[0]-y[0],k=p[1]-y[1],m=Math.hypot(v,k);return m>0?[v/m,k/m]:[1,0]};return{length:o,at:h,tangentAt:c,atProgress:f=>h(jr(f)*o),tangentAtProgress:f=>c(jr(f)*o)}}function Po(t){return ce(t).length}function Ao(t,e){return ce(t).at(e)}var ri=class extends G{constructor(e){var a;super(e);x(this,"target");x(this,"progress");this.target=e.target,this.progress=$(1),typeof e.progress=="function"?this.progress.bindSource(e.progress):e.progress!==void 0&&this.progress.set(e.progress),this.registerTarget("progress",this.progress,"number");let s=e.samplesPerSegment!==void 0?{samplesPerSegment:e.samplesPerSegment}:{},n=e.path instanceof rn?()=>e.path.data():()=>e.path,r=n(),i=ce(r,s),o=()=>{let h=n();return h!==r&&(r=h,i=ce(h,s)),i};if(e.target.position.bindSource(()=>o().atProgress(this.progress())),e.orient){let h=(a=e.orientOffset)!=null?a:0;e.target.rotation.bindSource(()=>{let c=o().tangentAtProgress(this.progress());return Math.atan2(c[1],c[0])*180/Math.PI+h})}}draw(){}};function Oo(t,e,s={}){return new ri(D(E({},s),{target:t,path:e}))}var le=class extends Error{constructor(t){super(t),this.name="TokenMatchError"}},ln=t=>t.replace(/\s+/g,"");function hn(t,e,s=1){let n=ln(e);if(n.length===0)throw new le("empty token");let r=0;for(let i=0;i<t.length;i++){let o="";for(let a=i;a<t.length;a++){if(o+=ln(t[a].text),o===n){if(r++,r===s)return[i,a];break}if(!n.startsWith(o))break}}throw new le(`no match for token '${e}'${s>1?` (occurrence ${s})`:""} \u2014 segments are [${t.map(i=>`'${i.text}'`).join(", ")}]`)}var ii=class extends G{constructor(e){var n,r,i;super(e);x(this,"target");x(this,"padding");x(this,"cornerRadius");x(this,"rematch");x(this,"ranges");this.target=e.text,this.padding=(n=e.padding)!=null?n:[4,2],this.cornerRadius=(r=e.cornerRadius)!=null?r:4,this.rematch=(i=e.rematch)!=null?i:!1;let s=this.target.wordBoxes();this.ranges=e.ranges.map((o,a)=>{var u;let h=this.resolveRun(s,o),c=(u=o.id)!=null?u:`r${a}`,l={spec:o,fill:Qe($("#ffe066"),o.fill),opacity:Qe($(1),o.opacity),progress:Qe($(1),o.progress),scale:Qe($(1),o.scale),offset:zo(zt([0,0]),o.offset),run:h,bound:Hr(s,h)};return this.registerTarget(`${c}/fill`,l.fill,"color"),this.registerTarget(`${c}/opacity`,l.opacity,"number"),this.registerTarget(`${c}/progress`,l.progress,"number"),this.registerTarget(`${c}/scale`,l.scale,"number"),this.registerTarget(`${c}/offset`,l.offset,"vec2"),this.registerTarget(`${c}/offset.x`,l.offset.x,"number"),this.registerTarget(`${c}/offset.y`,l.offset.y,"number"),l})}resolveRun(e,s){var n;if(typeof s.match!="string"){let[r,i]=s.match;if(r<0||i>=e.length||r>i)throw new le(`word index range [${r}, ${i}] out of bounds (${e.length} boxes)`);return[r,i]}return hn(e,s.match,(n=s.occurrence)!=null?n:1)}draw(e,s){var h;let n=this.target.wordBoxes(s.measurer);if(n.length===0)return;let r=this.target.localMatrix(),[i,o]=this.padding,a=!1;for(let c of this.ranges){let l=c.opacity();if(l<=0)continue;let u=Math.min(1,Math.max(0,c.progress()));if(u<=0)continue;let f=c.run;if(this.rematch&&typeof c.spec.match=="string")f=hn(n,c.spec.match,(h=c.spec.occurrence)!=null?h:1);else if(Hr(n,f)!==c.bound)throw new le(`bound token '${c.bound}' no longer matches boxes [${f[0]}, ${f[1]}] \u2014 the text changed (segments now [${n.slice(f[0],f[1]+1).map(b=>`'${b.text}'`).join(", ")}]); pass rematch: true for animated text`);let d=[];for(let b=f[0];b<=f[1];b++){let T=n[b],I=d[d.length-1],w=b>f[0]&&n[b-1].line===T.line?I:void 0;w?(w.w=T.x+T.w+i-w.x,w.y=Math.min(w.y,T.y-o),w.h=Math.max(w.h,T.y+T.h+o-w.y)):d.push({x:T.x-i,y:T.y-o,w:T.w+2*i,h:T.h+2*o})}!a&&!kt(r,vt)&&(e.push({op:"transform",m:r}),a=!0);let y=l<1;y&&e.push({op:"pushGroup",opacity:l,blend:"source-over",filters:[]});let p=c.fill(),v=c.scale(),[k,m]=c.offset(),g=u*d.reduce((b,T)=>b+T.w,0);for(let b of d){let T=Math.min(b.w,g);if(g-=T,T<=0)break;let I=b.x+b.w/2+k,w=b.y+b.h/2+m,M=T*v,S=b.h*v,C=I-b.w/2*v,L=w-S/2,R=Math.min(this.cornerRadius,M/2,S/2),K=e.resource({kind:"path",segs:Rt(C,L,M,S,R)});if(e.push({op:"fillPath",path:K,paint:{kind:"color",color:p}}),g<=0)break}y&&e.push({op:"popGroup"})}}};function Hr(t,e){return t.slice(e[0],e[1]+1).map(s=>ln(s.text)).join("")}function Do(t,e){return new ii(D(E({},e),{text:t}))}function Qe(t,e){return typeof e=="function"?t.bindSource(e):e!==void 0&&t.set(e),t}function zo(t,e){return typeof e=="function"?t.bindSource(e):e!==void 0&&t.set(e),t}function oi(t){let e=[],s=n=>{if(n instanceof Ue){let r=n.text();r&&e.push({family:n.fontFamily,text:r})}if(n instanceof xt)for(let r of n.children)s(r)};return s(t.root),e}function Fo(t){let e=t.indexOf("/");return e>=0?t.slice(0,e):t}function Lo(t,e){let s=[];for(let n of e.tracks){if(n.type!=="string")continue;let r=t.nodes.get(Fo(n.target));if(r instanceof Ue)for(let i of n.keys){let o=i.value;typeof o=="string"&&o&&s.push({family:r.fontFamily,text:o})}}return s}async function dn(t,e,s,n={}){var c,l;let r=(c=n.mode)!=null?c:"dev",i=Zt(e.assets),o=[...oi(t),...(l=n.extraUsages)!=null?l:[]],a=new Set;for(let u of o)if(i.has(u.family))for(let f of i.fallbackChain(u.family))a.add(f);let h=new Map;for(let u of a){let f=i.resolveFace(u);if(!f)continue;let d=await s(f.url);d&&h.set(u,Ae(d))}return qs(o,i,h,r,E({},n.osFamilies!==void 0?{osFamilies:n.osFamilies}:{}))}var oe=class extends Error{constructor(e,s,n){super(`asset '${e}' not ready: ${s}. evaluate() never awaits \u2014 warm assets before evaluating (\xA72.5 readiness precondition)`);x(this,"assetId");x(this,"detail");x(this,"mediaT");this.name="ColdAssetError",this.assetId=e,this.detail=s,this.mediaT=n}},Ro=class extends xt{constructor(e){var n;super(e);x(this,"wgsl");x(this,"uniformSignals");this.wgsl=e.wgsl;let s=new Map;for(let[r,i]of Object.entries((n=e.uniforms)!=null?n:{})){let o=$(i);s.set(r,o),this.registerTarget(`u.${r}`,o,"number")}this.uniformSignals=s}uniform(e){let s=this.uniformSignals.get(e);if(!s)throw new Error(`ShaderEffect has no uniform '${e}' (have: ${[...this.uniformSignals.keys()].join(", ")})`);return s}groupShader(){let e={};for(let[s,n]of this.uniformSignals)e[s]=n();return{wgsl:this.wgsl,uniforms:e}}},No=t=>t*t*(3-2*t),Vo=2.4,qo=1-Math.exp(-5.76/2),Wo=t=>(1-Math.exp(-((t*Vo)**2)/2))/qo;function Bo(t,e){if(e==="linear"||t.length<2)return t;let s=e==="gaussian"?Wo:No,n=t[0].offset,r=t[t.length-1].offset-n;if(r<=0)return t;let i=[],o=0;for(let a=0;a<64;a++){let h=n+r*(a/63);for(;o<t.length-2&&h>t[o+1].offset;)o++;let c=t[o],l=t[o+1],u=l.offset-c.offset,f=u>0?Math.min(1,Math.max(0,(h-c.offset)/u)):0;i.push({offset:h,color:lt(c.color,l.color,s(f))})}return i}var _o=4,jo=2,un=.32,Yr=1e-6,Gr=1024;function ai(t,e,s){let n=new Uint8ClampedArray(Math.max(1,e)*Math.max(1,s)*4),r=t.points.map(h=>({u:h.pos[0],v:h.pos[1],lab:Tt(ht(h.color))})),i=t.bg!==void 0?Tt(ht(t.bg)):null,o=t.interpolation==="gaussian",a=2*un*un;for(let h=0;h<s;h++){let c=s>1?(h+.5)/s:.5;for(let l=0;l<e;l++){let u=e>1?(l+.5)/e:.5,f=0,d=0,y=0,p=0,v=0;i&&(f=1,d=i.L,y=i.a,p=i.b,v=i.alpha);let k=!1;for(let b=0;b<r.length;b++){let T=r[b],I=u-T.u,w=c-T.v,M=I*I+w*w;if(M<=Yr*Yr){d=T.lab.L,y=T.lab.a,p=T.lab.b,v=T.lab.alpha,k=!0;break}let S;o?S=Math.exp(-M/a):S=1/M,f+=S,d+=S*T.lab.L,y+=S*T.lab.a,p+=S*T.lab.b,v+=S*T.lab.alpha}let m;if(k)m=At({L:d,a:y,b:p,alpha:v});else if(f>0){let b=1/f;m=At({L:d*b,a:y*b,b:p*b,alpha:v*b})}else m={r:0,g:0,b:0,a:0};let g=(h*e+l)*4;n[g]=m.r,n[g+1]=m.g,n[g+2]=m.b,n[g+3]=Math.round(m.a*255)}}return n}function ci(t,e){return{w:Math.min(Gr,Math.max(1,Math.ceil(Math.abs(t)/4))),h:Math.min(Gr,Math.max(1,Math.ceil(Math.abs(e)/4)))}}var Ur=!1;function Xo(t){var e,s,n;return Ur||(Ur=!0,q("mesh Paint on a stroke/text resolves to a representative solid color (mesh fill is supported only on filled paths, \xA73 Paint) \u2014 use a fillPath for the mesh gradient")),(n=(s=t.bg)!=null?s:(e=t.points[0])==null?void 0:e.color)!=null?n:"#00000000"}function cn(t,e,s){if(e.kind==="color")return e.color;if(e.kind==="mesh")return Xo(e);let n;if(e.kind==="radial"){let i=e.center?e.center[0]:s?(s.minX+s.maxX)/2:0,o=e.center?e.center[1]:s?(s.minY+s.maxY)/2:0,a=e.radius!==void 0?e.radius:s?Math.hypot(s.maxX-s.minX,s.maxY-s.minY)/2:0;n=t.createRadialGradient(i,o,0,i,o,a)}else{let i=e.from?e.from[0]:s?(s.minX+s.maxX)/2:0,o=e.from?e.from[1]:s?s.minY:0,a=e.to?e.to[0]:s?(s.minX+s.maxX)/2:0,h=e.to?e.to[1]:s?s.maxY:0;n=t.createLinearGradient(i,o,a,h)}let r=e.interpolation?Bo(e.stops,e.interpolation):e.stops;for(let i of r)n.addColorStop(i.offset,i.color);return n}function Je(t){return`${t.style==="italic"?"italic ":""}${t.weight!==void 0&&t.weight!==400?`${t.weight} `:""}${t.size}px ${t.family}`}var Ho=16;function Yo(t){let e=s=>Object.is(s,-0)?"0":String(Math.round(s*1e4)/1e4);return`${e(t[0])},${e(t[1])},${e(t[2])},${e(t[3])},${e(t[4])},${e(t[5])}`}function Go(t){let e=0;for(let s of t!=null?t:[])s.kind==="blur"?e+=3*s.radius:s.kind==="drop-shadow"&&(e+=Math.max(Math.abs(s.dx),Math.abs(s.dy))+3*s.blur);return e}function li(t,e,s){return t?(e<t.minX&&(t.minX=e),s<t.minY&&(t.minY=s),e>t.maxX&&(t.maxX=e),s>t.maxY&&(t.maxY=s),t):{minX:e,minY:s,maxX:e,maxY:s}}function ie(t,e,s,n,r,i){for(let[o,a]of[[s,n],[r,n],[s,i],[r,i]])t.bounds=li(t.bounds,e[0]*o+e[2]*a+e[4],e[1]*o+e[3]*a+e[5])}function Uo(t){let e=null,s=(n,r)=>{e=li(e,n,r)};for(let n of t)switch(n[0]){case"M":case"L":s(n[1],n[2]);break;case"C":s(n[1],n[2]),s(n[3],n[4]),s(n[5],n[6]);break;case"Q":s(n[1],n[2]),s(n[3],n[4]);break;case"E":{let r=Math.max(n[3],n[4]);s(n[1]-r,n[2]-r),s(n[1]+r,n[2]+r);break}}return e}var pn=class{constructor(t,e="warn",s=(i=>(i=(r=>(r=(n=>(n=globalThis.process)==null?void 0:n.env)())==null?void 0:r.RASTER_CACHE)())!=null?i:"1")()!=="0"){x(this,"host");x(this,"shaderCaps");x(this,"pool",[]);x(this,"pathCache",new WeakMap);x(this,"pathBoundsCache",new WeakMap);x(this,"images",new Map);x(this,"videos",new Map);x(this,"warnedShaders",!1);x(this,"rasterCache",new Map);x(this,"cacheEnabled");this.host=t,this.shaderCaps=e,this.cacheEnabled=s}setImageAsset(t,e){this.images.set(t,e)}setVideoAsset(t,e){this.videos.set(t,e)}dispose(){this.pool.length=0,this.rasterCache.clear()}resolveDrawable(t,e){if(t.kind==="image"){let s=this.images.get(t.assetId);if(!s)throw new oe(t.assetId,"no decoded image registered");return s}if(t.kind==="videoFrame"){let s=this.videos.get(t.assetId);if(!s)throw new oe(t.assetId,"no VideoFrameSource registered",t.mediaT);try{return s.getFrameSync(t.mediaT)}catch(n){throw n instanceof oe?new oe(t.assetId,n.detail,t.mediaT):n}}throw new Error(`resource ${e} is not drawable`)}path(t,e){let s=t[e];if(!s||s.kind!=="path")throw new Error(`resource ${e} is not a path`);let n=this.pathCache.get(s);return n||(n=this.buildPath(s.segs),this.pathCache.set(s,n)),n}pathBounds(t,e){var n;let s=t[e];return!s||s.kind!=="path"?null:(this.pathBoundsCache.has(s)||this.pathBoundsCache.set(s,Uo(s.segs)),(n=this.pathBoundsCache.get(s))!=null?n:null)}buildPath(t){let e=this.host.newPath();for(let s of t)switch(s[0]){case"M":e.moveTo(s[1],s[2]);break;case"L":e.lineTo(s[1],s[2]);break;case"C":e.bezierCurveTo(s[1],s[2],s[3],s[4],s[5],s[6]);break;case"Q":e.quadraticCurveTo(s[1],s[2],s[3],s[4]);break;case"E":e.ellipse(s[1],s[2],s[3],s[4],s[5],s[6],s[7]);break;case"Z":e.closePath();break}return e}acquire(t,e){let s=this.pool.pop();return s?(s.width!==t&&(s.width=t),s.height!==e&&(s.height=e),s):this.host.createCanvas(t,e)}release(t){this.pool.length<8&&this.pool.push(t)}cacheStore(t,e){let s=this.rasterCache.get(t);for(s&&(this.rasterCache.delete(t),s.canvas!==e.canvas&&this.release(s.canvas)),this.rasterCache.set(t,e);this.rasterCache.size>Ho;){let n=this.rasterCache.keys().next().value;if(n===void 0)break;let r=this.rasterCache.get(n);this.rasterCache.delete(n),this.release(r.canvas)}}cacheTouch(t){let e=this.rasterCache.get(t);return e&&(this.rasterCache.delete(t),this.rasterCache.set(t,e)),e}fillMesh(t,e,s,n){let r=n.maxX-n.minX,i=n.maxY-n.minY;if(r<=0||i<=0)return;let{w:o,h:a}=ci(r,i),h=ai(s,o,a),c=this.acquire(o,a),l=this.host.context(c),u=l.createImageData(o,a);u.data.set(h),l.putImageData(u,0,0),t.save(),t.clip(e,"nonzero"),t.imageSmoothingEnabled=!0,t.drawImage(c,0,0,o,a,n.minX,n.minY,r,i),t.restore(),this.release(c)}composite(t,e,s,n,r,i,o,a,h,c,l,u){let f=h!==void 0&&h!=="none",d=f?Go(c):0;r||a!=="source-over"?e.unbounded=!0:n&&ie(e,vt,n.minX-d,n.minY-d,n.maxX+d,n.maxY+d);let y=f&&!i&&!r&&a==="source-over";if(!(y&&n===null)){if(t.save(),t.resetTransform(),y&&n){let p=Math.max(0,Math.floor(n.minX-d)),v=Math.max(0,Math.floor(n.minY-d)),k=Math.min(l,Math.ceil(n.maxX+d)),m=Math.min(u,Math.ceil(n.maxY+d));if(p>=k||v>=m){t.restore();return}let g=this.host.newPath();g.moveTo(p,v),g.lineTo(k,v),g.lineTo(k,m),g.lineTo(p,m),g.closePath(),t.clip(g,"nonzero")}t.globalAlpha=o,f&&(t.filter=h),t.globalCompositeOperation=a,t.drawImage(s,0,0),t.restore()}}render(t,e){var u,f,d,y,p,v,k,m,g,b,T;let{w:s,h:n}=e.size;t.width!==s&&(t.width=s),t.height!==n&&(t.height=n);let r=this.host.context(t);r.resetTransform(),r.clearRect(0,0,s,n);let i=[{ctx:r,canvas:null,opacity:1,blend:"source-over",bounds:null,unbounded:!1}],o=()=>i[i.length-1].ctx,a=()=>i[i.length-1],h=vt,c=[],l=e.commands;for(let I=0;I<l.length;I++){let w=l[I];switch(w.op){case"save":c.push(h),o().save();break;case"restore":h=(u=c.pop())!=null?u:h,o().restore();break;case"transform":h=ee(h,w.m),o().transform(w.m[0],w.m[1],w.m[2],w.m[3],w.m[4],w.m[5]);break;case"clip":o().clip(this.path(e.resources,w.path),(f=w.rule)!=null?f:"nonzero");break;case"fillPath":{let M=o(),S=this.pathBounds(e.resources,w.path);w.paint.kind==="mesh"&&S?this.fillMesh(M,this.path(e.resources,w.path),w.paint,S):(M.fillStyle=cn(M,w.paint,S),M.fill(this.path(e.resources,w.path))),S&&ie(a(),h,S.minX,S.minY,S.maxX,S.maxY);break}case"strokePath":{let M=o(),S=this.pathBounds(e.resources,w.path);if(M.strokeStyle=cn(M,w.paint,S),M.lineWidth=w.stroke.width,M.lineCap=(d=w.stroke.cap)!=null?d:"butt",M.lineJoin=(y=w.stroke.join)!=null?y:"miter",w.stroke.dash&&(M.setLineDash(w.stroke.dash),M.lineDashOffset=(p=w.stroke.dashOffset)!=null?p:0),M.stroke(this.path(e.resources,w.path)),w.stroke.dash&&(M.setLineDash([]),M.lineDashOffset=0),S){let C=w.stroke.width*(((v=w.stroke.join)!=null?v:"miter")==="miter"?5:1);ie(a(),h,S.minX-C,S.minY-C,S.maxX+C,S.maxY+C)}break}case"fillText":{let M=o();M.font=Je(w.font),M.fillStyle=cn(M,w.paint,null),M.textBaseline="alphabetic",M.textAlign=(k=w.align)!=null?k:"left",M.fillText(w.text,w.x,w.y);try{let S=M.measureText(w.text).width,C=(m=w.align)!=null?m:"left",L=C==="center"?w.x-S/2:C==="right"?w.x-S:w.x,R=w.font.size;ie(a(),h,L-R,w.y-1.5*R,L+S+R,w.y+.75*R)}catch(S){a().unbounded=!0}break}case"drawImage":{let M=e.resources[w.image];if(!M)throw new Error(`drawImage references missing resource ${w.image}`);let S=this.resolveDrawable(M,w.image),C=o();w.smoothing!==void 0&&(C.imageSmoothingEnabled=w.smoothing);let{x:L,y:R,w:K,h:ct}=w.dst;w.src?C.drawImage(S,w.src.x,w.src.y,w.src.w,w.src.h,L,R,K,ct):C.drawImage(S,L,R,K,ct),ie(a(),h,L,R,L+K,R+ct);break}case"pushGroup":{let M=o(),S=this.cacheEnabled&&w.cacheKey!==void 0&&w.shader===void 0?`${w.cacheKey}@${Yo(h)}`:void 0;if(S!==void 0){let R=this.cacheTouch(S);if(R){this.composite(M,a(),R.canvas,R.bounds,R.unbounded,!1,w.opacity,w.blend,He(w.filters),w.filters,s,n);let K=1;for(;K>0&&++I<l.length;){let ct=l[I];ct.op==="pushGroup"?K++:ct.op==="popGroup"&&K--}break}}let C=this.acquire(s,n),L=this.host.context(C);L.resetTransform(),L.clearRect(0,0,s,n),L.setTransform(M.getTransform()),i.push(E(D(E({ctx:L,canvas:C,opacity:w.opacity,blend:w.blend,filter:He(w.filters),filters:w.filters},w.shader!==void 0?{shader:w.shader}:{}),{bounds:null,unbounded:!1}),S!==void 0?{cacheStoreKey:S}:{}));break}case"popGroup":{let M=i.pop();if(!M||M.canvas===null)throw new Error("popGroup without matching pushGroup");let S=o(),C=M.canvas,L=!1;if(M.shader!==void 0){let R=(T=(b=(g=this.host).applyShader)==null?void 0:b.call(g,M.canvas,M.shader,s,n))!=null?T:null;if(R!==null)C=R,L=!0,M.bounds={minX:0,minY:0,maxX:s,maxY:n},M.unbounded=!1;else{if(this.shaderCaps==="error")throw new Error("a ShaderEffect reached a backend without a shader runner (\xA73.7) \u2014 load @glissade/effects-webgpu in the browser, or accept passthrough with caps.shaders: warn");this.warnedShaders||(this.warnedShaders=!0,q("ShaderEffect pass skipped: no shader runner here (headless or webgpu-less browser) \u2014 subtree composites unfiltered (\xA73.7 caps.shaders)"))}}this.composite(S,a(),C,M.bounds,M.unbounded,L,M.opacity,M.blend,M.filter,M.filters,s,n),M.cacheStoreKey!==void 0&&!L?this.cacheStore(M.cacheStoreKey,{canvas:M.canvas,bounds:M.bounds,unbounded:M.unbounded}):this.release(M.canvas);break}}}if(i.length!==1)throw new Error("unbalanced pushGroup/popGroup in DisplayList")}};var he=null;function hi(t){he=t}function Ko(t,e){if(typeof OffscreenCanvas!="undefined")return new OffscreenCanvas(t,e);let s=document.createElement("canvas");return s.width=t,s.height=e,s}var Qo=16384,Ze=class{constructor(t,e={}){x(this,"target");x(this,"raster");var s;this.target=t,this.raster=new pn({context:n=>this.context(n),createCanvas:(n,r)=>Ko(n,r),newPath:()=>new Path2D,applyShader:(n,r,i,o)=>{var a;return(a=he==null?void 0:he.apply(n,r,i,o))!=null?a:null}},(s=e.shaderCaps)!=null?s:"warn")}get caps(){return{filters:fn,shaders:he!==null,maxTextureSize:Qo}}setImageAsset(t,e){this.raster.setImageAsset(t,e)}setVideoAsset(t,e){this.raster.setVideoAsset(t,e)}measureText(t,e){let s=this.context(this.target);s.save(),s.font=Je(e);let n=s.measureText(t);return s.restore(),{width:n.width,ascent:n.actualBoundingBoxAscent,descent:n.actualBoundingBoxDescent}}render(t){this.raster.render(this.target,t)}async readPixels(){return this.context(this.target).getImageData(0,0,this.target.width,this.target.height).data}dispose(){this.raster.dispose()}context(t){let e=t.getContext("2d");if(!e)throw new Error("canvas 2d context unavailable");return e}};function ui(){let t=0,e=!1;return{start(s){e=!0;let n,r=i=>{e&&(n!=null||(n=i),s((i-n)/1e3),t=requestAnimationFrame(r))};t=requestAnimationFrame(r)},stop(){e=!1,cancelAnimationFrame(t)}}}function Jo(t){var r;let e=(r=t.axis)!=null?r:"y",s=null,n=t.source;return{start(i,o){var c,l;let a=(l=t.range)!=null?l:[0,(c=o.duration)!=null?c:1],h=()=>{if(n instanceof Element){let y=e==="y"?n.scrollHeight-n.clientHeight:n.scrollWidth-n.clientWidth,p=e==="y"?n.scrollTop:n.scrollLeft;return y>0?p/y:0}let u=document.documentElement,f=e==="y"?u.scrollHeight-window.innerHeight:u.scrollWidth-window.innerWidth,d=e==="y"?window.scrollY:window.scrollX;return f>0?d/f:0};s=()=>{let u=Math.min(1,Math.max(0,h()));i(a[0]+u*(a[1]-a[0]))},n.addEventListener("scroll",s,{passive:!0}),s()},stop(){s&&n.removeEventListener("scroll",s),s=null}}}var fi=class extends Error{constructor(t){super(`machine targets overlap an already-bound target set: ${t.join(", ")} \u2014 concurrent writers to one property is the silent last-writer-wins \xA72.2 exists to kill`),this.name="TargetOverlapError"}};function di(t,e={}){var R,K,ct,kn,vn,xn,Mn;let{playhead:s}=t,n=t.duration,r=(R=t.markers)!=null?R:[],i=(K=t.driver)!=null?K:ui(),o=(ct=e.loop)!=null?ct:!1,a=(kn=e.background)!=null?kn:"pause",h=(vn=t.visibility)!=null?vn:(()=>"visible"),c=new Map,l=new Map,u=(xn=e.rate)!=null?xn:1,f=!1,d=$(!1),y=A=>{f=A,d.set(A)},p=!1,v=new Set((Mn=t.targets)!=null?Mn:[]),k=[],m=0,g=null,b=0,T=[0,n],I=0,w=null;function M(A,O){var V,j,Q;if(A===O||c.size===0&&l.size===0)return;let z=O>A;for(let st of r){if(!(z?st.t>A&&st.t<=O:st.t>=O&&st.t<A))continue;for(let ss of(V=c.get(st.name))!=null?V:[])ss(st);let St=(j=st.data)==null?void 0:j.kind;if(typeof St=="string")for(let ss of(Q=l.get(St))!=null?Q:[])ss(st)}}function S(A){y(!1),g=null;let O=w;w=null,O==null||O(A)}function C(A){b=A;for(let St of k)St.step(A);if(!f)return;if(a==="pause"&&h()==="hidden"){m=s.peek(),g=null;return}g!=null||(g=A);let O=s.peek(),z=m+(A-g)*u,[V,j]=T;if(!(u>=0?z>=j:z<=V)){s.set(z),M(O,z);return}let Q=o===!0?{mode:"restart"}:o===!1?null:o,st=Q&&"count"in Q&&Q.count!==void 0?Q.count:1/0;if(!Q||I+1>=st){let St=u>=0?j:V;s.set(St),M(O,St),S(!0);return}I++,j-V,Q.mode==="alternate"?(M(O,u>=0?j:V),u=-u,m=u>=0?V:j):(M(O,u>=0?j:V),m=u>=0?V:j),g=A,z=m,s.set(z)}function L(){p||(p=!0,i.start(C,{duration:n,visibility:h}))}return{playhead:s,get duration(){return n},get playing(){return f},playingSignal:d,get rate(){return u},set rate(A){m=s.peek(),g=f?b:null,u=A},play(A){var j;w&&S(!1),T=(j=A==null?void 0:A.range)!=null?j:[0,n];let O=s.peek(),[z,V]=T;return m=u>=0?O>=V||O<z?z:O:O<=z||O>V?V:O,s.set(m),g=null,I=0,y(!0),L(),{finished:new Promise(Q=>{w=Q})}},pause(){f&&(m=s.peek(),S(!1))},seek(A){m=Math.min(Math.max(A,0),n),g=f?b:null,s.set(m)},swap(A){var z,V;n=A.duration,r=(z=A.markers)!=null?z:[],v=new Set((V=A.targets)!=null?V:[]);let O=Math.min(s.peek(),n);T=[0,n],m=O,g=f?b:null,I=0,s.set(O)},attach(A){if(A.targets){let O=[];for(let z of A.targets)v.has(z)?O.push(`'${z}' (player timeline)`):k.some(V=>{var j;return(j=V.targets)==null?void 0:j.has(z)})&&O.push(`'${z}' (another machine)`);if(O.length>0)throw new fi(O)}return k.push(A),L(),()=>{let O=k.indexOf(A);O>=0&&k.splice(O,1)}},onMarker(A,O){let z=c.get(A);return z||(z=new Set,c.set(A,z)),z.add(O),()=>z.delete(O)},onCue(A,O){let z=l.get(A);return z||(z=new Set,l.set(A,z)),z.add(O),()=>z.delete(O)},dispose(){f&&S(!1),k.length=0,p&&i.stop(),p=!1}}}function pi(t,e,s,n,r){var o;let i=t!=null?t:"respect";return i==="ignore"||!e?{autoplay:r}:typeof i=="function"?{autoplay:r,swapTo:i(s)}:{autoplay:!1,seekTo:(o=s.posterTime)!=null?o:n}}function gi(){return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function gn(t,e,s,n={}){var k;let r=t,i=e,o=tt(i),a=new Ze(s);r.setTextMeasurer(a);let h=r.playhead,c=di({playhead:h,duration:o.duration,markers:o.markers,targets:o.tracks.keys()},n),l=()=>a.render(ae(r,i,h.peek())),u=!1,f=()=>{u||(u=!0,requestAnimationFrame(()=>{u=!1,l()}))},d=h.subscribe(f),y=m=>{if(typeof FontFace=="undefined")return;let g=Zt(m.assets);for(let b of g.faces()){let T=new FontFace(b.family,`url(${b.url})`,{weight:String(b.weight),style:b.style});document.fonts.add(T),T.load().then(()=>l(),()=>{})}dn(r,m,async b=>{try{let T=await fetch(b);return T.ok?await T.arrayBuffer():void 0}catch(T){return}},E({mode:n.strictFonts?"strict":"dev"},n.osFonts!==void 0?{osFamilies:n.osFonts}:{}))};y(i);let p=((k=n.prefersReducedMotion)!=null?k:gi)(),v=pi(n.reducedMotion,p,i,o.duration,!!n.autoplay);if(v.swapTo){i=v.swapTo;let m=tt(i);c.swap({duration:m.duration,markers:m.markers,targets:m.tracks.keys()}),y(i)}return v.seekTo!==void 0&&c.seek(v.seekTo),l(),v.autoplay&&c.play(),{player:c,backend:a,render:l,swap(m){m.scene&&(r=m.scene,r.setTextMeasurer(a)),i=m.timeline;let g=tt(i);c.swap({duration:g.duration,markers:g.markers,targets:g.tracks.keys()}),y(i),l()},dispose(){d(),c.dispose(),a.dispose()}}}function Zo(t,e,s){let n=Object.keys(tt(e).labels);return r=>{if(r==null)return;let i=s(r),o=Object.keys(tt(i.timeline).labels),a=n.filter(h=>!o.includes(h));a.length>0&&console.warn(`[glissade] HMR: this edit removed label(s) ${a.map(h=>`'${h}'`).join(", ")} \u2014 anything seeking to them will no longer resolve`),n=o,t.swap(i)}}var ta=`
4
+ <style>
5
+ :host { display: inline-block; }
6
+ canvas { display: block; width: 100%; height: auto; }
7
+ .controls { display: flex; gap: 8px; align-items: center; padding: 6px 4px; font: 12px system-ui, sans-serif; }
8
+ button { font: inherit; cursor: pointer; }
9
+ input[type='range'] { flex: 1; }
10
+ .time { font-variant-numeric: tabular-nums; opacity: 0.75; min-width: 9ch; text-align: right; }
11
+ </style>
12
+ <canvas part="canvas"></canvas>
13
+ `,mn,et,dt,at,qt,Mt,ue,Ct,U,F,yn,wn,yi,wi,bn,ts,es,Vt,mi=(mn=class extends HTMLElement{constructor(){super();H(this,F);H(this,et,null);H(this,dt,null);H(this,at,null);H(this,qt,!1);H(this,Mt,null);H(this,ue);H(this,Ct);H(this,U,null);let e=this.attachShadow({mode:"open"});e.innerHTML=ta,_(this,ue,e),_(this,Ct,e.querySelector("canvas"))}get scene(){return P(this,dt)}set scene(e){_(this,dt,e),N(this,F,ts).call(this)}get player(){var e,s;return(s=(e=P(this,et))==null?void 0:e.player)!=null?s:null}connectedCallback(){N(this,F,wn).call(this),N(this,F,ts).call(this)}disconnectedCallback(){N(this,F,bn).call(this)}attributeChangedCallback(e){if(e==="controls"){N(this,F,wn).call(this),N(this,F,yn).call(this);return}this.isConnected&&P(this,dt)&&N(this,F,ts).call(this)}},et=new WeakMap,dt=new WeakMap,at=new WeakMap,qt=new WeakMap,Mt=new WeakMap,ue=new WeakMap,Ct=new WeakMap,U=new WeakMap,F=new WeakSet,yn=function(){P(this,U)&&!P(this,at)&&P(this,Mt)?(_(this,at,P(this,Mt).subscribe(()=>{requestAnimationFrame(()=>{P(this,U)&&(N(this,F,es).call(this),N(this,F,Vt).call(this))})})),N(this,F,es).call(this),N(this,F,Vt).call(this)):!P(this,U)&&P(this,at)&&(P(this,at).call(this),_(this,at,null))},wn=function(){let e=this.hasAttribute("controls");e&&!P(this,U)?N(this,F,yi).call(this):!e&&P(this,U)&&N(this,F,wi).call(this)},yi=function(){let e=document.createElement("div");e.className="controls",e.setAttribute("part","controls");let s=document.createElement("button");s.setAttribute("part","button"),s.setAttribute("aria-label","Play or pause"),s.textContent="Play";let n=document.createElement("input");n.setAttribute("part","scrubber"),n.type="range",n.min="0",n.max="1",n.step="0.0001",n.value="0",n.setAttribute("aria-label","Seek");let r=document.createElement("span");r.className="time",r.setAttribute("part","time");let i=()=>{var h;let a=(h=P(this,et))==null?void 0:h.player;a&&(a.playing?a.pause():a.play(),N(this,F,Vt).call(this))},o=()=>{var h;let a=(h=P(this,et))==null?void 0:h.player;a&&(_(this,qt,!0),a.pause(),a.seek(parseFloat(n.value)*a.duration),_(this,qt,!1),N(this,F,Vt).call(this))};s.addEventListener("click",i),n.addEventListener("input",o),e.append(s,n,r),P(this,ue).append(e),_(this,U,{root:e,button:s,scrubber:n,time:r,onClick:i,onInput:o}),N(this,F,es).call(this),N(this,F,Vt).call(this)},wi=function(){let e=P(this,U);e&&(e.button.removeEventListener("click",e.onClick),e.scrubber.removeEventListener("input",e.onInput),e.root.remove(),_(this,U,null))},bn=function(){var e,s;(e=P(this,at))==null||e.call(this),_(this,at,null),(s=P(this,et))==null||s.dispose(),_(this,et,null),_(this,Mt,null)},ts=function(){if(N(this,F,bn).call(this),!P(this,dt)||!this.isConnected)return;let e=P(this,dt).createScene();P(this,Ct).width=e.size.w,P(this,Ct).height=e.size.h,_(this,et,gn(e,P(this,dt).timeline,P(this,Ct),{loop:this.hasAttribute("loop"),autoplay:this.hasAttribute("autoplay")})),_(this,Mt,e.playhead),N(this,F,yn).call(this)},es=function(){var r,i,o;let e=P(this,U),s=(r=P(this,et))==null?void 0:r.player;if(!e||!s)return;let n=(o=(i=P(this,Mt))==null?void 0:i.peek())!=null?o:0;e.time.textContent=`${n.toFixed(2)} / ${s.duration.toFixed(2)}s`,!P(this,qt)&&s.duration>0&&(e.scrubber.value=String(n/s.duration))},Vt=function(){var n,r;let e=P(this,U);if(!e)return;let s=(r=(n=P(this,et))==null?void 0:n.player.playing)!=null?r:!1;e.button.textContent=s?"Pause":"Play"},x(mn,"observedAttributes",["loop","autoplay","controls"]),mn);function bi(t="gs-player"){customElements.get(t)||customElements.define(t,mi)}bi();return Ei(ea);})();
14
+ //# sourceMappingURL=glissade.browser.js.map