Haleshot's picture
Update course materials and assets across various sections, including functional programming, optimization, probability, and Python. Enhance HTML content and ensure consistency in asset management.
565ea71 unverified
raw
history blame
23.6 kB
import{V as t,W as n,X as e,y as r,z as i,A as o,B as u,Y as a,Z as s,_ as l}from"./step-xJWGRC3d.js";var c="http://www.w3.org/1999/xhtml";const f={svg:"http://www.w3.org/2000/svg",xhtml:c,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function h(t){var n=t+="",e=n.indexOf(":");return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),f.hasOwnProperty(n)?{space:f[n],local:t}:t}function p(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===c&&n.documentElement.namespaceURI===c?n.createElement(t):n.createElementNS(e,t)}}function _(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function v(t){var n=h(t);return(n.local?_:p)(n)}function d(){}function y(t){return null==t?d:function(){return this.querySelector(t)}}function m(){return[]}function g(t){return null==t?m:function(){return this.querySelectorAll(t)}}function w(t){return function(){return null==(n=t.apply(this,arguments))?[]:Array.isArray(n)?n:Array.from(n);var n}}function A(t){return function(){return this.matches(t)}}function x(t){return function(n){return n.matches(t)}}var b=Array.prototype.find;function E(){return this.firstElementChild}var S=Array.prototype.filter;function N(){return Array.from(this.children)}function C(t){return new Array(t.length)}function k(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}function P(t,n,e,r,i,o){for(var u,a=0,s=n.length,l=o.length;a<l;++a)(u=n[a])?(u.__data__=o[a],r[a]=u):e[a]=new k(t,o[a]);for(;a<s;++a)(u=n[a])&&(i[a]=u)}function T(t,n,e,r,i,o,u){var a,s,l,c=new Map,f=n.length,h=o.length,p=new Array(f);for(a=0;a<f;++a)(s=n[a])&&(p[a]=l=u.call(s,s.__data__,a,n)+"",c.has(l)?i[a]=s:c.set(l,s));for(a=0;a<h;++a)l=u.call(t,o[a],a,o)+"",(s=c.get(l))?(r[a]=s,s.__data__=o[a],c.delete(l)):e[a]=new k(t,o[a]);for(a=0;a<f;++a)(s=n[a])&&c.get(p[a])===s&&(i[a]=s)}function L(t){return t.__data__}function B(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function M(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function q(t){return function(){this.removeAttribute(t)}}function D(t){return function(){this.removeAttributeNS(t.space,t.local)}}function O(t,n){return function(){this.setAttribute(t,n)}}function V(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function X(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function j(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function z(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Y(t){return function(){this.style.removeProperty(t)}}function H(t,n,e){return function(){this.style.setProperty(t,n,e)}}function I(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function R(t,n){return t.style.getPropertyValue(n)||z(t).getComputedStyle(t,null).getPropertyValue(n)}function U(t){return function(){delete this[t]}}function W(t,n){return function(){this[t]=n}}function Z(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function $(t){return t.trim().split(/^|\s+/)}function F(t){return t.classList||new G(t)}function G(t){this._node=t,this._names=$(t.getAttribute("class")||"")}function J(t,n){for(var e=F(t),r=-1,i=n.length;++r<i;)e.add(n[r])}function K(t,n){for(var e=F(t),r=-1,i=n.length;++r<i;)e.remove(n[r])}function Q(t){return function(){J(this,t)}}function tt(t){return function(){K(this,t)}}function nt(t,n){return function(){(n.apply(this,arguments)?J:K)(this,t)}}function et(){this.textContent=""}function rt(t){return function(){this.textContent=t}}function it(t){return function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}}function ot(){this.innerHTML=""}function ut(t){return function(){this.innerHTML=t}}function at(t){return function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}}function st(){this.nextSibling&&this.parentNode.appendChild(this)}function lt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ct(){return null}function ft(){var t=this.parentNode;t&&t.removeChild(this)}function ht(){var t=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function pt(){var t=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(t,this.nextSibling):t}function _t(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r<o;++r)e=n[r],t.type&&e.type!==t.type||e.name!==t.name?n[++i]=e:this.removeEventListener(e.type,e.listener,e.options);++i?n.length=i:delete this.__on}}}function vt(t,n,e){return function(){var r,i=this.__on,o=function(t){return function(n){t.call(this,n,this.__data__)}}(n);if(i)for(var u=0,a=i.length;u<a;++u)if((r=i[u]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=e),void(r.value=n);this.addEventListener(t.type,o,e),r={type:t.type,name:t.name,value:n,listener:o,options:e},i?i.push(r):this.__on=[r]}}function dt(t,n,e){var r=z(t),i=r.CustomEvent;"function"==typeof i?i=new i(n,e):(i=r.document.createEvent("Event"),e?(i.initEvent(n,e.bubbles,e.cancelable),i.detail=e.detail):i.initEvent(n,!1,!1)),t.dispatchEvent(i)}function yt(t,n){return function(){return dt(this,t,n)}}function mt(t,n){return function(){return dt(this,t,n.apply(this,arguments))}}k.prototype={constructor:k,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},G.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var n=this._names.indexOf(t);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var gt=[null];function wt(t,n){this._groups=t,this._parents=n}function At(){return new wt([[document.documentElement]],gt)}function xt(t){return"string"==typeof t?new wt([[document.querySelector(t)]],[document.documentElement]):new wt([[t]],gt)}function bt(n,e,r){var i=new t;return e=null==e?0:+e,i.restart((t=>{i.stop(),n(t+e)}),e,r),i}wt.prototype=At.prototype={constructor:wt,select:function(t){"function"!=typeof t&&(t=y(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u,a=n[i],s=a.length,l=r[i]=new Array(s),c=0;c<s;++c)(o=a[c])&&(u=t.call(o,o.__data__,c,a))&&("__data__"in o&&(u.__data__=o.__data__),l[c]=u);return new wt(r,this._parents)},selectAll:function(t){t="function"==typeof t?w(t):g(t);for(var n=this._groups,e=n.length,r=[],i=[],o=0;o<e;++o)for(var u,a=n[o],s=a.length,l=0;l<s;++l)(u=a[l])&&(r.push(t.call(u,u.__data__,l,a)),i.push(u));return new wt(r,i)},selectChild:function(t){return this.select(null==t?E:function(t){return function(){return b.call(this.children,t)}}("function"==typeof t?t:x(t)))},selectChildren:function(t){return this.selectAll(null==t?N:function(t){return function(){return S.call(this.children,t)}}("function"==typeof t?t:x(t)))},filter:function(t){"function"!=typeof t&&(t=A(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u=n[i],a=u.length,s=r[i]=[],l=0;l<a;++l)(o=u[l])&&t.call(o,o.__data__,l,u)&&s.push(o);return new wt(r,this._parents)},data:function(t,n){if(!arguments.length)return Array.from(this,L);var e,r=n?T:P,i=this._parents,o=this._groups;"function"!=typeof t&&(e=t,t=function(){return e});for(var u=o.length,a=new Array(u),s=new Array(u),l=new Array(u),c=0;c<u;++c){var f=i[c],h=o[c],p=h.length,_=B(t.call(f,f&&f.__data__,c,i)),v=_.length,d=s[c]=new Array(v),y=a[c]=new Array(v);r(f,h,d,y,l[c]=new Array(p),_,n);for(var m,g,w=0,A=0;w<v;++w)if(m=d[w]){for(w>=A&&(A=w+1);!(g=y[A])&&++A<v;);m._next=g||null}}return(a=new wt(a,i))._enter=s,a._exit=l,a},enter:function(){return new wt(this._enter||this._groups.map(C),this._parents)},exit:function(){return new wt(this._exit||this._groups.map(C),this._parents)},join:function(t,n,e){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=n&&(i=n(i))&&(i=i.selection()),null==e?o.remove():e(o),r&&i?r.merge(i).order():i},merge:function(t){for(var n=t.selection?t.selection():t,e=this._groups,r=n._groups,i=e.length,o=r.length,u=Math.min(i,o),a=new Array(i),s=0;s<u;++s)for(var l,c=e[s],f=r[s],h=c.length,p=a[s]=new Array(h),_=0;_<h;++_)(l=c[_]||f[_])&&(p[_]=l);for(;s<i;++s)a[s]=e[s];return new wt(a,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,n=-1,e=t.length;++n<e;)for(var r,i=t[n],o=i.length-1,u=i[o];--o>=0;)(r=i[o])&&(u&&4^r.compareDocumentPosition(u)&&u.parentNode.insertBefore(r,u),u=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=M);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var u,a=e[o],s=a.length,l=i[o]=new Array(s),c=0;c<s;++c)(u=a[c])&&(l[c]=u);l.sort(n)}return new wt(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r=t[n],i=0,o=r.length;i<o;++i){var u=r[i];if(u)return u}return null},size:function(){let t=0;for(const n of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var n=this._groups,e=0,r=n.length;e<r;++e)for(var i,o=n[e],u=0,a=o.length;u<a;++u)(i=o[u])&&t.call(i,i.__data__,u,o);return this},attr:function(t,n){var e=h(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?D:q:"function"==typeof n?e.local?j:X:e.local?V:O)(e,n))},style:function(t,n,e){return arguments.length>1?this.each((null==n?Y:"function"==typeof n?I:H)(t,n,null==e?"":e)):R(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?U:"function"==typeof n?Z:W)(t,n)):this.node()[t]},classed:function(t,n){var e=$(t+"");if(arguments.length<2){for(var r=F(this.node()),i=-1,o=e.length;++i<o;)if(!r.contains(e[i]))return!1;return!0}return this.each(("function"==typeof n?nt:n?Q:tt)(e,n))},text:function(t){return arguments.length?this.each(null==t?et:("function"==typeof t?it:rt)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?ot:("function"==typeof t?at:ut)(t)):this.node().innerHTML},raise:function(){return this.each(st)},lower:function(){return this.each(lt)},append:function(t){var n="function"==typeof t?t:v(t);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(t,n){var e="function"==typeof t?t:v(t),r=null==n?ct:"function"==typeof n?n:y(n);return this.select((function(){return this.insertBefore(e.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(ft)},clone:function(t){return this.select(t?pt:ht)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,n,e){var r,i,o=function(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}(t+""),u=o.length;if(!(arguments.length<2)){for(a=n?vt:_t,r=0;r<u;++r)this.each(a(o[r],n,e));return this}var a=this.node().__on;if(a)for(var s,l=0,c=a.length;l<c;++l)for(r=0,s=a[l];r<u;++r)if((i=o[r]).type===s.type&&i.name===s.name)return s.value},dispatch:function(t,n){return this.each(("function"==typeof n?mt:yt)(t,n))},[Symbol.iterator]:function*(){for(var t=this._groups,n=0,e=t.length;n<e;++n)for(var r,i=t[n],o=0,u=i.length;o<u;++o)(r=i[o])&&(yield r)}};var Et=e("start","end","cancel","interrupt"),St=[];function Nt(t,e,r,i,o,u){var a=t.__transition;if(a){if(r in a)return}else t.__transition={};!function(t,e,r){var i,o=t.__transition;function u(t){r.state=1,r.timer.restart(a,r.delay,r.time),r.delay<=t&&a(t-r.delay)}function a(n){var u,c,f,h;if(1!==r.state)return l();for(u in o)if((h=o[u]).name===r.name){if(3===h.state)return bt(a);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete o[u]):+u<e&&(h.state=6,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete o[u])}if(bt((function(){3===r.state&&(r.state=4,r.timer.restart(s,r.delay,r.time),s(n))})),r.state=2,r.on.call("start",t,t.__data__,r.index,r.group),2===r.state){for(r.state=3,i=new Array(f=r.tween.length),u=0,c=-1;u<f;++u)(h=r.tween[u].value.call(t,t.__data__,r.index,r.group))&&(i[++c]=h);i.length=c+1}}function s(n){for(var e=n<r.duration?r.ease.call(null,n/r.duration):(r.timer.restart(l),r.state=5,1),o=-1,u=i.length;++o<u;)i[o].call(t,e);5===r.state&&(r.on.call("end",t,t.__data__,r.index,r.group),l())}function l(){for(var n in r.state=6,r.timer.stop(),delete o[e],o)return;delete t.__transition}o[e]=r,r.timer=n(u,0,r.time)}(t,r,{name:e,index:i,group:o,on:Et,tween:St,time:u.time,delay:u.delay,duration:u.duration,ease:u.ease,timer:null,state:0})}function Ct(t,n){var e=Pt(t,n);if(e.state>0)throw new Error("too late; already scheduled");return e}function kt(t,n){var e=Pt(t,n);if(e.state>3)throw new Error("too late; already running");return e}function Pt(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function Tt(t,n){var e,r,i,o=t.__transition,u=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>2&&e.state<5,e.state=6,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete o[i]):u=!1;u&&delete t.__transition}}function Lt(t,n){var e,r;return function(){var i=kt(this,t),o=i.tween;if(o!==e)for(var u=0,a=(r=e=o).length;u<a;++u)if(r[u].name===n){(r=r.slice()).splice(u,1);break}i.tween=r}}function Bt(t,n,e){var r,i;if("function"!=typeof e)throw new Error;return function(){var o=kt(this,t),u=o.tween;if(u!==r){i=(r=u).slice();for(var a={name:n,value:e},s=0,l=i.length;s<l;++s)if(i[s].name===n){i[s]=a;break}s===l&&i.push(a)}o.tween=i}}function Mt(t,n,e){var r=t._id;return t.each((function(){var t=kt(this,r);(t.value||(t.value={}))[n]=e.apply(this,arguments)})),function(t){return Pt(t,r).value[n]}}function qt(t,n){var e;return("number"==typeof n?r:n instanceof u?i:(e=u(n))?(n=e,i):o)(t,n)}function Dt(t){return function(){this.removeAttribute(t)}}function Ot(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Vt(t,n,e){var r,i,o=e+"";return function(){var u=this.getAttribute(t);return u===o?null:u===r?i:i=n(r=u,e)}}function Xt(t,n,e){var r,i,o=e+"";return function(){var u=this.getAttributeNS(t.space,t.local);return u===o?null:u===r?i:i=n(r=u,e)}}function jt(t,n,e){var r,i,o;return function(){var u,a,s=e(this);if(null!=s)return(u=this.getAttribute(t))===(a=s+"")?null:u===r&&a===i?o:(i=a,o=n(r=u,s));this.removeAttribute(t)}}function zt(t,n,e){var r,i,o;return function(){var u,a,s=e(this);if(null!=s)return(u=this.getAttributeNS(t.space,t.local))===(a=s+"")?null:u===r&&a===i?o:(i=a,o=n(r=u,s));this.removeAttributeNS(t.space,t.local)}}function Yt(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttributeNS(t.space,t.local,n.call(this,e))}}(t,i)),e}return i._value=n,i}function Ht(t,n){var e,r;function i(){var i=n.apply(this,arguments);return i!==r&&(e=(r=i)&&function(t,n){return function(e){this.setAttribute(t,n.call(this,e))}}(t,i)),e}return i._value=n,i}function It(t,n){return function(){Ct(this,t).delay=+n.apply(this,arguments)}}function Rt(t,n){return n=+n,function(){Ct(this,t).delay=n}}function Ut(t,n){return function(){kt(this,t).duration=+n.apply(this,arguments)}}function Wt(t,n){return n=+n,function(){kt(this,t).duration=n}}var Zt=At.prototype.constructor;function $t(t){return function(){this.style.removeProperty(t)}}var Ft=0;function Gt(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function Jt(){return++Ft}var Kt=At.prototype;Gt.prototype={constructor:Gt,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=y(t));for(var r=this._groups,i=r.length,o=new Array(i),u=0;u<i;++u)for(var a,s,l=r[u],c=l.length,f=o[u]=new Array(c),h=0;h<c;++h)(a=l[h])&&(s=t.call(a,a.__data__,h,l))&&("__data__"in a&&(s.__data__=a.__data__),f[h]=s,Nt(f[h],n,e,h,f,Pt(a,e)));return new Gt(o,this._parents,n,e)},selectAll:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=g(t));for(var r=this._groups,i=r.length,o=[],u=[],a=0;a<i;++a)for(var s,l=r[a],c=l.length,f=0;f<c;++f)if(s=l[f]){for(var h,p=t.call(s,s.__data__,f,l),_=Pt(s,e),v=0,d=p.length;v<d;++v)(h=p[v])&&Nt(h,n,e,v,p,_);o.push(p),u.push(s)}return new Gt(o,u,n,e)},selectChild:Kt.selectChild,selectChildren:Kt.selectChildren,filter:function(t){"function"!=typeof t&&(t=A(t));for(var n=this._groups,e=n.length,r=new Array(e),i=0;i<e;++i)for(var o,u=n[i],a=u.length,s=r[i]=[],l=0;l<a;++l)(o=u[l])&&t.call(o,o.__data__,l,u)&&s.push(o);return new Gt(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var n=this._groups,e=t._groups,r=n.length,i=e.length,o=Math.min(r,i),u=new Array(r),a=0;a<o;++a)for(var s,l=n[a],c=e[a],f=l.length,h=u[a]=new Array(f),p=0;p<f;++p)(s=l[p]||c[p])&&(h[p]=s);for(;a<r;++a)u[a]=n[a];return new Gt(u,this._parents,this._name,this._id)},selection:function(){return new Zt(this._groups,this._parents)},transition:function(){for(var t=this._name,n=this._id,e=Jt(),r=this._groups,i=r.length,o=0;o<i;++o)for(var u,a=r[o],s=a.length,l=0;l<s;++l)if(u=a[l]){var c=Pt(u,n);Nt(u,t,e,l,a,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Gt(r,this._parents,t,e)},call:Kt.call,nodes:Kt.nodes,node:Kt.node,size:Kt.size,empty:Kt.empty,each:Kt.each,on:function(t,n){var e=this._id;return arguments.length<2?Pt(this.node(),e).on.on(t):this.each(function(t,n,e){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?Ct:kt;return function(){var u=o(this,t),a=u.on;a!==r&&(i=(r=a).copy()).on(n,e),u.on=i}}(e,t,n))},attr:function(t,n){var e=h(t),r="transform"===e?a:qt;return this.attrTween(t,"function"==typeof n?(e.local?zt:jt)(e,r,Mt(this,"attr."+t,n)):null==n?(e.local?Ot:Dt)(e):(e.local?Xt:Vt)(e,r,n))},attrTween:function(t,n){var e="attr."+t;if(arguments.length<2)return(e=this.tween(e))&&e._value;if(null==n)return this.tween(e,null);if("function"!=typeof n)throw new Error;var r=h(t);return this.tween(e,(r.local?Yt:Ht)(r,n))},style:function(t,n,e){var r="transform"==(t+="")?s:qt;return null==n?this.styleTween(t,function(t,n){var e,r,i;return function(){var o=R(this,t),u=(this.style.removeProperty(t),R(this,t));return o===u?null:o===e&&u===r?i:i=n(e=o,r=u)}}(t,r)).on("end.style."+t,$t(t)):"function"==typeof n?this.styleTween(t,function(t,n,e){var r,i,o;return function(){var u=R(this,t),a=e(this),s=a+"";return null==a&&(this.style.removeProperty(t),s=a=R(this,t)),u===s?null:u===r&&s===i?o:(i=s,o=n(r=u,a))}}(t,r,Mt(this,"style."+t,n))).each(function(t,n){var e,r,i,o,u="style."+n,a="end."+u;return function(){var s=kt(this,t),l=s.on,c=null==s.value[u]?o||(o=$t(n)):void 0;l===e&&i===c||(r=(e=l).copy()).on(a,i=c),s.on=r}}(this._id,t)):this.styleTween(t,function(t,n,e){var r,i,o=e+"";return function(){var u=R(this,t);return u===o?null:u===r?i:i=n(r=u,e)}}(t,r,n),e).on("end.style."+t,null)},styleTween:function(t,n,e){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}(t,o,e)),r}return o._value=n,o}(t,n,null==e?"":e))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var n=t(this);this.textContent=null==n?"":n}}(Mt(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;return this.tween(n,function(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&function(t){return function(n){this.textContent=t.call(this,n)}}(r)),n}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",(t=this._id,function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}));var t},tween:function(t,n){var e=this._id;if(t+="",arguments.length<2){for(var r,i=Pt(this.node(),e).tween,o=0,u=i.length;o<u;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==n?Lt:Bt)(e,t,n))},delay:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?It:Rt)(n,t)):Pt(this.node(),n).delay},duration:function(t){var n=this._id;return arguments.length?this.each(("function"==typeof t?Ut:Wt)(n,t)):Pt(this.node(),n).duration},ease:function(t){var n=this._id;return arguments.length?this.each(function(t,n){if("function"!=typeof n)throw new Error;return function(){kt(this,t).ease=n}}(n,t)):Pt(this.node(),n).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,n){return function(){var e=n.apply(this,arguments);if("function"!=typeof e)throw new Error;kt(this,t).ease=e}}(this._id,t))},end:function(){var t,n,e=this,r=e._id,i=e.size();return new Promise((function(o,u){var a={value:u},s={value:function(){0==--i&&o()}};e.each((function(){var e=kt(this,r),i=e.on;i!==t&&((n=(t=i).copy())._.cancel.push(a),n._.interrupt.push(a),n._.end.push(s)),e.on=n})),0===i&&o()}))},[Symbol.iterator]:Kt[Symbol.iterator]};var Qt={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function tn(t,n){for(var e;!(e=t.__transition)||!(e=e[n]);)if(!(t=t.parentNode))throw new Error(`transition ${n} not found`);return e}function nn(t,n,e){this.k=t,this.x=n,this.y=e}At.prototype.interrupt=function(t){return this.each((function(){Tt(this,t)}))},At.prototype.transition=function(t){var n,e;t instanceof Gt?(n=t._id,t=t._name):(n=Jt(),(e=Qt).time=l(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var u,a=r[o],s=a.length,c=0;c<s;++c)(u=a[c])&&Nt(u,t,n,c,a,e||tn(u,n));return new Gt(r,this._parents,t,n)},nn.prototype={constructor:nn,scale:function(t){return 1===t?this:new nn(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new nn(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var en=new nn(1,0,0);nn.prototype;export{nn as T,Tt as a,en as i,xt as s};