Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

65.9 KB
Raw Blame
<!DOCTYPE html>
<html style="height: 100%">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, height=device-height, interactive-widget=resizes-content, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, viewport-fit=cover">
    <title>{{.l6}}</title>
    <script>
        // 在正文解析前确定主题,避免认证页先绘制浅色背景。
        if ({{.appearanceModeOS}} && window.matchMedia("(prefers-color-scheme: dark)").matches || {{.appearanceMode}} === 1) {
            document.documentElement.classList.add("dark");
        }
    </script>
    <style>
        html {
            background-color: #fff;
        }

        html.dark {
            background-color: #1e1e1e;
        }

        body {
            margin: 0;
            display: flex;
            align-items: center;
            height: 100%;
            justify-content: center;
            font-family: "Helvetica Neue", "Luxi Sans", "DejaVu Sans", "Hiragino Sans GB", "Microsoft Yahei", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", "EmojiSymbols";
            --b3-theme-on-surface: rgba(0, 0, 0, .6);
            --b3-protyle-code-background: rgba(27, 31, 35, .05);
            --b3-protyle-inline-link-color: #4285f4;
            --b3-theme-primary: #3573f0;
            --b3-theme-primary-lighter: rgba(53, 115, 240, 0.38);
            --b3-theme-primary-lightest: rgba(53, 115, 240, 0.12);
            --b3-theme-background: #fff;
            --b3-theme-on-background: #202124;
            --b3-theme-on-primary: #fff;
            background-color: var(--b3-theme-background);
        }

        .dark body {
            --b3-theme-on-surface: #9aa0a6;
            --b3-protyle-code-background: rgba(240, 246, 252, .15);
            --b3-protyle-inline-link-color: #8ab4f8;
            --b3-theme-primary: #3573f0;
            --b3-theme-primary-lighter: rgba(53, 115, 240, 0.48);
            --b3-theme-primary-lightest: rgba(53, 115, 240, 0.24);
            --b3-theme-background: #1e1e1e;
            --b3-theme-on-background: #c9d1d9;
            --b3-theme-on-primary: #fff;
        }

        .b3-button {
            margin: 16px 0;
            width: 240px;
            cursor: pointer;
            color: #fff;
            border-radius: 4px;
            line-height: 20px;
            padding: 4px 8px;
            white-space: nowrap;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transition: box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);
            border: 0;
            box-sizing: border-box;
            text-align: center;
            font-family: "Helvetica Neue", "Luxi Sans", "DejaVu Sans", "Hiragino Sans GB", "Microsoft Yahei", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", "EmojiSymbols";
            background-color: var(--b3-theme-primary);
        }

        .b3-button svg {
            height: 16px;
            width: 16px;
            margin-right: 4px;
        }

        .b3-button:hover, .b3-button:focus {
            outline: none;
            text-decoration: none;
            box-shadow: 0px 5px 5px -3px rgb(0 0 0 / 0.2), 0px 8px 10px 1px rgb(0 0 0 / 0.14), 0px 3px 14px 2px rgb(0 0 0 / 0.12);
        }

        .b3-button:active {
            outline: none;
            box-shadow: 0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, .12);
        }

        .b3-button--white {
            color: rgb(13, 60, 97);
            background-color: #d6eaf9;
        }

        .b3-text-field {
            width: 240px;
            border: 0;
            border-radius: 4px;
            box-shadow: inset 0 0 0 1px var(--b3-theme-on-surface);
            padding: 4px 8px;
            line-height: 20px;
            box-sizing: border-box;
            color: var(--b3-theme-on-background);
            transition: box-shadow 120ms 0ms cubic-bezier(0, 0, 0.2, 1);
            background-color: var(--b3-theme-background);
            -webkit-appearance: none;
        }

        .b3-text-field:hover {
            border-color: var(--b3-theme-on-background);
        }

        .b3-text-field:focus {
            outline: none;
            box-shadow: inset 0 0 0 1px var(--b3-theme-primary), 0 0 0 3px var(--b3-theme-primary-lightest);
        }

        .b3-snackbar {
            position: fixed;
            top: 0;
            z-index: 502;
            app-region: no-drag;
            transform: translate3d(0, -100px, 0);
            opacity: 0;
            transition: opacity 0.15s cubic-bezier(0, 0, 0.2, 1) 0ms, transform 0.15s cubic-bezier(0, 0, 0.2, 1) 0ms;
            width: 100%;
            align-items: center;
            justify-content: center;
            height: 0;
            display: flex;
            font-size: 14px;
        }

        .b3-snackbar--show {
            transform: translate3d(0, 0, 0);
            opacity: 1;
        }

        .b3-snackbar--show .b3-snackbar__content {
            transform: none;
            text-align: center;
        }

        .b3-snackbar__content {
            line-height: 20px;
            border-radius: 4px;
            padding: 8px 16px;
            font-size: inherit;
            background-color: var(--b3-theme-primary);
            box-sizing: border-box;
            transition: transform 0.15s cubic-bezier(0, 0, 0.2, 1) 0ms;
            transform: scale(0.8);
            top: 16px;
            position: absolute;
            word-break: break-word;
            color: var(--b3-theme-on-primary);
            box-shadow: 0 3px 5px -1px rgb(0 0 0 / 20%), 0 6px 10px 0 rgb(0 0 0 / 14%), 0 1px 18px 0 rgb(0 0 0 / 12%);
        }

        .b3-snackbar__content .b3-button {
            margin: 8px 0 0 0;
        }

        a {
            outline: 0;
            text-decoration: none;
            color: var(--b3-protyle-inline-link-color);
        }

        a:hover {
            text-decoration: underline;
        }

        .b3-code {
            padding: 0.2em 0.4em;
            margin: 0;
            font-size: 85%;
            border-radius: 3px;
            font-family: "JetBrainsMono-Regular", mononoki, Consolas, "Liberation Mono", Menlo, Courier, monospace, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", "EmojiSymbols";
            word-break: break-word;
            background-size: 20px 20px;
            white-space: pre-wrap;
            background-color: var(--b3-protyle-code-background);
        }

        .auth-actions {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .auth-actions > .b3-button {
            margin: 16px 0 0;
        }

        #lockScreenWallpaper {
            height: 100%;
            inset: 0;
            object-fit: cover;
            pointer-events: none;
            position: fixed;
            width: 100%;
            z-index: 1;
        }

        body.has-wallpaper #authPanel {
            background-color: var(--b3-theme-background);
            border-radius: 12px;
            box-sizing: border-box;
            margin: 40px 16px 16px;
            max-height: calc(100% - 56px);
            max-width: calc(100% - 32px);
            overflow: auto;
            overflow-wrap: anywhere;
            padding: 24px;
            width: 480px;
        }

        @supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
            body.has-wallpaper #authPanel {
                --auth-text-outline: #000;
                --auth-panel-text: #fff;
                --auth-panel-secondary: #f4f6fa;
                background-color: rgba(255, 255, 255, .08);
                box-shadow: 0 8px 32px rgba(0, 0, 0, .16), inset 0 0 0 1px rgba(255, 255, 255, .4);
                -webkit-backdrop-filter: blur(8px) saturate(105%);
                backdrop-filter: blur(8px) saturate(105%);
            }

            .dark body.has-wallpaper #authPanel {
                background-color: rgba(0, 0, 0, .06);
            }

            body.has-wallpaper #authPanel h1,
            body.has-wallpaper #authPanel label {
                text-shadow: 0 1px 3px var(--auth-text-outline);
            }
        }

        @media (prefers-reduced-transparency: reduce), (forced-colors: active) {
            body.has-wallpaper #authPanel,
            .dark body.has-wallpaper #authPanel {
                --auth-text-outline: transparent;
                --auth-panel-text: var(--b3-theme-on-background);
                --auth-panel-secondary: var(--b3-theme-on-surface);
                background-color: var(--b3-theme-background);
                box-shadow: none;
                -webkit-backdrop-filter: none;
                backdrop-filter: none;
            }
        }

        #lockScreenCover {
            align-items: center;
            background: transparent;
            border: 0;
            box-sizing: border-box;
            color: #fff;
            cursor: pointer;
            display: flex;
            flex-direction: column;
            font: inherit;
            height: 100%;
            justify-content: center;
            left: 0;
            margin: 0;
            padding: 32px 24px;
            pointer-events: none;
            position: fixed;
            text-align: center;
            text-shadow: 0 2px 8px #000, 0 0 24px #000;
            top: 0;
            width: 100%;
            z-index: 2;
        }

        #lockScreenCover[hidden] {
            display: none;
        }

        #lockScreenCover:focus-visible {
            outline: 2px solid #fff;
            outline-offset: -8px;
        }

        #lockScreenClock {
            align-items: center;
            display: flex;
            flex-direction: column;
            max-width: 100%;
            opacity: var(--auth-clock-open-opacity, 0);
            transform: translateY(var(--auth-clock-open-y, -24px)) scale(.65);
        }

        #lockScreenTime {
            font-size: clamp(48px, 9vw, 112px);
            font-variant-numeric: tabular-nums;
            line-height: 1.15;
        }

        #lockScreenDate {
            font-size: clamp(18px, 2.5vw, 28px);
            margin-top: 8px;
        }

        #lockScreenHint {
            bottom: clamp(16px, 6vh, 48px);
            font-size: 14px;
            left: 16px;
            position: absolute;
            right: 16px;
            opacity: 0;
            visibility: hidden;
        }

        #authPanel h1 {
            margin-bottom: 48px;
        }

        body.wallpaper-cover #authPanel {
            opacity: 0;
            pointer-events: none;
            transform: translateY(20px);
        }

        body.has-wallpaper {
            --auth-motion-duration: 200ms;
            overflow: hidden;
        }

        body.wallpaper-cover #lockScreenCover {
            pointer-events: auto;
        }

        body.wallpaper-cover #lockScreenClock {
            opacity: 1;
            transform: none;
        }

        body.wallpaper-cover #lockScreenHint {
            opacity: 1;
            visibility: visible;
        }

        body.wallpaper-transition #authPanel {
            transition: opacity var(--auth-motion-duration) ease, transform var(--auth-motion-duration) ease;
        }

        body.wallpaper-transition #lockScreenClock {
            transition: opacity var(--auth-motion-duration) cubic-bezier(.16, 1, .3, 1),
                transform var(--auth-motion-duration) cubic-bezier(.16, 1, .3, 1);
        }

        body.wallpaper-transition.wallpaper-cover #lockScreenClock {
            transition-timing-function: cubic-bezier(.7, 0, .84, 0);
        }

        body.wallpaper-transition #lockScreenHint {
            transition: opacity var(--auth-motion-duration) ease, visibility 0s var(--auth-motion-duration);
        }

        body.wallpaper-transition.wallpaper-cover #lockScreenHint {
            transition-delay: 0s, 0s;
        }

        @media (prefers-reduced-motion: reduce) {
            body.has-wallpaper {
                --auth-motion-duration: 0ms;
            }
        }

        body.has-wallpaper #authPanel h1 {
            font-size: 24px;
            margin: 0 0 16px;
        }

        body.has-wallpaper .auth-actions > .b3-button {
            margin-top: 8px;
        }

    </style>
