packages feed

reanimate 0.1.6.0 → 0.1.7.0

raw patch · 69 files changed

+2480/−1882 lines, 69 filesdep +chiphunkdep +optparse-applicativedep −matricesdep ~reanimate-svgbinary-added

Dependencies added: chiphunk, optparse-applicative

Dependencies removed: matrices

Dependency ranges changed: reanimate-svg

Files

+ docs/gifs/doc_andThen.gif view

binary file changed (absent → 15149 bytes)

+ docs/gifs/doc_bellS.gif view

binary file changed (absent → 11523 bytes)

+ docs/gifs/doc_constantS.gif view

binary file changed (absent → 2528 bytes)

+ docs/gifs/doc_curveS.gif view

binary file changed (absent → 11071 bytes)

+ docs/gifs/doc_drawBox.gif view

binary file changed (absent → 2753 bytes)

+ docs/gifs/doc_drawCircle.gif view

binary file changed (absent → 14071 bytes)

+ docs/gifs/doc_drawProgress.gif view

binary file changed (absent → 11373 bytes)

+ docs/gifs/doc_fromToS.gif view

binary file changed (absent → 10888 bytes)

+ docs/gifs/doc_identityS.gif view

binary file changed (absent → 11373 bytes)

+ docs/gifs/doc_mapA.gif view

binary file changed (absent → 6786 bytes)

+ docs/gifs/doc_oscillateS.gif view

binary file changed (absent → 11758 bytes)

+ docs/gifs/doc_parA.gif view

binary file changed (absent → 28657 bytes)

+ docs/gifs/doc_parDropA.gif view

binary file changed (absent → 29365 bytes)

+ docs/gifs/doc_parLoopA.gif view

binary file changed (absent → 32781 bytes)

+ docs/gifs/doc_pause.gif view

binary file changed (absent → 14583 bytes)

+ docs/gifs/doc_pauseAround.gif view

binary file changed (absent → 12720 bytes)

+ docs/gifs/doc_pauseAtBeginning.gif view

binary file changed (absent → 11946 bytes)

+ docs/gifs/doc_pauseAtEnd.gif view

binary file changed (absent → 12147 bytes)

+ docs/gifs/doc_playThenReverseA.gif view

binary file changed (absent → 26577 bytes)

+ docs/gifs/doc_repeatA.gif view

binary file changed (absent → 20798 bytes)

+ docs/gifs/doc_reverseA.gif view

binary file changed (absent → 14984 bytes)

+ docs/gifs/doc_reverseS.gif view

binary file changed (absent → 11198 bytes)

+ docs/gifs/doc_seqA.gif view

binary file changed (absent → 15834 bytes)

+ docs/gifs/doc_signalA.gif view

binary file changed (absent → 13561 bytes)

+ docs/gifs/doc_signalFlat.gif view

binary file changed (absent → 2528 bytes)

reanimate.cabal view
@@ -2,7 +2,7 @@ --  see http://haskell.org/cabal/users-guide/  name:                reanimate-version:             0.1.6.0+version:             0.1.7.0 -- synopsis: -- description: license:             PublicDomain@@ -13,7 +13,8 @@ homepage:            https://github.com/Lemmih/reanimate build-type:          Simple extra-source-files:  ChangeLog.md-cabal-version:       >=1.10+extra-doc-files:     docs/gifs/*.gif+cabal-version:       >=1.18  description:   Animation library based on SVGs. Can import (and manipulate) SVGs from@@ -23,8 +24,8 @@  data-files:           viewer/build/*.js                       viewer/build/*.html-                      viewer/build/static/js/2.772a56e7.chunk.js-                      viewer/build/static/js/main.c36ecb4a.chunk.js+                      viewer/build/static/js/2.822530b2.chunk.js+                      viewer/build/static/js/main.b15b405f.chunk.js                       viewer/build/static/js/runtime~main.9eb600ee.js                       viewer/build/static/css/main.f7ad3e9b.chunk.css                       data/CIExyz.csv@@ -38,18 +39,22 @@   hs-source-dirs:     src   default-language:   Haskell2010   default-extensions: PackageImports-  exposed-modules:    Reanimate.Monad+  exposed-modules:    Reanimate+                      Reanimate.Animation                       Reanimate.Signal                       Reanimate.Render                       Reanimate.Examples                       Reanimate.Combinators                       Reanimate.LaTeX                       Reanimate.Svg+                      Reanimate.Svg.Unuse+                      Reanimate.Svg.Constructors+                      Reanimate.Svg.BoundingBox+                      Reanimate.Svg.LineCommand                       Reanimate.Diagrams                       Reanimate.Transform                       Reanimate.Driver                       Reanimate.Misc-                      Reanimate.Morph                       Reanimate.Raster                       Reanimate.ColorMap                       Reanimate.ColorSpace@@ -57,17 +62,27 @@                       Reanimate.Memo                       Reanimate.Scene                       Reanimate.Povray-  other-modules:      Reanimate.Svg.NamedColors-                      Reanimate.Cache+                      Reanimate.Effect+                      Reanimate.Constants+                      Reanimate.Chiphunk+                      Reanimate.PolyShape+                      Reanimate.Builtin.Documentation+  other-modules:      Reanimate.Cache+                      Reanimate.Driver.Check+                      Reanimate.Driver.CLI+                      Reanimate.Driver.Server+                      Reanimate.Driver.Compile                       Paths_reanimate   build-depends:       base >=4.10 && <4.13,                        time, text, filepath, process, directory,-                       containers, reanimate-svg >= 0.9.1.1, xml, bytestring, lens, linear, mtl, matrix,+                       containers, reanimate-svg >= 0.9.2.1, xml, bytestring, lens, linear, mtl, matrix,                        JuicyPixels, attoparsec, parallel, diagrams, diagrams-svg,                        diagrams-core, diagrams-lib, diagrams-contrib,-                       svg-builder, matrices, cubicbezier, palette, websockets,+                       svg-builder, cubicbezier, palette, websockets,                        hashable, fsnotify, open-browser, random-shuffle, base64-bytestring,-                       vector, colour, cassava, ansi-wl-pprint, here, temporary+                       vector, colour, cassava, ansi-wl-pprint, here, temporary,+                       optparse-applicative, chiphunk+  ghc-options: -Wall  test-suite spec   type: exitcode-stdio-1.0
+ src/Reanimate.hs view
@@ -0,0 +1,106 @@+{-|+Module      : Reanimate+Description : SVG-base animation library.+Copyright   : Written by David Himmelstrup+License     : Unlicense+Maintainer  : lemmih@gmail.com+Stability   : experimental+Portability : POSIX++Reanimate is an animation library based on SVGs. It is designed to act like glue+between external components such as 'latex', 'ffmpeg', 'gnuplot', 'diagrams',+and 'povray'.++-}+module Reanimate+  ( -- * Driver+    --+    -- | Reanimate features a web-based viewer which is opened by default if+    --   no other parameters are given. Key features:+    --+    --   * This viewer listens for changes to the source file and recompiles the+    --     code automatically as needed.+    --   * Animations are rendered with increasing fidelity until the frame+    --     rate eaches 60 fps.+    --   * Key commands for pausing, frame stepping, forward/rewind.+    reanimate,+    -- * Animations+    SVG,+    Animation(..),+    mkAnimation,+    animate,+    duration,+    -- ** Composition+    seqA,+    parA,+    parLoopA,+    parDropA,+    pause,+    andThen,+    mapA,+    pauseAtEnd,+    pauseAtBeginning,+    pauseAround,+    adjustDuration,+    setDuration,+    reverseA,+    playThenReverseA,+    repeatA,+    freezeAtPercentage,+    signalA,+    -- ** Signals+    Signal,+    constantS,+    fromToS,+    reverseS,+    curveS,+    bellS,+    oscillateS,+    fromListS,+    -- * SVG+    module Reanimate.Svg.Constructors,+    module Reanimate.Svg.LineCommand,+    module Reanimate.Svg.BoundingBox,+    module Reanimate.Svg,+    -- ** Raster data+    embedImage,+    embedDynamicImage,+    embedPng,+    raster,+    -- ** External SVG providers+    latex,+    latexAlign,+    xelatex,+    povray,+    -- * Colormaps+    turbo,+    viridis,+    magma,+    inferno,+    plasma,+    sinebow,+    parula,+    cividis,+    jet,+    hsv,+    hsvMatlab,+    greyscale,+    -- * Constants+    screenWidth,+    screenHeight,+    defaultDPI,+    defaultStrokeWidth+  ) where++import           Reanimate.Animation+import           Reanimate.ColorMap+import           Reanimate.Constants+import           Reanimate.Driver+import           Reanimate.LaTeX+import           Reanimate.Povray+import           Reanimate.Raster+import           Reanimate.Signal+import           Reanimate.Svg+import           Reanimate.Svg.BoundingBox+import           Reanimate.Svg.Constructors+import           Reanimate.Svg.LineCommand
+ src/Reanimate/Animation.hs view
@@ -0,0 +1,258 @@+module Reanimate.Animation where++import           Control.Arrow              ()+import           Data.Fixed                 (mod')+import qualified Data.Map                   as M+import           Graphics.SvgTree           (Document (..), Number (..),+                                             Tree (..), xmlOfTree)+import           Graphics.SvgTree.Printer+import           Reanimate.Constants+import           Reanimate.Svg.Constructors+import           Reanimate.Signal+import           Text.XML.Light.Output++-- | Duration of an animation or effect. Usually measured in seconds.+type Duration = Double+-- | Time signal. Goes from 0 to 1, inclusive.+type Time = Double++type SVG = Tree++-- | Animations are SVGs over a finite time.+data Animation = Animation Duration (Time -> SVG)++mkAnimation :: Duration -> (Time -> SVG) -> Animation+mkAnimation = Animation++-- | Construct animation with a duration of @1@.+animate :: (Time -> SVG) -> Animation+animate = Animation 1++-- | Query the duration of an animation.+duration :: Animation -> Duration+duration (Animation d _) = d++-- | Play animations in sequence. The @lhs@ animation is removed after it has+--   completed. New animation duration is '@duration lhs + duration rhs@'.+--+--   Example:+--+--   > drawBox `seqA` drawCircle+--+--   <<docs/gifs/doc_seqA.gif>>+seqA :: Animation -> Animation -> Animation+seqA (Animation d1 f1) (Animation d2 f2) =+  Animation totalD $ \t ->+    if t < d1/totalD+      then f1 (t * totalD/d1)+      else f2 ((t-d1/totalD) * totalD/d2)+  where+    totalD = d1+d2++-- | Play two animation concurrently. Shortest animation freezes on last frame.+--   New animation duration is '@max (duration lhs) (duration rhs)@'.+--+--   Example:+--+--   > drawBox `parA` adjustDuration (*2) drawCircle+--+--   <<docs/gifs/doc_parA.gif>>+parA :: Animation -> Animation -> Animation+parA (Animation d1 f1) (Animation d2 f2) =+  Animation (max d1 d2) $ \t ->+    let t1 = t * totalD/d1+        t2 = t * totalD/d2 in+    mkGroup+    [ f1 (min 1 t1)+    , f2 (min 1 t2) ]+  where+    totalD = max d1 d2++-- | Play two animation concurrently. Shortest animation loops.+--   New animation duration is '@max (duration lhs) (duration rhs)@'.+--+--   Example:+--+--   > drawBox `parLoopA` adjustDuration (*2) drawCircle+--+--   <<docs/gifs/doc_parLoopA.gif>>+parLoopA :: Animation -> Animation -> Animation+parLoopA (Animation d1 f1) (Animation d2 f2) =+  Animation totalD $ \t ->+    let t1 = t * totalD/d1+        t2 = t * totalD/d2 in+    mkGroup+    [ f1 (t1 `mod'` 1)+    , f2 (t2 `mod'` 1) ]+  where+    totalD = max d1 d2++-- | Play two animation concurrently. Animations disappear after playing once.+--   New animation duration is '@max (duration lhs) (duration rhs)@'.+--+--   Example:+--+--   > drawBox `parLoopA` adjustDuration (*2) drawCircle+--+--   <<docs/gifs/doc_parDropA.gif>>+parDropA :: Animation -> Animation -> Animation+parDropA (Animation d1 f1) (Animation d2 f2) =+  Animation totalD $ \t ->+    let t1 = t * totalD/d1+        t2 = t * totalD/d2 in+    mkGroup+    [ if t1>1 then None else f1 t1+    , if t2>1 then None else f2 t2 ]+  where+    totalD = max d1 d2++-- | Empty animation (no SVG output) with a fixed duration.+--+--   Example:+--+--   > pause 1 `seqA` drawCircle+--+--   <<docs/gifs/doc_pause.gif>>+pause :: Duration -> Animation+pause d = Animation d (const None)++-- | Play left animation and freeze on the last frame, then play the right+--   animation. New duration is '@duration lhs + duration rhs@'.+--+--   Example:+--+--   > drawBox `andThen` drawCircle+--+--   <<docs/gifs/doc_andThen.gif>>+andThen :: Animation -> Animation -> Animation+andThen a b = a `parA` (pause (duration a) `seqA` b)++frameAt :: Double -> Animation -> Tree+frameAt t (Animation d f) = f t'+  where+    t' = min 1 (max 0 (t/d))++renderTree :: Tree -> String+renderTree t = maybe "" ppElement $ xmlOfTree t++renderSvg :: Maybe Number -> Maybe Number -> Tree -> String+renderSvg w h t = ppDocument doc+-- renderSvg w h t = ppFastElement (xmlOfDocument doc)+  where+    width = 16+    height = 9+    doc = Document+      { _viewBox = Just (-width/2, -height/2, width, height)+      , _width = w+      , _height = h+      , _elements = [withStrokeWidth defaultStrokeWidth $ scaleXY 1 (-1) t]+      , _definitions = M.empty+      , _description = ""+      , _documentLocation = ""+      }++-- | Map over the SVG produced by an animation at every frame.+--+--   Example:+--+--   > mapA (scale 0.5) drawCircle+--+--   <<docs/gifs/doc_mapA.gif>>++mapA :: (Tree -> Tree) -> Animation -> Animation+mapA fn (Animation d f) = Animation d (fn . f)++-- | Freeze the last frame for @t@ seconds at the end of the animation.+--+--   Example:+--+--   > pauseAtEnd 1 drawProgress+--+--   <<docs/gifs/doc_pauseAtEnd.gif>>+pauseAtEnd :: Duration -> Animation -> Animation+pauseAtEnd t a = a `andThen` pause t++-- | Freeze the first frame for @t@ seconds at the beginning of the animation.+--+--   Example:+--+--   > pauseAtBeginning 1 drawProgress+--+--   <<docs/gifs/doc_pauseAtBeginning.gif>>+pauseAtBeginning :: Duration -> Animation -> Animation+pauseAtBeginning t a =+    Animation t (freezeFrame 0 a) `seqA` a++-- | Freeze the first and the last frame of the animation for a specified duration.+--+--   Example:+--+--   > pauseAround 1 1 drawProgress+--+--   <<docs/gifs/doc_pauseAround.gif>>+pauseAround :: Duration -> Duration -> Animation -> Animation+pauseAround start end = pauseAtEnd end . pauseAtBeginning start++-- Freeze frame at time @t@.+freezeFrame :: Double -> Animation -> (Time -> SVG)+freezeFrame t (Animation d f) = const $ f (t/d)++-- | Change the duration of an animation. Animates are stretched or squished+--   (rather than truncated) to fit the new duration.+adjustDuration :: (Duration -> Duration) -> Animation -> Animation+adjustDuration fn (Animation d gen) =+  Animation (fn d) gen++-- | Set the duration of an animation by adjusting its playback rate. The+--   animation is still played from start to finish without being cropped.+setDuration :: Duration -> Animation -> Animation+setDuration newD = adjustDuration (const newD)++-- | Play an animation in reverse. Duration remains unchanged. Shorthand for:+--   @'signalA' 'reverseS'@.+--+--   Example:+--+--   > reverseA drawCircle+--+--   <<docs/gifs/doc_reverseA.gif>>+reverseA :: Animation -> Animation+reverseA = signalA reverseS++-- | Play animation before playing it again in reverse. Duration is twice+--   the duration of the input.+--+--   Example:+--+--   > playThenReverseA drawCircle+--+--   <<docs/gifs/doc_playThenReverseA.gif>>+playThenReverseA :: Animation -> Animation+playThenReverseA a = a `seqA` reverseA a++-- | Loop animation @n@ number of times. This number may be fractional and it+--   may be less than 1. It must be greater than or equal to 0, though.+--   New duration is @n*duration input@.+--+--   Example:+--+--   > repeatA 1.5 drawCircle+--+--   <<docs/gifs/doc_repeatA.gif>>+repeatA :: Double -> Animation -> Animation+repeatA n (Animation d f) = Animation (d*n) $ \t ->+  f ((t*n) `mod'` 1)++freezeAtPercentage :: Time -> Animation -> Animation+freezeAtPercentage frac (Animation d genFrame) =+  Animation d $ const $ genFrame frac++-- | Modify the time component of an animation. Animation duration is unchanged.+--+--   Example:+--+--   > signalA (fromToS 0.25 0.75) drawCircle+--+--   <<docs/gifs/doc_signalA.gif>>+signalA :: Signal -> Animation -> Animation+signalA fn (Animation d gen) = Animation d $ gen . fn
+ src/Reanimate/Builtin/Documentation.hs view
@@ -0,0 +1,35 @@+module Reanimate.Builtin.Documentation where++import Reanimate.Animation+import Reanimate.Svg+import Reanimate.Constants++docEnv :: Animation -> Animation+docEnv = mapA $ \svg -> mkGroup+  [ mkBackground "white"+  , withFillOpacity 0 $+    withStrokeWidth 0.1 $+    withStrokeColor "black" svg ]++-- | <<docs/gifs/doc_drawBox.gif>>+drawBox :: Animation+drawBox = mkAnimation 2 $ \t ->+  partialSvg t $ pathify $+  mkRect (screenWidth/2) (screenHeight/2)++-- | <<docs/gifs/doc_drawCircle.gif>>+drawCircle :: Animation+drawCircle = mkAnimation 2 $ \t ->+  partialSvg t $ pathify $+  mkCircle (screenHeight/3)++-- | <<docs/gifs/doc_drawProgress.gif>>+drawProgress :: Animation+drawProgress = mkAnimation 2 $ \t ->+  mkGroup+  [ mkLine (-screenWidth/2*widthP,0)+           (screenWidth/2*widthP,0)+  , translate (-screenWidth/2*widthP + screenWidth*widthP*t) 0 $+    withFillOpacity 1 $ mkCircle 0.5 ]+  where+    widthP = 0.8
src/Reanimate/Cache.hs view
@@ -6,23 +6,20 @@   , cacheDiskLines   ) where -import           Control.Exception import           Data.Hashable import           Data.IORef import           Data.Map           (Map) import qualified Data.Map           as Map import           Data.Text          (Text) import qualified Data.Text          as T-import qualified Data.Text.Encoding as T import qualified Data.Text.IO       as T-import           Graphics.SvgTree   (Tree (..), parseSvgFile, unparse)-import           Reanimate.Monad    (renderTree)-import           Reanimate.Svg      (unbox)-import Text.XML.Light ( Content(..), parseXML )+import           Graphics.SvgTree   (Tree (..), unparse)+import           Reanimate.Animation    (renderTree) import           System.Directory import           System.FilePath-import           System.IO.Unsafe import           System.IO+import           System.IO.Unsafe+import           Text.XML.Light     (Content (..), parseXML)  -- Memory cache and disk cache @@ -36,7 +33,7 @@       then do         inp <- T.readFile path         case parse inp of-          Nothing -> genCache root path+          Nothing  -> genCache root path           Just val -> pure val       else genCache root path   where@@ -56,7 +53,7 @@   where     parse txt = case parseXML txt of       [Elem t] -> Just (unparse t)-      _   -> Nothing+      _        -> Nothing     render = T.pack . renderTree  cacheDiskLines :: (Text -> IO [Text]) -> (Text -> IO [Text])@@ -81,4 +78,4 @@         -- None usually indicates that latex or another tool was misconfigured. In this case,         -- don't store the result.         None -> pure None-        _ -> atomicModifyIORef cache (\store -> (Map.insert key svg store, svg))+        _    -> atomicModifyIORef cache (\m -> (Map.insert key svg m, svg))
+ src/Reanimate/Chiphunk.hs view
@@ -0,0 +1,96 @@+module Reanimate.Chiphunk+  ( simulate+  , BodyStore+  , newBodyStore+  , addToBodyStore+  , spaceFreeRecursive+  , polyShapesToBody+  , polygonsToBody+  ) where++import           Chiphunk.Low+import           Control.Monad+import           Data.IORef+import           Data.Map            (Map)+import qualified Data.Map            as Map+import qualified Data.Vector         as V+import qualified Data.Vector.Mutable as V+import           Foreign.Ptr+import           Graphics.SvgTree    (Tree)+import           Linear.V2 (V2(..))+import           Reanimate.Animation+import           Reanimate.PolyShape+import           Reanimate.Svg.Constructors++type BodyStore = IORef (Map WordPtr Tree)++newBodyStore :: IO BodyStore+newBodyStore = newIORef Map.empty++addToBodyStore :: BodyStore -> Body -> Tree -> IO ()+addToBodyStore store body svg = do+  key <- atomicModifyIORef' store $ \m ->+          case Map.maxViewWithKey m of+            Nothing -> (Map.singleton 1 svg, 1)+            Just ((maxKey,_),_) ->+              (Map.insert (maxKey+1) svg m, maxKey+1)+  bodyUserData body $= wordPtrToPtr key++renderBodyStore :: Space -> BodyStore -> IO Tree+renderBodyStore space store = do+  m <- readIORef store+  lst <- newIORef []+  spaceEachBody space (\body _dat -> do+    key <- get (bodyUserData body)+    case Map.lookup (ptrToWordPtr key) m of+      Nothing -> putStrLn "Body doesn't have an associated SVG"+      Just svg -> do+        Vect posX posY <- get $ bodyPosition body+        angle <- get $ bodyAngle body+        let bodySvg =+              translate posX posY $+              rotate (angle/pi*180) $+              svg+        modifyIORef lst $ (bodySvg:)+    ) nullPtr+  result <- readIORef lst+  return $ mkGroup result+++simulate :: Space -> BodyStore -> Double -> Int -> Double -> IO Animation+simulate space store fps stepsPerFrame dur = do+  let timeStep = 1/(fps*fromIntegral stepsPerFrame)+      frames = round (dur * fps)+  v <- V.new frames+  forM_ [0..frames-1] $ \nth -> do+    svg <- renderBodyStore space store+    V.write v nth svg+    replicateM_ stepsPerFrame $ spaceStep space timeStep+  frozen <- V.unsafeFreeze v+  return $ mkAnimation dur $ \t ->+    let key = round (t * fromIntegral (frames-1))+    in frozen V.! key++polyShapesToBody :: Space -> [PolyShape] -> IO Body+polyShapesToBody space poly = do+    polygonsToBody space (map (map toVect) $ plDecompose poly)+  where+    toVect (V2 x y) = Vect x y++polygonsToBody :: Space -> [[Vect]] -> IO Body+polygonsToBody space polygons = do+  plBody <- bodyNew 0 0+  spaceAddBody space plBody++  forM_ polygons $ \vects -> do+    polyShape <- polyShapeNewRaw plBody vects 0.00+    shapeDensity polyShape $= 1+    spaceAddShape space polyShape+    shapeFriction polyShape $= 0.7+  return plBody++spaceFreeRecursive :: Space -> IO ()+spaceFreeRecursive space = do+  spaceEachBody space (\body _ -> bodyFree body) nullPtr+  spaceEachShape space (\shape _ -> shapeFree shape) nullPtr+  spaceFree space
src/Reanimate/ColorMap.hs view
@@ -10,6 +10,7 @@   , cividis   , jet   , hsv+  , hsvMatlab   , greyscale   ) where @@ -150,9 +151,9 @@     pi_1_3 = pi / 3     pi_2_3 = pi * 2 / 3     x = (0.5 - t) * pi-    r = round $ 255 * sin(x)^2-    g = round $ 255 * sin(x+pi_1_3)^2-    b = round $ 255 * sin(x+pi_2_3)^2+    r = round $ 255 * sin(x)**2+    g = round $ 255 * sin(x+pi_1_3)**2+    b = round $ 255 * sin(x+pi_2_3)**2  -- | Given a number t in the range [0,1], returns the corresponding color from --   the “cividis” color vision deficiency-optimized color scheme designed by@@ -174,7 +175,7 @@     green = trunc $ min (4*t - 0.5) (-4*t + 3.5)     blue  = trunc $ min (4*t + 0.5) (-4*t + 2.5)     trunc :: Double -> Pixel8-    trunc = fromIntegral . min 255 . max 0 . round . (*) 255+    trunc = round . min 255 . max 0 . (*) 255  -- | hsv colormap. Goes from 0 degrees to 360 degrees. hsv :: Double -> PixelRGB8@@ -196,12 +197,14 @@ parula :: Double -> PixelRGB8 parula = ramp vec   where-    vec = V.fromList $ pixels colors+    vec = V.fromList $ pixels colorList     pixels [] = []     pixels (r:g:b:xs) =       PixelRGB8 (round $ r*255) (round $ g*255) (round $ b*255) :       pixels xs-    colors =+    pixels _ = error "Reanimate.ColorMap.parula: Broken data"+    colorList :: [Double]+    colorList =        [0.2081, 0.1663, 0.5292        ,0.2091, 0.1721, 0.5411        ,0.2101, 0.1779, 0.5530@@ -467,6 +470,7 @@   where     toColor [r1,r2,g1,g2,b1,b2] =       PixelRGB8 (r1 `shiftL` 4 + r2) (g1 `shiftL` 4 + g2) (b1 `shiftL` 4+b2)+    toColor _ = error "Reanimate.ColorMap.colors: Broken data"  ramp :: Vector PixelRGB8 -> Double -> PixelRGB8 ramp v = \t -> v V.! (max 0 $ min (len-1) $ round $ t * (len'-1))
src/Reanimate/ColorSpace.hs view
@@ -1,18 +1,18 @@ module Reanimate.ColorSpace where -import qualified Data.ByteString.Lazy as BS+import qualified Data.ByteString.Lazy       as BS+import           Data.Colour.CIE+import           Data.Colour.CIE.Illuminant (d65) import           Data.Csv-import           Data.Map             (Map)-import qualified Data.Map             as Map+import           Data.Map                   (Map)+import qualified Data.Map                   as Map import           Data.Maybe-import qualified Data.Vector          as V-import Data.Colour.CIE-import Data.Colour.CIE.Illuminant+import qualified Data.Vector                as V import           Paths_reanimate import           System.IO.Unsafe -import           Reanimate.Svg-import           Graphics.SvgTree (Number(..), Tree)+import           Graphics.SvgTree           (Tree)+import           Reanimate.Svg.Constructors  type Nanometer = Integer @@ -30,7 +30,7 @@   withFillOpacity 0 $   mkLinePath $   [ (x, 1-y)-  | (ang, (x,y,_z)) <- Map.toList lightXYZCoordinates+  | (_nm, (x,y,_z)) <- Map.toList lightXYZCoordinates   ]  lightLABCoordinates :: Map Nanometer (Double, Double, Double)@@ -43,7 +43,7 @@   withFillOpacity 0 $   mkLinePath $   [ (a/350, (1-b)/150)-  | (ang, (_l,a,b)) <- Map.toList lightLABCoordinates+  | (_nm, (_l,a,b)) <- Map.toList lightLABCoordinates   ]  -- (Long, Medium, Short)@@ -57,9 +57,9 @@  renderSensitivity :: Tree renderSensitivity = mkGroup-  [ withStrokeColor "blue"  $ draw (\(l,m,s) -> s)-  , withStrokeColor "green" $ draw (\(l,m,s) -> m)-  , withStrokeColor "red"   $ draw (\(l,m,s) -> l)+  [ withStrokeColor "blue"  $ draw (\(_,_,s) -> s)+  , withStrokeColor "green" $ draw (\(_,m,_) -> m)+  , withStrokeColor "red"   $ draw (\(l,_,_) -> l)   ]   where     draw fn = withFillOpacity 0 $ mkLinePath
src/Reanimate/Combinators.hs view
@@ -1,15 +1,5 @@-{-# LANGUAGE Arrows            #-}-{-# LANGUAGE OverloadedStrings #-} module Reanimate.Combinators where -import           Control.Arrow-import           Data.Fixed      (mod')-import           Data.Monoid     ((<>))-import           Data.Text       (Text, pack)-import qualified Data.Text       as T---- import           Reanimate.Arrow- type Path = [(Double, Double)]  approxFnData :: Int -> (Double -> (Double, Double)) -> Path@@ -22,19 +12,3 @@     worker (x1, y1) (x2, y2) =       (x1 + (x2-x1)*idx       ,y1 + (y2-y1)*idx)---- signalSigmoid :: Double -> Double -> Double -> Ani Double--- signalSigmoid steepness from to = proc () -> do---   s <- signal 0 1 -< ()---   let s' = (s-0.5)*steepness---   let sigmoid = exp s' / (exp s'+1)---       ret = (from + (to-from)*sigmoid)---   returnA -< ret------ signalSCurve :: Double -> Double -> Double -> Ani Double--- signalSCurve steepness from to = proc () -> do---   s <- signal 0 1 -< ()---   let s' = if s < 0.5---               then 0.5 * (2*s)**steepness---               else 1-0.5 * (2 - 2*s)**steepness---   returnA -< from + (to-from)*s'
+ src/Reanimate/Constants.hs view
@@ -0,0 +1,19 @@+module Reanimate.Constants+  ( screenWidth+  , screenHeight+  , defaultDPI+  , defaultStrokeWidth+  ) where++import           Graphics.SvgTree++screenWidth, screenHeight :: Num a => a++screenWidth = 16+screenHeight = 9++defaultDPI :: Dpi+defaultDPI = 96++defaultStrokeWidth :: Double+defaultStrokeWidth = 0.05
src/Reanimate/Diagrams.hs view
@@ -1,27 +1,16 @@-{-# LANGUAGE FlexibleContexts          #-}-{-# LANGUAGE NoMonomorphismRestriction #-}-{-# LANGUAGE OverloadedStrings         #-}-{-# LANGUAGE PackageImports            #-}-{-# LANGUAGE TypeFamilies              #-}+{-# LANGUAGE OverloadedStrings #-} module Reanimate.Diagrams   ( renderDiagram   , SvgDiagram   ) where -import qualified Data.ByteString.Lazy  as BL-import qualified Diagrams.Backend.SVG  as D-import qualified Diagrams.Core.Compile as D-import qualified Diagrams.Core.Types   as D-import qualified Diagrams.Size         as D-import           Graphics.SvgTree      (Document (..), Tree (..), defaultSvg,-                                        elements, loadSvgFile, parseSvgFile,-                                        xmlOfDocument)-import qualified Graphics.Svg.Core as Svg-import           Linear.V2-import           Reanimate.Svg         (unbox)-+import qualified Data.ByteString.Lazy as BL+import qualified Diagrams.Backend.SVG as D+import qualified Diagrams.Core.Types  as D import           Diagrams.Prelude-import qualified Diagrams.Prelude      as D+import qualified Graphics.Svg.Core    as Svg+import           Graphics.SvgTree     (Tree (..), parseSvgFile)+import           Reanimate.Svg.Unuse  (unbox)  renderDiagram :: SvgDiagram -> Tree renderDiagram d =
src/Reanimate/Driver.hs view
@@ -1,274 +1,148 @@-{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE RecordWildCards #-} module Reanimate.Driver ( reanimate ) where -import           Control.Concurrent           (MVar, forkIO, forkOS, killThread,-                                               modifyMVar_, newEmptyMVar,-                                               putMVar, takeMVar)-import           Control.Exception            (SomeException, finally, handle) import           Control.Monad-import           Control.Monad.Fix            (fix) import           Data.Maybe-import qualified Data.Text                    as T-import qualified Data.Text.Read               as T-import           Data.Version-import           GHC.Environment              (getFullArgs)-import           Network.WebSockets-import           Paths_reanimate-import           Reanimate.Misc               (runCmdLazy, runCmd_)-import           Reanimate.Monad              (Animation)-import           Reanimate.Render             (render, renderSnippets,-                                               renderSvgs)-import           System.Directory             (doesFileExist, findExecutable,-                                               findFile, listDirectory, withCurrentDirectory)-import           System.Environment           (getArgs, getProgName)-import           System.Exit+import           Reanimate.Animation      (Animation)+import           Reanimate.Driver.Check+import           Reanimate.Driver.CLI+import           Reanimate.Driver.Compile+import           Reanimate.Driver.Server+import           Reanimate.Render         (FPS, Format (..), Height, Width,+                                           render, renderSnippets, renderSvgs)+import           System.Directory import           System.FilePath-import           System.FSNotify-import           System.IO-import           System.IO.Temp-import           Text.ParserCombinators.ReadP-import qualified Text.PrettyPrint.ANSI.Leijen as Doc import           Text.Printf-import           Web.Browser                  (openBrowser) -opts = defaultConnectionOptions-  { connectionCompressionOptions = PermessageDeflateCompression defaultPermessageDeflate }+presetFormat :: Preset -> Format+presetFormat Youtube    = RenderMp4+presetFormat ExampleGif = RenderGif+presetFormat Quick      = RenderMp4 -reanimate :: Animation -> IO ()-reanimate animation = do-  watch <- startManager-  args <- getArgs-  hSetBuffering stdin NoBuffering-  case args of-    ["once"] -> renderSvgs animation-    ["snippets"] -> renderSnippets animation-    ["check"] -> checkEnvironment-    ["render", target] ->-      render animation target-    _ -> do-      self <- findOwnSource-      url <- getDataFileName "viewer/build/index.html"-      putStrLn "Opening browser..."-      bSucc <- openBrowser url-      if bSucc-          then putStrLn "Browser opened."-          else hPutStrLn stderr $ "Failed to open browser. Manually visit: " ++ url-      putStrLn "Listening..."-      runServerWith "127.0.0.1" 9161 opts $ \pending -> do-        putStrLn "New connection received."-        conn <- acceptRequest pending-        slave <- newEmptyMVar-        let handler = modifyMVar_ slave $ \tid -> do+presetFPS :: Preset -> FPS+presetFPS Youtube    = 60+presetFPS ExampleGif = 24+presetFPS Quick      = 15 -              putStrLn "Reloading code..."-              killThread tid-              tid <- forkOS $ slaveHandler conn self-              return tid-            killSlave = do-              tid <- takeMVar slave-              killThread tid-        stop <- watchFile watch self handler-        putMVar slave =<< forkIO (return ())-        let loop = do-              fps <- receiveData conn :: IO T.Text-              handler-              loop-        loop `finally` (stop >> killSlave)+presetWidth :: Preset -> Width+presetWidth Youtube    = 2560+presetWidth ExampleGif = 320+presetWidth Quick      = 320 -slaveHandler conn self =-  withCurrentDirectory (takeDirectory self) $-  withSystemTempDirectory "reanimate" $ \tmpDir ->-  withTempFile tmpDir "reanimate.exe" $ \tmpExecutable handle -> do-    hClose handle-    sendTextData conn (T.pack "Compiling")-    ret <- runCmd_ "stack" $ ["ghc", "--"] ++ ghcOptions tmpDir ++ [takeFileName self, "-o", tmpExecutable]-    case ret of-      Left err ->-        sendTextData conn $ T.pack $ "Error" ++ unlines (drop 3 (lines err))-      Right{} -> do-        getFrame <- runCmdLazy tmpExecutable ["once", "+RTS", "-N", "-M1G", "-RTS"]-        (frameCount,_) <- expectFrame =<< getFrame-        sendTextData conn (T.pack $ show frameCount)-        fix $ \loop -> do-          (frameIdx, frame) <- expectFrame =<< getFrame-          sendTextData conn (T.pack $ show frameIdx)-          sendTextData conn frame-          loop-  where-    expectFrame (Left "") = do-      sendTextData conn (T.pack "Done")-      exitWith ExitSuccess-    expectFrame (Left err) = do-      sendTextData conn $ T.pack $ "Error" ++ err-      exitWith (ExitFailure 1)-    expectFrame (Right frame) =-      case T.decimal frame of-        Left err -> do-          hPutStrLn stderr (T.unpack frame)-          hPutStrLn stderr $ "expectFrame: " ++ err-          sendTextData conn $ T.pack $ "Error" ++ err-          exitWith (ExitFailure 1)-        Right (frameNumber, rest) -> pure (frameNumber, rest)+presetHeight :: Preset -> Height+presetHeight Youtube    = 1440+presetHeight ExampleGif = 180+presetHeight Quick      = 180 -watchFile watch file action = watchDir watch (takeDirectory file) check (const action)-  where-    check event = takeFileName (eventPath event) == takeFileName file+formatFPS :: Format -> FPS+formatFPS RenderMp4  = 60+formatFPS RenderGif  = 24+formatFPS RenderWebm = 60 -ghcOptions :: FilePath -> [String]-ghcOptions tmpDir =-    ["-rtsopts", "--make", "-threaded", "-O2"] ++-    ["-odir", tmpDir, "-hidir", tmpDir]+formatWidth :: Format -> Width+formatWidth RenderMp4  = 2560+formatWidth RenderGif  = 320+formatWidth RenderWebm = 2560 --- FIXME: Gracefully disable code reloading if source is missing.-findOwnSource :: IO FilePath-findOwnSource = do-  fullArgs <- getFullArgs-  let stackSource = last fullArgs-  exist <- doesFileExist stackSource-  if exist-    then return stackSource-    else do-      prog <- getProgName-      lst <- listDirectory "."-      mbSelf <- findFile ("." : lst) prog-      case mbSelf of-        Nothing -> do-          hPutStrLn stderr "Failed to find own source code."-          exitFailure-        Just self -> pure self+formatHeight :: Format -> Height+formatHeight RenderMp4  = 1440+formatHeight RenderGif  = 180+formatHeight RenderWebm = 1440 +{-|+Main entry-point for accessing an animation. Creates a program that takes the+following command-line arguments: ------------------------------------------------------------------------------ Check environment+> Usage: PROG [COMMAND]+>   This program contains an animation which can either be viewed in a web-browser+>   or rendered to disk.+>+> Available options:+>   -h,--help                Show this help text+>+> Available commands:+>   check                    Run a system's diagnostic and report any missing+>                            external dependencies.+>   view                     Play animation in browser window.+>   render                   Render animation to file. -checkEnvironment :: IO ()-checkEnvironment = do-    putStrLn "reanimate checks:"-    runCheck "Has ffmpeg" hasFFmpeg-    runCheck "Has LaTeX" hasLaTeX-    runCheck "Has XeLaTeX" hasXeLaTeX-    runCheck "Has dvisvgm" hasDvisvgm-    runCheck "Has povray" hasPovray-    forM_ latexPackages $ \pkg ->-      runCheck ("Has LaTeX package '"++ pkg ++ "'") $ hasTeXPackage "latex" $-        "{"++pkg++"}"-    forM_ xelatexPackages $ \pkg ->-      runCheck ("Has XeLaTeX package '"++ pkg ++ "'") $ hasTeXPackage "xelatex" $-        "{"++pkg++"}"-  where-    latexPackages =-      ["babel"-      ,"amsmath"-      ,"amssymb"-      ,"dsfont"-      ,"setspace"-      ,"relsize"-      ,"textcomp"-      ,"mathrsfs"-      ,"calligra"-      ,"wasysym"-      ,"ragged2e"-      ,"physics"-      ,"xcolor"-      ,"textcomp"-      ,"xfrac"-      ,"microtype"]-    xelatexPackages =-      ["ctex"]-    runCheck msg fn = do-      printf "  %-35s" (msg ++ ":")-      val <- fn-      case val of-        Left err -> print $ Doc.red $ Doc.text err-        Right ok -> print $ Doc.green $ Doc.text ok+Neither the 'check' nor the 'view' command take any additional arguments.+Rendering animation can be controlled with these arguments: --- latex, dvisvgm, xelatex+> Usage: PROG render [-o|--target FILE] [--fps FPS] [-w|--width PIXELS]+>                    [-h|--height PIXELS] [--compile] [--format FMT]+>                    [--preset TYPE]+>   Render animation to file.+>+> Available options:+>   -o,--target FILE         Write output to FILE+>   --fps FPS                Set frames per second.+>   -w,--width PIXELS        Set video width.+>   -h,--height PIXELS       Set video height.+>   --compile                Compile source code before rendering.+>   --format FMT             Video format: mp4, gif, webm+>   --preset TYPE            Parameter presets: youtube, gif, quick+>   -h,--help                Show this help text+-}+reanimate :: Animation -> IO ()+reanimate animation = do+  Options{..} <- getDriverOptions+  case optsCommand of+    Raw        -> renderSvgs animation+    Test       -> do+      -- hSetBinaryMode stdout True+      renderSnippets animation+    Check      -> checkEnvironment+    View       -> serve+    Render{..} -> do+      let fmt = guessParameter renderFormat (fmap presetFormat renderPreset) $+                case renderTarget of+                  -- Format guessed from output+                  Just target -> case takeExtension target of+                    ".mp4"  -> RenderMp4+                    ".gif"  -> RenderGif+                    ".webm" -> RenderWebm+                    _       -> RenderMp4+                  -- Default to mp4 rendering.+                  Nothing -> RenderMp4 -hasLaTeX :: IO (Either String String)-hasLaTeX = hasProgram "latex"+      target <- case renderTarget of+        Nothing -> do+          self <- findOwnSource+          pure $ case fmt of+            RenderMp4  -> replaceExtension self "mp4"+            RenderGif  -> replaceExtension self "gif"+            RenderWebm -> replaceExtension self "webm"+        Just target -> makeAbsolute target -hasXeLaTeX :: IO (Either String String)-hasXeLaTeX = hasProgram "xelatex"+      let fps = guessParameter renderFPS (fmap presetFPS renderPreset) $+                (formatFPS fmt)+          width = guessParameter renderWidth (fmap presetWidth renderPreset) $+                  (formatWidth fmt)+          height = guessParameter renderHeight (fmap presetHeight renderPreset) $+                  (formatHeight fmt) -hasDvisvgm :: IO (Either String String)-hasDvisvgm = hasProgram "dvisvgm"+      if renderCompile+        then+          compile+            ["render"+            ,"--fps", show fps+            ,"--width", show width+            ,"--height", show height+            ,"--format", showFormat fmt+            ,"--target", target+            ,"+RTS", "-N", "-RTS"]+        else do+          printf "Animation options:\n\+                 \  fps:    %d\n\+                 \  width:  %d\n\+                 \  height: %d\n\+                 \  fmt:    %s\n\+                 \  target: %s\n"+            fps width height (showFormat fmt) target+          render animation target fmt width height fps -hasPovray :: IO (Either String String)-hasPovray = hasProgram "povray" -hasFFmpeg :: IO (Either String String)-hasFFmpeg = do-  mbVersion <- ffmpegVersion-  return $ case mbVersion of-    Nothing                   -> Left "no"-    Just vs | vs < minVersion -> Left "too old"-            | otherwise       -> Right (showVersion vs)-  where-    minVersion = Version [4,1,3] []-ffmpegVersion :: IO (Maybe Version)-ffmpegVersion = do-  mbPath <- findExecutable "ffmpeg"-  case mbPath of-    Nothing   -> return Nothing-    Just path -> do-      ret <- runCmd_ path ["-version"]-      case ret of-        Left{} -> return Nothing-        Right out ->-          case map (take 3 . words) $ take 1 $ lines out of-            [["ffmpeg", "version", vs]] ->-              return $ parseVS vs-            _ -> return Nothing-  where-    parseVS vs = listToMaybe-      [ v | (v, "") <- readP_to_S parseVersion vs ] --hasTeXPackage :: FilePath -> String -> IO (Either String String)-hasTeXPackage exec pkg = handle (\(e::SomeException) -> return $ Left "n/a") $-    withSystemTempDirectory "reanimate" $ \tmp_dir -> withTempFile tmp_dir "test.tex" $ \tex_file tex_handle -> do-      hPutStr tex_handle tex_document-      hPutStr tex_handle $ "\\usepackage" ++ pkg ++ "\n"-      hPutStr tex_handle "\\begin{document}\n"-      hPutStr tex_handle "blah\n"-      hPutStr tex_handle tex_epilogue-      hClose tex_handle-      ret <- runCmd_ exec ["-interaction=batchmode", "-halt-on-error", "-output-directory="++tmp_dir, tex_file]-      return $ case ret of-        Right{} -> Right "OK"-        Left{}  -> Left "missing"-  where-    tex_document = "\\documentclass[preview]{standalone}\n"-    tex_xelatex =-      "\\usepackage[UTF8]{ctex}\n"--    tex_prologue =-      "\\usepackage[english]{babel}\n\-      \\\usepackage{amsmath}\n\-      \\\usepackage{amssymb}\n\-      \\\usepackage{dsfont}\n\-      \\\usepackage{setspace}\n\-      \\\usepackage{relsize}\n\-      \\\usepackage{textcomp}\n\-      \\\usepackage{mathrsfs}\n\-      \\\usepackage{calligra}\n\-      \\\usepackage{wasysym}\n\-      \\\usepackage{ragged2e}\n\-      \\\usepackage{physics}\n\-      \\\usepackage{xcolor}\n\-      \\\usepackage{textcomp}\n\-      \\\usepackage{xfrac}\n\-      \\\usepackage{microtype}\n\-      \\\linespread{1}\n\-      \\\begin{document}\n"--    tex_epilogue =-      "\n\-      \\\end{document}"--hasProgram :: String -> IO (Either String String)-hasProgram exec = do-  mbPath <- findExecutable exec-  return $ case mbPath of-    Nothing   -> Left $ "'" ++ exec ++ "'' not found"-    Just path -> Right path+guessParameter :: Maybe a -> Maybe a -> a -> a+guessParameter a b def = fromMaybe def (a `mplus` b)
+ src/Reanimate/Driver/CLI.hs view
@@ -0,0 +1,150 @@+{-# LANGUAGE RecordWildCards #-}+module Reanimate.Driver.CLI+  ( getDriverOptions+  , Options(..)+  , Command(..)+  , Preset(..)+  , Format(..)+  , showFormat+  ) where++import           Data.Char+import           Data.Monoid         ((<>))+import           Options.Applicative+import           Reanimate.Render    (Format (..), Width, Height, FPS)++data Options = Options+  { optsCommand :: Command+  } deriving (Show)++data Command+  = Raw+  | Test+  | Check+  | View+  | Render+    { renderTarget  :: Maybe String+    , renderFPS     :: Maybe FPS+    , renderWidth   :: Maybe Width+    , renderHeight  :: Maybe Height+    , renderCompile :: Bool+    , renderFormat  :: Maybe Format+    , renderPreset  :: Maybe Preset+    }+   deriving (Show)++data Preset = Youtube | ExampleGif | Quick+  deriving (Show)++readFormat :: String -> Maybe Format+readFormat fmt =+  case map toLower fmt of+    "mp4"  -> Just RenderMp4+    "gif"  -> Just RenderGif+    "webm" -> Just RenderWebm+    _      -> Nothing++showFormat :: Format -> String+showFormat RenderMp4  = "mp4"+showFormat RenderGif  = "gif"+showFormat RenderWebm = "webm"++readPreset :: String -> Maybe Preset+readPreset preset =+  case map toLower preset of+    "youtube" -> Just Youtube+    "gif"     -> Just ExampleGif+    "quick"   -> Just Quick+    _         -> Nothing++showPreset :: Preset -> String+showPreset Youtube    = "youtube"+showPreset ExampleGif = "gif"+showPreset Quick      = "quick"++options :: Parser Options+options = Options <$> commandP++commandP :: Parser Command+commandP = subparser(command "raw" rawCommand+  <> command "test" testCommand+  <> commandGroup "Internal commands"+  <> internal )+  <|> hsubparser+    ( command "check" checkCommand+    <> command "view" viewCommand+    <> command "render" renderCommand+    )+  <|> infoParser viewCommand++rawCommand :: ParserInfo Command+rawCommand = info (parse)+    (progDesc "Output raw SVGs for animation at 60 fps. Used internally by viewer.")+  where+    parse = pure Raw++testCommand :: ParserInfo Command+testCommand = info (parse <**> helper)+    (progDesc "Generate 50 frames spread out evenly across the animation. Used \+              \internally by the test-suite.")+  where+    parse = pure Test++checkCommand :: ParserInfo Command+checkCommand = info (parse)+    (progDesc "Run a system's diagnostic and report any missing external dependencies.")+  where+    parse = pure Check++viewCommand :: ParserInfo Command+viewCommand = info (parse)+    (progDesc "Play animation in browser window.")+  where+    parse = pure View++renderCommand :: ParserInfo Command+renderCommand = info (parse)+    (progDesc "Render animation to file.")+  where+    -- fromPreset :: (Maybe Preset -> (Command -> Command))+    -- fromPreset Nothing = id+    -- fromPreset (Just ExampleGif) = \cmd -> cmd{renderFPS=24}+    -- modParser :: Parser (Command -> Command)+    -- modParser = fmap fromPreset $+    --   optional (option (maybeReader readPreset)+    --       (long "preset" <> showDefaultWith showPreset+    --       <> metavar "TYPE"+    --       <> help "Parameter presets: youtube, gif, quick"))+    parse = Render+      <$> optional (strOption (long "target"+                    <> short 'o'+                    <> metavar "FILE"+                    <> help "Write output to FILE"))+      <*> optional (option auto+          (long "fps" <> metavar "FPS"+          <> help "Set frames per second."))+      <*> optional (option auto+          (long "width" <> short 'w' <> metavar "PIXELS"+          <> help "Set video width."))+      <*> optional (option auto+          (long "height" <> short 'h'+          <> metavar "PIXELS" <> help "Set video height."))+      <*> switch (long "compile"+                  <> help "Compile source code before rendering.")+      <*> optional (option (maybeReader readFormat)+          (long "format" <> metavar "FMT"+          <> help "Video format: mp4, gif, webm"))+      <*> optional (option (maybeReader readPreset)+          (long "preset" <> showDefaultWith showPreset+          <> metavar "TYPE"+          <> help "Parameter presets: youtube, gif, quick"))++opts :: ParserInfo Options+opts = info (options <**> helper )+  ( fullDesc+  <> progDesc "This program contains an animation which can either be viewed \+              \in a web-browser or rendered to disk."+  )++getDriverOptions :: IO Options+getDriverOptions = customExecParser (prefs showHelpOnError) opts
+ src/Reanimate/Driver/Check.hs view
@@ -0,0 +1,132 @@+{-# LANGUAGE ScopedTypeVariables #-}+module Reanimate.Driver.Check+  ( checkEnvironment+  ) where++import           Control.Exception            (SomeException, handle)+import           Control.Monad+import           Data.Maybe+import           Data.Version+import           Reanimate.Misc               (runCmd_)+import           System.Directory             (findExecutable)+import           System.IO+import           System.IO.Temp+import           Text.ParserCombinators.ReadP+import qualified Text.PrettyPrint.ANSI.Leijen as Doc+import           Text.Printf++--------------------------------------------------------------------------+-- Check environment++checkEnvironment :: IO ()+checkEnvironment = do+    putStrLn "reanimate checks:"+    runCheck "Has ffmpeg" hasFFmpeg+    runCheck "Has LaTeX" hasLaTeX+    runCheck "Has XeLaTeX" hasXeLaTeX+    runCheck "Has dvisvgm" hasDvisvgm+    runCheck "Has povray" hasPovray+    runCheck ("Has LaTeX package '"++ "babel" ++ "'") $ hasTeXPackage "latex" $+      "[english]{babel}"+    forM_ latexPackages $ \pkg ->+      runCheck ("Has LaTeX package '"++ pkg ++ "'") $ hasTeXPackage "latex" $+        "{"++pkg++"}"+    forM_ xelatexPackages $ \pkg ->+      runCheck ("Has XeLaTeX package '"++ pkg ++ "'") $ hasTeXPackage "xelatex" $+        "{"++pkg++"}"+  where+    latexPackages =+      ["preview"+      ,"amsmath"+      ,"amssymb"+      ,"dsfont"+      ,"setspace"+      ,"relsize"+      ,"textcomp"+      ,"mathrsfs"+      ,"calligra"+      ,"wasysym"+      ,"ragged2e"+      ,"physics"+      ,"xcolor"+      ,"textcomp"+      ,"xfrac"+      ,"microtype"]+    xelatexPackages =+      ["ctex"]+    runCheck msg fn = do+      printf "  %-35s" (msg ++ ":")+      val <- fn+      case val of+        Left err -> print $ Doc.red $ Doc.text err+        Right ok -> print $ Doc.green $ Doc.text ok++-- latex, dvisvgm, xelatex++hasLaTeX :: IO (Either String String)+hasLaTeX = hasProgram "latex"++hasXeLaTeX :: IO (Either String String)+hasXeLaTeX = hasProgram "xelatex"++hasDvisvgm :: IO (Either String String)+hasDvisvgm = hasProgram "dvisvgm"++hasPovray :: IO (Either String String)+hasPovray = hasProgram "povray"++hasFFmpeg :: IO (Either String String)+hasFFmpeg = do+  mbVersion <- ffmpegVersion+  return $ case mbVersion of+    Nothing                   -> Left "no"+    Just vs | vs < minVersion -> Left $ "too old: " ++ showVersion vs ++ " < " ++ showVersion minVersion+            | otherwise       -> Right (showVersion vs)+  where+    minVersion = Version [4,1,3] []++ffmpegVersion :: IO (Maybe Version)+ffmpegVersion = do+  mbPath <- findExecutable "ffmpeg"+  case mbPath of+    Nothing   -> return Nothing+    Just path -> do+      ret <- runCmd_ path ["-version"]+      case ret of+        Left{} -> return $ Just noVersion+        Right out ->+          case map (take 3 . words) $ take 1 $ lines out of+            [["ffmpeg", "version", vs]] ->+              return $ Just $ fromMaybe noVersion $ parseVS vs+            _ -> return $ Just noVersion+  where+    noVersion = Version [] []+    parseVS vs = listToMaybe $ reverse+      [ v | (v, _) <- readP_to_S parseVersion vs ]+++hasTeXPackage :: FilePath -> String -> IO (Either String String)+hasTeXPackage exec pkg = handle (\(_::SomeException) -> return $ Left "n/a") $+    withSystemTempDirectory "reanimate" $ \tmp_dir -> withTempFile tmp_dir "test.tex" $ \tex_file tex_handle -> do+      hPutStr tex_handle tex_document+      hPutStr tex_handle $ "\\usepackage" ++ pkg ++ "\n"+      hPutStr tex_handle "\\begin{document}\n"+      hPutStr tex_handle "blah\n"+      hPutStr tex_handle tex_epilogue+      hClose tex_handle+      ret <- runCmd_ exec ["-interaction=batchmode", "-halt-on-error", "-output-directory="++tmp_dir, tex_file]+      return $ case ret of+        Right{} -> Right "OK"+        Left{}  -> Left "missing"+  where+    tex_document = "\\documentclass[preview]{standalone}\n"+    tex_epilogue =+      "\n\+      \\\end{document}"++hasProgram :: String -> IO (Either String String)+hasProgram exec = do+  mbPath <- findExecutable exec+  return $ case mbPath of+    Nothing   -> Left $ "'" ++ exec ++ "'' not found"+    Just path -> Right path
+ src/Reanimate/Driver/Compile.hs view
@@ -0,0 +1,27 @@+module Reanimate.Driver.Compile ( compile ) where++import           Reanimate.Driver.Server (findOwnSource)+import           System.Directory+import           System.Exit+import           System.FilePath+import           System.Process++compile :: [String] -> IO ()+compile opts = do+  self <- findOwnSource+  let selfDir = takeDirectory self+      selfName = takeBaseName self+      outDir = selfDir </> ".reanimate" </> selfName+      target = outDir </> selfName+      ghcOptions =+          ["-rtsopts", "--make", "-threaded", "-O2"] +++          ["-odir", outDir, "-hidir", outDir] +++          [self, "-o", target]+  createDirectoryIfMissing True outDir+  withCurrentDirectory selfDir $ do+    checkExitCode =<< rawSystem "stack" (["ghc", "--"] ++ ghcOptions)+    checkExitCode =<< rawSystem target opts++checkExitCode :: ExitCode -> IO ()+checkExitCode ExitSuccess     = return ()+checkExitCode (ExitFailure n) = exitWith (ExitFailure n)
+ src/Reanimate/Driver/Server.hs view
@@ -0,0 +1,157 @@+{-# LANGUAGE ScopedTypeVariables #-}+module Reanimate.Driver.Server+  ( serve+  , findOwnSource+  ) where++import           Control.Concurrent      (forkIO, killThread, modifyMVar_,+                                          newEmptyMVar, putMVar, takeMVar,+                                          threadDelay)+import           Control.Concurrent.MVar+import           Control.Exception       (SomeException, catch, finally)+import           Control.Monad+import           Control.Monad.Fix       (fix)+import           Data.Text               (Text)+import qualified Data.Text               as T+import qualified Data.Text.Read          as T+import           GHC.Environment         (getFullArgs)+import           Network.WebSockets+import           Paths_reanimate+import           Reanimate.Misc          (runCmdLazy, runCmd_)+import           System.Directory        (doesFileExist, findFile,+                                          listDirectory, makeAbsolute,+                                          withCurrentDirectory)+import           System.Environment      (getProgName)+import           System.Exit+import           System.FilePath+import           System.FSNotify+import           System.IO+import           System.IO.Temp+import           Web.Browser             (openBrowser)++opts :: ConnectionOptions+opts = defaultConnectionOptions+  { connectionCompressionOptions = PermessageDeflateCompression defaultPermessageDeflate }++serve :: IO ()+serve = withManager $ \watch -> do+  hSetBuffering stdin NoBuffering+  self <- findOwnSource+  hasConnectionVar <- newMVar False++  -- There might already browser window open. Wait 2s to see if that window+  -- connects to us. If not, open a new window.+  _ <- forkIO $ do+    threadDelay (2*10^(6::Int))+    hasConn <- readMVar hasConnectionVar+    unless hasConn openViewer++  putStrLn "Listening..."+  runServerWith "127.0.0.1" 9161 opts $ \pending -> do+    putStrLn "New connection received."+    hasConn <- swapMVar hasConnectionVar True+    if hasConn+      then do+        putStrLn "Already connected to browser. Rejecting."+        rejectRequestWith pending defaultRejectRequest+      else do+        conn <- acceptRequest pending+        slave <- newEmptyMVar+        let handler = modifyMVar_ slave $ \tid -> do+              putStrLn "Reloading code..."+              killThread tid+              forkIO $ ignoreErrors $ slaveHandler conn self+            killSlave = do+              tid <- takeMVar slave+              killThread tid+        stop <- watchFile watch self handler+        putMVar slave =<< forkIO (return ())+        let loop = do+              -- FIXME: We don't use fps here.+              _fps <- receiveData conn :: IO T.Text+              handler+              loop+        loop `finally` (swapMVar hasConnectionVar False >> stop >> killSlave)++ignoreErrors :: IO () -> IO ()+ignoreErrors action = action `catch` \(_::SomeException) -> return ()++openViewer :: IO ()+openViewer = do+  url <- getDataFileName "viewer/build/index.html"+  putStrLn "Opening browser..."+  bSucc <- openBrowser url+  if bSucc+      then putStrLn "Browser opened."+      else hPutStrLn stderr $ "Failed to open browser. Manually visit: " ++ url++slaveHandler :: Connection -> FilePath -> IO ()+slaveHandler conn self =+  withCurrentDirectory (takeDirectory self) $+  withSystemTempDirectory "reanimate" $ \tmpDir ->+  withTempFile tmpDir "reanimate.exe" $ \tmpExecutable handle -> do+    hClose handle+    sendTextData conn (T.pack "Compiling")+    ret <- runCmd_ "stack" $ ["ghc", "--"] ++ ghcOptions tmpDir ++ [takeFileName self, "-o", tmpExecutable]+    case ret of+      Left err ->+        sendTextData conn $ T.pack $ "Error" ++ unlines (drop 3 (lines err))+      Right{} -> runCmdLazy tmpExecutable execOpts $ \getFrame -> do+        (frameCount,_) <- expectFrame =<< getFrame+        sendTextData conn (T.pack $ show frameCount)+        fix $ \loop -> do+          (frameIdx, frame) <- expectFrame =<< getFrame+          sendTextData conn (T.pack $ show frameIdx)+          sendTextData conn frame+          loop+  where+    execOpts = ["raw", "+RTS", "-N", "-M1G", "-RTS"]+    expectFrame :: Either String Text -> IO (Integer, Text)+    expectFrame (Left "") = do+      sendTextData conn (T.pack "Done")+      exitWith ExitSuccess+    expectFrame (Left err) = do+      sendTextData conn $ T.pack $ "Error" ++ err+      exitWith (ExitFailure 1)+    expectFrame (Right frame) =+      case T.decimal frame of+        Left err -> do+          hPutStrLn stderr (T.unpack frame)+          hPutStrLn stderr $ "expectFrame: " ++ err+          sendTextData conn $ T.pack $ "Error" ++ err+          exitWith (ExitFailure 1)+        Right (frameNumber, rest) -> pure (frameNumber, rest)++watchFile :: WatchManager -> FilePath -> IO () -> IO StopListening+watchFile watch file action = watchTree watch (takeDirectory file) check (const action)+  where+    check event =+      takeFileName (eventPath event) == takeFileName file ||+      takeExtension (eventPath event) `elem` sourceExtensions ||+      takeExtension (eventPath event) `elem` dataExtensions+    sourceExtensions = [".hs", ".lhs"]+    dataExtensions = [".jpg", ".png", ".bmp", ".pov", ".tex", ".csv"]++ghcOptions :: FilePath -> [String]+ghcOptions tmpDir =+    ["-rtsopts", "--make", "-threaded", "-O2"] +++    ["-odir", tmpDir, "-hidir", tmpDir]++-- FIXME: Move to a different module+-- FIXME: Gracefully disable code reloading if source is missing.+findOwnSource :: IO FilePath+findOwnSource = do+  fullArgs <- getFullArgs+  stackSource <- makeAbsolute (last fullArgs)+  exist <- doesFileExist stackSource+  if exist+    then return stackSource+    else do+      prog <- getProgName+      lst <- listDirectory "."+      mbSelf <- findFile ("." : lst) prog+      case mbSelf of+        Nothing -> do+          hPutStrLn stderr "Failed to find own source code."+          exitFailure+        Just self -> pure self
+ src/Reanimate/Effect.hs view
@@ -0,0 +1,50 @@+module Reanimate.Effect where++import           Graphics.SvgTree    (Tree)+import           Reanimate.Animation+import           Reanimate.Svg++type Effect = Double -> Double -> Tree -> Tree++overBeginning :: Double -> Effect -> Effect+overBeginning maxT fn = \_d t ->+  if t < maxT+    then fn maxT t+    else id++overEnding :: Double -> Effect -> Effect+overEnding minT fn d t =+  if t >= blankDur+    then fn minT (t-blankDur)+    else id+  where+    blankDur = d-minT++reverseE :: Effect -> Effect+reverseE fn = \d t -> fn d (d-t)++delayE :: Double -> Effect -> Effect+delayE delayT fn = \d t -> overEnding (d-delayT) fn d t++applyE :: Effect -> Animation -> Animation+applyE fn (Animation d genFrame) = Animation d $ \t -> fn d (d*t) $ genFrame t++constE :: (Tree -> Tree) -> Effect+constE fn _d _t = fn++fadeInE :: Effect+fadeInE d t = withGroupOpacity (t/d)++fadeOutE :: Effect+fadeOutE = reverseE fadeInE++drawInE :: Effect+drawInE d t = withFillOpacity 0 . partialSvg (t/d) . pathify++drawOutE :: Effect+drawOutE = reverseE drawInE++fillInE :: Effect+fillInE d t = withFillOpacity f+  where+    f = t/d
src/Reanimate/Examples.hs view
@@ -7,33 +7,23 @@ {-# LANGUAGE TypeFamilies          #-} module Reanimate.Examples where -import           Codec.Picture.Types+{- import           Control.Lens                  ()-import           Control.Monad import qualified Data.Map                      as M-import           Data.Text                     (Text, pack)-import           Graphics.SvgTree              as S+import           Graphics.SvgTree              as S hiding (circle, width) import           Linear.V2-import           Numeric-import           Text.Printf  import           Reanimate.Combinators import           Reanimate.Diagrams import           Reanimate.LaTeX import           Reanimate.Monad-import           Reanimate.Svg import           Reanimate.Signal+import           Reanimate.Svg -import qualified Data.Colour.Palette.BrewerSet as D-import qualified Diagrams.Backend.SVG          as D-import           Diagrams.Prelude              hiding (Animation, boundingBox,-                                                center, circle, duration,-                                                fontSize, rotate, scale,-                                                translate)+import           Diagrams.Prelude              (deg, turn, withEnvelope, (@@)) import qualified Diagrams.Prelude              as D import qualified Diagrams.TwoD.Path.LSystem    as D--import           Debug.Trace+-}  {- sinewave :: Ani ()@@ -490,7 +480,7 @@     svg = scale 10 $ center $ latex "\\LaTeX" -} -+{- morph_wave :: Animation morph_wave = autoReverse $ mkAnimation 2.5 $ do     morph <- getSignal signalLinear@@ -570,3 +560,4 @@     tree s =       D.lSystem gens (s/16 @@ turn) (D.symbols "F") rules     rules = M.fromList [D.rule 'F' "FF-[->F+F+>F]+[+>F->F->F]"]+-}
src/Reanimate/Interpolate.hs view
@@ -4,7 +4,7 @@ import Codec.Picture
 import Data.Colour
 import Data.Colour.CIE
-import Data.Colour.CIE.Illuminant
+import Data.Colour.CIE.Illuminant (d65)
 import Data.Colour.SRGB
 import Data.Colour.RGBSpace.HSV
 import Data.Colour.RGBSpace
@@ -49,7 +49,7 @@           c = sqrt (a*a + b*b)
           h :: Double
           h = (toDeg(atan2 b a) + 360) `mod'` 360
-          isZero = round (c*10000) == 0
+          isZero = round (c*10000) == (0::Integer)
       in (l, c, if isZero then 0/0 else h)
     pack l c h =
       cieLAB d65 l (cos (toRad h) * c) (sin (toRad h) * c)
src/Reanimate/LaTeX.hs view
@@ -2,27 +2,18 @@ {-# LANGUAGE ScopedTypeVariables #-} module Reanimate.LaTeX (latex,xelatex,latexAlign) where -import           Control.Exception     (SomeException, handle)-import qualified Data.ByteString       as B-import           Data.IORef-import           Data.Map              (Map)-import qualified Data.Map              as Map-import Data.Monoid+import           Control.Exception (SomeException, handle)+import qualified Data.ByteString   as B+import           Data.Monoid ((<>))+import           Data.Text         (Text)+import qualified Data.Text         as T+import qualified Data.Text.IO      as T+import           Graphics.SvgTree  (Tree (..), defaultSvg, parseSvgFile) import           Reanimate.Cache import           Reanimate.Misc import           Reanimate.Svg-import           System.FilePath       (replaceExtension, takeFileName, (</>))-import           System.IO.Unsafe      (unsafePerformIO)--import           Control.Lens          (over, set, (%~), (&), (.~), (^.))-import           Data.Text             (Text)-import qualified Data.Text             as T-import qualified Data.Text.IO             as T-import           Graphics.SvgTree      (Document (..), Tree (..), defaultSvg,-                                        elements, loadSvgFile, parseSvgFile,-                                        xmlOfDocument)-import           Text.XML.Light        (elContent)-import           Text.XML.Light.Output (ppcContent, ppcElement, prettyConfigPP)+import           System.FilePath   (replaceExtension, takeFileName, (</>))+import           System.IO.Unsafe  (unsafePerformIO)  latex :: T.Text -> Tree latex tex = (unsafePerformIO . (cacheMem . cacheDiskSvg) latexToSVG)@@ -35,10 +26,12 @@ latexAlign :: Text -> Tree latexAlign tex = latex $ T.unlines ["\\begin{align*}", tex, "\\end{align*}"] +postprocess :: Tree -> Tree+postprocess = lowerTransformations . scaleXY 1 (-1) . scale 0.1 . pathify  latexToSVG :: Text -> IO Tree-latexToSVG tex = handle (\(e::SomeException) -> return (failedSvg tex)) $ do-  latex <- requireExecutable "latex"+latexToSVG tex = handle (\(_::SomeException) -> return (failedSvg tex)) $ do+  latexBin <- requireExecutable "latex"   dvisvgm <- requireExecutable "dvisvgm"   withTempDir $ \tmp_dir -> withTempFile "tex" $ \tex_file -> withTempFile "svg" $ \svg_file -> do     let dvi_file = tmp_dir </> replaceExtension (takeFileName tex_file) "dvi"@@ -46,8 +39,8 @@     appendFile tex_file tex_prologue     T.appendFile tex_file tex     appendFile tex_file tex_epilogue-    runCmd latex ["-interaction=batchmode", "-halt-on-error", "-output-directory="++tmp_dir, tex_file]-    runCmd dvisvgm [ dvi_file+    runCmd latexBin ["-interaction=batchmode", "-halt-on-error", "-output-directory="++tmp_dir, tex_file]+    runCmd dvisvgm [ dvi_file, "--precision=5"                    , "--exact"    -- better bboxes.                    -- , "--bbox=1,1" -- increase bbox size.                    , "--no-fonts" -- use glyphs instead of fonts.@@ -55,11 +48,11 @@     svg_data <- B.readFile svg_file     case parseSvgFile svg_file svg_data of       Nothing  -> error "Malformed svg"-      Just svg -> return $ unbox $ replaceUses svg+      Just svg -> return $ postprocess $ unbox $ replaceUses svg  xelatexToSVG :: Text -> IO Tree-xelatexToSVG tex = handle (\(e::SomeException) -> return (failedSvg tex)) $ do-  latex <- requireExecutable "xelatex"+xelatexToSVG tex = handle (\(_::SomeException) -> return (failedSvg tex)) $ do+  xetexBin <- requireExecutable "xelatex"   dvisvgm <- requireExecutable "dvisvgm"   withTempDir $ \tmp_dir -> withTempFile "tex" $ \tex_file -> withTempFile "svg" $ \svg_file -> do     let dvi_file = tmp_dir </> replaceExtension (takeFileName tex_file) "xdv"@@ -68,7 +61,7 @@     appendFile tex_file tex_prologue     T.appendFile tex_file tex     appendFile tex_file tex_epilogue-    runCmd latex ["-no-pdf", "-interaction=batchmode", "-halt-on-error", "-output-directory="++tmp_dir, tex_file]+    runCmd xetexBin ["-no-pdf", "-interaction=batchmode", "-halt-on-error", "-output-directory="++tmp_dir, tex_file]     runCmd dvisvgm [ dvi_file                    , "--exact"    -- better bboxes.                    -- , "--bbox=1,1" -- increase bbox size.@@ -77,16 +70,21 @@     svg_data <- B.readFile svg_file     case parseSvgFile svg_file svg_data of       Nothing  -> error "Malformed svg"-      Just svg -> return $ unbox $ replaceUses svg+      Just svg -> return $ postprocess $ unbox $ replaceUses svg  failedSvg :: Text -> Tree-failedSvg tex = defaultSvg+failedSvg _tex = defaultSvg   -- text_ [ font_size_ "20"   --       , fill_ "white"] (toHtml $ "bad latex: "++tex) +tex_document :: String tex_document = "\\documentclass[preview]{standalone}\n"++tex_xelatex :: String tex_xelatex =   "\\usepackage[UTF8]{ctex}\n"++tex_prologue :: String tex_prologue =   "\\usepackage[english]{babel}\n\   \\\usepackage{amsmath}\n\@@ -107,6 +105,7 @@   \\\linespread{1}\n\   \\\begin{document}\n" +tex_epilogue :: String tex_epilogue =   "\n\   \\\end{document}"
src/Reanimate/Memo.hs view
@@ -1,73 +1,71 @@-{-# LANGUAGE RankNTypes, ExistentialQuantification, BangPatterns #-}
-module Reanimate.Memo
-  ( Key(..)
-  , memo
-  ) where
-
-import Control.Monad.ST
-import Data.STRef
-import System.Mem.StableName
-import Debug.Trace
-import System.IO.Unsafe
-import Control.Monad.ST.Unsafe
-import Data.IORef
-import qualified Data.Map as Map
-import Data.Dynamic
-import Data.Typeable
-import Data.Maybe
-
-data DynamicName = forall a. DynamicName !(StableName a) | forall a. (Eq a, Ord a, Typeable a) => DynamicKey a
-instance Eq DynamicName where
-  DynamicName a == DynamicName b = eqStableName a b
-  DynamicKey a == DynamicKey b =
-    case cast a of
-      Nothing -> False
-      Just a' -> a'==b
-  _ == _ = False
-
-instance Ord DynamicName where
-  DynamicName a `compare` DynamicName b =
-    hashStableName a `compare` hashStableName b
-  DynamicName{} `compare` _ = LT
-  DynamicKey a `compare` DynamicKey b =
-    case cast a of
-      Nothing -> typeOf a `compare` typeOf b
-      Just a' -> a' `compare` b
-  _ `compare` _ = GT
-
-data CacheMap = CacheMap !(Map.Map DynamicName CacheMap) !(Map.Map DynamicName Dynamic)
-
-emptyCacheMap :: CacheMap
-emptyCacheMap = CacheMap Map.empty Map.empty
-
-cacheMapLookup :: [DynamicName] -> CacheMap -> Maybe Dynamic
-cacheMapLookup [] _ = Nothing
-cacheMapLookup [k] (CacheMap _ vals) = Map.lookup k vals
-cacheMapLookup (k:ks) (CacheMap sub _) =
-  cacheMapLookup ks =<< Map.lookup k sub
-
-cacheMapInsert :: [DynamicName] -> Dynamic -> CacheMap -> CacheMap
-cacheMapInsert [] _ m = m
-cacheMapInsert [k] v (CacheMap sub vals) = CacheMap sub (Map.insert k v vals)
-cacheMapInsert (k:ks) v (CacheMap sub vals) =
-  CacheMap (Map.alter fn k sub) vals
-  where
-    fn = Just . cacheMapInsert ks v . fromMaybe emptyCacheMap
-
-{-# NOINLINE cacheMap #-}
-cacheMap :: IORef CacheMap
-cacheMap = unsafePerformIO (newIORef emptyCacheMap)
-
-data Key = forall a. Key !a | forall a. (Typeable a, Eq a, Ord a) => KeyPrim !a
-
-fromKey :: Key -> IO DynamicName
-fromKey (Key val) = DynamicName <$> makeStableName val
-fromKey (KeyPrim val) = pure (DynamicKey val)
-
-memo :: Typeable a => [Key] -> a -> a
-memo !k v = unsafePerformIO $ do
-  keys <- mapM fromKey k
-  atomicModifyIORef' cacheMap $ \m ->
-    case fromDynamic =<< cacheMapLookup keys m of
-      Just v' -> (m, v')
-      Nothing -> (cacheMapInsert keys (toDyn v) m, v)
+{-# LANGUAGE BangPatterns              #-}+{-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE RankNTypes                #-}+module Reanimate.Memo+  ( Key(..)+  , memo+  ) where++import           Data.Dynamic+import           Data.IORef+import qualified Data.Map                as Map+import           Data.Maybe+import           Data.Typeable+import           System.IO.Unsafe+import           System.Mem.StableName++data DynamicName = forall a. DynamicName !(StableName a) | forall a. (Eq a, Ord a, Typeable a) => DynamicKey a+instance Eq DynamicName where+  DynamicName a == DynamicName b = eqStableName a b+  DynamicKey a == DynamicKey b =+    case cast a of+      Nothing -> False+      Just a' -> a'==b+  _ == _ = False++instance Ord DynamicName where+  DynamicName a `compare` DynamicName b =+    hashStableName a `compare` hashStableName b+  DynamicName{} `compare` _ = LT+  DynamicKey a `compare` DynamicKey b =+    case cast a of+      Nothing -> typeOf a `compare` typeOf b+      Just a' -> a' `compare` b+  _ `compare` _ = GT++data CacheMap = CacheMap !(Map.Map DynamicName CacheMap) !(Map.Map DynamicName Dynamic)++emptyCacheMap :: CacheMap+emptyCacheMap = CacheMap Map.empty Map.empty++cacheMapLookup :: [DynamicName] -> CacheMap -> Maybe Dynamic+cacheMapLookup [] _ = Nothing+cacheMapLookup [k] (CacheMap _ vals) = Map.lookup k vals+cacheMapLookup (k:ks) (CacheMap sub _) =+  cacheMapLookup ks =<< Map.lookup k sub++cacheMapInsert :: [DynamicName] -> Dynamic -> CacheMap -> CacheMap+cacheMapInsert [] _ m = m+cacheMapInsert [k] v (CacheMap sub vals) = CacheMap sub (Map.insert k v vals)+cacheMapInsert (k:ks) v (CacheMap sub vals) =+  CacheMap (Map.alter fn k sub) vals+  where+    fn = Just . cacheMapInsert ks v . fromMaybe emptyCacheMap++{-# NOINLINE cacheMap #-}+cacheMap :: IORef CacheMap+cacheMap = unsafePerformIO (newIORef emptyCacheMap)++data Key = forall a. Key !a | forall a. (Typeable a, Eq a, Ord a) => KeyPrim !a++fromKey :: Key -> IO DynamicName+fromKey (Key val)     = DynamicName <$> makeStableName val+fromKey (KeyPrim val) = pure (DynamicKey val)++memo :: Typeable a => [Key] -> a -> a+memo !k v = unsafePerformIO $ do+  keys <- mapM fromKey k+  atomicModifyIORef' cacheMap $ \m ->+    case fromDynamic =<< cacheMapLookup keys m of+      Just v' -> (m, v')+      Nothing -> (cacheMapInsert keys (toDyn v) m, v)
src/Reanimate/Misc.hs view
@@ -7,18 +7,17 @@   , withTempFile   ) where -import           Control.Exception (evaluate, finally, throwIO)+import           Control.Exception (evaluate, finally) import qualified Data.Text         as T import qualified Data.Text.IO      as T import           System.Directory  (createDirectory, findExecutable,-                                    getTemporaryDirectory,-                                    removeDirectoryRecursive, removeFile)+                                    getTemporaryDirectory, removeFile) import           System.Exit       (ExitCode (..)) import           System.FilePath   ((<.>), (</>))-import           System.IO         (hClose, openTempFile, hGetContents, hIsEOF)+import           System.IO         (hClose, hGetContents, hIsEOF, openTempFile) import           System.Process    (readProcessWithExitCode,                                     runInteractiveProcess, showCommandForUser,-                                    waitForProcess)+                                    terminateProcess, waitForProcess)  requireExecutable :: String -> IO FilePath requireExecutable exec = do@@ -35,7 +34,7 @@ runCmd_ :: FilePath -> [String] -> IO (Either String String) runCmd_ exec args = do   (ret, stdout, stderr) <- readProcessWithExitCode exec args ""-  evaluate (length stdout + length stderr)+  _ <- evaluate (length stdout + length stderr)   case ret of     ExitSuccess -> return (Right stdout)     ExitFailure err -> do@@ -44,27 +43,31 @@         "Error code: " ++ show err ++ "\n" ++         "stderr: " ++ stderr -runCmdLazy :: FilePath -> [String] -> IO (IO (Either String T.Text))-runCmdLazy exec args = do+runCmdLazy :: FilePath -> [String] -> (IO (Either String T.Text) -> IO a) -> IO a+runCmdLazy exec args handler = do   (inp, out, err, pid) <- runInteractiveProcess exec args Nothing Nothing   hClose inp-  return $ do-    eof <- hIsEOF out-    if eof-      then do-        stderr <- hGetContents err-        evaluate (length stderr)-        ret <- waitForProcess pid-        case ret of-          ExitSuccess -> return (Left "")-          ExitFailure err -> do-            return $ Left $-              "Failed to run: " ++ showCommandForUser exec args ++ "\n" ++-              "Error code: " ++ show err ++ "\n" ++-              "stderr: " ++ stderr-      else do-        line <- T.hGetLine out-        return (Right line)+  let fetch = do+        eof <- hIsEOF out+        if eof+          then do+            stderr <- hGetContents err+            _ <- evaluate (length stderr)+            ret <- waitForProcess pid+            case ret of+              ExitSuccess -> return (Left "")+              ExitFailure errMsg -> do+                return $ Left $+                  "Failed to run: " ++ showCommandForUser exec args ++ "\n" +++                  "Error code: " ++ show errMsg ++ "\n" +++                  "stderr: " ++ stderr+          else do+            line <- T.hGetLine out+            return (Right line)+  handler fetch `finally` do+    terminateProcess pid+    _ <- waitForProcess pid+    return ()  withTempDir :: (FilePath -> IO a) -> IO a withTempDir action = do
− src/Reanimate/Monad.hs
@@ -1,159 +0,0 @@-module Reanimate.Monad where--import           Control.Arrow         ()-import qualified Control.Category      as C-import           Control.Monad.State-import           Data.Fixed-import           Data.Fixed            (mod')-import Text.Printf-import qualified Data.Map              as M-import           Data.Monoid           ((<>))-import           Data.Text             (Text, pack)-import           Graphics.SvgTree      (Document (..), Number (..), Text (..),-                                        TextSpan (..), TextSpanContent (..),-                                        Tree, Tree (..), xmlOfDocument, xmlOfTree)-import           Graphics.SvgTree.Printer-import           Reanimate.Svg-import           Reanimate.Signal-import           Text.XML.Light        (elContent)-import           Text.XML.Light.Output--import           Reanimate.Combinators (approxFnData, morphPath)--type Duration = Double-type Time = Double--data Frame a = Frame {unFrame :: Duration -> Time -> State ([Tree] -> [Tree]) a}--instance Functor Frame where-  fmap fn f = Frame $ \d t -> fmap fn (unFrame f d t)--instance Applicative Frame where-  pure a = Frame $ \_ _ -> pure a-  fn <*> fa = Frame $ \d t -> do-    fn <- unFrame fn d t-    a <- unFrame fa d t-    pure (fn a)--instance Monad Frame where-  return a = Frame $ \_ _ -> pure a-  f >>= g = Frame $ \d t -> do-    a <- unFrame f d t-    unFrame (g a) d t---- End behavior:---   Freeze at last frame---   Loop---   Disappear-data Animation = Animation Duration (Frame ())--mkAnimation :: Duration -> Frame () -> Animation-mkAnimation = Animation--duration :: Animation -> Duration-duration (Animation d _) = d--emit :: Tree -> Frame ()-emit svg = Frame $ \_ _ -> modify (.(svg:))--before :: Animation -> Animation -> Animation-before (Animation d1 (Frame f1)) (Animation d2 (Frame f2)) =-  Animation (d1+d2) (Frame $ \_ t -> if t < d1 then f1 d1 t else f2 d2 (t-d1))---- Play two animation concurrently. Shortest animation freezes on last frame.-sim :: Animation -> Animation -> Animation-sim (Animation d1 (Frame f1)) (Animation d2 (Frame f2)) =-  Animation (max d1 d2) $ Frame $ \d t -> do-    f1 d1 (min d1 t)-    f2 d2 (min d2 t)---- Play two animation concurrently. Shortest animation loops.-simLoop :: Animation -> Animation -> Animation-simLoop (Animation d1 (Frame f1)) (Animation d2 (Frame f2)) =-  Animation (max d1 d2) $ Frame $ \d t -> do-    f1 d1 (t `mod'` d1)-    f2 d2 (t `mod'` d2)---- Play two animation concurrently. Animations disappear after playing once.-simDrop :: Animation -> Animation -> Animation-simDrop (Animation d1 (Frame f1)) (Animation d2 (Frame f2)) =-  Animation (max d1 d2) $ Frame $ \d t -> do-    when (t < d1) (f1 d1 t)-    when (t < d2) (f2 d2 t)--pause :: Double -> Animation-pause d = Animation d (pure ())--andThen :: Animation -> Animation -> Animation-andThen a b = a `sim` (pause (duration a) `before` b)--getSignal :: Signal -> Frame Double-getSignal s = Frame $ \d t -> pure $ s (t/d)--frameAt :: Double -> Animation -> Tree-frameAt t (Animation d (Frame f)) = mkGroup $ execState (f d (min d t)) id []--renderTree :: Tree -> String-renderTree t = maybe "" ppElement $ xmlOfTree t--renderSvg :: Maybe Number -> Maybe Number -> Tree -> String-renderSvg w h t = ppDocument doc--- renderSvg w h t = ppFastElement (xmlOfDocument doc)-  where-    width = 320-    height = width / (16/9)-    doc = Document-      { _viewBox = Just (-width/2, -height/2, width, height)-      , _width = w-      , _height = h-      , _elements = [t]-      , _definitions = M.empty-      , _description = ""-      , _documentLocation = ""-      }--mapA :: (Tree -> Tree) -> Animation -> Animation-mapA fn (Animation d f) = Animation d (mapF fn f)--mapF :: (Tree -> Tree) -> Frame a -> Frame a-mapF fn frame = Frame $ \d t -> do-  case runState (unFrame frame d t) id of-    (a, children) -> modify (. (fn (mkGroup (children [])):)) >> pure a--pauseAtEnd :: Double -> Animation -> Animation-pauseAtEnd p a = a `andThen` pause p--pauseAtBeginning :: Double -> Animation -> Animation-pauseAtBeginning d1 a =-    Animation d1 (freezeFrame 0 a) `before` a--pauseAround :: Double -> Double -> Animation -> Animation-pauseAround start end = pauseAtEnd end . pauseAtBeginning start--freezeFrame :: Double -> Animation -> Frame ()-freezeFrame t (Animation d f) = Frame $ \_ _ -> unFrame f d t--adjustSpeed :: Double -> Animation -> Animation-adjustSpeed factor (Animation d fn) =-  Animation (d/factor) $ Frame $ \_dur t -> unFrame fn d (t*factor)--setDuration :: Double -> Animation -> Animation-setDuration newD (Animation d fn) =-  Animation newD $ Frame $ \dur t -> unFrame fn dur t--reverseAnimation :: Animation -> Animation-reverseAnimation (Animation d fn) = Animation d $ Frame $ \_dur t ->-  unFrame fn d (d-t)--autoReverse :: Animation -> Animation-autoReverse a = a `before` reverseAnimation a--oscillate :: Frame a -> Frame a-oscillate f = Frame $ \d t -> do-  if t < d/2-    then unFrame f d (t*2)-    else unFrame f d (d*2-t*2)--repeatAnimation :: Double -> Animation -> Animation-repeatAnimation n (Animation d f) = Animation (d*n) $ Frame $ \_ t ->-  unFrame f d (t `mod'` d)
− src/Reanimate/Morph.hs
@@ -1,384 +0,0 @@-{-# LANGUAGE ParallelListComp #-}-module Reanimate.Morph where--import           Control.Lens-import           Control.Monad.State-import           Linear.Metric-import           Linear.V2-import Data.List-import Data.Ord-import           Linear.Vector-import qualified Geom2D.CubicBezier          as Bezier-import           Graphics.SvgTree--import Reanimate.Svg-import Reanimate.Monad-import Reanimate.LaTeX--import Debug.Trace--{--alignCommands :: [LineCommand] -> [LineCommand] -> ([LineCommand], [LineCommand])-alignCommands a b =-    (worker (glyphs [] a) (glyphs [] b)-    ,worker (glyphs [] b) (glyphs [] a))-  where-    glyphs acc [] = [reverse acc]-    glyphs [] (LineMove p:cs) = glyphs [LineMove p] cs-    glyphs acc (LineMove p:cs) = reverse acc : glyphs [LineMove p] cs-    glyphs acc (c:cs) = glyphs (c:acc) cs--    worker :: [[LineCommand]] -> [[LineCommand]] -> [LineCommand]-    worker [] [] = []-    worker xs [] = concat xs-    worker [] ((LineMove p:ps):xs) = LineMove p : [LineBezier [p,p,p] | _ <- ps]-    worker (x:xs) (y:ys) = align x y ++ worker xs ys--    align :: [LineCommand] -> [LineCommand] -> [LineCommand]-    align x y = addControlPoints (length y - length x) x--addControlPoints :: Int -> [LineCommand] -> [LineCommand]-addControlPoints n cmds | n <= 0 = cmds-addControlPoints n cmds = evalState (worker 0 cmds) zero-  where-    worker d [] = pure []-    worker d (cmd:xs) = do-      from <- get-      len <- lineLength cmd-      if d+len > pointDistance-        then do-          put from-          let newLen = pointDistance-d-              (cmdBefore, cmdAfter) = splitLineLength (newLen / len) from cmd-          _ <- lineLength cmdBefore-          (cmdBefore:) <$> worker 0 (cmdAfter : xs)-        else (cmd:) <$> worker (d+len) xs-    totalLen = evalState (sum <$> mapM lineLength cmds) zero-    pointDistance = totalLen / fromIntegral (n+1)--splitLineLength :: Double -> RPoint -> LineCommand -> (LineCommand, LineCommand)-splitLineLength alpha from cmd =-  case cmd of-    LineBezier points ->-      (LineBezier $ drop 1 $ partial_bezier_points (from:points) 0 alpha-      ,LineBezier $ drop 1 $ partial_bezier_points (from:points) alpha 1)-    LineMove p -> (LineMove p, LineMove p)-    LineEnd -> (LineEnd, LineEnd)--}-interpolateLineCommands :: Double -> [LineCommand] -> [LineCommand] -> [LineCommand]-interpolateLineCommands alpha x y = map worker (zip x y)-  where-    worker (LineMove p1, LineMove p2) = LineMove (lerp alpha p1 p2)-    worker (LineBezier ps1, LineBezier ps2) =-      LineBezier [lerp alpha x y | (x,y) <- merge ps1 ps2]-    worker (LineEnd, LineEnd) = LineEnd-    worker (x,y) = error (show (x,y))-    merge [] [] = []-    merge [x] [y] = [(x,y)]-    merge (x:xs) [y] = (x,y) : merge xs [y]-    merge [x] (y:ys) = (x,y) : merge [x] ys-    merge (x:xs) (y:ys) = (x,y) : merge xs ys---boxCommands :: [LineCommand]-boxCommands = toLineCommands $ extractPath $ center $ mkPathString-  "M10,5 v-5 h-10 v10 h10 z M5,8 h-3 v-6 h6 v6 z"--squareCommands :: [LineCommand]-squareCommands = toLineCommands $ extractPath $ center $ scale 4 $ mkPathString-  "M10,5 v-5 h-10 v10 h10 z"--oCommands :: [LineCommand]-oCommands = toLineCommands $ extractPath $ center $ scale 10 $ mkPathString-  "M4.692403,-2.132005 C4.692403,-3.407223 3.696139,-4.463263 2.49066,-4.463263 C1.24533,-4.463263 0.278954,-3.377335 0.278954,-2.132005 C0.278954,-0.846824 1.315068,0.109589 2.480697,0.109589 C3.686177,0.109589 4.692403,-0.86675 4.692403,-2.132005 L4.692403,-2.132005 z\-  \M2.49066,-0.139477 C2.062267,-0.139477 1.62391,-0.348692 1.354919,-0.806974 C1.105853,-1.24533 1.105853,-1.853051 1.105853,-2.211706 C1.105853,-2.600249 1.105853,-3.138232 1.344956,-3.576588 C1.613948,-4.034869 2.082192,-4.244085 2.480697,-4.244085 C2.919054,-4.244085 3.347447,-4.024907 3.606476,-3.596513 S3.865504,-2.590286 3.865504,-2.211706 C3.865504,-1.853051 3.865504,-1.315068 3.646326,-0.876712 C3.427148,-0.428394 2.988792,-0.139477 2.49066,-0.139477 L2.49066,-0.139477 z"--innerOCommands :: [LineCommand]-innerOCommands = toLineCommands $ extractPath $ center $ scale 10 $ mkPathString-  "M2.49066,-0.139477 C2.062267,-0.139477 1.62391,-0.348692 1.354919,-0.806974 C1.105853,-1.24533 1.105853,-1.853051 1.105853,-2.211706 C1.105853,-2.600249 1.105853,-3.138232 1.344956,-3.576588 C1.613948,-4.034869 2.082192,-4.244085 2.480697,-4.244085 C2.919054,-4.244085 3.347447,-4.024907 3.606476,-3.596513 S3.865504,-2.590286 3.865504,-2.211706 C3.865504,-1.853051 3.865504,-1.315068 3.646326,-0.876712 C3.427148,-0.428394 2.988792,-0.139477 2.49066,-0.139477 L2.49066,-0.139477 z"--{--A figure consists of a set of objects.-Each object is either a string or a loop.-Each object has a non-negative integer rank.--Strings can be reversed.-Loops can be reversed and shifted left/right.--}---- Invariant: End point is the same as starting point-data Loop = Loop RPoint [[RPoint]]-  deriving (Show, Eq)--loopStart :: Loop -> RPoint-loopStart (Loop start _) = start--shiftRight :: Loop -> Loop-shiftRight (Loop start (x:xs)) = Loop (last x) (xs ++ [x])--reverseLoop :: Loop -> Loop-reverseLoop (Loop start ps) = Loop start (drop 1 $ worker [] (reverse $ map reverse ps))-  where-    worker rest [s:cs] = (rest++[s]) : [cs ++ [start]]-    worker rest ((s:cs):xs) = (rest ++ [s]) : worker cs xs--loopToCommands :: Loop -> [LineCommand]-loopToCommands (Loop start curves) =-  LineMove start :-  [ LineBezier bs | bs <- curves ] ++-  [LineEnd]--commandsToLoops :: [LineCommand] -> [Loop]-commandsToLoops (LineMove start : xs) = map simplifyLoop $ worker start [] xs-  where-    worker start acc [] = [Loop start (reverse acc)]-    worker start acc (LineMove newStart : xs) =-      Loop start (reverse acc) : worker newStart [] xs-    worker start acc (LineBezier cs : xs) =-      worker start (cs:acc) xs-    worker start acc (LineEnd : xs) =-      worker start acc xs--simplifyLoop :: Loop -> Loop-simplifyLoop (Loop start cs) = Loop start (worker start cs)-  where-    worker from ([x]:xs)-      | from == x = worker from xs-    worker from (curves:cs) =-      curves : worker (last curves) cs-    worker from [] = []--loopLength :: Loop -> Double-loopLength (Loop start curves) = worker start curves-  where-    worker :: RPoint -> [[RPoint]] -> Double-    worker from [] = 0-    worker from (bezier:cs) =-      Bezier.arcLength (mkBezier from bezier) 1 tolerance + worker (last bezier) cs--    tolerance = 0.1--mkBezier :: RPoint -> [RPoint] -> Bezier.CubicBezier Double-mkBezier a cs = case cs of-    [b]   -> Bezier.CubicBezier (mkPoint a) (mkPoint b) (mkPoint b) (mkPoint b)-    [b,c] -> Bezier.quadToCubic (Bezier.QuadBezier (mkPoint a) (mkPoint b) (mkPoint c))-    [b,c,d]   -> Bezier.CubicBezier (mkPoint a) (mkPoint b) (mkPoint c) (mkPoint d)-  where-    mkPoint (V2 a1 a2) = Bezier.Point a1 a2--fromBezier :: Bezier.CubicBezier Double -> [RPoint]-fromBezier (Bezier.CubicBezier _ b c d) =-    [fromPoint b,fromPoint c,fromPoint d]-  where-    fromPoint (Bezier.Point x y) = V2 x y--loopCtrlPoints :: Loop -> [Double]-loopCtrlPoints (Loop start curves) = worker start 0 curves-  where-    worker from d [] = []-    worker from d (bezier:cs) =-      let d' = d + Bezier.arcLength (mkBezier from bezier) 1 0.1 in-      d' / totalLen : worker (last bezier) d' cs-    totalLen = loopLength (Loop start curves)--addCtrlPoints :: Loop -> [Double] -> Loop-addCtrlPoints (Loop start cs) ctrlPoints = Loop start (worker start 0 cs ctrlPoints)-  where-    totalLen = loopLength (Loop start cs)-    worker from d [] _ = []-    worker from d cs [] = cs-    worker from d (curves:cs) (p:ps) =-      let bezier = mkBezier from curves-          len = Bezier.arcLength bezier 1 0.1 in-      if d+len > p*totalLen-        then-          let newLen = p*totalLen - d-              param = Bezier.arcLengthParam bezier newLen 0.1-              (before,after) = Bezier.splitBezier bezier param-              beforeLst = fromBezier before-          in beforeLst : worker (last beforeLst) (d+newLen) (fromBezier after : cs) ps-        else curves: worker (last curves) (d+len) cs (p:ps)--setLoopStart :: Loop -> Double -> Loop-setLoopStart loop newStart =-    worker (loopCtrlPoints loop') loop'-  where-    loop' = addCtrlPoints loop [newStart]-    worker [] l = l-    worker (x:xs) l-      | x < newStart = worker xs (shiftRight l)-      | otherwise = l---closestPoint :: Loop -> RPoint -> (RPoint, Double)-closestPoint (Loop start cs) p = worker start 0 0 start cs-  where-    pPoint = mkPoint p-    mkPoint (V2 a1 a2) = Bezier.Point a1 a2-    fromPoint (Bezier.Point x y) = V2 x y-    worker :: RPoint -> Double -> Double -> RPoint -> [[RPoint]] -> (RPoint, Double)-    worker point at pos _ [] = (point, at / loopLength (Loop start cs))-    worker point at pos from (curves:cs) =-      let bezier = mkBezier from curves-          c = Bezier.closest bezier pPoint 0.1-          len = Bezier.arcLength bezier c 0.1-          totalLen = Bezier.arcLength bezier 1 0.1-          newPoint = fromPoint $ Bezier.evalBezier bezier c-      in if distance newPoint p < distance point p-        then worker newPoint (pos+len) (pos+totalLen) (last curves) cs-        else worker point at (pos+totalLen) (last curves) cs--loopDistance :: Loop -> Loop -> Double-loopDistance (Loop s1 c1) (Loop s2 c2) =-    distance s1 s2 + worker c1 c2-  where-    worker [] [] = 0-    worker (c1:cs1) (c2:cs2) =-      distance (last c1) (last c2) +-      worker cs1 cs2-    worker _ _ = error $ "Bad lengths: " ++ show (length c1, length c2)--loopBestAlign :: Loop -> Loop -> (Loop, Loop)-loopBestAlign orig foreign_ =-    if loopDistance orig' foreign'' < loopDistance origRev foreignRev-      then (orig', foreign'')-      else (origRev, foreignRev)-  where-    loopStart (Loop s _) = s-    (_, newStartDist) = closestPoint foreign_ (loopStart orig)-    foreign' = setLoopStart foreign_ newStartDist-    foreign'' = addCtrlPoints foreign' (init $ loopCtrlPoints orig)-    foreignRev = addCtrlPoints (reverseLoop foreign') (init $ loopCtrlPoints orig)-    orig' = addCtrlPoints orig (init $ loopCtrlPoints foreign')-    origRev = addCtrlPoints orig (init $ loopCtrlPoints (reverseLoop foreign'))--loopContains :: Loop -> Loop -> Bool-loopContains a (Loop b _) =-  odd (length $ loopIntersections a b)--loopIntersections_ :: Loop -> Loop -> [RPoint]-loopIntersections_ l1 (Loop start _) = loopIntersections l1 start--loopIntersections :: Loop -> RPoint -> [RPoint]-loopIntersections (Loop start cs) point = worker start cs-  where-    V2 pointX pointY = point-    mkPoint (V2 a1 a2) = Bezier.Point a1 a2-    fromPoint (Bezier.Point x y) = V2 x y-    farPoint = (Bezier.Point 1000 pointY) -- FIXME-    -- line = Bezier.Line (mkPoint point) farPoint-    lineBezier = Bezier.CubicBezier (mkPoint point) farPoint farPoint farPoint-    worker from [] = []-    worker from (curves : cs) =-      let bezier = mkBezier from curves-          -- inter = Bezier.bezierLineIntersections bezier line 0-          inter = map fst $ Bezier.bezierIntersection bezier lineBezier 0.00001-          pts = [ V2 x y | V2 x y <- map (fromPoint . Bezier.evalBezier bezier) inter ]-      in pts ++ worker (last curves) cs--data LoopTree = LoopBranch Loop LoopForest-  deriving (Show, Eq)-type LoopForest = [LoopTree]--singleton :: Loop -> LoopTree-singleton l = LoopBranch l []--insertTree :: LoopForest -> Loop -> LoopForest-insertTree [] l = [singleton l]-insertTree (LoopBranch b sub:xs) l-  | loopContains b l = LoopBranch b (insertTree sub l) : xs-  | loopContains l b = LoopBranch l [singleton b] : xs-  | otherwise        = LoopBranch b sub : insertTree xs l--forestFromList :: [Loop] -> LoopForest-forestFromList = foldl insertTree []--zeroLoop :: Loop -> Loop-zeroLoop (Loop start cs) = Loop start (map worker cs)-  where-    worker _bezier = [start]--zeroLoopAt :: Loop -> Maybe RPoint -> Loop-zeroLoopAt (Loop start cs) Nothing = Loop center (map (const [center]) cs)-  where-    center = loopCenter (Loop start cs)-zeroLoopAt (Loop _ cs) (Just start) = Loop start (map (const [start]) cs)--pairLoopForests :: LoopForest -> LoopForest -> [(Loop, Loop)]-pairLoopForests [] [] = []-pairLoopForests [] (LoopBranch b bSub:bs) =-    (zeroLoop b, b) : pairLoopForests [] bSub ++ pairLoopForests [] bs-pairLoopForests (LoopBranch a aSub:as) [] =-    (a, zeroLoop a) : pairLoopForests aSub [] ++ pairLoopForests as []-pairLoopForests (LoopBranch self selfSub:xs) bs =-    let (a, b, sub, rest) = findMatch self bs-    in (a,b) : pairLoopForests selfSub sub ++ pairLoopForests xs rest-  where-    findMatch :: Loop -> LoopForest -> (Loop, Loop, LoopForest, LoopForest)-    findMatch self (t@(LoopBranch l lSub) : xs) =-        let (a,b) = loopBestAlign self l-        in worker a b lSub (delete t bs) xs-      where-        worker a b lSub rest [] = (a,b,lSub, rest)-        worker a b lSub rest (t@(LoopBranch l lSub'): xs) =-          let (a', b') = loopBestAlign self l in-          if loopDistance a b < loopDistance a' b'-            then worker a b lSub rest xs-            else worker a' b' lSub' (delete t bs) xs---- Assume loops are polygons-loopCenter :: Loop -> RPoint-loopCenter (Loop start cs) = V2 cx cy -- start --FIXME-  where-    pts = start : map last cs-    cx = sum [ (x1+x2)*(x1*y2 - x2*y1) | (V2 x1 y1,V2 x2 y2) <- zip pts (tail pts) ] /-          (6 * area)-    cy = sum [ (y1+y2)*(x1*y2 - x2*y1) | (V2 x1 y1,V2 x2 y2) <- zip pts (tail pts) ] /-          (6 * area)-    area = sum [ x1*y2 - x2*y1 | (V2 x1 y1,V2 x2 y2) <- zip pts (tail pts) ] / 2--permPair :: LoopForest -> LoopForest -> [(Loop,Loop)]-permPair a b =-    minimumBy (comparing loopDistances) $-    simplePair Nothing Nothing <$> permutations a <*> permutations b-  where-    loopDistances ls = sum [ loopDistance a b | (a,b) <- ls ]-    simplePair :: Maybe RPoint -> Maybe RPoint -> LoopForest -> LoopForest -> [(Loop,Loop)]-    simplePair srcCenter dstCenter a b =-      case (a,b) of-        ([],[]) -> []-        (LoopBranch x xSub:xs,[]) ->-          (x,zeroLoopAt x dstCenter) :-            simplePair srcCenter dstCenter xSub [] ++-            simplePair srcCenter dstCenter xs []-        ([], LoopBranch x xSub:xs) ->-          (zeroLoopAt x srcCenter,x) :-            simplePair srcCenter dstCenter [] xSub ++-            simplePair srcCenter dstCenter [] xs-        (LoopBranch al aSub:as, LoopBranch bl bSub:bs) ->-          let (aBest, bBest) = loopBestAlign al bl-              srcCenter' = Just $ loopCenter aBest-              dstCenter' = Just $ loopCenter bBest-          in-          (aBest, bBest) : simplePair srcCenter' dstCenter' aSub bSub ++-                           simplePair srcCenter dstCenter as bs--morph :: Tree -> Tree -> (Double -> Tree)-morph a b =-  let aF = forestFromList $ commandsToLoops $ toLineCommands $ extractPath a-      bF = forestFromList $ commandsToLoops $ toLineCommands $ extractPath b-      -- (aLoops, bLoops) = unzip $ pairLoopForests aF bF-      (aLoops, bLoops) = unzip $ permPair aF bF-      aCmds = concatMap loopToCommands aLoops-      bCmds = concatMap loopToCommands bLoops-  in \d -> PathTree $ defaultSvg & pathDefinition .~ lineToPath (interpolateLineCommands (1-d) aCmds bCmds)--annotatePath :: Tree -> Tree-annotatePath = mkGroup . reverse . map worker . toLineCommands . extractPath-  where-    mkCircle (V2 x y) = CircleTree $ defaultSvg-      & circleCenter .~ (Num x, Num y)-      & circleRadius .~ Num 1-    worker (LineMove p) = withFillColor "green" $ mkCircle p-    worker (LineBezier cs) = withFillColor "red" $ mkCircle (last cs)-    worker LineEnd = mkGroup []
+ src/Reanimate/PolyShape.hs view
@@ -0,0 +1,318 @@+module Reanimate.PolyShape+  ( PolyShape(..)+  , PolyShapeWithHoles(..)+  , svgToPolyShapes     -- :: Tree -> [PolyShape]++  , renderPolyShape     -- :: PolyShape -> Tree+  , renderPolyShapes    -- :: [PolyShape] -> Tree+  , renderPolyShapePoints -- :: PolyShape -> Tree++  , plPathCommands      -- :: PolyShape -> [PathCommand]+  , plLineCommands      -- :: PolyShape -> [LineCommand]++  , plLength            -- :: PolyShape -> Double+  , plCurves            -- :: PolyShape -> [CubicBezier Double]+  , isInsideOf          -- :: PolyShape -> PolyShape -> Bool++  , plFromPolygon       -- :: [RPoint] -> PolyShape+  , plPolygonify        -- :: Double -> PolyShape -> [Point Double]+  , plDecompose         -- :: [PolyShape] -> [[RPoint]]+  , unionPolyShapes     -- :: [PolyShape] -> [PolyShape]+  , unionPolyShapes'    -- :: Double -> [PolyShape] -> [PolyShape]+  , plDecompose'        -- :: Double -> [PolyShape] -> [[RPoint]]+  , decomposePolygon    -- :: [Point Double] -> [[RPoint]]+  , plGroupShapes       -- :: [PolyShape] -> [PolyShapeWithHoles]+  , mergePolyShapeHoles -- :: PolyShapeWithHoles -> PolyShape+  , polyShapeTolerance+  ) where++import           Chiphunk.Low+import           Control.Lens        ((&), (.~))+import           Data.List           (nub, partition, sortBy)+import           Data.Ord+import           Debug.Trace+import           Geom2D.CubicBezier  (ClosedPath (..), CubicBezier (..), DPoint,+                                      FillRule (..), PathJoin (..), Point (..),+                                      arcLength, bezierIntersection,+                                      closedPathCurves, closest, colinear,+                                      curvesToClosed, evalBezier, splitBezier,+                                      union, vectorDistance)+import           Graphics.SvgTree    (PathCommand (..), RPoint, Tree (..),+                                      defaultSvg, pathDefinition)+import           Linear.V2+import           Reanimate.Constants+import           Reanimate.Svg++-- | Shape drawn by continuous line. May have overlap, may be convex.+newtype PolyShape = PolyShape { unPolyShape :: ClosedPath Double }+  deriving (Show)++data PolyShapeWithHoles = PolyShapeWithHoles+  { polyShapeParent :: PolyShape+  , polyShapeHoles  :: [PolyShape]+  }+++renderPolyShapes :: [PolyShape] -> Tree+renderPolyShapes pls =+  PathTree $ defaultSvg & pathDefinition .~ concatMap plPathCommands pls++renderPolyShape :: PolyShape -> Tree+renderPolyShape pl =+    PathTree $ defaultSvg & pathDefinition .~ plPathCommands pl++renderPolyShapePoints :: PolyShape -> Tree+renderPolyShapePoints = mkGroup . map renderPoint . plCurves+  where+    renderPoint (CubicBezier (Point x y) _ _ _) =+      translate x y $ mkCircle 0.02++plLength :: PolyShape -> Double+plLength = sum . map cubicLength . plCurves+  where+    cubicLength c = arcLength c 1 polyShapeTolerance++-- 1/10th of a pixel if rendered at 2560x1440+polyShapeTolerance :: Double+polyShapeTolerance = screenWidth/25600++plFromPolygon :: [RPoint] -> PolyShape+plFromPolygon = PolyShape . ClosedPath . map worker+  where+    worker (V2 x y) = (Point x y, JoinLine)++-- | Deconstruct a polyshape into non-intersecting, convex polygons.+plDecompose :: [PolyShape] -> [[RPoint]]+plDecompose = plDecompose' 0.001++-- | Deconstruct a polyshape into non-intersecting, convex polygons.+plDecompose' :: Double -> [PolyShape] -> [[RPoint]]+plDecompose' tol =+  concatMap decomposePolygon .+  map (plPolygonify tol) .+  map mergePolyShapeHoles .+  plGroupShapes .+  unionPolyShapes++decomposePolygon :: [Point Double] -> [[RPoint]]+decomposePolygon poly =+  map (map fromVect . adjust) $ convexDecomposition (map toVect poly) tol+  where+    tol = polyShapeTolerance+    toVect (Point x y) = Vect x y+    fromVect (Vect x y) = V2 x y+    adjust [] = []+    adjust x = if head x == last x then adjust (init x) else x++plPolygonify :: Double -> PolyShape -> [Point Double]+plPolygonify tol shape =+    startPoint (head curves) : concatMap worker curves+  where+    curves = plCurves shape+    worker c | endPoint c == startPoint c =+      [] -- error $ "Bad bezier: " ++ show c+    worker c =+      if colinear c tol+        then [endPoint c]+        else+          let (lhs,rhs) = splitBezier c 0.5+          in worker lhs ++ worker rhs+    endPoint (CubicBezier _ _ _ d) = d+    startPoint (CubicBezier a _ _ _) = a+++plPathCommands :: PolyShape -> [PathCommand]+plPathCommands = lineToPath . plLineCommands++plLineCommands :: PolyShape -> [LineCommand]+plLineCommands pl =+  case curves of+    []                  -> []+    (CubicBezier start _ _ _:_) ->+      LineMove (toRPoint start) :+      zipWith worker (drop 1 dstList ++ [start]) joinList +++      [LineEnd (toRPoint start)]+  where+    ClosedPath closedPath = unPolyShape pl+    (dstList, joinList) = unzip closedPath+    curves = plCurves pl+    worker dst JoinLine =+      LineBezier [toRPoint dst]+    worker dst (JoinCurve a b) =+      LineBezier $ map toRPoint [a,b,dst]+    toRPoint :: Point Double -> RPoint+    toRPoint (Point x y) = V2 x y++svgToPolyShapes :: Tree -> [PolyShape]+svgToPolyShapes = cmdsToPolyShapes . toLineCommands . extractPath++cmdsToPolyShapes :: [LineCommand] -> [PolyShape]+cmdsToPolyShapes [] = []+cmdsToPolyShapes cmds =+    case cmds of+      (LineMove dst:cont) -> map PolyShape $ worker dst [] cont+      _                   -> bad+  where+    bad = error $ "Reanimate.PolyShape: Invalid commands: " ++ show cmds+    finalize [] rest  = rest+    finalize acc rest = (ClosedPath $ reverse acc) : rest+    worker _from acc [] = finalize acc []+    worker _from acc (LineMove newStart : xs) =+      finalize acc $+      worker newStart [] xs+    worker from acc (LineEnd orig:LineMove dst:xs) | from /= orig =+      finalize ((toGPoint from, JoinLine):acc) $+      worker dst [] xs+    worker _from acc (LineEnd{}:LineMove dst:xs) =+      finalize (acc) $+      worker dst [] xs+    worker from acc [LineEnd orig] | from /= orig =+      finalize ((toGPoint from, JoinLine):acc) []+    worker _from acc [LineEnd{}] =+      finalize (acc) []+    worker from acc (LineBezier [x]:xs) =+      worker x ((toGPoint from, JoinLine) : acc) xs+    worker from acc (LineBezier [a,b,c]:xs) =+      worker c ((toGPoint from, JoinCurve (toGPoint a) (toGPoint b)) : acc) xs+    worker _ _ _ = bad++    toGPoint :: RPoint -> Point Double+    toGPoint (V2 x y) = Point x y++unionPolyShapes :: [PolyShape] -> [PolyShape]+unionPolyShapes shapes =+    map PolyShape $+    union (map unPolyShape shapes) NonZero (polyShapeTolerance/10000)++unionPolyShapes' :: Double -> [PolyShape] -> [PolyShape]+unionPolyShapes' tol shapes =+    map PolyShape $+    union (map unPolyShape shapes) NonZero tol++-- True iff lhs is inside of rhs.+-- lhs and rhs may not overlap.+-- Implementation: Trace a vertical line through the origin of A and check+-- of this line intersects and odd number of times on both sides of A.+isInsideOf :: PolyShape -> PolyShape -> Bool+lhs `isInsideOf` rhs =+    odd (length upHits) && odd (length downHits)+  where+    (upHits, downHits) = polyIntersections origin rhs+    origin = polyShapeOrigin lhs++polyIntersections :: DPoint -> PolyShape -> ([DPoint],[DPoint])+polyIntersections origin rhs =+    (nub $ concatMap (intersections rayUp) curves+    ,nub $ concatMap (intersections rayDown) curves)+  where+    curves = plCurves rhs++    intersections line bs =+      map (evalBezier bs . fst) (bezierIntersection bs line polyShapeTolerance)+    limit = 1000+    rayUp = CubicBezier origin origin origin (Point limit limit)+    rayDown = CubicBezier origin origin origin (Point (-limit) (-limit))++polyShapeOrigin :: PolyShape -> Point Double+polyShapeOrigin (PolyShape closedPath) =+  case closedPath of+    ClosedPath []            -> Point 0 0+    ClosedPath ((start,_):_) -> start++plGroupShapes :: [PolyShape] -> [PolyShapeWithHoles]+plGroupShapes = worker+  where+    worker (s:rest)+      | null (parents s rest) =+        let isOnlyChild x = parents x (s:rest) == [s]+            (holes, nonHoles) = partition isOnlyChild rest+            prime = PolyShapeWithHoles+              { polyShapeParent = s+              , polyShapeHoles  = holes }+        in prime : worker nonHoles+      | otherwise = trace ("Found hole, putting back") $ worker (rest ++ [s])+    worker [] = []++    parents :: PolyShape -> [PolyShape] -> [PolyShape]+    parents self = filter (self `isInsideOf`) . filter (/=self)++instance Eq PolyShape where+  a == b = plCurves a == plCurves b++mergePolyShapeHoles :: PolyShapeWithHoles -> PolyShape+mergePolyShapeHoles (PolyShapeWithHoles parent []) = parent+mergePolyShapeHoles (PolyShapeWithHoles parent (child:children)) =+  mergePolyShapeHoles $+    PolyShapeWithHoles (mergePolyShapeHole parent child) children++-- Merge+mergePolyShapeHole :: PolyShape -> PolyShape -> PolyShape+mergePolyShapeHole parent child =+  snd $ head $+  sortBy (comparing fst)+  [ cutSingleHole newParent child+  | newParent <- polyShapePermutations parent ]++{-+parent:+  (a,b)+  (b,c)+  (c,a)++child:+  (x,y)+  (y,z)+  (z,x)++P = split (a,b)+new:+  (P,b) p2b+  (b,c) pTail+  (c,a) pTail+  (a,P) a2p++  (P,x) p2x++  (x,y) childCurves+  (y,z) childCurves+  (z,x) childCurves++  (x,P) x2p++-}+cutSingleHole :: PolyShape -> PolyShape -> (Double, PolyShape)+cutSingleHole parent child =+    (score, PolyShape $ curvesToClosed $+      p2b:pTail ++ [a2p] +++      [p2x] ++ childCurves +++      [x2p]+    )+  where+    score = vectorDistance childOrigin p+    childOrigin = polyShapeOrigin child+    (pHead:pTail) = plCurves parent+    childCurves = plCurves child++    pParam = closest pHead childOrigin polyShapeTolerance++    (a2p, p2b) = splitBezier pHead pParam++    p = evalBezier pHead pParam+    -- straight line to child origin+    p2x = lineBetween p childOrigin+    -- straight line from child origin+    x2p = lineBetween childOrigin p++    lineBetween a b = CubicBezier a a a b++plCurves :: PolyShape -> [CubicBezier Double]+plCurves = closedPathCurves . unPolyShape++polyShapePermutations :: PolyShape -> [PolyShape]+polyShapePermutations =+    map (PolyShape . curvesToClosed) . cycleList . plCurves+  where+    cycleList lst =+      let n = length lst in+      [ take n $ drop i $ cycle lst+      | i <- [0.. n-1] ]
src/Reanimate/Povray.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE OverloadedStrings   #-}-{-# LANGUAGE ScopedTypeVariables #-} module Reanimate.Povray   ( povray   , povrayQuick@@ -7,33 +6,18 @@   ) where  import           Codec.Picture.Png-import           Control.Exception     (SomeException, handle)-import qualified Data.ByteString       as B-import qualified Data.ByteString.Lazy  as BL-import           Data.IORef-import           Data.Map              (Map)-import qualified Data.Map              as Map-import           Data.Monoid-import           Reanimate.Cache+import qualified Data.ByteString   as B+import           Data.Text         (Text)+import qualified Data.Text         as T+import qualified Data.Text.IO      as T+import           Graphics.SvgTree  (Tree (..)) import           Reanimate.Cache import           Reanimate.Memo import           Reanimate.Misc import           Reanimate.Raster-import           Reanimate.Svg-import           System.IO--import           System.FilePath       (replaceExtension, takeFileName, (</>))-import           System.IO.Unsafe      (unsafePerformIO)--import           Control.Lens          (over, set, (%~), (&), (.~), (^.))-import           Data.Text             (Text)-import qualified Data.Text             as T-import qualified Data.Text.IO          as T-import           Graphics.SvgTree      (Document (..), Tree (..), defaultSvg,-                                        elements, loadSvgFile, parseSvgFile,-                                        xmlOfDocument)-import           Text.XML.Light        (elContent)-import           Text.XML.Light.Output (ppcContent, ppcElement, prettyConfigPP)+import           Reanimate.Svg.Constructors+import           System.FilePath   (replaceExtension)+import           System.IO.Unsafe  (unsafePerformIO)  povrayRaw :: [String] -> Text -> Tree povrayRaw args script =@@ -51,17 +35,17 @@  mkPovrayImage :: [String] -> Text -> IO Tree mkPovrayImage args script = cacheDiskKey key $ do-  povray <- requireExecutable "povray"+  exec <- requireExecutable "povray"   withTempFile "pov" $ \pov_file -> do     let out = replaceExtension pov_file "png"     T.writeFile pov_file script-    ret <- runCmd_ povray (args ++ ["-D","+UA", pov_file, "+o"++out])+    ret <- runCmd_ exec (args ++ ["-D","+UA", pov_file, "+o"++out])     case ret of       Left{} -> error "povray went wrong"       Right{} -> do         png <- B.readFile out         case decodePng png of           Left{}    -> error "bad image"-          Right img -> return $ center $ scaleToSize 320 180 $ embedDynamicImage img+          Right img -> return $ center $ scaleToSize 16 9 $ embedDynamicImage img   where     key = T.concat (script:map T.pack args)
src/Reanimate/Raster.hs view
@@ -1,37 +1,69 @@ module Reanimate.Raster   ( embedImage   , embedDynamicImage+  , embedPng+  , raster   ) where -import Control.Lens-import Codec.Picture-import Codec.Picture.Png-import Codec.Picture.Types+import           Codec.Picture+import           Codec.Picture.Types         (dynamicMap)+import           Control.Lens+import qualified Data.ByteString             as B import qualified Data.ByteString.Base64.Lazy as Base64-import qualified Data.ByteString.Lazy.Char8 as LBS-import Graphics.SvgTree (Tree(..), defaultSvg)-import qualified Graphics.SvgTree as Svg+import qualified Data.ByteString.Lazy.Char8  as LBS+import           Graphics.SvgTree            (Number (..), Tree (..),+                                              defaultSvg)+import qualified Graphics.SvgTree            as Svg+import           Reanimate.Misc+import           Reanimate.Animation+import           System.FilePath+import           System.IO+import           System.IO.Temp+import           System.IO.Unsafe + -- XXX: Use Px instead of Num for width and height? {-# INLINE embedImage #-} embedImage :: PngSavable a => Image a -> Tree-embedImage img =+embedImage img = embedPng width height (encodePng img)+  where+    width  = fromIntegral $ imageWidth img+    height = fromIntegral $ imageHeight img++embedPng :: Double -> Double -> LBS.ByteString -> Tree+embedPng w h png =   ImageTree $ defaultSvg-    & Svg.imageWidth .~ Svg.Num (fromIntegral $ imageWidth img)-    & Svg.imageHeight .~ Svg.Num (fromIntegral $ imageHeight img)+    & Svg.imageWidth .~ Svg.Num w+    & Svg.imageHeight .~ Svg.Num h     & Svg.imageHref .~ ("data:image/png;base64," ++ imgData)   where-    imgData = LBS.unpack $ Base64.encode (encodePng img)+    imgData = LBS.unpack $ Base64.encode png + {-# INLINE embedDynamicImage #-} embedDynamicImage :: DynamicImage -> Tree-embedDynamicImage img =-  ImageTree $ defaultSvg-    & Svg.imageWidth .~ Svg.Num (fromIntegral $ dynamicMap imageWidth img)-    & Svg.imageHeight .~ Svg.Num (fromIntegral $ dynamicMap imageHeight img)-    & Svg.imageHref .~ ("data:image/png;base64," ++ imgData)+embedDynamicImage img = embedPng width height imgData   where+    width   = fromIntegral $ dynamicMap imageWidth img+    height  = fromIntegral $ dynamicMap imageHeight img     imgData =       case encodeDynamicPng img of-        Left err -> error err-        Right dat -> LBS.unpack $ Base64.encode dat+        Left err  -> error err+        Right dat -> dat++raster :: Tree -> DynamicImage+raster svg = unsafePerformIO $+    withSystemTempFile "reanimate.svg" $ \tmpFile handle -> do+      let target = replaceExtension tmpFile "png"+      -- ffmpeg <- requireExecutable "ffmpeg"+      convert <- requireExecutable "convert"+      hPutStr handle $ renderSvg (Just $ Num width) (Just $ Num height) svg+      hClose handle+      runCmd convert [ tmpFile, target ]+      png <- B.readFile target+      case decodePng png of+        Left{}    -> error "bad image"+        Right img -> return img+  where+    width = 2560+    height = width * 9 / 16
src/Reanimate/Render.hs view
@@ -2,25 +2,21 @@   ( render   , renderSvgs   , renderSnippets+  , Format(..)+  , Width, Height, FPS   ) where -import           Control.Monad               (forM_)-import           Control.Parallel.Strategies-import           Control.Concurrent.QSemN import           Control.Concurrent import           Control.Exception-import qualified Data.ByteString.Lazy.Char8  as BS-import qualified Data.Text                   as T-import qualified Data.Text.IO                as T-import           Graphics.SvgTree            (Number (..))-import           Reanimate.Diagrams+import           Control.Monad      (forM_)+import qualified Data.Text          as T+import qualified Data.Text.IO       as T+import           Graphics.SvgTree   (Number (..)) import           Reanimate.Misc-import           Reanimate.Monad-import           System.Directory            (renameFile)-import           System.FilePath             (takeExtension, takeFileName,-                                              (</>))+import           Reanimate.Animation+import           System.FilePath    ((</>)) import           System.IO-import           Text.Printf                 (printf)+import           Text.Printf        (printf)  renderSvgs :: Animation ->  IO () renderSvgs ani = do@@ -32,7 +28,7 @@           now = (duration ani / (fromIntegral frameCount-1)) * fromIntegral nth           frame = frameAt (if frameCount<=1 then 0 else now) ani           svg = renderSvg Nothing Nothing frame-      evaluate (length svg)+      _ <- evaluate (length svg)       withMVar lock $ \_ -> do         putStr (show nth)         T.putStrLn $ T.concat . T.lines . T.pack $ svg@@ -44,55 +40,55 @@ -- XXX: Merge with 'renderSvgs' renderSnippets :: Animation ->  IO () renderSnippets ani = do-    print frameCount     forM_ [0..frameCount-1] $ \nth -> do       let now = (duration ani / (fromIntegral frameCount-1)) * fromIntegral nth-          frame = frameAt (if frameCount<=1 then 0 else now) ani+          frame = frameAt now ani           svg = renderSvg Nothing Nothing frame       putStr (show nth)       T.putStrLn $ T.concat . T.lines . T.pack $ svg   where-    frameCount = 50+    frameCount = 50 :: Integer  frameOrder :: Int -> Int -> [Int] frameOrder fps nFrames = worker [] fps   where-    worker seen 0 = []+    worker _seen 0 = []     worker seen nthFrame =       filterFrameList seen nthFrame nFrames ++       worker (nthFrame : seen) (nthFrame `div` 2)++filterFrameList :: [Int] -> Int -> Int -> [Int] filterFrameList seen nthFrame nFrames =     filter (not.isSeen) $ [0, nthFrame .. nFrames-1]   where     isSeen x = any (\y -> x `mod` y == 0) seen -data Format = RenderMp4 | RenderGif | RenderWebm | RenderBlank--formatFPS :: Format -> Int-formatFPS RenderMp4   = 60-formatFPS RenderGif   = 25-formatFPS RenderWebm  = 30-formatFPS RenderBlank = 60+data Format = RenderMp4 | RenderGif | RenderWebm+  deriving (Show) -render :: Animation -> FilePath -> IO ()-render ani target =-  case takeExtension target of-    ".mp4"  -> renderFormat RenderMp4 ani target-    ".gif"  -> renderFormat RenderGif ani target-    ".webm" -> renderFormat RenderWebm ani target-    ""      -> renderFormat RenderBlank ani target-    ext     -> error $ "Unknown media format: " ++ show ext+type Width = Int+type Height = Int+type FPS = Int -renderFormat :: Format -> Animation -> FilePath -> IO ()-renderFormat format ani target = do-  putStrLn $ "Starting render of animation: " ++ show (round (duration ani)) ++ "s"+render :: Animation+       -> FilePath+       -> Format+       -> Width+       -> Height+       -> FPS+       -> IO ()+render ani target format width height fps = do+  printf "Starting render of animation: %.1f\n" (duration ani)   ffmpeg <- requireExecutable "ffmpeg"-  generateFrames ani 2560 fps $ \template ->+  generateFrames ani width height fps $ \template ->     withTempFile "txt" $ \progress -> writeFile progress "" >>     case format of       RenderMp4 ->         runCmd ffmpeg ["-r", show fps, "-i", template, "-y"                       , "-c:v", "libx264", "-vf", "fps="++show fps+                      , "-preset", "slow"+                      , "-crf", "18"+                      , "-movflags", "+faststart"                       , "-progress", progress                       , "-pix_fmt", "yuv420p", target]       RenderGif -> withTempFile "png" $ \palette -> do@@ -112,18 +108,14 @@                       ,"-progress", progress                       , "-c:v", "libvpx-vp9", "-vf", "fps="++show fps                       , target]-      RenderBlank -> return ()-  where-    fps = formatFPS format  --------------------------------------------------------------------------------- -- Helpers -generateFrames ani width_ rate action = withTempDir $ \tmp -> do-    done <- newMVar 0+generateFrames :: Animation -> Width -> Height -> FPS -> (FilePath -> IO a) -> IO a+generateFrames ani width_ height_ rate action = withTempDir $ \tmp -> do+    done <- newMVar (0::Int)     let frameName nth = tmp </> printf nameTemplate nth-        rendered = [ renderSvg width height $ nthFrame n | n <- frames]-                    `using` parBuffer 16 rdeepseq     concurrentForM_ frames $ \n -> do       writeFile (frameName n) $ renderSvg width height $ nthFrame n       modifyMVar_ done $ \nDone -> do@@ -133,8 +125,8 @@     putStrLn "\n"     action (tmp </> nameTemplate)   where-    width = Just $ Num width_-    height = Just $ Num (width_*(9/16))+    width = Just $ Num $ fromIntegral width_+    height = Just $ Num $ fromIntegral height_     frames = [0..frameCount-1]     nthFrame nth = frameAt (recip (fromIntegral rate) * fromIntegral nth) ani     frameCount = round (duration ani * fromIntegral rate) :: Int
src/Reanimate/Scene.hs view
@@ -1,23 +1,20 @@-{-# LANGUAGE RankNTypes   #-}+{-# LANGUAGE RankNTypes #-} module Reanimate.Scene where +import           Control.Monad.Fix import           Control.Monad.ST-import           Control.Monad.ST.Unsafe-import           Data.IORef-import           Data.Map                (Map)-import qualified Data.Map                as Map-import           Data.STRef-import           Debug.Trace-import           Data.Ord import           Data.List-import           System.IO.Unsafe-import           System.Mem.StableName--import           Reanimate.Monad+import           Data.Ord+import           Debug.Trace+import           Reanimate.Animation+import           Reanimate.Svg.Constructors  data World type ZIndex = Int +(#) :: a -> (a -> b) -> b+o # f = f o+ -- (seq duration, par duration) -- [(Time, Animation, ZIndex)] -- Map Time [(Animation, ZIndex)]@@ -49,20 +46,23 @@     (b, s2, p2, tl2) <- unM (g a) (t+s1)     return (b, s1+s2, max p1 (s1+p2), unionTimeline tl1 tl2) +instance MonadFix (Scene s) where+  mfix fn = M $ \t -> mfix (\v -> let (a,_s,_p,_tl) = v in unM (fn a) t)+ --data Frame a = Frame {unFrame :: Duration -> Time -> State ([Tree] -> [Tree]) a} sceneAnimation :: (forall s. Scene s a) -> Animation-sceneAnimation action = Animation (max s p) $ Frame $ \d t ->-  sequence_ $ map snd $ sortBy (comparing fst)-    [ (z, unFrame frameGen dur (t-startT))+sceneAnimation action = Animation (max s p) $ \t ->+  mkGroup $ map snd $ sortBy (comparing fst)+    [ (z, frameGen (t-startT))     | (startT, Animation dur frameGen, z) <- tl-    , startT < t-    , startT+dur > t+    , t >= startT+    , t < startT+dur     ]   where     (_, s, p, tl) = runST (unM action 0)  debug :: String -> Scene s ()-debug msg = M $ \t -> trace msg (return ((), 0, 0, emptyTimeline))+debug msg = M $ \_ -> trace msg (return ((), 0, 0, emptyTimeline))  someaction :: Scene s () someaction = debug "someaction"@@ -95,7 +95,7 @@   wait (max 0 (tNew - now))  wait :: Duration -> Scene s ()-wait d = M $ \t ->+wait d = M $ \_ ->   return ((), d, 0, emptyTimeline)  adjustZ :: (ZIndex -> ZIndex) -> Scene s a -> Scene s a@@ -103,7 +103,7 @@   (a, s, p, tl) <- action t   return (a, s, p, [ (startT, ani, fn z) | (startT, ani, z) <- tl ]) -withSceneDuration :: Scene s a -> Scene s Duration+withSceneDuration :: Scene s () -> Scene s Duration withSceneDuration s = do   t1 <- queryNow   s
src/Reanimate/Signal.hs view
@@ -1,9 +1,20 @@-module Reanimate.Signal where+module Reanimate.Signal+  ( Signal+  , constantS+  , fromToS+  , reverseS+  , curveS+  , bellS+  , oscillateS+  , fromListS+  ) where +-- | Signals are time-varying variables. Signals can be composed using function+--   composition. type Signal = Double -> Double -signalFromList :: [(Double, Signal)] -> Signal-signalFromList fns t = worker 0 fns+fromListS :: [(Double, Signal)] -> Signal+fromListS fns t = worker 0 fns   where     worker _ [] = 0     worker now [(len, fn)] = fn (min 1 ((t-now) / min (1-now) len))@@ -11,25 +22,68 @@       | now+len < t = worker (now+len) rest       | otherwise = fn ((t-now) / len) -signalFlat :: Double -> Signal-signalFlat x = const x--signalLinear :: Signal-signalLinear = id+-- | Constant signal.+--+--   Example:+--+--   > signalA (constantS 0.5) drawProgress+--+--   <<docs/gifs/doc_constantS.gif>>+constantS :: Double -> Signal+constantS x = const x -signalFromTo :: Double -> Double -> Signal -> Signal-signalFromTo from to c t = from + (to-from)*(c t)+-- | Signal with new starting and end values.+--+--   Example:+--+--   > signalA (fromToS 0.8 0.2) drawProgress+--+--   <<docs/gifs/doc_fromToS.gif>>+fromToS :: Double -> Double -> Signal+fromToS from to t = from + (to-from)*t -signalReverse :: Signal -> Signal-signalReverse fn t = fn (1-t)+-- | Reverse signal order.+--+--   Example:+--+--   > signalA reverseS drawProgress+--+--   <<docs/gifs/doc_reverseS.gif>>+reverseS :: Signal+reverseS t = 1-t -signalCurve :: Double -> Signal-signalCurve steepness s =+-- | S-curve signal. Takes a steepness parameter. 2 is a good default.+--+--   Example:+--+--   > signalA (curveS 2) drawProgress+--+--   <<docs/gifs/doc_curveS.gif>>+curveS :: Double -> Signal+curveS steepness s =   if s < 0.5     then 0.5 * (2*s)**steepness     else 1-0.5 * (2 - 2*s)**steepness -signalBell :: Double -> Signal-signalBell steepness s-  | s < 0.5   = signalCurve steepness (s/0.5)-  | otherwise = signalCurve steepness (1-((s-0.5)/0.5))+-- | Oscillate signal.+--+--   Example:+--+--   > signalA oscillateS drawProgress+--+--   <<docs/gifs/doc_oscillateS.gif>>+oscillateS :: Signal+oscillateS t =+  if t < 1/2+    then t*2+    else 2-t*2++-- | Bell-curve signal. Takes a steepness parameter. 2 is a good default.+--+--   Example:+--+--   > signalA (bellS 2) drawProgress+--+--   <<docs/gifs/doc_bellS.gif>>+bellS :: Double -> Signal+bellS steepness = curveS steepness . oscillateS
src/Reanimate/Svg.hs view
@@ -1,385 +1,33 @@ {-# LANGUAGE LambdaCase #-}-module Reanimate.Svg where+module Reanimate.Svg+  ( module Reanimate.Svg+  , module Reanimate.Svg.Constructors+  , module Reanimate.Svg.LineCommand+  , module Reanimate.Svg.BoundingBox+  , module Reanimate.Svg.Unuse+  ) where -import           Codec.Picture               (PixelRGBA8 (..))-import           Codec.Picture.Types         ()-import           Control.Arrow-import           Control.Lens                (over, set, (%~), (&), (.~), (^.))-import           Control.Monad.Fix+import           Control.Lens                 ((%~), (&), (.~), (^.)) import           Control.Monad.State-import           Data.Attoparsec.Text        (parseOnly)-import           Data.List-import qualified Data.Map                    as Map-import           Data.Maybe-import qualified Data.Text                   as T-import qualified Geom2D.CubicBezier          as Bezier-import           Graphics.SvgTree-import           Graphics.SvgTree.PathParser-import           Linear.Metric-import           Linear.V2-import           Linear.Vector-import           Reanimate.Svg.NamedColors-import qualified Reanimate.Transform         as Transform--import           Debug.Trace--defaultDPI :: Dpi-defaultDPI = 96--replaceUses :: Document -> Document-replaceUses doc = doc & elements %~ map (mapTree replace)-                      & definitions .~ Map.empty-  where-    replaceDefinition PathTree{} = None-    replaceDefinition t = t--    replace t@DefinitionTree{} = mapTree replaceDefinition t-    replace (UseTree _ Just{}) = error "replaceUses: subtree in use?"-    replace (UseTree use Nothing) =-      case Map.lookup (use^.useName) idMap of-        Nothing -> error $ "Unknown id: " ++ (use^.useName)-        Just tree ->-          GroupTree $-          defaultSvg & groupChildren .~ [tree]-                     & transform .~ Just [baseToTransformation (use^.useBase)]-    replace x = x-    baseToTransformation (x,y) =-      case (toUserUnit defaultDPI x, toUserUnit defaultDPI y) of-        (Num a, Num b) -> Translate a b-        _              -> TransformUnknown-    docTree = mkGroup (doc^.elements)-    idMap = foldTree updMap Map.empty docTree `Map.union`-            (doc^.definitions)-    updMap m tree =-      case tree^.attrId of-        Nothing  -> m-        Just tid -> Map.insert tid tree m--docIds :: Document -> [String]-docIds doc = Map.keys idMap ++ Map.keys (doc^.definitions)-  where-    docTree = GroupTree $ set groupChildren (doc^.elements) defaultSvg-    idMap = foldTree updMap Map.empty docTree-    updMap m tree =-      case tree^.attrId of-        Nothing  -> m-        Just tid -> Map.insert tid tree m----- Transform out viewbox. defs and CSS rules are discarded.-unbox :: Document -> Tree-unbox doc@Document{_viewBox = Just (minx, minw, _width, _height)} =-  GroupTree $ defaultSvg-          & groupChildren .~ doc^.elements-          & transform .~ Just [Translate (-minx) (-minw)]-unbox doc =-  GroupTree $ defaultSvg-    & groupChildren .~ doc^.elements--type CmdM a = State RPoint a--data LineCommand-  = LineMove RPoint-  -- | LineDraw RPoint-  | LineBezier [RPoint]-  | LineEnd-  deriving (Show)--lineToPath :: [LineCommand] -> [PathCommand]-lineToPath = map worker-  where-    worker (LineMove p)         = MoveTo OriginAbsolute [p]-    -- worker (LineDraw p)         = LineTo OriginAbsolute [p]-    worker (LineBezier [a,b,c]) = CurveTo OriginAbsolute [(a,b,c)]-    worker (LineBezier [a,b])   = QuadraticBezier OriginAbsolute [(a,b)]-    worker (LineBezier [a])     = LineTo OriginAbsolute [a]-    worker LineEnd              = EndPath--lineToPoints :: Int -> [LineCommand] -> [RPoint]-lineToPoints nPoints cmds =-    map lineEnd lineSegments-  where-    lineSegments = [ partialLine (fromIntegral n/ fromIntegral nPoints) cmds | n <- [0 .. nPoints-1] ]-    totalLen = evalState (sum <$> mapM lineLength cmds) zero-    lineEnd [LineBezier bezier] = last bezier-    lineEnd (_:xs) = lineEnd xs-    lineEnd _ = error "invalid line"--partialLine :: Double -> [LineCommand] -> [LineCommand]-partialLine alpha cmds = evalState (worker 0 cmds) zero-  where-    worker d [] = pure []-    worker d (cmd:xs) = do-      from <- get-      len <- lineLength cmd-      let frac = (targetLen-d) / len-      if len == 0 || frac > 1-        then (cmd:) <$> worker (d+len) xs-        else pure [adjustLineLength frac from cmd]-    totalLen = evalState (sum <$> mapM lineLength cmds) zero-    targetLen = totalLen * alpha--adjustLineLength :: Double -> RPoint -> LineCommand -> LineCommand-adjustLineLength alpha from cmd =-  case cmd of-    LineBezier points -> LineBezier $ drop 1 $ partial_bezier_points (from:points) 0 alpha-    LineMove p -> LineMove p-    -- LineDraw t -> LineDraw (lerp alpha t from)-    LineEnd -> LineEnd--lineLength :: LineCommand -> CmdM Double-lineLength cmd =-  case cmd of-    LineMove to       -> pure 0 <* put to-    -- LineDraw to       -> gets (distance to) <* put to-    LineBezier points -> gets (distance (last points)) <* put (last points)-    LineEnd           -> pure 0--toLineCommands :: [PathCommand] -> [LineCommand]-toLineCommands ps = evalState (worker zero Nothing ps) zero-  where-    worker startPos mbPrevControlPt [] = pure []-    worker startPos mbPrevControlPt (cmd:cmds) = do-      lcmds <- toLineCommand startPos mbPrevControlPt cmd-      let startPos' =-            case lcmds of-              [LineMove pos] -> pos-              _              -> startPos-      (lcmds++) <$> worker startPos' (cmdToControlPoint $ last lcmds) cmds--cmdToControlPoint (LineBezier points) = Just (last (init points))-cmdToControlPoint _                   = Nothing--mkStraightLine p = LineBezier [p]--toLineCommand :: RPoint -> Maybe RPoint -> PathCommand -> CmdM [LineCommand]-toLineCommand startPos mbPrevControlPt cmd = do-  case cmd of-    MoveTo OriginAbsolute []  -> pure []-    MoveTo OriginAbsolute lst -> put (last lst) *> gets (pure.LineMove)-    MoveTo OriginRelative lst -> modify (+ sum lst) *> gets (pure.LineMove)-    LineTo OriginAbsolute lst -> forM lst (\to -> put to *> pure (mkStraightLine to))-    LineTo OriginRelative lst -> forM lst (\to -> modify (+to) *> gets mkStraightLine)-    HorizontalTo OriginAbsolute lst ->-      forM lst $ \x -> modify (_x .~ x) *> gets mkStraightLine-    HorizontalTo OriginRelative lst ->-      forM lst $ \x -> modify (_x %~ (+x)) *> gets mkStraightLine-    VerticalTo OriginAbsolute lst ->-      forM lst $ \y -> modify (_y .~ y) *> gets mkStraightLine-    VerticalTo OriginRelative lst ->-      forM lst $ \y -> modify (_y %~ (+y)) *> gets mkStraightLine-    CurveTo OriginAbsolute quads -> do-      forM quads $ \(a,b,c) -> put c *> pure (LineBezier [a,b,c])-    CurveTo OriginRelative quads -> do-      forM quads $ \(a,b,c) -> do-        from <- get <* modify (+c)-        pure $ LineBezier $ map (+from) [a,b,c]-    SmoothCurveTo o lst -> mfix $ \result -> do-      let ctrl = mbPrevControlPt : map cmdToControlPoint result-      forM (zip lst ctrl) $ \((c2,to), mbControl) -> do-        from <- get <* adjustPosition o to-        let c1 = maybe (makeAbsolute o from c2) (mirrorPoint from) mbControl-        pure $ LineBezier [c1,makeAbsolute o from c2,makeAbsolute o from to]-    QuadraticBezier OriginAbsolute pairs -> do-      forM pairs $ \(a,b) -> put b *> pure (LineBezier [a,b])-    QuadraticBezier OriginRelative pairs -> do-      forM pairs $ \(a,b) -> do-        from <- get <* modify (+b)-        pure $ LineBezier $ map (+from) [a,b]-    SmoothQuadraticBezierCurveTo o lst -> mfix $ \result -> do-      let ctrl = mbPrevControlPt : map cmdToControlPoint result-      forM (zip lst ctrl) $ \(to, mbControl) -> do-        from <- get <* adjustPosition o to-        let c1 = maybe from (mirrorPoint from) mbControl-        pure $ LineBezier [c1,makeAbsolute o from to]-    EllipticalArc o points -> concat <$>-      (forM points $ \(rotX, rotY, angle, largeArc, sweepFlag, to) -> do-        from <- get <* adjustPosition o to-        return $ convertSvgArc from rotX rotY angle largeArc sweepFlag (makeAbsolute o from to))-    EndPath -> put startPos *> pure [LineBezier [startPos], LineEnd]-  where-    mirrorPoint c p = c*2-p-    adjustPosition OriginRelative p = modify (+p)-    adjustPosition OriginAbsolute p = put p-    makeAbsolute OriginAbsolute from p = p-    makeAbsolute OriginRelative from p = from+p---calculateVectorAngle :: Double -> Double -> Double -> Double -> Double-calculateVectorAngle ux uy vx vy-    | tb >= ta-        = tb - ta-    | otherwise-        = pi * 2 - (ta - tb)-    where-        ta = atan2 uy ux-        tb = atan2 vy vx---- ported from: https://github.com/vvvv/SVG/blob/master/Source/Paths/SvgArcSegment.cs-convertSvgArc :: RPoint -> Coord -> Coord -> Coord -> Bool -> Bool -> RPoint -> [LineCommand]-convertSvgArc (V2 x0 y0) radiusX radiusY angle largeArcFlag sweepFlag (V2 x y)-    | x0 == x && y0 == y-        = []-    | radiusX == 0.0 && radiusY == 0.0-        = [LineBezier [V2 x y]]-    | otherwise-        = calcSegments x0 y0 theta1' segments'-    where-        sinPhi = sin (angle * pi/180)-        cosPhi = cos (angle * pi/180)--        x1dash = cosPhi * (x0 - x) / 2.0 + sinPhi * (y0 - y) / 2.0-        y1dash = -sinPhi * (x0 - x) / 2.0 + cosPhi * (y0 - y) / 2.0--        numerator = radiusX * radiusX * radiusY * radiusY - radiusX * radiusX * y1dash * y1dash - radiusY * radiusY * x1dash * x1dash--        s = sqrt(1.0 - numerator / (radiusX * radiusX * radiusY * radiusY))-        rx   = if (numerator < 0.0) then (radiusX * s) else radiusX-        ry   = if (numerator < 0.0) then (radiusY * s) else radiusY-        root = if (numerator < 0.0)-                then (0.0)-                else ((if ((largeArcFlag && sweepFlag) || (not largeArcFlag && not sweepFlag)) then (-1.0) else 1.0) *-                        sqrt(numerator / (radiusX * radiusX * y1dash * y1dash + radiusY * radiusY * x1dash * x1dash)))--        cxdash = root * rx * y1dash / ry-        cydash = -root * ry * x1dash / rx--        cx = cosPhi * cxdash - sinPhi * cydash + (x0 + x) / 2.0-        cy = sinPhi * cxdash + cosPhi * cydash + (y0 + y) / 2.0--        theta1'  = calculateVectorAngle 1.0 0.0 ((x1dash - cxdash) / rx) ((y1dash - cydash) / ry)-        dtheta' = calculateVectorAngle ((x1dash - cxdash) / rx) ((y1dash - cydash) / ry) ((-x1dash - cxdash) / rx) ((-y1dash - cydash) / ry)-        dtheta  = if (not sweepFlag && dtheta' > 0)-                    then  (dtheta' - 2 * pi)-                    else  (if (sweepFlag && dtheta' < 0) then (dtheta' + 2 * pi) else dtheta')--        segments' = ceiling (abs (dtheta / (pi / 2.0)))-        delta = dtheta / fromInteger segments'-        t = 8.0 / 3.0 * sin(delta / 4.0) * sin(delta / 4.0) / sin(delta / 2.0)--        calcSegments startX startY theta1 segments-            | segments == 0-                = []-            | otherwise-                = LineBezier [ V2 (startX + dx1) (startY + dy1)-                             , V2 (endpointX + dxe) (endpointY + dye)-                             , V2 endpointX endpointY ] : calcSegments endpointX endpointY theta2 (segments - 1)-            where-                cosTheta1 = cos theta1-                sinTheta1 = sin theta1-                theta2 = theta1 + delta-                cosTheta2 = cos theta2-                sinTheta2 = sin theta2--                endpointX = cosPhi * rx * cosTheta2 - sinPhi * ry * sinTheta2 + cx-                endpointY = sinPhi * rx * cosTheta2 + cosPhi * ry * sinTheta2 + cy--                dx1 = t * (-cosPhi * rx * sinTheta1 - sinPhi * ry * cosTheta1)-                dy1 = t * (-sinPhi * rx * sinTheta1 + cosPhi * ry * cosTheta1)--                dxe = t * (cosPhi * rx * sinTheta2 + sinPhi * ry * cosTheta2)-                dye = t * (sinPhi * rx * sinTheta2 - cosPhi * ry * cosTheta2)----- Algorithm taken from manim. It's magic.-bezier :: [RPoint] -> Double -> RPoint-bezier points t = sum-    [ point ^* (((1-t)**(fromIntegral $ n-k)) * (t**fromIntegral k) * fromIntegral (choose n k))-    | (k, point) <- zip [0..] points ]-  where-    n = length points -1-    choose n k = product [n,n-1 .. n-k+1] `div` product [1..k]--partial_bezier_points :: [RPoint] -> Double -> Double -> [RPoint]-partial_bezier_points points a b-  | isNaN end_prop || isInfinite end_prop = replicate (length points) (last points)-  | otherwise = [ bezier (take (i+1) a_to_1) end_prop | i <- [0..length points-1] ]-  where-    a_to_1 = [ bezier (drop i points) a | i <- [0..length points-1] ]-    end_prop = (b-a) / (1-a)----interpolatePathCommands :: Double -> [PathCommand] -> [PathCommand]-interpolatePathCommands alpha = lineToPath . partialLine alpha . toLineCommands--partialSvg :: Double -> Tree -> Tree-partialSvg alpha = mapTree worker-  where-    worker (PathTree path) =-      PathTree $ path & pathDefinition %~ lineToPath . partialLine alpha . toLineCommands-    worker t = t---- (x,y,w,h)-boundingBox :: Tree -> (Double, Double, Double, Double)-boundingBox t =-    case svgBoundingPoints t of-      [] -> (0,0,0,0)-      (V2 x y:rest) ->-        let (minx, miny, maxx, maxy) = foldl' worker (x, y, x, y) rest-        in (minx, miny, maxx-minx, maxy-miny)-  where-    worker (minx, miny, maxx, maxy) (V2 x y) =-      (min minx x, min miny y, max maxx x, max maxy y)--linePoints :: [LineCommand] -> [RPoint]-linePoints = worker zero-  where-    worker from [] = []-    worker from (x:xs) =-      case x of-        LineMove to     -> worker to xs-        -- LineDraw to     -> from:to:worker to xs-        -- FIXME: Use approximation from Geom2D.Bezier-        LineBezier ctrl -> -- approximation-          [ last (partial_bezier_points (from:ctrl) 0 (recip chunks*i)) | i <- [0..chunks]] ++-          worker (last ctrl) xs-        LineEnd -> worker from xs-    chunks = 10--svgBoundingPoints :: Tree -> [RPoint]-svgBoundingPoints t = map (Transform.transformPoint m) $-    case t of-      None            -> []-      UseTree{}       -> []-      GroupTree g     -> concatMap svgBoundingPoints (g^.groupChildren)-      SymbolTree (Symbol g) -> concatMap svgBoundingPoints (g^.groupChildren)-      FilterTree{}    -> []-      DefinitionTree{} -> []-      PathTree p      -> linePoints $ toLineCommands (p^.pathDefinition)-      CircleTree{}    -> error "CircleTree"-      PolyLineTree{}  -> error "PolyLineTree"-      EllipseTree{}   -> error "EllipseTree"-      LineTree line   -> map pointToRPoint [line^.linePoint1, line^.linePoint2]-      RectangleTree rect ->-        case pointToRPoint (rect^.rectUpperLeftCorner) of-          V2 x y -> [V2 x y] ++-            case mapTuple (fmap $ toUserUnit defaultDPI) (rect^.rectWidth, rect^.rectHeight) of-              (Just (Num w), Just (Num h)) -> [V2 (x+w) (y+h)]-              _                            -> []-      TextTree{}      -> []-      ImageTree img   ->-        case (img^.imageCornerUpperLeft, img^.imageWidth, img^.imageHeight) of-          ((Num x, Num y), Num w, Num h) ->-            [V2 x y, V2 (x+w) (y+h)]-          _ -> []-      MeshGradientTree{} -> []-  where-    m = Transform.mkMatrix (t^.transform)-    mapTuple f = f *** f-    pointToRPoint p =-      case mapTuple (toUserUnit defaultDPI) p of-        (Num x, Num y) -> (V2 x y)+import           Graphics.SvgTree             hiding (height, line, path, use,+                                               width)+import           Linear.V2                    hiding (angle)+import           Reanimate.Constants+import           Reanimate.Svg.Constructors+import           Reanimate.Svg.LineCommand+import           Reanimate.Svg.BoundingBox+import           Reanimate.Svg.Unuse+import qualified Reanimate.Transform          as Transform  lowerTransformations :: Tree -> Tree lowerTransformations = worker Transform.identity   where     updLineCmd m cmd =       case cmd of-        LineMove p -> LineMove $ Transform.transformPoint m p+        LineMove p    -> LineMove $ Transform.transformPoint m p         -- LineDraw p -> LineDraw $ Transform.transformPoint m p         LineBezier ps -> LineBezier $ map (Transform.transformPoint m) ps-        LineEnd -> LineEnd+        LineEnd p     -> LineEnd $ Transform.transformPoint m p     updPath m = lineToPath . map (updLineCmd m) . toLineCommands     worker m t =       let m' = m * Transform.mkMatrix (t^.transform) in@@ -390,211 +38,51 @@         GroupTree g -> GroupTree $           g & groupChildren %~ map (worker m')             & transform .~ Nothing-        _ -> t+        _ -> mkGroup [t] & transform .~ Just [ Transform.toTransformation m ]  lowerIds :: Tree -> Tree lowerIds = mapTree worker   where     worker t@GroupTree{} = t & attrId .~ Nothing-    worker t@PathTree{} = t & attrId .~ Nothing-    worker t = t+    worker t@PathTree{}  = t & attrId .~ Nothing+    worker t             = t  simplify :: Tree -> Tree simplify root =   case worker root of-    [] -> None+    []  -> None     [x] -> x-    xs -> mkGroup xs+    xs  -> mkGroup xs   where     worker None = []-    worker (DefinitionTree d)-      | null (d ^. groupChildren) = []-      | otherwise = [DefinitionTree $ d & groupChildren %~ concatMap worker]+    worker (DefinitionTree d) =+      concatMap dropNulls $+      [DefinitionTree $ d & groupChildren %~ concatMap worker]     worker (GroupTree g)-      | g ^. drawAttributes == defaultSvg = concatMap worker (g^.groupChildren)-      | otherwise = [GroupTree $ g & groupChildren %~ concatMap worker]-    worker t = [t]+      | g ^. drawAttributes == defaultSvg =+        concatMap dropNulls $+        concatMap worker (g^.groupChildren)+      | otherwise =+        dropNulls $+        GroupTree $ g & groupChildren %~ concatMap worker+    worker t = dropNulls t +    dropNulls None = []+    dropNulls (DefinitionTree d)+      | null (d^.groupChildren) = []+    dropNulls (GroupTree g)+      | null (g^.groupChildren) = []+    dropNulls t = [t]+ extractPath :: Tree -> [PathCommand] extractPath = worker . simplify . lowerTransformations . pathify   where     worker (GroupTree g) = concatMap worker (g^.groupChildren)-    worker (PathTree p) = p^.pathDefinition-    worker _ = []--withTransformations :: [Transformation] -> Tree -> Tree-withTransformations transformations t =-  mkGroup [t] & transform .~ Just transformations--translate :: Double -> Double -> Tree -> Tree-translate x y = withTransformations [Translate x y]--rotate :: Double -> Tree -> Tree-rotate a = withTransformations [Rotate a Nothing]--rotateAround :: Double -> RPoint -> Tree -> Tree-rotateAround a (V2 x y) = withTransformations [Rotate a (Just (x,y))]--rotateAroundCenter :: Double -> Tree -> Tree-rotateAroundCenter a t =-    rotateAround a (V2 (x+w/h) (y+h/2)) t-  where-    (x,y,w,h) = boundingBox t--scale :: Double -> Tree -> Tree-scale a = withTransformations [Scale a Nothing]--scaleToSize :: Double -> Double -> Tree -> Tree-scaleToSize w h t =-    scaleXY (w/w') (h/h') t-  where-    (_x, _y, w', h') = boundingBox t--scaleXY :: Double -> Double -> Tree -> Tree-scaleXY x y = withTransformations [Scale x (Just y)]---- scalePoints :: Double -> Tree -> Tree--- scalePoints a = scalePointsXY a a------ scalePointsXY :: Double -> Double -> Tree -> Tree--- scalePointsXY x y = mapTree worker---   where---     worker t =---       case t of---         None            -> t---         UseTree{}       -> t---         GroupTree{}     -> t---         SymbolTree{}    -> t---         PathTree p      -> PathTree $ p---           & pathDefinition %~ lineToPath . map scaleCmd . toLineCommands---         CircleTree{}    -> error "scalePointsXY CircleTree"---         PolyLineTree{}  -> error "scalePointsXY PolyLineTree"---         EllipseTree{}   -> error "scalePointsXY EllipseTree"---         LineTree{}      -> error "scalePointsXY LineTree"---         RectangleTree rect -> RectangleTree $ rect---           & rectUpperLeftCorner %~ (mapNumber (*x) *** mapNumber (*y))---           & rectWidth %~ mapNumber (*x)---           & rectHeight %~ mapNumber (*y)---         TextTree{}      -> t---         ImageTree{}     -> t---         MeshGradientTree{} -> t---     scaleCmd (LineMove to) = LineMove (to * V2 x y)---     scaleCmd (LineDraw to) = LineDraw (to * V2 x y)---     scaleCmd (LineBezier points) = LineBezier (map (*V2 x y) points)--center :: Tree -> Tree-center t = translate (-x-w/2) (-y-h/2) t-  where-    (x, y, w, h) = boundingBox t--centerX :: Tree -> Tree-centerX t = translate (-x-w/2) 0 t-  where-    (x, y, w, h) = boundingBox t--centerY :: Tree -> Tree-centerY t = translate 0 (-y-h/2) t-  where-    (x, y, w, h) = boundingBox t--mkColor :: String -> Texture-mkColor name =-  case Map.lookup name svgNamedColors of-    Nothing -> ColorRef (PixelRGBA8 240 248 255 255)-    Just c  -> ColorRef c--withStrokeColor :: String -> Tree -> Tree-withStrokeColor color = strokeColor .~ pure (mkColor color)--withStrokeLineJoin :: LineJoin -> Tree -> Tree-withStrokeLineJoin join = strokeLineJoin .~ pure join--withFillColor :: String -> Tree -> Tree-withFillColor color = fillColor .~ pure (mkColor color)--withFillColorPixel :: PixelRGBA8 -> Tree -> Tree-withFillColorPixel color = fillColor .~ pure (ColorRef color)--withFillOpacity :: Double -> Tree -> Tree-withFillOpacity opacity = fillOpacity .~ Just (realToFrac opacity)--withGroupOpacity :: Double -> Tree -> Tree-withGroupOpacity opacity = groupOpacity .~ Just (realToFrac opacity)--withStrokeWidth :: Number -> Tree -> Tree-withStrokeWidth width = strokeWidth .~ pure width--withClipPathRef :: ElementRef -> Tree -> Tree-withClipPathRef ref = clipPathRef .~ pure ref--withId :: String -> Tree -> Tree-withId idTag = attrId .~ Just idTag--mkRect :: Number -> Number -> Tree-mkRect width height = center $ RectangleTree $ defaultSvg-  & rectUpperLeftCorner .~ (Num 0, Num 0)-  & rectWidth .~ Just width-  & rectHeight .~ Just height--mkCircle :: Number -> Tree-mkCircle radius = CircleTree $ defaultSvg-  & circleCenter .~ (Num 0, Num 0)-  & circleRadius .~ radius---- XXX: This is broken.-mkBoundingRect :: Tree -> Double -> Tree-mkBoundingRect src margin =-    translate (x-margin) (y-margin) $-    mkRect (Num $ w+margin*2) (Num $ h+margin*2)-  where-    (x, y, w, h) = boundingBox src--mkLine :: Point -> Point -> Tree-mkLine point1 point2 = LineTree $ defaultSvg-  & linePoint1 .~ point1-  & linePoint2 .~ point2--mkGroup :: [Tree] -> Tree-mkGroup forest = GroupTree $ defaultSvg-  & groupChildren .~ forest--mkDefinitions :: [Tree] -> Tree-mkDefinitions forest = DefinitionTree $ defaultSvg-  & groupChildren .~ forest--mkUse :: String -> Tree-mkUse name = UseTree (defaultSvg & useName .~ name) Nothing--mkClipPath :: String -> [Tree] -> Tree-mkClipPath idTag forest = withId idTag $ ClipPathTree $ (defaultSvg-  & clipPathContent .~ forest)--mkPathString :: String -> Tree-mkPathString = mkPathText . T.pack--mkPathText :: T.Text -> Tree-mkPathText str =-  case parseOnly pathParser str of-    Left err   -> error err-    Right cmds -> PathTree $ defaultSvg & pathDefinition .~ cmds--mkLinePath :: [(Double, Double)] -> Tree-mkLinePath [] = mkGroup []-mkLinePath ((startX, startY):rest) =-    PathTree $ defaultSvg & pathDefinition .~ cmds-  where-    cmds = [ MoveTo OriginAbsolute [V2 startX startY]-           , LineTo OriginAbsolute [ V2 x y | (x, y) <- rest ] ]--mkBackground :: String -> Tree-mkBackground color = withFillColor color $ mkRect (Num 320) (Num 180)--mkBackgroundPixel :: PixelRGBA8 -> Tree-mkBackgroundPixel pixel =-    withFillColorPixel pixel $ mkRect (Num 320) (Num 180)+    worker (PathTree p)  = p^.pathDefinition+    worker _             = []  withSubglyphs :: [Int] -> (Tree -> Tree) -> Tree -> Tree-withSubglyphs target fn t = evalState (worker t) 0+withSubglyphs target fn = \t -> evalState (worker t) 0   where     worker :: Tree -> State Int Tree     worker t =@@ -611,11 +99,11 @@         RectangleTree{} -> handleGlyph t         _ -> return t     handleGlyph :: Tree -> State Int Tree-    handleGlyph t = do+    handleGlyph svg = do       n <- get <* modify (+1)       if n `elem` target-        then return $ fn t-        else return t+        then return $ fn svg+        else return svg  splitGlyphs :: [Int] -> Tree -> (Tree, Tree) splitGlyphs target = \t ->@@ -632,7 +120,7 @@     worker acc t =       case t of         GroupTree g -> do-          let acc' t = acc (GroupTree $ g & groupChildren .~ [t])+          let acc' sub = acc (GroupTree $ g & groupChildren .~ [sub])           mapM_ (worker acc') (g ^. groupChildren)         PathTree{} -> handleGlyph $ acc t         CircleTree{} -> handleGlyph $ acc t@@ -642,7 +130,7 @@         LineTree{} -> handleGlyph $ acc t         RectangleTree{} -> handleGlyph $ acc t         DefinitionTree{} -> return ()-        t ->+        _ ->           modify $ \(n, l, r) -> (n, acc t:l, r)  
+ src/Reanimate/Svg/BoundingBox.hs view
@@ -0,0 +1,77 @@+{-# LANGUAGE LambdaCase #-}+module Reanimate.Svg.BoundingBox where++import           Control.Arrow+import           Control.Lens                 ((^.))+import           Data.List+import           Graphics.SvgTree             hiding (height, line, path, use,+                                               width)+import           Linear.V2                    hiding (angle)+import           Linear.Vector+import           Reanimate.Constants+import           Reanimate.Svg.LineCommand+import qualified Reanimate.Transform          as Transform+-- import qualified Geom2D.CubicBezier           as Bezier++-- (x,y,w,h)+boundingBox :: Tree -> (Double, Double, Double, Double)+boundingBox t =+    case svgBoundingPoints t of+      [] -> (0,0,0,0)+      (V2 x y:rest) ->+        let (minx, miny, maxx, maxy) = foldl' worker (x, y, x, y) rest+        in (minx, miny, maxx-minx, maxy-miny)+  where+    worker (minx, miny, maxx, maxy) (V2 x y) =+      (min minx x, min miny y, max maxx x, max maxy y)++linePoints :: [LineCommand] -> [RPoint]+linePoints = worker zero+  where+    worker _from [] = []+    worker from (x:xs) =+      case x of+        LineMove to     -> worker to xs+        -- LineDraw to     -> from:to:worker to xs+        -- FIXME: Use approximation from Geom2D.Bezier+        LineBezier ctrl -> -- approximation+          [ last (partial_bezier_points (from:ctrl) 0 (recip chunks*i)) | i <- [0..chunks]] +++          worker (last ctrl) xs+        LineEnd p -> p : worker p xs+    chunks = 10++svgBoundingPoints :: Tree -> [RPoint]+svgBoundingPoints t = map (Transform.transformPoint m) $+    case t of+      None            -> []+      UseTree{}       -> []+      GroupTree g     -> concatMap svgBoundingPoints (g^.groupChildren)+      SymbolTree (Symbol g) -> concatMap svgBoundingPoints (g^.groupChildren)+      FilterTree{}    -> []+      DefinitionTree{} -> []+      PathTree p      -> linePoints $ toLineCommands (p^.pathDefinition)+      CircleTree{}    -> error "Bounding box: CircleTree"+      PolyLineTree{}  -> error "Bounding box: PolyLineTree"+      EllipseTree{}   -> error "Bounding box: EllipseTree"+      LineTree line   -> map pointToRPoint [line^.linePoint1, line^.linePoint2]+      RectangleTree rect ->+        case pointToRPoint (rect^.rectUpperLeftCorner) of+          V2 x y -> [V2 x y] +++            case mapTuple (fmap $ toUserUnit defaultDPI) (rect^.rectWidth, rect^.rectHeight) of+              (Just (Num w), Just (Num h)) -> [V2 (x+w) (y+h)]+              _                            -> []+      TextTree{}      -> []+      ImageTree img   ->+        case (img^.imageCornerUpperLeft, img^.imageWidth, img^.imageHeight) of+          ((Num x, Num y), Num w, Num h) ->+            [V2 x y, V2 (x+w) (y+h)]+          _ -> []+      MeshGradientTree{} -> []+      _ -> []+  where+    m = Transform.mkMatrix (t^.transform)+    mapTuple f = f *** f+    pointToRPoint p =+      case mapTuple (toUserUnit defaultDPI) p of+        (Num x, Num y) -> (V2 x y)+        _ -> error "Reanimate.Svg.svgBoundingPoints: Unrecognized number format."
+ src/Reanimate/Svg/Constructors.hs view
@@ -0,0 +1,173 @@+module Reanimate.Svg.Constructors where++import           Codec.Picture                (PixelRGBA8 (..))+import           Control.Lens                 ((&), (.~))+import           Data.Attoparsec.Text         (parseOnly)+import qualified Data.Map                     as Map+import qualified Data.Text                    as T+import           Graphics.SvgTree             hiding (height, line, path, use,+                                               width)+import           Graphics.SvgTree.NamedColors+import           Graphics.SvgTree.PathParser+import           Linear.V2                    hiding (angle)+import           Reanimate.Constants+import           Reanimate.Svg.BoundingBox++withTransformations :: [Transformation] -> Tree -> Tree+withTransformations transformations t =+  mkGroup [t] & transform .~ Just transformations++translate :: Double -> Double -> Tree -> Tree+translate x y = withTransformations [Translate x y]++rotate :: Double -> Tree -> Tree+rotate a = withTransformations [Rotate a Nothing]++rotateAround :: Double -> RPoint -> Tree -> Tree+rotateAround a (V2 x y) = withTransformations [Rotate a (Just (x,y))]++rotateAroundCenter :: Double -> Tree -> Tree+rotateAroundCenter a t =+    rotateAround a (V2 (x+w/h) (y+h/2)) t+  where+    (x,y,w,h) = boundingBox t++scale :: Double -> Tree -> Tree+scale a = withTransformations [Scale a Nothing]++scaleToSize :: Double -> Double -> Tree -> Tree+scaleToSize w h t =+    scaleXY (w/w') (h/h') t+  where+    (_x, _y, w', h') = boundingBox t++scaleToWidth :: Double -> Tree -> Tree+scaleToWidth w t =+    scale (w/w') t+  where+    (_x, _y, w', _h') = boundingBox t++scaleToHeight :: Double -> Tree -> Tree+scaleToHeight h t =+    scale (h/h') t+  where+    (_x, _y, _w', h') = boundingBox t++scaleXY :: Double -> Double -> Tree -> Tree+scaleXY x y = withTransformations [Scale x (Just y)]++center :: Tree -> Tree+center t = translate (-x-w/2) (-y-h/2) t+  where+    (x, y, w, h) = boundingBox t++centerX :: Tree -> Tree+centerX t = translate (-x-w/2) 0 t+  where+    (x, _y, w, _h) = boundingBox t++centerY :: Tree -> Tree+centerY t = translate 0 (-y-h/2) t+  where+    (_x, y, _w, h) = boundingBox t++mkColor :: String -> Texture+mkColor name =+  case Map.lookup (T.pack name) svgNamedColors of+    Nothing -> ColorRef (PixelRGBA8 240 248 255 255)+    Just c  -> ColorRef c++withStrokeColor :: String -> Tree -> Tree+withStrokeColor color = strokeColor .~ pure (mkColor color)++withStrokeLineJoin :: LineJoin -> Tree -> Tree+withStrokeLineJoin ljoin = strokeLineJoin .~ pure ljoin++withFillColor :: String -> Tree -> Tree+withFillColor color = fillColor .~ pure (mkColor color)++withFillColorPixel :: PixelRGBA8 -> Tree -> Tree+withFillColorPixel color = fillColor .~ pure (ColorRef color)++withFillOpacity :: Double -> Tree -> Tree+withFillOpacity opacity = fillOpacity .~ Just (realToFrac opacity)++withGroupOpacity :: Double -> Tree -> Tree+withGroupOpacity opacity = groupOpacity .~ Just (realToFrac opacity)++withStrokeWidth :: Double -> Tree -> Tree+withStrokeWidth width = strokeWidth .~ pure (Num width)++withClipPathRef :: ElementRef -> Tree -> Tree+withClipPathRef ref = clipPathRef .~ pure ref++withId :: String -> Tree -> Tree+withId idTag = attrId .~ Just idTag++mkRect :: Double -> Double -> Tree+mkRect width height = translate (-width/2) (-height/2) $ RectangleTree $ defaultSvg+  & rectUpperLeftCorner .~ (Num 0, Num 0)+  & rectWidth .~ Just (Num width)+  & rectHeight .~ Just (Num height)++mkCircle :: Double -> Tree+mkCircle radius = CircleTree $ defaultSvg+  & circleCenter .~ (Num 0, Num 0)+  & circleRadius .~ Num radius++mkLine :: (Double,Double) -> (Double, Double) -> Tree+mkLine (x1,y1) (x2,y2) = LineTree $ defaultSvg+  & linePoint1 .~ (Num x1, Num y1)+  & linePoint2 .~ (Num x2, Num y2)++mkGroup :: [Tree] -> Tree+mkGroup forest = GroupTree $ defaultSvg+  & groupChildren .~ forest++mkDefinitions :: [Tree] -> Tree+mkDefinitions forest = DefinitionTree $ defaultSvg+  & groupChildren .~ forest++mkUse :: String -> Tree+mkUse name = UseTree (defaultSvg & useName .~ name) Nothing++mkClipPath :: String -> [Tree] -> Tree+mkClipPath idTag forest = withId idTag $ ClipPathTree $ (defaultSvg+  & clipPathContent .~ forest)++mkPathString :: String -> Tree+mkPathString = mkPathText . T.pack++mkPathText :: T.Text -> Tree+mkPathText str =+  case parseOnly pathParser str of+    Left err   -> error err+    Right cmds -> PathTree $ defaultSvg & pathDefinition .~ cmds++mkLinePath :: [(Double, Double)] -> Tree+mkLinePath [] = mkGroup []+mkLinePath ((startX, startY):rest) =+    PathTree $ defaultSvg & pathDefinition .~ cmds+  where+    cmds = [ MoveTo OriginAbsolute [V2 startX startY]+           , LineTo OriginAbsolute [ V2 x y | (x, y) <- rest ] ]++mkBackground :: String -> Tree+mkBackground color = withFillColor color $ mkRect screenWidth screenHeight++mkBackgroundPixel :: PixelRGBA8 -> Tree+mkBackgroundPixel pixel =+    withFillColorPixel pixel $ mkRect screenWidth screenHeight++gridLayout :: [[Tree]] -> Tree+gridLayout rows = mkGroup+    [ translate (-screenWidth/2+colSep*(nCol))+                (screenHeight/2-rowSep*(nRow))+      elt+    | (nRow, col) <- zip [1..] rows+    , let nCols = length col+          colSep = screenWidth / fromIntegral (nCols+1)+    , (nCol, elt) <- zip [1..] col ]+  where+    rowSep = screenHeight / fromIntegral (nRows+1)+    nRows = length rows
+ src/Reanimate/Svg/LineCommand.hs view
@@ -0,0 +1,248 @@+{-# LANGUAGE LambdaCase #-}+module Reanimate.Svg.LineCommand where++import           Control.Lens                 ((%~), (&), (.~))+import           Control.Monad.Fix+import           Control.Monad.State+import           Graphics.SvgTree             hiding (height, line, path, use,+                                               width)+import           Linear.Metric+import           Linear.V2                    hiding (angle)+import           Linear.Vector+-- import qualified Geom2D.CubicBezier           as Bezier++type CmdM a = State RPoint a++data LineCommand+  = LineMove RPoint+  -- | LineDraw RPoint+  | LineBezier [RPoint]+  | LineEnd RPoint+  deriving (Show)++lineToPath :: [LineCommand] -> [PathCommand]+lineToPath = map worker+  where+    worker (LineMove p)         = MoveTo OriginAbsolute [p]+    -- worker (LineDraw p)         = LineTo OriginAbsolute [p]+    worker (LineBezier [a,b,c]) = CurveTo OriginAbsolute [(a,b,c)]+    worker (LineBezier [a,b])   = QuadraticBezier OriginAbsolute [(a,b)]+    worker (LineBezier [a])     = LineTo OriginAbsolute [a]+    worker LineBezier{}         = error "Reanimate.Svg.lineToPath: invalid bezier curve"+    worker LineEnd{}            = EndPath++lineToPoints :: Int -> [LineCommand] -> [RPoint]+lineToPoints nPoints cmds =+    map lineEnd lineSegments+  where+    lineSegments = [ partialLine (fromIntegral n/ fromIntegral nPoints) cmds | n <- [0 .. nPoints-1] ]+    lineEnd [LineBezier pts] = last pts+    lineEnd (_:xs)           = lineEnd xs+    lineEnd _                = error "invalid line"++partialLine :: Double -> [LineCommand] -> [LineCommand]+partialLine alpha cmds = evalState (worker 0 cmds) zero+  where+    worker _d [] = pure []+    worker d (cmd:xs) = do+      from <- get+      len <- lineLength cmd+      let frac = (targetLen-d) / len+      if len == 0 || frac >= 1+        then (cmd:) <$> worker (d+len) xs+        else pure [adjustLineLength frac from cmd]+    totalLen = evalState (sum <$> mapM lineLength cmds) zero+    targetLen = totalLen * alpha++adjustLineLength :: Double -> RPoint -> LineCommand -> LineCommand+adjustLineLength alpha from cmd =+  case cmd of+    LineBezier points -> LineBezier $ drop 1 $ partial_bezier_points (from:points) 0 alpha+    LineMove p -> LineMove p+    -- LineDraw t -> LineDraw (lerp alpha t from)+    LineEnd p -> LineBezier [lerp alpha p from]++lineLength :: LineCommand -> CmdM Double+lineLength cmd =+  case cmd of+    LineMove to       -> pure 0 <* put to+    -- LineDraw to       -> gets (distance to) <* put to+    LineBezier points -> gets (distance (last points)) <* put (last points)+    LineEnd to        -> gets (distance to) <* put to++toLineCommands :: [PathCommand] -> [LineCommand]+toLineCommands ps = evalState (worker zero Nothing ps) zero+  where+    worker _startPos _mbPrevControlPt [] = pure []+    worker startPos mbPrevControlPt (cmd:cmds) = do+      lcmds <- toLineCommand startPos mbPrevControlPt cmd+      let startPos' =+            case lcmds of+              [LineMove pos] -> pos+              _              -> startPos+      (lcmds++) <$> worker startPos' (cmdToControlPoint $ last lcmds) cmds++cmdToControlPoint :: LineCommand -> Maybe RPoint+cmdToControlPoint (LineBezier points) = Just (last (init points))+cmdToControlPoint _                   = Nothing++mkStraightLine :: RPoint -> LineCommand+mkStraightLine p = LineBezier [p]++toLineCommand :: RPoint -> Maybe RPoint -> PathCommand -> CmdM [LineCommand]+toLineCommand startPos mbPrevControlPt cmd = do+  case cmd of+    MoveTo OriginAbsolute []  -> pure []+    MoveTo OriginAbsolute lst -> put (last lst) *> gets (pure.LineMove)+    MoveTo OriginRelative lst -> modify (+ sum lst) *> gets (pure.LineMove)+    LineTo OriginAbsolute lst -> forM lst (\to -> put to *> pure (mkStraightLine to))+    LineTo OriginRelative lst -> forM lst (\to -> modify (+to) *> gets mkStraightLine)+    HorizontalTo OriginAbsolute lst ->+      forM lst $ \x -> modify (_x .~ x) *> gets mkStraightLine+    HorizontalTo OriginRelative lst ->+      forM lst $ \x -> modify (_x %~ (+x)) *> gets mkStraightLine+    VerticalTo OriginAbsolute lst ->+      forM lst $ \y -> modify (_y .~ y) *> gets mkStraightLine+    VerticalTo OriginRelative lst ->+      forM lst $ \y -> modify (_y %~ (+y)) *> gets mkStraightLine+    CurveTo OriginAbsolute quads -> do+      forM quads $ \(a,b,c) -> put c *> pure (LineBezier [a,b,c])+    CurveTo OriginRelative quads -> do+      forM quads $ \(a,b,c) -> do+        from <- get <* modify (+c)+        pure $ LineBezier $ map (+from) [a,b,c]+    SmoothCurveTo o lst -> mfix $ \result -> do+      let ctrl = mbPrevControlPt : map cmdToControlPoint result+      forM (zip lst ctrl) $ \((c2,to), mbControl) -> do+        from <- get <* adjustPosition o to+        let c1 = maybe (makeAbsolute o from c2) (mirrorPoint from) mbControl+        pure $ LineBezier [c1,makeAbsolute o from c2,makeAbsolute o from to]+    QuadraticBezier OriginAbsolute pairs -> do+      forM pairs $ \(a,b) -> put b *> pure (LineBezier [a,b])+    QuadraticBezier OriginRelative pairs -> do+      forM pairs $ \(a,b) -> do+        from <- get <* modify (+b)+        pure $ LineBezier $ map (+from) [a,b]+    SmoothQuadraticBezierCurveTo o lst -> mfix $ \result -> do+      let ctrl = mbPrevControlPt : map cmdToControlPoint result+      forM (zip lst ctrl) $ \(to, mbControl) -> do+        from <- get <* adjustPosition o to+        let c1 = maybe from (mirrorPoint from) mbControl+        pure $ LineBezier [c1,makeAbsolute o from to]+    EllipticalArc o points -> concat <$>+      (forM points $ \(rotX, rotY, angle, largeArc, sweepFlag, to) -> do+        from <- get <* adjustPosition o to+        return $ convertSvgArc from rotX rotY angle largeArc sweepFlag (makeAbsolute o from to))+    EndPath -> put startPos *> pure [LineEnd startPos]+  where+    mirrorPoint c p = c*2-p+    adjustPosition OriginRelative p = modify (+p)+    adjustPosition OriginAbsolute p = put p+    makeAbsolute OriginAbsolute _from p = p+    makeAbsolute OriginRelative from p  = from+p+++calculateVectorAngle :: Double -> Double -> Double -> Double -> Double+calculateVectorAngle ux uy vx vy+    | tb >= ta+        = tb - ta+    | otherwise+        = pi * 2 - (ta - tb)+    where+        ta = atan2 uy ux+        tb = atan2 vy vx++-- ported from: https://github.com/vvvv/SVG/blob/master/Source/Paths/SvgArcSegment.cs+convertSvgArc :: RPoint -> Coord -> Coord -> Coord -> Bool -> Bool -> RPoint -> [LineCommand]+convertSvgArc (V2 x0 y0) radiusX radiusY angle largeArcFlag sweepFlag (V2 x y)+    | x0 == x && y0 == y+        = []+    | radiusX == 0.0 && radiusY == 0.0+        = [LineBezier [V2 x y]]+    | otherwise+        = calcSegments x0 y0 theta1' segments'+    where+        sinPhi = sin (angle * pi/180)+        cosPhi = cos (angle * pi/180)++        x1dash = cosPhi * (x0 - x) / 2.0 + sinPhi * (y0 - y) / 2.0+        y1dash = -sinPhi * (x0 - x) / 2.0 + cosPhi * (y0 - y) / 2.0++        numerator = radiusX * radiusX * radiusY * radiusY - radiusX * radiusX * y1dash * y1dash - radiusY * radiusY * x1dash * x1dash++        s = sqrt(1.0 - numerator / (radiusX * radiusX * radiusY * radiusY))+        rx   = if (numerator < 0.0) then (radiusX * s) else radiusX+        ry   = if (numerator < 0.0) then (radiusY * s) else radiusY+        root = if (numerator < 0.0)+                then (0.0)+                else ((if ((largeArcFlag && sweepFlag) || (not largeArcFlag && not sweepFlag)) then (-1.0) else 1.0) *+                        sqrt(numerator / (radiusX * radiusX * y1dash * y1dash + radiusY * radiusY * x1dash * x1dash)))++        cxdash = root * rx * y1dash / ry+        cydash = -root * ry * x1dash / rx++        cx = cosPhi * cxdash - sinPhi * cydash + (x0 + x) / 2.0+        cy = sinPhi * cxdash + cosPhi * cydash + (y0 + y) / 2.0++        theta1'  = calculateVectorAngle 1.0 0.0 ((x1dash - cxdash) / rx) ((y1dash - cydash) / ry)+        dtheta' = calculateVectorAngle ((x1dash - cxdash) / rx) ((y1dash - cydash) / ry) ((-x1dash - cxdash) / rx) ((-y1dash - cydash) / ry)+        dtheta  = if (not sweepFlag && dtheta' > 0)+                    then  (dtheta' - 2 * pi)+                    else  (if (sweepFlag && dtheta' < 0) then (dtheta' + 2 * pi) else dtheta')++        segments' = ceiling (abs (dtheta / (pi / 2.0)))+        delta = dtheta / fromInteger segments'+        t = 8.0 / 3.0 * sin(delta / 4.0) * sin(delta / 4.0) / sin(delta / 2.0)++        calcSegments startX startY theta1 segments+            | segments == 0+                = []+            | otherwise+                = LineBezier [ V2 (startX + dx1) (startY + dy1)+                             , V2 (endpointX + dxe) (endpointY + dye)+                             , V2 endpointX endpointY ] : calcSegments endpointX endpointY theta2 (segments - 1)+            where+                cosTheta1 = cos theta1+                sinTheta1 = sin theta1+                theta2 = theta1 + delta+                cosTheta2 = cos theta2+                sinTheta2 = sin theta2++                endpointX = cosPhi * rx * cosTheta2 - sinPhi * ry * sinTheta2 + cx+                endpointY = sinPhi * rx * cosTheta2 + cosPhi * ry * sinTheta2 + cy++                dx1 = t * (-cosPhi * rx * sinTheta1 - sinPhi * ry * cosTheta1)+                dy1 = t * (-sinPhi * rx * sinTheta1 + cosPhi * ry * cosTheta1)++                dxe = t * (cosPhi * rx * sinTheta2 + sinPhi * ry * cosTheta2)+                dye = t * (sinPhi * rx * sinTheta2 - cosPhi * ry * cosTheta2)+++-- Algorithm taken from manim. It's magic.+bezier :: [RPoint] -> Double -> RPoint+bezier points t = sum+    [ point ^* (((1-t)**(fromIntegral $ n-k)) * (t**fromIntegral k) * fromIntegral (choose n k))+    | (k, point) <- zip [0..] points+    , let n = length points-1 ]+  where+    choose n k = product [n,n-1 .. n-k+1] `div` product [1..k]++partial_bezier_points :: [RPoint] -> Double -> Double -> [RPoint]+partial_bezier_points points a b+  | isNaN end_prop || isInfinite end_prop = replicate (length points) (last points)+  | otherwise = [ bezier (take (i+1) a_to_1) end_prop | i <- [0..length points-1] ]+  where+    a_to_1 = [ bezier (drop i points) a | i <- [0..length points-1] ]+    end_prop = (b-a) / (1-a)++++interpolatePathCommands :: Double -> [PathCommand] -> [PathCommand]+interpolatePathCommands alpha = lineToPath . partialLine alpha . toLineCommands++partialSvg :: Double -> Tree -> Tree+partialSvg alpha = mapTree worker+  where+    worker (PathTree path) =+      PathTree $ path & pathDefinition %~ lineToPath . partialLine alpha . toLineCommands+    worker t = t
− src/Reanimate/Svg/NamedColors.hs
@@ -1,157 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}
-module Reanimate.Svg.NamedColors( svgNamedColors ) where
-
-import qualified Data.Map as M
-import Codec.Picture( PixelRGBA8( .. ) )
-import Data.Text( Text )
-
-svgNamedColors :: M.Map String PixelRGBA8
-svgNamedColors = M.fromList
-  [ ("aliceblue"           , PixelRGBA8 240 248 255 255)
-  , ("antiquewhite"        , PixelRGBA8 250 235 215 255)
-  , ("aqua"                , PixelRGBA8   0 255 255 255)
-  , ("aquamarine"          , PixelRGBA8 127 255 212 255)
-  , ("azure"               , PixelRGBA8 240 255 255 255)
-  , ("beige"               , PixelRGBA8 245 245 220 255)
-  , ("bisque"              , PixelRGBA8 255 228 196 255)
-  , ("black"               , PixelRGBA8   0   0   0 255)
-  , ("blanchedalmond"      , PixelRGBA8 255 235 205 255)
-  , ("blue"                , PixelRGBA8   0   0 255 255)
-  , ("blueviolet"          , PixelRGBA8 138  43 226 255)
-  , ("brown"               , PixelRGBA8 165  42  42 255)
-  , ("burlywood"           , PixelRGBA8 222 184 135 255)
-  , ("cadetblue"           , PixelRGBA8  95 158 160 255)
-  , ("chartreuse"          , PixelRGBA8 127 255   0 255)
-  , ("chocolate"           , PixelRGBA8 210 105  30 255)
-  , ("coral"               , PixelRGBA8 255 127  80 255)
-  , ("cornflowerblue"      , PixelRGBA8 100 149 237 255)
-  , ("cornsilk"            , PixelRGBA8 255 248 220 255)
-  , ("crimson"             , PixelRGBA8 220  20  60 255)
-  , ("cyan"                , PixelRGBA8   0 255 255 255)
-  , ("darkblue"            , PixelRGBA8   0   0 139 255)
-  , ("darkcyan"            , PixelRGBA8   0 139 139 255)
-  , ("darkgoldenrod"       , PixelRGBA8 184 134  11 255)
-  , ("darkgray"            , PixelRGBA8 169 169 169 255)
-  , ("darkgreen"           , PixelRGBA8   0 100   0 255)
-  , ("darkgrey"            , PixelRGBA8 169 169 169 255)
-  , ("darkkhaki"           , PixelRGBA8 189 183 107 255)
-  , ("darkmagenta"         , PixelRGBA8 139   0 139 255)
-  , ("darkolivegreen"      , PixelRGBA8  85 107  47 255)
-  , ("darkorange"          , PixelRGBA8 255 140   0 255)
-  , ("darkorchid"          , PixelRGBA8 153  50 204 255)
-  , ("darkred"             , PixelRGBA8 139   0   0 255)
-  , ("darksalmon"          , PixelRGBA8 233 150 122 255)
-  , ("darkseagreen"        , PixelRGBA8 143 188 143 255)
-  , ("darkslateblue"       , PixelRGBA8  72  61 139 255)
-  , ("darkslategray"       , PixelRGBA8  47  79  79 255)
-  , ("darkslategrey"       , PixelRGBA8  47  79  79 255)
-  , ("darkturquoise"       , PixelRGBA8   0 206 209 255)
-  , ("darkviolet"          , PixelRGBA8 148   0 211 255)
-  , ("deeppink"            , PixelRGBA8 255  20 147 255)
-  , ("deepskyblue"         , PixelRGBA8   0 191 255 255)
-  , ("dimgray"             , PixelRGBA8 105 105 105 255)
-  , ("dimgrey"             , PixelRGBA8 105 105 105 255)
-  , ("dodgerblue"          , PixelRGBA8  30 144 255 255)
-  , ("firebrick"           , PixelRGBA8 178  34  34 255)
-  , ("floralwhite"         , PixelRGBA8 255 250 240 255)
-  , ("forestgreen"         , PixelRGBA8  34 139  34 255)
-  , ("fuchsia"             , PixelRGBA8 255   0 255 255)
-  , ("gainsboro"           , PixelRGBA8 220 220 220 255)
-  , ("ghostwhite"          , PixelRGBA8 248 248 255 255)
-  , ("gold"                , PixelRGBA8 255 215   0 255)
-  , ("goldenrod"           , PixelRGBA8 218 165  32 255)
-  , ("gray"                , PixelRGBA8 128 128 128 255)
-  , ("grey"                , PixelRGBA8 128 128 128 255)
-  , ("green"               , PixelRGBA8   0 128   0 255)
-  , ("greenyellow"         , PixelRGBA8 173 255  47 255)
-  , ("honeydew"            , PixelRGBA8 240 255 240 255)
-  , ("hotpink"             , PixelRGBA8 255 105 180 255)
-  , ("indianred"           , PixelRGBA8 205  92  92 255)
-  , ("indigo"              , PixelRGBA8  75   0 130 255)
-  , ("ivory"               , PixelRGBA8 255 255 240 255)
-  , ("khaki"               , PixelRGBA8 240 230 140 255)
-  , ("lavender"            , PixelRGBA8 230 230 250 255)
-  , ("lavenderblush"       , PixelRGBA8 255 240 245 255)
-  , ("lawngreen"           , PixelRGBA8 124 252   0 255)
-  , ("lemonchiffon"        , PixelRGBA8 255 250 205 255)
-  , ("lightblue"           , PixelRGBA8 173 216 230 255)
-  , ("lightcoral"          , PixelRGBA8 240 128 128 255)
-  , ("lightcyan"           , PixelRGBA8 224 255 255 255)
-  , ("lightgoldenrodyellow", PixelRGBA8 250 250 210 255)
-  , ("lightgray"           , PixelRGBA8 211 211 211 255)
-  , ("lightgreen"          , PixelRGBA8 144 238 144 255)
-  , ("lightgrey"           , PixelRGBA8 211 211 211 255)
-  , ("lightpink"           , PixelRGBA8 255 182 193 255)
-  , ("lightsalmon"         , PixelRGBA8 255 160 122 255)
-  , ("lightseagreen"       , PixelRGBA8  32 178 170 255)
-  , ("lightskyblue"        , PixelRGBA8 135 206 250 255)
-  , ("lightslategray"      , PixelRGBA8 119 136 153 255)
-  , ("lightslategrey"      , PixelRGBA8 119 136 153 255)
-  , ("lightsteelblue"      , PixelRGBA8 176 196 222 255)
-  , ("lightyellow"         , PixelRGBA8 255 255 224 255)
-  , ("lime"                , PixelRGBA8   0 255   0 255)
-  , ("limegreen"           , PixelRGBA8  50 205  50 255)
-  , ("linen"               , PixelRGBA8 250 240 230 255)
-  , ("magenta"             , PixelRGBA8 255   0 255 255)
-  , ("maroon"              , PixelRGBA8 128   0   0 255)
-  , ("mediumaquamarine"    , PixelRGBA8 102 205 170 255)
-  , ("mediumblue"          , PixelRGBA8   0   0 205 255)
-  , ("mediumorchid"        , PixelRGBA8 186  85 211 255)
-  , ("mediumpurple"        , PixelRGBA8 147 112 219 255)
-  , ("mediumseagreen"      , PixelRGBA8  60 179 113 255)
-  , ("mediumslateblue"     , PixelRGBA8 123 104 238 255)
-  , ("mediumspringgreen"   , PixelRGBA8   0 250 154 255)
-  , ("mediumturquoise"     , PixelRGBA8  72 209 204 255)
-  , ("mediumvioletred"     , PixelRGBA8 199  21 133 255)
-  , ("midnightblue"        , PixelRGBA8  25  25 112 255)
-  , ("mintcream"           , PixelRGBA8 245 255 250 255)
-  , ("mistyrose"           , PixelRGBA8 255 228 225 255)
-  , ("moccasin"            , PixelRGBA8 255 228 181 255)
-  , ("navajowhite"         , PixelRGBA8 255 222 173 255)
-  , ("navy"                , PixelRGBA8   0   0 128 255)
-  , ("oldlace"             , PixelRGBA8 253 245 230 255)
-  , ("olive"               , PixelRGBA8 128 128   0 255)
-  , ("olivedrab"           , PixelRGBA8 107 142  35 255)
-  , ("orange"              , PixelRGBA8 255 165   0 255)
-  , ("orangered"           , PixelRGBA8 255  69   0 255)
-  , ("orchid"              , PixelRGBA8 218 112 214 255)
-  , ("palegoldenrod"       , PixelRGBA8 238 232 170 255)
-  , ("palegreen"           , PixelRGBA8 152 251 152 255)
-  , ("paleturquoise"       , PixelRGBA8 175 238 238 255)
-  , ("palevioletred"       , PixelRGBA8 219 112 147 255)
-  , ("papayawhip"          , PixelRGBA8 255 239 213 255)
-  , ("peachpuff"           , PixelRGBA8 255 218 185 255)
-  , ("peru"                , PixelRGBA8 205 133  63 255)
-  , ("pink"                , PixelRGBA8 255 192 203 255)
-  , ("plum"                , PixelRGBA8 221 160 221 255)
-  , ("powderblue"          , PixelRGBA8 176 224 230 255)
-  , ("purple"              , PixelRGBA8 128   0 128 255)
-  , ("red"                 , PixelRGBA8 255   0   0 255)
-  , ("rosybrown"           , PixelRGBA8 188 143 143 255)
-  , ("royalblue"           , PixelRGBA8  65 105 225 255)
-  , ("saddlebrown"         , PixelRGBA8 139  69  19 255)
-  , ("salmon"              , PixelRGBA8 250 128 114 255)
-  , ("sandybrown"          , PixelRGBA8 244 164  96 255)
-  , ("seagreen"            , PixelRGBA8  46 139  87 255)
-  , ("seashell"            , PixelRGBA8 255 245 238 255)
-  , ("sienna"              , PixelRGBA8 160  82  45 255)
-  , ("silver"              , PixelRGBA8 192 192 192 255)
-  , ("skyblue"             , PixelRGBA8 135 206 235 255)
-  , ("slateblue"           , PixelRGBA8 106  90 205 255)
-  , ("slategray"           , PixelRGBA8 112 128 144 255)
-  , ("slategrey"           , PixelRGBA8 112 128 144 255)
-  , ("snow"                , PixelRGBA8 255 250 250 255)
-  , ("springgreen"         , PixelRGBA8   0 255 127 255)
-  , ("steelblue"           , PixelRGBA8  70 130 180 255)
-  , ("tan"                 , PixelRGBA8 210 180 140 255)
-  , ("teal"                , PixelRGBA8   0 128 128 255)
-  , ("thistle"             , PixelRGBA8 216 191 216 255)
-  , ("tomato"              , PixelRGBA8 255  99  71 255)
-  , ("turquoise"           , PixelRGBA8  64 224 208 255)
-  , ("violet"              , PixelRGBA8 238 130 238 255)
-  , ("wheat"               , PixelRGBA8 245 222 179 255)
-  , ("white"               , PixelRGBA8 255 255 255 255)
-  , ("whitesmoke"          , PixelRGBA8 245 245 245 255)
-  , ("yellow"              , PixelRGBA8 255 255   0 255)
-  , ("yellowgreen"         , PixelRGBA8 154 205  50 255)
-  ]
+ src/Reanimate/Svg/Unuse.hs view
@@ -0,0 +1,50 @@+module Reanimate.Svg.Unuse+  ( replaceUses+  , unbox+  ) where++import           Control.Lens                 ((%~), (&), (.~), (^.))+import qualified Data.Map                     as Map+import           Graphics.SvgTree             hiding (height, line, path, use,+                                               width)+import           Reanimate.Constants+import           Reanimate.Svg.Constructors++replaceUses :: Document -> Document+replaceUses doc = doc & elements %~ map (mapTree replace)+                      & definitions .~ Map.empty+  where+    replaceDefinition PathTree{} = None+    replaceDefinition t          = t++    replace t@DefinitionTree{} = mapTree replaceDefinition t+    replace (UseTree _ Just{}) = error "replaceUses: subtree in use?"+    replace (UseTree use Nothing) =+      case Map.lookup (use^.useName) idMap of+        Nothing -> error $ "Unknown id: " ++ (use^.useName)+        Just tree ->+          GroupTree $+          defaultSvg & groupChildren .~ [tree]+                     & transform .~ Just [baseToTransformation (use^.useBase)]+    replace x = x+    baseToTransformation (x,y) =+      case (toUserUnit defaultDPI x, toUserUnit defaultDPI y) of+        (Num a, Num b) -> Translate a b+        _              -> TransformUnknown+    docTree = mkGroup (doc^.elements)+    idMap = foldTree updMap Map.empty docTree `Map.union`+            (doc^.definitions)+    updMap m tree =+      case tree^.attrId of+        Nothing  -> m+        Just tid -> Map.insert tid tree m++-- Transform out viewbox. defs and CSS rules are discarded.+unbox :: Document -> Tree+unbox doc@Document{_viewBox = Just (minx, minw, _width, _height)} =+  GroupTree $ defaultSvg+          & groupChildren .~ doc^.elements+          & transform .~ Just [Translate (-minx) (-minw)]+unbox doc =+  GroupTree $ defaultSvg+    & groupChildren .~ doc^.elements
src/Reanimate/Transform.hs view
@@ -3,6 +3,7 @@   ( identity   , transformPoint   , mkMatrix+  , toTransformation   ) where  -- XXX: Use Linear.Matrix instead of Data.Matrix to drop the 'matrix' dependency.@@ -46,3 +47,8 @@     translate x y = fromList [1,0,0,1,x,y]     rotate a = fromList [cos r,sin r,-sin r,cos r,0,0]       where r = a * pi / 180++toTransformation :: TMatrix -> Transformation+toTransformation m = TransformMatrix a b c d e f+  where+    [a,c,e,b,d,f,_,_,_] = M.toList m
test/UnitTests.hs view
@@ -4,9 +4,8 @@   , compileVideoFolder   ) where -import           Control.Monad        (forM)+import           Control.Exception import qualified Data.ByteString.Lazy as LBS-import           Data.Maybe           (catMaybes) import           Reanimate.Misc       (withTempDir, withTempFile) import           System.Directory import           System.Exit@@ -21,7 +20,7 @@ unitTestFolder path = do   files <- getDirectoryContents path   return $ testGroup "animate"-    [ goldenVsStringDiff file (\ref new -> ["diff", "--brief", ref, new]) fullPath (genGolden hsPath)+    [ goldenVsStringDiff file (\ref new -> ["diff", "--strip-trailing-cr", ref, new]) fullPath (genGolden hsPath)     | file <- files     , let fullPath = path </> file           hsPath = replaceExtension fullPath "hs"@@ -38,8 +37,10 @@   -- ret <- runCmd_ "stack" $ ["ghc", "--"] ++ ghcOptions tmpDir ++ [self, "-o", tmpExecutable]   -- ["-rtsopts", "--make", "-threaded", "-O2"] ++   -- ["-odir", tmpDir, "-hidir", tmpDir]-  (inh, outh, errh, pid) <- runInteractiveProcess tmpExecutable (["snippets"] ++ runOpts)+  (inh, outh, errh, _pid) <- runInteractiveProcess tmpExecutable (["test"] ++ runOpts)     Nothing Nothing+  -- hSetBinaryMode outh True+  -- hSetNewlineMode outh universalNewlineMode   hClose inh   hClose errh   LBS.hGetContents outh@@ -49,16 +50,17 @@   files <- getDirectoryContents path   return $ testGroup "compile"     [ testCase file $ do-        (ret, _stdout, _stderr) <- readProcessWithExitCode "stack" (["ghc","--", fullPath] ++ ghcOpts) ""+        (ret, _stdout, err) <- readProcessWithExitCode "stack" (["ghc","--", fullPath] ++ ghcOpts) ""+        _ <- evaluate (length err)         case ret of-          ExitFailure{} -> assertFailure "Failed to compile"+          ExitFailure{} -> assertFailure $ "Failed to compile:\n" ++ err           ExitSuccess   -> return ()     | file <- files     , let fullPath = path </> file     , takeExtension file == ".hs" || takeExtension file == ".lhs"     ]   where-    ghcOpts = ["-fno-code", "-O0"]+    ghcOpts = ["-fno-code", "-O0", "-Werror", "-Wall"]  compileVideoFolder :: FilePath -> IO TestTree compileVideoFolder path = do
viewer/build/index.html view
@@ -1,1 +1,1 @@-<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="./manifest.json"/><title>Reanimate Playground</title><link href="./static/css/main.f7ad3e9b.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(l){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],f=0,i=[];f<n.length;f++)t=n[f],p[t]&&i.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r]);for(s&&s(e);i.length;)i.shift()();return c.push.apply(c,u||[]),a()}function a(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=f(f.s=t[0]))}return e}var t={},p={1:0},c=[];function f(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return l[e].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=l,f.c=t,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(r,e){if(1&e&&(r=f(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)f.d(t,n,function(e){return r[e]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="./";var r=window.webpackJsonp=window.webpackJsonp||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="./static/js/2.772a56e7.chunk.js"></script><script src="./static/js/main.c36ecb4a.chunk.js"></script></body></html>+<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="./manifest.json"/><title>Reanimate Playground</title><link href="./static/css/main.f7ad3e9b.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(l){function e(e){for(var r,t,n=e[0],o=e[1],u=e[2],f=0,i=[];f<n.length;f++)t=n[f],p[t]&&i.push(p[t][0]),p[t]=0;for(r in o)Object.prototype.hasOwnProperty.call(o,r)&&(l[r]=o[r]);for(s&&s(e);i.length;)i.shift()();return c.push.apply(c,u||[]),a()}function a(){for(var e,r=0;r<c.length;r++){for(var t=c[r],n=!0,o=1;o<t.length;o++){var u=t[o];0!==p[u]&&(n=!1)}n&&(c.splice(r--,1),e=f(f.s=t[0]))}return e}var t={},p={1:0},c=[];function f(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return l[e].call(r.exports,r,r.exports,f),r.l=!0,r.exports}f.m=l,f.c=t,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(r,e){if(1&e&&(r=f(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)f.d(t,n,function(e){return r[e]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="./";var r=window.webpackJsonp=window.webpackJsonp||[],n=r.push.bind(r);r.push=e,r=r.slice();for(var o=0;o<r.length;o++)e(r[o]);var s=n;a()}([])</script><script src="./static/js/2.822530b2.chunk.js"></script><script src="./static/js/main.b15b405f.chunk.js"></script></body></html>
viewer/build/service-worker.js view
@@ -14,7 +14,7 @@ importScripts("https://storage.googleapis.com/workbox-cdn/releases/3.6.3/workbox-sw.js");  importScripts(-  "./precache-manifest.2267f062fb7f449c2505790eb4da5a8a.js"+  "./precache-manifest.ea495bbf63da838cb91204dca53ee4e1.js" );  workbox.clientsClaim();
− viewer/build/static/js/2.772a56e7.chunk.js
@@ -1,2 +0,0 @@-(window.webpackJsonp=window.webpackJsonp||[]).push([[2],[function(e,t,n){"use strict";e.exports=n(11)},function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,"a",function(){return r})},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},l=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(l=l.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),l.forEach(function(t){r(e,t,n[t])})}return e}n.d(t,"a",function(){return l})},function(e,t,n){"use strict";var r=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(l){return!1}}()?Object.assign:function(e,t){for(var n,o,a=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),u=1;u<arguments.length;u++){for(var c in n=Object(arguments[u]))l.call(n,c)&&(a[c]=n[c]);if(r){o=r(n);for(var s=0;s<o.length;s++)i.call(n,o[s])&&(a[o[s]]=n[o[s]])}}return a}},function(e,t,n){"use strict";!function e(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=n(12)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,"a",function(){return r})},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}n.d(t,"a",function(){return l})},function(e,t,n){"use strict";function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n.d(t,"a",function(){return r})},function(e,t,n){"use strict";function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function l(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}n.d(t,"a",function(){return l})},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e){return(l="function"===typeof Symbol&&"symbol"===r(Symbol.iterator)?function(e){return r(e)}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":r(e)})(e)}var i=n(1);function o(e,t){return!t||"object"!==l(t)&&"function"!==typeof t?Object(i.a)(e):t}n.d(t,"a",function(){return o})},,function(e,t,n){"use strict";var r=n(3),l="function"===typeof Symbol&&Symbol.for,i=l?Symbol.for("react.element"):60103,o=l?Symbol.for("react.portal"):60106,a=l?Symbol.for("react.fragment"):60107,u=l?Symbol.for("react.strict_mode"):60108,c=l?Symbol.for("react.profiler"):60114,s=l?Symbol.for("react.provider"):60109,f=l?Symbol.for("react.context"):60110,d=l?Symbol.for("react.concurrent_mode"):60111,p=l?Symbol.for("react.forward_ref"):60112,m=l?Symbol.for("react.suspense"):60113,h=l?Symbol.for("react.memo"):60115,y=l?Symbol.for("react.lazy"):60116,v="function"===typeof Symbol&&Symbol.iterator;function g(e){for(var t=arguments.length-1,n="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=0;r<t;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);!function(e,t,n,r,l,i,o,a){if(!e){if(e=void 0,void 0===t)e=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,l,i,o,a],c=0;(e=Error(t.replace(/%s/g,function(){return u[c++]}))).name="Invariant Violation"}throw e.framesToPop=1,e}}(!1,"Minified React error #"+e+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",n)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k={};function w(e,t,n){this.props=e,this.context=t,this.refs=k,this.updater=n||b}function x(){}function T(e,t,n){this.props=e,this.context=t,this.refs=k,this.updater=n||b}w.prototype.isReactComponent={},w.prototype.setState=function(e,t){"object"!==typeof e&&"function"!==typeof e&&null!=e&&g("85"),this.updater.enqueueSetState(this,e,t,"setState")},w.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},x.prototype=w.prototype;var S=T.prototype=new x;S.constructor=T,r(S,w.prototype),S.isPureReactComponent=!0;var _={current:null},E={current:null},C=Object.prototype.hasOwnProperty,P={key:!0,ref:!0,__self:!0,__source:!0};function N(e,t,n){var r=void 0,l={},o=null,a=null;if(null!=t)for(r in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(o=""+t.key),t)C.call(t,r)&&!P.hasOwnProperty(r)&&(l[r]=t[r]);var u=arguments.length-2;if(1===u)l.children=n;else if(1<u){for(var c=Array(u),s=0;s<u;s++)c[s]=arguments[s+2];l.children=c}if(e&&e.defaultProps)for(r in u=e.defaultProps)void 0===l[r]&&(l[r]=u[r]);return{$$typeof:i,type:e,key:o,ref:a,props:l,_owner:E.current}}function O(e){return"object"===typeof e&&null!==e&&e.$$typeof===i}var z=/\/+/g,R=[];function M(e,t,n,r){if(R.length){var l=R.pop();return l.result=e,l.keyPrefix=t,l.func=n,l.context=r,l.count=0,l}return{result:e,keyPrefix:t,func:n,context:r,count:0}}function I(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>R.length&&R.push(e)}function U(e,t,n){return null==e?0:function e(t,n,r,l){var a=typeof t;"undefined"!==a&&"boolean"!==a||(t=null);var u=!1;if(null===t)u=!0;else switch(a){case"string":case"number":u=!0;break;case"object":switch(t.$$typeof){case i:case o:u=!0}}if(u)return r(l,t,""===n?"."+D(t,0):n),1;if(u=0,n=""===n?".":n+":",Array.isArray(t))for(var c=0;c<t.length;c++){var s=n+D(a=t[c],c);u+=e(a,s,r,l)}else if(s=null===t||"object"!==typeof t?null:"function"===typeof(s=v&&t[v]||t["@@iterator"])?s:null,"function"===typeof s)for(t=s.call(t),c=0;!(a=t.next()).done;)u+=e(a=a.value,s=n+D(a,c++),r,l);else"object"===a&&g("31","[object Object]"===(r=""+t)?"object with keys {"+Object.keys(t).join(", ")+"}":r,"");return u}(e,"",t,n)}function D(e,t){return"object"===typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(e){return t[e]})}(e.key):t.toString(36)}function F(e,t){e.func.call(e.context,t,e.count++)}function L(e,t,n){var r=e.result,l=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?A(e,r,n,function(e){return e}):null!=e&&(O(e)&&(e=function(e,t){return{$$typeof:i,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(e,l+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(z,"$&/")+"/")+n)),r.push(e))}function A(e,t,n,r,l){var i="";null!=n&&(i=(""+n).replace(z,"$&/")+"/"),U(e,L,t=M(t,i,r,l)),I(t)}function j(){var e=_.current;return null===e&&g("307"),e}var W={Children:{map:function(e,t,n){if(null==e)return e;var r=[];return A(e,r,null,t,n),r},forEach:function(e,t,n){if(null==e)return e;U(e,F,t=M(null,null,t,n)),I(t)},count:function(e){return U(e,function(){return null},null)},toArray:function(e){var t=[];return A(e,t,null,function(e){return e}),t},only:function(e){return O(e)||g("143"),e}},createRef:function(){return{current:null}},Component:w,PureComponent:T,createContext:function(e,t){return void 0===t&&(t=null),(e={$$typeof:f,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:s,_context:e},e.Consumer=e},forwardRef:function(e){return{$$typeof:p,render:e}},lazy:function(e){return{$$typeof:y,_ctor:e,_status:-1,_result:null}},memo:function(e,t){return{$$typeof:h,type:e,compare:void 0===t?null:t}},useCallback:function(e,t){return j().useCallback(e,t)},useContext:function(e,t){return j().useContext(e,t)},useEffect:function(e,t){return j().useEffect(e,t)},useImperativeHandle:function(e,t,n){return j().useImperativeHandle(e,t,n)},useDebugValue:function(){},useLayoutEffect:function(e,t){return j().useLayoutEffect(e,t)},useMemo:function(e,t){return j().useMemo(e,t)},useReducer:function(e,t,n){return j().useReducer(e,t,n)},useRef:function(e){return j().useRef(e)},useState:function(e){return j().useState(e)},Fragment:a,StrictMode:u,Suspense:m,createElement:N,cloneElement:function(e,t,n){(null===e||void 0===e)&&g("267",e);var l=void 0,o=r({},e.props),a=e.key,u=e.ref,c=e._owner;if(null!=t){void 0!==t.ref&&(u=t.ref,c=E.current),void 0!==t.key&&(a=""+t.key);var s=void 0;for(l in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)C.call(t,l)&&!P.hasOwnProperty(l)&&(o[l]=void 0===t[l]&&void 0!==s?s[l]:t[l])}if(1===(l=arguments.length-2))o.children=n;else if(1<l){s=Array(l);for(var f=0;f<l;f++)s[f]=arguments[f+2];o.children=s}return{$$typeof:i,type:e.type,key:a,ref:u,props:o,_owner:c}},createFactory:function(e){var t=N.bind(null,e);return t.type=e,t},isValidElement:O,version:"16.8.2",unstable_ConcurrentMode:d,unstable_Profiler:c,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentDispatcher:_,ReactCurrentOwner:E,assign:r}},V={default:W},B=V&&W||V;e.exports=B.default||B},function(e,t,n){"use strict";var r=n(0),l=n(3),i=n(13);function o(e){for(var t=arguments.length-1,n="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=0;r<t;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);!function(e,t,n,r,l,i,o,a){if(!e){if(e=void 0,void 0===t)e=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,l,i,o,a],c=0;(e=Error(t.replace(/%s/g,function(){return u[c++]}))).name="Invariant Violation"}throw e.framesToPop=1,e}}(!1,"Minified React error #"+e+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",n)}r||o("227");var a=!1,u=null,c=!1,s=null,f={onError:function(e){a=!0,u=e}};function d(e,t,n,r,l,i,o,c,s){a=!1,u=null,function(e,t,n,r,l,i,o,a,u){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(s){this.onError(s)}}.apply(f,arguments)}var p=null,m={};function h(){if(p)for(var e in m){var t=m[e],n=p.indexOf(e);if(-1<n||o("96",e),!v[n])for(var r in t.extractEvents||o("97",e),v[n]=t,n=t.eventTypes){var l=void 0,i=n[r],a=t,u=r;g.hasOwnProperty(u)&&o("99",u),g[u]=i;var c=i.phasedRegistrationNames;if(c){for(l in c)c.hasOwnProperty(l)&&y(c[l],a,u);l=!0}else i.registrationName?(y(i.registrationName,a,u),l=!0):l=!1;l||o("98",r,e)}}}function y(e,t,n){b[e]&&o("100",e),b[e]=t,k[e]=t.eventTypes[n].dependencies}var v=[],g={},b={},k={},w=null,x=null,T=null;function S(e,t,n){var r=e.type||"unknown-event";e.currentTarget=T(n),function(e,t,n,r,l,i,f,p,m){if(d.apply(this,arguments),a){if(a){var h=u;a=!1,u=null}else o("198"),h=void 0;c||(c=!0,s=h)}}(r,t,void 0,e),e.currentTarget=null}function _(e,t){return null==t&&o("30"),null==e?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}function E(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)}var C=null;function P(e){if(e){var t=e._dispatchListeners,n=e._dispatchInstances;if(Array.isArray(t))for(var r=0;r<t.length&&!e.isPropagationStopped();r++)S(e,t[r],n[r]);else t&&S(e,t,n);e._dispatchListeners=null,e._dispatchInstances=null,e.isPersistent()||e.constructor.release(e)}}var N={injectEventPluginOrder:function(e){p&&o("101"),p=Array.prototype.slice.call(e),h()},injectEventPluginsByName:function(e){var t,n=!1;for(t in e)if(e.hasOwnProperty(t)){var r=e[t];m.hasOwnProperty(t)&&m[t]===r||(m[t]&&o("102",t),m[t]=r,n=!0)}n&&h()}};function O(e,t){var n=e.stateNode;if(!n)return null;var r=w(n);if(!r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}return e?null:(n&&"function"!==typeof n&&o("231",t,typeof n),n)}function z(e){if(null!==e&&(C=_(C,e)),e=C,C=null,e&&(E(e,P),C&&o("95"),c))throw e=s,c=!1,s=null,e}var R=Math.random().toString(36).slice(2),M="__reactInternalInstance$"+R,I="__reactEventHandlers$"+R;function U(e){if(e[M])return e[M];for(;!e[M];){if(!e.parentNode)return null;e=e.parentNode}return 5===(e=e[M]).tag||6===e.tag?e:null}function D(e){return!(e=e[M])||5!==e.tag&&6!==e.tag?null:e}function F(e){if(5===e.tag||6===e.tag)return e.stateNode;o("33")}function L(e){return e[I]||null}function A(e){do{e=e.return}while(e&&5!==e.tag);return e||null}function j(e,t,n){(t=O(e,n.dispatchConfig.phasedRegistrationNames[t]))&&(n._dispatchListeners=_(n._dispatchListeners,t),n._dispatchInstances=_(n._dispatchInstances,e))}function W(e){if(e&&e.dispatchConfig.phasedRegistrationNames){for(var t=e._targetInst,n=[];t;)n.push(t),t=A(t);for(t=n.length;0<t--;)j(n[t],"captured",e);for(t=0;t<n.length;t++)j(n[t],"bubbled",e)}}function V(e,t,n){e&&n&&n.dispatchConfig.registrationName&&(t=O(e,n.dispatchConfig.registrationName))&&(n._dispatchListeners=_(n._dispatchListeners,t),n._dispatchInstances=_(n._dispatchInstances,e))}function B(e){e&&e.dispatchConfig.registrationName&&V(e._targetInst,null,e)}function H(e){E(e,W)}var $=!("undefined"===typeof window||!window.document||!window.document.createElement);function Q(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var K={animationend:Q("Animation","AnimationEnd"),animationiteration:Q("Animation","AnimationIteration"),animationstart:Q("Animation","AnimationStart"),transitionend:Q("Transition","TransitionEnd")},q={},Y={};function X(e){if(q[e])return q[e];if(!K[e])return e;var t,n=K[e];for(t in n)if(n.hasOwnProperty(t)&&t in Y)return q[e]=n[t];return e}$&&(Y=document.createElement("div").style,"AnimationEvent"in window||(delete K.animationend.animation,delete K.animationiteration.animation,delete K.animationstart.animation),"TransitionEvent"in window||delete K.transitionend.transition);var G=X("animationend"),J=X("animationiteration"),Z=X("animationstart"),ee=X("transitionend"),te="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),ne=null,re=null,le=null;function ie(){if(le)return le;var e,t,n=re,r=n.length,l="value"in ne?ne.value:ne.textContent,i=l.length;for(e=0;e<r&&n[e]===l[e];e++);var o=r-e;for(t=1;t<=o&&n[r-t]===l[i-t];t++);return le=l.slice(e,1<t?1-t:void 0)}function oe(){return!0}function ae(){return!1}function ue(e,t,n,r){for(var l in this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n,e=this.constructor.Interface)e.hasOwnProperty(l)&&((t=e[l])?this[l]=t(n):"target"===l?this.target=r:this[l]=n[l]);return this.isDefaultPrevented=(null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue)?oe:ae,this.isPropagationStopped=ae,this}function ce(e,t,n,r){if(this.eventPool.length){var l=this.eventPool.pop();return this.call(l,e,t,n,r),l}return new this(e,t,n,r)}function se(e){e instanceof this||o("279"),e.destructor(),10>this.eventPool.length&&this.eventPool.push(e)}function fe(e){e.eventPool=[],e.getPooled=ce,e.release=se}l(ue.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!==typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=oe)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!==typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=oe)},persist:function(){this.isPersistent=oe},isPersistent:ae,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=ae,this._dispatchInstances=this._dispatchListeners=null}}),ue.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},ue.extend=function(e){function t(){}function n(){return r.apply(this,arguments)}var r=this;t.prototype=r.prototype;var i=new t;return l(i,n.prototype),n.prototype=i,n.prototype.constructor=n,n.Interface=l({},r.Interface,e),n.extend=r.extend,fe(n),n},fe(ue);var de=ue.extend({data:null}),pe=ue.extend({data:null}),me=[9,13,27,32],he=$&&"CompositionEvent"in window,ye=null;$&&"documentMode"in document&&(ye=document.documentMode);var ve=$&&"TextEvent"in window&&!ye,ge=$&&(!he||ye&&8<ye&&11>=ye),be=String.fromCharCode(32),ke={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},we=!1;function xe(e,t){switch(e){case"keyup":return-1!==me.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function Te(e){return"object"===typeof(e=e.detail)&&"data"in e?e.data:null}var Se=!1;var _e={eventTypes:ke,extractEvents:function(e,t,n,r){var l=void 0,i=void 0;if(he)e:{switch(e){case"compositionstart":l=ke.compositionStart;break e;case"compositionend":l=ke.compositionEnd;break e;case"compositionupdate":l=ke.compositionUpdate;break e}l=void 0}else Se?xe(e,n)&&(l=ke.compositionEnd):"keydown"===e&&229===n.keyCode&&(l=ke.compositionStart);return l?(ge&&"ko"!==n.locale&&(Se||l!==ke.compositionStart?l===ke.compositionEnd&&Se&&(i=ie()):(re="value"in(ne=r)?ne.value:ne.textContent,Se=!0)),l=de.getPooled(l,t,n,r),i?l.data=i:null!==(i=Te(n))&&(l.data=i),H(l),i=l):i=null,(e=ve?function(e,t){switch(e){case"compositionend":return Te(t);case"keypress":return 32!==t.which?null:(we=!0,be);case"textInput":return(e=t.data)===be&&we?null:e;default:return null}}(e,n):function(e,t){if(Se)return"compositionend"===e||!he&&xe(e,t)?(e=ie(),le=re=ne=null,Se=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return ge&&"ko"!==t.locale?null:t.data;default:return null}}(e,n))?((t=pe.getPooled(ke.beforeInput,t,n,r)).data=e,H(t)):t=null,null===i?t:null===t?i:[i,t]}},Ee=null,Ce=null,Pe=null;function Ne(e){if(e=x(e)){"function"!==typeof Ee&&o("280");var t=w(e.stateNode);Ee(e.stateNode,e.type,t)}}function Oe(e){Ce?Pe?Pe.push(e):Pe=[e]:Ce=e}function ze(){if(Ce){var e=Ce,t=Pe;if(Pe=Ce=null,Ne(e),t)for(e=0;e<t.length;e++)Ne(t[e])}}function Re(e,t){return e(t)}function Me(e,t,n){return e(t,n)}function Ie(){}var Ue=!1;function De(e,t){if(Ue)return e(t);Ue=!0;try{return Re(e,t)}finally{Ue=!1,(null!==Ce||null!==Pe)&&(Ie(),ze())}}var Fe={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Le(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Fe[e.type]:"textarea"===t}function Ae(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}function je(e){if(!$)return!1;var t=(e="on"+e)in document;return t||((t=document.createElement("div")).setAttribute(e,"return;"),t="function"===typeof t[e]),t}function We(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function Ve(e){e._valueTracker||(e._valueTracker=function(e){var t=We(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&"undefined"!==typeof n&&"function"===typeof n.get&&"function"===typeof n.set){var l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(e){r=""+e,i.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function Be(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=We(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}var He=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;He.hasOwnProperty("ReactCurrentDispatcher")||(He.ReactCurrentDispatcher={current:null});var $e=/^(.*)[\\\/]/,Qe="function"===typeof Symbol&&Symbol.for,Ke=Qe?Symbol.for("react.element"):60103,qe=Qe?Symbol.for("react.portal"):60106,Ye=Qe?Symbol.for("react.fragment"):60107,Xe=Qe?Symbol.for("react.strict_mode"):60108,Ge=Qe?Symbol.for("react.profiler"):60114,Je=Qe?Symbol.for("react.provider"):60109,Ze=Qe?Symbol.for("react.context"):60110,et=Qe?Symbol.for("react.concurrent_mode"):60111,tt=Qe?Symbol.for("react.forward_ref"):60112,nt=Qe?Symbol.for("react.suspense"):60113,rt=Qe?Symbol.for("react.memo"):60115,lt=Qe?Symbol.for("react.lazy"):60116,it="function"===typeof Symbol&&Symbol.iterator;function ot(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=it&&e[it]||e["@@iterator"])?e:null}function at(e){if(null==e)return null;if("function"===typeof e)return e.displayName||e.name||null;if("string"===typeof e)return e;switch(e){case et:return"ConcurrentMode";case Ye:return"Fragment";case qe:return"Portal";case Ge:return"Profiler";case Xe:return"StrictMode";case nt:return"Suspense"}if("object"===typeof e)switch(e.$$typeof){case Ze:return"Context.Consumer";case Je:return"Context.Provider";case tt:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case rt:return at(e.type);case lt:if(e=1===e._status?e._result:null)return at(e)}return null}function ut(e){var t="";do{e:switch(e.tag){case 3:case 4:case 6:case 7:case 10:case 9:var n="";break e;default:var r=e._debugOwner,l=e._debugSource,i=at(e.type);n=null,r&&(n=at(r.type)),r=i,i="",l?i=" (at "+l.fileName.replace($e,"")+":"+l.lineNumber+")":n&&(i=" (created by "+n+")"),n="\n    in "+(r||"Unknown")+i}t+=n,e=e.return}while(e);return t}var ct=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,st=Object.prototype.hasOwnProperty,ft={},dt={};function pt(e,t,n,r,l){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t}var mt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){mt[e]=new pt(e,0,!1,e,null)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];mt[t]=new pt(t,1,!1,e[1],null)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){mt[e]=new pt(e,2,!1,e.toLowerCase(),null)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){mt[e]=new pt(e,2,!1,e,null)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){mt[e]=new pt(e,3,!1,e.toLowerCase(),null)}),["checked","multiple","muted","selected"].forEach(function(e){mt[e]=new pt(e,3,!0,e,null)}),["capture","download"].forEach(function(e){mt[e]=new pt(e,4,!1,e,null)}),["cols","rows","size","span"].forEach(function(e){mt[e]=new pt(e,6,!1,e,null)}),["rowSpan","start"].forEach(function(e){mt[e]=new pt(e,5,!1,e.toLowerCase(),null)});var ht=/[\-:]([a-z])/g;function yt(e){return e[1].toUpperCase()}function vt(e,t,n,r){var l=mt.hasOwnProperty(t)?mt[t]:null;(null!==l?0===l.type:!r&&(2<t.length&&("o"===t[0]||"O"===t[0])&&("n"===t[1]||"N"===t[1])))||(function(e,t,n,r){if(null===t||"undefined"===typeof t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,l,r)&&(n=null),r||null===l?function(e){return!!st.call(dt,e)||!st.call(ft,e)&&(ct.test(e)?dt[e]=!0:(ft[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):l.mustUseProperty?e[l.propertyName]=null===n?3!==l.type&&"":n:(t=l.attributeName,r=l.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(l=l.type)||4===l&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}function gt(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function bt(e,t){var n=t.checked;return l({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function kt(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=gt(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function wt(e,t){null!=(t=t.checked)&&vt(e,"checked",t,!1)}function xt(e,t){wt(e,t);var n=gt(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?St(e,t.type,n):t.hasOwnProperty("defaultValue")&&St(e,t.type,gt(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Tt(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!e.defaultChecked,e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function St(e,t,n){"number"===t&&e.ownerDocument.activeElement===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(ht,yt);mt[t]=new pt(t,1,!1,e,null)}),"xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(ht,yt);mt[t]=new pt(t,1,!1,e,"http://www.w3.org/1999/xlink")}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(ht,yt);mt[t]=new pt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace")}),["tabIndex","crossOrigin"].forEach(function(e){mt[e]=new pt(e,1,!1,e.toLowerCase(),null)});var _t={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function Et(e,t,n){return(e=ue.getPooled(_t.change,e,t,n)).type="change",Oe(n),H(e),e}var Ct=null,Pt=null;function Nt(e){z(e)}function Ot(e){if(Be(F(e)))return e}function zt(e,t){if("change"===e)return t}var Rt=!1;function Mt(){Ct&&(Ct.detachEvent("onpropertychange",It),Pt=Ct=null)}function It(e){"value"===e.propertyName&&Ot(Pt)&&De(Nt,e=Et(Pt,e,Ae(e)))}function Ut(e,t,n){"focus"===e?(Mt(),Pt=n,(Ct=t).attachEvent("onpropertychange",It)):"blur"===e&&Mt()}function Dt(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Ot(Pt)}function Ft(e,t){if("click"===e)return Ot(t)}function Lt(e,t){if("input"===e||"change"===e)return Ot(t)}$&&(Rt=je("input")&&(!document.documentMode||9<document.documentMode));var At={eventTypes:_t,_isInputEventSupported:Rt,extractEvents:function(e,t,n,r){var l=t?F(t):window,i=void 0,o=void 0,a=l.nodeName&&l.nodeName.toLowerCase();if("select"===a||"input"===a&&"file"===l.type?i=zt:Le(l)?Rt?i=Lt:(i=Dt,o=Ut):(a=l.nodeName)&&"input"===a.toLowerCase()&&("checkbox"===l.type||"radio"===l.type)&&(i=Ft),i&&(i=i(e,t)))return Et(i,n,r);o&&o(e,l,t),"blur"===e&&(e=l._wrapperState)&&e.controlled&&"number"===l.type&&St(l,"number",l.value)}},jt=ue.extend({view:null,detail:null}),Wt={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Vt(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Wt[e])&&!!t[e]}function Bt(){return Vt}var Ht=0,$t=0,Qt=!1,Kt=!1,qt=jt.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:Bt,button:null,buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},movementX:function(e){if("movementX"in e)return e.movementX;var t=Ht;return Ht=e.screenX,Qt?"mousemove"===e.type?e.screenX-t:0:(Qt=!0,0)},movementY:function(e){if("movementY"in e)return e.movementY;var t=$t;return $t=e.screenY,Kt?"mousemove"===e.type?e.screenY-t:0:(Kt=!0,0)}}),Yt=qt.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),Xt={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",dependencies:["pointerout","pointerover"]}},Gt={eventTypes:Xt,extractEvents:function(e,t,n,r){var l="mouseover"===e||"pointerover"===e,i="mouseout"===e||"pointerout"===e;if(l&&(n.relatedTarget||n.fromElement)||!i&&!l)return null;if(l=r.window===r?r:(l=r.ownerDocument)?l.defaultView||l.parentWindow:window,i?(i=t,t=(t=n.relatedTarget||n.toElement)?U(t):null):i=null,i===t)return null;var o=void 0,a=void 0,u=void 0,c=void 0;"mouseout"===e||"mouseover"===e?(o=qt,a=Xt.mouseLeave,u=Xt.mouseEnter,c="mouse"):"pointerout"!==e&&"pointerover"!==e||(o=Yt,a=Xt.pointerLeave,u=Xt.pointerEnter,c="pointer");var s=null==i?l:F(i);if(l=null==t?l:F(t),(e=o.getPooled(a,i,n,r)).type=c+"leave",e.target=s,e.relatedTarget=l,(n=o.getPooled(u,t,n,r)).type=c+"enter",n.target=l,n.relatedTarget=s,r=t,i&&r)e:{for(l=r,c=0,o=t=i;o;o=A(o))c++;for(o=0,u=l;u;u=A(u))o++;for(;0<c-o;)t=A(t),c--;for(;0<o-c;)l=A(l),o--;for(;c--;){if(t===l||t===l.alternate)break e;t=A(t),l=A(l)}t=null}else t=null;for(l=t,t=[];i&&i!==l&&(null===(c=i.alternate)||c!==l);)t.push(i),i=A(i);for(i=[];r&&r!==l&&(null===(c=r.alternate)||c!==l);)i.push(r),r=A(r);for(r=0;r<t.length;r++)V(t[r],"bubbled",e);for(r=i.length;0<r--;)V(i[r],"captured",n);return[e,n]}};function Jt(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t}var Zt=Object.prototype.hasOwnProperty;function en(e,t){if(Jt(e,t))return!0;if("object"!==typeof e||null===e||"object"!==typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++)if(!Zt.call(t,n[r])||!Jt(e[n[r]],t[n[r]]))return!1;return!0}function tn(e){var t=e;if(e.alternate)for(;t.return;)t=t.return;else{if(0!==(2&t.effectTag))return 1;for(;t.return;)if(0!==(2&(t=t.return).effectTag))return 1}return 3===t.tag?2:3}function nn(e){2!==tn(e)&&o("188")}function rn(e){if(!(e=function(e){var t=e.alternate;if(!t)return 3===(t=tn(e))&&o("188"),1===t?null:e;for(var n=e,r=t;;){var l=n.return,i=l?l.alternate:null;if(!l||!i)break;if(l.child===i.child){for(var a=l.child;a;){if(a===n)return nn(l),e;if(a===r)return nn(l),t;a=a.sibling}o("188")}if(n.return!==r.return)n=l,r=i;else{a=!1;for(var u=l.child;u;){if(u===n){a=!0,n=l,r=i;break}if(u===r){a=!0,r=l,n=i;break}u=u.sibling}if(!a){for(u=i.child;u;){if(u===n){a=!0,n=i,r=l;break}if(u===r){a=!0,r=i,n=l;break}u=u.sibling}a||o("189")}}n.alternate!==r&&o("190")}return 3!==n.tag&&o("188"),n.stateNode.current===n?e:t}(e)))return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}var ln=ue.extend({animationName:null,elapsedTime:null,pseudoElement:null}),on=ue.extend({clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),an=jt.extend({relatedTarget:null});function un(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}var cn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},fn=jt.extend({key:function(e){if(e.key){var t=cn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=un(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?sn[e.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:Bt,charCode:function(e){return"keypress"===e.type?un(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?un(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),dn=qt.extend({dataTransfer:null}),pn=jt.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:Bt}),mn=ue.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),hn=qt.extend({deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null}),yn=[["abort","abort"],[G,"animationEnd"],[J,"animationIteration"],[Z,"animationStart"],["canplay","canPlay"],["canplaythrough","canPlayThrough"],["drag","drag"],["dragenter","dragEnter"],["dragexit","dragExit"],["dragleave","dragLeave"],["dragover","dragOver"],["durationchange","durationChange"],["emptied","emptied"],["encrypted","encrypted"],["ended","ended"],["error","error"],["gotpointercapture","gotPointerCapture"],["load","load"],["loadeddata","loadedData"],["loadedmetadata","loadedMetadata"],["loadstart","loadStart"],["lostpointercapture","lostPointerCapture"],["mousemove","mouseMove"],["mouseout","mouseOut"],["mouseover","mouseOver"],["playing","playing"],["pointermove","pointerMove"],["pointerout","pointerOut"],["pointerover","pointerOver"],["progress","progress"],["scroll","scroll"],["seeking","seeking"],["stalled","stalled"],["suspend","suspend"],["timeupdate","timeUpdate"],["toggle","toggle"],["touchmove","touchMove"],[ee,"transitionEnd"],["waiting","waiting"],["wheel","wheel"]],vn={},gn={};function bn(e,t){var n=e[0],r="on"+((e=e[1])[0].toUpperCase()+e.slice(1));t={phasedRegistrationNames:{bubbled:r,captured:r+"Capture"},dependencies:[n],isInteractive:t},vn[e]=t,gn[n]=t}[["blur","blur"],["cancel","cancel"],["click","click"],["close","close"],["contextmenu","contextMenu"],["copy","copy"],["cut","cut"],["auxclick","auxClick"],["dblclick","doubleClick"],["dragend","dragEnd"],["dragstart","dragStart"],["drop","drop"],["focus","focus"],["input","input"],["invalid","invalid"],["keydown","keyDown"],["keypress","keyPress"],["keyup","keyUp"],["mousedown","mouseDown"],["mouseup","mouseUp"],["paste","paste"],["pause","pause"],["play","play"],["pointercancel","pointerCancel"],["pointerdown","pointerDown"],["pointerup","pointerUp"],["ratechange","rateChange"],["reset","reset"],["seeked","seeked"],["submit","submit"],["touchcancel","touchCancel"],["touchend","touchEnd"],["touchstart","touchStart"],["volumechange","volumeChange"]].forEach(function(e){bn(e,!0)}),yn.forEach(function(e){bn(e,!1)});var kn={eventTypes:vn,isInteractiveTopLevelEventType:function(e){return void 0!==(e=gn[e])&&!0===e.isInteractive},extractEvents:function(e,t,n,r){var l=gn[e];if(!l)return null;switch(e){case"keypress":if(0===un(n))return null;case"keydown":case"keyup":e=fn;break;case"blur":case"focus":e=an;break;case"click":if(2===n.button)return null;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":e=qt;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":e=dn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":e=pn;break;case G:case J:case Z:e=ln;break;case ee:e=mn;break;case"scroll":e=jt;break;case"wheel":e=hn;break;case"copy":case"cut":case"paste":e=on;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":e=Yt;break;default:e=ue}return H(t=e.getPooled(l,t,n,r)),t}},wn=kn.isInteractiveTopLevelEventType,xn=[];function Tn(e){var t=e.targetInst,n=t;do{if(!n){e.ancestors.push(n);break}var r;for(r=n;r.return;)r=r.return;if(!(r=3!==r.tag?null:r.stateNode.containerInfo))break;e.ancestors.push(n),n=U(r)}while(n);for(n=0;n<e.ancestors.length;n++){t=e.ancestors[n];var l=Ae(e.nativeEvent);r=e.topLevelType;for(var i=e.nativeEvent,o=null,a=0;a<v.length;a++){var u=v[a];u&&(u=u.extractEvents(r,t,i,l))&&(o=_(o,u))}z(o)}}var Sn=!0;function _n(e,t){if(!t)return null;var n=(wn(e)?Cn:Pn).bind(null,e);t.addEventListener(e,n,!1)}function En(e,t){if(!t)return null;var n=(wn(e)?Cn:Pn).bind(null,e);t.addEventListener(e,n,!0)}function Cn(e,t){Me(Pn,e,t)}function Pn(e,t){if(Sn){var n=Ae(t);if(null===(n=U(n))||"number"!==typeof n.tag||2===tn(n)||(n=null),xn.length){var r=xn.pop();r.topLevelType=e,r.nativeEvent=t,r.targetInst=n,e=r}else e={topLevelType:e,nativeEvent:t,targetInst:n,ancestors:[]};try{De(Tn,e)}finally{e.topLevelType=null,e.nativeEvent=null,e.targetInst=null,e.ancestors.length=0,10>xn.length&&xn.push(e)}}}var Nn={},On=0,zn="_reactListenersID"+(""+Math.random()).slice(2);function Rn(e){return Object.prototype.hasOwnProperty.call(e,zn)||(e[zn]=On++,Nn[e[zn]]={}),Nn[e[zn]]}function Mn(e){if("undefined"===typeof(e=e||("undefined"!==typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function In(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Un(e,t){var n,r=In(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=In(r)}}function Dn(){for(var e=window,t=Mn();t instanceof e.HTMLIFrameElement;){try{e=t.contentDocument.defaultView}catch(n){break}t=Mn(e.document)}return t}function Fn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function Ln(e){var t=Dn(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&function e(t,n){return!(!t||!n)&&(t===n||(!t||3!==t.nodeType)&&(n&&3===n.nodeType?e(t,n.parentNode):"contains"in t?t.contains(n):!!t.compareDocumentPosition&&!!(16&t.compareDocumentPosition(n))))}(n.ownerDocument.documentElement,n)){if(null!==r&&Fn(n))if(t=r.start,void 0===(e=r.end)&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if((e=(t=n.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var l=n.textContent.length,i=Math.min(r.start,l);r=void 0===r.end?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=Un(n,i);var o=Un(n,r);l&&o&&(1!==e.rangeCount||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&((t=t.createRange()).setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"===typeof n.focus&&n.focus(),n=0;n<t.length;n++)(e=t[n]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var An=$&&"documentMode"in document&&11>=document.documentMode,jn={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Wn=null,Vn=null,Bn=null,Hn=!1;function $n(e,t){var n=t.window===t?t.document:9===t.nodeType?t:t.ownerDocument;return Hn||null==Wn||Wn!==Mn(n)?null:("selectionStart"in(n=Wn)&&Fn(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},Bn&&en(Bn,n)?null:(Bn=n,(e=ue.getPooled(jn.select,Vn,e,t)).type="select",e.target=Wn,H(e),e))}var Qn={eventTypes:jn,extractEvents:function(e,t,n,r){var l,i=r.window===r?r.document:9===r.nodeType?r:r.ownerDocument;if(!(l=!i)){e:{i=Rn(i),l=k.onSelect;for(var o=0;o<l.length;o++){var a=l[o];if(!i.hasOwnProperty(a)||!i[a]){i=!1;break e}}i=!0}l=!i}if(l)return null;switch(i=t?F(t):window,e){case"focus":(Le(i)||"true"===i.contentEditable)&&(Wn=i,Vn=t,Bn=null);break;case"blur":Bn=Vn=Wn=null;break;case"mousedown":Hn=!0;break;case"contextmenu":case"mouseup":case"dragend":return Hn=!1,$n(n,r);case"selectionchange":if(An)break;case"keydown":case"keyup":return $n(n,r)}return null}};function Kn(e,t){return e=l({children:void 0},t),(t=function(e){var t="";return r.Children.forEach(e,function(e){null!=e&&(t+=e)}),t}(t.children))&&(e.children=t),e}function qn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l<n.length;l++)t["$"+n[l]]=!0;for(n=0;n<e.length;n++)l=t.hasOwnProperty("$"+e[n].value),e[n].selected!==l&&(e[n].selected=l),l&&r&&(e[n].defaultSelected=!0)}else{for(n=""+gt(n),t=null,l=0;l<e.length;l++){if(e[l].value===n)return e[l].selected=!0,void(r&&(e[l].defaultSelected=!0));null!==t||e[l].disabled||(t=e[l])}null!==t&&(t.selected=!0)}}function Yn(e,t){return null!=t.dangerouslySetInnerHTML&&o("91"),l({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Xn(e,t){var n=t.value;null==n&&(n=t.defaultValue,null!=(t=t.children)&&(null!=n&&o("92"),Array.isArray(t)&&(1>=t.length||o("93"),t=t[0]),n=t),null==n&&(n="")),e._wrapperState={initialValue:gt(n)}}function Gn(e,t){var n=gt(t.value),r=gt(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function Jn(e){var t=e.textContent;t===e._wrapperState.initialValue&&(e.value=t)}N.injectEventPluginOrder("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" ")),w=L,x=D,T=F,N.injectEventPluginsByName({SimpleEventPlugin:kn,EnterLeaveEventPlugin:Gt,ChangeEventPlugin:At,SelectEventPlugin:Qn,BeforeInputEventPlugin:_e});var Zn={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function er(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function tr(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?er(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var nr,rr=void 0,lr=(nr=function(e,t){if(e.namespaceURI!==Zn.svg||"innerHTML"in e)e.innerHTML=t;else{for((rr=rr||document.createElement("div")).innerHTML="<svg>"+t+"</svg>",t=rr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction(function(){return nr(e,t)})}:nr);function ir(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var or={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ar=["Webkit","ms","Moz","O"];function ur(e,t,n){return null==t||"boolean"===typeof t||""===t?"":n||"number"!==typeof t||0===t||or.hasOwnProperty(e)&&or[e]?(""+t).trim():t+"px"}function cr(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),l=ur(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}Object.keys(or).forEach(function(e){ar.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),or[t]=or[e]})});var sr=l({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function fr(e,t){t&&(sr[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML)&&o("137",e,""),null!=t.dangerouslySetInnerHTML&&(null!=t.children&&o("60"),"object"===typeof t.dangerouslySetInnerHTML&&"__html"in t.dangerouslySetInnerHTML||o("61")),null!=t.style&&"object"!==typeof t.style&&o("62",""))}function dr(e,t){if(-1===e.indexOf("-"))return"string"===typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function pr(e,t){var n=Rn(e=9===e.nodeType||11===e.nodeType?e:e.ownerDocument);t=k[t];for(var r=0;r<t.length;r++){var l=t[r];if(!n.hasOwnProperty(l)||!n[l]){switch(l){case"scroll":En("scroll",e);break;case"focus":case"blur":En("focus",e),En("blur",e),n.blur=!0,n.focus=!0;break;case"cancel":case"close":je(l)&&En(l,e);break;case"invalid":case"submit":case"reset":break;default:-1===te.indexOf(l)&&_n(l,e)}n[l]=!0}}}function mr(){}var hr=null,yr=null;function vr(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function gr(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"===typeof t.children||"number"===typeof t.children||"object"===typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var br="function"===typeof setTimeout?setTimeout:void 0,kr="function"===typeof clearTimeout?clearTimeout:void 0,wr=i.unstable_scheduleCallback,xr=i.unstable_cancelCallback;function Tr(e){for(e=e.nextSibling;e&&1!==e.nodeType&&3!==e.nodeType;)e=e.nextSibling;return e}function Sr(e){for(e=e.firstChild;e&&1!==e.nodeType&&3!==e.nodeType;)e=e.nextSibling;return e}new Set;var _r=[],Er=-1;function Cr(e){0>Er||(e.current=_r[Er],_r[Er]=null,Er--)}function Pr(e,t){_r[++Er]=e.current,e.current=t}var Nr={},Or={current:Nr},zr={current:!1},Rr=Nr;function Mr(e,t){var n=e.type.contextTypes;if(!n)return Nr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l,i={};for(l in n)i[l]=t[l];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Ir(e){return null!==(e=e.childContextTypes)&&void 0!==e}function Ur(e){Cr(zr),Cr(Or)}function Dr(e){Cr(zr),Cr(Or)}function Fr(e,t,n){Or.current!==Nr&&o("168"),Pr(Or,t),Pr(zr,n)}function Lr(e,t,n){var r=e.stateNode;if(e=t.childContextTypes,"function"!==typeof r.getChildContext)return n;for(var i in r=r.getChildContext())i in e||o("108",at(t)||"Unknown",i);return l({},n,r)}function Ar(e){var t=e.stateNode;return t=t&&t.__reactInternalMemoizedMergedChildContext||Nr,Rr=Or.current,Pr(Or,t),Pr(zr,zr.current),!0}function jr(e,t,n){var r=e.stateNode;r||o("169"),n?(t=Lr(e,t,Rr),r.__reactInternalMemoizedMergedChildContext=t,Cr(zr),Cr(Or),Pr(Or,t)):Cr(zr),Pr(zr,n)}var Wr=null,Vr=null;function Br(e){return function(t){try{return e(t)}catch(n){}}}function Hr(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.contextDependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childExpirationTime=this.expirationTime=0,this.alternate=null}function $r(e,t,n,r){return new Hr(e,t,n,r)}function Qr(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Kr(e,t){var n=e.alternate;return null===n?((n=$r(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.effectTag=0,n.nextEffect=null,n.firstEffect=null,n.lastEffect=null),n.childExpirationTime=e.childExpirationTime,n.expirationTime=e.expirationTime,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,n.contextDependencies=e.contextDependencies,n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function qr(e,t,n,r,l,i){var a=2;if(r=e,"function"===typeof e)Qr(e)&&(a=1);else if("string"===typeof e)a=5;else e:switch(e){case Ye:return Yr(n.children,l,i,t);case et:return Xr(n,3|l,i,t);case Xe:return Xr(n,2|l,i,t);case Ge:return(e=$r(12,n,t,4|l)).elementType=Ge,e.type=Ge,e.expirationTime=i,e;case nt:return(e=$r(13,n,t,l)).elementType=nt,e.type=nt,e.expirationTime=i,e;default:if("object"===typeof e&&null!==e)switch(e.$$typeof){case Je:a=10;break e;case Ze:a=9;break e;case tt:a=11;break e;case rt:a=14;break e;case lt:a=16,r=null;break e}o("130",null==e?e:typeof e,"")}return(t=$r(a,n,t,l)).elementType=e,t.type=r,t.expirationTime=i,t}function Yr(e,t,n,r){return(e=$r(7,e,r,t)).expirationTime=n,e}function Xr(e,t,n,r){return e=$r(8,e,r,t),t=0===(1&t)?Xe:et,e.elementType=t,e.type=t,e.expirationTime=n,e}function Gr(e,t,n){return(e=$r(6,e,null,t)).expirationTime=n,e}function Jr(e,t,n){return(t=$r(4,null!==e.children?e.children:[],e.key,t)).expirationTime=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Zr(e,t){e.didError=!1;var n=e.earliestPendingTime;0===n?e.earliestPendingTime=e.latestPendingTime=t:n<t?e.earliestPendingTime=t:e.latestPendingTime>t&&(e.latestPendingTime=t),nl(t,e)}function el(e,t){e.didError=!1,e.latestPingedTime>=t&&(e.latestPingedTime=0);var n=e.earliestPendingTime,r=e.latestPendingTime;n===t?e.earliestPendingTime=r===t?e.latestPendingTime=0:r:r===t&&(e.latestPendingTime=n),n=e.earliestSuspendedTime,r=e.latestSuspendedTime,0===n?e.earliestSuspendedTime=e.latestSuspendedTime=t:n<t?e.earliestSuspendedTime=t:r>t&&(e.latestSuspendedTime=t),nl(t,e)}function tl(e,t){var n=e.earliestPendingTime;return n>t&&(t=n),(e=e.earliestSuspendedTime)>t&&(t=e),t}function nl(e,t){var n=t.earliestSuspendedTime,r=t.latestSuspendedTime,l=t.earliestPendingTime,i=t.latestPingedTime;0===(l=0!==l?l:i)&&(0===e||r<e)&&(l=r),0!==(e=l)&&n>e&&(e=n),t.nextExpirationTimeToWorkOn=l,t.expirationTime=e}function rl(e,t){if(e&&e.defaultProps)for(var n in t=l({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}var ll=(new r.Component).refs;function il(e,t,n,r){n=null===(n=n(r,t=e.memoizedState))||void 0===n?t:l({},t,n),e.memoizedState=n,null!==(r=e.updateQueue)&&0===e.expirationTime&&(r.baseState=n)}var ol={isMounted:function(e){return!!(e=e._reactInternalFiber)&&2===tn(e)},enqueueSetState:function(e,t,n){e=e._reactInternalFiber;var r=xa(),l=Yi(r=Yo(r,e));l.payload=t,void 0!==n&&null!==n&&(l.callback=n),Bo(),Gi(e,l),Jo(e,r)},enqueueReplaceState:function(e,t,n){e=e._reactInternalFiber;var r=xa(),l=Yi(r=Yo(r,e));l.tag=Bi,l.payload=t,void 0!==n&&null!==n&&(l.callback=n),Bo(),Gi(e,l),Jo(e,r)},enqueueForceUpdate:function(e,t){e=e._reactInternalFiber;var n=xa(),r=Yi(n=Yo(n,e));r.tag=Hi,void 0!==t&&null!==t&&(r.callback=t),Bo(),Gi(e,r),Jo(e,n)}};function al(e,t,n,r,l,i,o){return"function"===typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,i,o):!t.prototype||!t.prototype.isPureReactComponent||(!en(n,r)||!en(l,i))}function ul(e,t,n){var r=!1,l=Nr,i=t.contextType;return"object"===typeof i&&null!==i?i=Wi(i):(l=Ir(t)?Rr:Or.current,i=(r=null!==(r=t.contextTypes)&&void 0!==r)?Mr(e,l):Nr),t=new t(n,i),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=ol,e.stateNode=t,t._reactInternalFiber=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=l,e.__reactInternalMemoizedMaskedChildContext=i),t}function cl(e,t,n,r){e=t.state,"function"===typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"===typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&ol.enqueueReplaceState(t,t.state,null)}function sl(e,t,n,r){var l=e.stateNode;l.props=n,l.state=e.memoizedState,l.refs=ll;var i=t.contextType;"object"===typeof i&&null!==i?l.context=Wi(i):(i=Ir(t)?Rr:Or.current,l.context=Mr(e,i)),null!==(i=e.updateQueue)&&(to(e,i,n,l,r),l.state=e.memoizedState),"function"===typeof(i=t.getDerivedStateFromProps)&&(il(e,t,i,n),l.state=e.memoizedState),"function"===typeof t.getDerivedStateFromProps||"function"===typeof l.getSnapshotBeforeUpdate||"function"!==typeof l.UNSAFE_componentWillMount&&"function"!==typeof l.componentWillMount||(t=l.state,"function"===typeof l.componentWillMount&&l.componentWillMount(),"function"===typeof l.UNSAFE_componentWillMount&&l.UNSAFE_componentWillMount(),t!==l.state&&ol.enqueueReplaceState(l,l.state,null),null!==(i=e.updateQueue)&&(to(e,i,n,l,r),l.state=e.memoizedState)),"function"===typeof l.componentDidMount&&(e.effectTag|=4)}var fl=Array.isArray;function dl(e,t,n){if(null!==(e=n.ref)&&"function"!==typeof e&&"object"!==typeof e){if(n._owner){n=n._owner;var r=void 0;n&&(1!==n.tag&&o("309"),r=n.stateNode),r||o("147",e);var l=""+e;return null!==t&&null!==t.ref&&"function"===typeof t.ref&&t.ref._stringRef===l?t.ref:((t=function(e){var t=r.refs;t===ll&&(t=r.refs={}),null===e?delete t[l]:t[l]=e})._stringRef=l,t)}"string"!==typeof e&&o("284"),n._owner||o("290",e)}return e}function pl(e,t){"textarea"!==e.type&&o("31","[object Object]"===Object.prototype.toString.call(t)?"object with keys {"+Object.keys(t).join(", ")+"}":t,"")}function ml(e){function t(t,n){if(e){var r=t.lastEffect;null!==r?(r.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n,n.nextEffect=null,n.effectTag=8}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function l(e,t,n){return(e=Kr(e,t)).index=0,e.sibling=null,e}function i(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.effectTag=2,n):r:(t.effectTag=2,n):n}function a(t){return e&&null===t.alternate&&(t.effectTag=2),t}function u(e,t,n,r){return null===t||6!==t.tag?((t=Gr(n,e.mode,r)).return=e,t):((t=l(t,n)).return=e,t)}function c(e,t,n,r){return null!==t&&t.elementType===n.type?((r=l(t,n.props)).ref=dl(e,t,n),r.return=e,r):((r=qr(n.type,n.key,n.props,null,e.mode,r)).ref=dl(e,t,n),r.return=e,r)}function s(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Jr(n,e.mode,r)).return=e,t):((t=l(t,n.children||[])).return=e,t)}function f(e,t,n,r,i){return null===t||7!==t.tag?((t=Yr(n,e.mode,r,i)).return=e,t):((t=l(t,n)).return=e,t)}function d(e,t,n){if("string"===typeof t||"number"===typeof t)return(t=Gr(""+t,e.mode,n)).return=e,t;if("object"===typeof t&&null!==t){switch(t.$$typeof){case Ke:return(n=qr(t.type,t.key,t.props,null,e.mode,n)).ref=dl(e,null,t),n.return=e,n;case qe:return(t=Jr(t,e.mode,n)).return=e,t}if(fl(t)||ot(t))return(t=Yr(t,e.mode,n,null)).return=e,t;pl(e,t)}return null}function p(e,t,n,r){var l=null!==t?t.key:null;if("string"===typeof n||"number"===typeof n)return null!==l?null:u(e,t,""+n,r);if("object"===typeof n&&null!==n){switch(n.$$typeof){case Ke:return n.key===l?n.type===Ye?f(e,t,n.props.children,r,l):c(e,t,n,r):null;case qe:return n.key===l?s(e,t,n,r):null}if(fl(n)||ot(n))return null!==l?null:f(e,t,n,r,null);pl(e,n)}return null}function m(e,t,n,r,l){if("string"===typeof r||"number"===typeof r)return u(t,e=e.get(n)||null,""+r,l);if("object"===typeof r&&null!==r){switch(r.$$typeof){case Ke:return e=e.get(null===r.key?n:r.key)||null,r.type===Ye?f(t,e,r.props.children,l,r.key):c(t,e,r,l);case qe:return s(t,e=e.get(null===r.key?n:r.key)||null,r,l)}if(fl(r)||ot(r))return f(t,e=e.get(n)||null,r,l,null);pl(t,r)}return null}function h(l,o,a,u){for(var c=null,s=null,f=o,h=o=0,y=null;null!==f&&h<a.length;h++){f.index>h?(y=f,f=null):y=f.sibling;var v=p(l,f,a[h],u);if(null===v){null===f&&(f=y);break}e&&f&&null===v.alternate&&t(l,f),o=i(v,o,h),null===s?c=v:s.sibling=v,s=v,f=y}if(h===a.length)return n(l,f),c;if(null===f){for(;h<a.length;h++)(f=d(l,a[h],u))&&(o=i(f,o,h),null===s?c=f:s.sibling=f,s=f);return c}for(f=r(l,f);h<a.length;h++)(y=m(f,l,h,a[h],u))&&(e&&null!==y.alternate&&f.delete(null===y.key?h:y.key),o=i(y,o,h),null===s?c=y:s.sibling=y,s=y);return e&&f.forEach(function(e){return t(l,e)}),c}function y(l,a,u,c){var s=ot(u);"function"!==typeof s&&o("150"),null==(u=s.call(u))&&o("151");for(var f=s=null,h=a,y=a=0,v=null,g=u.next();null!==h&&!g.done;y++,g=u.next()){h.index>y?(v=h,h=null):v=h.sibling;var b=p(l,h,g.value,c);if(null===b){h||(h=v);break}e&&h&&null===b.alternate&&t(l,h),a=i(b,a,y),null===f?s=b:f.sibling=b,f=b,h=v}if(g.done)return n(l,h),s;if(null===h){for(;!g.done;y++,g=u.next())null!==(g=d(l,g.value,c))&&(a=i(g,a,y),null===f?s=g:f.sibling=g,f=g);return s}for(h=r(l,h);!g.done;y++,g=u.next())null!==(g=m(h,l,y,g.value,c))&&(e&&null!==g.alternate&&h.delete(null===g.key?y:g.key),a=i(g,a,y),null===f?s=g:f.sibling=g,f=g);return e&&h.forEach(function(e){return t(l,e)}),s}return function(e,r,i,u){var c="object"===typeof i&&null!==i&&i.type===Ye&&null===i.key;c&&(i=i.props.children);var s="object"===typeof i&&null!==i;if(s)switch(i.$$typeof){case Ke:e:{for(s=i.key,c=r;null!==c;){if(c.key===s){if(7===c.tag?i.type===Ye:c.elementType===i.type){n(e,c.sibling),(r=l(c,i.type===Ye?i.props.children:i.props)).ref=dl(e,c,i),r.return=e,e=r;break e}n(e,c);break}t(e,c),c=c.sibling}i.type===Ye?((r=Yr(i.props.children,e.mode,u,i.key)).return=e,e=r):((u=qr(i.type,i.key,i.props,null,e.mode,u)).ref=dl(e,r,i),u.return=e,e=u)}return a(e);case qe:e:{for(c=i.key;null!==r;){if(r.key===c){if(4===r.tag&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),(r=l(r,i.children||[])).return=e,e=r;break e}n(e,r);break}t(e,r),r=r.sibling}(r=Jr(i,e.mode,u)).return=e,e=r}return a(e)}if("string"===typeof i||"number"===typeof i)return i=""+i,null!==r&&6===r.tag?(n(e,r.sibling),(r=l(r,i)).return=e,e=r):(n(e,r),(r=Gr(i,e.mode,u)).return=e,e=r),a(e);if(fl(i))return h(e,r,i,u);if(ot(i))return y(e,r,i,u);if(s&&pl(e,i),"undefined"===typeof i&&!c)switch(e.tag){case 1:case 0:o("152",(u=e.type).displayName||u.name||"Component")}return n(e,r)}}var hl=ml(!0),yl=ml(!1),vl={},gl={current:vl},bl={current:vl},kl={current:vl};function wl(e){return e===vl&&o("174"),e}function xl(e,t){Pr(kl,t),Pr(bl,e),Pr(gl,vl);var n=t.nodeType;switch(n){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:tr(null,"");break;default:t=tr(t=(n=8===n?t.parentNode:t).namespaceURI||null,n=n.tagName)}Cr(gl),Pr(gl,t)}function Tl(e){Cr(gl),Cr(bl),Cr(kl)}function Sl(e){wl(kl.current);var t=wl(gl.current),n=tr(t,e.type);t!==n&&(Pr(bl,e),Pr(gl,n))}function _l(e){bl.current===e&&(Cr(gl),Cr(bl))}var El=0,Cl=2,Pl=4,Nl=8,Ol=16,zl=32,Rl=64,Ml=128,Il=He.ReactCurrentDispatcher,Ul=0,Dl=null,Fl=null,Ll=null,Al=null,jl=null,Wl=null,Vl=0,Bl=null,Hl=0,$l=!1,Ql=null,Kl=0;function ql(){o("307")}function Yl(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Jt(e[n],t[n]))return!1;return!0}function Xl(e,t,n,r,l,i){if(Ul=i,Dl=t,Ll=null!==e?e.memoizedState:null,Il.current=null===Ll?ci:si,t=n(r,l),$l){do{$l=!1,Kl+=1,Ll=null!==e?e.memoizedState:null,Wl=Al,Bl=jl=Fl=null,Il.current=si,t=n(r,l)}while($l);Ql=null,Kl=0}return Il.current=ui,(e=Dl).memoizedState=Al,e.expirationTime=Vl,e.updateQueue=Bl,e.effectTag|=Hl,e=null!==Fl&&null!==Fl.next,Ul=0,Wl=jl=Al=Ll=Fl=Dl=null,Vl=0,Bl=null,Hl=0,e&&o("300"),t}function Gl(){Il.current=ui,Ul=0,Wl=jl=Al=Ll=Fl=Dl=null,Vl=0,Bl=null,Hl=0,$l=!1,Ql=null,Kl=0}function Jl(){var e={memoizedState:null,baseState:null,queue:null,baseUpdate:null,next:null};return null===jl?Al=jl=e:jl=jl.next=e,jl}function Zl(){if(null!==Wl)Wl=(jl=Wl).next,Ll=null!==(Fl=Ll)?Fl.next:null;else{null===Ll&&o("310");var e={memoizedState:(Fl=Ll).memoizedState,baseState:Fl.baseState,queue:Fl.queue,baseUpdate:Fl.baseUpdate,next:null};jl=null===jl?Al=e:jl.next=e,Ll=Fl.next}return jl}function ei(e,t){return"function"===typeof t?t(e):t}function ti(e){var t=Zl(),n=t.queue;if(null===n&&o("311"),0<Kl){var r=n.dispatch;if(null!==Ql){var l=Ql.get(n);if(void 0!==l){Ql.delete(n);var i=t.memoizedState;do{i=e(i,l.action),l=l.next}while(null!==l);return Jt(i,t.memoizedState)||(wi=!0),t.memoizedState=i,t.baseUpdate===n.last&&(t.baseState=i),[i,r]}}return[t.memoizedState,r]}r=n.last;var a=t.baseUpdate;if(i=t.baseState,null!==a?(null!==r&&(r.next=null),r=a.next):r=null!==r?r.next:null,null!==r){var u=l=null,c=r,s=!1;do{var f=c.expirationTime;f<Ul?(s||(s=!0,u=a,l=i),f>Vl&&(Vl=f)):i=c.eagerReducer===e?c.eagerState:e(i,c.action),a=c,c=c.next}while(null!==c&&c!==r);s||(u=a,l=i),Jt(i,t.memoizedState)||(wi=!0),t.memoizedState=i,t.baseUpdate=u,t.baseState=l,n.eagerReducer=e,n.eagerState=i}return[t.memoizedState,n.dispatch]}function ni(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===Bl?(Bl={lastEffect:null}).lastEffect=e.next=e:null===(t=Bl.lastEffect)?Bl.lastEffect=e.next=e:(n=t.next,t.next=e,e.next=n,Bl.lastEffect=e),e}function ri(e,t,n,r){var l=Jl();Hl|=e,l.memoizedState=ni(t,n,void 0,void 0===r?null:r)}function li(e,t,n,r){var l=Zl();r=void 0===r?null:r;var i=void 0;if(null!==Fl){var o=Fl.memoizedState;if(i=o.destroy,null!==r&&Yl(r,o.deps))return void ni(El,n,i,r)}Hl|=e,l.memoizedState=ni(t,n,i,r)}function ii(e,t){return"function"===typeof t?(e=e(),t(e),function(){t(null)}):null!==t&&void 0!==t?(e=e(),t.current=e,function(){t.current=null}):void 0}function oi(){}function ai(e,t,n){25>Kl||o("301");var r=e.alternate;if(e===Dl||null!==r&&r===Dl)if($l=!0,e={expirationTime:Ul,action:n,eagerReducer:null,eagerState:null,next:null},null===Ql&&(Ql=new Map),void 0===(n=Ql.get(t)))Ql.set(t,e);else{for(t=n;null!==t.next;)t=t.next;t.next=e}else{Bo();var l=xa(),i={expirationTime:l=Yo(l,e),action:n,eagerReducer:null,eagerState:null,next:null},a=t.last;if(null===a)i.next=i;else{var u=a.next;null!==u&&(i.next=u),a.next=i}if(t.last=i,0===e.expirationTime&&(null===r||0===r.expirationTime)&&null!==(r=t.eagerReducer))try{var c=t.eagerState,s=r(c,n);if(i.eagerReducer=r,i.eagerState=s,Jt(s,c))return}catch(f){}Jo(e,l)}}var ui={readContext:Wi,useCallback:ql,useContext:ql,useEffect:ql,useImperativeHandle:ql,useLayoutEffect:ql,useMemo:ql,useReducer:ql,useRef:ql,useState:ql,useDebugValue:ql},ci={readContext:Wi,useCallback:function(e,t){return Jl().memoizedState=[e,void 0===t?null:t],e},useContext:Wi,useEffect:function(e,t){return ri(516,Ml|Rl,e,t)},useImperativeHandle:function(e,t,n){return n=null!==n&&void 0!==n?n.concat([e]):null,ri(4,Pl|zl,ii.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ri(4,Pl|zl,e,t)},useMemo:function(e,t){var n=Jl();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Jl();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e=(e=r.queue={last:null,dispatch:null,eagerReducer:e,eagerState:t}).dispatch=ai.bind(null,Dl,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},Jl().memoizedState=e},useState:function(e){var t=Jl();return"function"===typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={last:null,dispatch:null,eagerReducer:ei,eagerState:e}).dispatch=ai.bind(null,Dl,e),[t.memoizedState,e]},useDebugValue:oi},si={readContext:Wi,useCallback:function(e,t){var n=Zl();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&Yl(t,r[1])?r[0]:(n.memoizedState=[e,t],e)},useContext:Wi,useEffect:function(e,t){return li(516,Ml|Rl,e,t)},useImperativeHandle:function(e,t,n){return n=null!==n&&void 0!==n?n.concat([e]):null,li(4,Pl|zl,ii.bind(null,t,e),n)},useLayoutEffect:function(e,t){return li(4,Pl|zl,e,t)},useMemo:function(e,t){var n=Zl();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&Yl(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)},useReducer:ti,useRef:function(){return Zl().memoizedState},useState:function(e){return ti(ei)},useDebugValue:oi},fi=null,di=null,pi=!1;function mi(e,t){var n=$r(5,null,null,0);n.elementType="DELETED",n.type="DELETED",n.stateNode=t,n.return=e,n.effectTag=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function hi(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,!0);case 13:default:return!1}}function yi(e){if(pi){var t=di;if(t){var n=t;if(!hi(e,t)){if(!(t=Tr(n))||!hi(e,t))return e.effectTag|=2,pi=!1,void(fi=e);mi(fi,n)}fi=e,di=Sr(t)}else e.effectTag|=2,pi=!1,fi=e}}function vi(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&18!==e.tag;)e=e.return;fi=e}function gi(e){if(e!==fi)return!1;if(!pi)return vi(e),pi=!0,!1;var t=e.type;if(5!==e.tag||"head"!==t&&"body"!==t&&!gr(t,e.memoizedProps))for(t=di;t;)mi(e,t),t=Tr(t);return vi(e),di=fi?Tr(e.stateNode):null,!0}function bi(){di=fi=null,pi=!1}var ki=He.ReactCurrentOwner,wi=!1;function xi(e,t,n,r){t.child=null===e?yl(t,null,n,r):hl(t,e.child,n,r)}function Ti(e,t,n,r,l){n=n.render;var i=t.ref;return ji(t,l),r=Xl(e,t,n,r,i,l),null===e||wi?(t.effectTag|=1,xi(e,t,r,l),t.child):(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=l&&(e.expirationTime=0),Ri(e,t,l))}function Si(e,t,n,r,l,i){if(null===e){var o=n.type;return"function"!==typeof o||Qr(o)||void 0!==o.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=qr(n.type,null,r,null,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,_i(e,t,o,r,l,i))}return o=e.child,l<i&&(l=o.memoizedProps,(n=null!==(n=n.compare)?n:en)(l,r)&&e.ref===t.ref)?Ri(e,t,i):(t.effectTag|=1,(e=Kr(o,r)).ref=t.ref,e.return=t,t.child=e)}function _i(e,t,n,r,l,i){return null!==e&&en(e.memoizedProps,r)&&e.ref===t.ref&&(wi=!1,l<i)?Ri(e,t,i):Ci(e,t,n,r,i)}function Ei(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.effectTag|=128)}function Ci(e,t,n,r,l){var i=Ir(n)?Rr:Or.current;return i=Mr(t,i),ji(t,l),n=Xl(e,t,n,r,i,l),null===e||wi?(t.effectTag|=1,xi(e,t,n,l),t.child):(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=l&&(e.expirationTime=0),Ri(e,t,l))}function Pi(e,t,n,r,l){if(Ir(n)){var i=!0;Ar(t)}else i=!1;if(ji(t,l),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),ul(t,n,r),sl(t,n,r,l),r=!0;else if(null===e){var o=t.stateNode,a=t.memoizedProps;o.props=a;var u=o.context,c=n.contextType;"object"===typeof c&&null!==c?c=Wi(c):c=Mr(t,c=Ir(n)?Rr:Or.current);var s=n.getDerivedStateFromProps,f="function"===typeof s||"function"===typeof o.getSnapshotBeforeUpdate;f||"function"!==typeof o.UNSAFE_componentWillReceiveProps&&"function"!==typeof o.componentWillReceiveProps||(a!==r||u!==c)&&cl(t,o,r,c),Qi=!1;var d=t.memoizedState;u=o.state=d;var p=t.updateQueue;null!==p&&(to(t,p,r,o,l),u=t.memoizedState),a!==r||d!==u||zr.current||Qi?("function"===typeof s&&(il(t,n,s,r),u=t.memoizedState),(a=Qi||al(t,n,a,r,d,u,c))?(f||"function"!==typeof o.UNSAFE_componentWillMount&&"function"!==typeof o.componentWillMount||("function"===typeof o.componentWillMount&&o.componentWillMount(),"function"===typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount()),"function"===typeof o.componentDidMount&&(t.effectTag|=4)):("function"===typeof o.componentDidMount&&(t.effectTag|=4),t.memoizedProps=r,t.memoizedState=u),o.props=r,o.state=u,o.context=c,r=a):("function"===typeof o.componentDidMount&&(t.effectTag|=4),r=!1)}else o=t.stateNode,a=t.memoizedProps,o.props=t.type===t.elementType?a:rl(t.type,a),u=o.context,"object"===typeof(c=n.contextType)&&null!==c?c=Wi(c):c=Mr(t,c=Ir(n)?Rr:Or.current),(f="function"===typeof(s=n.getDerivedStateFromProps)||"function"===typeof o.getSnapshotBeforeUpdate)||"function"!==typeof o.UNSAFE_componentWillReceiveProps&&"function"!==typeof o.componentWillReceiveProps||(a!==r||u!==c)&&cl(t,o,r,c),Qi=!1,u=t.memoizedState,d=o.state=u,null!==(p=t.updateQueue)&&(to(t,p,r,o,l),d=t.memoizedState),a!==r||u!==d||zr.current||Qi?("function"===typeof s&&(il(t,n,s,r),d=t.memoizedState),(s=Qi||al(t,n,a,r,u,d,c))?(f||"function"!==typeof o.UNSAFE_componentWillUpdate&&"function"!==typeof o.componentWillUpdate||("function"===typeof o.componentWillUpdate&&o.componentWillUpdate(r,d,c),"function"===typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(r,d,c)),"function"===typeof o.componentDidUpdate&&(t.effectTag|=4),"function"===typeof o.getSnapshotBeforeUpdate&&(t.effectTag|=256)):("function"!==typeof o.componentDidUpdate||a===e.memoizedProps&&u===e.memoizedState||(t.effectTag|=4),"function"!==typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&u===e.memoizedState||(t.effectTag|=256),t.memoizedProps=r,t.memoizedState=d),o.props=r,o.state=d,o.context=c,r=s):("function"!==typeof o.componentDidUpdate||a===e.memoizedProps&&u===e.memoizedState||(t.effectTag|=4),"function"!==typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&u===e.memoizedState||(t.effectTag|=256),r=!1);return Ni(e,t,n,r,i,l)}function Ni(e,t,n,r,l,i){Ei(e,t);var o=0!==(64&t.effectTag);if(!r&&!o)return l&&jr(t,n,!1),Ri(e,t,i);r=t.stateNode,ki.current=t;var a=o&&"function"!==typeof n.getDerivedStateFromError?null:r.render();return t.effectTag|=1,null!==e&&o?(t.child=hl(t,e.child,null,i),t.child=hl(t,null,a,i)):xi(e,t,a,i),t.memoizedState=r.state,l&&jr(t,n,!0),t.child}function Oi(e){var t=e.stateNode;t.pendingContext?Fr(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Fr(0,t.context,!1),xl(e,t.containerInfo)}function zi(e,t,n){var r=t.mode,l=t.pendingProps,i=t.memoizedState;if(0===(64&t.effectTag)){i=null;var o=!1}else i={timedOutAt:null!==i?i.timedOutAt:0},o=!0,t.effectTag&=-65;if(null===e)if(o){var a=l.fallback;e=Yr(null,r,0,null),0===(1&t.mode)&&(e.child=null!==t.memoizedState?t.child.child:t.child),r=Yr(a,r,n,null),e.sibling=r,(n=e).return=r.return=t}else n=r=yl(t,null,l.children,n);else null!==e.memoizedState?(a=(r=e.child).sibling,o?(n=l.fallback,l=Kr(r,r.pendingProps),0===(1&t.mode)&&((o=null!==t.memoizedState?t.child.child:t.child)!==r.child&&(l.child=o)),r=l.sibling=Kr(a,n,a.expirationTime),n=l,l.childExpirationTime=0,n.return=r.return=t):n=r=hl(t,r.child,l.children,n)):(a=e.child,o?(o=l.fallback,(l=Yr(null,r,0,null)).child=a,0===(1&t.mode)&&(l.child=null!==t.memoizedState?t.child.child:t.child),(r=l.sibling=Yr(o,r,n,null)).effectTag|=2,n=l,l.childExpirationTime=0,n.return=r.return=t):r=n=hl(t,a,l.children,n)),t.stateNode=e.stateNode;return t.memoizedState=i,t.child=n,r}function Ri(e,t,n){if(null!==e&&(t.contextDependencies=e.contextDependencies),t.childExpirationTime<n)return null;if(null!==e&&t.child!==e.child&&o("153"),null!==t.child){for(n=Kr(e=t.child,e.pendingProps,e.expirationTime),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Kr(e,e.pendingProps,e.expirationTime)).return=t;n.sibling=null}return t.child}function Mi(e,t,n){var r=t.expirationTime;if(null!==e){if(e.memoizedProps!==t.pendingProps||zr.current)wi=!0;else if(r<n){switch(wi=!1,t.tag){case 3:Oi(t),bi();break;case 5:Sl(t);break;case 1:Ir(t.type)&&Ar(t);break;case 4:xl(t,t.stateNode.containerInfo);break;case 10:Li(t,t.memoizedProps.value);break;case 13:if(null!==t.memoizedState)return 0!==(r=t.child.childExpirationTime)&&r>=n?zi(e,t,n):null!==(t=Ri(e,t,n))?t.sibling:null}return Ri(e,t,n)}}else wi=!1;switch(t.expirationTime=0,t.tag){case 2:r=t.elementType,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps;var l=Mr(t,Or.current);if(ji(t,n),l=Xl(null,t,r,e,l,n),t.effectTag|=1,"object"===typeof l&&null!==l&&"function"===typeof l.render&&void 0===l.$$typeof){if(t.tag=1,Gl(),Ir(r)){var i=!0;Ar(t)}else i=!1;t.memoizedState=null!==l.state&&void 0!==l.state?l.state:null;var a=r.getDerivedStateFromProps;"function"===typeof a&&il(t,r,a,e),l.updater=ol,t.stateNode=l,l._reactInternalFiber=t,sl(t,r,e,n),t=Ni(null,t,r,!0,i,n)}else t.tag=0,xi(null,t,l,n),t=t.child;return t;case 16:switch(l=t.elementType,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),i=t.pendingProps,e=function(e){var t=e._result;switch(e._status){case 1:return t;case 2:case 0:throw t;default:switch(e._status=0,(t=(t=e._ctor)()).then(function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)},function(t){0===e._status&&(e._status=2,e._result=t)}),e._status){case 1:return e._result;case 2:throw e._result}throw e._result=t,t}}(l),t.type=e,l=t.tag=function(e){if("function"===typeof e)return Qr(e)?1:0;if(void 0!==e&&null!==e){if((e=e.$$typeof)===tt)return 11;if(e===rt)return 14}return 2}(e),i=rl(e,i),a=void 0,l){case 0:a=Ci(null,t,e,i,n);break;case 1:a=Pi(null,t,e,i,n);break;case 11:a=Ti(null,t,e,i,n);break;case 14:a=Si(null,t,e,rl(e.type,i),r,n);break;default:o("306",e,"")}return a;case 0:return r=t.type,l=t.pendingProps,Ci(e,t,r,l=t.elementType===r?l:rl(r,l),n);case 1:return r=t.type,l=t.pendingProps,Pi(e,t,r,l=t.elementType===r?l:rl(r,l),n);case 3:return Oi(t),null===(r=t.updateQueue)&&o("282"),l=null!==(l=t.memoizedState)?l.element:null,to(t,r,t.pendingProps,null,n),(r=t.memoizedState.element)===l?(bi(),t=Ri(e,t,n)):(l=t.stateNode,(l=(null===e||null===e.child)&&l.hydrate)&&(di=Sr(t.stateNode.containerInfo),fi=t,l=pi=!0),l?(t.effectTag|=2,t.child=yl(t,null,r,n)):(xi(e,t,r,n),bi()),t=t.child),t;case 5:return Sl(t),null===e&&yi(t),r=t.type,l=t.pendingProps,i=null!==e?e.memoizedProps:null,a=l.children,gr(r,l)?a=null:null!==i&&gr(r,i)&&(t.effectTag|=16),Ei(e,t),1!==n&&1&t.mode&&l.hidden?(t.expirationTime=t.childExpirationTime=1,t=null):(xi(e,t,a,n),t=t.child),t;case 6:return null===e&&yi(t),null;case 13:return zi(e,t,n);case 4:return xl(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=hl(t,null,r,n):xi(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,Ti(e,t,r,l=t.elementType===r?l:rl(r,l),n);case 7:return xi(e,t,t.pendingProps,n),t.child;case 8:case 12:return xi(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,a=t.memoizedProps,Li(t,i=l.value),null!==a){var u=a.value;if(0===(i=Jt(u,i)?0:0|("function"===typeof r._calculateChangedBits?r._calculateChangedBits(u,i):1073741823))){if(a.children===l.children&&!zr.current){t=Ri(e,t,n);break e}}else for(null!==(u=t.child)&&(u.return=t);null!==u;){var c=u.contextDependencies;if(null!==c){a=u.child;for(var s=c.first;null!==s;){if(s.context===r&&0!==(s.observedBits&i)){1===u.tag&&((s=Yi(n)).tag=Hi,Gi(u,s)),u.expirationTime<n&&(u.expirationTime=n),null!==(s=u.alternate)&&s.expirationTime<n&&(s.expirationTime=n),s=n;for(var f=u.return;null!==f;){var d=f.alternate;if(f.childExpirationTime<s)f.childExpirationTime=s,null!==d&&d.childExpirationTime<s&&(d.childExpirationTime=s);else{if(!(null!==d&&d.childExpirationTime<s))break;d.childExpirationTime=s}f=f.return}c.expirationTime<n&&(c.expirationTime=n);break}s=s.next}}else a=10===u.tag&&u.type===t.type?null:u.child;if(null!==a)a.return=u;else for(a=u;null!==a;){if(a===t){a=null;break}if(null!==(u=a.sibling)){u.return=a.return,a=u;break}a=a.return}u=a}}xi(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=(i=t.pendingProps).children,ji(t,n),r=r(l=Wi(l,i.unstable_observedBits)),t.effectTag|=1,xi(e,t,r,n),t.child;case 14:return i=rl(l=t.type,t.pendingProps),Si(e,t,l,i=rl(l.type,i),r,n);case 15:return _i(e,t,t.type,t.pendingProps,r,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:rl(r,l),null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),t.tag=1,Ir(r)?(e=!0,Ar(t)):e=!1,ji(t,n),ul(t,r,l),sl(t,r,l,n),Ni(null,t,r,!0,e,n)}o("156")}var Ii={current:null},Ui=null,Di=null,Fi=null;function Li(e,t){var n=e.type._context;Pr(Ii,n._currentValue),n._currentValue=t}function Ai(e){var t=Ii.current;Cr(Ii),e.type._context._currentValue=t}function ji(e,t){Ui=e,Fi=Di=null;var n=e.contextDependencies;null!==n&&n.expirationTime>=t&&(wi=!0),e.contextDependencies=null}function Wi(e,t){return Fi!==e&&!1!==t&&0!==t&&("number"===typeof t&&1073741823!==t||(Fi=e,t=1073741823),t={context:e,observedBits:t,next:null},null===Di?(null===Ui&&o("308"),Di=t,Ui.contextDependencies={first:t,expirationTime:0}):Di=Di.next=t),e._currentValue}var Vi=0,Bi=1,Hi=2,$i=3,Qi=!1;function Ki(e){return{baseState:e,firstUpdate:null,lastUpdate:null,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function qi(e){return{baseState:e.baseState,firstUpdate:e.firstUpdate,lastUpdate:e.lastUpdate,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function Yi(e){return{expirationTime:e,tag:Vi,payload:null,callback:null,next:null,nextEffect:null}}function Xi(e,t){null===e.lastUpdate?e.firstUpdate=e.lastUpdate=t:(e.lastUpdate.next=t,e.lastUpdate=t)}function Gi(e,t){var n=e.alternate;if(null===n){var r=e.updateQueue,l=null;null===r&&(r=e.updateQueue=Ki(e.memoizedState))}else r=e.updateQueue,l=n.updateQueue,null===r?null===l?(r=e.updateQueue=Ki(e.memoizedState),l=n.updateQueue=Ki(n.memoizedState)):r=e.updateQueue=qi(l):null===l&&(l=n.updateQueue=qi(r));null===l||r===l?Xi(r,t):null===r.lastUpdate||null===l.lastUpdate?(Xi(r,t),Xi(l,t)):(Xi(r,t),l.lastUpdate=t)}function Ji(e,t){var n=e.updateQueue;null===(n=null===n?e.updateQueue=Ki(e.memoizedState):Zi(e,n)).lastCapturedUpdate?n.firstCapturedUpdate=n.lastCapturedUpdate=t:(n.lastCapturedUpdate.next=t,n.lastCapturedUpdate=t)}function Zi(e,t){var n=e.alternate;return null!==n&&t===n.updateQueue&&(t=e.updateQueue=qi(t)),t}function eo(e,t,n,r,i,o){switch(n.tag){case Bi:return"function"===typeof(e=n.payload)?e.call(o,r,i):e;case $i:e.effectTag=-2049&e.effectTag|64;case Vi:if(null===(i="function"===typeof(e=n.payload)?e.call(o,r,i):e)||void 0===i)break;return l({},r,i);case Hi:Qi=!0}return r}function to(e,t,n,r,l){Qi=!1;for(var i=(t=Zi(e,t)).baseState,o=null,a=0,u=t.firstUpdate,c=i;null!==u;){var s=u.expirationTime;s<l?(null===o&&(o=u,i=c),a<s&&(a=s)):(c=eo(e,0,u,c,n,r),null!==u.callback&&(e.effectTag|=32,u.nextEffect=null,null===t.lastEffect?t.firstEffect=t.lastEffect=u:(t.lastEffect.nextEffect=u,t.lastEffect=u))),u=u.next}for(s=null,u=t.firstCapturedUpdate;null!==u;){var f=u.expirationTime;f<l?(null===s&&(s=u,null===o&&(i=c)),a<f&&(a=f)):(c=eo(e,0,u,c,n,r),null!==u.callback&&(e.effectTag|=32,u.nextEffect=null,null===t.lastCapturedEffect?t.firstCapturedEffect=t.lastCapturedEffect=u:(t.lastCapturedEffect.nextEffect=u,t.lastCapturedEffect=u))),u=u.next}null===o&&(t.lastUpdate=null),null===s?t.lastCapturedUpdate=null:e.effectTag|=32,null===o&&null===s&&(i=c),t.baseState=i,t.firstUpdate=o,t.firstCapturedUpdate=s,e.expirationTime=a,e.memoizedState=c}function no(e,t,n){null!==t.firstCapturedUpdate&&(null!==t.lastUpdate&&(t.lastUpdate.next=t.firstCapturedUpdate,t.lastUpdate=t.lastCapturedUpdate),t.firstCapturedUpdate=t.lastCapturedUpdate=null),ro(t.firstEffect,n),t.firstEffect=t.lastEffect=null,ro(t.firstCapturedEffect,n),t.firstCapturedEffect=t.lastCapturedEffect=null}function ro(e,t){for(;null!==e;){var n=e.callback;if(null!==n){e.callback=null;var r=t;"function"!==typeof n&&o("191",n),n.call(r)}e=e.nextEffect}}function lo(e,t){return{value:e,source:t,stack:ut(t)}}function io(e){e.effectTag|=4}var oo=void 0,ao=void 0,uo=void 0,co=void 0;oo=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},ao=function(){},uo=function(e,t,n,r,i){var o=e.memoizedProps;if(o!==r){var a=t.stateNode;switch(wl(gl.current),e=null,n){case"input":o=bt(a,o),r=bt(a,r),e=[];break;case"option":o=Kn(a,o),r=Kn(a,r),e=[];break;case"select":o=l({},o,{value:void 0}),r=l({},r,{value:void 0}),e=[];break;case"textarea":o=Yn(a,o),r=Yn(a,r),e=[];break;default:"function"!==typeof o.onClick&&"function"===typeof r.onClick&&(a.onclick=mr)}fr(n,r),a=n=void 0;var u=null;for(n in o)if(!r.hasOwnProperty(n)&&o.hasOwnProperty(n)&&null!=o[n])if("style"===n){var c=o[n];for(a in c)c.hasOwnProperty(a)&&(u||(u={}),u[a]="")}else"dangerouslySetInnerHTML"!==n&&"children"!==n&&"suppressContentEditableWarning"!==n&&"suppressHydrationWarning"!==n&&"autoFocus"!==n&&(b.hasOwnProperty(n)?e||(e=[]):(e=e||[]).push(n,null));for(n in r){var s=r[n];if(c=null!=o?o[n]:void 0,r.hasOwnProperty(n)&&s!==c&&(null!=s||null!=c))if("style"===n)if(c){for(a in c)!c.hasOwnProperty(a)||s&&s.hasOwnProperty(a)||(u||(u={}),u[a]="");for(a in s)s.hasOwnProperty(a)&&c[a]!==s[a]&&(u||(u={}),u[a]=s[a])}else u||(e||(e=[]),e.push(n,u)),u=s;else"dangerouslySetInnerHTML"===n?(s=s?s.__html:void 0,c=c?c.__html:void 0,null!=s&&c!==s&&(e=e||[]).push(n,""+s)):"children"===n?c===s||"string"!==typeof s&&"number"!==typeof s||(e=e||[]).push(n,""+s):"suppressContentEditableWarning"!==n&&"suppressHydrationWarning"!==n&&(b.hasOwnProperty(n)?(null!=s&&pr(i,n),e||c===s||(e=[])):(e=e||[]).push(n,s))}u&&(e=e||[]).push("style",u),i=e,(t.updateQueue=i)&&io(t)}},co=function(e,t,n,r){n!==r&&io(t)};var so="function"===typeof WeakSet?WeakSet:Set;function fo(e,t){var n=t.source,r=t.stack;null===r&&null!==n&&(r=ut(n)),null!==n&&at(n.type),t=t.value,null!==e&&1===e.tag&&at(e.type);try{console.error(t)}catch(l){setTimeout(function(){throw l})}}function po(e){var t=e.ref;if(null!==t)if("function"===typeof t)try{t(null)}catch(n){qo(e,n)}else t.current=null}function mo(e,t,n){if(null!==(n=null!==(n=n.updateQueue)?n.lastEffect:null)){var r=n=n.next;do{if((r.tag&e)!==El){var l=r.destroy;r.destroy=void 0,void 0!==l&&l()}(r.tag&t)!==El&&(l=r.create,r.destroy=l()),r=r.next}while(r!==n)}}function ho(e){switch("function"===typeof Vr&&Vr(e),e.tag){case 0:case 11:case 14:case 15:var t=e.updateQueue;if(null!==t&&null!==(t=t.lastEffect)){var n=t=t.next;do{var r=n.destroy;if(void 0!==r){var l=e;try{r()}catch(i){qo(l,i)}}n=n.next}while(n!==t)}break;case 1:if(po(e),"function"===typeof(t=e.stateNode).componentWillUnmount)try{t.props=e.memoizedProps,t.state=e.memoizedState,t.componentWillUnmount()}catch(i){qo(e,i)}break;case 5:po(e);break;case 4:go(e)}}function yo(e){return 5===e.tag||3===e.tag||4===e.tag}function vo(e){e:{for(var t=e.return;null!==t;){if(yo(t)){var n=t;break e}t=t.return}o("160"),n=void 0}var r=t=void 0;switch(n.tag){case 5:t=n.stateNode,r=!1;break;case 3:case 4:t=n.stateNode.containerInfo,r=!0;break;default:o("161")}16&n.effectTag&&(ir(t,""),n.effectTag&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||yo(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag&&18!==n.tag;){if(2&n.effectTag)continue t;if(null===n.child||4===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.effectTag)){n=n.stateNode;break e}}for(var l=e;;){if(5===l.tag||6===l.tag)if(n)if(r){var i=t,a=l.stateNode,u=n;8===i.nodeType?i.parentNode.insertBefore(a,u):i.insertBefore(a,u)}else t.insertBefore(l.stateNode,n);else r?(a=t,u=l.stateNode,8===a.nodeType?(i=a.parentNode).insertBefore(u,a):(i=a).appendChild(u),null!==(a=a._reactRootContainer)&&void 0!==a||null!==i.onclick||(i.onclick=mr)):t.appendChild(l.stateNode);else if(4!==l.tag&&null!==l.child){l.child.return=l,l=l.child;continue}if(l===e)break;for(;null===l.sibling;){if(null===l.return||l.return===e)return;l=l.return}l.sibling.return=l.return,l=l.sibling}}function go(e){for(var t=e,n=!1,r=void 0,l=void 0;;){if(!n){n=t.return;e:for(;;){switch(null===n&&o("160"),n.tag){case 5:r=n.stateNode,l=!1;break e;case 3:case 4:r=n.stateNode.containerInfo,l=!0;break e}n=n.return}n=!0}if(5===t.tag||6===t.tag){e:for(var i=t,a=i;;)if(ho(a),null!==a.child&&4!==a.tag)a.child.return=a,a=a.child;else{if(a===i)break;for(;null===a.sibling;){if(null===a.return||a.return===i)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}l?(i=r,a=t.stateNode,8===i.nodeType?i.parentNode.removeChild(a):i.removeChild(a)):r.removeChild(t.stateNode)}else if(4===t.tag){if(null!==t.child){r=t.stateNode.containerInfo,l=!0,t.child.return=t,t=t.child;continue}}else if(ho(t),null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return;4===(t=t.return).tag&&(n=!1)}t.sibling.return=t.return,t=t.sibling}}function bo(e,t){switch(t.tag){case 0:case 11:case 14:case 15:mo(Pl,Nl,t);break;case 1:break;case 5:var n=t.stateNode;if(null!=n){var r=t.memoizedProps;e=null!==e?e.memoizedProps:r;var l=t.type,i=t.updateQueue;t.updateQueue=null,null!==i&&function(e,t,n,r,l){e[I]=l,"input"===n&&"radio"===l.type&&null!=l.name&&wt(e,l),dr(n,r),r=dr(n,l);for(var i=0;i<t.length;i+=2){var o=t[i],a=t[i+1];"style"===o?cr(e,a):"dangerouslySetInnerHTML"===o?lr(e,a):"children"===o?ir(e,a):vt(e,o,a,r)}switch(n){case"input":xt(e,l);break;case"textarea":Gn(e,l);break;case"select":t=e._wrapperState.wasMultiple,e._wrapperState.wasMultiple=!!l.multiple,null!=(n=l.value)?qn(e,!!l.multiple,n,!1):t!==!!l.multiple&&(null!=l.defaultValue?qn(e,!!l.multiple,l.defaultValue,!0):qn(e,!!l.multiple,l.multiple?[]:"",!1))}}(n,i,l,e,r)}break;case 6:null===t.stateNode&&o("162"),t.stateNode.nodeValue=t.memoizedProps;break;case 3:case 12:break;case 13:if(n=t.memoizedState,r=void 0,e=t,null===n?r=!1:(r=!0,e=t.child,0===n.timedOutAt&&(n.timedOutAt=xa())),null!==e&&function(e,t){for(var n=e;;){if(5===n.tag){var r=n.stateNode;if(t)r.style.display="none";else{r=n.stateNode;var l=n.memoizedProps.style;l=void 0!==l&&null!==l&&l.hasOwnProperty("display")?l.display:null,r.style.display=ur("display",l)}}else if(6===n.tag)n.stateNode.nodeValue=t?"":n.memoizedProps;else{if(13===n.tag&&null!==n.memoizedState){(r=n.child.sibling).return=n,n=r;continue}if(null!==n.child){n.child.return=n,n=n.child;continue}}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}}(e,r),null!==(n=t.updateQueue)){t.updateQueue=null;var a=t.stateNode;null===a&&(a=t.stateNode=new so),n.forEach(function(e){var n=function(e,t){var n=e.stateNode;null!==n&&n.delete(t),t=Yo(t=xa(),e),null!==(e=Go(e,t))&&(Zr(e,t),0!==(t=e.expirationTime)&&Ta(e,t))}.bind(null,t,e);a.has(e)||(a.add(e),e.then(n,n))})}break;case 17:break;default:o("163")}}var ko="function"===typeof WeakMap?WeakMap:Map;function wo(e,t,n){(n=Yi(n)).tag=$i,n.payload={element:null};var r=t.value;return n.callback=function(){Ra(r),fo(e,t)},n}function xo(e,t,n){(n=Yi(n)).tag=$i;var r=e.type.getDerivedStateFromError;if("function"===typeof r){var l=t.value;n.payload=function(){return r(l)}}var i=e.stateNode;return null!==i&&"function"===typeof i.componentDidCatch&&(n.callback=function(){"function"!==typeof r&&(null===Lo?Lo=new Set([this]):Lo.add(this));var n=t.value,l=t.stack;fo(e,t),this.componentDidCatch(n,{componentStack:null!==l?l:""})}),n}function To(e){switch(e.tag){case 1:Ir(e.type)&&Ur();var t=e.effectTag;return 2048&t?(e.effectTag=-2049&t|64,e):null;case 3:return Tl(),Dr(),0!==(64&(t=e.effectTag))&&o("285"),e.effectTag=-2049&t|64,e;case 5:return _l(e),null;case 13:return 2048&(t=e.effectTag)?(e.effectTag=-2049&t|64,e):null;case 18:return null;case 4:return Tl(),null;case 10:return Ai(e),null;default:return null}}var So=He.ReactCurrentDispatcher,_o=He.ReactCurrentOwner,Eo=1073741822,Co=!1,Po=null,No=null,Oo=0,zo=-1,Ro=!1,Mo=null,Io=!1,Uo=null,Do=null,Fo=null,Lo=null;function Ao(){if(null!==Po)for(var e=Po.return;null!==e;){var t=e;switch(t.tag){case 1:var n=t.type.childContextTypes;null!==n&&void 0!==n&&Ur();break;case 3:Tl(),Dr();break;case 5:_l(t);break;case 4:Tl();break;case 10:Ai(t)}e=e.return}No=null,Oo=0,zo=-1,Ro=!1,Po=null}function jo(){for(;null!==Mo;){var e=Mo.effectTag;if(16&e&&ir(Mo.stateNode,""),128&e){var t=Mo.alternate;null!==t&&(null!==(t=t.ref)&&("function"===typeof t?t(null):t.current=null))}switch(14&e){case 2:vo(Mo),Mo.effectTag&=-3;break;case 6:vo(Mo),Mo.effectTag&=-3,bo(Mo.alternate,Mo);break;case 4:bo(Mo.alternate,Mo);break;case 8:go(e=Mo),e.return=null,e.child=null,e.memoizedState=null,e.updateQueue=null,null!==(e=e.alternate)&&(e.return=null,e.child=null,e.memoizedState=null,e.updateQueue=null)}Mo=Mo.nextEffect}}function Wo(){for(;null!==Mo;){if(256&Mo.effectTag)e:{var e=Mo.alternate,t=Mo;switch(t.tag){case 0:case 11:case 15:mo(Cl,El,t);break e;case 1:if(256&t.effectTag&&null!==e){var n=e.memoizedProps,r=e.memoizedState;t=(e=t.stateNode).getSnapshotBeforeUpdate(t.elementType===t.type?n:rl(t.type,n),r),e.__reactInternalSnapshotBeforeUpdate=t}break e;case 3:case 5:case 6:case 4:case 17:break e;default:o("163")}}Mo=Mo.nextEffect}}function Vo(e,t){for(;null!==Mo;){var n=Mo.effectTag;if(36&n){var r=Mo.alternate,l=Mo,i=t;switch(l.tag){case 0:case 11:case 15:mo(Ol,zl,l);break;case 1:var a=l.stateNode;if(4&l.effectTag)if(null===r)a.componentDidMount();else{var u=l.elementType===l.type?r.memoizedProps:rl(l.type,r.memoizedProps);a.componentDidUpdate(u,r.memoizedState,a.__reactInternalSnapshotBeforeUpdate)}null!==(r=l.updateQueue)&&no(0,r,a);break;case 3:if(null!==(r=l.updateQueue)){if(a=null,null!==l.child)switch(l.child.tag){case 5:a=l.child.stateNode;break;case 1:a=l.child.stateNode}no(0,r,a)}break;case 5:i=l.stateNode,null===r&&4&l.effectTag&&vr(l.type,l.memoizedProps)&&i.focus();break;case 6:case 4:case 12:case 13:case 17:break;default:o("163")}}128&n&&(null!==(l=Mo.ref)&&(i=Mo.stateNode,"function"===typeof l?l(i):l.current=i)),512&n&&(Uo=e),Mo=Mo.nextEffect}}function Bo(){null!==Do&&xr(Do),null!==Fo&&Fo()}function Ho(e,t){Io=Co=!0,e.current===t&&o("177");var n=e.pendingCommitExpirationTime;0===n&&o("261"),e.pendingCommitExpirationTime=0;var r=t.expirationTime,l=t.childExpirationTime;for(function(e,t){if(e.didError=!1,0===t)e.earliestPendingTime=0,e.latestPendingTime=0,e.earliestSuspendedTime=0,e.latestSuspendedTime=0,e.latestPingedTime=0;else{t<e.latestPingedTime&&(e.latestPingedTime=0);var n=e.latestPendingTime;0!==n&&(n>t?e.earliestPendingTime=e.latestPendingTime=0:e.earliestPendingTime>t&&(e.earliestPendingTime=e.latestPendingTime)),0===(n=e.earliestSuspendedTime)?Zr(e,t):t<e.latestSuspendedTime?(e.earliestSuspendedTime=0,e.latestSuspendedTime=0,e.latestPingedTime=0,Zr(e,t)):t>n&&Zr(e,t)}nl(0,e)}(e,l>r?l:r),_o.current=null,r=void 0,1<t.effectTag?null!==t.lastEffect?(t.lastEffect.nextEffect=t,r=t.firstEffect):r=t:r=t.firstEffect,hr=Sn,yr=function(){var e=Dn();if(Fn(e)){if("selectionStart"in e)var t={start:e.selectionStart,end:e.selectionEnd};else e:{var n=(t=(t=e.ownerDocument)&&t.defaultView||window).getSelection&&t.getSelection();if(n&&0!==n.rangeCount){t=n.anchorNode;var r=n.anchorOffset,l=n.focusNode;n=n.focusOffset;try{t.nodeType,l.nodeType}catch(p){t=null;break e}var i=0,o=-1,a=-1,u=0,c=0,s=e,f=null;t:for(;;){for(var d;s!==t||0!==r&&3!==s.nodeType||(o=i+r),s!==l||0!==n&&3!==s.nodeType||(a=i+n),3===s.nodeType&&(i+=s.nodeValue.length),null!==(d=s.firstChild);)f=s,s=d;for(;;){if(s===e)break t;if(f===t&&++u===r&&(o=i),f===l&&++c===n&&(a=i),null!==(d=s.nextSibling))break;f=(s=f).parentNode}s=d}t=-1===o||-1===a?null:{start:o,end:a}}else t=null}t=t||{start:0,end:0}}else t=null;return{focusedElem:e,selectionRange:t}}(),Sn=!1,Mo=r;null!==Mo;){l=!1;var a=void 0;try{Wo()}catch(c){l=!0,a=c}l&&(null===Mo&&o("178"),qo(Mo,a),null!==Mo&&(Mo=Mo.nextEffect))}for(Mo=r;null!==Mo;){l=!1,a=void 0;try{jo()}catch(c){l=!0,a=c}l&&(null===Mo&&o("178"),qo(Mo,a),null!==Mo&&(Mo=Mo.nextEffect))}for(Ln(yr),yr=null,Sn=!!hr,hr=null,e.current=t,Mo=r;null!==Mo;){l=!1,a=void 0;try{Vo(e,n)}catch(c){l=!0,a=c}l&&(null===Mo&&o("178"),qo(Mo,a),null!==Mo&&(Mo=Mo.nextEffect))}if(null!==r&&null!==Uo){var u=function(e,t){Fo=Do=Uo=null;var n=la;la=!0;do{if(512&t.effectTag){var r=!1,l=void 0;try{var i=t;mo(Ml,El,i),mo(El,Rl,i)}catch(u){r=!0,l=u}r&&qo(t,l)}t=t.nextEffect}while(null!==t);la=n,0!==(n=e.expirationTime)&&Ta(e,n),sa||la||Pa(1073741823,!1)}.bind(null,e,r);Do=i.unstable_runWithPriority(i.unstable_NormalPriority,function(){return wr(u)}),Fo=u}Co=Io=!1,"function"===typeof Wr&&Wr(t.stateNode),n=t.expirationTime,0===(t=(t=t.childExpirationTime)>n?t:n)&&(Lo=null),function(e,t){e.expirationTime=t,e.finishedWork=null}(e,t)}function $o(e){for(;;){var t=e.alternate,n=e.return,r=e.sibling;if(0===(1024&e.effectTag)){Po=e;e:{var i=t,a=Oo,u=(t=e).pendingProps;switch(t.tag){case 2:case 16:break;case 15:case 0:break;case 1:Ir(t.type)&&Ur();break;case 3:Tl(),Dr(),(u=t.stateNode).pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),null!==i&&null!==i.child||(gi(t),t.effectTag&=-3),ao(t);break;case 5:_l(t);var c=wl(kl.current);if(a=t.type,null!==i&&null!=t.stateNode)uo(i,t,a,u,c),i.ref!==t.ref&&(t.effectTag|=128);else if(u){var s=wl(gl.current);if(gi(t)){i=(u=t).stateNode;var f=u.type,d=u.memoizedProps,p=c;switch(i[M]=u,i[I]=d,a=void 0,c=f){case"iframe":case"object":_n("load",i);break;case"video":case"audio":for(f=0;f<te.length;f++)_n(te[f],i);break;case"source":_n("error",i);break;case"img":case"image":case"link":_n("error",i),_n("load",i);break;case"form":_n("reset",i),_n("submit",i);break;case"details":_n("toggle",i);break;case"input":kt(i,d),_n("invalid",i),pr(p,"onChange");break;case"select":i._wrapperState={wasMultiple:!!d.multiple},_n("invalid",i),pr(p,"onChange");break;case"textarea":Xn(i,d),_n("invalid",i),pr(p,"onChange")}for(a in fr(c,d),f=null,d)d.hasOwnProperty(a)&&(s=d[a],"children"===a?"string"===typeof s?i.textContent!==s&&(f=["children",s]):"number"===typeof s&&i.textContent!==""+s&&(f=["children",""+s]):b.hasOwnProperty(a)&&null!=s&&pr(p,a));switch(c){case"input":Ve(i),Tt(i,d,!0);break;case"textarea":Ve(i),Jn(i);break;case"select":case"option":break;default:"function"===typeof d.onClick&&(i.onclick=mr)}a=f,u.updateQueue=a,(u=null!==a)&&io(t)}else{d=t,i=a,p=u,f=9===c.nodeType?c:c.ownerDocument,s===Zn.html&&(s=er(i)),s===Zn.html?"script"===i?((i=f.createElement("div")).innerHTML="<script><\/script>",f=i.removeChild(i.firstChild)):"string"===typeof p.is?f=f.createElement(i,{is:p.is}):(f=f.createElement(i),"select"===i&&p.multiple&&(f.multiple=!0)):f=f.createElementNS(s,i),(i=f)[M]=d,i[I]=u,oo(i,t,!1,!1),p=i;var m=c,h=dr(f=a,d=u);switch(f){case"iframe":case"object":_n("load",p),c=d;break;case"video":case"audio":for(c=0;c<te.length;c++)_n(te[c],p);c=d;break;case"source":_n("error",p),c=d;break;case"img":case"image":case"link":_n("error",p),_n("load",p),c=d;break;case"form":_n("reset",p),_n("submit",p),c=d;break;case"details":_n("toggle",p),c=d;break;case"input":kt(p,d),c=bt(p,d),_n("invalid",p),pr(m,"onChange");break;case"option":c=Kn(p,d);break;case"select":p._wrapperState={wasMultiple:!!d.multiple},c=l({},d,{value:void 0}),_n("invalid",p),pr(m,"onChange");break;case"textarea":Xn(p,d),c=Yn(p,d),_n("invalid",p),pr(m,"onChange");break;default:c=d}fr(f,c),s=void 0;var y=f,v=p,g=c;for(s in g)if(g.hasOwnProperty(s)){var k=g[s];"style"===s?cr(v,k):"dangerouslySetInnerHTML"===s?null!=(k=k?k.__html:void 0)&&lr(v,k):"children"===s?"string"===typeof k?("textarea"!==y||""!==k)&&ir(v,k):"number"===typeof k&&ir(v,""+k):"suppressContentEditableWarning"!==s&&"suppressHydrationWarning"!==s&&"autoFocus"!==s&&(b.hasOwnProperty(s)?null!=k&&pr(m,s):null!=k&&vt(v,s,k,h))}switch(f){case"input":Ve(p),Tt(p,d,!1);break;case"textarea":Ve(p),Jn(p);break;case"option":null!=d.value&&p.setAttribute("value",""+gt(d.value));break;case"select":(c=p).multiple=!!d.multiple,null!=(p=d.value)?qn(c,!!d.multiple,p,!1):null!=d.defaultValue&&qn(c,!!d.multiple,d.defaultValue,!0);break;default:"function"===typeof c.onClick&&(p.onclick=mr)}(u=vr(a,u))&&io(t),t.stateNode=i}null!==t.ref&&(t.effectTag|=128)}else null===t.stateNode&&o("166");break;case 6:i&&null!=t.stateNode?co(i,t,i.memoizedProps,u):("string"!==typeof u&&(null===t.stateNode&&o("166")),i=wl(kl.current),wl(gl.current),gi(t)?(a=(u=t).stateNode,i=u.memoizedProps,a[M]=u,(u=a.nodeValue!==i)&&io(t)):(a=t,(u=(9===i.nodeType?i:i.ownerDocument).createTextNode(u))[M]=t,a.stateNode=u));break;case 11:break;case 13:if(u=t.memoizedState,0!==(64&t.effectTag)){t.expirationTime=a,Po=t;break e}u=null!==u,a=null!==i&&null!==i.memoizedState,null!==i&&!u&&a&&(null!==(i=i.child.sibling)&&(null!==(c=t.firstEffect)?(t.firstEffect=i,i.nextEffect=c):(t.firstEffect=t.lastEffect=i,i.nextEffect=null),i.effectTag=8)),(u||a)&&(t.effectTag|=4);break;case 7:case 8:case 12:break;case 4:Tl(),ao(t);break;case 10:Ai(t);break;case 9:case 14:break;case 17:Ir(t.type)&&Ur();break;case 18:break;default:o("156")}Po=null}if(t=e,1===Oo||1!==t.childExpirationTime){for(u=0,a=t.child;null!==a;)(i=a.expirationTime)>u&&(u=i),(c=a.childExpirationTime)>u&&(u=c),a=a.sibling;t.childExpirationTime=u}if(null!==Po)return Po;null!==n&&0===(1024&n.effectTag)&&(null===n.firstEffect&&(n.firstEffect=e.firstEffect),null!==e.lastEffect&&(null!==n.lastEffect&&(n.lastEffect.nextEffect=e.firstEffect),n.lastEffect=e.lastEffect),1<e.effectTag&&(null!==n.lastEffect?n.lastEffect.nextEffect=e:n.firstEffect=e,n.lastEffect=e))}else{if(null!==(e=To(e)))return e.effectTag&=1023,e;null!==n&&(n.firstEffect=n.lastEffect=null,n.effectTag|=1024)}if(null!==r)return r;if(null===n)break;e=n}return null}function Qo(e){var t=Mi(e.alternate,e,Oo);return e.memoizedProps=e.pendingProps,null===t&&(t=$o(e)),_o.current=null,t}function Ko(e,t){Co&&o("243"),Bo(),Co=!0;var n=So.current;So.current=ui;var r=e.nextExpirationTimeToWorkOn;r===Oo&&e===No&&null!==Po||(Ao(),Oo=r,Po=Kr((No=e).current,null),e.pendingCommitExpirationTime=0);for(var l=!1;;){try{if(t)for(;null!==Po&&!Ea();)Po=Qo(Po);else for(;null!==Po;)Po=Qo(Po)}catch(v){if(Fi=Di=Ui=null,Gl(),null===Po)l=!0,Ra(v);else{null===Po&&o("271");var i=Po,a=i.return;if(null!==a){e:{var u=e,c=a,s=i,f=v;if(a=Oo,s.effectTag|=1024,s.firstEffect=s.lastEffect=null,null!==f&&"object"===typeof f&&"function"===typeof f.then){var d=f;f=c;var p=-1,m=-1;do{if(13===f.tag){var h=f.alternate;if(null!==h&&null!==(h=h.memoizedState)){m=10*(1073741822-h.timedOutAt);break}"number"===typeof(h=f.pendingProps.maxDuration)&&(0>=h?p=0:(-1===p||h<p)&&(p=h))}f=f.return}while(null!==f);f=c;do{if((h=13===f.tag)&&(h=void 0!==f.memoizedProps.fallback&&null===f.memoizedState),h){if(null===(c=f.updateQueue)?((c=new Set).add(d),f.updateQueue=c):c.add(d),0===(1&f.mode)){f.effectTag|=64,s.effectTag&=-1957,1===s.tag&&(null===s.alternate?s.tag=17:((a=Yi(1073741823)).tag=Hi,Gi(s,a))),s.expirationTime=1073741823;break e}c=a;var y=(s=u).pingCache;null===y?(y=s.pingCache=new ko,h=new Set,y.set(d,h)):void 0===(h=y.get(d))&&(h=new Set,y.set(d,h)),h.has(c)||(h.add(c),s=Xo.bind(null,s,d,c),d.then(s,s)),-1===p?u=1073741823:(-1===m&&(m=10*(1073741822-tl(u,a))-5e3),u=m+p),0<=u&&zo<u&&(zo=u),f.effectTag|=2048,f.expirationTime=a;break e}f=f.return}while(null!==f);f=Error((at(s.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display."+ut(s))}Ro=!0,f=lo(f,s),u=c;do{switch(u.tag){case 3:u.effectTag|=2048,u.expirationTime=a,Ji(u,a=wo(u,f,a));break e;case 1:if(p=f,m=u.type,s=u.stateNode,0===(64&u.effectTag)&&("function"===typeof m.getDerivedStateFromError||null!==s&&"function"===typeof s.componentDidCatch&&(null===Lo||!Lo.has(s)))){u.effectTag|=2048,u.expirationTime=a,Ji(u,a=xo(u,p,a));break e}}u=u.return}while(null!==u)}Po=$o(i);continue}l=!0,Ra(v)}}break}if(Co=!1,So.current=n,Fi=Di=Ui=null,Gl(),l)No=null,e.finishedWork=null;else if(null!==Po)e.finishedWork=null;else{if(null===(n=e.current.alternate)&&o("281"),No=null,Ro){if(l=e.latestPendingTime,i=e.latestSuspendedTime,a=e.latestPingedTime,0!==l&&l<r||0!==i&&i<r||0!==a&&a<r)return el(e,r),void wa(e,n,r,e.expirationTime,-1);if(!e.didError&&t)return e.didError=!0,r=e.nextExpirationTimeToWorkOn=r,t=e.expirationTime=1073741823,void wa(e,n,r,t,-1)}t&&-1!==zo?(el(e,r),(t=10*(1073741822-tl(e,r)))<zo&&(zo=t),t=10*(1073741822-xa()),t=zo-t,wa(e,n,r,e.expirationTime,0>t?0:t)):(e.pendingCommitExpirationTime=r,e.finishedWork=n)}}function qo(e,t){for(var n=e.return;null!==n;){switch(n.tag){case 1:var r=n.stateNode;if("function"===typeof n.type.getDerivedStateFromError||"function"===typeof r.componentDidCatch&&(null===Lo||!Lo.has(r)))return Gi(n,e=xo(n,e=lo(t,e),1073741823)),void Jo(n,1073741823);break;case 3:return Gi(n,e=wo(n,e=lo(t,e),1073741823)),void Jo(n,1073741823)}n=n.return}3===e.tag&&(Gi(e,n=wo(e,n=lo(t,e),1073741823)),Jo(e,1073741823))}function Yo(e,t){var n=i.unstable_getCurrentPriorityLevel(),r=void 0;if(0===(1&t.mode))r=1073741823;else if(Co&&!Io)r=Oo;else{switch(n){case i.unstable_ImmediatePriority:r=1073741823;break;case i.unstable_UserBlockingPriority:r=1073741822-10*(1+((1073741822-e+15)/10|0));break;case i.unstable_NormalPriority:r=1073741822-25*(1+((1073741822-e+500)/25|0));break;case i.unstable_LowPriority:case i.unstable_IdlePriority:r=1;break;default:o("313")}null!==No&&r===Oo&&--r}return n===i.unstable_UserBlockingPriority&&(0===aa||r<aa)&&(aa=r),r}function Xo(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),null!==No&&Oo===n?No=null:(t=e.earliestSuspendedTime,r=e.latestSuspendedTime,0!==t&&n<=t&&n>=r&&(e.didError=!1,(0===(t=e.latestPingedTime)||t>n)&&(e.latestPingedTime=n),nl(n,e),0!==(n=e.expirationTime)&&Ta(e,n)))}function Go(e,t){e.expirationTime<t&&(e.expirationTime=t);var n=e.alternate;null!==n&&n.expirationTime<t&&(n.expirationTime=t);var r=e.return,l=null;if(null===r&&3===e.tag)l=e.stateNode;else for(;null!==r;){if(n=r.alternate,r.childExpirationTime<t&&(r.childExpirationTime=t),null!==n&&n.childExpirationTime<t&&(n.childExpirationTime=t),null===r.return&&3===r.tag){l=r.stateNode;break}r=r.return}return l}function Jo(e,t){null!==(e=Go(e,t))&&(!Co&&0!==Oo&&t>Oo&&Ao(),Zr(e,t),Co&&!Io&&No===e||Ta(e,e.expirationTime),va>ya&&(va=0,o("185")))}function Zo(e,t,n,r,l){return i.unstable_runWithPriority(i.unstable_ImmediatePriority,function(){return e(t,n,r,l)})}var ea=null,ta=null,na=0,ra=void 0,la=!1,ia=null,oa=0,aa=0,ua=!1,ca=null,sa=!1,fa=!1,da=null,pa=i.unstable_now(),ma=1073741822-(pa/10|0),ha=ma,ya=50,va=0,ga=null;function ba(){ma=1073741822-((i.unstable_now()-pa)/10|0)}function ka(e,t){if(0!==na){if(t<na)return;null!==ra&&i.unstable_cancelCallback(ra)}na=t,e=i.unstable_now()-pa,ra=i.unstable_scheduleCallback(Ca,{timeout:10*(1073741822-t)-e})}function wa(e,t,n,r,l){e.expirationTime=r,0!==l||Ea()?0<l&&(e.timeoutHandle=br(function(e,t,n){e.pendingCommitExpirationTime=n,e.finishedWork=t,ba(),ha=ma,Na(e,n)}.bind(null,e,t,n),l)):(e.pendingCommitExpirationTime=n,e.finishedWork=t)}function xa(){return la?ha:(Sa(),0!==oa&&1!==oa||(ba(),ha=ma),ha)}function Ta(e,t){null===e.nextScheduledRoot?(e.expirationTime=t,null===ta?(ea=ta=e,e.nextScheduledRoot=e):(ta=ta.nextScheduledRoot=e).nextScheduledRoot=ea):t>e.expirationTime&&(e.expirationTime=t),la||(sa?fa&&(ia=e,oa=1073741823,Oa(e,1073741823,!1)):1073741823===t?Pa(1073741823,!1):ka(e,t))}function Sa(){var e=0,t=null;if(null!==ta)for(var n=ta,r=ea;null!==r;){var l=r.expirationTime;if(0===l){if((null===n||null===ta)&&o("244"),r===r.nextScheduledRoot){ea=ta=r.nextScheduledRoot=null;break}if(r===ea)ea=l=r.nextScheduledRoot,ta.nextScheduledRoot=l,r.nextScheduledRoot=null;else{if(r===ta){(ta=n).nextScheduledRoot=ea,r.nextScheduledRoot=null;break}n.nextScheduledRoot=r.nextScheduledRoot,r.nextScheduledRoot=null}r=n.nextScheduledRoot}else{if(l>e&&(e=l,t=r),r===ta)break;if(1073741823===e)break;n=r,r=r.nextScheduledRoot}}ia=t,oa=e}var _a=!1;function Ea(){return!!_a||!!i.unstable_shouldYield()&&(_a=!0)}function Ca(){try{if(!Ea()&&null!==ea){ba();var e=ea;do{var t=e.expirationTime;0!==t&&ma<=t&&(e.nextExpirationTimeToWorkOn=ma),e=e.nextScheduledRoot}while(e!==ea)}Pa(0,!0)}finally{_a=!1}}function Pa(e,t){if(Sa(),t)for(ba(),ha=ma;null!==ia&&0!==oa&&e<=oa&&!(_a&&ma>oa);)Oa(ia,oa,ma>oa),Sa(),ba(),ha=ma;else for(;null!==ia&&0!==oa&&e<=oa;)Oa(ia,oa,!1),Sa();if(t&&(na=0,ra=null),0!==oa&&ka(ia,oa),va=0,ga=null,null!==da)for(e=da,da=null,t=0;t<e.length;t++){var n=e[t];try{n._onComplete()}catch(r){ua||(ua=!0,ca=r)}}if(ua)throw e=ca,ca=null,ua=!1,e}function Na(e,t){la&&o("253"),ia=e,oa=t,Oa(e,t,!1),Pa(1073741823,!1)}function Oa(e,t,n){if(la&&o("245"),la=!0,n){var r=e.finishedWork;null!==r?za(e,r,t):(e.finishedWork=null,-1!==(r=e.timeoutHandle)&&(e.timeoutHandle=-1,kr(r)),Ko(e,n),null!==(r=e.finishedWork)&&(Ea()?e.finishedWork=r:za(e,r,t)))}else null!==(r=e.finishedWork)?za(e,r,t):(e.finishedWork=null,-1!==(r=e.timeoutHandle)&&(e.timeoutHandle=-1,kr(r)),Ko(e,n),null!==(r=e.finishedWork)&&za(e,r,t));la=!1}function za(e,t,n){var r=e.firstBatch;if(null!==r&&r._expirationTime>=n&&(null===da?da=[r]:da.push(r),r._defer))return e.finishedWork=t,void(e.expirationTime=0);e.finishedWork=null,e===ga?va++:(ga=e,va=0),i.unstable_runWithPriority(i.unstable_ImmediatePriority,function(){Ho(e,t)})}function Ra(e){null===ia&&o("246"),ia.expirationTime=0,ua||(ua=!0,ca=e)}function Ma(e,t){var n=sa;sa=!0;try{return e(t)}finally{(sa=n)||la||Pa(1073741823,!1)}}function Ia(e,t){if(sa&&!fa){fa=!0;try{return e(t)}finally{fa=!1}}return e(t)}function Ua(e,t,n){sa||la||0===aa||(Pa(aa,!1),aa=0);var r=sa;sa=!0;try{return i.unstable_runWithPriority(i.unstable_UserBlockingPriority,function(){return e(t,n)})}finally{(sa=r)||la||Pa(1073741823,!1)}}function Da(e,t,n,r,l){var i=t.current;e:if(n){t:{2===tn(n=n._reactInternalFiber)&&1===n.tag||o("170");var a=n;do{switch(a.tag){case 3:a=a.stateNode.context;break t;case 1:if(Ir(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break t}}a=a.return}while(null!==a);o("171"),a=void 0}if(1===n.tag){var u=n.type;if(Ir(u)){n=Lr(n,u,a);break e}}n=a}else n=Nr;return null===t.context?t.context=n:t.pendingContext=n,t=l,(l=Yi(r)).payload={element:e},null!==(t=void 0===t?null:t)&&(l.callback=t),Bo(),Gi(i,l),Jo(i,r),r}function Fa(e,t,n,r){var l=t.current;return Da(e,t,n,l=Yo(xa(),l),r)}function La(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 5:default:return e.child.stateNode}}function Aa(e){var t=1073741822-25*(1+((1073741822-xa()+500)/25|0));t>=Eo&&(t=Eo-1),this._expirationTime=Eo=t,this._root=e,this._callbacks=this._next=null,this._hasChildren=this._didComplete=!1,this._children=null,this._defer=!0}function ja(){this._callbacks=null,this._didCommit=!1,this._onCommit=this._onCommit.bind(this)}function Wa(e,t,n){e={current:t=$r(3,null,null,t?3:0),containerInfo:e,pendingChildren:null,pingCache:null,earliestPendingTime:0,latestPendingTime:0,earliestSuspendedTime:0,latestSuspendedTime:0,latestPingedTime:0,didError:!1,pendingCommitExpirationTime:0,finishedWork:null,timeoutHandle:-1,context:null,pendingContext:null,hydrate:n,nextExpirationTimeToWorkOn:0,expirationTime:0,firstBatch:null,nextScheduledRoot:null},this._internalRoot=t.stateNode=e}function Va(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Ba(e,t,n,r,l){var i=n._reactRootContainer;if(i){if("function"===typeof l){var o=l;l=function(){var e=La(i._internalRoot);o.call(e)}}null!=e?i.legacy_renderSubtreeIntoContainer(e,t,l):i.render(t,l)}else{if(i=n._reactRootContainer=function(e,t){if(t||(t=!(!(t=e?9===e.nodeType?e.documentElement:e.firstChild:null)||1!==t.nodeType||!t.hasAttribute("data-reactroot"))),!t)for(var n;n=e.lastChild;)e.removeChild(n);return new Wa(e,!1,t)}(n,r),"function"===typeof l){var a=l;l=function(){var e=La(i._internalRoot);a.call(e)}}Ia(function(){null!=e?i.legacy_renderSubtreeIntoContainer(e,t,l):i.render(t,l)})}return La(i._internalRoot)}function Ha(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;return Va(t)||o("200"),function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:qe,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)}Ee=function(e,t,n){switch(t){case"input":if(xt(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var l=L(r);l||o("90"),Be(r),xt(r,l)}}}break;case"textarea":Gn(e,n);break;case"select":null!=(t=n.value)&&qn(e,!!n.multiple,t,!1)}},Aa.prototype.render=function(e){this._defer||o("250"),this._hasChildren=!0,this._children=e;var t=this._root._internalRoot,n=this._expirationTime,r=new ja;return Da(e,t,null,n,r._onCommit),r},Aa.prototype.then=function(e){if(this._didComplete)e();else{var t=this._callbacks;null===t&&(t=this._callbacks=[]),t.push(e)}},Aa.prototype.commit=function(){var e=this._root._internalRoot,t=e.firstBatch;if(this._defer&&null!==t||o("251"),this._hasChildren){var n=this._expirationTime;if(t!==this){this._hasChildren&&(n=this._expirationTime=t._expirationTime,this.render(this._children));for(var r=null,l=t;l!==this;)r=l,l=l._next;null===r&&o("251"),r._next=l._next,this._next=t,e.firstBatch=this}this._defer=!1,Na(e,n),t=this._next,this._next=null,null!==(t=e.firstBatch=t)&&t._hasChildren&&t.render(t._children)}else this._next=null,this._defer=!1},Aa.prototype._onComplete=function(){if(!this._didComplete){this._didComplete=!0;var e=this._callbacks;if(null!==e)for(var t=0;t<e.length;t++)(0,e[t])()}},ja.prototype.then=function(e){if(this._didCommit)e();else{var t=this._callbacks;null===t&&(t=this._callbacks=[]),t.push(e)}},ja.prototype._onCommit=function(){if(!this._didCommit){this._didCommit=!0;var e=this._callbacks;if(null!==e)for(var t=0;t<e.length;t++){var n=e[t];"function"!==typeof n&&o("191",n),n()}}},Wa.prototype.render=function(e,t){var n=this._internalRoot,r=new ja;return null!==(t=void 0===t?null:t)&&r.then(t),Fa(e,n,null,r._onCommit),r},Wa.prototype.unmount=function(e){var t=this._internalRoot,n=new ja;return null!==(e=void 0===e?null:e)&&n.then(e),Fa(null,t,null,n._onCommit),n},Wa.prototype.legacy_renderSubtreeIntoContainer=function(e,t,n){var r=this._internalRoot,l=new ja;return null!==(n=void 0===n?null:n)&&l.then(n),Fa(t,r,e,l._onCommit),l},Wa.prototype.createBatch=function(){var e=new Aa(this),t=e._expirationTime,n=this._internalRoot,r=n.firstBatch;if(null===r)n.firstBatch=e,e._next=null;else{for(n=null;null!==r&&r._expirationTime>=t;)n=r,r=r._next;e._next=r,null!==n&&(n._next=e)}return e},Re=Ma,Me=Ua,Ie=function(){la||0===aa||(Pa(aa,!1),aa=0)};var $a={createPortal:Ha,findDOMNode:function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternalFiber;return void 0===t&&("function"===typeof e.render?o("188"):o("268",Object.keys(e))),e=null===(e=rn(t))?null:e.stateNode},hydrate:function(e,t,n){return Va(t)||o("200"),Ba(null,e,t,!0,n)},render:function(e,t,n){return Va(t)||o("200"),Ba(null,e,t,!1,n)},unstable_renderSubtreeIntoContainer:function(e,t,n,r){return Va(n)||o("200"),(null==e||void 0===e._reactInternalFiber)&&o("38"),Ba(e,t,n,!1,r)},unmountComponentAtNode:function(e){return Va(e)||o("40"),!!e._reactRootContainer&&(Ia(function(){Ba(null,null,e,!1,function(){e._reactRootContainer=null})}),!0)},unstable_createPortal:function(){return Ha.apply(void 0,arguments)},unstable_batchedUpdates:Ma,unstable_interactiveUpdates:Ua,flushSync:function(e,t){la&&o("187");var n=sa;sa=!0;try{return Zo(e,t)}finally{sa=n,Pa(1073741823,!1)}},unstable_createRoot:function(e,t){return Va(e)||o("299","unstable_createRoot"),new Wa(e,!0,null!=t&&!0===t.hydrate)},unstable_flushControlled:function(e){var t=sa;sa=!0;try{Zo(e)}finally{(sa=t)||la||Pa(1073741823,!1)}},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{Events:[D,F,L,N.injectEventPluginsByName,g,H,function(e){E(e,B)},Oe,ze,Pn,z]}};!function(e){var t=e.findFiberByHostInstance;(function(e){if("undefined"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)return!0;try{var n=t.inject(e);Wr=Br(function(e){return t.onCommitFiberRoot(n,e)}),Vr=Br(function(e){return t.onCommitFiberUnmount(n,e)})}catch(r){}})(l({},e,{overrideProps:null,currentDispatcherRef:He.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=rn(e))?null:e.stateNode},findFiberByHostInstance:function(e){return t?t(e):null}}))}({findFiberByHostInstance:U,bundleType:0,version:"16.8.2",rendererPackageName:"react-dom"});var Qa={default:$a},Ka=Qa&&$a||Qa;e.exports=Ka.default||Ka},function(e,t,n){"use strict";e.exports=n(14)},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var n=null,r=!1,l=3,i=-1,o=-1,a=!1,u=!1;function c(){if(!a){var e=n.expirationTime;u?T():u=!0,x(d,e)}}function s(){var e=n,t=n.next;if(n===t)n=null;else{var r=n.previous;n=r.next=t,t.previous=r}e.next=e.previous=null,r=e.callback,t=e.expirationTime,e=e.priorityLevel;var i=l,a=o;l=e,o=t;try{var u=r()}finally{l=i,o=a}if("function"===typeof u)if(u={callback:u,priorityLevel:e,expirationTime:t,next:null,previous:null},null===n)n=u.next=u.previous=u;else{r=null,e=n;do{if(e.expirationTime>=t){r=e;break}e=e.next}while(e!==n);null===r?r=n:r===n&&(n=u,c()),(t=r.previous).next=r.previous=u,u.next=r,u.previous=t}}function f(){if(-1===i&&null!==n&&1===n.priorityLevel){a=!0;try{do{s()}while(null!==n&&1===n.priorityLevel)}finally{a=!1,null!==n?c():u=!1}}}function d(e){a=!0;var l=r;r=e;try{if(e)for(;null!==n;){var i=t.unstable_now();if(!(n.expirationTime<=i))break;do{s()}while(null!==n&&n.expirationTime<=i)}else if(null!==n)do{s()}while(null!==n&&!S())}finally{a=!1,r=l,null!==n?c():u=!1,f()}}var p,m,h=Date,y="function"===typeof setTimeout?setTimeout:void 0,v="function"===typeof clearTimeout?clearTimeout:void 0,g="function"===typeof requestAnimationFrame?requestAnimationFrame:void 0,b="function"===typeof cancelAnimationFrame?cancelAnimationFrame:void 0;function k(e){p=g(function(t){v(m),e(t)}),m=y(function(){b(p),e(t.unstable_now())},100)}if("object"===typeof performance&&"function"===typeof performance.now){var w=performance;t.unstable_now=function(){return w.now()}}else t.unstable_now=function(){return h.now()};var x,T,S,_=null;if("undefined"!==typeof window?_=window:"undefined"!==typeof e&&(_=e),_&&_._schedMock){var E=_._schedMock;x=E[0],T=E[1],S=E[2],t.unstable_now=E[3]}else if("undefined"===typeof window||"function"!==typeof MessageChannel){var C=null,P=function(e){if(null!==C)try{C(e)}finally{C=null}};x=function(e){null!==C?setTimeout(x,0,e):(C=e,setTimeout(P,0,!1))},T=function(){C=null},S=function(){return!1}}else{"undefined"!==typeof console&&("function"!==typeof g&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!==typeof b&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"));var N=null,O=!1,z=-1,R=!1,M=!1,I=0,U=33,D=33;S=function(){return I<=t.unstable_now()};var F=new MessageChannel,L=F.port2;F.port1.onmessage=function(){O=!1;var e=N,n=z;N=null,z=-1;var r=t.unstable_now(),l=!1;if(0>=I-r){if(!(-1!==n&&n<=r))return R||(R=!0,k(A)),N=e,void(z=n);l=!0}if(null!==e){M=!0;try{e(l)}finally{M=!1}}};var A=function e(t){if(null!==N){k(e);var n=t-I+D;n<D&&U<D?(8>n&&(n=8),D=n<U?U:n):U=n,I=t+D,O||(O=!0,L.postMessage(void 0))}else R=!1};x=function(e,t){N=e,z=t,M||0>t?L.postMessage(void 0):R||(R=!0,k(A))},T=function(){N=null,O=!1,z=-1}}t.unstable_ImmediatePriority=1,t.unstable_UserBlockingPriority=2,t.unstable_NormalPriority=3,t.unstable_IdlePriority=5,t.unstable_LowPriority=4,t.unstable_runWithPriority=function(e,n){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var r=l,o=i;l=e,i=t.unstable_now();try{return n()}finally{l=r,i=o,f()}},t.unstable_next=function(e){switch(l){case 1:case 2:case 3:var n=3;break;default:n=l}var r=l,o=i;l=n,i=t.unstable_now();try{return e()}finally{l=r,i=o,f()}},t.unstable_scheduleCallback=function(e,r){var o=-1!==i?i:t.unstable_now();if("object"===typeof r&&null!==r&&"number"===typeof r.timeout)r=o+r.timeout;else switch(l){case 1:r=o+-1;break;case 2:r=o+250;break;case 5:r=o+1073741823;break;case 4:r=o+1e4;break;default:r=o+5e3}if(e={callback:e,priorityLevel:l,expirationTime:r,next:null,previous:null},null===n)n=e.next=e.previous=e,c();else{o=null;var a=n;do{if(a.expirationTime>r){o=a;break}a=a.next}while(a!==n);null===o?o=n:o===n&&(n=e,c()),(r=o.previous).next=o.previous=e,e.next=o,e.previous=r}return e},t.unstable_cancelCallback=function(e){var t=e.next;if(null!==t){if(t===e)n=null;else{e===n&&(n=t);var r=e.previous;r.next=t,t.previous=r}e.next=e.previous=null}},t.unstable_wrapCallback=function(e){var n=l;return function(){var r=l,o=i;l=n,i=t.unstable_now();try{return e.apply(this,arguments)}finally{l=r,i=o,f()}}},t.unstable_getCurrentPriorityLevel=function(){return l},t.unstable_shouldYield=function(){return!r&&(null!==n&&n.expirationTime<o||S())},t.unstable_continueExecution=function(){null!==n&&c()},t.unstable_pauseExecution=function(){},t.unstable_getFirstCallbackNode=function(){return n}}).call(this,n(15))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(r){"object"===typeof window&&(n=window)}e.exports=n}]]);-//# sourceMappingURL=2.772a56e7.chunk.js.map
+ viewer/build/static/js/2.822530b2.chunk.js view
@@ -0,0 +1,2 @@+(window.webpackJsonp=window.webpackJsonp||[]).push([[2],[function(e,t,n){"use strict";e.exports=n(13)},function(e,t,n){e.exports=n(19)()},function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,"a",function(){return r})},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},i=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(t){r(e,t,n[t])})}return e}n.d(t,"a",function(){return i})},function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}n.d(t,"a",function(){return i})},function(e,t,n){"use strict";e.exports=n(18)},function(e,t,n){"use strict";var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(i){return!1}}()?Object.assign:function(e,t){for(var n,a,l=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),u=1;u<arguments.length;u++){for(var s in n=Object(arguments[u]))i.call(n,s)&&(l[s]=n[s]);if(r){a=r(n);for(var c=0;c<a.length;c++)o.call(n,a[c])&&(l[a[c]]=n[a[c]])}}return l}},function(e,t,n){"use strict";!function e(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=n(14)},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,"a",function(){return r})},function(e,t,n){"use strict";function r(e){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n.d(t,"a",function(){return r})},function(e,t,n){"use strict";function r(e){return(r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e){return(i="function"===typeof Symbol&&"symbol"===r(Symbol.iterator)?function(e){return r(e)}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":r(e)})(e)}var o=n(2);function a(e,t){return!t||"object"!==i(t)&&"function"!==typeof t?Object(o.a)(e):t}n.d(t,"a",function(){return a})},function(e,t,n){"use strict";function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}n.d(t,"a",function(){return i})},,function(e,t,n){"use strict";var r=n(6),i="function"===typeof Symbol&&Symbol.for,o=i?Symbol.for("react.element"):60103,a=i?Symbol.for("react.portal"):60106,l=i?Symbol.for("react.fragment"):60107,u=i?Symbol.for("react.strict_mode"):60108,s=i?Symbol.for("react.profiler"):60114,c=i?Symbol.for("react.provider"):60109,f=i?Symbol.for("react.context"):60110,d=i?Symbol.for("react.forward_ref"):60112,p=i?Symbol.for("react.suspense"):60113,h=i?Symbol.for("react.suspense_list"):60120,y=i?Symbol.for("react.memo"):60115,v=i?Symbol.for("react.lazy"):60116;i&&Symbol.for("react.fundamental"),i&&Symbol.for("react.responder");var g="function"===typeof Symbol&&Symbol.iterator;function m(e){for(var t=e.message,n="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r<arguments.length;r++)n+="&args[]="+encodeURIComponent(arguments[r]);return e.message="Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",e}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k={};function _(e,t,n){this.props=e,this.context=t,this.refs=k,this.updater=n||b}function w(){}function E(e,t,n){this.props=e,this.context=t,this.refs=k,this.updater=n||b}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if("object"!==typeof e&&"function"!==typeof e&&null!=e)throw m(Error(85));this.updater.enqueueSetState(this,e,t,"setState")},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},w.prototype=_.prototype;var C=E.prototype=new w;C.constructor=E,r(C,_.prototype),C.isPureReactComponent=!0;var S={current:null},x={suspense:null},T={current:null},P=Object.prototype.hasOwnProperty,I={key:!0,ref:!0,__self:!0,__source:!0};function K(e,t,n){var r=void 0,i={},a=null,l=null;if(null!=t)for(r in void 0!==t.ref&&(l=t.ref),void 0!==t.key&&(a=""+t.key),t)P.call(t,r)&&!I.hasOwnProperty(r)&&(i[r]=t[r]);var u=arguments.length-2;if(1===u)i.children=n;else if(1<u){for(var s=Array(u),c=0;c<u;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in u=e.defaultProps)void 0===i[r]&&(i[r]=u[r]);return{$$typeof:o,type:e,key:a,ref:l,props:i,_owner:T.current}}function O(e){return"object"===typeof e&&null!==e&&e.$$typeof===o}var M=/\/+/g,N=[];function L(e,t,n,r){if(N.length){var i=N.pop();return i.result=e,i.keyPrefix=t,i.func=n,i.context=r,i.count=0,i}return{result:e,keyPrefix:t,func:n,context:r,count:0}}function A(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>N.length&&N.push(e)}function H(e,t,n){return null==e?0:function e(t,n,r,i){var l=typeof t;"undefined"!==l&&"boolean"!==l||(t=null);var u=!1;if(null===t)u=!0;else switch(l){case"string":case"number":u=!0;break;case"object":switch(t.$$typeof){case o:case a:u=!0}}if(u)return r(i,t,""===n?"."+R(t,0):n),1;if(u=0,n=""===n?".":n+":",Array.isArray(t))for(var s=0;s<t.length;s++){var c=n+R(l=t[s],s);u+=e(l,c,r,i)}else if(c=null===t||"object"!==typeof t?null:"function"===typeof(c=g&&t[g]||t["@@iterator"])?c:null,"function"===typeof c)for(t=c.call(t),s=0;!(l=t.next()).done;)u+=e(l=l.value,c=n+R(l,s++),r,i);else if("object"===l)throw r=""+t,m(Error(31),"[object Object]"===r?"object with keys {"+Object.keys(t).join(", ")+"}":r,"");return u}(e,"",t,n)}function R(e,t){return"object"===typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(e){return t[e]})}(e.key):t.toString(36)}function F(e,t){e.func.call(e.context,t,e.count++)}function D(e,t,n){var r=e.result,i=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?U(e,r,n,function(e){return e}):null!=e&&(O(e)&&(e=function(e,t){return{$$typeof:o,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(e,i+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(M,"$&/")+"/")+n)),r.push(e))}function U(e,t,n,r,i){var o="";null!=n&&(o=(""+n).replace(M,"$&/")+"/"),H(e,D,t=L(t,o,r,i)),A(t)}function z(){var e=S.current;if(null===e)throw m(Error(321));return e}var j={Children:{map:function(e,t,n){if(null==e)return e;var r=[];return U(e,r,null,t,n),r},forEach:function(e,t,n){if(null==e)return e;H(e,F,t=L(null,null,t,n)),A(t)},count:function(e){return H(e,function(){return null},null)},toArray:function(e){var t=[];return U(e,t,null,function(e){return e}),t},only:function(e){if(!O(e))throw m(Error(143));return e}},createRef:function(){return{current:null}},Component:_,PureComponent:E,createContext:function(e,t){return void 0===t&&(t=null),(e={$$typeof:f,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:c,_context:e},e.Consumer=e},forwardRef:function(e){return{$$typeof:d,render:e}},lazy:function(e){return{$$typeof:v,_ctor:e,_status:-1,_result:null}},memo:function(e,t){return{$$typeof:y,type:e,compare:void 0===t?null:t}},useCallback:function(e,t){return z().useCallback(e,t)},useContext:function(e,t){return z().useContext(e,t)},useEffect:function(e,t){return z().useEffect(e,t)},useImperativeHandle:function(e,t,n){return z().useImperativeHandle(e,t,n)},useDebugValue:function(){},useLayoutEffect:function(e,t){return z().useLayoutEffect(e,t)},useMemo:function(e,t){return z().useMemo(e,t)},useReducer:function(e,t,n){return z().useReducer(e,t,n)},useRef:function(e){return z().useRef(e)},useState:function(e){return z().useState(e)},Fragment:l,Profiler:s,StrictMode:u,Suspense:p,unstable_SuspenseList:h,createElement:K,cloneElement:function(e,t,n){if(null===e||void 0===e)throw m(Error(267),e);var i=void 0,a=r({},e.props),l=e.key,u=e.ref,s=e._owner;if(null!=t){void 0!==t.ref&&(u=t.ref,s=T.current),void 0!==t.key&&(l=""+t.key);var c=void 0;for(i in e.type&&e.type.defaultProps&&(c=e.type.defaultProps),t)P.call(t,i)&&!I.hasOwnProperty(i)&&(a[i]=void 0===t[i]&&void 0!==c?c[i]:t[i])}if(1===(i=arguments.length-2))a.children=n;else if(1<i){c=Array(i);for(var f=0;f<i;f++)c[f]=arguments[f+2];a.children=c}return{$$typeof:o,type:e.type,key:l,ref:u,props:a,_owner:s}},createFactory:function(e){var t=K.bind(null,e);return t.type=e,t},isValidElement:O,version:"16.9.0",unstable_withSuspenseConfig:function(e,t){var n=x.suspense;x.suspense=void 0===t?null:t;try{e()}finally{x.suspense=n}},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentDispatcher:S,ReactCurrentBatchConfig:x,ReactCurrentOwner:T,IsSomeRendererActing:{current:!1},assign:r}},B={default:j},q=B&&j||B;e.exports=q.default||q},function(e,t,n){"use strict";var r=n(0),i=n(6),o=n(15);function a(e){for(var t=e.message,n="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r<arguments.length;r++)n+="&args[]="+encodeURIComponent(arguments[r]);return e.message="Minified React error #"+t+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",e}if(!r)throw a(Error(227));var l=null,u={};function s(){if(l)for(var e in u){var t=u[e],n=l.indexOf(e);if(!(-1<n))throw a(Error(96),e);if(!f[n]){if(!t.extractEvents)throw a(Error(97),e);for(var r in f[n]=t,n=t.eventTypes){var i=void 0,o=n[r],s=t,p=r;if(d.hasOwnProperty(p))throw a(Error(99),p);d[p]=o;var h=o.phasedRegistrationNames;if(h){for(i in h)h.hasOwnProperty(i)&&c(h[i],s,p);i=!0}else o.registrationName?(c(o.registrationName,s,p),i=!0):i=!1;if(!i)throw a(Error(98),r,e)}}}}function c(e,t,n){if(p[e])throw a(Error(100),e);p[e]=t,h[e]=t.eventTypes[n].dependencies}var f=[],d={},p={},h={};var y=!1,v=null,g=!1,m=null,b={onError:function(e){y=!0,v=e}};function k(e,t,n,r,i,o,a,l,u){y=!1,v=null,function(e,t,n,r,i,o,a,l,u){var s=Array.prototype.slice.call(arguments,3);try{t.apply(n,s)}catch(c){this.onError(c)}}.apply(b,arguments)}var _=null,w=null,E=null;function C(e,t,n){var r=e.type||"unknown-event";e.currentTarget=E(n),function(e,t,n,r,i,o,l,u,s){if(k.apply(this,arguments),y){if(!y)throw a(Error(198));var c=v;y=!1,v=null,g||(g=!0,m=c)}}(r,t,void 0,e),e.currentTarget=null}function S(e,t){if(null==t)throw a(Error(30));return null==e?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}function x(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)}var T=null;function P(e){if(e){var t=e._dispatchListeners,n=e._dispatchInstances;if(Array.isArray(t))for(var r=0;r<t.length&&!e.isPropagationStopped();r++)C(e,t[r],n[r]);else t&&C(e,t,n);e._dispatchListeners=null,e._dispatchInstances=null,e.isPersistent()||e.constructor.release(e)}}function I(e){if(null!==e&&(T=S(T,e)),e=T,T=null,e){if(x(e,P),T)throw a(Error(95));if(g)throw e=m,g=!1,m=null,e}}var K={injectEventPluginOrder:function(e){if(l)throw a(Error(101));l=Array.prototype.slice.call(e),s()},injectEventPluginsByName:function(e){var t,n=!1;for(t in e)if(e.hasOwnProperty(t)){var r=e[t];if(!u.hasOwnProperty(t)||u[t]!==r){if(u[t])throw a(Error(102),t);u[t]=r,n=!0}}n&&s()}};function O(e,t){var n=e.stateNode;if(!n)return null;var r=_(n);if(!r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!==typeof n)throw a(Error(231),t,typeof n);return n}var M=Math.random().toString(36).slice(2),N="__reactInternalInstance$"+M,L="__reactEventHandlers$"+M;function A(e){if(e[N])return e[N];for(;!e[N];){if(!e.parentNode)return null;e=e.parentNode}return 5===(e=e[N]).tag||6===e.tag?e:null}function H(e){return!(e=e[N])||5!==e.tag&&6!==e.tag?null:e}function R(e){if(5===e.tag||6===e.tag)return e.stateNode;throw a(Error(33))}function F(e){return e[L]||null}function D(e){do{e=e.return}while(e&&5!==e.tag);return e||null}function U(e,t,n){(t=O(e,n.dispatchConfig.phasedRegistrationNames[t]))&&(n._dispatchListeners=S(n._dispatchListeners,t),n._dispatchInstances=S(n._dispatchInstances,e))}function z(e){if(e&&e.dispatchConfig.phasedRegistrationNames){for(var t=e._targetInst,n=[];t;)n.push(t),t=D(t);for(t=n.length;0<t--;)U(n[t],"captured",e);for(t=0;t<n.length;t++)U(n[t],"bubbled",e)}}function j(e,t,n){e&&n&&n.dispatchConfig.registrationName&&(t=O(e,n.dispatchConfig.registrationName))&&(n._dispatchListeners=S(n._dispatchListeners,t),n._dispatchInstances=S(n._dispatchInstances,e))}function B(e){e&&e.dispatchConfig.registrationName&&j(e._targetInst,null,e)}function q(e){x(e,z)}var W=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement);function V(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var $={animationend:V("Animation","AnimationEnd"),animationiteration:V("Animation","AnimationIteration"),animationstart:V("Animation","AnimationStart"),transitionend:V("Transition","TransitionEnd")},Q={},G={};function Y(e){if(Q[e])return Q[e];if(!$[e])return e;var t,n=$[e];for(t in n)if(n.hasOwnProperty(t)&&t in G)return Q[e]=n[t];return e}W&&(G=document.createElement("div").style,"AnimationEvent"in window||(delete $.animationend.animation,delete $.animationiteration.animation,delete $.animationstart.animation),"TransitionEvent"in window||delete $.transitionend.transition);var X=Y("animationend"),J=Y("animationiteration"),Z=Y("animationstart"),ee=Y("transitionend"),te="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),ne=null,re=null,ie=null;function oe(){if(ie)return ie;var e,t,n=re,r=n.length,i="value"in ne?ne.value:ne.textContent,o=i.length;for(e=0;e<r&&n[e]===i[e];e++);var a=r-e;for(t=1;t<=a&&n[r-t]===i[o-t];t++);return ie=i.slice(e,1<t?1-t:void 0)}function ae(){return!0}function le(){return!1}function ue(e,t,n,r){for(var i in this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n,e=this.constructor.Interface)e.hasOwnProperty(i)&&((t=e[i])?this[i]=t(n):"target"===i?this.target=r:this[i]=n[i]);return this.isDefaultPrevented=(null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue)?ae:le,this.isPropagationStopped=le,this}function se(e,t,n,r){if(this.eventPool.length){var i=this.eventPool.pop();return this.call(i,e,t,n,r),i}return new this(e,t,n,r)}function ce(e){if(!(e instanceof this))throw a(Error(279));e.destructor(),10>this.eventPool.length&&this.eventPool.push(e)}function fe(e){e.eventPool=[],e.getPooled=se,e.release=ce}i(ue.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!==typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=ae)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!==typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=ae)},persist:function(){this.isPersistent=ae},isPersistent:le,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=le,this._dispatchInstances=this._dispatchListeners=null}}),ue.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},ue.extend=function(e){function t(){}function n(){return r.apply(this,arguments)}var r=this;t.prototype=r.prototype;var o=new t;return i(o,n.prototype),n.prototype=o,n.prototype.constructor=n,n.Interface=i({},r.Interface,e),n.extend=r.extend,fe(n),n},fe(ue);var de=ue.extend({data:null}),pe=ue.extend({data:null}),he=[9,13,27,32],ye=W&&"CompositionEvent"in window,ve=null;W&&"documentMode"in document&&(ve=document.documentMode);var ge=W&&"TextEvent"in window&&!ve,me=W&&(!ye||ve&&8<ve&&11>=ve),be=String.fromCharCode(32),ke={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},_e=!1;function we(e,t){switch(e){case"keyup":return-1!==he.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function Ee(e){return"object"===typeof(e=e.detail)&&"data"in e?e.data:null}var Ce=!1;var Se={eventTypes:ke,extractEvents:function(e,t,n,r){var i=void 0,o=void 0;if(ye)e:{switch(e){case"compositionstart":i=ke.compositionStart;break e;case"compositionend":i=ke.compositionEnd;break e;case"compositionupdate":i=ke.compositionUpdate;break e}i=void 0}else Ce?we(e,n)&&(i=ke.compositionEnd):"keydown"===e&&229===n.keyCode&&(i=ke.compositionStart);return i?(me&&"ko"!==n.locale&&(Ce||i!==ke.compositionStart?i===ke.compositionEnd&&Ce&&(o=oe()):(re="value"in(ne=r)?ne.value:ne.textContent,Ce=!0)),i=de.getPooled(i,t,n,r),o?i.data=o:null!==(o=Ee(n))&&(i.data=o),q(i),o=i):o=null,(e=ge?function(e,t){switch(e){case"compositionend":return Ee(t);case"keypress":return 32!==t.which?null:(_e=!0,be);case"textInput":return(e=t.data)===be&&_e?null:e;default:return null}}(e,n):function(e,t){if(Ce)return"compositionend"===e||!ye&&we(e,t)?(e=oe(),ie=re=ne=null,Ce=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return me&&"ko"!==t.locale?null:t.data;default:return null}}(e,n))?((t=pe.getPooled(ke.beforeInput,t,n,r)).data=e,q(t)):t=null,null===o?t:null===t?o:[o,t]}},xe=null,Te=null,Pe=null;function Ie(e){if(e=w(e)){if("function"!==typeof xe)throw a(Error(280));var t=_(e.stateNode);xe(e.stateNode,e.type,t)}}function Ke(e){Te?Pe?Pe.push(e):Pe=[e]:Te=e}function Oe(){if(Te){var e=Te,t=Pe;if(Pe=Te=null,Ie(e),t)for(e=0;e<t.length;e++)Ie(t[e])}}function Me(e,t){return e(t)}function Ne(e,t,n,r){return e(t,n,r)}function Le(){}var Ae=Me,He=!1;function Re(){null===Te&&null===Pe||(Le(),Oe())}var Fe={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function De(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Fe[e.type]:"textarea"===t}function Ue(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}function ze(e){if(!W)return!1;var t=(e="on"+e)in document;return t||((t=document.createElement("div")).setAttribute(e,"return;"),t="function"===typeof t[e]),t}function je(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function Be(e){e._valueTracker||(e._valueTracker=function(e){var t=je(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&"undefined"!==typeof n&&"function"===typeof n.get&&"function"===typeof n.set){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function qe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=je(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}var We=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;We.hasOwnProperty("ReactCurrentDispatcher")||(We.ReactCurrentDispatcher={current:null}),We.hasOwnProperty("ReactCurrentBatchConfig")||(We.ReactCurrentBatchConfig={suspense:null});var Ve=/^(.*)[\\\/]/,$e="function"===typeof Symbol&&Symbol.for,Qe=$e?Symbol.for("react.element"):60103,Ge=$e?Symbol.for("react.portal"):60106,Ye=$e?Symbol.for("react.fragment"):60107,Xe=$e?Symbol.for("react.strict_mode"):60108,Je=$e?Symbol.for("react.profiler"):60114,Ze=$e?Symbol.for("react.provider"):60109,et=$e?Symbol.for("react.context"):60110,tt=$e?Symbol.for("react.concurrent_mode"):60111,nt=$e?Symbol.for("react.forward_ref"):60112,rt=$e?Symbol.for("react.suspense"):60113,it=$e?Symbol.for("react.suspense_list"):60120,ot=$e?Symbol.for("react.memo"):60115,at=$e?Symbol.for("react.lazy"):60116;$e&&Symbol.for("react.fundamental"),$e&&Symbol.for("react.responder");var lt="function"===typeof Symbol&&Symbol.iterator;function ut(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=lt&&e[lt]||e["@@iterator"])?e:null}function st(e){if(null==e)return null;if("function"===typeof e)return e.displayName||e.name||null;if("string"===typeof e)return e;switch(e){case Ye:return"Fragment";case Ge:return"Portal";case Je:return"Profiler";case Xe:return"StrictMode";case rt:return"Suspense";case it:return"SuspenseList"}if("object"===typeof e)switch(e.$$typeof){case et:return"Context.Consumer";case Ze:return"Context.Provider";case nt:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case ot:return st(e.type);case at:if(e=1===e._status?e._result:null)return st(e)}return null}function ct(e){var t="";do{e:switch(e.tag){case 3:case 4:case 6:case 7:case 10:case 9:var n="";break e;default:var r=e._debugOwner,i=e._debugSource,o=st(e.type);n=null,r&&(n=st(r.type)),r=o,o="",i?o=" (at "+i.fileName.replace(Ve,"")+":"+i.lineNumber+")":n&&(o=" (created by "+n+")"),n="\n    in "+(r||"Unknown")+o}t+=n,e=e.return}while(e);return t}var ft=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,dt=Object.prototype.hasOwnProperty,pt={},ht={};function yt(e,t,n,r,i,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o}var vt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){vt[e]=new yt(e,0,!1,e,null,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];vt[t]=new yt(t,1,!1,e[1],null,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){vt[e]=new yt(e,2,!1,e.toLowerCase(),null,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){vt[e]=new yt(e,2,!1,e,null,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){vt[e]=new yt(e,3,!1,e.toLowerCase(),null,!1)}),["checked","multiple","muted","selected"].forEach(function(e){vt[e]=new yt(e,3,!0,e,null,!1)}),["capture","download"].forEach(function(e){vt[e]=new yt(e,4,!1,e,null,!1)}),["cols","rows","size","span"].forEach(function(e){vt[e]=new yt(e,6,!1,e,null,!1)}),["rowSpan","start"].forEach(function(e){vt[e]=new yt(e,5,!1,e.toLowerCase(),null,!1)});var gt=/[\-:]([a-z])/g;function mt(e){return e[1].toUpperCase()}function bt(e,t,n,r){var i=vt.hasOwnProperty(t)?vt[t]:null;(null!==i?0===i.type:!r&&(2<t.length&&("o"===t[0]||"O"===t[0])&&("n"===t[1]||"N"===t[1])))||(function(e,t,n,r){if(null===t||"undefined"===typeof t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,i,r)&&(n=null),r||null===i?function(e){return!!dt.call(ht,e)||!dt.call(pt,e)&&(ft.test(e)?ht[e]=!0:(pt[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=null===n?3!==i.type&&"":n:(t=i.attributeName,r=i.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(i=i.type)||4===i&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}function kt(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function _t(e,t){var n=t.checked;return i({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function wt(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=kt(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function Et(e,t){null!=(t=t.checked)&&bt(e,"checked",t,!1)}function Ct(e,t){Et(e,t);var n=kt(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?xt(e,t.type,n):t.hasOwnProperty("defaultValue")&&xt(e,t.type,kt(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function St(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!e.defaultChecked,e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function xt(e,t,n){"number"===t&&e.ownerDocument.activeElement===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(gt,mt);vt[t]=new yt(t,1,!1,e,null,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(gt,mt);vt[t]=new yt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(gt,mt);vt[t]=new yt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1)}),["tabIndex","crossOrigin"].forEach(function(e){vt[e]=new yt(e,1,!1,e.toLowerCase(),null,!1)}),vt.xlinkHref=new yt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0),["src","href","action","formAction"].forEach(function(e){vt[e]=new yt(e,1,!1,e.toLowerCase(),null,!0)});var Tt={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function Pt(e,t,n){return(e=ue.getPooled(Tt.change,e,t,n)).type="change",Ke(n),q(e),e}var It=null,Kt=null;function Ot(e){I(e)}function Mt(e){if(qe(R(e)))return e}function Nt(e,t){if("change"===e)return t}var Lt=!1;function At(){It&&(It.detachEvent("onpropertychange",Ht),Kt=It=null)}function Ht(e){if("value"===e.propertyName&&Mt(Kt))if(e=Pt(Kt,e,Ue(e)),He)I(e);else{He=!0;try{Me(Ot,e)}finally{He=!1,Re()}}}function Rt(e,t,n){"focus"===e?(At(),Kt=n,(It=t).attachEvent("onpropertychange",Ht)):"blur"===e&&At()}function Ft(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Mt(Kt)}function Dt(e,t){if("click"===e)return Mt(t)}function Ut(e,t){if("input"===e||"change"===e)return Mt(t)}W&&(Lt=ze("input")&&(!document.documentMode||9<document.documentMode));var zt={eventTypes:Tt,_isInputEventSupported:Lt,extractEvents:function(e,t,n,r){var i=t?R(t):window,o=void 0,a=void 0,l=i.nodeName&&i.nodeName.toLowerCase();if("select"===l||"input"===l&&"file"===i.type?o=Nt:De(i)?Lt?o=Ut:(o=Ft,a=Rt):(l=i.nodeName)&&"input"===l.toLowerCase()&&("checkbox"===i.type||"radio"===i.type)&&(o=Dt),o&&(o=o(e,t)))return Pt(o,n,r);a&&a(e,i,t),"blur"===e&&(e=i._wrapperState)&&e.controlled&&"number"===i.type&&xt(i,"number",i.value)}},jt=ue.extend({view:null,detail:null}),Bt={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function qt(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Bt[e])&&!!t[e]}function Wt(){return qt}var Vt=0,$t=0,Qt=!1,Gt=!1,Yt=jt.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:Wt,button:null,buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},movementX:function(e){if("movementX"in e)return e.movementX;var t=Vt;return Vt=e.screenX,Qt?"mousemove"===e.type?e.screenX-t:0:(Qt=!0,0)},movementY:function(e){if("movementY"in e)return e.movementY;var t=$t;return $t=e.screenY,Gt?"mousemove"===e.type?e.screenY-t:0:(Gt=!0,0)}}),Xt=Yt.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),Jt={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",dependencies:["pointerout","pointerover"]}},Zt={eventTypes:Jt,extractEvents:function(e,t,n,r){var i="mouseover"===e||"pointerover"===e,o="mouseout"===e||"pointerout"===e;if(i&&(n.relatedTarget||n.fromElement)||!o&&!i)return null;if(i=r.window===r?r:(i=r.ownerDocument)?i.defaultView||i.parentWindow:window,o?(o=t,t=(t=n.relatedTarget||n.toElement)?A(t):null):o=null,o===t)return null;var a=void 0,l=void 0,u=void 0,s=void 0;"mouseout"===e||"mouseover"===e?(a=Yt,l=Jt.mouseLeave,u=Jt.mouseEnter,s="mouse"):"pointerout"!==e&&"pointerover"!==e||(a=Xt,l=Jt.pointerLeave,u=Jt.pointerEnter,s="pointer");var c=null==o?i:R(o);if(i=null==t?i:R(t),(e=a.getPooled(l,o,n,r)).type=s+"leave",e.target=c,e.relatedTarget=i,(n=a.getPooled(u,t,n,r)).type=s+"enter",n.target=i,n.relatedTarget=c,r=t,o&&r)e:{for(i=r,s=0,a=t=o;a;a=D(a))s++;for(a=0,u=i;u;u=D(u))a++;for(;0<s-a;)t=D(t),s--;for(;0<a-s;)i=D(i),a--;for(;s--;){if(t===i||t===i.alternate)break e;t=D(t),i=D(i)}t=null}else t=null;for(i=t,t=[];o&&o!==i&&(null===(s=o.alternate)||s!==i);)t.push(o),o=D(o);for(o=[];r&&r!==i&&(null===(s=r.alternate)||s!==i);)o.push(r),r=D(r);for(r=0;r<t.length;r++)j(t[r],"bubbled",e);for(r=o.length;0<r--;)j(o[r],"captured",n);return[e,n]}};function en(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t}var tn=Object.prototype.hasOwnProperty;function nn(e,t){if(en(e,t))return!0;if("object"!==typeof e||null===e||"object"!==typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++)if(!tn.call(t,n[r])||!en(e[n[r]],t[n[r]]))return!1;return!0}function rn(e,t){return{responder:e,props:t}}function on(e){var t=e;if(e.alternate)for(;t.return;)t=t.return;else{if(0!==(2&t.effectTag))return 1;for(;t.return;)if(0!==(2&(t=t.return).effectTag))return 1}return 3===t.tag?2:3}function an(e){if(2!==on(e))throw a(Error(188))}function ln(e){if(!(e=function(e){var t=e.alternate;if(!t){if(3===(t=on(e)))throw a(Error(188));return 1===t?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var o=i.alternate;if(null===o){if(null!==(r=i.return)){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return an(i),e;if(o===r)return an(i),t;o=o.sibling}throw a(Error(188))}if(n.return!==r.return)n=i,r=o;else{for(var l=!1,u=i.child;u;){if(u===n){l=!0,n=i,r=o;break}if(u===r){l=!0,r=i,n=o;break}u=u.sibling}if(!l){for(u=o.child;u;){if(u===n){l=!0,n=o,r=i;break}if(u===r){l=!0,r=o,n=i;break}u=u.sibling}if(!l)throw a(Error(189))}}if(n.alternate!==r)throw a(Error(190))}if(3!==n.tag)throw a(Error(188));return n.stateNode.current===n?e:t}(e)))return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}new Map,new Map,new Set,new Map;var un=ue.extend({animationName:null,elapsedTime:null,pseudoElement:null}),sn=ue.extend({clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),cn=jt.extend({relatedTarget:null});function fn(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}for(var dn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},pn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},hn=jt.extend({key:function(e){if(e.key){var t=dn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=fn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?pn[e.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:Wt,charCode:function(e){return"keypress"===e.type?fn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?fn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),yn=Yt.extend({dataTransfer:null}),vn=jt.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:Wt}),gn=ue.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),mn=Yt.extend({deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null}),bn=[["blur","blur",0],["cancel","cancel",0],["click","click",0],["close","close",0],["contextmenu","contextMenu",0],["copy","copy",0],["cut","cut",0],["auxclick","auxClick",0],["dblclick","doubleClick",0],["dragend","dragEnd",0],["dragstart","dragStart",0],["drop","drop",0],["focus","focus",0],["input","input",0],["invalid","invalid",0],["keydown","keyDown",0],["keypress","keyPress",0],["keyup","keyUp",0],["mousedown","mouseDown",0],["mouseup","mouseUp",0],["paste","paste",0],["pause","pause",0],["play","play",0],["pointercancel","pointerCancel",0],["pointerdown","pointerDown",0],["pointerup","pointerUp",0],["ratechange","rateChange",0],["reset","reset",0],["seeked","seeked",0],["submit","submit",0],["touchcancel","touchCancel",0],["touchend","touchEnd",0],["touchstart","touchStart",0],["volumechange","volumeChange",0],["drag","drag",1],["dragenter","dragEnter",1],["dragexit","dragExit",1],["dragleave","dragLeave",1],["dragover","dragOver",1],["mousemove","mouseMove",1],["mouseout","mouseOut",1],["mouseover","mouseOver",1],["pointermove","pointerMove",1],["pointerout","pointerOut",1],["pointerover","pointerOver",1],["scroll","scroll",1],["toggle","toggle",1],["touchmove","touchMove",1],["wheel","wheel",1],["abort","abort",2],[X,"animationEnd",2],[J,"animationIteration",2],[Z,"animationStart",2],["canplay","canPlay",2],["canplaythrough","canPlayThrough",2],["durationchange","durationChange",2],["emptied","emptied",2],["encrypted","encrypted",2],["ended","ended",2],["error","error",2],["gotpointercapture","gotPointerCapture",2],["load","load",2],["loadeddata","loadedData",2],["loadedmetadata","loadedMetadata",2],["loadstart","loadStart",2],["lostpointercapture","lostPointerCapture",2],["playing","playing",2],["progress","progress",2],["seeking","seeking",2],["stalled","stalled",2],["suspend","suspend",2],["timeupdate","timeUpdate",2],[ee,"transitionEnd",2],["waiting","waiting",2]],kn={},_n={},wn=0;wn<bn.length;wn++){var En=bn[wn],Cn=En[0],Sn=En[1],xn=En[2],Tn="on"+(Sn[0].toUpperCase()+Sn.slice(1)),Pn={phasedRegistrationNames:{bubbled:Tn,captured:Tn+"Capture"},dependencies:[Cn],eventPriority:xn};kn[Sn]=Pn,_n[Cn]=Pn}var In={eventTypes:kn,getEventPriority:function(e){return void 0!==(e=_n[e])?e.eventPriority:2},extractEvents:function(e,t,n,r){var i=_n[e];if(!i)return null;switch(e){case"keypress":if(0===fn(n))return null;case"keydown":case"keyup":e=hn;break;case"blur":case"focus":e=cn;break;case"click":if(2===n.button)return null;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":e=Yt;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":e=yn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":e=vn;break;case X:case J:case Z:e=un;break;case ee:e=gn;break;case"scroll":e=jt;break;case"wheel":e=mn;break;case"copy":case"cut":case"paste":e=sn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":e=Xt;break;default:e=ue}return q(t=e.getPooled(i,t,n,r)),t}},Kn=In.getEventPriority,On=[];function Mn(e){var t=e.targetInst,n=t;do{if(!n){e.ancestors.push(n);break}var r;for(r=n;r.return;)r=r.return;if(!(r=3!==r.tag?null:r.stateNode.containerInfo))break;e.ancestors.push(n),n=A(r)}while(n);for(n=0;n<e.ancestors.length;n++){t=e.ancestors[n];var i=Ue(e.nativeEvent);r=e.topLevelType;for(var o=e.nativeEvent,a=null,l=0;l<f.length;l++){var u=f[l];u&&(u=u.extractEvents(r,t,o,i))&&(a=S(a,u))}I(a)}}var Nn=!0;function Ln(e,t){An(t,e,!1)}function An(e,t,n){switch(Kn(t)){case 0:var r=function(e,t,n){He||Le();var r=Hn,i=He;He=!0;try{Ne(r,e,t,n)}finally{(He=i)||Re()}}.bind(null,t,1);break;case 1:r=function(e,t,n){Hn(e,t,n)}.bind(null,t,1);break;default:r=Hn.bind(null,t,1)}n?e.addEventListener(t,r,!0):e.addEventListener(t,r,!1)}function Hn(e,t,n){if(Nn){if(null===(t=A(t=Ue(n)))||"number"!==typeof t.tag||2===on(t)||(t=null),On.length){var r=On.pop();r.topLevelType=e,r.nativeEvent=n,r.targetInst=t,e=r}else e={topLevelType:e,nativeEvent:n,targetInst:t,ancestors:[]};try{if(n=e,He)Mn(n);else{He=!0;try{Ae(Mn,n,void 0)}finally{He=!1,Re()}}}finally{e.topLevelType=null,e.nativeEvent=null,e.targetInst=null,e.ancestors.length=0,10>On.length&&On.push(e)}}}var Rn=new("function"===typeof WeakMap?WeakMap:Map);function Fn(e){var t=Rn.get(e);return void 0===t&&(t=new Set,Rn.set(e,t)),t}function Dn(e){if("undefined"===typeof(e=e||("undefined"!==typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Un(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function zn(e,t){var n,r=Un(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Un(r)}}function jn(){for(var e=window,t=Dn();t instanceof e.HTMLIFrameElement;){try{var n="string"===typeof t.contentWindow.location.href}catch(r){n=!1}if(!n)break;t=Dn((e=t.contentWindow).document)}return t}function Bn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var qn=W&&"documentMode"in document&&11>=document.documentMode,Wn={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Vn=null,$n=null,Qn=null,Gn=!1;function Yn(e,t){var n=t.window===t?t.document:9===t.nodeType?t:t.ownerDocument;return Gn||null==Vn||Vn!==Dn(n)?null:("selectionStart"in(n=Vn)&&Bn(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},Qn&&nn(Qn,n)?null:(Qn=n,(e=ue.getPooled(Wn.select,$n,e,t)).type="select",e.target=Vn,q(e),e))}var Xn={eventTypes:Wn,extractEvents:function(e,t,n,r){var i,o=r.window===r?r.document:9===r.nodeType?r:r.ownerDocument;if(!(i=!o)){e:{o=Fn(o),i=h.onSelect;for(var a=0;a<i.length;a++)if(!o.has(i[a])){o=!1;break e}o=!0}i=!o}if(i)return null;switch(o=t?R(t):window,e){case"focus":(De(o)||"true"===o.contentEditable)&&(Vn=o,$n=t,Qn=null);break;case"blur":Qn=$n=Vn=null;break;case"mousedown":Gn=!0;break;case"contextmenu":case"mouseup":case"dragend":return Gn=!1,Yn(n,r);case"selectionchange":if(qn)break;case"keydown":case"keyup":return Yn(n,r)}return null}};function Jn(e,t){return e=i({children:void 0},t),(t=function(e){var t="";return r.Children.forEach(e,function(e){null!=e&&(t+=e)}),t}(t.children))&&(e.children=t),e}function Zn(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+kt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n)return e[i].selected=!0,void(r&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function er(e,t){if(null!=t.dangerouslySetInnerHTML)throw a(Error(91));return i({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function tr(e,t){var n=t.value;if(null==n){if(n=t.defaultValue,null!=(t=t.children)){if(null!=n)throw a(Error(92));if(Array.isArray(t)){if(!(1>=t.length))throw a(Error(93));t=t[0]}n=t}null==n&&(n="")}e._wrapperState={initialValue:kt(n)}}function nr(e,t){var n=kt(t.value),r=kt(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function rr(e){var t=e.textContent;t===e._wrapperState.initialValue&&(e.value=t)}K.injectEventPluginOrder("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" ")),_=F,w=H,E=R,K.injectEventPluginsByName({SimpleEventPlugin:In,EnterLeaveEventPlugin:Zt,ChangeEventPlugin:zt,SelectEventPlugin:Xn,BeforeInputEventPlugin:Se});var ir={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function or(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ar(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?or(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var lr,ur=void 0,sr=(lr=function(e,t){if(e.namespaceURI!==ir.svg||"innerHTML"in e)e.innerHTML=t;else{for((ur=ur||document.createElement("div")).innerHTML="<svg>"+t+"</svg>",t=ur.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction(function(){return lr(e,t)})}:lr);function cr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var fr={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},dr=["Webkit","ms","Moz","O"];function pr(e,t,n){return null==t||"boolean"===typeof t||""===t?"":n||"number"!==typeof t||0===t||fr.hasOwnProperty(e)&&fr[e]?(""+t).trim():t+"px"}function hr(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=pr(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}Object.keys(fr).forEach(function(e){dr.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fr[t]=fr[e]})});var yr=i({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function vr(e,t){if(t){if(yr[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw a(Error(137),e,"");if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw a(Error(60));if(!("object"===typeof t.dangerouslySetInnerHTML&&"__html"in t.dangerouslySetInnerHTML))throw a(Error(61))}if(null!=t.style&&"object"!==typeof t.style)throw a(Error(62),"")}}function gr(e,t){if(-1===e.indexOf("-"))return"string"===typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function mr(e,t){var n=Fn(e=9===e.nodeType||11===e.nodeType?e:e.ownerDocument);t=h[t];for(var r=0;r<t.length;r++){var i=t[r];if(!n.has(i)){switch(i){case"scroll":An(e,"scroll",!0);break;case"focus":case"blur":An(e,"focus",!0),An(e,"blur",!0),n.add("blur"),n.add("focus");break;case"cancel":case"close":ze(i)&&An(e,i,!0);break;case"invalid":case"submit":case"reset":break;default:-1===te.indexOf(i)&&Ln(i,e)}n.add(i)}}}function br(){}var kr=null,_r=null;function wr(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function Er(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"===typeof t.children||"number"===typeof t.children||"object"===typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Cr="function"===typeof setTimeout?setTimeout:void 0,Sr="function"===typeof clearTimeout?clearTimeout:void 0;function xr(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break}return e}new Set;var Tr=[],Pr=-1;function Ir(e){0>Pr||(e.current=Tr[Pr],Tr[Pr]=null,Pr--)}function Kr(e,t){Tr[++Pr]=e.current,e.current=t}var Or={},Mr={current:Or},Nr={current:!1},Lr=Or;function Ar(e,t){var n=e.type.contextTypes;if(!n)return Or;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Hr(e){return null!==(e=e.childContextTypes)&&void 0!==e}function Rr(e){Ir(Nr),Ir(Mr)}function Fr(e){Ir(Nr),Ir(Mr)}function Dr(e,t,n){if(Mr.current!==Or)throw a(Error(168));Kr(Mr,t),Kr(Nr,n)}function Ur(e,t,n){var r=e.stateNode;if(e=t.childContextTypes,"function"!==typeof r.getChildContext)return n;for(var o in r=r.getChildContext())if(!(o in e))throw a(Error(108),st(t)||"Unknown",o);return i({},n,r)}function zr(e){var t=e.stateNode;return t=t&&t.__reactInternalMemoizedMergedChildContext||Or,Lr=Mr.current,Kr(Mr,t),Kr(Nr,Nr.current),!0}function jr(e,t,n){var r=e.stateNode;if(!r)throw a(Error(169));n?(t=Ur(e,t,Lr),r.__reactInternalMemoizedMergedChildContext=t,Ir(Nr),Ir(Mr),Kr(Mr,t)):Ir(Nr),Kr(Nr,n)}var Br=o.unstable_runWithPriority,qr=o.unstable_scheduleCallback,Wr=o.unstable_cancelCallback,Vr=o.unstable_shouldYield,$r=o.unstable_requestPaint,Qr=o.unstable_now,Gr=o.unstable_getCurrentPriorityLevel,Yr=o.unstable_ImmediatePriority,Xr=o.unstable_UserBlockingPriority,Jr=o.unstable_NormalPriority,Zr=o.unstable_LowPriority,ei=o.unstable_IdlePriority,ti={},ni=void 0!==$r?$r:function(){},ri=null,ii=null,oi=!1,ai=Qr(),li=1e4>ai?Qr:function(){return Qr()-ai};function ui(){switch(Gr()){case Yr:return 99;case Xr:return 98;case Jr:return 97;case Zr:return 96;case ei:return 95;default:throw a(Error(332))}}function si(e){switch(e){case 99:return Yr;case 98:return Xr;case 97:return Jr;case 96:return Zr;case 95:return ei;default:throw a(Error(332))}}function ci(e,t){return e=si(e),Br(e,t)}function fi(e,t,n){return e=si(e),qr(e,t,n)}function di(e){return null===ri?(ri=[e],ii=qr(Yr,hi)):ri.push(e),ti}function pi(){null!==ii&&Wr(ii),hi()}function hi(){if(!oi&&null!==ri){oi=!0;var e=0;try{var t=ri;ci(99,function(){for(;e<t.length;e++){var n=t[e];do{n=n(!0)}while(null!==n)}}),ri=null}catch(n){throw null!==ri&&(ri=ri.slice(e+1)),qr(Yr,pi),n}finally{oi=!1}}}function yi(e,t){return 1073741823===t?99:1===t?95:0>=(e=10*(1073741821-t)-10*(1073741821-e))?99:250>=e?98:5250>=e?97:95}function vi(e,t){if(e&&e.defaultProps)for(var n in t=i({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}var gi={current:null},mi=null,bi=null,ki=null;function _i(){ki=bi=mi=null}function wi(e,t){var n=e.type._context;Kr(gi,n._currentValue),n._currentValue=t}function Ei(e){var t=gi.current;Ir(gi),e.type._context._currentValue=t}function Ci(e,t){for(;null!==e;){var n=e.alternate;if(e.childExpirationTime<t)e.childExpirationTime=t,null!==n&&n.childExpirationTime<t&&(n.childExpirationTime=t);else{if(!(null!==n&&n.childExpirationTime<t))break;n.childExpirationTime=t}e=e.return}}function Si(e,t){mi=e,ki=bi=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(e.expirationTime>=t&&(sa=!0),e.firstContext=null)}function xi(e,t){if(ki!==e&&!1!==t&&0!==t)if("number"===typeof t&&1073741823!==t||(ki=e,t=1073741823),t={context:e,observedBits:t,next:null},null===bi){if(null===mi)throw a(Error(308));bi=t,mi.dependencies={expirationTime:0,firstContext:t,responders:null}}else bi=bi.next=t;return e._currentValue}var Ti=!1;function Pi(e){return{baseState:e,firstUpdate:null,lastUpdate:null,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function Ii(e){return{baseState:e.baseState,firstUpdate:e.firstUpdate,lastUpdate:e.lastUpdate,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function Ki(e,t){return{expirationTime:e,suspenseConfig:t,tag:0,payload:null,callback:null,next:null,nextEffect:null}}function Oi(e,t){null===e.lastUpdate?e.firstUpdate=e.lastUpdate=t:(e.lastUpdate.next=t,e.lastUpdate=t)}function Mi(e,t){var n=e.alternate;if(null===n){var r=e.updateQueue,i=null;null===r&&(r=e.updateQueue=Pi(e.memoizedState))}else r=e.updateQueue,i=n.updateQueue,null===r?null===i?(r=e.updateQueue=Pi(e.memoizedState),i=n.updateQueue=Pi(n.memoizedState)):r=e.updateQueue=Ii(i):null===i&&(i=n.updateQueue=Ii(r));null===i||r===i?Oi(r,t):null===r.lastUpdate||null===i.lastUpdate?(Oi(r,t),Oi(i,t)):(Oi(r,t),i.lastUpdate=t)}function Ni(e,t){var n=e.updateQueue;null===(n=null===n?e.updateQueue=Pi(e.memoizedState):Li(e,n)).lastCapturedUpdate?n.firstCapturedUpdate=n.lastCapturedUpdate=t:(n.lastCapturedUpdate.next=t,n.lastCapturedUpdate=t)}function Li(e,t){var n=e.alternate;return null!==n&&t===n.updateQueue&&(t=e.updateQueue=Ii(t)),t}function Ai(e,t,n,r,o,a){switch(n.tag){case 1:return"function"===typeof(e=n.payload)?e.call(a,r,o):e;case 3:e.effectTag=-2049&e.effectTag|64;case 0:if(null===(o="function"===typeof(e=n.payload)?e.call(a,r,o):e)||void 0===o)break;return i({},r,o);case 2:Ti=!0}return r}function Hi(e,t,n,r,i){Ti=!1;for(var o=(t=Li(e,t)).baseState,a=null,l=0,u=t.firstUpdate,s=o;null!==u;){var c=u.expirationTime;c<i?(null===a&&(a=u,o=s),l<c&&(l=c)):(Ul(c,u.suspenseConfig),s=Ai(e,0,u,s,n,r),null!==u.callback&&(e.effectTag|=32,u.nextEffect=null,null===t.lastEffect?t.firstEffect=t.lastEffect=u:(t.lastEffect.nextEffect=u,t.lastEffect=u))),u=u.next}for(c=null,u=t.firstCapturedUpdate;null!==u;){var f=u.expirationTime;f<i?(null===c&&(c=u,null===a&&(o=s)),l<f&&(l=f)):(s=Ai(e,0,u,s,n,r),null!==u.callback&&(e.effectTag|=32,u.nextEffect=null,null===t.lastCapturedEffect?t.firstCapturedEffect=t.lastCapturedEffect=u:(t.lastCapturedEffect.nextEffect=u,t.lastCapturedEffect=u))),u=u.next}null===a&&(t.lastUpdate=null),null===c?t.lastCapturedUpdate=null:e.effectTag|=32,null===a&&null===c&&(o=s),t.baseState=o,t.firstUpdate=a,t.firstCapturedUpdate=c,e.expirationTime=l,e.memoizedState=s}function Ri(e,t,n){null!==t.firstCapturedUpdate&&(null!==t.lastUpdate&&(t.lastUpdate.next=t.firstCapturedUpdate,t.lastUpdate=t.lastCapturedUpdate),t.firstCapturedUpdate=t.lastCapturedUpdate=null),Fi(t.firstEffect,n),t.firstEffect=t.lastEffect=null,Fi(t.firstCapturedEffect,n),t.firstCapturedEffect=t.lastCapturedEffect=null}function Fi(e,t){for(;null!==e;){var n=e.callback;if(null!==n){e.callback=null;var r=t;if("function"!==typeof n)throw a(Error(191),n);n.call(r)}e=e.nextEffect}}var Di=We.ReactCurrentBatchConfig,Ui=(new r.Component).refs;function zi(e,t,n,r){n=null===(n=n(r,t=e.memoizedState))||void 0===n?t:i({},t,n),e.memoizedState=n,null!==(r=e.updateQueue)&&0===e.expirationTime&&(r.baseState=n)}var ji={isMounted:function(e){return!!(e=e._reactInternalFiber)&&2===on(e)},enqueueSetState:function(e,t,n){e=e._reactInternalFiber;var r=Tl(),i=Di.suspense;(i=Ki(r=Pl(r,e,i),i)).payload=t,void 0!==n&&null!==n&&(i.callback=n),Mi(e,i),Kl(e,r)},enqueueReplaceState:function(e,t,n){e=e._reactInternalFiber;var r=Tl(),i=Di.suspense;(i=Ki(r=Pl(r,e,i),i)).tag=1,i.payload=t,void 0!==n&&null!==n&&(i.callback=n),Mi(e,i),Kl(e,r)},enqueueForceUpdate:function(e,t){e=e._reactInternalFiber;var n=Tl(),r=Di.suspense;(r=Ki(n=Pl(n,e,r),r)).tag=2,void 0!==t&&null!==t&&(r.callback=t),Mi(e,r),Kl(e,n)}};function Bi(e,t,n,r,i,o,a){return"function"===typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,a):!t.prototype||!t.prototype.isPureReactComponent||(!nn(n,r)||!nn(i,o))}function qi(e,t,n){var r=!1,i=Or,o=t.contextType;return"object"===typeof o&&null!==o?o=xi(o):(i=Hr(t)?Lr:Mr.current,o=(r=null!==(r=t.contextTypes)&&void 0!==r)?Ar(e,i):Or),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=ji,e.stateNode=t,t._reactInternalFiber=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function Wi(e,t,n,r){e=t.state,"function"===typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"===typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&ji.enqueueReplaceState(t,t.state,null)}function Vi(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs=Ui;var o=t.contextType;"object"===typeof o&&null!==o?i.context=xi(o):(o=Hr(t)?Lr:Mr.current,i.context=Ar(e,o)),null!==(o=e.updateQueue)&&(Hi(e,o,n,i,r),i.state=e.memoizedState),"function"===typeof(o=t.getDerivedStateFromProps)&&(zi(e,t,o,n),i.state=e.memoizedState),"function"===typeof t.getDerivedStateFromProps||"function"===typeof i.getSnapshotBeforeUpdate||"function"!==typeof i.UNSAFE_componentWillMount&&"function"!==typeof i.componentWillMount||(t=i.state,"function"===typeof i.componentWillMount&&i.componentWillMount(),"function"===typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),t!==i.state&&ji.enqueueReplaceState(i,i.state,null),null!==(o=e.updateQueue)&&(Hi(e,o,n,i,r),i.state=e.memoizedState)),"function"===typeof i.componentDidMount&&(e.effectTag|=4)}var $i=Array.isArray;function Qi(e,t,n){if(null!==(e=n.ref)&&"function"!==typeof e&&"object"!==typeof e){if(n._owner){n=n._owner;var r=void 0;if(n){if(1!==n.tag)throw a(Error(309));r=n.stateNode}if(!r)throw a(Error(147),e);var i=""+e;return null!==t&&null!==t.ref&&"function"===typeof t.ref&&t.ref._stringRef===i?t.ref:((t=function(e){var t=r.refs;t===Ui&&(t=r.refs={}),null===e?delete t[i]:t[i]=e})._stringRef=i,t)}if("string"!==typeof e)throw a(Error(284));if(!n._owner)throw a(Error(290),e)}return e}function Gi(e,t){if("textarea"!==e.type)throw a(Error(31),"[object Object]"===Object.prototype.toString.call(t)?"object with keys {"+Object.keys(t).join(", ")+"}":t,"")}function Yi(e){function t(t,n){if(e){var r=t.lastEffect;null!==r?(r.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n,n.nextEffect=null,n.effectTag=8}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function i(e,t,n){return(e=eu(e,t)).index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.effectTag=2,n):r:(t.effectTag=2,n):n}function l(t){return e&&null===t.alternate&&(t.effectTag=2),t}function u(e,t,n,r){return null===t||6!==t.tag?((t=ru(n,e.mode,r)).return=e,t):((t=i(t,n)).return=e,t)}function s(e,t,n,r){return null!==t&&t.elementType===n.type?((r=i(t,n.props)).ref=Qi(e,t,n),r.return=e,r):((r=tu(n.type,n.key,n.props,null,e.mode,r)).ref=Qi(e,t,n),r.return=e,r)}function c(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=iu(n,e.mode,r)).return=e,t):((t=i(t,n.children||[])).return=e,t)}function f(e,t,n,r,o){return null===t||7!==t.tag?((t=nu(n,e.mode,r,o)).return=e,t):((t=i(t,n)).return=e,t)}function d(e,t,n){if("string"===typeof t||"number"===typeof t)return(t=ru(""+t,e.mode,n)).return=e,t;if("object"===typeof t&&null!==t){switch(t.$$typeof){case Qe:return(n=tu(t.type,t.key,t.props,null,e.mode,n)).ref=Qi(e,null,t),n.return=e,n;case Ge:return(t=iu(t,e.mode,n)).return=e,t}if($i(t)||ut(t))return(t=nu(t,e.mode,n,null)).return=e,t;Gi(e,t)}return null}function p(e,t,n,r){var i=null!==t?t.key:null;if("string"===typeof n||"number"===typeof n)return null!==i?null:u(e,t,""+n,r);if("object"===typeof n&&null!==n){switch(n.$$typeof){case Qe:return n.key===i?n.type===Ye?f(e,t,n.props.children,r,i):s(e,t,n,r):null;case Ge:return n.key===i?c(e,t,n,r):null}if($i(n)||ut(n))return null!==i?null:f(e,t,n,r,null);Gi(e,n)}return null}function h(e,t,n,r,i){if("string"===typeof r||"number"===typeof r)return u(t,e=e.get(n)||null,""+r,i);if("object"===typeof r&&null!==r){switch(r.$$typeof){case Qe:return e=e.get(null===r.key?n:r.key)||null,r.type===Ye?f(t,e,r.props.children,i,r.key):s(t,e,r,i);case Ge:return c(t,e=e.get(null===r.key?n:r.key)||null,r,i)}if($i(r)||ut(r))return f(t,e=e.get(n)||null,r,i,null);Gi(t,r)}return null}function y(i,a,l,u){for(var s=null,c=null,f=a,y=a=0,v=null;null!==f&&y<l.length;y++){f.index>y?(v=f,f=null):v=f.sibling;var g=p(i,f,l[y],u);if(null===g){null===f&&(f=v);break}e&&f&&null===g.alternate&&t(i,f),a=o(g,a,y),null===c?s=g:c.sibling=g,c=g,f=v}if(y===l.length)return n(i,f),s;if(null===f){for(;y<l.length;y++)null!==(f=d(i,l[y],u))&&(a=o(f,a,y),null===c?s=f:c.sibling=f,c=f);return s}for(f=r(i,f);y<l.length;y++)null!==(v=h(f,i,y,l[y],u))&&(e&&null!==v.alternate&&f.delete(null===v.key?y:v.key),a=o(v,a,y),null===c?s=v:c.sibling=v,c=v);return e&&f.forEach(function(e){return t(i,e)}),s}function v(i,l,u,s){var c=ut(u);if("function"!==typeof c)throw a(Error(150));if(null==(u=c.call(u)))throw a(Error(151));for(var f=c=null,y=l,v=l=0,g=null,m=u.next();null!==y&&!m.done;v++,m=u.next()){y.index>v?(g=y,y=null):g=y.sibling;var b=p(i,y,m.value,s);if(null===b){null===y&&(y=g);break}e&&y&&null===b.alternate&&t(i,y),l=o(b,l,v),null===f?c=b:f.sibling=b,f=b,y=g}if(m.done)return n(i,y),c;if(null===y){for(;!m.done;v++,m=u.next())null!==(m=d(i,m.value,s))&&(l=o(m,l,v),null===f?c=m:f.sibling=m,f=m);return c}for(y=r(i,y);!m.done;v++,m=u.next())null!==(m=h(y,i,v,m.value,s))&&(e&&null!==m.alternate&&y.delete(null===m.key?v:m.key),l=o(m,l,v),null===f?c=m:f.sibling=m,f=m);return e&&y.forEach(function(e){return t(i,e)}),c}return function(e,r,o,u){var s="object"===typeof o&&null!==o&&o.type===Ye&&null===o.key;s&&(o=o.props.children);var c="object"===typeof o&&null!==o;if(c)switch(o.$$typeof){case Qe:e:{for(c=o.key,s=r;null!==s;){if(s.key===c){if(7===s.tag?o.type===Ye:s.elementType===o.type){n(e,s.sibling),(r=i(s,o.type===Ye?o.props.children:o.props)).ref=Qi(e,s,o),r.return=e,e=r;break e}n(e,s);break}t(e,s),s=s.sibling}o.type===Ye?((r=nu(o.props.children,e.mode,u,o.key)).return=e,e=r):((u=tu(o.type,o.key,o.props,null,e.mode,u)).ref=Qi(e,r,o),u.return=e,e=u)}return l(e);case Ge:e:{for(s=o.key;null!==r;){if(r.key===s){if(4===r.tag&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),(r=i(r,o.children||[])).return=e,e=r;break e}n(e,r);break}t(e,r),r=r.sibling}(r=iu(o,e.mode,u)).return=e,e=r}return l(e)}if("string"===typeof o||"number"===typeof o)return o=""+o,null!==r&&6===r.tag?(n(e,r.sibling),(r=i(r,o)).return=e,e=r):(n(e,r),(r=ru(o,e.mode,u)).return=e,e=r),l(e);if($i(o))return y(e,r,o,u);if(ut(o))return v(e,r,o,u);if(c&&Gi(e,o),"undefined"===typeof o&&!s)switch(e.tag){case 1:case 0:throw e=e.type,a(Error(152),e.displayName||e.name||"Component")}return n(e,r)}}var Xi=Yi(!0),Ji=Yi(!1),Zi={},eo={current:Zi},to={current:Zi},no={current:Zi};function ro(e){if(e===Zi)throw a(Error(174));return e}function io(e,t){Kr(no,t),Kr(to,e),Kr(eo,Zi);var n=t.nodeType;switch(n){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ar(null,"");break;default:t=ar(t=(n=8===n?t.parentNode:t).namespaceURI||null,n=n.tagName)}Ir(eo),Kr(eo,t)}function oo(e){Ir(eo),Ir(to),Ir(no)}function ao(e){ro(no.current);var t=ro(eo.current),n=ar(t,e.type);t!==n&&(Kr(to,e),Kr(eo,n))}function lo(e){to.current===e&&(Ir(eo),Ir(to))}var uo=1,so=1,co=2,fo={current:0};function po(e){for(var t=e;null!==t;){if(13===t.tag){if(null!==t.memoizedState)return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!==(64&t.effectTag))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ho=0,yo=2,vo=4,go=8,mo=16,bo=32,ko=64,_o=128,wo=We.ReactCurrentDispatcher,Eo=0,Co=null,So=null,xo=null,To=null,Po=null,Io=null,Ko=0,Oo=null,Mo=0,No=!1,Lo=null,Ao=0;function Ho(){throw a(Error(321))}function Ro(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!en(e[n],t[n]))return!1;return!0}function Fo(e,t,n,r,i,o){if(Eo=o,Co=t,xo=null!==e?e.memoizedState:null,wo.current=null===xo?Xo:Jo,t=n(r,i),No){do{No=!1,Ao+=1,xo=null!==e?e.memoizedState:null,Io=To,Oo=Po=So=null,wo.current=Jo,t=n(r,i)}while(No);Lo=null,Ao=0}if(wo.current=Yo,(e=Co).memoizedState=To,e.expirationTime=Ko,e.updateQueue=Oo,e.effectTag|=Mo,e=null!==So&&null!==So.next,Eo=0,Io=Po=To=xo=So=Co=null,Ko=0,Oo=null,Mo=0,e)throw a(Error(300));return t}function Do(){wo.current=Yo,Eo=0,Io=Po=To=xo=So=Co=null,Ko=0,Oo=null,Mo=0,No=!1,Lo=null,Ao=0}function Uo(){var e={memoizedState:null,baseState:null,queue:null,baseUpdate:null,next:null};return null===Po?To=Po=e:Po=Po.next=e,Po}function zo(){if(null!==Io)Io=(Po=Io).next,xo=null!==(So=xo)?So.next:null;else{if(null===xo)throw a(Error(310));var e={memoizedState:(So=xo).memoizedState,baseState:So.baseState,queue:So.queue,baseUpdate:So.baseUpdate,next:null};Po=null===Po?To=e:Po.next=e,xo=So.next}return Po}function jo(e,t){return"function"===typeof t?t(e):t}function Bo(e){var t=zo(),n=t.queue;if(null===n)throw a(Error(311));if(n.lastRenderedReducer=e,0<Ao){var r=n.dispatch;if(null!==Lo){var i=Lo.get(n);if(void 0!==i){Lo.delete(n);var o=t.memoizedState;do{o=e(o,i.action),i=i.next}while(null!==i);return en(o,t.memoizedState)||(sa=!0),t.memoizedState=o,t.baseUpdate===n.last&&(t.baseState=o),n.lastRenderedState=o,[o,r]}}return[t.memoizedState,r]}r=n.last;var l=t.baseUpdate;if(o=t.baseState,null!==l?(null!==r&&(r.next=null),r=l.next):r=null!==r?r.next:null,null!==r){var u=i=null,s=r,c=!1;do{var f=s.expirationTime;f<Eo?(c||(c=!0,u=l,i=o),f>Ko&&(Ko=f)):(Ul(f,s.suspenseConfig),o=s.eagerReducer===e?s.eagerState:e(o,s.action)),l=s,s=s.next}while(null!==s&&s!==r);c||(u=l,i=o),en(o,t.memoizedState)||(sa=!0),t.memoizedState=o,t.baseUpdate=u,t.baseState=i,n.lastRenderedState=o}return[t.memoizedState,n.dispatch]}function qo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===Oo?(Oo={lastEffect:null}).lastEffect=e.next=e:null===(t=Oo.lastEffect)?Oo.lastEffect=e.next=e:(n=t.next,t.next=e,e.next=n,Oo.lastEffect=e),e}function Wo(e,t,n,r){var i=Uo();Mo|=e,i.memoizedState=qo(t,n,void 0,void 0===r?null:r)}function Vo(e,t,n,r){var i=zo();r=void 0===r?null:r;var o=void 0;if(null!==So){var a=So.memoizedState;if(o=a.destroy,null!==r&&Ro(r,a.deps))return void qo(ho,n,o,r)}Mo|=e,i.memoizedState=qo(t,n,o,r)}function $o(e,t){return"function"===typeof t?(e=e(),t(e),function(){t(null)}):null!==t&&void 0!==t?(e=e(),t.current=e,function(){t.current=null}):void 0}function Qo(){}function Go(e,t,n){if(!(25>Ao))throw a(Error(301));var r=e.alternate;if(e===Co||null!==r&&r===Co)if(No=!0,e={expirationTime:Eo,suspenseConfig:null,action:n,eagerReducer:null,eagerState:null,next:null},null===Lo&&(Lo=new Map),void 0===(n=Lo.get(t)))Lo.set(t,e);else{for(t=n;null!==t.next;)t=t.next;t.next=e}else{var i=Tl(),o=Di.suspense;o={expirationTime:i=Pl(i,e,o),suspenseConfig:o,action:n,eagerReducer:null,eagerState:null,next:null};var l=t.last;if(null===l)o.next=o;else{var u=l.next;null!==u&&(o.next=u),l.next=o}if(t.last=o,0===e.expirationTime&&(null===r||0===r.expirationTime)&&null!==(r=t.lastRenderedReducer))try{var s=t.lastRenderedState,c=r(s,n);if(o.eagerReducer=r,o.eagerState=c,en(c,s))return}catch(f){}Kl(e,i)}}var Yo={readContext:xi,useCallback:Ho,useContext:Ho,useEffect:Ho,useImperativeHandle:Ho,useLayoutEffect:Ho,useMemo:Ho,useReducer:Ho,useRef:Ho,useState:Ho,useDebugValue:Ho,useResponder:Ho},Xo={readContext:xi,useCallback:function(e,t){return Uo().memoizedState=[e,void 0===t?null:t],e},useContext:xi,useEffect:function(e,t){return Wo(516,_o|ko,e,t)},useImperativeHandle:function(e,t,n){return n=null!==n&&void 0!==n?n.concat([e]):null,Wo(4,vo|bo,$o.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Wo(4,vo|bo,e,t)},useMemo:function(e,t){var n=Uo();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Uo();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e=(e=r.queue={last:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t}).dispatch=Go.bind(null,Co,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},Uo().memoizedState=e},useState:function(e){var t=Uo();return"function"===typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={last:null,dispatch:null,lastRenderedReducer:jo,lastRenderedState:e}).dispatch=Go.bind(null,Co,e),[t.memoizedState,e]},useDebugValue:Qo,useResponder:rn},Jo={readContext:xi,useCallback:function(e,t){var n=zo();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&Ro(t,r[1])?r[0]:(n.memoizedState=[e,t],e)},useContext:xi,useEffect:function(e,t){return Vo(516,_o|ko,e,t)},useImperativeHandle:function(e,t,n){return n=null!==n&&void 0!==n?n.concat([e]):null,Vo(4,vo|bo,$o.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Vo(4,vo|bo,e,t)},useMemo:function(e,t){var n=zo();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&Ro(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)},useReducer:Bo,useRef:function(){return zo().memoizedState},useState:function(e){return Bo(jo)},useDebugValue:Qo,useResponder:rn},Zo=null,ea=null,ta=!1;function na(e,t){var n=Jl(5,null,null,0);n.elementType="DELETED",n.type="DELETED",n.stateNode=t,n.return=e,n.effectTag=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function ra(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,!0);case 13:default:return!1}}function ia(e){if(ta){var t=ea;if(t){var n=t;if(!ra(e,t)){if(!(t=xr(n.nextSibling))||!ra(e,t))return e.effectTag|=2,ta=!1,void(Zo=e);na(Zo,n)}Zo=e,ea=xr(t.firstChild)}else e.effectTag|=2,ta=!1,Zo=e}}function oa(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&18!==e.tag;)e=e.return;Zo=e}function aa(e){if(e!==Zo)return!1;if(!ta)return oa(e),ta=!0,!1;var t=e.type;if(5!==e.tag||"head"!==t&&"body"!==t&&!Er(t,e.memoizedProps))for(t=ea;t;)na(e,t),t=xr(t.nextSibling);return oa(e),ea=Zo?xr(e.stateNode.nextSibling):null,!0}function la(){ea=Zo=null,ta=!1}var ua=We.ReactCurrentOwner,sa=!1;function ca(e,t,n,r){t.child=null===e?Ji(t,null,n,r):Xi(t,e.child,n,r)}function fa(e,t,n,r,i){n=n.render;var o=t.ref;return Si(t,i),r=Fo(e,t,n,r,o,i),null===e||sa?(t.effectTag|=1,ca(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=i&&(e.expirationTime=0),Ea(e,t,i))}function da(e,t,n,r,i,o){if(null===e){var a=n.type;return"function"!==typeof a||Zl(a)||void 0!==a.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=tu(n.type,null,r,null,t.mode,o)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,pa(e,t,a,r,i,o))}return a=e.child,i<o&&(i=a.memoizedProps,(n=null!==(n=n.compare)?n:nn)(i,r)&&e.ref===t.ref)?Ea(e,t,o):(t.effectTag|=1,(e=eu(a,r)).ref=t.ref,e.return=t,t.child=e)}function pa(e,t,n,r,i,o){return null!==e&&nn(e.memoizedProps,r)&&e.ref===t.ref&&(sa=!1,i<o)?Ea(e,t,o):ya(e,t,n,r,o)}function ha(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.effectTag|=128)}function ya(e,t,n,r,i){var o=Hr(n)?Lr:Mr.current;return o=Ar(t,o),Si(t,i),n=Fo(e,t,n,r,o,i),null===e||sa?(t.effectTag|=1,ca(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.effectTag&=-517,e.expirationTime<=i&&(e.expirationTime=0),Ea(e,t,i))}function va(e,t,n,r,i){if(Hr(n)){var o=!0;zr(t)}else o=!1;if(Si(t,i),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),qi(t,n,r),Vi(t,n,r,i),r=!0;else if(null===e){var a=t.stateNode,l=t.memoizedProps;a.props=l;var u=a.context,s=n.contextType;"object"===typeof s&&null!==s?s=xi(s):s=Ar(t,s=Hr(n)?Lr:Mr.current);var c=n.getDerivedStateFromProps,f="function"===typeof c||"function"===typeof a.getSnapshotBeforeUpdate;f||"function"!==typeof a.UNSAFE_componentWillReceiveProps&&"function"!==typeof a.componentWillReceiveProps||(l!==r||u!==s)&&Wi(t,a,r,s),Ti=!1;var d=t.memoizedState;u=a.state=d;var p=t.updateQueue;null!==p&&(Hi(t,p,r,a,i),u=t.memoizedState),l!==r||d!==u||Nr.current||Ti?("function"===typeof c&&(zi(t,n,c,r),u=t.memoizedState),(l=Ti||Bi(t,n,l,r,d,u,s))?(f||"function"!==typeof a.UNSAFE_componentWillMount&&"function"!==typeof a.componentWillMount||("function"===typeof a.componentWillMount&&a.componentWillMount(),"function"===typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"===typeof a.componentDidMount&&(t.effectTag|=4)):("function"===typeof a.componentDidMount&&(t.effectTag|=4),t.memoizedProps=r,t.memoizedState=u),a.props=r,a.state=u,a.context=s,r=l):("function"===typeof a.componentDidMount&&(t.effectTag|=4),r=!1)}else a=t.stateNode,l=t.memoizedProps,a.props=t.type===t.elementType?l:vi(t.type,l),u=a.context,"object"===typeof(s=n.contextType)&&null!==s?s=xi(s):s=Ar(t,s=Hr(n)?Lr:Mr.current),(f="function"===typeof(c=n.getDerivedStateFromProps)||"function"===typeof a.getSnapshotBeforeUpdate)||"function"!==typeof a.UNSAFE_componentWillReceiveProps&&"function"!==typeof a.componentWillReceiveProps||(l!==r||u!==s)&&Wi(t,a,r,s),Ti=!1,u=t.memoizedState,d=a.state=u,null!==(p=t.updateQueue)&&(Hi(t,p,r,a,i),d=t.memoizedState),l!==r||u!==d||Nr.current||Ti?("function"===typeof c&&(zi(t,n,c,r),d=t.memoizedState),(c=Ti||Bi(t,n,l,r,u,d,s))?(f||"function"!==typeof a.UNSAFE_componentWillUpdate&&"function"!==typeof a.componentWillUpdate||("function"===typeof a.componentWillUpdate&&a.componentWillUpdate(r,d,s),"function"===typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(r,d,s)),"function"===typeof a.componentDidUpdate&&(t.effectTag|=4),"function"===typeof a.getSnapshotBeforeUpdate&&(t.effectTag|=256)):("function"!==typeof a.componentDidUpdate||l===e.memoizedProps&&u===e.memoizedState||(t.effectTag|=4),"function"!==typeof a.getSnapshotBeforeUpdate||l===e.memoizedProps&&u===e.memoizedState||(t.effectTag|=256),t.memoizedProps=r,t.memoizedState=d),a.props=r,a.state=d,a.context=s,r=c):("function"!==typeof a.componentDidUpdate||l===e.memoizedProps&&u===e.memoizedState||(t.effectTag|=4),"function"!==typeof a.getSnapshotBeforeUpdate||l===e.memoizedProps&&u===e.memoizedState||(t.effectTag|=256),r=!1);return ga(e,t,n,r,o,i)}function ga(e,t,n,r,i,o){ha(e,t);var a=0!==(64&t.effectTag);if(!r&&!a)return i&&jr(t,n,!1),Ea(e,t,o);r=t.stateNode,ua.current=t;var l=a&&"function"!==typeof n.getDerivedStateFromError?null:r.render();return t.effectTag|=1,null!==e&&a?(t.child=Xi(t,e.child,null,o),t.child=Xi(t,null,l,o)):ca(e,t,l,o),t.memoizedState=r.state,i&&jr(t,n,!0),t.child}function ma(e){var t=e.stateNode;t.pendingContext?Dr(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Dr(0,t.context,!1),io(e,t.containerInfo)}var ba={};function ka(e,t,n){var r,i=t.mode,o=t.pendingProps,a=fo.current,l=null,u=!1;if((r=0!==(64&t.effectTag))||(r=0!==(a&co)&&(null===e||null!==e.memoizedState)),r?(l=ba,u=!0,t.effectTag&=-65):null!==e&&null===e.memoizedState||void 0===o.fallback||!0===o.unstable_avoidThisFallback||(a|=so),Kr(fo,a&=uo),null===e)if(u){if(o=o.fallback,(e=nu(null,i,0,null)).return=t,0===(2&t.mode))for(u=null!==t.memoizedState?t.child.child:t.child,e.child=u;null!==u;)u.return=e,u=u.sibling;(n=nu(o,i,n,null)).return=t,e.sibling=n,i=e}else i=n=Ji(t,null,o.children,n);else{if(null!==e.memoizedState)if(i=(a=e.child).sibling,u){if(o=o.fallback,(n=eu(a,a.pendingProps)).return=t,0===(2&t.mode)&&(u=null!==t.memoizedState?t.child.child:t.child)!==a.child)for(n.child=u;null!==u;)u.return=n,u=u.sibling;(o=eu(i,o,i.expirationTime)).return=t,n.sibling=o,i=n,n.childExpirationTime=0,n=o}else i=n=Xi(t,a.child,o.children,n);else if(a=e.child,u){if(u=o.fallback,(o=nu(null,i,0,null)).return=t,o.child=a,null!==a&&(a.return=o),0===(2&t.mode))for(a=null!==t.memoizedState?t.child.child:t.child,o.child=a;null!==a;)a.return=o,a=a.sibling;(n=nu(u,i,n,null)).return=t,o.sibling=n,n.effectTag|=2,i=o,o.childExpirationTime=0}else n=i=Xi(t,a,o.children,n);t.stateNode=e.stateNode}return t.memoizedState=l,t.child=i,n}function _a(e,t,n,r,i){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,last:r,tail:n,tailExpiration:0,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.last=r,o.tail=n,o.tailExpiration=0,o.tailMode=i)}function wa(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(ca(e,t,r.children,n),0!==((r=fo.current)&co))r=r&uo|co,t.effectTag|=64;else{if(null!==e&&0!==(64&e.effectTag))e:for(e=t.child;null!==e;){if(13===e.tag){if(null!==e.memoizedState){e.expirationTime<n&&(e.expirationTime=n);var a=e.alternate;null!==a&&a.expirationTime<n&&(a.expirationTime=n),Ci(e.return,n)}}else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=uo}if(Kr(fo,r),0===(2&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(r=n.alternate)&&null===po(r)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),_a(t,!1,i,n,o);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(r=i.alternate)&&null===po(r)){t.child=i;break}r=i.sibling,i.sibling=n,n=i,i=r}_a(t,!0,n,null,o);break;case"together":_a(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ea(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),t.childExpirationTime<n)return null;if(null!==e&&t.child!==e.child)throw a(Error(153));if(null!==t.child){for(n=eu(e=t.child,e.pendingProps,e.expirationTime),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=eu(e,e.pendingProps,e.expirationTime)).return=t;n.sibling=null}return t.child}function Ca(e){e.effectTag|=4}var Sa=void 0,xa=void 0,Ta=void 0,Pa=void 0;function Ia(e,t){switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ka(e){switch(e.tag){case 1:Hr(e.type)&&Rr();var t=e.effectTag;return 2048&t?(e.effectTag=-2049&t|64,e):null;case 3:if(oo(),Fr(),0!==(64&(t=e.effectTag)))throw a(Error(285));return e.effectTag=-2049&t|64,e;case 5:return lo(e),null;case 13:return Ir(fo),2048&(t=e.effectTag)?(e.effectTag=-2049&t|64,e):null;case 18:return null;case 19:return Ir(fo),null;case 4:return oo(),null;case 10:return Ei(e),null;default:return null}}function Oa(e,t){return{value:e,source:t,stack:ct(t)}}Sa=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(20===n.tag)e.appendChild(n.stateNode.instance);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},xa=function(){},Ta=function(e,t,n,r,o){var a=e.memoizedProps;if(a!==r){var l=t.stateNode;switch(ro(eo.current),e=null,n){case"input":a=_t(l,a),r=_t(l,r),e=[];break;case"option":a=Jn(l,a),r=Jn(l,r),e=[];break;case"select":a=i({},a,{value:void 0}),r=i({},r,{value:void 0}),e=[];break;case"textarea":a=er(l,a),r=er(l,r),e=[];break;default:"function"!==typeof a.onClick&&"function"===typeof r.onClick&&(l.onclick=br)}vr(n,r),l=n=void 0;var u=null;for(n in a)if(!r.hasOwnProperty(n)&&a.hasOwnProperty(n)&&null!=a[n])if("style"===n){var s=a[n];for(l in s)s.hasOwnProperty(l)&&(u||(u={}),u[l]="")}else"dangerouslySetInnerHTML"!==n&&"children"!==n&&"suppressContentEditableWarning"!==n&&"suppressHydrationWarning"!==n&&"autoFocus"!==n&&(p.hasOwnProperty(n)?e||(e=[]):(e=e||[]).push(n,null));for(n in r){var c=r[n];if(s=null!=a?a[n]:void 0,r.hasOwnProperty(n)&&c!==s&&(null!=c||null!=s))if("style"===n)if(s){for(l in s)!s.hasOwnProperty(l)||c&&c.hasOwnProperty(l)||(u||(u={}),u[l]="");for(l in c)c.hasOwnProperty(l)&&s[l]!==c[l]&&(u||(u={}),u[l]=c[l])}else u||(e||(e=[]),e.push(n,u)),u=c;else"dangerouslySetInnerHTML"===n?(c=c?c.__html:void 0,s=s?s.__html:void 0,null!=c&&s!==c&&(e=e||[]).push(n,""+c)):"children"===n?s===c||"string"!==typeof c&&"number"!==typeof c||(e=e||[]).push(n,""+c):"suppressContentEditableWarning"!==n&&"suppressHydrationWarning"!==n&&(p.hasOwnProperty(n)?(null!=c&&mr(o,n),e||s===c||(e=[])):(e=e||[]).push(n,c))}u&&(e=e||[]).push("style",u),o=e,(t.updateQueue=o)&&Ca(t)}},Pa=function(e,t,n,r){n!==r&&Ca(t)};var Ma="function"===typeof WeakSet?WeakSet:Set;function Na(e,t){var n=t.source,r=t.stack;null===r&&null!==n&&(r=ct(n)),null!==n&&st(n.type),t=t.value,null!==e&&1===e.tag&&st(e.type);try{console.error(t)}catch(i){setTimeout(function(){throw i})}}function La(e){var t=e.ref;if(null!==t)if("function"===typeof t)try{t(null)}catch(n){Vl(e,n)}else t.current=null}function Aa(e,t,n){if(null!==(n=null!==(n=n.updateQueue)?n.lastEffect:null)){var r=n=n.next;do{if((r.tag&e)!==ho){var i=r.destroy;r.destroy=void 0,void 0!==i&&i()}(r.tag&t)!==ho&&(i=r.create,r.destroy=i()),r=r.next}while(r!==n)}}function Ha(e,t){switch("function"===typeof Yl&&Yl(e),e.tag){case 0:case 11:case 14:case 15:var n=e.updateQueue;if(null!==n&&null!==(n=n.lastEffect)){var r=n.next;ci(97<t?97:t,function(){var t=r;do{var n=t.destroy;if(void 0!==n){var i=e;try{n()}catch(o){Vl(i,o)}}t=t.next}while(t!==r)})}break;case 1:La(e),"function"===typeof(t=e.stateNode).componentWillUnmount&&function(e,t){try{t.props=e.memoizedProps,t.state=e.memoizedState,t.componentWillUnmount()}catch(n){Vl(e,n)}}(e,t);break;case 5:La(e);break;case 4:Ua(e,t)}}function Ra(e,t){for(var n=e;;)if(Ha(n,t),null!==n.child&&4!==n.tag)n.child.return=n,n=n.child;else{if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}}function Fa(e){return 5===e.tag||3===e.tag||4===e.tag}function Da(e){e:{for(var t=e.return;null!==t;){if(Fa(t)){var n=t;break e}t=t.return}throw a(Error(160))}switch(t=n.stateNode,n.tag){case 5:var r=!1;break;case 3:case 4:t=t.containerInfo,r=!0;break;default:throw a(Error(161))}16&n.effectTag&&(cr(t,""),n.effectTag&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||Fa(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag&&18!==n.tag;){if(2&n.effectTag)continue t;if(null===n.child||4===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.effectTag)){n=n.stateNode;break e}}for(var i=e;;){var o=5===i.tag||6===i.tag;if(o||20===i.tag){var l=o?i.stateNode:i.stateNode.instance;if(n)if(r){var u=l;l=n,8===(o=t).nodeType?o.parentNode.insertBefore(u,l):o.insertBefore(u,l)}else t.insertBefore(l,n);else r?(8===(u=t).nodeType?(o=u.parentNode).insertBefore(l,u):(o=u).appendChild(l),null!==(u=u._reactRootContainer)&&void 0!==u||null!==o.onclick||(o.onclick=br)):t.appendChild(l)}else if(4!==i.tag&&null!==i.child){i.child.return=i,i=i.child;continue}if(i===e)break;for(;null===i.sibling;){if(null===i.return||i.return===e)return;i=i.return}i.sibling.return=i.return,i=i.sibling}}function Ua(e,t){for(var n=e,r=!1,i=void 0,o=void 0;;){if(!r){r=n.return;e:for(;;){if(null===r)throw a(Error(160));switch(i=r.stateNode,r.tag){case 5:o=!1;break e;case 3:case 4:i=i.containerInfo,o=!0;break e}r=r.return}r=!0}if(5===n.tag||6===n.tag)if(Ra(n,t),o){var l=i,u=n.stateNode;8===l.nodeType?l.parentNode.removeChild(u):l.removeChild(u)}else i.removeChild(n.stateNode);else if(20===n.tag)u=n.stateNode.instance,Ra(n,t),o?8===(l=i).nodeType?l.parentNode.removeChild(u):l.removeChild(u):i.removeChild(u);else if(4===n.tag){if(null!==n.child){i=n.stateNode.containerInfo,o=!0,n.child.return=n,n=n.child;continue}}else if(Ha(n,t),null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return;4===(n=n.return).tag&&(r=!1)}n.sibling.return=n.return,n=n.sibling}}function za(e,t){switch(t.tag){case 0:case 11:case 14:case 15:Aa(vo,go,t);break;case 1:break;case 5:var n=t.stateNode;if(null!=n){var r=t.memoizedProps,i=null!==e?e.memoizedProps:r;e=t.type;var o=t.updateQueue;if(t.updateQueue=null,null!==o){for(n[L]=r,"input"===e&&"radio"===r.type&&null!=r.name&&Et(n,r),gr(e,i),t=gr(e,r),i=0;i<o.length;i+=2){var l=o[i],u=o[i+1];"style"===l?hr(n,u):"dangerouslySetInnerHTML"===l?sr(n,u):"children"===l?cr(n,u):bt(n,l,u,t)}switch(e){case"input":Ct(n,r);break;case"textarea":nr(n,r);break;case"select":t=n._wrapperState.wasMultiple,n._wrapperState.wasMultiple=!!r.multiple,null!=(e=r.value)?Zn(n,!!r.multiple,e,!1):t!==!!r.multiple&&(null!=r.defaultValue?Zn(n,!!r.multiple,r.defaultValue,!0):Zn(n,!!r.multiple,r.multiple?[]:"",!1))}}}break;case 6:if(null===t.stateNode)throw a(Error(162));t.stateNode.nodeValue=t.memoizedProps;break;case 3:case 12:break;case 13:if(n=t,null===t.memoizedState?r=!1:(r=!0,n=t.child,pl=li()),null!==n)e:for(e=n;;){if(5===e.tag)o=e.stateNode,r?"function"===typeof(o=o.style).setProperty?o.setProperty("display","none","important"):o.display="none":(o=e.stateNode,i=void 0!==(i=e.memoizedProps.style)&&null!==i&&i.hasOwnProperty("display")?i.display:null,o.style.display=pr("display",i));else if(6===e.tag)e.stateNode.nodeValue=r?"":e.memoizedProps;else{if(13===e.tag&&null!==e.memoizedState){(o=e.child.sibling).return=e,e=o;continue}if(null!==e.child){e.child.return=e,e=e.child;continue}}if(e===n)break e;for(;null===e.sibling;){if(null===e.return||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}ja(t);break;case 19:ja(t);break;case 17:case 20:break;default:throw a(Error(163))}}function ja(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new Ma),t.forEach(function(t){var r=function(e,t){var n=e.stateNode;null!==n&&n.delete(t),n=Tl(),t=Pl(n,e,null),n=yi(n,t),null!==(e=Ol(e,t))&&Ml(e,n,t)}.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}var Ba="function"===typeof WeakMap?WeakMap:Map;function qa(e,t,n){(n=Ki(n,null)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){vl||(vl=!0,gl=r),Na(e,t)},n}function Wa(e,t,n){(n=Ki(n,null)).tag=3;var r=e.type.getDerivedStateFromError;if("function"===typeof r){var i=t.value;n.payload=function(){return Na(e,t),r(i)}}var o=e.stateNode;return null!==o&&"function"===typeof o.componentDidCatch&&(n.callback=function(){"function"!==typeof r&&(null===ml?ml=new Set([this]):ml.add(this),Na(e,t));var n=t.stack;this.componentDidCatch(t.value,{componentStack:null!==n?n:""})}),n}var Va=Math.ceil,$a=We.ReactCurrentDispatcher,Qa=We.ReactCurrentOwner,Ga=0,Ya=8,Xa=16,Ja=32,Za=0,el=1,tl=2,nl=3,rl=4,il=Ga,ol=null,al=null,ll=0,ul=Za,sl=1073741823,cl=1073741823,fl=null,dl=!1,pl=0,hl=500,yl=null,vl=!1,gl=null,ml=null,bl=!1,kl=null,_l=90,wl=0,El=null,Cl=0,Sl=null,xl=0;function Tl(){return(il&(Xa|Ja))!==Ga?1073741821-(li()/10|0):0!==xl?xl:xl=1073741821-(li()/10|0)}function Pl(e,t,n){if(0===(2&(t=t.mode)))return 1073741823;var r=ui();if(0===(4&t))return 99===r?1073741823:1073741822;if((il&Xa)!==Ga)return ll;if(null!==n)e=1073741821-25*(1+((1073741821-e+(0|n.timeoutMs||5e3)/10)/25|0));else switch(r){case 99:e=1073741823;break;case 98:e=1073741821-10*(1+((1073741821-e+15)/10|0));break;case 97:case 96:e=1073741821-25*(1+((1073741821-e+500)/25|0));break;case 95:e=1;break;default:throw a(Error(326))}return null!==ol&&e===ll&&--e,e}var Il=0;function Kl(e,t){if(50<Cl)throw Cl=0,Sl=null,a(Error(185));if(null!==(e=Ol(e,t))){e.pingTime=0;var n=ui();if(1073741823===t)if((il&Ya)!==Ga&&(il&(Xa|Ja))===Ga)for(var r=Dl(e,1073741823,!0);null!==r;)r=r(!0);else Ml(e,99,1073741823),il===Ga&&pi();else Ml(e,n,t);(4&il)===Ga||98!==n&&99!==n||(null===El?El=new Map([[e,t]]):(void 0===(n=El.get(e))||n>t)&&El.set(e,t))}}function Ol(e,t){e.expirationTime<t&&(e.expirationTime=t);var n=e.alternate;null!==n&&n.expirationTime<t&&(n.expirationTime=t);var r=e.return,i=null;if(null===r&&3===e.tag)i=e.stateNode;else for(;null!==r;){if(n=r.alternate,r.childExpirationTime<t&&(r.childExpirationTime=t),null!==n&&n.childExpirationTime<t&&(n.childExpirationTime=t),null===r.return&&3===r.tag){i=r.stateNode;break}r=r.return}return null!==i&&(t>i.firstPendingTime&&(i.firstPendingTime=t),0===(e=i.lastPendingTime)||t<e)&&(i.lastPendingTime=t),i}function Ml(e,t,n){if(e.callbackExpirationTime<n){var r=e.callbackNode;null!==r&&r!==ti&&Wr(r),e.callbackExpirationTime=n,1073741823===n?e.callbackNode=di(Nl.bind(null,e,Dl.bind(null,e,n))):(r=null,1!==n&&(r={timeout:10*(1073741821-n)-li()}),e.callbackNode=fi(t,Nl.bind(null,e,Dl.bind(null,e,n)),r))}}function Nl(e,t,n){var r=e.callbackNode,i=null;try{return null!==(i=t(n))?Nl.bind(null,e,i):null}finally{null===i&&r===e.callbackNode&&(e.callbackNode=null,e.callbackExpirationTime=0)}}function Ll(){(il&(1|Xa|Ja))===Ga&&(function(){if(null!==El){var e=El;El=null,e.forEach(function(e,t){di(Dl.bind(null,t,e))}),pi()}}(),ql())}function Al(e,t){var n=il;il|=1;try{return e(t)}finally{(il=n)===Ga&&pi()}}function Hl(e,t,n,r){var i=il;il|=4;try{return ci(98,e.bind(null,t,n,r))}finally{(il=i)===Ga&&pi()}}function Rl(e,t){var n=il;il&=-2,il|=Ya;try{return e(t)}finally{(il=n)===Ga&&pi()}}function Fl(e,t){e.finishedWork=null,e.finishedExpirationTime=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,Sr(n)),null!==al)for(n=al.return;null!==n;){var r=n;switch(r.tag){case 1:var i=r.type.childContextTypes;null!==i&&void 0!==i&&Rr();break;case 3:oo(),Fr();break;case 5:lo(r);break;case 4:oo();break;case 13:case 19:Ir(fo);break;case 10:Ei(r)}n=n.return}ol=e,al=eu(e.current,null),ll=t,ul=Za,cl=sl=1073741823,fl=null,dl=!1}function Dl(e,t,n){if((il&(Xa|Ja))!==Ga)throw a(Error(327));if(e.firstPendingTime<t)return null;if(n&&e.finishedExpirationTime===t)return Bl.bind(null,e);if(ql(),e!==ol||t!==ll)Fl(e,t);else if(ul===nl)if(dl)Fl(e,t);else{var r=e.lastPendingTime;if(r<t)return Dl.bind(null,e,r)}if(null!==al){r=il,il|=Xa;var i=$a.current;if(null===i&&(i=Yo),$a.current=Yo,n){if(1073741823!==t){var o=Tl();if(o<t)return il=r,_i(),$a.current=i,Dl.bind(null,e,o)}}else xl=0;for(;;)try{if(n)for(;null!==al;)al=zl(al);else for(;null!==al&&!Vr();)al=zl(al);break}catch(y){if(_i(),Do(),null===(o=al)||null===o.return)throw Fl(e,t),il=r,y;e:{var l=e,u=o.return,s=o,c=y,f=ll;if(s.effectTag|=1024,s.firstEffect=s.lastEffect=null,null!==c&&"object"===typeof c&&"function"===typeof c.then){var d=c,p=0!==(fo.current&so);c=u;do{var h;if((h=13===c.tag)&&(null!==c.memoizedState?h=!1:h=void 0!==(h=c.memoizedProps).fallback&&(!0!==h.unstable_avoidThisFallback||!p)),h){if(null===(u=c.updateQueue)?((u=new Set).add(d),c.updateQueue=u):u.add(d),0===(2&c.mode)){c.effectTag|=64,s.effectTag&=-1957,1===s.tag&&(null===s.alternate?s.tag=17:((f=Ki(1073741823,null)).tag=2,Mi(s,f))),s.expirationTime=1073741823;break e}s=l,l=f,null===(p=s.pingCache)?(p=s.pingCache=new Ba,u=new Set,p.set(d,u)):void 0===(u=p.get(d))&&(u=new Set,p.set(d,u)),u.has(l)||(u.add(l),s=$l.bind(null,s,d,l),d.then(s,s)),c.effectTag|=2048,c.expirationTime=f;break e}c=c.return}while(null!==c);c=Error((st(s.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display."+ct(s))}ul!==rl&&(ul=el),c=Oa(c,s),s=u;do{switch(s.tag){case 3:s.effectTag|=2048,s.expirationTime=f,Ni(s,f=qa(s,c,f));break e;case 1:if(d=c,l=s.type,u=s.stateNode,0===(64&s.effectTag)&&("function"===typeof l.getDerivedStateFromError||null!==u&&"function"===typeof u.componentDidCatch&&(null===ml||!ml.has(u)))){s.effectTag|=2048,s.expirationTime=f,Ni(s,f=Wa(s,d,f));break e}}s=s.return}while(null!==s)}al=jl(o)}if(il=r,_i(),$a.current=i,null!==al)return Dl.bind(null,e,t)}if(e.finishedWork=e.current.alternate,e.finishedExpirationTime=t,function(e,t){var n=e.firstBatch;return!!(null!==n&&n._defer&&n._expirationTime>=t)&&(fi(97,function(){return n._onComplete(),null}),!0)}(e,t))return null;switch(ol=null,ul){case Za:throw a(Error(328));case el:return(r=e.lastPendingTime)<t?Dl.bind(null,e,r):n?Bl.bind(null,e):(Fl(e,t),di(Dl.bind(null,e,t)),null);case tl:return 1073741823===sl&&!n&&10<(n=pl+hl-li())?dl?(Fl(e,t),Dl.bind(null,e,t)):(r=e.lastPendingTime)<t?Dl.bind(null,e,r):(e.timeoutHandle=Cr(Bl.bind(null,e),n),null):Bl.bind(null,e);case nl:if(!n){if(dl)return Fl(e,t),Dl.bind(null,e,t);if((n=e.lastPendingTime)<t)return Dl.bind(null,e,n);if(1073741823!==cl?n=10*(1073741821-cl)-li():1073741823===sl?n=0:(n=10*(1073741821-sl)-5e3,0>(n=(r=li())-n)&&(n=0),(t=10*(1073741821-t)-r)<(n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Va(n/1960))-n)&&(n=t)),10<n)return e.timeoutHandle=Cr(Bl.bind(null,e),n),null}return Bl.bind(null,e);case rl:return!n&&1073741823!==sl&&null!==fl&&(r=sl,0>=(t=0|(i=fl).busyMinDurationMs)?t=0:(n=0|i.busyDelayMs,t=(r=li()-(10*(1073741821-r)-(0|i.timeoutMs||5e3)))<=n?0:n+t-r),10<t)?(e.timeoutHandle=Cr(Bl.bind(null,e),t),null):Bl.bind(null,e);default:throw a(Error(329))}}function Ul(e,t){e<sl&&1<e&&(sl=e),null!==t&&e<cl&&1<e&&(cl=e,fl=t)}function zl(e){var t=Ql(e.alternate,e,ll);return e.memoizedProps=e.pendingProps,null===t&&(t=jl(e)),Qa.current=null,t}function jl(e){al=e;do{var t=al.alternate;if(e=al.return,0===(1024&al.effectTag)){e:{var n=t,r=ll,o=(t=al).pendingProps;switch(t.tag){case 2:case 16:break;case 15:case 0:break;case 1:Hr(t.type)&&Rr();break;case 3:oo(),Fr(),(r=t.stateNode).pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==n&&null!==n.child||(aa(t),t.effectTag&=-3),xa(t);break;case 5:lo(t),r=ro(no.current);var l=t.type;if(null!==n&&null!=t.stateNode)Ta(n,t,l,o,r),n.ref!==t.ref&&(t.effectTag|=128);else if(o){var u=ro(eo.current);if(aa(t)){o=void 0,l=(n=t).stateNode;var s=n.type,c=n.memoizedProps;switch(l[N]=n,l[L]=c,s){case"iframe":case"object":case"embed":Ln("load",l);break;case"video":case"audio":for(var f=0;f<te.length;f++)Ln(te[f],l);break;case"source":Ln("error",l);break;case"img":case"image":case"link":Ln("error",l),Ln("load",l);break;case"form":Ln("reset",l),Ln("submit",l);break;case"details":Ln("toggle",l);break;case"input":wt(l,c),Ln("invalid",l),mr(r,"onChange");break;case"select":l._wrapperState={wasMultiple:!!c.multiple},Ln("invalid",l),mr(r,"onChange");break;case"textarea":tr(l,c),Ln("invalid",l),mr(r,"onChange")}for(o in vr(s,c),f=null,c)c.hasOwnProperty(o)&&(u=c[o],"children"===o?"string"===typeof u?l.textContent!==u&&(f=["children",u]):"number"===typeof u&&l.textContent!==""+u&&(f=["children",""+u]):p.hasOwnProperty(o)&&null!=u&&mr(r,o));switch(s){case"input":Be(l),St(l,c,!0);break;case"textarea":Be(l),rr(l);break;case"select":case"option":break;default:"function"===typeof c.onClick&&(l.onclick=br)}r=f,n.updateQueue=r,null!==r&&Ca(t)}else{c=l,n=o,s=t,f=9===r.nodeType?r:r.ownerDocument,u===ir.html&&(u=or(c)),u===ir.html?"script"===c?((c=f.createElement("div")).innerHTML="<script><\/script>",f=c.removeChild(c.firstChild)):"string"===typeof n.is?f=f.createElement(c,{is:n.is}):(f=f.createElement(c),"select"===c&&(c=f,n.multiple?c.multiple=!0:n.size&&(c.size=n.size))):f=f.createElementNS(u,c),(c=f)[N]=s,c[L]=n,Sa(n=c,t,!1,!1),s=n;var d=r,h=gr(l,o);switch(l){case"iframe":case"object":case"embed":Ln("load",s),r=o;break;case"video":case"audio":for(r=0;r<te.length;r++)Ln(te[r],s);r=o;break;case"source":Ln("error",s),r=o;break;case"img":case"image":case"link":Ln("error",s),Ln("load",s),r=o;break;case"form":Ln("reset",s),Ln("submit",s),r=o;break;case"details":Ln("toggle",s),r=o;break;case"input":wt(s,o),r=_t(s,o),Ln("invalid",s),mr(d,"onChange");break;case"option":r=Jn(s,o);break;case"select":s._wrapperState={wasMultiple:!!o.multiple},r=i({},o,{value:void 0}),Ln("invalid",s),mr(d,"onChange");break;case"textarea":tr(s,o),r=er(s,o),Ln("invalid",s),mr(d,"onChange");break;default:r=o}vr(l,r),c=void 0,f=l,u=s;var y=r;for(c in y)if(y.hasOwnProperty(c)){var v=y[c];"style"===c?hr(u,v):"dangerouslySetInnerHTML"===c?null!=(v=v?v.__html:void 0)&&sr(u,v):"children"===c?"string"===typeof v?("textarea"!==f||""!==v)&&cr(u,v):"number"===typeof v&&cr(u,""+v):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(p.hasOwnProperty(c)?null!=v&&mr(d,c):null!=v&&bt(u,c,v,h))}switch(l){case"input":Be(s),St(s,o,!1);break;case"textarea":Be(s),rr(s);break;case"option":null!=o.value&&s.setAttribute("value",""+kt(o.value));break;case"select":r=s,s=o,r.multiple=!!s.multiple,null!=(c=s.value)?Zn(r,!!s.multiple,c,!1):null!=s.defaultValue&&Zn(r,!!s.multiple,s.defaultValue,!0);break;default:"function"===typeof r.onClick&&(s.onclick=br)}wr(l,o)&&Ca(t),t.stateNode=n}null!==t.ref&&(t.effectTag|=128)}else if(null===t.stateNode)throw a(Error(166));break;case 6:if(n&&null!=t.stateNode)Pa(n,t,n.memoizedProps,o);else{if("string"!==typeof o&&null===t.stateNode)throw a(Error(166));n=ro(no.current),ro(eo.current),aa(t)?(r=t.stateNode,n=t.memoizedProps,r[N]=t,r.nodeValue!==n&&Ca(t)):(r=t,(n=(9===n.nodeType?n:n.ownerDocument).createTextNode(o))[N]=t,r.stateNode=n)}break;case 11:break;case 13:if(Ir(fo),o=t.memoizedState,0!==(64&t.effectTag)){t.expirationTime=r;break e}r=null!==o,o=!1,null===n?aa(t):(o=null!==(l=n.memoizedState),r||null===l||null!==(l=n.child.sibling)&&(null!==(s=t.firstEffect)?(t.firstEffect=l,l.nextEffect=s):(t.firstEffect=t.lastEffect=l,l.nextEffect=null),l.effectTag=8)),r&&!o&&0!==(2&t.mode)&&(null===n&&!0!==t.memoizedProps.unstable_avoidThisFallback||0!==(fo.current&so)?ul===Za&&(ul=tl):ul!==Za&&ul!==tl||(ul=nl)),(r||o)&&(t.effectTag|=4);break;case 7:case 8:case 12:break;case 4:oo(),xa(t);break;case 10:Ei(t);break;case 9:case 14:break;case 17:Hr(t.type)&&Rr();break;case 18:break;case 19:if(Ir(fo),null===(o=t.memoizedState))break;if(l=0!==(64&t.effectTag),null===(s=o.rendering)){if(l)Ia(o,!1);else if(ul!==Za||null!==n&&0!==(64&n.effectTag))for(n=t.child;null!==n;){if(null!==(s=po(n))){for(t.effectTag|=64,Ia(o,!1),null!==(n=s.updateQueue)&&(t.updateQueue=n,t.effectTag|=4),t.firstEffect=t.lastEffect=null,n=t.child;null!==n;)l=r,(o=n).effectTag&=2,o.nextEffect=null,o.firstEffect=null,o.lastEffect=null,null===(s=o.alternate)?(o.childExpirationTime=0,o.expirationTime=l,o.child=null,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null):(o.childExpirationTime=s.childExpirationTime,o.expirationTime=s.expirationTime,o.child=s.child,o.memoizedProps=s.memoizedProps,o.memoizedState=s.memoizedState,o.updateQueue=s.updateQueue,l=s.dependencies,o.dependencies=null===l?null:{expirationTime:l.expirationTime,firstContext:l.firstContext,responders:l.responders}),n=n.sibling;Kr(fo,fo.current&uo|co),t=t.child;break e}n=n.sibling}}else{if(!l)if(null!==(n=po(s))){if(t.effectTag|=64,l=!0,Ia(o,!0),null===o.tail&&"hidden"===o.tailMode){null!==(r=n.updateQueue)&&(t.updateQueue=r,t.effectTag|=4),null!==(t=t.lastEffect=o.lastEffect)&&(t.nextEffect=null);break}}else li()>o.tailExpiration&&1<r&&(t.effectTag|=64,l=!0,Ia(o,!1),t.expirationTime=t.childExpirationTime=r-1);o.isBackwards?(s.sibling=t.child,t.child=s):(null!==(r=o.last)?r.sibling=s:t.child=s,o.last=s)}if(null!==o.tail){0===o.tailExpiration&&(o.tailExpiration=li()+500),r=o.tail,o.rendering=r,o.tail=r.sibling,o.lastEffect=t.lastEffect,r.sibling=null,n=fo.current,Kr(fo,n=l?n&uo|co:n&uo),t=r;break e}break;case 20:break;default:throw a(Error(156))}t=null}if(r=al,1===ll||1!==r.childExpirationTime){for(n=0,o=r.child;null!==o;)(l=o.expirationTime)>n&&(n=l),(s=o.childExpirationTime)>n&&(n=s),o=o.sibling;r.childExpirationTime=n}if(null!==t)return t;null!==e&&0===(1024&e.effectTag)&&(null===e.firstEffect&&(e.firstEffect=al.firstEffect),null!==al.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=al.firstEffect),e.lastEffect=al.lastEffect),1<al.effectTag&&(null!==e.lastEffect?e.lastEffect.nextEffect=al:e.firstEffect=al,e.lastEffect=al))}else{if(null!==(t=Ka(al)))return t.effectTag&=1023,t;null!==e&&(e.firstEffect=e.lastEffect=null,e.effectTag|=1024)}if(null!==(t=al.sibling))return t;al=e}while(null!==al);return ul===Za&&(ul=rl),null}function Bl(e){var t=ui();return ci(99,function(e,t){if(ql(),(il&(Xa|Ja))!==Ga)throw a(Error(327));var n=e.finishedWork,r=e.finishedExpirationTime;if(null===n)return null;if(e.finishedWork=null,e.finishedExpirationTime=0,n===e.current)throw a(Error(177));e.callbackNode=null,e.callbackExpirationTime=0;var i=n.expirationTime,o=n.childExpirationTime;if(i=o>i?o:i,e.firstPendingTime=i,i<e.lastPendingTime&&(e.lastPendingTime=i),e===ol&&(al=ol=null,ll=0),1<n.effectTag?null!==n.lastEffect?(n.lastEffect.nextEffect=n,i=n.firstEffect):i=n:i=n.firstEffect,null!==i){o=il,il|=Ja,Qa.current=null,kr=Nn;var l=jn();if(Bn(l)){if("selectionStart"in l)var u={start:l.selectionStart,end:l.selectionEnd};else e:{var s=(u=(u=l.ownerDocument)&&u.defaultView||window).getSelection&&u.getSelection();if(s&&0!==s.rangeCount){u=s.anchorNode;var c=s.anchorOffset,f=s.focusNode;s=s.focusOffset;try{u.nodeType,f.nodeType}catch(D){u=null;break e}var d=0,p=-1,h=-1,y=0,v=0,g=l,m=null;t:for(;;){for(var b;g!==u||0!==c&&3!==g.nodeType||(p=d+c),g!==f||0!==s&&3!==g.nodeType||(h=d+s),3===g.nodeType&&(d+=g.nodeValue.length),null!==(b=g.firstChild);)m=g,g=b;for(;;){if(g===l)break t;if(m===u&&++y===c&&(p=d),m===f&&++v===s&&(h=d),null!==(b=g.nextSibling))break;m=(g=m).parentNode}g=b}u=-1===p||-1===h?null:{start:p,end:h}}else u=null}u=u||{start:0,end:0}}else u=null;_r={focusedElem:l,selectionRange:u},Nn=!1,yl=i;do{try{for(;null!==yl;){if(0!==(256&yl.effectTag)){var k=yl.alternate;switch((l=yl).tag){case 0:case 11:case 15:Aa(yo,ho,l);break;case 1:if(256&l.effectTag&&null!==k){var _=k.memoizedProps,w=k.memoizedState,E=l.stateNode,C=E.getSnapshotBeforeUpdate(l.elementType===l.type?_:vi(l.type,_),w);E.__reactInternalSnapshotBeforeUpdate=C}break;case 3:case 5:case 6:case 4:case 17:break;default:throw a(Error(163))}}yl=yl.nextEffect}}catch(D){if(null===yl)throw a(Error(330));Vl(yl,D),yl=yl.nextEffect}}while(null!==yl);yl=i;do{try{for(k=t;null!==yl;){var S=yl.effectTag;if(16&S&&cr(yl.stateNode,""),128&S){var x=yl.alternate;if(null!==x){var T=x.ref;null!==T&&("function"===typeof T?T(null):T.current=null)}}switch(14&S){case 2:Da(yl),yl.effectTag&=-3;break;case 6:Da(yl),yl.effectTag&=-3,za(yl.alternate,yl);break;case 4:za(yl.alternate,yl);break;case 8:Ua(_=yl,k),_.return=null,_.child=null,_.memoizedState=null,_.updateQueue=null,_.dependencies=null;var P=_.alternate;null!==P&&(P.return=null,P.child=null,P.memoizedState=null,P.updateQueue=null,P.dependencies=null)}yl=yl.nextEffect}}catch(D){if(null===yl)throw a(Error(330));Vl(yl,D),yl=yl.nextEffect}}while(null!==yl);if(T=_r,x=jn(),S=T.focusedElem,k=T.selectionRange,x!==S&&S&&S.ownerDocument&&function e(t,n){return!(!t||!n)&&(t===n||(!t||3!==t.nodeType)&&(n&&3===n.nodeType?e(t,n.parentNode):"contains"in t?t.contains(n):!!t.compareDocumentPosition&&!!(16&t.compareDocumentPosition(n))))}(S.ownerDocument.documentElement,S)){null!==k&&Bn(S)&&(x=k.start,void 0===(T=k.end)&&(T=x),"selectionStart"in S?(S.selectionStart=x,S.selectionEnd=Math.min(T,S.value.length)):(T=(x=S.ownerDocument||document)&&x.defaultView||window).getSelection&&(T=T.getSelection(),_=S.textContent.length,P=Math.min(k.start,_),k=void 0===k.end?P:Math.min(k.end,_),!T.extend&&P>k&&(_=k,k=P,P=_),_=zn(S,P),w=zn(S,k),_&&w&&(1!==T.rangeCount||T.anchorNode!==_.node||T.anchorOffset!==_.offset||T.focusNode!==w.node||T.focusOffset!==w.offset)&&((x=x.createRange()).setStart(_.node,_.offset),T.removeAllRanges(),P>k?(T.addRange(x),T.extend(w.node,w.offset)):(x.setEnd(w.node,w.offset),T.addRange(x))))),x=[];for(T=S;T=T.parentNode;)1===T.nodeType&&x.push({element:T,left:T.scrollLeft,top:T.scrollTop});for("function"===typeof S.focus&&S.focus(),S=0;S<x.length;S++)(T=x[S]).element.scrollLeft=T.left,T.element.scrollTop=T.top}_r=null,Nn=!!kr,kr=null,e.current=n,yl=i;do{try{for(S=r;null!==yl;){var I=yl.effectTag;if(36&I){var K=yl.alternate;switch(T=S,(x=yl).tag){case 0:case 11:case 15:Aa(mo,bo,x);break;case 1:var O=x.stateNode;if(4&x.effectTag)if(null===K)O.componentDidMount();else{var M=x.elementType===x.type?K.memoizedProps:vi(x.type,K.memoizedProps);O.componentDidUpdate(M,K.memoizedState,O.__reactInternalSnapshotBeforeUpdate)}var N=x.updateQueue;null!==N&&Ri(0,N,O);break;case 3:var L=x.updateQueue;if(null!==L){if(P=null,null!==x.child)switch(x.child.tag){case 5:P=x.child.stateNode;break;case 1:P=x.child.stateNode}Ri(0,L,P)}break;case 5:var A=x.stateNode;null===K&&4&x.effectTag&&(T=A,wr(x.type,x.memoizedProps)&&T.focus());break;case 6:case 4:case 12:break;case 13:case 19:case 17:case 20:break;default:throw a(Error(163))}}if(128&I){var H=yl.ref;if(null!==H){var R=yl.stateNode;switch(yl.tag){case 5:var F=R;break;default:F=R}"function"===typeof H?H(F):H.current=F}}512&I&&(bl=!0),yl=yl.nextEffect}}catch(D){if(null===yl)throw a(Error(330));Vl(yl,D),yl=yl.nextEffect}}while(null!==yl);yl=null,ni(),il=o}else e.current=n;if(bl)bl=!1,kl=e,wl=r,_l=t;else for(yl=i;null!==yl;)t=yl.nextEffect,yl.nextEffect=null,yl=t;if(0!==(t=e.firstPendingTime)?(I=yi(I=Tl(),t),Ml(e,I,t)):ml=null,"function"===typeof Gl&&Gl(n.stateNode,r),1073741823===t?e===Sl?Cl++:(Cl=0,Sl=e):Cl=0,vl)throw vl=!1,e=gl,gl=null,e;return(il&Ya)!==Ga?null:(pi(),null)}.bind(null,e,t)),null!==kl&&fi(97,function(){return ql(),null}),null}function ql(){if(null===kl)return!1;var e=kl,t=wl,n=_l;return kl=null,wl=0,_l=90,ci(97<n?97:n,function(e){if((il&(Xa|Ja))!==Ga)throw a(Error(331));var t=il;for(il|=Ja,e=e.current.firstEffect;null!==e;){try{var n=e;if(0!==(512&n.effectTag))switch(n.tag){case 0:case 11:case 15:Aa(_o,ho,n),Aa(ho,ko,n)}}catch(r){if(null===e)throw a(Error(330));Vl(e,r)}n=e.nextEffect,e.nextEffect=null,e=n}return il=t,pi(),!0}.bind(null,e,t))}function Wl(e,t,n){Mi(e,t=qa(e,t=Oa(n,t),1073741823)),null!==(e=Ol(e,1073741823))&&Ml(e,99,1073741823)}function Vl(e,t){if(3===e.tag)Wl(e,e,t);else for(var n=e.return;null!==n;){if(3===n.tag){Wl(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"===typeof n.type.getDerivedStateFromError||"function"===typeof r.componentDidCatch&&(null===ml||!ml.has(r))){Mi(n,e=Wa(n,e=Oa(t,e),1073741823)),null!==(n=Ol(n,1073741823))&&Ml(n,99,1073741823);break}}n=n.return}}function $l(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),ol===e&&ll===n?ul===nl||ul===tl&&1073741823===sl&&li()-pl<hl?Fl(e,ll):dl=!0:e.lastPendingTime<n||(0!==(t=e.pingTime)&&t<n||(e.pingTime=n,e.finishedExpirationTime===n&&(e.finishedExpirationTime=0,e.finishedWork=null),Ml(e,t=yi(t=Tl(),n),n)))}var Ql=void 0;Ql=function(e,t,n){var r=t.expirationTime;if(null!==e){var i=t.pendingProps;if(e.memoizedProps!==i||Nr.current)sa=!0;else if(r<n){switch(sa=!1,t.tag){case 3:ma(t),la();break;case 5:if(ao(t),4&t.mode&&1!==n&&i.hidden)return t.expirationTime=t.childExpirationTime=1,null;break;case 1:Hr(t.type)&&zr(t);break;case 4:io(t,t.stateNode.containerInfo);break;case 10:wi(t,t.memoizedProps.value);break;case 13:if(null!==t.memoizedState)return 0!==(r=t.child.childExpirationTime)&&r>=n?ka(e,t,n):(Kr(fo,fo.current&uo),null!==(t=Ea(e,t,n))?t.sibling:null);Kr(fo,fo.current&uo);break;case 19:if(r=t.childExpirationTime>=n,0!==(64&e.effectTag)){if(r)return wa(e,t,n);t.effectTag|=64}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null),Kr(fo,fo.current),!r)return null}return Ea(e,t,n)}}else sa=!1;switch(t.expirationTime=0,t.tag){case 2:if(r=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,i=Ar(t,Mr.current),Si(t,n),i=Fo(null,t,r,e,i,n),t.effectTag|=1,"object"===typeof i&&null!==i&&"function"===typeof i.render&&void 0===i.$$typeof){if(t.tag=1,Do(),Hr(r)){var o=!0;zr(t)}else o=!1;t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null;var l=r.getDerivedStateFromProps;"function"===typeof l&&zi(t,r,l,e),i.updater=ji,t.stateNode=i,i._reactInternalFiber=t,Vi(t,r,e,n),t=ga(null,t,r,!0,o,n)}else t.tag=0,ca(null,t,i,n),t=t.child;return t;case 16:switch(i=t.elementType,null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),e=t.pendingProps,i=function(e){var t=e._result;switch(e._status){case 1:return t;case 2:case 0:throw t;default:switch(e._status=0,(t=(t=e._ctor)()).then(function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)},function(t){0===e._status&&(e._status=2,e._result=t)}),e._status){case 1:return e._result;case 2:throw e._result}throw e._result=t,t}}(i),t.type=i,o=t.tag=function(e){if("function"===typeof e)return Zl(e)?1:0;if(void 0!==e&&null!==e){if((e=e.$$typeof)===nt)return 11;if(e===ot)return 14}return 2}(i),e=vi(i,e),o){case 0:t=ya(null,t,i,e,n);break;case 1:t=va(null,t,i,e,n);break;case 11:t=fa(null,t,i,e,n);break;case 14:t=da(null,t,i,vi(i.type,e),r,n);break;default:throw a(Error(306),i,"")}return t;case 0:return r=t.type,i=t.pendingProps,ya(e,t,r,i=t.elementType===r?i:vi(r,i),n);case 1:return r=t.type,i=t.pendingProps,va(e,t,r,i=t.elementType===r?i:vi(r,i),n);case 3:if(ma(t),null===(r=t.updateQueue))throw a(Error(282));return i=null!==(i=t.memoizedState)?i.element:null,Hi(t,r,t.pendingProps,null,n),(r=t.memoizedState.element)===i?(la(),t=Ea(e,t,n)):(i=t.stateNode,(i=(null===e||null===e.child)&&i.hydrate)&&(ea=xr(t.stateNode.containerInfo.firstChild),Zo=t,i=ta=!0),i?(t.effectTag|=2,t.child=Ji(t,null,r,n)):(ca(e,t,r,n),la()),t=t.child),t;case 5:return ao(t),null===e&&ia(t),r=t.type,i=t.pendingProps,o=null!==e?e.memoizedProps:null,l=i.children,Er(r,i)?l=null:null!==o&&Er(r,o)&&(t.effectTag|=16),ha(e,t),4&t.mode&&1!==n&&i.hidden?(t.expirationTime=t.childExpirationTime=1,t=null):(ca(e,t,l,n),t=t.child),t;case 6:return null===e&&ia(t),null;case 13:return ka(e,t,n);case 4:return io(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=Xi(t,null,r,n):ca(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,fa(e,t,r,i=t.elementType===r?i:vi(r,i),n);case 7:return ca(e,t,t.pendingProps,n),t.child;case 8:case 12:return ca(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,l=t.memoizedProps,wi(t,o=i.value),null!==l){var u=l.value;if(0===(o=en(u,o)?0:0|("function"===typeof r._calculateChangedBits?r._calculateChangedBits(u,o):1073741823))){if(l.children===i.children&&!Nr.current){t=Ea(e,t,n);break e}}else for(null!==(u=t.child)&&(u.return=t);null!==u;){var s=u.dependencies;if(null!==s){l=u.child;for(var c=s.firstContext;null!==c;){if(c.context===r&&0!==(c.observedBits&o)){1===u.tag&&((c=Ki(n,null)).tag=2,Mi(u,c)),u.expirationTime<n&&(u.expirationTime=n),null!==(c=u.alternate)&&c.expirationTime<n&&(c.expirationTime=n),Ci(u.return,n),s.expirationTime<n&&(s.expirationTime=n);break}c=c.next}}else l=10===u.tag&&u.type===t.type?null:u.child;if(null!==l)l.return=u;else for(l=u;null!==l;){if(l===t){l=null;break}if(null!==(u=l.sibling)){u.return=l.return,l=u;break}l=l.return}u=l}}ca(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=(o=t.pendingProps).children,Si(t,n),r=r(i=xi(i,o.unstable_observedBits)),t.effectTag|=1,ca(e,t,r,n),t.child;case 14:return o=vi(i=t.type,t.pendingProps),da(e,t,i,o=vi(i.type,o),r,n);case 15:return pa(e,t,t.type,t.pendingProps,r,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:vi(r,i),null!==e&&(e.alternate=null,t.alternate=null,t.effectTag|=2),t.tag=1,Hr(r)?(e=!0,zr(t)):e=!1,Si(t,n),qi(t,r,i),Vi(t,r,i,n),ga(null,t,r,!0,e,n);case 19:return wa(e,t,n)}throw a(Error(156))};var Gl=null,Yl=null;function Xl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childExpirationTime=this.expirationTime=0,this.alternate=null}function Jl(e,t,n,r){return new Xl(e,t,n,r)}function Zl(e){return!(!(e=e.prototype)||!e.isReactComponent)}function eu(e,t){var n=e.alternate;return null===n?((n=Jl(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.effectTag=0,n.nextEffect=null,n.firstEffect=null,n.lastEffect=null),n.childExpirationTime=e.childExpirationTime,n.expirationTime=e.expirationTime,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{expirationTime:t.expirationTime,firstContext:t.firstContext,responders:t.responders},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function tu(e,t,n,r,i,o){var l=2;if(r=e,"function"===typeof e)Zl(e)&&(l=1);else if("string"===typeof e)l=5;else e:switch(e){case Ye:return nu(n.children,i,o,t);case tt:l=8,i|=7;break;case Xe:l=8,i|=1;break;case Je:return(e=Jl(12,n,t,8|i)).elementType=Je,e.type=Je,e.expirationTime=o,e;case rt:return(e=Jl(13,n,t,i)).type=rt,e.elementType=rt,e.expirationTime=o,e;case it:return(e=Jl(19,n,t,i)).elementType=it,e.expirationTime=o,e;default:if("object"===typeof e&&null!==e)switch(e.$$typeof){case Ze:l=10;break e;case et:l=9;break e;case nt:l=11;break e;case ot:l=14;break e;case at:l=16,r=null;break e}throw a(Error(130),null==e?e:typeof e,"")}return(t=Jl(l,n,t,i)).elementType=e,t.type=r,t.expirationTime=o,t}function nu(e,t,n,r){return(e=Jl(7,e,r,t)).expirationTime=n,e}function ru(e,t,n){return(e=Jl(6,e,null,t)).expirationTime=n,e}function iu(e,t,n){return(t=Jl(4,null!==e.children?e.children:[],e.key,t)).expirationTime=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function ou(e,t,n){this.tag=t,this.current=null,this.containerInfo=e,this.pingCache=this.pendingChildren=null,this.finishedExpirationTime=0,this.finishedWork=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=n,this.callbackNode=this.firstBatch=null,this.pingTime=this.lastPendingTime=this.firstPendingTime=this.callbackExpirationTime=0}function au(e,t,n){return e=new ou(e,t,n),t=Jl(3,null,null,2===t?7:1===t?3:0),e.current=t,t.stateNode=e}function lu(e,t,n,r,i,o){var l=t.current;e:if(n){t:{if(2!==on(n=n._reactInternalFiber)||1!==n.tag)throw a(Error(170));var u=n;do{switch(u.tag){case 3:u=u.stateNode.context;break t;case 1:if(Hr(u.type)){u=u.stateNode.__reactInternalMemoizedMergedChildContext;break t}}u=u.return}while(null!==u);throw a(Error(171))}if(1===n.tag){var s=n.type;if(Hr(s)){n=Ur(n,s,u);break e}}n=u}else n=Or;return null===t.context?t.context=n:t.pendingContext=n,t=o,(i=Ki(r,i)).payload={element:e},null!==(t=void 0===t?null:t)&&(i.callback=t),Mi(l,i),Kl(l,r),r}function uu(e,t,n,r){var i=t.current,o=Tl(),a=Di.suspense;return lu(e,t,n,i=Pl(o,i,a),a,r)}function su(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 5:default:return e.child.stateNode}}function cu(e){var t=1073741821-25*(1+((1073741821-Tl()+500)/25|0));t<=Il&&--t,this._expirationTime=Il=t,this._root=e,this._callbacks=this._next=null,this._hasChildren=this._didComplete=!1,this._children=null,this._defer=!0}function fu(){this._callbacks=null,this._didCommit=!1,this._onCommit=this._onCommit.bind(this)}function du(e,t,n){this._internalRoot=au(e,t,n)}function pu(e,t){this._internalRoot=au(e,2,t)}function hu(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function yu(e,t,n,r,i){var o=n._reactRootContainer,a=void 0;if(o){if(a=o._internalRoot,"function"===typeof i){var l=i;i=function(){var e=su(a);l.call(e)}}uu(t,a,e,i)}else{if(o=n._reactRootContainer=function(e,t){if(t||(t=!(!(t=e?9===e.nodeType?e.documentElement:e.firstChild:null)||1!==t.nodeType||!t.hasAttribute("data-reactroot"))),!t)for(var n;n=e.lastChild;)e.removeChild(n);return new du(e,0,t)}(n,r),a=o._internalRoot,"function"===typeof i){var u=i;i=function(){var e=su(a);u.call(e)}}Rl(function(){uu(t,a,e,i)})}return su(a)}function vu(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!hu(t))throw a(Error(200));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:Ge,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)}xe=function(e,t,n){switch(t){case"input":if(Ct(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=F(r);if(!i)throw a(Error(90));qe(r),Ct(r,i)}}}break;case"textarea":nr(e,n);break;case"select":null!=(t=n.value)&&Zn(e,!!n.multiple,t,!1)}},cu.prototype.render=function(e){if(!this._defer)throw a(Error(250));this._hasChildren=!0,this._children=e;var t=this._root._internalRoot,n=this._expirationTime,r=new fu;return lu(e,t,null,n,null,r._onCommit),r},cu.prototype.then=function(e){if(this._didComplete)e();else{var t=this._callbacks;null===t&&(t=this._callbacks=[]),t.push(e)}},cu.prototype.commit=function(){var e=this._root._internalRoot,t=e.firstBatch;if(!this._defer||null===t)throw a(Error(251));if(this._hasChildren){var n=this._expirationTime;if(t!==this){this._hasChildren&&(n=this._expirationTime=t._expirationTime,this.render(this._children));for(var r=null,i=t;i!==this;)r=i,i=i._next;if(null===r)throw a(Error(251));r._next=i._next,this._next=t,e.firstBatch=this}if(this._defer=!1,t=n,(il&(Xa|Ja))!==Ga)throw a(Error(253));di(Dl.bind(null,e,t)),pi(),t=this._next,this._next=null,null!==(t=e.firstBatch=t)&&t._hasChildren&&t.render(t._children)}else this._next=null,this._defer=!1},cu.prototype._onComplete=function(){if(!this._didComplete){this._didComplete=!0;var e=this._callbacks;if(null!==e)for(var t=0;t<e.length;t++)(0,e[t])()}},fu.prototype.then=function(e){if(this._didCommit)e();else{var t=this._callbacks;null===t&&(t=this._callbacks=[]),t.push(e)}},fu.prototype._onCommit=function(){if(!this._didCommit){this._didCommit=!0;var e=this._callbacks;if(null!==e)for(var t=0;t<e.length;t++){var n=e[t];if("function"!==typeof n)throw a(Error(191),n);n()}}},pu.prototype.render=du.prototype.render=function(e,t){var n=this._internalRoot,r=new fu;return null!==(t=void 0===t?null:t)&&r.then(t),uu(e,n,null,r._onCommit),r},pu.prototype.unmount=du.prototype.unmount=function(e){var t=this._internalRoot,n=new fu;return null!==(e=void 0===e?null:e)&&n.then(e),uu(null,t,null,n._onCommit),n},pu.prototype.createBatch=function(){var e=new cu(this),t=e._expirationTime,n=this._internalRoot,r=n.firstBatch;if(null===r)n.firstBatch=e,e._next=null;else{for(n=null;null!==r&&r._expirationTime>=t;)n=r,r=r._next;e._next=r,null!==n&&(n._next=e)}return e},Me=Al,Ne=Hl,Le=Ll,Ae=function(e,t){var n=il;il|=2;try{return e(t)}finally{(il=n)===Ga&&pi()}};var gu={createPortal:vu,findDOMNode:function(e){if(null==e)e=null;else if(1!==e.nodeType){var t=e._reactInternalFiber;if(void 0===t){if("function"===typeof e.render)throw a(Error(188));throw a(Error(268),Object.keys(e))}e=null===(e=ln(t))?null:e.stateNode}return e},hydrate:function(e,t,n){if(!hu(t))throw a(Error(200));return yu(null,e,t,!0,n)},render:function(e,t,n){if(!hu(t))throw a(Error(200));return yu(null,e,t,!1,n)},unstable_renderSubtreeIntoContainer:function(e,t,n,r){if(!hu(n))throw a(Error(200));if(null==e||void 0===e._reactInternalFiber)throw a(Error(38));return yu(e,t,n,!1,r)},unmountComponentAtNode:function(e){if(!hu(e))throw a(Error(40));return!!e._reactRootContainer&&(Rl(function(){yu(null,null,e,!1,function(){e._reactRootContainer=null})}),!0)},unstable_createPortal:function(){return vu.apply(void 0,arguments)},unstable_batchedUpdates:Al,unstable_interactiveUpdates:function(e,t,n,r){return Ll(),Hl(e,t,n,r)},unstable_discreteUpdates:Hl,unstable_flushDiscreteUpdates:Ll,flushSync:function(e,t){if((il&(Xa|Ja))!==Ga)throw a(Error(187));var n=il;il|=1;try{return ci(99,e.bind(null,t))}finally{il=n,pi()}},unstable_createRoot:function(e,t){if(!hu(e))throw a(Error(299),"unstable_createRoot");return new pu(e,null!=t&&!0===t.hydrate)},unstable_createSyncRoot:function(e,t){if(!hu(e))throw a(Error(299),"unstable_createRoot");return new du(e,1,null!=t&&!0===t.hydrate)},unstable_flushControlled:function(e){var t=il;il|=1;try{ci(99,e)}finally{(il=t)===Ga&&pi()}},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{Events:[H,R,F,K.injectEventPluginsByName,d,q,function(e){x(e,B)},Ke,Oe,Hn,I,ql,{current:!1}]}};!function(e){var t=e.findFiberByHostInstance;(function(e){if("undefined"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)return!0;try{var n=t.inject(e);Gl=function(e){try{t.onCommitFiberRoot(n,e,void 0,64===(64&e.current.effectTag))}catch(r){}},Yl=function(e){try{t.onCommitFiberUnmount(n,e)}catch(r){}}}catch(r){}})(i({},e,{overrideHookState:null,overrideProps:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:We.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=ln(e))?null:e.stateNode},findFiberByHostInstance:function(e){return t?t(e):null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null}))}({findFiberByHostInstance:A,bundleType:0,version:"16.9.0",rendererPackageName:"react-dom"});var mu={default:gu},bu=mu&&gu||mu;e.exports=bu.default||bu},function(e,t,n){"use strict";e.exports=n(16)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=void 0,i=void 0,o=void 0,a=void 0,l=void 0;if(t.unstable_now=void 0,t.unstable_forceFrameRate=void 0,"undefined"===typeof window||"function"!==typeof MessageChannel){var u=null,s=null,c=function e(){if(null!==u)try{var n=t.unstable_now();u(!0,n),u=null}catch(r){throw setTimeout(e,0),r}};t.unstable_now=function(){return Date.now()},r=function(e){null!==u?setTimeout(r,0,e):(u=e,setTimeout(c,0))},i=function(e,t){s=setTimeout(e,t)},o=function(){clearTimeout(s)},a=function(){return!1},l=t.unstable_forceFrameRate=function(){}}else{var f=window.performance,d=window.Date,p=window.setTimeout,h=window.clearTimeout,y=window.requestAnimationFrame,v=window.cancelAnimationFrame;"undefined"!==typeof console&&("function"!==typeof y&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!==typeof v&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")),t.unstable_now="object"===typeof f&&"function"===typeof f.now?function(){return f.now()}:function(){return d.now()};var g=!1,m=null,b=-1,k=-1,_=33.33,w=-1,E=-1,C=0,S=!1;a=function(){return t.unstable_now()>=C},l=function(){},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):0<e?(_=Math.floor(1e3/e),S=!0):(_=33.33,S=!1)};var x=function(){if(null!==m){var e=t.unstable_now(),n=0<C-e;try{m(n,e)||(m=null)}catch(r){throw P.postMessage(null),r}}},T=new MessageChannel,P=T.port2;T.port1.onmessage=x;r=function(e){m=e,g||(g=!0,y(function(e){!function e(n){if(null===m)E=w=-1,g=!1;else{if(g=!0,y(function(t){h(b),e(t)}),b=p(function e(){C=t.unstable_now()+_/2,x(),b=p(e,3*_)},3*_),-1!==w&&.1<n-w){var r=n-w;!S&&-1!==E&&r<_&&E<_&&8.33>(_=r<E?E:r)&&(_=8.33),E=r}w=n,C=n+_,P.postMessage(null)}}(e)}))},i=function(e,n){k=p(function(){e(t.unstable_now())},n)},o=function(){h(k),k=-1}}var I=null,K=null,O=null,M=3,N=!1,L=!1,A=!1;function H(e,t){var n=e.next;if(n===e)I=null;else{e===I&&(I=n);var r=e.previous;r.next=n,n.previous=r}e.next=e.previous=null,n=e.callback,r=M;var i=O;M=e.priorityLevel,O=e;try{var o=e.expirationTime<=t;switch(M){case 1:var a=n(o);break;case 2:case 3:case 4:a=n(o);break;case 5:a=n(o)}}catch(l){throw l}finally{M=r,O=i}if("function"===typeof a)if(t=e.expirationTime,e.callback=a,null===I)I=e.next=e.previous=e;else{a=null,o=I;do{if(t<=o.expirationTime){a=o;break}o=o.next}while(o!==I);null===a?a=I:a===I&&(I=e),(t=a.previous).next=a.previous=e,e.next=a,e.previous=t}}function R(e){if(null!==K&&K.startTime<=e)do{var t=K,n=t.next;if(t===n)K=null;else{K=n;var r=t.previous;r.next=n,n.previous=r}t.next=t.previous=null,z(t,t.expirationTime)}while(null!==K&&K.startTime<=e)}function F(e){A=!1,R(e),L||(null!==I?(L=!0,r(D)):null!==K&&i(F,K.startTime-e))}function D(e,n){L=!1,A&&(A=!1,o()),R(n),N=!0;try{if(e){if(null!==I)do{H(I,n),R(n=t.unstable_now())}while(null!==I&&!a())}else for(;null!==I&&I.expirationTime<=n;)H(I,n),R(n=t.unstable_now());return null!==I||(null!==K&&i(F,K.startTime-n),!1)}finally{N=!1}}function U(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}function z(e,t){if(null===I)I=e.next=e.previous=e;else{var n=null,r=I;do{if(t<r.expirationTime){n=r;break}r=r.next}while(r!==I);null===n?n=I:n===I&&(I=e),(t=n.previous).next=n.previous=e,e.next=n,e.previous=t}}var j=l;t.unstable_ImmediatePriority=1,t.unstable_UserBlockingPriority=2,t.unstable_NormalPriority=3,t.unstable_IdlePriority=5,t.unstable_LowPriority=4,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=M;M=e;try{return t()}finally{M=n}},t.unstable_next=function(e){switch(M){case 1:case 2:case 3:var t=3;break;default:t=M}var n=M;M=t;try{return e()}finally{M=n}},t.unstable_scheduleCallback=function(e,n,a){var l=t.unstable_now();if("object"===typeof a&&null!==a){var u=a.delay;u="number"===typeof u&&0<u?l+u:l,a="number"===typeof a.timeout?a.timeout:U(e)}else a=U(e),u=l;if(e={callback:n,priorityLevel:e,startTime:u,expirationTime:a=u+a,next:null,previous:null},u>l){if(a=u,null===K)K=e.next=e.previous=e;else{n=null;var s=K;do{if(a<s.startTime){n=s;break}s=s.next}while(s!==K);null===n?n=K:n===K&&(K=e),(a=n.previous).next=n.previous=e,e.next=n,e.previous=a}null===I&&K===e&&(A?o():A=!0,i(F,u-l))}else z(e,a),L||N||(L=!0,r(D));return e},t.unstable_cancelCallback=function(e){var t=e.next;if(null!==t){if(e===t)e===I?I=null:e===K&&(K=null);else{e===I?I=t:e===K&&(K=t);var n=e.previous;n.next=t,t.previous=n}e.next=e.previous=null}},t.unstable_wrapCallback=function(e){var t=M;return function(){var n=M;M=t;try{return e.apply(this,arguments)}finally{M=n}}},t.unstable_getCurrentPriorityLevel=function(){return M},t.unstable_shouldYield=function(){var e=t.unstable_now();return R(e),null!==O&&null!==I&&I.startTime<=e&&I.expirationTime<O.expirationTime||a()},t.unstable_requestPaint=j,t.unstable_continueExecution=function(){L||N||(L=!0,r(D))},t.unstable_pauseExecution=function(){},t.unstable_getFirstCallbackNode=function(){return I}},,function(e,t,n){"use strict";n.r(t),n.d(t,"HotKeys",function(){return Ye}),n.d(t,"GlobalHotKeys",function(){return Je}),n.d(t,"IgnoreKeys",function(){return tt}),n.d(t,"ObserveKeys",function(){return nt}),n.d(t,"withHotKeys",function(){return Ge}),n.d(t,"withIgnoreKeys",function(){return rt}),n.d(t,"withObserveKeys",function(){return it}),n.d(t,"configure",function(){return ot}),n.d(t,"getApplicationKeyMap",function(){return at}),n.d(t,"recordKeyCombination",function(){return lt});var r=n(1),i=n.n(r),o=n(0),a=n.n(o);function l(e){return(l="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),e}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){f(e,t,n[t])})}return e}function h(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e,t,n){return(g=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&v(i,n.prototype),i}).apply(null,arguments)}function m(e){var t="function"===typeof Map?new Map:void 0;return(m=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!==typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return g(e,arguments,y(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),v(r,e)})(e)}function b(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function k(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _(e,t){return!t||"object"!==typeof t&&"function"!==typeof t?k(e):t}function w(e,t,n){return(w="undefined"!==typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=y(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function E(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function C(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return e.reduce(function(e,n){return e[n]=t||{value:n},e},{})}var S={logLevel:"warn",defaultKeyEvent:"keydown",defaultComponent:"div",defaultTabIndex:"-1",ignoreTags:["input","select","textarea"],enableHardSequences:!1,ignoreKeymapAndHandlerChangesByDefault:!0,ignoreEventsCondition:function(e){var t=e.target;if(t&&t.tagName){var n=t.tagName.toLowerCase();return T.option("_ignoreTagsDict")[n]||t.isContentEditable}return!1},ignoreRepeatedEventsWhenKeyHeldDown:!0,simulateMissingKeyPressEvents:!0,stopEventPropagationAfterHandling:!0,stopEventPropagationAfterIgnoring:!0,allowCombinationSubmatches:!1,customKeyCodes:{}},x=p({},S);x._ignoreTagsDict=C(x.ignoreTags,!0);var T=function(){function e(){u(this,e)}return c(e,null,[{key:"init",value:function(e){var t=this,n=e.ignoreTags,r=e.customKeyCodes;n&&(e._ignoreTagsDict=C(e.ignoreTags)),r&&(e._customKeyNamesDict=C(Object.values(e.customKeyCodes))),-1!==["verbose","debug","info"].indexOf(e.logLevel)&&console.warn("React HotKeys: You have requested log level '".concat(e.logLevel,"' but for performance reasons, logging below severity level 'warning' is disabled in production. Please use the development build for complete logs.")),Object.keys(e).forEach(function(n){t.set(n,e[n])})}},{key:"set",value:function(e,t){x[e]=t}},{key:"reset",value:function(e){x[e]=S[e]}},{key:"option",value:function(e){return x[e]}}]),e}(),P=function(){function e(){var t=this,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"warn";u(this,e),f(this,"verbose",this.noop),f(this,"debug",this.noop),f(this,"info",this.noop),f(this,"warn",this.noop),f(this,"error",this.noop),this.logLevel=this.constructor.levels[n],this.logLevel>=this.constructor.levels.error&&(this.error=console.error,this.logLevel>=this.constructor.levels.warn&&(this.warn=console.warn,["info","debug","verbose"].some(function(e){return!(t.logLevel>=t.constructor.levels[e])||(t[e]=console.log,!1)})))}return c(e,[{key:"noop",value:function(){}}]),e}();f(P,"logIcons",["\ud83d\udcd5","\ud83d\udcd7","\ud83d\udcd8","\ud83d\udcd9"]),f(P,"componentIcons",["\ud83d\udd3a","\u2b50\ufe0f","\ud83d\udd37","\ud83d\udd36","\u2b1b\ufe0f"]),f(P,"eventIcons",["\u2764\ufe0f","\ud83d\udc9a","\ud83d\udc99","\ud83d\udc9b","\ud83d\udc9c","\ud83e\udde1"]),f(P,"levels",{none:0,error:1,warn:2,info:3,debug:4,verbose:5});var I={keydown:0,keypress:1,keyup:2},K={Shift:["shiftKey"],Meta:["metaKey"],Control:["ctrlKey"],Alt:["altKey"]},O={"`":["~"],1:["!"],2:["@",'"'],3:["#","\xa3"],4:["$"],5:["%"],6:["^"],7:["&"],8:["*"],9:["("],0:[")"],"-":["_"],"=":["plus"],";":[":"],"'":['"',"@"],",":["<"],".":[">"],"/":["?"],"\\":["|"],"[":["{"],"]":["}"],"#":["~"]};function M(e){return O[e]||[1===e.length?e.toUpperCase():e]}function N(e,t){return e.hasOwnProperty(t)}function L(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(e).reduce(function(n,r){var i=e[r];return i.forEach(function(e){N(n,e)||(n[e]=[]),n[e].push(r)}),t.includeOriginal&&(!N(n,r)&&(n[r]=[]),n[r]=[].concat(E(n[r]),E(i))),n},{})}var A=L(O);function H(e){return A[e]||[1===e.length?e.toLowerCase():e]}var R=L({},{includeOriginal:!0});function F(e){return"string"==typeof e}var D={tab:"Tab",capslock:"CapsLock",shift:"Shift",meta:"Meta",alt:"Alt",ctrl:"Control",space:" ",spacebar:" ",escape:"Escape",esc:"Escape",left:"ArrowLeft",right:"ArrowRight",up:"ArrowUp",down:"ArrowDown",return:"Enter",del:"Delete",command:"Meta",option:"Alt",enter:"Enter",backspace:"Backspace",ins:"Insert",pageup:"PageUp",pagedown:"PageDown",end:"End",home:"Home",contextmenu:"ContextMenu",numlock:"Clear"},U={cmd:"Meta"};function z(e){var t=e.toLowerCase();return D[t]||U[t]||(e.match(/^f\d+$/)?e.toUpperCase():e)}var j={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},B=C(Object.values(j),!0);function q(e){return!!B[e]}function W(e){return q(e)||String.fromCharCode(e.charCodeAt(0))===e||function(e){return T.option("_customKeyNamesDict")[e]}(e)}var V=function(e){function t(){var e,n;u(this,t);for(var r=arguments.length,i=Array(r),o=0;o<r;o++)i[o]=arguments[o];return f(k(k(n=_(this,(e=y(t)).call.apply(e,[this].concat(i))))),"name","InvalidKeyNameError"),n}return h(t,m(Error)),t}();function $(e){return e.sort().join("+")}var Q=function(){function e(){u(this,e)}return c(e,null,[{key:"parse",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=function(e){return F(e)?e.trim().replace(/\s+/g," "):e}(e).split(" ");try{var r=n.slice(0,n.length-1),i=n[n.length-1],o=r.map(function(e){var n=G(e,t);return $(Object.keys(n))}).join(" "),a=G(i,t),l={id:$(Object.keys(a)),keyDictionary:a,keyEventType:t.keyEventType,size:Object.keys(a).length};return{sequence:{prefix:o,size:r.length+1},combination:l}}catch(e){return{sequence:null,combination:null}}}}]),e}();function G(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return e.replace(/^\+|(\s|[^+]\+)\+/,"$1plus").split("+").reduce(function(e,n){var r=z(n);if(t.ensureValidKeys&&!W(r))throw new V;return e[r]=!0,e},{})}var Y={"`":["`"],1:["\xa1"],2:["\u2122"],3:["\xa3"],4:["\xa2"],5:["\u221e"],6:["\xa7"],7:["\xb6"],8:["\u2022"],9:["\xaa"],0:["\xba"],"-":["\u2013"],"=":["\u2260"],a:["\xe5"],b:["\u222b"],c:["\xe7"],d:["\u2202"],e:["\xb4"],f:["\u0192"],g:["\xa9"],h:["\u02d9"],i:["\u02c6"],j:["\u2206"],k:["\u02da"],l:["\xac"],m:["\xb5"],n:["\u02dc"],o:["\xf8"],p:["\u03c0"],q:["\u0153"],r:["\xae"],s:["\xdf"],t:["\u2020"],u:["\xa8"],v:["\u221a"],w:["\u2211"],x:["\u2248"],y:["\xa5"],z:["\u03a9"],"[":["\u201c"],"]":["\u2018"],"\\":["\xab"],"'":["\xe6"],";":["\u2026"],",":["\u2264"],".":["\u2265"],"/":["\xf7"]},X=L(Y);function J(e){return X[e]||[e]}function Z(e){return Y[e]||[e]}var ee={"`":["`"],1:["\u2044"],2:["\u20ac"],3:["\u2039"],4:["\u203a"],5:["\ufb01"],6:["\ufb02"],7:["\u2021"],8:["\xb0"],9:["\xb7"],0:["\u201a"],"-":["\u2014"],"=":["\xb1"],a:["\xc5"],b:["\u0131"],c:["\xc7"],d:["\xce"],e:["\xb4"],f:["\xcf"],g:["\u02dd"],h:["\xd3"],i:["\u02c6"],j:["\xd4"],k:["\uf8ff"],l:["\xd2"],m:["\xc2"],n:["\u02dc"],o:["\xd8"],p:["\u03c0"],q:["\u0152"],r:["\u2030"],s:["\xcd"],t:["\xce"],u:["\xa8"],v:["\u25ca"],w:["\u201e"],x:["\u02db"],y:["\xc1"],z:["\xb8"],"[":["\u201d"],"]":["\u2019"],"\\":["\xbb"],"'":["\xc6"],";":["\xda"],",":["\xaf"],".":["\u02d8"]},te=L(ee);function ne(e){return te[e]||H(e)}function re(e){return ee[e]||[e]}var ie=function(){function e(){u(this,e)}return c(e,null,[{key:"serialize",value:function(e){var t=e.Shift,n=e.Alt,r={};return Object.keys(e).sort().forEach(function(e){var i=[];if(t)if(n){var o=ne(e),a=re(e);i=[].concat(E(i),[e],E(o),E(a))}else{var l=H(e),u=M(e);i=[].concat(E(i),[e],E(l),E(u))}else if(n){var s=J(e),c=Z(e);i=[].concat(E(i),[e],E(s),E(c))}else{i.push(e);var d=R[e];d&&(i=[].concat(E(i),E(d)))}var h=Object.keys(r);0<h.length?h.forEach(function(e){i.forEach(function(t){r[e+"+".concat(t)]=p({},r[e],f({},t,!0))}),delete r[e]}):i.forEach(function(e){r[e]=f({},e,!0)})}),Object.values(r).map(function(e){return Object.keys(e).sort().join("+")})}},{key:"isValidKeySerialization",value:function(e){return!!(0<e.length)&&!!Q.parse(e,{ensureValidKeys:!0}).combination}}]),e}(),oe=0,ae=1;function le(e){return"undefined"==typeof e}var ue={unseen:0,seen:1,simulated:2},se=function(){function e(){u(this,e)}return c(e,null,[{key:"newRecord",value:function(e,t){var n=[ue.unseen,ue.unseen,ue.unseen];if(!le(e))for(var r=0;r<=e;r++)n[r]=t;return n}},{key:"setBit",value:function(e,t,n){return e[t]=n,e}},{key:"clone",value:function(e){for(var t=this.newRecord(),n=0;n<e.length;n++)t[n]=e[n];return t}}]),e}();function ce(e){return!Array.isArray(e)&&"object"===l(e)&&null!==e}function fe(e){return ce(e)?0===Object.keys(e).length:!e||0===e.length}function de(e){return ce(e)?Object.keys(e).length:e.length}var pe=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};u(this,e),this._keys=t,this._includesKeyUp=!1,this._update()}return c(e,[{key:"getIds",value:function(){return this._ids}},{key:"getKeyAliases",value:function(){return this._keyAliases}},{key:"getNormalizedKeyName",value:function(e){if(this._keys[e])return e;var t=this._keyAliases[e];return t||e}},{key:"getNumberOfKeys",value:function(){return de(this._keys)}},{key:"any",value:function(){return 0<Object.keys(this._getKeyStates()).length}},{key:"isEnding",value:function(){return this._includesKeyUp}},{key:"hasEnded",value:function(){return fe(this.keysStillPressedDict())}},{key:"addKey",value:function(e,t){this._setKeyState(e,[se.newRecord(),se.newRecord(I.keydown,t)])}},{key:"setKeyState",value:function(e,t,n){var r=this._getKeyState(e);if(this.isKeyIncluded(e)){var i=se.clone(r[1]),o=se.clone(i);se.setBit(o,t,n),this._setKeyState(e,[i,o])}else this.addKey(e,n);t===I.keyup&&(this._includesKeyUp=!0)}},{key:"forEachKey",value:function(e){return Object.keys(this._keys).forEach(e)}},{key:"some",value:function(e){return Object.keys(this._keys).some(e)}},{key:"getKeyDictionary",value:function(){return C(Object.keys(this._getKeyStates()),!0)}},{key:"keysStillPressedDict",value:function(){var e=this;return Object.keys(this._keys).reduce(function(t,n){return e.isKeyStillPressed(n)&&(t[n]=e._getKeyState(n)),t},{})}},{key:"isKeyIncluded",value:function(e){return!!this._getKeyState(e)}},{key:"isKeyStillPressed",value:function(e){return this.isEventTriggered(e,I.keypress)&&!this.isKeyReleased(e)}},{key:"isKeyReleased",value:function(e){return this.isEventTriggered(e,I.keyup)}},{key:"isEventTriggered",value:function(e,t){return this._getKeyStateType(e,ae,t)}},{key:"wasEventPreviouslyTriggered",value:function(e,t){return this._getKeyStateType(e,oe,t)}},{key:"isKeyPressSimulated",value:function(e){return this._isKeyEventSimulated(e,I.keypress)}},{key:"isKeyUpSimulated",value:function(e){return this._isKeyEventSimulated(e,I.keyup)}},{key:"describe",value:function(){return this.getIds()[0]}},{key:"toJSON",value:function(){return{keys:this._getKeyStates(),ids:this.getIds(),keyAliases:this.getKeyAliases()}}},{key:"_getKeyStateType",value:function(e,t,n){var r=this._getKeyState(e);return r&&r[t][n]}},{key:"_update",value:function(){this._ids=ie.serialize(this._keys),this._keyAliases=function(e){return Object.keys(e).reduce(function(t,n){return function(e){return R[e]||[e]}(n).forEach(function(r){(function(e){if(e.Shift)return e.Alt?[re,ne]:[M,H];if(e.Alt)return[Z,J];var t=function(e){return[e]};return[t,t]})(e).forEach(function(e){e(r).forEach(function(e){(e!==n||n!==r)&&(t[e]=n)})})}),t},{})}(this._keys)}},{key:"_isKeyEventSimulated",value:function(e,t){return this.isEventTriggered(e,t)===ue.simulated}},{key:"_getKeyStates",value:function(){return this._keys}},{key:"_getKeyState",value:function(e){var t=this._keys[e];if(t)return t;var n=this._keyAliases[e];return n?this._keys[n]:void 0}},{key:"_setKeyState",value:function(e,t){var n=this.getNormalizedKeyName(e);this._keys[n]=t,this._update()}}]),e}();var he=function(){function e(t){var n=t.maxLength,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;u(this,e),this._records=[],this._maxLength=n,r?this._push(r):this._push(new pe)}return c(e,[{key:"getMostRecentCombinations",value:function(e){return this._records.slice(-e,-1)}},{key:"any",value:function(){return this._records.some(function(e){return e.any()})}},{key:"getLength",value:function(){return this._records.length}},{key:"getCurrentCombination",value:function(){return this._records[this.getLength()-1]}},{key:"addKeyToCurrentCombination",value:function(e,t,n){this._ensureInitialKeyCombination(),this.getCurrentCombination().setKeyState(e,t,n)}},{key:"setMaxLength",value:function(e){this._maxLength=e,this._trimHistory()}},{key:"startNewKeyCombination",value:function(e,t){this._ensureInitialKeyCombination();var n=new pe(this.getCurrentCombination().keysStillPressedDict());n.addKey(e,t),this._push(n)}},{key:"toJSON",value:function(){return this._records.map(function(e){return e.toJSON()})}},{key:"_ensureInitialKeyCombination",value:function(){0===this.getLength()&&this._push(new pe)}},{key:"_push",value:function(e){this._trimHistory(),this._records.push(e)}},{key:"_trimHistory",value:function(){for(;this.getLength()>this._maxLength;)this._shift()}},{key:"_shift",value:function(){this._records.shift()}}]),e}(),ye=function(){function e(){u(this,e),this._registry={}}return c(e,[{key:"get",value:function(e){return this._registry[e]}},{key:"set",value:function(e,t){this._registry[e]=t}},{key:"remove",value:function(e){delete this._registry[e]}},{key:"toJSON",value:function(){return this._registry}}]),e}();function ve(e){return Array.isArray(e)?e:e?[e]:[]}var ge=function(e){function t(){return u(this,t),_(this,y(t).apply(this,arguments))}return h(t,ye),c(t,[{key:"add",value:function(e,n){w(y(t.prototype),"set",this).call(this,e,{childIds:[],parentId:null,keyMap:n})}},{key:"update",value:function(e,n){var r=w(y(t.prototype),"get",this).call(this,e);w(y(t.prototype),"set",this).call(this,e,p({},r,{keyMap:n}))}},{key:"setParent",value:function(e,t){this.get(e).parentId=t,this._addChildId(t,e)}},{key:"remove",value:function(e){var n=this._getParentId(e);this._removeChildId(n,e),w(y(t.prototype),"remove",this).call(this,e)}},{key:"_getParentId",value:function(e){var t=this.get(e);return t&&t.parentId}},{key:"_addChildId",value:function(e,t){this.get(e).childIds.push(t)}},{key:"_removeChildId",value:function(e,t){var n=this.get(e);n&&(n.childIds=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=C(ve(t));return Array.isArray(e)?e.reduce(function(e,t){return r[t]&&(n.stringifyFirst||r[t].value===t)||e.push(t),e},[]):ce(e)?Object.keys(e).reduce(function(t,n){return r[n]||(t[n]=e[n]),t},{}):e}(n.childIds,t))}}]),t}();var me=function(){function e(t){u(this,e),this._list=t,this._position=-1}return c(e,[{key:"getPosition",value:function(){return this._position}},{key:"getComponent",value:function(){return this._list.getAtPosition(this.getPosition())}},{key:"next",value:function(){return this.getPosition()+1<this._list.getLength()?(this._position++,this.getComponent()):null}}]),e}(),be=function(){function e(){u(this,e),this._list=[],this._idToIndex={},this._longestSequence=1,this._longestSequenceComponentId=null,this._keyMapEventRecord=se.newRecord()}return c(e,[{key:"getNewIterator",value:function(){return new me(this)}},{key:"add",value:function(e,t,n,r){if(this.containsId(e))return this.update(e,t,n,r);var i=this._build(e,t,n,r);this._list.push(i);var o=this._getLastIndex();return this._idToIndex[e]=o}},{key:"containsId",value:function(e){return!!this.get(e)}},{key:"get",value:function(e){return this.getAtPosition(this.getIndexById(e))}},{key:"getIndexById",value:function(e){return this._idToIndex[e]}},{key:"update",value:function(e,t,n,r){var i=this._isUpdatingComponentWithLongestSequence(e),o=this.getLongestSequence(),a=this._build(e,t,n,r);i&&a.sequenceLength!==o&&(a.sequenceLength>o?this._longestSequence=a.sequenceLength:this._recalculateLongestSequence()),this._list[this.getIndexById(e)]=a}},{key:"remove",value:function(e){var t=this._isUpdatingComponentWithLongestSequence(e);this.removeAtPosition(this.getIndexById(e)),t&&this._recalculateLongestSequence()}},{key:"any",value:function(){return 0!==this.getLength()}},{key:"isRoot",value:function(e){return this.getIndexById(e)>=this.getLength()-1}},{key:"getLongestSequence",value:function(){return this._longestSequence}},{key:"anyActionsForEventType",value:function(e){return!!this._keyMapEventRecord[e]}},{key:"getLength",value:function(){return this._list.length}},{key:"getAtPosition",value:function(e){return this._list[e]}},{key:"removeAtPosition",value:function(e){this._list=function(e,t){return[].concat(E(e.slice(0,t)),E(e.slice(t+1)))}(this._list,e);for(var t=e;t<this.getLength();)this._idToIndex[this.getAtPosition(t).componentId]=t,t++}},{key:"toJSON",value:function(){return this._list}},{key:"_getLastIndex",value:function(){return this.getLength()-1}},{key:"_build",value:function(e,t,n,r){var i=this._applyHardSequences(t,n),o=i.keyMap,a=i.handlers;return{actions:this._buildActionDictionary(p({},t,o),r,e),handlers:a,componentId:e,options:r}}},{key:"_isUpdatingComponentWithLongestSequence",value:function(e){return e===this._getLongestSequenceComponentId()}},{key:"_getLongestSequenceComponentId",value:function(){return this._longestSequenceComponentId}},{key:"_recalculateLongestSequence",value:function(){for(var e=this.getNewIterator();e.next();){var t=e.getComponent(),n=t.longestSequence,r=t.componentId;n>this.getLongestSequence()&&(this._longestSequenceComponentId=r,this._longestSequence=n)}}},{key:"_applyHardSequences",value:function(e,t){return T.option("enableHardSequences")?Object.keys(t).reduce(function(n,r){return!!!e[r]&&ie.isValidKeySerialization(r)&&(n.keyMap[r]=r),n.handlers[r]=t[r],n},{keyMap:{},handlers:{}}):{keyMap:e,handlers:t}}},{key:"_buildActionDictionary",value:function(e,t,n){var r=this;return Object.keys(e).reduce(function(i,o){var a=e[o];return(ce(a)&&N(a,"sequences")?ve(a.sequences):ve(a)).forEach(function(e){var a=function(e,t){if(ce(e)){var n=e.sequence,r=e.action;return{keySequence:n,keyEventType:le(r)?I[t.defaultKeyEvent]:I[r]}}return{keySequence:e,keyEventType:I[t.defaultKeyEvent]}}(e,t),l=a.keySequence,u=a.keyEventType;r._addActionOptions(i,n,o,l,u)}),i},{})}},{key:"_addActionOptions",value:function(e,t,n,r,i){var o=Q.parse(r,{keyEventType:i}),a=o.sequence,l=o.combination;a.size>this.getLongestSequence()&&(this._longestSequence=a.size,this._longestSequenceComponentId=t),this._keyMapEventRecord[i]=ue.seen,e[n]||(e[n]=[]),e[n].push(p({prefix:a.prefix,actionName:n,sequenceLength:a.size},l))}}]),e}();function ke(e,t){return e[e.length-(t+1)]}for(var _e={Enter:!0,Backspace:!0,ArrowRight:!0,ArrowLeft:!0,ArrowUp:!0,ArrowDown:!0,CapsLock:!0},we=1;13>we;we++)_e["F".concat(we)]=!0;function Ee(e){return 1===e.length||N(_e,e)}var Ce=function(){function e(){u(this,e),this._actionConfigs={},this._order=null}return c(e,[{key:"addMatch",value:function(e,t){if(this._includesMatcherForCombination(e.id)){var n=e.keyEventType,r=e.actionName,i=e.id;this._addHandlerToActionConfig(i,{keyEventType:n,actionName:r,handler:t})}else this._addNewActionConfig(e,t)}},{key:"findMatch",value:function(e,t,n){this._order||this._setOrder();var r=!0,i=!1,o=void 0;try{for(var a,l=this._order[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var u=a.value,s=this._actionConfigs[u];if(this._matchesActionConfig(e,t,n,s))return s}}catch(e){i=!0,o=e}finally{try{r||null==l.return||l.return()}finally{if(i)throw o}}return null}},{key:"toJSON",value:function(){return{actionConfigs:this._actionConfigs,order:this._order}}},{key:"_matchesActionConfig",value:function(e,t,n,r){if(!function(e,t){var n=de(t.keyDictionary);return T.option("allowCombinationSubmatches")||function(e){return!!e.isKeyStillPressed("Meta")&&e.some(function(e){return Ee(e)})}(e)?e.getNumberOfKeys()>=n:e.getNumberOfKeys()===n}(e,r))return!1;if(!r.events[n])return!1;var i=!1;return Object.keys(r.keyDictionary).every(function(r){return!!e.isEventTriggered(r,n)&&(t&&t===e.getNormalizedKeyName(r)&&(i=!e.wasEventPreviouslyTriggered(r,n)),!0)})&&i}},{key:"_setOrder",value:function(){var e=Object.values(this._actionConfigs).reduce(function(e,t){var n=t.id,r=t.size;return e[r]||(e[r]=[]),e[r].push(n),e},{});this._order=Object.keys(e).sort(function(e,t){return t-e}).reduce(function(t,n){return t.concat(e[n])},[])}},{key:"_addNewActionConfig",value:function(e,t){var n=e.prefix,r=e.sequenceLength,i=e.id,o=e.keyDictionary,a=e.size,l=e.keyEventType,u=e.actionName;this._setCombinationMatcher(i,{prefix:n,sequenceLength:r,id:i,keyDictionary:o,size:a,events:{}}),this._addHandlerToActionConfig(i,{keyEventType:l,actionName:u,handler:t})}},{key:"_addHandlerToActionConfig",value:function(e,t){var n=t.keyEventType,r=t.actionName,i=t.handler,o=this._getCombinationMatcher(e);this._setCombinationMatcher(e,p({},o,{events:p({},o.events,f({},n,{actionName:r,handler:i}))}))}},{key:"_setCombinationMatcher",value:function(e,t){this._actionConfigs[e]=t}},{key:"_getCombinationMatcher",value:function(e){return this._actionConfigs[e]}},{key:"_includesMatcherForCombination",value:function(e){return!!this._getCombinationMatcher(e)}}]),e}();var Se=function(){function e(){u(this,e),this._combinationMatchers={},this._eventRecord=se.newRecord()}return c(e,[{key:"addMatch",value:function(e,t){this._getOrCreateCombinationMatcher(e.prefix).addMatch(e,t),se.setBit(this._eventRecord,e.keyEventType,ue.seen),(!this._longestSequence||this._longestSequence<e.sequenceLength)&&(this._longestSequence=e.sequenceLength)}},{key:"findMatch",value:function(e,t,n){var r=this._findCombinationMatcher(e);return r?r.findMatch(e.getCurrentCombination(),e.getCurrentCombination().getNormalizedKeyName(t),n):null}},{key:"hasMatchesForEventType",value:function(e){return!!this._eventRecord[e]}},{key:"getLongestSequence",value:function(){return this._longestSequence}},{key:"toJSON",value:function(){var e=this;return Object.keys(this._combinationMatchers).reduce(function(t,n){var r=e._combinationMatchers[n];return t[n]=r.toJSON(),t},{})}},{key:"_getOrCreateCombinationMatcher",value:function(e){return this._combinationMatchers[e]||(this._combinationMatchers[e]=new Ce),this._combinationMatchers[e]}},{key:"_findCombinationMatcher",value:function(e){var t=e.getMostRecentCombinations(this.getLongestSequence());if(0===t.length)return this._combinationMatchers[""];for(var n=t.map(function(e){return e.getIds()}),r=n.map(function(e){return e.length}),i=Array(n.length).fill(0),o=!1;!o;){var a=i.map(function(e,t){return n[t][e]}).join(" ");if(this._combinationMatchers[a])return this._combinationMatchers[a];for(var l=0,u=!0;u&&l<i.length;){var s=(ke(i,l)+1)%(ke(r,l)||1);i[i.length-(l+1)]=s,(u=0==s)&&l++}o=l===i.length}}}]),e}(),xe=function(){function e(t){u(this,e),this._keyMapMatchers=[],this._unmatchedHandlerStatus=[],this._handlersDictionary={},this._keySequencesDictionary={};for(var n=t.getNewIterator();n.next();){var r=n.getComponent().handlers;this._unmatchedHandlerStatus.push([Object.keys(r).length,{}]),this._keyMapMatchers.push(new Se)}this._componentList=t,this._componentListIterator=t.getNewIterator()}return c(e,[{key:"getKeyHistoryMatcher",value:function(e){if(this._componentHasUnmatchedHandlers(e))for(;this._componentListIterator.next();)this._addHandlersFromComponent(),this._addActionsFromComponent();return this._getKeyHistoryMatcher(e)}},{key:"componentHasActionsBoundToEventType",value:function(e,t){return this.getKeyHistoryMatcher(e).hasMatchesForEventType(t)}},{key:"findMatchingKeySequenceInComponent",value:function(e,t,n,r){return this.componentHasActionsBoundToEventType(e,r)?this.getKeyHistoryMatcher(e).findMatch(t,n,r):null}},{key:"_getKeyHistoryMatcher",value:function(e){return this._keyMapMatchers[e]}},{key:"_addActionsFromComponent",value:function(){var e=this,t=this._componentListIterator.getComponent().actions;Object.keys(t).forEach(function(n){var r=e._getHandlers(n);if(r){var i=r[0],o=e._componentList.getAtPosition(i).handlers[n],a=e._getKeyHistoryMatcher(i);t[n].forEach(function(t){var n=[t.prefix,t.id].join(" ");e._isClosestHandlerFound(n,t)||(a.addMatch(t,o),e._addKeySequence(n,[i,t.keyEventType]))}),r.forEach(function(t){var r=e._getUnmatchedHandlerStatus(t);r[1][n]||(r[1][n]=!0,r[0]--)})}})}},{key:"_getHandlers",value:function(e){return this._handlersDictionary[e]}},{key:"_addHandlersFromComponent",value:function(){var e=this,t=this._componentListIterator.getComponent().handlers;Object.keys(t).forEach(function(t){e._addHandler(t)})}},{key:"_addHandler",value:function(e){this._handlersDictionary[e]||(this._handlersDictionary[e]=[]),this._handlersDictionary[e].push(this._componentListIterator.getPosition())}},{key:"_addKeySequence",value:function(e,t){this._keySequencesDictionary[e]||(this._keySequencesDictionary[e]=[]),this._keySequencesDictionary[e].push(t)}},{key:"_componentHasUnmatchedHandlers",value:function(e){return 0<this._getUnmatchedHandlerStatus(e)[0]}},{key:"_getUnmatchedHandlerStatus",value:function(e){return this._unmatchedHandlerStatus[e]}},{key:"_isClosestHandlerFound",value:function(e,t){return this._keySequencesDictionary[e]&&this._keySequencesDictionary[e].some(function(e){return e[1]===t.keyEventType})}}]),e}();function Te(e,t,n){return n.forEach(function(n){N(e,n)&&(t[n]=e[n])}),t}function Pe(e){switch(parseInt(e,10)){case 0:return"keydown";case 1:return"keypress";default:return"keyup"}}function Ie(e){return e.simulated?ue.simulated:ue.seen}var Ke=["sequence","action"],Oe=["name","description","group"],Me=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0;u(this,e),this.logger=t.logger||new P("warn"),this.componentId=-1,this.keyEventManager=n,this._componentTree=new ge,this.rootComponentId=null,this._reset(),this.resetKeyHistory()}return c(e,[{key:"_reset",value:function(){this.componentList=new be,this._initHandlerResolutionState()}},{key:"_newKeyHistory",value:function(){return new he({maxLength:this.componentList.getLongestSequence()})}},{key:"getKeyHistory",value:function(){return this._keyHistory?this._keyHistory:(this._keyHistory=this._newKeyHistory(),this._keyHistory)}},{key:"_initHandlerResolutionState",value:function(){this._actionResolver=null}},{key:"resetKeyHistory",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.keypressEventsToSimulate=[],this.keyupEventsToSimulate=[],this._keyHistory=this.getKeyHistory().any()&&!e.force?new he({maxLength:this.componentList.getLongestSequence()},new pe(this.getCurrentCombination().keysStillPressedDict())):this._newKeyHistory()}},{key:"getApplicationKeyMap",value:function(){return null===this.rootComponentId?{}:this._buildApplicationKeyMap([this.rootComponentId],{})}},{key:"_buildApplicationKeyMap",value:function(e,t){var n=this;return e.forEach(function(e){var r=n._componentTree.get(e),i=r.childIds,o=r.keyMap;o&&Object.keys(o).forEach(function(e){var r=o[e];t[e]={},ce(r)?N(r,"sequences")?(Te(r,t[e],Oe),t[e].sequences=n._createSequenceFromConfig(r.sequences)):(Te(r,t[e],Oe),t[e].sequences=[Te(r,{},Ke)]):t[e].sequences=n._createSequenceFromConfig(r)}),n._buildApplicationKeyMap(i,t)}),t}},{key:"_createSequenceFromConfig",value:function(e){return ve(e).map(function(e){return ce(e)?Te(e,{},Ke):{sequence:e}})}},{key:"registerKeyMap",value:function(e){return this.componentId+=1,this._componentTree.add(this.componentId,e),this.componentId}},{key:"reregisterKeyMap",value:function(e,t){this._componentTree.update(e,t)}},{key:"registerComponentMount",value:function(e,t){le(t)?this.rootComponentId=e:this._componentTree.setParent(e,t)}},{key:"deregisterKeyMap",value:function(e){this._componentTree.remove(e),e===this.rootComponentId&&(this.rootComponentId=null)}},{key:"_addComponent",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=3<arguments.length?arguments[3]:void 0;this.componentList.add(e,t,n,r),this.getKeyHistory().setMaxLength(this.componentList.getLongestSequence())}},{key:"_allKeysAreReleased",value:function(){return this.getCurrentCombination().hasEnded()}},{key:"getCurrentCombination",value:function(){return this.getKeyHistory().getCurrentCombination()}},{key:"_shouldSimulate",value:function(e,t){var n=function(e){return!q(e)}(t),r=this.getCurrentCombination();return e===I.keypress?!n||n&&r.isKeyStillPressed("Meta"):e===I.keyup&&Ee(t)&&r.isKeyReleased("Meta")}},{key:"_cloneAndMergeEvent",value:function(e,t){return p({},Object.keys(K).reduce(function(t,n){return t[n]=e[n],t},{}),t)}},{key:"_callClosestMatchingHandler",value:function(e,t,n,r,i){for(this._actionResolver||(this._actionResolver=new xe(this.componentList));i<=r;){this._actionResolver.getKeyHistoryMatcher(i);var o=this._actionResolver.findMatchingKeySequenceInComponent(i,this.getKeyHistory(),t,n);this.getCurrentCombination();if(o){var a=o.events[n];if(T.option("allowCombinationSubmatches"))ie.serialize(o.keyDictionary);return a.handler(e),this._stopEventPropagationAfterHandlingIfEnabled(e,i),!0}this._actionResolver.componentHasActionsBoundToEventType(i,n),i++}}},{key:"_stopEventPropagationAfterHandlingIfEnabled",value:function(e,t){return!!T.option("stopEventPropagationAfterHandling")&&(this._stopEventPropagation(e,t),!0)}},{key:"_stopEventPropagation",value:function(){throw new Error("_stopEventPropagation must be overridden by a subclass")}},{key:"_checkForModifierFlagDiscrepancies",value:function(e,t,n){var r=this;Object.keys(K).forEach(function(i){if(t!==i||n!==I.keyup){var o=r.getCurrentCombination(),a=o.isKeyStillPressed(i);K[i].forEach(function(t){!1===e[t]&&a&&o.setKeyState(i,I.keyup,Ie(e))})}})}},{key:"_logPrefix",value:function(){}}]),e}(),Ne=function(){function e(){u(this,e)}return c(e,null,[{key:"getId",value:function(){return le(this._id)&&(this._id=0),this._id}},{key:"incrementId",value:function(){this._id=this.getId()+1}}]),e}();var Le={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"};function Ae(e){var t=function(){var t=T.option("customKeyCodes"),n=e.keyCode||e.charCode;return N(t,n)?t[n]:e.nativeEvent?e.key:function(e){if(e.key){var t=Le[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=function(e){var t,n=e.keyCode;return"charCode"in e?0===(t=e.charCode)&&13===n&&(t=13):t=n,10===t&&(t=13),32<=t||13===t?t:0}(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?j[e.keyCode]||"Unidentified":""}(e)}();return"+"===t?"plus":t}function He(e){return"Meta"===e}var Re=0,Fe=1,De=2,Ue=4,ze=function(){function e(t,n){var r=n.logger,i=n.logPrefix;u(this,e),this._componentList=t,this._previousPropagation=null,this.logger=r,this._logPrefix=i,this._reset()}return c(e,[{key:"_reset",value:function(){this._previousPosition=-1,this._position=-1,this._actionHandled=!1,this._ignoreEvent=!1,this._observeIgnoredEvents=!1,this._stopping=!1,this._componentId=null,this._key=null,this._type=null}},{key:"isFirstPropagationStep",value:function(){var e=this.getPreviousPosition();return-1===e||e>=this._position}},{key:"isForKey",value:function(e){return this._key===e}},{key:"isForEventType",value:function(e){return this._type===e}},{key:"startNewPropagationStep",value:function(e,t,n,r){return this._position=this._componentList.getIndexById(e),this._componentId=e,this.isFirstPropagationStep()&&(Ne.incrementId(),this._key=t.key,this._type=r),!(t.repeat&&T.option("ignoreRepeatedEventsWhenKeyHeldDown"))||(this.ignoreEvent(t),!1)}},{key:"finishPropagationStep",value:function(){this.isStopped()||this._componentList.isRoot(this._componentId)?(this._previousPropagation=this._clone(),this._reset()):this._previousPosition=this._position}},{key:"getPreviousPropagation",value:function(){return this._previousPropagation||(this._previousPropagation=this._clone({copyState:!1})),this._previousPropagation}},{key:"getPreviousPosition",value:function(){return this._previousPosition}},{key:"observeIgnoredEvents",value:function(){this._observeIgnoredEvents=!0}},{key:"ignoreEvent",value:function(e){return this.setIgnoreEvent(!0),!(!this.isIgnoringEvent()||!T.option("stopEventPropagationAfterIgnoring"))&&(this.stop(e),this.finishPropagationStep(),!0)}},{key:"setIgnoreEvent",value:function(e){this._ignoreEvent=e}},{key:"isIgnoringEvent",value:function(){return!this._observeIgnoredEvents&&this._ignoreEvent}},{key:"isStopped",value:function(){return this._stopping}},{key:"stop",value:function(e){return!this.isStopped()&&(this._stopping=!0,e.simulated||e.stopPropagation(),!0)}},{key:"isPendingPropagation",value:function(){var e=this.getPreviousPosition();return-1!==e&&e+1<this._position}},{key:"isHandled",value:function(){return this._actionHandled}},{key:"setHandled",value:function(){this._actionHandled=!0}},{key:"_clone",value:function(){var t=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).copyState,n=new e(this._componentList,{logger:this.logger,logPrefix:this._logPrefix});return(void 0===t||t)&&Object.assign(n,this),n}}]),e}(),je=function(e){function t(){var e,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length?arguments[1]:void 0;return u(this,t),(e=_(this,y(t).call(this,n,r))).focusTreeId=0,e}return h(t,Me),c(t,[{key:"_reset",value:function(){w(y(t.prototype),"_reset",this).call(this),this.keypressEventsToSimulate=[],this.focusTreeId+=1,this.eventPropagator=new ze(this.componentList,{logger:this.logger,logPrefix:this._logPrefix.bind(this)})}},{key:"enableHotKeys",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=3<arguments.length?arguments[3]:void 0;if(this.resetOnNextFocus&&(this._reset(),this.resetOnNextFocus=!1),!this.componentList.containsId(e))return this._addComponent(e,t,n,r),this.focusTreeId}},{key:"updateEnabledHotKeys",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},i=4<arguments.length?arguments[4]:void 0;e===this.focusTreeId&&this.componentList.containsId(t)&&(this.componentList.update(t,n,r,i),this.getKeyHistory().setMaxLength(this.componentList.getLongestSequence()),this._initHandlerResolutionState())}},{key:"disableHotKeys",value:function(e,t){return this.resetOnNextFocus||(this.resetOnNextFocus=!0),this.eventPropagator.isPendingPropagation()}},{key:"handleKeydown",value:function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},i=Ae(e);if(t!==this.focusTreeId)return this.eventPropagator.ignoreEvent(e),!0;if(this.eventPropagator.startNewPropagationStep(n,e,i,I.keydown)){if(this._howToHandleKeyEvent(e,t,n,i,r,I.keydown)===Ue){var o=Ie(e),a=this.getCurrentCombination();a.isKeyIncluded(i)||a.isEnding()?this._startAndLogNewKeyCombination(i,t,n,o):this._addToAndLogCurrentKeyCombination(i,I.keydown,t,n,o),this._callHandlerIfActionNotHandled(e,i,I.keydown,n,t)}return this._simulateKeyPressForNonPrintableKeys(e,i,t,n,r),this.eventPropagator.finishPropagationStep(),!1}}},{key:"_howToHandleKeyEvent",value:function(e,t,n,r,i,o){if(this.eventPropagator.isFirstPropagationStep()){if(i.ignoreEventsCondition(e)&&this.eventPropagator.ignoreEvent(e))return this._eventIsToBeIgnored(e,n,r,o);this._checkForModifierFlagDiscrepancies(e,r,o)}else if(this.eventPropagator.isIgnoringEvent())return this._eventIsToBeIgnored(e,n,r,o);return Ue}},{key:"_eventIsToBeIgnored",value:function(e,t,n,r){return Fe}},{key:"handleKeyPress",value:function(e,t,n,r){var i=Ae(e),o=this.getCurrentCombination();if(o.isKeyPressSimulated(i))return this.eventPropagator.ignoreEvent(e),!0;if(this.eventPropagator.startNewPropagationStep(n,e,i,I.keypress)){var a=t!==this.focusTreeId,l=this._howToHandleKeyEvent(e,t,n,i,r,I.keypress);return this.eventPropagator.isFirstPropagationStep(n)&&o.isKeyIncluded(i)&&this._addToAndLogCurrentKeyCombination(i,I.keypress,t,n,Ie(e)),l===Ue&&this._callHandlerIfActionNotHandled(e,i,I.keypress,n,t),this.eventPropagator.finishPropagationStep(),a}}},{key:"handleKeyUp",value:function(e,t,n,r){var i=Ae(e),o=this.getCurrentCombination();if(o.isKeyUpSimulated(i))return this.eventPropagator.ignoreEvent(e),!0;if(this.eventPropagator.startNewPropagationStep(n,e,i,I.keyup)){var a=t!==this.focusTreeId,l=this._howToHandleKeyEvent(e,t,n,i,r,I.keyup);return this.eventPropagator.isFirstPropagationStep(n)&&o.isKeyIncluded(i)&&this._addToAndLogCurrentKeyCombination(i,I.keyup,t,n,Ie(e)),l===Ue&&this._callHandlerIfActionNotHandled(e,i,I.keyup,n,t),this._simulateKeyUpEventsHiddenByCmd(e,i,t,n,r),this.eventPropagator.finishPropagationStep(),a}}},{key:"closeHangingKeyCombination",value:function(e,t){var n=this.getCurrentCombination();n.isKeyIncluded(e)&&!n.isEventTriggered(e,t)&&n.setKeyState(e,t,ue.simulated)}},{key:"_simulateKeyPressForNonPrintableKeys",value:function(e,t,n,r,i){this._handleEventSimulation("keypressEventsToSimulate","simulatePendingKeyPressEvents",this._shouldSimulate(I.keypress,t),{event:e,key:t,focusTreeId:n,componentId:r,options:i})}},{key:"_simulateKeyUpEventsHiddenByCmd",value:function(e,t,n,r,i){var o=this;He(t)&&this.getCurrentCombination().forEachKey(function(t){He(t)||o._handleEventSimulation("keyupEventsToSimulate","simulatePendingKeyUpEvents",o._shouldSimulate(I.keyup,t),{event:e,key:t,focusTreeId:n,componentId:r,options:i})})}},{key:"_stopEventPropagation",value:function(e,t){this.eventPropagator.stop(e)}},{key:"getEventPropagator",value:function(){return this.eventPropagator}},{key:"_startAndLogNewKeyCombination",value:function(e,t,n,r){this.getKeyHistory().startNewKeyCombination(e,r)}},{key:"_addToAndLogCurrentKeyCombination",value:function(e,t,n,r,i){this.getKeyHistory().addKeyToCurrentCombination(e,t,i)}},{key:"_handleEventSimulation",value:function(e,t,n,r){var i=r.event,o=r.key,a=r.focusTreeId,l=r.componentId,u=r.options;if(n&&T.option("simulateMissingKeyPressEvents")){var s=this._cloneAndMergeEvent(i,{key:o,simulated:!0});this[e].push({event:s,focusTreeId:a,componentId:l,options:u})}(this.componentList.isRoot(l)||this.eventPropagator.isStopped())&&!this.keyEventManager.isGlobalListenersBound()&&this[t]()}},{key:"simulatePendingKeyPressEvents",value:function(){this._simulatePendingKeyEvents("keypressEventsToSimulate","handleKeyPress")}},{key:"simulatePendingKeyUpEvents",value:function(){this._simulatePendingKeyEvents("keyupEventsToSimulate","handleKeyUp")}},{key:"_simulatePendingKeyEvents",value:function(e,t){var n=this;0<this[e].length&&Ne.incrementId(),this[e].forEach(function(e){var r=e.event,i=e.focusTreeId,o=e.componentId,a=e.options;n[t](r,i,o,a)}),this[e]=[]}},{key:"_callHandlerIfActionNotHandled",value:function(e,t,n,r,i){this.getCurrentCombination().describe();if(this.componentList.anyActionsForEventType(n))if(this.eventPropagator.isHandled());else{var o=this.eventPropagator.getPreviousPosition(),a=this.componentList.getIndexById(r);this._callClosestMatchingHandler(e,t,n,a,-1===o?0:o)&&this.eventPropagator.setHandled()}}},{key:"_logPrefix",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=P.logIcons,r=P.eventIcons,i=P.componentIcons,o="HotKeys (";if(!1!==t.focusTreeId){var a=le(t.focusTreeId)?this.focusTreeId:t.focusTreeId;o+="F".concat(a).concat(n[a%n.length],"-")}if(!1!==t.eventId){var l=le(t.eventId)?Ne.getId():t.eventId;o+="E".concat(l).concat(r[l%r.length],"-")}o+="C".concat(e).concat(i[e%i.length]);var u=this.componentList.getIndexById(e);return le(u)||(o+="-P".concat(u).concat(i[u%i.length],":")),"".concat(o,")")}}]),t}();function Be(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return Array.isArray(e)||F(e)?n.stringifyFirst?!le(e.find(function(e){return e.toString()===t.toString()})):-1!==e.indexOf(t):ce(e)?N(e,t):n.stringifyFirst?e.toString()===t.toString():e===t}function qe(e){return e.replace(/\b\w/g,function(e){return e.toUpperCase()})}var We=function(e){function t(){var e,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length?arguments[1]:void 0;return u(this,t),(e=_(this,y(t).call(this,n,r))).listenersBound=!1,e.eventOptions={ignoreEventsCondition:T.option("ignoreEventsCondition")},e.listeners={},e}return h(t,Me),c(t,[{key:"enableHotKeys",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=3<arguments.length?arguments[3]:void 0,i=4<arguments.length?arguments[4]:void 0;this.eventOptions=i,this._addComponent(e,t,n,r),this._updateDocumentHandlers(),this._initHandlerResolutionState()}},{key:"updateEnabledHotKeys",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=3<arguments.length?arguments[3]:void 0,i=4<arguments.length?arguments[4]:void 0;this.eventOptions=i,this.componentList.update(e,t,n,r),this.getKeyHistory().setMaxLength(this.componentList.getLongestSequence()),this._updateDocumentHandlers(),this._initHandlerResolutionState()}},{key:"disableHotKeys",value:function(e){this.componentList.remove(e),this.getKeyHistory().setMaxLength(this.componentList.getLongestSequence()),this._updateDocumentHandlers(),this._initHandlerResolutionState()}},{key:"_updateDocumentHandlers",value:function(){var e=this,t=this._listenersShouldBeBound();!this.listenersBound&&t?(Object.values(I).forEach(function(t){var n=Pe(t);document["on".concat(n)]=function(t){e.keyEventManager["handleGlobal".concat(function(e){return"".concat(qe(e.slice(0,3))).concat(qe(e.slice(3)))}(n))](t)}}),this.listenersBound=!0):this.listenersBound&&!t&&(Object.values(I).forEach(function(e){var t=Pe(e);delete document["on".concat(t)]}),this.listenersBound=!1)}},{key:"_listenersShouldBeBound",value:function(){return this.componentList.any()||this.listeners.keyCombination}},{key:"handleKeydown",value:function(e){var t=Ae(e);if(e.repeat&&T.option("ignoreRepeatedEventsWhenKeyHeldDown"))return!0;this._checkForModifierFlagDiscrepancies(e,t,I.keydown);var n=this._howReactAppRespondedTo(e,t,I.keydown);if(n!==Re||!this.eventOptions.ignoreEventsCondition(e)){if(n!==Fe){var r=Ie(e),i=this.getCurrentCombination();i.isKeyIncluded(t)||i.isEnding()?this._startAndLogNewKeyCombination(t,r):this._addToAndLogCurrentKeyCombination(t,I.keydown,r)}Be([Fe,Ue],n)||this._callHandlerIfExists(e,t,I.keydown),this._simulateKeyPressForNonPrintableKeys(e,t)}}},{key:"_howReactAppRespondedTo",value:function(e,t,n){var r=this.keyEventManager.reactAppHistoryWithEvent(t,n);return r===Ue||(r===Fe||(r===De||Ne.incrementId())),r}},{key:"handleKeyPress",value:function(e){var t=Ae(e);if(e.repeat&&T.option("ignoreRepeatedEventsWhenKeyHeldDown"))return!0;var n=this.getCurrentCombination();if(n.isKeyPressSimulated(t))return!0;var r=this._howReactAppRespondedTo(e,t,I.keypress);return n.isKeyIncluded(t)&&this._addToAndLogCurrentKeyCombination(t,I.keypress,Ie(e)),r===Re&&(this.keyEventManager.closeHangingKeyCombination(t,I.keypress),this.eventOptions.ignoreEventsCondition(e))?void 0:void(!Be([Fe,Ue],r)&&this._callHandlerIfExists(e,t,I.keypress))}},{key:"handleKeyUp",value:function(e){var t=Ae(e),n=this.getCurrentCombination();if(n.isKeyUpSimulated(t))return!0;var r=this._howReactAppRespondedTo(e,t,I.keyup);n.isKeyIncluded(t)&&this._addToAndLogCurrentKeyCombination(t,I.keyup,Ie(e)),r===Re?(this.keyEventManager.closeHangingKeyCombination(t,I.keyup),this.eventOptions.ignoreEventsCondition(e)||!Be([Fe,Ue],r)&&this._callHandlerIfExists(e,t,I.keyup)):!Be([Fe,Ue],r)&&this._callHandlerIfExists(e,t,I.keyup),this._simulateKeyUpEventsHiddenByCmd(e,t),this.listeners.keyCombination&&this._allKeysAreReleased()&&this.listeners.keyCombination({keys:n.getKeyDictionary(),id:n.describe()})}},{key:"_simulateKeyPressForNonPrintableKeys",value:function(e,t){this.keyEventManager.simulatePendingKeyPressEvents(),this._handleEventSimulation("handleKeyPress",this._shouldSimulate(I.keypress,t),{event:e,key:t})}},{key:"_simulateKeyUpEventsHiddenByCmd",value:function(e,t){var n=this;He(t)&&(this.keyEventManager.simulatePendingKeyUpEvents(),this.getCurrentCombination().forEachKey(function(t){He(t)||n._handleEventSimulation("handleKeyUp",n._shouldSimulate(I.keyup,t),{event:e,key:t})}))}},{key:"_startAndLogNewKeyCombination",value:function(e,t){this.getKeyHistory().startNewKeyCombination(e,t)}},{key:"_addToAndLogCurrentKeyCombination",value:function(e,t,n){this.getKeyHistory().addKeyToCurrentCombination(e,t,n)}},{key:"_handleEventSimulation",value:function(e,t,n){var r=n.event,i=n.key;if(t&&T.option("simulateMissingKeyPressEvents")){var o=this._cloneAndMergeEvent(r,{key:i,simulated:!0});this[e](o)}}},{key:"_callHandlerIfExists",value:function(e,t,n){this.getCurrentCombination().describe();return this.componentList.anyActionsForEventType(n)?void this._callClosestMatchingHandler(e,t,n):void 0}},{key:"_callClosestMatchingHandler",value:function(e,n,r){for(var i=this.componentList.getNewIterator();i.next();)if(w(y(t.prototype),"_callClosestMatchingHandler",this).call(this,e,n,r,i.getPosition(),0))return}},{key:"_stopEventPropagation",value:function(e,t){e.simulated||e.stopPropagation()}},{key:"addKeyCombinationListener",value:function(e){var t=this,n=function(){delete t.listeners.keyCombination};return this.listeners.keyCombination=function(t){e(t),n()},this._updateDocumentHandlers(),n}},{key:"_logPrefix",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=P.eventIcons,r=P.componentIcons,i="HotKeys (GLOBAL";if(!1!==t.eventId){var o=le(t.eventId)?Ne.getId():t.eventId;i="".concat(i,"-E").concat(o).concat(n[o%n.length])}return le(e)?"".concat(i,"):"):"".concat(i,"-C").concat(e).concat(r[e%r.length],"):")}}]),t}();function Ve(e){return!le(e)}var $e=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};u(this,e),this.logger=t.logger||new P(T.option("logLevel")),this._focusOnlyEventStrategy=new je({configuration:t,logger:this.logger},this),this._globalEventStrategy=new We({configuration:t,logger:this.logger},this),this.mountedComponentsCount=0}return c(e,null,[{key:"getInstance",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return this.instance||(this.instance=new e(t)),this.instance}},{key:"clear",value:function(){delete this.instance}}]),c(e,[{key:"getApplicationKeyMap",value:function(){return Object.assign(this._globalEventStrategy.getApplicationKeyMap(),this._focusOnlyEventStrategy.getApplicationKeyMap())}},{key:"registerKeyMap",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return this._focusOnlyEventStrategy.registerKeyMap(e)}},{key:"reregisterKeyMap",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};this._focusOnlyEventStrategy.reregisterKeyMap(e,t)}},{key:"deregisterKeyMap",value:function(e){this._focusOnlyEventStrategy.deregisterKeyMap(e)}},{key:"registerComponentMount",value:function(e,t){return this._incrementComponentCount(),this._focusOnlyEventStrategy.registerComponentMount(e,t)}},{key:"registerComponentUnmount",value:function(){this._decrementComponentCount()}},{key:"_incrementComponentCount",value:function(){var e=this,t=this.mountedComponentsCount;this.mountedComponentsCount+=1,0===t&&1===this.mountedComponentsCount&&(window.onblur=function(){return e._clearKeyHistory()})}},{key:"_decrementComponentCount",value:function(){var e=this.mountedComponentsCount;this.mountedComponentsCount-=1,1===e&&0===this.mountedComponentsCount&&delete window.onblur}},{key:"_clearKeyHistory",value:function(){this._focusOnlyEventStrategy.resetKeyHistory({force:!0}),this._globalEventStrategy.resetKeyHistory({force:!0})}},{key:"registerGlobalKeyMap",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return this._globalEventStrategy.registerKeyMap(e)}},{key:"registerGlobalComponentUnmount",value:function(){this._decrementComponentCount()}},{key:"registerGlobalComponentMount",value:function(e,t){return this._incrementComponentCount(),this._globalEventStrategy.registerComponentMount(e,t)}},{key:"reregisterGlobalKeyMap",value:function(e,t){this._globalEventStrategy.reregisterKeyMap(e,t)}},{key:"deregisterGlobalKeyMap",value:function(e){this._globalEventStrategy.deregisterKeyMap(e)}},{key:"addKeyCombinationListener",value:function(e){return this._globalEventStrategy.addKeyCombinationListener(e)}},{key:"enableHotKeys",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=3<arguments.length?arguments[3]:void 0;return this._focusOnlyEventStrategy.enableHotKeys(e,t,n,r)}},{key:"updateEnabledHotKeys",value:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},i=4<arguments.length?arguments[4]:void 0;return this._focusOnlyEventStrategy.updateEnabledHotKeys(e,t,n,r,i)}},{key:"disableHotKeys",value:function(e,t){return this._focusOnlyEventStrategy.disableHotKeys(e,t)}},{key:"handleKeydown",value:function(e,t,n,r){if(Ve(t))return this._focusOnlyEventStrategy.handleKeydown(e,t,n,r)}},{key:"handleKeyPress",value:function(e,t,n,r){if(Ve(t))return this._focusOnlyEventStrategy.handleKeyPress(e,t,n,r)}},{key:"handleKeyUp",value:function(e,t,n,r){if(Ve(t))return this._focusOnlyEventStrategy.handleKeyUp(e,t,n,r)}},{key:"enableGlobalHotKeys",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=3<arguments.length?arguments[3]:void 0,i=4<arguments.length?arguments[4]:void 0;return this._globalEventStrategy.enableHotKeys(e,t,n,r,i)}},{key:"updateEnabledGlobalHotKeys",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},r=3<arguments.length?arguments[3]:void 0,i=4<arguments.length?arguments[4]:void 0;return this._globalEventStrategy.updateEnabledHotKeys(e,t,n,r,i)}},{key:"disableGlobalHotKeys",value:function(e){return this._globalEventStrategy.disableHotKeys(e)}},{key:"handleGlobalKeyDown",value:function(e){return this._globalEventStrategy.handleKeydown(e)}},{key:"handleGlobalKeyPress",value:function(e){return this._globalEventStrategy.handleKeyPress(e)}},{key:"handleGlobalKeyUp",value:function(e){return this._globalEventStrategy.handleKeyUp(e)}},{key:"ignoreEvent",value:function(e){this._focusOnlyEventStrategy.getEventPropagator().ignoreEvent(e)}},{key:"observeIgnoredEvents",value:function(e){this._focusOnlyEventStrategy.getEventPropagator().observeIgnoredEvents(e)}},{key:"closeHangingKeyCombination",value:function(e,t){this._focusOnlyEventStrategy.closeHangingKeyCombination(e,t)}},{key:"reactAppHistoryWithEvent",value:function(e,t){var n=this._focusOnlyEventStrategy.eventPropagator.getPreviousPropagation();return n.isForKey(e)&&n.isForEventType(t)?n.isHandled()?Ue:n.isIgnoringEvent()?Fe:De:Re}},{key:"simulatePendingKeyPressEvents",value:function(){this._focusOnlyEventStrategy.simulatePendingKeyPressEvents()}},{key:"simulatePendingKeyUpEvents",value:function(){this._focusOnlyEventStrategy.simulatePendingKeyUpEvents()}},{key:"isGlobalListenersBound",value:function(){return this._globalEventStrategy.listenersBound}}]),e}();function Qe(e,t){var n=t.deprecatedAPI,r=n.contextTypes,i=n.childContextTypes,o=t.newAPI.contextType;if("undefined"==typeof a.a.createContext)e.contextTypes=r,e.childContextTypes=i,e.prototype.getChildContext=function(){return this._childContext};else{var l=a.a.createContext(o);e.contextType=l,e.prototype._originalRender=e.prototype.render,e.prototype.render=function(){var e=this._originalRender();return e?a.a.createElement(l.Provider,{value:this._childContext},e):null}}return e}function Ge(e){function t(e,t){return p({},l[e]||{},t[e]||{})}function n(e){return t("handlers",e)}function r(e){return t("keyMap",e)}var l=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},s=function(t){function i(e){var t;return u(this,i),(t=_(this,y(i).call(this,e)))._handleFocus=t._handleFocus.bind(k(k(t))),t._handleBlur=t._handleBlur.bind(k(k(t))),t._handleKeyDown=t._handleKeyDown.bind(k(k(t))),t._handleKeyPress=t._handleKeyPress.bind(k(k(t))),t._handleKeyUp=t._handleKeyUp.bind(k(k(t))),t._componentIsFocused=t._componentIsFocused.bind(k(k(t))),t._id=$e.getInstance().registerKeyMap(e.keyMap),t._childContext={hotKeysParentId:t._id},t}return h(i,o["PureComponent"]),c(i,[{key:"render",value:function(){var t=this.props,n=(t.keyMap,t.handlers,t.allowChanges,t.root,b(t,["keyMap","handlers","allowChanges","root"])),r={onFocus:this._wrapFunction("onFocus",this._handleFocus),onBlur:this._wrapFunction("onBlur",this._handleBlur),tabIndex:T.option("defaultTabIndex")};return this._shouldBindKeyListeners()&&(r.onKeyDown=this._handleKeyDown,r.onKeyPress=this._handleKeyPress,r.onKeyUp=this._handleKeyUp),a.a.createElement(e,d({hotKeys:r},n))}},{key:"_shouldBindKeyListeners",value:function(){var e=r(this.props);return!fe(e)||this.props.root||T.option("enableHardSequences")&&this._handlersIncludeHardSequences(e,n(this.props))}},{key:"_handlersIncludeHardSequences",value:function(e,t){return Object.keys(t).some(function(t){return!e[t]&&ie.isValidKeySerialization(t)})}},{key:"_wrapFunction",value:function(e,t){var n=this;return"function"==typeof this.props[e]?function(r){n.props[e](r),t(r)}:t}},{key:"_focusTreeIdsPush",value:function(e){this._focusTreeIds||(this._focusTreeIds=[]),this._focusTreeIds.push(e)}},{key:"_focusTreeIdsShift",value:function(){this._focusTreeIds&&this._focusTreeIds.shift()}},{key:"_getFocusTreeId",value:function(){if(this._focusTreeIds)return this._focusTreeIds[0]}},{key:"componentDidUpdate",value:function(){var e=$e.getInstance();if(e.reregisterKeyMap(this._id,this.props.keyMap),this._componentIsFocused()&&(this.props.allowChanges||!T.option("ignoreKeymapAndHandlerChangesByDefault"))){var t=this.props,n=t.keyMap,r=t.handlers;e.updateEnabledHotKeys(this._getFocusTreeId(),this._id,n,r,this._getComponentOptions())}}},{key:"_componentIsFocused",value:function(){return!0===this._focused}},{key:"componentDidMount",value:function(){var e=$e.getInstance(),t=this.context.hotKeysParentId;e.registerComponentMount(this._id,t)}},{key:"_handleFocus",value:function(){var e;this.props.onFocus&&(e=this.props).onFocus.apply(e,arguments);var t=$e.getInstance().enableHotKeys(this._id,r(this.props),n(this.props),this._getComponentOptions());le(t)||this._focusTreeIdsPush(t),this._focused=!0}},{key:"componentWillUnmount",value:function(){var e=$e.getInstance();e.deregisterKeyMap(this._id),e.registerComponentUnmount(),this._handleBlur()}},{key:"_handleBlur",value:function(){var e;this.props.onBlur&&(e=this.props).onBlur.apply(e,arguments);$e.getInstance().disableHotKeys(this._getFocusTreeId(),this._id)||this._focusTreeIdsShift(),this._focused=!1}},{key:"_handleKeyDown",value:function(e){$e.getInstance().handleKeydown(e,this._getFocusTreeId(),this._id,this._getEventOptions())&&this._focusTreeIdsShift()}},{key:"_handleKeyPress",value:function(e){$e.getInstance().handleKeyPress(e,this._getFocusTreeId(),this._id,this._getEventOptions())&&this._focusTreeIdsShift()}},{key:"_handleKeyUp",value:function(e){$e.getInstance().handleKeyUp(e,this._getFocusTreeId(),this._id,this._getEventOptions())&&this._focusTreeIdsShift()}},{key:"_getComponentOptions",value:function(){return{defaultKeyEvent:T.option("defaultKeyEvent")}}},{key:"_getEventOptions",value:function(){return{ignoreEventsCondition:T.option("ignoreEventsCondition")}}}]),i}();return f(s,"propTypes",{keyMap:i.a.object,handlers:i.a.object,onFocus:i.a.func,onBlur:i.a.func,allowChanges:i.a.bool,root:i.a.bool}),Qe(s,{deprecatedAPI:{contextTypes:{hotKeysParentId:i.a.number},childContextTypes:{hotKeysParentId:i.a.number}},newAPI:{contextType:{hotKeysParentId:void 0}}})}var Ye=Ge(function(e){function t(){return u(this,t),_(this,y(t).apply(this,arguments))}return h(t,o["Component"]),c(t,[{key:"render",value:function(){var e=this.props,t=e.hotKeys,n=e.innerRef,r=e.component,i=b(e,["hotKeys","innerRef","component"]),o=r||T.option("defaultComponent");return a.a.createElement(o,p({},t,{ref:n},i))}}]),t}());Ye.propTypes={innerRef:i.a.oneOfType([i.a.object,i.a.func])};var Xe=function(e){function t(e){var n;return u(this,t),(n=_(this,y(t).call(this,e)))._id=$e.getInstance().registerGlobalKeyMap(e.keyMap),n._childContext={globalHotKeysParentId:n._id},n}return h(t,o["Component"]),c(t,[{key:"render",value:function(){return this.props.children||null}},{key:"componentDidUpdate",value:function(){var e=$e.getInstance();if(e.reregisterGlobalKeyMap(this._id,this.props.keyMap),this.props.allowChanges||!T.option("ignoreKeymapAndHandlerChangesByDefault")){var t=this.props,n=t.keyMap,r=t.handlers;e.updateEnabledGlobalHotKeys(this._id,n,r,this._getComponentOptions(),this._getEventOptions())}}},{key:"componentDidMount",value:function(){var e=this.props,t=e.keyMap,n=e.handlers,r=this.context.globalHotKeysParentId,i=$e.getInstance();i.registerGlobalComponentMount(this._id,r),i.enableGlobalHotKeys(this._id,t,n,this._getComponentOptions(),this._getEventOptions())}},{key:"componentWillUnmount",value:function(){var e=$e.getInstance();e.deregisterGlobalKeyMap(this._id),e.disableGlobalHotKeys(this._id),e.registerGlobalComponentUnmount()}},{key:"_getComponentOptions",value:function(){return{defaultKeyEvent:T.option("defaultKeyEvent")}}},{key:"_getEventOptions",value:function(){return{ignoreEventsCondition:T.option("ignoreEventsCondition")}}}]),t}();f(Xe,"propTypes",{keyMap:i.a.object,handlers:i.a.object,allowChanges:i.a.bool});var Je=Qe(Xe,{deprecatedAPI:{contextTypes:{globalHotKeysParentId:i.a.number},childContextTypes:{globalHotKeysParentId:i.a.number}},newAPI:{contextType:{globalHotKeysParentId:void 0}}});function Ze(e){var t,n,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{only:[],except:[]},l=2<arguments.length?arguments[2]:void 0;return n=t=function(t){function n(e){var t;return u(this,n),(t=_(this,y(n).call(this,e)))._handleKeyEvent=t._handleKeyEvent.bind(k(k(t))),t._reloadDictionaries=t._reloadDictionaries.bind(k(k(t))),t}return h(n,o["PureComponent"]),c(n,[{key:"render",value:function(){var t=this.props,n=(t.only,t.except,b(t,["only","except"])),r={onKeyDown:this._handleKeyEvent,onKeyPress:this._handleKeyEvent,onKeyUp:this._handleKeyEvent,onFocus:this._reloadDictionaries};return a.a.createElement(e,d({hotKeys:r},n))}},{key:"_reloadDictionaries",value:function(){var e=this.props,t=e.only,n=e.except;this._onlyDict=et(t),this._exceptDict=et(n)}},{key:"_shouldIgnoreEvent",value:function(e){var t=e.key;return fe(this._onlyDict)?!!fe(this._exceptDict)||!N(this._exceptDict,t):fe(this._exceptDict)?N(this._onlyDict,t):N(this._onlyDict,t)&&!N(this._exceptDict,t)}},{key:"_handleKeyEvent",value:function(e){this._shouldIgnoreEvent(e)&&$e.getInstance()[l](e)}}]),n}(),f(t,"propTypes",{only:i.a.oneOfType([i.a.string,i.a.arrayOf(i.a.string)]),except:i.a.oneOfType([i.a.string,i.a.arrayOf(i.a.string)])}),f(t,"defaultProps",r),n}function et(e){return ve(e).reduce(function(e,t){var n=z(t);if(!W(n))throw new V(t);return[re,ne,M,H,Z,J].forEach(function(t){e[t(n)]=!0}),e},{})}var tt=Ze(function(e){function t(){return u(this,t),_(this,y(t).apply(this,arguments))}return h(t,o["Component"]),c(t,[{key:"render",value:function(){var e=this.props,t=e.hotKeys,n=b(e,["hotKeys"]),r=n.component||T.option("defaultComponent");return a.a.createElement(r,p({},t,n))}}]),t}(),{},"ignoreEvent"),nt=Ze(function(e){function t(){return u(this,t),_(this,y(t).apply(this,arguments))}return h(t,o["Component"]),c(t,[{key:"render",value:function(){var e=this.props,t=e.hotKeys,n=b(e,["hotKeys"]),r=n.component||T.option("defaultComponent");return a.a.createElement(r,p({},t,n))}}]),t}(),{},"observeIgnoredEvents");function rt(e){return Ze(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:{only:[],except:[]},"ignoreEvent")}function it(e){return Ze(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:{only:[],except:[]},"observeIgnoredEvents")}function ot(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};T.init(e)}function at(){return $e.getInstance().getApplicationKeyMap()}function lt(e){return $e.getInstance().addKeyCombinationListener(e)}},function(e,t,n){"use strict";var r=n(20);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,o,a){if(a!==r){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}]]);+//# sourceMappingURL=2.822530b2.chunk.js.map
+ viewer/build/static/js/main.b15b405f.chunk.js view
@@ -0,0 +1,2 @@+(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{12:function(e,t,n){e.exports=n(22)},17:function(e,t,n){},21:function(e,t,n){},22:function(e,t,n){"use strict";n.r(t);var a=n(0),r=n.n(a),s=n(7),o=n.n(s),c=(n(17),n(3)),f=n(8),i=n(10),u=n(9),m=n(2),l=n(4),g=n(11),d=n(5);n(21);Object(d.configure)({ignoreRepeatedEventsWhenKeyHeldDown:!1});var _={PAUSE:"space",STEP_FORWARD:"right",STEP_BACKWARDS:"left",SKIP_FORWARD:"up",SKIP_BACKWARDS:"down"},v=function(e){function t(e){var n;Object(f.a)(this,t),(n=Object(i.a)(this,Object(u.a)(t).call(this,e))).connect=function(){var e=new WebSocket("ws://localhost:9161");e.onopen=function(t){n.setState(function(e){return Object(c.a)({},e,{message:"Connected."})}),e.send("60")},e.onclose=function(e){n.setState(function(e){return Object(c.a)({},e,{message:"Disconnected."})}),n.svgs=[],n.status="",n.frame_count=0,n.next_frame=0,setTimeout(n.connect,1e3)},e.onmessage=function(e){if("Success!"===e.data)console.log("Success");else if("Compiling"===e.data)n.setState({message:"Compiling..."}),n.status="compiling",n.svgs=[],n.frame_count=0,n.next_frame=0;else if("Done"===e.data)n.setState({message:""}),console.log("Done"),n.status="done";else if(e.data.startsWith("Error"))console.log("Error",e.data.substring(5)),n.setState({message:e.data.substring(5)});else{var t=parseInt(e.data);if(isNaN(t)){var a=document.createElement("div");a.innerHTML=e.data,n.svgs[n.next_frame]=a;var r=0;n.svgs.forEach(function(e){return r++})}else"compiling"===n.status?(n.setState({message:"Rendering..."}),n.frame_count=t,n.status="rendering",n.start=Date.now(),n.svgs=[],n.svgs[n.frame_count-1]=void 0):"rendering"===n.status?n.next_frame=t:console.log("Bad state change: received number")}},n.setState(function(t){return Object(c.a)({},t,{socket:e,message:"Connecting..."})})},n.onLoad=function(e){setTimeout(function(){e.resize()},0)},n.state={},setTimeout(n.connect,0),n.svgs=[],n.start=Date.now(),n.status="",n.frame_count=0,n.next_frame=0,n.freeze_frame=null;var a=Object(m.a)(n);return requestAnimationFrame(function e(){Date.now();var t=a.frame_count,r=a.frame_count/60,s=null!==n.freeze_frame?n.freeze_frame:a.frameByTimer(),o=0;if(n.svgs.forEach(function(e){return o++}),t){if(a.svgs[s]){for(n.setState({message:s+"/"+a.frame_count+" "+Math.round(o/r)+" fps"});a.svg.firstChild;)a.svg.removeChild(a.svg.firstChild);a.svg.appendChild(a.svgs[s])}}else a.svg.innerText="";requestAnimationFrame(e)}),n}return Object(g.a)(t,e),Object(l.a)(t,[{key:"frameByTimer",value:function(){var e=Date.now(),t=this.frame_count;return Math.round((e-this.start)/1e3*60)%t}}]),Object(l.a)(t,[{key:"render",value:function(){var e=this,t=this,n=function(){null===t.freeze_frame&&(console.log("Pause"),t.freeze_frame=t.frameByTimer())},a={PAUSE:function(e){e.preventDefault(),null===t.freeze_frame?n():(console.log("unpause"),t.start=Date.now()-t.freeze_frame/60*1e3,t.freeze_frame=null)},STEP_FORWARD:function(e){n(),t.freeze_frame=(t.freeze_frame+1)%t.frame_count},SKIP_FORWARD:function(e){n(),t.freeze_frame=(t.freeze_frame+10)%t.frame_count},STEP_BACKWARDS:function(e){n(),t.freeze_frame-=1,t.freeze_frame<0&&(t.freeze_frame=t.frame_count+t.freeze_frame)},SKIP_BACKWARDS:function(e){n(),t.freeze_frame-=10,t.freeze_frame<0&&(t.freeze_frame=t.frame_count+t.freeze_frame)}},s=this.state.message;return r.a.createElement(d.HotKeys,{handlers:a,keyMap:_},r.a.createElement("div",{className:"App"},r.a.createElement("div",{className:"viewer"},r.a.createElement("div",{ref:function(t){return e.svg=t}}),r.a.createElement("div",{className:"messages"},r.a.createElement("pre",null,s)))))}}]),t}(a.Component);Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));o.a.render(r.a.createElement(v,null),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(function(e){e.unregister()})}},[[12,1,2]]]);+//# sourceMappingURL=main.b15b405f.chunk.js.map
− viewer/build/static/js/main.c36ecb4a.chunk.js
@@ -1,2 +0,0 @@-(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{10:function(e,t,n){e.exports=n(18)},16:function(e,t,n){},17:function(e,t,n){},18:function(e,t,n){"use strict";n.r(t);var a=n(0),s=n.n(a),o=n(4),r=n.n(o),c=(n(16),n(2)),i=n(5),u=n(6),m=n(9),l=n(7),f=n(1),g=n(8),d=(n(17),function(e){function t(e){var n;Object(i.a)(this,t),(n=Object(m.a)(this,Object(l.a)(t).call(this,e))).connect=function(){var e=new WebSocket("ws://localhost:9161");e.onopen=function(t){n.setState(function(e){return Object(c.a)({},e,{message:"Connected."})}),e.send("60")},e.onclose=function(e){n.setState(function(e){return Object(c.a)({},e,{message:"Disconnected."})}),setTimeout(n.connect,1e3)},e.onmessage=function(e){if("Success!"===e.data)console.log("Success");else if("Compiling"===e.data)n.setState({message:"Compiling..."}),n.status="compiling",n.svgs=[],n.frame_count=0,n.next_frame=0;else if("Done"===e.data)n.setState({message:""}),console.log("Done"),n.status="done";else if(e.data.startsWith("Error"))console.log("Error",e.data.substring(5)),n.setState({message:e.data.substring(5)});else{var t=parseInt(e.data);if(isNaN(t)){var a=document.createElement("div");a.innerHTML=e.data,n.svgs[n.next_frame]=a;var s=0;n.svgs.forEach(function(e){return s++}),console.log("Received",n.next_frame,n.frame_count,s)}else"compiling"===n.status?(n.setState({message:"Rendering..."}),n.frame_count=t,n.status="rendering",n.start=Date.now(),n.svgs=[],n.svgs[n.frame_count-1]=void 0):"rendering"===n.status?n.next_frame=t:console.log("Bad state change: received number")}},n.setState(function(t){return Object(c.a)({},t,{socket:e,message:"Connecting..."})})},n.onLoad=function(e){setTimeout(function(){e.resize()},0)},n.state={},setTimeout(n.connect,0),n.svgs=[],n.start=Date.now(),n.status="",n.frame_count=0,n.next_frame=0;var a=Object(f.a)(n);return requestAnimationFrame(function e(){var t=Date.now(),s=a.frame_count,o=a.frame_count/60,r=Math.round((t-n.start)/1e3*60)%s,c=0;if(n.svgs.forEach(function(e){return c++}),s){if(a.svgs[r]){for(n.setState({message:r+"/"+a.frame_count+" "+Math.round(c/o)+" fps"});a.svg.firstChild;)a.svg.removeChild(a.svg.firstChild);a.svg.appendChild(a.svgs[r])}}else a.svg.innerText="";requestAnimationFrame(e)}),n}return Object(g.a)(t,e),Object(u.a)(t,[{key:"render",value:function(){var e=this,t=this.state.message;return s.a.createElement("div",{className:"App"},s.a.createElement("div",{className:"viewer"},s.a.createElement("div",{ref:function(t){return e.svg=t}}),s.a.createElement("div",{className:"messages"},s.a.createElement("pre",null,t))))}}]),t}(a.Component));Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));r.a.render(s.a.createElement(d,null),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(function(e){e.unregister()})}},[[10,1,2]]]);-//# sourceMappingURL=main.c36ecb4a.chunk.js.map