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DV,EAAQmB,WAAW,EACrBZ,EAAeI,OAAO,EAAEc,oBAAoB,WAAYf,GAE1DH,EAAeI,OAAO,EAAEe,SAC1B,CACF,EAAG,CAAC1B,EAAQ,EAEZS,CAAAA,EAAAA,EAAAA,SAAAA,EAAU,KACJP,GACFK,EAAeI,OAAO,EAAEgB,SAASzB,GAE/BD,EACFM,EAAeI,OAAO,EAAEiB,OAExBrB,EAAeI,OAAO,EAAEO,MAE5B,EAAG,CAACjB,EAAWC,EAAM,EAEd,UAAC2B,MAAAA,CAAIC,IAAKzB,EAAS0B,MAAO,CAAE5B,MAAAA,EAAOC,OAAAA,EAAQ4B,WAAY,CAAE,C,EAClE,E,q4nBC3EMC,EAAyB,CAAC,CAC9BC,SAAAA,CAAQ,CACR,GAAGC,EACyB,IAC5B,GAAM,CAACC,EAAcC,EAAgB,CAAGC,CAAAA,EAAAA,EAAAA,QAAAA,EAAS,IACjD,MACE,UAACT,MAAAA,CACCU,aAAc,IAAMF,EAAgB,IACpCG,aAAc,IAAMH,EAAgB,IACnC,GAAGF,CAAK,C,SAERM,CAAAA,EAAAA,EAAAA,YAAAA,EAAaP,EAAU,CACtBjC,UAAW,CAACmC,EACZlC,MAAO,EACPC,MAAO,GACPC,OAAQ,EACV,E,EAGN,EAEMsC,EAAoB,CACxBpB,KAAM,GACNF,SAAU,GACVuB,cAAeC,EACfC,iBAAkB,CAChBC,oBAAqB,gBACvB,CACF,EAEMC,EAAwB,CAC5BzB,KAAM,GACNF,SAAU,GACVuB,cAAeK,EACfH,iBAAkB,CAChBC,oBAAqB,gBACvB,CACF,EAEaG,EAAiB,GAI1B,UAAChB,EAAAA,CAAwB,GAAGE,CAAK,C,SAC/B,UAACpC,EAAcA,CAACC,QAAS0C,C,KAKlBQ,EAAqB,GAI9B,UAACjB,EAAAA,CAAwB,GAAGE,CAAK,C,SAC/B,UAACpC,EAAcA,CAACC,QAAS+C,C","sources":["webpack://@affine/web/../component/src/components/internal-lottie/index.tsx","webpack://@affine/web/../core/src/components/blocksuite/block-suite-mode-switch/switch-items.tsx"],"sourcesContent":["import type { AnimationItem } from 'lottie-web';\nimport lottie from 'lottie-web';\nimport { useEffect, useRef } from 'react';\n\ninterface CustomLottieProps {\n options: {\n loop?: boolean | number | undefined;\n autoReverse?: boolean | undefined;\n autoplay?: boolean | undefined;\n animationData: any;\n rendererSettings?: {\n preserveAspectRatio?: string | undefined;\n };\n };\n isStopped?: boolean | undefined;\n speed?: number | undefined;\n width?: number | string | undefined;\n height?: number | string | undefined;\n}\n\nexport const InternalLottie = ({\n options,\n isStopped,\n speed,\n width,\n height,\n}: CustomLottieProps) => {\n const element = useRef(null);\n const lottieInstance = useRef();\n const directionRef = useRef<1 | -1>(1);\n\n useEffect(() => {\n const callback = () => {\n if (!lottieInstance.current) {\n return;\n }\n const frame = lottieInstance.current.currentFrame.toFixed(0);\n if (frame === '1' || frame === '0') {\n directionRef.current = 1;\n lottieInstance.current.setDirection(directionRef.current);\n lottieInstance.current.goToAndStop(0, true);\n lottieInstance.current.play();\n } else {\n directionRef.current = -1;\n lottieInstance.current.setDirection(directionRef.current);\n lottieInstance.current.goToAndStop(\n lottieInstance.current.totalFrames - 1,\n true\n );\n lottieInstance.current.play();\n }\n };\n if (element.current) {\n if (options.autoReverse && options.autoplay) {\n lottieInstance.current = lottie.loadAnimation({\n ...options,\n autoplay: false,\n loop: false,\n container: element.current,\n });\n } else {\n lottieInstance.current = lottie.loadAnimation({\n ...options,\n container: element.current,\n });\n }\n if (options.autoReverse) {\n lottieInstance.current.addEventListener('complete', callback);\n }\n }\n return () => {\n if (options.autoReverse) {\n lottieInstance.current?.removeEventListener('complete', callback);\n }\n lottieInstance.current?.destroy();\n };\n }, [options]);\n\n useEffect(() => {\n if (speed) {\n lottieInstance.current?.setSpeed(speed);\n }\n if (isStopped) {\n lottieInstance.current?.stop();\n } else {\n lottieInstance.current?.play();\n }\n }, [isStopped, speed]);\n\n return
;\n};\n","import { InternalLottie } from '@affine/component/internal-lottie';\nimport type { HTMLAttributes } from 'react';\nimport type React from 'react';\nimport { cloneElement, useState } from 'react';\n\nimport edgelessHover from './animation-data/edgeless-hover.json';\nimport pageHover from './animation-data/page-hover.json';\n\ntype HoverAnimateControllerProps = {\n active?: boolean;\n hide?: boolean;\n trash?: boolean;\n children: React.ReactElement;\n} & HTMLAttributes;\n\nconst HoverAnimateController = ({\n children,\n ...props\n}: HoverAnimateControllerProps) => {\n const [startAnimate, setStartAnimate] = useState(false);\n return (\n setStartAnimate(true)}\n onMouseLeave={() => setStartAnimate(false)}\n {...props}\n >\n {cloneElement(children, {\n isStopped: !startAnimate,\n speed: 1,\n width: 20,\n height: 20,\n })}\n \n );\n};\n\nconst pageLottieOptions = {\n loop: false,\n autoplay: false,\n animationData: pageHover,\n rendererSettings: {\n preserveAspectRatio: 'xMidYMid slice',\n },\n};\n\nconst edgelessLottieOptions = {\n loop: false,\n autoplay: false,\n animationData: edgelessHover,\n rendererSettings: {\n preserveAspectRatio: 'xMidYMid slice',\n },\n};\n\nexport const PageSwitchItem = (\n props: Omit\n) => {\n return (\n \n \n \n );\n};\n\nexport const EdgelessSwitchItem = (\n props: Omit\n) => {\n return (\n \n \n \n );\n};\n"],"names":["InternalLottie","options","isStopped","speed","width","height","element","useRef","lottieInstance","directionRef","useEffect","callback","current","frame","currentFrame","toFixed","setDirection","goToAndStop","totalFrames","play","autoReverse","autoplay","lottie","loop","container","addEventListener","removeEventListener","destroy","setSpeed","stop","div","ref","style","lineHeight","HoverAnimateController","children","props","startAnimate","setStartAnimate","useState","onMouseEnter","onMouseLeave","cloneElement","pageLottieOptions","animationData","pageHover","rendererSettings","preserveAspectRatio","edgelessLottieOptions","edgelessHover","PageSwitchItem","EdgelessSwitchItem"],"sourceRoot":""}