shopport 0.3.3 → 0.3.4
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/cli.js +1 -1
- package/dist/dashboard-ui/assets/{index-DVjxNexJ.js → index-5AhXL8tX.js} +4 -4
- package/dist/dashboard-ui/assets/index-Cuq6bR2B.css +1 -0
- package/dist/dashboard-ui/index.html +2 -2
- package/dist/skills/cost-calc/SKILL.md +16 -0
- package/dist/skills/cost-register/SKILL.md +116 -0
- package/dist/skills/shopport/SKILL.md +1 -0
- package/dist/skills/sppt/SKILL.md +1 -0
- package/package.json +1 -1
- package/dist/dashboard-ui/assets/index-wrpslIzq.css +0 -1
|
@@ -284,7 +284,7 @@ Error generating stack: `+x.message+`
|
|
|
284
284
|
*/const Fee=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Uee=yt("zap",Fee),MD=CJ,Wee=AJ,Yee=MJ,oH=Y.forwardRef(({className:r,sideOffset:e=4,...t},n)=>m.jsx(DJ,{children:m.jsx(J6,{ref:n,sideOffset:e,className:Qe("z-50 max-w-[280px] rounded-md bg-popover px-3 py-1.5 text-[11px] leading-relaxed text-popover-foreground shadow-md","animate-in fade-in-0 zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2","data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...t})}));oH.displayName=J6.displayName;function us({children:r,content:e,delayDuration:t=200,side:n,contentClassName:a}){return m.jsx(MD,{children:m.jsxs(Wee,{delayDuration:t,children:[m.jsx(Yee,{asChild:!0,children:r}),m.jsx(oH,{side:n,className:a,children:e})]})})}function Zt({content:r,size:e=10,side:t,contentClassName:n}){return m.jsx(us,{content:r,side:t,contentClassName:n,children:m.jsx("span",{className:"cursor-help text-muted-foreground inline-flex items-center",children:m.jsx(rH,{size:e})})})}function bn({label:r,value:e,sub:t,tooltip:n,trend:a,highlight:i,warn:o,accent:s,onClick:l}){const u=a&&a.value>=0,c=Qe("border rounded-lg p-4 text-left w-full","border-border bg-card",i&&"border-primary/50 bg-primary/5",o&&"border-amber-500/50 bg-amber-50 dark:bg-amber-950/20",l&&"cursor-pointer hover:border-primary/70 transition-colors"),f=Qe("text-2xl font-semibold",i&&"text-primary",o&&"text-amber-500",s&&"text-emerald-600 dark:text-emerald-400"),h=m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"text-[11px] text-muted-foreground mb-1 flex items-center gap-1",children:[r,n&&m.jsx(Zt,{size:10,content:n})]}),m.jsx("div",{className:f,children:typeof e=="number"?e.toLocaleString():e}),t&&m.jsx("div",{className:"text-[11px] text-muted-foreground mt-0.5",children:t}),a!=null&&m.jsxs("div",{className:Qe("text-xs mt-1 font-medium",u?"text-emerald-600 dark:text-emerald-400":"text-red-500"),children:[u?"+":"",a.value,"%",a.label?` ${a.label}`:""]})]});return l?m.jsx("button",{type:"button",className:c,onClick:l,children:h}):m.jsx("div",{className:c,children:h})}const Zv=r=>r.toISOString().slice(0,10),JO=r=>{const e=new Date;return e.setDate(e.getDate()-r),e};function DD({from:r,to:e,onChange:t,className:n}){var f;const a=Zv(new Date),i=new Date,o=`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-01`,s=Zv(new Date(i.getFullYear(),i.getMonth()-1,1)),l=Zv(new Date(i.getFullYear(),i.getMonth(),0)),u=[{label:"전체",from:"",to:""},{label:"오늘",from:a,to:a},{label:"7일",from:Zv(JO(7)),to:a},{label:"이번 달",from:o,to:a},{label:"지난 달",from:s,to:l},{label:"3개월",from:Zv(JO(90)),to:a}],c=((f=u.find(h=>h.from===r&&h.to===e))==null?void 0:f.label)??null;return m.jsxs("div",{className:Qe("flex items-center gap-2 flex-wrap",n),children:[m.jsx("div",{className:"flex items-center gap-1",children:u.map(({label:h,from:v,to:g})=>m.jsx("button",{type:"button",onClick:()=>t(v,g),className:Qe("text-[11px] px-2 py-0.5 rounded border cursor-pointer transition-colors",c===h?"border-primary/60 bg-primary/10 text-foreground font-medium":"border-border bg-card text-muted-foreground hover:text-foreground"),children:h},h))}),m.jsx("span",{className:"text-muted-foreground/30",children:"|"}),m.jsx("input",{type:"date",value:r,onChange:h=>t(h.target.value,e),className:"text-[12px] px-2 py-1 rounded-md border border-border bg-card outline-none"}),m.jsx("span",{className:"text-[11px] text-muted-foreground",children:"~"}),m.jsx("input",{type:"date",value:e,onChange:h=>t(r,h.target.value),className:"text-[12px] px-2 py-1 rounded-md border border-border bg-card outline-none"}),(!!r||!!e)&&c===null&&m.jsxs("button",{type:"button",onClick:()=>t("",""),className:"text-[11px] text-muted-foreground hover:text-foreground flex items-center gap-0.5 cursor-pointer",children:[m.jsx(ql,{size:11})," 초기화"]})]})}function Jx({label:r,options:e,selected:t,onToggle:n,onClear:a,renderOption:i}){const[o,s]=Y.useState(!1),l=Y.useRef(null);return m.jsxs("div",{className:"relative",ref:l,children:[m.jsxs("button",{type:"button",onClick:()=>s(!o),className:Qe("flex items-center gap-1 text-[12px] px-2.5 py-1 rounded-md border cursor-pointer transition-colors",t.size>0?"border-primary/40 bg-primary/5 text-foreground":"border-border bg-card text-muted-foreground"),children:[r,t.size>0&&m.jsx("span",{className:"text-[10px] font-semibold bg-primary/10 text-primary px-1 rounded",children:t.size}),m.jsx("svg",{className:Qe("w-3 h-3 transition-transform",o&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:m.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),o&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>s(!1)}),m.jsxs("div",{className:"absolute top-full left-0 mt-1 z-20 bg-card border border-border rounded-lg shadow-lg py-1 min-w-[160px] max-h-[280px] overflow-y-auto",children:[t.size>0&&m.jsxs("button",{type:"button",onClick:()=>{a(),s(!1)},className:"w-full text-left px-3 py-1.5 text-[11px] text-muted-foreground hover:bg-muted/50 flex items-center gap-1",children:[m.jsx(ql,{size:10})," 초기화"]}),e.map(u=>m.jsxs("label",{className:"flex items-center gap-2 px-3 py-1.5 text-[12px] hover:bg-muted/50 cursor-pointer",children:[m.jsx("input",{type:"checkbox",checked:t.has(u),onChange:()=>n(u),className:"rounded border-border"}),i?i(u):u]},u))]})]})]})}const sH={pending:"결제대기",paid:"결제완료",confirmed:"구매확정",preparing:"발송준비",shipped:"배송중",delivered:"배송완료",cancelled:"취소",returned:"반품",unknown:"알수없음"},eP={pending:"bg-amber-100 text-amber-700 dark:bg-amber-950/50 dark:text-amber-400",paid:"bg-blue-100 text-blue-700 dark:bg-blue-950/50 dark:text-blue-400",confirmed:"bg-emerald-100 text-emerald-700 dark:bg-emerald-950/50 dark:text-emerald-400",preparing:"bg-purple-100 text-purple-700 dark:bg-purple-950/50 dark:text-purple-400",shipped:"bg-sky-100 text-sky-700 dark:bg-sky-950/50 dark:text-sky-400",delivered:"bg-green-100 text-green-700 dark:bg-green-950/50 dark:text-green-400",cancelled:"bg-muted text-muted-foreground",returned:"bg-red-100 text-red-700 dark:bg-red-950/50 dark:text-red-400",unknown:"bg-muted text-muted-foreground"};function lH({status:r}){return m.jsx("span",{className:Qe("inline-block text-[10px] font-medium px-1.5 py-0.5 rounded-full",eP[r]??eP.unknown),children:sH[r]??r})}const $ee={cafe24:"cafe24.com",coupang:"coupang.com",smartstore:"smartstore.naver.com",shopify:"shopify.com","toss-shopping":"toss.im",tosshop:"toss.im","29cm":"29cm.co.kr",musinsa:"musinsa.com",kurly:"kurly.com",ssf:"ssfshop.com",bronte:"bronte.co.kr",ezadmin:"ezadmin.co.kr"};function Xee(r,e){if(e!=null&&e[r])return e[r];const t=$ee[r];return t?`https://www.google.com/s2/favicons?domain=${t}&sz=32`:null}function Jy({channel:r,size:e=14,overrides:t}){const n=Xee(r,t);return n?m.jsx("img",{src:n,alt:"",width:e,height:e,className:"rounded-[2px] shrink-0 inline-block"}):null}const hr={cafe24:"카페24",coupang:"쿠팡",smartstore:"스마트스토어",shopify:"Shopify","toss-shopping":"토스쇼핑",tosshop:"토스쇼핑","29cm":"29CM",musinsa:"무신사",kurly:"컬리",ssf:"SSF",bronte:"브론테",ezadmin:"이지어드민"},ND={cafe24:"#3b82f6",coupang:"#f97316",smartstore:"#22c55e",shopify:"#10b981","toss-shopping":"#38bdf8",tosshop:"#38bdf8","29cm":"#64748b",musinsa:"#a1a1aa",kurly:"#a855f7",ssf:"#38bdf8",bronte:"#f43f5e",ezadmin:"#4a7cbe"},qee={cafe24:"bg-blue-500",coupang:"bg-orange-500",smartstore:"bg-green-500",shopify:"bg-emerald-500","toss-shopping":"bg-blue-400",tosshop:"bg-blue-400","29cm":"bg-slate-700 dark:bg-slate-400",musinsa:"bg-zinc-800 dark:bg-zinc-200",kurly:"bg-purple-500",ssf:"bg-sky-500",bronte:"bg-rose-500",ezadmin:"bg-gray-500"};function Zee({data:r,size:e=90}){if(r.length===0)return null;const t=r.reduce((h,v)=>h+v.totalRevenue,0);if(t===0)return null;const n=e/2,a=e/2,i=e*.35,o=e*.2,s=i-o,l=(i+o)/2,u=2*Math.PI*l,c=[];let f=0;for(const h of r){const v=h.totalRevenue/t,g=v*u,y=u-g,b=-(f*u)+u*.25;c.push({channel:h.channel,color:ND[h.channel]??"#94a3b8",dasharray:`${g} ${y}`,dashoffset:b.toFixed(2),label:hr[h.channel]??h.channel,pct:v*100}),f+=v}return m.jsxs("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,"aria-hidden":"true",children:[m.jsx("title",{children:"채널별 매출 비중"}),c.map(h=>m.jsx("circle",{cx:n,cy:a,r:l,fill:"none",stroke:h.color,strokeWidth:s,strokeDasharray:h.dasharray,strokeDashoffset:h.dashoffset,style:{transition:"stroke-dashoffset 0.3s"},children:m.jsxs("title",{children:[h.label,": ",h.pct.toFixed(1),"%"]})},h.channel))]})}function Tb({channel:r}){return m.jsx("span",{className:Qe("inline-block w-2 h-2 rounded-full shrink-0",qee[r]??"bg-muted-foreground")})}function Kee({label:r,value:e,onChange:t,className:n}){return m.jsxs("div",{className:Qe("relative",n),children:[m.jsx("input",{type:"text",placeholder:r,value:e,onChange:a=>t(a.target.value),className:Qe("text-[12px] px-2.5 py-1 rounded-md border bg-card w-[140px] outline-none transition-colors",e?"border-primary/40 text-foreground":"border-border text-muted-foreground placeholder:text-muted-foreground/60")}),e&&m.jsx("button",{type:"button",onClick:()=>t(""),className:"absolute right-1.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:m.jsx(ql,{size:11})})]})}function Ot(r){return r==null?"-":r>=1e8?`${(r/1e8).toFixed(1)}억원`:r>=1e4?`${Math.round(r/1e4).toLocaleString()}만원`:`${r.toLocaleString()}원`}function jl(r){return r==null?"-":`${r.toLocaleString()}원`}function Tg(r){if(!r)return null;const e=Date.now()-new Date(r).getTime();if(e<0)return null;const t=Math.floor(e/6e4);if(t<1)return"방금 전";if(t<60)return`${t}분 전`;const n=Math.floor(t/60);return n<24?`${n}시간 전`:`${Math.floor(n/24)}일 전`}function Qee({value:r}){const e=/^O\b|^포함/.test(r),t=/^X\b|^제외/.test(r),n=e?"text-emerald-600 dark:text-emerald-400":t?"text-red-400 dark:text-red-400":"";return m.jsx("span",{className:n,children:r})}function sr({metric:r,rows:e,summary:t}){return m.jsxs("div",{children:[m.jsx("div",{className:"text-[10px] font-semibold mb-1.5 pb-1 border-b border-border/50",children:r}),m.jsx("table",{className:"text-[10px] border-collapse",children:m.jsx("tbody",{children:e.map(([n,a])=>m.jsxs("tr",{children:[m.jsx("td",{className:"pr-3 py-[1px] text-muted-foreground whitespace-nowrap",children:n}),m.jsx("td",{className:"py-[1px] font-medium whitespace-nowrap",children:m.jsx(Qee,{value:a})})]},n))})}),m.jsxs("div",{className:"text-[10px] text-muted-foreground mt-1.5 pt-1 border-t border-border/50",children:["= ",t]})]})}const lr={주문:[["소스","주문 테이블"],["취소·반품·미결제","제외"],["미정산 주문","O (포함)"]],정산주문:[["소스","정산 테이블"],["취소·환불 주문","O (포함, 음수 행으로 상계)"],["미정산 주문","X (제외)"],["중복 제거","채널 주문번호 기준"]],매출:[["소스","주문 테이블"],["상품금액","O"],["배송비","O"],["쿠폰·포인트 할인","O (차감)"],["취소·반품·미결제","제외"],["미정산 주문","O (포함)"]],상품매출:[["소스","주문 테이블 (아이템)"],["상품금액","O"],["배송비","X"],["쿠폰·포인트 할인","X (미반영)"],["취소·반품·미결제","제외"],["미정산 주문","O (포함)"]],정산매출:[["소스","정산 테이블"],["상품금액","O"],["배송비","O"],["쿠폰·포인트 할인","O (차감)"],["취소·환불 주문","O (포함, 음수로 상계)"],["미정산 주문","X (제외)"]],순수익:[["소스","정산 테이블"],["정산매출(gross)","O"],["수수료·PG","O (차감)"],["취소·환불 주문","O (포함, 음수로 상계)"],["미정산 주문","X (제외)"]],공헌이익:[["소스","정산 테이블"],["정산매출(gross)","O"],["수수료·PG","O (차감)"],["매입원가","O (차감)"],["택배·포장·풀필먼트","O (차감)"],["취소·환불 주문","O (포함, 음수로 상계)"],["미정산 주문","X (제외)"],["미등록 원가 SKU","변동비 0 처리"]],판매수량:[["소스","주문 테이블 (아이템)"],["계산","주문수량 × 구성품수"],["세트 상품","구성품별 물리 수량으로 분해"],["취소·반품·미결제","제외"],["미정산 주문","O (포함)"]],전체주문:[["소스","주문 테이블"],["취소·반품·미결제","O (포함)"],["제외 처리 주문","O (포함)"],["필터 적용","선택한 필터 조건 반영"]],전체수량:[["소스","주문 테이블 (아이템)"],["계산","주문수량 합계"],["취소·반품·미결제","O (포함)"],["제외 처리 주문","O (포함)"],["필터 적용","선택한 필터 조건 반영"]]};function Cg(r,e){if(!(r!=null&&r.length)||e==null)return null;const t=r.findIndex(n=>n.maxAnnualRevenue==null||e<=n.maxAnnualRevenue);return t>=0?t:r.length-1}function Jee(r,e,t,n){var L,k;const a=r.avgCommissionRate;if(a==null)return null;const i=a>1?a:a*100,o=t[r.channel],s=o?o.commissionRate+o.pgRate:null,l=e.filter(R=>R.channel===r.channel),u=(o==null?void 0:o.discrepancyHints)??[],c=R=>({k:"text",v:R}),f=(R,E,I)=>({k:"row",label:R,value:E,accent:I}),h={k:"divider"},v=(R,E)=>({k:"section",v:R,accent:E}),g=R=>({k:"bullet",v:R}),y=(R,E)=>({k:"fixbullet",v:R,href:E}),b=u.filter(R=>R.type==="fix"),_=u.filter(R=>R.type==="auto"),S=u.filter(R=>R.type==="info");function T(R={fix:3,auto:2,info:2}){const E=[];if(b.length>0){E.push(v("설정으로 개선 가능","fix"));for(const I of b.slice(0,R.fix))E.push(y(I.text,I.configHref))}if(_.length>0){E.push(v("자동 처리","info"));for(const I of _.slice(0,R.auto))E.push(g(I.text))}if(S.length>0){E.push(v("참고 항목","info"));for(const I of S.slice(0,R.info))E.push(g(I.text))}return E}const C=l.find(R=>{const E=(R.commissionRate??0)+(R.pgRate??0);return Math.abs(E-i)<.5}),M=b.length>0||_.length>0||S.length>0;if(s!=null&&Math.abs(s-i)<.1){const R=Cg(o.revenueTiers,n),E=R!=null?(L=o.revenueTiers)==null?void 0:L[R]:null,I=(E==null?void 0:E.pgRate)??o.pgRate,z=o.commissionRate+I;return{method:"default",label:"채널 기본 요율 적용",lines:[c("실 정산 데이터 없음 — 추정값"),...o.commissionRate>0?[f("판매수수료",`${o.commissionRate}%`,"muted")]:[],...I>0?[f(`PG${E?` (${E.label})`:""}`,`${I}%`,"muted")]:[],f("합계",`${z.toFixed(2)}%`),...n==null&&((k=o.revenueTiers)!=null&&k.length)?[c("⚠ 연매출 미설정 — 일반 등급 기준")]:[],...M?[h,...T({fix:3,auto:2,info:2})]:[]]}}for(const R of l){const E=(R.commissionRate??0)+(R.pgRate??0);if(Math.abs(E-i)<.5)return{method:"custom_rule",label:"커스텀 규칙 적용",lines:[f("규칙 ID",R.id,"muted"),...R.commissionRate!=null?[f("판매수수료",`${R.commissionRate}%`)]:[],...R.pgRate!=null?[f("PG수수료",`${R.pgRate}%`)]:[],...R.note?[f("메모",R.note,"muted")]:[],...M?[h,...T({fix:2,auto:1,info:2})]:[]]}}const D=s!=null?i-s:null;return{method:"order_data",label:"주문 데이터 평균",lines:[c("주문별 수수료율의 평균값"),f("적용 요율",`${i.toFixed(2)}%`),...s!=null?[f("채널 기준",`${s.toFixed(2)}%`,"muted"),...D!=null&&Math.abs(D)>=.1?[f("차이",`${D>0?"+":""}${D.toFixed(2)}%p`,D>.5?"warn":D<-.5?"green":"muted")]:[],...C?[c(`커스텀 규칙 적용 중${C.note?` (${C.note})`:""}`)]:[]]:[],...M?[h,...T({fix:2,auto:1,info:2})]:[]]}}function Zf(r,e,t){let n=t.initialDeps??[],a,i=!0;function o(){var s,l,u;let c;t.key&&((s=t.debug)!=null&&s.call(t))&&(c=Date.now());const f=r();if(!(f.length!==n.length||f.some((g,y)=>n[y]!==g)))return a;n=f;let v;if(t.key&&((l=t.debug)!=null&&l.call(t))&&(v=Date.now()),a=e(...f),t.key&&((u=t.debug)!=null&&u.call(t))){const g=Math.round((Date.now()-c)*100)/100,y=Math.round((Date.now()-v)*100)/100,b=y/16,_=(S,T)=>{for(S=String(S);S.length<T;)S=" "+S;return S};console.info(`%c⏱ ${_(y,5)} /${_(g,5)} ms`,`
|
|
285
285
|
font-size: .6rem;
|
|
286
286
|
font-weight: bold;
|
|
287
|
-
color: hsl(${Math.max(0,Math.min(120-120*b,120))}deg 100% 31%);`,t==null?void 0:t.key)}return t!=null&&t.onChange&&!(i&&t.skipInitialOnChange)&&t.onChange(a),i=!1,a}return o.updateDeps=s=>{n=s},o}function tP(r,e){if(r===void 0)throw new Error("Unexpected undefined");return r}const ete=(r,e)=>Math.abs(r-e)<1.01,tte=(r,e,t)=>{let n;return function(...a){r.clearTimeout(n),n=r.setTimeout(()=>e.apply(this,a),t)}},rP=r=>{const{offsetWidth:e,offsetHeight:t}=r;return{width:e,height:t}},rte=r=>r,nte=r=>{const e=Math.max(r.startIndex-r.overscan,0),t=Math.min(r.endIndex+r.overscan,r.count-1),n=[];for(let a=e;a<=t;a++)n.push(a);return n},ate=(r,e)=>{const t=r.scrollElement;if(!t)return;const n=r.targetWindow;if(!n)return;const a=o=>{const{width:s,height:l}=o;e({width:Math.round(s),height:Math.round(l)})};if(a(rP(t)),!n.ResizeObserver)return()=>{};const i=new n.ResizeObserver(o=>{const s=()=>{const l=o[0];if(l!=null&&l.borderBoxSize){const u=l.borderBoxSize[0];if(u){a({width:u.inlineSize,height:u.blockSize});return}}a(rP(t))};r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()});return i.observe(t,{box:"border-box"}),()=>{i.unobserve(t)}},nP={passive:!0},aP=typeof window>"u"?!0:"onscrollend"in window,ite=(r,e)=>{const t=r.scrollElement;if(!t)return;const n=r.targetWindow;if(!n)return;let a=0;const i=r.options.useScrollendEvent&&aP?()=>{}:tte(n,()=>{e(a,!1)},r.options.isScrollingResetDelay),o=c=>()=>{const{horizontal:f,isRtl:h}=r.options;a=f?t.scrollLeft*(h&&-1||1):t.scrollTop,i(),e(a,c)},s=o(!0),l=o(!1);t.addEventListener("scroll",s,nP);const u=r.options.useScrollendEvent&&aP;return u&&t.addEventListener("scrollend",l,nP),()=>{t.removeEventListener("scroll",s),u&&t.removeEventListener("scrollend",l)}},ote=(r,e,t)=>{if(e!=null&&e.borderBoxSize){const n=e.borderBoxSize[0];if(n)return Math.round(n[t.options.horizontal?"inlineSize":"blockSize"])}return r[t.options.horizontal?"offsetWidth":"offsetHeight"]},ste=(r,{adjustments:e=0,behavior:t},n)=>{var a,i;const o=r+e;(i=(a=n.scrollElement)==null?void 0:a.scrollTo)==null||i.call(a,{[n.options.horizontal?"left":"top"]:o,behavior:t})};class lte{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var t,n,a;return((a=(n=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:n.now)==null?void 0:a.call(n))??Date.now()},this.observer=(()=>{let t=null;const n=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(a=>{a.forEach(i=>{const o=()=>{const s=i.target,l=this.indexFromElement(s);if(!s.isConnected){this.observer.unobserve(s);return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(s,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var a;(a=n())==null||a.disconnect(),t=null},observe:a=>{var i;return(i=n())==null?void 0:i.observe(a,{box:"border-box"})},unobserve:a=>{var i;return(i=n())==null?void 0:i.unobserve(a)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([n,a])=>{typeof a>"u"&&delete t[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:rte,rangeExtractor:nte,onChange:()=>{},measureElement:ote,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...t}},this.notify=t=>{var n,a;(a=(n=this.options).onChange)==null||a.call(n,this,t)},this.maybeNotify=Zf(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(a=>{this.observer.observe(a)}),this.unsubs.push(this.options.observeElementRect(this,a=>{this.scrollRect=a,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(a,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<a?"forward":"backward":null,this.scrollOffset=a,this.isScrolling=i,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,n)=>{const a=new Map,i=new Map;for(let o=n-1;o>=0;o--){const s=t[o];if(a.has(s.lane))continue;const l=i.get(s.lane);if(l==null||s.end>l.end?i.set(s.lane,s):s.end<l.end&&a.set(s.lane,!0),a.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((o,s)=>o.end===s.end?o.index-s.index:o.end-s.end)[0]:void 0},this.getMeasurementOptions=Zf(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,n,a,i,o,s,l)=>(this.prevLanes!==void 0&&this.prevLanes!==s&&(this.lanesChangedFlag=!0),this.prevLanes=s,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:n,scrollMargin:a,getItemKey:i,enabled:o,lanes:s,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=Zf(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:n,scrollMargin:a,getItemKey:i,enabled:o,lanes:s,laneAssignmentMode:l},u)=>{if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const v of this.laneAssignments.keys())v>=t&&this.laneAssignments.delete(v);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(v=>{this.itemSizeCache.set(v.key,v.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const f=this.measurementsCache.slice(0,c),h=new Array(s).fill(void 0);for(let v=0;v<c;v++){const g=f[v];g&&(h[g.lane]=v)}for(let v=c;v<t;v++){const g=i(v),y=this.laneAssignments.get(v);let b,_;const S=l==="estimate"||u.has(g);if(y!==void 0&&this.options.lanes>1){b=y;const D=h[b],L=D!==void 0?f[D]:void 0;_=L?L.end+this.options.gap:n+a}else{const D=this.options.lanes===1?f[v-1]:this.getFurthestMeasurement(f,v);_=D?D.end+this.options.gap:n+a,b=D?D.lane:v%this.options.lanes,this.options.lanes>1&&S&&this.laneAssignments.set(v,b)}const T=u.get(g),C=typeof T=="number"?T:this.options.estimateSize(v),M=_+C;f[v]={index:v,start:_,size:C,end:M,key:g,lane:b},h[b]=v}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Zf(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,n,a,i)=>this.range=t.length>0&&n>0?ute({measurements:t,outerSize:n,scrollOffset:a,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Zf(()=>{let t=null,n=null;const a=this.calculateRange();return a&&(t=a.startIndex,n=a.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,n]},(t,n,a,i,o)=>i===null||o===null?[]:t({startIndex:i,endIndex:o,overscan:n,count:a}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const n=this.options.indexAttribute,a=t.getAttribute(n);return a?parseInt(a,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const a=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(a!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,a-i),s=Math.min(this.options.count-1,a+i);return t>=o&&t<=s}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((o,s)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(s))});return}const n=this.indexFromElement(t),a=this.options.getItemKey(n),i=this.elementsCache.get(a);i!==t&&(i&&this.observer.unobserve(i),this.observer.observe(t),this.elementsCache.set(a,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,n)=>{var a;const i=this.measurementsCache[t];if(!i)return;const o=this.itemSizeCache.get(i.key)??i.size,s=n-o;s!==0&&(((a=this.scrollState)==null?void 0:a.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,s,this):i.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=s,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,n)),this.notify(!1))},this.getVirtualItems=Zf(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,n)=>{const a=[];for(let i=0,o=t.length;i<o;i++){const s=t[i],l=n[s];a.push(l)}return a},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const n=this.getMeasurements();if(n.length!==0)return tP(n[uH(0,n.length-1,a=>tP(n[a]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,n,a=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),o=this.getScrollOffset();n==="auto"&&(n=t>=o+i?"end":"start"),n==="center"?t+=(a-i)/2:n==="end"&&(t-=i);const s=this.getMaxScrollOffset();return Math.max(Math.min(s,t),0)},this.getOffsetForIndex=(t,n="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const a=this.getSize(),i=this.getScrollOffset(),o=this.measurementsCache[t];if(!o)return;if(n==="auto")if(o.end>=i+a-this.options.scrollPaddingEnd)n="end";else if(o.start<=i+this.options.scrollPaddingStart)n="start";else return[i,n];if(n==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),n];const s=n==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(s,n,o.size),n]},this.scrollToOffset=(t,{align:n="start",behavior:a="auto"}={})=>{const i=this.getOffsetForAlignment(t,n),o=this.now();this.scrollState={index:null,align:n,behavior:a,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:a}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:n="auto",behavior:a="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const i=this.getOffsetForIndex(t,n);if(!i)return;const[o,s]=i,l=this.now();this.scrollState={index:t,align:s,behavior:a,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:a}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:n="auto"}={})=>{const a=this.getScrollOffset()+t,i=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:i,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const n=this.getMeasurements();let a;if(n.length===0)a=this.options.paddingStart;else if(this.options.lanes===1)a=((t=n[n.length-1])==null?void 0:t.end)??0;else{const i=Array(this.options.lanes).fill(null);let o=n.length-1;for(;o>=0&&i.some(s=>s===null);){const s=n[o];i[s.lane]===null&&(i[s.lane]=s.end),o--}a=Math.max(...i.filter(s=>s!==null))}return Math.max(a-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:n,behavior:a})=>{this.options.scrollToFn(t,{behavior:a,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,a=n?n[0]:this.scrollState.lastTargetOffset,i=1,o=a!==this.scrollState.lastTargetOffset;if(!o&&ete(a,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.scrollState=null;return}}else this.scrollState.stableFrames=0,o&&(this.scrollState.lastTargetOffset=a,this.scrollState.behavior="auto",this._scrollToOffset(a,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const uH=(r,e,t,n)=>{for(;r<=e;){const a=(r+e)/2|0,i=t(a);if(i<n)r=a+1;else if(i>n)e=a-1;else return a}return r>0?r-1:0};function ute({measurements:r,outerSize:e,scrollOffset:t,lanes:n}){const a=r.length-1,i=l=>r[l].start;if(r.length<=n)return{startIndex:0,endIndex:a};let o=uH(0,a,i,t),s=o;if(n===1)for(;s<a&&r[s].end<t+e;)s++;else if(n>1){const l=Array(n).fill(0);for(;s<a&&l.some(c=>c<t+e);){const c=r[s];l[c.lane]=c.end,s++}const u=Array(n).fill(t+e);for(;o>=0&&u.some(c=>c>=t);){const c=r[o];u[c.lane]=c.start,o--}o=Math.max(0,o-o%n),s=Math.min(a,s+(n-1-s%n))}return{startIndex:o,endIndex:s}}const iP=typeof document<"u"?Y.useLayoutEffect:Y.useEffect;function cte({useFlushSync:r=!0,...e}){const t=Y.useReducer(()=>({}),{})[1],n={...e,onChange:(i,o)=>{var s;r&&o?pb.flushSync(t):t(),(s=e.onChange)==null||s.call(e,i,o)}},[a]=Y.useState(()=>new lte(n));return a.setOptions(n),iP(()=>a._didMount(),[]),iP(()=>a._willUpdate()),a}function fte(r){return cte({observeElementRect:ate,observeElementOffset:ite,scrollToFn:ste,...r})}const dte={스마트스토어정산:"스마트스토어",쿠팡정산:"쿠팡",tosspaymen:"토스페이먼츠",Npay정산:"네이버페이",카페24페이먼:"카페24페이먼츠",Shopify:"Shopify",토스쇼핑정산:"토스쇼핑"},hte={스마트스토어정산:"#22c55e",쿠팡정산:"#f97316",tosspaymen:"#3b82f6",Npay정산:"#16a34a",카페24페이먼:"#6366f1",Shopify:"#10b981",토스쇼핑정산:"#38bdf8"};function LD(r){return r.byProvider&&r.byProvider.length>0?r.byProvider.map(e=>({key:e.provider,label:dte[e.provider]??e.provider,color:hte[e.provider]??"#888",amount:e.amount})):r.byChannel.map(e=>({key:e.channel,label:hr[e.channel]??e.channel,color:ND[e.channel]??"#888",amount:e.amount}))}const vte=["일","월","화","수","목","금","토"];function cH(r){const e=new Date(`${r}T00:00:00Z`);return vte[e.getUTCDay()]??""}function fH(r){return r.slice(5).replace("-","/")}function pte(r){return r>=1e8?`${(r/1e8).toFixed(1)}억`:r>=1e4?`${Math.round(r/1e4)}만`:r>=1e3?`${Math.round(r/1e3)}천`:r.toLocaleString()}function dH({items:r,className:e}){return m.jsx(m.Fragment,{children:r.map(t=>m.jsxs("div",{className:Qe("flex items-center justify-between gap-4 text-[11px]",e),children:[m.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[m.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:t.color}}),m.jsx("span",{className:"text-muted-foreground truncate",children:t.label})]}),m.jsx("span",{className:"font-medium tabular-nums shrink-0",children:jl(t.amount)})]},t.key))})}function gte({dateStr:r,day:e}){var a;const t=LD(e),n=e.holdbacks&&e.holdbacks.length>0;return m.jsxs("div",{className:"min-w-[180px] space-y-1",children:[m.jsxs("div",{className:"text-[10px] text-muted-foreground font-medium mb-0.5",children:[fH(r)," (",cH(r),")"]}),m.jsx(dH,{items:t}),n&&((a=e.holdbacks)==null?void 0:a.map(i=>m.jsxs("div",{className:"flex items-center justify-between gap-4 text-[11px] text-amber-600 dark:text-amber-400",children:[m.jsxs("span",{children:["지급보류 ",i.provider]}),m.jsxs("span",{className:"font-medium tabular-nums",children:["-",jl(i.amount)]})]},i.provider))),m.jsxs("div",{className:"flex justify-between gap-4 text-[11px] font-semibold pt-1 border-t border-border/40",children:[m.jsx("span",{children:n?"실입금":"합계"}),m.jsx("span",{className:"tabular-nums text-emerald-500",children:jl(n&&e.adjustedAmount!=null?e.adjustedAmount:e.totalAmount)})]})]})}function mte({year:r,month:e,depositMap:t,today:n,maxAmount:a}){const i=new Date(`${r}-${String(e).padStart(2,"0")}-01T00:00:00Z`).getUTCDay(),o=new Date(r,e,0).getDate(),s=[...Array(i).fill(null),...Array.from({length:o},(l,u)=>u+1)];return m.jsxs("div",{children:[m.jsxs("div",{className:"text-[11px] font-medium text-muted-foreground mb-2",children:[r,"년 ",e,"월"]}),m.jsxs("div",{className:"grid grid-cols-7 gap-[2px]",children:[["일","월","화","수","목","금","토"].map(l=>m.jsx("div",{className:"text-center text-[9px] text-muted-foreground/50 py-0.5 font-medium",children:l},l)),s.map((l,u)=>{if(!l)return m.jsx("div",{className:"h-[40px]"},`e-${u}`);const c=`${r}-${String(e).padStart(2,"0")}-${String(l).padStart(2,"0")}`,f=t.get(c),h=c===n,v=(f==null?void 0:f.holdbacks)&&f.holdbacks.length>0,g=f?.07+f.totalAmount/a*.28:0,y=m.jsxs("div",{className:Qe("h-[40px] flex flex-col items-center justify-center gap-0.5 rounded cursor-default",h&&"ring-1 ring-inset ring-primary/50",v&&"ring-1 ring-inset ring-amber-400/60"),style:f?{backgroundColor:`hsl(var(--primary) / ${g})`}:void 0,children:[m.jsx("span",{className:Qe("text-[10px] leading-none",h?"font-bold text-primary":f?"font-medium text-foreground":"text-muted-foreground/60"),children:l}),f&&m.jsx("span",{className:Qe("text-[8px] font-semibold leading-none",v?"text-amber-600 dark:text-amber-400":"text-foreground/80"),children:pte(v&&f.adjustedAmount!=null?f.adjustedAmount:f.totalAmount)})]});return f?m.jsx(us,{content:m.jsx(gte,{dateStr:c,day:f}),side:"top",contentClassName:"max-w-[240px]",delayDuration:80,children:y},c):m.jsx("div",{children:y},c)})]})]})}function yte(r){if(r.type==="divider")return 28;if(r.type==="empty-upcoming")return 32;const e=r.day.byProvider&&r.day.byProvider.length>0?r.day.byProvider.length:r.day.byChannel.length;return 36+e*22+(e>1?28:0)}function xte({schedule:r,today:e}){const t=[...r].sort((c,f)=>c.depositDate.localeCompare(f.depositDate)),n=t.filter(c=>c.depositDate<e),a=t.filter(c=>c.depositDate>=e),i=[...n.map(c=>({type:"day",day:c,isPast:!0})),...n.length>0&&a.length>0?[{type:"divider",label:"예정 입금"}]:[],...a.length===0&&n.length>0?[{type:"empty-upcoming"}]:[],...a.map(c=>({type:"day",day:c,isPast:!1}))],o=i.findIndex(c=>c.type==="divider"||c.type==="day"&&!c.isPast),s=Math.max(0,o-2),l=Y.useRef(null),u=fte({count:i.length,getScrollElement:()=>l.current,estimateSize:c=>yte(i[c]??{type:"empty-upcoming"}),overscan:5});return Y.useEffect(()=>{i.length===0||o<0||u.scrollToIndex(s,{align:"start"})},[i.length,o,s,u.scrollToIndex]),m.jsxs("div",{className:"absolute inset-0 border border-border rounded-lg bg-card flex flex-col overflow-hidden",children:[m.jsx("div",{className:"px-3 pt-3 pb-2 text-[11px] font-medium text-muted-foreground border-b border-border/50 shrink-0",children:"입금 내역"}),t.length===0?m.jsx("p",{className:"text-[12px] text-muted-foreground px-3 py-3",children:"데이터 없음"}):m.jsx("div",{ref:l,className:"flex-1 overflow-y-auto",children:m.jsx("div",{style:{height:u.getTotalSize(),position:"relative"},children:u.getVirtualItems().map(c=>{const f=i[c.index];return f?m.jsxs("div",{"data-index":c.index,ref:u.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${c.start}px)`},children:[f.type==="divider"&&m.jsx("div",{className:"px-3 py-1.5 text-[10px] text-muted-foreground/50 bg-muted/30 border-y border-border/50",children:f.label}),f.type==="empty-upcoming"&&m.jsx("p",{className:"text-[11px] text-muted-foreground px-3 py-2",children:"향후 예정 없음"}),f.type==="day"&&(()=>{var y;const{day:h,isPast:v}=f,g=LD(h);return m.jsxs("div",{className:Qe("px-3 py-2.5 border-b border-border/50",v&&"opacity-50"),children:[m.jsxs("div",{className:"text-[10px] font-semibold text-foreground/70 mb-1.5",children:[fH(h.depositDate)," ",m.jsxs("span",{className:"font-normal text-muted-foreground/60",children:["(",cH(h.depositDate),")"]}),v&&m.jsx("span",{className:"ml-1 text-muted-foreground/40 font-normal",children:"완료"})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx(dH,{items:g}),(y=h.holdbacks)==null?void 0:y.map(b=>m.jsxs("div",{className:"flex items-center justify-between gap-2 text-[10px] text-amber-600 dark:text-amber-400",children:[m.jsxs("span",{className:"truncate",children:["지급보류 ",b.provider]}),m.jsxs("span",{className:"font-medium tabular-nums shrink-0",children:["-",jl(b.amount)]})]},b.provider)),(g.length>1||h.holdbacks&&h.holdbacks.length>0)&&m.jsxs("div",{className:"flex justify-between text-[10px] font-semibold pt-1 border-t border-border/30",children:[m.jsx("span",{className:"text-muted-foreground/60",children:h.holdbacks&&h.holdbacks.length>0?"실입금":"합계"}),m.jsx("span",{className:"text-emerald-600 dark:text-emerald-400 tabular-nums",children:jl(h.adjustedAmount!=null?h.adjustedAmount:h.totalAmount)})]})]})]})})()]},c.key):null})})})]})}function bte({depositSchedule:r,today:e,maxAmount:t}){const n=e??new Date().toISOString().slice(0,10),a=t??Math.max(...r.map(y=>y.totalAmount),1),i=new Map(r.map(y=>[y.depositDate,y])),[o,s]=n.split("-").map(Number),[l,u]=Y.useState(0),c=new Date(o,s-1+l,1),f={year:c.getFullYear(),month:c.getMonth()+1},h=new Date(c.getFullYear(),c.getMonth()+1,1),v={year:h.getFullYear(),month:h.getMonth()+1},g=[f,v];return m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4",children:[m.jsxs("div",{className:"flex items-center justify-end gap-1 mb-2",children:[m.jsx("button",{type:"button",onClick:()=>u(y=>y-1),className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",children:m.jsx(CD,{size:14})}),m.jsx("button",{type:"button",onClick:()=>u(0),className:Qe("px-2 py-0.5 rounded text-[10px] transition-colors",l===0?"text-muted-foreground/40 cursor-default":"text-muted-foreground hover:bg-muted hover:text-foreground"),disabled:l===0,children:"오늘"}),m.jsx("button",{type:"button",onClick:()=>u(y=>y+1),className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",children:m.jsx(qr,{size:14})})]}),m.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6 sm:divide-x sm:divide-border/40",children:g.map(({year:y,month:b})=>m.jsx(mte,{year:y,month:b,depositMap:i,today:n,maxAmount:a},`${y}-${b}`))})]})}const _te=["cancelled","returned","pending"];function Ste(r){return!_te.includes(r)}function mi({children:r,variant:e="primary",className:t}){return m.jsx("code",{className:Qe("font-mono rounded",e==="primary"&&"bg-primary/10 text-primary px-1 py-px text-[0.85em]",e==="muted"&&"bg-muted/60 text-foreground/70 px-1.5 py-0.5 text-[10px]",t),children:r})}const wte=[{days:3,label:"3일"},{days:7,label:"7일",default:!0},{days:14,label:"14일"},{days:30,label:"30일"},{days:90,label:"90일"}];function e1({onSync:r,syncing:e=!1,syncResult:t,timeLeft:n,disabled:a=!1}){const[i,o]=Y.useState(7),[s,l]=Y.useState(!1),u=Y.useRef(null);Y.useEffect(()=>{function h(v){u.current&&!u.current.contains(v.target)&&l(!1)}return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[]);const c="flex items-center rounded-none bg-primary text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50 cursor-pointer",f=e&&n!=null&&n>0?`약 ${n}초 후 완료`:t??null;return m.jsxs("div",{className:"flex items-center gap-2",children:[f&&m.jsx("span",{className:"text-[11px] text-muted-foreground",children:f}),m.jsxs("div",{ref:u,className:"relative flex",children:[m.jsxs("div",{className:"flex rounded overflow-hidden",children:[m.jsxs("button",{type:"button",onClick:()=>!a&&r(i),disabled:e||a,className:Qe(c,"gap-1.5 text-[12px] px-2.5 py-1 border-r border-primary-foreground/20"),children:[m.jsx(Dee,{size:12,className:e?"animate-spin":""}),e?"동기화 중...":i===7?"주문 동기화":`주문 동기화 · ${i}일`]}),m.jsx("button",{type:"button",onClick:()=>!a&&l(h=>!h),disabled:e||a,className:Qe(c,"px-1.5 py-1"),"aria-label":"동기화 기간 선택",children:m.jsx(cn,{size:12,className:Qe("transition-transform",s&&"rotate-180")})})]}),s&&m.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 w-max min-w-[110px] rounded border border-border bg-popover shadow-md py-1",children:[wte.map(h=>m.jsxs("button",{type:"button",onClick:()=>{o(h.days),l(!1)},className:Qe("w-full text-left px-3 py-1.5 text-[12px] cursor-pointer hover:bg-muted/70 hover:text-foreground transition-colors flex items-center justify-between gap-4",i===h.days?"text-primary font-medium":"text-muted-foreground"),children:[m.jsx("span",{children:h.label}),"default"in h&&m.jsx("span",{className:"text-[10px] text-muted-foreground",children:"기본"})]},h.days)),m.jsx("div",{className:"border-t border-border/50 mt-1 mx-2"}),m.jsxs("p",{className:"px-3 py-2 text-[10px] text-muted-foreground leading-snug whitespace-nowrap",children:["90일 이전은 채널 관리자에서 CSV 다운로드 후",m.jsx("br",{}),m.jsx(mi,{children:"sppt order import"}),"로 가져오세요."]})]})]})]})}function Tte({channelFilter:r,statusFilter:e,productSearch:t,channelOptions:n,statusOptions:a,onChannelToggle:i,onChannelClear:o,onStatusToggle:s,onStatusClear:l,onProductSearch:u,onReset:c}){const f=r.size>0||e.size>0||t;return m.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-4",children:[m.jsx(Jx,{label:"채널",options:n,selected:r,onToggle:i,onClear:o,renderOption:h=>m.jsx("span",{children:hr[h]??h})}),m.jsx(Jx,{label:"상태",options:a,selected:e,onToggle:s,onClear:l,renderOption:h=>m.jsx(lH,{status:h})}),m.jsx(Kee,{label:"상품 검색",value:t,onChange:u}),f&&m.jsxs("button",{type:"button",onClick:c,className:"text-[11px] text-muted-foreground hover:text-foreground flex items-center gap-0.5 cursor-pointer",children:[m.jsx(ql,{size:11})," 전체 초기화"]})]})}const hH=6048e5,Cte=864e5,vH=6e4,pH=36e5,e0=43200,oP=1440,sP=Symbol.for("constructDateFrom");function ho(r,e){return typeof r=="function"?r(e):r&&typeof r=="object"&&sP in r?r[sP](e):r instanceof Date?new r.constructor(e):new Date(e)}function Vr(r,e){return ho(e||r,r)}let Ate={};function hm(){return Ate}function Ag(r,e){var s,l,u,c;const t=hm(),n=(e==null?void 0:e.weekStartsOn)??((l=(s=e==null?void 0:e.locale)==null?void 0:s.options)==null?void 0:l.weekStartsOn)??t.weekStartsOn??((c=(u=t.locale)==null?void 0:u.options)==null?void 0:c.weekStartsOn)??0,a=Vr(r,e==null?void 0:e.in),i=a.getDay(),o=(i<n?7:0)+i-n;return a.setDate(a.getDate()-o),a.setHours(0,0,0,0),a}function t1(r,e){return Ag(r,{...e,weekStartsOn:1})}function gH(r,e){const t=Vr(r,e==null?void 0:e.in),n=t.getFullYear(),a=ho(t,0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);const i=t1(a),o=ho(t,0);o.setFullYear(n,0,4),o.setHours(0,0,0,0);const s=t1(o);return t.getTime()>=i.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function r1(r){const e=Vr(r),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+r-+t}function Cb(r,...e){const t=ho.bind(null,r||e.find(n=>typeof n=="object"));return e.map(t)}function lP(r,e){const t=Vr(r,e==null?void 0:e.in);return t.setHours(0,0,0,0),t}function Mte(r,e,t){const[n,a]=Cb(t==null?void 0:t.in,r,e),i=lP(n),o=lP(a),s=+i-r1(i),l=+o-r1(o);return Math.round((s-l)/Cte)}function Dte(r,e){const t=gH(r,e),n=ho(r,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),t1(n)}function Sx(r,e){const t=+Vr(r)-+Vr(e);return t<0?-1:t>0?1:t}function Nte(r){return ho(r,Date.now())}function Lte(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function kte(r){return!(!Lte(r)&&typeof r!="number"||isNaN(+Vr(r)))}function Rte(r,e,t){const[n,a]=Cb(t==null?void 0:t.in,r,e),i=n.getFullYear()-a.getFullYear(),o=n.getMonth()-a.getMonth();return i*12+o}function Ete(r){return e=>{const n=(r?Math[r]:Math.trunc)(e);return n===0?0:n}}function Ite(r,e){return+Vr(r)-+Vr(e)}function Ote(r,e){const t=Vr(r,e==null?void 0:e.in);return t.setHours(23,59,59,999),t}function Pte(r,e){const t=Vr(r,e==null?void 0:e.in),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function jte(r,e){const t=Vr(r,e==null?void 0:e.in);return+Ote(t,e)==+Pte(t,e)}function zte(r,e,t){const[n,a,i]=Cb(t==null?void 0:t.in,r,r,e),o=Sx(a,i),s=Math.abs(Rte(a,i));if(s<1)return 0;a.getMonth()===1&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-o*s);let l=Sx(a,i)===-o;jte(n)&&s===1&&Sx(n,i)===1&&(l=!1);const u=o*(s-+l);return u===0?0:u}function Bte(r,e,t){const n=Ite(r,e)/1e3;return Ete(t==null?void 0:t.roundingMethod)(n)}function Vte(r,e){const t=Vr(r,e==null?void 0:e.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}const Gte={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Hte=(r,e,t)=>{let n;const a=Gte[r];return typeof a=="string"?n=a:e===1?n=a.one:n=a.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function Hd(r){return(e={})=>{const t=e.width?String(e.width):r.defaultWidth;return r.formats[t]||r.formats[r.defaultWidth]}}const Fte={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Ute={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Wte={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Yte={date:Hd({formats:Fte,defaultWidth:"full"}),time:Hd({formats:Ute,defaultWidth:"full"}),dateTime:Hd({formats:Wte,defaultWidth:"full"})},$te={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Xte=(r,e,t,n)=>$te[r];function Ki(r){return(e,t)=>{const n=t!=null&&t.context?String(t.context):"standalone";let a;if(n==="formatting"&&r.formattingValues){const o=r.defaultFormattingWidth||r.defaultWidth,s=t!=null&&t.width?String(t.width):o;a=r.formattingValues[s]||r.formattingValues[o]}else{const o=r.defaultWidth,s=t!=null&&t.width?String(t.width):r.defaultWidth;a=r.values[s]||r.values[o]}const i=r.argumentCallback?r.argumentCallback(e):e;return a[i]}}const qte={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Zte={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Kte={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Qte={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Jte={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},ere={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},tre=(r,e)=>{const t=Number(r),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},rre={ordinalNumber:tre,era:Ki({values:qte,defaultWidth:"wide"}),quarter:Ki({values:Zte,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Ki({values:Kte,defaultWidth:"wide"}),day:Ki({values:Qte,defaultWidth:"wide"}),dayPeriod:Ki({values:Jte,defaultWidth:"wide",formattingValues:ere,defaultFormattingWidth:"wide"})};function Qi(r){return(e,t={})=>{const n=t.width,a=n&&r.matchPatterns[n]||r.matchPatterns[r.defaultMatchWidth],i=e.match(a);if(!i)return null;const o=i[0],s=n&&r.parsePatterns[n]||r.parsePatterns[r.defaultParseWidth],l=Array.isArray(s)?are(s,f=>f.test(o)):nre(s,f=>f.test(o));let u;u=r.valueCallback?r.valueCallback(l):l,u=t.valueCallback?t.valueCallback(u):u;const c=e.slice(o.length);return{value:u,rest:c}}}function nre(r,e){for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&e(r[t]))return t}function are(r,e){for(let t=0;t<r.length;t++)if(e(r[t]))return t}function mH(r){return(e,t={})=>{const n=e.match(r.matchPattern);if(!n)return null;const a=n[0],i=e.match(r.parsePattern);if(!i)return null;let o=r.valueCallback?r.valueCallback(i[0]):i[0];o=t.valueCallback?t.valueCallback(o):o;const s=e.slice(a.length);return{value:o,rest:s}}}const ire=/^(\d+)(th|st|nd|rd)?/i,ore=/\d+/i,sre={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},lre={any:[/^b/i,/^(a|c)/i]},ure={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},cre={any:[/1/i,/2/i,/3/i,/4/i]},fre={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},dre={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},hre={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},vre={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},pre={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},gre={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},mre={ordinalNumber:mH({matchPattern:ire,parsePattern:ore,valueCallback:r=>parseInt(r,10)}),era:Qi({matchPatterns:sre,defaultMatchWidth:"wide",parsePatterns:lre,defaultParseWidth:"any"}),quarter:Qi({matchPatterns:ure,defaultMatchWidth:"wide",parsePatterns:cre,defaultParseWidth:"any",valueCallback:r=>r+1}),month:Qi({matchPatterns:fre,defaultMatchWidth:"wide",parsePatterns:dre,defaultParseWidth:"any"}),day:Qi({matchPatterns:hre,defaultMatchWidth:"wide",parsePatterns:vre,defaultParseWidth:"any"}),dayPeriod:Qi({matchPatterns:pre,defaultMatchWidth:"any",parsePatterns:gre,defaultParseWidth:"any"})},yH={code:"en-US",formatDistance:Hte,formatLong:Yte,formatRelative:Xte,localize:rre,match:mre,options:{weekStartsOn:0,firstWeekContainsDate:1}};function yre(r,e){const t=Vr(r,e==null?void 0:e.in);return Mte(t,Vte(t))+1}function xre(r,e){const t=Vr(r,e==null?void 0:e.in),n=+t1(t)-+Dte(t);return Math.round(n/hH)+1}function xH(r,e){var c,f,h,v;const t=Vr(r,e==null?void 0:e.in),n=t.getFullYear(),a=hm(),i=(e==null?void 0:e.firstWeekContainsDate)??((f=(c=e==null?void 0:e.locale)==null?void 0:c.options)==null?void 0:f.firstWeekContainsDate)??a.firstWeekContainsDate??((v=(h=a.locale)==null?void 0:h.options)==null?void 0:v.firstWeekContainsDate)??1,o=ho((e==null?void 0:e.in)||r,0);o.setFullYear(n+1,0,i),o.setHours(0,0,0,0);const s=Ag(o,e),l=ho((e==null?void 0:e.in)||r,0);l.setFullYear(n,0,i),l.setHours(0,0,0,0);const u=Ag(l,e);return+t>=+s?n+1:+t>=+u?n:n-1}function bre(r,e){var s,l,u,c;const t=hm(),n=(e==null?void 0:e.firstWeekContainsDate)??((l=(s=e==null?void 0:e.locale)==null?void 0:s.options)==null?void 0:l.firstWeekContainsDate)??t.firstWeekContainsDate??((c=(u=t.locale)==null?void 0:u.options)==null?void 0:c.firstWeekContainsDate)??1,a=xH(r,e),i=ho((e==null?void 0:e.in)||r,0);return i.setFullYear(a,0,n),i.setHours(0,0,0,0),Ag(i,e)}function _re(r,e){const t=Vr(r,e==null?void 0:e.in),n=+Ag(t,e)-+bre(t,e);return Math.round(n/hH)+1}function Xt(r,e){const t=r<0?"-":"",n=Math.abs(r).toString().padStart(e,"0");return t+n}const nl={y(r,e){const t=r.getFullYear(),n=t>0?t:1-t;return Xt(e==="yy"?n%100:n,e.length)},M(r,e){const t=r.getMonth();return e==="M"?String(t+1):Xt(t+1,2)},d(r,e){return Xt(r.getDate(),e.length)},a(r,e){const t=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(r,e){return Xt(r.getHours()%12||12,e.length)},H(r,e){return Xt(r.getHours(),e.length)},m(r,e){return Xt(r.getMinutes(),e.length)},s(r,e){return Xt(r.getSeconds(),e.length)},S(r,e){const t=e.length,n=r.getMilliseconds(),a=Math.trunc(n*Math.pow(10,t-3));return Xt(a,e.length)}},Kf={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},uP={G:function(r,e,t){const n=r.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(r,e,t){if(e==="yo"){const n=r.getFullYear(),a=n>0?n:1-n;return t.ordinalNumber(a,{unit:"year"})}return nl.y(r,e)},Y:function(r,e,t,n){const a=xH(r,n),i=a>0?a:1-a;if(e==="YY"){const o=i%100;return Xt(o,2)}return e==="Yo"?t.ordinalNumber(i,{unit:"year"}):Xt(i,e.length)},R:function(r,e){const t=gH(r);return Xt(t,e.length)},u:function(r,e){const t=r.getFullYear();return Xt(t,e.length)},Q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return Xt(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return Xt(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(r,e,t){const n=r.getMonth();switch(e){case"M":case"MM":return nl.M(r,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(r,e,t){const n=r.getMonth();switch(e){case"L":return String(n+1);case"LL":return Xt(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(r,e,t,n){const a=_re(r,n);return e==="wo"?t.ordinalNumber(a,{unit:"week"}):Xt(a,e.length)},I:function(r,e,t){const n=xre(r);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):Xt(n,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):nl.d(r,e)},D:function(r,e,t){const n=yre(r);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):Xt(n,e.length)},E:function(r,e,t){const n=r.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(r,e,t,n){const a=r.getDay(),i=(a-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return Xt(i,2);case"eo":return t.ordinalNumber(i,{unit:"day"});case"eee":return t.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(a,{width:"short",context:"formatting"});case"eeee":default:return t.day(a,{width:"wide",context:"formatting"})}},c:function(r,e,t,n){const a=r.getDay(),i=(a-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return Xt(i,e.length);case"co":return t.ordinalNumber(i,{unit:"day"});case"ccc":return t.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(a,{width:"narrow",context:"standalone"});case"cccccc":return t.day(a,{width:"short",context:"standalone"});case"cccc":default:return t.day(a,{width:"wide",context:"standalone"})}},i:function(r,e,t){const n=r.getDay(),a=n===0?7:n;switch(e){case"i":return String(a);case"ii":return Xt(a,e.length);case"io":return t.ordinalNumber(a,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(r,e,t){const a=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(r,e,t){const n=r.getHours();let a;switch(n===12?a=Kf.noon:n===0?a=Kf.midnight:a=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(r,e,t){const n=r.getHours();let a;switch(n>=17?a=Kf.evening:n>=12?a=Kf.afternoon:n>=4?a=Kf.morning:a=Kf.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(r,e,t){if(e==="ho"){let n=r.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return nl.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):nl.H(r,e)},K:function(r,e,t){const n=r.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):Xt(n,e.length)},k:function(r,e,t){let n=r.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):Xt(n,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):nl.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):nl.s(r,e)},S:function(r,e){return nl.S(r,e)},X:function(r,e,t){const n=r.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return fP(n);case"XXXX":case"XX":return rc(n);case"XXXXX":case"XXX":default:return rc(n,":")}},x:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"x":return fP(n);case"xxxx":case"xx":return rc(n);case"xxxxx":case"xxx":default:return rc(n,":")}},O:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+cP(n,":");case"OOOO":default:return"GMT"+rc(n,":")}},z:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+cP(n,":");case"zzzz":default:return"GMT"+rc(n,":")}},t:function(r,e,t){const n=Math.trunc(+r/1e3);return Xt(n,e.length)},T:function(r,e,t){return Xt(+r,e.length)}};function cP(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=Math.trunc(n/60),i=n%60;return i===0?t+String(a):t+String(a)+e+Xt(i,2)}function fP(r,e){return r%60===0?(r>0?"-":"+")+Xt(Math.abs(r)/60,2):rc(r,e)}function rc(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=Xt(Math.trunc(n/60),2),i=Xt(n%60,2);return t+a+e+i}const dP=(r,e)=>{switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},bH=(r,e)=>{switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Sre=(r,e)=>{const t=r.match(/(P+)(p+)?/)||[],n=t[1],a=t[2];if(!a)return dP(r,e);let i;switch(n){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",dP(n,e)).replace("{{time}}",bH(a,e))},wre={p:bH,P:Sre},Tre=/^D+$/,Cre=/^Y+$/,Are=["D","DD","YY","YYYY"];function Mre(r){return Tre.test(r)}function Dre(r){return Cre.test(r)}function Nre(r,e,t){const n=Lre(r,e,t);if(console.warn(n),Are.includes(r))throw new RangeError(n)}function Lre(r,e,t){const n=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const kre=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Rre=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Ere=/^'([^]*?)'?$/,Ire=/''/g,Ore=/[a-zA-Z]/;function Pre(r,e,t){var c,f,h,v,g,y,b,_;const n=hm(),a=(t==null?void 0:t.locale)??n.locale??yH,i=(t==null?void 0:t.firstWeekContainsDate)??((f=(c=t==null?void 0:t.locale)==null?void 0:c.options)==null?void 0:f.firstWeekContainsDate)??n.firstWeekContainsDate??((v=(h=n.locale)==null?void 0:h.options)==null?void 0:v.firstWeekContainsDate)??1,o=(t==null?void 0:t.weekStartsOn)??((y=(g=t==null?void 0:t.locale)==null?void 0:g.options)==null?void 0:y.weekStartsOn)??n.weekStartsOn??((_=(b=n.locale)==null?void 0:b.options)==null?void 0:_.weekStartsOn)??0,s=Vr(r,t==null?void 0:t.in);if(!kte(s))throw new RangeError("Invalid time value");let l=e.match(Rre).map(S=>{const T=S[0];if(T==="p"||T==="P"){const C=wre[T];return C(S,a.formatLong)}return S}).join("").match(kre).map(S=>{if(S==="''")return{isToken:!1,value:"'"};const T=S[0];if(T==="'")return{isToken:!1,value:jre(S)};if(uP[T])return{isToken:!0,value:S};if(T.match(Ore))throw new RangeError("Format string contains an unescaped latin alphabet character `"+T+"`");return{isToken:!1,value:S}});a.localize.preprocessor&&(l=a.localize.preprocessor(s,l));const u={firstWeekContainsDate:i,weekStartsOn:o,locale:a};return l.map(S=>{if(!S.isToken)return S.value;const T=S.value;(!(t!=null&&t.useAdditionalWeekYearTokens)&&Dre(T)||!(t!=null&&t.useAdditionalDayOfYearTokens)&&Mre(T))&&Nre(T,e,String(r));const C=uP[T[0]];return C(s,T,a.localize,u)}).join("")}function jre(r){const e=r.match(Ere);return e?e[1].replace(Ire,"'"):r}function zre(r,e,t){const n=hm(),a=(t==null?void 0:t.locale)??n.locale??yH,i=2520,o=Sx(r,e);if(isNaN(o))throw new RangeError("Invalid time value");const s=Object.assign({},t,{addSuffix:t==null?void 0:t.addSuffix,comparison:o}),[l,u]=Cb(t==null?void 0:t.in,...o>0?[e,r]:[r,e]),c=Bte(u,l),f=(r1(u)-r1(l))/1e3,h=Math.round((c-f)/60);let v;if(h<2)return t!=null&&t.includeSeconds?c<5?a.formatDistance("lessThanXSeconds",5,s):c<10?a.formatDistance("lessThanXSeconds",10,s):c<20?a.formatDistance("lessThanXSeconds",20,s):c<40?a.formatDistance("halfAMinute",0,s):c<60?a.formatDistance("lessThanXMinutes",1,s):a.formatDistance("xMinutes",1,s):h===0?a.formatDistance("lessThanXMinutes",1,s):a.formatDistance("xMinutes",h,s);if(h<45)return a.formatDistance("xMinutes",h,s);if(h<90)return a.formatDistance("aboutXHours",1,s);if(h<oP){const g=Math.round(h/60);return a.formatDistance("aboutXHours",g,s)}else{if(h<i)return a.formatDistance("xDays",1,s);if(h<e0){const g=Math.round(h/oP);return a.formatDistance("xDays",g,s)}else if(h<e0*2)return v=Math.round(h/e0),a.formatDistance("aboutXMonths",v,s)}if(v=zte(u,l),v<12){const g=Math.round(h/e0);return a.formatDistance("xMonths",g,s)}else{const g=v%12,y=Math.trunc(v/12);return g<3?a.formatDistance("aboutXYears",y,s):g<9?a.formatDistance("overXYears",y,s):a.formatDistance("almostXYears",y+1,s)}}function kD(r,e){return zre(r,Nte(r),e)}function Bre(r,e){const t=()=>ho(e==null?void 0:e.in,NaN),a=Fre(r);let i;if(a.date){const u=Ure(a.date,2);i=Wre(u.restDateString,u.year)}if(!i||isNaN(+i))return t();const o=+i;let s=0,l;if(a.time&&(s=Yre(a.time),isNaN(s)))return t();if(a.timezone){if(l=$re(a.timezone),isNaN(l))return t()}else{const u=new Date(o+s),c=Vr(0,e==null?void 0:e.in);return c.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),c.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),c}return Vr(o+s+l,e==null?void 0:e.in)}const t0={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Vre=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Gre=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Hre=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Fre(r){const e={},t=r.split(t0.dateTimeDelimiter);let n;if(t.length>2)return e;if(/:/.test(t[0])?n=t[0]:(e.date=t[0],n=t[1],t0.timeZoneDelimiter.test(e.date)&&(e.date=r.split(t0.timeZoneDelimiter)[0],n=r.substr(e.date.length,r.length))),n){const a=t0.timezone.exec(n);a?(e.time=n.replace(a[1],""),e.timezone=a[1]):e.time=n}return e}function Ure(r,e){const t=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),n=r.match(t);if(!n)return{year:NaN,restDateString:""};const a=n[1]?parseInt(n[1]):null,i=n[2]?parseInt(n[2]):null;return{year:i===null?a:i*100,restDateString:r.slice((n[1]||n[2]).length)}}function Wre(r,e){if(e===null)return new Date(NaN);const t=r.match(Vre);if(!t)return new Date(NaN);const n=!!t[4],a=Kv(t[1]),i=Kv(t[2])-1,o=Kv(t[3]),s=Kv(t[4]),l=Kv(t[5])-1;if(n)return Qre(e,s,l)?Xre(e,s,l):new Date(NaN);{const u=new Date(0);return!Zre(e,i,o)||!Kre(e,a)?new Date(NaN):(u.setUTCFullYear(e,i,Math.max(a,o)),u)}}function Kv(r){return r?parseInt(r):1}function Yre(r){const e=r.match(Gre);if(!e)return NaN;const t=Iw(e[1]),n=Iw(e[2]),a=Iw(e[3]);return Jre(t,n,a)?t*pH+n*vH+a*1e3:NaN}function Iw(r){return r&&parseFloat(r.replace(",","."))||0}function $re(r){if(r==="Z")return 0;const e=r.match(Hre);if(!e)return 0;const t=e[1]==="+"?-1:1,n=parseInt(e[2]),a=e[3]&&parseInt(e[3])||0;return ene(n,a)?t*(n*pH+a*vH):NaN}function Xre(r,e,t){const n=new Date(0);n.setUTCFullYear(r,0,4);const a=n.getUTCDay()||7,i=(e-1)*7+t+1-a;return n.setUTCDate(n.getUTCDate()+i),n}const qre=[31,null,31,30,31,30,31,31,30,31,30,31];function _H(r){return r%400===0||r%4===0&&r%100!==0}function Zre(r,e,t){return e>=0&&e<=11&&t>=1&&t<=(qre[e]||(_H(r)?29:28))}function Kre(r,e){return e>=1&&e<=(_H(r)?366:365)}function Qre(r,e,t){return e>=1&&e<=53&&t>=0&&t<=6}function Jre(r,e,t){return r===24?e===0&&t===0:t>=0&&t<60&&e>=0&&e<60&&r>=0&&r<25}function ene(r,e){return e>=0&&e<=59}const tne={lessThanXSeconds:{one:"1초 미만",other:"{{count}}초 미만"},xSeconds:{one:"1초",other:"{{count}}초"},halfAMinute:"30초",lessThanXMinutes:{one:"1분 미만",other:"{{count}}분 미만"},xMinutes:{one:"1분",other:"{{count}}분"},aboutXHours:{one:"약 1시간",other:"약 {{count}}시간"},xHours:{one:"1시간",other:"{{count}}시간"},xDays:{one:"1일",other:"{{count}}일"},aboutXWeeks:{one:"약 1주",other:"약 {{count}}주"},xWeeks:{one:"1주",other:"{{count}}주"},aboutXMonths:{one:"약 1개월",other:"약 {{count}}개월"},xMonths:{one:"1개월",other:"{{count}}개월"},aboutXYears:{one:"약 1년",other:"약 {{count}}년"},xYears:{one:"1년",other:"{{count}}년"},overXYears:{one:"1년 이상",other:"{{count}}년 이상"},almostXYears:{one:"거의 1년",other:"거의 {{count}}년"}},rne=(r,e,t)=>{let n;const a=tne[r];return typeof a=="string"?n=a:e===1?n=a.one:n=a.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?n+" 후":n+" 전":n},nne={full:"y년 M월 d일 EEEE",long:"y년 M월 d일",medium:"y.MM.dd",short:"y.MM.dd"},ane={full:"a H시 mm분 ss초 zzzz",long:"a H:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},ine={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},one={date:Hd({formats:nne,defaultWidth:"full"}),time:Hd({formats:ane,defaultWidth:"full"}),dateTime:Hd({formats:ine,defaultWidth:"full"})},sne={lastWeek:"'지난' eeee p",yesterday:"'어제' p",today:"'오늘' p",tomorrow:"'내일' p",nextWeek:"'다음' eeee p",other:"P"},lne=(r,e,t,n)=>sne[r],une={narrow:["BC","AD"],abbreviated:["BC","AD"],wide:["기원전","서기"]},cne={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1분기","2분기","3분기","4분기"]},fne={narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],abbreviated:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],wide:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"]},dne={narrow:["일","월","화","수","목","금","토"],short:["일","월","화","수","목","금","토"],abbreviated:["일","월","화","수","목","금","토"],wide:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"]},hne={narrow:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"},abbreviated:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"},wide:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"}},vne={narrow:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"},abbreviated:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"},wide:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"}},pne=(r,e)=>{const t=Number(r);switch(String(e==null?void 0:e.unit)){case"minute":case"second":return String(t);case"date":return t+"일";default:return t+"번째"}},gne={ordinalNumber:pne,era:Ki({values:une,defaultWidth:"wide"}),quarter:Ki({values:cne,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Ki({values:fne,defaultWidth:"wide"}),day:Ki({values:dne,defaultWidth:"wide"}),dayPeriod:Ki({values:hne,defaultWidth:"wide",formattingValues:vne,defaultFormattingWidth:"wide"})},mne=/^(\d+)(일|번째)?/i,yne=/\d+/i,xne={narrow:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(기원전|서기)/i},bne={any:[/^(bc|기원전)/i,/^(ad|서기)/i]},_ne={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234]사?분기/i},Sne={any:[/1/i,/2/i,/3/i,/4/i]},wne={narrow:/^(1[012]|[123456789])/,abbreviated:/^(1[012]|[123456789])월/i,wide:/^(1[012]|[123456789])월/i},Tne={any:[/^1월?$/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},Cne={narrow:/^[일월화수목금토]/,short:/^[일월화수목금토]/,abbreviated:/^[일월화수목금토]/,wide:/^[일월화수목금토]요일/},Ane={any:[/^일/,/^월/,/^화/,/^수/,/^목/,/^금/,/^토/]},Mne={any:/^(am|pm|오전|오후|자정|정오|아침|저녁|밤)/i},Dne={any:{am:/^(am|오전)/i,pm:/^(pm|오후)/i,midnight:/^자정/i,noon:/^정오/i,morning:/^아침/i,afternoon:/^오후/i,evening:/^저녁/i,night:/^밤/i}},Nne={ordinalNumber:mH({matchPattern:mne,parsePattern:yne,valueCallback:r=>parseInt(r,10)}),era:Qi({matchPatterns:xne,defaultMatchWidth:"wide",parsePatterns:bne,defaultParseWidth:"any"}),quarter:Qi({matchPatterns:_ne,defaultMatchWidth:"wide",parsePatterns:Sne,defaultParseWidth:"any",valueCallback:r=>r+1}),month:Qi({matchPatterns:wne,defaultMatchWidth:"wide",parsePatterns:Tne,defaultParseWidth:"any"}),day:Qi({matchPatterns:Cne,defaultMatchWidth:"wide",parsePatterns:Ane,defaultParseWidth:"any"}),dayPeriod:Qi({matchPatterns:Mne,defaultMatchWidth:"any",parsePatterns:Dne,defaultParseWidth:"any"})},Ab={code:"ko",formatDistance:rne,formatLong:one,formatRelative:lne,localize:gne,match:Nne,options:{weekStartsOn:0,firstWeekContainsDate:1}},RD=Y.createContext({sticky:!1});function vo({children:r,minWidth:e,stickyHeader:t=!1,sort:n,onSort:a,className:i,...o}){return m.jsx(RD.Provider,{value:{sticky:t,sort:n,onSort:a},children:m.jsx("div",{className:Qe("border border-border rounded-lg",t?"overflow-clip":"overflow-x-auto",i),...o,children:m.jsx("table",{className:"w-full text-[12px] border-collapse",style:e?{minWidth:e}:void 0,children:r})})})}function po({children:r,className:e,...t}){const{sticky:n}=Y.useContext(RD);return m.jsx("thead",{className:Qe(n&&"sticky z-[5]",e),style:n?{top:"var(--page-header-h, 0px)",backgroundColor:"var(--page-bg, white)"}:void 0,...t,children:m.jsx("tr",{className:"border-b border-border bg-muted/40 text-[11px] font-semibold text-muted-foreground",children:r})})}function je({align:r="left",sortKey:e,className:t,children:n,onClick:a,...i}){const{sort:o,onSort:s}=Y.useContext(RD),l=!!e&&!!s,c=l&&(o==null?void 0:o.key)===e?o==null?void 0:o.dir:null;function f(v){l&&s(e),a==null||a(v)}const h=r==="right"?"text-right":r==="center"?"text-center":"text-left";return m.jsx("th",{className:Qe("px-3 py-2 whitespace-nowrap",h,l&&"cursor-pointer select-none hover:text-foreground transition-colors",t),onClick:l?f:a,...i,children:l?m.jsxs("span",{className:Qe("inline-flex items-center gap-1",r==="right"?"justify-end":""),children:[n,c==="asc"?m.jsx(FJ,{size:12,className:"shrink-0"}):c==="desc"?m.jsx(OJ,{size:12,className:"shrink-0"}):m.jsx(GJ,{size:12,className:"shrink-0 opacity-30"})]}):n})}function Lne(r,e="asc"){const[t,n]=Y.useState(null),a=Y.useCallback(o=>{n(s=>(s==null?void 0:s.key)===o?s.dir==="asc"?{key:o,dir:"desc"}:null:{key:o,dir:"asc"})},[]),i=Y.useCallback((o,s)=>{if(!t)return o;const{key:l,dir:u}=t;return[...o].sort((c,f)=>{const h=s(c,l),v=s(f,l);if(typeof h=="number"&&typeof v=="number")return u==="asc"?h-v:v-h;const g=String(h??""),y=String(v??"");return u==="asc"?g.localeCompare(y):y.localeCompare(g)})},[t]);return{sort:t,onSort:a,sortData:i}}function kne(r){if(!r)return"-";try{return Pre(Bre(r),"MM.dd HH:mm",{locale:Ab})}catch{return r.slice(0,10)}}function Rne({rows:r}){return m.jsxs(vo,{minWidth:"520px",stickyHeader:!0,children:[m.jsxs(po,{children:[m.jsx(je,{children:"채널"}),m.jsx(je,{children:"상품"}),m.jsx(je,{className:"w-[90px]",children:"주문번호"}),m.jsx(je,{align:"center",children:"상태"}),m.jsx(je,{align:"right",children:"금액"}),m.jsx(je,{align:"right",children:"주문일"})]}),m.jsxs("tbody",{className:"bg-card",children:[r.map((e,t)=>{const n=e.unitPrice!=null?(e.unitPrice*e.quantity).toLocaleString():e.totalAmount>0?e.totalAmount.toLocaleString():null;return m.jsxs("tr",{className:Qe("border-b border-border/60",t%2!==0&&"bg-muted/5"),children:[m.jsx("td",{className:"px-3 py-2 whitespace-nowrap",children:hr[e.channel]??e.channel}),m.jsxs("td",{className:"px-3 py-2 max-w-[280px]",title:e.productName,children:[m.jsx("div",{className:"truncate",children:e.productName}),e.channelProductOptionName&&m.jsx("div",{className:"text-[10px] text-muted-foreground truncate",children:e.channelProductOptionName})]}),m.jsx("td",{className:"px-3 py-2 text-muted-foreground font-mono text-[10px] w-[90px] max-w-[90px] truncate",title:e.channelOrderId,children:e.channelOrderId}),m.jsx("td",{className:"px-3 py-2 text-center",children:m.jsxs("div",{className:"flex items-center justify-center gap-1",children:[m.jsx(lH,{status:e.status}),e.excluded&&m.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[9px] font-medium bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400",title:e.excludedReason??"제외된 주문",children:"제외"})]})}),m.jsx("td",{className:"px-3 py-2 text-right",children:n!=null?`${n}원`:"-"}),m.jsx("td",{className:"px-3 py-2 text-muted-foreground text-right",children:kne(e.orderedAt)})]},e.key)}),r.length===0&&m.jsx("tr",{children:m.jsx("td",{colSpan:6,className:"px-3 py-8 text-center text-muted-foreground text-[13px]",children:"필터 조건에 맞는 주문이 없습니다."})})]})]})}const Ene=50,Ine=["cafe24","coupang","smartstore"],One=Object.keys(sH);function Pne(r){return(r.items.length>0?r.items:[null]).map((t,n)=>{var a;return{key:`${r.channelOrderId}-${n}`,channel:r.channel,channelOrderId:r.channelOrderId,productName:(t==null?void 0:t.productName)??"(no items)",optionLabel:t==null?void 0:t.optionLabel,quantity:(t==null?void 0:t.quantity)??0,unitPrice:t==null?void 0:t.unitPrice,channelProductOptionName:t==null?void 0:t.channelProductOptionName,totalAmount:r.totalAmount,status:r.status,orderedAt:r.orderedAt,buyerName:((a=r.buyer)==null?void 0:a.name)??"",excluded:r.excluded,excludedReason:r.excludedReason}})}function hP(r,e){const t=new Set(r);return t.has(e)?t.delete(e):t.add(e),t}function jne({orders:r,total:e,isLoading:t=!1,error:n,page:a,pageSize:i=Ene,onPageChange:o,onDateChange:s,dateFrom:l,dateTo:u,onChannelChange:c,onStatusChange:f,onProductSearchChange:h,syncing:v=!1,syncResult:g,onSync:y,lastSyncedAt:b,aggregates:_,syncDisabled:S=!1}){const[T,C]=Y.useState(""),[M,D]=Y.useState(""),L=l!==void 0||u!==void 0,k=L?l??"":T,R=L?u??"":M,[E,I]=Y.useState(0),z=a!==void 0,j=z?a:E,G=Math.ceil(e/i),[U,O]=Y.useState(new Set),[H,F]=Y.useState(new Set),[$,B]=Y.useState(""),X=Y.useMemo(()=>c?Ine:[...new Set(r.map(Ee=>Ee.channel))].sort(),[r,c]),q=Y.useMemo(()=>f?One:[...new Set(r.map(Ee=>Ee.status))].sort(),[r,f]),Q=Y.useMemo(()=>{const bt=r.filter(Mt=>!(!c&&U.size>0&&!U.has(Mt.channel)||!f&&H.size>0&&!H.has(Mt.status))).flatMap(Pne);return!h&&$?bt.filter(Mt=>Mt.productName.toLowerCase().includes($.toLowerCase())):bt},[r,U,H,$,c,f,h]),ne=Y.useMemo(()=>{const Ee=new Set;let bt=0,Mt=0;for(const ar of Q){const Ur=`${ar.channel}:${ar.channelOrderId}`;Ee.has(Ur)||(Ee.add(Ur),Ste(ar.status)&&(bt+=ar.totalAmount)),Mt+=ar.quantity}return{orderCount:Ee.size,totalRevenue:bt,totalQty:Mt}},[Q]),fe=U.size>0||H.size>0||!!$;function ve(Ee){const bt=hP(U,Ee);O(bt),c==null||c([...bt])}function Se(Ee){const bt=hP(H,Ee);F(bt),f==null||f([...bt])}function ge(Ee){B(Ee),h==null||h(Ee)}function he(){O(new Set),F(new Set),B(""),c==null||c([]),f==null||f([]),h==null||h("")}function Ne(Ee,bt){L||(C(Ee),D(bt)),z||I(0),s==null||s(Ee,bt)}function xe(Ee){z||I(Ee),o==null||o(Ee)}const Te=!!(c||f||h),$e=j*i+1,We=j*i+r.length,lt=fe&&!Te?`${Q.length.toLocaleString()} / ${e.toLocaleString()}건`:G>1?`${$e.toLocaleString()}~${We.toLocaleString()} / 전체 ${e.toLocaleString()}건`:`총 ${e.toLocaleString()}건`,vt=Y.useRef(null);return Y.useEffect(()=>{const Ee=vt.current,bt=Ee==null?void 0:Ee.closest(".dashboard main");if(!Ee||!bt)return;const Mt=new ResizeObserver(()=>{bt.style.setProperty("--page-header-h",`${Ee.offsetHeight}px`)});return Mt.observe(Ee),()=>Mt.disconnect()},[]),m.jsxs("div",{children:[m.jsxs("div",{ref:vt,className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-4 sticky top-0 z-10 py-4 -mt-4 md:-mt-7 md:pt-7",style:{backgroundColor:"var(--page-bg, transparent)"},children:[m.jsx("h2",{className:"text-xl font-medium",children:"주문 현황"}),m.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m.jsx("span",{className:"text-[12px] text-muted-foreground",children:lt}),(()=>{const Ee=g??(Tg(b)?`마지막 동기화: ${Tg(b)}`:null);return Ee?m.jsx("span",{className:"text-[11px] text-muted-foreground",children:Ee}):null})(),y&&m.jsx(e1,{onSync:y,syncing:v,syncResult:g,disabled:S})]})]}),m.jsx(DD,{from:k,to:R,onChange:Ne,className:"mb-4"}),m.jsx(Tte,{channelFilter:U,statusFilter:H,productSearch:$,channelOptions:X,statusOptions:q,onChannelToggle:ve,onChannelClear:()=>{O(new Set),c==null||c([])},onStatusToggle:Se,onStatusClear:()=>{F(new Set),f==null||f([])},onProductSearch:ge,onReset:he}),!t&&!n&&(r.length>0||_)&&(()=>{const Ee=_??ne;return m.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2 mb-3",children:[m.jsxs("div",{className:"border border-border rounded-lg px-3 py-2.5 bg-card",children:[m.jsxs("p",{className:"text-[10px] text-muted-foreground mb-0.5 flex items-center gap-1",children:["전체 주문 수",m.jsx(Zt,{size:10,content:m.jsx(sr,{metric:"전체주문",rows:lr.전체주문,summary:"필터 조건에 해당하는 모든 주문 수"})})]}),m.jsxs("p",{className:"text-sm font-semibold",children:[Ee.orderCount.toLocaleString(),"건"]})]}),m.jsxs("div",{className:"border border-border rounded-lg px-3 py-2.5 bg-card",children:[m.jsxs("p",{className:"text-[10px] text-muted-foreground mb-0.5 flex items-center gap-1",children:["총 수량",m.jsx(Zt,{size:10,content:m.jsx(sr,{metric:"전체수량",rows:lr.전체수량,summary:"필터 조건에 해당하는 모든 주문의 수량 합계"})})]}),m.jsxs("p",{className:"text-sm font-semibold",children:[Ee.totalQty.toLocaleString(),"개"]})]}),m.jsxs("div",{className:"border border-border rounded-lg px-3 py-2.5 bg-card",children:[m.jsxs("p",{className:"text-[10px] text-muted-foreground mb-0.5 flex items-center gap-1",children:["합계 금액",m.jsx(Zt,{size:10,content:m.jsx(sr,{metric:"매출",rows:lr.매출,summary:"취소·반품·미결제 제외 주문의 최종 결제 금액 합계"})})]}),m.jsxs("p",{className:"text-sm font-semibold",children:[Ee.totalRevenue.toLocaleString(),"원"]})]})]})})(),t?m.jsx("div",{className:"text-sm text-muted-foreground py-8 text-center",children:"불러오는 중..."}):n?m.jsx("div",{className:"text-sm text-destructive py-8 text-center",children:"주문 조회 실패"}):r.length===0?m.jsxs("div",{className:"border border-dashed border-border rounded-lg p-12 text-center text-muted-foreground text-sm",children:["주문 데이터가 없습니다.",m.jsxs("div",{className:"text-[11px] mt-2 space-y-1",children:[m.jsxs("p",{children:["위의 ",m.jsx("strong",{children:"주문 동기화"})," 버튼을 눌러 연결된 채널에서 주문을 가져오거나,"]}),m.jsxs("p",{children:[m.jsx("code",{className:"bg-muted px-1 py-0.5 rounded text-[10px]",children:"sppt import"}),"로 CSV/엑셀 파일을 불러올 수 있습니다."]})]})]}):m.jsx(Rne,{rows:Q}),G>1&&(Te||!fe)&&m.jsxs("div",{className:"flex items-center justify-center gap-2 mt-4",children:[m.jsx("button",{type:"button",onClick:()=>xe(Math.max(0,j-1)),disabled:j===0,className:"px-3 py-1.5 text-xs rounded disabled:opacity-40 border border-border",children:"이전"}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:[j+1," / ",G]}),m.jsx("button",{type:"button",onClick:()=>xe(Math.min(G-1,j+1)),disabled:j>=G-1,className:"px-3 py-1.5 text-xs rounded disabled:opacity-40 border border-border",children:"다음"})]}),m.jsx("p",{className:"text-[11px] text-muted-foreground/50 mt-4",children:"주문 동기화 · CSV 불러오기 · 수동 입력 등 터미널에서 AI에게 요청할 수 있습니다."})]})}function zne(r){return r==null?"무제한":r>=1e8?`${(r/1e8).toFixed(0)}억원 미만`:r>=1e7?`${(r/1e7).toFixed(0)}천만원 미만`:`${r.toLocaleString()}원 미만`}function Ow({url:r}){return r?m.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"ml-1 inline-flex items-center gap-0.5 text-[9px] opacity-50 hover:opacity-100 transition-opacity",onClick:e=>e.stopPropagation(),children:[m.jsx(Qc,{size:8}),"출처"]}):null}function Qv({children:r}){return m.jsx("span",{className:"inline-flex items-center text-[10px] font-medium bg-muted text-muted-foreground px-1.5 py-0.5 rounded-full",children:r})}function Bne({d:r,annualRevenue:e,channel:t,onOpenConfig:n}){var C,M,D,L,k,R,E,I,z,j,G,U;const[a,i]=Y.useState(!1),[o,s]=Y.useState(!1),[l,u]=Y.useState(!1),[c,f]=Y.useState(!1),[h,v]=Y.useState(!1),g=r.categoryRates&&Object.keys(r.categoryRates).length>0,y=r.pgRateByPayment&&Object.keys(r.pgRateByPayment).length>0,b=r.revenueTiers&&r.revenueTiers.length>0,_=r.verticalRates&&Object.keys(r.verticalRates).length>0,S=r.discrepancyHints&&r.discrepancyHints.length>0,T=r.sources&&r.sources.length>0;return!g&&!y&&!b&&!_&&!S&&!T?null:m.jsx("tr",{className:"border-b border-border/40 bg-muted/5",children:m.jsx("td",{colSpan:7,className:"px-3 pb-3 pt-0",children:m.jsxs("div",{className:"flex flex-wrap gap-3 mt-2",children:[g&&m.jsxs("div",{className:"w-full",children:[m.jsxs("button",{type:"button",onClick:()=>i(O=>!O),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[a?m.jsx(cn,{size:11}):m.jsx(qr,{size:11}),m.jsx("span",{className:"font-medium text-foreground/70",children:"카테고리별 수수료"}),m.jsxs(Qv,{children:[Object.keys(r.categoryRates??{}).length,"개"]})]}),a&&m.jsx("div",{className:"mt-1.5 ml-4 border border-border/60 rounded overflow-hidden",children:m.jsxs("table",{className:"w-full text-[11px]",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"bg-muted/50 text-muted-foreground",children:[m.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"카테고리"}),m.jsx("th",{className:"px-2 py-1 text-right font-medium",children:"수수료율"})]})}),m.jsx("tbody",{children:Object.entries(r.categoryRates??{}).sort((O,H)=>O[1]-H[1]).map(([O,H])=>m.jsxs("tr",{className:"border-t border-border/40",children:[m.jsx("td",{className:"px-2 py-1",children:O}),m.jsxs("td",{className:"px-2 py-1 text-right font-medium",children:[H,"%"]})]},O))})]})})]}),y&&m.jsxs("div",{className:"w-full",children:[m.jsxs("button",{type:"button",onClick:()=>s(O=>!O),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[o?m.jsx(cn,{size:11}):m.jsx(qr,{size:11}),m.jsx("span",{className:"font-medium text-foreground/70",children:"결제수단별 PG 수수료"}),m.jsxs(Qv,{children:[Object.keys(r.pgRateByPayment??{}).length,"종"]})]}),o&&m.jsx("div",{className:"mt-1.5 ml-4 border border-border/60 rounded overflow-hidden",children:m.jsxs("table",{className:"w-full text-[11px]",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"bg-muted/50 text-muted-foreground",children:[m.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"결제수단"}),m.jsx("th",{className:"px-2 py-1 text-right font-medium",children:"수수료율"})]})}),m.jsx("tbody",{children:Object.entries(r.pgRateByPayment??{}).map(([O,H])=>m.jsxs("tr",{className:"border-t border-border/40",children:[m.jsx("td",{className:"px-2 py-1",children:H.label}),m.jsxs("td",{className:"px-2 py-1 text-right font-medium",children:[H.rate,"%"]})]},O))})]})})]}),b&&m.jsxs("div",{className:"w-full",children:[m.jsxs("button",{type:"button",onClick:()=>u(O=>!O),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[l?m.jsx(cn,{size:11}):m.jsx(qr,{size:11}),m.jsx("span",{className:"font-medium text-foreground/70",children:"매출 등급별 수수료"}),m.jsxs(Qv,{children:[(C=r.revenueTiers)==null?void 0:C.length,"구간"]}),(()=>{var F;const O=Cg(r.revenueTiers,e),H=O!=null?(F=r.revenueTiers)==null?void 0:F[O]:null;return H?m.jsxs("span",{className:"inline-flex items-center text-[10px] font-medium bg-emerald-100 text-emerald-700 dark:bg-emerald-950/50 dark:text-emerald-400 px-1.5 py-0.5 rounded-full ml-1",children:["현재 ",H.label]}):m.jsx("span",{className:"inline-flex items-center text-[10px] text-amber-500 px-1 ml-1",children:"연매출 미설정"})})()]}),l&&m.jsxs("div",{className:"mt-1.5 ml-4 border border-border/60 rounded overflow-hidden",children:[m.jsxs("table",{className:"w-full text-[11px]",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"bg-muted/50 text-muted-foreground",children:[m.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"등급"}),m.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"연매출 기준"}),((M=r.revenueTiers)==null?void 0:M.some(O=>O.pgRate!=null))&&m.jsx("th",{className:"px-2 py-1 text-right font-medium",children:"PG수수료"}),((D=r.revenueTiers)==null?void 0:D.some(O=>O.commissionRate!=null))&&m.jsx("th",{className:"px-2 py-1 text-right font-medium",children:"판매수수료"}),m.jsx("th",{className:"px-2 py-1 text-right font-medium",children:"적용"})]})}),m.jsx("tbody",{children:(L=r.revenueTiers)==null?void 0:L.map((O,H)=>{var B,X;const $=Cg(r.revenueTiers,e)===H;return m.jsxs("tr",{className:Qe("border-t border-border/40",$&&"bg-emerald-50 dark:bg-emerald-950/30"),children:[m.jsx("td",{className:Qe("px-2 py-1 font-medium",$&&"text-emerald-700 dark:text-emerald-400"),children:O.label}),m.jsx("td",{className:"px-2 py-1 text-muted-foreground",children:zne(O.maxAnnualRevenue)}),((B=r.revenueTiers)==null?void 0:B.some(q=>q.pgRate!=null))&&m.jsx("td",{className:Qe("px-2 py-1 text-right",$&&"font-semibold text-emerald-700 dark:text-emerald-400"),children:O.pgRate!=null?`${O.pgRate}%`:"-"}),((X=r.revenueTiers)==null?void 0:X.some(q=>q.commissionRate!=null))&&m.jsx("td",{className:Qe("px-2 py-1 text-right",$&&"font-semibold text-emerald-700 dark:text-emerald-400"),children:O.commissionRate!=null?`${O.commissionRate}%`:"-"}),m.jsx("td",{className:"px-2 py-1 text-right",children:$?m.jsx("span",{className:"text-emerald-600 dark:text-emerald-400 font-medium",children:"◀ 현재"}):null})]},O.label)})})]}),e==null&&m.jsxs("div",{className:"px-2 py-1.5 bg-amber-50/50 dark:bg-amber-950/20 border-t border-amber-200/50 dark:border-amber-900/50 text-[10px] text-amber-700 dark:text-amber-400",children:["연매출을 설정하면 현재 적용 등급을 확인할 수 있습니다."," ",n&&m.jsx("button",{type:"button",onClick:()=>n("annualRevenue"),className:"underline underline-offset-2 hover:text-foreground transition-colors",children:"연 매출 설정→"})]})]})]}),_&&m.jsxs("div",{className:"w-full",children:[m.jsxs("button",{type:"button",onClick:()=>f(O=>!O),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[c?m.jsx(cn,{size:11}):m.jsx(qr,{size:11}),m.jsx("span",{className:"font-medium text-foreground/70",children:"버티컬/솔루션 추가 수수료"}),m.jsxs(Qv,{children:[Object.keys(r.verticalRates??{}).length,"종"]})]}),c&&m.jsxs("div",{className:"mt-1.5 ml-4 border border-border/60 rounded overflow-hidden",children:[m.jsxs("table",{className:"w-full text-[11px]",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"bg-muted/50 text-muted-foreground",children:[m.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"서비스"}),m.jsx("th",{className:"px-2 py-1 text-right font-medium",children:"추가 수수료율"}),m.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"비고"})]})}),m.jsx("tbody",{children:Object.entries(r.verticalRates??{}).map(([O,H])=>m.jsxs("tr",{className:"border-t border-border/40",children:[m.jsx("td",{className:"px-2 py-1 font-medium",children:O}),m.jsxs("td",{className:"px-2 py-1 text-right text-red-500",children:["+",H.rate,"%"]}),m.jsx("td",{className:"px-2 py-1 text-muted-foreground",children:H.label})]},O))})]}),m.jsx("div",{className:"px-2 py-1.5 bg-muted/30 text-[10px] text-muted-foreground border-t border-border/40",children:"판매수수료에 중복 부과됩니다. 쇼핑라이브·렌탈 등 해당 서비스 이용 시만 적용."})]})]}),S&&m.jsxs("div",{className:"w-full",children:[m.jsxs("button",{type:"button",onClick:()=>v(O=>!O),className:"flex items-center gap-1 text-[11px] text-amber-600 dark:text-amber-400 hover:text-foreground transition-colors",children:[h?m.jsx(cn,{size:11}):m.jsx(qr,{size:11}),m.jsx("span",{className:"font-medium",children:"실정산 차이 발생 가능 원인"}),m.jsxs(Qv,{children:[(k=r.discrepancyHints)==null?void 0:k.length,"가지"]})]}),h&&m.jsxs("div",{className:"mt-1.5 ml-4 space-y-1.5",children:[((R=r.discrepancyHints)==null?void 0:R.some(O=>O.type==="fix"))&&m.jsxs("div",{className:"border border-emerald-200 dark:border-emerald-900/60 rounded bg-emerald-50/50 dark:bg-emerald-950/20 p-2",children:[m.jsx("p",{className:"text-[9px] font-semibold text-emerald-700 dark:text-emerald-400 uppercase tracking-wide mb-1",children:"설정으로 개선 가능"}),m.jsx("ul",{className:"space-y-1",children:(E=r.discrepancyHints)==null?void 0:E.filter(O=>O.type==="fix").map(O=>m.jsxs("li",{className:"text-[10px] text-emerald-800 dark:text-emerald-300 flex items-start gap-1.5",children:[m.jsx("span",{className:"shrink-0 mt-0.5",children:"✓"}),m.jsxs("span",{children:[O.text,O.configHref&&n&&m.jsx("button",{type:"button",onClick:()=>{const H=O.text.includes("annualRevenue");n(H?"annualRevenue":"channel",H?void 0:t)},className:"ml-1.5 underline underline-offset-2 text-emerald-600 dark:text-emerald-400 hover:text-foreground transition-colors",children:"설정 →"}),m.jsx(Ow,{url:O.source})]})]},O.text))})]}),((I=r.discrepancyHints)==null?void 0:I.some(O=>O.type==="auto"))&&m.jsxs("div",{className:"border border-blue-200 dark:border-blue-900/60 rounded bg-blue-50/50 dark:bg-blue-950/20 p-2",children:[m.jsx("p",{className:"text-[9px] font-semibold text-blue-700 dark:text-blue-400 uppercase tracking-wide mb-1",children:"데이터 수집 시 자동 처리"}),m.jsx("ul",{className:"space-y-1",children:(z=r.discrepancyHints)==null?void 0:z.filter(O=>O.type==="auto").map(O=>m.jsxs("li",{className:"text-[10px] text-blue-800 dark:text-blue-300 flex items-start gap-1.5",children:[m.jsx("span",{className:"shrink-0 mt-0.5",children:"↻"}),m.jsxs("span",{children:[O.text,m.jsx(Ow,{url:O.source})]})]},O.text))})]}),((j=r.discrepancyHints)==null?void 0:j.some(O=>O.type==="info"))&&m.jsxs("div",{className:"border border-amber-200 dark:border-amber-900/60 rounded bg-amber-50/50 dark:bg-amber-950/20 p-2",children:[m.jsx("p",{className:"text-[9px] font-semibold text-amber-600 dark:text-amber-500 uppercase tracking-wide mb-1",children:"계산 범위 밖 참고 항목"}),m.jsx("ul",{className:"space-y-1",children:(G=r.discrepancyHints)==null?void 0:G.filter(O=>O.type==="info").map(O=>m.jsxs("li",{className:"text-[10px] text-amber-700 dark:text-amber-400 flex gap-1.5",children:[m.jsx("span",{className:"shrink-0 mt-0.5",children:"·"}),m.jsxs("span",{children:[O.text,m.jsx(Ow,{url:O.source})]})]},O.text))})]})]})]}),T&&m.jsxs("div",{className:"flex flex-wrap gap-2 pt-0.5 border-t border-border/30 w-full",children:[m.jsx("span",{className:"text-[10px] text-muted-foreground/50 self-center",children:"출처"}),(U=r.sources)==null?void 0:U.map(O=>{const H=new URL(O).hostname.replace(/^www\./,"");return m.jsxs("a",{href:O,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-0.5 text-[10px] text-muted-foreground/70 hover:text-foreground transition-colors underline underline-offset-2",children:[m.jsx(Qc,{size:9}),H]},O)})]})]})})})}const Vne={card:"카드",transfer:"계좌이체",vbank:"가상계좌",virtual_account:"가상계좌",phone:"휴대폰",voucher:"상품권",brandpay:"브랜드페이",escrow:"에스크로",point:"포인트"};function Gne({data:r,isLoading:e,parentTotalRevenue:t}){return e?m.jsx("tr",{className:"border-b border-border/20 bg-muted/5",children:m.jsx("td",{colSpan:7,className:"px-4 py-1.5 text-[11px] text-muted-foreground text-center",children:"불러오는 중..."})}):r.length===0?m.jsx("tr",{className:"border-b border-border/20 bg-muted/5",children:m.jsx("td",{colSpan:7,className:"px-4 py-1.5 text-[11px] text-muted-foreground text-center",children:"결제수단 데이터 없음"})}):m.jsx(m.Fragment,{children:r.map(n=>{const a=n.paymentMethod?Vne[n.paymentMethod]??n.paymentMethod:"미지정",i=(n.avgCommissionRate*100).toFixed(1),o=t>0?(n.totalRevenue/t*100).toFixed(1):"0.0";return m.jsxs("tr",{className:"border-b border-border/20 bg-muted/5 hover:bg-muted/15 text-[11px]",children:[m.jsx("td",{className:"py-1 text-muted-foreground",style:{paddingLeft:48},children:m.jsx("span",{className:"whitespace-nowrap",children:a})}),m.jsxs("td",{className:"px-3 py-1 text-right text-muted-foreground whitespace-nowrap",children:[n.orderCount.toLocaleString(),"건"]}),m.jsx("td",{className:"px-3 py-1 text-right whitespace-nowrap",children:Ot(n.totalRevenue)}),m.jsx("td",{className:"px-3 py-1 text-right text-red-600 dark:text-red-400 whitespace-nowrap",children:Ot(n.feeAmount)}),m.jsxs("td",{className:"px-3 py-1 text-right text-muted-foreground whitespace-nowrap",children:[i,"%"]}),m.jsx("td",{className:"px-3 py-1 text-right text-emerald-600 dark:text-emerald-400 whitespace-nowrap",children:Ot(n.totalNet)}),m.jsxs("td",{className:"px-3 py-1 text-right text-muted-foreground whitespace-nowrap text-[11px]",children:[o,"%"]})]},n.paymentMethod??"__null__")})})}const Hne={tosspayments:"토스페이먼츠",naverpay:"네이버페이",cafe24pay:"카페24페이먼츠","kg-inicis":"KG이니시스",kakaopay:"카카오페이",danal:"다날","shopify-payments":"Shopify Payments","channel-integrated":"채널 통합",nicepay:"나이스페이"},Fne={tosspayments:"#3b82f6",naverpay:"#16a34a",cafe24pay:"#6366f1","kg-inicis":"#64748b",kakaopay:"#facc15",danal:"#f97316","shopify-payments":"#10b981","channel-integrated":"#a1a1aa",nicepay:"#0ea5e9"};function Une({pgProvider:r,channel:e,dateFrom:t,dateTo:n,pgTotalRevenue:a,fetchPaymentBreakdown:i}){const[o,s]=Y.useState([]),[l,u]=Y.useState(!1),c=Y.useRef(i);return c.current=i,Y.useEffect(()=>{let f=!1;return u(!0),c.current({channel:e,pgProvider:r,from:t,to:n}).then(h=>{f||s(h.paymentBreakdown)}).catch(()=>{f||s([])}).finally(()=>{f||u(!1)}),()=>{f=!0}},[e,r,t,n]),m.jsx(Gne,{data:o,isLoading:l,parentTotalRevenue:a})}function Wne({channel:r,dateFrom:e,dateTo:t,parentTotalRevenue:n,fetchPgBreakdown:a,fetchPaymentBreakdown:i}){const[o,s]=Y.useState([]),[l,u]=Y.useState(!1),[c,f]=Y.useState(null),h=Y.useRef(a);return h.current=a,Y.useEffect(()=>{let v=!1;return u(!0),f(null),h.current({channel:r,from:e,to:t}).then(g=>{v||s(g.pgBreakdown)}).catch(()=>{v||s([])}).finally(()=>{v||u(!1)}),()=>{v=!0}},[r,e,t]),l?m.jsx("tr",{className:"border-b border-border/30 bg-muted/5",children:m.jsx("td",{colSpan:7,className:"px-4 py-2 text-[11px] text-muted-foreground text-center",children:"PG 데이터 불러오는 중..."})}):o.length===0?m.jsx("tr",{className:"border-b border-border/30 bg-muted/5",children:m.jsx("td",{colSpan:7,className:"px-4 py-2 text-[11px] text-muted-foreground text-center",children:"PG 데이터 없음"})}):m.jsxs(m.Fragment,{children:[m.jsx("tr",{className:"border-b border-border/30 bg-muted/5",children:m.jsx("td",{colSpan:7,className:"px-4 py-1.5 text-[10px] font-semibold text-muted-foreground tracking-wide",children:"PG사별 분석"})}),o.map(v=>{const g=v.pgProvider??"__null__",y=v.pgProvider?Hne[v.pgProvider]??v.pgProvider:"미지정",b=(v.avgCommissionRate*100).toFixed(1),_=c===g,S=n>0?(v.totalRevenue/n*100).toFixed(1):"0.0";return m.jsxs(Y.Fragment,{children:[m.jsxs("tr",{className:Qe("border-b border-border/30 bg-muted/10 hover:bg-muted/20 text-[11px] cursor-pointer"),onClick:()=>f(_?null:g),onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&f(_?null:g)},tabIndex:0,children:[m.jsx("td",{className:"py-1.5",style:{paddingLeft:28},children:m.jsxs("div",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[_?m.jsx(cn,{size:10,className:"text-muted-foreground shrink-0"}):m.jsx(qr,{size:10,className:"text-muted-foreground shrink-0"}),m.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:v.pgProvider?Fne[v.pgProvider]??"#888":"#888"}}),m.jsx("span",{children:y})]})}),m.jsxs("td",{className:"px-3 py-1.5 text-right text-muted-foreground whitespace-nowrap",children:[v.orderCount.toLocaleString(),"건"]}),m.jsx("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:Ot(v.totalRevenue)}),m.jsx("td",{className:"px-3 py-1.5 text-right text-red-600 dark:text-red-400 whitespace-nowrap",children:Ot(v.feeAmount)}),m.jsxs("td",{className:"px-3 py-1.5 text-right text-muted-foreground whitespace-nowrap",children:[b,"%"]}),m.jsx("td",{className:"px-3 py-1.5 text-right text-emerald-600 dark:text-emerald-400 whitespace-nowrap",children:Ot(v.totalNet)}),m.jsxs("td",{className:"px-3 py-1.5 text-right text-muted-foreground whitespace-nowrap text-[11px]",children:[S,"%"]})]}),_&&m.jsx(Une,{pgProvider:v.pgProvider??"",channel:r,dateFrom:e,dateTo:t,pgTotalRevenue:v.totalRevenue,fetchPaymentBreakdown:i})]},g)})]})}const Yne=/^\d{4}-\d{2}-\d{2}$/,$ne=["일","월","화","수","목","금","토"];function Vp(r,e){const t=new Date(`${r}T00:00:00Z`);return Number.isNaN(t.getTime())?r:(t.setUTCDate(t.getUTCDate()+e),t.toISOString().slice(0,10))}function vP(r){if(!Yne.test(r))return null;const e=new Date(`${r}T00:00:00Z`);if(Number.isNaN(e.getTime()))return null;const t=e.getUTCDay();return e.setUTCDate(e.getUTCDate()+(t===0?-6:1-t)),e.toISOString().slice(0,10)}function Xne(r){const e=new Date(`${r}T00:00:00Z`);return $ne[e.getUTCDay()]??""}function qne(r){return r>=1e8?`${(r/1e8).toFixed(1)}억`:r>=1e4?`${Math.round(r/1e4)}만`:r>=1e3?`${Math.round(r/1e3)}천`:r.toLocaleString()}function Tx(r){return r.slice(5).replace("-","/")}function Zne({wk:r,days:e,total:t}){const n=Vp(r,6);return m.jsxs("div",{className:"min-w-[200px] space-y-2",children:[m.jsxs("div",{className:"text-[10px] text-muted-foreground font-medium",children:[Tx(r)," ~ ",Tx(n)]}),e.length===0?m.jsx("p",{className:"text-[11px] text-muted-foreground",children:"입금 없음"}):m.jsxs(m.Fragment,{children:[e.map(a=>{const i=LD(a.day);return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground/70 mb-0.5",children:[m.jsxs("span",{children:[Tx(a.date)," (",Xne(a.date),")"]}),m.jsx("span",{className:"font-medium tabular-nums text-foreground/60",children:jl(a.amount)})]}),i.map(o=>m.jsxs("div",{className:"flex items-center justify-between gap-4 text-[11px]",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:o.color}}),m.jsx("span",{className:"text-muted-foreground",children:o.label})]}),m.jsx("span",{className:"font-medium tabular-nums",children:jl(o.amount)})]},o.key))]},a.date)}),m.jsxs("div",{className:"flex justify-between gap-4 text-[11px] font-semibold pt-1 border-t border-border/40",children:[m.jsx("span",{children:"주간 합계"}),m.jsx("span",{className:"tabular-nums text-emerald-500",children:jl(t)})]})]})]})}const Jv=80,Pw=24,Kne=216;function Qne({depositSchedule:r,today:e}){const t=e??new Date().toISOString().slice(0,10),n=Y.useRef(null),a=new Map;for(const v of r){const g=vP(v.depositDate);if(!g)continue;const y=a.get(g);a.set(g,{amount:((y==null?void 0:y.amount)??0)+v.totalAmount,days:[...(y==null?void 0:y.days)??[],{date:v.depositDate,amount:v.totalAmount,day:v}].sort((b,_)=>b.date.localeCompare(_.date))})}const i=Math.max(...[...a.values()].map(v=>v.amount),1),o=vP(t)??t,s=[...a.keys()].sort(),l=[Vp(o,-28),s[0]??o].sort()[0],u=[Vp(o,56),s[s.length-1]??o].sort().at(-1),c=[];let f=l;for(;f<=u;)c.push(f),f=Vp(f,7);for(;c.length<20;)c.push(Vp(c.at(-1),7));Y.useEffect(()=>{const v=n.current;if(!v)return;const g=c.indexOf(o);if(g<0)return;const y=v.scrollWidth/c.length,b=g*y-v.clientWidth/2+y/2;v.scrollLeft=Math.max(0,b)},[c.length,o]);const h=Y.useCallback(v=>{var g;(g=n.current)==null||g.scrollBy({left:v*Kne,behavior:"smooth"})},[]);return m.jsxs("div",{className:"relative",children:[m.jsxs("div",{className:"absolute top-0 right-0 flex items-center gap-0.5 z-10",children:[m.jsx("button",{type:"button",onClick:()=>h(-1),className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",children:m.jsx(CD,{size:14})}),m.jsx("button",{type:"button",onClick:()=>h(1),className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",children:m.jsx(qr,{size:14})})]}),m.jsx("div",{ref:n,className:"overflow-x-auto",children:m.jsxs("div",{className:"relative flex",style:{height:`${Jv+Pw}px`,minWidth:`${c.length*36}px`},children:[m.jsx("div",{className:"absolute bottom-[20px] left-0 right-0 border-b border-border/40 pointer-events-none"}),c.map(v=>{const g=a.get(v),y=(g==null?void 0:g.amount)??0,b=y>0?Math.max(5,Math.round(y/i*Jv)):0,_=v===o,S=y>0?.2+y/i*.72:0;return m.jsx(us,{content:m.jsx(Zne,{wk:v,days:(g==null?void 0:g.days)??[],total:(g==null?void 0:g.amount)??0}),side:"top",contentClassName:"max-w-[260px]",delayDuration:80,children:m.jsxs("div",{className:"relative flex flex-col flex-1 min-w-0 cursor-default px-0.5",style:{height:`${Jv+Pw}px`},children:[_&&m.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 w-px bg-primary/50 pointer-events-none",style:{top:0,height:`${Jv}px`}}),_&&m.jsx("span",{className:"absolute top-0 left-0 right-0 text-center text-[10px] text-primary font-semibold leading-none bg-card/80 pointer-events-none",children:"이번주"}),m.jsx("div",{style:{height:`${Jv-b}px`,flexShrink:0}}),b>0&&m.jsx("div",{className:"w-full rounded-t",style:{height:`${b}px`,backgroundColor:`hsl(var(--primary) / ${S})`,flexShrink:0}}),m.jsx("div",{className:Qe("text-center mt-1 leading-none truncate text-[10px]",_?"text-primary font-semibold":"text-muted-foreground/50"),children:Tx(v)}),b>=24&&m.jsx("div",{className:"absolute left-0 right-0 text-center text-[10px] font-medium text-white/90 pointer-events-none",style:{bottom:`${Pw+4}px`},children:qne(y)})]})},v)})]})})]})}const SH={tosspayments:"토스페이먼츠",naverpay:"네이버페이",cafe24pay:"카페24페이먼츠","kg-inicis":"KG이니시스",kakaopay:"카카오페이",danal:"다날","shopify-payments":"Shopify Payments","channel-integrated":"채널 통합"};function Jne(r){return r==null?"-":`${(r>1?r:r*100).toFixed(1)}%`}function eae({lines:r,channel:e,onOpenConfig:t}){return m.jsx("div",{className:"space-y-0.5",children:r.map((n,a)=>{const i=`${n.k}-${a}`;if(n.k==="divider")return m.jsx("div",{className:"border-t border-border/40 my-1"},i);if(n.k==="section")return m.jsx("p",{className:Qe("text-[9px] font-semibold uppercase tracking-wide pt-0.5",n.accent==="fix"?"text-emerald-600 dark:text-emerald-400":n.accent==="info"?"text-amber-600 dark:text-amber-400":"text-foreground/50"),children:n.v},i);if(n.k==="fixbullet")return m.jsxs("div",{className:"flex gap-1.5 text-[10px] leading-snug",children:[m.jsx("span",{className:"text-foreground/40 shrink-0 mt-px",children:"✓"}),m.jsxs("span",{children:[n.v,n.href&&t&&m.jsx("button",{type:"button",onClick:()=>{const o=n.v.includes("annualRevenue");t(o?"annualRevenue":"channel",o?void 0:e)},className:"ml-1 text-emerald-600 dark:text-emerald-400 underline underline-offset-2 hover:opacity-80 transition-opacity",children:"설정→"})]})]},i);if(n.k==="bullet")return m.jsxs("div",{className:"flex gap-1.5 text-muted-foreground text-[10px] leading-snug",children:[m.jsx("span",{className:"text-foreground/40 shrink-0 mt-px",children:"•"}),m.jsx("span",{children:n.v})]},i);if(n.k==="row"){const o=n.accent==="muted"?"text-muted-foreground":n.accent==="green"?"text-emerald-500 tabular-nums":n.accent==="red"?"text-red-500 tabular-nums":n.accent==="warn"?"text-amber-500 tabular-nums":"tabular-nums";return m.jsxs("div",{className:"flex justify-between gap-4 text-[11px]",children:[m.jsx("span",{className:"text-muted-foreground shrink-0",children:n.label}),m.jsx("span",{className:o,children:n.value})]},i)}return m.jsx("p",{className:"text-muted-foreground text-[11px]",children:n.v},i)})})}function tae({channels:r,rules:e,defaults:t,annualRevenue:n,quickSettlement:a,totalRevenue:i,totalOrders:o,totalCommission:s,netRevenue:l,commissionRate:u,isLoading:c,ssDaily:f,coupangConnected:h,dateFrom:v,dateTo:g,fetchPgBreakdown:y,fetchPaymentBreakdown:b,onOpenConfig:_}){const[S,T]=Y.useState(null),{sort:C,onSort:M,sortData:D}=Lne(),L=(()=>{const E=(f==null?void 0:f.elements)??[];if(!E.length)return null;const I=E.reduce((U,O)=>U+(O.paySettleAmount??0),0),z=E.reduce((U,O)=>U+(O.commissionSettleAmount??0),0),j=E.reduce((U,O)=>U+(O.settleAmount??0),0),G=I>0?Math.abs(z)/I*100:null;return{totalPay:I,totalComm:z,totalNet:j,rate:G}})();if(c)return m.jsxs("div",{className:"mb-6",children:[m.jsx("h3",{className:"text-[13px] font-medium mb-3",children:"채널별 정산 현황"}),m.jsx("div",{className:"text-sm text-muted-foreground py-6 text-center",children:"불러오는 중..."})]});if(r.length===0)return m.jsxs("div",{className:"mb-6",children:[m.jsx("h3",{className:"text-[13px] font-medium mb-3",children:"채널별 정산 현황"}),m.jsxs("div",{className:"border border-dashed border-border rounded-lg p-10 text-center text-muted-foreground text-sm",children:["정산 데이터가 없습니다.",m.jsxs("div",{className:"text-[11px] mt-1",children:[m.jsx("code",{className:"bg-muted px-1 rounded",children:"sppt import"}),"로 주문 데이터를 가져오거나 채널을 동기화하세요."]})]})]});const k=v||new Date(Date.now()-720*60*60*1e3).toISOString().slice(0,10),R=g||new Date().toISOString().slice(0,10);return m.jsxs("div",{className:"mb-6",children:[m.jsx("h3",{className:"text-[13px] font-medium mb-3",children:"채널별 정산 현황"}),m.jsxs(vo,{stickyHeader:!0,minWidth:"640px",sort:C,onSort:M,children:[m.jsxs(po,{children:[m.jsx(je,{sortKey:"channel",children:"채널"}),m.jsx(je,{sortKey:"orderCount",align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:["주문수",m.jsx(Zt,{side:"top",content:m.jsx(sr,{metric:"정산주문",rows:lr.정산주문,summary:"정산 테이블 기준 주문 건수"})})]})}),m.jsx(je,{sortKey:"totalRevenue",align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:["총 매출",m.jsx(Zt,{side:"top",content:m.jsx(sr,{metric:"정산매출",rows:lr.정산매출,summary:"정산 완료 주문의 grossAmount 합계"})})]})}),m.jsx(je,{align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:["수수료",m.jsx(Zt,{side:"top",content:m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"font-medium",children:"수수료 계산 기준"}),m.jsx("p",{children:"채널별 수수료 정책 기반 추정"}),m.jsx("p",{className:"pl-2 text-muted-foreground",children:"커스텀 규칙 → 채널 기본 요율 순 적용"})]})})]})}),m.jsx(je,{align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:["평균 수수료율",m.jsx(Zt,{side:"top",contentClassName:"max-w-[340px]",content:m.jsxs("div",{className:"space-y-2",children:[m.jsx("p",{className:"font-medium",children:"수수료율 결정 우선순위"}),m.jsxs("div",{className:"space-y-0.5 text-muted-foreground",children:[m.jsx("p",{children:"① 주문별 수수료율 데이터 평균"}),m.jsx("p",{className:"pl-3 text-[10px]",children:"채널 CSV에 수수료율 컬럼이 있을 때"}),m.jsx("p",{children:"② 커스텀 fee rule"}),m.jsx("p",{className:"pl-3 text-[10px]",children:"직접 설정한 규칙이 있을 때"}),m.jsx("p",{children:"③ 채널 기본 요율"}),m.jsx("p",{className:"pl-3 text-[10px]",children:"공식 자료 기반 기본값 (추정)"})]}),Object.keys(t).length>0&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"border-t border-border/40 pt-1.5",children:[m.jsxs("p",{className:"font-medium mb-0.5",children:["채널별 기본 수수료",n!=null?` (연매출 ${(n/1e8).toFixed(1)}억 기준)`:" (일반 등급 기준, 추정)"]}),n==null&&m.jsxs("p",{className:"text-[10px] text-amber-500 mb-1",children:["연매출 미설정 — 등급별 실제 요율과 다를 수 있음"," ",_&&m.jsx("button",{type:"button",onClick:()=>_("annualRevenue"),className:"underline underline-offset-2 hover:opacity-80",children:"설정→"})]}),m.jsx("div",{className:"space-y-0.5",children:Object.entries(t).map(([E,I])=>{var $;const z=Cg(I.revenueTiers,n),j=z!=null?($=I.revenueTiers)==null?void 0:$[z]:null,G=(j==null?void 0:j.pgRate)??I.pgRate,U=I.commissionRate+G,O=e.some(B=>B.channel===E),H=e.find(B=>B.channel===E&&!B.from&&!B.to&&!B.paymentMethod&&!B.category),F=H?(H.commissionRate??0)+(H.pgRate??0):null;return m.jsxs("div",{className:"flex justify-between gap-4 text-[10px]",children:[m.jsx("span",{className:"text-muted-foreground",children:hr[E]??E}),m.jsx("span",{children:H&&F!=null?m.jsxs("span",{className:"text-amber-400",children:[F.toFixed(1),"%"," ",m.jsxs("span",{className:"text-muted-foreground/50",children:["(기본 ",U.toFixed(1),"% ✎)"]})]}):O?m.jsxs("span",{className:Qe(j?"text-emerald-400":""),children:[U.toFixed(1),"%"," ",m.jsx("span",{className:"text-amber-400/70",children:"✎"})]}):m.jsxs("span",{className:j?"text-emerald-400":"",children:[U.toFixed(1),"%",j?` (${j.label})`:""]})})]},E)})}),m.jsx("p",{className:"text-[10px] text-muted-foreground/60 mt-1",children:"✎ 커스텀 규칙 · 초록 = 등급 적용"})]}),m.jsx("p",{className:"text-[10px] text-muted-foreground/60 border-t border-border/40 pt-1.5",children:"정확한 등급 요율 → 아래 '채널 기본 수수료 규칙' 펼치기"})]})]})})]})}),m.jsx(je,{sortKey:"netRevenue",align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:["실수령 예상",m.jsx(Zt,{side:"top",content:m.jsx(sr,{metric:"순수익",rows:lr.순수익,summary:"정산매출 - 수수료 - PG비"})})]})}),m.jsx(je,{sortKey:"revShare",align:"right",children:"매출 비중"})]}),m.jsx("tbody",{className:"bg-card",children:D(r,(E,I)=>I==="revShare"?i>0?E.totalRevenue/i:0:E[I]).map((E,I)=>{var fe;const z=E.channel==="smartstore",j=E.channel==="coupang",G=z?L:null,U=z?f==null?void 0:f.settleMeta:void 0,O=G?Math.abs(G.totalComm):E.totalCommission!=null?E.totalCommission:E.totalRevenue-(E.netRevenue??0),H=G?G.totalNet:E.netRevenue??0,F=(G==null?void 0:G.rate)??E.avgCommissionRate,$=z&&t.smartstore?(t.smartstore.commissionRate??0)+(t.smartstore.pgRate??0):null,B=(G==null?void 0:G.rate)!=null&&$!=null?G.rate-$:null,X=B!=null&&Math.abs(B)>.5,q=i>0?(E.totalRevenue/i*100).toFixed(1):"0",Q=Jee(E,e,t,n),ne=S===E.channel;return m.jsxs(Y.Fragment,{children:[m.jsxs("tr",{className:Qe("border-b border-border/60 cursor-pointer hover:bg-muted/20",I%2!==0&&"bg-muted/30"),onClick:()=>T(ne?null:E.channel),onKeyDown:ve=>{(ve.key==="Enter"||ve.key===" ")&&T(ne?null:E.channel)},tabIndex:0,children:[m.jsx("td",{className:"px-3 py-2.5",children:m.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[ne?m.jsx(cn,{size:12,className:"text-muted-foreground shrink-0"}):m.jsx(qr,{size:12,className:"text-muted-foreground shrink-0"}),m.jsx(Tb,{channel:E.channel}),hr[E.channel]??E.channelLabel??E.channel,z&&G&&m.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"실정산"}),j&&h&&m.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"API 연동"}),z&&a&&m.jsx("span",{className:"inline-flex items-center text-[10px] font-medium bg-blue-100 text-blue-700 dark:bg-blue-950/50 dark:text-blue-400 px-1.5 py-0.5 rounded-full",children:"⚡ 빠른정산"})]})}),m.jsxs("td",{className:"px-3 py-2.5 text-right text-muted-foreground",children:[E.orderCount.toLocaleString(),"건"]}),m.jsx("td",{className:"px-3 py-2.5 text-right font-medium",children:Ot(E.totalRevenue)}),m.jsx("td",{className:"px-3 py-2.5 text-right text-red-600 dark:text-red-400",children:Ot(O)}),m.jsx("td",{className:"px-3 py-2.5 text-right text-muted-foreground",children:m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",onClick:ve=>ve.stopPropagation(),children:[Jne(F),X&&m.jsx(us,{side:"left",contentClassName:"max-w-[300px]",content:m.jsxs("div",{className:"space-y-1.5",children:[m.jsx("p",{className:"font-medium text-[11px] text-amber-500",children:"수수료율 불일치"}),m.jsxs("div",{className:"space-y-0.5 text-[11px]",children:[m.jsxs("div",{className:"flex justify-between gap-4",children:[m.jsx("span",{className:"text-muted-foreground",children:"설정값"}),m.jsxs("span",{children:[$==null?void 0:$.toFixed(1),"%"]})]}),m.jsxs("div",{className:"flex justify-between gap-4",children:[m.jsx("span",{className:"text-muted-foreground",children:"실측"}),m.jsxs("span",{className:"text-amber-500",children:[(fe=G==null?void 0:G.rate)==null?void 0:fe.toFixed(1),"%"]})]}),m.jsxs("div",{className:"flex justify-between gap-4",children:[m.jsx("span",{className:"text-muted-foreground",children:"차이"}),m.jsxs("span",{className:"text-amber-500",children:[B!=null&&B>=0?"+":"",B==null?void 0:B.toFixed(1),"%p"]})]})]}),U&&m.jsx("div",{className:"border-t border-border/40 pt-1 text-[10px] text-muted-foreground/70",children:m.jsxs("p",{children:["📅 정산완료일 기준 · 주문일+",U.offsetDays.min,"~",U.offsetDays.max,"일 오프셋 적용"]})})]}),children:m.jsx("span",{className:"cursor-help inline-flex items-center",children:m.jsx(Gee,{size:11,className:"text-amber-500"})})}),!X&&G&&U&&m.jsx(Zt,{side:"left",contentClassName:"max-w-[320px]",content:m.jsxs("div",{className:"space-y-1.5",children:[m.jsx("p",{className:"font-medium text-[11px]",children:"실정산 수수료율"}),m.jsxs("div",{className:"space-y-0.5 text-[11px]",children:[m.jsxs("div",{className:"flex justify-between gap-4",children:[m.jsx("span",{className:"text-muted-foreground",children:"결제 기준금액"}),m.jsx("span",{children:Ot(G.totalPay)})]}),m.jsxs("div",{className:"flex justify-between gap-4",children:[m.jsx("span",{className:"text-muted-foreground",children:"수수료 합계"}),m.jsx("span",{className:"text-red-500",children:Ot(Math.abs(G.totalComm))})]}),m.jsxs("div",{className:"flex justify-between gap-4",children:[m.jsx("span",{className:"text-muted-foreground",children:"실수령"}),m.jsx("span",{className:"text-emerald-500",children:Ot(G.totalNet)})]})]}),m.jsxs("div",{className:"border-t border-border/40 pt-1 text-[10px] text-muted-foreground/70 space-y-1",children:[m.jsx("p",{className:"font-medium text-foreground/60",children:"조회 방식"}),m.jsxs("p",{children:["주문일(",U.orderFrom,"~",U.orderTo,")에 배송·구매확정 소요일(+",U.offsetDays.min,"~",U.offsetDays.max,"일)을 더해 정산완료일 범위로 조회합니다."]}),m.jsx("p",{children:"월 경계 주문은 실제 정산일과 다소 차이가 날 수 있습니다."}),m.jsx("p",{className:"text-foreground/50",children:"행 클릭 → 주문건별 정산 상세 확인 가능"})]})]})}),!G&&Q&&m.jsx(Zt,{side:"left",contentClassName:"max-w-[300px]",content:m.jsxs("div",{className:"space-y-1.5",children:[m.jsx("p",{className:"font-medium text-[11px]",children:Q.label}),m.jsx(eae,{lines:Q.lines,channel:E.channel,onOpenConfig:_}),z&&m.jsxs("div",{className:"mt-1.5 pt-1.5 border-t border-border/40 text-[10px] text-muted-foreground/60 space-y-0.5",children:[m.jsx("p",{children:"현재 추정값입니다. 정산 데이터가 있는 기간 선택 시 네이버 실정산 기준으로 자동 교체됩니다."}),m.jsx("p",{className:"text-foreground/40",children:"행 클릭 → 주문건별 정산 상세 확인 가능"})]})]})})]})}),m.jsx("td",{className:"px-3 py-2.5 text-right text-emerald-600 dark:text-emerald-400 font-medium",children:Ot(H)}),m.jsx("td",{className:"px-3 py-2.5 text-right",children:m.jsxs("div",{className:"flex items-center justify-end gap-2",children:[m.jsx("div",{className:"w-[60px] bg-muted rounded-full h-1.5 overflow-hidden",children:m.jsx("div",{className:"h-full bg-primary/60 rounded-full",style:{width:`${q}%`}})}),m.jsxs("span",{className:"text-muted-foreground text-[11px] w-[32px] text-right",children:[q,"%"]})]})})]}),ne&&y&&b&&m.jsx(Wne,{channel:E.channel,dateFrom:k,dateTo:R,parentTotalRevenue:i,fetchPgBreakdown:y,fetchPaymentBreakdown:b})]},E.channel)})}),r.length>1&&m.jsx("tfoot",{children:m.jsxs("tr",{className:"border-t border-border bg-muted/30 text-[12px] font-semibold",children:[m.jsx("td",{className:"px-3 py-2.5",children:"합계"}),m.jsxs("td",{className:"px-3 py-2.5 text-right text-muted-foreground",children:[o.toLocaleString(),"건"]}),m.jsx("td",{className:"px-3 py-2.5 text-right",children:Ot(i)}),m.jsx("td",{className:"px-3 py-2.5 text-right text-red-600 dark:text-red-400",children:Ot(s)}),m.jsxs("td",{className:"px-3 py-2.5 text-right text-muted-foreground",children:[u.toFixed(1),"%"]}),m.jsx("td",{className:"px-3 py-2.5 text-right text-emerald-600 dark:text-emerald-400",children:Ot(l)}),m.jsx("td",{})]})})]})]})}const rae={ordered:"주문일",paid:"결제일",confirmed:"구매확정일"};function nae({defaults:r,rules:e,annualRevenue:t,isLoading:n,onOpenConfig:a}){return n?m.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:"불러오는 중..."}):Object.keys(r).length===0?m.jsxs("div",{className:"border border-dashed border-border rounded-lg px-4 py-5 text-[12px] text-muted-foreground flex items-center gap-2",children:[m.jsx(AD,{size:13,className:"shrink-0"}),"기본 수수료 규칙 데이터 없음"]}):m.jsxs(vo,{stickyHeader:!0,minWidth:"640px",children:[m.jsxs(po,{children:[m.jsx(je,{children:"채널"}),m.jsx(je,{align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:["판매수수료",m.jsx(Zt,{side:"top",content:m.jsx("p",{children:"네이버쇼핑·일반 유입 기준 요율. 마케팅 링크 유입 시 별도 요율 적용 (셀별 ℹ 확인)"})})]})}),m.jsx(je,{align:"right",children:"PG수수료"}),m.jsx(je,{align:"right",children:"합계"}),m.jsx(je,{children:"정산 기준"}),m.jsx(je,{align:"right",children:"정산 주기"}),m.jsx(je,{children:"커스텀 규칙"})]}),m.jsx("tbody",{className:"bg-card",children:Object.entries(r).map(([i,o],s)=>{const l=e.filter(c=>c.channel===i).length,u=o.commissionRate+o.pgRate;return m.jsxs(Y.Fragment,{children:[m.jsxs("tr",{className:Qe("border-b border-border/60",s%2!==0&&"bg-muted/30"),children:[m.jsx("td",{className:"px-3 py-2.5",children:m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Tb,{channel:i}),hr[i]??i]})}),m.jsx("td",{className:"px-3 py-2.5 text-right",children:o.commissionRate>0?m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:[m.jsxs("span",{className:"font-medium",children:[o.commissionRate,"%"]}),o.marketingLinkCommissionRate!=null&&m.jsx(Zt,{side:"top",content:m.jsxs("div",{className:"space-y-0.5",children:[m.jsx("p",{className:"font-medium",children:"판매수수료 2종 (택1)"}),m.jsxs("p",{children:["일반 유입: ",o.commissionRate,"%"]}),m.jsxs("p",{children:["마케팅 링크 유입: ",o.marketingLinkCommissionRate,"%"]})]})})]}):m.jsx("span",{className:"text-muted-foreground",children:"-"})}),m.jsx("td",{className:"px-3 py-2.5 text-right",children:o.pgRate>0?m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:[(()=>{var v;const c=Cg(o.revenueTiers,t),f=c!=null?(v=o.revenueTiers)==null?void 0:v[c]:null,h=(f==null?void 0:f.pgRate)??null;return h!=null&&h!==o.pgRate?m.jsxs("span",{className:"inline-flex items-center gap-1",children:[m.jsxs("span",{className:"font-semibold text-emerald-600 dark:text-emerald-400",children:[h,"%"]}),m.jsx(Zt,{side:"top",content:m.jsxs("div",{className:"space-y-0.5",children:[m.jsxs("p",{className:"font-medium text-emerald-400",children:["현재 적용: ",h,"% (",f==null?void 0:f.label,")"]}),m.jsxs("p",{className:"text-muted-foreground",children:["기본(일반): ",o.pgRate,"%"]}),t!=null&&m.jsxs("p",{className:"text-muted-foreground text-[10px]",children:["연매출 ",(t/1e8).toFixed(1),"억 기준"]})]})})]}):m.jsxs("span",{className:"font-medium",children:[o.pgRate,"%"]})})(),o.pgRateAppliesToShipping&&m.jsx(Zt,{side:"top",content:m.jsx("p",{children:"배송비 포함 금액에도 적용 (스마트스토어 Npay 수수료)"})})]}):m.jsx("span",{className:"text-muted-foreground",children:"-"})}),m.jsx("td",{className:"px-3 py-2.5 text-right text-muted-foreground",children:u>0?m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:[u.toFixed(2),"%",o.shippingCommissionRate!=null&&o.shippingCommissionRate>0&&m.jsx(Zt,{side:"top",content:m.jsxs("p",{children:["배송비 수수료 ",o.shippingCommissionRate,"% 별도"]})})]}):"-"}),m.jsx("td",{className:"px-3 py-2.5 text-muted-foreground",children:rae[o.settlementDayBasis]??o.settlementDayBasis}),m.jsxs("td",{className:"px-3 py-2.5 text-right text-muted-foreground",children:[o.settlementCycleDays,"일"]}),m.jsx("td",{className:"px-3 py-2.5",children:l>0?m.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium bg-amber-100 text-amber-700 dark:bg-amber-950/50 dark:text-amber-400 px-1.5 py-0.5 rounded-full",children:[l,"개 규칙 적용"]}):m.jsx("span",{className:"text-[11px] text-muted-foreground",children:"기본값"})})]}),m.jsx(Bne,{d:o,annualRevenue:t,channel:i,onOpenConfig:a},`${i}-detail`),o.pgProviders&&Object.keys(o.pgProviders).length>1&&m.jsx("tr",{className:"border-b border-border/40",children:m.jsxs("td",{colSpan:7,className:"px-6 py-2 bg-muted/10",children:[m.jsx("div",{className:"text-[11px] text-muted-foreground font-medium mb-1.5",children:"PG사별 수수료"}),m.jsx("div",{className:"grid grid-cols-[1fr_auto_auto] gap-x-4 gap-y-1 text-[11px]",children:Object.entries(o.pgProviders).map(([c,f])=>m.jsxs(Y.Fragment,{children:[m.jsx("span",{className:"text-muted-foreground",children:SH[c]??c}),m.jsxs("span",{className:"text-right font-medium",children:[f.pgRate,"%"]}),m.jsx("span",{className:"text-right text-muted-foreground/60",children:f.pgRateByPayment?`${Object.keys(f.pgRateByPayment).length}종`:""})]},c))})]})})]},i)})})]})}function aae({channels:r,totalRevenue:e,netRevenue:t,totalOrders:n,rules:a=[],defaults:i={},depositSchedule:o=[],isLoading:s=!1,scheduleLoading:l=!1,dateFrom:u,dateTo:c,onDateChange:f,ssDaily:h,coupangConnected:v=!1,annualRevenue:g=null,quickSettlement:y=!1,renderExpandedPanel:b,fetchPgBreakdown:_,fetchPaymentBreakdown:S,onOpenConfig:T,onSync:C,syncing:M=!1,syncResult:D,lastSyncedAt:L,syncDisabled:k=!1,estimationNote:R="주문 데이터 기반 추정값",children:E}){const I=Y.useRef(null),z=Y.useRef(null);Y.useEffect(()=>{const Se=z.current,ge=I.current;if(!Se||!ge)return;const he=new ResizeObserver(()=>{ge.style.setProperty("--page-header-h",`${Se.offsetHeight}px`)});return he.observe(Se),()=>he.disconnect()},[]);const[j,G]=Y.useState(""),[U,O]=Y.useState(""),H=u!==void 0||c!==void 0,F=H?u??"":j,$=H?c??"":U,[B,X]=Y.useState(!1),[q,Q]=Y.useState(!1),ne=e-t,fe=e>0?ne/e*100:0;function ve(Se,ge){H||(G(Se),O(ge)),f==null||f(Se,ge)}return m.jsx(MD,{delayDuration:200,children:m.jsxs("div",{ref:I,children:[m.jsxs("div",{ref:z,className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-4 sticky top-0 z-10 py-4 -mt-4 md:-mt-7 md:pt-7",style:{backgroundColor:"var(--page-bg, transparent)"},children:[m.jsx("h2",{className:"text-xl font-medium",children:"정산"}),m.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[m.jsx(rH,{size:12}),R," · 실제 정산과 차이 있을 수 있음"]}),(()=>{const Se=D??(Tg(L)?`마지막 동기화: ${Tg(L)}`:null);return Se?m.jsx("span",{className:"text-[11px] text-muted-foreground",children:Se}):null})(),C&&m.jsx(e1,{onSync:C,syncing:M,syncResult:D,disabled:k})]})]}),m.jsx(DD,{from:F,to:$,onChange:ve,className:"mb-6"}),m.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:[m.jsx(bn,{label:"총 매출",value:Ot(e),sub:`주문 ${n.toLocaleString()}건`,tooltip:m.jsx(sr,{metric:"정산매출",rows:lr.정산매출,summary:"정산 완료 주문의 grossAmount 합계"})}),m.jsx(bn,{label:"수수료 · PG 합계",value:Ot(ne),sub:`평균 ${fe.toFixed(1)}%`}),m.jsx(bn,{label:"실수령 예상",value:Ot(t),accent:!0,tooltip:m.jsx(sr,{metric:"순수익",rows:lr.순수익,summary:"정산매출 - 수수료 - PG비"})}),m.jsx(bn,{label:"커스텀 수수료 규칙",value:`${a.length}개`,sub:a.length===0?"기본값 적용 중":"커스텀 규칙 적용"})]}),m.jsx(tae,{channels:r,rules:a,defaults:i,annualRevenue:g,quickSettlement:y,totalRevenue:e,totalOrders:n,totalCommission:ne,netRevenue:t,commissionRate:fe,isLoading:s,ssDaily:h,coupangConnected:v,dateFrom:F,dateTo:$,fetchPgBreakdown:_,fetchPaymentBreakdown:S,onOpenConfig:T}),m.jsxs("div",{className:"mb-4",children:[m.jsxs("button",{type:"button",onClick:()=>X(Se=>!Se),className:"flex items-center gap-2 w-full text-left group mb-0",children:[B?m.jsx(cn,{size:13,className:"shrink-0 text-muted-foreground"}):m.jsx(qr,{size:13,className:"shrink-0 text-muted-foreground"}),m.jsx("span",{className:"text-[13px] font-medium group-hover:text-foreground/80 transition-colors",children:"채널 기본 수수료 규칙"}),m.jsx(Zt,{size:12,contentClassName:"max-w-[300px]",content:m.jsxs("div",{className:"space-y-1.5",children:[m.jsx("p",{className:"font-medium",children:"채널 기본 수수료 규칙이란?"}),m.jsxs("div",{className:"space-y-1 text-muted-foreground",children:[m.jsx("p",{children:"공식 자료·실데이터 기반 채널별 표준 요율입니다."}),m.jsx("p",{children:"커스텀 규칙이 없을 때 정산 추정에 사용됩니다."}),m.jsx("p",{children:"실제 계약 조건이 다르면 커스텀 규칙으로 오버라이드하세요."})]})]})})]}),B&&m.jsx("div",{className:"mt-3",children:m.jsx(nae,{defaults:i,rules:a,annualRevenue:g,isLoading:!1,onOpenConfig:T})})]}),m.jsxs("div",{className:"mb-6",children:[m.jsxs("button",{type:"button",onClick:()=>Q(Se=>!Se),className:"flex items-center gap-2 w-full text-left group mb-0",children:[q?m.jsx(cn,{size:13,className:"shrink-0 text-muted-foreground"}):m.jsx(qr,{size:13,className:"shrink-0 text-muted-foreground"}),m.jsx("span",{className:"text-[13px] font-medium group-hover:text-foreground/80 transition-colors",children:"커스텀 수수료 규칙"}),a.length>0&&m.jsxs("span",{className:"inline-flex items-center text-[10px] font-medium bg-amber-100 text-amber-700 dark:bg-amber-950/50 dark:text-amber-400 px-1.5 py-0.5 rounded-full",children:[a.length,"개"]}),m.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground flex items-center gap-1",children:m.jsx("code",{className:"bg-muted px-1 rounded text-[10px] mr-2",children:"sppt settlement fee set <channel>"})})]}),q&&m.jsx("div",{className:"mt-3",children:a.length===0?m.jsxs("div",{className:"border border-dashed border-border rounded-lg px-4 py-5 text-[12px] text-muted-foreground flex items-center gap-2",children:[m.jsx(AD,{size:13,className:"shrink-0"}),"등록된 커스텀 규칙 없음 — 채널 기본 수수료 규칙이 적용됩니다."]}):m.jsxs(m.Fragment,{children:[m.jsxs(vo,{stickyHeader:!0,minWidth:"560px",className:"rounded-b-none",children:[m.jsxs(po,{children:[m.jsx(je,{className:"w-[72px]",children:"ID"}),m.jsx(je,{children:"채널"}),m.jsx(je,{children:"PG사"}),m.jsx(je,{align:"right",children:"판매수수료"}),m.jsx(je,{align:"right",children:"PG수수료"}),m.jsx(je,{children:"적용 기간"}),m.jsx(je,{children:"결제수단"}),m.jsx(je,{children:"메모"})]}),m.jsx("tbody",{className:"bg-card",children:a.map(Se=>m.jsxs("tr",{className:"border-b border-border/50",children:[m.jsx("td",{className:"px-3 py-2 font-mono text-[10px] text-muted-foreground",children:Se.id}),m.jsx("td",{className:"px-3 py-2",children:hr[Se.channel]??Se.channel}),m.jsx("td",{className:"px-3 py-2 text-[11px] text-muted-foreground",children:Se.pgProvider?SH[Se.pgProvider]??Se.pgProvider:"전체"}),m.jsx("td",{className:"px-3 py-2 text-right text-muted-foreground",children:Se.commissionRate!=null?`${(Se.commissionRate*100).toFixed(1)}%`:"-"}),m.jsx("td",{className:"px-3 py-2 text-right text-muted-foreground",children:Se.pgRate!=null?`${(Se.pgRate*100).toFixed(1)}%`:"-"}),m.jsx("td",{className:"px-3 py-2 text-[11px] text-muted-foreground",children:Se.from&&Se.to?`${Se.from} ~ ${Se.to}`:Se.from??Se.to??"-"}),m.jsx("td",{className:"px-3 py-2 text-[11px] text-muted-foreground",children:Se.paymentMethod??"-"}),m.jsx("td",{className:"px-3 py-2 text-[11px] text-muted-foreground",children:Se.note??"-"})]},Se.id))})]}),m.jsxs("div",{className:"px-3 py-2 border border-t-0 border-border rounded-b-lg bg-muted/20 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[m.jsx(iH,{size:11}),"조건이 많이 맞는 규칙이 우선 적용 (PG사 > 기간 > 결제수단 > 카테고리 순)"]})]})})]}),(o.length>0||l)&&m.jsx("div",{className:"mt-6",children:(()=>{const Se=new Date().toISOString().slice(0,10),ge=Math.max(...o.map(Te=>Te.totalAmount),1),he=o.filter(Te=>Te.depositDate>=Se),Ne=he.reduce((Te,$e)=>Te+$e.totalAmount,0),xe=he.reduce((Te,$e)=>Te+$e.orderCount,0);return m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between mb-3",children:[m.jsx("h3",{className:"text-[13px] font-medium",children:"입금 스케줄"}),Ne>0&&m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["향후"," ",m.jsx("span",{className:"text-emerald-600 dark:text-emerald-400 font-medium",children:Ot(Ne)})," ","예정 · ",xe,"건"]})]}),l?m.jsx("div",{className:"text-sm py-4 text-center text-muted-foreground",children:"불러오는 중..."}):o.length===0?m.jsx("div",{className:"border border-dashed border-border rounded-lg px-4 py-5 text-[12px] text-muted-foreground text-center",children:"정산 데이터가 없어 입금 스케줄을 계산할 수 없습니다."}):m.jsxs("div",{className:"grid gap-3 grid-cols-1 md:grid-cols-[2fr_1fr]",children:[m.jsxs("div",{className:"min-w-0",children:[m.jsx("div",{className:"border border-border rounded-lg bg-card px-3 pt-7 pb-2 mb-3",children:m.jsx(Qne,{depositSchedule:o,today:Se,maxAmount:ge})}),m.jsx(bte,{depositSchedule:o,today:Se,maxAmount:ge})]}),m.jsx("div",{className:"relative min-w-0 h-[400px] md:h-auto",children:m.jsx(xte,{schedule:o,today:Se})})]})]})})()}),E]})})}const wH={cafe24:{domain:"cafe24.com",initial:"C24",bg:"#3b82f6"},coupang:{domain:"coupang.com",initial:"CP",bg:"#f97316"},smartstore:{domain:"shopping.naver.com",initial:"N",bg:"#03c75a"},shopify:{domain:"shopify.com",initial:"S",bg:"#96bf48"},"toss-shopping":{domain:"toss.im",initial:"T",bg:"#0064ff"},kurly:{domain:"kurly.com",initial:"K",bg:"#a855f7"}};function iae(r,e=32){const t=wH[r];if(t!=null&&t.domain)return`https://www.google.com/s2/favicons?domain=${t.domain}&sz=${e}`}function oae(r,e){switch(r){case"cafe24":return e?`https://${e}.cafe24.com/disp/admin/shop1/index`:null;case"coupang":return"https://wing.coupang.com/";case"smartstore":return"https://partner.smartstore.naver.com/";case"shopify":return e?`https://${e}/admin`:null;case"toss-shopping":return"https://shopping-seller.toss.im/";default:return null}}const pP=[{id:"cafe24",label:hr.cafe24,hasApi:!0},{id:"coupang",label:hr.coupang,hasApi:!0},{id:"smartstore",label:hr.smartstore,hasApi:!0},{id:"shopify",label:hr.shopify,hasApi:!0},{id:"toss-shopping",label:hr["toss-shopping"],hasApi:!0},{id:"kurly",label:hr.kurly,hasApi:!1},{id:"ssf",label:hr.ssf,hasApi:!1},{id:"bronte",label:hr.bronte,hasApi:!1},{id:"ezadmin",label:hr.ezadmin,hasApi:!1}],sae=[{categoryId:"R",category:"매출",rows:[{id:"R1",feature:"매출액 합계",command:"report revenue",conquered:!0,dataKey:"totalRevenue"},{id:"R2",feature:"기간별 추이",command:"report --period",conquered:!0},{id:"R3",feature:"평균주문가 (AOV)",command:"report revenue",conquered:!0,dataKey:"avgOrderValue"},{id:"R4",feature:"시간대별 매출",command:"report --by hour"},{id:"R5",feature:"결제수단별 매출",command:"report --by payment"}]},{categoryId:"O",category:"주문",rows:[{id:"O1",feature:"주문 목록",command:"order list",conquered:!0,dataKey:"orderCount"},{id:"O2",feature:"주문 상태별 현황",command:"order list --status",conquered:!0,dataKey:"statusBreakdown"},{id:"O3",feature:"채널별 주문수 비교",command:"report --by channel",conquered:!0},{id:"O4",feature:"주문 상세",command:"order get"}]},{categoryId:"P",category:"상품",rows:[{id:"P1",feature:"상품 매핑/해체",command:"product rules",conquered:!0},{id:"P2",feature:"상품별 판매량/매출",command:"report --by product",conquered:!0},{id:"P3",feature:"카테고리별 판매량/매출",command:"report --by category",conquered:!0},{id:"P4",feature:"제품라인별 판매량/매출",command:"report --by productline",conquered:!0},{id:"P5",feature:"공헌이익",command:"report --metric contribution"},{id:"P6",feature:"상품 조회수 (PV)",command:"-"},{id:"P7",feature:"전환율 (CVR)",command:"-"},{id:"P8",feature:"재고 현황",command:"inventory sync"}]},{categoryId:"C",category:"고객",rows:[{id:"C1",feature:"신규/재구매 비율",command:"report --segment"},{id:"C2",feature:"고객 등급/세그먼트",command:"-"},{id:"C3",feature:"LTV/구매주기",command:"-"},{id:"C4",feature:"리뷰 분석",command:"-"}]},{categoryId:"M",category:"마케팅",rows:[{id:"M1",feature:"유입경로별 전환",command:"-"},{id:"M2",feature:"광고 캠페인 성과",command:"-"},{id:"M3",feature:"쿠폰 발급/사용",command:"coupon"},{id:"M4",feature:"키워드 검색량",command:"trend keyword"}]},{categoryId:"D",category:"배송/CS",rows:[{id:"D1",feature:"배송 리드타임",command:"order list"},{id:"D2",feature:"반품/교환율",command:"order list"},{id:"D3",feature:"CS 문의 분석",command:"-"}]},{categoryId:"S",category:"정산",rows:[{id:"S1",feature:"수수료 정책 모델링",command:"settlement calc",conquered:!0,dataKey:"commissionRate"},{id:"S2",feature:"수수료 역산/검증",command:"settlement fee-check",conquered:!0},{id:"S3",feature:"정산 스케줄 예측",command:"settlement schedule",conquered:!0},{id:"S4",feature:"채널수수료 공헌이익",command:"report --by channel --metric margin",conquered:!0,dataKey:"netRevenue"},{id:"S5",feature:"정산 상세 내역",command:"settlement list"},{id:"S6",feature:"정산-예측 대조",command:"settlement reconcile"},{id:"S7",feature:"채널간 순이익 비교",command:"settlement summary"}]}],TH={backgroundColor:"rgba(221,235,233,0.8)",color:"rgb(15 118 110)"},CH={backgroundColor:"rgba(232,236,230,0.8)",color:"rgb(20 184 166 / 0.7)"},ED={backgroundColor:"rgba(231,229,228,0.6)",color:"rgb(120 113 108)"},AH={backgroundColor:"rgba(239,68,68,0.08)",color:"rgb(239 68 68)"};function lae(r,e){if(!r||e==="-")return null;const t=e.split(" ")[0];for(const[n,a]of Object.entries(r))if(e.includes(" ")){if(n.startsWith(e))return a}else if(n.startsWith(t??""))return a;return null}function uae(r){const e=Date.now()-new Date(r).getTime(),t=Math.floor(e/6e4);if(t<1)return"방금";if(t<60)return`${t}분 전`;const n=Math.floor(t/60);if(n<24)return`${n}시간 전`;const a=Math.floor(n/24);return a<30?`${a}일 전`:`${Math.floor(a/30)}개월 전`}function jw(r){return r>=1e8?`${(r/1e8).toFixed(1)}억`:r>=1e4?`${Math.round(r/1e4)}만`:r.toLocaleString()}function cae(r,e,t){if(!r)return null;switch(r){case"orderCount":return e!=null&&e.orderCount?`${e.orderCount.toLocaleString()}건`:null;case"totalRevenue":return e!=null&&e.totalRevenue?jw(e.totalRevenue):null;case"avgOrderValue":return e!=null&&e.avgOrderValue?`${jw(e.avgOrderValue)}원`:null;case"statusBreakdown":{if(!(e!=null&&e.statusBreakdown))return null;const n=e.statusBreakdown,a=[];return n.paid&&a.push(`결제 ${n.paid}`),n.shipping&&a.push(`배송 ${n.shipping}`),n.delivered&&a.push(`완료 ${n.delivered}`),n.cancelled&&a.push(`취소 ${n.cancelled}`),a.length>0?a.join(" · "):null}case"commissionRate":return(t==null?void 0:t.avgCommissionRate)!=null?`${(t.avgCommissionRate*100).toFixed(1)}%`:null;case"netRevenue":return t!=null&&t.netRevenue?jw(t.netRevenue):null;default:return null}}function fae(r){const e=(Date.now()-new Date(r).getTime())/36e5;return e<24?TH:e<168?CH:ED}function dae({exec:r,dataLabel:e}){if(!r&&!e)return m.jsx("div",{className:"h-full flex items-center justify-center rounded-[3px] bg-muted/30",children:m.jsx("span",{className:"text-[10px] text-muted-foreground/40",children:"—"})});if(!r&&e)return m.jsx("div",{className:"h-full flex flex-col items-center justify-center rounded-[3px] px-2 py-1.5",style:ED,children:m.jsx("span",{className:"text-[11px] font-semibold leading-tight",children:e})});const t=r,a=t.result==="error"?AH:fae(t.lastRun);return m.jsxs("div",{className:"h-full flex flex-col items-center justify-center rounded-[3px] px-2 py-1.5 gap-0.5",style:a,children:[e&&m.jsx("span",{className:"text-[11px] font-semibold leading-tight",children:e}),m.jsx("span",{className:"leading-tight",style:{fontSize:e?"9px":"11px",opacity:e?.6:1,fontWeight:e?void 0:500},children:uae(t.lastRun)}),!e&&t.durationMs>0&&m.jsx("span",{className:"text-[9px] opacity-60",children:t.durationMs<1e3?`${t.durationMs}ms`:`${(t.durationMs/1e3).toFixed(1)}s`})]})}function hae({channelId:r}){const e=wH[r];if(!e)return null;const t=iae(r);return t?m.jsx("img",{src:t,alt:r,width:20,height:20,className:"shrink-0 rounded-[3px]",onError:n=>{const a=document.createElement("span");a.className="inline-flex items-center justify-center w-5 h-5 rounded-[4px] text-[8px] font-bold text-white shrink-0 leading-none",a.style.backgroundColor=e.bg,a.textContent=e.initial,n.target.replaceWith(a)}}):m.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded-[4px] text-[8px] font-bold text-white shrink-0 leading-none",style:{backgroundColor:e.bg},children:e.initial})}function vae({ch:r,channelStatuses:e,onConnect:t}){const n=r.hasApi?(e??[]).find(o=>o.channel===r.id):void 0,a=(n==null?void 0:n.connected)??!1,i=a?oae(r.id,n==null?void 0:n.storeId):null;return m.jsx("th",{className:"text-center px-3 py-3.5 min-w-[155px] align-bottom",children:m.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(hae,{channelId:r.id}),m.jsx("span",{className:"font-semibold text-[13px] whitespace-nowrap",children:r.label})]}),r.hasApi&&a&&n&&m.jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[i?m.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] font-medium whitespace-nowrap hover:underline",style:{color:"hsl(var(--success))"},children:n.storeId||"연결됨"}):m.jsx("span",{className:"text-[10px] font-medium whitespace-nowrap",style:{color:"hsl(var(--success))"},children:n.storeId||"연결됨"}),(n.rateLimit!==void 0||n.webhook!==void 0)&&m.jsxs("div",{className:"text-[9px] text-muted-foreground/50 font-normal whitespace-nowrap flex items-center gap-1",children:[n.rateLimit!==void 0&&m.jsxs("span",{children:[n.rateLimit,"rps"]}),n.webhook!==void 0&&m.jsx("span",{children:n.webhook?"webhook":"polling"}),n.keyExpiry!==void 0&&n.keyExpiry<=14&&m.jsxs("span",{className:"ml-1",style:{color:"hsl(var(--warning))"},children:["⚠ ",n.keyExpiry,"d"]})]})]}),r.hasApi&&!a&&m.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(r.id),className:"flex items-center gap-1 text-[10px] text-muted-foreground/50 hover:text-primary transition-colors px-2 py-0.5 rounded border border-dashed border-border hover:border-primary whitespace-nowrap",children:[m.jsx(vee,{size:10}),"연결하기"]}),!r.hasApi&&m.jsx("span",{className:"text-[10px] text-muted-foreground/40 font-normal",children:"CSV only"})]})})}function pae({command:r}){const[e,t]=Y.useState(!1),n=Y.useCallback(()=>{navigator.clipboard.writeText(r),t(!0),setTimeout(()=>t(!1),1200)},[r]);return m.jsxs("div",{className:"flex items-center gap-1 max-w-full",children:[m.jsx(mi,{variant:"muted",className:"whitespace-nowrap overflow-hidden text-ellipsis min-w-0",children:r}),m.jsx("button",{type:"button",onClick:n,className:"shrink-0 p-0.5 rounded transition-colors text-muted-foreground/50",title:"복사",children:e?m.jsx("span",{className:"text-[9px] font-medium text-emerald-600 dark:text-emerald-400",children:"ok"}):m.jsx(nee,{size:10})})]})}const vm=60,Mb=130,ID=28,MH=180,DH=vm,NH=vm+Mb,LH=vm+Mb+ID,kH="after:absolute after:right-0 after:top-0 after:bottom-0 after:w-[6px] after:pointer-events-none after:bg-gradient-to-r after:from-black/[0.04] after:to-transparent dark:after:from-white/[0.06]",RH=r=>({width:r,minWidth:r,maxWidth:r}),Fd=(r,e)=>({width:r,minWidth:r,maxWidth:r,left:e});function gae({group:r,channels:e,ctx:t}){return m.jsx(m.Fragment,{children:r.rows.map((n,a)=>m.jsxs("tr",{style:{borderBottom:"1px solid hsl(var(--border) / 0.5)",borderTop:a===0?"2px solid hsl(var(--border))":void 0},children:[a===0&&m.jsxs("td",{rowSpan:r.rows.length,className:"px-3 py-3 align-middle text-center sticky z-20",style:{...RH(vm),left:0,backgroundColor:"hsl(var(--muted))",borderRight:"1px solid hsl(var(--border) / 0.5)"},children:[m.jsx("span",{className:"text-[9px] font-mono block mb-0.5 text-muted-foreground/40",children:r.categoryId}),m.jsx("span",{className:"text-[12px] font-bold whitespace-nowrap text-foreground/70",children:r.category})]}),m.jsxs("td",{className:"px-3 py-2 font-medium sticky z-20",style:{...Fd(Mb,DH),backgroundColor:"hsl(var(--card))",borderRight:"1px solid hsl(var(--border) / 0.5)"},children:[m.jsx("span",{className:"text-[9px] font-mono mr-1 text-muted-foreground/40",children:n.id}),n.feature]}),m.jsx("td",{className:"text-center sticky z-20",style:{...Fd(ID,NH),backgroundColor:"hsl(var(--card))",borderRight:"1px solid hsl(var(--border) / 0.5)"},children:n.conquered&&m.jsx("span",{className:"text-[13px] leading-none text-emerald-600 dark:text-emerald-400",title:"정복",children:"●"})}),m.jsx("td",{className:`px-3 py-2 sticky z-20 relative overflow-hidden ${kH}`,style:{...Fd(MH,LH),backgroundColor:"hsl(var(--card))"},children:n.command!=="-"?m.jsx(pae,{command:`sppt ${n.command}`}):m.jsx("span",{className:"text-[10px] text-muted-foreground/40",children:"-"})}),e.map(i=>{const o=lae(t.executions[i.id],n.command),s=cae(n.dataKey,t.channelData[i.id],t.settlementData[i.id]);return m.jsx("td",{className:"px-1.5 py-1 text-center min-w-[155px] bg-card",children:m.jsx(dae,{exec:o,dataLabel:s})},i.id)})]},n.feature))})}function mae({executions:r={},channelData:e={},settlementData:t={},channelStatuses:n=[],onConnect:a,isLoading:i=!1}){const[o,s]=Y.useState(""),l=Y.useMemo(()=>{if(!o.trim())return pP;const c=o.trim().toLowerCase();return pP.filter(f=>f.label.toLowerCase().includes(c)||f.id.toLowerCase().includes(c))},[o]),u={executions:r,channelData:e,settlementData:t};return i?m.jsxs("div",{children:[m.jsx("h2",{className:"text-xl font-medium mb-6",children:"채널 보드"}),m.jsx("div",{className:"text-sm text-muted-foreground",children:"로딩 중..."})]}):m.jsxs("div",{children:[m.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-4 sticky top-0 z-10 py-4 -mt-4 md:-mt-7 md:pt-7",style:{backgroundColor:"var(--page-bg, transparent)"},children:[m.jsx("h2",{className:"text-xl font-medium",children:"채널 보드"}),m.jsxs("div",{className:"relative",children:[m.jsx(wg,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground/60"}),m.jsx("input",{type:"text",value:o,onChange:c=>s(c.target.value),placeholder:"채널 검색",className:"pl-7 pr-3 py-1.5 text-[11px] rounded-md w-[160px] focus:outline-none bg-muted/40 border border-border text-foreground"})]})]}),m.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-1.5 text-[11px] mb-3",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"inline-block px-1.5 py-0.5 rounded-[3px] text-[10px] font-medium leading-none",style:TH,children:"방금"}),m.jsx("span",{className:"text-muted-foreground",children:"24시간 이내"})]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"inline-block px-1.5 py-0.5 rounded-[3px] text-[10px] font-medium leading-none",style:CH,children:"3일 전"}),m.jsx("span",{className:"text-muted-foreground",children:"1~7일"})]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"inline-block px-1.5 py-0.5 rounded-[3px] text-[10px] font-medium leading-none",style:ED,children:"2주 전"}),m.jsx("span",{className:"text-muted-foreground",children:"7일 이상"})]}),m.jsx("div",{className:"flex items-center gap-1.5",children:m.jsx("span",{className:"inline-block px-1.5 py-0.5 rounded-[3px] text-[10px] font-medium leading-none",style:AH,children:"실패"})}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"text-[13px] leading-none text-emerald-600 dark:text-emerald-400",children:"●"}),m.jsx("span",{className:"text-muted-foreground",children:"주요 항목"})]})]}),m.jsx("div",{className:"border border-border rounded-lg overflow-hidden",children:m.jsx("div",{className:"overflow-x-auto",children:m.jsxs("table",{className:"w-full text-[12px] border-collapse",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"text-[11px] font-semibold text-muted-foreground",style:{borderBottom:"1px solid hsl(var(--border))"},children:[m.jsx("th",{className:"text-left px-3 py-2.5 sticky z-20",style:{...RH(vm),left:0,backgroundColor:"hsl(var(--background))",borderRight:"1px solid hsl(var(--border) / 0.5)"},children:"영역"}),m.jsx("th",{className:"text-left px-3 py-2.5 sticky z-20",style:{...Fd(Mb,DH),backgroundColor:"hsl(var(--background))",borderRight:"1px solid hsl(var(--border) / 0.5)"},children:"분석 항목"}),m.jsx("th",{className:"text-center py-2.5 sticky z-20",style:{...Fd(ID,NH),backgroundColor:"hsl(var(--background))",borderRight:"1px solid hsl(var(--border) / 0.5)"},title:"핵심 정복 항목",children:m.jsx("span",{className:"text-[10px]",children:"주요"})}),m.jsx("th",{className:`text-left px-3 py-2.5 sticky z-20 relative overflow-hidden ${kH}`,style:{...Fd(MH,LH),backgroundColor:"hsl(var(--background))"},children:m.jsx("span",{className:"font-mono text-[10px]",children:"명령어"})}),l.map(c=>m.jsx(vae,{ch:c,channelStatuses:n,onConnect:a},c.id))]})}),m.jsx("tbody",{children:sae.map(c=>m.jsx(gae,{group:c,channels:l,ctx:u},c.category))})]})})})]})}const zw=5;function yae(r){return`${Math.round(r/1e4).toLocaleString()}만원`}function gP({items:r,totalRevenue:e,leftColSpan:t,totalCol:n}){const[a,i]=Y.useState(!1);if(r.length===0)return null;const o=a?r:r.slice(0,zw),s=r.length>zw;return m.jsxs(m.Fragment,{children:[m.jsx("tr",{style:{borderBottom:"1px solid hsl(var(--border) / 0.3)"},className:"bg-muted/5",children:m.jsxs("td",{colSpan:n,className:"px-4 py-1.5 text-[10px] font-semibold text-muted-foreground tracking-wide",children:["채널별 판매 상품-옵션",m.jsxs("span",{className:"font-normal ml-1.5",children:["(",r.length,"개)"]})]})}),o.map(l=>{const u=e>0?l.totalRevenue/e*100:0,c=l.totalOrderQuantity>0?Math.round(l.totalQuantity/l.totalOrderQuantity):1,f=c>1;return m.jsxs("tr",{style:{borderBottom:"1px solid hsl(var(--border) / 0.4)",backgroundColor:"hsl(var(--muted) / 0.15)"},children:[m.jsx("td",{className:"pl-8 pr-3 py-1.5 text-muted-foreground",colSpan:t,children:m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Tb,{channel:l.channel}),m.jsxs("div",{className:"min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"text-[10px] font-medium shrink-0",children:hr[l.channel]??l.channel}),m.jsx("span",{className:"text-[11px] text-foreground/80",children:l.productName})]}),l.optionName&&m.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight mt-0.5",children:l.optionName})]})]})}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:l.orderCount.toLocaleString()}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:f?m.jsxs("span",{children:[m.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:[l.totalOrderQuantity.toLocaleString(),"×",c,"="]}),l.totalQuantity.toLocaleString()]}):l.totalQuantity.toLocaleString()}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:l.totalQuantity>0?`${Math.round(l.totalRevenue/l.totalQuantity).toLocaleString()}원`:"-"}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] whitespace-nowrap",children:yae(l.totalRevenue)}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[10px] text-muted-foreground whitespace-nowrap",children:u.toFixed(1)}),m.jsx("td",{className:"px-1 py-1.5"})]},`${l.channel}|${l.channelProductId}|${l.channelProductOptionId}`)}),s&&m.jsx("tr",{style:{borderBottom:"1px solid hsl(var(--border) / 0.3)"},children:m.jsx("td",{colSpan:n,className:"px-4 py-1",children:m.jsx("button",{type:"button",onClick:()=>i(l=>!l),className:"text-[10px] cursor-pointer",style:{color:"hsl(37 97% 49%)"},children:a?"접기":`더보기 (${r.length-zw}개 남음)`})})})]})}function mP(r){return`${Math.round(r/1e4).toLocaleString()}만원`}function yP(r,e){return e>0?`${Math.round(r/e).toLocaleString()}원`:"-"}function xae(r,e){const t=e[r];return t?t.commissionRate+t.pgRate:null}function xP({channelBreakdown:r,inflowBreakdown:e=[],totalRevenue:t,defaults:n,variant:a}){const[i,o]=Y.useState(!1),s=e.length>0,l=r.length>1,u=Math.min(90,r.length*30),c=Math.max(0,Math.floor((r.length*26-u)/2)),f=()=>o(v=>!v),h=[];for(const v of r)if(h.push({type:"channel",ch:v}),v.channel==="smartstore"&&i)for(const g of e)h.push({type:"inflow",inf:g,parentRev:v.totalRevenue});return m.jsx(m.Fragment,{children:h.map((v,g)=>{const y=g===0;if(v.type==="channel"){const{ch:M}=v,D=t>0?M.totalRevenue/t*100:0,L=xae(M.channel,n),k=M.channel==="smartstore"&&s,R=hr[M.channel]??M.channel;return m.jsxs("tr",{className:Qe("border-b border-border/30 bg-muted/10 hover:bg-muted/20",k&&"cursor-pointer"),onClick:k?f:void 0,onKeyDown:k?E=>{(E.key==="Enter"||E.key===" ")&&f()}:void 0,children:[m.jsxs("td",{colSpan:a==="product"?5:void 0,className:Qe("py-1.5 text-[11px]",y&&l&&"relative z-[1]"),style:{paddingLeft:l?130:24},children:[y&&l&&m.jsx("div",{className:"absolute left-3 pointer-events-none",style:{top:c},children:m.jsx("div",{className:"pointer-events-auto",children:m.jsx(Zee,{data:r,size:u})})}),m.jsxs("div",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[k&&(i?m.jsx(cn,{size:10,className:"text-muted-foreground"}):m.jsx(qr,{size:10,className:"text-muted-foreground"})),m.jsx(Tb,{channel:M.channel}),m.jsx("span",{children:R})]})]}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:"-"}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:m.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[m.jsx("span",{children:L!=null?`${L.toFixed(1)}%`:"-"}),L!=null&&m.jsx("div",{className:"w-[28px] h-1.5 rounded-full bg-muted/30 overflow-hidden shrink-0",children:m.jsx("div",{className:"h-full rounded-full bg-amber-500/60",style:{width:`${Math.min(L/30*100,100)}%`}})})]})}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:M.orderCount.toLocaleString()}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:M.totalQuantity.toLocaleString()}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:yP(M.totalRevenue,M.totalQuantity)}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] whitespace-nowrap",children:mP(M.totalRevenue)}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:D.toFixed(1)}),m.jsx("td",{className:"px-1 py-1.5",children:m.jsx("div",{className:"h-1.5 rounded-full bg-muted/30 overflow-hidden",children:m.jsx("div",{className:"h-full rounded-full",style:{width:`${D}%`,backgroundColor:ND[M.channel]??"#94a3b8",opacity:.7}})})})]},`ch-${M.channel}`)}const{inf:b,parentRev:_}=v,S=_>0?b.totalRevenue/_*100:0,T=n.smartstore,C=T?(b.inflowPath.includes("마케팅")||b.inflowPath==="마케팅링크"?T.marketingLinkCommissionRate??T.commissionRate:T.commissionRate)+T.pgRate:null;return m.jsxs("tr",{className:"border-b border-border/20 bg-muted/5 hover:bg-muted/15",children:[m.jsx("td",{colSpan:a==="product"?5:void 0,className:"py-1 text-[11px] text-muted-foreground",style:{paddingLeft:l?150:44},children:m.jsx("div",{className:"flex items-center gap-1.5 whitespace-nowrap",children:m.jsx("span",{className:"truncate max-w-[180px]",title:b.inflowPath,children:b.inflowPath})})}),m.jsx("td",{className:"px-2 py-1 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:"-"}),m.jsx("td",{className:"px-2 py-1 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:m.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[m.jsx("span",{children:C!=null?`${C.toFixed(1)}%`:"-"}),C!=null&&m.jsx("div",{className:"w-[28px] h-1 rounded-full bg-muted/30 overflow-hidden shrink-0",children:m.jsx("div",{className:"h-full rounded-full bg-amber-500/60",style:{width:`${Math.min(C/30*100,100)}%`}})})]})}),m.jsx("td",{className:"px-2 py-1 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:b.orderCount.toLocaleString()}),m.jsx("td",{className:"px-2 py-1 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:b.totalQuantity.toLocaleString()}),m.jsx("td",{className:"px-2 py-1 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:yP(b.totalRevenue,b.totalQuantity)}),m.jsx("td",{className:"px-2 py-1 text-right text-[11px] whitespace-nowrap",children:mP(b.totalRevenue)}),m.jsx("td",{className:"px-2 py-1 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:S.toFixed(1)}),m.jsx("td",{className:"px-1 py-1",children:m.jsx("div",{className:"h-1.5 rounded-full bg-muted/30 overflow-hidden",children:m.jsx("div",{className:"h-full rounded-full bg-foreground/25",style:{width:`${Math.min(S,100)}%`}})})})]},`inf-${b.inflowPath}`)})})}function r0(r){return`${Math.round(r/1e4).toLocaleString()}만원`}function bP(r,e){return e>0?`${Math.round(r/e).toLocaleString()}원`:"-"}function _P(r,e){const t=new Map;for(const n of r)for(const a of n){const i=e(a),o=t.get(i);o?(o.orderCount+=a.orderCount,o.totalQuantity+=a.totalQuantity,o.totalRevenue+=a.totalRevenue):t.set(i,{...a})}return[...t.values()].sort((n,a)=>a.totalRevenue-n.totalRevenue)}function bae(r,e){const t=e[r];return t?t.commissionRate+t.pgRate:null}function SP(r,e){let t=0,n=0;for(const a of r){const i=bae(a.channel,e);i!=null&&(t+=i*a.totalRevenue,n+=a.totalRevenue)}return n>0?t/n:null}const Bw=20;function _ae({catalog:r,unmappedCount:e=0,byCategory:t=[],byLine:n=[],feeDefaults:a={},isLoading:i=!1,error:o,dateFrom:s,dateTo:l,onDateChange:u,currentUserRole:c,orderTotalRevenue:f}){const[h,v]=Y.useState(""),[g,y]=Y.useState(""),b=s!==void 0||l!==void 0,_=b?s??"":h,S=b?l??"":g,T=!!_||!!S,[C,M]=Y.useState("category"),[D,L]=Y.useState(new Set),[k,R]=Y.useState(null),[E,I]=Y.useState(new Set),[z,j]=Y.useState(new Set),G=Y.useRef(null);Y.useEffect(()=>{const ye=G.current,Xe=ye==null?void 0:ye.closest(".dashboard main");if(!ye||!Xe)return;const et=new ResizeObserver(()=>{Xe.style.setProperty("--page-header-h",`${ye.offsetHeight}px`)});return et.observe(ye),()=>et.disconnect()},[]);const U=!c||c==="admin"||c==="editor",[O,H]=Y.useState(!1),[F,$]=Y.useState(null),[B,X]=Y.useState(""),[q,Q]=Y.useState(!1),[ne,fe]=Y.useState(""),[ve,Se]=Y.useState(!1),ge=Y.useCallback(async()=>{if(O){H(!1),Q(!1);return}try{const Xe=await(await fetch("/api/product-rules")).json();$(Xe.content),X(Xe.path),H(!0)}catch{H(!0)}},[O]),he=Y.useCallback(()=>{fe(F??""),Q(!0)},[F]),Ne=Y.useCallback(async()=>{Se(!0);try{await fetch("/api/product-rules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:ne})}),$(ne),Q(!1)}finally{Se(!1)}},[ne]),xe=Y.useMemo(()=>r.filter(ye=>!(E.size>0&&!E.has(ye.category??"")||z.size>0&&!z.has(ye.productLine??""))),[r,E,z]),Te=Y.useMemo(()=>[...xe].sort((ye,Xe)=>Xe.totalRevenue-ye.totalRevenue),[xe]),$e=Y.useMemo(()=>{const ye=new Map;for(const Xe of Te){const et=`${Xe.productName}||${Xe.brand??""}||${Xe.productLine??""}`,An=ye.get(et);An?(An.skus.push(Xe),An.totalQuantity+=Xe.totalQuantity,An.totalRevenue+=Xe.totalRevenue,An.orderCount+=Xe.orderCount):ye.set(et,{key:et,productName:Xe.productName,brand:Xe.brand,productLine:Xe.productLine,category:Xe.category,skus:[Xe],totalQuantity:Xe.totalQuantity,totalRevenue:Xe.totalRevenue,orderCount:Xe.orderCount,channelBreakdown:[],inflowBreakdown:[]})}for(const Xe of ye.values())Xe.channelBreakdown=_P(Xe.skus.map(et=>et.channelBreakdown??[]),et=>et.channel),Xe.inflowBreakdown=_P(Xe.skus.map(et=>et.inflowBreakdown??[]),et=>et.inflowPath);return[...ye.values()].sort((Xe,et)=>et.totalRevenue-Xe.totalRevenue)},[Te]),We=ye=>{L(Xe=>{const et=new Set(Xe);return et.has(ye)?et.delete(ye):et.add(ye),et})};Y.useEffect(()=>vt(Bw),[E,z,_,S]);const[lt,vt]=Y.useState(Bw),Ee=Y.useMemo(()=>$e.slice(0,lt),[$e,lt]),bt=lt<$e.length,Mt=Y.useMemo(()=>r.reduce((ye,Xe)=>ye+Xe.totalQuantity,0),[r]),ar=Y.useMemo(()=>r.reduce((ye,Xe)=>ye+Xe.totalRevenue,0),[r]),Ur=Y.useMemo(()=>[...new Set(r.map(ye=>ye.category??""))].sort(),[r]),ki=Y.useMemo(()=>[...new Set(r.map(ye=>ye.productLine??""))].sort(),[r]),Ls=(ye,Xe)=>{const et=new Set(ye);return et.has(Xe)?et.delete(Xe):et.add(Xe),et},uf=E.size>0||z.size>0;function cf(ye,Xe){b||(v(ye),y(Xe)),u==null||u(ye,Xe)}if(i)return m.jsxs("div",{children:[m.jsx("h2",{className:"text-xl font-medium mb-6",children:"상품"}),m.jsx("div",{className:"text-sm py-8 text-center text-muted-foreground",children:"불러오는 중..."})]});if(o)return m.jsxs("div",{children:[m.jsx("h2",{className:"text-xl font-medium mb-6",children:"상품"}),m.jsx("div",{className:"text-sm py-8 text-center text-destructive",children:"카탈로그 조회 실패"})]});if(r.length===0&&!T)return m.jsxs("div",{children:[m.jsx("h2",{className:"text-xl font-medium mb-6",children:"상품"}),m.jsxs("div",{className:"border border-dashed border-border rounded-lg p-12 text-center text-sm text-muted-foreground",children:["상품 카탈로그가 비어있습니다.",m.jsx("div",{className:"text-[11px] mt-1",children:"sppt product parse 스킬로 상품명을 해체하세요."})]})]});const Ri=C==="category"?t:n;return m.jsxs("div",{children:[m.jsxs("div",{ref:G,className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-4 sticky top-0 z-10 py-4 -mt-4 md:-mt-7 md:pt-7",style:{backgroundColor:"var(--page-bg, transparent)"},children:[m.jsx("h2",{className:"text-xl font-medium",children:"상품"}),m.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[m.jsxs("button",{type:"button",onClick:ge,className:Qe("flex items-center gap-1.5 text-[12px] px-2.5 py-1 rounded-md border cursor-pointer transition-colors",O?"border-primary bg-primary text-primary-foreground":"border-primary bg-primary text-primary-foreground hover:opacity-90"),children:[m.jsx(QO,{size:12}),"분류 규칙"]}),m.jsxs("span",{className:"text-[12px] text-muted-foreground",children:["총 ",r.length.toLocaleString(),"개 SKU"]})]})]}),m.jsx(DD,{from:_,to:S,onChange:cf,className:"mb-5"}),O&&m.jsx("dialog",{open:!0,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm",onClick:ye=>{ye.target===ye.currentTarget&&!q&&H(!1)},onKeyDown:ye=>{ye.key==="Escape"&&!q&&H(!1)},"aria-label":"분류 규칙",tabIndex:-1,children:m.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-xl w-[860px] max-w-[95vw] max-h-[80vh] flex flex-col overflow-hidden",children:[m.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border bg-muted/40 shrink-0",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(QO,{size:13,className:"text-muted-foreground"}),m.jsx("span",{className:"text-[13px] font-medium",children:"분류 규칙"}),B&&m.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:B})]}),m.jsxs("div",{className:"flex items-center gap-2",children:[U&&q?m.jsxs(m.Fragment,{children:[m.jsx("button",{type:"button",onClick:()=>Q(!1),className:"text-[11px] px-2 py-0.5 rounded border border-border text-muted-foreground hover:text-foreground cursor-pointer",children:"취소"}),m.jsx("button",{type:"button",onClick:Ne,disabled:ve,className:"text-[11px] px-2.5 py-0.5 rounded bg-primary text-primary-foreground cursor-pointer disabled:opacity-50",children:ve?"저장 중...":"저장"})]}):U?m.jsx("button",{type:"button",onClick:he,className:"text-[11px] px-2.5 py-0.5 rounded border border-border bg-secondary text-foreground hover:bg-muted cursor-pointer",children:"편집"}):null,!q&&m.jsx("button",{type:"button",onClick:()=>{H(!1),Q(!1)},className:"text-muted-foreground hover:text-foreground cursor-pointer",children:m.jsx(ql,{size:14})})]})]}),m.jsx("div",{className:"px-5 py-2 text-[11px] text-muted-foreground border-b border-border/50 bg-muted/20 shrink-0",children:"AI가 이 규칙을 바탕으로 주문 데이터의 상품명을 SKU, 카테고리, 제품라인 단위로 자동 분류합니다."}),m.jsxs("div",{className:"flex divide-x divide-border/60 flex-1 overflow-hidden",children:[m.jsx("div",{className:"flex-1 px-5 py-4 overflow-y-auto",children:q?m.jsx("textarea",{value:ne,onChange:ye=>fe(ye.target.value),className:"w-full h-full min-h-[320px] text-[11px] leading-relaxed bg-transparent outline-none resize-none font-sans text-foreground/90",placeholder:`예시:
|
|
287
|
+
color: hsl(${Math.max(0,Math.min(120-120*b,120))}deg 100% 31%);`,t==null?void 0:t.key)}return t!=null&&t.onChange&&!(i&&t.skipInitialOnChange)&&t.onChange(a),i=!1,a}return o.updateDeps=s=>{n=s},o}function tP(r,e){if(r===void 0)throw new Error("Unexpected undefined");return r}const ete=(r,e)=>Math.abs(r-e)<1.01,tte=(r,e,t)=>{let n;return function(...a){r.clearTimeout(n),n=r.setTimeout(()=>e.apply(this,a),t)}},rP=r=>{const{offsetWidth:e,offsetHeight:t}=r;return{width:e,height:t}},rte=r=>r,nte=r=>{const e=Math.max(r.startIndex-r.overscan,0),t=Math.min(r.endIndex+r.overscan,r.count-1),n=[];for(let a=e;a<=t;a++)n.push(a);return n},ate=(r,e)=>{const t=r.scrollElement;if(!t)return;const n=r.targetWindow;if(!n)return;const a=o=>{const{width:s,height:l}=o;e({width:Math.round(s),height:Math.round(l)})};if(a(rP(t)),!n.ResizeObserver)return()=>{};const i=new n.ResizeObserver(o=>{const s=()=>{const l=o[0];if(l!=null&&l.borderBoxSize){const u=l.borderBoxSize[0];if(u){a({width:u.inlineSize,height:u.blockSize});return}}a(rP(t))};r.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()});return i.observe(t,{box:"border-box"}),()=>{i.unobserve(t)}},nP={passive:!0},aP=typeof window>"u"?!0:"onscrollend"in window,ite=(r,e)=>{const t=r.scrollElement;if(!t)return;const n=r.targetWindow;if(!n)return;let a=0;const i=r.options.useScrollendEvent&&aP?()=>{}:tte(n,()=>{e(a,!1)},r.options.isScrollingResetDelay),o=c=>()=>{const{horizontal:f,isRtl:h}=r.options;a=f?t.scrollLeft*(h&&-1||1):t.scrollTop,i(),e(a,c)},s=o(!0),l=o(!1);t.addEventListener("scroll",s,nP);const u=r.options.useScrollendEvent&&aP;return u&&t.addEventListener("scrollend",l,nP),()=>{t.removeEventListener("scroll",s),u&&t.removeEventListener("scrollend",l)}},ote=(r,e,t)=>{if(e!=null&&e.borderBoxSize){const n=e.borderBoxSize[0];if(n)return Math.round(n[t.options.horizontal?"inlineSize":"blockSize"])}return r[t.options.horizontal?"offsetWidth":"offsetHeight"]},ste=(r,{adjustments:e=0,behavior:t},n)=>{var a,i;const o=r+e;(i=(a=n.scrollElement)==null?void 0:a.scrollTo)==null||i.call(a,{[n.options.horizontal?"left":"top"]:o,behavior:t})};class lte{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var t,n,a;return((a=(n=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:n.now)==null?void 0:a.call(n))??Date.now()},this.observer=(()=>{let t=null;const n=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(a=>{a.forEach(i=>{const o=()=>{const s=i.target,l=this.indexFromElement(s);if(!s.isConnected){this.observer.unobserve(s);return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(s,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var a;(a=n())==null||a.disconnect(),t=null},observe:a=>{var i;return(i=n())==null?void 0:i.observe(a,{box:"border-box"})},unobserve:a=>{var i;return(i=n())==null?void 0:i.unobserve(a)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([n,a])=>{typeof a>"u"&&delete t[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:rte,rangeExtractor:nte,onChange:()=>{},measureElement:ote,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",...t}},this.notify=t=>{var n,a;(a=(n=this.options).onChange)==null||a.call(n,this,t)},this.maybeNotify=Zf(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(a=>{this.observer.observe(a)}),this.unsubs.push(this.options.observeElementRect(this,a=>{this.scrollRect=a,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(a,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<a?"forward":"backward":null,this.scrollOffset=a,this.isScrolling=i,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(t,n)=>{const a=new Map,i=new Map;for(let o=n-1;o>=0;o--){const s=t[o];if(a.has(s.lane))continue;const l=i.get(s.lane);if(l==null||s.end>l.end?i.set(s.lane,s):s.end<l.end&&a.set(s.lane,!0),a.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((o,s)=>o.end===s.end?o.index-s.index:o.end-s.end)[0]:void 0},this.getMeasurementOptions=Zf(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(t,n,a,i,o,s,l)=>(this.prevLanes!==void 0&&this.prevLanes!==s&&(this.lanesChangedFlag=!0),this.prevLanes=s,this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:n,scrollMargin:a,getItemKey:i,enabled:o,lanes:s,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=Zf(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:n,scrollMargin:a,getItemKey:i,enabled:o,lanes:s,laneAssignmentMode:l},u)=>{if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const v of this.laneAssignments.keys())v>=t&&this.laneAssignments.delete(v);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(v=>{this.itemSizeCache.set(v.key,v.size)}));const c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1);const f=this.measurementsCache.slice(0,c),h=new Array(s).fill(void 0);for(let v=0;v<c;v++){const g=f[v];g&&(h[g.lane]=v)}for(let v=c;v<t;v++){const g=i(v),y=this.laneAssignments.get(v);let b,_;const S=l==="estimate"||u.has(g);if(y!==void 0&&this.options.lanes>1){b=y;const D=h[b],L=D!==void 0?f[D]:void 0;_=L?L.end+this.options.gap:n+a}else{const D=this.options.lanes===1?f[v-1]:this.getFurthestMeasurement(f,v);_=D?D.end+this.options.gap:n+a,b=D?D.lane:v%this.options.lanes,this.options.lanes>1&&S&&this.laneAssignments.set(v,b)}const T=u.get(g),C=typeof T=="number"?T:this.options.estimateSize(v),M=_+C;f[v]={index:v,start:_,size:C,end:M,key:g,lane:b},h[b]=v}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Zf(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,n,a,i)=>this.range=t.length>0&&n>0?ute({measurements:t,outerSize:n,scrollOffset:a,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Zf(()=>{let t=null,n=null;const a=this.calculateRange();return a&&(t=a.startIndex,n=a.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,n]},(t,n,a,i,o)=>i===null||o===null?[]:t({startIndex:i,endIndex:o,overscan:n,count:a}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const n=this.options.indexAttribute,a=t.getAttribute(n);return a?parseInt(a,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const a=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(a!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,a-i),s=Math.min(this.options.count-1,a+i);return t>=o&&t<=s}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((o,s)=>{o.isConnected||(this.observer.unobserve(o),this.elementsCache.delete(s))});return}const n=this.indexFromElement(t),a=this.options.getItemKey(n),i=this.elementsCache.get(a);i!==t&&(i&&this.observer.unobserve(i),this.observer.observe(t),this.elementsCache.set(a,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,n)=>{var a;const i=this.measurementsCache[t];if(!i)return;const o=this.itemSizeCache.get(i.key)??i.size,s=n-o;s!==0&&(((a=this.scrollState)==null?void 0:a.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,s,this):i.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=s,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,n)),this.notify(!1))},this.getVirtualItems=Zf(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,n)=>{const a=[];for(let i=0,o=t.length;i<o;i++){const s=t[i],l=n[s];a.push(l)}return a},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const n=this.getMeasurements();if(n.length!==0)return tP(n[uH(0,n.length-1,a=>tP(n[a]).start,t)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(t,n,a=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),o=this.getScrollOffset();n==="auto"&&(n=t>=o+i?"end":"start"),n==="center"?t+=(a-i)/2:n==="end"&&(t-=i);const s=this.getMaxScrollOffset();return Math.max(Math.min(s,t),0)},this.getOffsetForIndex=(t,n="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const a=this.getSize(),i=this.getScrollOffset(),o=this.measurementsCache[t];if(!o)return;if(n==="auto")if(o.end>=i+a-this.options.scrollPaddingEnd)n="end";else if(o.start<=i+this.options.scrollPaddingStart)n="start";else return[i,n];if(n==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),n];const s=n==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(s,n,o.size),n]},this.scrollToOffset=(t,{align:n="start",behavior:a="auto"}={})=>{const i=this.getOffsetForAlignment(t,n),o=this.now();this.scrollState={index:null,align:n,behavior:a,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:a}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:n="auto",behavior:a="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));const i=this.getOffsetForIndex(t,n);if(!i)return;const[o,s]=i,l=this.now();this.scrollState={index:t,align:s,behavior:a,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:a}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:n="auto"}={})=>{const a=this.getScrollOffset()+t,i=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:i,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var t;const n=this.getMeasurements();let a;if(n.length===0)a=this.options.paddingStart;else if(this.options.lanes===1)a=((t=n[n.length-1])==null?void 0:t.end)??0;else{const i=Array(this.options.lanes).fill(null);let o=n.length-1;for(;o>=0&&i.some(s=>s===null);){const s=n[o];i[s.lane]===null&&(i[s.lane]=s.end),o--}a=Math.max(...i.filter(s=>s!==null))}return Math.max(a-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:n,behavior:a})=>{this.options.scrollToFn(t,{behavior:a,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,a=n?n[0]:this.scrollState.lastTargetOffset,i=1,o=a!==this.scrollState.lastTargetOffset;if(!o&&ete(a,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.scrollState=null;return}}else this.scrollState.stableFrames=0,o&&(this.scrollState.lastTargetOffset=a,this.scrollState.behavior="auto",this._scrollToOffset(a,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const uH=(r,e,t,n)=>{for(;r<=e;){const a=(r+e)/2|0,i=t(a);if(i<n)r=a+1;else if(i>n)e=a-1;else return a}return r>0?r-1:0};function ute({measurements:r,outerSize:e,scrollOffset:t,lanes:n}){const a=r.length-1,i=l=>r[l].start;if(r.length<=n)return{startIndex:0,endIndex:a};let o=uH(0,a,i,t),s=o;if(n===1)for(;s<a&&r[s].end<t+e;)s++;else if(n>1){const l=Array(n).fill(0);for(;s<a&&l.some(c=>c<t+e);){const c=r[s];l[c.lane]=c.end,s++}const u=Array(n).fill(t+e);for(;o>=0&&u.some(c=>c>=t);){const c=r[o];u[c.lane]=c.start,o--}o=Math.max(0,o-o%n),s=Math.min(a,s+(n-1-s%n))}return{startIndex:o,endIndex:s}}const iP=typeof document<"u"?Y.useLayoutEffect:Y.useEffect;function cte({useFlushSync:r=!0,...e}){const t=Y.useReducer(()=>({}),{})[1],n={...e,onChange:(i,o)=>{var s;r&&o?pb.flushSync(t):t(),(s=e.onChange)==null||s.call(e,i,o)}},[a]=Y.useState(()=>new lte(n));return a.setOptions(n),iP(()=>a._didMount(),[]),iP(()=>a._willUpdate()),a}function fte(r){return cte({observeElementRect:ate,observeElementOffset:ite,scrollToFn:ste,...r})}const dte={스마트스토어정산:"스마트스토어",쿠팡정산:"쿠팡",tosspaymen:"토스페이먼츠",Npay정산:"네이버페이",카페24페이먼:"카페24페이먼츠",Shopify:"Shopify",토스쇼핑정산:"토스쇼핑"},hte={스마트스토어정산:"#22c55e",쿠팡정산:"#f97316",tosspaymen:"#3b82f6",Npay정산:"#16a34a",카페24페이먼:"#6366f1",Shopify:"#10b981",토스쇼핑정산:"#38bdf8"};function LD(r){return r.byProvider&&r.byProvider.length>0?r.byProvider.map(e=>({key:e.provider,label:dte[e.provider]??e.provider,color:hte[e.provider]??"#888",amount:e.amount})):r.byChannel.map(e=>({key:e.channel,label:hr[e.channel]??e.channel,color:ND[e.channel]??"#888",amount:e.amount}))}const vte=["일","월","화","수","목","금","토"];function cH(r){const e=new Date(`${r}T00:00:00Z`);return vte[e.getUTCDay()]??""}function fH(r){return r.slice(5).replace("-","/")}function pte(r){return r>=1e8?`${(r/1e8).toFixed(1)}억`:r>=1e4?`${Math.round(r/1e4)}만`:r>=1e3?`${Math.round(r/1e3)}천`:r.toLocaleString()}function dH({items:r,className:e}){return m.jsx(m.Fragment,{children:r.map(t=>m.jsxs("div",{className:Qe("flex items-center justify-between gap-4 text-[11px]",e),children:[m.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[m.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:t.color}}),m.jsx("span",{className:"text-muted-foreground truncate",children:t.label})]}),m.jsx("span",{className:"font-medium tabular-nums shrink-0",children:jl(t.amount)})]},t.key))})}function gte({dateStr:r,day:e}){var a;const t=LD(e),n=e.holdbacks&&e.holdbacks.length>0;return m.jsxs("div",{className:"min-w-[180px] space-y-1",children:[m.jsxs("div",{className:"text-[10px] text-muted-foreground font-medium mb-0.5",children:[fH(r)," (",cH(r),")"]}),m.jsx(dH,{items:t}),n&&((a=e.holdbacks)==null?void 0:a.map(i=>m.jsxs("div",{className:"flex items-center justify-between gap-4 text-[11px] text-amber-600 dark:text-amber-400",children:[m.jsxs("span",{children:["지급보류 ",i.provider]}),m.jsxs("span",{className:"font-medium tabular-nums",children:["-",jl(i.amount)]})]},i.provider))),m.jsxs("div",{className:"flex justify-between gap-4 text-[11px] font-semibold pt-1 border-t border-border/40",children:[m.jsx("span",{children:n?"실입금":"합계"}),m.jsx("span",{className:"tabular-nums text-emerald-500",children:jl(n&&e.adjustedAmount!=null?e.adjustedAmount:e.totalAmount)})]})]})}function mte({year:r,month:e,depositMap:t,today:n,maxAmount:a}){const i=new Date(`${r}-${String(e).padStart(2,"0")}-01T00:00:00Z`).getUTCDay(),o=new Date(r,e,0).getDate(),s=[...Array(i).fill(null),...Array.from({length:o},(l,u)=>u+1)];return m.jsxs("div",{children:[m.jsxs("div",{className:"text-[11px] font-medium text-muted-foreground mb-2",children:[r,"년 ",e,"월"]}),m.jsxs("div",{className:"grid grid-cols-7 gap-[2px]",children:[["일","월","화","수","목","금","토"].map(l=>m.jsx("div",{className:"text-center text-[9px] text-muted-foreground/50 py-0.5 font-medium",children:l},l)),s.map((l,u)=>{if(!l)return m.jsx("div",{className:"h-[40px]"},`e-${u}`);const c=`${r}-${String(e).padStart(2,"0")}-${String(l).padStart(2,"0")}`,f=t.get(c),h=c===n,v=(f==null?void 0:f.holdbacks)&&f.holdbacks.length>0,g=f?.07+f.totalAmount/a*.28:0,y=m.jsxs("div",{className:Qe("h-[40px] flex flex-col items-center justify-center gap-0.5 rounded cursor-default",h&&"ring-1 ring-inset ring-primary/50",v&&"ring-1 ring-inset ring-amber-400/60"),style:f?{backgroundColor:`hsl(var(--primary) / ${g})`}:void 0,children:[m.jsx("span",{className:Qe("text-[10px] leading-none",h?"font-bold text-primary":f?"font-medium text-foreground":"text-muted-foreground/60"),children:l}),f&&m.jsx("span",{className:Qe("text-[8px] font-semibold leading-none",v?"text-amber-600 dark:text-amber-400":"text-foreground/80"),children:pte(v&&f.adjustedAmount!=null?f.adjustedAmount:f.totalAmount)})]});return f?m.jsx(us,{content:m.jsx(gte,{dateStr:c,day:f}),side:"top",contentClassName:"max-w-[240px]",delayDuration:80,children:y},c):m.jsx("div",{children:y},c)})]})]})}function yte(r){if(r.type==="divider")return 28;if(r.type==="empty-upcoming")return 32;const e=r.day.byProvider&&r.day.byProvider.length>0?r.day.byProvider.length:r.day.byChannel.length;return 36+e*22+(e>1?28:0)}function xte({schedule:r,today:e}){const t=[...r].sort((c,f)=>c.depositDate.localeCompare(f.depositDate)),n=t.filter(c=>c.depositDate<e),a=t.filter(c=>c.depositDate>=e),i=[...n.map(c=>({type:"day",day:c,isPast:!0})),...n.length>0&&a.length>0?[{type:"divider",label:"예정 입금"}]:[],...a.length===0&&n.length>0?[{type:"empty-upcoming"}]:[],...a.map(c=>({type:"day",day:c,isPast:!1}))],o=i.findIndex(c=>c.type==="divider"||c.type==="day"&&!c.isPast),s=Math.max(0,o-2),l=Y.useRef(null),u=fte({count:i.length,getScrollElement:()=>l.current,estimateSize:c=>yte(i[c]??{type:"empty-upcoming"}),overscan:5});return Y.useEffect(()=>{i.length===0||o<0||u.scrollToIndex(s,{align:"start"})},[i.length,o,s,u.scrollToIndex]),m.jsxs("div",{className:"absolute inset-0 border border-border rounded-lg bg-card flex flex-col overflow-hidden",children:[m.jsx("div",{className:"px-3 pt-3 pb-2 text-[11px] font-medium text-muted-foreground border-b border-border/50 shrink-0",children:"입금 내역"}),t.length===0?m.jsx("p",{className:"text-[12px] text-muted-foreground px-3 py-3",children:"데이터 없음"}):m.jsx("div",{ref:l,className:"flex-1 overflow-y-auto",children:m.jsx("div",{style:{height:u.getTotalSize(),position:"relative"},children:u.getVirtualItems().map(c=>{const f=i[c.index];return f?m.jsxs("div",{"data-index":c.index,ref:u.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${c.start}px)`},children:[f.type==="divider"&&m.jsx("div",{className:"px-3 py-1.5 text-[10px] text-muted-foreground/50 bg-muted/30 border-y border-border/50",children:f.label}),f.type==="empty-upcoming"&&m.jsx("p",{className:"text-[11px] text-muted-foreground px-3 py-2",children:"향후 예정 없음"}),f.type==="day"&&(()=>{var y;const{day:h,isPast:v}=f,g=LD(h);return m.jsxs("div",{className:Qe("px-3 py-2.5 border-b border-border/50",v&&"opacity-50"),children:[m.jsxs("div",{className:"text-[10px] font-semibold text-foreground/70 mb-1.5",children:[fH(h.depositDate)," ",m.jsxs("span",{className:"font-normal text-muted-foreground/60",children:["(",cH(h.depositDate),")"]}),v&&m.jsx("span",{className:"ml-1 text-muted-foreground/40 font-normal",children:"완료"})]}),m.jsxs("div",{className:"space-y-1",children:[m.jsx(dH,{items:g}),(y=h.holdbacks)==null?void 0:y.map(b=>m.jsxs("div",{className:"flex items-center justify-between gap-2 text-[10px] text-amber-600 dark:text-amber-400",children:[m.jsxs("span",{className:"truncate",children:["지급보류 ",b.provider]}),m.jsxs("span",{className:"font-medium tabular-nums shrink-0",children:["-",jl(b.amount)]})]},b.provider)),(g.length>1||h.holdbacks&&h.holdbacks.length>0)&&m.jsxs("div",{className:"flex justify-between text-[10px] font-semibold pt-1 border-t border-border/30",children:[m.jsx("span",{className:"text-muted-foreground/60",children:h.holdbacks&&h.holdbacks.length>0?"실입금":"합계"}),m.jsx("span",{className:"text-emerald-600 dark:text-emerald-400 tabular-nums",children:jl(h.adjustedAmount!=null?h.adjustedAmount:h.totalAmount)})]})]})]})})()]},c.key):null})})})]})}function bte({depositSchedule:r,today:e,maxAmount:t}){const n=e??new Date().toISOString().slice(0,10),a=t??Math.max(...r.map(y=>y.totalAmount),1),i=new Map(r.map(y=>[y.depositDate,y])),[o,s]=n.split("-").map(Number),[l,u]=Y.useState(0),c=new Date(o,s-1+l,1),f={year:c.getFullYear(),month:c.getMonth()+1},h=new Date(c.getFullYear(),c.getMonth()+1,1),v={year:h.getFullYear(),month:h.getMonth()+1},g=[f,v];return m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4",children:[m.jsxs("div",{className:"flex items-center justify-end gap-1 mb-2",children:[m.jsx("button",{type:"button",onClick:()=>u(y=>y-1),className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",children:m.jsx(CD,{size:14})}),m.jsx("button",{type:"button",onClick:()=>u(0),className:Qe("px-2 py-0.5 rounded text-[10px] transition-colors",l===0?"text-muted-foreground/40 cursor-default":"text-muted-foreground hover:bg-muted hover:text-foreground"),disabled:l===0,children:"오늘"}),m.jsx("button",{type:"button",onClick:()=>u(y=>y+1),className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",children:m.jsx(qr,{size:14})})]}),m.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6 sm:divide-x sm:divide-border/40",children:g.map(({year:y,month:b})=>m.jsx(mte,{year:y,month:b,depositMap:i,today:n,maxAmount:a},`${y}-${b}`))})]})}const kD=Y.createContext({sticky:!1});function ho({children:r,minWidth:e,stickyHeader:t=!1,sort:n,onSort:a,className:i,...o}){return m.jsx(kD.Provider,{value:{sticky:t,sort:n,onSort:a},children:m.jsx("div",{className:Qe("border border-border rounded-lg",t?"overflow-clip":"overflow-x-auto",i),...o,children:m.jsx("table",{className:"w-full text-[12px] border-collapse",style:e?{minWidth:e}:void 0,children:r})})})}function vo({children:r,className:e,...t}){const{sticky:n}=Y.useContext(kD);return m.jsx("thead",{className:Qe(n&&"sticky z-[5]",e),style:n?{top:"var(--page-header-h, 0px)",backgroundColor:"var(--page-bg, white)"}:void 0,...t,children:m.jsx("tr",{className:"border-b border-border bg-muted/40 text-[11px] font-semibold text-muted-foreground",children:r})})}function je({align:r="left",sortKey:e,className:t,children:n,onClick:a,...i}){const{sort:o,onSort:s}=Y.useContext(kD),l=!!e&&!!s,c=l&&(o==null?void 0:o.key)===e?o==null?void 0:o.dir:null;function f(v){l&&s(e),a==null||a(v)}const h=r==="right"?"text-right":r==="center"?"text-center":"text-left";return m.jsx("th",{className:Qe("px-3 py-2 whitespace-nowrap",h,l&&"cursor-pointer select-none hover:text-foreground transition-colors",t),onClick:l?f:a,...i,children:l?m.jsxs("span",{className:Qe("inline-flex items-center gap-1",r==="right"?"justify-end":""),children:[n,c==="asc"?m.jsx(FJ,{size:12,className:"shrink-0"}):c==="desc"?m.jsx(OJ,{size:12,className:"shrink-0"}):m.jsx(GJ,{size:12,className:"shrink-0 opacity-30"})]}):n})}function _te(r,e="asc"){const[t,n]=Y.useState(null),a=Y.useCallback(o=>{n(s=>(s==null?void 0:s.key)===o?s.dir==="asc"?{key:o,dir:"desc"}:null:{key:o,dir:"asc"})},[]),i=Y.useCallback((o,s)=>{if(!t)return o;const{key:l,dir:u}=t;return[...o].sort((c,f)=>{const h=s(c,l),v=s(f,l);if(typeof h=="number"&&typeof v=="number")return u==="asc"?h-v:v-h;const g=String(h??""),y=String(v??"");return u==="asc"?g.localeCompare(y):y.localeCompare(g)})},[t]);return{sort:t,onSort:a,sortData:i}}const Ste=["cancelled","returned","pending"];function wte(r){return!Ste.includes(r)}function mi({children:r,variant:e="primary",className:t}){return m.jsx("code",{className:Qe("font-mono rounded",e==="primary"&&"bg-primary/10 text-primary px-1 py-px text-[0.85em]",e==="muted"&&"bg-muted/60 text-foreground/70 px-1.5 py-0.5 text-[10px]",t),children:r})}const Tte=[{days:3,label:"3일"},{days:7,label:"7일",default:!0},{days:14,label:"14일"},{days:30,label:"30일"},{days:90,label:"90일"}];function e1({onSync:r,syncing:e=!1,syncResult:t,timeLeft:n,disabled:a=!1}){const[i,o]=Y.useState(7),[s,l]=Y.useState(!1),u=Y.useRef(null);Y.useEffect(()=>{function h(v){u.current&&!u.current.contains(v.target)&&l(!1)}return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[]);const c="flex items-center rounded-none bg-primary text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50 cursor-pointer",f=e&&n!=null&&n>0?`약 ${n}초 후 완료`:t??null;return m.jsxs("div",{className:"flex items-center gap-2",children:[f&&m.jsx("span",{className:"text-[11px] text-muted-foreground",children:f}),m.jsxs("div",{ref:u,className:"relative flex",children:[m.jsxs("div",{className:"flex rounded overflow-hidden",children:[m.jsxs("button",{type:"button",onClick:()=>!a&&r(i),disabled:e||a,className:Qe(c,"gap-1.5 text-[12px] px-2.5 py-1 border-r border-primary-foreground/20"),children:[m.jsx(Dee,{size:12,className:e?"animate-spin":""}),e?"동기화 중...":i===7?"주문 동기화":`주문 동기화 · ${i}일`]}),m.jsx("button",{type:"button",onClick:()=>!a&&l(h=>!h),disabled:e||a,className:Qe(c,"px-1.5 py-1"),"aria-label":"동기화 기간 선택",children:m.jsx(cn,{size:12,className:Qe("transition-transform",s&&"rotate-180")})})]}),s&&m.jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 w-max min-w-[110px] rounded border border-border bg-popover shadow-md py-1",children:[Tte.map(h=>m.jsxs("button",{type:"button",onClick:()=>{o(h.days),l(!1)},className:Qe("w-full text-left px-3 py-1.5 text-[12px] cursor-pointer hover:bg-muted/70 hover:text-foreground transition-colors flex items-center justify-between gap-4",i===h.days?"text-primary font-medium":"text-muted-foreground"),children:[m.jsx("span",{children:h.label}),"default"in h&&m.jsx("span",{className:"text-[10px] text-muted-foreground",children:"기본"})]},h.days)),m.jsx("div",{className:"border-t border-border/50 mt-1 mx-2"}),m.jsxs("p",{className:"px-3 py-2 text-[10px] text-muted-foreground leading-snug whitespace-nowrap",children:["90일 이전은 채널 관리자에서 CSV 다운로드 후",m.jsx("br",{}),m.jsx(mi,{children:"sppt order import"}),"로 가져오세요."]})]})]})]})}function Cte({channelFilter:r,statusFilter:e,productSearch:t,channelOptions:n,statusOptions:a,onChannelToggle:i,onChannelClear:o,onStatusToggle:s,onStatusClear:l,onProductSearch:u,onReset:c}){const f=r.size>0||e.size>0||t;return m.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-4",children:[m.jsx(Jx,{label:"채널",options:n,selected:r,onToggle:i,onClear:o,renderOption:h=>m.jsx("span",{children:hr[h]??h})}),m.jsx(Jx,{label:"상태",options:a,selected:e,onToggle:s,onClear:l,renderOption:h=>m.jsx(lH,{status:h})}),m.jsx(Kee,{label:"상품 검색",value:t,onChange:u}),f&&m.jsxs("button",{type:"button",onClick:c,className:"text-[11px] text-muted-foreground hover:text-foreground flex items-center gap-0.5 cursor-pointer",children:[m.jsx(ql,{size:11})," 전체 초기화"]})]})}const hH=6048e5,Ate=864e5,vH=6e4,pH=36e5,e0=43200,oP=1440,sP=Symbol.for("constructDateFrom");function po(r,e){return typeof r=="function"?r(e):r&&typeof r=="object"&&sP in r?r[sP](e):r instanceof Date?new r.constructor(e):new Date(e)}function Vr(r,e){return po(e||r,r)}let Mte={};function hm(){return Mte}function Ag(r,e){var s,l,u,c;const t=hm(),n=(e==null?void 0:e.weekStartsOn)??((l=(s=e==null?void 0:e.locale)==null?void 0:s.options)==null?void 0:l.weekStartsOn)??t.weekStartsOn??((c=(u=t.locale)==null?void 0:u.options)==null?void 0:c.weekStartsOn)??0,a=Vr(r,e==null?void 0:e.in),i=a.getDay(),o=(i<n?7:0)+i-n;return a.setDate(a.getDate()-o),a.setHours(0,0,0,0),a}function t1(r,e){return Ag(r,{...e,weekStartsOn:1})}function gH(r,e){const t=Vr(r,e==null?void 0:e.in),n=t.getFullYear(),a=po(t,0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);const i=t1(a),o=po(t,0);o.setFullYear(n,0,4),o.setHours(0,0,0,0);const s=t1(o);return t.getTime()>=i.getTime()?n+1:t.getTime()>=s.getTime()?n:n-1}function r1(r){const e=Vr(r),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+r-+t}function Cb(r,...e){const t=po.bind(null,r||e.find(n=>typeof n=="object"));return e.map(t)}function lP(r,e){const t=Vr(r,e==null?void 0:e.in);return t.setHours(0,0,0,0),t}function Dte(r,e,t){const[n,a]=Cb(t==null?void 0:t.in,r,e),i=lP(n),o=lP(a),s=+i-r1(i),l=+o-r1(o);return Math.round((s-l)/Ate)}function Nte(r,e){const t=gH(r,e),n=po(r,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),t1(n)}function Sx(r,e){const t=+Vr(r)-+Vr(e);return t<0?-1:t>0?1:t}function Lte(r){return po(r,Date.now())}function kte(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function Rte(r){return!(!kte(r)&&typeof r!="number"||isNaN(+Vr(r)))}function Ete(r,e,t){const[n,a]=Cb(t==null?void 0:t.in,r,e),i=n.getFullYear()-a.getFullYear(),o=n.getMonth()-a.getMonth();return i*12+o}function Ite(r){return e=>{const n=(r?Math[r]:Math.trunc)(e);return n===0?0:n}}function Ote(r,e){return+Vr(r)-+Vr(e)}function Pte(r,e){const t=Vr(r,e==null?void 0:e.in);return t.setHours(23,59,59,999),t}function jte(r,e){const t=Vr(r,e==null?void 0:e.in),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function zte(r,e){const t=Vr(r,e==null?void 0:e.in);return+Pte(t,e)==+jte(t,e)}function Bte(r,e,t){const[n,a,i]=Cb(t==null?void 0:t.in,r,r,e),o=Sx(a,i),s=Math.abs(Ete(a,i));if(s<1)return 0;a.getMonth()===1&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-o*s);let l=Sx(a,i)===-o;zte(n)&&s===1&&Sx(n,i)===1&&(l=!1);const u=o*(s-+l);return u===0?0:u}function Vte(r,e,t){const n=Ote(r,e)/1e3;return Ite(t==null?void 0:t.roundingMethod)(n)}function Gte(r,e){const t=Vr(r,e==null?void 0:e.in);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}const Hte={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Fte=(r,e,t)=>{let n;const a=Hte[r];return typeof a=="string"?n=a:e===1?n=a.one:n=a.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function Hd(r){return(e={})=>{const t=e.width?String(e.width):r.defaultWidth;return r.formats[t]||r.formats[r.defaultWidth]}}const Ute={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Wte={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Yte={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},$te={date:Hd({formats:Ute,defaultWidth:"full"}),time:Hd({formats:Wte,defaultWidth:"full"}),dateTime:Hd({formats:Yte,defaultWidth:"full"})},Xte={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},qte=(r,e,t,n)=>Xte[r];function Ki(r){return(e,t)=>{const n=t!=null&&t.context?String(t.context):"standalone";let a;if(n==="formatting"&&r.formattingValues){const o=r.defaultFormattingWidth||r.defaultWidth,s=t!=null&&t.width?String(t.width):o;a=r.formattingValues[s]||r.formattingValues[o]}else{const o=r.defaultWidth,s=t!=null&&t.width?String(t.width):r.defaultWidth;a=r.values[s]||r.values[o]}const i=r.argumentCallback?r.argumentCallback(e):e;return a[i]}}const Zte={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Kte={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Qte={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Jte={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},ere={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},tre={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},rre=(r,e)=>{const t=Number(r),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},nre={ordinalNumber:rre,era:Ki({values:Zte,defaultWidth:"wide"}),quarter:Ki({values:Kte,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Ki({values:Qte,defaultWidth:"wide"}),day:Ki({values:Jte,defaultWidth:"wide"}),dayPeriod:Ki({values:ere,defaultWidth:"wide",formattingValues:tre,defaultFormattingWidth:"wide"})};function Qi(r){return(e,t={})=>{const n=t.width,a=n&&r.matchPatterns[n]||r.matchPatterns[r.defaultMatchWidth],i=e.match(a);if(!i)return null;const o=i[0],s=n&&r.parsePatterns[n]||r.parsePatterns[r.defaultParseWidth],l=Array.isArray(s)?ire(s,f=>f.test(o)):are(s,f=>f.test(o));let u;u=r.valueCallback?r.valueCallback(l):l,u=t.valueCallback?t.valueCallback(u):u;const c=e.slice(o.length);return{value:u,rest:c}}}function are(r,e){for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&e(r[t]))return t}function ire(r,e){for(let t=0;t<r.length;t++)if(e(r[t]))return t}function mH(r){return(e,t={})=>{const n=e.match(r.matchPattern);if(!n)return null;const a=n[0],i=e.match(r.parsePattern);if(!i)return null;let o=r.valueCallback?r.valueCallback(i[0]):i[0];o=t.valueCallback?t.valueCallback(o):o;const s=e.slice(a.length);return{value:o,rest:s}}}const ore=/^(\d+)(th|st|nd|rd)?/i,sre=/\d+/i,lre={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},ure={any:[/^b/i,/^(a|c)/i]},cre={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},fre={any:[/1/i,/2/i,/3/i,/4/i]},dre={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},hre={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},vre={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},pre={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},gre={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},mre={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},yre={ordinalNumber:mH({matchPattern:ore,parsePattern:sre,valueCallback:r=>parseInt(r,10)}),era:Qi({matchPatterns:lre,defaultMatchWidth:"wide",parsePatterns:ure,defaultParseWidth:"any"}),quarter:Qi({matchPatterns:cre,defaultMatchWidth:"wide",parsePatterns:fre,defaultParseWidth:"any",valueCallback:r=>r+1}),month:Qi({matchPatterns:dre,defaultMatchWidth:"wide",parsePatterns:hre,defaultParseWidth:"any"}),day:Qi({matchPatterns:vre,defaultMatchWidth:"wide",parsePatterns:pre,defaultParseWidth:"any"}),dayPeriod:Qi({matchPatterns:gre,defaultMatchWidth:"any",parsePatterns:mre,defaultParseWidth:"any"})},yH={code:"en-US",formatDistance:Fte,formatLong:$te,formatRelative:qte,localize:nre,match:yre,options:{weekStartsOn:0,firstWeekContainsDate:1}};function xre(r,e){const t=Vr(r,e==null?void 0:e.in);return Dte(t,Gte(t))+1}function bre(r,e){const t=Vr(r,e==null?void 0:e.in),n=+t1(t)-+Nte(t);return Math.round(n/hH)+1}function xH(r,e){var c,f,h,v;const t=Vr(r,e==null?void 0:e.in),n=t.getFullYear(),a=hm(),i=(e==null?void 0:e.firstWeekContainsDate)??((f=(c=e==null?void 0:e.locale)==null?void 0:c.options)==null?void 0:f.firstWeekContainsDate)??a.firstWeekContainsDate??((v=(h=a.locale)==null?void 0:h.options)==null?void 0:v.firstWeekContainsDate)??1,o=po((e==null?void 0:e.in)||r,0);o.setFullYear(n+1,0,i),o.setHours(0,0,0,0);const s=Ag(o,e),l=po((e==null?void 0:e.in)||r,0);l.setFullYear(n,0,i),l.setHours(0,0,0,0);const u=Ag(l,e);return+t>=+s?n+1:+t>=+u?n:n-1}function _re(r,e){var s,l,u,c;const t=hm(),n=(e==null?void 0:e.firstWeekContainsDate)??((l=(s=e==null?void 0:e.locale)==null?void 0:s.options)==null?void 0:l.firstWeekContainsDate)??t.firstWeekContainsDate??((c=(u=t.locale)==null?void 0:u.options)==null?void 0:c.firstWeekContainsDate)??1,a=xH(r,e),i=po((e==null?void 0:e.in)||r,0);return i.setFullYear(a,0,n),i.setHours(0,0,0,0),Ag(i,e)}function Sre(r,e){const t=Vr(r,e==null?void 0:e.in),n=+Ag(t,e)-+_re(t,e);return Math.round(n/hH)+1}function Xt(r,e){const t=r<0?"-":"",n=Math.abs(r).toString().padStart(e,"0");return t+n}const nl={y(r,e){const t=r.getFullYear(),n=t>0?t:1-t;return Xt(e==="yy"?n%100:n,e.length)},M(r,e){const t=r.getMonth();return e==="M"?String(t+1):Xt(t+1,2)},d(r,e){return Xt(r.getDate(),e.length)},a(r,e){const t=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(r,e){return Xt(r.getHours()%12||12,e.length)},H(r,e){return Xt(r.getHours(),e.length)},m(r,e){return Xt(r.getMinutes(),e.length)},s(r,e){return Xt(r.getSeconds(),e.length)},S(r,e){const t=e.length,n=r.getMilliseconds(),a=Math.trunc(n*Math.pow(10,t-3));return Xt(a,e.length)}},Kf={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},uP={G:function(r,e,t){const n=r.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(r,e,t){if(e==="yo"){const n=r.getFullYear(),a=n>0?n:1-n;return t.ordinalNumber(a,{unit:"year"})}return nl.y(r,e)},Y:function(r,e,t,n){const a=xH(r,n),i=a>0?a:1-a;if(e==="YY"){const o=i%100;return Xt(o,2)}return e==="Yo"?t.ordinalNumber(i,{unit:"year"}):Xt(i,e.length)},R:function(r,e){const t=gH(r);return Xt(t,e.length)},u:function(r,e){const t=r.getFullYear();return Xt(t,e.length)},Q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return Xt(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return Xt(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(r,e,t){const n=r.getMonth();switch(e){case"M":case"MM":return nl.M(r,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(r,e,t){const n=r.getMonth();switch(e){case"L":return String(n+1);case"LL":return Xt(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(r,e,t,n){const a=Sre(r,n);return e==="wo"?t.ordinalNumber(a,{unit:"week"}):Xt(a,e.length)},I:function(r,e,t){const n=bre(r);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):Xt(n,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):nl.d(r,e)},D:function(r,e,t){const n=xre(r);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):Xt(n,e.length)},E:function(r,e,t){const n=r.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(r,e,t,n){const a=r.getDay(),i=(a-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return Xt(i,2);case"eo":return t.ordinalNumber(i,{unit:"day"});case"eee":return t.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(a,{width:"short",context:"formatting"});case"eeee":default:return t.day(a,{width:"wide",context:"formatting"})}},c:function(r,e,t,n){const a=r.getDay(),i=(a-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return Xt(i,e.length);case"co":return t.ordinalNumber(i,{unit:"day"});case"ccc":return t.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(a,{width:"narrow",context:"standalone"});case"cccccc":return t.day(a,{width:"short",context:"standalone"});case"cccc":default:return t.day(a,{width:"wide",context:"standalone"})}},i:function(r,e,t){const n=r.getDay(),a=n===0?7:n;switch(e){case"i":return String(a);case"ii":return Xt(a,e.length);case"io":return t.ordinalNumber(a,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(r,e,t){const a=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(r,e,t){const n=r.getHours();let a;switch(n===12?a=Kf.noon:n===0?a=Kf.midnight:a=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(r,e,t){const n=r.getHours();let a;switch(n>=17?a=Kf.evening:n>=12?a=Kf.afternoon:n>=4?a=Kf.morning:a=Kf.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(r,e,t){if(e==="ho"){let n=r.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return nl.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):nl.H(r,e)},K:function(r,e,t){const n=r.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):Xt(n,e.length)},k:function(r,e,t){let n=r.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):Xt(n,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):nl.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):nl.s(r,e)},S:function(r,e){return nl.S(r,e)},X:function(r,e,t){const n=r.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return fP(n);case"XXXX":case"XX":return rc(n);case"XXXXX":case"XXX":default:return rc(n,":")}},x:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"x":return fP(n);case"xxxx":case"xx":return rc(n);case"xxxxx":case"xxx":default:return rc(n,":")}},O:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+cP(n,":");case"OOOO":default:return"GMT"+rc(n,":")}},z:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+cP(n,":");case"zzzz":default:return"GMT"+rc(n,":")}},t:function(r,e,t){const n=Math.trunc(+r/1e3);return Xt(n,e.length)},T:function(r,e,t){return Xt(+r,e.length)}};function cP(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=Math.trunc(n/60),i=n%60;return i===0?t+String(a):t+String(a)+e+Xt(i,2)}function fP(r,e){return r%60===0?(r>0?"-":"+")+Xt(Math.abs(r)/60,2):rc(r,e)}function rc(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=Xt(Math.trunc(n/60),2),i=Xt(n%60,2);return t+a+e+i}const dP=(r,e)=>{switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},bH=(r,e)=>{switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},wre=(r,e)=>{const t=r.match(/(P+)(p+)?/)||[],n=t[1],a=t[2];if(!a)return dP(r,e);let i;switch(n){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",dP(n,e)).replace("{{time}}",bH(a,e))},Tre={p:bH,P:wre},Cre=/^D+$/,Are=/^Y+$/,Mre=["D","DD","YY","YYYY"];function Dre(r){return Cre.test(r)}function Nre(r){return Are.test(r)}function Lre(r,e,t){const n=kre(r,e,t);if(console.warn(n),Mre.includes(r))throw new RangeError(n)}function kre(r,e,t){const n=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Rre=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ere=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Ire=/^'([^]*?)'?$/,Ore=/''/g,Pre=/[a-zA-Z]/;function jre(r,e,t){var c,f,h,v,g,y,b,_;const n=hm(),a=(t==null?void 0:t.locale)??n.locale??yH,i=(t==null?void 0:t.firstWeekContainsDate)??((f=(c=t==null?void 0:t.locale)==null?void 0:c.options)==null?void 0:f.firstWeekContainsDate)??n.firstWeekContainsDate??((v=(h=n.locale)==null?void 0:h.options)==null?void 0:v.firstWeekContainsDate)??1,o=(t==null?void 0:t.weekStartsOn)??((y=(g=t==null?void 0:t.locale)==null?void 0:g.options)==null?void 0:y.weekStartsOn)??n.weekStartsOn??((_=(b=n.locale)==null?void 0:b.options)==null?void 0:_.weekStartsOn)??0,s=Vr(r,t==null?void 0:t.in);if(!Rte(s))throw new RangeError("Invalid time value");let l=e.match(Ere).map(S=>{const T=S[0];if(T==="p"||T==="P"){const C=Tre[T];return C(S,a.formatLong)}return S}).join("").match(Rre).map(S=>{if(S==="''")return{isToken:!1,value:"'"};const T=S[0];if(T==="'")return{isToken:!1,value:zre(S)};if(uP[T])return{isToken:!0,value:S};if(T.match(Pre))throw new RangeError("Format string contains an unescaped latin alphabet character `"+T+"`");return{isToken:!1,value:S}});a.localize.preprocessor&&(l=a.localize.preprocessor(s,l));const u={firstWeekContainsDate:i,weekStartsOn:o,locale:a};return l.map(S=>{if(!S.isToken)return S.value;const T=S.value;(!(t!=null&&t.useAdditionalWeekYearTokens)&&Nre(T)||!(t!=null&&t.useAdditionalDayOfYearTokens)&&Dre(T))&&Lre(T,e,String(r));const C=uP[T[0]];return C(s,T,a.localize,u)}).join("")}function zre(r){const e=r.match(Ire);return e?e[1].replace(Ore,"'"):r}function Bre(r,e,t){const n=hm(),a=(t==null?void 0:t.locale)??n.locale??yH,i=2520,o=Sx(r,e);if(isNaN(o))throw new RangeError("Invalid time value");const s=Object.assign({},t,{addSuffix:t==null?void 0:t.addSuffix,comparison:o}),[l,u]=Cb(t==null?void 0:t.in,...o>0?[e,r]:[r,e]),c=Vte(u,l),f=(r1(u)-r1(l))/1e3,h=Math.round((c-f)/60);let v;if(h<2)return t!=null&&t.includeSeconds?c<5?a.formatDistance("lessThanXSeconds",5,s):c<10?a.formatDistance("lessThanXSeconds",10,s):c<20?a.formatDistance("lessThanXSeconds",20,s):c<40?a.formatDistance("halfAMinute",0,s):c<60?a.formatDistance("lessThanXMinutes",1,s):a.formatDistance("xMinutes",1,s):h===0?a.formatDistance("lessThanXMinutes",1,s):a.formatDistance("xMinutes",h,s);if(h<45)return a.formatDistance("xMinutes",h,s);if(h<90)return a.formatDistance("aboutXHours",1,s);if(h<oP){const g=Math.round(h/60);return a.formatDistance("aboutXHours",g,s)}else{if(h<i)return a.formatDistance("xDays",1,s);if(h<e0){const g=Math.round(h/oP);return a.formatDistance("xDays",g,s)}else if(h<e0*2)return v=Math.round(h/e0),a.formatDistance("aboutXMonths",v,s)}if(v=Bte(u,l),v<12){const g=Math.round(h/e0);return a.formatDistance("xMonths",g,s)}else{const g=v%12,y=Math.trunc(v/12);return g<3?a.formatDistance("aboutXYears",y,s):g<9?a.formatDistance("overXYears",y,s):a.formatDistance("almostXYears",y+1,s)}}function RD(r,e){return Bre(r,Lte(r),e)}function Vre(r,e){const t=()=>po(e==null?void 0:e.in,NaN),a=Ure(r);let i;if(a.date){const u=Wre(a.date,2);i=Yre(u.restDateString,u.year)}if(!i||isNaN(+i))return t();const o=+i;let s=0,l;if(a.time&&(s=$re(a.time),isNaN(s)))return t();if(a.timezone){if(l=Xre(a.timezone),isNaN(l))return t()}else{const u=new Date(o+s),c=Vr(0,e==null?void 0:e.in);return c.setFullYear(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()),c.setHours(u.getUTCHours(),u.getUTCMinutes(),u.getUTCSeconds(),u.getUTCMilliseconds()),c}return Vr(o+s+l,e==null?void 0:e.in)}const t0={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Gre=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Hre=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Fre=/^([+-])(\d{2})(?::?(\d{2}))?$/;function Ure(r){const e={},t=r.split(t0.dateTimeDelimiter);let n;if(t.length>2)return e;if(/:/.test(t[0])?n=t[0]:(e.date=t[0],n=t[1],t0.timeZoneDelimiter.test(e.date)&&(e.date=r.split(t0.timeZoneDelimiter)[0],n=r.substr(e.date.length,r.length))),n){const a=t0.timezone.exec(n);a?(e.time=n.replace(a[1],""),e.timezone=a[1]):e.time=n}return e}function Wre(r,e){const t=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),n=r.match(t);if(!n)return{year:NaN,restDateString:""};const a=n[1]?parseInt(n[1]):null,i=n[2]?parseInt(n[2]):null;return{year:i===null?a:i*100,restDateString:r.slice((n[1]||n[2]).length)}}function Yre(r,e){if(e===null)return new Date(NaN);const t=r.match(Gre);if(!t)return new Date(NaN);const n=!!t[4],a=Kv(t[1]),i=Kv(t[2])-1,o=Kv(t[3]),s=Kv(t[4]),l=Kv(t[5])-1;if(n)return Jre(e,s,l)?qre(e,s,l):new Date(NaN);{const u=new Date(0);return!Kre(e,i,o)||!Qre(e,a)?new Date(NaN):(u.setUTCFullYear(e,i,Math.max(a,o)),u)}}function Kv(r){return r?parseInt(r):1}function $re(r){const e=r.match(Hre);if(!e)return NaN;const t=Iw(e[1]),n=Iw(e[2]),a=Iw(e[3]);return ene(t,n,a)?t*pH+n*vH+a*1e3:NaN}function Iw(r){return r&&parseFloat(r.replace(",","."))||0}function Xre(r){if(r==="Z")return 0;const e=r.match(Fre);if(!e)return 0;const t=e[1]==="+"?-1:1,n=parseInt(e[2]),a=e[3]&&parseInt(e[3])||0;return tne(n,a)?t*(n*pH+a*vH):NaN}function qre(r,e,t){const n=new Date(0);n.setUTCFullYear(r,0,4);const a=n.getUTCDay()||7,i=(e-1)*7+t+1-a;return n.setUTCDate(n.getUTCDate()+i),n}const Zre=[31,null,31,30,31,30,31,31,30,31,30,31];function _H(r){return r%400===0||r%4===0&&r%100!==0}function Kre(r,e,t){return e>=0&&e<=11&&t>=1&&t<=(Zre[e]||(_H(r)?29:28))}function Qre(r,e){return e>=1&&e<=(_H(r)?366:365)}function Jre(r,e,t){return e>=1&&e<=53&&t>=0&&t<=6}function ene(r,e,t){return r===24?e===0&&t===0:t>=0&&t<60&&e>=0&&e<60&&r>=0&&r<25}function tne(r,e){return e>=0&&e<=59}const rne={lessThanXSeconds:{one:"1초 미만",other:"{{count}}초 미만"},xSeconds:{one:"1초",other:"{{count}}초"},halfAMinute:"30초",lessThanXMinutes:{one:"1분 미만",other:"{{count}}분 미만"},xMinutes:{one:"1분",other:"{{count}}분"},aboutXHours:{one:"약 1시간",other:"약 {{count}}시간"},xHours:{one:"1시간",other:"{{count}}시간"},xDays:{one:"1일",other:"{{count}}일"},aboutXWeeks:{one:"약 1주",other:"약 {{count}}주"},xWeeks:{one:"1주",other:"{{count}}주"},aboutXMonths:{one:"약 1개월",other:"약 {{count}}개월"},xMonths:{one:"1개월",other:"{{count}}개월"},aboutXYears:{one:"약 1년",other:"약 {{count}}년"},xYears:{one:"1년",other:"{{count}}년"},overXYears:{one:"1년 이상",other:"{{count}}년 이상"},almostXYears:{one:"거의 1년",other:"거의 {{count}}년"}},nne=(r,e,t)=>{let n;const a=rne[r];return typeof a=="string"?n=a:e===1?n=a.one:n=a.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?n+" 후":n+" 전":n},ane={full:"y년 M월 d일 EEEE",long:"y년 M월 d일",medium:"y.MM.dd",short:"y.MM.dd"},ine={full:"a H시 mm분 ss초 zzzz",long:"a H:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},one={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},sne={date:Hd({formats:ane,defaultWidth:"full"}),time:Hd({formats:ine,defaultWidth:"full"}),dateTime:Hd({formats:one,defaultWidth:"full"})},lne={lastWeek:"'지난' eeee p",yesterday:"'어제' p",today:"'오늘' p",tomorrow:"'내일' p",nextWeek:"'다음' eeee p",other:"P"},une=(r,e,t,n)=>lne[r],cne={narrow:["BC","AD"],abbreviated:["BC","AD"],wide:["기원전","서기"]},fne={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1분기","2분기","3분기","4분기"]},dne={narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],abbreviated:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],wide:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"]},hne={narrow:["일","월","화","수","목","금","토"],short:["일","월","화","수","목","금","토"],abbreviated:["일","월","화","수","목","금","토"],wide:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"]},vne={narrow:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"},abbreviated:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"},wide:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"}},pne={narrow:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"},abbreviated:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"},wide:{am:"오전",pm:"오후",midnight:"자정",noon:"정오",morning:"아침",afternoon:"오후",evening:"저녁",night:"밤"}},gne=(r,e)=>{const t=Number(r);switch(String(e==null?void 0:e.unit)){case"minute":case"second":return String(t);case"date":return t+"일";default:return t+"번째"}},mne={ordinalNumber:gne,era:Ki({values:cne,defaultWidth:"wide"}),quarter:Ki({values:fne,defaultWidth:"wide",argumentCallback:r=>r-1}),month:Ki({values:dne,defaultWidth:"wide"}),day:Ki({values:hne,defaultWidth:"wide"}),dayPeriod:Ki({values:vne,defaultWidth:"wide",formattingValues:pne,defaultFormattingWidth:"wide"})},yne=/^(\d+)(일|번째)?/i,xne=/\d+/i,bne={narrow:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(기원전|서기)/i},_ne={any:[/^(bc|기원전)/i,/^(ad|서기)/i]},Sne={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234]사?분기/i},wne={any:[/1/i,/2/i,/3/i,/4/i]},Tne={narrow:/^(1[012]|[123456789])/,abbreviated:/^(1[012]|[123456789])월/i,wide:/^(1[012]|[123456789])월/i},Cne={any:[/^1월?$/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},Ane={narrow:/^[일월화수목금토]/,short:/^[일월화수목금토]/,abbreviated:/^[일월화수목금토]/,wide:/^[일월화수목금토]요일/},Mne={any:[/^일/,/^월/,/^화/,/^수/,/^목/,/^금/,/^토/]},Dne={any:/^(am|pm|오전|오후|자정|정오|아침|저녁|밤)/i},Nne={any:{am:/^(am|오전)/i,pm:/^(pm|오후)/i,midnight:/^자정/i,noon:/^정오/i,morning:/^아침/i,afternoon:/^오후/i,evening:/^저녁/i,night:/^밤/i}},Lne={ordinalNumber:mH({matchPattern:yne,parsePattern:xne,valueCallback:r=>parseInt(r,10)}),era:Qi({matchPatterns:bne,defaultMatchWidth:"wide",parsePatterns:_ne,defaultParseWidth:"any"}),quarter:Qi({matchPatterns:Sne,defaultMatchWidth:"wide",parsePatterns:wne,defaultParseWidth:"any",valueCallback:r=>r+1}),month:Qi({matchPatterns:Tne,defaultMatchWidth:"wide",parsePatterns:Cne,defaultParseWidth:"any"}),day:Qi({matchPatterns:Ane,defaultMatchWidth:"wide",parsePatterns:Mne,defaultParseWidth:"any"}),dayPeriod:Qi({matchPatterns:Dne,defaultMatchWidth:"any",parsePatterns:Nne,defaultParseWidth:"any"})},Ab={code:"ko",formatDistance:nne,formatLong:sne,formatRelative:une,localize:mne,match:Lne,options:{weekStartsOn:0,firstWeekContainsDate:1}};function kne(r){if(!r)return"-";try{return jre(Vre(r),"MM.dd HH:mm",{locale:Ab})}catch{return r.slice(0,10)}}function Rne({rows:r}){return m.jsxs(ho,{minWidth:"520px",stickyHeader:!0,children:[m.jsxs(vo,{children:[m.jsx(je,{children:"채널"}),m.jsx(je,{children:"상품"}),m.jsx(je,{className:"w-[90px]",children:"주문번호"}),m.jsx(je,{align:"center",children:"상태"}),m.jsx(je,{align:"right",children:"금액"}),m.jsx(je,{align:"right",children:"주문일"})]}),m.jsxs("tbody",{className:"bg-card",children:[r.map((e,t)=>{const n=e.unitPrice!=null?(e.unitPrice*e.quantity).toLocaleString():e.totalAmount>0?e.totalAmount.toLocaleString():null;return m.jsxs("tr",{className:Qe("border-b border-border/60",t%2!==0&&"bg-muted/5"),children:[m.jsx("td",{className:"px-3 py-2 whitespace-nowrap",children:hr[e.channel]??e.channel}),m.jsxs("td",{className:"px-3 py-2 max-w-[280px]",title:e.productName,children:[m.jsx("div",{className:"truncate",children:e.productName}),e.channelProductOptionName&&m.jsx("div",{className:"text-[10px] text-muted-foreground truncate",children:e.channelProductOptionName})]}),m.jsx("td",{className:"px-3 py-2 text-muted-foreground font-mono text-[10px] w-[90px] max-w-[90px] truncate",title:e.channelOrderId,children:e.channelOrderId}),m.jsx("td",{className:"px-3 py-2 text-center",children:m.jsxs("div",{className:"flex items-center justify-center gap-1",children:[m.jsx(lH,{status:e.status}),e.excluded&&m.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 rounded text-[9px] font-medium bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400",title:e.excludedReason??"제외된 주문",children:"제외"})]})}),m.jsx("td",{className:"px-3 py-2 text-right",children:n!=null?`${n}원`:"-"}),m.jsx("td",{className:"px-3 py-2 text-muted-foreground text-right",children:kne(e.orderedAt)})]},e.key)}),r.length===0&&m.jsx("tr",{children:m.jsx("td",{colSpan:6,className:"px-3 py-8 text-center text-muted-foreground text-[13px]",children:"필터 조건에 맞는 주문이 없습니다."})})]})]})}const Ene=50,Ine=["cafe24","coupang","smartstore"],One=Object.keys(sH);function Pne(r){return(r.items.length>0?r.items:[null]).map((t,n)=>{var a;return{key:`${r.channelOrderId}-${n}`,channel:r.channel,channelOrderId:r.channelOrderId,productName:(t==null?void 0:t.productName)??"(no items)",optionLabel:t==null?void 0:t.optionLabel,quantity:(t==null?void 0:t.quantity)??0,unitPrice:t==null?void 0:t.unitPrice,channelProductOptionName:t==null?void 0:t.channelProductOptionName,totalAmount:r.totalAmount,status:r.status,orderedAt:r.orderedAt,buyerName:((a=r.buyer)==null?void 0:a.name)??"",excluded:r.excluded,excludedReason:r.excludedReason}})}function hP(r,e){const t=new Set(r);return t.has(e)?t.delete(e):t.add(e),t}function jne({orders:r,total:e,isLoading:t=!1,error:n,page:a,pageSize:i=Ene,onPageChange:o,onDateChange:s,dateFrom:l,dateTo:u,onChannelChange:c,onStatusChange:f,onProductSearchChange:h,syncing:v=!1,syncResult:g,onSync:y,lastSyncedAt:b,aggregates:_,syncDisabled:S=!1}){const[T,C]=Y.useState(""),[M,D]=Y.useState(""),L=l!==void 0||u!==void 0,k=L?l??"":T,R=L?u??"":M,[E,I]=Y.useState(0),z=a!==void 0,j=z?a:E,G=Math.ceil(e/i),[U,O]=Y.useState(new Set),[H,F]=Y.useState(new Set),[$,B]=Y.useState(""),X=Y.useMemo(()=>c?Ine:[...new Set(r.map(Ee=>Ee.channel))].sort(),[r,c]),q=Y.useMemo(()=>f?One:[...new Set(r.map(Ee=>Ee.status))].sort(),[r,f]),Q=Y.useMemo(()=>{const bt=r.filter(Mt=>!(!c&&U.size>0&&!U.has(Mt.channel)||!f&&H.size>0&&!H.has(Mt.status))).flatMap(Pne);return!h&&$?bt.filter(Mt=>Mt.productName.toLowerCase().includes($.toLowerCase())):bt},[r,U,H,$,c,f,h]),ne=Y.useMemo(()=>{const Ee=new Set;let bt=0,Mt=0;for(const ar of Q){const Ur=`${ar.channel}:${ar.channelOrderId}`;Ee.has(Ur)||(Ee.add(Ur),wte(ar.status)&&(bt+=ar.totalAmount)),Mt+=ar.quantity}return{orderCount:Ee.size,totalRevenue:bt,totalQty:Mt}},[Q]),fe=U.size>0||H.size>0||!!$;function ve(Ee){const bt=hP(U,Ee);O(bt),c==null||c([...bt])}function Se(Ee){const bt=hP(H,Ee);F(bt),f==null||f([...bt])}function ge(Ee){B(Ee),h==null||h(Ee)}function he(){O(new Set),F(new Set),B(""),c==null||c([]),f==null||f([]),h==null||h("")}function Ne(Ee,bt){L||(C(Ee),D(bt)),z||I(0),s==null||s(Ee,bt)}function xe(Ee){z||I(Ee),o==null||o(Ee)}const Te=!!(c||f||h),$e=j*i+1,We=j*i+r.length,lt=fe&&!Te?`${Q.length.toLocaleString()} / ${e.toLocaleString()}건`:G>1?`${$e.toLocaleString()}~${We.toLocaleString()} / 전체 ${e.toLocaleString()}건`:`총 ${e.toLocaleString()}건`,vt=Y.useRef(null);return Y.useEffect(()=>{const Ee=vt.current,bt=Ee==null?void 0:Ee.closest(".dashboard main");if(!Ee||!bt)return;const Mt=new ResizeObserver(()=>{bt.style.setProperty("--page-header-h",`${Ee.offsetHeight}px`)});return Mt.observe(Ee),()=>Mt.disconnect()},[]),m.jsxs("div",{children:[m.jsxs("div",{ref:vt,className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-4 sticky top-0 z-10 py-4 -mt-4 md:-mt-7 md:pt-7",style:{backgroundColor:"var(--page-bg, transparent)"},children:[m.jsx("h2",{className:"text-xl font-medium",children:"주문 현황"}),m.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m.jsx("span",{className:"text-[12px] text-muted-foreground",children:lt}),(()=>{const Ee=g??(Tg(b)?`마지막 동기화: ${Tg(b)}`:null);return Ee?m.jsx("span",{className:"text-[11px] text-muted-foreground",children:Ee}):null})(),y&&m.jsx(e1,{onSync:y,syncing:v,syncResult:g,disabled:S})]})]}),m.jsx(DD,{from:k,to:R,onChange:Ne,className:"mb-4"}),m.jsx(Cte,{channelFilter:U,statusFilter:H,productSearch:$,channelOptions:X,statusOptions:q,onChannelToggle:ve,onChannelClear:()=>{O(new Set),c==null||c([])},onStatusToggle:Se,onStatusClear:()=>{F(new Set),f==null||f([])},onProductSearch:ge,onReset:he}),!t&&!n&&(r.length>0||_)&&(()=>{const Ee=_??ne;return m.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2 mb-3",children:[m.jsxs("div",{className:"border border-border rounded-lg px-3 py-2.5 bg-card",children:[m.jsxs("p",{className:"text-[10px] text-muted-foreground mb-0.5 flex items-center gap-1",children:["전체 주문 수",m.jsx(Zt,{size:10,content:m.jsx(sr,{metric:"전체주문",rows:lr.전체주문,summary:"필터 조건에 해당하는 모든 주문 수"})})]}),m.jsxs("p",{className:"text-sm font-semibold",children:[Ee.orderCount.toLocaleString(),"건"]})]}),m.jsxs("div",{className:"border border-border rounded-lg px-3 py-2.5 bg-card",children:[m.jsxs("p",{className:"text-[10px] text-muted-foreground mb-0.5 flex items-center gap-1",children:["총 수량",m.jsx(Zt,{size:10,content:m.jsx(sr,{metric:"전체수량",rows:lr.전체수량,summary:"필터 조건에 해당하는 모든 주문의 수량 합계"})})]}),m.jsxs("p",{className:"text-sm font-semibold",children:[Ee.totalQty.toLocaleString(),"개"]})]}),m.jsxs("div",{className:"border border-border rounded-lg px-3 py-2.5 bg-card",children:[m.jsxs("p",{className:"text-[10px] text-muted-foreground mb-0.5 flex items-center gap-1",children:["합계 금액",m.jsx(Zt,{size:10,content:m.jsx(sr,{metric:"매출",rows:lr.매출,summary:"취소·반품·미결제 제외 주문의 최종 결제 금액 합계"})})]}),m.jsxs("p",{className:"text-sm font-semibold",children:[Ee.totalRevenue.toLocaleString(),"원"]})]})]})})(),t?m.jsx("div",{className:"text-sm text-muted-foreground py-8 text-center",children:"불러오는 중..."}):n?m.jsx("div",{className:"text-sm text-destructive py-8 text-center",children:"주문 조회 실패"}):r.length===0?m.jsxs("div",{className:"border border-dashed border-border rounded-lg p-12 text-center text-muted-foreground text-sm",children:["주문 데이터가 없습니다.",m.jsxs("div",{className:"text-[11px] mt-2 space-y-1",children:[m.jsxs("p",{children:["위의 ",m.jsx("strong",{children:"주문 동기화"})," 버튼을 눌러 연결된 채널에서 주문을 가져오거나,"]}),m.jsxs("p",{children:[m.jsx("code",{className:"bg-muted px-1 py-0.5 rounded text-[10px]",children:"sppt import"}),"로 CSV/엑셀 파일을 불러올 수 있습니다."]})]})]}):m.jsx(Rne,{rows:Q}),G>1&&(Te||!fe)&&m.jsxs("div",{className:"flex items-center justify-center gap-2 mt-4",children:[m.jsx("button",{type:"button",onClick:()=>xe(Math.max(0,j-1)),disabled:j===0,className:"px-3 py-1.5 text-xs rounded disabled:opacity-40 border border-border",children:"이전"}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:[j+1," / ",G]}),m.jsx("button",{type:"button",onClick:()=>xe(Math.min(G-1,j+1)),disabled:j>=G-1,className:"px-3 py-1.5 text-xs rounded disabled:opacity-40 border border-border",children:"다음"})]}),m.jsx("p",{className:"text-[11px] text-muted-foreground/50 mt-4",children:"주문 동기화 · CSV 불러오기 · 수동 입력 등 터미널에서 AI에게 요청할 수 있습니다."})]})}function zne(r){return r==null?"무제한":r>=1e8?`${(r/1e8).toFixed(0)}억원 미만`:r>=1e7?`${(r/1e7).toFixed(0)}천만원 미만`:`${r.toLocaleString()}원 미만`}function Ow({url:r}){return r?m.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"ml-1 inline-flex items-center gap-0.5 text-[9px] opacity-50 hover:opacity-100 transition-opacity",onClick:e=>e.stopPropagation(),children:[m.jsx(Qc,{size:8}),"출처"]}):null}function Qv({children:r}){return m.jsx("span",{className:"inline-flex items-center text-[10px] font-medium bg-muted text-muted-foreground px-1.5 py-0.5 rounded-full",children:r})}function Bne({d:r,annualRevenue:e,channel:t,onOpenConfig:n}){var C,M,D,L,k,R,E,I,z,j,G,U;const[a,i]=Y.useState(!1),[o,s]=Y.useState(!1),[l,u]=Y.useState(!1),[c,f]=Y.useState(!1),[h,v]=Y.useState(!1),g=r.categoryRates&&Object.keys(r.categoryRates).length>0,y=r.pgRateByPayment&&Object.keys(r.pgRateByPayment).length>0,b=r.revenueTiers&&r.revenueTiers.length>0,_=r.verticalRates&&Object.keys(r.verticalRates).length>0,S=r.discrepancyHints&&r.discrepancyHints.length>0,T=r.sources&&r.sources.length>0;return!g&&!y&&!b&&!_&&!S&&!T?null:m.jsx("tr",{className:"border-b border-border/40 bg-muted/5",children:m.jsx("td",{colSpan:7,className:"px-3 pb-3 pt-0",children:m.jsxs("div",{className:"flex flex-wrap gap-3 mt-2",children:[g&&m.jsxs("div",{className:"w-full",children:[m.jsxs("button",{type:"button",onClick:()=>i(O=>!O),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[a?m.jsx(cn,{size:11}):m.jsx(qr,{size:11}),m.jsx("span",{className:"font-medium text-foreground/70",children:"카테고리별 수수료"}),m.jsxs(Qv,{children:[Object.keys(r.categoryRates??{}).length,"개"]})]}),a&&m.jsx("div",{className:"mt-1.5 ml-4 border border-border/60 rounded overflow-hidden",children:m.jsxs("table",{className:"w-full text-[11px]",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"bg-muted/50 text-muted-foreground",children:[m.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"카테고리"}),m.jsx("th",{className:"px-2 py-1 text-right font-medium",children:"수수료율"})]})}),m.jsx("tbody",{children:Object.entries(r.categoryRates??{}).sort((O,H)=>O[1]-H[1]).map(([O,H])=>m.jsxs("tr",{className:"border-t border-border/40",children:[m.jsx("td",{className:"px-2 py-1",children:O}),m.jsxs("td",{className:"px-2 py-1 text-right font-medium",children:[H,"%"]})]},O))})]})})]}),y&&m.jsxs("div",{className:"w-full",children:[m.jsxs("button",{type:"button",onClick:()=>s(O=>!O),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[o?m.jsx(cn,{size:11}):m.jsx(qr,{size:11}),m.jsx("span",{className:"font-medium text-foreground/70",children:"결제수단별 PG 수수료"}),m.jsxs(Qv,{children:[Object.keys(r.pgRateByPayment??{}).length,"종"]})]}),o&&m.jsx("div",{className:"mt-1.5 ml-4 border border-border/60 rounded overflow-hidden",children:m.jsxs("table",{className:"w-full text-[11px]",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"bg-muted/50 text-muted-foreground",children:[m.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"결제수단"}),m.jsx("th",{className:"px-2 py-1 text-right font-medium",children:"수수료율"})]})}),m.jsx("tbody",{children:Object.entries(r.pgRateByPayment??{}).map(([O,H])=>m.jsxs("tr",{className:"border-t border-border/40",children:[m.jsx("td",{className:"px-2 py-1",children:H.label}),m.jsxs("td",{className:"px-2 py-1 text-right font-medium",children:[H.rate,"%"]})]},O))})]})})]}),b&&m.jsxs("div",{className:"w-full",children:[m.jsxs("button",{type:"button",onClick:()=>u(O=>!O),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[l?m.jsx(cn,{size:11}):m.jsx(qr,{size:11}),m.jsx("span",{className:"font-medium text-foreground/70",children:"매출 등급별 수수료"}),m.jsxs(Qv,{children:[(C=r.revenueTiers)==null?void 0:C.length,"구간"]}),(()=>{var F;const O=Cg(r.revenueTiers,e),H=O!=null?(F=r.revenueTiers)==null?void 0:F[O]:null;return H?m.jsxs("span",{className:"inline-flex items-center text-[10px] font-medium bg-emerald-100 text-emerald-700 dark:bg-emerald-950/50 dark:text-emerald-400 px-1.5 py-0.5 rounded-full ml-1",children:["현재 ",H.label]}):m.jsx("span",{className:"inline-flex items-center text-[10px] text-amber-500 px-1 ml-1",children:"연매출 미설정"})})()]}),l&&m.jsxs("div",{className:"mt-1.5 ml-4 border border-border/60 rounded overflow-hidden",children:[m.jsxs("table",{className:"w-full text-[11px]",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"bg-muted/50 text-muted-foreground",children:[m.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"등급"}),m.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"연매출 기준"}),((M=r.revenueTiers)==null?void 0:M.some(O=>O.pgRate!=null))&&m.jsx("th",{className:"px-2 py-1 text-right font-medium",children:"PG수수료"}),((D=r.revenueTiers)==null?void 0:D.some(O=>O.commissionRate!=null))&&m.jsx("th",{className:"px-2 py-1 text-right font-medium",children:"판매수수료"}),m.jsx("th",{className:"px-2 py-1 text-right font-medium",children:"적용"})]})}),m.jsx("tbody",{children:(L=r.revenueTiers)==null?void 0:L.map((O,H)=>{var B,X;const $=Cg(r.revenueTiers,e)===H;return m.jsxs("tr",{className:Qe("border-t border-border/40",$&&"bg-emerald-50 dark:bg-emerald-950/30"),children:[m.jsx("td",{className:Qe("px-2 py-1 font-medium",$&&"text-emerald-700 dark:text-emerald-400"),children:O.label}),m.jsx("td",{className:"px-2 py-1 text-muted-foreground",children:zne(O.maxAnnualRevenue)}),((B=r.revenueTiers)==null?void 0:B.some(q=>q.pgRate!=null))&&m.jsx("td",{className:Qe("px-2 py-1 text-right",$&&"font-semibold text-emerald-700 dark:text-emerald-400"),children:O.pgRate!=null?`${O.pgRate}%`:"-"}),((X=r.revenueTiers)==null?void 0:X.some(q=>q.commissionRate!=null))&&m.jsx("td",{className:Qe("px-2 py-1 text-right",$&&"font-semibold text-emerald-700 dark:text-emerald-400"),children:O.commissionRate!=null?`${O.commissionRate}%`:"-"}),m.jsx("td",{className:"px-2 py-1 text-right",children:$?m.jsx("span",{className:"text-emerald-600 dark:text-emerald-400 font-medium",children:"◀ 현재"}):null})]},O.label)})})]}),e==null&&m.jsxs("div",{className:"px-2 py-1.5 bg-amber-50/50 dark:bg-amber-950/20 border-t border-amber-200/50 dark:border-amber-900/50 text-[10px] text-amber-700 dark:text-amber-400",children:["연매출을 설정하면 현재 적용 등급을 확인할 수 있습니다."," ",n&&m.jsx("button",{type:"button",onClick:()=>n("annualRevenue"),className:"underline underline-offset-2 hover:text-foreground transition-colors",children:"연 매출 설정→"})]})]})]}),_&&m.jsxs("div",{className:"w-full",children:[m.jsxs("button",{type:"button",onClick:()=>f(O=>!O),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors",children:[c?m.jsx(cn,{size:11}):m.jsx(qr,{size:11}),m.jsx("span",{className:"font-medium text-foreground/70",children:"버티컬/솔루션 추가 수수료"}),m.jsxs(Qv,{children:[Object.keys(r.verticalRates??{}).length,"종"]})]}),c&&m.jsxs("div",{className:"mt-1.5 ml-4 border border-border/60 rounded overflow-hidden",children:[m.jsxs("table",{className:"w-full text-[11px]",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"bg-muted/50 text-muted-foreground",children:[m.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"서비스"}),m.jsx("th",{className:"px-2 py-1 text-right font-medium",children:"추가 수수료율"}),m.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"비고"})]})}),m.jsx("tbody",{children:Object.entries(r.verticalRates??{}).map(([O,H])=>m.jsxs("tr",{className:"border-t border-border/40",children:[m.jsx("td",{className:"px-2 py-1 font-medium",children:O}),m.jsxs("td",{className:"px-2 py-1 text-right text-red-500",children:["+",H.rate,"%"]}),m.jsx("td",{className:"px-2 py-1 text-muted-foreground",children:H.label})]},O))})]}),m.jsx("div",{className:"px-2 py-1.5 bg-muted/30 text-[10px] text-muted-foreground border-t border-border/40",children:"판매수수료에 중복 부과됩니다. 쇼핑라이브·렌탈 등 해당 서비스 이용 시만 적용."})]})]}),S&&m.jsxs("div",{className:"w-full",children:[m.jsxs("button",{type:"button",onClick:()=>v(O=>!O),className:"flex items-center gap-1 text-[11px] text-amber-600 dark:text-amber-400 hover:text-foreground transition-colors",children:[h?m.jsx(cn,{size:11}):m.jsx(qr,{size:11}),m.jsx("span",{className:"font-medium",children:"실정산 차이 발생 가능 원인"}),m.jsxs(Qv,{children:[(k=r.discrepancyHints)==null?void 0:k.length,"가지"]})]}),h&&m.jsxs("div",{className:"mt-1.5 ml-4 space-y-1.5",children:[((R=r.discrepancyHints)==null?void 0:R.some(O=>O.type==="fix"))&&m.jsxs("div",{className:"border border-emerald-200 dark:border-emerald-900/60 rounded bg-emerald-50/50 dark:bg-emerald-950/20 p-2",children:[m.jsx("p",{className:"text-[9px] font-semibold text-emerald-700 dark:text-emerald-400 uppercase tracking-wide mb-1",children:"설정으로 개선 가능"}),m.jsx("ul",{className:"space-y-1",children:(E=r.discrepancyHints)==null?void 0:E.filter(O=>O.type==="fix").map(O=>m.jsxs("li",{className:"text-[10px] text-emerald-800 dark:text-emerald-300 flex items-start gap-1.5",children:[m.jsx("span",{className:"shrink-0 mt-0.5",children:"✓"}),m.jsxs("span",{children:[O.text,O.configHref&&n&&m.jsx("button",{type:"button",onClick:()=>{const H=O.text.includes("annualRevenue");n(H?"annualRevenue":"channel",H?void 0:t)},className:"ml-1.5 underline underline-offset-2 text-emerald-600 dark:text-emerald-400 hover:text-foreground transition-colors",children:"설정 →"}),m.jsx(Ow,{url:O.source})]})]},O.text))})]}),((I=r.discrepancyHints)==null?void 0:I.some(O=>O.type==="auto"))&&m.jsxs("div",{className:"border border-blue-200 dark:border-blue-900/60 rounded bg-blue-50/50 dark:bg-blue-950/20 p-2",children:[m.jsx("p",{className:"text-[9px] font-semibold text-blue-700 dark:text-blue-400 uppercase tracking-wide mb-1",children:"데이터 수집 시 자동 처리"}),m.jsx("ul",{className:"space-y-1",children:(z=r.discrepancyHints)==null?void 0:z.filter(O=>O.type==="auto").map(O=>m.jsxs("li",{className:"text-[10px] text-blue-800 dark:text-blue-300 flex items-start gap-1.5",children:[m.jsx("span",{className:"shrink-0 mt-0.5",children:"↻"}),m.jsxs("span",{children:[O.text,m.jsx(Ow,{url:O.source})]})]},O.text))})]}),((j=r.discrepancyHints)==null?void 0:j.some(O=>O.type==="info"))&&m.jsxs("div",{className:"border border-amber-200 dark:border-amber-900/60 rounded bg-amber-50/50 dark:bg-amber-950/20 p-2",children:[m.jsx("p",{className:"text-[9px] font-semibold text-amber-600 dark:text-amber-500 uppercase tracking-wide mb-1",children:"계산 범위 밖 참고 항목"}),m.jsx("ul",{className:"space-y-1",children:(G=r.discrepancyHints)==null?void 0:G.filter(O=>O.type==="info").map(O=>m.jsxs("li",{className:"text-[10px] text-amber-700 dark:text-amber-400 flex gap-1.5",children:[m.jsx("span",{className:"shrink-0 mt-0.5",children:"·"}),m.jsxs("span",{children:[O.text,m.jsx(Ow,{url:O.source})]})]},O.text))})]})]})]}),T&&m.jsxs("div",{className:"flex flex-wrap gap-2 pt-0.5 border-t border-border/30 w-full",children:[m.jsx("span",{className:"text-[10px] text-muted-foreground/50 self-center",children:"출처"}),(U=r.sources)==null?void 0:U.map(O=>{const H=new URL(O).hostname.replace(/^www\./,"");return m.jsxs("a",{href:O,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-0.5 text-[10px] text-muted-foreground/70 hover:text-foreground transition-colors underline underline-offset-2",children:[m.jsx(Qc,{size:9}),H]},O)})]})]})})})}const Vne={card:"카드",transfer:"계좌이체",vbank:"가상계좌",virtual_account:"가상계좌",phone:"휴대폰",voucher:"상품권",brandpay:"브랜드페이",escrow:"에스크로",point:"포인트"};function Gne({data:r,isLoading:e,parentTotalRevenue:t}){return e?m.jsx("tr",{className:"border-b border-border/20 bg-muted/5",children:m.jsx("td",{colSpan:7,className:"px-4 py-1.5 text-[11px] text-muted-foreground text-center",children:"불러오는 중..."})}):r.length===0?m.jsx("tr",{className:"border-b border-border/20 bg-muted/5",children:m.jsx("td",{colSpan:7,className:"px-4 py-1.5 text-[11px] text-muted-foreground text-center",children:"결제수단 데이터 없음"})}):m.jsx(m.Fragment,{children:r.map(n=>{const a=n.paymentMethod?Vne[n.paymentMethod]??n.paymentMethod:"미지정",i=(n.avgCommissionRate*100).toFixed(1),o=t>0?(n.totalRevenue/t*100).toFixed(1):"0.0";return m.jsxs("tr",{className:"border-b border-border/20 bg-muted/5 hover:bg-muted/15 text-[11px]",children:[m.jsx("td",{className:"py-1 text-muted-foreground",style:{paddingLeft:48},children:m.jsx("span",{className:"whitespace-nowrap",children:a})}),m.jsxs("td",{className:"px-3 py-1 text-right text-muted-foreground whitespace-nowrap",children:[n.orderCount.toLocaleString(),"건"]}),m.jsx("td",{className:"px-3 py-1 text-right whitespace-nowrap",children:Ot(n.totalRevenue)}),m.jsx("td",{className:"px-3 py-1 text-right text-red-600 dark:text-red-400 whitespace-nowrap",children:Ot(n.feeAmount)}),m.jsxs("td",{className:"px-3 py-1 text-right text-muted-foreground whitespace-nowrap",children:[i,"%"]}),m.jsx("td",{className:"px-3 py-1 text-right text-emerald-600 dark:text-emerald-400 whitespace-nowrap",children:Ot(n.totalNet)}),m.jsxs("td",{className:"px-3 py-1 text-right text-muted-foreground whitespace-nowrap text-[11px]",children:[o,"%"]})]},n.paymentMethod??"__null__")})})}const Hne={tosspayments:"토스페이먼츠",naverpay:"네이버페이",cafe24pay:"카페24페이먼츠","kg-inicis":"KG이니시스",kakaopay:"카카오페이",danal:"다날","shopify-payments":"Shopify Payments","channel-integrated":"채널 통합",nicepay:"나이스페이"},Fne={tosspayments:"#3b82f6",naverpay:"#16a34a",cafe24pay:"#6366f1","kg-inicis":"#64748b",kakaopay:"#facc15",danal:"#f97316","shopify-payments":"#10b981","channel-integrated":"#a1a1aa",nicepay:"#0ea5e9"};function Une({pgProvider:r,channel:e,dateFrom:t,dateTo:n,pgTotalRevenue:a,fetchPaymentBreakdown:i}){const[o,s]=Y.useState([]),[l,u]=Y.useState(!1),c=Y.useRef(i);return c.current=i,Y.useEffect(()=>{let f=!1;return u(!0),c.current({channel:e,pgProvider:r,from:t,to:n}).then(h=>{f||s(h.paymentBreakdown)}).catch(()=>{f||s([])}).finally(()=>{f||u(!1)}),()=>{f=!0}},[e,r,t,n]),m.jsx(Gne,{data:o,isLoading:l,parentTotalRevenue:a})}function Wne({channel:r,dateFrom:e,dateTo:t,parentTotalRevenue:n,fetchPgBreakdown:a,fetchPaymentBreakdown:i}){const[o,s]=Y.useState([]),[l,u]=Y.useState(!1),[c,f]=Y.useState(null),h=Y.useRef(a);return h.current=a,Y.useEffect(()=>{let v=!1;return u(!0),f(null),h.current({channel:r,from:e,to:t}).then(g=>{v||s(g.pgBreakdown)}).catch(()=>{v||s([])}).finally(()=>{v||u(!1)}),()=>{v=!0}},[r,e,t]),l?m.jsx("tr",{className:"border-b border-border/30 bg-muted/5",children:m.jsx("td",{colSpan:7,className:"px-4 py-2 text-[11px] text-muted-foreground text-center",children:"PG 데이터 불러오는 중..."})}):o.length===0?m.jsx("tr",{className:"border-b border-border/30 bg-muted/5",children:m.jsx("td",{colSpan:7,className:"px-4 py-2 text-[11px] text-muted-foreground text-center",children:"PG 데이터 없음"})}):m.jsxs(m.Fragment,{children:[m.jsx("tr",{className:"border-b border-border/30 bg-muted/5",children:m.jsx("td",{colSpan:7,className:"px-4 py-1.5 text-[10px] font-semibold text-muted-foreground tracking-wide",children:"PG사별 분석"})}),o.map(v=>{const g=v.pgProvider??"__null__",y=v.pgProvider?Hne[v.pgProvider]??v.pgProvider:"미지정",b=(v.avgCommissionRate*100).toFixed(1),_=c===g,S=n>0?(v.totalRevenue/n*100).toFixed(1):"0.0";return m.jsxs(Y.Fragment,{children:[m.jsxs("tr",{className:Qe("border-b border-border/30 bg-muted/10 hover:bg-muted/20 text-[11px] cursor-pointer"),onClick:()=>f(_?null:g),onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&f(_?null:g)},tabIndex:0,children:[m.jsx("td",{className:"py-1.5",style:{paddingLeft:28},children:m.jsxs("div",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[_?m.jsx(cn,{size:10,className:"text-muted-foreground shrink-0"}):m.jsx(qr,{size:10,className:"text-muted-foreground shrink-0"}),m.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:v.pgProvider?Fne[v.pgProvider]??"#888":"#888"}}),m.jsx("span",{children:y})]})}),m.jsxs("td",{className:"px-3 py-1.5 text-right text-muted-foreground whitespace-nowrap",children:[v.orderCount.toLocaleString(),"건"]}),m.jsx("td",{className:"px-3 py-1.5 text-right whitespace-nowrap",children:Ot(v.totalRevenue)}),m.jsx("td",{className:"px-3 py-1.5 text-right text-red-600 dark:text-red-400 whitespace-nowrap",children:Ot(v.feeAmount)}),m.jsxs("td",{className:"px-3 py-1.5 text-right text-muted-foreground whitespace-nowrap",children:[b,"%"]}),m.jsx("td",{className:"px-3 py-1.5 text-right text-emerald-600 dark:text-emerald-400 whitespace-nowrap",children:Ot(v.totalNet)}),m.jsxs("td",{className:"px-3 py-1.5 text-right text-muted-foreground whitespace-nowrap text-[11px]",children:[S,"%"]})]}),_&&m.jsx(Une,{pgProvider:v.pgProvider??"",channel:r,dateFrom:e,dateTo:t,pgTotalRevenue:v.totalRevenue,fetchPaymentBreakdown:i})]},g)})]})}const Yne=/^\d{4}-\d{2}-\d{2}$/,$ne=["일","월","화","수","목","금","토"];function Vp(r,e){const t=new Date(`${r}T00:00:00Z`);return Number.isNaN(t.getTime())?r:(t.setUTCDate(t.getUTCDate()+e),t.toISOString().slice(0,10))}function vP(r){if(!Yne.test(r))return null;const e=new Date(`${r}T00:00:00Z`);if(Number.isNaN(e.getTime()))return null;const t=e.getUTCDay();return e.setUTCDate(e.getUTCDate()+(t===0?-6:1-t)),e.toISOString().slice(0,10)}function Xne(r){const e=new Date(`${r}T00:00:00Z`);return $ne[e.getUTCDay()]??""}function qne(r){return r>=1e8?`${(r/1e8).toFixed(1)}억`:r>=1e4?`${Math.round(r/1e4)}만`:r>=1e3?`${Math.round(r/1e3)}천`:r.toLocaleString()}function Tx(r){return r.slice(5).replace("-","/")}function Zne({wk:r,days:e,total:t}){const n=Vp(r,6);return m.jsxs("div",{className:"min-w-[200px] space-y-2",children:[m.jsxs("div",{className:"text-[10px] text-muted-foreground font-medium",children:[Tx(r)," ~ ",Tx(n)]}),e.length===0?m.jsx("p",{className:"text-[11px] text-muted-foreground",children:"입금 없음"}):m.jsxs(m.Fragment,{children:[e.map(a=>{const i=LD(a.day);return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground/70 mb-0.5",children:[m.jsxs("span",{children:[Tx(a.date)," (",Xne(a.date),")"]}),m.jsx("span",{className:"font-medium tabular-nums text-foreground/60",children:jl(a.amount)})]}),i.map(o=>m.jsxs("div",{className:"flex items-center justify-between gap-4 text-[11px]",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{backgroundColor:o.color}}),m.jsx("span",{className:"text-muted-foreground",children:o.label})]}),m.jsx("span",{className:"font-medium tabular-nums",children:jl(o.amount)})]},o.key))]},a.date)}),m.jsxs("div",{className:"flex justify-between gap-4 text-[11px] font-semibold pt-1 border-t border-border/40",children:[m.jsx("span",{children:"주간 합계"}),m.jsx("span",{className:"tabular-nums text-emerald-500",children:jl(t)})]})]})]})}const Jv=80,Pw=24,Kne=216;function Qne({depositSchedule:r,today:e}){const t=e??new Date().toISOString().slice(0,10),n=Y.useRef(null),a=new Map;for(const v of r){const g=vP(v.depositDate);if(!g)continue;const y=a.get(g);a.set(g,{amount:((y==null?void 0:y.amount)??0)+v.totalAmount,days:[...(y==null?void 0:y.days)??[],{date:v.depositDate,amount:v.totalAmount,day:v}].sort((b,_)=>b.date.localeCompare(_.date))})}const i=Math.max(...[...a.values()].map(v=>v.amount),1),o=vP(t)??t,s=[...a.keys()].sort(),l=[Vp(o,-28),s[0]??o].sort()[0],u=[Vp(o,56),s[s.length-1]??o].sort().at(-1),c=[];let f=l;for(;f<=u;)c.push(f),f=Vp(f,7);for(;c.length<20;)c.push(Vp(c.at(-1),7));Y.useEffect(()=>{const v=n.current;if(!v)return;const g=c.indexOf(o);if(g<0)return;const y=v.scrollWidth/c.length,b=g*y-v.clientWidth/2+y/2;v.scrollLeft=Math.max(0,b)},[c.length,o]);const h=Y.useCallback(v=>{var g;(g=n.current)==null||g.scrollBy({left:v*Kne,behavior:"smooth"})},[]);return m.jsxs("div",{className:"relative",children:[m.jsxs("div",{className:"absolute top-0 right-0 flex items-center gap-0.5 z-10",children:[m.jsx("button",{type:"button",onClick:()=>h(-1),className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",children:m.jsx(CD,{size:14})}),m.jsx("button",{type:"button",onClick:()=>h(1),className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",children:m.jsx(qr,{size:14})})]}),m.jsx("div",{ref:n,className:"overflow-x-auto",children:m.jsxs("div",{className:"relative flex",style:{height:`${Jv+Pw}px`,minWidth:`${c.length*36}px`},children:[m.jsx("div",{className:"absolute bottom-[20px] left-0 right-0 border-b border-border/40 pointer-events-none"}),c.map(v=>{const g=a.get(v),y=(g==null?void 0:g.amount)??0,b=y>0?Math.max(5,Math.round(y/i*Jv)):0,_=v===o,S=y>0?.2+y/i*.72:0;return m.jsx(us,{content:m.jsx(Zne,{wk:v,days:(g==null?void 0:g.days)??[],total:(g==null?void 0:g.amount)??0}),side:"top",contentClassName:"max-w-[260px]",delayDuration:80,children:m.jsxs("div",{className:"relative flex flex-col flex-1 min-w-0 cursor-default px-0.5",style:{height:`${Jv+Pw}px`},children:[_&&m.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 w-px bg-primary/50 pointer-events-none",style:{top:0,height:`${Jv}px`}}),_&&m.jsx("span",{className:"absolute top-0 left-0 right-0 text-center text-[10px] text-primary font-semibold leading-none bg-card/80 pointer-events-none",children:"이번주"}),m.jsx("div",{style:{height:`${Jv-b}px`,flexShrink:0}}),b>0&&m.jsx("div",{className:"w-full rounded-t",style:{height:`${b}px`,backgroundColor:`hsl(var(--primary) / ${S})`,flexShrink:0}}),m.jsx("div",{className:Qe("text-center mt-1 leading-none truncate text-[10px]",_?"text-primary font-semibold":"text-muted-foreground/50"),children:Tx(v)}),b>=24&&m.jsx("div",{className:"absolute left-0 right-0 text-center text-[10px] font-medium text-white/90 pointer-events-none",style:{bottom:`${Pw+4}px`},children:qne(y)})]})},v)})]})})]})}const SH={tosspayments:"토스페이먼츠",naverpay:"네이버페이",cafe24pay:"카페24페이먼츠","kg-inicis":"KG이니시스",kakaopay:"카카오페이",danal:"다날","shopify-payments":"Shopify Payments","channel-integrated":"채널 통합"};function Jne(r){return r==null?"-":`${(r>1?r:r*100).toFixed(1)}%`}function eae({lines:r,channel:e,onOpenConfig:t}){return m.jsx("div",{className:"space-y-0.5",children:r.map((n,a)=>{const i=`${n.k}-${a}`;if(n.k==="divider")return m.jsx("div",{className:"border-t border-border/40 my-1"},i);if(n.k==="section")return m.jsx("p",{className:Qe("text-[9px] font-semibold uppercase tracking-wide pt-0.5",n.accent==="fix"?"text-emerald-600 dark:text-emerald-400":n.accent==="info"?"text-amber-600 dark:text-amber-400":"text-foreground/50"),children:n.v},i);if(n.k==="fixbullet")return m.jsxs("div",{className:"flex gap-1.5 text-[10px] leading-snug",children:[m.jsx("span",{className:"text-foreground/40 shrink-0 mt-px",children:"✓"}),m.jsxs("span",{children:[n.v,n.href&&t&&m.jsx("button",{type:"button",onClick:()=>{const o=n.v.includes("annualRevenue");t(o?"annualRevenue":"channel",o?void 0:e)},className:"ml-1 text-emerald-600 dark:text-emerald-400 underline underline-offset-2 hover:opacity-80 transition-opacity",children:"설정→"})]})]},i);if(n.k==="bullet")return m.jsxs("div",{className:"flex gap-1.5 text-muted-foreground text-[10px] leading-snug",children:[m.jsx("span",{className:"text-foreground/40 shrink-0 mt-px",children:"•"}),m.jsx("span",{children:n.v})]},i);if(n.k==="row"){const o=n.accent==="muted"?"text-muted-foreground":n.accent==="green"?"text-emerald-500 tabular-nums":n.accent==="red"?"text-red-500 tabular-nums":n.accent==="warn"?"text-amber-500 tabular-nums":"tabular-nums";return m.jsxs("div",{className:"flex justify-between gap-4 text-[11px]",children:[m.jsx("span",{className:"text-muted-foreground shrink-0",children:n.label}),m.jsx("span",{className:o,children:n.value})]},i)}return m.jsx("p",{className:"text-muted-foreground text-[11px]",children:n.v},i)})})}function tae({channels:r,rules:e,defaults:t,annualRevenue:n,quickSettlement:a,totalRevenue:i,totalOrders:o,totalCommission:s,netRevenue:l,commissionRate:u,isLoading:c,ssDaily:f,coupangConnected:h,dateFrom:v,dateTo:g,fetchPgBreakdown:y,fetchPaymentBreakdown:b,onOpenConfig:_}){const[S,T]=Y.useState(null),{sort:C,onSort:M,sortData:D}=_te(),L=(()=>{const E=(f==null?void 0:f.elements)??[];if(!E.length)return null;const I=E.reduce((U,O)=>U+(O.paySettleAmount??0),0),z=E.reduce((U,O)=>U+(O.commissionSettleAmount??0),0),j=E.reduce((U,O)=>U+(O.settleAmount??0),0),G=I>0?Math.abs(z)/I*100:null;return{totalPay:I,totalComm:z,totalNet:j,rate:G}})();if(c)return m.jsxs("div",{className:"mb-6",children:[m.jsx("h3",{className:"text-[13px] font-medium mb-3",children:"채널별 정산 현황"}),m.jsx("div",{className:"text-sm text-muted-foreground py-6 text-center",children:"불러오는 중..."})]});if(r.length===0)return m.jsxs("div",{className:"mb-6",children:[m.jsx("h3",{className:"text-[13px] font-medium mb-3",children:"채널별 정산 현황"}),m.jsxs("div",{className:"border border-dashed border-border rounded-lg p-10 text-center text-muted-foreground text-sm",children:["정산 데이터가 없습니다.",m.jsxs("div",{className:"text-[11px] mt-1",children:[m.jsx("code",{className:"bg-muted px-1 rounded",children:"sppt import"}),"로 주문 데이터를 가져오거나 채널을 동기화하세요."]})]})]});const k=v||new Date(Date.now()-720*60*60*1e3).toISOString().slice(0,10),R=g||new Date().toISOString().slice(0,10);return m.jsxs("div",{className:"mb-6",children:[m.jsx("h3",{className:"text-[13px] font-medium mb-3",children:"채널별 정산 현황"}),m.jsxs(ho,{stickyHeader:!0,minWidth:"640px",sort:C,onSort:M,children:[m.jsxs(vo,{children:[m.jsx(je,{sortKey:"channel",children:"채널"}),m.jsx(je,{sortKey:"orderCount",align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:["주문수",m.jsx(Zt,{side:"top",content:m.jsx(sr,{metric:"정산주문",rows:lr.정산주문,summary:"정산 테이블 기준 주문 건수"})})]})}),m.jsx(je,{sortKey:"totalRevenue",align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:["총 매출",m.jsx(Zt,{side:"top",content:m.jsx(sr,{metric:"정산매출",rows:lr.정산매출,summary:"정산 완료 주문의 grossAmount 합계"})})]})}),m.jsx(je,{align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:["수수료",m.jsx(Zt,{side:"top",content:m.jsxs("div",{className:"space-y-1",children:[m.jsx("p",{className:"font-medium",children:"수수료 계산 기준"}),m.jsx("p",{children:"채널별 수수료 정책 기반 추정"}),m.jsx("p",{className:"pl-2 text-muted-foreground",children:"커스텀 규칙 → 채널 기본 요율 순 적용"})]})})]})}),m.jsx(je,{align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:["평균 수수료율",m.jsx(Zt,{side:"top",contentClassName:"max-w-[340px]",content:m.jsxs("div",{className:"space-y-2",children:[m.jsx("p",{className:"font-medium",children:"수수료율 결정 우선순위"}),m.jsxs("div",{className:"space-y-0.5 text-muted-foreground",children:[m.jsx("p",{children:"① 주문별 수수료율 데이터 평균"}),m.jsx("p",{className:"pl-3 text-[10px]",children:"채널 CSV에 수수료율 컬럼이 있을 때"}),m.jsx("p",{children:"② 커스텀 fee rule"}),m.jsx("p",{className:"pl-3 text-[10px]",children:"직접 설정한 규칙이 있을 때"}),m.jsx("p",{children:"③ 채널 기본 요율"}),m.jsx("p",{className:"pl-3 text-[10px]",children:"공식 자료 기반 기본값 (추정)"})]}),Object.keys(t).length>0&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"border-t border-border/40 pt-1.5",children:[m.jsxs("p",{className:"font-medium mb-0.5",children:["채널별 기본 수수료",n!=null?` (연매출 ${(n/1e8).toFixed(1)}억 기준)`:" (일반 등급 기준, 추정)"]}),n==null&&m.jsxs("p",{className:"text-[10px] text-amber-500 mb-1",children:["연매출 미설정 — 등급별 실제 요율과 다를 수 있음"," ",_&&m.jsx("button",{type:"button",onClick:()=>_("annualRevenue"),className:"underline underline-offset-2 hover:opacity-80",children:"설정→"})]}),m.jsx("div",{className:"space-y-0.5",children:Object.entries(t).map(([E,I])=>{var $;const z=Cg(I.revenueTiers,n),j=z!=null?($=I.revenueTiers)==null?void 0:$[z]:null,G=(j==null?void 0:j.pgRate)??I.pgRate,U=I.commissionRate+G,O=e.some(B=>B.channel===E),H=e.find(B=>B.channel===E&&!B.from&&!B.to&&!B.paymentMethod&&!B.category),F=H?(H.commissionRate??0)+(H.pgRate??0):null;return m.jsxs("div",{className:"flex justify-between gap-4 text-[10px]",children:[m.jsx("span",{className:"text-muted-foreground",children:hr[E]??E}),m.jsx("span",{children:H&&F!=null?m.jsxs("span",{className:"text-amber-400",children:[F.toFixed(1),"%"," ",m.jsxs("span",{className:"text-muted-foreground/50",children:["(기본 ",U.toFixed(1),"% ✎)"]})]}):O?m.jsxs("span",{className:Qe(j?"text-emerald-400":""),children:[U.toFixed(1),"%"," ",m.jsx("span",{className:"text-amber-400/70",children:"✎"})]}):m.jsxs("span",{className:j?"text-emerald-400":"",children:[U.toFixed(1),"%",j?` (${j.label})`:""]})})]},E)})}),m.jsx("p",{className:"text-[10px] text-muted-foreground/60 mt-1",children:"✎ 커스텀 규칙 · 초록 = 등급 적용"})]}),m.jsx("p",{className:"text-[10px] text-muted-foreground/60 border-t border-border/40 pt-1.5",children:"정확한 등급 요율 → 아래 '채널 기본 수수료 규칙' 펼치기"})]})]})})]})}),m.jsx(je,{sortKey:"netRevenue",align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:["실수령 예상",m.jsx(Zt,{side:"top",content:m.jsx(sr,{metric:"순수익",rows:lr.순수익,summary:"정산매출 - 수수료 - PG비"})})]})}),m.jsx(je,{sortKey:"revShare",align:"right",children:"매출 비중"})]}),m.jsx("tbody",{className:"bg-card",children:D(r,(E,I)=>I==="revShare"?i>0?E.totalRevenue/i:0:E[I]).map((E,I)=>{var fe;const z=E.channel==="smartstore",j=E.channel==="coupang",G=z?L:null,U=z?f==null?void 0:f.settleMeta:void 0,O=G?Math.abs(G.totalComm):E.totalCommission!=null?E.totalCommission:E.totalRevenue-(E.netRevenue??0),H=G?G.totalNet:E.netRevenue??0,F=(G==null?void 0:G.rate)??E.avgCommissionRate,$=z&&t.smartstore?(t.smartstore.commissionRate??0)+(t.smartstore.pgRate??0):null,B=(G==null?void 0:G.rate)!=null&&$!=null?G.rate-$:null,X=B!=null&&Math.abs(B)>.5,q=i>0?(E.totalRevenue/i*100).toFixed(1):"0",Q=Jee(E,e,t,n),ne=S===E.channel;return m.jsxs(Y.Fragment,{children:[m.jsxs("tr",{className:Qe("border-b border-border/60 cursor-pointer hover:bg-muted/20",I%2!==0&&"bg-muted/30"),onClick:()=>T(ne?null:E.channel),onKeyDown:ve=>{(ve.key==="Enter"||ve.key===" ")&&T(ne?null:E.channel)},tabIndex:0,children:[m.jsx("td",{className:"px-3 py-2.5",children:m.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[ne?m.jsx(cn,{size:12,className:"text-muted-foreground shrink-0"}):m.jsx(qr,{size:12,className:"text-muted-foreground shrink-0"}),m.jsx(Tb,{channel:E.channel}),hr[E.channel]??E.channelLabel??E.channel,z&&G&&m.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"실정산"}),j&&h&&m.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"API 연동"}),z&&a&&m.jsx("span",{className:"inline-flex items-center text-[10px] font-medium bg-blue-100 text-blue-700 dark:bg-blue-950/50 dark:text-blue-400 px-1.5 py-0.5 rounded-full",children:"⚡ 빠른정산"})]})}),m.jsxs("td",{className:"px-3 py-2.5 text-right text-muted-foreground",children:[E.orderCount.toLocaleString(),"건"]}),m.jsx("td",{className:"px-3 py-2.5 text-right font-medium",children:Ot(E.totalRevenue)}),m.jsx("td",{className:"px-3 py-2.5 text-right text-red-600 dark:text-red-400",children:Ot(O)}),m.jsx("td",{className:"px-3 py-2.5 text-right text-muted-foreground",children:m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",onClick:ve=>ve.stopPropagation(),children:[Jne(F),X&&m.jsx(us,{side:"left",contentClassName:"max-w-[300px]",content:m.jsxs("div",{className:"space-y-1.5",children:[m.jsx("p",{className:"font-medium text-[11px] text-amber-500",children:"수수료율 불일치"}),m.jsxs("div",{className:"space-y-0.5 text-[11px]",children:[m.jsxs("div",{className:"flex justify-between gap-4",children:[m.jsx("span",{className:"text-muted-foreground",children:"설정값"}),m.jsxs("span",{children:[$==null?void 0:$.toFixed(1),"%"]})]}),m.jsxs("div",{className:"flex justify-between gap-4",children:[m.jsx("span",{className:"text-muted-foreground",children:"실측"}),m.jsxs("span",{className:"text-amber-500",children:[(fe=G==null?void 0:G.rate)==null?void 0:fe.toFixed(1),"%"]})]}),m.jsxs("div",{className:"flex justify-between gap-4",children:[m.jsx("span",{className:"text-muted-foreground",children:"차이"}),m.jsxs("span",{className:"text-amber-500",children:[B!=null&&B>=0?"+":"",B==null?void 0:B.toFixed(1),"%p"]})]})]}),U&&m.jsx("div",{className:"border-t border-border/40 pt-1 text-[10px] text-muted-foreground/70",children:m.jsxs("p",{children:["📅 정산완료일 기준 · 주문일+",U.offsetDays.min,"~",U.offsetDays.max,"일 오프셋 적용"]})})]}),children:m.jsx("span",{className:"cursor-help inline-flex items-center",children:m.jsx(Gee,{size:11,className:"text-amber-500"})})}),!X&&G&&U&&m.jsx(Zt,{side:"left",contentClassName:"max-w-[320px]",content:m.jsxs("div",{className:"space-y-1.5",children:[m.jsx("p",{className:"font-medium text-[11px]",children:"실정산 수수료율"}),m.jsxs("div",{className:"space-y-0.5 text-[11px]",children:[m.jsxs("div",{className:"flex justify-between gap-4",children:[m.jsx("span",{className:"text-muted-foreground",children:"결제 기준금액"}),m.jsx("span",{children:Ot(G.totalPay)})]}),m.jsxs("div",{className:"flex justify-between gap-4",children:[m.jsx("span",{className:"text-muted-foreground",children:"수수료 합계"}),m.jsx("span",{className:"text-red-500",children:Ot(Math.abs(G.totalComm))})]}),m.jsxs("div",{className:"flex justify-between gap-4",children:[m.jsx("span",{className:"text-muted-foreground",children:"실수령"}),m.jsx("span",{className:"text-emerald-500",children:Ot(G.totalNet)})]})]}),m.jsxs("div",{className:"border-t border-border/40 pt-1 text-[10px] text-muted-foreground/70 space-y-1",children:[m.jsx("p",{className:"font-medium text-foreground/60",children:"조회 방식"}),m.jsxs("p",{children:["주문일(",U.orderFrom,"~",U.orderTo,")에 배송·구매확정 소요일(+",U.offsetDays.min,"~",U.offsetDays.max,"일)을 더해 정산완료일 범위로 조회합니다."]}),m.jsx("p",{children:"월 경계 주문은 실제 정산일과 다소 차이가 날 수 있습니다."}),m.jsx("p",{className:"text-foreground/50",children:"행 클릭 → 주문건별 정산 상세 확인 가능"})]})]})}),!G&&Q&&m.jsx(Zt,{side:"left",contentClassName:"max-w-[300px]",content:m.jsxs("div",{className:"space-y-1.5",children:[m.jsx("p",{className:"font-medium text-[11px]",children:Q.label}),m.jsx(eae,{lines:Q.lines,channel:E.channel,onOpenConfig:_}),z&&m.jsxs("div",{className:"mt-1.5 pt-1.5 border-t border-border/40 text-[10px] text-muted-foreground/60 space-y-0.5",children:[m.jsx("p",{children:"현재 추정값입니다. 정산 데이터가 있는 기간 선택 시 네이버 실정산 기준으로 자동 교체됩니다."}),m.jsx("p",{className:"text-foreground/40",children:"행 클릭 → 주문건별 정산 상세 확인 가능"})]})]})})]})}),m.jsx("td",{className:"px-3 py-2.5 text-right text-emerald-600 dark:text-emerald-400 font-medium",children:Ot(H)}),m.jsx("td",{className:"px-3 py-2.5 text-right",children:m.jsxs("div",{className:"flex items-center justify-end gap-2",children:[m.jsx("div",{className:"w-[60px] bg-muted rounded-full h-1.5 overflow-hidden",children:m.jsx("div",{className:"h-full bg-primary/60 rounded-full",style:{width:`${q}%`}})}),m.jsxs("span",{className:"text-muted-foreground text-[11px] w-[32px] text-right",children:[q,"%"]})]})})]}),ne&&y&&b&&m.jsx(Wne,{channel:E.channel,dateFrom:k,dateTo:R,parentTotalRevenue:i,fetchPgBreakdown:y,fetchPaymentBreakdown:b})]},E.channel)})}),r.length>1&&m.jsx("tfoot",{children:m.jsxs("tr",{className:"border-t border-border bg-muted/30 text-[12px] font-semibold",children:[m.jsx("td",{className:"px-3 py-2.5",children:"합계"}),m.jsxs("td",{className:"px-3 py-2.5 text-right text-muted-foreground",children:[o.toLocaleString(),"건"]}),m.jsx("td",{className:"px-3 py-2.5 text-right",children:Ot(i)}),m.jsx("td",{className:"px-3 py-2.5 text-right text-red-600 dark:text-red-400",children:Ot(s)}),m.jsxs("td",{className:"px-3 py-2.5 text-right text-muted-foreground",children:[u.toFixed(1),"%"]}),m.jsx("td",{className:"px-3 py-2.5 text-right text-emerald-600 dark:text-emerald-400",children:Ot(l)}),m.jsx("td",{})]})})]})]})}const rae={ordered:"주문일",paid:"결제일",confirmed:"구매확정일"};function nae({defaults:r,rules:e,annualRevenue:t,isLoading:n,onOpenConfig:a}){return n?m.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:"불러오는 중..."}):Object.keys(r).length===0?m.jsxs("div",{className:"border border-dashed border-border rounded-lg px-4 py-5 text-[12px] text-muted-foreground flex items-center gap-2",children:[m.jsx(AD,{size:13,className:"shrink-0"}),"기본 수수료 규칙 데이터 없음"]}):m.jsxs(ho,{stickyHeader:!0,minWidth:"640px",children:[m.jsxs(vo,{children:[m.jsx(je,{children:"채널"}),m.jsx(je,{align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:["판매수수료",m.jsx(Zt,{side:"top",content:m.jsx("p",{children:"네이버쇼핑·일반 유입 기준 요율. 마케팅 링크 유입 시 별도 요율 적용 (셀별 ℹ 확인)"})})]})}),m.jsx(je,{align:"right",children:"PG수수료"}),m.jsx(je,{align:"right",children:"합계"}),m.jsx(je,{children:"정산 기준"}),m.jsx(je,{align:"right",children:"정산 주기"}),m.jsx(je,{children:"커스텀 규칙"})]}),m.jsx("tbody",{className:"bg-card",children:Object.entries(r).map(([i,o],s)=>{const l=e.filter(c=>c.channel===i).length,u=o.commissionRate+o.pgRate;return m.jsxs(Y.Fragment,{children:[m.jsxs("tr",{className:Qe("border-b border-border/60",s%2!==0&&"bg-muted/30"),children:[m.jsx("td",{className:"px-3 py-2.5",children:m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Tb,{channel:i}),hr[i]??i]})}),m.jsx("td",{className:"px-3 py-2.5 text-right",children:o.commissionRate>0?m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:[m.jsxs("span",{className:"font-medium",children:[o.commissionRate,"%"]}),o.marketingLinkCommissionRate!=null&&m.jsx(Zt,{side:"top",content:m.jsxs("div",{className:"space-y-0.5",children:[m.jsx("p",{className:"font-medium",children:"판매수수료 2종 (택1)"}),m.jsxs("p",{children:["일반 유입: ",o.commissionRate,"%"]}),m.jsxs("p",{children:["마케팅 링크 유입: ",o.marketingLinkCommissionRate,"%"]})]})})]}):m.jsx("span",{className:"text-muted-foreground",children:"-"})}),m.jsx("td",{className:"px-3 py-2.5 text-right",children:o.pgRate>0?m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:[(()=>{var v;const c=Cg(o.revenueTiers,t),f=c!=null?(v=o.revenueTiers)==null?void 0:v[c]:null,h=(f==null?void 0:f.pgRate)??null;return h!=null&&h!==o.pgRate?m.jsxs("span",{className:"inline-flex items-center gap-1",children:[m.jsxs("span",{className:"font-semibold text-emerald-600 dark:text-emerald-400",children:[h,"%"]}),m.jsx(Zt,{side:"top",content:m.jsxs("div",{className:"space-y-0.5",children:[m.jsxs("p",{className:"font-medium text-emerald-400",children:["현재 적용: ",h,"% (",f==null?void 0:f.label,")"]}),m.jsxs("p",{className:"text-muted-foreground",children:["기본(일반): ",o.pgRate,"%"]}),t!=null&&m.jsxs("p",{className:"text-muted-foreground text-[10px]",children:["연매출 ",(t/1e8).toFixed(1),"억 기준"]})]})})]}):m.jsxs("span",{className:"font-medium",children:[o.pgRate,"%"]})})(),o.pgRateAppliesToShipping&&m.jsx(Zt,{side:"top",content:m.jsx("p",{children:"배송비 포함 금액에도 적용 (스마트스토어 Npay 수수료)"})})]}):m.jsx("span",{className:"text-muted-foreground",children:"-"})}),m.jsx("td",{className:"px-3 py-2.5 text-right text-muted-foreground",children:u>0?m.jsxs("span",{className:"inline-flex items-center gap-1 justify-end",children:[u.toFixed(2),"%",o.shippingCommissionRate!=null&&o.shippingCommissionRate>0&&m.jsx(Zt,{side:"top",content:m.jsxs("p",{children:["배송비 수수료 ",o.shippingCommissionRate,"% 별도"]})})]}):"-"}),m.jsx("td",{className:"px-3 py-2.5 text-muted-foreground",children:rae[o.settlementDayBasis]??o.settlementDayBasis}),m.jsxs("td",{className:"px-3 py-2.5 text-right text-muted-foreground",children:[o.settlementCycleDays,"일"]}),m.jsx("td",{className:"px-3 py-2.5",children:l>0?m.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium bg-amber-100 text-amber-700 dark:bg-amber-950/50 dark:text-amber-400 px-1.5 py-0.5 rounded-full",children:[l,"개 규칙 적용"]}):m.jsx("span",{className:"text-[11px] text-muted-foreground",children:"기본값"})})]}),m.jsx(Bne,{d:o,annualRevenue:t,channel:i,onOpenConfig:a},`${i}-detail`),o.pgProviders&&Object.keys(o.pgProviders).length>1&&m.jsx("tr",{className:"border-b border-border/40",children:m.jsxs("td",{colSpan:7,className:"px-6 py-2 bg-muted/10",children:[m.jsx("div",{className:"text-[11px] text-muted-foreground font-medium mb-1.5",children:"PG사별 수수료"}),m.jsx("div",{className:"grid grid-cols-[1fr_auto_auto] gap-x-4 gap-y-1 text-[11px]",children:Object.entries(o.pgProviders).map(([c,f])=>m.jsxs(Y.Fragment,{children:[m.jsx("span",{className:"text-muted-foreground",children:SH[c]??c}),m.jsxs("span",{className:"text-right font-medium",children:[f.pgRate,"%"]}),m.jsx("span",{className:"text-right text-muted-foreground/60",children:f.pgRateByPayment?`${Object.keys(f.pgRateByPayment).length}종`:""})]},c))})]})})]},i)})})]})}function aae({channels:r,totalRevenue:e,netRevenue:t,totalOrders:n,rules:a=[],defaults:i={},depositSchedule:o=[],isLoading:s=!1,scheduleLoading:l=!1,dateFrom:u,dateTo:c,onDateChange:f,ssDaily:h,coupangConnected:v=!1,annualRevenue:g=null,quickSettlement:y=!1,renderExpandedPanel:b,fetchPgBreakdown:_,fetchPaymentBreakdown:S,onOpenConfig:T,onSync:C,syncing:M=!1,syncResult:D,lastSyncedAt:L,syncDisabled:k=!1,estimationNote:R="주문 데이터 기반 추정값",children:E}){const I=Y.useRef(null),z=Y.useRef(null);Y.useEffect(()=>{const Se=z.current,ge=I.current;if(!Se||!ge)return;const he=new ResizeObserver(()=>{ge.style.setProperty("--page-header-h",`${Se.offsetHeight}px`)});return he.observe(Se),()=>he.disconnect()},[]);const[j,G]=Y.useState(""),[U,O]=Y.useState(""),H=u!==void 0||c!==void 0,F=H?u??"":j,$=H?c??"":U,[B,X]=Y.useState(!1),[q,Q]=Y.useState(!1),ne=e-t,fe=e>0?ne/e*100:0;function ve(Se,ge){H||(G(Se),O(ge)),f==null||f(Se,ge)}return m.jsx(MD,{delayDuration:200,children:m.jsxs("div",{ref:I,children:[m.jsxs("div",{ref:z,className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-4 sticky top-0 z-10 py-4 -mt-4 md:-mt-7 md:pt-7",style:{backgroundColor:"var(--page-bg, transparent)"},children:[m.jsx("h2",{className:"text-xl font-medium",children:"정산"}),m.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[m.jsx(rH,{size:12}),R," · 실제 정산과 차이 있을 수 있음"]}),(()=>{const Se=D??(Tg(L)?`마지막 동기화: ${Tg(L)}`:null);return Se?m.jsx("span",{className:"text-[11px] text-muted-foreground",children:Se}):null})(),C&&m.jsx(e1,{onSync:C,syncing:M,syncResult:D,disabled:k})]})]}),m.jsx(DD,{from:F,to:$,onChange:ve,className:"mb-6"}),m.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:[m.jsx(bn,{label:"총 매출",value:Ot(e),sub:`주문 ${n.toLocaleString()}건`,tooltip:m.jsx(sr,{metric:"정산매출",rows:lr.정산매출,summary:"정산 완료 주문의 grossAmount 합계"})}),m.jsx(bn,{label:"수수료 · PG 합계",value:Ot(ne),sub:`평균 ${fe.toFixed(1)}%`}),m.jsx(bn,{label:"실수령 예상",value:Ot(t),accent:!0,tooltip:m.jsx(sr,{metric:"순수익",rows:lr.순수익,summary:"정산매출 - 수수료 - PG비"})}),m.jsx(bn,{label:"커스텀 수수료 규칙",value:`${a.length}개`,sub:a.length===0?"기본값 적용 중":"커스텀 규칙 적용"})]}),m.jsx(tae,{channels:r,rules:a,defaults:i,annualRevenue:g,quickSettlement:y,totalRevenue:e,totalOrders:n,totalCommission:ne,netRevenue:t,commissionRate:fe,isLoading:s,ssDaily:h,coupangConnected:v,dateFrom:F,dateTo:$,fetchPgBreakdown:_,fetchPaymentBreakdown:S,onOpenConfig:T}),m.jsxs("div",{className:"mb-4",children:[m.jsxs("button",{type:"button",onClick:()=>X(Se=>!Se),className:"flex items-center gap-2 w-full text-left group mb-0",children:[B?m.jsx(cn,{size:13,className:"shrink-0 text-muted-foreground"}):m.jsx(qr,{size:13,className:"shrink-0 text-muted-foreground"}),m.jsx("span",{className:"text-[13px] font-medium group-hover:text-foreground/80 transition-colors",children:"채널 기본 수수료 규칙"}),m.jsx(Zt,{size:12,contentClassName:"max-w-[300px]",content:m.jsxs("div",{className:"space-y-1.5",children:[m.jsx("p",{className:"font-medium",children:"채널 기본 수수료 규칙이란?"}),m.jsxs("div",{className:"space-y-1 text-muted-foreground",children:[m.jsx("p",{children:"공식 자료·실데이터 기반 채널별 표준 요율입니다."}),m.jsx("p",{children:"커스텀 규칙이 없을 때 정산 추정에 사용됩니다."}),m.jsx("p",{children:"실제 계약 조건이 다르면 커스텀 규칙으로 오버라이드하세요."})]})]})})]}),B&&m.jsx("div",{className:"mt-3",children:m.jsx(nae,{defaults:i,rules:a,annualRevenue:g,isLoading:!1,onOpenConfig:T})})]}),m.jsxs("div",{className:"mb-6",children:[m.jsxs("button",{type:"button",onClick:()=>Q(Se=>!Se),className:"flex items-center gap-2 w-full text-left group mb-0",children:[q?m.jsx(cn,{size:13,className:"shrink-0 text-muted-foreground"}):m.jsx(qr,{size:13,className:"shrink-0 text-muted-foreground"}),m.jsx("span",{className:"text-[13px] font-medium group-hover:text-foreground/80 transition-colors",children:"커스텀 수수료 규칙"}),a.length>0&&m.jsxs("span",{className:"inline-flex items-center text-[10px] font-medium bg-amber-100 text-amber-700 dark:bg-amber-950/50 dark:text-amber-400 px-1.5 py-0.5 rounded-full",children:[a.length,"개"]}),m.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground flex items-center gap-1",children:m.jsx("code",{className:"bg-muted px-1 rounded text-[10px] mr-2",children:"sppt settlement fee set <channel>"})})]}),q&&m.jsx("div",{className:"mt-3",children:a.length===0?m.jsxs("div",{className:"border border-dashed border-border rounded-lg px-4 py-5 text-[12px] text-muted-foreground flex items-center gap-2",children:[m.jsx(AD,{size:13,className:"shrink-0"}),"등록된 커스텀 규칙 없음 — 채널 기본 수수료 규칙이 적용됩니다."]}):m.jsxs(m.Fragment,{children:[m.jsxs(ho,{stickyHeader:!0,minWidth:"560px",className:"rounded-b-none",children:[m.jsxs(vo,{children:[m.jsx(je,{className:"w-[72px]",children:"ID"}),m.jsx(je,{children:"채널"}),m.jsx(je,{children:"PG사"}),m.jsx(je,{align:"right",children:"판매수수료"}),m.jsx(je,{align:"right",children:"PG수수료"}),m.jsx(je,{children:"적용 기간"}),m.jsx(je,{children:"결제수단"}),m.jsx(je,{children:"메모"})]}),m.jsx("tbody",{className:"bg-card",children:a.map(Se=>m.jsxs("tr",{className:"border-b border-border/50",children:[m.jsx("td",{className:"px-3 py-2 font-mono text-[10px] text-muted-foreground",children:Se.id}),m.jsx("td",{className:"px-3 py-2",children:hr[Se.channel]??Se.channel}),m.jsx("td",{className:"px-3 py-2 text-[11px] text-muted-foreground",children:Se.pgProvider?SH[Se.pgProvider]??Se.pgProvider:"전체"}),m.jsx("td",{className:"px-3 py-2 text-right text-muted-foreground",children:Se.commissionRate!=null?`${(Se.commissionRate*100).toFixed(1)}%`:"-"}),m.jsx("td",{className:"px-3 py-2 text-right text-muted-foreground",children:Se.pgRate!=null?`${(Se.pgRate*100).toFixed(1)}%`:"-"}),m.jsx("td",{className:"px-3 py-2 text-[11px] text-muted-foreground",children:Se.from&&Se.to?`${Se.from} ~ ${Se.to}`:Se.from??Se.to??"-"}),m.jsx("td",{className:"px-3 py-2 text-[11px] text-muted-foreground",children:Se.paymentMethod??"-"}),m.jsx("td",{className:"px-3 py-2 text-[11px] text-muted-foreground",children:Se.note??"-"})]},Se.id))})]}),m.jsxs("div",{className:"px-3 py-2 border border-t-0 border-border rounded-b-lg bg-muted/20 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[m.jsx(iH,{size:11}),"조건이 많이 맞는 규칙이 우선 적용 (PG사 > 기간 > 결제수단 > 카테고리 순)"]})]})})]}),(o.length>0||l)&&m.jsx("div",{className:"mt-6",children:(()=>{const Se=new Date().toISOString().slice(0,10),ge=Math.max(...o.map(Te=>Te.totalAmount),1),he=o.filter(Te=>Te.depositDate>=Se),Ne=he.reduce((Te,$e)=>Te+$e.totalAmount,0),xe=he.reduce((Te,$e)=>Te+$e.orderCount,0);return m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between mb-3",children:[m.jsx("h3",{className:"text-[13px] font-medium",children:"입금 스케줄"}),Ne>0&&m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["향후"," ",m.jsx("span",{className:"text-emerald-600 dark:text-emerald-400 font-medium",children:Ot(Ne)})," ","예정 · ",xe,"건"]})]}),l?m.jsx("div",{className:"text-sm py-4 text-center text-muted-foreground",children:"불러오는 중..."}):o.length===0?m.jsx("div",{className:"border border-dashed border-border rounded-lg px-4 py-5 text-[12px] text-muted-foreground text-center",children:"정산 데이터가 없어 입금 스케줄을 계산할 수 없습니다."}):m.jsxs("div",{className:"grid gap-3 grid-cols-1 md:grid-cols-[2fr_1fr]",children:[m.jsxs("div",{className:"min-w-0",children:[m.jsx("div",{className:"border border-border rounded-lg bg-card px-3 pt-7 pb-2 mb-3",children:m.jsx(Qne,{depositSchedule:o,today:Se,maxAmount:ge})}),m.jsx(bte,{depositSchedule:o,today:Se,maxAmount:ge})]}),m.jsx("div",{className:"relative min-w-0 h-[400px] md:h-auto",children:m.jsx(xte,{schedule:o,today:Se})})]})]})})()}),E]})})}const wH={cafe24:{domain:"cafe24.com",initial:"C24",bg:"#3b82f6"},coupang:{domain:"coupang.com",initial:"CP",bg:"#f97316"},smartstore:{domain:"shopping.naver.com",initial:"N",bg:"#03c75a"},shopify:{domain:"shopify.com",initial:"S",bg:"#96bf48"},"toss-shopping":{domain:"toss.im",initial:"T",bg:"#0064ff"},kurly:{domain:"kurly.com",initial:"K",bg:"#a855f7"}};function iae(r,e=32){const t=wH[r];if(t!=null&&t.domain)return`https://www.google.com/s2/favicons?domain=${t.domain}&sz=${e}`}function oae(r,e){switch(r){case"cafe24":return e?`https://${e}.cafe24.com/disp/admin/shop1/index`:null;case"coupang":return"https://wing.coupang.com/";case"smartstore":return"https://partner.smartstore.naver.com/";case"shopify":return e?`https://${e}/admin`:null;case"toss-shopping":return"https://shopping-seller.toss.im/";default:return null}}const pP=[{id:"cafe24",label:hr.cafe24,hasApi:!0},{id:"coupang",label:hr.coupang,hasApi:!0},{id:"smartstore",label:hr.smartstore,hasApi:!0},{id:"shopify",label:hr.shopify,hasApi:!0},{id:"toss-shopping",label:hr["toss-shopping"],hasApi:!0},{id:"kurly",label:hr.kurly,hasApi:!1},{id:"ssf",label:hr.ssf,hasApi:!1},{id:"bronte",label:hr.bronte,hasApi:!1},{id:"ezadmin",label:hr.ezadmin,hasApi:!1}],sae=[{categoryId:"R",category:"매출",rows:[{id:"R1",feature:"매출액 합계",command:"report revenue",conquered:!0,dataKey:"totalRevenue"},{id:"R2",feature:"기간별 추이",command:"report --period",conquered:!0},{id:"R3",feature:"평균주문가 (AOV)",command:"report revenue",conquered:!0,dataKey:"avgOrderValue"},{id:"R4",feature:"시간대별 매출",command:"report --by hour"},{id:"R5",feature:"결제수단별 매출",command:"report --by payment"}]},{categoryId:"O",category:"주문",rows:[{id:"O1",feature:"주문 목록",command:"order list",conquered:!0,dataKey:"orderCount"},{id:"O2",feature:"주문 상태별 현황",command:"order list --status",conquered:!0,dataKey:"statusBreakdown"},{id:"O3",feature:"채널별 주문수 비교",command:"report --by channel",conquered:!0},{id:"O4",feature:"주문 상세",command:"order get"}]},{categoryId:"P",category:"상품",rows:[{id:"P1",feature:"상품 매핑/해체",command:"product rules",conquered:!0},{id:"P2",feature:"상품별 판매량/매출",command:"report --by product",conquered:!0},{id:"P3",feature:"카테고리별 판매량/매출",command:"report --by category",conquered:!0},{id:"P4",feature:"제품라인별 판매량/매출",command:"report --by productline",conquered:!0},{id:"P5",feature:"공헌이익",command:"report --metric contribution"},{id:"P6",feature:"상품 조회수 (PV)",command:"-"},{id:"P7",feature:"전환율 (CVR)",command:"-"},{id:"P8",feature:"재고 현황",command:"inventory sync"}]},{categoryId:"C",category:"고객",rows:[{id:"C1",feature:"신규/재구매 비율",command:"report --segment"},{id:"C2",feature:"고객 등급/세그먼트",command:"-"},{id:"C3",feature:"LTV/구매주기",command:"-"},{id:"C4",feature:"리뷰 분석",command:"-"}]},{categoryId:"M",category:"마케팅",rows:[{id:"M1",feature:"유입경로별 전환",command:"-"},{id:"M2",feature:"광고 캠페인 성과",command:"-"},{id:"M3",feature:"쿠폰 발급/사용",command:"coupon"},{id:"M4",feature:"키워드 검색량",command:"trend keyword"}]},{categoryId:"D",category:"배송/CS",rows:[{id:"D1",feature:"배송 리드타임",command:"order list"},{id:"D2",feature:"반품/교환율",command:"order list"},{id:"D3",feature:"CS 문의 분석",command:"-"}]},{categoryId:"S",category:"정산",rows:[{id:"S1",feature:"수수료 정책 모델링",command:"settlement calc",conquered:!0,dataKey:"commissionRate"},{id:"S2",feature:"수수료 역산/검증",command:"settlement fee-check",conquered:!0},{id:"S3",feature:"정산 스케줄 예측",command:"settlement schedule",conquered:!0},{id:"S4",feature:"채널수수료 공헌이익",command:"report --by channel --metric margin",conquered:!0,dataKey:"netRevenue"},{id:"S5",feature:"정산 상세 내역",command:"settlement list"},{id:"S6",feature:"정산-예측 대조",command:"settlement reconcile"},{id:"S7",feature:"채널간 순이익 비교",command:"settlement summary"}]}],TH={backgroundColor:"rgba(221,235,233,0.8)",color:"rgb(15 118 110)"},CH={backgroundColor:"rgba(232,236,230,0.8)",color:"rgb(20 184 166 / 0.7)"},ED={backgroundColor:"rgba(231,229,228,0.6)",color:"rgb(120 113 108)"},AH={backgroundColor:"rgba(239,68,68,0.08)",color:"rgb(239 68 68)"};function lae(r,e){if(!r||e==="-")return null;const t=e.split(" ")[0];for(const[n,a]of Object.entries(r))if(e.includes(" ")){if(n.startsWith(e))return a}else if(n.startsWith(t??""))return a;return null}function uae(r){const e=Date.now()-new Date(r).getTime(),t=Math.floor(e/6e4);if(t<1)return"방금";if(t<60)return`${t}분 전`;const n=Math.floor(t/60);if(n<24)return`${n}시간 전`;const a=Math.floor(n/24);return a<30?`${a}일 전`:`${Math.floor(a/30)}개월 전`}function jw(r){return r>=1e8?`${(r/1e8).toFixed(1)}억`:r>=1e4?`${Math.round(r/1e4)}만`:r.toLocaleString()}function cae(r,e,t){if(!r)return null;switch(r){case"orderCount":return e!=null&&e.orderCount?`${e.orderCount.toLocaleString()}건`:null;case"totalRevenue":return e!=null&&e.totalRevenue?jw(e.totalRevenue):null;case"avgOrderValue":return e!=null&&e.avgOrderValue?`${jw(e.avgOrderValue)}원`:null;case"statusBreakdown":{if(!(e!=null&&e.statusBreakdown))return null;const n=e.statusBreakdown,a=[];return n.paid&&a.push(`결제 ${n.paid}`),n.shipping&&a.push(`배송 ${n.shipping}`),n.delivered&&a.push(`완료 ${n.delivered}`),n.cancelled&&a.push(`취소 ${n.cancelled}`),a.length>0?a.join(" · "):null}case"commissionRate":return(t==null?void 0:t.avgCommissionRate)!=null?`${(t.avgCommissionRate*100).toFixed(1)}%`:null;case"netRevenue":return t!=null&&t.netRevenue?jw(t.netRevenue):null;default:return null}}function fae(r){const e=(Date.now()-new Date(r).getTime())/36e5;return e<24?TH:e<168?CH:ED}function dae({exec:r,dataLabel:e}){if(!r&&!e)return m.jsx("div",{className:"h-full flex items-center justify-center rounded-[3px] bg-muted/30",children:m.jsx("span",{className:"text-[10px] text-muted-foreground/40",children:"—"})});if(!r&&e)return m.jsx("div",{className:"h-full flex flex-col items-center justify-center rounded-[3px] px-2 py-1.5",style:ED,children:m.jsx("span",{className:"text-[11px] font-semibold leading-tight",children:e})});const t=r,a=t.result==="error"?AH:fae(t.lastRun);return m.jsxs("div",{className:"h-full flex flex-col items-center justify-center rounded-[3px] px-2 py-1.5 gap-0.5",style:a,children:[e&&m.jsx("span",{className:"text-[11px] font-semibold leading-tight",children:e}),m.jsx("span",{className:"leading-tight",style:{fontSize:e?"9px":"11px",opacity:e?.6:1,fontWeight:e?void 0:500},children:uae(t.lastRun)}),!e&&t.durationMs>0&&m.jsx("span",{className:"text-[9px] opacity-60",children:t.durationMs<1e3?`${t.durationMs}ms`:`${(t.durationMs/1e3).toFixed(1)}s`})]})}function hae({channelId:r}){const e=wH[r];if(!e)return null;const t=iae(r);return t?m.jsx("img",{src:t,alt:r,width:20,height:20,className:"shrink-0 rounded-[3px]",onError:n=>{const a=document.createElement("span");a.className="inline-flex items-center justify-center w-5 h-5 rounded-[4px] text-[8px] font-bold text-white shrink-0 leading-none",a.style.backgroundColor=e.bg,a.textContent=e.initial,n.target.replaceWith(a)}}):m.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 rounded-[4px] text-[8px] font-bold text-white shrink-0 leading-none",style:{backgroundColor:e.bg},children:e.initial})}function vae({ch:r,channelStatuses:e,onConnect:t}){const n=r.hasApi?(e??[]).find(o=>o.channel===r.id):void 0,a=(n==null?void 0:n.connected)??!1,i=a?oae(r.id,n==null?void 0:n.storeId):null;return m.jsx("th",{className:"text-center px-3 py-3.5 min-w-[155px] align-bottom",children:m.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(hae,{channelId:r.id}),m.jsx("span",{className:"font-semibold text-[13px] whitespace-nowrap",children:r.label})]}),r.hasApi&&a&&n&&m.jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[i?m.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] font-medium whitespace-nowrap hover:underline",style:{color:"hsl(var(--success))"},children:n.storeId||"연결됨"}):m.jsx("span",{className:"text-[10px] font-medium whitespace-nowrap",style:{color:"hsl(var(--success))"},children:n.storeId||"연결됨"}),(n.rateLimit!==void 0||n.webhook!==void 0)&&m.jsxs("div",{className:"text-[9px] text-muted-foreground/50 font-normal whitespace-nowrap flex items-center gap-1",children:[n.rateLimit!==void 0&&m.jsxs("span",{children:[n.rateLimit,"rps"]}),n.webhook!==void 0&&m.jsx("span",{children:n.webhook?"webhook":"polling"}),n.keyExpiry!==void 0&&n.keyExpiry<=14&&m.jsxs("span",{className:"ml-1",style:{color:"hsl(var(--warning))"},children:["⚠ ",n.keyExpiry,"d"]})]})]}),r.hasApi&&!a&&m.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(r.id),className:"flex items-center gap-1 text-[10px] text-muted-foreground/50 hover:text-primary transition-colors px-2 py-0.5 rounded border border-dashed border-border hover:border-primary whitespace-nowrap",children:[m.jsx(vee,{size:10}),"연결하기"]}),!r.hasApi&&m.jsx("span",{className:"text-[10px] text-muted-foreground/40 font-normal",children:"CSV only"})]})})}function pae({command:r}){const[e,t]=Y.useState(!1),n=Y.useCallback(()=>{navigator.clipboard.writeText(r),t(!0),setTimeout(()=>t(!1),1200)},[r]);return m.jsxs("div",{className:"flex items-center gap-1 max-w-full",children:[m.jsx(mi,{variant:"muted",className:"whitespace-nowrap overflow-hidden text-ellipsis min-w-0",children:r}),m.jsx("button",{type:"button",onClick:n,className:"shrink-0 p-0.5 rounded transition-colors text-muted-foreground/50",title:"복사",children:e?m.jsx("span",{className:"text-[9px] font-medium text-emerald-600 dark:text-emerald-400",children:"ok"}):m.jsx(nee,{size:10})})]})}const vm=60,Mb=130,ID=28,MH=180,DH=vm,NH=vm+Mb,LH=vm+Mb+ID,kH="after:absolute after:right-0 after:top-0 after:bottom-0 after:w-[6px] after:pointer-events-none after:bg-gradient-to-r after:from-black/[0.04] after:to-transparent dark:after:from-white/[0.06]",RH=r=>({width:r,minWidth:r,maxWidth:r}),Fd=(r,e)=>({width:r,minWidth:r,maxWidth:r,left:e});function gae({group:r,channels:e,ctx:t}){return m.jsx(m.Fragment,{children:r.rows.map((n,a)=>m.jsxs("tr",{style:{borderBottom:"1px solid hsl(var(--border) / 0.5)",borderTop:a===0?"2px solid hsl(var(--border))":void 0},children:[a===0&&m.jsxs("td",{rowSpan:r.rows.length,className:"px-3 py-3 align-middle text-center sticky z-20",style:{...RH(vm),left:0,backgroundColor:"hsl(var(--muted))",borderRight:"1px solid hsl(var(--border) / 0.5)"},children:[m.jsx("span",{className:"text-[9px] font-mono block mb-0.5 text-muted-foreground/40",children:r.categoryId}),m.jsx("span",{className:"text-[12px] font-bold whitespace-nowrap text-foreground/70",children:r.category})]}),m.jsxs("td",{className:"px-3 py-2 font-medium sticky z-20",style:{...Fd(Mb,DH),backgroundColor:"hsl(var(--card))",borderRight:"1px solid hsl(var(--border) / 0.5)"},children:[m.jsx("span",{className:"text-[9px] font-mono mr-1 text-muted-foreground/40",children:n.id}),n.feature]}),m.jsx("td",{className:"text-center sticky z-20",style:{...Fd(ID,NH),backgroundColor:"hsl(var(--card))",borderRight:"1px solid hsl(var(--border) / 0.5)"},children:n.conquered&&m.jsx("span",{className:"text-[13px] leading-none text-emerald-600 dark:text-emerald-400",title:"정복",children:"●"})}),m.jsx("td",{className:`px-3 py-2 sticky z-20 relative overflow-hidden ${kH}`,style:{...Fd(MH,LH),backgroundColor:"hsl(var(--card))"},children:n.command!=="-"?m.jsx(pae,{command:`sppt ${n.command}`}):m.jsx("span",{className:"text-[10px] text-muted-foreground/40",children:"-"})}),e.map(i=>{const o=lae(t.executions[i.id],n.command),s=cae(n.dataKey,t.channelData[i.id],t.settlementData[i.id]);return m.jsx("td",{className:"px-1.5 py-1 text-center min-w-[155px] bg-card",children:m.jsx(dae,{exec:o,dataLabel:s})},i.id)})]},n.feature))})}function mae({executions:r={},channelData:e={},settlementData:t={},channelStatuses:n=[],onConnect:a,isLoading:i=!1}){const[o,s]=Y.useState(""),l=Y.useMemo(()=>{if(!o.trim())return pP;const c=o.trim().toLowerCase();return pP.filter(f=>f.label.toLowerCase().includes(c)||f.id.toLowerCase().includes(c))},[o]),u={executions:r,channelData:e,settlementData:t};return i?m.jsxs("div",{children:[m.jsx("h2",{className:"text-xl font-medium mb-6",children:"채널 보드"}),m.jsx("div",{className:"text-sm text-muted-foreground",children:"로딩 중..."})]}):m.jsxs("div",{children:[m.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-4 sticky top-0 z-10 py-4 -mt-4 md:-mt-7 md:pt-7",style:{backgroundColor:"var(--page-bg, transparent)"},children:[m.jsx("h2",{className:"text-xl font-medium",children:"채널 보드"}),m.jsxs("div",{className:"relative",children:[m.jsx(wg,{size:13,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground/60"}),m.jsx("input",{type:"text",value:o,onChange:c=>s(c.target.value),placeholder:"채널 검색",className:"pl-7 pr-3 py-1.5 text-[11px] rounded-md w-[160px] focus:outline-none bg-muted/40 border border-border text-foreground"})]})]}),m.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-1.5 text-[11px] mb-3",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"inline-block px-1.5 py-0.5 rounded-[3px] text-[10px] font-medium leading-none",style:TH,children:"방금"}),m.jsx("span",{className:"text-muted-foreground",children:"24시간 이내"})]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"inline-block px-1.5 py-0.5 rounded-[3px] text-[10px] font-medium leading-none",style:CH,children:"3일 전"}),m.jsx("span",{className:"text-muted-foreground",children:"1~7일"})]}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"inline-block px-1.5 py-0.5 rounded-[3px] text-[10px] font-medium leading-none",style:ED,children:"2주 전"}),m.jsx("span",{className:"text-muted-foreground",children:"7일 이상"})]}),m.jsx("div",{className:"flex items-center gap-1.5",children:m.jsx("span",{className:"inline-block px-1.5 py-0.5 rounded-[3px] text-[10px] font-medium leading-none",style:AH,children:"실패"})}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"text-[13px] leading-none text-emerald-600 dark:text-emerald-400",children:"●"}),m.jsx("span",{className:"text-muted-foreground",children:"주요 항목"})]})]}),m.jsx("div",{className:"border border-border rounded-lg overflow-hidden",children:m.jsx("div",{className:"overflow-x-auto",children:m.jsxs("table",{className:"w-full text-[12px] border-collapse",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"text-[11px] font-semibold text-muted-foreground",style:{borderBottom:"1px solid hsl(var(--border))"},children:[m.jsx("th",{className:"text-left px-3 py-2.5 sticky z-20",style:{...RH(vm),left:0,backgroundColor:"hsl(var(--background))",borderRight:"1px solid hsl(var(--border) / 0.5)"},children:"영역"}),m.jsx("th",{className:"text-left px-3 py-2.5 sticky z-20",style:{...Fd(Mb,DH),backgroundColor:"hsl(var(--background))",borderRight:"1px solid hsl(var(--border) / 0.5)"},children:"분석 항목"}),m.jsx("th",{className:"text-center py-2.5 sticky z-20",style:{...Fd(ID,NH),backgroundColor:"hsl(var(--background))",borderRight:"1px solid hsl(var(--border) / 0.5)"},title:"핵심 정복 항목",children:m.jsx("span",{className:"text-[10px]",children:"주요"})}),m.jsx("th",{className:`text-left px-3 py-2.5 sticky z-20 relative overflow-hidden ${kH}`,style:{...Fd(MH,LH),backgroundColor:"hsl(var(--background))"},children:m.jsx("span",{className:"font-mono text-[10px]",children:"명령어"})}),l.map(c=>m.jsx(vae,{ch:c,channelStatuses:n,onConnect:a},c.id))]})}),m.jsx("tbody",{children:sae.map(c=>m.jsx(gae,{group:c,channels:l,ctx:u},c.category))})]})})})]})}const zw=5;function yae(r){return`${Math.round(r/1e4).toLocaleString()}만원`}function gP({items:r,totalRevenue:e,leftColSpan:t,totalCol:n}){const[a,i]=Y.useState(!1);if(r.length===0)return null;const o=a?r:r.slice(0,zw),s=r.length>zw;return m.jsxs(m.Fragment,{children:[m.jsx("tr",{style:{borderBottom:"1px solid hsl(var(--border) / 0.3)"},className:"bg-muted/5",children:m.jsxs("td",{colSpan:n,className:"px-4 py-1.5 text-[10px] font-semibold text-muted-foreground tracking-wide",children:["채널별 판매 상품-옵션",m.jsxs("span",{className:"font-normal ml-1.5",children:["(",r.length,"개)"]})]})}),o.map(l=>{const u=e>0?l.totalRevenue/e*100:0,c=l.totalOrderQuantity>0?Math.round(l.totalQuantity/l.totalOrderQuantity):1,f=c>1;return m.jsxs("tr",{style:{borderBottom:"1px solid hsl(var(--border) / 0.4)",backgroundColor:"hsl(var(--muted) / 0.15)"},children:[m.jsx("td",{className:"pl-8 pr-3 py-1.5 text-muted-foreground",colSpan:t,children:m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx(Tb,{channel:l.channel}),m.jsxs("div",{className:"min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{className:"text-[10px] font-medium shrink-0",children:hr[l.channel]??l.channel}),m.jsx("span",{className:"text-[11px] text-foreground/80",children:l.productName})]}),l.optionName&&m.jsx("div",{className:"text-[10px] text-muted-foreground leading-tight mt-0.5",children:l.optionName})]})]})}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:l.orderCount.toLocaleString()}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:f?m.jsxs("span",{children:[m.jsxs("span",{className:"text-[10px] text-muted-foreground/60",children:[l.totalOrderQuantity.toLocaleString(),"×",c,"="]}),l.totalQuantity.toLocaleString()]}):l.totalQuantity.toLocaleString()}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:l.totalQuantity>0?`${Math.round(l.totalRevenue/l.totalQuantity).toLocaleString()}원`:"-"}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] whitespace-nowrap",children:yae(l.totalRevenue)}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[10px] text-muted-foreground whitespace-nowrap",children:u.toFixed(1)}),m.jsx("td",{className:"px-1 py-1.5"})]},`${l.channel}|${l.channelProductId}|${l.channelProductOptionId}`)}),s&&m.jsx("tr",{style:{borderBottom:"1px solid hsl(var(--border) / 0.3)"},children:m.jsx("td",{colSpan:n,className:"px-4 py-1",children:m.jsx("button",{type:"button",onClick:()=>i(l=>!l),className:"text-[10px] cursor-pointer",style:{color:"hsl(37 97% 49%)"},children:a?"접기":`더보기 (${r.length-zw}개 남음)`})})})]})}function mP(r){return`${Math.round(r/1e4).toLocaleString()}만원`}function yP(r,e){return e>0?`${Math.round(r/e).toLocaleString()}원`:"-"}function xae(r,e){const t=e[r];return t?t.commissionRate+t.pgRate:null}function xP({channelBreakdown:r,inflowBreakdown:e=[],totalRevenue:t,defaults:n,variant:a}){const[i,o]=Y.useState(!1),s=e.length>0,l=r.length>1,u=Math.min(90,r.length*30),c=Math.max(0,Math.floor((r.length*26-u)/2)),f=()=>o(v=>!v),h=[];for(const v of r)if(h.push({type:"channel",ch:v}),v.channel==="smartstore"&&i)for(const g of e)h.push({type:"inflow",inf:g,parentRev:v.totalRevenue});return m.jsx(m.Fragment,{children:h.map((v,g)=>{const y=g===0;if(v.type==="channel"){const{ch:M}=v,D=t>0?M.totalRevenue/t*100:0,L=xae(M.channel,n),k=M.channel==="smartstore"&&s,R=hr[M.channel]??M.channel;return m.jsxs("tr",{className:Qe("border-b border-border/30 bg-muted/10 hover:bg-muted/20",k&&"cursor-pointer"),onClick:k?f:void 0,onKeyDown:k?E=>{(E.key==="Enter"||E.key===" ")&&f()}:void 0,children:[m.jsxs("td",{colSpan:a==="product"?5:void 0,className:Qe("py-1.5 text-[11px]",y&&l&&"relative z-[1]"),style:{paddingLeft:l?130:24},children:[y&&l&&m.jsx("div",{className:"absolute left-3 pointer-events-none",style:{top:c},children:m.jsx("div",{className:"pointer-events-auto",children:m.jsx(Zee,{data:r,size:u})})}),m.jsxs("div",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[k&&(i?m.jsx(cn,{size:10,className:"text-muted-foreground"}):m.jsx(qr,{size:10,className:"text-muted-foreground"})),m.jsx(Tb,{channel:M.channel}),m.jsx("span",{children:R})]})]}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:"-"}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:m.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[m.jsx("span",{children:L!=null?`${L.toFixed(1)}%`:"-"}),L!=null&&m.jsx("div",{className:"w-[28px] h-1.5 rounded-full bg-muted/30 overflow-hidden shrink-0",children:m.jsx("div",{className:"h-full rounded-full bg-amber-500/60",style:{width:`${Math.min(L/30*100,100)}%`}})})]})}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:M.orderCount.toLocaleString()}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:M.totalQuantity.toLocaleString()}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:yP(M.totalRevenue,M.totalQuantity)}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] whitespace-nowrap",children:mP(M.totalRevenue)}),m.jsx("td",{className:"px-2 py-1.5 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:D.toFixed(1)}),m.jsx("td",{className:"px-1 py-1.5",children:m.jsx("div",{className:"h-1.5 rounded-full bg-muted/30 overflow-hidden",children:m.jsx("div",{className:"h-full rounded-full",style:{width:`${D}%`,backgroundColor:ND[M.channel]??"#94a3b8",opacity:.7}})})})]},`ch-${M.channel}`)}const{inf:b,parentRev:_}=v,S=_>0?b.totalRevenue/_*100:0,T=n.smartstore,C=T?(b.inflowPath.includes("마케팅")||b.inflowPath==="마케팅링크"?T.marketingLinkCommissionRate??T.commissionRate:T.commissionRate)+T.pgRate:null;return m.jsxs("tr",{className:"border-b border-border/20 bg-muted/5 hover:bg-muted/15",children:[m.jsx("td",{colSpan:a==="product"?5:void 0,className:"py-1 text-[11px] text-muted-foreground",style:{paddingLeft:l?150:44},children:m.jsx("div",{className:"flex items-center gap-1.5 whitespace-nowrap",children:m.jsx("span",{className:"truncate max-w-[180px]",title:b.inflowPath,children:b.inflowPath})})}),m.jsx("td",{className:"px-2 py-1 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:"-"}),m.jsx("td",{className:"px-2 py-1 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:m.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[m.jsx("span",{children:C!=null?`${C.toFixed(1)}%`:"-"}),C!=null&&m.jsx("div",{className:"w-[28px] h-1 rounded-full bg-muted/30 overflow-hidden shrink-0",children:m.jsx("div",{className:"h-full rounded-full bg-amber-500/60",style:{width:`${Math.min(C/30*100,100)}%`}})})]})}),m.jsx("td",{className:"px-2 py-1 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:b.orderCount.toLocaleString()}),m.jsx("td",{className:"px-2 py-1 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:b.totalQuantity.toLocaleString()}),m.jsx("td",{className:"px-2 py-1 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:yP(b.totalRevenue,b.totalQuantity)}),m.jsx("td",{className:"px-2 py-1 text-right text-[11px] whitespace-nowrap",children:mP(b.totalRevenue)}),m.jsx("td",{className:"px-2 py-1 text-right text-[11px] text-muted-foreground whitespace-nowrap",children:S.toFixed(1)}),m.jsx("td",{className:"px-1 py-1",children:m.jsx("div",{className:"h-1.5 rounded-full bg-muted/30 overflow-hidden",children:m.jsx("div",{className:"h-full rounded-full bg-foreground/25",style:{width:`${Math.min(S,100)}%`}})})})]},`inf-${b.inflowPath}`)})})}function r0(r){return`${Math.round(r/1e4).toLocaleString()}만원`}function bP(r,e){return e>0?`${Math.round(r/e).toLocaleString()}원`:"-"}function _P(r,e){const t=new Map;for(const n of r)for(const a of n){const i=e(a),o=t.get(i);o?(o.orderCount+=a.orderCount,o.totalQuantity+=a.totalQuantity,o.totalRevenue+=a.totalRevenue):t.set(i,{...a})}return[...t.values()].sort((n,a)=>a.totalRevenue-n.totalRevenue)}function bae(r,e){const t=e[r];return t?t.commissionRate+t.pgRate:null}function SP(r,e){let t=0,n=0;for(const a of r){const i=bae(a.channel,e);i!=null&&(t+=i*a.totalRevenue,n+=a.totalRevenue)}return n>0?t/n:null}const Bw=20;function _ae({catalog:r,unmappedCount:e=0,byCategory:t=[],byLine:n=[],feeDefaults:a={},isLoading:i=!1,error:o,dateFrom:s,dateTo:l,onDateChange:u,currentUserRole:c,orderTotalRevenue:f}){const[h,v]=Y.useState(""),[g,y]=Y.useState(""),b=s!==void 0||l!==void 0,_=b?s??"":h,S=b?l??"":g,T=!!_||!!S,[C,M]=Y.useState("category"),[D,L]=Y.useState(new Set),[k,R]=Y.useState(null),[E,I]=Y.useState(new Set),[z,j]=Y.useState(new Set),G=Y.useRef(null);Y.useEffect(()=>{const ye=G.current,Xe=ye==null?void 0:ye.closest(".dashboard main");if(!ye||!Xe)return;const et=new ResizeObserver(()=>{Xe.style.setProperty("--page-header-h",`${ye.offsetHeight}px`)});return et.observe(ye),()=>et.disconnect()},[]);const U=!c||c==="admin"||c==="editor",[O,H]=Y.useState(!1),[F,$]=Y.useState(null),[B,X]=Y.useState(""),[q,Q]=Y.useState(!1),[ne,fe]=Y.useState(""),[ve,Se]=Y.useState(!1),ge=Y.useCallback(async()=>{if(O){H(!1),Q(!1);return}try{const Xe=await(await fetch("/api/product-rules")).json();$(Xe.content),X(Xe.path),H(!0)}catch{H(!0)}},[O]),he=Y.useCallback(()=>{fe(F??""),Q(!0)},[F]),Ne=Y.useCallback(async()=>{Se(!0);try{await fetch("/api/product-rules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:ne})}),$(ne),Q(!1)}finally{Se(!1)}},[ne]),xe=Y.useMemo(()=>r.filter(ye=>!(E.size>0&&!E.has(ye.category??"")||z.size>0&&!z.has(ye.productLine??""))),[r,E,z]),Te=Y.useMemo(()=>[...xe].sort((ye,Xe)=>Xe.totalRevenue-ye.totalRevenue),[xe]),$e=Y.useMemo(()=>{const ye=new Map;for(const Xe of Te){const et=`${Xe.productName}||${Xe.brand??""}||${Xe.productLine??""}`,An=ye.get(et);An?(An.skus.push(Xe),An.totalQuantity+=Xe.totalQuantity,An.totalRevenue+=Xe.totalRevenue,An.orderCount+=Xe.orderCount):ye.set(et,{key:et,productName:Xe.productName,brand:Xe.brand,productLine:Xe.productLine,category:Xe.category,skus:[Xe],totalQuantity:Xe.totalQuantity,totalRevenue:Xe.totalRevenue,orderCount:Xe.orderCount,channelBreakdown:[],inflowBreakdown:[]})}for(const Xe of ye.values())Xe.channelBreakdown=_P(Xe.skus.map(et=>et.channelBreakdown??[]),et=>et.channel),Xe.inflowBreakdown=_P(Xe.skus.map(et=>et.inflowBreakdown??[]),et=>et.inflowPath);return[...ye.values()].sort((Xe,et)=>et.totalRevenue-Xe.totalRevenue)},[Te]),We=ye=>{L(Xe=>{const et=new Set(Xe);return et.has(ye)?et.delete(ye):et.add(ye),et})};Y.useEffect(()=>vt(Bw),[E,z,_,S]);const[lt,vt]=Y.useState(Bw),Ee=Y.useMemo(()=>$e.slice(0,lt),[$e,lt]),bt=lt<$e.length,Mt=Y.useMemo(()=>r.reduce((ye,Xe)=>ye+Xe.totalQuantity,0),[r]),ar=Y.useMemo(()=>r.reduce((ye,Xe)=>ye+Xe.totalRevenue,0),[r]),Ur=Y.useMemo(()=>[...new Set(r.map(ye=>ye.category??""))].sort(),[r]),ki=Y.useMemo(()=>[...new Set(r.map(ye=>ye.productLine??""))].sort(),[r]),Ls=(ye,Xe)=>{const et=new Set(ye);return et.has(Xe)?et.delete(Xe):et.add(Xe),et},uf=E.size>0||z.size>0;function cf(ye,Xe){b||(v(ye),y(Xe)),u==null||u(ye,Xe)}if(i)return m.jsxs("div",{children:[m.jsx("h2",{className:"text-xl font-medium mb-6",children:"상품"}),m.jsx("div",{className:"text-sm py-8 text-center text-muted-foreground",children:"불러오는 중..."})]});if(o)return m.jsxs("div",{children:[m.jsx("h2",{className:"text-xl font-medium mb-6",children:"상품"}),m.jsx("div",{className:"text-sm py-8 text-center text-destructive",children:"카탈로그 조회 실패"})]});if(r.length===0&&!T)return m.jsxs("div",{children:[m.jsx("h2",{className:"text-xl font-medium mb-6",children:"상품"}),m.jsxs("div",{className:"border border-dashed border-border rounded-lg p-12 text-center text-sm text-muted-foreground",children:["상품 카탈로그가 비어있습니다.",m.jsx("div",{className:"text-[11px] mt-1",children:"sppt product parse 스킬로 상품명을 해체하세요."})]})]});const Ri=C==="category"?t:n;return m.jsxs("div",{children:[m.jsxs("div",{ref:G,className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between mb-4 sticky top-0 z-10 py-4 -mt-4 md:-mt-7 md:pt-7",style:{backgroundColor:"var(--page-bg, transparent)"},children:[m.jsx("h2",{className:"text-xl font-medium",children:"상품"}),m.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[m.jsxs("button",{type:"button",onClick:ge,className:Qe("flex items-center gap-1.5 text-[12px] px-2.5 py-1 rounded-md border cursor-pointer transition-colors",O?"border-primary bg-primary text-primary-foreground":"border-primary bg-primary text-primary-foreground hover:opacity-90"),children:[m.jsx(QO,{size:12}),"분류 규칙"]}),m.jsxs("span",{className:"text-[12px] text-muted-foreground",children:["총 ",r.length.toLocaleString(),"개 SKU"]})]})]}),m.jsx(DD,{from:_,to:S,onChange:cf,className:"mb-5"}),O&&m.jsx("dialog",{open:!0,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm",onClick:ye=>{ye.target===ye.currentTarget&&!q&&H(!1)},onKeyDown:ye=>{ye.key==="Escape"&&!q&&H(!1)},"aria-label":"분류 규칙",tabIndex:-1,children:m.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-xl w-[860px] max-w-[95vw] max-h-[80vh] flex flex-col overflow-hidden",children:[m.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border bg-muted/40 shrink-0",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(QO,{size:13,className:"text-muted-foreground"}),m.jsx("span",{className:"text-[13px] font-medium",children:"분류 규칙"}),B&&m.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:B})]}),m.jsxs("div",{className:"flex items-center gap-2",children:[U&&q?m.jsxs(m.Fragment,{children:[m.jsx("button",{type:"button",onClick:()=>Q(!1),className:"text-[11px] px-2 py-0.5 rounded border border-border text-muted-foreground hover:text-foreground cursor-pointer",children:"취소"}),m.jsx("button",{type:"button",onClick:Ne,disabled:ve,className:"text-[11px] px-2.5 py-0.5 rounded bg-primary text-primary-foreground cursor-pointer disabled:opacity-50",children:ve?"저장 중...":"저장"})]}):U?m.jsx("button",{type:"button",onClick:he,className:"text-[11px] px-2.5 py-0.5 rounded border border-border bg-secondary text-foreground hover:bg-muted cursor-pointer",children:"편집"}):null,!q&&m.jsx("button",{type:"button",onClick:()=>{H(!1),Q(!1)},className:"text-muted-foreground hover:text-foreground cursor-pointer",children:m.jsx(ql,{size:14})})]})]}),m.jsx("div",{className:"px-5 py-2 text-[11px] text-muted-foreground border-b border-border/50 bg-muted/20 shrink-0",children:"AI가 이 규칙을 바탕으로 주문 데이터의 상품명을 SKU, 카테고리, 제품라인 단위로 자동 분류합니다."}),m.jsxs("div",{className:"flex divide-x divide-border/60 flex-1 overflow-hidden",children:[m.jsx("div",{className:"flex-1 px-5 py-4 overflow-y-auto",children:q?m.jsx("textarea",{value:ne,onChange:ye=>fe(ye.target.value),className:"w-full h-full min-h-[320px] text-[11px] leading-relaxed bg-transparent outline-none resize-none font-sans text-foreground/90",placeholder:`예시:
|
|
288
288
|
|
|
289
289
|
## 카테고리 분류
|
|
290
290
|
- 프라이팬/웍: '팬', '웍' 류
|
|
@@ -296,7 +296,7 @@ Error generating stack: `+x.message+`
|
|
|
296
296
|
## SKU 옵션 분리
|
|
297
297
|
- '케이크상자 포함' / '케이크상자 없음' → 별도 SKU`,autoFocus:!0}):F?m.jsx("pre",{className:"text-[11px] leading-relaxed text-foreground/80 whitespace-pre-wrap font-sans",children:F}):m.jsxs("div",{className:"text-[12px] text-muted-foreground py-8 text-center",children:["분류 규칙이 등록되지 않았습니다.",U&&m.jsxs("div",{className:"text-[11px] mt-1",children:[m.jsx("button",{type:"button",onClick:he,className:"underline cursor-pointer",children:"여기서 직접 작성"}),"하거나 AI(e.g. Claude Code 등)에서 알려주세요."]})]})}),m.jsxs("div",{className:"w-80 shrink-0 px-5 py-4 overflow-y-auto bg-muted/10 text-[11px] text-muted-foreground space-y-5",children:[m.jsxs("div",{children:[m.jsx("div",{className:"font-semibold text-foreground/60 mb-2",children:"작성 형식"}),m.jsx("p",{className:"leading-relaxed",children:"마크다운 형식으로 자유롭게 작성합니다."})]}),m.jsxs("div",{children:[m.jsx("div",{className:"font-semibold text-foreground/60 mb-2",children:"주요 분류 항목"}),m.jsxs("ul",{className:"space-y-1.5 leading-relaxed list-disc list-inside marker:text-muted-foreground/40",children:[m.jsxs("li",{children:[m.jsx("span",{className:"text-foreground/70",children:"카테고리"})," — 상품 대분류 (예: 스킨케어, 헤어)"]}),m.jsxs("li",{children:[m.jsx("span",{className:"text-foreground/70",children:"제품라인"})," — 브랜드 내 라인명 (예: 글로우 위시)"]}),m.jsxs("li",{children:[m.jsx("span",{className:"text-foreground/70",children:"SKU"})," — 단품 식별자, 옵션 다르면 별도로"]})]})]}),m.jsxs("div",{children:[m.jsx("div",{className:"font-semibold text-foreground/60 mb-2",children:"옵션을 별도 SKU로 분리하려면?"}),m.jsx("p",{className:"leading-relaxed mb-2",children:"가격·원가가 다른 옵션(예: 선물상자 포함/없음)은 별도 SKU로 나눠야 공헌이익이 정확히 계산돼요."}),m.jsx("div",{className:"bg-muted/40 rounded p-2.5 font-mono text-[10px] leading-relaxed whitespace-pre",children:`## SKU 옵션 분리
|
|
298
298
|
- OO세트-기본: 선물상자 없음
|
|
299
|
-
- OO세트-기프트: 선물상자 포함`})]}),m.jsxs("div",{children:[m.jsx("div",{className:"font-semibold text-foreground/60 mb-2",children:"규칙 적용 방법"}),m.jsxs("p",{className:"leading-relaxed",children:["규칙 저장 후 AI에서 ",m.jsx(mi,{children:"/sppt-product-parse"})," 스킬을 실행하면 미매핑 상품명을 자동으로 분류합니다."]})]}),m.jsxs("div",{className:"pt-2 border-t border-border/40 text-[10px] space-y-1.5",children:[m.jsx("div",{className:"font-medium text-foreground/50",children:"AI로 규칙 수정하기"}),m.jsxs("p",{className:"leading-relaxed text-muted-foreground/80",children:["AI가 규칙 파일을 작성한 뒤"," ",m.jsx(mi,{children:"sppt product rules set <file>"})," 을 실행하면 이 화면과 클라우드가 동시에 업데이트됩니다."]})]})]})]})]})}),m.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-4",children:[m.jsx(bn,{label:"카탈로그 SKU",value:r.length.toLocaleString()}),m.jsx(bn,{label:"미매핑 상품",value:e,warn:e>0}),m.jsx(bn,{label:"총 판매 수량",value:Mt.toLocaleString(),sub:"개",tooltip:m.jsx(sr,{metric:"판매수량",rows:lr.판매수량,summary:"주문수량 × 구성품수 합계"})}),m.jsxs("div",{className:"relative",children:[m.jsx(bn,{label:"총 상품매출",value:r0(ar),sub:f!=null&&Math.abs(f-ar)>1e3?`(매출 ${r0(f)})`:void 0}),m.jsx("span",{className:"absolute top-3 right-3",children:m.jsx(Zt,{size:12,contentClassName:"max-w-[340px]",content:m.jsxs("div",{className:"space-y-2",children:[m.jsx("div",{className:"text-[10px] font-semibold pb-1 border-b border-border/50",children:"상품매출 vs 매출"}),m.jsxs("table",{className:"w-full text-[10px]",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border/50",children:[m.jsx("th",{className:"text-left py-0.5 pr-2",children:"포함 항목"}),m.jsx("th",{className:"text-center py-0.5 px-1",children:"상품매출"}),m.jsx("th",{className:"text-center py-0.5 px-1",children:"매출"})]})}),m.jsxs("tbody",{children:[m.jsxs("tr",{children:[m.jsx("td",{className:"py-0.5 pr-2",children:"상품금액 (단가×수량)"}),m.jsx("td",{className:"text-center text-emerald-600 dark:text-emerald-400",children:"O"}),m.jsx("td",{className:"text-center text-emerald-600 dark:text-emerald-400",children:"O"})]}),m.jsxs("tr",{children:[m.jsx("td",{className:"py-0.5 pr-2",children:"배송비"}),m.jsx("td",{className:"text-center text-red-400",children:"X"}),m.jsx("td",{className:"text-center text-emerald-600 dark:text-emerald-400",children:"O"})]}),m.jsxs("tr",{children:[m.jsx("td",{className:"py-0.5 pr-2",children:"쿠폰·포인트 할인"}),m.jsx("td",{className:"text-center text-red-400",children:"X"}),m.jsx("td",{className:"text-center text-emerald-600 dark:text-emerald-400",children:"O (차감)"})]}),m.jsxs("tr",{children:[m.jsx("td",{className:"py-0.5 pr-2",children:"미정산 주문"}),m.jsx("td",{className:"text-center text-emerald-600 dark:text-emerald-400",children:"O"}),m.jsx("td",{className:"text-center text-emerald-600 dark:text-emerald-400",children:"O"})]}),m.jsxs("tr",{children:[m.jsx("td",{className:"py-0.5 pr-2",children:"구성품 비례배분 반올림"}),m.jsx("td",{className:"text-center",children:"누적"}),m.jsx("td",{className:"text-center",children:"없음"})]})]})]})]})})})]})]}),m.jsxs("div",{className:"border border-border/50 rounded-lg bg-muted/10 px-4 py-3 mb-6 text-[11px] text-muted-foreground space-y-1.5",children:[m.jsxs("div",{className:"flex gap-6",children:[m.jsx("span",{className:"shrink-0 font-medium text-foreground/50 w-16",children:"상품 분류"}),m.jsxs("span",{children:["위 ",m.jsx("span",{className:"text-foreground/70 font-medium",children:"분류 규칙"})," 버튼에서 규칙을 작성해두면, ",m.jsx(mi,{children:"/sppt-product-parse"})," 스킬로 미매핑 상품명을 자동 분류해 상품 목록이 구축됩니다."]})]}),m.jsxs("div",{className:"flex gap-6",children:[m.jsx("span",{className:"shrink-0 font-medium text-foreground/50 w-16",children:"원가 등록"}),m.jsxs("span",{children:["매입단가·택배비 등이 담긴 엑셀 파일을 AI에 붙여넣으면,"," ",m.jsx(mi,{children:"/sppt-cost-calc"})," 스킬로 원가를 등록하고 단품 기준 공헌이익을 계산합니다."]})]})]}),m.jsxs("div",{className:"flex items-center justify-between mb-4",children:[m.jsx("span",{className:"text-[13px] font-medium",children:"판매요약"}),m.jsx("div",{className:"flex items-center gap-2",children:["category","line"].map(ye=>m.jsx("button",{type:"button",onClick:()=>M(ye),className:"text-[12px] px-3 py-1.5 rounded-md border transition-colors cursor-pointer",style:C===ye?{borderColor:"hsl(37 97% 49% / 0.4)",backgroundColor:"hsl(37 97% 49% / 0.05)",fontWeight:500}:{borderColor:"hsl(var(--border))",backgroundColor:"hsl(var(--card))",color:"hsl(var(--muted-foreground))"},children:ye==="category"?"카테고리별":"제품라인별"},ye))})]}),m.jsxs(vo,{className:"mb-6",minWidth:"600px",stickyHeader:!0,children:[m.jsxs(po,{children:[m.jsx(je,{children:C==="category"?"카테고리":"제품라인"}),m.jsx(je,{align:"right",children:"원가"}),m.jsx(je,{align:"right",children:"수수료율"}),m.jsx(je,{align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-0.5",children:["주문수",m.jsx(Zt,{content:m.jsx(sr,{metric:"주문",rows:lr.주문,summary:"취소·반품·미결제 제외 주문 건수"})})]})}),m.jsx(je,{align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-0.5",children:["수량",m.jsx(Zt,{content:m.jsx(sr,{metric:"판매수량",rows:lr.판매수량,summary:"주문수량 × 구성품수 합계"})})]})}),m.jsx(je,{align:"right",children:"판매단가"}),m.jsx(je,{align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-0.5",children:["매출",m.jsx(Zt,{content:m.jsx(sr,{metric:"상품매출",rows:lr.상품매출,summary:"상품 단가 × 수량 합산"})})]})}),m.jsx(je,{align:"right",className:"w-[52px]",children:"비중(%)"}),m.jsx(je,{className:"px-1 w-[56px]"})]}),m.jsx("tbody",{className:"bg-card",children:Ri.map((ye,Xe)=>{const et=C==="category"?ye.category:ye.productLine,An=ar>0?ye.totalRevenue/ar*100:0,Xn=`${C}-${et}`,qn=k===Xn,mr=ye.channelBreakdown??[],Me=SP(mr,a);return m.jsxs(Y.Fragment,{children:[m.jsxs("tr",{className:"cursor-pointer transition-colors",style:{borderBottom:"1px solid hsl(var(--border) / 0.6)",backgroundColor:qn?"hsl(37 97% 49% / 0.05)":Xe%2!==0?"hsl(var(--muted) / 0.05)":void 0},onClick:()=>R(qn?null:Xn),onKeyDown:wt=>{(wt.key==="Enter"||wt.key===" ")&&R(qn?null:Xn)},children:[m.jsx("td",{className:"px-3 py-2",children:m.jsxs("div",{className:"flex items-center gap-1",children:[qn?m.jsx(cn,{size:11,className:"text-muted-foreground"}):m.jsx(qr,{size:11,className:"text-muted-foreground"}),et||"(미분류)"]})}),m.jsx("td",{className:"px-3 py-2 text-right text-muted-foreground",children:"-"}),m.jsx("td",{className:"px-3 py-2 text-right text-muted-foreground",children:m.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[m.jsx("span",{children:Me!=null?`${Me.toFixed(1)}%`:"-"}),Me!=null&&m.jsx("div",{className:"w-[28px] h-1.5 rounded-full overflow-hidden shrink-0 bg-muted",children:m.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.min(Me/30*100,100)}%`,backgroundColor:"rgb(245 158 11 / 0.6)"}})})]})}),m.jsx("td",{className:"px-3 py-2 text-right",children:ye.orderCount.toLocaleString()}),m.jsx("td",{className:"px-3 py-2 text-right",children:ye.totalQuantity.toLocaleString()}),m.jsx("td",{className:"px-3 py-2 text-right text-muted-foreground",children:bP(ye.totalRevenue,ye.totalQuantity)}),m.jsx("td",{className:"px-3 py-2 text-right",children:r0(ye.totalRevenue)}),m.jsx("td",{className:"px-3 py-2 text-right",children:An.toFixed(1)}),m.jsx("td",{className:"px-1 py-2",children:m.jsx("div",{className:"h-2 rounded-full overflow-hidden bg-muted",children:m.jsx("div",{className:"h-full rounded-full",style:{width:`${An}%`,backgroundColor:"hsl(37 97% 49% / 0.6)"}})})})]}),qn&&mr.length>0&&m.jsx(xP,{channelBreakdown:mr,inflowBreakdown:ye.inflowBreakdown,totalRevenue:ye.totalRevenue,defaults:a,variant:"summary"}),qn&&(()=>{const Mr=r.filter(mt=>C==="category"?(mt.category||"미분류")===et:(mt.productLine||"미분류")===et).flatMap(mt=>mt.channelOptionBreakdown??[]).reduce((mt,Dr)=>{const Pm=`${Dr.channel}|${Dr.channelProductId}|${Dr.channelProductOptionId}`,ks=mt.find(cu=>`${cu.channel}|${cu.channelProductId}|${cu.channelProductOptionId}`===Pm);return ks?(ks.orderCount+=Dr.orderCount,ks.totalOrderQuantity+=Dr.totalOrderQuantity,ks.totalQuantity+=Dr.totalQuantity,ks.totalRevenue+=Dr.totalRevenue):mt.push({...Dr}),mt},[]).sort((mt,Dr)=>Dr.totalRevenue-mt.totalRevenue);return m.jsx(gP,{items:Mr,totalRevenue:ye.totalRevenue,leftColSpan:3,totalCol:9})})()]},Xn)})})]}),m.jsxs("div",{className:"flex items-center justify-between mb-3",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-[12px] font-medium",children:"상품 목록"}),m.jsx(Jx,{label:"카테고리",options:Ur,selected:E,onToggle:ye=>I(Ls(E,ye)),onClear:()=>I(new Set)}),m.jsx(Jx,{label:"제품라인",options:ki,selected:z,onToggle:ye=>j(Ls(z,ye)),onClear:()=>j(new Set)}),uf&&m.jsxs(m.Fragment,{children:[m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[$e.length,"개 상품"]}),m.jsxs("button",{type:"button",onClick:()=>{I(new Set),j(new Set)},className:"text-[11px] text-muted-foreground flex items-center gap-0.5 cursor-pointer",children:[m.jsx(ql,{size:11})," 초기화"]})]})]}),m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[$e.length,"개 상품 · ",Te.length,"개 품목"]})]}),m.jsxs(vo,{minWidth:"760px",stickyHeader:!0,className:bt?"rounded-b-none":void 0,children:[m.jsxs(po,{children:[m.jsx(je,{className:"px-2",children:"상품명"}),m.jsx(je,{className:"px-2",children:"브랜드"}),m.jsx(je,{className:"px-2",children:"제품라인"}),m.jsx(je,{className:"px-2",children:"카테고리"}),m.jsx(je,{className:"px-2",align:"right",children:"SKU수"}),m.jsx(je,{className:"px-2",align:"right",children:"원가"}),m.jsx(je,{className:"px-2",align:"right",children:"수수료율"}),m.jsx(je,{className:"px-2",align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-0.5",children:["주문수",m.jsx(Zt,{content:m.jsx(sr,{metric:"주문",rows:lr.주문,summary:"취소·반품·미결제 제외 주문 건수"})})]})}),m.jsx(je,{className:"px-2",align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-0.5",children:["수량",m.jsx(Zt,{content:m.jsx(sr,{metric:"판매수량",rows:lr.판매수량,summary:"주문수량 × 구성품수 합계"})})]})}),m.jsx(je,{className:"px-2",align:"right",children:"판매단가"}),m.jsx(je,{className:"px-2",align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-0.5",children:["매출",m.jsx(Zt,{content:m.jsx(sr,{metric:"상품매출",rows:lr.상품매출,summary:"상품 단가 × 수량 합산"})})]})}),m.jsx(je,{className:"px-2 w-[52px]",align:"right",children:"비중(%)"}),m.jsx(je,{className:"px-1 w-[56px]"})]}),m.jsxs("tbody",{className:"bg-card",children:[Ee.map((ye,Xe)=>{const et=D.has(ye.key),An=ar>0?ye.totalRevenue/ar*100:0,Xn=SP(ye.channelBreakdown,a),qn=et?ye.skus.flatMap(mr=>mr.channelOptionBreakdown??[]).reduce((mr,Me)=>{const wt=`${Me.channel}|${Me.channelProductId}|${Me.channelProductOptionId}`,Mr=mr.find(mt=>`${mt.channel}|${mt.channelProductId}|${mt.channelProductOptionId}`===wt);return Mr?(Mr.orderCount+=Me.orderCount,Mr.totalOrderQuantity+=Me.totalOrderQuantity,Mr.totalQuantity+=Me.totalQuantity,Mr.totalRevenue+=Me.totalRevenue):mr.push({...Me}),mr},[]).sort((mr,Me)=>Me.totalRevenue-mr.totalRevenue):[];return m.jsxs(Y.Fragment,{children:[m.jsxs("tr",{className:"cursor-pointer transition-colors",style:{borderBottom:"1px solid hsl(var(--border) / 0.6)",backgroundColor:et?"hsl(37 97% 49% / 0.05)":Xe%2!==0?"hsl(var(--muted) / 0.05)":void 0},onClick:()=>We(ye.key),onKeyDown:mr=>{(mr.key==="Enter"||mr.key===" ")&&We(ye.key)},children:[m.jsx("td",{className:"px-2 py-2 font-medium max-w-[260px]",title:ye.productName,children:m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("span",{className:"shrink-0 text-muted-foreground/60",children:et?m.jsx(cn,{size:13}):m.jsx(qr,{size:13})}),m.jsx("span",{className:"truncate",children:ye.productName})]})}),m.jsx("td",{className:"px-2 py-2 text-muted-foreground whitespace-nowrap",children:ye.brand??"-"}),m.jsx("td",{className:"px-2 py-2 text-muted-foreground whitespace-nowrap",children:ye.productLine||"(미분류)"}),m.jsx("td",{className:"px-2 py-2 text-muted-foreground whitespace-nowrap",children:ye.category||"(미분류)"}),m.jsx("td",{className:"px-2 py-2 text-right whitespace-nowrap text-muted-foreground",children:ye.skus.length}),m.jsx("td",{className:"px-2 py-2 text-right whitespace-nowrap text-muted-foreground",children:"-"}),m.jsx("td",{className:"px-2 py-2 text-right whitespace-nowrap text-muted-foreground",children:m.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[m.jsx("span",{children:Xn!=null?`${Xn.toFixed(1)}%`:"-"}),Xn!=null&&m.jsx("div",{className:"w-[28px] h-1.5 rounded-full overflow-hidden shrink-0 bg-muted",children:m.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.min(Xn/30*100,100)}%`,backgroundColor:"rgb(245 158 11 / 0.6)"}})})]})}),m.jsx("td",{className:"px-2 py-2 text-right whitespace-nowrap",children:ye.orderCount.toLocaleString()}),m.jsx("td",{className:"px-2 py-2 text-right whitespace-nowrap",children:ye.totalQuantity.toLocaleString()}),m.jsx("td",{className:"px-2 py-2 text-right whitespace-nowrap text-muted-foreground",children:bP(ye.totalRevenue,ye.totalQuantity)}),m.jsx("td",{className:"px-2 py-2 text-right whitespace-nowrap font-medium",children:r0(ye.totalRevenue)}),m.jsx("td",{className:"px-2 py-2 text-right whitespace-nowrap text-muted-foreground",children:An.toFixed(1)}),m.jsx("td",{className:"px-1 py-2",children:m.jsx("div",{className:"h-2 rounded-full overflow-hidden bg-muted",children:m.jsx("div",{className:"h-full rounded-full",style:{width:`${An}%`,backgroundColor:"hsl(37 97% 49% / 0.6)"}})})})]}),et&&ye.channelBreakdown.length>=1&&m.jsx("tr",{style:{borderBottom:"1px solid hsl(var(--border) / 0.3)"},className:"bg-muted/5",children:m.jsx("td",{colSpan:13,className:"px-4 py-1.5 text-[10px] font-semibold text-muted-foreground tracking-wide",children:"채널별 판매현황"})}),et&&ye.channelBreakdown.length>=1&&m.jsx(xP,{channelBreakdown:ye.channelBreakdown,inflowBreakdown:ye.inflowBreakdown,totalRevenue:ye.totalRevenue,defaults:a,variant:"product"}),et&&qn.length>0&&m.jsx(gP,{items:qn,totalRevenue:ye.totalRevenue,leftColSpan:7,totalCol:13})]},ye.key)}),$e.length===0&&m.jsx("tr",{children:m.jsx("td",{colSpan:13,className:"px-3 py-8 text-center text-[13px] text-muted-foreground",children:"필터 조건에 맞는 상품이 없습니다."})})]})]}),bt&&m.jsx("div",{className:"border border-border border-t-0 rounded-b-lg px-4 py-3 text-center",children:m.jsxs("button",{type:"button",onClick:()=>vt(ye=>ye+Bw),className:"text-[12px] font-medium cursor-pointer",style:{color:"hsl(37 97% 49%)"},children:["더보기 (",$e.length-lt,"개 남음)"]})})]})}function Sae(r){if(!(r!=null&&r.length))return null;const e=r.map(t=>t.lastSyncedAt?new Date(t.lastSyncedAt).getTime():0).filter(Boolean).sort((t,n)=>n-t)[0];return e?new Date(e).toISOString():null}function al(r,e){return e?Math.round((r-e)/e*100):null}function wP(r){return r===null?"-":r>=0?`+${r}%`:`${r}%`}function wae({connected:r}){return m.jsx("span",{className:Qe("inline-block w-2 h-2 rounded-full shrink-0",r?"bg-green-500":"bg-muted-foreground/40")})}function Tae({log:r}){return m.jsxs("div",{className:"flex items-start gap-3 py-1.5 last:border-0",style:{borderBottom:"1px solid hsl(var(--border) / 0.5)"},children:[m.jsx("span",{className:"text-[11px] font-mono shrink-0 pt-px text-muted-foreground",children:r.time}),m.jsx("span",{className:"text-[11px] shrink-0 w-[88px] truncate text-muted-foreground/70",children:r.channel}),m.jsx("span",{className:"text-[12px] text-foreground",children:r.message})]})}function Cae({byStatus:r={},totalOrders:e=0,totalRevenue:t=0,recentActivity:n=[],channels:a=[],periodStats:i,weeklyStats:o,settlement:s=[],byChannel:l=[],totalImportedOrders:u,totalImportedRevenue:c,catalog:f,catalogLoading:h=!1,isLoading:v=!1,syncing:g=!1,syncResult:y,timeLeft:b,onSync:_,syncDisabled:S=!1,actionNeeded:T=0,onActionNeededClick:C,onUnmappedClick:M,onConnectChannel:D,onChannelSettingsClick:L,channelFaviconOverrides:k,WeeklyLineChartComponent:R,headerExtra:E,belowHeader:I}){var We,lt,vt,Ee,bt,Mt,ar,Ur,ki,Ls,uf,cf,Ri,ye,Xe,et,An,Xn,qn,mr;const[z,j]=Y.useState("product"),[G,U]=Y.useState("revenue"),O=Tg(Sae(a)),H=y??(O?`마지막 동기화: ${O}`:null),F=new Date(Date.now()+540*60*1e3),$=F.getUTCDate(),B=F.getUTCMonth(),X=F.getUTCFullYear(),q=new Date(Date.UTC(X,B,0)).getUTCDate(),Q=new Date(Date.UTC(X-1,B+1,0)).getUTCDate(),ne=al(((We=i==null?void 0:i.thisMonth)==null?void 0:We.revenue)??0,(((lt=i==null?void 0:i.lastMonth)==null?void 0:lt.revenue)??0)*$/q),fe=al(((vt=i==null?void 0:i.thisMonth)==null?void 0:vt.count)??0,(((Ee=i==null?void 0:i.lastMonth)==null?void 0:Ee.count)??0)*$/q),ve=al(((bt=i==null?void 0:i.thisMonth)==null?void 0:bt.revenue)??0,(((Mt=i==null?void 0:i.lastYearSameMonth)==null?void 0:Mt.revenue)??0)*$/Q),Se=al(((ar=i==null?void 0:i.thisMonth)==null?void 0:ar.count)??0,(((Ur=i==null?void 0:i.lastYearSameMonth)==null?void 0:Ur.count)??0)*$/Q),ge=!!(i!=null&&i.last7d&&(i!=null&&i.prev7d)),he=ge?al(((ki=i==null?void 0:i.last7d)==null?void 0:ki.count)??0,((Ls=i==null?void 0:i.prev7d)==null?void 0:Ls.count)??0):al(((uf=i==null?void 0:i.thisWeek)==null?void 0:uf.count)??0,((cf=i==null?void 0:i.lastWeek)==null?void 0:cf.count)??0),Ne=ge?al(((Ri=i==null?void 0:i.last7d)==null?void 0:Ri.revenue)??0,((ye=i==null?void 0:i.prev7d)==null?void 0:ye.revenue)??0):al(((Xe=i==null?void 0:i.thisWeek)==null?void 0:Xe.revenue)??0,((et=i==null?void 0:i.lastWeek)==null?void 0:et.revenue)??0),xe=ge?"최근 7일":"이번주",Te=(An=o==null?void 0:o.thisYear)!=null&&An.length?Math.max(...o.thisYear.map(Me=>Me.week)):void 0,$e=Math.max(...s.map(Me=>Me.netRevenue??0),1);return v?m.jsxs("div",{children:[m.jsx("h2",{className:"text-xl font-medium mb-6",children:"Overview"}),m.jsx("div",{className:"text-sm text-muted-foreground",children:"로딩 중..."})]}):m.jsxs("div",{children:[m.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-6 sticky top-0 z-10 py-4 -mt-4 md:-mt-7 md:pt-7",style:{backgroundColor:"var(--page-bg, transparent)"},children:[m.jsx("h2",{className:"text-xl font-medium",children:"Overview"}),m.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[E,H&&m.jsx("span",{className:"text-[11px] text-muted-foreground",children:H}),_&&m.jsx(e1,{onSync:_,syncing:g,syncResult:y,timeLeft:b,disabled:S})]})]}),I,m.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3 mb-6",children:[m.jsx(bn,{label:"오늘 주문",value:((Xn=i==null?void 0:i.today)==null?void 0:Xn.count)??"-",sub:"건",tooltip:m.jsx(sr,{metric:"주문",rows:lr.주문,summary:"오늘(KST) 주문 건수"})}),m.jsx(bn,{label:"미매핑 상품",value:(f==null?void 0:f.unmappedCount)??0,sub:"분류 안 된 주문 상품",highlight:((f==null?void 0:f.unmappedCount)??0)>0,onClick:M}),m.jsx(bn,{label:"이번 달 매출",value:i?`${Math.round((((qn=i.thisMonth)==null?void 0:qn.revenue)??0)/1e4).toLocaleString()}만`:t>0?`${Math.round(t/1e4).toLocaleString()}만`:"-",sub:ne!==null?`전월비 ${wP(ne)}`:"전월 데이터 없음",highlight:ne!==null&&ne>0,tooltip:m.jsx(sr,{metric:"매출",rows:lr.매출,summary:"이번 달(KST) 최종 결제 금액 합계"})}),m.jsx(bn,{label:"이번 달 주문",value:((mr=i==null?void 0:i.thisMonth)==null?void 0:mr.count)??e,sub:"건",tooltip:m.jsx(sr,{metric:"주문",rows:lr.주문,summary:"이번 달(KST) 주문 건수"})}),m.jsx(bn,{label:"누적 주문",value:(u??e).toLocaleString(),sub:"건",tooltip:m.jsx(sr,{metric:"주문",rows:lr.주문,summary:"전체 기간 주문 건수"})}),m.jsx(bn,{label:"누적 매출",value:`${Math.round((c??t)/1e4).toLocaleString()}만원`,tooltip:m.jsx(sr,{metric:"매출",rows:lr.매출,summary:"전체 기간 최종 결제 금액 합계"})})]}),m.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-6",children:[m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-medium",children:[m.jsx(Qx,{size:13}),"판매채널",L&&m.jsx("button",{type:"button",onClick:L,className:"ml-auto text-muted-foreground/50 hover:text-muted-foreground transition-colors cursor-pointer",children:m.jsx(aH,{size:13})})]}),m.jsx("div",{className:"text-[10px] text-muted-foreground/60 mb-3",children:"API 연결 상태"}),m.jsx("div",{className:"space-y-1.5 mb-3",children:a.map(Me=>m.jsxs("div",{className:"flex items-center gap-2 text-[12px]",children:[m.jsx(wae,{connected:Me.connected}),m.jsx(Jy,{channel:Me.channel,size:13,overrides:k}),m.jsx("span",{children:hr[Me.channel]??Me.channel}),Me.connected?m.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:Me.storeId}):D?m.jsx("button",{type:"button",onClick:()=>D(Me.channel),className:"ml-auto text-[11px] text-primary/60 hover:text-primary transition-colors cursor-pointer",children:"연결하기 →"}):m.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"미연결"})]},Me.channel))})]}),m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-medium",children:[m.jsx(Sg,{size:13}),"채널별 주문",m.jsx(Zt,{size:11,content:m.jsx(sr,{metric:"주문",rows:lr.주문,summary:"채널별 주문 건수"})})]}),m.jsx("div",{className:"text-[10px] text-muted-foreground/60 mb-3",children:"취소·반품·미결제 제외"}),l.length>0?(()=>{const Me=Math.max(...l.map(wt=>wt.count),1);return m.jsx("div",{className:"space-y-2",children:[...l].sort((wt,Mr)=>Mr.count-wt.count).map(wt=>m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs("span",{className:"flex items-center gap-1 text-[11px] w-[80px] shrink-0 truncate",children:[m.jsx(Jy,{channel:wt.channel,size:12,overrides:k}),hr[wt.channel]??wt.channel]}),m.jsx("div",{className:"flex-1 min-w-0",children:m.jsx("div",{className:"w-full bg-muted rounded-full h-1.5",children:m.jsx("div",{className:"h-full bg-primary/50 rounded-full",style:{width:`${wt.count/Me*100}%`}})})}),m.jsx("span",{className:"text-[11px] text-muted-foreground shrink-0 w-8 text-right",children:wt.count.toLocaleString()})]},wt.channel))})})():m.jsx("div",{className:"text-[12px] text-muted-foreground",children:"데이터 없음"})]}),m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4 flex flex-col gap-3",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-medium",children:[m.jsx(jee,{size:13}),"AI에게 물어보기"]}),m.jsxs("div",{className:"space-y-1.5 text-[11.5px] text-muted-foreground leading-snug",children:[m.jsxs("p",{className:"flex items-center gap-1 flex-wrap",children:[m.jsxs("span",{className:"inline-flex items-center gap-0.5",children:[m.jsx("img",{src:"https://www.google.com/s2/favicons?domain=claude.ai&sz=32",alt:"",className:"w-[13px] h-[13px] rounded-[3px]"}),m.jsx(mi,{variant:"muted",children:"claude"})]}),", ",m.jsxs("span",{className:"inline-flex items-center gap-0.5",children:[m.jsx("img",{src:"https://www.google.com/s2/favicons?domain=openai.com&sz=32",alt:"",className:"w-[13px] h-[13px] rounded-[3px]"}),m.jsx(mi,{variant:"muted",children:"codex"})]})," 에게 운영 고민을 물어보세요"]}),m.jsxs("p",{children:[m.jsx(mi,{variant:"muted",children:"/sppt"})," 를 입력하면 사용 가능한 스킬 목록이 나와요"]})]}),m.jsx("div",{className:"flex flex-col gap-2 pt-0.5",children:[{cmd:"/sppt-daily-report",desc:"오늘 매출 브리핑해줘"},{cmd:"/sppt-weekly-analysis",desc:"이번 주 매출 분석해줘"}].map(({cmd:Me,desc:wt})=>m.jsx("div",{className:"text-[11.5px] leading-snug",children:m.jsxs("div",{className:"bg-primary/10 border border-primary/20 rounded-tl-xl rounded-tr-xl rounded-br-xl px-3 py-1.5 inline-block max-w-full",children:[m.jsx(mi,{className:"font-semibold",children:Me}),m.jsxs("span",{className:"text-foreground/70",children:[" ",wt]})]})},Me))})]})]}),m.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_2fr_1fr] gap-4 mb-6",children:[m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4",children:[m.jsxs("div",{className:"flex items-center justify-between mb-3",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-medium",children:[m.jsx(Sg,{size:13}),"상품매출 랭킹",m.jsx(Zt,{size:11,content:m.jsx(sr,{metric:"상품매출",rows:lr.상품매출,summary:"상품 단가 × 수량 합산"})})]}),m.jsx("div",{className:"flex gap-0.5",children:["product","category","line"].map(Me=>m.jsx("button",{type:"button",onClick:()=>j(Me),className:Qe("text-[10px] px-1.5 py-0.5 rounded transition-colors",z===Me?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:Me==="product"?"상품":Me==="category"?"카테고리":"제품라인"},Me))})]}),h?m.jsx("div",{className:"text-[11px] text-muted-foreground",children:"로딩 중..."}):(()=>{var Mr;let Me=[];if(z==="product"?Me=[...(f==null?void 0:f.catalog)??[]].sort((mt,Dr)=>Dr.totalRevenue-mt.totalRevenue).slice(0,8).map(mt=>({key:mt.productName,label:mt.productName,totalRevenue:mt.totalRevenue})):z==="category"?Me=[...(f==null?void 0:f.byCategory)??[]].sort((mt,Dr)=>Dr.totalRevenue-mt.totalRevenue).slice(0,8).map(mt=>({key:mt.category,label:mt.category||"미분류",totalRevenue:mt.totalRevenue})):Me=[...(f==null?void 0:f.byLine)??[]].sort((mt,Dr)=>Dr.totalRevenue-mt.totalRevenue).slice(0,8).map(mt=>({key:mt.productLine,label:mt.productLine||"미분류",totalRevenue:mt.totalRevenue})),Me.length===0)return m.jsx("div",{className:"text-[11px] text-muted-foreground",children:"데이터 없음"});const wt=((Mr=Me[0])==null?void 0:Mr.totalRevenue)??1;return m.jsx("div",{className:"space-y-2",children:Me.map((mt,Dr)=>m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-[10px] text-muted-foreground w-3 text-right shrink-0",children:Dr+1}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[m.jsx("span",{className:"text-[11px] truncate",children:mt.label}),m.jsxs("span",{className:"text-[10px] text-muted-foreground ml-1 shrink-0",children:[Math.round(mt.totalRevenue/1e4).toLocaleString(),"만"]})]}),m.jsx("div",{className:"w-full bg-muted rounded-full h-1",children:m.jsx("div",{className:"h-full bg-primary/50 rounded-full",style:{width:`${mt.totalRevenue/wt*100}%`}})})]})]},mt.key||Dr))})})()]}),s.length>0?m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-medium mb-3",children:["채널별 정산 현황",m.jsx(Zt,{size:11,content:m.jsx(sr,{metric:"정산매출",rows:lr.정산매출,summary:"정산 완료 주문의 grossAmount 합계"})})]}),m.jsxs("table",{className:"w-full text-[12px]",style:{borderCollapse:"collapse"},children:[m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border",children:[m.jsx("th",{className:"py-1.5 text-left text-[11px] font-semibold text-muted-foreground",children:"채널"}),m.jsx("th",{className:"py-1.5 text-right text-[11px] font-semibold text-muted-foreground",children:"주문"}),m.jsx("th",{className:"py-1.5 text-right text-[11px] font-semibold text-muted-foreground",children:"매출"}),m.jsx("th",{className:"py-1.5 text-right text-[11px] font-semibold text-muted-foreground",children:"수수료율"}),m.jsx("th",{className:"py-1.5 text-right text-[11px] font-semibold text-muted-foreground",children:"순수익"})]})}),m.jsx("tbody",{children:s.map(Me=>m.jsxs("tr",{className:"border-b border-border/50",children:[m.jsx("td",{className:"py-1.5",children:m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx(Jy,{channel:Me.channel,size:13,overrides:k}),hr[Me.channel]??Me.channel]})}),m.jsx("td",{className:"py-1.5 text-right text-muted-foreground",children:Me.orderCount.toLocaleString()}),m.jsxs("td",{className:"py-1.5 text-right font-medium",children:[Math.round(Me.totalRevenue/1e4).toLocaleString(),"만"]}),m.jsx("td",{className:"py-1.5 text-right text-muted-foreground",children:Me.avgCommissionRate!=null?`${(Me.avgCommissionRate*100).toFixed(1)}%`:"-"}),m.jsx("td",{className:"py-1.5 text-right font-medium text-emerald-600 dark:text-emerald-400",children:Me.netRevenue!=null?`${Math.round(Me.netRevenue/1e4).toLocaleString()}만`:"-"})]},Me.channel))})]})]}):m.jsx("div",{className:"border border-border rounded-lg bg-card p-4 flex items-center justify-center text-[12px] text-muted-foreground",children:"정산 데이터 없음"}),m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4",children:[m.jsxs("div",{className:"flex items-center gap-1.5 mb-3 text-[12px] font-medium",children:[m.jsx(WJ,{size:13}),"공헌이익 순위",m.jsx(Zt,{size:11,content:m.jsx(sr,{metric:"공헌이익",rows:lr.공헌이익,summary:"순수익 - 총변동비"})})]}),s.length>0?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"space-y-2",children:[...s].filter(Me=>Me.netRevenue!=null).sort((Me,wt)=>(wt.netRevenue??0)-(Me.netRevenue??0)).slice(0,8).map((Me,wt)=>{const Mr=(Me.netRevenue??0)/$e*100;return m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-[10px] text-muted-foreground w-3 text-right shrink-0",children:wt+1}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[m.jsxs("span",{className:"flex items-center gap-1 text-[11px] truncate",children:[m.jsx(Jy,{channel:Me.channel,size:12,overrides:k}),hr[Me.channel]??Me.channel]}),m.jsxs("span",{className:"text-[10px] text-emerald-600 dark:text-emerald-400 ml-1 shrink-0",children:[Math.round((Me.netRevenue??0)/1e4).toLocaleString(),"만"]})]}),m.jsx("div",{className:"w-full bg-muted rounded-full h-1",children:m.jsx("div",{className:"h-full rounded-full bg-emerald-500/50",style:{width:`${Mr}%`}})})]})]},Me.channel)})}),m.jsx("div",{className:"mt-2 text-[10px] text-muted-foreground/60 border-t border-border/50 pt-1.5",children:"채널별 순수익 기준"})]}):m.jsx("div",{className:"text-[12px] text-muted-foreground",children:"데이터 없음"})]})]}),(i||o)&&m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4 mb-6",children:[m.jsxs("div",{className:"flex items-center justify-between mb-4",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-medium",children:[m.jsx(Pl,{size:13}),"성장 트렌드",m.jsx(Zt,{size:11,content:G==="revenue"?m.jsx(sr,{metric:"매출",rows:lr.매출,summary:"주간/월간/연간 매출 증감 비교"}):m.jsx(sr,{metric:"주문",rows:lr.주문,summary:"주간/월간/연간 주문 건수 증감 비교"})})]}),m.jsx("div",{className:"flex gap-0.5",children:["revenue","count"].map(Me=>m.jsx("button",{type:"button",onClick:()=>U(Me),className:Qe("text-[10px] px-1.5 py-0.5 rounded transition-colors",G===Me?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:Me==="revenue"?"매출":"주문건수"},Me))})]}),m.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[200px_1fr] gap-6",children:[m.jsx("div",{className:"divide-y divide-border/40",children:[{label:"전주비 WoW",pct:G==="count"?he:Ne,sub:`${xe} ${G==="count"?"주문":"매출"}`},{label:"전월비 MoM",pct:G==="count"?fe:ne,sub:`이번달 ${$}일 ${G==="count"?"주문":"매출"}`},{label:"전년동월비 YoY",pct:G==="count"?Se:ve,sub:`이번달 ${$}일 ${G==="count"?"주문":"매출"}`}].map(({label:Me,pct:wt,sub:Mr})=>m.jsxs("div",{className:"py-2.5 first:pt-0 last:pb-0",children:[m.jsx("div",{className:"text-[11px] font-medium text-foreground/60 mb-0.5",children:Me}),m.jsxs("div",{className:Qe("text-[20px] font-bold flex items-center gap-1 leading-none",wt===null?"text-muted-foreground":wt>=0?"text-emerald-600 dark:text-emerald-400":"text-red-500"),children:[wt!==null&&(wt>=0?m.jsx(Pl,{size:14}):m.jsx(iH,{size:14})),wP(wt)]}),m.jsxs("div",{className:"mt-1 inline-flex items-center text-[10px] text-muted-foreground/60 bg-muted/50 px-1.5 py-0.5 rounded",children:[Mr," 기준"]})]},Me))}),m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-3 mb-2 text-[10px] text-muted-foreground",children:[m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx("span",{className:"inline-block w-4 h-0.5 bg-primary rounded"}),"올해"]}),m.jsxs("span",{className:"flex items-center gap-1 opacity-40",children:[m.jsx("span",{className:"inline-block w-4 h-0.5 bg-muted-foreground rounded"}),"작년"]})]}),o&&R?m.jsx(R,{thisYear:o.thisYear??[],lastYear:o.lastYear??[],metric:G,currentWeek:Te}):m.jsx("div",{className:"h-[72px] flex items-center justify-center text-[11px] text-muted-foreground",children:R?"로딩 중...":"차트 미제공"})]})]})]}),m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4",children:[m.jsxs("div",{className:"text-[12px] font-medium mb-3 flex items-center gap-1.5",children:[m.jsx(Uee,{size:12}),"최근 활동"]}),n.length===0?m.jsx("div",{className:"text-[12px] text-muted-foreground py-3 text-center",children:"활동 없음"}):m.jsx("div",{children:n.slice(0,10).map((Me,wt)=>m.jsx(Tae,{log:Me},wt))})]}),(u??e)===0&&_&&!S&&m.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-40 border-t border-border bg-card/95 backdrop-blur-sm",children:m.jsxs("div",{className:"max-w-screen-xl mx-auto px-6 py-3 flex items-center justify-between gap-4",children:[m.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[m.jsx("div",{className:"shrink-0 w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center",children:m.jsx(iee,{size:15,className:"text-primary"})}),m.jsxs("div",{className:"min-w-0",children:[m.jsx("p",{className:"text-[13px] font-medium truncate",children:"판매 채널에서 주문을 수집해보세요"}),m.jsx("p",{className:"text-[11px] text-muted-foreground truncate",children:"연결된 채널의 최근 주문 데이터를 한 번에 가져옵니다"})]})]}),m.jsx(e1,{onSync:_,syncing:g,syncResult:y,timeLeft:b,disabled:S})]})})]})}const n1={cafe24:{label:"카페24",guide:"https://developers.cafe24.com",cliNote:"sppt config set cafe24 storeId <mallId>",fields:[{key:"storeId",label:"스토어 ID (mallId)",type:"text",placeholder:"mymall"},{key:"clientId",label:"Client ID",type:"text"},{key:"clientSecret",label:"Client Secret",type:"password"},{key:"accessToken",label:"Access Token",type:"text",readOnly:!0,hint:"OAuth 인증 후 자동 발급·갱신"}]},coupang:{label:"쿠팡",guide:"https://wing.coupang.com",cliNote:"sppt config set coupang storeId <vendorId>",ipNote:`Wing 포털 → 판매자정보 → Open API → IP 관리에서 아래 IP를 등록해야 합니다.
|
|
299
|
+
- OO세트-기프트: 선물상자 포함`})]}),m.jsxs("div",{children:[m.jsx("div",{className:"font-semibold text-foreground/60 mb-2",children:"규칙 적용 방법"}),m.jsxs("p",{className:"leading-relaxed",children:["규칙 저장 후 AI에서 ",m.jsx(mi,{children:"/sppt-product-parse"})," 스킬을 실행하면 미매핑 상품명을 자동으로 분류합니다."]})]}),m.jsxs("div",{className:"pt-2 border-t border-border/40 text-[10px] space-y-1.5",children:[m.jsx("div",{className:"font-medium text-foreground/50",children:"AI로 규칙 수정하기"}),m.jsxs("p",{className:"leading-relaxed text-muted-foreground/80",children:["AI가 규칙 파일을 작성한 뒤"," ",m.jsx(mi,{children:"sppt product rules set <file>"})," 을 실행하면 이 화면과 클라우드가 동시에 업데이트됩니다."]})]})]})]})]})}),m.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-4",children:[m.jsx(bn,{label:"카탈로그 SKU",value:r.length.toLocaleString()}),m.jsx(bn,{label:"미매핑 상품",value:e,warn:e>0}),m.jsx(bn,{label:"총 판매 수량",value:Mt.toLocaleString(),sub:"개",tooltip:m.jsx(sr,{metric:"판매수량",rows:lr.판매수량,summary:"주문수량 × 구성품수 합계"})}),m.jsxs("div",{className:"relative",children:[m.jsx(bn,{label:"총 상품매출",value:r0(ar),sub:f!=null&&Math.abs(f-ar)>1e3?`(매출 ${r0(f)})`:void 0}),m.jsx("span",{className:"absolute top-3 right-3",children:m.jsx(Zt,{size:12,contentClassName:"max-w-[340px]",content:m.jsxs("div",{className:"space-y-2",children:[m.jsx("div",{className:"text-[10px] font-semibold pb-1 border-b border-border/50",children:"상품매출 vs 매출"}),m.jsxs("table",{className:"w-full text-[10px]",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border/50",children:[m.jsx("th",{className:"text-left py-0.5 pr-2",children:"포함 항목"}),m.jsx("th",{className:"text-center py-0.5 px-1",children:"상품매출"}),m.jsx("th",{className:"text-center py-0.5 px-1",children:"매출"})]})}),m.jsxs("tbody",{children:[m.jsxs("tr",{children:[m.jsx("td",{className:"py-0.5 pr-2",children:"상품금액 (단가×수량)"}),m.jsx("td",{className:"text-center text-emerald-600 dark:text-emerald-400",children:"O"}),m.jsx("td",{className:"text-center text-emerald-600 dark:text-emerald-400",children:"O"})]}),m.jsxs("tr",{children:[m.jsx("td",{className:"py-0.5 pr-2",children:"배송비"}),m.jsx("td",{className:"text-center text-red-400",children:"X"}),m.jsx("td",{className:"text-center text-emerald-600 dark:text-emerald-400",children:"O"})]}),m.jsxs("tr",{children:[m.jsx("td",{className:"py-0.5 pr-2",children:"쿠폰·포인트 할인"}),m.jsx("td",{className:"text-center text-red-400",children:"X"}),m.jsx("td",{className:"text-center text-emerald-600 dark:text-emerald-400",children:"O (차감)"})]}),m.jsxs("tr",{children:[m.jsx("td",{className:"py-0.5 pr-2",children:"미정산 주문"}),m.jsx("td",{className:"text-center text-emerald-600 dark:text-emerald-400",children:"O"}),m.jsx("td",{className:"text-center text-emerald-600 dark:text-emerald-400",children:"O"})]}),m.jsxs("tr",{children:[m.jsx("td",{className:"py-0.5 pr-2",children:"구성품 비례배분 반올림"}),m.jsx("td",{className:"text-center",children:"누적"}),m.jsx("td",{className:"text-center",children:"없음"})]})]})]})]})})})]})]}),m.jsxs("div",{className:"border border-border/50 rounded-lg bg-muted/10 px-4 py-3 mb-6 text-[11px] text-muted-foreground space-y-1.5",children:[m.jsxs("div",{className:"flex gap-6",children:[m.jsx("span",{className:"shrink-0 font-medium text-foreground/50 w-16",children:"상품 분류"}),m.jsxs("span",{children:["위 ",m.jsx("span",{className:"text-foreground/70 font-medium",children:"분류 규칙"})," 버튼에서 규칙을 작성해두면, ",m.jsx(mi,{children:"/sppt-product-parse"})," 스킬로 미매핑 상품명을 자동 분류해 상품 목록이 구축됩니다."]})]}),m.jsxs("div",{className:"flex gap-6",children:[m.jsx("span",{className:"shrink-0 font-medium text-foreground/50 w-16",children:"원가 등록"}),m.jsxs("span",{children:["매입단가·택배비 등이 담긴 엑셀 파일을 AI에 붙여넣으면,"," ",m.jsx(mi,{children:"/sppt-cost-calc"})," 스킬로 원가를 등록하고 단품 기준 공헌이익을 계산합니다."]})]})]}),m.jsxs("div",{className:"flex items-center justify-between mb-4",children:[m.jsx("span",{className:"text-[13px] font-medium",children:"판매요약"}),m.jsx("div",{className:"flex items-center gap-2",children:["category","line"].map(ye=>m.jsx("button",{type:"button",onClick:()=>M(ye),className:"text-[12px] px-3 py-1.5 rounded-md border transition-colors cursor-pointer",style:C===ye?{borderColor:"hsl(37 97% 49% / 0.4)",backgroundColor:"hsl(37 97% 49% / 0.05)",fontWeight:500}:{borderColor:"hsl(var(--border))",backgroundColor:"hsl(var(--card))",color:"hsl(var(--muted-foreground))"},children:ye==="category"?"카테고리별":"제품라인별"},ye))})]}),m.jsxs(ho,{className:"mb-6",minWidth:"600px",stickyHeader:!0,children:[m.jsxs(vo,{children:[m.jsx(je,{children:C==="category"?"카테고리":"제품라인"}),m.jsx(je,{align:"right",children:"원가"}),m.jsx(je,{align:"right",children:"수수료율"}),m.jsx(je,{align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-0.5",children:["주문수",m.jsx(Zt,{content:m.jsx(sr,{metric:"주문",rows:lr.주문,summary:"취소·반품·미결제 제외 주문 건수"})})]})}),m.jsx(je,{align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-0.5",children:["수량",m.jsx(Zt,{content:m.jsx(sr,{metric:"판매수량",rows:lr.판매수량,summary:"주문수량 × 구성품수 합계"})})]})}),m.jsx(je,{align:"right",children:"판매단가"}),m.jsx(je,{align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-0.5",children:["매출",m.jsx(Zt,{content:m.jsx(sr,{metric:"상품매출",rows:lr.상품매출,summary:"상품 단가 × 수량 합산"})})]})}),m.jsx(je,{align:"right",className:"w-[52px]",children:"비중(%)"}),m.jsx(je,{className:"px-1 w-[56px]"})]}),m.jsx("tbody",{className:"bg-card",children:Ri.map((ye,Xe)=>{const et=C==="category"?ye.category:ye.productLine,An=ar>0?ye.totalRevenue/ar*100:0,Xn=`${C}-${et}`,qn=k===Xn,mr=ye.channelBreakdown??[],Me=SP(mr,a);return m.jsxs(Y.Fragment,{children:[m.jsxs("tr",{className:"cursor-pointer transition-colors",style:{borderBottom:"1px solid hsl(var(--border) / 0.6)",backgroundColor:qn?"hsl(37 97% 49% / 0.05)":Xe%2!==0?"hsl(var(--muted) / 0.05)":void 0},onClick:()=>R(qn?null:Xn),onKeyDown:wt=>{(wt.key==="Enter"||wt.key===" ")&&R(qn?null:Xn)},children:[m.jsx("td",{className:"px-3 py-2",children:m.jsxs("div",{className:"flex items-center gap-1",children:[qn?m.jsx(cn,{size:11,className:"text-muted-foreground"}):m.jsx(qr,{size:11,className:"text-muted-foreground"}),et||"(미분류)"]})}),m.jsx("td",{className:"px-3 py-2 text-right text-muted-foreground",children:"-"}),m.jsx("td",{className:"px-3 py-2 text-right text-muted-foreground",children:m.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[m.jsx("span",{children:Me!=null?`${Me.toFixed(1)}%`:"-"}),Me!=null&&m.jsx("div",{className:"w-[28px] h-1.5 rounded-full overflow-hidden shrink-0 bg-muted",children:m.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.min(Me/30*100,100)}%`,backgroundColor:"rgb(245 158 11 / 0.6)"}})})]})}),m.jsx("td",{className:"px-3 py-2 text-right",children:ye.orderCount.toLocaleString()}),m.jsx("td",{className:"px-3 py-2 text-right",children:ye.totalQuantity.toLocaleString()}),m.jsx("td",{className:"px-3 py-2 text-right text-muted-foreground",children:bP(ye.totalRevenue,ye.totalQuantity)}),m.jsx("td",{className:"px-3 py-2 text-right",children:r0(ye.totalRevenue)}),m.jsx("td",{className:"px-3 py-2 text-right",children:An.toFixed(1)}),m.jsx("td",{className:"px-1 py-2",children:m.jsx("div",{className:"h-2 rounded-full overflow-hidden bg-muted",children:m.jsx("div",{className:"h-full rounded-full",style:{width:`${An}%`,backgroundColor:"hsl(37 97% 49% / 0.6)"}})})})]}),qn&&mr.length>0&&m.jsx(xP,{channelBreakdown:mr,inflowBreakdown:ye.inflowBreakdown,totalRevenue:ye.totalRevenue,defaults:a,variant:"summary"}),qn&&(()=>{const Mr=r.filter(mt=>C==="category"?(mt.category||"미분류")===et:(mt.productLine||"미분류")===et).flatMap(mt=>mt.channelOptionBreakdown??[]).reduce((mt,Dr)=>{const Pm=`${Dr.channel}|${Dr.channelProductId}|${Dr.channelProductOptionId}`,ks=mt.find(cu=>`${cu.channel}|${cu.channelProductId}|${cu.channelProductOptionId}`===Pm);return ks?(ks.orderCount+=Dr.orderCount,ks.totalOrderQuantity+=Dr.totalOrderQuantity,ks.totalQuantity+=Dr.totalQuantity,ks.totalRevenue+=Dr.totalRevenue):mt.push({...Dr}),mt},[]).sort((mt,Dr)=>Dr.totalRevenue-mt.totalRevenue);return m.jsx(gP,{items:Mr,totalRevenue:ye.totalRevenue,leftColSpan:3,totalCol:9})})()]},Xn)})})]}),m.jsxs("div",{className:"flex items-center justify-between mb-3",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-[12px] font-medium",children:"상품 목록"}),m.jsx(Jx,{label:"카테고리",options:Ur,selected:E,onToggle:ye=>I(Ls(E,ye)),onClear:()=>I(new Set)}),m.jsx(Jx,{label:"제품라인",options:ki,selected:z,onToggle:ye=>j(Ls(z,ye)),onClear:()=>j(new Set)}),uf&&m.jsxs(m.Fragment,{children:[m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[$e.length,"개 상품"]}),m.jsxs("button",{type:"button",onClick:()=>{I(new Set),j(new Set)},className:"text-[11px] text-muted-foreground flex items-center gap-0.5 cursor-pointer",children:[m.jsx(ql,{size:11})," 초기화"]})]})]}),m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[$e.length,"개 상품 · ",Te.length,"개 품목"]})]}),m.jsxs(ho,{minWidth:"760px",stickyHeader:!0,className:bt?"rounded-b-none":void 0,children:[m.jsxs(vo,{children:[m.jsx(je,{className:"px-2",children:"상품명"}),m.jsx(je,{className:"px-2",children:"브랜드"}),m.jsx(je,{className:"px-2",children:"제품라인"}),m.jsx(je,{className:"px-2",children:"카테고리"}),m.jsx(je,{className:"px-2",align:"right",children:"SKU수"}),m.jsx(je,{className:"px-2",align:"right",children:"원가"}),m.jsx(je,{className:"px-2",align:"right",children:"수수료율"}),m.jsx(je,{className:"px-2",align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-0.5",children:["주문수",m.jsx(Zt,{content:m.jsx(sr,{metric:"주문",rows:lr.주문,summary:"취소·반품·미결제 제외 주문 건수"})})]})}),m.jsx(je,{className:"px-2",align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-0.5",children:["수량",m.jsx(Zt,{content:m.jsx(sr,{metric:"판매수량",rows:lr.판매수량,summary:"주문수량 × 구성품수 합계"})})]})}),m.jsx(je,{className:"px-2",align:"right",children:"판매단가"}),m.jsx(je,{className:"px-2",align:"right",children:m.jsxs("span",{className:"inline-flex items-center gap-0.5",children:["매출",m.jsx(Zt,{content:m.jsx(sr,{metric:"상품매출",rows:lr.상품매출,summary:"상품 단가 × 수량 합산"})})]})}),m.jsx(je,{className:"px-2 w-[52px]",align:"right",children:"비중(%)"}),m.jsx(je,{className:"px-1 w-[56px]"})]}),m.jsxs("tbody",{className:"bg-card",children:[Ee.map((ye,Xe)=>{const et=D.has(ye.key),An=ar>0?ye.totalRevenue/ar*100:0,Xn=SP(ye.channelBreakdown,a),qn=et?ye.skus.flatMap(mr=>mr.channelOptionBreakdown??[]).reduce((mr,Me)=>{const wt=`${Me.channel}|${Me.channelProductId}|${Me.channelProductOptionId}`,Mr=mr.find(mt=>`${mt.channel}|${mt.channelProductId}|${mt.channelProductOptionId}`===wt);return Mr?(Mr.orderCount+=Me.orderCount,Mr.totalOrderQuantity+=Me.totalOrderQuantity,Mr.totalQuantity+=Me.totalQuantity,Mr.totalRevenue+=Me.totalRevenue):mr.push({...Me}),mr},[]).sort((mr,Me)=>Me.totalRevenue-mr.totalRevenue):[];return m.jsxs(Y.Fragment,{children:[m.jsxs("tr",{className:"cursor-pointer transition-colors",style:{borderBottom:"1px solid hsl(var(--border) / 0.6)",backgroundColor:et?"hsl(37 97% 49% / 0.05)":Xe%2!==0?"hsl(var(--muted) / 0.05)":void 0},onClick:()=>We(ye.key),onKeyDown:mr=>{(mr.key==="Enter"||mr.key===" ")&&We(ye.key)},children:[m.jsx("td",{className:"px-2 py-2 font-medium max-w-[260px]",title:ye.productName,children:m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("span",{className:"shrink-0 text-muted-foreground/60",children:et?m.jsx(cn,{size:13}):m.jsx(qr,{size:13})}),m.jsx("span",{className:"truncate",children:ye.productName})]})}),m.jsx("td",{className:"px-2 py-2 text-muted-foreground whitespace-nowrap",children:ye.brand??"-"}),m.jsx("td",{className:"px-2 py-2 text-muted-foreground whitespace-nowrap",children:ye.productLine||"(미분류)"}),m.jsx("td",{className:"px-2 py-2 text-muted-foreground whitespace-nowrap",children:ye.category||"(미분류)"}),m.jsx("td",{className:"px-2 py-2 text-right whitespace-nowrap text-muted-foreground",children:ye.skus.length}),m.jsx("td",{className:"px-2 py-2 text-right whitespace-nowrap text-muted-foreground",children:"-"}),m.jsx("td",{className:"px-2 py-2 text-right whitespace-nowrap text-muted-foreground",children:m.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[m.jsx("span",{children:Xn!=null?`${Xn.toFixed(1)}%`:"-"}),Xn!=null&&m.jsx("div",{className:"w-[28px] h-1.5 rounded-full overflow-hidden shrink-0 bg-muted",children:m.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.min(Xn/30*100,100)}%`,backgroundColor:"rgb(245 158 11 / 0.6)"}})})]})}),m.jsx("td",{className:"px-2 py-2 text-right whitespace-nowrap",children:ye.orderCount.toLocaleString()}),m.jsx("td",{className:"px-2 py-2 text-right whitespace-nowrap",children:ye.totalQuantity.toLocaleString()}),m.jsx("td",{className:"px-2 py-2 text-right whitespace-nowrap text-muted-foreground",children:bP(ye.totalRevenue,ye.totalQuantity)}),m.jsx("td",{className:"px-2 py-2 text-right whitespace-nowrap font-medium",children:r0(ye.totalRevenue)}),m.jsx("td",{className:"px-2 py-2 text-right whitespace-nowrap text-muted-foreground",children:An.toFixed(1)}),m.jsx("td",{className:"px-1 py-2",children:m.jsx("div",{className:"h-2 rounded-full overflow-hidden bg-muted",children:m.jsx("div",{className:"h-full rounded-full",style:{width:`${An}%`,backgroundColor:"hsl(37 97% 49% / 0.6)"}})})})]}),et&&ye.channelBreakdown.length>=1&&m.jsx("tr",{style:{borderBottom:"1px solid hsl(var(--border) / 0.3)"},className:"bg-muted/5",children:m.jsx("td",{colSpan:13,className:"px-4 py-1.5 text-[10px] font-semibold text-muted-foreground tracking-wide",children:"채널별 판매현황"})}),et&&ye.channelBreakdown.length>=1&&m.jsx(xP,{channelBreakdown:ye.channelBreakdown,inflowBreakdown:ye.inflowBreakdown,totalRevenue:ye.totalRevenue,defaults:a,variant:"product"}),et&&qn.length>0&&m.jsx(gP,{items:qn,totalRevenue:ye.totalRevenue,leftColSpan:7,totalCol:13})]},ye.key)}),$e.length===0&&m.jsx("tr",{children:m.jsx("td",{colSpan:13,className:"px-3 py-8 text-center text-[13px] text-muted-foreground",children:"필터 조건에 맞는 상품이 없습니다."})})]})]}),bt&&m.jsx("div",{className:"border border-border border-t-0 rounded-b-lg px-4 py-3 text-center",children:m.jsxs("button",{type:"button",onClick:()=>vt(ye=>ye+Bw),className:"text-[12px] font-medium cursor-pointer",style:{color:"hsl(37 97% 49%)"},children:["더보기 (",$e.length-lt,"개 남음)"]})})]})}function Sae(r){if(!(r!=null&&r.length))return null;const e=r.map(t=>t.lastSyncedAt?new Date(t.lastSyncedAt).getTime():0).filter(Boolean).sort((t,n)=>n-t)[0];return e?new Date(e).toISOString():null}function al(r,e){return e?Math.round((r-e)/e*100):null}function wP(r){return r===null?"-":r>=0?`+${r}%`:`${r}%`}function wae({connected:r}){return m.jsx("span",{className:Qe("inline-block w-2 h-2 rounded-full shrink-0",r?"bg-green-500":"bg-muted-foreground/40")})}function Tae({log:r}){return m.jsxs("div",{className:"flex items-start gap-3 py-1.5 last:border-0",style:{borderBottom:"1px solid hsl(var(--border) / 0.5)"},children:[m.jsx("span",{className:"text-[11px] font-mono shrink-0 pt-px text-muted-foreground",children:r.time}),m.jsx("span",{className:"text-[11px] shrink-0 w-[88px] truncate text-muted-foreground/70",children:r.channel}),m.jsx("span",{className:"text-[12px] text-foreground",children:r.message})]})}function Cae({byStatus:r={},totalOrders:e=0,totalRevenue:t=0,recentActivity:n=[],channels:a=[],periodStats:i,weeklyStats:o,settlement:s=[],byChannel:l=[],totalImportedOrders:u,totalImportedRevenue:c,catalog:f,catalogLoading:h=!1,isLoading:v=!1,syncing:g=!1,syncResult:y,timeLeft:b,onSync:_,syncDisabled:S=!1,actionNeeded:T=0,onActionNeededClick:C,onUnmappedClick:M,onConnectChannel:D,onChannelSettingsClick:L,channelFaviconOverrides:k,WeeklyLineChartComponent:R,headerExtra:E,belowHeader:I}){var We,lt,vt,Ee,bt,Mt,ar,Ur,ki,Ls,uf,cf,Ri,ye,Xe,et,An,Xn,qn,mr;const[z,j]=Y.useState("product"),[G,U]=Y.useState("revenue"),O=Tg(Sae(a)),H=y??(O?`마지막 동기화: ${O}`:null),F=new Date(Date.now()+540*60*1e3),$=F.getUTCDate(),B=F.getUTCMonth(),X=F.getUTCFullYear(),q=new Date(Date.UTC(X,B,0)).getUTCDate(),Q=new Date(Date.UTC(X-1,B+1,0)).getUTCDate(),ne=al(((We=i==null?void 0:i.thisMonth)==null?void 0:We.revenue)??0,(((lt=i==null?void 0:i.lastMonth)==null?void 0:lt.revenue)??0)*$/q),fe=al(((vt=i==null?void 0:i.thisMonth)==null?void 0:vt.count)??0,(((Ee=i==null?void 0:i.lastMonth)==null?void 0:Ee.count)??0)*$/q),ve=al(((bt=i==null?void 0:i.thisMonth)==null?void 0:bt.revenue)??0,(((Mt=i==null?void 0:i.lastYearSameMonth)==null?void 0:Mt.revenue)??0)*$/Q),Se=al(((ar=i==null?void 0:i.thisMonth)==null?void 0:ar.count)??0,(((Ur=i==null?void 0:i.lastYearSameMonth)==null?void 0:Ur.count)??0)*$/Q),ge=!!(i!=null&&i.last7d&&(i!=null&&i.prev7d)),he=ge?al(((ki=i==null?void 0:i.last7d)==null?void 0:ki.count)??0,((Ls=i==null?void 0:i.prev7d)==null?void 0:Ls.count)??0):al(((uf=i==null?void 0:i.thisWeek)==null?void 0:uf.count)??0,((cf=i==null?void 0:i.lastWeek)==null?void 0:cf.count)??0),Ne=ge?al(((Ri=i==null?void 0:i.last7d)==null?void 0:Ri.revenue)??0,((ye=i==null?void 0:i.prev7d)==null?void 0:ye.revenue)??0):al(((Xe=i==null?void 0:i.thisWeek)==null?void 0:Xe.revenue)??0,((et=i==null?void 0:i.lastWeek)==null?void 0:et.revenue)??0),xe=ge?"최근 7일":"이번주",Te=(An=o==null?void 0:o.thisYear)!=null&&An.length?Math.max(...o.thisYear.map(Me=>Me.week)):void 0,$e=Math.max(...s.map(Me=>Me.netRevenue??0),1);return v?m.jsxs("div",{children:[m.jsx("h2",{className:"text-xl font-medium mb-6",children:"Overview"}),m.jsx("div",{className:"text-sm text-muted-foreground",children:"로딩 중..."})]}):m.jsxs("div",{children:[m.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-6 sticky top-0 z-10 py-4 -mt-4 md:-mt-7 md:pt-7",style:{backgroundColor:"var(--page-bg, transparent)"},children:[m.jsx("h2",{className:"text-xl font-medium",children:"Overview"}),m.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[E,H&&m.jsx("span",{className:"text-[11px] text-muted-foreground",children:H}),_&&m.jsx(e1,{onSync:_,syncing:g,syncResult:y,timeLeft:b,disabled:S})]})]}),I,m.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3 mb-6",children:[m.jsx(bn,{label:"오늘 주문",value:((Xn=i==null?void 0:i.today)==null?void 0:Xn.count)??"-",sub:"건",tooltip:m.jsx(sr,{metric:"주문",rows:lr.주문,summary:"오늘(KST) 주문 건수"})}),m.jsx(bn,{label:"미매핑 상품",value:(f==null?void 0:f.unmappedCount)??0,sub:"분류 안 된 주문 상품",highlight:((f==null?void 0:f.unmappedCount)??0)>0,onClick:M}),m.jsx(bn,{label:"이번 달 매출",value:i?`${Math.round((((qn=i.thisMonth)==null?void 0:qn.revenue)??0)/1e4).toLocaleString()}만`:t>0?`${Math.round(t/1e4).toLocaleString()}만`:"-",sub:ne!==null?`전월비 ${wP(ne)}`:"전월 데이터 없음",highlight:ne!==null&&ne>0,tooltip:m.jsx(sr,{metric:"매출",rows:lr.매출,summary:"이번 달(KST) 최종 결제 금액 합계"})}),m.jsx(bn,{label:"이번 달 주문",value:((mr=i==null?void 0:i.thisMonth)==null?void 0:mr.count)??e,sub:"건",tooltip:m.jsx(sr,{metric:"주문",rows:lr.주문,summary:"이번 달(KST) 주문 건수"})}),m.jsx(bn,{label:"누적 주문",value:(u??e).toLocaleString(),sub:"건",tooltip:m.jsx(sr,{metric:"주문",rows:lr.주문,summary:"전체 기간 주문 건수"})}),m.jsx(bn,{label:"누적 매출",value:`${Math.round((c??t)/1e4).toLocaleString()}만원`,tooltip:m.jsx(sr,{metric:"매출",rows:lr.매출,summary:"전체 기간 최종 결제 금액 합계"})})]}),m.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mb-6",children:[m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-medium",children:[m.jsx(Qx,{size:13}),"판매채널",L&&m.jsx("button",{type:"button",onClick:L,className:"ml-auto text-muted-foreground/50 hover:text-muted-foreground transition-colors cursor-pointer",children:m.jsx(aH,{size:13})})]}),m.jsx("div",{className:"text-[10px] text-muted-foreground/60 mb-3",children:"API 연결 상태"}),m.jsx("div",{className:"space-y-1.5 mb-3",children:a.map(Me=>m.jsxs("div",{className:"flex items-center gap-2 text-[12px]",children:[m.jsx(wae,{connected:Me.connected}),m.jsx(Jy,{channel:Me.channel,size:13,overrides:k}),m.jsx("span",{children:hr[Me.channel]??Me.channel}),Me.connected?m.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:Me.storeId}):D?m.jsx("button",{type:"button",onClick:()=>D(Me.channel),className:"ml-auto text-[11px] text-primary/60 hover:text-primary transition-colors cursor-pointer",children:"연결하기 →"}):m.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:"미연결"})]},Me.channel))})]}),m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-medium",children:[m.jsx(Sg,{size:13}),"채널별 주문",m.jsx(Zt,{size:11,content:m.jsx(sr,{metric:"주문",rows:lr.주문,summary:"채널별 주문 건수"})})]}),m.jsx("div",{className:"text-[10px] text-muted-foreground/60 mb-3",children:"취소·반품·미결제 제외"}),l.length>0?(()=>{const Me=Math.max(...l.map(wt=>wt.count),1);return m.jsx("div",{className:"space-y-2",children:[...l].sort((wt,Mr)=>Mr.count-wt.count).map(wt=>m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsxs("span",{className:"flex items-center gap-1 text-[11px] w-[80px] shrink-0 truncate",children:[m.jsx(Jy,{channel:wt.channel,size:12,overrides:k}),hr[wt.channel]??wt.channel]}),m.jsx("div",{className:"flex-1 min-w-0",children:m.jsx("div",{className:"w-full bg-muted rounded-full h-1.5",children:m.jsx("div",{className:"h-full bg-primary/50 rounded-full",style:{width:`${wt.count/Me*100}%`}})})}),m.jsx("span",{className:"text-[11px] text-muted-foreground shrink-0 w-8 text-right",children:wt.count.toLocaleString()})]},wt.channel))})})():m.jsx("div",{className:"text-[12px] text-muted-foreground",children:"데이터 없음"})]}),m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4 flex flex-col gap-3",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-medium",children:[m.jsx(jee,{size:13}),"AI에게 물어보기"]}),m.jsxs("div",{className:"space-y-1.5 text-[11.5px] text-muted-foreground leading-snug",children:[m.jsxs("p",{className:"flex items-center gap-1 flex-wrap",children:[m.jsxs("span",{className:"inline-flex items-center gap-0.5",children:[m.jsx("img",{src:"https://www.google.com/s2/favicons?domain=claude.ai&sz=32",alt:"",className:"w-[13px] h-[13px] rounded-[3px]"}),m.jsx(mi,{variant:"muted",children:"claude"})]}),", ",m.jsxs("span",{className:"inline-flex items-center gap-0.5",children:[m.jsx("img",{src:"https://www.google.com/s2/favicons?domain=openai.com&sz=32",alt:"",className:"w-[13px] h-[13px] rounded-[3px]"}),m.jsx(mi,{variant:"muted",children:"codex"})]})," 에게 운영 고민을 물어보세요"]}),m.jsxs("p",{children:[m.jsx(mi,{variant:"muted",children:"/sppt"})," 를 입력하면 사용 가능한 스킬 목록이 나와요"]})]}),m.jsx("div",{className:"flex flex-col gap-2 pt-0.5",children:[{cmd:"/sppt-daily-report",desc:"오늘 매출 브리핑해줘"},{cmd:"/sppt-weekly-analysis",desc:"이번 주 매출 분석해줘"}].map(({cmd:Me,desc:wt})=>m.jsx("div",{className:"text-[11.5px] leading-snug",children:m.jsxs("div",{className:"bg-primary/10 border border-primary/20 rounded-tl-xl rounded-tr-xl rounded-br-xl px-3 py-1.5 inline-block max-w-full",children:[m.jsx(mi,{className:"font-semibold",children:Me}),m.jsxs("span",{className:"text-foreground/70",children:[" ",wt]})]})},Me))})]})]}),m.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_2fr_1fr] gap-4 mb-6",children:[m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4",children:[m.jsxs("div",{className:"flex items-center justify-between mb-3",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-medium",children:[m.jsx(Sg,{size:13}),"상품매출 랭킹",m.jsx(Zt,{size:11,content:m.jsx(sr,{metric:"상품매출",rows:lr.상품매출,summary:"상품 단가 × 수량 합산"})})]}),m.jsx("div",{className:"flex gap-0.5",children:["product","category","line"].map(Me=>m.jsx("button",{type:"button",onClick:()=>j(Me),className:Qe("text-[10px] px-1.5 py-0.5 rounded transition-colors",z===Me?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:Me==="product"?"상품":Me==="category"?"카테고리":"제품라인"},Me))})]}),h?m.jsx("div",{className:"text-[11px] text-muted-foreground",children:"로딩 중..."}):(()=>{var Mr;let Me=[];if(z==="product"?Me=[...(f==null?void 0:f.catalog)??[]].sort((mt,Dr)=>Dr.totalRevenue-mt.totalRevenue).slice(0,8).map(mt=>({key:mt.productName,label:mt.productName,totalRevenue:mt.totalRevenue})):z==="category"?Me=[...(f==null?void 0:f.byCategory)??[]].sort((mt,Dr)=>Dr.totalRevenue-mt.totalRevenue).slice(0,8).map(mt=>({key:mt.category,label:mt.category||"미분류",totalRevenue:mt.totalRevenue})):Me=[...(f==null?void 0:f.byLine)??[]].sort((mt,Dr)=>Dr.totalRevenue-mt.totalRevenue).slice(0,8).map(mt=>({key:mt.productLine,label:mt.productLine||"미분류",totalRevenue:mt.totalRevenue})),Me.length===0)return m.jsx("div",{className:"text-[11px] text-muted-foreground",children:"데이터 없음"});const wt=((Mr=Me[0])==null?void 0:Mr.totalRevenue)??1;return m.jsx("div",{className:"space-y-2",children:Me.map((mt,Dr)=>m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-[10px] text-muted-foreground w-3 text-right shrink-0",children:Dr+1}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[m.jsx("span",{className:"text-[11px] truncate",children:mt.label}),m.jsxs("span",{className:"text-[10px] text-muted-foreground ml-1 shrink-0",children:[Math.round(mt.totalRevenue/1e4).toLocaleString(),"만"]})]}),m.jsx("div",{className:"w-full bg-muted rounded-full h-1",children:m.jsx("div",{className:"h-full bg-primary/50 rounded-full",style:{width:`${mt.totalRevenue/wt*100}%`}})})]})]},mt.key||Dr))})})()]}),s.length>0?m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-medium mb-3",children:["채널별 정산 현황",m.jsx(Zt,{size:11,content:m.jsx(sr,{metric:"정산매출",rows:lr.정산매출,summary:"정산 완료 주문의 grossAmount 합계"})})]}),m.jsxs("table",{className:"w-full text-[12px]",style:{borderCollapse:"collapse"},children:[m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border",children:[m.jsx("th",{className:"py-1.5 text-left text-[11px] font-semibold text-muted-foreground",children:"채널"}),m.jsx("th",{className:"py-1.5 text-right text-[11px] font-semibold text-muted-foreground",children:"주문"}),m.jsx("th",{className:"py-1.5 text-right text-[11px] font-semibold text-muted-foreground",children:"매출"}),m.jsx("th",{className:"py-1.5 text-right text-[11px] font-semibold text-muted-foreground",children:"수수료율"}),m.jsx("th",{className:"py-1.5 text-right text-[11px] font-semibold text-muted-foreground",children:"순수익"})]})}),m.jsx("tbody",{children:s.map(Me=>m.jsxs("tr",{className:"border-b border-border/50",children:[m.jsx("td",{className:"py-1.5",children:m.jsxs("span",{className:"flex items-center gap-1.5",children:[m.jsx(Jy,{channel:Me.channel,size:13,overrides:k}),hr[Me.channel]??Me.channel]})}),m.jsx("td",{className:"py-1.5 text-right text-muted-foreground",children:Me.orderCount.toLocaleString()}),m.jsxs("td",{className:"py-1.5 text-right font-medium",children:[Math.round(Me.totalRevenue/1e4).toLocaleString(),"만"]}),m.jsx("td",{className:"py-1.5 text-right text-muted-foreground",children:Me.avgCommissionRate!=null?`${(Me.avgCommissionRate*100).toFixed(1)}%`:"-"}),m.jsx("td",{className:"py-1.5 text-right font-medium text-emerald-600 dark:text-emerald-400",children:Me.netRevenue!=null?`${Math.round(Me.netRevenue/1e4).toLocaleString()}만`:"-"})]},Me.channel))})]})]}):m.jsx("div",{className:"border border-border rounded-lg bg-card p-4 flex items-center justify-center text-[12px] text-muted-foreground",children:"정산 데이터 없음"}),m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4",children:[m.jsxs("div",{className:"flex items-center gap-1.5 mb-3 text-[12px] font-medium",children:[m.jsx(WJ,{size:13}),"공헌이익 순위",m.jsx(Zt,{size:11,content:m.jsx(sr,{metric:"공헌이익",rows:lr.공헌이익,summary:"순수익 - 총변동비"})})]}),s.length>0?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"space-y-2",children:[...s].filter(Me=>Me.netRevenue!=null).sort((Me,wt)=>(wt.netRevenue??0)-(Me.netRevenue??0)).slice(0,8).map((Me,wt)=>{const Mr=(Me.netRevenue??0)/$e*100;return m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"text-[10px] text-muted-foreground w-3 text-right shrink-0",children:wt+1}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center justify-between mb-0.5",children:[m.jsxs("span",{className:"flex items-center gap-1 text-[11px] truncate",children:[m.jsx(Jy,{channel:Me.channel,size:12,overrides:k}),hr[Me.channel]??Me.channel]}),m.jsxs("span",{className:"text-[10px] text-emerald-600 dark:text-emerald-400 ml-1 shrink-0",children:[Math.round((Me.netRevenue??0)/1e4).toLocaleString(),"만"]})]}),m.jsx("div",{className:"w-full bg-muted rounded-full h-1",children:m.jsx("div",{className:"h-full rounded-full bg-emerald-500/50",style:{width:`${Mr}%`}})})]})]},Me.channel)})}),m.jsx("div",{className:"mt-2 text-[10px] text-muted-foreground/60 border-t border-border/50 pt-1.5",children:"채널별 순수익 기준"})]}):m.jsx("div",{className:"text-[12px] text-muted-foreground",children:"데이터 없음"})]})]}),(i||o)&&m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4 mb-6",children:[m.jsxs("div",{className:"flex items-center justify-between mb-4",children:[m.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-medium",children:[m.jsx(Pl,{size:13}),"성장 트렌드",m.jsx(Zt,{size:11,content:G==="revenue"?m.jsx(sr,{metric:"매출",rows:lr.매출,summary:"주간/월간/연간 매출 증감 비교"}):m.jsx(sr,{metric:"주문",rows:lr.주문,summary:"주간/월간/연간 주문 건수 증감 비교"})})]}),m.jsx("div",{className:"flex gap-0.5",children:["revenue","count"].map(Me=>m.jsx("button",{type:"button",onClick:()=>U(Me),className:Qe("text-[10px] px-1.5 py-0.5 rounded transition-colors",G===Me?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:Me==="revenue"?"매출":"주문건수"},Me))})]}),m.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[200px_1fr] gap-6",children:[m.jsx("div",{className:"divide-y divide-border/40",children:[{label:"전주비 WoW",pct:G==="count"?he:Ne,sub:`${xe} ${G==="count"?"주문":"매출"}`},{label:"전월비 MoM",pct:G==="count"?fe:ne,sub:`이번달 ${$}일 ${G==="count"?"주문":"매출"}`},{label:"전년동월비 YoY",pct:G==="count"?Se:ve,sub:`이번달 ${$}일 ${G==="count"?"주문":"매출"}`}].map(({label:Me,pct:wt,sub:Mr})=>m.jsxs("div",{className:"py-2.5 first:pt-0 last:pb-0",children:[m.jsx("div",{className:"text-[11px] font-medium text-foreground/60 mb-0.5",children:Me}),m.jsxs("div",{className:Qe("text-[20px] font-bold flex items-center gap-1 leading-none",wt===null?"text-muted-foreground":wt>=0?"text-emerald-600 dark:text-emerald-400":"text-red-500"),children:[wt!==null&&(wt>=0?m.jsx(Pl,{size:14}):m.jsx(iH,{size:14})),wP(wt)]}),m.jsxs("div",{className:"mt-1 inline-flex items-center text-[10px] text-muted-foreground/60 bg-muted/50 px-1.5 py-0.5 rounded",children:[Mr," 기준"]})]},Me))}),m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-3 mb-2 text-[10px] text-muted-foreground",children:[m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx("span",{className:"inline-block w-4 h-0.5 bg-primary rounded"}),"올해"]}),m.jsxs("span",{className:"flex items-center gap-1 opacity-40",children:[m.jsx("span",{className:"inline-block w-4 h-0.5 bg-muted-foreground rounded"}),"작년"]})]}),o&&R?m.jsx(R,{thisYear:o.thisYear??[],lastYear:o.lastYear??[],metric:G,currentWeek:Te}):m.jsx("div",{className:"h-[72px] flex items-center justify-center text-[11px] text-muted-foreground",children:R?"로딩 중...":"차트 미제공"})]})]})]}),m.jsxs("div",{className:"border border-border rounded-lg bg-card p-4",children:[m.jsxs("div",{className:"text-[12px] font-medium mb-3 flex items-center gap-1.5",children:[m.jsx(Uee,{size:12}),"최근 활동"]}),n.length===0?m.jsx("div",{className:"text-[12px] text-muted-foreground py-3 text-center",children:"활동 없음"}):m.jsx("div",{children:n.slice(0,10).map((Me,wt)=>m.jsx(Tae,{log:Me},wt))})]}),(u??e)===0&&_&&!S&&m.jsx("div",{className:"fixed bottom-0 left-0 md:left-[220px] right-0 z-40 border-t border-border bg-card/95 backdrop-blur-sm",children:m.jsxs("div",{className:"max-w-screen-xl mx-auto px-6 py-3 flex items-center justify-between gap-4",children:[m.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[m.jsx("div",{className:"shrink-0 w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center",children:m.jsx(iee,{size:15,className:"text-primary"})}),m.jsxs("div",{className:"min-w-0",children:[m.jsx("p",{className:"text-[13px] font-medium truncate",children:"판매 채널에서 주문을 수집해보세요"}),m.jsx("p",{className:"text-[11px] text-muted-foreground truncate",children:"연결된 채널의 최근 주문 데이터를 한 번에 가져옵니다"})]})]}),m.jsx(e1,{onSync:_,syncing:g,syncResult:y,timeLeft:b,disabled:S})]})})]})}const n1={cafe24:{label:"카페24",guide:"https://developers.cafe24.com",cliNote:"sppt config set cafe24 storeId <mallId>",fields:[{key:"storeId",label:"스토어 ID (mallId)",type:"text",placeholder:"mymall"},{key:"clientId",label:"Client ID",type:"text"},{key:"clientSecret",label:"Client Secret",type:"password"},{key:"accessToken",label:"Access Token",type:"text",readOnly:!0,hint:"OAuth 인증 후 자동 발급·갱신"}]},coupang:{label:"쿠팡",guide:"https://wing.coupang.com",cliNote:"sppt config set coupang storeId <vendorId>",ipNote:`Wing 포털 → 판매자정보 → Open API → IP 관리에서 아래 IP를 등록해야 합니다.
|
|
300
300
|
209.71.88.61`,fields:[{key:"storeId",label:"Vendor ID",type:"text",placeholder:"A00123456"},{key:"accessKey",label:"Access Key",type:"text"},{key:"secretKey",label:"Secret Key",type:"password"},{key:"keyExpiresAt",label:"키 만료일",type:"text",readOnly:!0,hint:"키 생성 후 180일. CLI에서 accessKey 입력 시 자동 계산"},{key:"vendorUserId",label:"Wing 포털 ID",type:"text",optional:!0},{key:"outboundShippingPlaceCode",label:"출고지 코드",type:"number",optional:!0,hint:"Wing → 판매자정보 → 출고지 관리"},{key:"returnCenterCode",label:"반품지 코드",type:"text",optional:!0}]},smartstore:{label:"스마트스토어",guide:"https://sell.smartstore.naver.com",cliNote:"sppt config set smartstore clientId <id>",ipNote:`네이버 커머스 API → 애플리케이션 관리 → IP 허용 목록에서 아래 IP를 등록해야 합니다.
|
|
301
301
|
209.71.88.61`,fields:[{key:"clientId",label:"애플리케이션 ID",type:"text"},{key:"clientSecret",label:"애플리케이션 시크릿",type:"password"},{key:"accessToken",label:"Access Token",type:"text",readOnly:!0,hint:"자동 발급·갱신"},{key:"quickSettlement",label:"빠른정산 사용 중",type:"boolean",optional:!0,hint:"체크 시 정산 기준일이 구매확정일 대신 집화처리일로 계산됩니다"},{key:"isBrandStore",label:"브랜드스토어 여부",type:"boolean",optional:!0,hint:"브랜드스토어는 판매수수료 4% (마케팅링크 2%)"}]},shopify:{label:"Shopify",guide:"https://admin.shopify.com",cliNote:"sppt config set shopify storeId <domain>",fields:[{key:"storeId",label:"스토어 도메인",type:"text",placeholder:"mystore.myshopify.com"},{key:"accessToken",label:"Access Token",type:"password",hint:"Shopify Admin → Apps → 앱 개발 → Token 발급"},{key:"apiVersion",label:"API Version",type:"text",placeholder:"2024-10"}]},"toss-shopping":{label:"토스쇼핑",guide:"https://shopping-seller.toss.im/integration-key",cliNote:"sppt config set toss-shopping clientId <id>",fields:[{key:"clientId",label:"Client ID",type:"text",hint:"토스쇼핑 셀러 포털 → 연동 키 관리"},{key:"clientSecret",label:"Client Secret",type:"password"},{key:"accessToken",label:"Access Token",type:"text",readOnly:!0,hint:"자동 갱신"}]},"29cm":{label:"29CM (준비중)",guide:"https://openapi.29cm.co.kr",cliNote:"sppt config set 29cm clientId <id>",fields:[{key:"clientId",label:"Client ID",type:"text",hint:"29CM 파트너 포털(29Connect)에서 발급"},{key:"clientSecret",label:"Client Secret",type:"password"},{key:"partnerKey",label:"Partner Key",type:"password",hint:"상품 API 전용 키 (별도 발급)"},{key:"accessToken",label:"Access Token",type:"text",readOnly:!0,hint:"자동 갱신"}]},musinsa:{label:"무신사 (준비중)",guide:"https://partners.musinsa.com",cliNote:"sppt config set musinsa apiKey <key>",fields:[{key:"apiKey",label:"API Key",type:"text",hint:"⚠️ 2026-04 현재 공개 API 미제공 — EDI 계약 필요"},{key:"apiSecret",label:"API Secret",type:"password"}]}},HC={domeggook:{label:"도매꾹",guide:"https://mobile.domeggook.com/openAPI/management",cliNote:"sppt config set domeggook apiKey <key>",fields:[{key:"apiKey",label:"API Key",type:"password"}]},domemae:{label:"도매매",cliNote:"sppt config set domemae apiKey <key>",fields:[{key:"apiKey",label:"API Key",type:"password",hint:"도매꾹 API Key 공유 (동일 계정)"}]},specialoffer:{label:"스페셜오퍼",cliNote:"sppt config set specialoffer apiKey <key>",fields:[{key:"apiKey",label:"API Key",type:"password"}]},cjdropshipping:{label:"CJ Dropshipping",guide:"https://cjdropshipping.com",cliNote:"sppt config set cjdropshipping accessToken <token>",fields:[{key:"accessToken",label:"Access Token",type:"password",hint:"CJ Dropshipping 셀러 센터에서 발급"}]}},FC={"naver-datalab":{label:"네이버 데이터랩",guide:"https://developers.naver.com/apps",cliNote:"sppt config set naver-datalab clientId <id>",proxyNote:"shopport 공용 키로 검색 트렌드를 조회합니다. 월 요청량이 많거나 전용 키가 필요하면 직접 설정하세요.",fields:[{key:"clientId",label:"Client ID",type:"text",hint:"네이버 개발자 센터 → 내 애플리케이션"},{key:"clientSecret",label:"Client Secret",type:"password"}]},"naver-searchad":{label:"네이버 검색광고",guide:"https://searchad.naver.com",cliNote:"sppt config set naver-searchad customerId <id>",proxyNote:"shopport 공용 키로 키워드 검색량을 조회합니다. 직접 계정을 연결하면 더 정확한 데이터를 얻을 수 있습니다.",fields:[{key:"customerId",label:"Customer ID",type:"text",hint:"네이버 검색광고 → API 관리"},{key:"accessLicense",label:"Access License",type:"text"},{key:"secretKey",label:"Secret Key",type:"password"}]},"naver-shopping":{label:"네이버 쇼핑",guide:"https://developers.naver.com/apps",cliNote:"sppt config set naver-shopping clientId <id>",proxyNote:"shopport 공용 키로 네이버 쇼핑 데이터를 조회합니다. 직접 설정 시 네이버 개발자 센터에서 발급하세요.",fields:[{key:"clientId",label:"Client ID",type:"text"},{key:"clientSecret",label:"Client Secret",type:"password"}]}},UC={"dada-erp":{label:"DADA ERP (세이고)",cliNote:"sppt config set dada-erp apiKey <key>",fields:[{key:"apiKey",label:"API Key",type:"password",hint:"세이고 ERP → 시스템설정 → API 관리"},{key:"apiSecret",label:"API Secret",type:"password"},{key:"companyCode",label:"업체 코드",type:"text",optional:!0}]},ezadmin:{label:"이지어드민",cliNote:"sppt config set ezadmin apiKey <key>",fields:[{key:"apiKey",label:"API Key",type:"password",hint:"이지어드민 → 환경설정 → API 연동 관리"},{key:"shopCode",label:"쇼핑몰 코드",type:"text",hint:"가입 시 부여된 코드 (예: SHOP001)"}]},onewms:{label:"OneWMS",cliNote:"sppt config set onewms apiKey <key>",fields:[{key:"apiKey",label:"API Key",type:"password",hint:"OneWMS → 관리 → API 설정"},{key:"warehouseCode",label:"창고 코드",type:"text"},{key:"clientCode",label:"고객사 코드",type:"text",optional:!0}]},sabangnet:{label:"사방넷",cliNote:"sppt config set sabangnet sabangId <id>",fields:[{key:"sabangId",label:"아이디",type:"text"},{key:"sabangKey",label:"API Key",type:"password",hint:"사방넷 → 기본설정 → API 설정"}]},boxhero:{label:"박스히어로",guide:"https://www.boxhero.io",cliNote:"sppt config set boxhero accessToken <token>",fields:[{key:"accessToken",label:"Access Token",type:"password",hint:"BoxHero → Settings → Integrations → Open API"},{key:"teamId",label:"팀 ID",type:"text",optional:!0}]},"ecount-erp":{label:"이카운트ERP",cliNote:"sppt config set ecount-erp companyCode <code>",fields:[{key:"companyCode",label:"회사 코드",type:"text",hint:"로그인 화면에서 확인"},{key:"userId",label:"아이디",type:"text"},{key:"apiKey",label:"API Key",type:"password",hint:"ERP → 시스템관리 → Open API 설정"},{key:"zoneCode",label:"Zone 코드 (A~E)",type:"text",optional:!0}]},"douzone-wehago":{label:"더존 WEHAGO",guide:"https://developer.wehago.com",cliNote:"sppt config set douzone-wehago clientId <id>",fields:[{key:"clientId",label:"Client ID",type:"text",hint:"더존 개발자 포털에서 발급"},{key:"clientSecret",label:"Client Secret",type:"password"},{key:"companyCode",label:"회사 코드",type:"text"},{key:"accessToken",label:"Access Token",type:"text",readOnly:!0,hint:"자동 갱신"}]},playauto:{label:"플레이오토",guide:"https://plto.com/additional/API/",cliNote:"sppt config set playauto apiKey <key>",fields:[{key:"apiKey",label:"API Key",type:"password"},{key:"apiSecret",label:"API Secret",type:"password"},{key:"shopId",label:"쇼핑몰 ID",type:"text",optional:!0}]},argo:{label:"아르고 풀필먼트",cliNote:"sppt config set argo apiKey <key>",fields:[{key:"apiKey",label:"API Key",type:"password"},{key:"clientCode",label:"고객사 코드",type:"text",optional:!0}]},poomgo:{label:"품고",cliNote:"sppt config set poomgo apiKey <key>",fields:[{key:"apiKey",label:"API Key",type:"password"},{key:"warehouseCode",label:"창고 코드",type:"text",optional:!0}]}};function Aae({total:r,current:e,stepIds:t}){return m.jsx("div",{className:"flex items-center gap-1.5",children:t.slice(0,r).map((n,a)=>m.jsx("div",{className:Qe("h-1.5 rounded-full transition-all duration-200",a===e?"w-5 bg-primary":a<e?"w-1.5 bg-primary/50":"w-1.5 bg-border")},n))})}function Mae({step:r,fields:e,values:t,onChangeValues:n}){const a=r.inputFields?e.filter(i=>{var o;return(o=r.inputFields)==null?void 0:o.includes(i.key)}):[];return m.jsxs("div",{className:"space-y-4",children:[m.jsx("div",{className:"text-[13px] text-foreground/90 leading-relaxed whitespace-pre-line",children:r.description}),r.image&&m.jsx("div",{className:"rounded-lg border border-border overflow-hidden bg-muted/20",children:m.jsx("img",{src:r.image,alt:r.title,className:"w-full h-auto max-h-[280px] object-contain"})}),r.link&&m.jsxs("a",{href:r.link.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-[12px] border border-border rounded-md hover:bg-muted transition-colors",children:[m.jsx(Qc,{size:11}),r.link.label]}),a.length>0&&m.jsxs("div",{className:"space-y-2.5 pt-2 border-t border-border/50",children:[m.jsx("p",{className:"text-[11px] text-muted-foreground font-medium",children:"아래에 복사한 값을 입력하세요"}),a.map(i=>m.jsxs("div",{className:"space-y-0.5",children:[m.jsx("label",{htmlFor:`guide-field-${i.key}`,className:"text-[11px] text-muted-foreground",children:i.label}),m.jsx("input",{id:`guide-field-${i.key}`,type:i.type==="password"?"password":"text",value:String(t[i.key]??""),placeholder:i.placeholder??"",onChange:o=>n({...t,[i.key]:o.target.value}),className:"h-8 px-2.5 text-[12px] border border-border rounded bg-background w-full font-mono focus:outline-none focus:ring-1 focus:ring-primary/50"}),i.hint&&m.jsx("p",{className:"text-[10px] text-muted-foreground/70",children:i.hint})]},i.key))]})]})}function Dae({guide:r,fields:e,values:t,onChangeValues:n,onComplete:a,onClose:i,onSave:o,oauthUrl:s}){var g;const[l,u]=Y.useState(0),c=r.steps[l],f=l===r.steps.length-1,h=l===0;function v(){o==null||o(),s&&window.open(s,"_blank"),a()}return m.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[8vh] bg-black/40 backdrop-blur-sm",children:m.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-2xl w-full max-w-[560px] max-h-[80vh] flex flex-col",children:[m.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-border shrink-0",children:[m.jsxs("div",{className:"flex items-center gap-2.5",children:[m.jsx(tH,{size:14,className:"text-primary"}),m.jsxs("div",{children:[m.jsx("h3",{className:"text-[13px] font-semibold",children:"가이드 따라하기"}),m.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["약 ",r.estimatedMinutes,"분 소요"]})]})]}),m.jsx("button",{type:"button",onClick:i,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",children:m.jsx(ql,{size:15})})]}),m.jsxs("div",{className:"px-5 pt-4 pb-3 space-y-2.5 shrink-0",children:[m.jsx(Aae,{total:r.steps.length,current:l,stepIds:r.steps.map(y=>y.title)}),m.jsxs("h4",{className:"text-[14px] font-semibold",children:[m.jsxs("span",{className:"text-primary mr-1.5",children:[l+1,"."]}),c.title]})]}),m.jsx("div",{className:"px-5 pb-4 overflow-y-auto flex-1 min-h-0",children:m.jsx(Mae,{step:c,fields:e,values:t,onChangeValues:n})}),m.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-t border-border shrink-0",children:[m.jsxs("button",{type:"button",onClick:()=>u(y=>y-1),disabled:h,className:"flex items-center gap-1.5 px-3 py-1.5 text-[12px] border border-border rounded-md hover:bg-muted transition-colors disabled:opacity-30 disabled:pointer-events-none",children:[m.jsx(jJ,{size:12}),"이전"]}),m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[l+1," / ",r.steps.length]}),((g=c.action)==null?void 0:g.type)==="oauth"?m.jsxs("button",{type:"button",onClick:v,className:"flex items-center gap-1.5 px-4 py-1.5 text-[12px] bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",children:[m.jsx(Qc,{size:12}),c.action.label]}):f?m.jsxs("button",{type:"button",onClick:a,className:"flex items-center gap-1.5 px-4 py-1.5 text-[12px] bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",children:[m.jsx(Kc,{size:12}),"완료"]}):m.jsxs("button",{type:"button",onClick:()=>u(y=>y+1),className:"flex items-center gap-1.5 px-3 py-1.5 text-[12px] bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors",children:["다음",m.jsx(BJ,{size:12})]})]})]})})}function Nae({onClick:r}){return m.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-1.5 px-2.5 py-1 text-[11px] text-primary border border-primary/30 rounded-md hover:bg-primary/5 cursor-pointer transition-colors",children:[m.jsx(tH,{size:11}),"가이드 따라하기"]})}const Lae={channel:"coupang",estimatedMinutes:5,steps:[{title:"WING 포털 로그인",description:`쿠팡 WING(wing.coupang.com)에 로그인한 뒤 '추가판매정보' 페이지로 이동합니다.
|
|
302
302
|
좌측 사이드바 → '판매자정보' → '추가판매정보'를 클릭하세요.`,link:{url:"https://wing.coupang.com/tenants/wing-account/vendor/confirm-password?redirect=%2Ftenants%2Fwing-account%2Fextravendorinfo%2Findex",label:"WING 포털 열기"}},{title:"OPEN API 키 발급",description:"페이지 하단의 'OPEN API 키 발급' 섹션에서 'API Key 발급 받기' 버튼을 클릭합니다."},{title:"약관 동의 및 설정",description:`팝업에서 '키의 사용 목적' → 'OPEN API'를 선택하고 확인을 누릅니다.
|
|
@@ -358,7 +358,7 @@ https://shopport.vercel.app/api/callback/cafe24
|
|
|
358
358
|
또는 아래 링크를 직접 클릭하세요.`,link:{url:"https://shopping-seller.toss.im/integration-key",label:"연동 키 관리 열기"}},{title:"Client ID · Secret 확인",description:`연동 키 관리 페이지에서 발급된 Client ID와 Client Secret을 확인합니다.
|
|
359
359
|
아직 키가 없다면 '키 발급' 버튼을 클릭하여 새로 생성하세요.`},{title:"자격증명 입력",description:`확인한 Client ID와 Client Secret을 아래 입력란에 붙여넣으세요.
|
|
360
360
|
저장 후 액세스 토큰이 자동으로 발급·갱신됩니다.`,inputFields:["clientId","clientSecret"]}]},WC={coupang:Lae,smartstore:kae,cafe24:Rae,shopify:Eae,"toss-shopping":Iae};function TP(r){return r in WC}let OD=null;const YC=new Set;function EH(){for(const r of YC)r()}function CP(r){OD=r,EH()}function Vw(){OD=null,EH()}function Oae(){return Y.useSyncExternalStore(r=>(YC.add(r),()=>YC.delete(r)),()=>OD,()=>null)}function AP(r){return n1[r]?{schema:n1[r],group:"channels"}:HC[r]?{schema:HC[r],group:"sourceChannels"}:FC[r]?{schema:FC[r],group:"trendChannels"}:UC[r]?{schema:UC[r],group:"logisticsChannels"}:null}function IH({field:r,value:e,onChange:t}){return m.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[140px_1fr] items-start gap-3",children:[m.jsxs("span",{className:Qe("text-[12px] text-right pt-1.5 leading-tight",r.optional?"text-muted-foreground/60":"text-muted-foreground"),children:[r.label,r.optional&&m.jsx("span",{className:"ml-1 text-[10px]",children:"(선택)"})]}),m.jsxs("div",{className:"space-y-0.5",children:[r.type==="boolean"?m.jsx("input",{type:"checkbox",checked:!!e,onChange:n=>t(a=>({...a,[r.key]:n.target.checked})),className:"w-4 h-4 accent-primary mt-1.5"}):m.jsx("input",{type:r.type==="password"?"password":r.type==="number"?"number":"text",value:String(e??""),placeholder:r.placeholder??"",onChange:n=>t(a=>({...a,[r.key]:n.target.value})),className:"h-7 px-2 text-[12px] border border-border rounded bg-background w-full font-mono focus:outline-none focus:ring-1 focus:ring-primary/50"}),r.hint&&m.jsx("p",{className:"text-[10px] text-muted-foreground/70 pl-0.5",children:r.hint})]})]})}function Pae({channelKey:r,schema:e,current:t,onSave:n,saving:a,saved:i,oauthUrl:o}){const s=e.fields.filter(_=>!_.readOnly),l=e.fields.filter(_=>_.readOnly),u=s.some(_=>{const S=t[_.key];return S!==void 0&&S!==""&&S!==null}),[c,f]=Y.useState(!e.proxyNote||u),[h,v]=Y.useState(!1),[g,y]=Y.useState(()=>{const _={};for(const S of s){const T=t[S.key];S.type==="boolean"?_[S.key]=!!T:S.type==="number"?_[S.key]=T!==void 0&&T!==""?Number(T):"":_[S.key]=String(T??"")}return _});function b(){if(!s.some(T=>{const C=g[T.key];return C!==""&&C!==void 0})){n({});return}const S={...t};for(const T of s){const C=g[T.key];C!==""&&C!==void 0?S[T.key]=C:delete S[T.key]}n(S)}return m.jsxs("div",{className:"space-y-3",children:[(e.guide||e.cliNote||r&&TP(r))&&m.jsxs("div",{className:"flex items-center gap-4 text-[11px] text-muted-foreground border-b border-border/50 pb-2",children:[r&&TP(r)&&m.jsx(Nae,{onClick:()=>v(!0)}),e.guide&&m.jsxs("a",{href:e.guide,target:"_blank",rel:"noreferrer",className:"flex items-center gap-1 hover:text-foreground transition-colors",children:[m.jsx(Qc,{size:10}),"자격증명 발급"]}),e.cliNote&&m.jsx(mi,{variant:"muted",children:e.cliNote})]}),h&&r&&WC[r]&&m.jsx(Dae,{guide:WC[r],fields:e.fields,values:g,onChangeValues:_=>y(_),onComplete:()=>v(!1),onClose:()=>v(!1),onSave:b,oauthUrl:o}),e.proxyNote&&!c?m.jsxs("div",{className:"flex items-start justify-between gap-4",children:[m.jsx("p",{className:"text-[12px] text-foreground/80",children:e.proxyNote}),m.jsxs("button",{type:"button",onClick:()=>f(!0),className:"shrink-0 flex items-center gap-1.5 px-3 py-1.5 text-[11px] border border-border rounded hover:bg-muted transition-colors",children:[m.jsx(nH,{size:10}),"직접 설정"]})]}):m.jsxs("div",{className:"space-y-2.5",children:[e.proxyNote&&c&&m.jsxs("div",{className:"flex items-center justify-between pb-1 border-b border-border/50",children:[m.jsx("span",{className:"text-[11px] text-muted-foreground",children:"직접 설정 중"}),m.jsxs("button",{type:"button",onClick:()=>f(!1),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground",children:[m.jsx(GC,{size:10})," 공용 키로 전환"]})]}),s.map(_=>m.jsx(IH,{field:_,value:g[_.key]??"",onChange:y},_.key)),l.filter(_=>t[_.key]!==void 0&&t[_.key]!=="").map(_=>m.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[140px_1fr] items-start gap-3",children:[m.jsx("span",{className:"text-[12px] text-right pt-1.5 text-muted-foreground/50",children:_.label}),m.jsx("div",{className:"h-7 px-2 flex items-center",children:m.jsx("span",{className:"text-[12px] font-mono text-muted-foreground/70 truncate",children:_.type==="password"?"••••••••":String(t[_.key])})})]},_.key)),e.ipNote&&m.jsx("div",{className:"py-2.5 px-3 bg-amber-50 dark:bg-amber-950/30 rounded-md border border-amber-200/60 dark:border-amber-800/40",children:e.ipNote.split(`
|
|
361
|
-
`).map((_,S)=>S===0?m.jsx("p",{className:"text-[11px] text-amber-800 dark:text-amber-300",children:_},_):m.jsx("p",{className:"mt-0.5 font-mono text-[12px] font-semibold text-amber-900 dark:text-amber-200 select-all",children:_},_))}),m.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[i&&m.jsxs("span",{className:"text-[11px] text-emerald-600 flex items-center gap-1",children:[m.jsx(Kc,{size:11})," 저장됨"]}),m.jsxs("button",{type:"button",onClick:b,disabled:a,className:"flex items-center gap-1.5 px-3 py-1.5 text-[12px] bg-primary text-primary-foreground rounded hover:bg-primary/90 disabled:opacity-50 transition-colors",children:[m.jsx(wb,{size:11}),a?"저장 중...":"저장"]})]})]})]})}function jae({onSave:r}){const[e,t]=Y.useState(!1),[n,a]=Y.useState(!1),[i,o]=Y.useState("");async function s(){t(!0);try{await r(i?Number(i):null),a(!0),setTimeout(()=>a(!1),2e3)}finally{t(!1)}}return m.jsxs("div",{className:"space-y-3",children:[m.jsx("p",{className:"text-[12px] text-muted-foreground leading-relaxed",children:"스마트스토어 Npay 등급, 카페24 카드 영중소 우대 등 채널별 수수료율이 연 매출 기준으로 결정됩니다."}),m.jsx(IH,{field:{key:"annualRevenue",label:"연 매출 (원)",type:"number",placeholder:"500000000",optional:!0,hint:"대략적인 구간만 맞아도 등급 판정에 충분합니다."},value:i,onChange:l=>{const u=typeof l=="function"?l({annualRevenue:i}):l;o(String(u.annualRevenue??""))}}),m.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[n&&m.jsxs("span",{className:"text-[11px] text-emerald-600 flex items-center gap-1",children:[m.jsx(Kc,{size:11})," 저장됨"]}),m.jsxs("button",{type:"button",onClick:s,disabled:e,className:"flex items-center gap-1.5 px-3 py-1.5 text-[12px] bg-primary text-primary-foreground rounded hover:bg-primary/90 disabled:opacity-50 transition-colors",children:[m.jsx(wb,{size:11}),e?"저장 중...":"저장"]})]})]})}function zae({config:r,onSaveChannel:e,onSaveAnnualRevenue:t,onLoadChannelConfig:n,oauthLinks:a={}}){var _;const i=Oae(),[o,s]=Y.useState(!1),[l,u]=Y.useState(!1),[c,f]=Y.useState(null),[h,v]=Y.useState(!1),g=Y.useCallback(S=>{S.key==="Escape"&&Vw()},[]);if(Y.useEffect(()=>{if(i)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[i,g]),Y.useEffect(()=>{(i==null?void 0:i.type)==="channel"&&n?(f(null),v(!0),n(i.channel).then(S=>f(S??{})).finally(()=>v(!1))):(f(null),v(!1))},[i,n]),!i)return null;const y=i.type==="annualRevenue"?"연 매출 설정":((_=AP(i.channel))==null?void 0:_.schema.label)??i.channel;function b(S,T,C){s(!0),Promise.resolve(e(S,T,C)).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)}).finally(()=>s(!1))}return m.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] bg-black/40 backdrop-blur-sm",onClick:S=>{S.target===S.currentTarget&&Vw()},onKeyDown:()=>{},children:m.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-2xl w-full max-w-[480px] max-h-[70vh] overflow-y-auto",children:[m.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-border sticky top-0 bg-card rounded-t-xl z-10",children:[m.jsx("h3",{className:"text-[14px] font-semibold",children:y}),m.jsx("button",{type:"button",onClick:Vw,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",children:m.jsx(ql,{size:15})})]}),m.jsxs("div",{className:"px-5 py-4",children:[i.type==="annualRevenue"&&m.jsx(jae,{onSave:t}),i.type==="channel"&&(()=>{var C;const S=AP(i.channel);if(!S)return m.jsxs("p",{className:"text-[12px] text-muted-foreground",children:["알 수 없는 채널: ",i.channel]});if(h)return m.jsx("p",{className:"text-[12px] text-muted-foreground py-4 text-center",children:"불러오는 중..."});const T=n?c??{}:((C=r==null?void 0:r[S.group])==null?void 0:C[i.channel])??{};return m.jsx(Pae,{channelKey:i.channel,schema:S.schema,current:T,onSave:M=>b(S.group,i.channel,M),saving:o,saved:l,oauthUrl:a[i.channel]})})()]})]})})}const Qf=10;function Bae({channel:r,dateFrom:e,dateTo:t,fetchOrders:n}){const[a,i]=Y.useState([]),[o,s]=Y.useState(!1),[l,u]=Y.useState(0),c=Y.useRef(n);c.current=n,Y.useEffect(()=>{let v=!1;return s(!0),u(0),c.current({channel:r,from:e,to:t,limit:500}).then(g=>{v||i(g.orders)}).catch(()=>{v||i([])}).finally(()=>{v||s(!1)}),()=>{v=!0}},[r,e,t]);const f=Math.max(1,Math.ceil(a.length/Qf)),h=a.slice(l*Qf,(l+1)*Qf);return m.jsxs("div",{className:"bg-muted/10 border-t border-border/30 px-4 py-3 space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-[12px] font-semibold",children:"주문내역"}),m.jsxs("div",{className:"flex items-center gap-3",children:[a.length>Qf&&m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("button",{type:"button",onClick:()=>u(v=>Math.max(0,v-1)),disabled:l===0,className:"px-2 py-1 text-[11px] border border-border rounded hover:bg-muted/50 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:"←"}),m.jsxs("span",{className:"text-[11px] text-muted-foreground px-1",children:[l*Qf+1,"–",Math.min((l+1)*Qf,a.length)," /"," ",a.length,"건"]}),m.jsx("button",{type:"button",onClick:()=>u(v=>Math.min(f-1,v+1)),disabled:l>=f-1,className:"px-2 py-1 text-[11px] border border-border rounded hover:bg-muted/50 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:"→"})]}),m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[e," ~ ",t," · 총 ",a.length,"건"]})]})]}),o?m.jsx("div",{className:"text-[12px] text-muted-foreground py-3 text-center",children:"불러오는 중…"}):h.length===0?m.jsx("div",{className:"text-[12px] text-muted-foreground py-2",children:"해당 기간 주문 없음"}):m.jsxs(vo,{stickyHeader:!0,children:[m.jsxs(po,{children:[m.jsx(je,{children:"주문일"}),m.jsx(je,{children:"주문번호"}),m.jsx(je,{children:"상품명"}),m.jsx(je,{align:"right",children:"판매가"}),m.jsx(je,{children:"상태"})]}),m.jsx("tbody",{className:"bg-card divide-y divide-border/50",children:h.map((v,g)=>{var y;return m.jsxs("tr",{className:Qe(g%2!==0&&"bg-muted/20"),children:[m.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:v.orderedAt.slice(0,10)}),m.jsx("td",{className:"px-3 py-2 font-mono text-[11px] text-muted-foreground",children:v.channelOrderId.slice(-10)}),m.jsxs("td",{className:"px-3 py-2 max-w-[200px] truncate",children:[((y=v.items[0])==null?void 0:y.productName)??"-",v.items.length>1&&` 외 ${v.items.length-1}건`]}),m.jsx("td",{className:"px-3 py-2 text-right font-medium",children:Ot(v.totalAmount)}),m.jsx("td",{className:"px-3 py-2 text-muted-foreground text-[11px]",children:v.status})]},v.channelOrderId)})})]})]})}function Vae({orderId:r,payDate:e,fetchOrderSettlement:t}){const[n,a]=Y.useState([]),[i,o]=Y.useState(!1),s=Y.useRef(t);return s.current=t,Y.useEffect(()=>{let l=!1;return o(!0),s.current(r,e).then(u=>{l||a(u.elements??[])}).catch(()=>{l||a([])}).finally(()=>{l||o(!1)}),()=>{l=!0}},[r,e]),i?m.jsx("div",{className:"text-[11px] text-muted-foreground py-2 pl-4",children:"건별 정산 조회 중…"}):n.length?m.jsx("div",{className:"border-t border-border/40 bg-muted/10",children:m.jsxs("table",{className:"w-full text-[11px]",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"text-[10px] text-muted-foreground/70",children:[m.jsx("th",{className:"px-4 py-1 text-left",children:"상품주문번호"}),m.jsx("th",{className:"px-3 py-1 text-left",children:"상품명"}),m.jsx("th",{className:"px-3 py-1 text-right",children:"결제금액"}),m.jsx("th",{className:"px-3 py-1 text-right",children:"수수료"}),m.jsx("th",{className:"px-3 py-1 text-right",children:"실수령"}),m.jsx("th",{className:"px-3 py-1 text-left",children:"정산완료일"})]})}),m.jsx("tbody",{children:n.map((l,u)=>{var c;return m.jsxs("tr",{className:Qe(u%2!==0&&"bg-muted/20"),children:[m.jsx("td",{className:"px-4 py-1 font-mono text-[10px] text-muted-foreground",children:((c=l.productOrderId)==null?void 0:c.slice(-10))??"-"}),m.jsx("td",{className:"px-3 py-1 max-w-[160px] truncate text-muted-foreground",children:l.productName??"-"}),m.jsx("td",{className:"px-3 py-1 text-right",children:Ot(l.paySettleAmount)}),m.jsx("td",{className:"px-3 py-1 text-right text-red-600 dark:text-red-400",children:l.totalPayCommissionAmount!=null?Ot(Math.abs(l.totalPayCommissionAmount)):"-"}),m.jsx("td",{className:"px-3 py-1 text-right text-emerald-600 dark:text-emerald-400 font-medium",children:Ot(l.settleExpectAmount)}),m.jsx("td",{className:"px-3 py-1 text-muted-foreground",children:l.settleCompleteDate??"-"})]},u)})})]})}):m.jsx("div",{className:"text-[11px] text-muted-foreground py-2 pl-4",children:"건별 정산 내역 없음"})}const Jf=10;function Gae({dateFrom:r,dateTo:e,fetchOrders:t,fetchOrderSettlement:n}){const[a,i]=Y.useState([]),[o,s]=Y.useState(!1),[l,u]=Y.useState(new Set),[c,f]=Y.useState(0),h=Y.useRef(t);h.current=t,Y.useEffect(()=>{let S=!1;return s(!0),f(0),h.current({channel:"smartstore",from:r,to:e,limit:500}).then(T=>{S||i(T.orders)}).catch(()=>{S||i([])}).finally(()=>{S||s(!1)}),()=>{S=!0}},[r,e]);const v=Math.max(1,Math.ceil(a.length/Jf)),g=a.slice(c*Jf,(c+1)*Jf);function y(S){u(T=>{const C=new Set(T);return C.has(S)?C.delete(S):C.add(S),C})}const b=!!n,_=b?"주문내역 (클릭 시 실정산내역)":"주문내역";return m.jsxs("div",{className:"bg-muted/10 border-t border-border/30 px-4 py-3 space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-[12px] font-semibold",children:_}),m.jsxs("div",{className:"flex items-center gap-3",children:[a.length>Jf&&m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("button",{type:"button",onClick:()=>{f(S=>Math.max(0,S-1)),u(new Set)},disabled:c===0,className:"px-2 py-1 text-[11px] border border-border rounded hover:bg-muted/50 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:"←"}),m.jsxs("span",{className:"text-[11px] text-muted-foreground px-1",children:[c*Jf+1,"–",Math.min((c+1)*Jf,a.length)," /"," ",a.length,"건"]}),m.jsx("button",{type:"button",onClick:()=>{f(S=>Math.min(v-1,S+1)),u(new Set)},disabled:c>=v-1,className:"px-2 py-1 text-[11px] border border-border rounded hover:bg-muted/50 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:"→"})]}),m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[r," ~ ",e," · 총 ",a.length,"건"]})]})]}),o?m.jsx("div",{className:"text-[12px] text-muted-foreground py-3 text-center",children:"불러오는 중…"}):g.length===0?m.jsx("div",{className:"text-[12px] text-muted-foreground py-2",children:"해당 기간 주문 없음"}):m.jsxs(vo,{stickyHeader:!0,children:[m.jsxs(po,{children:[m.jsx(je,{children:"주문일"}),m.jsx(je,{children:"주문번호"}),m.jsx(je,{children:"상품명"}),m.jsx(je,{align:"right",children:"판매가"}),m.jsx(je,{children:"상태"})]}),m.jsx("tbody",{className:"bg-card divide-y divide-border/50",children:g.map((S,T)=>{var D;const C=S.channelOrderId,M=l.has(C);return m.jsxs(Y.Fragment,{children:[m.jsxs("tr",{className:Qe(T%2!==0&&"bg-muted/20",b&&"cursor-pointer hover:bg-muted/30 transition-colors"),onClick:b?()=>y(C):void 0,onKeyDown:b?L=>{(L.key==="Enter"||L.key===" ")&&y(C)}:void 0,tabIndex:b?0:void 0,children:[m.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:S.orderedAt.slice(0,10)}),m.jsx("td",{className:"px-3 py-2 font-mono text-[11px] text-muted-foreground",children:b?m.jsxs("span",{className:"inline-flex items-center gap-1",children:[M?m.jsx(cn,{size:11,className:"shrink-0"}):m.jsx(qr,{size:11,className:"shrink-0"}),C.slice(-10)]}):C.slice(-10)}),m.jsxs("td",{className:"px-3 py-2 max-w-[200px] truncate",children:[((D=S.items[0])==null?void 0:D.productName)??"-",S.items.length>1&&` 외 ${S.items.length-1}건`]}),m.jsx("td",{className:"px-3 py-2 text-right font-medium",children:Ot(S.totalAmount)}),m.jsx("td",{className:"px-3 py-2 text-muted-foreground text-[11px]",children:S.status})]}),M&&n&&m.jsx("tr",{children:m.jsx("td",{colSpan:5,className:"p-0",children:m.jsx(Vae,{orderId:C,payDate:S.orderedAt.slice(0,10),fetchOrderSettlement:n})})})]},C)})})]})]})}function Hae({data:r,isLoading:e}){if(e)return m.jsx("div",{className:"text-[12px] text-muted-foreground py-4",children:"조회 중…"});if(!r)return null;const t=Array.isArray(r)?r:r.data??[];return t.length?m.jsxs(vo,{stickyHeader:!0,children:[m.jsxs(po,{children:[m.jsx(je,{children:"매출인식월"}),m.jsx(je,{align:"right",children:"정산대상금액"}),m.jsx(je,{align:"right",children:"서비스수수료"}),m.jsx(je,{align:"right",children:"공제금액"}),m.jsx(je,{align:"right",children:"최종 정산금액"}),m.jsx(je,{children:"정산예정일"})]}),m.jsx("tbody",{className:"bg-card divide-y divide-border/50",children:t.map((n,a)=>m.jsxs("tr",{className:Qe(a%2!==0&&"bg-muted/20"),children:[m.jsx("td",{className:"px-3 py-2 font-medium",children:n.revenueRecognitionMonth??"-"}),m.jsx("td",{className:"px-3 py-2 text-right",children:Ot(n.settlementTargetAmount)}),m.jsx("td",{className:"px-3 py-2 text-right text-red-600 dark:text-red-400",children:n.serviceFee!=null?Ot(Math.abs(n.serviceFee)):"-"}),m.jsx("td",{className:"px-3 py-2 text-right text-muted-foreground",children:n.deductionAmount!=null?Ot(Math.abs(n.deductionAmount)):"-"}),m.jsx("td",{className:"px-3 py-2 text-right font-medium text-emerald-600 dark:text-emerald-400",children:Ot(n.finalSettlementAmount)}),m.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:n.settlementDate??n.finalSettlementDate??"-"})]},a))})]}):m.jsx("div",{className:"text-[12px] text-muted-foreground py-2",children:"해당 월 정산 내역 없음"})}function Fae({data:r,isLoading:e}){if(e)return m.jsx("div",{className:"text-[12px] text-muted-foreground py-4",children:"조회 중… (매출인식일별 조회로 시간이 걸릴 수 있습니다)"});if(!r)return null;const{items:t,totalActual:n,totalPredicted:a,totalDiff:i,accuracy:o,scannedDates:s}=r;if(!t.length)return m.jsx("div",{className:"text-[12px] text-muted-foreground py-2",children:"해당 기간 매출인식 데이터 없음 — 구매확정 주문이 있는지 확인하세요"});const l=o>=99?"text-emerald-600 dark:text-emerald-400":o>=95?"text-amber-600":"text-red-600";return m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:[m.jsx(bn,{label:"실 정산 합계",value:Ot(n)}),m.jsx(bn,{label:"예상 정산 합계",value:Ot(a)}),m.jsx(bn,{label:"예측 정확도",value:`${o.toFixed(1)}%`,sub:i!==0?`실정산이 예상보다 ${i>0?"+":""}${Ot(i)}`:"완전 일치",accent:o>=99})]}),m.jsxs(vo,{stickyHeader:!0,children:[m.jsxs(po,{children:[m.jsx(je,{children:"주문번호"}),m.jsx(je,{children:"상품명"}),m.jsx(je,{align:"right",children:"결제금액"}),m.jsx(je,{align:"right",children:"실정산"}),m.jsx(je,{align:"right",children:"예상정산"}),m.jsx(je,{align:"right",children:"차이"})]}),m.jsx("tbody",{className:"bg-card divide-y divide-border/50",children:t.map((u,c)=>m.jsxs("tr",{className:Qe(c%2!==0&&"bg-muted/20"),children:[m.jsx("td",{className:"px-3 py-2 font-mono text-[11px] text-muted-foreground",children:u.orderId.slice(-10)}),m.jsx("td",{className:"px-3 py-2 max-w-[180px] truncate",children:u.productName}),m.jsx("td",{className:"px-3 py-2 text-right",children:Ot(u.gross)}),m.jsx("td",{className:"px-3 py-2 text-right font-medium",children:Ot(u.actual)}),m.jsx("td",{className:"px-3 py-2 text-right text-muted-foreground",children:Ot(u.predicted)}),m.jsxs("td",{className:Qe("px-3 py-2 text-right",Math.abs(u.diff)>500?"text-amber-600 font-medium":"text-muted-foreground"),children:[u.diff>=0?"+":"",Ot(u.diff)]})]},c))})]}),m.jsxs("p",{className:Qe("text-[11px]",l),children:["예측 정확도 ",o.toFixed(1),"% · ",s,"개 매출인식일 조회"]})]})}function Uae({dateFrom:r,dateTo:e,fetchMonthly:t,fetchReconcile:n}){const a=(r||new Date().toISOString()).slice(0,7),[i,o]=Y.useState(a),[s,l]=Y.useState("monthly"),[u,c]=Y.useState(void 0),[f,h]=Y.useState(!1),[v,g]=Y.useState(void 0),[y,b]=Y.useState(!1),_=Y.useRef(t);_.current=t;const S=Y.useRef(n);return S.current=n,Y.useEffect(()=>{if(s!=="monthly")return;let T=!1;return h(!0),_.current(i).then(C=>{T||c(C)}).catch(()=>{T||c(void 0)}).finally(()=>{T||h(!1)}),()=>{T=!0}},[s,i]),Y.useEffect(()=>{if(s!=="reconcile")return;let T=!1;return b(!0),S.current(r,e).then(C=>{T||g(C)}).catch(()=>{T||g(void 0)}).finally(()=>{T||b(!1)}),()=>{T=!0}},[s,r,e]),m.jsxs("div",{className:"bg-muted/10 border-t border-border/30 px-4 py-4 space-y-3",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-[12px] font-semibold",children:"쿠팡 실정산"}),m.jsx("span",{className:"text-[11px] text-muted-foreground",children:"쿠팡 Wing API 직접 조회"})]}),m.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[m.jsx("div",{className:"flex rounded border border-border overflow-hidden text-[11px]",children:["monthly","reconcile"].map(T=>m.jsx("button",{type:"button",onClick:()=>l(T),className:Qe("px-3 py-1 transition-colors",s===T?"bg-primary text-primary-foreground":"hover:bg-muted/50 text-muted-foreground"),children:T==="monthly"?"월별 정산":"예상 비교"},T))}),s==="monthly"&&m.jsx("input",{type:"month",value:i,onChange:T=>o(T.target.value),className:"h-7 px-2 border border-border rounded bg-background text-[12px] focus:outline-none focus:ring-1 focus:ring-primary/50"}),s==="reconcile"&&m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[r," ~ ",e," 기간 조회"]})]}),s==="monthly"&&m.jsx(Hae,{data:u,isLoading:f}),s==="reconcile"&&m.jsx(Fae,{data:v,isLoading:y})]})}function Wae({nav:r,activeId:e,onNavigate:t,renderLink:n,email:a,appLabel:i,onLogout:o,workspaces:s,activeWorkspaceId:l,onSwitchWorkspace:u,mobileOpen:c,onMobileClose:f,footerSlot:h}){const[v,g]=Y.useState(!1),[y,b]=Y.useState(!1),_=s==null?void 0:s.find(D=>D.id===l),[S,T]=Y.useState(e);e!==S&&(T(e),c&&(f==null||f()));async function C(D){D===l||!u||(b(!0),g(!1),await u(D),b(!1))}const M=m.jsxs("nav",{className:"w-[220px] border-r border-border flex flex-col shrink-0 h-screen overflow-y-auto bg-background",children:[m.jsxs("div",{className:"px-4 py-4 border-b border-border flex items-center gap-2",children:[m.jsx("img",{src:"/shopport-logo-type.svg",alt:"shopport",className:"h-[18px]"}),i&&m.jsxs("span",{className:"text-[11px] text-muted-foreground font-normal",children:[i," beta"]})]}),s&&s.length>0&&m.jsxs("div",{className:"relative border-b border-border",children:[m.jsxs("button",{type:"button",onClick:()=>g(D=>!D),disabled:y,className:"w-full flex items-center justify-between px-4 py-2.5 text-[12px] hover:bg-muted/40 transition-colors disabled:opacity-50",children:[m.jsx("span",{className:"truncate text-foreground font-medium",children:y?"전환 중...":(_==null?void 0:_.name)??"워크스페이스"}),m.jsx(cn,{size:12,className:Qe("text-muted-foreground shrink-0 transition-transform",v&&"rotate-180")})]}),v&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>g(!1),"aria-hidden":"true"}),m.jsx("div",{className:"absolute left-0 right-0 top-full bg-background border border-border shadow-md z-50 rounded-b-md overflow-hidden",children:s.map(D=>m.jsxs("button",{type:"button",onClick:()=>C(D.id),className:"w-full flex items-center justify-between px-4 py-2 text-[12px] hover:bg-muted transition-colors",children:[m.jsx("span",{className:"truncate",children:D.name}),D.id===l&&m.jsx(Kc,{size:11,className:"text-primary shrink-0"})]},D.id))})]})]}),m.jsx("div",{className:"flex-1 py-2",children:r.map(D=>D.type==="section"?m.jsx("div",{className:"px-4 pt-4 pb-1 text-[11px] font-medium text-muted-foreground/60 uppercase tracking-wider",children:D.label},D.label):m.jsx(Yae,{item:D,isActive:D.id===e,onNavigate:t,renderLink:n},D.id))}),h&&m.jsx("div",{className:"border-t border-border px-4 py-2",children:h}),m.jsxs("div",{className:"border-t border-border",children:[a&&m.jsx("div",{className:"px-4 pt-3 pb-1 text-[11px] text-muted-foreground truncate",children:a}),o&&m.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-2 w-full px-4 py-2.5 text-[12px] text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[m.jsx(See,{size:12}),"로그아웃"]})]})]});return m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"hidden md:block sticky top-0 h-screen shrink-0",children:M}),c&&m.jsxs("div",{className:"fixed inset-0 z-50 md:hidden",children:[m.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:f,"aria-hidden":"true"}),m.jsx("div",{className:"relative z-10 h-full",children:M})]})]})}function Yae({item:r,isActive:e,onNavigate:t,renderLink:n}){const a=r.icon,i=Qe("flex items-center gap-2.5 w-full px-4 py-2 text-[13px] text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",e&&"bg-muted text-foreground font-medium"),o=m.jsxs(m.Fragment,{children:[m.jsx(a,{size:14}),r.label]});return n?n(r.id,o,i):m.jsx("button",{type:"button",onClick:()=>t==null?void 0:t(r.id),className:i,children:o})}function $ae(){const{data:r,refetch:e}=QG();async function t(a,i,o){if(!r)return;const s={...r[a]};Object.keys(o).length>0?s[i]={...o,channel:i}:delete s[i],await EC({...r,[a]:s}),e()}async function n(a){r&&(await EC({...r,settlement:{...r.settlement??{},annualRevenue:a??void 0}}),e())}return m.jsx(zae,{config:r,onSaveChannel:t,onSaveAnnualRevenue:n})}function Xae(){const{isLoading:r,data:e}=vb(),{data:t,isLoading:n}=dZ();return m.jsx(mae,{executions:(t==null?void 0:t.executions)??{},channelData:(t==null?void 0:t.channelData)??{},settlementData:(t==null?void 0:t.settlementData)??{},channelStatuses:(e==null?void 0:e.channels)??[],onConnect:()=>{window.location.hash="config"},isLoading:r||n})}const PD="-",qae=r=>{const e=Kae(r),{conflictingClassGroups:t,conflictingClassGroupModifiers:n}=r;return{getClassGroupId:o=>{const s=o.split(PD);return s[0]===""&&s.length!==1&&s.shift(),OH(s,e)||Zae(o)},getConflictingClassGroupIds:(o,s)=>{const l=t[o]||[];return s&&n[o]?[...l,...n[o]]:l}}},OH=(r,e)=>{var o;if(r.length===0)return e.classGroupId;const t=r[0],n=e.nextPart.get(t),a=n?OH(r.slice(1),n):void 0;if(a)return a;if(e.validators.length===0)return;const i=r.join(PD);return(o=e.validators.find(({validator:s})=>s(i)))==null?void 0:o.classGroupId},MP=/^\[(.+)\]$/,Zae=r=>{if(MP.test(r)){const e=MP.exec(r)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},Kae=r=>{const{theme:e,prefix:t}=r,n={nextPart:new Map,validators:[]};return Jae(Object.entries(r.classGroups),t).forEach(([i,o])=>{$C(o,n,i,e)}),n},$C=(r,e,t,n)=>{r.forEach(a=>{if(typeof a=="string"){const i=a===""?e:DP(e,a);i.classGroupId=t;return}if(typeof a=="function"){if(Qae(a)){$C(a(n),e,t,n);return}e.validators.push({validator:a,classGroupId:t});return}Object.entries(a).forEach(([i,o])=>{$C(o,DP(e,i),t,n)})})},DP=(r,e)=>{let t=r;return e.split(PD).forEach(n=>{t.nextPart.has(n)||t.nextPart.set(n,{nextPart:new Map,validators:[]}),t=t.nextPart.get(n)}),t},Qae=r=>r.isThemeGetter,Jae=(r,e)=>e?r.map(([t,n])=>{const a=n.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,s])=>[e+o,s])):i);return[t,a]}):r,eie=r=>{if(r<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,n=new Map;const a=(i,o)=>{t.set(i,o),e++,e>r&&(e=0,n=t,t=new Map)};return{get(i){let o=t.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return a(i,o),o},set(i,o){t.has(i)?t.set(i,o):a(i,o)}}},PH="!",tie=r=>{const{separator:e,experimentalParseClassName:t}=r,n=e.length===1,a=e[0],i=e.length,o=s=>{const l=[];let u=0,c=0,f;for(let b=0;b<s.length;b++){let _=s[b];if(u===0){if(_===a&&(n||s.slice(b,b+i)===e)){l.push(s.slice(c,b)),c=b+i;continue}if(_==="/"){f=b;continue}}_==="["?u++:_==="]"&&u--}const h=l.length===0?s:s.substring(c),v=h.startsWith(PH),g=v?h.substring(1):h,y=f&&f>c?f-c:void 0;return{modifiers:l,hasImportantModifier:v,baseClassName:g,maybePostfixModifierPosition:y}};return t?s=>t({className:s,parseClassName:o}):o},rie=r=>{if(r.length<=1)return r;const e=[];let t=[];return r.forEach(n=>{n[0]==="["?(e.push(...t.sort(),n),t=[]):t.push(n)}),e.push(...t.sort()),e},nie=r=>({cache:eie(r.cacheSize),parseClassName:tie(r),...qae(r)}),aie=/\s+/,iie=(r,e)=>{const{parseClassName:t,getClassGroupId:n,getConflictingClassGroupIds:a}=e,i=[],o=r.trim().split(aie);let s="";for(let l=o.length-1;l>=0;l-=1){const u=o[l],{modifiers:c,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:v}=t(u);let g=!!v,y=n(g?h.substring(0,v):h);if(!y){if(!g){s=u+(s.length>0?" "+s:s);continue}if(y=n(h),!y){s=u+(s.length>0?" "+s:s);continue}g=!1}const b=rie(c).join(":"),_=f?b+PH:b,S=_+y;if(i.includes(S))continue;i.push(S);const T=a(y,g);for(let C=0;C<T.length;++C){const M=T[C];i.push(_+M)}s=u+(s.length>0?" "+s:s)}return s};function oie(){let r=0,e,t,n="";for(;r<arguments.length;)(e=arguments[r++])&&(t=jH(e))&&(n&&(n+=" "),n+=t);return n}const jH=r=>{if(typeof r=="string")return r;let e,t="";for(let n=0;n<r.length;n++)r[n]&&(e=jH(r[n]))&&(t&&(t+=" "),t+=e);return t};function sie(r,...e){let t,n,a,i=o;function o(l){const u=e.reduce((c,f)=>f(c),r());return t=nie(u),n=t.cache.get,a=t.cache.set,i=s,s(l)}function s(l){const u=n(l);if(u)return u;const c=iie(l,t);return a(l,c),c}return function(){return i(oie.apply(null,arguments))}}const ur=r=>{const e=t=>t[r]||[];return e.isThemeGetter=!0,e},zH=/^\[(?:([a-z-]+):)?(.+)\]$/i,lie=/^\d+\/\d+$/,uie=new Set(["px","full","screen"]),cie=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,fie=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,die=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,hie=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,vie=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ho=r=>Ud(r)||uie.has(r)||lie.test(r),il=r=>Lh(r,"length",Sie),Ud=r=>!!r&&!Number.isNaN(Number(r)),Gw=r=>Lh(r,"number",Ud),ep=r=>!!r&&Number.isInteger(Number(r)),pie=r=>r.endsWith("%")&&Ud(r.slice(0,-1)),St=r=>zH.test(r),ol=r=>cie.test(r),gie=new Set(["length","size","percentage"]),mie=r=>Lh(r,gie,BH),yie=r=>Lh(r,"position",BH),xie=new Set(["image","url"]),bie=r=>Lh(r,xie,Tie),_ie=r=>Lh(r,"",wie),tp=()=>!0,Lh=(r,e,t)=>{const n=zH.exec(r);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):t(n[2]):!1},Sie=r=>fie.test(r)&&!die.test(r),BH=()=>!1,wie=r=>hie.test(r),Tie=r=>vie.test(r),Cie=()=>{const r=ur("colors"),e=ur("spacing"),t=ur("blur"),n=ur("brightness"),a=ur("borderColor"),i=ur("borderRadius"),o=ur("borderSpacing"),s=ur("borderWidth"),l=ur("contrast"),u=ur("grayscale"),c=ur("hueRotate"),f=ur("invert"),h=ur("gap"),v=ur("gradientColorStops"),g=ur("gradientColorStopPositions"),y=ur("inset"),b=ur("margin"),_=ur("opacity"),S=ur("padding"),T=ur("saturate"),C=ur("scale"),M=ur("sepia"),D=ur("skew"),L=ur("space"),k=ur("translate"),R=()=>["auto","contain","none"],E=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto",St,e],z=()=>[St,e],j=()=>["",Ho,il],G=()=>["auto",Ud,St],U=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],O=()=>["solid","dashed","dotted","double","none"],H=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>["start","end","center","between","around","evenly","stretch"],$=()=>["","0",St],B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],X=()=>[Ud,St];return{cacheSize:500,separator:":",theme:{colors:[tp],spacing:[Ho,il],blur:["none","",ol,St],brightness:X(),borderColor:[r],borderRadius:["none","","full",ol,St],borderSpacing:z(),borderWidth:j(),contrast:X(),grayscale:$(),hueRotate:X(),invert:$(),gap:z(),gradientColorStops:[r],gradientColorStopPositions:[pie,il],inset:I(),margin:I(),opacity:X(),padding:z(),saturate:X(),scale:X(),sepia:$(),skew:X(),space:z(),translate:z()},classGroups:{aspect:[{aspect:["auto","square","video",St]}],container:["container"],columns:[{columns:[ol]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...U(),St]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ep,St]}],basis:[{basis:I()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",St]}],grow:[{grow:$()}],shrink:[{shrink:$()}],order:[{order:["first","last","none",ep,St]}],"grid-cols":[{"grid-cols":[tp]}],"col-start-end":[{col:["auto",{span:["full",ep,St]},St]}],"col-start":[{"col-start":G()}],"col-end":[{"col-end":G()}],"grid-rows":[{"grid-rows":[tp]}],"row-start-end":[{row:["auto",{span:[ep,St]},St]}],"row-start":[{"row-start":G()}],"row-end":[{"row-end":G()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",St]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",St]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...F()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...F(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...F(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[S]}],px:[{px:[S]}],py:[{py:[S]}],ps:[{ps:[S]}],pe:[{pe:[S]}],pt:[{pt:[S]}],pr:[{pr:[S]}],pb:[{pb:[S]}],pl:[{pl:[S]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[L]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[L]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",St,e]}],"min-w":[{"min-w":[St,e,"min","max","fit"]}],"max-w":[{"max-w":[St,e,"none","full","min","max","fit","prose",{screen:[ol]},ol]}],h:[{h:[St,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[St,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[St,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[St,e,"auto","min","max","fit"]}],"font-size":[{text:["base",ol,il]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Gw]}],"font-family":[{font:[tp]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",St]}],"line-clamp":[{"line-clamp":["none",Ud,Gw]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ho,St]}],"list-image":[{"list-image":["none",St]}],"list-style-type":[{list:["none","disc","decimal",St]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[r]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[r]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ho,il]}],"underline-offset":[{"underline-offset":["auto",Ho,St]}],"text-decoration-color":[{decoration:[r]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",St]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",St]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...U(),yie]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",mie]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},bie]}],"bg-color":[{bg:[r]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...O(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:O()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...O()]}],"outline-offset":[{"outline-offset":[Ho,St]}],"outline-w":[{outline:[Ho,il]}],"outline-color":[{outline:[r]}],"ring-w":[{ring:j()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[r]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Ho,il]}],"ring-offset-color":[{"ring-offset":[r]}],shadow:[{shadow:["","inner","none",ol,_ie]}],"shadow-color":[{shadow:[tp]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...H(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":H()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[n]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",ol,St]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[f]}],saturate:[{saturate:[T]}],sepia:[{sepia:[M]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",St]}],duration:[{duration:X()}],ease:[{ease:["linear","in","out","in-out",St]}],delay:[{delay:X()}],animate:[{animate:["none","spin","ping","pulse","bounce",St]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[ep,St]}],"translate-x":[{"translate-x":[k]}],"translate-y":[{"translate-y":[k]}],"skew-x":[{"skew-x":[D]}],"skew-y":[{"skew-y":[D]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",St]}],accent:[{accent:["auto",r]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",St]}],"caret-color":[{caret:[r]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",St]}],fill:[{fill:[r,"none"]}],"stroke-w":[{stroke:[Ho,il,Gw]}],stroke:[{stroke:[r,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Aie=sie(Cie);function zr(...r){return Aie(e6(r))}function Dd({channelKey:r,schema:e,current:t,onSave:n,saving:a,saved:i}){const o=e.fields.filter(_=>!_.readOnly),s=e.fields.filter(_=>_.readOnly),l=o.some(_=>{const S=t[_.key];return S!==void 0&&S!==""&&S!==null}),u=o.some(_=>{const S=t[_.key];return S!==void 0&&S!==""&&S!==null}),[c,f]=Y.useState(l),[h,v]=Y.useState(!e.proxyNote||u),[g,y]=Y.useState(()=>{const _={};for(const S of o){const T=t[S.key];S.type==="boolean"?_[S.key]=!!T:S.type==="number"?_[S.key]=T!==void 0&&T!==""?Number(T):"":_[S.key]=String(T??"")}return _});function b(){if(!o.some(T=>{const C=g[T.key];return C!==""&&C!==void 0})){n({});return}const S={...t};for(const T of o){const C=g[T.key];C!==""&&C!==void 0?S[T.key]=C:delete S[T.key]}n(S)}return m.jsxs("div",{id:r?`cfg-ch-${r}`:void 0,className:"border border-border rounded-lg overflow-hidden bg-card scroll-mt-4",children:[m.jsxs("button",{type:"button",onClick:()=>f(_=>!_),className:"w-full flex items-center justify-between px-4 py-2.5 text-[13px] hover:bg-muted/30 transition-colors",children:[m.jsxs("span",{className:"flex items-center gap-2",children:[c?m.jsx(cn,{size:13,className:"text-muted-foreground"}):m.jsx(qr,{size:13,className:"text-muted-foreground"}),m.jsx("span",{className:"font-medium",children:e.label}),l&&m.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 shrink-0"})]}),m.jsx("span",{className:"text-[11px] text-muted-foreground",children:l?m.jsx("span",{className:"text-emerald-600",children:"연결됨"}):e.proxyNote&&!u?m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx(GC,{size:10})," 공용 키"]}):null})]}),c&&m.jsxs("div",{className:"border-t border-border bg-muted/10",children:[(e.guide||e.cliNote)&&m.jsxs("div",{className:"px-4 pt-3 pb-2 flex items-center gap-4 text-[11px] text-muted-foreground border-b border-border/50",children:[e.guide&&m.jsxs("a",{href:e.guide,target:"_blank",rel:"noreferrer",className:"flex items-center gap-1 hover:text-foreground transition-colors",onClick:_=>_.stopPropagation(),children:[m.jsx(Qc,{size:10}),"자격증명 발급"]}),e.cliNote&&m.jsx("code",{className:"font-mono text-[10px] bg-muted px-1.5 py-0.5 rounded text-foreground/70",children:e.cliNote})]}),e.proxyNote&&!h?m.jsxs("div",{className:"px-4 py-4 flex items-start justify-between gap-4",children:[m.jsx("div",{className:"space-y-1",children:m.jsx("p",{className:"text-[12px] text-foreground/80",children:e.proxyNote})}),m.jsxs("button",{type:"button",onClick:()=>v(!0),className:"shrink-0 flex items-center gap-1.5 px-3 py-1.5 text-[11px] border border-border rounded hover:bg-muted transition-colors",children:[m.jsx(nH,{size:10}),"직접 설정"]})]}):m.jsxs("div",{className:"px-4 py-4 space-y-2.5",children:[e.proxyNote&&h&&m.jsxs("div",{className:"flex items-center justify-between pb-1 border-b border-border/50",children:[m.jsx("span",{className:"text-[11px] text-muted-foreground",children:"직접 설정 중"}),m.jsxs("button",{type:"button",onClick:()=>v(!1),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground",children:[m.jsx(GC,{size:10})," 공용 키로 전환"]})]}),o.map(_=>m.jsxs("div",{className:"grid grid-cols-[190px_1fr] items-start gap-3",children:[m.jsxs("span",{className:zr("text-[12px] text-right pt-1.5 leading-tight",_.optional?"text-muted-foreground/60":"text-muted-foreground"),children:[_.label,_.optional&&m.jsx("span",{className:"ml-1 text-[10px]",children:"(선택)"})]}),m.jsxs("div",{className:"space-y-0.5",children:[_.type==="boolean"?m.jsx("input",{type:"checkbox",checked:!!g[_.key],onChange:S=>y(T=>({...T,[_.key]:S.target.checked})),className:"w-4 h-4 accent-primary mt-1.5"}):m.jsx("input",{type:_.type==="password"?"password":_.type==="number"?"number":"text",value:String(g[_.key]??""),placeholder:_.placeholder??"",onChange:S=>y(T=>({...T,[_.key]:S.target.value})),className:"h-7 px-2 text-[12px] border border-border rounded bg-background w-full font-mono focus:outline-none focus:ring-1 focus:ring-primary/50"}),_.hint&&m.jsx("p",{className:"text-[10px] text-muted-foreground/70 pl-0.5",children:_.hint})]})]},_.key)),s.filter(_=>t[_.key]!==void 0&&t[_.key]!=="").map(_=>m.jsxs("div",{className:"grid grid-cols-[190px_1fr] items-start gap-3",children:[m.jsx("span",{className:"text-[12px] text-right pt-1.5 text-muted-foreground/50",children:_.label}),m.jsxs("div",{className:"space-y-0.5",children:[m.jsx("div",{className:"h-7 px-2 flex items-center",children:m.jsx("span",{className:"text-[12px] font-mono text-muted-foreground/70 truncate",children:_.type==="password"?"••••••••":String(t[_.key])})}),_.hint&&m.jsx("p",{className:"text-[10px] text-muted-foreground/50 pl-0.5",children:_.hint})]})]},_.key)),e.ipNote&&m.jsx("div",{className:"py-2.5 px-3 bg-amber-50 dark:bg-amber-950/30 rounded-md border border-amber-200/60 dark:border-amber-800/40",children:e.ipNote.split(`
|
|
361
|
+
`).map((_,S)=>S===0?m.jsx("p",{className:"text-[11px] text-amber-800 dark:text-amber-300",children:_},_):m.jsx("p",{className:"mt-0.5 font-mono text-[12px] font-semibold text-amber-900 dark:text-amber-200 select-all",children:_},_))}),m.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[i&&m.jsxs("span",{className:"text-[11px] text-emerald-600 flex items-center gap-1",children:[m.jsx(Kc,{size:11})," 저장됨"]}),m.jsxs("button",{type:"button",onClick:b,disabled:a,className:"flex items-center gap-1.5 px-3 py-1.5 text-[12px] bg-primary text-primary-foreground rounded hover:bg-primary/90 disabled:opacity-50 transition-colors",children:[m.jsx(wb,{size:11}),a?"저장 중...":"저장"]})]})]})]})}function jae({onSave:r}){const[e,t]=Y.useState(!1),[n,a]=Y.useState(!1),[i,o]=Y.useState("");async function s(){t(!0);try{await r(i?Number(i):null),a(!0),setTimeout(()=>a(!1),2e3)}finally{t(!1)}}return m.jsxs("div",{className:"space-y-3",children:[m.jsx("p",{className:"text-[12px] text-muted-foreground leading-relaxed",children:"스마트스토어 Npay 등급, 카페24 카드 영중소 우대 등 채널별 수수료율이 연 매출 기준으로 결정됩니다."}),m.jsx(IH,{field:{key:"annualRevenue",label:"연 매출 (원)",type:"number",placeholder:"500000000",optional:!0,hint:"대략적인 구간만 맞아도 등급 판정에 충분합니다."},value:i,onChange:l=>{const u=typeof l=="function"?l({annualRevenue:i}):l;o(String(u.annualRevenue??""))}}),m.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[n&&m.jsxs("span",{className:"text-[11px] text-emerald-600 flex items-center gap-1",children:[m.jsx(Kc,{size:11})," 저장됨"]}),m.jsxs("button",{type:"button",onClick:s,disabled:e,className:"flex items-center gap-1.5 px-3 py-1.5 text-[12px] bg-primary text-primary-foreground rounded hover:bg-primary/90 disabled:opacity-50 transition-colors",children:[m.jsx(wb,{size:11}),e?"저장 중...":"저장"]})]})]})}function zae({config:r,onSaveChannel:e,onSaveAnnualRevenue:t,onLoadChannelConfig:n,oauthLinks:a={}}){var _;const i=Oae(),[o,s]=Y.useState(!1),[l,u]=Y.useState(!1),[c,f]=Y.useState(null),[h,v]=Y.useState(!1),g=Y.useCallback(S=>{S.key==="Escape"&&Vw()},[]);if(Y.useEffect(()=>{if(i)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[i,g]),Y.useEffect(()=>{(i==null?void 0:i.type)==="channel"&&n?(f(null),v(!0),n(i.channel).then(S=>f(S??{})).finally(()=>v(!1))):(f(null),v(!1))},[i,n]),!i)return null;const y=i.type==="annualRevenue"?"연 매출 설정":((_=AP(i.channel))==null?void 0:_.schema.label)??i.channel;function b(S,T,C){s(!0),Promise.resolve(e(S,T,C)).then(()=>{u(!0),setTimeout(()=>u(!1),2e3)}).finally(()=>s(!1))}return m.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[15vh] bg-black/40 backdrop-blur-sm",onClick:S=>{S.target===S.currentTarget&&Vw()},onKeyDown:()=>{},children:m.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-2xl w-full max-w-[480px] max-h-[70vh] overflow-y-auto",children:[m.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-border sticky top-0 bg-card rounded-t-xl z-10",children:[m.jsx("h3",{className:"text-[14px] font-semibold",children:y}),m.jsx("button",{type:"button",onClick:Vw,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",children:m.jsx(ql,{size:15})})]}),m.jsxs("div",{className:"px-5 py-4",children:[i.type==="annualRevenue"&&m.jsx(jae,{onSave:t}),i.type==="channel"&&(()=>{var C;const S=AP(i.channel);if(!S)return m.jsxs("p",{className:"text-[12px] text-muted-foreground",children:["알 수 없는 채널: ",i.channel]});if(h)return m.jsx("p",{className:"text-[12px] text-muted-foreground py-4 text-center",children:"불러오는 중..."});const T=n?c??{}:((C=r==null?void 0:r[S.group])==null?void 0:C[i.channel])??{};return m.jsx(Pae,{channelKey:i.channel,schema:S.schema,current:T,onSave:M=>b(S.group,i.channel,M),saving:o,saved:l,oauthUrl:a[i.channel]})})()]})]})})}const Qf=10;function Bae({channel:r,dateFrom:e,dateTo:t,fetchOrders:n}){const[a,i]=Y.useState([]),[o,s]=Y.useState(!1),[l,u]=Y.useState(0),c=Y.useRef(n);c.current=n,Y.useEffect(()=>{let v=!1;return s(!0),u(0),c.current({channel:r,from:e,to:t,limit:500}).then(g=>{v||i(g.orders)}).catch(()=>{v||i([])}).finally(()=>{v||s(!1)}),()=>{v=!0}},[r,e,t]);const f=Math.max(1,Math.ceil(a.length/Qf)),h=a.slice(l*Qf,(l+1)*Qf);return m.jsxs("div",{className:"bg-muted/10 border-t border-border/30 px-4 py-3 space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-[12px] font-semibold",children:"주문내역"}),m.jsxs("div",{className:"flex items-center gap-3",children:[a.length>Qf&&m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("button",{type:"button",onClick:()=>u(v=>Math.max(0,v-1)),disabled:l===0,className:"px-2 py-1 text-[11px] border border-border rounded hover:bg-muted/50 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:"←"}),m.jsxs("span",{className:"text-[11px] text-muted-foreground px-1",children:[l*Qf+1,"–",Math.min((l+1)*Qf,a.length)," /"," ",a.length,"건"]}),m.jsx("button",{type:"button",onClick:()=>u(v=>Math.min(f-1,v+1)),disabled:l>=f-1,className:"px-2 py-1 text-[11px] border border-border rounded hover:bg-muted/50 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:"→"})]}),m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[e," ~ ",t," · 총 ",a.length,"건"]})]})]}),o?m.jsx("div",{className:"text-[12px] text-muted-foreground py-3 text-center",children:"불러오는 중…"}):h.length===0?m.jsx("div",{className:"text-[12px] text-muted-foreground py-2",children:"해당 기간 주문 없음"}):m.jsxs(ho,{stickyHeader:!0,children:[m.jsxs(vo,{children:[m.jsx(je,{children:"주문일"}),m.jsx(je,{children:"주문번호"}),m.jsx(je,{children:"상품명"}),m.jsx(je,{align:"right",children:"판매가"}),m.jsx(je,{children:"상태"})]}),m.jsx("tbody",{className:"bg-card divide-y divide-border/50",children:h.map((v,g)=>{var y;return m.jsxs("tr",{className:Qe(g%2!==0&&"bg-muted/20"),children:[m.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:v.orderedAt.slice(0,10)}),m.jsx("td",{className:"px-3 py-2 font-mono text-[11px] text-muted-foreground",children:v.channelOrderId.slice(-10)}),m.jsxs("td",{className:"px-3 py-2 max-w-[200px] truncate",children:[((y=v.items[0])==null?void 0:y.productName)??"-",v.items.length>1&&` 외 ${v.items.length-1}건`]}),m.jsx("td",{className:"px-3 py-2 text-right font-medium",children:Ot(v.totalAmount)}),m.jsx("td",{className:"px-3 py-2 text-muted-foreground text-[11px]",children:v.status})]},v.channelOrderId)})})]})]})}function Vae({orderId:r,payDate:e,fetchOrderSettlement:t}){const[n,a]=Y.useState([]),[i,o]=Y.useState(!1),s=Y.useRef(t);return s.current=t,Y.useEffect(()=>{let l=!1;return o(!0),s.current(r,e).then(u=>{l||a(u.elements??[])}).catch(()=>{l||a([])}).finally(()=>{l||o(!1)}),()=>{l=!0}},[r,e]),i?m.jsx("div",{className:"text-[11px] text-muted-foreground py-2 pl-4",children:"건별 정산 조회 중…"}):n.length?m.jsx("div",{className:"border-t border-border/40 bg-muted/10",children:m.jsxs("table",{className:"w-full text-[11px]",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"text-[10px] text-muted-foreground/70",children:[m.jsx("th",{className:"px-4 py-1 text-left",children:"상품주문번호"}),m.jsx("th",{className:"px-3 py-1 text-left",children:"상품명"}),m.jsx("th",{className:"px-3 py-1 text-right",children:"결제금액"}),m.jsx("th",{className:"px-3 py-1 text-right",children:"수수료"}),m.jsx("th",{className:"px-3 py-1 text-right",children:"실수령"}),m.jsx("th",{className:"px-3 py-1 text-left",children:"정산완료일"})]})}),m.jsx("tbody",{children:n.map((l,u)=>{var c;return m.jsxs("tr",{className:Qe(u%2!==0&&"bg-muted/20"),children:[m.jsx("td",{className:"px-4 py-1 font-mono text-[10px] text-muted-foreground",children:((c=l.productOrderId)==null?void 0:c.slice(-10))??"-"}),m.jsx("td",{className:"px-3 py-1 max-w-[160px] truncate text-muted-foreground",children:l.productName??"-"}),m.jsx("td",{className:"px-3 py-1 text-right",children:Ot(l.paySettleAmount)}),m.jsx("td",{className:"px-3 py-1 text-right text-red-600 dark:text-red-400",children:l.totalPayCommissionAmount!=null?Ot(Math.abs(l.totalPayCommissionAmount)):"-"}),m.jsx("td",{className:"px-3 py-1 text-right text-emerald-600 dark:text-emerald-400 font-medium",children:Ot(l.settleExpectAmount)}),m.jsx("td",{className:"px-3 py-1 text-muted-foreground",children:l.settleCompleteDate??"-"})]},u)})})]})}):m.jsx("div",{className:"text-[11px] text-muted-foreground py-2 pl-4",children:"건별 정산 내역 없음"})}const Jf=10;function Gae({dateFrom:r,dateTo:e,fetchOrders:t,fetchOrderSettlement:n}){const[a,i]=Y.useState([]),[o,s]=Y.useState(!1),[l,u]=Y.useState(new Set),[c,f]=Y.useState(0),h=Y.useRef(t);h.current=t,Y.useEffect(()=>{let S=!1;return s(!0),f(0),h.current({channel:"smartstore",from:r,to:e,limit:500}).then(T=>{S||i(T.orders)}).catch(()=>{S||i([])}).finally(()=>{S||s(!1)}),()=>{S=!0}},[r,e]);const v=Math.max(1,Math.ceil(a.length/Jf)),g=a.slice(c*Jf,(c+1)*Jf);function y(S){u(T=>{const C=new Set(T);return C.has(S)?C.delete(S):C.add(S),C})}const b=!!n,_=b?"주문내역 (클릭 시 실정산내역)":"주문내역";return m.jsxs("div",{className:"bg-muted/10 border-t border-border/30 px-4 py-3 space-y-2",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-[12px] font-semibold",children:_}),m.jsxs("div",{className:"flex items-center gap-3",children:[a.length>Jf&&m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("button",{type:"button",onClick:()=>{f(S=>Math.max(0,S-1)),u(new Set)},disabled:c===0,className:"px-2 py-1 text-[11px] border border-border rounded hover:bg-muted/50 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:"←"}),m.jsxs("span",{className:"text-[11px] text-muted-foreground px-1",children:[c*Jf+1,"–",Math.min((c+1)*Jf,a.length)," /"," ",a.length,"건"]}),m.jsx("button",{type:"button",onClick:()=>{f(S=>Math.min(v-1,S+1)),u(new Set)},disabled:c>=v-1,className:"px-2 py-1 text-[11px] border border-border rounded hover:bg-muted/50 disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:"→"})]}),m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[r," ~ ",e," · 총 ",a.length,"건"]})]})]}),o?m.jsx("div",{className:"text-[12px] text-muted-foreground py-3 text-center",children:"불러오는 중…"}):g.length===0?m.jsx("div",{className:"text-[12px] text-muted-foreground py-2",children:"해당 기간 주문 없음"}):m.jsxs(ho,{stickyHeader:!0,children:[m.jsxs(vo,{children:[m.jsx(je,{children:"주문일"}),m.jsx(je,{children:"주문번호"}),m.jsx(je,{children:"상품명"}),m.jsx(je,{align:"right",children:"판매가"}),m.jsx(je,{children:"상태"})]}),m.jsx("tbody",{className:"bg-card divide-y divide-border/50",children:g.map((S,T)=>{var D;const C=S.channelOrderId,M=l.has(C);return m.jsxs(Y.Fragment,{children:[m.jsxs("tr",{className:Qe(T%2!==0&&"bg-muted/20",b&&"cursor-pointer hover:bg-muted/30 transition-colors"),onClick:b?()=>y(C):void 0,onKeyDown:b?L=>{(L.key==="Enter"||L.key===" ")&&y(C)}:void 0,tabIndex:b?0:void 0,children:[m.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:S.orderedAt.slice(0,10)}),m.jsx("td",{className:"px-3 py-2 font-mono text-[11px] text-muted-foreground",children:b?m.jsxs("span",{className:"inline-flex items-center gap-1",children:[M?m.jsx(cn,{size:11,className:"shrink-0"}):m.jsx(qr,{size:11,className:"shrink-0"}),C.slice(-10)]}):C.slice(-10)}),m.jsxs("td",{className:"px-3 py-2 max-w-[200px] truncate",children:[((D=S.items[0])==null?void 0:D.productName)??"-",S.items.length>1&&` 외 ${S.items.length-1}건`]}),m.jsx("td",{className:"px-3 py-2 text-right font-medium",children:Ot(S.totalAmount)}),m.jsx("td",{className:"px-3 py-2 text-muted-foreground text-[11px]",children:S.status})]}),M&&n&&m.jsx("tr",{children:m.jsx("td",{colSpan:5,className:"p-0",children:m.jsx(Vae,{orderId:C,payDate:S.orderedAt.slice(0,10),fetchOrderSettlement:n})})})]},C)})})]})]})}function Hae({data:r,isLoading:e}){if(e)return m.jsx("div",{className:"text-[12px] text-muted-foreground py-4",children:"조회 중…"});if(!r)return null;const t=Array.isArray(r)?r:r.data??[];return t.length?m.jsxs(ho,{stickyHeader:!0,children:[m.jsxs(vo,{children:[m.jsx(je,{children:"매출인식월"}),m.jsx(je,{align:"right",children:"정산대상금액"}),m.jsx(je,{align:"right",children:"서비스수수료"}),m.jsx(je,{align:"right",children:"공제금액"}),m.jsx(je,{align:"right",children:"최종 정산금액"}),m.jsx(je,{children:"정산예정일"})]}),m.jsx("tbody",{className:"bg-card divide-y divide-border/50",children:t.map((n,a)=>m.jsxs("tr",{className:Qe(a%2!==0&&"bg-muted/20"),children:[m.jsx("td",{className:"px-3 py-2 font-medium",children:n.revenueRecognitionMonth??"-"}),m.jsx("td",{className:"px-3 py-2 text-right",children:Ot(n.settlementTargetAmount)}),m.jsx("td",{className:"px-3 py-2 text-right text-red-600 dark:text-red-400",children:n.serviceFee!=null?Ot(Math.abs(n.serviceFee)):"-"}),m.jsx("td",{className:"px-3 py-2 text-right text-muted-foreground",children:n.deductionAmount!=null?Ot(Math.abs(n.deductionAmount)):"-"}),m.jsx("td",{className:"px-3 py-2 text-right font-medium text-emerald-600 dark:text-emerald-400",children:Ot(n.finalSettlementAmount)}),m.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:n.settlementDate??n.finalSettlementDate??"-"})]},a))})]}):m.jsx("div",{className:"text-[12px] text-muted-foreground py-2",children:"해당 월 정산 내역 없음"})}function Fae({data:r,isLoading:e}){if(e)return m.jsx("div",{className:"text-[12px] text-muted-foreground py-4",children:"조회 중… (매출인식일별 조회로 시간이 걸릴 수 있습니다)"});if(!r)return null;const{items:t,totalActual:n,totalPredicted:a,totalDiff:i,accuracy:o,scannedDates:s}=r;if(!t.length)return m.jsx("div",{className:"text-[12px] text-muted-foreground py-2",children:"해당 기간 매출인식 데이터 없음 — 구매확정 주문이 있는지 확인하세요"});const l=o>=99?"text-emerald-600 dark:text-emerald-400":o>=95?"text-amber-600":"text-red-600";return m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:[m.jsx(bn,{label:"실 정산 합계",value:Ot(n)}),m.jsx(bn,{label:"예상 정산 합계",value:Ot(a)}),m.jsx(bn,{label:"예측 정확도",value:`${o.toFixed(1)}%`,sub:i!==0?`실정산이 예상보다 ${i>0?"+":""}${Ot(i)}`:"완전 일치",accent:o>=99})]}),m.jsxs(ho,{stickyHeader:!0,children:[m.jsxs(vo,{children:[m.jsx(je,{children:"주문번호"}),m.jsx(je,{children:"상품명"}),m.jsx(je,{align:"right",children:"결제금액"}),m.jsx(je,{align:"right",children:"실정산"}),m.jsx(je,{align:"right",children:"예상정산"}),m.jsx(je,{align:"right",children:"차이"})]}),m.jsx("tbody",{className:"bg-card divide-y divide-border/50",children:t.map((u,c)=>m.jsxs("tr",{className:Qe(c%2!==0&&"bg-muted/20"),children:[m.jsx("td",{className:"px-3 py-2 font-mono text-[11px] text-muted-foreground",children:u.orderId.slice(-10)}),m.jsx("td",{className:"px-3 py-2 max-w-[180px] truncate",children:u.productName}),m.jsx("td",{className:"px-3 py-2 text-right",children:Ot(u.gross)}),m.jsx("td",{className:"px-3 py-2 text-right font-medium",children:Ot(u.actual)}),m.jsx("td",{className:"px-3 py-2 text-right text-muted-foreground",children:Ot(u.predicted)}),m.jsxs("td",{className:Qe("px-3 py-2 text-right",Math.abs(u.diff)>500?"text-amber-600 font-medium":"text-muted-foreground"),children:[u.diff>=0?"+":"",Ot(u.diff)]})]},c))})]}),m.jsxs("p",{className:Qe("text-[11px]",l),children:["예측 정확도 ",o.toFixed(1),"% · ",s,"개 매출인식일 조회"]})]})}function Uae({dateFrom:r,dateTo:e,fetchMonthly:t,fetchReconcile:n}){const a=(r||new Date().toISOString()).slice(0,7),[i,o]=Y.useState(a),[s,l]=Y.useState("monthly"),[u,c]=Y.useState(void 0),[f,h]=Y.useState(!1),[v,g]=Y.useState(void 0),[y,b]=Y.useState(!1),_=Y.useRef(t);_.current=t;const S=Y.useRef(n);return S.current=n,Y.useEffect(()=>{if(s!=="monthly")return;let T=!1;return h(!0),_.current(i).then(C=>{T||c(C)}).catch(()=>{T||c(void 0)}).finally(()=>{T||h(!1)}),()=>{T=!0}},[s,i]),Y.useEffect(()=>{if(s!=="reconcile")return;let T=!1;return b(!0),S.current(r,e).then(C=>{T||g(C)}).catch(()=>{T||g(void 0)}).finally(()=>{T||b(!1)}),()=>{T=!0}},[s,r,e]),m.jsxs("div",{className:"bg-muted/10 border-t border-border/30 px-4 py-4 space-y-3",children:[m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("span",{className:"text-[12px] font-semibold",children:"쿠팡 실정산"}),m.jsx("span",{className:"text-[11px] text-muted-foreground",children:"쿠팡 Wing API 직접 조회"})]}),m.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[m.jsx("div",{className:"flex rounded border border-border overflow-hidden text-[11px]",children:["monthly","reconcile"].map(T=>m.jsx("button",{type:"button",onClick:()=>l(T),className:Qe("px-3 py-1 transition-colors",s===T?"bg-primary text-primary-foreground":"hover:bg-muted/50 text-muted-foreground"),children:T==="monthly"?"월별 정산":"예상 비교"},T))}),s==="monthly"&&m.jsx("input",{type:"month",value:i,onChange:T=>o(T.target.value),className:"h-7 px-2 border border-border rounded bg-background text-[12px] focus:outline-none focus:ring-1 focus:ring-primary/50"}),s==="reconcile"&&m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[r," ~ ",e," 기간 조회"]})]}),s==="monthly"&&m.jsx(Hae,{data:u,isLoading:f}),s==="reconcile"&&m.jsx(Fae,{data:v,isLoading:y})]})}function Wae({nav:r,activeId:e,onNavigate:t,renderLink:n,email:a,appLabel:i,onLogout:o,workspaces:s,activeWorkspaceId:l,onSwitchWorkspace:u,mobileOpen:c,onMobileClose:f,footerSlot:h}){const[v,g]=Y.useState(!1),[y,b]=Y.useState(!1),_=s==null?void 0:s.find(D=>D.id===l),[S,T]=Y.useState(e);e!==S&&(T(e),c&&(f==null||f()));async function C(D){D===l||!u||(b(!0),g(!1),await u(D),b(!1))}const M=m.jsxs("nav",{className:"w-[220px] border-r border-border flex flex-col shrink-0 h-screen overflow-y-auto bg-background",children:[m.jsxs("div",{className:"px-4 py-4 border-b border-border flex items-center gap-2",children:[m.jsx("img",{src:"/shopport-logo-type.svg",alt:"shopport",className:"h-[18px]"}),i&&m.jsxs("span",{className:"text-[11px] text-muted-foreground font-normal",children:[i," beta"]})]}),s&&s.length>0&&m.jsxs("div",{className:"relative border-b border-border",children:[m.jsxs("button",{type:"button",onClick:()=>g(D=>!D),disabled:y,className:"w-full flex items-center justify-between px-4 py-2.5 text-[12px] hover:bg-muted/40 transition-colors disabled:opacity-50",children:[m.jsx("span",{className:"truncate text-foreground font-medium",children:y?"전환 중...":(_==null?void 0:_.name)??"워크스페이스"}),m.jsx(cn,{size:12,className:Qe("text-muted-foreground shrink-0 transition-transform",v&&"rotate-180")})]}),v&&m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>g(!1),"aria-hidden":"true"}),m.jsx("div",{className:"absolute left-0 right-0 top-full bg-background border border-border shadow-md z-50 rounded-b-md overflow-hidden",children:s.map(D=>m.jsxs("button",{type:"button",onClick:()=>C(D.id),className:"w-full flex items-center justify-between px-4 py-2 text-[12px] hover:bg-muted transition-colors",children:[m.jsx("span",{className:"truncate",children:D.name}),D.id===l&&m.jsx(Kc,{size:11,className:"text-primary shrink-0"})]},D.id))})]})]}),m.jsx("div",{className:"flex-1 py-2",children:r.map(D=>D.type==="section"?m.jsx("div",{className:"px-4 pt-4 pb-1 text-[11px] font-medium text-muted-foreground/60 uppercase tracking-wider",children:D.label},D.label):m.jsx(Yae,{item:D,isActive:D.id===e,onNavigate:t,renderLink:n},D.id))}),h&&m.jsx("div",{className:"border-t border-border px-4 py-2",children:h}),m.jsxs("div",{className:"border-t border-border",children:[a&&m.jsx("div",{className:"px-4 pt-3 pb-1 text-[11px] text-muted-foreground truncate",children:a}),o&&m.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-2 w-full px-4 py-2.5 text-[12px] text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[m.jsx(See,{size:12}),"로그아웃"]})]})]});return m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"hidden md:block sticky top-0 h-screen shrink-0",children:M}),c&&m.jsxs("div",{className:"fixed inset-0 z-50 md:hidden",children:[m.jsx("div",{className:"absolute inset-0 bg-black/40",onClick:f,"aria-hidden":"true"}),m.jsx("div",{className:"relative z-10 h-full",children:M})]})]})}function Yae({item:r,isActive:e,onNavigate:t,renderLink:n}){const a=r.icon,i=Qe("flex items-center gap-2.5 w-full px-4 py-2 text-[13px] text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",e&&"bg-muted text-foreground font-medium"),o=m.jsxs(m.Fragment,{children:[m.jsx(a,{size:14}),r.label]});return n?n(r.id,o,i):m.jsx("button",{type:"button",onClick:()=>t==null?void 0:t(r.id),className:i,children:o})}function $ae(){const{data:r,refetch:e}=QG();async function t(a,i,o){if(!r)return;const s={...r[a]};Object.keys(o).length>0?s[i]={...o,channel:i}:delete s[i],await EC({...r,[a]:s}),e()}async function n(a){r&&(await EC({...r,settlement:{...r.settlement??{},annualRevenue:a??void 0}}),e())}return m.jsx(zae,{config:r,onSaveChannel:t,onSaveAnnualRevenue:n})}function Xae(){const{isLoading:r,data:e}=vb(),{data:t,isLoading:n}=dZ();return m.jsx(mae,{executions:(t==null?void 0:t.executions)??{},channelData:(t==null?void 0:t.channelData)??{},settlementData:(t==null?void 0:t.settlementData)??{},channelStatuses:(e==null?void 0:e.channels)??[],onConnect:()=>{window.location.hash="config"},isLoading:r||n})}const PD="-",qae=r=>{const e=Kae(r),{conflictingClassGroups:t,conflictingClassGroupModifiers:n}=r;return{getClassGroupId:o=>{const s=o.split(PD);return s[0]===""&&s.length!==1&&s.shift(),OH(s,e)||Zae(o)},getConflictingClassGroupIds:(o,s)=>{const l=t[o]||[];return s&&n[o]?[...l,...n[o]]:l}}},OH=(r,e)=>{var o;if(r.length===0)return e.classGroupId;const t=r[0],n=e.nextPart.get(t),a=n?OH(r.slice(1),n):void 0;if(a)return a;if(e.validators.length===0)return;const i=r.join(PD);return(o=e.validators.find(({validator:s})=>s(i)))==null?void 0:o.classGroupId},MP=/^\[(.+)\]$/,Zae=r=>{if(MP.test(r)){const e=MP.exec(r)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},Kae=r=>{const{theme:e,prefix:t}=r,n={nextPart:new Map,validators:[]};return Jae(Object.entries(r.classGroups),t).forEach(([i,o])=>{$C(o,n,i,e)}),n},$C=(r,e,t,n)=>{r.forEach(a=>{if(typeof a=="string"){const i=a===""?e:DP(e,a);i.classGroupId=t;return}if(typeof a=="function"){if(Qae(a)){$C(a(n),e,t,n);return}e.validators.push({validator:a,classGroupId:t});return}Object.entries(a).forEach(([i,o])=>{$C(o,DP(e,i),t,n)})})},DP=(r,e)=>{let t=r;return e.split(PD).forEach(n=>{t.nextPart.has(n)||t.nextPart.set(n,{nextPart:new Map,validators:[]}),t=t.nextPart.get(n)}),t},Qae=r=>r.isThemeGetter,Jae=(r,e)=>e?r.map(([t,n])=>{const a=n.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,s])=>[e+o,s])):i);return[t,a]}):r,eie=r=>{if(r<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,n=new Map;const a=(i,o)=>{t.set(i,o),e++,e>r&&(e=0,n=t,t=new Map)};return{get(i){let o=t.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return a(i,o),o},set(i,o){t.has(i)?t.set(i,o):a(i,o)}}},PH="!",tie=r=>{const{separator:e,experimentalParseClassName:t}=r,n=e.length===1,a=e[0],i=e.length,o=s=>{const l=[];let u=0,c=0,f;for(let b=0;b<s.length;b++){let _=s[b];if(u===0){if(_===a&&(n||s.slice(b,b+i)===e)){l.push(s.slice(c,b)),c=b+i;continue}if(_==="/"){f=b;continue}}_==="["?u++:_==="]"&&u--}const h=l.length===0?s:s.substring(c),v=h.startsWith(PH),g=v?h.substring(1):h,y=f&&f>c?f-c:void 0;return{modifiers:l,hasImportantModifier:v,baseClassName:g,maybePostfixModifierPosition:y}};return t?s=>t({className:s,parseClassName:o}):o},rie=r=>{if(r.length<=1)return r;const e=[];let t=[];return r.forEach(n=>{n[0]==="["?(e.push(...t.sort(),n),t=[]):t.push(n)}),e.push(...t.sort()),e},nie=r=>({cache:eie(r.cacheSize),parseClassName:tie(r),...qae(r)}),aie=/\s+/,iie=(r,e)=>{const{parseClassName:t,getClassGroupId:n,getConflictingClassGroupIds:a}=e,i=[],o=r.trim().split(aie);let s="";for(let l=o.length-1;l>=0;l-=1){const u=o[l],{modifiers:c,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:v}=t(u);let g=!!v,y=n(g?h.substring(0,v):h);if(!y){if(!g){s=u+(s.length>0?" "+s:s);continue}if(y=n(h),!y){s=u+(s.length>0?" "+s:s);continue}g=!1}const b=rie(c).join(":"),_=f?b+PH:b,S=_+y;if(i.includes(S))continue;i.push(S);const T=a(y,g);for(let C=0;C<T.length;++C){const M=T[C];i.push(_+M)}s=u+(s.length>0?" "+s:s)}return s};function oie(){let r=0,e,t,n="";for(;r<arguments.length;)(e=arguments[r++])&&(t=jH(e))&&(n&&(n+=" "),n+=t);return n}const jH=r=>{if(typeof r=="string")return r;let e,t="";for(let n=0;n<r.length;n++)r[n]&&(e=jH(r[n]))&&(t&&(t+=" "),t+=e);return t};function sie(r,...e){let t,n,a,i=o;function o(l){const u=e.reduce((c,f)=>f(c),r());return t=nie(u),n=t.cache.get,a=t.cache.set,i=s,s(l)}function s(l){const u=n(l);if(u)return u;const c=iie(l,t);return a(l,c),c}return function(){return i(oie.apply(null,arguments))}}const ur=r=>{const e=t=>t[r]||[];return e.isThemeGetter=!0,e},zH=/^\[(?:([a-z-]+):)?(.+)\]$/i,lie=/^\d+\/\d+$/,uie=new Set(["px","full","screen"]),cie=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,fie=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,die=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,hie=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,vie=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ho=r=>Ud(r)||uie.has(r)||lie.test(r),il=r=>Lh(r,"length",Sie),Ud=r=>!!r&&!Number.isNaN(Number(r)),Gw=r=>Lh(r,"number",Ud),ep=r=>!!r&&Number.isInteger(Number(r)),pie=r=>r.endsWith("%")&&Ud(r.slice(0,-1)),St=r=>zH.test(r),ol=r=>cie.test(r),gie=new Set(["length","size","percentage"]),mie=r=>Lh(r,gie,BH),yie=r=>Lh(r,"position",BH),xie=new Set(["image","url"]),bie=r=>Lh(r,xie,Tie),_ie=r=>Lh(r,"",wie),tp=()=>!0,Lh=(r,e,t)=>{const n=zH.exec(r);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):t(n[2]):!1},Sie=r=>fie.test(r)&&!die.test(r),BH=()=>!1,wie=r=>hie.test(r),Tie=r=>vie.test(r),Cie=()=>{const r=ur("colors"),e=ur("spacing"),t=ur("blur"),n=ur("brightness"),a=ur("borderColor"),i=ur("borderRadius"),o=ur("borderSpacing"),s=ur("borderWidth"),l=ur("contrast"),u=ur("grayscale"),c=ur("hueRotate"),f=ur("invert"),h=ur("gap"),v=ur("gradientColorStops"),g=ur("gradientColorStopPositions"),y=ur("inset"),b=ur("margin"),_=ur("opacity"),S=ur("padding"),T=ur("saturate"),C=ur("scale"),M=ur("sepia"),D=ur("skew"),L=ur("space"),k=ur("translate"),R=()=>["auto","contain","none"],E=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto",St,e],z=()=>[St,e],j=()=>["",Ho,il],G=()=>["auto",Ud,St],U=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],O=()=>["solid","dashed","dotted","double","none"],H=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],F=()=>["start","end","center","between","around","evenly","stretch"],$=()=>["","0",St],B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],X=()=>[Ud,St];return{cacheSize:500,separator:":",theme:{colors:[tp],spacing:[Ho,il],blur:["none","",ol,St],brightness:X(),borderColor:[r],borderRadius:["none","","full",ol,St],borderSpacing:z(),borderWidth:j(),contrast:X(),grayscale:$(),hueRotate:X(),invert:$(),gap:z(),gradientColorStops:[r],gradientColorStopPositions:[pie,il],inset:I(),margin:I(),opacity:X(),padding:z(),saturate:X(),scale:X(),sepia:$(),skew:X(),space:z(),translate:z()},classGroups:{aspect:[{aspect:["auto","square","video",St]}],container:["container"],columns:[{columns:[ol]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...U(),St]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ep,St]}],basis:[{basis:I()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",St]}],grow:[{grow:$()}],shrink:[{shrink:$()}],order:[{order:["first","last","none",ep,St]}],"grid-cols":[{"grid-cols":[tp]}],"col-start-end":[{col:["auto",{span:["full",ep,St]},St]}],"col-start":[{"col-start":G()}],"col-end":[{"col-end":G()}],"grid-rows":[{"grid-rows":[tp]}],"row-start-end":[{row:["auto",{span:[ep,St]},St]}],"row-start":[{"row-start":G()}],"row-end":[{"row-end":G()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",St]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",St]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...F()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...F(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...F(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[S]}],px:[{px:[S]}],py:[{py:[S]}],ps:[{ps:[S]}],pe:[{pe:[S]}],pt:[{pt:[S]}],pr:[{pr:[S]}],pb:[{pb:[S]}],pl:[{pl:[S]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[L]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[L]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",St,e]}],"min-w":[{"min-w":[St,e,"min","max","fit"]}],"max-w":[{"max-w":[St,e,"none","full","min","max","fit","prose",{screen:[ol]},ol]}],h:[{h:[St,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[St,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[St,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[St,e,"auto","min","max","fit"]}],"font-size":[{text:["base",ol,il]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Gw]}],"font-family":[{font:[tp]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",St]}],"line-clamp":[{"line-clamp":["none",Ud,Gw]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ho,St]}],"list-image":[{"list-image":["none",St]}],"list-style-type":[{list:["none","disc","decimal",St]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[r]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[r]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ho,il]}],"underline-offset":[{"underline-offset":["auto",Ho,St]}],"text-decoration-color":[{decoration:[r]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",St]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",St]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...U(),yie]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",mie]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},bie]}],"bg-color":[{bg:[r]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...O(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:O()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...O()]}],"outline-offset":[{"outline-offset":[Ho,St]}],"outline-w":[{outline:[Ho,il]}],"outline-color":[{outline:[r]}],"ring-w":[{ring:j()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[r]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Ho,il]}],"ring-offset-color":[{"ring-offset":[r]}],shadow:[{shadow:["","inner","none",ol,_ie]}],"shadow-color":[{shadow:[tp]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...H(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":H()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[n]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",ol,St]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[c]}],invert:[{invert:[f]}],saturate:[{saturate:[T]}],sepia:[{sepia:[M]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[c]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",St]}],duration:[{duration:X()}],ease:[{ease:["linear","in","out","in-out",St]}],delay:[{delay:X()}],animate:[{animate:["none","spin","ping","pulse","bounce",St]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[ep,St]}],"translate-x":[{"translate-x":[k]}],"translate-y":[{"translate-y":[k]}],"skew-x":[{"skew-x":[D]}],"skew-y":[{"skew-y":[D]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",St]}],accent:[{accent:["auto",r]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",St]}],"caret-color":[{caret:[r]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",St]}],fill:[{fill:[r,"none"]}],"stroke-w":[{stroke:[Ho,il,Gw]}],stroke:[{stroke:[r,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Aie=sie(Cie);function zr(...r){return Aie(e6(r))}function Dd({channelKey:r,schema:e,current:t,onSave:n,saving:a,saved:i}){const o=e.fields.filter(_=>!_.readOnly),s=e.fields.filter(_=>_.readOnly),l=o.some(_=>{const S=t[_.key];return S!==void 0&&S!==""&&S!==null}),u=o.some(_=>{const S=t[_.key];return S!==void 0&&S!==""&&S!==null}),[c,f]=Y.useState(l),[h,v]=Y.useState(!e.proxyNote||u),[g,y]=Y.useState(()=>{const _={};for(const S of o){const T=t[S.key];S.type==="boolean"?_[S.key]=!!T:S.type==="number"?_[S.key]=T!==void 0&&T!==""?Number(T):"":_[S.key]=String(T??"")}return _});function b(){if(!o.some(T=>{const C=g[T.key];return C!==""&&C!==void 0})){n({});return}const S={...t};for(const T of o){const C=g[T.key];C!==""&&C!==void 0?S[T.key]=C:delete S[T.key]}n(S)}return m.jsxs("div",{id:r?`cfg-ch-${r}`:void 0,className:"border border-border rounded-lg overflow-hidden bg-card scroll-mt-4",children:[m.jsxs("button",{type:"button",onClick:()=>f(_=>!_),className:"w-full flex items-center justify-between px-4 py-2.5 text-[13px] hover:bg-muted/30 transition-colors",children:[m.jsxs("span",{className:"flex items-center gap-2",children:[c?m.jsx(cn,{size:13,className:"text-muted-foreground"}):m.jsx(qr,{size:13,className:"text-muted-foreground"}),m.jsx("span",{className:"font-medium",children:e.label}),l&&m.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-emerald-500 shrink-0"})]}),m.jsx("span",{className:"text-[11px] text-muted-foreground",children:l?m.jsx("span",{className:"text-emerald-600",children:"연결됨"}):e.proxyNote&&!u?m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx(GC,{size:10})," 공용 키"]}):null})]}),c&&m.jsxs("div",{className:"border-t border-border bg-muted/10",children:[(e.guide||e.cliNote)&&m.jsxs("div",{className:"px-4 pt-3 pb-2 flex items-center gap-4 text-[11px] text-muted-foreground border-b border-border/50",children:[e.guide&&m.jsxs("a",{href:e.guide,target:"_blank",rel:"noreferrer",className:"flex items-center gap-1 hover:text-foreground transition-colors",onClick:_=>_.stopPropagation(),children:[m.jsx(Qc,{size:10}),"자격증명 발급"]}),e.cliNote&&m.jsx("code",{className:"font-mono text-[10px] bg-muted px-1.5 py-0.5 rounded text-foreground/70",children:e.cliNote})]}),e.proxyNote&&!h?m.jsxs("div",{className:"px-4 py-4 flex items-start justify-between gap-4",children:[m.jsx("div",{className:"space-y-1",children:m.jsx("p",{className:"text-[12px] text-foreground/80",children:e.proxyNote})}),m.jsxs("button",{type:"button",onClick:()=>v(!0),className:"shrink-0 flex items-center gap-1.5 px-3 py-1.5 text-[11px] border border-border rounded hover:bg-muted transition-colors",children:[m.jsx(nH,{size:10}),"직접 설정"]})]}):m.jsxs("div",{className:"px-4 py-4 space-y-2.5",children:[e.proxyNote&&h&&m.jsxs("div",{className:"flex items-center justify-between pb-1 border-b border-border/50",children:[m.jsx("span",{className:"text-[11px] text-muted-foreground",children:"직접 설정 중"}),m.jsxs("button",{type:"button",onClick:()=>v(!1),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground",children:[m.jsx(GC,{size:10})," 공용 키로 전환"]})]}),o.map(_=>m.jsxs("div",{className:"grid grid-cols-[190px_1fr] items-start gap-3",children:[m.jsxs("span",{className:zr("text-[12px] text-right pt-1.5 leading-tight",_.optional?"text-muted-foreground/60":"text-muted-foreground"),children:[_.label,_.optional&&m.jsx("span",{className:"ml-1 text-[10px]",children:"(선택)"})]}),m.jsxs("div",{className:"space-y-0.5",children:[_.type==="boolean"?m.jsx("input",{type:"checkbox",checked:!!g[_.key],onChange:S=>y(T=>({...T,[_.key]:S.target.checked})),className:"w-4 h-4 accent-primary mt-1.5"}):m.jsx("input",{type:_.type==="password"?"password":_.type==="number"?"number":"text",value:String(g[_.key]??""),placeholder:_.placeholder??"",onChange:S=>y(T=>({...T,[_.key]:S.target.value})),className:"h-7 px-2 text-[12px] border border-border rounded bg-background w-full font-mono focus:outline-none focus:ring-1 focus:ring-primary/50"}),_.hint&&m.jsx("p",{className:"text-[10px] text-muted-foreground/70 pl-0.5",children:_.hint})]})]},_.key)),s.filter(_=>t[_.key]!==void 0&&t[_.key]!=="").map(_=>m.jsxs("div",{className:"grid grid-cols-[190px_1fr] items-start gap-3",children:[m.jsx("span",{className:"text-[12px] text-right pt-1.5 text-muted-foreground/50",children:_.label}),m.jsxs("div",{className:"space-y-0.5",children:[m.jsx("div",{className:"h-7 px-2 flex items-center",children:m.jsx("span",{className:"text-[12px] font-mono text-muted-foreground/70 truncate",children:_.type==="password"?"••••••••":String(t[_.key])})}),_.hint&&m.jsx("p",{className:"text-[10px] text-muted-foreground/50 pl-0.5",children:_.hint})]})]},_.key)),e.ipNote&&m.jsx("div",{className:"py-2.5 px-3 bg-amber-50 dark:bg-amber-950/30 rounded-md border border-amber-200/60 dark:border-amber-800/40",children:e.ipNote.split(`
|
|
362
362
|
`).map((_,S)=>S===0?m.jsx("p",{className:"text-[11px] text-amber-800 dark:text-amber-300",children:_},_):m.jsx("p",{className:"mt-0.5 font-mono text-[12px] font-semibold text-amber-900 dark:text-amber-200 select-all",children:_},_))}),m.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[i&&m.jsxs("span",{className:"text-[11px] text-emerald-600 flex items-center gap-1",children:[m.jsx(Kc,{size:11})," 저장됨"]}),m.jsxs("button",{type:"button",onClick:b,disabled:a,className:"flex items-center gap-1.5 px-3 py-1.5 text-[12px] bg-primary text-primary-foreground rounded hover:bg-primary/90 disabled:opacity-50 transition-colors",children:[m.jsx(wb,{size:11}),a?"저장 중...":"저장"]})]})]})]})]})}function ed({id:r,title:e,defaultOpen:t=!0,children:n}){const[a,i]=Y.useState(t);return m.jsxs("div",{id:r,className:"space-y-2 scroll-mt-4",children:[m.jsxs("button",{type:"button",onClick:()=>i(o=>!o),className:"flex items-center gap-1.5 text-[11px] font-semibold text-muted-foreground uppercase tracking-wider hover:text-foreground transition-colors w-full",children:[a?m.jsx(cn,{size:11}):m.jsx(qr,{size:11}),e]}),a&&m.jsx("div",{className:"space-y-1.5",children:n})]})}const n0=[{id:"cfg-seller",label:"사업자 정보"},{id:"cfg-sell",label:"판매 채널"},{id:"cfg-source",label:"소싱 채널"},{id:"cfg-trend",label:"트렌드 · 외부 도구"},{id:"cfg-logistics",label:"물류 채널"},{id:"cfg-advanced",label:"고급 설정"}];function Mie(){const[r,e]=Y.useState(n0[0].id);Y.useEffect(()=>{function n(){const a=window.innerHeight/3;let i=n0[0].id;for(const{id:o}of n0){const s=document.getElementById(o);s&&s.getBoundingClientRect().top<a&&(i=o)}e(i)}return window.addEventListener("scroll",n,{passive:!0}),()=>window.removeEventListener("scroll",n)},[]);function t(n){var a;(a=document.getElementById(n))==null||a.scrollIntoView({behavior:"smooth",block:"start"}),e(n)}return m.jsxs("nav",{className:"fixed top-8 right-6 w-36 z-20 pt-1",children:[m.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider mb-2 px-2",children:"목차"}),m.jsx("ul",{className:"space-y-0.5",children:n0.map(n=>m.jsx("li",{children:m.jsx("button",{type:"button",onClick:()=>t(n.id),className:zr("w-full text-left text-[12px] px-2 py-1.5 rounded border-l-2 transition-colors leading-tight",r===n.id?"border-primary text-foreground font-medium bg-muted/60":"border-transparent text-muted-foreground hover:text-foreground hover:bg-muted/30"),children:n.label})},n.id))})]})}function Nd({title:r,description:e,fields:t,values:n,onSave:a,saving:i,saved:o,defaultOpen:s=!1,cliNote:l}){const[u,c]=Y.useState(s),[f,h]=Y.useState(()=>{const b={};for(const _ of t){const S=n[_.key];_.type==="boolean"?b[_.key]=!!S:_.type==="number"?b[_.key]=S!==void 0&&S!==""?Number(S):"":b[_.key]=String(S??"")}return b}),[v,g]=Y.useState(n);if(n!==v){g(n);const b={};for(const _ of t){const S=n[_.key];_.type==="boolean"?b[_.key]=!!S:_.type==="number"?b[_.key]=S!==void 0&&S!==""?Number(S):"":b[_.key]=String(S??"")}h(b)}function y(){const b={};for(const _ of t){const S=f[_.key];S!==""&&S!==void 0&&(b[_.key]=S)}a(b)}return m.jsxs("div",{className:"border border-border rounded-lg overflow-hidden bg-card",children:[m.jsx("button",{type:"button",onClick:()=>c(b=>!b),className:"w-full flex items-center justify-between px-4 py-2.5 text-[13px] hover:bg-muted/30 transition-colors",children:m.jsxs("span",{className:"flex items-center gap-2",children:[u?m.jsx(cn,{size:13,className:"text-muted-foreground"}):m.jsx(qr,{size:13,className:"text-muted-foreground"}),m.jsx("span",{className:"font-medium",children:r})]})}),u&&m.jsxs("div",{className:"border-t border-border bg-muted/10",children:[(e||l)&&m.jsxs("div",{className:"px-4 pt-3 pb-2 space-y-1 border-b border-border/50",children:[e&&m.jsx("p",{className:"text-[12px] text-muted-foreground leading-relaxed",children:e}),l&&m.jsx("code",{className:"text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded text-foreground/70",children:l})]}),m.jsxs("div",{className:"px-4 py-4 space-y-2.5",children:[t.map(b=>m.jsxs("div",{className:"grid grid-cols-[190px_1fr] items-start gap-3",children:[m.jsxs("span",{className:zr("text-[12px] text-right pt-1.5 leading-tight",b.optional?"text-muted-foreground/60":"text-muted-foreground"),children:[b.label,b.optional&&m.jsx("span",{className:"ml-1 text-[10px]",children:"(선택)"})]}),m.jsxs("div",{className:"space-y-0.5",children:[b.type==="boolean"?m.jsx("input",{type:"checkbox",checked:!!f[b.key],onChange:_=>h(S=>({...S,[b.key]:_.target.checked})),className:"w-4 h-4 accent-primary mt-1.5"}):m.jsx("input",{type:b.type==="password"?"password":b.type==="number"?"number":"text",value:String(f[b.key]??""),placeholder:b.placeholder??"",onChange:_=>h(S=>({...S,[b.key]:_.target.value})),className:"h-7 px-2 text-[12px] border border-border rounded bg-background w-full font-mono focus:outline-none focus:ring-1 focus:ring-primary/50"}),b.hint&&m.jsx("p",{className:"text-[10px] text-muted-foreground/70 pl-0.5",children:b.hint})]})]},b.key)),m.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[o&&m.jsxs("span",{className:"text-[11px] text-emerald-600 flex items-center gap-1",children:[m.jsx(Kc,{size:11})," 저장됨"]}),m.jsxs("button",{type:"button",onClick:y,disabled:i,className:"flex items-center gap-1.5 px-3 py-1.5 text-[12px] bg-primary text-primary-foreground rounded hover:bg-primary/90 disabled:opacity-50 transition-colors",children:[m.jsx(wb,{size:11}),i?"저장 중...":"저장"]})]})]})]})]})}const NP=[{key:"store",label:"스토어 프로필"},{key:"channels",label:"채널 연결"},{key:"done",label:"완료"}];function Die({current:r}){const e=NP.findIndex(t=>t.key===r);return m.jsx("div",{className:"flex items-center gap-2 mb-8",children:NP.map((t,n)=>m.jsxs("div",{className:"flex items-center gap-2",children:[n>0&&m.jsx("div",{className:zr("w-8 h-px",n<=e?"bg-primary":"bg-border")}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("div",{className:zr("w-6 h-6 rounded-full flex items-center justify-center text-[11px] font-medium",n<e||n===e?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:n<e?m.jsx(Kc,{size:12}):n+1}),m.jsx("span",{className:zr("text-[12px]",n===e?"font-medium text-foreground":"text-muted-foreground"),children:t.label})]})]},t.key))})}function Nie({connectedCount:r,onBack:e}){const[t,n]=Y.useState("idle"),[a,i]=Y.useState(null);async function o(){n("syncing"),i(null);try{const s=await ZG();i(s),n(s.error?"error":"success")}catch(s){i({synced:0,error:s instanceof Error?s.message:"알 수 없는 오류"}),n("error")}}return m.jsxs("div",{className:"py-8 space-y-6",children:[m.jsxs("div",{className:"text-center space-y-3",children:[m.jsx(KO,{size:44,className:"mx-auto text-emerald-500"}),m.jsx("h3",{className:"text-[16px] font-semibold",children:"채널 설정 완료!"}),r>0?m.jsxs("p",{className:"text-[13px] text-muted-foreground",children:[r,"개 채널이 연결되었습니다."]}):m.jsx("p",{className:"text-[13px] text-muted-foreground",children:"채널은 나중에 Settings에서 추가할 수 있습니다."})]}),r>0&&m.jsx("div",{className:"border border-border rounded-lg bg-card overflow-hidden",children:m.jsxs("div",{className:"px-5 py-4 space-y-3",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx(Qx,{size:15,className:"text-muted-foreground"}),m.jsx("span",{className:"text-[13px] font-medium",children:"최근 주문 가져오기"})]}),m.jsx("p",{className:"text-[12px] text-muted-foreground",children:"연결된 채널에서 최근 7일간 주문을 가져옵니다."}),t==="idle"&&m.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-2 px-4 py-2 text-[13px] bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:[m.jsx(Qx,{size:13}),"주문 가져오기"]}),t==="syncing"&&m.jsxs("div",{className:"flex items-center gap-2 text-[13px] text-muted-foreground",children:[m.jsx(yee,{size:14,className:"animate-spin"}),"연결된 채널에서 주문을 가져오는 중..."]}),t==="success"&&a&&m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-center gap-2 text-[13px] text-emerald-600",children:[m.jsx(KO,{size:14}),a.synced>0?`${a.synced}건의 주문을 가져왔습니다.`:"새로운 주문이 없습니다."]}),m.jsx("button",{type:"button",onClick:()=>{window.location.hash="orders"},className:"text-[12px] text-primary hover:underline",children:"주문 목록 보기"})]}),t==="error"&&a&&m.jsxs("div",{className:"space-y-2",children:[m.jsxs("div",{className:"flex items-start gap-2 text-[13px] text-red-600",children:[m.jsx(AD,{size:14,className:"mt-0.5 shrink-0"}),m.jsxs("div",{children:[m.jsx("p",{children:"주문 가져오기에 실패했습니다."}),a.error&&m.jsx("p",{className:"text-[11px] text-red-500/80 mt-0.5",children:a.error})]})]}),m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx("button",{type:"button",onClick:o,className:"text-[12px] text-primary hover:underline",children:"다시 시도"}),m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["또는 터미널에서: ",m.jsx("code",{className:"font-mono",children:"sppt order list"})]})]})]})]})}),m.jsxs("div",{className:"p-4 bg-muted/50 rounded-lg border border-border/60 text-left",children:[m.jsx("p",{className:"text-[12px] text-muted-foreground mb-1.5",children:"터미널에서 바로 사용 가능합니다:"}),m.jsxs("div",{className:"space-y-0.5",children:[m.jsx("code",{className:"text-[12px] font-mono text-foreground/80 block",children:"sppt health"}),m.jsx("code",{className:"text-[12px] font-mono text-foreground/80 block",children:"sppt product list"}),m.jsx("code",{className:"text-[12px] font-mono text-foreground/80 block",children:"sppt order list"})]})]}),m.jsxs("div",{className:"flex items-center justify-between",children:[m.jsx("button",{type:"button",onClick:e,className:"px-4 py-2 text-[13px] text-muted-foreground hover:text-foreground transition-colors",children:"채널 더 추가하기"}),m.jsx("button",{type:"button",onClick:()=>{window.location.hash="overview"},className:"px-5 py-2 text-[13px] bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"대시보드로 이동"})]})]})}function Lie({draft:r,doSave:e,channelSaver:t,mk:n}){const[a,i]=Y.useState("store"),o=Object.entries(r.channels??{}).filter(([,s])=>{const l=s;return l&&Object.values(l).some(u=>u!==void 0&&u!==""&&u!==null)});return m.jsxs("div",{className:"max-w-[720px] mx-auto",children:[m.jsxs("div",{className:"mb-6",children:[m.jsx("h2",{className:"text-[17px] font-semibold",children:"초기 설정"}),m.jsx("p",{className:"text-[12px] text-muted-foreground mt-0.5",children:"스토어 정보를 입력하고 판매 채널을 연결하세요."})]}),m.jsx(Die,{current:a}),a==="store"&&m.jsxs("div",{className:"space-y-4",children:[m.jsx(Nd,{title:"스토어 기본 정보",description:"브랜드명과 사업자 정보를 입력하세요. 오픈마켓 입점 시 활용됩니다.",defaultOpen:!0,fields:[{key:"businessName",label:"상호명",type:"text"},{key:"representative",label:"대표자명",type:"text"},{key:"businessRegNumber",label:"사업자등록번호",type:"text",placeholder:"123-45-67890",optional:!0},{key:"mailOrderRegNumber",label:"통신판매업 신고번호",type:"text",placeholder:"2024-서울강남-12345",optional:!0}],values:r.seller??{},onSave:s=>e("seller",{...r,seller:s}),...n("seller")}),m.jsx("div",{className:"flex justify-end pt-2",children:m.jsx("button",{type:"button",onClick:()=>i("channels"),className:"px-5 py-2 text-[13px] bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"다음"})})]}),a==="channels"&&m.jsxs("div",{className:"space-y-4",children:[m.jsx("p",{className:"text-[12px] text-muted-foreground",children:"사용하는 판매 채널의 API 키를 입력하세요. 나중에 추가할 수도 있습니다."}),Object.entries(n1).map(([s,l])=>{var u;return m.jsx(Dd,{channelKey:s,schema:l,current:((u=r.channels)==null?void 0:u[s])??{},onSave:t("channels",s),...n(`channels.${s}`)},s)}),m.jsxs("div",{className:"flex items-center justify-between pt-2",children:[m.jsx("button",{type:"button",onClick:()=>i("store"),className:"px-4 py-2 text-[13px] text-muted-foreground hover:text-foreground transition-colors",children:"이전"}),m.jsx("button",{type:"button",onClick:()=>i("done"),className:"px-5 py-2 text-[13px] bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:o.length>0?`다음 (${o.length}개 연결됨)`:"건너뛰기"})]})]}),a==="done"&&m.jsx(Nie,{connectedCount:o.length,onBack:()=>i("channels")})]})}function kie({initMode:r=!1}){var v,g,y,b;const{data:e,isLoading:t,refetch:n}=QG(),[a,i]=Y.useState(null),[o,s]=Y.useState({}),[l,u]=Y.useState({});Y.useEffect(()=>{e&&i(e)},[e]);async function c(_,S){i(S),s(T=>({...T,[_]:!0}));try{await EC(S),u(T=>({...T,[_]:!0})),setTimeout(()=>u(T=>({...T,[_]:!1})),2e3),n()}finally{s(T=>({...T,[_]:!1}))}}function f(_,S){return T=>{if(!a)return;const C=`${_}.${S}`,M={...a[_]??{}};Object.keys(T).length>0?M[S]={...T,channel:S}:delete M[S],c(C,{...a,[_]:M})}}const h=_=>({saving:!!o[_],saved:!!l[_]});return t||!a?m.jsx("div",{className:"text-[13px] text-muted-foreground p-4",children:"설정 불러오는 중..."}):r?m.jsx(Lie,{draft:a,doSave:c,channelSaver:f,mk:h}):m.jsxs("div",{className:"flex gap-8 mx-auto max-w-[860px]",children:[m.jsxs("div",{className:"flex-1 min-w-0 space-y-8",children:[m.jsxs("div",{children:[m.jsx("h2",{className:"text-[17px] font-semibold",children:"설정"}),m.jsx("p",{className:"text-[12px] text-muted-foreground mt-0.5",children:"~/.shopport/config.json 과 양방향 동기화됩니다."}),m.jsxs("div",{className:"mt-2 px-3 py-2 bg-muted/50 rounded-lg border border-border/60 text-[11px] text-muted-foreground",children:["커맨드라인에서도 설정 가능:",m.jsx("code",{className:"ml-2 font-mono text-foreground/70",children:"sppt config set <채널> <키> <값>"}),m.jsx("span",{className:"mx-2 text-border",children:"·"}),m.jsx("code",{className:"font-mono text-foreground/70",children:"sppt config list"})]})]}),m.jsxs(ed,{id:"cfg-seller",title:"사업자 정보",children:[m.jsx(Nd,{title:"사업자 기본 정보",description:"오픈마켓 입점 및 채널 온보딩에 활용됩니다. 사업자등록번호·통신판매업 신고번호는 쿠팡·스마트스토어 등 판매의 필수 전제 조건입니다.",cliNote:"sppt config set seller businessRegNumber <번호>",defaultOpen:!0,fields:[{key:"businessRegNumber",label:"사업자등록번호",type:"text",placeholder:"123-45-67890"},{key:"mailOrderRegNumber",label:"통신판매업 신고번호",type:"text",placeholder:"2024-서울강남-12345"},{key:"businessName",label:"상호명",type:"text"},{key:"representative",label:"대표자명",type:"text"}],values:a.seller??{},onSave:_=>c("seller",{...a,seller:_}),...h("seller")}),m.jsx(Nd,{title:"연 매출 설정",description:"스마트스토어 Npay 등급, 카페24 카드 영중소 우대 등 채널별 수수료율이 연 매출 기준으로 결정됩니다. 대략적인 연 매출을 입력하면 정산 페이지의 수수료율 계산 정확도가 높아집니다.",defaultOpen:!0,fields:[{key:"annualRevenue",label:"연 매출 (원)",type:"number",placeholder:"500000000",optional:!0,hint:"정확하지 않아도 됩니다. 대략적인 구간만 맞아도 등급 판정에 충분합니다."}],values:{annualRevenue:((v=a.settlement)==null?void 0:v.annualRevenue)??""},onSave:_=>c("settlement.annualRevenue",{...a,settlement:{...a.settlement??{},annualRevenue:_.annualRevenue?Number(_.annualRevenue):void 0}}),...h("settlement.annualRevenue")})]}),m.jsx(ed,{id:"cfg-sell",title:"판매 채널",children:Object.entries(n1).map(([_,S])=>{var T;return m.jsx(Dd,{channelKey:_,schema:S,current:((T=a.channels)==null?void 0:T[_])??{},onSave:f("channels",_),...h(`channels.${_}`)},_)})}),m.jsx(ed,{id:"cfg-source",title:"소싱 채널 (준비중)",children:Object.entries(HC).map(([_,S])=>{var T;return m.jsx(Dd,{channelKey:_,schema:S,current:((T=a.sourceChannels)==null?void 0:T[_])??{},onSave:f("sourceChannels",_),...h(`sourceChannels.${_}`)},_)})}),m.jsxs(ed,{id:"cfg-trend",title:"트렌드 · 외부 도구",children:[Object.entries(FC).map(([_,S])=>{var T;return m.jsx(Dd,{channelKey:_,schema:S,current:((T=a.trendChannels)==null?void 0:T[_])??{},onSave:f("trendChannels",_),...h(`trendChannels.${_}`)},_)}),m.jsx(Dd,{channelKey:"apify",schema:{label:"Apify",guide:"https://console.apify.com/account/integrations",cliNote:"sppt config set apify apiToken <token>",proxyNote:"shopport 공용 Apify 계정으로 전문몰 랭킹 등을 수집합니다. 크롤링 한도가 부족하거나 전용 계정이 필요하면 직접 설정하세요.",fields:[{key:"apiToken",label:"API Token",type:"password",hint:"Apify Console → Settings → Integrations"}]},current:a.apify??{},onSave:_=>c("apify",{...a,apify:_}),...h("apify")})]}),m.jsx(ed,{id:"cfg-logistics",title:"물류 채널 (준비중)",defaultOpen:!1,children:Object.entries(UC).map(([_,S])=>{var T;return m.jsx(Dd,{channelKey:_,schema:S,current:((T=a.logisticsChannels)==null?void 0:T[_])??{},onSave:f("logisticsChannels",_),...h(`logisticsChannels.${_}`)},_)})}),m.jsxs(ed,{id:"cfg-advanced",title:"고급 설정",defaultOpen:!1,children:[m.jsx(Nd,{title:"소싱 환율 (USD → KRW)",description:"중국·해외 소싱 상품의 원가를 원화로 계산할 때 사용합니다.",fields:[{key:"usdToKrw",label:"환율",type:"number",placeholder:"1380",hint:"기본값: 1380",optional:!0}],values:{usdToKrw:a.usdToKrw??""},onSave:_=>c("usdToKrw",{...a,usdToKrw:_.usdToKrw?Number(_.usdToKrw):void 0}),...h("usdToKrw")}),m.jsx(Nd,{title:"DB 연결",description:"PostgreSQL에 운영 이력, 상품 매핑, 주문 내역을 저장합니다. 설정하지 않으면 로컬 파일(JSONL)에 저장됩니다.",fields:[{key:"url",label:"Connection URL",type:"text",placeholder:"postgresql://user:pass@host:5432/db",optional:!0}],values:{url:((g=a.database)==null?void 0:g.url)??""},onSave:_=>c("database",{...a,database:_.url?{url:String(_.url)}:void 0}),...h("database")}),m.jsx(Nd,{title:"프록시 설정",description:"Fly.io 정적 IP 프록시를 통해 쿠팡 IP 화이트리스트를 우회합니다.",fields:[{key:"enabled",label:"사용",type:"boolean"},{key:"baseUrl",label:"프록시 URL",type:"text",placeholder:"https://rocketsell-proxy.fly.dev",optional:!0}],values:{enabled:((y=a.proxy)==null?void 0:y.enabled)??!1,baseUrl:((b=a.proxy)==null?void 0:b.baseUrl)??""},onSave:_=>c("proxy",{...a,proxy:{enabled:!!_.enabled,baseUrl:_.baseUrl?String(_.baseUrl):void 0}}),...h("proxy")})]})]}),m.jsx("div",{className:"w-36 shrink-0","aria-hidden":"true"}),m.jsx(Mie,{})]})}const Hw=50;function Rie(){const[r,e]=Y.useState(""),[t,n]=Y.useState(""),[a,i]=Y.useState(0),[o,s]=Y.useState([]),[l,u]=Y.useState([]),[c,f]=Y.useState(""),h=Y.useRef(null),v=Y.useCallback(M=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{f(M),i(0)},300)},[]);Y.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]);const g={limit:String(Hw),offset:String(a*Hw)};r&&(g.from=r),t&&(g.to=t),o.length===1&&(g.channel=o[0]),l.length===1&&(g.status=l[0]),c&&(g.productSearch=c);const{data:y,isLoading:b,error:_}=yZ(g),{syncing:S,syncResult:T,handleSync:C}=KG();return m.jsx(jne,{orders:(y==null?void 0:y.orders)??[],total:(y==null?void 0:y.total)??0,isLoading:b,error:_,aggregates:y==null?void 0:y.aggregates,page:a,pageSize:Hw,onPageChange:i,dateFrom:r,dateTo:t,onDateChange:(M,D)=>{e(M),n(D),i(0)},onChannelChange:M=>{s(M),i(0)},onStatusChange:M=>{u(M),i(0)},onProductSearchChange:v,syncing:S,syncResult:T,onSync:C})}/*! *****************************************************************************
|
|
363
363
|
Copyright (c) Microsoft Corporation.
|
|
364
364
|
|
|
@@ -419,4 +419,4 @@ yyyy`);var n=wo(e),a=t?"getUTC":"get",i=n[a+"FullYear"](),o=n[a+"Month"]()+1,s=n
|
|
|
419
419
|
|
|
420
420
|
`:"<br/>",_=f.join(b);this._showOrMove(s,function(){this._updateContentNotChangedOnAxis(t,u)?this._updatePosition(s,v,o[0],o[1],this._tooltipContent,u):this._showTooltipContent(s,_,u,Math.random()+"",o[0],o[1],v,null,h)})},e.prototype._showSeriesItemTooltip=function(t,n,a){var i=this._ecModel,o=Ge(n),s=o.seriesIndex,l=i.getSeriesByIndex(s),u=o.dataModel||l,c=o.dataIndex,f=o.dataType,h=u.getData(f),v=this._renderMode,g=t.positionDefault,y=Np([h.getItemModel(c),u,l&&(l.coordinateSystem||{}).model],this._tooltipModel,g?{position:g}:null),b=y.get("trigger");if(!(b!=null&&b!=="item")){var _=u.getDataParams(c,f),S=new O2;_.marker=S.makeTooltipMarker("item",Wc(_.color),v);var T=g5(u.formatTooltip(c,!1,f)),C=y.get("order"),M=y.get("valueFormatter"),D=T.frag,L=D?S5(M?oe({valueFormatter:M},D):D,S,v,C,i.get("useUTC"),y.get("textStyle")):T.text,k="item_"+u.name+"_"+c;this._showOrMove(y,function(){this._showTooltipContent(y,L,_,k,t.offsetX,t.offsetY,t.position,t.target,S)}),a({type:"showTip",dataIndexInside:c,dataIndex:h.getRawIndex(c),seriesIndex:s,from:this.uid})}},e.prototype._showComponentItemTooltip=function(t,n,a){var i=this._renderMode==="html",o=Ge(n),s=o.tooltipConfig,l=s.option||{},u=l.encodeHTMLContent;if(_e(l)){var c=l;l={content:c,formatter:c},u=!0}u&&i&&l.content&&(l=ke(l),l.content=In(l.content));var f=[l],h=this._ecModel.getComponent(o.componentMainType,o.componentIndex);h&&f.push(h),f.push({formatter:l.content});var v=t.positionDefault,g=Np(f,this._tooltipModel,v?{position:v}:null),y=g.get("content"),b=Math.random()+"",_=new O2;this._showOrMove(g,function(){var S=ke(g.get("formatterParams")||{});this._showTooltipContent(g,y,S,b,t.offsetX,t.offsetY,t.position,n,_)}),a({type:"showTip",from:this.uid})},e.prototype._showTooltipContent=function(t,n,a,i,o,s,l,u,c){if(this._ticket="",!(!t.get("showContent")||!t.get("show"))){var f=this._tooltipContent;f.setEnterable(t.get("enterable"));var h=t.get("formatter");l=l||t.get("position");var v=n,g=this._getNearestPoint([o,s],a,t.get("trigger"),t.get("borderColor"),t.get("defaultBorderColor",!0)),y=g.color;if(h)if(_e(h)){var b=t.ecModel.get("useUTC"),_=ue(a)?a[0]:a,S=_&&_.axisType&&_.axisType.indexOf("time")>=0;v=h,S&&(v=Am(_.axisValue,v,b)),v=RN(v,a,!0)}else if(Le(h)){var T=we(function(C,M){C===this._ticket&&(f.setContent(M,c,t,y,l),this._updatePosition(t,l,o,s,f,a,u))},this);this._ticket=i,v=h(a,i,T)}else v=h;f.setContent(v,c,t,y,l),f.show(t,y),this._updatePosition(t,l,o,s,f,a,u)}},e.prototype._getNearestPoint=function(t,n,a,i,o){if(a==="axis"||ue(n))return{color:i||o};if(!ue(n))return{color:i||n.color||n.borderColor}},e.prototype._updatePosition=function(t,n,a,i,o,s,l){var u=this._api.getWidth(),c=this._api.getHeight();n=n||t.get("position");var f=o.getSize(),h=t.get("align"),v=t.get("verticalAlign"),g=l&&l.getBoundingRect().clone();if(l&&g.applyTransform(l.transform),Le(n)&&(n=n([a,i],s,o.el,g,{viewSize:[u,c],contentSize:f.slice()})),ue(n))a=be(n[0],u),i=be(n[1],c);else if(Oe(n)){var y=n;y.width=f[0],y.height=f[1];var b=tr(y,{width:u,height:c});a=b.x,i=b.y,h=null,v=null}else if(_e(n)&&l){var _=N2e(n,g,f,t.get("borderWidth"));a=_[0],i=_[1]}else{var _=M2e(a,i,o,u,c,h?null:20,v?null:20);a=_[0],i=_[1]}if(h&&(a-=tV(h)?f[0]/2:h==="right"?f[0]:0),v&&(i-=tV(v)?f[1]/2:v==="bottom"?f[1]:0),kY(t)){var _=D2e(a,i,o,u,c);a=_[0],i=_[1]}o.moveTo(a,i)},e.prototype._updateContentNotChangedOnAxis=function(t,n){var a=this._lastDataByCoordSys,i=this._cbParamsList,o=!!a&&a.length===t.length;return o&&P(a,function(s,l){var u=s.dataByAxis||[],c=t[l]||{},f=c.dataByAxis||[];o=o&&u.length===f.length,o&&P(u,function(h,v){var g=f[v]||{},y=h.seriesDataIndices||[],b=g.seriesDataIndices||[];o=o&&h.value===g.value&&h.axisType===g.axisType&&h.axisId===g.axisId&&y.length===b.length,o&&P(y,function(_,S){var T=b[S];o=o&&_.seriesIndex===T.seriesIndex&&_.dataIndex===T.dataIndex}),i&&P(h.seriesDataIndices,function(_){var S=_.seriesIndex,T=n[S],C=i[S];T&&C&&C.data!==T.data&&(o=!1)})})}),this._lastDataByCoordSys=t,this._cbParamsList=n,!!o},e.prototype._hide=function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},e.prototype.dispose=function(t,n){dt.node||!n.getDom()||(Gg(this,"_updatePosition"),this._tooltipContent.dispose(),zM("itemTooltip",n))},e.type="tooltip",e})(Ft);function Np(r,e,t){var n=e.ecModel,a;t?(a=new ut(t,n,n),a=new ut(e.option,a,n)):a=e;for(var i=r.length-1;i>=0;i--){var o=r[i];o&&(o instanceof ut&&(o=o.get("tooltip",!0)),_e(o)&&(o={formatter:o}),o&&(a=new ut(o,a,n)))}return a}function eV(r,e){return r.dispatchAction||we(e.dispatchAction,e)}function M2e(r,e,t,n,a,i,o){var s=t.getSize(),l=s[0],u=s[1];return i!=null&&(r+l+i+2>n?r-=l+i:r+=i),o!=null&&(e+u+o>a?e-=u+o:e+=o),[r,e]}function D2e(r,e,t,n,a){var i=t.getSize(),o=i[0],s=i[1];return r=Math.min(r+o,n)-o,e=Math.min(e+s,a)-s,r=Math.max(r,0),e=Math.max(e,0),[r,e]}function N2e(r,e,t,n){var a=t[0],i=t[1],o=Math.ceil(Math.SQRT2*n)+8,s=0,l=0,u=e.width,c=e.height;switch(r){case"inside":s=e.x+u/2-a/2,l=e.y+c/2-i/2;break;case"top":s=e.x+u/2-a/2,l=e.y-i-o;break;case"bottom":s=e.x+u/2-a/2,l=e.y+c+o;break;case"left":s=e.x-a-o,l=e.y+c/2-i/2;break;case"right":s=e.x+u+o,l=e.y+c/2-i/2}return[s,l]}function tV(r){return r==="center"||r==="middle"}function L2e(r,e,t){var n=eN(r).queryOptionMap,a=n.keys()[0];if(!(!a||a==="series")){var i=Eh(e,a,n.get(a),{useDefault:!1,enableAll:!1,enableNone:!1}),o=i.models[0];if(o){var s=t.getViewOfComponentModel(o),l;if(s.group.traverse(function(u){var c=Ge(u).tooltipConfig;if(c&&c.name===r.name)return l=u,!0}),l)return{componentMainType:a,componentIndex:o.componentIndex,el:l}}}}function k2e(r){tt(Om),r.registerComponentModel(h2e),r.registerComponentView(A2e),r.registerAction({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},vr),r.registerAction({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},vr)}var R2e=["rect","polygon","keep","clear"];function E2e(r,e){var t=Ht(r?r.brush:[]);if(t.length){var n=[];P(t,function(l){var u=l.hasOwnProperty("toolbox")?l.toolbox:[];u instanceof Array&&(n=n.concat(u))});var a=r&&r.toolbox;ue(a)&&(a=a[0]),a||(a={feature:{}},r.toolbox=[a]);var i=a.feature||(a.feature={}),o=i.brush||(i.brush={}),s=o.type||(o.type=[]);s.push.apply(s,n),I2e(s),e&&!s.length&&s.push.apply(s,R2e)}}function I2e(r){var e={};P(r,function(t){e[t]=1}),r.length=0,P(e,function(t,n){r.push(n)})}var rV=P;function nV(r){if(r){for(var e in r)if(r.hasOwnProperty(e))return!0}}function $M(r,e,t){var n={};return rV(e,function(i){var o=n[i]=a();rV(r[i],function(s,l){if(Qr.isValidType(l)){var u={type:l,visual:s};t&&t(u,i),o[l]=new Qr(u),l==="opacity"&&(u=ke(u),u.type="colorAlpha",o.__hidden.__alphaForOpacity=new Qr(u))}})}),n;function a(){var i=function(){};i.prototype.__hidden=i.prototype;var o=new i;return o}}function OY(r,e,t){var n;P(t,function(a){e.hasOwnProperty(a)&&nV(e[a])&&(n=!0)}),n&&P(t,function(a){e.hasOwnProperty(a)&&nV(e[a])?r[a]=ke(e[a]):delete r[a]})}function O2e(r,e,t,n,a,i){var o={};P(r,function(f){var h=Qr.prepareVisualTypes(e[f]);o[f]=h});var s;function l(f){return HN(t,s,f)}function u(f,h){R7(t,s,f,h)}t.each(c);function c(f,h){s=f;var v=t.getRawDataItem(s);if(!(v&&v.visualMap===!1))for(var g=n.call(a,f),y=e[g],b=o[g],_=0,S=b.length;_<S;_++){var T=b[_];y[T]&&y[T].applyVisual(f,l,u)}}}function P2e(r,e,t,n){var a={};return P(r,function(i){var o=Qr.prepareVisualTypes(e[i]);a[i]=o}),{progress:function(o,s){var l;n!=null&&(l=s.getDimensionIndex(n));function u(M){return HN(s,f,M)}function c(M,D){R7(s,f,M,D)}for(var f,h=s.getStore();(f=o.next())!=null;){var v=s.getRawDataItem(f);if(!(v&&v.visualMap===!1))for(var g=n!=null?h.get(l,f):f,y=t(g),b=e[y],_=a[y],S=0,T=_.length;S<T;S++){var C=_[S];b[C]&&b[C].applyVisual(g,u,c)}}}}}function j2e(r){var e=r.brushType,t={point:function(n){return aV[e].point(n,t,r)},rect:function(n){return aV[e].rect(n,t,r)}};return t}var aV={lineX:iV(0),lineY:iV(1),rect:{point:function(r,e,t){return r&&t.boundingRect.contain(r[0],r[1])},rect:function(r,e,t){return r&&t.boundingRect.intersect(r)}},polygon:{point:function(r,e,t){return r&&t.boundingRect.contain(r[0],r[1])&&uc(t.range,r[0],r[1])},rect:function(r,e,t){var n=t.range;if(!r||n.length<=1)return!1;var a=r.x,i=r.y,o=r.width,s=r.height,l=n[0];if(uc(n,a,i)||uc(n,a+o,i)||uc(n,a,i+s)||uc(n,a+o,i+s)||Be.create(r).contain(l[0],l[1])||Wp(a,i,a+o,i,n)||Wp(a,i,a,i+s,n)||Wp(a+o,i,a+o,i+s,n)||Wp(a,i+s,a+o,i+s,n))return!0}}};function iV(r){var e=["x","y"],t=["width","height"];return{point:function(n,a,i){if(n){var o=i.range,s=n[r];return Lp(s,o)}},rect:function(n,a,i){if(n){var o=i.range,s=[n[e[r]],n[e[r]]+n[t[r]]];return s[1]<s[0]&&s.reverse(),Lp(s[0],o)||Lp(s[1],o)||Lp(o[0],s)||Lp(o[1],s)}}}}function Lp(r,e){return e[0]<=r&&r<=e[1]}var oV=["inBrush","outOfBrush"],tC="__ecBrushSelect",XM="__ecInBrushSelectEvent";function PY(r){r.eachComponent({mainType:"brush"},function(e){var t=e.brushTargetManager=new uk(e.option,r);t.setInputRanges(e.areas,r)})}function z2e(r,e,t){var n=[],a,i;r.eachComponent({mainType:"brush"},function(o){t&&t.type==="takeGlobalCursor"&&o.setBrushOption(t.key==="brush"?t.brushOption:{brushType:!1})}),PY(r),r.eachComponent({mainType:"brush"},function(o,s){var l={brushId:o.id,brushIndex:s,brushName:o.name,areas:ke(o.areas),selected:[]};n.push(l);var u=o.option,c=u.brushLink,f=[],h=[],v=[],g=!1;s||(a=u.throttleType,i=u.throttleDelay);var y=ce(o.areas,function(M){var D=H2e[M.brushType],L=Ie({boundingRect:D?D(M):void 0},M);return L.selectors=j2e(L),L}),b=$M(o.option,oV,function(M){M.mappingMethod="fixed"});ue(c)&&P(c,function(M){f[M]=1});function _(M){return c==="all"||!!f[M]}function S(M){return!!M.length}r.eachSeries(function(M,D){var L=v[D]=[];M.subType==="parallel"?T(M,D):C(M,D,L)});function T(M,D){var L=M.coordinateSystem;g=g||L.hasAxisBrushed(),_(D)&&L.eachActiveState(M.getData(),function(k,R){k==="active"&&(h[R]=1)})}function C(M,D,L){if(!(!M.brushSelector||G2e(o,D))&&(P(y,function(R){o.brushTargetManager.controlSeries(R,M,r)&&L.push(R),g=g||S(L)}),_(D)&&S(L))){var k=M.getData();k.each(function(R){sV(M,L,k,R)&&(h[R]=1)})}}r.eachSeries(function(M,D){var L={seriesId:M.id,seriesIndex:D,seriesName:M.name,dataIndex:[]};l.selected.push(L);var k=v[D],R=M.getData(),E=_(D)?function(I){return h[I]?(L.dataIndex.push(R.getRawIndex(I)),"inBrush"):"outOfBrush"}:function(I){return sV(M,k,R,I)?(L.dataIndex.push(R.getRawIndex(I)),"inBrush"):"outOfBrush"};(_(D)?g:S(k))&&O2e(oV,b,R,E)})}),B2e(e,a,i,n,t)}function B2e(r,e,t,n,a){if(a){var i=r.getZr();if(!i[XM]){i[tC]||(i[tC]=V2e);var o=Uh(i,tC,t,e);o(r,n)}}}function V2e(r,e){if(!r.isDisposed()){var t=r.getZr();t[XM]=!0,r.dispatchAction({type:"brushSelect",batch:e}),t[XM]=!1}}function sV(r,e,t,n){for(var a=0,i=e.length;a<i;a++){var o=e[a];if(r.brushSelector(n,t,o.selectors,o))return!0}}function G2e(r,e){var t=r.option.seriesIndex;return t!=null&&t!=="all"&&(ue(t)?Ze(t,e)<0:e!==t)}var H2e={rect:function(r){return lV(r.range)},polygon:function(r){for(var e,t=r.range,n=0,a=t.length;n<a;n++){e=e||[[1/0,-1/0],[1/0,-1/0]];var i=t[n];i[0]<e[0][0]&&(e[0][0]=i[0]),i[0]>e[0][1]&&(e[0][1]=i[0]),i[1]<e[1][0]&&(e[1][0]=i[1]),i[1]>e[1][1]&&(e[1][1]=i[1])}return e&&lV(e)}};function lV(r){return new Be(r[0][0],r[1][0],r[0][1]-r[0][0],r[1][1]-r[1][0])}var F2e=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,n){this.ecModel=t,this.api=n,this.model,(this._brushController=new IL(n.getZr())).on("brush",we(this._onBrush,this)).mount()},e.prototype.render=function(t,n,a,i){this.model=t,this._updateController(t,n,a,i)},e.prototype.updateTransform=function(t,n,a,i){PY(n),this._updateController(t,n,a,i)},e.prototype.updateVisual=function(t,n,a,i){this.updateTransform(t,n,a,i)},e.prototype.updateView=function(t,n,a,i){this._updateController(t,n,a,i)},e.prototype._updateController=function(t,n,a,i){(!i||i.$from!==t.id)&&this._brushController.setPanels(t.brushTargetManager.makePanelOpts(a)).enableBrush(t.brushOption).updateCovers(t.areas.slice())},e.prototype.dispose=function(){this._brushController.dispose()},e.prototype._onBrush=function(t){var n=this.model.id,a=this.model.brushTargetManager.setOutputRanges(t.areas,this.ecModel);(!t.isEnd||t.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:n,areas:ke(a),$from:n}),t.isEnd&&this.api.dispatchAction({type:"brushEnd",brushId:n,areas:ke(a),$from:n})},e.type="brush",e})(Ft),U2e=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.areas=[],t.brushOption={},t}return e.prototype.optionUpdated=function(t,n){var a=this.option;!n&&OY(a,t,["inBrush","outOfBrush"]);var i=a.inBrush=a.inBrush||{};a.outOfBrush=a.outOfBrush||{color:this.option.defaultOutOfBrushColor},i.hasOwnProperty("liftZ")||(i.liftZ=5)},e.prototype.setAreas=function(t){t&&(this.areas=ce(t,function(n){return uV(this.option,n)},this))},e.prototype.setBrushOption=function(t){this.brushOption=uV(this.option,t),this.brushType=this.brushOption.brushType},e.type="brush",e.dependencies=["geo","grid","xAxis","yAxis","parallel","series"],e.defaultOption={seriesIndex:"all",brushType:"rect",brushMode:"single",transformable:!0,brushStyle:{borderWidth:1,color:te.color.backgroundTint,borderColor:te.color.borderTint},throttleType:"fixRate",throttleDelay:0,removeOnClick:!0,z:1e4,defaultOutOfBrushColor:te.color.disabled},e})(ot);function uV(r,e){return Je({brushType:r.brushType,brushMode:r.brushMode,transformable:r.transformable,brushStyle:new ut(r.brushStyle).getItemStyle(),removeOnClick:r.removeOnClick,z:r.z},e,!0)}var W2e=["rect","polygon","lineX","lineY","keep","clear"],Y2e=(function(r){K(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.render=function(t,n,a){var i,o,s;n.eachComponent({mainType:"brush"},function(l){i=l.brushType,o=l.brushOption.brushMode||"single",s=s||!!l.areas.length}),this._brushType=i,this._brushMode=o,P(t.get("type",!0),function(l){t.setIconStatus(l,(l==="keep"?o==="multiple":l==="clear"?s:l===i)?"emphasis":"normal")})},e.prototype.updateView=function(t,n,a){this.render(t,n,a)},e.prototype.getIcons=function(){var t=this.model,n=t.get("icon",!0),a={};return P(t.get("type",!0),function(i){n[i]&&(a[i]=n[i])}),a},e.prototype.onclick=function(t,n,a){var i=this._brushType,o=this._brushMode;a==="clear"?(n.dispatchAction({type:"axisAreaSelect",intervals:[]}),n.dispatchAction({type:"brush",command:"clear",areas:[]})):n.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:a==="keep"?i:i===a?!1:a,brushMode:a==="keep"?o==="multiple"?"single":"multiple":o}})},e.getDefaultOption=function(t){var n={show:!0,type:W2e.slice(),icon:{rect:"M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13",polygon:"M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2",lineX:"M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4",lineY:"M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4",keep:"M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z",clear:"M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2"},title:t.getLocaleModel().get(["toolbox","brush","title"])};return n},e})(Ka);function $2e(r){r.registerComponentView(F2e),r.registerComponentModel(U2e),r.registerPreprocessor(E2e),r.registerVisual(r.PRIORITY.VISUAL.BRUSH,z2e),r.registerAction({type:"brush",event:"brush",update:"updateVisual"},function(e,t){t.eachComponent({mainType:"brush",query:e},function(n){n.setAreas(e.areas)})}),r.registerAction({type:"brushSelect",event:"brushSelected",update:"none"},vr),r.registerAction({type:"brushEnd",event:"brushEnd",update:"none"},vr),Ed("brush",Y2e)}var X2e=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.layoutMode={type:"box",ignoreSize:!0},t}return e.type="title",e.defaultOption={z:6,show:!0,text:"",target:"blank",subtext:"",subtarget:"blank",left:"center",top:te.size.m,backgroundColor:te.color.transparent,borderColor:te.color.primary,borderWidth:0,padding:5,itemGap:10,textStyle:{fontSize:18,fontWeight:"bold",color:te.color.primary},subtextStyle:{fontSize:12,color:te.color.quaternary}},e})(ot),q2e=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,n,a){if(this.group.removeAll(),!!t.get("show")){var i=this.group,o=t.getModel("textStyle"),s=t.getModel("subtextStyle"),l=t.get("textAlign"),u=De(t.get("textBaseline"),t.get("textVerticalAlign")),c=new pt({style:Gt(o,{text:t.get("text"),fill:o.getTextColor()},{disableBox:!0}),z2:10}),f=c.getBoundingRect(),h=t.get("subtext"),v=new pt({style:Gt(s,{text:h,fill:s.getTextColor(),y:f.height+t.get("itemGap"),verticalAlign:"top"},{disableBox:!0}),z2:10}),g=t.get("link"),y=t.get("sublink"),b=t.get("triggerEvent",!0);c.silent=!g&&!b,v.silent=!y&&!b,g&&c.on("click",function(){C1(g,"_"+t.get("target"))}),y&&v.on("click",function(){C1(y,"_"+t.get("subtarget"))}),Ge(c).eventData=Ge(v).eventData=b?{componentType:"title",componentIndex:t.componentIndex}:null,i.add(c),h&&i.add(v);var _=i.getBoundingRect(),S=t.getBoxLayoutParams();S.width=_.width,S.height=_.height;var T=Fr(t,a),C=tr(S,T.refContainer,t.get("padding"));l||(l=t.get("left")||t.get("right"),l==="middle"&&(l="center"),l==="right"?C.x+=C.width:l==="center"&&(C.x+=C.width/2)),u||(u=t.get("top")||t.get("bottom"),u==="center"&&(u="middle"),u==="bottom"?C.y+=C.height:u==="middle"&&(C.y+=C.height/2),u=u||"top"),i.x=C.x,i.y=C.y,i.markRedraw();var M={align:l,verticalAlign:u};c.setStyle(M),v.setStyle(M),_=i.getBoundingRect();var D=C.margin,L=t.getItemStyle(["color","opacity"]);L.fill=t.get("backgroundColor");var k=new rt({shape:{x:_.x-D[3],y:_.y-D[0],width:_.width+D[1]+D[3],height:_.height+D[0]+D[2],r:t.get("borderRadius")},style:L,subPixelOptimize:!0,silent:!0});i.add(k)}},e.type="title",e})(Ft);function Z2e(r){r.registerComponentModel(X2e),r.registerComponentView(q2e)}var cV=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.layoutMode="box",t}return e.prototype.init=function(t,n,a){this.mergeDefaultAndTheme(t,a),this._initData()},e.prototype.mergeOption=function(t){r.prototype.mergeOption.apply(this,arguments),this._initData()},e.prototype.setCurrentIndex=function(t){t==null&&(t=this.option.currentIndex);var n=this._data.count();this.option.loop?t=(t%n+n)%n:(t>=n&&(t=n-1),t<0&&(t=0)),this.option.currentIndex=t},e.prototype.getCurrentIndex=function(){return this.option.currentIndex},e.prototype.isIndexMax=function(){return this.getCurrentIndex()>=this._data.count()-1},e.prototype.setPlayState=function(t){this.option.autoPlay=!!t},e.prototype.getPlayState=function(){return!!this.option.autoPlay},e.prototype._initData=function(){var t=this.option,n=t.data||[],a=t.axisType,i=this._names=[],o;a==="category"?(o=[],P(n,function(u,c){var f=Br(Rh(u),""),h;Oe(u)?(h=ke(u),h.value=c):h=c,o.push(h),i.push(f)})):o=n;var s={category:"ordinal",time:"time",value:"number"}[a]||"number",l=this._data=new Pn([{name:"value",type:s}],this);l.initData(o,i)},e.prototype.getData=function(){return this._data},e.prototype.getCategories=function(){if(this.get("axisType")==="category")return this._names.slice()},e.type="timeline",e.defaultOption={z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:te.size.m,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:te.color.secondary},data:[]},e})(ot),jY=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="timeline.slider",e.defaultOption=su(cV.defaultOption,{backgroundColor:"rgba(0,0,0,0)",borderColor:te.color.border,borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"circle",symbolSize:12,lineStyle:{show:!0,width:2,color:te.color.accent10},label:{position:"auto",show:!0,interval:"auto",rotate:0,color:te.color.tertiary},itemStyle:{color:te.color.accent20,borderWidth:0},checkpointStyle:{symbol:"circle",symbolSize:15,color:te.color.accent50,borderColor:te.color.accent50,borderWidth:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"rgba(0, 0, 0, 0)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:24,itemGap:12,position:"left",playIcon:"path://M15 0C23.2843 0 30 6.71573 30 15C30 23.2843 23.2843 30 15 30C6.71573 30 0 23.2843 0 15C0 6.71573 6.71573 0 15 0ZM15 3C8.37258 3 3 8.37258 3 15C3 21.6274 8.37258 27 15 27C21.6274 27 27 21.6274 27 15C27 8.37258 21.6274 3 15 3ZM11.5 10.6699C11.5 9.90014 12.3333 9.41887 13 9.80371L20.5 14.1338C21.1667 14.5187 21.1667 15.4813 20.5 15.8662L13 20.1963C12.3333 20.5811 11.5 20.0999 11.5 19.3301V10.6699Z",stopIcon:"path://M15 0C23.2843 0 30 6.71573 30 15C30 23.2843 23.2843 30 15 30C6.71573 30 0 23.2843 0 15C0 6.71573 6.71573 0 15 0ZM15 3C8.37258 3 3 8.37258 3 15C3 21.6274 8.37258 27 15 27C21.6274 27 27 21.6274 27 15C27 8.37258 21.6274 3 15 3ZM11.5 10C12.3284 10 13 10.6716 13 11.5V18.5C13 19.3284 12.3284 20 11.5 20C10.6716 20 10 19.3284 10 18.5V11.5C10 10.6716 10.6716 10 11.5 10ZM18.5 10C19.3284 10 20 10.6716 20 11.5V18.5C20 19.3284 19.3284 20 18.5 20C17.6716 20 17 19.3284 17 18.5V11.5C17 10.6716 17.6716 10 18.5 10Z",nextIcon:"path://M0.838834 18.7383C0.253048 18.1525 0.253048 17.2028 0.838834 16.617L7.55635 9.89949L0.838834 3.18198C0.253048 2.59619 0.253048 1.64645 0.838834 1.06066C1.42462 0.474874 2.37437 0.474874 2.96015 1.06066L10.7383 8.83883L10.8412 8.95277C11.2897 9.50267 11.2897 10.2963 10.8412 10.8462L10.7383 10.9602L2.96015 18.7383C2.37437 19.3241 1.42462 19.3241 0.838834 18.7383Z",prevIcon:"path://M10.9602 1.06066C11.5459 1.64645 11.5459 2.59619 10.9602 3.18198L4.24264 9.89949L10.9602 16.617C11.5459 17.2028 11.5459 18.1525 10.9602 18.7383C10.3744 19.3241 9.42462 19.3241 8.83883 18.7383L1.06066 10.9602L0.957771 10.8462C0.509245 10.2963 0.509245 9.50267 0.957771 8.95277L1.06066 8.83883L8.83883 1.06066C9.42462 0.474874 10.3744 0.474874 10.9602 1.06066Z",prevBtnSize:18,nextBtnSize:18,color:te.color.accent50,borderColor:te.color.accent50,borderWidth:0},emphasis:{label:{show:!0,color:te.color.accent60},itemStyle:{color:te.color.accent60,borderColor:te.color.accent60},controlStyle:{color:te.color.accent70,borderColor:te.color.accent70}},progress:{lineStyle:{color:te.color.accent30},itemStyle:{color:te.color.accent40}},data:[]}),e})(cV);gr(jY,Kb.prototype);var K2e=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="timeline",e})(Ft),Q2e=(function(r){K(e,r);function e(t,n,a,i){var o=r.call(this,t,n,a)||this;return o.type=i||"value",o}return e.prototype.getLabelModel=function(){return this.model.getModel("label")},e.prototype.isHorizontal=function(){return this.model.get("orient")==="horizontal"},e})(si),rC=Math.PI,fV=st(),J2e=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(t,n){this.api=n},e.prototype.render=function(t,n,a){if(this.model=t,this.api=a,this.ecModel=n,this.group.removeAll(),t.get("show",!0)){var i=this._layout(t,a),o=this._createGroup("_mainGroup"),s=this._createGroup("_labelGroup"),l=this._axis=this._createAxis(i,t);t.formatTooltip=function(u){var c=l.scale.getLabel({value:u});return Ir("nameValue",{noName:!0,value:c})},P(["AxisLine","AxisTick","Control","CurrentPointer"],function(u){this["_render"+u](i,o,l,t)},this),this._renderAxisLabel(i,s,l,t),this._position(i,t)}this._doPlayStop(),this._updateTicksStatus()},e.prototype.remove=function(){this._clearTimer(),this.group.removeAll()},e.prototype.dispose=function(){this._clearTimer()},e.prototype._layout=function(t,n){var a=t.get(["label","position"]),i=t.get("orient"),o=tTe(t,n),s;a==null||a==="auto"?s=i==="horizontal"?o.y+o.height/2<n.getHeight()/2?"-":"+":o.x+o.width/2<n.getWidth()/2?"+":"-":_e(a)?s={horizontal:{top:"-",bottom:"+"},vertical:{left:"-",right:"+"}}[i][a]:s=a;var l={horizontal:"center",vertical:s>=0||s==="+"?"left":"right"},u={horizontal:s>=0||s==="+"?"top":"bottom",vertical:"middle"},c={horizontal:0,vertical:rC/2},f=i==="vertical"?o.height:o.width,h=t.getModel("controlStyle"),v=h.get("show",!0),g=v?h.get("itemSize"):0,y=v?h.get("itemGap"):0,b=g+y,_=t.get(["label","rotate"])||0;_=_*rC/180;var S,T,C,M=h.get("position",!0),D=v&&h.get("showPlayBtn",!0),L=v&&h.get("showPrevBtn",!0),k=v&&h.get("showNextBtn",!0),R=0,E=f;M==="left"||M==="bottom"?(D&&(S=[0,0],R+=b),L&&(T=[R,0],R+=b),k&&(C=[E-g,0],E-=b)):(D&&(S=[E-g,0],E-=b),L&&(T=[0,0],R+=b),k&&(C=[E-g,0],E-=b));var I=[R,E];return t.get("inverse")&&I.reverse(),{viewRect:o,mainLength:f,orient:i,rotation:c[i],labelRotation:_,labelPosOpt:s,labelAlign:t.get(["label","align"])||l[i],labelBaseline:t.get(["label","verticalAlign"])||t.get(["label","baseline"])||u[i],playPosition:S,prevBtnPosition:T,nextBtnPosition:C,axisExtent:I,controlSize:g,controlGap:y}},e.prototype._position=function(t,n){var a=this._mainGroup,i=this._labelGroup,o=t.viewRect;if(t.orient==="vertical"){var s=Kr(),l=o.x,u=o.y+o.height;Ai(s,s,[-l,-u]),Ms(s,s,-rC/2),Ai(s,s,[l,u]),o=o.clone(),o.applyTransform(s)}var c=S(o),f=S(a.getBoundingRect()),h=S(i.getBoundingRect()),v=[a.x,a.y],g=[i.x,i.y];g[0]=v[0]=c[0][0];var y=t.labelPosOpt;if(y==null||_e(y)){var b=y==="+"?0:1;T(v,f,c,1,b),T(g,h,c,1,1-b)}else{var b=y>=0?0:1;T(v,f,c,1,b),g[1]=v[1]+y}a.setPosition(v),i.setPosition(g),a.rotation=i.rotation=t.rotation,_(a),_(i);function _(C){C.originX=c[0][0]-C.x,C.originY=c[1][0]-C.y}function S(C){return[[C.x,C.x+C.width],[C.y,C.y+C.height]]}function T(C,M,D,L,k){C[L]+=D[L][k]-M[L][k]}},e.prototype._createAxis=function(t,n){var a=n.getData(),i=n.get("axisType"),o=eTe(n,i);o.getTicks=function(){return a.mapArray(["value"],function(u){return{value:u}})};var s=a.getDataExtent("value");o.setExtent(s[0],s[1]),o.calcNiceTicks();var l=new Q2e("value",o,t.axisExtent,i);return l.model=n,l},e.prototype._createGroup=function(t){var n=this[t]=new Re;return this.group.add(n),n},e.prototype._renderAxisLine=function(t,n,a,i){var o=a.getExtent();if(i.get(["lineStyle","show"])){var s=new Cr({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:oe({lineCap:"round"},i.getModel("lineStyle").getLineStyle()),silent:!0,z2:1});n.add(s);var l=this._progressLine=new Cr({shape:{x1:o[0],x2:this._currentPointer?this._currentPointer.x:o[0],y1:0,y2:0},style:Ie({lineCap:"round",lineWidth:s.style.lineWidth},i.getModel(["progress","lineStyle"]).getLineStyle()),silent:!0,z2:1});n.add(l)}},e.prototype._renderAxisTick=function(t,n,a,i){var o=this,s=i.getData(),l=a.scale.getTicks();this._tickSymbols=[],P(l,function(u){var c=a.dataToCoord(u.value),f=s.getItemModel(u.value),h=f.getModel("itemStyle"),v=f.getModel(["emphasis","itemStyle"]),g=f.getModel(["progress","itemStyle"]),y={x:c,y:0,onclick:we(o._changeTimeline,o,u.value)},b=dV(f,h,n,y);b.ensureState("emphasis").style=v.getItemStyle(),b.ensureState("progress").style=g.getItemStyle(),Gl(b);var _=Ge(b);f.get("tooltip")?(_.dataIndex=u.value,_.dataModel=i):_.dataIndex=_.dataModel=null,o._tickSymbols.push(b)})},e.prototype._renderAxisLabel=function(t,n,a,i){var o=this,s=a.getLabelModel();if(s.get("show")){var l=i.getData(),u=a.getViewLabels();this._tickLabels=[],P(u,function(c){var f=c.tickValue,h=l.getItemModel(f),v=h.getModel("label"),g=h.getModel(["emphasis","label"]),y=h.getModel(["progress","label"]),b=a.dataToCoord(c.tickValue),_=new pt({x:b,y:0,rotation:t.labelRotation-t.rotation,onclick:we(o._changeTimeline,o,f),silent:!1,style:Gt(v,{text:c.formattedLabel,align:t.labelAlign,verticalAlign:t.labelBaseline})});_.ensureState("emphasis").style=Gt(g),_.ensureState("progress").style=Gt(y),n.add(_),Gl(_),fV(_).dataIndex=f,o._tickLabels.push(_)})}},e.prototype._renderControl=function(t,n,a,i){var o=t.controlSize,s=t.rotation,l=i.getModel("controlStyle").getItemStyle(),u=i.getModel(["emphasis","controlStyle"]).getItemStyle(),c=i.getPlayState(),f=i.get("inverse",!0);h(t.nextBtnPosition,"next",we(this._changeTimeline,this,f?"-":"+")),h(t.prevBtnPosition,"prev",we(this._changeTimeline,this,f?"+":"-")),h(t.playPosition,c?"stop":"play",we(this._handlePlayClick,this,!c),!0);function h(v,g,y,b){if(v){var _=Mi(De(i.get(["controlStyle",g+"BtnSize"]),o),o),S=[0,-_/2,_,_],T=rTe(i,g+"Icon",S,{x:v[0],y:v[1],originX:o/2,originY:0,rotation:b?-s:0,rectHover:!0,style:l,onclick:y});T.ensureState("emphasis").style=u,n.add(T),Gl(T)}}},e.prototype._renderCurrentPointer=function(t,n,a,i){var o=i.getData(),s=i.getCurrentIndex(),l=o.getItemModel(s).getModel("checkpointStyle"),u=this,c={onCreate:function(f){f.draggable=!0,f.drift=we(u._handlePointerDrag,u),f.ondragend=we(u._handlePointerDragend,u),hV(f,u._progressLine,s,a,i,!0)},onUpdate:function(f){hV(f,u._progressLine,s,a,i)}};this._currentPointer=dV(l,l,this._mainGroup,{},this._currentPointer,c)},e.prototype._handlePlayClick=function(t){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:t,from:this.uid})},e.prototype._handlePointerDrag=function(t,n,a){this._clearTimer(),this._pointerChangeTimeline([a.offsetX,a.offsetY])},e.prototype._handlePointerDragend=function(t){this._pointerChangeTimeline([t.offsetX,t.offsetY],!0)},e.prototype._pointerChangeTimeline=function(t,n){var a=this._toAxisCoord(t)[0],i=this._axis,o=Ta(i.getExtent().slice());a>o[1]&&(a=o[1]),a<o[0]&&(a=o[0]),this._currentPointer.x=a,this._currentPointer.markRedraw();var s=this._progressLine;s&&(s.shape.x2=a,s.dirty());var l=this._findNearestTick(a),u=this.model;(n||l!==u.getCurrentIndex()&&u.get("realtime"))&&this._changeTimeline(l)},e.prototype._doPlayStop=function(){var t=this;this._clearTimer(),this.model.getPlayState()&&(this._timer=setTimeout(function(){var n=t.model;t._changeTimeline(n.getCurrentIndex()+(n.get("rewind",!0)?-1:1))},this.model.get("playInterval")))},e.prototype._toAxisCoord=function(t){var n=this._mainGroup.getLocalTransform();return Si(t,n,!0)},e.prototype._findNearestTick=function(t){var n=this.model.getData(),a=1/0,i,o=this._axis;return n.each(["value"],function(s,l){var u=o.dataToCoord(s),c=Math.abs(u-t);c<a&&(a=c,i=l)}),i},e.prototype._clearTimer=function(){this._timer&&(clearTimeout(this._timer),this._timer=null)},e.prototype._changeTimeline=function(t){var n=this.model.getCurrentIndex();t==="+"?t=n+1:t==="-"&&(t=n-1),this.api.dispatchAction({type:"timelineChange",currentIndex:t,from:this.uid})},e.prototype._updateTicksStatus=function(){var t=this.model.getCurrentIndex(),n=this._tickSymbols,a=this._tickLabels;if(n)for(var i=0;i<n.length;i++)n&&n[i]&&n[i].toggleState("progress",i<t);if(a)for(var i=0;i<a.length;i++)a&&a[i]&&a[i].toggleState("progress",fV(a[i]).dataIndex<=t)},e.type="timeline.slider",e})(K2e);function eTe(r,e){if(e=e||r.get("type"),e)switch(e){case"category":return new bh({ordinalMeta:r.getCategories(),extent:[1/0,-1/0]});case"time":return new aL({locale:r.ecModel.getLocaleModel(),useUTC:r.ecModel.get("useUTC")});default:return new Ts}}function tTe(r,e){return tr(r.getBoxLayoutParams(),Fr(r,e).refContainer,r.get("padding"))}function rTe(r,e,t,n){var a=n.style,i=zh(r.get(["controlStyle",e]),n||{},new Be(t[0],t[1],t[2],t[3]));return a&&i.setStyle(a),i}function dV(r,e,t,n,a,i){var o=e.get("color");if(a)a.setColor(o),t.add(a),i&&i.onUpdate(a);else{var s=r.get("symbol");a=Ar(s,-1,-1,2,2,o),a.setStyle("strokeNoScale",!0),t.add(a),i&&i.onCreate(a)}var l=e.getItemStyle(["color"]);a.setStyle(l),n=Je({rectHover:!0,z2:100},n,!0);var u=Wh(r.get("symbolSize"));n.scaleX=u[0]/2,n.scaleY=u[1]/2;var c=af(r.get("symbolOffset"),u);c&&(n.x=(n.x||0)+c[0],n.y=(n.y||0)+c[1]);var f=r.get("symbolRotate");return n.rotation=(f||0)*Math.PI/180||0,a.attr(n),a.updateTransform(),a}function hV(r,e,t,n,a,i){if(!r.dragging){var o=a.getModel("checkpointStyle"),s=n.dataToCoord(a.getData().get("value",t));if(i||!o.get("animation",!0))r.attr({x:s,y:0}),e&&e.attr({shape:{x2:s}});else{var l={duration:o.get("animationDuration",!0),easing:o.get("animationEasing",!0)};r.stopAnimation(null,!0),r.animateTo({x:s,y:0},l),e&&e.animateTo({shape:{x2:s}},l)}}}function nTe(r){r.registerAction({type:"timelineChange",event:"timelineChanged",update:"prepareAndUpdate"},function(e,t,n){var a=t.getComponent("timeline");return a&&e.currentIndex!=null&&(a.setCurrentIndex(e.currentIndex),!a.get("loop",!0)&&a.isIndexMax()&&a.getPlayState()&&(a.setPlayState(!1),n.dispatchAction({type:"timelinePlayChange",playState:!1,from:e.from}))),t.resetOption("timeline",{replaceMerge:a.get("replaceMerge",!0)}),Ie({currentIndex:a.option.currentIndex},e)}),r.registerAction({type:"timelinePlayChange",event:"timelinePlayChanged",update:"update"},function(e,t){var n=t.getComponent("timeline");n&&e.playState!=null&&n.setPlayState(e.playState)})}function aTe(r){var e=r&&r.timeline;ue(e)||(e=e?[e]:[]),P(e,function(t){t&&iTe(t)})}function iTe(r){var e=r.type,t={number:"value",time:"time"};if(t[e]&&(r.axisType=t[e],delete r.type),vV(r),dc(r,"controlPosition")){var n=r.controlStyle||(r.controlStyle={});dc(n,"position")||(n.position=r.controlPosition),n.position==="none"&&!dc(n,"show")&&(n.show=!1,delete n.position),delete r.controlPosition}P(r.data||[],function(a){Oe(a)&&!ue(a)&&(!dc(a,"value")&&dc(a,"name")&&(a.value=a.name),vV(a))})}function vV(r){var e=r.itemStyle||(r.itemStyle={}),t=e.emphasis||(e.emphasis={}),n=r.label||r.label||{},a=n.normal||(n.normal={}),i={normal:1,emphasis:1};P(n,function(o,s){!i[s]&&!dc(a,s)&&(a[s]=o)}),t.label&&!dc(n,"emphasis")&&(n.emphasis=t.label,delete t.label)}function dc(r,e){return r.hasOwnProperty(e)}function oTe(r){r.registerComponentModel(jY),r.registerComponentView(J2e),r.registerSubTypeDefaulter("timeline",function(){return"slider"}),nTe(r),r.registerPreprocessor(aTe)}function dk(r,e){if(!r)return!1;for(var t=ue(r)?r:[r],n=0;n<t.length;n++)if(t[n]&&t[n][e])return!0;return!1}function fx(r){Bc(r,"label",["show"])}var dx=st(),_o=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.createdBySelf=!1,t.preventAutoZ=!0,t}return e.prototype.init=function(t,n,a){this.mergeDefaultAndTheme(t,a),this._mergeOption(t,a,!1,!0)},e.prototype.isAnimationEnabled=function(){if(dt.node)return!1;var t=this.__hostSeries;return this.getShallow("animation")&&t&&t.isAnimationEnabled()},e.prototype.mergeOption=function(t,n){this._mergeOption(t,n,!1,!1)},e.prototype._mergeOption=function(t,n,a,i){var o=this.mainType;a||n.eachSeries(function(s){var l=s.get(this.mainType,!0),u=dx(s)[o];if(!l||!l.data){dx(s)[o]=null;return}u?u._mergeOption(l,n,!0):(i&&fx(l),P(l.data,function(c){c instanceof Array?(fx(c[0]),fx(c[1])):fx(c)}),u=this.createMarkerModelFromSeries(l,this,n),oe(u,{mainType:this.mainType,seriesIndex:s.seriesIndex,name:s.name,createdBySelf:!0}),u.__hostSeries=s),dx(s)[o]=u},this)},e.prototype.formatTooltip=function(t,n,a){var i=this.getData(),o=this.getRawValue(t),s=i.getName(t);return Ir("section",{header:this.name,blocks:[Ir("nameValue",{name:s,value:o,noName:!s,noValue:o==null})]})},e.prototype.getData=function(){return this._data},e.prototype.setData=function(t){this._data=t},e.prototype.getDataParams=function(t,n){var a=Kb.prototype.getDataParams.call(this,t,n),i=this.__hostSeries;return i&&(a.seriesId=i.id,a.seriesName=i.name,a.seriesType=i.subType),a},e.getMarkerModelFromSeries=function(t,n){return dx(t)[n]},e.type="marker",e.dependencies=["series","grid","polar","geo"],e})(ot);gr(_o,Kb.prototype);var sTe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.createMarkerModelFromSeries=function(t,n,a){return new e(t,n,a)},e.type="markPoint",e.defaultOption={z:5,symbol:"pin",symbolSize:50,tooltip:{trigger:"item"},label:{show:!0,position:"inside"},itemStyle:{borderWidth:2},emphasis:{label:{show:!0}}},e})(_o);function qM(r){return!(isNaN(parseFloat(r.x))&&isNaN(parseFloat(r.y)))}function lTe(r){return!isNaN(parseFloat(r.x))&&!isNaN(parseFloat(r.y))}function hx(r,e,t,n,a,i,o){var s=[],l=ws(e,a),u=l?e.getCalculationInfo("stackResultDimension"):a,c=ob(e,u,r),f=e.hostModel,h=f.indicesOfNearest(t,u,c)[0];s[i]=e.get(n,h),s[o]=e.get(u,h);var v=e.get(a,h),g=yi(e.get(a,h));return g=Math.min(g,20),g>=0&&(s[o]=+s[o].toFixed(g)),[s,v]}var vx={min:qe(hx,"min"),max:qe(hx,"max"),average:qe(hx,"average"),median:qe(hx,"median")};function nm(r,e){if(e){var t=r.getData(),n=r.coordinateSystem,a=n&&n.dimensions;if(!lTe(e)&&!ue(e.coord)&&ue(a)){var i=zY(e,t,n,r);if(e=ke(e),e.type&&vx[e.type]&&i.baseAxis&&i.valueAxis){var o=Ze(a,i.baseAxis.dim),s=Ze(a,i.valueAxis.dim),l=vx[e.type](t,i.valueAxis.dim,i.baseDataDim,i.valueDataDim,o,s);e.coord=l[0],e.value=l[1]}else e.coord=[e.xAxis!=null?e.xAxis:e.radiusAxis,e.yAxis!=null?e.yAxis:e.angleAxis]}if(e.coord==null||!ue(a)){e.coord=[];var u=r.getBaseAxis();if(u&&e.type&&vx[e.type]){var c=n.getOtherAxis(u);c&&(e.value=ob(t,t.mapDimension(c.dim),e.type))}}else for(var f=e.coord,h=0;h<2;h++)vx[f[h]]&&(f[h]=ob(t,t.mapDimension(a[h]),f[h]));return e}}function zY(r,e,t,n){var a={};return r.valueIndex!=null||r.valueDim!=null?(a.valueDataDim=r.valueIndex!=null?e.getDimension(r.valueIndex):r.valueDim,a.valueAxis=t.getAxis(uTe(n,a.valueDataDim)),a.baseAxis=t.getOtherAxis(a.valueAxis),a.baseDataDim=e.mapDimension(a.baseAxis.dim)):(a.baseAxis=n.getBaseAxis(),a.valueAxis=t.getOtherAxis(a.baseAxis),a.baseDataDim=e.mapDimension(a.baseAxis.dim),a.valueDataDim=e.mapDimension(a.valueAxis.dim)),a}function uTe(r,e){var t=r.getData().getDimensionInfo(e);return t&&t.coordDim}function am(r,e){return r&&r.containData&&e.coord&&!qM(e)?r.containData(e.coord):!0}function cTe(r,e,t){return r&&r.containZone&&e.coord&&t.coord&&!qM(e)&&!qM(t)?r.containZone(e.coord,t.coord):!0}function BY(r,e){return r?function(t,n,a,i){var o=i<2?t.coord&&t.coord[i]:t.value;return Ul(o,e[i])}:function(t,n,a,i){return Ul(t.value,e[i])}}function ob(r,e,t){if(t==="average"){var n=0,a=0;return r.each(e,function(i,o){isNaN(i)||(n+=i,a++)}),n/a}else return t==="median"?r.getMedian(e):r.getDataExtent(e)[t==="max"?1:0]}var nC=st(),hk=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.init=function(){this.markerGroupMap=Ae()},e.prototype.render=function(t,n,a){var i=this,o=this.markerGroupMap;o.each(function(s){nC(s).keep=!1}),n.eachSeries(function(s){var l=_o.getMarkerModelFromSeries(s,i.type);l&&i.renderSeries(s,l,n,a)}),o.each(function(s){!nC(s).keep&&i.group.remove(s.group)}),fTe(n,o,this.type)},e.prototype.markKeep=function(t){nC(t).keep=!0},e.prototype.toggleBlurSeries=function(t,n){var a=this;P(t,function(i){var o=_o.getMarkerModelFromSeries(i,a.type);if(o){var s=o.getData();s.eachItemGraphicEl(function(l){l&&(n?e8(l):lN(l))})}})},e.type="marker",e})(Ft);function fTe(r,e,t){r.eachSeries(function(n){var a=_o.getMarkerModelFromSeries(n,t),i=e.get(n.id);if(a&&i&&i.group){var o=Uc(a),s=o.z,l=o.zlevel;$b(i.group,s,l)}})}function pV(r,e,t){var n=e.coordinateSystem,a=t.getWidth(),i=t.getHeight(),o=n&&n.getArea&&n.getArea();r.each(function(s){var l=r.getItemModel(s),u=l.get("relativeTo")==="coordinate",c=u?o?o.width:0:a,f=u?o?o.height:0:i,h=u&&o?o.x:0,v=u&&o?o.y:0,g,y=be(l.get("x"),c)+h,b=be(l.get("y"),f)+v;if(!isNaN(y)&&!isNaN(b))g=[y,b];else if(e.getMarkerPosition)g=e.getMarkerPosition(r.getValues(r.dimensions,s));else if(n){var _=r.get(n.dimensions[0],s),S=r.get(n.dimensions[1],s);g=n.dataToPoint([_,S])}isNaN(y)||(g[0]=y),isNaN(b)||(g[1]=b),r.setItemLayout(s,g)})}var dTe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.updateTransform=function(t,n,a){n.eachSeries(function(i){var o=_o.getMarkerModelFromSeries(i,"markPoint");o&&(pV(o.getData(),i,a),this.markerGroupMap.get(i.id).updateLayout())},this)},e.prototype.renderSeries=function(t,n,a,i){var o=t.coordinateSystem,s=t.id,l=t.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new km),f=hTe(o,t,n);n.setData(f),pV(n.getData(),t,i),f.each(function(h){var v=f.getItemModel(h),g=v.getShallow("symbol"),y=v.getShallow("symbolSize"),b=v.getShallow("symbolRotate"),_=v.getShallow("symbolOffset"),S=v.getShallow("symbolKeepAspect");if(Le(g)||Le(y)||Le(b)||Le(_)){var T=n.getRawValue(h),C=n.getDataParams(h);Le(g)&&(g=g(T,C)),Le(y)&&(y=y(T,C)),Le(b)&&(b=b(T,C)),Le(_)&&(_=_(T,C))}var M=v.getModel("itemStyle").getItemStyle(),D=v.get("z2"),L=Dm(l,"color");M.fill||(M.fill=L),f.setItemVisual(h,{z2:De(D,0),symbol:g,symbolSize:y,symbolRotate:b,symbolOffset:_,symbolKeepAspect:S,style:M})}),c.updateData(f),this.group.add(c.group),f.eachItemGraphicEl(function(h){h.traverse(function(v){Ge(v).dataModel=n})}),this.markKeep(c),c.group.silent=n.get("silent")||t.get("silent")},e.type="markPoint",e})(hk);function hTe(r,e,t){var n;r?n=ce(r&&r.dimensions,function(s){var l=e.getData().getDimensionInfo(e.getData().mapDimension(s))||{};return oe(oe({},l),{name:s,ordinalMeta:null})}):n=[{name:"value",type:"float"}];var a=new Pn(n,t),i=ce(t.get("data"),qe(nm,e));r&&(i=At(i,qe(am,r)));var o=BY(!!r,n);return a.initData(i,null,o),a}function vTe(r){r.registerComponentModel(sTe),r.registerComponentView(dTe),r.registerPreprocessor(function(e){dk(e.series,"markPoint")&&(e.markPoint=e.markPoint||{})})}var pTe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.createMarkerModelFromSeries=function(t,n,a){return new e(t,n,a)},e.type="markLine",e.defaultOption={z:5,symbol:["circle","arrow"],symbolSize:[8,16],symbolOffset:0,precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end",distance:5},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"},e})(_o),px=st(),gTe=function(r,e,t,n){var a=r.getData(),i;if(ue(n))i=n;else{var o=n.type;if(o==="min"||o==="max"||o==="average"||o==="median"||n.xAxis!=null||n.yAxis!=null){var s=void 0,l=void 0;if(n.yAxis!=null||n.xAxis!=null)s=e.getAxis(n.yAxis!=null?"y":"x"),l=fn(n.yAxis,n.xAxis);else{var u=zY(n,a,e,r);s=u.valueAxis;var c=tL(a,u.valueDataDim);l=ob(a,c,o)}var f=s.dim==="x"?0:1,h=1-f,v=ke(n),g={coord:[]};v.type=null,v.coord=[],v.coord[h]=-1/0,g.coord[h]=1/0;var y=t.get("precision");y>=0&>(l)&&(l=+l.toFixed(Math.min(y,20))),v.coord[f]=g.coord[f]=l,i=[v,g,{type:o,valueIndex:n.valueIndex,value:l}]}else i=[]}var b=[nm(r,i[0]),nm(r,i[1]),oe({},i[2])];return b[2].type=b[2].type||null,Je(b[2],b[0]),Je(b[2],b[1]),b};function sb(r){return!isNaN(r)&&!isFinite(r)}function gV(r,e,t,n){var a=1-r,i=n.dimensions[r];return sb(e[a])&&sb(t[a])&&e[r]===t[r]&&n.getAxis(i).containData(e[r])}function mTe(r,e){if(r.type==="cartesian2d"){var t=e[0].coord,n=e[1].coord;if(t&&n&&(gV(1,t,n,r)||gV(0,t,n,r)))return!0}return am(r,e[0])&&am(r,e[1])}function aC(r,e,t,n,a){var i=n.coordinateSystem,o=r.getItemModel(e),s,l=be(o.get("x"),a.getWidth()),u=be(o.get("y"),a.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(n.getMarkerPosition)s=n.getMarkerPosition(r.getValues(r.dimensions,e));else{var c=i.dimensions,f=r.get(c[0],e),h=r.get(c[1],e);s=i.dataToPoint([f,h])}if(Ql(i,"cartesian2d")){var v=i.getAxis("x"),g=i.getAxis("y"),c=i.dimensions;sb(r.get(c[0],e))?s[0]=v.toGlobalCoord(v.getExtent()[t?0:1]):sb(r.get(c[1],e))&&(s[1]=g.toGlobalCoord(g.getExtent()[t?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}r.setItemLayout(e,s)}var yTe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.updateTransform=function(t,n,a){n.eachSeries(function(i){var o=_o.getMarkerModelFromSeries(i,"markLine");if(o){var s=o.getData(),l=px(o).from,u=px(o).to;l.each(function(c){aC(l,c,!0,i,a),aC(u,c,!1,i,a)}),s.each(function(c){s.setItemLayout(c,[l.getItemLayout(c),u.getItemLayout(c)])}),this.markerGroupMap.get(i.id).updateLayout()}},this)},e.prototype.renderSeries=function(t,n,a,i){var o=t.coordinateSystem,s=t.id,l=t.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,new RL);this.group.add(c.group);var f=xTe(o,t,n),h=f.from,v=f.to,g=f.line;px(n).from=h,px(n).to=v,n.setData(g);var y=n.get("symbol"),b=n.get("symbolSize"),_=n.get("symbolRotate"),S=n.get("symbolOffset");ue(y)||(y=[y,y]),ue(b)||(b=[b,b]),ue(_)||(_=[_,_]),ue(S)||(S=[S,S]),f.from.each(function(C){T(h,C,!0),T(v,C,!1)}),g.each(function(C){var M=g.getItemModel(C),D=M.getModel("lineStyle").getLineStyle();g.setItemLayout(C,[h.getItemLayout(C),v.getItemLayout(C)]);var L=M.get("z2");D.stroke==null&&(D.stroke=h.getItemVisual(C,"style").fill),g.setItemVisual(C,{z2:De(L,0),fromSymbolKeepAspect:h.getItemVisual(C,"symbolKeepAspect"),fromSymbolOffset:h.getItemVisual(C,"symbolOffset"),fromSymbolRotate:h.getItemVisual(C,"symbolRotate"),fromSymbolSize:h.getItemVisual(C,"symbolSize"),fromSymbol:h.getItemVisual(C,"symbol"),toSymbolKeepAspect:v.getItemVisual(C,"symbolKeepAspect"),toSymbolOffset:v.getItemVisual(C,"symbolOffset"),toSymbolRotate:v.getItemVisual(C,"symbolRotate"),toSymbolSize:v.getItemVisual(C,"symbolSize"),toSymbol:v.getItemVisual(C,"symbol"),style:D})}),c.updateData(g),f.line.eachItemGraphicEl(function(C){Ge(C).dataModel=n,C.traverse(function(M){Ge(M).dataModel=n})});function T(C,M,D){var L=C.getItemModel(M);aC(C,M,D,t,i);var k=L.getModel("itemStyle").getItemStyle();k.fill==null&&(k.fill=Dm(l,"color")),C.setItemVisual(M,{symbolKeepAspect:L.get("symbolKeepAspect"),symbolOffset:De(L.get("symbolOffset",!0),S[D?0:1]),symbolRotate:De(L.get("symbolRotate",!0),_[D?0:1]),symbolSize:De(L.get("symbolSize"),b[D?0:1]),symbol:De(L.get("symbol",!0),y[D?0:1]),style:k})}this.markKeep(c),c.group.silent=n.get("silent")||t.get("silent")},e.type="markLine",e})(hk);function xTe(r,e,t){var n;r?n=ce(r&&r.dimensions,function(u){var c=e.getData().getDimensionInfo(e.getData().mapDimension(u))||{};return oe(oe({},c),{name:u,ordinalMeta:null})}):n=[{name:"value",type:"float"}];var a=new Pn(n,t),i=new Pn(n,t),o=new Pn([],t),s=ce(t.get("data"),qe(gTe,e,r,t));r&&(s=At(s,qe(mTe,r)));var l=BY(!!r,n);return a.initData(ce(s,function(u){return u[0]}),null,l),i.initData(ce(s,function(u){return u[1]}),null,l),o.initData(ce(s,function(u){return u[2]})),o.hasItemOption=!0,{from:a,to:i,line:o}}function bTe(r){r.registerComponentModel(pTe),r.registerComponentView(yTe),r.registerPreprocessor(function(e){dk(e.series,"markLine")&&(e.markLine=e.markLine||{})})}var _Te=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.createMarkerModelFromSeries=function(t,n,a){return new e(t,n,a)},e.type="markArea",e.defaultOption={z:1,tooltip:{trigger:"item"},animation:!1,label:{show:!0,position:"top"},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:"top"}}},e})(_o),gx=st(),STe=function(r,e,t,n){var a=n[0],i=n[1];if(!(!a||!i)){var o=nm(r,a),s=nm(r,i),l=o.coord,u=s.coord;l[0]=fn(l[0],-1/0),l[1]=fn(l[1],-1/0),u[0]=fn(u[0],1/0),u[1]=fn(u[1],1/0);var c=Lb([{},o,s]);return c.coord=[o.coord,s.coord],c.x0=o.x,c.y0=o.y,c.x1=s.x,c.y1=s.y,c}};function lb(r){return!isNaN(r)&&!isFinite(r)}function mV(r,e,t,n){var a=1-r;return lb(e[a])&&lb(t[a])}function wTe(r,e){var t=e.coord[0],n=e.coord[1],a={coord:t,x:e.x0,y:e.y0},i={coord:n,x:e.x1,y:e.y1};return Ql(r,"cartesian2d")?t&&n&&(mV(1,t,n)||mV(0,t,n))?!0:cTe(r,a,i):am(r,a)||am(r,i)}function yV(r,e,t,n,a){var i=n.coordinateSystem,o=r.getItemModel(e),s,l=be(o.get(t[0]),a.getWidth()),u=be(o.get(t[1]),a.getHeight());if(!isNaN(l)&&!isNaN(u))s=[l,u];else{if(n.getMarkerPosition){var c=r.getValues(["x0","y0"],e),f=r.getValues(["x1","y1"],e),h=i.clampData(c),v=i.clampData(f),g=[];t[0]==="x0"?g[0]=h[0]>v[0]?f[0]:c[0]:g[0]=h[0]>v[0]?c[0]:f[0],t[1]==="y0"?g[1]=h[1]>v[1]?f[1]:c[1]:g[1]=h[1]>v[1]?c[1]:f[1],s=n.getMarkerPosition(g,t,!0)}else{var y=r.get(t[0],e),b=r.get(t[1],e),_=[y,b];i.clampData&&i.clampData(_,_),s=i.dataToPoint(_,!0)}if(Ql(i,"cartesian2d")){var S=i.getAxis("x"),T=i.getAxis("y"),y=r.get(t[0],e),b=r.get(t[1],e);lb(y)?s[0]=S.toGlobalCoord(S.getExtent()[t[0]==="x0"?0:1]):lb(b)&&(s[1]=T.toGlobalCoord(T.getExtent()[t[1]==="y0"?0:1]))}isNaN(l)||(s[0]=l),isNaN(u)||(s[1]=u)}return s}var xV=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]],TTe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.updateTransform=function(t,n,a){n.eachSeries(function(i){var o=_o.getMarkerModelFromSeries(i,"markArea");if(o){var s=o.getData();s.each(function(l){var u=ce(xV,function(f){return yV(s,l,f,i,a)});s.setItemLayout(l,u);var c=s.getItemGraphicEl(l);c.setShape("points",u)})}},this)},e.prototype.renderSeries=function(t,n,a,i){var o=t.coordinateSystem,s=t.id,l=t.getData(),u=this.markerGroupMap,c=u.get(s)||u.set(s,{group:new Re});this.group.add(c.group),this.markKeep(c);var f=CTe(o,t,n);n.setData(f),f.each(function(h){var v=ce(xV,function(E){return yV(f,h,E,t,i)}),g=o.getAxis("x").scale,y=o.getAxis("y").scale,b=g.getExtent(),_=y.getExtent(),S=[g.parse(f.get("x0",h)),g.parse(f.get("x1",h))],T=[y.parse(f.get("y0",h)),y.parse(f.get("y1",h))];Ta(S),Ta(T);var C=!(b[0]>S[1]||b[1]<S[0]||_[0]>T[1]||_[1]<T[0]),M=!C;f.setItemLayout(h,{points:v,allClipped:M});var D=f.getItemModel(h),L=D.getModel("itemStyle").getItemStyle(),k=D.get("z2"),R=Dm(l,"color");L.fill||(L.fill=R,_e(L.fill)&&(L.fill=kg(L.fill,.4))),L.stroke||(L.stroke=R),f.setItemVisual(h,"style",L),f.setItemVisual(h,"z2",De(k,0))}),f.diff(gx(c).data).add(function(h){var v=f.getItemLayout(h),g=f.getItemVisual(h,"z2");if(!v.allClipped){var y=new Cn({z2:De(g,0),shape:{points:v.points}});f.setItemGraphicEl(h,y),c.group.add(y)}}).update(function(h,v){var g=gx(c).data.getItemGraphicEl(v),y=f.getItemLayout(h),b=f.getItemVisual(h,"z2");y.allClipped?g&&c.group.remove(g):(g?xt(g,{z2:De(b,0),shape:{points:y.points}},n,h):g=new Cn({shape:{points:y.points}}),f.setItemGraphicEl(h,g),c.group.add(g))}).remove(function(h){var v=gx(c).data.getItemGraphicEl(h);c.group.remove(v)}).execute(),f.eachItemGraphicEl(function(h,v){var g=f.getItemModel(v),y=f.getItemVisual(v,"style");h.useStyle(f.getItemVisual(v,"style")),Jr(h,Hr(g),{labelFetcher:n,labelDataIndex:v,defaultText:f.getName(v)||"",inheritColor:_e(y.fill)?kg(y.fill,1):te.color.neutral99}),Gr(h,g),nr(h,null,null,g.get(["emphasis","disabled"])),Ge(h).dataModel=n}),gx(c).data=f,c.group.silent=n.get("silent")||t.get("silent")},e.type="markArea",e})(hk);function CTe(r,e,t){var n,a,i=["x0","y0","x1","y1"];if(r){var o=ce(r&&r.dimensions,function(u){var c=e.getData(),f=c.getDimensionInfo(c.mapDimension(u))||{};return oe(oe({},f),{name:u,ordinalMeta:null})});a=ce(i,function(u,c){return{name:u,type:o[c%2].type}}),n=new Pn(a,t)}else a=[{name:"value",type:"float"}],n=new Pn(a,t);var s=ce(t.get("data"),qe(STe,e,r,t));r&&(s=At(s,qe(wTe,r)));var l=r?function(u,c,f,h){var v=u.coord[Math.floor(h/2)][h%2];return Ul(v,a[h])}:function(u,c,f,h){return Ul(u.value,a[h])};return n.initData(s,null,l),n.hasItemOption=!0,n}function ATe(r){r.registerComponentModel(_Te),r.registerComponentView(TTe),r.registerPreprocessor(function(e){dk(e.series,"markArea")&&(e.markArea=e.markArea||{})})}var MTe=function(r,e){if(e==="all")return{type:"all",title:r.getLocaleModel().get(["legend","selector","all"])};if(e==="inverse")return{type:"inverse",title:r.getLocaleModel().get(["legend","selector","inverse"])}},ZM=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.layoutMode={type:"box",ignoreSize:!0},t}return e.prototype.init=function(t,n,a){this.mergeDefaultAndTheme(t,a),t.selected=t.selected||{},this._updateSelector(t)},e.prototype.mergeOption=function(t,n){r.prototype.mergeOption.call(this,t,n),this._updateSelector(t)},e.prototype._updateSelector=function(t){var n=t.selector,a=this.ecModel;n===!0&&(n=t.selector=["all","inverse"]),ue(n)&&P(n,function(i,o){_e(i)&&(i={type:i}),n[o]=Je(i,MTe(a,i.type))})},e.prototype.optionUpdated=function(){this._updateData(this.ecModel);var t=this._data;if(t[0]&&this.get("selectedMode")==="single"){for(var n=!1,a=0;a<t.length;a++){var i=t[a].get("name");if(this.isSelected(i)){this.select(i),n=!0;break}}!n&&this.select(t[0].get("name"))}},e.prototype._updateData=function(t){var n=[],a=[];t.eachRawSeries(function(l){var u=l.name;a.push(u);var c;if(l.legendVisualProvider){var f=l.legendVisualProvider,h=f.getAllNames();t.isSeriesFiltered(l)||(a=a.concat(h)),h.length?n=n.concat(h):c=!0}else c=!0;c&&JD(l)&&n.push(l.name)}),this._availableNames=a;var i=this.get("data")||n,o=Ae(),s=ce(i,function(l){return(_e(l)||gt(l))&&(l={name:l}),o.get(l.name)?null:(o.set(l.name,!0),new ut(l,this,this.ecModel))},this);this._data=At(s,function(l){return!!l})},e.prototype.getData=function(){return this._data},e.prototype.select=function(t){var n=this.option.selected,a=this.get("selectedMode");if(a==="single"){var i=this._data;P(i,function(o){n[o.get("name")]=!1})}n[t]=!0},e.prototype.unSelect=function(t){this.get("selectedMode")!=="single"&&(this.option.selected[t]=!1)},e.prototype.toggleSelected=function(t){var n=this.option.selected;n.hasOwnProperty(t)||(n[t]=!0),this[n[t]?"unSelect":"select"](t)},e.prototype.allSelect=function(){var t=this._data,n=this.option.selected;P(t,function(a){n[a.get("name",!0)]=!0})},e.prototype.inverseSelect=function(){var t=this._data,n=this.option.selected;P(t,function(a){var i=a.get("name",!0);n.hasOwnProperty(i)||(n[i]=!0),n[i]=!n[i]})},e.prototype.isSelected=function(t){var n=this.option.selected;return!(n.hasOwnProperty(t)&&!n[t])&&Ze(this._availableNames,t)>=0},e.prototype.getOrient=function(){return this.get("orient")==="vertical"?{index:1,name:"vertical"}:{index:0,name:"horizontal"}},e.type="legend.plain",e.dependencies=["series"],e.defaultOption={z:4,show:!0,orient:"horizontal",left:"center",bottom:te.size.m,align:"auto",backgroundColor:te.color.transparent,borderColor:te.color.border,borderRadius:0,borderWidth:0,padding:5,itemGap:8,itemWidth:25,itemHeight:14,symbolRotate:"inherit",symbolKeepAspect:!0,inactiveColor:te.color.disabled,inactiveBorderColor:te.color.disabled,inactiveBorderWidth:"auto",itemStyle:{color:"inherit",opacity:"inherit",borderColor:"inherit",borderWidth:"auto",borderCap:"inherit",borderJoin:"inherit",borderDashOffset:"inherit",borderMiterLimit:"inherit"},lineStyle:{width:"auto",color:"inherit",inactiveColor:te.color.disabled,inactiveWidth:2,opacity:"inherit",type:"inherit",cap:"inherit",join:"inherit",dashOffset:"inherit",miterLimit:"inherit"},textStyle:{color:te.color.secondary},selectedMode:!0,selector:!1,selectorLabel:{show:!0,borderRadius:10,padding:[3,5,3,5],fontSize:12,fontFamily:"sans-serif",color:te.color.tertiary,borderWidth:1,borderColor:te.color.border},emphasis:{selectorLabel:{show:!0,color:te.color.quaternary}},selectorPosition:"auto",selectorItemGap:7,selectorButtonGap:10,tooltip:{show:!1},triggerEvent:!1},e})(ot),wd=qe,KM=P,mx=Re,VY=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.newlineDisabled=!1,t}return e.prototype.init=function(){this.group.add(this._contentGroup=new mx),this.group.add(this._selectorGroup=new mx),this._isFirstRender=!0},e.prototype.getContentGroup=function(){return this._contentGroup},e.prototype.getSelectorGroup=function(){return this._selectorGroup},e.prototype.render=function(t,n,a){var i=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),!!t.get("show",!0)){var o=t.get("align"),s=t.get("orient");(!o||o==="auto")&&(o=t.get("left")==="right"&&s==="vertical"?"right":"left");var l=t.get("selector",!0),u=t.get("selectorPosition",!0);l&&(!u||u==="auto")&&(u=s==="horizontal"?"end":"start"),this.renderInner(o,t,n,a,l,s,u);var c=Fr(t,a).refContainer,f=t.getBoxLayoutParams(),h=t.get("padding"),v=tr(f,c,h),g=this.layoutInner(t,o,v,i,l,u),y=tr(Ie({width:g.width,height:g.height},f),c,h);this.group.x=y.x-g.x,this.group.y=y.y-g.y,this.group.markRedraw(),this.group.add(this._backgroundEl=DY(g,t))}},e.prototype.resetInner=function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl),this.getSelectorGroup().removeAll()},e.prototype.renderInner=function(t,n,a,i,o,s,l){var u=this.getContentGroup(),c=Ae(),f=n.get("selectedMode"),h=n.get("triggerEvent"),v=[];a.eachRawSeries(function(g){!g.get("legendHoverLink")&&v.push(g.id)}),KM(n.getData(),function(g,y){var b=this,_=g.get("name");if(!this.newlineDisabled&&(_===""||_===`
|
|
421
421
|
`)){var S=new mx;S.newline=!0,u.add(S);return}var T=a.getSeriesByName(_)[0];if(!c.get(_))if(T){var C=T.getData(),M=C.getVisual("legendLineStyle")||{},D=C.getVisual("legendIcon"),L=C.getVisual("style"),k=this._createItem(T,_,y,g,n,t,M,L,D,f,i);k.on("click",wd(bV,_,null,i,v)).on("mouseover",wd(QM,T.name,null,i,v)).on("mouseout",wd(JM,T.name,null,i,v)),a.ssr&&k.eachChild(function(R){var E=Ge(R);E.seriesIndex=T.seriesIndex,E.dataIndex=y,E.ssrType="legend"}),h&&k.eachChild(function(R){b.packEventData(R,n,T,y,_)}),c.set(_,!0)}else a.eachRawSeries(function(R){var E=this;if(!c.get(_)&&R.legendVisualProvider){var I=R.legendVisualProvider;if(!I.containName(_))return;var z=I.indexOfName(_),j=I.getItemVisual(z,"style"),G=I.getItemVisual(z,"legendIcon"),U=On(j.fill);U&&U[3]===0&&(U[3]=.2,j=oe(oe({},j),{fill:Ja(U,"rgba")}));var O=this._createItem(R,_,y,g,n,t,{},j,G,f,i);O.on("click",wd(bV,null,_,i,v)).on("mouseover",wd(QM,null,_,i,v)).on("mouseout",wd(JM,null,_,i,v)),a.ssr&&O.eachChild(function(H){var F=Ge(H);F.seriesIndex=R.seriesIndex,F.dataIndex=y,F.ssrType="legend"}),h&&O.eachChild(function(H){E.packEventData(H,n,R,y,_)}),c.set(_,!0)}},this)},this),o&&this._createSelector(o,n,i,s,l)},e.prototype.packEventData=function(t,n,a,i,o){var s={componentType:"legend",componentIndex:n.componentIndex,dataIndex:i,value:o,seriesIndex:a.seriesIndex};Ge(t).eventData=s},e.prototype._createSelector=function(t,n,a,i,o){var s=this.getSelectorGroup();KM(t,function(u){var c=u.type,f=new pt({style:{x:0,y:0,align:"center",verticalAlign:"middle"},onclick:function(){a.dispatchAction({type:c==="all"?"legendAllSelect":"legendInverseSelect",legendId:n.id})}});s.add(f);var h=n.getModel("selectorLabel"),v=n.getModel(["emphasis","selectorLabel"]);Jr(f,{normal:h,emphasis:v},{defaultText:u.title}),Gl(f)})},e.prototype._createItem=function(t,n,a,i,o,s,l,u,c,f,h){var v=t.visualDrawType,g=o.get("itemWidth"),y=o.get("itemHeight"),b=o.isSelected(n),_=i.get("symbolRotate"),S=i.get("symbolKeepAspect"),T=i.get("icon");c=T||c||"roundRect";var C=DTe(c,i,l,u,v,b,h),M=new mx,D=i.getModel("textStyle");if(Le(t.getLegendIcon)&&(!T||T==="inherit"))M.add(t.getLegendIcon({itemWidth:g,itemHeight:y,icon:c,iconRotate:_,itemStyle:C.itemStyle,lineStyle:C.lineStyle,symbolKeepAspect:S}));else{var L=T==="inherit"&&t.getData().getVisual("symbol")?_==="inherit"?t.getData().getVisual("symbolRotate"):_:0;M.add(NTe({itemWidth:g,itemHeight:y,icon:c,iconRotate:L,itemStyle:C.itemStyle,symbolKeepAspect:S}))}var k=s==="left"?g+5:-5,R=s,E=o.get("formatter"),I=n;_e(E)&&E?I=E.replace("{name}",n??""):Le(E)&&(I=E(n));var z=b?D.getTextColor():i.get("inactiveColor");M.add(new pt({style:Gt(D,{text:I,x:k,y:y/2,fill:z,align:R,verticalAlign:"middle"},{inheritColor:z})}));var j=new rt({shape:M.getBoundingRect(),style:{fill:"transparent"}}),G=i.getModel("tooltip");return G.get("show")&&Ns({el:j,componentModel:o,itemName:n,itemTooltipOption:G.option}),M.add(j),M.eachChild(function(U){U.silent=!0}),j.silent=!f,this.getContentGroup().add(M),Gl(M),M.__legendDataIndex=a,M},e.prototype.layoutInner=function(t,n,a,i,o,s){var l=this.getContentGroup(),u=this.getSelectorGroup();Ec(t.get("orient"),l,t.get("itemGap"),a.width,a.height);var c=l.getBoundingRect(),f=[-c.x,-c.y];if(u.markRedraw(),l.markRedraw(),o){Ec("horizontal",u,t.get("selectorItemGap",!0));var h=u.getBoundingRect(),v=[-h.x,-h.y],g=t.get("selectorButtonGap",!0),y=t.getOrient().index,b=y===0?"width":"height",_=y===0?"height":"width",S=y===0?"y":"x";s==="end"?v[y]+=c[b]+g:f[y]+=h[b]+g,v[1-y]+=c[_]/2-h[_]/2,u.x=v[0],u.y=v[1],l.x=f[0],l.y=f[1];var T={x:0,y:0};return T[b]=c[b]+g+h[b],T[_]=Math.max(c[_],h[_]),T[S]=Math.min(0,h[S]+v[1-y]),T}else return l.x=f[0],l.y=f[1],this.group.getBoundingRect()},e.prototype.remove=function(){this.getContentGroup().removeAll(),this._isFirstRender=!0},e.type="legend.plain",e})(Ft);function DTe(r,e,t,n,a,i,o){function s(b,_){b.lineWidth==="auto"&&(b.lineWidth=_.lineWidth>0?2:0),KM(b,function(S,T){b[T]==="inherit"&&(b[T]=_[T])})}var l=e.getModel("itemStyle"),u=l.getItemStyle(),c=r.lastIndexOf("empty",0)===0?"fill":"stroke",f=l.getShallow("decal");u.decal=!f||f==="inherit"?n.decal:xh(f,o),u.fill==="inherit"&&(u.fill=n[a]),u.stroke==="inherit"&&(u.stroke=n[c]),u.opacity==="inherit"&&(u.opacity=(a==="fill"?n:t).opacity),s(u,n);var h=e.getModel("lineStyle"),v=h.getLineStyle();if(s(v,t),u.fill==="auto"&&(u.fill=n.fill),u.stroke==="auto"&&(u.stroke=n.fill),v.stroke==="auto"&&(v.stroke=n.fill),!i){var g=e.get("inactiveBorderWidth"),y=u[c];u.lineWidth=g==="auto"?n.lineWidth>0&&y?2:0:u.lineWidth,u.fill=e.get("inactiveColor"),u.stroke=e.get("inactiveBorderColor"),v.stroke=h.get("inactiveColor"),v.lineWidth=h.get("inactiveWidth")}return{itemStyle:u,lineStyle:v}}function NTe(r){var e=r.icon||"roundRect",t=Ar(e,0,0,r.itemWidth,r.itemHeight,r.itemStyle.fill,r.symbolKeepAspect);return t.setStyle(r.itemStyle),t.rotation=(r.iconRotate||0)*Math.PI/180,t.setOrigin([r.itemWidth/2,r.itemHeight/2]),e.indexOf("empty")>-1&&(t.style.stroke=t.style.fill,t.style.fill=te.color.neutral00,t.style.lineWidth=2),t}function bV(r,e,t,n){JM(r,e,t,n),t.dispatchAction({type:"legendToggleSelect",name:r??e}),QM(r,e,t,n)}function GY(r){for(var e=r.getZr().storage.getDisplayList(),t,n=0,a=e.length;n<a&&!(t=e[n].states.emphasis);)n++;return t&&t.hoverLayer}function QM(r,e,t,n){GY(t)||t.dispatchAction({type:"highlight",seriesName:r,name:e,excludeSeriesId:n})}function JM(r,e,t,n){GY(t)||t.dispatchAction({type:"downplay",seriesName:r,name:e,excludeSeriesId:n})}function LTe(r){var e=r.findComponents({mainType:"legend"});e&&e.length&&r.filterSeries(function(t){for(var n=0;n<e.length;n++)if(!e[n].isSelected(t.name))return!1;return!0})}function kp(r,e,t){var n=r==="allSelect"||r==="inverseSelect",a={},i=[];t.eachComponent({mainType:"legend",query:e},function(s){n?s[r]():s[r](e.name),_V(s,a),i.push(s.componentIndex)});var o={};return t.eachComponent("legend",function(s){P(a,function(l,u){s[l?"select":"unSelect"](u)}),_V(s,o)}),n?{selected:o,legendIndex:i}:{name:e.name,selected:o}}function _V(r,e){var t=e||{};return P(r.getData(),function(n){var a=n.get("name");if(!(a===`
|
|
422
|
-
`||a==="")){var i=r.isSelected(a);Ce(t,a)?t[a]=t[a]&&i:t[a]=i}}),t}function kTe(r){r.registerAction("legendToggleSelect","legendselectchanged",qe(kp,"toggleSelected")),r.registerAction("legendAllSelect","legendselectall",qe(kp,"allSelect")),r.registerAction("legendInverseSelect","legendinverseselect",qe(kp,"inverseSelect")),r.registerAction("legendSelect","legendselected",qe(kp,"select")),r.registerAction("legendUnSelect","legendunselected",qe(kp,"unSelect"))}function HY(r){r.registerComponentModel(ZM),r.registerComponentView(VY),r.registerProcessor(r.PRIORITY.PROCESSOR.SERIES_FILTER,LTe),r.registerSubTypeDefaulter("legend",function(){return"plain"}),kTe(r)}var RTe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.setScrollDataIndex=function(t){this.option.scrollDataIndex=t},e.prototype.init=function(t,n,a){var i=rf(t);r.prototype.init.call(this,t,n,a),SV(this,t,i)},e.prototype.mergeOption=function(t,n){r.prototype.mergeOption.call(this,t,n),SV(this,this.option,t)},e.type="legend.scroll",e.defaultOption=su(ZM.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:"end",pageFormatter:"{current}/{total}",pageIcons:{horizontal:["M0,0L12,-10L12,10z","M0,0L-12,-10L-12,10z"],vertical:["M0,0L20,0L10,-20z","M0,0L20,0L10,20z"]},pageIconColor:te.color.accent50,pageIconInactiveColor:te.color.accent10,pageIconSize:15,pageTextStyle:{color:te.color.tertiary},animationDurationUpdate:800}),e})(ZM);function SV(r,e,t){var n=r.getOrient(),a=[1,1];a[n.index]=0,xo(e,t,{type:"box",ignoreSize:!!a})}var wV=Re,iC=["width","height"],oC=["x","y"],ETe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.newlineDisabled=!0,t._currentIndex=0,t}return e.prototype.init=function(){r.prototype.init.call(this),this.group.add(this._containerGroup=new wV),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new wV)},e.prototype.resetInner=function(){r.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},e.prototype.renderInner=function(t,n,a,i,o,s,l){var u=this;r.prototype.renderInner.call(this,t,n,a,i,o,s,l);var c=this._controllerGroup,f=n.get("pageIconSize",!0),h=ue(f)?f:[f,f];g("pagePrev",0);var v=n.getModel("pageTextStyle");c.add(new pt({name:"pageText",style:{text:"xx/xx",fill:v.getTextColor(),font:v.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),g("pageNext",1);function g(y,b){var _=y+"DataIndex",S=zh(n.get("pageIcons",!0)[n.getOrient().name][b],{onclick:we(u._pageGo,u,_,n,i)},{x:-h[0]/2,y:-h[1]/2,width:h[0],height:h[1]});S.name=y,c.add(S)}},e.prototype.layoutInner=function(t,n,a,i,o,s){var l=this.getSelectorGroup(),u=t.getOrient().index,c=iC[u],f=oC[u],h=iC[1-u],v=oC[1-u];o&&Ec("horizontal",l,t.get("selectorItemGap",!0));var g=t.get("selectorButtonGap",!0),y=l.getBoundingRect(),b=[-y.x,-y.y],_=ke(a);o&&(_[c]=a[c]-y[c]-g);var S=this._layoutContentAndController(t,i,_,u,c,h,v,f);if(o){if(s==="end")b[u]+=S[c]+g;else{var T=y[c]+g;b[u]-=T,S[f]-=T}S[c]+=y[c]+g,b[1-u]+=S[v]+S[h]/2-y[h]/2,S[h]=Math.max(S[h],y[h]),S[v]=Math.min(S[v],y[v]+b[1-u]),l.x=b[0],l.y=b[1],l.markRedraw()}return S},e.prototype._layoutContentAndController=function(t,n,a,i,o,s,l,u){var c=this.getContentGroup(),f=this._containerGroup,h=this._controllerGroup;Ec(t.get("orient"),c,t.get("itemGap"),i?a.width:null,i?null:a.height),Ec("horizontal",h,t.get("pageButtonItemGap",!0));var v=c.getBoundingRect(),g=h.getBoundingRect(),y=this._showController=v[o]>a[o],b=[-v.x,-v.y];n||(b[i]=c[u]);var _=[0,0],S=[-g.x,-g.y],T=De(t.get("pageButtonGap",!0),t.get("itemGap",!0));if(y){var C=t.get("pageButtonPosition",!0);C==="end"?S[i]+=a[o]-g[o]:_[i]+=g[o]+T}S[1-i]+=v[s]/2-g[s]/2,c.setPosition(b),f.setPosition(_),h.setPosition(S);var M={x:0,y:0};if(M[o]=y?a[o]:v[o],M[s]=Math.max(v[s],g[s]),M[l]=Math.min(0,g[l]+S[1-i]),f.__rectSize=a[o],y){var D={x:0,y:0};D[o]=Math.max(a[o]-g[o]-T,0),D[s]=M[s],f.setClipPath(new rt({shape:D})),f.__rectSize=D[o]}else h.eachChild(function(k){k.attr({invisible:!0,silent:!0})});var L=this._getPageInfo(t);return L.pageIndex!=null&&xt(c,{x:L.contentPosition[0],y:L.contentPosition[1]},y?t:null),this._updatePageInfoView(t,L),M},e.prototype._pageGo=function(t,n,a){var i=this._getPageInfo(n)[t];i!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:n.id})},e.prototype._updatePageInfoView=function(t,n){var a=this._controllerGroup;P(["pagePrev","pageNext"],function(c){var f=c+"DataIndex",h=n[f]!=null,v=a.childOfName(c);v&&(v.setStyle("fill",h?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),v.cursor=h?"pointer":"default")});var i=a.childOfName("pageText"),o=t.get("pageFormatter"),s=n.pageIndex,l=s!=null?s+1:0,u=n.pageCount;i&&o&&i.setStyle("text",_e(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",u==null?"":u+""):o({current:l,total:u}))},e.prototype._getPageInfo=function(t){var n=t.get("scrollDataIndex",!0),a=this.getContentGroup(),i=this._containerGroup.__rectSize,o=t.getOrient().index,s=iC[o],l=oC[o],u=this._findTargetItemIndex(n),c=a.children(),f=c[u],h=c.length,v=h?1:0,g={contentPosition:[a.x,a.y],pageCount:v,pageIndex:v-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!f)return g;var y=C(f);g.contentPosition[o]=-y.s;for(var b=u+1,_=y,S=y,T=null;b<=h;++b)T=C(c[b]),(!T&&S.e>_.s+i||T&&!M(T,_.s))&&(S.i>_.i?_=S:_=T,_&&(g.pageNextDataIndex==null&&(g.pageNextDataIndex=_.i),++g.pageCount)),S=T;for(var b=u-1,_=y,S=y,T=null;b>=-1;--b)T=C(c[b]),(!T||!M(S,T.s))&&_.i<S.i&&(S=_,g.pagePrevDataIndex==null&&(g.pagePrevDataIndex=_.i),++g.pageCount,++g.pageIndex),_=T;return g;function C(D){if(D){var L=D.getBoundingRect(),k=L[l]+D[l];return{s:k,e:k+L[s],i:D.__legendDataIndex}}}function M(D,L){return D.e>=L&&D.s<=L+i}},e.prototype._findTargetItemIndex=function(t){if(!this._showController)return 0;var n,a=this.getContentGroup(),i;return a.eachChild(function(o,s){var l=o.__legendDataIndex;i==null&&l!=null&&(i=s),l===t&&(n=s)}),n??i},e.type="legend.scroll",e})(VY);function ITe(r){r.registerAction("legendScroll","legendscroll",function(e,t){var n=e.scrollDataIndex;n!=null&&t.eachComponent({mainType:"legend",subType:"scroll",query:e},function(a){a.setScrollDataIndex(n)})})}function OTe(r){tt(HY),r.registerComponentModel(RTe),r.registerComponentView(ETe),ITe(r)}function PTe(r){tt(HY),tt(OTe)}var jTe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.inside",e.defaultOption=su(rm.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),e})(rm),vk=st();function zTe(r,e,t){vk(r).coordSysRecordMap.each(function(n){var a=n.dataZoomInfoMap.get(e.uid);a&&(a.getRange=t)})}function BTe(r,e){for(var t=vk(r).coordSysRecordMap,n=t.keys(),a=0;a<n.length;a++){var i=n[a],o=t.get(i),s=o.dataZoomInfoMap;if(s){var l=e.uid,u=s.get(l);u&&(s.removeKey(l),s.keys().length||FY(t,o))}}}function FY(r,e){if(e){r.removeKey(e.model.uid);var t=e.controller;t&&t.dispose()}}function VTe(r,e){var t={model:e,containsPoint:qe(HTe,e),dispatchAction:qe(GTe,r),dataZoomInfoMap:null,controller:null},n=t.controller=new sf(r.getZr());return P(["pan","zoom","scrollMove"],function(a){n.on(a,function(i){var o=[];t.dataZoomInfoMap.each(function(s){if(i.isAvailableBehavior(s.model.option)){var l=(s.getRange||{})[a],u=l&&l(s.dzReferCoordSysInfo,t.model.mainType,t.controller,i);!s.model.get("disabled",!0)&&u&&o.push({dataZoomId:s.model.id,start:u[0],end:u[1]})}}),o.length&&t.dispatchAction(o)})}),t}function GTe(r,e){r.isDisposed()||r.dispatchAction({type:"dataZoom",animation:{easing:"cubicOut",duration:100},batch:e})}function HTe(r,e,t,n){return r.coordinateSystem.containPoint([t,n])}function FTe(r,e,t){var n,a="type_",i={type_true:2,type_move:1,type_false:0,type_undefined:-1},o=!0;return r.each(function(s){var l=s.model,u=l.get("disabled",!0)?!1:l.get("zoomLock",!0)?"move":!0;i[a+u]>i[a+n]&&(n=u),o=o&&l.get("preventDefaultMouseMove",!0)}),{controlType:n,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!o,api:t,zInfo:{component:e.model},triggerInfo:{roamTrigger:null,isInSelf:e.containsPoint}}}}function UTe(r){r.registerProcessor(r.PRIORITY.PROCESSOR.FILTER,function(e,t){var n=vk(t),a=n.coordSysRecordMap||(n.coordSysRecordMap=Ae());a.each(function(i){i.dataZoomInfoMap=null}),e.eachComponent({mainType:"dataZoom",subType:"inside"},function(i){var o=CY(i);P(o.infoList,function(s){var l=s.model.uid,u=a.get(l)||a.set(l,VTe(t,s.model)),c=u.dataZoomInfoMap||(u.dataZoomInfoMap=Ae());c.set(i.uid,{dzReferCoordSysInfo:s,model:i,getRange:null})})}),a.each(function(i){var o=i.controller,s,l=i.dataZoomInfoMap;if(l){var u=l.keys()[0];u!=null&&(s=l.get(u))}if(!s){FY(a,i);return}var c=FTe(l,i,t);o.enable(c.controlType,c.opt),Uh(i,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var WTe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataZoom.inside",t}return e.prototype.render=function(t,n,a){if(r.prototype.render.apply(this,arguments),t.noTarget()){this._clear();return}this.range=t.getPercentRange(),zTe(a,t,{pan:we(sC.pan,this),zoom:we(sC.zoom,this),scrollMove:we(sC.scrollMove,this)})},e.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){BTe(this.api,this.dataZoomModel),this.range=null},e.type="dataZoom.inside",e})(ok),sC={zoom:function(r,e,t,n){var a=this.range,i=a.slice(),o=r.axisModels[0];if(o){var s=lC[e](null,[n.originX,n.originY],o,t,r),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(i[1]-i[0])+i[0],u=Math.max(1/n.scale,0);i[0]=(i[0]-l)*u+l,i[1]=(i[1]-l)*u+l;var c=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(Jl(0,i,[0,100],0,c.minSpan,c.maxSpan),this.range=i,a[0]!==i[0]||a[1]!==i[1])return i}},pan:TV(function(r,e,t,n,a,i){var o=lC[n]([i.oldX,i.oldY],[i.newX,i.newY],e,a,t);return o.signal*(r[1]-r[0])*o.pixel/o.pixelLength}),scrollMove:TV(function(r,e,t,n,a,i){var o=lC[n]([0,0],[i.scrollDelta,i.scrollDelta],e,a,t);return o.signal*(r[1]-r[0])*i.scrollDelta})};function TV(r){return function(e,t,n,a){var i=this.range,o=i.slice(),s=e.axisModels[0];if(s){var l=r(o,s,e,t,n,a);if(Jl(l,o,[0,100],"all"),this.range=o,i[0]!==o[0]||i[1]!==o[1])return o}}}var lC={grid:function(r,e,t,n,a){var i=t.axis,o={},s=a.model.coordinateSystem.getRect();return r=r||[0,0],i.dim==="x"?(o.pixel=e[0]-r[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=i.inverse?1:-1):(o.pixel=e[1]-r[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=i.inverse?-1:1),o},polar:function(r,e,t,n,a){var i=t.axis,o={},s=a.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return r=r?s.pointToCoord(r):[0,0],e=s.pointToCoord(e),t.mainType==="radiusAxis"?(o.pixel=e[0]-r[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=i.inverse?1:-1):(o.pixel=e[1]-r[1],o.pixelLength=u[1]-u[0],o.pixelStart=u[0],o.signal=i.inverse?-1:1),o},singleAxis:function(r,e,t,n,a){var i=t.axis,o=a.model.coordinateSystem.getRect(),s={};return r=r||[0,0],i.orient==="horizontal"?(s.pixel=e[0]-r[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=i.inverse?1:-1):(s.pixel=e[1]-r[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=i.inverse?-1:1),s}};function UY(r){sk(r),r.registerComponentModel(jTe),r.registerComponentView(WTe),UTe(r)}var YTe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.slider",e.layoutMode="box",e.defaultOption=su(rm.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:te.color.accent10,borderRadius:0,backgroundColor:te.color.transparent,dataBackground:{lineStyle:{color:te.color.accent30,width:.5},areaStyle:{color:te.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:te.color.accent40,width:.5},areaStyle:{color:te.color.accent20,opacity:.3}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:te.color.neutral00,borderColor:te.color.accent20},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:te.color.accent40,opacity:.5},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:te.color.tertiary},brushSelect:!0,brushStyle:{color:te.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:te.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),e})(rm),Rp=rt,$Te=1,uC=30,XTe=7,Ep="horizontal",CV="vertical",qTe=5,ZTe=["line","bar","candlestick","scatter"],KTe={easing:"cubicOut",duration:100,delay:0},QTe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._displayables={},t}return e.prototype.init=function(t,n){this.api=n,this._onBrush=we(this._onBrush,this),this._onBrushEnd=we(this._onBrushEnd,this)},e.prototype.render=function(t,n,a,i){if(r.prototype.render.apply(this,arguments),Uh(this,"_dispatchZoomAction",t.get("throttle"),"fixRate"),this._orient=t.getOrient(),t.get("show")===!1){this.group.removeAll();return}if(t.noTarget()){this._clear(),this.group.removeAll();return}(!i||i.type!=="dataZoom"||i.from!==this.uid)&&this._buildView(),this._updateView()},e.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){Gg(this,"_dispatchZoomAction");var t=this.api.getZr();t.off("mousemove",this._onBrush),t.off("mouseup",this._onBrushEnd)},e.prototype._buildView=function(){var t=this.group;t.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var n=this._displayables.sliderGroup=new Re;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),t.add(n),this._positionGroup()},e.prototype._resetLocation=function(){var t=this.dataZoomModel,n=this.api,a=t.get("brushSelect"),i=a?XTe:0,o=Fr(t,n).refContainer,s=this._findCoordRect(),l=t.get("defaultLocationEdgeGap",!0)||0,u=this._orient===Ep?{right:o.width-s.x-s.width,top:o.height-uC-l-i,width:s.width,height:uC}:{right:l,top:s.y,width:uC,height:s.height},c=rf(t.option);P(["right","top","width","height"],function(h){c[h]==="ph"&&(c[h]=u[h])});var f=tr(c,o);this._location={x:f.x,y:f.y},this._size=[f.width,f.height],this._orient===CV&&this._size.reverse()},e.prototype._positionGroup=function(){var t=this.group,n=this._location,a=this._orient,i=this.dataZoomModel.getFirstTargetAxisModel(),o=i&&i.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(a===Ep&&!o?{scaleY:l?1:-1,scaleX:1}:a===Ep&&o?{scaleY:l?1:-1,scaleX:-1}:a===CV&&!o?{scaleY:l?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:l?-1:1,scaleX:-1,rotation:Math.PI/2});var u=t.getBoundingRect([s]);t.x=n.x-u.x,t.y=n.y-u.y,t.markRedraw()},e.prototype._getViewExtent=function(){return[0,this._size[0]]},e.prototype._renderBackground=function(){var t=this.dataZoomModel,n=this._size,a=this._displayables.sliderGroup,i=t.get("brushSelect");a.add(new Rp({silent:!0,shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:t.get("backgroundColor")},z2:-40}));var o=new Rp({shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:"transparent"},z2:0,onclick:we(this._onClickPanel,this)}),s=this.api.getZr();i?(o.on("mousedown",this._onBrushStart,this),o.cursor="crosshair",s.on("mousemove",this._onBrush),s.on("mouseup",this._onBrushEnd)):(s.off("mousemove",this._onBrush),s.off("mouseup",this._onBrushEnd)),a.add(o)},e.prototype._renderDataShadow=function(){var t=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!t)return;var n=this._size,a=this._shadowSize||[],i=t.series,o=i.getRawData(),s=i.getShadowDim&&i.getShadowDim(),l=s&&o.getDimensionInfo(s)?i.getShadowDim():t.otherDim;if(l==null)return;var u=this._shadowPolygonPts,c=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||n[0]!==a[0]||n[1]!==a[1]){var f=o.getDataExtent(t.thisDim),h=o.getDataExtent(l),v=(h[1]-h[0])*.3;h=[h[0]-v,h[1]+v];var g=[0,n[1]],y=[0,n[0]],b=[[n[0],0],[0,0]],_=[],S=y[1]/Math.max(1,o.count()-1),T=n[0]/(f[1]-f[0]),C=t.thisAxis.type==="time",M=-S,D=Math.round(o.count()/n[0]),L;o.each([t.thisDim,l],function(z,j,G){if(D>0&&G%D){C||(M+=S);return}M=C?(+z-f[0])*T:M+S;var U=j==null||isNaN(j)||j==="",O=U?0:Nt(j,h,g,!0);U&&!L&&G?(b.push([b[b.length-1][0],0]),_.push([_[_.length-1][0],0])):!U&&L&&(b.push([M,0]),_.push([M,0])),U||(b.push([M,O]),_.push([M,O])),L=U}),u=this._shadowPolygonPts=b,c=this._shadowPolylinePts=_}this._shadowData=o,this._shadowDim=l,this._shadowSize=[n[0],n[1]];var k=this.dataZoomModel;function R(z){var j=k.getModel(z?"selectedDataBackground":"dataBackground"),G=new Re,U=new Cn({shape:{points:u},segmentIgnoreThreshold:1,style:j.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),O=new dn({shape:{points:c},segmentIgnoreThreshold:1,style:j.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return G.add(U),G.add(O),G}for(var E=0;E<3;E++){var I=R(E===1);this._displayables.sliderGroup.add(I),this._displayables.dataShadowSegs.push(I)}},e.prototype._prepareDataShadowInfo=function(){var t=this.dataZoomModel,n=t.get("showDataShadow");if(n!==!1){var a,i=this.ecModel;return t.eachTargetAxis(function(o,s){var l=t.getAxisProxy(o,s).getTargetSeriesModels();P(l,function(u){if(!a&&!(n!==!0&&Ze(ZTe,u.get("type"))<0)){var c=i.getComponent(Il(o),s).axis,f=JTe(o),h,v=u.coordinateSystem;f!=null&&v.getOtherAxis&&(h=v.getOtherAxis(c).inverse),f=u.getData().mapDimension(f);var g=u.getData().mapDimension(o);a={thisAxis:c,series:u,thisDim:g,otherDim:f,otherAxisInverse:h}}},this)},this),a}},e.prototype._renderHandle=function(){var t=this.group,n=this._displayables,a=n.handles=[null,null],i=n.handleLabels=[null,null],o=this._displayables.sliderGroup,s=this._size,l=this.dataZoomModel,u=this.api,c=l.get("borderRadius")||0,f=l.get("brushSelect"),h=n.filler=new Rp({silent:f,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(h),o.add(new Rp({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:s[0],height:s[1],r:c},style:{stroke:l.get("dataBackgroundColor")||l.get("borderColor"),lineWidth:$Te,fill:te.color.transparent}})),P([0,1],function(T){var C=l.get("handleIcon");!D1[C]&&C.indexOf("path://")<0&&C.indexOf("image://")<0&&(C="path://"+C);var M=Ar(C,-1,0,2,2,null,!0);M.attr({cursor:eCe(this._orient),draggable:!0,drift:we(this._onDragMove,this,T),ondragend:we(this._onDragEnd,this),onmouseover:we(this._showDataInfo,this,!0),onmouseout:we(this._showDataInfo,this,!1),z2:5});var D=M.getBoundingRect(),L=l.get("handleSize");this._handleHeight=be(L,this._size[1]),this._handleWidth=D.width/D.height*this._handleHeight,M.setStyle(l.getModel("handleStyle").getItemStyle()),M.style.strokeNoScale=!0,M.rectHover=!0,M.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),Gl(M);var k=l.get("handleColor");k!=null&&(M.style.fill=k),o.add(a[T]=M);var R=l.getModel("textStyle"),E=l.get("handleLabel")||{},I=E.show||!1;t.add(i[T]=new pt({silent:!0,invisible:!I,style:Gt(R,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:R.getTextColor(),font:R.getFont()}),z2:10}))},this);var v=h;if(f){var g=be(l.get("moveHandleSize"),s[1]),y=n.moveHandle=new rt({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:g}}),b=g*.8,_=n.moveHandleIcon=Ar(l.get("moveHandleIcon"),-b/2,-b/2,b,b,te.color.neutral00,!0);_.silent=!0,_.y=s[1]+g/2-.5,y.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var S=Math.min(s[1]/2,Math.max(g,10));v=n.moveZone=new rt({invisible:!0,shape:{y:s[1]-S,height:g+S}}),v.on("mouseover",function(){u.enterEmphasis(y)}).on("mouseout",function(){u.leaveEmphasis(y)}),o.add(y),o.add(_),o.add(v)}v.attr({draggable:!0,cursor:"default",drift:we(this._onDragMove,this,"all"),ondragstart:we(this._showDataInfo,this,!0),ondragend:we(this._onDragEnd,this),onmouseover:we(this._showDataInfo,this,!0),onmouseout:we(this._showDataInfo,this,!1)})},e.prototype._resetInterval=function(){var t=this._range=this.dataZoomModel.getPercentRange(),n=this._getViewExtent();this._handleEnds=[Nt(t[0],[0,100],n,!0),Nt(t[1],[0,100],n,!0)]},e.prototype._updateInterval=function(t,n){var a=this.dataZoomModel,i=this._handleEnds,o=this._getViewExtent(),s=a.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];Jl(n,i,o,a.get("zoomLock")?"all":t,s.minSpan!=null?Nt(s.minSpan,l,o,!0):null,s.maxSpan!=null?Nt(s.maxSpan,l,o,!0):null);var u=this._range,c=this._range=Ta([Nt(i[0],o,l,!0),Nt(i[1],o,l,!0)]);return!u||u[0]!==c[0]||u[1]!==c[1]},e.prototype._updateView=function(t){var n=this._displayables,a=this._handleEnds,i=Ta(a.slice()),o=this._size;P([0,1],function(v){var g=n.handles[v],y=this._handleHeight;g.attr({scaleX:y/2,scaleY:y/2,x:a[v]+(v?-1:1),y:o[1]/2-y/2})},this),n.filler.setShape({x:i[0],y:0,width:i[1]-i[0],height:o[1]});var s={x:i[0],width:i[1]-i[0]};n.moveHandle&&(n.moveHandle.setShape(s),n.moveZone.setShape(s),n.moveZone.getBoundingRect(),n.moveHandleIcon&&n.moveHandleIcon.attr("x",s.x+s.width/2));for(var l=n.dataShadowSegs,u=[0,i[0],i[1],o[0]],c=0;c<l.length;c++){var f=l[c],h=f.getClipPath();h||(h=new rt,f.setClipPath(h)),h.setShape({x:u[c],y:0,width:u[c+1]-u[c],height:o[1]})}this._updateDataInfo(t)},e.prototype._updateDataInfo=function(t){var n=this.dataZoomModel,a=this._displayables,i=a.handleLabels,o=this._orient,s=["",""];if(n.get("showDetail")){var l=n.findRepresentativeAxisProxy();if(l){var u=l.getAxisModel().axis,c=this._range,f=t?l.calculateDataWindow({start:c[0],end:c[1]}).valueWindow:l.getDataValueWindow();s=[this._formatLabel(f[0],u),this._formatLabel(f[1],u)]}}var h=Ta(this._handleEnds.slice());v.call(this,0),v.call(this,1);function v(g){var y=Hl(a.handles[g].parent,this.group),b=Yb(g===0?"right":"left",y),_=this._handleWidth/2+qTe,S=Si([h[g]+(g===0?-_:_),this._size[1]/2],y);i[g].setStyle({x:S[0],y:S[1],verticalAlign:o===Ep?"middle":b,align:o===Ep?b:"center",text:s[g]})}},e.prototype._formatLabel=function(t,n){var a=this.dataZoomModel,i=a.get("labelFormatter"),o=a.get("labelPrecision");(o==null||o==="auto")&&(o=n.getPixelPrecision());var s=t==null||isNaN(t)?"":n.type==="category"||n.type==="time"?n.scale.getLabel({value:Math.round(t)}):t.toFixed(Math.min(o,20));return Le(i)?i(t,s):_e(i)?i.replace("{value}",s):s},e.prototype._showDataInfo=function(t){var n=this.dataZoomModel.get("handleLabel")||{},a=n.show||!1,i=this.dataZoomModel.getModel(["emphasis","handleLabel"]),o=i.get("show")||!1,s=t||this._dragging?o:a,l=this._displayables,u=l.handleLabels;u[0].attr("invisible",!s),u[1].attr("invisible",!s),l.moveHandle&&this.api[s?"enterEmphasis":"leaveEmphasis"](l.moveHandle,1)},e.prototype._onDragMove=function(t,n,a,i){this._dragging=!0,xs(i.event);var o=this._displayables.sliderGroup.getLocalTransform(),s=Si([n,a],o,!0),l=this._updateInterval(t,s[0]),u=this.dataZoomModel.get("realtime");this._updateView(!u),l&&u&&this._dispatchZoomAction(!0)},e.prototype._onDragEnd=function(){this._dragging=!1,this._showDataInfo(!1);var t=this.dataZoomModel.get("realtime");!t&&this._dispatchZoomAction(!1)},e.prototype._onClickPanel=function(t){var n=this._size,a=this._displayables.sliderGroup.transformCoordToLocal(t.offsetX,t.offsetY);if(!(a[0]<0||a[0]>n[0]||a[1]<0||a[1]>n[1])){var i=this._handleEnds,o=(i[0]+i[1])/2,s=this._updateInterval("all",a[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},e.prototype._onBrushStart=function(t){var n=t.offsetX,a=t.offsetY;this._brushStart=new ze(n,a),this._brushing=!0,this._brushStartTime=+new Date},e.prototype._onBrushEnd=function(t){if(this._brushing){var n=this._displayables.brushRect;if(this._brushing=!1,!!n){n.attr("ignore",!0);var a=n.shape,i=+new Date;if(!(i-this._brushStartTime<200&&Math.abs(a.width)<5)){var o=this._getViewExtent(),s=[0,100],l=this._handleEnds=[a.x,a.x+a.width],u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();Jl(0,l,o,0,u.minSpan!=null?Nt(u.minSpan,s,o,!0):null,u.maxSpan!=null?Nt(u.maxSpan,s,o,!0):null),this._range=Ta([Nt(l[0],o,s,!0),Nt(l[1],o,s,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},e.prototype._onBrush=function(t){this._brushing&&(xs(t.event),this._updateBrushRect(t.offsetX,t.offsetY))},e.prototype._updateBrushRect=function(t,n){var a=this._displayables,i=this.dataZoomModel,o=a.brushRect;o||(o=a.brushRect=new Rp({silent:!0,style:i.getModel("brushStyle").getItemStyle()}),a.sliderGroup.add(o)),o.attr("ignore",!1);var s=this._brushStart,l=this._displayables.sliderGroup,u=l.transformCoordToLocal(t,n),c=l.transformCoordToLocal(s.x,s.y),f=this._size;u[0]=Math.max(Math.min(f[0],u[0]),0),o.setShape({x:c[0],y:0,width:u[0]-c[0],height:f[1]})},e.prototype._dispatchZoomAction=function(t){var n=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:t?KTe:null,start:n[0],end:n[1]})},e.prototype._findCoordRect=function(){var t,n=CY(this.dataZoomModel).infoList;if(!t&&n.length){var a=n[0].model.coordinateSystem;t=a.getRect&&a.getRect()}if(!t){var i=this.api.getWidth(),o=this.api.getHeight();t={x:i*.2,y:o*.2,width:i*.6,height:o*.6}}return t},e.type="dataZoom.slider",e})(ok);function JTe(r){var e={x:"y",y:"x",radius:"angle",angle:"radius"};return e[r]}function eCe(r){return r==="vertical"?"ns-resize":"ew-resize"}function WY(r){r.registerComponentModel(YTe),r.registerComponentView(QTe),sk(r)}function tCe(r){tt(UY),tt(WY)}var YY={get:function(r,e,t){var n=ke((rCe[r]||{})[e]);return t&&ue(n)?n[n.length-1]:n}},rCe={color:{active:["#006edd","#e0ffff"],inactive:[te.color.transparent]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},AV=Qr.mapVisual,nCe=Qr.eachVisual,aCe=ue,MV=P,iCe=Ta,oCe=Nt,ub=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.stateList=["inRange","outOfRange"],t.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],t.layoutMode={type:"box",ignoreSize:!0},t.dataBound=[-1/0,1/0],t.targetVisuals={},t.controllerVisuals={},t}return e.prototype.init=function(t,n,a){this.mergeDefaultAndTheme(t,a)},e.prototype.optionUpdated=function(t,n){var a=this.option;!n&&OY(a,t,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},e.prototype.resetVisual=function(t){var n=this.stateList;t=we(t,this),this.controllerVisuals=$M(this.option.controller,n,t),this.targetVisuals=$M(this.option.target,n,t)},e.prototype.getItemSymbol=function(){return null},e.prototype.getTargetSeriesIndices=function(){var t=this.option.seriesId,n=this.option.seriesIndex;n==null&&t==null&&(n="all");var a=Eh(this.ecModel,"series",{index:n,id:t},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return ce(a,function(i){return i.componentIndex})},e.prototype.eachTargetSeries=function(t,n){P(this.getTargetSeriesIndices(),function(a){var i=this.ecModel.getSeriesByIndex(a);i&&t.call(n,i)},this)},e.prototype.isTargetSeries=function(t){var n=!1;return this.eachTargetSeries(function(a){a===t&&(n=!0)}),n},e.prototype.formatValueText=function(t,n,a){var i=this.option,o=i.precision,s=this.dataBound,l=i.formatter,u;a=a||["<",">"],ue(t)&&(t=t.slice(),u=!0);var c=n?t:u?[f(t[0]),f(t[1])]:f(t);if(_e(l))return l.replace("{value}",u?c[0]:c).replace("{value2}",u?c[1]:c);if(Le(l))return u?l(t[0],t[1]):l(t);if(u)return t[0]===s[0]?a[0]+" "+c[1]:t[1]===s[1]?a[1]+" "+c[0]:c[0]+" - "+c[1];return c;function f(h){return h===s[0]?"min":h===s[1]?"max":(+h).toFixed(Math.min(o,20))}},e.prototype.resetExtent=function(){var t=this.option,n=iCe([t.min,t.max]);this._dataExtent=n},e.prototype.getDataDimensionIndex=function(t){var n=this.option.dimension;if(n!=null)return t.getDimensionIndex(n);for(var a=t.dimensions,i=a.length-1;i>=0;i--){var o=a[i],s=t.getDimensionInfo(o);if(!s.isCalculationCoord)return s.storeDimIndex}},e.prototype.getExtent=function(){return this._dataExtent.slice()},e.prototype.completeVisualOption=function(){var t=this.ecModel,n=this.option,a={inRange:n.inRange,outOfRange:n.outOfRange},i=n.target||(n.target={}),o=n.controller||(n.controller={});Je(i,a),Je(o,a);var s=this.isCategory();l.call(this,i),l.call(this,o),u.call(this,i,"inRange","outOfRange"),c.call(this,o);function l(f){aCe(n.color)&&!f.inRange&&(f.inRange={color:n.color.slice().reverse()}),f.inRange=f.inRange||{color:t.get("gradientColor")}}function u(f,h,v){var g=f[h],y=f[v];g&&!y&&(y=f[v]={},MV(g,function(b,_){if(Qr.isValidType(_)){var S=YY.get(_,"inactive",s);S!=null&&(y[_]=S,_==="color"&&!y.hasOwnProperty("opacity")&&!y.hasOwnProperty("colorAlpha")&&(y.opacity=[0,0]))}}))}function c(f){var h=(f.inRange||{}).symbol||(f.outOfRange||{}).symbol,v=(f.inRange||{}).symbolSize||(f.outOfRange||{}).symbolSize,g=this.get("inactiveColor"),y=this.getItemSymbol(),b=y||"roundRect";MV(this.stateList,function(_){var S=this.itemSize,T=f[_];T||(T=f[_]={color:s?g:[g]}),T.symbol==null&&(T.symbol=h&&ke(h)||(s?b:[b])),T.symbolSize==null&&(T.symbolSize=v&&ke(v)||(s?S[0]:[S[0],S[0]])),T.symbol=AV(T.symbol,function(D){return D==="none"?b:D});var C=T.symbolSize;if(C!=null){var M=-1/0;nCe(C,function(D){D>M&&(M=D)}),T.symbolSize=AV(C,function(D){return oCe(D,[0,M],[0,S[0]],!0)})}},this)}},e.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},e.prototype.isCategory=function(){return!!this.option.categories},e.prototype.setSelected=function(t){},e.prototype.getSelected=function(){return null},e.prototype.getValueState=function(t){return null},e.prototype.getVisualMeta=function(t){return null},e.type="visualMap",e.dependencies=["series"],e.defaultOption={show:!0,z:4,min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:te.color.transparent,borderColor:te.color.borderTint,contentColor:te.color.theme[0],inactiveColor:te.color.disabled,borderWidth:0,padding:te.size.m,textGap:10,precision:0,textStyle:{color:te.color.secondary}},e})(ot),DV=[20,140],sCe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.optionUpdated=function(t,n){r.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(a){a.mappingMethod="linear",a.dataExtent=this.getExtent()}),this._resetRange()},e.prototype.resetItemSize=function(){r.prototype.resetItemSize.apply(this,arguments);var t=this.itemSize;(t[0]==null||isNaN(t[0]))&&(t[0]=DV[0]),(t[1]==null||isNaN(t[1]))&&(t[1]=DV[1])},e.prototype._resetRange=function(){var t=this.getExtent(),n=this.option.range;!n||n.auto?(t.auto=1,this.option.range=t):ue(n)&&(n[0]>n[1]&&n.reverse(),n[0]=Math.max(n[0],t[0]),n[1]=Math.min(n[1],t[1]))},e.prototype.completeVisualOption=function(){r.prototype.completeVisualOption.apply(this,arguments),P(this.stateList,function(t){var n=this.option.controller[t].symbolSize;n&&n[0]!==n[1]&&(n[0]=n[1]/3)},this)},e.prototype.setSelected=function(t){this.option.range=t.slice(),this._resetRange()},e.prototype.getSelected=function(){var t=this.getExtent(),n=Ta((this.get("range")||[]).slice());return n[0]>t[1]&&(n[0]=t[1]),n[1]>t[1]&&(n[1]=t[1]),n[0]<t[0]&&(n[0]=t[0]),n[1]<t[0]&&(n[1]=t[0]),n},e.prototype.getValueState=function(t){var n=this.option.range,a=this.getExtent(),i=De(this.option.unboundedRange,!0);return(i&&n[0]<=a[0]||n[0]<=t)&&(i&&n[1]>=a[1]||t<=n[1])?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(t){var n=[];return this.eachTargetSeries(function(a){var i=[],o=a.getData();o.each(this.getDataDimensionIndex(o),function(s,l){t[0]<=s&&s<=t[1]&&i.push(l)},this),n.push({seriesId:a.id,dataIndex:i})},this),n},e.prototype.getVisualMeta=function(t){var n=NV(this,"outOfRange",this.getExtent()),a=NV(this,"inRange",this.option.range.slice()),i=[];function o(v,g){i.push({value:v,color:t(v,g)})}for(var s=0,l=0,u=a.length,c=n.length;l<c&&(!a.length||n[l]<=a[0]);l++)n[l]<a[s]&&o(n[l],"outOfRange");for(var f=1;s<u;s++,f=0)f&&i.length&&o(a[s],"outOfRange"),o(a[s],"inRange");for(var f=1;l<c;l++)(!a.length||a[a.length-1]<n[l])&&(f&&(i.length&&o(i[i.length-1].value,"outOfRange"),f=0),o(n[l],"outOfRange"));var h=i.length;return{stops:i,outerColors:[h?i[0].color:"transparent",h?i[h-1].color:"transparent"]}},e.type="visualMap.continuous",e.defaultOption=su(ub.defaultOption,{align:"auto",calculable:!1,hoverLink:!0,realtime:!0,handleIcon:"path://M-11.39,9.77h0a3.5,3.5,0,0,1-3.5,3.5h-22a3.5,3.5,0,0,1-3.5-3.5h0a3.5,3.5,0,0,1,3.5-3.5h22A3.5,3.5,0,0,1-11.39,9.77Z",handleSize:"120%",handleStyle:{borderColor:te.color.neutral00,borderWidth:1},indicatorIcon:"circle",indicatorSize:"50%",indicatorStyle:{borderColor:te.color.neutral00,borderWidth:2,shadowBlur:2,shadowOffsetX:1,shadowOffsetY:1,shadowColor:te.color.shadow}}),e})(ub);function NV(r,e,t){if(t[0]===t[1])return t.slice();for(var n=200,a=(t[1]-t[0])/n,i=t[0],o=[],s=0;s<=n&&i<t[1];s++)o.push(i),i+=a;return o.push(t[1]),o}var $Y=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.autoPositionValues={left:1,right:1,top:1,bottom:1},t}return e.prototype.init=function(t,n){this.ecModel=t,this.api=n},e.prototype.render=function(t,n,a,i){if(this.visualMapModel=t,t.get("show")===!1){this.group.removeAll();return}this.doRender(t,n,a,i)},e.prototype.renderBackground=function(t){var n=this.visualMapModel,a=Gh(n.get("padding")||0),i=t.getBoundingRect();t.add(new rt({z2:-1,silent:!0,shape:{x:i.x-a[3],y:i.y-a[0],width:i.width+a[3]+a[1],height:i.height+a[0]+a[2]},style:{fill:n.get("backgroundColor"),stroke:n.get("borderColor"),lineWidth:n.get("borderWidth")}}))},e.prototype.getControllerVisual=function(t,n,a){a=a||{};var i=a.forceState,o=this.visualMapModel,s={};if(n==="color"){var l=o.get("contentColor");s.color=l}function u(v){return s[v]}function c(v,g){s[v]=g}var f=o.controllerVisuals[i||o.getValueState(t)],h=Qr.prepareVisualTypes(f);return P(h,function(v){var g=f[v];a.convertOpacityToAlpha&&v==="opacity"&&(v="colorAlpha",g=f.__alphaForOpacity),Qr.dependsOn(v,n)&&g&&g.applyVisual(t,u,c)}),s[n]},e.prototype.positionGroup=function(t){var n=this.visualMapModel,a=this.api,i=Fr(n,a).refContainer;qb(t,n.getBoxLayoutParams(),i)},e.prototype.doRender=function(t,n,a,i){},e.type="visualMap",e})(Ft),LV=[["left","right","width"],["top","bottom","height"]];function XY(r,e,t){var n=r.option,a=n.align;if(a!=null&&a!=="auto")return a;for(var i={width:e.getWidth(),height:e.getHeight()},o=n.orient==="horizontal"?1:0,s=LV[o],l=[0,null,10],u={},c=0;c<3;c++)u[LV[1-o][c]]=l[c],u[s[c]]=c===2?t[0]:n[s[c]];var f=[["x","width",3],["y","height",0]][o],h=tr(u,i,n.padding);return s[(h.margin[f[2]]||0)+h[f[0]]+h[f[1]]*.5<i[f[1]]*.5?0:1]}function Wx(r,e){return P(r||[],function(t){t.dataIndex!=null&&(t.dataIndexInside=t.dataIndex,t.dataIndex=null),t.highlightKey="visualMap"+(e?e.componentIndex:"")}),r}var Yi=Nt,lCe=P,kV=Math.min,cC=Math.max,uCe=12,cCe=6,fCe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._shapes={},t._dataInterval=[],t._handleEnds=[],t._hoverLinkDataIndices=[],t}return e.prototype.init=function(t,n){r.prototype.init.call(this,t,n),this._hoverLinkFromSeriesMouseOver=we(this._hoverLinkFromSeriesMouseOver,this),this._hideIndicator=we(this._hideIndicator,this)},e.prototype.doRender=function(t,n,a,i){(!i||i.type!=="selectDataRange"||i.from!==this.uid)&&this._buildView()},e.prototype._buildView=function(){this.group.removeAll();var t=this.visualMapModel,n=this.group;this._orient=t.get("orient"),this._useHandle=t.get("calculable"),this._resetInterval(),this._renderBar(n);var a=t.get("text");this._renderEndsText(n,a,0),this._renderEndsText(n,a,1),this._updateView(!0),this.renderBackground(n),this._updateView(),this._enableHoverLinkToSeries(),this._enableHoverLinkFromSeries(),this.positionGroup(n)},e.prototype._renderEndsText=function(t,n,a){if(n){var i=n[1-a];i=i!=null?i+"":"";var o=this.visualMapModel,s=o.get("textGap"),l=o.itemSize,u=this._shapes.mainGroup,c=this._applyTransform([l[0]/2,a===0?-s:l[1]+s],u),f=this._applyTransform(a===0?"bottom":"top",u),h=this._orient,v=this.visualMapModel.textStyleModel;this.group.add(new pt({style:Gt(v,{x:c[0],y:c[1],verticalAlign:v.get("verticalAlign")||(h==="horizontal"?"middle":f),align:v.get("align")||(h==="horizontal"?f:"center"),text:i})}))}},e.prototype._renderBar=function(t){var n=this.visualMapModel,a=this._shapes,i=n.itemSize,o=this._orient,s=this._useHandle,l=XY(n,this.api,i),u=a.mainGroup=this._createBarGroup(l),c=new Re;u.add(c),c.add(a.outOfRange=RV()),c.add(a.inRange=RV(null,s?IV(this._orient):null,we(this._dragHandle,this,"all",!1),we(this._dragHandle,this,"all",!0))),c.setClipPath(new rt({shape:{x:0,y:0,width:i[0],height:i[1],r:3}}));var f=n.textStyleModel.getTextRect("国"),h=cC(f.width,f.height);s&&(a.handleThumbs=[],a.handleLabels=[],a.handleLabelPoints=[],this._createHandle(n,u,0,i,h,o),this._createHandle(n,u,1,i,h,o)),this._createIndicator(n,u,i,h,o),t.add(u)},e.prototype._createHandle=function(t,n,a,i,o,s){var l=we(this._dragHandle,this,a,!1),u=we(this._dragHandle,this,a,!0),c=Mi(t.get("handleSize"),i[0]),f=Ar(t.get("handleIcon"),-c/2,-c/2,c,c,null,!0),h=IV(this._orient);f.attr({cursor:h,draggable:!0,drift:l,ondragend:u,onmousemove:function(_){xs(_.event)}}),f.x=i[0]/2,f.useStyle(t.getModel("handleStyle").getItemStyle()),f.setStyle({strokeNoScale:!0,strokeFirst:!0}),f.style.lineWidth*=2,f.ensureState("emphasis").style=t.getModel(["emphasis","handleStyle"]).getItemStyle(),gc(f,!0),n.add(f);var v=this.visualMapModel.textStyleModel,g=new pt({cursor:h,draggable:!0,drift:l,onmousemove:function(_){xs(_.event)},ondragend:u,style:Gt(v,{x:0,y:0,text:""})});g.ensureState("blur").style={opacity:.1},g.stateTransition={duration:200},this.group.add(g);var y=[c,0],b=this._shapes;b.handleThumbs[a]=f,b.handleLabelPoints[a]=y,b.handleLabels[a]=g},e.prototype._createIndicator=function(t,n,a,i,o){var s=Mi(t.get("indicatorSize"),a[0]),l=Ar(t.get("indicatorIcon"),-s/2,-s/2,s,s,null,!0);l.attr({cursor:"move",invisible:!0,silent:!0,x:a[0]/2});var u=t.getModel("indicatorStyle").getItemStyle();if(l instanceof en){var c=l.style;l.useStyle(oe({image:c.image,x:c.x,y:c.y,width:c.width,height:c.height},u))}else l.useStyle(u);n.add(l);var f=this.visualMapModel.textStyleModel,h=new pt({silent:!0,invisible:!0,style:Gt(f,{x:0,y:0,text:""})});this.group.add(h);var v=[(o==="horizontal"?i/2:cCe)+a[0]/2,0],g=this._shapes;g.indicator=l,g.indicatorLabel=h,g.indicatorLabelPoint=v,this._firstShowIndicator=!0},e.prototype._dragHandle=function(t,n,a,i){if(this._useHandle){if(this._dragging=!n,!n){var o=this._applyTransform([a,i],this._shapes.mainGroup,!0);this._updateInterval(t,o[1]),this._hideIndicator(),this._updateView()}n===!this.visualMapModel.get("realtime")&&this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:this._dataInterval.slice()}),n?!this._hovering&&this._clearHoverLinkToSeries():EV(this.visualMapModel)&&this._doHoverLinkToSeries(this._handleEnds[t],!1)}},e.prototype._resetInterval=function(){var t=this.visualMapModel,n=this._dataInterval=t.getSelected(),a=t.getExtent(),i=[0,t.itemSize[1]];this._handleEnds=[Yi(n[0],a,i,!0),Yi(n[1],a,i,!0)]},e.prototype._updateInterval=function(t,n){n=n||0;var a=this.visualMapModel,i=this._handleEnds,o=[0,a.itemSize[1]];Jl(n,i,o,t,0);var s=a.getExtent();this._dataInterval=[Yi(i[0],o,s,!0),Yi(i[1],o,s,!0)]},e.prototype._updateView=function(t){var n=this.visualMapModel,a=n.getExtent(),i=this._shapes,o=[0,n.itemSize[1]],s=t?o:this._handleEnds,l=this._createBarVisual(this._dataInterval,a,s,"inRange"),u=this._createBarVisual(a,a,o,"outOfRange");i.inRange.setStyle({fill:l.barColor}).setShape("points",l.barPoints),i.outOfRange.setStyle({fill:u.barColor}).setShape("points",u.barPoints),this._updateHandle(s,l)},e.prototype._createBarVisual=function(t,n,a,i){var o={forceState:i,convertOpacityToAlpha:!0},s=this._makeColorGradient(t,o),l=[this.getControllerVisual(t[0],"symbolSize",o),this.getControllerVisual(t[1],"symbolSize",o)],u=this._createBarPoints(a,l);return{barColor:new ef(0,0,0,1,s),barPoints:u,handlesColor:[s[0].color,s[s.length-1].color]}},e.prototype._makeColorGradient=function(t,n){var a=100,i=[],o=(t[1]-t[0])/a;i.push({color:this.getControllerVisual(t[0],"color",n),offset:0});for(var s=1;s<a;s++){var l=t[0]+o*s;if(l>t[1])break;i.push({color:this.getControllerVisual(l,"color",n),offset:s/a})}return i.push({color:this.getControllerVisual(t[1],"color",n),offset:1}),i},e.prototype._createBarPoints=function(t,n){var a=this.visualMapModel.itemSize;return[[a[0]-n[0],t[0]],[a[0],t[0]],[a[0],t[1]],[a[0]-n[1],t[1]]]},e.prototype._createBarGroup=function(t){var n=this._orient,a=this.visualMapModel.get("inverse");return new Re(n==="horizontal"&&!a?{scaleX:t==="bottom"?1:-1,rotation:Math.PI/2}:n==="horizontal"&&a?{scaleX:t==="bottom"?-1:1,rotation:-Math.PI/2}:n==="vertical"&&!a?{scaleX:t==="left"?1:-1,scaleY:-1}:{scaleX:t==="left"?1:-1})},e.prototype._updateHandle=function(t,n){if(this._useHandle){var a=this._shapes,i=this.visualMapModel,o=a.handleThumbs,s=a.handleLabels,l=i.itemSize,u=i.getExtent(),c=this._applyTransform("left",a.mainGroup);lCe([0,1],function(f){var h=o[f];h.setStyle("fill",n.handlesColor[f]),h.y=t[f];var v=Yi(t[f],[0,l[1]],u,!0),g=this.getControllerVisual(v,"symbolSize");h.scaleX=h.scaleY=g/l[0],h.x=l[0]-g/2;var y=Si(a.handleLabelPoints[f],Hl(h,this.group));if(this._orient==="horizontal"){var b=c==="left"||c==="top"?(l[0]-g)/2:(l[0]-g)/-2;y[1]+=b}s[f].setStyle({x:y[0],y:y[1],text:i.formatValueText(this._dataInterval[f]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",a.mainGroup):"center"})},this)}},e.prototype._showIndicator=function(t,n,a,i){var o=this.visualMapModel,s=o.getExtent(),l=o.itemSize,u=[0,l[1]],c=this._shapes,f=c.indicator;if(f){f.attr("invisible",!1);var h={convertOpacityToAlpha:!0},v=this.getControllerVisual(t,"color",h),g=this.getControllerVisual(t,"symbolSize"),y=Yi(t,s,u,!0),b=l[0]-g/2,_={x:f.x,y:f.y};f.y=y,f.x=b;var S=Si(c.indicatorLabelPoint,Hl(f,this.group)),T=c.indicatorLabel;T.attr("invisible",!1);var C=this._applyTransform("left",c.mainGroup),M=this._orient,D=M==="horizontal";T.setStyle({text:(a||"")+o.formatValueText(n),verticalAlign:D?C:"middle",align:D?"center":C});var L={x:b,y,style:{fill:v}},k={style:{x:S[0],y:S[1]}};if(o.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var R={duration:100,easing:"cubicInOut",additive:!0};f.x=_.x,f.y=_.y,f.animateTo(L,R),T.animateTo(k,R)}else f.attr(L),T.attr(k);this._firstShowIndicator=!1;var E=this._shapes.handleLabels;if(E)for(var I=0;I<E.length;I++)this.api.enterBlur(E[I])}},e.prototype._enableHoverLinkToSeries=function(){var t=this;this._shapes.mainGroup.on("mousemove",function(n){if(t._hovering=!0,!t._dragging){var a=t.visualMapModel.itemSize,i=t._applyTransform([n.offsetX,n.offsetY],t._shapes.mainGroup,!0,!0);i[1]=kV(cC(0,i[1]),a[1]),t._doHoverLinkToSeries(i[1],0<=i[0]&&i[0]<=a[0])}}).on("mouseout",function(){t._hovering=!1,!t._dragging&&t._clearHoverLinkToSeries()})},e.prototype._enableHoverLinkFromSeries=function(){var t=this.api.getZr();this.visualMapModel.option.hoverLink?(t.on("mouseover",this._hoverLinkFromSeriesMouseOver,this),t.on("mouseout",this._hideIndicator,this)):this._clearHoverLinkFromSeries()},e.prototype._doHoverLinkToSeries=function(t,n){var a=this.visualMapModel,i=a.itemSize;if(a.option.hoverLink){var o=[0,i[1]],s=a.getExtent();t=kV(cC(o[0],t),o[1]);var l=dCe(a,s,o),u=[t-l,t+l],c=Yi(t,o,s,!0),f=[Yi(u[0],o,s,!0),Yi(u[1],o,s,!0)];u[0]<o[0]&&(f[0]=-1/0),u[1]>o[1]&&(f[1]=1/0),n&&(f[0]===-1/0?this._showIndicator(c,f[1],"< ",l):f[1]===1/0?this._showIndicator(c,f[0],"> ",l):this._showIndicator(c,c,"≈ ",l));var h=this._hoverLinkDataIndices,v=[];(n||EV(a))&&(v=this._hoverLinkDataIndices=a.findTargetDataIndices(f));var g=Wse(h,v);this._dispatchHighDown("downplay",Wx(g[0],a)),this._dispatchHighDown("highlight",Wx(g[1],a))}},e.prototype._hoverLinkFromSeriesMouseOver=function(t){var n;if(yc(t.target,function(l){var u=Ge(l);if(u.dataIndex!=null)return n=u,!0},!0),!!n){var a=this.ecModel.getSeriesByIndex(n.seriesIndex),i=this.visualMapModel;if(i.isTargetSeries(a)){var o=a.getData(n.dataType),s=o.getStore().get(i.getDataDimensionIndex(o),n.dataIndex);isNaN(s)||this._showIndicator(s,s)}}},e.prototype._hideIndicator=function(){var t=this._shapes;t.indicator&&t.indicator.attr("invisible",!0),t.indicatorLabel&&t.indicatorLabel.attr("invisible",!0);var n=this._shapes.handleLabels;if(n)for(var a=0;a<n.length;a++)this.api.leaveBlur(n[a])},e.prototype._clearHoverLinkToSeries=function(){this._hideIndicator();var t=this._hoverLinkDataIndices;this._dispatchHighDown("downplay",Wx(t,this.visualMapModel)),t.length=0},e.prototype._clearHoverLinkFromSeries=function(){this._hideIndicator();var t=this.api.getZr();t.off("mouseover",this._hoverLinkFromSeriesMouseOver),t.off("mouseout",this._hideIndicator)},e.prototype._applyTransform=function(t,n,a,i){var o=Hl(n,i?null:this.group);return ue(t)?Si(t,o,a):Yb(t,o,a)},e.prototype._dispatchHighDown=function(t,n){n&&n.length&&this.api.dispatchAction({type:t,batch:n})},e.prototype.dispose=function(){this._clearHoverLinkFromSeries(),this._clearHoverLinkToSeries()},e.type="visualMap.continuous",e})($Y);function RV(r,e,t,n){return new Cn({shape:{points:r},draggable:!!t,cursor:e,drift:t,onmousemove:function(a){xs(a.event)},ondragend:n})}function dCe(r,e,t){var n=uCe/2,a=r.get("hoverLinkDataSize");return a&&(n=Yi(a,e,t,!0)/2),n}function EV(r){var e=r.get("hoverLinkOnHandle");return!!(e??r.get("realtime"))}function IV(r){return r==="vertical"?"ns-resize":"ew-resize"}var hCe={type:"selectDataRange",event:"dataRangeSelected",update:"update"},vCe=function(r,e){e.eachComponent({mainType:"visualMap",query:r},function(t){t.setSelected(r.selected)})},pCe=[{createOnAllSeries:!0,reset:function(r,e){var t=[];return e.eachComponent("visualMap",function(n){var a=r.pipelineContext;!n.isTargetSeries(r)||a&&a.large||t.push(P2e(n.stateList,n.targetVisuals,we(n.getValueState,n),n.getDataDimensionIndex(r.getData())))}),t}},{createOnAllSeries:!0,reset:function(r,e){var t=r.getData(),n=[];e.eachComponent("visualMap",function(a){if(a.isTargetSeries(r)){var i=a.getVisualMeta(we(gCe,null,r,a))||{stops:[],outerColors:[]},o=a.getDataDimensionIndex(t);o>=0&&(i.dimension=o,n.push(i))}}),r.getData().setVisual("visualMeta",n)}}];function gCe(r,e,t,n){for(var a=e.targetVisuals[n],i=Qr.prepareVisualTypes(a),o={color:Dm(r.getData(),"color")},s=0,l=i.length;s<l;s++){var u=i[s],c=a[u==="opacity"?"__alphaForOpacity":u];c&&c.applyVisual(t,f,h)}return o.color;function f(v){return o[v]}function h(v,g){o[v]=g}}var OV=P;function mCe(r){var e=r&&r.visualMap;ue(e)||(e=e?[e]:[]),OV(e,function(t){if(t){Td(t,"splitList")&&!Td(t,"pieces")&&(t.pieces=t.splitList,delete t.splitList);var n=t.pieces;n&&ue(n)&&OV(n,function(a){Oe(a)&&(Td(a,"start")&&!Td(a,"min")&&(a.min=a.start),Td(a,"end")&&!Td(a,"max")&&(a.max=a.end))})}})}function Td(r,e){return r&&r.hasOwnProperty&&r.hasOwnProperty(e)}var PV=!1;function qY(r){PV||(PV=!0,r.registerSubTypeDefaulter("visualMap",function(e){return!e.categories&&(!(e.pieces?e.pieces.length>0:e.splitNumber>0)||e.calculable)?"continuous":"piecewise"}),r.registerAction(hCe,vCe),P(pCe,function(e){r.registerVisual(r.PRIORITY.VISUAL.COMPONENT,e)}),r.registerPreprocessor(mCe))}function ZY(r){r.registerComponentModel(sCe),r.registerComponentView(fCe),qY(r)}var yCe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._pieceList=[],t}return e.prototype.optionUpdated=function(t,n){r.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var a=this._mode=this._determineMode();this._pieceList=[],xCe[this._mode].call(this,this._pieceList),this._resetSelected(t,n);var i=this.option.categories;this.resetVisual(function(o,s){a==="categories"?(o.mappingMethod="category",o.categories=ke(i)):(o.dataExtent=this.getExtent(),o.mappingMethod="piecewise",o.pieceList=ce(this._pieceList,function(l){return l=ke(l),s!=="inRange"&&(l.visual=null),l}))})},e.prototype.completeVisualOption=function(){var t=this.option,n={},a=Qr.listVisualTypes(),i=this.isCategory();P(t.pieces,function(s){P(a,function(l){s.hasOwnProperty(l)&&(n[l]=1)})}),P(n,function(s,l){var u=!1;P(this.stateList,function(c){u=u||o(t,c,l)||o(t.target,c,l)},this),!u&&P(this.stateList,function(c){(t[c]||(t[c]={}))[l]=YY.get(l,c==="inRange"?"active":"inactive",i)})},this);function o(s,l,u){return s&&s[l]&&s[l].hasOwnProperty(u)}r.prototype.completeVisualOption.apply(this,arguments)},e.prototype._resetSelected=function(t,n){var a=this.option,i=this._pieceList,o=(n?a:t).selected||{};if(a.selected=o,P(i,function(l,u){var c=this.getSelectedMapKey(l);o.hasOwnProperty(c)||(o[c]=!0)},this),a.selectedMode==="single"){var s=!1;P(i,function(l,u){var c=this.getSelectedMapKey(l);o[c]&&(s?o[c]=!1:s=!0)},this)}},e.prototype.getItemSymbol=function(){return this.get("itemSymbol")},e.prototype.getSelectedMapKey=function(t){return this._mode==="categories"?t.value+"":t.index+""},e.prototype.getPieceList=function(){return this._pieceList},e.prototype._determineMode=function(){var t=this.option;return t.pieces&&t.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},e.prototype.setSelected=function(t){this.option.selected=ke(t)},e.prototype.getValueState=function(t){var n=Qr.findPieceIndex(t,this._pieceList);return n!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[n])]?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(t){var n=[],a=this._pieceList;return this.eachTargetSeries(function(i){var o=[],s=i.getData();s.each(this.getDataDimensionIndex(s),function(l,u){var c=Qr.findPieceIndex(l,a);c===t&&o.push(u)},this),n.push({seriesId:i.id,dataIndex:o})},this),n},e.prototype.getRepresentValue=function(t){var n;if(this.isCategory())n=t.value;else if(t.value!=null)n=t.value;else{var a=t.interval||[];n=a[0]===-1/0&&a[1]===1/0?0:(a[0]+a[1])/2}return n},e.prototype.getVisualMeta=function(t){if(this.isCategory())return;var n=[],a=["",""],i=this;function o(c,f){var h=i.getRepresentValue({interval:c});f||(f=i.getValueState(h));var v=t(h,f);c[0]===-1/0?a[0]=v:c[1]===1/0?a[1]=v:n.push({value:c[0],color:v},{value:c[1],color:v})}var s=this._pieceList.slice();if(!s.length)s.push({interval:[-1/0,1/0]});else{var l=s[0].interval[0];l!==-1/0&&s.unshift({interval:[-1/0,l]}),l=s[s.length-1].interval[1],l!==1/0&&s.push({interval:[l,1/0]})}var u=-1/0;return P(s,function(c){var f=c.interval;f&&(f[0]>u&&o([u,f[0]],"outOfRange"),o(f.slice()),u=f[1])},this),{stops:n,outerColors:a}},e.type="visualMap.piecewise",e.defaultOption=su(ub.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),e})(ub),xCe={splitNumber:function(r){var e=this.option,t=Math.min(e.precision,20),n=this.getExtent(),a=e.splitNumber;a=Math.max(parseInt(a,10),1),e.splitNumber=a;for(var i=(n[1]-n[0])/a;+i.toFixed(t)!==i&&t<5;)t++;e.precision=t,i=+i.toFixed(t),e.minOpen&&r.push({interval:[-1/0,n[0]],close:[0,0]});for(var o=0,s=n[0];o<a;s+=i,o++){var l=o===a-1?n[1]:s+i;r.push({interval:[s,l],close:[1,1]})}e.maxOpen&&r.push({interval:[n[1],1/0],close:[0,0]}),yA(r),P(r,function(u,c){u.index=c,u.text=this.formatValueText(u.interval)},this)},categories:function(r){var e=this.option;P(e.categories,function(t){r.push({text:this.formatValueText(t,!0),value:t})},this),jV(e,r)},pieces:function(r){var e=this.option;P(e.pieces,function(t,n){Oe(t)||(t={value:t});var a={text:"",index:n};if(t.label!=null&&(a.text=t.label),t.hasOwnProperty("value")){var i=a.value=t.value;a.interval=[i,i],a.close=[1,1]}else{for(var o=a.interval=[],s=a.close=[0,0],l=[1,0,1],u=[-1/0,1/0],c=[],f=0;f<2;f++){for(var h=[["gte","gt","min"],["lte","lt","max"]][f],v=0;v<3&&o[f]==null;v++)o[f]=t[h[v]],s[f]=l[v],c[f]=v===2;o[f]==null&&(o[f]=u[f])}c[0]&&o[1]===1/0&&(s[0]=0),c[1]&&o[0]===-1/0&&(s[1]=0),o[0]===o[1]&&s[0]&&s[1]&&(a.value=o[0])}a.visual=Qr.retrieveVisuals(t),r.push(a)},this),jV(e,r),yA(r),P(r,function(t){var n=t.close,a=[["<","≤"][n[1]],[">","≥"][n[0]]];t.text=t.text||this.formatValueText(t.value!=null?t.value:t.interval,!1,a)},this)}};function jV(r,e){var t=r.inverse;(r.orient==="vertical"?!t:t)&&e.reverse()}var bCe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.doRender=function(){var t=this.group;t.removeAll();var n=this.visualMapModel,a=n.get("textGap"),i=n.textStyleModel,o=this._getItemAlign(),s=n.itemSize,l=this._getViewData(),u=l.endsText,c=fn(n.get("showLabel",!0),!u),f=!n.get("selectedMode");u&&this._renderEndsText(t,u[0],s,c,o),P(l.viewPieceList,function(h){var v=h.piece,g=new Re;g.onclick=we(this._onItemClick,this,v),this._enableHoverLink(g,h.indexInModelPieceList);var y=n.getRepresentValue(v);if(this._createItemSymbol(g,y,[0,0,s[0],s[1]],f),c){var b=this.visualMapModel.getValueState(y),_=i.get("align")||o;g.add(new pt({style:Gt(i,{x:_==="right"?-a:s[0]+a,y:s[1]/2,text:v.text,verticalAlign:i.get("verticalAlign")||"middle",align:_,opacity:De(i.get("opacity"),b==="outOfRange"?.5:1)}),silent:f}))}t.add(g)},this),u&&this._renderEndsText(t,u[1],s,c,o),Ec(n.get("orient"),t,n.get("itemGap")),this.renderBackground(t),this.positionGroup(t)},e.prototype._enableHoverLink=function(t,n){var a=this;t.on("mouseover",function(){return i("highlight")}).on("mouseout",function(){return i("downplay")});var i=function(o){var s=a.visualMapModel;s.option.hoverLink&&a.api.dispatchAction({type:o,batch:Wx(s.findTargetDataIndices(n),s)})}},e.prototype._getItemAlign=function(){var t=this.visualMapModel,n=t.option;if(n.orient==="vertical")return XY(t,this.api,t.itemSize);var a=n.align;return(!a||a==="auto")&&(a="left"),a},e.prototype._renderEndsText=function(t,n,a,i,o){if(n){var s=new Re,l=this.visualMapModel.textStyleModel;s.add(new pt({style:Gt(l,{x:i?o==="right"?a[0]:0:a[0]/2,y:a[1]/2,verticalAlign:"middle",align:i?o:"center",text:n})})),t.add(s)}},e.prototype._getViewData=function(){var t=this.visualMapModel,n=ce(t.getPieceList(),function(s,l){return{piece:s,indexInModelPieceList:l}}),a=t.get("text"),i=t.get("orient"),o=t.get("inverse");return(i==="horizontal"?o:!o)?n.reverse():a&&(a=a.slice().reverse()),{viewPieceList:n,endsText:a}},e.prototype._createItemSymbol=function(t,n,a,i){var o=Ar(this.getControllerVisual(n,"symbol"),a[0],a[1],a[2],a[3],this.getControllerVisual(n,"color"));o.silent=i,t.add(o)},e.prototype._onItemClick=function(t){var n=this.visualMapModel,a=n.option,i=a.selectedMode;if(i){var o=ke(a.selected),s=n.getSelectedMapKey(t);i==="single"||i===!0?(o[s]=!0,P(o,function(l,u){o[u]=u===s})):o[s]=!o[s],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:o})}},e.type="visualMap.piecewise",e})($Y);function KY(r){r.registerComponentModel(yCe),r.registerComponentView(bCe),qY(r)}function _Ce(r){tt(ZY),tt(KY)}var SCe=(function(){function r(e){this._thumbnailModel=e}return r.prototype.reset=function(e){this._renderVersion=e.getMainProcessVersion()},r.prototype.renderContent=function(e){var t=e.api.getViewOfComponentModel(this._thumbnailModel);t&&(e.group.silent=!0,t.renderContent({group:e.group,targetTrans:e.targetTrans,z2Range:_8(e.group),roamType:e.roamType,viewportRect:e.viewportRect,renderVersion:this._renderVersion}))},r.prototype.updateWindow=function(e,t){var n=t.getViewOfComponentModel(this._thumbnailModel);n&&n.updateWindow({targetTrans:e,renderVersion:this._renderVersion})},r})(),wCe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.preventAutoZ=!0,t}return e.prototype.optionUpdated=function(t,n){this._updateBridge()},e.prototype._updateBridge=function(){var t=this._birdge=this._birdge||new SCe(this);if(this._target=null,this.ecModel.eachSeries(function(a){l4(a,null)}),this.shouldShow()){var n=this.getTarget();l4(n.baseMapProvider,t)}},e.prototype.shouldShow=function(){return this.getShallow("show",!0)},e.prototype.getBridge=function(){return this._birdge},e.prototype.getTarget=function(){if(this._target)return this._target;var t=this.getReferringComponents("series",{useDefault:!1,enableAll:!1,enableNone:!1}).models[0];return t?t.subType!=="graph"&&(t=null):t=this.ecModel.queryComponents({mainType:"series",subType:"graph"})[0],this._target={baseMapProvider:t},this._target},e.type="thumbnail",e.layoutMode="box",e.dependencies=["series","geo"],e.defaultOption={show:!0,right:1,bottom:1,height:"25%",width:"25%",itemStyle:{borderColor:te.color.border,borderWidth:2},windowStyle:{borderWidth:1,color:te.color.neutral30,borderColor:te.color.neutral40,opacity:.3},z:10},e})(ot),TCe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,n,a){if(this._api=a,this._model=t,this._coordSys||(this._coordSys=new lf),!this._isEnabled()){this._clear();return}this._renderVersion=a.getMainProcessVersion();var i=this.group;i.removeAll();var o=t.getModel("itemStyle"),s=o.getItemStyle();s.fill==null&&(s.fill=n.get("backgroundColor")||te.color.neutral00);var l=Fr(t,a).refContainer,u=tr(G8(t,!0),l),c=s.lineWidth||0,f=this._contentRect=Fc(u.clone(),c/2,!0,!0),h=new Re;i.add(h),h.setClipPath(new rt({shape:f.plain()}));var v=this._targetGroup=new Re;h.add(v);var g=u.plain();g.r=o.getShallow("borderRadius",!0),i.add(this._bgRect=new rt({style:s,shape:g,silent:!1,cursor:"grab"}));var y=t.getModel("windowStyle"),b=y.getShallow("borderRadius",!0);h.add(this._windowRect=new rt({shape:{x:0,y:0,width:0,height:0,r:b},style:y.getItemStyle(),silent:!1,cursor:"grab"})),this._dealRenderContent(),this._dealUpdateWindow(),BV(t,this)},e.prototype.renderContent=function(t){this._bridgeRendered=t,this._isEnabled()&&(this._dealRenderContent(),this._dealUpdateWindow(),BV(this._model,this))},e.prototype._dealRenderContent=function(){var t=this._bridgeRendered;if(!(!t||t.renderVersion!==this._renderVersion)){var n=this._targetGroup,a=this._coordSys,i=this._contentRect;if(n.removeAll(),!!t){var o=t.group,s=o.getBoundingRect();n.add(o),this._bgRect.z2=t.z2Range.min-10,a.setBoundingRect(s.x,s.y,s.width,s.height);var l=tr({left:"center",top:"center",aspect:s.width/s.height},i);a.setViewRect(l.x,l.y,l.width,l.height),o.attr(a.getTransformInfo().raw),this._windowRect.z2=t.z2Range.max+10,this._resetRoamController(t.roamType)}}},e.prototype.updateWindow=function(t){var n=this._bridgeRendered;n&&n.renderVersion===t.renderVersion&&(n.targetTrans=t.targetTrans),this._isEnabled()&&this._dealUpdateWindow()},e.prototype._dealUpdateWindow=function(){var t=this._bridgeRendered;if(!(!t||t.renderVersion!==this._renderVersion)){var n=ri([],t.targetTrans),a=bi([],this._coordSys.transform,n);this._transThisToTarget=ri([],a);var i=t.viewportRect;i?i=i.clone():i=new Be(0,0,this._api.getWidth(),this._api.getHeight()),i.applyTransform(a);var o=this._windowRect,s=o.shape.r;o.setShape(Ie({r:s},i))}},e.prototype._resetRoamController=function(t){var n=this,a=this._api,i=this._roamController;if(i||(i=this._roamController=new sf(a.getZr())),!t||!this._isEnabled()){i.disable();return}i.enable(t,{api:a,zInfo:{component:this._model},triggerInfo:{roamTrigger:null,isInSelf:function(o,s,l){return n._contentRect.contain(s,l)}}}),i.off("pan").off("zoom").on("pan",we(this._onPan,this)).on("zoom",we(this._onZoom,this))},e.prototype._onPan=function(t){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var a=pr([],[t.oldX,t.oldY],n),i=pr([],[t.oldX-t.dx,t.oldY-t.dy],n);this._api.dispatchAction(zV(this._model.getTarget().baseMapProvider,{dx:i[0]-a[0],dy:i[1]-a[1]}))}},e.prototype._onZoom=function(t){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var a=pr([],[t.originX,t.originY],n);this._api.dispatchAction(zV(this._model.getTarget().baseMapProvider,{zoom:1/t.scale,originX:a[0],originY:a[1]}))}},e.prototype._isEnabled=function(){var t=this._model;if(!t||!t.shouldShow())return!1;var n=t.getTarget().baseMapProvider;return!!n},e.prototype._clear=function(){this.group.removeAll(),this._bridgeRendered=null,this._roamController&&this._roamController.disable()},e.prototype.remove=function(){this._clear()},e.prototype.dispose=function(){this._clear()},e.type="thumbnail",e})(Ft);function zV(r,e){var t=r.mainType==="series"?r.subType+"Roam":r.mainType+"Roam",n={type:t};return n[r.mainType+"Id"]=r.id,oe(n,e),n}function BV(r,e){var t=Uc(r);$b(e.group,t.z,t.zlevel)}function CCe(r){r.registerComponentModel(wCe),r.registerComponentView(TCe)}var ACe={label:{enabled:!0},decal:{show:!1}},VV=st(),MCe={};function DCe(r,e){var t=r.getModel("aria");if(!t.get("enabled"))return;var n=ke(ACe);Je(n.label,r.getLocaleModel().get("aria"),!1),Je(t.option,n,!1),a(),i();function a(){var u=t.getModel("decal"),c=u.get("show");if(c){var f=Ae();r.eachSeries(function(h){if(!h.isColorBySeries()){var v=f.get(h.type);v||(v={},f.set(h.type,v)),VV(h).scope=v}}),r.eachRawSeries(function(h){if(r.isSeriesFiltered(h))return;if(Le(h.enableAriaDecal)){h.enableAriaDecal();return}var v=h.getData();if(h.isColorBySeries()){var S=BA(h.ecModel,h.name,MCe,r.getSeriesCount()),T=v.getVisual("decal");v.setVisual("decal",C(T,S))}else{var g=h.getRawData(),y={},b=VV(h).scope;v.each(function(M){var D=v.getRawIndex(M);y[D]=M});var _=g.count();g.each(function(M){var D=y[M],L=g.getName(M)||M+"",k=BA(h.ecModel,L,b,_),R=v.getItemVisual(D,"decal");v.setItemVisual(D,"decal",C(R,k))})}function C(M,D){var L=M?oe(oe({},D),M):D;return L.dirty=!0,L}})}}function i(){var u=e.getZr().dom;if(u){var c=r.getLocaleModel().get("aria"),f=t.getModel("label");if(f.option=Ie(f.option,c),!!f.get("enabled")){if(u.setAttribute("role","img"),f.get("description")){u.setAttribute("aria-label",f.get("description"));return}var h=r.getSeriesCount(),v=f.get(["data","maxCount"])||10,g=f.get(["series","maxCount"])||10,y=Math.min(h,g),b;if(!(h<1)){var _=s();if(_){var S=f.get(["general","withTitle"]);b=o(S,{title:_})}else b=f.get(["general","withoutTitle"]);var T=[],C=h>1?f.get(["series","multiple","prefix"]):f.get(["series","single","prefix"]);b+=o(C,{seriesCount:h}),r.eachSeries(function(k,R){if(R<y){var E=void 0,I=k.get("name"),z=I?"withName":"withoutName";E=h>1?f.get(["series","multiple",z]):f.get(["series","single",z]),E=o(E,{seriesId:k.seriesIndex,seriesName:k.get("name"),seriesType:l(k.subType)});var j=k.getData();if(j.count()>v){var G=f.get(["data","partialData"]);E+=o(G,{displayCnt:v})}else E+=f.get(["data","allData"]);for(var U=f.get(["data","separator","middle"]),O=f.get(["data","separator","end"]),H=f.get(["data","excludeDimensionId"]),F=[],$=0;$<j.count();$++)if($<v){var B=j.getName($),X=H?At(j.getValues($),function(Q,ne){return Ze(H,ne)===-1}):j.getValues($),q=f.get(["data",B?"withName":"withoutName"]);F.push(o(q,{name:B,value:X.join(U)}))}E+=F.join(U)+O,T.push(E)}});var M=f.getModel(["series","multiple","separator"]),D=M.get("middle"),L=M.get("end");b+=T.join(D)+L,u.setAttribute("aria-label",b)}}}}function o(u,c){if(!_e(u))return u;var f=u;return P(c,function(h,v){f=f.replace(new RegExp("\\{\\s*"+v+"\\s*\\}","g"),h)}),f}function s(){var u=r.get("title");return u&&u.length&&(u=u[0]),u&&u.text}function l(u){var c=r.getLocaleModel().get(["series","typeNames"]);return c[u]||c.chart}}function NCe(r){if(!(!r||!r.aria)){var e=r.aria;e.show!=null&&(e.enabled=e.show),e.label=e.label||{},P(["description","general","series","data"],function(t){e[t]!=null&&(e.label[t]=e[t])})}}function LCe(r){r.registerPreprocessor(NCe),r.registerVisual(r.PRIORITY.VISUAL.ARIA,DCe)}var GV={value:"eq","<":"lt","<=":"lte",">":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},kCe=(function(){function r(e){var t=this._condVal=_e(e)?new RegExp(e):WH(e)?e:null;if(t==null){var n="";Lt(n)}}return r.prototype.evaluate=function(e){var t=typeof e;return _e(t)?this._condVal.test(e):gt(t)?this._condVal.test(e+""):!1},r})(),RCe=(function(){function r(){}return r.prototype.evaluate=function(){return this.value},r})(),ECe=(function(){function r(){}return r.prototype.evaluate=function(){for(var e=this.children,t=0;t<e.length;t++)if(!e[t].evaluate())return!1;return!0},r})(),ICe=(function(){function r(){}return r.prototype.evaluate=function(){for(var e=this.children,t=0;t<e.length;t++)if(e[t].evaluate())return!0;return!1},r})(),OCe=(function(){function r(){}return r.prototype.evaluate=function(){return!this.child.evaluate()},r})(),PCe=(function(){function r(){}return r.prototype.evaluate=function(){for(var e=!!this.valueParser,t=this.getValue,n=t(this.valueGetterParam),a=e?this.valueParser(n):null,i=0;i<this.subCondList.length;i++)if(!this.subCondList[i].evaluate(e?a:n))return!1;return!0},r})();function pk(r,e){if(r===!0||r===!1){var t=new RCe;return t.value=r,t}var n="";return QY(r)||Lt(n),r.and?HV("and",r,e):r.or?HV("or",r,e):r.not?jCe(r,e):zCe(r,e)}function HV(r,e,t){var n=e[r],a="";ue(n)||Lt(a),n.length||Lt(a);var i=r==="and"?new ECe:new ICe;return i.children=ce(n,function(o){return pk(o,t)}),i.children.length||Lt(a),i}function jCe(r,e){var t=r.not,n="";QY(t)||Lt(n);var a=new OCe;return a.child=pk(t,e),a.child||Lt(n),a}function zCe(r,e){for(var t="",n=e.prepareGetValue(r),a=[],i=ht(r),o=r.parser,s=o?u7(o):null,l=0;l<i.length;l++){var u=i[l];if(!(u==="parser"||e.valueGetterAttrMap.get(u))){var c=Ce(GV,u)?GV[u]:u,f=r[u],h=s?s(f):f,v=afe(c,h)||c==="reg"&&new kCe(h);v||Lt(t),a.push(v)}}a.length||Lt(t);var g=new PCe;return g.valueGetterParam=n,g.valueParser=s,g.getValue=e.getValue,g.subCondList=a,g}function QY(r){return Oe(r)&&!Sn(r)}var BCe=(function(){function r(e,t){this._cond=pk(e,t)}return r.prototype.evaluate=function(){return this._cond.evaluate()},r})();function VCe(r,e){return new BCe(r,e)}var GCe={type:"echarts:filter",transform:function(r){for(var e=r.upstream,t,n=VCe(r.config,{valueGetterAttrMap:Ae({dimension:!0}),prepareGetValue:function(s){var l="",u=s.dimension;Ce(s,"dimension")||Lt(l);var c=e.getDimensionInfo(u);return c||Lt(l),{dimIdx:c.index}},getValue:function(s){return e.retrieveValueFromItem(t,s.dimIdx)}}),a=[],i=0,o=e.count();i<o;i++)t=e.getRawDataItem(i),n.evaluate()&&a.push(t);return{data:a}}},HCe={type:"echarts:sort",transform:function(r){var e=r.upstream,t=r.config,n="",a=Ht(t);a.length||Lt(n);var i=[];P(a,function(c){var f=c.dimension,h=c.order,v=c.parser,g=c.incomparable;if(f==null&&Lt(n),h!=="asc"&&h!=="desc"&&Lt(n),g&&g!=="min"&&g!=="max"){var y="";Lt(y)}if(h!=="asc"&&h!=="desc"){var b="";Lt(b)}var _=e.getDimensionInfo(f);_||Lt(n);var S=v?u7(v):null;v&&!S&&Lt(n),i.push({dimIdx:_.index,parser:S,comparator:new f7(h,g)})});var o=e.sourceFormat;o!==hn&&o!==La&&Lt(n);for(var s=[],l=0,u=e.count();l<u;l++)s.push(e.getRawDataItem(l));return s.sort(function(c,f){for(var h=0;h<i.length;h++){var v=i[h],g=e.retrieveValueFromItem(c,v.dimIdx),y=e.retrieveValueFromItem(f,v.dimIdx);v.parser&&(g=v.parser(g),y=v.parser(y));var b=v.comparator.evaluate(g,y);if(b!==0)return b}return 0}),{data:s}}};function FCe(r){r.registerTransform(GCe),r.registerTransform(HCe)}var UCe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataset",t}return e.prototype.init=function(t,n,a){r.prototype.init.call(this,t,n,a),this._sourceManager=new p7(this),b5(this)},e.prototype.mergeOption=function(t,n){r.prototype.mergeOption.call(this,t,n),b5(this)},e.prototype.optionUpdated=function(){this._sourceManager.dirty()},e.prototype.getSourceManager=function(){return this._sourceManager},e.type="dataset",e.defaultOption={seriesLayoutBy:wi},e})(ot),WCe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataset",t}return e.type="dataset",e})(Ft);function YCe(r){r.registerComponentModel(UCe),r.registerComponentView(WCe)}var Ui=yo.CMD;function Vd(r,e){return Math.abs(r-e)<1e-5}function eD(r){var e=r.data,t=r.len(),n=[],a,i=0,o=0,s=0,l=0;function u(j,G){a&&a.length>2&&n.push(a),a=[j,G]}function c(j,G,U,O){Vd(j,U)&&Vd(G,O)||a.push(j,G,U,O,U,O)}function f(j,G,U,O,H,F){var $=Math.abs(G-j),B=Math.tan($/4)*4/3,X=G<j?-1:1,q=Math.cos(j),Q=Math.sin(j),ne=Math.cos(G),fe=Math.sin(G),ve=q*H+U,Se=Q*F+O,ge=ne*H+U,he=fe*F+O,Ne=H*B*X,xe=F*B*X;a.push(ve-Ne*Q,Se+xe*q,ge+Ne*fe,he-xe*ne,ge,he)}for(var h,v,g,y,b=0;b<t;){var _=e[b++],S=b===1;switch(S&&(i=e[b],o=e[b+1],s=i,l=o,(_===Ui.L||_===Ui.C||_===Ui.Q)&&(a=[s,l])),_){case Ui.M:i=s=e[b++],o=l=e[b++],u(s,l);break;case Ui.L:h=e[b++],v=e[b++],c(i,o,h,v),i=h,o=v;break;case Ui.C:a.push(e[b++],e[b++],e[b++],e[b++],i=e[b++],o=e[b++]);break;case Ui.Q:h=e[b++],v=e[b++],g=e[b++],y=e[b++],a.push(i+2/3*(h-i),o+2/3*(v-o),g+2/3*(h-g),y+2/3*(v-y),g,y),i=g,o=y;break;case Ui.A:var T=e[b++],C=e[b++],M=e[b++],D=e[b++],L=e[b++],k=e[b++]+L;b+=1;var R=!e[b++];h=Math.cos(L)*M+T,v=Math.sin(L)*D+C,S?(s=h,l=v,u(s,l)):c(i,o,h,v),i=Math.cos(k)*M+T,o=Math.sin(k)*D+C;for(var E=(R?-1:1)*Math.PI/2,I=L;R?I>k:I<k;I+=E){var z=R?Math.max(I+E,k):Math.min(I+E,k);f(I,z,T,C,M,D)}break;case Ui.R:s=i=e[b++],l=o=e[b++],h=s+e[b++],v=l+e[b++],u(h,l),c(h,l,h,v),c(h,v,s,v),c(s,v,s,l),c(s,l,h,l);break;case Ui.Z:a&&c(i,o,s,l),i=s,o=l;break}}return a&&a.length>2&&n.push(a),n}function tD(r,e,t,n,a,i,o,s,l,u){if(Vd(r,t)&&Vd(e,n)&&Vd(a,o)&&Vd(i,s)){l.push(o,s);return}var c=2/u,f=c*c,h=o-r,v=s-e,g=Math.sqrt(h*h+v*v);h/=g,v/=g;var y=t-r,b=n-e,_=a-o,S=i-s,T=y*y+b*b,C=_*_+S*S;if(T<f&&C<f){l.push(o,s);return}var M=h*y+v*b,D=-h*_-v*S,L=T-M*M,k=C-D*D;if(L<f&&M>=0&&k<f&&D>=0){l.push(o,s);return}var R=[],E=[];Zl(r,t,a,o,.5,R),Zl(e,n,i,s,.5,E),tD(R[0],E[0],R[1],E[1],R[2],E[2],R[3],E[3],l,u),tD(R[4],E[4],R[5],E[5],R[6],E[6],R[7],E[7],l,u)}function $Ce(r,e){var t=eD(r),n=[];e=e||1;for(var a=0;a<t.length;a++){var i=t[a],o=[],s=i[0],l=i[1];o.push(s,l);for(var u=2;u<i.length;){var c=i[u++],f=i[u++],h=i[u++],v=i[u++],g=i[u++],y=i[u++];tD(s,l,c,f,h,v,g,y,o,e),s=g,l=y}n.push(o)}return n}function JY(r,e,t){var n=r[e],a=r[1-e],i=Math.abs(n/a),o=Math.ceil(Math.sqrt(i*t)),s=Math.floor(t/o);s===0&&(s=1,o=t);for(var l=[],u=0;u<o;u++)l.push(s);var c=o*s,f=t-c;if(f>0)for(var u=0;u<f;u++)l[u%o]+=1;return l}function FV(r,e,t){for(var n=r.r0,a=r.r,i=r.startAngle,o=r.endAngle,s=Math.abs(o-i),l=s*a,u=a-n,c=l>Math.abs(u),f=JY([l,u],c?0:1,e),h=(c?s:u)/f.length,v=0;v<f.length;v++)for(var g=(c?u:s)/f[v],y=0;y<f[v];y++){var b={};c?(b.startAngle=i+h*v,b.endAngle=i+h*(v+1),b.r0=n+g*y,b.r=n+g*(y+1)):(b.startAngle=i+g*y,b.endAngle=i+g*(y+1),b.r0=n+h*v,b.r=n+h*(v+1)),b.clockwise=r.clockwise,b.cx=r.cx,b.cy=r.cy,t.push(b)}}function XCe(r,e,t){for(var n=r.width,a=r.height,i=n>a,o=JY([n,a],i?0:1,e),s=i?"width":"height",l=i?"height":"width",u=i?"x":"y",c=i?"y":"x",f=r[s]/o.length,h=0;h<o.length;h++)for(var v=r[l]/o[h],g=0;g<o[h];g++){var y={};y[u]=h*f,y[c]=g*v,y[s]=f,y[l]=v,y.x+=r.x,y.y+=r.y,t.push(y)}}function UV(r,e,t,n){return r*n-t*e}function qCe(r,e,t,n,a,i,o,s){var l=t-r,u=n-e,c=o-a,f=s-i,h=UV(c,f,l,u);if(Math.abs(h)<1e-6)return null;var v=r-a,g=e-i,y=UV(v,g,c,f)/h;return y<0||y>1?null:new ze(y*l+r,y*u+e)}function ZCe(r,e,t){var n=new ze;ze.sub(n,t,e),n.normalize();var a=new ze;ze.sub(a,r,e);var i=a.dot(n);return i}function Cd(r,e){var t=r[r.length-1];t&&t[0]===e[0]&&t[1]===e[1]||r.push(e)}function KCe(r,e,t){for(var n=r.length,a=[],i=0;i<n;i++){var o=r[i],s=r[(i+1)%n],l=qCe(o[0],o[1],s[0],s[1],e.x,e.y,t.x,t.y);l&&a.push({projPt:ZCe(l,e,t),pt:l,idx:i})}if(a.length<2)return[{points:r},{points:r}];a.sort(function(b,_){return b.projPt-_.projPt});var u=a[0],c=a[a.length-1];if(c.idx<u.idx){var f=u;u=c,c=f}for(var h=[u.pt.x,u.pt.y],v=[c.pt.x,c.pt.y],g=[h],y=[v],i=u.idx+1;i<=c.idx;i++)Cd(g,r[i].slice());Cd(g,v),Cd(g,h);for(var i=c.idx+1;i<=u.idx+n;i++)Cd(y,r[i%n].slice());return Cd(y,h),Cd(y,v),[{points:g},{points:y}]}function WV(r){var e=r.points,t=[],n=[];Gb(e,t,n);var a=new Be(t[0],t[1],n[0]-t[0],n[1]-t[1]),i=a.width,o=a.height,s=a.x,l=a.y,u=new ze,c=new ze;return i>o?(u.x=c.x=s+i/2,u.y=l,c.y=l+o):(u.y=c.y=l+o/2,u.x=s,c.x=s+i),KCe(e,u,c)}function cb(r,e,t,n){if(t===1)n.push(e);else{var a=Math.floor(t/2),i=r(e);cb(r,i[0],a,n),cb(r,i[1],t-a,n)}return n}function QCe(r,e){for(var t=[],n=0;n<e;n++)t.push(cN(r));return t}function JCe(r,e){e.setStyle(r.style),e.z=r.z,e.z2=r.z2,e.zlevel=r.zlevel}function eAe(r){for(var e=[],t=0;t<r.length;)e.push([r[t++],r[t++]]);return e}function tAe(r,e){var t=[],n=r.shape,a;switch(r.type){case"rect":XCe(n,e,t),a=rt;break;case"sector":FV(n,e,t),a=Tn;break;case"circle":FV({r0:0,r:n.r,startAngle:0,endAngle:Math.PI*2,cx:n.cx,cy:n.cy},e,t),a=Tn;break;default:var i=r.getComputedTransform(),o=i?Math.sqrt(Math.max(i[0]*i[0]+i[1]*i[1],i[2]*i[2]+i[3]*i[3])):1,s=ce($Ce(r.getUpdatedPathProxy(),o),function(_){return eAe(_)}),l=s.length;if(l===0)cb(WV,{points:s[0]},e,t);else if(l===e)for(var u=0;u<l;u++)t.push({points:s[u]});else{var c=0,f=ce(s,function(_){var S=[],T=[];Gb(_,S,T);var C=(T[1]-S[1])*(T[0]-S[0]);return c+=C,{poly:_,area:C}});f.sort(function(_,S){return S.area-_.area});for(var h=e,u=0;u<l;u++){var v=f[u];if(h<=0)break;var g=u===l-1?h:Math.ceil(v.area/c*e);g<0||(cb(WV,{points:v.poly},g,t),h-=g)}}a=Cn;break}if(!a)return QCe(r,e);for(var y=[],u=0;u<t.length;u++){var b=new a;b.setShape(t[u]),JCe(r,b),y.push(b)}return y}function rAe(r,e){var t=r.length,n=e.length;if(t===n)return[r,e];for(var a=[],i=[],o=t<n?r:e,s=Math.min(t,n),l=Math.abs(n-t)/6,u=(s-2)/6,c=Math.ceil(l/u)+1,f=[o[0],o[1]],h=l,v=2;v<s;){var g=o[v-2],y=o[v-1],b=o[v++],_=o[v++],S=o[v++],T=o[v++],C=o[v++],M=o[v++];if(h<=0){f.push(b,_,S,T,C,M);continue}for(var D=Math.min(h,c-1)+1,L=1;L<=D;L++){var k=L/D;Zl(g,b,S,C,k,a),Zl(y,_,T,M,k,i),g=a[3],y=i[3],f.push(a[1],i[1],a[2],i[2],g,y),b=a[5],_=i[5],S=a[6],T=i[6]}h-=D-1}return o===r?[f,e]:[r,f]}function YV(r,e){for(var t=r.length,n=r[t-2],a=r[t-1],i=[],o=0;o<e.length;)i[o++]=n,i[o++]=a;return i}function nAe(r,e){for(var t,n,a,i=[],o=[],s=0;s<Math.max(r.length,e.length);s++){var l=r[s],u=e[s],c=void 0,f=void 0;l?u?(t=rAe(l,u),c=t[0],f=t[1],n=c,a=f):(f=YV(a||l,l),c=l):(c=YV(n||u,u),f=u),i.push(c),o.push(f)}return[i,o]}function $V(r){for(var e=0,t=0,n=0,a=r.length,i=0,o=a-2;i<a;o=i,i+=2){var s=r[o],l=r[o+1],u=r[i],c=r[i+1],f=s*c-u*l;e+=f,t+=(s+u)*f,n+=(l+c)*f}return e===0?[r[0]||0,r[1]||0]:[t/e/3,n/e/3,e]}function aAe(r,e,t,n){for(var a=(r.length-2)/6,i=1/0,o=0,s=r.length,l=s-2,u=0;u<a;u++){for(var c=u*6,f=0,h=0;h<s;h+=2){var v=h===0?c:(c+h-2)%l+2,g=r[v]-t[0],y=r[v+1]-t[1],b=e[h]-n[0],_=e[h+1]-n[1],S=b-g,T=_-y;f+=S*S+T*T}f<i&&(i=f,o=u)}return o}function iAe(r){for(var e=[],t=r.length,n=0;n<t;n+=2)e[n]=r[t-n-2],e[n+1]=r[t-n-1];return e}function oAe(r,e,t,n){for(var a=[],i,o=0;o<r.length;o++){var s=r[o],l=e[o],u=$V(s),c=$V(l);i==null&&(i=u[2]<0!=c[2]<0);var f=[],h=[],v=0,g=1/0,y=[],b=s.length;i&&(s=iAe(s));for(var _=aAe(s,l,u,c)*6,S=b-2,T=0;T<S;T+=2){var C=(_+T)%S+2;f[T+2]=s[C]-u[0],f[T+3]=s[C+1]-u[1]}f[0]=s[_]-u[0],f[1]=s[_+1]-u[1];for(var M=n/t,D=-n/2;D<=n/2;D+=M){for(var L=Math.sin(D),k=Math.cos(D),R=0,T=0;T<s.length;T+=2){var E=f[T],I=f[T+1],z=l[T]-c[0],j=l[T+1]-c[1],G=z*k-j*L,U=z*L+j*k;y[T]=G,y[T+1]=U;var O=G-E,H=U-I;R+=O*O+H*H}if(R<g){g=R,v=D;for(var F=0;F<y.length;F++)h[F]=y[F]}}a.push({from:f,to:h,fromCp:u,toCp:c,rotation:-v})}return a}function fb(r){return r.__isCombineMorphing}var e$="__mOriginal_";function db(r,e,t){var n=e$+e,a=r[n]||r[e];r[n]||(r[n]=r[e]);var i=t.replace,o=t.after,s=t.before;r[e]=function(){var l=arguments,u;return s&&s.apply(this,l),i?u=i.apply(this,l):u=a.apply(this,l),o&&o.apply(this,l),u}}function pg(r,e){var t=e$+e;r[t]&&(r[e]=r[t],r[t]=null)}function XV(r,e){for(var t=0;t<r.length;t++)for(var n=r[t],a=0;a<n.length;){var i=n[a],o=n[a+1];n[a++]=e[0]*i+e[2]*o+e[4],n[a++]=e[1]*i+e[3]*o+e[5]}}function t$(r,e){var t=r.getUpdatedPathProxy(),n=e.getUpdatedPathProxy(),a=nAe(eD(t),eD(n)),i=a[0],o=a[1],s=r.getComputedTransform(),l=e.getComputedTransform();function u(){this.transform=null}s&&XV(i,s),l&&XV(o,l),db(e,"updateTransform",{replace:u}),e.transform=null;var c=oAe(i,o,10,Math.PI),f=[];db(e,"buildPath",{replace:function(h){for(var v=e.__morphT,g=1-v,y=[],b=0;b<c.length;b++){var _=c[b],S=_.from,T=_.to,C=_.rotation*v,M=_.fromCp,D=_.toCp,L=Math.sin(C),k=Math.cos(C);ng(y,M,D,v);for(var R=0;R<S.length;R+=2){var E=S[R],I=S[R+1],z=T[R],j=T[R+1],G=E*g+z*v,U=I*g+j*v;f[R]=G*k-U*L+y[0],f[R+1]=G*L+U*k+y[1]}var O=f[0],H=f[1];h.moveTo(O,H);for(var R=2;R<S.length;){var z=f[R++],j=f[R++],F=f[R++],$=f[R++],B=f[R++],X=f[R++];O===z&&H===j&&F===B&&$===X?h.lineTo(B,X):h.bezierCurveTo(z,j,F,$,B,X),O=B,H=X}}}})}function gk(r,e,t){if(!r||!e)return e;var n=t.done,a=t.during;t$(r,e),e.__morphT=0;function i(){pg(e,"buildPath"),pg(e,"updateTransform"),e.__morphT=-1,e.createPathProxy(),e.dirtyShape()}return e.animateTo({__morphT:1},Ie({during:function(o){e.dirtyShape(),a&&a(o)},done:function(){i(),n&&n()}},t)),e}function sAe(r,e,t,n,a,i){var o=16;r=a===t?0:Math.round(32767*(r-t)/(a-t)),e=i===n?0:Math.round(32767*(e-n)/(i-n));for(var s=0,l,u=(1<<o)/2;u>0;u/=2){var c=0,f=0;(r&u)>0&&(c=1),(e&u)>0&&(f=1),s+=u*u*(3*c^f),f===0&&(c===1&&(r=u-1-r,e=u-1-e),l=r,r=e,e=l)}return s}function hb(r){var e=1/0,t=1/0,n=-1/0,a=-1/0,i=ce(r,function(s){var l=s.getBoundingRect(),u=s.getComputedTransform(),c=l.x+l.width/2+(u?u[4]:0),f=l.y+l.height/2+(u?u[5]:0);return e=Math.min(c,e),t=Math.min(f,t),n=Math.max(c,n),a=Math.max(f,a),[c,f]}),o=ce(i,function(s,l){return{cp:s,z:sAe(s[0],s[1],e,t,n,a),path:r[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function r$(r){return tAe(r.path,r.count)}function rD(){return{fromIndividuals:[],toIndividuals:[],count:0}}function lAe(r,e,t){var n=[];function a(M){for(var D=0;D<M.length;D++){var L=M[D];fb(L)?a(L.childrenRef()):L instanceof ct&&n.push(L)}}a(r);var i=n.length;if(!i)return rD();var o=t.dividePath||r$,s=o({path:e,count:i});if(s.length!==i)return console.error("Invalid morphing: unmatched splitted path"),rD();n=hb(n),s=hb(s);for(var l=t.done,u=t.during,c=t.individualDelay,f=new ss,h=0;h<i;h++){var v=n[h],g=s[h];g.parent=e,g.copyTransform(f),c||t$(v,g)}e.__isCombineMorphing=!0,e.childrenRef=function(){return s};function y(M){for(var D=0;D<s.length;D++)s[D].addSelfToZr(M)}db(e,"addSelfToZr",{after:function(M){y(M)}}),db(e,"removeSelfFromZr",{after:function(M){for(var D=0;D<s.length;D++)s[D].removeSelfFromZr(M)}});function b(){e.__isCombineMorphing=!1,e.__morphT=-1,e.childrenRef=null,pg(e,"addSelfToZr"),pg(e,"removeSelfFromZr")}var _=s.length;if(c)for(var S=_,T=function(){S--,S===0&&(b(),l&&l())},h=0;h<_;h++){var C=c?Ie({delay:(t.delay||0)+c(h,_,n[h],s[h]),done:T},t):t;gk(n[h],s[h],C)}else e.__morphT=0,e.animateTo({__morphT:1},Ie({during:function(M){for(var D=0;D<_;D++){var L=s[D];L.__morphT=e.__morphT,L.dirtyShape()}u&&u(M)},done:function(){b();for(var M=0;M<r.length;M++)pg(r[M],"updateTransform");l&&l()}},t));return e.__zr&&y(e.__zr),{fromIndividuals:n,toIndividuals:s,count:_}}function uAe(r,e,t){var n=e.length,a=[],i=t.dividePath||r$;function o(v){for(var g=0;g<v.length;g++){var y=v[g];fb(y)?o(y.childrenRef()):y instanceof ct&&a.push(y)}}if(fb(r)){o(r.childrenRef());var s=a.length;if(s<n)for(var l=0,u=s;u<n;u++)a.push(cN(a[l++%s]));a.length=n}else{a=i({path:r,count:n});for(var c=r.getComputedTransform(),u=0;u<a.length;u++)a[u].setLocalTransform(c);if(a.length!==n)return console.error("Invalid morphing: unmatched splitted path"),rD()}a=hb(a),e=hb(e);for(var f=t.individualDelay,u=0;u<n;u++){var h=f?Ie({delay:(t.delay||0)+f(u,n,a[u],e[u])},t):t;gk(a[u],e[u],h)}return{fromIndividuals:a,toIndividuals:e,count:e.length}}function qV(r){return ue(r[0])}function ZV(r,e){for(var t=[],n=r.length,a=0;a<n;a++)t.push({one:r[a],many:[]});for(var a=0;a<e.length;a++){var i=e[a].length,o=void 0;for(o=0;o<i;o++)t[o%n].many.push(e[a][o])}for(var s=0,a=n-1;a>=0;a--)if(!t[a].many.length){var l=t[s].many;if(l.length<=1)if(s)s=0;else return t;var i=l.length,u=Math.ceil(i/2);t[a].many=l.slice(u,i),t[s].many=l.slice(0,u),s++}return t}var cAe={clone:function(r){for(var e=[],t=1-Math.pow(1-r.path.style.opacity,1/r.count),n=0;n<r.count;n++){var a=cN(r.path);a.setStyle("opacity",t),e.push(a)}return e},split:null};function fC(r,e,t,n,a,i){if(!r.length||!e.length)return;var o=jh("update",n,a);if(!(o&&o.duration>0))return;var s=n.getModel("universalTransition").get("delay"),l=Object.assign({setToFinal:!0},o),u,c;qV(r)&&(u=r,c=e),qV(e)&&(u=e,c=r);function f(_,S,T,C,M){var D=_.many,L=_.one;if(D.length===1&&!M){var k=S?D[0]:L,R=S?L:D[0];if(fb(k))f({many:[k],one:R},!0,T,C,!0);else{var E=s?Ie({delay:s(T,C)},l):l;gk(k,R,E),i(k,R,k,R,E)}}else for(var I=Ie({dividePath:cAe[t],individualDelay:s&&function(H,F,$,B){return s(H+T,C)}},l),z=S?lAe(D,L,I):uAe(L,D,I),j=z.fromIndividuals,G=z.toIndividuals,U=j.length,O=0;O<U;O++){var E=s?Ie({delay:s(O,U)},l):l;i(j[O],G[O],S?D[O]:_.one,S?_.one:D[O],E)}}for(var h=u?u===r:r.length>e.length,v=u?ZV(c,u):ZV(h?e:r,[h?r:e]),g=0,y=0;y<v.length;y++)g+=v[y].many.length;for(var b=0,y=0;y<v.length;y++)f(v[y],h,b,g),b+=v[y].many.length}function lc(r){if(!r)return[];if(ue(r)){for(var e=[],t=0;t<r.length;t++)e.push(lc(r[t]));return e}var n=[];return r.traverse(function(a){a instanceof ct&&!a.disableMorphing&&!a.invisible&&!a.ignore&&n.push(a)}),n}var n$=1e4,fAe=0,KV=1,QV=2,dAe=st();function hAe(r,e){for(var t=r.dimensions,n=0;n<t.length;n++){var a=r.getDimensionInfo(t[n]);if(a&&a.otherDims[e]===0)return t[n]}}function vAe(r,e,t){var n=r.getDimensionInfo(t),a=n&&n.ordinalMeta;if(n){var i=r.get(n.name,e);return a&&a.categories[i]||i+""}}function JV(r,e,t,n){var a=n?"itemChildGroupId":"itemGroupId",i=hAe(r,a);if(i){var o=vAe(r,e,i);return o}var s=r.getRawDataItem(e),l=n?"childGroupId":"groupId";if(s&&s[l])return s[l]+"";if(!n)return t||r.getId(e)}function eG(r){var e=[];return P(r,function(t){var n=t.data,a=t.dataGroupId;if(!(n.count()>n$))for(var i=n.getIndices(),o=0;o<i.length;o++)e.push({data:n,groupId:JV(n,o,a,!1),childGroupId:JV(n,o,a,!0),divide:t.divide,dataIndex:o})}),e}function dC(r,e,t){r.traverse(function(n){n instanceof ct&&Kt(n,{style:{opacity:0}},e,{dataIndex:t,isFrom:!0})})}function hC(r){if(r.parent){var e=r.getComputedTransform();r.setLocalTransform(e),r.parent.remove(r)}}function Ad(r){r.stopAnimation(),r.isGroup&&r.traverse(function(e){e.stopAnimation()})}function pAe(r,e,t){var n=jh("update",t,e);n&&r.traverse(function(a){if(a instanceof ni){var i=Rue(a);i&&a.animateFrom({style:i},n)}})}function gAe(r,e){var t=r.length;if(t!==e.length)return!1;for(var n=0;n<t;n++){var a=r[n],i=e[n];if(a.data.getId(a.dataIndex)!==i.data.getId(i.dataIndex))return!1}return!0}function a$(r,e,t){var n=eG(r),a=eG(e);function i(T,C,M,D,L){(M||T)&&C.animateFrom({style:M&&M!==T?oe(oe({},M.style),T.style):T.style},L)}var o=!1,s=fAe,l=Ae(),u=Ae();n.forEach(function(T){T.groupId&&l.set(T.groupId,!0),T.childGroupId&&u.set(T.childGroupId,!0)});for(var c=0;c<a.length;c++){var f=a[c].groupId;if(u.get(f)){s=KV;break}var h=a[c].childGroupId;if(h&&l.get(h)){s=QV;break}}function v(T,C){return function(M){var D=M.data,L=M.dataIndex;return C?D.getId(L):T?s===KV?M.childGroupId:M.groupId:s===QV?M.childGroupId:M.groupId}}var g=gAe(n,a),y={};if(!g)for(var c=0;c<a.length;c++){var b=a[c],_=b.data.getItemGraphicEl(b.dataIndex);_&&(y[_.id]=!0)}function S(T,C){var M=n[C],D=a[T],L=D.data.hostModel,k=M.data.getItemGraphicEl(M.dataIndex),R=D.data.getItemGraphicEl(D.dataIndex);if(k===R){R&&pAe(R,D.dataIndex,L);return}k&&y[k.id]||R&&(Ad(R),k?(Ad(k),hC(k),o=!0,fC(lc(k),lc(R),D.divide,L,T,i)):dC(R,L,T))}new Ss(n,a,v(!0,g),v(!1,g),null,"multiple").update(S).updateManyToOne(function(T,C){var M=a[T],D=M.data,L=D.hostModel,k=D.getItemGraphicEl(M.dataIndex),R=At(ce(C,function(E){return n[E].data.getItemGraphicEl(n[E].dataIndex)}),function(E){return E&&E!==k&&!y[E.id]});k&&(Ad(k),R.length?(P(R,function(E){Ad(E),hC(E)}),o=!0,fC(lc(R),lc(k),M.divide,L,T,i)):dC(k,L,M.dataIndex))}).updateOneToMany(function(T,C){var M=n[C],D=M.data.getItemGraphicEl(M.dataIndex);if(!(D&&y[D.id])){var L=At(ce(T,function(R){return a[R].data.getItemGraphicEl(a[R].dataIndex)}),function(R){return R&&R!==D}),k=a[T[0]].data.hostModel;L.length&&(P(L,function(R){return Ad(R)}),D?(Ad(D),hC(D),o=!0,fC(lc(D),lc(L),M.divide,k,T[0],i)):P(L,function(R){return dC(R,k,T[0])}))}}).updateManyToMany(function(T,C){new Ss(C,T,function(M){return n[M].data.getId(n[M].dataIndex)},function(M){return a[M].data.getId(a[M].dataIndex)}).update(function(M,D){S(T[M],C[D])}).execute()}).execute(),o&&P(e,function(T){var C=T.data,M=C.hostModel,D=M&&t.getViewOfSeriesModel(M),L=jh("update",M,0);D&&M.isAnimationEnabled()&&L&&L.duration>0&&D.group.traverse(function(k){k instanceof ct&&!k.animators.length&&k.animateFrom({style:{opacity:0}},L)})})}function tG(r){var e=r.getModel("universalTransition").get("seriesKey");return e||r.id}function rG(r){return ue(r)?r.sort().join(","):r}function xl(r){if(r.hostModel)return r.hostModel.getModel("universalTransition").get("divideShape")}function mAe(r,e){var t=Ae(),n=Ae(),a=Ae();return P(r.oldSeries,function(i,o){var s=r.oldDataGroupIds[o],l=r.oldData[o],u=tG(i),c=rG(u);n.set(c,{dataGroupId:s,data:l}),ue(u)&&P(u,function(f){a.set(f,{key:c,dataGroupId:s,data:l})})}),P(e.updatedSeries,function(i){if(i.isUniversalTransitionEnabled()&&i.isAnimationEnabled()){var o=i.get("dataGroupId"),s=i.getData(),l=tG(i),u=rG(l),c=n.get(u);if(c)t.set(u,{oldSeries:[{dataGroupId:c.dataGroupId,divide:xl(c.data),data:c.data}],newSeries:[{dataGroupId:o,divide:xl(s),data:s}]});else if(ue(l)){var f=[];P(l,function(g){var y=n.get(g);y.data&&f.push({dataGroupId:y.dataGroupId,divide:xl(y.data),data:y.data})}),f.length&&t.set(u,{oldSeries:f,newSeries:[{dataGroupId:o,data:s,divide:xl(s)}]})}else{var h=a.get(l);if(h){var v=t.get(h.key);v||(v={oldSeries:[{dataGroupId:h.dataGroupId,data:h.data,divide:xl(h.data)}],newSeries:[]},t.set(h.key,v)),v.newSeries.push({dataGroupId:o,data:s,divide:xl(s)})}}}}),t}function nG(r,e){for(var t=0;t<r.length;t++){var n=e.seriesIndex!=null&&e.seriesIndex===r[t].seriesIndex||e.seriesId!=null&&e.seriesId===r[t].id;if(n)return t}}function yAe(r,e,t,n){var a=[],i=[];P(Ht(r.from),function(o){var s=nG(e.oldSeries,o);s>=0&&a.push({dataGroupId:e.oldDataGroupIds[s],data:e.oldData[s],divide:xl(e.oldData[s]),groupIdDim:o.dimension})}),P(Ht(r.to),function(o){var s=nG(t.updatedSeries,o);if(s>=0){var l=t.updatedSeries[s].getData();i.push({dataGroupId:e.oldDataGroupIds[s],data:l,divide:xl(l),groupIdDim:o.dimension})}}),a.length>0&&i.length>0&&a$(a,i,n)}function xAe(r){r.registerUpdateLifecycle("series:beforeupdate",function(e,t,n){P(Ht(n.seriesTransition),function(a){P(Ht(a.to),function(i){for(var o=n.updatedSeries,s=0;s<o.length;s++)(i.seriesIndex!=null&&i.seriesIndex===o[s].seriesIndex||i.seriesId!=null&&i.seriesId===o[s].id)&&(o[s][zx]=!0)})})}),r.registerUpdateLifecycle("series:transition",function(e,t,n){var a=dAe(t);if(a.oldSeries&&n.updatedSeries&&n.optionChanged){var i=n.seriesTransition;if(i)P(Ht(i),function(v){yAe(v,a,n,t)});else{var o=mAe(a,n);P(o.keys(),function(v){var g=o.get(v);a$(g.oldSeries,g.newSeries,t)})}P(n.updatedSeries,function(v){v[zx]&&(v[zx]=!1)})}for(var s=e.getSeries(),l=a.oldSeries=[],u=a.oldDataGroupIds=[],c=a.oldData=[],f=0;f<s.length;f++){var h=s[f].getData();h.count()<n$&&(l.push(s[f]),u.push(s[f].get("dataGroupId")),c.push(h))}})}var bAe=(function(){function r(){this.breaks=[],this._elapsedExtent=[1/0,-1/0]}return r.prototype.setBreaks=function(e){this.breaks=e.breaks},r.prototype.update=function(e){SAe(this,e);var t=this._elapsedExtent;t[0]=this.elapse(e[0]),t[1]=this.elapse(e[1])},r.prototype.hasBreaks=function(){return!!this.breaks.length},r.prototype.calcNiceTickMultiple=function(e,t){for(var n=0;n<this.breaks.length;n++){var a=this.breaks[n];if(a.vmin<e&&e<a.vmax){var i=t(e,a.vmax);return i}}return 0},r.prototype.getExtentSpan=function(){return this._elapsedExtent[1]-this._elapsedExtent[0]},r.prototype.normalize=function(e){var t=this._elapsedExtent[1]-this._elapsedExtent[0];return t===0?.5:(this.elapse(e)-this._elapsedExtent[0])/t},r.prototype.scale=function(e){return this.unelapse(e*(this._elapsedExtent[1]-this._elapsedExtent[0])+this._elapsedExtent[0])},r.prototype.elapse=function(e){for(var t=aG,n=iG,a=!0,i=0;i<this.breaks.length;i++){var o=this.breaks[i];if(e<=o.vmax){e>o.vmin?t+=o.vmin-n+(e-o.vmin)/(o.vmax-o.vmin)*o.gapReal:t+=e-n,n=o.vmax,a=!1;break}t+=o.vmin-n+o.gapReal,n=o.vmax}return a&&(t+=e-n),t},r.prototype.unelapse=function(e){for(var t=aG,n=iG,a=!0,i=0,o=0;o<this.breaks.length;o++){var s=this.breaks[o],l=t+s.vmin-n,u=l+s.gapReal;if(e<=u){e>l?i=s.vmin+(e-l)/(u-l)*(s.vmax-s.vmin):i=n+e-t,n=s.vmax,a=!1;break}t=u,n=s.vmax}return a&&(i=n+e-t),i},r})();function _Ae(){return new bAe}var aG=0,iG=0;function SAe(r,e){var t=0,n={tpAbs:{span:0,val:0},tpPrct:{span:0,val:0}},a=function(){return{has:!1,span:NaN,inExtFrac:NaN,val:NaN}},i={S:{tpAbs:a(),tpPrct:a()},E:{tpAbs:a(),tpPrct:a()}};P(r.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(t+=l.val);var u=mk(s,e);if(u){var c=u.vmin!==s.vmin,f=u.vmax!==s.vmax,h=u.vmax-u.vmin;if(!(c&&f))if(c||f){var v=c?"S":"E";i[v][l.type].has=!0,i[v][l.type].span=h,i[v][l.type].inExtFrac=h/(s.vmax-s.vmin),i[v][l.type].val=l.val}else n[l.type].span+=h,n[l.type].val+=l.val}});var o=t*(0+(e[1]-e[0])+(n.tpAbs.val-n.tpAbs.span)+(i.S.tpAbs.has?(i.S.tpAbs.val-i.S.tpAbs.span)*i.S.tpAbs.inExtFrac:0)+(i.E.tpAbs.has?(i.E.tpAbs.val-i.E.tpAbs.span)*i.E.tpAbs.inExtFrac:0)-n.tpPrct.span-(i.S.tpPrct.has?i.S.tpPrct.span*i.S.tpPrct.inExtFrac:0)-(i.E.tpPrct.has?i.E.tpPrct.span*i.E.tpPrct.inExtFrac:0))/(1-n.tpPrct.val-(i.S.tpPrct.has?i.S.tpPrct.val*i.S.tpPrct.inExtFrac:0)-(i.E.tpPrct.has?i.E.tpPrct.val*i.E.tpPrct.inExtFrac:0));P(r.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(s.gapReal=t!==0?Math.max(o,0)*l.val/t:0),l.type==="tpAbs"&&(s.gapReal=l.val),s.gapReal==null&&(s.gapReal=0)})}function wAe(r,e,t,n,a,i){r!=="no"&&P(t,function(o){var s=mk(o,i);if(s)for(var l=e.length-1;l>=0;l--){var u=e[l],c=n(u),f=a*3/4;c>s.vmin-f&&c<s.vmax+f&&(r!=="preserve_extent_bound"||c!==i[0]&&c!==i[1])&&e.splice(l,1)}})}function TAe(r,e,t,n){P(e,function(a){var i=mk(a,t);i&&(r.push({value:i.vmin,break:{type:"vmin",parsedBreak:i},time:n?n(i):void 0}),r.push({value:i.vmax,break:{type:"vmax",parsedBreak:i},time:n?n(i):void 0}))}),e.length&&r.sort(function(a,i){return a.value-i.value})}function mk(r,e){var t=Math.max(r.vmin,e[0]),n=Math.min(r.vmax,e[1]);return t<n||t===n&&t>e[0]&&t<e[1]?{vmin:t,vmax:n,breakOption:r.breakOption,gapParsed:r.gapParsed,gapReal:r.gapReal}:null}function nD(r,e,t){var n=[];if(!r)return{breaks:n};function a(o,s){return o>=0&&o<1-1e-5}P(r,function(o){if(!(!o||o.start==null||o.end==null)&&!o.isExpanded){var s={breakOption:ke(o),vmin:e(o.start),vmax:e(o.end),gapParsed:{type:"tpAbs",val:0},gapReal:null};if(o.gap!=null){var l=!1;if(_e(o.gap)){var u=wa(o.gap);if(u.match(/%$/)){var c=parseFloat(u)/100;a(c)||(c=0),s.gapParsed.type="tpPrct",s.gapParsed.val=c,l=!0}}if(!l){var f=e(o.gap);(!isFinite(f)||f<0)&&(f=0),s.gapParsed.type="tpAbs",s.gapParsed.val=f}}if(s.vmin===s.vmax&&(s.gapParsed.type="tpAbs",s.gapParsed.val=0),t&&t.noNegative&&P(["vmin","vmax"],function(v){s[v]<0&&(s[v]=0)}),s.vmin>s.vmax){var h=s.vmax;s.vmax=s.vmin,s.vmin=h}n.push(s)}}),n.sort(function(o,s){return o.vmin-s.vmin});var i=-1/0;return P(n,function(o,s){i>o.vmin&&(n[s]=null),i=o.vmax}),{breaks:n.filter(function(o){return!!o})}}function yk(r,e){return aD(e)===aD(r)}function aD(r){return r.start+"_\0_"+r.end}function CAe(r,e,t){var n=[];P(r,function(i,o){var s=e(i);s&&s.type==="vmin"&&n.push([o])}),P(r,function(i,o){var s=e(i);if(s&&s.type==="vmax"){var l=au(n,function(u){return yk(e(r[u[0]]).parsedBreak.breakOption,s.parsedBreak.breakOption)});l&&l.push(o)}});var a=[];return P(n,function(i){i.length===2&&a.push(t?i:[r[i[0]],r[i[1]]])}),a}function AAe(r,e,t,n){var a,i;if(r.break){var o=r.break.parsedBreak,s=au(t,function(f){return yk(f.breakOption,r.break.parsedBreak.breakOption)}),l=n(Math.pow(e,o.vmin),s.vmin),u=n(Math.pow(e,o.vmax),s.vmax),c={type:o.gapParsed.type,val:o.gapParsed.type==="tpAbs"?Tr(Math.pow(e,o.vmin+o.gapParsed.val))-l:o.gapParsed.val};a={type:r.break.type,parsedBreak:{breakOption:o.breakOption,vmin:l,vmax:u,gapParsed:c,gapReal:o.gapReal}},i=s[r.break.type]}return{brkRoundingCriterion:i,vBreak:a}}function MAe(r,e,t){var n={noNegative:!0},a=nD(r,t,n),i=nD(r,t,n),o=Math.log(e);return i.breaks=ce(i.breaks,function(s){var l=Math.log(s.vmin)/o,u=Math.log(s.vmax)/o,c={type:s.gapParsed.type,val:s.gapParsed.type==="tpAbs"?Math.log(s.vmin+s.gapParsed.val)/o-l:s.gapParsed.val};return{vmin:l,vmax:u,gapParsed:c,gapReal:s.gapReal,breakOption:s.breakOption}}),{parsedOriginal:a,parsedLogged:i}}var DAe={vmin:"start",vmax:"end"};function NAe(r,e){return e&&(r=r||{},r.break={type:DAe[e.type],start:e.parsedBreak.vmin,end:e.parsedBreak.vmax}),r}function LAe(){Que({createScaleBreakContext:_Ae,pruneTicksByBreak:wAe,addBreaksToTicks:TAe,parseAxisBreakOption:nD,identifyAxisBreak:yk,serializeAxisBreakIdentifier:aD,retrieveAxisBreakPairs:CAe,getTicksLogTransformBreak:AAe,logarithmicParseBreaksFromOption:MAe,makeAxisLabelFormatterParamBreak:NAe})}var oG=st();function kAe(r,e){var t=au(r,function(n){return Rr().identifyAxisBreak(n.parsedBreak.breakOption,e.breakOption)});return t||r.push(t={zigzagRandomList:[],parsedBreak:e,shouldRemove:!1}),t}function RAe(r){P(r,function(e){return e.shouldRemove=!0})}function EAe(r){for(var e=r.length-1;e>=0;e--)r[e].shouldRemove&&r.splice(e,1)}function IAe(r,e,t,n,a){var i=t.axis;if(i.scale.isBlank()||!Rr())return;var o=Rr().retrieveAxisBreakPairs(i.scale.getTicks({breakTicks:"only_break"}),function(R){return R.break},!1);if(!o.length)return;var s=t.getModel("breakArea"),l=s.get("zigzagAmplitude"),u=s.get("zigzagMinSpan"),c=s.get("zigzagMaxSpan");u=Math.max(2,u||0),c=Math.max(u,c||0);var f=s.get("expandOnClick"),h=s.get("zigzagZ"),v=s.getModel("itemStyle"),g=v.getItemStyle(),y=g.stroke,b=g.lineWidth,_=g.lineDash,S=g.fill,T=new Re({ignoreModelZ:!0}),C=i.isHorizontal(),M=oG(e).visualList||(oG(e).visualList=[]);RAe(M);for(var D=function(R){var E=o[R][0].break.parsedBreak,I=[];I[0]=i.toGlobalCoord(i.dataToCoord(E.vmin,!0)),I[1]=i.toGlobalCoord(i.dataToCoord(E.vmax,!0)),I[1]<I[0]&&I.reverse();var z=kAe(M,E);z.shouldRemove=!1;var j=new Re;k(z.zigzagRandomList,j,I[0],I[1],C,E),f&&j.on("click",function(){var G={type:a_,breaks:[{start:E.breakOption.start,end:E.breakOption.end}]};G[i.dim+"AxisIndex"]=t.componentIndex,a.dispatchAction(G)}),j.silent=!f,T.add(j)},L=0;L<o.length;L++)D(L);r.add(T),EAe(M);function k(R,E,I,z,j,G){var U={stroke:y,lineWidth:b,lineDash:_,fill:"none"},O=j?0:1,H=1-O,F=n[Ye[H]]+n[Er[H]];function $($e){var We=[],lt=[];We[O]=lt[O]=$e,We[H]=n[Ye[H]],lt[H]=F;var vt={x1:We[0],y1:We[1],x2:lt[0],y2:lt[1]};return Fb(vt,vt,{lineWidth:1}),We[0]=vt.x1,We[1]=vt.y1,We[O]}I=$(I),z=$(z);for(var B=[],X=[],q=!0,Q=n[Ye[H]],ne=0;;ne++){var fe=Q===n[Ye[H]],ve=Q>=F;ve&&(Q=F);var Se=[],ge=[];Se[O]=I,ge[O]=z,!fe&&!ve&&(Se[O]+=q?-l:l,ge[O]-=q?l:-l),Se[H]=Q,ge[H]=Q,B.push(Se),X.push(ge);var he=void 0;if(ne<R.length?he=R[ne]:(he=Math.random(),R.push(he)),Q+=he*(c-u)+u,q=!q,ve)break}var Ne=Rr().serializeAxisBreakIdentifier(G.breakOption);if(E.add(new dn({anid:"break_a_"+Ne,shape:{points:B},style:U,z:h})),G.gapReal!==0){E.add(new dn({anid:"break_b_"+Ne,shape:{points:X},style:U,z:h}));var xe=X.slice();xe.reverse();var Te=B.concat(xe);E.add(new Cn({anid:"break_c_"+Ne,shape:{points:Te},style:{fill:S,opacity:g.opacity},z:h}))}}}function OAe(r,e,t,n){var a=r.axis,i=t.transform;wn(n.style);var o=a.getExtent();a.inverse&&(o=o.slice(),o.reverse());var s=Rr().retrieveAxisBreakPairs(a.scale.getTicks({breakTicks:"only_break"}),function(b){return b.break},!1),l=ce(s,function(b){var _=b[0].break.parsedBreak,S=[a.dataToCoord(_.vmin,!0),a.dataToCoord(_.vmax,!0)];return S[0]>S[1]&&S.reverse(),{coordPair:S,brkId:Rr().serializeAxisBreakIdentifier(_.breakOption)}});l.sort(function(b,_){return b.coordPair[0]-_.coordPair[0]});for(var u=o[0],c=null,f=0;f<l.length;f++){var h=l[f],v=Math.max(h.coordPair[0],o[0]),g=Math.min(h.coordPair[1],o[1]);u<=v&&y(u,v,c,h),u=g,c=h}u<=o[1]&&y(u,o[1],c,null);function y(b,_,S,T){function C(I,z){i&&(pr(I,I,i),pr(z,z,i))}function M(I,z){var j={x1:I[0],y1:I[1],x2:z[0],y2:z[1]};Fb(j,j,n.style),I[0]=j.x1,I[1]=j.y1,z[0]=j.x2,z[1]=j.y2}var D=[b,0],L=[_,0],k=[b,5],R=[_,5];C(D,k),M(D,k),C(L,R),M(L,R),M(D,L);var E=new Cr(oe({shape:{x1:D[0],y1:D[1],x2:L[0],y2:L[1]}},n));e.add(E),E.anid="breakLine_"+(S?S.brkId:"\0")+"_\0_"+(T?T.brkId:"\0")}}function PAe(r,e,t){if(au(t,function(S){return!S}))return;var n=new ze;if(!r_(t[0],t[1],n,{direction:-(r?e+Math.PI:e),touchThreshold:0,bidirectional:!1}))return;var a=Kr();Ms(a,a,-e);var i=ce(t,function(S){return S.transform?bi(Kr(),a,S.transform):a});function o(S){var T=t[0].localRect,C=new ze(T[Er[S]]*i[0][0],T[Er[S]]*i[0][1]);return Math.abs(C.y)<1e-5}var s=.5;if(o(0)||o(1)){var l=ce(t,function(S,T){var C=S.localRect.clone();return C.applyTransform(i[T]),C}),u=new ze;u.copy(t[0].label).add(t[1].label).scale(.5),u.transform(a);var c=n.clone().transform(a),f=l[0].x+l[1].x+(c.x>=0?l[0].width:l[1].width),h=(f+c.x)/2-u.x,v=Math.min(h,h-c.x),g=Math.max(h,h-c.x),y=g<0?g:v>0?v:0;s=(h-y)/c.x}var b=new ze,_=new ze;ze.scale(b,n,-s),ze.scale(_,n,1-s),iM(t[0],b),iM(t[1],_)}function jAe(r,e){var t={breaks:[]};return P(e.breaks,function(n){if(n){var a=au(r.get("breaks",!0),function(s){return Rr().identifyAxisBreak(s,n)});if(a){var i=e.type,o={isExpanded:!!a.isExpanded};a.isExpanded=i===a_?!0:i===C9?!1:i===A9?!a.isExpanded:a.isExpanded,t.breaks.push({start:a.start,end:a.end,isExpanded:!!a.isExpanded,old:o})}}}),t}function zAe(){Ege({adjustBreakLabelPair:PAe,buildAxisBreakLine:OAe,rectCoordBuildBreakAxis:IAe,updateModelAxisBreak:jAe})}function BAe(r){Bge(r),LAe(),zAe()}function VAe(){ome(GAe)}function GAe(r,e){P(r,function(t){if(!t.model.get(["axisLabel","inside"])){var n=HAe(t);if(n){var a=t.isHorizontal()?"height":"width",i=t.model.get(["axisLabel","margin"]);e[a]-=n[a]+i,t.position==="top"?e.y+=n.height+i:t.position==="left"&&(e.x+=n.width+i)}}})}function HAe(r){var e=r.model,t=r.scale;if(!e.get(["axisLabel","show"])||t.isBlank())return;var n,a,i=t.getExtent();t instanceof bh?a=t.count():(n=t.getTicks(),a=n.length);var o=r.getLabelModel(),s=$h(r),l,u=1;a>40&&(u=Math.ceil(a/40));for(var c=0;c<a;c+=u){var f=n?n[c]:{value:i[0]+c},h=s(f,c),v=o.getTextRect(h),g=y(v,o.get("rotate")||0);l?l.union(g):l=g}return l;function y(b,_){var S=_*Math.PI/180,T=b.width,C=b.height,M=T*Math.abs(Math.cos(S))+Math.abs(C*Math.sin(S)),D=T*Math.abs(Math.sin(S))+Math.abs(C*Math.cos(S)),L=new Be(b.x,b.y,M,D);return L}}tt([kpe]);tt([Ape]);tt([Kpe,dge,Sge,Cme,Pme,Cye,Qye,O0e,rxe,uxe,pxe,wxe,g1e,V1e,K1e,hbe,mbe,Mbe,Ibe,Wbe,Kbe,s_e,W_e]);tt(cSe);tt(OSe);tt(Q9);tt($Se);tt(zW);tt(KSe);tt(mwe);tt(Awe);tt(d2e);tt(k2e);tt(Om);tt($2e);tt(Z2e);tt(oTe);tt(vTe);tt(bTe);tt(ATe);tt(PTe);tt(tCe);tt(UY);tt(WY);tt(_Ce);tt(ZY);tt(KY);tt(CCe);tt(LCe);tt(FCe);tt(YCe);tt(xAe);tt(Yve);tt(BAe);tt(VAe);tt(Ame);const FAe=Object.freeze(Object.defineProperty({__proto__:null,Axis:si,ChartView:Pt,ComponentModel:ot,ComponentView:Ft,List:Pn,Model:ut,PRIORITY:Y7,SeriesModel:zt,color:Uoe,connect:qde,dataTool:nhe,dependencies:kde,disConnect:Zde,disconnect:eU,dispose:Kde,env:dt,extendChartView:kve,extendComponentModel:Dve,extendComponentView:Nve,extendSeriesModel:Lve,format:hve,getCoordinateSystemDimensions:Jde,getInstanceByDom:XN,getInstanceById:Qde,getMap:rhe,graphic:dve,helper:ave,init:Xde,innerDrawElementOnCanvas:UN,matrix:xoe,number:cve,parseGeoJSON:nM,parseGeoJson:nM,registerAction:Li,registerCoordinateSystem:nU,registerCustomSeries:ehe,registerLayout:aU,registerLoading:JN,registerLocale:_N,registerMap:iU,registerPostInit:tU,registerPostUpdate:rU,registerPreprocessor:ZN,registerProcessor:KN,registerTheme:qN,registerTransform:oU,registerUpdateLifecycle:t_,registerVisual:lu,setCanvasCreator:the,setPlatformAPI:GH,throttle:Jb,time:fve,use:tt,util:vve,vector:aoe,version:Lde,zrUtil:Kie,zrender:Ase},Symbol.toStringTag,{value:"Module"}));var Xo={},qo={},vC={},sG;function UAe(){return sG||(sG=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var e=1;r.default=function(){return"".concat(e++)}})(vC)),vC}var Ip={},Op={},pC={},lG;function i$(){return lG||(lG=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,r.default=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:60,a=null;return function(){for(var i=this,o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];clearTimeout(a),a=setTimeout(function(){t.apply(i,s)},n)}}})(pC)),pC}var Zo={},uG;function xk(){return uG||(uG=1,Object.defineProperty(Zo,"__esModule",{value:!0}),Zo.SizeSensorId=Zo.SensorTabIndex=Zo.SensorClassName=void 0,Zo.SizeSensorId="size-sensor-id",Zo.SensorClassName="size-sensor-object",Zo.SensorTabIndex="-1"),Zo}var cG;function WAe(){if(cG)return Op;cG=1,Object.defineProperty(Op,"__esModule",{value:!0}),Op.createSensor=void 0;var r=t(i$()),e=xk();function t(n){return n&&n.__esModule?n:{default:n}}return Op.createSensor=function(a,i){var o=void 0,s=[],l=function(){getComputedStyle(a).position==="static"&&(a.style.position="relative");var g=document.createElement("object");return g.onload=function(){g.contentDocument.defaultView.addEventListener("resize",u),u()},g.style.display="block",g.style.position="absolute",g.style.top="0",g.style.left="0",g.style.height="100%",g.style.width="100%",g.style.overflow="hidden",g.style.pointerEvents="none",g.style.zIndex="-1",g.style.opacity="0",g.setAttribute("class",e.SensorClassName),g.setAttribute("tabindex",e.SensorTabIndex),g.type="text/html",a.appendChild(g),g.data="about:blank",g},u=(0,r.default)(function(){s.forEach(function(v){v(a)})}),c=function(g){o||(o=l()),s.indexOf(g)===-1&&s.push(g)},f=function(){o&&o.parentNode&&(o.contentDocument&&o.contentDocument.defaultView.removeEventListener("resize",u),o.parentNode.removeChild(o),a.removeAttribute(e.SizeSensorId),o=void 0,s=[],i&&i())},h=function(g){var y=s.indexOf(g);y!==-1&&s.splice(y,1),s.length===0&&o&&f()};return{element:a,bind:c,destroy:f,unbind:h}},Op}var Pp={},fG;function YAe(){if(fG)return Pp;fG=1,Object.defineProperty(Pp,"__esModule",{value:!0}),Pp.createSensor=void 0;var r=xk(),e=t(i$());function t(n){return n&&n.__esModule?n:{default:n}}return Pp.createSensor=function(a,i){var o=void 0,s=[],l=(0,e.default)(function(){s.forEach(function(v){v(a)})}),u=function(){var g=new ResizeObserver(l);return g.observe(a),l(),g},c=function(g){o||(o=u()),s.indexOf(g)===-1&&s.push(g)},f=function(){o&&o.disconnect(),s=[],o=void 0,a.removeAttribute(r.SizeSensorId),i&&i()},h=function(g){var y=s.indexOf(g);y!==-1&&s.splice(y,1),s.length===0&&o&&f()};return{element:a,bind:c,destroy:f,unbind:h}},Pp}var dG;function $Ae(){if(dG)return Ip;dG=1,Object.defineProperty(Ip,"__esModule",{value:!0}),Ip.createSensor=void 0;var r=WAe(),e=YAe();return Ip.createSensor=typeof ResizeObserver<"u"?e.createSensor:r.createSensor,Ip}var hG;function XAe(){if(hG)return qo;hG=1,Object.defineProperty(qo,"__esModule",{value:!0}),qo.removeSensor=qo.getSensor=qo.Sensors=void 0;var r=n(UAe()),e=$Ae(),t=xk();function n(o){return o&&o.__esModule?o:{default:o}}var a=qo.Sensors={};function i(o){o&&a[o]&&delete a[o]}return qo.getSensor=function(s){var l=s.getAttribute(t.SizeSensorId);if(l&&a[l])return a[l];var u=(0,r.default)();s.setAttribute(t.SizeSensorId,u);var c=(0,e.createSensor)(s,function(){return i(u)});return a[u]=c,c},qo.removeSensor=function(s){var l=s.element.getAttribute(t.SizeSensorId);s.destroy(),i(l)},qo}var vG;function qAe(){if(vG)return Xo;vG=1,Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.ver=Xo.clear=Xo.bind=void 0;var r=XAe();return Xo.bind=function(t,n){var a=(0,r.getSensor)(t);return a.bind(n),function(){a.unbind(n)}},Xo.clear=function(t){var n=(0,r.getSensor)(t);(0,r.removeSensor)(n)},Xo.ver="1.0.3",Xo}var pG=qAe();function gG(r,e){var t={};return e.forEach(function(n){t[n]=r[n]}),t}function gC(r){return typeof r=="function"}function ZAe(r){return typeof r=="string"}var mC,mG;function KAe(){return mG||(mG=1,mC=function r(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,a,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(a=n;a--!==0;)if(!r(e[a],t[a]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(a=n;a--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[a]))return!1;for(a=n;a--!==0;){var o=i[a];if(!r(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}),mC}var QAe=KAe();const Md=oD(QAe);var JAe=(function(r){K(e,r);function e(t){var n=r.call(this,t)||this;return n.echarts=t.echarts,n.ele=null,n.isInitialResize=!0,n.eventHandlerRefs={},n}return e.prototype.componentDidMount=function(){this.renderNewEcharts()},e.prototype.componentDidUpdate=function(t){var n=this.props.shouldSetOption;if(!(gC(n)&&!n(t,this.props))){if(!Md(t.theme,this.props.theme)||!Md(t.opts,this.props.opts)){this.dispose(),this.renderNewEcharts();return}var a=this.getEchartsInstance();Md(t.onEvents,this.props.onEvents)||(this.unbindEvents(a),this.bindEvents(a,this.props.onEvents));var i=["option","notMerge","replaceMerge","lazyUpdate","showLoading","loadingOption"];Md(gG(this.props,i),gG(t,i))||this.updateEChartsOption(),(!Md(t.style,this.props.style)||!Md(t.className,this.props.className))&&this.resize()}},e.prototype.componentWillUnmount=function(){this.dispose()},e.prototype.initEchartsInstance=function(){return LP(this,void 0,void 0,function(){var t=this;return kP(this,function(n){return[2,new Promise(function(a){t.echarts.init(t.ele,t.props.theme,t.props.opts);var i=t.getEchartsInstance();i.on("finished",function(){var o=t.ele.clientWidth,s=t.ele.clientHeight;t.echarts.dispose(t.ele);var l=eg({width:o,height:s},t.props.opts);a(t.echarts.init(t.ele,t.props.theme,l))})})]})})},e.prototype.getEchartsInstance=function(){return this.echarts.getInstanceByDom(this.ele)},e.prototype.dispose=function(){if(this.ele){try{pG.clear(this.ele)}catch(t){console.warn(t)}this.echarts.dispose(this.ele)}},e.prototype.renderNewEcharts=function(){return LP(this,void 0,void 0,function(){var t,n,a,i,o,s,l=this;return kP(this,function(u){switch(u.label){case 0:return t=this.props,n=t.onEvents,a=t.onChartReady,i=t.autoResize,o=i===void 0?!0:i,[4,this.initEchartsInstance()];case 1:return u.sent(),s=this.updateEChartsOption(),this.bindEvents(s,n||{}),gC(a)&&a(s),this.ele&&o&&pG.bind(this.ele,function(){l.resize()}),[2]}})})},e.prototype.bindEvents=function(t,n){var a=this,i=function(s,l){if(ZAe(s)&&gC(l)){var u=function(c){l(c,t)};t.on(s,u),a.eventHandlerRefs[s]=u}};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&i(o,n[o])},e.prototype.unbindEvents=function(t){for(var n=0,a=Object.entries(this.eventHandlerRefs);n<a.length;n++){var i=a[n],o=i[0],s=i[1];t.off(o,s)}this.eventHandlerRefs={}},e.prototype.updateEChartsOption=function(){var t=this.props,n=t.option,a=t.notMerge,i=a===void 0?!1:a,o=t.replaceMerge,s=o===void 0?null:o,l=t.lazyUpdate,u=l===void 0?!1:l,c=t.showLoading,f=t.loadingOption,h=f===void 0?null:f,v=this.getEchartsInstance();return v.setOption(n,{notMerge:i,replaceMerge:s,lazyUpdate:u}),c?v.showLoading(h):v.hideLoading(),v},e.prototype.resize=function(){var t=this.getEchartsInstance();if(!this.isInitialResize)try{t.resize({width:"auto",height:"auto"})}catch(n){console.warn(n)}this.isInitialResize=!1},e.prototype.render=function(){var t=this,n=this.props,a=n.style,i=n.className,o=i===void 0?"":i;n.echarts,n.option,n.theme,n.notMerge,n.replaceMerge,n.lazyUpdate,n.showLoading,n.loadingOption,n.opts,n.onChartReady,n.onEvents,n.shouldSetOption,n.autoResize;var s=Eie(n,["style","className","echarts","option","theme","notMerge","replaceMerge","lazyUpdate","showLoading","loadingOption","opts","onChartReady","onEvents","shouldSetOption","autoResize"]),l=eg({height:300},a);return GG.createElement("div",eg({ref:function(u){t.ele=u},style:l,className:"echarts-for-react ".concat(o)},s))},e})(Y.PureComponent),eMe=(function(r){K(e,r);function e(t){var n=r.call(this,t)||this;return n.echarts=FAe,n}return e})(JAe);function tMe({thisYear:r,lastYear:e}){const t=Array.from({length:52},(o,s)=>{const l=r.find(u=>u.week===s+1);return(l==null?void 0:l.count)??null}),n=Array.from({length:52},(o,s)=>{const l=e.find(u=>u.week===s+1);return(l==null?void 0:l.count)??null}),a=Array.from({length:52},(o,s)=>`${s+1}주`),i={animation:!0,grid:{top:8,right:8,bottom:24,left:36},xAxis:{type:"category",data:a,axisLabel:{interval:3,formatter:(o,s)=>{const u=[0,4,8,13,17,21,26,30,34,39,43,47].indexOf(s);return u>=0?`${u+1}월`:""},fontSize:10,color:"#999"},axisTick:{show:!1},axisLine:{show:!1},splitLine:{show:!0,interval:(o,s)=>["1주","5주","9주","14주","18주","22주","27주","31주","35주","40주","44주","48주"].includes(s),lineStyle:{color:"#e5e7eb",width:1}}},yAxis:{type:"value",axisLabel:{fontSize:10,color:"#999"},splitLine:{lineStyle:{color:"#f3f4f6"}},minInterval:1},series:[{name:"올해",type:"line",data:t,smooth:!0,symbol:"none",connectNulls:!1,lineStyle:{width:2.5,color:"hsl(var(--primary))"},itemStyle:{color:"hsl(var(--primary))"},emphasis:{focus:"none",lineStyle:{width:2.5,opacity:1}},blur:{lineStyle:{opacity:1,width:2.5}}},{name:"작년",type:"line",data:n,smooth:!0,symbol:"none",connectNulls:!1,lineStyle:{width:1.5,color:"#999",type:"dashed"},itemStyle:{color:"#999"},emphasis:{focus:"none",lineStyle:{width:1.5,opacity:1}},blur:{lineStyle:{opacity:1,width:1.5}}}],tooltip:{trigger:"axis",formatter:o=>{var u;const s=(((u=o[0])==null?void 0:u.dataIndex)??0)+1,l=o.filter(c=>c.value!=null).map(c=>`${c.seriesName}: ${c.value}건`).join("<br/>");return`${s}주차<br/>${l}`}},legend:{show:!1}};return m.jsx(eMe,{option:i,style:{height:160}})}function rMe(){const{data:r}=vb(),{data:e}=$G(),{data:t}=TZ(),{data:n}=wZ(),{data:a,isLoading:i}=qG(),{syncing:o,syncResult:s,handleSync:l}=KG(),u=(e==null?void 0:e.settlement)??[],c={};return m.jsx(Cae,{byStatus:c,totalOrders:(e==null?void 0:e.totalOrders)??0,totalRevenue:(e==null?void 0:e.totalRevenue)??0,recentActivity:[],channels:(r==null?void 0:r.channels)??[],periodStats:t,weeklyStats:n,settlement:u,totalImportedOrders:e==null?void 0:e.totalOrders,totalImportedRevenue:e==null?void 0:e.totalRevenue,catalog:a,catalogLoading:i,syncing:o,syncResult:s,onSync:l,actionNeeded:0,WeeklyLineChartComponent:tMe})}function nMe(){const[r,e]=Y.useState(""),[t,n]=Y.useState(""),a=Y.useMemo(()=>{const u={};return r&&(u.from=r),t&&(u.to=t),Object.keys(u).length>0?u:void 0},[r,t]),{data:i,isLoading:o,error:s}=qG(a),{data:l}=XG();return m.jsx(_ae,{catalog:(i==null?void 0:i.catalog)??[],unmappedCount:(i==null?void 0:i.unmappedCount)??0,byCategory:(i==null?void 0:i.byCategory)??[],byLine:(i==null?void 0:i.byLine)??[],feeDefaults:(l==null?void 0:l.defaults)??{},isLoading:o,error:s,dateFrom:r,dateTo:t,onDateChange:(u,c)=>{e(u),n(c)}})}function aMe(r){if(!r.startedAt)return"";const t=(r.endedAt??Date.now())-r.startedAt;return t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`}function iMe({status:r}){return r==="pending"?m.jsx("span",{className:"w-4 h-4 rounded-full border-2 border-muted-foreground/40 flex-shrink-0"}):r==="running"?m.jsx("span",{className:"w-4 h-4 flex-shrink-0 flex items-center justify-center",children:m.jsx("span",{className:"w-3.5 h-3.5 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):r==="completed"?m.jsx("span",{className:"w-4 h-4 rounded-full bg-green-500/15 flex-shrink-0 flex items-center justify-center",children:m.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:m.jsx("path",{d:"M2 5l2.5 2.5L8 3",stroke:"#22c55e",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}):m.jsx("span",{className:"w-4 h-4 rounded-full bg-red-500/15 flex-shrink-0 flex items-center justify-center",children:m.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:m.jsx("path",{d:"M3 3l4 4M7 3l-4 4",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round"})})})}function oMe({session:r}){if(!r)return m.jsx("div",{className:"bg-card border border-border rounded-xl flex items-center justify-center min-h-[120px]",children:m.jsx("p",{className:"text-[13px] text-muted-foreground",children:"세션을 선택하세요"})});const e=r.tasks.length>0?"태스크":"출력";return m.jsxs("div",{className:"bg-card border border-border rounded-xl overflow-hidden",children:[m.jsxs("div",{className:"px-4 py-2.5 border-b border-border flex items-center gap-2",children:[m.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:e}),m.jsx("span",{className:"font-mono text-[11px] text-foreground/70 truncate",children:r.command.replace(/^sppt\s+/,"")})]}),r.tasks.length>0?m.jsx("ul",{className:"divide-y divide-border",children:r.tasks.map(t=>m.jsxs("li",{className:"flex items-center gap-3 px-4 py-2.5",children:[m.jsx(iMe,{status:t.status}),m.jsx("span",{className:"text-[12px] flex-1 truncate",children:t.name}),t.detail&&m.jsx("span",{className:"text-[11px] text-muted-foreground truncate max-w-[120px]",children:t.detail}),t.startedAt&&m.jsx("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:aMe(t)})]},t.id))}):r.output?m.jsx("pre",{className:"px-4 py-3 text-[12px] leading-relaxed text-foreground/80 whitespace-pre-wrap font-mono overflow-x-auto",children:r.output}):m.jsx("div",{className:"flex items-center justify-center py-8",children:m.jsx("p",{className:"text-[12px] text-muted-foreground",children:"출력 없음"})})]})}function sMe({sessions:r,selectedId:e,onSelect:t}){return r.length===0?m.jsx("div",{className:"bg-card border border-border rounded-xl flex items-center justify-center p-4",children:m.jsxs("p",{className:"text-[12px] text-muted-foreground text-center",children:["CLI 커맨드를 실행하면",m.jsx("br",{}),"여기에 표시됩니다"]})}):m.jsxs("div",{className:"bg-card border border-border rounded-xl overflow-hidden flex flex-col max-h-[70vh]",children:[m.jsx("div",{className:"px-3 py-2 border-b border-border flex-shrink-0",children:m.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"세션"})}),m.jsx("ul",{className:"overflow-y-auto flex-1",children:r.map(n=>{const a=n.tasks.filter(u=>u.status==="completed").length,i=n.tasks.length,o=n.tasks.some(u=>u.status==="running"),s=n.id===e,l=kD(new Date(n.createdAt),{addSuffix:!0,locale:Ab});return m.jsx("li",{children:m.jsxs("button",{type:"button",onClick:()=>t(n.id),className:["w-full text-left pl-2 pr-3 py-2.5 hover:bg-muted/60 transition-colors border-b border-border last:border-b-0",s?"bg-muted":""].join(" "),children:[m.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[m.jsx("span",{className:["w-1.5 h-1.5 rounded-full flex-shrink-0",o?"bg-green-500 animate-pulse":"bg-muted-foreground/40"].join(" ")}),m.jsx("span",{className:"text-[12px] font-medium truncate flex-1 font-mono",children:n.command.replace(/^sppt\s+/,"")})]}),m.jsxs("div",{className:"flex items-center justify-between pl-2",children:[m.jsx("span",{className:"text-[11px] text-muted-foreground",children:i>0?`${a}/${i} 완료`:"태스크 없음"}),m.jsx("span",{className:"text-[10px] text-muted-foreground",children:l})]})]})},n.id)})})]})}function lMe(){const r=window.location.hash.slice(1),e=r.includes("?")?r.split("?")[1]:"";return new URLSearchParams(e).get("id")}function uMe(){const{data:r=[]}=hZ(),[e,t]=Y.useState(lMe),n=Y.useCallback(i=>{t(i);const o=window.location.hash.split("?")[0];window.history.replaceState(null,"",`${o}?id=${i}`)},[]);Y.useEffect(()=>{r.length>0&&!e&&n(r[0].id)},[r,e,n]);const a=r.find(i=>i.id===e)??null;return m.jsxs("div",{children:[m.jsx("div",{className:"flex items-center justify-between mb-6",children:m.jsx("h2",{className:"text-xl font-medium",children:"Session"})}),m.jsxs("div",{className:"grid grid-cols-[260px_1fr] gap-4 mb-8",children:[m.jsx(sMe,{sessions:r,selectedId:e,onSelect:n}),m.jsx(oMe,{session:a})]})]})}async function cMe(r){const e=new URLSearchParams({channel:r.channel,from:r.from,to:r.to,limit:String(r.limit)}),t=await fetch(`/api/orders?${e}`);if(!t.ok)throw new Error(`orders API failed: ${t.status}`);return t.json()}function fMe({channel:r,dateFrom:e,dateTo:t}){return m.jsx(Bae,{channel:r,dateFrom:e,dateTo:t,fetchOrders:cMe})}async function dMe(r){const e=await fetch(`/api/settlement/coupang/monthly?yearMonth=${r}`);if(!e.ok)throw new Error(`coupang monthly API failed: ${e.status}`);return e.json()}async function hMe(r,e){const t=new URLSearchParams({from:r,to:e}),n=await fetch(`/api/settlement/coupang/reconcile?${t}`);if(!n.ok)throw new Error(`coupang reconcile API failed: ${n.status}`);return n.json()}function vMe({dateFrom:r,dateTo:e}){return m.jsx(Uae,{dateFrom:r,dateTo:e,fetchMonthly:dMe,fetchReconcile:hMe})}async function pMe(r){const e=new URLSearchParams({channel:r.channel,from:r.from,to:r.to,limit:String(r.limit)}),t=await fetch(`/api/orders?${e}`);if(!t.ok)throw new Error(`orders API failed: ${t.status}`);return t.json()}async function gMe(r,e){const t=new URLSearchParams({orderId:r,payDate:e}),n=await fetch(`/api/settlement/smartstore/order?${t}`);if(!n.ok)throw new Error(`smartstore order settlement API failed: ${n.status}`);return n.json()}function mMe({dateFrom:r,dateTo:e}){return m.jsx(Gae,{dateFrom:r,dateTo:e,fetchOrders:pMe,fetchOrderSettlement:gMe})}function yMe(){var S,T;const[r,e]=Y.useState(""),[t,n]=Y.useState(""),a=!!r||!!t,{data:i,isLoading:o}=$G(a?{from:r,to:t}:void 0),{data:s}=XG(),{data:l=[],isLoading:u}=gZ(r||void 0,t||void 0),{data:c}=vb(),f=((S=c==null?void 0:c.channels)==null?void 0:S.some(C=>C.channel==="smartstore"&&C.connected))??!1,h=((T=c==null?void 0:c.channels)==null?void 0:T.some(C=>C.channel==="coupang"&&C.connected))??!1,{data:v}=mZ(r||new Date(Date.now()-720*60*60*1e3).toISOString().slice(0,10),t||new Date().toISOString().slice(0,10),f),g=(i==null?void 0:i.settlement)??[],y=(i==null?void 0:i.totalRevenue)??0,b=(i==null?void 0:i.netRevenue)??0,_=(i==null?void 0:i.totalOrders)??0;return m.jsx(aae,{channels:g,totalRevenue:y,netRevenue:b,totalOrders:_,rules:(s==null?void 0:s.rules)??[],defaults:(s==null?void 0:s.defaults)??{},depositSchedule:l,isLoading:o,scheduleLoading:u,estimationNote:"orders.jsonl 기반 추정값",dateFrom:r,dateTo:t,onDateChange:(C,M)=>{e(C),n(M)},ssDaily:v??null,coupangConnected:h,annualRevenue:(s==null?void 0:s.annualRevenue)??null,quickSettlement:(s==null?void 0:s.quickSettlement)??!1,renderExpandedPanel:(C,M,D)=>C==="smartstore"?m.jsx(mMe,{dateFrom:M,dateTo:D}):C==="coupang"&&h?m.jsx(vMe,{dateFrom:M,dateTo:D}):m.jsx(fMe,{channel:C,dateFrom:M,dateTo:D}),onOpenConfig:(C,M)=>{CP(C==="annualRevenue"?{type:"annualRevenue"}:{type:"channel",channel:M??""})}})}function xMe({trendPoints:r,direction:e}){const[t,n]=Y.useState(null);if(!r||r.length<2)return m.jsx("span",{className:"inline-block w-[50px] h-[24px]"});const a=50,i=24,o=2,s=r.map(b=>b.ratio),l=Math.min(...s),c=Math.max(...s)-l||1,f=r.map((b,_)=>({x:o+_/(r.length-1)*(a-o*2),y:i-o-(b.ratio-l)/c*(i-o*2),period:b.period,ratio:b.ratio})),h=f.map(b=>`${b.x},${b.y}`).join(" "),v=e==="상승"?"#22c55e":e==="하락"?"#ef4444":"#94a3b8",g=f.map((b,_)=>{const S=_>0?(f[_-1].x+b.x)/2:0,T=_<f.length-1?(b.x+f[_+1].x)/2:a;return{x:S,width:T-S}}),y=t!==null?f[t]:null;return m.jsxs("svg",{width:a,height:i,viewBox:`0 0 ${a} ${i}`,className:"inline-block overflow-visible","aria-hidden":"true",children:[m.jsx("polyline",{points:h,fill:"none",stroke:v,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),y&&m.jsxs(m.Fragment,{children:[m.jsx("line",{x1:y.x,y1:0,x2:y.x,y2:i,stroke:v,strokeWidth:1,strokeDasharray:"2 2",strokeOpacity:.5}),m.jsx("circle",{cx:y.x,cy:y.y,r:2.5,fill:v,stroke:"white",strokeWidth:1})]}),g.map((b,_)=>m.jsx(us,{side:"top",content:m.jsxs("span",{children:[m.jsx("span",{className:"font-medium",children:f[_].period}),m.jsx("br",{}),"상대 검색량 ",m.jsx("span",{className:"font-semibold",children:Math.round(f[_].ratio)}),m.jsx("span",{className:"opacity-60",children:" / 100"})]}),children:m.jsx("rect",{x:b.x,y:0,width:b.width,height:i,fill:"transparent",stroke:"none",className:"cursor-default",onMouseEnter:()=>n(_),onMouseLeave:()=>n(null)})},f[_].period))]})}const bMe={낮음:"bg-green-500/15 text-green-600",보통:"bg-yellow-500/15 text-yellow-600",높음:"bg-orange-500/15 text-orange-600",매우높음:"bg-red-500/15 text-red-600"},_Me={상승:{icon:"↑",cls:"text-green-500"},하락:{icon:"↓",cls:"text-red-500"},보합:{icon:"→",cls:"text-muted-foreground"}};function yG(r){return r==null?"—":r.toLocaleString("ko-KR")}function yx(r){return r==null?"—":`${r.toLocaleString("ko-KR")}원`}function SMe(r,e,t,n){const a=(e+t)/2,i=Math.max(n,t);return r<=a?{dot:"🟢",label:"신규진입 가능 — 하위 ~20%, 리뷰 없어도 경쟁 가능",cls:"text-green-600 font-semibold"}:r<=i?{dot:"🟡",label:"판매 가능 — 시장 평균 이하, 경쟁력 있음",cls:"text-yellow-600 font-medium"}:{dot:"🔴",label:"판매 어려움 — 시장가 초과",cls:"text-red-500"}}function wMe(r){var n;const e=new Set,t=[];for(const a of r)for(const i of((n=a.analysis.marginAnalysis)==null?void 0:n.platforms)??[])e.has(i.platform)||(e.add(i.platform),t.push(i.platform));return t}function TMe({entries:r}){const e=wMe(r),t=e.length>0;return m.jsx("div",{className:"overflow-x-auto rounded-xl border border-border",children:m.jsxs("table",{className:"w-full text-[12px] border-collapse",children:[m.jsxs("thead",{children:[m.jsxs("tr",{className:"border-b border-border bg-muted/40",children:[m.jsx(xx,{align:"left",children:"키워드"}),m.jsx(xx,{align:"left",children:"소싱 채널"}),m.jsx(jp,{tip:"도매 소싱가",children:"소싱가"}),m.jsxs(jp,{tip:"네이버쇼핑 검색결과 기준. 중앙값은 저가 잡상품에 왜곡될 수 있어, avg가 중앙값보다 높으면 avg를 함께 표시합니다.",children:["시장판매가",m.jsx("br",{}),m.jsx("span",{className:"font-normal text-[10px] opacity-60",children:"(중앙값 / avg)"})]}),m.jsxs(jp,{tip:"네이버쇼핑 기준 해당 키워드 검색 시 노출되는 경쟁 상품 수",children:["경쟁상품수",m.jsx("br",{}),m.jsx("span",{className:"font-normal text-[10px] opacity-60",children:"(네이버쇼핑)"})]}),m.jsxs(jp,{tip:"최근 1개월 네이버 검색량 (PC+모바일)",children:["월검색량",m.jsx("br",{}),m.jsx("span",{className:"font-normal text-[10px] opacity-60",children:"(트렌드)"})]}),m.jsx(xx,{children:"경쟁도"}),t&&m.jsxs(jp,{colSpan:e.length,tip:"소싱가 기준 플랫폼 수수료 포함, 각 마진율 달성 최소판매가. 30% * = 세전 최소기준선(≈×1.7). 🟢 신규진입 가능(하위~20%) 🟡 판매 가능(시장 평균↓) 🔴 판매 어려움(시장가 초과)",children:["채널별 최소판매가",m.jsx("br",{}),m.jsx("span",{className:"font-normal text-[10px] opacity-60",children:"(수수료 포함, 5·10·20·30% * 기준)"})]}),m.jsx(xx,{children:"검토"})]}),t&&m.jsxs("tr",{className:"border-b border-border bg-muted/20",children:[Array.from({length:7}).map((n,a)=>m.jsx("td",{},a)),e.map(n=>m.jsx("td",{className:"px-3 py-1 text-center text-[10px] text-muted-foreground font-medium border-l border-border",children:n},n)),m.jsx("td",{})]})]}),m.jsx("tbody",{className:"bg-white dark:bg-card",children:r.map((n,a)=>{const{analysis:i,keyword:o,productName:s,sourceChannel:l,sourcingPrice:u,savedAt:c}=n,{demand:f,marginAnalysis:h,price:v,competitionLevel:g,totalListings:y}=i,b=kD(new Date(c),{addSuffix:!0,locale:Ab}),_=(f==null?void 0:f.trendDirection)??null,S=_?_Me[_]:null,T=f==null?void 0:f.monthlyTotal,C=u&&v.median>0?Math.round((v.median-u)/u*100):null,M=new Map((h==null?void 0:h.platforms.map(L=>[L.platform,L]))??[]),D=v.avg>v.median*1.5;return m.jsxs("tr",{className:["border-b border-border/60 hover:bg-blue-50/40 dark:hover:bg-muted/20 transition-colors",a%2!==0?"bg-gray-50/60 dark:bg-muted/5":""].join(" "),children:[m.jsxs("td",{className:"px-3 py-2.5 max-w-[140px]",children:[m.jsx("div",{className:"font-semibold truncate",children:o}),s&&m.jsx("div",{className:"text-[10px] text-muted-foreground truncate mt-0.5",children:s})]}),m.jsx("td",{className:"px-3 py-2.5 text-center whitespace-nowrap",children:l??"—"}),m.jsx("td",{className:"px-3 py-2.5 text-right whitespace-nowrap",children:u?m.jsx("span",{className:"font-medium",children:yx(u)}):m.jsx("span",{className:"text-muted-foreground",children:"—"})}),m.jsxs("td",{className:"px-3 py-2.5 text-right whitespace-nowrap",children:[m.jsxs("div",{className:"flex items-baseline justify-end gap-1",children:[m.jsx("span",{className:"font-medium",children:yx(v.median)}),C!=null&&m.jsx(us,{content:`소싱가 대비 ${C>=0?"+":""}${C}%`,children:m.jsxs("span",{className:["text-[10px] cursor-default",C>=0?"text-green-500":"text-red-500"].join(" "),children:[C>=0?"+":"",C,"%"]})})]}),D&&m.jsx(us,{content:"평균가 — 중앙값이 저가 잡상품에 왜곡된 경우 이 값이 실거래 기준이 됩니다. 티어 판정(🟢🟡🔴)에 사용됩니다.",children:m.jsxs("div",{className:"text-[10px] text-blue-500 mt-0.5 cursor-default",children:["avg ",yx(v.avg)]})})]}),m.jsxs("td",{className:"px-3 py-2.5 text-right whitespace-nowrap",children:[yG(y),"개"]}),m.jsx("td",{className:"px-3 py-2.5 whitespace-nowrap",children:T!=null?m.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[m.jsxs("span",{children:[yG(T),"회"]}),S&&m.jsx("span",{className:["font-medium text-[10px]",S.cls].join(" "),children:S.icon}),f&&f.trendPoints.length>=2&&m.jsx(xMe,{trendPoints:f.trendPoints,direction:_})]}):m.jsx("span",{className:"text-muted-foreground float-right",children:"—"})}),m.jsx("td",{className:"px-3 py-2.5 text-center",children:m.jsx("span",{className:["text-[10px] font-semibold px-2 py-0.5 rounded-full whitespace-nowrap",bMe[g]??"bg-muted text-muted-foreground"].join(" "),children:g})}),e.map(L=>{const k=M.get(L),R=k&&(k.sell5||k.sell10||k.sell20||k.sell30),E=R?[{label:"5%",sell:k.sell5||null,isMin:!1},{label:"10%",sell:k.sell10||null,isMin:!1},{label:"20%",sell:k.sell20||null,isMin:!1},{label:"30% *",sell:k.sell30||null,isMin:!0}]:[];return m.jsx("td",{className:"px-3 py-2 border-l border-border/40 align-top",children:R?m.jsx("div",{className:"flex flex-col gap-0.5",children:E.map(({label:I,sell:z,isMin:j})=>{if(z==null)return null;const G=SMe(z,v.min,v.median,v.avg);return m.jsx(us,{content:j?`[최소기준선] ${G.label}`:G.label,children:m.jsxs("div",{className:["flex items-center justify-between gap-1.5 text-[11px] cursor-default",j?"font-semibold":""].join(" "),children:[m.jsx("span",{className:["w-10 shrink-0 whitespace-nowrap",j?"text-foreground/70":"text-muted-foreground"].join(" "),children:I}),m.jsx("span",{className:[G.cls,"whitespace-nowrap"].join(" "),children:yx(z)}),m.jsx("span",{children:G.dot})]})},I)})}):m.jsx("span",{className:"text-muted-foreground",children:"—"})},L)}),m.jsx("td",{className:"px-3 py-2.5 text-right whitespace-nowrap text-muted-foreground",children:b})]},n.id)})})]})})}function xx({children:r,align:e="center",colSpan:t}){return m.jsx("th",{colSpan:t,className:["px-3 py-2 text-[11px] font-semibold text-muted-foreground leading-tight whitespace-nowrap",e==="left"?"text-left":e==="right"?"text-right":"text-center"].join(" "),children:r})}function jp({children:r,tip:e,align:t="center",colSpan:n}){return m.jsx("th",{colSpan:n,className:["px-3 py-2 text-[11px] font-semibold text-muted-foreground leading-tight whitespace-nowrap",t==="left"?"text-left":t==="right"?"text-right":"text-center"].join(" "),children:m.jsx(us,{content:e,children:m.jsx("span",{className:"cursor-help underline decoration-dotted decoration-muted-foreground/40",children:r})})})}const zp=20;function CMe(r){var l;const e=(l=r.analysis.marginAnalysis)==null?void 0:l.platforms;if(!(e!=null&&e.length))return"🔴";const{min:t,median:n,avg:a}=r.analysis.price,i=(t+n)/2,o=Math.max(a,n);let s="🔴";for(const u of e){const c=u.sell30;if(c){if(c<=i)return"🟢";c<=o&&s!=="🟢"&&(s="🟡")}}return s}function AMe(r,e){return e?r.filter(t=>CMe(t)===e):r}const MMe={domeggook:"도매꾹",specialoffer:"특가몰",cjdropshipping:"CJ Dropshipping"};function DMe({channel:r,connected:e,rateLimit:t,dailyLimit:n}){const a=MMe[r]??r;return m.jsxs("div",{className:"flex items-center gap-3 py-3 border-b border-border/60 last:border-0",children:[m.jsx("span",{className:zr("w-2 h-2 rounded-full shrink-0",e?"bg-green-500":"bg-muted-foreground/30")}),m.jsx("span",{className:"text-[13px] font-medium",children:a}),e?m.jsxs("div",{className:"ml-auto flex gap-3 text-[11px] text-muted-foreground",children:[m.jsxs("span",{children:[t," rps"]}),n&&m.jsxs("span",{children:["일 ",n.toLocaleString(),"회"]}),m.jsx("span",{className:"text-green-600 font-medium",children:"연결됨"})]}):m.jsxs("div",{className:"ml-auto text-[11px] text-muted-foreground",children:["미연결 · ",m.jsx("code",{className:"font-mono",children:"sppt init"})]})]})}function NMe(){const{data:r}=vb(),{data:e=[],refetch:t,isFetching:n}=vZ(),{data:a=[]}=pZ(),[i,o]=Y.useState(1),[s,l]=Y.useState(null),u=(r==null?void 0:r.sourceChannels)??[],c=u.filter(b=>b.connected).length,f=AMe(e,s),h=Math.max(1,Math.ceil(f.length/zp)),v=Math.min(i,h),g=f.slice((v-1)*zp,v*zp);function y(b){l(_=>_===b?null:b),o(1)}return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center justify-between mb-6",children:[m.jsx("h2",{className:"text-xl font-medium",children:"소싱 채널"}),m.jsxs("div",{className:"text-[12px] text-muted-foreground",children:[c,"/",u.length," 연결됨"]})]}),m.jsxs("div",{className:"border border-border rounded-lg px-4 py-1 mb-8",children:[u.map(b=>m.jsx(DMe,{channel:b.channel,connected:b.connected,rateLimit:b.rateLimit,dailyLimit:b.dailyLimit},b.channel)),u.length===0&&m.jsx("div",{className:"py-4 text-center text-[12px] text-muted-foreground",children:"로딩 중..."})]}),m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(Sg,{size:13,className:"text-muted-foreground"}),m.jsx("span",{className:"text-[13px] font-semibold text-muted-foreground",children:"소싱 검토 이력"}),e.length>0&&m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[s?`${f.length} / `:"",e.length,"건"]}),e.length>0&&m.jsx("div",{className:"flex items-center gap-1 ml-2",children:["🟢","🟡","🔴"].map(b=>m.jsx("button",{type:"button",onClick:()=>y(b),className:zr("px-2 py-0.5 rounded-full text-[11px] border transition-colors",s===b?"border-foreground/50 bg-muted text-foreground font-medium":"border-border text-muted-foreground hover:border-foreground/30"),children:b},b))}),m.jsxs("button",{type:"button",onClick:()=>t(),className:zr("ml-auto flex items-center gap-1 text-[11px] border border-border rounded px-2 py-1 hover:border-foreground/40 transition-colors",n&&"opacity-50 pointer-events-none"),children:[m.jsx(_x,{size:10,className:zr(n&&"animate-spin")}),"새로고침"]})]}),e.length===0||f.length===0?m.jsxs("div",{className:"border border-dashed border-border rounded-lg p-10 text-center text-muted-foreground text-sm",children:[m.jsx(Pl,{size:24,className:"mx-auto mb-3 opacity-30"}),e.length===0?"소싱 상품 시장 분석 이력이 없습니다.":`${s} 해당 항목이 없습니다.`,m.jsxs("div",{className:"mt-3 space-y-1",children:[m.jsx("code",{className:"block bg-muted rounded px-2 py-1 text-[11px] text-foreground font-mono",children:"sppt source market-check <keyword>"}),m.jsx("code",{className:"block bg-muted rounded px-2 py-1 text-[11px] text-foreground font-mono",children:"sppt source detail <id> --market-check"})]})]}):m.jsxs(m.Fragment,{children:[m.jsx(TMe,{entries:g}),h>1&&m.jsxs("div",{className:"flex items-center justify-between mt-3 text-[12px] text-muted-foreground",children:[m.jsxs("span",{children:[(v-1)*zp+1,"–",Math.min(v*zp,f.length)," ","/ ",f.length,"건"]}),m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("button",{type:"button",onClick:()=>o(b=>Math.max(1,b-1)),disabled:v===1,className:"p-1 rounded hover:bg-muted disabled:opacity-30 disabled:pointer-events-none",children:m.jsx(CD,{size:14})}),Array.from({length:h},(b,_)=>_+1).map(b=>m.jsx("button",{type:"button",onClick:()=>o(b),className:zr("w-6 h-6 rounded text-[11px] hover:bg-muted",b===v&&"bg-muted font-semibold text-foreground"),children:b},b)),m.jsx("button",{type:"button",onClick:()=>o(b=>Math.min(h,b+1)),disabled:v===h,className:"p-1 rounded hover:bg-muted disabled:opacity-30 disabled:pointer-events-none",children:m.jsx(qr,{size:14})})]})]})]})]}),a.length>0&&m.jsxs("div",{className:"mt-8",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(Eee,{size:13,className:"text-muted-foreground"}),m.jsx("span",{className:"text-[13px] font-semibold text-muted-foreground",children:"공급처 검증 이력"}),m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[a.length,"건"]})]}),m.jsx("div",{className:"border border-border rounded-lg overflow-hidden",children:m.jsxs("table",{className:"w-full text-[12px] border-collapse",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border bg-muted/40 text-[11px] font-semibold text-muted-foreground",children:[m.jsx("th",{className:"px-3 py-2 text-left",children:"공급처"}),m.jsx("th",{className:"px-3 py-2 text-center",children:"채널"}),m.jsx("th",{className:"px-3 py-2 text-center",children:"판정"}),m.jsx("th",{className:"px-3 py-2 text-center",children:"재고(평균)"}),m.jsx("th",{className:"px-3 py-2 text-center",children:"품절율"}),m.jsx("th",{className:"px-3 py-2 text-center",children:"즉시출고"}),m.jsx("th",{className:"px-3 py-2 text-center",children:"자동검증"}),m.jsx("th",{className:"px-3 py-2 text-right",children:"검토"})]})}),m.jsx("tbody",{children:a.map((b,_)=>m.jsxs("tr",{className:zr("border-b border-border/60",_%2!==0&&"bg-muted/5"),children:[m.jsxs("td",{className:"px-3 py-2",children:[m.jsx("div",{className:"font-medium",children:b.supplierNick??b.productId}),b.isPowerSeller&&m.jsx("span",{className:"text-[10px] text-blue-500",children:"파워셀러"}),b.isGoodSeller&&m.jsx("span",{className:"text-[10px] text-green-500 ml-1",children:"우수셀러"})]}),m.jsx("td",{className:"px-3 py-2 text-center text-muted-foreground",children:b.channel}),m.jsx("td",{className:"px-3 py-2 text-center text-base",children:b.tier}),m.jsx("td",{className:"px-3 py-2 text-center",children:b.avgStock!==void 0?m.jsxs("span",{className:b.avgStock>=30?"text-green-600":"text-red-500",children:[b.avgStock,"개"]}):"—"}),m.jsx("td",{className:"px-3 py-2 text-center",children:b.outOfStockRatioPct!==void 0?m.jsxs("span",{className:b.outOfStockRatioPct<30?"text-green-600":"text-red-500",children:[b.outOfStockRatioPct,"%"]}):"—"}),m.jsx("td",{className:"px-3 py-2 text-center",children:b.immediateShipPct!==void 0?m.jsxs("span",{className:b.immediateShipPct>=50?"text-green-600":"text-yellow-600",children:[b.immediateShipPct,"%"]}):"—"}),m.jsxs("td",{className:"px-3 py-2 text-center text-muted-foreground",children:[b.autoPassCount,"/",b.autoTotalCount]}),m.jsx("td",{className:"px-3 py-2 text-right text-muted-foreground whitespace-nowrap",children:kD(new Date(b.savedAt),{addSuffix:!0,locale:Ab})})]},b.id))})]})})]})]})}const LMe=[{id:"musinsa",label:"무신사"},{id:"hwahae",label:"화해"}];function gg(r){return r==null?"-":r==="<10"?"<10":typeof r=="number"?r.toLocaleString():String(r)}function bk(r){return r==="낮음"?"text-green-600":r==="보통"?"text-yellow-600":"text-red-500"}function yC(r){const e=Date.now()-new Date(r).getTime(),t=Math.floor(e/6e4);if(t<1)return"방금";if(t<60)return`${t}분 전`;const n=Math.floor(t/60);return n<24?`${n}시간 전`:`${Math.floor(n/24)}일 전`}function kMe({data:r}){const e=Math.max(...r.map(t=>t.ratio),1);return m.jsx("div",{className:"flex items-end gap-0.5 h-12",children:r.map(t=>m.jsxs("div",{className:"flex flex-col items-center flex-1 gap-0.5 group relative",children:[m.jsx("div",{className:"w-full bg-primary/70 rounded-sm transition-all",style:{height:`${Math.round(t.ratio/e*100)}%`}}),m.jsxs("div",{className:"absolute -top-6 left-1/2 -translate-x-1/2 hidden group-hover:block text-[10px] bg-popover border border-border rounded px-1 py-0.5 whitespace-nowrap z-10",children:[t.period,": ",t.ratio]})]},t.period))})}function RMe({kw:r,highlight:e}){const t=typeof r.monthlyPcQcCnt=="number"?r.monthlyPcQcCnt:0,n=typeof r.monthlyMobileQcCnt=="number"?r.monthlyMobileQcCnt:0,a=t+n;return m.jsxs("tr",{className:zr("border-b border-border/50 text-[12px]",e&&"bg-muted/50"),children:[m.jsx("td",{className:"py-2 px-3 font-medium text-foreground",children:r.relKeyword}),m.jsx("td",{className:"py-2 px-3 text-right tabular-nums text-muted-foreground",children:gg(r.monthlyPcQcCnt)}),m.jsx("td",{className:"py-2 px-3 text-right tabular-nums text-muted-foreground",children:gg(r.monthlyMobileQcCnt)}),m.jsx("td",{className:"py-2 px-3 text-right tabular-nums font-medium",children:a>0?a.toLocaleString():gg(r.monthlyPcQcCnt)}),m.jsx("td",{className:zr("py-2 px-3 text-center font-medium",bk(r.compIdx)),children:r.compIdx})]})}function EMe({ranking:r}){return r?m.jsxs("div",{children:[m.jsx("div",{className:"flex items-center gap-2 mb-3",children:m.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[r.platformLabel," · ",r.items.length,"개 ·"," ",new Date(r.fetchedAt).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})," ","기준"]})}),m.jsx("div",{className:"border border-border rounded-lg overflow-hidden",children:m.jsxs("table",{className:"w-full",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border bg-muted/40",children:[m.jsx("th",{className:"py-2 px-3 text-left text-[11px] text-muted-foreground font-medium w-8",children:"순위"}),m.jsx("th",{className:"py-2 px-3 text-left text-[11px] text-muted-foreground font-medium",children:"상품명"}),m.jsx("th",{className:"py-2 px-3 text-left text-[11px] text-muted-foreground font-medium",children:"브랜드"}),m.jsx("th",{className:"py-2 px-3 text-right text-[11px] text-muted-foreground font-medium",children:"가격"}),m.jsx("th",{className:"py-2 px-3 text-right text-[11px] text-muted-foreground font-medium",children:"리뷰"}),m.jsx("th",{className:"py-2 px-3 text-center text-[11px] text-muted-foreground font-medium w-8",children:"링크"})]})}),m.jsx("tbody",{children:r.items.map(e=>m.jsxs("tr",{className:"border-b border-border/50 hover:bg-muted/30 transition-colors text-[12px]",children:[m.jsx("td",{className:"py-2 px-3 text-muted-foreground tabular-nums text-center",children:e.rank}),m.jsx("td",{className:"py-2 px-3 font-medium max-w-[220px] truncate",children:e.name||"-"}),m.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:e.brand||"-"}),m.jsx("td",{className:"py-2 px-3 text-right tabular-nums",children:e.price?m.jsxs("span",{children:[e.price.toLocaleString(),e.discountRate?m.jsxs("span",{className:"ml-1 text-[10px] text-red-500",children:["-",e.discountRate,"%"]}):null]}):"-"}),m.jsx("td",{className:"py-2 px-3 text-right tabular-nums text-muted-foreground",children:e.reviewCount?e.reviewCount.toLocaleString():"-"}),m.jsx("td",{className:"py-2 px-3 text-center",children:e.url?m.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex text-muted-foreground hover:text-foreground transition-colors",children:m.jsx(Qc,{size:12})}):"-"})]},e.rank))})]})})]}):null}function IMe({onSelectKeyword:r,onSelectPlatform:e}){const{data:t,isLoading:n}=SZ(),[a,i]=Y.useState(!0);return n||!t||t.length===0?null:m.jsxs("section",{className:"mt-8",children:[m.jsxs("button",{type:"button",onClick:()=>i(o=>!o),className:"flex items-center gap-2 mb-3 text-[13px] font-semibold text-muted-foreground hover:text-foreground transition-colors",children:[m.jsx(uee,{size:13}),"CLI 기록",m.jsxs("span",{className:"text-[11px] font-normal opacity-60",children:["(",t.length,"건)"]}),m.jsx("span",{className:"ml-auto text-[11px]",children:a?"▲":"▼"})]}),a&&m.jsx("div",{className:"border border-border rounded-lg overflow-hidden divide-y divide-border",children:t.map(o=>m.jsx(OMe,{entry:o,onSelectKeyword:r,onSelectPlatform:e},o.id))})]})}function OMe({entry:r,onSelectKeyword:e,onSelectPlatform:t}){var n;if(r.type==="keyword"){const a=(n=r.volume)==null?void 0:n.results[0],i=typeof(a==null?void 0:a.monthlyPcQcCnt)=="number"?a.monthlyPcQcCnt:0,o=typeof(a==null?void 0:a.monthlyMobileQcCnt)=="number"?a.monthlyMobileQcCnt:0,s=i+o;return m.jsxs("button",{type:"button",onClick:()=>e(r),className:"w-full flex items-center gap-3 px-4 py-2.5 hover:bg-muted/40 transition-colors text-left",children:[m.jsx(wg,{size:11,className:"text-muted-foreground shrink-0"}),m.jsx("span",{className:"text-[13px] font-medium flex-1",children:r.keyword}),s>0&&m.jsxs("span",{className:"text-[11px] tabular-nums text-muted-foreground",children:[s.toLocaleString(),"회"]}),(a==null?void 0:a.compIdx)&&m.jsx("span",{className:zr("text-[11px]",bk(a.compIdx)),children:a.compIdx}),m.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:yC(r.timestamp)})]})}return r.type==="compare"?m.jsxs("button",{type:"button",onClick:()=>e(r),className:"w-full flex items-center gap-3 px-4 py-2.5 hover:bg-muted/40 transition-colors text-left",children:[m.jsx(Sg,{size:11,className:"text-muted-foreground shrink-0"}),m.jsx("span",{className:"text-[13px] font-medium flex-1",children:r.keywords.join(" vs ")}),m.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:yC(r.timestamp)})]}):m.jsxs("button",{type:"button",onClick:()=>t(r),className:"w-full flex items-center gap-3 px-4 py-2.5 hover:bg-muted/40 transition-colors text-left",children:[m.jsx(Pl,{size:11,className:"text-muted-foreground shrink-0"}),m.jsxs("span",{className:"text-[13px] font-medium flex-1",children:[r.platformLabel," 랭킹"]}),m.jsxs("span",{className:"text-[11px] tabular-nums text-muted-foreground",children:[r.ranking.items.length,"위"]}),m.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:yC(r.timestamp)})]})}function PMe(){var I,z,j,G,U,O;const{data:r}=xZ(),[e,t]=Y.useState(""),[n,a]=Y.useState(null),[i,o]=Y.useState(!1),[s,l]=Y.useState(null),[u,c]=Y.useState(null),[f,h]=Y.useState(null),[v,g]=Y.useState(!1),[y,b]=Y.useState(null),_=Y.useRef(new Map);async function S(){const H=e.trim();if(H){o(!0),l(null),a(null);try{const F=await bZ(H);F.error==="not_configured"?l(F.message??"채널이 설정되지 않았습니다"):F.error?l(F.message??F.error):a(F)}catch(F){l(F instanceof Error?F.message:String(F))}finally{o(!1)}}}async function T(H,F=!1){if(c(H),b(null),!F&&_.current.has(H)){h(_.current.get(H));return}g(!0),h(null);try{const $=await _Z(H,20);$.error==="not_configured"?b($.message??"Apify가 설정되지 않았습니다"):$.error?b($.message??$.error):(_.current.set(H,$),h($))}catch($){b($ instanceof Error?$.message:String($))}finally{g(!1)}}function C(H){if(u===H&&f){c(null),h(null);return}T(H)}function M(){u&&T(u,!0)}function D(H){if(H.type==="keyword")t(H.keyword),a({keyword:H.keyword,volume:H.volume,trend:H.trend}),l(null),c(null),h(null);else{const F=H.keywords.join(", ");t(F),a({keyword:F,trend:H.trend}),l(null),c(null),h(null)}}function L(H){const F={ranking:H.ranking};_.current.set(H.platform,F),c(H.platform),h(F),b(null),a(null),l(null)}const k=((j=(z=(I=n==null?void 0:n.trend)==null?void 0:I.results)==null?void 0:z[0])==null?void 0:j.data)??[],R=((G=n==null?void 0:n.volume)==null?void 0:G.results)??[],E=R[0]??null;return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center justify-between mb-6",children:[m.jsx("h2",{className:"text-xl font-medium",children:"트렌드"}),r&&m.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[m.jsx("span",{className:zr("w-1.5 h-1.5 rounded-full",r.searchad?"bg-green-500":"bg-muted-foreground/30")}),"검색광고",m.jsx("span",{className:zr("w-1.5 h-1.5 rounded-full",r.datalab?"bg-green-500":"bg-muted-foreground/30")}),"데이터랩",m.jsx("span",{className:zr("w-1.5 h-1.5 rounded-full",r.apify?"bg-green-500":"bg-muted-foreground/30")}),"Apify"]})]}),m.jsxs("section",{className:"mb-8",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[m.jsx(wg,{size:13,className:"text-muted-foreground"}),m.jsx("span",{className:"text-[13px] font-semibold text-muted-foreground",children:"키워드 검색량"})]}),m.jsxs("div",{className:"flex gap-2 mb-4",children:[m.jsx("input",{type:"text",value:e,onChange:H=>t(H.target.value),onKeyDown:H=>H.key==="Enter"&&!i&&S(),placeholder:"키워드 입력 (예: 여름 원피스)",className:"flex-1 h-9 px-3 text-[13px] border border-border rounded-md bg-background focus:outline-none focus:ring-1 focus:ring-ring"}),m.jsx("button",{type:"button",onClick:S,disabled:i||!e.trim(),className:"h-9 px-4 text-[13px] font-medium bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-1.5",children:i?m.jsxs(m.Fragment,{children:[m.jsx(_x,{size:12,className:"animate-spin"}),"조회 중"]}):m.jsxs(m.Fragment,{children:[m.jsx(wg,{size:12}),"검색"]})})]}),s&&m.jsx("div",{className:"flex items-center gap-2 text-[12px] text-red-600 bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900/50 rounded-lg px-4 py-3 mb-4",children:s}),n&&!s&&m.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[E&&m.jsx("div",{className:"px-5 py-4 border-b border-border bg-muted/30",children:m.jsxs("div",{className:"flex items-center gap-6",children:[m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] text-muted-foreground mb-0.5",children:"키워드"}),m.jsx("div",{className:"text-[14px] font-semibold",children:E.relKeyword})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] text-muted-foreground mb-0.5",children:"PC 검색량"}),m.jsx("div",{className:"text-[14px] font-semibold tabular-nums",children:gg(E.monthlyPcQcCnt)})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] text-muted-foreground mb-0.5",children:"모바일 검색량"}),m.jsx("div",{className:"text-[14px] font-semibold tabular-nums",children:gg(E.monthlyMobileQcCnt)})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] text-muted-foreground mb-0.5",children:"합계"}),m.jsx("div",{className:"text-[14px] font-semibold tabular-nums",children:(()=>{const H=typeof E.monthlyPcQcCnt=="number"?E.monthlyPcQcCnt:0,F=typeof E.monthlyMobileQcCnt=="number"?E.monthlyMobileQcCnt:0;return(H+F).toLocaleString()})()})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] text-muted-foreground mb-0.5",children:"경쟁강도"}),m.jsx("div",{className:zr("text-[14px] font-semibold",bk(E.compIdx)),children:E.compIdx})]})]})}),k.length>0&&m.jsxs("div",{className:"px-5 py-4 border-b border-border",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(Pl,{size:12,className:"text-muted-foreground"}),m.jsx("span",{className:"text-[11px] text-muted-foreground font-medium",children:"최근 3개월 트렌드 (월별 상대지수)"})]}),m.jsx(kMe,{data:k}),m.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1",children:[m.jsx("span",{children:(U=k[0])==null?void 0:U.period}),m.jsx("span",{children:(O=k[k.length-1])==null?void 0:O.period})]})]}),R.length>1&&m.jsx("div",{className:"overflow-x-auto",children:m.jsxs("table",{className:"w-full",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border bg-muted/30",children:[m.jsx("th",{className:"py-2 px-3 text-left text-[11px] text-muted-foreground font-medium",children:"연관 키워드"}),m.jsx("th",{className:"py-2 px-3 text-right text-[11px] text-muted-foreground font-medium",children:"PC"}),m.jsx("th",{className:"py-2 px-3 text-right text-[11px] text-muted-foreground font-medium",children:"모바일"}),m.jsx("th",{className:"py-2 px-3 text-right text-[11px] text-muted-foreground font-medium",children:"합계"}),m.jsx("th",{className:"py-2 px-3 text-center text-[11px] text-muted-foreground font-medium",children:"경쟁강도"})]})}),m.jsx("tbody",{children:R.map((H,F)=>m.jsx(RMe,{kw:H,highlight:F%2===1},H.relKeyword))})]})})]}),!n&&!i&&!s&&m.jsxs("div",{className:"border border-dashed border-border rounded-lg p-8 text-center text-muted-foreground text-sm",children:[m.jsx(Sg,{size:24,className:"mx-auto mb-3 opacity-30"}),m.jsx("p",{className:"text-[13px]",children:"키워드를 입력하면 검색량과 트렌드를 조회합니다"})]})]}),m.jsxs("section",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[m.jsx(Pl,{size:13,className:"text-muted-foreground"}),m.jsx("span",{className:"text-[13px] font-semibold text-muted-foreground",children:"전문몰 랭킹"}),r&&!r.apify&&m.jsx("span",{className:"text-[11px] text-muted-foreground",children:"· Apify 미설정"})]}),m.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-4",children:[LMe.map(H=>m.jsx("button",{type:"button",onClick:()=>C(H.id),className:zr("px-3 py-1.5 text-[12px] rounded-md border transition-colors",u===H.id?"border-foreground/50 bg-muted text-foreground font-medium":"border-border text-muted-foreground hover:border-foreground/30 hover:text-foreground"),children:H.label},H.id)),f&&u&&!v&&m.jsxs("button",{type:"button",onClick:M,className:"ml-auto flex items-center gap-1 px-2.5 py-1.5 text-[11px] border border-border rounded-md text-muted-foreground hover:border-foreground/30 hover:text-foreground transition-colors",title:"Apify 재조회 (비용 발생)",children:[m.jsx(_x,{size:11}),"새로고침"]})]}),v&&m.jsxs("div",{className:"flex items-center gap-2 py-8 justify-center text-[12px] text-muted-foreground",children:[m.jsx(_x,{size:13,className:"animate-spin"}),"랭킹 수집 중... (최대 2분 소요)"]}),y&&!v&&m.jsx("div",{className:"flex items-center gap-2 text-[12px] text-red-600 bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900/50 rounded-lg px-4 py-3",children:y}),(f==null?void 0:f.ranking)&&!v&&m.jsx(EMe,{ranking:f.ranking}),!u&&!v&&m.jsxs("div",{className:"border border-dashed border-border rounded-lg p-8 text-center text-muted-foreground text-sm",children:[m.jsx(Pl,{size:24,className:"mx-auto mb-3 opacity-30"}),m.jsx("p",{className:"text-[13px]",children:"플랫폼을 선택하면 실시간 랭킹을 수집합니다"}),m.jsx("p",{className:"text-[11px] mt-1 opacity-70",children:"Apify 기반 · 수집에 1-2분 소요"})]})]}),m.jsx(IMe,{onSelectKeyword:D,onSelectPlatform:L})]})}const jMe=["overview","session","config","orders","products","channels","sourcing","trend","settlement"];function xG(){const r=window.location.hash.slice(1).split("?")[0];return jMe.includes(r)?r:"overview"}function bG(){const r=window.location.hash.slice(1),e=r.indexOf("?");return e===-1?new URLSearchParams:new URLSearchParams(r.slice(e+1))}const zMe=[{type:"item",id:"overview",label:"Overview",icon:dee},{type:"item",id:"session",label:"Session",icon:tee},{type:"item",id:"config",label:"Settings",icon:aH},{type:"section",label:"상품전략"},{type:"item",id:"trend",label:"트렌드",icon:Pl},{type:"item",id:"sourcing",label:"소싱",icon:wg},{type:"item",id:"products",label:"상품",icon:Qx},{type:"section",label:"판매채널"},{type:"item",id:"channels",label:"채널",icon:gee},{type:"item",id:"orders",label:"주문",icon:Oee},{type:"item",id:"settlement",label:"정산",icon:Cee}];function BMe(){const[r,e]=Y.useState(xG),[t,n]=Y.useState(bG);Y.useEffect(()=>{const i=()=>{e(xG()),n(bG())};return window.addEventListener("hashchange",i),()=>window.removeEventListener("hashchange",i)},[]);const a=i=>{window.location.hash=i};return m.jsxs(MD,{delayDuration:200,children:[m.jsxs("div",{className:"flex min-h-screen",children:[m.jsx(Wae,{nav:zMe,activeId:r,onNavigate:i=>a(i),appLabel:"v0.1.0"}),m.jsx("main",{className:"flex-1 overflow-y-auto",children:m.jsxs("div",{className:"max-w-[1280px] mx-auto p-7",children:[r==="overview"&&m.jsx(rMe,{}),r==="session"&&m.jsx(uMe,{}),r==="config"&&m.jsx(kie,{initMode:t.get("mode")==="init"}),r==="orders"&&m.jsx(Rie,{}),r==="products"&&m.jsx(nMe,{}),r==="channels"&&m.jsx(Xae,{}),r==="sourcing"&&m.jsx(NMe,{}),r==="trend"&&m.jsx(PMe,{}),r==="settlement"&&m.jsx(yMe,{})]})})]}),m.jsx($ae,{})]})}const VMe=new Yq({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:1e4}}}),o$=document.getElementById("root");if(!o$)throw new Error("Root element not found");fZ.createRoot(o$).render(m.jsx(Y.StrictMode,{children:m.jsx(Xq,{client:VMe,children:m.jsx(BMe,{})})}));
|
|
422
|
+
`||a==="")){var i=r.isSelected(a);Ce(t,a)?t[a]=t[a]&&i:t[a]=i}}),t}function kTe(r){r.registerAction("legendToggleSelect","legendselectchanged",qe(kp,"toggleSelected")),r.registerAction("legendAllSelect","legendselectall",qe(kp,"allSelect")),r.registerAction("legendInverseSelect","legendinverseselect",qe(kp,"inverseSelect")),r.registerAction("legendSelect","legendselected",qe(kp,"select")),r.registerAction("legendUnSelect","legendunselected",qe(kp,"unSelect"))}function HY(r){r.registerComponentModel(ZM),r.registerComponentView(VY),r.registerProcessor(r.PRIORITY.PROCESSOR.SERIES_FILTER,LTe),r.registerSubTypeDefaulter("legend",function(){return"plain"}),kTe(r)}var RTe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.setScrollDataIndex=function(t){this.option.scrollDataIndex=t},e.prototype.init=function(t,n,a){var i=rf(t);r.prototype.init.call(this,t,n,a),SV(this,t,i)},e.prototype.mergeOption=function(t,n){r.prototype.mergeOption.call(this,t,n),SV(this,this.option,t)},e.type="legend.scroll",e.defaultOption=su(ZM.defaultOption,{scrollDataIndex:0,pageButtonItemGap:5,pageButtonGap:null,pageButtonPosition:"end",pageFormatter:"{current}/{total}",pageIcons:{horizontal:["M0,0L12,-10L12,10z","M0,0L-12,-10L-12,10z"],vertical:["M0,0L20,0L10,-20z","M0,0L20,0L10,20z"]},pageIconColor:te.color.accent50,pageIconInactiveColor:te.color.accent10,pageIconSize:15,pageTextStyle:{color:te.color.tertiary},animationDurationUpdate:800}),e})(ZM);function SV(r,e,t){var n=r.getOrient(),a=[1,1];a[n.index]=0,xo(e,t,{type:"box",ignoreSize:!!a})}var wV=Re,iC=["width","height"],oC=["x","y"],ETe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.newlineDisabled=!0,t._currentIndex=0,t}return e.prototype.init=function(){r.prototype.init.call(this),this.group.add(this._containerGroup=new wV),this._containerGroup.add(this.getContentGroup()),this.group.add(this._controllerGroup=new wV)},e.prototype.resetInner=function(){r.prototype.resetInner.call(this),this._controllerGroup.removeAll(),this._containerGroup.removeClipPath(),this._containerGroup.__rectSize=null},e.prototype.renderInner=function(t,n,a,i,o,s,l){var u=this;r.prototype.renderInner.call(this,t,n,a,i,o,s,l);var c=this._controllerGroup,f=n.get("pageIconSize",!0),h=ue(f)?f:[f,f];g("pagePrev",0);var v=n.getModel("pageTextStyle");c.add(new pt({name:"pageText",style:{text:"xx/xx",fill:v.getTextColor(),font:v.getFont(),verticalAlign:"middle",align:"center"},silent:!0})),g("pageNext",1);function g(y,b){var _=y+"DataIndex",S=zh(n.get("pageIcons",!0)[n.getOrient().name][b],{onclick:we(u._pageGo,u,_,n,i)},{x:-h[0]/2,y:-h[1]/2,width:h[0],height:h[1]});S.name=y,c.add(S)}},e.prototype.layoutInner=function(t,n,a,i,o,s){var l=this.getSelectorGroup(),u=t.getOrient().index,c=iC[u],f=oC[u],h=iC[1-u],v=oC[1-u];o&&Ec("horizontal",l,t.get("selectorItemGap",!0));var g=t.get("selectorButtonGap",!0),y=l.getBoundingRect(),b=[-y.x,-y.y],_=ke(a);o&&(_[c]=a[c]-y[c]-g);var S=this._layoutContentAndController(t,i,_,u,c,h,v,f);if(o){if(s==="end")b[u]+=S[c]+g;else{var T=y[c]+g;b[u]-=T,S[f]-=T}S[c]+=y[c]+g,b[1-u]+=S[v]+S[h]/2-y[h]/2,S[h]=Math.max(S[h],y[h]),S[v]=Math.min(S[v],y[v]+b[1-u]),l.x=b[0],l.y=b[1],l.markRedraw()}return S},e.prototype._layoutContentAndController=function(t,n,a,i,o,s,l,u){var c=this.getContentGroup(),f=this._containerGroup,h=this._controllerGroup;Ec(t.get("orient"),c,t.get("itemGap"),i?a.width:null,i?null:a.height),Ec("horizontal",h,t.get("pageButtonItemGap",!0));var v=c.getBoundingRect(),g=h.getBoundingRect(),y=this._showController=v[o]>a[o],b=[-v.x,-v.y];n||(b[i]=c[u]);var _=[0,0],S=[-g.x,-g.y],T=De(t.get("pageButtonGap",!0),t.get("itemGap",!0));if(y){var C=t.get("pageButtonPosition",!0);C==="end"?S[i]+=a[o]-g[o]:_[i]+=g[o]+T}S[1-i]+=v[s]/2-g[s]/2,c.setPosition(b),f.setPosition(_),h.setPosition(S);var M={x:0,y:0};if(M[o]=y?a[o]:v[o],M[s]=Math.max(v[s],g[s]),M[l]=Math.min(0,g[l]+S[1-i]),f.__rectSize=a[o],y){var D={x:0,y:0};D[o]=Math.max(a[o]-g[o]-T,0),D[s]=M[s],f.setClipPath(new rt({shape:D})),f.__rectSize=D[o]}else h.eachChild(function(k){k.attr({invisible:!0,silent:!0})});var L=this._getPageInfo(t);return L.pageIndex!=null&&xt(c,{x:L.contentPosition[0],y:L.contentPosition[1]},y?t:null),this._updatePageInfoView(t,L),M},e.prototype._pageGo=function(t,n,a){var i=this._getPageInfo(n)[t];i!=null&&a.dispatchAction({type:"legendScroll",scrollDataIndex:i,legendId:n.id})},e.prototype._updatePageInfoView=function(t,n){var a=this._controllerGroup;P(["pagePrev","pageNext"],function(c){var f=c+"DataIndex",h=n[f]!=null,v=a.childOfName(c);v&&(v.setStyle("fill",h?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),v.cursor=h?"pointer":"default")});var i=a.childOfName("pageText"),o=t.get("pageFormatter"),s=n.pageIndex,l=s!=null?s+1:0,u=n.pageCount;i&&o&&i.setStyle("text",_e(o)?o.replace("{current}",l==null?"":l+"").replace("{total}",u==null?"":u+""):o({current:l,total:u}))},e.prototype._getPageInfo=function(t){var n=t.get("scrollDataIndex",!0),a=this.getContentGroup(),i=this._containerGroup.__rectSize,o=t.getOrient().index,s=iC[o],l=oC[o],u=this._findTargetItemIndex(n),c=a.children(),f=c[u],h=c.length,v=h?1:0,g={contentPosition:[a.x,a.y],pageCount:v,pageIndex:v-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!f)return g;var y=C(f);g.contentPosition[o]=-y.s;for(var b=u+1,_=y,S=y,T=null;b<=h;++b)T=C(c[b]),(!T&&S.e>_.s+i||T&&!M(T,_.s))&&(S.i>_.i?_=S:_=T,_&&(g.pageNextDataIndex==null&&(g.pageNextDataIndex=_.i),++g.pageCount)),S=T;for(var b=u-1,_=y,S=y,T=null;b>=-1;--b)T=C(c[b]),(!T||!M(S,T.s))&&_.i<S.i&&(S=_,g.pagePrevDataIndex==null&&(g.pagePrevDataIndex=_.i),++g.pageCount,++g.pageIndex),_=T;return g;function C(D){if(D){var L=D.getBoundingRect(),k=L[l]+D[l];return{s:k,e:k+L[s],i:D.__legendDataIndex}}}function M(D,L){return D.e>=L&&D.s<=L+i}},e.prototype._findTargetItemIndex=function(t){if(!this._showController)return 0;var n,a=this.getContentGroup(),i;return a.eachChild(function(o,s){var l=o.__legendDataIndex;i==null&&l!=null&&(i=s),l===t&&(n=s)}),n??i},e.type="legend.scroll",e})(VY);function ITe(r){r.registerAction("legendScroll","legendscroll",function(e,t){var n=e.scrollDataIndex;n!=null&&t.eachComponent({mainType:"legend",subType:"scroll",query:e},function(a){a.setScrollDataIndex(n)})})}function OTe(r){tt(HY),r.registerComponentModel(RTe),r.registerComponentView(ETe),ITe(r)}function PTe(r){tt(HY),tt(OTe)}var jTe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.inside",e.defaultOption=su(rm.defaultOption,{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}),e})(rm),vk=st();function zTe(r,e,t){vk(r).coordSysRecordMap.each(function(n){var a=n.dataZoomInfoMap.get(e.uid);a&&(a.getRange=t)})}function BTe(r,e){for(var t=vk(r).coordSysRecordMap,n=t.keys(),a=0;a<n.length;a++){var i=n[a],o=t.get(i),s=o.dataZoomInfoMap;if(s){var l=e.uid,u=s.get(l);u&&(s.removeKey(l),s.keys().length||FY(t,o))}}}function FY(r,e){if(e){r.removeKey(e.model.uid);var t=e.controller;t&&t.dispose()}}function VTe(r,e){var t={model:e,containsPoint:qe(HTe,e),dispatchAction:qe(GTe,r),dataZoomInfoMap:null,controller:null},n=t.controller=new sf(r.getZr());return P(["pan","zoom","scrollMove"],function(a){n.on(a,function(i){var o=[];t.dataZoomInfoMap.each(function(s){if(i.isAvailableBehavior(s.model.option)){var l=(s.getRange||{})[a],u=l&&l(s.dzReferCoordSysInfo,t.model.mainType,t.controller,i);!s.model.get("disabled",!0)&&u&&o.push({dataZoomId:s.model.id,start:u[0],end:u[1]})}}),o.length&&t.dispatchAction(o)})}),t}function GTe(r,e){r.isDisposed()||r.dispatchAction({type:"dataZoom",animation:{easing:"cubicOut",duration:100},batch:e})}function HTe(r,e,t,n){return r.coordinateSystem.containPoint([t,n])}function FTe(r,e,t){var n,a="type_",i={type_true:2,type_move:1,type_false:0,type_undefined:-1},o=!0;return r.each(function(s){var l=s.model,u=l.get("disabled",!0)?!1:l.get("zoomLock",!0)?"move":!0;i[a+u]>i[a+n]&&(n=u),o=o&&l.get("preventDefaultMouseMove",!0)}),{controlType:n,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!o,api:t,zInfo:{component:e.model},triggerInfo:{roamTrigger:null,isInSelf:e.containsPoint}}}}function UTe(r){r.registerProcessor(r.PRIORITY.PROCESSOR.FILTER,function(e,t){var n=vk(t),a=n.coordSysRecordMap||(n.coordSysRecordMap=Ae());a.each(function(i){i.dataZoomInfoMap=null}),e.eachComponent({mainType:"dataZoom",subType:"inside"},function(i){var o=CY(i);P(o.infoList,function(s){var l=s.model.uid,u=a.get(l)||a.set(l,VTe(t,s.model)),c=u.dataZoomInfoMap||(u.dataZoomInfoMap=Ae());c.set(i.uid,{dzReferCoordSysInfo:s,model:i,getRange:null})})}),a.each(function(i){var o=i.controller,s,l=i.dataZoomInfoMap;if(l){var u=l.keys()[0];u!=null&&(s=l.get(u))}if(!s){FY(a,i);return}var c=FTe(l,i,t);o.enable(c.controlType,c.opt),Uh(i,"dispatchAction",s.model.get("throttle",!0),"fixRate")})})}var WTe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataZoom.inside",t}return e.prototype.render=function(t,n,a){if(r.prototype.render.apply(this,arguments),t.noTarget()){this._clear();return}this.range=t.getPercentRange(),zTe(a,t,{pan:we(sC.pan,this),zoom:we(sC.zoom,this),scrollMove:we(sC.scrollMove,this)})},e.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){BTe(this.api,this.dataZoomModel),this.range=null},e.type="dataZoom.inside",e})(ok),sC={zoom:function(r,e,t,n){var a=this.range,i=a.slice(),o=r.axisModels[0];if(o){var s=lC[e](null,[n.originX,n.originY],o,t,r),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(i[1]-i[0])+i[0],u=Math.max(1/n.scale,0);i[0]=(i[0]-l)*u+l,i[1]=(i[1]-l)*u+l;var c=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();if(Jl(0,i,[0,100],0,c.minSpan,c.maxSpan),this.range=i,a[0]!==i[0]||a[1]!==i[1])return i}},pan:TV(function(r,e,t,n,a,i){var o=lC[n]([i.oldX,i.oldY],[i.newX,i.newY],e,a,t);return o.signal*(r[1]-r[0])*o.pixel/o.pixelLength}),scrollMove:TV(function(r,e,t,n,a,i){var o=lC[n]([0,0],[i.scrollDelta,i.scrollDelta],e,a,t);return o.signal*(r[1]-r[0])*i.scrollDelta})};function TV(r){return function(e,t,n,a){var i=this.range,o=i.slice(),s=e.axisModels[0];if(s){var l=r(o,s,e,t,n,a);if(Jl(l,o,[0,100],"all"),this.range=o,i[0]!==o[0]||i[1]!==o[1])return o}}}var lC={grid:function(r,e,t,n,a){var i=t.axis,o={},s=a.model.coordinateSystem.getRect();return r=r||[0,0],i.dim==="x"?(o.pixel=e[0]-r[0],o.pixelLength=s.width,o.pixelStart=s.x,o.signal=i.inverse?1:-1):(o.pixel=e[1]-r[1],o.pixelLength=s.height,o.pixelStart=s.y,o.signal=i.inverse?-1:1),o},polar:function(r,e,t,n,a){var i=t.axis,o={},s=a.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return r=r?s.pointToCoord(r):[0,0],e=s.pointToCoord(e),t.mainType==="radiusAxis"?(o.pixel=e[0]-r[0],o.pixelLength=l[1]-l[0],o.pixelStart=l[0],o.signal=i.inverse?1:-1):(o.pixel=e[1]-r[1],o.pixelLength=u[1]-u[0],o.pixelStart=u[0],o.signal=i.inverse?-1:1),o},singleAxis:function(r,e,t,n,a){var i=t.axis,o=a.model.coordinateSystem.getRect(),s={};return r=r||[0,0],i.orient==="horizontal"?(s.pixel=e[0]-r[0],s.pixelLength=o.width,s.pixelStart=o.x,s.signal=i.inverse?1:-1):(s.pixel=e[1]-r[1],s.pixelLength=o.height,s.pixelStart=o.y,s.signal=i.inverse?-1:1),s}};function UY(r){sk(r),r.registerComponentModel(jTe),r.registerComponentView(WTe),UTe(r)}var YTe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.type="dataZoom.slider",e.layoutMode="box",e.defaultOption=su(rm.defaultOption,{show:!0,right:"ph",top:"ph",width:"ph",height:"ph",left:null,bottom:null,borderColor:te.color.accent10,borderRadius:0,backgroundColor:te.color.transparent,dataBackground:{lineStyle:{color:te.color.accent30,width:.5},areaStyle:{color:te.color.accent20,opacity:.2}},selectedDataBackground:{lineStyle:{color:te.color.accent40,width:.5},areaStyle:{color:te.color.accent20,opacity:.3}},fillerColor:"rgba(135,175,274,0.2)",handleIcon:"path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z",handleSize:"100%",handleStyle:{color:te.color.neutral00,borderColor:te.color.accent20},moveHandleSize:7,moveHandleIcon:"path://M-320.9-50L-320.9-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-348-41-339-50-320.9-50z M-212.3-50L-212.3-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-239.4-41-230.4-50-212.3-50z M-103.7-50L-103.7-50c18.1,0,27.1,9,27.1,27.1V85.7c0,18.1-9,27.1-27.1,27.1l0,0c-18.1,0-27.1-9-27.1-27.1V-22.9C-130.9-41-121.8-50-103.7-50z",moveHandleStyle:{color:te.color.accent40,opacity:.5},showDetail:!0,showDataShadow:"auto",realtime:!0,zoomLock:!1,textStyle:{color:te.color.tertiary},brushSelect:!0,brushStyle:{color:te.color.accent30,opacity:.3},emphasis:{handleLabel:{show:!0},handleStyle:{borderColor:te.color.accent40},moveHandleStyle:{opacity:.8}},defaultLocationEdgeGap:15}),e})(rm),Rp=rt,$Te=1,uC=30,XTe=7,Ep="horizontal",CV="vertical",qTe=5,ZTe=["line","bar","candlestick","scatter"],KTe={easing:"cubicOut",duration:100,delay:0},QTe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._displayables={},t}return e.prototype.init=function(t,n){this.api=n,this._onBrush=we(this._onBrush,this),this._onBrushEnd=we(this._onBrushEnd,this)},e.prototype.render=function(t,n,a,i){if(r.prototype.render.apply(this,arguments),Uh(this,"_dispatchZoomAction",t.get("throttle"),"fixRate"),this._orient=t.getOrient(),t.get("show")===!1){this.group.removeAll();return}if(t.noTarget()){this._clear(),this.group.removeAll();return}(!i||i.type!=="dataZoom"||i.from!==this.uid)&&this._buildView(),this._updateView()},e.prototype.dispose=function(){this._clear(),r.prototype.dispose.apply(this,arguments)},e.prototype._clear=function(){Gg(this,"_dispatchZoomAction");var t=this.api.getZr();t.off("mousemove",this._onBrush),t.off("mouseup",this._onBrushEnd)},e.prototype._buildView=function(){var t=this.group;t.removeAll(),this._brushing=!1,this._displayables.brushRect=null,this._resetLocation(),this._resetInterval();var n=this._displayables.sliderGroup=new Re;this._renderBackground(),this._renderHandle(),this._renderDataShadow(),t.add(n),this._positionGroup()},e.prototype._resetLocation=function(){var t=this.dataZoomModel,n=this.api,a=t.get("brushSelect"),i=a?XTe:0,o=Fr(t,n).refContainer,s=this._findCoordRect(),l=t.get("defaultLocationEdgeGap",!0)||0,u=this._orient===Ep?{right:o.width-s.x-s.width,top:o.height-uC-l-i,width:s.width,height:uC}:{right:l,top:s.y,width:uC,height:s.height},c=rf(t.option);P(["right","top","width","height"],function(h){c[h]==="ph"&&(c[h]=u[h])});var f=tr(c,o);this._location={x:f.x,y:f.y},this._size=[f.width,f.height],this._orient===CV&&this._size.reverse()},e.prototype._positionGroup=function(){var t=this.group,n=this._location,a=this._orient,i=this.dataZoomModel.getFirstTargetAxisModel(),o=i&&i.get("inverse"),s=this._displayables.sliderGroup,l=(this._dataShadowInfo||{}).otherAxisInverse;s.attr(a===Ep&&!o?{scaleY:l?1:-1,scaleX:1}:a===Ep&&o?{scaleY:l?1:-1,scaleX:-1}:a===CV&&!o?{scaleY:l?-1:1,scaleX:1,rotation:Math.PI/2}:{scaleY:l?-1:1,scaleX:-1,rotation:Math.PI/2});var u=t.getBoundingRect([s]);t.x=n.x-u.x,t.y=n.y-u.y,t.markRedraw()},e.prototype._getViewExtent=function(){return[0,this._size[0]]},e.prototype._renderBackground=function(){var t=this.dataZoomModel,n=this._size,a=this._displayables.sliderGroup,i=t.get("brushSelect");a.add(new Rp({silent:!0,shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:t.get("backgroundColor")},z2:-40}));var o=new Rp({shape:{x:0,y:0,width:n[0],height:n[1]},style:{fill:"transparent"},z2:0,onclick:we(this._onClickPanel,this)}),s=this.api.getZr();i?(o.on("mousedown",this._onBrushStart,this),o.cursor="crosshair",s.on("mousemove",this._onBrush),s.on("mouseup",this._onBrushEnd)):(s.off("mousemove",this._onBrush),s.off("mouseup",this._onBrushEnd)),a.add(o)},e.prototype._renderDataShadow=function(){var t=this._dataShadowInfo=this._prepareDataShadowInfo();if(this._displayables.dataShadowSegs=[],!t)return;var n=this._size,a=this._shadowSize||[],i=t.series,o=i.getRawData(),s=i.getShadowDim&&i.getShadowDim(),l=s&&o.getDimensionInfo(s)?i.getShadowDim():t.otherDim;if(l==null)return;var u=this._shadowPolygonPts,c=this._shadowPolylinePts;if(o!==this._shadowData||l!==this._shadowDim||n[0]!==a[0]||n[1]!==a[1]){var f=o.getDataExtent(t.thisDim),h=o.getDataExtent(l),v=(h[1]-h[0])*.3;h=[h[0]-v,h[1]+v];var g=[0,n[1]],y=[0,n[0]],b=[[n[0],0],[0,0]],_=[],S=y[1]/Math.max(1,o.count()-1),T=n[0]/(f[1]-f[0]),C=t.thisAxis.type==="time",M=-S,D=Math.round(o.count()/n[0]),L;o.each([t.thisDim,l],function(z,j,G){if(D>0&&G%D){C||(M+=S);return}M=C?(+z-f[0])*T:M+S;var U=j==null||isNaN(j)||j==="",O=U?0:Nt(j,h,g,!0);U&&!L&&G?(b.push([b[b.length-1][0],0]),_.push([_[_.length-1][0],0])):!U&&L&&(b.push([M,0]),_.push([M,0])),U||(b.push([M,O]),_.push([M,O])),L=U}),u=this._shadowPolygonPts=b,c=this._shadowPolylinePts=_}this._shadowData=o,this._shadowDim=l,this._shadowSize=[n[0],n[1]];var k=this.dataZoomModel;function R(z){var j=k.getModel(z?"selectedDataBackground":"dataBackground"),G=new Re,U=new Cn({shape:{points:u},segmentIgnoreThreshold:1,style:j.getModel("areaStyle").getAreaStyle(),silent:!0,z2:-20}),O=new dn({shape:{points:c},segmentIgnoreThreshold:1,style:j.getModel("lineStyle").getLineStyle(),silent:!0,z2:-19});return G.add(U),G.add(O),G}for(var E=0;E<3;E++){var I=R(E===1);this._displayables.sliderGroup.add(I),this._displayables.dataShadowSegs.push(I)}},e.prototype._prepareDataShadowInfo=function(){var t=this.dataZoomModel,n=t.get("showDataShadow");if(n!==!1){var a,i=this.ecModel;return t.eachTargetAxis(function(o,s){var l=t.getAxisProxy(o,s).getTargetSeriesModels();P(l,function(u){if(!a&&!(n!==!0&&Ze(ZTe,u.get("type"))<0)){var c=i.getComponent(Il(o),s).axis,f=JTe(o),h,v=u.coordinateSystem;f!=null&&v.getOtherAxis&&(h=v.getOtherAxis(c).inverse),f=u.getData().mapDimension(f);var g=u.getData().mapDimension(o);a={thisAxis:c,series:u,thisDim:g,otherDim:f,otherAxisInverse:h}}},this)},this),a}},e.prototype._renderHandle=function(){var t=this.group,n=this._displayables,a=n.handles=[null,null],i=n.handleLabels=[null,null],o=this._displayables.sliderGroup,s=this._size,l=this.dataZoomModel,u=this.api,c=l.get("borderRadius")||0,f=l.get("brushSelect"),h=n.filler=new Rp({silent:f,style:{fill:l.get("fillerColor")},textConfig:{position:"inside"}});o.add(h),o.add(new Rp({silent:!0,subPixelOptimize:!0,shape:{x:0,y:0,width:s[0],height:s[1],r:c},style:{stroke:l.get("dataBackgroundColor")||l.get("borderColor"),lineWidth:$Te,fill:te.color.transparent}})),P([0,1],function(T){var C=l.get("handleIcon");!D1[C]&&C.indexOf("path://")<0&&C.indexOf("image://")<0&&(C="path://"+C);var M=Ar(C,-1,0,2,2,null,!0);M.attr({cursor:eCe(this._orient),draggable:!0,drift:we(this._onDragMove,this,T),ondragend:we(this._onDragEnd,this),onmouseover:we(this._showDataInfo,this,!0),onmouseout:we(this._showDataInfo,this,!1),z2:5});var D=M.getBoundingRect(),L=l.get("handleSize");this._handleHeight=be(L,this._size[1]),this._handleWidth=D.width/D.height*this._handleHeight,M.setStyle(l.getModel("handleStyle").getItemStyle()),M.style.strokeNoScale=!0,M.rectHover=!0,M.ensureState("emphasis").style=l.getModel(["emphasis","handleStyle"]).getItemStyle(),Gl(M);var k=l.get("handleColor");k!=null&&(M.style.fill=k),o.add(a[T]=M);var R=l.getModel("textStyle"),E=l.get("handleLabel")||{},I=E.show||!1;t.add(i[T]=new pt({silent:!0,invisible:!I,style:Gt(R,{x:0,y:0,text:"",verticalAlign:"middle",align:"center",fill:R.getTextColor(),font:R.getFont()}),z2:10}))},this);var v=h;if(f){var g=be(l.get("moveHandleSize"),s[1]),y=n.moveHandle=new rt({style:l.getModel("moveHandleStyle").getItemStyle(),silent:!0,shape:{r:[0,0,2,2],y:s[1]-.5,height:g}}),b=g*.8,_=n.moveHandleIcon=Ar(l.get("moveHandleIcon"),-b/2,-b/2,b,b,te.color.neutral00,!0);_.silent=!0,_.y=s[1]+g/2-.5,y.ensureState("emphasis").style=l.getModel(["emphasis","moveHandleStyle"]).getItemStyle();var S=Math.min(s[1]/2,Math.max(g,10));v=n.moveZone=new rt({invisible:!0,shape:{y:s[1]-S,height:g+S}}),v.on("mouseover",function(){u.enterEmphasis(y)}).on("mouseout",function(){u.leaveEmphasis(y)}),o.add(y),o.add(_),o.add(v)}v.attr({draggable:!0,cursor:"default",drift:we(this._onDragMove,this,"all"),ondragstart:we(this._showDataInfo,this,!0),ondragend:we(this._onDragEnd,this),onmouseover:we(this._showDataInfo,this,!0),onmouseout:we(this._showDataInfo,this,!1)})},e.prototype._resetInterval=function(){var t=this._range=this.dataZoomModel.getPercentRange(),n=this._getViewExtent();this._handleEnds=[Nt(t[0],[0,100],n,!0),Nt(t[1],[0,100],n,!0)]},e.prototype._updateInterval=function(t,n){var a=this.dataZoomModel,i=this._handleEnds,o=this._getViewExtent(),s=a.findRepresentativeAxisProxy().getMinMaxSpan(),l=[0,100];Jl(n,i,o,a.get("zoomLock")?"all":t,s.minSpan!=null?Nt(s.minSpan,l,o,!0):null,s.maxSpan!=null?Nt(s.maxSpan,l,o,!0):null);var u=this._range,c=this._range=Ta([Nt(i[0],o,l,!0),Nt(i[1],o,l,!0)]);return!u||u[0]!==c[0]||u[1]!==c[1]},e.prototype._updateView=function(t){var n=this._displayables,a=this._handleEnds,i=Ta(a.slice()),o=this._size;P([0,1],function(v){var g=n.handles[v],y=this._handleHeight;g.attr({scaleX:y/2,scaleY:y/2,x:a[v]+(v?-1:1),y:o[1]/2-y/2})},this),n.filler.setShape({x:i[0],y:0,width:i[1]-i[0],height:o[1]});var s={x:i[0],width:i[1]-i[0]};n.moveHandle&&(n.moveHandle.setShape(s),n.moveZone.setShape(s),n.moveZone.getBoundingRect(),n.moveHandleIcon&&n.moveHandleIcon.attr("x",s.x+s.width/2));for(var l=n.dataShadowSegs,u=[0,i[0],i[1],o[0]],c=0;c<l.length;c++){var f=l[c],h=f.getClipPath();h||(h=new rt,f.setClipPath(h)),h.setShape({x:u[c],y:0,width:u[c+1]-u[c],height:o[1]})}this._updateDataInfo(t)},e.prototype._updateDataInfo=function(t){var n=this.dataZoomModel,a=this._displayables,i=a.handleLabels,o=this._orient,s=["",""];if(n.get("showDetail")){var l=n.findRepresentativeAxisProxy();if(l){var u=l.getAxisModel().axis,c=this._range,f=t?l.calculateDataWindow({start:c[0],end:c[1]}).valueWindow:l.getDataValueWindow();s=[this._formatLabel(f[0],u),this._formatLabel(f[1],u)]}}var h=Ta(this._handleEnds.slice());v.call(this,0),v.call(this,1);function v(g){var y=Hl(a.handles[g].parent,this.group),b=Yb(g===0?"right":"left",y),_=this._handleWidth/2+qTe,S=Si([h[g]+(g===0?-_:_),this._size[1]/2],y);i[g].setStyle({x:S[0],y:S[1],verticalAlign:o===Ep?"middle":b,align:o===Ep?b:"center",text:s[g]})}},e.prototype._formatLabel=function(t,n){var a=this.dataZoomModel,i=a.get("labelFormatter"),o=a.get("labelPrecision");(o==null||o==="auto")&&(o=n.getPixelPrecision());var s=t==null||isNaN(t)?"":n.type==="category"||n.type==="time"?n.scale.getLabel({value:Math.round(t)}):t.toFixed(Math.min(o,20));return Le(i)?i(t,s):_e(i)?i.replace("{value}",s):s},e.prototype._showDataInfo=function(t){var n=this.dataZoomModel.get("handleLabel")||{},a=n.show||!1,i=this.dataZoomModel.getModel(["emphasis","handleLabel"]),o=i.get("show")||!1,s=t||this._dragging?o:a,l=this._displayables,u=l.handleLabels;u[0].attr("invisible",!s),u[1].attr("invisible",!s),l.moveHandle&&this.api[s?"enterEmphasis":"leaveEmphasis"](l.moveHandle,1)},e.prototype._onDragMove=function(t,n,a,i){this._dragging=!0,xs(i.event);var o=this._displayables.sliderGroup.getLocalTransform(),s=Si([n,a],o,!0),l=this._updateInterval(t,s[0]),u=this.dataZoomModel.get("realtime");this._updateView(!u),l&&u&&this._dispatchZoomAction(!0)},e.prototype._onDragEnd=function(){this._dragging=!1,this._showDataInfo(!1);var t=this.dataZoomModel.get("realtime");!t&&this._dispatchZoomAction(!1)},e.prototype._onClickPanel=function(t){var n=this._size,a=this._displayables.sliderGroup.transformCoordToLocal(t.offsetX,t.offsetY);if(!(a[0]<0||a[0]>n[0]||a[1]<0||a[1]>n[1])){var i=this._handleEnds,o=(i[0]+i[1])/2,s=this._updateInterval("all",a[0]-o);this._updateView(),s&&this._dispatchZoomAction(!1)}},e.prototype._onBrushStart=function(t){var n=t.offsetX,a=t.offsetY;this._brushStart=new ze(n,a),this._brushing=!0,this._brushStartTime=+new Date},e.prototype._onBrushEnd=function(t){if(this._brushing){var n=this._displayables.brushRect;if(this._brushing=!1,!!n){n.attr("ignore",!0);var a=n.shape,i=+new Date;if(!(i-this._brushStartTime<200&&Math.abs(a.width)<5)){var o=this._getViewExtent(),s=[0,100],l=this._handleEnds=[a.x,a.x+a.width],u=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();Jl(0,l,o,0,u.minSpan!=null?Nt(u.minSpan,s,o,!0):null,u.maxSpan!=null?Nt(u.maxSpan,s,o,!0):null),this._range=Ta([Nt(l[0],o,s,!0),Nt(l[1],o,s,!0)]),this._updateView(),this._dispatchZoomAction(!1)}}}},e.prototype._onBrush=function(t){this._brushing&&(xs(t.event),this._updateBrushRect(t.offsetX,t.offsetY))},e.prototype._updateBrushRect=function(t,n){var a=this._displayables,i=this.dataZoomModel,o=a.brushRect;o||(o=a.brushRect=new Rp({silent:!0,style:i.getModel("brushStyle").getItemStyle()}),a.sliderGroup.add(o)),o.attr("ignore",!1);var s=this._brushStart,l=this._displayables.sliderGroup,u=l.transformCoordToLocal(t,n),c=l.transformCoordToLocal(s.x,s.y),f=this._size;u[0]=Math.max(Math.min(f[0],u[0]),0),o.setShape({x:c[0],y:0,width:u[0]-c[0],height:f[1]})},e.prototype._dispatchZoomAction=function(t){var n=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,animation:t?KTe:null,start:n[0],end:n[1]})},e.prototype._findCoordRect=function(){var t,n=CY(this.dataZoomModel).infoList;if(!t&&n.length){var a=n[0].model.coordinateSystem;t=a.getRect&&a.getRect()}if(!t){var i=this.api.getWidth(),o=this.api.getHeight();t={x:i*.2,y:o*.2,width:i*.6,height:o*.6}}return t},e.type="dataZoom.slider",e})(ok);function JTe(r){var e={x:"y",y:"x",radius:"angle",angle:"radius"};return e[r]}function eCe(r){return r==="vertical"?"ns-resize":"ew-resize"}function WY(r){r.registerComponentModel(YTe),r.registerComponentView(QTe),sk(r)}function tCe(r){tt(UY),tt(WY)}var YY={get:function(r,e,t){var n=ke((rCe[r]||{})[e]);return t&&ue(n)?n[n.length-1]:n}},rCe={color:{active:["#006edd","#e0ffff"],inactive:[te.color.transparent]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},AV=Qr.mapVisual,nCe=Qr.eachVisual,aCe=ue,MV=P,iCe=Ta,oCe=Nt,ub=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.stateList=["inRange","outOfRange"],t.replacableOptionKeys=["inRange","outOfRange","target","controller","color"],t.layoutMode={type:"box",ignoreSize:!0},t.dataBound=[-1/0,1/0],t.targetVisuals={},t.controllerVisuals={},t}return e.prototype.init=function(t,n,a){this.mergeDefaultAndTheme(t,a)},e.prototype.optionUpdated=function(t,n){var a=this.option;!n&&OY(a,t,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},e.prototype.resetVisual=function(t){var n=this.stateList;t=we(t,this),this.controllerVisuals=$M(this.option.controller,n,t),this.targetVisuals=$M(this.option.target,n,t)},e.prototype.getItemSymbol=function(){return null},e.prototype.getTargetSeriesIndices=function(){var t=this.option.seriesId,n=this.option.seriesIndex;n==null&&t==null&&(n="all");var a=Eh(this.ecModel,"series",{index:n,id:t},{useDefault:!1,enableAll:!0,enableNone:!1}).models;return ce(a,function(i){return i.componentIndex})},e.prototype.eachTargetSeries=function(t,n){P(this.getTargetSeriesIndices(),function(a){var i=this.ecModel.getSeriesByIndex(a);i&&t.call(n,i)},this)},e.prototype.isTargetSeries=function(t){var n=!1;return this.eachTargetSeries(function(a){a===t&&(n=!0)}),n},e.prototype.formatValueText=function(t,n,a){var i=this.option,o=i.precision,s=this.dataBound,l=i.formatter,u;a=a||["<",">"],ue(t)&&(t=t.slice(),u=!0);var c=n?t:u?[f(t[0]),f(t[1])]:f(t);if(_e(l))return l.replace("{value}",u?c[0]:c).replace("{value2}",u?c[1]:c);if(Le(l))return u?l(t[0],t[1]):l(t);if(u)return t[0]===s[0]?a[0]+" "+c[1]:t[1]===s[1]?a[1]+" "+c[0]:c[0]+" - "+c[1];return c;function f(h){return h===s[0]?"min":h===s[1]?"max":(+h).toFixed(Math.min(o,20))}},e.prototype.resetExtent=function(){var t=this.option,n=iCe([t.min,t.max]);this._dataExtent=n},e.prototype.getDataDimensionIndex=function(t){var n=this.option.dimension;if(n!=null)return t.getDimensionIndex(n);for(var a=t.dimensions,i=a.length-1;i>=0;i--){var o=a[i],s=t.getDimensionInfo(o);if(!s.isCalculationCoord)return s.storeDimIndex}},e.prototype.getExtent=function(){return this._dataExtent.slice()},e.prototype.completeVisualOption=function(){var t=this.ecModel,n=this.option,a={inRange:n.inRange,outOfRange:n.outOfRange},i=n.target||(n.target={}),o=n.controller||(n.controller={});Je(i,a),Je(o,a);var s=this.isCategory();l.call(this,i),l.call(this,o),u.call(this,i,"inRange","outOfRange"),c.call(this,o);function l(f){aCe(n.color)&&!f.inRange&&(f.inRange={color:n.color.slice().reverse()}),f.inRange=f.inRange||{color:t.get("gradientColor")}}function u(f,h,v){var g=f[h],y=f[v];g&&!y&&(y=f[v]={},MV(g,function(b,_){if(Qr.isValidType(_)){var S=YY.get(_,"inactive",s);S!=null&&(y[_]=S,_==="color"&&!y.hasOwnProperty("opacity")&&!y.hasOwnProperty("colorAlpha")&&(y.opacity=[0,0]))}}))}function c(f){var h=(f.inRange||{}).symbol||(f.outOfRange||{}).symbol,v=(f.inRange||{}).symbolSize||(f.outOfRange||{}).symbolSize,g=this.get("inactiveColor"),y=this.getItemSymbol(),b=y||"roundRect";MV(this.stateList,function(_){var S=this.itemSize,T=f[_];T||(T=f[_]={color:s?g:[g]}),T.symbol==null&&(T.symbol=h&&ke(h)||(s?b:[b])),T.symbolSize==null&&(T.symbolSize=v&&ke(v)||(s?S[0]:[S[0],S[0]])),T.symbol=AV(T.symbol,function(D){return D==="none"?b:D});var C=T.symbolSize;if(C!=null){var M=-1/0;nCe(C,function(D){D>M&&(M=D)}),T.symbolSize=AV(C,function(D){return oCe(D,[0,M],[0,S[0]],!0)})}},this)}},e.prototype.resetItemSize=function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},e.prototype.isCategory=function(){return!!this.option.categories},e.prototype.setSelected=function(t){},e.prototype.getSelected=function(){return null},e.prototype.getValueState=function(t){return null},e.prototype.getVisualMeta=function(t){return null},e.type="visualMap",e.dependencies=["series"],e.defaultOption={show:!0,z:4,min:0,max:200,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:te.color.transparent,borderColor:te.color.borderTint,contentColor:te.color.theme[0],inactiveColor:te.color.disabled,borderWidth:0,padding:te.size.m,textGap:10,precision:0,textStyle:{color:te.color.secondary}},e})(ot),DV=[20,140],sCe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.optionUpdated=function(t,n){r.prototype.optionUpdated.apply(this,arguments),this.resetExtent(),this.resetVisual(function(a){a.mappingMethod="linear",a.dataExtent=this.getExtent()}),this._resetRange()},e.prototype.resetItemSize=function(){r.prototype.resetItemSize.apply(this,arguments);var t=this.itemSize;(t[0]==null||isNaN(t[0]))&&(t[0]=DV[0]),(t[1]==null||isNaN(t[1]))&&(t[1]=DV[1])},e.prototype._resetRange=function(){var t=this.getExtent(),n=this.option.range;!n||n.auto?(t.auto=1,this.option.range=t):ue(n)&&(n[0]>n[1]&&n.reverse(),n[0]=Math.max(n[0],t[0]),n[1]=Math.min(n[1],t[1]))},e.prototype.completeVisualOption=function(){r.prototype.completeVisualOption.apply(this,arguments),P(this.stateList,function(t){var n=this.option.controller[t].symbolSize;n&&n[0]!==n[1]&&(n[0]=n[1]/3)},this)},e.prototype.setSelected=function(t){this.option.range=t.slice(),this._resetRange()},e.prototype.getSelected=function(){var t=this.getExtent(),n=Ta((this.get("range")||[]).slice());return n[0]>t[1]&&(n[0]=t[1]),n[1]>t[1]&&(n[1]=t[1]),n[0]<t[0]&&(n[0]=t[0]),n[1]<t[0]&&(n[1]=t[0]),n},e.prototype.getValueState=function(t){var n=this.option.range,a=this.getExtent(),i=De(this.option.unboundedRange,!0);return(i&&n[0]<=a[0]||n[0]<=t)&&(i&&n[1]>=a[1]||t<=n[1])?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(t){var n=[];return this.eachTargetSeries(function(a){var i=[],o=a.getData();o.each(this.getDataDimensionIndex(o),function(s,l){t[0]<=s&&s<=t[1]&&i.push(l)},this),n.push({seriesId:a.id,dataIndex:i})},this),n},e.prototype.getVisualMeta=function(t){var n=NV(this,"outOfRange",this.getExtent()),a=NV(this,"inRange",this.option.range.slice()),i=[];function o(v,g){i.push({value:v,color:t(v,g)})}for(var s=0,l=0,u=a.length,c=n.length;l<c&&(!a.length||n[l]<=a[0]);l++)n[l]<a[s]&&o(n[l],"outOfRange");for(var f=1;s<u;s++,f=0)f&&i.length&&o(a[s],"outOfRange"),o(a[s],"inRange");for(var f=1;l<c;l++)(!a.length||a[a.length-1]<n[l])&&(f&&(i.length&&o(i[i.length-1].value,"outOfRange"),f=0),o(n[l],"outOfRange"));var h=i.length;return{stops:i,outerColors:[h?i[0].color:"transparent",h?i[h-1].color:"transparent"]}},e.type="visualMap.continuous",e.defaultOption=su(ub.defaultOption,{align:"auto",calculable:!1,hoverLink:!0,realtime:!0,handleIcon:"path://M-11.39,9.77h0a3.5,3.5,0,0,1-3.5,3.5h-22a3.5,3.5,0,0,1-3.5-3.5h0a3.5,3.5,0,0,1,3.5-3.5h22A3.5,3.5,0,0,1-11.39,9.77Z",handleSize:"120%",handleStyle:{borderColor:te.color.neutral00,borderWidth:1},indicatorIcon:"circle",indicatorSize:"50%",indicatorStyle:{borderColor:te.color.neutral00,borderWidth:2,shadowBlur:2,shadowOffsetX:1,shadowOffsetY:1,shadowColor:te.color.shadow}}),e})(ub);function NV(r,e,t){if(t[0]===t[1])return t.slice();for(var n=200,a=(t[1]-t[0])/n,i=t[0],o=[],s=0;s<=n&&i<t[1];s++)o.push(i),i+=a;return o.push(t[1]),o}var $Y=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.autoPositionValues={left:1,right:1,top:1,bottom:1},t}return e.prototype.init=function(t,n){this.ecModel=t,this.api=n},e.prototype.render=function(t,n,a,i){if(this.visualMapModel=t,t.get("show")===!1){this.group.removeAll();return}this.doRender(t,n,a,i)},e.prototype.renderBackground=function(t){var n=this.visualMapModel,a=Gh(n.get("padding")||0),i=t.getBoundingRect();t.add(new rt({z2:-1,silent:!0,shape:{x:i.x-a[3],y:i.y-a[0],width:i.width+a[3]+a[1],height:i.height+a[0]+a[2]},style:{fill:n.get("backgroundColor"),stroke:n.get("borderColor"),lineWidth:n.get("borderWidth")}}))},e.prototype.getControllerVisual=function(t,n,a){a=a||{};var i=a.forceState,o=this.visualMapModel,s={};if(n==="color"){var l=o.get("contentColor");s.color=l}function u(v){return s[v]}function c(v,g){s[v]=g}var f=o.controllerVisuals[i||o.getValueState(t)],h=Qr.prepareVisualTypes(f);return P(h,function(v){var g=f[v];a.convertOpacityToAlpha&&v==="opacity"&&(v="colorAlpha",g=f.__alphaForOpacity),Qr.dependsOn(v,n)&&g&&g.applyVisual(t,u,c)}),s[n]},e.prototype.positionGroup=function(t){var n=this.visualMapModel,a=this.api,i=Fr(n,a).refContainer;qb(t,n.getBoxLayoutParams(),i)},e.prototype.doRender=function(t,n,a,i){},e.type="visualMap",e})(Ft),LV=[["left","right","width"],["top","bottom","height"]];function XY(r,e,t){var n=r.option,a=n.align;if(a!=null&&a!=="auto")return a;for(var i={width:e.getWidth(),height:e.getHeight()},o=n.orient==="horizontal"?1:0,s=LV[o],l=[0,null,10],u={},c=0;c<3;c++)u[LV[1-o][c]]=l[c],u[s[c]]=c===2?t[0]:n[s[c]];var f=[["x","width",3],["y","height",0]][o],h=tr(u,i,n.padding);return s[(h.margin[f[2]]||0)+h[f[0]]+h[f[1]]*.5<i[f[1]]*.5?0:1]}function Wx(r,e){return P(r||[],function(t){t.dataIndex!=null&&(t.dataIndexInside=t.dataIndex,t.dataIndex=null),t.highlightKey="visualMap"+(e?e.componentIndex:"")}),r}var Yi=Nt,lCe=P,kV=Math.min,cC=Math.max,uCe=12,cCe=6,fCe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._shapes={},t._dataInterval=[],t._handleEnds=[],t._hoverLinkDataIndices=[],t}return e.prototype.init=function(t,n){r.prototype.init.call(this,t,n),this._hoverLinkFromSeriesMouseOver=we(this._hoverLinkFromSeriesMouseOver,this),this._hideIndicator=we(this._hideIndicator,this)},e.prototype.doRender=function(t,n,a,i){(!i||i.type!=="selectDataRange"||i.from!==this.uid)&&this._buildView()},e.prototype._buildView=function(){this.group.removeAll();var t=this.visualMapModel,n=this.group;this._orient=t.get("orient"),this._useHandle=t.get("calculable"),this._resetInterval(),this._renderBar(n);var a=t.get("text");this._renderEndsText(n,a,0),this._renderEndsText(n,a,1),this._updateView(!0),this.renderBackground(n),this._updateView(),this._enableHoverLinkToSeries(),this._enableHoverLinkFromSeries(),this.positionGroup(n)},e.prototype._renderEndsText=function(t,n,a){if(n){var i=n[1-a];i=i!=null?i+"":"";var o=this.visualMapModel,s=o.get("textGap"),l=o.itemSize,u=this._shapes.mainGroup,c=this._applyTransform([l[0]/2,a===0?-s:l[1]+s],u),f=this._applyTransform(a===0?"bottom":"top",u),h=this._orient,v=this.visualMapModel.textStyleModel;this.group.add(new pt({style:Gt(v,{x:c[0],y:c[1],verticalAlign:v.get("verticalAlign")||(h==="horizontal"?"middle":f),align:v.get("align")||(h==="horizontal"?f:"center"),text:i})}))}},e.prototype._renderBar=function(t){var n=this.visualMapModel,a=this._shapes,i=n.itemSize,o=this._orient,s=this._useHandle,l=XY(n,this.api,i),u=a.mainGroup=this._createBarGroup(l),c=new Re;u.add(c),c.add(a.outOfRange=RV()),c.add(a.inRange=RV(null,s?IV(this._orient):null,we(this._dragHandle,this,"all",!1),we(this._dragHandle,this,"all",!0))),c.setClipPath(new rt({shape:{x:0,y:0,width:i[0],height:i[1],r:3}}));var f=n.textStyleModel.getTextRect("国"),h=cC(f.width,f.height);s&&(a.handleThumbs=[],a.handleLabels=[],a.handleLabelPoints=[],this._createHandle(n,u,0,i,h,o),this._createHandle(n,u,1,i,h,o)),this._createIndicator(n,u,i,h,o),t.add(u)},e.prototype._createHandle=function(t,n,a,i,o,s){var l=we(this._dragHandle,this,a,!1),u=we(this._dragHandle,this,a,!0),c=Mi(t.get("handleSize"),i[0]),f=Ar(t.get("handleIcon"),-c/2,-c/2,c,c,null,!0),h=IV(this._orient);f.attr({cursor:h,draggable:!0,drift:l,ondragend:u,onmousemove:function(_){xs(_.event)}}),f.x=i[0]/2,f.useStyle(t.getModel("handleStyle").getItemStyle()),f.setStyle({strokeNoScale:!0,strokeFirst:!0}),f.style.lineWidth*=2,f.ensureState("emphasis").style=t.getModel(["emphasis","handleStyle"]).getItemStyle(),gc(f,!0),n.add(f);var v=this.visualMapModel.textStyleModel,g=new pt({cursor:h,draggable:!0,drift:l,onmousemove:function(_){xs(_.event)},ondragend:u,style:Gt(v,{x:0,y:0,text:""})});g.ensureState("blur").style={opacity:.1},g.stateTransition={duration:200},this.group.add(g);var y=[c,0],b=this._shapes;b.handleThumbs[a]=f,b.handleLabelPoints[a]=y,b.handleLabels[a]=g},e.prototype._createIndicator=function(t,n,a,i,o){var s=Mi(t.get("indicatorSize"),a[0]),l=Ar(t.get("indicatorIcon"),-s/2,-s/2,s,s,null,!0);l.attr({cursor:"move",invisible:!0,silent:!0,x:a[0]/2});var u=t.getModel("indicatorStyle").getItemStyle();if(l instanceof en){var c=l.style;l.useStyle(oe({image:c.image,x:c.x,y:c.y,width:c.width,height:c.height},u))}else l.useStyle(u);n.add(l);var f=this.visualMapModel.textStyleModel,h=new pt({silent:!0,invisible:!0,style:Gt(f,{x:0,y:0,text:""})});this.group.add(h);var v=[(o==="horizontal"?i/2:cCe)+a[0]/2,0],g=this._shapes;g.indicator=l,g.indicatorLabel=h,g.indicatorLabelPoint=v,this._firstShowIndicator=!0},e.prototype._dragHandle=function(t,n,a,i){if(this._useHandle){if(this._dragging=!n,!n){var o=this._applyTransform([a,i],this._shapes.mainGroup,!0);this._updateInterval(t,o[1]),this._hideIndicator(),this._updateView()}n===!this.visualMapModel.get("realtime")&&this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:this._dataInterval.slice()}),n?!this._hovering&&this._clearHoverLinkToSeries():EV(this.visualMapModel)&&this._doHoverLinkToSeries(this._handleEnds[t],!1)}},e.prototype._resetInterval=function(){var t=this.visualMapModel,n=this._dataInterval=t.getSelected(),a=t.getExtent(),i=[0,t.itemSize[1]];this._handleEnds=[Yi(n[0],a,i,!0),Yi(n[1],a,i,!0)]},e.prototype._updateInterval=function(t,n){n=n||0;var a=this.visualMapModel,i=this._handleEnds,o=[0,a.itemSize[1]];Jl(n,i,o,t,0);var s=a.getExtent();this._dataInterval=[Yi(i[0],o,s,!0),Yi(i[1],o,s,!0)]},e.prototype._updateView=function(t){var n=this.visualMapModel,a=n.getExtent(),i=this._shapes,o=[0,n.itemSize[1]],s=t?o:this._handleEnds,l=this._createBarVisual(this._dataInterval,a,s,"inRange"),u=this._createBarVisual(a,a,o,"outOfRange");i.inRange.setStyle({fill:l.barColor}).setShape("points",l.barPoints),i.outOfRange.setStyle({fill:u.barColor}).setShape("points",u.barPoints),this._updateHandle(s,l)},e.prototype._createBarVisual=function(t,n,a,i){var o={forceState:i,convertOpacityToAlpha:!0},s=this._makeColorGradient(t,o),l=[this.getControllerVisual(t[0],"symbolSize",o),this.getControllerVisual(t[1],"symbolSize",o)],u=this._createBarPoints(a,l);return{barColor:new ef(0,0,0,1,s),barPoints:u,handlesColor:[s[0].color,s[s.length-1].color]}},e.prototype._makeColorGradient=function(t,n){var a=100,i=[],o=(t[1]-t[0])/a;i.push({color:this.getControllerVisual(t[0],"color",n),offset:0});for(var s=1;s<a;s++){var l=t[0]+o*s;if(l>t[1])break;i.push({color:this.getControllerVisual(l,"color",n),offset:s/a})}return i.push({color:this.getControllerVisual(t[1],"color",n),offset:1}),i},e.prototype._createBarPoints=function(t,n){var a=this.visualMapModel.itemSize;return[[a[0]-n[0],t[0]],[a[0],t[0]],[a[0],t[1]],[a[0]-n[1],t[1]]]},e.prototype._createBarGroup=function(t){var n=this._orient,a=this.visualMapModel.get("inverse");return new Re(n==="horizontal"&&!a?{scaleX:t==="bottom"?1:-1,rotation:Math.PI/2}:n==="horizontal"&&a?{scaleX:t==="bottom"?-1:1,rotation:-Math.PI/2}:n==="vertical"&&!a?{scaleX:t==="left"?1:-1,scaleY:-1}:{scaleX:t==="left"?1:-1})},e.prototype._updateHandle=function(t,n){if(this._useHandle){var a=this._shapes,i=this.visualMapModel,o=a.handleThumbs,s=a.handleLabels,l=i.itemSize,u=i.getExtent(),c=this._applyTransform("left",a.mainGroup);lCe([0,1],function(f){var h=o[f];h.setStyle("fill",n.handlesColor[f]),h.y=t[f];var v=Yi(t[f],[0,l[1]],u,!0),g=this.getControllerVisual(v,"symbolSize");h.scaleX=h.scaleY=g/l[0],h.x=l[0]-g/2;var y=Si(a.handleLabelPoints[f],Hl(h,this.group));if(this._orient==="horizontal"){var b=c==="left"||c==="top"?(l[0]-g)/2:(l[0]-g)/-2;y[1]+=b}s[f].setStyle({x:y[0],y:y[1],text:i.formatValueText(this._dataInterval[f]),verticalAlign:"middle",align:this._orient==="vertical"?this._applyTransform("left",a.mainGroup):"center"})},this)}},e.prototype._showIndicator=function(t,n,a,i){var o=this.visualMapModel,s=o.getExtent(),l=o.itemSize,u=[0,l[1]],c=this._shapes,f=c.indicator;if(f){f.attr("invisible",!1);var h={convertOpacityToAlpha:!0},v=this.getControllerVisual(t,"color",h),g=this.getControllerVisual(t,"symbolSize"),y=Yi(t,s,u,!0),b=l[0]-g/2,_={x:f.x,y:f.y};f.y=y,f.x=b;var S=Si(c.indicatorLabelPoint,Hl(f,this.group)),T=c.indicatorLabel;T.attr("invisible",!1);var C=this._applyTransform("left",c.mainGroup),M=this._orient,D=M==="horizontal";T.setStyle({text:(a||"")+o.formatValueText(n),verticalAlign:D?C:"middle",align:D?"center":C});var L={x:b,y,style:{fill:v}},k={style:{x:S[0],y:S[1]}};if(o.ecModel.isAnimationEnabled()&&!this._firstShowIndicator){var R={duration:100,easing:"cubicInOut",additive:!0};f.x=_.x,f.y=_.y,f.animateTo(L,R),T.animateTo(k,R)}else f.attr(L),T.attr(k);this._firstShowIndicator=!1;var E=this._shapes.handleLabels;if(E)for(var I=0;I<E.length;I++)this.api.enterBlur(E[I])}},e.prototype._enableHoverLinkToSeries=function(){var t=this;this._shapes.mainGroup.on("mousemove",function(n){if(t._hovering=!0,!t._dragging){var a=t.visualMapModel.itemSize,i=t._applyTransform([n.offsetX,n.offsetY],t._shapes.mainGroup,!0,!0);i[1]=kV(cC(0,i[1]),a[1]),t._doHoverLinkToSeries(i[1],0<=i[0]&&i[0]<=a[0])}}).on("mouseout",function(){t._hovering=!1,!t._dragging&&t._clearHoverLinkToSeries()})},e.prototype._enableHoverLinkFromSeries=function(){var t=this.api.getZr();this.visualMapModel.option.hoverLink?(t.on("mouseover",this._hoverLinkFromSeriesMouseOver,this),t.on("mouseout",this._hideIndicator,this)):this._clearHoverLinkFromSeries()},e.prototype._doHoverLinkToSeries=function(t,n){var a=this.visualMapModel,i=a.itemSize;if(a.option.hoverLink){var o=[0,i[1]],s=a.getExtent();t=kV(cC(o[0],t),o[1]);var l=dCe(a,s,o),u=[t-l,t+l],c=Yi(t,o,s,!0),f=[Yi(u[0],o,s,!0),Yi(u[1],o,s,!0)];u[0]<o[0]&&(f[0]=-1/0),u[1]>o[1]&&(f[1]=1/0),n&&(f[0]===-1/0?this._showIndicator(c,f[1],"< ",l):f[1]===1/0?this._showIndicator(c,f[0],"> ",l):this._showIndicator(c,c,"≈ ",l));var h=this._hoverLinkDataIndices,v=[];(n||EV(a))&&(v=this._hoverLinkDataIndices=a.findTargetDataIndices(f));var g=Wse(h,v);this._dispatchHighDown("downplay",Wx(g[0],a)),this._dispatchHighDown("highlight",Wx(g[1],a))}},e.prototype._hoverLinkFromSeriesMouseOver=function(t){var n;if(yc(t.target,function(l){var u=Ge(l);if(u.dataIndex!=null)return n=u,!0},!0),!!n){var a=this.ecModel.getSeriesByIndex(n.seriesIndex),i=this.visualMapModel;if(i.isTargetSeries(a)){var o=a.getData(n.dataType),s=o.getStore().get(i.getDataDimensionIndex(o),n.dataIndex);isNaN(s)||this._showIndicator(s,s)}}},e.prototype._hideIndicator=function(){var t=this._shapes;t.indicator&&t.indicator.attr("invisible",!0),t.indicatorLabel&&t.indicatorLabel.attr("invisible",!0);var n=this._shapes.handleLabels;if(n)for(var a=0;a<n.length;a++)this.api.leaveBlur(n[a])},e.prototype._clearHoverLinkToSeries=function(){this._hideIndicator();var t=this._hoverLinkDataIndices;this._dispatchHighDown("downplay",Wx(t,this.visualMapModel)),t.length=0},e.prototype._clearHoverLinkFromSeries=function(){this._hideIndicator();var t=this.api.getZr();t.off("mouseover",this._hoverLinkFromSeriesMouseOver),t.off("mouseout",this._hideIndicator)},e.prototype._applyTransform=function(t,n,a,i){var o=Hl(n,i?null:this.group);return ue(t)?Si(t,o,a):Yb(t,o,a)},e.prototype._dispatchHighDown=function(t,n){n&&n.length&&this.api.dispatchAction({type:t,batch:n})},e.prototype.dispose=function(){this._clearHoverLinkFromSeries(),this._clearHoverLinkToSeries()},e.type="visualMap.continuous",e})($Y);function RV(r,e,t,n){return new Cn({shape:{points:r},draggable:!!t,cursor:e,drift:t,onmousemove:function(a){xs(a.event)},ondragend:n})}function dCe(r,e,t){var n=uCe/2,a=r.get("hoverLinkDataSize");return a&&(n=Yi(a,e,t,!0)/2),n}function EV(r){var e=r.get("hoverLinkOnHandle");return!!(e??r.get("realtime"))}function IV(r){return r==="vertical"?"ns-resize":"ew-resize"}var hCe={type:"selectDataRange",event:"dataRangeSelected",update:"update"},vCe=function(r,e){e.eachComponent({mainType:"visualMap",query:r},function(t){t.setSelected(r.selected)})},pCe=[{createOnAllSeries:!0,reset:function(r,e){var t=[];return e.eachComponent("visualMap",function(n){var a=r.pipelineContext;!n.isTargetSeries(r)||a&&a.large||t.push(P2e(n.stateList,n.targetVisuals,we(n.getValueState,n),n.getDataDimensionIndex(r.getData())))}),t}},{createOnAllSeries:!0,reset:function(r,e){var t=r.getData(),n=[];e.eachComponent("visualMap",function(a){if(a.isTargetSeries(r)){var i=a.getVisualMeta(we(gCe,null,r,a))||{stops:[],outerColors:[]},o=a.getDataDimensionIndex(t);o>=0&&(i.dimension=o,n.push(i))}}),r.getData().setVisual("visualMeta",n)}}];function gCe(r,e,t,n){for(var a=e.targetVisuals[n],i=Qr.prepareVisualTypes(a),o={color:Dm(r.getData(),"color")},s=0,l=i.length;s<l;s++){var u=i[s],c=a[u==="opacity"?"__alphaForOpacity":u];c&&c.applyVisual(t,f,h)}return o.color;function f(v){return o[v]}function h(v,g){o[v]=g}}var OV=P;function mCe(r){var e=r&&r.visualMap;ue(e)||(e=e?[e]:[]),OV(e,function(t){if(t){Td(t,"splitList")&&!Td(t,"pieces")&&(t.pieces=t.splitList,delete t.splitList);var n=t.pieces;n&&ue(n)&&OV(n,function(a){Oe(a)&&(Td(a,"start")&&!Td(a,"min")&&(a.min=a.start),Td(a,"end")&&!Td(a,"max")&&(a.max=a.end))})}})}function Td(r,e){return r&&r.hasOwnProperty&&r.hasOwnProperty(e)}var PV=!1;function qY(r){PV||(PV=!0,r.registerSubTypeDefaulter("visualMap",function(e){return!e.categories&&(!(e.pieces?e.pieces.length>0:e.splitNumber>0)||e.calculable)?"continuous":"piecewise"}),r.registerAction(hCe,vCe),P(pCe,function(e){r.registerVisual(r.PRIORITY.VISUAL.COMPONENT,e)}),r.registerPreprocessor(mCe))}function ZY(r){r.registerComponentModel(sCe),r.registerComponentView(fCe),qY(r)}var yCe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t._pieceList=[],t}return e.prototype.optionUpdated=function(t,n){r.prototype.optionUpdated.apply(this,arguments),this.resetExtent();var a=this._mode=this._determineMode();this._pieceList=[],xCe[this._mode].call(this,this._pieceList),this._resetSelected(t,n);var i=this.option.categories;this.resetVisual(function(o,s){a==="categories"?(o.mappingMethod="category",o.categories=ke(i)):(o.dataExtent=this.getExtent(),o.mappingMethod="piecewise",o.pieceList=ce(this._pieceList,function(l){return l=ke(l),s!=="inRange"&&(l.visual=null),l}))})},e.prototype.completeVisualOption=function(){var t=this.option,n={},a=Qr.listVisualTypes(),i=this.isCategory();P(t.pieces,function(s){P(a,function(l){s.hasOwnProperty(l)&&(n[l]=1)})}),P(n,function(s,l){var u=!1;P(this.stateList,function(c){u=u||o(t,c,l)||o(t.target,c,l)},this),!u&&P(this.stateList,function(c){(t[c]||(t[c]={}))[l]=YY.get(l,c==="inRange"?"active":"inactive",i)})},this);function o(s,l,u){return s&&s[l]&&s[l].hasOwnProperty(u)}r.prototype.completeVisualOption.apply(this,arguments)},e.prototype._resetSelected=function(t,n){var a=this.option,i=this._pieceList,o=(n?a:t).selected||{};if(a.selected=o,P(i,function(l,u){var c=this.getSelectedMapKey(l);o.hasOwnProperty(c)||(o[c]=!0)},this),a.selectedMode==="single"){var s=!1;P(i,function(l,u){var c=this.getSelectedMapKey(l);o[c]&&(s?o[c]=!1:s=!0)},this)}},e.prototype.getItemSymbol=function(){return this.get("itemSymbol")},e.prototype.getSelectedMapKey=function(t){return this._mode==="categories"?t.value+"":t.index+""},e.prototype.getPieceList=function(){return this._pieceList},e.prototype._determineMode=function(){var t=this.option;return t.pieces&&t.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},e.prototype.setSelected=function(t){this.option.selected=ke(t)},e.prototype.getValueState=function(t){var n=Qr.findPieceIndex(t,this._pieceList);return n!=null&&this.option.selected[this.getSelectedMapKey(this._pieceList[n])]?"inRange":"outOfRange"},e.prototype.findTargetDataIndices=function(t){var n=[],a=this._pieceList;return this.eachTargetSeries(function(i){var o=[],s=i.getData();s.each(this.getDataDimensionIndex(s),function(l,u){var c=Qr.findPieceIndex(l,a);c===t&&o.push(u)},this),n.push({seriesId:i.id,dataIndex:o})},this),n},e.prototype.getRepresentValue=function(t){var n;if(this.isCategory())n=t.value;else if(t.value!=null)n=t.value;else{var a=t.interval||[];n=a[0]===-1/0&&a[1]===1/0?0:(a[0]+a[1])/2}return n},e.prototype.getVisualMeta=function(t){if(this.isCategory())return;var n=[],a=["",""],i=this;function o(c,f){var h=i.getRepresentValue({interval:c});f||(f=i.getValueState(h));var v=t(h,f);c[0]===-1/0?a[0]=v:c[1]===1/0?a[1]=v:n.push({value:c[0],color:v},{value:c[1],color:v})}var s=this._pieceList.slice();if(!s.length)s.push({interval:[-1/0,1/0]});else{var l=s[0].interval[0];l!==-1/0&&s.unshift({interval:[-1/0,l]}),l=s[s.length-1].interval[1],l!==1/0&&s.push({interval:[l,1/0]})}var u=-1/0;return P(s,function(c){var f=c.interval;f&&(f[0]>u&&o([u,f[0]],"outOfRange"),o(f.slice()),u=f[1])},this),{stops:n,outerColors:a}},e.type="visualMap.piecewise",e.defaultOption=su(ub.defaultOption,{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieces:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0}),e})(ub),xCe={splitNumber:function(r){var e=this.option,t=Math.min(e.precision,20),n=this.getExtent(),a=e.splitNumber;a=Math.max(parseInt(a,10),1),e.splitNumber=a;for(var i=(n[1]-n[0])/a;+i.toFixed(t)!==i&&t<5;)t++;e.precision=t,i=+i.toFixed(t),e.minOpen&&r.push({interval:[-1/0,n[0]],close:[0,0]});for(var o=0,s=n[0];o<a;s+=i,o++){var l=o===a-1?n[1]:s+i;r.push({interval:[s,l],close:[1,1]})}e.maxOpen&&r.push({interval:[n[1],1/0],close:[0,0]}),yA(r),P(r,function(u,c){u.index=c,u.text=this.formatValueText(u.interval)},this)},categories:function(r){var e=this.option;P(e.categories,function(t){r.push({text:this.formatValueText(t,!0),value:t})},this),jV(e,r)},pieces:function(r){var e=this.option;P(e.pieces,function(t,n){Oe(t)||(t={value:t});var a={text:"",index:n};if(t.label!=null&&(a.text=t.label),t.hasOwnProperty("value")){var i=a.value=t.value;a.interval=[i,i],a.close=[1,1]}else{for(var o=a.interval=[],s=a.close=[0,0],l=[1,0,1],u=[-1/0,1/0],c=[],f=0;f<2;f++){for(var h=[["gte","gt","min"],["lte","lt","max"]][f],v=0;v<3&&o[f]==null;v++)o[f]=t[h[v]],s[f]=l[v],c[f]=v===2;o[f]==null&&(o[f]=u[f])}c[0]&&o[1]===1/0&&(s[0]=0),c[1]&&o[0]===-1/0&&(s[1]=0),o[0]===o[1]&&s[0]&&s[1]&&(a.value=o[0])}a.visual=Qr.retrieveVisuals(t),r.push(a)},this),jV(e,r),yA(r),P(r,function(t){var n=t.close,a=[["<","≤"][n[1]],[">","≥"][n[0]]];t.text=t.text||this.formatValueText(t.value!=null?t.value:t.interval,!1,a)},this)}};function jV(r,e){var t=r.inverse;(r.orient==="vertical"?!t:t)&&e.reverse()}var bCe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.doRender=function(){var t=this.group;t.removeAll();var n=this.visualMapModel,a=n.get("textGap"),i=n.textStyleModel,o=this._getItemAlign(),s=n.itemSize,l=this._getViewData(),u=l.endsText,c=fn(n.get("showLabel",!0),!u),f=!n.get("selectedMode");u&&this._renderEndsText(t,u[0],s,c,o),P(l.viewPieceList,function(h){var v=h.piece,g=new Re;g.onclick=we(this._onItemClick,this,v),this._enableHoverLink(g,h.indexInModelPieceList);var y=n.getRepresentValue(v);if(this._createItemSymbol(g,y,[0,0,s[0],s[1]],f),c){var b=this.visualMapModel.getValueState(y),_=i.get("align")||o;g.add(new pt({style:Gt(i,{x:_==="right"?-a:s[0]+a,y:s[1]/2,text:v.text,verticalAlign:i.get("verticalAlign")||"middle",align:_,opacity:De(i.get("opacity"),b==="outOfRange"?.5:1)}),silent:f}))}t.add(g)},this),u&&this._renderEndsText(t,u[1],s,c,o),Ec(n.get("orient"),t,n.get("itemGap")),this.renderBackground(t),this.positionGroup(t)},e.prototype._enableHoverLink=function(t,n){var a=this;t.on("mouseover",function(){return i("highlight")}).on("mouseout",function(){return i("downplay")});var i=function(o){var s=a.visualMapModel;s.option.hoverLink&&a.api.dispatchAction({type:o,batch:Wx(s.findTargetDataIndices(n),s)})}},e.prototype._getItemAlign=function(){var t=this.visualMapModel,n=t.option;if(n.orient==="vertical")return XY(t,this.api,t.itemSize);var a=n.align;return(!a||a==="auto")&&(a="left"),a},e.prototype._renderEndsText=function(t,n,a,i,o){if(n){var s=new Re,l=this.visualMapModel.textStyleModel;s.add(new pt({style:Gt(l,{x:i?o==="right"?a[0]:0:a[0]/2,y:a[1]/2,verticalAlign:"middle",align:i?o:"center",text:n})})),t.add(s)}},e.prototype._getViewData=function(){var t=this.visualMapModel,n=ce(t.getPieceList(),function(s,l){return{piece:s,indexInModelPieceList:l}}),a=t.get("text"),i=t.get("orient"),o=t.get("inverse");return(i==="horizontal"?o:!o)?n.reverse():a&&(a=a.slice().reverse()),{viewPieceList:n,endsText:a}},e.prototype._createItemSymbol=function(t,n,a,i){var o=Ar(this.getControllerVisual(n,"symbol"),a[0],a[1],a[2],a[3],this.getControllerVisual(n,"color"));o.silent=i,t.add(o)},e.prototype._onItemClick=function(t){var n=this.visualMapModel,a=n.option,i=a.selectedMode;if(i){var o=ke(a.selected),s=n.getSelectedMapKey(t);i==="single"||i===!0?(o[s]=!0,P(o,function(l,u){o[u]=u===s})):o[s]=!o[s],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:o})}},e.type="visualMap.piecewise",e})($Y);function KY(r){r.registerComponentModel(yCe),r.registerComponentView(bCe),qY(r)}function _Ce(r){tt(ZY),tt(KY)}var SCe=(function(){function r(e){this._thumbnailModel=e}return r.prototype.reset=function(e){this._renderVersion=e.getMainProcessVersion()},r.prototype.renderContent=function(e){var t=e.api.getViewOfComponentModel(this._thumbnailModel);t&&(e.group.silent=!0,t.renderContent({group:e.group,targetTrans:e.targetTrans,z2Range:_8(e.group),roamType:e.roamType,viewportRect:e.viewportRect,renderVersion:this._renderVersion}))},r.prototype.updateWindow=function(e,t){var n=t.getViewOfComponentModel(this._thumbnailModel);n&&n.updateWindow({targetTrans:e,renderVersion:this._renderVersion})},r})(),wCe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t.preventAutoZ=!0,t}return e.prototype.optionUpdated=function(t,n){this._updateBridge()},e.prototype._updateBridge=function(){var t=this._birdge=this._birdge||new SCe(this);if(this._target=null,this.ecModel.eachSeries(function(a){l4(a,null)}),this.shouldShow()){var n=this.getTarget();l4(n.baseMapProvider,t)}},e.prototype.shouldShow=function(){return this.getShallow("show",!0)},e.prototype.getBridge=function(){return this._birdge},e.prototype.getTarget=function(){if(this._target)return this._target;var t=this.getReferringComponents("series",{useDefault:!1,enableAll:!1,enableNone:!1}).models[0];return t?t.subType!=="graph"&&(t=null):t=this.ecModel.queryComponents({mainType:"series",subType:"graph"})[0],this._target={baseMapProvider:t},this._target},e.type="thumbnail",e.layoutMode="box",e.dependencies=["series","geo"],e.defaultOption={show:!0,right:1,bottom:1,height:"25%",width:"25%",itemStyle:{borderColor:te.color.border,borderWidth:2},windowStyle:{borderWidth:1,color:te.color.neutral30,borderColor:te.color.neutral40,opacity:.3},z:10},e})(ot),TCe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,n,a){if(this._api=a,this._model=t,this._coordSys||(this._coordSys=new lf),!this._isEnabled()){this._clear();return}this._renderVersion=a.getMainProcessVersion();var i=this.group;i.removeAll();var o=t.getModel("itemStyle"),s=o.getItemStyle();s.fill==null&&(s.fill=n.get("backgroundColor")||te.color.neutral00);var l=Fr(t,a).refContainer,u=tr(G8(t,!0),l),c=s.lineWidth||0,f=this._contentRect=Fc(u.clone(),c/2,!0,!0),h=new Re;i.add(h),h.setClipPath(new rt({shape:f.plain()}));var v=this._targetGroup=new Re;h.add(v);var g=u.plain();g.r=o.getShallow("borderRadius",!0),i.add(this._bgRect=new rt({style:s,shape:g,silent:!1,cursor:"grab"}));var y=t.getModel("windowStyle"),b=y.getShallow("borderRadius",!0);h.add(this._windowRect=new rt({shape:{x:0,y:0,width:0,height:0,r:b},style:y.getItemStyle(),silent:!1,cursor:"grab"})),this._dealRenderContent(),this._dealUpdateWindow(),BV(t,this)},e.prototype.renderContent=function(t){this._bridgeRendered=t,this._isEnabled()&&(this._dealRenderContent(),this._dealUpdateWindow(),BV(this._model,this))},e.prototype._dealRenderContent=function(){var t=this._bridgeRendered;if(!(!t||t.renderVersion!==this._renderVersion)){var n=this._targetGroup,a=this._coordSys,i=this._contentRect;if(n.removeAll(),!!t){var o=t.group,s=o.getBoundingRect();n.add(o),this._bgRect.z2=t.z2Range.min-10,a.setBoundingRect(s.x,s.y,s.width,s.height);var l=tr({left:"center",top:"center",aspect:s.width/s.height},i);a.setViewRect(l.x,l.y,l.width,l.height),o.attr(a.getTransformInfo().raw),this._windowRect.z2=t.z2Range.max+10,this._resetRoamController(t.roamType)}}},e.prototype.updateWindow=function(t){var n=this._bridgeRendered;n&&n.renderVersion===t.renderVersion&&(n.targetTrans=t.targetTrans),this._isEnabled()&&this._dealUpdateWindow()},e.prototype._dealUpdateWindow=function(){var t=this._bridgeRendered;if(!(!t||t.renderVersion!==this._renderVersion)){var n=ri([],t.targetTrans),a=bi([],this._coordSys.transform,n);this._transThisToTarget=ri([],a);var i=t.viewportRect;i?i=i.clone():i=new Be(0,0,this._api.getWidth(),this._api.getHeight()),i.applyTransform(a);var o=this._windowRect,s=o.shape.r;o.setShape(Ie({r:s},i))}},e.prototype._resetRoamController=function(t){var n=this,a=this._api,i=this._roamController;if(i||(i=this._roamController=new sf(a.getZr())),!t||!this._isEnabled()){i.disable();return}i.enable(t,{api:a,zInfo:{component:this._model},triggerInfo:{roamTrigger:null,isInSelf:function(o,s,l){return n._contentRect.contain(s,l)}}}),i.off("pan").off("zoom").on("pan",we(this._onPan,this)).on("zoom",we(this._onZoom,this))},e.prototype._onPan=function(t){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var a=pr([],[t.oldX,t.oldY],n),i=pr([],[t.oldX-t.dx,t.oldY-t.dy],n);this._api.dispatchAction(zV(this._model.getTarget().baseMapProvider,{dx:i[0]-a[0],dy:i[1]-a[1]}))}},e.prototype._onZoom=function(t){var n=this._transThisToTarget;if(!(!this._isEnabled()||!n)){var a=pr([],[t.originX,t.originY],n);this._api.dispatchAction(zV(this._model.getTarget().baseMapProvider,{zoom:1/t.scale,originX:a[0],originY:a[1]}))}},e.prototype._isEnabled=function(){var t=this._model;if(!t||!t.shouldShow())return!1;var n=t.getTarget().baseMapProvider;return!!n},e.prototype._clear=function(){this.group.removeAll(),this._bridgeRendered=null,this._roamController&&this._roamController.disable()},e.prototype.remove=function(){this._clear()},e.prototype.dispose=function(){this._clear()},e.type="thumbnail",e})(Ft);function zV(r,e){var t=r.mainType==="series"?r.subType+"Roam":r.mainType+"Roam",n={type:t};return n[r.mainType+"Id"]=r.id,oe(n,e),n}function BV(r,e){var t=Uc(r);$b(e.group,t.z,t.zlevel)}function CCe(r){r.registerComponentModel(wCe),r.registerComponentView(TCe)}var ACe={label:{enabled:!0},decal:{show:!1}},VV=st(),MCe={};function DCe(r,e){var t=r.getModel("aria");if(!t.get("enabled"))return;var n=ke(ACe);Je(n.label,r.getLocaleModel().get("aria"),!1),Je(t.option,n,!1),a(),i();function a(){var u=t.getModel("decal"),c=u.get("show");if(c){var f=Ae();r.eachSeries(function(h){if(!h.isColorBySeries()){var v=f.get(h.type);v||(v={},f.set(h.type,v)),VV(h).scope=v}}),r.eachRawSeries(function(h){if(r.isSeriesFiltered(h))return;if(Le(h.enableAriaDecal)){h.enableAriaDecal();return}var v=h.getData();if(h.isColorBySeries()){var S=BA(h.ecModel,h.name,MCe,r.getSeriesCount()),T=v.getVisual("decal");v.setVisual("decal",C(T,S))}else{var g=h.getRawData(),y={},b=VV(h).scope;v.each(function(M){var D=v.getRawIndex(M);y[D]=M});var _=g.count();g.each(function(M){var D=y[M],L=g.getName(M)||M+"",k=BA(h.ecModel,L,b,_),R=v.getItemVisual(D,"decal");v.setItemVisual(D,"decal",C(R,k))})}function C(M,D){var L=M?oe(oe({},D),M):D;return L.dirty=!0,L}})}}function i(){var u=e.getZr().dom;if(u){var c=r.getLocaleModel().get("aria"),f=t.getModel("label");if(f.option=Ie(f.option,c),!!f.get("enabled")){if(u.setAttribute("role","img"),f.get("description")){u.setAttribute("aria-label",f.get("description"));return}var h=r.getSeriesCount(),v=f.get(["data","maxCount"])||10,g=f.get(["series","maxCount"])||10,y=Math.min(h,g),b;if(!(h<1)){var _=s();if(_){var S=f.get(["general","withTitle"]);b=o(S,{title:_})}else b=f.get(["general","withoutTitle"]);var T=[],C=h>1?f.get(["series","multiple","prefix"]):f.get(["series","single","prefix"]);b+=o(C,{seriesCount:h}),r.eachSeries(function(k,R){if(R<y){var E=void 0,I=k.get("name"),z=I?"withName":"withoutName";E=h>1?f.get(["series","multiple",z]):f.get(["series","single",z]),E=o(E,{seriesId:k.seriesIndex,seriesName:k.get("name"),seriesType:l(k.subType)});var j=k.getData();if(j.count()>v){var G=f.get(["data","partialData"]);E+=o(G,{displayCnt:v})}else E+=f.get(["data","allData"]);for(var U=f.get(["data","separator","middle"]),O=f.get(["data","separator","end"]),H=f.get(["data","excludeDimensionId"]),F=[],$=0;$<j.count();$++)if($<v){var B=j.getName($),X=H?At(j.getValues($),function(Q,ne){return Ze(H,ne)===-1}):j.getValues($),q=f.get(["data",B?"withName":"withoutName"]);F.push(o(q,{name:B,value:X.join(U)}))}E+=F.join(U)+O,T.push(E)}});var M=f.getModel(["series","multiple","separator"]),D=M.get("middle"),L=M.get("end");b+=T.join(D)+L,u.setAttribute("aria-label",b)}}}}function o(u,c){if(!_e(u))return u;var f=u;return P(c,function(h,v){f=f.replace(new RegExp("\\{\\s*"+v+"\\s*\\}","g"),h)}),f}function s(){var u=r.get("title");return u&&u.length&&(u=u[0]),u&&u.text}function l(u){var c=r.getLocaleModel().get(["series","typeNames"]);return c[u]||c.chart}}function NCe(r){if(!(!r||!r.aria)){var e=r.aria;e.show!=null&&(e.enabled=e.show),e.label=e.label||{},P(["description","general","series","data"],function(t){e[t]!=null&&(e.label[t]=e[t])})}}function LCe(r){r.registerPreprocessor(NCe),r.registerVisual(r.PRIORITY.VISUAL.ARIA,DCe)}var GV={value:"eq","<":"lt","<=":"lte",">":"gt",">=":"gte","=":"eq","!=":"ne","<>":"ne"},kCe=(function(){function r(e){var t=this._condVal=_e(e)?new RegExp(e):WH(e)?e:null;if(t==null){var n="";Lt(n)}}return r.prototype.evaluate=function(e){var t=typeof e;return _e(t)?this._condVal.test(e):gt(t)?this._condVal.test(e+""):!1},r})(),RCe=(function(){function r(){}return r.prototype.evaluate=function(){return this.value},r})(),ECe=(function(){function r(){}return r.prototype.evaluate=function(){for(var e=this.children,t=0;t<e.length;t++)if(!e[t].evaluate())return!1;return!0},r})(),ICe=(function(){function r(){}return r.prototype.evaluate=function(){for(var e=this.children,t=0;t<e.length;t++)if(e[t].evaluate())return!0;return!1},r})(),OCe=(function(){function r(){}return r.prototype.evaluate=function(){return!this.child.evaluate()},r})(),PCe=(function(){function r(){}return r.prototype.evaluate=function(){for(var e=!!this.valueParser,t=this.getValue,n=t(this.valueGetterParam),a=e?this.valueParser(n):null,i=0;i<this.subCondList.length;i++)if(!this.subCondList[i].evaluate(e?a:n))return!1;return!0},r})();function pk(r,e){if(r===!0||r===!1){var t=new RCe;return t.value=r,t}var n="";return QY(r)||Lt(n),r.and?HV("and",r,e):r.or?HV("or",r,e):r.not?jCe(r,e):zCe(r,e)}function HV(r,e,t){var n=e[r],a="";ue(n)||Lt(a),n.length||Lt(a);var i=r==="and"?new ECe:new ICe;return i.children=ce(n,function(o){return pk(o,t)}),i.children.length||Lt(a),i}function jCe(r,e){var t=r.not,n="";QY(t)||Lt(n);var a=new OCe;return a.child=pk(t,e),a.child||Lt(n),a}function zCe(r,e){for(var t="",n=e.prepareGetValue(r),a=[],i=ht(r),o=r.parser,s=o?u7(o):null,l=0;l<i.length;l++){var u=i[l];if(!(u==="parser"||e.valueGetterAttrMap.get(u))){var c=Ce(GV,u)?GV[u]:u,f=r[u],h=s?s(f):f,v=afe(c,h)||c==="reg"&&new kCe(h);v||Lt(t),a.push(v)}}a.length||Lt(t);var g=new PCe;return g.valueGetterParam=n,g.valueParser=s,g.getValue=e.getValue,g.subCondList=a,g}function QY(r){return Oe(r)&&!Sn(r)}var BCe=(function(){function r(e,t){this._cond=pk(e,t)}return r.prototype.evaluate=function(){return this._cond.evaluate()},r})();function VCe(r,e){return new BCe(r,e)}var GCe={type:"echarts:filter",transform:function(r){for(var e=r.upstream,t,n=VCe(r.config,{valueGetterAttrMap:Ae({dimension:!0}),prepareGetValue:function(s){var l="",u=s.dimension;Ce(s,"dimension")||Lt(l);var c=e.getDimensionInfo(u);return c||Lt(l),{dimIdx:c.index}},getValue:function(s){return e.retrieveValueFromItem(t,s.dimIdx)}}),a=[],i=0,o=e.count();i<o;i++)t=e.getRawDataItem(i),n.evaluate()&&a.push(t);return{data:a}}},HCe={type:"echarts:sort",transform:function(r){var e=r.upstream,t=r.config,n="",a=Ht(t);a.length||Lt(n);var i=[];P(a,function(c){var f=c.dimension,h=c.order,v=c.parser,g=c.incomparable;if(f==null&&Lt(n),h!=="asc"&&h!=="desc"&&Lt(n),g&&g!=="min"&&g!=="max"){var y="";Lt(y)}if(h!=="asc"&&h!=="desc"){var b="";Lt(b)}var _=e.getDimensionInfo(f);_||Lt(n);var S=v?u7(v):null;v&&!S&&Lt(n),i.push({dimIdx:_.index,parser:S,comparator:new f7(h,g)})});var o=e.sourceFormat;o!==hn&&o!==La&&Lt(n);for(var s=[],l=0,u=e.count();l<u;l++)s.push(e.getRawDataItem(l));return s.sort(function(c,f){for(var h=0;h<i.length;h++){var v=i[h],g=e.retrieveValueFromItem(c,v.dimIdx),y=e.retrieveValueFromItem(f,v.dimIdx);v.parser&&(g=v.parser(g),y=v.parser(y));var b=v.comparator.evaluate(g,y);if(b!==0)return b}return 0}),{data:s}}};function FCe(r){r.registerTransform(GCe),r.registerTransform(HCe)}var UCe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataset",t}return e.prototype.init=function(t,n,a){r.prototype.init.call(this,t,n,a),this._sourceManager=new p7(this),b5(this)},e.prototype.mergeOption=function(t,n){r.prototype.mergeOption.call(this,t,n),b5(this)},e.prototype.optionUpdated=function(){this._sourceManager.dirty()},e.prototype.getSourceManager=function(){return this._sourceManager},e.type="dataset",e.defaultOption={seriesLayoutBy:wi},e})(ot),WCe=(function(r){K(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.type="dataset",t}return e.type="dataset",e})(Ft);function YCe(r){r.registerComponentModel(UCe),r.registerComponentView(WCe)}var Ui=yo.CMD;function Vd(r,e){return Math.abs(r-e)<1e-5}function eD(r){var e=r.data,t=r.len(),n=[],a,i=0,o=0,s=0,l=0;function u(j,G){a&&a.length>2&&n.push(a),a=[j,G]}function c(j,G,U,O){Vd(j,U)&&Vd(G,O)||a.push(j,G,U,O,U,O)}function f(j,G,U,O,H,F){var $=Math.abs(G-j),B=Math.tan($/4)*4/3,X=G<j?-1:1,q=Math.cos(j),Q=Math.sin(j),ne=Math.cos(G),fe=Math.sin(G),ve=q*H+U,Se=Q*F+O,ge=ne*H+U,he=fe*F+O,Ne=H*B*X,xe=F*B*X;a.push(ve-Ne*Q,Se+xe*q,ge+Ne*fe,he-xe*ne,ge,he)}for(var h,v,g,y,b=0;b<t;){var _=e[b++],S=b===1;switch(S&&(i=e[b],o=e[b+1],s=i,l=o,(_===Ui.L||_===Ui.C||_===Ui.Q)&&(a=[s,l])),_){case Ui.M:i=s=e[b++],o=l=e[b++],u(s,l);break;case Ui.L:h=e[b++],v=e[b++],c(i,o,h,v),i=h,o=v;break;case Ui.C:a.push(e[b++],e[b++],e[b++],e[b++],i=e[b++],o=e[b++]);break;case Ui.Q:h=e[b++],v=e[b++],g=e[b++],y=e[b++],a.push(i+2/3*(h-i),o+2/3*(v-o),g+2/3*(h-g),y+2/3*(v-y),g,y),i=g,o=y;break;case Ui.A:var T=e[b++],C=e[b++],M=e[b++],D=e[b++],L=e[b++],k=e[b++]+L;b+=1;var R=!e[b++];h=Math.cos(L)*M+T,v=Math.sin(L)*D+C,S?(s=h,l=v,u(s,l)):c(i,o,h,v),i=Math.cos(k)*M+T,o=Math.sin(k)*D+C;for(var E=(R?-1:1)*Math.PI/2,I=L;R?I>k:I<k;I+=E){var z=R?Math.max(I+E,k):Math.min(I+E,k);f(I,z,T,C,M,D)}break;case Ui.R:s=i=e[b++],l=o=e[b++],h=s+e[b++],v=l+e[b++],u(h,l),c(h,l,h,v),c(h,v,s,v),c(s,v,s,l),c(s,l,h,l);break;case Ui.Z:a&&c(i,o,s,l),i=s,o=l;break}}return a&&a.length>2&&n.push(a),n}function tD(r,e,t,n,a,i,o,s,l,u){if(Vd(r,t)&&Vd(e,n)&&Vd(a,o)&&Vd(i,s)){l.push(o,s);return}var c=2/u,f=c*c,h=o-r,v=s-e,g=Math.sqrt(h*h+v*v);h/=g,v/=g;var y=t-r,b=n-e,_=a-o,S=i-s,T=y*y+b*b,C=_*_+S*S;if(T<f&&C<f){l.push(o,s);return}var M=h*y+v*b,D=-h*_-v*S,L=T-M*M,k=C-D*D;if(L<f&&M>=0&&k<f&&D>=0){l.push(o,s);return}var R=[],E=[];Zl(r,t,a,o,.5,R),Zl(e,n,i,s,.5,E),tD(R[0],E[0],R[1],E[1],R[2],E[2],R[3],E[3],l,u),tD(R[4],E[4],R[5],E[5],R[6],E[6],R[7],E[7],l,u)}function $Ce(r,e){var t=eD(r),n=[];e=e||1;for(var a=0;a<t.length;a++){var i=t[a],o=[],s=i[0],l=i[1];o.push(s,l);for(var u=2;u<i.length;){var c=i[u++],f=i[u++],h=i[u++],v=i[u++],g=i[u++],y=i[u++];tD(s,l,c,f,h,v,g,y,o,e),s=g,l=y}n.push(o)}return n}function JY(r,e,t){var n=r[e],a=r[1-e],i=Math.abs(n/a),o=Math.ceil(Math.sqrt(i*t)),s=Math.floor(t/o);s===0&&(s=1,o=t);for(var l=[],u=0;u<o;u++)l.push(s);var c=o*s,f=t-c;if(f>0)for(var u=0;u<f;u++)l[u%o]+=1;return l}function FV(r,e,t){for(var n=r.r0,a=r.r,i=r.startAngle,o=r.endAngle,s=Math.abs(o-i),l=s*a,u=a-n,c=l>Math.abs(u),f=JY([l,u],c?0:1,e),h=(c?s:u)/f.length,v=0;v<f.length;v++)for(var g=(c?u:s)/f[v],y=0;y<f[v];y++){var b={};c?(b.startAngle=i+h*v,b.endAngle=i+h*(v+1),b.r0=n+g*y,b.r=n+g*(y+1)):(b.startAngle=i+g*y,b.endAngle=i+g*(y+1),b.r0=n+h*v,b.r=n+h*(v+1)),b.clockwise=r.clockwise,b.cx=r.cx,b.cy=r.cy,t.push(b)}}function XCe(r,e,t){for(var n=r.width,a=r.height,i=n>a,o=JY([n,a],i?0:1,e),s=i?"width":"height",l=i?"height":"width",u=i?"x":"y",c=i?"y":"x",f=r[s]/o.length,h=0;h<o.length;h++)for(var v=r[l]/o[h],g=0;g<o[h];g++){var y={};y[u]=h*f,y[c]=g*v,y[s]=f,y[l]=v,y.x+=r.x,y.y+=r.y,t.push(y)}}function UV(r,e,t,n){return r*n-t*e}function qCe(r,e,t,n,a,i,o,s){var l=t-r,u=n-e,c=o-a,f=s-i,h=UV(c,f,l,u);if(Math.abs(h)<1e-6)return null;var v=r-a,g=e-i,y=UV(v,g,c,f)/h;return y<0||y>1?null:new ze(y*l+r,y*u+e)}function ZCe(r,e,t){var n=new ze;ze.sub(n,t,e),n.normalize();var a=new ze;ze.sub(a,r,e);var i=a.dot(n);return i}function Cd(r,e){var t=r[r.length-1];t&&t[0]===e[0]&&t[1]===e[1]||r.push(e)}function KCe(r,e,t){for(var n=r.length,a=[],i=0;i<n;i++){var o=r[i],s=r[(i+1)%n],l=qCe(o[0],o[1],s[0],s[1],e.x,e.y,t.x,t.y);l&&a.push({projPt:ZCe(l,e,t),pt:l,idx:i})}if(a.length<2)return[{points:r},{points:r}];a.sort(function(b,_){return b.projPt-_.projPt});var u=a[0],c=a[a.length-1];if(c.idx<u.idx){var f=u;u=c,c=f}for(var h=[u.pt.x,u.pt.y],v=[c.pt.x,c.pt.y],g=[h],y=[v],i=u.idx+1;i<=c.idx;i++)Cd(g,r[i].slice());Cd(g,v),Cd(g,h);for(var i=c.idx+1;i<=u.idx+n;i++)Cd(y,r[i%n].slice());return Cd(y,h),Cd(y,v),[{points:g},{points:y}]}function WV(r){var e=r.points,t=[],n=[];Gb(e,t,n);var a=new Be(t[0],t[1],n[0]-t[0],n[1]-t[1]),i=a.width,o=a.height,s=a.x,l=a.y,u=new ze,c=new ze;return i>o?(u.x=c.x=s+i/2,u.y=l,c.y=l+o):(u.y=c.y=l+o/2,u.x=s,c.x=s+i),KCe(e,u,c)}function cb(r,e,t,n){if(t===1)n.push(e);else{var a=Math.floor(t/2),i=r(e);cb(r,i[0],a,n),cb(r,i[1],t-a,n)}return n}function QCe(r,e){for(var t=[],n=0;n<e;n++)t.push(cN(r));return t}function JCe(r,e){e.setStyle(r.style),e.z=r.z,e.z2=r.z2,e.zlevel=r.zlevel}function eAe(r){for(var e=[],t=0;t<r.length;)e.push([r[t++],r[t++]]);return e}function tAe(r,e){var t=[],n=r.shape,a;switch(r.type){case"rect":XCe(n,e,t),a=rt;break;case"sector":FV(n,e,t),a=Tn;break;case"circle":FV({r0:0,r:n.r,startAngle:0,endAngle:Math.PI*2,cx:n.cx,cy:n.cy},e,t),a=Tn;break;default:var i=r.getComputedTransform(),o=i?Math.sqrt(Math.max(i[0]*i[0]+i[1]*i[1],i[2]*i[2]+i[3]*i[3])):1,s=ce($Ce(r.getUpdatedPathProxy(),o),function(_){return eAe(_)}),l=s.length;if(l===0)cb(WV,{points:s[0]},e,t);else if(l===e)for(var u=0;u<l;u++)t.push({points:s[u]});else{var c=0,f=ce(s,function(_){var S=[],T=[];Gb(_,S,T);var C=(T[1]-S[1])*(T[0]-S[0]);return c+=C,{poly:_,area:C}});f.sort(function(_,S){return S.area-_.area});for(var h=e,u=0;u<l;u++){var v=f[u];if(h<=0)break;var g=u===l-1?h:Math.ceil(v.area/c*e);g<0||(cb(WV,{points:v.poly},g,t),h-=g)}}a=Cn;break}if(!a)return QCe(r,e);for(var y=[],u=0;u<t.length;u++){var b=new a;b.setShape(t[u]),JCe(r,b),y.push(b)}return y}function rAe(r,e){var t=r.length,n=e.length;if(t===n)return[r,e];for(var a=[],i=[],o=t<n?r:e,s=Math.min(t,n),l=Math.abs(n-t)/6,u=(s-2)/6,c=Math.ceil(l/u)+1,f=[o[0],o[1]],h=l,v=2;v<s;){var g=o[v-2],y=o[v-1],b=o[v++],_=o[v++],S=o[v++],T=o[v++],C=o[v++],M=o[v++];if(h<=0){f.push(b,_,S,T,C,M);continue}for(var D=Math.min(h,c-1)+1,L=1;L<=D;L++){var k=L/D;Zl(g,b,S,C,k,a),Zl(y,_,T,M,k,i),g=a[3],y=i[3],f.push(a[1],i[1],a[2],i[2],g,y),b=a[5],_=i[5],S=a[6],T=i[6]}h-=D-1}return o===r?[f,e]:[r,f]}function YV(r,e){for(var t=r.length,n=r[t-2],a=r[t-1],i=[],o=0;o<e.length;)i[o++]=n,i[o++]=a;return i}function nAe(r,e){for(var t,n,a,i=[],o=[],s=0;s<Math.max(r.length,e.length);s++){var l=r[s],u=e[s],c=void 0,f=void 0;l?u?(t=rAe(l,u),c=t[0],f=t[1],n=c,a=f):(f=YV(a||l,l),c=l):(c=YV(n||u,u),f=u),i.push(c),o.push(f)}return[i,o]}function $V(r){for(var e=0,t=0,n=0,a=r.length,i=0,o=a-2;i<a;o=i,i+=2){var s=r[o],l=r[o+1],u=r[i],c=r[i+1],f=s*c-u*l;e+=f,t+=(s+u)*f,n+=(l+c)*f}return e===0?[r[0]||0,r[1]||0]:[t/e/3,n/e/3,e]}function aAe(r,e,t,n){for(var a=(r.length-2)/6,i=1/0,o=0,s=r.length,l=s-2,u=0;u<a;u++){for(var c=u*6,f=0,h=0;h<s;h+=2){var v=h===0?c:(c+h-2)%l+2,g=r[v]-t[0],y=r[v+1]-t[1],b=e[h]-n[0],_=e[h+1]-n[1],S=b-g,T=_-y;f+=S*S+T*T}f<i&&(i=f,o=u)}return o}function iAe(r){for(var e=[],t=r.length,n=0;n<t;n+=2)e[n]=r[t-n-2],e[n+1]=r[t-n-1];return e}function oAe(r,e,t,n){for(var a=[],i,o=0;o<r.length;o++){var s=r[o],l=e[o],u=$V(s),c=$V(l);i==null&&(i=u[2]<0!=c[2]<0);var f=[],h=[],v=0,g=1/0,y=[],b=s.length;i&&(s=iAe(s));for(var _=aAe(s,l,u,c)*6,S=b-2,T=0;T<S;T+=2){var C=(_+T)%S+2;f[T+2]=s[C]-u[0],f[T+3]=s[C+1]-u[1]}f[0]=s[_]-u[0],f[1]=s[_+1]-u[1];for(var M=n/t,D=-n/2;D<=n/2;D+=M){for(var L=Math.sin(D),k=Math.cos(D),R=0,T=0;T<s.length;T+=2){var E=f[T],I=f[T+1],z=l[T]-c[0],j=l[T+1]-c[1],G=z*k-j*L,U=z*L+j*k;y[T]=G,y[T+1]=U;var O=G-E,H=U-I;R+=O*O+H*H}if(R<g){g=R,v=D;for(var F=0;F<y.length;F++)h[F]=y[F]}}a.push({from:f,to:h,fromCp:u,toCp:c,rotation:-v})}return a}function fb(r){return r.__isCombineMorphing}var e$="__mOriginal_";function db(r,e,t){var n=e$+e,a=r[n]||r[e];r[n]||(r[n]=r[e]);var i=t.replace,o=t.after,s=t.before;r[e]=function(){var l=arguments,u;return s&&s.apply(this,l),i?u=i.apply(this,l):u=a.apply(this,l),o&&o.apply(this,l),u}}function pg(r,e){var t=e$+e;r[t]&&(r[e]=r[t],r[t]=null)}function XV(r,e){for(var t=0;t<r.length;t++)for(var n=r[t],a=0;a<n.length;){var i=n[a],o=n[a+1];n[a++]=e[0]*i+e[2]*o+e[4],n[a++]=e[1]*i+e[3]*o+e[5]}}function t$(r,e){var t=r.getUpdatedPathProxy(),n=e.getUpdatedPathProxy(),a=nAe(eD(t),eD(n)),i=a[0],o=a[1],s=r.getComputedTransform(),l=e.getComputedTransform();function u(){this.transform=null}s&&XV(i,s),l&&XV(o,l),db(e,"updateTransform",{replace:u}),e.transform=null;var c=oAe(i,o,10,Math.PI),f=[];db(e,"buildPath",{replace:function(h){for(var v=e.__morphT,g=1-v,y=[],b=0;b<c.length;b++){var _=c[b],S=_.from,T=_.to,C=_.rotation*v,M=_.fromCp,D=_.toCp,L=Math.sin(C),k=Math.cos(C);ng(y,M,D,v);for(var R=0;R<S.length;R+=2){var E=S[R],I=S[R+1],z=T[R],j=T[R+1],G=E*g+z*v,U=I*g+j*v;f[R]=G*k-U*L+y[0],f[R+1]=G*L+U*k+y[1]}var O=f[0],H=f[1];h.moveTo(O,H);for(var R=2;R<S.length;){var z=f[R++],j=f[R++],F=f[R++],$=f[R++],B=f[R++],X=f[R++];O===z&&H===j&&F===B&&$===X?h.lineTo(B,X):h.bezierCurveTo(z,j,F,$,B,X),O=B,H=X}}}})}function gk(r,e,t){if(!r||!e)return e;var n=t.done,a=t.during;t$(r,e),e.__morphT=0;function i(){pg(e,"buildPath"),pg(e,"updateTransform"),e.__morphT=-1,e.createPathProxy(),e.dirtyShape()}return e.animateTo({__morphT:1},Ie({during:function(o){e.dirtyShape(),a&&a(o)},done:function(){i(),n&&n()}},t)),e}function sAe(r,e,t,n,a,i){var o=16;r=a===t?0:Math.round(32767*(r-t)/(a-t)),e=i===n?0:Math.round(32767*(e-n)/(i-n));for(var s=0,l,u=(1<<o)/2;u>0;u/=2){var c=0,f=0;(r&u)>0&&(c=1),(e&u)>0&&(f=1),s+=u*u*(3*c^f),f===0&&(c===1&&(r=u-1-r,e=u-1-e),l=r,r=e,e=l)}return s}function hb(r){var e=1/0,t=1/0,n=-1/0,a=-1/0,i=ce(r,function(s){var l=s.getBoundingRect(),u=s.getComputedTransform(),c=l.x+l.width/2+(u?u[4]:0),f=l.y+l.height/2+(u?u[5]:0);return e=Math.min(c,e),t=Math.min(f,t),n=Math.max(c,n),a=Math.max(f,a),[c,f]}),o=ce(i,function(s,l){return{cp:s,z:sAe(s[0],s[1],e,t,n,a),path:r[l]}});return o.sort(function(s,l){return s.z-l.z}).map(function(s){return s.path})}function r$(r){return tAe(r.path,r.count)}function rD(){return{fromIndividuals:[],toIndividuals:[],count:0}}function lAe(r,e,t){var n=[];function a(M){for(var D=0;D<M.length;D++){var L=M[D];fb(L)?a(L.childrenRef()):L instanceof ct&&n.push(L)}}a(r);var i=n.length;if(!i)return rD();var o=t.dividePath||r$,s=o({path:e,count:i});if(s.length!==i)return console.error("Invalid morphing: unmatched splitted path"),rD();n=hb(n),s=hb(s);for(var l=t.done,u=t.during,c=t.individualDelay,f=new ss,h=0;h<i;h++){var v=n[h],g=s[h];g.parent=e,g.copyTransform(f),c||t$(v,g)}e.__isCombineMorphing=!0,e.childrenRef=function(){return s};function y(M){for(var D=0;D<s.length;D++)s[D].addSelfToZr(M)}db(e,"addSelfToZr",{after:function(M){y(M)}}),db(e,"removeSelfFromZr",{after:function(M){for(var D=0;D<s.length;D++)s[D].removeSelfFromZr(M)}});function b(){e.__isCombineMorphing=!1,e.__morphT=-1,e.childrenRef=null,pg(e,"addSelfToZr"),pg(e,"removeSelfFromZr")}var _=s.length;if(c)for(var S=_,T=function(){S--,S===0&&(b(),l&&l())},h=0;h<_;h++){var C=c?Ie({delay:(t.delay||0)+c(h,_,n[h],s[h]),done:T},t):t;gk(n[h],s[h],C)}else e.__morphT=0,e.animateTo({__morphT:1},Ie({during:function(M){for(var D=0;D<_;D++){var L=s[D];L.__morphT=e.__morphT,L.dirtyShape()}u&&u(M)},done:function(){b();for(var M=0;M<r.length;M++)pg(r[M],"updateTransform");l&&l()}},t));return e.__zr&&y(e.__zr),{fromIndividuals:n,toIndividuals:s,count:_}}function uAe(r,e,t){var n=e.length,a=[],i=t.dividePath||r$;function o(v){for(var g=0;g<v.length;g++){var y=v[g];fb(y)?o(y.childrenRef()):y instanceof ct&&a.push(y)}}if(fb(r)){o(r.childrenRef());var s=a.length;if(s<n)for(var l=0,u=s;u<n;u++)a.push(cN(a[l++%s]));a.length=n}else{a=i({path:r,count:n});for(var c=r.getComputedTransform(),u=0;u<a.length;u++)a[u].setLocalTransform(c);if(a.length!==n)return console.error("Invalid morphing: unmatched splitted path"),rD()}a=hb(a),e=hb(e);for(var f=t.individualDelay,u=0;u<n;u++){var h=f?Ie({delay:(t.delay||0)+f(u,n,a[u],e[u])},t):t;gk(a[u],e[u],h)}return{fromIndividuals:a,toIndividuals:e,count:e.length}}function qV(r){return ue(r[0])}function ZV(r,e){for(var t=[],n=r.length,a=0;a<n;a++)t.push({one:r[a],many:[]});for(var a=0;a<e.length;a++){var i=e[a].length,o=void 0;for(o=0;o<i;o++)t[o%n].many.push(e[a][o])}for(var s=0,a=n-1;a>=0;a--)if(!t[a].many.length){var l=t[s].many;if(l.length<=1)if(s)s=0;else return t;var i=l.length,u=Math.ceil(i/2);t[a].many=l.slice(u,i),t[s].many=l.slice(0,u),s++}return t}var cAe={clone:function(r){for(var e=[],t=1-Math.pow(1-r.path.style.opacity,1/r.count),n=0;n<r.count;n++){var a=cN(r.path);a.setStyle("opacity",t),e.push(a)}return e},split:null};function fC(r,e,t,n,a,i){if(!r.length||!e.length)return;var o=jh("update",n,a);if(!(o&&o.duration>0))return;var s=n.getModel("universalTransition").get("delay"),l=Object.assign({setToFinal:!0},o),u,c;qV(r)&&(u=r,c=e),qV(e)&&(u=e,c=r);function f(_,S,T,C,M){var D=_.many,L=_.one;if(D.length===1&&!M){var k=S?D[0]:L,R=S?L:D[0];if(fb(k))f({many:[k],one:R},!0,T,C,!0);else{var E=s?Ie({delay:s(T,C)},l):l;gk(k,R,E),i(k,R,k,R,E)}}else for(var I=Ie({dividePath:cAe[t],individualDelay:s&&function(H,F,$,B){return s(H+T,C)}},l),z=S?lAe(D,L,I):uAe(L,D,I),j=z.fromIndividuals,G=z.toIndividuals,U=j.length,O=0;O<U;O++){var E=s?Ie({delay:s(O,U)},l):l;i(j[O],G[O],S?D[O]:_.one,S?_.one:D[O],E)}}for(var h=u?u===r:r.length>e.length,v=u?ZV(c,u):ZV(h?e:r,[h?r:e]),g=0,y=0;y<v.length;y++)g+=v[y].many.length;for(var b=0,y=0;y<v.length;y++)f(v[y],h,b,g),b+=v[y].many.length}function lc(r){if(!r)return[];if(ue(r)){for(var e=[],t=0;t<r.length;t++)e.push(lc(r[t]));return e}var n=[];return r.traverse(function(a){a instanceof ct&&!a.disableMorphing&&!a.invisible&&!a.ignore&&n.push(a)}),n}var n$=1e4,fAe=0,KV=1,QV=2,dAe=st();function hAe(r,e){for(var t=r.dimensions,n=0;n<t.length;n++){var a=r.getDimensionInfo(t[n]);if(a&&a.otherDims[e]===0)return t[n]}}function vAe(r,e,t){var n=r.getDimensionInfo(t),a=n&&n.ordinalMeta;if(n){var i=r.get(n.name,e);return a&&a.categories[i]||i+""}}function JV(r,e,t,n){var a=n?"itemChildGroupId":"itemGroupId",i=hAe(r,a);if(i){var o=vAe(r,e,i);return o}var s=r.getRawDataItem(e),l=n?"childGroupId":"groupId";if(s&&s[l])return s[l]+"";if(!n)return t||r.getId(e)}function eG(r){var e=[];return P(r,function(t){var n=t.data,a=t.dataGroupId;if(!(n.count()>n$))for(var i=n.getIndices(),o=0;o<i.length;o++)e.push({data:n,groupId:JV(n,o,a,!1),childGroupId:JV(n,o,a,!0),divide:t.divide,dataIndex:o})}),e}function dC(r,e,t){r.traverse(function(n){n instanceof ct&&Kt(n,{style:{opacity:0}},e,{dataIndex:t,isFrom:!0})})}function hC(r){if(r.parent){var e=r.getComputedTransform();r.setLocalTransform(e),r.parent.remove(r)}}function Ad(r){r.stopAnimation(),r.isGroup&&r.traverse(function(e){e.stopAnimation()})}function pAe(r,e,t){var n=jh("update",t,e);n&&r.traverse(function(a){if(a instanceof ni){var i=Rue(a);i&&a.animateFrom({style:i},n)}})}function gAe(r,e){var t=r.length;if(t!==e.length)return!1;for(var n=0;n<t;n++){var a=r[n],i=e[n];if(a.data.getId(a.dataIndex)!==i.data.getId(i.dataIndex))return!1}return!0}function a$(r,e,t){var n=eG(r),a=eG(e);function i(T,C,M,D,L){(M||T)&&C.animateFrom({style:M&&M!==T?oe(oe({},M.style),T.style):T.style},L)}var o=!1,s=fAe,l=Ae(),u=Ae();n.forEach(function(T){T.groupId&&l.set(T.groupId,!0),T.childGroupId&&u.set(T.childGroupId,!0)});for(var c=0;c<a.length;c++){var f=a[c].groupId;if(u.get(f)){s=KV;break}var h=a[c].childGroupId;if(h&&l.get(h)){s=QV;break}}function v(T,C){return function(M){var D=M.data,L=M.dataIndex;return C?D.getId(L):T?s===KV?M.childGroupId:M.groupId:s===QV?M.childGroupId:M.groupId}}var g=gAe(n,a),y={};if(!g)for(var c=0;c<a.length;c++){var b=a[c],_=b.data.getItemGraphicEl(b.dataIndex);_&&(y[_.id]=!0)}function S(T,C){var M=n[C],D=a[T],L=D.data.hostModel,k=M.data.getItemGraphicEl(M.dataIndex),R=D.data.getItemGraphicEl(D.dataIndex);if(k===R){R&&pAe(R,D.dataIndex,L);return}k&&y[k.id]||R&&(Ad(R),k?(Ad(k),hC(k),o=!0,fC(lc(k),lc(R),D.divide,L,T,i)):dC(R,L,T))}new Ss(n,a,v(!0,g),v(!1,g),null,"multiple").update(S).updateManyToOne(function(T,C){var M=a[T],D=M.data,L=D.hostModel,k=D.getItemGraphicEl(M.dataIndex),R=At(ce(C,function(E){return n[E].data.getItemGraphicEl(n[E].dataIndex)}),function(E){return E&&E!==k&&!y[E.id]});k&&(Ad(k),R.length?(P(R,function(E){Ad(E),hC(E)}),o=!0,fC(lc(R),lc(k),M.divide,L,T,i)):dC(k,L,M.dataIndex))}).updateOneToMany(function(T,C){var M=n[C],D=M.data.getItemGraphicEl(M.dataIndex);if(!(D&&y[D.id])){var L=At(ce(T,function(R){return a[R].data.getItemGraphicEl(a[R].dataIndex)}),function(R){return R&&R!==D}),k=a[T[0]].data.hostModel;L.length&&(P(L,function(R){return Ad(R)}),D?(Ad(D),hC(D),o=!0,fC(lc(D),lc(L),M.divide,k,T[0],i)):P(L,function(R){return dC(R,k,T[0])}))}}).updateManyToMany(function(T,C){new Ss(C,T,function(M){return n[M].data.getId(n[M].dataIndex)},function(M){return a[M].data.getId(a[M].dataIndex)}).update(function(M,D){S(T[M],C[D])}).execute()}).execute(),o&&P(e,function(T){var C=T.data,M=C.hostModel,D=M&&t.getViewOfSeriesModel(M),L=jh("update",M,0);D&&M.isAnimationEnabled()&&L&&L.duration>0&&D.group.traverse(function(k){k instanceof ct&&!k.animators.length&&k.animateFrom({style:{opacity:0}},L)})})}function tG(r){var e=r.getModel("universalTransition").get("seriesKey");return e||r.id}function rG(r){return ue(r)?r.sort().join(","):r}function xl(r){if(r.hostModel)return r.hostModel.getModel("universalTransition").get("divideShape")}function mAe(r,e){var t=Ae(),n=Ae(),a=Ae();return P(r.oldSeries,function(i,o){var s=r.oldDataGroupIds[o],l=r.oldData[o],u=tG(i),c=rG(u);n.set(c,{dataGroupId:s,data:l}),ue(u)&&P(u,function(f){a.set(f,{key:c,dataGroupId:s,data:l})})}),P(e.updatedSeries,function(i){if(i.isUniversalTransitionEnabled()&&i.isAnimationEnabled()){var o=i.get("dataGroupId"),s=i.getData(),l=tG(i),u=rG(l),c=n.get(u);if(c)t.set(u,{oldSeries:[{dataGroupId:c.dataGroupId,divide:xl(c.data),data:c.data}],newSeries:[{dataGroupId:o,divide:xl(s),data:s}]});else if(ue(l)){var f=[];P(l,function(g){var y=n.get(g);y.data&&f.push({dataGroupId:y.dataGroupId,divide:xl(y.data),data:y.data})}),f.length&&t.set(u,{oldSeries:f,newSeries:[{dataGroupId:o,data:s,divide:xl(s)}]})}else{var h=a.get(l);if(h){var v=t.get(h.key);v||(v={oldSeries:[{dataGroupId:h.dataGroupId,data:h.data,divide:xl(h.data)}],newSeries:[]},t.set(h.key,v)),v.newSeries.push({dataGroupId:o,data:s,divide:xl(s)})}}}}),t}function nG(r,e){for(var t=0;t<r.length;t++){var n=e.seriesIndex!=null&&e.seriesIndex===r[t].seriesIndex||e.seriesId!=null&&e.seriesId===r[t].id;if(n)return t}}function yAe(r,e,t,n){var a=[],i=[];P(Ht(r.from),function(o){var s=nG(e.oldSeries,o);s>=0&&a.push({dataGroupId:e.oldDataGroupIds[s],data:e.oldData[s],divide:xl(e.oldData[s]),groupIdDim:o.dimension})}),P(Ht(r.to),function(o){var s=nG(t.updatedSeries,o);if(s>=0){var l=t.updatedSeries[s].getData();i.push({dataGroupId:e.oldDataGroupIds[s],data:l,divide:xl(l),groupIdDim:o.dimension})}}),a.length>0&&i.length>0&&a$(a,i,n)}function xAe(r){r.registerUpdateLifecycle("series:beforeupdate",function(e,t,n){P(Ht(n.seriesTransition),function(a){P(Ht(a.to),function(i){for(var o=n.updatedSeries,s=0;s<o.length;s++)(i.seriesIndex!=null&&i.seriesIndex===o[s].seriesIndex||i.seriesId!=null&&i.seriesId===o[s].id)&&(o[s][zx]=!0)})})}),r.registerUpdateLifecycle("series:transition",function(e,t,n){var a=dAe(t);if(a.oldSeries&&n.updatedSeries&&n.optionChanged){var i=n.seriesTransition;if(i)P(Ht(i),function(v){yAe(v,a,n,t)});else{var o=mAe(a,n);P(o.keys(),function(v){var g=o.get(v);a$(g.oldSeries,g.newSeries,t)})}P(n.updatedSeries,function(v){v[zx]&&(v[zx]=!1)})}for(var s=e.getSeries(),l=a.oldSeries=[],u=a.oldDataGroupIds=[],c=a.oldData=[],f=0;f<s.length;f++){var h=s[f].getData();h.count()<n$&&(l.push(s[f]),u.push(s[f].get("dataGroupId")),c.push(h))}})}var bAe=(function(){function r(){this.breaks=[],this._elapsedExtent=[1/0,-1/0]}return r.prototype.setBreaks=function(e){this.breaks=e.breaks},r.prototype.update=function(e){SAe(this,e);var t=this._elapsedExtent;t[0]=this.elapse(e[0]),t[1]=this.elapse(e[1])},r.prototype.hasBreaks=function(){return!!this.breaks.length},r.prototype.calcNiceTickMultiple=function(e,t){for(var n=0;n<this.breaks.length;n++){var a=this.breaks[n];if(a.vmin<e&&e<a.vmax){var i=t(e,a.vmax);return i}}return 0},r.prototype.getExtentSpan=function(){return this._elapsedExtent[1]-this._elapsedExtent[0]},r.prototype.normalize=function(e){var t=this._elapsedExtent[1]-this._elapsedExtent[0];return t===0?.5:(this.elapse(e)-this._elapsedExtent[0])/t},r.prototype.scale=function(e){return this.unelapse(e*(this._elapsedExtent[1]-this._elapsedExtent[0])+this._elapsedExtent[0])},r.prototype.elapse=function(e){for(var t=aG,n=iG,a=!0,i=0;i<this.breaks.length;i++){var o=this.breaks[i];if(e<=o.vmax){e>o.vmin?t+=o.vmin-n+(e-o.vmin)/(o.vmax-o.vmin)*o.gapReal:t+=e-n,n=o.vmax,a=!1;break}t+=o.vmin-n+o.gapReal,n=o.vmax}return a&&(t+=e-n),t},r.prototype.unelapse=function(e){for(var t=aG,n=iG,a=!0,i=0,o=0;o<this.breaks.length;o++){var s=this.breaks[o],l=t+s.vmin-n,u=l+s.gapReal;if(e<=u){e>l?i=s.vmin+(e-l)/(u-l)*(s.vmax-s.vmin):i=n+e-t,n=s.vmax,a=!1;break}t=u,n=s.vmax}return a&&(i=n+e-t),i},r})();function _Ae(){return new bAe}var aG=0,iG=0;function SAe(r,e){var t=0,n={tpAbs:{span:0,val:0},tpPrct:{span:0,val:0}},a=function(){return{has:!1,span:NaN,inExtFrac:NaN,val:NaN}},i={S:{tpAbs:a(),tpPrct:a()},E:{tpAbs:a(),tpPrct:a()}};P(r.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(t+=l.val);var u=mk(s,e);if(u){var c=u.vmin!==s.vmin,f=u.vmax!==s.vmax,h=u.vmax-u.vmin;if(!(c&&f))if(c||f){var v=c?"S":"E";i[v][l.type].has=!0,i[v][l.type].span=h,i[v][l.type].inExtFrac=h/(s.vmax-s.vmin),i[v][l.type].val=l.val}else n[l.type].span+=h,n[l.type].val+=l.val}});var o=t*(0+(e[1]-e[0])+(n.tpAbs.val-n.tpAbs.span)+(i.S.tpAbs.has?(i.S.tpAbs.val-i.S.tpAbs.span)*i.S.tpAbs.inExtFrac:0)+(i.E.tpAbs.has?(i.E.tpAbs.val-i.E.tpAbs.span)*i.E.tpAbs.inExtFrac:0)-n.tpPrct.span-(i.S.tpPrct.has?i.S.tpPrct.span*i.S.tpPrct.inExtFrac:0)-(i.E.tpPrct.has?i.E.tpPrct.span*i.E.tpPrct.inExtFrac:0))/(1-n.tpPrct.val-(i.S.tpPrct.has?i.S.tpPrct.val*i.S.tpPrct.inExtFrac:0)-(i.E.tpPrct.has?i.E.tpPrct.val*i.E.tpPrct.inExtFrac:0));P(r.breaks,function(s){var l=s.gapParsed;l.type==="tpPrct"&&(s.gapReal=t!==0?Math.max(o,0)*l.val/t:0),l.type==="tpAbs"&&(s.gapReal=l.val),s.gapReal==null&&(s.gapReal=0)})}function wAe(r,e,t,n,a,i){r!=="no"&&P(t,function(o){var s=mk(o,i);if(s)for(var l=e.length-1;l>=0;l--){var u=e[l],c=n(u),f=a*3/4;c>s.vmin-f&&c<s.vmax+f&&(r!=="preserve_extent_bound"||c!==i[0]&&c!==i[1])&&e.splice(l,1)}})}function TAe(r,e,t,n){P(e,function(a){var i=mk(a,t);i&&(r.push({value:i.vmin,break:{type:"vmin",parsedBreak:i},time:n?n(i):void 0}),r.push({value:i.vmax,break:{type:"vmax",parsedBreak:i},time:n?n(i):void 0}))}),e.length&&r.sort(function(a,i){return a.value-i.value})}function mk(r,e){var t=Math.max(r.vmin,e[0]),n=Math.min(r.vmax,e[1]);return t<n||t===n&&t>e[0]&&t<e[1]?{vmin:t,vmax:n,breakOption:r.breakOption,gapParsed:r.gapParsed,gapReal:r.gapReal}:null}function nD(r,e,t){var n=[];if(!r)return{breaks:n};function a(o,s){return o>=0&&o<1-1e-5}P(r,function(o){if(!(!o||o.start==null||o.end==null)&&!o.isExpanded){var s={breakOption:ke(o),vmin:e(o.start),vmax:e(o.end),gapParsed:{type:"tpAbs",val:0},gapReal:null};if(o.gap!=null){var l=!1;if(_e(o.gap)){var u=wa(o.gap);if(u.match(/%$/)){var c=parseFloat(u)/100;a(c)||(c=0),s.gapParsed.type="tpPrct",s.gapParsed.val=c,l=!0}}if(!l){var f=e(o.gap);(!isFinite(f)||f<0)&&(f=0),s.gapParsed.type="tpAbs",s.gapParsed.val=f}}if(s.vmin===s.vmax&&(s.gapParsed.type="tpAbs",s.gapParsed.val=0),t&&t.noNegative&&P(["vmin","vmax"],function(v){s[v]<0&&(s[v]=0)}),s.vmin>s.vmax){var h=s.vmax;s.vmax=s.vmin,s.vmin=h}n.push(s)}}),n.sort(function(o,s){return o.vmin-s.vmin});var i=-1/0;return P(n,function(o,s){i>o.vmin&&(n[s]=null),i=o.vmax}),{breaks:n.filter(function(o){return!!o})}}function yk(r,e){return aD(e)===aD(r)}function aD(r){return r.start+"_\0_"+r.end}function CAe(r,e,t){var n=[];P(r,function(i,o){var s=e(i);s&&s.type==="vmin"&&n.push([o])}),P(r,function(i,o){var s=e(i);if(s&&s.type==="vmax"){var l=au(n,function(u){return yk(e(r[u[0]]).parsedBreak.breakOption,s.parsedBreak.breakOption)});l&&l.push(o)}});var a=[];return P(n,function(i){i.length===2&&a.push(t?i:[r[i[0]],r[i[1]]])}),a}function AAe(r,e,t,n){var a,i;if(r.break){var o=r.break.parsedBreak,s=au(t,function(f){return yk(f.breakOption,r.break.parsedBreak.breakOption)}),l=n(Math.pow(e,o.vmin),s.vmin),u=n(Math.pow(e,o.vmax),s.vmax),c={type:o.gapParsed.type,val:o.gapParsed.type==="tpAbs"?Tr(Math.pow(e,o.vmin+o.gapParsed.val))-l:o.gapParsed.val};a={type:r.break.type,parsedBreak:{breakOption:o.breakOption,vmin:l,vmax:u,gapParsed:c,gapReal:o.gapReal}},i=s[r.break.type]}return{brkRoundingCriterion:i,vBreak:a}}function MAe(r,e,t){var n={noNegative:!0},a=nD(r,t,n),i=nD(r,t,n),o=Math.log(e);return i.breaks=ce(i.breaks,function(s){var l=Math.log(s.vmin)/o,u=Math.log(s.vmax)/o,c={type:s.gapParsed.type,val:s.gapParsed.type==="tpAbs"?Math.log(s.vmin+s.gapParsed.val)/o-l:s.gapParsed.val};return{vmin:l,vmax:u,gapParsed:c,gapReal:s.gapReal,breakOption:s.breakOption}}),{parsedOriginal:a,parsedLogged:i}}var DAe={vmin:"start",vmax:"end"};function NAe(r,e){return e&&(r=r||{},r.break={type:DAe[e.type],start:e.parsedBreak.vmin,end:e.parsedBreak.vmax}),r}function LAe(){Que({createScaleBreakContext:_Ae,pruneTicksByBreak:wAe,addBreaksToTicks:TAe,parseAxisBreakOption:nD,identifyAxisBreak:yk,serializeAxisBreakIdentifier:aD,retrieveAxisBreakPairs:CAe,getTicksLogTransformBreak:AAe,logarithmicParseBreaksFromOption:MAe,makeAxisLabelFormatterParamBreak:NAe})}var oG=st();function kAe(r,e){var t=au(r,function(n){return Rr().identifyAxisBreak(n.parsedBreak.breakOption,e.breakOption)});return t||r.push(t={zigzagRandomList:[],parsedBreak:e,shouldRemove:!1}),t}function RAe(r){P(r,function(e){return e.shouldRemove=!0})}function EAe(r){for(var e=r.length-1;e>=0;e--)r[e].shouldRemove&&r.splice(e,1)}function IAe(r,e,t,n,a){var i=t.axis;if(i.scale.isBlank()||!Rr())return;var o=Rr().retrieveAxisBreakPairs(i.scale.getTicks({breakTicks:"only_break"}),function(R){return R.break},!1);if(!o.length)return;var s=t.getModel("breakArea"),l=s.get("zigzagAmplitude"),u=s.get("zigzagMinSpan"),c=s.get("zigzagMaxSpan");u=Math.max(2,u||0),c=Math.max(u,c||0);var f=s.get("expandOnClick"),h=s.get("zigzagZ"),v=s.getModel("itemStyle"),g=v.getItemStyle(),y=g.stroke,b=g.lineWidth,_=g.lineDash,S=g.fill,T=new Re({ignoreModelZ:!0}),C=i.isHorizontal(),M=oG(e).visualList||(oG(e).visualList=[]);RAe(M);for(var D=function(R){var E=o[R][0].break.parsedBreak,I=[];I[0]=i.toGlobalCoord(i.dataToCoord(E.vmin,!0)),I[1]=i.toGlobalCoord(i.dataToCoord(E.vmax,!0)),I[1]<I[0]&&I.reverse();var z=kAe(M,E);z.shouldRemove=!1;var j=new Re;k(z.zigzagRandomList,j,I[0],I[1],C,E),f&&j.on("click",function(){var G={type:a_,breaks:[{start:E.breakOption.start,end:E.breakOption.end}]};G[i.dim+"AxisIndex"]=t.componentIndex,a.dispatchAction(G)}),j.silent=!f,T.add(j)},L=0;L<o.length;L++)D(L);r.add(T),EAe(M);function k(R,E,I,z,j,G){var U={stroke:y,lineWidth:b,lineDash:_,fill:"none"},O=j?0:1,H=1-O,F=n[Ye[H]]+n[Er[H]];function $($e){var We=[],lt=[];We[O]=lt[O]=$e,We[H]=n[Ye[H]],lt[H]=F;var vt={x1:We[0],y1:We[1],x2:lt[0],y2:lt[1]};return Fb(vt,vt,{lineWidth:1}),We[0]=vt.x1,We[1]=vt.y1,We[O]}I=$(I),z=$(z);for(var B=[],X=[],q=!0,Q=n[Ye[H]],ne=0;;ne++){var fe=Q===n[Ye[H]],ve=Q>=F;ve&&(Q=F);var Se=[],ge=[];Se[O]=I,ge[O]=z,!fe&&!ve&&(Se[O]+=q?-l:l,ge[O]-=q?l:-l),Se[H]=Q,ge[H]=Q,B.push(Se),X.push(ge);var he=void 0;if(ne<R.length?he=R[ne]:(he=Math.random(),R.push(he)),Q+=he*(c-u)+u,q=!q,ve)break}var Ne=Rr().serializeAxisBreakIdentifier(G.breakOption);if(E.add(new dn({anid:"break_a_"+Ne,shape:{points:B},style:U,z:h})),G.gapReal!==0){E.add(new dn({anid:"break_b_"+Ne,shape:{points:X},style:U,z:h}));var xe=X.slice();xe.reverse();var Te=B.concat(xe);E.add(new Cn({anid:"break_c_"+Ne,shape:{points:Te},style:{fill:S,opacity:g.opacity},z:h}))}}}function OAe(r,e,t,n){var a=r.axis,i=t.transform;wn(n.style);var o=a.getExtent();a.inverse&&(o=o.slice(),o.reverse());var s=Rr().retrieveAxisBreakPairs(a.scale.getTicks({breakTicks:"only_break"}),function(b){return b.break},!1),l=ce(s,function(b){var _=b[0].break.parsedBreak,S=[a.dataToCoord(_.vmin,!0),a.dataToCoord(_.vmax,!0)];return S[0]>S[1]&&S.reverse(),{coordPair:S,brkId:Rr().serializeAxisBreakIdentifier(_.breakOption)}});l.sort(function(b,_){return b.coordPair[0]-_.coordPair[0]});for(var u=o[0],c=null,f=0;f<l.length;f++){var h=l[f],v=Math.max(h.coordPair[0],o[0]),g=Math.min(h.coordPair[1],o[1]);u<=v&&y(u,v,c,h),u=g,c=h}u<=o[1]&&y(u,o[1],c,null);function y(b,_,S,T){function C(I,z){i&&(pr(I,I,i),pr(z,z,i))}function M(I,z){var j={x1:I[0],y1:I[1],x2:z[0],y2:z[1]};Fb(j,j,n.style),I[0]=j.x1,I[1]=j.y1,z[0]=j.x2,z[1]=j.y2}var D=[b,0],L=[_,0],k=[b,5],R=[_,5];C(D,k),M(D,k),C(L,R),M(L,R),M(D,L);var E=new Cr(oe({shape:{x1:D[0],y1:D[1],x2:L[0],y2:L[1]}},n));e.add(E),E.anid="breakLine_"+(S?S.brkId:"\0")+"_\0_"+(T?T.brkId:"\0")}}function PAe(r,e,t){if(au(t,function(S){return!S}))return;var n=new ze;if(!r_(t[0],t[1],n,{direction:-(r?e+Math.PI:e),touchThreshold:0,bidirectional:!1}))return;var a=Kr();Ms(a,a,-e);var i=ce(t,function(S){return S.transform?bi(Kr(),a,S.transform):a});function o(S){var T=t[0].localRect,C=new ze(T[Er[S]]*i[0][0],T[Er[S]]*i[0][1]);return Math.abs(C.y)<1e-5}var s=.5;if(o(0)||o(1)){var l=ce(t,function(S,T){var C=S.localRect.clone();return C.applyTransform(i[T]),C}),u=new ze;u.copy(t[0].label).add(t[1].label).scale(.5),u.transform(a);var c=n.clone().transform(a),f=l[0].x+l[1].x+(c.x>=0?l[0].width:l[1].width),h=(f+c.x)/2-u.x,v=Math.min(h,h-c.x),g=Math.max(h,h-c.x),y=g<0?g:v>0?v:0;s=(h-y)/c.x}var b=new ze,_=new ze;ze.scale(b,n,-s),ze.scale(_,n,1-s),iM(t[0],b),iM(t[1],_)}function jAe(r,e){var t={breaks:[]};return P(e.breaks,function(n){if(n){var a=au(r.get("breaks",!0),function(s){return Rr().identifyAxisBreak(s,n)});if(a){var i=e.type,o={isExpanded:!!a.isExpanded};a.isExpanded=i===a_?!0:i===C9?!1:i===A9?!a.isExpanded:a.isExpanded,t.breaks.push({start:a.start,end:a.end,isExpanded:!!a.isExpanded,old:o})}}}),t}function zAe(){Ege({adjustBreakLabelPair:PAe,buildAxisBreakLine:OAe,rectCoordBuildBreakAxis:IAe,updateModelAxisBreak:jAe})}function BAe(r){Bge(r),LAe(),zAe()}function VAe(){ome(GAe)}function GAe(r,e){P(r,function(t){if(!t.model.get(["axisLabel","inside"])){var n=HAe(t);if(n){var a=t.isHorizontal()?"height":"width",i=t.model.get(["axisLabel","margin"]);e[a]-=n[a]+i,t.position==="top"?e.y+=n.height+i:t.position==="left"&&(e.x+=n.width+i)}}})}function HAe(r){var e=r.model,t=r.scale;if(!e.get(["axisLabel","show"])||t.isBlank())return;var n,a,i=t.getExtent();t instanceof bh?a=t.count():(n=t.getTicks(),a=n.length);var o=r.getLabelModel(),s=$h(r),l,u=1;a>40&&(u=Math.ceil(a/40));for(var c=0;c<a;c+=u){var f=n?n[c]:{value:i[0]+c},h=s(f,c),v=o.getTextRect(h),g=y(v,o.get("rotate")||0);l?l.union(g):l=g}return l;function y(b,_){var S=_*Math.PI/180,T=b.width,C=b.height,M=T*Math.abs(Math.cos(S))+Math.abs(C*Math.sin(S)),D=T*Math.abs(Math.sin(S))+Math.abs(C*Math.cos(S)),L=new Be(b.x,b.y,M,D);return L}}tt([kpe]);tt([Ape]);tt([Kpe,dge,Sge,Cme,Pme,Cye,Qye,O0e,rxe,uxe,pxe,wxe,g1e,V1e,K1e,hbe,mbe,Mbe,Ibe,Wbe,Kbe,s_e,W_e]);tt(cSe);tt(OSe);tt(Q9);tt($Se);tt(zW);tt(KSe);tt(mwe);tt(Awe);tt(d2e);tt(k2e);tt(Om);tt($2e);tt(Z2e);tt(oTe);tt(vTe);tt(bTe);tt(ATe);tt(PTe);tt(tCe);tt(UY);tt(WY);tt(_Ce);tt(ZY);tt(KY);tt(CCe);tt(LCe);tt(FCe);tt(YCe);tt(xAe);tt(Yve);tt(BAe);tt(VAe);tt(Ame);const FAe=Object.freeze(Object.defineProperty({__proto__:null,Axis:si,ChartView:Pt,ComponentModel:ot,ComponentView:Ft,List:Pn,Model:ut,PRIORITY:Y7,SeriesModel:zt,color:Uoe,connect:qde,dataTool:nhe,dependencies:kde,disConnect:Zde,disconnect:eU,dispose:Kde,env:dt,extendChartView:kve,extendComponentModel:Dve,extendComponentView:Nve,extendSeriesModel:Lve,format:hve,getCoordinateSystemDimensions:Jde,getInstanceByDom:XN,getInstanceById:Qde,getMap:rhe,graphic:dve,helper:ave,init:Xde,innerDrawElementOnCanvas:UN,matrix:xoe,number:cve,parseGeoJSON:nM,parseGeoJson:nM,registerAction:Li,registerCoordinateSystem:nU,registerCustomSeries:ehe,registerLayout:aU,registerLoading:JN,registerLocale:_N,registerMap:iU,registerPostInit:tU,registerPostUpdate:rU,registerPreprocessor:ZN,registerProcessor:KN,registerTheme:qN,registerTransform:oU,registerUpdateLifecycle:t_,registerVisual:lu,setCanvasCreator:the,setPlatformAPI:GH,throttle:Jb,time:fve,use:tt,util:vve,vector:aoe,version:Lde,zrUtil:Kie,zrender:Ase},Symbol.toStringTag,{value:"Module"}));var Xo={},qo={},vC={},sG;function UAe(){return sG||(sG=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var e=1;r.default=function(){return"".concat(e++)}})(vC)),vC}var Ip={},Op={},pC={},lG;function i$(){return lG||(lG=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,r.default=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:60,a=null;return function(){for(var i=this,o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];clearTimeout(a),a=setTimeout(function(){t.apply(i,s)},n)}}})(pC)),pC}var Zo={},uG;function xk(){return uG||(uG=1,Object.defineProperty(Zo,"__esModule",{value:!0}),Zo.SizeSensorId=Zo.SensorTabIndex=Zo.SensorClassName=void 0,Zo.SizeSensorId="size-sensor-id",Zo.SensorClassName="size-sensor-object",Zo.SensorTabIndex="-1"),Zo}var cG;function WAe(){if(cG)return Op;cG=1,Object.defineProperty(Op,"__esModule",{value:!0}),Op.createSensor=void 0;var r=t(i$()),e=xk();function t(n){return n&&n.__esModule?n:{default:n}}return Op.createSensor=function(a,i){var o=void 0,s=[],l=function(){getComputedStyle(a).position==="static"&&(a.style.position="relative");var g=document.createElement("object");return g.onload=function(){g.contentDocument.defaultView.addEventListener("resize",u),u()},g.style.display="block",g.style.position="absolute",g.style.top="0",g.style.left="0",g.style.height="100%",g.style.width="100%",g.style.overflow="hidden",g.style.pointerEvents="none",g.style.zIndex="-1",g.style.opacity="0",g.setAttribute("class",e.SensorClassName),g.setAttribute("tabindex",e.SensorTabIndex),g.type="text/html",a.appendChild(g),g.data="about:blank",g},u=(0,r.default)(function(){s.forEach(function(v){v(a)})}),c=function(g){o||(o=l()),s.indexOf(g)===-1&&s.push(g)},f=function(){o&&o.parentNode&&(o.contentDocument&&o.contentDocument.defaultView.removeEventListener("resize",u),o.parentNode.removeChild(o),a.removeAttribute(e.SizeSensorId),o=void 0,s=[],i&&i())},h=function(g){var y=s.indexOf(g);y!==-1&&s.splice(y,1),s.length===0&&o&&f()};return{element:a,bind:c,destroy:f,unbind:h}},Op}var Pp={},fG;function YAe(){if(fG)return Pp;fG=1,Object.defineProperty(Pp,"__esModule",{value:!0}),Pp.createSensor=void 0;var r=xk(),e=t(i$());function t(n){return n&&n.__esModule?n:{default:n}}return Pp.createSensor=function(a,i){var o=void 0,s=[],l=(0,e.default)(function(){s.forEach(function(v){v(a)})}),u=function(){var g=new ResizeObserver(l);return g.observe(a),l(),g},c=function(g){o||(o=u()),s.indexOf(g)===-1&&s.push(g)},f=function(){o&&o.disconnect(),s=[],o=void 0,a.removeAttribute(r.SizeSensorId),i&&i()},h=function(g){var y=s.indexOf(g);y!==-1&&s.splice(y,1),s.length===0&&o&&f()};return{element:a,bind:c,destroy:f,unbind:h}},Pp}var dG;function $Ae(){if(dG)return Ip;dG=1,Object.defineProperty(Ip,"__esModule",{value:!0}),Ip.createSensor=void 0;var r=WAe(),e=YAe();return Ip.createSensor=typeof ResizeObserver<"u"?e.createSensor:r.createSensor,Ip}var hG;function XAe(){if(hG)return qo;hG=1,Object.defineProperty(qo,"__esModule",{value:!0}),qo.removeSensor=qo.getSensor=qo.Sensors=void 0;var r=n(UAe()),e=$Ae(),t=xk();function n(o){return o&&o.__esModule?o:{default:o}}var a=qo.Sensors={};function i(o){o&&a[o]&&delete a[o]}return qo.getSensor=function(s){var l=s.getAttribute(t.SizeSensorId);if(l&&a[l])return a[l];var u=(0,r.default)();s.setAttribute(t.SizeSensorId,u);var c=(0,e.createSensor)(s,function(){return i(u)});return a[u]=c,c},qo.removeSensor=function(s){var l=s.element.getAttribute(t.SizeSensorId);s.destroy(),i(l)},qo}var vG;function qAe(){if(vG)return Xo;vG=1,Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.ver=Xo.clear=Xo.bind=void 0;var r=XAe();return Xo.bind=function(t,n){var a=(0,r.getSensor)(t);return a.bind(n),function(){a.unbind(n)}},Xo.clear=function(t){var n=(0,r.getSensor)(t);(0,r.removeSensor)(n)},Xo.ver="1.0.3",Xo}var pG=qAe();function gG(r,e){var t={};return e.forEach(function(n){t[n]=r[n]}),t}function gC(r){return typeof r=="function"}function ZAe(r){return typeof r=="string"}var mC,mG;function KAe(){return mG||(mG=1,mC=function r(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,a,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(a=n;a--!==0;)if(!r(e[a],t[a]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(a=n;a--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[a]))return!1;for(a=n;a--!==0;){var o=i[a];if(!r(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}),mC}var QAe=KAe();const Md=oD(QAe);var JAe=(function(r){K(e,r);function e(t){var n=r.call(this,t)||this;return n.echarts=t.echarts,n.ele=null,n.isInitialResize=!0,n.eventHandlerRefs={},n}return e.prototype.componentDidMount=function(){this.renderNewEcharts()},e.prototype.componentDidUpdate=function(t){var n=this.props.shouldSetOption;if(!(gC(n)&&!n(t,this.props))){if(!Md(t.theme,this.props.theme)||!Md(t.opts,this.props.opts)){this.dispose(),this.renderNewEcharts();return}var a=this.getEchartsInstance();Md(t.onEvents,this.props.onEvents)||(this.unbindEvents(a),this.bindEvents(a,this.props.onEvents));var i=["option","notMerge","replaceMerge","lazyUpdate","showLoading","loadingOption"];Md(gG(this.props,i),gG(t,i))||this.updateEChartsOption(),(!Md(t.style,this.props.style)||!Md(t.className,this.props.className))&&this.resize()}},e.prototype.componentWillUnmount=function(){this.dispose()},e.prototype.initEchartsInstance=function(){return LP(this,void 0,void 0,function(){var t=this;return kP(this,function(n){return[2,new Promise(function(a){t.echarts.init(t.ele,t.props.theme,t.props.opts);var i=t.getEchartsInstance();i.on("finished",function(){var o=t.ele.clientWidth,s=t.ele.clientHeight;t.echarts.dispose(t.ele);var l=eg({width:o,height:s},t.props.opts);a(t.echarts.init(t.ele,t.props.theme,l))})})]})})},e.prototype.getEchartsInstance=function(){return this.echarts.getInstanceByDom(this.ele)},e.prototype.dispose=function(){if(this.ele){try{pG.clear(this.ele)}catch(t){console.warn(t)}this.echarts.dispose(this.ele)}},e.prototype.renderNewEcharts=function(){return LP(this,void 0,void 0,function(){var t,n,a,i,o,s,l=this;return kP(this,function(u){switch(u.label){case 0:return t=this.props,n=t.onEvents,a=t.onChartReady,i=t.autoResize,o=i===void 0?!0:i,[4,this.initEchartsInstance()];case 1:return u.sent(),s=this.updateEChartsOption(),this.bindEvents(s,n||{}),gC(a)&&a(s),this.ele&&o&&pG.bind(this.ele,function(){l.resize()}),[2]}})})},e.prototype.bindEvents=function(t,n){var a=this,i=function(s,l){if(ZAe(s)&&gC(l)){var u=function(c){l(c,t)};t.on(s,u),a.eventHandlerRefs[s]=u}};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&i(o,n[o])},e.prototype.unbindEvents=function(t){for(var n=0,a=Object.entries(this.eventHandlerRefs);n<a.length;n++){var i=a[n],o=i[0],s=i[1];t.off(o,s)}this.eventHandlerRefs={}},e.prototype.updateEChartsOption=function(){var t=this.props,n=t.option,a=t.notMerge,i=a===void 0?!1:a,o=t.replaceMerge,s=o===void 0?null:o,l=t.lazyUpdate,u=l===void 0?!1:l,c=t.showLoading,f=t.loadingOption,h=f===void 0?null:f,v=this.getEchartsInstance();return v.setOption(n,{notMerge:i,replaceMerge:s,lazyUpdate:u}),c?v.showLoading(h):v.hideLoading(),v},e.prototype.resize=function(){var t=this.getEchartsInstance();if(!this.isInitialResize)try{t.resize({width:"auto",height:"auto"})}catch(n){console.warn(n)}this.isInitialResize=!1},e.prototype.render=function(){var t=this,n=this.props,a=n.style,i=n.className,o=i===void 0?"":i;n.echarts,n.option,n.theme,n.notMerge,n.replaceMerge,n.lazyUpdate,n.showLoading,n.loadingOption,n.opts,n.onChartReady,n.onEvents,n.shouldSetOption,n.autoResize;var s=Eie(n,["style","className","echarts","option","theme","notMerge","replaceMerge","lazyUpdate","showLoading","loadingOption","opts","onChartReady","onEvents","shouldSetOption","autoResize"]),l=eg({height:300},a);return GG.createElement("div",eg({ref:function(u){t.ele=u},style:l,className:"echarts-for-react ".concat(o)},s))},e})(Y.PureComponent),eMe=(function(r){K(e,r);function e(t){var n=r.call(this,t)||this;return n.echarts=FAe,n}return e})(JAe);function tMe({thisYear:r,lastYear:e}){const t=Array.from({length:52},(o,s)=>{const l=r.find(u=>u.week===s+1);return(l==null?void 0:l.count)??null}),n=Array.from({length:52},(o,s)=>{const l=e.find(u=>u.week===s+1);return(l==null?void 0:l.count)??null}),a=Array.from({length:52},(o,s)=>`${s+1}주`),i={animation:!0,grid:{top:8,right:8,bottom:24,left:36},xAxis:{type:"category",data:a,axisLabel:{interval:3,formatter:(o,s)=>{const u=[0,4,8,13,17,21,26,30,34,39,43,47].indexOf(s);return u>=0?`${u+1}월`:""},fontSize:10,color:"#999"},axisTick:{show:!1},axisLine:{show:!1},splitLine:{show:!0,interval:(o,s)=>["1주","5주","9주","14주","18주","22주","27주","31주","35주","40주","44주","48주"].includes(s),lineStyle:{color:"#e5e7eb",width:1}}},yAxis:{type:"value",axisLabel:{fontSize:10,color:"#999"},splitLine:{lineStyle:{color:"#f3f4f6"}},minInterval:1},series:[{name:"올해",type:"line",data:t,smooth:!0,symbol:"none",connectNulls:!1,lineStyle:{width:2.5,color:"hsl(var(--primary))"},itemStyle:{color:"hsl(var(--primary))"},emphasis:{focus:"none",lineStyle:{width:2.5,opacity:1}},blur:{lineStyle:{opacity:1,width:2.5}}},{name:"작년",type:"line",data:n,smooth:!0,symbol:"none",connectNulls:!1,lineStyle:{width:1.5,color:"#999",type:"dashed"},itemStyle:{color:"#999"},emphasis:{focus:"none",lineStyle:{width:1.5,opacity:1}},blur:{lineStyle:{opacity:1,width:1.5}}}],tooltip:{trigger:"axis",formatter:o=>{var u;const s=(((u=o[0])==null?void 0:u.dataIndex)??0)+1,l=o.filter(c=>c.value!=null).map(c=>`${c.seriesName}: ${c.value}건`).join("<br/>");return`${s}주차<br/>${l}`}},legend:{show:!1}};return m.jsx(eMe,{option:i,style:{height:160}})}function rMe(){const{data:r}=vb(),{data:e}=$G(),{data:t}=TZ(),{data:n}=wZ(),{data:a,isLoading:i}=qG(),{syncing:o,syncResult:s,handleSync:l}=KG(),u=(e==null?void 0:e.settlement)??[],c={};return m.jsx(Cae,{byStatus:c,totalOrders:(e==null?void 0:e.totalOrders)??0,totalRevenue:(e==null?void 0:e.totalRevenue)??0,recentActivity:[],channels:(r==null?void 0:r.channels)??[],periodStats:t,weeklyStats:n,settlement:u,totalImportedOrders:e==null?void 0:e.totalOrders,totalImportedRevenue:e==null?void 0:e.totalRevenue,catalog:a,catalogLoading:i,syncing:o,syncResult:s,onSync:l,actionNeeded:0,WeeklyLineChartComponent:tMe})}function nMe(){const[r,e]=Y.useState(""),[t,n]=Y.useState(""),a=Y.useMemo(()=>{const u={};return r&&(u.from=r),t&&(u.to=t),Object.keys(u).length>0?u:void 0},[r,t]),{data:i,isLoading:o,error:s}=qG(a),{data:l}=XG();return m.jsx(_ae,{catalog:(i==null?void 0:i.catalog)??[],unmappedCount:(i==null?void 0:i.unmappedCount)??0,byCategory:(i==null?void 0:i.byCategory)??[],byLine:(i==null?void 0:i.byLine)??[],feeDefaults:(l==null?void 0:l.defaults)??{},isLoading:o,error:s,dateFrom:r,dateTo:t,onDateChange:(u,c)=>{e(u),n(c)}})}function aMe(r){if(!r.startedAt)return"";const t=(r.endedAt??Date.now())-r.startedAt;return t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`}function iMe({status:r}){return r==="pending"?m.jsx("span",{className:"w-4 h-4 rounded-full border-2 border-muted-foreground/40 flex-shrink-0"}):r==="running"?m.jsx("span",{className:"w-4 h-4 flex-shrink-0 flex items-center justify-center",children:m.jsx("span",{className:"w-3.5 h-3.5 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):r==="completed"?m.jsx("span",{className:"w-4 h-4 rounded-full bg-green-500/15 flex-shrink-0 flex items-center justify-center",children:m.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:m.jsx("path",{d:"M2 5l2.5 2.5L8 3",stroke:"#22c55e",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}):m.jsx("span",{className:"w-4 h-4 rounded-full bg-red-500/15 flex-shrink-0 flex items-center justify-center",children:m.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:m.jsx("path",{d:"M3 3l4 4M7 3l-4 4",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round"})})})}function oMe({session:r}){if(!r)return m.jsx("div",{className:"bg-card border border-border rounded-xl flex items-center justify-center min-h-[120px]",children:m.jsx("p",{className:"text-[13px] text-muted-foreground",children:"세션을 선택하세요"})});const e=r.tasks.length>0?"태스크":"출력";return m.jsxs("div",{className:"bg-card border border-border rounded-xl overflow-hidden",children:[m.jsxs("div",{className:"px-4 py-2.5 border-b border-border flex items-center gap-2",children:[m.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:e}),m.jsx("span",{className:"font-mono text-[11px] text-foreground/70 truncate",children:r.command.replace(/^sppt\s+/,"")})]}),r.tasks.length>0?m.jsx("ul",{className:"divide-y divide-border",children:r.tasks.map(t=>m.jsxs("li",{className:"flex items-center gap-3 px-4 py-2.5",children:[m.jsx(iMe,{status:t.status}),m.jsx("span",{className:"text-[12px] flex-1 truncate",children:t.name}),t.detail&&m.jsx("span",{className:"text-[11px] text-muted-foreground truncate max-w-[120px]",children:t.detail}),t.startedAt&&m.jsx("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:aMe(t)})]},t.id))}):r.output?m.jsx("pre",{className:"px-4 py-3 text-[12px] leading-relaxed text-foreground/80 whitespace-pre-wrap font-mono overflow-x-auto",children:r.output}):m.jsx("div",{className:"flex items-center justify-center py-8",children:m.jsx("p",{className:"text-[12px] text-muted-foreground",children:"출력 없음"})})]})}function sMe({sessions:r,selectedId:e,onSelect:t}){return r.length===0?m.jsx("div",{className:"bg-card border border-border rounded-xl flex items-center justify-center p-4",children:m.jsxs("p",{className:"text-[12px] text-muted-foreground text-center",children:["CLI 커맨드를 실행하면",m.jsx("br",{}),"여기에 표시됩니다"]})}):m.jsxs("div",{className:"bg-card border border-border rounded-xl overflow-hidden flex flex-col max-h-[70vh]",children:[m.jsx("div",{className:"px-3 py-2 border-b border-border flex-shrink-0",children:m.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"세션"})}),m.jsx("ul",{className:"overflow-y-auto flex-1",children:r.map(n=>{const a=n.tasks.filter(u=>u.status==="completed").length,i=n.tasks.length,o=n.tasks.some(u=>u.status==="running"),s=n.id===e,l=RD(new Date(n.createdAt),{addSuffix:!0,locale:Ab});return m.jsx("li",{children:m.jsxs("button",{type:"button",onClick:()=>t(n.id),className:["w-full text-left pl-2 pr-3 py-2.5 hover:bg-muted/60 transition-colors border-b border-border last:border-b-0",s?"bg-muted":""].join(" "),children:[m.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[m.jsx("span",{className:["w-1.5 h-1.5 rounded-full flex-shrink-0",o?"bg-green-500 animate-pulse":"bg-muted-foreground/40"].join(" ")}),m.jsx("span",{className:"text-[12px] font-medium truncate flex-1 font-mono",children:n.command.replace(/^sppt\s+/,"")})]}),m.jsxs("div",{className:"flex items-center justify-between pl-2",children:[m.jsx("span",{className:"text-[11px] text-muted-foreground",children:i>0?`${a}/${i} 완료`:"태스크 없음"}),m.jsx("span",{className:"text-[10px] text-muted-foreground",children:l})]})]})},n.id)})})]})}function lMe(){const r=window.location.hash.slice(1),e=r.includes("?")?r.split("?")[1]:"";return new URLSearchParams(e).get("id")}function uMe(){const{data:r=[]}=hZ(),[e,t]=Y.useState(lMe),n=Y.useCallback(i=>{t(i);const o=window.location.hash.split("?")[0];window.history.replaceState(null,"",`${o}?id=${i}`)},[]);Y.useEffect(()=>{r.length>0&&!e&&n(r[0].id)},[r,e,n]);const a=r.find(i=>i.id===e)??null;return m.jsxs("div",{children:[m.jsx("div",{className:"flex items-center justify-between mb-6",children:m.jsx("h2",{className:"text-xl font-medium",children:"Session"})}),m.jsxs("div",{className:"grid grid-cols-[260px_1fr] gap-4 mb-8",children:[m.jsx(sMe,{sessions:r,selectedId:e,onSelect:n}),m.jsx(oMe,{session:a})]})]})}async function cMe(r){const e=new URLSearchParams({channel:r.channel,from:r.from,to:r.to,limit:String(r.limit)}),t=await fetch(`/api/orders?${e}`);if(!t.ok)throw new Error(`orders API failed: ${t.status}`);return t.json()}function fMe({channel:r,dateFrom:e,dateTo:t}){return m.jsx(Bae,{channel:r,dateFrom:e,dateTo:t,fetchOrders:cMe})}async function dMe(r){const e=await fetch(`/api/settlement/coupang/monthly?yearMonth=${r}`);if(!e.ok)throw new Error(`coupang monthly API failed: ${e.status}`);return e.json()}async function hMe(r,e){const t=new URLSearchParams({from:r,to:e}),n=await fetch(`/api/settlement/coupang/reconcile?${t}`);if(!n.ok)throw new Error(`coupang reconcile API failed: ${n.status}`);return n.json()}function vMe({dateFrom:r,dateTo:e}){return m.jsx(Uae,{dateFrom:r,dateTo:e,fetchMonthly:dMe,fetchReconcile:hMe})}async function pMe(r){const e=new URLSearchParams({channel:r.channel,from:r.from,to:r.to,limit:String(r.limit)}),t=await fetch(`/api/orders?${e}`);if(!t.ok)throw new Error(`orders API failed: ${t.status}`);return t.json()}async function gMe(r,e){const t=new URLSearchParams({orderId:r,payDate:e}),n=await fetch(`/api/settlement/smartstore/order?${t}`);if(!n.ok)throw new Error(`smartstore order settlement API failed: ${n.status}`);return n.json()}function mMe({dateFrom:r,dateTo:e}){return m.jsx(Gae,{dateFrom:r,dateTo:e,fetchOrders:pMe,fetchOrderSettlement:gMe})}function yMe(){var S,T;const[r,e]=Y.useState(""),[t,n]=Y.useState(""),a=!!r||!!t,{data:i,isLoading:o}=$G(a?{from:r,to:t}:void 0),{data:s}=XG(),{data:l=[],isLoading:u}=gZ(r||void 0,t||void 0),{data:c}=vb(),f=((S=c==null?void 0:c.channels)==null?void 0:S.some(C=>C.channel==="smartstore"&&C.connected))??!1,h=((T=c==null?void 0:c.channels)==null?void 0:T.some(C=>C.channel==="coupang"&&C.connected))??!1,{data:v}=mZ(r||new Date(Date.now()-720*60*60*1e3).toISOString().slice(0,10),t||new Date().toISOString().slice(0,10),f),g=(i==null?void 0:i.settlement)??[],y=(i==null?void 0:i.totalRevenue)??0,b=(i==null?void 0:i.netRevenue)??0,_=(i==null?void 0:i.totalOrders)??0;return m.jsx(aae,{channels:g,totalRevenue:y,netRevenue:b,totalOrders:_,rules:(s==null?void 0:s.rules)??[],defaults:(s==null?void 0:s.defaults)??{},depositSchedule:l,isLoading:o,scheduleLoading:u,estimationNote:"orders.jsonl 기반 추정값",dateFrom:r,dateTo:t,onDateChange:(C,M)=>{e(C),n(M)},ssDaily:v??null,coupangConnected:h,annualRevenue:(s==null?void 0:s.annualRevenue)??null,quickSettlement:(s==null?void 0:s.quickSettlement)??!1,renderExpandedPanel:(C,M,D)=>C==="smartstore"?m.jsx(mMe,{dateFrom:M,dateTo:D}):C==="coupang"&&h?m.jsx(vMe,{dateFrom:M,dateTo:D}):m.jsx(fMe,{channel:C,dateFrom:M,dateTo:D}),onOpenConfig:(C,M)=>{CP(C==="annualRevenue"?{type:"annualRevenue"}:{type:"channel",channel:M??""})}})}function xMe({trendPoints:r,direction:e}){const[t,n]=Y.useState(null);if(!r||r.length<2)return m.jsx("span",{className:"inline-block w-[50px] h-[24px]"});const a=50,i=24,o=2,s=r.map(b=>b.ratio),l=Math.min(...s),c=Math.max(...s)-l||1,f=r.map((b,_)=>({x:o+_/(r.length-1)*(a-o*2),y:i-o-(b.ratio-l)/c*(i-o*2),period:b.period,ratio:b.ratio})),h=f.map(b=>`${b.x},${b.y}`).join(" "),v=e==="상승"?"#22c55e":e==="하락"?"#ef4444":"#94a3b8",g=f.map((b,_)=>{const S=_>0?(f[_-1].x+b.x)/2:0,T=_<f.length-1?(b.x+f[_+1].x)/2:a;return{x:S,width:T-S}}),y=t!==null?f[t]:null;return m.jsxs("svg",{width:a,height:i,viewBox:`0 0 ${a} ${i}`,className:"inline-block overflow-visible","aria-hidden":"true",children:[m.jsx("polyline",{points:h,fill:"none",stroke:v,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),y&&m.jsxs(m.Fragment,{children:[m.jsx("line",{x1:y.x,y1:0,x2:y.x,y2:i,stroke:v,strokeWidth:1,strokeDasharray:"2 2",strokeOpacity:.5}),m.jsx("circle",{cx:y.x,cy:y.y,r:2.5,fill:v,stroke:"white",strokeWidth:1})]}),g.map((b,_)=>m.jsx(us,{side:"top",content:m.jsxs("span",{children:[m.jsx("span",{className:"font-medium",children:f[_].period}),m.jsx("br",{}),"상대 검색량 ",m.jsx("span",{className:"font-semibold",children:Math.round(f[_].ratio)}),m.jsx("span",{className:"opacity-60",children:" / 100"})]}),children:m.jsx("rect",{x:b.x,y:0,width:b.width,height:i,fill:"transparent",stroke:"none",className:"cursor-default",onMouseEnter:()=>n(_),onMouseLeave:()=>n(null)})},f[_].period))]})}const bMe={낮음:"bg-green-500/15 text-green-600",보통:"bg-yellow-500/15 text-yellow-600",높음:"bg-orange-500/15 text-orange-600",매우높음:"bg-red-500/15 text-red-600"},_Me={상승:{icon:"↑",cls:"text-green-500"},하락:{icon:"↓",cls:"text-red-500"},보합:{icon:"→",cls:"text-muted-foreground"}};function yG(r){return r==null?"—":r.toLocaleString("ko-KR")}function yx(r){return r==null?"—":`${r.toLocaleString("ko-KR")}원`}function SMe(r,e,t,n){const a=(e+t)/2,i=Math.max(n,t);return r<=a?{dot:"🟢",label:"신규진입 가능 — 하위 ~20%, 리뷰 없어도 경쟁 가능",cls:"text-green-600 font-semibold"}:r<=i?{dot:"🟡",label:"판매 가능 — 시장 평균 이하, 경쟁력 있음",cls:"text-yellow-600 font-medium"}:{dot:"🔴",label:"판매 어려움 — 시장가 초과",cls:"text-red-500"}}function wMe(r){var n;const e=new Set,t=[];for(const a of r)for(const i of((n=a.analysis.marginAnalysis)==null?void 0:n.platforms)??[])e.has(i.platform)||(e.add(i.platform),t.push(i.platform));return t}function TMe({entries:r}){const e=wMe(r),t=e.length>0;return m.jsx("div",{className:"overflow-x-auto rounded-xl border border-border",children:m.jsxs("table",{className:"w-full text-[12px] border-collapse",children:[m.jsxs("thead",{children:[m.jsxs("tr",{className:"border-b border-border bg-muted/40",children:[m.jsx(xx,{align:"left",children:"키워드"}),m.jsx(xx,{align:"left",children:"소싱 채널"}),m.jsx(jp,{tip:"도매 소싱가",children:"소싱가"}),m.jsxs(jp,{tip:"네이버쇼핑 검색결과 기준. 중앙값은 저가 잡상품에 왜곡될 수 있어, avg가 중앙값보다 높으면 avg를 함께 표시합니다.",children:["시장판매가",m.jsx("br",{}),m.jsx("span",{className:"font-normal text-[10px] opacity-60",children:"(중앙값 / avg)"})]}),m.jsxs(jp,{tip:"네이버쇼핑 기준 해당 키워드 검색 시 노출되는 경쟁 상품 수",children:["경쟁상품수",m.jsx("br",{}),m.jsx("span",{className:"font-normal text-[10px] opacity-60",children:"(네이버쇼핑)"})]}),m.jsxs(jp,{tip:"최근 1개월 네이버 검색량 (PC+모바일)",children:["월검색량",m.jsx("br",{}),m.jsx("span",{className:"font-normal text-[10px] opacity-60",children:"(트렌드)"})]}),m.jsx(xx,{children:"경쟁도"}),t&&m.jsxs(jp,{colSpan:e.length,tip:"소싱가 기준 플랫폼 수수료 포함, 각 마진율 달성 최소판매가. 30% * = 세전 최소기준선(≈×1.7). 🟢 신규진입 가능(하위~20%) 🟡 판매 가능(시장 평균↓) 🔴 판매 어려움(시장가 초과)",children:["채널별 최소판매가",m.jsx("br",{}),m.jsx("span",{className:"font-normal text-[10px] opacity-60",children:"(수수료 포함, 5·10·20·30% * 기준)"})]}),m.jsx(xx,{children:"검토"})]}),t&&m.jsxs("tr",{className:"border-b border-border bg-muted/20",children:[Array.from({length:7}).map((n,a)=>m.jsx("td",{},a)),e.map(n=>m.jsx("td",{className:"px-3 py-1 text-center text-[10px] text-muted-foreground font-medium border-l border-border",children:n},n)),m.jsx("td",{})]})]}),m.jsx("tbody",{className:"bg-white dark:bg-card",children:r.map((n,a)=>{const{analysis:i,keyword:o,productName:s,sourceChannel:l,sourcingPrice:u,savedAt:c}=n,{demand:f,marginAnalysis:h,price:v,competitionLevel:g,totalListings:y}=i,b=RD(new Date(c),{addSuffix:!0,locale:Ab}),_=(f==null?void 0:f.trendDirection)??null,S=_?_Me[_]:null,T=f==null?void 0:f.monthlyTotal,C=u&&v.median>0?Math.round((v.median-u)/u*100):null,M=new Map((h==null?void 0:h.platforms.map(L=>[L.platform,L]))??[]),D=v.avg>v.median*1.5;return m.jsxs("tr",{className:["border-b border-border/60 hover:bg-blue-50/40 dark:hover:bg-muted/20 transition-colors",a%2!==0?"bg-gray-50/60 dark:bg-muted/5":""].join(" "),children:[m.jsxs("td",{className:"px-3 py-2.5 max-w-[140px]",children:[m.jsx("div",{className:"font-semibold truncate",children:o}),s&&m.jsx("div",{className:"text-[10px] text-muted-foreground truncate mt-0.5",children:s})]}),m.jsx("td",{className:"px-3 py-2.5 text-center whitespace-nowrap",children:l??"—"}),m.jsx("td",{className:"px-3 py-2.5 text-right whitespace-nowrap",children:u?m.jsx("span",{className:"font-medium",children:yx(u)}):m.jsx("span",{className:"text-muted-foreground",children:"—"})}),m.jsxs("td",{className:"px-3 py-2.5 text-right whitespace-nowrap",children:[m.jsxs("div",{className:"flex items-baseline justify-end gap-1",children:[m.jsx("span",{className:"font-medium",children:yx(v.median)}),C!=null&&m.jsx(us,{content:`소싱가 대비 ${C>=0?"+":""}${C}%`,children:m.jsxs("span",{className:["text-[10px] cursor-default",C>=0?"text-green-500":"text-red-500"].join(" "),children:[C>=0?"+":"",C,"%"]})})]}),D&&m.jsx(us,{content:"평균가 — 중앙값이 저가 잡상품에 왜곡된 경우 이 값이 실거래 기준이 됩니다. 티어 판정(🟢🟡🔴)에 사용됩니다.",children:m.jsxs("div",{className:"text-[10px] text-blue-500 mt-0.5 cursor-default",children:["avg ",yx(v.avg)]})})]}),m.jsxs("td",{className:"px-3 py-2.5 text-right whitespace-nowrap",children:[yG(y),"개"]}),m.jsx("td",{className:"px-3 py-2.5 whitespace-nowrap",children:T!=null?m.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[m.jsxs("span",{children:[yG(T),"회"]}),S&&m.jsx("span",{className:["font-medium text-[10px]",S.cls].join(" "),children:S.icon}),f&&f.trendPoints.length>=2&&m.jsx(xMe,{trendPoints:f.trendPoints,direction:_})]}):m.jsx("span",{className:"text-muted-foreground float-right",children:"—"})}),m.jsx("td",{className:"px-3 py-2.5 text-center",children:m.jsx("span",{className:["text-[10px] font-semibold px-2 py-0.5 rounded-full whitespace-nowrap",bMe[g]??"bg-muted text-muted-foreground"].join(" "),children:g})}),e.map(L=>{const k=M.get(L),R=k&&(k.sell5||k.sell10||k.sell20||k.sell30),E=R?[{label:"5%",sell:k.sell5||null,isMin:!1},{label:"10%",sell:k.sell10||null,isMin:!1},{label:"20%",sell:k.sell20||null,isMin:!1},{label:"30% *",sell:k.sell30||null,isMin:!0}]:[];return m.jsx("td",{className:"px-3 py-2 border-l border-border/40 align-top",children:R?m.jsx("div",{className:"flex flex-col gap-0.5",children:E.map(({label:I,sell:z,isMin:j})=>{if(z==null)return null;const G=SMe(z,v.min,v.median,v.avg);return m.jsx(us,{content:j?`[최소기준선] ${G.label}`:G.label,children:m.jsxs("div",{className:["flex items-center justify-between gap-1.5 text-[11px] cursor-default",j?"font-semibold":""].join(" "),children:[m.jsx("span",{className:["w-10 shrink-0 whitespace-nowrap",j?"text-foreground/70":"text-muted-foreground"].join(" "),children:I}),m.jsx("span",{className:[G.cls,"whitespace-nowrap"].join(" "),children:yx(z)}),m.jsx("span",{children:G.dot})]})},I)})}):m.jsx("span",{className:"text-muted-foreground",children:"—"})},L)}),m.jsx("td",{className:"px-3 py-2.5 text-right whitespace-nowrap text-muted-foreground",children:b})]},n.id)})})]})})}function xx({children:r,align:e="center",colSpan:t}){return m.jsx("th",{colSpan:t,className:["px-3 py-2 text-[11px] font-semibold text-muted-foreground leading-tight whitespace-nowrap",e==="left"?"text-left":e==="right"?"text-right":"text-center"].join(" "),children:r})}function jp({children:r,tip:e,align:t="center",colSpan:n}){return m.jsx("th",{colSpan:n,className:["px-3 py-2 text-[11px] font-semibold text-muted-foreground leading-tight whitespace-nowrap",t==="left"?"text-left":t==="right"?"text-right":"text-center"].join(" "),children:m.jsx(us,{content:e,children:m.jsx("span",{className:"cursor-help underline decoration-dotted decoration-muted-foreground/40",children:r})})})}const zp=20;function CMe(r){var l;const e=(l=r.analysis.marginAnalysis)==null?void 0:l.platforms;if(!(e!=null&&e.length))return"🔴";const{min:t,median:n,avg:a}=r.analysis.price,i=(t+n)/2,o=Math.max(a,n);let s="🔴";for(const u of e){const c=u.sell30;if(c){if(c<=i)return"🟢";c<=o&&s!=="🟢"&&(s="🟡")}}return s}function AMe(r,e){return e?r.filter(t=>CMe(t)===e):r}const MMe={domeggook:"도매꾹",specialoffer:"특가몰",cjdropshipping:"CJ Dropshipping"};function DMe({channel:r,connected:e,rateLimit:t,dailyLimit:n}){const a=MMe[r]??r;return m.jsxs("div",{className:"flex items-center gap-3 py-3 border-b border-border/60 last:border-0",children:[m.jsx("span",{className:zr("w-2 h-2 rounded-full shrink-0",e?"bg-green-500":"bg-muted-foreground/30")}),m.jsx("span",{className:"text-[13px] font-medium",children:a}),e?m.jsxs("div",{className:"ml-auto flex gap-3 text-[11px] text-muted-foreground",children:[m.jsxs("span",{children:[t," rps"]}),n&&m.jsxs("span",{children:["일 ",n.toLocaleString(),"회"]}),m.jsx("span",{className:"text-green-600 font-medium",children:"연결됨"})]}):m.jsxs("div",{className:"ml-auto text-[11px] text-muted-foreground",children:["미연결 · ",m.jsx("code",{className:"font-mono",children:"sppt init"})]})]})}function NMe(){const{data:r}=vb(),{data:e=[],refetch:t,isFetching:n}=vZ(),{data:a=[]}=pZ(),[i,o]=Y.useState(1),[s,l]=Y.useState(null),u=(r==null?void 0:r.sourceChannels)??[],c=u.filter(b=>b.connected).length,f=AMe(e,s),h=Math.max(1,Math.ceil(f.length/zp)),v=Math.min(i,h),g=f.slice((v-1)*zp,v*zp);function y(b){l(_=>_===b?null:b),o(1)}return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center justify-between mb-6",children:[m.jsx("h2",{className:"text-xl font-medium",children:"소싱 채널"}),m.jsxs("div",{className:"text-[12px] text-muted-foreground",children:[c,"/",u.length," 연결됨"]})]}),m.jsxs("div",{className:"border border-border rounded-lg px-4 py-1 mb-8",children:[u.map(b=>m.jsx(DMe,{channel:b.channel,connected:b.connected,rateLimit:b.rateLimit,dailyLimit:b.dailyLimit},b.channel)),u.length===0&&m.jsx("div",{className:"py-4 text-center text-[12px] text-muted-foreground",children:"로딩 중..."})]}),m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(Sg,{size:13,className:"text-muted-foreground"}),m.jsx("span",{className:"text-[13px] font-semibold text-muted-foreground",children:"소싱 검토 이력"}),e.length>0&&m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[s?`${f.length} / `:"",e.length,"건"]}),e.length>0&&m.jsx("div",{className:"flex items-center gap-1 ml-2",children:["🟢","🟡","🔴"].map(b=>m.jsx("button",{type:"button",onClick:()=>y(b),className:zr("px-2 py-0.5 rounded-full text-[11px] border transition-colors",s===b?"border-foreground/50 bg-muted text-foreground font-medium":"border-border text-muted-foreground hover:border-foreground/30"),children:b},b))}),m.jsxs("button",{type:"button",onClick:()=>t(),className:zr("ml-auto flex items-center gap-1 text-[11px] border border-border rounded px-2 py-1 hover:border-foreground/40 transition-colors",n&&"opacity-50 pointer-events-none"),children:[m.jsx(_x,{size:10,className:zr(n&&"animate-spin")}),"새로고침"]})]}),e.length===0||f.length===0?m.jsxs("div",{className:"border border-dashed border-border rounded-lg p-10 text-center text-muted-foreground text-sm",children:[m.jsx(Pl,{size:24,className:"mx-auto mb-3 opacity-30"}),e.length===0?"소싱 상품 시장 분석 이력이 없습니다.":`${s} 해당 항목이 없습니다.`,m.jsxs("div",{className:"mt-3 space-y-1",children:[m.jsx("code",{className:"block bg-muted rounded px-2 py-1 text-[11px] text-foreground font-mono",children:"sppt source market-check <keyword>"}),m.jsx("code",{className:"block bg-muted rounded px-2 py-1 text-[11px] text-foreground font-mono",children:"sppt source detail <id> --market-check"})]})]}):m.jsxs(m.Fragment,{children:[m.jsx(TMe,{entries:g}),h>1&&m.jsxs("div",{className:"flex items-center justify-between mt-3 text-[12px] text-muted-foreground",children:[m.jsxs("span",{children:[(v-1)*zp+1,"–",Math.min(v*zp,f.length)," ","/ ",f.length,"건"]}),m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("button",{type:"button",onClick:()=>o(b=>Math.max(1,b-1)),disabled:v===1,className:"p-1 rounded hover:bg-muted disabled:opacity-30 disabled:pointer-events-none",children:m.jsx(CD,{size:14})}),Array.from({length:h},(b,_)=>_+1).map(b=>m.jsx("button",{type:"button",onClick:()=>o(b),className:zr("w-6 h-6 rounded text-[11px] hover:bg-muted",b===v&&"bg-muted font-semibold text-foreground"),children:b},b)),m.jsx("button",{type:"button",onClick:()=>o(b=>Math.min(h,b+1)),disabled:v===h,className:"p-1 rounded hover:bg-muted disabled:opacity-30 disabled:pointer-events-none",children:m.jsx(qr,{size:14})})]})]})]})]}),a.length>0&&m.jsxs("div",{className:"mt-8",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(Eee,{size:13,className:"text-muted-foreground"}),m.jsx("span",{className:"text-[13px] font-semibold text-muted-foreground",children:"공급처 검증 이력"}),m.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[a.length,"건"]})]}),m.jsx("div",{className:"border border-border rounded-lg overflow-hidden",children:m.jsxs("table",{className:"w-full text-[12px] border-collapse",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border bg-muted/40 text-[11px] font-semibold text-muted-foreground",children:[m.jsx("th",{className:"px-3 py-2 text-left",children:"공급처"}),m.jsx("th",{className:"px-3 py-2 text-center",children:"채널"}),m.jsx("th",{className:"px-3 py-2 text-center",children:"판정"}),m.jsx("th",{className:"px-3 py-2 text-center",children:"재고(평균)"}),m.jsx("th",{className:"px-3 py-2 text-center",children:"품절율"}),m.jsx("th",{className:"px-3 py-2 text-center",children:"즉시출고"}),m.jsx("th",{className:"px-3 py-2 text-center",children:"자동검증"}),m.jsx("th",{className:"px-3 py-2 text-right",children:"검토"})]})}),m.jsx("tbody",{children:a.map((b,_)=>m.jsxs("tr",{className:zr("border-b border-border/60",_%2!==0&&"bg-muted/5"),children:[m.jsxs("td",{className:"px-3 py-2",children:[m.jsx("div",{className:"font-medium",children:b.supplierNick??b.productId}),b.isPowerSeller&&m.jsx("span",{className:"text-[10px] text-blue-500",children:"파워셀러"}),b.isGoodSeller&&m.jsx("span",{className:"text-[10px] text-green-500 ml-1",children:"우수셀러"})]}),m.jsx("td",{className:"px-3 py-2 text-center text-muted-foreground",children:b.channel}),m.jsx("td",{className:"px-3 py-2 text-center text-base",children:b.tier}),m.jsx("td",{className:"px-3 py-2 text-center",children:b.avgStock!==void 0?m.jsxs("span",{className:b.avgStock>=30?"text-green-600":"text-red-500",children:[b.avgStock,"개"]}):"—"}),m.jsx("td",{className:"px-3 py-2 text-center",children:b.outOfStockRatioPct!==void 0?m.jsxs("span",{className:b.outOfStockRatioPct<30?"text-green-600":"text-red-500",children:[b.outOfStockRatioPct,"%"]}):"—"}),m.jsx("td",{className:"px-3 py-2 text-center",children:b.immediateShipPct!==void 0?m.jsxs("span",{className:b.immediateShipPct>=50?"text-green-600":"text-yellow-600",children:[b.immediateShipPct,"%"]}):"—"}),m.jsxs("td",{className:"px-3 py-2 text-center text-muted-foreground",children:[b.autoPassCount,"/",b.autoTotalCount]}),m.jsx("td",{className:"px-3 py-2 text-right text-muted-foreground whitespace-nowrap",children:RD(new Date(b.savedAt),{addSuffix:!0,locale:Ab})})]},b.id))})]})})]})]})}const LMe=[{id:"musinsa",label:"무신사"},{id:"hwahae",label:"화해"}];function gg(r){return r==null?"-":r==="<10"?"<10":typeof r=="number"?r.toLocaleString():String(r)}function bk(r){return r==="낮음"?"text-green-600":r==="보통"?"text-yellow-600":"text-red-500"}function yC(r){const e=Date.now()-new Date(r).getTime(),t=Math.floor(e/6e4);if(t<1)return"방금";if(t<60)return`${t}분 전`;const n=Math.floor(t/60);return n<24?`${n}시간 전`:`${Math.floor(n/24)}일 전`}function kMe({data:r}){const e=Math.max(...r.map(t=>t.ratio),1);return m.jsx("div",{className:"flex items-end gap-0.5 h-12",children:r.map(t=>m.jsxs("div",{className:"flex flex-col items-center flex-1 gap-0.5 group relative",children:[m.jsx("div",{className:"w-full bg-primary/70 rounded-sm transition-all",style:{height:`${Math.round(t.ratio/e*100)}%`}}),m.jsxs("div",{className:"absolute -top-6 left-1/2 -translate-x-1/2 hidden group-hover:block text-[10px] bg-popover border border-border rounded px-1 py-0.5 whitespace-nowrap z-10",children:[t.period,": ",t.ratio]})]},t.period))})}function RMe({kw:r,highlight:e}){const t=typeof r.monthlyPcQcCnt=="number"?r.monthlyPcQcCnt:0,n=typeof r.monthlyMobileQcCnt=="number"?r.monthlyMobileQcCnt:0,a=t+n;return m.jsxs("tr",{className:zr("border-b border-border/50 text-[12px]",e&&"bg-muted/50"),children:[m.jsx("td",{className:"py-2 px-3 font-medium text-foreground",children:r.relKeyword}),m.jsx("td",{className:"py-2 px-3 text-right tabular-nums text-muted-foreground",children:gg(r.monthlyPcQcCnt)}),m.jsx("td",{className:"py-2 px-3 text-right tabular-nums text-muted-foreground",children:gg(r.monthlyMobileQcCnt)}),m.jsx("td",{className:"py-2 px-3 text-right tabular-nums font-medium",children:a>0?a.toLocaleString():gg(r.monthlyPcQcCnt)}),m.jsx("td",{className:zr("py-2 px-3 text-center font-medium",bk(r.compIdx)),children:r.compIdx})]})}function EMe({ranking:r}){return r?m.jsxs("div",{children:[m.jsx("div",{className:"flex items-center gap-2 mb-3",children:m.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[r.platformLabel," · ",r.items.length,"개 ·"," ",new Date(r.fetchedAt).toLocaleTimeString("ko-KR",{hour:"2-digit",minute:"2-digit"})," ","기준"]})}),m.jsx("div",{className:"border border-border rounded-lg overflow-hidden",children:m.jsxs("table",{className:"w-full",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border bg-muted/40",children:[m.jsx("th",{className:"py-2 px-3 text-left text-[11px] text-muted-foreground font-medium w-8",children:"순위"}),m.jsx("th",{className:"py-2 px-3 text-left text-[11px] text-muted-foreground font-medium",children:"상품명"}),m.jsx("th",{className:"py-2 px-3 text-left text-[11px] text-muted-foreground font-medium",children:"브랜드"}),m.jsx("th",{className:"py-2 px-3 text-right text-[11px] text-muted-foreground font-medium",children:"가격"}),m.jsx("th",{className:"py-2 px-3 text-right text-[11px] text-muted-foreground font-medium",children:"리뷰"}),m.jsx("th",{className:"py-2 px-3 text-center text-[11px] text-muted-foreground font-medium w-8",children:"링크"})]})}),m.jsx("tbody",{children:r.items.map(e=>m.jsxs("tr",{className:"border-b border-border/50 hover:bg-muted/30 transition-colors text-[12px]",children:[m.jsx("td",{className:"py-2 px-3 text-muted-foreground tabular-nums text-center",children:e.rank}),m.jsx("td",{className:"py-2 px-3 font-medium max-w-[220px] truncate",children:e.name||"-"}),m.jsx("td",{className:"py-2 px-3 text-muted-foreground",children:e.brand||"-"}),m.jsx("td",{className:"py-2 px-3 text-right tabular-nums",children:e.price?m.jsxs("span",{children:[e.price.toLocaleString(),e.discountRate?m.jsxs("span",{className:"ml-1 text-[10px] text-red-500",children:["-",e.discountRate,"%"]}):null]}):"-"}),m.jsx("td",{className:"py-2 px-3 text-right tabular-nums text-muted-foreground",children:e.reviewCount?e.reviewCount.toLocaleString():"-"}),m.jsx("td",{className:"py-2 px-3 text-center",children:e.url?m.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex text-muted-foreground hover:text-foreground transition-colors",children:m.jsx(Qc,{size:12})}):"-"})]},e.rank))})]})})]}):null}function IMe({onSelectKeyword:r,onSelectPlatform:e}){const{data:t,isLoading:n}=SZ(),[a,i]=Y.useState(!0);return n||!t||t.length===0?null:m.jsxs("section",{className:"mt-8",children:[m.jsxs("button",{type:"button",onClick:()=>i(o=>!o),className:"flex items-center gap-2 mb-3 text-[13px] font-semibold text-muted-foreground hover:text-foreground transition-colors",children:[m.jsx(uee,{size:13}),"CLI 기록",m.jsxs("span",{className:"text-[11px] font-normal opacity-60",children:["(",t.length,"건)"]}),m.jsx("span",{className:"ml-auto text-[11px]",children:a?"▲":"▼"})]}),a&&m.jsx("div",{className:"border border-border rounded-lg overflow-hidden divide-y divide-border",children:t.map(o=>m.jsx(OMe,{entry:o,onSelectKeyword:r,onSelectPlatform:e},o.id))})]})}function OMe({entry:r,onSelectKeyword:e,onSelectPlatform:t}){var n;if(r.type==="keyword"){const a=(n=r.volume)==null?void 0:n.results[0],i=typeof(a==null?void 0:a.monthlyPcQcCnt)=="number"?a.monthlyPcQcCnt:0,o=typeof(a==null?void 0:a.monthlyMobileQcCnt)=="number"?a.monthlyMobileQcCnt:0,s=i+o;return m.jsxs("button",{type:"button",onClick:()=>e(r),className:"w-full flex items-center gap-3 px-4 py-2.5 hover:bg-muted/40 transition-colors text-left",children:[m.jsx(wg,{size:11,className:"text-muted-foreground shrink-0"}),m.jsx("span",{className:"text-[13px] font-medium flex-1",children:r.keyword}),s>0&&m.jsxs("span",{className:"text-[11px] tabular-nums text-muted-foreground",children:[s.toLocaleString(),"회"]}),(a==null?void 0:a.compIdx)&&m.jsx("span",{className:zr("text-[11px]",bk(a.compIdx)),children:a.compIdx}),m.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:yC(r.timestamp)})]})}return r.type==="compare"?m.jsxs("button",{type:"button",onClick:()=>e(r),className:"w-full flex items-center gap-3 px-4 py-2.5 hover:bg-muted/40 transition-colors text-left",children:[m.jsx(Sg,{size:11,className:"text-muted-foreground shrink-0"}),m.jsx("span",{className:"text-[13px] font-medium flex-1",children:r.keywords.join(" vs ")}),m.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:yC(r.timestamp)})]}):m.jsxs("button",{type:"button",onClick:()=>t(r),className:"w-full flex items-center gap-3 px-4 py-2.5 hover:bg-muted/40 transition-colors text-left",children:[m.jsx(Pl,{size:11,className:"text-muted-foreground shrink-0"}),m.jsxs("span",{className:"text-[13px] font-medium flex-1",children:[r.platformLabel," 랭킹"]}),m.jsxs("span",{className:"text-[11px] tabular-nums text-muted-foreground",children:[r.ranking.items.length,"위"]}),m.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:yC(r.timestamp)})]})}function PMe(){var I,z,j,G,U,O;const{data:r}=xZ(),[e,t]=Y.useState(""),[n,a]=Y.useState(null),[i,o]=Y.useState(!1),[s,l]=Y.useState(null),[u,c]=Y.useState(null),[f,h]=Y.useState(null),[v,g]=Y.useState(!1),[y,b]=Y.useState(null),_=Y.useRef(new Map);async function S(){const H=e.trim();if(H){o(!0),l(null),a(null);try{const F=await bZ(H);F.error==="not_configured"?l(F.message??"채널이 설정되지 않았습니다"):F.error?l(F.message??F.error):a(F)}catch(F){l(F instanceof Error?F.message:String(F))}finally{o(!1)}}}async function T(H,F=!1){if(c(H),b(null),!F&&_.current.has(H)){h(_.current.get(H));return}g(!0),h(null);try{const $=await _Z(H,20);$.error==="not_configured"?b($.message??"Apify가 설정되지 않았습니다"):$.error?b($.message??$.error):(_.current.set(H,$),h($))}catch($){b($ instanceof Error?$.message:String($))}finally{g(!1)}}function C(H){if(u===H&&f){c(null),h(null);return}T(H)}function M(){u&&T(u,!0)}function D(H){if(H.type==="keyword")t(H.keyword),a({keyword:H.keyword,volume:H.volume,trend:H.trend}),l(null),c(null),h(null);else{const F=H.keywords.join(", ");t(F),a({keyword:F,trend:H.trend}),l(null),c(null),h(null)}}function L(H){const F={ranking:H.ranking};_.current.set(H.platform,F),c(H.platform),h(F),b(null),a(null),l(null)}const k=((j=(z=(I=n==null?void 0:n.trend)==null?void 0:I.results)==null?void 0:z[0])==null?void 0:j.data)??[],R=((G=n==null?void 0:n.volume)==null?void 0:G.results)??[],E=R[0]??null;return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center justify-between mb-6",children:[m.jsx("h2",{className:"text-xl font-medium",children:"트렌드"}),r&&m.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[m.jsx("span",{className:zr("w-1.5 h-1.5 rounded-full",r.searchad?"bg-green-500":"bg-muted-foreground/30")}),"검색광고",m.jsx("span",{className:zr("w-1.5 h-1.5 rounded-full",r.datalab?"bg-green-500":"bg-muted-foreground/30")}),"데이터랩",m.jsx("span",{className:zr("w-1.5 h-1.5 rounded-full",r.apify?"bg-green-500":"bg-muted-foreground/30")}),"Apify"]})]}),m.jsxs("section",{className:"mb-8",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[m.jsx(wg,{size:13,className:"text-muted-foreground"}),m.jsx("span",{className:"text-[13px] font-semibold text-muted-foreground",children:"키워드 검색량"})]}),m.jsxs("div",{className:"flex gap-2 mb-4",children:[m.jsx("input",{type:"text",value:e,onChange:H=>t(H.target.value),onKeyDown:H=>H.key==="Enter"&&!i&&S(),placeholder:"키워드 입력 (예: 여름 원피스)",className:"flex-1 h-9 px-3 text-[13px] border border-border rounded-md bg-background focus:outline-none focus:ring-1 focus:ring-ring"}),m.jsx("button",{type:"button",onClick:S,disabled:i||!e.trim(),className:"h-9 px-4 text-[13px] font-medium bg-primary text-primary-foreground rounded-md hover:bg-primary/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-1.5",children:i?m.jsxs(m.Fragment,{children:[m.jsx(_x,{size:12,className:"animate-spin"}),"조회 중"]}):m.jsxs(m.Fragment,{children:[m.jsx(wg,{size:12}),"검색"]})})]}),s&&m.jsx("div",{className:"flex items-center gap-2 text-[12px] text-red-600 bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900/50 rounded-lg px-4 py-3 mb-4",children:s}),n&&!s&&m.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[E&&m.jsx("div",{className:"px-5 py-4 border-b border-border bg-muted/30",children:m.jsxs("div",{className:"flex items-center gap-6",children:[m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] text-muted-foreground mb-0.5",children:"키워드"}),m.jsx("div",{className:"text-[14px] font-semibold",children:E.relKeyword})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] text-muted-foreground mb-0.5",children:"PC 검색량"}),m.jsx("div",{className:"text-[14px] font-semibold tabular-nums",children:gg(E.monthlyPcQcCnt)})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] text-muted-foreground mb-0.5",children:"모바일 검색량"}),m.jsx("div",{className:"text-[14px] font-semibold tabular-nums",children:gg(E.monthlyMobileQcCnt)})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] text-muted-foreground mb-0.5",children:"합계"}),m.jsx("div",{className:"text-[14px] font-semibold tabular-nums",children:(()=>{const H=typeof E.monthlyPcQcCnt=="number"?E.monthlyPcQcCnt:0,F=typeof E.monthlyMobileQcCnt=="number"?E.monthlyMobileQcCnt:0;return(H+F).toLocaleString()})()})]}),m.jsxs("div",{children:[m.jsx("div",{className:"text-[11px] text-muted-foreground mb-0.5",children:"경쟁강도"}),m.jsx("div",{className:zr("text-[14px] font-semibold",bk(E.compIdx)),children:E.compIdx})]})]})}),k.length>0&&m.jsxs("div",{className:"px-5 py-4 border-b border-border",children:[m.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[m.jsx(Pl,{size:12,className:"text-muted-foreground"}),m.jsx("span",{className:"text-[11px] text-muted-foreground font-medium",children:"최근 3개월 트렌드 (월별 상대지수)"})]}),m.jsx(kMe,{data:k}),m.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1",children:[m.jsx("span",{children:(U=k[0])==null?void 0:U.period}),m.jsx("span",{children:(O=k[k.length-1])==null?void 0:O.period})]})]}),R.length>1&&m.jsx("div",{className:"overflow-x-auto",children:m.jsxs("table",{className:"w-full",children:[m.jsx("thead",{children:m.jsxs("tr",{className:"border-b border-border bg-muted/30",children:[m.jsx("th",{className:"py-2 px-3 text-left text-[11px] text-muted-foreground font-medium",children:"연관 키워드"}),m.jsx("th",{className:"py-2 px-3 text-right text-[11px] text-muted-foreground font-medium",children:"PC"}),m.jsx("th",{className:"py-2 px-3 text-right text-[11px] text-muted-foreground font-medium",children:"모바일"}),m.jsx("th",{className:"py-2 px-3 text-right text-[11px] text-muted-foreground font-medium",children:"합계"}),m.jsx("th",{className:"py-2 px-3 text-center text-[11px] text-muted-foreground font-medium",children:"경쟁강도"})]})}),m.jsx("tbody",{children:R.map((H,F)=>m.jsx(RMe,{kw:H,highlight:F%2===1},H.relKeyword))})]})})]}),!n&&!i&&!s&&m.jsxs("div",{className:"border border-dashed border-border rounded-lg p-8 text-center text-muted-foreground text-sm",children:[m.jsx(Sg,{size:24,className:"mx-auto mb-3 opacity-30"}),m.jsx("p",{className:"text-[13px]",children:"키워드를 입력하면 검색량과 트렌드를 조회합니다"})]})]}),m.jsxs("section",{children:[m.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[m.jsx(Pl,{size:13,className:"text-muted-foreground"}),m.jsx("span",{className:"text-[13px] font-semibold text-muted-foreground",children:"전문몰 랭킹"}),r&&!r.apify&&m.jsx("span",{className:"text-[11px] text-muted-foreground",children:"· Apify 미설정"})]}),m.jsxs("div",{className:"flex flex-wrap gap-1.5 mb-4",children:[LMe.map(H=>m.jsx("button",{type:"button",onClick:()=>C(H.id),className:zr("px-3 py-1.5 text-[12px] rounded-md border transition-colors",u===H.id?"border-foreground/50 bg-muted text-foreground font-medium":"border-border text-muted-foreground hover:border-foreground/30 hover:text-foreground"),children:H.label},H.id)),f&&u&&!v&&m.jsxs("button",{type:"button",onClick:M,className:"ml-auto flex items-center gap-1 px-2.5 py-1.5 text-[11px] border border-border rounded-md text-muted-foreground hover:border-foreground/30 hover:text-foreground transition-colors",title:"Apify 재조회 (비용 발생)",children:[m.jsx(_x,{size:11}),"새로고침"]})]}),v&&m.jsxs("div",{className:"flex items-center gap-2 py-8 justify-center text-[12px] text-muted-foreground",children:[m.jsx(_x,{size:13,className:"animate-spin"}),"랭킹 수집 중... (최대 2분 소요)"]}),y&&!v&&m.jsx("div",{className:"flex items-center gap-2 text-[12px] text-red-600 bg-red-50 dark:bg-red-950/20 border border-red-200 dark:border-red-900/50 rounded-lg px-4 py-3",children:y}),(f==null?void 0:f.ranking)&&!v&&m.jsx(EMe,{ranking:f.ranking}),!u&&!v&&m.jsxs("div",{className:"border border-dashed border-border rounded-lg p-8 text-center text-muted-foreground text-sm",children:[m.jsx(Pl,{size:24,className:"mx-auto mb-3 opacity-30"}),m.jsx("p",{className:"text-[13px]",children:"플랫폼을 선택하면 실시간 랭킹을 수집합니다"}),m.jsx("p",{className:"text-[11px] mt-1 opacity-70",children:"Apify 기반 · 수집에 1-2분 소요"})]})]}),m.jsx(IMe,{onSelectKeyword:D,onSelectPlatform:L})]})}const jMe=["overview","session","config","orders","products","channels","sourcing","trend","settlement"];function xG(){const r=window.location.hash.slice(1).split("?")[0];return jMe.includes(r)?r:"overview"}function bG(){const r=window.location.hash.slice(1),e=r.indexOf("?");return e===-1?new URLSearchParams:new URLSearchParams(r.slice(e+1))}const zMe=[{type:"item",id:"overview",label:"Overview",icon:dee},{type:"item",id:"session",label:"Session",icon:tee},{type:"item",id:"config",label:"Settings",icon:aH},{type:"section",label:"상품전략"},{type:"item",id:"trend",label:"트렌드",icon:Pl},{type:"item",id:"sourcing",label:"소싱",icon:wg},{type:"item",id:"products",label:"상품",icon:Qx},{type:"section",label:"판매채널"},{type:"item",id:"channels",label:"채널",icon:gee},{type:"item",id:"orders",label:"주문",icon:Oee},{type:"item",id:"settlement",label:"정산",icon:Cee}];function BMe(){const[r,e]=Y.useState(xG),[t,n]=Y.useState(bG);Y.useEffect(()=>{const i=()=>{e(xG()),n(bG())};return window.addEventListener("hashchange",i),()=>window.removeEventListener("hashchange",i)},[]);const a=i=>{window.location.hash=i};return m.jsxs(MD,{delayDuration:200,children:[m.jsxs("div",{className:"flex min-h-screen",children:[m.jsx(Wae,{nav:zMe,activeId:r,onNavigate:i=>a(i),appLabel:"v0.1.0"}),m.jsx("main",{className:"flex-1 overflow-y-auto",children:m.jsxs("div",{className:"max-w-[1280px] mx-auto p-7",children:[r==="overview"&&m.jsx(rMe,{}),r==="session"&&m.jsx(uMe,{}),r==="config"&&m.jsx(kie,{initMode:t.get("mode")==="init"}),r==="orders"&&m.jsx(Rie,{}),r==="products"&&m.jsx(nMe,{}),r==="channels"&&m.jsx(Xae,{}),r==="sourcing"&&m.jsx(NMe,{}),r==="trend"&&m.jsx(PMe,{}),r==="settlement"&&m.jsx(yMe,{})]})})]}),m.jsx($ae,{})]})}const VMe=new Yq({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1,staleTime:1e4}}}),o$=document.getElementById("root");if(!o$)throw new Error("Root element not found");fZ.createRoot(o$).render(m.jsx(Y.StrictMode,{children:m.jsx(Xq,{client:VMe,children:m.jsx(BMe,{})})}));
|