UNPKG

vue3-fortune-wheel

Version:
1 lines 55.8 kB
(function(Z,_){typeof exports=="object"&&typeof module<"u"?_(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],_):(Z=typeof globalThis<"u"?globalThis:Z||self,_(Z.FortuneWheel={},Z.Vue))})(this,function(Z,_){"use strict";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const ge=()=>{};function un(t,e){function n(...r){return new Promise((i,o)=>{Promise.resolve(t(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})).then(i).catch(o)})}return n}function cn(t,e={}){let n,r,i=ge;const o=l=>{clearTimeout(l),i(),i=ge};let a;return l=>{const c=_.toValue(t),u=_.toValue(e.maxWait);return n&&o(n),c<=0||u!==void 0&&u<=0?(r&&(o(r),r=null),Promise.resolve(l())):new Promise((h,f)=>{i=e.rejectOnCancel?f:h,a=l,u&&!r&&(r=setTimeout(()=>{n&&o(n),r=null,h(a())},u)),n=setTimeout(()=>{r&&o(r),r=null,h(l())},c)})}}function fn(t,e=200,n={}){return un(cn(e,n),t)}const hn=20;function dn(){const t=_.ref({width:600}),e=_.ref({width:600,height:600}),n=()=>{if(typeof window<"u"){const o=window.innerWidth,a=Math.min(o,t.value.width)-hn,s=Math.min(o,t.value.width)+120;e.value={width:a,height:s}}};_.onMounted(()=>{n()});const r=_.computed(()=>e.value),i=_.computed(()=>({width:`${r.value.width}px`,height:`${r.value.height}px`,margin:"0 auto","will-change":"transform",transform:"translate3d(0,0,0)","backface-visibility":"hidden",perspective:"1000px",contain:"layout paint",isolation:"isolate"}));return{wheelSize:r,wheelStyle:i}}var pn={value:()=>{}};function me(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new wt(n)}function wt(t){this._=t}function gn(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}wt.prototype=me.prototype={constructor:wt,on:function(t,e){var n=this._,r=gn(t+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o<a;)if((i=(t=r[o]).type)&&(i=mn(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<a;)if(i=(t=r[o]).type)n[i]=ye(n[i],t.name,e);else if(e==null)for(i in n)n[i]=ye(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new wt(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};function mn(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function ye(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=pn,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var Bt="http://www.w3.org/1999/xhtml";const we={svg:"http://www.w3.org/2000/svg",xhtml:Bt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function _t(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),we.hasOwnProperty(e)?{space:we[e],local:t}:t}function yn(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Bt&&e.documentElement.namespaceURI===Bt?e.createElement(t):e.createElementNS(n,t)}}function wn(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function _e(t){var e=_t(t);return(e.local?wn:yn)(e)}function _n(){}function Ht(t){return t==null?_n:function(){return this.querySelector(t)}}function xn(t){typeof t!="function"&&(t=Ht(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],a=o.length,s=r[i]=new Array(a),l,c,u=0;u<a;++u)(l=o[u])&&(c=t.call(l,l.__data__,u,o))&&("__data__"in l&&(c.__data__=l.__data__),s[u]=c);return new F(r,this._parents)}function vn(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function $n(){return[]}function xe(t){return t==null?$n:function(){return this.querySelectorAll(t)}}function An(t){return function(){return vn(t.apply(this,arguments))}}function bn(t){typeof t=="function"?t=An(t):t=xe(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a=e[o],s=a.length,l,c=0;c<s;++c)(l=a[c])&&(r.push(t.call(l,l.__data__,c,a)),i.push(l));return new F(r,i)}function ve(t){return function(){return this.matches(t)}}function $e(t){return function(e){return e.matches(t)}}var En=Array.prototype.find;function kn(t){return function(){return En.call(this.children,t)}}function Mn(){return this.firstElementChild}function Nn(t){return this.select(t==null?Mn:kn(typeof t=="function"?t:$e(t)))}var Sn=Array.prototype.filter;function Rn(){return Array.from(this.children)}function Tn(t){return function(){return Sn.call(this.children,t)}}function Cn(t){return this.selectAll(t==null?Rn:Tn(typeof t=="function"?t:$e(t)))}function Fn(t){typeof t!="function"&&(t=ve(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],a=o.length,s=r[i]=[],l,c=0;c<a;++c)(l=o[c])&&t.call(l,l.__data__,c,o)&&s.push(l);return new F(r,this._parents)}function Ae(t){return new Array(t.length)}function In(){return new F(this._enter||this._groups.map(Ae),this._parents)}function xt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}xt.prototype={constructor:xt,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Pn(t){return function(){return t}}function On(t,e,n,r,i,o){for(var a=0,s,l=e.length,c=o.length;a<c;++a)(s=e[a])?(s.__data__=o[a],r[a]=s):n[a]=new xt(t,o[a]);for(;a<l;++a)(s=e[a])&&(i[a]=s)}function Dn(t,e,n,r,i,o,a){var s,l,c=new Map,u=e.length,h=o.length,f=new Array(u),d;for(s=0;s<u;++s)(l=e[s])&&(f[s]=d=a.call(l,l.__data__,s,e)+"",c.has(d)?i[s]=l:c.set(d,l));for(s=0;s<h;++s)d=a.call(t,o[s],s,o)+"",(l=c.get(d))?(r[s]=l,l.__data__=o[s],c.delete(d)):n[s]=new xt(t,o[s]);for(s=0;s<u;++s)(l=e[s])&&c.get(f[s])===l&&(i[s]=l)}function qn(t){return t.__data__}function Vn(t,e){if(!arguments.length)return Array.from(this,qn);var n=e?Dn:On,r=this._parents,i=this._groups;typeof t!="function"&&(t=Pn(t));for(var o=i.length,a=new Array(o),s=new Array(o),l=new Array(o),c=0;c<o;++c){var u=r[c],h=i[c],f=h.length,d=Ln(t.call(u,u&&u.__data__,c,r)),g=d.length,y=s[c]=new Array(g),b=a[c]=new Array(g),$=l[c]=new Array(f);n(u,h,y,b,$,d,e);for(var p=0,x=0,m,v;p<g;++p)if(m=y[p]){for(p>=x&&(x=p+1);!(v=b[x])&&++x<g;);m._next=v||null}}return a=new F(a,r),a._enter=s,a._exit=l,a}function Ln(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Wn(){return new F(this._exit||this._groups.map(Ae),this._parents)}function Bn(t,e,n){var r=this.enter(),i=this,o=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function Hn(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),l=0;l<a;++l)for(var c=n[l],u=r[l],h=c.length,f=s[l]=new Array(h),d,g=0;g<h;++g)(d=c[g]||u[g])&&(f[g]=d);for(;l<i;++l)s[l]=n[l];return new F(s,this._parents)}function Gn(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,o=r[i],a;--i>=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function Xn(t){t||(t=Un);function e(h,f){return h&&f?t(h.__data__,f.__data__):!h-!f}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a=n[o],s=a.length,l=i[o]=new Array(s),c,u=0;u<s;++u)(c=a[u])&&(l[u]=c);l.sort(e)}return new F(i,this._parents).order()}function Un(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function zn(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Yn(){return Array.from(this)}function Kn(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null}function Zn(){let t=0;for(const e of this)++t;return t}function Qn(){return!this.node()}function Jn(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,a=i.length,s;o<a;++o)(s=i[o])&&t.call(s,s.__data__,o,i);return this}function jn(t){return function(){this.removeAttribute(t)}}function tr(t){return function(){this.removeAttributeNS(t.space,t.local)}}function er(t,e){return function(){this.setAttribute(t,e)}}function nr(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function rr(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function ir(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function or(t,e){var n=_t(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?tr:jn:typeof e=="function"?n.local?ir:rr:n.local?nr:er)(n,e))}function be(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ar(t){return function(){this.style.removeProperty(t)}}function sr(t,e,n){return function(){this.style.setProperty(t,e,n)}}function lr(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function ur(t,e,n){return arguments.length>1?this.each((e==null?ar:typeof e=="function"?lr:sr)(t,e,n??"")):rt(this.node(),t)}function rt(t,e){return t.style.getPropertyValue(e)||be(t).getComputedStyle(t,null).getPropertyValue(e)}function cr(t){return function(){delete this[t]}}function fr(t,e){return function(){this[t]=e}}function hr(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function dr(t,e){return arguments.length>1?this.each((e==null?cr:typeof e=="function"?hr:fr)(t,e)):this.node()[t]}function Ee(t){return t.trim().split(/^|\s+/)}function Gt(t){return t.classList||new ke(t)}function ke(t){this._node=t,this._names=Ee(t.getAttribute("class")||"")}ke.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Me(t,e){for(var n=Gt(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function Ne(t,e){for(var n=Gt(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function pr(t){return function(){Me(this,t)}}function gr(t){return function(){Ne(this,t)}}function mr(t,e){return function(){(e.apply(this,arguments)?Me:Ne)(this,t)}}function yr(t,e){var n=Ee(t+"");if(arguments.length<2){for(var r=Gt(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?mr:e?pr:gr)(n,e))}function wr(){this.textContent=""}function _r(t){return function(){this.textContent=t}}function xr(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function vr(t){return arguments.length?this.each(t==null?wr:(typeof t=="function"?xr:_r)(t)):this.node().textContent}function $r(){this.innerHTML=""}function Ar(t){return function(){this.innerHTML=t}}function br(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Er(t){return arguments.length?this.each(t==null?$r:(typeof t=="function"?br:Ar)(t)):this.node().innerHTML}function kr(){this.nextSibling&&this.parentNode.appendChild(this)}function Mr(){return this.each(kr)}function Nr(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Sr(){return this.each(Nr)}function Rr(t){var e=typeof t=="function"?t:_e(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Tr(){return null}function Cr(t,e){var n=typeof t=="function"?t:_e(t),r=e==null?Tr:typeof e=="function"?e:Ht(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Fr(){var t=this.parentNode;t&&t.removeChild(this)}function Ir(){return this.each(Fr)}function Pr(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Or(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Dr(t){return this.select(t?Or:Pr)}function qr(t){return arguments.length?this.property("__data__",t):this.node().__data__}function Vr(t){return function(e){t.call(this,e,this.__data__)}}function Lr(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function Wr(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,o;n<i;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++r]=o;++r?e.length=r:delete this.__on}}}function Br(t,e,n){return function(){var r=this.__on,i,o=Vr(e);if(r){for(var a=0,s=r.length;a<s;++a)if((i=r[a]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=e;return}}this.addEventListener(t.type,o,n),i={type:t.type,name:t.name,value:e,listener:o,options:n},r?r.push(i):this.__on=[i]}}function Hr(t,e,n){var r=Lr(t+""),i,o=r.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var l=0,c=s.length,u;l<c;++l)for(i=0,u=s[l];i<o;++i)if((a=r[i]).type===u.type&&a.name===u.name)return u.value}return}for(s=e?Br:Wr,i=0;i<o;++i)this.each(s(r[i],e,n));return this}function Se(t,e,n){var r=be(t),i=r.CustomEvent;typeof i=="function"?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Gr(t,e){return function(){return Se(this,t,e)}}function Xr(t,e){return function(){return Se(this,t,e.apply(this,arguments))}}function Ur(t,e){return this.each((typeof e=="function"?Xr:Gr)(t,e))}function*zr(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length,a;i<o;++i)(a=r[i])&&(yield a)}var Re=[null];function F(t,e){this._groups=t,this._parents=e}function lt(){return new F([[document.documentElement]],Re)}function Yr(){return this}F.prototype=lt.prototype={constructor:F,select:xn,selectAll:bn,selectChild:Nn,selectChildren:Cn,filter:Fn,data:Vn,enter:In,exit:Wn,join:Bn,merge:Hn,selection:Yr,order:Gn,sort:Xn,call:zn,nodes:Yn,node:Kn,size:Zn,empty:Qn,each:Jn,attr:or,style:ur,property:dr,classed:yr,text:vr,html:Er,raise:Mr,lower:Sr,append:Rr,insert:Cr,remove:Ir,clone:Dr,datum:qr,on:Hr,dispatch:Ur,[Symbol.iterator]:zr};function R(t){return typeof t=="string"?new F([[document.querySelector(t)]],[document.documentElement]):new F([[t]],Re)}function Xt(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Te(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ut(){}var ct=.7,vt=1/ct,it="\\s*([+-]?\\d+)\\s*",ft="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",L="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Kr=/^#([0-9a-f]{3,8})$/,Zr=new RegExp(`^rgb\\(${it},${it},${it}\\)$`),Qr=new RegExp(`^rgb\\(${L},${L},${L}\\)$`),Jr=new RegExp(`^rgba\\(${it},${it},${it},${ft}\\)$`),jr=new RegExp(`^rgba\\(${L},${L},${L},${ft}\\)$`),ti=new RegExp(`^hsl\\(${ft},${L},${L}\\)$`),ei=new RegExp(`^hsla\\(${ft},${L},${L},${ft}\\)$`),Ce={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Xt(ut,Q,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Fe,formatHex:Fe,formatHex8:ni,formatHsl:ri,formatRgb:Ie,toString:Ie});function Fe(){return this.rgb().formatHex()}function ni(){return this.rgb().formatHex8()}function ri(){return Ve(this).formatHsl()}function Ie(){return this.rgb().formatRgb()}function Q(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Kr.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Pe(e):n===3?new T(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?$t(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?$t(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Zr.exec(t))?new T(e[1],e[2],e[3],1):(e=Qr.exec(t))?new T(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Jr.exec(t))?$t(e[1],e[2],e[3],e[4]):(e=jr.exec(t))?$t(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=ti.exec(t))?qe(e[1],e[2]/100,e[3]/100,1):(e=ei.exec(t))?qe(e[1],e[2]/100,e[3]/100,e[4]):Ce.hasOwnProperty(t)?Pe(Ce[t]):t==="transparent"?new T(NaN,NaN,NaN,0):null}function Pe(t){return new T(t>>16&255,t>>8&255,t&255,1)}function $t(t,e,n,r){return r<=0&&(t=e=n=NaN),new T(t,e,n,r)}function ii(t){return t instanceof ut||(t=Q(t)),t?(t=t.rgb(),new T(t.r,t.g,t.b,t.opacity)):new T}function Ut(t,e,n,r){return arguments.length===1?ii(t):new T(t,e,n,r??1)}function T(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}Xt(T,Ut,Te(ut,{brighter(t){return t=t==null?vt:Math.pow(vt,t),new T(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ct:Math.pow(ct,t),new T(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new T(J(this.r),J(this.g),J(this.b),At(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Oe,formatHex:Oe,formatHex8:oi,formatRgb:De,toString:De}));function Oe(){return`#${j(this.r)}${j(this.g)}${j(this.b)}`}function oi(){return`#${j(this.r)}${j(this.g)}${j(this.b)}${j((isNaN(this.opacity)?1:this.opacity)*255)}`}function De(){const t=At(this.opacity);return`${t===1?"rgb(":"rgba("}${J(this.r)}, ${J(this.g)}, ${J(this.b)}${t===1?")":`, ${t})`}`}function At(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function J(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function j(t){return t=J(t),(t<16?"0":"")+t.toString(16)}function qe(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new P(t,e,n,r)}function Ve(t){if(t instanceof P)return new P(t.h,t.s,t.l,t.opacity);if(t instanceof ut||(t=Q(t)),!t)return new P;if(t instanceof P)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(e===o?a=(n-r)/s+(n<r)*6:n===o?a=(r-e)/s+2:a=(e-n)/s+4,s/=l<.5?o+i:2-o-i,a*=60):s=l>0&&l<1?0:a,new P(a,s,l,t.opacity)}function ai(t,e,n,r){return arguments.length===1?Ve(t):new P(t,e,n,r??1)}function P(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}Xt(P,ai,Te(ut,{brighter(t){return t=t==null?vt:Math.pow(vt,t),new P(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ct:Math.pow(ct,t),new P(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new T(zt(t>=240?t-240:t+120,i,r),zt(t,i,r),zt(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new P(Le(this.h),bt(this.s),bt(this.l),At(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=At(this.opacity);return`${t===1?"hsl(":"hsla("}${Le(this.h)}, ${bt(this.s)*100}%, ${bt(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Le(t){return t=(t||0)%360,t<0?t+360:t}function bt(t){return Math.max(0,Math.min(1,t||0))}function zt(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Yt=t=>()=>t;function si(t,e){return function(n){return t+n*e}}function li(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function ui(t){return(t=+t)==1?We:function(e,n){return n-e?li(e,n,t):Yt(isNaN(e)?n:e)}}function We(t,e){var n=e-t;return n?si(t,n):Yt(isNaN(t)?e:t)}const Et=function t(e){var n=ui(e);function r(i,o){var a=n((i=Ut(i)).r,(o=Ut(o)).r),s=n(i.g,o.g),l=n(i.b,o.b),c=We(i.opacity,o.opacity);return function(u){return i.r=a(u),i.g=s(u),i.b=l(u),i.opacity=c(u),i+""}}return r.gamma=t,r}(1);function ci(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=t[i]*(1-o)+e[i]*o;return r}}function fi(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function hi(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,i=new Array(r),o=new Array(n),a;for(a=0;a<r;++a)i[a]=Qt(t[a],e[a]);for(;a<n;++a)o[a]=e[a];return function(s){for(a=0;a<r;++a)o[a]=i[a](s);return o}}function di(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function W(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function pi(t,e){var n={},r={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?n[i]=Qt(t[i],e[i]):r[i]=e[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var Kt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Zt=new RegExp(Kt.source,"g");function gi(t){return function(){return t}}function mi(t){return function(e){return t(e)+""}}function Be(t,e){var n=Kt.lastIndex=Zt.lastIndex=0,r,i,o,a=-1,s=[],l=[];for(t=t+"",e=e+"";(r=Kt.exec(t))&&(i=Zt.exec(e));)(o=i.index)>n&&(o=e.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:W(r,i)})),n=Zt.lastIndex;return n<e.length&&(o=e.slice(n),s[a]?s[a]+=o:s[++a]=o),s.length<2?l[0]?mi(l[0].x):gi(e):(e=l.length,function(c){for(var u=0,h;u<e;++u)s[(h=l[u]).i]=h.x(c);return s.join("")})}function Qt(t,e){var n=typeof e,r;return e==null||n==="boolean"?Yt(e):(n==="number"?W:n==="string"?(r=Q(e))?(e=r,Et):Be:e instanceof Q?Et:e instanceof Date?di:fi(e)?ci:Array.isArray(e)?hi:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?pi:W)(t,e)}var He=180/Math.PI,Jt={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ge(t,e,n,r,i,o){var a,s,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),t*r<e*n&&(t=-t,e=-e,l=-l,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*He,skewX:Math.atan(l)*He,scaleX:a,scaleY:s}}var kt;function yi(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Jt:Ge(e.a,e.b,e.c,e.d,e.e,e.f)}function wi(t){return t==null||(kt||(kt=document.createElementNS("http://www.w3.org/2000/svg","g")),kt.setAttribute("transform",t),!(t=kt.transform.baseVal.consolidate()))?Jt:(t=t.matrix,Ge(t.a,t.b,t.c,t.d,t.e,t.f))}function Xe(t,e,n,r){function i(c){return c.length?c.pop()+" ":""}function o(c,u,h,f,d,g){if(c!==h||u!==f){var y=d.push("translate(",null,e,null,n);g.push({i:y-4,x:W(c,h)},{i:y-2,x:W(u,f)})}else(h||f)&&d.push("translate("+h+e+f+n)}function a(c,u,h,f){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),f.push({i:h.push(i(h)+"rotate(",null,r)-2,x:W(c,u)})):u&&h.push(i(h)+"rotate("+u+r)}function s(c,u,h,f){c!==u?f.push({i:h.push(i(h)+"skewX(",null,r)-2,x:W(c,u)}):u&&h.push(i(h)+"skewX("+u+r)}function l(c,u,h,f,d,g){if(c!==h||u!==f){var y=d.push(i(d)+"scale(",null,",",null,")");g.push({i:y-4,x:W(c,h)},{i:y-2,x:W(u,f)})}else(h!==1||f!==1)&&d.push(i(d)+"scale("+h+","+f+")")}return function(c,u){var h=[],f=[];return c=t(c),u=t(u),o(c.translateX,c.translateY,u.translateX,u.translateY,h,f),a(c.rotate,u.rotate,h,f),s(c.skewX,u.skewX,h,f),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,h,f),c=u=null,function(d){for(var g=-1,y=f.length,b;++g<y;)h[(b=f[g]).i]=b.x(d);return h.join("")}}}var _i=Xe(yi,"px, ","px)","deg)"),xi=Xe(wi,", ",")",")"),ot=0,ht=0,dt=0,Ue=1e3,Mt,pt,Nt=0,tt=0,St=0,gt=typeof performance=="object"&&performance.now?performance:Date,ze=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function jt(){return tt||(ze(vi),tt=gt.now()+St)}function vi(){tt=0}function Rt(){this._call=this._time=this._next=null}Rt.prototype=Ye.prototype={constructor:Rt,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?jt():+n)+(e==null?0:+e),!this._next&&pt!==this&&(pt?pt._next=this:Mt=this,pt=this),this._call=t,this._time=n,te()},stop:function(){this._call&&(this._call=null,this._time=1/0,te())}};function Ye(t,e,n){var r=new Rt;return r.restart(t,e,n),r}function $i(){jt(),++ot;for(var t=Mt,e;t;)(e=tt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--ot}function Ke(){tt=(Nt=gt.now())+St,ot=ht=0;try{$i()}finally{ot=0,bi(),tt=0}}function Ai(){var t=gt.now(),e=t-Nt;e>Ue&&(St-=e,Nt=t)}function bi(){for(var t,e=Mt,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Mt=n);pt=t,te(r)}function te(t){if(!ot){ht&&(ht=clearTimeout(ht));var e=t-tt;e>24?(t<1/0&&(ht=setTimeout(Ke,t-gt.now()-St)),dt&&(dt=clearInterval(dt))):(dt||(Nt=gt.now(),dt=setInterval(Ai,Ue)),ot=1,ze(Ke))}}function Ze(t,e,n){var r=new Rt;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}var Ei=me("start","end","cancel","interrupt"),ki=[],Qe=0,Je=1,ee=2,Tt=3,je=4,ne=5,Ct=6;function Ft(t,e,n,r,i,o){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;Mi(t,n,{name:e,index:r,group:i,on:Ei,tween:ki,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Qe})}function re(t,e){var n=O(t,e);if(n.state>Qe)throw new Error("too late; already scheduled");return n}function B(t,e){var n=O(t,e);if(n.state>Tt)throw new Error("too late; already running");return n}function O(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Mi(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=Ye(o,0,n.time);function o(c){n.state=Je,n.timer.restart(a,n.delay,n.time),n.delay<=c&&a(c-n.delay)}function a(c){var u,h,f,d;if(n.state!==Je)return l();for(u in r)if(d=r[u],d.name===n.name){if(d.state===Tt)return Ze(a);d.state===je?(d.state=Ct,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete r[u]):+u<e&&(d.state=Ct,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete r[u])}if(Ze(function(){n.state===Tt&&(n.state=je,n.timer.restart(s,n.delay,n.time),s(c))}),n.state=ee,n.on.call("start",t,t.__data__,n.index,n.group),n.state===ee){for(n.state=Tt,i=new Array(f=n.tween.length),u=0,h=-1;u<f;++u)(d=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(i[++h]=d);i.length=h+1}}function s(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=ne,1),h=-1,f=i.length;++h<f;)i[h].call(t,u);n.state===ne&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){n.state=Ct,n.timer.stop(),delete r[e];for(var c in r)return;delete t.__transition}}function Ni(t,e){var n=t.__transition,r,i,o=!0,a;if(n){e=e==null?null:e+"";for(a in n){if((r=n[a]).name!==e){o=!1;continue}i=r.state>ee&&r.state<ne,r.state=Ct,r.timer.stop(),r.on.call(i?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[a]}o&&delete t.__transition}}function Si(t){return this.each(function(){Ni(this,t)})}function Ri(t,e){var n,r;return function(){var i=B(this,t),o=i.tween;if(o!==n){r=n=o;for(var a=0,s=r.length;a<s;++a)if(r[a].name===e){r=r.slice(),r.splice(a,1);break}}i.tween=r}}function Ti(t,e,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=B(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:e,value:n},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=s;break}l===c&&i.push(s)}o.tween=i}}function Ci(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=O(this.node(),n).tween,i=0,o=r.length,a;i<o;++i)if((a=r[i]).name===t)return a.value;return null}return this.each((e==null?Ri:Ti)(n,t,e))}function ie(t,e,n){var r=t._id;return t.each(function(){var i=B(this,r);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return O(i,r).value[e]}}function tn(t,e){var n;return(typeof e=="number"?W:e instanceof Q?Et:(n=Q(e))?(e=n,Et):Be)(t,e)}function Fi(t){return function(){this.removeAttribute(t)}}function Ii(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Pi(t,e,n){var r,i=n+"",o;return function(){var a=this.getAttribute(t);return a===i?null:a===r?o:o=e(r=a,n)}}function Oi(t,e,n){var r,i=n+"",o;return function(){var a=this.getAttributeNS(t.space,t.local);return a===i?null:a===r?o:o=e(r=a,n)}}function Di(t,e,n){var r,i,o;return function(){var a,s=n(this),l;return s==null?void this.removeAttribute(t):(a=this.getAttribute(t),l=s+"",a===l?null:a===r&&l===i?o:(i=l,o=e(r=a,s)))}}function qi(t,e,n){var r,i,o;return function(){var a,s=n(this),l;return s==null?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),l=s+"",a===l?null:a===r&&l===i?o:(i=l,o=e(r=a,s)))}}function Vi(t,e){var n=_t(t),r=n==="transform"?xi:tn;return this.attrTween(t,typeof e=="function"?(n.local?qi:Di)(n,r,ie(this,"attr."+t,e)):e==null?(n.local?Ii:Fi)(n):(n.local?Oi:Pi)(n,r,e))}function Li(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Wi(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Bi(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&Wi(t,o)),n}return i._value=e,i}function Hi(t,e){var n,r;function i(){var o=e.apply(this,arguments);return o!==r&&(n=(r=o)&&Li(t,o)),n}return i._value=e,i}function Gi(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=_t(t);return this.tween(n,(r.local?Bi:Hi)(r,e))}function Xi(t,e){return function(){re(this,t).delay=+e.apply(this,arguments)}}function Ui(t,e){return e=+e,function(){re(this,t).delay=e}}function zi(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Xi:Ui)(e,t)):O(this.node(),e).delay}function Yi(t,e){return function(){B(this,t).duration=+e.apply(this,arguments)}}function Ki(t,e){return e=+e,function(){B(this,t).duration=e}}function Zi(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Yi:Ki)(e,t)):O(this.node(),e).duration}function Qi(t,e){if(typeof e!="function")throw new Error;return function(){B(this,t).ease=e}}function Ji(t){var e=this._id;return arguments.length?this.each(Qi(e,t)):O(this.node(),e).ease}function ji(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;B(this,t).ease=n}}function to(t){if(typeof t!="function")throw new Error;return this.each(ji(this._id,t))}function eo(t){typeof t!="function"&&(t=ve(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],a=o.length,s=r[i]=[],l,c=0;c<a;++c)(l=o[c])&&t.call(l,l.__data__,c,o)&&s.push(l);return new G(r,this._parents,this._name,this._id)}function no(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var l=e[s],c=n[s],u=l.length,h=a[s]=new Array(u),f,d=0;d<u;++d)(f=l[d]||c[d])&&(h[d]=f);for(;s<r;++s)a[s]=e[s];return new G(a,this._parents,this._name,this._id)}function ro(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function io(t,e,n){var r,i,o=ro(e)?re:B;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}function oo(t,e){var n=this._id;return arguments.length<2?O(this.node(),n).on.on(t):this.each(io(n,t,e))}function ao(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function so(){return this.on("end.remove",ao(this._id))}function lo(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Ht(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s=r[a],l=s.length,c=o[a]=new Array(l),u,h,f=0;f<l;++f)(u=s[f])&&(h=t.call(u,u.__data__,f,s))&&("__data__"in u&&(h.__data__=u.__data__),c[f]=h,Ft(c[f],e,n,f,c,O(u,n)));return new G(o,this._parents,e,n)}function uo(t){var e=this._name,n=this._id;typeof t!="function"&&(t=xe(t));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var l=r[s],c=l.length,u,h=0;h<c;++h)if(u=l[h]){for(var f=t.call(u,u.__data__,h,l),d,g=O(u,n),y=0,b=f.length;y<b;++y)(d=f[y])&&Ft(d,e,n,y,f,g);o.push(f),a.push(u)}return new G(o,a,e,n)}var co=lt.prototype.constructor;function fo(){return new co(this._groups,this._parents)}function ho(t,e){var n,r,i;return function(){var o=rt(this,t),a=(this.style.removeProperty(t),rt(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}function en(t){return function(){this.style.removeProperty(t)}}function po(t,e,n){var r,i=n+"",o;return function(){var a=rt(this,t);return a===i?null:a===r?o:o=e(r=a,n)}}function go(t,e,n){var r,i,o;return function(){var a=rt(this,t),s=n(this),l=s+"";return s==null&&(l=s=(this.style.removeProperty(t),rt(this,t))),a===l?null:a===r&&l===i?o:(i=l,o=e(r=a,s))}}function mo(t,e){var n,r,i,o="style."+e,a="end."+o,s;return function(){var l=B(this,t),c=l.on,u=l.value[o]==null?s||(s=en(e)):void 0;(c!==n||i!==u)&&(r=(n=c).copy()).on(a,i=u),l.on=r}}function yo(t,e,n){var r=(t+="")=="transform"?_i:tn;return e==null?this.styleTween(t,ho(t,r)).on("end.style."+t,en(t)):typeof e=="function"?this.styleTween(t,go(t,r,ie(this,"style."+t,e))).each(mo(this._id,t)):this.styleTween(t,po(t,r,e),n).on("end.style."+t,null)}function wo(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function _o(t,e,n){var r,i;function o(){var a=e.apply(this,arguments);return a!==i&&(r=(i=a)&&wo(t,a,n)),r}return o._value=e,o}function xo(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,_o(t,e,n??""))}function vo(t){return function(){this.textContent=t}}function $o(t){return function(){var e=t(this);this.textContent=e??""}}function Ao(t){return this.tween("text",typeof t=="function"?$o(ie(this,"text",t)):vo(t==null?"":t+""))}function bo(t){return function(e){this.textContent=t.call(this,e)}}function Eo(t){var e,n;function r(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&bo(i)),e}return r._value=t,r}function ko(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Eo(t))}function Mo(){for(var t=this._name,e=this._id,n=nn(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,l,c=0;c<s;++c)if(l=a[c]){var u=O(l,e);Ft(l,t,n,c,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new G(r,this._parents,t,n)}function No(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var s={value:a},l={value:function(){--i===0&&o()}};n.each(function(){var c=B(this,r),u=c.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(s),e._.interrupt.push(s),e._.end.push(l)),c.on=e}),i===0&&o()})}var So=0;function G(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function nn(){return++So}var X=lt.prototype;G.prototype={constructor:G,select:lo,selectAll:uo,selectChild:X.selectChild,selectChildren:X.selectChildren,filter:eo,merge:no,selection:fo,transition:Mo,call:X.call,nodes:X.nodes,node:X.node,size:X.size,empty:X.empty,each:X.each,on:oo,attr:Vi,attrTween:Gi,style:yo,styleTween:xo,text:Ao,textTween:ko,remove:so,tween:Ci,delay:zi,duration:Zi,ease:Ji,easeVarying:to,end:No,[Symbol.iterator]:X[Symbol.iterator]};function Ro(t){return t*(2-t)}function To(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Co={time:null,delay:0,duration:250,ease:To};function Fo(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Io(t){var e,n;t instanceof G?(e=t._id,t=t._name):(e=nn(),(n=Co).time=jt(),t=t==null?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a=r[o],s=a.length,l,c=0;c<s;++c)(l=a[c])&&Ft(l,t,e,c,a,n||Fo(l,e));return new G(r,this._parents,t,e)}lt.prototype.interrupt=Si,lt.prototype.transition=Io;const oe=Math.PI,ae=2*oe,et=1e-6,Po=ae-et;function rn(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function Oo(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return rn;const n=10**e;return function(r){this._+=r[0];for(let i=1,o=r.length;i<o;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}class Do{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?rn:Oo(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,r,i){this._append`Q${+e},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(e,n,r,i,o,a){this._append`C${+e},${+n},${+r},${+i},${this._x1=+o},${this._y1=+a}`}arcTo(e,n,r,i,o){if(e=+e,n=+n,r=+r,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let a=this._x1,s=this._y1,l=r-e,c=i-n,u=a-e,h=s-n,f=u*u+h*h;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(f>et)if(!(Math.abs(h*l-c*u)>et)||!o)this._append`L${this._x1=e},${this._y1=n}`;else{let d=r-a,g=i-s,y=l*l+c*c,b=d*d+g*g,$=Math.sqrt(y),p=Math.sqrt(f),x=o*Math.tan((oe-Math.acos((y+f-b)/(2*$*p)))/2),m=x/p,v=x/$;Math.abs(m-1)>et&&this._append`L${e+m*u},${n+m*h}`,this._append`A${o},${o},0,0,${+(h*d>u*g)},${this._x1=e+v*l},${this._y1=n+v*c}`}}arc(e,n,r,i,o,a){if(e=+e,n=+n,r=+r,a=!!a,r<0)throw new Error(`negative radius: ${r}`);let s=r*Math.cos(i),l=r*Math.sin(i),c=e+s,u=n+l,h=1^a,f=a?i-o:o-i;this._x1===null?this._append`M${c},${u}`:(Math.abs(this._x1-c)>et||Math.abs(this._y1-u)>et)&&this._append`L${c},${u}`,r&&(f<0&&(f=f%ae+ae),f>Po?this._append`A${r},${r},0,1,${h},${e-s},${n-l}A${r},${r},0,1,${h},${this._x1=c},${this._y1=u}`:f>et&&this._append`A${r},${r},0,${+(f>=oe)},${h},${this._x1=e+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function S(t){return function(){return t}}const on=Math.abs,M=Math.atan2,nt=Math.cos,qo=Math.max,se=Math.min,H=Math.sin,at=Math.sqrt,C=1e-12,mt=Math.PI,It=mt/2,Pt=2*mt;function Vo(t){return t>1?0:t<-1?mt:Math.acos(t)}function an(t){return t>=1?It:t<=-1?-It:Math.asin(t)}function Lo(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new Do(e)}function Wo(t){return t.innerRadius}function Bo(t){return t.outerRadius}function Ho(t){return t.startAngle}function Go(t){return t.endAngle}function Xo(t){return t&&t.padAngle}function Uo(t,e,n,r,i,o,a,s){var l=n-t,c=r-e,u=a-i,h=s-o,f=h*l-u*c;if(!(f*f<C))return f=(u*(e-o)-h*(t-i))/f,[t+f*l,e+f*c]}function Ot(t,e,n,r,i,o,a){var s=t-n,l=e-r,c=(a?o:-o)/at(s*s+l*l),u=c*l,h=-c*s,f=t+u,d=e+h,g=n+u,y=r+h,b=(f+g)/2,$=(d+y)/2,p=g-f,x=y-d,m=p*p+x*x,v=i-o,k=f*y-g*d,D=(x<0?-1:1)*at(qo(0,v*v*m-k*k)),q=(k*x-p*D)/m,V=(-k*p-x*D)/m,I=(k*x+p*D)/m,N=(-k*p+x*D)/m,E=q-b,w=V-$,A=I-b,z=N-$;return E*E+w*w>A*A+z*z&&(q=I,V=N),{cx:q,cy:V,x01:-u,y01:-h,x11:q*(i/v-1),y11:V*(i/v-1)}}function zo(){var t=Wo,e=Bo,n=S(0),r=null,i=Ho,o=Go,a=Xo,s=null,l=Lo(c);function c(){var u,h,f=+t.apply(this,arguments),d=+e.apply(this,arguments),g=i.apply(this,arguments)-It,y=o.apply(this,arguments)-It,b=on(y-g),$=y>g;if(s||(s=u=l()),d<f&&(h=d,d=f,f=h),!(d>C))s.moveTo(0,0);else if(b>Pt-C)s.moveTo(d*nt(g),d*H(g)),s.arc(0,0,d,g,y,!$),f>C&&(s.moveTo(f*nt(y),f*H(y)),s.arc(0,0,f,y,g,$));else{var p=g,x=y,m=g,v=y,k=b,D=b,q=a.apply(this,arguments)/2,V=q>C&&(r?+r.apply(this,arguments):at(f*f+d*d)),I=se(on(d-f)/2,+n.apply(this,arguments)),N=I,E=I,w,A;if(V>C){var z=an(V/f*H(q)),st=an(V/d*H(q));(k-=z*2)>C?(z*=$?1:-1,m+=z,v-=z):(k=0,m=v=(g+y)/2),(D-=st*2)>C?(st*=$?1:-1,p+=st,x-=st):(D=0,p=x=(g+y)/2)}var Y=d*nt(p),K=d*H(p),qt=f*nt(v),Vt=f*H(v);if(I>C){var Lt=d*nt(x),Wt=d*H(x),ue=f*nt(m),ce=f*H(m),U;if(b<mt)if(U=Uo(Y,K,ue,ce,Lt,Wt,qt,Vt)){var fe=Y-U[0],he=K-U[1],de=Lt-U[0],pe=Wt-U[1],sn=1/H(Vo((fe*de+he*pe)/(at(fe*fe+he*he)*at(de*de+pe*pe)))/2),ln=at(U[0]*U[0]+U[1]*U[1]);N=se(I,(f-ln)/(sn-1)),E=se(I,(d-ln)/(sn+1))}else N=E=0}D>C?E>C?(w=Ot(ue,ce,Y,K,d,E,$),A=Ot(Lt,Wt,qt,Vt,d,E,$),s.moveTo(w.cx+w.x01,w.cy+w.y01),E<I?s.arc(w.cx,w.cy,E,M(w.y01,w.x01),M(A.y01,A.x01),!$):(s.arc(w.cx,w.cy,E,M(w.y01,w.x01),M(w.y11,w.x11),!$),s.arc(0,0,d,M(w.cy+w.y11,w.cx+w.x11),M(A.cy+A.y11,A.cx+A.x11),!$),s.arc(A.cx,A.cy,E,M(A.y11,A.x11),M(A.y01,A.x01),!$))):(s.moveTo(Y,K),s.arc(0,0,d,p,x,!$)):s.moveTo(Y,K),!(f>C)||!(k>C)?s.lineTo(qt,Vt):N>C?(w=Ot(qt,Vt,Lt,Wt,f,-N,$),A=Ot(Y,K,ue,ce,f,-N,$),s.lineTo(w.cx+w.x01,w.cy+w.y01),N<I?s.arc(w.cx,w.cy,N,M(w.y01,w.x01),M(A.y01,A.x01),!$):(s.arc(w.cx,w.cy,N,M(w.y01,w.x01),M(w.y11,w.x11),!$),s.arc(0,0,f,M(w.cy+w.y11,w.cx+w.x11),M(A.cy+A.y11,A.cx+A.x11),$),s.arc(A.cx,A.cy,N,M(A.y11,A.x11),M(A.y01,A.x01),!$))):s.arc(0,0,f,v,m,$)}if(s.closePath(),u)return s=null,u+""||null}return c.centroid=function(){var u=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,h=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-mt/2;return[nt(h)*u,H(h)*u]},c.innerRadius=function(u){return arguments.length?(t=typeof u=="function"?u:S(+u),c):t},c.outerRadius=function(u){return arguments.length?(e=typeof u=="function"?u:S(+u),c):e},c.cornerRadius=function(u){return arguments.length?(n=typeof u=="function"?u:S(+u),c):n},c.padRadius=function(u){return arguments.length?(r=u==null?null:typeof u=="function"?u:S(+u),c):r},c.startAngle=function(u){return arguments.length?(i=typeof u=="function"?u:S(+u),c):i},c.endAngle=function(u){return arguments.length?(o=typeof u=="function"?u:S(+u),c):o},c.padAngle=function(u){return arguments.length?(a=typeof u=="function"?u:S(+u),c):a},c.context=function(u){return arguments.length?(s=u??null,c):s},c}function Yo(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Ko(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function Zo(t){return t}function Qo(){var t=Zo,e=Ko,n=null,r=S(0),i=S(Pt),o=S(0);function a(s){var l,c=(s=Yo(s)).length,u,h,f=0,d=new Array(c),g=new Array(c),y=+r.apply(this,arguments),b=Math.min(Pt,Math.max(-Pt,i.apply(this,arguments)-y)),$,p=Math.min(Math.abs(b)/c,o.apply(this,arguments)),x=p*(b<0?-1:1),m;for(l=0;l<c;++l)(m=g[d[l]=l]=+t(s[l],l,s))>0&&(f+=m);for(e!=null?d.sort(function(v,k){return e(g[v],g[k])}):n!=null&&d.sort(function(v,k){return n(s[v],s[k])}),l=0,h=f?(b-c*x)/f:0;l<c;++l,y=$)u=d[l],m=g[u],$=y+(m>0?m*h:0)+x,g[u]={data:s[u],index:l,value:m,startAngle:y,endAngle:$,padAngle:p};return g}return a.value=function(s){return arguments.length?(t=typeof s=="function"?s:S(+s),a):t},a.sortValues=function(s){return arguments.length?(e=s,n=null,a):e},a.sort=function(s){return arguments.length?(n=s,e=null,a):n},a.startAngle=function(s){return arguments.length?(r=typeof s=="function"?s:S(+s),a):r},a.endAngle=function(s){return arguments.length?(i=typeof s=="function"?s:S(+s),a):i},a.padAngle=function(s){return arguments.length?(o=typeof s=="function"?s:S(+s),a):o},a}function yt(t,e,n){this.k=t,this.x=e,this.y=n}yt.prototype={constructor:yt,scale:function(t){return t===1?this:new yt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new yt(this.k,this.x+this.k*t,this.y+this.k*e)},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+")"}},yt.prototype;const le=8;function Jo(t,e,n){if(!t.data||t.data.length===0)throw new Error("Wheel data cannot be empty");const r=()=>(Math.min(e.value.width,e.value.height)-8)/2,i=_.reactive({pieGenerator:null,arcGenerator:null,arrow:null,container:null,rayon:r(),rotation:0,isSpinning:!1,svg:null,vis:null,error:null,isRendering:!1,renderAttempts:0});_.watch(()=>e.value,()=>{i.rayon=r(),i.isRendering||b()});const o=3,a=p=>n?p<=3?16:p<=5?12:p<=9?10:8:p<=3?18:p<=7?13:11,s=()=>{i.container&&R(i.container).append("circle").attr("cx",0).attr("cy",0).attr("r",i.rayon/2.5).attr("fill","#ffffff").attr("stroke-width",le/2).attr("stroke","#000000").attr("filter","url(#arrowShadow)")},l=()=>{i.container&&R(i.container).append("circle").attr("cx",0).attr("cy",0).attr("r",(e.value.width-4)/2).attr("fill","transparent").attr("stroke-width",10).attr("stroke","#ffffff").attr("filter","url(#arrowShadow)")},c=()=>{if(!i.container||!t.imgParams)return;const{width:p,height:x,src:m}=t.imgParams,v=new Image;v.onerror=()=>{i.error="Failed to load center image",console.error("Failed to load image:",m)},v.onload=()=>{R(i.container).append("image").attr("x",-p/2).attr("y",-x/2).attr("width",p).attr("height",x).attr("href",m).attr("preserveAspectRatio","xMidYMid meet")},v.src=m},u=()=>{if(!i.container)return;const p="M 95.3 9.8 C 78.8 9.8 71.6 25.4 73.4 36.8 C 76.8 58.5 95.3 79 95.3 79 S 113.8 58.5 117.2 36.8 C 119 25.4 111.8 9.8 95.3 9.8 Z";i.arrow=R(i.container).append("path").attr("d",p).attr("stroke","#ffffff").attr("fill","#FFFFFF").attr("stroke-linejoin","round").attr("stroke-width",le/2).attr("filter","url(#arrowShadow)").attr("transform",`translate(-95, ${-e.value.height/2+20})`).node()},h=()=>{try{const p=a(t.data.length),x=R("#wheel").append("svg").attr("font-size",`${p}px`).attr("font-family",t.fontFamily||"Arial, sans-serif").attr("height","100%").attr("width","100%").attr("viewBox",`0 0 ${e.value.width+40} ${e.value.height}`).attr("shape-rendering","optimizeSpeed").attr("aria-label","Fortune Wheel");if(!x.node())throw new Error("Failed to create SVG element");const v=x.append("defs").append("filter").attr("id","arrowShadow").attr("x","-50%").attr("y","-50%").attr("width","200%").attr("height","200%");if(v.append("feOffset").attr("in","SourceAlpha").attr("dx",0).attr("dy",0).attr("result","offsetOut"),v.append("feGaussianBlur").attr("stdDeviation",6).attr("in","offsetOut").attr("result","blurOut"),v.append("feColorMatrix").attr("in","blurOut").attr("type","matrix").attr("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.20 0").attr("result","shadowOut"),v.append("feBlend").attr("in","SourceGraphic").attr("in2","shadowOut").attr("mode","normal"),i.svg=x.append("g").attr("class","wrapper").attr("transform",`translate(${(e.value.width+40)/2}, ${e.value.height/2})`).node(),!i.svg)throw new Error("Failed to create SVG wrapper")}catch(p){i.error=`Error creating SVG: ${p instanceof Error?p.message:"Unknown error"}`}},f=()=>{i.svg&&(i.container=R(i.svg).append("g").attr("class","wheelholder").node(),i.vis=R(i.container).append("g").node(),i.pieGenerator=Qo().value(()=>1).sort(null),i.arcGenerator=zo().outerRadius(i.rayon).innerRadius(0))},d=()=>{try{if(!i.pieGenerator||!i.arcGenerator||!i.vis)throw new Error("Required generators or visual elements not initialized");if(!t.data.every((m,v)=>{if(!m.value)throw new Error(`Invalid data format at index