@glissade/browser 0.18.0-pre.4 → 0.18.0-pre.6
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/dist/glissade.api.json +1370 -0
- package/dist/glissade.browser.js +4 -4
- package/dist/glissade.browser.js.map +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +6 -6
package/dist/glissade.browser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var glissade=(()=>{var Me=Object.defineProperty,Wi=Object.defineProperties,Bi=Object.getOwnPropertyDescriptor,_i=Object.getOwnPropertyDescriptors,ji=Object.getOwnPropertyNames,xe=Object.getOwnPropertySymbols;var mn=Object.prototype.hasOwnProperty,Ns=Object.prototype.propertyIsEnumerable;var Rs=t=>{throw TypeError(t)};var pn=(t,e,n)=>e in t?Me(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,T=(t,e)=>{for(var n in e||(e={}))mn.call(e,n)&&pn(t,n,e[n]);if(xe)for(var n of xe(e))Ns.call(e,n)&&pn(t,n,e[n]);return t},z=(t,e)=>Wi(t,_i(e));var Vs=t=>typeof t=="symbol"?t:t+"",Vt=(t,e)=>{var n={};for(var s in t)mn.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(t!=null&&xe)for(var s of xe(t))e.indexOf(s)<0&&Ns.call(t,s)&&(n[s]=t[s]);return n};var Hi=(t,e)=>{for(var n in e)Me(t,n,{get:e[n],enumerable:!0})},Xi=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ji(e))!mn.call(t,r)&&r!==n&&Me(t,r,{get:()=>e[r],enumerable:!(s=Bi(e,r))||s.enumerable});return t};var Yi=t=>Xi(Me({},"__esModule",{value:!0}),t);var x=(t,e,n)=>pn(t,typeof e!="symbol"?e+"":e,n),gn=(t,e,n)=>e.has(t)||Rs("Cannot "+n);var D=(t,e,n)=>(gn(t,e,"read from private field"),n?n.call(t):e.get(t)),U=(t,e,n)=>e.has(t)?Rs("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),H=(t,e,n,s)=>(gn(t,e,"write to private field"),s?s.call(t,n):e.set(t,n),n),q=(t,e,n)=>(gn(t,e,"access private method"),n);var qa={};Hi(qa,{ALL_FILTER_KINDS:()=>Ss,BakeError:()=>je,BindTypeMismatchError:()=>$r,Canvas2DBackend:()=>ln,Circle:()=>Gr,CircularDependencyError:()=>mr,ClipError:()=>lt,ColdAssetError:()=>ge,ColorParseError:()=>Tn,Custom:()=>Xr,DEFAULT_EASE:()=>Ys,DL_SNAPSHOT_VERSION:()=>qr,DeterminismViolationError:()=>fi,DlSnapshotError:()=>Ke,DuplicateNodeIdError:()=>di,EachError:()=>Gt,FilterValidationError:()=>zt,FollowPath:()=>yi,FontValidationError:()=>kr,Group:()=>$t,GsPlayerElement:()=>Ni,Highlight:()=>li,IDENTITY:()=>Tt,Image:()=>Ur,ImageNode:()=>Ur,LayoutEngineMissingError:()=>ws,MEASURE_QUANTUM_PX:()=>Qe,MESH_DOWNSCALE:()=>ha,MESH_SHEPARD_POWER:()=>ua,MESH_SIGMA:()=>Ms,MorphError:()=>Ut,NODE_TAXONOMY:()=>Fo,Node:()=>J,Path:()=>ys,PositionError:()=>Kn,PresenceError:()=>Cs,Raster2D:()=>Ts,Rect:()=>Yr,ReservedNodeIdError:()=>pi,ShaderEffect:()=>ra,SidecarVersionError:()=>Hn,SketchValidationError:()=>gt,TARGET_PATH:()=>Pt,TargetOverlapError:()=>Di,Text:()=>sn,TextCursor:()=>hi,TimelineValidationError:()=>K,TokenHighlight:()=>wi,TokenMatchError:()=>be,TrackValidationError:()=>kt,UnboundTargetError:()=>Tr,UnknownEasingError:()=>Mn,UnknownValueTypeError:()=>In,UnresolvableTargetError:()=>Ae,ValueTypeInferenceError:()=>Nn,Video:()=>Kr,WriteDuringEvaluationError:()=>Be,applyToPoint:()=>Rr,arcLength:()=>fs,assignKeyIds:()=>Yn,audioOffsetSamples:()=>ir,auditCacheCold:()=>Uo,bake:()=>Eo,bakeCheckpointed:()=>To,batch:()=>yo,beginReadPhase:()=>gr,bindScene:()=>gi,bindTimeline:()=>ts,booleanType:()=>Fn,breakLines:()=>ct,buildFontRegistry:()=>le,buildTimeline:()=>Er,clip:()=>yt,clipList:()=>va,clockDriver:()=>Pi,coercePathData:()=>Je,collapseReplacer:()=>Xt,collectLocalizedTextUsages:()=>sa,collectTextUsages:()=>bi,colorType:()=>Pn,compileTimeline:()=>st,computed:()=>ce,createDisplayListBuilder:()=>de,createPlayer:()=>Fi,createPlayhead:()=>Xe,createScene:()=>Go,cubicBezier:()=>vn,cubicBezierDerivative:()=>xn,defineGsPlayer:()=>qi,deleteSidecarTrack:()=>ur,diffDisplayLists:()=>os,drawOn:()=>ui,drawOnEach:()=>Ho,driftLoop:()=>Ea,each:()=>jo,easingDerivatives:()=>Ce,easings:()=>kn,emitDevWarning:()=>B,emptySidecar:()=>lr,endReadPhase:()=>yr,estimatingMeasurer:()=>cs,evaluate:()=>ye,evaluateAt:()=>es,filtersToCanvasFilter:()=>Ze,flatten:()=>pe,followPath:()=>Zo,fontString:()=>cn,formatColor:()=>De,formatDisplayDiff:()=>Vr,fromTRS:()=>is,getLayoutEngine:()=>Zr,getTimelineCallbacks:()=>Sr,getValueType:()=>re,glow:()=>_r,hachureLines:()=>ps,hashKeys:()=>Ve,highlight:()=>zo,inReadPhase:()=>wo,inferValueType:()=>At,invert:()=>Nr,isDurationEditable:()=>ar,isEditableNodeId:()=>oe,isExemptFamily:()=>vr,key:()=>I,lerpColor:()=>ut,matEquals:()=>Et,matchTokenRun:()=>xs,mediaPrefersReducedMotion:()=>Li,mergeSidecar:()=>fr,mergeSidecarDetailed:()=>Gn,meshRasterSize:()=>vi,migrateSidecar:()=>Xn,morph:()=>Ta,motionPath:()=>we,mount:()=>Ps,multiply:()=>ue,namedEasing:()=>ee,normalizeEditedKeys:()=>dr,numberType:()=>Cn,oklabToRgba:()=>Wt,paintType:()=>Ln,parseCmap:()=>Re,parseColor:()=>dt,parseDisplaySnapshot:()=>Br,parseSvgPathData:()=>Ai,pathFromSegs:()=>nn,pathFromSvg:()=>La,pathLength:()=>Qo,pathType:()=>zn,planReducedMotion:()=>zi,pointAtLength:()=>Jo,popIn:()=>xa,presence:()=>za,pulse:()=>Sa,quantize:()=>G,random:()=>at,rasterizeMesh:()=>ki,registerValueType:()=>ot,reprOf:()=>Fe,requireLayoutEngine:()=>ti,resolveAnchor:()=>ls,resolveEase:()=>Rn,resolveEaseDerivative:()=>Vn,resolveSketch:()=>us,resolveTweenTarget:()=>vt,revealSchedule:()=>Qr,rgbaToOklab:()=>Ot,roughen:()=>en,roundedRectSegs:()=>Yt,sampleTrack:()=>Ne,scrollDriver:()=>Na,segmentGraphemes:()=>St,segmentWords:()=>tn,serializeDisplayList:()=>Wr,setDefaultMeasurer:()=>jr,setDevWarning:()=>Js,setLayoutEngine:()=>Jr,setScheduler:()=>fo,setShaderRunner:()=>Mi,setSidecarTrack:()=>hr,signal:()=>A,sketchStrokes:()=>Hr,slideIn:()=>Ma,spring:()=>ft,springEasing:()=>Sn,springEasingDerivative:()=>En,springPresets:()=>Ks,springTo:()=>tr,stagger:()=>Le,stringType:()=>Dn,swapOnHmr:()=>Ra,synchronousScheduler:()=>Qn,targetNodeId:()=>Bt,textCursor:()=>Lo,timeline:()=>So,tokenHighlight:()=>ta,track:()=>pt,transitionToClip:()=>Ci,typewriter:()=>Vo,untracked:()=>bo,validateFilters:()=>as,validateFonts:()=>Zn,validateHachure:()=>ds,validateSceneFonts:()=>Es,validateSketch:()=>hs,validateTrack:()=>ie,vec2ArcType:()=>An,vec2Equals:()=>ze,vec2Signal:()=>jt,vec2Type:()=>On,velocityAt:()=>qn,withDeterminismGuards:()=>Yo});var $e=2.5949095,Ie=2.70158,qt=2*Math.PI/3,te=2*Math.PI/4.5;function Se(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 kn={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=>Ie*t**3-1.70158*t*t,easeOutBack:t=>1+Ie*(t-1)**3+1.70158*(t-1)**2,easeInOutBack:t=>t<.5?(2*t)**2*(3.5949095*2*t-$e)/2:((2*t-2)**2*(3.5949095*(t*2-2)+$e)+2)/2,easeInElastic:t=>t===0?0:t===1?1:-(2**(10*t-10))*Math.sin((t*10-10.75)*qt),easeOutElastic:t=>t===0?0:t===1?1:2**(-10*t)*Math.sin((t*10-.75)*qt)+1,easeInOutElastic:t=>t===0?0:t===1?1:t<.5?-(2**(20*t-10)*Math.sin((20*t-11.125)*te))/2:2**(-20*t+10)*Math.sin((20*t-11.125)*te)/2+1,easeInBounce:t=>1-Se(1-t),easeOutBounce:Se,easeInOutBounce:t=>t<.5?(1-Se(1-2*t))/2:(1+Se(2*t-1))/2};function Ee(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 bt=Math.LN2,Ce={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*bt*2**(10*t-10),easeOutExpo:t=>t===1?0:10*bt*2**(-10*t),easeInOutExpo:t=>t===0||t===1?0:t<.5?10*bt*2**(20*t-10):10*bt*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*Ie*t**2-2*1.70158*t,easeOutBack:t=>3*Ie*(t-1)**2+2*1.70158*(t-1),easeInOutBack:t=>t<.5?12*3.5949095*t**2-4*$e*t:3*3.5949095*(2*t-2)**2+2*$e*(2*t-2),easeInElastic:t=>{if(t===0||t===1)return 0;let e=(t*10-10.75)*qt,n=2**(10*t-10);return-(10*bt*n*Math.sin(e)+n*10*qt*Math.cos(e))},easeOutElastic:t=>{if(t===0||t===1)return 0;let e=(t*10-.75)*qt,n=2**(-10*t);return-10*bt*n*Math.sin(e)+n*10*qt*Math.cos(e)},easeInOutElastic:t=>{if(t===0||t===1)return 0;let e=(20*t-11.125)*te;if(t<.5){let s=2**(20*t-10);return-(20*bt*s*Math.sin(e)+s*20*te*Math.cos(e))/2}let n=2**(-20*t+10);return(-20*bt*n*Math.sin(e)+n*20*te*Math.cos(e))/2},easeInBounce:t=>Ee(1-t),easeOutBounce:Ee,easeInOutBounce:t=>t<.5?Ee(1-2*t):Ee(2*t-1)},Ys="easeInOutCubic";function Gs(t,e,n,s){let r=3*t-3*n+1,i=3*n-6*t,o=3*t,a=3*e-3*s+1,l=3*s-6*e,c=3*e,h=p=>((r*p+i)*p+o)*p,f=p=>((a*p+l)*p+c)*p,u=p=>(3*r*p+2*i)*p+o;return{sampleY:f,sampleDX:u,sampleDY:p=>(3*a*p+2*l)*p+c,solveU:p=>{let k=p;for(let y=0;y<8;y++){let v=h(k)-p;if(Math.abs(v)<1e-7)return k;let S=u(k);if(Math.abs(S)<1e-6)break;k-=v/S}let b=0,g=1;for(k=p;g-b>1e-7;)h(k)<p?b=k:g=k,k=(b+g)/2;return k}}}function vn(t,e,n,s){let r=Gs(t,e,n,s);return i=>i<=0?0:i>=1?1:r.sampleY(r.solveU(i))}function xn(t,e,n,s){let r=Gs(t,e,n,s);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 Mn=class extends Error{constructor(t){super(`unknown easing '${t}'; register it via easings or use cubicBezier/spring`),this.name="UnknownEasingError"}};function ee(t){let e=kn[t];if(!e)throw new Mn(t);return e}var Gi=.005;function se(t){var n;let e=(n=t.mass)!=null?n: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 Ui(t,e){if(e<=0)return 0;let{w0:n,zeta:s}=se(t);if(Math.abs(s-1)<1e-9)return n*n*e*Math.exp(-n*e);if(s<1){let a=n*Math.sqrt(1-s*s);return Math.exp(-s*n*e)*(n*n/a)*Math.sin(a*e)}let r=Math.sqrt(s*s-1),i=-n*(s-r),o=-n*(s+r);return i*o*(Math.exp(i*e)-Math.exp(o*e))/(i-o)}function ne(t,e){if(e<=0)return 0;let{w0:n,zeta:s}=se(t);if(Math.abs(s-1)<1e-9)return 1-Math.exp(-n*e)*(1+n*e);if(s<1){let a=n*Math.sqrt(1-s*s);return 1-Math.exp(-s*n*e)*(Math.cos(a*e)+s*n/a*Math.sin(a*e))}let r=Math.sqrt(s*s-1),i=-n*(s-r),o=-n*(s+r);return 1+(o*Math.exp(i*e)-i*Math.exp(o*e))/(i-o)}function Pe(t,e){var a;let n=(a=e==null?void 0:e.settleTolerance)!=null?a:Gi,{w0:s,zeta:r}=se(t);if(r<1){let l=s*Math.sqrt(1-r*r),c=Math.sqrt(1+(r*s/l)**2);return Math.log(c/n)/(r*s)}let i=1/s;for(;1-ne(t,i)>n;)i*=2;let o=0;for(let l=0;l<64&&i-o>1e-9;l++){let c=(o+i)/2;1-ne(t,c)>n?o=c:i=c}return i}function Us(t,e,n){let s=Pe(t,n);return ne(t,Math.min(e,s))/ne(t,s)}function Ki(t,e,n){let{w0:s,zeta:r}=se(t),i,o,a;if(Math.abs(r-1)<1e-9){let c=n+s*e;i=h=>h<=0?e:Math.exp(-s*h)*(e+c*h),o=h=>h<=0?n:Math.exp(-s*h)*(n-s*c*h),a=h=>Math.exp(-s*h)*(Math.abs(e)+Math.abs(c)*h)}else if(r<1){let c=s*Math.sqrt(1-r*r),h=(n+r*s*e)/c,f=Math.hypot(e,h);i=u=>u<=0?e:Math.exp(-r*s*u)*(e*Math.cos(c*u)+h*Math.sin(c*u)),o=u=>u<=0?n:Math.exp(-r*s*u)*(n*Math.cos(c*u)-(s*s*e+r*s*n)/c*Math.sin(c*u)),a=u=>Math.exp(-r*s*u)*f}else{let c=Math.sqrt(r*r-1),h=s*(-r+c),f=s*(-r-c),u=(n-f*e)/(h-f),d=(h*e-n)/(h-f);i=m=>m<=0?e:u*Math.exp(h*m)+d*Math.exp(f*m),o=m=>m<=0?n:u*h*Math.exp(h*m)+d*f*Math.exp(f*m),a=m=>Math.abs(u)*Math.exp(h*m)+Math.abs(d)*Math.exp(f*m)}return{value:i,velocity:o,settleTime:c=>{let h=c!=null?c:Math.abs(e)*.005+1e-6;if(a(0)<=h&&Math.abs(n)<1e-12)return 0;let f=1/s,u=0;for(;a(f)>h&&u++<64;)f*=2;let d=0;for(let m=0;m<64&&f-d>1e-9;m++){let p=(d+f)/2;Math.max(a(p),a(p*1.05+1e-6))>h?d=p:f=p}return f}}}var ft=Object.assign(t=>{var e;return se(t),{kind:"spring",stiffness:t.stiffness,damping:t.damping,mass:(e=t.mass)!=null?e:1}},{duration:Pe,value:Us,retarget:Ki}),Ks={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 Sn(t){let e=Pe(t);return n=>Us(t,n*e)}function En(t){let e=Pe(t),n=e/ne(t,e);return s=>s>=1?0:Ui(t,s*e)*n}var Qs=t=>{var e;(e=globalThis.console)==null||e.warn(`[glissade] ${t}`)};function Js(t){Qs=t}function B(t){Qs(t)}var Qi=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Ji=/^rgba?\(\s*([\d.]+)\s*[, ]\s*([\d.]+)\s*[, ]\s*([\d.]+)\s*(?:[,/]\s*([\d.]+%?)\s*)?\)$/i,Tn=class extends Error{constructor(t){super(`cannot parse color '${t}' (supported: #rgb[a], #rrggbb[aa], rgb()/rgba())`),this.name="ColorParseError"}};function dt(t){let e=Qi.exec(t);if(e){let s=e[1];s.length<=4&&(s=[...s].map(i=>i+i).join(""));let r=parseInt(s,16);return s.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 n=Ji.exec(t);if(n){let s=n[4],r=s===void 0?1:s.endsWith("%")?parseFloat(s)/100:parseFloat(s);return{r:parseFloat(n[1]),g:parseFloat(n[2]),b:parseFloat(n[3]),a:r}}throw new Tn(t)}function De(t){let e=i=>Math.min(255,Math.max(0,Math.round(i))),n=i=>e(i).toString(16).padStart(2,"0"),s=`#${n(t.r)}${n(t.g)}${n(t.b)}`,r=Math.min(1,Math.max(0,t.a));return r>=1?s:`${s}${n(r*255)}`}function yn(t){let e=t/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function wn(t){return(t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055)*255}function Ot(t){let e=yn(t.r),n=yn(t.g),s=yn(t.b),r=Math.cbrt(.4122214708*e+.5363325363*n+.0514459929*s),i=Math.cbrt(.2119034982*e+.6806995451*n+.1073969566*s),o=Math.cbrt(.0883024619*e+.2817188376*n+.6299787005*s);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 Wt(t){let e=(t.L+.3963377774*t.a+.2158037573*t.b)**3,n=(t.L-.1055613458*t.a-.0638541728*t.b)**3,s=(t.L-.0894841775*t.a-1.291485548*t.b)**3;return{r:wn(4.0767416621*e-3.3077115913*n+.2309699292*s),g:wn(-1.2684380046*e+2.6097574011*n-.3413193965*s),b:wn(-.0041960863*e-.7034186147*n+1.707614701*s),a:t.alpha}}function ut(t,e,n){let s=Ot(dt(t)),r=Ot(dt(e)),i=(o,a)=>o+(a-o)*n;return De(Wt({L:i(s.L,r.L),a:i(s.a,r.a),b:i(s.b,r.b),alpha:i(s.alpha,r.alpha)}))}var $n=new Map;function ot(t){$n.set(t.id,t)}var In=class extends Error{constructor(t){super(`unknown value type '${t}'; register it via registerValueType()`),this.name="UnknownValueTypeError"}};function re(t){let e=$n.get(t);if(!e)throw new In(t);return e}function Fe(t){var e,n;return(n=(e=$n.get(t))==null?void 0:e.repr)!=null?n:t}var Cn={id:"number",lerp:(t,e,n)=>t+(e-t)*n,extrapolates:!0,equals:Object.is,add:(t,e)=>t+e,sub:(t,e)=>t-e,scale:(t,e)=>t*e,defaultHandoff:"spring"},ze=(t,e)=>t[0]===e[0]&&t[1]===e[1],On={id:"vec2",lerp:(t,e,n)=>[t[0]+(e[0]-t[0])*n,t[1]+(e[1]-t[1])*n],extrapolates:!0,equals:ze,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"},An={id:"vec2-arc",repr:"vec2",lerp:(t,e,n)=>{let s=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=s+(r-s)*n,l=i+o*n;return[a*Math.cos(l),a*Math.sin(l)]},extrapolates:!0,equals:ze,defaultHandoff:"blend-from-frozen"},Pn={id:"color",lerp:ut,extrapolates:!0,equals:(t,e)=>t===e,defaultHandoff:"blend-from-frozen"};function Zs(t){return{id:t,lerp:(e,n,s)=>s>=1?n:e,extrapolates:!1,equals:(e,n)=>Object.is(e,n),defaultHandoff:"cut"}}var Dn=Zs("string"),Fn=Zs("boolean"),bn=(t,e,n)=>[t[0]+(e[0]-t[0])*n,t[1]+(e[1]-t[1])*n];function qs(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++){let s=t[n],r=e[n];if(s.closed!==r.closed||s.v.length!==r.v.length)return!1}return!0}var Ws=!1,zn={id:"path",lerp:(t,e,n)=>qs(t,e)?t.map((s,r)=>{let i=e[r];return{closed:s.closed,v:s.v.map((o,a)=>bn(o,i.v[a],n)),in:s.in.map((o,a)=>bn(o,i.in[a],n)),out:s.out.map((o,a)=>bn(o,i.out[a],n))}}):(Ws||(Ws=!0,B("path lerp with mismatched topology (contour/vertex counts or closed flags differ): snapping instead of morphing \u2014 supply matched vertex counts (\xA72.2)")),n>=1?e:t),extrapolates:!1,equals:(t,e)=>{if(t===e)return!0;if(!qs(t,e))return!1;let n=(s,r)=>s[0]===r[0]&&s[1]===r[1];return t.every((s,r)=>{let i=e[r];return s.v.every((o,a)=>n(o,i.v[a]))&&s.in.every((o,a)=>n(o,i.in[a]))&&s.out.every((o,a)=>n(o,i.out[a]))})},defaultHandoff:"blend-from-frozen"},Oe=(t,e,n)=>t+(e-t)*n,Te=(t,e,n)=>[Oe(t[0],e[0],n),Oe(t[1],e[1],n)];function Bs(t){try{return De(z(T({},dt(t)),{a:0}))}catch(e){return t}}function Zi(t,e,n){try{return ut(t,e,n)}catch(s){return n>=1?e:t}}function _s(t,e){let n=e.stops.map(r=>({offset:r.offset,color:t})),s=e.interpolation?{interpolation:e.interpolation}:{};return e.kind==="radial"?T(T(T({kind:"radial",stops:n},e.center?{center:e.center}:{}),e.radius!==void 0?{radius:e.radius}:{}),s):T(T(T({kind:"linear",stops:n},e.from?{from:e.from}:{}),e.to?{to:e.to}:{}),s)}var js=!1;function Zt(t,e,n,s="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 js||(js=!0,B(s)),t>=1?n:e}var to=(t,e)=>t.length===e.length&&t.every((n,s)=>n.offset===e[s].offset&&n.color===e[s].color),Ln={id:"paint",lerp:(t,e,n)=>{var a,l,c,h;if(t.kind==="color"&&e.kind==="color")return{kind:"color",color:ut(t.color,e.color,n)};if(t.kind==="mesh"&&e.kind==="mesh"){if(t.points.length!==e.points.length)return Zt(n,t,e);if(t.interpolation!==e.interpolation)return Zt(n,t,e,`paint lerp across mismatched mesh interpolation modes ('${(a=t.interpolation)!=null?a:"smooth"}' \u2192 '${(l=e.interpolation)!=null?l:"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 f=t.points.map((d,m)=>{let p=e.points[m];return{pos:Te(d.pos,p.pos,n),color:ut(d.color,p.color,n)}}),u=t.bg!==void 0||e.bg!==void 0?{bg:Zi((c=t.bg)!=null?c:Bs(e.bg),(h=e.bg)!=null?h:Bs(t.bg),n)}:{};return T(T({kind:"mesh",points:f},t.interpolation?{interpolation:t.interpolation}:{}),u)}if(t.kind==="mesh"||e.kind==="mesh")return Zt(n,t,e);let s=t,r=e;if(s.kind==="color"&&r.kind!=="color"?s=_s(s.color,r):r.kind==="color"&&s.kind!=="color"&&(r=_s(r.color,s)),s.kind==="color"||r.kind==="color"||s.kind!==r.kind||s.stops.length!==r.stops.length)return Zt(n,t,e);let i=s.stops.map((f,u)=>({offset:Oe(f.offset,r.stops[u].offset,n),color:ut(f.color,r.stops[u].color,n)})),o=s.interpolation?{interpolation:s.interpolation}:{};return s.kind==="radial"&&r.kind==="radial"?T(T(T({kind:"radial",stops:i},s.center&&r.center?{center:Te(s.center,r.center,n)}:s.center?{center:s.center}:{}),s.radius!==void 0&&r.radius!==void 0?{radius:Oe(s.radius,r.radius,n)}:s.radius!==void 0?{radius:s.radius}:{}),o):s.kind==="linear"&&r.kind==="linear"?T(T(T({kind:"linear",stops:i},s.from&&r.from?{from:Te(s.from,r.from,n)}:s.from?{from:s.from}:{}),s.to&&r.to?{to:Te(s.to,r.to,n)}:s.to?{to:s.to}:{}),o):Zt(n,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((n,s)=>{let r=e.points[s];return n.color===r.color&&n.pos[0]===r.pos[0]&&n.pos[1]===r.pos[1]}):e.kind==="color"||e.kind==="mesh"||!to(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"},Nn=class extends Error{constructor(t){super(`cannot infer a value type for ${JSON.stringify(t)}; register a custom type`),this.name="ValueTypeInferenceError"}},eo=t=>typeof t=="object"&&t!==null&&typeof t.closed=="boolean"&&Array.isArray(t.v)&&Array.isArray(t.in)&&Array.isArray(t.out),no=t=>typeof t=="object"&&t!==null&&(t.kind==="color"||t.kind==="linear"||t.kind==="radial"||t.kind==="mesh");function At(t){if(typeof t=="number")return"number";if(typeof t=="boolean")return"boolean";if(no(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(eo))return"path";if(typeof t=="string")try{return dt(t),"color"}catch(e){return"string"}throw new Nn(t)}ot(Cn);ot(On);ot(An);ot(Pn);ot(Dn);ot(Fn);ot(zn);ot(Ln);var kt=class extends Error{constructor(t,e){super(`track '${t}': ${e}`),this.name="TrackValidationError"}};function ie(t){let e=re(t.type);if(t.keys.length===0)throw new kt(t.target,"must have at least one key");if(e.defaultHandoff==="cut")for(let n of t.keys)n.interp!=="hold"&&(n.interp="hold");for(let n=1;n<t.keys.length;n++){let s=t.keys[n-1],r=t.keys[n];if(r.t<=s.t)throw new kt(t.target,`keys must be strictly increasing in t (key[${n}] at t=${r.t} after t=${s.t})`)}if(!/^[^/]+\/.+$/.test(t.target))throw new kt(t.target,"target must be '<nodeId>/<prop.path>' (e.g. 'circle/opacity')")}function I(t,e,n){if(n===void 0)return{t,value:e};if(typeof n=="string"||"kind"in n)return{t,value:e,ease:n};let s=n,r={t,value:e};return s.ease!==void 0&&(r.ease=s.ease),s.interp!==void 0&&(r.interp=s.interp),s.id!==void 0&&(r.id=s.id),s.derived!==void 0&&(r.derived=s.derived),r}function tr(t,e,n,s){let r=ft.duration(s);if(t-r<0)throw new kt("springTo",`this spring needs ${r.toFixed(3)}s to settle \u2014 endT must be \u2265 its duration (got ${t})`);return[I(t-r,e),I(t,n,ft(s))]}function Le(t,e){let n=typeof e=="function"?e:s=>s*e;return t.map((s,r)=>{let i=n(r);return z(T({},s),{keys:s.keys.map(o=>z(T({},o),{t:o.t+i}))})})}function pt(t,e,n,s){let r={target:t,type:e,keys:n};return(s==null?void 0:s.editable)!==void 0&&(r.editable=s.editable),ie(r),r}function Rn(t){return t===void 0?ee("linear"):typeof t=="string"?ee(t):t.kind==="cubicBezier"?vn(...t.pts):Sn(t)}var Hs=new Set;function Vn(t){if(t===void 0)return Ce.linear;if(typeof t=="string"){let e=Ce[t];if(e)return e;let n=ee(t);Hs.has(t)||(Hs.add(t),B(`easing '${t}' has no registered derivative; velocity uses a numeric fallback \u2014 register one in easingDerivatives for exact interruption handoff`));let s=1/1024;return r=>(n(Math.min(1,r+s))-n(Math.max(0,r-s)))/(Math.min(1,r+s)-Math.max(0,r-s))}return t.kind==="cubicBezier"?xn(...t.pts):En(t)}var Xs=new WeakMap;function er(t){let e=Xs.get(t);return e||(e={cursor:1,easeCache:new Array(t.keys.length)},Xs.set(t,e)),e}function nr(t,e,n){let s=e.easeCache[n];return s||(s=Rn(t.keys[n].ease),e.easeCache[n]=s),s}function sr(t,e,n){let s=t.length;for(let o=Math.max(1,n-1);o<=Math.min(s-1,n+1);o++)if(t[o-1].t<=e&&e<t[o].t)return o;if(e<t[0].t)return 0;if(e>=t[s-1].t)return s;let r=1,i=s-1;for(;r<i;){let o=r+i>>1;t[o].t<=e?r=o+1:i=o}return r}function qn(t,e){let n=re(t.type);if(!n.sub||!n.scale)return null;let s=t.keys,r=s.length,i=er(t),o=sr(s,e,i.cursor),a=n.scale(n.sub(s[0].value,s[0].value),0);if(o===0||o>=r)return a;let l=s[o];if(l.interp==="hold")return a;let c=s[o-1],h=l.t-c.t,f=(e-c.t)/h;if(!n.extrapolates){let d=nr(t,i,o)(f);if(d<0||d>1)return a}let u=Vn(l.ease)(f);return n.scale(n.sub(l.value,c.value),u/h)}function Ne(t,e){let n=t.keys,s=n.length,r=er(t),i=sr(n,e,r.cursor);if(i===0)return n[0].value;if(i>=s)return n[s-1].value;r.cursor=i;let o=n[i],a=n[i-1];if(o.interp==="hold")return a.value;let l=re(t.type),c=(e-a.t)/(o.t-a.t),h=nr(t,r,i)(c);return!l.extrapolates&&(h<0||h>1)&&(r.warnedClamp||(r.warnedClamp=!0,B(`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`)),h=Math.min(1,Math.max(0,h))),l.lerp(a.value,o.value,h)}var Pt=Symbol.for("glissade.targetPath"),Ae=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 Bt(t){let e=t.indexOf("/");return e<0?t:t.slice(0,e)}function oe(t){return typeof t=="string"&&t.length>0&&t!=="__root"&&!t.startsWith("~")}function vt(t){let e=typeof t=="string"?t:t[Pt];if(typeof e!="string")throw new Ae;if(Bt(e).startsWith("~"))throw new Ae(`'${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 nt(t,e){return e+2<=t.byteLength?t.getUint16(e):0}function mt(t,e){return e+4<=t.byteLength?t.getUint32(e):0}function so(t,e){return t===3&&e===10||t===0&&e>=4?5:t===3&&e===1||t===0?3:0}function ro(t,e,n){let s=nt(t,e+6),r=s>>1,i=e+14,o=i+s+2,a=o+s,l=a+s;for(let c=0;c<r;c++){let h=nt(t,i+c*2),f=nt(t,o+c*2);if(f>h)continue;let u=nt(t,a+c*2),d=nt(t,l+c*2);for(let m=f;m<=h;m++){if(m===65535)continue;let p;if(d===0)p=m+u&65535;else{let k=nt(t,l+c*2+d+(m-f)*2);p=k===0?0:k+u&65535}p!==0&&n.add(m)}}}function io(t,e,n){let s=mt(t,e+12),r=Math.max(0,Math.floor((t.byteLength-(e+16))/12)),i=Math.min(s,r),o=e+16;for(let a=0;a<i;a++,o+=12){let l=mt(t,o),c=mt(t,o+4),h=mt(t,o+8);if(!(l>c)&&!(c-l>2097152))for(let f=l;f<=c;f++)h+(f-l)!==0&&n.add(f)}}function Re(t){let e=new Set;try{let n=ArrayBuffer.isView(t)?new DataView(t.buffer,t.byteOffset,t.byteLength):new DataView(t);if(n.byteLength<12)return e;let s=0;mt(n,0)===1953784678&&(s=mt(n,12));let r=nt(n,s+4),i=0;for(let h=0;h<r;h++){let f=s+12+h*16;if(mt(n,f)===1668112752){i=mt(n,f+8);break}}if(i===0)return e;let o=nt(n,i+2),a=0,l=-1;for(let h=0;h<o;h++){let f=i+4+h*8,u=nt(n,f),d=nt(n,f+2),m=i+mt(n,f+4),p=so(u,d);p>l&&m+2<=n.byteLength&&(l=p,a=m)}if(l<0)return e;let c=nt(n,a);c===4?ro(n,a,e):c===12&&io(n,a,e)}catch(n){return e}return e}function Wn(t){var n;let e={version:1,tracks:(n=t.tracks)!=null?n:[]};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 K=class extends Error{constructor(t){super(t),this.name="TimelineValidationError"}};function oo(t){for(let e=1;e<t.keys.length;e++){let n=t.keys[e];if(n.ease&&typeof n.ease=="object"&&n.ease.kind==="spring"){let s=t.keys[e-1].t+ft.duration(n.ease);if(Math.abs(n.t-s)>1e-6)throw new K(`track '${t.target}': spring-eased key at t=${n.t} must sit at prev.t + spring.duration (${s.toFixed(6)}); the builder computes this automatically`)}}}function ir(t,e=48e3){return Math.round(t*e)}function ao(t,e,n){return t.map(s=>z(T({},s),{t:e+s.t/n}))}function Bn(t){return`c${t}/`}var co=/(^|\/)call:\d+$/;function _n(t,e){return e!==""&&co.test(t)?e+t:t}function or(t,e,n,s,r,i){var o,a;for(let l of t.tracks)ie(l),oo(l),r.push({track:z(T({},l),{keys:ao(l.keys,e,n)}),unit:s});for(let l of(o=t.children)!=null?o:[]){let c=l.mode==="sync"&&(a=l.timeScale)!=null?a:1;if(l.mode==="add"&&l.timeScale!==void 0)throw new K("timeScale is only valid on mode:'sync' children (\xA72.3)");if(c<=0)throw new K("sync timeScale must be > 0");let h=l.mode==="sync"?++i.n:s;or(l.timeline,e+l.at/n,n*c,h,r,i)}}function lo(t){let e=new Map;for(let{track:s,unit:r}of t){let i=e.get(s.target);if(!i){e.set(s.target,{track:z(T({},s),{keys:[...s.keys]}),unit:r});continue}if(i.unit!==r)throw new K(`target '${s.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!==s.type)throw new K(`target '${s.target}' has conflicting value types '${i.track.type}' and '${s.type}'`);let o=s.keys[0].t,a=s.keys[s.keys.length-1].t,l=i.track.keys[0].t,c=i.track.keys[i.track.keys.length-1].t,h=i.track.keys.filter(f=>f.t<o||f.t>a);l<=a&&o<=c&&B(`overlapping tracks for '${s.target}' in [${o}, ${a}]: later insertion wins (${i.track.keys.length-h.length} earlier key(s) dropped)`),i.track.keys=[...h,...s.keys].sort((f,u)=>f.t-u.t)}let n=new Map;for(let[s,{track:r}]of e)n.set(s,r);return n}function ar(t){return t.editableDuration===!0}function ho(t){var n;let e=t.mode==="sync"&&(n=t.timeScale)!=null?n:1;return t.at+cr(t.timeline)/e}function cr(t){var n,s;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(n=t.markers)!=null?n:[])e=Math.max(e,r.t);for(let r of(s=t.children)!=null?s:[])e=Math.max(e,ho(r));return e}function st(t){var a,l;if(t.version!==1)throw new K(`unsupported timeline document version ${String(t.version)}`);let e=[];or(t,0,1,0,e,{n:0});let n=lo(e),s=T({},t.labels),r=[...(a=t.markers)!=null?a:[]],i=[...(l=t.audio)!=null?l:[]],o=(c,h,f,u)=>{(c!=null?c:[]).forEach((d,m)=>{var g,y,v,S,$;let p=h+d.at/f,k=f*(d.mode==="sync"&&(g=d.timeScale)!=null?g:1),b=u+Bn(m);for(let[w,M]of Object.entries((y=d.timeline.labels)!=null?y:{}))w in s||(s[w]=p+M/k);for(let w of(v=d.timeline.markers)!=null?v:[])r.push(z(T({},w),{name:_n(w.name,b),t:p+w.t/k}));for(let w of(S=d.timeline.audio)!=null?S:[])i.push(T(z(T({},w),{at:p+w.at/k}),k!==1?{playbackRate:(($=w.playbackRate)!=null?$:1)*k}:{}));o(d.timeline.children,p,k,b)})};return o(t.children,0,1,""),r.sort((c,h)=>c.t-h.t),i.sort((c,h)=>c.at-h.at),{duration:cr(t),labels:s,markers:r,tracks:n,audio:i}}var jn="main",Hn=class extends Error{constructor(t){super(`unsupported sidecar version ${String(t)}; this build reads sidecarVersion 1 or 2`),this.name="SidecarVersionError"}};function lr(){return{sidecarVersion:2,timelines:{[jn]:{tracks:{}}}}}function Xn(t){if(!t)return null;if(t.sidecarVersion===2)return t;if(t.sidecarVersion===1){let e={};for(let s of t.tracks)e[s.target]={type:s.type,baseHash:null,keys:s.keys};let n={tracks:e};return t.labels&&(n.labels=t.labels),{sidecarVersion:2,timelines:{[jn]:n}}}throw new Hn(t.sidecarVersion)}function Ve(t){let e=JSON.stringify(t.map(s=>{var r,i;return[s.t,s.value,(r=s.ease)!=null?r:null,(i=s.interp)!=null?i:null]})),n=2166136261;for(let s=0;s<e.length;s++)n^=e.charCodeAt(s),n=Math.imul(n,16777619);return(n>>>0).toString(16)}function Yn(t){let e=-1;for(let n of t){let s=n.id?/^k(\d+)$/.exec(n.id):null;s&&(e=Math.max(e,Number(s[1])))}return t.map(n=>n.id?T({},n):z(T({},n),{id:`k${++e}`}))}function hr(t,e,n,s,r,i){var l;if(!oe(Bt(n)))throw new kt(n,"structural/un-id'd nodes cannot host editor tracks (\xA76.5) \u2014 only nodes with an explicit id");let o=(l=t.timelines[e])!=null?l:{tracks:{}},a={type:s,baseHash:i?Ve(i):null,keys:Yn(r)};return z(T({},t),{timelines:z(T({},t.timelines),{[e]:z(T({},o),{tracks:z(T({},o.tracks),{[n]:a})})})})}function ur(t,e,n){let s=t.timelines[e];if(!s||!(n in s.tracks))return t;let o=s.tracks,{[n]:r}=o,i=Vt(o,[Vs(n)]);return z(T({},t),{timelines:z(T({},t.timelines),{[e]:z(T({},s),{tracks:i})})})}function rr(t){return t.some(e=>e.derived)?t.map((e,n)=>e.derived&&n>0?z(T({},e),{value:t[n-1].value}):e):t}function Gn(t,e){var c,h,f;let n=Xn(e);if(!n)return{timeline:t,drift:[],orphans:{}};let s=(c=n.timelines[jn])!=null?c:{tracks:{}},r=new Map(Object.entries(s.tracks)),i=[],o=T({},(h=s.orphans)!=null?h:{}),a=t.tracks.map(u=>{let d=r.get(u.target);return d?(r.delete(u.target),d.type!==u.type?(o[u.target]={type:d.type,keys:d.keys,reason:"type-changed"},u):(d.baseHash!==null&&d.baseHash!==Ve(u.keys)&&i.push(u.target),z(T({},u),{keys:rr(d.keys.map(m=>T({},m))),editable:!0}))):u});for(let[u,d]of r)d.baseHash!==null?o[u]={type:d.type,keys:d.keys,reason:"prop-missing"}:a.push({target:u,type:d.type,keys:rr(d.keys.map(m=>T({},m))),editable:!0});let l=z(T({},t),{tracks:a});if(s.labels&&Object.keys(s.labels).length>0){let u=(f=t.labels)!=null?f:{},d=Object.keys(s.labels).filter(m=>m in u);d.length&&B(`sidecar label(s) ${d.join(", ")} collide with code labels; code wins (\xA76.2)`),l.labels=T(T({},s.labels),u)}return i.length&&B(`sidecar: code baseline changed beneath edits on ${i.join(", ")} (\xA76.2)`),{timeline:l,drift:i,orphans:o}}function fr(t,e){return Gn(t,e).timeline}function dr(t){let e=t.map(n=>T({},n)).sort((n,s)=>n.t-s.t);for(let n=0;n<2;n++){for(let s=1;s<e.length;s++){let r=e[s].ease;r&&typeof r=="object"&&r.kind==="spring"&&(e[s].t=e[s-1].t+ft.duration(r))}e.sort((s,r)=>s.t-r.t)}for(let n=1;n<e.length;n++)e[n].t<=e[n-1].t&&(e[n].t=e[n-1].t+.001);return e}var Qn=t=>t(),Un=Qn,Dt=new Set,_e=0,_t=!1,ae=!1,uo=1e3;function fo(t){let e=Un;return Un=t!=null?t:Qn,ae&&!_t&&(ae=!1,Dt.size>0&&Jn()),e}function po(t){Dt.add(t),Jn()}function Jn(){_e>0||_t||ae||(ae=!0,Un(mo))}function mo(){ae=!1,!_t&&go()}function go(){if(_t)return;_t=!0;let t;try{let e=0;for(;Dt.size>0;){if(++e>uo)throw Dt.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 n=[...Dt];Dt.clear();for(let s of n)try{s()}catch(r){t!=null||(t={err:r})}}}finally{_t=!1}if(t)throw t.err}function qe(){_e++}function We(){_e--,_e===0&&Dt.size>0&&Jn()}function yo(t){qe();try{return t()}finally{We()}}var xt=null,Ft=0,Be=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"}},mr=class extends Error{constructor(){super("circular signal dependency detected"),this.name="CircularDependencyError"}};function gr(){Ft++}function yr(){if(Ft===0)throw new Error("endReadPhase() without matching beginReadPhase()");Ft--}function wo(){return Ft>0}var wr=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,n;this.fn=(e=t.fn)!=null?e:null,this.value=t.value,this.equals=(n=t.equals)!=null?n:Object.is,this.state=this.fn?2:0}get(){return xt&&xt.addDep(this),this.updateIfNecessary(),this.value}peek(){return this.updateIfNecessary(),this.value}set(t){if(Ft>0)throw new Be;qe();try{this.fn&&this.detachFn(),this.writeValue(t)}finally{We()}}forceSet(t){qe();try{this.fn&&this.detachFn(),this.writeValue(t)}finally{We()}}bindSource(t){if(Ft>0)throw new Be;qe();try{this.fn=t,this.state=2,this.invalidateDependents(2)}finally{We()}}unbindSource(){if(Ft>0)throw new Be;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])po(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 mr;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=xt;xt=this,this.computing=!0;let e;try{e=this.fn()}finally{this.computing=!1,xt=t}for(let n=0;n<this.deps.length;n++)this.depVersions[n]=this.deps[n].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 br(t,e){let n=(()=>t.get());return n.peek=()=>t.peek(),n.subscribe=s=>t.subscribe(s),e(n),n}function A(t,e){let n=new wr({value:t,equals:e==null?void 0:e.equals});return br(n,s=>{s.set=r=>n.set(r),s.forceSet=r=>n.forceSet(r),s.bindSource=r=>n.bindSource(r),s.unbindSource=()=>n.unbindSource(),Object.defineProperty(s,"isBound",{get:()=>n.isBound})})}function ce(t,e){return br(new wr({fn:t,equals:e==null?void 0:e.equals}),()=>{})}function bo(t){let e=xt;xt=null;try{return t()}finally{xt=e}}function jt(t){let[e,n]=Array.isArray(t)?t:[t.x,t.y],s=A(e),r=A(n);s.expects="number",r.expects="number";let i=A(null,{equals:(h,f)=>h===null||f===null?h===f:h[0]===f[0]&&h[1]===f[1]}),o=A(e),a=A(n);s.bindSource(()=>{let h=i();return h===null?o():h[0]}),r.bindSource(()=>{let h=i();return h===null?a():h[1]});let l=ce(()=>[s(),r()],{equals:(h,f)=>h[0]===f[0]&&h[1]===f[1]}),c=(()=>l());return c.peek=()=>l.peek(),c.subscribe=h=>l.subscribe(h),c.set=h=>{i.set(null),o.set(h[0]),a.set(h[1])},c.bindSource=h=>i.bindSource(()=>h()),c.unbindSource=()=>{i.unbindSource(),i.set(null)},c.expects="vec2",Object.defineProperty(c,"x",{value:s,enumerable:!0}),Object.defineProperty(c,"y",{value:r,enumerable:!0}),c}function ko(t,e){return e.faces&&e.faces.length>0?e.faces.map(n=>{var s,r;return{family:t,url:n.url,weight:(s=n.weight)!=null?s:400,style:(r=n.style)!=null?r:"normal"}}):[{family:t,url:e.url,weight:400,style:"normal"}]}function vo(t,e){let n,s=Number.POSITIVE_INFINITY;for(let r of t){let i=Math.abs(r.weight-e);(i<s||i===s&&n!==void 0&&r.weight<n.weight)&&(n=r,s=i)}return n}function le(t){let e=new Map;for(let[n,s]of Object.entries(t!=null?t:{}))s.kind==="font"&&e.set(n,{faces:ko(n,s),fallback:s.fallback?[...s.fallback]:[]});return{has(n){return e.has(n)},faces(){let n=[];for(let s of e.values())n.push(...s.faces);return n},resolveFace(n,s=400,r="normal"){let i=e.get(n);if(!i)return;let o=i.faces.filter(a=>a.style===r);return vo(o.length>0?o:i.faces,s)},fallbackChain(n){let s=e.get(n);return s?[n,...s.fallback]:[n]}}}var kr=class extends Error{constructor(e){super(xr(e));x(this,"report");this.name="FontValidationError",this.report=e}},xo=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","math","emoji","fangsong"]);function vr(t,e){var s;let n=t.trim().toLowerCase();return xo.has(n)?!0:(s=e==null?void 0:e.has(n))!=null?s:!1}function Mo(t){let e=[];for(let n of t){let s=n.codePointAt(0);s!==void 0&&e.push(s)}return e}function xr(t){let e=[];t.unregistered.length>0&&e.push(`unregistered font ${t.unregistered.length===1?"family":"families"}: ${t.unregistered.join(", ")}`);for(let n of t.missingGlyphs){let s=n.codePoints.map(r=>"U+"+r.toString(16).toUpperCase().padStart(4,"0")).join(", ");e.push(`family '${n.family}' is missing glyphs for ${s}`)}return"font validation failed (\xA73.6): "+e.join("; ")+" \u2014 register the family with its faces/fallback, or supply covering glyphs"}function Zn(t,e,n,s,r={}){let i=new Set,o=new Map;for(let l of t){let c=l.family,h=vr(c,r.osFamilies);if(!e.has(c)){h||i.add(c);continue}let f=e.fallbackChain(c);for(let u of Mo(l.text))if(!f.some(d=>{var m,p;return(p=(m=n.get(d))==null?void 0:m.has(u))!=null?p:!1})){let d=o.get(c);d||(d=new Set,o.set(c,d)),d.add(u)}}let a={unregistered:[...i].sort(),missingGlyphs:[...o.entries()].map(([l,c])=>({family:l,codePoints:[...c].sort((h,f)=>h-f)})).sort((l,c)=>l.family<c.family?-1:l.family>c.family?1:0)};if(!(a.unregistered.length===0&&a.missingGlyphs.length===0)){if(s==="strict")throw new kr(a);B(xr(a))}return a}var Kn=class extends Error{constructor(t,e){super(`invalid position '${t}': ${e}`),this.name="PositionError"}};function pr(t){return typeof t!="string"&&typeof t.peek=="function"?t.peek():void 0}var Mr=new WeakMap;function Sr(t){var e;return(e=Mr.get(t))!=null?e:new Map}function Er(t,e={}){var k;let n=[],s=T({},e.labels),r=[],i=[],o=new Map,a=!1,l=0,c=0,h=0;function f(b){if(b===void 0)return c;if(typeof b=="number")return b;if(b==="<")return l;if(b===">")return c;let g=/^([+-])=([\d.]+)$/.exec(b);if(g)return c+(g[1]==="+"?1:-1)*parseFloat(g[2]);let y=/^([^+\-=]+?)(?:([+-])=([\d.]+))?$/.exec(b);if(y){let v=y[1];if(!(v in s))throw new Kn(b,`unknown label '${v}' (labels must be declared before use)`);let S=y[2]?(y[2]==="+"?1:-1)*parseFloat(y[3]):0;return s[v]+S}throw new Kn(b,"expected a number, '<', '>', '+=x', '-=x', or 'label[+=x]'")}let u={to(b,g,y={}){var E,C;let v=(E=y.ease)!=null?E:"easeInOutCubic",S=typeof v=="object"&&v.kind==="spring",$=S?ft.duration(v):(C=y.duration)!=null?C:1;if(S&&y.duration!==void 0)throw new K("a spring ease determines its duration (spring.duration(cfg)); do not pass duration with a spring");let w=f(y.at),M={kind:"tween",target:vt(b),value:g,duration:$,ease:v,at:y.at,baseValue:pr(b),editable:!1,start:w};return y.from!==void 0&&(M.explicitFrom=y.from),n.push(M),l=w,c=w+$,u},fromTo(b,g,y,v={}){return u.to(b,y,v),n[n.length-1].explicitFrom=g,u},stagger(b,g,y){var Jt;let v=b.length,S=f(y.at),$=(v-1)/2,{anchor:w="start",each:M}=y,E=V=>{if(!Number.isFinite(V))throw new K(`stagger: non-finite each/anchor (${String(V)})`);return V};typeof w=="number"&&E(w),typeof M=="number"&&E(M);let C=V=>w==="start"?V:w==="end"?v-1-V:Math.round(w==="center"?Math.abs(V-$):w==="edges"?$-Math.abs(V-$):Math.abs(V-w)),L=V=>E(typeof M=="function"?M(V,v):V*M),N=g.ease,X=typeof N=="object"&&N!==null&&N.kind==="spring"?ft.duration(N):(Jt=g.duration)!=null?Jt:1,tt=V=>T(T({at:S+V},g.duration!==void 0?{duration:g.duration}:{}),g.ease!==void 0?{ease:g.ease}:{}),Nt=0,Rt=0;for(let V=0;V<v;V++){let O=L(C(V));(V===0||O<Nt)&&(Nt=O),(V===0||O>Rt)&&(Rt=O);let P=S+O;if(P<0)throw new K(`stagger: target would land at t=${P} (< 0); shift opts.at`);let F=b[V];g.from!==void 0?u.fromTo(F,g.from,g.to,tt(O)):u.to(F,g.to,tt(O))}return v>0&&(l=S+Nt,c=S+Rt+X),u},set(b,g,y={}){let v=f(y.at);return n.push({kind:"set",target:vt(b),value:g,duration:0,ease:"linear",at:y.at,baseValue:pr(b),editable:!1,start:v}),l=v,c=v,u},label(b,g){return s[b]=g===void 0?c:f(g),u},add(b,g,y={}){var C,L;let v=g===void 0?c:f(g),S=(C=y.mode)!=null?C:"add",$={timeline:b,at:v,mode:S,_pos:g};y.timeScale!==void 0&&($.timeScale=y.timeScale);let w=r.length;r.push($);let M=Bn(w);for(let[N,X]of Sr(b))o.set(_n(N,M),X);let E=S==="sync"&&(L=y.timeScale)!=null?L:1;return l=v,c=v+st(b).duration/E,u},sequence(b,g={}){var S;let y=(S=g.gap)!=null?S:0,v=y<0?`-=${-y}`:`+=${y}`;for(let $=0;$<b.length;$++)u.add(b[$],$===0?void 0:v);return u},at(b,g){return u.add(g,b)},call(b,g){let y=g===void 0?c:f(g),v=`call:${h++}`;return i.push({t:y,name:v}),o.set(v,b),u},cue(b,g,y){let v=y!=null&&typeof y=="object"&&!Array.isArray(y)?T({kind:"cue"},y):{kind:"cue"};return i.push({t:f(b),name:g,data:v}),u},adBreak(b,g={}){var v;let y=T({kind:"ad-break"},g.duration!==void 0?{duration:g.duration}:{});return i.push({t:f(b),name:(v=g.id)!=null?v:"ad-break",data:y}),u},editable(){let b=n[n.length-1];if(!b)throw new K(".editable() requires a preceding insertion");let g=Bt(b.target);if(!oe(g))throw new K(`.editable() needs a node with an explicit id; '${g}' is not an editable host (\xA76.4)`);return b.editable=!0,u},editableDuration(){return a=!0,u}};t(u);let d=new Map;for(let b of n){let g=d.get(b.target);g||(g=[],d.set(b.target,g)),g.push(b)}let m=[];for(let[b,g]of d){g.sort((E,C)=>E.start-C.start);let y=[],v=g.some(E=>E.editable),S=(k=g.find(E=>E.baseValue!==void 0))==null?void 0:k.baseValue,$=g[0];$.kind==="tween"&&$.explicitFrom===void 0&&S===void 0&&B(`'${b}': 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 E of g){if(E.kind==="set"){y.push({t:E.start,value:E.value,interp:"hold"}),S=E.value;continue}let C=E.explicitFrom!==void 0?E.explicitFrom:S,L=y[y.length-1];if(C!==void 0&&(!L||L.t<E.start)){let N={t:E.start,value:C};E.explicitFrom===void 0&&(N.derived=!0),(!L||E.start>L.t)&&y.push(N)}y.push({t:E.start+E.duration,value:E.value,ease:E.ease}),S=E.value}let w=[];for(let E of y.sort((C,L)=>C.t-L.t)){let C=w[w.length-1];C&&C.t===E.t?w[w.length-1]=E:w.push(E)}let M={target:b,type:At(g[0].value),keys:w};v&&(M.editable=!0),m.push(M)}let p=Wn(T(T(T(z(T({},e),{tracks:m,labels:s}),a?{editableDuration:!0}:{}),i.length?{markers:i}:{}),r.length?{children:r.map(y=>{var v=y,{_pos:b}=v,g=Vt(v,["_pos"]);return g})}:{}));return o.size&&Mr.set(p,o),p}function So(t,e){return typeof t=="function"?Er(t,e):Wn(t)}function Xe(t=0){return A(t)}var Tr=class extends Error{constructor(t){super(`timeline targets '${t}' but no property signal resolves to it`),this.name="UnboundTargetError"}},$r=class extends Error{constructor(e,n,s){let r=e.slice(e.lastIndexOf("/")+1),i=[s].flat(),o=n==="number"&&i.includes("vec2")?`; target '${r}.x'/'${r}.y' or author a vec2 track`:"";super(`track '${e}' is '${n}' but '${r}' expects '${i.join("'|'")}' (would silently NaN evaluation)${o}`);x(this,"target");x(this,"got");x(this,"expected");this.target=e,this.got=n,this.name="BindTypeMismatchError",this.expected=s}};function ts(t,e,n=Xe()){let s=[],r=new Map;for(let[i,o]of t.tracks){let a=e(i);if(!a)throw new Tr(i);let l=o.type,c=a.expects;if(c!==void 0){let h=Fe(l);if(!(Array.isArray(c)?c:[c]).some(f=>Fe(f)===h))throw new $r(i,l,c)}a.bindSource(()=>Ne(o,n())),s.push(a),r.set(i,{track:o,value:h=>Ne(o,h),velocity:h=>qn(o,h)})}return{playhead:n,samplers:r,unbind:()=>{for(let i of s)i.unbindSource()}}}function es(t,e,n){t.forceSet(e),gr();try{return n()}finally{yr()}}function at(t){let e=t>>>0;return()=>{e=e+2654435769|0;let n=e^e>>>16;return n=Math.imul(n,569420461),n=n^n>>>15,n=Math.imul(n,1935289751),n=n^n>>>15,(n>>>0)/4294967296}}var je=class extends Error{constructor(t){super(`bake(): ${t}`),this.name="BakeError"}};function He(t,e,n){for(let[s,r]of Object.entries(e)){let i=t.get(s);i||(i={keys:[],type:At(r)},t.set(s,i)),i.keys.push({t:n,value:r})}}function Ir(t){return[...t.entries()].map(([e,n])=>({target:e,type:n.type,keys:n.keys}))}function Eo(t){var o,a;if(!(t.fps>0)||!(t.duration>=0))throw new je("fps must be > 0 and duration >= 0");let e=at((o=t.seed)!=null?o:0),n=1/t.fps,s=Math.round(t.duration*t.fps),r=t.setup(e),i=new Map;He(i,t.sample(r),0);for(let l=1;l<=s;l++)r=(a=t.step(r,n,e))!=null?a:r,He(i,t.sample(r),l*n);return Ir(i)}function To(t){var f;if(!(t.every>=1))throw new je("checkpoint interval `every` must be >= 1 frame");let e=1/t.fps,n=Math.round(t.duration*t.fps),s=0,r=at((f=t.seed)!=null?f:0),i=()=>(s++,r()),o=u=>{var m;let d=at((m=t.seed)!=null?m:0);for(let p=0;p<u;p++)d();return d},a=t.setup(i),l=[{snap:t.snapshot(a),rngDraws:s}],c=0;function h(u){var d;for(;c<Math.min(u,n);)a=(d=t.step(a,e,i))!=null?d:a,c++,c%t.every===0&&l.push({snap:t.snapshot(a),rngDraws:s})}return{frames:n,bakeRange(u,d){var v;if(u<0||d>n||u>d)throw new je(`range ${u}..${d} outside 0..${n}`);let m=Math.floor(u/t.every)*t.every;h(m);let p=l[m/t.every],k=t.restore(p.snap),b=o(p.rngDraws),g=m,y=new Map;for(g>=u&&He(y,t.sample(k),g*e);g<d;)k=(v=t.step(k,e,b))!=null?v:k,g++,g>=u&&He(y,t.sample(k),g*e);return Ir(y)}}}var Tt=[1,0,0,1,0,0],_=t=>t===0?0:t;function ue(t,e){let[n,s,r,i,o,a]=t,[l,c,h,f,u,d]=e;return[_(n*l+r*c),_(s*l+i*c),_(n*h+r*f),_(s*h+i*f),_(n*u+r*d+o),_(s*u+i*d+a)]}function is(t,e,n){let s=e*Math.PI/180,r=Math.cos(s),i=Math.sin(s),[o,a]=n;return[_(r*o),_(i*o),_(-i*a),_(r*a),_(t[0]),_(t[1])]}function Nr(t){let[e,n,s,r,i,o]=t,a=e*r-n*s;if(a===0)return null;let l=r/a,c=-n/a,h=-s/a,f=e/a;return[_(l),_(c),_(h),_(f),_(-(l*i+h*o)),_(-(c*i+f*o))]}function Rr(t,e){return[t[0]*e[0]+t[2]*e[1]+t[4],t[1]*e[0]+t[3]*e[1]+t[5]]}function Et(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 Xt(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 Cr(t,e){let n={};for(let[s,r]of Object.entries(t))n[s]=r;return t.op==="clip"||t.op==="fillPath"||t.op==="strokePath"?n.path=e[t.path]:t.op==="drawImage"&&(n.image=e[t.image]),n}var Ht=t=>JSON.stringify(t,Xt);function $o(t,e){let n=[],s=new Set([...Object.keys(t),...Object.keys(e)]);for(let r of s)r!=="op"&&Ht(t[r])!==Ht(e[r])&&n.push({path:r,from:t[r],to:e[r]});return n}function os(t,e){let n=[],s=Math.max(t.commands.length,e.commands.length);for(let i=0;i<s;i++){let o=t.commands[i],a=e.commands[i];if(o!==void 0&&a!==void 0){let l=Cr(o,t.resources),c=Cr(a,e.resources);if(Ht(l)===Ht(c))continue;o.op!==a.op?n.push({index:i,kind:"change",opA:o.op,opB:a.op,fields:[{path:"op",from:o.op,to:a.op}]}):n.push({index:i,kind:"change",opA:o.op,opB:a.op,fields:$o(l,c)})}else a!==void 0?n.push({index:i,kind:"add",opB:a.op,fields:[]}):o!==void 0&&n.push({index:i,kind:"remove",opA:o.op,fields:[]})}let r=t.size.w!==e.size.w||t.size.h!==e.size.h;return T({equal:n.length===0&&!r,deltas:n},r?{size:{from:t.size,to:e.size}}:{})}function Vr(t){var n,s,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 ${(n=o.opB)!=null?n:"?"}`);else if(o.kind==="remove")e.push(`- [${o.index}] remove ${(s=o.opA)!=null?s:"?"}`);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 l of o.fields)e.push(` ${l.path}: ${Ht(l.from)} -> ${Ht(l.to)}`)}return e.join(`
|
|
2
|
-
`)}var
|
|
3
|
-
`);if(n===void 0||n<=0)return r;let i=[];for(let o of r){let a=tn(o),l="";for(let c of a){let h=l+c;l!==""&&G(s.measureText(h.trimEnd(),e).width)>n?(i.push(l.trimEnd()),l=c.trimStart()===""?"":c):l=h}i.push(l.trimEnd())}return i}var Oo={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 ls(t){if(typeof t=="string"){let e=Oo[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 he(t,e){return typeof e=="function"?t.bindSource(e):e!==void 0&&t.set(e),t}function Ar(t,e){return typeof e=="function"?t.bindSource(e):e!==void 0&&t.set(e),t}var fe,zr,J=(zr=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);U(this,fe,!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=Ar(jt([0,0]),t.position),this.rotation=he(A(0),t.rotation),this.scale=Ar(jt([1,1]),t.scale),this.opacity=he(A(1),t.opacity),this.blend=he(A("source-over"),t.blend),this.zIndex=he(A(0),t.zIndex),this.filters=he(A([]),t.filters),this.hasAnchor=t.anchor!==void 0,this.anchor=ls((e=t.anchor)!=null?e:"center"),this.cache=t.cache===!0,this.localMatrix=ce(()=>{let n=is(this.position(),this.rotation(),this.scale()),[s,r]=this.anchorShift();return s===0&&r===0?n:ue(n,[1,0,0,1,s,r])},{equals:Et}),this.worldMatrix=ce(()=>this.parent?ue(this.parent.worldMatrix(),this.localMatrix()):this.localMatrix(),{equals:Et}),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,n){e.expects=n,this.targets.set(t,e),this.id!==void 0&&(e[Pt]=`${this.id}/${t}`)}resolveTarget(t){return this.targets.get(t)}intrinsicSize(t){return null}drawOffset(t){var s,r,i;let e=(r=t!=null?t:(s=this.measurerSource)==null?void 0:s.call(this))!=null?r:Q(),n=(i=this.intrinsicSize(e))!=null?i:{w:0,h:0};return{x:-n.w/2,y:-n.h/2}}flowOffset(t){var i,o;let e=(o=t!=null?t:(i=this.measurerSource)==null?void 0:i.call(this))!=null?o:Q(),n=this.drawOffset(e),[s,r]=this.anchorShift(e);return{x:n.x+s,y:n.y+r}}anchorShift(t){var l,c;if(!this.hasAnchor)return[0,0];let[e,n]=this.anchor,s=(c=t!=null?t:(l=this.measurerSource)==null?void 0:l.call(this))!=null?c:Q(),r=this.intrinsicSize(s);if(!r)return D(this,fe)||(H(this,fe,!0),B(`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(s),o=-(i.x+e*r.w),a=-(i.y+n*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 n=this.opacity();if(n<=0)return;let s=this.localMatrix(),r=Et(s,Tt),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:s});let l=-1;o&&(a&&(l=t.mark()),t.push(T({op:"pushGroup",opacity:n,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 h=t.cacheKey(c,t.mark());h!==void 0&&t.patchCacheKey(l,h)}t.push({op:"popGroup"})}t.push({op:"restore"})}},fe=new WeakMap,zr),Pr=["marker","crayon","pencil","ink","chalk"],gt=class extends Error{constructor(t){super(t),this.name="SketchValidationError"}};function hs(t){if(!Pr.includes(t.kind))throw new gt(`unknown sketch kind '${String(t.kind)}' (have: ${Pr.join(", ")})`);if(t.width!==void 0&&!(t.width>0))throw new gt(`sketch width must be > 0, got ${String(t.width)}`);if(t.roughness!==void 0&&!(t.roughness>=0))throw new gt(`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 gt(`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 gt("sketch chalk dash must be an array of non-negative numbers")}function us(t){var e,n,s,r,i,o,a,l,c,h,f,u,d;switch(t.kind){case"marker":return{width:(e=t.width)!=null?e:8,roughness:(n=t.roughness)!=null?n:1.2,passes:2};case"crayon":return{width:(s=t.width)!=null?s: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:(l=t.passes)!=null?l:2};case"ink":return{width:(c=t.width)!=null?c:2.5,roughness:(h=t.roughness)!=null?h:.8,passes:1};case"chalk":return{width:(f=t.width)!=null?f:3,roughness:(u=t.roughness)!=null?u:1.6,passes:1,dash:(d=t.dash)!=null?d:[6,5]}}}var Ao=(t,e,n,s,r)=>{let i=1-r,o=i*i*i,a=3*i*i*r,l=3*i*r*r,c=r*r*r;return[o*t[0]+a*e[0]+l*n[0]+c*s[0],o*t[1]+a*e[1]+l*n[1]+c*s[1]]},Po=(t,e,n,s)=>{let r=1-s;return[r*r*t[0]+2*r*s*e[0]+s*s*n[0],r*r*t[1]+2*r*s*e[1]+s*s*n[1]]},ns=(t,e,n,s,r,i)=>{let o=n*Math.cos(i),a=s*Math.sin(i),l=Math.cos(r),c=Math.sin(r);return[t+o*l-a*c,e+o*c+a*l]};function pe(t,e=16){let n=[],s=null,r=0,i=0,o=0,a=0,l=(c,h)=>(s||(s={points:[[c,h]],closed:!1},n.push(s),o=c,a=h),s);for(let c of t)switch(c[0]){case"M":s={points:[[c[1],c[2]]],closed:!1},n.push(s),r=o=c[1],i=a=c[2];break;case"L":l(r,i).points.push([c[1],c[2]]),r=c[1],i=c[2];break;case"C":{let h=l(r,i);for(let f=1;f<=e;f++)h.points.push(Ao([r,i],[c[1],c[2]],[c[3],c[4]],[c[5],c[6]],f/e));r=c[5],i=c[6];break}case"Q":{let h=l(r,i);for(let f=1;f<=e;f++)h.points.push(Po([r,i],[c[1],c[2]],[c[3],c[4]],f/e));r=c[3],i=c[4];break}case"E":{let[,h,f,u,d,m,p,k]=c,b=ns(h,f,u,d,m,p),g=l(b[0],b[1]);for(let v=1;v<=e;v++)g.points.push(ns(h,f,u,d,m,p+(k-p)*(v/e)));let y=ns(h,f,u,d,m,k);r=y[0],i=y[1];break}case"Z":s&&(s.points.push([o,a]),s.closed=!0,r=o,i=a);break}return n.filter(c=>c.points.length>0)}function fs(t){let e=0;for(let n=1;n<t.points.length;n++)e+=Math.hypot(t.points[n][0]-t.points[n-1][0],t.points[n][1]-t.points[n-1][1]);return e}function ds(t){if(!(t.gap>0))throw new gt(`hachure gap must be > 0, got ${String(t.gap)}`);if(t.roughness!==void 0&&!(t.roughness>=0))throw new gt(`hachure roughness must be \u2265 0, got ${String(t.roughness)}`)}function ps(t,e,n){var $;let s=pe(t),r=1/0,i=1/0,o=-1/0,a=-1/0;for(let w of s)for(let[M,E]of w.points)M<r&&(r=M),E<i&&(i=E),M>o&&(o=M),E>a&&(a=E);if(!Number.isFinite(r))return[];let l=(r+o)/2,c=(i+a)/2,h=Math.cos(e.angleRad),f=Math.sin(e.angleRad),u=(w,M)=>[(w-l)*h+(M-c)*f,-(w-l)*f+(M-c)*h],d=(w,M)=>[l+w*h-M*f,c+w*f+M*h],m=1/0,p=1/0,k=-1/0,b=-1/0,g=[[r,i],[o,i],[o,a],[r,a]];for(let[w,M]of g){let[E,C]=u(w,M);E<m&&(m=E),C<p&&(p=C),E>k&&(k=E),C>b&&(b=C)}let y=($=e.roughness)!=null?$:1,v=()=>(n()*2-1)*y,S=[];for(let w=p+e.gap/2;w<b;w+=e.gap){let M=d(m,w+v()),E=d(k,w+v());S.push(["M",M[0],M[1]],["L",E[0],E[1]])}return S}function en(t,e,n){let s=us(e),r=pe(t),i=()=>(n()*2-1)*s.roughness,o=[];for(let a=0;a<s.passes;a++){let l=[];for(let c of r){let h=c.points;if(h.length<2)continue;let f=h[0][0]+i(),u=h[0][1]+i();l.push(["M",f,u]);for(let d=1;d<h.length;d++){let m=h[d][0]+i(),p=h[d][1]+i(),k=m-f,b=p-u,g=Math.hypot(k,b)||1,y=i()*.5,v=(f+m)/2+-b/g*y,S=(u+p)/2+k/g*y;l.push(["Q",v,S,m,p]),f=m,u=p}}o.push(l)}return{strokes:o,resolved:s}}function ms(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}function Hr(t,e,n){return en(t,e,at(n>>>0)).strokes}var Xr=class extends J{};function Yt(t,e,n,s,r){if(r<=0)return[["M",t,e],["L",t+n,e],["L",t+n,e+s],["L",t,e+s],["Z"]];let i=Math.PI/2;return[["M",t+r,e],["L",t+n-r,e],["E",t+n-r,e+r,r,r,0,-i,0],["L",t+n,e+s-r],["E",t+n-r,e+s-r,r,r,0,0,i],["L",t+r,e+s],["E",t+r,e+s-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 Mt,Lr,$t=(Lr=class extends J{constructor(e={}){var n;super(e);x(this,"children");U(this,Mt,A(0));this.children=(n=e.children)!=null?n:[];for(let s of this.children)s.parent=this}trackStructure(){D(this,Mt).call(this)}add(e){return e.parent=this,this.children.push(e),D(this,Mt).set(D(this,Mt).peek()+1),this}remove(e){let n=this.children.indexOf(e);return n>=0&&(this.children.splice(n,1),e.parent===this&&(e.parent=null),D(this,Mt).set(D(this,Mt).peek()+1)),this}draw(e,n){let s=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 s)r.emit(e,n)}},Mt=new WeakMap,Lr);function Dr(t){return typeof t=="string"?{kind:"color",color:t}:t}var gs=class extends J{constructor(e={}){var n;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=j(A(""),e.fill),this.stroke=j(A(""),e.stroke),this.strokeWidth=j(A(0),e.strokeWidth),this.reveal=j(A(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&&hs(e.sketch),e.sketchFill&&ds(e.sketchFill),e.sketchFill&&!e.sketch&&B(`${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=(n=e.sketchSeed)!=null?n:this.id!==void 0?ms(this.id):0}draw(e){let n=this.pathSegs();if(this.sketch)return this.drawSketch(e,n);let s=e.resource({kind:"path",segs:n}),r=this.fill();r&&e.push({op:"fillPath",path:s,paint:Dr(r)});let i=this.stroke(),o=this.strokeWidth();if(i&&o>0){let a=this.reveal();a<1?Fr(e,n,{kind:"color",color:i},{width:o},a):e.push({op:"strokePath",path:s,paint:{kind:"color",color:i},stroke:{width:o}})}}drawSketch(e,n){let s=at(this.sketchSeed>>>0),r=this.fill();if(r){let h=e.resource({kind:"path",segs:n});e.push({op:"fillPath",path:h,paint:Dr(r)})}let{strokes:i,resolved:o}=en(n,this.sketch,s),a=this.stroke()||(typeof r=="string"?r:"")||"#000000";if(this.sketchFill){let h=e.resource({kind:"path",segs:n});e.push({op:"save"}),e.push({op:"clip",path:h,rule:"nonzero"});let f=ps(n,this.sketchFill,s);if(f.length>0){let u=e.resource({kind:"path",segs:f});e.push({op:"strokePath",path:u,paint:{kind:"color",color:a},stroke:{width:Math.max(1,o.width*.5),cap:"round"}})}e.push({op:"restore"})}let l=this.reveal(),c=l<1;for(let h of i){if(h.length===0)continue;if(c){Fr(e,h,{kind:"color",color:a},{width:o.width,cap:"round",join:"round"},l);continue}let f=e.resource({kind:"path",segs:h});e.push({op:"strokePath",path:f,paint:{kind:"color",color:a},stroke:T({width:o.width,cap:"round",join:"round"},o.dash?{dash:o.dash}:{})})}}};function j(t,e){return typeof e=="function"?t.bindSource(e):e!==void 0&&t.set(e),t}function Do(t){let e=[],n=null;for(let s of t)s[0]==="M"?(n=[s],e.push(n)):n&&n.push(s);return e}function Fr(t,e,n,s,r){for(let i of Do(e)){let o=pe(i).reduce((l,c)=>l+fs(c),0),a=t.resource({kind:"path",segs:i});t.push({op:"strokePath",path:a,paint:n,stroke:z(T({},s),{dash:[o,o],dashOffset:o*(1-r)})})}}function Je(t){if(t===void 0)return[];if(Array.isArray(t)&&t.every(e=>typeof e=="object"&&e!==null&&Array.isArray(e.v)&&Array.isArray(e.in)&&Array.isArray(e.out)))return t;throw new TypeError(`Path.data expects PathValue (PathContour[]); for an SVG path 'd' string, parse it with pathFromSvg(d) from "@glissade/scene/path" (or window.glissade.pathFromSvg in the browser bundle)`)}function nn(t){let e=[],n=null,s=(i,o=[0,0],a=[0,0])=>{n.v.push(i),n.in.push(o),n.out.push(a)},r=()=>n.v[n.v.length-1];for(let i of t)switch(i[0]){case"M":n={closed:!1,v:[[i[1],i[2]]],in:[[0,0]],out:[[0,0]]},e.push(n);break;case"L":n&&s([i[1],i[2]]);break;case"C":if(n){let o=r();n.out[n.out.length-1]=[i[1]-o[0],i[2]-o[1]],s([i[5],i[6]],[i[3]-i[5],i[4]-i[6]])}break;case"Q":if(n){let o=r(),a=i[1],l=i[2],c=i[3],h=i[4];n.out[n.out.length-1]=[2/3*(a-o[0]),2/3*(l-o[1])],s([c,h],[2/3*(a-c),2/3*(l-h)])}break;case"E":if(n){let[,o,a,l,c,h,f,u]=i,d=Math.cos(h),m=Math.sin(h);for(let p=1;p<=16;p++){let k=f+(u-f)*(p/16),b=l*Math.cos(k),g=c*Math.sin(k);s([o+b*d-g*m,a+b*m+g*d])}}break;case"Z":if(n){n.closed=!0;let o=n.v[0],a=r();n.v.length>1&&Math.abs(o[0]-a[0])<1e-9&&Math.abs(o[1]-a[1])<1e-9&&(n.in[0]=n.in[n.in.length-1],n.v.pop(),n.in.pop(),n.out.pop())}break}return e}var Yr=class extends gs{constructor(e={}){super(e);x(this,"width");x(this,"height");x(this,"cornerRadius");this.width=j(A(0),e.width),this.height=j(A(0),e.height),this.cornerRadius=j(A(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(),n=this.height(),s=Math.min(Math.max(0,this.cornerRadius()),e/2,n/2);return Yt(-e/2,-n/2,e,n,s)}},Gr=class extends gs{constructor(e={}){super(e);x(this,"radius");this.radius=j(A(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"]]}},ys=class extends gs{constructor(e={}){super(e);x(this,"data");let n=e.data,s=typeof n=="function"?()=>Je(n()):n!==void 0?Je(n):void 0;this.data=j(A([]),s),this.registerTarget("d",this.data,"path")}bounds(){let e=1/0,n=1/0,s=-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],l=i.v[o][1],c=[[a,l],[a+i.in[o][0],l+i.in[o][1]],[a+i.out[o][0],l+i.out[o][1]]];for(let h of c)h[0]<e&&(e=h[0]),h[1]<n&&(n=h[1]),h[0]>s&&(s=h[0]),h[1]>r&&(r=h[1])}return e>s?{minX:0,minY:0,maxX:0,maxY:0}:{minX:e,minY:n,maxX:s,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 n of this.data()){let s=n.v.length;if(s!==0){e.push(["M",n.v[0][0],n.v[0][1]]);for(let r=0;r<s-1;r++)e.push(["C",n.v[r][0]+n.out[r][0],n.v[r][1]+n.out[r][1],n.v[r+1][0]+n.in[r+1][0],n.v[r+1][1]+n.in[r+1][1],n.v[r+1][0],n.v[r+1][1]]);n.closed&&s>1&&(e.push(["C",n.v[s-1][0]+n.out[s-1][0],n.v[s-1][1]+n.out[s-1][1],n.v[0][0]+n.in[0][0],n.v[0][1]+n.in[0][1],n.v[0][0],n.v[0][1]]),e.push(["Z"]))}}return e}},ss,Ur=(ss=class extends J{constructor(e){super(e);x(this,"assetId");x(this,"width");x(this,"height");this.assetId=e.assetId,this.width=j(A(0),e.width),this.height=j(A(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 n=this.width(),s=this.height();if(n<=0||s<=0)return;let r=e.resource({kind:"image",assetId:this.assetId});e.push({op:"drawImage",image:r,dst:{x:-n/2,y:-s/2,w:n,h:s}})}},x(ss,"assetKind","image"),ss),rs,Kr=(rs=class extends J{constructor(e){var n,s,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=(n=e.at)!=null?n:0,this.trimStart=(s=e.trimStart)!=null?s:0,this.playbackRate=(r=e.playbackRate)!=null?r:1,this.clipDuration=e.clipDuration,this.sourceFps=e.sourceFps,this.width=j(A(0),e.width),this.height=j(A(0),e.height),this.registerTarget("width",this.width,"number"),this.registerTarget("height",this.height,"number")}mediaTime(e){let n=(e-this.at)*this.playbackRate;if(n<0||this.clipDuration!==void 0&&e-this.at>=this.clipDuration)return null;let s=this.trimStart+n;return this.sourceFps!==void 0?Math.floor(s*this.sourceFps+1e-9)/this.sourceFps:s}draw(e,n){let s=this.mediaTime(n.time);if(s===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:s});e.push({op:"drawImage",image:o,dst:{x:-r/2,y:-i/2,w:r,h:i}})}},x(rs,"assetKind","video"),rs),sn=class extends J{constructor(e={}){var n,s,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=j(A(""),e.text),this.fill=j(A("#000000"),e.fill),this.fontSize=j(A(16),e.fontSize),this.fontFamily=(n=e.fontFamily)!=null?n:"sans-serif",this.fontWeight=(s=e.fontWeight)!=null?s:400,this.fontStyle=(r=e.fontStyle)!=null?r:"normal",this.align=(i=e.align)!=null?i:"left",this.width=j(A(0),e.width),this.lineHeight=(o=e.lineHeight)!=null?o:1.25,this.reveal=j(A(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 n=this.text();if(!n)return{w:0,h:0};let s=T({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),r=this.width(),i=ct(n,s,r>0?r:void 0,e),o=Math.max(...i.map(a=>G(e.measureText(a,s).width)),0);return{w:r>0?r:o,h:G(s.size*this.lineHeight)*i.length}}drawOffset(e){var a,l,c;let n=(l=e!=null?e:(a=this.measurerSource)==null?void 0:a.call(this))!=null?l:Q(),s=this.intrinsicSize(n),r=T({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=(c=ct(this.text(),r,this.width()>0?this.width():void 0,n)[0])!=null?c:"",o=n.measureText(i,r).ascent;return{x:this.align==="left"?0:this.align==="center"?-s.w/2:-s.w,y:-o}}measuredSize(e){var n,s;return this.intrinsicSize((s=e!=null?e:(n=this.measurerSource)==null?void 0:n.call(this))!=null?s:Q())}lineBoxes(e){var c,h;let n=(h=e!=null?e:(c=this.measurerSource)==null?void 0:c.call(this))!=null?h:Q(),s=this.text();if(!s)return[];let r=T({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=ct(s,r,i>0?i:void 0,n),a=G(r.size*this.lineHeight),l=[];for(let f=0;f<o.length;f++){let u=o[f];if(!u)continue;let d=n.measureText(u,r),m=G(d.width),p=this.align==="left"?0:this.align==="center"?-m/2:-m;l.push({text:u,x:p,y:f*a-d.ascent,w:m,h:d.ascent+d.descent})}return l}wordBoxes(e){var c,h;let n=(h=e!=null?e:(c=this.measurerSource)==null?void 0:c.call(this))!=null?h:Q(),s=this.text();if(!s)return[];let r=T({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=ct(s,r,i>0?i:void 0,n),a=G(r.size*this.lineHeight),l=[];for(let f=0;f<o.length;f++){let u=o[f];if(!u)continue;let d=n.measureText(u,r),m=G(d.width),p=this.align==="left"?0:this.align==="center"?-m/2:-m,k=f*a-d.ascent,b=d.ascent+d.descent,g="";for(let y of tn(u)){let v=g;g+=y;let S=y.trim();if(S==="")continue;let $=y.length-y.trimStart().length,w=n.measureText(v+y.slice(0,$),r).width,M=n.measureText(v+y.trimEnd(),r).width;l.push({text:S,line:f,x:p+w,y:k,w:M-w,h:b})}}return l}graphemes(e){var l,c;let n=(c=e!=null?e:(l=this.measurerSource)==null?void 0:l.call(this))!=null?c:Q(),s=this.text();if(!s)return[];let r=T({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=ct(s,r,i>0?i:void 0,n),a=[];for(let h of o)for(let f of St(h))a.push(f);return a}revealHead(e){var u,d,m;let n=(d=e!=null?e:(u=this.measurerSource)==null?void 0:u.call(this))!=null?d:Q(),s=T({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),r=this.width(),i=ct(this.text(),s,r>0?r:void 0,n),o=G(s.size*this.lineHeight),a=i.reduce((p,k)=>p+St(k).length,0),l=this.reveal(),c=Math.max(0,Math.min(Number.isFinite(l)?Math.floor(l):a,a)),h=c,f={x:0,y:0,h:0,line:0,index:c};for(let p=0;p<i.length;p++){let k=(m=i[p])!=null?m:"",b=n.measureText(k,s),g=G(b.width),y=this.align==="left"?0:this.align==="center"?-g/2:-g,v=p*o-b.ascent,S=b.ascent+b.descent,$=St(k);if(h<=$.length)return{x:y+(h<=0?0:n.measureText($.slice(0,h).join(""),s).width),y:v,h:S,line:p,index:c};h-=$.length,f={x:y+b.width,y:v,h:S,line:p,index:c}}return f}draw(e,n){let s=this.text();if(!s)return;let r=T({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=ct(s,r,i>0?i:void 0,n.measurer),a=G(r.size*this.lineHeight),l=this.reveal(),c=Number.isFinite(l),h=c?Math.max(0,Math.floor(l)):0;for(let f=0;f<o.length;f++){let u=o[f];if(!u)continue;if(!c){e.push(T({op:"fillText",text:u,font:r,paint:{kind:"color",color:this.fill()},x:0,y:f*a},this.align!=="left"?{align:this.align}:{}));continue}if(h<=0)break;let d=St(u),m=Math.min(h,d.length);if(h-=m,m===d.length)e.push(T({op:"fillText",text:u,font:r,paint:{kind:"color",color:this.fill()},x:0,y:f*a},this.align!=="left"?{align:this.align}:{}));else{let p=G(n.measurer.measureText(u,r).width),k=this.align==="left"?0:this.align==="center"?-p/2:-p;e.push({op:"fillText",text:d.slice(0,m).join(""),font:r,paint:{kind:"color",color:this.fill()},x:k,y:f*a})}}}};function Qr(t,e,n){var u,d;let s=(d=n!=null?n:(u=t.measurerSource)==null?void 0:u.call(t))!=null?d:Q(),r=t.text();if(!r)return[];let i=T({family:t.fontFamily,size:t.fontSize(),weight:t.fontWeight},t.fontStyle==="italic"?{style:"italic"}:{}),o=t.width(),a=ct(r,i,o>0?o:void 0,s),l=G(i.size*t.lineHeight),c=e.keys,h=[],f=0;for(let m=0;m<a.length;m++){let p=a[m];if(!p)continue;let k=s.measureText(p,i),b=G(k.width),g=t.align==="left"?0:t.align==="center"?-b/2:-b,y=m*l-k.ascent,v="";for(let S of St(p)){v+=S;let $=f+1,w=Number.POSITIVE_INFINITY;for(let M of c)if(M.value>=$){w=M.t;break}Number.isFinite(w)&&h.push({charIndex:f,grapheme:S,time:w,x:g+s.measureText(v,i).width,y,line:m}),f++}}return h}var ws=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"}},rn=null;function Jr(t){rn=t}function Zr(){return rn}function ti(){if(!rn)throw new ws;return rn}var Fo=["Group","Rect","Circle","Path","Text","Image","Video","Layout","Custom"],li=class extends J{constructor(e){var n,s;super(e);x(this,"target");x(this,"color");x(this,"progress");x(this,"padding");x(this,"cornerRadius");this.target=e.text,this.color=ei(A("#ffe066"),e.color),this.progress=ei(A(1),e.progress),this.padding=(n=e.padding)!=null?n:[4,2],this.cornerRadius=(s=e.cornerRadius)!=null?s:4,this.registerTarget("progress",this.progress,"number"),this.registerTarget("color",this.color,"color")}draw(e,n){let s=Math.min(1,Math.max(0,this.progress()));if(s<=0)return;let[r,i]=this.padding,o=this.target.lineBoxes(n.measurer).map(f=>({x:f.x-r,y:f.y-i,w:f.w+2*r,h:f.h+2*i})),a=o.reduce((f,u)=>f+u.w,0);if(a<=0)return;let l=this.target.localMatrix();Et(l,Tt)||e.push({op:"transform",m:l});let c=this.color(),h=s*a;for(let f of o){let u=Math.min(f.w,h);if(h-=u,u<=0)break;let d=Math.min(this.cornerRadius,u/2,f.h/2),m=e.resource({kind:"path",segs:Yt(f.x,f.y,u,f.h,d)});if(e.push({op:"fillPath",path:m,paint:{kind:"color",color:c}}),h<=0)break}}};function zo(t,e={}){return new li(z(T({},e),{text:t}))}function ei(t,e){return typeof e=="function"?t.bindSource(e):e!==void 0&&t.set(e),t}var hi=class extends J{constructor(e){var n,s,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=(n=e.blinkPeriod)!=null?n:1.06,this.blinkPhase=(s=e.blinkPhase)!=null?s:0,this.solidWhileTyping=(r=e.solidWhileTyping)!=null?r:!0,this.caretWidth=(i=e.width)!=null?i:2,this.fill=No(A(""),e.fill),this.registerTarget("fill",this.fill,"color")}draw(e,n){let s=this.target.revealHead(n.measurer);if(s.h<=0)return;let r=!0,i=this.target.graphemes(n.measurer).length,o=s.index<i;if(!(this.solidWhileTyping&&o)){let h=this.blinkPeriod>0?this.blinkPeriod:1;r=((n.time-this.blinkPhase)%h+h)%h<h/2}if(!r)return;let a=this.target.localMatrix();Et(a,Tt)||e.push({op:"transform",m:a});let l=this.fill()||this.target.fill(),c=e.resource({kind:"path",segs:Yt(s.x,s.y,this.caretWidth,s.h,0)});e.push({op:"fillPath",path:c,paint:{kind:"color",color:l}})}};function Lo(t,e={}){return new hi(z(T({},e),{text:t}))}function No(t,e){return typeof e=="function"?t.bindSource(e):e!==void 0&&t.set(e),t}var Ro=.06;function Vo(t,e,n={}){var f,u,d,m;let s=(f=n.start)!=null?f:0,r=(u=n.perChar)!=null?u:Ro,i=(d=n.gap)!=null?d:0,o=s,a=[],l=[I(s,"",{interp:"hold"})],c=[],h=[];for(let p=0;p<e.length;p++){let k=e[p],b=o,g=(m=k.perChar)!=null?m:r;if(k.type!==void 0)for(let y of St(k.type)){o+=g,a.push(y);let v=a.join("");l.push(I(o,v,{interp:"hold"})),c.push({time:o,kind:"insert",grapheme:y,value:v})}if(k.delete!==void 0)for(let y=0;y<k.delete&&a.length>0;y++){o+=g;let v=a.pop(),S=a.join("");l.push(I(o,S,{interp:"hold"})),c.push({time:o,kind:"delete",grapheme:v,value:S})}k.hold!==void 0&&(o+=k.hold),h.push({index:p,start:b,end:o,value:a.join("")}),i>0&&p<e.length-1&&(o+=i)}return{track:pt(t,"string",l),marks:c,steps:h,duration:o}}var Gt=class extends Error{constructor(t){super(t),this.name="EachError"}};function bs(t,e){let n=(t^Math.imul(e+1,2654435769))>>>0;return n=Math.imul(n^n>>>16,569420461),n=Math.imul(n^n>>>15,1935289751),(n^n>>>15)>>>0}var qo=1779033703;function Wo(t,e,n){var s,r,i,o,a,l,c,h,f,u,d,m;if(typeof t=="function")return t(e,n);switch(t.kind){case"row":{let p=(s=t.gap)!=null?s:n>1?1/(n-1):0,k=(r=t.align)!=null?r:.5,b=.5-p*(n-1)/2;return[n===1?.5:b+p*e,k]}case"column":{let p=(i=t.gap)!=null?i:n>1?1/(n-1):0,k=(o=t.align)!=null?o:.5,b=.5-p*(n-1)/2;return[k,n===1?.5:b+p*e]}case"grid":{let p=t.cols;if(!(p>=1))throw new Gt(`grid layout needs cols >= 1 (got ${p})`);let k=(a=t.rows)!=null?a:Math.ceil(n/p),b=(l=t.order)!=null?l:"row",g=b==="row"?e%p:Math.floor(e/k),y=b==="row"?Math.floor(e/p):e%k,v=(c=t.gapX)!=null?c:p>1?1/(p-1):0,S=(h=t.gapY)!=null?h:k>1?1/(k-1):0,$=v*(p-1),w=S*(k-1);return[p===1?.5:.5-$/2+v*g,k===1?.5:.5-w/2+S*y]}case"ring":{let p=(f=t.radius)!=null?f:.5,[k,b]=(u=t.center)!=null?u:[.5,.5],g=((d=t.startAngle)!=null?d:-Math.PI/2)+((m=t.sweep)!=null?m:Math.PI*2)*(n===0?0:e/n);return[k+p*Math.cos(g),b+p*Math.sin(g)]}}}function Bo(t,e,n){let s=(n-1)/2;switch(t){case"from-center":return r=>Math.abs(r-s)*e;case"from-edges":return r=>(s-Math.abs(r-s))*e;case"delay":return r=>r*e}}function _o(t,e){var s,r;let n=(s=t.stagger)!=null?s:0;return typeof n=="function"?n:Bo((r=t.distribute)!=null?r:"delay",n,e)}function jo(t,e,n){var d,m,p,k,b,g;if(!Number.isInteger(t)||t<0)throw new Gt(`each() count must be a non-negative integer (got ${t})`);let s=((d=n.seed)!=null?d:ms(n.id))>>>0,r=n.box,[i,o]=(m=r==null?void 0:r.origin)!=null?m:[0,0],a=[],l=[],c=new Set;for(let y=0;y<t;y++){let v=`${n.id}/${y}`,S=Wo(n.layout,y,t),$={i:y,n:t,id:v,place:S,rng:at(bs(s,y)),seed:s},w=e(y,$);if(!(w instanceof J))throw new Gt(`each() factory must return a Node for index ${y} (got ${typeof w})`);if(c.has(w))throw new Gt(`each() factory returned the same Node instance for index ${y} \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=v;else if(w.id!==v)throw new Gt(`each() factory set id '${w.id}' on index ${y}, but each owns the id namespace \u2014 leave it unset so it becomes '${v}'`);a.push(w),l.push(r?{frac:S,px:[i+S[0]*r.w,o+S[1]*r.h]}:{frac:S})}let h=new $t({id:n.id,children:a}),f=[],u=(k=(p=n.motion)==null?void 0:p.startSec)!=null?k:0;if(n.motion){let y=n.motion,v=(b=y.startSec)!=null?b:0,S=_o(y,t);for(let $=0;$<t;$++){let w=at(bs(bs(s,$),qo)),M=(g=y.jitter)==null?void 0:g.call(y,$,w,t),E=T(T({},M!==void 0?{overrides:M}:{}),y.speed!==void 0?{speed:y.speed}:{}),C=y.clip.apply(`${n.id}/${$}`,v+S($),E);f.push(...C.tracks),C.end>u&&(u=C.end)}}return{node:h,children:a,tracks:f,end:u,places:l}}function ui(t,e={}){var i,o,a;let n=(i=e.start)!=null?i:0,s=(o=e.duration)!=null?o:1,r=(a=e.ease)!=null?a:"easeInOutCubic";return pt(`${t}/reveal`,"number",[I(n,0),I(n+s,1,r)])}function Ho(t,e={}){var s,r;let n=(r=e.delay)!=null?r:((s=e.duration)!=null?s:1)*.6;return Le(t.map(i=>ui(i,e)),n)}var fi=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 Xo(){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 Yo(t,e){if(t==="off")return e();let n=Xo(),s=n.map(i=>i.target[i.key]),r=new Set;n.forEach((i,o)=>{i.target[i.key]=(...a)=>{if(t==="throw")throw new fi(i.label);return r.has(i.label)||(r.add(i.label),B(`${i.label} called inside evaluate() \u2014 nondeterministic, not reproducible on export (\xA75.5)`)),s[o].apply(i.target,a)}});try{return e()}finally{n.forEach((i,o)=>{i.target[i.key]=s[o]})}}var di=class extends Error{constructor(t){super(`duplicate node id '${t}' \u2014 explicit ids must be unique (\xA73.1/\xA76.5)`),this.name="DuplicateNodeIdError"}},pi=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 mi(t,e,n){if(t.measurerSource=n,t.id!==void 0){if(t.id.startsWith("~"))throw new pi(t.id);if(e.has(t.id))throw new di(t.id);e.set(t.id,t)}if(t instanceof $t)for(let s of t.children)mi(s,e,n)}function Go(t){let e=new $t({id:"__root",children:t.children}),n=new Map,s=Xe(),r=A(null);return mi(e,n,()=>{var i;return(i=r())!=null?i:Q()}),{root:e,nodes:n,size:t.size,playhead:s,resolveTarget:i=>{for(let o=i.lastIndexOf("/");o>0;o=i.lastIndexOf("/",o-1)){let a=n.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:Q()}}}var ni=new WeakMap;function gi(t,e){let n=ni.get(t);n||(n=new WeakMap,ni.set(t,n));let s=n.get(e);if(!s){let r=st(e);s={compiled:r,bound:ts(r,t.resolveTarget,t.playhead)},n.set(e,s)}return s}function ye(t,e,n){gi(t,e);let s=e.fps,r={time:n,frame:s!==void 0?Math.round(n*s):-1,measurer:t.textMeasurer};return es(t.playhead,n,()=>{let i=de(t.size);return t.root.emit(i,r),i.finish()})}function on(t){return JSON.stringify(t,Xt)}function Uo(t,e,n){let s=t(),r=t(),i=ye(s,e,n),o=ye(r,e,n);if(on(i)===on(o))return{ok:!0};let a=e.fps!==void 0?Math.round(n*e.fps):-1,l={time:n,frame:a,measurer:s.textMeasurer},c={time:n,frame:a,measurer:r.textMeasurer},h;for(let[f,u]of s.nodes){let d=r.nodes.get(f);if(!d)return{ok:!1,node:f};let m=de(s.size);u.emit(m,l);let p=de(r.size);d.emit(p,c);let k=m.finish(),b=p.finish();if(on(k)===on(b))continue;if(u instanceof $t){h!=null||(h=f);continue}let g=os(k,b).deltas[0];return T({ok:!1,node:f},g!==void 0?{delta:g}:{})}return T({ok:!1},h!==void 0?{node:h}:{})}var Ss=new Set(["blur","drop-shadow","brightness","contrast","saturate"]),si=t=>t<0?0:t>1?1:t;function ri(t,e,n,s,r){let i=1-r,o=i*i*i,a=3*i*i*r,l=3*i*r*r,c=r*r*r;return[o*t[0]+a*e[0]+l*n[0]+c*s[0],o*t[1]+a*e[1]+l*n[1]+c*s[1]]}function Ko(t){let e=[];for(let n of t){let s=n.v.length;for(let r=0;r<s-1;r++)e.push([n.v[r],[n.v[r][0]+n.out[r][0],n.v[r][1]+n.out[r][1]],[n.v[r+1][0]+n.in[r+1][0],n.v[r+1][1]+n.in[r+1][1]],n.v[r+1]]);n.closed&&s>1&&e.push([n.v[s-1],[n.v[s-1][0]+n.out[s-1][0],n.v[s-1][1]+n.out[s-1][1]],[n.v[0][0]+n.in[0][0],n.v[0][1]+n.in[0][1]],n.v[0]])}return e}function we(t,e={}){var h,f;let n=Math.max(1,Math.floor((h=e.samplesPerSegment)!=null?h:32)),s=Ko(t),r=[],i=[];if(s.length>0){let u=ri(...s[0],0);r.push(u),i.push(0);let d=0;for(let m of s)for(let p=1;p<=n;p++){let k=ri(...m,p/n);d+=Math.hypot(k[0]-u[0],k[1]-u[1]),r.push(k),i.push(d),u=k}}else{let u=(f=t[0])==null?void 0:f.v[0];r.push(u?[u[0],u[1]]:[0,0]),i.push(0)}let o=i[i.length-1],a=u=>{if(o<=0||u<=0)return{i:0,f:0};if(u>=o)return{i:r.length-2,f:1};let d=0;for(;d<i.length-1&&i[d+1]<u;)d++;let m=i[d+1]-i[d];return{i:d,f:m>0?(u-i[d])/m:0}},l=u=>{if(r.length===1)return[r[0][0],r[0][1]];let{i:d,f:m}=a(u),p=r[d],k=r[d+1];return[p[0]+(k[0]-p[0])*m,p[1]+(k[1]-p[1])*m]},c=u=>{if(r.length===1)return[1,0];let{i:d}=a(u),m=r[d],p=r[d+1],k=p[0]-m[0],b=p[1]-m[1],g=Math.hypot(k,b);return g>0?[k/g,b/g]:[1,0]};return{length:o,at:l,tangentAt:c,atProgress:u=>l(si(u)*o),tangentAtProgress:u=>c(si(u)*o)}}function Qo(t){return we(t).length}function Jo(t,e){return we(t).at(e)}var yi=class extends J{constructor(e){var a;super(e);x(this,"target");x(this,"progress");this.target=e.target,this.progress=A(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 n=e.samplesPerSegment!==void 0?{samplesPerSegment:e.samplesPerSegment}:{},s=e.path instanceof ys?()=>e.path.data():()=>e.path,r=s(),i=we(r,n),o=()=>{let l=s();return l!==r&&(r=l,i=we(l,n)),i};if(e.target.position.bindSource(()=>o().atProgress(this.progress())),e.orient){let l=(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+l})}}draw(){}};function Zo(t,e,n={}){return new yi(z(T({},n),{target:t,path:e}))}var be=class extends Error{constructor(t){super(t),this.name="TokenMatchError"}},vs=t=>t.replace(/\s+/g,"");function xs(t,e,n=1){let s=vs(e);if(s.length===0)throw new be("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+=vs(t[a].text),o===s){if(r++,r===n)return[i,a];break}if(!s.startsWith(o))break}}throw new be(`no match for token '${e}'${n>1?` (occurrence ${n})`:""} \u2014 segments are [${t.map(i=>`'${i.text}'`).join(", ")}]`)}var wi=class extends J{constructor(e){var s,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=(s=e.padding)!=null?s:[4,2],this.cornerRadius=(r=e.cornerRadius)!=null?r:4,this.rematch=(i=e.rematch)!=null?i:!1;let n=this.target.wordBoxes();this.ranges=e.ranges.map((o,a)=>{var f;let l=this.resolveRun(n,o),c=(f=o.id)!=null?f:`r${a}`,h={spec:o,fill:an(A("#ffe066"),o.fill),opacity:an(A(1),o.opacity),progress:an(A(1),o.progress),scale:an(A(1),o.scale),offset:ea(jt([0,0]),o.offset),run:l,bound:ii(n,l)};return this.registerTarget(`${c}/fill`,h.fill,"color"),this.registerTarget(`${c}/opacity`,h.opacity,"number"),this.registerTarget(`${c}/progress`,h.progress,"number"),this.registerTarget(`${c}/scale`,h.scale,"number"),this.registerTarget(`${c}/offset`,h.offset,"vec2"),this.registerTarget(`${c}/offset.x`,h.offset.x,"number"),this.registerTarget(`${c}/offset.y`,h.offset.y,"number"),h})}resolveRun(e,n){var s;if(typeof n.match!="string"){let[r,i]=n.match;if(r<0||i>=e.length||r>i)throw new be(`word index range [${r}, ${i}] out of bounds (${e.length} boxes)`);return[r,i]}return xs(e,n.match,(s=n.occurrence)!=null?s:1)}draw(e,n){var l;let s=this.target.wordBoxes(n.measurer);if(s.length===0)return;let r=this.target.localMatrix(),[i,o]=this.padding,a=!1;for(let c of this.ranges){let h=c.opacity();if(h<=0)continue;let f=Math.min(1,Math.max(0,c.progress()));if(f<=0)continue;let u=c.run;if(this.rematch&&typeof c.spec.match=="string")u=xs(s,c.spec.match,(l=c.spec.occurrence)!=null?l:1);else if(ii(s,u)!==c.bound)throw new be(`bound token '${c.bound}' no longer matches boxes [${u[0]}, ${u[1]}] \u2014 the text changed (segments now [${s.slice(u[0],u[1]+1).map(v=>`'${v.text}'`).join(", ")}]); pass rematch: true for animated text`);let d=[];for(let v=u[0];v<=u[1];v++){let S=s[v],$=d[d.length-1],w=v>u[0]&&s[v-1].line===S.line?$:void 0;w?(w.w=S.x+S.w+i-w.x,w.y=Math.min(w.y,S.y-o),w.h=Math.max(w.h,S.y+S.h+o-w.y)):d.push({x:S.x-i,y:S.y-o,w:S.w+2*i,h:S.h+2*o})}!a&&!Et(r,Tt)&&(e.push({op:"transform",m:r}),a=!0);let m=h<1;m&&e.push({op:"pushGroup",opacity:h,blend:"source-over",filters:[]});let p=c.fill(),k=c.scale(),[b,g]=c.offset(),y=f*d.reduce((v,S)=>v+S.w,0);for(let v of d){let S=Math.min(v.w,y);if(y-=S,S<=0)break;let $=v.x+v.w/2+b,w=v.y+v.h/2+g,M=S*k,E=v.h*k,C=$-v.w/2*k,L=w-E/2,N=Math.min(this.cornerRadius,M/2,E/2),X=e.resource({kind:"path",segs:Yt(C,L,M,E,N)});if(e.push({op:"fillPath",path:X,paint:{kind:"color",color:p}}),y<=0)break}m&&e.push({op:"popGroup"})}}};function ii(t,e){return t.slice(e[0],e[1]+1).map(n=>vs(n.text)).join("")}function ta(t,e){return new wi(z(T({},e),{text:t}))}function an(t,e){return typeof e=="function"?t.bindSource(e):e!==void 0&&t.set(e),t}function ea(t,e){return typeof e=="function"?t.bindSource(e):e!==void 0&&t.set(e),t}function bi(t){let e=[],n=s=>{if(s instanceof sn){let r=s.text();r&&e.push({family:s.fontFamily,text:r})}if(s instanceof $t)for(let r of s.children)n(r)};return n(t.root),e}function na(t){let e=t.indexOf("/");return e>=0?t.slice(0,e):t}function sa(t,e){let n=[];for(let s of e.tracks){if(s.type!=="string")continue;let r=t.nodes.get(na(s.target));if(r instanceof sn)for(let i of s.keys){let o=i.value;typeof o=="string"&&o&&n.push({family:r.fontFamily,text:o})}}return n}async function Es(t,e,n,s={}){var c,h;let r=(c=s.mode)!=null?c:"dev",i=le(e.assets),o=[...bi(t),...(h=s.extraUsages)!=null?h:[]],a=new Set;for(let f of o)if(i.has(f.family))for(let u of i.fallbackChain(f.family))a.add(u);let l=new Map;for(let f of a){let u=i.resolveFace(f);if(!u)continue;let d=await n(u.url);d&&l.set(f,Re(d))}return Zn(o,i,l,r,T({},s.osFamilies!==void 0?{osFamilies:s.osFamilies}:{}))}var ge=class extends Error{constructor(e,n,s){super(`asset '${e}' not ready: ${n}. 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=n,this.mediaT=s}},ra=class extends $t{constructor(e){var s;super(e);x(this,"wgsl");x(this,"uniformSignals");this.wgsl=e.wgsl;let n=new Map;for(let[r,i]of Object.entries((s=e.uniforms)!=null?s:{})){let o=A(i);n.set(r,o),this.registerTarget(`u.${r}`,o,"number")}this.uniformSignals=n}uniform(e){let n=this.uniformSignals.get(e);if(!n)throw new Error(`ShaderEffect has no uniform '${e}' (have: ${[...this.uniformSignals.keys()].join(", ")})`);return n}groupShader(){let e={};for(let[n,s]of this.uniformSignals)e[n]=s();return{wgsl:this.wgsl,uniforms:e}}},ia=t=>t*t*(3-2*t),oa=2.4,aa=1-Math.exp(-5.76/2),ca=t=>(1-Math.exp(-((t*oa)**2)/2))/aa;function la(t,e){if(e==="linear"||t.length<2)return t;let n=e==="gaussian"?ca:ia,s=t[0].offset,r=t[t.length-1].offset-s;if(r<=0)return t;let i=[],o=0;for(let a=0;a<64;a++){let l=s+r*(a/63);for(;o<t.length-2&&l>t[o+1].offset;)o++;let c=t[o],h=t[o+1],f=h.offset-c.offset,u=f>0?Math.min(1,Math.max(0,(l-c.offset)/f)):0;i.push({offset:l,color:ut(c.color,h.color,n(u))})}return i}var ha=4,ua=2,Ms=.32,oi=1e-6,ai=1024;function ki(t,e,n){let s=new Uint8ClampedArray(Math.max(1,e)*Math.max(1,n)*4),r=t.points.map(l=>({u:l.pos[0],v:l.pos[1],lab:Ot(dt(l.color))})),i=t.bg!==void 0?Ot(dt(t.bg)):null,o=t.interpolation==="gaussian",a=2*Ms*Ms;for(let l=0;l<n;l++){let c=n>1?(l+.5)/n:.5;for(let h=0;h<e;h++){let f=e>1?(h+.5)/e:.5,u=0,d=0,m=0,p=0,k=0;i&&(u=1,d=i.L,m=i.a,p=i.b,k=i.alpha);let b=!1;for(let v=0;v<r.length;v++){let S=r[v],$=f-S.u,w=c-S.v,M=$*$+w*w;if(M<=oi*oi){d=S.lab.L,m=S.lab.a,p=S.lab.b,k=S.lab.alpha,b=!0;break}let E;o?E=Math.exp(-M/a):E=1/M,u+=E,d+=E*S.lab.L,m+=E*S.lab.a,p+=E*S.lab.b,k+=E*S.lab.alpha}let g;if(b)g=Wt({L:d,a:m,b:p,alpha:k});else if(u>0){let v=1/u;g=Wt({L:d*v,a:m*v,b:p*v,alpha:k*v})}else g={r:0,g:0,b:0,a:0};let y=(l*e+h)*4;s[y]=g.r,s[y+1]=g.g,s[y+2]=g.b,s[y+3]=Math.round(g.a*255)}}return s}function vi(t,e){return{w:Math.min(ai,Math.max(1,Math.ceil(Math.abs(t)/4))),h:Math.min(ai,Math.max(1,Math.ceil(Math.abs(e)/4)))}}var ci=!1;function fa(t){var e,n,s;return ci||(ci=!0,B("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")),(s=(n=t.bg)!=null?n:(e=t.points[0])==null?void 0:e.color)!=null?s:"#00000000"}function ks(t,e,n){if(e.kind==="color")return e.color;if(e.kind==="mesh")return fa(e);let s;if(e.kind==="radial"){let i=e.center?e.center[0]:n?(n.minX+n.maxX)/2:0,o=e.center?e.center[1]:n?(n.minY+n.maxY)/2:0,a=e.radius!==void 0?e.radius:n?Math.hypot(n.maxX-n.minX,n.maxY-n.minY)/2:0;s=t.createRadialGradient(i,o,0,i,o,a)}else{let i=e.from?e.from[0]:n?(n.minX+n.maxX)/2:0,o=e.from?e.from[1]:n?n.minY:0,a=e.to?e.to[0]:n?(n.minX+n.maxX)/2:0,l=e.to?e.to[1]:n?n.maxY:0;s=t.createLinearGradient(i,o,a,l)}let r=e.interpolation?la(e.stops,e.interpolation):e.stops;for(let i of r)s.addColorStop(i.offset,i.color);return s}function cn(t){return`${t.style==="italic"?"italic ":""}${t.weight!==void 0&&t.weight!==400?`${t.weight} `:""}${t.size}px ${t.family}`}var da=16;function pa(t){let e=n=>Object.is(n,-0)?"0":String(Math.round(n*1e4)/1e4);return`${e(t[0])},${e(t[1])},${e(t[2])},${e(t[3])},${e(t[4])},${e(t[5])}`}function ma(t){let e=0;for(let n of t!=null?t:[])n.kind==="blur"?e+=3*n.radius:n.kind==="drop-shadow"&&(e+=Math.max(Math.abs(n.dx),Math.abs(n.dy))+3*n.blur);return e}function xi(t,e,n){return t?(e<t.minX&&(t.minX=e),n<t.minY&&(t.minY=n),e>t.maxX&&(t.maxX=e),n>t.maxY&&(t.maxY=n),t):{minX:e,minY:n,maxX:e,maxY:n}}function me(t,e,n,s,r,i){for(let[o,a]of[[n,s],[r,s],[n,i],[r,i]])t.bounds=xi(t.bounds,e[0]*o+e[2]*a+e[4],e[1]*o+e[3]*a+e[5])}function ga(t){let e=null,n=(s,r)=>{e=xi(e,s,r)};for(let s of t)switch(s[0]){case"M":case"L":n(s[1],s[2]);break;case"C":n(s[1],s[2]),n(s[3],s[4]),n(s[5],s[6]);break;case"Q":n(s[1],s[2]),n(s[3],s[4]);break;case"E":{let r=Math.max(s[3],s[4]);n(s[1]-r,s[2]-r),n(s[1]+r,s[2]+r);break}}return e}var Ts=class{constructor(t,e="warn",n=(i=>(i=(r=>(r=(s=>(s=globalThis.process)==null?void 0:s.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=n}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 n=this.images.get(t.assetId);if(!n)throw new ge(t.assetId,"no decoded image registered");return n}if(t.kind==="videoFrame"){let n=this.videos.get(t.assetId);if(!n)throw new ge(t.assetId,"no VideoFrameSource registered",t.mediaT);try{return n.getFrameSync(t.mediaT)}catch(s){throw s instanceof ge?new ge(t.assetId,s.detail,t.mediaT):s}}throw new Error(`resource ${e} is not drawable`)}path(t,e){let n=t[e];if(!n||n.kind!=="path")throw new Error(`resource ${e} is not a path`);let s=this.pathCache.get(n);return s||(s=this.buildPath(n.segs),this.pathCache.set(n,s)),s}pathBounds(t,e){var s;let n=t[e];return!n||n.kind!=="path"?null:(this.pathBoundsCache.has(n)||this.pathBoundsCache.set(n,ga(n.segs)),(s=this.pathBoundsCache.get(n))!=null?s:null)}buildPath(t){let e=this.host.newPath();for(let n of t)switch(n[0]){case"M":e.moveTo(n[1],n[2]);break;case"L":e.lineTo(n[1],n[2]);break;case"C":e.bezierCurveTo(n[1],n[2],n[3],n[4],n[5],n[6]);break;case"Q":e.quadraticCurveTo(n[1],n[2],n[3],n[4]);break;case"E":e.ellipse(n[1],n[2],n[3],n[4],n[5],n[6],n[7]);break;case"Z":e.closePath();break}return e}acquire(t,e){let n=this.pool.pop();return n?(n.width!==t&&(n.width=t),n.height!==e&&(n.height=e),n):this.host.createCanvas(t,e)}release(t){this.pool.length<8&&this.pool.push(t)}cacheStore(t,e){let n=this.rasterCache.get(t);for(n&&(this.rasterCache.delete(t),n.canvas!==e.canvas&&this.release(n.canvas)),this.rasterCache.set(t,e);this.rasterCache.size>da;){let s=this.rasterCache.keys().next().value;if(s===void 0)break;let r=this.rasterCache.get(s);this.rasterCache.delete(s),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,n,s){let r=s.maxX-s.minX,i=s.maxY-s.minY;if(r<=0||i<=0)return;let{w:o,h:a}=vi(r,i),l=ki(n,o,a),c=this.acquire(o,a),h=this.host.context(c),f=h.createImageData(o,a);f.data.set(l),h.putImageData(f,0,0),t.save(),t.clip(e,"nonzero"),t.imageSmoothingEnabled=!0,t.drawImage(c,0,0,o,a,s.minX,s.minY,r,i),t.restore(),this.release(c)}composite(t,e,n,s,r,i,o,a,l,c,h,f){let u=l!==void 0&&l!=="none",d=u?ma(c):0;r||a!=="source-over"?e.unbounded=!0:s&&me(e,Tt,s.minX-d,s.minY-d,s.maxX+d,s.maxY+d);let m=u&&!i&&!r&&a==="source-over";if(!(m&&s===null)){if(t.save(),t.resetTransform(),m&&s){let p=Math.max(0,Math.floor(s.minX-d)),k=Math.max(0,Math.floor(s.minY-d)),b=Math.min(h,Math.ceil(s.maxX+d)),g=Math.min(f,Math.ceil(s.maxY+d));if(p>=b||k>=g){t.restore();return}let y=this.host.newPath();y.moveTo(p,k),y.lineTo(b,k),y.lineTo(b,g),y.lineTo(p,g),y.closePath(),t.clip(y,"nonzero")}t.globalAlpha=o,u&&(t.filter=l),t.globalCompositeOperation=a,t.drawImage(n,0,0),t.restore()}}render(t,e){var f,u,d,m,p,k,b,g,y,v,S;let{w:n,h:s}=e.size;t.width!==n&&(t.width=n),t.height!==s&&(t.height=s);let r=this.host.context(t);r.resetTransform(),r.clearRect(0,0,n,s);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],l=Tt,c=[],h=e.commands;for(let $=0;$<h.length;$++){let w=h[$];switch(w.op){case"save":c.push(l),o().save();break;case"restore":l=(f=c.pop())!=null?f:l,o().restore();break;case"transform":l=ue(l,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),(u=w.rule)!=null?u:"nonzero");break;case"fillPath":{let M=o(),E=this.pathBounds(e.resources,w.path);w.paint.kind==="mesh"&&E?this.fillMesh(M,this.path(e.resources,w.path),w.paint,E):(M.fillStyle=ks(M,w.paint,E),M.fill(this.path(e.resources,w.path))),E&&me(a(),l,E.minX,E.minY,E.maxX,E.maxY);break}case"strokePath":{let M=o(),E=this.pathBounds(e.resources,w.path);if(M.strokeStyle=ks(M,w.paint,E),M.lineWidth=w.stroke.width,M.lineCap=(d=w.stroke.cap)!=null?d:"butt",M.lineJoin=(m=w.stroke.join)!=null?m:"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),E){let C=w.stroke.width*(((k=w.stroke.join)!=null?k:"miter")==="miter"?5:1);me(a(),l,E.minX-C,E.minY-C,E.maxX+C,E.maxY+C)}break}case"fillText":{let M=o();M.font=cn(w.font),M.fillStyle=ks(M,w.paint,null),M.textBaseline="alphabetic",M.textAlign=(b=w.align)!=null?b:"left",M.fillText(w.text,w.x,w.y);try{let E=M.measureText(w.text).width,C=(g=w.align)!=null?g:"left",L=C==="center"?w.x-E/2:C==="right"?w.x-E:w.x,N=w.font.size;me(a(),l,L-N,w.y-1.5*N,L+E+N,w.y+.75*N)}catch(E){a().unbounded=!0}break}case"drawImage":{let M=e.resources[w.image];if(!M)throw new Error(`drawImage references missing resource ${w.image}`);let E=this.resolveDrawable(M,w.image),C=o();w.smoothing!==void 0&&(C.imageSmoothingEnabled=w.smoothing);let{x:L,y:N,w:X,h:tt}=w.dst;w.src?C.drawImage(E,w.src.x,w.src.y,w.src.w,w.src.h,L,N,X,tt):C.drawImage(E,L,N,X,tt),me(a(),l,L,N,L+X,N+tt);break}case"pushGroup":{let M=o(),E=this.cacheEnabled&&w.cacheKey!==void 0&&w.shader===void 0?`${w.cacheKey}@${pa(l)}`:void 0;if(E!==void 0){let N=this.cacheTouch(E);if(N){this.composite(M,a(),N.canvas,N.bounds,N.unbounded,!1,w.opacity,w.blend,Ze(w.filters),w.filters,n,s);let X=1;for(;X>0&&++$<h.length;){let tt=h[$];tt.op==="pushGroup"?X++:tt.op==="popGroup"&&X--}break}}let C=this.acquire(n,s),L=this.host.context(C);L.resetTransform(),L.clearRect(0,0,n,s),L.setTransform(M.getTransform()),i.push(T(z(T({ctx:L,canvas:C,opacity:w.opacity,blend:w.blend,filter:Ze(w.filters),filters:w.filters},w.shader!==void 0?{shader:w.shader}:{}),{bounds:null,unbounded:!1}),E!==void 0?{cacheStoreKey:E}:{}));break}case"popGroup":{let M=i.pop();if(!M||M.canvas===null)throw new Error("popGroup without matching pushGroup");let E=o(),C=M.canvas,L=!1;if(M.shader!==void 0){let N=(S=(v=(y=this.host).applyShader)==null?void 0:v.call(y,M.canvas,M.shader,n,s))!=null?S:null;if(N!==null)C=N,L=!0,M.bounds={minX:0,minY:0,maxX:n,maxY:s},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,B("ShaderEffect pass skipped: no shader runner here (headless or webgpu-less browser) \u2014 subtree composites unfiltered (\xA73.7 caps.shaders)"))}}this.composite(E,a(),C,M.bounds,M.unbounded,L,M.opacity,M.blend,M.filter,M.filters,n,s),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 ke=null;function Mi(t){ke=t}function ya(t,e){if(typeof OffscreenCanvas!="undefined")return new OffscreenCanvas(t,e);let n=document.createElement("canvas");return n.width=t,n.height=e,n}var wa=16384,ln=class{constructor(t,e={}){x(this,"target");x(this,"raster");var n;this.target=t,this.raster=new Ts({context:s=>this.context(s),createCanvas:(s,r)=>ya(s,r),newPath:()=>new Path2D,applyShader:(s,r,i,o)=>{var a;return(a=ke==null?void 0:ke.apply(s,r,i,o))!=null?a:null}},(n=e.shaderCaps)!=null?n:"warn")}get caps(){return{filters:Ss,shaders:ke!==null,maxTextureSize:wa}}setImageAsset(t,e){this.raster.setImageAsset(t,e)}setVideoAsset(t,e){this.raster.setVideoAsset(t,e)}measureText(t,e){let n=this.context(this.target);n.save(),n.font=cn(e);let s=n.measureText(t);return n.restore(),{width:s.width,ascent:s.actualBoundingBoxAscent,descent:s.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}};var lt=class extends Error{constructor(t){super(t),this.name="ClipError"}};function Si(t,e,n){let s;try{s=At(n)}catch(i){throw new lt(`clip override for '${t}' has an un-typeable value ${JSON.stringify(n)} (channel type '${e}')`)}let r=i=>i==="color"||i==="string";if(!(s===e||r(s)&&r(e)))throw new lt(`clip override for '${t}' is a '${s}' value but the channel is '${e}' (${JSON.stringify(n)}); a mismatched override samples to NaN`);return n}function Ei(t){return t.keys.length===0?0:t.keys[t.keys.length-1].t}function ba(t,e,n){if(typeof t=="string")return vt(`${t}/${n}`);let s=t[e];if(s===void 0)throw new lt(`clip target map is missing channel '${e}' \u2014 provide a target for every channel, or pass a node-id string`);return vt(s)}function ka(t,e,n,s,r){var a;if(e.keys.length===0)throw new lt(`clip channel '${t}' has no keys`);let i=(a=e.type)!=null?a:At(e.keys[0].value),o=e.keys.length-1;if(r&&o===0&&r.from!==void 0)throw new lt(r.to!==void 0?`clip override for '${t}' supplies both 'from' and 'to' on a single-key channel \u2014 ambiguous (both target the only key)`:`clip override for '${t}' supplies 'from' on a single-key channel \u2014 ambiguous (the only key already is the 'to' value)`);return pt(t,i,e.keys.map((l,c)=>{let h=l.value,f=!1;r&&(c===0&&r.from!==void 0&&(h=Si(t,i,r.from),f=!0),c===o&&r.to!==void 0&&(h=Si(t,i,r.to),f=!0));let u={t:n+l.t/s,value:h},d=r&&c===o&&r.ease!==void 0?r.ease:l.ease;return d!==void 0&&(u.ease=d),l.interp!==void 0&&(u.interp=l.interp),l.id!==void 0&&(u.id=l.id),l.derived!==void 0&&!f&&(u.derived=l.derived),l.from!==void 0&&(u.from=l.from),u}))}function yt(t){let e=Object.keys(t.channels);if(e.length===0)throw new lt("clip() requires at least one channel");let n=0;for(let r of e){let i=t.channels[r];if(i.keys.length===0)throw new lt(`clip channel '${r}' has no keys`);n=Math.max(n,Ei(i))}function s(r,i,o){var f;let a=(f=o==null?void 0:o.speed)!=null?f:1;if(!(a>0))throw new lt(`clip speed must be > 0 (got ${a})`);let l=o==null?void 0:o.overrides,c=[],h=i;for(let u of e){let d=t.channels[u],m=ba(r,u,d.path);c.push(ka(m,d,i,a,l==null?void 0:l[u])),h=Math.max(h,i+Ei(d)/a)}if(l){for(let u of Object.keys(l))if(!(u in t.channels))throw new lt(`clip override references unknown channel '${u}'`)}return{tracks:c,end:h}}return{spec:t,duration:n,apply:s}}function va(t,e,n,s){var h;let r=(h=s==null?void 0:s.stagger)!=null?h:0,i=typeof r=="function"?r:u=>u*r,f=s!=null?s:{},{stagger:o}=f,a=Vt(f,["stagger"]),l=[],c=n;return e.forEach((u,d)=>{let m=t.apply(u,n+i(d),a);l.push(...m.tracks),m.end>c&&(c=m.end)}),{tracks:l,end:c}}function xa(t){var s,r;let e=(s=t==null?void 0:t.duration)!=null?s:.3,n=(r=t==null?void 0:t.ease)!=null?r:"easeOutCubic";return yt({channels:{opacity:{path:"opacity",keys:[I(0,0),I(e,1,n)]},scale:{path:"scale",keys:[I(0,[.8,.8]),I(e,[1,1],n)]}}})}function Ma(t,e){var o,a,l;let n=(o=e==null?void 0:e.duration)!=null?o:.3,s=(a=e==null?void 0:e.ease)!=null?a:"easeOutCubic",r=(l=e==null?void 0:e.distance)!=null?l:40,i=t==="left"?[-r,0]:t==="right"?[r,0]:t==="top"?[0,-r]:[0,r];return yt({channels:{opacity:{path:"opacity",keys:[I(0,0),I(n,1,s)]},offset:{path:"position",keys:[I(0,i),I(n,[0,0],s)]}}})}function Sa(t){var r,i,o;let e=(r=t==null?void 0:t.duration)!=null?r:.4,n=(i=t==null?void 0:t.ease)!=null?i:"easeInOutSine",s=(o=t==null?void 0:t.scale)!=null?o:1.1;return yt({channels:{scale:{path:"scale",keys:[I(0,[1,1]),I(e/2,[s,s],n),I(e,[1,1],n)]}}})}function Ea(t){var r,i,o;let e=(r=t==null?void 0:t.duration)!=null?r:2,n=(i=t==null?void 0:t.ease)!=null?i:"easeInOutSine",s=(o=t==null?void 0:t.amplitude)!=null?o:8;return yt({channels:{drift:{path:"position",keys:[I(0,[0,0]),I(e/2,[s,0],n),I(e,[0,0],n)]}}})}var Ut=class extends Error{constructor(t){super(t),this.name="MorphError"}};function $s(t,e){for(let[n,s]of[["x",e.x],["y",e.y],["w",e.w],["h",e.h]])if(!Number.isFinite(s))throw new Ut(`morph ${t}.${n} must be finite (got ${s})`);if(!(e.w>0)||!(e.h>0))throw new Ut(`morph ${t} must have w>0 and h>0 (got w=${e.w}, h=${e.h}); a zero/negative box yields a NaN/Infinity scale`)}function hn(t,e){let n=typeof t=="string"?t:t[Pt];return typeof n!="string"||n.length===0?`${String(n)}/${e}`:`${typeof t=="string"?n:n.slice(0,Math.max(0,n.lastIndexOf("/")))}/${e}`}function Ta(t,e,n,s){var b,g,y;let{at:r,duration:i}=s,o=s.ease,a=(b=s.crossfade)!=null?b:.5,l=(g=s.metric)!=null?g:"transform";if(l!=="transform")throw new Ut(`morph metric '${l}' is not supported in v1 (only 'transform')`);if($s("from",t),$s("to",e),!(i>0))throw new Ut(`morph duration must be > 0 (got ${i})`);if(!(a>=0&&a<=1))throw new Ut(`morph crossfade must be in [0,1] (got ${a})`);let c=(y=s.base)!=null?y:{w:e.w,h:e.h};$s("to",{x:0,y:0,w:c.w,h:c.h});let h=[t.w/c.w,t.h/c.h],f=[e.w/c.w,e.h/c.h],u=[t.x,t.y],d=[e.x,e.y],m={position:{path:"position",type:"vec2",keys:[I(0,u),I(i,d,o)]},scale:{path:"scale",type:"vec2",keys:[I(0,h),I(i,f,o)]}},p={position:hn(n.morphNode,"position"),scale:hn(n.morphNode,"scale")};n.fromNode!==void 0&&i*a>0&&(m.fromOpacity={path:"opacity",type:"number",keys:[I(0,1),I(i*a,0,o)]},p.fromOpacity=hn(n.fromNode,"opacity")),n.toNode!==void 0&&i*(1-a)<i&&(m.toOpacity={path:"opacity",type:"number",keys:[I(i*(1-a),0),I(i,1,o)]},p.toOpacity=hn(n.toNode,"opacity"));let{tracks:k}=yt({channels:m}).apply(p,r);return{tracks:k,end:r+i}}var Cs=class extends Error{constructor(t){super(t),this.name="PresenceError"}},As=.3;function $a(){return yt({channels:{opacity:{path:"opacity",keys:[I(0,0),I(As,1)]}}})}function Ia(){return yt({channels:{opacity:{path:"opacity",keys:[I(0,1),I(As,0)]}}})}function Ca(t){return typeof t.apply=="function"}function Os(t){return Array.isArray(t)}function Ci(t,e){var i,o;let n=(i=t.dur)!=null?i:As,s=t.ease,r={};if(t.opacity!==void 0){let[a,l]=t.opacity;r.opacity={path:"opacity",keys:[I(0,a),I(n,l,...Is(s))]}}if(t.offset!==void 0){let[a,l]=Aa(t.offset,(o=t.edge)!=null?o:"bottom",e);r.offset={path:"position",keys:[I(0,a),I(n,l,...Is(s))]}}if(t.scale!==void 0){let[a,l]=Pa(t.scale);r.scale={path:"scale",keys:[I(0,a),I(n,l,...Is(s))]}}return yt({channels:r})}function Is(t){return t!==void 0?[t]:[]}function Oa(t,e){return t==="left"?[-e,0]:t==="right"?[e,0]:t==="top"?[0,-e]:[0,e]}function Aa(t,e,n){if(Array.isArray(t)&&Os(t[0]))return t;let s=Os(t)?t:Oa(e,t),r=[0,0];return n==="enter"?[s,r]:[r,s]}function Pa(t){let[e,n]=t,s=r=>Os(r)?r:[r,r];return[s(e),s(n)]}function Ti(t,e,n){return t===void 0?n():Ca(t)?t:Ci(t,e)}function $i(t,e){var n;return t.duration/((n=e==null?void 0:e.speed)!=null?n:1)}function Da(t){return t.map((e,n)=>[e,n]).sort((e,n)=>e[0].t-n[0].t||e[1]-n[1]).map(([e])=>e)}function Ii(t,e){let n=[],s=[];for(let r of t)r.target===e?s=r.keys:n.push(r);return{opacityKeys:s,rest:n}}function Oi(t){let e=Da(t),n=[];for(let s of e){let r=n[n.length-1];r&&r.t===s.t?n[n.length-1]=s:n.push(s)}return n}function Fa(t,e){let n=[],s=new Map;for(let r of[...t,...e]){let i=s.get(r.target);i?i.push(r):(s.set(r.target,[r]),n.push(r.target))}return n.map(r=>{let i=s.get(r);if(i.length===1)return i[0];let o=i.flatMap(a=>a.keys);return pt(r,i[0].type,Oi(o))})}function za(t,e){var v,S,$,w;let n=(S=e.show)!=null?S:(v=e.window)==null?void 0:v[0],s=(w=e.hide)!=null?w:($=e.window)==null?void 0:$[1];if(n===void 0||s===void 0)throw new Cs("presence() needs a window: pass { show, hide } or { window: [show, hide] }");let r=vt(typeof t=="string"?`${t}/opacity`:t),i=r.lastIndexOf("/"),o=i<0?r:r.slice(0,i),a=Ti(e.enter,"enter",$a),l=Ti(e.exit,"exit",Ia),c=a.apply(o,n,e.enterOpts),h=n+$i(a,e.enterOpts),f=$i(l,e.exitOpts),u=s-f;if(u<=n)throw new Cs(`presence('${o}') exit needs ${f.toFixed(3)}s but only ${(s-n).toFixed(3)}s between show (${n}) and hide (${s}) \u2014 widen the window or shorten/speed up the exit`);let d=l.apply(o,u,e.exitOpts),{opacityKeys:m,rest:p}=Ii(c.tracks,r),{opacityKeys:k,rest:b}=Ii(d.tracks,r),g=[I(0,0,{interp:"hold"}),I(h,1,{interp:"hold"}),I(s,0,{interp:"hold"})],y=[];if(m.length>0?m.forEach((M,E)=>{E===0&&M.value!==0&&M.interp!=="hold"?y.push(z(T({},M),{interp:"hold"})):y.push(M)}):y.push(I(n,0),I(h,1)),k.length>0)for(let M of k)y.push(M);else y.push(I(u,1),I(s,0));return{tracks:[pt(r,"number",Oi([...g,...y])),...Fa(p,b)],end:s,shownAt:n,hiddenAt:s}}function Ai(t){var f;let e=(f=t.match(/[MmLlHhVvCcQqZz]|-?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g))!=null?f:[],n=[],s=0,r=0,i=0,o=0,a=0,l="",c=()=>Number(e[s++]),h=u=>!!u&&/^[MmLlHhVvCcQqZz]$/.test(u);for(;s<e.length;){let u=e[s];if(h(u)?s++:u=l==="M"?"L":l==="m"?"l":l,!u)break;let d=u===u.toLowerCase();switch(u.toUpperCase()){case"M":{let m=c()+(d?r:0),p=c()+(d?i:0);r=m,i=p,o=m,a=p,n.push(["M",m,p]);break}case"L":{let m=c()+(d?r:0),p=c()+(d?i:0);r=m,i=p,n.push(["L",m,p]);break}case"H":{let m=c()+(d?r:0);r=m,n.push(["L",m,i]);break}case"V":{let m=c()+(d?i:0);i=m,n.push(["L",r,m]);break}case"C":{let m=c()+(d?r:0),p=c()+(d?i:0),k=c()+(d?r:0),b=c()+(d?i:0),g=c()+(d?r:0),y=c()+(d?i:0);r=g,i=y,n.push(["C",m,p,k,b,g,y]);break}case"Q":{let m=c()+(d?r:0),p=c()+(d?i:0),k=c()+(d?r:0),b=c()+(d?i:0);r=k,i=b,n.push(["Q",m,p,k,b]);break}case"Z":n.push(["Z"]),r=o,i=a;break;default:s++;break}l=u}return n}function La(t){return nn(Ai(t))}function Pi(){let t=0,e=!1;return{start(n){e=!0;let s,r=i=>{e&&(s!=null||(s=i),n((i-s)/1e3),t=requestAnimationFrame(r))};t=requestAnimationFrame(r)},stop(){e=!1,cancelAnimationFrame(t)}}}function Na(t){var r;let e=(r=t.axis)!=null?r:"y",n=null,s=t.source;return{start(i,o){var c,h;let a=(h=t.range)!=null?h:[0,(c=o.duration)!=null?c:1],l=()=>{if(s instanceof Element){let m=e==="y"?s.scrollHeight-s.clientHeight:s.scrollWidth-s.clientWidth,p=e==="y"?s.scrollTop:s.scrollLeft;return m>0?p/m:0}let f=document.documentElement,u=e==="y"?f.scrollHeight-window.innerHeight:f.scrollWidth-window.innerWidth,d=e==="y"?window.scrollY:window.scrollX;return u>0?d/u:0};n=()=>{let f=Math.min(1,Math.max(0,l()));i(a[0]+f*(a[1]-a[0]))},s.addEventListener("scroll",n,{passive:!0}),n()},stop(){n&&s.removeEventListener("scroll",n),n=null}}}var Di=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 Fi(t,e={}){var N,X,tt,Nt,Rt,Jt,V;let{playhead:n}=t,s=t.duration,r=(N=t.markers)!=null?N:[],i=(X=t.driver)!=null?X:Pi(),o=(tt=e.loop)!=null?tt:!1,a=(Nt=e.background)!=null?Nt:"pause",l=(Rt=t.visibility)!=null?Rt:(()=>"visible"),c=new Map,h=new Map,f=(Jt=e.rate)!=null?Jt:1,u=!1,d=A(!1),m=O=>{u=O,d.set(O)},p=!1,k=new Set((V=t.targets)!=null?V:[]),b=[],g=0,y=null,v=0,S=[0,s],$=0,w=null;function M(O,P){var W,Y,et;if(O===P||c.size===0&&h.size===0)return;let F=P>O;for(let it of r){if(!(F?it.t>O&&it.t<=P:it.t>=P&&it.t<O))continue;for(let dn of(W=c.get(it.name))!=null?W:[])dn(it);let Ct=(Y=it.data)==null?void 0:Y.kind;if(typeof Ct=="string")for(let dn of(et=h.get(Ct))!=null?et:[])dn(it)}}function E(O){m(!1),y=null;let P=w;w=null,P==null||P(O)}function C(O){v=O;for(let Ct of b)Ct.step(O);if(!u)return;if(a==="pause"&&l()==="hidden"){g=n.peek(),y=null;return}y!=null||(y=O);let P=n.peek(),F=g+(O-y)*f,[W,Y]=S;if(!(f>=0?F>=Y:F<=W)){n.set(F),M(P,F);return}let et=o===!0?{mode:"restart"}:o===!1?null:o,it=et&&"count"in et&&et.count!==void 0?et.count:1/0;if(!et||$+1>=it){let Ct=f>=0?Y:W;n.set(Ct),M(P,Ct),E(!0);return}$++,Y-W,et.mode==="alternate"?(M(P,f>=0?Y:W),f=-f,g=f>=0?W:Y):(M(P,f>=0?Y:W),g=f>=0?W:Y),y=O,F=g,n.set(F)}function L(){p||(p=!0,i.start(C,{duration:s,visibility:l}))}return{playhead:n,get duration(){return s},get playing(){return u},playingSignal:d,get rate(){return f},set rate(O){g=n.peek(),y=u?v:null,f=O},play(O){var Y;w&&E(!1),S=(Y=O==null?void 0:O.range)!=null?Y:[0,s];let P=n.peek(),[F,W]=S;return g=f>=0?P>=W||P<F?F:P:P<=F||P>W?W:P,n.set(g),y=null,$=0,m(!0),L(),{finished:new Promise(et=>{w=et})}},pause(){u&&(g=n.peek(),E(!1))},seek(O){g=Math.min(Math.max(O,0),s),y=u?v:null,n.set(g)},swap(O){var F,W;s=O.duration,r=(F=O.markers)!=null?F:[],k=new Set((W=O.targets)!=null?W:[]);let P=Math.min(n.peek(),s);S=[0,s],g=P,y=u?v:null,$=0,n.set(P)},attach(O){if(O.targets){let P=[];for(let F of O.targets)k.has(F)?P.push(`'${F}' (player timeline)`):b.some(W=>{var Y;return(Y=W.targets)==null?void 0:Y.has(F)})&&P.push(`'${F}' (another machine)`);if(P.length>0)throw new Di(P)}return b.push(O),L(),()=>{let P=b.indexOf(O);P>=0&&b.splice(P,1)}},onMarker(O,P){let F=c.get(O);return F||(F=new Set,c.set(O,F)),F.add(P),()=>F.delete(P)},onCue(O,P){let F=h.get(O);return F||(F=new Set,h.set(O,F)),F.add(P),()=>F.delete(P)},dispose(){u&&E(!1),b.length=0,p&&i.stop(),p=!1}}}function zi(t,e,n,s,r){var o;let i=t!=null?t:"respect";return i==="ignore"||!e?{autoplay:r}:typeof i=="function"?{autoplay:r,swapTo:i(n)}:{autoplay:!1,seekTo:(o=n.posterTime)!=null?o:s}}function Li(){return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function Ps(t,e,n,s={}){var b;let r=t,i=e,o=st(i),a=new ln(n);r.setTextMeasurer(a);let l=r.playhead,c=Fi({playhead:l,duration:o.duration,markers:o.markers,targets:o.tracks.keys()},s),h=()=>a.render(ye(r,i,l.peek())),f=!1,u=()=>{f||(f=!0,requestAnimationFrame(()=>{f=!1,h()}))},d=l.subscribe(u),m=g=>{if(typeof FontFace=="undefined")return;let y=le(g.assets);for(let v of y.faces()){let S=new FontFace(v.family,`url(${v.url})`,{weight:String(v.weight),style:v.style});document.fonts.add(S),S.load().then(()=>h(),()=>{})}Es(r,g,async v=>{try{let S=await fetch(v);return S.ok?await S.arrayBuffer():void 0}catch(S){return}},T({mode:s.strictFonts?"strict":"dev"},s.osFonts!==void 0?{osFamilies:s.osFonts}:{}))};m(i);let p=((b=s.prefersReducedMotion)!=null?b:Li)(),k=zi(s.reducedMotion,p,i,o.duration,!!s.autoplay);if(k.swapTo){i=k.swapTo;let g=st(i);c.swap({duration:g.duration,markers:g.markers,targets:g.tracks.keys()}),m(i)}return k.seekTo!==void 0&&c.seek(k.seekTo),h(),k.autoplay&&c.play(),{player:c,backend:a,render:h,swap(g){g.scene&&(r=g.scene,r.setTextMeasurer(a)),i=g.timeline;let y=st(i);c.swap({duration:y.duration,markers:y.markers,targets:y.tracks.keys()}),m(i),h()},dispose(){d(),c.dispose(),a.dispose()}}}function Ra(t,e,n){let s=Object.keys(st(e).labels);return r=>{if(r==null)return;let i=n(r),o=Object.keys(st(i.timeline).labels),a=s.filter(l=>!o.includes(l));a.length>0&&console.warn(`[glissade] HMR: this edit removed label(s) ${a.map(l=>`'${l}'`).join(", ")} \u2014 anything seeking to them will no longer resolve`),s=o,t.swap(i)}}var Va=`
|
|
1
|
+
"use strict";var glissade=(()=>{var Et=Object.defineProperty,Hi=Object.defineProperties,Xi=Object.getOwnPropertyDescriptor,Yi=Object.getOwnPropertyDescriptors,Gi=Object.getOwnPropertyNames,Tt=Object.getOwnPropertySymbols;var Sn=Object.prototype.hasOwnProperty,_s=Object.prototype.propertyIsEnumerable;var Ws=e=>{throw TypeError(e)};var xn=(e,t,n)=>t in e?Et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E=(e,t)=>{for(var n in t||(t={}))Sn.call(t,n)&&xn(e,n,t[n]);if(Tt)for(var n of Tt(t))_s.call(t,n)&&xn(e,n,t[n]);return e},L=(e,t)=>Hi(e,Yi(t));var js=e=>typeof e=="symbol"?e:e+"",Ve=(e,t)=>{var n={};for(var s in e)Sn.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&Tt)for(var s of Tt(e))t.indexOf(s)<0&&_s.call(e,s)&&(n[s]=e[s]);return n};var Ui=(e,t)=>{for(var n in t)Et(e,n,{get:t[n],enumerable:!0})},Ki=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Gi(t))!Sn.call(e,r)&&r!==n&&Et(e,r,{get:()=>t[r],enumerable:!(s=Xi(t,r))||s.enumerable});return e};var Qi=e=>Ki(Et({},"__esModule",{value:!0}),e);var x=(e,t,n)=>xn(e,typeof t!="symbol"?t+"":t,n),Mn=(e,t,n)=>t.has(e)||Ws("Cannot "+n);var D=(e,t,n)=>(Mn(e,t,"read from private field"),n?n.call(e):t.get(e)),U=(e,t,n)=>t.has(e)?Ws("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),H=(e,t,n,s)=>(Mn(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),B=(e,t,n)=>(Mn(e,t,"access private method"),n);var nc={};Ui(nc,{ALL_FILTER_KINDS:()=>Cs,BakeError:()=>Ut,BindTypeMismatchError:()=>Pr,Canvas2DBackend:()=>yn,Circle:()=>un,CircularDependencyError:()=>kr,ClipError:()=>ue,ColdAssetError:()=>bt,ColorParseError:()=>Dn,Custom:()=>Qr,DEFAULT_EASE:()=>Js,DL_SNAPSHOT_VERSION:()=>Hr,DeterminismViolationError:()=>di,DlSnapshotError:()=>tn,DuplicateNodeIdError:()=>pi,EachError:()=>Ue,FilterValidationError:()=>Le,FollowPath:()=>wi,FontValidationError:()=>Tr,Group:()=>re,GsPlayerElement:()=>qi,Highlight:()=>ui,IDENTITY:()=>Ie,Image:()=>hn,ImageNode:()=>hn,LayoutEngineMissingError:()=>Ss,MEASURE_QUANTUM_PX:()=>nn,MESH_DOWNSCALE:()=>pa,MESH_SHEPARD_POWER:()=>ma,MESH_SIGMA:()=>$s,MorphError:()=>Ke,NODE_TAXONOMY:()=>zo,Node:()=>J,Path:()=>yt,PositionError:()=>ns,PresenceError:()=>Fs,Raster2D:()=>As,Rect:()=>ln,ReservedNodeIdError:()=>mi,ShaderEffect:()=>ca,SidecarVersionError:()=>Qn,SketchValidationError:()=>ye,TARGET_PATH:()=>Pe,TargetOverlapError:()=>Ri,Text:()=>Ge,TextCursor:()=>hi,TimelineValidationError:()=>K,TokenHighlight:()=>bi,TokenMatchError:()=>xt,TrackValidationError:()=>ve,UnboundTargetError:()=>Ar,UnknownEasingError:()=>On,UnknownValueTypeError:()=>Fn,UnresolvableTargetError:()=>Ft,ValueTypeInferenceError:()=>Wn,Video:()=>fn,WriteDuringEvaluationError:()=>Yt,applyToPoint:()=>Wr,arcLength:()=>gs,assignKeyIds:()=>Zn,audioOffsetSamples:()=>ur,auditCacheCold:()=>Zo,bake:()=>Co,bakeCheckpointed:()=>Oo,batch:()=>vo,beginReadPhase:()=>vr,bindScene:()=>yi,bindTimeline:()=>os,booleanType:()=>Bn,breakLines:()=>le,buildFontRegistry:()=>ht,buildTimeline:()=>Or,clip:()=>we,clipList:()=>Ta,clockDriver:()=>Ni,coercePathData:()=>sn,collapseReplacer:()=>Xe,collectLocalizedTextUsages:()=>aa,collectTextUsages:()=>ki,colorType:()=>zn,compileTimeline:()=>se,computed:()=>ut,createDisplayListBuilder:()=>mt,createPlayer:()=>zi,createPlayhead:()=>Qt,createScene:()=>Jo,cubicBezier:()=>$n,cubicBezierDerivative:()=>Cn,defineGsPlayer:()=>ji,deleteSidecarTrack:()=>gr,describe:()=>Ja,diffDisplayLists:()=>fs,drawOn:()=>fi,drawOnEach:()=>Uo,driftLoop:()=>Ca,each:()=>Go,easingDerivatives:()=>Pt,easings:()=>rt,emitDevWarning:()=>_,emptySidecar:()=>pr,endReadPhase:()=>xr,estimatingMeasurer:()=>ks,evaluate:()=>kt,evaluateAt:()=>as,filtersToCanvasFilter:()=>rn,flatten:()=>gt,followPath:()=>sa,fontString:()=>gn,formatColor:()=>Nt,formatDisplayDiff:()=>jr,fromTRS:()=>hs,getLayoutEngine:()=>ei,getTimelineCallbacks:()=>Cr,getValueType:()=>ot,glow:()=>Gr,hachureLines:()=>ws,hashKeys:()=>jt,highlight:()=>Vo,inReadPhase:()=>xo,inferValueType:()=>Ae,invert:()=>_r,isDurationEditable:()=>fr,isEditableNodeId:()=>ct,isExemptFamily:()=>Er,key:()=>$,lerpColor:()=>fe,listValueTypes:()=>zt,matEquals:()=>Ee,matchTokenRun:()=>Is,mediaPrefersReducedMotion:()=>Bi,mergeSidecar:()=>yr,mergeSidecarDetailed:()=>es,meshRasterSize:()=>xi,migrateSidecar:()=>Jn,morph:()=>Oa,motionPath:()=>vt,mount:()=>Rs,multiply:()=>dt,namedEasing:()=>nt,normalizeEditedKeys:()=>wr,numberType:()=>Ln,oklabToRgba:()=>qe,paintType:()=>_n,parseCmap:()=>Wt,parseColor:()=>pe,parseDisplaySnapshot:()=>Yr,parseSvgPathData:()=>Pi,pathFromSegs:()=>cn,pathFromSvg:()=>Ba,pathLength:()=>ta,pathType:()=>qn,planReducedMotion:()=>Vi,pointAtLength:()=>na,popIn:()=>Ea,presence:()=>Va,pulse:()=>$a,quantize:()=>G,random:()=>ce,rasterizeMesh:()=>vi,registerValueType:()=>ae,reprOf:()=>Vt,requireLayoutEngine:()=>ti,resolveAnchor:()=>vs,resolveEase:()=>jn,resolveEaseDerivative:()=>Hn,resolveSketch:()=>ms,resolveTweenTarget:()=>xe,revealSchedule:()=>Jr,rgbaToOklab:()=>Oe,roughen:()=>on,roundedRectSegs:()=>Ye,sampleTrack:()=>_t,scrollDriver:()=>Za,segmentGraphemes:()=>Te,segmentWords:()=>an,serializeDisplayList:()=>Xr,setDefaultMeasurer:()=>Kr,setDevWarning:()=>sr,setLayoutEngine:()=>Zr,setScheduler:()=>yo,setShaderRunner:()=>Mi,setSidecarTrack:()=>mr,signal:()=>A,sketchStrokes:()=>Ur,slideIn:()=>Ia,spring:()=>de,springEasing:()=>An,springEasingDerivative:()=>Pn,springPresets:()=>tr,springTo:()=>ir,stagger:()=>qt,stringType:()=>Vn,swapOnHmr:()=>ec,synchronousScheduler:()=>ss,targetNodeId:()=>_e,textCursor:()=>Bo,timeline:()=>$o,tokenHighlight:()=>ra,track:()=>me,transitionToClip:()=>Oi,typewriter:()=>Wo,untracked:()=>So,validateFilters:()=>ds,validateFonts:()=>is,validateHachure:()=>ys,validateSceneFonts:()=>Os,validateSketch:()=>ps,validateTrack:()=>at,vec2ArcType:()=>Rn,vec2Equals:()=>Bt,vec2Signal:()=>je,vec2Type:()=>Nn,velocityAt:()=>Xn,withDeterminismGuards:()=>Qo});var Ot=2.5949095,At=2.70158,Be=2*Math.PI/3,tt=2*Math.PI/4.5;function It(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}var rt={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>1-(1-e)*(1-e),easeInOutQuad:e=>e<.5?2*e*e:1-(-2*e+2)**2/2,easeInCubic:e=>e**3,easeOutCubic:e=>1-(1-e)**3,easeInOutCubic:e=>e<.5?4*e**3:1-(-2*e+2)**3/2,easeInQuart:e=>e**4,easeOutQuart:e=>1-(1-e)**4,easeInOutQuart:e=>e<.5?8*e**4:1-(-2*e+2)**4/2,easeInQuint:e=>e**5,easeOutQuint:e=>1-(1-e)**5,easeInOutQuint:e=>e<.5?16*e**5:1-(-2*e+2)**5/2,easeInSine:e=>1-Math.cos(e*Math.PI/2),easeOutSine:e=>Math.sin(e*Math.PI/2),easeInOutSine:e=>-(Math.cos(Math.PI*e)-1)/2,easeInExpo:e=>e===0?0:2**(10*e-10),easeOutExpo:e=>e===1?1:1-2**(-10*e),easeInOutExpo:e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2,easeInCirc:e=>1-Math.sqrt(1-e*e),easeOutCirc:e=>Math.sqrt(1-(e-1)*(e-1)),easeInOutCirc:e=>e<.5?(1-Math.sqrt(1-(2*e)**2))/2:(Math.sqrt(1-(-2*e+2)**2)+1)/2,easeInBack:e=>At*e**3-1.70158*e*e,easeOutBack:e=>1+At*(e-1)**3+1.70158*(e-1)**2,easeInOutBack:e=>e<.5?(2*e)**2*(3.5949095*2*e-Ot)/2:((2*e-2)**2*(3.5949095*(e*2-2)+Ot)+2)/2,easeInElastic:e=>e===0?0:e===1?1:-(2**(10*e-10))*Math.sin((e*10-10.75)*Be),easeOutElastic:e=>e===0?0:e===1?1:2**(-10*e)*Math.sin((e*10-.75)*Be)+1,easeInOutElastic:e=>e===0?0:e===1?1:e<.5?-(2**(20*e-10)*Math.sin((20*e-11.125)*tt))/2:2**(-20*e+10)*Math.sin((20*e-11.125)*tt)/2+1,easeInBounce:e=>1-It(1-e),easeOutBounce:It,easeInOutBounce:e=>e<.5?(1-It(1-2*e))/2:(1+It(2*e-1))/2};function $t(e){return e<1/2.75?2*7.5625*e:e<2/2.75?2*7.5625*(e-1.5/2.75):e<2.5/2.75?2*7.5625*(e-2.25/2.75):2*7.5625*(e-2.625/2.75)}var ke=Math.LN2,Pt={linear:()=>1,easeInQuad:e=>2*e,easeOutQuad:e=>2*(1-e),easeInOutQuad:e=>e<.5?4*e:4*(1-e),easeInCubic:e=>3*e**2,easeOutCubic:e=>3*(1-e)**2,easeInOutCubic:e=>e<.5?12*e**2:12*(1-e)**2,easeInQuart:e=>4*e**3,easeOutQuart:e=>4*(1-e)**3,easeInOutQuart:e=>e<.5?32*e**3:32*(1-e)**3,easeInQuint:e=>5*e**4,easeOutQuint:e=>5*(1-e)**4,easeInOutQuint:e=>e<.5?80*e**4:80*(1-e)**4,easeInSine:e=>Math.PI/2*Math.sin(e*Math.PI/2),easeOutSine:e=>Math.PI/2*Math.cos(e*Math.PI/2),easeInOutSine:e=>Math.PI/2*Math.sin(Math.PI*e),easeInExpo:e=>e===0?0:10*ke*2**(10*e-10),easeOutExpo:e=>e===1?0:10*ke*2**(-10*e),easeInOutExpo:e=>e===0||e===1?0:e<.5?10*ke*2**(20*e-10):10*ke*2**(-20*e+10),easeInCirc:e=>e/Math.sqrt(1-e*e),easeOutCirc:e=>(1-e)/Math.sqrt(1-(e-1)*(e-1)),easeInOutCirc:e=>e<.5?2*e/Math.sqrt(1-4*e*e):(2-2*e)/Math.sqrt(1-(-2*e+2)**2),easeInBack:e=>3*At*e**2-2*1.70158*e,easeOutBack:e=>3*At*(e-1)**2+2*1.70158*(e-1),easeInOutBack:e=>e<.5?12*3.5949095*e**2-4*Ot*e:3*3.5949095*(2*e-2)**2+2*Ot*(2*e-2),easeInElastic:e=>{if(e===0||e===1)return 0;let t=(e*10-10.75)*Be,n=2**(10*e-10);return-(10*ke*n*Math.sin(t)+n*10*Be*Math.cos(t))},easeOutElastic:e=>{if(e===0||e===1)return 0;let t=(e*10-.75)*Be,n=2**(-10*e);return-10*ke*n*Math.sin(t)+n*10*Be*Math.cos(t)},easeInOutElastic:e=>{if(e===0||e===1)return 0;let t=(20*e-11.125)*tt;if(e<.5){let s=2**(20*e-10);return-(20*ke*s*Math.sin(t)+s*20*tt*Math.cos(t))/2}let n=2**(-20*e+10);return(-20*ke*n*Math.sin(t)+n*20*tt*Math.cos(t))/2},easeInBounce:e=>$t(1-e),easeOutBounce:$t,easeInOutBounce:e=>e<.5?$t(1-2*e):$t(2*e-1)},Js="easeInOutCubic";function Zs(e,t,n,s){let r=3*e-3*n+1,i=3*n-6*e,o=3*e,a=3*t-3*s+1,l=3*s-6*t,c=3*t,u=p=>((r*p+i)*p+o)*p,f=p=>((a*p+l)*p+c)*p,h=p=>(3*r*p+2*i)*p+o;return{sampleY:f,sampleDX:h,sampleDY:p=>(3*a*p+2*l)*p+c,solveU:p=>{let k=p;for(let y=0;y<8;y++){let v=u(k)-p;if(Math.abs(v)<1e-7)return k;let M=h(k);if(Math.abs(M)<1e-6)break;k-=v/M}let b=0,g=1;for(k=p;g-b>1e-7;)u(k)<p?b=k:g=k,k=(b+g)/2;return k}}}function $n(e,t,n,s){let r=Zs(e,t,n,s);return i=>i<=0?0:i>=1?1:r.sampleY(r.solveU(i))}function Cn(e,t,n,s){let r=Zs(e,t,n,s);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 On=class extends Error{constructor(e){super(`unknown easing '${e}'; register it via easings or use cubicBezier/spring`),this.name="UnknownEasingError"}};function nt(e){let t=rt[e];if(!t)throw new On(e);return t}var Ji=.005;function it(e){var n;let t=(n=e.mass)!=null?n:1;if(!(e.stiffness>0)||!(e.damping>0)||!(t>0))throw new RangeError("spring stiffness, damping, and mass must all be > 0");return{w0:Math.sqrt(e.stiffness/t),zeta:e.damping/(2*Math.sqrt(e.stiffness*t))}}function Zi(e,t){if(t<=0)return 0;let{w0:n,zeta:s}=it(e);if(Math.abs(s-1)<1e-9)return n*n*t*Math.exp(-n*t);if(s<1){let a=n*Math.sqrt(1-s*s);return Math.exp(-s*n*t)*(n*n/a)*Math.sin(a*t)}let r=Math.sqrt(s*s-1),i=-n*(s-r),o=-n*(s+r);return i*o*(Math.exp(i*t)-Math.exp(o*t))/(i-o)}function st(e,t){if(t<=0)return 0;let{w0:n,zeta:s}=it(e);if(Math.abs(s-1)<1e-9)return 1-Math.exp(-n*t)*(1+n*t);if(s<1){let a=n*Math.sqrt(1-s*s);return 1-Math.exp(-s*n*t)*(Math.cos(a*t)+s*n/a*Math.sin(a*t))}let r=Math.sqrt(s*s-1),i=-n*(s-r),o=-n*(s+r);return 1+(o*Math.exp(i*t)-i*Math.exp(o*t))/(i-o)}function Lt(e,t){var a;let n=(a=t==null?void 0:t.settleTolerance)!=null?a:Ji,{w0:s,zeta:r}=it(e);if(r<1){let l=s*Math.sqrt(1-r*r),c=Math.sqrt(1+(r*s/l)**2);return Math.log(c/n)/(r*s)}let i=1/s;for(;1-st(e,i)>n;)i*=2;let o=0;for(let l=0;l<64&&i-o>1e-9;l++){let c=(o+i)/2;1-st(e,c)>n?o=c:i=c}return i}function er(e,t,n){let s=Lt(e,n);return st(e,Math.min(t,s))/st(e,s)}function eo(e,t,n){let{w0:s,zeta:r}=it(e),i,o,a;if(Math.abs(r-1)<1e-9){let c=n+s*t;i=u=>u<=0?t:Math.exp(-s*u)*(t+c*u),o=u=>u<=0?n:Math.exp(-s*u)*(n-s*c*u),a=u=>Math.exp(-s*u)*(Math.abs(t)+Math.abs(c)*u)}else if(r<1){let c=s*Math.sqrt(1-r*r),u=(n+r*s*t)/c,f=Math.hypot(t,u);i=h=>h<=0?t:Math.exp(-r*s*h)*(t*Math.cos(c*h)+u*Math.sin(c*h)),o=h=>h<=0?n:Math.exp(-r*s*h)*(n*Math.cos(c*h)-(s*s*t+r*s*n)/c*Math.sin(c*h)),a=h=>Math.exp(-r*s*h)*f}else{let c=Math.sqrt(r*r-1),u=s*(-r+c),f=s*(-r-c),h=(n-f*t)/(u-f),d=(u*t-n)/(u-f);i=m=>m<=0?t:h*Math.exp(u*m)+d*Math.exp(f*m),o=m=>m<=0?n:h*u*Math.exp(u*m)+d*f*Math.exp(f*m),a=m=>Math.abs(h)*Math.exp(u*m)+Math.abs(d)*Math.exp(f*m)}return{value:i,velocity:o,settleTime:c=>{let u=c!=null?c:Math.abs(t)*.005+1e-6;if(a(0)<=u&&Math.abs(n)<1e-12)return 0;let f=1/s,h=0;for(;a(f)>u&&h++<64;)f*=2;let d=0;for(let m=0;m<64&&f-d>1e-9;m++){let p=(d+f)/2;Math.max(a(p),a(p*1.05+1e-6))>u?d=p:f=p}return f}}}var de=Object.assign(e=>{var t;return it(e),{kind:"spring",stiffness:e.stiffness,damping:e.damping,mass:(t=e.mass)!=null?t:1}},{duration:Lt,value:er,retarget:eo}),tr={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 An(e){let t=Lt(e);return n=>er(e,n*t)}function Pn(e){let t=Lt(e),n=t/st(e,t);return s=>s>=1?0:Zi(e,s*t)*n}var nr=e=>{var t;(t=globalThis.console)==null||t.warn(`[glissade] ${e}`)};function sr(e){nr=e}function _(e){nr(e)}var to=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,no=/^rgba?\(\s*([\d.]+)\s*[, ]\s*([\d.]+)\s*[, ]\s*([\d.]+)\s*(?:[,/]\s*([\d.]+%?)\s*)?\)$/i,Dn=class extends Error{constructor(e){super(`cannot parse color '${e}' (supported: #rgb[a], #rrggbb[aa], rgb()/rgba())`),this.name="ColorParseError"}};function pe(e){let t=to.exec(e);if(t){let s=t[1];s.length<=4&&(s=[...s].map(i=>i+i).join(""));let r=parseInt(s,16);return s.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 n=no.exec(e);if(n){let s=n[4],r=s===void 0?1:s.endsWith("%")?parseFloat(s)/100:parseFloat(s);return{r:parseFloat(n[1]),g:parseFloat(n[2]),b:parseFloat(n[3]),a:r}}throw new Dn(e)}function Nt(e){let t=i=>Math.min(255,Math.max(0,Math.round(i))),n=i=>t(i).toString(16).padStart(2,"0"),s=`#${n(e.r)}${n(e.g)}${n(e.b)}`,r=Math.min(1,Math.max(0,e.a));return r>=1?s:`${s}${n(r*255)}`}function Tn(e){let t=e/255;return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function En(e){return(e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055)*255}function Oe(e){let t=Tn(e.r),n=Tn(e.g),s=Tn(e.b),r=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*s),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*s),o=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*s);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:e.a}}function qe(e){let t=(e.L+.3963377774*e.a+.2158037573*e.b)**3,n=(e.L-.1055613458*e.a-.0638541728*e.b)**3,s=(e.L-.0894841775*e.a-1.291485548*e.b)**3;return{r:En(4.0767416621*t-3.3077115913*n+.2309699292*s),g:En(-1.2684380046*t+2.6097574011*n-.3413193965*s),b:En(-.0041960863*t-.7034186147*n+1.707614701*s),a:e.alpha}}function fe(e,t,n){let s=Oe(pe(e)),r=Oe(pe(t)),i=(o,a)=>o+(a-o)*n;return Nt(qe({L:i(s.L,r.L),a:i(s.a,r.a),b:i(s.b,r.b),alpha:i(s.alpha,r.alpha)}))}var Rt=new Map;function ae(e){Rt.set(e.id,e)}var Fn=class extends Error{constructor(e){super(`unknown value type '${e}'; register it via registerValueType()`),this.name="UnknownValueTypeError"}};function ot(e){let t=Rt.get(e);if(!t)throw new Fn(e);return t}function zt(){return[...Rt.keys()]}function Vt(e){var t,n;return(n=(t=Rt.get(e))==null?void 0:t.repr)!=null?n:e}var Ln={id:"number",lerp:(e,t,n)=>e+(t-e)*n,extrapolates:!0,equals:Object.is,add:(e,t)=>e+t,sub:(e,t)=>e-t,scale:(e,t)=>e*t,defaultHandoff:"spring"},Bt=(e,t)=>e[0]===t[0]&&e[1]===t[1],Nn={id:"vec2",lerp:(e,t,n)=>[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n],extrapolates:!0,equals:Bt,add:(e,t)=>[e[0]+t[0],e[1]+t[1]],sub:(e,t)=>[e[0]-t[0],e[1]-t[1]],scale:(e,t)=>[e[0]*t,e[1]*t],defaultHandoff:"spring"},Rn={id:"vec2-arc",repr:"vec2",lerp:(e,t,n)=>{let s=Math.hypot(e[0],e[1]),r=Math.hypot(t[0],t[1]),i=Math.atan2(e[1],e[0]),o=Math.atan2(t[1],t[0])-i;for(;o>Math.PI;)o-=2*Math.PI;for(;o<-Math.PI;)o+=2*Math.PI;let a=s+(r-s)*n,l=i+o*n;return[a*Math.cos(l),a*Math.sin(l)]},extrapolates:!0,equals:Bt,defaultHandoff:"blend-from-frozen"},zn={id:"color",lerp:fe,extrapolates:!0,equals:(e,t)=>e===t,defaultHandoff:"blend-from-frozen"};function rr(e){return{id:e,lerp:(t,n,s)=>s>=1?n:t,extrapolates:!1,equals:(t,n)=>Object.is(t,n),defaultHandoff:"cut"}}var Vn=rr("string"),Bn=rr("boolean"),In=(e,t,n)=>[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n];function Hs(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let s=e[n],r=t[n];if(s.closed!==r.closed||s.v.length!==r.v.length)return!1}return!0}var Xs=!1,qn={id:"path",lerp:(e,t,n)=>Hs(e,t)?e.map((s,r)=>{let i=t[r];return{closed:s.closed,v:s.v.map((o,a)=>In(o,i.v[a],n)),in:s.in.map((o,a)=>In(o,i.in[a],n)),out:s.out.map((o,a)=>In(o,i.out[a],n))}}):(Xs||(Xs=!0,_("path lerp with mismatched topology (contour/vertex counts or closed flags differ): snapping instead of morphing \u2014 supply matched vertex counts (\xA72.2)")),n>=1?t:e),extrapolates:!1,equals:(e,t)=>{if(e===t)return!0;if(!Hs(e,t))return!1;let n=(s,r)=>s[0]===r[0]&&s[1]===r[1];return e.every((s,r)=>{let i=t[r];return s.v.every((o,a)=>n(o,i.v[a]))&&s.in.every((o,a)=>n(o,i.in[a]))&&s.out.every((o,a)=>n(o,i.out[a]))})},defaultHandoff:"blend-from-frozen"},Dt=(e,t,n)=>e+(t-e)*n,Ct=(e,t,n)=>[Dt(e[0],t[0],n),Dt(e[1],t[1],n)];function Ys(e){try{return Nt(L(E({},pe(e)),{a:0}))}catch(t){return e}}function so(e,t,n){try{return fe(e,t,n)}catch(s){return n>=1?t:e}}function Gs(e,t){let n=t.stops.map(r=>({offset:r.offset,color:e})),s=t.interpolation?{interpolation:t.interpolation}:{};return t.kind==="radial"?E(E(E({kind:"radial",stops:n},t.center?{center:t.center}:{}),t.radius!==void 0?{radius:t.radius}:{}),s):E(E(E({kind:"linear",stops:n},t.from?{from:t.from}:{}),t.to?{to:t.to}:{}),s)}var Us=!1;function et(e,t,n,s="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 Us||(Us=!0,_(s)),e>=1?n:t}var ro=(e,t)=>e.length===t.length&&e.every((n,s)=>n.offset===t[s].offset&&n.color===t[s].color),_n={id:"paint",lerp:(e,t,n)=>{var a,l,c,u;if(e.kind==="color"&&t.kind==="color")return{kind:"color",color:fe(e.color,t.color,n)};if(e.kind==="mesh"&&t.kind==="mesh"){if(e.points.length!==t.points.length)return et(n,e,t);if(e.interpolation!==t.interpolation)return et(n,e,t,`paint lerp across mismatched mesh interpolation modes ('${(a=e.interpolation)!=null?a:"smooth"}' \u2192 '${(l=t.interpolation)!=null?l:"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 f=e.points.map((d,m)=>{let p=t.points[m];return{pos:Ct(d.pos,p.pos,n),color:fe(d.color,p.color,n)}}),h=e.bg!==void 0||t.bg!==void 0?{bg:so((c=e.bg)!=null?c:Ys(t.bg),(u=t.bg)!=null?u:Ys(e.bg),n)}:{};return E(E({kind:"mesh",points:f},e.interpolation?{interpolation:e.interpolation}:{}),h)}if(e.kind==="mesh"||t.kind==="mesh")return et(n,e,t);let s=e,r=t;if(s.kind==="color"&&r.kind!=="color"?s=Gs(s.color,r):r.kind==="color"&&s.kind!=="color"&&(r=Gs(r.color,s)),s.kind==="color"||r.kind==="color"||s.kind!==r.kind||s.stops.length!==r.stops.length)return et(n,e,t);let i=s.stops.map((f,h)=>({offset:Dt(f.offset,r.stops[h].offset,n),color:fe(f.color,r.stops[h].color,n)})),o=s.interpolation?{interpolation:s.interpolation}:{};return s.kind==="radial"&&r.kind==="radial"?E(E(E({kind:"radial",stops:i},s.center&&r.center?{center:Ct(s.center,r.center,n)}:s.center?{center:s.center}:{}),s.radius!==void 0&&r.radius!==void 0?{radius:Dt(s.radius,r.radius,n)}:s.radius!==void 0?{radius:s.radius}:{}),o):s.kind==="linear"&&r.kind==="linear"?E(E(E({kind:"linear",stops:i},s.from&&r.from?{from:Ct(s.from,r.from,n)}:s.from?{from:s.from}:{}),s.to&&r.to?{to:Ct(s.to,r.to,n)}:s.to?{to:s.to}:{}),o):et(n,e,t)},extrapolates:!1,equals:(e,t)=>e===t?!0:e.kind!==t.kind?!1:e.kind==="color"?t.kind==="color"&&e.color===t.color:e.kind==="mesh"?t.kind!=="mesh"||e.interpolation!==t.interpolation||e.bg!==t.bg||e.points.length!==t.points.length?!1:e.points.every((n,s)=>{let r=t.points[s];return n.color===r.color&&n.pos[0]===r.pos[0]&&n.pos[1]===r.pos[1]}):t.kind==="color"||t.kind==="mesh"||!ro(e.stops,t.stops)||e.interpolation!==t.interpolation?!1:e.kind==="radial"&&t.kind==="radial"?JSON.stringify(e.center)===JSON.stringify(t.center)&&e.radius===t.radius:e.kind==="linear"&&t.kind==="linear"?JSON.stringify(e.from)===JSON.stringify(t.from)&&JSON.stringify(e.to)===JSON.stringify(t.to):!1,defaultHandoff:"blend-from-frozen"},Wn=class extends Error{constructor(e){super(`cannot infer a value type for ${JSON.stringify(e)}; register a custom type`),this.name="ValueTypeInferenceError"}},io=e=>typeof e=="object"&&e!==null&&typeof e.closed=="boolean"&&Array.isArray(e.v)&&Array.isArray(e.in)&&Array.isArray(e.out),oo=e=>typeof e=="object"&&e!==null&&(e.kind==="color"||e.kind==="linear"||e.kind==="radial"||e.kind==="mesh");function Ae(e){if(typeof e=="number")return"number";if(typeof e=="boolean")return"boolean";if(oo(e))return"paint";if(Array.isArray(e)&&e.length===2&&e.every(t=>typeof t=="number"))return"vec2";if(Array.isArray(e)&&e.length>0&&e.every(io))return"path";if(typeof e=="string")try{return pe(e),"color"}catch(t){return"string"}throw new Wn(e)}ae(Ln);ae(Nn);ae(Rn);ae(zn);ae(Vn);ae(Bn);ae(qn);ae(_n);var ve=class extends Error{constructor(e,t){super(`track '${e}': ${t}`),this.name="TrackValidationError"}};function at(e){let t=ot(e.type);if(e.keys.length===0)throw new ve(e.target,"must have at least one key");if(t.defaultHandoff==="cut")for(let n of e.keys)n.interp!=="hold"&&(n.interp="hold");for(let n=1;n<e.keys.length;n++){let s=e.keys[n-1],r=e.keys[n];if(r.t<=s.t)throw new ve(e.target,`keys must be strictly increasing in t (key[${n}] at t=${r.t} after t=${s.t})`)}if(!/^[^/]+\/.+$/.test(e.target))throw new ve(e.target,"target must be '<nodeId>/<prop.path>' (e.g. 'circle/opacity')")}function $(e,t,n){if(n===void 0)return{t:e,value:t};if(typeof n=="string"||"kind"in n)return{t:e,value:t,ease:n};let s=n,r={t:e,value:t};return s.ease!==void 0&&(r.ease=s.ease),s.interp!==void 0&&(r.interp=s.interp),s.id!==void 0&&(r.id=s.id),s.derived!==void 0&&(r.derived=s.derived),r}function ir(e,t,n,s){let r=de.duration(s);if(e-r<0)throw new ve("springTo",`this spring needs ${r.toFixed(3)}s to settle \u2014 endT must be \u2265 its duration (got ${e})`);return[$(e-r,t),$(e,n,de(s))]}function qt(e,t){let n=typeof t=="function"?t:s=>s*t;return e.map((s,r)=>{let i=n(r);return L(E({},s),{keys:s.keys.map(o=>L(E({},o),{t:o.t+i}))})})}function me(e,t,n,s){let r={target:e,type:t,keys:n};return(s==null?void 0:s.editable)!==void 0&&(r.editable=s.editable),at(r),r}function jn(e){return e===void 0?nt("linear"):typeof e=="string"?nt(e):e.kind==="cubicBezier"?$n(...e.pts):An(e)}var Ks=new Set;function Hn(e){if(e===void 0)return Pt.linear;if(typeof e=="string"){let t=Pt[e];if(t)return t;let n=nt(e);Ks.has(e)||(Ks.add(e),_(`easing '${e}' has no registered derivative; velocity uses a numeric fallback \u2014 register one in easingDerivatives for exact interruption handoff`));let s=1/1024;return r=>(n(Math.min(1,r+s))-n(Math.max(0,r-s)))/(Math.min(1,r+s)-Math.max(0,r-s))}return e.kind==="cubicBezier"?Cn(...e.pts):Pn(e)}var Qs=new WeakMap;function or(e){let t=Qs.get(e);return t||(t={cursor:1,easeCache:new Array(e.keys.length)},Qs.set(e,t)),t}function ar(e,t,n){let s=t.easeCache[n];return s||(s=jn(e.keys[n].ease),t.easeCache[n]=s),s}function cr(e,t,n){let s=e.length;for(let o=Math.max(1,n-1);o<=Math.min(s-1,n+1);o++)if(e[o-1].t<=t&&t<e[o].t)return o;if(t<e[0].t)return 0;if(t>=e[s-1].t)return s;let r=1,i=s-1;for(;r<i;){let o=r+i>>1;e[o].t<=t?r=o+1:i=o}return r}function Xn(e,t){let n=ot(e.type);if(!n.sub||!n.scale)return null;let s=e.keys,r=s.length,i=or(e),o=cr(s,t,i.cursor),a=n.scale(n.sub(s[0].value,s[0].value),0);if(o===0||o>=r)return a;let l=s[o];if(l.interp==="hold")return a;let c=s[o-1],u=l.t-c.t,f=(t-c.t)/u;if(!n.extrapolates){let d=ar(e,i,o)(f);if(d<0||d>1)return a}let h=Hn(l.ease)(f);return n.scale(n.sub(l.value,c.value),h/u)}function _t(e,t){let n=e.keys,s=n.length,r=or(e),i=cr(n,t,r.cursor);if(i===0)return n[0].value;if(i>=s)return n[s-1].value;r.cursor=i;let o=n[i],a=n[i-1];if(o.interp==="hold")return a.value;let l=ot(e.type),c=(t-a.t)/(o.t-a.t),u=ar(e,r,i)(c);return!l.extrapolates&&(u<0||u>1)&&(r.warnedClamp||(r.warnedClamp=!0,_(`track '${e.target}' (type '${e.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`)),u=Math.min(1,Math.max(0,u))),l.lerp(a.value,o.value,u)}var Pe=Symbol.for("glissade.targetPath"),Ft=class extends Error{constructor(e){super(e!=null?e:'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 _e(e){let t=e.indexOf("/");return t<0?e:e.slice(0,t)}function ct(e){return typeof e=="string"&&e.length>0&&e!=="__root"&&!e.startsWith("~")}function xe(e){let t=typeof e=="string"?e:e[Pe];if(typeof t!="string")throw new Ft;if(_e(t).startsWith("~"))throw new Ft(`'${t}': structural ids (~Type.ordinal) are inspection-only and cannot be track targets (\xA76.5) \u2014 give the node an explicit id`);return t}function ne(e,t){return t+2<=e.byteLength?e.getUint16(t):0}function ge(e,t){return t+4<=e.byteLength?e.getUint32(t):0}function ao(e,t){return e===3&&t===10||e===0&&t>=4?5:e===3&&t===1||e===0?3:0}function co(e,t,n){let s=ne(e,t+6),r=s>>1,i=t+14,o=i+s+2,a=o+s,l=a+s;for(let c=0;c<r;c++){let u=ne(e,i+c*2),f=ne(e,o+c*2);if(f>u)continue;let h=ne(e,a+c*2),d=ne(e,l+c*2);for(let m=f;m<=u;m++){if(m===65535)continue;let p;if(d===0)p=m+h&65535;else{let k=ne(e,l+c*2+d+(m-f)*2);p=k===0?0:k+h&65535}p!==0&&n.add(m)}}}function lo(e,t,n){let s=ge(e,t+12),r=Math.max(0,Math.floor((e.byteLength-(t+16))/12)),i=Math.min(s,r),o=t+16;for(let a=0;a<i;a++,o+=12){let l=ge(e,o),c=ge(e,o+4),u=ge(e,o+8);if(!(l>c)&&!(c-l>2097152))for(let f=l;f<=c;f++)u+(f-l)!==0&&n.add(f)}}function Wt(e){let t=new Set;try{let n=ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e);if(n.byteLength<12)return t;let s=0;ge(n,0)===1953784678&&(s=ge(n,12));let r=ne(n,s+4),i=0;for(let u=0;u<r;u++){let f=s+12+u*16;if(ge(n,f)===1668112752){i=ge(n,f+8);break}}if(i===0)return t;let o=ne(n,i+2),a=0,l=-1;for(let u=0;u<o;u++){let f=i+4+u*8,h=ne(n,f),d=ne(n,f+2),m=i+ge(n,f+4),p=ao(h,d);p>l&&m+2<=n.byteLength&&(l=p,a=m)}if(l<0)return t;let c=ne(n,a);c===4?co(n,a,t):c===12&&lo(n,a,t)}catch(n){return t}return t}function Yn(e){var n;let t={version:1,tracks:(n=e.tracks)!=null?n:[]};return e.duration!==void 0&&(t.duration=e.duration),e.editableDuration!==void 0&&(t.editableDuration=e.editableDuration),e.fps!==void 0&&(t.fps=e.fps),e.posterTime!==void 0&&(t.posterTime=e.posterTime),e.labels!==void 0&&(t.labels=e.labels),e.markers!==void 0&&(t.markers=e.markers),e.children!==void 0&&(t.children=e.children),e.audio!==void 0&&(t.audio=e.audio),e.assets!==void 0&&(t.assets=e.assets),t}var K=class extends Error{constructor(e){super(e),this.name="TimelineValidationError"}};function uo(e){for(let t=1;t<e.keys.length;t++){let n=e.keys[t];if(n.ease&&typeof n.ease=="object"&&n.ease.kind==="spring"){let s=e.keys[t-1].t+de.duration(n.ease);if(Math.abs(n.t-s)>1e-6)throw new K(`track '${e.target}': spring-eased key at t=${n.t} must sit at prev.t + spring.duration (${s.toFixed(6)}); the builder computes this automatically`)}}}function ur(e,t=48e3){return Math.round(e*t)}function ho(e,t,n){return e.map(s=>L(E({},s),{t:t+s.t/n}))}function Gn(e){return`c${e}/`}var fo=/(^|\/)call:\d+$/;function Un(e,t){return t!==""&&fo.test(e)?t+e:e}function hr(e,t,n,s,r,i){var o,a;for(let l of e.tracks)at(l),uo(l),r.push({track:L(E({},l),{keys:ho(l.keys,t,n)}),unit:s});for(let l of(o=e.children)!=null?o:[]){let c=l.mode==="sync"&&(a=l.timeScale)!=null?a:1;if(l.mode==="add"&&l.timeScale!==void 0)throw new K("timeScale is only valid on mode:'sync' children (\xA72.3)");if(c<=0)throw new K("sync timeScale must be > 0");let u=l.mode==="sync"?++i.n:s;hr(l.timeline,t+l.at/n,n*c,u,r,i)}}function po(e){let t=new Map;for(let{track:s,unit:r}of e){let i=t.get(s.target);if(!i){t.set(s.target,{track:L(E({},s),{keys:[...s.keys]}),unit:r});continue}if(i.unit!==r)throw new K(`target '${s.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!==s.type)throw new K(`target '${s.target}' has conflicting value types '${i.track.type}' and '${s.type}'`);let o=s.keys[0].t,a=s.keys[s.keys.length-1].t,l=i.track.keys[0].t,c=i.track.keys[i.track.keys.length-1].t,u=i.track.keys.filter(f=>f.t<o||f.t>a);l<=a&&o<=c&&_(`overlapping tracks for '${s.target}' in [${o}, ${a}]: later insertion wins (${i.track.keys.length-u.length} earlier key(s) dropped)`),i.track.keys=[...u,...s.keys].sort((f,h)=>f.t-h.t)}let n=new Map;for(let[s,{track:r}]of t)n.set(s,r);return n}function fr(e){return e.editableDuration===!0}function mo(e){var n;let t=e.mode==="sync"&&(n=e.timeScale)!=null?n:1;return e.at+dr(e.timeline)/t}function dr(e){var n,s;if(e.duration!==void 0)return e.duration;let t=0;for(let r of e.tracks){let i=r.keys[r.keys.length-1];i&&(t=Math.max(t,i.t))}for(let r of(n=e.markers)!=null?n:[])t=Math.max(t,r.t);for(let r of(s=e.children)!=null?s:[])t=Math.max(t,mo(r));return t}function se(e){var a,l;if(e.version!==1)throw new K(`unsupported timeline document version ${String(e.version)}`);let t=[];hr(e,0,1,0,t,{n:0});let n=po(t),s=E({},e.labels),r=[...(a=e.markers)!=null?a:[]],i=[...(l=e.audio)!=null?l:[]],o=(c,u,f,h)=>{(c!=null?c:[]).forEach((d,m)=>{var g,y,v,M,I;let p=u+d.at/f,k=f*(d.mode==="sync"&&(g=d.timeScale)!=null?g:1),b=h+Gn(m);for(let[w,S]of Object.entries((y=d.timeline.labels)!=null?y:{}))w in s||(s[w]=p+S/k);for(let w of(v=d.timeline.markers)!=null?v:[])r.push(L(E({},w),{name:Un(w.name,b),t:p+w.t/k}));for(let w of(M=d.timeline.audio)!=null?M:[])i.push(E(L(E({},w),{at:p+w.at/k}),k!==1?{playbackRate:((I=w.playbackRate)!=null?I:1)*k}:{}));o(d.timeline.children,p,k,b)})};return o(e.children,0,1,""),r.sort((c,u)=>c.t-u.t),i.sort((c,u)=>c.at-u.at),{duration:dr(e),labels:s,markers:r,tracks:n,audio:i}}var Kn="main",Qn=class extends Error{constructor(e){super(`unsupported sidecar version ${String(e)}; this build reads sidecarVersion 1 or 2`),this.name="SidecarVersionError"}};function pr(){return{sidecarVersion:2,timelines:{[Kn]:{tracks:{}}}}}function Jn(e){if(!e)return null;if(e.sidecarVersion===2)return e;if(e.sidecarVersion===1){let t={};for(let s of e.tracks)t[s.target]={type:s.type,baseHash:null,keys:s.keys};let n={tracks:t};return e.labels&&(n.labels=e.labels),{sidecarVersion:2,timelines:{[Kn]:n}}}throw new Qn(e.sidecarVersion)}function jt(e){let t=JSON.stringify(e.map(s=>{var r,i;return[s.t,s.value,(r=s.ease)!=null?r:null,(i=s.interp)!=null?i:null]})),n=2166136261;for(let s=0;s<t.length;s++)n^=t.charCodeAt(s),n=Math.imul(n,16777619);return(n>>>0).toString(16)}function Zn(e){let t=-1;for(let n of e){let s=n.id?/^k(\d+)$/.exec(n.id):null;s&&(t=Math.max(t,Number(s[1])))}return e.map(n=>n.id?E({},n):L(E({},n),{id:`k${++t}`}))}function mr(e,t,n,s,r,i){var l;if(!ct(_e(n)))throw new ve(n,"structural/un-id'd nodes cannot host editor tracks (\xA76.5) \u2014 only nodes with an explicit id");let o=(l=e.timelines[t])!=null?l:{tracks:{}},a={type:s,baseHash:i?jt(i):null,keys:Zn(r)};return L(E({},e),{timelines:L(E({},e.timelines),{[t]:L(E({},o),{tracks:L(E({},o.tracks),{[n]:a})})})})}function gr(e,t,n){let s=e.timelines[t];if(!s||!(n in s.tracks))return e;let o=s.tracks,{[n]:r}=o,i=Ve(o,[js(n)]);return L(E({},e),{timelines:L(E({},e.timelines),{[t]:L(E({},s),{tracks:i})})})}function lr(e){return e.some(t=>t.derived)?e.map((t,n)=>t.derived&&n>0?L(E({},t),{value:e[n-1].value}):t):e}function es(e,t){var c,u,f;let n=Jn(t);if(!n)return{timeline:e,drift:[],orphans:{}};let s=(c=n.timelines[Kn])!=null?c:{tracks:{}},r=new Map(Object.entries(s.tracks)),i=[],o=E({},(u=s.orphans)!=null?u:{}),a=e.tracks.map(h=>{let d=r.get(h.target);return d?(r.delete(h.target),d.type!==h.type?(o[h.target]={type:d.type,keys:d.keys,reason:"type-changed"},h):(d.baseHash!==null&&d.baseHash!==jt(h.keys)&&i.push(h.target),L(E({},h),{keys:lr(d.keys.map(m=>E({},m))),editable:!0}))):h});for(let[h,d]of r)d.baseHash!==null?o[h]={type:d.type,keys:d.keys,reason:"prop-missing"}:a.push({target:h,type:d.type,keys:lr(d.keys.map(m=>E({},m))),editable:!0});let l=L(E({},e),{tracks:a});if(s.labels&&Object.keys(s.labels).length>0){let h=(f=e.labels)!=null?f:{},d=Object.keys(s.labels).filter(m=>m in h);d.length&&_(`sidecar label(s) ${d.join(", ")} collide with code labels; code wins (\xA76.2)`),l.labels=E(E({},s.labels),h)}return i.length&&_(`sidecar: code baseline changed beneath edits on ${i.join(", ")} (\xA76.2)`),{timeline:l,drift:i,orphans:o}}function yr(e,t){return es(e,t).timeline}function wr(e){let t=e.map(n=>E({},n)).sort((n,s)=>n.t-s.t);for(let n=0;n<2;n++){for(let s=1;s<t.length;s++){let r=t[s].ease;r&&typeof r=="object"&&r.kind==="spring"&&(t[s].t=t[s-1].t+de.duration(r))}t.sort((s,r)=>s.t-r.t)}for(let n=1;n<t.length;n++)t[n].t<=t[n-1].t&&(t[n].t=t[n-1].t+.001);return t}var ss=e=>e(),ts=ss,De=new Set,Gt=0,We=!1,lt=!1,go=1e3;function yo(e){let t=ts;return ts=e!=null?e:ss,lt&&!We&&(lt=!1,De.size>0&&rs()),t}function wo(e){De.add(e),rs()}function rs(){Gt>0||We||lt||(lt=!0,ts(bo))}function bo(){lt=!1,!We&&ko()}function ko(){if(We)return;We=!0;let e;try{let t=0;for(;De.size>0;){if(++t>go)throw De.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 n=[...De];De.clear();for(let s of n)try{s()}catch(r){e!=null||(e={err:r})}}}finally{We=!1}if(e)throw e.err}function Ht(){Gt++}function Xt(){Gt--,Gt===0&&De.size>0&&rs()}function vo(e){Ht();try{return e()}finally{Xt()}}var Se=null,Fe=0,Yt=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"}},kr=class extends Error{constructor(){super("circular signal dependency detected"),this.name="CircularDependencyError"}};function vr(){Fe++}function xr(){if(Fe===0)throw new Error("endReadPhase() without matching beginReadPhase()");Fe--}function xo(){return Fe>0}var Sr=class{constructor(e){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 t,n;this.fn=(t=e.fn)!=null?t:null,this.value=e.value,this.equals=(n=e.equals)!=null?n:Object.is,this.state=this.fn?2:0}get(){return Se&&Se.addDep(this),this.updateIfNecessary(),this.value}peek(){return this.updateIfNecessary(),this.value}set(e){if(Fe>0)throw new Yt;Ht();try{this.fn&&this.detachFn(),this.writeValue(e)}finally{Xt()}}forceSet(e){Ht();try{this.fn&&this.detachFn(),this.writeValue(e)}finally{Xt()}}bindSource(e){if(Fe>0)throw new Yt;Ht();try{this.fn=e,this.state=2,this.invalidateDependents(2)}finally{Xt()}}unbindSource(){if(Fe>0)throw new Yt;this.fn&&(this.updateIfNecessary(),this.detachFn())}get isBound(){return this.fn!==null}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}addDep(e){this.deps[this.deps.length-1]!==e&&(this.deps.push(e),this.depVersions.push(-1),e.dependents.add(this))}detachFn(){this.fn=null,this.clearDeps(),this.state=0}writeValue(e){(this.version>0||this.value!==void 0)&&this.equals(this.value,e)||(this.value=e,this.version++,this.invalidateDependents(2))}invalidateDependents(e){for(let t of[...this.dependents])t.markStale(e);if(this.subscribers.size>0)for(let t of[...this.subscribers])wo(t)}markStale(e){if(this.state>=e)return;let t=this.state===0;this.state=e,t&&this.invalidateDependents(1)}updateIfNecessary(){if(!(this.fn===null||this.state===0)){if(this.computing)throw new kr;if(this.state===1){this.state=0;for(let e=0;e<this.deps.length;e++){let t=this.deps[e];if(t.updateIfNecessary(),t.version!==this.depVersions[e]){this.state=2;break}}}this.state===2&&this.recompute(),this.state=0}}recompute(){this.clearDeps();let e=Se;Se=this,this.computing=!0;let t;try{t=this.fn()}finally{this.computing=!1,Se=e}for(let n=0;n<this.deps.length;n++)this.depVersions[n]=this.deps[n].version;(!(this.version>0||this.value!==void 0)||!this.equals(this.value,t))&&(this.value=t,this.version++)}clearDeps(){for(let e of this.deps)e.dependents.delete(this);this.deps=[],this.depVersions=[]}};function Mr(e,t){let n=(()=>e.get());return n.peek=()=>e.peek(),n.subscribe=s=>e.subscribe(s),t(n),n}function A(e,t){let n=new Sr({value:e,equals:t==null?void 0:t.equals});return Mr(n,s=>{s.set=r=>n.set(r),s.forceSet=r=>n.forceSet(r),s.bindSource=r=>n.bindSource(r),s.unbindSource=()=>n.unbindSource(),Object.defineProperty(s,"isBound",{get:()=>n.isBound})})}function ut(e,t){return Mr(new Sr({fn:e,equals:t==null?void 0:t.equals}),()=>{})}function So(e){let t=Se;Se=null;try{return e()}finally{Se=t}}function je(e){let[t,n]=Array.isArray(e)?e:[e.x,e.y],s=A(t),r=A(n);s.expects="number",r.expects="number";let i=A(null,{equals:(u,f)=>u===null||f===null?u===f:u[0]===f[0]&&u[1]===f[1]}),o=A(t),a=A(n);s.bindSource(()=>{let u=i();return u===null?o():u[0]}),r.bindSource(()=>{let u=i();return u===null?a():u[1]});let l=ut(()=>[s(),r()],{equals:(u,f)=>u[0]===f[0]&&u[1]===f[1]}),c=(()=>l());return c.peek=()=>l.peek(),c.subscribe=u=>l.subscribe(u),c.set=u=>{i.set(null),o.set(u[0]),a.set(u[1])},c.bindSource=u=>i.bindSource(()=>u()),c.unbindSource=()=>{i.unbindSource(),i.set(null)},c.expects="vec2",Object.defineProperty(c,"x",{value:s,enumerable:!0}),Object.defineProperty(c,"y",{value:r,enumerable:!0}),c}function Mo(e,t){return t.faces&&t.faces.length>0?t.faces.map(n=>{var s,r;return{family:e,url:n.url,weight:(s=n.weight)!=null?s:400,style:(r=n.style)!=null?r:"normal"}}):[{family:e,url:t.url,weight:400,style:"normal"}]}function To(e,t){let n,s=Number.POSITIVE_INFINITY;for(let r of e){let i=Math.abs(r.weight-t);(i<s||i===s&&n!==void 0&&r.weight<n.weight)&&(n=r,s=i)}return n}function ht(e){let t=new Map;for(let[n,s]of Object.entries(e!=null?e:{}))s.kind==="font"&&t.set(n,{faces:Mo(n,s),fallback:s.fallback?[...s.fallback]:[]});return{has(n){return t.has(n)},faces(){let n=[];for(let s of t.values())n.push(...s.faces);return n},resolveFace(n,s=400,r="normal"){let i=t.get(n);if(!i)return;let o=i.faces.filter(a=>a.style===r);return To(o.length>0?o:i.faces,s)},fallbackChain(n){let s=t.get(n);return s?[n,...s.fallback]:[n]}}}var Tr=class extends Error{constructor(t){super(Ir(t));x(this,"report");this.name="FontValidationError",this.report=t}},Eo=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","math","emoji","fangsong"]);function Er(e,t){var s;let n=e.trim().toLowerCase();return Eo.has(n)?!0:(s=t==null?void 0:t.has(n))!=null?s:!1}function Io(e){let t=[];for(let n of e){let s=n.codePointAt(0);s!==void 0&&t.push(s)}return t}function Ir(e){let t=[];e.unregistered.length>0&&t.push(`unregistered font ${e.unregistered.length===1?"family":"families"}: ${e.unregistered.join(", ")}`);for(let n of e.missingGlyphs){let s=n.codePoints.map(r=>"U+"+r.toString(16).toUpperCase().padStart(4,"0")).join(", ");t.push(`family '${n.family}' is missing glyphs for ${s}`)}return"font validation failed (\xA73.6): "+t.join("; ")+" \u2014 register the family with its faces/fallback, or supply covering glyphs"}function is(e,t,n,s,r={}){let i=new Set,o=new Map;for(let l of e){let c=l.family,u=Er(c,r.osFamilies);if(!t.has(c)){u||i.add(c);continue}let f=t.fallbackChain(c);for(let h of Io(l.text))if(!f.some(d=>{var m,p;return(p=(m=n.get(d))==null?void 0:m.has(h))!=null?p:!1})){let d=o.get(c);d||(d=new Set,o.set(c,d)),d.add(h)}}let a={unregistered:[...i].sort(),missingGlyphs:[...o.entries()].map(([l,c])=>({family:l,codePoints:[...c].sort((u,f)=>u-f)})).sort((l,c)=>l.family<c.family?-1:l.family>c.family?1:0)};if(!(a.unregistered.length===0&&a.missingGlyphs.length===0)){if(s==="strict")throw new Tr(a);_(Ir(a))}return a}var ns=class extends Error{constructor(e,t){super(`invalid position '${e}': ${t}`),this.name="PositionError"}};function br(e){return typeof e!="string"&&typeof e.peek=="function"?e.peek():void 0}var $r=new WeakMap;function Cr(e){var t;return(t=$r.get(e))!=null?t:new Map}function Or(e,t={}){var k;let n=[],s=E({},t.labels),r=[],i=[],o=new Map,a=!1,l=0,c=0,u=0;function f(b){if(b===void 0)return c;if(typeof b=="number")return b;if(b==="<")return l;if(b===">")return c;let g=/^([+-])=([\d.]+)$/.exec(b);if(g)return c+(g[1]==="+"?1:-1)*parseFloat(g[2]);let y=/^([^+\-=]+?)(?:([+-])=([\d.]+))?$/.exec(b);if(y){let v=y[1];if(!(v in s))throw new ns(b,`unknown label '${v}' (labels must be declared before use)`);let M=y[2]?(y[2]==="+"?1:-1)*parseFloat(y[3]):0;return s[v]+M}throw new ns(b,"expected a number, '<', '>', '+=x', '-=x', or 'label[+=x]'")}let h={to(b,g,y={}){var T,C;let v=(T=y.ease)!=null?T:"easeInOutCubic",M=typeof v=="object"&&v.kind==="spring",I=M?de.duration(v):(C=y.duration)!=null?C:1;if(M&&y.duration!==void 0)throw new K("a spring ease determines its duration (spring.duration(cfg)); do not pass duration with a spring");let w=f(y.at),S={kind:"tween",target:xe(b),value:g,duration:I,ease:v,at:y.at,baseValue:br(b),editable:!1,start:w};return y.from!==void 0&&(S.explicitFrom=y.from),n.push(S),l=w,c=w+I,h},fromTo(b,g,y,v={}){return h.to(b,y,v),n[n.length-1].explicitFrom=g,h},stagger(b,g,y){var Ze;let v=b.length,M=f(y.at),I=(v-1)/2,{anchor:w="start",each:S}=y,T=V=>{if(!Number.isFinite(V))throw new K(`stagger: non-finite each/anchor (${String(V)})`);return V};typeof w=="number"&&T(w),typeof S=="number"&&T(S);let C=V=>w==="start"?V:w==="end"?v-1-V:Math.round(w==="center"?Math.abs(V-I):w==="edges"?I-Math.abs(V-I):Math.abs(V-w)),N=V=>T(typeof S=="function"?S(V,v):V*S),R=g.ease,X=typeof R=="object"&&R!==null&&R.kind==="spring"?de.duration(R):(Ze=g.duration)!=null?Ze:1,ee=V=>E(E({at:M+V},g.duration!==void 0?{duration:g.duration}:{}),g.ease!==void 0?{ease:g.ease}:{}),Re=0,ze=0;for(let V=0;V<v;V++){let O=N(C(V));(V===0||O<Re)&&(Re=O),(V===0||O>ze)&&(ze=O);let P=M+O;if(P<0)throw new K(`stagger: target would land at t=${P} (< 0); shift opts.at`);let F=b[V];g.from!==void 0?h.fromTo(F,g.from,g.to,ee(O)):h.to(F,g.to,ee(O))}return v>0&&(l=M+Re,c=M+ze+X),h},set(b,g,y={}){let v=f(y.at);return n.push({kind:"set",target:xe(b),value:g,duration:0,ease:"linear",at:y.at,baseValue:br(b),editable:!1,start:v}),l=v,c=v,h},label(b,g){return s[b]=g===void 0?c:f(g),h},add(b,g,y={}){var C,N;let v=g===void 0?c:f(g),M=(C=y.mode)!=null?C:"add",I={timeline:b,at:v,mode:M,_pos:g};y.timeScale!==void 0&&(I.timeScale=y.timeScale);let w=r.length;r.push(I);let S=Gn(w);for(let[R,X]of Cr(b))o.set(Un(R,S),X);let T=M==="sync"&&(N=y.timeScale)!=null?N:1;return l=v,c=v+se(b).duration/T,h},sequence(b,g={}){var M;let y=(M=g.gap)!=null?M:0,v=y<0?`-=${-y}`:`+=${y}`;for(let I=0;I<b.length;I++)h.add(b[I],I===0?void 0:v);return h},at(b,g){return h.add(g,b)},call(b,g){let y=g===void 0?c:f(g),v=`call:${u++}`;return i.push({t:y,name:v}),o.set(v,b),h},cue(b,g,y){let v=y!=null&&typeof y=="object"&&!Array.isArray(y)?E({kind:"cue"},y):{kind:"cue"};return i.push({t:f(b),name:g,data:v}),h},adBreak(b,g={}){var v;let y=E({kind:"ad-break"},g.duration!==void 0?{duration:g.duration}:{});return i.push({t:f(b),name:(v=g.id)!=null?v:"ad-break",data:y}),h},editable(){let b=n[n.length-1];if(!b)throw new K(".editable() requires a preceding insertion");let g=_e(b.target);if(!ct(g))throw new K(`.editable() needs a node with an explicit id; '${g}' is not an editable host (\xA76.4)`);return b.editable=!0,h},editableDuration(){return a=!0,h}};e(h);let d=new Map;for(let b of n){let g=d.get(b.target);g||(g=[],d.set(b.target,g)),g.push(b)}let m=[];for(let[b,g]of d){g.sort((T,C)=>T.start-C.start);let y=[],v=g.some(T=>T.editable),M=(k=g.find(T=>T.baseValue!==void 0))==null?void 0:k.baseValue,I=g[0];I.kind==="tween"&&I.explicitFrom===void 0&&M===void 0&&_(`'${b}': 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 T of g){if(T.kind==="set"){y.push({t:T.start,value:T.value,interp:"hold"}),M=T.value;continue}let C=T.explicitFrom!==void 0?T.explicitFrom:M,N=y[y.length-1];if(C!==void 0&&(!N||N.t<T.start)){let R={t:T.start,value:C};T.explicitFrom===void 0&&(R.derived=!0),(!N||T.start>N.t)&&y.push(R)}y.push({t:T.start+T.duration,value:T.value,ease:T.ease}),M=T.value}let w=[];for(let T of y.sort((C,N)=>C.t-N.t)){let C=w[w.length-1];C&&C.t===T.t?w[w.length-1]=T:w.push(T)}let S={target:b,type:Ae(g[0].value),keys:w};v&&(S.editable=!0),m.push(S)}let p=Yn(E(E(E(L(E({},t),{tracks:m,labels:s}),a?{editableDuration:!0}:{}),i.length?{markers:i}:{}),r.length?{children:r.map(y=>{var v=y,{_pos:b}=v,g=Ve(v,["_pos"]);return g})}:{}));return o.size&&$r.set(p,o),p}function $o(e,t){return typeof e=="function"?Or(e,t):Yn(e)}function Qt(e=0){return A(e)}var Ar=class extends Error{constructor(e){super(`timeline targets '${e}' but no property signal resolves to it`),this.name="UnboundTargetError"}},Pr=class extends Error{constructor(t,n,s){let r=t.slice(t.lastIndexOf("/")+1),i=[s].flat(),o=n==="number"&&i.includes("vec2")?`; target '${r}.x'/'${r}.y' or author a vec2 track`:"";super(`track '${t}' is '${n}' but '${r}' expects '${i.join("'|'")}' (would silently NaN evaluation)${o}`);x(this,"target");x(this,"got");x(this,"expected");this.target=t,this.got=n,this.name="BindTypeMismatchError",this.expected=s}};function os(e,t,n=Qt()){let s=[],r=new Map;for(let[i,o]of e.tracks){let a=t(i);if(!a)throw new Ar(i);let l=o.type,c=a.expects;if(c!==void 0){let u=Vt(l);if(!(Array.isArray(c)?c:[c]).some(f=>Vt(f)===u))throw new Pr(i,l,c)}a.bindSource(()=>_t(o,n())),s.push(a),r.set(i,{track:o,value:u=>_t(o,u),velocity:u=>Xn(o,u)})}return{playhead:n,samplers:r,unbind:()=>{for(let i of s)i.unbindSource()}}}function as(e,t,n){e.forceSet(t),vr();try{return n()}finally{xr()}}function ce(e){let t=e>>>0;return()=>{t=t+2654435769|0;let n=t^t>>>16;return n=Math.imul(n,569420461),n=n^n>>>15,n=Math.imul(n,1935289751),n=n^n>>>15,(n>>>0)/4294967296}}var Ut=class extends Error{constructor(e){super(`bake(): ${e}`),this.name="BakeError"}};function Kt(e,t,n){for(let[s,r]of Object.entries(t)){let i=e.get(s);i||(i={keys:[],type:Ae(r)},e.set(s,i)),i.keys.push({t:n,value:r})}}function Dr(e){return[...e.entries()].map(([t,n])=>({target:t,type:n.type,keys:n.keys}))}function Co(e){var o,a;if(!(e.fps>0)||!(e.duration>=0))throw new Ut("fps must be > 0 and duration >= 0");let t=ce((o=e.seed)!=null?o:0),n=1/e.fps,s=Math.round(e.duration*e.fps),r=e.setup(t),i=new Map;Kt(i,e.sample(r),0);for(let l=1;l<=s;l++)r=(a=e.step(r,n,t))!=null?a:r,Kt(i,e.sample(r),l*n);return Dr(i)}function Oo(e){var f;if(!(e.every>=1))throw new Ut("checkpoint interval `every` must be >= 1 frame");let t=1/e.fps,n=Math.round(e.duration*e.fps),s=0,r=ce((f=e.seed)!=null?f:0),i=()=>(s++,r()),o=h=>{var m;let d=ce((m=e.seed)!=null?m:0);for(let p=0;p<h;p++)d();return d},a=e.setup(i),l=[{snap:e.snapshot(a),rngDraws:s}],c=0;function u(h){var d;for(;c<Math.min(h,n);)a=(d=e.step(a,t,i))!=null?d:a,c++,c%e.every===0&&l.push({snap:e.snapshot(a),rngDraws:s})}return{frames:n,bakeRange(h,d){var v;if(h<0||d>n||h>d)throw new Ut(`range ${h}..${d} outside 0..${n}`);let m=Math.floor(h/e.every)*e.every;u(m);let p=l[m/e.every],k=e.restore(p.snap),b=o(p.rngDraws),g=m,y=new Map;for(g>=h&&Kt(y,e.sample(k),g*t);g<d;)k=(v=e.step(k,t,b))!=null?v:k,g++,g>=h&&Kt(y,e.sample(k),g*t);return Dr(y)}}}var Ie=[1,0,0,1,0,0],W=e=>e===0?0:e;function dt(e,t){let[n,s,r,i,o,a]=e,[l,c,u,f,h,d]=t;return[W(n*l+r*c),W(s*l+i*c),W(n*u+r*f),W(s*u+i*f),W(n*h+r*d+o),W(s*h+i*d+a)]}function hs(e,t,n){let s=t*Math.PI/180,r=Math.cos(s),i=Math.sin(s),[o,a]=n;return[W(r*o),W(i*o),W(-i*a),W(r*a),W(e[0]),W(e[1])]}function _r(e){let[t,n,s,r,i,o]=e,a=t*r-n*s;if(a===0)return null;let l=r/a,c=-n/a,u=-s/a,f=t/a;return[W(l),W(c),W(u),W(f),W(-(l*i+u*o)),W(-(c*i+f*o))]}function Wr(e,t){return[e[0]*t[0]+e[2]*t[1]+e[4],e[1]*t[0]+e[3]*t[1]+e[5]]}function Ee(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]}function Xe(e,t){if(t instanceof ArrayBuffer)return`ab:${t.byteLength}`;if(ArrayBuffer.isView(t))return`view:${t.byteLength}`;if(typeof t!="function")return typeof t=="number"&&!Number.isFinite(t)?Number.isNaN(t)?"NaN":t>0?"Infinity":"-Infinity":t}function Fr(e,t){let n={};for(let[s,r]of Object.entries(e))n[s]=r;return e.op==="clip"||e.op==="fillPath"||e.op==="strokePath"?n.path=t[e.path]:e.op==="drawImage"&&(n.image=t[e.image]),n}var He=e=>JSON.stringify(e,Xe);function Ao(e,t){let n=[],s=new Set([...Object.keys(e),...Object.keys(t)]);for(let r of s)r!=="op"&&He(e[r])!==He(t[r])&&n.push({path:r,from:e[r],to:t[r]});return n}function fs(e,t){let n=[],s=Math.max(e.commands.length,t.commands.length);for(let i=0;i<s;i++){let o=e.commands[i],a=t.commands[i];if(o!==void 0&&a!==void 0){let l=Fr(o,e.resources),c=Fr(a,t.resources);if(He(l)===He(c))continue;o.op!==a.op?n.push({index:i,kind:"change",opA:o.op,opB:a.op,fields:[{path:"op",from:o.op,to:a.op}]}):n.push({index:i,kind:"change",opA:o.op,opB:a.op,fields:Ao(l,c)})}else a!==void 0?n.push({index:i,kind:"add",opB:a.op,fields:[]}):o!==void 0&&n.push({index:i,kind:"remove",opA:o.op,fields:[]})}let r=e.size.w!==t.size.w||e.size.h!==t.size.h;return E({equal:n.length===0&&!r,deltas:n},r?{size:{from:e.size,to:t.size}}:{})}function jr(e){var n,s,r,i;if(e.equal)return"DisplayLists are identical.";let t=[];e.size&&t.push(`size ${e.size.from.w}x${e.size.from.h} -> ${e.size.to.w}x${e.size.to.h}`);for(let o of e.deltas)if(o.kind==="add")t.push(`+ [${o.index}] add ${(n=o.opB)!=null?n:"?"}`);else if(o.kind==="remove")t.push(`- [${o.index}] remove ${(s=o.opA)!=null?s:"?"}`);else{let a=o.opA===o.opB?o.opA:`${(r=o.opA)!=null?r:"?"} -> ${(i=o.opB)!=null?i:"?"}`;t.push(`~ [${o.index}] ${a}`);for(let l of o.fields)t.push(` ${l.path}: ${He(l.from)} -> ${He(l.to)}`)}return t.join(`
|
|
2
|
+
`)}var Hr=1;function Xr(e){let t={dlSnapshotVersion:1,size:e.size,commands:e.commands,resources:e.resources};return JSON.stringify(t,Xe,2)}var tn=class extends Error{constructor(e){super(e),this.name="DlSnapshotError"}};function Yr(e){let t=JSON.parse(e);if(t.dlSnapshotVersion!==1)throw new tn(`unsupported dlSnapshotVersion ${String(t.dlSnapshotVersion)}; this build reads 1`);if(!t.size||!Array.isArray(t.commands)||!Array.isArray(t.resources))throw new tn("malformed .dl.json snapshot (need size, commands[], resources[])");return{size:t.size,commands:t.commands,resources:t.resources}}var Le=class extends Error{constructor(e){super(e),this.name="FilterValidationError"}},Lr=new Set(["blur","drop-shadow","brightness","contrast","saturate"]);function ds(e){for(let t of e){if(!Lr.has(t.kind))throw new Le(`unknown filter kind '${String(t.kind)}' (have: ${[...Lr].join(", ")})`);if(t.kind==="blur"&&!(Number.isFinite(t.radius)&&t.radius>=0))throw new Le(`blur radius must be \u2265 0, got ${String(t.radius)}`);if(t.kind==="drop-shadow"){if(![t.dx,t.dy,t.blur].every(Number.isFinite)||t.blur<0)throw new Le("drop-shadow needs finite dx/dy and blur \u2265 0");if(typeof t.color!="string"||t.color.length===0)throw new Le("drop-shadow needs a color string")}if((t.kind==="brightness"||t.kind==="contrast"||t.kind==="saturate")&&!(Number.isFinite(t.amount)&&t.amount>=0))throw new Le(`${t.kind} amount must be \u2265 0, got ${String(t.amount)}`)}}function rn(e){return e.length===0?"none":e.map(t=>{switch(t.kind){case"blur":return`blur(${t.radius}px)`;case"drop-shadow":return`drop-shadow(${t.dx}px ${t.dy}px ${t.blur}px ${t.color})`;default:return`${t.kind}(${t.amount})`}}).join(" ")}function Gr(e,t=16,n=2){let s=[];for(let r=0;r<Math.max(1,n);r++)s.push({kind:"drop-shadow",dx:0,dy:0,blur:t*(1+r*1.5),color:e});return s}function Po(e){switch(e.op){case"clip":case"fillPath":case"strokePath":return[e.path];case"drawImage":return[e.image];default:return[]}}function Do(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")}function mt(e){let t=[],n=[],s=new Map;return{push:r=>{r.op==="pushGroup"&&r.filters.length>0&&ds(r.filters),t.push(r)},resource:r=>{let i=JSON.stringify(r),o=s.get(i);if(o!==void 0)return o;let a=n.length;return n.push(r),s.set(i,a),a},mark:()=>t.length,cacheKey:(r,i)=>{if(i<=r)return;let o=new Map,a=[],l=u=>{let f=o.get(u);return f===void 0&&(f=o.size,o.set(u,f),a.push(n[u])),f},c=t.slice(r,i).map(u=>Po(u).length===0?u:u.op==="drawImage"?L(E({},u),{image:l(u.image)}):L(E({},u),{path:l(u.path)}));return Do(JSON.stringify({c,r:a},Xe))},patchCacheKey:(r,i)=>{let o=t[r];o&&o.op==="pushGroup"&&(o.cacheKey=i)},finish:()=>({commands:t,resources:n,size:e})}}var Nr=["marker","crayon","pencil","ink","chalk"],ye=class extends Error{constructor(e){super(e),this.name="SketchValidationError"}};function ps(e){if(!Nr.includes(e.kind))throw new ye(`unknown sketch kind '${String(e.kind)}' (have: ${Nr.join(", ")})`);if(e.width!==void 0&&!(e.width>0))throw new ye(`sketch width must be > 0, got ${String(e.width)}`);if(e.roughness!==void 0&&!(e.roughness>=0))throw new ye(`sketch roughness must be \u2265 0, got ${String(e.roughness)}`);if((e.kind==="crayon"||e.kind==="pencil")&&e.passes!==void 0&&!(e.passes>=1))throw new ye(`sketch passes must be \u2265 1, got ${String(e.passes)}`);if(e.kind==="chalk"&&e.dash!==void 0&&(!Array.isArray(e.dash)||e.dash.some(t=>!(t>=0))))throw new ye("sketch chalk dash must be an array of non-negative numbers")}function ms(e){var t,n,s,r,i,o,a,l,c,u,f,h,d;switch(e.kind){case"marker":return{width:(t=e.width)!=null?t:8,roughness:(n=e.roughness)!=null?n:1.2,passes:2};case"crayon":return{width:(s=e.width)!=null?s:4,roughness:(r=e.roughness)!=null?r:2.4,passes:(i=e.passes)!=null?i:3};case"pencil":return{width:(o=e.width)!=null?o:1.5,roughness:(a=e.roughness)!=null?a:1,passes:(l=e.passes)!=null?l:2};case"ink":return{width:(c=e.width)!=null?c:2.5,roughness:(u=e.roughness)!=null?u:.8,passes:1};case"chalk":return{width:(f=e.width)!=null?f:3,roughness:(h=e.roughness)!=null?h:1.6,passes:1,dash:(d=e.dash)!=null?d:[6,5]}}}var Fo=(e,t,n,s,r)=>{let i=1-r,o=i*i*i,a=3*i*i*r,l=3*i*r*r,c=r*r*r;return[o*e[0]+a*t[0]+l*n[0]+c*s[0],o*e[1]+a*t[1]+l*n[1]+c*s[1]]},Lo=(e,t,n,s)=>{let r=1-s;return[r*r*e[0]+2*r*s*t[0]+s*s*n[0],r*r*e[1]+2*r*s*t[1]+s*s*n[1]]},cs=(e,t,n,s,r,i)=>{let o=n*Math.cos(i),a=s*Math.sin(i),l=Math.cos(r),c=Math.sin(r);return[e+o*l-a*c,t+o*c+a*l]};function gt(e,t=16){let n=[],s=null,r=0,i=0,o=0,a=0,l=(c,u)=>(s||(s={points:[[c,u]],closed:!1},n.push(s),o=c,a=u),s);for(let c of e)switch(c[0]){case"M":s={points:[[c[1],c[2]]],closed:!1},n.push(s),r=o=c[1],i=a=c[2];break;case"L":l(r,i).points.push([c[1],c[2]]),r=c[1],i=c[2];break;case"C":{let u=l(r,i);for(let f=1;f<=t;f++)u.points.push(Fo([r,i],[c[1],c[2]],[c[3],c[4]],[c[5],c[6]],f/t));r=c[5],i=c[6];break}case"Q":{let u=l(r,i);for(let f=1;f<=t;f++)u.points.push(Lo([r,i],[c[1],c[2]],[c[3],c[4]],f/t));r=c[3],i=c[4];break}case"E":{let[,u,f,h,d,m,p,k]=c,b=cs(u,f,h,d,m,p),g=l(b[0],b[1]);for(let v=1;v<=t;v++)g.points.push(cs(u,f,h,d,m,p+(k-p)*(v/t)));let y=cs(u,f,h,d,m,k);r=y[0],i=y[1];break}case"Z":s&&(s.points.push([o,a]),s.closed=!0,r=o,i=a);break}return n.filter(c=>c.points.length>0)}function gs(e){let t=0;for(let n=1;n<e.points.length;n++)t+=Math.hypot(e.points[n][0]-e.points[n-1][0],e.points[n][1]-e.points[n-1][1]);return t}function ys(e){if(!(e.gap>0))throw new ye(`hachure gap must be > 0, got ${String(e.gap)}`);if(e.roughness!==void 0&&!(e.roughness>=0))throw new ye(`hachure roughness must be \u2265 0, got ${String(e.roughness)}`)}function ws(e,t,n){var I;let s=gt(e),r=1/0,i=1/0,o=-1/0,a=-1/0;for(let w of s)for(let[S,T]of w.points)S<r&&(r=S),T<i&&(i=T),S>o&&(o=S),T>a&&(a=T);if(!Number.isFinite(r))return[];let l=(r+o)/2,c=(i+a)/2,u=Math.cos(t.angleRad),f=Math.sin(t.angleRad),h=(w,S)=>[(w-l)*u+(S-c)*f,-(w-l)*f+(S-c)*u],d=(w,S)=>[l+w*u-S*f,c+w*f+S*u],m=1/0,p=1/0,k=-1/0,b=-1/0,g=[[r,i],[o,i],[o,a],[r,a]];for(let[w,S]of g){let[T,C]=h(w,S);T<m&&(m=T),C<p&&(p=C),T>k&&(k=T),C>b&&(b=C)}let y=(I=t.roughness)!=null?I:1,v=()=>(n()*2-1)*y,M=[];for(let w=p+t.gap/2;w<b;w+=t.gap){let S=d(m,w+v()),T=d(k,w+v());M.push(["M",S[0],S[1]],["L",T[0],T[1]])}return M}function on(e,t,n){let s=ms(t),r=gt(e),i=()=>(n()*2-1)*s.roughness,o=[];for(let a=0;a<s.passes;a++){let l=[];for(let c of r){let u=c.points;if(u.length<2)continue;let f=u[0][0]+i(),h=u[0][1]+i();l.push(["M",f,h]);for(let d=1;d<u.length;d++){let m=u[d][0]+i(),p=u[d][1]+i(),k=m-f,b=p-h,g=Math.hypot(k,b)||1,y=i()*.5,v=(f+m)/2+-b/g*y,M=(h+p)/2+k/g*y;l.push(["Q",v,M,m,p]),f=m,h=p}}o.push(l)}return{strokes:o,resolved:s}}function bs(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function Ur(e,t,n){return on(e,t,ce(n>>>0)).strokes}var nn=.5;function G(e){return Math.round(e/nn)*nn}var en=null;function Kr(e){en=e}function Q(){return en!=null?en:ks}var ks={measureText(e,t){return{width:e.length*t.size*.52,ascent:t.size*.8,descent:t.size*.2}}},Jt;function an(e){if(Jt===void 0&&(Jt=typeof Intl!="undefined"&&"Segmenter"in Intl?new Intl.Segmenter(void 0,{granularity:"word"}):null),Jt){let t=[...Jt.segment(e)].map(s=>s.segment),n=[];for(let s of t)n.length>0&&/^[^\p{L}\p{N}\s]+$/u.test(s)?n[n.length-1]+=s:n.push(s);return n}return e.split(/(\s+)/).filter(t=>t.length>0)}var Zt;function Te(e){return Zt===void 0&&(Zt=typeof Intl!="undefined"&&"Segmenter"in Intl?new Intl.Segmenter(void 0,{granularity:"grapheme"}):null),Zt?[...Zt.segment(e)].map(t=>t.segment):Array.from(e)}function le(e,t,n,s){let r=e.split(`
|
|
3
|
+
`);if(n===void 0||n<=0)return r;let i=[];for(let o of r){let a=an(o),l="";for(let c of a){let u=l+c;l!==""&&G(s.measureText(u.trimEnd(),t).width)>n?(i.push(l.trimEnd()),l=c.trimStart()===""?"":c):l=u}i.push(l.trimEnd())}return i}var No={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 vs(e){if(typeof e=="string"){let t=No[e];if(!t)throw new Error(`unknown anchor '${e}' (use a preset like 'top-left' or a [ax, ay] pair)`);return t}return[e[0],e[1]]}function ft(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}function Rr(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}var pt,Br,J=(Br=class{constructor(e={}){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);U(this,pt,!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 t;this.id=e.id,this.position=Rr(je([0,0]),e.position),this.rotation=ft(A(0),e.rotation),this.scale=Rr(je([1,1]),e.scale),this.opacity=ft(A(1),e.opacity),this.blend=ft(A("source-over"),e.blend),this.zIndex=ft(A(0),e.zIndex),this.filters=ft(A([]),e.filters),this.hasAnchor=e.anchor!==void 0,this.anchor=vs((t=e.anchor)!=null?t:"center"),this.cache=e.cache===!0,this.localMatrix=ut(()=>{let n=hs(this.position(),this.rotation(),this.scale()),[s,r]=this.anchorShift();return s===0&&r===0?n:dt(n,[1,0,0,1,s,r])},{equals:Ee}),this.worldMatrix=ut(()=>this.parent?dt(this.parent.worldMatrix(),this.localMatrix()):this.localMatrix(),{equals:Ee}),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(e,t,n){t.expects=n,this.targets.set(e,t),this.id!==void 0&&(t[Pe]=`${this.id}/${e}`)}resolveTarget(e){return this.targets.get(e)}listTargets(){return[...this.targets].map(([e,t])=>({path:e,expects:t.expects}))}intrinsicSize(e){return null}drawOffset(e){var s,r,i;let t=(r=e!=null?e:(s=this.measurerSource)==null?void 0:s.call(this))!=null?r:Q(),n=(i=this.intrinsicSize(t))!=null?i:{w:0,h:0};return{x:-n.w/2,y:-n.h/2}}flowOffset(e){var i,o;let t=(o=e!=null?e:(i=this.measurerSource)==null?void 0:i.call(this))!=null?o:Q(),n=this.drawOffset(t),[s,r]=this.anchorShift(t);return{x:n.x+s,y:n.y+r}}anchorShift(e){var l,c;if(!this.hasAnchor)return[0,0];let[t,n]=this.anchor,s=(c=e!=null?e:(l=this.measurerSource)==null?void 0:l.call(this))!=null?c:Q(),r=this.intrinsicSize(s);if(!r)return D(this,pt)||(H(this,pt,!0),_(`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(s),o=-(i.x+t*r.w),a=-(i.y+n*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(e,t){let n=this.opacity();if(n<=0)return;let s=this.localMatrix(),r=Ee(s,Ie),i=this.groupShader(),o=this.requiresGroup()||i!==void 0||this.cache,a=this.cache&&e.mark!==void 0;e.push({op:"save"}),r||e.push({op:"transform",m:s});let l=-1;o&&(a&&(l=e.mark()),e.push(E({op:"pushGroup",opacity:n,blend:this.blend(),filters:this.filters()},i!==void 0?{shader:i}:{})));let c=a?e.mark():-1;if(this.draw(e,t),o){if(a){let u=e.cacheKey(c,e.mark());u!==void 0&&e.patchCacheKey(l,u)}e.push({op:"popGroup"})}e.push({op:"restore"})}},pt=new WeakMap,Br),Qr=class extends J{};function Ye(e,t,n,s,r){if(r<=0)return[["M",e,t],["L",e+n,t],["L",e+n,t+s],["L",e,t+s],["Z"]];let i=Math.PI/2;return[["M",e+r,t],["L",e+n-r,t],["E",e+n-r,t+r,r,r,0,-i,0],["L",e+n,t+s-r],["E",e+n-r,t+s-r,r,r,0,0,i],["L",e+r,t+s],["E",e+r,t+s-r,r,r,0,i,Math.PI],["L",e,t+r],["E",e+r,t+r,r,r,0,Math.PI,Math.PI+i],["Z"]]}var Me,qr,re=(qr=class extends J{constructor(t={}){var n;super(t);x(this,"children");U(this,Me,A(0));this.children=(n=t.children)!=null?n:[];for(let s of this.children)s.parent=this}trackStructure(){D(this,Me).call(this)}add(t){return t.parent=this,this.children.push(t),D(this,Me).set(D(this,Me).peek()+1),this}remove(t){let n=this.children.indexOf(t);return n>=0&&(this.children.splice(n,1),t.parent===this&&(t.parent=null),D(this,Me).set(D(this,Me).peek()+1)),this}draw(t,n){let s=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 s)r.emit(t,n)}},Me=new WeakMap,qr);function zr(e){return typeof e=="string"?{kind:"color",color:e}:e}var xs=class extends J{constructor(t={}){var n;super(t);x(this,"fill");x(this,"stroke");x(this,"strokeWidth");x(this,"sketch");x(this,"sketchFill");x(this,"sketchSeed");x(this,"reveal");this.fill=j(A(""),t.fill),this.stroke=j(A(""),t.stroke),this.strokeWidth=j(A(0),t.strokeWidth),this.reveal=j(A(1),t.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"),t.sketch&&ps(t.sketch),t.sketchFill&&ys(t.sketchFill),t.sketchFill&&!t.sketch&&_(`${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=t.sketch,this.sketchFill=t.sketchFill,this.sketchSeed=(n=t.sketchSeed)!=null?n:this.id!==void 0?bs(this.id):0}draw(t){let n=this.pathSegs();if(this.sketch)return this.drawSketch(t,n);let s=t.resource({kind:"path",segs:n}),r=this.fill();r&&t.push({op:"fillPath",path:s,paint:zr(r)});let i=this.stroke(),o=this.strokeWidth();if(i&&o>0){let a=this.reveal();a<1?Vr(t,n,{kind:"color",color:i},{width:o},a):t.push({op:"strokePath",path:s,paint:{kind:"color",color:i},stroke:{width:o}})}}drawSketch(t,n){let s=ce(this.sketchSeed>>>0),r=this.fill();if(r){let u=t.resource({kind:"path",segs:n});t.push({op:"fillPath",path:u,paint:zr(r)})}let{strokes:i,resolved:o}=on(n,this.sketch,s),a=this.stroke()||(typeof r=="string"?r:"")||"#000000";if(this.sketchFill){let u=t.resource({kind:"path",segs:n});t.push({op:"save"}),t.push({op:"clip",path:u,rule:"nonzero"});let f=ws(n,this.sketchFill,s);if(f.length>0){let h=t.resource({kind:"path",segs:f});t.push({op:"strokePath",path:h,paint:{kind:"color",color:a},stroke:{width:Math.max(1,o.width*.5),cap:"round"}})}t.push({op:"restore"})}let l=this.reveal(),c=l<1;for(let u of i){if(u.length===0)continue;if(c){Vr(t,u,{kind:"color",color:a},{width:o.width,cap:"round",join:"round"},l);continue}let f=t.resource({kind:"path",segs:u});t.push({op:"strokePath",path:f,paint:{kind:"color",color:a},stroke:E({width:o.width,cap:"round",join:"round"},o.dash?{dash:o.dash}:{})})}}};function j(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}function Ro(e){let t=[],n=null;for(let s of e)s[0]==="M"?(n=[s],t.push(n)):n&&n.push(s);return t}function Vr(e,t,n,s,r){for(let i of Ro(t)){let o=gt(i).reduce((l,c)=>l+gs(c),0),a=e.resource({kind:"path",segs:i});e.push({op:"strokePath",path:a,paint:n,stroke:L(E({},s),{dash:[o,o],dashOffset:o*(1-r)})})}}function sn(e){if(e===void 0)return[];if(Array.isArray(e)&&e.every(t=>typeof t=="object"&&t!==null&&Array.isArray(t.v)&&Array.isArray(t.in)&&Array.isArray(t.out)))return e;throw new TypeError(`Path.data expects PathValue (PathContour[]); for an SVG path 'd' string, parse it with pathFromSvg(d) from "@glissade/scene/path" (or window.glissade.pathFromSvg in the browser bundle)`)}function cn(e){let t=[],n=null,s=(i,o=[0,0],a=[0,0])=>{n.v.push(i),n.in.push(o),n.out.push(a)},r=()=>n.v[n.v.length-1];for(let i of e)switch(i[0]){case"M":n={closed:!1,v:[[i[1],i[2]]],in:[[0,0]],out:[[0,0]]},t.push(n);break;case"L":n&&s([i[1],i[2]]);break;case"C":if(n){let o=r();n.out[n.out.length-1]=[i[1]-o[0],i[2]-o[1]],s([i[5],i[6]],[i[3]-i[5],i[4]-i[6]])}break;case"Q":if(n){let o=r(),a=i[1],l=i[2],c=i[3],u=i[4];n.out[n.out.length-1]=[2/3*(a-o[0]),2/3*(l-o[1])],s([c,u],[2/3*(a-c),2/3*(l-u)])}break;case"E":if(n){let[,o,a,l,c,u,f,h]=i,d=Math.cos(u),m=Math.sin(u);for(let p=1;p<=16;p++){let k=f+(h-f)*(p/16),b=l*Math.cos(k),g=c*Math.sin(k);s([o+b*d-g*m,a+b*m+g*d])}}break;case"Z":if(n){n.closed=!0;let o=n.v[0],a=r();n.v.length>1&&Math.abs(o[0]-a[0])<1e-9&&Math.abs(o[1]-a[1])<1e-9&&(n.in[0]=n.in[n.in.length-1],n.v.pop(),n.in.pop(),n.out.pop())}break}return t}var ln=class extends xs{constructor(t={}){super(t);x(this,"width");x(this,"height");x(this,"cornerRadius");this.width=j(A(0),t.width),this.height=j(A(0),t.height),this.cornerRadius=j(A(0),t.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 t=this.width(),n=this.height(),s=Math.min(Math.max(0,this.cornerRadius()),t/2,n/2);return Ye(-t/2,-n/2,t,n,s)}},un=class extends xs{constructor(t={}){super(t);x(this,"radius");this.radius=j(A(0),t.radius),this.registerTarget("radius",this.radius,"number")}intrinsicSize(){let t=this.radius()*2;return{w:t,h:t}}pathSegs(){let t=this.radius();return[["E",0,0,t,t,0,0,Math.PI*2],["Z"]]}},yt=class extends xs{constructor(t={}){super(t);x(this,"data");let n=t.data,s=typeof n=="function"?()=>sn(n()):n!==void 0?sn(n):void 0;this.data=j(A([]),s),this.registerTarget("d",this.data,"path")}bounds(){let t=1/0,n=1/0,s=-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],l=i.v[o][1],c=[[a,l],[a+i.in[o][0],l+i.in[o][1]],[a+i.out[o][0],l+i.out[o][1]]];for(let u of c)u[0]<t&&(t=u[0]),u[1]<n&&(n=u[1]),u[0]>s&&(s=u[0]),u[1]>r&&(r=u[1])}return t>s?{minX:0,minY:0,maxX:0,maxY:0}:{minX:t,minY:n,maxX:s,maxY:r}}intrinsicSize(){let t=this.bounds();return{w:t.maxX-t.minX,h:t.maxY-t.minY}}drawOffset(){let t=this.bounds();return{x:t.minX,y:t.minY}}pathSegs(){let t=[];for(let n of this.data()){let s=n.v.length;if(s!==0){t.push(["M",n.v[0][0],n.v[0][1]]);for(let r=0;r<s-1;r++)t.push(["C",n.v[r][0]+n.out[r][0],n.v[r][1]+n.out[r][1],n.v[r+1][0]+n.in[r+1][0],n.v[r+1][1]+n.in[r+1][1],n.v[r+1][0],n.v[r+1][1]]);n.closed&&s>1&&(t.push(["C",n.v[s-1][0]+n.out[s-1][0],n.v[s-1][1]+n.out[s-1][1],n.v[0][0]+n.in[0][0],n.v[0][1]+n.in[0][1],n.v[0][0],n.v[0][1]]),t.push(["Z"]))}}return t}},ls,hn=(ls=class extends J{constructor(t){super(t);x(this,"assetId");x(this,"width");x(this,"height");this.assetId=t.assetId,this.width=j(A(0),t.width),this.height=j(A(0),t.height),this.registerTarget("width",this.width,"number"),this.registerTarget("height",this.height,"number")}intrinsicSize(){return{w:this.width(),h:this.height()}}draw(t){let n=this.width(),s=this.height();if(n<=0||s<=0)return;let r=t.resource({kind:"image",assetId:this.assetId});t.push({op:"drawImage",image:r,dst:{x:-n/2,y:-s/2,w:n,h:s}})}},x(ls,"assetKind","image"),ls),us,fn=(us=class extends J{constructor(t){var n,s,r;super(t);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=t.assetId,this.at=(n=t.at)!=null?n:0,this.trimStart=(s=t.trimStart)!=null?s:0,this.playbackRate=(r=t.playbackRate)!=null?r:1,this.clipDuration=t.clipDuration,this.sourceFps=t.sourceFps,this.width=j(A(0),t.width),this.height=j(A(0),t.height),this.registerTarget("width",this.width,"number"),this.registerTarget("height",this.height,"number")}mediaTime(t){let n=(t-this.at)*this.playbackRate;if(n<0||this.clipDuration!==void 0&&t-this.at>=this.clipDuration)return null;let s=this.trimStart+n;return this.sourceFps!==void 0?Math.floor(s*this.sourceFps+1e-9)/this.sourceFps:s}draw(t,n){let s=this.mediaTime(n.time);if(s===null)return;let r=this.width(),i=this.height();if(r<=0||i<=0)return;let o=t.resource({kind:"videoFrame",assetId:this.assetId,mediaT:s});t.push({op:"drawImage",image:o,dst:{x:-r/2,y:-i/2,w:r,h:i}})}},x(us,"assetKind","video"),us),Ge=class extends J{constructor(t={}){var n,s,r,i,o;super(t);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=j(A(""),t.text),this.fill=j(A("#000000"),t.fill),this.fontSize=j(A(16),t.fontSize),this.fontFamily=(n=t.fontFamily)!=null?n:"sans-serif",this.fontWeight=(s=t.fontWeight)!=null?s:400,this.fontStyle=(r=t.fontStyle)!=null?r:"normal",this.align=(i=t.align)!=null?i:"left",this.width=j(A(0),t.width),this.lineHeight=(o=t.lineHeight)!=null?o:1.25,this.reveal=j(A(Number.POSITIVE_INFINITY),t.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(t){let n=this.text();if(!n)return{w:0,h:0};let s=E({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),r=this.width(),i=le(n,s,r>0?r:void 0,t),o=Math.max(...i.map(a=>G(t.measureText(a,s).width)),0);return{w:r>0?r:o,h:G(s.size*this.lineHeight)*i.length}}drawOffset(t){var a,l,c;let n=(l=t!=null?t:(a=this.measurerSource)==null?void 0:a.call(this))!=null?l:Q(),s=this.intrinsicSize(n),r=E({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=(c=le(this.text(),r,this.width()>0?this.width():void 0,n)[0])!=null?c:"",o=n.measureText(i,r).ascent;return{x:this.align==="left"?0:this.align==="center"?-s.w/2:-s.w,y:-o}}measuredSize(t){var n,s;return this.intrinsicSize((s=t!=null?t:(n=this.measurerSource)==null?void 0:n.call(this))!=null?s:Q())}lineBoxes(t){var c,u;let n=(u=t!=null?t:(c=this.measurerSource)==null?void 0:c.call(this))!=null?u:Q(),s=this.text();if(!s)return[];let r=E({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=le(s,r,i>0?i:void 0,n),a=G(r.size*this.lineHeight),l=[];for(let f=0;f<o.length;f++){let h=o[f];if(!h)continue;let d=n.measureText(h,r),m=G(d.width),p=this.align==="left"?0:this.align==="center"?-m/2:-m;l.push({text:h,x:p,y:f*a-d.ascent,w:m,h:d.ascent+d.descent})}return l}wordBoxes(t){var c,u;let n=(u=t!=null?t:(c=this.measurerSource)==null?void 0:c.call(this))!=null?u:Q(),s=this.text();if(!s)return[];let r=E({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=le(s,r,i>0?i:void 0,n),a=G(r.size*this.lineHeight),l=[];for(let f=0;f<o.length;f++){let h=o[f];if(!h)continue;let d=n.measureText(h,r),m=G(d.width),p=this.align==="left"?0:this.align==="center"?-m/2:-m,k=f*a-d.ascent,b=d.ascent+d.descent,g="";for(let y of an(h)){let v=g;g+=y;let M=y.trim();if(M==="")continue;let I=y.length-y.trimStart().length,w=n.measureText(v+y.slice(0,I),r).width,S=n.measureText(v+y.trimEnd(),r).width;l.push({text:M,line:f,x:p+w,y:k,w:S-w,h:b})}}return l}graphemes(t){var l,c;let n=(c=t!=null?t:(l=this.measurerSource)==null?void 0:l.call(this))!=null?c:Q(),s=this.text();if(!s)return[];let r=E({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=le(s,r,i>0?i:void 0,n),a=[];for(let u of o)for(let f of Te(u))a.push(f);return a}revealHead(t){var h,d,m;let n=(d=t!=null?t:(h=this.measurerSource)==null?void 0:h.call(this))!=null?d:Q(),s=E({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),r=this.width(),i=le(this.text(),s,r>0?r:void 0,n),o=G(s.size*this.lineHeight),a=i.reduce((p,k)=>p+Te(k).length,0),l=this.reveal(),c=Math.max(0,Math.min(Number.isFinite(l)?Math.floor(l):a,a)),u=c,f={x:0,y:0,h:0,line:0,index:c};for(let p=0;p<i.length;p++){let k=(m=i[p])!=null?m:"",b=n.measureText(k,s),g=G(b.width),y=this.align==="left"?0:this.align==="center"?-g/2:-g,v=p*o-b.ascent,M=b.ascent+b.descent,I=Te(k);if(u<=I.length)return{x:y+(u<=0?0:n.measureText(I.slice(0,u).join(""),s).width),y:v,h:M,line:p,index:c};u-=I.length,f={x:y+b.width,y:v,h:M,line:p,index:c}}return f}draw(t,n){let s=this.text();if(!s)return;let r=E({family:this.fontFamily,size:this.fontSize(),weight:this.fontWeight},this.fontStyle==="italic"?{style:"italic"}:{}),i=this.width(),o=le(s,r,i>0?i:void 0,n.measurer),a=G(r.size*this.lineHeight),l=this.reveal(),c=Number.isFinite(l),u=c?Math.max(0,Math.floor(l)):0;for(let f=0;f<o.length;f++){let h=o[f];if(!h)continue;if(!c){t.push(E({op:"fillText",text:h,font:r,paint:{kind:"color",color:this.fill()},x:0,y:f*a},this.align!=="left"?{align:this.align}:{}));continue}if(u<=0)break;let d=Te(h),m=Math.min(u,d.length);if(u-=m,m===d.length)t.push(E({op:"fillText",text:h,font:r,paint:{kind:"color",color:this.fill()},x:0,y:f*a},this.align!=="left"?{align:this.align}:{}));else{let p=G(n.measurer.measureText(h,r).width),k=this.align==="left"?0:this.align==="center"?-p/2:-p;t.push({op:"fillText",text:d.slice(0,m).join(""),font:r,paint:{kind:"color",color:this.fill()},x:k,y:f*a})}}}};function Jr(e,t,n){var h,d;let s=(d=n!=null?n:(h=e.measurerSource)==null?void 0:h.call(e))!=null?d:Q(),r=e.text();if(!r)return[];let i=E({family:e.fontFamily,size:e.fontSize(),weight:e.fontWeight},e.fontStyle==="italic"?{style:"italic"}:{}),o=e.width(),a=le(r,i,o>0?o:void 0,s),l=G(i.size*e.lineHeight),c=t.keys,u=[],f=0;for(let m=0;m<a.length;m++){let p=a[m];if(!p)continue;let k=s.measureText(p,i),b=G(k.width),g=e.align==="left"?0:e.align==="center"?-b/2:-b,y=m*l-k.ascent,v="";for(let M of Te(p)){v+=M;let I=f+1,w=Number.POSITIVE_INFINITY;for(let S of c)if(S.value>=I){w=S.t;break}Number.isFinite(w)&&u.push({charIndex:f,grapheme:M,time:w,x:g+s.measureText(v,i).width,y,line:m}),f++}}return u}var Ss=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"}},dn=null;function Zr(e){dn=e}function ei(){return dn}function ti(){if(!dn)throw new Ss;return dn}var zo=["Group","Rect","Circle","Path","Text","Image","Video","Layout","Custom"],ui=class extends J{constructor(t){var n,s;super(t);x(this,"target");x(this,"color");x(this,"progress");x(this,"padding");x(this,"cornerRadius");this.target=t.text,this.color=ni(A("#ffe066"),t.color),this.progress=ni(A(1),t.progress),this.padding=(n=t.padding)!=null?n:[4,2],this.cornerRadius=(s=t.cornerRadius)!=null?s:4,this.registerTarget("progress",this.progress,"number"),this.registerTarget("color",this.color,"color")}draw(t,n){let s=Math.min(1,Math.max(0,this.progress()));if(s<=0)return;let[r,i]=this.padding,o=this.target.lineBoxes(n.measurer).map(f=>({x:f.x-r,y:f.y-i,w:f.w+2*r,h:f.h+2*i})),a=o.reduce((f,h)=>f+h.w,0);if(a<=0)return;let l=this.target.localMatrix();Ee(l,Ie)||t.push({op:"transform",m:l});let c=this.color(),u=s*a;for(let f of o){let h=Math.min(f.w,u);if(u-=h,h<=0)break;let d=Math.min(this.cornerRadius,h/2,f.h/2),m=t.resource({kind:"path",segs:Ye(f.x,f.y,h,f.h,d)});if(t.push({op:"fillPath",path:m,paint:{kind:"color",color:c}}),u<=0)break}}};function Vo(e,t={}){return new ui(L(E({},t),{text:e}))}function ni(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}var hi=class extends J{constructor(t){var n,s,r,i;super(t);x(this,"target");x(this,"blinkPeriod");x(this,"blinkPhase");x(this,"solidWhileTyping");x(this,"caretWidth");x(this,"fill");this.target=t.text,this.blinkPeriod=(n=t.blinkPeriod)!=null?n:1.06,this.blinkPhase=(s=t.blinkPhase)!=null?s:0,this.solidWhileTyping=(r=t.solidWhileTyping)!=null?r:!0,this.caretWidth=(i=t.width)!=null?i:2,this.fill=qo(A(""),t.fill),this.registerTarget("fill",this.fill,"color")}draw(t,n){let s=this.target.revealHead(n.measurer);if(s.h<=0)return;let r=!0,i=this.target.graphemes(n.measurer).length,o=s.index<i;if(!(this.solidWhileTyping&&o)){let u=this.blinkPeriod>0?this.blinkPeriod:1;r=((n.time-this.blinkPhase)%u+u)%u<u/2}if(!r)return;let a=this.target.localMatrix();Ee(a,Ie)||t.push({op:"transform",m:a});let l=this.fill()||this.target.fill(),c=t.resource({kind:"path",segs:Ye(s.x,s.y,this.caretWidth,s.h,0)});t.push({op:"fillPath",path:c,paint:{kind:"color",color:l}})}};function Bo(e,t={}){return new hi(L(E({},t),{text:e}))}function qo(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}var _o=.06;function Wo(e,t,n={}){var f,h,d,m;let s=(f=n.start)!=null?f:0,r=(h=n.perChar)!=null?h:_o,i=(d=n.gap)!=null?d:0,o=s,a=[],l=[$(s,"",{interp:"hold"})],c=[],u=[];for(let p=0;p<t.length;p++){let k=t[p],b=o,g=(m=k.perChar)!=null?m:r;if(k.type!==void 0)for(let y of Te(k.type)){o+=g,a.push(y);let v=a.join("");l.push($(o,v,{interp:"hold"})),c.push({time:o,kind:"insert",grapheme:y,value:v})}if(k.delete!==void 0)for(let y=0;y<k.delete&&a.length>0;y++){o+=g;let v=a.pop(),M=a.join("");l.push($(o,M,{interp:"hold"})),c.push({time:o,kind:"delete",grapheme:v,value:M})}k.hold!==void 0&&(o+=k.hold),u.push({index:p,start:b,end:o,value:a.join("")}),i>0&&p<t.length-1&&(o+=i)}return{track:me(e,"string",l),marks:c,steps:u,duration:o}}var Ue=class extends Error{constructor(e){super(e),this.name="EachError"}};function Ms(e,t){let n=(e^Math.imul(t+1,2654435769))>>>0;return n=Math.imul(n^n>>>16,569420461),n=Math.imul(n^n>>>15,1935289751),(n^n>>>15)>>>0}var jo=1779033703;function Ho(e,t,n){var s,r,i,o,a,l,c,u,f,h,d,m;if(typeof e=="function")return e(t,n);switch(e.kind){case"row":{let p=(s=e.gap)!=null?s:n>1?1/(n-1):0,k=(r=e.align)!=null?r:.5,b=.5-p*(n-1)/2;return[n===1?.5:b+p*t,k]}case"column":{let p=(i=e.gap)!=null?i:n>1?1/(n-1):0,k=(o=e.align)!=null?o:.5,b=.5-p*(n-1)/2;return[k,n===1?.5:b+p*t]}case"grid":{let p=e.cols;if(!(p>=1))throw new Ue(`grid layout needs cols >= 1 (got ${p})`);let k=(a=e.rows)!=null?a:Math.ceil(n/p),b=(l=e.order)!=null?l:"row",g=b==="row"?t%p:Math.floor(t/k),y=b==="row"?Math.floor(t/p):t%k,v=(c=e.gapX)!=null?c:p>1?1/(p-1):0,M=(u=e.gapY)!=null?u:k>1?1/(k-1):0,I=v*(p-1),w=M*(k-1);return[p===1?.5:.5-I/2+v*g,k===1?.5:.5-w/2+M*y]}case"ring":{let p=(f=e.radius)!=null?f:.5,[k,b]=(h=e.center)!=null?h:[.5,.5],g=((d=e.startAngle)!=null?d:-Math.PI/2)+((m=e.sweep)!=null?m:Math.PI*2)*(n===0?0:t/n);return[k+p*Math.cos(g),b+p*Math.sin(g)]}}}function Xo(e,t,n){let s=(n-1)/2;switch(e){case"from-center":return r=>Math.abs(r-s)*t;case"from-edges":return r=>(s-Math.abs(r-s))*t;case"delay":return r=>r*t}}function Yo(e,t){var s,r;let n=(s=e.stagger)!=null?s:0;return typeof n=="function"?n:Xo((r=e.distribute)!=null?r:"delay",n,t)}function Go(e,t,n){var d,m,p,k,b,g;if(!Number.isInteger(e)||e<0)throw new Ue(`each() count must be a non-negative integer (got ${e})`);let s=((d=n.seed)!=null?d:bs(n.id))>>>0,r=n.box,[i,o]=(m=r==null?void 0:r.origin)!=null?m:[0,0],a=[],l=[],c=new Set;for(let y=0;y<e;y++){let v=`${n.id}/${y}`,M=Ho(n.layout,y,e),I={i:y,n:e,id:v,place:M,rng:ce(Ms(s,y)),seed:s},w=t(y,I);if(!(w instanceof J))throw new Ue(`each() factory must return a Node for index ${y} (got ${typeof w})`);if(c.has(w))throw new Ue(`each() factory returned the same Node instance for index ${y} \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=v;else if(w.id!==v)throw new Ue(`each() factory set id '${w.id}' on index ${y}, but each owns the id namespace \u2014 leave it unset so it becomes '${v}'`);a.push(w),l.push(r?{frac:M,px:[i+M[0]*r.w,o+M[1]*r.h]}:{frac:M})}let u=new re({id:n.id,children:a}),f=[],h=(k=(p=n.motion)==null?void 0:p.startSec)!=null?k:0;if(n.motion){let y=n.motion,v=(b=y.startSec)!=null?b:0,M=Yo(y,e);for(let I=0;I<e;I++){let w=ce(Ms(Ms(s,I),jo)),S=(g=y.jitter)==null?void 0:g.call(y,I,w,e),T=E(E({},S!==void 0?{overrides:S}:{}),y.speed!==void 0?{speed:y.speed}:{}),C=y.clip.apply(`${n.id}/${I}`,v+M(I),T);f.push(...C.tracks),C.end>h&&(h=C.end)}}return{node:u,children:a,tracks:f,end:h,places:l}}function fi(e,t={}){var i,o,a;let n=(i=t.start)!=null?i:0,s=(o=t.duration)!=null?o:1,r=(a=t.ease)!=null?a:"easeInOutCubic";return me(`${e}/reveal`,"number",[$(n,0),$(n+s,1,r)])}function Uo(e,t={}){var s,r;let n=(r=t.delay)!=null?r:((s=t.duration)!=null?s:1)*.6;return qt(e.map(i=>fi(i,t)),n)}var di=class extends Error{constructor(e){super(`'${e}' 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 Ko(){let e=globalThis,t=[{target:Math,key:"random",label:"Math.random"},{target:Date,key:"now",label:"Date.now"},{target:e,key:"setTimeout",label:"setTimeout"},{target:e,key:"setInterval",label:"setInterval"}];return typeof performance!="undefined"&&t.push({target:performance,key:"now",label:"performance.now"}),typeof e.requestAnimationFrame=="function"&&t.push({target:e,key:"requestAnimationFrame",label:"requestAnimationFrame"}),t}function Qo(e,t){if(e==="off")return t();let n=Ko(),s=n.map(i=>i.target[i.key]),r=new Set;n.forEach((i,o)=>{i.target[i.key]=(...a)=>{if(e==="throw")throw new di(i.label);return r.has(i.label)||(r.add(i.label),_(`${i.label} called inside evaluate() \u2014 nondeterministic, not reproducible on export (\xA75.5)`)),s[o].apply(i.target,a)}});try{return t()}finally{n.forEach((i,o)=>{i.target[i.key]=s[o]})}}var pi=class extends Error{constructor(e){super(`duplicate node id '${e}' \u2014 explicit ids must be unique (\xA73.1/\xA76.5)`),this.name="DuplicateNodeIdError"}},mi=class extends Error{constructor(e){super(`node id '${e}' 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 gi(e,t,n){if(e.measurerSource=n,e.id!==void 0){if(e.id.startsWith("~"))throw new mi(e.id);if(t.has(e.id))throw new pi(e.id);t.set(e.id,e)}if(e instanceof re)for(let s of e.children)gi(s,t,n)}function Jo(e){let t=new re({id:"__root",children:e.children}),n=new Map,s=Qt(),r=A(null);return gi(t,n,()=>{var i;return(i=r())!=null?i:Q()}),{root:t,nodes:n,size:e.size,playhead:s,resolveTarget:i=>{for(let o=i.lastIndexOf("/");o>0;o=i.lastIndexOf("/",o-1)){let a=n.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:Q()}}}var si=new WeakMap;function yi(e,t){let n=si.get(e);n||(n=new WeakMap,si.set(e,n));let s=n.get(t);if(!s){let r=se(t);s={compiled:r,bound:os(r,e.resolveTarget,e.playhead)},n.set(t,s)}return s}function kt(e,t,n){yi(e,t);let s=t.fps,r={time:n,frame:s!==void 0?Math.round(n*s):-1,measurer:e.textMeasurer};return as(e.playhead,n,()=>{let i=mt(e.size);return e.root.emit(i,r),i.finish()})}function pn(e){return JSON.stringify(e,Xe)}function Zo(e,t,n){let s=e(),r=e(),i=kt(s,t,n),o=kt(r,t,n);if(pn(i)===pn(o))return{ok:!0};let a=t.fps!==void 0?Math.round(n*t.fps):-1,l={time:n,frame:a,measurer:s.textMeasurer},c={time:n,frame:a,measurer:r.textMeasurer},u;for(let[f,h]of s.nodes){let d=r.nodes.get(f);if(!d)return{ok:!1,node:f};let m=mt(s.size);h.emit(m,l);let p=mt(r.size);d.emit(p,c);let k=m.finish(),b=p.finish();if(pn(k)===pn(b))continue;if(h instanceof re){u!=null||(u=f);continue}let g=fs(k,b).deltas[0];return E({ok:!1,node:f},g!==void 0?{delta:g}:{})}return E({ok:!1},u!==void 0?{node:u}:{})}var Cs=new Set(["blur","drop-shadow","brightness","contrast","saturate"]),ri=e=>e<0?0:e>1?1:e;function ii(e,t,n,s,r){let i=1-r,o=i*i*i,a=3*i*i*r,l=3*i*r*r,c=r*r*r;return[o*e[0]+a*t[0]+l*n[0]+c*s[0],o*e[1]+a*t[1]+l*n[1]+c*s[1]]}function ea(e){let t=[];for(let n of e){let s=n.v.length;for(let r=0;r<s-1;r++)t.push([n.v[r],[n.v[r][0]+n.out[r][0],n.v[r][1]+n.out[r][1]],[n.v[r+1][0]+n.in[r+1][0],n.v[r+1][1]+n.in[r+1][1]],n.v[r+1]]);n.closed&&s>1&&t.push([n.v[s-1],[n.v[s-1][0]+n.out[s-1][0],n.v[s-1][1]+n.out[s-1][1]],[n.v[0][0]+n.in[0][0],n.v[0][1]+n.in[0][1]],n.v[0]])}return t}function vt(e,t={}){var u,f;let n=Math.max(1,Math.floor((u=t.samplesPerSegment)!=null?u:32)),s=ea(e),r=[],i=[];if(s.length>0){let h=ii(...s[0],0);r.push(h),i.push(0);let d=0;for(let m of s)for(let p=1;p<=n;p++){let k=ii(...m,p/n);d+=Math.hypot(k[0]-h[0],k[1]-h[1]),r.push(k),i.push(d),h=k}}else{let h=(f=e[0])==null?void 0:f.v[0];r.push(h?[h[0],h[1]]:[0,0]),i.push(0)}let o=i[i.length-1],a=h=>{if(o<=0||h<=0)return{i:0,f:0};if(h>=o)return{i:r.length-2,f:1};let d=0;for(;d<i.length-1&&i[d+1]<h;)d++;let m=i[d+1]-i[d];return{i:d,f:m>0?(h-i[d])/m:0}},l=h=>{if(r.length===1)return[r[0][0],r[0][1]];let{i:d,f:m}=a(h),p=r[d],k=r[d+1];return[p[0]+(k[0]-p[0])*m,p[1]+(k[1]-p[1])*m]},c=h=>{if(r.length===1)return[1,0];let{i:d}=a(h),m=r[d],p=r[d+1],k=p[0]-m[0],b=p[1]-m[1],g=Math.hypot(k,b);return g>0?[k/g,b/g]:[1,0]};return{length:o,at:l,tangentAt:c,atProgress:h=>l(ri(h)*o),tangentAtProgress:h=>c(ri(h)*o)}}function ta(e){return vt(e).length}function na(e,t){return vt(e).at(t)}var wi=class extends J{constructor(t){var a;super(t);x(this,"target");x(this,"progress");this.target=t.target,this.progress=A(1),typeof t.progress=="function"?this.progress.bindSource(t.progress):t.progress!==void 0&&this.progress.set(t.progress),this.registerTarget("progress",this.progress,"number");let n=t.samplesPerSegment!==void 0?{samplesPerSegment:t.samplesPerSegment}:{},s=t.path instanceof yt?()=>t.path.data():()=>t.path,r=s(),i=vt(r,n),o=()=>{let l=s();return l!==r&&(r=l,i=vt(l,n)),i};if(t.target.position.bindSource(()=>o().atProgress(this.progress())),t.orient){let l=(a=t.orientOffset)!=null?a:0;t.target.rotation.bindSource(()=>{let c=o().tangentAtProgress(this.progress());return Math.atan2(c[1],c[0])*180/Math.PI+l})}}draw(){}};function sa(e,t,n={}){return new wi(L(E({},n),{target:e,path:t}))}var xt=class extends Error{constructor(e){super(e),this.name="TokenMatchError"}},Es=e=>e.replace(/\s+/g,"");function Is(e,t,n=1){let s=Es(t);if(s.length===0)throw new xt("empty token");let r=0;for(let i=0;i<e.length;i++){let o="";for(let a=i;a<e.length;a++){if(o+=Es(e[a].text),o===s){if(r++,r===n)return[i,a];break}if(!s.startsWith(o))break}}throw new xt(`no match for token '${t}'${n>1?` (occurrence ${n})`:""} \u2014 segments are [${e.map(i=>`'${i.text}'`).join(", ")}]`)}var bi=class extends J{constructor(t){var s,r,i;super(t);x(this,"target");x(this,"padding");x(this,"cornerRadius");x(this,"rematch");x(this,"ranges");this.target=t.text,this.padding=(s=t.padding)!=null?s:[4,2],this.cornerRadius=(r=t.cornerRadius)!=null?r:4,this.rematch=(i=t.rematch)!=null?i:!1;let n=this.target.wordBoxes();this.ranges=t.ranges.map((o,a)=>{var f;let l=this.resolveRun(n,o),c=(f=o.id)!=null?f:`r${a}`,u={spec:o,fill:mn(A("#ffe066"),o.fill),opacity:mn(A(1),o.opacity),progress:mn(A(1),o.progress),scale:mn(A(1),o.scale),offset:ia(je([0,0]),o.offset),run:l,bound:oi(n,l)};return this.registerTarget(`${c}/fill`,u.fill,"color"),this.registerTarget(`${c}/opacity`,u.opacity,"number"),this.registerTarget(`${c}/progress`,u.progress,"number"),this.registerTarget(`${c}/scale`,u.scale,"number"),this.registerTarget(`${c}/offset`,u.offset,"vec2"),this.registerTarget(`${c}/offset.x`,u.offset.x,"number"),this.registerTarget(`${c}/offset.y`,u.offset.y,"number"),u})}resolveRun(t,n){var s;if(typeof n.match!="string"){let[r,i]=n.match;if(r<0||i>=t.length||r>i)throw new xt(`word index range [${r}, ${i}] out of bounds (${t.length} boxes)`);return[r,i]}return Is(t,n.match,(s=n.occurrence)!=null?s:1)}draw(t,n){var l;let s=this.target.wordBoxes(n.measurer);if(s.length===0)return;let r=this.target.localMatrix(),[i,o]=this.padding,a=!1;for(let c of this.ranges){let u=c.opacity();if(u<=0)continue;let f=Math.min(1,Math.max(0,c.progress()));if(f<=0)continue;let h=c.run;if(this.rematch&&typeof c.spec.match=="string")h=Is(s,c.spec.match,(l=c.spec.occurrence)!=null?l:1);else if(oi(s,h)!==c.bound)throw new xt(`bound token '${c.bound}' no longer matches boxes [${h[0]}, ${h[1]}] \u2014 the text changed (segments now [${s.slice(h[0],h[1]+1).map(v=>`'${v.text}'`).join(", ")}]); pass rematch: true for animated text`);let d=[];for(let v=h[0];v<=h[1];v++){let M=s[v],I=d[d.length-1],w=v>h[0]&&s[v-1].line===M.line?I:void 0;w?(w.w=M.x+M.w+i-w.x,w.y=Math.min(w.y,M.y-o),w.h=Math.max(w.h,M.y+M.h+o-w.y)):d.push({x:M.x-i,y:M.y-o,w:M.w+2*i,h:M.h+2*o})}!a&&!Ee(r,Ie)&&(t.push({op:"transform",m:r}),a=!0);let m=u<1;m&&t.push({op:"pushGroup",opacity:u,blend:"source-over",filters:[]});let p=c.fill(),k=c.scale(),[b,g]=c.offset(),y=f*d.reduce((v,M)=>v+M.w,0);for(let v of d){let M=Math.min(v.w,y);if(y-=M,M<=0)break;let I=v.x+v.w/2+b,w=v.y+v.h/2+g,S=M*k,T=v.h*k,C=I-v.w/2*k,N=w-T/2,R=Math.min(this.cornerRadius,S/2,T/2),X=t.resource({kind:"path",segs:Ye(C,N,S,T,R)});if(t.push({op:"fillPath",path:X,paint:{kind:"color",color:p}}),y<=0)break}m&&t.push({op:"popGroup"})}}};function oi(e,t){return e.slice(t[0],t[1]+1).map(n=>Es(n.text)).join("")}function ra(e,t){return new bi(L(E({},t),{text:e}))}function mn(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}function ia(e,t){return typeof t=="function"?e.bindSource(t):t!==void 0&&e.set(t),e}function ki(e){let t=[],n=s=>{if(s instanceof Ge){let r=s.text();r&&t.push({family:s.fontFamily,text:r})}if(s instanceof re)for(let r of s.children)n(r)};return n(e.root),t}function oa(e){let t=e.indexOf("/");return t>=0?e.slice(0,t):e}function aa(e,t){let n=[];for(let s of t.tracks){if(s.type!=="string")continue;let r=e.nodes.get(oa(s.target));if(r instanceof Ge)for(let i of s.keys){let o=i.value;typeof o=="string"&&o&&n.push({family:r.fontFamily,text:o})}}return n}async function Os(e,t,n,s={}){var c,u;let r=(c=s.mode)!=null?c:"dev",i=ht(t.assets),o=[...ki(e),...(u=s.extraUsages)!=null?u:[]],a=new Set;for(let f of o)if(i.has(f.family))for(let h of i.fallbackChain(f.family))a.add(h);let l=new Map;for(let f of a){let h=i.resolveFace(f);if(!h)continue;let d=await n(h.url);d&&l.set(f,Wt(d))}return is(o,i,l,r,E({},s.osFamilies!==void 0?{osFamilies:s.osFamilies}:{}))}var bt=class extends Error{constructor(t,n,s){super(`asset '${t}' not ready: ${n}. 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=t,this.detail=n,this.mediaT=s}},ca=class extends re{constructor(t){var s;super(t);x(this,"wgsl");x(this,"uniformSignals");this.wgsl=t.wgsl;let n=new Map;for(let[r,i]of Object.entries((s=t.uniforms)!=null?s:{})){let o=A(i);n.set(r,o),this.registerTarget(`u.${r}`,o,"number")}this.uniformSignals=n}uniform(t){let n=this.uniformSignals.get(t);if(!n)throw new Error(`ShaderEffect has no uniform '${t}' (have: ${[...this.uniformSignals.keys()].join(", ")})`);return n}groupShader(){let t={};for(let[n,s]of this.uniformSignals)t[n]=s();return{wgsl:this.wgsl,uniforms:t}}},la=e=>e*e*(3-2*e),ua=2.4,ha=1-Math.exp(-5.76/2),fa=e=>(1-Math.exp(-((e*ua)**2)/2))/ha;function da(e,t){if(t==="linear"||e.length<2)return e;let n=t==="gaussian"?fa:la,s=e[0].offset,r=e[e.length-1].offset-s;if(r<=0)return e;let i=[],o=0;for(let a=0;a<64;a++){let l=s+r*(a/63);for(;o<e.length-2&&l>e[o+1].offset;)o++;let c=e[o],u=e[o+1],f=u.offset-c.offset,h=f>0?Math.min(1,Math.max(0,(l-c.offset)/f)):0;i.push({offset:l,color:fe(c.color,u.color,n(h))})}return i}var pa=4,ma=2,$s=.32,ai=1e-6,ci=1024;function vi(e,t,n){let s=new Uint8ClampedArray(Math.max(1,t)*Math.max(1,n)*4),r=e.points.map(l=>({u:l.pos[0],v:l.pos[1],lab:Oe(pe(l.color))})),i=e.bg!==void 0?Oe(pe(e.bg)):null,o=e.interpolation==="gaussian",a=2*$s*$s;for(let l=0;l<n;l++){let c=n>1?(l+.5)/n:.5;for(let u=0;u<t;u++){let f=t>1?(u+.5)/t:.5,h=0,d=0,m=0,p=0,k=0;i&&(h=1,d=i.L,m=i.a,p=i.b,k=i.alpha);let b=!1;for(let v=0;v<r.length;v++){let M=r[v],I=f-M.u,w=c-M.v,S=I*I+w*w;if(S<=ai*ai){d=M.lab.L,m=M.lab.a,p=M.lab.b,k=M.lab.alpha,b=!0;break}let T;o?T=Math.exp(-S/a):T=1/S,h+=T,d+=T*M.lab.L,m+=T*M.lab.a,p+=T*M.lab.b,k+=T*M.lab.alpha}let g;if(b)g=qe({L:d,a:m,b:p,alpha:k});else if(h>0){let v=1/h;g=qe({L:d*v,a:m*v,b:p*v,alpha:k*v})}else g={r:0,g:0,b:0,a:0};let y=(l*t+u)*4;s[y]=g.r,s[y+1]=g.g,s[y+2]=g.b,s[y+3]=Math.round(g.a*255)}}return s}function xi(e,t){return{w:Math.min(ci,Math.max(1,Math.ceil(Math.abs(e)/4))),h:Math.min(ci,Math.max(1,Math.ceil(Math.abs(t)/4)))}}var li=!1;function ga(e){var t,n,s;return li||(li=!0,_("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")),(s=(n=e.bg)!=null?n:(t=e.points[0])==null?void 0:t.color)!=null?s:"#00000000"}function Ts(e,t,n){if(t.kind==="color")return t.color;if(t.kind==="mesh")return ga(t);let s;if(t.kind==="radial"){let i=t.center?t.center[0]:n?(n.minX+n.maxX)/2:0,o=t.center?t.center[1]:n?(n.minY+n.maxY)/2:0,a=t.radius!==void 0?t.radius:n?Math.hypot(n.maxX-n.minX,n.maxY-n.minY)/2:0;s=e.createRadialGradient(i,o,0,i,o,a)}else{let i=t.from?t.from[0]:n?(n.minX+n.maxX)/2:0,o=t.from?t.from[1]:n?n.minY:0,a=t.to?t.to[0]:n?(n.minX+n.maxX)/2:0,l=t.to?t.to[1]:n?n.maxY:0;s=e.createLinearGradient(i,o,a,l)}let r=t.interpolation?da(t.stops,t.interpolation):t.stops;for(let i of r)s.addColorStop(i.offset,i.color);return s}function gn(e){return`${e.style==="italic"?"italic ":""}${e.weight!==void 0&&e.weight!==400?`${e.weight} `:""}${e.size}px ${e.family}`}var ya=16;function wa(e){let t=n=>Object.is(n,-0)?"0":String(Math.round(n*1e4)/1e4);return`${t(e[0])},${t(e[1])},${t(e[2])},${t(e[3])},${t(e[4])},${t(e[5])}`}function ba(e){let t=0;for(let n of e!=null?e:[])n.kind==="blur"?t+=3*n.radius:n.kind==="drop-shadow"&&(t+=Math.max(Math.abs(n.dx),Math.abs(n.dy))+3*n.blur);return t}function Si(e,t,n){return e?(t<e.minX&&(e.minX=t),n<e.minY&&(e.minY=n),t>e.maxX&&(e.maxX=t),n>e.maxY&&(e.maxY=n),e):{minX:t,minY:n,maxX:t,maxY:n}}function wt(e,t,n,s,r,i){for(let[o,a]of[[n,s],[r,s],[n,i],[r,i]])e.bounds=Si(e.bounds,t[0]*o+t[2]*a+t[4],t[1]*o+t[3]*a+t[5])}function ka(e){let t=null,n=(s,r)=>{t=Si(t,s,r)};for(let s of e)switch(s[0]){case"M":case"L":n(s[1],s[2]);break;case"C":n(s[1],s[2]),n(s[3],s[4]),n(s[5],s[6]);break;case"Q":n(s[1],s[2]),n(s[3],s[4]);break;case"E":{let r=Math.max(s[3],s[4]);n(s[1]-r,s[2]-r),n(s[1]+r,s[2]+r);break}}return t}var As=class{constructor(e,t="warn",n=(i=>(i=(r=>(r=(s=>(s=globalThis.process)==null?void 0:s.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=e,this.shaderCaps=t,this.cacheEnabled=n}setImageAsset(e,t){this.images.set(e,t)}setVideoAsset(e,t){this.videos.set(e,t)}dispose(){this.pool.length=0,this.rasterCache.clear()}resolveDrawable(e,t){if(e.kind==="image"){let n=this.images.get(e.assetId);if(!n)throw new bt(e.assetId,"no decoded image registered");return n}if(e.kind==="videoFrame"){let n=this.videos.get(e.assetId);if(!n)throw new bt(e.assetId,"no VideoFrameSource registered",e.mediaT);try{return n.getFrameSync(e.mediaT)}catch(s){throw s instanceof bt?new bt(e.assetId,s.detail,e.mediaT):s}}throw new Error(`resource ${t} is not drawable`)}path(e,t){let n=e[t];if(!n||n.kind!=="path")throw new Error(`resource ${t} is not a path`);let s=this.pathCache.get(n);return s||(s=this.buildPath(n.segs),this.pathCache.set(n,s)),s}pathBounds(e,t){var s;let n=e[t];return!n||n.kind!=="path"?null:(this.pathBoundsCache.has(n)||this.pathBoundsCache.set(n,ka(n.segs)),(s=this.pathBoundsCache.get(n))!=null?s:null)}buildPath(e){let t=this.host.newPath();for(let n of e)switch(n[0]){case"M":t.moveTo(n[1],n[2]);break;case"L":t.lineTo(n[1],n[2]);break;case"C":t.bezierCurveTo(n[1],n[2],n[3],n[4],n[5],n[6]);break;case"Q":t.quadraticCurveTo(n[1],n[2],n[3],n[4]);break;case"E":t.ellipse(n[1],n[2],n[3],n[4],n[5],n[6],n[7]);break;case"Z":t.closePath();break}return t}acquire(e,t){let n=this.pool.pop();return n?(n.width!==e&&(n.width=e),n.height!==t&&(n.height=t),n):this.host.createCanvas(e,t)}release(e){this.pool.length<8&&this.pool.push(e)}cacheStore(e,t){let n=this.rasterCache.get(e);for(n&&(this.rasterCache.delete(e),n.canvas!==t.canvas&&this.release(n.canvas)),this.rasterCache.set(e,t);this.rasterCache.size>ya;){let s=this.rasterCache.keys().next().value;if(s===void 0)break;let r=this.rasterCache.get(s);this.rasterCache.delete(s),this.release(r.canvas)}}cacheTouch(e){let t=this.rasterCache.get(e);return t&&(this.rasterCache.delete(e),this.rasterCache.set(e,t)),t}fillMesh(e,t,n,s){let r=s.maxX-s.minX,i=s.maxY-s.minY;if(r<=0||i<=0)return;let{w:o,h:a}=xi(r,i),l=vi(n,o,a),c=this.acquire(o,a),u=this.host.context(c),f=u.createImageData(o,a);f.data.set(l),u.putImageData(f,0,0),e.save(),e.clip(t,"nonzero"),e.imageSmoothingEnabled=!0,e.drawImage(c,0,0,o,a,s.minX,s.minY,r,i),e.restore(),this.release(c)}composite(e,t,n,s,r,i,o,a,l,c,u,f){let h=l!==void 0&&l!=="none",d=h?ba(c):0;r||a!=="source-over"?t.unbounded=!0:s&&wt(t,Ie,s.minX-d,s.minY-d,s.maxX+d,s.maxY+d);let m=h&&!i&&!r&&a==="source-over";if(!(m&&s===null)){if(e.save(),e.resetTransform(),m&&s){let p=Math.max(0,Math.floor(s.minX-d)),k=Math.max(0,Math.floor(s.minY-d)),b=Math.min(u,Math.ceil(s.maxX+d)),g=Math.min(f,Math.ceil(s.maxY+d));if(p>=b||k>=g){e.restore();return}let y=this.host.newPath();y.moveTo(p,k),y.lineTo(b,k),y.lineTo(b,g),y.lineTo(p,g),y.closePath(),e.clip(y,"nonzero")}e.globalAlpha=o,h&&(e.filter=l),e.globalCompositeOperation=a,e.drawImage(n,0,0),e.restore()}}render(e,t){var f,h,d,m,p,k,b,g,y,v,M;let{w:n,h:s}=t.size;e.width!==n&&(e.width=n),e.height!==s&&(e.height=s);let r=this.host.context(e);r.resetTransform(),r.clearRect(0,0,n,s);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],l=Ie,c=[],u=t.commands;for(let I=0;I<u.length;I++){let w=u[I];switch(w.op){case"save":c.push(l),o().save();break;case"restore":l=(f=c.pop())!=null?f:l,o().restore();break;case"transform":l=dt(l,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(t.resources,w.path),(h=w.rule)!=null?h:"nonzero");break;case"fillPath":{let S=o(),T=this.pathBounds(t.resources,w.path);w.paint.kind==="mesh"&&T?this.fillMesh(S,this.path(t.resources,w.path),w.paint,T):(S.fillStyle=Ts(S,w.paint,T),S.fill(this.path(t.resources,w.path))),T&&wt(a(),l,T.minX,T.minY,T.maxX,T.maxY);break}case"strokePath":{let S=o(),T=this.pathBounds(t.resources,w.path);if(S.strokeStyle=Ts(S,w.paint,T),S.lineWidth=w.stroke.width,S.lineCap=(d=w.stroke.cap)!=null?d:"butt",S.lineJoin=(m=w.stroke.join)!=null?m:"miter",w.stroke.dash&&(S.setLineDash(w.stroke.dash),S.lineDashOffset=(p=w.stroke.dashOffset)!=null?p:0),S.stroke(this.path(t.resources,w.path)),w.stroke.dash&&(S.setLineDash([]),S.lineDashOffset=0),T){let C=w.stroke.width*(((k=w.stroke.join)!=null?k:"miter")==="miter"?5:1);wt(a(),l,T.minX-C,T.minY-C,T.maxX+C,T.maxY+C)}break}case"fillText":{let S=o();S.font=gn(w.font),S.fillStyle=Ts(S,w.paint,null),S.textBaseline="alphabetic",S.textAlign=(b=w.align)!=null?b:"left",S.fillText(w.text,w.x,w.y);try{let T=S.measureText(w.text).width,C=(g=w.align)!=null?g:"left",N=C==="center"?w.x-T/2:C==="right"?w.x-T:w.x,R=w.font.size;wt(a(),l,N-R,w.y-1.5*R,N+T+R,w.y+.75*R)}catch(T){a().unbounded=!0}break}case"drawImage":{let S=t.resources[w.image];if(!S)throw new Error(`drawImage references missing resource ${w.image}`);let T=this.resolveDrawable(S,w.image),C=o();w.smoothing!==void 0&&(C.imageSmoothingEnabled=w.smoothing);let{x:N,y:R,w:X,h:ee}=w.dst;w.src?C.drawImage(T,w.src.x,w.src.y,w.src.w,w.src.h,N,R,X,ee):C.drawImage(T,N,R,X,ee),wt(a(),l,N,R,N+X,R+ee);break}case"pushGroup":{let S=o(),T=this.cacheEnabled&&w.cacheKey!==void 0&&w.shader===void 0?`${w.cacheKey}@${wa(l)}`:void 0;if(T!==void 0){let R=this.cacheTouch(T);if(R){this.composite(S,a(),R.canvas,R.bounds,R.unbounded,!1,w.opacity,w.blend,rn(w.filters),w.filters,n,s);let X=1;for(;X>0&&++I<u.length;){let ee=u[I];ee.op==="pushGroup"?X++:ee.op==="popGroup"&&X--}break}}let C=this.acquire(n,s),N=this.host.context(C);N.resetTransform(),N.clearRect(0,0,n,s),N.setTransform(S.getTransform()),i.push(E(L(E({ctx:N,canvas:C,opacity:w.opacity,blend:w.blend,filter:rn(w.filters),filters:w.filters},w.shader!==void 0?{shader:w.shader}:{}),{bounds:null,unbounded:!1}),T!==void 0?{cacheStoreKey:T}:{}));break}case"popGroup":{let S=i.pop();if(!S||S.canvas===null)throw new Error("popGroup without matching pushGroup");let T=o(),C=S.canvas,N=!1;if(S.shader!==void 0){let R=(M=(v=(y=this.host).applyShader)==null?void 0:v.call(y,S.canvas,S.shader,n,s))!=null?M:null;if(R!==null)C=R,N=!0,S.bounds={minX:0,minY:0,maxX:n,maxY:s},S.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,_("ShaderEffect pass skipped: no shader runner here (headless or webgpu-less browser) \u2014 subtree composites unfiltered (\xA73.7 caps.shaders)"))}}this.composite(T,a(),C,S.bounds,S.unbounded,N,S.opacity,S.blend,S.filter,S.filters,n,s),S.cacheStoreKey!==void 0&&!N?this.cacheStore(S.cacheStoreKey,{canvas:S.canvas,bounds:S.bounds,unbounded:S.unbounded}):this.release(S.canvas);break}}}if(i.length!==1)throw new Error("unbalanced pushGroup/popGroup in DisplayList")}};var St=null;function Mi(e){St=e}function va(e,t){if(typeof OffscreenCanvas!="undefined")return new OffscreenCanvas(e,t);let n=document.createElement("canvas");return n.width=e,n.height=t,n}var xa=16384,yn=class{constructor(e,t={}){x(this,"target");x(this,"raster");var n;this.target=e,this.raster=new As({context:s=>this.context(s),createCanvas:(s,r)=>va(s,r),newPath:()=>new Path2D,applyShader:(s,r,i,o)=>{var a;return(a=St==null?void 0:St.apply(s,r,i,o))!=null?a:null}},(n=t.shaderCaps)!=null?n:"warn")}get caps(){return{filters:Cs,shaders:St!==null,maxTextureSize:xa}}setImageAsset(e,t){this.raster.setImageAsset(e,t)}setVideoAsset(e,t){this.raster.setVideoAsset(e,t)}measureText(e,t){let n=this.context(this.target);n.save(),n.font=gn(t);let s=n.measureText(e);return n.restore(),{width:s.width,ascent:s.actualBoundingBoxAscent,descent:s.actualBoundingBoxDescent}}render(e){this.raster.render(this.target,e)}async readPixels(){return this.context(this.target).getImageData(0,0,this.target.width,this.target.height).data}dispose(){this.raster.dispose()}context(e){let t=e.getContext("2d");if(!t)throw new Error("canvas 2d context unavailable");return t}};var ue=class extends Error{constructor(e){super(e),this.name="ClipError"}};function Ti(e,t,n){let s;try{s=Ae(n)}catch(i){throw new ue(`clip override for '${e}' has an un-typeable value ${JSON.stringify(n)} (channel type '${t}')`)}let r=i=>i==="color"||i==="string";if(!(s===t||r(s)&&r(t)))throw new ue(`clip override for '${e}' is a '${s}' value but the channel is '${t}' (${JSON.stringify(n)}); a mismatched override samples to NaN`);return n}function Ei(e){return e.keys.length===0?0:e.keys[e.keys.length-1].t}function Sa(e,t,n){if(typeof e=="string")return xe(`${e}/${n}`);let s=e[t];if(s===void 0)throw new ue(`clip target map is missing channel '${t}' \u2014 provide a target for every channel, or pass a node-id string`);return xe(s)}function Ma(e,t,n,s,r){var a;if(t.keys.length===0)throw new ue(`clip channel '${e}' has no keys`);let i=(a=t.type)!=null?a:Ae(t.keys[0].value),o=t.keys.length-1;if(r&&o===0&&r.from!==void 0)throw new ue(r.to!==void 0?`clip override for '${e}' supplies both 'from' and 'to' on a single-key channel \u2014 ambiguous (both target the only key)`:`clip override for '${e}' supplies 'from' on a single-key channel \u2014 ambiguous (the only key already is the 'to' value)`);return me(e,i,t.keys.map((l,c)=>{let u=l.value,f=!1;r&&(c===0&&r.from!==void 0&&(u=Ti(e,i,r.from),f=!0),c===o&&r.to!==void 0&&(u=Ti(e,i,r.to),f=!0));let h={t:n+l.t/s,value:u},d=r&&c===o&&r.ease!==void 0?r.ease:l.ease;return d!==void 0&&(h.ease=d),l.interp!==void 0&&(h.interp=l.interp),l.id!==void 0&&(h.id=l.id),l.derived!==void 0&&!f&&(h.derived=l.derived),l.from!==void 0&&(h.from=l.from),h}))}function we(e){let t=Object.keys(e.channels);if(t.length===0)throw new ue("clip() requires at least one channel");let n=0;for(let r of t){let i=e.channels[r];if(i.keys.length===0)throw new ue(`clip channel '${r}' has no keys`);n=Math.max(n,Ei(i))}function s(r,i,o){var f;let a=(f=o==null?void 0:o.speed)!=null?f:1;if(!(a>0))throw new ue(`clip speed must be > 0 (got ${a})`);let l=o==null?void 0:o.overrides,c=[],u=i;for(let h of t){let d=e.channels[h],m=Sa(r,h,d.path);c.push(Ma(m,d,i,a,l==null?void 0:l[h])),u=Math.max(u,i+Ei(d)/a)}if(l){for(let h of Object.keys(l))if(!(h in e.channels))throw new ue(`clip override references unknown channel '${h}'`)}return{tracks:c,end:u}}return{spec:e,duration:n,apply:s}}function Ta(e,t,n,s){var u;let r=(u=s==null?void 0:s.stagger)!=null?u:0,i=typeof r=="function"?r:h=>h*r,f=s!=null?s:{},{stagger:o}=f,a=Ve(f,["stagger"]),l=[],c=n;return t.forEach((h,d)=>{let m=e.apply(h,n+i(d),a);l.push(...m.tracks),m.end>c&&(c=m.end)}),{tracks:l,end:c}}function Ea(e){var s,r;let t=(s=e==null?void 0:e.duration)!=null?s:.3,n=(r=e==null?void 0:e.ease)!=null?r:"easeOutCubic";return we({channels:{opacity:{path:"opacity",keys:[$(0,0),$(t,1,n)]},scale:{path:"scale",keys:[$(0,[.8,.8]),$(t,[1,1],n)]}}})}function Ia(e,t){var o,a,l;let n=(o=t==null?void 0:t.duration)!=null?o:.3,s=(a=t==null?void 0:t.ease)!=null?a:"easeOutCubic",r=(l=t==null?void 0:t.distance)!=null?l:40,i=e==="left"?[-r,0]:e==="right"?[r,0]:e==="top"?[0,-r]:[0,r];return we({channels:{opacity:{path:"opacity",keys:[$(0,0),$(n,1,s)]},offset:{path:"position",keys:[$(0,i),$(n,[0,0],s)]}}})}function $a(e){var r,i,o;let t=(r=e==null?void 0:e.duration)!=null?r:.4,n=(i=e==null?void 0:e.ease)!=null?i:"easeInOutSine",s=(o=e==null?void 0:e.scale)!=null?o:1.1;return we({channels:{scale:{path:"scale",keys:[$(0,[1,1]),$(t/2,[s,s],n),$(t,[1,1],n)]}}})}function Ca(e){var r,i,o;let t=(r=e==null?void 0:e.duration)!=null?r:2,n=(i=e==null?void 0:e.ease)!=null?i:"easeInOutSine",s=(o=e==null?void 0:e.amplitude)!=null?o:8;return we({channels:{drift:{path:"position",keys:[$(0,[0,0]),$(t/2,[s,0],n),$(t,[0,0],n)]}}})}var Ke=class extends Error{constructor(e){super(e),this.name="MorphError"}};function Ps(e,t){for(let[n,s]of[["x",t.x],["y",t.y],["w",t.w],["h",t.h]])if(!Number.isFinite(s))throw new Ke(`morph ${e}.${n} must be finite (got ${s})`);if(!(t.w>0)||!(t.h>0))throw new Ke(`morph ${e} must have w>0 and h>0 (got w=${t.w}, h=${t.h}); a zero/negative box yields a NaN/Infinity scale`)}function wn(e,t){let n=typeof e=="string"?e:e[Pe];return typeof n!="string"||n.length===0?`${String(n)}/${t}`:`${typeof e=="string"?n:n.slice(0,Math.max(0,n.lastIndexOf("/")))}/${t}`}function Oa(e,t,n,s){var b,g,y;let{at:r,duration:i}=s,o=s.ease,a=(b=s.crossfade)!=null?b:.5,l=(g=s.metric)!=null?g:"transform";if(l!=="transform")throw new Ke(`morph metric '${l}' is not supported in v1 (only 'transform')`);if(Ps("from",e),Ps("to",t),!(i>0))throw new Ke(`morph duration must be > 0 (got ${i})`);if(!(a>=0&&a<=1))throw new Ke(`morph crossfade must be in [0,1] (got ${a})`);let c=(y=s.base)!=null?y:{w:t.w,h:t.h};Ps("to",{x:0,y:0,w:c.w,h:c.h});let u=[e.w/c.w,e.h/c.h],f=[t.w/c.w,t.h/c.h],h=[e.x,e.y],d=[t.x,t.y],m={position:{path:"position",type:"vec2",keys:[$(0,h),$(i,d,o)]},scale:{path:"scale",type:"vec2",keys:[$(0,u),$(i,f,o)]}},p={position:wn(n.morphNode,"position"),scale:wn(n.morphNode,"scale")};n.fromNode!==void 0&&i*a>0&&(m.fromOpacity={path:"opacity",type:"number",keys:[$(0,1),$(i*a,0,o)]},p.fromOpacity=wn(n.fromNode,"opacity")),n.toNode!==void 0&&i*(1-a)<i&&(m.toOpacity={path:"opacity",type:"number",keys:[$(i*(1-a),0),$(i,1,o)]},p.toOpacity=wn(n.toNode,"opacity"));let{tracks:k}=we({channels:m}).apply(p,r);return{tracks:k,end:r+i}}var Fs=class extends Error{constructor(e){super(e),this.name="PresenceError"}},Ns=.3;function Aa(){return we({channels:{opacity:{path:"opacity",keys:[$(0,0),$(Ns,1)]}}})}function Pa(){return we({channels:{opacity:{path:"opacity",keys:[$(0,1),$(Ns,0)]}}})}function Da(e){return typeof e.apply=="function"}function Ls(e){return Array.isArray(e)}function Oi(e,t){var i,o;let n=(i=e.dur)!=null?i:Ns,s=e.ease,r={};if(e.opacity!==void 0){let[a,l]=e.opacity;r.opacity={path:"opacity",keys:[$(0,a),$(n,l,...Ds(s))]}}if(e.offset!==void 0){let[a,l]=La(e.offset,(o=e.edge)!=null?o:"bottom",t);r.offset={path:"position",keys:[$(0,a),$(n,l,...Ds(s))]}}if(e.scale!==void 0){let[a,l]=Na(e.scale);r.scale={path:"scale",keys:[$(0,a),$(n,l,...Ds(s))]}}return we({channels:r})}function Ds(e){return e!==void 0?[e]:[]}function Fa(e,t){return e==="left"?[-t,0]:e==="right"?[t,0]:e==="top"?[0,-t]:[0,t]}function La(e,t,n){if(Array.isArray(e)&&Ls(e[0]))return e;let s=Ls(e)?e:Fa(t,e),r=[0,0];return n==="enter"?[s,r]:[r,s]}function Na(e){let[t,n]=e,s=r=>Ls(r)?r:[r,r];return[s(t),s(n)]}function Ii(e,t,n){return e===void 0?n():Da(e)?e:Oi(e,t)}function $i(e,t){var n;return e.duration/((n=t==null?void 0:t.speed)!=null?n:1)}function Ra(e){return e.map((t,n)=>[t,n]).sort((t,n)=>t[0].t-n[0].t||t[1]-n[1]).map(([t])=>t)}function Ci(e,t){let n=[],s=[];for(let r of e)r.target===t?s=r.keys:n.push(r);return{opacityKeys:s,rest:n}}function Ai(e){let t=Ra(e),n=[];for(let s of t){let r=n[n.length-1];r&&r.t===s.t?n[n.length-1]=s:n.push(s)}return n}function za(e,t){let n=[],s=new Map;for(let r of[...e,...t]){let i=s.get(r.target);i?i.push(r):(s.set(r.target,[r]),n.push(r.target))}return n.map(r=>{let i=s.get(r);if(i.length===1)return i[0];let o=i.flatMap(a=>a.keys);return me(r,i[0].type,Ai(o))})}function Va(e,t){var v,M,I,w;let n=(M=t.show)!=null?M:(v=t.window)==null?void 0:v[0],s=(w=t.hide)!=null?w:(I=t.window)==null?void 0:I[1];if(n===void 0||s===void 0)throw new Fs("presence() needs a window: pass { show, hide } or { window: [show, hide] }");let r=xe(typeof e=="string"?`${e}/opacity`:e),i=r.lastIndexOf("/"),o=i<0?r:r.slice(0,i),a=Ii(t.enter,"enter",Aa),l=Ii(t.exit,"exit",Pa),c=a.apply(o,n,t.enterOpts),u=n+$i(a,t.enterOpts),f=$i(l,t.exitOpts),h=s-f;if(h<=n)throw new Fs(`presence('${o}') exit needs ${f.toFixed(3)}s but only ${(s-n).toFixed(3)}s between show (${n}) and hide (${s}) \u2014 widen the window or shorten/speed up the exit`);let d=l.apply(o,h,t.exitOpts),{opacityKeys:m,rest:p}=Ci(c.tracks,r),{opacityKeys:k,rest:b}=Ci(d.tracks,r),g=[$(0,0,{interp:"hold"}),$(u,1,{interp:"hold"}),$(s,0,{interp:"hold"})],y=[];if(m.length>0?m.forEach((S,T)=>{T===0&&S.value!==0&&S.interp!=="hold"?y.push(L(E({},S),{interp:"hold"})):y.push(S)}):y.push($(n,0),$(u,1)),k.length>0)for(let S of k)y.push(S);else y.push($(h,1),$(s,0));return{tracks:[me(r,"number",Ai([...g,...y])),...za(p,b)],end:s,shownAt:n,hiddenAt:s}}function Pi(e){var f;let t=(f=e.match(/[MmLlHhVvCcQqZz]|-?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g))!=null?f:[],n=[],s=0,r=0,i=0,o=0,a=0,l="",c=()=>Number(t[s++]),u=h=>!!h&&/^[MmLlHhVvCcQqZz]$/.test(h);for(;s<t.length;){let h=t[s];if(u(h)?s++:h=l==="M"?"L":l==="m"?"l":l,!h)break;let d=h===h.toLowerCase();switch(h.toUpperCase()){case"M":{let m=c()+(d?r:0),p=c()+(d?i:0);r=m,i=p,o=m,a=p,n.push(["M",m,p]);break}case"L":{let m=c()+(d?r:0),p=c()+(d?i:0);r=m,i=p,n.push(["L",m,p]);break}case"H":{let m=c()+(d?r:0);r=m,n.push(["L",m,i]);break}case"V":{let m=c()+(d?i:0);i=m,n.push(["L",r,m]);break}case"C":{let m=c()+(d?r:0),p=c()+(d?i:0),k=c()+(d?r:0),b=c()+(d?i:0),g=c()+(d?r:0),y=c()+(d?i:0);r=g,i=y,n.push(["C",m,p,k,b,g,y]);break}case"Q":{let m=c()+(d?r:0),p=c()+(d?i:0),k=c()+(d?r:0),b=c()+(d?i:0);r=k,i=b,n.push(["Q",m,p,k,b]);break}case"Z":n.push(["Z"]),r=o,i=a;break;default:s++;break}l=h}return n}function Ba(e){return cn(Pi(e))}var Di="0.18.0-pre.6",qa=Di.includes("GLISSADE_".concat("VERSION"))?"0.0.0-dev":Di;function Fi(e){if(e==="number")return 1;if(e==="vec2"||e==="vec2-arc")return 2}function _a(e){return e===void 0?"unknown":Array.isArray(e)?e.join("|"):e}var Wa={Group:{children:{type:"Node[]"}},Rect:{sketch:{type:"SketchStyle"},sketchFill:{type:"HachureSpec"},sketchSeed:{type:"number"}},Circle:{sketch:{type:"SketchStyle"},sketchFill:{type:"HachureSpec"},sketchSeed:{type:"number"}},Path:{sketch:{type:"SketchStyle"},sketchFill:{type:"HachureSpec"},sketchSeed:{type:"number"}},Text:{fontFamily:{type:"string"},fontWeight:{type:"number"},fontStyle:{type:"'normal'|'italic'"},align:{type:"'left'|'center'|'right'"},lineHeight:{type:"number"}},Image:{assetId:{type:"string",required:!0}},Video:{assetId:{type:"string",required:!0},at:{type:"number"},trimStart:{type:"number"},playbackRate:{type:"number"},clipDuration:{type:"number"},sourceFps:{type:"number"}}},ja={id:{type:"string"},blend:{type:"BlendMode"},filters:{type:"FilterSpec[]"},anchor:{type:"AnchorSpec"},cache:{type:"boolean"}};function Li(e,t){var r;let n={};for(let{path:i,expects:o}of e.listTargets()){let a=_a(o),l=Fi(a);n[i]=E({type:a,animatable:!0,target:`<id>/${i}`},l!==void 0?{arity:l}:{})}let s=E(E({},ja),(r=Wa[t])!=null?r:{});for(let[i,o]of Object.entries(s))n[i]=E({type:o.type,animatable:!1},o.required?{required:!0}:{});return{props:n}}var Ha="@glissade/scene/layout",Xa={width:{type:"number"},height:{type:"number"},gap:{type:"number"},padding:{type:"number"}},Ya={direction:{type:"'row'|'column'"},justify:{type:"'start'|'center'|'end'|'space-between'|'space-around'"},align:{type:"'start'|'center'|'end'|'stretch'"},children:{type:"Node[]"}};function Ga(){let e=Li(new re,"Group").props;delete e.children;for(let[n,s]of Object.entries(Xa)){let r=Fi(s.type);e[n]=E({type:s.type,animatable:!0,target:`<id>/${n}`},r!==void 0?{arity:r}:{})}let t=Ya;for(let[n,s]of Object.entries(t))e[n]=E({type:s.type,animatable:!1},s.required?{required:!0}:{});return{props:e,subpath:Ha}}var Ua={Group:()=>new re,Rect:()=>new ln,Circle:()=>new un,Path:()=>new yt,Text:()=>new Ge,Image:()=>new hn({assetId:"~describe"}),Video:()=>new fn({assetId:"~describe"})},Ka=[{name:"to",signature:"to<T>(target, value, opts?: { duration?, ease?, at?, from? }): TimelineBuilder"},{name:"fromTo",signature:"fromTo<T>(target, from, to, opts?: { duration?, ease?, at? }): TimelineBuilder"},{name:"stagger",signature:"stagger<T>(targets, { to, from?, duration?, ease? }, { each: number | ((rank, count) => number), anchor?, at? }): TimelineBuilder"},{name:"set",signature:"set<T>(target, value, opts?: { at? }): TimelineBuilder"},{name:"label",signature:"label(name, at?): TimelineBuilder"},{name:"add",signature:"add(child, at?, opts?: { mode?: 'add'|'sync', timeScale? }): TimelineBuilder"},{name:"sequence",signature:"sequence(subs, opts?: { gap? }): TimelineBuilder"},{name:"at",signature:"at(time, sub): TimelineBuilder"},{name:"call",signature:"call(fn, at?): TimelineBuilder"},{name:"cue",signature:"cue(at, name, data?): TimelineBuilder"},{name:"adBreak",signature:"adBreak(at, opts?: { id?, duration? }): TimelineBuilder"},{name:"editable",signature:"editable(): TimelineBuilder"},{name:"editableDuration",signature:"editableDuration(): TimelineBuilder"}],Qa={"@glissade/core/clips":"motion clips: clip/clipList + the popIn/slideIn/pulse/driftLoop literals, presence (enter/exit) and morph (box-FLIP) build-time sugar.","@glissade/core/i18n":"localization: requireParity (id-set diff), localize (doc\u2192doc resolver), t() ambient-table sugar.","@glissade/scene/layout":"flexbox: the Yoga-backed Layout node + LayoutEngine (the only entry that ships Yoga wasm).","@glissade/scene/path":"SVG geometry: pathFromSvg / parseSvgPathData \u2014 parse an SVG `d` string into a PathValue for Path.data."};function Ja(){let e={};for(let[n,s]of Object.entries(Ua))e[n]=Li(s(),n);let t=Ga();for(let n of["Layout","Stack","Row","Column"])e[n]=t;return{version:qa,nodes:e,valueTypes:zt(),easings:Object.keys(rt),builder:{methods:Ka},createScene:"createScene({ size: { w, h }, children: Node[] }): Scene \u2014 media assets are declared on the Timeline document: timeline({ assets: { <id>: { kind: 'image'|'video', url } } }); an Image/Video node's `assetId` names an entry here.",subpaths:Qa}}function Ni(){let e=0,t=!1;return{start(n){t=!0;let s,r=i=>{t&&(s!=null||(s=i),n((i-s)/1e3),e=requestAnimationFrame(r))};e=requestAnimationFrame(r)},stop(){t=!1,cancelAnimationFrame(e)}}}function Za(e){var r;let t=(r=e.axis)!=null?r:"y",n=null,s=e.source;return{start(i,o){var c,u;let a=(u=e.range)!=null?u:[0,(c=o.duration)!=null?c:1],l=()=>{if(s instanceof Element){let m=t==="y"?s.scrollHeight-s.clientHeight:s.scrollWidth-s.clientWidth,p=t==="y"?s.scrollTop:s.scrollLeft;return m>0?p/m:0}let f=document.documentElement,h=t==="y"?f.scrollHeight-window.innerHeight:f.scrollWidth-window.innerWidth,d=t==="y"?window.scrollY:window.scrollX;return h>0?d/h:0};n=()=>{let f=Math.min(1,Math.max(0,l()));i(a[0]+f*(a[1]-a[0]))},s.addEventListener("scroll",n,{passive:!0}),n()},stop(){n&&s.removeEventListener("scroll",n),n=null}}}var Ri=class extends Error{constructor(e){super(`machine targets overlap an already-bound target set: ${e.join(", ")} \u2014 concurrent writers to one property is the silent last-writer-wins \xA72.2 exists to kill`),this.name="TargetOverlapError"}};function zi(e,t={}){var R,X,ee,Re,ze,Ze,V;let{playhead:n}=e,s=e.duration,r=(R=e.markers)!=null?R:[],i=(X=e.driver)!=null?X:Ni(),o=(ee=t.loop)!=null?ee:!1,a=(Re=t.background)!=null?Re:"pause",l=(ze=e.visibility)!=null?ze:(()=>"visible"),c=new Map,u=new Map,f=(Ze=t.rate)!=null?Ze:1,h=!1,d=A(!1),m=O=>{h=O,d.set(O)},p=!1,k=new Set((V=e.targets)!=null?V:[]),b=[],g=0,y=null,v=0,M=[0,s],I=0,w=null;function S(O,P){var q,Y,te;if(O===P||c.size===0&&u.size===0)return;let F=P>O;for(let oe of r){if(!(F?oe.t>O&&oe.t<=P:oe.t>=P&&oe.t<O))continue;for(let vn of(q=c.get(oe.name))!=null?q:[])vn(oe);let Ce=(Y=oe.data)==null?void 0:Y.kind;if(typeof Ce=="string")for(let vn of(te=u.get(Ce))!=null?te:[])vn(oe)}}function T(O){m(!1),y=null;let P=w;w=null,P==null||P(O)}function C(O){v=O;for(let Ce of b)Ce.step(O);if(!h)return;if(a==="pause"&&l()==="hidden"){g=n.peek(),y=null;return}y!=null||(y=O);let P=n.peek(),F=g+(O-y)*f,[q,Y]=M;if(!(f>=0?F>=Y:F<=q)){n.set(F),S(P,F);return}let te=o===!0?{mode:"restart"}:o===!1?null:o,oe=te&&"count"in te&&te.count!==void 0?te.count:1/0;if(!te||I+1>=oe){let Ce=f>=0?Y:q;n.set(Ce),S(P,Ce),T(!0);return}I++,Y-q,te.mode==="alternate"?(S(P,f>=0?Y:q),f=-f,g=f>=0?q:Y):(S(P,f>=0?Y:q),g=f>=0?q:Y),y=O,F=g,n.set(F)}function N(){p||(p=!0,i.start(C,{duration:s,visibility:l}))}return{playhead:n,get duration(){return s},get playing(){return h},playingSignal:d,get rate(){return f},set rate(O){g=n.peek(),y=h?v:null,f=O},play(O){var Y;w&&T(!1),M=(Y=O==null?void 0:O.range)!=null?Y:[0,s];let P=n.peek(),[F,q]=M;return g=f>=0?P>=q||P<F?F:P:P<=F||P>q?q:P,n.set(g),y=null,I=0,m(!0),N(),{finished:new Promise(te=>{w=te})}},pause(){h&&(g=n.peek(),T(!1))},seek(O){g=Math.min(Math.max(O,0),s),y=h?v:null,n.set(g)},swap(O){var F,q;s=O.duration,r=(F=O.markers)!=null?F:[],k=new Set((q=O.targets)!=null?q:[]);let P=Math.min(n.peek(),s);M=[0,s],g=P,y=h?v:null,I=0,n.set(P)},attach(O){if(O.targets){let P=[];for(let F of O.targets)k.has(F)?P.push(`'${F}' (player timeline)`):b.some(q=>{var Y;return(Y=q.targets)==null?void 0:Y.has(F)})&&P.push(`'${F}' (another machine)`);if(P.length>0)throw new Ri(P)}return b.push(O),N(),()=>{let P=b.indexOf(O);P>=0&&b.splice(P,1)}},onMarker(O,P){let F=c.get(O);return F||(F=new Set,c.set(O,F)),F.add(P),()=>F.delete(P)},onCue(O,P){let F=u.get(O);return F||(F=new Set,u.set(O,F)),F.add(P),()=>F.delete(P)},dispose(){h&&T(!1),b.length=0,p&&i.stop(),p=!1}}}function Vi(e,t,n,s,r){var o;let i=e!=null?e:"respect";return i==="ignore"||!t?{autoplay:r}:typeof i=="function"?{autoplay:r,swapTo:i(n)}:{autoplay:!1,seekTo:(o=n.posterTime)!=null?o:s}}function Bi(){return typeof matchMedia!="undefined"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function Rs(e,t,n,s={}){var b;let r=e,i=t,o=se(i),a=new yn(n);r.setTextMeasurer(a);let l=r.playhead,c=zi({playhead:l,duration:o.duration,markers:o.markers,targets:o.tracks.keys()},s),u=()=>a.render(kt(r,i,l.peek())),f=!1,h=()=>{f||(f=!0,requestAnimationFrame(()=>{f=!1,u()}))},d=l.subscribe(h),m=g=>{if(typeof FontFace=="undefined")return;let y=ht(g.assets);for(let v of y.faces()){let M=new FontFace(v.family,`url(${v.url})`,{weight:String(v.weight),style:v.style});document.fonts.add(M),M.load().then(()=>u(),()=>{})}Os(r,g,async v=>{try{let M=await fetch(v);return M.ok?await M.arrayBuffer():void 0}catch(M){return}},E({mode:s.strictFonts?"strict":"dev"},s.osFonts!==void 0?{osFamilies:s.osFonts}:{}))};m(i);let p=((b=s.prefersReducedMotion)!=null?b:Bi)(),k=Vi(s.reducedMotion,p,i,o.duration,!!s.autoplay);if(k.swapTo){i=k.swapTo;let g=se(i);c.swap({duration:g.duration,markers:g.markers,targets:g.tracks.keys()}),m(i)}return k.seekTo!==void 0&&c.seek(k.seekTo),u(),k.autoplay&&c.play(),{player:c,backend:a,render:u,swap(g){g.scene&&(r=g.scene,r.setTextMeasurer(a)),i=g.timeline;let y=se(i);c.swap({duration:y.duration,markers:y.markers,targets:y.tracks.keys()}),m(i),u()},dispose(){d(),c.dispose(),a.dispose()}}}function ec(e,t,n){let s=Object.keys(se(t).labels);return r=>{if(r==null)return;let i=n(r),o=Object.keys(se(i.timeline).labels),a=s.filter(l=>!o.includes(l));a.length>0&&console.warn(`[glissade] HMR: this edit removed label(s) ${a.map(l=>`'${l}'`).join(", ")} \u2014 anything seeking to them will no longer resolve`),s=o,e.swap(i)}}var tc=`
|
|
4
4
|
<style>
|
|
5
5
|
:host { display: inline-block; }
|
|
6
6
|
canvas { display: block; width: 100%; height: auto; }
|
|
@@ -10,5 +10,5 @@
|
|
|
10
10
|
.time { font-variant-numeric: tabular-nums; opacity: 0.75; min-width: 9ch; text-align: right; }
|
|
11
11
|
</style>
|
|
12
12
|
<canvas part="canvas"></canvas>
|
|
13
|
-
`,
|
|
13
|
+
`,zs,ie,be,he,Je,$e,Mt,Ne,Z,z,Vs,Bs,_i,Wi,qs,bn,kn,Qe,qi=(zs=class extends HTMLElement{constructor(){super();U(this,z);U(this,ie,null);U(this,be,null);U(this,he,null);U(this,Je,!1);U(this,$e,null);U(this,Mt);U(this,Ne);U(this,Z,null);let t=this.attachShadow({mode:"open"});t.innerHTML=tc,H(this,Mt,t),H(this,Ne,t.querySelector("canvas"))}get scene(){return D(this,be)}set scene(t){H(this,be,t),B(this,z,bn).call(this)}get player(){var t,n;return(n=(t=D(this,ie))==null?void 0:t.player)!=null?n:null}connectedCallback(){B(this,z,Bs).call(this),B(this,z,bn).call(this)}disconnectedCallback(){B(this,z,qs).call(this)}attributeChangedCallback(t){if(t==="controls"){B(this,z,Bs).call(this),B(this,z,Vs).call(this);return}this.isConnected&&D(this,be)&&B(this,z,bn).call(this)}},ie=new WeakMap,be=new WeakMap,he=new WeakMap,Je=new WeakMap,$e=new WeakMap,Mt=new WeakMap,Ne=new WeakMap,Z=new WeakMap,z=new WeakSet,Vs=function(){D(this,Z)&&!D(this,he)&&D(this,$e)?(H(this,he,D(this,$e).subscribe(()=>{requestAnimationFrame(()=>{D(this,Z)&&(B(this,z,kn).call(this),B(this,z,Qe).call(this))})})),B(this,z,kn).call(this),B(this,z,Qe).call(this)):!D(this,Z)&&D(this,he)&&(D(this,he).call(this),H(this,he,null))},Bs=function(){let t=this.hasAttribute("controls");t&&!D(this,Z)?B(this,z,_i).call(this):!t&&D(this,Z)&&B(this,z,Wi).call(this)},_i=function(){let t=document.createElement("div");t.className="controls",t.setAttribute("part","controls");let n=document.createElement("button");n.setAttribute("part","button"),n.setAttribute("aria-label","Play or pause"),n.textContent="Play";let s=document.createElement("input");s.setAttribute("part","scrubber"),s.type="range",s.min="0",s.max="1",s.step="0.0001",s.value="0",s.setAttribute("aria-label","Seek");let r=document.createElement("span");r.className="time",r.setAttribute("part","time");let i=()=>{var l;let a=(l=D(this,ie))==null?void 0:l.player;a&&(a.playing?a.pause():a.play(),B(this,z,Qe).call(this))},o=()=>{var l;let a=(l=D(this,ie))==null?void 0:l.player;a&&(H(this,Je,!0),a.pause(),a.seek(parseFloat(s.value)*a.duration),H(this,Je,!1),B(this,z,Qe).call(this))};n.addEventListener("click",i),s.addEventListener("input",o),t.append(n,s,r),D(this,Mt).append(t),H(this,Z,{root:t,button:n,scrubber:s,time:r,onClick:i,onInput:o}),B(this,z,kn).call(this),B(this,z,Qe).call(this)},Wi=function(){let t=D(this,Z);t&&(t.button.removeEventListener("click",t.onClick),t.scrubber.removeEventListener("input",t.onInput),t.root.remove(),H(this,Z,null))},qs=function(){var t,n;(t=D(this,he))==null||t.call(this),H(this,he,null),(n=D(this,ie))==null||n.dispose(),H(this,ie,null),H(this,$e,null)},bn=function(){if(B(this,z,qs).call(this),!D(this,be)||!this.isConnected)return;let t=D(this,be).createScene();D(this,Ne).width=t.size.w,D(this,Ne).height=t.size.h;let n=this.hasAttribute("pingpong")||this.hasAttribute("yoyo")?{mode:"alternate"}:this.hasAttribute("loop");H(this,ie,Rs(t,D(this,be).timeline,D(this,Ne),{loop:n,autoplay:this.hasAttribute("autoplay")})),H(this,$e,t.playhead),B(this,z,Vs).call(this)},kn=function(){var r,i,o;let t=D(this,Z),n=(r=D(this,ie))==null?void 0:r.player;if(!t||!n)return;let s=(o=(i=D(this,$e))==null?void 0:i.peek())!=null?o:0;t.time.textContent=`${s.toFixed(2)} / ${n.duration.toFixed(2)}s`,!D(this,Je)&&n.duration>0&&(t.scrubber.value=String(s/n.duration))},Qe=function(){var s,r;let t=D(this,Z);if(!t)return;let n=(r=(s=D(this,ie))==null?void 0:s.player.playing)!=null?r:!1;t.button.textContent=n?"Pause":"Play"},x(zs,"observedAttributes",["loop","pingpong","yoyo","autoplay","controls"]),zs);function ji(e="gs-player"){customElements.get(e)||customElements.define(e,qi)}ji();return Qi(nc);})();
|
|
14
14
|
//# sourceMappingURL=glissade.browser.js.map
|