PageSourceSearch

https://motioncanvas.io/assets/js/9106.c4c76028.js

js motioncanvas.io collected 2026-10-04 00:28:22 UTC 119,427 bytes, 11 lines download raw bytes

1var _____WB$wombat$assign$function_____=function(name){return (globalThis._wb_wombat && globalThis._wb_wombat.local_init && globalThis._wb_wombat.local_init(name))||globalThis[name];};if(!globalThis.__WB_pmw){globalThis.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{
2let window = _____WB$wombat$assign$function_____("window");
3let self = _____WB$wombat$assign$function_____("self");
4let document = _____WB$wombat$assign$function_____("document");
5let location = _____WB$wombat$assign$function_____("location");
6let top = _____WB$wombat$assign$function_____("top");
7let parent = _____WB$wombat$assign$function_____("parent");
8let frames = _____WB$wombat$assign$function_____("frames");
9let opener = _____WB$wombat$assign$function_____("opener");
10/*! For license information please see 9106.c4c76028.js.LICENSE.txt */
11"use strict";(self.webpackChunk_motion_canvas_docs=self.webpackChunk_motion_canvas_docs||[]).push([[9106],{9106:(t,e,r)=>{var s,i;r.r(e),function(t){t.Error="error",t.Warn="warn",t.Info="info",t.Http="http",t.Verbose="verbose",t.Debug="debug",t.Silly="silly"}(s||(s={}));class n{constructor(){this.subscribable=new a(this),this.subscribers=new Set}subscribe(t){return this.subscribers.add(t),()=>this.unsubscribe(t)}unsubscribe(t){this.subscribers.delete(t)}clear(){this.subscribers.clear()}notifySubscribers(t){return[...this.subscribers].map((e=>e(t)))}}class a{constructor(t){this.dispatcher=t}subscribe(t){return this.dispatcher.subscribe(t)}unsubscribe(t){this.dispatcher.unsubscribe(t)}}class o extends n{set current(t){this.value=t,this.notifySubscribers(t)}get current(){return this.value}constructor(t){super(),this.value=t,this.subscribable=new l(this)}subscribe(t,e){void 0===e&&(e=!0);const r=super.subscribe(t);return e&&t(this.value),r}}class l extends a{get current(){return this.dispatcher.current}subscribe(t,e){return void 0===e&&(e=!0),this.dispatcher.subscribe(t,e)}}!function(t){t[t.Playing=0]="Playing",t[t.Rendering=1]="Rendering",t[t.Paused=2]="Paused",t[t.Presenting=3]="Presenting"}(i||(i={}));class h{constructor(){this.frame=0,this.speed=1,this.fps=30,this.duration=0,this.finished=!1,this.slides=[],this.previousScene=null,this.state=i.Paused,this.currentSceneReference=null,this.scenes=new o([])}get onSceneChanged(){if(null===this.currentSceneReference)throw new Error("PlaybackManager has not been properly initialized");return this.currentSceneReference.subscribable}get onScenesRecalculated(){return this.scenes.subscribable}get currentScene(){if(null===this.currentSceneReference)throw new Error("PlaybackManager has not been properly initialized");return this.currentSceneReference.current}set currentScene(t){if(!t)throw new Error("Invalid scene.");this.currentSceneReference??(this.currentSceneReference=new o(t)),this.currentSceneReference.current=t}setup(t){this.scenes.current=t,this.currentScene=t[0]}async progress(){return this.finished=await this.next(),this.finished}async seek(t){if(t<=this.frame||this.currentScene.isCached()&&this.currentScene.lastFrame<t){const e=this.findBestScene(t);e!==this.currentScene?(this.previousScene=null,this.currentScene=e,this.frame=this.currentScene.firstFrame,await this.currentScene.reset()):this.frame>=t&&(this.previousScene=null,this.frame=this.currentScene.firstFrame,await this.currentScene.reset())}for(this.finished=!1;this.frame<t&&!this.finished;)this.finished=await this.next();return this.finished}async goBack(){let t=this.currentScene.slides.getCurrent();if(t&&this.currentScene.slides.isWaiting()){const e=this.slides.indexOf(t);t=this.slides[e-1]}await this.seekSlide(t)}async goForward(){const t=this.currentScene.slides.getCurrent(),e=this.slides.indexOf(t);await this.seekSlide(this.slides[e+1])}async goTo(t){await this.seekSlide(this.slides.find((e=>e.id===t)))}async seekSlide(t){if(void 0===t&&(t=null),!t)return;const{id:e,scene:r}=t;for((this.currentScene!==r||this.currentScene.slides.didHappen(e))&&(this.previousScene=null,this.currentScene=r,this.frame=this.currentScene.firstFrame,this.currentScene.slides.setTarget(e),await this.currentScene.reset()),this.finished=!1,this.currentScene.slides.setTarget(e);!this.currentScene.slides.isWaitingFor(e)&&!this.finished;)this.finished=await this.next();return this.currentScene.slides.setTarget(null),this.finished}async reset(){this.previousScene=null,this.currentScene=this.scenes.current[0],this.frame=0,await this.currentScene.reset()}reload(t){this.scenes.current.forEach((e=>e.reload(t)))}async recalculate(){this.previousScene=null,this.slides=[];const t=this.speed;this.frame=0,this.speed=1;const e=[];try{for(const t of this.scenes.current)await t.recalculate((t=>{this.frame=t})),this.slides.push(...t.slides.onChanged.current),e.push(t)}finally{this.speed=t}this.scenes.current=e,this.duration=this.frame}async next(){if(this.previousScene&&(await this.previousScene.next(),this.currentScene.isFinished()&&(this.previousScene=null)),this.frame+=this.speed,this.currentScene.isFinished())return!0;
11if(await this.currentScene.next(),this.previousScene&&this.currentScene.isAfterTransitionIn()&&(this.previousScene=null),this.currentScene.canTransitionOut()){this.previousScene=this.currentScene;const t=this.getNextScene(this.previousScene);t&&(this.currentScene=t,await this.currentScene.reset(this.previousScene)),t&&!this.currentScene.isAfterTransitionIn()||(this.previousScene=null)}return this.currentScene.isFinished()}findBestScene(t){let e=this.scenes.current[0];for(const r of this.scenes.current){if(!r.isCached()||r.lastFrame>t)return r;e=r}return e}getNextScene(t){const e=this.scenes.current;if(!t)return e[0];const r=e.findIndex((e=>e===t));return r<0?null:e[r+1]??null}}const u=[];function c(){const t=u.at(-1);if(!t)throw new f("The thread is not available in the current context.","<p><code>useThread()</code> can only be called from within generator functions.\n      It&#39;s not available during rendering.</p>\n");return t}class f extends Error{constructor(t,e){super(t),this.remarks=e}}function d(t,e){void 0===e&&(e=document.createElement("canvas"));const r=e.getContext("2d",t);if(!r)throw new Error("Could not create a 2D context.");return r}class v{constructor(){this.resolveCurrent=null,this.current=null}async acquire(){for(;this.current;)await this.current;this.current=new Promise((t=>{this.resolveCurrent=t}))}release(){var t;this.current=null,null==(t=this.resolveCurrent)||t.call(this),this.resolveCurrent=null}}const p=[];function g(){const t=p.at(-1);if(!t)throw new Error("The playback is not available in the current context.");return t}function b(t){const e={[t.name]:t},r=Object.getOwnPropertyDescriptor(e,t.name);if(r){for(var s=arguments.length,i=new Array(s>1?s-1:0),n=1;n<s;n++)i[n-1]=arguments[n];for(let s=i.length-1;s>=0;s--)i[s](e,t.name,r)}}function y(t){return function(e,r,s){s.value.prototype.name=t??r,s.value.prototype.threadable=!0}}function*m(t){let e=!0;for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];"boolean"==typeof t?e=t:s.push(t);const n=c(),a=s.map((t=>n.children.find((e=>e.runner===t)))).filter((t=>t)),o=n.time();let l;if(e){for(;a.find((t=>!t.canceled));)yield;l=Math.max(...a.map((t=>t.time())))}else{for(;!a.find((t=>t.canceled));)yield;const t=a.filter((t=>t.canceled));l=Math.min(...t.map((t=>t.time())))}n.time(Math.max(o,l))}function w(t,e){const r=Object.getPrototypeOf(t);r.threadable||(r.threadable=!0,r.name="string"==typeof e?e:function(t){return Object.getPrototypeOf(t).name??null}(e))}b(m,y());var k,x,S,M=r(5392);M.Color.symbol=M.Color.prototype.symbol=Symbol.for("@motion-canvas/core/types/Color"),M.Color.lerp=M.Color.prototype.lerp=function(t,e,r,s){void 0===s&&(s="lch"),"string"==typeof t&&(t=new M.Color(t)),"string"==typeof e&&(e=new M.Color(e));const i=t instanceof M.Color,n=e instanceof M.Color;return i||(t=n?e.alpha(0):new M.Color("rgba(0, 0, 0, 0)")),n||(e=i?t.alpha(0):new M.Color("rgba(0, 0, 0, 0)")),(0,M.mix)(t,e,r,s)},M.Color.createLerp=M.Color.prototype.createLerp=t=>(e,r,s)=>M.Color.lerp(e,r,s,t),M.Color.createSignal=function(t,e){void 0===e&&(e=M.Color.lerp);const r=new Z(t,e);return r.setParser((t=>new M.Color(t))),r.toSignal()},M.Color.prototype.toSymbol=()=>M.Color.symbol,M.Color.prototype.serialize=function(){return this.css()},M.Color.prototype.lerp=function(t,e,r){return M.Color.lerp(this,t,e,r)},function(t){t[t.Vertical=1]="Vertical",t[t.Horizontal=2]="Horizontal"}(k||(k={})),function(t){t[t.Top=4]="Top",t[t.Bottom=8]="Bottom",t[t.Left=16]="Left",t[t.Right=32]="Right"}(x||(x={})),function(t){t[t.Middle=3]="Middle",t[t.Top=5]="Top",t[t.Bottom=9]="Bottom",t[t.Left=18]="Left",t[t.Right=34]="Right",t[t.TopLeft=20]="TopLeft",t[t.TopRight=36]="TopRight",t[t.BottomLeft=24]="BottomLeft",t[t.BottomRight=40]="BottomRight"}(S||(S={}));class C{static createSignal(t,e,r){return void 0===e&&(e=C.lerp),new H(["x","y"],(t=>new C(t)),t,e,r).toSignal()}static lerp(t,e,r){let s,i;return"number"==typeof r?s=i=r:(s=r.x,i=r.y),new C(I(t.x,e.x,s),I(t.y,e.y,i))}static arcLerp(t,e,r,s,i){return void 0===s&&(s=!1),i??(i=t.sub(e).ctg),C.lerp(t,e,N(r,s,i))}static fromOrigin(t){const e=new C;return t===S.Middle||(t&x.Left?e.x=-1:t&x.Right&&(e.x=1),t&x.Top?e.y=-1:t&x.Bottom&&(e.y=1)),e}static fromScalar(t){return new C(t,t)}static fromRadians(t){return new C(Math.cos(t),Math.sin(t))}static magnitude(t,e){return Math.sqrt(t*t+e*e)}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}get magnitude(){return C.magnitude(this.x,this.y)}get normalized(){return this.scale(1/C.magnitude(this.x,this.y))}get safe(){return new C(isNaN(this.x)?0:this.x,isNaN(this.y)?0:this.y)}get flipped(){return new C(-this.x,-this.y)}get floored(){return new C(Math.floor(this.x),Math.floor(this.y))}get perpendicular(){return new C(this.y,-this.x)}get radians(){return Math.atan2(this.y,this.x)}get ctg(){return this.x/this.y}constructor(t,e){if(this.x=0,this.y=0,null!=t){if("object"!=typeof t)return this.x=t,void(this.y=e??t);if(Array.isArray(t))return this.x=t[0],void(this.y=t[1]);if("width"in t)return this.x=t.width,void(this.y=t.height);this.x=t.x,this.y=t.y}}lerp(t,e){return C.lerp(this,t,e)}getOriginOffset(t){const e=C.fromOrigin(t);return e.x*=this.x/2,e.y*=this.y/2,e}scale(t){return new C(this.x*t,this.y*t)}transformAsPoint(t){return new C(this.x*t.m11+this.y*t.m21+t.m41,this.x*t.m12+this.y*t.m22+t.m42)}transform(t){return new C(this.x*t.m11+this.y*t.m21,this.x*t.m12+this.y*t.m22)}mul(t){const e=new C(t);return new C(this.x*e.x,this.y*e.y)}div(t){const e=new C(t);return new C(this.x/e.x,this.y/e.y)}add(t){const e=new C(t);return new C(this.x+e.x,this.y+e.y)}sub(t){const e=new C(t);return new C(this.x-e.x,this.y-e.y)}dot(t){const e=new C(t);return this.x*e.x+this.y*e.y}addX(t){return new C(this.x+t,this.y)}addY(t){return new C(this.x,this.y+t)}toSymbol(){return C.symbol}serialize(){return{x:this.x,y:this.y}}exactlyEquals(t){return this.x===t.x&&this.y===t.y}}C.symbol=Symbol.for("@motion-canvas/core/types/Vector2"),C.zero=new C,C.one=new C(1,1),C.right=new C(1,0),C.left=new C(-1,0),C.up=new C(0,1),C.down=new C(0,-1);class T{static fromRotation(t){return T.identity.rotate(t)}static fromTranslation(t){return T.identity.translate(new C(t))}static fromScaling(t){return T.identity.scale(new C(t))}get x(){return new C(this.values[0],this.values[1])}get y(){return new C(this.values[2],this.values[3])}get scaleX(){return this.values[0]}set scaleX(t){this.values[0]=this.x.normalized.scale(t).x}set scaleY(t){this.values[3]=this.y.normalized.scale(t).y}get scaleY(){return this.values[3]}set translateX(t){this.values[4]=t}get translateX(){return this.values[4]}set translateY(t){this.values[5]=t}get translateY(){return this.values[5]}set rotation(t){const e=this.rotate(t-this.rotation);this.values[0]=e.values[0],this.values[1]=e.values[1],this.values[2]=e.values[2],this.values[3]=e.values[3]}get rotation(){return 180*Math.atan2(this.values[1],this.values[0])/Math.PI}set translation(t){const e=new C(t);this.values[4]=e.x,this.values[5]=e.y}get translation(){return new C(this.values[4],this.values[5])}set scaling(t){const e=new C(t),r=new C(this.values[0],this.values[1]).normalized,s=new C(this.values[2],this.values[3]).normalized;this.values[0]=r.x*e.x,this.values[1]=r.y*e.y,this.values[2]=s.x*e.x,this.values[3]=s.y*e.y}get scaling(){return new C(this.values[0],this.values[3])}get inverse(){const t=this.values[0],e=this.values[1],r=this.values[2],s=this.values[3],i=this.values[4],n=this.values[5];let a=t*s-e*r;return a?(a=1/a,new T(s*a,-e*a,-r*a,t*a,(r*n-s*i)*a,(e*i-t*n)*a)):null}get determinant(){return this.values[0]*this.values[3]-this.values[1]*this.values[2]}get domMatrix(){return new DOMMatrix([this.values[0],this.values[1],this.values[2],this.values[3],this.values[4],this.values[5]])}constructor(t,e,r,s,i,n){if(this.values=new Float32Array(6),0===arguments.length)return void(this.values=new Float32Array([1,0,0,1,0,0]));if(6===arguments.length)return this.values[0]=t,this.values[1]=e,this.values[2]=r,this.values[3]=s,this.values[4]=i,void(this.values[5]=n);if(t instanceof T)return void(this.values=t.values);if(Array.isArray(t)){if(2===t.length)return this.values[0]=t[0],this.values[1]=t[1],this.values[2]=e[0],this.values[3]=e[1],this.values[4]=r[0],void(this.values[5]=r[1]);if(3===t.length){const e=new C(t[0]),r=new C(t[1]),s=new C(t[2]);return this.values[0]=e.x,this.values[1]=e.y,this.values[2]=r.x,this.values[3]=r.y,this.values[4]=s.x,void(this.values[5]=s.y)}return this.values[0]=t[0],this.values[1]=t[1],this.values[2]=t[2],this.values[3]=t[3],this.values[4]=t[4],void(this.values[5]=t[5])}const a=new C(t),o=new C(e),l=new C(r);this.values[0]=a.x,this.values[1]=a.y,this.values[2]=o.x,this.values[3]=o.y,this.values[4]=l.x,this.values[5]=l.y}column(t){return new C(this.values[2*t],this.values[2*t+1])}row(t){return[this.values[t],this.values[t+2],this.values[t+4]]}mul(t){const e=this.values[0],r=this.values[1],s=this.values[2],i=this.values[3],n=this.values[4],a=this.values[5],o=t.values[0],l=t.values[1],h=t.values[2],u=t.values[3],c=t.values[4],f=t.values[5];return new T(e*o+s*l,r*o+i*l,e*h+s*u,r*h+i*u,e*c+s*f+n,r*c+i*f+a)}rotate(t,e){void 0===e&&(e=!0),e&&(t=t*Math.PI/180);const r=this.values[0],s=this.values[1],i=this.values[2],n=this.values[3],a=this.values[4],o=this.values[5],l=Math.sin(t),h=Math.cos(t);return new T(r*h+i*l,s*h+n*l,r*-l+i*h,s*-l+n*h,a,o)}scale(t){const e=new C(t);return new T(this.values[0]*e.x,this.values[1]*e.x,this.values[2]*e.y,this.values[3]*e.y,this.values[4],this.values[5])}mulScalar(t){return new T(this.values[0]*t,this.values[1]*t,this.values[2]*t,this.values[3]*t,this.values[4]*t,this.values[5]*t)}translate(t){const e=new C(t);return new T(this.values[0],this.values[1],this.values[2],this.values[3],this.values[0]*e.x+this.values[2]*e.y+this.values[4],this.values[1]*e.x+this.values[3]*e.y+this.values[5])}add(t){return new T(this.values[0]+t.values[0],this.values[1]+t.values[1],this.values[2]+t.values[2],this.values[3]+t.values[3],this.values[4]+t.values[4],this.values[5]+t.values[5])}sub(t){return new T(this.values[0]-t.values[0],this.values[1]-t.values[1],this.values[2]-t.values[2],this.values[3]-t.values[3],this.values[4]-t.values[4],this.values[5]-t.values[5])}equals(t,e){return void 0===e&&(e=1e-6),Math.abs(this.values[0]-t.values[0])<=e&&Math.abs(this.values[1]-t.values[1])<=e&&Math.abs(this.values[2]-t.values[2])<=e&&Math.abs(this.values[3]-t.values[3])<=e&&Math.abs(this.values[4]-t.values[4])<=e&&Math.abs(this.values[5]-t.values[5])<=e}exactlyEquals(t){return this.values[0]===t.values[0]&&this.values[1]===t.values[1]&&this.values[2]===t.values[2]&&this.values[3]===t.values[3]&&this.values[4]===t.values[4]&&this.values[5]===t.values[5]}}T.identity=new T(1,0,0,1,0,0),T.zero=new T(0,0,0,0,0,0);class A{static createSignal(t,e){return void 0===e&&(e=A.lerp),new H(["x","y","width","height"],(t=>new A(t)),t,e).toSignal()}static lerp(t,e,r){let s,i,n,a;return"number"==typeof r?s=i=n=a=r:r instanceof C?(s=n=r.x,i=a=r.y
11):(s=r.x,i=r.y,n=r.width,a=r.height),new A(I(t.x,e.x,s),I(t.y,e.y,i),I(t.width,e.width,n),I(t.height,e.height,a))}static arcLerp(t,e,r,s,i){return void 0===s&&(s=!1),i??(i=(t.position.sub(e.position).ctg+t.size.sub(e.size).ctg)/2),A.lerp(t,e,N(r,s,i))}static fromSizeCentered(t){return new A(-t.width/2,-t.height/2,t.width,t.height)}static fromPoints(){let t=1/0,e=1/0,r=-1/0,s=-1/0;for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];for(const o of n)o.x>r&&(r=o.x),o.x<t&&(t=o.x),o.y>s&&(s=o.y),o.y<e&&(e=o.y);return new A(t,e,r-t,s-e)}static fromBBoxes(){let t=1/0,e=1/0,r=-1/0,s=-1/0;for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];for(const o of n){const i=o.x+o.width;i>r&&(r=i),o.x<t&&(t=o.x);const n=o.y+o.height;n>s&&(s=n),o.y<e&&(e=o.y)}return new A(t,e,r-t,s-e)}lerp(t,e){return A.lerp(this,t,e)}get position(){return new C(this.x,this.y)}set position(t){this.x=t.x,this.y=t.y}get size(){return new C(this.width,this.height)}get center(){return new C(this.x+this.width/2,this.y+this.height/2)}get left(){return this.x}set left(t){this.width+=this.x-t,this.x=t}get right(){return this.x+this.width}set right(t){this.width=t-this.x}get top(){return this.y}set top(t){this.height+=this.y-t,this.y=t}get bottom(){return this.y+this.height}set bottom(t){this.height=t-this.y}get topLeft(){return this.position}get topRight(){return new C(this.x+this.width,this.y)}get bottomLeft(){return new C(this.x,this.y+this.height)}get bottomRight(){return new C(this.x+this.width,this.y+this.height)}get corners(){return[this.topLeft,this.topRight,this.bottomRight,this.bottomLeft]}get pixelPerfect(){return new A(Math.floor(this.x),Math.floor(this.y),Math.ceil(this.width+1),Math.ceil(this.height+1))}constructor(t,e,r,s){if(void 0===e&&(e=0),void 0===r&&(r=0),void 0===s&&(s=0),this.x=0,this.y=0,this.width=0,this.height=0,null!=t){if("number"==typeof t)return this.x=t,this.y=e,this.width=r,void(this.height=s);if(t instanceof C)return this.x=t.x,this.y=t.y,void(e instanceof C&&(this.width=e.x,this.height=e.y));if(Array.isArray(t))return this.x=t[0],this.y=t[1],this.width=t[2],void(this.height=t[3]);this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height}}transform(t){return new A(this.position.transformAsPoint(t),this.size.transform(t))}transformCorners(t){return this.corners.map((e=>e.transformAsPoint(t)))}expand(t){return new A(this.x-t,this.y-t,this.width+2*t,this.height+2*t)}addSpacing(t){const e=new A(this);return e.left-=t.left,e.top-=t.top,e.right+=t.right,e.bottom+=t.bottom,e}includes(t){return t.x>=this.x&&t.x<=this.x+this.width&&t.y>=this.y&&t.y<=this.y+this.height}intersects(t){return this.left<t.right&&this.right>t.left&&this.top<t.bottom&&this.bottom>t.top}toSymbol(){return A.symbol}serialize(){return{x:this.x,y:this.y,width:this.width,height:this.height}}}A.symbol=Symbol.for("@motion-canvas/core/types/Rect");class R{static createSignal(t,e){return void 0===e&&(e=R.lerp),new H(["top","right","bottom","left"],(t=>new R(t)),t,e).toSignal()}static lerp(t,e,r){return new R(I(t.top,e.top,r),I(t.right,e.right,r),I(t.bottom,e.bottom,r),I(t.left,e.left,r))}get x(){return this.left+this.right}get y(){return this.top+this.bottom}constructor(t,e,r,s){if(void 0===t&&(t=0),this.top=0,this.right=0,this.bottom=0,this.left=0,null!=t){if(Array.isArray(t)&&(s=t[3],r=t[2],e=t[1],t=t[0]),"number"==typeof t)return this.top=t,this.right=void 0!==e?e:t,this.bottom=void 0!==r?r:t,void(this.left=void 0!==s?s:void 0!==e?e:t);this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}}lerp(t,e){return R.lerp(this,t,e)}scale(t){return new R(this.top*t,this.right*t,this.bottom*t,this.left*t)}addScalar(t){return new R(this.top+t,this.right+t,this.bottom+t,this.left+t)}toSymbol(){return R.symbol}serialize(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}}function P(t,e,r,s){if(void 0===s&&(s=!1),0===r)return t;if(1===r)return e;if(null!=t&&null!=e){if("number"==typeof t&&"number"==typeof e)return I(t,e,r);if("string"==typeof t&&"string"==typeof e)return function(t,e,r){if(e.length>=t.length){const s=Math.floor(e.length*r),i=Math.floor(I(t.length-1,e.length,r));let n="";for(let r=0;r<e.length;r++)r<s?n+=e[r]:(t[r]||r<=i)&&(n+=t[r]??e[r]);return n}{const s=Math.round(t.length*(1-r)),i=Math.floor(I(t.length+1,e.length,r)),n=[];for(let r=t.length-1;r>=0;r--)r<s?n.unshift(t[r]):(e[r]||r<i)&&n.unshift(e[r]??t[r]);return n.join("")}}(t,e,r);
11if("boolean"==typeof t&&"boolean"==typeof e)return r<.5?t:e;if("lerp"in t)return t.lerp(e,r);if(t&&e&&"object"==typeof t&&"object"==typeof e)if(Array.isArray(t)&&Array.isArray(e)){if(t.length===e.length)return t.map(((t,s)=>P(t,e[s],r)))}else{let s=!1;if(t instanceof Map||e instanceof Map||(s=!0,t=new Map(Object.entries(t)),e=new Map(Object.entries(e))),t instanceof Map&&e instanceof Map){const i=new Map;for(const s of new Set([...t.keys(),...e.keys()])){const n=P(t.get(s),e.get(s),r,!0);void 0!==n&&i.set(s,n)}return s?Object.fromEntries(i):i}}return e}s||Q().warn(`Attempting to lerp ${t} -> ${e} may result in unexpected behavior.`)}function I(t,e,r){return t+(e-t)*r}function E(t,e,r){return r<t?t:r>e?e:r}function N(t,e,r){let s=e;r>1?r=1/r:s=!s;const i=I(s?Math.acos(E(-1,1,1-t)):Math.asin(t),I(0,Math.PI/2,t),r);let n=Math.sin(i),a=1-Math.cos(i);return e&&([n,a]=[a,n]),new C(n,a)}function L(t,e,r){return void 0===e&&(e=0),void 0===r&&(r=1),I(e,r,t=t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2)}function D(t,e){return void 0===t&&(t=7.5625),void 0===e&&(e=2.75),function(r,s,i){return void 0===s&&(s=0),void 0===i&&(i=1),r<1/e?r*=t*r:r=r<2/e?t*(r-=1.505/e)*r+.75:r<2.5/e?t*(r-=2.25/e)*r+.9375:t*(r-=2.625/e)*r+.984375,I(s,i,r)}}R.symbol=Symbol.for("@motion-canvas/core/types/Spacing");void 0===O&&(O=1.70158);var O;(function(t){void 0===t&&(t=1.70158)})(),function(t,e){void 0===t&&(t=1.70158),void 0===e&&(e=1.525)}(),function(t,e){void 0===t&&(t=7.5625),void 0===e&&(e=2.75);const r=D(t,e)}(),D(),function(t,e){void 0===t&&(t=7.5625),void 0===e&&(e=2.75);const r=D(t,e)}(),function(t){void 0===t&&(t=2.094395)}(),function(t){void 0===t&&(t=2.094395)}(),function(t){void 0===t&&(t=1.39626)}();function*j(t,e,r){const s=c(),i=s.time(),n=s.time()+t;for(e(0,0);n>s.fixed;){const r=s.fixed-i;r>0&&e(r/t,r),yield}s.time(n),e(1,t),null==r||r(1,t)}function F(t,e,r,s){return{mass:t,stiffness:e,damping:r,initialVelocity:s}}b(j,y()),b((function*(t,e,r,s,i,n){const a="number"==typeof s?s:.001;n="number"==typeof s?n:i;const o=(t,e)=>{"function"==typeof s?s(t,e):"function"==typeof i&&i(t,e)};if(t=t??{mass:.05,stiffness:10,damping:.5},t.mass<=0)return void Q().error(new Error("Spring mass must be greater than 0."));if(t.stiffness<0)return void Q().error(new Error("Spring stiffness must be greater or equal to 0."));if(t.damping<0)return void Q().error(new Error("Spring damping must be greater or equal to 0."));const l=c();let h=e,u=t.initialVelocity??0;const f=e=>{if(null===t)return;const s=h-r,i=-t.stiffness*s-t.damping*u;u+=i/t.mass*e,h+=u*e},d=1/120;o(e,0);const v=l.time();let p=v,g=!1;for(;!g;){for(;p<l.fixed;){const t=l.fixed-p;if(d>t?(f(t),p=l.fixed):(f(d),p+=d),Math.abs(r-h)<a&&Math.abs(u)<a){l.time(p),g=!0;break}}g||(o(h,l.fixed-v),yield)}o(r,l.fixed-v),null==n||n(r,l.fixed-v)}),y());F(.13,5.7,1.2,10),F(.2,20,.68,0),F(.08,4.75,.05,0),F(.39,19.85,2.82,0),F(.04,10,.7,8),F(.03,20,.9,4.8),F(.16,15.35,1.88,0);function*z(t,e){void 0===t&&(t=0);const r=c(),s=g().framesToSeconds(1),i=r.time()+t;for(;i-s>r.fixed;)yield;r.time(i),e&&(yield*e)}b((function*(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];for(const s of e)yield s;yield*m(...e)}),y()),b((function*(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];for(const s of e)yield s;yield*m(!1,...e)}),y()),b((function*(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];for(const s of e)Y(s)?yield*s:s()}),y()),b((function*(t,e){yield*z(function(t){const e=U(),r=c();return e.timeEvents.register(t,r.time())}(t)),e&&(yield*e)}),y()),b(z,y()),b((function*(t,e){yield*z(t),Y(e)?yield*e:e()}),y()),b((function*(t,e){for(let r=0;r<t;r++){const t=e(r);t?yield*t:yield}}),y()),b((function*(){}),y()),b((function*(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),s=1;s<e;s++)r[s-1]=arguments[s];for(const i of r)yield i,yield*z(t);yield*m(...r)}),y());class q extends n{constructor(){super(...arguments),this.value=!1}raise(){this.value||(this.value=!0,this.notifySubscribers())}reset(){this.value=!1}isRaised(){return this.value}subscribe(t){const e=super.subscribe(t);return this.value&&t(),e}}class B{static collectPromise(t,e){void 0===e&&(e=null);const r={promise:t,value:e,stack:(new Error).stack},s=this.collectionStack.at(-1);return s&&(r.owner=s.owner),t.then((t=>{r.value=t,null==s||s.markDirty()})),this.promises.push(r),r}static consumePromises(){const t=this.promises;return this.promises=[],t}constructor(t){this.owner=t,this.dependencies=new Set,this.event=new q,this.markDirty=()=>
11this.event.raise(),this.invokable=this.invoke.bind(this),Object.defineProperty(this.invokable,"context",{value:this}),Object.defineProperty(this.invokable,"toPromise",{value:this.toPromise.bind(this)})}invoke(){}startCollecting(){if(B.collectionSet.has(this))throw new f("A circular dependency occurred between signals.","This can happen when signals reference each other in a loop.\n        Try using the attached stack trace to locate said loop.");B.collectionSet.add(this),B.collectionStack.push(this)}finishCollecting(){if(B.collectionSet.delete(this),B.collectionStack.pop()!==this)throw new Error("collectStart/collectEnd was called out of order.")}clearDependencies(){this.dependencies.forEach((t=>t.unsubscribe(this.markDirty))),this.dependencies.clear()}collect(){const t=B.collectionStack.at(-1);t&&(t.dependencies.add(this.event.subscribable),this.event.subscribe(t.markDirty))}dispose(){this.clearDependencies(),this.event.clear(),this.owner=null}async toPromise(){let t=B.consumePromises();do{await Promise.all(t.map((t=>t.promise))),this.invokable(),t=B.consumePromises()}while(t.length>0);return this.invokable}}function _(t){return"function"==typeof t}B.collectionSet=new Set,B.collectionStack=[],B.promises=[];const G=Symbol.for("@motion-canvas/core/signals/default");class Z extends B{constructor(t,e,r){void 0===r&&(r=void 0),super(r),this.initial=t,this.interpolation=e,this.parser=t=>t,Object.defineProperty(this.invokable,"reset",{value:this.reset.bind(this)}),Object.defineProperty(this.invokable,"save",{value:this.save.bind(this)}),Object.defineProperty(this.invokable,"isInitial",{value:this.isInitial.bind(this)}),void 0!==this.initial&&(this.current=this.initial,this.markDirty(),_(this.initial)||(this.last=this.parse(this.initial)))}toSignal(){return this.invokable}parse(t){return this.parser(t)}wrap(t){return _(t)?()=>this.parse(t()):this.parse(t)}setInitial(t){this.initial=t}setParser(t){this.parser=t,void 0===this.current||_(this.current)||(this.last=this.parse(this.current)),this.markDirty()}set(t){return t===G&&(t=this.initial),this.current===t||(this.current=t,this.markDirty(),this.clearDependencies(),_(t)||(this.last=this.parse(t))),this.owner}get(){if(this.event.isRaised()&&_(this.current)){this.clearDependencies(),this.startCollecting();try{this.last=this.parse(this.current())}catch(r){var t;Q().error({...(e=r,{message:e.message,stack:e.stack,remarks:e.remarks}),inspect:null==(t=this.owner)?void 0:t.key})}this.finishCollecting()}var e;return this.event.reset(),this.collect(),this.last}invoke(t,e,r,s){return void 0===r&&(r=L),void 0===s&&(s=this.interpolation),void 0===t?this.get():void 0===e?this.set(t):this.makeAnimate(r,s)(t,e)}makeAnimate(t,e,r){var s=this;return function(i,n,a,o){void 0===a&&(a=t),void 0===o&&(o=e);const l=s.tween(i,n,a,o);let h=l;return r&&(h=function(t,e){let r;return"string"==typeof t?(r=e(),w(r,t)):(r=t(),w(r,r)),r}((function*(){yield*r,yield*l}))),h.to=s.makeAnimate(a,o,h),h}}*tween(t,e,r,s){t===G&&(t=this.initial),yield*this.doTween(this.parse(_(t)?t():t),e,r,s),this.set(t)}*doTween(t,e,r,s){const i=this.get();yield*j(e,(e=>{this.set(s(i,t,r(e)))}))}dispose(){super.dispose(),this.initial=void 0,this.current=void 0,this.last=void 0}reset(){return void 0!==this.initial&&this.set(this.initial),this.owner}save(){return this.set(this.get())}isInitial(){return this.collect(),this.current===this.initial}raw(){return this.current}}class H extends Z{constructor(t,e,r,s,i){void 0===i&&(i=void 0),super(void 0,s,i),this.entries=t,this.signals=[],this.parser=e;for(const n of t){const t=new Z(_(r)?()=>e(r())[n]:e(r)[n],I,i??this.invokable).toSignal();this.signals.push([n,t]),Object.defineProperty(this.invokable,n,{value:t})}}toSignal(){return this.invokable}parse(t){return this.parser(t)}get(){return this.parse(Object.fromEntries(this.signals.map((t=>{let[e,r]=t;return[e,r()]}))))}set(t){if(_(t))for(const[e,r]of this.signals)r((()=>this.parser(t())[e]));else{const e=this.parse(t);for(const[t,r]of this.signals)r(e[t])}return this.owner}reset(){for(const[,t]of this.signals)t.reset();return this.owner}save(){for(const[,t]of this.signals)t.save();return this.owner}}class W{get fixed(){return this.fixedTime}get canceled(){var t;return this.isCanceled||((null==(t=this.parent)?void 0:t.canceled)??!1)}constructor(t){var e,r;this.runner=t,this.children=[],this.time=(void 0===e&&(e=P),new Z(0,e,r).toSignal()),this.parent=null,this.isCanceled=!1,this.fixedTime=0}next(){var t;t=this,u.push(t);const e=this.runner.next(this.value);return function(t){if(u.pop()!==t)throw new Error("startThread/endThread was called out of order.")}(this),this.value=null,e}update(t){this.time(this.time()+t),this.fixedTime+=t,this.children=this.children.filter((t=>!t.canceled))}add(t){t.cancel(),t.parent=this,t.isCanceled=!1,t.time(this.time()),t.fixedTime=this.fixedTime,this.children.push(t),w(t.runner,`unknown ${this.children.length}`)}cancel(){this.isCanceled=!0,this.parent=null}}function Y(t){return null!==t&&"object"==typeof t&&Symbol.iterator in t&&"next"in t}b((function*(t,e){const r=g(),s=t();w(s,"root");const i=new W(s);null==e||e(i);let n=[i];for(;n.length>0;){const t=[],e=[...n],s=r.framesToSeconds(1)*r.speed;for(;e.length>0;){const r=e.pop();if(!r||r.canceled)continue;const i=r.next();if(i.done)r.cancel();else if(Y(i.value)){const t=new W(i.value);r.value=i.value,r.add(t),e.push(r),e.push(t)}else i.value?(r.value=yield i.value,e.push(r)):(r.update(s),t.unshift(r))}n=t.filter((t=>!t.canceled)),n.length>0&&(yield)}}),y());var V,$;!function(t){t[t.BeforeRender=0]="BeforeRender",t[t.BeginRender=1]="BeginRender",t[t.Finis
11hRender=2]="FinishRender",t[t.AfterRender=3]="AfterRender"}(V||(V={}));!function(t){t[t.Initial=0]="Initial",t[t.AfterTransitionIn=1]="AfterTransitionIn",t[t.CanTransitionOut=2]="CanTransitionOut",t[t.Finished=3]="Finished"}($||($={}));class X{constructor(t,e){void 0===e&&(e=!1),this.name=t,this.source=e,this.lock=new v,this.ignoreChange=!1,this.cache=null,this.metaField=null,this.handleChanged=async()=>{0}}attach(t){var e;this.metaField||(this.metaField=t,this.cache&&this.metaField.set(this.cache),null==(e=this.metaField)||e.onChanged.subscribe(this.handleChanged))}async saveData(t){if(!1===this.source)return;if(!this.source)throw new Error(`The meta file for ${this.name} is missing.`);if(X.sourceLookup[this.source])throw new Error(`Metadata for ${this.name} is already being updated`);const e=this.source;await new Promise(((r,s)=>{setTimeout((()=>{delete X.sourceLookup[e],s(`Connection timeout when updating metadata for ${this.name}`)}),1e3),X.sourceLookup[e]=()=>{delete X.sourceLookup[e],r()},(void 0).send("motion-canvas:meta",{source:e,data:t})}))}loadData(t){var e;this.ignoreChange=!0,this.cache=t,null==(e=this.metaField)||e.set(t),this.ignoreChange=!1}}X.sourceLookup={};const J=[];function U(){const t=J.at(-1);if(!t)throw new Error("The scene is not available in the current context.");return t}function Q(){var t;return(null==(t=J.at(-1))?void 0:t.logger)??console}class K{get onDataChanged(){return this.data.subscribable}constructor(t){this.logger=t,this.data=new o(null),this.audioElement=new Audio,this.source=null,this.error=!1,this.abortController=null,this.offset=0}getTime(){return this.toAbsoluteTime(this.audioElement.currentTime)}setTime(t){this.audioElement.currentTime=this.toRelativeTime(t)}setOffset(t){this.offset=t}setMuted(t){this.audioElement.muted=t}setSource(t){var e;this.source=t,this.audioElement.src=t,null==(e=this.abortController)||e.abort(),this.abortController=new AbortController,this.loadData(this.abortController.signal).catch((t=>{"AbortError"!==t.name&&this.logger.error(t)}))}isInRange(t){return t>=this.offset&&t<this.audioElement.duration}toRelativeTime(t){return Math.max(0,t-this.offset)}toAbsoluteTime(t){return t+this.offset}isReady(){return this.source&&!this.error}async setPaused(t){if(this.source&&this.audioElement.paused!==t)if(t)this.audioElement.pause();else try{return await this.audioElement.play(),this.error=!1,!0}catch(e){this.error||Q().error(e),this.error=!0}return!1}async loadData(t){if(this.data.current=null,!this.source)return;const e=await fetch(this.source,{signal:t}),r=await e.arrayBuffer();if(t.aborted)return;const s=await this.decodeAudioData(r);if(t.aborted)return;const i=256,n=~~(s.length/i),a=[];let o=0;for(let l=0;l<s.numberOfChannels;l++){const t=s.getChannelData(l);for(let e=0;e<n;e++){const r=~~(e*i),s=~~(r+i);let n=t[r],h=n;for(let e=r;e<s;e++){const r=t[e];r>h&&(h=r),r<n&&(n=r)}(0===l||h>a[2*e])&&(a[2*e]=h),(0===l||n<a[2*e+1])&&(a[2*e+1]=n),h>o&&(o=h),Math.abs(n)>o&&(o=Math.abs(n))}}this.data.current={peaks:a,absoluteMax:o,length:n,sampleRate:s.sampleRate/i*2}}decodeAudioData(t){return new Promise(((e,r)=>K.context.decodeAudioData(t,e,r)))}}K.context=new AudioContext;class tt extends n{async dispatch(t){await Promise.all(this.notifySubscribers(t))}}class et extends n{dispatch(t){this.notifySubscribers(t)}}class rt{constructor(t){this.playback=t}secondsToFrames(t){return Math.ceil(t*this.playback.fps)}framesToSeconds(t){return t/this.playback.fps}get time(){return this.framesToSeconds(this.playback.frame)}get frame(){return this.playback.frame}get speed(){return this.playback.speed}get fps(){return this.playback.fps}get state(){return this.playback.state}}class st{get onChanged(){return this.events.subscribable}constructor(t){this.scene=t,this.events=new o([]),this.registeredEvents={},this.lookup={},this.collisionLookup=new Set,this.previousReference=[],this.didEventsChange=!1,this.preserveTiming=!0,this.handleReload=()=>{this.registeredEvents={},this.collisionLookup.clear()},this.handleRecalculated=()=>{var t;this.preserveTiming=!0,this.events.current=Object.values(this.registeredEvents),(this.didEventsChange||((null==(t=this.previousReference)?void 0:t.length)??0)!==this.events.current.length)&&(this.didEventsChange=!1,this.previousReference=Object.values(this.registeredEvents).map((t=>({name:t.name,targetTime:t.targetTime}))),this.scene.meta.timeEvents.set(this.previousReference))},this.handleReset=()=>{this.collisionLookup.clear()},this.handleMetaChanged=t=>{t!==this.previousReference&&(this.previousReference=t,this.load(t),this.scene.reload())},this.previousReference=t.meta.timeEvents.get(),this.load(this.previousReference),t.onReloaded.subscribe(this.handleReload),t.onRecalculated.subscribe(this.handleRecalculated),t.onReset.subscribe(this.handleReset),t.meta.timeEvents.onChanged.subscribe(this.handleMetaChanged,!1)}set(t,e,r){void 0===r&&(r=!0),this.lookup[t]&&this.lookup[t].offset!==e&&(this.preserveTiming=r,this.lookup[t]={...this.lookup[t],targetTime:this.lookup[t].initialTime+e,offset:e},this.registeredEvents[t]=this.lookup[t],this.events.current=Object.values(this.registeredEvents),this.didEventsChange=!0,this.scene.reload())}register(t,e){if(this.collisionLookup.has(t))return this.scene.logger.error({message:`name "${t}" has already been used for another event name.`,stack:(new Error).stack}),0;if(this.collisionLookup.add(t),this.lookup[t]){let r=!1;const s={...this.lookup[t]},i=(new Error).stack;s.stack!==i&&(s.stack=i,r=!0),s.initialTime!==e&&(s.initialTime=e,r=!0);const n=Math.max(0,s.targetTime-s.initialTime);this.preserveTiming&&s.offset!==n&&(s.offset=n,r=!0);const a=s.initialTime+s.offset;this.preserveTiming||s.targetTime===a||(this.didEventsChange=!0,s.targetTime=a,r
11=!0),r&&(this.lookup[t]=s)}else this.didEventsChange=!0,this.lookup[t]={name:t,initialTime:e,targetTime:e,offset:0,stack:(new Error).stack};return this.registeredEvents[t]=this.lookup[t],this.lookup[t].offset}load(t){for(const e of t){const t=this.lookup[e.name]??{name:e.name,initialTime:0,offset:0};this.lookup[e.name]={...t,targetTime:e.targetTime}}}}class it{get onRender(){return this.render.subscribable}get onStateChanged(){return this.playerState.subscribable}get onFrameChanged(){return this.frame.subscribable}get onDurationChanged(){return this.duration.subscribable}get onRecalculated(){return this.recalculated.subscribable}get startFrame(){return Math.min(this.playback.duration,this.status.secondsToFrames(this.startTime))}get endFrame(){return Math.min(this.playback.duration,this.status.secondsToFrames(this.endTime))}get finished(){return this.playback.finished||this.playback.frame>=this.endFrame}constructor(t,e,r,s){var i,n;void 0===e&&(e={}),void 0===r&&(r={}),void 0===s&&(s=-1),this.project=t,this.settings=e,this.initialState=r,this.initialFrame=s,this.render=new tt,this.frame=new o(0),this.duration=new o(0),this.recalculated=new et,this.lock=new v,this.startTime=0,this.endTime=1/0,this.requestId=null,this.renderTime=0,this.requestedSeek=-1,this.requestedRecalculation=!0,this.active=!1,this.playerState=new o({loop:!0,muted:!0,speed:1,...r,paused:!0}),this.requestedSeek=s,this.logger=this.project.logger,this.playback=new h,this.status=new rt(this.playback),this.audio=new K(this.logger),this.size=e.size??new C(1920,1080),this.resolutionScale=e.resolutionScale??1,this.startTime=(null==(i=e.range)?void 0:i[0])??0,this.endTime=(null==(n=e.range)?void 0:n[1])??1/0,this.playback.fps=e.fps??60,this.audio.setOffset(e.audioOffset??0),t.audio&&this.audio.setSource(t.audio);const a=[];for(const o of t.scenes){var l;const e=new o.klass({...o,playback:this.status,logger:this.project.logger,size:this.size,resolutionScale:this.resolutionScale,timeEventsClass:st});null==(l=o.onReplaced)||l.subscribe((t=>{e.reload(t)}),!1),e.onReloaded.subscribe((()=>this.requestRecalculation())),e.variables.updateSignals(t.variables??{}),a.push(e)}this.playback.setup(a),this.activate()}async configure(t){await this.lock.acquire();let e=this.playback.frame,r=!1;if(this.startTime=t.range[0],this.endTime=t.range[1],this.playback.fps!==t.fps){const s=t.fps/this.playback.fps;this.playback.fps=t.fps,e=Math.floor(e*s),r=!0}t.size.exactlyEquals(this.size)&&t.resolutionScale===this.resolutionScale||(this.size=t.size,this.resolutionScale=t.resolutionScale,this.playback.reload({size:this.size,resolutionScale:this.resolutionScale})),void 0!==t.audioOffset&&this.audio.setOffset(t.audioOffset),this.lock.release(),r&&(this.playback.reload(),this.frame.current=e,this.requestRecalculation(),this.requestedSeek=e)}requestSeek(t){this.requestedSeek=this.clampRange(t)}requestPreviousFrame(){this.requestedSeek=this.frame.current-this.playback.speed}requestNextFrame(){this.requestedSeek=this.frame.current+this.playback.speed}requestReset(){this.requestedSeek=0}toggleLoop(t){void 0===t&&(t=!this.playerState.current.loop),t!==this.playerState.current.loop&&(this.playerState.current={...this.playerState.current,loop:t})}togglePlayback(t){void 0===t&&(t=this.playerState.current.paused),t===this.playerState.current.paused&&(this.playerState.current={...this.playerState.current,paused:!t},t&&!this.playerState.current.loop&&this.playback.frame===this.playback.duration&&this.requestReset())}toggleAudio(t){void 0===t&&(t=this.playerState.current.muted),t===this.playerState.current.muted&&(this.playerState.current={...this.playerState.current,muted:!t})}setSpeed(t){t!==this.playerState.current.speed&&(this.playback.speed=t,this.playback.reload(),this.playerState.current={...this.playerState.current,speed:t},this.requestRecalculation())}setVariables(t){for(const e of this.playback.onScenesRecalculated.current)e.variables.updateSignals(t)}activate(){this.active=!0,this.request()}deactivate(){this.active=!1,null!==this.requestId&&(cancelAnimationFrame(this.requestId),this.requestId=null)}requestRecalculation(){this.requestedRecalculation=!0,this.request()}async prepare(){const t={...this.playerState.current,seek:this.requestedSeek};if(this.requestedSeek=-1,this.requestedRecalculation){t.seek<0&&(t.seek=this.playback.frame);try{await this.playback.recalculate(),this.duration.current=this.playback.frame,this.recalculated.dispatch()}catch(r){throw this.requestSeek(t.seek),r}finally{this.requestedRecalculation=!1}}(!t.loop&&this.finished&&!t.paused&&t.seek<0||this.endFrame===this.startFrame)&&(this.togglePlayback(!1),t.paused=!0),t.loop&&(t.seek>this.endFrame||this.finished&&!t.paused)&&this.startFrame!==this.endTime&&(t.seek=this.startFrame);const e=t.paused||this.finished||!this.audio.isInRange(this.status.time);return await this.audio.setPaused(e)&&this.syncAudio(-3),this.audio.setMuted(t.muted),t}async run(){const t=await this.prepare(),e=this.playback.state;if(this.playback.state=t.paused?i.Paused:i.Playing,t.seek>=0||!this.isInRange(this.status.frame)){const e=t.seek<0?this.status.frame:t.seek,r=this.clampRange(e);this.logger.profile("seek time"),await this.playback.seek(r),this.logger.profile("seek time"),this.syncAudio(-3)}else{if(t.paused||1===t.speed&&this.audio.isReady()&&this.audio.isInRange(this.status.time)&&this.audio.getTime()<this.status.time)return t.paused&&e!==i.Paused&&await this.render.dispatch(),!t.paused&&this.status.time>this.audio.getTime()+.02&&this.syncAudio(),void this.request();if(this.audio.isReady()&&1===t.speed&&this.audio.isInRange(this.status.time)&&this.status.framesToSeconds(this.playback.frame+1)<this.audio.getTime()-.02){const t=this.status.secondsToFrames(this.audio.getTime());await this.playback.seek(t)}else this.status.frame<this.endFrame&&(await this.playback.progress(),1!==t.speed&&this.syncAudio())}
11!t.paused&&this.playback.currentScene.slides.isWaiting()&&(this.togglePlayback(!1),t.paused=!0),await this.render.dispatch(),this.frame.current=this.playback.frame,this.request()}request(){this.active&&(this.requestId??(this.requestId=requestAnimationFrame((async t=>{if(this.requestId=null,t-this.renderTime>=1e3/(this.status.fps+5)){this.renderTime=t,await this.lock.acquire();try{await this.run()}catch(e){this.logger.error(e)}this.lock.release()}else this.request()}))))}clampRange(t){return E(this.startFrame,this.endFrame,t)}isInRange(t){return t>=this.startFrame&&t<=this.endFrame}syncAudio(t){void 0===t&&(t=0),this.audio.setTime(this.status.framesToSeconds(this.playback.frame+t))}}class nt{get canvasSize(){return this.size.scale(this.resolutionScale)}constructor(){this.background=null,this.resolutionScale=1,this.colorSpace="srgb",this.size=C.zero,this.finalBuffer=document.createElement("canvas"),this.currentBuffer=document.createElement("canvas"),this.previousBuffer=document.createElement("canvas");const t=this.colorSpace;this.context=d({colorSpace:t},this.finalBuffer),this.currentContext=d({colorSpace:t},this.currentBuffer),this.previousContext=d({colorSpace:t},this.previousBuffer)}configure(t){let{colorSpace:e=this.colorSpace,size:r=this.size,resolutionScale:s=this.resolutionScale,background:i=this.background}=t;e!==this.colorSpace&&(this.colorSpace=e,this.context=d({colorSpace:e},this.finalBuffer),this.currentContext=d({colorSpace:e},this.currentBuffer),this.previousContext=d({colorSpace:e},this.previousBuffer)),r.exactlyEquals(this.size)&&s===this.resolutionScale||(this.resolutionScale=s,this.size=r,this.resizeCanvas(this.context),this.resizeCanvas(this.currentContext),this.resizeCanvas(this.previousContext)),this.background="string"==typeof i?i:(null==i?void 0:i.serialize())??null}async render(t,e){e&&(this.transformCanvas(this.previousContext),await e.render(this.previousContext)),this.transformCanvas(this.currentContext),await t.render(this.currentContext);const r=this.canvasSize;this.context.clearRect(0,0,r.width,r.height),this.background&&(this.context.save(),this.context.fillStyle=this.background,this.context.fillRect(0,0,r.width,r.height),this.context.restore()),e&&this.context.drawImage(this.previousBuffer,0,0),this.context.drawImage(this.currentBuffer,0,0)}transformCanvas(t){const e=this.canvasSize.scale(.5);t.setTransform(this.resolutionScale,0,0,this.resolutionScale,e.x,e.y)}resizeCanvas(t){const e=this.canvasSize;t.canvas.width=e.width,t.canvas.height=e.height}}var at;!function(t){t[t.Initial=0]="Initial",t[t.Working=1]="Working",t[t.Aborting=2]="Aborting"}(at||(at={}));Symbol("@motion-canvas/core/app/NextSlide"),Symbol("@motion-canvas/core/app/PreviousSlide");var ot,lt;!function(t){t[t.Initial=0]="Initial",t[t.Working=1]="Working",t[t.Aborting=2]="Aborting"}(ot||(ot={})),function(t){t[t.Success=0]="Success",t[t.Error=1]="Error",t[t.Aborted=2]="Aborted"}(lt||(lt={}));var ht=Object.defineProperty,ut=(t,e,r)=>(((t,e,r)=>{e in t?ht(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r})(t,"symbol"!=typeof e?e+"":e,r),r);typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"&&self;var ct={exports:{}};ct.exports=function(){for(var t=function(t,e,r){return void 0===e&&(e=0),void 0===r&&(r=1),t<e?e:t>r?r:t},e=t,r=function(t){t._clipped=!1,t._unclipped=t.slice(0);for(var r=0;r<=3;r++)r<3?((t[r]<0||t[r]>255)&&(t._clipped=!0),t[r]=e(t[r],0,255)):3===r&&(t[r]=e(t[r],0,1));return t},s={},i=0,n=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];i<n.length;i+=1){var a=n[i];s["[object "+a+"]"]=a.toLowerCase()}var o=function(t){return s[Object.prototype.toString.call(t)]||"object"},l=o,h=function(t,e){return void 0===e&&(e=null),t.length>=3?Array.prototype.slice.call(t):"object"==l(t[0])&&e?e.split("").filter((function(e){return void 0!==t[0][e]})).map((function(e){return t[0][e]})):t[0]},u=o,c=function(t){if(t.length<2)return null;var e=t.length-1;return"string"==u(t[e])?t[e].toLowerCase():null},f=Math.PI,d={clip_rgb:r,limit:t,type:o,unpack:h,last:c,PI:f,TWOPI:2*f,PITHIRD:f/3,DEG2RAD:f/180,RAD2DEG:180/f},v={format:{},autodetect:[]},p=d.last,g=d.clip_rgb,b=d.type,y=v,m=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=this;if("object"===b(t[0])&&t[0].constructor&&t[0].constructor===this.constructor)return t[0];var s=p(t),i=!1;if(!s){i=!0,y.sorted||(y.autodetect=y.autodetect.sort((function(t,e){return e.p-t.p})),y.sorted=!0);for(var n=0,a=y.autodetect;n<a.length;n+=1){var o=a[n];if(s=o.test.apply(o,t))break}}if(!y.format[s])throw new Error("unknown format: "+t);var l=y.format[s].apply(null,i?t:t.slice(0,-1));r._rgb=g(l),3===r._rgb.length&&r._rgb.push(1)};m.prototype.toString=function(){return"function"==b(this.hex)?this.hex():"["+this._rgb.join(",")+"]"};var w=m,k=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(k.Color,[null].concat(t)))};k.Color=w,k.version="2.4.2";var x=k,S=d.unpack,M=Math.max,C=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=S(t,"rgb"),s=r[0],i=r[1],n=r[2],a=1-M(s/=255,M(i/=255,n/=255)),o=a<1?1/(1-a):0;return[(1-s-a)*o,(1-i-a)*o,(1-n-a)*o,a]},T=C,A=d.unpack,R=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=(t=A(t,"cmyk"))[0],s=t[1],i=t[2],n=t[3],a=t.length>4?t[4]:1;return 1===n?[0,0,0,a]:[r>=1?0:255*(1-r)*(1-n),s>=1?0:255*(1-s)*(1-n),i>=1?0:255*(1-i)*(1-n),a]},P=R,I=x,E=w,N=v,L=d.unpack,D=d.type,O=T;E.prototype.cmyk=function(){return O(this._rgb)},I.cmyk=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(E,[null].concat(t,["cmyk"])))},N.format.cmyk=P,N.autodetect.push({p:2,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=L(t,"cmyk"),"array"===D(t)&&4===t.length)return"cmyk"}});var j=d.unpack,F=d.last,z=function(t){return Math.round(100*t)/100},q=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=j(t,"hsla"),s=F(t)||"lsa";return r[0]=z(r[0]||0),r[1]=z(100*r[1])+"%",r[2]=z(100*r[2])+"%","hsla"===s||r.length>3&&r[3]<1?(r[3]=r.length>3?r[3]:1,s="hsla"):r.length=3,s+"("+r.join(",")+")"},B=q,_=d.unpack,G=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=(t=_(t,"rgba"))[0],s=t[1],i=t[2];r/=255,s/=255,i/=255;var n,a,o=Math.min(r,s,i),l=Math.max(r,s,i),h=(l+o)/2;return l===o?(n=0,a=Number.NaN):n=h<.5?(l-o)/(l+o):(l-o)/(2-l-o),r==l?a=(s-i)/(l-o):s==l?a=2+(i-r)/(l-
vendor: 40,204 bytes, line 11
11o):i==l&&(a=4+(r-s)/(l-o)),(a*=60)<0&&(a+=360),t.length>3&&void 0!==t[3]?[a,n,h,t[3]]:[a,n,h]},Z=G,H=d.unpack,W=d.last,Y=B,V=Z,$=Math.round,X=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=H(t,"rgba"),s=W(t)||"rgb";return"hsl"==s.substr(0,3)?Y(V(r),s):(r[0]=$(r[0]),r[1]=$(r[1]),r[2]=$(r[2]),("rgba"===s||r.length>3&&r[3]<1)&&(r[3]=r.length>3?r[3]:1,s="rgba"),s+"("+r.slice(0,"rgb"===s?3:4).join(",")+")")},J=X,U=d.unpack,Q=Math.round,K=function(){for(var t,e=[],r=arguments.length;r--;)e[r]=arguments[r];var s,i,n,a=(e=U(e,"hsl"))[0],o=e[1],l=e[2];if(0===o)s=i=n=255*l;else{var h=[0,0,0],u=[0,0,0],c=l<.5?l*(1+o):l+o-l*o,f=2*l-c,d=a/360;h[0]=d+1/3,h[1]=d,h[2]=d-1/3;for(var v=0;v<3;v++)h[v]<0&&(h[v]+=1),h[v]>1&&(h[v]-=1),6*h[v]<1?u[v]=f+6*(c-f)*h[v]:2*h[v]<1?u[v]=c:3*h[v]<2?u[v]=f+(c-f)*(2/3-h[v])*6:u[v]=f;s=(t=[Q(255*u[0]),Q(255*u[1]),Q(255*u[2])])[0],i=t[1],n=t[2]}return e.length>3?[s,i,n,e[3]]:[s,i,n,1]},tt=K,et=tt,rt=v,st=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,it=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,nt=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,at=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,ot=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,lt=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,ht=Math.round,ut=function(t){var e;if(t=t.toLowerCase().trim(),rt.format.named)try{return rt.format.named(t)}catch{}if(e=t.match(st)){for(var r=e.slice(1,4),s=0;s<3;s++)r[s]=+r[s];return r[3]=1,r}if(e=t.match(it)){for(var i=e.slice(1,5),n=0;n<4;n++)i[n]=+i[n];return i}if(e=t.match(nt)){for(var a=e.slice(1,4),o=0;o<3;o++)a[o]=ht(2.55*a[o]);return a[3]=1,a}if(e=t.match(at)){for(var l=e.slice(1,5),h=0;h<3;h++)l[h]=ht(2.55*l[h]);return l[3]=+l[3],l}if(e=t.match(ot)){var u=e.slice(1,4);u[1]*=.01,u[2]*=.01;var c=et(u);return c[3]=1,c}if(e=t.match(lt)){var f=e.slice(1,4);f[1]*=.01,f[2]*=.01;var d=et(f);return d[3]=+e[4],d}};ut.test=function(t){return st.test(t)||it.test(t)||nt.test(t)||at.test(t)||ot.test(t)||lt.test(t)};var ct=ut,ft=x,dt=w,vt=v,pt=d.type,gt=J,bt=ct;dt.prototype.css=function(t){return gt(this._rgb,t)},ft.css=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(dt,[null].concat(t,["css"])))},vt.format.css=bt,vt.autodetect.push({p:5,test:function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];if(!e.length&&"string"===pt(t)&&bt.test(t))return"css"}});var yt=w,mt=x,wt=v,kt=d.unpack;wt.format.gl=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=kt(t,"rgba");return r[0]*=255,r[1]*=255,r[2]*=255,r},mt.gl=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(yt,[null].concat(t,["gl"])))},yt.prototype.gl=function(){var t=this._rgb;return[t[0]/255,t[1]/255,t[2]/255,t[3]]};var xt=d.unpack,St=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r,s=xt(t,"rgb"),i=s[0],n=s[1],a=s[2],o=Math.min(i,n,a),l=Math.max(i,n,a),h=l-o,u=100*h/255,c=o/(255-h)*100;return 0===h?r=Number.NaN:(i===l&&(r=(n-a)/h),n===l&&(r=2+(a-i)/h),a===l&&(r=4+(i-n)/h),(r*=60)<0&&(r+=360)),[r,u,c]},Mt=St,Ct=d.unpack,Tt=Math.floor,At=function(){for(var t,e,r,s,i,n,a=[],o=arguments.length;o--;)a[o]=arguments[o];var l,h,u,c=(a=Ct(a,"hcg"))[0],f=a[1],d=a[2];d*=255;var v=255*f;if(0===f)l=h=u=d;else{360===c&&(c=0),c>360&&(c-=360),c<0&&(c+=360);var p=Tt(c/=60),g=c-p,b=d*(1-f),y=b+v*(1-g),m=b+v*g,w=b+v;switch(p){case 0:l=(t=[w,m,b])[0],h=t[1],u=t[2];break;case 1:l=(e=[y,w,b])[0],h=e[1],u=e[2];break;case 2:l=(r=[b,w,m])[0],h=r[1],u=r[2];break;case 3:l=(s=[b,y,w])[0],h=s[1],u=s[2];break;case 4:l=(i=[m,b,w])[0],h=i[1],u=i[2];break;case 5:l=(n=[w,b,y])[0],h=n[1],u=n[2]}}return[l,h,u,a.length>3?a[3]:1]},Rt=At,Pt=d.unpack,It=d.type,Et=x,Nt=w,Lt=v,Dt=Mt;Nt.prototype.hcg=function(){return Dt(this._rgb)},Et.hcg=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(Nt,[null].concat(t,["hcg"])))},Lt.format.hcg=Rt,Lt.autodetect.push({p:1,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=Pt(t,"hcg"),"array"===It(t)&&3===t.length)return"hcg"}});var Ot=d.unpack,jt=d.last,Ft=Math.round,zt=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=Ot(t,"rgba"),s=r[0],i=r[1],n=r[2],a=r[3],o=jt(t)||"auto";void 0===a&&(a=1),"auto"===o&&(o=a<1?"rgba":"rgb");var l="000000"+((s=Ft(s))<<16|(i=Ft(i))<<8|(n=Ft(n))).toString(16);l=l.substr(l.length-6);var h="0"+Ft(255*a).toString(16);switch(h=h.substr(h.length-2),o.toLowerCase()){case"rgba":return"#"+l+h;case"argb":return"#"+h+l;default:return"#"+l}},qt=zt,Bt=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,_t=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Gt=function(t){if(t.match(Bt)){(4===t.length||7===t.length)&&(t=t.substr(1)),3===t.length&&(t=(t=t.split(""))[0]+t[0]+t[1]+t[1]+t[2]+t[2]);var e=parseInt(t,16);return[e>>16,e>>8&255,255&e,1]}if(t.match(_t)){(5===t.length||9===t.length)&&(t=t.substr(1)),4===t.length&&(t=(t=t.split(""))[0]+t[0]+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);var r=parseInt(t,16);return[r>>24&255,r>>16&255,r>>8&255,Math.round((255&r)/255*100)/100]}throw new Error("unknown hex color: "+t)},Zt=x,Ht=w,Wt=d.type,Yt=v,Vt=qt;Ht.prototype.hex=function(t){return Vt(this._rgb,t)},Zt.hex=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(Ht,[null].concat(t,["hex"])))},Yt.format.hex=Gt,Yt.autodetect.push({p:4,test:function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];if(!e.length&&"string"===Wt(t)&&[3,4,5,6,7,8,9].indexOf(t.length)>=0)return"hex"}});var $t=d.unpack,Xt=d.TWOPI,Jt=Math.min,Ut=Math.sqrt,Qt=Math.acos,Kt=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r,s=$t(t,"rgb"),i=s[0],n=s[1],a=s[2],o=Jt(i/=255,n/=255,a/=255),l=(i+n+a)/3,h=l>0?1-o/l:0;return 0===h?r=NaN:(r=(i-n+(i-a))/2,r/=Ut((i-n)*(i-n)+(i-a)*(n-a)),r=Qt(r),a>n&&(r=Xt-r),r/=Xt),[360*r,h,l]},te=Kt,ee=d.unpack,re=d.limit,se=d.TWOPI,ie=d.PITHIRD,ne=Math.cos,ae=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r,s,i,n=(t=ee(t,"hsi"))[0],a=t[1],o=t[2];return isNaN(n)&&(n=0),isNaN(a)&&(a=0),n>360&&(n-=360),n<0&&(n+=360),(n/=360)<1/3?s=1-((i=(1-a)/3)+(r=(1+a*ne(se*n)/ne(ie-se*n))/3)):n<2/3?i=1-((r=(1-a)/3)+(s=(1+a*ne(se*(n-=1/3))/ne(ie-se*n))/3)):r=1-((s=(1-a)/3)+(i=(1+a*ne(se*(n-=2/3))/ne(ie-se*n))/3)),[255*(r=re(o*r*3)),255*(s=re(o*s*3)),255*(i=re(o*i*3)),t.length>3?t[3]:1]},oe=ae,le=d.unpack,he=d.type,ue=x,ce=w,fe=v,de=te;ce.prototype.hsi=function(){return de(this._rgb)},ue.hsi=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(ce,[null].concat(t,["hsi"])))},fe.format.hsi=oe,fe.autodetect.push({p:2,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=le(t,"hsi"),"array"===he(t)&&3===t.length)return"hsi"}});var ve=d.unpack,pe=d.type,ge=x,be=w,ye=v,me=Z;be.prototype.hsl=function(){return me(this._rgb)},ge.hsl=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(be,[null].concat(t,["hsl"])))},ye.format.hsl=tt,ye.autodetect.push({p:2,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=ve(t,"hsl"),"array"===pe(t)&&3===t.length)return"hsl"}});var we=d.unpack,ke=Math.min,xe=Math.max,Se=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r,s,i,n=(t=we(t,"rgb"))[0],a=t[1],o=t[2],l=ke(n,a,o),h=xe(n,a,o),u=h-l;return i=h/255,0===h?(r=Number.NaN,s=0):(s=u/h,n===h&&(r=(a-o)/u),a===h&&(r=2+(o-n)/u),o===h&&(r=4+(n-a)/u),(r*=60)<0&&(r+=360)),[r,s,i]},Me=Se,Ce=d.unpack,Te=Math.floor,Ae=function(){for(var t,e,r,s,i,n,a=[],o=arguments.length;o--;)a[o]=arguments[o];var l,h,u,c=(a=Ce(a,"hsv"))[0],f=a[1],d=a[2];if(d*=255,0===f)l=h=u=d;else{360===c&&(c=0),c>360&&(c-=360),c<0&&(c+=360);var v=Te(c/=60),p=c-v,g=d*(1-f),b=d*(1-f*p),y=d*(1-f*(1-p));switch(v){case 0:l=(t=[d,y,g])[0],h=t[1],u=t[2];break;case 1:l=(e=[b,d,g])[0],h=e[1],u=e[2];break;case 2:l=(r=[g,d,y])[0],h=r[1],u=r[2];break;case 3:l=(s=[g,b,d])[0],h=s[1],u=s[2];break;case 4:l=(i=[y,g,d])[0],h=i[1],u=i[2];break;case 5:l=(n=[d,g,b])[0],h=n[1],u=n[2]}}return[l,h,u,a.length>3?a[3]:1]},Re=Ae,Pe=d.unpack,Ie=d.type,Ee=x,Ne=w,Le=v,De=Me;Ne.prototype.hsv=function(){return De(this._rgb)},Ee.hsv=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(Ne,[null].concat(t,["hsv"])))},Le.format.hsv=Re,Le.autodetect.push({p:2,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=Pe(t,"hsv"),"array"===Ie(t)&&3===t.length)return"hsv"}});var Oe={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},je=Oe,Fe=d.unpack,ze=Math.pow,qe=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=Fe(t,"rgb"),s=r[0],i=r[1],n=r[2],a=Ge(s,i,n),o=a[0],l=a[1],h=116*l-16;return[h<0?0:h,500*(o-l),200*(l-a[2])]},Be=function(t){return(t/=255)<=.04045?t/12.92:ze((t+.055)/1.055,2.4)},_e=function(t){return t>je.t3?ze(t,1/3):t/je.t2+je.t0},Ge=function(t,e,r){return t=Be(t),e=Be(e),r=Be(r),[_e((.4124564*t+.3575761*e+.1804375*r)/je.Xn),_e((.2126729*t+.7151522*e+.072175*r)/je.Yn),_e((.0193339*t+.119192*e+.9503041*r)/je.Zn)]},Ze=qe,He=Oe,We=d.unpack,Ye=Math.pow,Ve=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r,s,i,n=(t=We(t,"lab"))[0],a=t[1],o=t[2];return s=(n+16)/116,r=isNaN(a)?s:s+a/500,i=isNaN(o)?s:s-o/200,s=He.Yn*Xe(s),r=He.Xn*Xe(r),i=He.Zn*Xe(i),[$e(3.2404542*r-1.5371385*s-.4985314*i),$e(-.969266*r+1.8760108*s+.041556*i),$e(.0556434*r-.2040259*s+1.0572252*i),t.length>3?t[3]:1]},$e=function(t){return 255*(t<=.00304?12.92*t:1.055*Ye(t,1/2.4)-.055)},Xe=function(t){return t>He.t1?t*t*t:He.t2*(t-He.t0)},Je=Ve,Ue=d.unpack,Qe=d.type,Ke=x,tr=w,er=v,rr=Ze;tr.prototype.lab=function(){return rr(this._rgb)},Ke.lab=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(tr,[null].concat(t,["lab"])))},er.format.lab=Je,er.autodetect.push({p:2,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=Ue(t,"lab"),"array"===Qe(t)&&3===t.length)return"lab"}});var sr=d.unpack,ir=d.RAD2DEG,nr=Math.sqrt,ar=Math.atan2,or=Math.round,lr=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=sr(t,"lab"),s=r[0],i=r[1],n=r[2],a=nr(i*i+n*n),o=(ar(n,i)*ir+360)%360;return 0===or(1e4*a)&&(o=Number.NaN),[s,a,o]},hr=lr,ur=d.unpack,cr=Ze,fr=hr,dr=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=ur(t,"rgb"),s=r[0],i=r[1],n=r[2],a=cr(s,i,n),o=a[0],l=a[1],h=a[2];return fr(o,l,h)},vr=dr,pr=d.unpack,gr=d.DEG2RAD,br=Math.sin,yr=Math.cos,mr=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=pr(t,"lch"),s=r[0],i=r[1],n=r[2];return isNaN(n)&&(n=0),[s,yr(n*=gr)*i,br(n)*i]},wr=mr,kr=d.unpack,xr=wr,Sr=Je,Mr=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=(t=kr(t,"lch"))[0],s=t[1],i=t[2],n=xr(r,s,i),a=n[0],o=n[1],l=n[2],h=Sr(a,o,l);return[h[0],h[1],h[2],t.length>3?t[3]:1]},Cr=Mr,Tr=d.unpack,Ar=Cr,Rr=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=Tr(t,"hcl").reverse();return Ar.apply(void 0,r)},Pr=Rr,Ir=d.unpack,Er=d.type,Nr=x,Lr=w,Dr=v,Or=vr;Lr.prototype.lch=function(){return Or(this._rgb)},Lr.prototype.hcl=function(){return Or(this._rgb).reverse()},Nr.lch=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(Lr,[null].concat(t,["lch"])))},Nr.hcl=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(Lr,[null].concat(t,["hcl"])))},Dr.format.lch=Cr,Dr.format.hcl=Pr,["lch","hcl"].forEach((function(t){return Dr.autodetect.push({p:2,test:function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];if(e=Ir(e,t),"array"===Er(e)&&3===e.length)return t}})}));var jr={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},Fr=w,zr=v,qr=d.type,Br=jr,_r=Gt,Gr=qt;Fr.prototype.name=function(){for(var t=Gr(this._rgb,"rgb"),e=0,r=Object.keys(Br);e<r.length;e+=1){var s=r[e];if(Br[s]===t)return s.toLowerCase()}return t},zr.format.named=function(t){if(t=t.toLowerCase(),Br[t])return _r(Br[t]);throw new Error("unknown color name: "+t)},zr.autodetect.push({p:5,test:function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];if(!e.length&&"string"===qr(t)&&Br[t.toLowerCase()])return"named"}});var Zr=d.unpack,Hr=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=Zr(t,"rgb");return(r[0]<<16)+(r[1]<<8)+r[2]},Wr=Hr,Yr=d.type,Vr=function(t){if("number"==Yr(t)&&t>=0&&t<=16777215)return[t>>16,t>>8&255,255&t,1];throw new Error("unknown num color: "+t)},$r=x,Xr=w,Jr=v,Ur=d.type,Qr=Wr;Xr.prototype.num=function(){return Qr(this._rgb)},$r.num=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(Xr,[null].concat(t,["num"])))},Jr.format.num=Vr,Jr.autodetect.push({p:5,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(1===t.length&&"number"===Ur(t[0])&&t[0]>=0&&t[0]<=16777215)return"num"}});var Kr=x,ts=w,es=v,rs=d.unpack,ss=d.type,is=Math.round;ts.prototype.rgb=function(t){return void 0===t&&(t=!0),!1===t?this._rgb.slice(0,3):this._rgb.slice(0,3).map(is)},ts.prototype.rgba=function(t){return void 0===t&&(t=!0),this._rgb.slice(0,4).map((function(e,r){return r<3?!1===t?e:is(e):e}))},Kr.rgb=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(ts,[null].concat(t,["rgb"])))},es.format.rgb=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=rs(t,"rgba");return void 0===r[3]&&(r[3]=1),r},es.autodetect.push({p:3,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=rs(t,"rgba"),"array"===ss(t)&&(3===t.length||4===t.length&&"number"==ss(t[3])&&t[3]>=0&&t[3]<=1))return"rgb"}});var ns=Math.log,as=function(t){var e,r,s,i=t/100;return i<66?(e=255,r=i<6?0:-155.25485562709179-.44596950469579133*(r=i-2)+104.49216199393888*ns(r),s=i<20?0:.8274096064007395*(s=i-10)-254.76935184120902+115.67994401066147*ns(s)):(e=351.97690566805693+.114206453784165*(e=i-55)-40.25366309332127*ns(e),r=325.4494125711974+.07943456536662342*(r=i-50)-28.0852963507957*ns(r),s=255),[e,r,s,1]},os=as,ls=d.unpack,hs=Math.round,us=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];for(var r,s=ls(t,"rgb"),i=s[0],n=s[2],a=1e3,o=4e4,l=.4;o-a>l;){var h=os(r=.5*(o+a));h[2]/h[0]>=n/i?o=r:a=r}return hs(r)},cs=x,fs=w,ds=v,vs=us;fs.prototype.temp=fs.prototype.kelvin=fs.prototype.temperature=function(){return vs(this._rgb)},cs.temp=cs.kelvin=cs.temperature=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(fs,[null].concat(t,["temp"])))},ds.format.temp=ds.format.kelvin=ds.format.temperature=as;var ps=d.unpack,gs=Math.cbrt,bs=Math.pow,ys=Math.sign,ms=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=ps(t,"rgb"),s=r[0],i=r[1],n=r[2],a=[ks(s/255),ks(i/255),ks(n/255)],o=a[0],l=a[1],h=a[2],u=gs(.4122214708*o+.5363325363*l+.0514459929*h),c=gs(.2119034982*o+.6806995451*l+.1073969566*h),f=gs(.0883024619*o+.2817188376*l+.6299787005*h);return[.2104542553*u+.793617785*c-.0040720468*f,1.9779984951*u-2.428592205*c+.4505937099*f,.0259040371*u+.7827717662*c-.808675766*f]},ws=ms;function ks(t){var e=Math.abs(t);return e<.04045?t/12.92:(ys(t)||1)*bs((e+.055)/1.055,2.4)}var xs=d.unpack,Ss=Math.pow,Ms=Math.sign,Cs=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=(t=xs(t,"lab"))[0],s=t[1],i=t[2],n=Ss(r+.3963377774*s+.2158037573*i,3),a=Ss(r-.1055613458*s-.0638541728*i,3),o=Ss(r-.0894841775*s-1.291485548*i,3);return[255*As(4.0767416621*n-3.3077115913*a+.2309699292*o),255*As(-1.2684380046*n+2.6097574011*a-.3413193965*o),255*As(-.0041960863*n-.7034186147*a+1.707614701*o),t.length>3?t[3]:1]},Ts=Cs;function As(t){var e=Math.abs(t);return e>.0031308?(Ms(t)||1)*(1.055*Ss(e,1/2.4)-.055):12.92*t}var Rs=d.unpack,Ps=d.type,Is=x,Es=w,Ns=v,Ls=ws;Es.prototype.oklab=function(){return Ls(this._rgb)},Is.oklab=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(Es,[null].concat(t,["oklab"])))},Ns.format.oklab=Ts,Ns.autodetect.push({p:3,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=Rs(t,"oklab"),"array"===Ps(t)&&3===t.length)return"oklab"}});var Ds=d.unpack,Os=ws,js=hr,Fs=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=Ds(t,"rgb"),s=r[0],i=r[1],n=r[2],a=Os(s,i,n),o=a[0],l=a[1],h=a[2];return js(o,l,h)},zs=Fs,qs=d.unpack,Bs=wr,_s=Ts,Gs=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=(t=qs(t,"lch"))[0],s=t[1],i=t[2],n=Bs(r,s,i),a=n[0],o=n[1],l=n[2],h=_s(a,o,l);return[h[0],h[1],h[2],t.length>3?t[3]:1]},Zs=Gs,Hs=d.unpack,Ws=d.type,Ys=x,Vs=w,$s=v,Xs=zs;Vs.prototype.oklch=function(){return Xs(this._rgb)},Ys.oklch=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];return new(Function.prototype.bind.apply(Vs,[null].concat(t,["oklch"])))},$s.format.oklch=Zs,$s.autodetect.push({p:3,test:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t=Hs(t,"oklch"),"array"===Ws(t)&&3===t.length)return"oklch"}});var Js=w,Us=d.type;Js.prototype.alpha=function(t,e){return void 0===e&&(e=!1),void 0!==t&&"number"===Us(t)?e?(this._rgb[3]=t,this):new Js([this._rgb[0],this._rgb[1],this._rgb[2],t],"rgb"):this._rgb[3]},w.prototype.clipped=function(){return this._rgb._clipped||!1};var Qs=w,Ks=Oe;Qs.prototype.darken=function(t){void 0===t&&(t=1);var e=this,r=e.lab();return r[0]-=Ks.Kn*t,new Qs(r,"lab").alpha(e.alpha(),!0)},Qs.prototype.brighten=function(t){return void 0===t&&(t=1),this.darken(-t)},Qs.prototype.darker=Qs.prototype.darken,Qs.prototype.brighter=Qs.prototype.brighten,w.prototype.get=function(t){var e=t.split("."),r=e[0],s=e[1],i=this[r]();if(s){var n=r.indexOf(s)-("ok"===r.substr(0,2)?2:0);if(n>-1)return i[n];throw new Error("unknown channel "+s+" in mode "+r)}return i};var ti=w,ei=d.type,ri=Math.pow,si=1e-7,ii=20;ti.prototype.luminance=function(t){if(void 0!==t&&"number"===ei(t)){if(0===t)return new ti([0,0,0,this._rgb[3]],"rgb");if(1===t)return new ti([255,255,255,this._rgb[3]],"rgb");var e=this.luminance(),r="rgb",s=ii,i=function(e,n){var a=e.interpolate(n,.5,r),o=a.luminance();return Math.abs(t-o)<si||!s--?a:o>t?i(e,a):i(a,n)},n=(e>t?i(new ti([0,0,0]),this):i(this,new ti([255,255,255]))).rgb();return new ti(n.concat([this._rgb[3]]))}return ni.apply(void 0,this._rgb.slice(0,3))};var ni=function(t,e,r){return.2126*(t=ai(t))+.7152*(e=ai(e))+.0722*(r=ai(r))},ai=function(t){return(t/=255)<=.03928?t/12.92:ri((t+.055)/1.055,2.4)},oi={},li=w,hi=d.type,ui=oi,ci=function(t,e,r){void 0===r&&(r=.5);for(var s=[],i=arguments.length-3;i-- >0;)s[i]=arguments[i+3];var n=s[0]||"lrgb";if(!ui[n]&&!s.length&&(n=Object.keys(ui)[0]),!ui[n])throw new Error("interpolation mode "+n+" is not defined");return"object"!==hi(t)&&(t=new li(t)),"object"!==hi(e)&&(e=new li(e)),ui[n](t,e,r).alpha(t.alpha()+r*(e.alpha()-t.alpha()))},fi=w,di=ci;fi.prototype.mix=fi.prototype.interpolate=function(t,e){void 0===e&&(e=.5);for(var r=[],s=arguments.length-2;s-- >0;)r[s]=arguments[s+2];return di.apply(void 0,[this,t,e].concat(r))};var vi=w;vi.prototype.premultiply=function(t){void 0===t&&(t=!1);var e=this._rgb,r=e[3];return t?(this._rgb=[e[0]*r,e[1]*r,e[2]*r,r],this):new vi([e[0]*r,e[1]*r,e[2]*r,r],"rgb")};var pi=w,gi=Oe;pi.prototype.saturate=function(t){void 0===t&&(t=1);var e=this,r=e.lch();return r[1]+=gi.Kn*t,r[1]<0&&(r[1]=0),new pi(r,"lch").alpha(e.alpha(),!0)},pi.prototype.desaturate=function(t){return void 0===t&&(t=1),this.saturate(-t)};var bi=w,yi=d.type;bi.prototype.set=function(t,e,r){void 0===r&&(r=!1);var s=t.split("."),i=s[0],n=s[1],a=this[i]();if(n){var o=i.indexOf(n)-("ok"===i.substr(0,2)?2:0);if(o>-1){if("string"==yi(e))switch(e.charAt(0)){case"+":case"-":a[o]+=+e;break;case"*":a[o]*=+e.substr(1);break;case"/":a[o]/=+e.substr(1);break;default:a[o]=+e}else{if("number"!==yi(e))throw new Error("unsupported value for Color.set");a[o]=e}var l=new bi(a,i);return r?(this._rgb=l._rgb,this):l}throw new Error("unknown channel "+n+" in mode "+i)}return a};var mi=w,wi=function(t,e,r){var s=t._rgb,i=e._rgb;return new mi(s[0]+r*(i[0]-s[0]),s[1]+r*(i[1]-s[1]),s[2]+r*(i[2]-s[2]),"rgb")};oi.rgb=wi;var ki=w,xi=Math.sqrt,Si=Math.pow,Mi=function(t,e,r){var s=t._rgb,i=s[0],n=s[1],a=s[2],o=e._rgb,l=o[0],h=o[1],u=o[2];return new ki(xi(Si(i,2)*(1-r)+Si(l,2)*r),xi(Si(n,2)*(1-r)+Si(h,2)*r),xi(Si(a,2)*(1-r)+Si(u,2)*r),"rgb")};oi.lrgb=Mi;var Ci=w,Ti=function(t,e,r){var s=t.lab(),i=e.lab();return new Ci(s[0]+r*(i[0]-s[0]),s[1]+r*(i[1]-s[1]),s[2]+r*(i[2]-s[2]),"lab")};oi.lab=Ti;var Ai=w,Ri=function(t,e,r,s){var i,n,a,o,l,h,u,c,f,d,v,p,g;return"hsl"===s?(a=t.hsl(),o=e.hsl()):"hsv"===s?(a=t.hsv(),o=e.hsv()):"hcg"===s?(a=t.hcg(),o=e.hcg()):"hsi"===s?(a=t.hsi(),o=e.hsi()):"lch"===s||"hcl"===s?(s="hcl",a=t.hcl(),o=e.hcl()):"oklch"===s&&(a=t.oklch().reverse(),o=e.oklch().reverse()),("h"===s.substr(0,1)||"oklch"===s)&&(l=(i=a)[0],u=i[1],f=i[2],h=(n=o)[0],c=n[1],d=n[2]),isNaN(l)||isNaN(h)?isNaN(l)?isNaN(h)?p=Number.NaN:(p=h,(1==f||0==f)&&"hsv"!=s&&(v=c)):(p=l,(1==d||0==d)&&"hsv"!=s&&(v=u)):p=l+r*(h>l&&h-l>180?h-(l+360):h<l&&l-h>180?h+360-l:h-l),void 0===v&&(v=u+r*(c-u)),g=f+r*(d-f),new Ai("oklch"===s?[g,v,p]:[p,v,g],s)},Pi=Ri,Ii=function(t,e,r){return Pi(t,e,r,"lch")};oi.lch=Ii,oi.hcl=Ii;var Ei=w,Ni=function(t,e,r){var s=t.num(),i=e.num();return new Ei(s+r*(i-s),"num")};oi.num=Ni;var Li=Ri,Di=function(t,e,r){return Li(t,e,r,"hcg")};oi.hcg=Di;var Oi=Ri,ji=function(t,e,r){return Oi(t,e,r,"hsi")};oi.hsi=ji;var Fi=Ri,zi=function(t,e,r){return Fi(t,e,r,"hsl")};oi.hsl=zi;var qi=Ri,Bi=function(t,e,r){return qi(t,e,r,"hsv")};oi.hsv=Bi;var _i=w,Gi=function(t,e,r){var s=t.oklab(),i=e.oklab();return new _i(s[0]+r*(i[0]-s[0]),s[1]+r*(i[1]-s[1]),s[2]+r*(i[2]-s[2]),"oklab")};oi.oklab=Gi;var Zi=Ri,Hi=function(t,e,r){return Zi(t,e,r,"oklch")};oi.oklch=Hi;var Wi=w,Yi=d.clip_rgb,Vi=Math.pow,$i=Math.sqrt,Xi=Math.PI,Ji=Math.cos,Ui=Math.sin,Qi=Math.atan2,Ki=function(t,e,r){void 0===e&&(e="lrgb"),void 0===r&&(r=null);var s=t.length;r||(r=Array.from(new Array(s)).map((function(){return 1})));var i=s/r.reduce((function(t,e){return t+e}));if(r.forEach((function(t,e){r[e]*=i})),t=t.map((function(t){return new Wi(t)})),"lrgb"===e)return tn(t,r);for(var n=t.shift(),a=n.get(e),o=[],l=0,h=0,u=0;u<a.length;u++)if(a[u]=(a[u]||0)*r[0],o.push(isNaN(a[u])?0:r[0]),"h"===e.charAt(u)&&!isNaN(a[u])){var c=a[u]/180*Xi;l+=Ji(c)*r[0],h+=Ui(c)*r[0]}var f=n.alpha()*r[0];t.forEach((function(t,s){var i=t.get(e);f+=t.alpha()*r[s+1];for(var n=0;n<a.length;n++)if(!isNaN(i[n]))if(o[n]+=r[s+1],"h"===e.charAt(n)){var u=i[n]/180*Xi;l+=Ji(u)*r[s+1],h+=Ui(u)*r[s+1]}else a[n]+=i[n]*r[s+1]}));for(var d=0;d<a.length;d++)if("h"===e.charAt(d)){for(var v=Qi(h/o[d],l/o[d])/Xi*180;v<0;)v+=360;for(;v>=360;)v-=360;a[d]=v}else a[d]=a[d]/o[d];return f/=s,new Wi(a,e).alpha(f>.99999?1:f,!0)},tn=function(t,e){for(var r=t.length,s=[0,0,0,0],i=0;i<t.length;i++){var n=t[i],a=e[i]/r,o=n._rgb;s[0]+=Vi(o[0],2)*a,s[1]+=Vi(o[1],2)*a,s[2]+=Vi(o[2],2)*a,s[3]+=o[3]*a}return s[0]=$i(s[0]),s[1]=$i(s[1]),s[2]=$i(s[2]),s[3]>.9999999&&(s[3]=1),new Wi(Yi(s))},en=x,rn=d.type,sn=Math.pow,nn=function(t){var e="rgb",r=en("#ccc"),s=0,i=[0,1],n=[],a=[0,0],o=!1,l=[],h=!1,u=0,c=1,f=!1,d={},v=!0,p=1,g=function(t){if((t=t||["#fff","#000"])&&"string"===rn(t)&&en.brewer&&en.brewer[t.toLowerCase()]&&(t=en.brewer[t.toLowerCase()]),"array"===rn(t)){1===t.length&&(t=[t[0],t[0]]),t=t.slice(0);for(var e=0;e<t.length;e++)t[e]=en(t[e]);n.length=0;for(var r=0;r<t.length;r++)n.push(r/(t.length-1))}return k(),l=t},b=function(t){if(null!=o){for(var e=o.length-1,r=0;r<e&&t>=o[r];)r++;return r-1}return 0},y=function(t){return t},m=function(t){return t},w=function(t,s){var i,h;if(null==s&&(s=!1),isNaN(t)||null===t)return r;h=s?t:o&&o.length>2?b(t)/(o.length-2):c!==u?(t-u)/(c-u):1,h=m(h),s||(h=y(h)),1!==p&&(h=sn(h,p)),h=a[0]+h*(1-a[0]-a[1]),h=Math.min(1,Math.max(0,h));var f=Math.floor(1e4*h);if(v&&d[f])i=d[f];else{if("array"===rn(l))for(var g=0;g<n.length;g++){var w=n[g];if(h<=w){i=l[g];break}if(h>=w&&g===n.length-1){i=l[g];break}if(h>w&&h<n[g+1]){h=(h-w)/(n[g+1]-w),i=en.interpolate(l[g],l[g+1],h,e);break}}else"function"===rn(l)&&(i=l(h));v&&(d[f]=i)}return i},k=function(){return d={}};g(t);var x=function(t){var e=en(w(t));return h&&e[h]?e[h]():e};return x.classes=function(t){if(null!=t){if("array"===rn(t))o=t,i=[t[0],t[t.length-1]];else{var e=en.analyze(i);o=0===t?[e.min,e.max]:en.limits(e,"e",t)}return x}return o},x.domain=function(t){if(!arguments.length)return i;u=t[0],c=t[t.length-1],n=[];var e=l.length;if(t.length===e&&u!==c)for(var r=0,s=Array.from(t);r<s.length;r+=1){var a=s[r];n.push((a-u)/(c-u))}else{for(var o=0;o<e;o++)n.push(o/(e-1));if(t.length>2){var h=t.map((function(e,r){return r/(t.length-1)})),f=t.map((function(t){return(t-u)/(c-u)}));f.every((function(t,e){return h[e]===t}))||(m=function(t){if(t<=0||t>=1)return t;for(var e=0;t>=f[e+1];)e++;var r=(t-f[e])/(f[e+1]-f[e]);return h[e]+r*(h[e+1]-h[e])})}}return i=[u,c],x},x.mode=function(t){return arguments.length?(e=t,k(),x):e},x.range=function(t,e){return g(t),x},x.out=function(t){return h=t,x},x.spread=function(t){return arguments.length?(s=t,x):s},x.correctLightness=function(t){return null==t&&(t=!0),f=t,k(),y=f?function(t){for(var e=w(0,!0).lab()[0],r=w(1,!0).lab()[0],s=e>r,i=w(t,!0).lab()[0],n=e+(r-e)*t,a=i-n,o=0,l=1,h=20;Math.abs(a)>.01&&h-- >0;)s&&(a*=-1),a<0?(o=t,t+=.5*(l-t)):(l=t,t+=.5*(o-t)),i=w(t,!0).lab()[0],a=i-n;return t}:function(t){return t},x},x.padding=function(t){return null!=t?("number"===rn(t)&&(t=[t,t]),a=t,x):a},x.colors=function(e,r){arguments.length<2&&(r="hex");var s=[];if(0===arguments.length)s=l.slice(0);else if(1===e)s=[x(.5)];else if(e>1){var n=i[0],a=i[1]-n;s=an(0,e,!1).map((function(t){return x(n+t/(e-1)*a)}))}else{t=[];var h=[];if(o&&o.length>2)for(var u=1,c=o.length,f=1<=c;f?u<c:u>c;f?u++:u--)h.push(.5*(o[u-1]+o[u]));else h=i;s=h.map((function(t){return x(t)}))}return en[r]&&(s=s.map((function(t){return t[r]()}))),s},x.cache=function(t){return null!=t?(v=t,x):v},x.gamma=function(t){return null!=t?(p=t,x):p},x.nodata=function(t){return null!=t?(r=en(t),x):r},x};function an(t,e,r){for(var s=[],i=t<e,n=r?i?e+1:e-1:e,a=t;i?a<n:a>n;i?a++:a--)s.push(a);return s}var on=w,ln=nn,hn=function(t){for(var e=[1,1],r=1;r<t;r++){for(var s=[1],i=1;i<=e.length;i++)s[i]=(e[i]||0)+e[i-1];e=s}return e},un=function(t){var e,r,s,i,n,a,o;if(2===(t=t.map((function(t){return new on(t)}))).length)e=t.map((function(t){return t.lab()})),n=e[0],a=e[1],i=function(t){var e=[0,1,2].map((function(e){return n[e]+t*(a[e]-n[e])}));return new on(e,"lab")};else if(3===t.length)r=t.map((function(t){return t.lab()})),n=r[0],a=r[1],o=r[2],i=function(t){var e=[0,1,2].map((function(e){return(1-t)*(1-t)*n[e]+2*(1-t)*t*a[e]+t*t*o[e]}));return new on(e,"lab")};else if(4===t.length){var l;s=t.map((function(t){return t.lab()})),n=s[0],a=s[1],o=s[2],l=s[3],i=function(t){var e=[0,1,2].map((function(e){return(1-t)*(1-t)*(1-t)*n[e]+3*(1-t)*(1-t)*t*a[e]+3*(1-t)*t*t*o[e]+t*t*t*l[e]}));return new on(e,"lab")}}else{if(!(t.length>=5))throw new RangeError("No point in running bezier with only one color.");var h,u,c;h=t.map((function(t){return t.lab()})),c=t.length-1,u=hn(c),i=function(t){var e=1-t,r=[0,1,2].map((function(r){return h.reduce((function(s,i,n){return s+u[n]*Math.pow(e,c-n)*Math.pow(t,n)*i[r]}),0)}));return new on(r,"lab")}}return i},cn=function(t){var e=un(t);return e.scale=function(){return ln(e)},e},fn=x,dn=function(t,e,r){if(!dn[r])throw new Error("unknown blend mode "+r);return dn[r](t,e)},vn=function(t){return function(e,r){var s=fn(r).rgb(),i=fn(e).rgb();return fn.rgb(t(s,i))}},pn=function(t){return function(e,r){var s=[];return s[0]=t(e[0],r[0]),s[1]=t(e[1],r[1]),s[2]=t(e[2],r[2]),s}},gn=function(t){return t},bn=function(t,e){return t*e/255},yn=function(t,e){return t>e?e:t},mn=function(t,e){return t>e?t:e},wn=function(t,e){return 255*(1-(1-t/255)*(1-e/255))},kn=function(t,e){return e<128?2*t*e/255:255*(1-2*(1-t/255)*(1-e/255))},xn=function(t,e){return 255*(1-(1-e/255)/(t/255))},Sn=function(t,e){return 255===t||(t=e/255*255/(1-t/255))>255?255:t};dn.normal=vn(pn(gn)),dn.multiply=vn(pn(bn)),dn.screen=vn(pn(wn)),dn.overlay=vn(pn(kn)),dn.darken=vn(pn(yn)),dn.lighten=vn(pn(mn)),dn.dodge=vn(pn(Sn)),dn.burn=vn(pn(xn));for(var Mn=dn,Cn=d.type,Tn=d.clip_rgb,An=d.TWOPI,Rn=Math.pow,Pn=Math.sin,In=Math.cos,En=x,Nn=function(t,e,r,s,i){void 0===t&&(t=300),void 0===e&&(e=-1.5),void 0===r&&(r=1),void 0===s&&(s=1),void 0===i&&(i=[0,1]);var n,a=0;"array"===Cn(i)?n=i[1]-i[0]:(n=0,i=[i,i]);var o=function(o){var l=An*((t+120)/360+e*o),h=Rn(i[0]+n*o,s),u=(0!==a?r[0]+o*a:r)*h*(1-h)/2,c=In(l),f=Pn(l);return En(Tn([255*(h+u*(-.14861*c+1.78277*f)),255*(h+u*(-.29227*c-.90649*f)),255*(h+u*(1.97294*c)),1]))};return o.start=function(e){return null==e?t:(t=e,o)},o.rotations=function(t){return null==t?e:(e=t,o)},o.gamma=function(t){return null==t?s:(s=t,o)},o.hue=function(t){return null==t?r:("array"===Cn(r=t)?0==(a=r[1]-r[0])&&(r=r[1]):a=0,o)},o.lightness=function(t){return null==t?i:("array"===Cn(t)?(i=t,n=t[1]-t[0]):(i=[t,t],n=0),o)},o.scale=function(){return En.scale(o)},o.hue(r),o},Ln=w,Dn="0123456789abcdef",On=Math.floor,jn=Math.random,Fn=function(){for(var t="#",e=0;e<6;e++)t+=Dn.charAt(On(16*jn()));return new Ln(t,"hex")},zn=o,qn=Math.log,Bn=Math.pow,_n=Math.floor,Gn=Math.abs,Zn=function(t,e){void 0===e&&(e=null);var r={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0};return"object"===zn(t)&&(t=Object.values(t)),t.forEach((function(t){e&&"object"===zn(t)&&(t=t[e]),null!=t&&!isNaN(t)&&(r.values.push(t),r.sum+=t,t<r.min&&(r.min=t),t>r.max&&(r.max=t),r.count+=1)})),r.domain=[r.min,r.max],r.limits=function(t,e){return Hn(r,t,e)},r},Hn=function(t,e,r){void 0===e&&(e="equal"),void 0===r&&(r=7),"array"==zn(t)&&(t=Zn(t));var s=t.min,i=t.max,n=t.values.sort((function(t,e){return t-e}));if(1===r)return[s,i];var a=[];if("c"===e.substr(0,1)&&(a.push(s),a.push(i)),"e"===e.substr(0,1)){a.push(s);for(var o=1;o<r;o++)a.push(s+o/r*(i-s));a.push(i)}else if("l"===e.substr(0,1)){if(s<=0)throw new Error("Logarithmic scales are only possible for values > 0");var l=Math.LOG10E*qn(s),h=Math.LOG10E*qn(i);a.push(s);for(var u=1;u<r;u++)a.push(Bn(10,l+u/r*(h-l)));a.push(i)}else if("q"===e.substr(0,1)){a.push(s);for(var c=1;c<r;c++){var f=(n.length-1)*c/r,d=_n(f);if(d===f)a.push(n[d]);else{var v=f-d;a.push(n[d]*(1-v)+n[d+1]*v)}}a.push(i)}else if("k"===e.substr(0,1)){var p,g=n.length,b=new Array(g),y=new Array(r),m=!0,w=0,k=null;(k=[]).push(s);for(var x=1;x<r;x++)k.push(s+x/r*(i-s));for(k.push(i);m;){for(var S=0;S<r;S++)y[S]=0;for(var M=0;M<g;M++)for(var C=n[M],T=Number.MAX_VALUE,A=void 0,R=0;R<r;R++){var P=Gn(k[R]-C);P<T&&(T=P,A=R),y[A]++,b[M]=A}for(var I=new Array(r),E=0;E<r;E++)I[E]=null;for(var N=0;N<g;N++)null===I[p=b[N]]?I[p]=n[N]:I[p]+=n[N];for(var L=0;L<r;L++)I[L]*=1/y[L];m=!1;for(var D=0;D<r;D++)if(I[D]!==k[D]){m=!0;break}k=I,++w>200&&(m=!1)}for(var O={},j=0;j<r;j++)O[j]=[];for(var F=0;F<g;F++)O[p=b[F]].push(n[F]);for(var z=[],q=0;q<r;q++)z.push(O[q][0]),z.push(O[q][O[q].length-1]);z=z.sort((function(t,e){return t-e})),a.push(z[0]);for(var B=1;B<z.length;B+=2){var _=z[B];!isNaN(_)&&-1===a.indexOf(_)&&a.push(_)}}return a},Wn={analyze:Zn,limits:Hn},Yn=w,Vn=function(t,e){t=new Yn(t),e=new Yn(e);var r=t.luminance(),s=e.luminance();return r>s?(r+.05)/(s+.05):(s+.05)/(r+.05)},$n=w,Xn=Math.sqrt,Jn=Math.pow,Un=Math.min,Qn=Math.max,Kn=Math.atan2,ta=Math.abs,ea=Math.cos,ra=Math.sin,sa=Math.exp,ia=Math.PI,na=function(t,e,r,s,i){void 0===r&&(r=1),void 0===s&&(s=1),void 0===i&&(i=1);var n=function(t){return 360*t/(2*ia)},a=function(t){return 2*ia*t/360};t=new $n(t),e=new $n(e);var o=Array.from(t.lab()),l=o[0],h=o[1],u=o[2],c=Array.from(e.lab()),f=c[0],d=c[1],v=c[2],p=(l+f)/2,g=(Xn(Jn(h,2)+Jn(u,2))+Xn(Jn(d,2)+Jn(v,2)))/2,b=.5*(1-Xn(Jn(g,7)/(Jn(g,7)+Jn(25,7)))),y=h*(1+b),m=d*(1+b),w=Xn(Jn(y,2)+Jn(u,2)),k=Xn(Jn(m,2)+Jn(v,2)),x=(w+k)/2,S=n(Kn(u,y)),M=n(Kn(v,m)),C=S>=0?S:S+360,T=M>=0?M:M+360,A=ta(C-T)>180?(C+T+360)/2:(C+T)/2,R=1-.17*ea(a(A-30))+.24*ea(a(2*A))+.32*ea(a(3*A+6))-.2*ea(a(4*A-63)),P=T-C;P=ta(P)<=180?P:T<=C?P+360:P-360,P=2*Xn(w*k)*ra(a(P)/2);var I=f-l,E=k-w,N=1+.015*Jn(p-50,2)/Xn(20+Jn(p-50,2)),L=1+.045*x,D=1+.015*x*R,O=30*sa(-Jn((A-275)/25,2)),j=-2*Xn(Jn(x,7)/(Jn(x,7)+Jn(25,7)))*ra(2*a(O)),F=Xn(Jn(I/(r*N),2)+Jn(E/(s*L),2)+Jn(P/(i*D),2)+j*(E/(s*L))*(P/(i*D)));return Qn(0,Un(100,F))},aa=w,oa=function(t,e,r){void 0===r&&(r="lab"),t=new aa(t),e=new aa(e);var s=t.get(r),i=e.get(r),n=0;for(var a in s){var o=(s[a]||0)-(i[a]||0);n+=o*o}return Math.sqrt(n)},la=w,ha=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];try{return new(Function.prototype.bind.apply(la,[null].concat(t))),!0}catch{return!1}},ua=x,ca=nn,fa={cool:function(){return ca([ua.hsl(180,1,.9),ua.hsl(250,.7,.4)])},hot:function(){return ca(["#000","#f00","#ff0","#fff"]).mode("rgb")}},da={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},va=0,pa=Object.keys(da);va<pa.length;va+=1){var ga=pa[va];da[ga.toLowerCase()]=da[ga]}var ba=da,ya=x;return ya.average=Ki,ya.bezier=cn,ya.blend=Mn,ya.cubehelix=Nn,ya.mi
11x=ya.interpolate=ci,ya.random=Fn,ya.scale=nn,ya.analyze=Wn.analyze,ya.contrast=Vn,ya.deltaE=na,ya.distance=oa,ya.limits=Wn.limits,ya.valid=ha,ya.scales=fa,ya.colors=jr,ya.brewer=ba,ya}();const ft=[];function dt(){var t,e;return null!=(e=null==(t=ft.at(-1))?void 0:t.logger)?e:console}const vt=[];function pt(){const t=vt.at(-1);if(!t)throw new gt("The thread is not available in the current context.","<p><code>useThread()</code> can only be called from within generator functions.\n      It&#39;s not available during rendering.</p>\n");return t}class gt extends Error{constructor(t,e){super(t),this.remarks=e}}function bt(t){return{message:t.message,stack:t.stack,remarks:t.remarks}}class yt{constructor(){this.resolveCurrent=null,this.current=null}async acquire(){for(;this.current;)await this.current;this.current=new Promise((t=>{this.resolveCurrent=t}))}release(){var t;this.current=null,null==(t=this.resolveCurrent)||t.call(this),this.resolveCurrent=null}}const mt=[];function wt(){const t=mt.at(-1);if(!t)throw new Error("The playback is not available in the current context.");return t}function kt(t){const e={[t.name]:t},r=Object.getOwnPropertyDescriptor(e,t.name);for(var s=arguments.length,i=new Array(s>1?s-1:0),n=1;n<s;n++)i[n-1]=arguments[n];if(r)for(let a=i.length-1;a>=0;a--)i[a](e,t.name,r)}function xt(t){return function(e,r,s){s.value.prototype.name=null!=t?t:r,s.value.prototype.threadable=!0}}function*St(t){let e=!0;for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];"boolean"==typeof t?e=t:s.push(t);const n=pt(),a=s.map((t=>n.children.find((e=>e.runner===t)))).filter((t=>t)),o=n.time();let l;if(e){for(;a.find((t=>!t.canceled));)yield;l=Math.max(...a.map((t=>t.time())))}else{for(;!a.find((t=>t.canceled));)yield;const t=a.filter((t=>t.canceled));l=Math.min(...t.map((t=>t.time())))}n.time(Math.max(o,l))}function Mt(t,e){const r=Object.getPrototypeOf(t);r.threadable||(r.threadable=!0,r.name="string"==typeof e?e:function(t){var e;return null!=(e=Object.getPrototypeOf(t).name)?e:null}(e))}kt(St,xt());class Ct{get fixed(){return this.fixedTime}get canceled(){var t,e;return this.isCanceled||null!=(e=null==(t=this.parent)?void 0:t.canceled)&&e}constructor(t){this.runner=t,this.children=[],this.time=function(t,e,r){void 0===e&&(e=Ot);return new Zt(t,e,r).toSignal()}(0),this.parent=null,this.isCanceled=!1,this.fixedTime=0}next(){!function(t){vt.push(t)}(this);const t=this.runner.next(this.value);return function(t){if(vt.pop()!==t)throw new Error("startThread/endThread was called out of order.")}(this),this.value=null,t}update(t){this.time(this.time()+t),this.fixedTime+=t,this.children=this.children.filter((t=>!t.canceled))}add(t){t.cancel(),t.parent=this,t.isCanceled=!1,t.time(this.time()),t.fixedTime=this.fixedTime,this.children.push(t),Mt(t.runner,`unknown ${this.children.length}`)}cancel(){this.isCanceled=!0,this.parent=null}}function Tt(t){return null!==t&&"object"==typeof t&&Symbol.iterator in t&&"next"in t}kt((function*(t,e){const r=wt(),s=t();Mt(s,"root");const i=new Ct(s);null==e||e(i);let n=[i];for(;n.length>0;){const t=[],e=[...n],s=r.framesToSeconds(1)*r.speed;for(;e.length>0;){const r=e.pop();if(!r||r.canceled)continue;const i=r.next();if(i.done)r.cancel();else if(Tt(i.value)){const t=new Ct(i.value);r.value=i.value,r.add(t),e.push(r),e.push(t)}else i.value?(r.value=yield i.value,e.push(r)):(r.update(s),t.unshift(r))}n=t.filter((t=>!t.canceled)),n.length>0&&(yield)}}),xt());class At{constructor(){this.subscribable=new Rt(this),this.subscribers=new Set}subscribe(t){return this.subscribers.add(t),()=>this.unsubscribe(t)}unsubscribe(t){this.subscribers.delete(t)}clear(){this.subscribers.clear()}notifySubscribers(t){return[...this.subscribers].map((e=>e(t)))}}class Rt{constructor(t){this.dispatcher=t}subscribe(t){return this.dispatcher.subscribe(t)}unsubscribe(t){this.dispatcher.unsubscribe(t)}}class Pt extends At{constructor(){super(...arguments),this.value=!1}raise(){this.value||(this.value=!0,this.notifySubscribers())}reset(){this.value=!1}isRaised(){return this.value}subscribe(t){const e=super.subscribe(t);return this.value&&t(),e}}var It,Et,Nt;!function(t){t[t.BeforeRender=0]="BeforeRender",t[t.BeginRender=1]="BeginRender",t[t.Finis
11hRender=2]="FinishRender",t[t.AfterRender=3]="AfterRender"}(It||(It={})),function(t){t[t.Initial=0]="Initial",t[t.AfterTransitionIn=1]="AfterTransitionIn",t[t.CanTransitionOut=2]="CanTransitionOut",t[t.Finished=3]="Finished"}(Et||(Et={})),function(t){t[t.Playing=0]="Playing",t[t.Rendering=1]="Rendering",t[t.Paused=2]="Paused",t[t.Presenting=3]="Presenting"}(Nt||(Nt={}));class Lt{constructor(t,e){void 0===e&&(e=!1),this.name=t,this.source=e,this.lock=new yt,this.ignoreChange=!1,this.cache=null,this.metaField=null,this.handleChanged=async()=>{}}attach(t){var e;this.metaField||(this.metaField=t,this.cache&&this.metaField.set(this.cache),null==(e=this.metaField)||e.onChanged.subscribe(this.handleChanged))}async saveData(t){if(!1===this.source)return;if(!this.source)throw new Error(`The meta file for ${this.name} is missing.`);if(Lt.sourceLookup[this.source])throw new Error(`Metadata for ${this.name} is already being updated`);const e=this.source;await new Promise(((r,s)=>{setTimeout((()=>{delete Lt.sourceLookup[e],s(`Connection timeout when updating metadata for ${this.name}`)}),1e3),Lt.sourceLookup[e]=()=>{delete Lt.sourceLookup[e],r()},(!1).send("motion-canvas:meta",{source:e,data:t})}))}loadData(t){var e;this.ignoreChange=!0,this.cache=t,null==(e=this.metaField)||e.set(t),this.ignoreChange=!1}}function Dt(t){const e=function(){const t=ft.at(-1);if(!t)throw new Error("The scene is not available in the current context.");return t}(),r=pt();return e.timeEvents.register(t,r.time())}function Ot(t,e,r,s){if(void 0===s&&(s=!1),0===r)return t;if(1===r)return e;if(null!=t&&null!=e){if("number"==typeof t&&"number"==typeof e)return jt(t,e,r);if("string"==typeof t&&"string"==typeof e)return function(t,e,r){var s,i;if(e.length>=t.length){const i=Math.floor(e.length*r),n=Math.floor(jt(t.length-1,e.length,r));let a="";for(let r=0;r<e.length;r++)r<i?a+=e[r]:(t[r]||r<=n)&&(a+=null!=(s=t[r])?s:e[r]);return a}{const s=Math.round(t.length*(1-r)),n=Math.floor(jt(t.length+1,e.length,r)),a=[];for(let r=t.length-1;r>=0;r--)r<s?a.unshift(t[r]):(e[r]||r<n)&&a.unshift(null!=(i=e[r])?i:t[r]);return a.join("")}}(t,e,r);if("boolean"==typeof t&&"boolean"==typeof e)return r<.5?t:e;if("lerp"in t)return t.lerp(e,r);if(t&&e&&"object"==typeof t&&"object"==typeof e)if(Array.isArray(t)&&Array.isArray(e)){if(t.length===e.length)return t.map(((t,s)=>Ot(t,e[s],r)))}else{let s=!1;if(!(t instanceof Map)&&!(e instanceof Map)&&(s=!0,t=new Map(Object.entries(t)),e=new Map(Object.entries(e))),t instanceof Map&&e instanceof Map){const i=new Map;for(const s of new Set([...t.keys(),...e.keys()])){const n=Ot(t.get(s),e.get(s),r,!0);void 0!==n&&i.set(s,n)}return s?Object.fromEntries(i):i}}return e}s||dt().warn(`Attempting to lerp ${t} -> ${e} may result in unexpected behavior.`)}function jt(t,e,r){return t+(e-t)*r}function Ft(t,e,r){return void 0===e&&(e=0),void 0===r&&(r=1),jt(e,r,t=t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2)}function*zt(t,e,r){const s=pt(),i=s.time(),n=s.time()+t;for(e(0,0);n>s.fixed;){const r=s.fixed-i;r>0&&e(r/t,r),yield}s.time(n),e(1,t),null==r||r(1,t)}function*qt(t,e){void 0===t&&(t=0);const r=pt(),s=wt().framesToSeconds(1),i=r.time()+t;for(;i-s>r.fixed;)yield;r.time(i),e&&(yield*e)}Lt.sourceLookup={},kt(zt,xt()),kt((function*(t,e,r,s,i,n){var a;const o="number"==typeof s?s:.001;n="number"==typeof s?n:i;const l=(t,e)=>{"function"==typeof s?s(t,e):"function"==typeof i&&i(t,e)};if(t=null!=t?t:{mass:.05,stiffness:10,damping:.5},t.mass<=0)return void dt().error(new Error("Spring mass must be greater than 0."));if(t.stiffness<0)return void dt().error(new Error("Spring stiffness must be greater or equal to 0."));if(t.damping<0)return void dt().error(new Error("Spring damping must be greater or equal to 0."));const h=pt();let u=e,c=null!=(a=t.initialVelocity)?a:0;const f=e=>{if(null===t)return;const s=u-r,i=-t.stiffness*s-t.damping*c;c+=i/t.mass*e,u+=c*e},d=1/120;l(e,0);const v=h.time();let p=v,g=!1;for(;!g;){for(;p<h.fixed;){const t=h.fixed-p;if(d>t?(f(t),p=h.fixed):(f(d),p+=d),Math.abs(r-u)<o&&Math.abs(c)<o){h.time(p),g=!0;break}}g||(l(u,h.fixed-v),yield)}l(r,h.fixed-v),null==n||n(r,h.fixed-v)}),xt()),kt((function*(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];for(const s of e)yield s;yield*St(...e)}),xt()),kt((function*(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];for(const s of e)yield s;yield*St(!1,...e)}),xt()),kt((function*(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];for(const s of e)Tt(s)?yield*s:s()}),xt()),kt((function*(t,e){yield*qt(Dt(t)),e&&(yield*e)}),xt()),kt(qt,xt()),kt((function*(t,e){yield*qt(t),Tt(e)?yield*e:e()}),xt()),kt((function*(t,e){for(let r=0;r<t;r++){const t=e(r);t?yield*t:yield}}),xt()),kt((function*(){}),xt()),kt((function*(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),s=1;s<e;s++)r[s-1]=arguments[s];for(const i of r)yield i,yield*qt(t);yield*St(...r)}),xt());class Bt{static collectPromise(t,e){void 0===e&&(e=null);const r={promise:t,value:e,stack:(new Error).stack},s=this.collectionStack.at(-1);return s&&(r.owner=s.owner),t.then((t=>{r.value=t,null==s||s.markDirty()})),this.promises.push(r),r}static consumePromises(){const t=this.promises;return this.promises=[],t}constructor(t){this.owner=t,this.dependencies=new Set,this.event=new Pt,this.markDirty=()=>
11this.event.raise(),this.invokable=this.invoke.bind(this),Object.defineProperty(this.invokable,"context",{value:this}),Object.defineProperty(this.invokable,"toPromise",{value:this.toPromise.bind(this)})}invoke(){}startCollecting(){if(Bt.collectionSet.has(this))throw new gt("A circular dependency occurred between signals.","This can happen when signals reference each other in a loop.\n        Try using the attached stack trace to locate said loop.");Bt.collectionSet.add(this),Bt.collectionStack.push(this)}finishCollecting(){if(Bt.collectionSet.delete(this),Bt.collectionStack.pop()!==this)throw new Error("collectStart/collectEnd was called out of order.")}clearDependencies(){this.dependencies.forEach((t=>t.unsubscribe(this.markDirty))),this.dependencies.clear()}collect(){const t=Bt.collectionStack.at(-1);t&&(t.dependencies.add(this.event.subscribable),this.event.subscribe(t.markDirty))}dispose(){this.clearDependencies(),this.event.clear(),this.owner=null}async toPromise(){let t=Bt.consumePromises();do{await Promise.all(t.map((t=>t.promise))),this.invokable(),t=Bt.consumePromises()}while(t.length>0);return this.invokable}}function _t(t){return"function"==typeof t}Bt.collectionSet=new Set,Bt.collectionStack=[],Bt.promises=[];const Gt=Symbol.for("@motion-canvas/core/signals/default");class Zt extends Bt{constructor(t,e,r){void 0===r&&(r=void 0),super(r),this.initial=t,this.interpolation=e,this.parser=t=>t,Object.defineProperty(this.invokable,"reset",{value:this.reset.bind(this)}),Object.defineProperty(this.invokable,"save",{value:this.save.bind(this)}),Object.defineProperty(this.invokable,"isInitial",{value:this.isInitial.bind(this)}),void 0!==this.initial&&(this.current=this.initial,this.markDirty(),_t(this.initial)||(this.last=this.parse(this.initial)))}toSignal(){return this.invokable}parse(t){return this.parser(t)}wrap(t){return _t(t)?()=>this.parse(t()):this.parse(t)}setInitial(t){this.initial=t}setParser(t){this.parser=t,void 0!==this.current&&!_t(this.current)&&(this.last=this.parse(this.current)),this.markDirty()}set(t){return t===Gt&&(t=this.initial),this.current===t||(this.current=t,this.markDirty(),this.clearDependencies(),_t(t)||(this.last=this.parse(t))),this.owner}get(){var t;if(this.event.isRaised()&&_t(this.current)){this.clearDependencies(),this.startCollecting();try{this.last=this.parse(this.current())}catch(O){dt().error({...bt(O),inspect:null==(t=this.owner)?void 0:t.key})}this.finishCollecting()}return this.event.reset(),this.collect(),this.last}invoke(t,e,r,s){return void 0===r&&(r=Ft),void 0===s&&(s=this.interpolation),void 0===t?this.get():void 0===e?this.set(t):this.makeAnimate(r,s)(t,e)}makeAnimate(t,e,r){var s=this;return function(i,n,a,o){void 0===a&&(a=t),void 0===o&&(o=e);const l=s.tween(i,n,a,o);let h=l;return r&&(h=function(t,e){let r;return"string"==typeof t?(r=e(),Mt(r,t)):(r=t(),Mt(r,r)),r}((function*(){yield*r,yield*l}))),h.to=s.makeAnimate(a,o,h),h}}*tween(t,e,r,s){t===Gt&&(t=this.initial),yield*this.doTween(this.parse(_t(t)?t():t),e,r,s),this.set(t)}*doTween(t,e,r,s){const i=this.get();yield*zt(e,(e=>{this.set(s(i,t,r(e)))}))}dispose(){super.dispose(),this.initial=void 0,this.current=void 0,this.last=void 0}reset(){return void 0!==this.initial&&this.set(this.initial),this.owner}save(){return this.set(this.get())}isInitial(){return this.collect(),this.current===this.initial}raw(){return this.current}}class Ht extends Zt{constructor(t,e,r,s,i){void 0===i&&(i=void 0),super(void 0,s,i),this.entries=t,this.signals=[],this.parser=e;for(const n of t){const t=new Zt(_t(r)?()=>e(r())[n]:e(r)[n],jt,null!=i?i:this.invokable).toSignal();this.signals.push([n,t]),Object.defineProperty(this.invokable,n,{value:t})}}toSignal(){return this.invokable}parse(t){return this.parser(t)}get(){return this.parse(Object.fromEntries(this.signals.map((t=>{let[e,r]=t;return[e,r()]}))))}set(t){if(_t(t))for(const[e,r]of this.signals)r((()=>this.parser(t())[e]));else{const e=this.parse(t);for(const[t,r]of this.signals)r(e[t])}return this.owner}reset(){for(const[,t]of this.signals)t.reset();return this.owner}save(){for(const[,t]of this.signals)t.save();return this.owner}}var Wt,Yt,Vt;ct.exports.Color.symbol=ct.exports.Color.prototype.symbol=Symbol.for("@motion-canvas/core/types/Color"),ct.exports.Color.lerp=ct.exports.Color.prototype.lerp=function(t,e,r,s){void 0===s&&(s="lch"),"string"==typeof t&&(t=new ct.exports.Color(t)),"string"==typeof e&&(e=new ct.exports.Color(e));const i=t instanceof ct.exports.Color,n=e instanceof ct.exports.Color;
11return i||(t=n?e.alpha(0):new ct.exports.Color("rgba(0, 0, 0, 0)")),n||(e=i?t.alpha(0):new ct.exports.Color("rgba(0, 0, 0, 0)")),ct.exports.mix(t,e,r,s)},ct.exports.Color.createLerp=ct.exports.Color.prototype.createLerp=t=>(e,r,s)=>ct.exports.Color.lerp(e,r,s,t),ct.exports.Color.createSignal=function(t,e){void 0===e&&(e=ct.exports.Color.lerp);const r=new Zt(t,e);return r.setParser((t=>new ct.exports.Color(t))),r.toSignal()},ct.exports.Color.prototype.toSymbol=()=>ct.exports.Color.symbol,ct.exports.Color.prototype.serialize=function(){return this.css()},ct.exports.Color.prototype.lerp=function(t,e,r){return ct.exports.Color.lerp(this,t,e,r)},function(t){t[t.Vertical=1]="Vertical",t[t.Horizontal=2]="Horizontal"}(Wt||(Wt={})),function(t){t[t.Top=4]="Top",t[t.Bottom=8]="Bottom",t[t.Left=16]="Left",t[t.Right=32]="Right"}(Yt||(Yt={})),function(t){t[t.Middle=3]="Middle",t[t.Top=5]="Top",t[t.Bottom=9]="Bottom",t[t.Left=18]="Left",t[t.Right=34]="Right",t[t.TopLeft=20]="TopLeft",t[t.TopRight=36]="TopRight",t[t.BottomLeft=24]="BottomLeft",t[t.BottomRight=40]="BottomRight"}(Vt||(Vt={}));class $t{static createSignal(t,e,r){return void 0===e&&(e=$t.lerp),new Ht(["x","y"],(t=>new $t(t)),t,e,r).toSignal()}static lerp(t,e,r){let s,i;return"number"==typeof r?s=i=r:(s=r.x,i=r.y),new $t(jt(t.x,e.x,s),jt(t.y,e.y,i))}static arcLerp(t,e,r,s,i){return void 0===s&&(s=!1),null!=i||(i=t.sub(e).ctg),$t.lerp(t,e,function(t,e,r){let s=e;r>1?r=1/r:s=!s;const i=s?Math.acos(function(t,e,r){return r<t?t:r>e?e:r}(-1,1,1-t)):Math.asin(t),n=jt(i,jt(0,Math.PI/2,t),r);let a=Math.sin(n),o=1-Math.cos(n);return e&&([a,o]=[o,a]),new $t(a,o)}(r,s,i))}static fromOrigin(t){const e=new $t;return t===Vt.Middle||(t&Yt.Left?e.x=-1:t&Yt.Right&&(e.x=1),t&Yt.Top?e.y=-1:t&Yt.Bottom&&(e.y=1)),e}static fromScalar(t){return new $t(t,t)}static fromRadians(t){return new $t(Math.cos(t),Math.sin(t))}static magnitude(t,e){return Math.sqrt(t*t+e*e)}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}get magnitude(){return $t.magnitude(this.x,this.y)}get normalized(){return this.scale(1/$t.magnitude(this.x,this.y))}get safe(){return new $t(isNaN(this.x)?0:this.x,isNaN(this.y)?0:this.y)}get flipped(){return new $t(-this.x,-this.y)}get floored(){return new $t(Math.floor(this.x),Math.floor(this.y))}get perpendicular(){return new $t(this.y,-this.x)}get radians(){return Math.atan2(this.y,this.x)}get ctg(){return this.x/this.y}constructor(t,e){if(this.x=0,this.y=0,null!=t){if("object"!=typeof t)return this.x=t,void(this.y=null!=e?e:t);if(Array.isArray(t))return this.x=t[0],void(this.y=t[1]);if("width"in t)return this.x=t.width,void(this.y=t.height);this.x=t.x,this.y=t.y}}lerp(t,e){return $t.lerp(this,t,e)}getOriginOffset(t){const e=$t.fromOrigin(t);return e.x*=this.x/2,e.y*=this.y/2,e}scale(t){return new $t(this.x*t,this.y*t)}transformAsPoint(t){return new $t(this.x*t.m11+this.y*t.m21+t.m41,this.x*t.m12+this.y*t.m22+t.m42)}transform(t){return new $t(this.x*t.m11+this.y*t.m21,this.x*t.m12+this.y*t.m22)}mul(t){const e=new $t(t);return new $t(this.x*e.x,this.y*e.y)}div(t){const e=new $t(t);return new $t(this.x/e.x,this.y/e.y)}add(t){const e=new $t(t);return new $t(this.x+e.x,this.y+e.y)}sub(t){const e=new $t(t);return new $t(this.x-e.x,this.y-e.y)}dot(t){const e=new $t(t);return this.x*e.x+this.y*e.y}addX(t){return new $t(this.x+t,this.y)}addY(t){return new $t(this.x,this.y+t)}toSymbol(){return $t.symbol}serialize(){return{x:this.x,y:this.y}}exactlyEquals(t){return this.x===t.x&&this.y===t.y}}$t.symbol=Symbol.for("@motion-canvas/core/types/Vector2"),$t.zero=new $t,$t.one=new $t(1,1),$t.right=new $t(1,0),$t.left=new $t(-1,0),$t.up=new $t(0,1),$t.down=new $t(0,-1);class Xt{static fromRotation(t){return Xt.identity.rotate(t)}static fromTranslation(t){return Xt.identity.translate(new $t(t))}static fromScaling(t){return Xt.identity.scale(new $t(t))}get x(){return new $t(this.values[0],this.values[1])}get y(){return new $t(this.values[2],this.values[3])}get scaleX(){return this.values[0]}set scaleX(t){this.values[0]=this.x.normalized.scale(t).x}set scaleY(t){this.values[3]=this.y.normalized.scale(t).y}get scaleY(){return this.values[3]}set translateX(t){this.values[4]=t}get translateX(){return this.values[4]}set translateY(t){this.values[5]=t}get translateY(){return this.values[5]}set rotation(t){const e=this.rotate(t-this.rotation);this.values[0]=e.values[0],this.values[1]=e.values[1],this.values[2]=e.values[2],this.values[3]=e.values[3]}get rotation(){return 180*Math.atan2(this.values[1],this.values[0])/Math.PI}set translation(t){const e=new $t(t);this.values[4]=e.x,this.values[5]=e.y}get translation(){return new $t(this.values[4],this.values[5])}set scaling(t){const e=new $t(t),r=new $t(this.values[0],this.values[1]).normalized,s=new $t(this.values[2],this.values[3]).normalized;this.values[0]=r.x*e.x,this.values[1]=r.y*e.y,this.values[2]=s.x*e.x,this.values[3]=s.y*e.y}get scaling(){return new $t(this.values[0],this.values[3])}get inverse(){const t=this.values[0],e=this.values[1],r=this.values[2],s=this.values[3],i=this.values[4],n=this.values[5];let a=t*s-e*r;return a?(a=1/a,new Xt(s*a,-e*a,-r*a,t*a,(r*n-s*i)*a,(e*i-t*n)*a)):null}get determinant(){return this.values[0]*this.values[3]-this.values[1]*this.values[2]}get domMatrix(){return new DOMMatrix([this.values[0],this.values[1],this.values[2],this.values[3],this.values[4],this.values[5]])}constructor(t,e,r,s,i,n){if(this.values=new Float32Array(6),0===arguments.length)return void(this.values=new Float32Array([1,0,0,1,0,0]));if(6===arguments.length)return this.values[0]=t,this.values[1]=e,this.values[2]=r,this.values[3]=s,this.values[4]=i,void(this.values[5]=n);if(t instanceof Xt)return void(this.values=t.values);if(Array.isArray(t)){if(2===t.length)return this.values[0]=t[0],this.values[1]=t[1],this.values[2]=e[0],this.values[3]=e[1],this.values[4]=r[0],void(this.values[5]=r[1]);if(3===t.length){const e=new $t(t[0]),r=new $t(t[1]),s=new $t(t[2]);return this.values[0]=e.x,this.values[1]=e.y,this.values[2]=r.x,this.values[3]=r.y,this.values[4]=s.x,void(this.values[5]=s.y)}return this.values[0]=t[0],this.values[1]=t[1],this.values[2]=t[2],this.values[3]=t[3],this.values[4]=t[4],void(this.values[5]=t[5])}const a=new $t(t),o=new $t(e),l=new $t(r);this.values[0]=a.x,this.values[1]=a.y,this.values[2]=o.x,this.values[3]=o.y,this.values[4]=l.x,this.values[5]=l.y}column(t){return new $t(this.values[2*t],this.values[2*t+1])}row(t){return[this.values[t],this.values[t+2],this.values[t+4]]}mul(t){const e=this.values[0],r=this.values[1],s=this.values[2],i=this.values[3],n=this.values[4],a=this.values[5],o=t.values[0],l=t.values[1],h=t.values[2],u=t.values[3],c=t.values[4],f=t.values[5];return new Xt(e*o+s*l,r*o+i*l,e*h+s*u,r*h+i*u,e*c+s*f+n,r*c+i*f+a)}rotate(t,e){void 0===e&&(e=!0),e&&(t=t*Math.PI/180);const r=this.values[0],s=this.values[1],i=this.values[2],n=this.values[3],a=this.values[4],o=this.values[5],l=Math.sin(t),h=Math.cos(t);return new Xt(r*h+i*l,s*h+n*l,r*-l+i*h,s*-l+n*h,a,o)}scale(t){const e=new $t(t);return new Xt(this.values[0]*e.x,this.values[1]*e.x,this.values[2]*e.y,this.values[3]*e.y,this.values[4],this.values[5])}mulScalar(t){return new Xt(this.values[0]*t,this.values[1]*t,this.values[2]*t,this.values[3]*t,this.values[4]*t,this.values[5]*t)}translate(t){const e=new $t(t);return new Xt(this.values[0],this.values[1],this.values[2],this.values[3],this.values[0]*e.x+this.values[2]*e.y+this.values[4],this.values[1]*e.x+this.values[3]*e.y+this.values[5])}add(t){return new Xt(this.values[0]+t.values[0],this.values[1]+t.values[1],this.values[2]+t.values[2],this.values[3]+t.values[3],this.values[4]+t.values[4],this.values[5]+t.values[5])}sub(t){return new Xt(this.values[0]-t.values[0],this.values[1]-t.values[1],this.values[2]-t.values[2],this.values[3]-t.values[3],this.values[4]-t.values[4],this.values[5]-t.values[5])}equals(t,e){return void 0===e&&(e=1e-6),Math.abs(this.values[0]-t.values[0])<=e&&Math.abs(this.values[1]-t.values[1])<=e&&Math.abs(this.values[2]-t.values[2])<=e&&Math.abs(this.values[3]-t.values[3])<=e&&Math.abs(this.values[4]-t.values[4])<=e&&Math.abs(this.values[5]-t.values[5])<=e}exactlyEquals(t){return this.values[0]===t.values[0]&&this.values[1]===t.values[1]&&this.values[2]===t.values[2]&&this.values[3]===t.values[3]&&this.values[4]===t.values[4]&&this.values[5]===t.values[5]}}Xt.identity=new Xt(1,0,0,1,0,0),Xt.zero=new Xt(0,0,0,0,0,0);const Jt="motion-canvas-player";class Ut extends HTMLElement{constructor(){super(),ut(this,"root"),ut(this,"canvas"),ut(this,"overlay"),ut(this,"button"),ut(this,"state","initial"),ut(this,"project",null),ut(this,"player",null),ut(this,"defaultSettings"),ut(this,"abortController",null),ut(this,"mouseMoveId",null),ut(this,"finished",!1),ut(this,"playing",!1),ut(this,"connected",!1),ut(this,"stage",new nt),ut(this,"handleMouseMove",(()=>{this.mouseMoveId&&clearTimeout(this.mouseMoveId),this.hover&&!this.playing&&this.setPlaying(!0),this.mouseMoveId=window.setTimeout((()=>{this.mouseMoveId=null,this.updateClass()}),2e3),this.updateClass()})),ut(this,"handleMouseLeave",(()=>{this.hover&&this.setPlaying(!1),this.mouseMoveId&&(clearTimeout(this.mouseMoveId),this.mouseMoveId=null,this.updateClass())})),ut(this,"handleMouseDown",(t=>{t.preventDefault()})),ut(this,"handleClick",(()=>{this.auto||(this.handleMouseMove(),this.setPlaying(!this.playing),this.button.animate([{scale:"0.9"},{scale:"1",easing:"ease-out"}],{duration:200}))})),ut(this,"render",(async()=>{this.player&&await this.stage.render(this.player.playback.currentScene,this.player.playback.previousScene)})),this.root=this.attachShadow({mode:"open"}),this.root.innerHTML='<style>.initial{display:none}.state-initial .initial{display:block}.loading{display:none}.state-loading .loading{display:block}
11.ready{display:none}.state-ready .ready{display:block}.error{display:none}.state-error .error{display:block}:host{position:relative;display:block}.overlay{position:absolute;left:0;right:0;top:0;bottom:0;display:flex;align-items:center;justify-content:center;opacity:0;background-color:#0000008a;transition:opacity .1s}.overlay.state-ready:not(.auto){cursor:pointer}.overlay.playing:not(.hover):hover{cursor:none}.overlay.hover,.overlay.state-ready:focus-within,.overlay.state-ready:not(.playing){opacity:1}.overlay.hover .button,.overlay.state-ready:focus-within .button,.overlay.state-ready:not(.playing) .button{scale:1;transition:scale .1s ease-out}.overlay.state-loading,.overlay.state-error{opacity:1;transition:opacity 1s}.overlay.state-ready.auto{opacity:0}.button{width:50%;max-width:96px;aspect-ratio:1;scale:.5;transition:scale .1s ease-in,opacity .1s;background-color:transparent;border:none;background-size:100% 100%;background-repeat:no-repeat;opacity:.54;cursor:inherit;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjRweCIgdmlld0JveD0iMCAwIDI0IDI0IiB3aWR0aD0iMjRweCIgZmlsbD0iI2ZmZmZmZiI+PHBhdGggZD0iTTAgMGgyNHYyNEgwVjB6IiBmaWxsPSJub25lIi8+PHBhdGggZD0iTTEyIDJDNi40OCAyIDIgNi40OCAyIDEyczQuNDggMTAgMTAgMTAgMTAtNC40OCAxMC0xMFMxNy41MiAyIDEyIDJ6bS0yIDE0LjV2LTlsNiA0LjUtNiA0LjV6Ii8+PC9zdmc+)}.playing .button{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDI0IDI0IiBoZWlnaHQ9IjI0cHgiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0cHgiIGZpbGw9IiNmZmZmZmYiPjxnPjxyZWN0IGZpbGw9Im5vbmUiIGhlaWdodD0iMjQiIHdpZHRoPSIyNCIvPjxyZWN0IGZpbGw9Im5vbmUiIGhlaWdodD0iMjQiIHdpZHRoPSIyNCIvPjxyZWN0IGZpbGw9Im5vbmUiIGhlaWdodD0iMjQiIHdpZHRoPSIyNCIvPjwvZz48Zz48Zy8+PHBhdGggZD0iTTEyLDJDNi40OCwyLDIsNi40OCwyLDEyczQuNDgsMTAsMTAsMTBzMTAtNC40OCwxMC0xMFMxNy41MiwyLDEyLDJ6IE0xMSwxNkg5VjhoMlYxNnogTTE1LDE2aC0yVjhoMlYxNnoiLz48L2c+PC9zdmc+)}.button:focus,.overlay:hover .button{opacity:.87}.auto .button{display:none}.canvas{width:100%;display:block;opacity:0;transition:opacity .1s}.canvas.state-ready{opacity:1}.message{font-family:JetBrains Mono,sans-serif;text-align:center;font-size:20px;padding:8px 16px;margin:16px;border-radius:4px;color:#fff9;background-color:#000000de}.loader{width:50%;max-width:96px;display:none;rotate:-90deg;animation:stroke 2s cubic-bezier(.5,0,.5,1) infinite,rotate 2s linear infinite}@keyframes stroke{0%{stroke-dasharray:5.6548667765px 50.8938009883px;stroke-dashoffset:2.8274333882px}50%{stroke-dasharray:50.8938009883px 5.6548667765px;stroke-dashoffset:-2.8274333882px}to{stroke-dasharray:5.6548667765px 50.8938009883px;stroke-dashoffset:-53.7212343766px}}@keyframes rotate{0%{rotate:-110deg}to{rotate:250deg}}\n</style><div class="overlay">\n  <button title="Play / Pause" class="button ready" tabindex="0"></button>\n  <div class="message error">\n    An error occurred while loading the animation.\n  </div>\n  <svg\n    class="loader loading"\n    viewBox="0 0 24 24"\n    stroke="#ffffff"\n    stroke-width="2"\n    fill="transparent"\n  >\n    <circle cx="12" cy="12" r="9" />\n  </svg>\n</div>\n',this.overlay=this.root.querySelector(".overlay"),this.button=this.root.querySelector(".button"),this.canvas=this.stage.finalBuffer,this.canvas.classList.add("canvas"),this.root.prepend(this.canvas),this.overlay.addEventListener("click",this.handleClick),this.overlay.addEventListener("mousemove",this.handleMouseMove),this.overlay.addEventListener("mouseleave",this.handleMouseLeave),this.button.addEventListener("mousedown",this.handleMouseDown),this.setState("initial")}static get observedAttributes(){return["src","quality","width","height","auto","variables"]}get auto(){return!!this.getAttribute("auto")}get hover(){return"hover"===this.getAttribute("auto")}get quality(){const t=this.getAttribute("quality");return t?parseFloat(t):this.defaultSettings.resolutionScale}get width(){const t=this.getAttribute("width");return t?parseFloat(t):this.defaultSettings.size.width}get height(){const t=this.getAttribute("height");return t?parseFloat(t):this.defaultSettings.size.height}get variables(){try{const t=this.getAttribute("variables");return t?JSON.parse(t):{}}catch{return this.project.logger.warn("Project variables could not be parsed."),{}}}setState(t){this.state=t,this.setPlaying(this.playing)}setPlaying(t){var e,r;"ready"===this.state&&(t||this.auto&&!this.hover)?(null==(e=this.player)||e.togglePlayback(!0),this.playing=!0):(null==(r=this.player)||r.togglePlayback(!1),this.playing=!1),this.updateClass()}updateClass(){this.overlay.className=`overlay state-${this.state}`,this.canvas.className=`canvas state-${this.state}`,this.overlay.classList.toggle("playing",this.playing),this.overlay.classList.toggle("auto",this.auto),this.overlay.classList.toggle("hover",null!==this.mouseMoveId),this.connected&&(null===this.mouseMoveId&&this.playing?delete this.dataset.overlay:this.dataset.overlay="")}async updateSource(t){var e,r,s,i;let n;this.setState("initial"),null==(e=this.abortController)||e.abort(),this.abortController=new AbortController;try{const e=import(t),r=new Promise((t=>setTimeout(t,200)));await Promise.any([r,e]),this.setState("loading"),n=(await e).default}catch(o){return console.error(o),void this.setState("error")}this.defaultSettings=n.meta.getFullRenderingSettings();const a=new it(n);a.setVariables(this.variables),this.finished=!1,null==(r=this.player)||r.onRender.unsubscribe(this.render),null==(s=this.player)||s.togglePlayback(!1),null==(i=this.player)||i.deactivate(),this.project=n,this.player=a,this.updateSettings(),this.player.onRender.subscribe(this.render),this.player.togglePlayback(this.playing),this.setState("ready")}attributeChangedCallback(t,e,r){var s;switch(t){case"auto":this.setPlaying(this.playing);break;case"src":this.updateSource(r);break;case"quality":case"width":case"height":this.updateSettings();break;case"variables":null==(s=this.player)||s.setVariables(this.variables)}}disconnectedCallback(){var t,e;this.connected=!1,null==(t=this.player)||t.deactivate(),null==(e=this.player)||e.onRender.unsubscribe(this.render)}connectedCallback(){var t,e;this.connected=!0,null==(t=this.player)||t.activate(),null==(e=this.player)||e.onRender.subscribe(this.render)}updateSettings(){const t={...this.defaultSettings,size:new $t(this.width,this.height),resolutionScale:this.qual
11ity};this.stage.configure(t),this.player.configure(t)}}customElements.get(Jt)||customElements.define(Jt,Ut)}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.