mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-28 03:15:16 +00:00
1 line
40 KiB
Plaintext
1 line
40 KiB
Plaintext
{"version":3,"file":"reactjs-popup.esm.js","sources":["../src/hooks.tsx","../src/styles.ts","../src/Utils.ts","../src/index.tsx"],"sourcesContent":["import { useEffect, RefObject, useLayoutEffect } from 'react';\n\nexport const useOnEscape = (\n handler: (event: KeyboardEvent) => void,\n active = true\n) => {\n useEffect(() => {\n if (!active) return;\n const listener = (event: KeyboardEvent) => {\n // check if key is an Escape\n if (event.key === 'Escape') handler(event);\n };\n document.addEventListener('keyup', listener);\n\n return () => {\n if (!active) return;\n document.removeEventListener('keyup', listener);\n };\n }, [handler, active]);\n};\n\nexport const useRepositionOnResize = (handler: () => void, active = true) => {\n useEffect(() => {\n if (!active) return;\n const listener = () => {\n handler();\n };\n\n window.addEventListener('resize', listener);\n\n return () => {\n if (!active) return;\n window.removeEventListener('resize', listener);\n };\n }, [handler, active]);\n};\n\nexport const useOnClickOutside = (\n ref: RefObject<HTMLElement> | RefObject<HTMLElement>[],\n handler: (event: TouchEvent | MouseEvent) => void,\n active = true\n) => {\n useEffect(() => {\n if (!active) return;\n const listener = (event: TouchEvent | MouseEvent) => {\n // Do nothing if clicking ref's element or descendent elements\n const refs = Array.isArray(ref) ? ref : [ref];\n\n let contains = false;\n refs.forEach(r => {\n if (!r.current || r.current.contains(event.target as Node)) {\n contains = true;\n return;\n }\n });\n event.stopPropagation();\n if (!contains) handler(event);\n };\n\n document.addEventListener('mousedown', listener);\n document.addEventListener('touchstart', listener);\n\n return () => {\n if (!active) return;\n document.removeEventListener('mousedown', listener);\n document.removeEventListener('touchstart', listener);\n };\n }, [ref, handler, active]);\n};\n\n// Make sure that user is not able TAB out of the Modal content on Open\nexport const useTabbing = (\n contentRef: RefObject<HTMLElement>,\n active = true\n) => {\n useEffect(() => {\n if (!active) return;\n const listener = (event: KeyboardEvent) => {\n // check if key is an Tab\n if (event.keyCode === 9) {\n const els = contentRef?.current?.querySelectorAll(\n 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex=\"0\"]'\n );\n\n const focusableEls = Array.prototype.slice.call(els);\n if (focusableEls.length === 1) {\n event.preventDefault();\n return;\n }\n\n const firstFocusableEl = focusableEls[0];\n const lastFocusableEl = focusableEls[focusableEls.length - 1];\n if (event.shiftKey && document.activeElement === firstFocusableEl) {\n event.preventDefault();\n lastFocusableEl.focus();\n } else if (document.activeElement === lastFocusableEl) {\n event.preventDefault();\n firstFocusableEl.focus();\n }\n }\n };\n\n document.addEventListener('keydown', listener);\n\n return () => {\n if (!active) return;\n document.removeEventListener('keydown', listener);\n };\n }, [contentRef, active]);\n};\n\nexport const useIsomorphicLayoutEffect =\n typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n","import React from 'react';\n\ntype PopupStyle = {\n popupContent: {\n tooltip: React.CSSProperties;\n modal: React.CSSProperties;\n };\n popupArrow: React.CSSProperties;\n overlay: {\n tooltip: React.CSSProperties;\n modal: React.CSSProperties;\n };\n};\n\nconst Style: PopupStyle = {\n popupContent: {\n tooltip: {\n position: 'absolute',\n zIndex: 999,\n },\n modal: {\n position: 'relative',\n margin: 'auto',\n },\n },\n popupArrow: {\n height: '8px',\n width: '16px',\n position: 'absolute',\n background: 'transparent',\n color: '#FFF',\n zIndex: -1,\n },\n overlay: {\n tooltip: {\n position: 'fixed',\n top: '0',\n bottom: '0',\n left: '0',\n right: '0',\n zIndex: 999,\n },\n modal: {\n position: 'fixed',\n top: '0',\n bottom: '0',\n left: '0',\n right: '0',\n display: 'flex',\n zIndex: 999,\n },\n },\n};\n\nexport default Style;\n","/* Algo to calculate position\n 1. center position for popup content : the center of the trigger will be the center of the content content\n so the popup content position will be like this :\n top => the y of the center for the trigger element : trigger.top + trigger.height/2\n left => the x of the center for the trigger element : trigger.left + trigger.width/2\n\n 2. translate position according to the first position attribute passed in the function argument\n for example :\n position = 'left top'\n we need to handle the first argument in the position: 'left' => that's mean we need to translate the popup content according to the X axis by - content.width/2\n\n 3.translate position according to the first position attribute passed in the function argument\n for example :\n position = 'left top'\n the second argument 'top' => translate popup content by + content.height*4/5\n\n 4. check if calculated position is going out of bounds of wrapper box or not. If yes repeat 1-3 for next position enum. By default wrapper box is window element\n*/\nimport { PopupPosition } from './types';\n\nexport const POSITION_TYPES: PopupPosition[] = [\n 'top left',\n 'top center',\n 'top right',\n 'right top',\n 'right center',\n 'right bottom',\n 'bottom left',\n 'bottom center',\n 'bottom right',\n 'left top',\n 'left center',\n 'left bottom',\n //'center center',\n];\n\ntype CordsType = {\n top: number;\n left: number;\n transform: string;\n arrowLeft: string;\n arrowTop: string;\n};\n\nconst getCoordinatesForPosition = (\n triggerBounding: DOMRect,\n ContentBounding: DOMRect,\n position: PopupPosition, //PopupPosition | PopupPosition[],\n arrow: boolean,\n { offsetX, offsetY }: { offsetX: number; offsetY: number }\n): CordsType => {\n const margin = arrow ? 8 : 0;\n const args = position.split(' ');\n // the step N 1 : center the popup content => ok\n const CenterTop = triggerBounding.top + triggerBounding.height / 2;\n const CenterLeft = triggerBounding.left + triggerBounding.width / 2;\n const { height, width } = ContentBounding;\n let top = CenterTop - height / 2;\n let left = CenterLeft - width / 2;\n let transform = '';\n let arrowTop = '0%';\n let arrowLeft = '0%';\n // the step N 2 : => ok\n switch (args[0]) {\n case 'top':\n top -= height / 2 + triggerBounding.height / 2 + margin;\n transform = `rotate(180deg) translateX(50%)`;\n arrowTop = '100%';\n arrowLeft = '50%';\n break;\n case 'bottom':\n top += height / 2 + triggerBounding.height / 2 + margin;\n transform = `rotate(0deg) translateY(-100%) translateX(-50%)`;\n arrowLeft = '50%';\n break;\n case 'left':\n left -= width / 2 + triggerBounding.width / 2 + margin;\n transform = ` rotate(90deg) translateY(50%) translateX(-25%)`;\n arrowLeft = '100%';\n arrowTop = '50%';\n break;\n case 'right':\n left += width / 2 + triggerBounding.width / 2 + margin;\n transform = `rotate(-90deg) translateY(-150%) translateX(25%)`;\n arrowTop = '50%';\n break;\n default:\n }\n switch (args[1]) {\n case 'top':\n top = triggerBounding.top;\n arrowTop = `${triggerBounding.height / 2}px`;\n break;\n case 'bottom':\n top = triggerBounding.top - height + triggerBounding.height;\n arrowTop = `${height - triggerBounding.height / 2}px`;\n break;\n case 'left':\n left = triggerBounding.left;\n arrowLeft = `${triggerBounding.width / 2}px`;\n break;\n case 'right':\n left = triggerBounding.left - width + triggerBounding.width;\n arrowLeft = `${width - triggerBounding.width / 2}px`;\n break;\n default:\n }\n\n top = args[0] === 'top' ? top - offsetY : top + offsetY;\n left = args[0] === 'left' ? left - offsetX : left + offsetX;\n\n return { top, left, transform, arrowLeft, arrowTop };\n};\n\nexport const getTooltipBoundary = (keepTooltipInside: string | Boolean) => {\n // add viewport\n let boundingBox = {\n top: 0,\n left: 0,\n /* eslint-disable-next-line no-undef */\n width: window.innerWidth,\n /* eslint-disable-next-line no-undef */\n height: window.innerHeight,\n };\n if (typeof keepTooltipInside === 'string') {\n /* eslint-disable-next-line no-undef */\n const selector = document.querySelector(keepTooltipInside);\n if (process.env.NODE_ENV !== 'production') {\n if (selector === null)\n throw new Error(\n `${keepTooltipInside} selector does not exist : keepTooltipInside must be a valid html selector 'class' or 'Id' or a boolean value`\n );\n }\n if (selector !== null) boundingBox = selector.getBoundingClientRect();\n }\n\n return boundingBox;\n};\n\nconst calculatePosition = (\n triggerBounding: DOMRect,\n ContentBounding: DOMRect,\n position: PopupPosition | PopupPosition[],\n arrow: boolean,\n { offsetX, offsetY }: { offsetX: number; offsetY: number },\n keepTooltipInside: string | boolean\n): CordsType => {\n let bestCoords: CordsType = {\n arrowLeft: '0%',\n arrowTop: '0%',\n left: 0,\n top: 0,\n transform: 'rotate(135deg)',\n };\n let i = 0;\n const wrapperBox = getTooltipBoundary(keepTooltipInside);\n let positions = Array.isArray(position) ? position : [position];\n\n // keepTooltipInside would be activated if the keepTooltipInside exist or the position is Array\n if (keepTooltipInside || Array.isArray(position))\n positions = [...positions, ...POSITION_TYPES];\n\n // add viewPort for WarpperBox\n // wrapperBox.top = wrapperBox.top + window.scrollY;\n // wrapperBox.left = wrapperBox.left + window.scrollX;\n\n while (i < positions.length) {\n bestCoords = getCoordinatesForPosition(\n triggerBounding,\n ContentBounding,\n positions[i],\n arrow,\n { offsetX, offsetY }\n );\n\n const contentBox = {\n top: bestCoords.top,\n left: bestCoords.left,\n width: ContentBounding.width,\n height: ContentBounding.height,\n };\n\n if (\n contentBox.top <= wrapperBox.top ||\n contentBox.left <= wrapperBox.left ||\n contentBox.top + contentBox.height >=\n wrapperBox.top + wrapperBox.height ||\n contentBox.left + contentBox.width >= wrapperBox.left + wrapperBox.width\n ) {\n i++;\n } else {\n break;\n }\n }\n\n return bestCoords;\n};\n\nexport default calculatePosition;\n","import React, {\n useState,\n useRef,\n useEffect,\n forwardRef,\n useImperativeHandle,\n} from 'react';\nimport ReactDOM from 'react-dom';\nimport { PopupProps, PopupActions } from './types';\nimport {\n useOnEscape,\n useRepositionOnResize,\n useOnClickOutside,\n useTabbing,\n useIsomorphicLayoutEffect,\n} from './hooks';\n\nimport './index.css';\n\nimport styles from './styles';\nimport calculatePosition from './Utils';\n\nlet popupIdCounter = 0;\n\nconst getRootPopup = () => {\n let PopupRoot = document.getElementById('popup-root');\n\n if (PopupRoot === null) {\n PopupRoot = document.createElement('div');\n PopupRoot.setAttribute('id', 'popup-root');\n document.body.appendChild(PopupRoot);\n }\n\n return PopupRoot;\n};\n\nexport const Popup = forwardRef<PopupActions, PopupProps>(\n (\n {\n trigger = null,\n onOpen = () => {},\n onClose = () => {},\n defaultOpen = false,\n open = undefined,\n disabled = false,\n nested = false,\n closeOnDocumentClick = true,\n repositionOnResize = true,\n closeOnEscape = true,\n on = ['click'],\n contentStyle = {},\n arrowStyle = {},\n overlayStyle = {},\n className = '',\n position = 'bottom center',\n modal = false,\n lockScroll = false,\n arrow = true,\n offsetX = 0,\n offsetY = 0,\n mouseEnterDelay = 100,\n mouseLeaveDelay = 100,\n keepTooltipInside = false,\n children,\n },\n ref\n ) => {\n const [isOpen, setIsOpen] = useState<boolean>(open || defaultOpen);\n const triggerRef = useRef<HTMLElement>(null);\n const contentRef = useRef<HTMLElement>(null);\n const arrowRef = useRef<HTMLDivElement>(null);\n const focusedElBeforeOpen = useRef<Element | null>(null);\n const popupId = useRef<string>(`popup-${++popupIdCounter}`);\n\n const isModal = modal ? true : !trigger;\n const timeOut = useRef<any>(0);\n\n useIsomorphicLayoutEffect(() => {\n if (isOpen) {\n focusedElBeforeOpen.current = document.activeElement;\n setPosition();\n focusContentOnOpen(); // for accessibility\n lockScrolll();\n } else {\n resetScroll();\n }\n return () => {\n clearTimeout(timeOut.current);\n };\n }, [isOpen]);\n\n // for uncontrolled popup we need to sync isOpen with open prop\n useEffect(() => {\n if (typeof open === 'boolean') {\n if (open) openPopup();\n else closePopup();\n }\n }, [open, disabled]);\n\n const openPopup = (event?: React.SyntheticEvent) => {\n if (isOpen || disabled) return;\n setIsOpen(true);\n setTimeout(() => onOpen(event), 0);\n };\n\n const closePopup = (\n event?: React.SyntheticEvent | KeyboardEvent | TouchEvent | MouseEvent\n ) => {\n if (!isOpen || disabled) return;\n setIsOpen(false);\n if (isModal) (focusedElBeforeOpen.current as HTMLElement)?.focus();\n setTimeout(() => onClose(event), 0);\n };\n\n const togglePopup = (event?: React.SyntheticEvent) => {\n event?.stopPropagation();\n if (!isOpen) openPopup(event);\n else closePopup(event);\n };\n\n const onMouseEnter = (event?: React.SyntheticEvent) => {\n clearTimeout(timeOut.current);\n timeOut.current = setTimeout(() => openPopup(event), mouseEnterDelay);\n };\n\n const onContextMenu = (event?: React.SyntheticEvent) => {\n event?.preventDefault();\n togglePopup();\n };\n\n const onMouseLeave = (event?: React.SyntheticEvent) => {\n clearTimeout(timeOut.current);\n timeOut.current = setTimeout(() => closePopup(event), mouseLeaveDelay);\n };\n\n const lockScrolll = () => {\n if (isModal && lockScroll)\n document.getElementsByTagName('body')[0].style.overflow = 'hidden'; // migrate to document.body\n };\n\n const resetScroll = () => {\n if (isModal && lockScroll)\n document.getElementsByTagName('body')[0].style.overflow = 'auto';\n };\n const focusContentOnOpen = () => {\n const focusableEls = contentRef?.current?.querySelectorAll(\n 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex=\"0\"]'\n );\n const firstEl = Array.prototype.slice.call(focusableEls)[0];\n firstEl?.focus();\n };\n\n useImperativeHandle(ref, () => ({\n open: () => {\n openPopup();\n },\n close: () => {\n closePopup();\n },\n toggle: () => {\n togglePopup();\n },\n }));\n\n // set Position\n const setPosition = () => {\n if (isModal || !isOpen) return;\n if (!triggerRef?.current || !triggerRef?.current || !contentRef?.current)\n return; /// show error as one of ref is undefined\n const trigger = triggerRef.current.getBoundingClientRect();\n const content = contentRef.current.getBoundingClientRect();\n\n const cords = calculatePosition(\n trigger,\n content,\n position,\n arrow,\n {\n offsetX,\n offsetY,\n },\n keepTooltipInside\n );\n contentRef.current.style.top = `${cords.top + window.scrollY}px`;\n contentRef.current.style.left = `${cords.left + window.scrollX}px`;\n if (arrow && !!arrowRef.current) {\n arrowRef.current.style.transform = cords.transform;\n arrowRef.current.style.setProperty('-ms-transform', cords.transform);\n arrowRef.current.style.setProperty(\n '-webkit-transform',\n cords.transform\n );\n arrowRef.current.style.top =\n arrowStyle.top?.toString() || cords.arrowTop;\n arrowRef.current.style.left =\n arrowStyle.left?.toString() || cords.arrowLeft;\n }\n };\n // hooks\n useOnEscape(closePopup, closeOnEscape); // can be optimized if we disabled for hover\n useTabbing(contentRef, isOpen && isModal);\n useRepositionOnResize(setPosition, repositionOnResize);\n useOnClickOutside(\n !!trigger ? [contentRef, triggerRef] : [contentRef],\n closePopup,\n closeOnDocumentClick && !nested\n ); // we need to add a ne\n // render the trigger element and add events\n const renderTrigger = () => {\n const triggerProps: any = {\n key: 'T',\n ref: triggerRef,\n 'aria-describedby': popupId.current,\n };\n const onAsArray = Array.isArray(on) ? on : [on];\n for (let i = 0, len = onAsArray.length; i < len; i++) {\n switch (onAsArray[i]) {\n case 'click':\n triggerProps.onClick = togglePopup;\n break;\n case 'right-click':\n triggerProps.onContextMenu = onContextMenu;\n break;\n case 'hover':\n triggerProps.onMouseEnter = onMouseEnter;\n triggerProps.onMouseLeave = onMouseLeave;\n break;\n case 'focus':\n triggerProps.onFocus = onMouseEnter;\n triggerProps.onBlur = onMouseLeave;\n break;\n default:\n }\n }\n\n if (typeof trigger === 'function') {\n const comp = trigger(isOpen);\n return !!trigger && React.cloneElement(comp, triggerProps);\n }\n\n return !!trigger && React.cloneElement(trigger, triggerProps);\n };\n\n const addWarperAction = () => {\n const popupContentStyle = isModal\n ? styles.popupContent.modal\n : styles.popupContent.tooltip;\n\n const childrenElementProps: any = {\n className: `popup-content ${\n className !== ''\n ? className\n .split(' ')\n .map(c => `${c}-content`)\n .join(' ')\n : ''\n }`,\n style: {\n ...popupContentStyle,\n ...contentStyle,\n pointerEvents: 'auto', //closeOnDocumentClick && nested ? 'auto' : 'none',\n },\n ref: contentRef,\n onClick: (e: any) => {\n e.stopPropagation();\n },\n };\n if (!modal && on.indexOf('hover') >= 0) {\n childrenElementProps.onMouseEnter = onMouseEnter;\n childrenElementProps.onMouseLeave = onMouseLeave;\n }\n return childrenElementProps;\n };\n\n const renderContent = () => {\n return (\n <div\n {...addWarperAction()}\n key=\"C\"\n role={isModal ? 'dialog' : 'tooltip'}\n id={popupId.current}\n >\n {arrow && !isModal && (\n <div ref={arrowRef} style={styles.popupArrow}>\n <svg\n data-testid=\"arrow\"\n className={`popup-arrow ${\n className !== ''\n ? className\n .split(' ')\n .map(c => `${c}-arrow`)\n .join(' ')\n : ''\n }`}\n viewBox=\"0 0 32 16\"\n style={{\n position: 'absolute',\n ...arrowStyle,\n }}\n >\n <path d=\"M16 0l16 16H0z\" fill=\"currentcolor\" />\n </svg>\n </div>\n )}\n {children && typeof children === 'function'\n ? children(closePopup, isOpen)\n : children}\n </div>\n );\n };\n\n const overlay = !(on.indexOf('hover') >= 0);\n const ovStyle = isModal ? styles.overlay.modal : styles.overlay.tooltip;\n\n const content = [\n overlay && (\n <div\n key=\"O\"\n data-testid=\"overlay\"\n data-popup={isModal ? 'modal' : 'tooltip'}\n className={`popup-overlay ${\n className !== ''\n ? className\n .split(' ')\n .map(c => `${c}-overlay`)\n .join(' ')\n : ''\n }`}\n style={{\n ...ovStyle,\n ...overlayStyle,\n pointerEvents:\n (closeOnDocumentClick && nested) || isModal ? 'auto' : 'none',\n }}\n onClick={closeOnDocumentClick && nested ? closePopup : undefined}\n tabIndex={-1}\n >\n {isModal && renderContent()}\n </div>\n ),\n\n !isModal && renderContent(),\n ];\n\n return (\n <>\n {renderTrigger()}\n {isOpen && ReactDOM.createPortal(content, getRootPopup())}\n </>\n );\n }\n);\n\nexport default Popup;\n"],"names":["useOnEscape","handler","active","useEffect","listener","event","key","document","addEventListener","removeEventListener","useRepositionOnResize","window","useOnClickOutside","ref","refs","Array","isArray","contains","forEach","r","current","target","stopPropagation","useTabbing","contentRef","keyCode","els","querySelectorAll","focusableEls","prototype","slice","call","length","preventDefault","firstFocusableEl","lastFocusableEl","shiftKey","activeElement","focus","useIsomorphicLayoutEffect","useLayoutEffect","Style","popupContent","tooltip","position","zIndex","modal","margin","popupArrow","height","width","background","color","overlay","top","bottom","left","right","display","POSITION_TYPES","getCoordinatesForPosition","triggerBounding","ContentBounding","arrow","offsetX","offsetY","args","split","CenterTop","CenterLeft","transform","arrowTop","arrowLeft","getTooltipBoundary","keepTooltipInside","boundingBox","innerWidth","innerHeight","selector","querySelector","process","env","NODE_ENV","Error","getBoundingClientRect","calculatePosition","bestCoords","i","wrapperBox","positions","contentBox","popupIdCounter","getRootPopup","PopupRoot","getElementById","createElement","setAttribute","body","appendChild","Popup","forwardRef","trigger","onOpen","onClose","defaultOpen","open","undefined","disabled","nested","closeOnDocumentClick","repositionOnResize","closeOnEscape","on","contentStyle","arrowStyle","overlayStyle","className","lockScroll","mouseEnterDelay","mouseLeaveDelay","children","useState","isOpen","setIsOpen","triggerRef","useRef","arrowRef","focusedElBeforeOpen","popupId","isModal","timeOut","setPosition","focusContentOnOpen","lockScrolll","resetScroll","clearTimeout","openPopup","closePopup","setTimeout","togglePopup","onMouseEnter","onContextMenu","onMouseLeave","getElementsByTagName","style","overflow","firstEl","useImperativeHandle","close","toggle","content","cords","scrollY","scrollX","setProperty","toString","renderTrigger","triggerProps","onAsArray","len","onClick","onFocus","onBlur","comp","React","cloneElement","addWarperAction","popupContentStyle","styles","childrenElementProps","map","c","join","pointerEvents","e","indexOf","renderContent","role","id","viewBox","d","fill","ovStyle","tabIndex","ReactDOM","createPortal"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEO,IAAMA,WAAW,GAAG,SAAdA,WAAc,CACzBC,OADyB,EAEzBC,MAFyB;MAEzBA;AAAAA,IAAAA,SAAS;;;AAETC,EAAAA,SAAS,CAAC;AACR,QAAI,CAACD,MAAL,EAAa;;AACb,QAAME,QAAQ,GAAG,SAAXA,QAAW,CAACC,KAAD;AACf;AACA,UAAIA,KAAK,CAACC,GAAN,KAAc,QAAlB,EAA4BL,OAAO,CAACI,KAAD,CAAP;AAC7B,KAHD;;AAIAE,IAAAA,QAAQ,CAACC,gBAAT,CAA0B,OAA1B,EAAmCJ,QAAnC;AAEA,WAAO;AACL,UAAI,CAACF,MAAL,EAAa;AACbK,MAAAA,QAAQ,CAACE,mBAAT,CAA6B,OAA7B,EAAsCL,QAAtC;AACD,KAHD;AAID,GAZQ,EAYN,CAACH,OAAD,EAAUC,MAAV,CAZM,CAAT;AAaD,CAjBM;AAmBA,IAAMQ,qBAAqB,GAAG,SAAxBA,qBAAwB,CAACT,OAAD,EAAsBC,MAAtB;MAAsBA;AAAAA,IAAAA,SAAS;;;AAClEC,EAAAA,SAAS,CAAC;AACR,QAAI,CAACD,MAAL,EAAa;;AACb,QAAME,QAAQ,GAAG,SAAXA,QAAW;AACfH,MAAAA,OAAO;AACR,KAFD;;AAIAU,IAAAA,MAAM,CAACH,gBAA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