react-super-simple-scroller
Version:
Yet another react infinite scroller
1 lines • 51.8 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports["react-super-simple-scroller"]=t(require("react"),require("react-dom")):e["react-super-simple-scroller"]=t(e.react,e["react-dom"])}(self,(e,t)=>(()=>{"use strict";var r={63:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default=({portalIDListRef:e,cellPortalListRef:t,cellDataListRef:r,portalContainerMapRef:n,headBandListRef:o,tailBandListRef:a,cradleActualRef:l,callbacksRef:s})=>({backwardCellsToRemoveCount:c,forwardCellsToRemoveCount:i,backwardBandsToRemoveCount:u,forwardBandsToRemoveCount:d})=>{const f=e.current,p=t.current,h=r.current,m=n.current,g=o.current,b=a.current,v=l.current,R=i?f.splice(-i):[],w=f.splice(0,c);R.forEach(e=>{m.get(e).remove(),m.delete(e)}),w.forEach(e=>{m.get(e).remove(),m.delete(e)}),i&&p.splice(-i),c&&p.splice(0,c),i&&h.splice(-i),c&&h.splice(0,c),v.backwardCells-=c,v.forwardCells-=i,v.totalCells=v.backwardCells+v.forwardCells;const y=g.splice(0,u),C=d?b.splice(-d):[];if(v.backwardBands-=u,v.forwardBands-=d,v.totalBands=v.backwardBands+v.forwardBands,y.forEach(e=>{e.parentElement.removeChild(e)}),C.forEach(e=>{e.parentElement.removeChild(e)}),s.current.removed){const e=w.concat(R);e.length&&s.current.removed(e)}}},147:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createBand=t.createContainer=t.getCellGapFromSpacing=t.getBandPaddingFromSpacing=t.getCradleMarginsFromSpacing=t.baseCradleActual=t.isValidID=void 0;t.isValidID=e=>"number"==typeof e&&!Number.isNaN(e)||"string"==typeof e,t.baseCradleActual={cellsPerBand:null,totalBands:0,forwardBands:0,backwardBands:0,forwardCells:0,backwardCells:0,totalCells:0};t.getCradleMarginsFromSpacing=e=>{let t=e.cradleMargin;t=null!=t?t:[];let[r,n]=t;return r=null!=r?r:0,n=null!=n?n:0,[r,n]};t.getBandPaddingFromSpacing=e=>{let t=e.bandPadding;t=null!=t?t:[];let[r,n]=t;return r=null!=r?r:0,n=null!=n?n:0,[r,n]};t.getCellGapFromSpacing=e=>{let t=e.cellGap;return t=null!=t?t:0,t};t.createContainer=(e,t,r,n,o)=>{const a=document.createElement("div");return a.setAttribute("data-type","portal-container"),a.setAttribute("data-id",e),a.style.position="relative",a.style.boxSizing="border-box","vertical"==n?(a.style.maxWidth=t.maxWidth+"px",a.style.minWidth=t.minWidth+"px","uniform"==o?a.style.height=t.maxHeight+"px":(a.style.minHeight=t.minHeight+"px",a.style.maxHeight=t.maxHeight+"px")):(a.style.maxHeight=t.maxHeight+"px",a.style.minHeight=t.minHeight+"px","uniform"==o?a.style.width=t.maxWidth+"px":(a.style.minWidth=t.minWidth+"px",a.style.maxWidth=t.maxWidth+"px")),a};t.createBand=(e,t,r,n,o)=>{const{cellGap:a,bandPadding:l,cradleMargin:s}=n,c=document.createElement("div"),[i,u]=l,[d,f]=s;o&&o.observe(c,{childList:!0}),c.setAttribute("data-type","band"),c.style.display="grid",c.style.boxSizing="border-box";const p=`repeat(${r}, 1fr)`;return"vertical"==e?(c.style.gridTemplateColumns=p,c.style.paddingTop=i+"px",c.style.paddingBottom=u+"px",c.style.paddingLeft=d+"px",c.style.paddingRight=f+"px",c.style.columnGap=a+"px",c.style.minWidth="100%","variable"==t&&(c.style.gridTemplateRows="max-content")):(c.style.gridTemplateRows=p,c.style.paddingLeft=i+"px",c.style.paddingRight=u+"px",c.style.paddingTop=d+"px",c.style.paddingBottom=f+"px",c.style.rowGap=a+"px",c.style.minHeight="100%","variable"==t&&(c.style.gridTemplateColumns="max-content")),c}},155:t=>{t.exports=e},177:(e,t,r)=>{r.r(t),r.d(t,{ErrorBoundary:()=>l,ErrorBoundaryContext:()=>o,useErrorBoundary:()=>s,withErrorBoundary:()=>c});var n=r(155);const o=(0,n.createContext)(null),a={didCatch:!1,error:null};class l extends n.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=a}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(null!==e){for(var t,r,n=arguments.length,o=new Array(n),l=0;l<n;l++)o[l]=arguments[l];null===(t=(r=this.props).onReset)||void 0===t||t.call(r,{args:o,reason:"imperative-api"}),this.setState(a)}}componentDidCatch(e,t){var r,n;null===(r=(n=this.props).onError)||void 0===r||r.call(n,e,t)}componentDidUpdate(e,t){const{didCatch:r}=this.state,{resetKeys:n}=this.props;var o,l;r&&null!==t.error&&function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.length!==t.length||e.some((e,r)=>!Object.is(e,t[r]))}(e.resetKeys,n)&&(null===(o=(l=this.props).onReset)||void 0===o||o.call(l,{next:n,prev:e.resetKeys,reason:"keys"}),this.setState(a))}render(){const{children:e,fallbackRender:t,FallbackComponent:r,fallback:a}=this.props,{didCatch:l,error:s}=this.state;let c=e;if(l){const e={error:s,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)c=t(e);else if(r)c=(0,n.createElement)(r,e);else{if(void 0===a)throw s;c=a}}return(0,n.createElement)(o.Provider,{value:{didCatch:l,error:s,resetErrorBoundary:this.resetErrorBoundary}},c)}}function s(){const e=(0,n.useContext)(o);!function(e){if(null==e||"boolean"!=typeof e.didCatch||"function"!=typeof e.resetErrorBoundary)throw new Error("ErrorBoundaryContext not found")}(e);const[t,r]=(0,n.useState)({error:null,hasError:!1}),a=(0,n.useMemo)(()=>({resetBoundary:()=>{e.resetErrorBoundary(),r({error:null,hasError:!1})},showBoundary:e=>r({error:e,hasError:!0})}),[e.resetErrorBoundary]);if(t.hasError)throw t.error;return a}function c(e,t){const r=(0,n.forwardRef)((r,o)=>(0,n.createElement)(l,t,(0,n.createElement)(e,{...r,ref:o}))),o=e.displayName||e.name||"Unknown";return r.displayName="withErrorBoundary(".concat(o,")"),r}},494:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,a){function l(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(l,s)}c((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const o=r(155);t.default=({scrollerName:e,STANDARD_SCROLL_MOMENTUM_FADE:t,AXIS_START_POSITION:r,DOMManipulationQueueRef:a,orientationRef:l,viewportRef:s,headblockRef:c,leadHeadblockBandRef:i,headblockOverflowTriggerRef:u,tailblockRef:d,tailblockOverflowTriggerRef:f,leadTailblockBandRef:p,cradleActualRef:h,cradlePotentialRef:m,headBandListRef:g,tailBandListRef:b,intersectionsMapRef:v,scrollTopRef:R,scrollLeftRef:w,axisPositionRef:y,portalIDListRef:C,immediateIsScrollingRef:B,immediateStopScrollingRef:k,restoreScrollingTimeoutIDRef:x,setAxisPosition:D,assertIntersectionsDisconnect:E,assertIntersectionsConnect:P,fillCradle:I,updateCurrentAxisReferenceID:T,trimCradle:M})=>{const S=a.current,L=(0,o.useCallback)(e=>n(void 0,void 0,void 0,function*(){if(!s.current)return;if(v.current.size<7)return;if(!C.current.length)return;const e=v.current,o=e.get("lead-headblock-band"),a=e.get("headblock-overflow-trigger"),c=e.get("lead-headblock-band-backward-trigger"),i=e.get("lead-tailblock-band"),u=e.get("lead-tailblock-band-end-trigger"),d=e.get("lead-tailblock-band-forward-trigger"),f=e.get("tailblock-overflow-trigger"),p="before"==a.rs3position&&"before"==o.rs3position&&"before"==c.rs3position&&"before"==i.rs3position&&"before"==d.rs3position&&"before"==u.rs3position&&"before"==f.rs3position,h="after"==a.rs3position&&"after"==o.rs3position&&"after"==c.rs3position&&"after"==i.rs3position&&"after"==d.rs3position&&"after"==u.rs3position&&"after"==f.rs3position;if(p||h)return console.log("WARNING: POSITION RECOVERY","from all",p?"before":"after"),E(),B.current&&(s.current.style.overflow="hidden",k.current=!0,R.current=s.current.scrollTop,w.current,s.current.scrollLeft,clearTimeout(x.current),x.current=setTimeout(()=>{k.current=!1,s.current&&(s.current.style.overflow="auto")},t)),"vertical"==l.current?(k.current=!1,D(0,r-1,"outside"),s.current.scrollTo(w.current,r)):(k.current=!1,D(r-1,0,"outside"),s.current.scrollTo(r,R.current)),void setTimeout(()=>{P()},1);if("in"==o.rs3position||"in"==i.rs3position){if("in"!=a.rs3position&&"in"!=c.rs3position&&"in"!=f.rs3position&&"in"!=d.rs3position&&"in"!=u.rs3position&&("in"==o.rs3position&&"in"!=i.rs3position||"in"!=o.rs3position&&"in"==i.rs3position))return}if("before"!=a.rs3position){E(),B.current&&(s.current.style.overflow="hidden",k.current=!0,R.current=s.current.scrollTop,w.current=s.current.scrollLeft,clearTimeout(x.current),x.current=setTimeout(()=>{k.current=!1,s.current&&(s.current.style.overflow="auto")},t));const e=()=>n(void 0,void 0,void 0,function*(){E(),O(),yield I(),setTimeout(()=>{P()},1)});return void(yield S.enqueue(e))}if("after"!=f.rs3position&&g.current.length){E(),B.current&&(s.current.style.overflow="hidden",k.current=!0,R.current=s.current.scrollTop,w.current,s.current.scrollLeft,clearTimeout(x.current),x.current=setTimeout(()=>{k.current=!1,s.current&&(s.current.style.overflow="auto")},t));const e=()=>n(void 0,void 0,void 0,function*(){E(),_(),yield I(),setTimeout(()=>{P()},1)});return void(yield S.enqueue(e))}if("in"==c.rs3position){E();const e=b.current;let t=0;if("vertical"==l.current){const r=c.boundingClientRect.bottom-c.rootBounds.top;let n=e.length-1,o=e[n].offsetHeight,a=0;for(;o+a<r&&(o+=a,n--,!(n<0));)a=e[n].offsetHeight;t=e.length-n}else{const r=c.boundingClientRect.right-c.rootBounds.left;let n=e.length-1,o=e[n].offsetWidth,a=0;for(;o+a<r&&(o+=a,n--,!(n<0));)a=e[n].offsetHeight;t=e.length-n}const r=t,o=()=>n(void 0,void 0,void 0,function*(){E(),A("backward",r),yield I(),setTimeout(()=>{P()},1)});return void(yield S.enqueue(o))}if("before"==d.rs3position){E();const e=b.current;let t=0;if(!e.length)return;if("vertical"==l.current){const r=d.rootBounds.top-d.boundingClientRect.bottom;let n=e.length-1,o=e[n].offsetHeight,a=0;for(;o+a<r&&(o+=a,n--,!(n<0));)a=e[n].offsetHeight;t=e.length-n}else{const r=c.rootBounds.left-c.boundingClientRect.right;let n=e.length-1,o=e[n].offsetWidth,a=0;for(;o+a<r&&(o+=a,n--,!(n<0));)a=e[n].offsetHeight;t=e.length-n}const r=t,o=()=>n(void 0,void 0,void 0,function*(){E(),A("forward",r),yield I(),setTimeout(()=>{P()},1)});return void(yield S.enqueue(o))}}),[]),O=()=>{const e=h.current;e.backwardBands?A("backward",e.backwardBands):"vertical"==l.current?(R.current=r,s.current.scrollTo(w.current,r),D(0,r-1,"head overflow")):(s.current.scrollTo(r,R.current),w.current=r,D(r-1,0,"head overflow")),e.totalCells=e.forwardCells+e.backwardCells,e.totalBands=e.forwardBands+e.backwardBands},_=()=>{const e=f.current.getBoundingClientRect(),t=s.current.getBoundingClientRect();if("vertical"==l.current){const r=t.bottom-e.top,n=t.height,o=c.current.offsetHeight+d.current.offsetHeight+2-(n-r),a=Math.min(r,o)+3,l=y.current.y;a&&D(0,l+a,"tail overflow")}else{const r=t.right-e.left,n=t.width,o=c.current.offsetWidth+d.current.offsetWidth+2-(n-r),a=Math.min(r,o)+3,l=y.current.x;a&&D(l+a,0)}},A=(e,t)=>{const r=h.current,n=(m.current,c.current,g.current),o=(d.current,b.current),a=i.current,u=p.current;if("forward"==e)for(let e=1;e<=t;e++){const e=o.shift(),t=o[0],s=n.at(-1);n.push(e);const c=e.childElementCount;if(r.forwardBands--,r.forwardCells-=c,r.backwardBands++,r.backwardCells+=c,s&&a.before(s),a.append(e),t&&u.append(t),"vertical"==l.current){const t=y.current.y,r=e.offsetHeight;D(0,t+r,"forward shift")}else{const t=y.current.x,r=e.offsetWidth;D(t+r,0)}}else{if(!n.length)return void("vertical"==l.current?D(0,s.current.scrollTop-1):D(s.current.scrollLeft-1,0));for(let e=t;e>=1;e--){const e=n.pop(),t=n.at(-1),s=o[0];s&&u.after(s),u.append(e),o.unshift(e),t&&a.append(t);const c=e.childElementCount;if(r.forwardBands++,r.forwardCells+=c,r.backwardBands--,r.backwardCells-=c,"vertical"==l.current){const t=y.current.y,r=e.offsetHeight;D(0,t-r,"backward shift")}else{const t=y.current.x,r=e.offsetWidth;D(t-r,0)}}}M(),T()};return L}},514:e=>{e.exports=t},605:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,a){function l(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(l,s)}c((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const o=r(155),a=r(147);t.default=({DOMManipulationQueueRef:e,cradlePotentialRef:t,portalContainerMapRef:r,portalIDListRef:l,cellPortalListRef:s,cellDataListRef:c,tailBandListRef:i,headBandListRef:u,cradleActualRef:d,setPortalRenderList:f,assertIntersectionsDisconnect:p,assertIntersectionsConnect:h,getSeed:m,callbacksRef:g,resetAxisPosition:b})=>(0,o.useCallback)(e=>n(void 0,void 0,void 0,function*(){const n=t.current;r.current.forEach(e=>{e.remove()}),r.current.clear(),l.current.length=0,s.current.length=0,f([]),c.current.length=0,i.current.forEach(e=>{e.remove()}),i.current.length=0;u.current.length;u.current.forEach(e=>{e.remove()}),u.current.length=0;let o=null==e||e;if(!0!==o&&(o=!1),d.current=Object.assign(Object.assign({},a.baseCradleActual),{orientation:n.orientation,layout:n.layout,cellsPerBand:n.cellsPerBand}),o)return;const v=!(0,a.isValidID)(e);v&&g.current.error&&g.current.error({source:"reset",message:"must be a valid seed referenceID",arguments:[e],timestamp:Date.now()}),v||s.current.length||(p(),yield m(e),b(),setTimeout(()=>{h()},1))}),[])},678:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(){this.queue=[],this.pendingPromise=!1}enqueue(e){return new Promise((t,r)=>{this.queue.push({promise:e,resolve:t,reject:r}),this.dequeue()})}dequeue(){if(this.pendingPromise)return!1;const e=this.queue.shift();if(!e)return!1;try{this.pendingPromise=!0,e.promise().then(t=>{this.pendingPromise=!1,e.resolve(t),this.dequeue()}).catch(t=>{this.pendingPromise=!1,e.reject(t),this.dequeue()})}catch(t){this.pendingPromise=!1,e.reject(t),this.dequeue()}return!0}}},691:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,a){function l(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(l,s)}c((n=n.apply(e,t||[])).next())})},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const a=o(r(155)),l=r(514),s=r(147);t.default=({scrollerName:e,orientationRef:t,layoutRef:r,spacingRef:o,cradlePotentialRef:c,cradleActualRef:i,cellPortalListRef:u,portalIDListRef:d,cellDataListRef:f,portalContainerMapRef:p,cellDimensionsRef:h,tailblockRef:m,tailBandListRef:g,leadTailblockBandRef:b,headblockRef:v,headBandListRef:R,leadHeadblockBandRef:w,setPortalRenderList:y,fetchCellsRef:C,updateCurrentAxisReferenceID:B,callbacksRef:k,bandMutationObserverRef:x})=>{const D=k.current,E=(e,...t)=>n(void 0,[e,...t],void 0,function*(e,t=null){if(!m.current||!v.current)return;const r=c.current,n=i.current,o=C.current;if(r)if("seed"==e){const r=1,n=yield o(e,t,r);if(n.length>r){const e=n.splice(r);if(e.length){const t=e.map(e=>e.id);D.failed&&D.failed({source:"fetchCells, seed",message:"too many cellPacks; excess not loaded",excessList:t,timestamp:Date.now()})}}if(n.length){const e=P(n);u.current=e,y(e),B()}yield E("forward")}else if("forward"==e){const t=g.current;let a=0;t.length>1&&(a=n.cellsPerBand-t[0].childElementCount);let l=!0;for(;n.forwardCells<r.forwardCells-a&&l;){const t=r.forwardCells-n.forwardCells;let a=[];if(t>0&&(a=yield o(e,d.current.at(-1),t)),a.length>t){const e=a.splice(t);if(e.length){const t=e.map(e=>e.id);D.failed&&D.failed({source:"fetchCells, forward",message:"too many cellPacks; excess not loaded",excessList:t,timestamp:Date.now()})}}if(a.length){const r=I(a);if(r.length===u.current.length){D.error&&D.error({source:"fetchCells, forward",message:"one or more errors found in fetched cellPacks. Loading aborted",arguments:[e,d.current.at(-1),t],return:a,timestamp:Date.now()});break}u.current=r,y(r),B()}else l=!1}yield E("backward")}else if("backward"==e){let t=!0;for(;n.backwardCells<r.backwardCells&&t;){const a=r.backwardCells-n.backwardCells;let l=[];if(a>0&&(l=yield o(e,d.current[0],a)),l.length>a){const e=l.splice(a);if(e.length){const t=e.map(e=>e.id);D.failed&&D.failed({source:"fetchCells, backward",message:"too many cellPacks; excess not loaded",excessList:t,timestamp:Date.now()})}}if(l.length){const t=T(l);if(t.length===u.current.length){D.error&&D.error({source:"fetchCells, backward",message:"one or more errors found in fetched cellPacks. Loading aborted",arguments:[e,d.current[0],a],return:l,timestamp:Date.now()});break}u.current=t,y(t),B()}else t=!1}}}),P=e=>{const n=i.current,c=[],m=u.current,v=e[0];if("object"!=typeof v||!a.default.isValidElement(v.component)||!(0,s.isValidID)(v.id))return D.error&&D.error({source:"fetchCells, seed",message:"cellPack must have valid id and component; seed cellPack ignored",arguments:[v],timestamp:Date.now()}),m;const{id:R,component:w}=v;f.current.push(v),d.current.push(R);const y=(0,s.createContainer)(R,h.current,n.cellsPerBand,t.current,r.current);p.current.set(R,y),c.push((0,l.createPortal)(w,y,R));const C=(0,s.createBand)(t.current,r.current,i.current.cellsPerBand,o.current,x.current);g.current.push(C),b.current.append(C),C.append(y),n.totalBands++,n.forwardBands++,n.forwardCells++,n.totalCells++;return m.concat(c)},I=e=>{const n=[],c=u.current;if(!e.every(e=>{const t=!("object"==typeof e&&a.default.isValidElement(e.component)&&(0,s.isValidID)(e.id));t&&D.error&&D.error({source:"fetchCells, forward",message:"cellPack must have valid id and component",arguments:[e],timestamp:Date.now()});let r=!1;return t||(r=p.current.has(e.id),r&&D.error&&D.error({source:"fetchCells, forward",message:"fetched cellPack is a duplicate",arguments:[e],timestamp:Date.now()})),!r&&!t}))return c;const v=i.current;e.forEach(e=>{f.current.push(e);const{id:a,component:c}=e;d.current.push(a);const i=(0,s.createContainer)(a,h.current,v.cellsPerBand,t.current,r.current);let u;p.current.set(a,i),n.push((0,l.createPortal)(c,i,a));const R=g.current.at(-1);R&&R.childElementCount<v.cellsPerBand?u=R:(u=(0,s.createBand)(t.current,r.current,v.cellsPerBand,o.current,x.current),0==g.current.length?b.current.append(u):m.current.append(u),g.current.push(u),v.totalBands++,v.forwardBands++),u.append(i),v.forwardCells++,v.totalCells++});return c.concat(n)},T=e=>{const n=[],c=u.current;if(!e.every(e=>{const t=!("object"==typeof e&&a.default.isValidElement(e.component)&&(0,s.isValidID)(e.id));t&&D.error&&D.error({source:"fetchCells, backward",message:"cellPack must have valid id and component",arguments:[e],timestamp:Date.now()});let r=!1;return t||(r=p.current.has(e.id),r&&D.error&&D.error({source:"fetchCells, backward",message:"fetched cellPack is a duplicate",arguments:[e],timestamp:Date.now()})),!r&&!t}))return c;const m=i.current;e.forEach(e=>{f.current.unshift(e);const{id:a,component:c}=e;d.current.unshift(a);const u=(0,s.createContainer)(a,h.current,i.current.cellsPerBand,t.current,r.current);let b;p.current.set(a,u),n.unshift((0,l.createPortal)(c,u,a));const y=R.current[0];if(!y){const e=g.current[0];if(e.childElementCount<m.cellsPerBand)return b=e,b.prepend(u),m.forwardCells++,void m.totalCells++}y&&y.childElementCount<m.cellsPerBand?b=y:(b=(0,s.createBand)(t.current,r.current,m.cellsPerBand,o.current,x.current),0==R.current.length?w.current.append(b):v.current.prepend(b),R.current.unshift(b),m.totalBands++,m.backwardBands++),b.prepend(u),m.backwardCells++,m.totalCells++});return n.concat(c)};return E}},787:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.selectStyles=t.SCROLLBLOCK_SPAN=void 0;const r=1e6;t.SCROLLBLOCK_SPAN=r;const n={height:r+"px",width:"100%",position:"relative"},o={position:"absolute",top:0,left:0,height:0,width:"100%"},a={zIndex:0,position:"absolute",left:0,bottom:0,width:"fit-content",minWidth:"100%",display:"flex",flexDirection:"column"},l={zIndex:-1,position:"absolute",top:0,left:0,height:"1px",width:"100%"},s={zIndex:0,position:"relative",minHeight:"1px",minWidth:"100%"},c={zIndex:-1,position:"absolute",top:0,left:0,height:"1px",width:"100%"},i={zIndex:0,position:"absolute",top:0,left:0,width:"fit-content",minWidth:"100%",display:"flex",flexDirection:"column"},u={zIndex:-1,position:"absolute",bottom:"-4px",right:0,height:"1px",width:"100%"},d={zIndex:0,position:"relative",minHeight:"1px",minWidth:"100%"},f={zIndex:-1,position:"absolute",top:"5px",right:0,height:"1px",width:"100%"},p={zIndex:-1,position:"absolute",bottom:0,right:0,height:"1px",width:"100%"},h={width:r+"px",height:"100%",position:"relative"},m={position:"absolute",left:0,top:0,width:0,height:"100%"},g={zIndex:0,position:"absolute",top:0,right:0,height:"fit-content",minHeight:"100%",display:"flex",flexDirection:"row"},b={zIndex:-1,position:"absolute",left:0,top:0,height:"100%",width:"1px"},v={zIndex:0,position:"relative",minWidth:"1px",minHeight:"100%"},R={zIndex:-1,position:"absolute",left:0,top:0,height:"100%",width:"1px"},w={zIndex:0,position:"absolute",left:0,top:0,height:"fit-content",minHeight:"100%",display:"flex",flexDirection:"row"},y={zIndex:-1,position:"absolute",right:"-4px",top:0,height:"100%",width:"1px"},C={zIndex:0,position:"relative",minWidth:"1px",minHeight:"100%"},B={zIndex:-1,position:"absolute",top:0,left:0,height:"100%",width:"1px"},k={zIndex:-1,position:"absolute",top:0,right:0,height:"100%",width:"1px"};t.selectStyles=e=>{let t;return t="vertical"==e?{scrollblockStyles:n,axisStyles:o,headblockStyles:a,leadHeadblockBandStyles:s,headblockOverflowTriggerStyles:l,leadHeadblockBandBackwardTriggerStyles:c,tailblockStyles:i,leadTailblockBandStyles:d,tailblockOverflowTriggerStyles:u,leadTailblockBandForwardTriggerStyles:f,leadTailblockBandEndTriggerStyles:p}:{scrollblockStyles:h,axisStyles:m,headblockStyles:g,leadHeadblockBandStyles:v,headblockOverflowTriggerStyles:b,leadHeadblockBandBackwardTriggerStyles:R,tailblockStyles:w,leadTailblockBandStyles:C,tailblockOverflowTriggerStyles:y,leadTailblockBandForwardTriggerStyles:B,leadTailblockBandEndTriggerStyles:k},t}},869:function(e,t,r){var n,o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||(n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)},function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=n(e),l=0;l<r.length;l++)"default"!==r[l]&&o(t,e,r[l]);return a(t,e),t}),s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,a){function l(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(l,s)}c((n=n.apply(e,t||[])).next())})},c=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const u=l(r(155)),d=r(177),f=i(r(678)),p=r(787),h=r(147),m=i(r(691)),g=i(r(937)),b=i(r(63)),v=i(r(494)),R=i(r(605)),w=i(r(967)),y=r(787),C=r(147),B=p.SCROLLBLOCK_SPAN/2;let k=700,x=200,D=4;const E={position:"absolute",inset:0,overflow:"auto",scrollbarWidth:"none",overscrollBehavior:"none",overflowAnchor:"none"},P={display:"none"};function I({error:e,resetErrorBoundary:t}){return u.default.createElement("div",{role:"alert"},u.default.createElement("p",null,"Something went wrong:"),u.default.createElement("p",{style:{color:"red"}},e.message))}const T=e=>{const[t,r]=(0,u.useState)({error:!1,message:null}),n=(0,u.useRef)({}),o=(0,u.useRef)({}),a=(0,u.useRef)({}),{orientation:l="vertical",layout:c="uniform",cellDimensions:i,seedReferenceID:d,fetchCells:p,callbacks:I=n.current,calls:T,spacing:M=o.current,operations:S=a.current,scrollerName:L="not named"}=e,O=(0,u.useRef)(new f.default),_=(0,u.useRef)(!1),A=(0,u.useRef)(l),j=(0,u.useRef)(c),H=(0,u.useRef)(i),N=(0,u.useRef)(M),q=(0,u.useRef)(d),z=(0,u.useRef)(p),W=(0,u.useRef)(p),V=(0,u.useRef)(null),F=(0,u.useRef)(null),G=(0,u.useRef)(null),Q=(0,u.useRef)(null),K=(0,u.useRef)(null),U=(0,u.useRef)(null),$=(0,u.useRef)(null),X=(0,u.useRef)(null),[Y,J]=(0,u.useState)("setup"),Z=(0,u.useRef)(null),[ee,te]=(0,u.useState)(null),re=(0,u.useRef)(null),ne=(0,u.useRef)(!1),[oe,ae]=(0,u.useState)((0,y.selectStyles)(l)),le=(0,u.useRef)(null),se=(0,u.useRef)(null),ce=(0,u.useRef)(null),ie=(0,u.useRef)(null),ue=(0,u.useRef)(null),de=(0,u.useRef)(null),fe=(0,u.useRef)(null),pe=(0,u.useRef)(null),he=(0,u.useRef)(null),me=(0,u.useRef)(null),ge=(0,u.useRef)(null),be=(0,u.useRef)(null),[ve,Re]=(0,u.useState)(null),we=(0,u.useRef)(null),ye=(0,u.useRef)(Object.assign({orientation:l,layout:c},C.baseCradleActual)),Ce=(0,u.useRef)({x:0,y:B}),Be=(0,u.useRef)(null),ke=(0,u.useRef)(null),xe=(0,u.useRef)(null),De=(0,u.useRef)(d),Ee=(0,u.useRef)([]),Pe=(0,u.useRef)([]),Ie=(0,u.useRef)([]),Te=(0,u.useRef)(new Map),[Me,Se]=(0,u.useState)([]),Le=(0,u.useRef)([]),Oe=(0,u.useRef)([]),_e=(0,u.useRef)(0),Ae=(0,u.useRef)(0),[je,He]=(0,u.useState)(!1),Ne=(0,u.useRef)(!1),qe=(0,u.useRef)(!1),ze=(0,u.useRef)(null),We=(0,u.useRef)(new Map),Ve=(0,u.useRef)(null),Fe=(0,u.useRef)(null),Ge=(0,u.useRef)(null),Qe=(0,u.useRef)(null),Ke=(0,u.useRef)(null),Ue=(0,u.useRef)(null);V.current=l,F.current=c,G.current=i,Q.current=d,K.current=I,U.current=T,X.current=S,re.current=ee,we.current=ve,Z.current=Y;const $e=()=>{_.current&&(ze.current.disconnect(),_.current=!1)},Xe=()=>{_.current||O.current.queue.length||(We.current.clear(),fe.current&&ze.current.observe(fe.current),ue.current&&ze.current.observe(ue.current),de.current&&ze.current.observe(de.current),he.current&&ze.current.observe(he.current),me.current&&ze.current.observe(me.current),ge.current&&ze.current.observe(ge.current),be.current&&ze.current.observe(be.current),_.current=!0)},Ye=(0,u.useCallback)((e,t,r="general")=>{const n=`translate(${e+"px"},${t+"px"})`;Ce.current={x:e,y:t},ce.current.style.transform=n},[]),Je=()=>{const e=Pe.current.at(-ye.current.forwardCells);e!==De.current&&(De.current=e,K.current.axisReferenceID&&K.current.axisReferenceID(e))},Ze=()=>{const e=ye.current,t=we.current,r=Oe.current;let n=0;r.length>1&&(n=e.cellsPerBand-r[0].childElementCount);const o=Math.max(e.forwardBands-t.forwardBands,0),a=Math.max(e.backwardBands-t.backwardBands,0),l=Math.max(e.forwardCells-(t.forwardCells-n),0),s=Math.max(e.backwardCells-t.backwardCells,0);ot({forwardCellsToRemoveCount:l,forwardBandsToRemoveCount:o,backwardCellsToRemoveCount:s,backwardBandsToRemoveCount:a})},et=()=>s(void 0,void 0,void 0,function*(){return yield nt("forward"),!0}),tt=e=>s(void 0,void 0,void 0,function*(){return(0,h.isValidID)(e)?(yield nt("seed",e),!0):(I.error&&I.error({source:"getSeed",message:"must be a valid referenceID",arguments:[e],timestamp:Date.now()}),!1)}),rt=()=>{if(le.current)if("vertical"==V.current){const e=Ce.current.y-le.current.scrollTop;_e.current=B,le.current.scrollTo(Ae.current,B),Ye(0,B+e,"stop scrolling")}else{const e=Ce.current.x-le.current.scrollLeft;Ae.current=B,le.current.scrollTo(B,_e.current),Ye(B+e,0)}},nt=(0,m.default)({scrollerName:L,orientationRef:V,layoutRef:F,spacingRef:$,cradlePotentialRef:we,cradleActualRef:ye,cellPortalListRef:Ie,portalIDListRef:Pe,cellDataListRef:Ee,portalContainerMapRef:Te,cellDimensionsRef:G,tailblockRef:pe,tailBandListRef:Oe,leadTailblockBandRef:he,headblockRef:ie,headBandListRef:Le,leadHeadblockBandRef:ue,setPortalRenderList:Se,fetchCellsRef:z,updateCurrentAxisReferenceID:Je,callbacksRef:K,bandMutationObserverRef:Ge}),ot=(0,b.default)({portalIDListRef:Pe,cellPortalListRef:Ie,cellDataListRef:Ee,portalContainerMapRef:Te,headBandListRef:Le,tailBandListRef:Oe,cradleActualRef:ye,callbacksRef:K}),at=(0,v.default)({scrollerName:L,DOMManipulationQueueRef:O,orientationRef:V,intersectionsMapRef:We,immediateIsScrollingRef:Ne,viewportRef:le,immediateStopScrollingRef:qe,scrollTopRef:_e,scrollLeftRef:Ae,restoreScrollingTimeoutIDRef:Ke,STANDARD_SCROLL_MOMENTUM_FADE:k,AXIS_START_POSITION:B,axisPositionRef:Ce,cradleActualRef:ye,tailblockOverflowTriggerRef:be,cradlePotentialRef:we,headblockRef:ie,headBandListRef:Le,tailblockRef:pe,tailBandListRef:Oe,leadHeadblockBandRef:ue,headblockOverflowTriggerRef:fe,leadTailblockBandRef:he,portalIDListRef:Pe,setAxisPosition:Ye,assertIntersectionsDisconnect:$e,assertIntersectionsConnect:Xe,trimCradle:Ze,fillCradle:et,updateCurrentAxisReferenceID:Je}),lt=(0,R.default)({DOMManipulationQueueRef:O,cradlePotentialRef:we,portalContainerMapRef:Te,portalIDListRef:Pe,cellPortalListRef:Ie,cellDataListRef:Ee,tailBandListRef:Oe,headBandListRef:Le,cradleActualRef:ye,setPortalRenderList:Se,assertIntersectionsDisconnect:$e,assertIntersectionsConnect:Xe,getSeed:tt,callbacksRef:K,resetAxisPosition:rt}),st=(0,g.default)({DOMManipulationQueueRef:O,orientationRef:V,layoutRef:F,spacingRef:$,seedReferenceIDRef:Q,currentAxisReferenceIDRef:De,cradleActualRef:ye,cellPortalListRef:Ie,portalIDListRef:Pe,portalContainerMapRef:Te,headblockRef:ie,headBandListRef:Le,leadHeadblockBandRef:ue,tailblockRef:pe,tailBandListRef:Oe,leadTailblockBandRef:he,assertIntersectionsDisconnect:$e,assertIntersectionsConnect:Xe,setPortalRenderList:Se,removeCells:ot,getSeed:tt,fillCradle:et,updateCurrentAxisReferenceID:Je,bandMutationObserverRef:Ge}),ct=(0,w.default)({DOMManipulationQueueRef:O,scrollerName:L,operationsRef:X,portalIDListRef:Pe,cellPortalListRef:Ie,cellDataListRef:Ee,portalContainerMapRef:Te,spacingRef:$,scrollTopRef:_e,scrollLeftRef:Ae,viewportRef:le,headblockRef:ie,tailblockRef:pe,headBandListRef:Le,tailBandListRef:Oe,leadHeadblockBandRef:ue,cradleActualRef:ye,cradlePotentialRef:we,cellDimensionsRef:G,viewportDimensionsRef:re,orientationRef:V,layoutRef:F,currentAxisReferenceIDRef:De,setPortalRenderList:Se,updateCurrentAxisReferenceID:Je,trimCradle:Ze,fillCradle:et,reset:lt,callbacksRef:K,assertIntersectionsDisconnect:$e,assertIntersectionsConnect:Xe,bandMutationObserverRef:Ge});(0,u.useEffect)(()=>()=>{le.current&&le.current.remove()},[]),(0,u.useEffect)(()=>{Be.current=(0,C.getCradleMarginsFromSpacing)(M),ke.current=(0,C.getBandPaddingFromSpacing)(M),xe.current=(0,C.getCellGapFromSpacing)(M),$.current={cradleMargin:Be.current,bandPadding:ke.current,cellGap:xe.current}},[M]),(0,u.useEffect)(()=>{ze.current=new IntersectionObserver(it,{root:le.current});return(Ve.current=new ResizeObserver(ut)).observe(le.current),()=>{ze.current.disconnect(),Ve.current.disconnect()}},[]),(0,u.useEffect)(()=>{"vertical"==V.current?(le.current.scrollTo(Ae.current,B),Ye(0,B-1,"setup")):(le.current.scrollTo(B,_e.current),Ye(B-1,0))},[]),(0,u.useEffect)(()=>{T&&Object.assign(T,ct)},[T]);const it=(0,u.useCallback)((e,t)=>{e.sort((e,t)=>e.time-t.time),e.forEach(e=>{"vertical"==V.current?e.rs3position=e.isIntersecting?"in":e.rootBounds.top>e.boundingClientRect.bottom?"before":"after":e.rs3position=e.isIntersecting?"in":e.rootBounds.left>e.boundingClientRect.right?"before":"after",We.current.set(e.target.dataset.type,e)}),at("observer")},[]),ut=(0,u.useCallback)(e=>{const t=e[0].borderBoxSize[0],r=t.inlineSize,n=t.blockSize;$e();const o="setup"==Y?x:k;clearTimeout(Ue.current),Ue.current=setTimeout(()=>{"setup"==Y&&J("ready"),ne.current=!0,te({width:r,height:n})},o)},[Y]),dt=e=>{const{target:t}=e;e.stopPropagation(),clearTimeout(Qe.current),qe.current?t.scrollTo(Ae.current,_e.current):(_e.current=t.scrollTop,Ae.current=t.scrollLeft),je||(Ne.current=!0,He(!0)),Qe.current=setTimeout(()=>{He(!1)},k)};if((0,u.useEffect)(()=>{let e,t;if(S.dispatchAttachedEvents){const r=new Event("rs3attached"),n=e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{for(let t=0;t<e.children.length;t++){const n=e.children[t];n.firstChild&&n.firstChild.dispatchEvent(r)}})})},o=e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{e.firstChild&&e.firstChild.dispatchEvent(r)})})};Fe.current=e=new MutationObserver(n),e.observe(ie.current,{childList:!0}),e.observe(ue.current,{childList:!0}),e.observe(pe.current,{childList:!0}),e.observe(he.current,{childList:!0}),Ge.current=t=new MutationObserver(o);const a=Le.current,l=Oe.current;a.forEach(e=>{t.observe(e,{childList:!0})}),l.forEach(e=>{t.observe(e,{childList:!0})})}else Fe.current&&Fe.current.disconnect(),Ge.current&&Ge.current.disconnect();return()=>{Fe.current&&Fe.current.disconnect(),Ge.current&&Ge.current.disconnect()}},[S.dispatchAttachedEvents]),(0,u.useLayoutEffect)(()=>{if(!ee)return;const[e,t]=Be.current,n=xe.current;let o,a;const s=i.maxWidth,u=i.maxHeight,d=i.minWidth,f=i.minHeight,[p,h]=$.current.bandPadding,m=p+h;if("vertical"==l?(o=Math.ceil((ee.width-(e+t)+n)/(s+n)),a="uniform"==c?Math.ceil(ee.height/(u+m)):Math.ceil(ee.height/(f+m))):(o=Math.ceil((ee.height-(e+t)+n)/(u+n)),a="uniform"==c?Math.ceil(ee.width/(s+m)):Math.ceil(ee.width/(d+m))),o<=0){const e="A scroller fatal error occured: cellsPerBand calculated to 0, resulting in an undefined state. Scroller container width and height must always be able to accommodate content. Scroller operation halted.";return console.log(e),void r({error:!0,message:e})}const g=a+2*D,b=g-D,v=b*o,R=D*o,w={orientation:l,layout:c,cellsPerBand:o,visibleBands:a,totalBands:g,forwardBands:b,backwardBands:D,forwardCells:v,backwardCells:R,totalCells:v+R};null===ye.current.cellsPerBand&&(ye.current.cellsPerBand=o),ae((0,y.selectStyles)(l)),Re(w),ne.current&&(ne.current=!1,K.current.resized&&K.current.resized(Object.assign({cellDimensions:Object.assign({},G.current),spacing:Object.assign({},$.current),viewportDimensions:Object.assign({},re.current)},w)))},[l,c,i,M,ee,D]),(0,u.useLayoutEffect)(()=>{ve&&(A.current!==V.current||j.current!==F.current||H.current!==G.current||N.current!==$.current?(A.current=V.current,j.current=F.current,H.current=G.current,N.current=$.current,q.current=Q.current,W.current=z.current,O.current.enqueue(()=>s(void 0,void 0,void 0,function*(){yield lt(De.current),Xe()}))):O.current.enqueue(()=>s(void 0,void 0,void 0,function*(){yield st(ve),Xe()})))},[ve]),(0,u.useLayoutEffect)(()=>{if("setup"==Z.current)return;if(z.current=p,q.current===Q.current&&W.current===p)return;const e=q.current!==d?d:De.current;q.current=Q.current,W.current=z.current,O.current.enqueue(()=>s(void 0,void 0,void 0,function*(){yield lt(e),Xe()}))},[d,p]),(0,u.useLayoutEffect)(()=>{"setup"!=Z.current&&(je||(rt(),Ne.current=!1))},[je]),t.error)throw new Error(t.message);return u.default.createElement(u.default.Fragment,null,u.default.createElement("div",{"data-type":"viewport","data-scrollername":L,style:E,onScroll:dt,ref:le},u.default.createElement("div",{"data-type":"scrollblock",style:oe.scrollblockStyles,ref:se},u.default.createElement("div",{"data-type":"axis",style:oe.axisStyles,ref:ce},u.default.createElement("div",{"data-type":"headblock",style:oe.headblockStyles,ref:ie},u.default.createElement("div",{"data-type":"headblock-overflow-trigger",style:oe.headblockOverflowTriggerStyles,ref:fe}),u.default.createElement("div",{"data-type":"lead-headblock-band",style:oe.leadHeadblockBandStyles,ref:ue},u.default.createElement("div",{"data-type":"lead-headblock-band-backward-trigger",style:oe.leadHeadblockBandBackwardTriggerStyles,ref:de}))),u.default.createElement("div",{"data-type":"tailblock",style:oe.tailblockStyles,ref:pe},u.default.createElement("div",{"data-type":"lead-tailblock-band",style:oe.leadTailblockBandStyles,ref:he},u.default.createElement("div",{"data-type":"lead-tailblock-band-forward-trigger",style:oe.leadTailblockBandForwardTriggerStyles,ref:me}),u.default.createElement("div",{"data-type":"lead-tailblock-band-end-trigger",style:oe.leadTailblockBandEndTriggerStyles,ref:ge})),u.default.createElement("div",{"data-type":"tailblock-overflow-trigger",style:oe.tailblockOverflowTriggerStyles,ref:be}))))),u.default.createElement("div",{"data-type":"virtual-cradle",style:P},Me))};t.default=e=>{var{orientation:t,layout:r,cellDimensions:n,seedReferenceID:o,fetchCells:a}=e,l=c(e,["orientation","layout","cellDimensions","seedReferenceID","fetchCells"]);const{callbacks:s,calls:i,spacing:f,operations:p,scrollerName:h}=l,m={orientation:t,layout:r,cellDimensions:n,seedReferenceID:o,fetchCells:a,callbacks:s,calls:i,spacing:f,operations:p,scrollerName:h},{technical:g}=l;return(0,u.useEffect)(()=>{var e,t,r;const n=null!=g?g:{};k=null!==(e=n.STANDARD_SCROLL_MOMENTUM_FADE)&&void 0!==e?e:700,x=null!==(t=n.SHORT_MOMENTUM_FADE)&&void 0!==t?t:200,D=null!==(r=null==p?void 0:p.runway)&&void 0!==r?r:4},[g]),u.default.createElement(d.ErrorBoundary,{fallbackRender:I},u.default.createElement(T,Object.assign({},m)))}},937:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,a){function l(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(l,s)}c((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0});const o=r(155),a=r(147);t.default=({DOMManipulationQueueRef:e,orientationRef:t,layoutRef:r,spacingRef:l,seedReferenceIDRef:s,currentAxisReferenceIDRef:c,cradleActualRef:i,cellPortalListRef:u,portalIDListRef:d,portalContainerMapRef:f,headblockRef:p,headBandListRef:h,leadHeadblockBandRef:m,tailblockRef:g,tailBandListRef:b,leadTailblockBandRef:v,assertIntersectionsDisconnect:R,assertIntersectionsConnect:w,setPortalRenderList:y,removeCells:C,getSeed:B,fillCradle:k,updateCurrentAxisReferenceID:x,bandMutationObserverRef:D})=>(0,o.useCallback)(e=>n(void 0,void 0,void 0,function*(){if(null==s.current)return;R();const n=i.current,o=Object.assign({},n),c=u.current,E=h.current,P=b.current,I=t.current,T=r.current,M=d.current,S=p.current,L=g.current,O=m.current,_=v.current,A=D.current;if(e.cellsPerBand!==n.cellsPerBand){const t=e.cellsPerBand,r=e=>{const r=`repeat(${t}, 1fr)`;"vertical"==I?e.style.gridTemplateColumns=r:e.style.gridTemplateRows=r};E.forEach(e=>{r(e)}),P.forEach(e=>{r(e)});const s=Math.min(e.backwardBands,Math.ceil(o.backwardCells/t));let c=0;if(s>n.backwardBands){const e=s-n.backwardBands;for(let r=1;r<=e;r++){const e=(0,a.createBand)(I,T,t,l.current,A);0===E.length?O.append(e):S.prepend(e),E.unshift(e),n.backwardBands++}}if(s){let e=n.backwardCells-1;for(let r=E.length-1;r>=E.length-s;r--){const n=Math.min(e-(t-1),0),o=e-(t-1)+n,a=o+(t+n),l=M.slice(o,a),s=[];e-=l.length,c+=l.length,l.forEach(e=>{s.push(f.current.get(e))});E[r].replaceChildren(...s)}}const i=Math.min(e.forwardBands,Math.ceil(o.forwardCells/t));let d=0;if(i>n.forwardBands){const e=i-n.forwardBands;for(let r=1;r<=e;r++){const e=(0,a.createBand)(I,T,t,l.current,A);0===P.length?_.append(e):L.append(e),P.push(e),n.forwardBands++}}if(i){let e=n.backwardCells;for(let r=0;r<i;r++){const n=Math.min(M.length-1-(e+(t-1)),0),o=e,a=o+(t+n),l=M.slice(o,a),s=[];e+=l.length,d+=l.length,l.forEach(e=>{s.push(f.current.get(e))});P[r].replaceChildren(...s)}}const p=Math.max(o.backwardBands-s,0),h=Math.max(o.backwardCells-c,0),m=Math.max(o.forwardBands-i,0),g=Math.max(o.forwardCells-d,0);C({backwardCellsToRemoveCount:h,forwardCellsToRemoveCount:g,backwardBandsToRemoveCount:p,forwardBandsToRemoveCount:m}),Object.assign(n,{totalBands:n.backwardBands+n.forwardBands,totalCells:c+d,cellsPerBand:t}),y(u.current),x()}c.length?(yield k(),n.totalBands=n.backwardBands+n.forwardBands,n.totalCells=n.backwardCells+n.forwardCells,setTimeout(()=>{w()},1)):(yield B(s.current),n.totalBands=n.backwardBands+n.forwardBands,n.totalCells=n.backwardCells+n.forwardCells,setTimeout(()=>{w()},1))}),[])},967:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,a){function l(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(l,s)}c((n=n.apply(e,t||[])).next())})},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const a=o(r(155)),l=r(514),s=r(147);t.default=({DOMManipulationQueueRef:e,scrollerName:t,operationsRef:r,portalIDListRef:o,cellPortalListRef:c,cellDataListRef:i,portalContainerMapRef:u,spacingRef:d,scrollTopRef:f,scrollLeftRef:p,viewportRef:h,headblockRef:m,tailblockRef:g,headBandListRef:b,tailBandListRef:v,leadHeadblockBandRef:R,cradleActualRef:w,cradlePotentialRef:y,cellDimensionsRef:C,viewportDimensionsRef:B,orientationRef:k,layoutRef:x,currentAxisReferenceIDRef:D,setPortalRenderList:E,updateCurrentAxisReferenceID:P,trimCradle:I,fillCradle:T,reset:M,callbacksRef:S,assertIntersectionsDisconnect:L,assertIntersectionsConnect:O,bandMutationObserverRef:_})=>{const A=S.current,j=e.current,H=e=>n(void 0,void 0,void 0,function*(){return yield j.enqueue(()=>n(void 0,void 0,void 0,function*(){const t=yield(e=>{if(!(0,s.isValidID)(e))return A.error&&A.error({source:"remove",message:"must be valid target referenceID",arguments:[e],timestamp:Date.now()}),!1;const t=o.current.indexOf(e);if(-1===t)return A.warning&&A.warning({source:"remove",message:"target referenceID not found",arguments:[e],timestamp:Date.now()}),!1;L();const r=o.current,n=c.current,a=i.current,l=w.current,{cellsPerBand:d}=l,f=u.current,p=f.get(e);if(t<l.backwardCells){const e=b.current,r=d-e[0].childElementCount,n=t,o=Math.ceil((n+r+1)/d)-1;e[o];for(let t=o;t>0;t--)e[t].prepend(e[t-1].lastChild);const a=e[0];0===a.childElementCount&&(a.remove(),e.unShift(),l.backwardBands--,l.totalBands--),l.backwardCells--}else{const e=v.current,n=d-e[0].childElementCount,o=t-(r.length-l.forwardCells);for(let t=Math.ceil((o+n+1)/d)-1;t<e.length-1;t++)e[t].append(e[t+1].firstChild);const a=e.at(-1);0===a.childElementCount&&(a.remove(),e.pop(),l.forwardBands--,l.totalBands--),l.forwardCells--}return p.remove(),f.delete(e),r.splice(t,1),n.splice(t,1),a.splice(t,1),l.totalCells--,E([...c.current]),!0})(e);return t?(yield T(),setTimeout(()=>{O()},1),P(),A.removed&&A.removed([e])):O(),t}))});return{has:e=>(0,s.isValidID)(e)?u.current.has(e):(A.error&&A.error({source:"has",message:"must be a valid referenceID",arguments:[e],timestamp:Date.now()}),!1),insert:(e,t,...r)=>n(void 0,[e,t,...r],void 0,function*(e,t,r="before"){const f=yield j.enqueue(()=>n(void 0,void 0,void 0,function*(){const f=yield((e,t,r)=>n(void 0,void 0,void 0,function*(){if("object"!=typeof e||!a.default.isValidElement(e.component)||!(0,s.isValidID)(e.id))return A.error&&A.error({source:"insert",message:"insert must have a valid cellPack argument",arguments:[e,t,r],timestamp:Date.now()}),!1;if(!(0,s.isValidID)(t))return A.error&&A.error({source:"insert",message:"insert targetReferenceID must be a valid ID",arguments:[e,t,r],timestamp:Date.now()}),!1;if(!["before","after"].includes(r))return A.error&&A.error({source:"insert",message:'insert position must be either "before" or "after"',arguments:[e,t,r],timestamp:Date.now()}),!1;if(u.current.has(e.id))return A.error&&A.error({source:"insert",message:"insert error: cellPack.id is already in the cradle",arguments:[e,t,r],timestamp:Date.now()}),!1;const n=o.current.indexOf(t);if(-1===n)return A.error&&A.error({source:"insert",message:"target id is not in the cradle",arguments:[e,t,r],timestamp:Date.now()}),!1;L();const f=w.current,p=o.current,h=i.current,R=u.current,y=c.current,B="before"==r?n:n+1;n<f.backwardCells?f.backwardCells++:f.forwardCells++,h.splice(B,0,e),p.splice(B,0,e.id);const D=(0,s.createContainer)(e.id,C.current,f.cellsPerBand,k.current,x.current);R.set(e.id,D);const P=(0,l.createPortal)(e.component,D,e.id);y.splice(B,0,P);const{cellsPerBand:T}=f,M=R.get(t);if(n<=f.backwardCells-1){const e=b.current,t=T-e[0].childElementCount,o=n,a=Math.ceil((o+t+1)/T)-1;if(e[0].childElementCount===T){const t=(0,s.createBand)(k.current,x.current,T,d.current,_.current);m.current.prepend(t),e.unshift(t),f.backwardBands++,f.totalBands++}"before"==r?M.before(D):M.after(D);for(let t=0;t<a;t++)e[t].append(e[t+1].firstChild)}else{const e=v.current,t=T-e[0].childElementCount,o=n-(p.length-f.forwardCells),a=Math.ceil((o+t+1)/T)-1;if(e.at(-1).childElementCount===T){const t=(0,s.createBand)(k.current,x.current,T,d.current,_.current);g.current.append(t),e.push(t),f.forwardBands++,f.totalBands++}"before"==r?M.before(D):M.after(D);for(let t=e.length-1;t>a;t--)e[t].prepend(e[t-1].lastChild)}return E([...c.current]),I(),setTimeout(()=>{O()},1),!0}))(e,t,r);return P(),O(),f}));return f}),remove:H,move:(e,t,...r)=>n(void 0,[e,t,...r],void 0,function*(e,t,r="before"){const a=yield j.enqueue(()=>n(void 0,void 0,void 0,function*(){const a=yield((e,t,r)=>n(void 0,void 0,void 0,function*(){if(!(0,s.isValidID)(e)||!(0,s.isValidID)(t))return A.error&&A.error({source:"move",message:"both source and target must be valid referenceIDs",arguments:[e,t,r],timestamp:Date.now()}),!1;if(!["before","after"].includes(r))return A.error&&A.error({source:"move",message:'position must be "before" or "after"',arguments:[e,t,r],timestamp:Date.now()}),!1;if(e===t)return A.error&&A.error({source:"move",message:"source and target referenceIDs cannot be equal",arguments:[e,t,r],timestamp:Date.now()}),!1;const n=u.current;if(!n.has(e))return A.error&&A.error({source:"move",message:"source referenceID not found in cradle",arguments:[e,t,r],timestamp:Date.now()}),!1;if(!n.has(t))return A.warning&&A.warning({source:"move",message:"targetReferenceID not found in cradle. sourceReferenceID being removed",arguments:[e,t,r],timestamp:Date.now()}),H(e),!0;L();const a=w.current,{cellsPerBand:l}=a,f=o.current,p=i.current,h=c.current,R=f.indexOf(e),y=f.indexOf(t),C=f.length-a.forwardCells,B="s"+(R<C?"h":"t"),D="t"+(y<C?"h":"t"),P=Math.abs(R-y),T=n.get(e),M=n.get(t);if(1===P&&(R>y&&"after"==r||y>R&&"before"==r))return!0;const S=B+D;if("shth"==S){const e=b.current,t=l-e[0].childElementCount,n=R,o=y,a=Math.ceil((n+t+1)/l)-1,s=Math.ceil((o+t+1)/l)-1;if("after"==r?M.after(T):M.before(T),a<s)for(let t=s;t>a;t--)e[t-1].append(e[t].firstChild);else if(a>s)for(let t=s;t<a;t++)e[t+1].prepend(e[t].lastChild)}else if("sttt"==S){const e=v.current,t=l-e[0].childElementCount,n=R-C,o=y-C,a=Math.ceil((n+t+1)/l)-1,s=Math.ceil((o+t+1)/l)-1;if("after"==r?M.after(T):M.before(T),a>s)for(let t=s;t<a;t++)e[t+1].prepend(e[t].lastChild);else if(a<s)for(let t=s;t>a;t--)e[t-1].append(e[t].firstChild)}else if("sh"==B){const e=b.current,t=l-e[0].childElementCount,n=R,o=Math.ceil((n+t+1)/l)-1,c=v.current,i=y-C,u=Math.ceil((i+1)/l)-1;"after"==r?M.after(T):M.before(T);for(let t=o;t>0;t--)e[t].prepend(e[t-1].lastChild);const f=e[0];0===f.childElementCount&&(f.remove(),e.shift(),a.backwardBands--,a.totalBands--);for(let e=u;e<c.length-1;e++)c[e+1].prepend(c[e].lastChild);const p=c.at(-1);if(p.childElementCount>l){const e=(0,s.createBand)(k.current,x.current,l,d.current,_.current);e.prepend(p.lastChild),g.current.append(e),c.push(e),a.forwardBands++,a.totalBands++}a.backwardCells--,a.forwardCells++}else{const e=b.current,t=l-e[0].childElementCount,n=y,o=Math.ceil((n+t+1)/l)-1,c=v.current,i=R-C,u=Math.ceil((i+1)/l)-1;"after"==r?M.after(T):M.before(T);for(let e=u;e<c.length-1;e++)c[e].append(c[e+1].firstChild);const f=c.at(-1);0===f.childElementCount&&(f.remove(),c.pop(),a.forwardBands--,a.totalBands--);for(let t=o;t>0;t--)e[t-1].prepend(e[t].lastChild);const p=e[0];if(p.childElementCount>l){const t=(0,s.createBand)(k.current,x.current,l,d.current,_.current);t.append(p.firstChild),m.current.prepend(t),e.unshift(t),a.backwardBands++,a.totalBands++}a.backwardCells++,a.forwardCells--}const O="before"==r?y:y+1;if(R>y){const[e]=f.splice(R,1),[t]=h.splice(R,1),[r]=p.splice(R,1);f.splice(O,0,e),h.splice(O,0,t),p.splice(O,0,r)}else{const[e]=f.slice(R,R+1),[t]=h.slice(R,R+1),[r]=p.slice(R,R+1);f.splice(O,0,e),h.splice(O,0,t),p.splice(O,0,r),f.splice(R,1),h.splice(R,1),p.splice(R,1)}return I(),E([...c.current]),!0}))(e,t,r);return a?(yield T(),setTimeout(()=>{O()},1),P()):O(),a}));return a}),replace:(e,...t)=>n(void 0,[e,...t],void 0,function*(e,t={id:null,component:null,default:!0}){const r=yield j.enqueue(()=>n(void 0,void 0,void 0,function*(){const r=yield((e,t)=>{const r=o.current,n=c.current,d=i.current,f=u.current,p=y.current,h=C.current;if(!(0,s.isValidID)(e))return A.error&&A.error({source:"replace",message:"must be a valid referenceID",arguments:[e,t],timestamp:Date.now()}),!1;if(!(0,s.isValidID)(t.id))return A.error&&A.error({source:"replace",message:"must be a valid cellPack.id",arguments:[e,t],timestamp:Date.now()}),!1;if(!a.default.isValidElement(t.component))return A.error&&A.error({source:"replace",message:"must be a valid cellPack.component",arguments:[e,t],timestamp:Date.now()}),!1;if(!f.has(e))return A.warning&&A.warning({source:"replace",message:"referenceID not found",arguments:[e,t],timestamp:Date.now()}),!1;if(f.has(t.id))return A.error&&A.error({source:"replace",message:"cellPack.id already in cradle",arguments:[e,t],timestamp:Date.now()}),!1;const{cellsPerBand:m,orientation:g,layout:b}=p,v=(0,s.createContainer)(t.id,h,m,g,b),R=f.get(e),w=(0,l.createPortal)(t.component,v,t.id),B=t.id,k=r.findIndex(t=>e===t);return r[k]=B,n[k]=w,d[k]=t,f.delete(e),f.set(B,v),R.before(v),R.remove(),E([...n]),!0})(e,t);return P(),O(),r}));return r}),getCradleIDList:()=>[...o.current],getCradleSpecs:()=>({cradleActual:Object.as