@vacano/ui 1.15.5 → 1.15.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +223 -210
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +911 -895
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./keyboard-D8zOi0jU.cjs"),X=require("./index-GSZAZ6Cz.cjs"),i=require("./X-CI1qRJDP.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./keyboard-D8zOi0jU.cjs"),X=require("./index-GSZAZ6Cz.cjs"),i=require("./X-CI1qRJDP.cjs"),P=require("@emotion/react"),u=require("react"),d=require("./ToggleGroup-C3ReF8j7.cjs"),C=require("./tooling-Dflq0Y98.cjs"),De=require("react-dom"),Le=require("./CircleX-BzaN6v37.cjs"),jt=P.css`
|
|
2
2
|
*,
|
|
3
3
|
*::before,
|
|
4
4
|
*::after {
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
:focus:not(:focus-visible) {
|
|
101
101
|
outline: none;
|
|
102
102
|
}
|
|
103
|
-
`,Et=()=>i.jsx(
|
|
103
|
+
`,Et=()=>i.jsx(P.Global,{styles:jt}),zt=d.styled.div`
|
|
104
104
|
display: flex;
|
|
105
105
|
flex-direction: column;
|
|
106
106
|
gap: ${({$variant:e})=>e==="splitted"?"8px":"0"};
|
|
@@ -440,7 +440,13 @@
|
|
|
440
440
|
-webkit-backdrop-filter: blur(10px);
|
|
441
441
|
border-top: 1px solid ${n.alpha(n.COLORS["iron-grey"],15)};
|
|
442
442
|
`}
|
|
443
|
-
`,Oo=C.newClassNameGetter("card"),wo=({blurred:e=!1,border:t=!1,children:o,className:r,disabled:l=!1,footerBlurred:a=!1,fullWidth:c=!1,hoverable:s=!1,pressable:p=!1,radius:x="lg",ref:g,shadow:h="md",...y})=>{const f=typeof h=="boolean"?h?"md":"none":h;return i.jsx(bo,{...y,ref:g,className:Oo("container",r),$blurred:e,$border:t,$disabled:l,$footerBlurred:a,$fullWidth:c,$hoverable:s,$pressable:p,$radius:x,$shadow:f,tabIndex:p&&!l?0:void 0,role:p?"button":void 0,children:o})},vo=C.newClassNameGetter("card"),Co=({children:e,className:t,ref:o,...r})=>i.jsx(So,{...r,ref:o,className:vo("body",t),children:e}),Ro=C.newClassNameGetter("card"),Lo=({blurred:e=!1,children:t,className:o,ref:r,...l})=>i.jsx(mo,{...l,ref:r,className:Ro("footer",o),$blurred:e,children:t}),ko=C.newClassNameGetter("card"),jo=({children:e,className:t,ref:o,...r})=>i.jsx($o,{...r,ref:o,className:ko("header",t),children:e}),Eo="Confirm",zo="Cancel",No=
|
|
443
|
+
`,Oo=C.newClassNameGetter("card"),wo=({blurred:e=!1,border:t=!1,children:o,className:r,disabled:l=!1,footerBlurred:a=!1,fullWidth:c=!1,hoverable:s=!1,pressable:p=!1,radius:x="lg",ref:g,shadow:h="md",...y})=>{const f=typeof h=="boolean"?h?"md":"none":h;return i.jsx(bo,{...y,ref:g,className:Oo("container",r),$blurred:e,$border:t,$disabled:l,$footerBlurred:a,$fullWidth:c,$hoverable:s,$pressable:p,$radius:x,$shadow:f,tabIndex:p&&!l?0:void 0,role:p?"button":void 0,children:o})},vo=C.newClassNameGetter("card"),Co=({children:e,className:t,ref:o,...r})=>i.jsx(So,{...r,ref:o,className:vo("body",t),children:e}),Ro=C.newClassNameGetter("card"),Lo=({blurred:e=!1,children:t,className:o,ref:r,...l})=>i.jsx(mo,{...l,ref:r,className:Ro("footer",o),$blurred:e,children:t}),ko=C.newClassNameGetter("card"),jo=({children:e,className:t,ref:o,...r})=>i.jsx($o,{...r,ref:o,className:ko("header",t),children:e}),Eo="Confirm",zo="Cancel",No=P.keyframes`
|
|
444
|
+
from { opacity: 0; }
|
|
445
|
+
to { opacity: 1; }
|
|
446
|
+
`,To=P.keyframes`
|
|
447
|
+
from { opacity: 1; }
|
|
448
|
+
to { opacity: 0; }
|
|
449
|
+
`,Io=P.keyframes`
|
|
444
450
|
from {
|
|
445
451
|
opacity: 0;
|
|
446
452
|
transform: translateX(-50%) translateY(100%);
|
|
@@ -449,7 +455,7 @@
|
|
|
449
455
|
opacity: 1;
|
|
450
456
|
transform: translateX(-50%) translateY(0);
|
|
451
457
|
}
|
|
452
|
-
`,
|
|
458
|
+
`,Ao=P.keyframes`
|
|
453
459
|
from {
|
|
454
460
|
opacity: 1;
|
|
455
461
|
transform: translateX(-50%) translateY(0);
|
|
@@ -458,7 +464,14 @@
|
|
|
458
464
|
opacity: 0;
|
|
459
465
|
transform: translateX(-50%) translateY(100%);
|
|
460
466
|
}
|
|
461
|
-
`,
|
|
467
|
+
`,Po=d.styled.div`
|
|
468
|
+
position: fixed;
|
|
469
|
+
inset: 0;
|
|
470
|
+
z-index: 999;
|
|
471
|
+
background-color: rgba(0, 0, 0, 0.15);
|
|
472
|
+
backdrop-filter: blur(2px);
|
|
473
|
+
animation: ${({$isExiting:e})=>e?To:No} 0.2s ease-out forwards;
|
|
474
|
+
`,Bo=d.styled.div`
|
|
462
475
|
position: fixed;
|
|
463
476
|
bottom: 24px;
|
|
464
477
|
left: 50%;
|
|
@@ -472,18 +485,18 @@
|
|
|
472
485
|
box-shadow:
|
|
473
486
|
0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
474
487
|
0 2px 4px -2px rgba(0, 0, 0, 0.1);
|
|
475
|
-
animation: ${({$isExiting:e})=>e?
|
|
488
|
+
animation: ${({$isExiting:e})=>e?Ao:Io} 0.2s ease-out forwards;
|
|
476
489
|
z-index: 1000;
|
|
477
|
-
`,
|
|
490
|
+
`,Mo=d.styled.p`
|
|
478
491
|
margin: 0;
|
|
479
492
|
font-size: 14px;
|
|
480
493
|
color: ${n.COLORS.black};
|
|
481
494
|
white-space: nowrap;
|
|
482
|
-
`,
|
|
495
|
+
`,Fo=d.styled.div`
|
|
483
496
|
display: flex;
|
|
484
497
|
align-items: center;
|
|
485
498
|
gap: 8px;
|
|
486
|
-
`,
|
|
499
|
+
`,_o=({confirmation:e,onDone:t})=>{const[o,r]=u.useState(!1),[l,a]=u.useState(!1),{message:c,onConfirm:s,onCancel:p,options:x}=e,g=x.confirmLabel||Eo,h=x.cancelLabel||zo,y=u.useCallback(b=>{r(!0),setTimeout(()=>{b==null||b(),t()},200)},[t]),f=u.useCallback(async()=>{const b=s();if(b instanceof Promise){a(!0);try{await b}finally{a(!1)}}y()},[y,s]),S=u.useCallback(()=>{l||y(p)},[y,l,p]);return u.useEffect(()=>{const b=$=>{$.key==="Escape"&&!l&&S()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[S,l]),i.jsxs(i.Fragment,{children:[i.jsx(Po,{$isExiting:o,onClick:S}),i.jsxs(Bo,{$isExiting:o,children:[i.jsx(Mo,{children:c}),i.jsxs(Fo,{children:[i.jsx(d.Button,{variant:"system",size:"compact",onClick:S,disabled:l,children:h}),i.jsx(d.Button,{variant:"danger",size:"compact",onClick:f,loading:l,children:g})]})]})]})},ht=u.createContext(null),Do=()=>{},Go=({children:e})=>{const[t,o]=u.useState(null),r=u.useCallback((a,c,s,p)=>{o({open:!0,message:a,onConfirm:c,onCancel:s||Do,options:p||{}})},[]),l=u.useCallback(()=>{o(null)},[]);return i.jsxs(ht.Provider,{value:{show:r,hide:l},children:[e,t&&i.jsx(_o,{confirmation:t,onDone:l})]})},Yo=()=>{const e=u.useContext(ht);if(!e)throw new Error("useConfirmation must be used within ConfirmationProvider");return e},le={sm:`${n.BREAKPOINTS.sm}px`,md:`${n.BREAKPOINTS.md}px`,lg:`${n.BREAKPOINTS.lg}px`,xl:`${n.BREAKPOINTS.xl}px`,"2xl":`${n.BREAKPOINTS["2xl"]}px`},Ho=d.styled.div`
|
|
487
500
|
width: 100%;
|
|
488
501
|
|
|
489
502
|
${X.mediaUp("sm")} {
|
|
@@ -505,16 +518,16 @@
|
|
|
505
518
|
${X.mediaUp("2xl")} {
|
|
506
519
|
max-width: ${le["2xl"]};
|
|
507
520
|
}
|
|
508
|
-
`,
|
|
521
|
+
`,Xo=C.newClassNameGetter("container"),Uo=({children:e,className:t,ref:o,...r})=>i.jsx(Ho,{...r,ref:o,className:Xo("container",t),children:e}),qe=(e,t)=>new Intl.DateTimeFormat(t,{year:"numeric",month:"long"}).format(e),Wo=d.styled.span`
|
|
509
522
|
display: inline-flex;
|
|
510
523
|
align-items: baseline;
|
|
511
524
|
gap: 5px;
|
|
512
525
|
font-size: 13px;
|
|
513
526
|
font-weight: 500;
|
|
514
527
|
color: ${n.COLORS["iron-grey"]};
|
|
515
|
-
`,
|
|
528
|
+
`,qo=d.styled.span`
|
|
516
529
|
font-weight: 500;
|
|
517
|
-
`,
|
|
530
|
+
`,Ko=d.styled.span``,ae=C.newClassNameGetter("date-range"),Vo=({className:e,classnames:t,from:o,locale:r="en",presentLabel:l="Present Time",ref:a,to:c,...s})=>i.jsxs(Wo,{...s,ref:a,className:ae("container",e),children:[i.jsx(qo,{className:ae("hash",t==null?void 0:t.hash),children:"#"}),i.jsx("span",{className:ae("from",t==null?void 0:t.from),children:qe(o,r)}),i.jsx(Ko,{className:ae("separator",t==null?void 0:t.separator),children:"—"}),i.jsx("span",{className:ae("to",t==null?void 0:t.to),children:c?qe(c,r):l})]}),Zo=d.styled.div`
|
|
518
531
|
display: flex;
|
|
519
532
|
flex-direction: row;
|
|
520
533
|
align-items: center;
|
|
@@ -525,11 +538,11 @@
|
|
|
525
538
|
flex: 1;
|
|
526
539
|
height: 1px;
|
|
527
540
|
background-color: ${n.COLORS.gray};
|
|
528
|
-
`,
|
|
541
|
+
`,Qo=d.styled.span`
|
|
529
542
|
font-size: 12px;
|
|
530
543
|
color: ${n.COLORS["iron-grey"]};
|
|
531
544
|
white-space: nowrap;
|
|
532
|
-
`,fe=C.newClassNameGetter("divider"),
|
|
545
|
+
`,fe=C.newClassNameGetter("divider"),Jo=({children:e,className:t,classnames:o,ref:r,spacing:l=8,...a})=>i.jsxs(Zo,{...a,ref:r,className:fe("container",t),$spacing:l,children:[i.jsx(Ke,{className:fe("line",o==null?void 0:o.line)}),e&&i.jsxs(i.Fragment,{children:[i.jsx(Qo,{className:fe("label",o==null?void 0:o.label),children:e}),i.jsx(Ke,{className:fe("line",o==null?void 0:o.line)})]})]}),er={left:n.KEYFRAMES.slideInLeft,right:n.KEYFRAMES.slideInRight,top:n.KEYFRAMES.slideInTop,bottom:n.KEYFRAMES.slideInBottom},tr=(e,t)=>{switch(e){case"left":return`
|
|
533
546
|
top: 0;
|
|
534
547
|
left: 0;
|
|
535
548
|
height: 100%;
|
|
@@ -549,17 +562,17 @@
|
|
|
549
562
|
left: 0;
|
|
550
563
|
width: 100%;
|
|
551
564
|
height: ${t};
|
|
552
|
-
`}},
|
|
565
|
+
`}},or=d.styled.div`
|
|
553
566
|
position: fixed;
|
|
554
567
|
z-index: 1001;
|
|
555
568
|
background-color: ${n.COLORS.white};
|
|
556
569
|
box-shadow: 0 4px 24px ${n.alpha(n.COLORS.black,20)};
|
|
557
|
-
${e=>
|
|
558
|
-
animation: ${e=>
|
|
559
|
-
`,
|
|
570
|
+
${e=>tr(e.$position,e.$size)}
|
|
571
|
+
animation: ${e=>er[e.$position]} ${e=>e.$animated?"0.05s":"0s"} ease-out forwards;
|
|
572
|
+
`,rr=C.newClassNameGetter("drawer"),nr=({animated:e,children:t,className:o,open:r,position:l="right",ref:a,size:c="400px",...s})=>r?De.createPortal(i.jsx(or,{...s,ref:a,className:rr("container",o),$animated:!!e,$position:l,$size:c,children:t}),document.body):null,ir=d.styled.div`
|
|
560
573
|
position: relative;
|
|
561
574
|
display: inline-block;
|
|
562
|
-
`,
|
|
575
|
+
`,lr=d.styled.div`
|
|
563
576
|
cursor: pointer;
|
|
564
577
|
`,ft=`
|
|
565
578
|
z-index: 100;
|
|
@@ -569,7 +582,7 @@
|
|
|
569
582
|
border: 1px solid ${n.COLORS.gray};
|
|
570
583
|
border-radius: 8px;
|
|
571
584
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
572
|
-
`,yt=(e,t)=>e?"translateY(0)":t==="bottom"?"translateY(-8px)":"translateY(8px)",
|
|
585
|
+
`,yt=(e,t)=>e?"translateY(0)":t==="bottom"?"translateY(-8px)":"translateY(8px)",ar=d.styled.div`
|
|
573
586
|
position: absolute;
|
|
574
587
|
${({$position:e})=>e==="bottom"?"top: calc(100% + 4px);":"bottom: calc(100% + 4px);"}
|
|
575
588
|
${({$align:e})=>e==="left"?"left: 0;":"right: 0;"}
|
|
@@ -581,7 +594,7 @@
|
|
|
581
594
|
opacity 0.15s ease,
|
|
582
595
|
transform 0.15s ease,
|
|
583
596
|
visibility 0.15s;
|
|
584
|
-
`,
|
|
597
|
+
`,dr=d.styled.div`
|
|
585
598
|
position: fixed;
|
|
586
599
|
${ft}
|
|
587
600
|
opacity: ${({$open:e})=>e?1:0};
|
|
@@ -591,13 +604,13 @@
|
|
|
591
604
|
opacity 0.15s ease,
|
|
592
605
|
transform 0.15s ease,
|
|
593
606
|
visibility 0.15s;
|
|
594
|
-
`,ye=C.newClassNameGetter("dropdown"),be=4,
|
|
607
|
+
`,ye=C.newClassNameGetter("dropdown"),be=4,sr=100,cr=({align:e="left",autoClose:t=!0,children:o,className:r,classnames:l,onClose:a,onOpen:c,open:s,portalRenderNode:p,ref:x,trigger:g,...h})=>{const[y,f]=u.useState(!1),[S,b]=u.useState({top:0,left:0}),[$,m]=u.useState("bottom"),O=u.useRef(null),w=u.useRef(null),k=u.useRef(null),z=s!==void 0,j=z?s:y,L=u.useCallback(()=>{var _,D;if(!w.current)return;const N=w.current.getBoundingClientRect(),M=((_=k.current)==null?void 0:_.offsetHeight)??sr,Y=((D=k.current)==null?void 0:D.offsetWidth)??160,F=window.innerHeight-N.bottom-be,U=N.top-be,W=F<M&&U>F?"top":"bottom";if(m(W),p){let q;e==="left"?q=N.left:q=N.right-Y;const kt=W==="bottom"?N.bottom+be:N.top-M-be;b({top:kt,left:q})}},[e,p]),R=u.useCallback(()=>{z?j?a==null||a():c==null||c():f(N=>{const M=!N;return M?c==null||c():a==null||a(),M})},[z,j,a,c]),E=u.useCallback(()=>{z||f(!1),a==null||a()},[z,a]),v=u.useCallback(()=>{t&&E()},[t,E]);u.useLayoutEffect(()=>{j&&L()},[j,L]),u.useEffect(()=>{const N=U=>{const W=U.target,_=O.current&&!O.current.contains(W),D=k.current&&!k.current.contains(W);p?_&&D&&E():_&&E()},M=U=>{U.key==="Escape"&&E()},Y=()=>{j&&p&&L()},F=()=>{j&&p&&L()};return j&&(document.addEventListener("mousedown",N),document.addEventListener("keydown",M),p&&(window.addEventListener("scroll",Y,!0),window.addEventListener("resize",F))),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",M),window.removeEventListener("scroll",Y,!0),window.removeEventListener("resize",F)}},[j,E,p,L]);const T=p?De.createPortal(i.jsx(dr,{ref:k,$open:j,$position:$,className:ye("content",l==null?void 0:l.content),style:{top:S.top,left:S.left},onClick:v,children:o}),p):i.jsx(ar,{ref:k,$align:e,$open:j,$position:$,className:ye("content",l==null?void 0:l.content),onClick:v,children:o});return i.jsxs(ir,{...h,ref:x??O,className:ye("container",r),children:[i.jsx(lr,{ref:w,onClick:R,className:ye("trigger",l==null?void 0:l.trigger),children:u.cloneElement(g)}),T]})},pr=d.styled.div`
|
|
595
608
|
display: flex;
|
|
596
609
|
flex-direction: column;
|
|
597
610
|
align-items: center;
|
|
598
611
|
text-align: center;
|
|
599
612
|
padding: 40px 24px;
|
|
600
|
-
`,
|
|
613
|
+
`,ur=d.styled.div`
|
|
601
614
|
position: relative;
|
|
602
615
|
display: flex;
|
|
603
616
|
align-items: center;
|
|
@@ -605,7 +618,7 @@
|
|
|
605
618
|
width: 200px;
|
|
606
619
|
height: 200px;
|
|
607
620
|
margin-bottom: 16px;
|
|
608
|
-
`,
|
|
621
|
+
`,gr=d.styled.div`
|
|
609
622
|
position: absolute;
|
|
610
623
|
inset: 0;
|
|
611
624
|
|
|
@@ -626,7 +639,7 @@
|
|
|
626
639
|
inset: 8px;
|
|
627
640
|
opacity: 0.5;
|
|
628
641
|
}
|
|
629
|
-
`,
|
|
642
|
+
`,xr=d.styled.div`
|
|
630
643
|
position: absolute;
|
|
631
644
|
inset: 0;
|
|
632
645
|
|
|
@@ -646,7 +659,7 @@
|
|
|
646
659
|
&::after {
|
|
647
660
|
inset: 52px;
|
|
648
661
|
}
|
|
649
|
-
`,
|
|
662
|
+
`,hr=d.styled.div`
|
|
650
663
|
position: relative;
|
|
651
664
|
z-index: 1;
|
|
652
665
|
display: flex;
|
|
@@ -661,24 +674,24 @@
|
|
|
661
674
|
box-shadow:
|
|
662
675
|
0 1px 2px rgba(0, 0, 0, 0.05),
|
|
663
676
|
0 1px 3px rgba(0, 0, 0, 0.1);
|
|
664
|
-
`,
|
|
677
|
+
`,fr=d.styled.h3`
|
|
665
678
|
margin: 0 0 4px;
|
|
666
679
|
font-size: 16px;
|
|
667
680
|
font-weight: 600;
|
|
668
681
|
color: ${n.COLORS.black};
|
|
669
682
|
line-height: 1.4;
|
|
670
|
-
`,
|
|
683
|
+
`,yr=d.styled.p`
|
|
671
684
|
margin: 0;
|
|
672
685
|
font-size: 14px;
|
|
673
686
|
color: ${n.COLORS["iron-grey"]};
|
|
674
687
|
line-height: 1.5;
|
|
675
688
|
max-width: 360px;
|
|
676
|
-
`,
|
|
689
|
+
`,br=d.styled.div`
|
|
677
690
|
display: flex;
|
|
678
691
|
align-items: center;
|
|
679
692
|
gap: 12px;
|
|
680
693
|
margin-top: 20px;
|
|
681
|
-
`,de=C.newClassNameGetter("empty-state")
|
|
694
|
+
`,de=C.newClassNameGetter("empty-state"),$r=({actions:e,className:t,classnames:o,description:r,icon:l,ref:a,title:c,...s})=>i.jsxs(pr,{...s,ref:a,className:de("container",t),children:[l&&i.jsxs(ur,{className:de("icon",o==null?void 0:o.icon),children:[i.jsx(xr,{}),i.jsx(gr,{}),i.jsx(hr,{children:l})]}),i.jsx(fr,{className:de("title",o==null?void 0:o.title),children:c}),r&&i.jsx(yr,{className:de("description",o==null?void 0:o.description),children:r}),e&&i.jsx(br,{className:de("actions",o==null?void 0:o.actions),children:e})]}),Sr=d.styled.div`
|
|
682
695
|
display: grid;
|
|
683
696
|
grid-template-rows: auto 1fr auto;
|
|
684
697
|
grid-auto-flow: column;
|
|
@@ -703,12 +716,12 @@
|
|
|
703
716
|
> * > :not([class*='field-label']):not([class*='field-message']) {
|
|
704
717
|
grid-row: 2;
|
|
705
718
|
}
|
|
706
|
-
`,
|
|
719
|
+
`,mr=C.newClassNameGetter("field-row"),Or=({className:e,gap:t=16,ref:o,...r})=>i.jsx(Sr,{...r,ref:o,$gap:t,className:mr("container",e)}),bt=e=>{if(e===0)return"0 B";const t=["B","KB","MB","GB"],o=Math.floor(Math.log(e)/Math.log(1024)),r=e/Math.pow(1024,o);return`${r%1===0?r:r.toFixed(1)} ${t[o]}`},Ve=(e,t)=>t.split(",").map(r=>r.trim()).some(r=>r.startsWith(".")?e.name.toLowerCase().endsWith(r.toLowerCase()):r.endsWith("/*")?e.type.startsWith(r.replace("/*","/")):e.type===r),wr=d.styled.div`
|
|
707
720
|
flex-shrink: 0;
|
|
708
721
|
display: flex;
|
|
709
722
|
flex-direction: column;
|
|
710
723
|
gap: 16px;
|
|
711
|
-
`,
|
|
724
|
+
`,vr=d.styled.div`
|
|
712
725
|
display: flex;
|
|
713
726
|
flex-direction: column;
|
|
714
727
|
align-items: center;
|
|
@@ -730,7 +743,7 @@
|
|
|
730
743
|
background-color: #f9fafb;
|
|
731
744
|
}
|
|
732
745
|
`}
|
|
733
|
-
`,
|
|
746
|
+
`,Cr=d.styled.div`
|
|
734
747
|
display: flex;
|
|
735
748
|
align-items: center;
|
|
736
749
|
justify-content: center;
|
|
@@ -745,7 +758,7 @@
|
|
|
745
758
|
width: 20px;
|
|
746
759
|
height: 20px;
|
|
747
760
|
}
|
|
748
|
-
`,
|
|
761
|
+
`,Rr=d.styled.div`
|
|
749
762
|
display: flex;
|
|
750
763
|
flex-direction: column;
|
|
751
764
|
align-items: center;
|
|
@@ -753,29 +766,29 @@
|
|
|
753
766
|
font-size: 14px;
|
|
754
767
|
color: ${n.COLORS["iron-grey"]};
|
|
755
768
|
text-align: center;
|
|
756
|
-
`,
|
|
769
|
+
`,Lr=d.styled.span`
|
|
757
770
|
color: ${n.COLORS.black};
|
|
758
771
|
font-weight: 600;
|
|
759
772
|
cursor: pointer;
|
|
760
|
-
`,
|
|
773
|
+
`,kr=d.styled.div`
|
|
761
774
|
font-size: 12px;
|
|
762
775
|
color: ${n.COLORS["iron-grey"]};
|
|
763
776
|
text-align: center;
|
|
764
|
-
`,
|
|
777
|
+
`,jr=d.styled.input`
|
|
765
778
|
display: none;
|
|
766
779
|
`;d.styled.div`
|
|
767
780
|
display: flex;
|
|
768
781
|
flex-direction: column;
|
|
769
782
|
gap: 12px;
|
|
770
|
-
`;const
|
|
783
|
+
`;const Er={uploading:n.COLORS.gray,complete:n.COLORS.gray,failed:n.COLORS.red},zr=d.styled.div`
|
|
771
784
|
display: flex;
|
|
772
785
|
align-items: flex-start;
|
|
773
786
|
gap: 12px;
|
|
774
787
|
padding: 14px;
|
|
775
|
-
border: 1px solid ${({$status:e})=>
|
|
788
|
+
border: 1px solid ${({$status:e})=>Er[e]};
|
|
776
789
|
border-radius: 12px;
|
|
777
790
|
transition: border-color 0.15s ease;
|
|
778
|
-
`,
|
|
791
|
+
`,Nr=d.styled.div`
|
|
779
792
|
display: flex;
|
|
780
793
|
align-items: center;
|
|
781
794
|
justify-content: center;
|
|
@@ -790,54 +803,54 @@
|
|
|
790
803
|
width: 20px;
|
|
791
804
|
height: 20px;
|
|
792
805
|
}
|
|
793
|
-
`,
|
|
806
|
+
`,Tr=d.styled.div`
|
|
794
807
|
flex: 1;
|
|
795
808
|
min-width: 0;
|
|
796
809
|
display: flex;
|
|
797
810
|
flex-direction: column;
|
|
798
811
|
gap: 4px;
|
|
799
|
-
`,
|
|
812
|
+
`,Ir=d.styled.div`
|
|
800
813
|
display: flex;
|
|
801
814
|
align-items: flex-start;
|
|
802
815
|
justify-content: space-between;
|
|
803
816
|
gap: 8px;
|
|
804
|
-
`,
|
|
817
|
+
`,Ar=d.styled.div`
|
|
805
818
|
min-width: 0;
|
|
806
|
-
`,
|
|
819
|
+
`,Pr=d.styled.div`
|
|
807
820
|
font-size: 14px;
|
|
808
821
|
font-weight: 500;
|
|
809
822
|
color: ${n.COLORS.black};
|
|
810
823
|
white-space: nowrap;
|
|
811
824
|
overflow: hidden;
|
|
812
825
|
text-overflow: ellipsis;
|
|
813
|
-
`,
|
|
826
|
+
`,Br=d.styled.div`
|
|
814
827
|
font-size: 14px;
|
|
815
828
|
color: ${n.COLORS["iron-grey"]};
|
|
816
|
-
`,
|
|
829
|
+
`,Mr=d.styled.div`
|
|
817
830
|
display: flex;
|
|
818
831
|
align-items: center;
|
|
819
832
|
gap: 12px;
|
|
820
833
|
margin-top: 2px;
|
|
821
|
-
`,
|
|
834
|
+
`,Fr=d.styled.div`
|
|
822
835
|
flex: 1;
|
|
823
836
|
height: 8px;
|
|
824
837
|
border-radius: 4px;
|
|
825
838
|
background-color: ${n.COLORS.gray};
|
|
826
839
|
overflow: hidden;
|
|
827
|
-
`,
|
|
840
|
+
`,_r=d.styled.div`
|
|
828
841
|
height: 100%;
|
|
829
842
|
width: ${({$value:e})=>Math.min(100,Math.max(0,e))}%;
|
|
830
843
|
border-radius: 4px;
|
|
831
844
|
background-color: ${({$status:e})=>e==="failed"?n.COLORS.red:n.COLORS.black};
|
|
832
845
|
transition: width 0.2s ease;
|
|
833
|
-
`,
|
|
846
|
+
`,Dr=d.styled.span`
|
|
834
847
|
flex-shrink: 0;
|
|
835
848
|
font-size: 14px;
|
|
836
849
|
color: ${n.COLORS.black};
|
|
837
850
|
font-weight: 500;
|
|
838
851
|
min-width: 36px;
|
|
839
852
|
text-align: right;
|
|
840
|
-
`,
|
|
853
|
+
`,Gr=d.styled.button`
|
|
841
854
|
display: flex;
|
|
842
855
|
align-items: center;
|
|
843
856
|
justify-content: center;
|
|
@@ -860,7 +873,7 @@
|
|
|
860
873
|
&:hover {
|
|
861
874
|
color: ${n.COLORS.black};
|
|
862
875
|
}
|
|
863
|
-
`,
|
|
876
|
+
`,Yr=d.styled.button`
|
|
864
877
|
display: inline;
|
|
865
878
|
padding: 0;
|
|
866
879
|
border: none;
|
|
@@ -880,7 +893,7 @@
|
|
|
880
893
|
gap: 4px;
|
|
881
894
|
font-size: 14px;
|
|
882
895
|
color: ${n.COLORS["iron-grey"]};
|
|
883
|
-
`,
|
|
896
|
+
`,Hr=d.styled.span`
|
|
884
897
|
display: inline-flex;
|
|
885
898
|
color: ${n.COLORS.green};
|
|
886
899
|
|
|
@@ -888,7 +901,7 @@
|
|
|
888
901
|
width: 16px;
|
|
889
902
|
height: 16px;
|
|
890
903
|
}
|
|
891
|
-
`,$e=C.newClassNameGetter("file-upload"),
|
|
904
|
+
`,$e=C.newClassNameGetter("file-upload"),Xr=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),i.jsx("polyline",{points:"17 8 12 3 7 8"}),i.jsx("line",{x1:"12",x2:"12",y1:"3",y2:"15"})]}),Ur=({accept:e,children:t,className:o,classnames:r,description:l,disabled:a=!1,hint:c,icon:s,maxSize:p,multiple:x=!1,onChange:g,onReject:h,ref:y,...f})=>{const S=u.useRef(null),[b,$]=u.useState(!1),m=u.useCallback(L=>{if(!L||L.length===0)return;const R=Array.from(L);if(e){const E=R.filter(v=>!Ve(v,e));if(E.length>0){h==null||h(E,"type");const v=R.filter(T=>Ve(T,e));if(v.length===0)return;g==null||g(v);return}}if(p){const E=R.filter(v=>v.size>p);if(E.length>0){h==null||h(E,"size");const v=R.filter(T=>T.size<=p);if(v.length===0)return;g==null||g(v);return}}g==null||g(R)},[e,p,g,h]),O=()=>{var L;a||(L=S.current)==null||L.click()},w=L=>{m(L.target.files),S.current&&(S.current.value="")},k=L=>{L.preventDefault(),L.stopPropagation(),a||$(!0)},z=L=>{L.preventDefault(),L.stopPropagation(),$(!1)},j=L=>{L.preventDefault(),L.stopPropagation(),$(!1),a||m(L.dataTransfer.files)};return i.jsxs(wr,{ref:y,className:o,...f,children:[i.jsxs(vr,{className:$e("dropzone",r==null?void 0:r.dropzone),$disabled:a,$dragOver:b,onClick:O,onDragOver:k,onDragLeave:z,onDrop:j,role:"button",tabIndex:a?-1:0,"aria-disabled":a,children:[i.jsx(Cr,{className:$e("icon",r==null?void 0:r.icon),children:s||i.jsx(Xr,{})}),i.jsx(Rr,{className:$e("text",r==null?void 0:r.text),children:l||i.jsxs("span",{children:[i.jsx(Lr,{children:"Click to upload"})," or drag and drop"]})}),c&&i.jsx(kr,{className:$e("hint",r==null?void 0:r.hint),children:c})]}),i.jsx(jr,{ref:S,type:"file",accept:e,multiple:x,onChange:w,tabIndex:-1}),t]})},Q=C.newClassNameGetter("file-upload-item"),Wr=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),i.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"})]}),qr=()=>i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M18 6 6 18"}),i.jsx("path",{d:"m6 6 12 12"})]}),Kr=()=>i.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M20 6 9 17l-5-5"})}),Vr=({name:e,size:t,status:o="uploading",progress:r=0,icon:l,onRemove:a,onRetry:c,className:s,classnames:p,ref:x})=>i.jsxs(zr,{ref:x,className:Q("item",s),$status:o,children:[i.jsx(Nr,{className:Q("icon",p==null?void 0:p.icon),$status:o,children:l||i.jsx(Wr,{})}),i.jsxs(Tr,{children:[i.jsxs(Ir,{children:[i.jsxs(Ar,{className:Q("info",p==null?void 0:p.info),children:[i.jsx(Pr,{className:Q("name",p==null?void 0:p.name),children:e}),i.jsx(Br,{className:Q("size",p==null?void 0:p.size),children:bt(t)})]}),a&&i.jsx(Gr,{className:Q("action",p==null?void 0:p.action),onClick:a,"aria-label":"Remove file",type:"button",children:i.jsx(qr,{})})]}),o==="uploading"&&i.jsxs(Mr,{className:Q("progress",p==null?void 0:p.progress),children:[i.jsx(Fr,{children:i.jsx(_r,{$value:r,$status:o})}),i.jsxs(Dr,{children:[r,"%"]})]}),o==="complete"&&i.jsxs(Ze,{children:[i.jsx(Hr,{children:i.jsx(Kr,{})}),"Complete"]}),o==="failed"&&i.jsxs(Ze,{children:["Upload failed."," ",c&&i.jsx(Yr,{onClick:c,type:"button",children:"Try again"})]})]})]}),$t=`
|
|
892
905
|
display: inline-flex;
|
|
893
906
|
font-size: 14px;
|
|
894
907
|
gap: 3px;
|
|
@@ -900,24 +913,24 @@
|
|
|
900
913
|
&:hover {
|
|
901
914
|
color: ${n.COLORS["steel-blue"]};
|
|
902
915
|
}
|
|
903
|
-
`,
|
|
916
|
+
`,Zr=d.styled.span`
|
|
904
917
|
${$t}
|
|
905
918
|
cursor: ${({$clickable:e})=>e?"pointer":"default"};
|
|
906
919
|
${({$clickable:e})=>e&&St}
|
|
907
|
-
`,
|
|
920
|
+
`,Qr=d.styled.a`
|
|
908
921
|
${$t}
|
|
909
922
|
${St}
|
|
910
|
-
`,
|
|
923
|
+
`,Jr=d.styled.span``,en=d.styled.span``,Se=C.newClassNameGetter("hashtag"),tn=({children:e,className:t,classnames:o,href:r,onClick:l,ref:a,...c})=>{const s=i.jsxs(i.Fragment,{children:[i.jsx(Jr,{className:Se("hash",o==null?void 0:o.hash),children:"#"}),i.jsx(en,{className:Se("label",o==null?void 0:o.label),children:e})]});if(r)return i.jsx(Qr,{ref:a,href:r,className:Se("container",t),onClick:l,children:s});const p=!!l;return i.jsx(Zr,{...c,ref:a,className:Se("container",t),$clickable:p,onClick:l,role:p?"button":void 0,tabIndex:p?0:void 0,children:s})},Qe={1:{fontSize:32,lineHeight:1.2},2:{fontSize:24,lineHeight:1.25},3:{fontSize:18,lineHeight:1.3},4:{fontSize:16,lineHeight:1.4},5:{fontSize:14,lineHeight:1.4},6:{fontSize:12,lineHeight:1.5}},on=d.styled.h1`
|
|
911
924
|
margin: 0;
|
|
912
925
|
font-weight: 700;
|
|
913
926
|
color: ${n.COLORS.black};
|
|
914
927
|
font-size: ${({$level:e})=>Qe[e].fontSize}px;
|
|
915
928
|
line-height: ${({$level:e})=>Qe[e].lineHeight};
|
|
916
|
-
`,
|
|
929
|
+
`,rn=C.newClassNameGetter("heading"),nn=({as:e,children:t,className:o,level:r=3,ref:l,...a})=>i.jsx(on,{...a,as:`h${e??r}`,ref:l,className:rn("container",o),$level:r,children:t}),ln=d.styled.div`
|
|
917
930
|
display: flex;
|
|
918
931
|
flex-direction: column;
|
|
919
932
|
gap: 12px;
|
|
920
|
-
`,
|
|
933
|
+
`,an=d.styled.div`
|
|
921
934
|
width: ${({$size:e})=>e}px;
|
|
922
935
|
height: ${({$size:e})=>e}px;
|
|
923
936
|
border-radius: 8px;
|
|
@@ -933,10 +946,10 @@
|
|
|
933
946
|
height: 100%;
|
|
934
947
|
object-fit: cover;
|
|
935
948
|
}
|
|
936
|
-
`,
|
|
949
|
+
`,dn=d.styled.span`
|
|
937
950
|
font-size: 12px;
|
|
938
951
|
color: ${n.COLORS["iron-grey"]};
|
|
939
|
-
`,
|
|
952
|
+
`,sn=e=>`
|
|
940
953
|
.${e} {
|
|
941
954
|
padding: 7px 16px;
|
|
942
955
|
font-size: 14px;
|
|
@@ -954,7 +967,7 @@
|
|
|
954
967
|
.${e}:active {
|
|
955
968
|
transform: translate(0, 1px);
|
|
956
969
|
}
|
|
957
|
-
`,
|
|
970
|
+
`,cn=e=>`
|
|
958
971
|
.${e} {
|
|
959
972
|
display: flex;
|
|
960
973
|
flex: 1 1 auto;
|
|
@@ -978,7 +991,7 @@
|
|
|
978
991
|
max-height: 70vh;
|
|
979
992
|
}
|
|
980
993
|
}
|
|
981
|
-
`,
|
|
994
|
+
`,pn=e=>`
|
|
982
995
|
.${e} {
|
|
983
996
|
padding: 7px 16px;
|
|
984
997
|
font-size: 14px;
|
|
@@ -996,7 +1009,7 @@
|
|
|
996
1009
|
.${e}:active {
|
|
997
1010
|
transform: translate(0, 1px);
|
|
998
1011
|
}
|
|
999
|
-
`,
|
|
1012
|
+
`,un=e=>`
|
|
1000
1013
|
.${e} {
|
|
1001
1014
|
display: flex;
|
|
1002
1015
|
flex-direction: column;
|
|
@@ -1014,7 +1027,7 @@
|
|
|
1014
1027
|
border-radius: 8px;
|
|
1015
1028
|
}
|
|
1016
1029
|
}
|
|
1017
|
-
`,
|
|
1030
|
+
`,gn=e=>`
|
|
1018
1031
|
.${e} {
|
|
1019
1032
|
display: flex;
|
|
1020
1033
|
justify-content: flex-end;
|
|
@@ -1033,7 +1046,7 @@
|
|
|
1033
1046
|
gap: 8px;
|
|
1034
1047
|
}
|
|
1035
1048
|
}
|
|
1036
|
-
`,
|
|
1049
|
+
`,xn=e=>`
|
|
1037
1050
|
.${e} {
|
|
1038
1051
|
display: flex;
|
|
1039
1052
|
justify-content: flex-start;
|
|
@@ -1055,7 +1068,7 @@
|
|
|
1055
1068
|
font-size: 14px;
|
|
1056
1069
|
}
|
|
1057
1070
|
}
|
|
1058
|
-
`,
|
|
1071
|
+
`,hn=e=>`
|
|
1059
1072
|
.${e} {
|
|
1060
1073
|
display: block;
|
|
1061
1074
|
z-index: 101;
|
|
@@ -1073,27 +1086,27 @@
|
|
|
1073
1086
|
position: absolute;
|
|
1074
1087
|
touch-action: none;
|
|
1075
1088
|
}
|
|
1076
|
-
`,
|
|
1089
|
+
`,fn=e=>`
|
|
1077
1090
|
.${e} {
|
|
1078
1091
|
position: absolute;
|
|
1079
1092
|
z-index: 2;
|
|
1080
1093
|
background-color: rgba(0, 0, 0, 0.6);
|
|
1081
1094
|
touch-action: none;
|
|
1082
1095
|
}
|
|
1083
|
-
`,
|
|
1096
|
+
`,yn=e=>`
|
|
1084
1097
|
.${e} {
|
|
1085
1098
|
position: absolute;
|
|
1086
1099
|
z-index: 3;
|
|
1087
1100
|
touch-action: none;
|
|
1088
1101
|
}
|
|
1089
|
-
`,
|
|
1102
|
+
`,bn=e=>`
|
|
1090
1103
|
.${e} {
|
|
1091
1104
|
backface-visibility: hidden;
|
|
1092
1105
|
perspective: 1000px;
|
|
1093
1106
|
max-inline-size: unset !important;
|
|
1094
1107
|
max-block-size: unset !important;
|
|
1095
1108
|
}
|
|
1096
|
-
|
|
1109
|
+
`,$n=e=>`
|
|
1097
1110
|
.${e} {
|
|
1098
1111
|
position: absolute;
|
|
1099
1112
|
z-index: 100;
|
|
@@ -1104,7 +1117,7 @@
|
|
|
1104
1117
|
overflow: hidden;
|
|
1105
1118
|
border-radius: 50%;
|
|
1106
1119
|
}
|
|
1107
|
-
`,
|
|
1120
|
+
`,Sn={tl:"nw-resize",tr:"ne-resize",bl:"sw-resize",br:"se-resize"},mn={tl:{h:"left",v:"top"},tr:{h:"right",v:"top"},bl:{h:"left",v:"bottom"},br:{h:"right",v:"bottom"}},me=(e,t)=>{const o=Sn[t],{h:r,v:l}=mn[t];return`
|
|
1108
1121
|
.${e} {
|
|
1109
1122
|
display: block;
|
|
1110
1123
|
z-index: 102;
|
|
@@ -1130,7 +1143,7 @@
|
|
|
1130
1143
|
${l}: -12px;
|
|
1131
1144
|
}
|
|
1132
1145
|
}
|
|
1133
|
-
`}
|
|
1146
|
+
`},On=e=>`
|
|
1134
1147
|
.${e} {
|
|
1135
1148
|
display: flex;
|
|
1136
1149
|
align-items: center;
|
|
@@ -1156,7 +1169,7 @@
|
|
|
1156
1169
|
padding-bottom: env(safe-area-inset-bottom, 8px);
|
|
1157
1170
|
}
|
|
1158
1171
|
}
|
|
1159
|
-
`,
|
|
1172
|
+
`,wn=e=>`
|
|
1160
1173
|
.${e} {
|
|
1161
1174
|
backface-visibility: hidden;
|
|
1162
1175
|
user-select: none;
|
|
@@ -1169,25 +1182,25 @@
|
|
|
1169
1182
|
position: absolute;
|
|
1170
1183
|
z-index: 1;
|
|
1171
1184
|
}
|
|
1172
|
-
`,
|
|
1173
|
-
${
|
|
1174
|
-
${
|
|
1175
|
-
${
|
|
1176
|
-
${
|
|
1177
|
-
${
|
|
1178
|
-
${
|
|
1179
|
-
${
|
|
1180
|
-
${
|
|
1181
|
-
${
|
|
1182
|
-
${
|
|
1183
|
-
${
|
|
1185
|
+
`,vn=e=>{let t=5381;for(let o=0;o<e.length;o++)t=(t<<5)+t^e.charCodeAt(o);return Math.abs(t).toString(36)},I=e=>`hq-cropper__${vn(e)}`,A=e=>e||[],B=(e,t)=>{if(t)for(const o of t)e.classList.add(o)},Cn=e=>{const t={applyButton:[I("applyButton"),...A(e.applyButton)],cancelButton:[I("cancelButton"),...A(e.cancelButton)],container:[I("container"),...A(e.container)],handlerMove:[I("handlerMove"),...A(e.handlerMove)],handlerResizeTopLeft:[I("handlerResizeTopLeft"),...A(e.handlerResizeTopLeft)],handlerResizeTopRight:[I("handlerResizeTopRight"),...A(e.handlerResizeTopRight)],handlerResizeBottomLeft:[I("handlerResizeBottomLeft"),...A(e.handlerResizeBottomLeft)],handlerResizeBottomRight:[I("handlerResizeBottomRight"),...A(e.handlerResizeBottomRight)],sourceImage:[I("sourceImage"),...A(e.sourceImage)],portalArea:[I("portalArea"),...A(e.portalArea)],previewImage:[I("previewImage"),...A(e.previewImage)],body:[I("body"),...A(e.body)],header:[I("header"),...A(e.header)],footer:[I("footer"),...A(e.footer)],portal:[I("portal"),...A(e.portal)],preview:[I("preview"),...A(e.preview)],root:[I("root"),...A(e.root)]},o=`
|
|
1186
|
+
${sn(t.applyButton[0])}
|
|
1187
|
+
${cn(t.body[0])}
|
|
1188
|
+
${pn(t.cancelButton[0])}
|
|
1189
|
+
${un(t.container[0])}
|
|
1190
|
+
${gn(t.footer[0])}
|
|
1191
|
+
${xn(t.header[0])}
|
|
1192
|
+
${hn(t.handlerMove[0])}
|
|
1193
|
+
${fn(t.portalArea[0])}
|
|
1194
|
+
${yn(t.portal[0])}
|
|
1195
|
+
${bn(t.previewImage[0])}
|
|
1196
|
+
${$n(t.preview[0])}
|
|
1184
1197
|
${me(t.handlerResizeBottomLeft[0],"bl")}
|
|
1185
1198
|
${me(t.handlerResizeBottomRight[0],"br")}
|
|
1186
1199
|
${me(t.handlerResizeTopLeft[0],"tl")}
|
|
1187
1200
|
${me(t.handlerResizeTopRight[0],"tr")}
|
|
1188
|
-
${
|
|
1189
|
-
${
|
|
1190
|
-
`,r=document.createElement("style");return r.innerHTML=o,document.getElementsByTagName("head")[0].prepend(r),t};let wn=0;const vn=e=>{const t=new Map,o=new Proxy({...e},{set(r,l,a){return Reflect.set(r,l,a),(t.get(l)||[]).forEach(c=>c.action(a,r,l)),!0}});return{getState:()=>({...o}),setState:r=>{for(const l of Object.keys(r)){const a=r[l];a!==void 0&&(o[l]=a)}},subscribe:(r,l)=>{const a=String(++wn),c=t.get(r)||[];return t.set(r,[...c,{action:l,id:a}]),a},unsubscribe:r=>{for(const[l,a]of t.entries()){const c=a.filter(s=>s.id!==r);if(c.length!==a.length){t.set(l,c);return}}},unsubscribeAll:()=>{t.clear()}}},Fe={action:null,sourceBase64:"",fileName:"",sourceHeight:0,sourceWidth:0,frame:{left:0,top:0,width:0,height:0},portal:{left:0,top:0,size:0},emitted:{X:0,Y:0,left:0,top:0,size:0},config:{applyButtonLabel:"Apply",cancelButtonLabel:"Cancel",compression:1,framePadding:3,minPortalSize:50,portalPosition:"center",portalSize:150,outputSize:0,type:"jpeg",maxFileSize:0,allowedTypes:["image/jpeg","image/png","image/gif","image/webp"]}},Cn=(e={},t={})=>vn({...Fe,config:{...Fe.config,...e},css:On(t)}),Rn=(e,t)=>{var y;const o=e(),r=document.querySelector(`.${(y=o.css)==null?void 0:y.body[0]}`);if(!r)return o.frame;const{width:l,height:a}=r.getBoundingClientRect(),c=l/a,s=t.width/t.height;let p,x,g=0,h=0;return c>s?(p=a*s,x=a,h=(l-p)/2):(p=l,x=l*(t.height/t.width),g=(a-x)/2),{width:p,height:x,left:h,top:g}},Ln=(e,t,o)=>{const[r,l]=t,a=r+e>o.width?(o.width-e)/2:r,c=l+e>o.height?(o.height-e)/2:l;return[a,c]},kn=(e,t)=>{const{config:o}=e(),r=Math.min(t.width,t.height)-o.framePadding*2,l=o.portalSize>r?r:o.portalSize;if(Array.isArray(o.portalPosition)&&o.portalPosition.length===2){const[a,c]=Ln(l,o.portalPosition,t);return{left:a,top:c,size:l}}return o.portalPosition==="center"?{size:l,left:(t.width-l)/2,top:(t.height-l)/2}:{left:0,top:0,size:l}};var G=(e=>(e.MOVE="MOVE",e.RESIZE_TL="RESIZE_TL",e.RESIZE_TR="RESIZE_TR",e.RESIZE_BR="RESIZE_BR",e.RESIZE_BL="RESIZE_BL",e))(G||{});const jn=e=>{var r;const t=e(),o=document.createElement("span");return P(o,(r=t.css)==null?void 0:r.handlerMove),o.setAttribute("data-action",G.MOVE),o},En=e=>{var r;const t=e(),o=document.createElement("span");return P(o,(r=t.css)==null?void 0:r.handlerResizeBottomLeft),o.setAttribute("data-action",G.RESIZE_BL),o},zn=e=>{var r;const t=e(),o=document.createElement("span");return P(o,(r=t.css)==null?void 0:r.handlerResizeBottomRight),o.setAttribute("data-action",G.RESIZE_BR),o},Nn=e=>{var r;const t=e(),o=document.createElement("span");return P(o,(r=t.css)==null?void 0:r.handlerResizeTopLeft),o.setAttribute("data-action",G.RESIZE_TL),o},Tn=e=>{var r;const t=e(),o=document.createElement("span");return P(o,(r=t.css)==null?void 0:r.handlerResizeTopRight),o.setAttribute("data-action",G.RESIZE_TR),o},In=e=>{var r;const t=e(),o=document.createElement("img");return P(o,(r=t.css)==null?void 0:r.previewImage),o},An=e=>{var r;const t=e(),o=document.createElement("div");return P(o,(r=t.css)==null?void 0:r.preview),o.appendChild(In(e)),o},Pn=e=>{var r;const t=e(),o=document.createElement("div");return P(o,(r=t.css)==null?void 0:r.portal),o.appendChild(An(e)),o.appendChild(jn(e)),o.appendChild(Nn(e)),o.appendChild(Tn(e)),o.appendChild(En(e)),o.appendChild(zn(e)),o},Bn=e=>{var r;const t=e(),o=document.createElement("div");return P(o,(r=t.css)==null?void 0:r.portalArea),o.appendChild(Pn(e)),o},Mn=e=>{var r;const t=e(),o=document.createElement("img");return P(o,(r=t.css)==null?void 0:r.sourceImage),o.setAttribute("alt","source"),o.setAttribute("crossOrigin","anonymous"),o.setAttribute("draggable","false"),o.setAttribute("src",t.sourceBase64),o},Fn=e=>{var r;const t=e(),o=document.createElement("div");return P(o,(r=t.css)==null?void 0:r.body),o.appendChild(Mn(e)),o.appendChild(Bn(e)),o},_n=(e,t)=>{var l;const o=e(),r=document.createElement("div");return P(r,(l=o.css)==null?void 0:l.applyButton),r.setAttribute("role","button"),r.innerText=o.config.applyButtonLabel,r.addEventListener("click",t),r},Dn=(e,t)=>{var l;const o=e(),r=document.createElement("div");return P(r,(l=o.css)==null?void 0:l.cancelButton),r.setAttribute("role","button"),r.innerText=o.config.cancelButtonLabel,r.addEventListener("click",t),r},Gn=(e,t,o)=>{var a;const r=e(),l=document.createElement("div");return P(l,(a=r.css)==null?void 0:a.footer),l.appendChild(Dn(e,o)),l.appendChild(_n(e,t)),l},Yn=e=>{var r;const t=e(),o=document.createElement("div");return P(o,(r=t.css)==null?void 0:r.header),o},Hn=(e,t,o)=>{var a;const r=e(),l=document.createElement("div");return P(l,(a=r.css)==null?void 0:a.container),l.appendChild(Yn(e)),l.appendChild(Fn(e)),l.appendChild(Gn(e,t,o)),l},Xn=(e,t,o)=>{var a;const r=e(),l=document.createElement("div");P(l,(a=r.css)==null?void 0:a.root),l.appendChild(Hn(e,t,o)),document.body.appendChild(l)},Un=e=>{const t=document.createElement("input");return t.style.display="none",t.setAttribute("type","file"),t.setAttribute("accept","image/x-png,image/jpeg"),t.addEventListener("change",e,!1),document.body.appendChild(t),t},pe=new Map,Wn={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},J=(e,t)=>{if(pe.has(e))return pe.get(e);if(!t)return null;const o=t[Wn[e]],r=document.querySelector(`.${o[0]}`);return pe.set(e,r),r},qn=()=>{pe.clear()},Kn=()=>{pe.clear()},Vn=(e,t)=>{const o=J("header",t.css);o&&(o.innerText=e)},Zn=(e,t)=>{const o=J("sourceImage",t.css);o&&(o.setAttribute("src",e),o.style.height=`${t.frame.height}px`,o.style.width=`${t.frame.width}px`,o.style.left=`${t.frame.left}px`,o.style.top=`${t.frame.top}px`);const r=J("portalArea",t.css);r&&(r.style.height=`${t.frame.height}px`,r.style.width=`${t.frame.width}px`,r.style.left=`${t.frame.left}px`,r.style.top=`${t.frame.top}px`);const l=J("portal",t.css);l&&(l.style.width=`${t.portal.size}px`,l.style.height=`${t.portal.size}px`,l.style.left=`${t.portal.left}px`,l.style.top=`${t.portal.top}px`);const a=J("previewImage",t.css);a&&(a.setAttribute("src",e),a.style.height=`${t.frame.height}px`,a.style.width=`${t.frame.width}px`,a.style.marginLeft=`-${t.portal.left}px`,a.style.marginTop=`-${t.portal.top}px`)},Qn=(e,t)=>{const o=J("portal",t.css);o&&(o.style.left=`${e.left}px`,o.style.top=`${e.top}px`,o.style.width=`${e.size}px`,o.style.height=`${e.size}px`);const r=J("previewImage",t.css);r&&(r.style.marginLeft=`-${e.left}px`,r.style.marginTop=`-${e.top}px`)},je=1,Jn=e=>{var f,S;const t=e(),o=document.createElement("canvas"),r=t.frame.width||je,l=t.frame.height||je,a=t.sourceWidth/r,c=t.sourceHeight/l,s=t.portal.left*a,p=t.portal.top*c,x=Math.max(t.portal.size*Math.min(a,c),je),g=t.config.outputSize>0?t.config.outputSize:x;o.width=g,o.height=g;const h=document.querySelector(`.${(f=t.css)==null?void 0:f.sourceImage[0]}`);h&&((S=o.getContext("2d"))==null||S.drawImage(h,s,p,x,x,0,0,g,g));const y=o.toDataURL(`image/${t.config.type}`,t.config.compression);return new Promise((b,$)=>{try{o.toBlob(m=>{if(o.remove(),!m){$(new Error(`Failed to create blob for type: image/${t.config.type}`));return}b([y,m])},`image/${t.config.type}`,t.config.compression)}catch(m){o.remove(),$(m)}})},ei=(e,t,o)=>{const{emitted:r,portal:l,frame:a,config:c}=t();let s=r.left-r.X+e.clientX,p=r.top-r.Y+e.clientY;const x=c.framePadding,g=a.width-c.framePadding-l.size,h=c.framePadding,y=a.height-c.framePadding-l.size;s<x&&(s=x),s>g&&(s=g),p<h&&(p=h),p>y&&(p=y),o({portal:{...l,left:s,top:p}})},ti=(e,t,o)=>{const{action:r,emitted:l,portal:a,frame:c,config:s}=t(),p=e.pageX-l.X,x=e.pageY-l.Y;switch(r){case G.RESIZE_BR:{let g=l.size+Math.max(p,x);return g<s.minPortalSize&&(g=s.minPortalSize),l.top+g>c.height-s.framePadding&&(g=c.height-l.top-s.framePadding),l.left+g>c.width-s.framePadding&&(g=c.width-l.left-s.framePadding),o({portal:{...a,size:g}})}case G.RESIZE_TR:{let g=p+x>0?l.size+p:l.size-x,h=p+x>0?l.top-p:l.top+x;return g<s.minPortalSize&&(h=l.top+l.size-s.minPortalSize,g=s.minPortalSize),l.left+g>c.width-s.framePadding&&(g=c.width-l.left-s.framePadding,h=l.top-c.width+l.left+l.size),h<s.framePadding&&(g=l.top+l.size,h=s.framePadding),o({portal:{...a,top:h,size:g}})}case G.RESIZE_TL:{const g=Math.min(p,x);let h=l.size-g,y=l.left+g,f=l.top+g;if(h<s.minPortalSize){const S=l.size-s.minPortalSize;h=s.minPortalSize,y=l.left+S,f=l.top+S}if(f<s.framePadding){const S=s.framePadding-f;f=s.framePadding,y=y+S,h=h-S}if(y<s.framePadding){const S=s.framePadding-y;y=s.framePadding,f=f+S,h=h-S}return o({portal:{...a,top:f,left:y,size:h}})}case G.RESIZE_BL:{let g=p+x>0?l.size+x:l.size-p,h=p+x>0?l.left-x:l.left+p;return g<s.minPortalSize&&(h=l.left+l.size-s.minPortalSize,g=s.minPortalSize),g+l.top>c.height-s.framePadding&&(h=l.left-c.height+l.top+l.size,g=c.height-l.top-s.framePadding),h<s.framePadding&&(h=s.framePadding,g=l.left+l.size-s.framePadding),o({portal:{...a,left:h,size:g}})}default:return}},Je=e=>{if("touches"in e&&e.touches.length>0){const o=e.touches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}if("changedTouches"in e&&e.changedTouches.length>0){const o=e.changedTouches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}const t=e;return{clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY}},oi=(e,t)=>{var y,f,S;const o=e(),r=document.querySelector(`.${(y=o.css)==null?void 0:y.portal[0]}`),l=document.querySelector(`.${(f=o.css)==null?void 0:f.portalArea[0]}`),a=document.querySelector(`.${(S=o.css)==null?void 0:S.root[0]}`);let c=null,s=null;const p=b=>{b.preventDefault();const{portal:$}=e(),m=Je(b);if(b.target){const O=b.target.getAttribute("data-action"),w={X:m.pageX,Y:m.pageY,left:$.left,top:$.top,size:$.size};t({action:O,emitted:w})}},x=()=>{const{action:b}=e();c!==null&&(cancelAnimationFrame(c),c=null),s=null,b&&t({action:null})},g=()=>{if(c=null,!s)return;const b=s;s=null;const{action:$}=e();if($)switch($){case G.MOVE:ei(b,e,t);break;default:ti(b,e,t)}},h=b=>{const{action:$}=e();$&&(b.preventDefault(),s=Je(b),c===null&&(c=requestAnimationFrame(g)))};return a&&(a.addEventListener("mouseup",x),a.addEventListener("touchend",x),a.addEventListener("touchcancel",x)),r&&(r.addEventListener("mousedown",p),r.addEventListener("touchstart",p,{passive:!1})),l&&(l.addEventListener("mousemove",h),l.addEventListener("touchmove",h,{passive:!1})),()=>{c!==null&&cancelAnimationFrame(c),a&&(a.removeEventListener("mouseup",x),a.removeEventListener("touchend",x),a.removeEventListener("touchcancel",x)),r&&(r.removeEventListener("mousedown",p),r.removeEventListener("touchstart",p)),l&&(l.removeEventListener("mousemove",h),l.removeEventListener("touchmove",h))}},et=1024*1024,ri=(e,t)=>{if(!t.allowedTypes.includes(e.type))return`Invalid file type "${e.type}". Allowed types: ${t.allowedTypes.join(", ")}`;if(t.maxFileSize>0&&e.size>t.maxFileSize){const o=(t.maxFileSize/et).toFixed(2);return`File size (${(e.size/et).toFixed(2)}MB) exceeds maximum allowed size (${o}MB)`}return null},ni=(e,t,o,r,l,a,c)=>{const s=m=>{c?c(m):console.error(`HqCropper: ${m}`)};if(!e.target.files||e.target.files.length===0){s("Can't read file input");return}const p=e.target.files[0],{config:x}=t(),g=ri(p,x);if(g){s(g),e.target.value="";return}const h=new FileReader;let y=null;const f=()=>{var w;const m=t(),O=document.querySelector(`.${(w=m.css)==null?void 0:w.root[0]}`);O&&(O.remove(),document.removeEventListener("keydown",S),y==null||y(),Kn(),a(),o(Fe))},S=m=>{m.key==="Escape"&&t().sourceBase64&&b(m)},b=m=>{m.preventDefault(),f()},$=m=>{m.preventDefault();const O=t();Jn(t).then(([w,k])=>{r(w,k,O),b(m)}).catch(w=>{s(w instanceof Error?w.message:"Failed to crop image")})};h.onload=m=>{const O=new Image;if(!m.target||typeof m.target.result!="string"){s("Can't load result image");return}O.src=m.target.result,O.onerror=()=>{s("Failed to load image")},O.onload=()=>{var z;Xn(t,$,b),qn(),l("fileName",Vn),l("sourceBase64",Zn),l("portal",Qn);const w=Rn(t,O),k=kn(t,w);o({frame:w,portal:k,fileName:p.name,sourceBase64:(z=m.target)==null?void 0:z.result,sourceHeight:O.height,sourceWidth:O.width}),y=oi(t,o),document.addEventListener("keydown",S)}},h.onerror=()=>{s("Failed to read file")},h.readAsDataURL(p),e.target.value=""},ii=(e,t,o,r)=>{const{getState:l,setState:a,subscribe:c,unsubscribeAll:s}=Cn(t,o),p=Un(x=>ni(x,l,a,e,c,s,r));return{open:()=>p.click()}},K={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},tt="vacano-image-cropper-styles",li=`
|
|
1201
|
+
${On(t.root[0])}
|
|
1202
|
+
${wn(t.sourceImage[0])}
|
|
1203
|
+
`,r=document.createElement("style");return r.innerHTML=o,document.getElementsByTagName("head")[0].prepend(r),t};let Rn=0;const Ln=e=>{const t=new Map,o=new Proxy({...e},{set(r,l,a){return Reflect.set(r,l,a),(t.get(l)||[]).forEach(c=>c.action(a,r,l)),!0}});return{getState:()=>({...o}),setState:r=>{for(const l of Object.keys(r)){const a=r[l];a!==void 0&&(o[l]=a)}},subscribe:(r,l)=>{const a=String(++Rn),c=t.get(r)||[];return t.set(r,[...c,{action:l,id:a}]),a},unsubscribe:r=>{for(const[l,a]of t.entries()){const c=a.filter(s=>s.id!==r);if(c.length!==a.length){t.set(l,c);return}}},unsubscribeAll:()=>{t.clear()}}},Fe={action:null,sourceBase64:"",fileName:"",sourceHeight:0,sourceWidth:0,frame:{left:0,top:0,width:0,height:0},portal:{left:0,top:0,size:0},emitted:{X:0,Y:0,left:0,top:0,size:0},config:{applyButtonLabel:"Apply",cancelButtonLabel:"Cancel",compression:1,framePadding:3,minPortalSize:50,portalPosition:"center",portalSize:150,outputSize:0,type:"jpeg",maxFileSize:0,allowedTypes:["image/jpeg","image/png","image/gif","image/webp"]}},kn=(e={},t={})=>Ln({...Fe,config:{...Fe.config,...e},css:Cn(t)}),jn=(e,t)=>{var y;const o=e(),r=document.querySelector(`.${(y=o.css)==null?void 0:y.body[0]}`);if(!r)return o.frame;const{width:l,height:a}=r.getBoundingClientRect(),c=l/a,s=t.width/t.height;let p,x,g=0,h=0;return c>s?(p=a*s,x=a,h=(l-p)/2):(p=l,x=l*(t.height/t.width),g=(a-x)/2),{width:p,height:x,left:h,top:g}},En=(e,t,o)=>{const[r,l]=t,a=r+e>o.width?(o.width-e)/2:r,c=l+e>o.height?(o.height-e)/2:l;return[a,c]},zn=(e,t)=>{const{config:o}=e(),r=Math.min(t.width,t.height)-o.framePadding*2,l=o.portalSize>r?r:o.portalSize;if(Array.isArray(o.portalPosition)&&o.portalPosition.length===2){const[a,c]=En(l,o.portalPosition,t);return{left:a,top:c,size:l}}return o.portalPosition==="center"?{size:l,left:(t.width-l)/2,top:(t.height-l)/2}:{left:0,top:0,size:l}};var G=(e=>(e.MOVE="MOVE",e.RESIZE_TL="RESIZE_TL",e.RESIZE_TR="RESIZE_TR",e.RESIZE_BR="RESIZE_BR",e.RESIZE_BL="RESIZE_BL",e))(G||{});const Nn=e=>{var r;const t=e(),o=document.createElement("span");return B(o,(r=t.css)==null?void 0:r.handlerMove),o.setAttribute("data-action",G.MOVE),o},Tn=e=>{var r;const t=e(),o=document.createElement("span");return B(o,(r=t.css)==null?void 0:r.handlerResizeBottomLeft),o.setAttribute("data-action",G.RESIZE_BL),o},In=e=>{var r;const t=e(),o=document.createElement("span");return B(o,(r=t.css)==null?void 0:r.handlerResizeBottomRight),o.setAttribute("data-action",G.RESIZE_BR),o},An=e=>{var r;const t=e(),o=document.createElement("span");return B(o,(r=t.css)==null?void 0:r.handlerResizeTopLeft),o.setAttribute("data-action",G.RESIZE_TL),o},Pn=e=>{var r;const t=e(),o=document.createElement("span");return B(o,(r=t.css)==null?void 0:r.handlerResizeTopRight),o.setAttribute("data-action",G.RESIZE_TR),o},Bn=e=>{var r;const t=e(),o=document.createElement("img");return B(o,(r=t.css)==null?void 0:r.previewImage),o},Mn=e=>{var r;const t=e(),o=document.createElement("div");return B(o,(r=t.css)==null?void 0:r.preview),o.appendChild(Bn(e)),o},Fn=e=>{var r;const t=e(),o=document.createElement("div");return B(o,(r=t.css)==null?void 0:r.portal),o.appendChild(Mn(e)),o.appendChild(Nn(e)),o.appendChild(An(e)),o.appendChild(Pn(e)),o.appendChild(Tn(e)),o.appendChild(In(e)),o},_n=e=>{var r;const t=e(),o=document.createElement("div");return B(o,(r=t.css)==null?void 0:r.portalArea),o.appendChild(Fn(e)),o},Dn=e=>{var r;const t=e(),o=document.createElement("img");return B(o,(r=t.css)==null?void 0:r.sourceImage),o.setAttribute("alt","source"),o.setAttribute("crossOrigin","anonymous"),o.setAttribute("draggable","false"),o.setAttribute("src",t.sourceBase64),o},Gn=e=>{var r;const t=e(),o=document.createElement("div");return B(o,(r=t.css)==null?void 0:r.body),o.appendChild(Dn(e)),o.appendChild(_n(e)),o},Yn=(e,t)=>{var l;const o=e(),r=document.createElement("div");return B(r,(l=o.css)==null?void 0:l.applyButton),r.setAttribute("role","button"),r.innerText=o.config.applyButtonLabel,r.addEventListener("click",t),r},Hn=(e,t)=>{var l;const o=e(),r=document.createElement("div");return B(r,(l=o.css)==null?void 0:l.cancelButton),r.setAttribute("role","button"),r.innerText=o.config.cancelButtonLabel,r.addEventListener("click",t),r},Xn=(e,t,o)=>{var a;const r=e(),l=document.createElement("div");return B(l,(a=r.css)==null?void 0:a.footer),l.appendChild(Hn(e,o)),l.appendChild(Yn(e,t)),l},Un=e=>{var r;const t=e(),o=document.createElement("div");return B(o,(r=t.css)==null?void 0:r.header),o},Wn=(e,t,o)=>{var a;const r=e(),l=document.createElement("div");return B(l,(a=r.css)==null?void 0:a.container),l.appendChild(Un(e)),l.appendChild(Gn(e)),l.appendChild(Xn(e,t,o)),l},qn=(e,t,o)=>{var a;const r=e(),l=document.createElement("div");B(l,(a=r.css)==null?void 0:a.root),l.appendChild(Wn(e,t,o)),document.body.appendChild(l)},Kn=e=>{const t=document.createElement("input");return t.style.display="none",t.setAttribute("type","file"),t.setAttribute("accept","image/x-png,image/jpeg"),t.addEventListener("change",e,!1),document.body.appendChild(t),t},pe=new Map,Vn={header:"header",sourceImage:"sourceImage",portalArea:"portalArea",portal:"portal",previewImage:"previewImage"},J=(e,t)=>{if(pe.has(e))return pe.get(e);if(!t)return null;const o=t[Vn[e]],r=document.querySelector(`.${o[0]}`);return pe.set(e,r),r},Zn=()=>{pe.clear()},Qn=()=>{pe.clear()},Jn=(e,t)=>{const o=J("header",t.css);o&&(o.innerText=e)},ei=(e,t)=>{const o=J("sourceImage",t.css);o&&(o.setAttribute("src",e),o.style.height=`${t.frame.height}px`,o.style.width=`${t.frame.width}px`,o.style.left=`${t.frame.left}px`,o.style.top=`${t.frame.top}px`);const r=J("portalArea",t.css);r&&(r.style.height=`${t.frame.height}px`,r.style.width=`${t.frame.width}px`,r.style.left=`${t.frame.left}px`,r.style.top=`${t.frame.top}px`);const l=J("portal",t.css);l&&(l.style.width=`${t.portal.size}px`,l.style.height=`${t.portal.size}px`,l.style.left=`${t.portal.left}px`,l.style.top=`${t.portal.top}px`);const a=J("previewImage",t.css);a&&(a.setAttribute("src",e),a.style.height=`${t.frame.height}px`,a.style.width=`${t.frame.width}px`,a.style.marginLeft=`-${t.portal.left}px`,a.style.marginTop=`-${t.portal.top}px`)},ti=(e,t)=>{const o=J("portal",t.css);o&&(o.style.left=`${e.left}px`,o.style.top=`${e.top}px`,o.style.width=`${e.size}px`,o.style.height=`${e.size}px`);const r=J("previewImage",t.css);r&&(r.style.marginLeft=`-${e.left}px`,r.style.marginTop=`-${e.top}px`)},je=1,oi=e=>{var f,S;const t=e(),o=document.createElement("canvas"),r=t.frame.width||je,l=t.frame.height||je,a=t.sourceWidth/r,c=t.sourceHeight/l,s=t.portal.left*a,p=t.portal.top*c,x=Math.max(t.portal.size*Math.min(a,c),je),g=t.config.outputSize>0?t.config.outputSize:x;o.width=g,o.height=g;const h=document.querySelector(`.${(f=t.css)==null?void 0:f.sourceImage[0]}`);h&&((S=o.getContext("2d"))==null||S.drawImage(h,s,p,x,x,0,0,g,g));const y=o.toDataURL(`image/${t.config.type}`,t.config.compression);return new Promise((b,$)=>{try{o.toBlob(m=>{if(o.remove(),!m){$(new Error(`Failed to create blob for type: image/${t.config.type}`));return}b([y,m])},`image/${t.config.type}`,t.config.compression)}catch(m){o.remove(),$(m)}})},ri=(e,t,o)=>{const{emitted:r,portal:l,frame:a,config:c}=t();let s=r.left-r.X+e.clientX,p=r.top-r.Y+e.clientY;const x=c.framePadding,g=a.width-c.framePadding-l.size,h=c.framePadding,y=a.height-c.framePadding-l.size;s<x&&(s=x),s>g&&(s=g),p<h&&(p=h),p>y&&(p=y),o({portal:{...l,left:s,top:p}})},ni=(e,t,o)=>{const{action:r,emitted:l,portal:a,frame:c,config:s}=t(),p=e.pageX-l.X,x=e.pageY-l.Y;switch(r){case G.RESIZE_BR:{let g=l.size+Math.max(p,x);return g<s.minPortalSize&&(g=s.minPortalSize),l.top+g>c.height-s.framePadding&&(g=c.height-l.top-s.framePadding),l.left+g>c.width-s.framePadding&&(g=c.width-l.left-s.framePadding),o({portal:{...a,size:g}})}case G.RESIZE_TR:{let g=p+x>0?l.size+p:l.size-x,h=p+x>0?l.top-p:l.top+x;return g<s.minPortalSize&&(h=l.top+l.size-s.minPortalSize,g=s.minPortalSize),l.left+g>c.width-s.framePadding&&(g=c.width-l.left-s.framePadding,h=l.top-c.width+l.left+l.size),h<s.framePadding&&(g=l.top+l.size,h=s.framePadding),o({portal:{...a,top:h,size:g}})}case G.RESIZE_TL:{const g=Math.min(p,x);let h=l.size-g,y=l.left+g,f=l.top+g;if(h<s.minPortalSize){const S=l.size-s.minPortalSize;h=s.minPortalSize,y=l.left+S,f=l.top+S}if(f<s.framePadding){const S=s.framePadding-f;f=s.framePadding,y=y+S,h=h-S}if(y<s.framePadding){const S=s.framePadding-y;y=s.framePadding,f=f+S,h=h-S}return o({portal:{...a,top:f,left:y,size:h}})}case G.RESIZE_BL:{let g=p+x>0?l.size+x:l.size-p,h=p+x>0?l.left-x:l.left+p;return g<s.minPortalSize&&(h=l.left+l.size-s.minPortalSize,g=s.minPortalSize),g+l.top>c.height-s.framePadding&&(h=l.left-c.height+l.top+l.size,g=c.height-l.top-s.framePadding),h<s.framePadding&&(h=s.framePadding,g=l.left+l.size-s.framePadding),o({portal:{...a,left:h,size:g}})}default:return}},Je=e=>{if("touches"in e&&e.touches.length>0){const o=e.touches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}if("changedTouches"in e&&e.changedTouches.length>0){const o=e.changedTouches[0];return{clientX:o.clientX,clientY:o.clientY,pageX:o.pageX,pageY:o.pageY}}const t=e;return{clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY}},ii=(e,t)=>{var y,f,S;const o=e(),r=document.querySelector(`.${(y=o.css)==null?void 0:y.portal[0]}`),l=document.querySelector(`.${(f=o.css)==null?void 0:f.portalArea[0]}`),a=document.querySelector(`.${(S=o.css)==null?void 0:S.root[0]}`);let c=null,s=null;const p=b=>{b.preventDefault();const{portal:$}=e(),m=Je(b);if(b.target){const O=b.target.getAttribute("data-action"),w={X:m.pageX,Y:m.pageY,left:$.left,top:$.top,size:$.size};t({action:O,emitted:w})}},x=()=>{const{action:b}=e();c!==null&&(cancelAnimationFrame(c),c=null),s=null,b&&t({action:null})},g=()=>{if(c=null,!s)return;const b=s;s=null;const{action:$}=e();if($)switch($){case G.MOVE:ri(b,e,t);break;default:ni(b,e,t)}},h=b=>{const{action:$}=e();$&&(b.preventDefault(),s=Je(b),c===null&&(c=requestAnimationFrame(g)))};return a&&(a.addEventListener("mouseup",x),a.addEventListener("touchend",x),a.addEventListener("touchcancel",x)),r&&(r.addEventListener("mousedown",p),r.addEventListener("touchstart",p,{passive:!1})),l&&(l.addEventListener("mousemove",h),l.addEventListener("touchmove",h,{passive:!1})),()=>{c!==null&&cancelAnimationFrame(c),a&&(a.removeEventListener("mouseup",x),a.removeEventListener("touchend",x),a.removeEventListener("touchcancel",x)),r&&(r.removeEventListener("mousedown",p),r.removeEventListener("touchstart",p)),l&&(l.removeEventListener("mousemove",h),l.removeEventListener("touchmove",h))}},et=1024*1024,li=(e,t)=>{if(!t.allowedTypes.includes(e.type))return`Invalid file type "${e.type}". Allowed types: ${t.allowedTypes.join(", ")}`;if(t.maxFileSize>0&&e.size>t.maxFileSize){const o=(t.maxFileSize/et).toFixed(2);return`File size (${(e.size/et).toFixed(2)}MB) exceeds maximum allowed size (${o}MB)`}return null},ai=(e,t,o,r,l,a,c)=>{const s=m=>{c?c(m):console.error(`HqCropper: ${m}`)};if(!e.target.files||e.target.files.length===0){s("Can't read file input");return}const p=e.target.files[0],{config:x}=t(),g=li(p,x);if(g){s(g),e.target.value="";return}const h=new FileReader;let y=null;const f=()=>{var w;const m=t(),O=document.querySelector(`.${(w=m.css)==null?void 0:w.root[0]}`);O&&(O.remove(),document.removeEventListener("keydown",S),y==null||y(),Qn(),a(),o(Fe))},S=m=>{m.key==="Escape"&&t().sourceBase64&&b(m)},b=m=>{m.preventDefault(),f()},$=m=>{m.preventDefault();const O=t();oi(t).then(([w,k])=>{r(w,k,O),b(m)}).catch(w=>{s(w instanceof Error?w.message:"Failed to crop image")})};h.onload=m=>{const O=new Image;if(!m.target||typeof m.target.result!="string"){s("Can't load result image");return}O.src=m.target.result,O.onerror=()=>{s("Failed to load image")},O.onload=()=>{var z;qn(t,$,b),Zn(),l("fileName",Jn),l("sourceBase64",ei),l("portal",ti);const w=jn(t,O),k=zn(t,w);o({frame:w,portal:k,fileName:p.name,sourceBase64:(z=m.target)==null?void 0:z.result,sourceHeight:O.height,sourceWidth:O.width}),y=ii(t,o),document.addEventListener("keydown",S)}},h.onerror=()=>{s("Failed to read file")},h.readAsDataURL(p),e.target.value=""},di=(e,t,o,r)=>{const{getState:l,setState:a,subscribe:c,unsubscribeAll:s}=kn(t,o),p=Kn(x=>ai(x,l,a,e,c,s,r));return{open:()=>p.click()}},K={portalSize:200,outputSize:400,compression:.9,type:"jpeg",maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/webp"],applyLabel:"Apply",cancelLabel:"Cancel"},tt="vacano-image-cropper-styles",si=`
|
|
1191
1204
|
.vacano-cropper-root {
|
|
1192
1205
|
background-color: rgba(0, 0, 0, 0.5);
|
|
1193
1206
|
backdrop-filter: blur(4px);
|
|
@@ -1235,7 +1248,7 @@
|
|
|
1235
1248
|
.vacano-cropper-apply-button:hover {
|
|
1236
1249
|
background-color: ${n.COLORS["iron-grey"]};
|
|
1237
1250
|
}
|
|
1238
|
-
`,
|
|
1251
|
+
`,ci=()=>{if(typeof document>"u"||document.getElementById(tt))return;const e=document.createElement("style");e.id=tt,e.textContent=si,document.head.appendChild(e)},pi={root:["vacano-cropper-root"],container:["vacano-cropper-container"],header:["vacano-cropper-header"],body:["vacano-cropper-body"],footer:["vacano-cropper-footer"],cancelButton:["vacano-cropper-cancel-button"],applyButton:["vacano-cropper-apply-button"],portal:["vacano-cropper-portal"]},mt=(e={})=>{const{allowedTypes:t=K.allowedTypes,applyLabel:o=K.applyLabel,cancelLabel:r=K.cancelLabel,compression:l=K.compression,maxFileSize:a=K.maxFileSize,onCrop:c,onError:s,outputSize:p=K.outputSize,portalSize:x=K.portalSize,type:g=K.type}=e,h=u.useRef(null);return{open:u.useCallback(()=>{h.current||(ci(),h.current=di((f,S,b)=>{S&&(c==null||c({base64:f,blob:S,state:b}))},{portalSize:x,outputSize:p,compression:l,type:g,maxFileSize:a,allowedTypes:t,applyButtonLabel:o,cancelButtonLabel:r},pi,f=>{s==null||s({code:"CROPPER_ERROR",message:f})})),h.current.open()},[t,o,r,l,a,c,s,p,x,g])}},Ee=C.newClassNameGetter("image-cropper"),ui=({allowedTypes:e,applyLabel:t,buttonLabel:o="Select Image",cancelLabel:r,className:l,classnames:a,compression:c,maxFileSize:s,onCrop:p,onError:x,outputSize:g,portalSize:h,previewSize:y=120,ref:f,type:S,value:b,...$})=>{const[m,O]=u.useState(b??null),{open:w}=mt({allowedTypes:e,applyLabel:t,cancelLabel:r,compression:c,maxFileSize:s,onCrop:k=>{O(k.base64),p==null||p(k)},onError:x,outputSize:g,portalSize:h,type:S});return i.jsxs(ln,{...$,ref:f,className:Ee("container",l),children:[i.jsx(an,{$size:y,className:Ee("preview",a==null?void 0:a.preview),children:m?i.jsx("img",{src:m,alt:"Preview"}):i.jsx(dn,{children:"No image"})}),i.jsx(d.Button,{variant:"system",onClick:w,className:Ee("button",a==null?void 0:a.button),style:{width:y},children:o})]})},re={default:{box:40,line:22,weight:2.5,gap:6},compact:{box:32,line:18,weight:2,gap:5}},gi=d.styled.button`
|
|
1239
1252
|
position: relative;
|
|
1240
1253
|
display: flex;
|
|
1241
1254
|
align-items: center;
|
|
@@ -1258,7 +1271,7 @@
|
|
|
1258
1271
|
&:focus-visible {
|
|
1259
1272
|
box-shadow: 0 0 0 2px ${n.COLORS["steel-blue"]};
|
|
1260
1273
|
}
|
|
1261
|
-
`,
|
|
1274
|
+
`,xi=d.styled.div`
|
|
1262
1275
|
display: flex;
|
|
1263
1276
|
flex-direction: column;
|
|
1264
1277
|
align-items: center;
|
|
@@ -1275,14 +1288,14 @@
|
|
|
1275
1288
|
transform-origin: center;
|
|
1276
1289
|
|
|
1277
1290
|
${({$position:e,$size:t,$open:o})=>{const{gap:r,weight:l}=re[t],a=r+l;if(e==="top")return o?`transform: translateY(${a}px) rotate(45deg);`:"";if(e==="middle")return o?"opacity: 0;":"";if(e==="bottom")return o?`transform: translateY(-${a}px) rotate(-45deg);`:""}}
|
|
1278
|
-
`,Oe=C.newClassNameGetter("menu-button"),
|
|
1291
|
+
`,Oe=C.newClassNameGetter("menu-button"),hi=({className:e,classnames:t,defaultOpen:o=!1,disabled:r=!1,onOpenChange:l,open:a,ref:c,size:s="default",...p})=>{const[x,g]=u.useState(o),h=a!==void 0,y=h?a:x,f=u.useCallback(()=>{if(r)return;const S=!y;h||g(S),l==null||l(S)},[r,y,h,l]);return i.jsx(gi,{...p,ref:c,type:"button",disabled:r,"aria-label":y?"Close menu":"Open menu","aria-expanded":y,className:Oe("container",e),$size:s,$disabled:r,onClick:f,children:i.jsxs(xi,{$size:s,$open:y,children:[i.jsx(ze,{$size:s,$position:"top",$open:y,className:Oe("line",t==null?void 0:t.line)}),i.jsx(ze,{$size:s,$position:"middle",$open:y,className:Oe("line",t==null?void 0:t.line)}),i.jsx(ze,{$size:s,$position:"bottom",$open:y,className:Oe("line",t==null?void 0:t.line)})]})})},fi=5e3,ot={default:{background:"#374151",text:n.COLORS.white},success:{background:n.COLORS.green,text:n.COLORS.white},warning:{background:n.COLORS.yellow,text:n.COLORS.white},danger:{background:n.COLORS.red,text:n.COLORS.white},info:{background:n.COLORS["steel-blue"],text:n.COLORS.white}},Ot=u.createContext(null),rt=e=>ot[e]??ot.default,yi=d.styled.div`
|
|
1279
1292
|
position: fixed;
|
|
1280
1293
|
top: 0;
|
|
1281
1294
|
left: 0;
|
|
1282
1295
|
right: 0;
|
|
1283
1296
|
z-index: 9999;
|
|
1284
1297
|
pointer-events: none;
|
|
1285
|
-
`,
|
|
1298
|
+
`,bi=d.styled.div`
|
|
1286
1299
|
display: flex;
|
|
1287
1300
|
align-items: center;
|
|
1288
1301
|
justify-content: center;
|
|
@@ -1294,12 +1307,12 @@
|
|
|
1294
1307
|
animation: ${({$isExiting:e})=>e?n.KEYFRAMES.slideOutTopFade:n.KEYFRAMES.slideInTopFade}
|
|
1295
1308
|
0.3s ease-out forwards;
|
|
1296
1309
|
pointer-events: auto;
|
|
1297
|
-
|
|
1310
|
+
`,$i=d.styled.span`
|
|
1298
1311
|
font-size: 14px;
|
|
1299
1312
|
font-weight: 500;
|
|
1300
1313
|
line-height: 1.4;
|
|
1301
1314
|
text-align: center;
|
|
1302
|
-
`,
|
|
1315
|
+
`,Si=d.styled.button`
|
|
1303
1316
|
position: absolute;
|
|
1304
1317
|
right: 16px;
|
|
1305
1318
|
top: 50%;
|
|
@@ -1320,9 +1333,9 @@
|
|
|
1320
1333
|
&:hover {
|
|
1321
1334
|
opacity: 1;
|
|
1322
1335
|
}
|
|
1323
|
-
`,
|
|
1336
|
+
`,mi=d.styled.div`
|
|
1324
1337
|
position: relative;
|
|
1325
|
-
|
|
1338
|
+
`,Oi=({notification:e,onRemove:t,onAnimationEnd:o})=>{const[r,l]=u.useState(!1),a=()=>{l(!0)},c=()=>{r&&(t(),o())};return u.useEffect(()=>{const s=setTimeout(()=>{a()},e.duration);return()=>clearTimeout(s)},[e.duration,e.id]),i.jsx(mi,{children:i.jsxs(bi,{$variant:e.variant,$isExiting:r,onAnimationEnd:c,children:[i.jsx($i,{children:e.message}),i.jsx(Si,{onClick:a,children:i.jsx(i.X,{style:{width:18,height:18}})})]})})},wi=(e,t)=>{switch(t.type){case"ADD_NOTIFICATION":{const o=t.payload;return e.current?{...e,queue:[...e.queue,o]}:{...e,current:o}}case"REMOVE_CURRENT":return{...e,current:null};case"SHOW_NEXT":{const o=e.queue[0];return o?{current:o,queue:e.queue.slice(1)}:e}default:return e}},vi={current:null,queue:[]},Ci=({children:e})=>{const[t,o]=u.useReducer(wi,vi),r=u.useCallback((s,p="default",x=fi)=>{const g=`notification-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;o({type:"ADD_NOTIFICATION",payload:{id:g,message:s,variant:p,duration:x}})},[]),l=u.useCallback(()=>{o({type:"REMOVE_CURRENT"})},[]),a=u.useCallback(()=>{o({type:"REMOVE_CURRENT"})},[]),c=u.useCallback(()=>{setTimeout(()=>{o({type:"SHOW_NEXT"})},100)},[]);return i.jsxs(Ot.Provider,{value:{show:r,hide:l},children:[e,i.jsx(yi,{children:t.current&&i.jsx(Oi,{notification:t.current,onRemove:a,onAnimationEnd:c},t.current.id)})]})},Ri=()=>{const e=u.useContext(Ot);if(!e)throw new Error("useNotification must be used within NotificationProvider");return e},wt=u.createContext(null),Li="Agree",ki="Discard",ji=P.keyframes`
|
|
1326
1339
|
from {
|
|
1327
1340
|
opacity: 0;
|
|
1328
1341
|
transform: translateY(100%);
|
|
@@ -1331,7 +1344,7 @@
|
|
|
1331
1344
|
opacity: 1;
|
|
1332
1345
|
transform: translateY(0);
|
|
1333
1346
|
}
|
|
1334
|
-
`,
|
|
1347
|
+
`,Ei=P.keyframes`
|
|
1335
1348
|
from {
|
|
1336
1349
|
opacity: 1;
|
|
1337
1350
|
transform: translateY(0);
|
|
@@ -1340,7 +1353,7 @@
|
|
|
1340
1353
|
opacity: 0;
|
|
1341
1354
|
transform: translateY(100%);
|
|
1342
1355
|
}
|
|
1343
|
-
`,
|
|
1356
|
+
`,zi=d.styled.div`
|
|
1344
1357
|
position: fixed;
|
|
1345
1358
|
bottom: 24px;
|
|
1346
1359
|
right: 24px;
|
|
@@ -1355,20 +1368,20 @@
|
|
|
1355
1368
|
box-shadow:
|
|
1356
1369
|
0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
1357
1370
|
0 2px 4px -2px rgba(0, 0, 0, 0.1);
|
|
1358
|
-
animation: ${({$isExiting:e})=>e?
|
|
1371
|
+
animation: ${({$isExiting:e})=>e?Ei:ji} 0.2s ease-out forwards;
|
|
1359
1372
|
z-index: 1000;
|
|
1360
|
-
`,
|
|
1373
|
+
`,Ni=d.styled.p`
|
|
1361
1374
|
margin: 0;
|
|
1362
1375
|
font-weight: 600;
|
|
1363
1376
|
font-size: 14px;
|
|
1364
1377
|
color: ${n.COLORS.black};
|
|
1365
1378
|
text-align: left;
|
|
1366
|
-
`,
|
|
1379
|
+
`,Ti=d.styled.p`
|
|
1367
1380
|
margin: 4px 0 0;
|
|
1368
1381
|
font-size: 13px;
|
|
1369
1382
|
color: ${n.COLORS["iron-grey"]};
|
|
1370
1383
|
text-align: left;
|
|
1371
|
-
`,
|
|
1384
|
+
`,Ii=d.styled.div`
|
|
1372
1385
|
display: flex;
|
|
1373
1386
|
align-items: center;
|
|
1374
1387
|
justify-content: flex-start;
|
|
@@ -1377,20 +1390,20 @@
|
|
|
1377
1390
|
padding: 12px 16px;
|
|
1378
1391
|
border-top: 1px solid ${n.COLORS.gray};
|
|
1379
1392
|
background-color: rgba(0, 0, 0, 0.01);
|
|
1380
|
-
`,
|
|
1393
|
+
`,Ai=({confirmation:e,onDone:t})=>{const[o,r]=u.useState(!1),[l,a]=u.useState(!1),{label:c,description:s,onConfirm:p,onDiscard:x,options:g}=e,h=g.confirmLabel||Li,y=g.discardLabel||ki,f=u.useCallback($=>{r(!0),setTimeout(()=>{$==null||$(),t()},200)},[t]),S=u.useCallback(async()=>{const $=p();if($ instanceof Promise){a(!0);try{await $}finally{a(!1)}}f()},[f,p]),b=u.useCallback(()=>{l||f(x)},[f,l,x]);return u.useEffect(()=>{const $=m=>{m.key==="Escape"&&!l&&b()};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[b,l]),i.jsxs(zi,{$isExiting:o,children:[i.jsx(Ni,{children:c}),i.jsx(Ti,{children:s}),i.jsxs(Ii,{children:[i.jsx(d.Button,{variant:"transparent",size:"compact",onClick:b,disabled:l,children:y}),i.jsx(d.Button,{variant:"system",size:"compact",onClick:S,loading:l,children:h})]})]})},Pi=()=>{},Bi=({children:e})=>{const[t,o]=u.useState(null),r=u.useCallback((a,c,s,p,x)=>{o({open:!0,label:a,description:c,onConfirm:s,onDiscard:p||Pi,options:x||{}})},[]),l=u.useCallback(()=>{o(null)},[]);return i.jsxs(wt.Provider,{value:{show:r,hide:l},children:[e,t&&i.jsx(Ai,{confirmation:t,onDone:l})]})},Mi=()=>{const e=u.useContext(wt);if(!e)throw new Error("useNotifyConfirmation must be used within NotifyConfirmationProvider");return e},Fi=d.styled.div`
|
|
1381
1394
|
display: flex;
|
|
1382
1395
|
flex-direction: column;
|
|
1383
1396
|
gap: 2px;
|
|
1384
|
-
`,
|
|
1397
|
+
`,_i=d.styled.span`
|
|
1385
1398
|
font-size: 12px;
|
|
1386
1399
|
font-weight: 700;
|
|
1387
1400
|
text-transform: uppercase;
|
|
1388
1401
|
letter-spacing: 0.5px;
|
|
1389
1402
|
color: ${n.COLORS["iron-grey"]};
|
|
1390
|
-
`,
|
|
1403
|
+
`,Di=d.styled.span`
|
|
1391
1404
|
font-size: 14px;
|
|
1392
1405
|
color: ${n.COLORS["iron-grey"]};
|
|
1393
|
-
`,Ne=C.newClassNameGetter("overline"),
|
|
1406
|
+
`,Ne=C.newClassNameGetter("overline"),Gi=({children:e,className:t,classnames:o,description:r,ref:l,...a})=>i.jsxs(Fi,{...a,ref:l,className:Ne("container",t),children:[i.jsx(_i,{className:Ne("label",o==null?void 0:o.label),children:e}),r&&i.jsx(Di,{className:Ne("description",o==null?void 0:o.description),children:r})]}),Yi=d.styled.div`
|
|
1394
1407
|
position: relative;
|
|
1395
1408
|
display: flex;
|
|
1396
1409
|
flex-direction: column;
|
|
@@ -1400,7 +1413,7 @@
|
|
|
1400
1413
|
min-height: 100dvh;
|
|
1401
1414
|
padding: 40px 24px;
|
|
1402
1415
|
overflow: hidden;
|
|
1403
|
-
`,
|
|
1416
|
+
`,Hi=d.styled.div`
|
|
1404
1417
|
position: absolute;
|
|
1405
1418
|
inset: 0;
|
|
1406
1419
|
background-image:
|
|
@@ -1410,7 +1423,7 @@
|
|
|
1410
1423
|
mask-image: radial-gradient(ellipse 60% 50% at 50% 40%, black 20%, transparent 100%);
|
|
1411
1424
|
-webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 40%, black 20%, transparent 100%);
|
|
1412
1425
|
pointer-events: none;
|
|
1413
|
-
`,
|
|
1426
|
+
`,Xi=d.styled.div`
|
|
1414
1427
|
position: relative;
|
|
1415
1428
|
z-index: 1;
|
|
1416
1429
|
display: flex;
|
|
@@ -1418,9 +1431,9 @@
|
|
|
1418
1431
|
align-items: center;
|
|
1419
1432
|
width: 100%;
|
|
1420
1433
|
max-width: 400px;
|
|
1421
|
-
`,
|
|
1434
|
+
`,Ui=d.styled.div`
|
|
1422
1435
|
margin-bottom: 32px;
|
|
1423
|
-
`,
|
|
1436
|
+
`,Wi=d.styled.div`
|
|
1424
1437
|
display: flex;
|
|
1425
1438
|
align-items: center;
|
|
1426
1439
|
justify-content: center;
|
|
@@ -1434,38 +1447,38 @@
|
|
|
1434
1447
|
0 1px 2px rgba(0, 0, 0, 0.05),
|
|
1435
1448
|
0 1px 3px rgba(0, 0, 0, 0.1);
|
|
1436
1449
|
margin-bottom: 24px;
|
|
1437
|
-
`,
|
|
1450
|
+
`,qi=d.styled.div`
|
|
1438
1451
|
display: flex;
|
|
1439
1452
|
flex-direction: column;
|
|
1440
1453
|
align-items: center;
|
|
1441
1454
|
text-align: center;
|
|
1442
1455
|
gap: 8px;
|
|
1443
1456
|
margin-bottom: 32px;
|
|
1444
|
-
`,
|
|
1457
|
+
`,Ki=d.styled.h1`
|
|
1445
1458
|
margin: 0;
|
|
1446
1459
|
font-size: 24px;
|
|
1447
1460
|
font-weight: 600;
|
|
1448
1461
|
color: ${n.COLORS.black};
|
|
1449
1462
|
line-height: 1.3;
|
|
1450
|
-
`,
|
|
1463
|
+
`,Vi=d.styled.p`
|
|
1451
1464
|
margin: 0;
|
|
1452
1465
|
font-size: 14px;
|
|
1453
1466
|
color: ${n.COLORS["iron-grey"]};
|
|
1454
1467
|
line-height: 1.5;
|
|
1455
1468
|
max-width: 360px;
|
|
1456
|
-
`,
|
|
1469
|
+
`,Zi=d.styled.div`
|
|
1457
1470
|
width: 100%;
|
|
1458
|
-
`,
|
|
1471
|
+
`,Qi=d.styled.div`
|
|
1459
1472
|
margin-top: 32px;
|
|
1460
1473
|
text-align: center;
|
|
1461
1474
|
font-size: 14px;
|
|
1462
1475
|
color: ${n.COLORS["iron-grey"]};
|
|
1463
|
-
`,V=C.newClassNameGetter("shell-screen"),
|
|
1476
|
+
`,V=C.newClassNameGetter("shell-screen"),Ji=({children:e,className:t,classnames:o,description:r,footer:l,gridSize:a=64,icon:c,logo:s,ref:p,title:x,...g})=>i.jsxs(Yi,{...g,ref:p,className:V("container",t),children:[i.jsx(Hi,{$size:a,className:V("grid",o==null?void 0:o.grid)}),i.jsxs(Xi,{children:[s&&i.jsx(Ui,{children:s}),c&&i.jsx(Wi,{className:V("icon"),children:c}),(x||r)&&i.jsxs(qi,{className:V("header",o==null?void 0:o.header),children:[x&&i.jsx(Ki,{className:V("title",o==null?void 0:o.title),children:x}),r&&i.jsx(Vi,{className:V("description",o==null?void 0:o.description),children:r})]}),e&&i.jsx(Zi,{className:V("content",o==null?void 0:o.content),children:e}),l&&i.jsx(Qi,{className:V("footer",o==null?void 0:o.footer),children:l})]})]}),el=(e,t,o,r)=>{if(o*2+3+r*2>=e)return Array.from({length:e},(y,f)=>f+1);const a=Math.max(t-o,r+1),c=Math.min(t+o,e-r),s=a>r+2,p=c<e-r-1;if(!s&&p){const y=o*2+r+2,f=Array.from({length:y},(b,$)=>$+1),S=Array.from({length:r},(b,$)=>e-r+$+1);return[...f,"dots",...S]}if(s&&!p){const y=o*2+r+2,f=Array.from({length:r},(b,$)=>$+1),S=Array.from({length:y},(b,$)=>e-y+$+1);return[...f,"dots",...S]}const x=Array.from({length:r},(y,f)=>f+1),g=Array.from({length:c-a+1},(y,f)=>a+f),h=Array.from({length:r},(y,f)=>e-r+f+1);return[...x,"dots",...g,"dots",...h]},tl=d.styled.nav`
|
|
1464
1477
|
display: inline-flex;
|
|
1465
1478
|
align-items: center;
|
|
1466
1479
|
gap: 2px;
|
|
1467
1480
|
position: relative;
|
|
1468
|
-
`,
|
|
1481
|
+
`,ol=(e,t)=>{if(!t)switch(e){case"bordered":return`
|
|
1469
1482
|
background-color: transparent;
|
|
1470
1483
|
border: 1px solid ${n.COLORS.gray};
|
|
1471
1484
|
color: ${n.COLORS["iron-grey"]};
|
|
@@ -1482,7 +1495,7 @@
|
|
|
1482
1495
|
color: ${n.COLORS.white};
|
|
1483
1496
|
position: relative;
|
|
1484
1497
|
z-index: 1;
|
|
1485
|
-
`},
|
|
1498
|
+
`},rl=d.styled.button`
|
|
1486
1499
|
position: relative;
|
|
1487
1500
|
display: inline-flex;
|
|
1488
1501
|
align-items: center;
|
|
@@ -1499,13 +1512,13 @@
|
|
|
1499
1512
|
transition:
|
|
1500
1513
|
background-color 0.15s ease,
|
|
1501
1514
|
color 0.15s ease;
|
|
1502
|
-
${({$variant:e,$active:t})=>
|
|
1515
|
+
${({$variant:e,$active:t})=>ol(e,t)}
|
|
1503
1516
|
${({$disabled:e})=>e&&`
|
|
1504
1517
|
opacity: 0.4;
|
|
1505
1518
|
pointer-events: none;
|
|
1506
1519
|
cursor: default;
|
|
1507
1520
|
`}
|
|
1508
|
-
`,
|
|
1521
|
+
`,nl=d.styled.span`
|
|
1509
1522
|
position: absolute;
|
|
1510
1523
|
width: 36px;
|
|
1511
1524
|
height: 36px;
|
|
@@ -1514,7 +1527,7 @@
|
|
|
1514
1527
|
z-index: 0;
|
|
1515
1528
|
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
1516
1529
|
pointer-events: none;
|
|
1517
|
-
`,
|
|
1530
|
+
`,il=d.styled.span`
|
|
1518
1531
|
display: inline-flex;
|
|
1519
1532
|
align-items: center;
|
|
1520
1533
|
justify-content: center;
|
|
@@ -1547,7 +1560,7 @@
|
|
|
1547
1560
|
pointer-events: none;
|
|
1548
1561
|
cursor: default;
|
|
1549
1562
|
`}
|
|
1550
|
-
`,oe=C.newClassNameGetter("pagination"),
|
|
1563
|
+
`,oe=C.newClassNameGetter("pagination"),ll=({boundaries:e=1,className:t,classnames:o,disabled:r=!1,initialPage:l=1,loop:a=!1,onChange:c,page:s,ref:p,showControls:x=!1,siblings:g=1,total:h,variant:y="flat",...f})=>{const S=s!==void 0,[b,$]=u.useState(l),m=S?s:b,O=u.useRef(new Map),w=u.useRef(null),k=u.useRef(null),z=el(h,m,g,e),j=u.useCallback(v=>{S||$(v),c==null||c(v)},[S,c]),L=u.useCallback(v=>{v<1||v>h||v===m||j(v)},[m,j,h]),R=u.useCallback(()=>{if(m<=1){a&&j(h);return}j(m-1)},[m,a,j,h]),E=u.useCallback(()=>{if(m>=h){a&&j(1);return}j(m+1)},[m,a,j,h]);return u.useEffect(()=>{const v=k.current,T=w.current,N=O.current.get(m);if(!v||!T||!N)return;const M=T.getBoundingClientRect(),F=N.getBoundingClientRect().left-M.left;v.style.transform=`translateX(${F}px)`},[m,z]),i.jsxs(tl,{...f,ref:p||w,className:oe("container",t),children:[i.jsx(nl,{ref:k,className:oe("cursor",o==null?void 0:o.cursor)}),x&&i.jsx(nt,{className:oe("controls",o==null?void 0:o.controls),$disabled:r||!a&&m<=1,onClick:R,"aria-label":"Previous page",children:i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m15 18-6-6 6-6"})})}),z.map((v,T)=>v==="dots"?i.jsx(il,{className:oe("ellipsis",o==null?void 0:o.ellipsis),children:"..."},`dots-${T}`):i.jsx(rl,{ref:N=>{N?O.current.set(v,N):O.current.delete(v)},className:oe("item",o==null?void 0:o.item),$active:v===m,$variant:y,$disabled:r,onClick:()=>L(v),"aria-label":`Page ${v}`,"aria-current":v===m?"page":void 0,children:v},v)),x&&i.jsx(nt,{className:oe("controls",o==null?void 0:o.controls),$disabled:r||!a&&m>=h,onClick:E,"aria-label":"Next page",children:i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"m9 18 6-6-6-6"})})})]})},it={light:{background:n.COLORS.white,border:n.alpha(n.COLORS.black,30),title:n.COLORS.black,description:n.COLORS["iron-grey"]},dark:{background:n.alpha(n.COLORS.white,5),border:n.alpha(n.COLORS.white,30),title:n.COLORS.white,description:"#9ca3af"}},Re=e=>it[e]??it.light,al=d.styled.div`
|
|
1551
1564
|
position: relative;
|
|
1552
1565
|
display: flex;
|
|
1553
1566
|
flex-direction: column;
|
|
@@ -1559,7 +1572,7 @@
|
|
|
1559
1572
|
box-shadow:
|
|
1560
1573
|
0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
1561
1574
|
0 2px 4px -2px rgba(0, 0, 0, 0.1);
|
|
1562
|
-
`,
|
|
1575
|
+
`,dl=d.styled.div`
|
|
1563
1576
|
position: absolute;
|
|
1564
1577
|
top: -1px;
|
|
1565
1578
|
right: 12px;
|
|
@@ -1572,40 +1585,40 @@
|
|
|
1572
1585
|
letter-spacing: 0.5px;
|
|
1573
1586
|
text-transform: uppercase;
|
|
1574
1587
|
line-height: 1.4;
|
|
1575
|
-
`,
|
|
1588
|
+
`,sl=d.styled.div`
|
|
1576
1589
|
display: flex;
|
|
1577
1590
|
flex-direction: column;
|
|
1578
1591
|
gap: 4px;
|
|
1579
|
-
`,
|
|
1592
|
+
`,cl=d.styled.div`
|
|
1580
1593
|
font-size: 18px;
|
|
1581
1594
|
font-weight: 600;
|
|
1582
1595
|
line-height: 1.4;
|
|
1583
1596
|
color: ${({$variant:e})=>Re(e).title};
|
|
1584
|
-
`,
|
|
1597
|
+
`,pl=d.styled.div`
|
|
1585
1598
|
font-size: 14px;
|
|
1586
1599
|
line-height: 1.5;
|
|
1587
1600
|
color: ${({$variant:e})=>Re(e).description};
|
|
1588
|
-
`,
|
|
1601
|
+
`,ul=d.styled.div`
|
|
1589
1602
|
display: flex;
|
|
1590
1603
|
flex-wrap: wrap;
|
|
1591
1604
|
gap: 8px;
|
|
1592
|
-
`,se=C.newClassNameGetter("panel"),
|
|
1605
|
+
`,se=C.newClassNameGetter("panel"),gl=({children:e,className:t,classnames:o,description:r,label:l,ref:a,title:c,variant:s="light",...p})=>{const x=c||r;return i.jsxs(al,{...p,ref:a,className:se("container",t),$variant:s,children:[l&&i.jsx(dl,{className:se("label",o==null?void 0:o.label),children:l}),x&&i.jsxs(sl,{children:[c&&i.jsx(cl,{className:se("title",o==null?void 0:o.title),$variant:s,children:c}),r&&i.jsx(pl,{className:se("description",o==null?void 0:o.description),$variant:s,children:r})]}),i.jsx(ul,{className:se("content",o==null?void 0:o.content),children:e})]})},xl=["Готовим стартовый стол к запуску","Прогреваем фотонные двигатели","Запрашиваем разрешение у ЦУПа","Проверяем герметичность шлюзов","Выводим реактор на рабочую мощность","Ожидаем окно для маневра","Проверяем целостность теплозащиты","Разворачиваем солнечные паруса","Активируем систему навигации","Инициализируем бортовой компьютер","Рассчитываем вектор ускорения","Продуваем топливные магистрали","Тестируем аварийную систему спасения","Стабилизируем гироскопы на платформе","Загружаем полетное задание в память","Синхронизируем орбитальные часы","Рассчитываем траекторию кометы","Настраиваем антенну дальней связи","Считываем телеметрию со спутника","Корректируем азимут наведения","Фиксируем координаты черной дыры","Загружаем карту звездного неба","Калибруем инерциальную платформу","Принимаем эфемериды от станции","Уточняем параметры орбиты","Привязываемся к опорным звездам","Строим модель гравитационного поля","Анализируем метрики далеких звезд","Ждем прохождения первого нейтрино","Декодируем сигналы из туманности","Замеряем гравитационные волны","Отправляем зонд в пояс астероидов","Перехватываем межзвездные частицы","Обрабатываем данные телескопа","Анализируем спектр далекой звезды","Собираем пробы лунного грунта","Сканируем поверхность экзопланеты","Измеряем реликтовое излучение","Картографируем магнитные аномалии","Исследуем состав колец Сатурна","Регистрируем вспышку сверхновой","Фиксируем рентгеновский пульсар","Моделируем столкновение галактик","Наблюдаем транзит далекой планеты","Калибруем квантовый компилятор","Переводим данные в гиперпространство","Синтезируем топливо из вакуума","Компилируем нейронную матрицу","Оптимизируем квантовые вентили","Разматываем кубиты суперпозиции","Интерполируем пространство решений","Нормализуем тензорное поле","Индексируем базу знаний вселенной","Дефрагментируем пространство-время","Хешируем координаты червоточины","Верифицируем квантовую запутанность","Устанавливаем связь с Вояджером","Расшифровываем послание с Проксимы","Ретранслируем сигнал через Юпитер","Пингуем ближайший ретранслятор","Буферизуем поток тахионных данных","Шифруем канал субпространственной связи","Декомпрессируем архив звездных карт","Проверяем давление в отсеках","Балансируем нагрузку на генераторы","Охлаждаем сверхпроводящие магниты","Калибруем датчики внешней среды","Перезагружаем модуль жизнеобеспечения","Тестируем маневровые двигатели","Обновляем прошивку скафандров","Юстируем зеркала главного телескопа","Переключаем контур охлаждения","Диагностируем плазменный щит","Затягиваем болты на обшивке"],hl=3500,fl=e=>e&&e.length>0?e:xl,yl=e=>e&&e>0?e:hl,bl=e=>Math.max(...e.map(t=>t.length)),$l=(e,t)=>{const o=Math.floor((t-e.length)/2);return e.padStart(e.length+o).padEnd(t)},lt=(e,t)=>{const o=Array.from({length:e},(r,l)=>l);for(let r=o.length-1;r>0;r--){const l=Math.floor(Math.random()*(r+1));[o[r],o[l]]=[o[l],o[r]]}if(t!==void 0&&o[0]===t){const r=1+Math.floor(Math.random()*(o.length-1));[o[0],o[r]]=[o[r],o[0]]}return o},Sl=P.keyframes`
|
|
1593
1606
|
from { transform: rotate(0deg) translateX(20px) rotate(0deg); }
|
|
1594
1607
|
to { transform: rotate(360deg) translateX(20px) rotate(-360deg); }
|
|
1595
|
-
`,
|
|
1608
|
+
`,ml=P.keyframes`
|
|
1596
1609
|
from { transform: rotate(120deg) translateX(14px) rotate(-120deg); }
|
|
1597
1610
|
to { transform: rotate(480deg) translateX(14px) rotate(-480deg); }
|
|
1598
|
-
|
|
1611
|
+
`,Ol=P.keyframes`
|
|
1599
1612
|
from { transform: rotate(240deg) translateX(26px) rotate(-240deg); }
|
|
1600
1613
|
to { transform: rotate(600deg) translateX(26px) rotate(-600deg); }
|
|
1601
|
-
`,
|
|
1614
|
+
`,wl=d.styled.div`
|
|
1602
1615
|
display: flex;
|
|
1603
1616
|
flex-direction: column;
|
|
1604
1617
|
align-items: center;
|
|
1605
1618
|
justify-content: center;
|
|
1606
1619
|
padding: 48px 24px;
|
|
1607
1620
|
gap: 28px;
|
|
1608
|
-
`,
|
|
1621
|
+
`,vl=d.styled.div`
|
|
1609
1622
|
position: relative;
|
|
1610
1623
|
width: 64px;
|
|
1611
1624
|
height: 64px;
|
|
@@ -1619,9 +1632,9 @@
|
|
|
1619
1632
|
border-radius: 50%;
|
|
1620
1633
|
background: ${n.COLORS.black};
|
|
1621
1634
|
opacity: ${e=>e.$index===0?1:e.$index===1?.6:.35};
|
|
1622
|
-
animation: ${e=>e.$index===0?
|
|
1635
|
+
animation: ${e=>e.$index===0?Sl:e.$index===1?ml:Ol}
|
|
1623
1636
|
${e=>e.$index===0?3:e.$index===1?2:4.5}s linear infinite;
|
|
1624
|
-
`,
|
|
1637
|
+
`,Cl=d.styled.span`
|
|
1625
1638
|
position: absolute;
|
|
1626
1639
|
width: 1px;
|
|
1627
1640
|
height: 1px;
|
|
@@ -1631,14 +1644,14 @@
|
|
|
1631
1644
|
clip: rect(0, 0, 0, 0);
|
|
1632
1645
|
white-space: nowrap;
|
|
1633
1646
|
border: 0;
|
|
1634
|
-
`,
|
|
1647
|
+
`,Rl=d.styled.p`
|
|
1635
1648
|
margin: 0;
|
|
1636
1649
|
font-size: 14px;
|
|
1637
1650
|
color: ${n.COLORS["iron-grey"]};
|
|
1638
1651
|
line-height: 1.5;
|
|
1639
1652
|
text-align: center;
|
|
1640
1653
|
max-width: 360px;
|
|
1641
|
-
`,
|
|
1654
|
+
`,Ll=40,kl=200,jl=30,at="АБВГДЕЖЗИКЛМНОПРСТУФХЦЧШЩЭЮЯабвгдежзиклмнопрстуфхцчшщэюяABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",El=()=>at[Math.floor(Math.random()*at.length)],zl=e=>kl+e*jl,Nl=()=>Ll,Tl=d.styled.div`
|
|
1642
1655
|
display: flex;
|
|
1643
1656
|
justify-content: center;
|
|
1644
1657
|
white-space: pre;
|
|
@@ -1648,23 +1661,23 @@
|
|
|
1648
1661
|
line-height: 1.6;
|
|
1649
1662
|
color: ${n.COLORS.black};
|
|
1650
1663
|
min-height: 1.6em;
|
|
1651
|
-
`,
|
|
1664
|
+
`,Il=d.styled.span`
|
|
1652
1665
|
display: inline-block;
|
|
1653
1666
|
width: 0.65em;
|
|
1654
1667
|
text-align: center;
|
|
1655
|
-
`,
|
|
1668
|
+
`,Al=C.newClassNameGetter("split-flap-text"),vt=({className:e,ref:t,text:o,...r})=>{const[l,a]=u.useState(()=>o.split("")),c=u.useRef(o),s=u.useRef([]),p=u.useRef(null),x=u.useRef([]),g=u.useRef(o.split("")),h=u.useCallback(()=>{p.current&&(clearInterval(p.current),p.current=null);for(const f of x.current)clearTimeout(f);x.current=[]},[]),y=u.useCallback(f=>{h(),g.current=f,s.current=f.map(S=>S===" "),p.current=setInterval(()=>{a(S=>S.map((b,$)=>s.current[$]?g.current[$]:El()))},Nl()),x.current=f.map((S,b)=>setTimeout(()=>{s.current[b]=!0,s.current.every(Boolean)&&(p.current&&(clearInterval(p.current),p.current=null),a([...g.current]))},zl(b)))},[h]);return u.useEffect(()=>{o!==c.current&&(c.current=o,y(o.split("")))},[o,y]),u.useEffect(()=>h,[h]),i.jsx(Tl,{...r,ref:t,className:Al("container",e),"aria-hidden":"true",children:l.map((f,S)=>i.jsx(Il,{children:f===" "?" ":f},S))})},we=C.newClassNameGetter("pending-screen"),Pl=({className:e,classnames:t,description:o,interval:r,phrases:l,ref:a,...c})=>{const s=u.useMemo(()=>fl(l),[l]),p=u.useMemo(()=>yl(r),[r]),x=u.useMemo(()=>bl(s),[s]),g=u.useRef([]),h=u.useRef(0),y=u.useCallback(w=>(h.current>=g.current.length&&(g.current=lt(s.length,w),h.current=0),g.current[h.current++]),[s.length]),[f,S]=u.useState(()=>{g.current=lt(s.length);const w=g.current[0];return h.current=1,w}),b=u.useRef(null),$=u.useCallback(()=>{S(w=>y(w))},[y]);u.useEffect(()=>(b.current=setInterval($,p),()=>{b.current&&clearInterval(b.current)}),[$,p]);const m=s[f],O=$l(m,x);return i.jsxs(wl,{...c,ref:a,className:we("container",e),role:"status",children:[i.jsxs(vl,{className:we("indicator",t==null?void 0:t.indicator),children:[i.jsx(Te,{$index:0}),i.jsx(Te,{$index:1}),i.jsx(Te,{$index:2})]}),i.jsx(vt,{text:O,className:we("board",t==null?void 0:t.board)}),i.jsx(Cl,{children:m}),o&&i.jsx(Rl,{className:we("description",t==null?void 0:t.description),children:o})]})},_e={compact:{height:4,radius:2},default:{height:8,radius:4}},Bl=d.styled.div`
|
|
1656
1669
|
width: 100%;
|
|
1657
1670
|
height: ${({$size:e})=>_e[e].height}px;
|
|
1658
1671
|
border-radius: ${({$size:e})=>_e[e].radius}px;
|
|
1659
1672
|
background-color: ${n.COLORS.gray};
|
|
1660
1673
|
overflow: hidden;
|
|
1661
|
-
`,
|
|
1674
|
+
`,Ml=d.styled.div`
|
|
1662
1675
|
height: 100%;
|
|
1663
1676
|
width: ${({$value:e})=>Math.min(100,Math.max(0,e))}%;
|
|
1664
1677
|
border-radius: ${({$size:e})=>_e[e].radius}px;
|
|
1665
1678
|
background-color: ${n.COLORS.black};
|
|
1666
1679
|
transition: width 0.2s ease;
|
|
1667
|
-
`,dt=C.newClassNameGetter("progress"),
|
|
1680
|
+
`,dt=C.newClassNameGetter("progress"),Fl=({value:e,size:t="default",className:o,classnames:r,ref:l,...a})=>i.jsx(Bl,{...a,ref:l,$size:t,className:dt("track",o,r==null?void 0:r.track),role:"progressbar","aria-valuenow":e,"aria-valuemin":0,"aria-valuemax":100,children:i.jsx(Ml,{$size:t,$value:e,className:dt("bar",r==null?void 0:r.bar)})}),Ct=u.createContext(null),_l=d.styled.div`
|
|
1668
1681
|
position: fixed;
|
|
1669
1682
|
bottom: 24px;
|
|
1670
1683
|
right: 24px;
|
|
@@ -1679,56 +1692,56 @@
|
|
|
1679
1692
|
animation: ${n.KEYFRAMES.fadeIn} 0.2s ease-out;
|
|
1680
1693
|
pointer-events: none;
|
|
1681
1694
|
color: ${n.COLORS.black};
|
|
1682
|
-
`,
|
|
1695
|
+
`,Dl=d.styled.span`
|
|
1683
1696
|
font-size: 14px;
|
|
1684
1697
|
font-weight: 500;
|
|
1685
1698
|
white-space: nowrap;
|
|
1686
|
-
`,
|
|
1699
|
+
`,Gl=({children:e,defaultMessage:t="Saving"})=>{const[o,r]=u.useState(!1),[l,a]=u.useState(t),c=u.useCallback(x=>{a(x??t),r(!0)},[t]),s=u.useCallback(()=>{r(!1)},[]),p=u.useMemo(()=>({isVisible:o,show:c,hide:s}),[o,c,s]);return i.jsxs(Ct.Provider,{value:p,children:[e,o&&i.jsxs(_l,{children:[i.jsx(d.Spinner,{size:"sm"}),i.jsx(Dl,{children:l})]})]})},Yl=()=>{const e=u.useContext(Ct);if(!e)throw new Error("useSaveProgress must be used within SaveProgressProvider");return e},Hl=P.keyframes`
|
|
1687
1700
|
0% { opacity: 1; }
|
|
1688
1701
|
50% { opacity: 0.4; }
|
|
1689
1702
|
100% { opacity: 1; }
|
|
1690
|
-
`,
|
|
1703
|
+
`,Xl=P.keyframes`
|
|
1691
1704
|
0% { transform: translateX(-100%); }
|
|
1692
1705
|
60% { transform: translateX(100%); }
|
|
1693
1706
|
100% { transform: translateX(100%); }
|
|
1694
|
-
`,
|
|
1695
|
-
animation: ${
|
|
1696
|
-
`,
|
|
1707
|
+
`,Ul=P.css`
|
|
1708
|
+
animation: ${Hl} 1.5s ease-in-out infinite;
|
|
1709
|
+
`,Wl=P.css`
|
|
1697
1710
|
&::after {
|
|
1698
1711
|
content: '';
|
|
1699
1712
|
position: absolute;
|
|
1700
1713
|
inset: 0;
|
|
1701
1714
|
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
|
|
1702
|
-
animation: ${
|
|
1715
|
+
animation: ${Xl} 1.6s linear infinite;
|
|
1703
1716
|
}
|
|
1704
|
-
`,
|
|
1717
|
+
`,ql={pulse:Ul,wave:Wl,none:null},Kl={none:"0",sm:"4px",md:"8px",lg:"12px",full:"9999px"},Ie=e=>typeof e=="number"?`${e}px`:e,Vl=d.styled.div`
|
|
1705
1718
|
position: relative;
|
|
1706
1719
|
overflow: hidden;
|
|
1707
1720
|
background-color: #e5e7eb;
|
|
1708
1721
|
width: ${({$width:e,$circle:t,$height:o})=>Ie(t?o:e)};
|
|
1709
1722
|
height: ${({$height:e})=>Ie(e)};
|
|
1710
|
-
border-radius: ${({$circle:e,$radius:t})=>e?"50%":
|
|
1711
|
-
${({$animation:e})=>
|
|
1712
|
-
`,
|
|
1723
|
+
border-radius: ${({$circle:e,$radius:t})=>e?"50%":Kl[t]};
|
|
1724
|
+
${({$animation:e})=>ql[e]}
|
|
1725
|
+
`,Zl=C.newClassNameGetter("skeleton"),Ql=({animation:e="pulse",circle:t=!1,className:o,height:r=16,radius:l="md",ref:a,width:c="100%",...s})=>i.jsx(Vl,{...s,ref:a,className:Zl("container",o),$animation:e,$circle:t,$height:r,$radius:l,$width:c}),Jl=d.styled.span`
|
|
1713
1726
|
display: inline-flex;
|
|
1714
1727
|
align-items: baseline;
|
|
1715
1728
|
gap: 4px;
|
|
1716
1729
|
font-size: 13px;
|
|
1717
1730
|
color: #666;
|
|
1718
|
-
`,
|
|
1731
|
+
`,ea=d.styled.strong`
|
|
1719
1732
|
font-weight: 700;
|
|
1720
1733
|
color: ${n.COLORS.black};
|
|
1721
|
-
`,
|
|
1734
|
+
`,ta=d.styled.span``,Ae=C.newClassNameGetter("stat"),oa=({className:e,classnames:t,label:o,ref:r,value:l,...a})=>i.jsxs(Jl,{...a,ref:r,className:Ae("container",e),children:[i.jsx(ea,{className:Ae("value",t==null?void 0:t.value),children:l}),i.jsx(ta,{className:Ae("label",t==null?void 0:t.label),children:o})]}),ra=d.styled.div`
|
|
1722
1735
|
display: flex;
|
|
1723
1736
|
flex-direction: column;
|
|
1724
1737
|
border: 1px solid ${n.COLORS.gray};
|
|
1725
1738
|
border-radius: 8px;
|
|
1726
1739
|
overflow: hidden;
|
|
1727
|
-
`,
|
|
1740
|
+
`,na=d.styled.div`
|
|
1728
1741
|
&:not(:last-child) {
|
|
1729
1742
|
border-bottom: 1px solid ${n.COLORS.gray};
|
|
1730
1743
|
}
|
|
1731
|
-
`,
|
|
1744
|
+
`,ia=d.styled.button`
|
|
1732
1745
|
display: flex;
|
|
1733
1746
|
align-items: center;
|
|
1734
1747
|
gap: 8px;
|
|
@@ -1747,7 +1760,7 @@
|
|
|
1747
1760
|
&:hover {
|
|
1748
1761
|
background-color: ${({$interactive:e})=>e?n.alpha(n.COLORS.black,3):"transparent"};
|
|
1749
1762
|
}
|
|
1750
|
-
`,
|
|
1763
|
+
`,la=d.styled.span`
|
|
1751
1764
|
display: flex;
|
|
1752
1765
|
align-items: center;
|
|
1753
1766
|
justify-content: center;
|
|
@@ -1757,72 +1770,72 @@
|
|
|
1757
1770
|
color: ${n.COLORS["iron-grey"]};
|
|
1758
1771
|
transition: transform 0.15s ease;
|
|
1759
1772
|
transform: rotate(${({$expanded:e})=>e?"90deg":"0deg"});
|
|
1760
|
-
`,
|
|
1773
|
+
`,aa=d.styled.span`
|
|
1761
1774
|
width: 16px;
|
|
1762
1775
|
height: 16px;
|
|
1763
1776
|
flex-shrink: 0;
|
|
1764
|
-
`,
|
|
1777
|
+
`,da={success:n.COLORS.green,error:n.COLORS.red,running:n.COLORS["steel-blue"],pending:n.COLORS.gray},sa=P.keyframes`
|
|
1765
1778
|
from { transform: rotate(0deg); }
|
|
1766
1779
|
to { transform: rotate(360deg); }
|
|
1767
|
-
`,
|
|
1768
|
-
animation: ${
|
|
1769
|
-
`,
|
|
1780
|
+
`,ca=P.css`
|
|
1781
|
+
animation: ${sa} 1s linear infinite;
|
|
1782
|
+
`,pa=d.styled.span`
|
|
1770
1783
|
display: flex;
|
|
1771
1784
|
align-items: center;
|
|
1772
1785
|
justify-content: center;
|
|
1773
1786
|
flex-shrink: 0;
|
|
1774
|
-
color: ${({$status:e})=>
|
|
1775
|
-
${({$status:e})=>e==="running"&&
|
|
1776
|
-
`,
|
|
1787
|
+
color: ${({$status:e})=>da[e]};
|
|
1788
|
+
${({$status:e})=>e==="running"&&ca}
|
|
1789
|
+
`,ua=d.styled.span`
|
|
1777
1790
|
flex: 1;
|
|
1778
1791
|
min-width: 0;
|
|
1779
1792
|
overflow: hidden;
|
|
1780
1793
|
text-overflow: ellipsis;
|
|
1781
1794
|
white-space: nowrap;
|
|
1782
1795
|
color: ${({$muted:e})=>e?n.COLORS["iron-grey"]:n.COLORS.black};
|
|
1783
|
-
`,
|
|
1796
|
+
`,ga=d.styled.span`
|
|
1784
1797
|
flex-shrink: 0;
|
|
1785
1798
|
font-size: 12px;
|
|
1786
1799
|
font-weight: 400;
|
|
1787
1800
|
color: ${n.COLORS["iron-grey"]};
|
|
1788
1801
|
font-variant-numeric: tabular-nums;
|
|
1789
|
-
`,
|
|
1802
|
+
`,xa=d.styled.div`
|
|
1790
1803
|
display: grid;
|
|
1791
1804
|
grid-template-rows: ${({$expanded:e})=>e?"1fr":"0fr"};
|
|
1792
1805
|
transition: grid-template-rows 0.15s ease;
|
|
1793
|
-
`,
|
|
1806
|
+
`,ha=d.styled.div`
|
|
1794
1807
|
overflow: hidden;
|
|
1795
|
-
`,
|
|
1808
|
+
`,fa=d.styled.div`
|
|
1796
1809
|
padding: 8px 0;
|
|
1797
1810
|
background-color: ${n.COLORS.white};
|
|
1798
1811
|
border-top: 1px solid ${n.COLORS.gray};
|
|
1799
1812
|
font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
|
|
1800
1813
|
font-size: 12px;
|
|
1801
1814
|
line-height: 20px;
|
|
1802
|
-
`,
|
|
1815
|
+
`,ya=d.styled.div`
|
|
1803
1816
|
display: flex;
|
|
1804
1817
|
padding: 0 16px;
|
|
1805
1818
|
|
|
1806
1819
|
&:hover {
|
|
1807
1820
|
background-color: ${n.alpha(n.COLORS.black,3)};
|
|
1808
1821
|
}
|
|
1809
|
-
`,
|
|
1822
|
+
`,ba=d.styled.span`
|
|
1810
1823
|
flex-shrink: 0;
|
|
1811
1824
|
width: 40px;
|
|
1812
1825
|
text-align: right;
|
|
1813
1826
|
padding-right: 16px;
|
|
1814
1827
|
color: ${n.COLORS["iron-grey"]};
|
|
1815
1828
|
user-select: none;
|
|
1816
|
-
|
|
1829
|
+
`,$a=d.styled.span`
|
|
1817
1830
|
flex: 1;
|
|
1818
1831
|
min-width: 0;
|
|
1819
1832
|
white-space: pre;
|
|
1820
1833
|
color: ${n.COLORS.black};
|
|
1821
|
-
`,ve=C.newClassNameGetter("step-log"),
|
|
1834
|
+
`,ve=C.newClassNameGetter("step-log"),Sa={success:Le.CircleCheck,error:Le.CircleX,running:i.LoaderCircle,pending:Le.Circle},ma=({className:e,classnames:t,defaultValue:o=[],onChange:r,ref:l,steps:a,value:c,...s})=>{const[p,x]=u.useState(o),g=c!==void 0,h=g?c:p,y=u.useCallback(f=>{const b=h.includes(f)?h.filter($=>$!==f):[...h,f];g||x(b),r==null||r(b)},[h,g,r]);return i.jsx(ra,{...s,ref:l,className:ve("container",e),children:a.map(f=>{const S=h.includes(f.value),b=f.status??"pending",$=b!=="pending",m=f.lines&&f.lines.length>0,O=Sa[b];return i.jsxs(na,{className:ve("step",t==null?void 0:t.step),children:[i.jsxs(ia,{type:"button",$expanded:S,$interactive:$,onClick:$?()=>y(f.value):void 0,className:ve("header",t==null?void 0:t.header),children:[$?i.jsx(la,{$expanded:S,children:i.jsx(i.ChevronRight,{size:14})}):i.jsx(aa,{}),i.jsx(pa,{$status:b,children:i.jsx(O,{size:16})}),i.jsx(ua,{$muted:b==="pending",children:f.title}),f.duration&&i.jsx(ga,{children:f.duration})]}),$&&m&&i.jsx(xa,{$expanded:S,children:i.jsx(ha,{children:i.jsx(fa,{className:ve("log",t==null?void 0:t.log),children:f.lines.map(w=>i.jsxs(ya,{children:[i.jsx(ba,{children:w.line}),i.jsx($a,{children:w.text})]},w.line))})})})]},f.value)})})},Oa=d.styled.div`
|
|
1822
1835
|
display: flex;
|
|
1823
1836
|
align-items: ${e=>e.$orientation==="vertical"?"flex-start":"center"};
|
|
1824
1837
|
flex-direction: ${e=>e.$orientation==="vertical"?"column":"row"};
|
|
1825
|
-
`,
|
|
1838
|
+
`,wa=d.styled.div`
|
|
1826
1839
|
display: flex;
|
|
1827
1840
|
align-items: ${e=>e.$orientation==="vertical"?"flex-start":"center"};
|
|
1828
1841
|
flex-direction: ${e=>e.$orientation==="vertical"?"column":"row"};
|
|
@@ -1831,7 +1844,7 @@
|
|
|
1831
1844
|
&:last-child {
|
|
1832
1845
|
flex: 0;
|
|
1833
1846
|
}
|
|
1834
|
-
`,
|
|
1847
|
+
`,va=d.styled.button`
|
|
1835
1848
|
display: flex;
|
|
1836
1849
|
align-items: center;
|
|
1837
1850
|
gap: 10px;
|
|
@@ -1840,7 +1853,7 @@
|
|
|
1840
1853
|
background: transparent;
|
|
1841
1854
|
cursor: ${e=>e.$clickable?"pointer":"default"};
|
|
1842
1855
|
flex-shrink: 0;
|
|
1843
|
-
`,
|
|
1856
|
+
`,Ca=d.styled.div`
|
|
1844
1857
|
display: flex;
|
|
1845
1858
|
align-items: center;
|
|
1846
1859
|
justify-content: center;
|
|
@@ -1864,13 +1877,13 @@
|
|
|
1864
1877
|
border: 2px solid ${n.COLORS.gray};
|
|
1865
1878
|
color: ${n.COLORS["iron-grey"]};
|
|
1866
1879
|
`}
|
|
1867
|
-
`,
|
|
1880
|
+
`,Ra=d.styled.span`
|
|
1868
1881
|
font-size: 14px;
|
|
1869
1882
|
font-weight: 500;
|
|
1870
1883
|
white-space: nowrap;
|
|
1871
1884
|
color: ${e=>e.$active||e.$completed?n.COLORS.black:n.COLORS["iron-grey"]};
|
|
1872
1885
|
transition: color 0.2s ease;
|
|
1873
|
-
`,
|
|
1886
|
+
`,La=d.styled.div`
|
|
1874
1887
|
background-color: ${e=>e.$completed?n.COLORS.black:n.COLORS.gray};
|
|
1875
1888
|
transition: background-color 0.2s ease;
|
|
1876
1889
|
|
|
@@ -1884,11 +1897,11 @@
|
|
|
1884
1897
|
min-width: 16px;
|
|
1885
1898
|
margin: 0 12px;
|
|
1886
1899
|
`}
|
|
1887
|
-
`,ce=C.newClassNameGetter("stepper"),
|
|
1900
|
+
`,ce=C.newClassNameGetter("stepper"),ka=({className:e,classnames:t,onChange:o,orientation:r="horizontal",ref:l,steps:a,value:c,...s})=>{const p=u.useMemo(()=>a.findIndex(x=>x.value===c),[a,c]);return i.jsx(Oa,{...s,ref:l,$orientation:r,className:ce("container",e),children:a.map((x,g)=>{const h=x.value===c,y=g<p,f=g===a.length-1;return i.jsxs(wa,{$orientation:r,children:[i.jsxs(va,{type:"button",$active:h,$completed:y,$clickable:!!o,onClick:()=>o==null?void 0:o(x.value),className:ce("step",t==null?void 0:t.step),children:[i.jsx(Ca,{$active:h,$completed:y,className:ce("circle",t==null?void 0:t.circle),children:g+1}),i.jsx(Ra,{$active:h,$completed:y,className:ce("label",t==null?void 0:t.label),children:x.label})]}),!f&&i.jsx(La,{$completed:y,$orientation:r,className:ce("line",t==null?void 0:t.line)})]},x.value)})})},ja=d.styled.div`
|
|
1888
1901
|
display: flex;
|
|
1889
1902
|
align-items: center;
|
|
1890
1903
|
gap: 6px;
|
|
1891
|
-
`,
|
|
1904
|
+
`,Ea=d.styled.button`
|
|
1892
1905
|
padding: 6px 16px;
|
|
1893
1906
|
border: none;
|
|
1894
1907
|
border-radius: 12px;
|
|
@@ -1906,60 +1919,60 @@
|
|
|
1906
1919
|
&:hover:not(:disabled) {
|
|
1907
1920
|
background-color: ${e=>e.$active?n.COLORS.gray:"rgba(0, 0, 0, 0.05)"};
|
|
1908
1921
|
}
|
|
1909
|
-
`,st=C.newClassNameGetter("tabs"),
|
|
1922
|
+
`,st=C.newClassNameGetter("tabs"),za=({className:e,classnames:t,onChange:o,ref:r,tabs:l,value:a,...c})=>i.jsx(ja,{...c,ref:r,className:st("container",e),role:"tablist",children:l.map(s=>i.jsx(Ea,{type:"button",role:"tab","aria-selected":a===s.value,$active:a===s.value,$disabled:!!s.disabled,disabled:s.disabled,onClick:()=>o(s.value),className:st("tab",t==null?void 0:t.tab),children:s.label},s.value))}),Na=d.styled.div`
|
|
1910
1923
|
display: flex;
|
|
1911
1924
|
flex-direction: column;
|
|
1912
|
-
`,
|
|
1925
|
+
`,Ta=d.styled.div`
|
|
1913
1926
|
display: grid;
|
|
1914
1927
|
grid-template-columns: 20px 1fr;
|
|
1915
1928
|
gap: 0 12px;
|
|
1916
|
-
`,
|
|
1929
|
+
`,Ia=d.styled.div`
|
|
1917
1930
|
display: flex;
|
|
1918
1931
|
flex-direction: column;
|
|
1919
1932
|
align-items: center;
|
|
1920
1933
|
grid-row: 1 / -1;
|
|
1921
|
-
`,
|
|
1934
|
+
`,Aa=d.styled.div`
|
|
1922
1935
|
width: 10px;
|
|
1923
1936
|
height: 10px;
|
|
1924
1937
|
border-radius: 50%;
|
|
1925
1938
|
background-color: ${n.COLORS.black};
|
|
1926
1939
|
flex-shrink: 0;
|
|
1927
1940
|
margin-top: 5px;
|
|
1928
|
-
`,
|
|
1941
|
+
`,Pa=d.styled.div`
|
|
1929
1942
|
width: 2px;
|
|
1930
1943
|
flex: 1;
|
|
1931
1944
|
background-color: ${n.COLORS.gray};
|
|
1932
1945
|
visibility: ${e=>e.$last?"hidden":"visible"};
|
|
1933
|
-
`,
|
|
1946
|
+
`,Ba=d.styled.div`
|
|
1934
1947
|
padding-bottom: ${e=>e.$last?"0":"24px"};
|
|
1935
1948
|
min-width: 0;
|
|
1936
|
-
`,
|
|
1949
|
+
`,Ma=d.styled.div`
|
|
1937
1950
|
display: flex;
|
|
1938
1951
|
align-items: flex-start;
|
|
1939
1952
|
justify-content: space-between;
|
|
1940
1953
|
gap: 8px;
|
|
1941
|
-
`,
|
|
1954
|
+
`,Fa=d.styled.div`
|
|
1942
1955
|
font-size: 15px;
|
|
1943
1956
|
font-weight: 600;
|
|
1944
1957
|
color: ${n.COLORS.black};
|
|
1945
1958
|
line-height: 20px;
|
|
1946
1959
|
min-width: 0;
|
|
1947
|
-
`,
|
|
1960
|
+
`,_a=d.styled.div`
|
|
1948
1961
|
display: flex;
|
|
1949
1962
|
align-items: center;
|
|
1950
1963
|
gap: 4px;
|
|
1951
1964
|
flex-shrink: 0;
|
|
1952
|
-
`,
|
|
1965
|
+
`,Da=d.styled.div`
|
|
1953
1966
|
font-size: 13px;
|
|
1954
1967
|
color: ${n.COLORS["iron-grey"]};
|
|
1955
1968
|
margin-top: 2px;
|
|
1956
1969
|
line-height: 1.4;
|
|
1957
|
-
`,
|
|
1970
|
+
`,Ga=d.styled.div`
|
|
1958
1971
|
font-size: 14px;
|
|
1959
1972
|
color: ${n.COLORS["iron-grey"]};
|
|
1960
1973
|
margin-top: 8px;
|
|
1961
1974
|
line-height: 1.5;
|
|
1962
|
-
`,H=C.newClassNameGetter("timeline"),
|
|
1975
|
+
`,H=C.newClassNameGetter("timeline"),Ya=({className:e,classnames:t,items:o,ref:r,...l})=>i.jsx(Na,{...l,ref:r,className:H("container",e),children:o.map((a,c)=>{const s=c===o.length-1;return i.jsxs(Ta,{className:H("item",t==null?void 0:t.item),children:[i.jsxs(Ia,{$last:s,children:[i.jsx(Aa,{className:H("dot",t==null?void 0:t.dot)}),i.jsx(Pa,{className:H("line",t==null?void 0:t.line),$last:s})]}),i.jsxs(Ba,{className:H("content",t==null?void 0:t.content),$last:s,children:[i.jsxs(Ma,{children:[i.jsx(Fa,{className:H("title",t==null?void 0:t.title),children:a.title}),a.actions&&i.jsx(_a,{className:H("actions",t==null?void 0:t.actions),children:a.actions})]}),a.description&&i.jsx(Da,{className:H("description",t==null?void 0:t.description),children:a.description}),a.content&&i.jsx(Ga,{className:H("body",t==null?void 0:t.body),children:a.content})]})]},c)})}),Rt=u.createContext(null),Pe=3,ct={default:{background:"#374151",text:n.COLORS.white,border:"#374151"},success:{background:n.COLORS.green,text:n.COLORS.white,border:n.COLORS.green},warning:{background:n.COLORS.yellow,text:n.COLORS.white,border:n.COLORS.yellow},danger:{background:n.COLORS.red,text:n.COLORS.white,border:n.COLORS.red}},Ha=(e,t)=>{switch(t.type){case"ADD_TOAST":{const o=t.payload;return e.toasts.length<Pe?{...e,toasts:[...e.toasts,o]}:{...e,queue:[...e.queue,o]}}case"REMOVE_TOAST":{const o=t.payload,r=e.toasts.filter(a=>a.id!==o),l=e.queue[0];return l&&r.length<Pe?{toasts:[...r,l],queue:e.queue.slice(1)}:{...e,toasts:r}}case"SHOW_NEXT_FROM_QUEUE":{const o=e.queue[0];return!o||e.toasts.length>=Pe?e:{toasts:[...e.toasts,o],queue:e.queue.slice(1)}}default:return e}},Xa={toasts:[],queue:[]},Be=e=>ct[e]??ct.default,Ua=d.styled.div`
|
|
1963
1976
|
position: fixed;
|
|
1964
1977
|
bottom: 24px;
|
|
1965
1978
|
left: 24px;
|
|
@@ -1970,7 +1983,7 @@
|
|
|
1970
1983
|
pointer-events: none;
|
|
1971
1984
|
width: auto;
|
|
1972
1985
|
max-width: 90vw;
|
|
1973
|
-
`,
|
|
1986
|
+
`,Wa=d.styled.div`
|
|
1974
1987
|
display: flex;
|
|
1975
1988
|
align-items: center;
|
|
1976
1989
|
justify-content: space-between;
|
|
@@ -1986,14 +1999,14 @@
|
|
|
1986
1999
|
0.3s ease-out;
|
|
1987
2000
|
pointer-events: auto;
|
|
1988
2001
|
max-width: 500px;
|
|
1989
|
-
`,
|
|
2002
|
+
`,qa=d.styled.span`
|
|
1990
2003
|
font-size: 14px;
|
|
1991
2004
|
font-weight: 500;
|
|
1992
2005
|
line-height: 1.4;
|
|
1993
2006
|
white-space: nowrap;
|
|
1994
2007
|
overflow: hidden;
|
|
1995
2008
|
text-overflow: ellipsis;
|
|
1996
|
-
`,
|
|
2009
|
+
`,Ka=d.styled.button`
|
|
1997
2010
|
display: flex;
|
|
1998
2011
|
align-items: center;
|
|
1999
2012
|
justify-content: center;
|
|
@@ -2011,13 +2024,13 @@
|
|
|
2011
2024
|
&:hover {
|
|
2012
2025
|
opacity: 1;
|
|
2013
2026
|
}
|
|
2014
|
-
`,
|
|
2027
|
+
`,Va=d.styled.div`
|
|
2015
2028
|
display: flex;
|
|
2016
2029
|
align-items: center;
|
|
2017
2030
|
justify-content: space-between;
|
|
2018
2031
|
gap: 12px;
|
|
2019
2032
|
width: 100%;
|
|
2020
|
-
`,
|
|
2033
|
+
`,Za=d.styled.div`
|
|
2021
2034
|
display: flex;
|
|
2022
2035
|
align-items: center;
|
|
2023
2036
|
justify-content: center;
|
|
@@ -2032,7 +2045,7 @@
|
|
|
2032
2045
|
font-weight: 500;
|
|
2033
2046
|
white-space: nowrap;
|
|
2034
2047
|
margin-left: auto;
|
|
2035
|
-
`,pt=({toast:e,onHide:t})=>{const[o,r]=u.useState(!1),l=()=>{r(!0),setTimeout(()=>{t(e.id)},300)};return u.useEffect(()=>{if(e.duration){const a=setTimeout(()=>{l()},e.duration);return()=>clearTimeout(a)}},[e.duration,e.id]),i.jsxs(
|
|
2048
|
+
`,pt=({toast:e,onHide:t})=>{const[o,r]=u.useState(!1),l=()=>{r(!0),setTimeout(()=>{t(e.id)},300)};return u.useEffect(()=>{if(e.duration){const a=setTimeout(()=>{l()},e.duration);return()=>clearTimeout(a)}},[e.duration,e.id]),i.jsxs(Wa,{$variant:e.variant,$isExiting:o,children:[i.jsx(qa,{children:e.message}),i.jsx(Ka,{onClick:l,children:i.jsx(i.X,{style:{width:16,height:16}})})]})},Qa=({toasts:e,queueCount:t,onHide:o})=>{if(e.length===0)return null;const r=e.length-1;return i.jsx(Ua,{children:e.map((l,a)=>a===r&&t>0?i.jsxs(Va,{children:[i.jsx(pt,{toast:l,onHide:o}),i.jsxs(Za,{children:["+",t]})]},l.id):i.jsx(pt,{toast:l,onHide:o},l.id))})},Ja=({children:e})=>{const[t,o]=u.useReducer(Ha,Xa),r=u.useCallback((a,c="default",s)=>{const p=`toast-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;o({type:"ADD_TOAST",payload:{id:p,message:a,variant:c,duration:s}})},[]),l=u.useCallback(a=>{o({type:"REMOVE_TOAST",payload:a})},[]);return i.jsxs(Rt.Provider,{value:{show:r,hide:l},children:[e,i.jsx(Qa,{toasts:t.toasts,queueCount:t.queue.length,onHide:l})]})},ed=()=>{const e=u.useContext(Rt);if(!e)throw new Error("useToastr must be used within ToastProvider");return e},ut={dark:{background:n.COLORS.black,text:n.COLORS.white},light:{background:n.COLORS.white,text:n.COLORS.black,border:n.COLORS.gray},success:{background:n.COLORS.green,text:n.COLORS.white},warning:{background:n.COLORS.yellow,text:n.COLORS.white},danger:{background:n.COLORS.red,text:n.COLORS.white}},ue=e=>ut[e]??ut.dark,td=(e,t)=>{const o=ue(t).background;switch(e){case"top":return`
|
|
2036
2049
|
bottom: -12px;
|
|
2037
2050
|
left: 50%;
|
|
2038
2051
|
margin-left: -6px;
|
|
@@ -2052,7 +2065,7 @@
|
|
|
2052
2065
|
top: 50%;
|
|
2053
2066
|
margin-top: -6px;
|
|
2054
2067
|
border-right-color: ${o};
|
|
2055
|
-
`;default:return""}},
|
|
2068
|
+
`;default:return""}},od=(e,t)=>{if(t!=="light")return"";const o=ue(t).border;switch(e){case"top":return`
|
|
2056
2069
|
&::after {
|
|
2057
2070
|
bottom: -14px;
|
|
2058
2071
|
left: 50%;
|
|
@@ -2106,7 +2119,7 @@
|
|
|
2106
2119
|
width: 0;
|
|
2107
2120
|
height: 0;
|
|
2108
2121
|
border: 6px solid transparent;
|
|
2109
|
-
${
|
|
2122
|
+
${td(e.$placement,e.$variant)}
|
|
2110
2123
|
}
|
|
2111
2124
|
|
|
2112
2125
|
${e.$variant==="light"?`
|
|
@@ -2119,12 +2132,12 @@
|
|
|
2119
2132
|
}
|
|
2120
2133
|
`:""}
|
|
2121
2134
|
|
|
2122
|
-
${
|
|
2123
|
-
`,
|
|
2135
|
+
${od(e.$placement,e.$variant)}
|
|
2136
|
+
`,rd=d.styled.div`
|
|
2124
2137
|
position: relative;
|
|
2125
2138
|
display: inline-block;
|
|
2126
2139
|
width: fit-content;
|
|
2127
|
-
`,
|
|
2140
|
+
`,nd=e=>{switch(e){case"top":return`
|
|
2128
2141
|
bottom: calc(100% + 8px);
|
|
2129
2142
|
left: 50%;
|
|
2130
2143
|
transform: translateX(-50%);
|
|
@@ -2140,29 +2153,29 @@
|
|
|
2140
2153
|
left: calc(100% + 8px);
|
|
2141
2154
|
top: 50%;
|
|
2142
2155
|
transform: translateY(-50%);
|
|
2143
|
-
`;default:return""}},
|
|
2156
|
+
`;default:return""}},id=d.styled.div`
|
|
2144
2157
|
position: absolute;
|
|
2145
2158
|
${e=>Lt(e)}
|
|
2146
|
-
${({$placement:e})=>
|
|
2147
|
-
`,
|
|
2159
|
+
${({$placement:e})=>nd(e)}
|
|
2160
|
+
`,ld=d.styled.div`
|
|
2148
2161
|
position: fixed;
|
|
2149
2162
|
${e=>Lt(e)}
|
|
2150
|
-
`,Me=C.newClassNameGetter("tooltip"),Z=8,
|
|
2163
|
+
`,Me=C.newClassNameGetter("tooltip"),Z=8,ad=({children:e,className:t,classnames:o,content:r,delay:l=200,placement:a="top",portalRenderNode:c,ref:s,variant:p="dark",...x})=>{const[g,h]=u.useState(!1),[y,f]=u.useState(null),[S,b]=u.useState(a),[$,m]=u.useState({top:0,left:0}),O=u.useRef(null),w=u.useRef(null),k=u.useCallback(()=>{var U,W;if(!O.current)return;const R=O.current.getBoundingClientRect(),E=((U=w.current)==null?void 0:U.offsetWidth)??100,v=((W=w.current)==null?void 0:W.offsetHeight)??30,T=R.top-Z,N=window.innerHeight-R.bottom-Z,M=R.left-Z,Y=window.innerWidth-R.right-Z;let F=a;if(a==="top"&&T<v&&N>T?F="bottom":a==="bottom"&&N<v&&T>N?F="top":a==="left"&&M<E&&Y>M?F="right":a==="right"&&Y<E&&M>Y&&(F="left"),b(F),c){let _,D;switch(F){case"top":_=R.top-v-Z,D=R.left+R.width/2-E/2;break;case"bottom":_=R.bottom+Z,D=R.left+R.width/2-E/2;break;case"left":_=R.top+R.height/2-v/2,D=R.left-E-Z;break;case"right":_=R.top+R.height/2-v/2,D=R.right+Z;break;default:_=0,D=0}const q=8;D=Math.max(q,Math.min(D,window.innerWidth-E-q)),_=Math.max(q,Math.min(_,window.innerHeight-v-q)),m({top:_,left:D})}},[a,c]);u.useLayoutEffect(()=>{g&&k()},[g,k]);const z=()=>{const R=setTimeout(()=>{h(!0)},l);f(R)},j=()=>{y&&(clearTimeout(y),f(null)),h(!1)},L=c?De.createPortal(i.jsx(ld,{ref:w,className:Me("content",o==null?void 0:o.content),$placement:S,$variant:p,$visible:g,style:{top:$.top,left:$.left},children:r}),c):i.jsx(id,{ref:w,className:Me("content",o==null?void 0:o.content),$placement:S,$variant:p,$visible:g,children:r});return i.jsxs(rd,{...x,ref:R=>{O.current=R,typeof s=="function"?s(R):s&&(s.current=R)},className:Me("wrapper",t),onMouseEnter:z,onMouseLeave:j,children:[e,L]})},dd=d.styled.div`
|
|
2151
2164
|
display: inline-flex;
|
|
2152
2165
|
align-items: center;
|
|
2153
2166
|
gap: 12px;
|
|
2154
2167
|
flex-direction: ${({$reverse:e})=>e?"row-reverse":"row"};
|
|
2155
|
-
`,
|
|
2168
|
+
`,sd=d.styled.div`
|
|
2156
2169
|
display: flex;
|
|
2157
2170
|
flex-direction: column;
|
|
2158
2171
|
text-align: ${({$align:e})=>e};
|
|
2159
|
-
`,
|
|
2172
|
+
`,cd=d.styled.span`
|
|
2160
2173
|
font-size: 14px;
|
|
2161
2174
|
font-weight: 600;
|
|
2162
2175
|
line-height: 1.4;
|
|
2163
|
-
`,
|
|
2176
|
+
`,pd=d.styled.span`
|
|
2164
2177
|
font-size: 12px;
|
|
2165
2178
|
color: #666;
|
|
2166
2179
|
line-height: 1.4;
|
|
2167
|
-
`,Ce=C.newClassNameGetter("user"),
|
|
2180
|
+
`,Ce=C.newClassNameGetter("user"),ud=({avatarPosition:e="left",avatarProps:t,className:o,classnames:r,description:l,name:a,ref:c,src:s,...p})=>{const x=e==="right";return i.jsxs(dd,{...p,ref:c,className:Ce("container",o),$reverse:x,children:[i.jsx(xt,{size:"sm",...t,name:typeof a=="string"?a:void 0,src:s??(t==null?void 0:t.src),className:Ce("avatar",r==null?void 0:r.avatar)}),i.jsxs(sd,{$align:x?"right":"left",children:[i.jsx(cd,{className:Ce("name",r==null?void 0:r.name),children:a}),l&&i.jsx(pd,{className:Ce("description",r==null?void 0:r.description),children:l})]})]})};exports.BREAKPOINTS=n.BREAKPOINTS;exports.COLORS=n.COLORS;exports.KEYFRAMES=n.KEYFRAMES;exports.KEY_SYMBOLS=n.KEY_SYMBOLS;exports.alpha=n.alpha;exports.getBrowser=n.getBrowser;exports.getKeySymbols=n.getKeySymbols;exports.getOperatingSystem=n.getOperatingSystem;exports.isValid=n.isValid;exports.toHEX=n.toHEX;exports.useKeyBinding=n.useKeyBinding;exports.mediaBetween=X.mediaBetween;exports.mediaDown=X.mediaDown;exports.mediaUp=X.mediaUp;exports.validation=X.index;exports.Autocomplete=d.Autocomplete;exports.Button=d.Button;exports.Checkbox=d.Checkbox;exports.CheckboxCard=d.CheckboxCard;exports.CheckboxGroup=d.CheckboxGroup;exports.Chip=d.Chip;exports.DatePicker=d.DatePicker;exports.FieldLabel=d.FieldLabel;exports.FieldMessage=d.FieldMessage;exports.Input=d.Input;exports.KeySymbol=d.KeySymbol;exports.KeysBindings=d.KeysBindings;exports.Modal=d.Modal;exports.MultiSelect=d.MultiSelect;exports.OtpCode=d.OtpCode;exports.Radio=d.Radio;exports.RadioCard=d.RadioCard;exports.RadioGroup=d.RadioGroup;exports.Select=d.Select;exports.Spinner=d.Spinner;exports.Tags=d.Tags;exports.Textarea=d.Textarea;exports.Toggle=d.Toggle;exports.ToggleCard=d.ToggleCard;exports.ToggleGroup=d.ToggleGroup;exports.formatDateGo=d.formatDateGo;exports.newClassNameGetter=C.newClassNameGetter;exports.Accordion=Ft;exports.Alert=Wt;exports.Avatar=xt;exports.AvatarGroup=to;exports.Badge=ao;exports.BreadcrumbItem=so;exports.Breadcrumbs=fo;exports.Card=wo;exports.CardBody=Co;exports.CardFooter=Lo;exports.CardHeader=jo;exports.ConfirmationProvider=Go;exports.Container=Uo;exports.DateRange=Vo;exports.Divider=Jo;exports.Drawer=nr;exports.Dropdown=cr;exports.EmptyState=$r;exports.FieldRow=Or;exports.FileUpload=Ur;exports.FileUploadItem=Vr;exports.GlobalStyle=Et;exports.Hashtag=tn;exports.Heading=nn;exports.ImageCropper=ui;exports.MenuButton=hi;exports.NotificationProvider=Ci;exports.NotifyConfirmationProvider=Bi;exports.Overline=Gi;exports.Pagination=ll;exports.Panel=gl;exports.PendingScreen=Pl;exports.Progress=Fl;exports.SaveProgressProvider=Gl;exports.ShellScreen=Ji;exports.Skeleton=Ql;exports.SplitFlapText=vt;exports.Stat=oa;exports.StepLog=ma;exports.Stepper=ka;exports.Tabs=za;exports.Timeline=Ya;exports.ToastProvider=Ja;exports.Tooltip=ad;exports.User=ud;exports.formatFileSize=bt;exports.useConfirmation=Yo;exports.useImageCropper=mt;exports.useNotification=Ri;exports.useNotifyConfirmation=Mi;exports.useSaveProgress=Yl;exports.useToastr=ed;
|
|
2168
2181
|
//# sourceMappingURL=index.cjs.map
|