docusaurus/assets/js/29828.6e44b282.js
2024-10-24 16:47:52 +00:00

1 line
No EOL
17 KiB
JavaScript

"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["29828"],{80980:function(t,e,i){i.d(e,{Z:function(){return r},a:function(){return s}});var n=i(27378);let o={},a=n.createContext(o);function s(t){let e=n.useContext(a);return n.useMemo(function(){return"function"==typeof t?t(e):{...e,...t}},[e,t])}function r(t){let e;return e=t.disableParentContext?"function"==typeof t.components?t.components(o):t.components||o:s(t.components),n.createElement(a.Provider,{value:e},t.children)}},64479:function(t,e,i){i.d(e,{Z:function(){return N}});var n=i(27378),o=i(31542);let a=(t,e)=>t===e?.tagName?.toUpperCase?.(),s=t=>a("DIV",t)||a("SPAN",t),r=t=>a("IMG",t),h=t=>t.complete&&0!==t.naturalHeight,l=t=>a("SVG",t),d=({height:t,offset:e,width:i})=>Math.min((window.innerWidth-2*e)/i,(window.innerHeight-2*e)/t),c=({containerHeight:t,containerWidth:e,offset:i,targetHeight:n,targetWidth:o})=>{let a=d({height:n,offset:i,width:o}),s=o>n?o/e:n/t;return a>1?s:a*s},m=({containerHeight:t,containerWidth:e,hasScalableSrc:i,offset:n,targetHeight:o,targetWidth:a})=>t&&e?!i&&o&&a?c({containerHeight:t,containerWidth:e,offset:n,targetHeight:o,targetWidth:a}):d({height:t,offset:n,width:e}):1,u=/url(?:\(['"]?)(.*?)(?:['"]?\))/,g=t=>{if(t){if(r(t))return t.currentSrc;if(s(t)){let e=window.getComputedStyle(t).backgroundImage;if(e)return u.exec(e)?.[1]}}},v=t=>{if(t)return r(t)?t.alt??void 0:t.getAttribute("aria-label")??void 0},f=({containerHeight:t,containerLeft:e,containerTop:i,containerWidth:n,hasScalableSrc:o,offset:a,targetHeight:s,targetWidth:r})=>{let h=m({containerHeight:t,containerWidth:n,hasScalableSrc:o,offset:a,targetHeight:s,targetWidth:r});return{top:i,left:e,width:n*h,height:t*h,transform:`translate(0,0) scale(${1/h})`}},p=({position:t,relativeNum:e})=>{let i=parseFloat(t);return t.endsWith("%")?e*i/100:i},w=({containerHeight:t,containerLeft:e,containerTop:i,containerWidth:n,hasScalableSrc:o,objectFit:a,objectPosition:s,offset:r,targetHeight:h,targetWidth:l})=>{if("scale-down"===a&&(a=l<=n&&h<=t?"none":"contain"),"cover"===a||"contain"===a){let d=n/l,c=t/h,u="cover"===a?Math.max(d,c):Math.min(d,c),[g="50%",v="50%"]=s.split(" "),f=p({position:g,relativeNum:n-l*u}),w=p({position:v,relativeNum:t-h*u}),E=m({containerHeight:h*u,containerWidth:l*u,hasScalableSrc:o,offset:r,targetHeight:h,targetWidth:l});return{top:i+w,left:e+f,width:l*u*E,height:h*u*E,transform:`translate(0,0) scale(${1/E})`}}if("none"===a){let[a="50%",d="50%"]=s.split(" "),c=p({position:a,relativeNum:n-l}),u=p({position:d,relativeNum:t-h}),g=m({containerHeight:h,containerWidth:l,hasScalableSrc:o,offset:r,targetHeight:h,targetWidth:l});return{top:i+u,left:e+c,width:l*g,height:h*g,transform:`translate(0,0) scale(${1/g})`}}if("fill"!==a)return{};else{let e=Math.max(n/l,t/h),i=m({containerHeight:h*e,containerWidth:l*e,hasScalableSrc:o,offset:r,targetHeight:h,targetWidth:l});return{width:n*i,height:t*i,transform:`translate(0,0) scale(${1/i})`}}},E=({backgroundPosition:t,backgroundSize:e,containerHeight:i,containerLeft:n,containerTop:o,containerWidth:a,hasScalableSrc:s,offset:r,targetHeight:h,targetWidth:l})=>{if("cover"===e||"contain"===e){let d=a/l,c=i/h,u="cover"===e?Math.max(d,c):Math.min(d,c),[g="50%",v="50%"]=t.split(" "),f=p({position:g,relativeNum:a-l*u}),w=p({position:v,relativeNum:i-h*u}),E=m({containerHeight:h*u,containerWidth:l*u,hasScalableSrc:s,offset:r,targetHeight:h,targetWidth:l});return{top:o+w,left:n+f,width:l*u*E,height:h*u*E,transform:`translate(0,0) scale(${1/E})`}}if("auto"===e){let[e="50%",d="50%"]=t.split(" "),c=p({position:e,relativeNum:a-l}),u=p({position:d,relativeNum:i-h}),g=m({containerHeight:h,containerWidth:l,hasScalableSrc:s,offset:r,targetHeight:h,targetWidth:l});return{top:o+u,left:n+c,width:l*g,height:h*g,transform:`translate(0,0) scale(${1/g})`}}{let[d="50%",c="50%"]=e.split(" "),u=p({position:d,relativeNum:a}),g=p({position:c,relativeNum:i}),v=Math.min(u/l,g/h),[f="50%",w="50%"]=t.split(" "),E=p({position:f,relativeNum:a-l*v}),L=p({position:w,relativeNum:i-h*v}),b=m({containerHeight:h*v,containerWidth:l*v,hasScalableSrc:s,offset:r,targetHeight:h,targetWidth:l});return{top:o+L,left:n+E,width:l*v*b,height:h*v*b,transform:`translate(0,0) scale(${1/b})`}}},L=/\.svg$/i,b=({hasZoomImg:t,imgSrc:e,isSvg:i,isZoomed:n,loadedImgEl:o,offset:a,shouldRefresh:r,targetEl:h})=>{let l=i||e?.slice?.(0,18)==="data:image/svg+xml"||t||!!(e&&L.test(e)),d=h.getBoundingClientRect(),c=window.getComputedStyle(h),m=null!=o&&s(h),u=null!=o&&!m,g=f({containerHeight:d.height,containerLeft:d.left,containerTop:d.top,containerWidth:d.width,hasScalableSrc:l,offset:a,targetHeight:o?.naturalHeight||d.height,targetWidth:o?.naturalWidth||d.width}),v=u?w({containerHeight:d.height,containerLeft:d.left,containerTop:d.top,containerWidth:d.width,hasScalableSrc:l,objectFit:c.objectFit,objectPosition:c.objectPosition,offset:a,targetHeight:o?.naturalHeight||d.height,targetWidth:o?.naturalWidth||d.width}):void 0,p=Object.assign({},g,v,m?E({backgroundPosition:c.backgroundPosition,backgroundSize:c.backgroundSize,containerHeight:d.height,containerLeft:d.left,containerTop:d.top,containerWidth:d.width,hasScalableSrc:l,offset:a,targetHeight:o?.naturalHeight||d.height,targetWidth:o?.naturalWidth||d.width}):void 0);if(n){let t=window.innerWidth/2,e=window.innerHeight/2,i=parseFloat(String(p.left||0))+parseFloat(String(p.width||0))/2,n=parseFloat(String(p.top||0))+parseFloat(String(p.height||0))/2;r&&(p.transitionDuration="0.01ms"),p.transform=`translate(${t-i}px,${e-n}px) scale(1)`}return p},S=t=>{if(!t)return{};if(!l(t))return{height:t.offsetHeight,left:t.offsetLeft,width:t.offsetWidth,top:t.offsetTop};{let e=t.parentElement,i=t.getBoundingClientRect();if(!e)return{height:i.height,left:i.left,width:i.width,top:i.top};{let t=e.getBoundingClientRect();return{height:i.height,left:t.left-i.left,top:t.top-i.top,width:i.width}}}},y=t=>{let e="-zoom",i=["clip-path","fill","mask","marker-start","marker-mid","marker-end"],n=new Map;if(t.hasAttribute("id")){let i=t.id,o=i+e;n.set(i,o),t.id=o}t.querySelectorAll("[id]").forEach(t=>{let i=t.id,o=i+e;n.set(i,o),t.id=o}),n.forEach((e,n)=>{let o=`url(#${n})`,a=`url(#${e})`,s=i.map(t=>`[${t}="${o}"]`).join(", ");t.querySelectorAll(s).forEach(t=>{i.forEach(e=>{t.getAttribute(e)===o&&t.setAttribute(e,a)})})}),t.querySelectorAll("style").forEach(t=>{n.forEach((e,i)=>{t.textContent&&(t.textContent=t.textContent.replaceAll(`#${i}`,`#${e}`))})})},z=["img","svg",'[role="img"]',"[data-zoom]"].map(t=>`${t}:not([aria-hidden="true"])`).join(","),I={overflow:"",width:""};function C(t){return n.createElement(D,{...t})}class D extends n.Component{constructor(){super(...arguments),this.state={id:"",isZoomImgLoaded:!1,loadedImgEl:void 0,modalState:"UNLOADED",shouldRefresh:!1,styleGhost:{}},this.refContent=n.createRef(),this.refDialog=n.createRef(),this.refModalContent=n.createRef(),this.refModalImg=n.createRef(),this.refWrap=n.createRef(),this.imgEl=null,this.isScaling=!1,this.prevBodyAttrs=I,this.styleModalImg={},this.handleModalStateChange=t=>{let{modalState:e}=this.state;"LOADING"!==t&&"LOADING"===e?(this.loadZoomImg(),window.addEventListener("resize",this.handleResize,{passive:!0}),window.addEventListener("touchstart",this.handleTouchStart,{passive:!0}),window.addEventListener("touchmove",this.handleTouchMove,{passive:!0}),window.addEventListener("touchend",this.handleTouchEnd,{passive:!0}),window.addEventListener("touchcancel",this.handleTouchCancel,{passive:!0}),document.addEventListener("keydown",this.handleKeyDown,!0)):"LOADED"!==t&&"LOADED"===e?window.addEventListener("wheel",this.handleWheel,{passive:!0}):"UNLOADING"!==t&&"UNLOADING"===e?(this.ensureImgTransitionEnd(),window.removeEventListener("wheel",this.handleWheel),window.removeEventListener("touchstart",this.handleTouchStart),window.removeEventListener("touchmove",this.handleTouchMove),window.removeEventListener("touchend",this.handleTouchEnd),window.removeEventListener("touchcancel",this.handleTouchCancel),document.removeEventListener("keydown",this.handleKeyDown,!0)):"UNLOADED"!==t&&"UNLOADED"===e&&(this.bodyScrollEnable(),window.removeEventListener("resize",this.handleResize),this.refModalImg.current?.removeEventListener?.("transitionend",this.handleImgTransitionEnd),this.refDialog.current?.close?.())},this.getDialogContainer=()=>{let t=document.querySelector("[data-rmiz-portal]");return null==t&&((t=document.createElement("div")).setAttribute("data-rmiz-portal",""),document.body.appendChild(t)),t},this.setId=()=>{let t=()=>Math.random().toString(16).slice(-4);this.setState({id:t()+t()+t()})},this.setAndTrackImg=()=>{let t=this.refContent.current;t&&(this.imgEl=t.querySelector(z),this.imgEl?(this.contentNotFoundChangeObserver?.disconnect?.(),this.imgEl.addEventListener("load",this.handleImgLoad),this.imgEl.addEventListener("click",this.handleZoom),!this.state.loadedImgEl&&this.handleImgLoad(),this.imgElResizeObserver=new ResizeObserver(t=>{let e=t[0];e?.target&&(this.imgEl=e.target,this.setState({styleGhost:S(this.imgEl)}))}),this.imgElResizeObserver.observe(this.imgEl),!this.contentChangeObserver&&(this.contentChangeObserver=new MutationObserver(()=>{this.setState({styleGhost:S(this.imgEl)})}),this.contentChangeObserver.observe(t,{attributes:!0,childList:!0,subtree:!0}))):!this.contentNotFoundChangeObserver&&(this.contentNotFoundChangeObserver=new MutationObserver(this.setAndTrackImg),this.contentNotFoundChangeObserver.observe(t,{childList:!0,subtree:!0})))},this.handleIfZoomChanged=t=>{let{isZoomed:e}=this.props;!t&&e?this.zoom():t&&!e&&this.unzoom()},this.handleImgLoad=()=>{let t=g(this.imgEl);if(!t)return;let e=new Image;r(this.imgEl)&&(e.sizes=this.imgEl.sizes,e.srcset=this.imgEl.srcset),e.src=t;let i=()=>{this.setState({loadedImgEl:e,styleGhost:S(this.imgEl)})};e.decode().then(i).catch(()=>{if(h(e)){i();return}e.onload=i})},this.handleZoom=()=>{this.hasImage()&&this.props.onZoomChange?.(!0)},this.handleUnzoom=()=>{this.props.onZoomChange?.(!1)},this.handleDialogCancel=t=>{t.preventDefault()},this.handleDialogClick=t=>{(t.target===this.refModalContent.current||t.target===this.refModalImg.current)&&this.handleUnzoom()},this.handleKeyDown=t=>{("Escape"===t.key||27===t.keyCode)&&(t.preventDefault(),t.stopPropagation(),this.handleUnzoom())},this.handleWheel=t=>{!t.ctrlKey&&(t.stopPropagation(),queueMicrotask(()=>{this.handleUnzoom()}))},this.handleTouchStart=t=>{if(t.touches.length>1){this.isScaling=!0;return}1===t.changedTouches.length&&t.changedTouches[0]&&(this.touchYStart=t.changedTouches[0].screenY)},this.handleTouchMove=t=>{let e=window.visualViewport?.scale??1;if(this.props.canSwipeToUnzoom&&!this.isScaling&&e<=1&&null!=this.touchYStart&&t.changedTouches[0]){this.touchYEnd=t.changedTouches[0].screenY;let e=Math.max(this.touchYStart,this.touchYEnd);Math.abs(e-Math.min(this.touchYStart,this.touchYEnd))>this.props.swipeToUnzoomThreshold&&(this.touchYStart=void 0,this.touchYEnd=void 0,this.handleUnzoom())}},this.handleTouchEnd=()=>{this.isScaling=!1,this.touchYStart=void 0,this.touchYEnd=void 0},this.handleTouchCancel=()=>{this.isScaling=!1,this.touchYStart=void 0,this.touchYEnd=void 0},this.handleResize=()=>{this.setState({shouldRefresh:!0})},this.hasImage=()=>this.imgEl&&(this.state.loadedImgEl||l(this.imgEl))&&"none"!==window.getComputedStyle(this.imgEl).display,this.zoom=()=>{this.bodyScrollDisable(),this.refDialog.current?.showModal?.(),this.refModalImg.current?.addEventListener?.("transitionend",this.handleImgTransitionEnd),this.setState({modalState:"LOADING"})},this.unzoom=()=>{this.setState({modalState:"UNLOADING"})},this.handleImgTransitionEnd=()=>{clearTimeout(this.timeoutTransitionEnd),"LOADING"===this.state.modalState?this.setState({modalState:"LOADED"}):"UNLOADING"===this.state.modalState&&this.setState({shouldRefresh:!1,modalState:"UNLOADED"})},this.ensureImgTransitionEnd=()=>{if(this.refModalImg.current){let t=window.getComputedStyle(this.refModalImg.current).transitionDuration,e=parseFloat(t);if(e){let i=e*(t.endsWith("ms")?1:1e3)+50;this.timeoutTransitionEnd=setTimeout(this.handleImgTransitionEnd,i)}}},this.bodyScrollDisable=()=>{this.prevBodyAttrs={overflow:document.body.style.overflow,width:document.body.style.width};let t=document.body.clientWidth;document.body.style.overflow="hidden",document.body.style.width=`${t}px`},this.bodyScrollEnable=()=>{document.body.style.width=this.prevBodyAttrs.width,document.body.style.overflow=this.prevBodyAttrs.overflow,this.prevBodyAttrs=I},this.loadZoomImg=()=>{let{props:{zoomImg:t}}=this,e=t?.src;if(e){let i=new Image;i.sizes=t?.sizes??"",i.srcset=t?.srcSet??"",i.src=e;let n=()=>{this.setState({isZoomImgLoaded:!0})};i.decode().then(n).catch(()=>{if(h(i)){n();return}i.onload=n})}},this.UNSAFE_handleSvg=()=>{let{imgEl:t,refModalImg:e,styleModalImg:i}=this;if(l(t)){let n=t.cloneNode(!0);y(n),n.style.width=`${i.width||0}px`,n.style.height=`${i.height||0}px`,n.addEventListener("click",this.handleUnzoom),e.current?.firstChild?.remove?.(),e.current?.appendChild?.(n)}}}render(){let{handleDialogCancel:t,handleDialogClick:e,handleUnzoom:i,handleZoom:a,imgEl:h,props:{a11yNameButtonUnzoom:d,a11yNameButtonZoom:c,children:m,classDialog:u,IconUnzoom:f,IconZoom:p,isZoomed:w,wrapElement:E,ZoomContent:L,zoomImg:S,zoomMargin:y},refContent:z,refDialog:I,refModalContent:C,refModalImg:D,refWrap:N,state:{id:M,isZoomImgLoaded:T,loadedImgEl:A,modalState:O,shouldRefresh:U,styleGhost:k}}=this,W=`rmiz-modal-${M}`,$=`rmiz-modal-img-${M}`,x=s(h),Z=r(h),H=l(h),R=v(h),F=g(h),G=Z?h.sizes:void 0,Y=Z?h.srcset:void 0,B=!!S?.src,P=this.hasImage(),j=R?`${c}: ${R}`:c,q="LOADING"===O||"LOADED"===O,K=P?"found":"not-found",V="UNLOADED"===O||"UNLOADING"===O?"hidden":"visible";this.styleModalImg=P?b({hasZoomImg:B,imgSrc:F,isSvg:H,isZoomed:w&&q,loadedImgEl:A,offset:y,shouldRefresh:U,targetEl:h}):{};let _=null;if(P){let t=Z||x?n.createElement("img",{alt:R,sizes:G,src:F,srcSet:Y,...T&&"LOADED"===O?S:{},"data-rmiz-modal-img":"",height:this.styleModalImg.height||void 0,id:$,ref:D,style:this.styleModalImg,width:this.styleModalImg.width||void 0}):H?n.createElement("div",{"data-rmiz-modal-img":!0,ref:D,style:this.styleModalImg}):null,e=n.createElement("button",{"aria-label":d,"data-rmiz-btn-unzoom":"",onClick:i,type:"button"},n.createElement(f,null));_=L?n.createElement(L,{buttonUnzoom:e,modalState:O,img:t,onUnzoom:i}):n.createElement(n.Fragment,null,t,e)}return n.createElement(E,{"aria-owns":W,"data-rmiz":"",ref:N},n.createElement(E,{"data-rmiz-content":K,ref:z,style:{visibility:"UNLOADED"===O?"visible":"hidden"}},m),P&&n.createElement(E,{"data-rmiz-ghost":"",style:k},n.createElement("button",{"aria-label":j,"data-rmiz-btn-zoom":"",onClick:a,type:"button"},n.createElement(p,null))),P&&o.createPortal(n.createElement("dialog",{"aria-labelledby":$,"aria-modal":"true",className:u,"data-rmiz-modal":"",id:W,onClick:e,onClose:i,onCancel:t,ref:I,role:"dialog"},n.createElement("div",{"data-rmiz-modal-overlay":V}),n.createElement("div",{"data-rmiz-modal-content":"",ref:C},_)),this.getDialogContainer()))}componentDidMount(){this.setId(),this.setAndTrackImg(),this.handleImgLoad(),this.UNSAFE_handleSvg()}componentWillUnmount(){"UNLOADED"!==this.state.modalState&&this.bodyScrollEnable(),this.contentChangeObserver?.disconnect?.(),this.contentNotFoundChangeObserver?.disconnect?.(),this.imgElResizeObserver?.disconnect?.(),this.imgEl?.removeEventListener?.("load",this.handleImgLoad),this.imgEl?.removeEventListener?.("click",this.handleZoom),this.refModalImg.current?.removeEventListener?.("transitionend",this.handleImgTransitionEnd),window.removeEventListener("wheel",this.handleWheel),window.removeEventListener("touchstart",this.handleTouchStart),window.removeEventListener("touchmove",this.handleTouchMove),window.removeEventListener("touchend",this.handleTouchEnd),window.removeEventListener("touchcancel",this.handleTouchCancel),window.removeEventListener("resize",this.handleResize),document.removeEventListener("keydown",this.handleKeyDown,!0)}componentDidUpdate(t,e){this.handleModalStateChange(e.modalState),this.UNSAFE_handleSvg(),this.handleIfZoomChanged(t.isZoomed)}}function N(t){let[e,i]=n.useState(!1);return n.createElement(C,{...t,isZoomed:e,onZoomChange:i})}D.defaultProps={a11yNameButtonUnzoom:"Minimize image",a11yNameButtonZoom:"Expand image",canSwipeToUnzoom:!0,IconUnzoom:function(){return n.createElement("svg",{"aria-hidden":"true","data-rmiz-btn-unzoom-icon":!0,fill:"currentColor",focusable:"false",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},n.createElement("path",{d:"M 14.144531 1.148438 L 9 6.292969 L 9 3 L 8 3 L 8 8 L 13 8 L 13 7 L 9.707031 7 L 14.855469 1.851563 Z M 8 8 L 3 8 L 3 9 L 6.292969 9 L 1.148438 14.144531 L 1.851563 14.855469 L 7 9.707031 L 7 13 L 8 13 Z"}))},IconZoom:function(){return n.createElement("svg",{"aria-hidden":"true","data-rmiz-btn-zoom-icon":!0,fill:"currentColor",focusable:"false",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},n.createElement("path",{d:"M 9 1 L 9 2 L 12.292969 2 L 2 12.292969 L 2 9 L 1 9 L 1 14 L 6 14 L 6 13 L 2.707031 13 L 13 2.707031 L 13 6 L 14 6 L 14 1 Z"}))},swipeToUnzoomThreshold:10,wrapElement:"div",zoomMargin:0}}}]);