aha-components 1.7.5 → 1.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Loading.esm.js +1 -1
- package/dist/Loading.esm.js.map +1 -1
- package/dist/Loading.js +1 -1
- package/dist/Loading.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/Loading.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t,jsxs as r}from"react/jsx-runtime";import{useState as
|
|
1
|
+
import{jsx as t,jsxs as r}from"react/jsx-runtime";import{useState as i,useRef as e,useEffect as a}from"react";var o={name:"Thinking Five",tag:"Custom Rose Trail",rotate:!0,particleCount:62,trailSpan:.38,durationMs:3900,rotationDurationMs:28e3,pulseDurationMs:3e3,strokeWidth:5.5,baseRadius:7,detailAmplitude:3,petalCount:5,curveScale:3};function n(t,r,i){var e=t*Math.PI*2,a=Math.round(i.petalCount),o=i.baseRadius*Math.cos(e)-i.detailAmplitude*r*Math.cos(a*e),n=i.baseRadius*Math.sin(e)-i.detailAmplitude*r*Math.sin(a*e);return{x:50+o*i.curveScale,y:50+n*i.curveScale}}function u(t,r,i,e){var a=t/Math.max(1,e.particleCount-1),o=n(function(t){return(t%1+1)%1}(r-a*e.trailSpan),i,e),u=Math.pow(1-a,.56);return{x:o.x,y:o.y,radius:.9+2.7*u,opacity:.04+.96*u}}var c=function(c){var l=c.width,s=void 0===l?80:l,d=c.height,h=void 0===d?80:d,p=c.strokeWidth,v=c.color,m=void 0===v?"var(--theme-color, #5A31F0)":v,M=c.className,f=i(0),y=f[0],x=f[1],k=e(null);a(function(){var t,r=function(i){null===k.current&&(k.current=i),x(i-k.current),t=requestAnimationFrame(r)};return t=requestAnimationFrame(r),function(){return cancelAnimationFrame(t)}},[]);for(var g,A,C=y,F=(A=C%(g=o).pulseDurationMs/g.pulseDurationMs*Math.PI*2,.52+(Math.sin(A+.55)+1)/2*.48),b=C%o.durationMs/o.durationMs,w=function(t,r){return r.rotate?-t%r.rotationDurationMs/r.rotationDurationMs*360:0}(C,o),D=null!=p?p:o.strokeWidth,R=D/o.strokeWidth,S=function(t,r,i){void 0===i&&(i=480);for(var e=[],a=0;a<=i;a+=1){var o=n(a/i,t,r);e.push("".concat(0===a?"M":"L"," ").concat(o.x.toFixed(2)," ").concat(o.y.toFixed(2)))}return e.join(" ")}(F,o),W=[],L=0;L<o.particleCount;L+=1){var j=u(L,b,F,o);W.push({cx:j.x,cy:j.y,opacity:j.opacity,r:j.radius*R})}return t("div",{className:M,style:{width:s,height:h,display:"inline-block",color:m},role:"status","aria-label":"Loading",children:r("svg",{width:"100%",height:"100%",viewBox:"0 0 100 100",fill:"none",preserveAspectRatio:"xMidYMid meet",style:{overflow:"visible"},children:[t("title",{children:"Thinking Five"}),r("g",{transform:"rotate(".concat(w," 50 50)"),children:[t("path",{d:S,stroke:"currentColor",strokeWidth:D,strokeLinecap:"round",strokeLinejoin:"round",fill:"none",opacity:.1}),W.map(function(r,i){return t("circle",{cx:r.cx,cy:r.cy,r:r.r,fill:"currentColor",opacity:r.opacity},i)})]})]})})};export{c as default};
|
|
2
2
|
//# sourceMappingURL=Loading.esm.js.map
|
package/dist/Loading.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loading.esm.js","sources":["../src/components/Loading/index.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\n\nconst curve = {\n name: 'Thinking Five',\n tag: 'Custom Rose Trail',\n rotate: true,\n particleCount:
|
|
1
|
+
{"version":3,"file":"Loading.esm.js","sources":["../src/components/Loading/index.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\n\nconst curve = {\n name: 'Thinking Five',\n tag: 'Custom Rose Trail',\n rotate: true,\n particleCount: 62,\n trailSpan: 0.38,\n durationMs: 3900,\n rotationDurationMs: 28000,\n pulseDurationMs: 3000,\n strokeWidth: 5.5,\n baseRadius: 7,\n detailAmplitude: 3,\n petalCount: 5,\n curveScale: 3,\n} as const;\n\ntype CurveConfig = typeof curve;\n\nfunction point(\n progress: number,\n detailScaleValue: number,\n config: CurveConfig\n): { x: number; y: number } {\n const t = progress * Math.PI * 2;\n const petals = Math.round(config.petalCount);\n const x =\n config.baseRadius * Math.cos(t) -\n config.detailAmplitude * detailScaleValue * Math.cos(petals * t);\n const y =\n config.baseRadius * Math.sin(t) -\n config.detailAmplitude * detailScaleValue * Math.sin(petals * t);\n return {\n x: 50 + x * config.curveScale,\n y: 50 + y * config.curveScale,\n };\n}\n\nfunction getDetailScale(elapsedMs: number, config: CurveConfig): number {\n const pulseProgress =\n (elapsedMs % config.pulseDurationMs) / config.pulseDurationMs;\n const pulseAngle = pulseProgress * Math.PI * 2;\n return 0.52 + ((Math.sin(pulseAngle + 0.55) + 1) / 2) * 0.48;\n}\n\nfunction normalizeProgress(progress: number): number {\n return ((progress % 1) + 1) % 1;\n}\n\nfunction buildPath(detailScaleValue: number, config: CurveConfig, steps = 480): string {\n const parts: string[] = [];\n for (let index = 0; index <= steps; index += 1) {\n const p = point(index / steps, detailScaleValue, config);\n parts.push(`${index === 0 ? 'M' : 'L'} ${p.x.toFixed(2)} ${p.y.toFixed(2)}`);\n }\n return parts.join(' ');\n}\n\nfunction getParticle(\n index: number,\n progress: number,\n detailScaleValue: number,\n config: CurveConfig\n): { x: number; y: number; radius: number; opacity: number } {\n const denom = Math.max(1, config.particleCount - 1);\n const tailOffset = index / denom;\n const p = point(\n normalizeProgress(progress - tailOffset * config.trailSpan),\n detailScaleValue,\n config\n );\n const fade = Math.pow(1 - tailOffset, 0.56);\n return {\n x: p.x,\n y: p.y,\n radius: 0.9 + fade * 2.7,\n opacity: 0.04 + fade * 0.96,\n };\n}\n\nfunction getRotationDeg(elapsedMs: number, config: CurveConfig): number {\n if (!config.rotate) return 0;\n return -(\n ((elapsedMs % config.rotationDurationMs) / config.rotationDurationMs) *\n 360\n );\n}\n\nexport interface LoadingProps {\n width?: number | string;\n height?: number | string;\n strokeWidth?: number;\n color?: string;\n className?: string;\n}\n\nconst Loading: React.FC<LoadingProps> = ({\n width = 80,\n height = 80,\n strokeWidth: strokeWidthProp,\n color = 'var(--theme-color, #5A31F0)',\n className,\n}) => {\n const [frame, setFrame] = useState(0);\n const startRef = useRef<number | null>(null);\n\n useEffect(() => {\n let id: number;\n const tick = (now: number) => {\n if (startRef.current === null) {\n startRef.current = now;\n }\n setFrame(now - startRef.current);\n id = requestAnimationFrame(tick);\n };\n id = requestAnimationFrame(tick);\n return () => cancelAnimationFrame(id);\n }, []);\n\n const elapsed = frame;\n const s = getDetailScale(elapsed, curve);\n const progress = (elapsed % curve.durationMs) / curve.durationMs;\n const rotationDeg = getRotationDeg(elapsed, curve);\n const lineWeight = strokeWidthProp ?? curve.strokeWidth;\n const strokeScale = lineWeight / curve.strokeWidth;\n\n const pathD = buildPath(s, curve);\n\n const particles: { cx: number; cy: number; opacity: number; r: number }[] =\n [];\n for (let i = 0; i < curve.particleCount; i += 1) {\n const pt = getParticle(i, progress, s, curve);\n particles.push({\n cx: pt.x,\n cy: pt.y,\n opacity: pt.opacity,\n r: pt.radius * strokeScale,\n });\n }\n\n return (\n <div\n className={className}\n style={{\n width,\n height,\n display: 'inline-block',\n color,\n }}\n role=\"status\"\n aria-label=\"Loading\"\n >\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox=\"0 0 100 100\"\n fill=\"none\"\n preserveAspectRatio=\"xMidYMid meet\"\n style={{ overflow: 'visible' }}\n >\n <title>Thinking Five</title>\n <g transform={curve.rotate ? `rotate(${rotationDeg} 50 50)` : undefined}>\n <path\n d={pathD}\n stroke=\"currentColor\"\n strokeWidth={lineWeight}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n fill=\"none\"\n opacity={0.1}\n />\n {particles.map((pt, i) => (\n <circle\n key={i}\n cx={pt.cx}\n cy={pt.cy}\n r={pt.r}\n fill=\"currentColor\"\n opacity={pt.opacity}\n />\n ))}\n </g>\n </svg>\n </div>\n );\n};\n\nexport default Loading;\n"],"names":["curve","name","tag","rotate","particleCount","trailSpan","durationMs","rotationDurationMs","pulseDurationMs","strokeWidth","baseRadius","detailAmplitude","petalCount","curveScale","point","progress","detailScaleValue","config","t","Math","PI","petals","round","x","cos","y","sin","getParticle","index","tailOffset","max","p","normalizeProgress","fade","pow","radius","opacity","Loading","_a","_b","width","_c","height","strokeWidthProp","_d","color","className","_e","useState","frame","setFrame","startRef","useRef","useEffect","id","tick","now","current","requestAnimationFrame","cancelAnimationFrame","pulseAngle","elapsed","s","rotationDeg","elapsedMs","getRotationDeg","lineWeight","strokeScale","pathD","steps","parts","push","concat","toFixed","join","buildPath","particles","i","pt","cx","cy","r","_jsx","style","display","role","children","_jsxs","viewBox","fill","preserveAspectRatio","overflow","transform","d","stroke","strokeLinecap","strokeLinejoin","map"],"mappings":"8GAEA,IAAMA,EAAQ,CACZC,KAAM,gBACNC,IAAK,oBACLC,QAAQ,EACRC,cAAe,GACfC,UAAW,IACXC,WAAY,KACZC,mBAAoB,KACpBC,gBAAiB,IACjBC,YAAa,IACbC,WAAY,EACZC,gBAAiB,EACjBC,WAAY,EACZC,WAAY,GAKd,SAASC,EACPC,EACAC,EACAC,GAEA,IAAMC,EAAIH,EAAWI,KAAKC,GAAK,EACzBC,EAASF,KAAKG,MAAML,EAAOL,YAC3BW,EACJN,EAAOP,WAAaS,KAAKK,IAAIN,GAC7BD,EAAON,gBAAkBK,EAAmBG,KAAKK,IAAIH,EAASH,GAC1DO,EACJR,EAAOP,WAAaS,KAAKO,IAAIR,GAC7BD,EAAON,gBAAkBK,EAAmBG,KAAKO,IAAIL,EAASH,GAChE,MAAO,CACLK,EAAG,GAAKA,EAAIN,EAAOJ,WACnBY,EAAG,GAAKA,EAAIR,EAAOJ,WAEvB,CAsBA,SAASc,EACPC,EACAb,EACAC,EACAC,GAEA,IACMY,EAAa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EAAID,GAAM,OACxBK,EAAA,SAAA,CAEEH,GAAID,EAAGC,GACPC,GAAIF,EAAGE,GACPC,EAAGH,EAAGG,EACNQ,KAAK,eACLrD,QAAS0C,EAAG1C,SALPyC,EAFiB,UAcpC"}
|
package/dist/Loading.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react/jsx-runtime"),e=require("react"),r={name:"Thinking Five",tag:"Custom Rose Trail",rotate:!0,particleCount:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react/jsx-runtime"),e=require("react"),r={name:"Thinking Five",tag:"Custom Rose Trail",rotate:!0,particleCount:62,trailSpan:.38,durationMs:3900,rotationDurationMs:28e3,pulseDurationMs:3e3,strokeWidth:5.5,baseRadius:7,detailAmplitude:3,petalCount:5,curveScale:3};function i(t,e,r){var i=t*Math.PI*2,a=Math.round(r.petalCount),n=r.baseRadius*Math.cos(i)-r.detailAmplitude*e*Math.cos(a*i),o=r.baseRadius*Math.sin(i)-r.detailAmplitude*e*Math.sin(a*i);return{x:50+n*r.curveScale,y:50+o*r.curveScale}}function a(t,e,r,a){var n=t/Math.max(1,a.particleCount-1),o=i(function(t){return(t%1+1)%1}(e-n*a.trailSpan),r,a),u=Math.pow(1-n,.56);return{x:o.x,y:o.y,radius:.9+2.7*u,opacity:.04+.96*u}}exports.default=function(n){var o=n.width,u=void 0===o?80:o,s=n.height,c=void 0===s?80:s,l=n.strokeWidth,d=n.color,h=void 0===d?"var(--theme-color, #5A31F0)":d,p=n.className,v=e.useState(0),M=v[0],f=v[1],x=e.useRef(null);e.useEffect(function(){var t,e=function(r){null===x.current&&(x.current=r),f(r-x.current),t=requestAnimationFrame(e)};return t=requestAnimationFrame(e),function(){return cancelAnimationFrame(t)}},[]);for(var m,y,k=M,j=(y=k%(m=r).pulseDurationMs/m.pulseDurationMs*Math.PI*2,.52+(Math.sin(y+.55)+1)/2*.48),g=k%r.durationMs/r.durationMs,A=function(t,e){return e.rotate?-t%e.rotationDurationMs/e.rotationDurationMs*360:0}(k,r),C=null!=l?l:r.strokeWidth,F=C/r.strokeWidth,b=function(t,e,r){void 0===r&&(r=480);for(var a=[],n=0;n<=r;n+=1){var o=i(n/r,t,e);a.push("".concat(0===n?"M":"L"," ").concat(o.x.toFixed(2)," ").concat(o.y.toFixed(2)))}return a.join(" ")}(j,r),w=[],D=0;D<r.particleCount;D+=1){var R=a(D,g,j,r);w.push({cx:R.x,cy:R.y,opacity:R.opacity,r:R.radius*F})}return t.jsx("div",{className:p,style:{width:u,height:c,display:"inline-block",color:h},role:"status","aria-label":"Loading",children:t.jsxs("svg",{width:"100%",height:"100%",viewBox:"0 0 100 100",fill:"none",preserveAspectRatio:"xMidYMid meet",style:{overflow:"visible"},children:[t.jsx("title",{children:"Thinking Five"}),t.jsxs("g",{transform:"rotate(".concat(A," 50 50)"),children:[t.jsx("path",{d:b,stroke:"currentColor",strokeWidth:C,strokeLinecap:"round",strokeLinejoin:"round",fill:"none",opacity:.1}),w.map(function(e,r){return t.jsx("circle",{cx:e.cx,cy:e.cy,r:e.r,fill:"currentColor",opacity:e.opacity},r)})]})]})})};
|
|
2
2
|
//# sourceMappingURL=Loading.js.map
|
package/dist/Loading.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loading.js","sources":["../src/components/Loading/index.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\n\nconst curve = {\n name: 'Thinking Five',\n tag: 'Custom Rose Trail',\n rotate: true,\n particleCount:
|
|
1
|
+
{"version":3,"file":"Loading.js","sources":["../src/components/Loading/index.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\n\nconst curve = {\n name: 'Thinking Five',\n tag: 'Custom Rose Trail',\n rotate: true,\n particleCount: 62,\n trailSpan: 0.38,\n durationMs: 3900,\n rotationDurationMs: 28000,\n pulseDurationMs: 3000,\n strokeWidth: 5.5,\n baseRadius: 7,\n detailAmplitude: 3,\n petalCount: 5,\n curveScale: 3,\n} as const;\n\ntype CurveConfig = typeof curve;\n\nfunction point(\n progress: number,\n detailScaleValue: number,\n config: CurveConfig\n): { x: number; y: number } {\n const t = progress * Math.PI * 2;\n const petals = Math.round(config.petalCount);\n const x =\n config.baseRadius * Math.cos(t) -\n config.detailAmplitude * detailScaleValue * Math.cos(petals * t);\n const y =\n config.baseRadius * Math.sin(t) -\n config.detailAmplitude * detailScaleValue * Math.sin(petals * t);\n return {\n x: 50 + x * config.curveScale,\n y: 50 + y * config.curveScale,\n };\n}\n\nfunction getDetailScale(elapsedMs: number, config: CurveConfig): number {\n const pulseProgress =\n (elapsedMs % config.pulseDurationMs) / config.pulseDurationMs;\n const pulseAngle = pulseProgress * Math.PI * 2;\n return 0.52 + ((Math.sin(pulseAngle + 0.55) + 1) / 2) * 0.48;\n}\n\nfunction normalizeProgress(progress: number): number {\n return ((progress % 1) + 1) % 1;\n}\n\nfunction buildPath(detailScaleValue: number, config: CurveConfig, steps = 480): string {\n const parts: string[] = [];\n for (let index = 0; index <= steps; index += 1) {\n const p = point(index / steps, detailScaleValue, config);\n parts.push(`${index === 0 ? 'M' : 'L'} ${p.x.toFixed(2)} ${p.y.toFixed(2)}`);\n }\n return parts.join(' ');\n}\n\nfunction getParticle(\n index: number,\n progress: number,\n detailScaleValue: number,\n config: CurveConfig\n): { x: number; y: number; radius: number; opacity: number } {\n const denom = Math.max(1, config.particleCount - 1);\n const tailOffset = index / denom;\n const p = point(\n normalizeProgress(progress - tailOffset * config.trailSpan),\n detailScaleValue,\n config\n );\n const fade = Math.pow(1 - tailOffset, 0.56);\n return {\n x: p.x,\n y: p.y,\n radius: 0.9 + fade * 2.7,\n opacity: 0.04 + fade * 0.96,\n };\n}\n\nfunction getRotationDeg(elapsedMs: number, config: CurveConfig): number {\n if (!config.rotate) return 0;\n return -(\n ((elapsedMs % config.rotationDurationMs) / config.rotationDurationMs) *\n 360\n );\n}\n\nexport interface LoadingProps {\n width?: number | string;\n height?: number | string;\n strokeWidth?: number;\n color?: string;\n className?: string;\n}\n\nconst Loading: React.FC<LoadingProps> = ({\n width = 80,\n height = 80,\n strokeWidth: strokeWidthProp,\n color = 'var(--theme-color, #5A31F0)',\n className,\n}) => {\n const [frame, setFrame] = useState(0);\n const startRef = useRef<number | null>(null);\n\n useEffect(() => {\n let id: number;\n const tick = (now: number) => {\n if (startRef.current === null) {\n startRef.current = now;\n }\n setFrame(now - startRef.current);\n id = requestAnimationFrame(tick);\n };\n id = requestAnimationFrame(tick);\n return () => cancelAnimationFrame(id);\n }, []);\n\n const elapsed = frame;\n const s = getDetailScale(elapsed, curve);\n const progress = (elapsed % curve.durationMs) / curve.durationMs;\n const rotationDeg = getRotationDeg(elapsed, curve);\n const lineWeight = strokeWidthProp ?? curve.strokeWidth;\n const strokeScale = lineWeight / curve.strokeWidth;\n\n const pathD = buildPath(s, curve);\n\n const particles: { cx: number; cy: number; opacity: number; r: number }[] =\n [];\n for (let i = 0; i < curve.particleCount; i += 1) {\n const pt = getParticle(i, progress, s, curve);\n particles.push({\n cx: pt.x,\n cy: pt.y,\n opacity: pt.opacity,\n r: pt.radius * strokeScale,\n });\n }\n\n return (\n <div\n className={className}\n style={{\n width,\n height,\n display: 'inline-block',\n color,\n }}\n role=\"status\"\n aria-label=\"Loading\"\n >\n <svg\n width=\"100%\"\n height=\"100%\"\n viewBox=\"0 0 100 100\"\n fill=\"none\"\n preserveAspectRatio=\"xMidYMid meet\"\n style={{ overflow: 'visible' }}\n >\n <title>Thinking Five</title>\n <g transform={curve.rotate ? `rotate(${rotationDeg} 50 50)` : undefined}>\n <path\n d={pathD}\n stroke=\"currentColor\"\n strokeWidth={lineWeight}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n fill=\"none\"\n opacity={0.1}\n />\n {particles.map((pt, i) => (\n <circle\n key={i}\n cx={pt.cx}\n cy={pt.cy}\n r={pt.r}\n fill=\"currentColor\"\n opacity={pt.opacity}\n />\n ))}\n </g>\n </svg>\n </div>\n );\n};\n\nexport default Loading;\n"],"names":["curve","name","tag","rotate","particleCount","trailSpan","durationMs","rotationDurationMs","pulseDurationMs","strokeWidth","baseRadius","detailAmplitude","petalCount","curveScale","point","progress","detailScaleValue","config","t","Math","PI","petals","round","x","cos","y","sin","getParticle","index","tailOffset","max","p","normalizeProgress","fade","pow","radius","opacity","_a","_b","width","_c","height","strokeWidthProp","_d","color","className","_e","useState","frame","setFrame","startRef","useRef","useEffect","id","tick","now","current","requestAnimationFrame","cancelAnimationFrame","pulseAngle","elapsed","s","rotationDeg","elapsedMs","getRotationDeg","lineWeight","strokeScale","pathD","steps","parts","push","concat","toFixed","join","buildPath","particles","i","pt","cx","cy","r","_jsx","jsx","style","display","role","children","_jsxs","jsxs","viewBox","fill","preserveAspectRatio","overflow","transform","d","stroke","strokeLinecap","strokeLinejoin","map"],"mappings":"0HAEMA,EAAQ,CACZC,KAAM,gBACNC,IAAK,oBACLC,QAAQ,EACRC,cAAe,GACfC,UAAW,IACXC,WAAY,KACZC,mBAAoB,KACpBC,gBAAiB,IACjBC,YAAa,IACbC,WAAY,EACZC,gBAAiB,EACjBC,WAAY,EACZC,WAAY,GAKd,SAASC,EACPC,EACAC,EACAC,GAEA,IAAMC,EAAIH,EAAWI,KAAKC,GAAK,EACzBC,EAASF,KAAKG,MAAML,EAAOL,YAC3BW,EACJN,EAAOP,WAAaS,KAAKK,IAAIN,GAC7BD,EAAON,gBAAkBK,EAAmBG,KAAKK,IAAIH,EAASH,GAC1DO,EACJR,EAAOP,WAAaS,KAAKO,IAAIR,GAC7BD,EAAON,gBAAkBK,EAAmBG,KAAKO,IAAIL,EAASH,GAChE,MAAO,CACLK,EAAG,GAAKA,EAAIN,EAAOJ,WACnBY,EAAG,GAAKA,EAAIR,EAAOJ,WAEvB,CAsBA,SAASc,EACPC,EACAb,EACAC,EACAC,GAEA,IACMY,EAAaD,EADLT,KAAKW,IAAI,EAAGb,EAAOb,cAAgB,GAE3C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