@zyzgroup/core-web 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/theme.css +4 -4
- package/dist/zyzgroup_core_web.iife.js +1 -1
- package/dist/zyzgroup_core_web.iife.js.map +1 -1
- package/dist/zyzgroup_core_web.js +1 -1
- package/dist/zyzgroup_core_web.js.map +1 -1
- package/dist/zyzgroup_core_web.umd.cjs +1 -1
- package/dist/zyzgroup_core_web.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/theme.css
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
:root {
|
|
2
2
|
--border-radius: 4px;
|
|
3
3
|
--button-height: 44px;
|
|
4
|
-
--xg-blue:
|
|
5
|
-
--xg-red:
|
|
6
|
-
--xg-green:
|
|
7
|
-
--xg-orange:
|
|
4
|
+
--xg-blue: #5a82f0;
|
|
5
|
+
--xg-red: #fa503c;
|
|
6
|
+
--xg-green: #328a8c;
|
|
7
|
+
--xg-orange: #fa8c00;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
/* 浅色模式 */
|
|
@@ -31,7 +31,7 @@ var ZYZGroupCoreWeb=function(d){"use strict";var cr=typeof document<"u"?document
|
|
|
31
31
|
--sab:env(safe-area-inset-bottom, 0px);
|
|
32
32
|
--sal:env(safe-area-inset-left, 0px);
|
|
33
33
|
}
|
|
34
|
-
`))}Tf();const be=new Xe;let oi,hi,ci,li;In(document.documentElement,()=>{setTimeout(()=>{const i=getComputedStyle(document.documentElement),t=i.getPropertyValue("--sat");t!==oi&&be.emit("top",t),oi=t;const e=i.getPropertyValue("--sar");e!==hi&&be.emit("right",e),hi=e;const s=i.getPropertyValue("--sab");s!==ci&&be.emit("bottom",s),ci=s;const n=i.getPropertyValue("--sal");n!==li&&be.emit("left",n),li=n},0)});const _f={onTop:i=>(oi&&i(oi),be.on("top",i)),onRight:i=>(hi&&i(hi),be.on("right",i)),onBottom:i=>(ci&&i(ci),be.on("bottom",i)),onLeft:i=>(li&&i(li),be.on("left",i))},gs=[];let fo=Ri;function mo(i){return gs.length==0&&(fo=B(document,"scroll",t=>{gs.forEach(e=>e(t))})),gs.push(i),()=>{Pe(gs,i),gs.length==0&&fo()}}function Pf(i,t){window.scrollTo(i,t)}function Mf(){let i=Ri,t=Ri;return"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual",i=oo(()=>{window.history.scrollRestoration="auto"}),t=ao(()=>{window.history.scrollRestoration="manual"})),()=>{i(),t()}}async function go(i,t,e={threshold:.5}){return new Promise(s=>{new IntersectionObserver((r,a)=>{t(r,a),s(()=>{a.unobserve(i)})},e).observe(i)})}function Ef(i,t){let e;function s(){const{width:n,height:r}=t?.root?.getBoundingClientRect()||Ka(),{top:a,left:o,right:h,bottom:c}=i.getBoundingClientRect();(a>=0&&a<=r||c>=0&&c<=r)&&(o>=0&&o<=n||h>=0&&h<=n)?(e!==!0&&t?.onShow?.(),e=!0):(e!==!1&&t?.onHide?.(),e=!1)}return s(),mo(s)}async function Af(i,t){let e;const s=typeof t.threshold=="number"?t.threshold:.5;return go(i,n=>{let r=n[0];if(n.length>1){const o=n.find(h=>h.isIntersecting);o&&(r=o)}const a=r.isIntersecting&&r.intersectionRatio>=s;e!==a&&(a?t?.onShow?.():t?.onHide?.()),e=a},{threshold:s,root:t.root})}function kf(i){return i(!document.hidden),B(window,"visibilitychange",()=>{i(!document.hidden)})}function If(i,t,e,s,n){const r=t/e;let a=0,o=0;switch(i){case"aspectFit":r>=1?(a=s,o=a/r,o>n&&(o=n,a=o*r)):(o=n,a=o*r,a>s&&(a=s,o=a/r));break;case"aspectFill":r>=1?(o=n,a=o*r):(a=s,o=a/r);break;case"widthFix":a=s,o=a/r;break;case"heightFix":o=n,a=o*r;break;case"scaleToFill":default:a=s,o=n;break}return{width:a,height:o}}function po(i){try{const t=document.createElement("canvas"),e=t.getContext("2d");return t.width=i.width,t.height=i.height,e.drawImage(i,0,0,t.width,t.height),e.getImageData(0,0,t.width,t.height)}catch{return new ImageData(i.width,i.height)}}const Df=i=>{const t=i.width,e=i.height,s=t*e*3,n=s+54,r=[66,77,n&255,n>>8&255,n>>16&255,n>>24&255,0,0,0,0,54,0,0,0],a=[40,0,0,0,t&255,t>>8&255,t>>16&255,t>>24&255,e&255,e>>8&255,e>>16&255,e>>24&255,1,0,24,0,0,0,0,0,s&255,s>>8&255,s>>16&255,s>>24&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o=(4-t*3%4)%4,h=i.data;let c="";const l=t<<2;let u=e;const f=String.fromCharCode;do{const g=l*(u-1);let C="";for(let v=0;v<t;v++){const b=v<<2;C+=f(h[g+b+2])+f(h[g+b+1])+f(h[g+b])}for(let v=0;v<o;v++)C+=String.fromCharCode(0);c+=C}while(--u);function m(g){if(!window.btoa)throw"btoa undefined";let C="";if(typeof g=="string")C=g;else for(let v=0;v<g.length;v++)C+=String.fromCharCode(g[v]);return btoa(C)}return m(r.concat(a))+m(c)},Rf=i=>{const{width:t,height:e}=i,s=document.createElement("canvas"),n=s.getContext("2d");return s.width=t,s.height=e,n.putImageData(i,0,0,0,0,t,e),s.toDataURL("image/png")},Lf=(i,t,e)=>{const{width:s,height:n}=i,r=document.createElement("canvas"),a=r.getContext("2d");r.width=s,r.height=n,a.putImageData(i,0,0,0,0,s,n);const o=`image/${t?t.toLowerCase():"png"}`;r.toBlob(h=>{e?.(null,h)},o,1)};function zf(i,t){return createImageBitmap(i,t)}function Of(i){const t=[],e=[],s=[];let n=0;for(let h=0,c=i.data.length;h<c;h+=4)t[n]=i.data[h],e[n]=i.data[h+1],s[n]=i.data[h+2],n+=1;const r=Dn(t),a=Dn(e),o=Dn(s);return"rgb("+r+","+a+","+o+")"}function Dn(i){const t={},e=[],s=[];for(let o=0;o<i.length;o++)t[i[o]]?e.push(i[o]):t[i[o]]=1;let n=0;for(let o=0;o<e.length;o++){n=0;for(let h=0;h<e.length;h++)e[o]===e[h]&&(n+=1),s[o]=n}const r=Math.max.apply(null,s);let a=0;for(;a<s.length;a++)if(s[a]===r)return;return e[a]}const Ff=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=t[(a*e+e-o-1)*4],n[h+1]=t[(a*e+e-o-1)*4+1],n[h+2]=t[(a*e+e-o-1)*4+2],n[h+3]=t[(a*e+e-o-1)*4+3]}return new ImageData(n,e,s)},Bf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=t[((s-a-1)*e+o)*4],n[h+1]=t[((s-a-1)*e+o)*4+1],n[h+2]=t[((s-a-1)*e+o)*4+2],n[h+3]=t[((s-a-1)*e+o)*4+3]}return new ImageData(n,e,s)},Nf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<e;a++)for(let o=0;o<s;o++){const h=(a*s+o)*4;n[h]=t[(o*e+e-a-1)*4],n[h+1]=t[(o*e+e-a-1)*4+1],n[h+2]=t[(o*e+e-a-1)*4+2],n[h+3]=t[(o*e+e-a-1)*4+3]}return new ImageData(n,s,e)},Yf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<e;a++)for(let o=0;o<s;o++){const h=(a*s+o)*4;n[h]=t[((s-o-1)*e+a)*4],n[h+1]=t[((s-o-1)*e+a)*4+1],n[h+2]=t[((s-o-1)*e+a)*4+2],n[h+3]=t[((s-o-1)*e+a)*4+3]}return new ImageData(n,s,e)},Uf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,c=(t[h]+t[h+1]+t[h+2])/3;n[h]=c,n[h+1]=c,n[h+2]=c,n[h+3]=t[h+3]}return new ImageData(n,e,s)},Xf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,c=.2126*t[h]+.7152*t[h+1]+.0722*t[h+2];n[h]=c,n[h+1]=c,n[h+2]=c,n[h+3]=t[h+3]}return new ImageData(n,e,s)},Vf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,l=(t[h]+t[h+1]+t[h+2])/3>127?255:0;n[h]=l,n[h+1]=l,n[h+2]=l,n[h+3]=t[h+3]}return new ImageData(n,e,s)},Gf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=255-t[h],n[h+1]=255-t[h+1],n[h+2]=255-t[h+2],n[h+3]=t[h+3]}return new ImageData(n,e,s)},qf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=t[h],n[h+1]=0,n[h+2]=0,n[h+3]=t[h+3]}return new ImageData(n,e,s)},jf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=0,n[h+1]=t[h+1],n[h+2]=0,n[h+3]=t[h+3]}return new ImageData(n,e,s)},Hf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=0,n[h+1]=0,n[h+2]=t[h+2],n[h+3]=t[h+3]}return new ImageData(n,e,s)},Wf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=t[h],n[h+1]=t[h+1],n[h+2]=0,n[h+3]=t[h+3]}return new ImageData(n,e,s)},$f=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=t[h],n[h+1]=0,n[h+2]=t[h+1],n[h+3]=t[h+3]}return new ImageData(n,e,s)},Jf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=0,n[h+1]=t[h+1],n[h+2]=t[h+1],n[h+3]=t[h+3]}return new ImageData(n,e,s)},Zf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,c=(t[h+1]+t[h+2])/2;n[h]=t[h],n[h+1]=c,n[h+2]=c,n[h+3]=t[h+3]}return new ImageData(n,e,s)},Kf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,c=(t[h]+t[h+2])/2;n[h]=c,n[h+1]=t[h+1],n[h+2]=c,n[h+3]=t[h+3]}return new ImageData(n,e,s)},Qf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,c=(t[h]+t[h+1])/2;n[h]=c,n[h+1]=c,n[h+2]=t[h+2],n[h+3]=t[h+3]}return new ImageData(n,e,s)},td=i=>yo(i,[-1,-1,-1,-1,9,-1,-1,-1,-1]),ed=i=>yo(i,[-1,-1,-1,-1,8,-1,-1,-1,-1]),sd=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=t[h],n[h+1]=t[h+1],n[h+2]=t[h+2],n[h+3]=255}return new ImageData(n,e,s)},id=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;if(t[h+3]===0)n[h]=255,n[h+1]=255,n[h+2]=255,n[h+3]=255;else{const c=wo([t[h],t[h+1],t[h+2],t[h+3]],[255,255,255,255]);n[h]=c[0],n[h+1]=c[1],n[h+2]=c[2],n[h+3]=c[3]}}return new ImageData(n,e,s)},nd=(i,t,e,s,n,r=!1,a)=>{const{data:o,width:h,height:c}=i;let l=n,u=s,f=t,m=e;if(l<0?l=0:l>h&&(l=h),u<0?u=0:u>c&&(u=c),f<1?f=1:f>h&&(f=h),m<1?m=1:m>c&&(m=c),l+f>h&&(f=h-l),u+m>c&&(m=c-u),r){const g=new Uint8ClampedArray(o.length);for(let v=0;v<c;v++)for(let b=0;b<h;b++){const S=(v*h+b)*4;b>=l&&b<=l+f&&v>=u&&v<=u+m?(g[S]=o[S],g[S+1]=o[S+1],g[S+2]=o[S+2],g[S+3]=o[S+3]):(g[S]=255,g[S+1]=255,g[S+2]=255,g[S+3]=a&&["JPG","JPEG"].includes(a.toUpperCase())?255:0)}return new ImageData(g,h,c)}else{const g=new Uint8ClampedArray(f*m*4);for(let v=u;v<=u+m;v++)for(let b=l;b<=l+f;b++){const S=((v-u)*f+b-l)*4,y=(v*h+b)*4;g[S]=o[y],g[S+1]=o[y+1],g[S+2]=o[y+2],g[S+3]=o[y+3]}return new ImageData(g,f,m)}},rd=(i,t,e,s)=>{const{data:n,width:r,height:a}=i;let o=t;o>Math.floor(r/2)&&(o=Math.floor(r/2)),o>Math.floor(a/2)&&(o=Math.floor(a/2)),o<0&&(o=0);const h=new Uint8ClampedArray(n.length);for(let l=0;l<a;l++)for(let u=0;u<r;u++){const f=(l*r+u)*4;let m=-1;u<o?l<o?m=Math.sqrt(Math.pow(o-u-1,2)+Math.pow(o-l-1,2)):l>a-o-1&&(m=Math.sqrt(Math.pow(o-u-1,2)+Math.pow(l-(a-o),2))):u>r-o-1&&(l<o?m=Math.sqrt(Math.pow(u-(r-o),2)+Math.pow(o-l-1,2)):l>a-o-1&&(m=Math.sqrt(Math.pow(u-(r-o),2)+Math.pow(l-(a-o),2)))),Math.round(m)>o?(h[f]=255,h[f+1]=255,h[f+2]=255,h[f+3]=s||e.toUpperCase()==="PNG"?0:255):(h[f]=n[f],h[f+1]=n[f+1],h[f+2]=n[f+2],h[f+3]=s||e.toUpperCase()==="PNG"?n[f+3]:255)}return new ImageData(h,r,a)},ad=(i,t,e,s,n,r=1e4)=>{const a=new Image;a.src=i;const o=document.createElement("canvas"),h=o.getContext("2d");return o.width=r,o.height=r,h.drawImage(a,0,0,t,e,0,0,s,n),h.getImageData(0,0,s,n)},od=(i,t)=>{const{data:e,width:s,height:n}=i,r=new Uint8ClampedArray(e.length);for(let o=0;o<n;o++)for(let h=0;h<s;h++){const c=(o*s+h)*4;r[c]=Math.max(Math.min(e[c]+t,255),0),r[c+1]=Math.max(Math.min(e[c+1]+t,255),0),r[c+2]=Math.max(Math.min(e[c+2]+t,255),0),r[c+3]=e[c+3]}return new ImageData(r,s,n)},hd=(i,t,e=!1)=>{const{data:s,width:n,height:r}=i,a=new Uint8ClampedArray(s.length);for(let h=0;h<r;h++)for(let c=0;c<n;c++){const l=(h*n+c)*4;s[l+3]===0?(a[l]=255,a[l+1]=255,a[l+2]=255):(a[l]=s[l],a[l+1]=s[l+1],a[l+2]=s[l+2]);let u=s[l+3];e?u=Math.max(Math.min(Math.floor(255*t),255),0):u=Math.max(Math.min(Math.floor(u+255*t),255),0),a[l+3]=u}return new ImageData(a,n,r)},cd=(i,t,e,s)=>{const{data:n,width:r,height:a}=i,{data:o,width:h,height:c}=t;let l=e,u=s;e+c>a&&(l=a-c),s+h>r&&(u=r-h);const f=new Uint8ClampedArray(n.length);for(let g=0;g<a;g++)for(let C=0;C<r;C++){const v=(g*r+C)*4;if(C<u||C>u+h||g<=l||g>=l+c)f[v]=n[v],f[v+1]=n[v+1],f[v+2]=n[v+2],f[v+3]=n[v+3];else{const b=(g*r+C-((l+1)*r+(g-(l+1))*(r-h))+h-u-1)*4,S=[o[b],o[b+1],o[b+2],o[b+3]],y=[n[v],n[v+1],n[v+2],n[v+3]],w=wo(S,y);f[v]=w[0],f[v+1]=w[1],f[v+2]=w[2],f[v+3]=w[3]}}return new ImageData(f,r,a)},ld=(i,t,e,s,n,r=10)=>{const{data:a,width:o,height:h}=i;let c=n,l=s,u=t,f=e;c<0?c=0:c>o&&(c=o),l<0?l=0:l>h&&(l=h),u<1?u=1:u>o&&(u=o),f<1?f=1:f>h&&(f=h),c+u>o&&(u=o-c),l+f>h&&(f=h-l);const m=new Uint8ClampedArray(a.length);for(let C=0;C<h;C++)for(let v=0;v<o;v++){const b=(C*o+v)*4;if(v>=c&&v<=c+u&&C>=l&&C<=l+f){const S=Math.floor((v-c)/r),y=Math.floor((C-l)/r);let w=Math.floor(r*(S+1)-r/2+c),P=Math.floor(r*(y+1)-r/2+l);w>o-1&&(w=o-1),P>h-1&&(P=h-1);const _=(P*o+w)*4;m[b]=a[_],m[b+1]=a[_+1],m[b+2]=a[_+2],m[b+3]=a[_+3]}else m[b]=a[b],m[b+1]=a[b+1],m[b+2]=a[b+2],m[b+3]=a[b+3]}return new ImageData(m,o,h)},ud=(i,t,e={backgroundColor:{r:0,g:0,b:0,a:255},changeIntoColor:{r:0,g:0,b:0,a:0}})=>{if(t&&e){const{data:s,width:n,height:r}=i,{data:a}=t,o=new Uint8ClampedArray(s.length),{backgroundColor:h,changeIntoColor:c}=e;for(let u=0;u<r;u++)for(let f=0;f<n;f++){const m=(u*n+f)*4,g=a[m],C=a[m+1],v=a[m+2],b=a[m+3];g===h.r&&C===h.g&&v===h.b&&b===h.a&&c.a!==0?(o[m]=c.r,o[m+1]=c.g,o[m+2]=c.b,o[m+3]=c.a):(o[m]=s[m],o[m+1]=s[m+1],o[m+2]=s[m+2],o[m+3]=s[m+3])}return new ImageData(o,n,r)}return i},yo=(i,t)=>{const{data:e,width:s,height:n}=i,r=new Uint8ClampedArray(e.length);for(let o=0;o<n;o++)for(let h=0;h<s;h++){const c=(o*s+h)*4;for(let l=0;l<3;l++){const u=c+l;h===0||h===s-1||o===0||o===n-1?r[u]=e[u]:r[u]=t[0]*e[u-s*4-4]+t[1]*e[u-s*4]+t[2]*e[u-s*4+4]+t[3]*e[u-4]+t[4]*e[u]+t[5]*e[u+4]+t[6]*e[u+s*4-4]+t[7]*e[u+s*4]+t[8]*e[u+s*4+4]}r[c+3]=e[c+3]}return new ImageData(r,s,n)},wo=(i,t)=>{if(i&&i.length===4&&t&&t.length===4){const e=i[3],s=t[3];if(e===255||s===0)return i;if(e===0)return t;{const n=e/255,r=s/255,a=Math.max(Math.min(Math.floor(i[0]*n+t[0]*r*(1-n)),255),0),o=Math.max(Math.min(Math.floor(i[1]*n+t[1]*r*(1-n)),255),0),h=Math.max(Math.min(Math.floor(i[2]*n+t[2]*r*(1-n)),255),0),c=Math.max(Math.min(Math.floor((n+r*(1-n))*255),255),0);return[a,o,h,c]}}return[255,255,255,255]},Rn=function(){const i=[];return{writeByte(t){i.push(t&255)},writeShort(t){this.writeByte(t),this.writeByte(t>>>8)},writeBytes(t,e=0,s=t.length){for(let n=0;n<s;n++)this.writeByte(t[n+e])},writeString(t){for(let e=0,s=t.length;e<s;e++)this.writeByte(t.charCodeAt(e))},toByteArray(){return i},toString(){let t="[";for(let e=0,s=i.length;e<s;e++)e>0&&(t+=","),t+=i[e];return t+="]",t}}},xo=function(){let i=0,t=0,e=0,s="";const n=function(a){if(!(a<0)){if(a<26)return 65+a;if(a<52)return 97+(a-26);if(a<62)return 48+(a-52);if(a==62)return 43;if(a==63)return 47}throw new Error("n:"+a)},r=function(a){s+=String.fromCharCode(n(a&63))};return{writeByte(a){for(i=i<<8|a&255,t+=8,e+=1;t>=6;)r(i>>>t-6),t-=6},flush(){if(t>0&&(r(i<<6-t),i=0,t=0),e%3!=0){const a=3-e%3;for(let o=0;o<a;o++)s+="="}},toString(){return s}}},bo=function(i,t,e){const s=new Array(i*i),n=function(o){const h=o;let c=0,l=0;return{write(u,f){if(u>>>f)throw new Error("length over");for(;c+f>=8;)h.writeByte(255&(u<<c|l)),f-=8-c,u>>>=8-c,l=0,c=0;l=u<<c|l,c=c+f},flush(){c>0&&h.writeByte(l)}}},r=function(o){const h=1<<o,c=(1<<o)+1;let l=o+1;const u=a();for(let v=0;v<h;v++)u.add(String.fromCharCode(v));u.add(String.fromCharCode(h)),u.add(String.fromCharCode(c));const f=Rn(),m=n(f);m.write(h,l);let g=0,C=String.fromCharCode(s[g]);for(g+=1;g<s.length;){const v=String.fromCharCode(s[g]);g+=1,u.contains(C+v)?C=C+v:(m.write(u.indexOf(C),l),u.size()<4095&&(u.size()==1<<l&&(l+=1),u.add(C+v)),C=v)}return m.write(u.indexOf(C),l),m.write(c,l),m.flush(),f.toByteArray()},a=function(){const o={};let h=0;return{add(c){if(this.contains(c))throw new Error("dup key:"+c);o[c]=h,h+=1},size(){return h},indexOf(c){return o[c]},contains(c){return typeof o[c]<"u"}}};return{setPixel(o,h,c){s[h*i+o]=c},write(o){o.writeString("GIF87a"),o.writeShort(i),o.writeShort(i),o.writeByte(128),o.writeByte(0),o.writeByte(0),o.writeByte(Ue("0x"+t[1]+t[2])),o.writeByte(Ue("0x"+t[3]+t[4])),o.writeByte(Ue("0x"+t[5]+t[6])),o.writeByte(Ue("0x"+e[1]+e[2])),o.writeByte(Ue("0x"+e[3]+e[4])),o.writeByte(Ue("0x"+e[5]+e[6])),o.writeString(","),o.writeShort(0),o.writeShort(0),o.writeShort(i),o.writeShort(i),o.writeByte(0);const h=2,c=r(h);o.writeByte(h);let l=0;for(;c.length-l>255;)o.writeByte(255),o.writeBytes(c,l,255),l+=255;o.writeByte(c.length-l),o.writeBytes(c,l,c.length-l),o.writeByte(0),o.writeString(";")}}},So=function(i,t,e,s){const n=bo(i,t,e);for(let c=0;c<i;c++)for(let l=0;l<i;l++)n.setPixel(l,c,s(l,c));const r=Rn();n.write(r);const a=xo(),o=r.toByteArray();for(let c=0,l=o.length;c<l;c++)a.writeByte(o[c]);a.flush();let h="";return h+="data:image/gif;base64,",h+=a,h},At={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},ps={M:0,L:1,H:2,Q:3},Se={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},nt={glog:function(i){if(i<1)throw new Error("glog("+i+")");return nt.LOG_TABLE[i]},gexp:function(i){for(;i<0;)i+=255;for(;i>=256;)i-=255;return nt.EXP_TABLE[i]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(let i=0;i<8;i++)nt.EXP_TABLE[i]=1<<i;for(let i=8;i<256;i++)nt.EXP_TABLE[i]=nt.EXP_TABLE[i-4]^nt.EXP_TABLE[i-5]^nt.EXP_TABLE[i-6]^nt.EXP_TABLE[i-8];for(let i=0;i<255;i++)nt.LOG_TABLE[nt.EXP_TABLE[i]]=i;const Z={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(i){let t=i<<10;for(;Z.getBCHDigit(t)-Z.getBCHDigit(Z.G15)>=0;)t^=Z.G15<<Z.getBCHDigit(t)-Z.getBCHDigit(Z.G15);return(i<<10|t)^Z.G15_MASK},getBCHTypeNumber:function(i){let t=i<<12;for(;Z.getBCHDigit(t)-Z.getBCHDigit(Z.G18)>=0;)t^=Z.G18<<Z.getBCHDigit(t)-Z.getBCHDigit(Z.G18);return i<<12|t},getBCHDigit:function(i){let t=0;for(;i!=0;)t++,i>>>=1;return t},getPatternPosition:function(i){return Z.PATTERN_POSITION_TABLE[i-1]},getMask:function(i,t,e){switch(i){case Se.PATTERN000:return(t+e)%2==0;case Se.PATTERN001:return t%2==0;case Se.PATTERN010:return e%3==0;case Se.PATTERN011:return(t+e)%3==0;case Se.PATTERN100:return(Math.floor(t/2)+Math.floor(e/3))%2==0;case Se.PATTERN101:return t*e%2+t*e%3==0;case Se.PATTERN110:return(t*e%2+t*e%3)%2==0;case Se.PATTERN111:return(t*e%3+(t+e)%2)%2==0;default:throw new Error("bad maskPattern:"+i)}},getErrorCorrectPolynomial:function(i){let t=new $e([1],0);for(let e=0;e<i;e++)t=t.multiply(new $e([1,nt.gexp(e)],0));return t},getLengthInBits:function(i,t){if(1<=t&&t<10)switch(i){case At.MODE_NUMBER:return 10;case At.MODE_ALPHA_NUM:return 9;case At.MODE_8BIT_BYTE:return 8;case At.MODE_KANJI:return 8;default:throw new Error("mode:"+i)}else if(t<27)switch(i){case At.MODE_NUMBER:return 12;case At.MODE_ALPHA_NUM:return 11;case At.MODE_8BIT_BYTE:return 16;case At.MODE_KANJI:return 10;default:throw new Error("mode:"+i)}else if(t<41)switch(i){case At.MODE_NUMBER:return 14;case At.MODE_ALPHA_NUM:return 13;case At.MODE_8BIT_BYTE:return 16;case At.MODE_KANJI:return 12;default:throw new Error("mode:"+i)}else throw new Error("type:"+t)},getLostPoint:function(i){const t=i.getModuleCount();let e=0;for(let r=0;r<t;r++)for(let a=0;a<t;a++){let o=0;const h=i.isDark(r,a);for(let c=-1;c<=1;c++)if(!(r+c<0||t<=r+c))for(let l=-1;l<=1;l++)a+l<0||t<=a+l||c==0&&l==0||h==i.isDark(r+c,a+l)&&o++;o>5&&(e+=3+o-5)}for(let r=0;r<t-1;r++)for(let a=0;a<t-1;a++){let o=0;i.isDark(r,a)&&o++,i.isDark(r+1,a)&&o++,i.isDark(r,a+1)&&o++,i.isDark(r+1,a+1)&&o++,(o==0||o==4)&&(e+=3)}for(let r=0;r<t;r++)for(let a=0;a<t-6;a++)i.isDark(r,a)&&!i.isDark(r,a+1)&&i.isDark(r,a+2)&&i.isDark(r,a+3)&&i.isDark(r,a+4)&&!i.isDark(r,a+5)&&i.isDark(r,a+6)&&(e+=40);for(let r=0;r<t;r++)for(let a=0;a<t-6;a++)i.isDark(a,r)&&!i.isDark(a+1,r)&&i.isDark(a+2,r)&&i.isDark(a+3,r)&&i.isDark(a+4,r)&&!i.isDark(a+5,r)&&i.isDark(a+6,r)&&(e+=40);let s=0;for(let r=0;r<t;r++)for(let a=0;a<t;a++)i.isDark(a,r)&&s++;const n=Math.abs(100*s/t/t-50)/5;return e+=n*10,e}};class $e{num;constructor(t,e){if(t.length==null)throw new Error(t.length+"/"+e);let s=0;for(;s<t.length&&t[s]==0;)s++;this.num=new Array(t.length-s+e);for(let n=0;n<t.length-s;n++)this.num[n]=t[n+s]}get(t){return this.num[t]}getLength(){return this.num.length}multiply(t){const e=new Array(this.getLength()+t.getLength()-1);for(let s=0;s<this.getLength();s++)for(let n=0;n<t.getLength();n++)e[s+n]^=nt.gexp(nt.glog(this.get(s))+nt.glog(t.get(n)));return new $e(e,0)}mod(t){if(this.getLength()-t.getLength()<0)return this;const e=nt.glog(this.get(0))-nt.glog(t.get(0)),s=new Array(this.getLength());for(let n=0;n<this.getLength();n++)s[n]=this.get(n);for(let n=0;n<t.getLength();n++)s[n]^=nt.gexp(nt.glog(t.get(n))+e);return new $e(s,0).mod(t)}}class ie{totalCount;dataCount;constructor(t,e){this.totalCount=t,this.dataCount=e}static RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];static getRSBlocks(t,e){const s=ie.getRsBlockTable(t,e);if(s==null)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);const n=s.length/3,r=[];for(let a=0;a<n;a++){const o=s[a*3+0],h=s[a*3+1],c=s[a*3+2];for(let l=0;l<o;l++)r.push(new ie(h,c))}return r}static getRsBlockTable(t,e){switch(e){case ps.L:return ie.RS_BLOCK_TABLE[(t-1)*4+0];case ps.M:return ie.RS_BLOCK_TABLE[(t-1)*4+1];case ps.Q:return ie.RS_BLOCK_TABLE[(t-1)*4+2];case ps.H:return ie.RS_BLOCK_TABLE[(t-1)*4+3];default:return}}}class Co{buffer;length;constructor(){this.buffer=[],this.length=0}get(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)==1}put(t,e){for(let s=0;s<e;s++)this.putBit((t>>>e-s-1&1)==1)}getLengthInBits(){return this.length}putBit(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}}class fd{mode;data;constructor(t){this.mode=At.MODE_8BIT_BYTE,this.data=t}getLength(){return this.data.length}write(t){for(let e=0,s=this.data.length;e<s;e++)t.put(this.data.charCodeAt(e),8)}}class Ce{static PAD0=236;static PAD1=17;typeNumber;errorCorrectLevel;modules;moduleCount;dataCache;dataList;constructor(t,e){this.typeNumber=t,this.errorCorrectLevel=ps[e],this.modules=[],this.moduleCount=0,this.dataCache=null,this.dataList=[]}addData(t){const e=new fd(t);this.dataList.push(e),this.dataCache=null}isDark(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]}getModuleCount(){return this.moduleCount}make(){if(this.typeNumber<1){let t=1;for(t=1;t<40;t++){const e=ie.getRSBlocks(t,this.errorCorrectLevel),s=new Co;let n=0;for(let r=0;r<e.length;r++)n+=e[r].dataCount;for(let r=0;r<this.dataList.length;r++){const a=this.dataList[r];s.put(a.mode,4),s.put(a.getLength(),Z.getLengthInBits(a.mode,t)),a.write(s)}if(s.getLengthInBits()<=n*8)break}this.typeNumber=t}this.makeImpl(!1,this.getBestMaskPattern())}makeImpl(t,e){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(let s=0;s<this.moduleCount;s++){this.modules[s]=new Array(this.moduleCount);for(let n=0;n<this.moduleCount;n++)this.modules[s][n]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,e),this.typeNumber>=7&&this.setupTypeNumber(t),this.dataCache==null&&(this.dataCache=Ce.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)}setupPositionProbePattern(t,e){for(let s=-1;s<=7;s++)if(!(t+s<=-1||this.moduleCount<=t+s))for(let n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(0<=s&&s<=6&&(n==0||n==6)||0<=n&&n<=6&&(s==0||s==6)||2<=s&&s<=4&&2<=n&&n<=4?this.modules[t+s][e+n]=!0:this.modules[t+s][e+n]=!1)}getBestMaskPattern(){let t=0,e=0;for(let s=0;s<8;s++){this.makeImpl(!0,s);const n=Z.getLostPoint(this);(s==0||t>n)&&(t=n,e=s)}return e}createMovieClip(t,e,s){const n=t.createEmptyMovieClip(e,s),r=1;this.make();for(let a=0;a<this.modules.length;a++){const o=a*r;for(let h=0;h<this.modules[a].length;h++){const c=h*r;this.modules[a][h]&&(n.beginFill(0,100),n.moveTo(c,o),n.lineTo(c+r,o),n.lineTo(c+r,o+r),n.lineTo(c,o+r),n.endFill())}}return n}setupTimingPattern(){for(let t=8;t<this.moduleCount-8;t++)this.modules[t][6]==null&&(this.modules[t][6]=t%2==0);for(let t=8;t<this.moduleCount-8;t++)this.modules[6][t]==null&&(this.modules[6][t]=t%2==0)}setupPositionAdjustPattern(){const t=Z.getPatternPosition(this.typeNumber);for(let e=0;e<t.length;e++)for(let s=0;s<t.length;s++){const n=t[e],r=t[s];if(this.modules[n][r]==null)for(let a=-2;a<=2;a++)for(let o=-2;o<=2;o++)a==-2||a==2||o==-2||o==2||a==0&&o==0?this.modules[n+a][r+o]=!0:this.modules[n+a][r+o]=!1}}setupTypeNumber(t){const e=Z.getBCHTypeNumber(this.typeNumber);for(let s=0;s<18;s++){const n=!t&&(e>>s&1)==1;this.modules[Math.floor(s/3)][s%3+this.moduleCount-8-3]=n}for(let s=0;s<18;s++){const n=!t&&(e>>s&1)==1;this.modules[s%3+this.moduleCount-8-3][Math.floor(s/3)]=n}}setupTypeInfo(t,e){const s=this.errorCorrectLevel<<3|e,n=Z.getBCHTypeInfo(s);for(let r=0;r<15;r++){const a=!t&&(n>>r&1)==1;r<6?this.modules[r][8]=a:r<8?this.modules[r+1][8]=a:this.modules[this.moduleCount-15+r][8]=a}for(let r=0;r<15;r++){const a=!t&&(n>>r&1)==1;r<8?this.modules[8][this.moduleCount-r-1]=a:r<9?this.modules[8][15-r-1+1]=a:this.modules[8][15-r-1]=a}this.modules[this.moduleCount-8][8]=!t}mapData(t,e){let s=-1,n=this.moduleCount-1,r=7,a=0;for(let o=this.moduleCount-1;o>0;o-=2)for(o==6&&o--;;){for(let h=0;h<2;h++)if(this.modules[n][o-h]==null){let c=!1;a<t.length&&(c=(t[a]>>>r&1)==1),Z.getMask(e,n,o-h)&&(c=!c),this.modules[n][o-h]=c,r--,r==-1&&(a++,r=7)}if(n+=s,n<0||this.moduleCount<=n){n-=s,s=-s;break}}}static createData(t,e,s){const n=ie.getRSBlocks(t,e),r=new Co;for(let o=0;o<s.length;o++){const h=s[o];r.put(h.mode,4),r.put(h.getLength(),Z.getLengthInBits(h.mode,t)),h.write(r)}let a=0;for(let o=0;o<n.length;o++)a+=n[o].dataCount;if(r.getLengthInBits()>a*8)throw new Error("code length overflow. ("+r.getLengthInBits()+">"+a*8+")");for(r.getLengthInBits()+4<=a*8&&r.put(0,4);r.getLengthInBits()%8!=0;)r.putBit(!1);for(;!(r.getLengthInBits()>=a*8||(r.put(Ce.PAD0,8),r.getLengthInBits()>=a*8));)r.put(Ce.PAD1,8);return Ce.createBytes(r,n)}static createBytes(t,e){let s=0,n=0,r=0;const a=new Array(e.length),o=new Array(e.length);for(let u=0;u<e.length;u++){const f=e[u].dataCount,m=e[u].totalCount-f;n=Math.max(n,f),r=Math.max(r,m),a[u]=new Array(f);for(let b=0;b<a[u].length;b++)a[u][b]=255&t.buffer[b+s];s+=f;const g=Z.getErrorCorrectPolynomial(m),v=new $e(a[u],g.getLength()-1).mod(g);o[u]=new Array(g.getLength()-1);for(let b=0;b<o[u].length;b++){const S=b+v.getLength()-o[u].length;o[u][b]=S>=0?v.get(S):0}}let h=0;for(let u=0;u<e.length;u++)h+=e[u].totalCount;const c=new Array(h);let l=0;for(let u=0;u<n;u++)for(let f=0;f<e.length;f++)u<a[f].length&&(c[l++]=a[f][u]);for(let u=0;u<r;u++)for(let f=0;f<e.length;f++)u<o[f].length&&(c[l++]=o[f][u]);return c}}const vo=Math.ceil,ys=Math.floor,To=Math.round;function dd(i,t){const e=yr(i),s=t?.ecc||"H",n=t?.size||256,r=-1,a=t?.padding||0,o=t?.color||"#000000",h=t?.background||"#ffffff",c=new Ce(r,s);c.addData(e),c.make();const l=c.getModuleCount(),u=(n-a*2)/l,f=a,m=n-a;return So(n,o,h,function(g,C){if(f<=g&&g<m&&f<=C&&C<m){const v=ys((g-f)/u),b=ys((C-f)/u);return c.isDark(b,v)?0:1}else return 1})}function md(i,t){const e=t.x||0,s=t.y||0,n=yr(i),r=t.ctx,a=t.ecc||"H",o=typeof t.size=="number"?ys(t.size):256,h=t.padding||0,c=-1,l=t.color||"#000000",u=t.background||"#ffffff",f=new Ce(c,a);f.addData(n),f.make();const m=f.getModuleCount(),g=(o-h*2)/m;r.fillStyle=u,r.fillRect(e,s,o,o);for(let C=0;C<m;C++)for(let v=0;v<m;v++){const b=vo((v+1)*g)-ys(v*g),S=vo((C+1)*g)-ys(C*g);r.fillStyle=f.isDark(C,v)?l:u,r.fillRect(e+To(v*g)+h,s+To(C*g)+h,b,S)}}const ui=new fs,st=new Mt;function ne(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function H(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}class $t{array;itemSize;count;normalized;updateRanges;version;constructor(t,e,s=!1){if(Array.isArray(t))throw new TypeError("BufferAttribute: array should be a Typed Array.");this.array=t,this.itemSize=e,this.count=t.length/e,this.normalized=s,this.updateRanges=[],this.version=0}_onChangeCallback(){}set needsUpdate(t){t===!0&&this.version++}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=Ph(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this}copyAt(t,e,s){t*=this.itemSize,s*=e.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[s+n];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,s=this.count;e<s;e++)ui.fromBufferAttribute(this,e),ui.applyMatrix3(t),this.setXY(e,ui.x,ui.y);else if(this.itemSize===3)for(let e=0,s=this.count;e<s;e++)st.fromBufferAttribute(this,e),st.applyMatrix3(t),this.setXYZ(e,st.x,st.y,st.z);return this}applyMatrix4(t){for(let e=0,s=this.count;e<s;e++)st.fromBufferAttribute(this,e),st.applyMatrix4(t),this.setXYZ(e,st.x,st.y,st.z);return this}applyNormalMatrix(t){for(let e=0,s=this.count;e<s;e++)st.fromBufferAttribute(this,e),st.applyNormalMatrix(t),this.setXYZ(e,st.x,st.y,st.z);return this}transformDirection(t){for(let e=0,s=this.count;e<s;e++)st.fromBufferAttribute(this,e),st.transformDirection(t),this.setXYZ(e,st.x,st.y,st.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let s=this.array[t*this.itemSize+e];return this.normalized&&(s=ne(s,this.array)),s}setComponent(t,e,s){return this.normalized&&(s=H(s,this.array)),this.array[t*this.itemSize+e]=s,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=ne(e,this.array)),e}setX(t,e){return this.normalized&&(e=H(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=ne(e,this.array)),e}setY(t,e){return this.normalized&&(e=H(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=ne(e,this.array)),e}setZ(t,e){return this.normalized&&(e=H(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=ne(e,this.array)),e}setW(t,e){return this.normalized&&(e=H(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,s){return t*=this.itemSize,this.normalized&&(e=H(e,this.array),s=H(s,this.array)),this.array[t+0]=e,this.array[t+1]=s,this}setXYZ(t,e,s,n){return t*=this.itemSize,this.normalized&&(e=H(e,this.array),s=H(s,this.array),n=H(n,this.array)),this.array[t+0]=e,this.array[t+1]=s,this.array[t+2]=n,this}setXYZW(t,e,s,n,r){return t*=this.itemSize,this.normalized&&(e=H(e,this.array),s=H(s,this.array),n=H(n,this.array),r=H(r,this.array)),this.array[t+0]=e,this.array[t+1]=s,this.array[t+2]=n,this.array[t+3]=r,this}onChange(t){return this._onChangeCallback=t,this}clone(){return xr(this,this.array,this.itemSize,this.normalized).copy(this)}toJSON(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized}}}class gd extends $t{constructor(t,e,s=!1){super(new Int8Array(t),e,s)}}class pd extends $t{constructor(t,e,s=!1){super(new Uint8Array(t),e,s)}}class yd extends $t{constructor(t,e,s=!1){super(new Uint8ClampedArray(t),e,s)}}class wd extends $t{constructor(t,e,s=!1){super(new Int16Array(t),e,s)}}class xd extends $t{constructor(t,e,s=!1){super(new Uint16Array(t),e,s)}}class bd extends $t{constructor(t,e,s=!1){super(new Int32Array(t),e,s)}}class Sd extends $t{constructor(t,e,s=!1){super(new Uint32Array(t),e,s)}}class Cd extends $t{isFloat16BufferAttribute=!0;constructor(t,e,s=!1){super(new Uint16Array(t),e,s)}getX(t){let e=Ms(this.array[t*this.itemSize]);return this.normalized&&(e=ne(e,this.array)),e}setX(t,e){return this.normalized&&(e=H(e,this.array)),this.array[t*this.itemSize]=vt(e),this}getY(t){let e=Ms(this.array[t*this.itemSize+1]);return this.normalized&&(e=ne(e,this.array)),e}setY(t,e){return this.normalized&&(e=H(e,this.array)),this.array[t*this.itemSize+1]=vt(e),this}getZ(t){let e=Ms(this.array[t*this.itemSize+2]);return this.normalized&&(e=ne(e,this.array)),e}setZ(t,e){return this.normalized&&(e=H(e,this.array)),this.array[t*this.itemSize+2]=vt(e),this}getW(t){let e=Ms(this.array[t*this.itemSize+3]);return this.normalized&&(e=ne(e,this.array)),e}setW(t,e){return this.normalized&&(e=H(e,this.array)),this.array[t*this.itemSize+3]=vt(e),this}setXY(t,e,s){return t*=this.itemSize,this.normalized&&(e=H(e,this.array),s=H(s,this.array)),this.array[t+0]=vt(e),this.array[t+1]=vt(s),this}setXYZ(t,e,s,n){return t*=this.itemSize,this.normalized&&(e=H(e,this.array),s=H(s,this.array),n=H(n,this.array)),this.array[t+0]=vt(e),this.array[t+1]=vt(s),this.array[t+2]=vt(n),this}setXYZW(t,e,s,n,r){return t*=this.itemSize,this.normalized&&(e=H(e,this.array),s=H(s,this.array),n=H(n,this.array),r=H(r,this.array)),this.array[t+0]=vt(e),this.array[t+1]=vt(s),this.array[t+2]=vt(n),this.array[t+3]=vt(r),this}}class vd extends $t{constructor(t,e,s=!1){super(new Float32Array(t),e,s)}}class ut extends j{shapesCountChange=!1;constructor(t){super(t)}shapeInit(){}frameStart(t){return this.shapesCountChange&&(this.shapesCountChange=!1,this.shapes.forEach(e=>{e.parent=this,e.initPathD()}),this.pathd=this.initPathD(),this.shapes.forEach(e=>{!e.forceCXY&&!e.independentTransformInGroup&&(e.cX=this.cX-e.diffXInGroup,e.cY=this.cY-e.diffYInGroup)})),super.frameStart(t)}frameUpdate(t,e){this.shapes.forEach(s=>{!s.independentTransformInGroup&&!s.isDragging&&(s.x=this.x+s.diffXInGroup,s.y=this.y+s.diffYInGroup,s.degree=this.degree+s.diffDegreeInGroup,s.scalarX=this.scalarX*s.diffScalarXInGroup,s.scalarY=this.scalarY*s.diffScalarYInGroup)}),super.frameUpdate(t,e)}addShape(t){(Array.isArray(t)?t:[t]).forEach(e=>{this.shapes.findIndex(s=>s.id==e.id)==-1&&(e.on("draging",(s,n)=>{this.enableDrag&&(this.x+=s,this.y+=n,this.emit("draging",s,n,e))}),this.shapes.push(e),this.shapesCountChange=!0)})}getBoundingClientRect(){const t=[],e=[];this.shapes.forEach(h=>{const c=h.getBoundingClientRect();c&&(t.push(c.x,c.x+c.width),e.push(c.y,c.y+c.height))});const s=this.pathd?.getBoundingClientRect();if(s&&(s.width||s.height)&&(t.push(s.x,s.x+s.width),e.push(s.y,s.y+s.height)),t.length==0||e.length==0)return null;const n=Math.min.apply(0,t),r=Math.min.apply(0,e),a=Math.max.apply(0,t),o=Math.max.apply(0,e);return{x:n,y:r,width:a-n,height:o-r}}setAttrs(t,e){typeof t!="string"?(super.setAttr(t),this.shapes.forEach(s=>{s.setAttr(t)})):e&&(super.setAttr(t,e),this.shapes.forEach(s=>{s.setAttr(t,e)}))}sortPathD(){this.shapes=this.shapes.map(t=>{const e=t.initPathD();return{shape:t,perimeter:e.perimeterPoints()}}).sort((t,e)=>e.perimeter-t.perimeter).map(t=>t.shape)}expendFill(t){const e=t.shapes.length,s=this.shapes.length;if(e<s)return t.expendFill(this);for(let n=s;n<e;n++){const a=t.shapes[n].initPathD().polymorphPoints,o=a[0],h=a[1],c=[["M",o,h]];for(let l=2;l+5<a.length;l+=6)c.push(["C",o,h,o,h,o,h]);this.addShape(new j({attrs:{...t.shapes[n].getAttrs()},d:c}))}}strokeDashTween(t,e){switch(e?.type){case"sequence":const s=this.shapes.length-1;this.shapes.forEach((o,h)=>{o.strokeDashTween(t,{...e,delay:h,onStart:()=>{h==0&&e?.onGroupStart?.()},onUpdate:()=>{e?.onGroupUpdate?.()},onComplete:()=>{h==s&&e?.onGroupComplete?.()}})});break;case"parallel":default:const n=new Js({frameDuration:t}),r={},a={};this.shapes.forEach((o,h)=>{const c=jt(o.getTotalLength(),0);r[`offset_${h}`]=c,a[`offset_${h}`]=0,o.setAttr({strokeDasharray:`${c} ${c}`,strokeDashoffset:`${c}`})}),n.addTween(r,a,Object.assign(e||{},{onStart:()=>{e?.onGroupStart?.()},onUpdate:(o,h)=>{for(let c in o){const l=Ii(c).number;this.shapes[l].setAttr("strokeDashoffset",""+jt(o[c],2))}e?.onGroupUpdate?.()},onComplete:()=>{e?.onGroupComplete?.()}})),n.play();break}}}const Td={1:705234,2:8108026,3:6346665,4:16630114,5:16607842,6:16158139,7:2542847,8:10640125,9:16735870,10:8978266,11:16580418,12:16754221,13:16725759,14:14436630,15:6844849,16:13744437,17:1817755,18:16744272,19:4964291,20:16750848,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};class Q{static NAMES=Td;_color={r:0,g:0,b:0,a:1};constructor(t,e){t&&this.setColor(t),this.setAlpha(e)}get color(){return this._color}set color(t){const e="Color: Unknown color "+t;if(typeof t=="number")this.setHEX(t);else if(typeof t=="string"){let s;if(s=/^(\w+)\(([^)]*)\)/.exec(t)){const n=s[2];let r;switch(s[1]){case"rgb":case"rgba":(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))?(this.r=parseInt(r[1],10),this.g=parseInt(r[2],10),this.b=parseInt(r[3],10),r[4]&&(this.a=parseFloat(r[4]))):(r=/^\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))?(this.r=F(parseFloat(r[1]),0,100)*255/100,this.g=F(parseFloat(r[2]),0,100)*255/100,this.b=F(parseFloat(r[3]),0,100)*255/100,r[4]&&(this.a=parseFloat(r[4]))):console.warn(e);break;case"hsl":case"hsla":(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))?(this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100),r[4]&&(this.a=parseFloat(r[4]))):console.warn(e);break;default:console.warn(e)}}else if(s=/^#([A-Fa-f\d]+)$/.exec(t)){const n=s[1],r=n.length;r===3?this.setRGB(parseInt(n.charAt(0),16),parseInt(n.charAt(1),16),parseInt(n.charAt(2),16)):r===6||r===8?this.setHEX(parseInt(n,16)):console.warn(e)}else if(t&&t.length>0)try{this.setColorName(t)}catch{console.warn(e)}else console.warn(e)}else Object.prototype.hasOwnProperty.call(t,"r")&&Object.prototype.hasOwnProperty.call(t,"g")&&Object.prototype.hasOwnProperty.call(t,"b")?this.setRGB(t.r,t.g,t.b,t.a):Object.prototype.hasOwnProperty.call(t,"h")&&Object.prototype.hasOwnProperty.call(t,"s")&&Object.prototype.hasOwnProperty.call(t,"l")?this.setHSL(t.h,t.s,t.l,t.a):Object.prototype.hasOwnProperty.call(t,"h")&&Object.prototype.hasOwnProperty.call(t,"s")&&Object.prototype.hasOwnProperty.call(t,"v")?this.setHSV(t.h,t.s,t.v,t.a):console.warn(e)}setColor(t){return this.color=t,this}set(t){return this.setColor(t)}get r(){return this._color.r}set r(t){try{this._color.r=F(Math.round(It(t)),0,255)}catch{}}get g(){return this._color.g}set g(t){try{this._color.g=F(Math.round(It(t)),0,255)}catch{}}get b(){return this._color.b}set b(t){try{this._color.b=F(Math.round(It(t)),0,255)}catch{}}get a(){return this._color.a}set a(t){try{this._color.a=F(It(t),0,1)}catch{}}setAlpha(t){return this.a=t,this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,s=this.g,n=this.b,r=t.value;return this.r=r[0]*e+r[3]*s+r[6]*n,this.g=r[1]*e+r[4]*s+r[7]*n,this.b=r[2]*e+r[5]*s+r[8]*n,this}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this.a=t[e+3],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a,t}toRGBString(){return this.a===1?`rgb(${this.r},${this.g},${this.b})`:`rgba(${this.r},${this.g},${this.b},${jt(this.a,6)})`}toHexString(){return this.a===1?("000000"+this.hex.toString(16)).slice(-6):("00000000"+this.hex.toString(16)).slice(-8)}toString(){return this.a===1?"#"+this.toHexString():this.toRGBString()}toColorSpaceString(t=ze){On.fromWorkingColorSpace(Ut.copy(this),t);const e=Ut.r,s=Ut.g,n=Ut.b;return t!==ze?`color(${t} ${e.toFixed(3)} ${s.toFixed(3)} ${n.toFixed(3)})`:this.toRGBString()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b,yield this.a}clone(){return new Q(this.color)}copy(t){return this.setColor(t.color),this}copySRGBToLinear(t){return this.r=Re(t.r),this.g=Re(t.g),this.b=Re(t.b),this}copyLinearToSRGB(t){return this.r=Le(t.r),this.g=Le(t.g),this.b=Le(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a}add(t){return this.r=this.r+t.r,this.g=this.g+t.g,this.b=this.b+t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r=this.r+t,this.g=this.g+t,this.b=this.b+t,this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}sub(t){return this.r=this.r-t.r,this.g=this.g-t.g,this.b=this.b-t.b,this}multiply(t){return this.r=this.r*t.r,this.g=this.g*t.g,this.b=this.b*t.b,this}multiplyScalar(t){return this.r=this.r*t,this.g=this.g*t,this.b=this.b*t,this}opposite(t=!1,e="#000000",s="#ffffff"){if(t)return this.setColor(this.r*.299+this.g*.587+this.b*.114>186?e:s);{const{r:n,g:r,b:a}=this.color;return this.r=255-n,this.g=255-r,this.b=255-a,this}}lighten(t){t=F(t,0,1);const{r:e,g:s,b:n}=this.color;return this.r+=(255-e)*t,this.g+=(255-s)*t,this.b+=(255-n)*t,this}darken(t){t=F(t,0,1);const{r:e,g:s,b:n}=this.color;return this.r=e*(1-t),this.g=s*(1-t),this.b=n*(1-t),this}lerp(t,e){return e=F(e,0,1),this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,s){return s=F(s,0,1),this.r=t.r+(e.r-t.r)*s,this.g=t.g+(e.g-t.g)*s,this.b=t.b+(e.b-t.b)*s,this}static gradient(t,e,s){try{return Ut.lerpColors(new Q(t),new Q(e),s).toString()}catch{return e}}static random(){return Ut.setHEX(Math.random()*16777215).toString()}static nextIndex=0;static next(t=Q.nextIndex){Q.nextIndex=t;const e=Object.keys(Q.NAMES),s=e.length;return Ut.setHEX(Q.NAMES[e[Q.nextIndex++%s]]).toString()}setColorName(t){const e=Q.NAMES[t.toLowerCase()];return e!==void 0?this.setHEX(e):t==="none"?this.a=0:console.warn("Color.setColorName: Unknown color "+t),this}static getColors(){return Object.values(Q.NAMES).map(t=>Ut.setHEX(t).toString())}setRGB(t,e,s,n){return this.r=t,this.g=e,this.b=s,this.a=n,this}get rgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}setHEX(t){return t=Math.floor(t),t<16777216?(this.r=t>>16&255,this.g=t>>8&255,this.b=t&255):(this.r=t>>24&255,this.g=t>>16&255,this.b=t>>8&255,this.a=(t&255)/255),this}get hex(){let t=(this.r<<16)+(this.g<<8)+this.b;return this.a!==1&&(t=t<<8,t+=Math.round(this.a*255)),t}setHSL(t,e,s,n){const r=Oh(t,1),a=F(e,0,1),o=F(s,0,1);if(a===0)this.r=o*255,this.g=o*255,this.b=o*255;else{const h=o<=.5?o*(1+a):o+a-o*a,c=2*o-h;this.r=Fn(c,h,r+.3333333333333333)*255,this.g=Fn(c,h,r)*255,this.b=Fn(c,h,r-.3333333333333333)*255}return this.a=n,this}getHSL(t){const e=this.r,s=this.g,n=this.b,r=Math.max(e,s,n)/255,a=Math.min(e,s,n)/255;let o,h;const c=(a+r)/2;if(a===r)o=0,h=0;else{const l=r-a;switch(h=c<=.5?l/(r+a):l/(2-r-a),r){case e:o=(s-n)/l+(s<n?6:0);break;case s:o=(n-e)/l+2;break;case n:default:o=(e-s)/l+4;break}o/=6}return t&&t.setHSL(o,h,c,this.a),{h:o,s:h,l:c,a:this.a}}offsetHSL(t,e,s){const n=this.getHSL();return this.setHSL(n.h+t,n.s+e,n.l+s)}lerpHSL(t,e){const s=this.getHSL(),n=t.getHSL(),r=ki(s.h,n.h,e),a=ki(s.s,n.s,e),o=ki(s.l,n.l,e);return this.setHSL(r,a,o),this}setHSV(t,e,s,n){const r=F(t,0,1)*360,a=F(e,0,1),o=F(s,0,1),h=Math.floor(r/60)%6,c=r/60-Math.floor(r/60),l=o*(1-a),u=o*(1-c*a),f=o*(1-(1-c)*a),m=[[o,f,l],[u,o,l],[l,o,f],[l,u,o],[f,l,o],[o,l,u]][h];return this.r=m[0]*255,this.g=m[1]*255,this.b=m[2]*255,this.a=n,this}getHSV(t){const{r:e,g:s,b:n,a:r}=this.color,a=Math.max(e,s,n),o=Math.min(e,s,n),h=a-o;let c;e===a?c=(s-n)/h:s===a?c=2+(n-e)/h:c=4+(e-s)/h,c/=6,c<0&&(c+=1);const l=h==0?0:c,u=a===0?0:h/a,f=a/255;return t&&t.setHSV(l,u,f,r),{h:l,s:u,v:f,a:r}}}const Ut=new Q;function Re(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Le(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}const _o="",ze="srgb",Ln="srgb-linear",zn="linear",fi="srgb",Po=new qe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Mo=new qe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),Eo=[.64,.33,.3,.6,.15,.06],Ao=[.2126,.7152,.0722],ko=[.3127,.329],On={enabled:!0,workingColorSpace:Ln,spaces:{},convert:function(i,t,e){return this.enabled===!1||t===e||!t||!e||(this.spaces[t].transfer===fi&&(i.r=Re(i.r),i.g=Re(i.g),i.b=Re(i.b)),this.spaces[t].primaries!==this.spaces[e].primaries&&(i.applyMatrix3(this.spaces[t].toXYZ),i.applyMatrix3(this.spaces[e].fromXYZ)),this.spaces[e].transfer===fi&&(i.r=Le(i.r),i.g=Le(i.g),i.b=Le(i.b))),i},fromWorkingColorSpace:function(i,t){return this.convert(i,this.workingColorSpace,t)},toWorkingColorSpace:function(i,t){return this.convert(i,t,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===_o?zn:this.spaces[i].transfer},getLuminanceCoefficients:function(i,t=this.workingColorSpace){return i.fromArray(this.spaces[t].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,t,e){return i.copy(this.spaces[t].toXYZ).multiply(this.spaces[e].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace}};On.define({[Ln]:{primaries:Eo,whitePoint:ko,transfer:zn,toXYZ:Po,fromXYZ:Mo,luminanceCoefficients:Ao,workingColorSpaceConfig:{unpackColorSpace:ze},outputColorSpaceConfig:{drawingBufferColorSpace:ze}},[ze]:{primaries:Eo,whitePoint:ko,transfer:fi,toXYZ:Po,fromXYZ:Mo,luminanceCoefficients:Ao,outputColorSpaceConfig:{drawingBufferColorSpace:ze}}});function Fn(i,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<.16666666666666666?i+(t-i)*6*e:e<.5?t:e<.6666666666666666?i+(t-i)*6*(.6666666666666666-e):i}const Oe={backgroundColor:"#1a1a1a",numberColor:"#2FA1D6",booleanColor:"#806787",stringColor:"#1ed36f",functionColor:"#e61d5f",saveRowColor:"#dad5cb",buttonColor:"",borderColor:"",inputColor:""};Oe.buttonColor=new Q(Oe.saveRowColor).darken(.1).toString(),Oe.borderColor=new Q(Oe.backgroundColor).lighten(.07).toString(),Oe.inputColor=new Q(Oe.backgroundColor).lighten(.085).toString();class Fe extends j{toX;toY;constructor(t){super(t),this.toX=t?.toX||0,this.toY=t?.toY||0;let e=this.toX-this.x,s=this.toY-this.y;return new Proxy(this,{set(n,r,a,o){switch(r){case"x":n.toX=a+e;break;case"y":n.toY=a+s;break;case"toX":e=a-n.x;break;case"toY":s=a-n.y;break}return Reflect.set(n,r,a,o)}})}toSVGPathData(){return[["m",0,0],["l",this.toX-this.x,this.toY-this.y]]}toCanvasContext(t){t.beginPath(),t.moveTo(0,0),t.lineTo(this.toX-this.x,this.toY-this.y)}intersection(t){const e=new Ua({x:this.x,y:this.y,toX:this.toX,toY:this.toY}),s=new Ua({x:t.x,y:t.y,toX:t.toX,toY:t.toY});return e.intersection(s)}}class _d extends j{cx;cy;toX;toY;isLineThrough;constructor(t){super(t),this.cx=t?.cx||0,this.cy=t?.cy||0,this.toX=t?.toX||0,this.toY=t?.toY||0,this.isLineThrough=typeof t?.isLineThrough=="boolean"?t.isLineThrough:!1}toSVGPathData(){if(this.isLineThrough){const t=this.cx*2-(this.x+this.toX)/2,e=this.cy*2-(this.y+this.toY)/2;return[["m",0,0],["q",t-this.x,e-this.y,this.toX-this.x,this.toY-this.y]]}else return[["m",0,0],["q",this.cx-this.x,this.cy-this.y,this.toX-this.x,this.toY-this.y]]}toCanvasContext(t){if(t.beginPath(),t.moveTo(0,0),this.isLineThrough){const e=this.cx*2-(this.x+this.toX)/2,s=this.cy*2-(this.y+this.toY)/2;t.quadraticCurveTo(e-this.x,s-this.y,this.toX-this.x,this.toY-this.y)}else t.quadraticCurveTo(this.cx-this.x,this.cy-this.y,this.toX-this.x,this.toY-this.y)}}class ws{video;constructor(t){this.video=t}setSrcObject(t){this.video.addEventListener("loadedmetadata",e=>{e.target}),this.video.srcObject=t}captureWebCamera(){navigator.mediaDevices.getUserMedia({video:!0}).then(t=>{this.setSrcObject(t)})}static async videoMediaChangeSupport(){return new Promise(t=>{const e=document.createElement("iframe"),s=document.createElement("video"),n=document.createElement("source"),r=new MediaSource;r.addEventListener("sourceopen",()=>t(!0)),n.src=URL.createObjectURL(r),n.media="(min-width:10px)",s.append(n),e.width="5",e.style.cssText="position: absolute; visibility: hidden;",document.documentElement.append(e),e.contentDocument?.body.append(s),setTimeout(()=>{e.width="15"}),setTimeout(()=>{e.remove(),t(!1)},1e3)})}static tryAutoPlayOrAutoPlayAfterClick(t){return new Promise(e=>{t.play().then(()=>{t.autoplay=!0,e(!0)}).catch(()=>{ws.setAutoPlayWhenClick(t),e(!1)})})}static setAutoPlayWhenClick(t){function e(){t.autoplay=!0,t.play(),document.removeEventListener("click",e),document.removeEventListener("touchend",e)}document.addEventListener("click",e),document.addEventListener("touchend",e)}}class Io extends Xe{source;raw="";mode="text";tagname="";nodename="";textchunk="";entity="";quote="";attrs={};constructor(t){super(),this.source=t}parse(){const t=Ch(this.source);if(t===0){this.emit("finish");return}let e,s,n=mr(this.source,0);for(let r=1;r<t;r++)e=s,s=n,n=mr(this.source,r),this.raw+=s,s&&this.step(s,n,e);n&&this.step(n,void 0,s),this.emit("finish")}step(t,e,s){t==`
|
|
34
|
+
`))}Tf();const be=new Xe;let oi,hi,ci,li;In(document.documentElement,()=>{setTimeout(()=>{const i=getComputedStyle(document.documentElement),t=i.getPropertyValue("--sat");t!==oi&&be.emit("top",t),oi=t;const e=i.getPropertyValue("--sar");e!==hi&&be.emit("right",e),hi=e;const s=i.getPropertyValue("--sab");s!==ci&&be.emit("bottom",s),ci=s;const n=i.getPropertyValue("--sal");n!==li&&be.emit("left",n),li=n},0)});const _f={onTop:i=>(oi&&i(oi),be.on("top",i)),onRight:i=>(hi&&i(hi),be.on("right",i)),onBottom:i=>(ci&&i(ci),be.on("bottom",i)),onLeft:i=>(li&&i(li),be.on("left",i))},gs=[];let fo=Ri;function mo(i){return gs.length==0&&(fo=B(document,"scroll",t=>{gs.forEach(e=>e(t))})),gs.push(i),()=>{Pe(gs,i),gs.length==0&&fo()}}function Pf(i,t){window.scrollTo(i,t)}function Mf(){let i=Ri,t=Ri;return"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual",i=oo(()=>{window.history.scrollRestoration="auto"}),t=ao(()=>{window.history.scrollRestoration="manual"})),()=>{i(),t()}}async function go(i,t,e={threshold:.5}){return new Promise(s=>{new IntersectionObserver((r,a)=>{t(r,a),s(()=>{a.unobserve(i)})},e).observe(i)})}function Ef(i,t){let e;function s(){const{width:n,height:r}=t?.root?.getBoundingClientRect()||Ka(),{top:a,left:o,right:h,bottom:c}=i.getBoundingClientRect();(a>=0&&a<=r||c>=0&&c<=r)&&(o>=0&&o<=n||h>=0&&h<=n)?(e!==!0&&t?.onShow?.(),e=!0):(e!==!1&&t?.onHide?.(),e=!1)}return s(),mo(s)}async function Af(i,t){let e;const s=typeof t.threshold=="number"?t.threshold:.5;return go(i,n=>{let r=n[0];if(n.length>1){const o=n.find(h=>h.isIntersecting);o&&(r=o)}const a=r.isIntersecting&&r.intersectionRatio>=s;e!==a&&(a?t?.onShow?.():t?.onHide?.()),e=a},{threshold:s,root:t.root})}function kf(i){return i(!document.hidden),B(window,"visibilitychange",()=>{i(!document.hidden)})}function If(i,t,e,s,n){const r=t/e;let a=0,o=0;switch(i){case"aspectFit":r>=1?(a=s,o=a/r,o>n&&(o=n,a=o*r)):(o=n,a=o*r,a>s&&(a=s,o=a/r));break;case"aspectFill":r>=1?(o=n,a=o*r):(a=s,o=a/r);break;case"widthFix":a=s,o=a/r;break;case"heightFix":o=n,a=o*r;break;case"scaleToFill":default:a=s,o=n;break}return{width:a,height:o}}function po(i){try{const t=document.createElement("canvas"),e=t.getContext("2d");return t.width=i.width,t.height=i.height,e.drawImage(i,0,0,t.width,t.height),e.getImageData(0,0,t.width,t.height)}catch{return new ImageData(i.width,i.height)}}const Df=i=>{const t=i.width,e=i.height,s=t*e*3,n=s+54,r=[66,77,n&255,n>>8&255,n>>16&255,n>>24&255,0,0,0,0,54,0,0,0],a=[40,0,0,0,t&255,t>>8&255,t>>16&255,t>>24&255,e&255,e>>8&255,e>>16&255,e>>24&255,1,0,24,0,0,0,0,0,s&255,s>>8&255,s>>16&255,s>>24&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o=(4-t*3%4)%4,h=i.data;let c="";const l=t<<2;let u=e;const f=String.fromCharCode;do{const g=l*(u-1);let C="";for(let v=0;v<t;v++){const b=v<<2;C+=f(h[g+b+2])+f(h[g+b+1])+f(h[g+b])}for(let v=0;v<o;v++)C+=String.fromCharCode(0);c+=C}while(--u);function m(g){if(!window.btoa)throw"btoa undefined";let C="";if(typeof g=="string")C=g;else for(let v=0;v<g.length;v++)C+=String.fromCharCode(g[v]);return btoa(C)}return m(r.concat(a))+m(c)},Rf=i=>{const{width:t,height:e}=i,s=document.createElement("canvas"),n=s.getContext("2d");return s.width=t,s.height=e,n.putImageData(i,0,0,0,0,t,e),s.toDataURL("image/png")},Lf=(i,t,e)=>{const{width:s,height:n}=i,r=document.createElement("canvas"),a=r.getContext("2d");r.width=s,r.height=n,a.putImageData(i,0,0,0,0,s,n);const o=`image/${t?t.toLowerCase():"png"}`;r.toBlob(h=>{e?.(null,h)},o,1)};function zf(i,t){return createImageBitmap(i,t)}function Of(i){const t=[],e=[],s=[];let n=0;for(let h=0,c=i.data.length;h<c;h+=4)t[n]=i.data[h],e[n]=i.data[h+1],s[n]=i.data[h+2],n+=1;const r=Dn(t),a=Dn(e),o=Dn(s);return"rgb("+r+","+a+","+o+")"}function Dn(i){const t={},e=[],s=[];for(let o=0;o<i.length;o++)t[i[o]]?e.push(i[o]):t[i[o]]=1;let n=0;for(let o=0;o<e.length;o++){n=0;for(let h=0;h<e.length;h++)e[o]===e[h]&&(n+=1),s[o]=n}const r=Math.max.apply(null,s);let a=0;for(;a<s.length;a++)if(s[a]===r)return;return e[a]}const Ff=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=t[(a*e+e-o-1)*4],n[h+1]=t[(a*e+e-o-1)*4+1],n[h+2]=t[(a*e+e-o-1)*4+2],n[h+3]=t[(a*e+e-o-1)*4+3]}return new ImageData(n,e,s)},Bf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=t[((s-a-1)*e+o)*4],n[h+1]=t[((s-a-1)*e+o)*4+1],n[h+2]=t[((s-a-1)*e+o)*4+2],n[h+3]=t[((s-a-1)*e+o)*4+3]}return new ImageData(n,e,s)},Nf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<e;a++)for(let o=0;o<s;o++){const h=(a*s+o)*4;n[h]=t[(o*e+e-a-1)*4],n[h+1]=t[(o*e+e-a-1)*4+1],n[h+2]=t[(o*e+e-a-1)*4+2],n[h+3]=t[(o*e+e-a-1)*4+3]}return new ImageData(n,s,e)},Yf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<e;a++)for(let o=0;o<s;o++){const h=(a*s+o)*4;n[h]=t[((s-o-1)*e+a)*4],n[h+1]=t[((s-o-1)*e+a)*4+1],n[h+2]=t[((s-o-1)*e+a)*4+2],n[h+3]=t[((s-o-1)*e+a)*4+3]}return new ImageData(n,s,e)},Uf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,c=(t[h]+t[h+1]+t[h+2])/3;n[h]=c,n[h+1]=c,n[h+2]=c,n[h+3]=t[h+3]}return new ImageData(n,e,s)},Xf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,c=.2126*t[h]+.7152*t[h+1]+.0722*t[h+2];n[h]=c,n[h+1]=c,n[h+2]=c,n[h+3]=t[h+3]}return new ImageData(n,e,s)},Vf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,l=(t[h]+t[h+1]+t[h+2])/3>127?255:0;n[h]=l,n[h+1]=l,n[h+2]=l,n[h+3]=t[h+3]}return new ImageData(n,e,s)},Gf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=255-t[h],n[h+1]=255-t[h+1],n[h+2]=255-t[h+2],n[h+3]=t[h+3]}return new ImageData(n,e,s)},qf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=t[h],n[h+1]=0,n[h+2]=0,n[h+3]=t[h+3]}return new ImageData(n,e,s)},jf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=0,n[h+1]=t[h+1],n[h+2]=0,n[h+3]=t[h+3]}return new ImageData(n,e,s)},Hf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=0,n[h+1]=0,n[h+2]=t[h+2],n[h+3]=t[h+3]}return new ImageData(n,e,s)},Wf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=t[h],n[h+1]=t[h+1],n[h+2]=0,n[h+3]=t[h+3]}return new ImageData(n,e,s)},$f=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=t[h],n[h+1]=0,n[h+2]=t[h+1],n[h+3]=t[h+3]}return new ImageData(n,e,s)},Jf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=0,n[h+1]=t[h+1],n[h+2]=t[h+1],n[h+3]=t[h+3]}return new ImageData(n,e,s)},Zf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,c=(t[h+1]+t[h+2])/2;n[h]=t[h],n[h+1]=c,n[h+2]=c,n[h+3]=t[h+3]}return new ImageData(n,e,s)},Kf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,c=(t[h]+t[h+2])/2;n[h]=c,n[h+1]=t[h+1],n[h+2]=c,n[h+3]=t[h+3]}return new ImageData(n,e,s)},Qf=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4,c=(t[h]+t[h+1])/2;n[h]=c,n[h+1]=c,n[h+2]=t[h+2],n[h+3]=t[h+3]}return new ImageData(n,e,s)},td=i=>yo(i,[-1,-1,-1,-1,9,-1,-1,-1,-1]),ed=i=>yo(i,[-1,-1,-1,-1,8,-1,-1,-1,-1]),sd=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;n[h]=t[h],n[h+1]=t[h+1],n[h+2]=t[h+2],n[h+3]=255}return new ImageData(n,e,s)},id=i=>{const{data:t,width:e,height:s}=i,n=new Uint8ClampedArray(t.length);for(let a=0;a<s;a++)for(let o=0;o<e;o++){const h=(a*e+o)*4;if(t[h+3]===0)n[h]=255,n[h+1]=255,n[h+2]=255,n[h+3]=255;else{const c=wo([t[h],t[h+1],t[h+2],t[h+3]],[255,255,255,255]);n[h]=c[0],n[h+1]=c[1],n[h+2]=c[2],n[h+3]=c[3]}}return new ImageData(n,e,s)},nd=(i,t,e,s,n,r=!1,a)=>{const{data:o,width:h,height:c}=i;let l=n,u=s,f=t,m=e;if(l<0?l=0:l>h&&(l=h),u<0?u=0:u>c&&(u=c),f<1?f=1:f>h&&(f=h),m<1?m=1:m>c&&(m=c),l+f>h&&(f=h-l),u+m>c&&(m=c-u),r){const g=new Uint8ClampedArray(o.length);for(let v=0;v<c;v++)for(let b=0;b<h;b++){const S=(v*h+b)*4;b>=l&&b<=l+f&&v>=u&&v<=u+m?(g[S]=o[S],g[S+1]=o[S+1],g[S+2]=o[S+2],g[S+3]=o[S+3]):(g[S]=255,g[S+1]=255,g[S+2]=255,g[S+3]=a&&["JPG","JPEG"].includes(a.toUpperCase())?255:0)}return new ImageData(g,h,c)}else{const g=new Uint8ClampedArray(f*m*4);for(let v=u;v<=u+m;v++)for(let b=l;b<=l+f;b++){const S=((v-u)*f+b-l)*4,y=(v*h+b)*4;g[S]=o[y],g[S+1]=o[y+1],g[S+2]=o[y+2],g[S+3]=o[y+3]}return new ImageData(g,f,m)}},rd=(i,t,e,s)=>{const{data:n,width:r,height:a}=i;let o=t;o>Math.floor(r/2)&&(o=Math.floor(r/2)),o>Math.floor(a/2)&&(o=Math.floor(a/2)),o<0&&(o=0);const h=new Uint8ClampedArray(n.length);for(let l=0;l<a;l++)for(let u=0;u<r;u++){const f=(l*r+u)*4;let m=-1;u<o?l<o?m=Math.sqrt(Math.pow(o-u-1,2)+Math.pow(o-l-1,2)):l>a-o-1&&(m=Math.sqrt(Math.pow(o-u-1,2)+Math.pow(l-(a-o),2))):u>r-o-1&&(l<o?m=Math.sqrt(Math.pow(u-(r-o),2)+Math.pow(o-l-1,2)):l>a-o-1&&(m=Math.sqrt(Math.pow(u-(r-o),2)+Math.pow(l-(a-o),2)))),Math.round(m)>o?(h[f]=255,h[f+1]=255,h[f+2]=255,h[f+3]=s||e.toUpperCase()==="PNG"?0:255):(h[f]=n[f],h[f+1]=n[f+1],h[f+2]=n[f+2],h[f+3]=s||e.toUpperCase()==="PNG"?n[f+3]:255)}return new ImageData(h,r,a)},ad=(i,t,e,s,n,r=1e4)=>{const a=new Image;a.src=i;const o=document.createElement("canvas"),h=o.getContext("2d");return o.width=r,o.height=r,h.drawImage(a,0,0,t,e,0,0,s,n),h.getImageData(0,0,s,n)},od=(i,t)=>{const{data:e,width:s,height:n}=i,r=new Uint8ClampedArray(e.length);for(let o=0;o<n;o++)for(let h=0;h<s;h++){const c=(o*s+h)*4;r[c]=Math.max(Math.min(e[c]+t,255),0),r[c+1]=Math.max(Math.min(e[c+1]+t,255),0),r[c+2]=Math.max(Math.min(e[c+2]+t,255),0),r[c+3]=e[c+3]}return new ImageData(r,s,n)},hd=(i,t,e=!1)=>{const{data:s,width:n,height:r}=i,a=new Uint8ClampedArray(s.length);for(let h=0;h<r;h++)for(let c=0;c<n;c++){const l=(h*n+c)*4;s[l+3]===0?(a[l]=255,a[l+1]=255,a[l+2]=255):(a[l]=s[l],a[l+1]=s[l+1],a[l+2]=s[l+2]);let u=s[l+3];e?u=Math.max(Math.min(Math.floor(255*t),255),0):u=Math.max(Math.min(Math.floor(u+255*t),255),0),a[l+3]=u}return new ImageData(a,n,r)},cd=(i,t,e,s)=>{const{data:n,width:r,height:a}=i,{data:o,width:h,height:c}=t;let l=e,u=s;e+c>a&&(l=a-c),s+h>r&&(u=r-h);const f=new Uint8ClampedArray(n.length);for(let g=0;g<a;g++)for(let C=0;C<r;C++){const v=(g*r+C)*4;if(C<u||C>u+h||g<=l||g>=l+c)f[v]=n[v],f[v+1]=n[v+1],f[v+2]=n[v+2],f[v+3]=n[v+3];else{const b=(g*r+C-((l+1)*r+(g-(l+1))*(r-h))+h-u-1)*4,S=[o[b],o[b+1],o[b+2],o[b+3]],y=[n[v],n[v+1],n[v+2],n[v+3]],w=wo(S,y);f[v]=w[0],f[v+1]=w[1],f[v+2]=w[2],f[v+3]=w[3]}}return new ImageData(f,r,a)},ld=(i,t,e,s,n,r=10)=>{const{data:a,width:o,height:h}=i;let c=n,l=s,u=t,f=e;c<0?c=0:c>o&&(c=o),l<0?l=0:l>h&&(l=h),u<1?u=1:u>o&&(u=o),f<1?f=1:f>h&&(f=h),c+u>o&&(u=o-c),l+f>h&&(f=h-l);const m=new Uint8ClampedArray(a.length);for(let C=0;C<h;C++)for(let v=0;v<o;v++){const b=(C*o+v)*4;if(v>=c&&v<=c+u&&C>=l&&C<=l+f){const S=Math.floor((v-c)/r),y=Math.floor((C-l)/r);let w=Math.floor(r*(S+1)-r/2+c),P=Math.floor(r*(y+1)-r/2+l);w>o-1&&(w=o-1),P>h-1&&(P=h-1);const _=(P*o+w)*4;m[b]=a[_],m[b+1]=a[_+1],m[b+2]=a[_+2],m[b+3]=a[_+3]}else m[b]=a[b],m[b+1]=a[b+1],m[b+2]=a[b+2],m[b+3]=a[b+3]}return new ImageData(m,o,h)},ud=(i,t,e={backgroundColor:{r:0,g:0,b:0,a:255},changeIntoColor:{r:0,g:0,b:0,a:0}})=>{if(t&&e){const{data:s,width:n,height:r}=i,{data:a}=t,o=new Uint8ClampedArray(s.length),{backgroundColor:h,changeIntoColor:c}=e;for(let u=0;u<r;u++)for(let f=0;f<n;f++){const m=(u*n+f)*4,g=a[m],C=a[m+1],v=a[m+2],b=a[m+3];g===h.r&&C===h.g&&v===h.b&&b===h.a&&c.a!==0?(o[m]=c.r,o[m+1]=c.g,o[m+2]=c.b,o[m+3]=c.a):(o[m]=s[m],o[m+1]=s[m+1],o[m+2]=s[m+2],o[m+3]=s[m+3])}return new ImageData(o,n,r)}return i},yo=(i,t)=>{const{data:e,width:s,height:n}=i,r=new Uint8ClampedArray(e.length);for(let o=0;o<n;o++)for(let h=0;h<s;h++){const c=(o*s+h)*4;for(let l=0;l<3;l++){const u=c+l;h===0||h===s-1||o===0||o===n-1?r[u]=e[u]:r[u]=t[0]*e[u-s*4-4]+t[1]*e[u-s*4]+t[2]*e[u-s*4+4]+t[3]*e[u-4]+t[4]*e[u]+t[5]*e[u+4]+t[6]*e[u+s*4-4]+t[7]*e[u+s*4]+t[8]*e[u+s*4+4]}r[c+3]=e[c+3]}return new ImageData(r,s,n)},wo=(i,t)=>{if(i&&i.length===4&&t&&t.length===4){const e=i[3],s=t[3];if(e===255||s===0)return i;if(e===0)return t;{const n=e/255,r=s/255,a=Math.max(Math.min(Math.floor(i[0]*n+t[0]*r*(1-n)),255),0),o=Math.max(Math.min(Math.floor(i[1]*n+t[1]*r*(1-n)),255),0),h=Math.max(Math.min(Math.floor(i[2]*n+t[2]*r*(1-n)),255),0),c=Math.max(Math.min(Math.floor((n+r*(1-n))*255),255),0);return[a,o,h,c]}}return[255,255,255,255]},Rn=function(){const i=[];return{writeByte(t){i.push(t&255)},writeShort(t){this.writeByte(t),this.writeByte(t>>>8)},writeBytes(t,e=0,s=t.length){for(let n=0;n<s;n++)this.writeByte(t[n+e])},writeString(t){for(let e=0,s=t.length;e<s;e++)this.writeByte(t.charCodeAt(e))},toByteArray(){return i},toString(){let t="[";for(let e=0,s=i.length;e<s;e++)e>0&&(t+=","),t+=i[e];return t+="]",t}}},xo=function(){let i=0,t=0,e=0,s="";const n=function(a){if(!(a<0)){if(a<26)return 65+a;if(a<52)return 97+(a-26);if(a<62)return 48+(a-52);if(a==62)return 43;if(a==63)return 47}throw new Error("n:"+a)},r=function(a){s+=String.fromCharCode(n(a&63))};return{writeByte(a){for(i=i<<8|a&255,t+=8,e+=1;t>=6;)r(i>>>t-6),t-=6},flush(){if(t>0&&(r(i<<6-t),i=0,t=0),e%3!=0){const a=3-e%3;for(let o=0;o<a;o++)s+="="}},toString(){return s}}},bo=function(i,t,e){const s=new Array(i*i),n=function(o){const h=o;let c=0,l=0;return{write(u,f){if(u>>>f)throw new Error("length over");for(;c+f>=8;)h.writeByte(255&(u<<c|l)),f-=8-c,u>>>=8-c,l=0,c=0;l=u<<c|l,c=c+f},flush(){c>0&&h.writeByte(l)}}},r=function(o){const h=1<<o,c=(1<<o)+1;let l=o+1;const u=a();for(let v=0;v<h;v++)u.add(String.fromCharCode(v));u.add(String.fromCharCode(h)),u.add(String.fromCharCode(c));const f=Rn(),m=n(f);m.write(h,l);let g=0,C=String.fromCharCode(s[g]);for(g+=1;g<s.length;){const v=String.fromCharCode(s[g]);g+=1,u.contains(C+v)?C=C+v:(m.write(u.indexOf(C),l),u.size()<4095&&(u.size()==1<<l&&(l+=1),u.add(C+v)),C=v)}return m.write(u.indexOf(C),l),m.write(c,l),m.flush(),f.toByteArray()},a=function(){const o={};let h=0;return{add(c){if(this.contains(c))throw new Error("dup key:"+c);o[c]=h,h+=1},size(){return h},indexOf(c){return o[c]},contains(c){return typeof o[c]<"u"}}};return{setPixel(o,h,c){s[h*i+o]=c},write(o){o.writeString("GIF87a"),o.writeShort(i),o.writeShort(i),o.writeByte(128),o.writeByte(0),o.writeByte(0),o.writeByte(Ue("0x"+t[1]+t[2])),o.writeByte(Ue("0x"+t[3]+t[4])),o.writeByte(Ue("0x"+t[5]+t[6])),o.writeByte(Ue("0x"+e[1]+e[2])),o.writeByte(Ue("0x"+e[3]+e[4])),o.writeByte(Ue("0x"+e[5]+e[6])),o.writeString(","),o.writeShort(0),o.writeShort(0),o.writeShort(i),o.writeShort(i),o.writeByte(0);const h=2,c=r(h);o.writeByte(h);let l=0;for(;c.length-l>255;)o.writeByte(255),o.writeBytes(c,l,255),l+=255;o.writeByte(c.length-l),o.writeBytes(c,l,c.length-l),o.writeByte(0),o.writeString(";")}}},So=function(i,t,e,s){const n=bo(i,t,e);for(let c=0;c<i;c++)for(let l=0;l<i;l++)n.setPixel(l,c,s(l,c));const r=Rn();n.write(r);const a=xo(),o=r.toByteArray();for(let c=0,l=o.length;c<l;c++)a.writeByte(o[c]);a.flush();let h="";return h+="data:image/gif;base64,",h+=a,h},At={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},ps={M:0,L:1,H:2,Q:3},Se={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},nt={glog:function(i){if(i<1)throw new Error("glog("+i+")");return nt.LOG_TABLE[i]},gexp:function(i){for(;i<0;)i+=255;for(;i>=256;)i-=255;return nt.EXP_TABLE[i]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(let i=0;i<8;i++)nt.EXP_TABLE[i]=1<<i;for(let i=8;i<256;i++)nt.EXP_TABLE[i]=nt.EXP_TABLE[i-4]^nt.EXP_TABLE[i-5]^nt.EXP_TABLE[i-6]^nt.EXP_TABLE[i-8];for(let i=0;i<255;i++)nt.LOG_TABLE[nt.EXP_TABLE[i]]=i;const Z={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(i){let t=i<<10;for(;Z.getBCHDigit(t)-Z.getBCHDigit(Z.G15)>=0;)t^=Z.G15<<Z.getBCHDigit(t)-Z.getBCHDigit(Z.G15);return(i<<10|t)^Z.G15_MASK},getBCHTypeNumber:function(i){let t=i<<12;for(;Z.getBCHDigit(t)-Z.getBCHDigit(Z.G18)>=0;)t^=Z.G18<<Z.getBCHDigit(t)-Z.getBCHDigit(Z.G18);return i<<12|t},getBCHDigit:function(i){let t=0;for(;i!=0;)t++,i>>>=1;return t},getPatternPosition:function(i){return Z.PATTERN_POSITION_TABLE[i-1]},getMask:function(i,t,e){switch(i){case Se.PATTERN000:return(t+e)%2==0;case Se.PATTERN001:return t%2==0;case Se.PATTERN010:return e%3==0;case Se.PATTERN011:return(t+e)%3==0;case Se.PATTERN100:return(Math.floor(t/2)+Math.floor(e/3))%2==0;case Se.PATTERN101:return t*e%2+t*e%3==0;case Se.PATTERN110:return(t*e%2+t*e%3)%2==0;case Se.PATTERN111:return(t*e%3+(t+e)%2)%2==0;default:throw new Error("bad maskPattern:"+i)}},getErrorCorrectPolynomial:function(i){let t=new $e([1],0);for(let e=0;e<i;e++)t=t.multiply(new $e([1,nt.gexp(e)],0));return t},getLengthInBits:function(i,t){if(1<=t&&t<10)switch(i){case At.MODE_NUMBER:return 10;case At.MODE_ALPHA_NUM:return 9;case At.MODE_8BIT_BYTE:return 8;case At.MODE_KANJI:return 8;default:throw new Error("mode:"+i)}else if(t<27)switch(i){case At.MODE_NUMBER:return 12;case At.MODE_ALPHA_NUM:return 11;case At.MODE_8BIT_BYTE:return 16;case At.MODE_KANJI:return 10;default:throw new Error("mode:"+i)}else if(t<41)switch(i){case At.MODE_NUMBER:return 14;case At.MODE_ALPHA_NUM:return 13;case At.MODE_8BIT_BYTE:return 16;case At.MODE_KANJI:return 12;default:throw new Error("mode:"+i)}else throw new Error("type:"+t)},getLostPoint:function(i){const t=i.getModuleCount();let e=0;for(let r=0;r<t;r++)for(let a=0;a<t;a++){let o=0;const h=i.isDark(r,a);for(let c=-1;c<=1;c++)if(!(r+c<0||t<=r+c))for(let l=-1;l<=1;l++)a+l<0||t<=a+l||c==0&&l==0||h==i.isDark(r+c,a+l)&&o++;o>5&&(e+=3+o-5)}for(let r=0;r<t-1;r++)for(let a=0;a<t-1;a++){let o=0;i.isDark(r,a)&&o++,i.isDark(r+1,a)&&o++,i.isDark(r,a+1)&&o++,i.isDark(r+1,a+1)&&o++,(o==0||o==4)&&(e+=3)}for(let r=0;r<t;r++)for(let a=0;a<t-6;a++)i.isDark(r,a)&&!i.isDark(r,a+1)&&i.isDark(r,a+2)&&i.isDark(r,a+3)&&i.isDark(r,a+4)&&!i.isDark(r,a+5)&&i.isDark(r,a+6)&&(e+=40);for(let r=0;r<t;r++)for(let a=0;a<t-6;a++)i.isDark(a,r)&&!i.isDark(a+1,r)&&i.isDark(a+2,r)&&i.isDark(a+3,r)&&i.isDark(a+4,r)&&!i.isDark(a+5,r)&&i.isDark(a+6,r)&&(e+=40);let s=0;for(let r=0;r<t;r++)for(let a=0;a<t;a++)i.isDark(a,r)&&s++;const n=Math.abs(100*s/t/t-50)/5;return e+=n*10,e}};class $e{num;constructor(t,e){if(t.length==null)throw new Error(t.length+"/"+e);let s=0;for(;s<t.length&&t[s]==0;)s++;this.num=new Array(t.length-s+e);for(let n=0;n<t.length-s;n++)this.num[n]=t[n+s]}get(t){return this.num[t]}getLength(){return this.num.length}multiply(t){const e=new Array(this.getLength()+t.getLength()-1);for(let s=0;s<this.getLength();s++)for(let n=0;n<t.getLength();n++)e[s+n]^=nt.gexp(nt.glog(this.get(s))+nt.glog(t.get(n)));return new $e(e,0)}mod(t){if(this.getLength()-t.getLength()<0)return this;const e=nt.glog(this.get(0))-nt.glog(t.get(0)),s=new Array(this.getLength());for(let n=0;n<this.getLength();n++)s[n]=this.get(n);for(let n=0;n<t.getLength();n++)s[n]^=nt.gexp(nt.glog(t.get(n))+e);return new $e(s,0).mod(t)}}class ie{totalCount;dataCount;constructor(t,e){this.totalCount=t,this.dataCount=e}static RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];static getRSBlocks(t,e){const s=ie.getRsBlockTable(t,e);if(s==null)throw new Error("bad rs block @ typeNumber:"+t+"/errorCorrectLevel:"+e);const n=s.length/3,r=[];for(let a=0;a<n;a++){const o=s[a*3+0],h=s[a*3+1],c=s[a*3+2];for(let l=0;l<o;l++)r.push(new ie(h,c))}return r}static getRsBlockTable(t,e){switch(e){case ps.L:return ie.RS_BLOCK_TABLE[(t-1)*4+0];case ps.M:return ie.RS_BLOCK_TABLE[(t-1)*4+1];case ps.Q:return ie.RS_BLOCK_TABLE[(t-1)*4+2];case ps.H:return ie.RS_BLOCK_TABLE[(t-1)*4+3];default:return}}}class Co{buffer;length;constructor(){this.buffer=[],this.length=0}get(t){const e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)==1}put(t,e){for(let s=0;s<e;s++)this.putBit((t>>>e-s-1&1)==1)}getLengthInBits(){return this.length}putBit(t){const e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}}class fd{mode;data;constructor(t){this.mode=At.MODE_8BIT_BYTE,this.data=t}getLength(){return this.data.length}write(t){for(let e=0,s=this.data.length;e<s;e++)t.put(this.data.charCodeAt(e),8)}}class Ce{static PAD0=236;static PAD1=17;typeNumber;errorCorrectLevel;modules;moduleCount;dataCache;dataList;constructor(t,e){this.typeNumber=t,this.errorCorrectLevel=ps[e],this.modules=[],this.moduleCount=0,this.dataCache=null,this.dataList=[]}addData(t){const e=new fd(t);this.dataList.push(e),this.dataCache=null}isDark(t,e){if(t<0||this.moduleCount<=t||e<0||this.moduleCount<=e)throw new Error(t+","+e);return this.modules[t][e]}getModuleCount(){return this.moduleCount}make(){if(this.typeNumber<1){let t=1;for(t=1;t<40;t++){const e=ie.getRSBlocks(t,this.errorCorrectLevel),s=new Co;let n=0;for(let r=0;r<e.length;r++)n+=e[r].dataCount;for(let r=0;r<this.dataList.length;r++){const a=this.dataList[r];s.put(a.mode,4),s.put(a.getLength(),Z.getLengthInBits(a.mode,t)),a.write(s)}if(s.getLengthInBits()<=n*8)break}this.typeNumber=t}this.makeImpl(!1,this.getBestMaskPattern())}makeImpl(t,e){this.moduleCount=this.typeNumber*4+17,this.modules=new Array(this.moduleCount);for(let s=0;s<this.moduleCount;s++){this.modules[s]=new Array(this.moduleCount);for(let n=0;n<this.moduleCount;n++)this.modules[s][n]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(t,e),this.typeNumber>=7&&this.setupTypeNumber(t),this.dataCache==null&&(this.dataCache=Ce.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)}setupPositionProbePattern(t,e){for(let s=-1;s<=7;s++)if(!(t+s<=-1||this.moduleCount<=t+s))for(let n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(0<=s&&s<=6&&(n==0||n==6)||0<=n&&n<=6&&(s==0||s==6)||2<=s&&s<=4&&2<=n&&n<=4?this.modules[t+s][e+n]=!0:this.modules[t+s][e+n]=!1)}getBestMaskPattern(){let t=0,e=0;for(let s=0;s<8;s++){this.makeImpl(!0,s);const n=Z.getLostPoint(this);(s==0||t>n)&&(t=n,e=s)}return e}createMovieClip(t,e,s){const n=t.createEmptyMovieClip(e,s),r=1;this.make();for(let a=0;a<this.modules.length;a++){const o=a*r;for(let h=0;h<this.modules[a].length;h++){const c=h*r;this.modules[a][h]&&(n.beginFill(0,100),n.moveTo(c,o),n.lineTo(c+r,o),n.lineTo(c+r,o+r),n.lineTo(c,o+r),n.endFill())}}return n}setupTimingPattern(){for(let t=8;t<this.moduleCount-8;t++)this.modules[t][6]==null&&(this.modules[t][6]=t%2==0);for(let t=8;t<this.moduleCount-8;t++)this.modules[6][t]==null&&(this.modules[6][t]=t%2==0)}setupPositionAdjustPattern(){const t=Z.getPatternPosition(this.typeNumber);for(let e=0;e<t.length;e++)for(let s=0;s<t.length;s++){const n=t[e],r=t[s];if(this.modules[n][r]==null)for(let a=-2;a<=2;a++)for(let o=-2;o<=2;o++)a==-2||a==2||o==-2||o==2||a==0&&o==0?this.modules[n+a][r+o]=!0:this.modules[n+a][r+o]=!1}}setupTypeNumber(t){const e=Z.getBCHTypeNumber(this.typeNumber);for(let s=0;s<18;s++){const n=!t&&(e>>s&1)==1;this.modules[Math.floor(s/3)][s%3+this.moduleCount-8-3]=n}for(let s=0;s<18;s++){const n=!t&&(e>>s&1)==1;this.modules[s%3+this.moduleCount-8-3][Math.floor(s/3)]=n}}setupTypeInfo(t,e){const s=this.errorCorrectLevel<<3|e,n=Z.getBCHTypeInfo(s);for(let r=0;r<15;r++){const a=!t&&(n>>r&1)==1;r<6?this.modules[r][8]=a:r<8?this.modules[r+1][8]=a:this.modules[this.moduleCount-15+r][8]=a}for(let r=0;r<15;r++){const a=!t&&(n>>r&1)==1;r<8?this.modules[8][this.moduleCount-r-1]=a:r<9?this.modules[8][15-r-1+1]=a:this.modules[8][15-r-1]=a}this.modules[this.moduleCount-8][8]=!t}mapData(t,e){let s=-1,n=this.moduleCount-1,r=7,a=0;for(let o=this.moduleCount-1;o>0;o-=2)for(o==6&&o--;;){for(let h=0;h<2;h++)if(this.modules[n][o-h]==null){let c=!1;a<t.length&&(c=(t[a]>>>r&1)==1),Z.getMask(e,n,o-h)&&(c=!c),this.modules[n][o-h]=c,r--,r==-1&&(a++,r=7)}if(n+=s,n<0||this.moduleCount<=n){n-=s,s=-s;break}}}static createData(t,e,s){const n=ie.getRSBlocks(t,e),r=new Co;for(let o=0;o<s.length;o++){const h=s[o];r.put(h.mode,4),r.put(h.getLength(),Z.getLengthInBits(h.mode,t)),h.write(r)}let a=0;for(let o=0;o<n.length;o++)a+=n[o].dataCount;if(r.getLengthInBits()>a*8)throw new Error("code length overflow. ("+r.getLengthInBits()+">"+a*8+")");for(r.getLengthInBits()+4<=a*8&&r.put(0,4);r.getLengthInBits()%8!=0;)r.putBit(!1);for(;!(r.getLengthInBits()>=a*8||(r.put(Ce.PAD0,8),r.getLengthInBits()>=a*8));)r.put(Ce.PAD1,8);return Ce.createBytes(r,n)}static createBytes(t,e){let s=0,n=0,r=0;const a=new Array(e.length),o=new Array(e.length);for(let u=0;u<e.length;u++){const f=e[u].dataCount,m=e[u].totalCount-f;n=Math.max(n,f),r=Math.max(r,m),a[u]=new Array(f);for(let b=0;b<a[u].length;b++)a[u][b]=255&t.buffer[b+s];s+=f;const g=Z.getErrorCorrectPolynomial(m),v=new $e(a[u],g.getLength()-1).mod(g);o[u]=new Array(g.getLength()-1);for(let b=0;b<o[u].length;b++){const S=b+v.getLength()-o[u].length;o[u][b]=S>=0?v.get(S):0}}let h=0;for(let u=0;u<e.length;u++)h+=e[u].totalCount;const c=new Array(h);let l=0;for(let u=0;u<n;u++)for(let f=0;f<e.length;f++)u<a[f].length&&(c[l++]=a[f][u]);for(let u=0;u<r;u++)for(let f=0;f<e.length;f++)u<o[f].length&&(c[l++]=o[f][u]);return c}}const vo=Math.ceil,ys=Math.floor,To=Math.round;function dd(i,t){const e=yr(i),s=t?.ecc||"H",n=t?.size||256,r=-1,a=t?.padding||0,o=t?.color||"#000000",h=t?.background||"#ffffff",c=new Ce(r,s);c.addData(e),c.make();const l=c.getModuleCount(),u=(n-a*2)/l,f=a,m=n-a;return So(n,o,h,function(g,C){if(f<=g&&g<m&&f<=C&&C<m){const v=ys((g-f)/u),b=ys((C-f)/u);return c.isDark(b,v)?0:1}else return 1})}function md(i,t){const e=t.x||0,s=t.y||0,n=yr(i),r=t.ctx,a=t.ecc||"H",o=typeof t.size=="number"?ys(t.size):256,h=t.padding||0,c=-1,l=t.color||"#000000",u=t.background||"#ffffff",f=new Ce(c,a);f.addData(n),f.make();const m=f.getModuleCount(),g=(o-h*2)/m;r.fillStyle=u,r.fillRect(e,s,o,o);for(let C=0;C<m;C++)for(let v=0;v<m;v++){const b=vo((v+1)*g)-ys(v*g),S=vo((C+1)*g)-ys(C*g);r.fillStyle=f.isDark(C,v)?l:u,r.fillRect(e+To(v*g)+h,s+To(C*g)+h,b,S)}}const ui=new fs,st=new Mt;function ne(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function H(i,t){switch(t.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}class $t{array;itemSize;count;normalized;updateRanges;version;constructor(t,e,s=!1){if(Array.isArray(t))throw new TypeError("BufferAttribute: array should be a Typed Array.");this.array=t,this.itemSize=e,this.count=t.length/e,this.normalized=s,this.updateRanges=[],this.version=0}_onChangeCallback(){}set needsUpdate(t){t===!0&&this.version++}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=Ph(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this}copyAt(t,e,s){t*=this.itemSize,s*=e.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[s+n];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,s=this.count;e<s;e++)ui.fromBufferAttribute(this,e),ui.applyMatrix3(t),this.setXY(e,ui.x,ui.y);else if(this.itemSize===3)for(let e=0,s=this.count;e<s;e++)st.fromBufferAttribute(this,e),st.applyMatrix3(t),this.setXYZ(e,st.x,st.y,st.z);return this}applyMatrix4(t){for(let e=0,s=this.count;e<s;e++)st.fromBufferAttribute(this,e),st.applyMatrix4(t),this.setXYZ(e,st.x,st.y,st.z);return this}applyNormalMatrix(t){for(let e=0,s=this.count;e<s;e++)st.fromBufferAttribute(this,e),st.applyNormalMatrix(t),this.setXYZ(e,st.x,st.y,st.z);return this}transformDirection(t){for(let e=0,s=this.count;e<s;e++)st.fromBufferAttribute(this,e),st.transformDirection(t),this.setXYZ(e,st.x,st.y,st.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let s=this.array[t*this.itemSize+e];return this.normalized&&(s=ne(s,this.array)),s}setComponent(t,e,s){return this.normalized&&(s=H(s,this.array)),this.array[t*this.itemSize+e]=s,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=ne(e,this.array)),e}setX(t,e){return this.normalized&&(e=H(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=ne(e,this.array)),e}setY(t,e){return this.normalized&&(e=H(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=ne(e,this.array)),e}setZ(t,e){return this.normalized&&(e=H(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=ne(e,this.array)),e}setW(t,e){return this.normalized&&(e=H(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,s){return t*=this.itemSize,this.normalized&&(e=H(e,this.array),s=H(s,this.array)),this.array[t+0]=e,this.array[t+1]=s,this}setXYZ(t,e,s,n){return t*=this.itemSize,this.normalized&&(e=H(e,this.array),s=H(s,this.array),n=H(n,this.array)),this.array[t+0]=e,this.array[t+1]=s,this.array[t+2]=n,this}setXYZW(t,e,s,n,r){return t*=this.itemSize,this.normalized&&(e=H(e,this.array),s=H(s,this.array),n=H(n,this.array),r=H(r,this.array)),this.array[t+0]=e,this.array[t+1]=s,this.array[t+2]=n,this.array[t+3]=r,this}onChange(t){return this._onChangeCallback=t,this}clone(){return xr(this,this.array,this.itemSize,this.normalized).copy(this)}toJSON(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized}}}class gd extends $t{constructor(t,e,s=!1){super(new Int8Array(t),e,s)}}class pd extends $t{constructor(t,e,s=!1){super(new Uint8Array(t),e,s)}}class yd extends $t{constructor(t,e,s=!1){super(new Uint8ClampedArray(t),e,s)}}class wd extends $t{constructor(t,e,s=!1){super(new Int16Array(t),e,s)}}class xd extends $t{constructor(t,e,s=!1){super(new Uint16Array(t),e,s)}}class bd extends $t{constructor(t,e,s=!1){super(new Int32Array(t),e,s)}}class Sd extends $t{constructor(t,e,s=!1){super(new Uint32Array(t),e,s)}}class Cd extends $t{isFloat16BufferAttribute=!0;constructor(t,e,s=!1){super(new Uint16Array(t),e,s)}getX(t){let e=Ms(this.array[t*this.itemSize]);return this.normalized&&(e=ne(e,this.array)),e}setX(t,e){return this.normalized&&(e=H(e,this.array)),this.array[t*this.itemSize]=vt(e),this}getY(t){let e=Ms(this.array[t*this.itemSize+1]);return this.normalized&&(e=ne(e,this.array)),e}setY(t,e){return this.normalized&&(e=H(e,this.array)),this.array[t*this.itemSize+1]=vt(e),this}getZ(t){let e=Ms(this.array[t*this.itemSize+2]);return this.normalized&&(e=ne(e,this.array)),e}setZ(t,e){return this.normalized&&(e=H(e,this.array)),this.array[t*this.itemSize+2]=vt(e),this}getW(t){let e=Ms(this.array[t*this.itemSize+3]);return this.normalized&&(e=ne(e,this.array)),e}setW(t,e){return this.normalized&&(e=H(e,this.array)),this.array[t*this.itemSize+3]=vt(e),this}setXY(t,e,s){return t*=this.itemSize,this.normalized&&(e=H(e,this.array),s=H(s,this.array)),this.array[t+0]=vt(e),this.array[t+1]=vt(s),this}setXYZ(t,e,s,n){return t*=this.itemSize,this.normalized&&(e=H(e,this.array),s=H(s,this.array),n=H(n,this.array)),this.array[t+0]=vt(e),this.array[t+1]=vt(s),this.array[t+2]=vt(n),this}setXYZW(t,e,s,n,r){return t*=this.itemSize,this.normalized&&(e=H(e,this.array),s=H(s,this.array),n=H(n,this.array),r=H(r,this.array)),this.array[t+0]=vt(e),this.array[t+1]=vt(s),this.array[t+2]=vt(n),this.array[t+3]=vt(r),this}}class vd extends $t{constructor(t,e,s=!1){super(new Float32Array(t),e,s)}}class ut extends j{shapesCountChange=!1;constructor(t){super(t)}shapeInit(){}frameStart(t){return this.shapesCountChange&&(this.shapesCountChange=!1,this.shapes.forEach(e=>{e.parent=this,e.initPathD()}),this.pathd=this.initPathD(),this.shapes.forEach(e=>{!e.forceCXY&&!e.independentTransformInGroup&&(e.cX=this.cX-e.diffXInGroup,e.cY=this.cY-e.diffYInGroup)})),super.frameStart(t)}frameUpdate(t,e){this.shapes.forEach(s=>{!s.independentTransformInGroup&&!s.isDragging&&(s.x=this.x+s.diffXInGroup,s.y=this.y+s.diffYInGroup,s.degree=this.degree+s.diffDegreeInGroup,s.scalarX=this.scalarX*s.diffScalarXInGroup,s.scalarY=this.scalarY*s.diffScalarYInGroup)}),super.frameUpdate(t,e)}addShape(t){(Array.isArray(t)?t:[t]).forEach(e=>{this.shapes.findIndex(s=>s.id==e.id)==-1&&(e.on("draging",(s,n)=>{this.enableDrag&&(this.x+=s,this.y+=n,this.emit("draging",s,n,e))}),this.shapes.push(e),this.shapesCountChange=!0)})}getBoundingClientRect(){const t=[],e=[];this.shapes.forEach(h=>{const c=h.getBoundingClientRect();c&&(t.push(c.x,c.x+c.width),e.push(c.y,c.y+c.height))});const s=this.pathd?.getBoundingClientRect();if(s&&(s.width||s.height)&&(t.push(s.x,s.x+s.width),e.push(s.y,s.y+s.height)),t.length==0||e.length==0)return null;const n=Math.min.apply(0,t),r=Math.min.apply(0,e),a=Math.max.apply(0,t),o=Math.max.apply(0,e);return{x:n,y:r,width:a-n,height:o-r}}setAttrs(t,e){typeof t!="string"?(super.setAttr(t),this.shapes.forEach(s=>{s.setAttr(t)})):e&&(super.setAttr(t,e),this.shapes.forEach(s=>{s.setAttr(t,e)}))}sortPathD(){this.shapes=this.shapes.map(t=>{const e=t.initPathD();return{shape:t,perimeter:e.perimeterPoints()}}).sort((t,e)=>e.perimeter-t.perimeter).map(t=>t.shape)}expendFill(t){const e=t.shapes.length,s=this.shapes.length;if(e<s)return t.expendFill(this);for(let n=s;n<e;n++){const a=t.shapes[n].initPathD().polymorphPoints,o=a[0],h=a[1],c=[["M",o,h]];for(let l=2;l+5<a.length;l+=6)c.push(["C",o,h,o,h,o,h]);this.addShape(new j({attrs:{...t.shapes[n].getAttrs()},d:c}))}}strokeDashTween(t,e){switch(e?.type){case"sequence":const s=this.shapes.length-1;this.shapes.forEach((o,h)=>{o.strokeDashTween(t,{...e,delay:h,onStart:()=>{h==0&&e?.onGroupStart?.()},onUpdate:()=>{e?.onGroupUpdate?.()},onComplete:()=>{h==s&&e?.onGroupComplete?.()}})});break;case"parallel":default:const n=new Js({frameDuration:t}),r={},a={};this.shapes.forEach((o,h)=>{const c=jt(o.getTotalLength(),0);r[`offset_${h}`]=c,a[`offset_${h}`]=0,o.setAttr({strokeDasharray:`${c} ${c}`,strokeDashoffset:`${c}`})}),n.addTween(r,a,Object.assign(e||{},{onStart:()=>{e?.onGroupStart?.()},onUpdate:(o,h)=>{for(let c in o){const l=Ii(c).number;this.shapes[l].setAttr("strokeDashoffset",""+jt(o[c],2))}e?.onGroupUpdate?.()},onComplete:()=>{e?.onGroupComplete?.()}})),n.play();break}}}const Td={1:705234,2:8108026,3:6346665,4:16630114,5:16607842,6:16158139,7:2542847,8:10640125,9:16735870,10:8978266,11:16580418,12:16754221,13:16725759,14:14436630,15:6844849,16:13744437,17:1817755,18:16744272,19:4964291,20:16750848,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};class Q{static NAMES=Td;_color={r:0,g:0,b:0,a:1};constructor(t,e){t&&this.setColor(t),this.setAlpha(e)}get color(){return this._color}set color(t){const e="Color: Unknown color "+t;if(typeof t=="number")this.setHEX(t);else if(typeof t=="string"){let s;if(s=/^(\w+)\(([^)]*)\)/.exec(t)){const n=s[2];let r;switch(s[1]){case"rgb":case"rgba":(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))?(this.r=parseInt(r[1],10),this.g=parseInt(r[2],10),this.b=parseInt(r[3],10),r[4]&&(this.a=parseFloat(r[4]))):(r=/^\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))?(this.r=F(parseFloat(r[1]),0,100)*255/100,this.g=F(parseFloat(r[2]),0,100)*255/100,this.b=F(parseFloat(r[3]),0,100)*255/100,r[4]&&(this.a=parseFloat(r[4]))):console.warn(e);break;case"hsl":case"hsla":(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))?(this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100),r[4]&&(this.a=parseFloat(r[4]))):console.warn(e);break;default:console.warn(e)}}else if(s=/^#([A-Fa-f0-9]+)$/.exec(t)){const n=s[1],r=n.length;r===3?this.setRGB(parseInt(n.charAt(0),16),parseInt(n.charAt(1),16),parseInt(n.charAt(2),16)):r===6||r===8?this.setHEX(parseInt(n,16)):console.warn(e)}else if(t&&t.length>0)try{this.setColorName(t)}catch{console.warn(e)}else console.warn(e)}else Object.prototype.hasOwnProperty.call(t,"r")&&Object.prototype.hasOwnProperty.call(t,"g")&&Object.prototype.hasOwnProperty.call(t,"b")?this.setRGB(t.r,t.g,t.b,t.a):Object.prototype.hasOwnProperty.call(t,"h")&&Object.prototype.hasOwnProperty.call(t,"s")&&Object.prototype.hasOwnProperty.call(t,"l")?this.setHSL(t.h,t.s,t.l,t.a):Object.prototype.hasOwnProperty.call(t,"h")&&Object.prototype.hasOwnProperty.call(t,"s")&&Object.prototype.hasOwnProperty.call(t,"v")?this.setHSV(t.h,t.s,t.v,t.a):console.warn(e)}setColor(t){return this.color=t,this}set(t){return this.setColor(t)}get r(){return this._color.r}set r(t){try{this._color.r=F(Math.round(It(t)),0,255)}catch{}}get g(){return this._color.g}set g(t){try{this._color.g=F(Math.round(It(t)),0,255)}catch{}}get b(){return this._color.b}set b(t){try{this._color.b=F(Math.round(It(t)),0,255)}catch{}}get a(){return this._color.a}set a(t){try{this._color.a=F(It(t),0,1)}catch{}}setAlpha(t){return this.a=t,this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,s=this.g,n=this.b,r=t.value;return this.r=r[0]*e+r[3]*s+r[6]*n,this.g=r[1]*e+r[4]*s+r[7]*n,this.b=r[2]*e+r[5]*s+r[8]*n,this}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this.a=t[e+3],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a,t}toRGBString(){return this.a===1?`rgb(${this.r},${this.g},${this.b})`:`rgba(${this.r},${this.g},${this.b},${jt(this.a,6)})`}toHexString(){return this.a===1?("000000"+this.hex.toString(16)).slice(-6):("00000000"+this.hex.toString(16)).slice(-8)}toString(){return this.a===1?"#"+this.toHexString():this.toRGBString()}toColorSpaceString(t=ze){On.fromWorkingColorSpace(Ut.copy(this),t);const e=Ut.r,s=Ut.g,n=Ut.b;return t!==ze?`color(${t} ${e.toFixed(3)} ${s.toFixed(3)} ${n.toFixed(3)})`:this.toRGBString()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b,yield this.a}clone(){return new Q(this.color)}copy(t){return this.setColor(t.color),this}copySRGBToLinear(t){return this.r=Re(t.r),this.g=Re(t.g),this.b=Re(t.b),this}copyLinearToSRGB(t){return this.r=Le(t.r),this.g=Le(t.g),this.b=Le(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a}add(t){return this.r=this.r+t.r,this.g=this.g+t.g,this.b=this.b+t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r=this.r+t,this.g=this.g+t,this.b=this.b+t,this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}sub(t){return this.r=this.r-t.r,this.g=this.g-t.g,this.b=this.b-t.b,this}multiply(t){return this.r=this.r*t.r,this.g=this.g*t.g,this.b=this.b*t.b,this}multiplyScalar(t){return this.r=this.r*t,this.g=this.g*t,this.b=this.b*t,this}opposite(t=!1,e="#000000",s="#ffffff"){if(t)return this.setColor(this.r*.299+this.g*.587+this.b*.114>186?e:s);{const{r:n,g:r,b:a}=this.color;return this.r=255-n,this.g=255-r,this.b=255-a,this}}lighten(t){t=F(t,0,1);const{r:e,g:s,b:n}=this.color;return this.r+=(255-e)*t,this.g+=(255-s)*t,this.b+=(255-n)*t,this}darken(t){t=F(t,0,1);const{r:e,g:s,b:n}=this.color;return this.r=e*(1-t),this.g=s*(1-t),this.b=n*(1-t),this}lerp(t,e){return e=F(e,0,1),this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,s){return s=F(s,0,1),this.r=t.r+(e.r-t.r)*s,this.g=t.g+(e.g-t.g)*s,this.b=t.b+(e.b-t.b)*s,this}static gradient(t,e,s){try{return Ut.lerpColors(new Q(t),new Q(e),s).toString()}catch{return e}}static random(){return Ut.setHEX(Math.random()*16777215).toString()}static nextIndex=0;static next(t=Q.nextIndex){Q.nextIndex=t;const e=Object.keys(Q.NAMES),s=e.length;return Ut.setHEX(Q.NAMES[e[Q.nextIndex++%s]]).toString()}setColorName(t){const e=Q.NAMES[t.toLowerCase()];return e!==void 0?this.setHEX(e):t==="none"?this.a=0:console.warn("Color.setColorName: Unknown color "+t),this}static getColors(){return Object.values(Q.NAMES).map(t=>Ut.setHEX(t).toString())}setRGB(t,e,s,n){return this.r=t,this.g=e,this.b=s,this.a=n,this}get rgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}setHEX(t){return t=Math.floor(t),t<16777216?(this.r=t>>16&255,this.g=t>>8&255,this.b=t&255):(this.r=t>>24&255,this.g=t>>16&255,this.b=t>>8&255,this.a=(t&255)/255),this}get hex(){let t=(this.r<<16)+(this.g<<8)+this.b;return this.a!==1&&(t=t<<8,t+=Math.round(this.a*255)),t}setHSL(t,e,s,n){const r=Oh(t,1),a=F(e,0,1),o=F(s,0,1);if(a===0)this.r=o*255,this.g=o*255,this.b=o*255;else{const h=o<=.5?o*(1+a):o+a-o*a,c=2*o-h;this.r=Fn(c,h,r+.3333333333333333)*255,this.g=Fn(c,h,r)*255,this.b=Fn(c,h,r-.3333333333333333)*255}return this.a=n,this}getHSL(t){const e=this.r,s=this.g,n=this.b,r=Math.max(e,s,n)/255,a=Math.min(e,s,n)/255;let o,h;const c=(a+r)/2;if(a===r)o=0,h=0;else{const l=r-a;switch(h=c<=.5?l/(r+a):l/(2-r-a),r){case e:o=(s-n)/l+(s<n?6:0);break;case s:o=(n-e)/l+2;break;case n:default:o=(e-s)/l+4;break}o/=6}return t&&t.setHSL(o,h,c,this.a),{h:o,s:h,l:c,a:this.a}}offsetHSL(t,e,s){const n=this.getHSL();return this.setHSL(n.h+t,n.s+e,n.l+s)}lerpHSL(t,e){const s=this.getHSL(),n=t.getHSL(),r=ki(s.h,n.h,e),a=ki(s.s,n.s,e),o=ki(s.l,n.l,e);return this.setHSL(r,a,o),this}setHSV(t,e,s,n){const r=F(t,0,1)*360,a=F(e,0,1),o=F(s,0,1),h=Math.floor(r/60)%6,c=r/60-Math.floor(r/60),l=o*(1-a),u=o*(1-c*a),f=o*(1-(1-c)*a),m=[[o,f,l],[u,o,l],[l,o,f],[l,u,o],[f,l,o],[o,l,u]][h];return this.r=m[0]*255,this.g=m[1]*255,this.b=m[2]*255,this.a=n,this}getHSV(t){const{r:e,g:s,b:n,a:r}=this.color,a=Math.max(e,s,n),o=Math.min(e,s,n),h=a-o;let c;e===a?c=(s-n)/h:s===a?c=2+(n-e)/h:c=4+(e-s)/h,c/=6,c<0&&(c+=1);const l=h==0?0:c,u=a===0?0:h/a,f=a/255;return t&&t.setHSV(l,u,f,r),{h:l,s:u,v:f,a:r}}}const Ut=new Q;function Re(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Le(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}const _o="",ze="srgb",Ln="srgb-linear",zn="linear",fi="srgb",Po=new qe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Mo=new qe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),Eo=[.64,.33,.3,.6,.15,.06],Ao=[.2126,.7152,.0722],ko=[.3127,.329],On={enabled:!0,workingColorSpace:Ln,spaces:{},convert:function(i,t,e){return this.enabled===!1||t===e||!t||!e||(this.spaces[t].transfer===fi&&(i.r=Re(i.r),i.g=Re(i.g),i.b=Re(i.b)),this.spaces[t].primaries!==this.spaces[e].primaries&&(i.applyMatrix3(this.spaces[t].toXYZ),i.applyMatrix3(this.spaces[e].fromXYZ)),this.spaces[e].transfer===fi&&(i.r=Le(i.r),i.g=Le(i.g),i.b=Le(i.b))),i},fromWorkingColorSpace:function(i,t){return this.convert(i,this.workingColorSpace,t)},toWorkingColorSpace:function(i,t){return this.convert(i,t,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===_o?zn:this.spaces[i].transfer},getLuminanceCoefficients:function(i,t=this.workingColorSpace){return i.fromArray(this.spaces[t].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,t,e){return i.copy(this.spaces[t].toXYZ).multiply(this.spaces[e].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace}};On.define({[Ln]:{primaries:Eo,whitePoint:ko,transfer:zn,toXYZ:Po,fromXYZ:Mo,luminanceCoefficients:Ao,workingColorSpaceConfig:{unpackColorSpace:ze},outputColorSpaceConfig:{drawingBufferColorSpace:ze}},[ze]:{primaries:Eo,whitePoint:ko,transfer:fi,toXYZ:Po,fromXYZ:Mo,luminanceCoefficients:Ao,outputColorSpaceConfig:{drawingBufferColorSpace:ze}}});function Fn(i,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<.16666666666666666?i+(t-i)*6*e:e<.5?t:e<.6666666666666666?i+(t-i)*6*(.6666666666666666-e):i}const Oe={backgroundColor:"#1a1a1a",numberColor:"#2FA1D6",booleanColor:"#806787",stringColor:"#1ed36f",functionColor:"#e61d5f",saveRowColor:"#dad5cb",buttonColor:"",borderColor:"",inputColor:""};Oe.buttonColor=new Q(Oe.saveRowColor).darken(.1).toString(),Oe.borderColor=new Q(Oe.backgroundColor).lighten(.07).toString(),Oe.inputColor=new Q(Oe.backgroundColor).lighten(.085).toString();class Fe extends j{toX;toY;constructor(t){super(t),this.toX=t?.toX||0,this.toY=t?.toY||0;let e=this.toX-this.x,s=this.toY-this.y;return new Proxy(this,{set(n,r,a,o){switch(r){case"x":n.toX=a+e;break;case"y":n.toY=a+s;break;case"toX":e=a-n.x;break;case"toY":s=a-n.y;break}return Reflect.set(n,r,a,o)}})}toSVGPathData(){return[["m",0,0],["l",this.toX-this.x,this.toY-this.y]]}toCanvasContext(t){t.beginPath(),t.moveTo(0,0),t.lineTo(this.toX-this.x,this.toY-this.y)}intersection(t){const e=new Ua({x:this.x,y:this.y,toX:this.toX,toY:this.toY}),s=new Ua({x:t.x,y:t.y,toX:t.toX,toY:t.toY});return e.intersection(s)}}class _d extends j{cx;cy;toX;toY;isLineThrough;constructor(t){super(t),this.cx=t?.cx||0,this.cy=t?.cy||0,this.toX=t?.toX||0,this.toY=t?.toY||0,this.isLineThrough=typeof t?.isLineThrough=="boolean"?t.isLineThrough:!1}toSVGPathData(){if(this.isLineThrough){const t=this.cx*2-(this.x+this.toX)/2,e=this.cy*2-(this.y+this.toY)/2;return[["m",0,0],["q",t-this.x,e-this.y,this.toX-this.x,this.toY-this.y]]}else return[["m",0,0],["q",this.cx-this.x,this.cy-this.y,this.toX-this.x,this.toY-this.y]]}toCanvasContext(t){if(t.beginPath(),t.moveTo(0,0),this.isLineThrough){const e=this.cx*2-(this.x+this.toX)/2,s=this.cy*2-(this.y+this.toY)/2;t.quadraticCurveTo(e-this.x,s-this.y,this.toX-this.x,this.toY-this.y)}else t.quadraticCurveTo(this.cx-this.x,this.cy-this.y,this.toX-this.x,this.toY-this.y)}}class ws{video;constructor(t){this.video=t}setSrcObject(t){this.video.addEventListener("loadedmetadata",e=>{e.target}),this.video.srcObject=t}captureWebCamera(){navigator.mediaDevices.getUserMedia({video:!0}).then(t=>{this.setSrcObject(t)})}static async videoMediaChangeSupport(){return new Promise(t=>{const e=document.createElement("iframe"),s=document.createElement("video"),n=document.createElement("source"),r=new MediaSource;r.addEventListener("sourceopen",()=>t(!0)),n.src=URL.createObjectURL(r),n.media="(min-width:10px)",s.append(n),e.width="5",e.style.cssText="position: absolute; visibility: hidden;",document.documentElement.append(e),e.contentDocument?.body.append(s),setTimeout(()=>{e.width="15"}),setTimeout(()=>{e.remove(),t(!1)},1e3)})}static tryAutoPlayOrAutoPlayAfterClick(t){return new Promise(e=>{t.play().then(()=>{t.autoplay=!0,e(!0)}).catch(()=>{ws.setAutoPlayWhenClick(t),e(!1)})})}static setAutoPlayWhenClick(t){function e(){t.autoplay=!0,t.play(),document.removeEventListener("click",e),document.removeEventListener("touchend",e)}document.addEventListener("click",e),document.addEventListener("touchend",e)}}class Io extends Xe{source;raw="";mode="text";tagname="";nodename="";textchunk="";entity="";quote="";attrs={};constructor(t){super(),this.source=t}parse(){const t=Ch(this.source);if(t===0){this.emit("finish");return}let e,s,n=mr(this.source,0);for(let r=1;r<t;r++)e=s,s=n,n=mr(this.source,r),this.raw+=s,s&&this.step(s,n,e);n&&this.step(n,void 0,s),this.emit("finish")}step(t,e,s){t==`
|
|
35
35
|
`&&this.emit("newline"),this.act(t,e,s)}act(t,e,s){switch(this.mode){case"text":switch(t){case"<":case"eof":this.nodename="",this.attrs={},this.mode="tag name start",this.raw=this.raw.slice(0,-1),this.textchunk&&this.emit("text",this.textchunk),this.raw+=t,this.textchunk="";break;case"&":this.mode="entity",this.entity="";break;default:this.textchunk+=t;break}break;case"entity":Qt("whitespace",t)?(this.textchunk+=Do(this.entity),this.mode="text"):t==";"?(this.textchunk+=Do(this.entity+t),this.mode="text"):this.entity+=t;break;case"special":if(s=="!"&&t=="-"&&e=="-"){this.mode="comment start";break}if(this.textchunk=="[CDATA"&&t=="["){this.mode="cdata",this.textchunk="";break}if(t==">"||t=="eof"){this.emit("special",this.textchunk),this.mode="text",this.textchunk="";break}this.textchunk+=t;break;case"cdata":if(s=="]"&&t=="]"&&e==">"){this.mode="cdata end",this.textchunk=this.textchunk.slice(0,-1);break}t=="eof"&&(this.mode="cdata end",this.act(t,e,s)),this.textchunk+=t;break;case"cdata end":this.emit("cdata",this.textchunk),this.textchunk="",this.mode="text";break;case"comment start":e==">"||t=="eof"?(this.emit("comment",""),this.mode="skip"):this.mode="comment";break;case"skip":this.mode="text";break;case"comment":t=="-"&&s=="-"&&e==">"?(this.mode="comment end",this.textchunk=this.textchunk.slice(0,-1)):t=="eof"?this.emit("comment",this.textchunk):this.textchunk+=t;break;case"comment end":this.emit("comment",this.textchunk),this.textchunk="",this.mode="text";break;case"declaration":if(t=="?"&&e==">"){this.mode="declaration end";break}t=="eof"&&this.emit("comment",this.textchunk),this.textchunk+=t;break;case"declaration end":this.emit("comment",this.textchunk),this.textchunk="",this.mode="text";break;case"tag name start":if(t=="eof"){this.emit("text","<");break}if(!Qt("whitespace",t)){if(this.mode="tag name",t=="/"){this.mode="close tag name start";break}else if(t=="!"){this.mode="special",this.textchunk="";break}else if(t=="?"){this.mode="declaration";break}this.act(t,e,s)}break;case"close tag name start":Qt("whitespace",t)||(this.mode="close tag name",this.tagname="",this.nodename="",this.act(t,e,s));break;case"close tag name":if(Qt("whitespace",t))this.tagname=this.nodename;else switch(t){case">":this.emit("/tag",this.tagname||this.nodename,this.attrs),this.mode="text";break;default:!this.tagname&&(this.nodename+=t);break}break;case"tag name":if(Qt("whitespace",t))this.tagname=this.nodename,this.nodename="",this.mode="attr start";else switch(t){case">":this.emit("tag",this.nodename,this.attrs),this.mode="text";break;case"/":this.raw+=e,this.emit("tag",this.nodename,this.attrs),this.emit("/tag",this.nodename,this.attrs),this.mode="skip";break;default:this.nodename+=t;break}break;case"attr start":Qt("whitespace",t)||(this.mode="attr",this.nodename="",this.act(t,e,s));break;case"attr":if(Qt("whitespace",t)||t=="=")this.attrs[this.nodename]="",this.mode="attr value start";else switch(t){case">":this.nodename=="/"?(delete this.attrs["/"],this.emit("tag",this.tagname,this.attrs),this.emit("/tag",this.tagname,this.attrs)):(this.nodename&&(this.attrs[this.nodename]=""),this.emit("tag",this.tagname,this.attrs)),this.mode="text";break;default:this.nodename+=t;break}break;case"attr value start":if(!Qt("whitespace",t)){if(this.mode="attr value",this.quote="",t=="'"||t=='"'){this.quote=t;return}this.act(t,e,s)}break;case"attr value":if(Qt("whitespace",t)&&!this.quote)this.mode="attr start";else if(t==">"&&!this.quote)this.emit("tag",this.tagname,this.attrs),this.mode="text";else switch(t){case'"':case"'":this.quote==t&&s!="\\"&&(this.mode="attr start");break;default:this.attrs[this.nodename]+=t;break}break}}}function Do(i){const t={lt:60,"lt;":60,"AMP;":38,AMP:38,"GT;":62,GT:62,"QUOT;":34,QUOT:34,"apos;":39,"bull;":8226,"bullet;":8226,"copy;":169,copy:169,"deg;":176,deg:176};let e;return i.charAt(0)=="#"?i.charAt(1).toLowerCase()=="x"?e=parseInt(i.substring(2),16):e=parseInt(i.substring(1),10):e=t[i],e?String.fromCharCode(e):"&"+i}var Ro=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function Lo(i,t={}){var e=1,s=1;function n(L){var D=L.match(/\n/g);D&&(e+=D.length);var Y=L.lastIndexOf(`
|
|
36
36
|
`);s=~Y?L.length-Y:s+L.length}function r(){var L={line:e,column:s};return function(D){return D.position=new a(L),g(),D}}function a(L){this.start=L,this.end={line:e,column:s},this.source=t.source}a.prototype.content=i;var o=[];function h(L){var D=new Error(t.source+":"+e+":"+s+": "+L);if(D.reason=L,D.filename=t.source,D.line=e,D.column=s,D.source=i,t.silent)o.push(D);else throw D}function c(){var L=f();return{type:"stylesheet",stylesheet:{source:t.source,rules:L,parsingErrors:o}}}function l(){return m(/^{\s*/)}function u(){return m(/^}/)}function f(){var L,D=[];for(g(),C(D);i.length&&i.charAt(0)!="}"&&(L=Lt()||Vt());)L!==!1&&(D.push(L),C(D));return D}function m(L){var D=L.exec(i);if(D){var Y=D[0];return n(Y),i=i.slice(Y.length),D}}function g(){m(/^\s*/)}function C(L){var D;for(L=L||[];D=v();)D!==!1&&L.push(D);return L}function v(){var L=r();if(!(i.charAt(0)!="/"||i.charAt(1)!="*")){for(var D=2;i.charAt(D)!=""&&(i.charAt(D)!="*"||i.charAt(D+1)!="/");)++D;if(D+=2,i.charAt(D-1)==="")return h("End of comment missing");var Y=i.slice(2,D-2);return s+=2,n(Y),i=i.slice(D),s+=2,L({type:"comment",comment:Y})}}function b(){var L=m(/^([^{]+)/);if(L)return re(L[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(D){return D.replace(/,/g,"")}).split(/\s*(?![^(]*\)),\s*/).map(function(D){return D.replace(/\u200C/g,",")})}function S(){var L=r(),D=m(/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(D){if(D=re(D[0]),!m(/^:\s*/))return h("property missing ':'");var Y=m(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/),q=L({type:"declaration",property:D.replace(Ro,""),value:Y?re(Y[0]).replace(Ro,""):""});return m(/^[;\s]*/),q}}function y(){var L=[];if(!l())return h("missing '{'");C(L);for(var D;D=S();)D!==!1&&(L.push(D),C(L));return u()?L:h("missing '}'")}function w(){for(var L,D=[],Y=r();L=m(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)D.push(L[1]),m(/^,\s*/);if(D.length)return Y({type:"keyframe",values:D,declarations:y()})}function P(){var L=r(),D=m(/^@([-\w]+)?keyframes\s*/);if(D){var Y=D[1];if(D=m(/^([-\w]+)\s*/),!D)return h("@keyframes missing name");var q=D[1];if(!l())return h("@keyframes missing '{'");for(var yt,Gt=C();yt=w();)Gt.push(yt),Gt=Gt.concat(C());return u()?L({type:"keyframes",name:q,vendor:Y,keyframes:Gt}):h("@keyframes missing '}'")}}function _(){var L=r(),D=m(/^@supports *([^{]+)/);if(D){var Y=re(D[1]);if(!l())return h("@supports missing '{'");var q=C().concat(f());return u()?L({type:"supports",supports:Y,rules:q}):h("@supports missing '}'")}}function R(){var L=r(),D=m(/^@host\s*/);if(D){if(!l())return h("@host missing '{'");var Y=C().concat(f());return u()?L({type:"host",rules:Y}):h("@host missing '}'")}}function X(){var L=r(),D=m(/^@media *([^{]+)/);if(D){var Y=re(D[1]);if(!l())return h("@media missing '{'");var q=C().concat(f());return u()?L({type:"media",media:Y,rules:q}):h("@media missing '}'")}}function G(){var L=r(),D=m(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(D)return L({type:"custom-media",name:re(D[1]),media:re(D[2])})}function W(){var L=r(),D=m(/^@page */);if(D){var Y=b()||[];if(!l())return h("@page missing '{'");for(var q=C(),yt;yt=S();)q.push(yt),q=q.concat(C());return u()?L({type:"page",selectors:Y,declarations:q}):h("@page missing '}'")}}function $(){var L=r(),D=m(/^@([-\w]+)?document *([^{]+)/);if(D){var Y=re(D[1]),q=re(D[2]);if(!l())return h("@document missing '{'");var yt=C().concat(f());return u()?L({type:"document",document:q,vendor:Y,rules:yt}):h("@document missing '}'")}}function tt(){var L=r(),D=m(/^@font-face\s*/);if(D){if(!l())return h("@font-face missing '{'");for(var Y=C(),q;q=S();)Y.push(q),Y=Y.concat(C());return u()?L({type:"font-face",declarations:Y}):h("@font-face missing '}'")}}var at=kt("import"),it=kt("charset"),Xt=kt("namespace");function kt(L){var D=new RegExp("^@"+L+"\\s*([^;]+);");return function(){var Y=r(),q=m(D);if(q){var yt={type:L};return yt[L]=q[1].trim(),Y(yt)}}}function Lt(){if(i[0]=="@")return P()||X()||G()||_()||at()||it()||Xt()||$()||W()||R()||tt()}function Vt(){var L=r(),D=b();return D?(C(),L({type:"rule",selectors:D,declarations:y()})):h("selector missing")}return Bn(c())}function re(i){return i?i.replace(/^\s+|\s+$/g,""):""}function Bn(i,t){var e=i&&typeof i.type=="string",s=e?i:t;for(var n in i){var r=i[n];Array.isArray(r)?r.forEach(function(a){Bn(a,s)}):r&&typeof r=="object"&&Bn(r,s)}return e&&Object.defineProperty(i,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),i}class zo extends Io{currentItem={};items=[];groups=[];globalStyles={};grad={};idtops={};text="";constructor(t){super(t),this.on("tag",(e,s)=>{switch(this.text="",this.currentItem={type:e},e){case"g":this.groups.push(this.currentItem);break}this.processAttrs(e,s)}),this.on("text",e=>{if(this.currentItem.type=="style"){try{const s=Lo(e);for(const n of s.stylesheet.rules)for(const r of n.declarations)for(const a of n.selectors)this.globalStyles[a]=this.globalStyles[a]||[],this.globalStyles[a].push(`${r.property}:${r.value}`)}catch{console.error("CAN'T parse css text: "+e)}return}this.text+=e}),this.on("/tag",(e,s)=>{let n=this.groups.length;for(;n--;)if(this.groups[n]!=this.currentItem){let r="",a="";for(const o in this.groups[n])o=="transform"?r=this.groups[n].transform:o=="class"&&this.globalStyles["."+this.groups[n][o]]?a=this.globalStyles["."+this.groups[n][o]].join(";")+";"+a:o=="id"&&this.globalStyles["#"+this.groups[n][o]]?a=this.globalStyles["#"+this.groups[n][o]].join(";")+";"+a:typeof this.currentItem[o]>"u"&&(this.currentItem[o]=this.groups[n][o]);typeof this.currentItem.transform>"u"?this.currentItem.transform=r:this.currentItem.transform+=" "+r,typeof this.currentItem.style>"u"?this.currentItem.style=a:this.currentItem.style=a+this.currentItem.style,this.currentItem.class&&this.globalStyles["."+this.currentItem.class]?this.currentItem.style=this.globalStyles["."+this.currentItem.class].join(";")+";"+this.currentItem.style:this.currentItem.id&&this.globalStyles["#"+this.currentItem.id]&&(this.currentItem.style=this.globalStyles["#"+this.currentItem.id].join(";")+";"+this.currentItem.style),Yn(this.currentItem.style,this.currentItem,Un)}switch(this.processAttrs(e,s),e){case"g":this.groups.pop();break;case"cirlce":this.addToItems();break;case"ellipse":this.addToItems();break;case"polygon":this.addToItems();break;case"path":this.addToItems();break;case"line":this.addToItems();break;case"rect":this.addToItems();break;case"image":this.addToItems();break;case"text":this.currentItem.text=this.text,this.currentItem["text-anchor"]=this.currentItem["text-anchor"]||"start",this.addToItems();break}}),this.on("finish",()=>{this.emit("result",this.items)})}parse(){return super.parse(),this.items}processAttrs(t,e){let s=[],n;switch(t){case"svg":let r="",a="";if(e.width&&e.height)r=e.width,a=e.height;else if(e.viewBox){const o=e.viewBox.split(/\s+/gi);o.length==4&&(r=String(parseFloat(o[2])-parseFloat(o[0])),a=String(parseFloat(o[3])-parseFloat(o[1])))}r&&a&&this.items.push({type:"viewbox",width:r,height:a});break;case"line":typeof e.x1=="number"&&typeof e.y1=="number"&&typeof e.x2=="number"&&typeof e.y2=="number"&&(this.currentItem.path="M"+[e.x1,e.y1,e.x2,e.y2]);break;case"stop":n={},e.style&&Yn(e.style,n),n.offset=n.offset||e.offset,n.color=n["stop-color"]||e["stop-color"],n.opacity=n["stop-opacity"]||e["stop-opacity"],~(n.offset+"").indexOf("%")?n.offset=parseFloat(n.offset):n.offset=parseFloat(n.offset)*100,n.offset=+n.offset.toFixed(2),this.grad.stops.push(n);break;case"linearGradient":this.grad.angle=(360+Nn(parseFloat(e.x1),parseFloat(e.y1),parseFloat(e.x2),parseFloat(e.y2),parseFloat(e.x1)+100,parseFloat(e.y1))).toFixed(2),s=[this.grad.angle];for(let o=0,h=this.grad.stops.length;o<h;o++)n=this.grad.stops[o],o&&o!=h-1?s.push(n.color+":"+n.offset):s.push(n.color);this.idtops[this.grad.id]=s.join("-"),this.items.forEach(o=>{o.fillid==this.grad.id&&(o.fill=this.idtops[this.grad.id])});break;case"radialGradient":s=[];for(let o=0,h=this.grad.stops.length;o<h;o++)n=this.grad.stops[o],o&&o!=h-1?s.push(n.color+":"+n.offset):s.push(n.color);this.idtops[this.grad.id]=s.join("-"),this.items.forEach(o=>{o.fillid==this.grad.id&&(o.fill=this.idtops[this.grad.id])});break}for(const r in e){const a=e[r];if(Un.includes(r)&&(this.currentItem[r]=a),r==="id"&&(this.currentItem.type==="linearGradient"&&(this.grad={id:r,stops:[]}),this.currentItem.type==="radialGradient"&&(this.grad={id:r,stops:[]})),r==="style"&&Yn(a,this.currentItem,Un),r==="transform"&&(this.currentItem.transform=a+(this.currentItem.transform||" ")),r==="fill"){const o=a.match(/url\(#([^)]+)\)/);if(o){const h=o[1];this.currentItem.fillid=h,this.idtops[h]&&(this.currentItem.fill=this.idtops[h])}}r==="points"&&this.currentItem.type=="polygon"&&(this.currentItem.path="M"+a+"z"),r==="d"&&this.currentItem.type=="path"&&(this.currentItem.path=a),r==="xlink:href"&&this.currentItem.type=="image"&&(this.currentItem.src=a)}}addToItems(){this.items.push(this.currentItem)}}function Nn(i,t,e,s,n,r){if(typeof n>"u"||typeof r>"u"){const a=i-e,o=t-s;return!a&&!o?0:(180+Math.atan2(-o,-a)*180/Math.PI+360)%360}else return Nn(i,t,n,r)-Nn(e,s,n,r)}function Yn(i,t,e){const s=(i+"").split(";"),n=/^\s+|\s+$/g;for(let r=0,a=s.length;r<a;r++){const o=s[r].split(":"),h=o[0].replace(n,"").replace(/[A-Z]/g,function(c){return"-"+c.toLowerCase()});(!e||e.includes(h))&&(t[h]=o[1].replace(n,""))}}const Un=["id","class","viewBox","width","height","x","y","cx","cy","r","rx","ry","cursor","opacity","src","fill","fill-opacity","stroke","stroke-dasharray","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","font","font-family","font-size","font-style","font-weight","letter-spacing"];class Pd{controller;rootEl;ue;shapes=[];currentMouseInShape;currentEnableDragMouseInShape;dragDx=0;dragDy=0;constructor(t,e,s){this.controller=t,this.rootEl=_t.createSVGElement("svg"),this.ue=he(this.rootEl);const n=he(this.controller.el);n.empty(),n.insert(this.rootEl),e&&s?this.setSize(e,s):(this.setSize(this.controller.rect.width,this.controller.rect.height),this.controller.eb.on("resize",r=>{this.setSize(r.width,r.height)})),we(this.controller,{start:()=>{this.dragDx=0,this.dragDy=0,this.setCursor()},end:()=>{this.dragDx=0,this.dragDy=0,this.setCursor()},move:()=>{this.currentEnableDragMouseInShape&&(this.dragDx+=this.controller.mousePoint.dx,this.dragDy+=this.controller.mousePoint.dy),this.setCursor()}}),this.controller.eb.on("tap",()=>{for(const r of this.shapes)if(this.currentMouseInShape==r){r.emit("clicked",r);let a=r.parent;for(;a;)a.emit("clicked",r),a=a.parent;break}})}setCursor(){this.currentEnableDragMouseInShape?(this.controller.el.style.cursor="grab",this.controller.mousePoint.isDown&&(this.controller.el.style.cursor="grabbing")):this.currentMouseInShape?this.controller.el.style.cursor="pointer":this.controller.el.style.cursor="default"}setSize(t,e){return ye(this.rootEl,{viewBox:`0 0 ${t} ${e}`,width:`${t}`,height:`${e}`}),this}download(){return _t.downloadFromSVGElement(this.rootEl)}_addDrawShape(t){this.shapes.findIndex(e=>e.id==t.id)===-1&&(this.shapes.push(t),t instanceof ut&&t.shapes.forEach(e=>{this._addDrawShape(e)}))}path(t){(Array.isArray(t)?t:[t]).forEach(e=>{this._addDrawShape(e)}),this.controller.mousePoint.isDown&&this.currentEnableDragMouseInShape||(this.currentMouseInShape=void 0);for(const e of this.shapes){if(!e.isShow){e.el&&(e.el.remove(),delete e.el);continue}if(e.frameStart(this.controller.mousePoint),e.el||(e instanceof xs?e.el=this.text(e.text,e.x,e.y,br(e.getAttrs(),(n,r)=>typeof r=="string")):(e.el=_t.createSvgPath(e.toSVGPathD(),e.id),this.ue.insert(e.el))),e.followMouse&&(!Ps(e.x,this.controller.mousePoint.x,5)||!Ps(e.y,this.controller.mousePoint.y,5))&&e.followTo(this.controller.mousePoint),e.targetToAfterDragFree&&(this.controller.mousePoint.isDown||e.runEaseTo({x:e.targetToAfterDragFree.targetX,y:e.targetToAfterDragFree.targetY},{easing:e.targetToAfterDragFree?.easing})),this.controller.mousePoint.isDown&&this.currentEnableDragMouseInShape==e){e.isDragging=!0;const n=this.dragDx,r=this.dragDy;if(this.dragDx=0,this.dragDy=0,n||r){if(e.x+=n,e.y+=r,e.alongPath){const a=e.alongPath.closestPoint(e.x,e.y);e.x=a.point.x-e.cX,e.y=a.point.y-e.cY}e.emit("draging",n,r)}}else e.isDragging=!1;e instanceof xs&&(e.setAttr("x",String(e.x)),e.setAttr("y",String(e.y))),e.frameUpdate(this.controller.mousePoint);const s=e.toSVGPathD();if(this.attr(e,br(e.getAttrs(),(n,r)=>typeof r=="string")),this.attr(e,"d",s),!this.currentMouseInShape){const n=e.isPointInPath(this.controller.mousePoint.x,this.controller.mousePoint.y,this.rootEl)||e.isPointInStroke(this.controller.mousePoint.x,this.controller.mousePoint.y,this.rootEl)||!1;e.isMouseIn=n,n&&(this.currentMouseInShape=e,e.enableDrag&&(this.currentEnableDragMouseInShape=e))}e.frameEnd(this.controller.mousePoint)}this.currentMouseInShape||(this.currentEnableDragMouseInShape=void 0)}delete(t){(Array.isArray(t)?t:[t]).forEach(e=>{e.el&&e.el.remove(),delete e.el,this.shapes=this.shapes.filter(s=>s.id!==e.id)})}clear(){this.shapes.forEach(t=>{t.el&&t.el.remove(),delete t.el}),this.ue.empty(),this.shapes=[]}attr(t,e,s){const n=t.el||t;return n instanceof SVGElement?e===void 0&&s===void 0?ye(n):typeof e=="string"&&s===void 0?ye(n,mt(e))||"":(typeof e=="object"?ye(n,e):typeof e=="string"&&s!==void 0&&ye(n,mt(e),s),this):this}circle(t,e,s){return this.path(new ae({x:t,y:e,radius:s}))}circleEl(t,e,s){const n=_t.createSVGElement("circle",{cx:String(t),cy:String(e),r:String(s)});return this.ue.insert(n),n}ellipse(t,e,s,n){return this.path(new Fo({x:t,y:e,rx:s,ry:n}))}ellipseEl(t,e,s,n){const r=_t.createSVGElement("ellipse",{cx:String(t),cy:String(e),rx:String(s),ry:String(n)});return this.ue.insert(r),r}rect(t,e,s,n){return this.path(new oe({x:t,y:e,width:s,height:n}))}rectEl(t,e,s,n){const r=_t.createSVGElement("rect",{x:String(t),y:String(e),width:String(s),height:String(n)});return this.ue.insert(r),r}image(t,e,s,n,r){}text(t,e,s,n){const r=_t.createSVGElement("text",{x:String(e),y:String(s)});return he(r).html(t),this.attr(r,Object.assign({"alignment-baseline":"middle"},n)),this.ue.insert(r),r}textWithTspan(t,e,s,n){const r=n?.["line-height"]||"1.2em",a=_t.createSVGElement("text",{x:String(e),y:String(s)});return t.split(`
|
|
37
37
|
`).forEach((o,h)=>{if(o.trim()){const c=_t.createSVGElement("tspan",{x:String(e),dy:h>0?r:"0"});he(c).html(o),he(a).insert(c),this.attr(c,Object.assign({"alignment-baseline":"middle"},n))}}),this.ue.insert(a),a}}class Md extends ut{svgWidth=0;svgHeight=0;width=0;height=0;constructor(t){super(t);const e=new zo(t.svg).parse();for(let s=0,n=e.length;s<n;s++){const r=e[s];if(r.type=="viewbox"&&r.width&&r.height){if(this.svgWidth=parseFloat(r.width),this.svgHeight=parseFloat(r.height),t.width){const l=this.svgWidth/this.svgHeight;this.width=t.width,this.height=this.width/l}else this.width=this.svgWidth,this.height=this.svgHeight;continue}if(r.type!="path"||!Ie.isSVGPath(r.path))continue;const a={};for(const l in r)l==="type"||l==="path"||l==="transform"||(a[l]=r[l]);const o=Ie.absolutizeSVGPath(Ie.parseSVGPath(r.path)),h=[];let c=[];for(let l=0,u=o.length;l<u;l++){const f=o[l];c.push(f),f[0].toLowerCase()=="z"&&(h.push(c),c=[])}c.length&&h.push(c),h.forEach(l=>{const u=vn(r.transform??"");u.scale(this.width&&this.svgWidth?this.width/this.svgWidth:1),this.addShape(new j({...t,attrs:{...a,...t?.attrs||{}},d:l,originMatrix:u}))})}}shapeInit(){this.trim()}}class ae extends j{radius;constructor(t){super(t),this.radius=t?.radius||0}getBoundingClientRect(){return{x:this.x-this.radius,y:this.y-this.radius,width:this.radius*2,height:this.radius*2}}toSVGPathData(){return this.radius?[["m",0,-this.radius],["a",this.radius,this.radius,0,1,1,0,2*this.radius],["a",this.radius,this.radius,0,1,1,0,-2*this.radius],["z"]]:[["m",0,0]]}toCanvasContext(t){t.beginPath(),t.arc(0,0,this.radius,0,Math.PI*2,!0),t.closePath()}eq(t){return this.x===t.x&&this.y===t.y&&this.radius===t.radius&&this.mass===t.mass}midPointBtw(t){return{x:this.x+(t.x-this.x)/2,y:this.y+(t.y-this.y)/2}}length(){return Ks(this.x,this.y)}scalar(t){return this.x*=t,this.y*=t,this}normalize(t=1){const e=this.length();if(e){const s=t/e;this.scalar(s)}return this}clamp(t){const e=this.length();return e&&e>t&&this.scalar(t/e),this}cross(t){const e=this.x,s=this.y;return{x:s*t.x-e*t.y,y:e*t.y-s*t.x}}multiply(t){return{x:this.x*t.x,y:this.y*t.y}}div(t){return{x:this.x/t.x,y:this.y/t.y}}add(t){return{x:this.x+t.x,y:this.y+t.y}}sub(t){return{x:this.x-t.x,y:this.y-t.y}}dot(t){return this.x*t.x+this.y*t.y}reflect(t){const e=this.dot(t);return{x:this.x-2*e*t.x,y:this.y-2*e*t.y}}checkCollision(t){const e=t.x-this.x,s=t.y-this.y;if(Math.sqrt(e*e+s*s)<this.radius+t.radius){const r=Math.atan2(s,e),a={x:0,y:0},o=Yt(-r,e,s),h=Yt(-r,this.vx,this.vy),c=Yt(-r,t.vx,t.vy),l=h.x-c.x;h.x=((this.mass-t.mass)*h.x+2*t.mass*c.x)/(this.mass+t.mass),c.x=l+h.x;const u=Math.abs(h.x)+Math.abs(c.x),f=this.radius+t.radius-Math.abs(a.x-o.x);a.x+=h.x/u*f,o.x+=c.x/u*f;const m=Yt(r,a.x,a.y),g=Yt(r,o.x,o.y);t.x=this.x+g.x,t.y=this.y+g.y,this.x=this.x+m.x,this.y=this.y+m.y;const C=Yt(r,h.x,h.y),v=Yt(r,c.x,c.y);this.vx=C.x,this.vy=C.y,t.vx=v.x,t.vy=v.y}}checkWall(t){const e=typeof t?.bounce=="number"?t.bounce:-1,s=t.wall.x,n=t.wall.y,r=t.wall.x+t.wall.width,a=t.wall.y+t.wall.height;this.x+this.radius>r?(this.x=r-this.radius,this.vx*=e):this.x-this.radius<s&&(this.x=s+this.radius,this.vx*=e),this.y+this.radius>a?(this.y=a-this.radius,this.vy*=e):this.y-this.radius<n&&(this.y=n+this.radius,this.vy*=e)}}class Oo extends j{points;isStraight;constructor(t){if(super(t),this.points=t.points,this.points.length<3)throw new Error("points length must >= 3");this.isStraight=typeof t?.isStraight=="boolean"?t.isStraight:!0}toSVGPathData(){const t=[],e=this.points.length;if(this.isStraight){t.push(["M",this.points[0].x,this.points[0].y]);for(let s=1;s<=e-1;s++)t.push(["L",this.points[s].x,this.points[s].y]);t.push(["Z"])}else{const s=(this.points[0].x+this.points[e-1].x)/2,n=(this.points[0].y+this.points[e-1].y)/2;t.push(["M",s,n]);for(let r=0;r<e-1;r++){const a=(this.points[r].x+this.points[r+1].x)/2,o=(this.points[r].y+this.points[r+1].y)/2;t.push(["Q",this.points[r].x,this.points[r].y,a,o])}t.push(["Q",this.points[e-1].x,this.points[e-1].y,s,n])}return t}toCanvasContext(t){t.beginPath();const e=this.points.length;if(this.isStraight){t.moveTo(this.points[0].x,this.points[0].y);for(let s=1;s<=e-1;s++)t.lineTo(this.points[s].x,this.points[s].y);t.closePath()}else{const s=(this.points[0].x+this.points[e-1].x)/2,n=(this.points[0].y+this.points[e-1].y)/2;t.moveTo(s,n);for(let r=0;r<e-1;r++){const a=(this.points[r].x+this.points[r+1].x)/2,o=(this.points[r].y+this.points[r+1].y)/2;t.quadraticCurveTo(this.points[r].x,this.points[r].y,a,o)}t.quadraticCurveTo(this.points[e-1].x,this.points[e-1].y,s,n)}}isContainPoint(t,e){const s=this.points.length;let n=!1;const r=2e-10;for(let a=0,o=s-1;a<s;o=a,a++){const h=this.points[a].x,c=this.points[a].y,l=this.points[o].x,u=this.points[o].y;if(h===t&&c===e||l===t&&u===e||e===c&&e===u)return!0;if(e>=c&&e<u||e<c&&e>=u){const f=(l-h)/(u-c),m=h+f*(e-c);if(m===t||Math.abs(m-t)<r)return!0;m>t&&(n=!n)}}return n}[Symbol.iterator](){let t=-1;return{next:()=>({value:t<=this.points.length-1?this.points[++t]:void 0,done:t>=this.points.length})}}}class oe extends j{width;height;borderRadius;constructor(t){super(t),this.width=t.width,this.height=t.height,this.borderRadius=t.borderRadius||0}static fromCubicBezier(t,e,s,n,r,a,o,h){const c=new bt({x:t,y:e,c1x:s,c1y:n,c2x:r,c2y:a,toX:o,toY:h});return new oe(c.getBoundingClientRect())}getBoundingClientRect(){return{x:this.x,y:this.y,width:this.width,height:this.height}}toSVGPathData(){return this.borderRadius?[["m",this.borderRadius,0],["l",this.width-this.borderRadius*2,0],["a",this.borderRadius,this.borderRadius,0,0,1,this.borderRadius,this.borderRadius],["l",0,this.height-this.borderRadius*2],["a",this.borderRadius,this.borderRadius,0,0,1,-this.borderRadius,this.borderRadius],["l",this.borderRadius*2-this.width,0],["a",this.borderRadius,this.borderRadius,0,0,1,-this.borderRadius,-this.borderRadius],["l",0,this.borderRadius*2-this.height],["a",this.borderRadius,this.borderRadius,0,0,1,this.borderRadius,-this.borderRadius],["z"]]:[["m",0,0],["l",this.width,0],["l",0,this.height],["l",-this.width,0],["z"]]}toCanvasContext(t){t.beginPath(),this.borderRadius<=0?t.rect(0,0,this.width,this.height):(t.moveTo(0,this.borderRadius),t.lineTo(0,this.height-this.borderRadius),t.quadraticCurveTo(0,this.height,this.borderRadius,this.height),t.lineTo(this.width-this.borderRadius,this.height),t.quadraticCurveTo(this.width,this.height,this.width,this.height-this.borderRadius),t.lineTo(this.width,this.borderRadius),t.quadraticCurveTo(this.width,0,this.width-this.borderRadius,0),t.lineTo(this.borderRadius,0),t.quadraticCurveTo(0,0,0,this.borderRadius)),t.closePath()}eq(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height&&this.borderRadius===t.borderRadius}isIntersectRect(t){return!(this.x+this.width<t.x||t.x+t.width<this.x||this.y+this.height<t.y||t.y+t.height<this.y)}isContainPoint(t,e){return t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height}}class Fo extends j{rx;ry;constructor(t){super(t),this.rx=t?.rx||0,this.ry=t?.ry||0}getBoundingClientRect(){return{x:this.x-this.rx,y:this.y-this.ry,width:this.rx*2,height:this.ry*2}}toSVGPathData(){return[["m",0,-this.ry],["a",this.rx,this.ry,0,1,1,0,2*this.ry],["a",this.rx,this.ry,0,1,1,0,-2*this.ry],["z"]]}toCanvasContext(t){t.beginPath(),t.ellipse(0,0,this.rx,this.ry,0,0,2*Math.PI,!0),t.closePath()}}class Ed extends j{constructor(t){super(t)}toSVGPathData(){return[["m",-50,-25],["l",50,0],["l",0,-25],["l",50,50],["l",-50,50],["l",0,-25],["l",-50,0],["l",0,-50],["z"]]}toCanvasContext(t){t.beginPath(),t.moveTo(-50,-25),t.lineTo(0,-25),t.lineTo(0,-50),t.lineTo(50,0),t.lineTo(0,50),t.lineTo(0,25),t.lineTo(-50,25),t.lineTo(-50,-25),t.closePath()}}class Ad extends j{constructor(t){super(t)}toSVGPathData(){return[["m",4,24],["l",4,-8],["l",6,-6],["l",1,-10],["l",-6,-10],["l",-7,10],["l",-4,0],["l",-7,-10],["l",-6,10],["l",1,10],["l",6,6],["l",4,8],["z"]]}toCanvasContext(t){t.beginPath(),t.moveTo(4,24),t.lineTo(8,16),t.lineTo(14,10),t.lineTo(15,0),t.lineTo(9,-10),t.lineTo(2,0),t.lineTo(-2,0),t.lineTo(-9,-10),t.lineTo(-15,0),t.lineTo(-14,10),t.lineTo(-8,16),t.lineTo(-4,24),t.closePath()}}class kd extends j{rx;ry;constructor(t){super(t),this.rx=t?.rx||10,this.ry=t?.ry||10}toSVGPathData(){return[["m",0,0],["l",this.rx*2.4,-this.ry*3.14],["a",this.rx/2,this.ry/2,0,0,0,-this.rx*2.4,-this.ry*1.5],["a",this.rx/2,this.ry/2,0,0,0,-this.rx*2.4,this.ry*1.5],["l",this.rx*2.4,this.ry*3.14],["z"]]}}class Id extends j{rx;ry;constructor(t){super(t),this.rx=t?.rx??50,this.ry=t?.ry??50}toSVGPathData(){return[["m",0,0+this.ry*.3],["C",0,0,0-this.rx/2,0,0-this.rx/2,0+this.ry*.3],["C",0-this.rx/2,0+(this.ry+this.ry*.3)/2,0,0+(this.ry+this.ry*.3)/1.4,0,0+this.ry],["C",0,0+(this.ry+this.ry*.3)/1.8,0+this.rx/2,0+(this.ry+this.ry*.3)/2,0+this.rx/2,0+this.ry*.3],["C",0+this.rx/2,0,0,0,0,0+this.ry*.3],["z"]]}}class Dd extends j{r;constructor(t){super(t),this.r=t?.r||20}toSVGPathData(){const t=[["m",0,-this.r]];for(let e=0;e<6;e+=1){const s=288+e*144,n=this.r*Math.cos(U(s)),r=this.r*Math.sin(U(s));t.push(["l",n,r])}return t}}class Rd extends j{constructor(t){super(t)}toSVGPathData(){return[["M",0,0],["C",15,0,15,-40,5,-30],["L",0,0],["C",-15,0,-15,-40,-5,-30],["L",0,0],["a",15,15,0,1,1,0,30],["a",15,15,0,1,1,0,-30]]}}class Ld extends j{constructor(t){super(t),this.originD="m5.068 9.267-3.08-.77a.512.512 0 0 1 0-.994l3.08-.77a2.289 2.289 0 0 0 1.665-1.665l.77-3.08a.512.512 0 0 1 .994 0l.77 3.08c.205.82.845 1.46 1.665 1.665l3.08.77a.512.512 0 0 1 0 .994l-3.08.77a2.29 2.29 0 0 0-1.665 1.665l-.77 3.08a.512.512 0 0 1-.994 0l-.77-3.08a2.289 2.289 0 0 0-1.665-1.665Z"}}class zd extends ut{constructor(t){super(t);const e=new Fe({...t,x:this.x,y:this.y,toX:this.x,toY:this.y-140-Math.random()*20}),s=30+Math.random()*30,n=new Fe({...t,x:this.x,y:this.y-s,diffYInGroup:-s,toX:this.x+Math.random()*80-40,toY:this.y-100-Math.random()*40}),r=60+Math.random()*40,a=new Fe({...t,x:this.x,y:this.y-r,diffYInGroup:-r,toX:this.x+Math.random()*60-30,toY:this.y-110-Math.random()*20});this.addShape([e,n,a])}}class xs extends j{text;width=0;height=0;constructor(t){super(t),this.text=t.text,this.setAttr({fontSize:"10px",fontFamily:'system-ui, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',emojiFontFamily:'"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif',fill:"#666666",stroke:"none","alignment-baseline":"middle",textAnchor:"start",...this.getAttrs()});const e=Ii(this.getAttr("fontSize"),10).number,s=Ii(this.getAttr("fontWeight"),400).number,n=this.measureText(this.text,e,s);this.width=n.width,this.height=n.height}getBoundingClientRect(){return null}toSVGPathData(){return[]}toCanvasContext(t){t.fillText(this.text,0,0)}measureText(t,e=12,s=400){const n=document.createElement("span");n.style.visibility="hidden",n.style.margin="0",n.style.padding="0",n.style.inset="0",n.style.whiteSpace="nowrap",n.style.overflow="visible",n.style.fontSize=e+"px",n.style.fontWeight=s.toString(),n.innerText=t,document.body.appendChild(n);const r=n.offsetWidth,a=n.offsetHeight;return document.body.removeChild(n),{width:r,height:a}}getFixedWidthText(t,e,s=12,n=400,r=!0){let a="";if(!t||e<s)return a;const o=t.split(""),h="...";let c=r?this.measureText(h,s,n).width:0;for(let l=0,u=o.length;l<u;l++)if(c+=this.measureText(o[l],s,n).width,c>e){r&&(a+=h);break}else a+=o[l];return a}}class Bo extends ut{text;bg;padding;offset;isShow;textShape;bgShape;constructor(t){super(t),this.text=t.text,this.bg=t.bg||"rgba(0,0,0,0.5)",this.padding=t.padding||4,this.offset=t.offset||20,this.isShow=typeof t?.isShow=="boolean"?t?.isShow:!1,this.textShape=new xs({...t,x:this.x+this.offset,y:this.y+this.offset,text:this.text,attrs:{...this.getAttrs(),fill:Ut.set(this.bg).opposite(!0).toString(),textAnchor:"start"}}),this.bgShape=new oe({...t,x:this.textShape.x-this.padding,y:this.textShape.y-this.textShape.height/2-this.padding,width:this.textShape.width+this.padding*2,height:this.textShape.height+this.padding*2,attrs:{...this.getAttrs(),fill:this.bg}}),this.addShape([this.bgShape,this.textShape])}shapeInit(){xt(()=>{this.textShape.x=this.x+this.offset,this.textShape.y=this.y+this.offset,this.textShape.text=this.text,this.textShape.isShow=this.isShow,this.bgShape.x=this.textShape.x-this.padding,this.bgShape.y=this.textShape.y-this.textShape.height/2-this.padding,this.bgShape.width=this.textShape.width+this.padding*2,this.bgShape.height=this.textShape.height+this.padding*2,this.bgShape.isShow=this.isShow})}}class Od extends ut{radius;expandRaidus;startDegree;endDegree;text="";defaultShowText;tip="";p1=new ae;p1Offset=10;p2=new ae;p2Offset=40;p3=new ae;p3Offset=10;p4=new ae;p4Offset=10;direction=1;sectorArc;line12;line23;textShape;tipShape;constructor(t){super(t),this.radius=t.radius,this.expandRaidus=t.expandRaidus??20,this.startDegree=t.startDegree,this.endDegree=t.endDegree,this.text=t.text||"",this.defaultShowText=typeof t?.defaultShowText=="boolean"?t.defaultShowText:!!this.text,this.tip=t.tip||"",this.sectorArc=new No({x:this.x,y:this.y,radius:this.radius,expandRaidus:this.expandRaidus,startDegree:this.startDegree,endDegree:this.endDegree,attrs:Object.assign({...this.getAttrs()},{strokeWidth:"0"})}),this.addShape(this.sectorArc);const e=Object.assign({...this.getAttrs()},{fill:"none"});this.line12=new Fe({x:this.p1.x,y:this.p1.y,toX:this.p2.x,toY:this.p2.y,attrs:{...e},isShow:this.defaultShowText}),this.line23=new Fe({x:this.p2.x,y:this.p2.y,toX:this.p3.x,toY:this.p3.y,attrs:{...e},isShow:this.defaultShowText}),this.textShape=new xs({x:this.p4.x,y:this.p4.y,text:this.text,attrs:{stroke:e.stroke,textAnchor:this.direction==1?"start":"end"},isShow:this.defaultShowText}),this.text&&(this.addShape(this.line12),this.addShape(this.line23),this.addShape(this.textShape)),this.tipShape=new Bo({x:0,y:0,text:this.tip,isShow:!1}),this.tip&&this.addShape(this.tipShape)}frameUpdate(t){this.text&&!this.defaultShowText&&(this.line12.isShow=this.sectorArc.isMouseIn,this.line23.isShow=this.sectorArc.isMouseIn,this.textShape.isShow=this.sectorArc.isMouseIn);const e=this.startDegree+(this.endDegree-this.startDegree)/2,{dx:s,dy:n}=Wt(U(e),this.sectorArc.radius+this.p1Offset);this.p1.x=this.x+s,this.p1.y=this.y+n;const{dx:r,dy:a}=Wt(U(e),this.sectorArc.radius+this.p1Offset+this.p2Offset);this.p2.x=this.x+r,this.p2.y=this.y+a,this.line12.x=this.p1.x,this.line12.y=this.p1.y,this.line12.toX=this.p2.x,this.line12.toY=this.p2.y,this.direction=this.p1.x>this.x?1:-1,this.p3.x=this.p2.x+this.direction*this.p3Offset,this.p3.y=this.p2.y,this.p4.x=this.p3.x+this.direction*this.p4Offset,this.p4.y=this.p3.y,this.line23.x=this.p2.x,this.line23.y=this.p2.y,this.line23.toX=this.p3.x,this.line23.toY=this.p3.y,this.textShape.x=this.p4.x,this.textShape.y=this.p4.y,this.textShape.setAttr("textAnchor",this.direction==1?"start":"end"),this.sectorArc.isMouseIn?(this.tipShape.isShow=!0,this.tipShape.x=t.x,this.tipShape.y=t.y):(this.tipShape.isShow=!1,this.tipShape.x=t.x,this.tipShape.y=t.y)}}class No extends j{radius;realRadius;expandRaidus;startDegree;endDegree;vr;ar;bounce;durationTime;status;constructor(t){super(t),this.radius=0,this.realRadius=t.radius,this.expandRaidus=t.expandRaidus??20,this.startDegree=t.startDegree,this.endDegree=t.endDegree,this.vr=0,this.ar=.03,this.bounce=.6,this.durationTime=8.333333333333334,this.status=0}frameUpdate(){this.status==0&&this.radius<this.realRadius?(this.expand(this.realRadius),this.radius>=this.realRadius&&(this.status=1)):this.isMouseIn?this.expand(this.realRadius+this.expandRaidus):this.shrink(this.realRadius)}expand(t){this.vr+=this.ar,this.radius+=this.vr*this.durationTime,this.radius>t&&(this.radius=t,this.vr*=-this.bounce)}shrink(t){this.vr-=this.ar,this.radius+=this.vr*this.durationTime,this.radius<t&&(this.radius=t,this.vr*=-this.bounce)}toSVGPathData(){const{dx:t,dy:e}=Wt(U(this.startDegree),this.radius),{dx:s,dy:n}=Wt(U(this.endDegree),this.radius);return[["m",0,0],["l",t,e],["a",this.radius,this.radius,0,Math.abs(this.endDegree-this.startDegree)>=180?1:0,1,s-t,n-e],["z"]]}toCanvasContext(t){t.beginPath(),t.moveTo(0,0),t.arc(0,0,this.radius,U(this.startDegree),U(this.endDegree),!1),t.closePath()}containPoint(t,e){const s=Qs(this.x,this.y,t,e),n=lt(ge(this.x,this.y,t,e));return s<=this.radius&&n>=this.startDegree&&n<=this.endDegree}}class Fd extends ut{showFlame;ship;flame;constructor(t){super(t),this.showFlame=typeof t?.showFlame=="boolean"?t.showFlame:!1,this.ship=new j({...t,d:[["M",10,0],["L",-10,10],["L",-5,0],["L",-10,-10],["L",10,0],["Z"]]}),this.addShape(this.ship),this.flame=new j({...t,isShow:this.showFlame,d:[["m",-10,-5],["l",-7.5,5],["l",7.5,5],["z"]]}),this.addShape(this.flame)}shapeInit(){xt(()=>{this.ship.x=this.x,this.ship.y=this.y,this.flame.x=this.x,this.flame.y=this.y,this.flame.isShow=this.showFlame})}}class Bd extends ut{value;backgroundRect;occupyRect;handle;constructor(t){super(t);const e=t?.min||0,s=t?.max||100,n=t?.step||1,r=Fh(e,s,n);this.value=r(typeof t?.defaultValue=="number"?F(t.defaultValue,e,s):e);const a=this.value/(s-e),o=t?.barWidth||100,h=t?.barHeight||4,c=t?.handleRadius||10,l=h*.5,u=t?.barColor||"#f5f5f5",f=t?.handleColor||ro("--xg-blue");this.backgroundRect=new oe({x:this.x,y:this.y,width:o,height:h,borderRadius:l,attrs:{fill:u},enableDrag:!1,independentTransformInGroup:!0}),this.addShape(this.backgroundRect),this.occupyRect=new oe({x:this.x,y:this.y,width:o*a,height:h,borderRadius:l,attrs:{fill:f},enableDrag:!1,independentTransformInGroup:!0}),this.addShape(this.occupyRect),this.handle=new ae({x:this.x+o*a,y:this.y+l,diffXInGroup:o*a,diffYInGroup:l,radius:c,alongPath:new ju({x:this.x,y:this.y+l,d:[["m",0,0],["l",o,0]]}),attrs:{fill:f},enableDrag:!0,independentTransformInGroup:!0}),this.addShape(this.handle),this.handle.on("draging",m=>{this.occupyRect.width=F(this.occupyRect.width+m,0,o),this.value=r((this.handle.x-this.x)/o*(s-e)+e),this.emit("change",this.value)})}}class Nd extends ut{width;height;cornerRadius;controlPoint;mainRect;rightPoint;constructor(t){super(t),this.width=t.width,this.height=t.height,this.cornerRadius=this.height/2,this.controlPoint=new ae({...t,x:this.x,y:this.y,radius:2}),this.forceSetCXY(this.controlPoint.cX,this.controlPoint.cY),this.mainRect=new oe({...t,x:this.x-this.cornerRadius,y:this.y-this.cornerRadius,diffXInGroup:-this.cornerRadius,diffYInGroup:-this.cornerRadius,width:this.width+this.cornerRadius*2,height:this.height,borderRadius:this.cornerRadius}),this.rightPoint=new ae({...t,x:this.x+this.width,y:this.y,diffXInGroup:this.width,radius:2}),this.addShape([this.mainRect,this.controlPoint,this.rightPoint])}getPin(){return{x:this.controlPoint.x+Math.cos(U(this.controlPoint.degree))*this.width,y:this.controlPoint.y+Math.sin(U(this.controlPoint.degree))*this.width}}}class Xn extends j{extendDegree;radius;startDegree;endDegree;diffDegree;constructor(t){super(t),this.extendDegree=t?.extendDegree||0,this.x=(t.x||0)+t.width/2;const e=Math.min(t.width/2,t.height)-t.lineWidth;this.radius=Math.max(0,e-e*Math.abs(Math.sin(U(this.extendDegree)))),this.y=(t.y||0)+t.height-t.lineWidth-this.radius*Math.abs(Math.sin(U(this.extendDegree))),this.diffDegree=t.endDegree-t.startDegree,this.startDegree=180+t.startDegree-this.extendDegree,this.endDegree=180+t.endDegree+this.extendDegree,this.setAttr({"stroke-linecap":"round","stroke-width":String(t.lineWidth),stroke:t.color||"none"})}setPercent(t){this.endDegree=this.startDegree+(this.diffDegree+this.extendDegree*2)*t}toSVGPathData(){const{dx:t,dy:e}=Wt(U(this.startDegree),this.radius),{dx:s,dy:n}=Wt(U(this.endDegree),this.radius);return[["m",t,e],["a",this.radius,this.radius,0,Math.abs(this.endDegree-this.startDegree)>=180?1:0,1,s-t,n-e]]}toCanvasContext(t){t.beginPath(),t.arc(0,0,this.radius,U(this.startDegree),U(this.endDegree),!1)}}class Yd extends ut{percent=0;ringBg;ring;lines=[];bgColor;startColor;endColor;indicatorLineCount;constructor(t){super(t);const e=t?.startDegree||0,s=t?.endDegree||180,n=t?.extendDegree||15,r=t?.lineWidth||12;this.bgColor=t?.bgColor||"#B3C6E7",this.startColor=t?.startColor||"#5A82F0",this.endColor=t?.endColor||"#66B3FF",this.percent=t?.percent||0,this.indicatorLineCount=23;const a=20,o=2,h=17;this.ringBg=new Xn({...t,x:t?.x,y:t?.y,width:t.width,height:t.height,startDegree:e,endDegree:s,extendDegree:n,lineWidth:r,color:this.bgColor}),this.addShape(this.ringBg),this.ring=new Xn({...t,x:t?.x,y:t?.y,width:t.width,height:t.height,startDegree:e,endDegree:s,extendDegree:n,lineWidth:r}),this.addShape(this.ring);const c=this.ringBg.y-this.ringBg.radius+a;for(let l=0;l<this.indicatorLineCount;l++)this.lines.push(new Fe({...t,centerX:this.ringBg.x,centerY:this.ringBg.y,x:this.ringBg.x,y:c,toX:this.ringBg.x,toY:c+h,degree:this.ringBg.startDegree+90+(s-e+n*2)/(this.indicatorLineCount-1)*l,attrs:{"stroke-linecap":"round","stroke-width":String(o),stroke:this.bgColor}}));this.addShape(this.lines)}setPercent(t){this.percent=t}shapeInit(){this.on("draging",(t,e,s)=>{this.shapes.forEach(n=>{n!=s&&(n.x+=t,n.y+=e)})})}frameUpdate(t,e){const s=this.ringBg.radius-this.ringBg.radius*Math.cos(Math.PI*this.percent),n=this.ringBg.radius*Math.sin(Math.PI*this.percent);if(e){const r=e.createLinearGradient(-this.ringBg.radius,0,-this.ringBg.radius+s,-n,{0:this.startColor,1:this.endColor});this.ring.setAttr({stroke:r})}else this.ring.setAttr({stroke:this.startColor});this.ring.setPercent(this.percent);for(let r=0;r<this.indicatorLineCount;r++){const a=r/(this.indicatorLineCount-1)<=this.percent;this.lines[r].setAttr({stroke:a&&e?e.createLinearGradient(0,0,this.lines[r].toX-this.lines[r].x,this.lines[r].toY-this.lines[r].y,{0:this.startColor,1:this.endColor}):a?this.startColor:this.bgColor})}}}class Ud extends j{x;y;z;brightness;constructor(t){super(t),this.x=t?.x||0,this.y=t?.y||0,this.z=t?.z||0,this.brightness=this.setBrightness(t?.brightness||1)}setBrightness(t){return this.brightness=F(t,0,1),this.brightness}toSVGPathData(){return[]}}const Xd=Ud;class Vd extends j{points;light;constructor(t=[]){if(t.length<3)throw new Error("points length must >= 3");super(),this.points=t,this.light=new Xd({x:0,y:0,z:0,brightness:1})}toSVGPathData(){const t=[];t.push(["M",this.points[0].getScreenX(),this.points[0].getScreenY()]);for(let e=0,s=this.points.length;e<=s-1;e++)t.push(["L",this.points[e].getScreenX(),this.points[e].getScreenY()]);return t.push(["L",this.points[0].getScreenX(),this.points[0].getScreenY()]),t}toCanvasContext(t){t.beginPath(),t.moveTo(0,0);for(let e=0,s=this.points.length;e<=s-1;e++)t.lineTo(this.points[e].getScreenX()-this.points[0].getScreenX(),this.points[e].getScreenY()-this.points[0].getScreenY());t.lineTo(0,0)}get length(){return this.points.length}getDepth(){return Math.min(...this.points.map(t=>t.z))}isBackface(){const t=this.points[2].getScreenX()-this.points[0].getScreenX(),e=this.points[2].getScreenY()-this.points[0].getScreenY(),s=this.points[1].getScreenX()-this.points[2].getScreenX(),n=this.points[1].getScreenY()-this.points[2].getScreenY();return t*n>e*s}getLightFactor(){const t={x:this.points[0].x-this.points[1].x,y:this.points[0].y-this.points[1].y,z:this.points[0].z-this.points[1].z},e={x:this.points[1].x-this.points[2].x,y:this.points[1].y-this.points[2].y,z:this.points[1].z-this.points[2].z},s={x:t.y*e.z-t.z*e.y,y:-(t.x*e.z-t.z*e.x),z:t.x*e.y-t.y*e.x},n=s.x*this.light.x+s.y*this.light.y+s.z*this.light.z,r=Math.sqrt(s.x*s.x+s.y*s.y+s.z*s.z),a=Math.sqrt(this.light.x*this.light.x+this.light.y*this.light.y+this.light.z*this.light.z);return Math.acos(n/(r*a))/Math.PI*this.light.brightness}getAdjustedColor(t){const e=Ut.set(t),s=this.getLightFactor();return e.r*=s,e.g*=s,e.b*=s,e.toString()}}class Gd extends ut{fettis=[];constructor(t,e,s){super();const{shape:n,x:r,y:a,particleCount:o,angle:h,spread:c,startVelocity:l,decay:u,gravity:f,drift:m,ticks:g,colors:C,scalar:v,flat:b}=Object.assign({shape:oe,x:.5,y:.6,particleCount:100,angle:90,spread:70,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,colors:Q.getColors(),scalar:1,flat:!1},s||{}),S=U(h),y=U(c);let w=o;for(;w--;){const P=C[w%C.length],_=new n({x:t*r,y:e*a,width:10,height:10,scalar:v,attrs:{fill:P},independentTransformInGroup:!0});this.addShape(_),this.fettis.push({shape:_,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:l*.5+Math.random()*l,angle2D:-S+(.5*y-Math.random()*y),tiltAngle:(Math.random()*.5+.25)*Math.PI,tick:0,totalTicks:g,decay:u,drift:m,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:f*3,scalar:v,flat:b,color:new Q(P)})}}frameUpdate(t){this.fettis.length&&(this.fettis=this.fettis.filter(e=>{e.shape.x+=Math.cos(e.angle2D)*e.velocity+e.drift,e.shape.y+=Math.sin(e.angle2D)*e.velocity+e.gravity,e.velocity*=e.decay,e.flat?(e.wobble=0,e.wobbleX=e.shape.x+10*e.scalar,e.wobbleY=e.shape.y+10*e.scalar,e.tiltSin=0,e.tiltCos=0,e.random=1):(e.wobble+=e.wobbleSpeed,e.wobbleX=e.shape.x+10*e.scalar*Math.cos(e.wobble),e.wobbleY=e.shape.y+10*e.scalar*Math.sin(e.wobble),e.tiltAngle+=.1,e.tiltSin=Math.sin(e.tiltAngle),e.tiltCos=Math.cos(e.tiltAngle),e.random=Math.random()+2);const s=e.tick++/e.totalTicks,n=e.shape.x+e.random*e.tiltCos,r=e.shape.y+e.random*e.tiltSin,a=e.wobbleX+e.random*e.tiltCos,o=e.wobbleY+e.random*e.tiltSin;return e.shape.setAttr("fill",e.color.setAlpha(1-s).toString()),e.shape.degree=lt(Math.PI/10*e.wobble),e.shape.scalarX=Math.abs(a-n)*.1,e.shape.scalarY=Math.abs(o-r)*.1,e.tick<e.totalTicks}))}}class Vn{shapes;constructor(t){this.shapes=t}run(t){this.shapes.forEach(s=>{s.run(),t?.wall&&s.checkWall({wall:t.wall,bounce:t.bounce})});const e=this.shapes.length;for(let s=0,n=e-1;s<n;s++)for(let r=s+1;r<e;r++)this.shapes[s].checkCollision(this.shapes[r])}gravitate(){const t=this.shapes.length;this.shapes.forEach((e,s)=>{e.run();for(let n=s+1;n<t;n++)e.checkCollision(this.shapes[n]),e.gravitateTo(this.shapes[n])})}springChain(t){this.shapes.forEach((e,s)=>{s>0&&e.runSpringTo(this.shapes[s-1],t)})}springConnect(t){const e=It(t?.springLength,100);this.shapes.forEach(s=>{s.isDragging||this.shapes.filter(n=>n.id!==s.id).forEach(n=>{const r=ge(s.x,s.y,n.x,n.y);s.runSpringTo({x:n.x-Math.cos(r)*e,y:n.y-Math.sin(r)*e},t)})})}springMass(t,e){const s=this.shapes.length,n=[];return this.shapes.forEach((r,a)=>{r.run(e),r.x>t.x+t.width?r.x=t.x:r.x<t.x&&(r.x=t.x+t.width),r.y>t.y+t.height?r.y=t.y:r.y<t.y&&(r.y=t.y+t.height);for(let o=a+1;o<s;o++)n.push([r.x,r.y,this.shapes[o].x,this.shapes[o].y,r.springMassTo(this.shapes[o],e)])}),n}polymorph(){if(this.shapes.length<2)throw new Error("shapes个数必须大于等于2");const t=this.shapes.length-1,e=new Array(t);for(let n=0;n<t;n++){const r=this.shapes[n].initPathD();this.shapes[n].frameStart();const a=this.shapes[n+1].initPathD();this.shapes[n+1].frameStart();const o=Math.max(r.polymorphPoints.length,a.polymorphPoints.length);e[n]=Pt.getPathInterpolator(r.expendFill(o),a.expendFill(o))}const s=new j({d:e[0](0)});return n=>{const r=jt(t*n,6),a=Math.min(Math.floor(r),t-1),o=jt(r-a,6);s.originD=e[a](o);const h=this.shapes[a].getAttr("fill","none"),c=this.shapes[a+1].getAttr("fill","none");typeof h=="string"&&typeof c=="string"&&s.setAttr("fill",Q.gradient(h,c,o).toString());const l=this.shapes[a].getAttr("stroke","none"),u=this.shapes[a+1].getAttr("stroke","none");return typeof l=="string"&&typeof u=="string"&&s.setAttr("stroke",Q.gradient(l,u,o).toString()),s}}polymorphGroup(){if(this.shapes.length<2)throw new Error("shapes个数必须大于等于2");let t=0,e;const s=[];this.shapes.forEach(o=>{let h;o instanceof ut?(h=o,h.sortPathD()):(h=new ut,h.addShape(o)),s.push(h),t<h.shapes.length&&(t=h.shapes.length,e=h)}),s.forEach(o=>{o!==e&&o.expendFill(e)});const n=[];s.forEach((o,h)=>{o.shapes.forEach((c,l)=>{n[l]=n[l]||[],n[l][h]=c})});const r=[];n.forEach(o=>{r.push(new Vn(o).polymorph())});const a=new ut;return r.forEach(o=>{a.addShape(o(0))}),o=>(r.forEach(h=>{h(o)}),a)}polymorphTween(t=6e3,e){const s=this.shapes.findIndex(o=>o instanceof ut)>=0?this.polymorphGroup():this.polymorph(),n=s(0),r=e?.onUpdate,a=new Js({frameDuration:t});a.addTween({t:0},{t:1},Object.assign(e||{},{onUpdate:(o,h)=>{s(o.t),r?.(o,h),e?.draw?.(n)}})),a.play()}static generatePointsShape(t,e,s,n){const r=[];for(let a=0;a<n;a++){const o=a/n*2*Math.PI,{dx:h,dy:c}=Wt(o,s);r.push({x:t+h,y:e+c})}return new Oo({points:r})}static generateRosettaShape(t,e,s,n,r){if(r==0)throw new Error("no dividing by zero, please");const a=[],o=360/r;for(let h=0;h<r;h+=1){const c=o*h*Math.PI/180,l=t+2*s*Math.cos(c),u=e+2*s*Math.sin(c);a.push(new gn({x:t,y:e,rx:s,ry:n,xAxisRotate:o*h,largeArcFlag:1,sweepFlag:1,toX:l,toY:u})),a.push(new gn({x:l,y:u,rx:s,ry:n,xAxisRotate:o*h,largeArcFlag:1,sweepFlag:1,toX:t,toY:e}))}return new j({d:Pt.fromLines(a)})}}const Yo={map:new Map,transform:function(i){if(Ea)return i;if(this.map.has(i))return this.map.get(i);const t=new OffscreenCanvas(i.width,i.height);return t.getContext("2d")?.drawImage(i,0,0),this.map.set(i,t),t},clear:function(){this.map.clear()}};function qd(i,t,e){const s=new OffscreenCanvas(i,t),n=s.getContext("2d");if(n)return e(n),s.transferToImageBitmap()}function jd(i,t,e){const s=i.createPattern(Yo.transform(t),"no-repeat");if(s){const n=Tn(e);s.setTransform(n),i.fillStyle=s}}function Uo(i){return window.URL.createObjectURL(i)}function Hd(i){return window.URL.revokeObjectURL(i)}const Xo=new Me;async function Vo(i,t=6e4){return new Promise((e,s)=>{const n=typeof i=="string"?i:Uo(i),r=Xo.get(n);if(r)return e(r);const a=document.createElement("img");a.onload=h=>{clearTimeout(o);const c=a.naturalWidth||a.width,l=a.naturalHeight||a.height,u={width:c,height:l,aspectRatio:c/l,element:a,imageData:po(a)};Xo.set(n,u),e(u),a.onerror=a.onload=null},a.onerror=h=>{clearTimeout(o),s(h)},a.src=n;const o=setTimeout(()=>{s("Timeout!")},t)})}async function Gn(i=Dt.text,t=["*"]){const s=(await Zi(t))[0],n=await is(s,i);return{type:s.type,name:s.name,size:s.size,data:n}}async function Wd(i=["image/*"]){const e=(await Zi(i))[0];if(!e.type.match(/image\/*/))return new Error("Not Image Type!");const s=await is(e,Dt.arraybuffer),n=Di(s),r=await Vo(n);return{type:e.type,name:e.name,size:e.size,data:s,width:r.width,height:r.height,aspectRatio:r.aspectRatio,imageData:r.imageData}}function $d(i,t){const e=t.ctrl||!1,s=t.shift||!1,n=t.alt||!1;return(e===i.metaKey||e===i.ctrlKey)&&s===i.shiftKey&&n===i.altKey&&t.keys.map(r=>r.toLowerCase()).includes(i.key.toLowerCase())}function qn(i,t,e){const s=i.target||document||window;let n=!1,r=!1;const a=B(s,"keydown",async h=>{r||(n=$d(h,i),n&&(h.stopPropagation(),h.preventDefault(),await t()))}),o=B(s,"keyup",async h=>{r||n&&e&&(h.stopPropagation(),h.preventDefault(),await e())});return{hotKeys:function(h){const c=[];return h.ctrl&&c.push(tn()?"Cmd":"Ctrl"),h.shift&&c.push("Shift"),h.alt&&c.push("Alt"),c.push(...h.keys),c},destroy:()=>{a(),o()},pause:()=>r=!0,resume:()=>r=!1}}const Jd={BACKSPACE:8,TAB:9,COMMA:188,DELETE:46,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,UP:38,DOWN:40,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32};function Zd(i){if(i.key)return i.key;if(i.keyCode)return i.keyCode;if(i.which)return i.which}async function Kd(i={keys:["o"]},t=Dt.text){const e=Zh(),s=qn(i,async()=>{try{e.resolve(await Gn(t))}catch(n){e.reject(n)}s.destroy()},()=>{});return await e.promise}function Qd(i={keys:["o"]},t=Dt.text){const e=new Xe;return qn(i,async()=>{try{e.emit("file",await Gn(t))}catch{}},()=>{}),{on:s=>{e.on("file",s)},off:s=>{e.off("file",s)}}}async function tm(i,t=6e4){return new Promise((e,s)=>{const n=document.createElement("script");n.type="text/javascript",n.async=!1,n.onload=a=>{clearTimeout(r),e(a),n.onerror=n.onload=null},n.onerror=a=>{clearTimeout(r),s(a)},n.src=i;const r=setTimeout(()=>{s("Timeout!")},t);document.body.appendChild(n)})}async function em(i,t=document.getElementsByTagName("head")[0],e=6e4){return new Promise((s,n)=>{const r=document.createElement("link");r.setAttribute("type","text/css"),r.setAttribute("rel","stylesheet"),r.onload=o=>{clearTimeout(a),s(o),r.onerror=r.onload=null},r.onerror=o=>{clearTimeout(a),n(o)},r.setAttribute("href",i);const a=setTimeout(()=>{n("Timeout!")},e);t.appendChild(r)})}function sm(){return new Promise(i=>{const t=Array.from(document.querySelectorAll("link[rel=stylesheet]"));let e=document.styleSheets.length||0;const s=()=>e>=t.length?(i(),!0):!1;s()||t.forEach(n=>{n.onload=()=>{e+=1,s()}})})}function jn(i,t){const e=document.createElement("a");e.style.visibility="hidden",e.download=t,typeof i=="string"?e.href=i:e.href=window.URL.createObjectURL(i),e.click()}const Hn=new Me;async function Go(i,t){if(typeof fetch>"u")throw new Error("fetch() not supported!");if(typeof AbortController>"u")throw new Error("AbortController not supported!");const e=di(i,t),s=new AbortController;Hn.set(e,s);const{responseType:n,onProgress:r,timeout:a}={responseType:"json",timeout:6e4,...t},o=setTimeout(()=>{throw s.abort(),new Error(`${a} ms Timeout!`)},a);let h=await fetch(new Request(i,{...t,signal:s.signal}));if(Hn.delete(e),clearTimeout(o),h.status===200||h.status===0){if(h.status===0&&console.warn("useFetch: HTTP Status 0 received."),typeof ReadableStream<"u"&&h.body!==void 0&&h.body?.getReader!==void 0&&r){const c=h.body.getReader(),l=h.headers.get("X-File-Size")||h.headers.get("Content-Length"),u=l?parseInt(l):0,f=u!==0;let m=0;const g=new ReadableStream({start(C){function v(){c.read().then(({done:b,value:S})=>{b?C.close():(m+=S.byteLength,r?.(new ProgressEvent("progress",{lengthComputable:f,loaded:m,total:u})),C.enqueue(S),v())}).catch(b=>{C.error(b)})}v()}});h=new Response(g)}switch(n){case"arraybuffer":return[h.arrayBuffer(),h];case"blob":return[h.blob(),h];case"json":return[h.json(),h];case"text":default:return[h.text(),h]}}else throw new lr(`useFetch for "${h.url}" responded with ${h.status}: ${h.statusText}`,h)}const qo=new Me,Wn=new Me;async function im(i,t){const e=di(i,t);try{const s=qo.get(e);if(s)return s;const n=Wn.get(e);if(n)return await n;const r=Go(i,t);Wn.set(e,r);const a=await r;return qo.set(e,a),Wn.delete(e),a}catch{}}function nm(i,t){const e=Hn.get(di(i,t));e&&e.abort()}function di(i,t){return JSON.stringify({url:i,...t})}function rm(i,t,e){if(typeof t=="string"&&(t=pr(t)),(typeof t=="string"||t===void 0)&&e===void 0){const s=Object.assign({},i.dataset);return Object.keys(s).forEach(n=>{if(s[n]?.startsWith("[")||s[n]?.startsWith("{"))try{s[n]=JSON.parse(s[n]||"")}catch{}}),typeof t=="string"?s[t]:s}else{let s={};typeof t=="object"?s=t:typeof t=="string"&&(s[t]=e),Object.entries(s).forEach(([n,r])=>{r?i.dataset[n]=r instanceof Object?JSON.stringify(r):r:delete i.dataset[n]})}}function am(i,t){t.split(/[,\s]+/).forEach(e=>{e.trim()!=""&&delete i.dataset[e.trim()]})}function $n(i,t,e="toggle"){const s=t.split(/[,\s]+/);if(i.classList)s.forEach(n=>{const r=n.trim();r!==""&&i.classList[e](r)});else{const n=i.className.split(/ +/);let r=!1;s.forEach(a=>{const o=a.trim();if(o!==""){const h=n.indexOf(o);switch(e){case"add":h===-1&&(n.push(o),r=!0);break;case"remove":h!==-1&&(n.splice(h,1),r=!0);break;case"toggle":h===-1?n.push(o):n.splice(h,1),r=!0;break}}}),r&&ye(i,"class",n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}}function om(i,t){$n(i,t,"add")}function hm(i,t){$n(i,t,"remove")}function cm(i,t){return new RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(i.className)||!1}function lm(i,t){De(i,"display")=="none"&&t===void 0||t===!0?jo(i):Ho(i)}function jo(i){_n(i,"display",i instanceof HTMLTableRowElement?"table-row":i instanceof HTMLTableCellElement?"table-cell":"block")}function Ho(i){_n(i,"display","none")}function he(i){return{el:i,isRoot:()=>/(html|body)/i.test(i.tagName)||i===document.documentElement,isActive:()=>i===document.activeElement&&(i.type||i.href),getRemSize:function(){return parseFloat(getComputedStyle(document.documentElement).fontSize)},rem2px:function(t){return t*this.getRemSize()},getEmSize:function(){return i.parentElement?parseFloat(getComputedStyle(i.parentElement).fontSize):this.getRemSize()},nearestElement:()=>{let t=i;for(;t&&t.nodeType!==1&&t.parentElement;)t=t.parentElement;return t},parent:()=>i.parentElement,parents:function(t=i,e=[]){return!t||t.parentElement===null?e:this.parents(t.parentElement,e.concat([t]))},scrollParent:function(){const t=this.parents();for(let e=0,s=t.length;e<s;e++)if(/(auto|scroll)/.test(De(t[e],"overflow")+De(t[e],"overflow-y")+De(t[e],"overflow-x")))return t[e];return document.scrollingElement||document.documentElement},contains:t=>i.contains?i!=t&&i.contains(t):!!(i.compareDocumentPosition(t)&16),siblings:()=>Array.prototype.slice.call(i.parentElement?.children).filter(t=>t!==i),nextElementSibling:()=>i.nextElementSibling,previousElementSibling:()=>i.previousElementSibling,closest:t=>i.closest(t),shadowRoot:()=>i.shadowRoot,isInput:()=>i.tagName==="INPUT"||i instanceof HTMLInputElement,isSelect:()=>i.tagName==="SELECT"||i instanceof HTMLSelectElement,isTextArea:()=>i.tagName==="TEXTAREA"||i instanceof HTMLTextAreaElement,isInputCheckbox:function(){return this.isInput(i)&&i.getAttribute("type")==="checkbox"},isInputRadio:function(){return this.isInput(i)&&i.getAttribute("type")==="radio"},isInputText:function(){return this.isInput(i)&&i.getAttribute("type")==="text"},isInputNumber:function(){return this.isInput(i)&&i.getAttribute("type")==="number"},changeSelected:function(t){if(this.isSelect()){const e=i.options;for(let s=0,n=e.length;s<n;s++)e[s].selected=e[s].value==t}},changeRadioChecked:function(t){if(this.isInputRadio()){const e=document.getElementsByName(i.name);for(let s=0,n=e.length;s<n;s++){const r=e[s];r.checked=r.value==t}}},changeCheckboxChecked:function(t){this.isInputCheckbox()&&(i.checked=t)},insert:(t,e="append")=>{typeof t=="string"?i[e](Wo(t)):i[e](t)},html:function(t){if(typeof t=="string"){i.innerHTML=t;const e=$o(i);e!=i&&(i=e)}else this.insert(t,"replaceWith")},empty:function(){this.html("")},text:t=>{i.textContent=t},getInnerText:()=>{if(i instanceof SVGElement)return"";let t=i.innerText;if(!t){const e=i.querySelector("slot")?.assignedNodes()||[];let s=0;for(;!t&&s<=e.length-1;)"innerText"in e[s]&&(t=e[s].innerText),s++}return t},remove:()=>i.remove()}}function Wo(i,t=!1){const e=document.createElement("template");return e.innerHTML=i,t&&e.content.childNodes.forEach(s=>{const n=$o(s);n!=s&&e.content.replaceChild(n,s)}),e.content}function um(i){return document.createElement.call(document,i)}function fm(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function dm(i){return document.createTextNode.call(document,i)}function $o(i){return i.tagName=="SCRIPT"&&(i=Jo(i)),i.querySelectorAll&&i.querySelectorAll("script").forEach(t=>{t.parentNode?.replaceChild(Jo(t),t)}),i}function Jo(i){const t=i.ownerDocument.createElement("script");t.text=i.text;const e=i.attributes;for(let s=0,n=e.length;s<n;s++)t.setAttribute(e[s].name,e[s].value);return t}function mm(i){return{shadowRoot:()=>{let t=i;for(;t;){const e=i.parentElement||i.parentNode;if(e)t=e;else break}return t}}}function gm(i,t="http://test.com/localstorage.html"){const e=document.createElement("iframe");e.src=t,document.body.append(e),setTimeout(function(){e.contentWindow?.postMessage(i,t)},4e3),setTimeout(function(){e.remove()},6e3)}async function pm(i){if(navigator.clipboard)return await navigator.clipboard.writeText(i);{const t=document.createElement("textarea");return t.value=i,t.style.opacity="0",t.style.position="fixed",t.style.top="0",t.style.left="0",t.focus(),t.select(),document.execCommand("copy")}}function ym(){return"geolocation"in navigator?new Promise((i,t)=>{navigator.geolocation.getCurrentPosition(e=>{const s=e.coords.latitude,n=e.coords.longitude;i({latitude:s,longitude:n})},e=>{t(e)})}):Promise.reject("Geolocation is not available.")}function wm(i=200){"vibrate"in navigator?window.navigator.vibrate(i):console.error("Your device is not support vibrate on this browser.")}function xm(i){const t=new Proxy(window,{get(e,s,n){if(typeof s=="string"&&["open","location","document"].includes(s))throw new Error(`禁止访问 key: ${s}`);return s==="window"?t:Reflect.get(e,s,n)},set(e,s,n,r){return Reflect.set(e,s,n,r)}});new Function("window",`with(window) { ${i} }`)(t,null)}const bm={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:(i,t)=>{switch(t){case"W":return`${i}周`;default:return`${i}日`}},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:(i,t)=>{const e=i*100+t;return e<600?"凌晨":e<900?"早上":e<1100?"上午":e<1300?"中午":e<1800?"下午":"晚上"}},Sm={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:i=>{const t=["th","st","nd","rd"],e=i%100;return`[${i}${t[(e-20)%10]||t[e]||t[0]}]`}},ve=new Me;let mi="zh-cn";Jn(Sm),Jn(bm);function Jn(i,t){if(!i)return ve.get(mi);let e;if(typeof i=="string"){const s=i.toLowerCase();if(ve.get(s))e=s;else if(t)ve.set(s,t),e=s;else return ve.get(mi)}else{const{name:s}=i;ve.set(s,i),e=s}return e&&(mi=e),ve.get(e)||ve.get(mi)}function Be(i,t={},e=[],s){return{tag:i,props:t,children:e,el:s}}function gi(i){return Be(i.tagName,En(i),Array.from(i.children).map(t=>gi(t)),i)}function Je(i,t=document.documentElement){if(i.el)return i.el;if(i.el=document.createElement(i.tag),i.props)for(const e in i.props){const s=i.props[e];e.startsWith("on")?i.el.addEventListener(e.slice(2).toLowerCase(),s):e==="style"?ai(i.el,i.props[e]):He(i.el,e,s)}return i.children&&(typeof i.children=="string"?i.el.appendChild(document.createTextNode(i.children)):i.children.forEach(e=>{Je(e,i.el)})),t.appendChild(i.el),i.el}function pi(i,t){if(!i.el)return;if(i.tag!==t.tag){(i.el.parentElement||document.body).replaceChild(Je(t),i.el);return}const e=t.el=i.el,s=i.props,n=t.props;for(const o in s)o in n||(o.startsWith("on")?e.removeEventListener(o.slice(2).toLowerCase(),s[o]):e.removeAttribute(o));for(const o in n){const h=s[o],c=n[o];if(c!=h)if(o.startsWith("on")){const l=o.slice(2).toLowerCase();e.removeEventListener(l,h),e.addEventListener(l,c)}else if(o==="style"){for(const l in h)l in c||Mn(e,l);ai(e,c)}else He(e,o,c)}const r=i.children||[],a=t.children||[];if(typeof a=="string")e.innerHTML=a;else if(typeof r=="string")e.innerHTML="",a.forEach(o=>{Je(o,e)});else{const o=Math.min(r.length,a.length);for(let h=0;h<o;h++)pi(r[h],a[h]);a.length>r.length&&a.slice(r.length).forEach(h=>{Je(h,e)}),a.length<r.length&&r.slice(a.length).forEach(h=>{h.el&&e.removeChild(h.el)})}}class Cm{state;el;constructor(t,e){this.state=Pr(t,!0),this.el=e,this.compile(this.el)}compile(t){t.childNodes.forEach(e=>{switch(e.nodeType){case 1:const s=e;[...s.attributes].forEach(o=>{const h=o.name,c=o.value;if(h==="v-model")if(he(s).isInputRadio()){const l=s;xt(()=>{l.checked=this.getStateValue(c)==l.value}),l.addEventListener("change",u=>{this.setStateValue(c,u.target.value)})}else if(he(s).isInputCheckbox()){const l=s;xt(()=>{l.checked=Sr(this.getStateValue(c),l.value)}),l.addEventListener("change",u=>{const f=u.target,m=f.value;f.checked?Lh(this.getStateValue(c),m):Pe(this.getStateValue(c),m)})}else if(he(s).isSelect()){const l=s;xt(()=>{l.value=this.getStateValue(c)}),l.addEventListener("change",u=>{this.setStateValue(c,u.target.value)})}else{const l=s;xt(()=>{l.value=this.getStateValue(c)});const u=f=>{this.setStateValue(c,f.target.value)};l.addEventListener("input",u)}else h==="v-text"?xt(()=>{s.innerText=this.getStateValue(c)}):h==="v-html"&&xt(()=>{s.innerHTML=this.getStateValue(c)})}),s.childNodes.length>0&&this.compile(s);break;case 3:const n=e.textContent||"",r=/\{\{\s*([^{}\s]+)\s*\}\}/g,a=r.exec(n);a&&a[1]&&xt(()=>{e.textContent=n.replace(r,this.getStateValue(a[1]))});break}})}getStateValue(t){let e=this.state;return t.split(".").forEach(s=>{e=e[s]}),e}setStateValue(t,e){let s=this.state;const n=t.split("."),r=n.length;for(let a=0;a<r-1;a++)s=s[n[a]];s[n[r-1]]=e}static compileTemplate(t){return t=t.replace(/<%=(.+?)%>/g,"`); \n echo( $1 ); \n echo(`").replace(/<%([\s\S]+?)%>/g,"`); \n $1 \n echo(`"),t="echo(`"+t+"`);",`(function parse(data){
|