@agent-dock/cli 0.1.1 → 0.1.2
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/agents/codex-acp.mjs +35 -1
- package/dist/cli.js +421 -286
- package/dist/cli.js.map +4 -4
- package/package.json +1 -1
- package/public/assets/{ImageLightbox-DDAwu-Ky.js → ImageLightbox-D0mGZhIC.js} +1 -1
- package/public/assets/{PromptEditor-CkEM_6zj.js → PromptEditor-Cfvua_lI.js} +1 -1
- package/public/assets/{index-DCRx7Io2.js → index-CVjQTj1y.js} +92 -92
- package/public/index.html +1 -1
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as pn,j as gn}from"./index-DCRx7Io2.js";import{a as n}from"./syntax-highlighter-fRlPMgFb.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?pn.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 gn.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};
|
|
1
|
+
import{r as pn,j as gn}from"./index-CVjQTj1y.js";import{a as n}from"./syntax-highlighter-fRlPMgFb.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?pn.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 gn.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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as vp,j as Ye,a as Pp,P as Tp,E as Cp,M as Zp}from"./index-
|
|
1
|
+
import{_ as vp,j as Ye,a as Pp,P as Tp,E as Cp,M as Zp}from"./index-CVjQTj1y.js";import{a as ye}from"./syntax-highlighter-fRlPMgFb.js";let xo=[],ff=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?ff:xo).push(t=t+n[e])})();function Ap(n){if(n<768)return!1;for(let e=0,t=xo.length;;){let i=e+t>>1;if(n<xo[i])t=i;else if(n>=ff[i])e=i+1;else return!0;if(e==t)return!1}}function wa(n){return n>=127462&&n<=127487}const $a=8205;function Xp(n,e,t=!0,i=!0){return(t?uf:Mp)(n,e,i)}function uf(n,e,t){if(e==n.length)return e;e&&df(n.charCodeAt(e))&&Of(n.charCodeAt(e-1))&&e--;let i=Cs(n,e);for(e+=va(i);e<n.length;){let r=Cs(n,e);if(i==$a||r==$a||t&&Ap(r))e+=va(r),i=r;else if(wa(r)){let s=0,o=e-2;for(;o>=0&&wa(Cs(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Mp(n,e,t){for(;e>1;){let i=uf(n,e-2,t);if(i<e)return i;e--}return 0}function Cs(n,e){let t=n.charCodeAt(e);if(!Of(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return df(i)?(t-55296<<10)+(i-56320)+65536:t}function df(n){return n>=56320&&n<57344}function Of(n){return n>=55296&&n<56320}function va(n){return n<65536?1:2}class B{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=Pi(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),ut.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Pi(this,e,t);let i=[];return this.decompose(e,t,i,0),ut.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new sn(this),s=new sn(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(e=1){return new sn(this,e)}iterRange(e,t=this.length){return new pf(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new mf(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?B.empty:e.length<=32?new oe(e):ut.from(oe.split(e,[]))}}class oe extends B{constructor(e,t=Rp(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?i:l)>=e)return new Lp(r,l,i,o);r=l+1,i++}}decompose(e,t,i,r){let s=e<=0&&t>=this.length?this:new oe(Pa(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=i.pop(),l=br(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new oe(l,o.length+s.length));else{let a=l.length>>1;i.push(new oe(l.slice(0,a)),new oe(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof oe))return super.replace(e,t,i);[e,t]=Pi(this,e,t);let r=br(this.text,br(i.text,Pa(this.text,0,e)),t),s=this.length+i.length-(t-e);return r.length<=32?new oe(r,s):ut.from(oe.split(r,[]),s)}sliceString(e,t=this.length,i=`
|
|
2
2
|
`){[e,t]=Pi(this,e,t);let r="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(r+=i),e<a&&t>s&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],r=-1;for(let s of e)i.push(s),r+=s.length+1,i.length==32&&(t.push(new oe(i,r)),i=[],r=-1);return r>-1&&t.push(new oe(i,r)),t}}class ut extends B{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,r);r=l+1,i=a+1}}decompose(e,t,i,r){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let h=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=Pi(this,e,t),i.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e>=s&&t<=l){let a=o.replace(e-s,t-s,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let c=this.children.slice();return c[r]=a,new ut(c,this.length-(t-e)+i.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
|
3
3
|
`){[e,t]=Pi(this,e,t);let r="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=i),e<a&&t>o&&(r+=l.sliceString(e-o,t-o,i)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof ut))return 0;let i=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return i;let a=this.children[r],h=e.children[s];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let O of e)O.flatten(d);return new oe(d,t)}let r=Math.max(32,i>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,c=[];function f(d){let O;if(d.lines>s&&d instanceof ut)for(let p of d.children)f(p);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof oe&&a&&(O=c[c.length-1])instanceof oe&&d.lines+O.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new oe(O.text.concat(d.text),O.length+1+d.length)):(a+d.lines>r&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:ut.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new ut(l,t)}}B.empty=new oe([""],0);function Rp(n){let e=-1;for(let t of n)e+=t.length+1;return e}function br(n,e,t=0,i=1e9){for(let r=0,s=0,o=!0;s<n.length&&r<=i;s++){let l=n[s],a=r+l.length;a>=t&&(a>i&&(l=l.slice(0,i-r)),r<t&&(l=l.slice(t-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function Pa(n,e,t){return br(n,[""],e,t)}class sn{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof oe?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],s=this.offsets[i],o=s>>1,l=r instanceof oe?r.text.length:r.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
4
4
|
`,this;e--}else if(r instanceof oe){let a=r.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof oe?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class pf{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new sn(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class mf{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(B.prototype[Symbol.iterator]=function(){return this.iter()},sn.prototype[Symbol.iterator]=pf.prototype[Symbol.iterator]=mf.prototype[Symbol.iterator]=function(){return this});let Lp=class{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}};function Pi(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function ue(n,e,t=!0,i=!0){return Xp(n,e,t,i)}function Ep(n){return n>=56320&&n<57344}function jp(n){return n>=55296&&n<56320}function Ze(n,e){let t=n.charCodeAt(e);if(!jp(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Ep(i)?(t-55296<<10)+(i-56320)+65536:t}function kl(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function dt(n){return n<65536?1:2}const Qo=/\r\n?|\n/;var ge=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(ge||(ge={}));class bt{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,r=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(i,r,s),r+=s):r+=o,i+=s}}iterChangedRanges(e,t=!1){ko(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];r<0?e.push(i,r):e.push(r,i)}return new bt(e)}composeDesc(e){return this.empty?e:e.empty?this:gf(this,e)}mapDesc(e,t=!1){return e.empty?this:wo(this,e,t)}mapPos(e,t=-1,i=ge.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=r+l;if(a<0){if(h>e)return s+(e-r);s+=l}else{if(i!=ge.Simple&&h>=e&&(i==ge.TrackDel&&r<e&&h>e||i==ge.TrackBefore&&r<e||i==ge.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==r||t<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let i=0,r=0;i<this.sections.length&&r<=t;){let s=this.sections[i++],o=this.sections[i++],l=r+s;if(o>=0&&r<=t&&l>=e)return r<e&&l>t?"cover":!0;r=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new bt(e)}static create(e){return new bt(e)}}class ae extends bt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return ko(this,(t,i,r,s,o)=>e=e.replace(r,r+(i-t),o),!1),e}mapDesc(e,t=!1){return wo(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,s=0;r<t.length;r+=2){let o=t[r],l=t[r+1];if(l>=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;i.length<a;)i.push(B.empty);i.push(o?e.slice(s,s+o):B.empty)}s+=o}return new ae(t,i)}compose(e){return this.empty?e:e.empty?this:gf(this,e,!0)}map(e,t=!1){return e.empty?this:wo(this,e,t,!0)}iterChanges(e,t=!1){ko(this,e,t)}get desc(){return bt.create(this.sections)}filter(e){let t=[],i=[],r=[],s=new On(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break e;let c=Math.min(s.len,a-l);xe(r,c,-1);let f=s.ins==-1?-1:s.off==0?s.ins:0;xe(t,c,f),f>0&&jt(i,t,s.text),s.forward(c),l+=c}let h=e[o++];for(;l<h;){if(s.done)break e;let c=Math.min(s.len,h-l);xe(t,c,-1),xe(r,c,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(c),l+=c}}return{changes:new ae(t,i),filtered:bt.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],r=this.sections[t+1];r<0?e.push(i):r==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let r=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!r.length)return;o<t&&xe(r,t-o,-1);let f=new ae(r,s);l=l?l.compose(f.map(l)):f,r=[],s=[],o=0}function h(c){if(Array.isArray(c))for(let f of c)h(f);else if(c instanceof ae){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:f,to:u=f,insert:d}=c;if(f>u||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let O=d?typeof d=="string"?B.of(d.split(i||Qo)):d:B.empty,p=O.length;if(f==u&&p==0)return;f<o&&a(),f>o&&xe(r,f-o,-1),xe(r,u-f,p),jt(s,r,O),o=u}}return h(e),a(!l),l}static empty(e){return new ae(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let r=0;r<e.length;r++){let s=e[r];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<r;)i.push(B.empty);i[r]=B.of(s.slice(1)),t.push(s[0],i[r].length)}}}return new ae(t,i)}static createSet(e,t){return new ae(e,t)}}function xe(n,e,t,i=!1){if(e==0&&t<=0)return;let r=n.length-2;r>=0&&t<=0&&t==n[r+1]?n[r]+=e:r>=0&&e==0&&n[r]==0?n[r+1]+=t:i?(n[r]+=e,n[r+1]+=t):n.push(e,t)}function jt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(B.empty);n.push(t)}}function ko(n,e,t){let i=n.inserted;for(let r=0,s=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)r+=l,s+=l;else{let h=r,c=s,f=B.empty;for(;h+=l,c+=a,a&&i&&(f=f.append(i[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(r,h,s,c,f),r=h,s=c}}}function wo(n,e,t,i=!1){let r=[],s=i?[]:null,o=new On(n),l=new On(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);xe(r,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let h=l.len;for(xe(r,l.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=c&&(xe(r,0,o.ins),s&&jt(s,r,o.text),a=o.i),o.forward(c),h-=c}l.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;xe(r,h,a<o.i?o.ins:0),s&&a<o.i&&jt(s,r,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return s?ae.createSet(r,s):bt.create(r);throw new Error("Mismatched change set lengths")}}}function gf(n,e,t=!1){let i=[],r=t?[]:null,s=new On(n),o=new On(e);for(let l=!1;;){if(s.done&&o.done)return r?ae.createSet(i,r):bt.create(i);if(s.ins==0)xe(i,s.len,0,l),s.next();else if(o.len==0&&!o.done)xe(i,0,o.ins,l),r&&jt(r,i,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),h=i.length;if(s.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;xe(i,a,c,l),r&&c&&jt(r,i,o.text)}else o.ins==-1?(xe(i,s.off?0:s.len,a,l),r&&jt(r,i,s.textBit(a))):(xe(i,s.off?0:s.len,o.off?0:o.ins,l),r&&!o.off&&jt(r,i,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),s.forward2(a),o.forward(a)}}}}class On{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?B.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?B.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Lt{constructor(e,t,i,r){this.from=e,this.to=t,this.flags=i,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new Lt(i,r,this.flags,this.goalColumn)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return y.range(e,t,void 0,void 0,i);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return y.range(this.anchor,r,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return y.range(e.anchor,e.head)}static create(e,t,i,r){return new Lt(e,t,i,r)}}class y{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:y.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new y([this.main],0)}addRange(e,t=!0){return y.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,y.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new y(e.ranges.map(t=>Lt.fromJSON(t)),e.main)}static single(e,t=e){return new y([y.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;r<e.length;r++){let s=e[r];if(s.empty?s.from<=i:s.from<i)return y.normalized(e.slice(),t);i=s.to}return new y(e,t)}static cursor(e,t=0,i,r){return Lt.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i)),r)}static range(e,t,i,r,s){let o=r==null?7:Math.min(6,r);return!s&&e!=t&&(s=t<e?1:-1),s&&(o|=s<0?8:16),t<e?Lt.create(t,e,o|32,i):Lt.create(e,t,o,i)}static undirectionalRange(e,t){return Lt.create(e,t,64,void 0)}static normalized(e,t=0){let i=e[t];e.sort((r,s)=>r.from-s.from),t=e.indexOf(i);for(let r=1;r<e.length;r++){let s=e[r],o=e[r-1];if(s.empty?s.from<=o.to:s.from<o.to){let l=o.from,a=Math.max(s.to,o.to);r<=t&&t--,e.splice(--r,2,s.anchor>s.head?y.range(a,l):y.range(l,a))}}return new y(e,t)}}function Sf(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let wl=0;class Z{constructor(e,t,i,r,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=r,this.id=wl++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new Z(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:$l),!!e.static,e.enables)}of(e){return new yr([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new yr(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new yr(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function $l(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class yr{constructor(e,t,i,r){this.dependencies=e,this.facet=t,this.type=i,this.value=r,this.id=wl++}dynamicSlot(e){var t;let i=this.value,r=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||$o(f,c)){let d=i(f);if(l?!Ta(d,f.values[o],r):!r(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,O=u.config.address[s];if(O!=null){let p=Mr(u,O);if(this.dependencies.every(g=>g instanceof Z?u.facet(g)===f.facet(g):g instanceof be?u.field(g,!1)==f.field(g,!1):!0)||(l?Ta(d=i(f),p,r):r(d=i(f),p)))return f.values[o]=p,0}else d=i(f);return f.values[o]=d,1}}}get extension(){return this}}function Ta(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function $o(n,e){let t=!1;for(let i of e)on(n,i)&1&&(t=!0);return t}function zp(n,e,t){let i=t.map(a=>n[a.id]),r=t.map(a=>a.type),s=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;c<i.length;c++){let f=Mr(a,i[c]);if(r[c]==2)for(let u of f)h.push(u);else h.push(f)}return e.combine(h)}return{create(a){for(let h of i)on(a,h);return a.values[o]=l(a),1},update(a,h){if(!$o(a,s))return 0;let c=l(a);return e.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,h){let c=$o(a,i),f=h.config.facets[e.id],u=h.facet(e);if(f&&!c&&$l(t,f))return a.values[o]=u,0;let d=l(a);return e.compare(d,u)?(a.values[o]=u,0):(a.values[o]=d,1)}}}const Gn=Z.define({static:!0});class be{constructor(e,t,i,r,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=r,this.spec=s,this.provides=void 0}static define(e){let t=new be(wl++,e.create,e.update,e.compare||((i,r)=>i===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Gn).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,r)=>{let s=i.values[t],o=this.updateF(s,r);return this.compareF(s,o)?0:(i.values[t]=o,1)},reconfigure:(i,r)=>{let s=i.facet(Gn),o=r.facet(Gn),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):r.config.address[this.id]!=null?(i.values[t]=r.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,Gn.of({field:this,create:e})]}get extension(){return this}}const Kt={lowest:4,low:3,default:2,high:1,highest:0};function Ii(n){return e=>new bf(e,n)}const At={highest:Ii(Kt.highest),high:Ii(Kt.high),default:Ii(Kt.default),low:Ii(Kt.low),lowest:Ii(Kt.lowest)};class bf{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class fs{of(e){return new vo(this,e)}reconfigure(e){return fs.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class vo{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class Xr{constructor(e,t,i,r,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let r=[],s=Object.create(null),o=new Map;for(let u of Yp(e,t,o))u instanceof be?r.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of r)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i==null?void 0:i.config.facets;for(let u in s){let d=s[u],O=d[0].facet,p=c&&c[u]||[];if(d.every(g=>g.type==0))if(l[O.id]=a.length<<1|1,$l(p,d))a.push(i.facet(O));else{let g=O.combine(d.map(S=>S.value));a.push(i&&O.compare(g,i.facet(O))?i.facet(O):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(S=>g.dynamicSlot(S)));l[O.id]=h.length<<1,h.push(g=>zp(g,O,d))}}let f=h.map(u=>u(l));return new Xr(e,o,f,l,a,s)}}function Yp(n,e,t){let i=[[],[],[],[],[]],r=new Map;function s(o,l){let a=r.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof vo&&t.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof vo){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,l)}else if(o instanceof bf)s(o.inner,o.prec);else if(o instanceof be)i[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof yr)i[l].push(o),o.facet.extensions&&s(o.facet.extensions,Kt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}).`);if(h==o)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(n,Kt.default),i.reduce((o,l)=>o.concat(l))}function on(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let r=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|r}function Mr(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const yf=Z.define(),Po=Z.define({combine:n=>n.some(e=>e),static:!0}),xf=Z.define({combine:n=>n.length?n[0]:void 0,static:!0}),Qf=Z.define(),kf=Z.define(),wf=Z.define(),$f=Z.define({combine:n=>n.length?n[0]:!1});class Qt{constructor(e,t){this.type=e,this.value=t}static define(){return new _p}}class _p{of(e){return new Qt(this,e)}}class Wp{constructor(e){this.map=e}of(e){return new L(this,e)}}class L{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new L(this.type,t)}is(e){return this.type==e}static define(e={}){return new Wp(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let r of e){let s=r.map(t);s&&i.push(s)}return i}}L.reconfigure=L.define();L.appendConfig=L.define();class le{constructor(e,t,i,r,s,o){this.startState=e,this.changes=t,this.selection=i,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Sf(i,t.newLength),s.some(l=>l.type==le.time)||(this.annotations=s.concat(le.time.of(Date.now())))}static create(e,t,i,r,s,o){return new le(e,t,i,r,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(le.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}le.time=Qt.define();le.userEvent=Qt.define();le.addToHistory=Qt.define();le.remote=Qt.define();function Dp(n,e){let t=[];for(let i=0,r=0;;){let s,o;if(i<n.length&&(r==e.length||e[r]>=n[i]))s=n[i++],o=n[i++];else if(r<e.length)s=e[r++],o=e[r++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function vf(n,e,t){var i;let r,s,o;return t?(r=e.changes,s=ae.empty(e.changes.length),o=n.changes.compose(e.changes)):(r=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(r)),{changes:o,selection:e.selection?e.selection.map(s):(i=n.selection)===null||i===void 0?void 0:i.map(r),effects:L.mapEffects(n.effects,r).concat(L.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function To(n,e,t){let i=e.selection,r=bi(e.annotations);return e.userEvent&&(r=r.concat(le.userEvent.of(e.userEvent))),{changes:e.changes instanceof ae?e.changes:ae.of(e.changes||[],t,n.facet(xf)),selection:i&&(i instanceof y?i:y.single(i.anchor,i.head)),effects:bi(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function Pf(n,e,t){let i=To(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;i=vf(i,To(n,e[s],o?i.changes.newLength:n.doc.length),o)}let r=le.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Bp(t?Vp(r):r)}function Vp(n){let e=n.startState,t=!0;for(let r of e.facet(Qf)){let s=r(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:Dp(t,s))}if(t!==!0){let r,s;if(t===!1)s=n.changes.invertedDesc,r=ae.empty(e.doc.length);else{let o=n.changes.filter(t);r=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}n=le.create(e,r,n.selection&&n.selection.map(s),L.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let i=e.facet(kf);for(let r=i.length-1;r>=0;r--){let s=i[r](n);s instanceof le?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof le?n=s[0]:n=Pf(e,bi(s),!1)}return n}function Bp(n){let e=n.startState,t=e.facet(wf),i=n;for(let r=t.length-1;r>=0;r--){let s=t[r](n);s&&Object.keys(s).length&&(i=vf(i,To(e,s,n.changes.newLength),!0))}return i==n?n:le.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const qp=[];function bi(n){return n==null?qp:Array.isArray(n)?n:[n]}var te=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(te||(te={}));const Ip=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Co;try{Co=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Np(n){if(Co)return Co.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||Ip.test(t)))return!0}return!1}function Gp(n){return e=>{if(!/\S/.test(e))return te.Space;if(Np(e))return te.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return te.Word;return te.Other}}class D{constructor(e,t,i,r,s,o){this.config=e,this.doc=t,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)on(this,l<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return on(this,i),Mr(this,i)}update(...e){return Pf(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:r}=t;for(let l of e.effects)l.is(fs.reconfigure)?(t&&(r=new Map,t.compartments.forEach((a,h)=>r.set(h,a)),t=null),r.set(l.value.compartment,l.value.extension)):l.is(L.reconfigure)?(t=null,i=l.value):l.is(L.appendConfig)&&(t=null,i=bi(i).concat(l.value));let s;t?s=e.startState.values.slice():(t=Xr.resolve(i,r,this),s=new D(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(Po)?e.newSelection:e.newSelection.asSingle();new D(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:y.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),r=this.changes(i.changes),s=[i.range],o=bi(i.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),h=this.changes(a.changes),c=h.map(r);for(let u=0;u<l;u++)s[u]=s[u].map(c);let f=r.mapDesc(h,!0);s.push(a.range.map(f)),r=r.compose(c),o=L.mapEffects(o,c).concat(L.mapEffects(bi(a.effects),f))}return{changes:r,selection:y.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof ae?e:ae.of(e,this.doc.length,this.facet(D.lineSeparator))}toText(e){return B.of(e.split(this.facet(D.lineSeparator)||Qo))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(on(this,t),Mr(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let r=e[i];r instanceof be&&this.config.address[r.id]!=null&&(t[i]=r.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let o=i[s],l=e[s];r.push(o.init(a=>o.spec.fromJSON(l,a)))}}return D.create({doc:e.doc,selection:y.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=Xr.resolve(e.extensions||[],new Map),i=e.doc instanceof B?e.doc:B.of((e.doc||"").split(t.staticFacet(D.lineSeparator)||Qo)),r=e.selection?e.selection instanceof y?e.selection:y.single(e.selection.anchor,e.selection.head):y.single(0);return Sf(r,i.length),t.staticFacet(Po)||(r=r.asSingle()),new D(t,i,r,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(D.tabSize)}get lineBreak(){return this.facet(D.lineSeparator)||`
|