@billgangcom/theme-lib 1.81.1 → 1.81.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder.cjs.js +7 -7
- package/dist/builder.es.js +230 -229
- package/dist/{index-P2YlD50J.cjs → index-CTVVukDo.cjs} +1 -1
- package/dist/{index-CS7KRYlL.js → index-eH02UZ01.js} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/ui.cjs.js +1 -1
- package/dist/ui.es.js +2 -2
- package/package.json +1 -1
|
@@ -70,7 +70,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
70
70
|
To pick up a draggable item, press the space bar.
|
|
71
71
|
While dragging, use the arrow keys to move the item.
|
|
72
72
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
73
|
-
`},XI={onDragStart(t){let{active:n}=t;return"Picked up draggable item "+n.id+"."},onDragOver(t){let{active:n,over:o}=t;return o?"Draggable item "+n.id+" was moved over droppable area "+o.id+".":"Draggable item "+n.id+" is no longer over a droppable area."},onDragEnd(t){let{active:n,over:o}=t;return o?"Draggable item "+n.id+" was dropped over droppable area "+o.id:"Draggable item "+n.id+" was dropped."},onDragCancel(t){let{active:n}=t;return"Dragging was cancelled. Draggable item "+n.id+" was dropped."}};function KI(t){let{announcements:n=XI,container:o,hiddenTextDescribedById:r,screenReaderInstructions:a=YI}=t;const{announce:i,announcement:c}=ZI(),l=jr("DndLiveRegion"),[u,d]=y.useState(!1);if(y.useEffect(()=>{d(!0)},[]),GI(y.useMemo(()=>({onDragStart(f){let{active:m}=f;i(n.onDragStart({active:m}))},onDragMove(f){let{active:m,over:g}=f;n.onDragMove&&i(n.onDragMove({active:m,over:g}))},onDragOver(f){let{active:m,over:g}=f;i(n.onDragOver({active:m,over:g}))},onDragEnd(f){let{active:m,over:g}=f;i(n.onDragEnd({active:m,over:g}))},onDragCancel(f){let{active:m,over:g}=f;i(n.onDragCancel({active:m,over:g}))}}),[i,n])),!u)return null;const h=y.createElement(y.Fragment,null,y.createElement(WI,{id:r,value:a.draggable}),y.createElement(qI,{id:l,announcement:c}));return o?Io.createPortal(h,o):h}var pt;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(pt||(pt={}));function Ea(){}function Hu(t,n){return y.useMemo(()=>({sensor:t,options:n??{}}),[t,n])}function Vu(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return y.useMemo(()=>[...n].filter(r=>r!=null),[...n])}const gn=Object.freeze({x:0,y:0});function JI(t,n){let{data:{value:o}}=t,{data:{value:r}}=n;return r-o}function QI(t,n){if(!t||t.length===0)return null;const[o]=t;return o[n]}function e2(t,n){const o=Math.max(n.top,t.top),r=Math.max(n.left,t.left),a=Math.min(n.left+n.width,t.left+t.width),i=Math.min(n.top+n.height,t.top+t.height),c=a-r,l=i-o;if(r<a&&o<i){const u=n.width*n.height,d=t.width*t.height,h=c*l,f=h/(u+d-h);return Number(f.toFixed(4))}return 0}const t2=t=>{let{collisionRect:n,droppableRects:o,droppableContainers:r}=t;const a=[];for(const i of r){const{id:c}=i,l=o.get(c);if(l){const u=e2(l,n);u>0&&a.push({id:c,data:{droppableContainer:i,value:u}})}}return a.sort(JI)};function n2(t,n,o){return{...t,scaleX:n&&o?n.width/o.width:1,scaleY:n&&o?n.height/o.height:1}}function Uu(t,n){return t&&n?{x:t.left-n.left,y:t.top-n.top}:gn}function o2(t){return function(o){for(var r=arguments.length,a=new Array(r>1?r-1:0),i=1;i<r;i++)a[i-1]=arguments[i];return a.reduce((c,l)=>({...c,top:c.top+t*l.y,bottom:c.bottom+t*l.y,left:c.left+t*l.x,right:c.right+t*l.x}),{...o})}}const r2=o2(1);function a2(t){if(t.startsWith("matrix3d(")){const n=t.slice(9,-1).split(/, /);return{x:+n[12],y:+n[13],scaleX:+n[0],scaleY:+n[5]}}else if(t.startsWith("matrix(")){const n=t.slice(7,-1).split(/, /);return{x:+n[4],y:+n[5],scaleX:+n[0],scaleY:+n[3]}}return null}function i2(t,n,o){const r=a2(n);if(!r)return t;const{scaleX:a,scaleY:i,x:c,y:l}=r,u=t.left-c-(1-a)*parseFloat(o),d=t.top-l-(1-i)*parseFloat(o.slice(o.indexOf(" ")+1)),h=a?t.width/a:t.width,f=i?t.height/i:t.height;return{width:h,height:f,top:d,right:u+h,bottom:d+f,left:u}}const s2={ignoreTransform:!1};function zo(t,n){n===void 0&&(n=s2);let o=t.getBoundingClientRect();if(n.ignoreTransform){const{transform:d,transformOrigin:h}=Yt(t).getComputedStyle(t);d&&(o=i2(o,d,h))}const{top:r,left:a,width:i,height:c,bottom:l,right:u}=o;return{top:r,left:a,width:i,height:c,bottom:l,right:u}}function Yc(t){return zo(t,{ignoreTransform:!0})}function c2(t){const n=t.innerWidth,o=t.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}function l2(t,n){return n===void 0&&(n=Yt(t).getComputedStyle(t)),n.position==="fixed"}function u2(t,n){n===void 0&&(n=Yt(t).getComputedStyle(t));const o=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const i=n[a];return typeof i=="string"?o.test(i):!1})}function Ns(t,n){const o=[];function r(a){if(n!=null&&o.length>=n||!a)return o;if(Rs(a)&&a.scrollingElement!=null&&!o.includes(a.scrollingElement))return o.push(a.scrollingElement),o;if(!Br(a)||Fu(a)||o.includes(a))return o;const i=Yt(t).getComputedStyle(a);return a!==t&&u2(a,i)&&o.push(a),l2(a,i)?o:r(a.parentNode)}return t?r(t):o}function $u(t){const[n]=Ns(t,1);return n??null}function Si(t){return!za||!t?null:Zo(t)?t:Es(t)?Rs(t)||t===Go(t).scrollingElement?window:Br(t)?t:null:null}function Wu(t){return Zo(t)?t.scrollX:t.scrollLeft}function qu(t){return Zo(t)?t.scrollY:t.scrollTop}function es(t){return{x:Wu(t),y:qu(t)}}var bt;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(bt||(bt={}));function Zu(t){return!za||!t?!1:t===document.scrollingElement}function Gu(t){const n={x:0,y:0},o=Zu(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-o.width,y:t.scrollHeight-o.height},a=t.scrollTop<=n.y,i=t.scrollLeft<=n.x,c=t.scrollTop>=r.y,l=t.scrollLeft>=r.x;return{isTop:a,isLeft:i,isBottom:c,isRight:l,maxScroll:r,minScroll:n}}const d2={x:.2,y:.2};function h2(t,n,o,r,a){let{top:i,left:c,right:l,bottom:u}=o;r===void 0&&(r=10),a===void 0&&(a=d2);const{isTop:d,isBottom:h,isLeft:f,isRight:m}=Gu(t),g={x:0,y:0},I={x:0,y:0},p={height:n.height*a.y,width:n.width*a.x};return!d&&i<=n.top+p.height?(g.y=bt.Backward,I.y=r*Math.abs((n.top+p.height-i)/p.height)):!h&&u>=n.bottom-p.height&&(g.y=bt.Forward,I.y=r*Math.abs((n.bottom-p.height-u)/p.height)),!m&&l>=n.right-p.width?(g.x=bt.Forward,I.x=r*Math.abs((n.right-p.width-l)/p.width)):!f&&c<=n.left+p.width&&(g.x=bt.Backward,I.x=r*Math.abs((n.left+p.width-c)/p.width)),{direction:g,speed:I}}function f2(t){if(t===document.scrollingElement){const{innerWidth:i,innerHeight:c}=window;return{top:0,left:0,right:i,bottom:c,width:i,height:c}}const{top:n,left:o,right:r,bottom:a}=t.getBoundingClientRect();return{top:n,left:o,right:r,bottom:a,width:t.clientWidth,height:t.clientHeight}}function zu(t){return t.reduce((n,o)=>Oo(n,es(o)),gn)}function p2(t){return t.reduce((n,o)=>n+Wu(o),0)}function m2(t){return t.reduce((n,o)=>n+qu(o),0)}function g2(t,n){if(n===void 0&&(n=zo),!t)return;const{top:o,left:r,bottom:a,right:i}=n(t);$u(t)&&(a<=0||i<=0||o>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const I2=[["x",["left","right"],p2],["y",["top","bottom"],m2]];class Bs{constructor(n,o){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Ns(o),a=zu(r);this.rect={...n},this.width=n.width,this.height=n.height;for(const[i,c,l]of I2)for(const u of c)Object.defineProperty(this,u,{get:()=>{const d=l(r),h=a[i]-d;return this.rect[u]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ir{constructor(n){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(o=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...o)})},this.target=n}add(n,o,r){var a;(a=this.target)==null||a.addEventListener(n,o,r),this.listeners.push([n,o,r])}}function C2(t){const{EventTarget:n}=Yt(t);return t instanceof n?t:Go(t)}function yi(t,n){const o=Math.abs(t.x),r=Math.abs(t.y);return typeof n=="number"?Math.sqrt(o**2+r**2)>n:"x"in n&&"y"in n?o>n.x&&r>n.y:"x"in n?o>n.x:"y"in n?r>n.y:!1}var sn;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(sn||(sn={}));function Xc(t){t.preventDefault()}function S2(t){t.stopPropagation()}var Ee;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(Ee||(Ee={}));const Yu={start:[Ee.Space,Ee.Enter],cancel:[Ee.Esc],end:[Ee.Space,Ee.Enter,Ee.Tab]},y2=(t,n)=>{let{currentCoordinates:o}=n;switch(t.code){case Ee.Right:return{...o,x:o.x+25};case Ee.Left:return{...o,x:o.x-25};case Ee.Down:return{...o,y:o.y+25};case Ee.Up:return{...o,y:o.y-25}}};class Xu{constructor(n){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=n;const{event:{target:o}}=n;this.props=n,this.listeners=new Ir(Go(o)),this.windowListeners=new Ir(Yt(o)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(sn.Resize,this.handleCancel),this.windowListeners.add(sn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(sn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:n,onStart:o}=this.props,r=n.node.current;r&&g2(r),o(gn)}handleKeyDown(n){if(Ms(n)){const{active:o,context:r,options:a}=this.props,{keyboardCodes:i=Yu,coordinateGetter:c=y2,scrollBehavior:l="smooth"}=a,{code:u}=n;if(i.end.includes(u)){this.handleEnd(n);return}if(i.cancel.includes(u)){this.handleCancel(n);return}const{collisionRect:d}=r.current,h=d?{x:d.left,y:d.top}:gn;this.referenceCoordinates||(this.referenceCoordinates=h);const f=c(n,{active:o,context:r.current,currentCoordinates:h});if(f){const m=Aa(f,h),g={x:0,y:0},{scrollableAncestors:I}=r.current;for(const p of I){const C=n.code,{isTop:b,isRight:S,isLeft:x,isBottom:T,maxScroll:_,minScroll:R}=Gu(p),v=f2(p),P={x:Math.min(C===Ee.Right?v.right-v.width/2:v.right,Math.max(C===Ee.Right?v.left:v.left+v.width/2,f.x)),y:Math.min(C===Ee.Down?v.bottom-v.height/2:v.bottom,Math.max(C===Ee.Down?v.top:v.top+v.height/2,f.y))},N=C===Ee.Right&&!S||C===Ee.Left&&!x,M=C===Ee.Down&&!T||C===Ee.Up&&!b;if(N&&P.x!==f.x){const W=p.scrollLeft+m.x,j=C===Ee.Right&&W<=_.x||C===Ee.Left&&W>=R.x;if(j&&!m.y){p.scrollTo({left:W,behavior:l});return}j?g.x=p.scrollLeft-W:g.x=C===Ee.Right?p.scrollLeft-_.x:p.scrollLeft-R.x,g.x&&p.scrollBy({left:-g.x,behavior:l});break}else if(M&&P.y!==f.y){const W=p.scrollTop+m.y,j=C===Ee.Down&&W<=_.y||C===Ee.Up&&W>=R.y;if(j&&!m.x){p.scrollTo({top:W,behavior:l});return}j?g.y=p.scrollTop-W:g.y=C===Ee.Down?p.scrollTop-_.y:p.scrollTop-R.y,g.y&&p.scrollBy({top:-g.y,behavior:l});break}}this.handleMove(n,Oo(Aa(f,this.referenceCoordinates),g))}}}handleMove(n,o){const{onMove:r}=this.props;n.preventDefault(),r(o)}handleEnd(n){const{onEnd:o}=this.props;n.preventDefault(),this.detach(),o()}handleCancel(n){const{onCancel:o}=this.props;n.preventDefault(),this.detach(),o()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Xu.activators=[{eventName:"onKeyDown",handler:(t,n,o)=>{let{keyboardCodes:r=Yu,onActivation:a}=n,{active:i}=o;const{code:c}=t.nativeEvent;if(r.start.includes(c)){const l=i.activatorNode.current;return l&&t.target!==l?!1:(t.preventDefault(),a==null||a({event:t.nativeEvent}),!0)}return!1}}];function Kc(t){return!!(t&&"distance"in t)}function Jc(t){return!!(t&&"delay"in t)}class Fs{constructor(n,o,r){var a;r===void 0&&(r=C2(n.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=n,this.events=o;const{event:i}=n,{target:c}=i;this.props=n,this.events=o,this.document=Go(c),this.documentListeners=new Ir(this.document),this.listeners=new Ir(r),this.windowListeners=new Ir(Yt(c)),this.initialCoordinates=(a=Qi(i))!=null?a:gn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:n,props:{options:{activationConstraint:o,bypassActivationConstraint:r}}}=this;if(this.listeners.add(n.move.name,this.handleMove,{passive:!1}),this.listeners.add(n.end.name,this.handleEnd),n.cancel&&this.listeners.add(n.cancel.name,this.handleCancel),this.windowListeners.add(sn.Resize,this.handleCancel),this.windowListeners.add(sn.DragStart,Xc),this.windowListeners.add(sn.VisibilityChange,this.handleCancel),this.windowListeners.add(sn.ContextMenu,Xc),this.documentListeners.add(sn.Keydown,this.handleKeydown),o){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Jc(o)){this.timeoutId=setTimeout(this.handleStart,o.delay),this.handlePending(o);return}if(Kc(o)){this.handlePending(o);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(n,o){const{active:r,onPending:a}=this.props;a(r,n,this.initialCoordinates,o)}handleStart(){const{initialCoordinates:n}=this,{onStart:o}=this.props;n&&(this.activated=!0,this.documentListeners.add(sn.Click,S2,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(sn.SelectionChange,this.removeTextSelection),o(n))}handleMove(n){var o;const{activated:r,initialCoordinates:a,props:i}=this,{onMove:c,options:{activationConstraint:l}}=i;if(!a)return;const u=(o=Qi(n))!=null?o:gn,d=Aa(a,u);if(!r&&l){if(Kc(l)){if(l.tolerance!=null&&yi(d,l.tolerance))return this.handleCancel();if(yi(d,l.distance))return this.handleStart()}if(Jc(l)&&yi(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}n.cancelable&&n.preventDefault(),c(u)}handleEnd(){const{onAbort:n,onEnd:o}=this.props;this.detach(),this.activated||n(this.props.active),o()}handleCancel(){const{onAbort:n,onCancel:o}=this.props;this.detach(),this.activated||n(this.props.active),o()}handleKeydown(n){n.code===Ee.Esc&&this.handleCancel()}removeTextSelection(){var n;(n=this.document.getSelection())==null||n.removeAllRanges()}}const v2={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Ya extends Fs{constructor(n){const{event:o}=n,r=Go(o.target);super(n,v2,r)}}Ya.activators=[{eventName:"onPointerDown",handler:(t,n)=>{let{nativeEvent:o}=t,{onActivation:r}=n;return!o.isPrimary||o.button!==0?!1:(r==null||r({event:o}),!0)}}];const b2={move:{name:"mousemove"},end:{name:"mouseup"}};var ts;(function(t){t[t.RightClick=2]="RightClick"})(ts||(ts={}));class w2 extends Fs{constructor(n){super(n,b2,Go(n.event.target))}}w2.activators=[{eventName:"onMouseDown",handler:(t,n)=>{let{nativeEvent:o}=t,{onActivation:r}=n;return o.button===ts.RightClick?!1:(r==null||r({event:o}),!0)}}];const vi={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class x2 extends Fs{constructor(n){super(n,vi)}static setup(){return window.addEventListener(vi.move.name,n,{capture:!1,passive:!1}),function(){window.removeEventListener(vi.move.name,n)};function n(){}}}x2.activators=[{eventName:"onTouchStart",handler:(t,n)=>{let{nativeEvent:o}=t,{onActivation:r}=n;const{touches:a}=o;return a.length>1?!1:(r==null||r({event:o}),!0)}}];var Cr;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Cr||(Cr={}));var Ra;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ra||(Ra={}));function _2(t){let{acceleration:n,activator:o=Cr.Pointer,canScroll:r,draggingRect:a,enabled:i,interval:c=5,order:l=Ra.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:h,delta:f,threshold:m}=t;const g=k2({delta:f,disabled:!i}),[I,p]=OI(),C=y.useRef({x:0,y:0}),b=y.useRef({x:0,y:0}),S=y.useMemo(()=>{switch(o){case Cr.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case Cr.DraggableRect:return a}},[o,a,u]),x=y.useRef(null),T=y.useCallback(()=>{const R=x.current;if(!R)return;const v=C.current.x*b.current.x,P=C.current.y*b.current.y;R.scrollBy(v,P)},[]),_=y.useMemo(()=>l===Ra.TreeOrder?[...d].reverse():d,[l,d]);y.useEffect(()=>{if(!i||!d.length||!S){p();return}for(const R of _){if((r==null?void 0:r(R))===!1)continue;const v=d.indexOf(R),P=h[v];if(!P)continue;const{direction:N,speed:M}=h2(R,P,S,n,m);for(const W of["x","y"])g[W][N[W]]||(M[W]=0,N[W]=0);if(M.x>0||M.y>0){p(),x.current=R,I(T,c),C.current=M,b.current=N;return}}C.current={x:0,y:0},b.current={x:0,y:0},p()},[n,T,r,p,i,c,JSON.stringify(S),JSON.stringify(g),I,d,_,h,JSON.stringify(m)])}const T2={x:{[bt.Backward]:!1,[bt.Forward]:!1},y:{[bt.Backward]:!1,[bt.Forward]:!1}};function k2(t){let{delta:n,disabled:o}=t;const r=Ji(n);return Fr(a=>{if(o||!r||!a)return T2;const i={x:Math.sign(n.x-r.x),y:Math.sign(n.y-r.y)};return{x:{[bt.Backward]:a.x[bt.Backward]||i.x===-1,[bt.Forward]:a.x[bt.Forward]||i.x===1},y:{[bt.Backward]:a.y[bt.Backward]||i.y===-1,[bt.Forward]:a.y[bt.Forward]||i.y===1}}},[o,n,r])}function P2(t,n){const o=n!=null?t.get(n):void 0,r=o?o.node.current:null;return Fr(a=>{var i;return n==null?null:(i=r??a)!=null?i:null},[r,n])}function L2(t,n){return y.useMemo(()=>t.reduce((o,r)=>{const{sensor:a}=r,i=a.activators.map(c=>({eventName:c.eventName,handler:n(c.handler,r)}));return[...o,...i]},[]),[t,n])}var kr;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(kr||(kr={}));var ns;(function(t){t.Optimized="optimized"})(ns||(ns={}));const Qc=new Map;function A2(t,n){let{dragging:o,dependencies:r,config:a}=n;const[i,c]=y.useState(null),{frequency:l,measure:u,strategy:d}=a,h=y.useRef(t),f=C(),m=Tr(f),g=y.useCallback(function(b){b===void 0&&(b=[]),!m.current&&c(S=>S===null?b:S.concat(b.filter(x=>!S.includes(x))))},[m]),I=y.useRef(null),p=Fr(b=>{if(f&&!o)return Qc;if(!b||b===Qc||h.current!==t||i!=null){const S=new Map;for(let x of t){if(!x)continue;if(i&&i.length>0&&!i.includes(x.id)&&x.rect.current){S.set(x.id,x.rect.current);continue}const T=x.node.current,_=T?new Bs(u(T),T):null;x.rect.current=_,_&&S.set(x.id,_)}return S}return b},[t,i,o,f,u]);return y.useEffect(()=>{h.current=t},[t]),y.useEffect(()=>{f||g()},[o,f]),y.useEffect(()=>{i&&i.length>0&&c(null)},[JSON.stringify(i)]),y.useEffect(()=>{f||typeof l!="number"||I.current!==null||(I.current=setTimeout(()=>{g(),I.current=null},l))},[l,f,g,...r]),{droppableRects:p,measureDroppableContainers:g,measuringScheduled:i!=null};function C(){switch(d){case kr.Always:return!1;case kr.BeforeDragging:return o;default:return!o}}}function Ku(t,n){return Fr(o=>t?o||(typeof n=="function"?n(t):t):null,[n,t])}function E2(t,n){return Ku(t,n)}function R2(t){let{callback:n,disabled:o}=t;const r=Ds(n),a=y.useMemo(()=>{if(o||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,o]);return y.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function Xa(t){let{callback:n,disabled:o}=t;const r=Ds(n),a=y.useMemo(()=>{if(o||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[o]);return y.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function D2(t){return new Bs(zo(t),t)}function el(t,n,o){n===void 0&&(n=D2);const[r,a]=y.useState(null);function i(){a(u=>{if(!t)return null;if(t.isConnected===!1){var d;return(d=u??o)!=null?d:null}const h=n(t);return JSON.stringify(u)===JSON.stringify(h)?u:h})}const c=R2({callback(u){if(t)for(const d of u){const{type:h,target:f}=d;if(h==="childList"&&f instanceof HTMLElement&&f.contains(t)){i();break}}}}),l=Xa({callback:i});return En(()=>{i(),t?(l==null||l.observe(t),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),c==null||c.disconnect())},[t]),r}function M2(t){const n=Ku(t);return Uu(t,n)}const tl=[];function N2(t){const n=y.useRef(t),o=Fr(r=>t?r&&r!==tl&&t&&n.current&&t.parentNode===n.current.parentNode?r:Ns(t):tl,[t]);return y.useEffect(()=>{n.current=t},[t]),o}function B2(t){const[n,o]=y.useState(null),r=y.useRef(t),a=y.useCallback(i=>{const c=Si(i.target);c&&o(l=>l?(l.set(c,es(c)),new Map(l)):null)},[]);return y.useEffect(()=>{const i=r.current;if(t!==i){c(i);const l=t.map(u=>{const d=Si(u);return d?(d.addEventListener("scroll",a,{passive:!0}),[d,es(d)]):null}).filter(u=>u!=null);o(l.length?new Map(l):null),r.current=t}return()=>{c(t),c(i)};function c(l){l.forEach(u=>{const d=Si(u);d==null||d.removeEventListener("scroll",a)})}},[a,t]),y.useMemo(()=>t.length?n?Array.from(n.values()).reduce((i,c)=>Oo(i,c),gn):zu(t):gn,[t,n])}function nl(t,n){n===void 0&&(n=[]);const o=y.useRef(null);return y.useEffect(()=>{o.current=null},n),y.useEffect(()=>{const r=t!==gn;r&&!o.current&&(o.current=t),!r&&o.current&&(o.current=null)},[t]),o.current?Aa(t,o.current):gn}function F2(t){y.useEffect(()=>{if(!za)return;const n=t.map(o=>{let{sensor:r}=o;return r.setup==null?void 0:r.setup()});return()=>{for(const o of n)o==null||o()}},t.map(n=>{let{sensor:o}=n;return o}))}function j2(t,n){return y.useMemo(()=>t.reduce((o,r)=>{let{eventName:a,handler:i}=r;return o[a]=c=>{i(c,n)},o},{}),[t,n])}function Ju(t){return y.useMemo(()=>t?c2(t):null,[t])}const ol=[];function O2(t,n){n===void 0&&(n=zo);const[o]=t,r=Ju(o?Yt(o):null),[a,i]=y.useState(ol);function c(){i(()=>t.length?t.map(u=>Zu(u)?r:new Bs(n(u),u)):ol)}const l=Xa({callback:c});return En(()=>{l==null||l.disconnect(),c(),t.forEach(u=>l==null?void 0:l.observe(u))},[t]),a}function H2(t){if(!t)return null;if(t.children.length>1)return t;const n=t.children[0];return Br(n)?n:t}function V2(t){let{measure:n}=t;const[o,r]=y.useState(null),a=y.useCallback(d=>{for(const{target:h}of d)if(Br(h)){r(f=>{const m=n(h);return f?{...f,width:m.width,height:m.height}:m});break}},[n]),i=Xa({callback:a}),c=y.useCallback(d=>{const h=H2(d);i==null||i.disconnect(),h&&(i==null||i.observe(h)),r(h?n(h):null)},[n,i]),[l,u]=La(c);return y.useMemo(()=>({nodeRef:l,rect:o,setRef:u}),[o,l,u])}const U2=[{sensor:Ya,options:{}},{sensor:Xu,options:{}}],$2={current:{}},Ia={draggable:{measure:Yc},droppable:{measure:Yc,strategy:kr.WhileDragging,frequency:ns.Optimized},dragOverlay:{measure:zo}};class Sr extends Map{get(n){var o;return n!=null&&(o=super.get(n))!=null?o:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(n=>{let{disabled:o}=n;return!o})}getNodeFor(n){var o,r;return(o=(r=this.get(n))==null?void 0:r.node.current)!=null?o:void 0}}const W2={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Sr,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ea},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ia,measureDroppableContainers:Ea,windowRect:null,measuringScheduled:!1},q2={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ea,draggableNodes:new Map,over:null,measureDroppableContainers:Ea},Ka=y.createContext(q2),Qu=y.createContext(W2);function Z2(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Sr}}}function G2(t,n){switch(n.type){case pt.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:n.initialCoordinates,active:n.active}};case pt.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:n.coordinates.x-t.draggable.initialCoordinates.x,y:n.coordinates.y-t.draggable.initialCoordinates.y}}};case pt.DragEnd:case pt.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case pt.RegisterDroppable:{const{element:o}=n,{id:r}=o,a=new Sr(t.droppable.containers);return a.set(r,o),{...t,droppable:{...t.droppable,containers:a}}}case pt.SetDroppableDisabled:{const{id:o,key:r,disabled:a}=n,i=t.droppable.containers.get(o);if(!i||r!==i.key)return t;const c=new Sr(t.droppable.containers);return c.set(o,{...i,disabled:a}),{...t,droppable:{...t.droppable,containers:c}}}case pt.UnregisterDroppable:{const{id:o,key:r}=n,a=t.droppable.containers.get(o);if(!a||r!==a.key)return t;const i=new Sr(t.droppable.containers);return i.delete(o),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function z2(t){let{disabled:n}=t;const{active:o,activatorEvent:r,draggableNodes:a}=y.useContext(Ka),i=Ji(r),c=Ji(o==null?void 0:o.id);return y.useEffect(()=>{if(!n&&!r&&i&&c!=null){if(!Ms(i)||document.activeElement===i.target)return;const l=a.get(c);if(!l)return;const{activatorNode:u,node:d}=l;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const h of[u.current,d.current]){if(!h)continue;const f=UI(h);if(f){f.focus();break}}})}},[r,n,a,c,i]),null}function Y2(t,n){let{transform:o,...r}=n;return t!=null&&t.length?t.reduce((a,i)=>i({transform:a,...r}),o):o}function X2(t){return y.useMemo(()=>({draggable:{...Ia.draggable,...t==null?void 0:t.draggable},droppable:{...Ia.droppable,...t==null?void 0:t.droppable},dragOverlay:{...Ia.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function K2(t){let{activeNode:n,measure:o,initialRect:r,config:a=!0}=t;const i=y.useRef(!1),{x:c,y:l}=typeof a=="boolean"?{x:a,y:a}:a;En(()=>{if(!c&&!l||!n){i.current=!1;return}if(i.current||!r)return;const d=n==null?void 0:n.node.current;if(!d||d.isConnected===!1)return;const h=o(d),f=Uu(h,r);if(c||(f.x=0),l||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const m=$u(d);m&&m.scrollBy({top:f.y,left:f.x})}},[n,c,l,r,o])}const ed=y.createContext({...gn,scaleX:1,scaleY:1});var Jn;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Jn||(Jn={}));const td=y.memo(function(n){var o,r,a,i;let{id:c,accessibility:l,autoScroll:u=!0,children:d,sensors:h=U2,collisionDetection:f=t2,measuring:m,modifiers:g,...I}=n;const p=y.useReducer(G2,void 0,Z2),[C,b]=p,[S,x]=zI(),[T,_]=y.useState(Jn.Uninitialized),R=T===Jn.Initialized,{draggable:{active:v,nodes:P,translate:N},droppable:{containers:M}}=C,W=v!=null?P.get(v):null,j=y.useRef({initial:null,translated:null}),G=y.useMemo(()=>{var Ue;return v!=null?{id:v,data:(Ue=W==null?void 0:W.data)!=null?Ue:$2,rect:j}:null},[v,W]),H=y.useRef(null),[ce,he]=y.useState(null),[me,Ce]=y.useState(null),ye=Tr(I,Object.values(I)),$=jr("DndDescribedBy",c),Y=y.useMemo(()=>M.getEnabled(),[M]),ne=X2(m),{droppableRects:oe,measureDroppableContainers:O,measuringScheduled:X}=A2(Y,{dragging:R,dependencies:[N.x,N.y],config:ne.droppable}),K=P2(P,v),ie=y.useMemo(()=>me?Qi(me):null,[me]),ue=Bn(),z=E2(K,ne.draggable.measure);K2({activeNode:v!=null?P.get(v):null,config:ue.layoutShiftCompensation,initialRect:z,measure:ne.draggable.measure});const J=el(K,ne.draggable.measure,z),ke=el(K?K.parentElement:null),V=y.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:oe,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),xe=M.getNodeFor((o=V.current.over)==null?void 0:o.id),le=V2({measure:ne.dragOverlay.measure}),de=(r=le.nodeRef.current)!=null?r:K,Pe=R?(a=le.rect)!=null?a:J:null,tt=!!(le.nodeRef.current&&le.rect),nt=M2(tt?null:J),Le=Ju(de?Yt(de):null),Oe=N2(R?xe??K:null),Xt=O2(Oe),qe=Y2(g,{transform:{x:N.x-nt.x,y:N.y-nt.y,scaleX:1,scaleY:1},activatorEvent:me,active:G,activeNodeRect:J,containerNodeRect:ke,draggingNodeRect:Pe,over:V.current.over,overlayNodeRect:le.rect,scrollableAncestors:Oe,scrollableAncestorRects:Xt,windowRect:Le}),Ht=ie?Oo(ie,N):null,Ze=B2(Oe),dt=nl(Ze),At=nl(Ze,[J]),Xe=Oo(qe,dt),ot=Pe?r2(Pe,qe):null,Ke=G&&ot?f({active:G,collisionRect:ot,droppableRects:oe,droppableContainers:Y,pointerCoordinates:Ht}):null,yn=QI(Ke,"id"),[wt,Yn]=y.useState(null),rt=tt?qe:Oo(qe,At),vn=n2(rt,(i=wt==null?void 0:wt.rect)!=null?i:null,J),bn=y.useRef(null),so=y.useCallback((Ue,gt)=>{let{sensor:It,options:Kt}=gt;if(H.current==null)return;const xt=P.get(H.current);if(!xt)return;const Je=Ue.nativeEvent,Ct=new It({active:H.current,activeNode:xt,event:Je,options:Kt,context:V,onAbort(Qe){if(!P.get(Qe))return;const{onDragAbort:L}=ye.current,D={id:Qe};L==null||L(D),S({type:"onDragAbort",event:D})},onPending(Qe,k,L,D){if(!P.get(Qe))return;const{onDragPending:ee}=ye.current,se={id:Qe,constraint:k,initialCoordinates:L,offset:D};ee==null||ee(se),S({type:"onDragPending",event:se})},onStart(Qe){const k=H.current;if(k==null)return;const L=P.get(k);if(!L)return;const{onDragStart:D}=ye.current,q={activatorEvent:Je,active:{id:k,data:L.data,rect:j}};Io.unstable_batchedUpdates(()=>{D==null||D(q),_(Jn.Initializing),b({type:pt.DragStart,initialCoordinates:Qe,active:k}),S({type:"onDragStart",event:q}),he(bn.current),Ce(Je)})},onMove(Qe){b({type:pt.DragMove,coordinates:Qe})},onEnd:wn(pt.DragEnd),onCancel:wn(pt.DragCancel)});bn.current=Ct;function wn(Qe){return async function(){const{active:L,collisions:D,over:q,scrollAdjustedTranslate:ee}=V.current;let se=null;if(L&&ee){const{cancelDrop:w}=ye.current;se={activatorEvent:Je,active:L,collisions:D,delta:ee,over:q},Qe===pt.DragEnd&&typeof w=="function"&&await Promise.resolve(w(se))&&(Qe=pt.DragCancel)}H.current=null,Io.unstable_batchedUpdates(()=>{b({type:Qe}),_(Jn.Uninitialized),Yn(null),he(null),Ce(null),bn.current=null;const w=Qe===pt.DragEnd?"onDragEnd":"onDragCancel";if(se){const A=ye.current[w];A==null||A(se),S({type:w,event:se})}})}}},[P]),Ko=y.useCallback((Ue,gt)=>(It,Kt)=>{const xt=It.nativeEvent,Je=P.get(Kt);if(H.current!==null||!Je||xt.dndKit||xt.defaultPrevented)return;const Ct={active:Je};Ue(It,gt.options,Ct)===!0&&(xt.dndKit={capturedBy:gt.sensor},H.current=Kt,so(It,gt))},[P,so]),Mn=L2(h,Ko);F2(h),En(()=>{J&&T===Jn.Initializing&&_(Jn.Initialized)},[J,T]),y.useEffect(()=>{const{onDragMove:Ue}=ye.current,{active:gt,activatorEvent:It,collisions:Kt,over:xt}=V.current;if(!gt||!It)return;const Je={active:gt,activatorEvent:It,collisions:Kt,delta:{x:Xe.x,y:Xe.y},over:xt};Io.unstable_batchedUpdates(()=>{Ue==null||Ue(Je),S({type:"onDragMove",event:Je})})},[Xe.x,Xe.y]),y.useEffect(()=>{const{active:Ue,activatorEvent:gt,collisions:It,droppableContainers:Kt,scrollAdjustedTranslate:xt}=V.current;if(!Ue||H.current==null||!gt||!xt)return;const{onDragOver:Je}=ye.current,Ct=Kt.get(yn),wn=Ct&&Ct.rect.current?{id:Ct.id,rect:Ct.rect.current,data:Ct.data,disabled:Ct.disabled}:null,Qe={active:Ue,activatorEvent:gt,collisions:It,delta:{x:xt.x,y:xt.y},over:wn};Io.unstable_batchedUpdates(()=>{Yn(wn),Je==null||Je(Qe),S({type:"onDragOver",event:Qe})})},[yn]),En(()=>{V.current={activatorEvent:me,active:G,activeNode:K,collisionRect:ot,collisions:Ke,droppableRects:oe,draggableNodes:P,draggingNode:de,draggingNodeRect:Pe,droppableContainers:M,over:wt,scrollableAncestors:Oe,scrollAdjustedTranslate:Xe},j.current={initial:Pe,translated:ot}},[G,K,Ke,ot,P,de,Pe,oe,M,wt,Oe,Xe]),_2({...ue,delta:N,draggingRect:ot,pointerCoordinates:Ht,scrollableAncestors:Oe,scrollableAncestorRects:Xt});const Nn=y.useMemo(()=>({active:G,activeNode:K,activeNodeRect:J,activatorEvent:me,collisions:Ke,containerNodeRect:ke,dragOverlay:le,draggableNodes:P,droppableContainers:M,droppableRects:oe,over:wt,measureDroppableContainers:O,scrollableAncestors:Oe,scrollableAncestorRects:Xt,measuringConfiguration:ne,measuringScheduled:X,windowRect:Le}),[G,K,J,me,Ke,ke,le,P,M,oe,wt,O,Oe,Xt,ne,X,Le]),hn=y.useMemo(()=>({activatorEvent:me,activators:Mn,active:G,activeNodeRect:J,ariaDescribedById:{draggable:$},dispatch:b,draggableNodes:P,over:wt,measureDroppableContainers:O}),[me,Mn,G,J,b,$,P,wt,O]);return y.createElement(Ou.Provider,{value:x},y.createElement(Ka.Provider,{value:hn},y.createElement(Qu.Provider,{value:Nn},y.createElement(ed.Provider,{value:vn},d)),y.createElement(z2,{disabled:(l==null?void 0:l.restoreFocus)===!1})),y.createElement(KI,{...l,hiddenTextDescribedById:$}));function Bn(){const Ue=(ce==null?void 0:ce.autoScrollEnabled)===!1,gt=typeof u=="object"?u.enabled===!1:u===!1,It=R&&!Ue&&!gt;return typeof u=="object"?{...u,enabled:It}:{enabled:It}}}),J2=y.createContext(null),rl="button",Q2="Draggable";function e4(t){let{id:n,data:o,disabled:r=!1,attributes:a}=t;const i=jr(Q2),{activators:c,activatorEvent:l,active:u,activeNodeRect:d,ariaDescribedById:h,draggableNodes:f,over:m}=y.useContext(Ka),{role:g=rl,roleDescription:I="draggable",tabIndex:p=0}=a??{},C=(u==null?void 0:u.id)===n,b=y.useContext(C?ed:J2),[S,x]=La(),[T,_]=La(),R=j2(c,n),v=Tr(o);En(()=>(f.set(n,{id:n,key:i,node:S,activatorNode:T,data:v}),()=>{const N=f.get(n);N&&N.key===i&&f.delete(n)}),[f,n]);const P=y.useMemo(()=>({role:g,tabIndex:p,"aria-disabled":r,"aria-pressed":C&&g===rl?!0:void 0,"aria-roledescription":I,"aria-describedby":h.draggable}),[r,g,p,C,I,h.draggable]);return{active:u,activatorEvent:l,activeNodeRect:d,attributes:P,isDragging:C,listeners:r?void 0:R,node:S,over:m,setNodeRef:x,setActivatorNodeRef:_,transform:b}}function t4(){return y.useContext(Qu)}const n4="Droppable",o4={timeout:25};function r4(t){let{data:n,disabled:o=!1,id:r,resizeObserverConfig:a}=t;const i=jr(n4),{active:c,dispatch:l,over:u,measureDroppableContainers:d}=y.useContext(Ka),h=y.useRef({disabled:o}),f=y.useRef(!1),m=y.useRef(null),g=y.useRef(null),{disabled:I,updateMeasurementsFor:p,timeout:C}={...o4,...a},b=Tr(p??r),S=y.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{d(Array.isArray(b.current)?b.current:[b.current]),g.current=null},C)},[C]),x=Xa({callback:S,disabled:I||!c}),T=y.useCallback((P,N)=>{x&&(N&&(x.unobserve(N),f.current=!1),P&&x.observe(P))},[x]),[_,R]=La(T),v=Tr(n);return y.useEffect(()=>{!x||!_.current||(x.disconnect(),f.current=!1,x.observe(_.current))},[_,x]),y.useEffect(()=>(l({type:pt.RegisterDroppable,element:{id:r,key:i,disabled:o,node:_,rect:m,data:v}}),()=>l({type:pt.UnregisterDroppable,key:i,id:r})),[r]),y.useEffect(()=>{o!==h.current.disabled&&(l({type:pt.SetDroppableDisabled,id:r,key:i,disabled:o}),h.current.disabled=o)},[r,i,o,l]),{active:c,rect:m,isOver:(u==null?void 0:u.id)===r,node:_,over:u,setNodeRef:R}}function nd(t,n,o){const r=t.slice();return r.splice(o<0?r.length+o:o,0,r.splice(n,1)[0]),r}function a4(t,n){return t.reduce((o,r,a)=>{const i=n.get(r);return i&&(o[a]=i),o},Array(t.length))}function Kr(t){return t!==null&&t>=0}function i4(t,n){if(t===n)return!0;if(t.length!==n.length)return!1;for(let o=0;o<t.length;o++)if(t[o]!==n[o])return!1;return!0}function s4(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const od=t=>{let{rects:n,activeIndex:o,overIndex:r,index:a}=t;const i=nd(n,r,o),c=n[a],l=i[a];return!l||!c?null:{x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height}},Jr={scaleX:1,scaleY:1},rd=t=>{var n;let{activeIndex:o,activeNodeRect:r,index:a,rects:i,overIndex:c}=t;const l=(n=i[o])!=null?n:r;if(!l)return null;if(a===o){const d=i[c];return d?{x:0,y:o<c?d.top+d.height-(l.top+l.height):d.top-l.top,...Jr}:null}const u=c4(i,a,o);return a>o&&a<=c?{x:0,y:-l.height-u,...Jr}:a<o&&a>=c?{x:0,y:l.height+u,...Jr}:{x:0,y:0,...Jr}};function c4(t,n,o){const r=t[n],a=t[n-1],i=t[n+1];return r?o<n?a?r.top-(a.top+a.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):a?r.top-(a.top+a.height):0:0}const ad="Sortable",id=y.createContext({activeIndex:-1,containerId:ad,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:od,disabled:{draggable:!1,droppable:!1}});function sd(t){let{children:n,id:o,items:r,strategy:a=od,disabled:i=!1}=t;const{active:c,dragOverlay:l,droppableRects:u,over:d,measureDroppableContainers:h}=t4(),f=jr(ad,o),m=l.rect!==null,g=y.useMemo(()=>r.map(R=>typeof R=="object"&&"id"in R?R.id:R),[r]),I=c!=null,p=c?g.indexOf(c.id):-1,C=d?g.indexOf(d.id):-1,b=y.useRef(g),S=!i4(g,b.current),x=C!==-1&&p===-1||S,T=s4(i);En(()=>{S&&I&&h(g)},[S,g,I,h]),y.useEffect(()=>{b.current=g},[g]);const _=y.useMemo(()=>({activeIndex:p,containerId:f,disabled:T,disableTransforms:x,items:g,overIndex:C,useDragOverlay:m,sortedRects:a4(g,u),strategy:a}),[p,f,T.draggable,T.droppable,x,g,C,u,m,a]);return y.createElement(id.Provider,{value:_},n)}const l4=t=>{let{id:n,items:o,activeIndex:r,overIndex:a}=t;return nd(o,r,a).indexOf(n)},u4=t=>{let{containerId:n,isSorting:o,wasDragging:r,index:a,items:i,newIndex:c,previousItems:l,previousContainerId:u,transition:d}=t;return!d||!r||l!==i&&a===c?!1:o?!0:c!==a&&n===u},d4={duration:200,easing:"ease"},cd="transform",h4=Vo.Transition.toString({property:cd,duration:0,easing:"linear"}),f4={roleDescription:"sortable"};function p4(t){let{disabled:n,index:o,node:r,rect:a}=t;const[i,c]=y.useState(null),l=y.useRef(o);return En(()=>{if(!n&&o!==l.current&&r.current){const u=a.current;if(u){const d=zo(r.current,{ignoreTransform:!0}),h={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(h.x||h.y)&&c(h)}}o!==l.current&&(l.current=o)},[n,o,r,a]),y.useEffect(()=>{i&&c(null)},[i]),i}function ld(t){let{animateLayoutChanges:n=u4,attributes:o,disabled:r,data:a,getNewIndex:i=l4,id:c,strategy:l,resizeObserverConfig:u,transition:d=d4}=t;const{items:h,containerId:f,activeIndex:m,disabled:g,disableTransforms:I,sortedRects:p,overIndex:C,useDragOverlay:b,strategy:S}=y.useContext(id),x=m4(r,g),T=h.indexOf(c),_=y.useMemo(()=>({sortable:{containerId:f,index:T,items:h},...a}),[f,a,T,h]),R=y.useMemo(()=>h.slice(h.indexOf(c)),[h,c]),{rect:v,node:P,isOver:N,setNodeRef:M}=r4({id:c,data:_,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...u}}),{active:W,activatorEvent:j,activeNodeRect:G,attributes:H,setNodeRef:ce,listeners:he,isDragging:me,over:Ce,setActivatorNodeRef:ye,transform:$}=e4({id:c,data:_,attributes:{...f4,...o},disabled:x.draggable}),Y=jI(M,ce),ne=!!W,oe=ne&&!I&&Kr(m)&&Kr(C),O=!b&&me,X=O&&oe?$:null,ie=oe?X??(l??S)({rects:p,activeNodeRect:G,activeIndex:m,overIndex:C,index:T}):null,ue=Kr(m)&&Kr(C)?i({id:c,items:h,activeIndex:m,overIndex:C}):T,z=W==null?void 0:W.id,J=y.useRef({activeId:z,items:h,newIndex:ue,containerId:f}),ke=h!==J.current.items,V=n({active:W,containerId:f,isDragging:me,isSorting:ne,id:c,index:T,items:h,newIndex:J.current.newIndex,previousItems:J.current.items,previousContainerId:J.current.containerId,transition:d,wasDragging:J.current.activeId!=null}),xe=p4({disabled:!V,index:T,node:P,rect:v});return y.useEffect(()=>{ne&&J.current.newIndex!==ue&&(J.current.newIndex=ue),f!==J.current.containerId&&(J.current.containerId=f),h!==J.current.items&&(J.current.items=h)},[ne,ue,f,h]),y.useEffect(()=>{if(z===J.current.activeId)return;if(z!=null&&J.current.activeId==null){J.current.activeId=z;return}const de=setTimeout(()=>{J.current.activeId=z},50);return()=>clearTimeout(de)},[z]),{active:W,activeIndex:m,attributes:H,data:_,rect:v,index:T,newIndex:ue,items:h,isOver:N,isSorting:ne,isDragging:me,listeners:he,node:P,overIndex:C,over:Ce,setNodeRef:Y,setActivatorNodeRef:ye,setDroppableNodeRef:M,setDraggableNodeRef:ce,transform:xe??ie,transition:le()};function le(){if(xe||ke&&J.current.newIndex===T)return h4;if(!(O&&!Ms(j)||!d)&&(ne||V))return Vo.Transition.toString({...d,property:cd})}}function m4(t,n){var o,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(o=t==null?void 0:t.draggable)!=null?o:n.draggable,droppable:(r=t==null?void 0:t.droppable)!=null?r:n.droppable}}Ee.Down,Ee.Right,Ee.Up,Ee.Left;function g4({product:t,children:n}){const{attributes:o,listeners:r,setNodeRef:a,transform:i,transition:c,isDragging:l}=ld({id:t.id}),u={transform:Vo.Transform.toString(i),transition:c};return s.jsx("div",{ref:a,style:u,className:`${et.product} ${l?et.dragging:""}`,...o,...r,children:n})}const ud=t=>{const{isActiveItems:n,setIsActiveItems:o,items:r,setItems:a,other:i,title:c,subtitle:l,editable:u=!0,draggable:d=!1,withImage:h=!1,deletable:f=!0,addable:m=!0,itemsType:g,itemsPlaceholder:I="",itemsOptions:p,hasRangeSelector:C=!1,rangeSelectorOptions:b,modalOptions:S,addableOptions:x={},limit:T,autoInterval:_,tip:R,aspectRatio:v,setAspectRatio:P}=t,[N,M]=y.useState(null),[W,j]=y.useState({top:0,left:0}),[G,H]=y.useState(null),ce=y.useRef(null),[he,me]=y.useState(!1),Ce=Vu(Hu(Ya,{activationConstraint:{distance:5}}));y.useEffect(()=>{if(N){const O=[...r].map(X=>X.id===N.id?N:X);a(O)}},[N]),y.useEffect(()=>{if(ce.current&&G){const O=ce.current.getBoundingClientRect().height,X=window.innerHeight;let K=G.top;K+O>X+window.scrollY-200&&(K=X+window.scrollY-O-200),K<0&&(K=10),j({top:K-30,left:G.left})}},[ce.current,G]);const ye=(O,X)=>{O.stopPropagation();const K=O.target.getBoundingClientRect();H({top:K.top+window.scrollY-70,left:K.left-(m?30:65)}),M(X),me(!0)},$=(O,X)=>{const K=[...r],ie={...O,id:Math.random().toString(36).substr(2,9)};K.splice(X+1,0,ie),a(K)};function Y(O){if(h)return O?s.jsx("img",{src:`https://imagedelivery.net/${O[0]}/w=1000`,alt:"image",width:16,height:16}):s.jsx(Z,{name:"Image",width:16,height:16,fill:"#757575"})}const ne=O=>{const{active:X,over:K}=O;if(K&&X.id!==K.id){const ie=r.findIndex(z=>z.id===X.id),ue=r.findIndex(z=>z.id===K.id);if(ie!==-1&&ue!==-1){const z=[...r],[J]=z.splice(ie,1);z.splice(ue,0,J),a(z)}}},oe=(O,X)=>{var ie,ue;const K=s.jsxs(s.Fragment,{children:[d&&s.jsx("div",{children:s.jsx(Z,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),g==="select"&&p&&s.jsx(oo,{onChange:z=>{const J=[...r],ke=p.find(xe=>xe.name["en-US"]===z);if(!ke)return;const V=J.map(xe=>xe.id===O.id?{...ke,name:{"en-US":z}}:xe);M({...O,name:{"en-US":z}}),a([...V])},value:O.name["en-US"],options:p.filter(z=>!r.find(J=>J.name["en-US"]===z.name["en-US"])).map(z=>z.name["en-US"]),leftAddonOptions:p.filter(z=>{var J;return((J=z.images)==null?void 0:J.length)>0}).map(z=>({value:z.name["en-US"],addon:Y(z.images)}))}),g==="selectInfiniteList"&&p&&s.jsx(ws,{onChange:z=>{const J=[...r],ke=p.find(xe=>xe.name["en-US"]===z);if(!ke)return;const V=J.map(xe=>xe.id===O.id?{...ke,name:{"en-US":z}}:xe);M({...O,name:{"en-US":z}}),a([...V])},value:O.name["en-US"],options:p.filter(z=>!r.find(J=>J.name["en-US"]===z.name["en-US"])).map(z=>z.name["en-US"]),leftAddonOptions:p.filter(z=>{var J;return((J=z.images)==null?void 0:J.length)>0}).map(z=>({value:z.name["en-US"],addon:Y(z.images)}))}),g==="input"&&s.jsx(ln,{onChange:z=>{const ke=[...r].map(V=>V.id===O.id?{...O,name:{"en-US":z}}:V);a([...ke])},value:O.name["en-US"],placeholder:I}),g==="image"&&s.jsx(Nr,{onChange:z=>{const ke=[...r].map(V=>V.id===O.id?{...O,images:z}:V);a([...ke])},activeImage:(ie=r.find(z=>z.id===O.id))!=null&&ie.images?(ue=r.find(z=>z.id===O.id))==null?void 0:ue.images[0]:void 0,tip:R}),s.jsxs("div",{className:et.buttons,children:[T&&T>r.length&&m&&s.jsx("div",{className:et.deleteButton,children:s.jsx(Z,{name:"Copy",hoverable:!0,width:20,height:20,onClick:()=>{$(O,X)}})}),u&&s.jsx("div",{className:et.deleteButton,children:s.jsx(Z,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:z=>{ye(z,O)}})}),f&&s.jsx("div",{className:et.deleteButton,children:s.jsx(Z,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(r.filter(z=>z.id!==O.id))})})]})]});return d?s.jsx(g4,{product:O,index:X,children:K},O.id):s.jsx("div",{className:et.product,children:K},O.id)};return s.jsxs("div",{className:et.productsBlock,children:[(c||n!==void 0)&&s.jsxs("div",{className:et.top,children:[c&&s.jsx("h3",{className:et.title,children:c}),n!==void 0&&s.jsx(Dn,{current:n,onChange:O=>o==null?void 0:o(O)})]}),N&&u&&S&&he&&s.jsx(MI,{ref:ce,activeItem:N,setActiveItem:M,popupPosition:W,modalOptions:S,setIsOpenModal:me}),(n===void 0||n)&&C&&b&&s.jsx(dd,{...b}),(n===void 0||n)&&s.jsxs("div",{className:et.products,children:[l&&s.jsx("h5",{className:et.subtitle,children:l}),d?s.jsx(td,{sensors:Ce,onDragEnd:ne,children:s.jsx(sd,{items:r.map(O=>O.id),strategy:rd,children:r.map((O,X)=>oe(O,X))})}):r.map((O,X)=>oe(O,X)),m&&s.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:s.jsx(Ho,{withoutHover:!0,className:te(et.button,{[et.disabled]:!!(T&&T<=r.length||r.length===(p==null?void 0:p.length))}),size:"s",disabled:!!(T&&T<=r.length||r.length===(p==null?void 0:p.length)),onClick:()=>{const O=[...r];let X=null;if(p){for(let K=0;K<p.length;K++)if(!r.find(ie=>ie.id===p[K].id)){X=p[K];break}}g==="select"&&p?O.push({name:X?X.name:p[0].name,id:(X==null?void 0:X.id)||p[0].id,...x}):g==="input"?O.push({name:{"en-US":""},id:ze(),...x}):O.push({name:{"en-US":`Image ${r.length+1}`},id:ze(),...x}),a(O)},style:{width:"fit-content"},children:s.jsxs("div",{className:et.addButton,children:[s.jsx("span",{children:"Add Option"}),s.jsx(Z,{name:"Plus",width:16,height:16})]})})})]}),v&&P&&s.jsx(oo,{value:v,label:"Aspect Ratio",options:Object.keys(Gl),onChange:O=>P(O),leftAddonOptions:zl}),(n===void 0||n)&&i!==void 0&&s.jsx(Bu,{otherTitle:"Other",items:i}),(n===void 0||n)&&_!==void 0&&s.jsx(ln,{label:_.title||"Auto scroll interval",type:"number",value:String(_.autoInterval),onChange:O=>_.setAutoInterval(Number(O)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},I4="_title_cx65i_1",C4="_subtitle_cx65i_5",S4="_productsBlock_cx65i_14",y4="_top_cx65i_26",v4="_products_cx65i_14",b4="_product_cx65i_14",w4="_button_cx65i_80",x4="_disabled_cx65i_91",_4="_buttons_cx65i_118",T4="_modal_cx65i_125",k4="_link_cx65i_146",P4="_modalOptions_cx65i_152",L4="_addButton_cx65i_165",A4="_deleteButton_cx65i_180",E4="_closeIcon_cx65i_192",fo={title:I4,subtitle:C4,productsBlock:S4,top:y4,products:v4,product:b4,button:w4,disabled:x4,buttons:_4,modal:T4,link:k4,modalOptions:P4,addButton:L4,deleteButton:A4,closeIcon:E4},R4=y.forwardRef((t,n)=>{const{activeItem:o,setActiveItem:r,popupPosition:a,modalOptions:i,setIsOpenModal:c}=t;return $o(n,()=>{r(null),c(!1)}),s.jsxs("div",{ref:n,className:fo.modal,onClick:l=>{l.stopPropagation()},style:{top:`${a.top}px`,left:`${a.left}px`},children:[s.jsxs("div",{className:fo.top,children:[s.jsx("h3",{className:fo.title,children:o.name["en-US"]}),s.jsx("div",{className:fo.closeIcon,children:s.jsx(Z,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{r(null),c(!1)}})})]}),s.jsx("div",{className:fo.modalOptions,children:i.map(l=>{if(l.type==="image")return s.jsx(Nr,{label:"Put up an attractive image",activeImage:o[l.field],onChange:u=>{const d={...o,[l.field]:u};r(d)}},String(l.field));if(l.type==="text")return s.jsx(As,{isActiveText:!0,typesText:o[l.field.type],setTypesText:u=>{const d={...o,[l.field.type]:u};r(d)},alignText:o[l.field.alignText],setAlignText:u=>{const d={...o,[l.field.alignText]:u};r(d)},text:o[l.field.text]["en-US"]||"",setText:u=>{const d={...o,[l.field.text]:{"en-US":u}};r(d)},typeFont:o[l.field.type],setTypeFont:u=>{const d={...o,[l.field.type]:u};r(d)},subtitle:l.label});if(l.type==="input")return s.jsx(ln,{onChange:u=>{const d={...o,[l.field]:{"en-US":u}};r(d)},value:o[l.field]["en-US"]||"",label:l.label,placeholder:l.placeholder});if(l.type==="inputNumber")return s.jsx(ln,{onChange:u=>{const d={...o,[l.field]:u};r(d)},value:o[l.field]||"",label:l.label,placeholder:l.placeholder,type:"number"});if(l.type==="inputSwitch")return s.jsxs("div",{className:fo.link,children:[s.jsx(ln,{onChange:u=>{const d={...o,[l.field.text]:{"en-US":u}};r(d)},value:o[l.field.text]["en-US"]||"",label:l.inputLabel,placeholder:l.placeholder}),s.jsx(Dn,{current:!!o[l.field.switch]||!1,label:l.switchLabel,onChange:u=>{const d={...o,[l.field.switch]:u};r(d)}})]});if(l.type==="select")return s.jsx(oo,{options:l.itemsOptions,onChange:u=>{const d={...o,[l.field]:u};r(d)},label:l.label,value:o[l.field]||"String",leftAddonOptions:l.leftAddonOptions})})})]})}),D4="_title_hvj8m_1",M4="_buttonsBlock_hvj8m_15",N4="_top_hvj8m_26",B4="_modal_hvj8m_120",F4="_options_hvj8m_146",j4="_closeIcon_hvj8m_154",Fo={title:D4,buttonsBlock:M4,top:N4,modal:B4,options:F4,closeIcon:j4},O4=y.forwardRef((t,n)=>{var x;const{activeButton:o,setActiveButton:r,popupPosition:a,editableLink:i=!0}=t,[c,l]=y.useState(o.typesText),[u,d]=y.useState(o.destination),[h,f]=y.useState(o.page),[m,g]=y.useState(o.link||""),[I,p]=y.useState(o.text||{"en-US":""}),[C,b]=y.useState(o.openInNewTab),{pages:S}=Zn();return $o(n,()=>{r(null)}),y.useEffect(()=>{r({...o,...{text:I,link:m,destination:u,typesText:c,page:h,openInNewTab:C}})},[c,u,m,I,h,C]),s.jsxs("div",{className:Fo.modal,onClick:T=>{T.stopPropagation()},style:{top:`${a.top}px`,left:`${a.left}px`},ref:n,children:[s.jsxs("div",{className:Fo.top,children:[s.jsx("h3",{className:Fo.title,children:o.type}),s.jsx("div",{className:Fo.closeIcon,children:s.jsx(Z,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>r(null)})})]}),s.jsxs("div",{className:Fo.options,children:[i&&s.jsx(oo,{label:"Destination",onChange:T=>d(T),options:["Go to Page","Open Link"].filter(T=>T!==u),value:u}),i&&(u==="Go to Page"?s.jsx(oo,{label:"Go to",onChange:T=>{if(T==="Sign In")f("/customer-dash");else if(S){for(const _ in S)if(S[_].name===T){f(S[_].path);break}}else f(Zl[0])},options:S?[...Object.values(S).filter(T=>T.path!==h).map(T=>T.name),"Sign In"]:["Sign In"],value:S?h==="/customer-dash"?"Sign In":((x=Object.values(S).find(T=>T.path===h))==null?void 0:x.name)||"Home":"Home"}):s.jsx(ln,{onChange:T=>g(T),value:m,placeholder:"https://",label:"Link"})),i&&s.jsx(Dn,{current:o.openInNewTab,label:"Open in new tab",onChange:T=>b(T)}),s.jsx(Ps,{onChange:T=>p({"en-US":T}),value:I["en-US"],label:"Text"}),s.jsx(ks,{typesText:c,setTypesText:l})]})]})}),H4="_wrapper_m18qi_1",V4="_subtitle_m18qi_7",U4="_content_m18qi_14",$4="_range_m18qi_22",W4="_track_m18qi_27",q4="_progress_m18qi_36",Z4="_dots_m18qi_46",G4="_dot_m18qi_46",z4="_active_m18qi_65",Y4="_input_m18qi_77",X4="_countBlock_m18qi_91",K4="_controls_m18qi_107",J4="_button_m18qi_113",Et={wrapper:H4,subtitle:V4,content:U4,range:$4,track:W4,progress:q4,dots:Z4,dot:G4,active:z4,input:Y4,countBlock:X4,controls:K4,button:J4},dd=t=>{const{label:n,min:o=1,max:r=4,step:a=1,count:i,setCount:c}=t,[l,u]=y.useState(!1),d=Array.from({length:(r-o)/a+1}),h=(i-o)/(r-o)*100,f=()=>{i<r&&c(i+a)},m=()=>{i>o&&c(i-a)},g=I=>{const p=o+I*a;c(p)};return s.jsxs("div",{className:Et.wrapper,children:[n&&s.jsx("h5",{className:Et.subtitle,children:n}),s.jsxs("div",{className:Et.content,children:[s.jsxs("div",{className:Et.range,children:[s.jsx("div",{className:Et.track}),s.jsx("div",{className:Et.progress,style:{width:`${h}%`}}),s.jsx("div",{className:Et.dots,children:d.map((I,p)=>{const C=p<=(i-o)/a;return s.jsx("button",{onClick:()=>g(p),className:te(Et.dot,{[Et.active]:C,[Et.inactive]:!C,[Et.dragging]:l}),"aria-label":`Set value to ${o+p*a}`},p)})}),s.jsx("input",{type:"range",min:o,max:r,step:a,value:i,onChange:I=>c(Number(I.target.value)),onMouseDown:()=>u(!0),onMouseUp:()=>u(!1),onTouchStart:()=>u(!0),onTouchEnd:()=>u(!1),className:Et.input})]}),s.jsxs("div",{className:Et.countBlock,children:[s.jsx(ln,{type:"number",min:o,max:r,paddingless:!0,onChange:I=>{const p=Number(I);p>r?c(r):p<o?c(o):c(p)},value:String(i)}),s.jsxs("div",{className:Et.controls,children:[s.jsx("button",{onClick:f,disabled:i>=r,className:Et.button,"aria-label":"Increment count",children:s.jsx(Z,{name:"CaretUp",width:15,height:15})}),s.jsx("button",{onClick:m,disabled:i<=o,className:Et.button,"aria-label":"Decrement count",children:s.jsx(Z,{name:"CaretDown",width:15,height:15})})]})]})]})]})},Q4="_title_11jyy_1",eC="_subtitle_11jyy_5",tC="_productsBlock_11jyy_14",nC="_top_11jyy_26",oC="_products_11jyy_14",rC="_product_11jyy_14",aC="_button_11jyy_80",iC="_buttons_11jyy_114",sC="_modal_11jyy_121",cC="_modalOptions_11jyy_148",lC="_addButton_11jyy_161",uC="_deleteButton_11jyy_176",dC="_closeIcon_11jyy_188",fr={title:Q4,subtitle:eC,productsBlock:tC,top:nC,products:oC,product:rC,button:aC,buttons:iC,modal:sC,modalOptions:cC,addButton:lC,deleteButton:uC,closeIcon:dC},hd=({render:t,block:n})=>t(n),fd=({settings:t,pageContext:n})=>{const{footer:o}=$n(),{settings:r}=Er(),{pageContext:a}=Zn(),{footer:i}=bo();if(!i||!o)return null;const c=new i;return Object.keys(o).map(l=>{c[l]=o[l]}),c.renderBlock((t==null?void 0:t.blockSettings)||r,n||a)},pd=({settings:t,pageContext:n})=>{const{header:o}=$n(),{settings:r}=Er(),{pageContext:a}=Zn(),{header:i}=bo();if(!i||!o)return null;const c=new i;return Object.keys(o).map(l=>{c[l]=o[l]}),c.renderBlock((t==null?void 0:t.blockSettings)||r,n||a)},md=({settings:t,pageContext:n})=>{const{announcement:o}=$n(),{settings:r}=Er(),{pageContext:a}=Zn(),{announcement:i}=bo();if(!i||!o)return null;const c=new i;return Object.keys(o).map(l=>{c[l]=o[l]}),c.renderBlock(t||r,n||a)},hC=async t=>{var c,l;const n=Ye.getState().apiUrls,o=ut?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,r=To.getState(),a=localStorage.getItem("shopPassword");if((c=r.general)!=null&&c.info.passwordProtected&&!a)return null;const i=`${n.storeApi}/v2/shops/${o}/pages/${t}`+((l=r.general)!=null&&l.info.passwordProtected?`?password=${a}`:"");try{return await je({url:i,withToken:!0,method:"get"})}catch(u){if(He.isAxiosError(u)&&u.response&&u.response.status===404)return null}},fC="_wrapper_5w9s8_1",pC={wrapper:fC},os=t=>{const{error:n}=t;return s.jsx("div",{className:pC.wrapper,children:n})},mC=async t=>{const n=Ye.getState().apiUrls,o=ut?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${n.slApi}/v1/balance/top-up/${o}`;return await je({url:r,method:"post",body:t,withToken:!1})},Yo=async t=>{const n=Ye.getState().apiUrls,o=ut?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${n.customersApi}/v2/${o}/customers/${t}`;return await je({url:r,withToken:!0,method:"get",typeToken:"customer"})},gC=()=>Yo("dash/info"),IC=()=>Yo("dash/dashboard/home"),CC=()=>Yo("rewards"),SC=()=>Yo("balance"),yC=()=>Yo("balance/top-up/settings"),vC=()=>Yo("referral-system"),rs=10,Ja=async({url:t,PageNumber:n})=>{var l;const o=Ye.getState().apiUrls,r=ut?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${o.customersApi}/v2/${r}/${t}?PageNumber=${n}&PageSize=${rs}`,i=await je({url:a,withToken:!0,method:"get",typeToken:"customer"}),c=Number((l=i.headers)==null?void 0:l["x-pagination-total"]);return{list:i.data,totalCount:c}},js=async(t,n="get",o)=>{const r=Ye.getState().apiUrls,a=ut?localStorage.getItem("fakeDomain"):window.location.hostname,i=`${r.slApi}/v1/orders/${a}/${t}`;return await je({url:i,method:n,withToken:!0,body:o,typeToken:"customer"})},bC=t=>js("","post",t),wC=({PageNumber:t})=>Ja({url:"customers/orders",PageNumber:t}),xC=t=>js(t),_C=t=>js(t),TC=async t=>{const n=Ye.getState().apiUrls,o=ut?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${n.slApi}/v1/${o}/subscriptions`;return await je({url:r,method:"post",withToken:!1,body:t})},kC=async(t,n)=>{const o=Ye.getState().apiUrls,r=ut?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${o.slApi}/v2/${r}/subscriptions/${t}/${n}`;return await je({url:a,method:"get",withToken:!1})},PC=async(t,n)=>{const o=Ye.getState().apiUrls,r=ut?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${o.slApi}/v1/${r}/subscriptions/${t}/${n}/upgrades`;return await je({url:a,method:"get",withToken:!1})},LC=async(t,n,o)=>{const r=Ye.getState().apiUrls,a=ut?localStorage.getItem("fakeDomain"):window.location.hostname,i=`${r.slApi}/v1/${a}/subscriptions/${t}/${n}/cancel`;return await je({url:i,method:"post",withToken:!1,body:o})},AC=async(t,n)=>{const o=Ye.getState().apiUrls,r=ut?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${o.slApi}/v2/${r}/subscriptions/${t}/change-gateway`;return await je({url:a,method:"post",withToken:!1,body:{gateway:n}})},EC=({PageNumber:t})=>Ja({url:"customers/subscriptions",PageNumber:t}),RC=async({id:t,accessToken:n})=>await PC(t,n),DC=async(t,n)=>{const o=Ye.getState().apiUrls,r=ut?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${o.slApi}/v2/${r}/subscriptions/${t}/order`;return await je({url:a,method:"post",withToken:!1,body:n})},MC=async(t,n)=>{const o=Ye.getState().apiUrls,r=ut?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${o.slApi}/v1/public/${r}/tickets/${t}/${n}`;return await je({url:a,method:"get",withToken:!1})},NC=async(t,n,o,r,a)=>{const i=Ye.getState().apiUrls,c=ut?localStorage.getItem("fakeDomain"):window.location.hostname,l=`${i.slApi}/v1/public/${c}/tickets/${t}/${n}/answer`;return(await je({url:l,method:"post",body:{message:o,recaptcha:r,tsId:a},withToken:!1})).data},BC=({PageNumber:t})=>Ja({url:"customers/tickets",PageNumber:t}),FC=({PageNumber:t})=>Ja({url:"customers/balance/transactions",PageNumber:t}),gd=async t=>{const n=Ye.getState().apiUrls,o=t.map(c=>["names",c]),r=new URLSearchParams(o),a=ut?localStorage.getItem("fakeDomain"):window.location.hostname,i=`${n.slApi}/v2/gateways?shopDomain=${a}&${r.toString()}`;return await je({url:i,method:"get",withToken:!1})},jC=async({email:t,recaptcha:n,tsId:o})=>{const r=Ye.getState().apiUrls,a=ut?localStorage.getItem("fakeDomain"):window.location.hostname,i=`${r.customersApi}/v2/${a}/auth/otp/request`;return(await je({url:i,body:{email:t,recaptcha:n,tsId:o},method:"post",withToken:!1})).data?{requested:!0,email:t}:{requested:!1,email:void 0}},OC=async({email:t,otp:n,recaptcha:o,tsId:r})=>{const a=Ye.getState().apiUrls,i=ut?localStorage.getItem("fakeDomain"):window.location.hostname,c=`${a.customersApi}/v2/${i}/auth/otp/login`,{data:l}=await je({url:c,method:"post",body:{email:t,otp:n,recaptcha:o,tsId:r},withToken:!1});return ko.getState().setToken(l.data),localStorage.setItem("token",l.data),{token:l.data,requested:!1}},HC=async()=>{ko.getState().setToken(""),localStorage.removeItem("token")},VC=async t=>{const n=Ye.getState().apiUrls,o=ut?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${n.slApi}/v2/coupons/${o}/validate`;return await je({url:r,method:"post",body:t,withToken:!1})},UC=async t=>{const n=Ye.getState().apiUrls,o=ut?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${n.customersApi}/v2/${o}/customers/referral-system/signup`;return(await je({url:r,withToken:!0,method:"post",body:t,typeToken:"customer"})).data},$C=async()=>{const{data:t}=await vC();return t},WC=async t=>{const{data:n}=await UC(t);return n};async function qC(t){const n=Ye.getState().apiUrls,o=ut?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${n.customersApi}/v2/${o}/customers/rewards/${t.id}/claim`;return je({url:r,method:"post",withToken:!0,typeToken:"customer"})}const bi="Balance",ZC={Number:"NUMBER",Textarea:"LARGE_TEXT",Checkbox:"CHECK_BOX",Hidden:"HIDDEN"},GC={recaptcha:"",gateway:"",paymentMethod:"",parts:[],customFields:{},discordSocialConnectId:null,coupon:null,tsId:""},al=(t,n)=>{var d;const{productId:o,productVariantId:r,quantity:a,chargeType:i}=n,c=t.find(h=>h.id===o);if(!c)throw new Error("Product does not exist");const l=c.variants.find(h=>h.id===r);if(!l)throw new Error("Variant does not exist");if(i==="RECURRING"&&!l.subscriptionSettings)throw new Error("Variant does not have subscription settings");if(a!==void 0&&((d=l.quantity)!=null&&d.available)&&l.quantity.available<a)throw new Error("Not enough quantity available");const u=Un.getState().cart;if(u.parts.length>0){const h=t.find(m=>m.id===u.parts[0].productId),f=h==null?void 0:h.variants.find(m=>m.id===u.parts[0].productVariantId);if(f&&l.price.currency!==f.price.currency)throw new Error("Product have different currency")}return l},zC=(t,n)=>t.reduce((o,r)=>{var d,h;const a=n.find(f=>(f==null?void 0:f.id)===r.productId),i=a==null?void 0:a.variants.find(f=>f.id===r.productVariantId),{gateway:c}=Un.getState().cart,l=(i==null?void 0:i.gateways)||[],u=l.some(f=>f.name===c&&f.overrodePrice)?(d=l.find(f=>f.name===c))==null?void 0:d.overrodePrice:null;return r.chargeType==="ONE_TIME"?o+((u==null?void 0:u.amount)||(i==null?void 0:i.price.amount)||0)*r.quantity:i!=null&&i.subscriptionSettings?o+i.subscriptionSettings.price.amount+(((h=i.subscriptionSettings.entryFee)==null?void 0:h.amount)||0):o},0),YC=(t,n)=>({isRequired:n.some(r=>{var i;const a=t.find(c=>(c==null?void 0:c.id)===r.productId);return(i=a==null?void 0:a.variants.find(c=>c.id===r.productVariantId))==null?void 0:i.discordSettings.isRequired}),isEnabled:n.some(r=>{var i;const a=t.find(c=>(c==null?void 0:c.id)===r.productId);return(i=a==null?void 0:a.variants.find(c=>c.id===r.productVariantId))==null?void 0:i.discordSettings.isEnabled})}),il=t=>new Set(t.gateways.map(n=>n.name)),sl={availableGateways:[],requiresSignInGateways:[]},cl=(t,n)=>{var i;if(n.length===0)return sl;const o=(i=n[0])==null?void 0:i.variants[0];if(!o)return sl;const r=il(o);for(const c of t){const l=n.find(h=>h.id===c.productId);if(!l)continue;const u=l.variants.find(h=>h.id===c.productVariantId);if(!u)continue;const d=il(u);for(const h of r)d.has(h)||r.delete(h)}return!localStorage.getItem("token")&&r.has(bi)?(r.delete(bi),{availableGateways:[...r],requiresSignInGateways:[bi]}):{availableGateways:[...r],requiresSignInGateways:[]}},XC=(t,n)=>{if(t.length===0)return[];const r=t.map(i=>{const c=n.find(u=>u.id===i.productId),l=c==null?void 0:c.variants.find(u=>u.id===i.productVariantId);return(l==null?void 0:l.customFields)??[]}).flat().reduce((i,c)=>{const l=i[c.name];return l?(c.required&&!l.required&&(i[c.name]={...c,value:c.defaultValue}),i):(i[c.name]={...c,value:c.defaultValue},i)},{});return Object.values(r).map(i=>({...i,value:""}))},KC=(t,n)=>{const o=n.find(a=>a.id===t.productId),r=o==null?void 0:o.variants.find(a=>a.id===t.productVariantId);return t.chargeType==="RECURRING"?!!(r!=null&&r.subscriptionSettings):!1},JC=()=>{const{cart:t,products:n,coupon:o,pending:r,applyCouponPending:a,customerEmail:i,setCart:c,setProducts:l,setCoupon:u,setPending:d,setApplyCouponPending:h}=Un(),f=async p=>{var v;h(!0);const{cart:C}=Un.getState(),{gateway:b,parts:S}=C,{notifications:x,setNotifications:T}=Dt.getState();b||(h(!1),T([...x,{message:"There should be a gateway for the coupon",status:"error",id:ze()}]));const _=S.map(P=>P.productId);let R=null;try{const{data:P}=await VC({gateway:b,couponName:p,productIds:_});R=P.data,T([...x,{message:"Coupon is applied",status:"success",id:ze()}]),c(N=>({...N,coupon:p}))}catch(P){const N=P;T([...x,{message:`Coupon is not applied: ${N.message}`,status:"error",id:ze()}]),c(M=>({...M,coupon:null})),u(null),h(!1)}if(h(!1),(v=R==null?void 0:R.restrictToProductIds)!=null&&v.length&&!_.every(P=>{var N;return(N=R==null?void 0:R.restrictToProductIds)==null?void 0:N.includes(P)}))throw new Error("Coupon can't be applied to such products");return u(R),R},I={reset(){c({...GC})},addProducts:p=>{const C=Un.getState().products,b=p.filter(S=>!C.some(x=>x.id===S.id));l([...C,...b])},addProductToCart:p=>{const C=Un.getState().cart;try{al(n,p)}catch(S){throw new Error(S)}const b=C.parts.find(S=>S.productId===p.productId&&S.productVariantId===p.productVariantId&&S.chargeType===p.chargeType);if(b)return I.updateQuantityOfProduct({...b,quantity:(b.quantity||1)+(p.quantity||1),chargeType:p.chargeType});if(C.parts.length&&!cl([...C.parts,p],n).availableGateways.length)throw new Error("No common payment gateways available");c({...C,parts:[...C.parts,p]})},removeProduct({productId:p,productVariantId:C}){c(b=>({...b,parts:b.parts.filter(S=>S.productId!==p||S.productVariantId!==C)}))},getPossibleGateways(){return cl(t.parts,n)},removeCoupon(){u(null)},getDiscordSettings(){return YC(n,t.parts)},updateQuantityOfProduct(p){al(n,p),c(C=>({...C,parts:C.parts.map(b=>b.productId===p.productId&&b.productVariantId===p.productVariantId?{...b,quantity:p.quantity,chargeType:p.chargeType}:b)}))},getTotalAndDiscount(){const{coupon:p}=Un.getState(),C=zC(t.parts,n);let b;return p&&p.discount&&(!p.isFixed&&p.discount===100?b=0:b=p.isFixed?Math.max(0,C-p.discount):C*(1-p.discount/100)),{total:C,totalWithDiscount:b}},setGateway(p){c(C=>({...C,gateway:p})),t.coupon&&f(t.coupon)},setPaymentMethod(p){c(C=>({...C,paymentMethod:p}))},async submitCart(p){d(!0);const{cart:C}=Un.getState(),{discordInfo:b}=Ru.getState();let S;if(C.parts&&i&&KC(C.parts[0],n))try{const{data:x}=await TC({...C,partOrder:C.parts[0],referralCode:localStorage.getItem("referralCode"),discordSocialConnectId:b!=null&&b.authorized?b.id:null,customerEmail:i,recaptcha:p,customFields:{...C.customFields},tsId:ro()});S=x.data}catch(x){console.error(x)}else try{const{data:x}=await bC({...C,referralCode:localStorage.getItem("referralCode"),recaptcha:p,customFields:{...C.customFields},tsId:ro(),discordSocialConnectId:b!=null&&b.authorized?b.id:null});S=x.data}catch(x){const{notifications:T,setNotifications:_}=Dt.getState();_([...T,{message:`Failed to create order: ${x}`,status:"error",id:ze()}])}if(d(!1),S)return S;throw new Error("Failed to create order")},setDiscordSocialConnectId(p){c(C=>({...C,discordSocialConnectId:p}))},setCustomFields(p){c(C=>({...C,customFields:{...p}}))}};return y.useEffect(()=>{c(p=>({...p,customerEmail:i??""}))},[i,c]),{cart:t,products:n,coupon:o,pending:r,applyCouponPending:a,applyCoupon:f,...I}},Qa=()=>{const{notifications:t,setNotifications:n}=Dt();return o=>{navigator.clipboard.writeText(o),n([...t,{status:"success",message:"Successfully copied",id:ze()}])}};function Id(t,n=!0){if(!t||typeof t!="string")return"";if(/<[a-z][\s\S]*>/i.test(t))return t;const r=t.split(" "),a=20;if(n){let i="",c=[];return r.forEach(l=>{l.length>a?(c.length>0&&(i+=`<span style="hyphens: manual">${c.join(" ")} </span>`,c=[]),i+=`<span style="hyphens: auto" lang="en">${l} </span>`):c.push(l)}),c.length>0&&(i+=`<span style="hyphens: manual">${c.join(" ")}</span>`),i}else{const i=[];let c=[],l=0;return r.forEach(u=>{u.length>a?(c.length>0&&(i.push(s.jsxs("span",{style:{hyphens:"manual"},children:[c.join(" ")," "]},l++)),c=[]),i.push(s.jsxs("span",{style:{hyphens:"auto"},lang:"en",children:[u," "]},l++))):c.push(u)}),c.length>0&&i.push(s.jsx("span",{style:{hyphens:"manual"},children:c.join(" ")},l++)),i}}const QC=y.forwardRef((t,n)=>{const{activeItem:o,setActiveItem:r,popupPosition:a,setIsOpenModal:i,itemsOptions:c}=t,l=c.find(u=>u.id===o.listingId);return $o(n,()=>{r(null),i(!1)}),l?s.jsxs("div",{className:fr.modal,onClick:u=>{u.stopPropagation()},style:{top:`${a.top}px`,left:`${a.left}px`},children:[s.jsxs("div",{className:fr.top,children:[s.jsx("h3",{dangerouslySetInnerHTML:{__html:Id(l.productData.name)}}),s.jsx("div",{className:fr.closeIcon,children:s.jsx(Z,{name:"X",height:20,width:20,onClick:()=>{i(!1),r(null)}})})]}),s.jsx("div",{className:fr.modalOptions,children:s.jsx(Nr,{label:"Put up an attractive image",activeImage:l.productData.images.length>0?l.productData.images[0].cfId:o.image?o.image:void 0,onChange:u=>{const d={...o,image:u[0]};r(d)}})})]}):null}),e0="_wrapper_235d9_1",t0="_label_235d9_9",n0="_input_235d9_18",o0="_disabled_235d9_31",r0="_paddingless_235d9_36",a0="_content_235d9_40",i0="_contentBorder_235d9_53",s0="_contentField_235d9_58",c0="_borderless_235d9_62",l0="_rightIcon_235d9_67",u0="_leftIcon_235d9_75",d0="_requiredStar_235d9_82",Vt={wrapper:e0,label:t0,input:n0,disabled:o0,paddingless:r0,content:a0,contentBorder:i0,contentField:s0,borderless:c0,rightIcon:l0,leftIcon:u0,requiredStar:d0},_o=t=>{const{onChange:n,style:o,label:r,value:a,type:i="text",min:c,max:l,placeholder:u,disabled:d=!1,required:h=!1,regex:f,paddingless:m=!1,borderless:g=!1,editable:I=!1,isSearch:p=!1,centered:C=!1,maxSymbols:b,rightIcon:S,onFocus:x,leftIcon:T}=t,{themeSettings:_}=wo(),{inputs:R}=_,[v,P]=y.useState(!1);function N(W){if(Number(W)<0)return String(c);const j=W.replace(/[^\d-]/g,"");return Number(j)<0?String(c):j}function M(W){return!h||!f?!0:new RegExp(f).test(W)}return s.jsxs("div",{className:Vt.wrapper,children:[r&&s.jsxs("label",{className:Vt.label,htmlFor:r,children:[r,h&&s.jsx("span",{className:Vt.requiredStar,children:"*"})]}),s.jsxs("div",{className:te(Vt.content,{[Vt.contentBorder]:R.border.active,[Vt.contentField]:R.field.active,[Vt.disabled]:d}),style:{...o},children:[T&&s.jsx("div",{className:Vt.leftIcon,children:T}),s.jsx("input",{maxLength:b,id:r,type:i||"text",onChange:W=>{if(i==="text")n(W.target.value);else{const j=N(W.target.value);n(j)}},value:a,autoComplete:"off",placeholder:u||"Type something...",className:te(Vt.input,{[Vt.required]:v&&h&&!M(a),[Vt.paddingless]:m,[Vt.borderless]:g}),min:i==="number"?c:void 0,max:i==="number"?l:void 0,onFocus:()=>{x&&x(),P(!0)},disabled:d,style:{textAlign:C?"center":"left",padding:p?`7px ${Number(R.general.size)+20}px 7px ${T?35:11}px`:`7px ${S?35:11}px 7px ${T?35:11}px`}}),S&&s.jsx("div",{className:Vt.rightIcon,children:S}),p&&s.jsx("div",{className:Vt.rightIcon,children:s.jsx(Z,{name:"MagnifyingGlass",fill:"var(--text-secondary)",width:R.general.size,height:R.general.size})}),I&&s.jsx("div",{children:s.jsx(Z,{name:"Sliders",width:20,height:20,hoverable:!0})})]})]})},h0="_button_3j1b9_1",f0="_primary_3j1b9_20",p0="_primaryHovered_3j1b9_30",m0="_secondary_3j1b9_35",g0="_secondaryHovered_3j1b9_45",I0="_tertiary_3j1b9_50",C0="_special_3j1b9_60",S0="_tertiaryHovered_3j1b9_64",y0="_content_3j1b9_69",On={button:h0,primary:f0,primaryHovered:p0,secondary:m0,secondaryHovered:g0,tertiary:I0,special:C0,tertiaryHovered:S0,content:y0},v0=()=>typeof document<"u"?document.documentElement.hasAttribute("translated")||document.documentElement.querySelector(".translated-ltr, .translated-rtl")!==null||document.head.querySelector('meta[name="_translator"]')!==null:!1,Cd=({children:t,className:n,as:o="span",...r})=>{const[a,i]=y.useState(!1);return y.useEffect(()=>{typeof window<"u"&&i(v0())},[]),a?s.jsx(o,{className:n,...r,"data-stable-text":t,dangerouslySetInnerHTML:{__html:""}}):s.jsx(o,{className:n,...r,children:t})},lt=t=>{const{children:n,onClick:o,style:r,className:a,disabled:i=!1,type:c="Primary",dangerouslySetInnerHTML:l}=t,{themeSettings:u}=wo(),d=I=>typeof I=="string"?s.jsx(Cd,{children:I}):I,h={onClick:o,disabled:i,style:r,className:te(On.button,a,{[On.primary]:c==="Primary",[On.secondary]:c==="Secondary",[On.tertiary]:c==="Tertiary",[On.primaryHovered]:c==="Primary"&&!i&&u.buttons.primary.hover,[On.secondaryHovered]:c==="Secondary"&&!i&&u.buttons.secondary.hover,[On.tertiaryHovered]:c==="Tertiary"&&!i&&u.buttons.tertiary.hover})};if(c==="Special")return s.jsx("button",{...h,className:On.special,...l?{dangerouslySetInnerHTML:l}:{children:d(n)}});const f=c.toLowerCase(),m=u.buttons[f],g=c==="Tertiary"?s.jsxs("div",{className:On.content,children:[d(n),s.jsx(Z,{name:"ArrowRight",fill:"var(--text-tertiary)",width:20,height:20})]}):d(n);return s.jsx("button",{...h,style:{...r,textAlign:m.alignment},...l?{dangerouslySetInnerHTML:l}:{children:g}})},b0="_modal_1iz94_1",w0="_padding_1iz94_17",x0="_content_1iz94_21",_0="_close_1iz94_42",Qr={modal:b0,padding:w0,content:x0,close:_0},ei=t=>{const{close:n,children:o,withAnimation:r=!0,hasPadding:a=!0}=t,{isOpen:i,setIsOpen:c}=Gn(),l=()=>{c(!1),r?setTimeout(()=>{n(!1),c(!0)},300):(n(!1),c(!0))};return y.useEffect(()=>{const u=d=>{d.key==="Escape"&&l()};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}},[]),Io.createPortal(s.jsx("div",{className:te(Qr.modal,{[Qr.padding]:a}),onClick:l,children:r?s.jsx("div",{className:te(Qr.content,{[Qr.close]:!i}),children:o}):s.jsx(s.Fragment,{children:o})}),document.body)},Sd=({children:t,path:n,className:o,target:r="_self",id:a})=>{if(window.location.pathname.includes("/admin/builder"))return s.jsx("div",{className:o,role:"link",style:{cursor:"pointer"},id:a,children:t});const i=Rn(),c=/^https?:\/\//.test(n),l=u=>{c||r==="_blank"?r==="_blank"?window.open(n,"_blank"):window.open(n,"_self"):(u.preventDefault(),i(n,{replace:!1}))};return s.jsx("div",{onClick:l,className:o,role:"link",style:{cursor:"pointer"},id:a,children:t})},T0="_loader_3je9m_1",k0={loader:T0},dn=t=>s.jsx("div",{className:k0.loader,...t}),P0="_container_6vcrl_1",L0="_wrapper_6vcrl_5",ll={container:P0,wrapper:L0};class A0{constructor(){Qo(this,"observer",null);Qo(this,"callbacks",new Map);Qo(this,"handleWindowResize",()=>{this.callbacks.forEach((n,o)=>{const r=o.getBoundingClientRect().width;n.forEach(a=>a(r))})});this.observer=new ResizeObserver(n=>{var o;for(const r of n){const a=r.contentRect.width,i=r.target;this.callbacks.has(i)&&((o=this.callbacks.get(i))==null||o.forEach(c=>c(a)))}}),window.addEventListener("resize",this.handleWindowResize)}observe(n,o){var a;if(!this.observer)return;this.callbacks.has(n)||(this.callbacks.set(n,[]),this.observer.observe(n)),(this.callbacks.get(n)||[]).includes(o)||(a=this.callbacks.get(n))==null||a.push(o)}unobserve(n,o){var r;if(!(!this.observer||!this.callbacks.has(n))){if(o){const a=this.callbacks.get(n)||[];this.callbacks.set(n,a.filter(i=>i!==o))}(r=this.callbacks.get(n))!=null&&r.length||(this.callbacks.delete(n),this.observer.unobserve(n))}}disconnect(){this.observer&&(this.observer.disconnect(),this.observer=null),this.callbacks.clear(),window.removeEventListener("resize",this.handleWindowResize)}}const ul=new A0;function yd(t){const[n,o]=y.useState("desktop");return y.useEffect(()=>{const r=t.current;if(!r)return;const a=l=>l>=1081?"desktop":l>=720?"tablet":"mobile",i=l=>{const u=a(l);o(u)};ul.observe(r,i);const c=r.getBoundingClientRect().width;return i(c),()=>{ul.unobserve(r,i)}},[t]),n}const ea=16,vd=({children:t,padding:n,style:o,notPadding:r=!1})=>{const a=y.useRef(null),i=yd(a);return s.jsx("div",{className:ll.container,ref:a,style:o,children:s.jsx("div",{className:ll.wrapper,style:{maxWidth:"var(--max-width-store)",paddingTop:i==="desktop"?n==null?void 0:n.top:r?0:ea,paddingBottom:i==="desktop"?n==null?void 0:n.bottom:r?0:ea,paddingLeft:i==="desktop"?n==null?void 0:n.left:r?0:ea,paddingRight:i==="desktop"?n==null?void 0:n.right:r?0:ea,...o},children:t(i)})})},E0="_wrapper_oxpf7_1",R0="_label_oxpf7_10",D0="_contentBorder_oxpf7_19",M0="_textarea_oxpf7_23",N0="_contentField_oxpf7_35",B0="_length_oxpf7_49",uo={wrapper:E0,label:R0,contentBorder:D0,textarea:M0,contentField:N0,length:B0},F0=t=>{const{onChange:n,label:o,value:r,maxLength:a,placeholder:i="Type something...",type:c="text",required:l=!1}=t,[u,d]=y.useState(r.length),{themeSettings:h}=wo();function f(m){return c==="number"?m.replace(/[^\d\n]+/g,""):m}return s.jsxs("div",{className:uo.wrapper,children:[o&&s.jsxs("label",{className:uo.label,htmlFor:o,children:[o,l&&s.jsx("span",{className:uo.requiredStar,children:"*"})]}),s.jsx("textarea",{id:o,value:r,onChange:m=>{const g=f(m.target.value);d(g.length),n(g)},placeholder:i,className:te(uo.textarea,{[uo.contentBorder]:h.inputs.border.active,[uo.contentField]:h.inputs.field.active}),maxLength:a}),a&&s.jsxs("div",{className:uo.length,children:[u,"/",a]})]})},j0="_wrapper_ty9h3_2",O0="_label_ty9h3_9",H0="_top_ty9h3_17",V0="_select_ty9h3_23",U0="_borderFocused_ty9h3_42",$0="_input_ty9h3_49",W0="_icon_ty9h3_59",q0="_rotate_ty9h3_64",Z0="_content_ty9h3_68",G0="_options_ty9h3_72",z0="_filteredOptions_ty9h3_93",Y0="_open_ty9h3_97",X0="_option_ty9h3_72",K0="_focused_ty9h3_115",J0="_addon_ty9h3_119",Q0="_value_ty9h3_130",e3="_postfix_ty9h3_135",t3="_leftAddon_ty9h3_139",vt={wrapper:j0,label:O0,top:H0,select:V0,borderFocused:U0,input:$0,icon:W0,rotate:q0,content:Z0,options:G0,filteredOptions:z0,open:Y0,option:X0,focused:K0,addon:J0,value:Q0,postfix:e3,leftAddon:t3};function n3(t,n){y.useEffect(()=>{function o(r){!t.current||t.current.contains(r.target)||n(r)}return document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[t,n])}const bd=t=>{var P,N;const{onChange:n,label:o,value:r,options:a,style:i,switcher:c,postfixs:l,leftAddonOptions:u}=t,[d,h]=y.useState(!1),[f,m]=y.useState(""),[g,I]=y.useState(null),[p,C]=y.useState(!1),b=y.useRef(null);n3(b,()=>h(!1));function S(M){m(""),n(M),h(!1),I(null)}function x(M,W){return M?M.length>W+3?`${M.slice(0,W)}...`:M:""}function T(M){if(!d){(M.key==="Enter"||M.key==="ArrowDown")&&h(!0);return}const W=v;M.key==="ArrowDown"&&(M.preventDefault(),I(j=>j===null||j===W.length-1?0:j+1)),M.key==="ArrowUp"&&(M.preventDefault(),I(j=>j===null||j===0?W.length-1:j-1)),M.key==="Enter"&&g!==null&&(M.preventDefault(),S(W[g])),M.key==="Escape"&&h(!1)}const _=y.useRef(null),R=y.useMemo(()=>new zn(a,{threshold:.4,minMatchCharLength:2}),[a]),v=y.useMemo(()=>p&&f.trim()!==""?R.search(f).map(M=>M.item):a,[f,a,p,R]);return s.jsxs("div",{className:vt.wrapper,style:{...i},children:[o&&s.jsxs("div",{className:vt.top,children:[s.jsx("label",{className:vt.label,htmlFor:o,children:o}),c&&s.jsx(Dn,{current:c.value,onChange:c.onChange})]}),s.jsxs("label",{className:vt.content,ref:b,children:[s.jsxs("div",{className:te(vt.select,{[vt.borderFocused]:d}),onKeyDown:T,onClick:M=>{M.stopPropagation(),h(W=>!W),C(!1)},ref:_,tabIndex:0,children:[u&&u.length>0&&s.jsx("div",{className:vt.addon,children:(P=u.find(M=>M.value===r))==null?void 0:P.addon}),s.jsx("div",{className:vt.input,id:"md",children:x(r,15)}),s.jsx("div",{className:te(vt.icon,{[vt.rotate]:d}),onClick:M=>{M.stopPropagation(),h(W=>!W)},children:s.jsx(Z,{name:"CaretDown",width:16,height:16,fill:"var(--text-primary)"})})]}),s.jsxs("div",{className:te(vt.options,{[vt.open]:d}),style:{top:((N=_.current)==null?void 0:N.clientHeight)+10},children:[a.length>6&&s.jsx(_o,{type:"text",value:f,placeholder:"Search...",onChange:M=>{m(M),C(!0)},isSearch:!0}),s.jsxs("div",{className:vt.filteredOptions,children:[v.map((M,W)=>{var j;return s.jsxs("div",{className:te(vt.option,{[vt.focused]:W===g}),onClick:()=>{S(M),h(!1)},id:"md",children:[u&&u.length>0&&s.jsx("div",{className:vt.leftAddon,children:(j=u.find(G=>G.value===M))==null?void 0:j.addon}),s.jsx("span",{className:vt.value,id:"md",children:x(M,20)}),l&&s.jsx("span",{className:vt.postfix,id:"md",children:l[W]})]},M)}),v.length===0&&s.jsx("div",{children:"No results found."})]})]})]})]})},o3="_wrapper_2vleg_1",r3="_label_2vleg_9",a3="_options_2vleg_17",i3="_radioLabel_2vleg_23",s3="_radio_2vleg_23",c3="_custom_2vleg_38",l3="_option_2vleg_17",ho={wrapper:o3,label:r3,options:a3,radioLabel:i3,radio:s3,custom:c3,option:l3},u3=t=>{const{defaultValue:n,options:o,onChange:r,label:a,flexDirection:i="row"}=t,[c,l]=y.useState(n),u=d=>{const h=d.target.value;l(h),r(h)};return s.jsxs("div",{className:ho.wrapper,children:[s.jsx("span",{className:ho.label,children:a}),s.jsx("div",{className:ho.options,style:{flexDirection:i},children:o.map(d=>s.jsxs("label",{className:ho.radioLabel,children:[s.jsx("input",{type:"radio",value:d.value,checked:c===d.value,onChange:u,className:ho.radio}),s.jsx("span",{className:ho.custom}),s.jsx("span",{className:ho.option,children:d.label})]},d.value))})]})},d3="_content_eonwv_1",h3="_main_eonwv_12",f3="_block_eonwv_16",p3="_active_eonwv_22",m3="_name_eonwv_32",g3="_addSection_eonwv_109",I3="_addSectionTop_eonwv_117",Xn={content:d3,main:h3,block:f3,active:p3,name:m3,addSection:g3,addSectionTop:I3},C3="_sidebar_xhqpt_1",S3="_content_xhqpt_14",y3="_button_xhqpt_24",v3="_moveButton_xhqpt_40",b3="_deleteButton_xhqpt_49",Tn={sidebar:C3,content:S3,button:y3,moveButton:v3,deleteButton:b3},w3=()=>{var _;const{activeBlock:t,setActiveBlock:n}=Va(),{blocks:o,removeBlock:r,moveBlock:a,duplicateBlock:i,setCurrentBlock:c}=$n(),{currentPage:l,pages:u}=Zn(),{setTitle:d,setDescription:h,setOnConfirm:f}=Xl(),{setActiveBlock:m}=bo(),g=(_=u==null?void 0:u[l])==null?void 0:_.path,I=g?o[g]:null,p=(I==null?void 0:I.order)||[],C=p.indexOf(t.id),b=R=>{R.stopPropagation(),C>0&&g&&(a(g,C,C-1),n({id:t.id,neededScroll:!0}),setTimeout(()=>{n({id:t.id,neededScroll:!1})},100))},S=R=>{R.stopPropagation(),C<p.length-1&&g&&(a(g,C,C+1),n({id:t.id,neededScroll:!0}),setTimeout(()=>{n({id:t.id,neededScroll:!1})},100))},x=R=>{R.stopPropagation(),g&&i(g,t.id)},T=()=>{g&&(r(g,t.id),c(null),m(null),n({id:null,neededScroll:!1}))};return s.jsx("div",{className:Tn.sidebar,children:s.jsxs("div",{className:Tn.content,children:[s.jsx("button",{onClick:b,className:te(Tn.button,Tn.moveButton),disabled:C===0,children:s.jsx(Z,{name:"ArrowUp"})}),s.jsx("button",{onClick:S,className:te(Tn.button,Tn.moveButton),disabled:C===p.length-1,children:s.jsx(Z,{name:"ArrowDown"})}),s.jsx("button",{onClick:x,className:te(Tn.button,Tn.moveButton),children:s.jsx(Z,{name:"Copy"})}),s.jsx("button",{className:te(Tn.button,Tn.deleteButton),onClick:R=>{R.stopPropagation(),d("Remove Block"),h(`Are you sure you want to delete ${(I==null?void 0:I.data[t.id].name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),f(T)},children:s.jsx(Z,{name:"Trash",hoverable:!0,fill:"#C12A2A"})})]})})};function pr(t,n){if(!n||!n[t])return"unknown name";const o=new n[t];return!o.blockSettings||!o.blockSettings.displayName?"unknown name":o.blockSettings.displayName}const x3=y.memo(({scrollableRef:t})=>{const{setActiveBlock:n,activeBlock:o,zoomLevel:r}=Va(),{blocks:a,sourceBlocks:i}=bo(),{blocks:c,setCurrentBlock:l,currentBlock:u,setPositionBlock:d,announcement:h}=$n(),{settings:f}=Er(),{currentPage:m,pages:g,pageContext:I}=Zn(),{activeBlock:p,setActiveBlock:C}=wo(),{setError:b}=Yl(),{setActiveBlock:S}=bo(),x=y.useRef(o.id),T=y.useRef({});y.useEffect(()=>{if(o.id&&o.neededScroll&&T.current[o.id]){const v=T.current[o.id];if(v&&t.current){const P=v.offsetTop;t.current.scrollTo({top:P-30,behavior:"smooth"})}}},[o,t]);const _=Rn();y.useEffect(()=>{x.current=o.id},[o.id]);const R=v=>{if(!v||!v.name)return b({message:"Block or block.name is undefined.",failedSettings:!1,failedThemeSettings:!1,failedPageIds:g&&g[m].id?[g[m].id]:[]}),s.jsx(os,{error:"Block or block.name is undefined."});if(!a||!a[v.name])return b({message:'Block "${block.name}" does not exist in blocks.',failedSettings:!1,failedThemeSettings:!1,failedPageIds:g&&g[m].id?[g[m].id]:[]}),s.jsx(os,{error:`Block "${v.name}" does not exist in blocks.`});const P=new a[v.name];return v.value&&Object.assign(P,v.value),P.renderBlock(f==null?void 0:f.blockSettings,I)};return s.jsxs("div",{onClick:v=>{v.stopPropagation()},className:Xn.content,style:{width:"100%",height:"100%",zoom:`${r}`},ref:t,children:[h&&s.jsx(md,{}),s.jsx(pd,{}),s.jsx("div",{className:Xn.main,children:g&&g[m]&&c[g[m].path]&&c[g[m].path].data&&c[g[m].path].order.map(v=>s.jsxs("div",{ref:P=>T.current[v]=P,onClick:P=>{P.stopPropagation(),S(null),p&&C(null),n({id:v,neededScroll:!0}),setTimeout(()=>{n({id:v,neededScroll:!1})},100),l(null),u?setTimeout(()=>{l(o.id)},100):l(o.id)},onMouseEnter:P=>{P.stopPropagation(),o.neededScroll||n({id:v,neededScroll:!1})},onMouseLeave:P=>{P.stopPropagation(),o.neededScroll||n({id:null,neededScroll:!1})},className:te(Xn.block),children:[(o.id===v||u===v)&&s.jsx("div",{className:Xn.active}),(o.id===v||u===v)&&s.jsx("div",{className:Xn.name,children:pr(c[g[m].path].data[v].name,i)}),(o.id===v||u===v)&&pr(c[g[m].path].data[v].name,i)!=="unknown name"&&s.jsx(w3,{}),(o.id===v||u===v)&&pr(c[g[m].path].data[v].name,i)!=="unknown name"&&s.jsx("div",{className:Xn.addSection,children:s.jsx(Ho,{onClick:P=>{P.stopPropagation(),d(v,!0),l(null),n({id:null,neededScroll:!1}),S(null),_("/admin/builder/add")},children:"Add Section"})}),(o.id===v||u===v)&&pr(c[g[m].path].data[v].name,i)!=="unknown name"&&s.jsx("div",{className:te(Xn.addSection,Xn.addSectionTop),children:s.jsx(Ho,{onClick:P=>{P.stopPropagation(),d(v,!1),l(null),n({id:null,neededScroll:!1}),S(null),_("/admin/builder/add")},children:"Add Section"})}),a&&s.jsx(hd,{render:R,block:c[g[m].path].data[v]})]},v))}),s.jsx(fd,{})]})}),_3="_statItem_fzeec_1",T3="_content_fzeec_44",k3="_withChildren_fzeec_50",P3="_info_fzeec_56",L3="_iconWrapper_fzeec_68",A3="_text_fzeec_78",E3="_title_fzeec_84",R3="_value_fzeec_88",D3="_emptyImage_fzeec_94",M3="_image_fzeec_11",N3="_imageTitle_fzeec_112",B3="_emptyImageText_fzeec_122",F3="_hoverable_fzeec_147",ft={statItem:_3,content:T3,withChildren:k3,info:P3,iconWrapper:L3,text:A3,title:E3,value:R3,emptyImage:D3,image:M3,imageTitle:N3,emptyImageText:B3,hoverable:F3},rn=({iconName:t,title:n,value:o,image:r,imageName:a,children:i,className:c,logo:l,productSlug:u})=>{const d=Rn();return s.jsxs("div",{className:`${ft.statItem} ${c}`,children:[r&&r!=="empty"&&s.jsxs("div",{style:{position:"relative"},onClick:()=>{u&&d(`/${u}`)},children:[s.jsx("div",{style:{background:"#000000"},children:s.jsx("img",{src:r,alt:a,className:te(ft.image,ft.emptyImage,{[ft.hoverable]:u})})}),s.jsx("div",{className:ft.emptyImageText,children:s.jsx("div",{className:te(ft.title,ft.imageTitle),id:"h5",children:a})})]}),r==="empty"&&s.jsx("div",{style:{background:"#000000"},children:s.jsxs("div",{className:te(ft.emptyImage,{[ft.hoverable]:u}),onClick:()=>{u&&d(`/${u}`)},children:[s.jsx(Z,{name:"Image",width:64,height:64,fill:"var(--text-secondary)"}),s.jsx("div",{className:ft.emptyImageText,children:s.jsx("div",{className:ft.title,id:"h5",children:a||"No Product"})})]})}),s.jsxs("div",{className:`${ft.content} ${i?ft.withChildren:""}`,children:[s.jsxs("div",{className:ft.info,children:[l?s.jsx("div",{className:ft.iconWrapper,children:s.jsx("img",{src:l,width:28,height:28,style:{objectFit:"contain"}})}):s.jsx(Z,{name:t||"File",className:ft.iconWrapper,width:28,height:28,fill:"var(--text-action)"}),s.jsxs("div",{className:ft.text,children:[s.jsx("div",{className:ft.title,id:"h5",children:n}),s.jsx("div",{className:ft.value,id:"h5-bold",children:o})]})]}),i]})]})},j3="_card_10fve_2",O3="_mobile_10fve_15",H3="_email_10fve_19",V3="_balance_10fve_25",U3="_sidebar_10fve_32",$3="_navList_10fve_56",W3="_navItem_10fve_71",q3="_activeNavItem_10fve_84",Z3="_inactiveNavItem_10fve_89",G3="_logoutNavItem_10fve_98",z3="_iconWrapper_10fve_107",Y3="_skeleton_10fve_112",Nt={card:j3,mobile:O3,email:H3,balance:V3,sidebar:U3,navList:$3,navItem:W3,activeNavItem:q3,inactiveNavItem:Z3,logoutNavItem:G3,iconWrapper:z3,skeleton:Y3},X3=({email:t,balance:n,adaptiveStyles:o})=>s.jsxs("div",{className:te(Nt.card,{[Nt.mobile]:o!=="desktop"}),children:[s.jsx("div",{className:Nt.email,id:"h5",children:t}),s.jsxs("div",{className:Nt.balance,id:"md",children:["Balance: ",n]})]}),K3=[[st.Home,"House"],[st.Orders,"CurrencyCircleDollar"],[st.Rewards,"Medal"],[st.Balance,"Wallet"],[st.Subscriptions,"CalendarCheck"],[st.Tickets,"Question"]],J3=[[Bo.Home,"House"],[Bo.Orders,"CurrencyCircleDollar"],[Bo.Rewards,"Medal"],[Bo.Balance,"Wallet"],[Bo.Tickets,"Question"]],dl=({children:t,className:n="",onClick:o})=>s.jsx("button",{type:"button",className:te(Nt.navItem,n),onClick:o,children:t}),Q3=({adaptiveStyles:t})=>{const{route:n,setRoute:o}=un(),{isAntistock:r}=To(),a=r?J3:K3;return s.jsxs("div",{className:te(Nt.navList,{[Nt.mobile]:t!=="desktop"}),children:[a.map(([i,c])=>{const l=i===n;return s.jsxs(dl,{onClick:()=>o(i),className:te(l?Nt.activeNavItem:Nt.inactiveNavItem),children:[s.jsx("div",{className:Nt.iconWrapper,children:s.jsx(Z,{name:c})}),s.jsx("div",{children:i})]},i)}),s.jsxs(dl,{className:Nt.logoutNavItem,onClick:()=>{HC()},children:[s.jsx("div",{className:Nt.iconWrapper,children:s.jsx(Z,{name:"SignOut"})}),s.jsx("div",{children:"Sign Out"})]})]})};var Te=(t=>(t.New="NEW",t.Pending="PENDING",t.Completed="COMPLETED",t.Cancelled="CANCELLED",t.Expired="EXPIRED",t.FullDeliveryFailure="FULL_DELIVERY_FAILURE",t.PartiallyDelivered="PARTIALLY_DELIVERED",t.Refunded="REFUNDED",t.Failed="FAILED",t))(Te||{}),Ne=(t=>(t.Text="TEXT",t.Serial="SERIALS",t.Ebook="EBOOK",t.Link="LINK",t.Download="DOWNLOAD",t.Discord="DISCORD",t.Custom="CUSTOM",t))(Ne||{}),Hn=(t=>(t.RIAL="RIAL",t.AWAITING_PAYMENT="AWAITING_PAYMENT",t.ACTIVE="ACTIVE",t.PAST_DUE="PAST_DUE",t.CANCELLED="CANCELLED",t.EXPIRED="EXPIRED",t.CHANGED_GATEWAY="CHANGED_GATEWAY",t.REPLACED="REPLACED",t))(Hn||{});const Or=async t=>(await gd(t)).data,wd=async()=>{var o;const n=(await yC()).data;if(n.isEnabled){const r=(o=n==null?void 0:n.topUpSettings)==null?void 0:o.gateways;r&&Or(r)}return n},Os=async()=>{const n=(await SC()).data;return{amount:n.realBalance+n.manualBalance,currency:n.currency}};var mr=(t=>(t.ADDED="ADDED",t.REMOVED="REMOVED",t))(mr||{}),Fe=(t=>(t.NotPaid="NOT_PAID",t.Pending="PENDING",t.Paid="PAID",t.Expired="EXPIRED",t.Cancelled="CANCELLED",t))(Fe||{}),Pr=(t=>(t.Balance="BALANCE",t.Product="PRODUCT",t))(Pr||{}),tn=(t=>(t.Spend="SPEND_AMOUNT",t.Order="ORDER_COUNT",t.Referral="REFER_FRIEND",t.Review="LEAVE_REVIEW",t))(tn||{});const eS=async()=>(await CC()).data;/*! *****************************************************************************
|
|
73
|
+
`},XI={onDragStart(t){let{active:n}=t;return"Picked up draggable item "+n.id+"."},onDragOver(t){let{active:n,over:o}=t;return o?"Draggable item "+n.id+" was moved over droppable area "+o.id+".":"Draggable item "+n.id+" is no longer over a droppable area."},onDragEnd(t){let{active:n,over:o}=t;return o?"Draggable item "+n.id+" was dropped over droppable area "+o.id:"Draggable item "+n.id+" was dropped."},onDragCancel(t){let{active:n}=t;return"Dragging was cancelled. Draggable item "+n.id+" was dropped."}};function KI(t){let{announcements:n=XI,container:o,hiddenTextDescribedById:r,screenReaderInstructions:a=YI}=t;const{announce:i,announcement:c}=ZI(),l=jr("DndLiveRegion"),[u,d]=y.useState(!1);if(y.useEffect(()=>{d(!0)},[]),GI(y.useMemo(()=>({onDragStart(f){let{active:m}=f;i(n.onDragStart({active:m}))},onDragMove(f){let{active:m,over:g}=f;n.onDragMove&&i(n.onDragMove({active:m,over:g}))},onDragOver(f){let{active:m,over:g}=f;i(n.onDragOver({active:m,over:g}))},onDragEnd(f){let{active:m,over:g}=f;i(n.onDragEnd({active:m,over:g}))},onDragCancel(f){let{active:m,over:g}=f;i(n.onDragCancel({active:m,over:g}))}}),[i,n])),!u)return null;const h=y.createElement(y.Fragment,null,y.createElement(WI,{id:r,value:a.draggable}),y.createElement(qI,{id:l,announcement:c}));return o?Io.createPortal(h,o):h}var pt;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(pt||(pt={}));function Ea(){}function Hu(t,n){return y.useMemo(()=>({sensor:t,options:n??{}}),[t,n])}function Vu(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return y.useMemo(()=>[...n].filter(r=>r!=null),[...n])}const gn=Object.freeze({x:0,y:0});function JI(t,n){let{data:{value:o}}=t,{data:{value:r}}=n;return r-o}function QI(t,n){if(!t||t.length===0)return null;const[o]=t;return o[n]}function e2(t,n){const o=Math.max(n.top,t.top),r=Math.max(n.left,t.left),a=Math.min(n.left+n.width,t.left+t.width),i=Math.min(n.top+n.height,t.top+t.height),c=a-r,l=i-o;if(r<a&&o<i){const u=n.width*n.height,d=t.width*t.height,h=c*l,f=h/(u+d-h);return Number(f.toFixed(4))}return 0}const t2=t=>{let{collisionRect:n,droppableRects:o,droppableContainers:r}=t;const a=[];for(const i of r){const{id:c}=i,l=o.get(c);if(l){const u=e2(l,n);u>0&&a.push({id:c,data:{droppableContainer:i,value:u}})}}return a.sort(JI)};function n2(t,n,o){return{...t,scaleX:n&&o?n.width/o.width:1,scaleY:n&&o?n.height/o.height:1}}function Uu(t,n){return t&&n?{x:t.left-n.left,y:t.top-n.top}:gn}function o2(t){return function(o){for(var r=arguments.length,a=new Array(r>1?r-1:0),i=1;i<r;i++)a[i-1]=arguments[i];return a.reduce((c,l)=>({...c,top:c.top+t*l.y,bottom:c.bottom+t*l.y,left:c.left+t*l.x,right:c.right+t*l.x}),{...o})}}const r2=o2(1);function a2(t){if(t.startsWith("matrix3d(")){const n=t.slice(9,-1).split(/, /);return{x:+n[12],y:+n[13],scaleX:+n[0],scaleY:+n[5]}}else if(t.startsWith("matrix(")){const n=t.slice(7,-1).split(/, /);return{x:+n[4],y:+n[5],scaleX:+n[0],scaleY:+n[3]}}return null}function i2(t,n,o){const r=a2(n);if(!r)return t;const{scaleX:a,scaleY:i,x:c,y:l}=r,u=t.left-c-(1-a)*parseFloat(o),d=t.top-l-(1-i)*parseFloat(o.slice(o.indexOf(" ")+1)),h=a?t.width/a:t.width,f=i?t.height/i:t.height;return{width:h,height:f,top:d,right:u+h,bottom:d+f,left:u}}const s2={ignoreTransform:!1};function zo(t,n){n===void 0&&(n=s2);let o=t.getBoundingClientRect();if(n.ignoreTransform){const{transform:d,transformOrigin:h}=Yt(t).getComputedStyle(t);d&&(o=i2(o,d,h))}const{top:r,left:a,width:i,height:c,bottom:l,right:u}=o;return{top:r,left:a,width:i,height:c,bottom:l,right:u}}function Yc(t){return zo(t,{ignoreTransform:!0})}function c2(t){const n=t.innerWidth,o=t.innerHeight;return{top:0,left:0,right:n,bottom:o,width:n,height:o}}function l2(t,n){return n===void 0&&(n=Yt(t).getComputedStyle(t)),n.position==="fixed"}function u2(t,n){n===void 0&&(n=Yt(t).getComputedStyle(t));const o=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const i=n[a];return typeof i=="string"?o.test(i):!1})}function Ns(t,n){const o=[];function r(a){if(n!=null&&o.length>=n||!a)return o;if(Rs(a)&&a.scrollingElement!=null&&!o.includes(a.scrollingElement))return o.push(a.scrollingElement),o;if(!Br(a)||Fu(a)||o.includes(a))return o;const i=Yt(t).getComputedStyle(a);return a!==t&&u2(a,i)&&o.push(a),l2(a,i)?o:r(a.parentNode)}return t?r(t):o}function $u(t){const[n]=Ns(t,1);return n??null}function Si(t){return!za||!t?null:Zo(t)?t:Es(t)?Rs(t)||t===Go(t).scrollingElement?window:Br(t)?t:null:null}function Wu(t){return Zo(t)?t.scrollX:t.scrollLeft}function qu(t){return Zo(t)?t.scrollY:t.scrollTop}function es(t){return{x:Wu(t),y:qu(t)}}var bt;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(bt||(bt={}));function Zu(t){return!za||!t?!1:t===document.scrollingElement}function Gu(t){const n={x:0,y:0},o=Zu(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-o.width,y:t.scrollHeight-o.height},a=t.scrollTop<=n.y,i=t.scrollLeft<=n.x,c=t.scrollTop>=r.y,l=t.scrollLeft>=r.x;return{isTop:a,isLeft:i,isBottom:c,isRight:l,maxScroll:r,minScroll:n}}const d2={x:.2,y:.2};function h2(t,n,o,r,a){let{top:i,left:c,right:l,bottom:u}=o;r===void 0&&(r=10),a===void 0&&(a=d2);const{isTop:d,isBottom:h,isLeft:f,isRight:m}=Gu(t),g={x:0,y:0},I={x:0,y:0},p={height:n.height*a.y,width:n.width*a.x};return!d&&i<=n.top+p.height?(g.y=bt.Backward,I.y=r*Math.abs((n.top+p.height-i)/p.height)):!h&&u>=n.bottom-p.height&&(g.y=bt.Forward,I.y=r*Math.abs((n.bottom-p.height-u)/p.height)),!m&&l>=n.right-p.width?(g.x=bt.Forward,I.x=r*Math.abs((n.right-p.width-l)/p.width)):!f&&c<=n.left+p.width&&(g.x=bt.Backward,I.x=r*Math.abs((n.left+p.width-c)/p.width)),{direction:g,speed:I}}function f2(t){if(t===document.scrollingElement){const{innerWidth:i,innerHeight:c}=window;return{top:0,left:0,right:i,bottom:c,width:i,height:c}}const{top:n,left:o,right:r,bottom:a}=t.getBoundingClientRect();return{top:n,left:o,right:r,bottom:a,width:t.clientWidth,height:t.clientHeight}}function zu(t){return t.reduce((n,o)=>Oo(n,es(o)),gn)}function p2(t){return t.reduce((n,o)=>n+Wu(o),0)}function m2(t){return t.reduce((n,o)=>n+qu(o),0)}function g2(t,n){if(n===void 0&&(n=zo),!t)return;const{top:o,left:r,bottom:a,right:i}=n(t);$u(t)&&(a<=0||i<=0||o>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const I2=[["x",["left","right"],p2],["y",["top","bottom"],m2]];class Bs{constructor(n,o){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Ns(o),a=zu(r);this.rect={...n},this.width=n.width,this.height=n.height;for(const[i,c,l]of I2)for(const u of c)Object.defineProperty(this,u,{get:()=>{const d=l(r),h=a[i]-d;return this.rect[u]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ir{constructor(n){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(o=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...o)})},this.target=n}add(n,o,r){var a;(a=this.target)==null||a.addEventListener(n,o,r),this.listeners.push([n,o,r])}}function C2(t){const{EventTarget:n}=Yt(t);return t instanceof n?t:Go(t)}function yi(t,n){const o=Math.abs(t.x),r=Math.abs(t.y);return typeof n=="number"?Math.sqrt(o**2+r**2)>n:"x"in n&&"y"in n?o>n.x&&r>n.y:"x"in n?o>n.x:"y"in n?r>n.y:!1}var sn;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(sn||(sn={}));function Xc(t){t.preventDefault()}function S2(t){t.stopPropagation()}var Ee;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(Ee||(Ee={}));const Yu={start:[Ee.Space,Ee.Enter],cancel:[Ee.Esc],end:[Ee.Space,Ee.Enter,Ee.Tab]},y2=(t,n)=>{let{currentCoordinates:o}=n;switch(t.code){case Ee.Right:return{...o,x:o.x+25};case Ee.Left:return{...o,x:o.x-25};case Ee.Down:return{...o,y:o.y+25};case Ee.Up:return{...o,y:o.y-25}}};class Xu{constructor(n){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=n;const{event:{target:o}}=n;this.props=n,this.listeners=new Ir(Go(o)),this.windowListeners=new Ir(Yt(o)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(sn.Resize,this.handleCancel),this.windowListeners.add(sn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(sn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:n,onStart:o}=this.props,r=n.node.current;r&&g2(r),o(gn)}handleKeyDown(n){if(Ms(n)){const{active:o,context:r,options:a}=this.props,{keyboardCodes:i=Yu,coordinateGetter:c=y2,scrollBehavior:l="smooth"}=a,{code:u}=n;if(i.end.includes(u)){this.handleEnd(n);return}if(i.cancel.includes(u)){this.handleCancel(n);return}const{collisionRect:d}=r.current,h=d?{x:d.left,y:d.top}:gn;this.referenceCoordinates||(this.referenceCoordinates=h);const f=c(n,{active:o,context:r.current,currentCoordinates:h});if(f){const m=Aa(f,h),g={x:0,y:0},{scrollableAncestors:I}=r.current;for(const p of I){const C=n.code,{isTop:b,isRight:S,isLeft:x,isBottom:T,maxScroll:_,minScroll:R}=Gu(p),v=f2(p),P={x:Math.min(C===Ee.Right?v.right-v.width/2:v.right,Math.max(C===Ee.Right?v.left:v.left+v.width/2,f.x)),y:Math.min(C===Ee.Down?v.bottom-v.height/2:v.bottom,Math.max(C===Ee.Down?v.top:v.top+v.height/2,f.y))},N=C===Ee.Right&&!S||C===Ee.Left&&!x,M=C===Ee.Down&&!T||C===Ee.Up&&!b;if(N&&P.x!==f.x){const W=p.scrollLeft+m.x,j=C===Ee.Right&&W<=_.x||C===Ee.Left&&W>=R.x;if(j&&!m.y){p.scrollTo({left:W,behavior:l});return}j?g.x=p.scrollLeft-W:g.x=C===Ee.Right?p.scrollLeft-_.x:p.scrollLeft-R.x,g.x&&p.scrollBy({left:-g.x,behavior:l});break}else if(M&&P.y!==f.y){const W=p.scrollTop+m.y,j=C===Ee.Down&&W<=_.y||C===Ee.Up&&W>=R.y;if(j&&!m.x){p.scrollTo({top:W,behavior:l});return}j?g.y=p.scrollTop-W:g.y=C===Ee.Down?p.scrollTop-_.y:p.scrollTop-R.y,g.y&&p.scrollBy({top:-g.y,behavior:l});break}}this.handleMove(n,Oo(Aa(f,this.referenceCoordinates),g))}}}handleMove(n,o){const{onMove:r}=this.props;n.preventDefault(),r(o)}handleEnd(n){const{onEnd:o}=this.props;n.preventDefault(),this.detach(),o()}handleCancel(n){const{onCancel:o}=this.props;n.preventDefault(),this.detach(),o()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Xu.activators=[{eventName:"onKeyDown",handler:(t,n,o)=>{let{keyboardCodes:r=Yu,onActivation:a}=n,{active:i}=o;const{code:c}=t.nativeEvent;if(r.start.includes(c)){const l=i.activatorNode.current;return l&&t.target!==l?!1:(t.preventDefault(),a==null||a({event:t.nativeEvent}),!0)}return!1}}];function Kc(t){return!!(t&&"distance"in t)}function Jc(t){return!!(t&&"delay"in t)}class Fs{constructor(n,o,r){var a;r===void 0&&(r=C2(n.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=n,this.events=o;const{event:i}=n,{target:c}=i;this.props=n,this.events=o,this.document=Go(c),this.documentListeners=new Ir(this.document),this.listeners=new Ir(r),this.windowListeners=new Ir(Yt(c)),this.initialCoordinates=(a=Qi(i))!=null?a:gn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:n,props:{options:{activationConstraint:o,bypassActivationConstraint:r}}}=this;if(this.listeners.add(n.move.name,this.handleMove,{passive:!1}),this.listeners.add(n.end.name,this.handleEnd),n.cancel&&this.listeners.add(n.cancel.name,this.handleCancel),this.windowListeners.add(sn.Resize,this.handleCancel),this.windowListeners.add(sn.DragStart,Xc),this.windowListeners.add(sn.VisibilityChange,this.handleCancel),this.windowListeners.add(sn.ContextMenu,Xc),this.documentListeners.add(sn.Keydown,this.handleKeydown),o){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Jc(o)){this.timeoutId=setTimeout(this.handleStart,o.delay),this.handlePending(o);return}if(Kc(o)){this.handlePending(o);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(n,o){const{active:r,onPending:a}=this.props;a(r,n,this.initialCoordinates,o)}handleStart(){const{initialCoordinates:n}=this,{onStart:o}=this.props;n&&(this.activated=!0,this.documentListeners.add(sn.Click,S2,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(sn.SelectionChange,this.removeTextSelection),o(n))}handleMove(n){var o;const{activated:r,initialCoordinates:a,props:i}=this,{onMove:c,options:{activationConstraint:l}}=i;if(!a)return;const u=(o=Qi(n))!=null?o:gn,d=Aa(a,u);if(!r&&l){if(Kc(l)){if(l.tolerance!=null&&yi(d,l.tolerance))return this.handleCancel();if(yi(d,l.distance))return this.handleStart()}if(Jc(l)&&yi(d,l.tolerance))return this.handleCancel();this.handlePending(l,d);return}n.cancelable&&n.preventDefault(),c(u)}handleEnd(){const{onAbort:n,onEnd:o}=this.props;this.detach(),this.activated||n(this.props.active),o()}handleCancel(){const{onAbort:n,onCancel:o}=this.props;this.detach(),this.activated||n(this.props.active),o()}handleKeydown(n){n.code===Ee.Esc&&this.handleCancel()}removeTextSelection(){var n;(n=this.document.getSelection())==null||n.removeAllRanges()}}const v2={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Ya extends Fs{constructor(n){const{event:o}=n,r=Go(o.target);super(n,v2,r)}}Ya.activators=[{eventName:"onPointerDown",handler:(t,n)=>{let{nativeEvent:o}=t,{onActivation:r}=n;return!o.isPrimary||o.button!==0?!1:(r==null||r({event:o}),!0)}}];const b2={move:{name:"mousemove"},end:{name:"mouseup"}};var ts;(function(t){t[t.RightClick=2]="RightClick"})(ts||(ts={}));class w2 extends Fs{constructor(n){super(n,b2,Go(n.event.target))}}w2.activators=[{eventName:"onMouseDown",handler:(t,n)=>{let{nativeEvent:o}=t,{onActivation:r}=n;return o.button===ts.RightClick?!1:(r==null||r({event:o}),!0)}}];const vi={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class x2 extends Fs{constructor(n){super(n,vi)}static setup(){return window.addEventListener(vi.move.name,n,{capture:!1,passive:!1}),function(){window.removeEventListener(vi.move.name,n)};function n(){}}}x2.activators=[{eventName:"onTouchStart",handler:(t,n)=>{let{nativeEvent:o}=t,{onActivation:r}=n;const{touches:a}=o;return a.length>1?!1:(r==null||r({event:o}),!0)}}];var Cr;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Cr||(Cr={}));var Ra;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ra||(Ra={}));function _2(t){let{acceleration:n,activator:o=Cr.Pointer,canScroll:r,draggingRect:a,enabled:i,interval:c=5,order:l=Ra.TreeOrder,pointerCoordinates:u,scrollableAncestors:d,scrollableAncestorRects:h,delta:f,threshold:m}=t;const g=k2({delta:f,disabled:!i}),[I,p]=OI(),C=y.useRef({x:0,y:0}),b=y.useRef({x:0,y:0}),S=y.useMemo(()=>{switch(o){case Cr.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case Cr.DraggableRect:return a}},[o,a,u]),x=y.useRef(null),T=y.useCallback(()=>{const R=x.current;if(!R)return;const v=C.current.x*b.current.x,P=C.current.y*b.current.y;R.scrollBy(v,P)},[]),_=y.useMemo(()=>l===Ra.TreeOrder?[...d].reverse():d,[l,d]);y.useEffect(()=>{if(!i||!d.length||!S){p();return}for(const R of _){if((r==null?void 0:r(R))===!1)continue;const v=d.indexOf(R),P=h[v];if(!P)continue;const{direction:N,speed:M}=h2(R,P,S,n,m);for(const W of["x","y"])g[W][N[W]]||(M[W]=0,N[W]=0);if(M.x>0||M.y>0){p(),x.current=R,I(T,c),C.current=M,b.current=N;return}}C.current={x:0,y:0},b.current={x:0,y:0},p()},[n,T,r,p,i,c,JSON.stringify(S),JSON.stringify(g),I,d,_,h,JSON.stringify(m)])}const T2={x:{[bt.Backward]:!1,[bt.Forward]:!1},y:{[bt.Backward]:!1,[bt.Forward]:!1}};function k2(t){let{delta:n,disabled:o}=t;const r=Ji(n);return Fr(a=>{if(o||!r||!a)return T2;const i={x:Math.sign(n.x-r.x),y:Math.sign(n.y-r.y)};return{x:{[bt.Backward]:a.x[bt.Backward]||i.x===-1,[bt.Forward]:a.x[bt.Forward]||i.x===1},y:{[bt.Backward]:a.y[bt.Backward]||i.y===-1,[bt.Forward]:a.y[bt.Forward]||i.y===1}}},[o,n,r])}function P2(t,n){const o=n!=null?t.get(n):void 0,r=o?o.node.current:null;return Fr(a=>{var i;return n==null?null:(i=r??a)!=null?i:null},[r,n])}function L2(t,n){return y.useMemo(()=>t.reduce((o,r)=>{const{sensor:a}=r,i=a.activators.map(c=>({eventName:c.eventName,handler:n(c.handler,r)}));return[...o,...i]},[]),[t,n])}var kr;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(kr||(kr={}));var ns;(function(t){t.Optimized="optimized"})(ns||(ns={}));const Qc=new Map;function A2(t,n){let{dragging:o,dependencies:r,config:a}=n;const[i,c]=y.useState(null),{frequency:l,measure:u,strategy:d}=a,h=y.useRef(t),f=C(),m=Tr(f),g=y.useCallback(function(b){b===void 0&&(b=[]),!m.current&&c(S=>S===null?b:S.concat(b.filter(x=>!S.includes(x))))},[m]),I=y.useRef(null),p=Fr(b=>{if(f&&!o)return Qc;if(!b||b===Qc||h.current!==t||i!=null){const S=new Map;for(let x of t){if(!x)continue;if(i&&i.length>0&&!i.includes(x.id)&&x.rect.current){S.set(x.id,x.rect.current);continue}const T=x.node.current,_=T?new Bs(u(T),T):null;x.rect.current=_,_&&S.set(x.id,_)}return S}return b},[t,i,o,f,u]);return y.useEffect(()=>{h.current=t},[t]),y.useEffect(()=>{f||g()},[o,f]),y.useEffect(()=>{i&&i.length>0&&c(null)},[JSON.stringify(i)]),y.useEffect(()=>{f||typeof l!="number"||I.current!==null||(I.current=setTimeout(()=>{g(),I.current=null},l))},[l,f,g,...r]),{droppableRects:p,measureDroppableContainers:g,measuringScheduled:i!=null};function C(){switch(d){case kr.Always:return!1;case kr.BeforeDragging:return o;default:return!o}}}function Ku(t,n){return Fr(o=>t?o||(typeof n=="function"?n(t):t):null,[n,t])}function E2(t,n){return Ku(t,n)}function R2(t){let{callback:n,disabled:o}=t;const r=Ds(n),a=y.useMemo(()=>{if(o||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,o]);return y.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function Xa(t){let{callback:n,disabled:o}=t;const r=Ds(n),a=y.useMemo(()=>{if(o||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[o]);return y.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function D2(t){return new Bs(zo(t),t)}function el(t,n,o){n===void 0&&(n=D2);const[r,a]=y.useState(null);function i(){a(u=>{if(!t)return null;if(t.isConnected===!1){var d;return(d=u??o)!=null?d:null}const h=n(t);return JSON.stringify(u)===JSON.stringify(h)?u:h})}const c=R2({callback(u){if(t)for(const d of u){const{type:h,target:f}=d;if(h==="childList"&&f instanceof HTMLElement&&f.contains(t)){i();break}}}}),l=Xa({callback:i});return En(()=>{i(),t?(l==null||l.observe(t),c==null||c.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),c==null||c.disconnect())},[t]),r}function M2(t){const n=Ku(t);return Uu(t,n)}const tl=[];function N2(t){const n=y.useRef(t),o=Fr(r=>t?r&&r!==tl&&t&&n.current&&t.parentNode===n.current.parentNode?r:Ns(t):tl,[t]);return y.useEffect(()=>{n.current=t},[t]),o}function B2(t){const[n,o]=y.useState(null),r=y.useRef(t),a=y.useCallback(i=>{const c=Si(i.target);c&&o(l=>l?(l.set(c,es(c)),new Map(l)):null)},[]);return y.useEffect(()=>{const i=r.current;if(t!==i){c(i);const l=t.map(u=>{const d=Si(u);return d?(d.addEventListener("scroll",a,{passive:!0}),[d,es(d)]):null}).filter(u=>u!=null);o(l.length?new Map(l):null),r.current=t}return()=>{c(t),c(i)};function c(l){l.forEach(u=>{const d=Si(u);d==null||d.removeEventListener("scroll",a)})}},[a,t]),y.useMemo(()=>t.length?n?Array.from(n.values()).reduce((i,c)=>Oo(i,c),gn):zu(t):gn,[t,n])}function nl(t,n){n===void 0&&(n=[]);const o=y.useRef(null);return y.useEffect(()=>{o.current=null},n),y.useEffect(()=>{const r=t!==gn;r&&!o.current&&(o.current=t),!r&&o.current&&(o.current=null)},[t]),o.current?Aa(t,o.current):gn}function F2(t){y.useEffect(()=>{if(!za)return;const n=t.map(o=>{let{sensor:r}=o;return r.setup==null?void 0:r.setup()});return()=>{for(const o of n)o==null||o()}},t.map(n=>{let{sensor:o}=n;return o}))}function j2(t,n){return y.useMemo(()=>t.reduce((o,r)=>{let{eventName:a,handler:i}=r;return o[a]=c=>{i(c,n)},o},{}),[t,n])}function Ju(t){return y.useMemo(()=>t?c2(t):null,[t])}const ol=[];function O2(t,n){n===void 0&&(n=zo);const[o]=t,r=Ju(o?Yt(o):null),[a,i]=y.useState(ol);function c(){i(()=>t.length?t.map(u=>Zu(u)?r:new Bs(n(u),u)):ol)}const l=Xa({callback:c});return En(()=>{l==null||l.disconnect(),c(),t.forEach(u=>l==null?void 0:l.observe(u))},[t]),a}function H2(t){if(!t)return null;if(t.children.length>1)return t;const n=t.children[0];return Br(n)?n:t}function V2(t){let{measure:n}=t;const[o,r]=y.useState(null),a=y.useCallback(d=>{for(const{target:h}of d)if(Br(h)){r(f=>{const m=n(h);return f?{...f,width:m.width,height:m.height}:m});break}},[n]),i=Xa({callback:a}),c=y.useCallback(d=>{const h=H2(d);i==null||i.disconnect(),h&&(i==null||i.observe(h)),r(h?n(h):null)},[n,i]),[l,u]=La(c);return y.useMemo(()=>({nodeRef:l,rect:o,setRef:u}),[o,l,u])}const U2=[{sensor:Ya,options:{}},{sensor:Xu,options:{}}],$2={current:{}},Ia={draggable:{measure:Yc},droppable:{measure:Yc,strategy:kr.WhileDragging,frequency:ns.Optimized},dragOverlay:{measure:zo}};class Sr extends Map{get(n){var o;return n!=null&&(o=super.get(n))!=null?o:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(n=>{let{disabled:o}=n;return!o})}getNodeFor(n){var o,r;return(o=(r=this.get(n))==null?void 0:r.node.current)!=null?o:void 0}}const W2={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Sr,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ea},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ia,measureDroppableContainers:Ea,windowRect:null,measuringScheduled:!1},q2={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Ea,draggableNodes:new Map,over:null,measureDroppableContainers:Ea},Ka=y.createContext(q2),Qu=y.createContext(W2);function Z2(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Sr}}}function G2(t,n){switch(n.type){case pt.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:n.initialCoordinates,active:n.active}};case pt.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:n.coordinates.x-t.draggable.initialCoordinates.x,y:n.coordinates.y-t.draggable.initialCoordinates.y}}};case pt.DragEnd:case pt.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case pt.RegisterDroppable:{const{element:o}=n,{id:r}=o,a=new Sr(t.droppable.containers);return a.set(r,o),{...t,droppable:{...t.droppable,containers:a}}}case pt.SetDroppableDisabled:{const{id:o,key:r,disabled:a}=n,i=t.droppable.containers.get(o);if(!i||r!==i.key)return t;const c=new Sr(t.droppable.containers);return c.set(o,{...i,disabled:a}),{...t,droppable:{...t.droppable,containers:c}}}case pt.UnregisterDroppable:{const{id:o,key:r}=n,a=t.droppable.containers.get(o);if(!a||r!==a.key)return t;const i=new Sr(t.droppable.containers);return i.delete(o),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function z2(t){let{disabled:n}=t;const{active:o,activatorEvent:r,draggableNodes:a}=y.useContext(Ka),i=Ji(r),c=Ji(o==null?void 0:o.id);return y.useEffect(()=>{if(!n&&!r&&i&&c!=null){if(!Ms(i)||document.activeElement===i.target)return;const l=a.get(c);if(!l)return;const{activatorNode:u,node:d}=l;if(!u.current&&!d.current)return;requestAnimationFrame(()=>{for(const h of[u.current,d.current]){if(!h)continue;const f=UI(h);if(f){f.focus();break}}})}},[r,n,a,c,i]),null}function Y2(t,n){let{transform:o,...r}=n;return t!=null&&t.length?t.reduce((a,i)=>i({transform:a,...r}),o):o}function X2(t){return y.useMemo(()=>({draggable:{...Ia.draggable,...t==null?void 0:t.draggable},droppable:{...Ia.droppable,...t==null?void 0:t.droppable},dragOverlay:{...Ia.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function K2(t){let{activeNode:n,measure:o,initialRect:r,config:a=!0}=t;const i=y.useRef(!1),{x:c,y:l}=typeof a=="boolean"?{x:a,y:a}:a;En(()=>{if(!c&&!l||!n){i.current=!1;return}if(i.current||!r)return;const d=n==null?void 0:n.node.current;if(!d||d.isConnected===!1)return;const h=o(d),f=Uu(h,r);if(c||(f.x=0),l||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const m=$u(d);m&&m.scrollBy({top:f.y,left:f.x})}},[n,c,l,r,o])}const ed=y.createContext({...gn,scaleX:1,scaleY:1});var Jn;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Jn||(Jn={}));const td=y.memo(function(n){var o,r,a,i;let{id:c,accessibility:l,autoScroll:u=!0,children:d,sensors:h=U2,collisionDetection:f=t2,measuring:m,modifiers:g,...I}=n;const p=y.useReducer(G2,void 0,Z2),[C,b]=p,[S,x]=zI(),[T,_]=y.useState(Jn.Uninitialized),R=T===Jn.Initialized,{draggable:{active:v,nodes:P,translate:N},droppable:{containers:M}}=C,W=v!=null?P.get(v):null,j=y.useRef({initial:null,translated:null}),G=y.useMemo(()=>{var Ue;return v!=null?{id:v,data:(Ue=W==null?void 0:W.data)!=null?Ue:$2,rect:j}:null},[v,W]),H=y.useRef(null),[ce,he]=y.useState(null),[me,Ce]=y.useState(null),ye=Tr(I,Object.values(I)),$=jr("DndDescribedBy",c),Y=y.useMemo(()=>M.getEnabled(),[M]),ne=X2(m),{droppableRects:oe,measureDroppableContainers:O,measuringScheduled:X}=A2(Y,{dragging:R,dependencies:[N.x,N.y],config:ne.droppable}),K=P2(P,v),ie=y.useMemo(()=>me?Qi(me):null,[me]),ue=Bn(),z=E2(K,ne.draggable.measure);K2({activeNode:v!=null?P.get(v):null,config:ue.layoutShiftCompensation,initialRect:z,measure:ne.draggable.measure});const J=el(K,ne.draggable.measure,z),ke=el(K?K.parentElement:null),V=y.useRef({activatorEvent:null,active:null,activeNode:K,collisionRect:null,collisions:null,droppableRects:oe,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:M,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),xe=M.getNodeFor((o=V.current.over)==null?void 0:o.id),le=V2({measure:ne.dragOverlay.measure}),de=(r=le.nodeRef.current)!=null?r:K,Pe=R?(a=le.rect)!=null?a:J:null,tt=!!(le.nodeRef.current&&le.rect),nt=M2(tt?null:J),Le=Ju(de?Yt(de):null),Oe=N2(R?xe??K:null),Xt=O2(Oe),qe=Y2(g,{transform:{x:N.x-nt.x,y:N.y-nt.y,scaleX:1,scaleY:1},activatorEvent:me,active:G,activeNodeRect:J,containerNodeRect:ke,draggingNodeRect:Pe,over:V.current.over,overlayNodeRect:le.rect,scrollableAncestors:Oe,scrollableAncestorRects:Xt,windowRect:Le}),Ht=ie?Oo(ie,N):null,Ze=B2(Oe),dt=nl(Ze),At=nl(Ze,[J]),Xe=Oo(qe,dt),ot=Pe?r2(Pe,qe):null,Ke=G&&ot?f({active:G,collisionRect:ot,droppableRects:oe,droppableContainers:Y,pointerCoordinates:Ht}):null,yn=QI(Ke,"id"),[wt,Yn]=y.useState(null),rt=tt?qe:Oo(qe,At),vn=n2(rt,(i=wt==null?void 0:wt.rect)!=null?i:null,J),bn=y.useRef(null),so=y.useCallback((Ue,gt)=>{let{sensor:It,options:Kt}=gt;if(H.current==null)return;const xt=P.get(H.current);if(!xt)return;const Je=Ue.nativeEvent,Ct=new It({active:H.current,activeNode:xt,event:Je,options:Kt,context:V,onAbort(Qe){if(!P.get(Qe))return;const{onDragAbort:L}=ye.current,D={id:Qe};L==null||L(D),S({type:"onDragAbort",event:D})},onPending(Qe,k,L,D){if(!P.get(Qe))return;const{onDragPending:ee}=ye.current,se={id:Qe,constraint:k,initialCoordinates:L,offset:D};ee==null||ee(se),S({type:"onDragPending",event:se})},onStart(Qe){const k=H.current;if(k==null)return;const L=P.get(k);if(!L)return;const{onDragStart:D}=ye.current,q={activatorEvent:Je,active:{id:k,data:L.data,rect:j}};Io.unstable_batchedUpdates(()=>{D==null||D(q),_(Jn.Initializing),b({type:pt.DragStart,initialCoordinates:Qe,active:k}),S({type:"onDragStart",event:q}),he(bn.current),Ce(Je)})},onMove(Qe){b({type:pt.DragMove,coordinates:Qe})},onEnd:wn(pt.DragEnd),onCancel:wn(pt.DragCancel)});bn.current=Ct;function wn(Qe){return async function(){const{active:L,collisions:D,over:q,scrollAdjustedTranslate:ee}=V.current;let se=null;if(L&&ee){const{cancelDrop:w}=ye.current;se={activatorEvent:Je,active:L,collisions:D,delta:ee,over:q},Qe===pt.DragEnd&&typeof w=="function"&&await Promise.resolve(w(se))&&(Qe=pt.DragCancel)}H.current=null,Io.unstable_batchedUpdates(()=>{b({type:Qe}),_(Jn.Uninitialized),Yn(null),he(null),Ce(null),bn.current=null;const w=Qe===pt.DragEnd?"onDragEnd":"onDragCancel";if(se){const A=ye.current[w];A==null||A(se),S({type:w,event:se})}})}}},[P]),Ko=y.useCallback((Ue,gt)=>(It,Kt)=>{const xt=It.nativeEvent,Je=P.get(Kt);if(H.current!==null||!Je||xt.dndKit||xt.defaultPrevented)return;const Ct={active:Je};Ue(It,gt.options,Ct)===!0&&(xt.dndKit={capturedBy:gt.sensor},H.current=Kt,so(It,gt))},[P,so]),Mn=L2(h,Ko);F2(h),En(()=>{J&&T===Jn.Initializing&&_(Jn.Initialized)},[J,T]),y.useEffect(()=>{const{onDragMove:Ue}=ye.current,{active:gt,activatorEvent:It,collisions:Kt,over:xt}=V.current;if(!gt||!It)return;const Je={active:gt,activatorEvent:It,collisions:Kt,delta:{x:Xe.x,y:Xe.y},over:xt};Io.unstable_batchedUpdates(()=>{Ue==null||Ue(Je),S({type:"onDragMove",event:Je})})},[Xe.x,Xe.y]),y.useEffect(()=>{const{active:Ue,activatorEvent:gt,collisions:It,droppableContainers:Kt,scrollAdjustedTranslate:xt}=V.current;if(!Ue||H.current==null||!gt||!xt)return;const{onDragOver:Je}=ye.current,Ct=Kt.get(yn),wn=Ct&&Ct.rect.current?{id:Ct.id,rect:Ct.rect.current,data:Ct.data,disabled:Ct.disabled}:null,Qe={active:Ue,activatorEvent:gt,collisions:It,delta:{x:xt.x,y:xt.y},over:wn};Io.unstable_batchedUpdates(()=>{Yn(wn),Je==null||Je(Qe),S({type:"onDragOver",event:Qe})})},[yn]),En(()=>{V.current={activatorEvent:me,active:G,activeNode:K,collisionRect:ot,collisions:Ke,droppableRects:oe,draggableNodes:P,draggingNode:de,draggingNodeRect:Pe,droppableContainers:M,over:wt,scrollableAncestors:Oe,scrollAdjustedTranslate:Xe},j.current={initial:Pe,translated:ot}},[G,K,Ke,ot,P,de,Pe,oe,M,wt,Oe,Xe]),_2({...ue,delta:N,draggingRect:ot,pointerCoordinates:Ht,scrollableAncestors:Oe,scrollableAncestorRects:Xt});const Nn=y.useMemo(()=>({active:G,activeNode:K,activeNodeRect:J,activatorEvent:me,collisions:Ke,containerNodeRect:ke,dragOverlay:le,draggableNodes:P,droppableContainers:M,droppableRects:oe,over:wt,measureDroppableContainers:O,scrollableAncestors:Oe,scrollableAncestorRects:Xt,measuringConfiguration:ne,measuringScheduled:X,windowRect:Le}),[G,K,J,me,Ke,ke,le,P,M,oe,wt,O,Oe,Xt,ne,X,Le]),hn=y.useMemo(()=>({activatorEvent:me,activators:Mn,active:G,activeNodeRect:J,ariaDescribedById:{draggable:$},dispatch:b,draggableNodes:P,over:wt,measureDroppableContainers:O}),[me,Mn,G,J,b,$,P,wt,O]);return y.createElement(Ou.Provider,{value:x},y.createElement(Ka.Provider,{value:hn},y.createElement(Qu.Provider,{value:Nn},y.createElement(ed.Provider,{value:vn},d)),y.createElement(z2,{disabled:(l==null?void 0:l.restoreFocus)===!1})),y.createElement(KI,{...l,hiddenTextDescribedById:$}));function Bn(){const Ue=(ce==null?void 0:ce.autoScrollEnabled)===!1,gt=typeof u=="object"?u.enabled===!1:u===!1,It=R&&!Ue&&!gt;return typeof u=="object"?{...u,enabled:It}:{enabled:It}}}),J2=y.createContext(null),rl="button",Q2="Draggable";function e4(t){let{id:n,data:o,disabled:r=!1,attributes:a}=t;const i=jr(Q2),{activators:c,activatorEvent:l,active:u,activeNodeRect:d,ariaDescribedById:h,draggableNodes:f,over:m}=y.useContext(Ka),{role:g=rl,roleDescription:I="draggable",tabIndex:p=0}=a??{},C=(u==null?void 0:u.id)===n,b=y.useContext(C?ed:J2),[S,x]=La(),[T,_]=La(),R=j2(c,n),v=Tr(o);En(()=>(f.set(n,{id:n,key:i,node:S,activatorNode:T,data:v}),()=>{const N=f.get(n);N&&N.key===i&&f.delete(n)}),[f,n]);const P=y.useMemo(()=>({role:g,tabIndex:p,"aria-disabled":r,"aria-pressed":C&&g===rl?!0:void 0,"aria-roledescription":I,"aria-describedby":h.draggable}),[r,g,p,C,I,h.draggable]);return{active:u,activatorEvent:l,activeNodeRect:d,attributes:P,isDragging:C,listeners:r?void 0:R,node:S,over:m,setNodeRef:x,setActivatorNodeRef:_,transform:b}}function t4(){return y.useContext(Qu)}const n4="Droppable",o4={timeout:25};function r4(t){let{data:n,disabled:o=!1,id:r,resizeObserverConfig:a}=t;const i=jr(n4),{active:c,dispatch:l,over:u,measureDroppableContainers:d}=y.useContext(Ka),h=y.useRef({disabled:o}),f=y.useRef(!1),m=y.useRef(null),g=y.useRef(null),{disabled:I,updateMeasurementsFor:p,timeout:C}={...o4,...a},b=Tr(p??r),S=y.useCallback(()=>{if(!f.current){f.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{d(Array.isArray(b.current)?b.current:[b.current]),g.current=null},C)},[C]),x=Xa({callback:S,disabled:I||!c}),T=y.useCallback((P,N)=>{x&&(N&&(x.unobserve(N),f.current=!1),P&&x.observe(P))},[x]),[_,R]=La(T),v=Tr(n);return y.useEffect(()=>{!x||!_.current||(x.disconnect(),f.current=!1,x.observe(_.current))},[_,x]),y.useEffect(()=>(l({type:pt.RegisterDroppable,element:{id:r,key:i,disabled:o,node:_,rect:m,data:v}}),()=>l({type:pt.UnregisterDroppable,key:i,id:r})),[r]),y.useEffect(()=>{o!==h.current.disabled&&(l({type:pt.SetDroppableDisabled,id:r,key:i,disabled:o}),h.current.disabled=o)},[r,i,o,l]),{active:c,rect:m,isOver:(u==null?void 0:u.id)===r,node:_,over:u,setNodeRef:R}}function nd(t,n,o){const r=t.slice();return r.splice(o<0?r.length+o:o,0,r.splice(n,1)[0]),r}function a4(t,n){return t.reduce((o,r,a)=>{const i=n.get(r);return i&&(o[a]=i),o},Array(t.length))}function Kr(t){return t!==null&&t>=0}function i4(t,n){if(t===n)return!0;if(t.length!==n.length)return!1;for(let o=0;o<t.length;o++)if(t[o]!==n[o])return!1;return!0}function s4(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const od=t=>{let{rects:n,activeIndex:o,overIndex:r,index:a}=t;const i=nd(n,r,o),c=n[a],l=i[a];return!l||!c?null:{x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height}},Jr={scaleX:1,scaleY:1},rd=t=>{var n;let{activeIndex:o,activeNodeRect:r,index:a,rects:i,overIndex:c}=t;const l=(n=i[o])!=null?n:r;if(!l)return null;if(a===o){const d=i[c];return d?{x:0,y:o<c?d.top+d.height-(l.top+l.height):d.top-l.top,...Jr}:null}const u=c4(i,a,o);return a>o&&a<=c?{x:0,y:-l.height-u,...Jr}:a<o&&a>=c?{x:0,y:l.height+u,...Jr}:{x:0,y:0,...Jr}};function c4(t,n,o){const r=t[n],a=t[n-1],i=t[n+1];return r?o<n?a?r.top-(a.top+a.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):a?r.top-(a.top+a.height):0:0}const ad="Sortable",id=y.createContext({activeIndex:-1,containerId:ad,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:od,disabled:{draggable:!1,droppable:!1}});function sd(t){let{children:n,id:o,items:r,strategy:a=od,disabled:i=!1}=t;const{active:c,dragOverlay:l,droppableRects:u,over:d,measureDroppableContainers:h}=t4(),f=jr(ad,o),m=l.rect!==null,g=y.useMemo(()=>r.map(R=>typeof R=="object"&&"id"in R?R.id:R),[r]),I=c!=null,p=c?g.indexOf(c.id):-1,C=d?g.indexOf(d.id):-1,b=y.useRef(g),S=!i4(g,b.current),x=C!==-1&&p===-1||S,T=s4(i);En(()=>{S&&I&&h(g)},[S,g,I,h]),y.useEffect(()=>{b.current=g},[g]);const _=y.useMemo(()=>({activeIndex:p,containerId:f,disabled:T,disableTransforms:x,items:g,overIndex:C,useDragOverlay:m,sortedRects:a4(g,u),strategy:a}),[p,f,T.draggable,T.droppable,x,g,C,u,m,a]);return y.createElement(id.Provider,{value:_},n)}const l4=t=>{let{id:n,items:o,activeIndex:r,overIndex:a}=t;return nd(o,r,a).indexOf(n)},u4=t=>{let{containerId:n,isSorting:o,wasDragging:r,index:a,items:i,newIndex:c,previousItems:l,previousContainerId:u,transition:d}=t;return!d||!r||l!==i&&a===c?!1:o?!0:c!==a&&n===u},d4={duration:200,easing:"ease"},cd="transform",h4=Vo.Transition.toString({property:cd,duration:0,easing:"linear"}),f4={roleDescription:"sortable"};function p4(t){let{disabled:n,index:o,node:r,rect:a}=t;const[i,c]=y.useState(null),l=y.useRef(o);return En(()=>{if(!n&&o!==l.current&&r.current){const u=a.current;if(u){const d=zo(r.current,{ignoreTransform:!0}),h={x:u.left-d.left,y:u.top-d.top,scaleX:u.width/d.width,scaleY:u.height/d.height};(h.x||h.y)&&c(h)}}o!==l.current&&(l.current=o)},[n,o,r,a]),y.useEffect(()=>{i&&c(null)},[i]),i}function ld(t){let{animateLayoutChanges:n=u4,attributes:o,disabled:r,data:a,getNewIndex:i=l4,id:c,strategy:l,resizeObserverConfig:u,transition:d=d4}=t;const{items:h,containerId:f,activeIndex:m,disabled:g,disableTransforms:I,sortedRects:p,overIndex:C,useDragOverlay:b,strategy:S}=y.useContext(id),x=m4(r,g),T=h.indexOf(c),_=y.useMemo(()=>({sortable:{containerId:f,index:T,items:h},...a}),[f,a,T,h]),R=y.useMemo(()=>h.slice(h.indexOf(c)),[h,c]),{rect:v,node:P,isOver:N,setNodeRef:M}=r4({id:c,data:_,disabled:x.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...u}}),{active:W,activatorEvent:j,activeNodeRect:G,attributes:H,setNodeRef:ce,listeners:he,isDragging:me,over:Ce,setActivatorNodeRef:ye,transform:$}=e4({id:c,data:_,attributes:{...f4,...o},disabled:x.draggable}),Y=jI(M,ce),ne=!!W,oe=ne&&!I&&Kr(m)&&Kr(C),O=!b&&me,X=O&&oe?$:null,ie=oe?X??(l??S)({rects:p,activeNodeRect:G,activeIndex:m,overIndex:C,index:T}):null,ue=Kr(m)&&Kr(C)?i({id:c,items:h,activeIndex:m,overIndex:C}):T,z=W==null?void 0:W.id,J=y.useRef({activeId:z,items:h,newIndex:ue,containerId:f}),ke=h!==J.current.items,V=n({active:W,containerId:f,isDragging:me,isSorting:ne,id:c,index:T,items:h,newIndex:J.current.newIndex,previousItems:J.current.items,previousContainerId:J.current.containerId,transition:d,wasDragging:J.current.activeId!=null}),xe=p4({disabled:!V,index:T,node:P,rect:v});return y.useEffect(()=>{ne&&J.current.newIndex!==ue&&(J.current.newIndex=ue),f!==J.current.containerId&&(J.current.containerId=f),h!==J.current.items&&(J.current.items=h)},[ne,ue,f,h]),y.useEffect(()=>{if(z===J.current.activeId)return;if(z!=null&&J.current.activeId==null){J.current.activeId=z;return}const de=setTimeout(()=>{J.current.activeId=z},50);return()=>clearTimeout(de)},[z]),{active:W,activeIndex:m,attributes:H,data:_,rect:v,index:T,newIndex:ue,items:h,isOver:N,isSorting:ne,isDragging:me,listeners:he,node:P,overIndex:C,over:Ce,setNodeRef:Y,setActivatorNodeRef:ye,setDroppableNodeRef:M,setDraggableNodeRef:ce,transform:xe??ie,transition:le()};function le(){if(xe||ke&&J.current.newIndex===T)return h4;if(!(O&&!Ms(j)||!d)&&(ne||V))return Vo.Transition.toString({...d,property:cd})}}function m4(t,n){var o,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(o=t==null?void 0:t.draggable)!=null?o:n.draggable,droppable:(r=t==null?void 0:t.droppable)!=null?r:n.droppable}}Ee.Down,Ee.Right,Ee.Up,Ee.Left;function g4({product:t,children:n}){const{attributes:o,listeners:r,setNodeRef:a,transform:i,transition:c,isDragging:l}=ld({id:t.id}),u={transform:Vo.Transform.toString(i),transition:c};return s.jsx("div",{ref:a,style:u,className:`${et.product} ${l?et.dragging:""}`,...o,...r,children:n})}const ud=t=>{const{isActiveItems:n,setIsActiveItems:o,items:r,setItems:a,other:i,title:c,subtitle:l,editable:u=!0,draggable:d=!1,withImage:h=!1,deletable:f=!0,addable:m=!0,itemsType:g,itemsPlaceholder:I="",itemsOptions:p,hasRangeSelector:C=!1,rangeSelectorOptions:b,modalOptions:S,addableOptions:x={},limit:T,autoInterval:_,tip:R,aspectRatio:v,setAspectRatio:P}=t,[N,M]=y.useState(null),[W,j]=y.useState({top:0,left:0}),[G,H]=y.useState(null),ce=y.useRef(null),[he,me]=y.useState(!1),Ce=Vu(Hu(Ya,{activationConstraint:{distance:5}}));y.useEffect(()=>{if(N){const O=[...r].map(X=>X.id===N.id?N:X);a(O)}},[N]),y.useEffect(()=>{if(ce.current&&G){const O=ce.current.getBoundingClientRect().height,X=window.innerHeight;let K=G.top;K+O>X+window.scrollY-200&&(K=X+window.scrollY-O-200),K<0&&(K=10),j({top:K-30,left:G.left})}},[ce.current,G]);const ye=(O,X)=>{O.stopPropagation();const K=O.target.getBoundingClientRect();H({top:K.top+window.scrollY-70,left:K.left-(m?30:65)}),M(X),me(!0)},$=(O,X)=>{const K=[...r],ie={...O,id:Math.random().toString(36).substr(2,9)};K.splice(X+1,0,ie),a(K)};function Y(O){if(h)return O?s.jsx("img",{src:`https://imagedelivery.net/${O[0]}/w=1000`,alt:"image",width:16,height:16}):s.jsx(Z,{name:"Image",width:16,height:16,fill:"#757575"})}const ne=O=>{const{active:X,over:K}=O;if(K&&X.id!==K.id){const ie=r.findIndex(z=>z.id===X.id),ue=r.findIndex(z=>z.id===K.id);if(ie!==-1&&ue!==-1){const z=[...r],[J]=z.splice(ie,1);z.splice(ue,0,J),a(z)}}},oe=(O,X)=>{var ie,ue;const K=s.jsxs(s.Fragment,{children:[d&&s.jsx("div",{children:s.jsx(Z,{name:"DotsSixVertical",hoverable:!0,width:20,height:20})}),g==="select"&&p&&s.jsx(oo,{onChange:z=>{const J=[...r],ke=p.find(xe=>xe.name["en-US"]===z);if(!ke)return;const V=J.map(xe=>xe.id===O.id?{...ke,name:{"en-US":z}}:xe);M({...O,name:{"en-US":z}}),a([...V])},value:O.name["en-US"],options:p.filter(z=>!r.find(J=>J.name["en-US"]===z.name["en-US"])).map(z=>z.name["en-US"]),leftAddonOptions:p.filter(z=>{var J;return((J=z.images)==null?void 0:J.length)>0}).map(z=>({value:z.name["en-US"],addon:Y(z.images)}))}),g==="selectInfiniteList"&&p&&s.jsx(ws,{onChange:z=>{const J=[...r],ke=p.find(xe=>xe.name["en-US"]===z);if(!ke)return;const V=J.map(xe=>xe.id===O.id?{...ke,name:{"en-US":z}}:xe);M({...O,name:{"en-US":z}}),a([...V])},value:O.name["en-US"],options:p.filter(z=>!r.find(J=>J.name["en-US"]===z.name["en-US"])).map(z=>z.name["en-US"]),leftAddonOptions:p.filter(z=>{var J;return((J=z.images)==null?void 0:J.length)>0}).map(z=>({value:z.name["en-US"],addon:Y(z.images)}))}),g==="input"&&s.jsx(ln,{onChange:z=>{const ke=[...r].map(V=>V.id===O.id?{...O,name:{"en-US":z}}:V);a([...ke])},value:O.name["en-US"],placeholder:I}),g==="image"&&s.jsx(Nr,{onChange:z=>{const ke=[...r].map(V=>V.id===O.id?{...O,images:z}:V);a([...ke])},activeImage:(ie=r.find(z=>z.id===O.id))!=null&&ie.images?(ue=r.find(z=>z.id===O.id))==null?void 0:ue.images[0]:void 0,tip:R}),s.jsxs("div",{className:et.buttons,children:[T&&T>r.length&&m&&s.jsx("div",{className:et.deleteButton,children:s.jsx(Z,{name:"Copy",hoverable:!0,width:20,height:20,onClick:()=>{$(O,X)}})}),u&&s.jsx("div",{className:et.deleteButton,children:s.jsx(Z,{name:"Sliders",hoverable:!0,width:20,height:20,onClick:z=>{ye(z,O)}})}),f&&s.jsx("div",{className:et.deleteButton,children:s.jsx(Z,{name:"Trash",hoverable:!0,width:20,height:20,fill:"#C12A2A",onClick:()=>a(r.filter(z=>z.id!==O.id))})})]})]});return d?s.jsx(g4,{product:O,index:X,children:K},O.id):s.jsx("div",{className:et.product,children:K},O.id)};return s.jsxs("div",{className:et.productsBlock,children:[(c||n!==void 0)&&s.jsxs("div",{className:et.top,children:[c&&s.jsx("h3",{className:et.title,children:c}),n!==void 0&&s.jsx(Dn,{current:n,onChange:O=>o==null?void 0:o(O)})]}),N&&u&&S&&he&&s.jsx(MI,{ref:ce,activeItem:N,setActiveItem:M,popupPosition:W,modalOptions:S,setIsOpenModal:me}),(n===void 0||n)&&C&&b&&s.jsx(dd,{...b}),(n===void 0||n)&&s.jsxs("div",{className:et.products,children:[l&&s.jsx("h5",{className:et.subtitle,children:l}),d?s.jsx(td,{sensors:Ce,onDragEnd:ne,children:s.jsx(sd,{items:r.map(O=>O.id),strategy:rd,children:r.map((O,X)=>oe(O,X))})}):r.map((O,X)=>oe(O,X)),m&&s.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:s.jsx(Ho,{withoutHover:!0,className:te(et.button,{[et.disabled]:!!(T&&T<=r.length||r.length===(p==null?void 0:p.length))}),size:"s",disabled:!!(T&&T<=r.length||r.length===(p==null?void 0:p.length)),onClick:()=>{const O=[...r];let X=null;if(p){for(let K=0;K<p.length;K++)if(!r.find(ie=>ie.id===p[K].id)){X=p[K];break}}g==="select"&&p?O.push({name:X?X.name:p[0].name,id:(X==null?void 0:X.id)||p[0].id,...x}):g==="input"?O.push({name:{"en-US":""},id:ze(),...x}):O.push({name:{"en-US":`Image ${r.length+1}`},id:ze(),...x}),a(O)},style:{width:"fit-content"},children:s.jsxs("div",{className:et.addButton,children:[s.jsx("span",{children:"Add Option"}),s.jsx(Z,{name:"Plus",width:16,height:16})]})})})]}),v&&P&&s.jsx(oo,{value:v,label:"Aspect Ratio",options:Object.keys(Gl),onChange:O=>P(O),leftAddonOptions:zl}),(n===void 0||n)&&i!==void 0&&s.jsx(Bu,{otherTitle:"Other",items:i}),(n===void 0||n)&&_!==void 0&&s.jsx(ln,{label:_.title||"Auto scroll interval",type:"number",value:String(_.autoInterval),onChange:O=>_.setAutoInterval(Number(O)),min:.1,max:100,style:{width:"100%"},postfix:"sec."})]})},I4="_title_cx65i_1",C4="_subtitle_cx65i_5",S4="_productsBlock_cx65i_14",y4="_top_cx65i_26",v4="_products_cx65i_14",b4="_product_cx65i_14",w4="_button_cx65i_80",x4="_disabled_cx65i_91",_4="_buttons_cx65i_118",T4="_modal_cx65i_125",k4="_link_cx65i_146",P4="_modalOptions_cx65i_152",L4="_addButton_cx65i_165",A4="_deleteButton_cx65i_180",E4="_closeIcon_cx65i_192",fo={title:I4,subtitle:C4,productsBlock:S4,top:y4,products:v4,product:b4,button:w4,disabled:x4,buttons:_4,modal:T4,link:k4,modalOptions:P4,addButton:L4,deleteButton:A4,closeIcon:E4},R4=y.forwardRef((t,n)=>{const{activeItem:o,setActiveItem:r,popupPosition:a,modalOptions:i,setIsOpenModal:c}=t;return $o(n,()=>{r(null),c(!1)}),s.jsxs("div",{ref:n,className:fo.modal,onClick:l=>{l.stopPropagation()},style:{top:`${a.top}px`,left:`${a.left}px`},children:[s.jsxs("div",{className:fo.top,children:[s.jsx("h3",{className:fo.title,children:o.name["en-US"]}),s.jsx("div",{className:fo.closeIcon,children:s.jsx(Z,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>{r(null),c(!1)}})})]}),s.jsx("div",{className:fo.modalOptions,children:i.map(l=>{if(l.type==="image")return s.jsx(Nr,{label:"Put up an attractive image",activeImage:o[l.field],onChange:u=>{const d={...o,[l.field]:u};r(d)}},String(l.field));if(l.type==="text")return s.jsx(As,{isActiveText:!0,typesText:o[l.field.type],setTypesText:u=>{const d={...o,[l.field.type]:u};r(d)},alignText:o[l.field.alignText],setAlignText:u=>{const d={...o,[l.field.alignText]:u};r(d)},text:o[l.field.text]["en-US"]||"",setText:u=>{const d={...o,[l.field.text]:{"en-US":u}};r(d)},typeFont:o[l.field.type],setTypeFont:u=>{const d={...o,[l.field.type]:u};r(d)},subtitle:l.label});if(l.type==="input")return s.jsx(ln,{onChange:u=>{const d={...o,[l.field]:{"en-US":u}};r(d)},value:o[l.field]["en-US"]||"",label:l.label,placeholder:l.placeholder});if(l.type==="inputNumber")return s.jsx(ln,{onChange:u=>{const d={...o,[l.field]:u};r(d)},value:o[l.field]||"",label:l.label,placeholder:l.placeholder,type:"number"});if(l.type==="inputSwitch")return s.jsxs("div",{className:fo.link,children:[s.jsx(ln,{onChange:u=>{const d={...o,[l.field.text]:{"en-US":u}};r(d)},value:o[l.field.text]["en-US"]||"",label:l.inputLabel,placeholder:l.placeholder}),s.jsx(Dn,{current:!!o[l.field.switch]||!1,label:l.switchLabel,onChange:u=>{const d={...o,[l.field.switch]:u};r(d)}})]});if(l.type==="select")return s.jsx(oo,{options:l.itemsOptions,onChange:u=>{const d={...o,[l.field]:u};r(d)},label:l.label,value:o[l.field]||"String",leftAddonOptions:l.leftAddonOptions})})})]})}),D4="_title_hvj8m_1",M4="_buttonsBlock_hvj8m_15",N4="_top_hvj8m_26",B4="_modal_hvj8m_120",F4="_options_hvj8m_146",j4="_closeIcon_hvj8m_154",Fo={title:D4,buttonsBlock:M4,top:N4,modal:B4,options:F4,closeIcon:j4},O4=y.forwardRef((t,n)=>{var x;const{activeButton:o,setActiveButton:r,popupPosition:a,editableLink:i=!0}=t,[c,l]=y.useState(o.typesText),[u,d]=y.useState(o.destination),[h,f]=y.useState(o.page),[m,g]=y.useState(o.link||""),[I,p]=y.useState(o.text||{"en-US":""}),[C,b]=y.useState(o.openInNewTab),{pages:S}=Zn();return $o(n,()=>{r(null)}),y.useEffect(()=>{r({...o,...{text:I,link:m,destination:u,typesText:c,page:h,openInNewTab:C}})},[c,u,m,I,h,C]),s.jsxs("div",{className:Fo.modal,onClick:T=>{T.stopPropagation()},style:{top:`${a.top}px`,left:`${a.left}px`},ref:n,children:[s.jsxs("div",{className:Fo.top,children:[s.jsx("h3",{className:Fo.title,children:o.type}),s.jsx("div",{className:Fo.closeIcon,children:s.jsx(Z,{name:"X",height:20,width:20,hoverable:!0,onClick:()=>r(null)})})]}),s.jsxs("div",{className:Fo.options,children:[i&&s.jsx(oo,{label:"Destination",onChange:T=>d(T),options:["Go to Page","Open Link"].filter(T=>T!==u),value:u}),i&&(u==="Go to Page"?s.jsx(oo,{label:"Go to",onChange:T=>{if(T==="Sign In")f("/customer-dash");else if(S){for(const _ in S)if(S[_].name===T){f(S[_].path);break}}else f(Zl[0])},options:S?[...Object.values(S).filter(T=>T.path!==h).map(T=>T.name),"Sign In"]:["Sign In"],value:S?h==="/customer-dash"?"Sign In":((x=Object.values(S).find(T=>T.path===h))==null?void 0:x.name)||"Home":"Home"}):s.jsx(ln,{onChange:T=>g(T),value:m,placeholder:"https://",label:"Link"})),i&&s.jsx(Dn,{current:o.openInNewTab,label:"Open in new tab",onChange:T=>b(T)}),s.jsx(Ps,{onChange:T=>p({"en-US":T}),value:I["en-US"],label:"Text"}),s.jsx(ks,{typesText:c,setTypesText:l})]})]})}),H4="_wrapper_m18qi_1",V4="_subtitle_m18qi_7",U4="_content_m18qi_14",$4="_range_m18qi_22",W4="_track_m18qi_27",q4="_progress_m18qi_36",Z4="_dots_m18qi_46",G4="_dot_m18qi_46",z4="_active_m18qi_65",Y4="_input_m18qi_77",X4="_countBlock_m18qi_91",K4="_controls_m18qi_107",J4="_button_m18qi_113",Et={wrapper:H4,subtitle:V4,content:U4,range:$4,track:W4,progress:q4,dots:Z4,dot:G4,active:z4,input:Y4,countBlock:X4,controls:K4,button:J4},dd=t=>{const{label:n,min:o=1,max:r=4,step:a=1,count:i,setCount:c}=t,[l,u]=y.useState(!1),d=Array.from({length:(r-o)/a+1}),h=(i-o)/(r-o)*100,f=()=>{i<r&&c(i+a)},m=()=>{i>o&&c(i-a)},g=I=>{const p=o+I*a;c(p)};return s.jsxs("div",{className:Et.wrapper,children:[n&&s.jsx("h5",{className:Et.subtitle,children:n}),s.jsxs("div",{className:Et.content,children:[s.jsxs("div",{className:Et.range,children:[s.jsx("div",{className:Et.track}),s.jsx("div",{className:Et.progress,style:{width:`${h}%`}}),s.jsx("div",{className:Et.dots,children:d.map((I,p)=>{const C=p<=(i-o)/a;return s.jsx("button",{onClick:()=>g(p),className:te(Et.dot,{[Et.active]:C,[Et.inactive]:!C,[Et.dragging]:l}),"aria-label":`Set value to ${o+p*a}`},p)})}),s.jsx("input",{type:"range",min:o,max:r,step:a,value:i,onChange:I=>c(Number(I.target.value)),onMouseDown:()=>u(!0),onMouseUp:()=>u(!1),onTouchStart:()=>u(!0),onTouchEnd:()=>u(!1),className:Et.input})]}),s.jsxs("div",{className:Et.countBlock,children:[s.jsx(ln,{type:"number",min:o,max:r,paddingless:!0,onChange:I=>{const p=Number(I);p>r?c(r):p<o?c(o):c(p)},value:String(i)}),s.jsxs("div",{className:Et.controls,children:[s.jsx("button",{onClick:f,disabled:i>=r,className:Et.button,"aria-label":"Increment count",children:s.jsx(Z,{name:"CaretUp",width:15,height:15})}),s.jsx("button",{onClick:m,disabled:i<=o,className:Et.button,"aria-label":"Decrement count",children:s.jsx(Z,{name:"CaretDown",width:15,height:15})})]})]})]})]})},Q4="_title_11jyy_1",eC="_subtitle_11jyy_5",tC="_productsBlock_11jyy_14",nC="_top_11jyy_26",oC="_products_11jyy_14",rC="_product_11jyy_14",aC="_button_11jyy_80",iC="_buttons_11jyy_114",sC="_modal_11jyy_121",cC="_modalOptions_11jyy_148",lC="_addButton_11jyy_161",uC="_deleteButton_11jyy_176",dC="_closeIcon_11jyy_188",fr={title:Q4,subtitle:eC,productsBlock:tC,top:nC,products:oC,product:rC,button:aC,buttons:iC,modal:sC,modalOptions:cC,addButton:lC,deleteButton:uC,closeIcon:dC},hd=({render:t,block:n})=>t(n),fd=({settings:t,pageContext:n})=>{const{footer:o}=$n(),{settings:r}=Er(),{pageContext:a}=Zn(),{footer:i}=bo();if(!i||!o)return null;const c=new i;return Object.keys(o).map(l=>{c[l]=o[l]}),c.renderBlock((t==null?void 0:t.blockSettings)||r,n||a)},pd=({settings:t,pageContext:n})=>{const{header:o}=$n(),{settings:r}=Er(),{pageContext:a}=Zn(),{header:i}=bo();if(!i||!o)return null;const c=new i;return Object.keys(o).map(l=>{c[l]=o[l]}),c.renderBlock((t==null?void 0:t.blockSettings)||r,n||a)},md=({settings:t,pageContext:n})=>{const{announcement:o}=$n(),{settings:r}=Er(),{pageContext:a}=Zn(),{announcement:i}=bo();if(!i||!o)return null;const c=new i;return Object.keys(o).map(l=>{c[l]=o[l]}),c.renderBlock(t||r,n||a)},hC=async t=>{var c,l;const n=Ye.getState().apiUrls,o=ut?localStorage.getItem("fakeDomain")||"flagship-theme.pages.dev":window.location.hostname,r=To.getState(),a=localStorage.getItem("shopPassword");if((c=r.general)!=null&&c.info.passwordProtected&&!a)return null;const i=`${n.storeApi}/v2/shops/${o}/pages/${t}`+((l=r.general)!=null&&l.info.passwordProtected?`?password=${a}`:"");try{return await je({url:i,withToken:!0,method:"get"})}catch(u){if(He.isAxiosError(u)&&u.response&&u.response.status===404)return null}},fC="_wrapper_5w9s8_1",pC={wrapper:fC},os=t=>{const{error:n}=t;return s.jsx("div",{className:pC.wrapper,children:n})},mC=async t=>{const n=Ye.getState().apiUrls,o=ut?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${n.slApi}/v1/balance/top-up/${o}`;return await je({url:r,method:"post",body:t,withToken:!1})},Yo=async t=>{const n=Ye.getState().apiUrls,o=ut?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${n.customersApi}/v2/${o}/customers/${t}`;return await je({url:r,withToken:!0,method:"get",typeToken:"customer"})},gC=()=>Yo("dash/info"),IC=()=>Yo("dash/dashboard/home"),CC=()=>Yo("rewards"),SC=()=>Yo("balance"),yC=()=>Yo("balance/top-up/settings"),vC=()=>Yo("referral-system"),rs=10,Ja=async({url:t,PageNumber:n})=>{var l;const o=Ye.getState().apiUrls,r=ut?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${o.customersApi}/v2/${r}/${t}?PageNumber=${n}&PageSize=${rs}`,i=await je({url:a,withToken:!0,method:"get",typeToken:"customer"}),c=Number((l=i.headers)==null?void 0:l["x-pagination-total"]);return{list:i.data,totalCount:c}},js=async(t,n="get",o)=>{const r=Ye.getState().apiUrls,a=ut?localStorage.getItem("fakeDomain"):window.location.hostname,i=`${r.slApi}/v1/orders/${a}/${t}`;return await je({url:i,method:n,withToken:!0,body:o,typeToken:"customer"})},bC=t=>js("","post",t),wC=({PageNumber:t})=>Ja({url:"customers/orders",PageNumber:t}),xC=t=>js(t),_C=t=>js(t),TC=async t=>{const n=Ye.getState().apiUrls,o=ut?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${n.slApi}/v1/${o}/subscriptions`;return await je({url:r,method:"post",withToken:!1,body:t})},kC=async(t,n)=>{const o=Ye.getState().apiUrls,r=ut?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${o.slApi}/v2/${r}/subscriptions/${t}/${n}`;return await je({url:a,method:"get",withToken:!1})},PC=async(t,n)=>{const o=Ye.getState().apiUrls,r=ut?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${o.slApi}/v1/${r}/subscriptions/${t}/${n}/upgrades`;return await je({url:a,method:"get",withToken:!1})},LC=async(t,n,o)=>{const r=Ye.getState().apiUrls,a=ut?localStorage.getItem("fakeDomain"):window.location.hostname,i=`${r.slApi}/v1/${a}/subscriptions/${t}/${n}/cancel`;return await je({url:i,method:"post",withToken:!1,body:o})},AC=async(t,n)=>{const o=Ye.getState().apiUrls,r=ut?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${o.slApi}/v2/${r}/subscriptions/${t}/change-gateway`;return await je({url:a,method:"post",withToken:!1,body:{gateway:n}})},EC=({PageNumber:t})=>Ja({url:"customers/subscriptions",PageNumber:t}),RC=async({id:t,accessToken:n})=>await PC(t,n),DC=async(t,n)=>{const o=Ye.getState().apiUrls,r=ut?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${o.slApi}/v2/${r}/subscriptions/${t}/order`;return await je({url:a,method:"post",withToken:!1,body:n})},MC=async(t,n)=>{const o=Ye.getState().apiUrls,r=ut?localStorage.getItem("fakeDomain"):window.location.hostname,a=`${o.slApi}/v1/public/${r}/tickets/${t}/${n}`;return await je({url:a,method:"get",withToken:!1})},NC=async(t,n,o,r,a)=>{const i=Ye.getState().apiUrls,c=ut?localStorage.getItem("fakeDomain"):window.location.hostname,l=`${i.slApi}/v1/public/${c}/tickets/${t}/${n}/answer`;return(await je({url:l,method:"post",body:{message:o,recaptcha:r,tsId:a},withToken:!1})).data},BC=({PageNumber:t})=>Ja({url:"customers/tickets",PageNumber:t}),FC=({PageNumber:t})=>Ja({url:"customers/balance/transactions",PageNumber:t}),gd=async t=>{const n=Ye.getState().apiUrls,o=t.map(c=>["names",c]),r=new URLSearchParams(o),a=ut?localStorage.getItem("fakeDomain"):window.location.hostname,i=`${n.slApi}/v2/gateways?shopDomain=${a}&${r.toString()}`;return await je({url:i,method:"get",withToken:!1})},jC=async({email:t,recaptcha:n,tsId:o})=>{const r=Ye.getState().apiUrls,a=ut?localStorage.getItem("fakeDomain"):window.location.hostname,i=`${r.customersApi}/v2/${a}/auth/otp/request`;return(await je({url:i,body:{email:t,recaptcha:n,tsId:o},method:"post",withToken:!1})).data?{requested:!0,email:t}:{requested:!1,email:void 0}},OC=async({email:t,otp:n,recaptcha:o,tsId:r})=>{const a=Ye.getState().apiUrls,i=ut?localStorage.getItem("fakeDomain"):window.location.hostname,c=`${a.customersApi}/v2/${i}/auth/otp/login`,{data:l}=await je({url:c,method:"post",body:{email:t,otp:n,recaptcha:o,tsId:r},withToken:!1});return ko.getState().setToken(l.data),localStorage.setItem("token",l.data),{token:l.data,requested:!1}},HC=async()=>{ko.getState().setToken(""),localStorage.removeItem("token")},VC=async t=>{const n=Ye.getState().apiUrls,o=ut?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${n.slApi}/v2/coupons/${o}/validate`;return await je({url:r,method:"post",body:t,withToken:!1})},UC=async t=>{const n=Ye.getState().apiUrls,o=ut?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${n.customersApi}/v2/${o}/customers/referral-system/signup`;return(await je({url:r,withToken:!0,method:"post",body:t,typeToken:"customer"})).data},$C=async()=>{const{data:t}=await vC();return t},WC=async t=>{const{data:n}=await UC(t);return n};async function qC(t){const n=Ye.getState().apiUrls,o=ut?localStorage.getItem("fakeDomain"):window.location.hostname,r=`${n.customersApi}/v2/${o}/customers/rewards/${t.id}/claim`;return je({url:r,method:"post",withToken:!0,typeToken:"customer"})}const bi="Balance",ZC={Number:"NUMBER",Textarea:"LARGE_TEXT",Checkbox:"CHECK_BOX",Hidden:"HIDDEN"},GC={recaptcha:"",gateway:"",paymentMethod:"",parts:[],customFields:{},discordSocialConnectId:null,coupon:null,tsId:""},al=(t,n)=>{var d;const{productId:o,productVariantId:r,quantity:a,chargeType:i}=n,c=t.find(h=>h.id===o);if(!c)throw new Error("Product does not exist");const l=c.variants.find(h=>h.id===r);if(!l)throw new Error("Variant does not exist");if(i==="RECURRING"&&!l.subscriptionSettings)throw new Error("Variant does not have subscription settings");if(a!==void 0&&((d=l.quantity)!=null&&d.available)&&l.quantity.available<a)throw new Error("Not enough quantity available");const u=Un.getState().cart;if(u.parts.length>0){const h=t.find(m=>m.id===u.parts[0].productId),f=h==null?void 0:h.variants.find(m=>m.id===u.parts[0].productVariantId);if(f&&l.price.currency!==f.price.currency)throw new Error("Product have different currency")}return l},zC=(t,n)=>t.reduce((o,r)=>{var d,h;const a=n.find(f=>(f==null?void 0:f.id)===r.productId),i=a==null?void 0:a.variants.find(f=>f.id===r.productVariantId),{gateway:c}=Un.getState().cart,l=(i==null?void 0:i.gateways)||[],u=l.some(f=>f.name===c&&f.overrodePrice)?(d=l.find(f=>f.name===c))==null?void 0:d.overrodePrice:null;return r.chargeType==="ONE_TIME"?o+((u==null?void 0:u.amount)||(i==null?void 0:i.price.amount)||0)*r.quantity:i!=null&&i.subscriptionSettings?o+i.subscriptionSettings.price.amount+(((h=i.subscriptionSettings.entryFee)==null?void 0:h.amount)||0):o},0),YC=(t,n)=>({isRequired:n.some(r=>{var i;const a=t.find(c=>(c==null?void 0:c.id)===r.productId);return(i=a==null?void 0:a.variants.find(c=>c.id===r.productVariantId))==null?void 0:i.discordSettings.isRequired}),isEnabled:n.some(r=>{var i;const a=t.find(c=>(c==null?void 0:c.id)===r.productId);return(i=a==null?void 0:a.variants.find(c=>c.id===r.productVariantId))==null?void 0:i.discordSettings.isEnabled})}),il=t=>new Set(t.gateways.map(n=>n.name)),sl={availableGateways:[],requiresSignInGateways:[]},cl=(t,n)=>{var i;if(n.length===0)return sl;const o=(i=n[0])==null?void 0:i.variants[0];if(!o)return sl;const r=il(o);for(const c of t){const l=n.find(h=>h.id===c.productId);if(!l)continue;const u=l.variants.find(h=>h.id===c.productVariantId);if(!u)continue;const d=il(u);for(const h of r)d.has(h)||r.delete(h)}return!localStorage.getItem("token")&&r.has(bi)?(r.delete(bi),{availableGateways:[...r],requiresSignInGateways:[bi]}):{availableGateways:[...r],requiresSignInGateways:[]}},XC=(t,n)=>{if(t.length===0)return[];const r=t.map(i=>{const c=n.find(u=>u.id===i.productId),l=c==null?void 0:c.variants.find(u=>u.id===i.productVariantId);return(l==null?void 0:l.customFields)??[]}).flat().reduce((i,c)=>{const l=i[c.name];return l?(c.required&&!l.required&&(i[c.name]={...c,value:c.defaultValue}),i):(i[c.name]={...c,value:c.defaultValue},i)},{});return Object.values(r).map(i=>({...i,value:""}))},KC=(t,n)=>{const o=n.find(a=>a.id===t.productId),r=o==null?void 0:o.variants.find(a=>a.id===t.productVariantId);return t.chargeType==="RECURRING"?!!(r!=null&&r.subscriptionSettings):!1},JC=()=>{const{cart:t,products:n,coupon:o,pending:r,applyCouponPending:a,customerEmail:i,setCart:c,setProducts:l,setCoupon:u,setPending:d,setApplyCouponPending:h}=Un(),f=async p=>{var v;h(!0);const{cart:C}=Un.getState(),{gateway:b,parts:S}=C,{notifications:x,setNotifications:T}=Dt.getState();b||(h(!1),T([...x,{message:"There should be a gateway for the coupon",status:"error",id:ze()}]));const _=S.map(P=>P.productId);let R=null;try{const{data:P}=await VC({gateway:b,couponName:p,productIds:_});R=P.data,T([...x,{message:"Coupon is applied",status:"success",id:ze()}]),c(N=>({...N,coupon:p}))}catch(P){const N=P;T([...x,{message:`Coupon is not applied: ${N.message}`,status:"error",id:ze()}]),c(M=>({...M,coupon:null})),u(null),h(!1)}if(h(!1),(v=R==null?void 0:R.restrictToProductIds)!=null&&v.length&&!_.every(P=>{var N;return(N=R==null?void 0:R.restrictToProductIds)==null?void 0:N.includes(P)}))throw new Error("Coupon can't be applied to such products");return u(R),R},I={reset(){c({...GC})},addProducts:p=>{const C=Un.getState().products,b=p.filter(S=>!C.some(x=>x.id===S.id));l([...C,...b])},addProductToCart:p=>{const C=Un.getState().cart;try{al(n,p)}catch(S){throw new Error(S)}const b=C.parts.find(S=>S.productId===p.productId&&S.productVariantId===p.productVariantId&&S.chargeType===p.chargeType);if(b)return I.updateQuantityOfProduct({...b,quantity:(b.quantity||1)+(p.quantity||1),chargeType:p.chargeType});if(C.parts.length&&!cl([...C.parts,p],n).availableGateways.length)throw new Error("No common payment gateways available");c({...C,parts:[...C.parts,p]})},removeProduct({productId:p,productVariantId:C}){c(b=>({...b,parts:b.parts.filter(S=>S.productId!==p||S.productVariantId!==C)}))},getPossibleGateways(){return cl(t.parts,n)},removeCoupon(){u(null)},getDiscordSettings(){return YC(n,t.parts)},updateQuantityOfProduct(p){al(n,p),c(C=>({...C,parts:C.parts.map(b=>b.productId===p.productId&&b.productVariantId===p.productVariantId?{...b,quantity:p.quantity,chargeType:p.chargeType}:b)}))},getTotalAndDiscount(){const{coupon:p}=Un.getState(),C=zC(t.parts,n);let b;return p&&p.discount&&(!p.isFixed&&p.discount===100?b=0:b=p.isFixed?Math.max(0,C-p.discount):C*(1-p.discount/100)),{total:C,totalWithDiscount:b}},setGateway(p){c(C=>({...C,gateway:p})),t.coupon&&f(t.coupon)},setPaymentMethod(p){c(C=>({...C,paymentMethod:p}))},async submitCart(p){d(!0);const{cart:C}=Un.getState(),{discordInfo:b}=Ru.getState();let S;if(C.parts&&i&&KC(C.parts[0],n))try{const{data:x}=await TC({...C,partOrder:C.parts[0],referralCode:localStorage.getItem("referralCode"),discordSocialConnectId:b!=null&&b.authorized?b.id:null,customerEmail:i,recaptcha:p,customFields:{...C.customFields},tsId:ro()});S=x.data}catch(x){console.error(x)}else try{const{data:x}=await bC({...C,referralCode:localStorage.getItem("referralCode"),recaptcha:p,customFields:{...C.customFields},tsId:ro(),discordSocialConnectId:b!=null&&b.authorized?b.id:null});S=x.data}catch(x){const{notifications:T,setNotifications:_}=Dt.getState();_([...T,{message:`Failed to create order: ${x}`,status:"error",id:ze()}])}if(d(!1),S)return S;throw new Error("Failed to create order")},setDiscordSocialConnectId(p){c(C=>({...C,discordSocialConnectId:p}))},setCustomFields(p){c(C=>({...C,customFields:{...p}}))}};return y.useEffect(()=>{c(p=>({...p,customerEmail:i??""}))},[i,c]),{cart:t,products:n,coupon:o,pending:r,applyCouponPending:a,applyCoupon:f,...I}},Qa=()=>{const{notifications:t,setNotifications:n}=Dt();return o=>{navigator.clipboard.writeText(o),n([...t,{status:"success",message:"Successfully copied",id:ze()}])}};function Id(t,n=!0){if(!t||typeof t!="string")return"";if(/<[a-z][\s\S]*>/i.test(t))return t;const r=t.split(" "),a=20;if(n){let i="",c=[];return r.forEach(l=>{l.length>a?(c.length>0&&(i+=`<span style="hyphens: manual">${c.join(" ")} </span>`,c=[]),i+=`<span style="hyphens: auto" lang="en">${l} </span>`):c.push(l)}),c.length>0&&(i+=`<span style="hyphens: manual">${c.join(" ")}</span>`),i}else{const i=[];let c=[],l=0;return r.forEach(u=>{u.length>a?(c.length>0&&(i.push(s.jsxs("span",{style:{hyphens:"manual"},children:[c.join(" ")," "]},l++)),c=[]),i.push(s.jsxs("span",{style:{hyphens:"auto"},lang:"en",children:[u," "]},l++))):c.push(u)}),c.length>0&&i.push(s.jsx("span",{style:{hyphens:"manual"},children:c.join(" ")},l++)),i}}const QC=y.forwardRef((t,n)=>{const{activeItem:o,setActiveItem:r,popupPosition:a,setIsOpenModal:i,itemsOptions:c}=t,l=c.find(u=>u.id===o.listingId);return $o(n,()=>{r(null),i(!1)}),l?s.jsxs("div",{className:fr.modal,onClick:u=>{u.stopPropagation()},style:{top:`${a.top}px`,left:`${a.left}px`},children:[s.jsxs("div",{className:fr.top,children:[s.jsx("h3",{dangerouslySetInnerHTML:{__html:Id(l.productData.name)}}),s.jsx("div",{className:fr.closeIcon,children:s.jsx(Z,{name:"X",height:20,width:20,onClick:()=>{i(!1),r(null)}})})]}),s.jsx("div",{className:fr.modalOptions,children:s.jsx(Nr,{label:"Put up an attractive image",activeImage:l.productData.images.length>0?l.productData.images[0].cfId:o.image?o.image:void 0,onChange:u=>{const d={...o,image:u[0]};r(d)}})})]}):null}),e0="_wrapper_235d9_1",t0="_label_235d9_9",n0="_input_235d9_18",o0="_disabled_235d9_31",r0="_paddingless_235d9_36",a0="_content_235d9_40",i0="_contentBorder_235d9_53",s0="_contentField_235d9_58",c0="_borderless_235d9_62",l0="_rightIcon_235d9_67",u0="_leftIcon_235d9_75",d0="_requiredStar_235d9_82",Vt={wrapper:e0,label:t0,input:n0,disabled:o0,paddingless:r0,content:a0,contentBorder:i0,contentField:s0,borderless:c0,rightIcon:l0,leftIcon:u0,requiredStar:d0},_o=t=>{const{onChange:n,style:o,label:r,value:a,type:i="text",min:c,max:l,placeholder:u,disabled:d=!1,required:h=!1,regex:f,paddingless:m=!1,borderless:g=!1,editable:I=!1,isSearch:p=!1,centered:C=!1,maxSymbols:b,rightIcon:S,onFocus:x,leftIcon:T}=t,{themeSettings:_}=wo(),{inputs:R}=_,[v,P]=y.useState(!1);function N(W){if(Number(W)<0)return String(c);const j=W.replace(/[^\d-]/g,"");return Number(j)<0?String(c):j}function M(W){return!h||!f?!0:new RegExp(f).test(W)}return s.jsxs("div",{className:Vt.wrapper,children:[r&&s.jsxs("label",{className:Vt.label,htmlFor:r,children:[r,h&&s.jsx("span",{className:Vt.requiredStar,children:"*"})]}),s.jsxs("div",{className:te(Vt.content,{[Vt.contentBorder]:R.border.active,[Vt.contentField]:R.field.active,[Vt.disabled]:d}),style:{...o},children:[T&&s.jsx("div",{className:Vt.leftIcon,children:T}),s.jsx("input",{maxLength:b,id:r,type:i||"text",onChange:W=>{if(i==="text")n(W.target.value);else{const j=N(W.target.value);n(j)}},value:a,autoComplete:"off",placeholder:u||"Type something...",className:te(Vt.input,{[Vt.required]:v&&h&&!M(a),[Vt.paddingless]:m,[Vt.borderless]:g}),min:i==="number"?c:void 0,max:i==="number"?l:void 0,onFocus:()=>{x&&x(),P(!0)},disabled:d,style:{textAlign:C?"center":"left",padding:p?`7px ${Number(R.general.size)+20}px 7px ${T?35:11}px`:`7px ${S?35:11}px 7px ${T?35:11}px`}}),S&&s.jsx("div",{className:Vt.rightIcon,children:S}),p&&s.jsx("div",{className:Vt.rightIcon,children:s.jsx(Z,{name:"MagnifyingGlass",fill:"var(--text-secondary)",width:R.general.size,height:R.general.size})}),I&&s.jsx("div",{children:s.jsx(Z,{name:"Sliders",width:20,height:20,hoverable:!0})})]})]})},h0="_button_3j1b9_1",f0="_primary_3j1b9_20",p0="_primaryHovered_3j1b9_30",m0="_secondary_3j1b9_35",g0="_secondaryHovered_3j1b9_45",I0="_tertiary_3j1b9_50",C0="_special_3j1b9_60",S0="_tertiaryHovered_3j1b9_64",y0="_content_3j1b9_69",On={button:h0,primary:f0,primaryHovered:p0,secondary:m0,secondaryHovered:g0,tertiary:I0,special:C0,tertiaryHovered:S0,content:y0},v0=()=>typeof document<"u"?document.documentElement.hasAttribute("translated")||document.documentElement.querySelector(".translated-ltr, .translated-rtl")!==null||document.head.querySelector('meta[name="_translator"]')!==null:!1,Cd=({children:t,className:n,as:o="span",...r})=>{const[a,i]=y.useState(!1);return y.useEffect(()=>{typeof window<"u"&&i(v0())},[]),a?s.jsx(o,{className:n,...r,"data-stable-text":t,dangerouslySetInnerHTML:{__html:""}}):s.jsx(o,{className:n,...r,children:t})},lt=t=>{const{children:n,onClick:o,style:r,className:a,disabled:i=!1,type:c="Primary",dangerouslySetInnerHTML:l}=t,{themeSettings:u}=wo(),d=I=>typeof I=="string"?s.jsx(Cd,{children:I}):I,h={onClick:o,disabled:i,style:r,className:te(On.button,a,{[On.primary]:c==="Primary",[On.secondary]:c==="Secondary",[On.tertiary]:c==="Tertiary",[On.primaryHovered]:c==="Primary"&&!i&&u.buttons.primary.hover,[On.secondaryHovered]:c==="Secondary"&&!i&&u.buttons.secondary.hover,[On.tertiaryHovered]:c==="Tertiary"&&!i&&u.buttons.tertiary.hover})};if(c==="Special")return s.jsx("button",{...h,className:On.special,...l?{dangerouslySetInnerHTML:l}:{children:d(n)}});const f=c.toLowerCase(),m=u.buttons[f],g=c==="Tertiary"?s.jsxs("div",{className:On.content,children:[d(n),s.jsx(Z,{name:"ArrowRight",fill:"var(--text-tertiary)",width:20,height:20})]}):d(n);return s.jsx("button",{...h,style:{...r,textAlign:m.alignment},...l?{dangerouslySetInnerHTML:l}:{children:g}})},b0="_modal_1iz94_1",w0="_padding_1iz94_17",x0="_content_1iz94_21",_0="_close_1iz94_42",Qr={modal:b0,padding:w0,content:x0,close:_0},ei=t=>{const{close:n,children:o,withAnimation:r=!0,hasPadding:a=!0}=t,{isOpen:i,setIsOpen:c}=Gn(),l=()=>{c(!1),r?setTimeout(()=>{n(!1),c(!0)},300):(n(!1),c(!0))};return y.useEffect(()=>{const u=d=>{d.key==="Escape"&&l()};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}},[]),Io.createPortal(s.jsx("div",{className:te(Qr.modal,{[Qr.padding]:a}),onClick:l,children:r?s.jsx("div",{className:te(Qr.content,{[Qr.close]:!i}),children:o}):s.jsx(s.Fragment,{children:o})}),document.body)},Sd=({children:t,path:n,className:o,target:r="_self",id:a})=>{if(window.location.pathname.includes("/admin/builder"))return s.jsx("div",{className:o,role:"link",style:{cursor:"pointer"},id:a,children:t});const i=Rn(),c=/^https?:\/\//.test(n),l=u=>{c||r==="_blank"?r==="_blank"?window.open(n,"_blank"):window.open(n,"_self"):(u.preventDefault(),i(n,{replace:!1}))};return s.jsx("div",{onClick:l,className:o,role:"link",style:{cursor:"pointer"},id:a,children:t})},T0="_loader_3je9m_1",k0={loader:T0},dn=t=>s.jsx("div",{className:k0.loader,...t}),P0="_container_6vcrl_1",L0="_wrapper_6vcrl_5",ll={container:P0,wrapper:L0};class A0{constructor(){Qo(this,"observer",null);Qo(this,"callbacks",new Map);Qo(this,"handleWindowResize",()=>{this.callbacks.forEach((n,o)=>{const r=o.getBoundingClientRect().width;n.forEach(a=>a(r))})});this.observer=new ResizeObserver(n=>{var o;for(const r of n){const a=r.contentRect.width,i=r.target;this.callbacks.has(i)&&((o=this.callbacks.get(i))==null||o.forEach(c=>c(a)))}}),window.addEventListener("resize",this.handleWindowResize)}observe(n,o){var a;if(!this.observer)return;this.callbacks.has(n)||(this.callbacks.set(n,[]),this.observer.observe(n)),(this.callbacks.get(n)||[]).includes(o)||(a=this.callbacks.get(n))==null||a.push(o)}unobserve(n,o){var r;if(!(!this.observer||!this.callbacks.has(n))){if(o){const a=this.callbacks.get(n)||[];this.callbacks.set(n,a.filter(i=>i!==o))}(r=this.callbacks.get(n))!=null&&r.length||(this.callbacks.delete(n),this.observer.unobserve(n))}}disconnect(){this.observer&&(this.observer.disconnect(),this.observer=null),this.callbacks.clear(),window.removeEventListener("resize",this.handleWindowResize)}}const ul=new A0;function yd(t){const[n,o]=y.useState("desktop");return y.useEffect(()=>{const r=t.current;if(!r)return;const a=l=>l>=1081?"desktop":l>=720?"tablet":"mobile",i=l=>{const u=a(l);o(u)};ul.observe(r,i);const c=r.getBoundingClientRect().width;return i(c),()=>{ul.unobserve(r,i)}},[t]),n}const ea=16,vd=({children:t,padding:n,style:o,notPadding:r=!1})=>{const a=y.useRef(null),i=yd(a);return s.jsx("div",{className:ll.container,ref:a,style:o,children:s.jsx("div",{className:ll.wrapper,style:{maxWidth:"var(--max-width-store)",paddingTop:i==="desktop"?n==null?void 0:n.top:r?0:ea,paddingBottom:i==="desktop"?n==null?void 0:n.bottom:r?0:ea,paddingLeft:i==="desktop"?n==null?void 0:n.left:r?0:ea,paddingRight:i==="desktop"?n==null?void 0:n.right:r?0:ea,...o},children:t(i)})})},E0="_wrapper_oxpf7_1",R0="_label_oxpf7_10",D0="_contentBorder_oxpf7_19",M0="_textarea_oxpf7_23",N0="_contentField_oxpf7_35",B0="_length_oxpf7_49",uo={wrapper:E0,label:R0,contentBorder:D0,textarea:M0,contentField:N0,length:B0},F0=t=>{const{onChange:n,label:o,value:r,maxLength:a,placeholder:i="Type something...",type:c="text",required:l=!1}=t,[u,d]=y.useState(r.length),{themeSettings:h}=wo();function f(m){return c==="number"?m.replace(/[^\d\n]+/g,""):m}return s.jsxs("div",{className:uo.wrapper,children:[o&&s.jsxs("label",{className:uo.label,htmlFor:o,children:[o,l&&s.jsx("span",{className:uo.requiredStar,children:"*"})]}),s.jsx("textarea",{id:o,value:r,onChange:m=>{const g=f(m.target.value);d(g.length),n(g)},placeholder:i,className:te(uo.textarea,{[uo.contentBorder]:h.inputs.border.active,[uo.contentField]:h.inputs.field.active}),maxLength:a}),a&&s.jsxs("div",{className:uo.length,children:[u,"/",a]})]})},j0="_wrapper_ty9h3_2",O0="_label_ty9h3_9",H0="_top_ty9h3_17",V0="_select_ty9h3_23",U0="_borderFocused_ty9h3_42",$0="_input_ty9h3_49",W0="_icon_ty9h3_59",q0="_rotate_ty9h3_64",Z0="_content_ty9h3_68",G0="_options_ty9h3_72",z0="_filteredOptions_ty9h3_93",Y0="_open_ty9h3_97",X0="_option_ty9h3_72",K0="_focused_ty9h3_115",J0="_addon_ty9h3_119",Q0="_value_ty9h3_130",e3="_postfix_ty9h3_135",t3="_leftAddon_ty9h3_139",vt={wrapper:j0,label:O0,top:H0,select:V0,borderFocused:U0,input:$0,icon:W0,rotate:q0,content:Z0,options:G0,filteredOptions:z0,open:Y0,option:X0,focused:K0,addon:J0,value:Q0,postfix:e3,leftAddon:t3};function n3(t,n){y.useEffect(()=>{function o(r){!t.current||t.current.contains(r.target)||n(r)}return document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[t,n])}const bd=t=>{var P,N;const{onChange:n,label:o,value:r,options:a,style:i,switcher:c,postfixs:l,leftAddonOptions:u}=t,[d,h]=y.useState(!1),[f,m]=y.useState(""),[g,I]=y.useState(null),[p,C]=y.useState(!1),b=y.useRef(null);n3(b,()=>h(!1));function S(M){m(""),n(M),h(!1),I(null)}function x(M,W){return M?M.length>W+3?`${M.slice(0,W)}...`:M:""}function T(M){if(!d){(M.key==="Enter"||M.key==="ArrowDown")&&h(!0);return}const W=v;M.key==="ArrowDown"&&(M.preventDefault(),I(j=>j===null||j===W.length-1?0:j+1)),M.key==="ArrowUp"&&(M.preventDefault(),I(j=>j===null||j===0?W.length-1:j-1)),M.key==="Enter"&&g!==null&&(M.preventDefault(),S(W[g])),M.key==="Escape"&&h(!1)}const _=y.useRef(null),R=y.useMemo(()=>new zn(a,{threshold:.4,minMatchCharLength:2}),[a]),v=y.useMemo(()=>p&&f.trim()!==""?R.search(f).map(M=>M.item):a,[f,a,p,R]);return s.jsxs("div",{className:vt.wrapper,style:{...i},children:[o&&s.jsxs("div",{className:vt.top,children:[s.jsx("label",{className:vt.label,htmlFor:o,children:o}),c&&s.jsx(Dn,{current:c.value,onChange:c.onChange})]}),s.jsxs("label",{className:vt.content,ref:b,children:[s.jsxs("div",{className:te(vt.select,{[vt.borderFocused]:d}),onKeyDown:T,onClick:M=>{M.stopPropagation(),h(W=>!W),C(!1)},ref:_,tabIndex:0,children:[u&&u.length>0&&s.jsx("div",{className:vt.addon,children:(P=u.find(M=>M.value===r))==null?void 0:P.addon}),s.jsx("div",{className:vt.input,id:"md",children:x(r,15)}),s.jsx("div",{className:te(vt.icon,{[vt.rotate]:d}),onClick:M=>{M.stopPropagation(),h(W=>!W)},children:s.jsx(Z,{name:"CaretDown",width:16,height:16,fill:"var(--text-primary)"})})]}),s.jsxs("div",{className:te(vt.options,{[vt.open]:d}),style:{top:((N=_.current)==null?void 0:N.clientHeight)+10},children:[a.length>6&&s.jsx(_o,{type:"text",value:f,placeholder:"Search...",onChange:M=>{m(M),C(!0)},isSearch:!0}),s.jsxs("div",{className:vt.filteredOptions,children:[v.map((M,W)=>{var j;return s.jsxs("div",{className:te(vt.option,{[vt.focused]:W===g}),onClick:()=>{S(M),h(!1)},id:"md",children:[u&&u.length>0&&s.jsx("div",{className:vt.leftAddon,children:(j=u.find(G=>G.value===M))==null?void 0:j.addon}),s.jsx("span",{className:vt.value,id:"md",children:x(M,20)}),l&&s.jsx("span",{className:vt.postfix,id:"md",children:l[W]})]},M)}),v.length===0&&s.jsx("div",{children:"No results found."})]})]})]})]})},o3="_wrapper_2vleg_1",r3="_label_2vleg_9",a3="_options_2vleg_17",i3="_radioLabel_2vleg_23",s3="_radio_2vleg_23",c3="_custom_2vleg_38",l3="_option_2vleg_17",ho={wrapper:o3,label:r3,options:a3,radioLabel:i3,radio:s3,custom:c3,option:l3},u3=t=>{const{defaultValue:n,options:o,onChange:r,label:a,flexDirection:i="row"}=t,[c,l]=y.useState(n),u=d=>{const h=d.target.value;l(h),r(h)};return s.jsxs("div",{className:ho.wrapper,children:[s.jsx("span",{className:ho.label,children:a}),s.jsx("div",{className:ho.options,style:{flexDirection:i},children:o.map(d=>s.jsxs("label",{className:ho.radioLabel,children:[s.jsx("input",{type:"radio",value:d.value,checked:c===d.value,onChange:u,className:ho.radio}),s.jsx("span",{className:ho.custom}),s.jsx("span",{className:ho.option,children:d.label})]},d.value))})]})},d3="_content_eonwv_1",h3="_main_eonwv_12",f3="_block_eonwv_16",p3="_active_eonwv_22",m3="_name_eonwv_32",g3="_addSection_eonwv_109",I3="_addSectionTop_eonwv_117",Xn={content:d3,main:h3,block:f3,active:p3,name:m3,addSection:g3,addSectionTop:I3},C3="_sidebar_xhqpt_1",S3="_content_xhqpt_14",y3="_button_xhqpt_24",v3="_moveButton_xhqpt_40",b3="_deleteButton_xhqpt_49",Tn={sidebar:C3,content:S3,button:y3,moveButton:v3,deleteButton:b3},w3=()=>{var _;const{activeBlock:t,setActiveBlock:n}=Va(),{blocks:o,removeBlock:r,moveBlock:a,duplicateBlock:i,setCurrentBlock:c}=$n(),{currentPage:l,pages:u}=Zn(),{setTitle:d,setDescription:h,setOnConfirm:f}=Xl(),{setActiveBlock:m}=bo(),g=(_=u==null?void 0:u[l])==null?void 0:_.path,I=g?o[g]:null,p=(I==null?void 0:I.order)||[],C=p.indexOf(t.id),b=R=>{R.stopPropagation(),C>0&&g&&(a(g,C,C-1),n({id:t.id,neededScroll:!0}),setTimeout(()=>{n({id:t.id,neededScroll:!1})},100))},S=R=>{R.stopPropagation(),C<p.length-1&&g&&(a(g,C,C+1),n({id:t.id,neededScroll:!0}),setTimeout(()=>{n({id:t.id,neededScroll:!1})},100))},x=R=>{R.stopPropagation(),g&&i(g,t.id)},T=()=>{g&&(r(g,t.id),c(null),m(null),n({id:null,neededScroll:!1}))};return s.jsx("div",{className:Tn.sidebar,children:s.jsxs("div",{className:Tn.content,children:[s.jsx("button",{onClick:b,className:te(Tn.button,Tn.moveButton),disabled:C===0,children:s.jsx(Z,{name:"ArrowUp"})}),s.jsx("button",{onClick:S,className:te(Tn.button,Tn.moveButton),disabled:C===p.length-1,children:s.jsx(Z,{name:"ArrowDown"})}),s.jsx("button",{onClick:x,className:te(Tn.button,Tn.moveButton),children:s.jsx(Z,{name:"Copy"})}),s.jsx("button",{className:te(Tn.button,Tn.deleteButton),onClick:R=>{R.stopPropagation(),d("Remove Block"),h(`Are you sure you want to delete ${(I==null?void 0:I.data[t.id].name)||"this"} block? Once you delete this block, any content visible will also be deleted. This is irreversible.`),f(T)},children:s.jsx(Z,{name:"Trash",hoverable:!0,fill:"#C12A2A"})})]})})};function pr(t,n){if(!n||!n[t])return"unknown name";const o=new n[t];return!o.blockSettings||!o.blockSettings.displayName?"unknown name":o.blockSettings.displayName}const x3=y.memo(({scrollableRef:t})=>{const{setActiveBlock:n,activeBlock:o,zoomLevel:r}=Va(),{blocks:a,sourceBlocks:i}=bo(),{blocks:c,setCurrentBlock:l,currentBlock:u,setPositionBlock:d,announcement:h}=$n(),{settings:f}=Er(),{currentPage:m,pages:g,pageContext:I}=Zn(),{activeBlock:p,setActiveBlock:C}=wo(),{setError:b}=Yl(),{setActiveBlock:S}=bo(),x=y.useRef(o.id),T=y.useRef({});y.useEffect(()=>{if(o.id&&o.neededScroll&&T.current[o.id]){const v=T.current[o.id];if(v&&t.current){const P=v.offsetTop;t.current.scrollTo({top:P-30,behavior:"smooth"})}}},[o,t]);const _=Rn();y.useEffect(()=>{x.current=o.id},[o.id]);const R=v=>{if(!v||!v.name)return b({message:"Block or block.name is undefined.",failedSettings:!1,failedThemeSettings:!1,failedPageIds:g&&g[m].id?[g[m].id]:[]}),s.jsx(os,{error:"Block or block.name is undefined."});if(!a||!a[v.name])return b({message:'Block "${block.name}" does not exist in blocks.',failedSettings:!1,failedThemeSettings:!1,failedPageIds:g&&g[m].id?[g[m].id]:[]}),s.jsx(os,{error:`Block "${v.name}" does not exist in blocks.`});const P=new a[v.name];return v.value&&Object.assign(P,v.value),P.renderBlock(f,I)};return s.jsxs("div",{onClick:v=>{v.stopPropagation()},className:Xn.content,style:{width:"100%",height:"100%",zoom:`${r}`},ref:t,children:[h&&s.jsx(md,{}),s.jsx(pd,{}),s.jsx("div",{className:Xn.main,children:g&&g[m]&&c[g[m].path]&&c[g[m].path].data&&c[g[m].path].order.map(v=>s.jsxs("div",{ref:P=>T.current[v]=P,onClick:P=>{P.stopPropagation(),S(null),p&&C(null),n({id:v,neededScroll:!0}),setTimeout(()=>{n({id:v,neededScroll:!1})},100),l(null),u?setTimeout(()=>{l(o.id)},100):l(o.id)},onMouseEnter:P=>{P.stopPropagation(),o.neededScroll||n({id:v,neededScroll:!1})},onMouseLeave:P=>{P.stopPropagation(),o.neededScroll||n({id:null,neededScroll:!1})},className:te(Xn.block),children:[(o.id===v||u===v)&&s.jsx("div",{className:Xn.active}),(o.id===v||u===v)&&s.jsx("div",{className:Xn.name,children:pr(c[g[m].path].data[v].name,i)}),(o.id===v||u===v)&&pr(c[g[m].path].data[v].name,i)!=="unknown name"&&s.jsx(w3,{}),(o.id===v||u===v)&&pr(c[g[m].path].data[v].name,i)!=="unknown name"&&s.jsx("div",{className:Xn.addSection,children:s.jsx(Ho,{onClick:P=>{P.stopPropagation(),d(v,!0),l(null),n({id:null,neededScroll:!1}),S(null),_("/admin/builder/add")},children:"Add Section"})}),(o.id===v||u===v)&&pr(c[g[m].path].data[v].name,i)!=="unknown name"&&s.jsx("div",{className:te(Xn.addSection,Xn.addSectionTop),children:s.jsx(Ho,{onClick:P=>{P.stopPropagation(),d(v,!1),l(null),n({id:null,neededScroll:!1}),S(null),_("/admin/builder/add")},children:"Add Section"})}),a&&s.jsx(hd,{render:R,block:c[g[m].path].data[v]})]},v))}),s.jsx(fd,{})]})}),_3="_statItem_fzeec_1",T3="_content_fzeec_44",k3="_withChildren_fzeec_50",P3="_info_fzeec_56",L3="_iconWrapper_fzeec_68",A3="_text_fzeec_78",E3="_title_fzeec_84",R3="_value_fzeec_88",D3="_emptyImage_fzeec_94",M3="_image_fzeec_11",N3="_imageTitle_fzeec_112",B3="_emptyImageText_fzeec_122",F3="_hoverable_fzeec_147",ft={statItem:_3,content:T3,withChildren:k3,info:P3,iconWrapper:L3,text:A3,title:E3,value:R3,emptyImage:D3,image:M3,imageTitle:N3,emptyImageText:B3,hoverable:F3},rn=({iconName:t,title:n,value:o,image:r,imageName:a,children:i,className:c,logo:l,productSlug:u})=>{const d=Rn();return s.jsxs("div",{className:`${ft.statItem} ${c}`,children:[r&&r!=="empty"&&s.jsxs("div",{style:{position:"relative"},onClick:()=>{u&&d(`/${u}`)},children:[s.jsx("div",{style:{background:"#000000"},children:s.jsx("img",{src:r,alt:a,className:te(ft.image,ft.emptyImage,{[ft.hoverable]:u})})}),s.jsx("div",{className:ft.emptyImageText,children:s.jsx("div",{className:te(ft.title,ft.imageTitle),id:"h5",children:a})})]}),r==="empty"&&s.jsx("div",{style:{background:"#000000"},children:s.jsxs("div",{className:te(ft.emptyImage,{[ft.hoverable]:u}),onClick:()=>{u&&d(`/${u}`)},children:[s.jsx(Z,{name:"Image",width:64,height:64,fill:"var(--text-secondary)"}),s.jsx("div",{className:ft.emptyImageText,children:s.jsx("div",{className:ft.title,id:"h5",children:a||"No Product"})})]})}),s.jsxs("div",{className:`${ft.content} ${i?ft.withChildren:""}`,children:[s.jsxs("div",{className:ft.info,children:[l?s.jsx("div",{className:ft.iconWrapper,children:s.jsx("img",{src:l,width:28,height:28,style:{objectFit:"contain"}})}):s.jsx(Z,{name:t||"File",className:ft.iconWrapper,width:28,height:28,fill:"var(--text-action)"}),s.jsxs("div",{className:ft.text,children:[s.jsx("div",{className:ft.title,id:"h5",children:n}),s.jsx("div",{className:ft.value,id:"h5-bold",children:o})]})]}),i]})]})},j3="_card_10fve_2",O3="_mobile_10fve_15",H3="_email_10fve_19",V3="_balance_10fve_25",U3="_sidebar_10fve_32",$3="_navList_10fve_56",W3="_navItem_10fve_71",q3="_activeNavItem_10fve_84",Z3="_inactiveNavItem_10fve_89",G3="_logoutNavItem_10fve_98",z3="_iconWrapper_10fve_107",Y3="_skeleton_10fve_112",Nt={card:j3,mobile:O3,email:H3,balance:V3,sidebar:U3,navList:$3,navItem:W3,activeNavItem:q3,inactiveNavItem:Z3,logoutNavItem:G3,iconWrapper:z3,skeleton:Y3},X3=({email:t,balance:n,adaptiveStyles:o})=>s.jsxs("div",{className:te(Nt.card,{[Nt.mobile]:o!=="desktop"}),children:[s.jsx("div",{className:Nt.email,id:"h5",children:t}),s.jsxs("div",{className:Nt.balance,id:"md",children:["Balance: ",n]})]}),K3=[[st.Home,"House"],[st.Orders,"CurrencyCircleDollar"],[st.Rewards,"Medal"],[st.Balance,"Wallet"],[st.Subscriptions,"CalendarCheck"],[st.Tickets,"Question"]],J3=[[Bo.Home,"House"],[Bo.Orders,"CurrencyCircleDollar"],[Bo.Rewards,"Medal"],[Bo.Balance,"Wallet"],[Bo.Tickets,"Question"]],dl=({children:t,className:n="",onClick:o})=>s.jsx("button",{type:"button",className:te(Nt.navItem,n),onClick:o,children:t}),Q3=({adaptiveStyles:t})=>{const{route:n,setRoute:o}=un(),{isAntistock:r}=To(),a=r?J3:K3;return s.jsxs("div",{className:te(Nt.navList,{[Nt.mobile]:t!=="desktop"}),children:[a.map(([i,c])=>{const l=i===n;return s.jsxs(dl,{onClick:()=>o(i),className:te(l?Nt.activeNavItem:Nt.inactiveNavItem),children:[s.jsx("div",{className:Nt.iconWrapper,children:s.jsx(Z,{name:c})}),s.jsx("div",{children:i})]},i)}),s.jsxs(dl,{className:Nt.logoutNavItem,onClick:()=>{HC()},children:[s.jsx("div",{className:Nt.iconWrapper,children:s.jsx(Z,{name:"SignOut"})}),s.jsx("div",{children:"Sign Out"})]})]})};var Te=(t=>(t.New="NEW",t.Pending="PENDING",t.Completed="COMPLETED",t.Cancelled="CANCELLED",t.Expired="EXPIRED",t.FullDeliveryFailure="FULL_DELIVERY_FAILURE",t.PartiallyDelivered="PARTIALLY_DELIVERED",t.Refunded="REFUNDED",t.Failed="FAILED",t))(Te||{}),Ne=(t=>(t.Text="TEXT",t.Serial="SERIALS",t.Ebook="EBOOK",t.Link="LINK",t.Download="DOWNLOAD",t.Discord="DISCORD",t.Custom="CUSTOM",t))(Ne||{}),Hn=(t=>(t.RIAL="RIAL",t.AWAITING_PAYMENT="AWAITING_PAYMENT",t.ACTIVE="ACTIVE",t.PAST_DUE="PAST_DUE",t.CANCELLED="CANCELLED",t.EXPIRED="EXPIRED",t.CHANGED_GATEWAY="CHANGED_GATEWAY",t.REPLACED="REPLACED",t))(Hn||{});const Or=async t=>(await gd(t)).data,wd=async()=>{var o;const n=(await yC()).data;if(n.isEnabled){const r=(o=n==null?void 0:n.topUpSettings)==null?void 0:o.gateways;r&&Or(r)}return n},Os=async()=>{const n=(await SC()).data;return{amount:n.realBalance+n.manualBalance,currency:n.currency}};var mr=(t=>(t.ADDED="ADDED",t.REMOVED="REMOVED",t))(mr||{}),Fe=(t=>(t.NotPaid="NOT_PAID",t.Pending="PENDING",t.Paid="PAID",t.Expired="EXPIRED",t.Cancelled="CANCELLED",t))(Fe||{}),Pr=(t=>(t.Balance="BALANCE",t.Product="PRODUCT",t))(Pr||{}),tn=(t=>(t.Spend="SPEND_AMOUNT",t.Order="ORDER_COUNT",t.Referral="REFER_FRIEND",t.Review="LEAVE_REVIEW",t))(tn||{});const eS=async()=>(await CC()).data;/*! *****************************************************************************
|
|
74
74
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
75
75
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
76
76
|
this file except in compliance with the License. You may obtain a copy of the
|
|
@@ -18512,7 +18512,7 @@ const H7e = D.memo(({ scrollableRef: e }) => {
|
|
|
18512
18512
|
failedPageIds: m && m[p].id ? [m[p].id] : []
|
|
18513
18513
|
}), /* @__PURE__ */ s.jsx(rl, { error: `Block "${C.name}" does not exist in blocks.` });
|
|
18514
18514
|
const T = new o[C.name]();
|
|
18515
|
-
return C.value && Object.assign(T, C.value), T.renderBlock(h
|
|
18515
|
+
return C.value && Object.assign(T, C.value), T.renderBlock(h, g);
|
|
18516
18516
|
};
|
|
18517
18517
|
return /* @__PURE__ */ s.jsxs(
|
|
18518
18518
|
"div",
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./builder.cjs.js"),t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./builder.cjs.js"),t=require("./index-CTVVukDo.cjs");exports.App=e.App;exports.Checkout=e.Checkout;exports.ColorVariables=e.ColorVariables;exports.hotReload=e.hotReload;exports.iconNames=e.iconNames;exports.removeNotification=e.removeNotification;exports.showNotification=e.showNotification;exports.useBuilderPages=e.useBuilderPages;exports.useCreateTicket=e.useCreateTicket;exports.ReCaptchaProvider=t.ReCaptchaProvider;exports.aspectRatioOptions=t.aspectRatioOptions;exports.formatPrice=t.formatPrice;exports.splitTextIntoSpans=t.splitTextIntoSpans;exports.useAdaptiveStyles=t.useAdaptiveStyles;exports.useCart=t.useCart;exports.useReCaptcha=t.useReCaptcha;
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { App as s, Checkout as t, ColorVariables as o, hotReload as i, iconNames as r, removeNotification as p, showNotification as c, useBuilderPages as u, useCreateTicket as f } from "./builder.es.js";
|
|
2
|
-
import { R as n, a as C, f as h, s as m, c as R, b as d, u as v } from "./index-
|
|
2
|
+
import { R as n, a as C, f as h, s as m, c as R, b as d, u as v } from "./index-eH02UZ01.js";
|
|
3
3
|
export {
|
|
4
4
|
s as App,
|
|
5
5
|
t as Checkout,
|