"use strict";(self.webpackChunkneurosift_jp=self.webpackChunkneurosift_jp||[]).push([[471],{80471:(e,t,i)=>{i.r(t),i.d(t,{InView:()=>d,defaultFallbackInView:()=>c,observe:()=>u,useInView:()=>p});var n=i(93345),r=Object.defineProperty,s=(e,t,i)=>((e,t,i)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i),o=new Map,h=new WeakMap,l=0,a=void 0;function c(e){a=e}function u(e,t,i={},n=a){if(void 0===window.IntersectionObserver&&void 0!==n){const r=e.getBoundingClientRect();return t(n,{isIntersecting:n,target:e,intersectionRatio:"number"==typeof i.threshold?i.threshold:0,time:0,boundingClientRect:r,intersectionRect:r,rootBounds:r}),()=>{}}const{id:r,observer:s,elements:c}=function(e){const t=function(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>{return`${t}_${"root"===t?(i=e.root,i?(h.has(i)||(l+=1,h.set(i,l.toString())),h.get(i)):"0"):e[t]}`;var i})).toString()}(e);let i=o.get(t);if(!i){const n=new Map;let r;const s=new IntersectionObserver((t=>{t.forEach((t=>{var i;const s=t.isIntersecting&&r.some((e=>t.intersectionRatio>=e));e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=s),null==(i=n.get(t.target))||i.forEach((e=>{e(s,t)}))}))}),e);r=s.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),i={id:t,observer:s,elements:n},o.set(t,i)}return i}(i),u=c.get(e)||[];return c.has(e)||c.set(e,u),u.push(t),s.observe(e),function(){u.splice(u.indexOf(t),1),0===u.length&&(c.delete(e),s.unobserve(e)),0===c.size&&(s.disconnect(),o.delete(r))}}var d=class extends n.Component{constructor(e){super(e),s(this,"node",null),s(this,"_unobserveCb",null),s(this,"handleNode",(e=>{this.node&&(this.unobserve(),e||this.props.triggerOnce||this.props.skip||this.setState({inView:!!this.props.initialInView,entry:void 0})),this.node=e||null,this.observeNode()})),s(this,"handleChange",((e,t)=>{e&&this.props.triggerOnce&&this.unobserve(),function(e){return"function"!=typeof e.children}(this.props)||this.setState({inView:e,entry:t}),this.props.onChange&&this.props.onChange(e,t)})),this.state={inView:!!e.initialInView,entry:void 0}}componentDidMount(){this.unobserve(),this.observeNode()}componentDidUpdate(e){e.rootMargin===this.props.rootMargin&&e.root===this.props.root&&e.threshold===this.props.threshold&&e.skip===this.props.skip&&e.trackVisibility===this.props.trackVisibility&&e.delay===this.props.delay||(this.unobserve(),this.observeNode())}componentWillUnmount(){this.unobserve()}observeNode(){if(!this.node||this.props.skip)return;const{threshold:e,root:t,rootMargin:i,trackVisibility:n,delay:r,fallbackInView:s}=this.props;this._unobserveCb=u(this.node,this.handleChange,{threshold:e,root:t,rootMargin:i,trackVisibility:n,delay:r},s)}unobserve(){this._unobserveCb&&(this._unobserveCb(),this._unobserveCb=null)}render(){const{children:e}=this.props;if("function"==typeof e){const{inView:t,entry:i}=this.state;return e({inView:t,entry:i,ref:this.handleNode})}const{as:t,triggerOnce:i,threshold:r,root:s,rootMargin:o,onChange:h,skip:l,trackVisibility:a,delay:c,initialInView:u,fallbackInView:d,...p}=this.props;return n.createElement(t||"div",{ref:this.handleNode,...p},e)}};function p({threshold:e,delay:t,trackVisibility:i,rootMargin:r,root:s,triggerOnce:o,skip:h,initialInView:l,fallbackInView:a,onChange:c}={}){var d;const[p,b]=n.useState(null),v=n.useRef(),[f,g]=n.useState({inView:!!l,entry:void 0});v.current=c,n.useEffect((()=>{if(h||!p)return;let n;return n=u(p,((e,t)=>{g({inView:e,entry:t}),v.current&&v.current(e,t),t.isIntersecting&&o&&n&&(n(),n=void 0)}),{root:s,rootMargin:r,threshold:e,trackVisibility:i,delay:t},a),()=>{n&&n()}}),[Array.isArray(e)?e.toString():e,p,s,r,o,h,i,a,t]);const y=null==(d=f.entry)?void 0:d.target,V=n.useRef();p||!y||o||h||V.current===y||(V.current=y,g({inView:!!l,entry:void 0}));const w=[b,f.inView,f.entry];return w.ref=w[0],w.inView=w[1],w.entry=w[2],w}}}]);