</head>
<body>
<img id="lockScreenWallpaper" alt="" hidden>
<button id="lockScreenCover" type="button" aria-labelledby="lockScreenHint" hidden>
    <span id="lockScreenClock">
        <time id="lockScreenTime" aria-live="off"></time>
        <span id="lockScreenDate"></span>
    </span>
    <span id="lockScreenHint">{{.lockScreenReveal}}</span>
</button>
<div data-auth-drag style="-webkit-app-region: drag;height: 32px;width: 100%;position: absolute;top: 0;z-index: 3;"></div>
<div id="authPanel" style="position: relative;z-index: 2;text-align: center">
    <h1 style="color:var(--auth-panel-text, var(--b3-theme-on-background))">{{.workspace}}</h1>
    <form id="authForm" method="post" action="/check-auth">
        <div id="authCodePanel"{{if not .accessAuthCodeEnabled}} style="display: none"{{end}}>
            <input class="b3-text-field" id="authCode" name="password" type="password"
                   autocomplete="current-password" aria-label="{{.l0}}" placeholder="{{.l0}}"/><br>
            <div style="position: relative;width: 240px;margin: 8px auto 0;display: none">
                <img id="captchaImg" style="top: 1px;position: absolute;height: 26px;right: 1px;cursor: pointer">
                <input id="captcha" class="b3-text-field" autocomplete="off" placeholder="{{.l3}}">
            </div>
        </div>
        <div class="auth-actions">
            {{if .accessAuthCodeEnabled}}<button class="b3-button" id="authSubmit" type="submit">{{.l1}}</button>{{end}}
            {{if .oidcEnabled}}<button class="b3-button" id="oidcLogin" type="button" onclick="startOIDC()">{{.l12}}</button>{{end}}
            <div style="width: 240px; margin: 8px auto; text-align: left; display: flex; align-items: center;">
                <input type="checkbox" id="rememberMe" style="margin-right: 8px;">
                <label for="rememberMe" style="color: var(--auth-panel-secondary, var(--b3-theme-on-surface)); font-size: 14px;">{{.l10}}</label>
            </div>
            <button class="b3-button b3-button--white" type="button" onclick="exitSiYuan()">{{.l5}}</button>
        </div>
    </form>
