@agent-dock/cli 0.1.3 → 0.2.1-beta.20261108.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-dock/cli",
3
- "version": "0.1.3",
3
+ "version": "0.2.1-beta.20261108.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1 @@
1
+ import{j as pn}from"./index-RVKphYoh.js";import{r as n}from"./syntax-highlighter-DOKegME5.js";import{r as gn}from"./main-BHjClXhJ.js";const Ot="carousel",Nt="controller",vn="navigation",En="no-scroll",Be="portal",xn="root",Rt="toolbar",mt="zoom",Ze="loading",We="error",$e="complete",bn="placeholder",wn=e=>`active-slide-${e}`,Cn="fullsize",Ke="flex_center",_n="no_scroll",Tt="no_scroll_padding",je="slide",kt="slide_wrapper",Pn="slide_wrapper_interactive",ue="prev",de="next",pt="swipe",ge="close",Dt="onPointerDown",At="onPointerMove",Zt="onPointerUp",Wt="onPointerLeave",$t="onPointerCancel",Ge="onKeyDown",Mn="onKeyUp",qe="onWheel",Sn="Escape",yn="ArrowLeft",Ln="ArrowRight",In="button",Xe="icon",Ft="contain",gt="cover",Vt="Unknown action type",Ut="yarl__";function oe(...e){return e.filter(Boolean).join(" ")}function T(e){return`${Ut}${e}`}function K(e){return`--${Ut}${e}`}function we(e,t){return`${e}${t?`_${t}`:""}`}function Qe(e){return t=>we(e,t)}function ve(e,t){var r;return(r=e==null?void 0:e[t])!==null&&r!==void 0?r:t}function On(e,t,r){return ve(e,"{index} of {total}").replace(/\{index}/g,`${ot(r,t.length)+1}`).replace(/\{total}/g,`${t.length}`)}function Je(...e){return()=>{e.forEach(t=>{t()})}}function ie(e,t,r){return()=>{const o=n.useContext(r);if(!o)throw new Error(`${e} must be used within a ${t}.Provider`);return o}}function et(){return typeof window<"u"}function tt(e,t=0){const r=10**t;return Math.round((e+Number.EPSILON)*r)/r}function fe(e){return e.type===void 0||e.type==="image"}function nt(e,t){return e.imageFit===gt||e.imageFit!==Ft&&t===gt}function ye(e){return typeof e=="string"?Number.parseInt(e,10):e}function Me(e){if(typeof e=="number")return{pixel:e};if(typeof e=="string"){const t=ye(e);return e.endsWith("%")?{percent:t}:{pixel:t}}return{pixel:0}}function Nn(e,t){const r=Me(t),o=r.percent!==void 0?e.width/100*r.percent:r.pixel;return{width:Math.max(e.width-2*o,0),height:Math.max(e.height-2*o,0)}}function Rn(){return(et()?window==null?void 0:window.devicePixelRatio:void 0)||1}function ot(e,t){return t>0?(e%t+t)%t:0}function Xt(e){return e.length>0}function Yt(e,t){return e[ot(t,e.length)]}function Ye(e,t){return Xt(e)?Yt(e,t):void 0}function Tn(e){return fe(e)?e.src:void 0}function kn(e,t,r){if(!r)return e;const{buttons:o,...i}=e,c=o.findIndex(l=>l===t),s=n.isValidElement(r)?n.cloneElement(r,{key:t},null):r;if(c>=0){const l=[...o];return l.splice(c,1,s),{buttons:l,...i}}return{buttons:[s,...o],...i}}function Dn(e,t,r=0){return Math.min(e.preload,Math.max(e.finite?t.length-1:Math.floor(t.length/2),r))}const An=Number(n.version.split(".")[0])>=19;function Zn(e){return{inert:An?e:e?"":void 0}}function Wn(e){e.scrollTop}const ze={open:!1,close:()=>{},index:0,slides:[],render:{},plugins:[],toolbar:{buttons:[ge]},labels:{},animation:{fade:250,swipe:500,easing:{fade:"ease",swipe:"ease-out",navigation:"ease-in-out"}},carousel:{finite:!1,preload:2,padding:"16px",spacing:"30%",imageFit:Ft,imageProps:{}},controller:{ref:null,focus:!0,aria:!1,touchAction:"none",closeOnPullUp:!1,closeOnPullDown:!1,closeOnBackdropClick:!1,closeOnEscape:!0,preventDefaultWheelX:!0,preventDefaultWheelY:!1,disableSwipeNavigation:!1},portal:{},noScroll:{disabled:!1},on:{},styles:{},className:""};function se(e,t){return{name:e,component:t}}function Y(e,t){return{module:e,children:t}}function zt(e,t,r){return e.module.name===t?r(e):e.children?[Y(e.module,e.children.flatMap(o=>{var i;return(i=zt(o,t,r))!==null&&i!==void 0?i:[]}))]:[e]}function pe(e,t,r){return e.flatMap(o=>{var i;return(i=zt(o,t,r))!==null&&i!==void 0?i:[]})}function $n(e,t=[],r=[]){let o=e;const i=h=>{const m=[...o];for(;m.length>0;){const f=m.pop();if((f==null?void 0:f.module.name)===h)return!0;f!=null&&f.children&&m.push(...f.children)}return!1},c=(h,m)=>{if(h===""){o=[Y(m,o)];return}o=pe(o,h,f=>[Y(m,[f])])},s=(h,m)=>{o=pe(o,h,f=>[Y(f.module,[Y(m,f.children)])])},l=(h,m,f)=>{o=pe(o,h,b=>{var _;return[Y(b.module,[...f?[Y(m)]:[],...(_=b.children)!==null&&_!==void 0?_:[],...f?[]:[Y(m)]])]})},a=(h,m,f)=>{o=pe(o,h,b=>[...f?[Y(m)]:[],b,...f?[]:[Y(m)]])},d=h=>{s(Nt,h)},p=(h,m)=>{o=pe(o,h,f=>[Y(m,f.children)])},u=h=>{o=pe(o,h,m=>m.children)},g=h=>{r.push(h)};return t.forEach(h=>{h({contains:i,addParent:c,append:s,addChild:l,addSibling:a,addModule:d,replace:p,remove:u,augment:g})}),{config:o,augmentation:h=>r.reduce((m,f)=>f(m),h)}}const Ht=n.createContext(null),Bt=ie("useA11yContext","A11yContext",Ht);function Fn({children:e}){const[t,r]=n.useState(!1),[o,i]=n.useState(!1),c=n.useMemo(()=>({focusWithin:t,trackFocusWithin:(l,a)=>{const d=p=>u=>{var g;u.currentTarget.contains(u.relatedTarget)||r(p),(g=p?l:a)===null||g===void 0||g(u)};return{onFocus:d(!0),onBlur:d(!1)}},autoPlaying:o,setAutoPlaying:i}),[t,o]);return n.createElement(Ht.Provider,{value:c},e)}const Kt=n.createContext(null),Le=ie("useDocument","DocumentContext",Kt);function Vn({nodeRef:e,children:t}){const r=n.useMemo(()=>{const o=c=>{var s;return((s=c||e.current)===null||s===void 0?void 0:s.ownerDocument)||document};return{getOwnerDocument:o,getOwnerWindow:c=>{var s;return((s=o(c))===null||s===void 0?void 0:s.defaultView)||window}}},[e]);return n.createElement(Kt.Provider,{value:r},t)}const jt=n.createContext(null),Ie=ie("useEvents","EventsContext",jt);function Un({children:e}){const[t]=n.useState({});n.useEffect(()=>()=>{Object.keys(t).forEach(o=>delete t[o])},[t]);const r=n.useMemo(()=>{const o=(s,l)=>{var a;(a=t[s])===null||a===void 0||a.splice(0,t[s].length,...t[s].filter(d=>d!==l))};return{publish:(...[s,l])=>{var a;(a=t[s])===null||a===void 0||a.forEach(d=>d(l))},subscribe:(s,l)=>(t[s]||(t[s]=[]),t[s].push(l),()=>o(s,l)),unsubscribe:o}},[t]);return n.createElement(jt.Provider,{value:r},e)}const Gt=n.createContext(null),G=ie("useLightboxProps","LightboxPropsContext",Gt);function Xn({children:e,...t}){return n.createElement(Gt.Provider,{value:t},e)}const qt=n.createContext(null),le=ie("useLightboxState","LightboxStateContext",qt),Qt=n.createContext(null),Yn=ie("useLightboxDispatch","LightboxDispatchContext",Qt);function zn(e,t){switch(t.type){case"swipe":{const{slides:r}=e,o=(t==null?void 0:t.increment)||0,i=e.globalIndex+o,c=ot(i,r.length),s=Ye(r,c),l=o||t.duration!==void 0?{increment:o,duration:t.duration,easing:t.easing}:void 0;return{slides:r,currentIndex:c,globalIndex:i,currentSlide:s,animation:l}}case"update":return t.slides!==e.slides||t.index!==e.currentIndex?{slides:t.slides,currentIndex:t.index,globalIndex:t.index,currentSlide:Ye(t.slides,t.index)}:e;default:throw new Error(Vt)}}function Hn({slides:e,index:t,children:r}){const[o,i]=n.useReducer(zn,{slides:e,currentIndex:t,globalIndex:t,currentSlide:Ye(e,t)}),[c,s]=n.useState(e),[l,a]=n.useState(t);(e!==c||t!==l)&&(s(e),a(t),i({type:"update",slides:e,index:t}));const d=n.useMemo(()=>({...o,state:o,dispatch:i}),[o,i]);return n.createElement(Qt.Provider,{value:i},n.createElement(qt.Provider,{value:d},r))}const Jt=n.createContext(null),Bn=ie("useRTLContext","RTLContext",Jt);function Kn({isRTL:e,children:t}){const r=n.useMemo(()=>({isRTL:e}),[e]);return n.createElement(Jt.Provider,{value:r},t)}const en=n.createContext(null),Oe=ie("useTimeouts","TimeoutsContext",en);function jn({children:e}){const[t]=n.useState([]);n.useEffect(()=>()=>{t.forEach(o=>window.clearTimeout(o)),t.splice(0,t.length)},[t]);const r=n.useMemo(()=>{const o=s=>{t.splice(0,t.length,...t.filter(l=>l!==s))};return{setTimeout:(s,l)=>{const a=window.setTimeout(()=>{o(a),s()},l);return t.push(a),a},clearTimeout:s=>{s!==void 0&&(o(s),window.clearTimeout(s))}}},[t]);return n.createElement(en.Provider,{value:r},e)}const rt=n.forwardRef(function({label:t,className:r,icon:o,renderIcon:i,onClick:c,style:s,...l},a){const{styles:d,labels:p}=G(),u=ve(p,t);return n.createElement("button",{ref:a,type:"button",title:u,"aria-label":u,className:oe(T(In),r),onClick:c,style:{...s,...d.button},...l},i?i():n.createElement(o,{className:T(Xe),style:d.icon}))});function Gn(e,t){const r=o=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":"true",focusable:"false",...o},t);return r.displayName=e,r}function he(e,t){return Gn(e,n.createElement("g",{fill:"currentColor"},n.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),t))}const qn=he("Close",n.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"})),Qn=he("Previous",n.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})),Jn=he("Next",n.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"})),eo=he("Loading",n.createElement(n.Fragment,null,Array.from({length:8}).map((e,t,r)=>n.createElement("line",{key:t,x1:"12",y1:"6.5",x2:"12",y2:"1.8",strokeLinecap:"round",strokeWidth:"2.6",stroke:"currentColor",strokeOpacity:1/r.length*(t+1),transform:`rotate(${360/r.length*t}, 12, 12)`})))),to=he("Error",n.createElement("path",{d:"M21.9,21.9l-8.49-8.49l0,0L3.59,3.59l0,0L2.1,2.1L0.69,3.51L3,5.83V19c0,1.1,0.9,2,2,2h13.17l2.31,2.31L21.9,21.9z M5,18 l3.5-4.5l2.5,3.01L12.17,15l3,3H5z M21,18.17L5.83,3H19c1.1,0,2,0.9,2,2V18.17z"})),re=et()?n.useLayoutEffect:n.useEffect;function it(){const[e,t]=n.useState(!1);return n.useEffect(()=>{var r,o;const i=(r=window.matchMedia)===null||r===void 0?void 0:r.call(window,"(prefers-reduced-motion: reduce)");t(i==null?void 0:i.matches);const c=s=>t(s.matches);return(o=i==null?void 0:i.addEventListener)===null||o===void 0||o.call(i,"change",c),()=>{var s;return(s=i==null?void 0:i.removeEventListener)===null||s===void 0?void 0:s.call(i,"change",c)}},[]),e}function no(e){let t=0,r=0,o=0;const c=window.getComputedStyle(e).transform.match(/matrix.*\((.+)\)/);if(c){const s=c[1].split(",").map(ye);s.length===6?(t=s[4],r=s[5]):s.length===16&&(t=s[12],r=s[13],o=s[14])}return{x:t,y:r,z:o}}function vt(e,t){const r=n.useRef(void 0),o=n.useRef(void 0),i=it();return re(()=>{var c,s,l;if(e.current&&r.current!==void 0&&!i){const{keyframes:a,duration:d,easing:p,onfinish:u}=t(r.current,e.current.getBoundingClientRect(),no(e.current))||{};if(a&&d){(c=o.current)===null||c===void 0||c.cancel(),o.current=void 0;try{o.current=(l=(s=e.current).animate)===null||l===void 0?void 0:l.call(s,a,{duration:d,easing:p})}catch(g){console.error(g)}o.current&&(o.current.onfinish=()=>{o.current=void 0,u==null||u()})}}r.current=void 0}),{prepareAnimation:c=>{r.current=c},isAnimationPlaying:()=>{var c;return((c=o.current)===null||c===void 0?void 0:c.playState)==="running"}}}function tn(){const e=n.useRef(null),t=n.useRef(void 0),[r,o]=n.useState();return{setContainerRef:n.useCallback(c=>{e.current=c,t.current&&(t.current.disconnect(),t.current=void 0);const s=()=>{if(c){const l=window.getComputedStyle(c),a=d=>parseFloat(d)||0;o({width:Math.round(c.clientWidth-a(l.paddingLeft)-a(l.paddingRight)),height:Math.round(c.clientHeight-a(l.paddingTop)-a(l.paddingBottom))})}else o(void 0)};s(),c&&typeof ResizeObserver<"u"&&(t.current=new ResizeObserver(s),t.current.observe(c))},[]),containerRef:e,containerRect:r}}function Pe(){const e=n.useRef(void 0),{setTimeout:t,clearTimeout:r}=Oe();return n.useCallback((o,i)=>{r(e.current),e.current=t(o,i>0?i:0)},[t,r])}function D(e){const t=n.useRef(e);return re(()=>{t.current=e}),n.useCallback((...r)=>{var o;return(o=t.current)===null||o===void 0?void 0:o.call(t,...r)},[])}function Et(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function He(e,t){return n.useMemo(()=>e==null&&t==null?null:r=>{Et(e,r),Et(t,r)},[e,t])}function oo(e,t=!1){const r=n.useRef(!1);re(()=>{t&&r.current&&(r.current=!1,e())},[t,e]);const o=n.useCallback(()=>{r.current=!0},[]),i=n.useCallback(()=>{r.current=!1},[]);return{onFocus:o,onBlur:i}}function ct(){return Bn().isRTL}function ro(){const[e]=n.useState({}),t=n.useCallback((i,c)=>{var s;(s=e[i])===null||s===void 0||s.forEach(l=>{c.isPropagationStopped()||l(c)})},[e]),r=n.useMemo(()=>({onPointerDown:i=>t(Dt,i),onPointerMove:i=>t(At,i),onPointerUp:i=>t(Zt,i),onPointerLeave:i=>t(Wt,i),onPointerCancel:i=>t($t,i),onKeyDown:i=>t(Ge,i),onKeyUp:i=>t(Mn,i),onWheel:i=>t(qe,i)}),[t]),o=n.useCallback((i,c)=>(e[i]||(e[i]=[]),e[i].unshift(c),()=>{const s=e[i];s&&s.splice(0,s.length,...s.filter(l=>l!==c))}),[e]);return{registerSensors:r,subscribeSensors:o}}function xt(e,t){const r=n.useRef(0),o=Pe(),i=D((...c)=>{r.current=Date.now(),e(...c)});return n.useCallback((...c)=>{o(()=>{i(...c)},t-(Date.now()-r.current))},[t,i,o])}const Fe=Qe("slide"),Ve=Qe("slide_image");function Se({slide:e,offset:t,render:r,rect:o,imageFit:i,imageProps:c,onClick:s,onLoad:l,onError:a,style:d}){var p,u,g,h,m,f,b,_;const[P,I]=n.useState(Ze),{publish:L}=Ie(),{setTimeout:M}=Oe(),k=n.useRef(null);n.useEffect(()=>{t===0&&L(wn(P))},[t,P,L]);const E=D(S=>{("decode"in S?S.decode():Promise.resolve()).catch(()=>{}).then(()=>{S.parentNode&&(I($e),M(()=>{l==null||l(S)},0))})}),N=n.useCallback(S=>{k.current=S,S!=null&&S.complete&&E(S)},[E]),w=n.useCallback(S=>{E(S.currentTarget)},[E]),A=D(()=>{I(We),a==null||a()}),W=nt(e,i),X=(S,z)=>Number.isFinite(S)?S:z,C=X(Math.max(...((u=(p=e.srcSet)===null||p===void 0?void 0:p.map(S=>S.width))!==null&&u!==void 0?u:[]).concat(e.width?[e.width]:[]).filter(Boolean)),((g=k.current)===null||g===void 0?void 0:g.naturalWidth)||0),O=X(Math.max(...((m=(h=e.srcSet)===null||h===void 0?void 0:h.map(S=>S.height))!==null&&m!==void 0?m:[]).concat(e.height?[e.height]:[]).filter(Boolean)),((f=k.current)===null||f===void 0?void 0:f.naturalHeight)||0),y=C&&O?{maxWidth:`min(${C}px, 100%)`,maxHeight:`min(${O}px, 100%)`}:{maxWidth:"100%",maxHeight:"100%"},F=(b=e.srcSet)===null||b===void 0?void 0:b.slice().sort((S,z)=>S.width-z.width).map(S=>`${S.src} ${S.width}w`).join(", "),$=()=>o&&!W&&e.width&&e.height?o.height/e.height*e.width:Number.MAX_VALUE,x=F&&o&&et()?`${Math.round(Math.min($(),o.width))}px`:void 0,{style:R,className:U,...V}=(typeof c=="function"?c(e):c)||{};return n.createElement(n.Fragment,null,n.createElement("img",{ref:N,onLoad:w,onError:A,onClick:s,draggable:!1,className:oe(T(Ve()),W&&T(Ve("cover")),P!==$e&&T(Ve("loading")),U),style:{...y,...d,...R},...V,alt:(_=e.alt)!==null&&_!==void 0?_:"",sizes:x,srcSet:F,src:e.src}),P!==$e&&n.createElement("div",{className:T(Fe(bn))},P===Ze&&(r!=null&&r.iconLoading?r.iconLoading():n.createElement(eo,{className:oe(T(Xe),T(Fe(Ze)))})),P===We&&(r!=null&&r.iconError?r.iconError():n.createElement(to,{className:oe(T(Xe),T(Fe(We)))}))))}const io=n.forwardRef(function({className:t,children:r,onFocus:o,onBlur:i,...c},s){const l=n.useRef(null),[a,d]=n.useState(!1),{trackFocusWithin:p}=Bt(),u=D(()=>{if(l.current){const g=window.getComputedStyle(l.current).direction==="rtl";g!==a&&d(g)}});return n.useEffect(u),n.createElement(Vn,{nodeRef:l},n.createElement(Kn,{isRTL:a},n.createElement("div",{ref:He(s,l),className:oe(T("root"),t),...p(o,i),...c},r)))});var H;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL",e[e.ANIMATION=3]="ANIMATION"})(H||(H={}));function nn(e,t,r,o,i){n.useEffect(()=>i?()=>{}:Je(e(Dt,t),e(At,r),e(Zt,o),e(Wt,o),e($t,o)),[e,t,r,o,i])}var Q;(function(e){e[e.NONE=0]="NONE",e[e.SWIPE=1]="SWIPE",e[e.PULL=2]="PULL"})(Q||(Q={}));const Ue=30;function co({disableSwipeNavigation:e,closeOnBackdropClick:t},r,o,i,c,s,l,a,d,p,u,g,h,m,f,b){const _=n.useRef(0),P=n.useRef([]),I=n.useRef(void 0),L=n.useRef(0),M=n.useRef(Q.NONE),k=n.useCallback(C=>{I.current===C.pointerId&&(I.current=void 0,M.current=Q.NONE);const O=P.current;O.splice(0,O.length,...O.filter(y=>y.pointerId!==C.pointerId))},[]),E=n.useCallback(C=>{k(C),C.persist(),P.current.push(C)},[k]),N=n.useCallback(C=>P.current.find(({pointerId:O})=>C.pointerId===O),[]),w=D(C=>{E(C)}),A=(C,O)=>u&&C>O||p&&C<-O,W=D(C=>{const O=N(C);if(O)if(I.current===C.pointerId){const y=Date.now()-L.current,F=_.current;M.current===Q.SWIPE?Math.abs(F)>.3*i||Math.abs(F)>5&&y<c?a(F,y):d(F):M.current===Q.PULL&&(A(F,2*Ue)?m(F,y):f(F)),_.current=0,M.current=Q.NONE}else{const{target:y}=C;t&&y instanceof HTMLElement&&y===O.target&&(y.classList.contains(T(je))||y.classList.contains(T(kt)))&&b()}k(C)}),X=D(C=>{const O=N(C);if(O){const y=I.current===C.pointerId;if(C.buttons===0){y&&_.current!==0?W(C):k(O);return}const F=C.clientX-O.clientX,$=C.clientY-O.clientY;if(I.current===void 0){const x=R=>{E(C),I.current=C.pointerId,L.current=Date.now(),M.current=R};Math.abs(F)>Math.abs($)&&Math.abs(F)>Ue&&o(F)?e||(x(Q.SWIPE),s()):Math.abs($)>Math.abs(F)&&A($,Ue)&&(x(Q.PULL),g())}else y&&(M.current===Q.SWIPE?(_.current=F,l(F)):M.current===Q.PULL&&(_.current=$,h($)))}});nn(r,w,X,W)}function so({preventDefaultWheelX:e,preventDefaultWheelY:t}){const r=n.useRef(null),o=D(i=>{const c=Math.abs(i.deltaX)>Math.abs(i.deltaY);(c&&e||!c&&t||i.ctrlKey)&&i.preventDefault()});return n.useCallback(i=>{var c;i?i.addEventListener("wheel",o,{passive:!1}):(c=r.current)===null||c===void 0||c.removeEventListener("wheel",o),r.current=i},[o])}function lo(e,t,r,o,i,c,s,l,a){const d=n.useRef(0),p=n.useRef(0),u=n.useRef(void 0),g=n.useRef(void 0),h=n.useRef(0),m=n.useRef(void 0),f=n.useRef(0),{setTimeout:b,clearTimeout:_}=Oe(),P=n.useCallback(()=>{u.current&&(_(u.current),u.current=void 0)},[_]),I=n.useCallback(()=>{g.current&&(_(g.current),g.current=void 0)},[_]),L=D(()=>{e!==H.SWIPE&&(d.current=0,f.current=0,P(),I())});n.useEffect(L,[e,L]);const M=D(E=>{g.current=void 0,d.current===E&&a(d.current)}),k=D(E=>{if(E.ctrlKey||Math.abs(E.deltaY)>Math.abs(E.deltaX))return;const N=w=>{h.current=w,_(m.current),m.current=w>0?b(()=>{h.current=0,m.current=void 0},300):void 0};if(e===H.NONE){if(Math.abs(E.deltaX)<=1.2*Math.abs(h.current)){N(E.deltaX);return}if(!r(-E.deltaX))return;if(p.current+=E.deltaX,P(),Math.abs(p.current)>30)p.current=0,N(0),f.current=Date.now(),c();else{const w=p.current;u.current=b(()=>{u.current=void 0,w===p.current&&(p.current=0)},i)}}else if(e===H.SWIPE){let w=d.current-E.deltaX;if(w=Math.min(Math.abs(w),o)*Math.sign(w),d.current=w,s(w),I(),Math.abs(w)>.2*o){N(E.deltaX),l(w,Date.now()-f.current);return}g.current=b(()=>M(w),2*i)}else N(E.deltaX)});n.useEffect(()=>t(qe,k),[t,k])}const bt=Qe("container"),on=n.createContext(null),ce=ie("useController","ControllerContext",on);function ao({children:e,...t}){var r;const{carousel:o,animation:i,controller:c,on:s,styles:l,render:a}=t,{closeOnPullUp:d,closeOnPullDown:p,preventDefaultWheelX:u,preventDefaultWheelY:g}=c,[h,m]=n.useState(),f=le(),b=Yn(),[_,P]=n.useState(H.NONE),I=n.useRef(0),L=n.useRef(0),M=n.useRef(1),{registerSensors:k,subscribeSensors:E}=ro(),{subscribe:N,publish:w}=Ie(),A=Pe(),W=Pe(),X=Pe(),{containerRef:C,setContainerRef:O,containerRect:y}=tn(),F=He(so({preventDefaultWheelX:u,preventDefaultWheelY:g}),O),$=n.useRef(null),x=He($,void 0),{getOwnerDocument:R}=Le(),U=ct(),V=v=>(U?-1:1)*(typeof v=="number"?v:1),S=D(()=>{var v;return(v=C.current)===null||v===void 0?void 0:v.focus()}),z=D(()=>t),q=D(()=>f),J=n.useCallback(v=>w(ue,v),[w]),ee=n.useCallback(v=>w(de,v),[w]),me=n.useCallback(()=>w(ge),[w]),Re=v=>!(o.finite&&(V(v)>0&&f.currentIndex===0||V(v)<0&&f.currentIndex===f.slides.length-1)),lt=v=>{var Z;I.current=v,(Z=C.current)===null||Z===void 0||Z.style.setProperty(K("swipe_offset"),`${Math.round(v)}px`)},Te=v=>{var Z,B;L.current=v,M.current=(()=>{const xe=p&&v>0?v:d&&v<0?-v:0;return Math.min(Math.max(tt(1-xe/60*(1-.5),2),.5),1)})(),(Z=C.current)===null||Z===void 0||Z.style.setProperty(K("pull_offset"),`${Math.round(v)}px`),(B=C.current)===null||B===void 0||B.style.setProperty(K("pull_opacity"),`${M.current}`)},{prepareAnimation:un}=vt($,(v,Z,B)=>{if($.current&&y)return{keyframes:[{transform:`translate(0, ${v.rect.y-Z.y+B.y}px)`,opacity:v.opacity},{transform:"translate(0, 0)",opacity:1}],duration:v.duration,easing:i.easing.fade}}),at=(v,Z)=>{if(d||p){Te(v);let B=0;$.current&&(B=i.fade*(Z?2:1),un({rect:$.current.getBoundingClientRect(),opacity:M.current,duration:B})),X(()=>{Te(0),P(H.NONE)},B),P(H.ANIMATION),Z||me()}},{prepareAnimation:dn,isAnimationPlaying:fn}=vt($,(v,Z,B)=>{var te;if($.current&&y&&(!((te=f.animation)===null||te===void 0)&&te.duration)){const j=Me(o.spacing),xe=(j.percent?j.percent*y.width/100:j.pixel)||0;return{keyframes:[{transform:`translate(${V(f.globalIndex-v.index)*(y.width+xe)+v.rect.x-Z.x+B.x}px, 0)`},{transform:"translate(0, 0)"}],duration:f.animation.duration,easing:f.animation.easing}}}),Ee=D(v=>{var Z,B;const te=v.offset||0,j=te?i.swipe:(Z=i.navigation)!==null&&Z!==void 0?Z:i.swipe,xe=!te&&!fn()?i.easing.navigation:i.easing.swipe;let{direction:Ce}=v;const _e=(B=v.count)!==null&&B!==void 0?B:1;let ke=H.ANIMATION,ne=j*_e;if(!Ce){const be=y==null?void 0:y.width,ht=v.duration||0,Ae=be?j/be*Math.abs(te):j;_e!==0?(ht<Ae?ne=ne/Ae*Math.max(ht,Ae/5):be&&(ne=j/be*(be-Math.abs(te))),Ce=V(te)>0?ue:de):ne=j/2}let De=0;Ce===ue?Re(V(1))?De=-_e:(ke=H.NONE,ne=j):Ce===de&&(Re(V(-1))?De=_e:(ke=H.NONE,ne=j)),ne=Math.round(ne),W(()=>{lt(0),P(H.NONE)},ne),$.current&&dn({rect:$.current.getBoundingClientRect(),index:f.globalIndex}),P(ke),w(pt,{type:"swipe",increment:De,duration:ne,easing:xe})});n.useEffect(()=>{var v,Z;!((v=f.animation)===null||v===void 0)&&v.increment&&(!((Z=f.animation)===null||Z===void 0)&&Z.duration)&&A(()=>b({type:"swipe",increment:0}),f.animation.duration)},[f.animation,b,A]);const ut=[E,Re,(y==null?void 0:y.width)||0,i.swipe,()=>P(H.SWIPE),v=>lt(v),(v,Z)=>Ee({offset:v,duration:Z,count:1}),v=>Ee({offset:v,count:0})],hn=[()=>{p&&P(H.PULL)},v=>Te(v),v=>at(v),v=>at(v,!0)];co(c,...ut,d,p,...hn,me),lo(_,...ut);const dt=D(()=>{c.focus&&R().querySelector(`.${T(Be)} .${T(bt())}`)&&S()});n.useEffect(dt,[dt]);const ft=D(()=>{var v;(v=s.view)===null||v===void 0||v.call(s,{index:f.currentIndex})});n.useEffect(ft,[f.globalIndex,ft]),n.useEffect(()=>Je(N(ue,v=>Ee({direction:ue,...v})),N(de,v=>Ee({direction:de,...v})),N(pt,v=>b(v))),[N,Ee,b]);const mn=n.useMemo(()=>({prev:J,next:ee,close:me,focus:S,slideRect:y?Nn(y,o.padding):{width:0,height:0},containerRect:y||{width:0,height:0},subscribeSensors:E,containerRef:C,setCarouselRef:x,toolbarWidth:h,setToolbarWidth:m}),[J,ee,me,S,E,y,C,x,h,m,o.padding]);return n.useImperativeHandle(c.ref,()=>({prev:J,next:ee,close:me,focus:S,getLightboxProps:z,getLightboxState:q}),[J,ee,me,S,z,q]),n.createElement("div",{ref:F,className:oe(T(bt()),T(Ke)),style:{..._===H.SWIPE?{[K("swipe_offset")]:`${Math.round(I.current)}px`}:null,..._===H.PULL?{[K("pull_offset")]:`${Math.round(L.current)}px`,[K("pull_opacity")]:`${M.current}`}:null,...c.touchAction!=="none"?{[K("controller_touch_action")]:c.touchAction}:null,...l.container},tabIndex:-1,...k},y&&n.createElement(on.Provider,{value:mn},e,(r=a.controls)===null||r===void 0?void 0:r.call(a)))}const uo=se(Nt,ao);function ae(e){return we(Ot,e)}function wt(e){return we(je,e)}function fo({slide:e,offset:t}){const r=n.useRef(null),{currentIndex:o,slides:i}=le(),{slideRect:c,focus:s}=ce(),{render:l,carousel:{imageFit:a,imageProps:d},on:{click:p},styles:{slide:u},labels:g}=G(),{getOwnerDocument:h}=Le(),m=t!==0;n.useEffect(()=>{var b;m&&(!((b=r.current)===null||b===void 0)&&b.contains(h().activeElement))&&s()},[m,s,h]);const f=()=>{var b,_,P,I;let L=(b=l.slide)===null||b===void 0?void 0:b.call(l,{slide:e,offset:t,rect:c});return!L&&fe(e)&&(L=n.createElement(Se,{slide:e,offset:t,render:l,rect:c,imageFit:a,imageProps:d,onClick:m?void 0:()=>p==null?void 0:p({index:o})})),L?n.createElement(n.Fragment,null,(_=l.slideHeader)===null||_===void 0?void 0:_.call(l,{slide:e}),((P=l.slideContainer)!==null&&P!==void 0?P:(({children:M})=>M))({slide:e,children:L}),(I=l.slideFooter)===null||I===void 0?void 0:I.call(l,{slide:e})):null};return n.createElement("div",{ref:r,className:oe(T(wt()),!m&&T(wt("current")),T(Ke)),...Zn(m),style:u,role:"group","aria-roledescription":ve(g,"Slide"),"aria-label":On(g,i,o+t)},f())}function ho(){const e=G().styles.slide;return n.createElement("div",{className:T(je),style:e})}function mo({carousel:e,labels:t}){const{slides:r,currentIndex:o,globalIndex:i}=le(),{setCarouselRef:c}=ce(),{autoPlaying:s,focusWithin:l}=Bt(),a=Me(e.spacing),d=Me(e.padding),p=Dn(e,r,1),u=[];if(Xt(r))for(let g=o-p;g<=o+p;g+=1){const h=Yt(r,g),m=i-o+g,f=e.finite&&(g<0||g>r.length-1);u.push(f?{key:m}:{key:[`${m}`,Tn(h)].filter(Boolean).join("|"),offset:g-o,slide:h})}return n.createElement("div",{ref:c,className:oe(T(ae()),u.length>0&&T(ae("with_slides"))),style:{[`${K(ae("slides_count"))}`]:u.length,[`${K(ae("spacing_px"))}`]:a.pixel||0,[`${K(ae("spacing_percent"))}`]:a.percent||0,[`${K(ae("padding_px"))}`]:d.pixel||0,[`${K(ae("padding_percent"))}`]:d.percent||0},role:"region","aria-live":s&&!l?"off":"polite","aria-roledescription":ve(t,"Carousel"),"aria-label":ve(t,"Photo gallery")},u.map(({key:g,slide:h,offset:m})=>h?n.createElement(fo,{key:g,slide:h,offset:m}):n.createElement(ho,{key:g})))}const po=se(Ot,mo);function rn(){const{carousel:e}=G(),{slides:t,currentIndex:r}=le(),o=t.length===0||e.finite&&r===0,i=t.length===0||e.finite&&r===t.length-1;return{prevDisabled:o,nextDisabled:i}}function go(e){var t;const r=ct(),{publish:o}=Ie(),{animation:i,controller:c}=G(),{prevDisabled:s,nextDisabled:l}=rn(),a=((t=i.navigation)!==null&&t!==void 0?t:i.swipe)/2,d=xt(()=>o(ue),a),p=xt(()=>o(de),a),u=D(g=>{switch(g.key){case Sn:if(!c.closeOnEscape)return;o(ge);break;case yn:(r?l:s)||(r?p:d)();break;case Ln:(r?s:l)||(r?d:p)();break;default:return}g.stopPropagation()});n.useEffect(()=>e(Ge,u),[e,u])}function Ct({label:e,icon:t,renderIcon:r,action:o,onClick:i,disabled:c,style:s}){return n.createElement(rt,{label:e,icon:t,renderIcon:r,className:T(`navigation_${o}`),disabled:c,onClick:i,style:s,...oo(ce().focus,c)})}function vo({render:{buttonPrev:e,buttonNext:t,iconPrev:r,iconNext:o},styles:i}){const{prev:c,next:s,subscribeSensors:l}=ce(),{prevDisabled:a,nextDisabled:d}=rn();return go(l),n.createElement(n.Fragment,null,e?e():n.createElement(Ct,{label:"Previous",action:ue,icon:Qn,renderIcon:r,style:i.navigationPrev,disabled:a,onClick:c}),t?t():n.createElement(Ct,{label:"Next",action:de,icon:Jn,renderIcon:o,style:i.navigationNext,disabled:d,onClick:s}))}const Eo=se(vn,vo),_t=T(_n),xo=T(Tt);function bo(e){return"style"in e}function Pt(e,t,r){const o=window.getComputedStyle(e),i=r?"padding-left":"padding-right",c=r?o.paddingLeft:o.paddingRight,s=e.style.getPropertyValue(i);return e.style.setProperty(i,`${(ye(c)||0)+t}px`),()=>{s?e.style.setProperty(i,s):e.style.removeProperty(i)}}function wo({noScroll:{disabled:e},children:t}){const r=ct(),{getOwnerDocument:o,getOwnerWindow:i}=Le();return n.useEffect(()=>{if(e)return()=>{};const c=[],s=i(),{body:l,documentElement:a}=o(),d=Math.round(s.innerWidth-a.clientWidth);if(d>0){c.push(Pt(l,d,r));const p=l.getElementsByTagName("*");for(let u=0;u<p.length;u+=1){const g=p[u];bo(g)&&s.getComputedStyle(g).getPropertyValue("position")==="fixed"&&!g.classList.contains(xo)&&c.push(Pt(g,d,r))}}return l.classList.add(_t),()=>{l.classList.remove(_t),c.forEach(p=>p())}},[r,e,o,i]),n.createElement(n.Fragment,null,t)}const Co=se(En,wo);function Mt(e){return we(Be,e)}function St(e,t,r){const o=e.getAttribute(t);return e.setAttribute(t,r),()=>{o?e.setAttribute(t,o):e.removeAttribute(t)}}function _o({portal:{root:e,container:{className:t,style:r,...o}={}},animation:i,styles:c,className:s,on:l,close:a,labels:d,children:p}){const[u,g]=n.useState(!1),[h,m]=n.useState(!1),f=n.useRef([]),b=n.useRef(null),{setTimeout:_}=Oe(),{subscribe:P}=Ie(),L=it()?0:i.fade;n.useEffect(()=>(g(!0),()=>{g(!1),m(!1)}),[]);const M=D(()=>{f.current.forEach(w=>w()),f.current=[]}),k=D(()=>{var w;m(!1),M(),(w=l.exiting)===null||w===void 0||w.call(l),_(()=>{var A;(A=l.exited)===null||A===void 0||A.call(l),a()},L)});n.useEffect(()=>P(ge,k),[P,k]);const E=D(w=>{var A,W,X;Wn(w),m(!0),(A=l.entering)===null||A===void 0||A.call(l);const C=(X=(W=w.parentNode)===null||W===void 0?void 0:W.children)!==null&&X!==void 0?X:[];for(let O=0;O<C.length;O+=1){const y=C[O];["TEMPLATE","SCRIPT","STYLE"].indexOf(y.tagName)===-1&&y!==w&&(f.current.push(St(y,"inert","")),f.current.push(St(y,"aria-hidden","true")))}f.current.push(()=>{var O,y;(y=(O=b.current)===null||O===void 0?void 0:O.focus)===null||y===void 0||y.call(O)}),_(()=>{var O;(O=l.entered)===null||O===void 0||O.call(l)},L)}),N=n.useCallback(w=>{w?E(w):M()},[E,M]);return u?gn.createPortal(n.createElement(io,{ref:N,className:oe(s,t,T(Mt()),T(Tt),h&&T(Mt("open"))),"aria-modal":!0,role:"dialog","aria-label":ve(d,"Lightbox"),style:{...i.fade!==ze.animation.fade?{[K("fade_animation_duration")]:`${L}ms`}:null,...i.easing.fade!==ze.animation.easing.fade?{[K("fade_animation_timing_function")]:i.easing.fade}:null,...c.root,...r},onFocus:w=>{b.current||(b.current=w.relatedTarget)},...o},p),(typeof e=="function"?e():e)||document.body):null}const Po=se(Be,_o);function Mo({children:e}){return n.createElement(n.Fragment,null,e)}const So=se(xn,Mo);function yo(e){return we(Rt,e)}function Lo({toolbar:{buttons:e},render:{buttonClose:t,iconClose:r},styles:o}){const{close:i,setToolbarWidth:c}=ce(),{setContainerRef:s,containerRect:l}=tn();re(()=>{c(l==null?void 0:l.width)},[c,l==null?void 0:l.width]);const a=()=>t?t():n.createElement(rt,{key:ge,label:"Close",icon:qn,renderIcon:r,onClick:i});return n.createElement("div",{ref:s,style:o.toolbar,className:T(yo())},e==null?void 0:e.map(d=>d===ge?a():d))}const Io=se(Rt,Lo);function cn(e,t){var r;return n.createElement(e.module.component,{key:e.module.name,...t},(r=e.children)===null||r===void 0?void 0:r.map(o=>cn(o,t)))}function Oo(e,t={}){const{easing:r,...o}=e,{easing:i,...c}=t;return{easing:{...r,...i},...o,...c}}function No({carousel:e,animation:t,render:r,toolbar:o,controller:i,noScroll:c,on:s,plugins:l,slides:a,index:d,...p}){const{animation:u,carousel:g,render:h,toolbar:m,controller:f,noScroll:b,on:_,slides:P,index:I,plugins:L,...M}=ze,{config:k,augmentation:E}=$n([Y(Po,[Y(Co,[Y(uo,[Y(po),Y(Io),Y(Eo)])])])],l||L),N=E({animation:Oo(u,t),carousel:{...g,...e},render:{...h,...r},toolbar:{...m,...o},controller:{...f,...i},noScroll:{...b,...c},on:{..._,...s},...M,...p});return N.open?n.createElement(Xn,{...N},n.createElement(Hn,{slides:a||P,index:ye(d||I)},n.createElement(jn,null,n.createElement(Un,null,n.createElement(Fn,null,cn(Y(So,k),N)))))):null}const sn={minZoom:1,maxZoomPixelRatio:1,zoomInMultiplier:2,doubleTapDelay:300,doubleClickDelay:500,doubleClickMaxStops:2,keyboardMoveDistance:50,wheelZoomDistanceFactor:100,pinchZoomDistanceFactor:100,pinchZoomV4:!1,scrollToZoom:!1,maxZoom:8};function Ro(e){return Math.min(Math.max(e,Number.EPSILON),1)}function ln(e){const{minZoom:t,...r}={...sn,...e};return{minZoom:Ro(t),...r}}function To(e,t,r,o){const i=n.useRef(void 0),c=n.useRef(void 0),{zoom:s}=G().animation,l=it(),a=D(()=>{var d,p,u;if((d=i.current)===null||d===void 0||d.cancel(),i.current=void 0,c.current&&(o!=null&&o.current)){try{i.current=(u=(p=o.current).animate)===null||u===void 0?void 0:u.call(p,[{transform:c.current},{transform:`scale(${e}) translateX(${t}px) translateY(${r}px)`}],{duration:l?0:s??500,easing:i.current?"ease-out":"ease-in-out"})}catch(g){console.error(g)}c.current=void 0,i.current&&(i.current.onfinish=()=>{i.current=void 0})}});return re(a,[e,t,r,a]),n.useCallback(()=>{c.current=o!=null&&o.current?window.getComputedStyle(o.current).transform:void 0},[o])}function ko(e,t){const{on:r}=G(),o=D(()=>{var i;t||(i=r.zoom)===null||i===void 0||i.call(r,{zoom:e})});n.useEffect(o,[e,o])}function Ne(){const{zoom:e}=G();return ln(e)}function Do(e,t){var r;const o=typeof e=="function"?(r=e(t))!==null&&r!==void 0?r:sn.maxZoom:e;return Math.max(o,1)}function Ao(e,t){var r,o;let i={width:0,height:0},c={width:0,height:0};const{currentSlide:s}=le(),{imageFit:l}=G().carousel,{maxZoomPixelRatio:a,maxZoom:d}=Ne();if(e&&s){const u={...s,...t};if(fe(u)){const g=nt(u,l),h=Math.max(...(((r=u.srcSet)===null||r===void 0?void 0:r.map(f=>f.width))||[]).concat(u.width?[u.width]:[])),m=Math.max(...(((o=u.srcSet)===null||o===void 0?void 0:o.map(f=>f.height))||[]).concat(u.height?[u.height]:[]));h>0&&m>0&&e.width>0&&e.height>0&&(c=g?{width:Math.round(Math.min(h,e.width/e.height*m)),height:Math.round(Math.min(m,e.height/e.width*h))}:{width:h,height:m},c={width:c.width*a,height:c.height*a},i=g?{width:Math.min(e.width,c.width,h),height:Math.min(e.height,c.height,m)}:{width:Math.round(Math.min(e.width,e.height/m*h,h)),height:Math.round(Math.min(e.height,e.width/h*m,m))})}else e.width>0&&e.height>0&&(t&&t.width>0&&t.height>0?i={width:Math.min(e.width,t.width),height:Math.min(e.height,t.height)}:i={width:e.width,height:e.height})}const p=s&&i.width?fe(s)?Math.max(tt(c.width/i.width,5),1):Do(d,s):1;return{imageRect:i,maxZoom:p}}function yt(e,t){return Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)}function Lt(e,t,r=100,o=2){return e*Math.min(1+Math.abs(t/r),o)**Math.sign(t)}function Zo(e,t,r,o,i,c,s,l,a){const d=n.useRef([]),p=n.useRef(0),u=n.useRef(void 0),{globalIndex:g}=le(),{getOwnerWindow:h}=Le(),{containerRef:m,subscribeSensors:f}=ce(),{keyboardMoveDistance:b,zoomInMultiplier:_,wheelZoomDistanceFactor:P,scrollToZoom:I,doubleTapDelay:L,doubleClickDelay:M,doubleClickMaxStops:k,pinchZoomDistanceFactor:E,pinchZoomV4:N}=Ne(),w=n.useCallback(x=>{if(m.current){const{pageX:R,pageY:U}=x,{scrollX:V,scrollY:S}=h(),{left:z,top:q,width:J,height:ee}=m.current.getBoundingClientRect();return[R-z-V-J/2,U-q-S-ee/2]}return[]},[m,h]),A=D(x=>{const{key:R,metaKey:U,ctrlKey:V}=x,S=U||V,z=()=>{x.preventDefault(),x.stopPropagation()};if(e>1){const q=(J,ee)=>{z(),l(J,ee)};R==="ArrowDown"?q(0,b):R==="ArrowUp"?q(0,-b):R==="ArrowLeft"?q(-b,0):R==="ArrowRight"&&q(b,0)}R==="+"||S&&R==="="?(z(),i()):R==="-"||S&&R==="_"?(z(),c()):S&&R==="0"&&(z(),s(1))}),W=D(x=>{if((x.ctrlKey||I)&&Math.abs(x.deltaY)>Math.abs(x.deltaX)){x.stopPropagation(),s(Lt(e,-x.deltaY,P),!0,...w(x));return}e>1&&(x.stopPropagation(),I||l(x.deltaX,x.deltaY))}),X=n.useCallback(x=>{const R=d.current;R.splice(0,R.length,...R.filter(U=>U.pointerId!==x.pointerId))},[]),C=n.useCallback(x=>{X(x),x.persist(),d.current.push(x)},[X]),O=D(x=>{var R;const U=d.current;if(x.pointerType==="mouse"&&x.buttons>1||!(!((R=a==null?void 0:a.current)===null||R===void 0)&&R.contains(x.target)))return;e>1&&x.stopPropagation();const{timeStamp:V}=x;if(U.length===0&&V-p.current<(x.pointerType==="touch"?L:M)){p.current=0;const S=e>=1?e!==r?e*Math.max(r**(1/k),_):1:e!==t?e/Math.max(t**(-1/k),_):1;s(S,!1,...w(x))}else p.current=V;if(C(x),U.length===2){const S=yt(U[0],U[1]);u.current={previousDistance:S,initialDistance:Math.max(S,1),initialZoom:e}}}),y=D(x=>{const R=d.current,U=R.find(V=>V.pointerId===x.pointerId);if(R.length===2&&u.current){x.stopPropagation(),C(x);const V=yt(R[0],R[1]),S=N?u.current.initialZoom/u.current.initialDistance*V:Lt(e,V-u.current.previousDistance,E);s(S,!0,...R.map(z=>w(z)).reduce((z,q)=>q.map((J,ee)=>z[ee]+J/2))),u.current.previousDistance=V;return}e>1&&(x.stopPropagation(),U&&(R.length===1&&l((U.clientX-x.clientX)/e,(U.clientY-x.clientY)/e),C(x)))}),F=n.useCallback(x=>{const R=d.current;R.length===2&&R.find(U=>U.pointerId===x.pointerId)&&(u.current=void 0),X(x)},[X]),$=n.useCallback(()=>{const x=d.current;x.splice(0,x.length),p.current=0,u.current=void 0},[]);nn(f,O,y,F,o),n.useEffect($,[g,$]),n.useEffect(()=>o?()=>{}:Je($,f(Ge,A),f(qe,W)),[o,f,$,A,W])}function Wo(e,t,r){const[o,i]=n.useState(1),[c,s]=n.useState(0),[l,a]=n.useState(0),d=To(o,c,l,r),{currentSlide:p,globalIndex:u}=le(),{containerRect:g,slideRect:h}=ce(),{minZoom:m,zoomInMultiplier:f}=Ne(),b=p&&fe(p)?p.src:void 0,_=!(r!=null&&r.current);re(()=>{i(1),s(0),a(0)},[u,b]);const P=n.useCallback((E,N,w)=>{const A=w||o,W=c-(E||0),X=l-(N||0),C=(e.width*A-h.width)/2/A,O=(e.height*A-h.height)/2/A;s(Math.min(Math.abs(W),Math.max(C,0))*Math.sign(W)),a(Math.min(Math.abs(X),Math.max(O,0))*Math.sign(X))},[o,c,l,h,e.width,e.height]),I=n.useCallback((E,N,w,A)=>{const W=tt(E+.01<t?E-.01>m?E:m:t,5);N||d(),P(w?w*(1/o-1/W):0,A?A*(1/o-1/W):0,W),i(W)},[o,m,t,P,d]),L=D(()=>{o>1&&(o>t&&I(t,!0),P())});re(L,[g.width,g.height,L]);const M=n.useCallback(()=>{const E=o*f;I(o<1&&E>1?1:E)},[o,f,I]),k=n.useCallback(()=>{const E=o/f;I(o>1&&E<1?1:E)},[o,f,I]);return{zoom:o,offsetX:c,offsetY:l,disabled:_,changeOffsets:P,changeZoom:I,zoomIn:M,zoomOut:k}}const an=n.createContext(null),st=ie("useZoom","ZoomControllerContext",an);function $o({children:e}){const[t,r]=n.useState(),{slideRect:o}=ce(),{ref:i,minZoom:c}=Ne(),{imageRect:s,maxZoom:l}=Ao(o,t==null?void 0:t.imageDimensions),{zoom:a,offsetX:d,offsetY:p,disabled:u,changeZoom:g,changeOffsets:h,zoomIn:m,zoomOut:f}=Wo(s,l,t==null?void 0:t.zoomWrapperRef);ko(a,u),Zo(a,c,l,u,m,f,g,h,t==null?void 0:t.zoomWrapperRef);const b=n.useMemo(()=>({zoom:a,minZoom:c,maxZoom:l,offsetX:d,offsetY:p,disabled:u,zoomIn:m,zoomOut:f,changeZoom:g}),[a,c,l,d,p,u,m,f,g]);n.useImperativeHandle(i,()=>b,[b]);const _=n.useMemo(()=>({...b,setZoomWrapper:r}),[b,r]);return n.createElement(an.Provider,{value:_},e)}const Fo=he("ZoomIn",n.createElement(n.Fragment,null,n.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),n.createElement("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"}))),Vo=he("ZoomOut",n.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})),It=n.forwardRef(function({zoomIn:t,onLoseFocus:r},o){const i=n.useRef(!1),c=n.useRef(!1),{zoom:s,minZoom:l,maxZoom:a,zoomIn:d,zoomOut:p,disabled:u}=st(),{render:g}=G(),h=u||(t?s>=a:s<=l);return n.useEffect(()=>{h&&i.current&&c.current&&r(),h||(i.current=!0)},[h,r]),n.createElement(rt,{ref:o,disabled:h,label:t?"Zoom in":"Zoom out",icon:t?Fo:Vo,renderIcon:t?g.iconZoomIn:g.iconZoomOut,onClick:t?d:p,onFocus:()=>{c.current=!0},onBlur:()=>{c.current=!1}})});function Uo(){const e=n.useRef(null),t=n.useRef(null),{focus:r}=ce(),o=n.useCallback(s=>{var l,a;!((l=s.current)===null||l===void 0)&&l.disabled?r():(a=s.current)===null||a===void 0||a.focus()},[r]),i=n.useCallback(()=>o(e),[o]),c=n.useCallback(()=>o(t),[o]);return n.createElement(n.Fragment,null,n.createElement(It,{zoomIn:!0,ref:e,onLoseFocus:c}),n.createElement(It,{ref:t,onLoseFocus:i}))}function Xo(){const{render:e}=G(),t=st();return e.buttonZoom?n.createElement(n.Fragment,null,e.buttonZoom(t)):n.createElement(Uo,null)}function Yo(e){var t;return(((t=e.srcSet)===null||t===void 0?void 0:t.length)||0)>0}function zo({current:e,preload:t},{type:r,source:o}){switch(r){case"fetch":return e?{current:e,preload:o}:{current:o};case"done":return o===t?{current:o}:{current:e,preload:t};default:throw new Error(Vt)}}function Ho(e){var t,r;const[{current:o,preload:i},c]=n.useReducer(zo,{}),{slide:s,rect:l,imageFit:a,render:d,interactive:p}=e,u=s.srcSet.sort((M,k)=>M.width-k.width),g=(t=s.width)!==null&&t!==void 0?t:u[u.length-1].width,h=(r=s.height)!==null&&r!==void 0?r:u[u.length-1].height,m=nt(s,a),f=Math.max(...u.map(M=>M.width)),b=Math.min((m?Math.max:Math.min)(l.width,g*(l.height/h)),f),_=Rn(),P=D(()=>{var M;const k=(M=u.find(E=>E.width>=b*_))!==null&&M!==void 0?M:u[u.length-1];(!o||u.findIndex(E=>E.src===o)<u.findIndex(E=>E===k))&&c({type:"fetch",source:k.src})});re(P,[l.width,l.height,_,P]);const I=D(M=>c({type:"done",source:M})),L={WebkitTransform:p?"initial":"translateZ(0)"};return m||Object.assign(L,l.width/l.height<g/h?{width:"100%",height:"auto"}:{width:"auto",height:"100%"}),n.createElement(n.Fragment,null,i&&i!==o&&n.createElement(Se,{key:"preload",...e,offset:void 0,slide:{...s,src:i,srcSet:void 0},style:{position:"absolute",visibility:"hidden",...L},onLoad:()=>I(i),render:{...d,iconLoading:()=>null,iconError:()=>null}}),o&&n.createElement(Se,{key:"current",...e,slide:{...s,src:o,srcSet:void 0},style:L}))}function Bo({render:e,slide:t,offset:r,rect:o}){var i;const[c,s]=n.useState(),l=n.useRef(null),a=fe(t),{zoom:d,maxZoom:p,offsetX:u,offsetY:g,setZoomWrapper:h}=st(),m=d>1,{carousel:f,on:b}=G(),{currentIndex:_}=le();re(()=>{if(r!==0||a||!l.current)return()=>{};const I=()=>{const M=l.current;if(!M)return;let k=0,E=0;for(const N of M.children)N instanceof HTMLElement&&(k=Math.max(k,N.offsetWidth),E=Math.max(E,N.offsetHeight));s(N=>N&&N.width===k&&N.height===E?N:{width:k,height:E})};if(I(),typeof ResizeObserver>"u")return()=>{};const L=new ResizeObserver(I);for(const M of l.current.children)L.observe(M);return()=>L.disconnect()},[r,a,o]),re(()=>r===0?(h({zoomWrapperRef:l,imageDimensions:c}),()=>h(void 0)):()=>{},[r,c,h]);let P=(i=e.slide)===null||i===void 0?void 0:i.call(e,{slide:t,offset:r,rect:o,zoom:d,maxZoom:p});if(!P&&a){const I={slide:t,offset:r,rect:o,render:e,imageFit:f.imageFit,imageProps:f.imageProps,onClick:r===0?()=>{var L;return(L=b.click)===null||L===void 0?void 0:L.call(b,{index:_})}:void 0};P=Yo(t)?n.createElement(Ho,{...I,slide:t,interactive:m,rect:r===0?{width:o.width*d,height:o.height*d}:o}):n.createElement(Se,{onLoad:L=>s({width:L.naturalWidth,height:L.naturalHeight}),...I})}return P?n.createElement("div",{ref:l,className:oe(T(Cn),T(Ke),T(kt),m&&T(Pn)),style:r===0?{transform:`scale(${d}) translateX(${u}px) translateY(${g}px)`}:void 0},P):null}const Ko=({augment:e,addModule:t})=>{e(({zoom:r,toolbar:o,render:i,controller:c,...s})=>{const l=ln(r);return{zoom:l,toolbar:kn(o,mt,n.createElement(Xo,null)),render:{...i,slide:a=>{var d,p;return fe(a.slide)||a.slide.type!=null&&(!((d=l.supports)===null||d===void 0)&&d.includes(a.slide.type))?n.createElement(Bo,{render:i,...a}):(p=i.slide)===null||p===void 0?void 0:p.call(i,a)}},controller:{...c,preventDefaultWheelY:l.scrollToZoom},...s}}),t(se(mt,$o))};function Qo({src:e,alt:t,open:r,onClose:o}){return pn.jsx(No,{open:r,close:o,slides:[{src:e,alt:t}],plugins:[Ko],zoom:{scrollToZoom:!0,maxZoomPixelRatio:5},styles:{container:{backgroundColor:"rgba(0, 0, 0, 0.85)",backdropFilter:"blur(8px)"},toolbar:{background:"transparent",padding:"16px"},button:{backgroundColor:"rgba(255, 255, 255, 0.1)",borderRadius:"9999px",color:"#fff",width:40,height:40},icon:{width:20,height:20}},animation:{fade:200}})}export{Qo as default};