
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Checking your browser...</title>
    <style>
        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
            background: #f1f5f9;
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .card {
            background: #fff;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            box-shadow: 0 4px 24px rgba(0,0,0,0.08);
            padding: 36px 40px 32px;
            width: 340px;
            text-align: left;
        }

        .cf-logo {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 24px;
        }

        .cf-logo svg {
            width: 32px;
            height: 32px;
            flex-shrink: 0;
        }

        .cf-logo-text {
            font-size: 13px;
            font-weight: 600;
            color: #1a1a2e;
            line-height: 1.2;
        }

        .cf-logo-sub {
            font-size: 11px;
            font-weight: 400;
            color: #64748b;
        }

        .headline {
            font-size: 17px;
            font-weight: 600;
            color: #0f172a;
            margin-bottom: 6px;
        }

        .subline {
            font-size: 13px;
            color: #64748b;
            margin-bottom: 20px;
            line-height: 1.5;
        }

        /* Checkbox widget */
        .widget {
            border: 1px solid #d1d5db;
            border-radius: 6px;
            padding: 14px 16px;
            display: flex;
            align-items: center;
            gap: 14px;
            background: #f8fafc;
            margin-bottom: 16px;
            cursor: pointer;
            user-select: none;
            transition: border-color 0.15s, background 0.15s;
        }

        .widget:hover {
            border-color: #94a3b8;
            background: #f1f5f9;
        }

        .widget.verifying {
            cursor: default;
            border-color: #cbd5e1;
        }

        .widget.verified {
            border-color: #22c55e;
            background: #f0fdf4;
            cursor: default;
        }

        /* The actual checkbox */
        .cb-box {
            width: 24px;
            height: 24px;
            border: 2px solid #9ca3af;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            background: #fff;
            transition: border-color 0.15s, background 0.15s;
            position: relative;
        }

        .widget:hover .cb-box {
            border-color: #6b7280;
        }

        .widget.verifying .cb-box,
        .widget.verified .cb-box {
            border-color: transparent;
            background: transparent;
        }

        /* Spinner */
        .spinner {
            display: none;
            width: 22px;
            height: 22px;
            border: 2.5px solid #e5e7eb;
            border-top-color: #f6821f;
            border-radius: 50%;
            animation: spin 0.7s linear infinite;
            flex-shrink: 0;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        /* Checkmark */
        .checkmark {
            display: none;
            width: 22px;
            height: 22px;
            flex-shrink: 0;
        }

        .checkmark circle {
            fill: #22c55e;
        }

        .checkmark path {
            fill: none;
            stroke: #fff;
            stroke-width: 2.5;
            stroke-linecap: round;
            stroke-linejoin: round;
        }

        .widget-label {
            font-size: 14px;
            color: #374151;
            font-weight: 500;
        }

        .widget.verified .widget-label {
            color: #15803d;
        }

        /* CF branding footer */
        .cf-footer {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 5px;
            font-size: 10px;
            color: #94a3b8;
        }

        .cf-footer svg {
            width: 14px;
            height: 14px;
            opacity: 0.5;
        }

        .error-msg {
            display: none;
            font-size: 12px;
            color: #dc2626;
            margin-top: 8px;
        }
    </style>

</head>
<body>

<div class="card" role="main">
    <!-- Logo row -->
    <div class="cf-logo" aria-hidden="true">
        <!-- Shield icon -->
        <svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
            <path d="M16 3L4 8v8c0 6.627 5.373 12 12 12s12-5.373 12-12V8L16 3z" fill="#f6821f"/>
            <path d="M16 3L4 8v8c0 6.627 5.373 12 12 12V3z" fill="#faad3f" opacity="0.6"/>
            <path d="M11 16l3 3 7-7" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
        </svg>
        <div>
            <div class="cf-logo-text">Verification</div>
            <div class="cf-logo-sub">Security check</div>
        </div>
    </div>

    <div class="headline">Checking your browser</div>
    <p class="subline">Before you can access this site, we need to verify you&rsquo;re human.</p>

    <!-- Interactive widget -->
    
    <div class="widget" id="widget" role="checkbox" aria-checked="false" tabindex="0"
         onclick="startVerify()" onkeydown="if(event.key==='Enter'||event.key===' ')startVerify()">
        <!-- Unchecked box (default) -->
        <div class="cb-box" id="cb-box"></div>
        <!-- Spinner (verifying state) -->
        <div class="spinner" id="spinner"></div>
        <!-- Checkmark (verified state) -->
        <svg class="checkmark" id="checkmark" viewBox="0 0 22 22" aria-hidden="true">
            <circle cx="11" cy="11" r="11"/>
            <path d="M6 11.5l3.5 3.5 6.5-7"/>
        </svg>
        <span class="widget-label" id="widget-label">I am human</span>
    </div>
    

    <p class="error-msg" id="error-msg" role="alert">Verification failed. Please refresh and try again.</p>

    <div class="cf-footer" aria-label="Security powered by site verification">
        <!-- Small lock icon -->
        <svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
            <rect x="3" y="7" width="10" height="7" rx="1.5" fill="#94a3b8"/>
            <path d="M5 7V5a3 3 0 016 0v2" stroke="#94a3b8" stroke-width="1.5" stroke-linecap="round"/>
        </svg>
        Privacy &bull; Security
    </div>
</div>


<script>
(function() {
    var done = false;
    var retryCount = 0;
    // Bounds the automatic reload below. A persistently failing challenge that
    // reloaded unconditionally would loop forever, which is worse than showing
    // the error: it burns mobile battery and hammers the edge.
    var RELOAD_KEY = '_gp_ac_reloaded';

    function el(id) { return document.getElementById(id); }

    // Reveal whichever terminal-failure surface this page rendered: #error-msg
    // inside the card when the UI is shown, #fallback-msg when it is hidden.
    // Exactly one of the two exists, so both lookups stay guarded.
    function showFailure() {
        var widget  = el('widget');
        var spinner = el('spinner');
        var cbBox   = el('cb-box');
        var label   = el('widget-label');

        if (spinner) { spinner.style.display = 'none'; }
        if (cbBox) { cbBox.style.display = 'block'; }
        if (widget) {
            widget.classList.remove('verifying');
            if (widget.hasAttribute('aria-checked')) {
                widget.setAttribute('aria-checked', 'false');
            }
        }
        // Only the hard challenge has a checkbox to click again; in js_probe
        // mode "I am human" would invite an interaction that does nothing.
        if (label) { label.textContent = cbBox ? 'I am human' : 'Verification failed'; }

        var errMsg = el('error-msg');
        if (errMsg) { errMsg.style.display = 'block'; }
        var fallback = el('fallback-msg');
        if (fallback) { fallback.style.display = 'block'; }
    }

    // The nonce is baked into this page and is valid for only 10 minutes, so a
    // rejected nonce can never be fixed by re-POSTing the same value: the page
    // has to be reloaded to be issued a fresh one. Returns false when the
    // reload budget is already spent, or when sessionStorage is unavailable and
    // the budget therefore cannot be tracked (never reload unbounded).
    function reloadForFreshNonce() {
        try {
            if (sessionStorage.getItem(RELOAD_KEY)) { return false; }
            sessionStorage.setItem(RELOAD_KEY, '1');
        } catch (e) {
            return false;
        }
        window.location.reload();
        return true;
    }

    window.startVerify = function() {
        if (done) return;
        done = true;

        var widget  = el('widget');
        var spinner = el('spinner');
        var check   = el('checkmark');
        var label   = el('widget-label');
        var cbBox   = el('cb-box');

        // Transition to "verifying" state. Every element is optional: when the
        // challenge content is hidden (Visible=false) none of these nodes exist,
        // but verification must still proceed so the bypass cookie gets set.
        if (widget) {
            widget.classList.add('verifying');
            if (widget.hasAttribute('aria-checked')) {
                widget.setAttribute('aria-checked', 'mixed');
            }
        }
        if (cbBox) { cbBox.style.display = 'none'; }
        if (spinner) { spinner.style.display = 'block'; }
        if (label) { label.textContent = 'Verifying\u2026'; }

        // POST nonce to verification endpoint
        fetch('/_challenge/complete', {
            method: 'POST',
            headers: { 'Content-Type': 'application/json' },
            body: JSON.stringify({
                nonce: "239cfc7e465dea5f9d136310e1b98c2f.1787215329.b7dc3f1ba6a91e389b10b3e7016b094fe59dd041bbf553b880203ed2478d18d6",
                path:  "/registered-nurse.xml"
            }),
            credentials: 'same-origin'
        })
        .then(function(res) {
            // 403 means the nonce itself was rejected (expired, or malformed).
            // Flag it so the handler below reloads for a fresh nonce instead of
            // retrying a token that cannot ever succeed.
            if (res.status === 403) {
                var stale = new Error('stale nonce');
                stale.staleNonce = true;
                throw stale;
            }
            if (!res.ok) { throw new Error('bad status ' + res.status); }
            return res.json();
        })
        .then(function(data) {
            if (!data.success) { throw new Error('not ok'); }

            // Release the reload budget so a later challenge on this origin
            // still gets its one reload.
            try { sessionStorage.removeItem(RELOAD_KEY); } catch (e) {}

            // Transition to "verified" state (cosmetic; nodes may be absent)
            if (spinner) { spinner.style.display = 'none'; }
            if (check) { check.style.display = 'block'; }
            if (widget) {
                widget.classList.remove('verifying');
                widget.classList.add('verified');
                if (widget.hasAttribute('aria-checked')) {
                    widget.setAttribute('aria-checked', 'true');
                }
            }
            if (label) { label.textContent = 'Verified'; }

            setTimeout(function() {
                window.location.replace(data.redirect || '/');
            }, 600);
        })
        .catch(function(err) {
            done = false;

            if (err && err.staleNonce) {
                if (reloadForFreshNonce()) { return; }
                showFailure();
                return;
            }

            // Transient failure: network drop, 5xx, or an upstream 429 from
            // nginx. Retry once in both modes -- a hard challenge that failed on
            // a blip would otherwise dead-end on a click the visitor already
            // made, with no way back short of a manual refresh.
            if (retryCount < 1) {
                retryCount++;
                setTimeout(window.startVerify, 2000);
                return;
            }

            showFailure();
        });
    };

    
}());
</script>
</body>
</html>