</div>
<div id="authDefaultBackground" style="overflow: hidden;position: absolute;height: 100%;width: 100%;top: 0;left: 0;">
    <svg style="top: 50%;left: 50%;width: 200%;transform: translate(-50%, -50%);position: absolute;z-index: 1;"
         xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" height="1602"
         viewBox="0 0 2769 1602" width="2769">
        <filter id="a" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse" height="1044" width="1044"
                x="1682" y="558">
            <feFlood flood-opacity="0" result="BackgroundImageFix"/>
            <feBlend in="SourceGraphic" in2="BackgroundImageFix" mode="normal" result="shape"/>
            <feGaussianBlur result="effect1_foregroundBlur" stdDeviation="100"/>
        </filter>
        <filter id="b" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse" height="1044" width="1044"
                x="1725" y="0">
            <feFlood flood-opacity="0" result="BackgroundImageFix"/>
            <feBlend in="SourceGraphic" in2="BackgroundImageFix" mode="normal" result="shape"/>
            <feGaussianBlur result="effect1_foregroundBlur" stdDeviation="100"/>
        </filter>
        <filter id="c" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse" height="858" width="982" x="0"
                y="23">
            <feFlood flood-opacity="0" result="BackgroundImageFix"/>
            <feBlend in="SourceGraphic" in2="BackgroundImageFix" mode="normal" result="shape"/>
            <feGaussianBlur result="effect1_foregroundBlur" stdDeviation="100"/>
        </filter>
        <filter id="d" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse" height="646" width="982" x="279"
                y="58">
            <feFlood flood-opacity="0" result="BackgroundImageFix"/>
            <feBlend in="SourceGraphic" in2="BackgroundImageFix" mode="normal" result="shape"/>
            <feGaussianBlur result="effect1_foregroundBlur" stdDeviation="100"/>
        </filter>
        <g filter="url(#a)" opacity=".34">
            <circle cx="2204" cy="1080" fill="#db469f" r="322"/>
        </g>
        <g filter="url(#b)" opacity=".7">
            <circle cx="2247" cy="522" fill="#043a8a" r="322"/>
        </g>
        <g filter="url(#c)" opacity=".9">
            <ellipse cx="491" cy="452" fill="#043a8a" rx="291" ry="229"/>
        </g>
        <g filter="url(#d)" opacity=".43">
            <ellipse cx="770" cy="381" fill="#043a8a" rx="291" ry="123"/>
        </g>
    </svg>
    <svg style="width: 100%;height: auto" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
         width="1764" height="1351" viewBox="0 0 1764 1351"><title>star-bg</title>
        <defs>
            <path id="a" d="M6.23.067V5.69H.61V.066h5.62z"/>
            <path id="c" d="M.67.697h9.937v9.938H.67z"/>
            <path id="e" d="M6.23.067V5.69H.61V.066h5.62z"/>
        </defs>
        <g fill="none" fill-rule="evenodd">
            <path d="M717.978 92.117l2.756 1.507a.394.394 0 0 1 0 .69l-2.756 1.508a.4.4 0 0 0-.156.156l-1.507 2.756a.393.393 0 0 1-.69 0l-1.508-2.755a.395.395 0 0 0-.157-.16l-2.755-1.505a.394.394 0 0 1 0-.69l2.755-1.508a.393.393 0 0 0 .157-.157l1.507-2.754a.393.393 0 0 1 .69 0l1.508 2.754c.036.067.09.12.156.157"
                  fill="#D15D64" style="mix-blend-mode:lighten"/>
            <path d="M239.057 166.72l1.36.745a.395.395 0 0 1 0 .692l-1.36.743a.4.4 0 0 0-.156.157l-.743 1.36a.394.394 0 0 1-.692 0l-.743-1.36a.395.395 0 0 0-.157-.157l-1.36-.743a.395.395 0 0 1 0-.692l1.36-.744a.393.393 0 0 0 .157-.155l.743-1.36a.395.395 0 0 1 .692 0l.744 1.36c.037.066.092.12.157.156"
                  fill="#FCD05C" style="mix-blend-mode:lighten"/>
            <path d="M409.472 108L408 109.47M413.47 104l-1.47 1.472M409.543 108.163a1.852 1.852 0 1 0 2.62-2.62 1.852 1.852 0 1 0-2.62 2.62z"
                  stroke="#7B63AB" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"/>
            <path d="M961.978 138.117l2.756 1.507a.394.394 0 0 1 0 .69l-2.756 1.507a.4.4 0 0 0-.156.16l-1.507 2.754a.393.393 0 0 1-.69 0l-1.508-2.756a.395.395 0 0 0-.157-.157l-2.755-1.505a.394.394 0 0 1 0-.69l2.755-1.508a.393.393 0 0 0 .157-.156l1.507-2.755a.393.393 0 0 1 .69 0l1.508 2.755c.036.066.09.12.156.156"
                  fill="#D15D64" style="mix-blend-mode:lighten"/>
            <path d="M1144.978 177.117l2.755 1.507a.394.394 0 0 1 0 .69l-2.755 1.508a.397.397 0 0 0-.156.156l-1.506 2.756a.393.393 0 0 1-.692 0l-1.506-2.756a.402.402 0 0 0-.16-.156l-2.753-1.507a.393.393 0 0 1 0-.69l2.755-1.508a.402.402 0 0 0 .158-.156l1.506-2.755a.394.394 0 0 1 .69 0l1.508 2.756c.037.066.09.12.157.157"
                  fill="#E98333" style="mix-blend-mode:lighten"/>
            <path d="M1083.057 100.72l1.36.745a.395.395 0 0 1 0 .692l-1.36.743a.4.4 0 0 0-.156.157l-.743 1.36a.394.394 0 0 1-.692 0l-.743-1.36a.395.395 0 0 0-.157-.157l-1.36-.743a.395.395 0 0 1 0-.692l1.36-.744a.393.393 0 0 0 .157-.155l.743-1.36a.395.395 0 0 1 .692 0l.744 1.36c.037.066.092.12.157.156"
                  fill="#FCD05C" style="mix-blend-mode:lighten"/>
            <path d="M1206.813 253.907a2.907 2.907 0 1 1-5.815-.003 2.907 2.907 0 0 1 5.815.003M114.978 319.116l2.756 1.507a.394.394 0 0 1 0 .692l-2.756 1.507a.4.4 0 0 0-.156.156l-1.507 2.755a.393.393 0 0 1-.69 0l-1.508-2.755a.395.395 0 0 0-.157-.156l-2.755-1.507a.394.394 0 0 1 0-.692l2.755-1.507a.393.393 0 0 0 .157-.155l1.507-2.755a.393.393 0 0 1 .69 0l1.508 2.756c.036.067.09.12.156.156"
                  fill="#D15D64" style="mix-blend-mode:lighten"/>
            <path d="M206.057 452.72l1.36.745a.395.395 0 0 1 0 .692l-1.36.743a.4.4 0 0 0-.156.157l-.743 1.36a.394.394 0 0 1-.692 0l-.743-1.36a.395.395 0 0 0-.157-.157l-1.36-.743a.395.395 0 0 1 0-.692l1.36-.744a.393.393 0 0 0 .157-.155l.743-1.36a.395.395 0 0 1 .692 0l.744 1.36c.037.066.092.12.157.156"
                  fill="#FCD05C" style="mix-blend-mode:lighten"/>
            <path d="M1661.978 527.116l2.755 1.508a.395.395 0 0 1 0 .692l-2.755 1.506a.39.39 0 0 0-.156.157l-1.506 2.754a.393.393 0 0 1-.692 0l-1.506-2.755a.39.39 0 0 0-.16-.158l-2.753-1.506a.394.394 0 0 1 0-.692l2.755-1.508a.39.39 0 0 0 .158-.155l1.506-2.755a.393.393 0 0 1 .69 0l1.508 2.755a.39.39 0 0 0 .157.156M1376.877 100.645l1.3.71c.26.144.26.52 0 .66l-1.3.713a.38.38 0 0 0-.15.148l-.71 1.3a.377.377 0 0 1-.66 0l-.71-1.3a.386.386 0 0 0-.152-.148l-1.3-.712a.377.377 0 0 1 0-.66l1.3-.71a.39.39 0 0 0 .15-.15l.71-1.3a.376.376 0 0 1 .662 0l.71 1.3a.384.384 0 0 0 .15.15"
                  fill="#D15D64" style="mix-blend-mode:lighten"/>
            <path d="M1634.057 382.72l1.36.745a.395.395 0 0 1 0 .692l-1.36.743a.4.4 0 0 0-.156.157l-.743 1.36a.394.394 0 0 1-.692 0l-.743-1.36a.395.395 0 0 0-.157-.157l-1.36-.743a.395.395 0 0 1 0-.692l1.36-.744a.393.393 0 0 0 .157-.155l.743-1.36a.395.395 0 0 1 .692 0l.744 1.36c.037.066.092.12.157.156"
                  fill="#FCD05C" style="mix-blend-mode:lighten"/>
            <path stroke="#E98333" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"
                  d="M411 385.888l3.554-.888-.887 3.554z"/>
            <path fill="#00A959" style="mix-blend-mode:lighten"
                  d="M522.226 503.018l2.018 1.104-2.018 1.103-1.104 2.018-1.104-2.018-2.018-1.103 2.018-1.104 1.104-2.018z"/>
            <path d="M530.98 40.117l2.754 1.507a.394.394 0 0 1 0 .69l-2.755 1.508a.397.397 0 0 0-.158.156l-1.506 2.756a.393.393 0 0 1-.692 0l-1.507-2.756a.402.402 0 0 0-.157-.156l-2.755-1.507a.393.393 0 0 1 0-.69l2.755-1.508a.402.402 0 0 0 .157-.156l1.508-2.755a.394.394 0 0 1 .69 0l1.507 2.756c.037.066.09.12.157.157"
                  fill="#E98333" style="mix-blend-mode:lighten"/>
            <path d="M653.86 202.256l-.847-1.6a.44.44 0 0 0-.18-.18l-1.6-.848a.434.434 0 0 1 0-.768l1.6-.847a.442.442 0 0 0 .18-.18l.847-1.6a.435.435 0 0 1 .77 0l.845 1.6a.44.44 0 0 0 .18.18l1.6.847c.31.163.31.605 0 .768l-1.6.847a.436.436 0 0 0-.18.18l-.846 1.6a.435.435 0 0 1-.77 0z"
                  stroke="#7B63AB" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"/>
            <path d="M593.978 161.117l2.756 1.507a.394.394 0 0 1 0 .69l-2.756 1.507a.4.4 0 0 0-.156.16l-1.507 2.754a.393.393 0 0 1-.69 0l-1.508-2.756a.395.395 0 0 0-.157-.157l-2.755-1.505a.394.394 0 0 1 0-.69l2.755-1.508a.393.393 0 0 0 .157-.156l1.507-2.755a.393.393 0 0 1 .69 0l1.508 2.755c.036.066.09.12.156.156"
                  fill="#D15D64" style="mix-blend-mode:lighten"/>
            <path d="M177.98 127.117l2.754 1.507a.394.394 0 0 1 0 .69l-2.756 1.508a.397.397 0 0 0-.156.156l-1.507 2.756a.393.393 0 0 1-.69 0l-1.507-2.756a.402.402 0 0 0-.16-.156l-2.752-1.507a.393.393 0 0 1 0-.69l2.754-1.508a.402.402 0 0 0 .157-.156l1.508-2.755a.394.394 0 0 1 .69 0l1.507 2.756c.036.066.09.12.156.157"
                  fill="#E98333" style="mix-blend-mode:lighten"/>
            <path d="M299.813 56.907a2.907 2.907 0 1 1-5.815-.003 2.907 2.907 0 0 1 5.815.003" fill="#D15D64"
                  style="mix-blend-mode:lighten"/>
            <path d="M50.86 205.256l-.847-1.6a.44.44 0 0 0-.18-.18l-1.6-.848a.434.434 0 0 1 0-.768l1.6-.847a.442.442 0 0 0 .18-.18l.847-1.6a.435.435 0 0 1 .77 0l.845 1.6a.44.44 0 0 0 .18.18l1.6.847c.31.163.31.605 0 .768l-1.6.847a.436.436 0 0 0-.18.18l-.846 1.6a.435.435 0 0 1-.77 0z"
                  stroke="#7B63AB" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"/>
            <path d="M1690.978 261.116l2.755 1.507a.395.395 0 0 1 0 .692l-2.755 1.507a.39.39 0 0 0-.156.156l-1.506 2.755a.393.393 0 0 1-.692 0l-1.506-2.755a.39.39 0 0 0-.16-.156l-2.753-1.507a.394.394 0 0 1 0-.692l2.755-1.507a.39.39 0 0 0 .158-.155l1.506-2.755a.393.393 0 0 1 .69 0l1.508 2.756a.39.39 0 0 0 .157.156"
                  fill="#D15D64" style="mix-blend-mode:lighten"/>
            <path d="M1637.057 223.722l1.36.743a.395.395 0 0 1 0 .692l-1.36.744a.397.397 0 0 0-.156.157l-.743 1.36a.395.395 0 0 1-.692 0l-.743-1.36a.393.393 0 0 0-.157-.156l-1.36-.743a.395.395 0 0 1 0-.692l1.36-.743a.395.395 0 0 0 .157-.157l.743-1.36a.395.395 0 0 1 .692 0l.744 1.36a.4.4 0 0 0 .157.157"
                  fill="#7B63AB" style="mix-blend-mode:lighten"/>
            <path d="M1611.877 48.645l1.3.71c.26.145.26.52 0 .662l-1.3.71a.38.38 0 0 0-.15.15l-.71 1.3a.377.377 0 0 1-.66 0l-.71-1.3a.386.386 0 0 0-.152-.15l-1.3-.71a.377.377 0 0 1 0-.662l1.3-.71a.39.39 0 0 0 .15-.15l.71-1.298a.376.376 0 0 1 .662 0l.71 1.298a.384.384 0 0 0 .15.15"
                  fill="#D15D64" style="mix-blend-mode:lighten"/>
            <path d="M1663.057 116.72l1.36.745a.395.395 0 0 1 0 .692l-1.36.743a.4.4 0 0 0-.156.157l-.743 1.36a.394.394 0 0 1-.692 0l-.743-1.36a.395.395 0 0 0-.157-.157l-1.36-.743a.395.395 0 0 1 0-.692l1.36-.744a.393.393 0 0 0 .157-.155l.743-1.36a.395.395 0 0 1 .692 0l.744 1.36c.037.066.092.12.157.156"
                  fill="#FCD05C" style="mix-blend-mode:lighten"/>
            <g transform="translate(1580 434)">
                <mask id="b" fill="#fff">
                    <use xlink:href="#a"/>
                </mask>
                <path d="M4.667 1.79l1.36.743a.394.394 0 0 1 0 .692l-1.36.743a.4.4 0 0 0-.157.156l-.743 1.36a.394.394 0 0 1-.692 0l-.744-1.36a.397.397 0 0 0-.155-.156l-1.36-.743a.395.395 0 0 1 0-.692l1.36-.744a.39.39 0 0 0 .156-.157l.745-1.36a.394.394 0 0 1 .692 0l.743 1.36c.036.066.09.12.157.156"
                      fill="#7B63AB" mask="url(#b)"/>
            </g>
            <path d="M1384.978 483.118l2.755 1.507a.394.394 0 0 1 0 .69l-2.755 1.507a.393.393 0 0 0-.157.156l-1.505 2.755a.393.393 0 0 1-.692 0l-1.506-2.755a.387.387 0 0 0-.158-.156l-2.755-1.507a.393.393 0 0 1 0-.69l2.755-1.507a.39.39 0 0 0 .157-.157l1.506-2.755a.393.393 0 0 1 .69 0l1.508 2.756c.038.067.092.122.16.158"
                  fill="#FCD05C" style="mix-blend-mode:lighten"/>
            <path d="M1273.877 338.646l1.3.71c.26.144.26.52 0 .66l-1.3.712a.38.38 0 0 0-.15.15l-.71 1.298a.377.377 0 0 1-.66 0l-.71-1.3a.386.386 0 0 0-.152-.148l-1.3-.712a.377.377 0 0 1 0-.66l1.3-.71a.39.39 0 0 0 .15-.15l.71-1.3a.376.376 0 0 1 .662 0l.71 1.3a.384.384 0 0 0 .15.15"
                  fill="#D15D64" style="mix-blend-mode:lighten"/>
            <path d="M1494.057 406.72l1.36.745a.395.395 0 0 1 0 .692l-1.36.743a.4.4 0 0 0-.156.157l-.743 1.36a.394.394 0 0 1-.692 0l-.743-1.36a.395.395 0 0 0-.157-.157l-1.36-.743a.395.395 0 0 1 0-.692l1.36-.744a.393.393 0 0 0 .157-.155l.743-1.36a.395.395 0 0 1 .692 0l.744 1.36c.037.066.092.12.157.156"
                  fill="#FCD05C" style="mix-blend-mode:lighten"/>
            <path stroke="#00A959" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"
                  d="M1712 450.524l1.762-.542 1.762.542-.543-1.762.544-1.762-1.762.543L1712 447l.542 1.762z"/>
            <g transform="translate(1598 622)">
                <mask id="d" fill="#fff">
                    <use xlink:href="#c"/>
                </mask>
                <path d="M7.648 3.813l2.755 1.507a.394.394 0 0 1 0 .69L7.648 7.52a.39.39 0 0 0-.157.157L5.985 10.43a.394.394 0 0 1-.69 0L3.785 7.675a.39.39 0 0 0-.157-.157L.873 6.01a.394.394 0 0 1 0-.69L3.63 3.813a.39.39 0 0 0 .156-.157L5.293.9a.394.394 0 0 1 .69 0l1.508 2.756a.39.39 0 0 0 .158.157"
                      fill="#D15D64" mask="url(#d)"/>
            </g>
            <g stroke="#E98333" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round">
                <path d="M70.472 513L69 514.47M74.47 509L73 510.47M70.543 513.163a1.852 1.852 0 0 0 2.62-2.62 1.852 1.852 0 0 0-2.62 2.62z"/>
            </g>
            <path d="M239.057 1200.9l1.36-.743a.395.395 0 0 0 0-.692l-1.36-.743a.4.4 0 0 1-.156-.157l-.743-1.36a.394.394 0 0 0-.692 0l-.743 1.36a.395.395 0 0 1-.157.157l-1.36.743a.395.395 0 0 0 0 .692l1.36.744c.066.037.12.09.157.157l.743 1.36c.15.273.542.273.692 0l.744-1.36a.397.397 0 0 1 .157-.156"
                  fill="#FCD05C" style="mix-blend-mode:lighten"/>
            <path d="M1206.813 1132.906a2.907 2.907 0 1 0-5.815.003 2.907 2.907 0 0 0 5.815-.004M114.978 1035.822l2.756-1.506a.394.394 0 0 0 0-.692l-2.756-1.507a.4.4 0 0 1-.156-.157l-1.507-2.755a.393.393 0 0 0-.69 0l-1.508 2.755a.395.395 0 0 1-.157.157l-2.755 1.507a.394.394 0 0 0 0 .69l2.755 1.508c.066.036.12.09.157.157l1.507 2.753c.15.274.542.274.69 0l1.508-2.755a.397.397 0 0 1 .156-.156"
                  fill="#D15D64" style="mix-blend-mode:lighten"/>
            <path d="M206.057 793.9l1.36-.744a.395.395 0 0 0 0-.692l-1.36-.743a.4.4 0 0 1-.156-.156l-.743-1.36a.394.394 0 0 0-.692 0l-.743 1.36a.395.395 0 0 1-.157.158l-1.36.742a.395.395 0 0 0 0 .692l1.36.745c.066.037.12.09.157.156l.743 1.36c.15.273.542.273.692 0l.744-1.36a.397.397 0 0 1 .157-.156"
                  fill="#FCD05C" style="mix-blend-mode:lighten"/>
            <path d="M1455.978 1061.822l2.755-1.506a.395.395 0 0 0 0-.693l-2.755-1.507a.39.39 0 0 1-.156-.156l-1.506-2.755a.393.393 0 0 0-.692 0l-1.506 2.755a.39.39 0 0 1-.16.156l-2.753 1.507a.394.394 0 0 0 0 .692l2.755 1.507a.39.39 0 0 1 .158.157l1.506 2.753c.15.274.543.274.69 0l1.508-2.755a.39.39 0 0 1 .157-.156"
                  fill="#D15D64" style="mix-blend-mode:lighten"/>
            <path d="M1402.057 1085.9l1.36-.743a.395.395 0 0 0 0-.692l-1.36-.744a.397.397 0 0 1-.156-.155l-.743-1.36a.395.395 0 0 0-.692 0l-.743 1.36a.393.393 0 0 1-.157.156l-1.36.745a.395.395 0 0 0 0 .692l1.36.743c.066.036.12.09.157.157l.743 1.36c.15.273.542.273.692 0l.744-1.36a.4.4 0 0 1 .157-.157"
                  fill="#7B63AB" style="mix-blend-mode:lighten"/>
            <path stroke="#E98333" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"
                  d="M411 894.666l3.554.888-.887-3.554z"/>
            <path fill="#00A959" style="mix-blend-mode:lighten"
                  d="M522.226 745.225l2.018-1.104-2.018-1.102-1.104-2.018-1.104 2.018L518 744.12l2.018 1.105 1.104 2.018z"/>
            <path d="M177.98 1225.822l2.754-1.506a.394.394 0 0 0 0-.692l-2.756-1.507a.397.397 0 0 1-.156-.156l-1.507-2.755a.393.393 0 0 0-.69 0l-1.507 2.756a.402.402 0 0 1-.16.157l-2.752 1.507a.393.393 0 0 0 0 .69l2.754 1.508c.066.036.12.09.157.157l1.508 2.754c.15.274.54.274.69 0l1.507-2.755a.397.397 0 0 1 .156-.158"
                  fill="#E98333" style="mix-blend-mode:lighten"/>
            <path d="M299.813 1325.906a2.907 2.907 0 1 0-5.815.003 2.907 2.907 0 0 0 5.815-.004" fill="#D15D64"
                  style="mix-blend-mode:lighten"/>
            <path d="M50.86 1174.232l-.847 1.6a.44.44 0 0 1-.18.18l-1.6.848a.434.434 0 0 0 0 .768l1.6.847c.076.04.14.104.18.18l.847 1.6c.163.31.605.31.77 0l.845-1.6a.44.44 0 0 1 .18-.18l1.6-.847a.434.434 0 0 0 0-.768l-1.6-.847a.436.436 0 0 1-.18-.18l-.846-1.6a.435.435 0 0 0-.77 0z"
                  stroke="#7B63AB" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"/>
            <path d="M1690.978 1110.822l2.755-1.506a.395.395 0 0 0 0-.693l-2.755-1.507a.39.39 0 0 1-.156-.156l-1.506-2.755a.393.393 0 0 0-.692 0l-1.506 2.755a.39.39 0 0 1-.16.156l-2.753 1.507a.394.394 0 0 0 0 .692l2.755 1.507a.39.39 0 0 1 .158.157l1.506 2.753c.15.274.543.274.69 0l1.508-2.755a.39.39 0 0 1 .157-.156"
                  fill="#D15D64" style="mix-blend-mode:lighten"/>
            <path d="M1637.057 1155.9l1.36-.743a.395.395 0 0 0 0-.692l-1.36-.744a.397.397 0 0 1-.156-.155l-.743-1.36a.395.395 0 0 0-.692 0l-.743 1.36a.393.393 0 0 1-.157.156l-1.36.745a.395.395 0 0 0 0 .692l1.36.743c.066.036.12.09.157.157l.743 1.36c.15.273.542.273.692 0l.744-1.36a.4.4 0 0 1 .157-.157"
                  fill="#7B63AB" style="mix-blend-mode:lighten"/>
            <path d="M1611.877 1349.727l1.3-.71a.377.377 0 0 0 0-.66l-1.3-.712a.38.38 0 0 1-.15-.15l-.71-1.3a.377.377 0 0 0-.66 0l-.71 1.3a.386.386 0 0 1-.152.15l-1.3.71a.377.377 0 0 0 0 .662l1.3.71a.39.39 0 0 1 .15.15l.71 1.3a.376.376 0 0 0 .662 0l.71-1.3a.384.384 0 0 1 .15-.15"
                  fill="#D15D64" style="mix-blend-mode:lighten"/>
            <path d="M1663.057 1249.9l1.36-.743a.395.395 0 0 0 0-.692l-1.36-.743a.4.4 0 0 1-.156-.157l-.743-1.36a.394.394 0 0 0-.692 0l-.743 1.36a.395.395 0 0 1-.157.157l-1.36.743a.395.395 0 0 0 0 .692l1.36.744c.066.037.12.09.157.157l.743 1.36c.15.273.542.273.692 0l.744-1.36a.397.397 0 0 1 .157-.156"
                  fill="#FCD05C" style="mix-blend-mode:lighten"/>
            <g transform="matrix(1 0 0 -1 1587 986)">
                <mask id="f" fill="#fff">
                    <use xlink:href="#e"/>
                </mask>
                <path d="M4.667 1.79l1.36.743a.394.394 0 0 1 0 .692l-1.36.743a.4.4 0 0 0-.157.156l-.743 1.36a.394.394 0 0 1-.692 0l-.744-1.36a.397.397 0 0 0-.155-.156l-1.36-.743a.395.395 0 0 1 0-.692l1.36-.744a.39.39 0 0 0 .156-.157l.745-1.36a.394.394 0 0 1 .692 0l.743 1.36c.036.066.09.12.157.156"
                      fill="#7B63AB" mask="url(#f)"/>
            </g>
            <g stroke="#7B63AB" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round">
                <path d="M1164 915l2.78-2.78M1156 923l2.78-2.78M1161.607 912.906c0-.997-5.483 4.486-4.486 4.486-.996 0 4.487 5.484 4.487 4.487 0 .996 5.483-4.488 4.486-4.488.997 0-4.486-5.483-4.486-4.486z"/>
            </g>
            <path d="M1384.978 770.822l2.755-1.507a.394.394 0 0 0 0-.692l-2.755-1.506a.393.393 0 0 1-.157-.156l-1.505-2.755a.393.393 0 0 0-.692 0l-1.506 2.755a.387.387 0 0 1-.158.157l-2.755 1.507a.393.393 0 0 0 0 .69l2.755 1.508a.39.39 0 0 1 .157.157l1.506 2.754c.15.274.543.274.69 0l1.508-2.755a.395.395 0 0 1 .16-.158"
                  fill="#FCD05C" style="mix-blend-mode:lighten"/>
            <path d="M1273.877 962.727l1.3-.71a.377.377 0 0 0 0-.66l-1.3-.712a.38.38 0 0 1-.15-.15l-.71-1.3a.377.377 0 0 0-.66 0l-.71 1.3a.386.386 0 0 1-.152.15l-1.3.71a.377.377 0 0 0 0 .662l1.3.71a.39.39 0 0 1 .15.15l.71 1.3a.376.376 0 0 0 .662 0l.71-1.3a.384.384 0 0 1 .15-.15"
                  fill="#D15D64" style="mix-blend-mode:lighten"/>
            <path d="M1494.057 873.9l1.36-.744a.395.395 0 0 0 0-.692l-1.36-.743a.4.4 0 0 1-.156-.156l-.743-1.36a.394.394 0 0 0-.692 0l-.743 1.36a.395.395 0 0 1-.157.158l-1.36.742a.395.395 0 0 0 0 .692l1.36.745c.066.037.12.09.157.156l.743 1.36c.15.273.542.273.692 0l.744-1.36a.397.397 0 0 1 .157-.156"
                  fill="#FCD05C" style="mix-blend-mode:lighten"/>
            <path stroke="#00A959" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"
                  d="M1712 812l1.762.542 1.762-.542-.543 1.762.544 1.762-1.762-.543-1.762.544.542-1.762z"/>
            <g stroke="#E98333" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round">
                <path d="M70.472 721L69 719.53M74.47 725L73 723.53M70.543 720.837a1.852 1.852 0 0 1 2.62 2.62 1.852 1.852 0 0 1-2.62-2.62z"/>
            </g>
            <g opacity=".5">
                <path d="M373.247 442.788c4.296 3.612 4.85 10.023 1.237 14.32a10.16 10.16 0 0 1-10.065 3.36c-1.154 1.653-1.81 3.362-1.5 4.926.158.796-.377.72-.654.36-1.387-1.802-2.994-4.632-2.882-8.138-3.57-3.698-3.838-9.57-.457-13.59 3.613-4.297 10.024-4.85 14.32-1.238"
                      fill="#DBE7F0"/>
                <path d="M370.31 449.378h-1.215l.012-.59c0-.78-.703-3.015-1.803-3.015-.35 0-.703.18-.937.46a1.02 1.02 0 0 0-.252.85c.15.89.168 1.37-.38 1.97-.6.655-.89.93-1.436.93h-1.203c-.637-.004-1.2.56-1.2 1.198v2.404c0 .638.563 1.202 1.2 1.202h1.034l.867.517a.62.62 0 0 0 .312.084h3.803c.68 0 1.707-.3 1.802-1.13l.59-3.575c.012-.048.012-.084.012-.12-.02-.704-.505-1.184-1.202-1.184h-.006zm0 4.808c-.03.414-.765.6-1.203.6h-3.804l-1.004-.6v-3.607c.817 0 1.268-.45 1.88-1.13.74-.817.686-1.54.53-2.482-.048-.3.3-.6.6-.6.5 0 1.202 1.64 1.202 2.403l-.012.62c0 .415.2.583.613.583h1.202c.38 0 .59.217.6.6l-.6 3.607-.006.006z"
                      fill="#27363A"/>
                <path d="M400.562 483.592c0-4.514-1.568-8.66-4.186-11.93-2.117-2.222-4.432-.835-5.07 9.53-.766 12.432-7.31 4.13-12.526 9.985-5.203 5.844-17.318-4.782-14.19 1.43 3.22 6.01 9.56 10.1 16.857 10.1 10.556 0 19.115-8.558 19.115-19.115"
                      fill="#4D595D"/>
                <path d="M381.446 464.478c10.557 0 19.115 8.558 19.115 19.114 0 10.557-8.557 19.115-19.114 19.115s-19.114-8.558-19.114-19.115c0-10.556 8.557-19.114 19.114-19.114z"
                      stroke="#DBE7F0" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"/>
                <path d="M381.446 464.478c10.557 0 19.115 8.558 19.115 19.114 0 10.557-8.557 19.115-19.114 19.115s-19.114-8.558-19.114-19.115c0-10.556 8.557-19.114 19.114-19.114z"
                      stroke="#DBE7F0" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"/>
                <path d="M363.84 476.14c3.66 1.605 8.12 3.147 11.752 3.147 7.577 0 9.3-4.65 18.253-4.822 1.615-.03 3.07-.05 4.366-.06M374.033 501.216c1.376-3.52 4.187-8.467 9.652-11.252 6.53-3.326 11.208-.57 16.055-.814"
                      stroke="#DBE7F0" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"/>
                <path d="M365.356 493.916c2.948-.404 7.794-1.682 11.786-5.674 6.2-6.2 7.92-6.37 11.71-6.37 3.103 0 7.71 3.234 11.64 3.363M373.727 466.1c3.98.616 8.786 1.863 11.853 4.404 2.395 1.985 6.528 1.848 10.644.963M369.765 468.462c1.467.318 2.818.663 3.696.947 2.897.936 5.453 1.277 4.715 3.333-.938 2.61-5.274 1.137-8.17.2-.95-.306-2.138-.87-3.3-1.518M362.458 481.395c3.822.546 9.144 1.832 9.69 4.78.376 2.04-3.85 3.184-8.714 3.828M376.508 502.063c3.32-3.523 11.45-10.65 21.097-8.256h.002"
                      stroke="#DBE7F0" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"/>
            </g>
            <g opacity=".5">
                <path d="M1532.112 302.432c-40.54-52.804-43.992 39.154-122.523 23.703 22.006 27.912 56.123 45.83 94.426 45.83 66.372 0 120.18-53.805 120.18-120.178 0-39.354-18.916-74.285-48.15-96.208l-5.04 2.005c22.04 27.215-19.393 170.245-38.894 144.847"
                      fill="#4D595D"/>
                <path d="M1383.837 249.923c.11-7.848.99-15.757 2.696-23.617M1428.895 345.34a118.99 118.99 0 0 1-8.532-7.51M1543.853 364.704a120.262 120.262 0 0 1-30.652 6.533M1617.31 212.7c1.547 4.5 2.826 9.096 3.83 13.762M1582.858 161.307a118.96 118.96 0 0 1 10.203 10.076M1483.746 133.316a119.536 119.536 0 0 1 23.026-1.673"
                      stroke="#DBE7F0" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"/>
                <path d="M1429.216 347.407c4.525 3.988 9.963 7.712 16.628 10.84.277.13.504.33.674.587.734 1.124 3.406 3.995 4.255 4.897.175.188.384.323.624.41l8.84 3.218c.254.095.482.25.662.454l5.732 6.455c.38.424.95.62 1.507.523l6.055-1.065a1.57 1.57 0 0 1 .648.017l4.28.978c.22.05.45.055.672.012l4.958-.94c.213-.04.43-.038.64.005l9.515 1.985c.344.072.703.03 1.023-.12l5.018-2.32c.216-.098.452-.152.69-.152l7.943.008c.31 0 .608-.086.87-.248l5.004-3.12c1.056-.66.556-2.29-.69-2.242l-3.87.148c-.265.01-.53-.043-.767-.158l-9.46-4.507a1.64 1.64 0 0 0-1.094-.11l-5.363 1.316c-.375.09-.77.05-1.117-.123l-15.316-7.585a1.682 1.682 0 0 0-.484-.15l-12.27-1.845a1.614 1.614 0 0 1-.737-.305l-9.95-7.432a1.63 1.63 0 0 0-1.018-.326l-11.674.275a1.706 1.706 0 0 1-.37-.033l-10.64-2.186c-1.644-.338-2.68 1.73-1.418 2.84"
                      fill="#27363A"/>
                <path d="M1429.216 347.407c4.525 3.988 9.963 7.712 16.628 10.84.277.13.504.33.674.587.734 1.124 3.406 3.995 4.255 4.897.175.188.384.323.624.41l8.84 3.218c.254.095.482.25.662.454l5.732 6.455c.38.424.95.62 1.507.523l6.055-1.065a1.57 1.57 0 0 1 .648.017l4.28.978c.22.05.45.055.672.012l4.958-.94c.213-.04.43-.038.64.005l9.515 1.985c.344.072.703.03 1.023-.12l5.018-2.32c.216-.098.452-.152.69-.152l7.943.008c.31 0 .608-.086.87-.248l5.004-3.12c1.056-.66.556-2.29-.69-2.242l-3.87.148c-.265.01-.53-.043-.767-.158l-9.46-4.507a1.64 1.64 0 0 0-1.094-.11l-5.363 1.316c-.375.09-.77.05-1.117-.123l-15.316-7.585a1.682 1.682 0 0 0-.484-.15l-12.27-1.845a1.614 1.614 0 0 1-.737-.305l-9.95-7.432a1.63 1.63 0 0 0-1.018-.326l-11.674.275a1.706 1.706 0 0 1-.37-.033l-10.64-2.186c-1.644-.338-2.68 1.73-1.418 2.84z"
                      stroke="#DBE7F0" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"/>
                <path d="M1595.746 171.66c8.49 9.6 19.728 26.172 22.898 39.2a1.624 1.624 0 0 1-.414 1.513c-3.71 3.898-21.428 20.263-23.31 22-.118.11-.234.185-.378.254l-10.532 5.145c-.125.062-.26.11-.397.134l-5.52 1.105a1.63 1.63 0 0 0-1.02.67l-6.537 9.33c-.48.688-1.404.902-2.137.494l-24.443-13.58a1.64 1.64 0 0 1-.823-1.182l-3.094-20.038a1.64 1.64 0 0 1 .818-1.682l15.878-8.86c.394-.222.68-.595.787-1.034l6.738-27.035a1.632 1.632 0 0 1 1.27-1.21l28.674-5.73a1.617 1.617 0 0 1 1.542.508"
                      fill="#27363A"/>
                <path d="M1595.746 171.66c8.49 9.6 19.728 26.172 22.898 39.2a1.624 1.624 0 0 1-.414 1.513c-3.71 3.898-21.428 20.263-23.31 22-.118.11-.234.185-.378.254l-10.532 5.145c-.125.062-.26.11-.397.134l-5.52 1.105a1.63 1.63 0 0 0-1.02.67l-6.537 9.33c-.48.688-1.404.902-2.137.494l-24.443-13.58a1.64 1.64 0 0 1-.823-1.182l-3.094-20.038a1.64 1.64 0 0 1 .818-1.682l15.878-8.86c.394-.222.68-.595.787-1.034l6.738-27.035a1.632 1.632 0 0 1 1.27-1.21l28.674-5.73a1.617 1.617 0 0 1 1.542.508z"
                      stroke="#DBE7F0" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"/>
                <path d="M1383.83 277.438a115.53 115.53 0 0 1-2.57-26.214c.02-1.37 1.65-2.09 2.7-1.21l7.906 6.636c.343.29.792.423 1.237.373l12.898-1.46c.368-.04.74.045 1.053.24l15.875 9.933c.166.105.353.18.546.22l16.18 3.235c.376.077.764.018 1.1-.163l13.964-7.536a1.636 1.636 0 0 1 2 .352l10.16 11.405c.244.27.388.616.414.98l1.868 27.814c.033.502-.162.99-.535 1.326l-13.413 12.154a1.65 1.65 0 0 0-.477.773l-3.872 13.864a1.638 1.638 0 0 1-1.34 1.18l-16.906 2.457a1.652 1.652 0 0 1-.47 0l-7.174-1.048a1.624 1.624 0 0 0-1.64.778c-.546.912-1.39 2.33-2.084 3.5a1.648 1.648 0 0 1-2.515.38c-7.462-6.728-13.777-14.133-18.978-22.02h21.636c7.013 0-3.504-3.665-10.993-3.187-.992.063-2.01.127-3.04.188-.25-2.444-2.85-6.547-8.617-6.613a17.45 17.45 0 0 0 1.14-1.862c11.31-18.812-3.523-28.586-16.053-26.472z"
                      fill="#27363A"/>
                <path d="M1399.757 315.384c5.2 7.887 11.516 15.29 18.978 22.02a1.648 1.648 0 0 0 2.514-.38c.694-1.17 1.537-2.588 2.082-3.5a1.624 1.624 0 0 1 1.64-.778l7.174 1.048c.155.023.315.023.47 0l16.906-2.458a1.638 1.638 0 0 0 1.34-1.18l3.873-13.863a1.65 1.65 0 0 1 .477-.773l13.413-12.154c.373-.336.568-.824.535-1.325l-1.868-27.812a1.637 1.637 0 0 0-.414-.98l-10.16-11.406a1.636 1.636 0 0 0-2-.35l-13.964 7.535c-.336.18-.724.24-1.1.164l-16.18-3.234a1.685 1.685 0 0 1-.546-.22l-15.875-9.933a1.663 1.663 0 0 0-1.052-.24l-12.897 1.46a1.64 1.64 0 0 1-1.237-.373l-7.907-6.636c-1.05-.88-2.68-.16-2.7 1.21a115.53 115.53 0 0 0 2.574 26.233M1481.845 131.863c-40.293 6.95-84.5 37.83-96.602 92.68-.256 1.166.798 2.212 1.965 1.96 1.21-.263 2.594-.59 3.488-.808a1.627 1.627 0 0 1 1.6.496l9.014 10.01c.39.435.984.627 1.556.506l23.454-4.997c.398-.087.75-.317.99-.647l14.668-20.428a1.64 1.64 0 0 0-.11-2.048l-7.536-8.405a1.633 1.633 0 0 1-.39-1.39l2.432-13.225c.097-.527.445-.974.933-1.195l14.23-6.466a1.638 1.638 0 0 1 2.312 1.38l.743 11.123c.03.41.21.794.51 1.08l19.442 18.422c.413.387.997.537 1.545.393l16.548-4.365c.162-.043.326-.06.492-.052 2.147.1 17.425.794 17.647.257.217-.525 1.7-15.952 1.962-18.685a1.58 1.58 0 0 1 .282-.763l9.51-13.675a1.64 1.64 0 0 0-.087-1.985l-16.126-19.296a1.63 1.63 0 0 0-.663-.474l-19.852-7.74a1.626 1.626 0 0 1-1.027-1.303c-.255-1.916-.816-6.277-1.026-8.87a1.64 1.64 0 0 0-1.907-1.49z"
                      stroke="#DBE7F0" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"/>
                <path d="M1620.344 227.284l-4.855 11.086c-.196.443-.57.775-1.035.914l-12.18 3.624c-.28.084-.533.242-.734.457l-10.937 11.832c-.326.354-.48.836-.42 1.314l2.075 16.555c.057.464-.084.93-.392 1.28l-9.227 10.573a1.63 1.63 0 0 1-1.277.56l-16.347-.43a1.64 1.64 0 0 0-1.68 1.547l-1.076 19.236c-.01.198-.057.393-.14.573l-7.605 17.106a1.65 1.65 0 0 0-.02 1.28l5.99 14.818c.184.463.15.986-.095 1.42l-8.3 14.683c-.08.143-.17.264-.29.374-.85.806-4.726 4.514-7.488 7.372-1.142 1.183-.02 3.11 1.58 2.723 26.152-6.267 91.19-51.263 77.582-138.47-.255-1.625-2.47-1.93-3.13-.426"
                      fill="#27363A"/>
                <path d="M1620.344 227.284l-4.855 11.086c-.196.443-.57.775-1.035.914l-12.18 3.624c-.28.084-.533.242-.734.457l-10.937 11.832c-.326.354-.48.836-.42 1.314l2.075 16.555c.057.464-.084.93-.392 1.28l-9.227 10.573a1.63 1.63 0 0 1-1.277.56l-16.347-.43a1.64 1.64 0 0 0-1.68 1.547l-1.076 19.236c-.01.198-.057.393-.14.573l-7.605 17.106a1.65 1.65 0 0 0-.02 1.28l5.99 14.818c.184.463.15.986-.095 1.42l-8.3 14.683c-.08.143-.17.264-.29.374-.85.806-4.726 4.514-7.488 7.372-1.142 1.183-.02 3.11 1.58 2.723 26.152-6.267 91.19-51.263 77.582-138.47-.255-1.625-2.47-1.93-3.13-.426zM1508.277 129.87l14.245-.803c.394-.023.783.098 1.093.34l2.198 1.702c.392.303.9.413 1.384.296l8.717-2.083c.43-.102.88-.027 1.255.207l3.643 2.303c.344.22.76.3 1.16.23l5.543-.978c.306-.056.62-.02.906.096l1.95.803c.364.15.663.426.837.777l1.834 3.646c.232.46.667.783 1.175.873l3.756.672c.394.07.746.28.995.593l2.818 3.55c.105.132.23.247.37.34l6.405 4.297c.21.142.38.32.505.54.438.77 1.533 2.663 1.796 2.89.287.25 9.896 8.11 12.564 10.293.28.23.176.683-.177.765-.88.21-2.217.514-2.886.607a1.202 1.202 0 0 1-.687-.107l-8.67-4.134c-.108-.05-.22-.092-.336-.12l-9.538-2.203a1.6 1.6 0 0 0-.585-.03l-9.56 1.272a1.64 1.64 0 0 1-1.14-.272l-14.58-9.99a1.626 1.626 0 0 0-.516-.234l-16.947-4.396a1.64 1.64 0 0 1-.88-.576l-4.424-5.66a1.64 1.64 0 0 0-.614-.483l-4.194-1.9c-1.558-.71-1.124-3.03.585-3.126z"
                      stroke="#DBE7F0" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"/>
                <path d="M1350.275 152.803c10.917-3.648 22.724 2.246 26.372 13.163 2.566 7.677.408 15.79-4.894 21.203 1.654 3.784 3.945 6.757 7.013 7.89 1.56.577.85 1.43-.074 1.53-4.635.5-11.303.28-17.32-3.67-10.285 2.287-20.845-3.53-24.26-13.744-3.645-10.918 2.248-22.725 13.163-26.373"
                      fill="#DBE7F0"/>
                <path d="M1363.83 167.265c-.683-.828-1.644-1.25-2.89-1.314-1.277 0-2.222.552-2.893 1.315-.217.246-.4.458-.55.638a.652.652 0 0 1-1 0c-.15-.18-.334-.392-.553-.638-.685-.763-1.538-1.314-2.892-1.314-1.248.066-2.222.5-2.89 1.315-.686.802-1.026 1.684-1.055 2.63 0 .682.12 1.996.882 3.51.733 1.456 2.91 3.695 6.587 6.668.24.195.595.195.837 0 3.666-2.973 5.877-5.2 6.6-6.668.75-1.526.868-2.853.868-3.51-.027-.946-.37-1.828-1.052-2.656v.025z"
                      fill="#27363A"/>
                <path d="M1616.754 204.907h69.555c11.152 0 6.372-4.142-7.652-2.866-.7.062-1.39.11-2.077.153-1.574-1.702-5.468-3.782-9.27-2.613-.64-4.567-8.22-10.058-15.36-5.288-.52-7.097-7.663-13.905-15.19-7.848 2.247-11.497-.782-24.157-18.335-22.648-10.806.93-15.68 6.52-17.204 13.25M1410.4 312.197c-.992.063-2.01.127-3.04.188-.25-2.444-2.85-6.547-8.617-6.613a17.45 17.45 0 0 0 1.14-1.862c16.572-27.565-22.99-35.727-29.182-15.508-1.31 4.28-1.848 8.465-1.838 12.162-1.975-1.26-4.667-2.07-8.338-2.07-10 0-13.275 8.763-12.264 12.954-1.802-1.124-3.82-2.215-8.293-1.8-8.604.797-17.208 5.737-4.142 5.737h85.568c7.013 0-3.504-3.666-10.993-3.188z"
                      stroke="#DBE7F0" stroke-width="1.097" stroke-linecap="round" stroke-linejoin="round"/>
            </g>
        </g>
    </svg>
</div>
<div class="b3-snackbar" id="message">
    <div class="b3-snackbar__content"></div>
</div>
<script>
    const loadLockScreenWallpaper = () => {
        const wallpaper = document.getElementById("lockScreenWallpaper");
        const cover = document.getElementById("lockScreenCover");
        const clock = document.getElementById("lockScreenClock");
        const panel = document.getElementById("authPanel") || document.querySelector("main");
        let pending = true;
        let interacted = false;
        let covered = false;
        let composing = false;
        let clockShown = false;
        let resumeTarget;
        let clockTimer;
        const focusInput = () => {
            const candidates = [resumeTarget, document.getElementById("authCode"),
                ...panel.querySelectorAll("button:not(:disabled), a[href]")];
            const target = candidates.find(item => item && !item.disabled && item.getClientRects().length);
            target?.focus({preventScroll: true});
            return target;
        };
        const stopClock = () => {
            clearInterval(clockTimer);
            clockTimer = undefined;
        };
        const positionClock = () => {
            const height = clock.offsetHeight * .65;
            const top = panel.offsetTop - 16 - height;
            clockShown = top >= 40;
            cover.style.setProperty("--auth-clock-open-y", `${clockShown ? top + height / 2 - window.innerHeight / 2 : -24}px`);
            cover.style.setProperty("--auth-clock-open-opacity", clockShown ? "1" : "0");
        };
        const updateClock = () => {
            const now = new Date();
            const time = document.getElementById("lockScreenTime");
            time.textContent = now.toLocaleTimeString(undefined, {hour: "2-digit", minute: "2-digit"});
            time.dateTime = now.toISOString();
            document.getElementById("lockScreenDate").textContent = now.toLocaleDateString(undefined,
                {weekday: "long", month: "long", day: "numeric"});
            positionClock();
        };
        const refreshClock = () => {
            stopClock();
            if (!wallpaper.hidden && !document.hidden) {
                updateClock();
                if (covered || clockShown) clockTimer = setInterval(updateClock, 1000);
            }
        };
        const setCovered = show => {
            covered = show;
            cover.inert = !show;
            cover.setAttribute("aria-hidden", String(!show));
            panel.inert = show;
            document.body.classList[show ? "add" : "remove"]("wallpaper-cover");
            refreshClock();
        };
        const reveal = () => {
            interacted = true;
            if (!covered) return pending ? focusInput() : undefined;
            document.body.classList.add("wallpaper-transition");
            setCovered(false);
            return focusInput();
        };
        const conceal = () => {
            if (wallpaper.hidden || covered) return false;
            const active = document.activeElement;
            resumeTarget = panel.contains(active) ? active : undefined;
            document.body.classList.add("wallpaper-transition");
            setCovered(true);
            cover.focus({preventScroll: true});
            return true;
        };
        cover.addEventListener("click", reveal);
        document.addEventListener("pointerdown", event => {
            if (event.target.closest("#windowBar, [data-auth-drag]")) return;
            if (covered) event.preventDefault();
            reveal();
        }, true);
        document.addEventListener("keydown", event => {
            if (event.key === "Escape") {
                if (event.isComposing || composing || event.keyCode === 229 || event.ctrlKey || event.metaKey || event.altKey) return;
                if (conceal()) {
                    event.preventDefault();
                    event.stopImmediatePropagation();
                }
                return;
            }
            if ((event.ctrlKey || event.metaKey) && !event.altKey && event.key.toLowerCase() === "v") {
                reveal();
                return;
            }
            const altGraph = event.getModifierState?.("AltGraph");
            if ((event.ctrlKey || event.metaKey || event.altKey) && !altGraph) return;
            const wasCovered = covered;
            const target = reveal();
            if (!wasCovered || event.isComposing || event.key === "Process" || event.key === "Dead") return;
            // 唤起按键不触发登录;可直接输入的首字符只写入当前输入框一次。
            if ((target?.type === "password" || target?.type === "text") && Array.from(event.key).length === 1 && event.key !== " ") {
                target.setRangeText(event.key, target.selectionStart, target.selectionEnd, "end");
                target.dispatchEvent(new Event("input", {bubbles: true}));
            }
            event.preventDefault();
            event.stopImmediatePropagation();
        }, true);
        document.addEventListener("compositionstart", () => { composing = true; reveal(); }, true);
        document.addEventListener("compositionend", () => { composing = false; }, true);
        document.addEventListener("visibilitychange", refreshClock);
        window.addEventListener("resize", refreshClock);
        window.addEventListener("pagehide", stopClock);
        window.addEventListener("pageshow", refreshClock);
        wallpaper.onload = () => {
            pending = false;
            wallpaper.hidden = false;
            cover.hidden = false;
            document.body.classList.add("has-wallpaper");
            const background = document.getElementById("authDefaultBackground");
            if (background) background.hidden = true;
            // 慢加载不打断已经开始的输入,也不遮住密码管理器填入的内容。
            setCovered(!interacted && !document.getElementById("authCode")?.value);
            if (covered) cover.focus({preventScroll: true});
            else if (!interacted) focusInput();
        };
        wallpaper.onerror = () => {
            pending = false;
            const shouldFocus = !interacted || covered;
            wallpaper.hidden = true;
            cover.hidden = true;
            setCovered(false);
            document.body.classList.remove("has-wallpaper", "wallpaper-transition");
            const background = document.getElementById("authDefaultBackground");
            if (background) background.hidden = false;
            if (shouldFocus) focusInput();
        };
        wallpaper.src = "/api/system/getLockScreenWallpaper";
        return {focus: () => {
            if (pending) return;
            refreshClock();
            if (covered) cover.focus({preventScroll: true});
            else focusInput();
        }};
    };
    const lockScreenWallpaperState = loadLockScreenWallpaper();

    window.showKeyboardToolbar = function () {}
    window.hideKeyboardToolbar = function () {}

    const exitApp = () => {
        try {
            const {ipcRenderer} = require('electron')
            ipcRenderer.send('siyuan-quit', window.location.port)
        } catch (e) {
            if (window.JSAndroid) {
                window.JSAndroid.exit();
                return;
            }

            if (window.webkit && window.webkit.messageHandlers) {
                window.webkit.messageHandlers.exit.postMessage("");
                return;
            }

            if (window.JSHarmony) {
                window.JSHarmony.exit();
                return;
            }

            window.location.reload()
        }
    }

    const url = new URL(window.location)
    // 仅允许跳转到同源地址,避免 javascript: 等伪协议在授权页执行
    // https://github.com/siyuan-note/siyuan/security/advisories/GHSA-fmj3-xc2f-6w4w
    const safeRedirectTarget = (target) => {
        try {
            const resolved = new URL(target, window.location.origin);
            if (resolved.origin !== window.location.origin) {
                return "/";
            }
            return resolved.pathname + resolved.search + resolved.hash;
        } catch (e) {
            return "/";
        }
    };
    toPath = safeRedirectTarget(url.searchParams.get("to") || "/");

    const exitSiYuan = () => {
        if (toPath.indexOf("/stage/build/app/window.html") > -1) {
            const {ipcRenderer} = require('electron');
            ipcRenderer.send("siyuan-cmd", "destroy");
            return;
        }

        document.querySelector('#message').classList.add('b3-snackbar--show')
        document.querySelector('#message').firstElementChild.innerHTML = "{{.l8}}"
        try {
            fetch('/api/system/exit', {
                method: 'POST',
                body: JSON.stringify({force: false}),
            }).then((response) => {
                return response.json()
            }).then((response) => {
                if (response.code === 1) {
                    document.querySelector('#message').firstElementChild.innerHTML = response.msg
                    const buttonElement = document.querySelector(`#message button`)
                    if (buttonElement) {
                        buttonElement.addEventListener('click', () => {
                            fetch('/api/system/exit', {
                                method: 'POST',
                                body: JSON.stringify({force: true}),
                            }).then((response) => {
                                return response.json()
                            }).then(() => {
                                exitApp()
                            })
                        })
                    }
                } else {
                    exitApp()
                }
            }).catch(() => {
                exitApp()
            })
        } catch (e) {
            exitApp()
        }
    }

    const showMessage = (msg) => {
        document.querySelector('#message').classList.add('b3-snackbar--show')
        document.querySelector('#message').firstElementChild.innerHTML = msg
        setTimeout(() => {
            document.querySelector('#message').classList.remove('b3-snackbar--show')
            document.querySelector('#message').firstElementChild.textContent = ''
        }, 6000)
    }

    const showOIDCError = (message) => {
        const messageElement = document.querySelector('#message')
        messageElement.classList.add('b3-snackbar--show')
        messageElement.firstElementChild.textContent = String(message || '{{.l13}}')
        setTimeout(() => {
            messageElement.classList.remove('b3-snackbar--show')
            messageElement.firstElementChild.textContent = ''
        }, 6000)
    }
    window.handleOIDCAuthError = showOIDCError

    let oidcPollTimer
    const pollOIDC = (pollToken) => {
        clearInterval(oidcPollTimer)
        oidcPollTimer = setInterval(() => {
            fetch('/api/system/oidc/poll', {
                method: 'POST',
                body: JSON.stringify({pollToken}),
            }).then((response) => response.json()).then((response) => {
                if (response.code !== 0) {
                    clearInterval(oidcPollTimer)
                    showOIDCError(response.msg)
                    return
                }
                if (response.data.status === 'completed') {
                    clearInterval(oidcPollTimer)
                    window.location.href = response.data.to || toPath
                }
            }).catch(() => {
                clearInterval(oidcPollTimer)
                showOIDCError('{{.l13}}')
            })
        }, 1000)
    }

    const handleOIDCCallback = (callbackURL, retryCount = 0) => {
        fetch('/api/system/oidc/mobileCallback', {
            method: 'POST',
            body: JSON.stringify({callbackURL}),
        }).then((response) => response.json()).then((response) => {
            if (response.code === 0) {
                window.location.href = response.data.to || toPath
            } else {
                showOIDCError(response.msg)
            }
        }).catch(() => {
            if (retryCount < 4) {
                setTimeout(() => handleOIDCCallback(callbackURL, retryCount + 1), 1000 * (retryCount + 1))
                return
            }
            showOIDCError('{{.l13}}')
        })
    }
    window.handleOIDCCallback = handleOIDCCallback
    window.handleOidcCallbackLink = handleOIDCCallback

    const startOIDC = () => {
        let flow = 'web'
        if (window.JSAndroid || window.JSHarmony || window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.openAuthURL) {
            flow = 'mobile'
        } else {
            try {
                if (require('electron')) {
                    flow = 'desktop'
                }
            } catch (e) {
                // 浏览器使用当前页面完成回调
            }
        }
        const button = document.getElementById('oidcLogin')
        button.disabled = true
        fetch('/api/system/oidc/start', {
            method: 'POST',
            body: JSON.stringify({flow, to: toPath, rememberMe: document.getElementById('rememberMe').checked}),
        }).then((response) => response.json()).then((response) => {
            button.disabled = false
            if (response.code !== 0) {
                showOIDCError(response.msg)
                return
            }
            if (flow === 'mobile') {
                if (window.JSAndroid) {
                    window.JSAndroid.openAuthURL(response.data.authURL)
                } else if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.openAuthURL) {
                    window.webkit.messageHandlers.openAuthURL.postMessage(response.data.authURL)
                } else {
                    window.JSHarmony.openAuthURL(response.data.authURL)
                }
                return
            }
            if (flow === 'desktop') {
                require('electron').shell.openExternal(response.data.authURL)
                pollOIDC(response.data.pollToken)
                return
            }
            window.location.href = response.data.authURL
        }).catch(() => {
            button.disabled = false
            showOIDCError('{{.l13}}')
        })
    }

    const submitAuth = () => {
        const inputElement = document.getElementById('authCode')
        const captchaElement = document.getElementById('captcha')
        const rememberMeElement = document.getElementById('rememberMe')
        let code = inputElement.value.trim();
        if ("" === code) {
            showMessage({{.l9}})
            inputElement.value = ''
            captchaElement.value = ''
            inputElement.focus()
            return
        }

        fetch('/api/system/loginAuth', {
            method: 'POST',
            body: JSON.stringify({
                authCode: code,
                captcha: captchaElement.value,
                rememberMe: rememberMeElement.checked
            }),
        }).then((response) => {
            return response.json()
        }).then((response) => {
            if (0 === response.code) {
                window.location.href = toPath
                return
            }

            if (response.code === 1) {
                captchaElement.previousElementSibling.src = `/api/system/getCaptcha?v=${new Date().getTime()}`
                captchaElement.parentElement.style.display = 'block'
            } else {
                captchaElement.parentElement.style.display = 'none'
                captchaElement.previousElementSibling.src = ''
            }

            showMessage(response.msg)
            inputElement.value = ''
            captchaElement.value = ''
            inputElement.focus()
        })
    }

    // 认证走前端 fetch,须阻止表单默认提交(内核不接收 POST /check-auth);监听在同步阶段挂载,
    // 让回车与提交按钮统一走 submit 事件,密码管理器也依赖标准表单结构识别登录表单
    document.getElementById('authForm').addEventListener('submit', (event) => {
        event.preventDefault()
        submitAuth()
    })

    const init = async () => {
        const isDark = document.documentElement.classList.contains('dark')
        // 同步外观到原生壳:让 iOS 顶/底条与认证页背景一致
        if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.changeStatusBar) {
            window.webkit.messageHandlers.changeStatusBar.postMessage((isDark ? "#1e1e1e" : "#fff") + " " + (isDark ? 1 : 0))
        }
        if (window.location.hostname !== 'localhost' && window.location.hostname !== '127.0.0.1') {
            document.querySelector('.b3-button--white').remove()
        } else if (toPath.indexOf("/stage/build/app/window.html") > -1) {
            document.querySelector('.b3-button--white').textContent = "{{.l11}}"
        }

        try {
            const {ipcRenderer} = require('electron')
            ipcRenderer.send("siyuan-ready-to-show");
            ipcRenderer.on('siyuan-save-close', (event, close) => {
                exitSiYuan()
            })
            await ipcRenderer.invoke("siyuan-init", {
                languages: {{.trayMenuLangs}},
                workspaceDir: '{{.workspaceDir}}',
                port: location.port
            });
            ipcRenderer.send("siyuan-hotkey", {
                languages: {{.trayMenuLangs}},
                hotkeys: ['{{.keymapGeneralToggleWin}}']
            });
        } catch (e) {
            // console.log(e)
        }
        if (window.JSAndroid && window.JSAndroid.getOIDCCallback) {
            const callbackURL = window.JSAndroid.getOIDCCallback()
            if (callbackURL) {
                handleOIDCCallback(callbackURL)
            }
        }
        if (window.JSHarmony && window.JSHarmony.getOIDCCallback) {
            const callbackURL = window.JSHarmony.getOIDCCallback()
            if (callbackURL) {
                handleOIDCCallback(callbackURL)
            }
        }

        const captchaElement = document.getElementById('captcha')
        lockScreenWallpaperState.focus();

        captchaElement.previousElementSibling.addEventListener('click', function () {
            this.src = `/api/system/getCaptcha?v=${new Date().getTime()}`
        })

        // 用于授权页保持连接,避免非常驻内存内核自动退出 https://github.com/siyuan-note/insider/issues/1099
        const ws = new WebSocket((window.location.protocol === 'https:' ? 'wss' : 'ws') + '://' + window.location.host + '/ws?app=siyuan' + Math.random().toString(36).substring(8) + '&id=auth&type=auth')
        ws.onmessage = (event) => {
            const data = JSON.parse(event.data);
            if (data.cmd === "loginAuth") {
                window.location.href = toPath
            }
        };
    }
    init();
    window.addEventListener("click", (event) => {
        if (event.target.tagName === "INPUT" &&
            ["email", "number", "password", "search", "tel", "text", "url", "", null].includes(event.target.getAttribute("type")) &&
            event.target.getAttribute("readonly") !== "readonly") {
            if (window.JSAndroid && window.JSAndroid.showKeyboard) {
                window.JSAndroid.showKeyboard();
            } else if (window.JSHarmony && window.JSHarmony.showKeyboard) {
                window.JSHarmony.showKeyboard();
            }
        }
    })
</script>
</body>
</html>