{"id":36,"date":"2026-05-04T19:33:46","date_gmt":"2026-05-04T19:33:46","guid":{"rendered":"https:\/\/demo.qrjournal.org\/?page_id=36"},"modified":"2026-05-04T19:58:51","modified_gmt":"2026-05-04T19:58:51","slug":"isochronic-core","status":"publish","type":"page","link":"https:\/\/demo.qrjournal.org\/index.php\/isochronic-core\/","title":{"rendered":"isochronic-core"},"content":{"rendered":"\n    \n    <link rel='stylesheet' href='https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/bootstrap\/5.3.0\/css\/bootstrap.min.css'>\n    <link rel='stylesheet' href='https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/font-awesome\/6.4.0\/css\/all.min.css'>\n    <link href=\"https:\/\/fonts.googleapis.com\/css2?family=Playfair+Display:ital,wght@0,700;1,700&family=Inter:wght@400;900&family=JetBrains+Mono&display=swap\" rel=\"stylesheet\">\n    \n    <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/bootstrap\/5.3.0\/js\/bootstrap.bundle.min.js\"><\/script>\n    <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/d3\/7.8.5\/d3.min.js\"><\/script>\n    <script src=\"https:\/\/unpkg.com\/html5-qrcode\"><\/script>\n    <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/annyang\/2.6.1\/annyang.min.js\"><\/script>\n    <script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jspdf\/2.5.1\/jspdf.umd.min.js\"><\/script>\n\n    <style>\n        #full-map-overlay svg { width: 100%; height: 100%; background: #050505; cursor: grab; }\n        #full-map-overlay svg:active { cursor: grabbing; }\n        #geo-map svg { cursor: grab; border: 1px solid #222; background: #000; }\n        #geo-map svg:active { cursor: grabbing; }\n      \n        :root { --bg: #000; --cyan: #00f2ff; --gold: #ffff00; --border: #222; --danger: #ff0055; }\n        body.isochronic-active { background: var(--bg); color: #fff; font-family: 'Inter', sans-serif; min-height: 100vh; margin: 0; overflow-x: hidden; }\n        \n        #init-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: #000; z-index: 20000; display: flex; flex-direction: column; align-items: center; justify-content: center; }\n\n        #gen-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.92); z-index: 11000; display: none; flex-direction: column; align-items: center; justify-content: center; }\n        .forge-dna { font-size: 5rem; color: var(--cyan); animation: dnaSpin 2.5s infinite linear; filter: drop-shadow(0 0 10px var(--cyan)); }\n        @keyframes dnaSpin { 0% { transform: rotateY(0deg); color: var(--cyan); } 50% { color: var(--gold); } 100% { transform: rotateY(360deg); color: var(--cyan); } }\n\n        #crawl-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 10000; display: none; }\n        .spawn-icon { position: absolute; color: var(--cyan); opacity: 0; animation: spawnFade 1.5s cubic-bezier(0.19, 1, 0.22, 1) forwards; }\n        @keyframes spawnFade { 0% { transform: scale(0.5) rotate(-90deg); opacity: 0; } 50% { opacity: 1; color: var(--gold); } 100% { transform: scale(3) rotate(90deg); opacity: 0; } }\n\n        #checkpointOverlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 15000; display: none; background: rgba(0,0,0,0.98); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px); align-items: flex-start; justify-content: center; padding-top: 20px; overflow-y: auto; pointer-events: auto; }\n        #checkpointOverlay input, #checkpointOverlay select, #nodeEditorModal select, #lexiconEditorModal select { border: 2px solid var(--cyan) !important; color: #ffffff !important; background-color: #111 !important; }\n        #checkpointOverlay label { color: var(--gold) !important; }\n\n        .dash-panel { background: #050505; border: 1px solid var(--border); border-radius: 12px; min-height: calc(100vh - 2rem); display: flex; flex-direction: column; padding: 1.2rem; }\n        .lex-entry { display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; padding: 6px; border-bottom: 1px solid #111; font-family: 'JetBrains Mono'; }\n        .weight-high { color: var(--gold); border-left: 3px solid var(--gold); padding-left: 5px; }\n\n        .diag-terminal { background: rgba(10,10,10,0.5); border: 1px solid #333; border-radius: 4px; font-family: 'JetBrains Mono'; font-size: 0.65rem; padding: 10px; color: #0f0; height: 200px; overflow-y: auto; text-transform: uppercase; }\n        .diag-entry { margin-bottom: 4px; border-bottom: 1px solid #111; padding-bottom: 2px; }\n        .diag-alt { color: #555; display: block; font-size: 0.6rem; }\n\n        #geo-hud-container { margin-bottom: 10px; border: 1px solid #333; background: #080808; border-radius: 4px; padding: 8px; }\n        #geo-map svg { background: #000; width: 100%; height: 150px; border: 1px solid #222; }\n        .node-point { fill: var(--cyan); stroke: none; transition: all 0.5s; cursor: pointer; }\n        .node-point:hover { fill: var(--gold); r: 8; }\n        .user-point { fill: var(--danger); animate: pulse 2s infinite; }\n        .node-label { fill: #fff; font-size: 8px; font-family: 'JetBrains Mono'; pointer-events: none; opacity: 0.7; }\n        .geo-data { font-family: 'JetBrains Mono'; font-size: 0.7rem; color: var(--gold); display: flex; justify-content: space-between; margin-bottom: 5px; }\n\n        .spectrum-line { font-family: 'Playfair Display', serif; text-align: center; opacity: 0.1; transition: 1s; font-size: 2.2rem; margin-bottom: 180px; padding: 0 10%; }\n        .active-focus { opacity: 1 !important; transform: scale(1.05); text-shadow: 0 0 15px rgba(0, 242, 255, 0.3); }\n\n        .btn-sync.active { background: var(--gold) !important; color: #000; border-color: var(--gold); }\n        .spin-icon { display: none; }\n        .active .spin-icon { display: inline-block; animation: fa-spin 1s infinite linear; margin-right: 5px; }\n        \n        ::-webkit-scrollbar { width: 5px; }\n        ::-webkit-scrollbar-track { background: #000; }\n        ::-webkit-scrollbar-thumb { background: #333; }\n    <\/style>\n\n    <div class=\"isochronic-wrapper\">\n        <div id=\"init-overlay\">\n            <h1 class=\"display-4 fw-900 text-info mb-3 text-center\">ISOCHRONIC 4.0<\/h1>\n            <p class=\"text-secondary small mb-4 px-4 text-center\">System requires explicit user authorization to initialize Spatial-Neural links.<\/p>\n            \n            <div id=\"isoSessionOptions\" style=\"display: none; width: 100%; max-width: 400px; background: rgba(10,10,10,0.9); padding: 15px; border-radius: 8px; border: 1px solid #00f2ff; margin-bottom: 25px; box-shadow: 0 0 20px rgba(0,242,255,0.1);\">\n                <div class=\"alert alert-dark border-info text-info py-2 small mb-3 text-center fw-bold\">\n                    <i class=\"fas fa-database me-2\"><\/i>Previous Neural State Detected\n                <\/div>\n                \n                <div class=\"form-check form-switch mb-2\" id=\"toggleWaypointsContainer\" style=\"display:none;\">\n                    <input class=\"form-check-input\" type=\"checkbox\" id=\"importWaypoints\" checked>\n                    <label class=\"form-check-label text-light small\" for=\"importWaypoints\">Load Spatial Anchors (Waypoints)<\/label>\n                <\/div>\n                \n                <div class=\"form-check form-switch mb-2\" id=\"toggleLexiconContainer\" style=\"display:none;\">\n                    <input class=\"form-check-input\" type=\"checkbox\" id=\"importLexiconData\" checked>\n                    <label class=\"form-check-label text-light small\" for=\"importLexiconData\">Load Neural Lexicon (Nodes)<\/label>\n                <\/div>\n                \n                <div class=\"form-check form-switch mb-3\" id=\"toggleInterceptionsContainer\" style=\"display:none;\">\n                    <input class=\"form-check-input\" type=\"checkbox\" id=\"importInterceptions\" checked>\n                    <label class=\"form-check-label text-light small\" for=\"importInterceptions\">Load Intercepted Works Archive<\/label>\n                <\/div>\n                \n                <hr class=\"border-secondary my-3\">\n                <button class=\"btn btn-outline-danger btn-sm w-100 fw-bold\" id=\"isoStartFreshBtn\"><i class=\"fas fa-trash me-2\"><\/i>WIPE ALL DATA (Start Fresh)<\/button>\n            <\/div>\n            \n            <button class=\"btn btn-outline-info btn-lg px-5 fw-bold\" id=\"initCoreBtn\">INITIALIZE CORE<\/button>\n        <\/div>\n\n        <div id=\"gen-overlay\">\n            <i class=\"fas fa-dna forge-dna mb-4\"><\/i>\n            <h4 class=\"text-info fw-bold letter-spacing-2\">NEURAL FORGING<\/h4>\n            <p class=\"text-secondary small\">Synthesizing Lexical Weights...<\/p>\n        <\/div>\n        <div id=\"crawl-overlay\"><\/div>\n\n        <div class=\"modal fade\" id=\"interceptionsModal\" tabindex=\"-1\">\n            <div class=\"modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable\">\n                <div class=\"modal-content bg-black border border-info\">\n                    <div class=\"modal-header border-secondary\">\n                        <h5 class=\"modal-title text-info fw-bold\"><i class=\"fas fa-folder-open me-2\"><\/i>INTERCEPTED WORKS<\/h5>\n                        <button type=\"button\" class=\"btn-close btn-close-white\" data-bs-dismiss=\"modal\"><\/button>\n                    <\/div>\n                    <div class=\"modal-body\" id=\"interceptions-list\"><\/div>\n                <\/div>\n            <\/div>\n        <\/div>\n\n        <div id=\"checkpointOverlay\">\n            <div class=\"container\" style=\"max-width: 1000px;\">\n                <div class=\"row g-4\">\n                    <div class=\"col-md-5 border-end border-secondary\">\n                        <h2 class=\"text-warning fw-900 mb-4\">NEURAL CHECKPOINT<\/h2>\n                        \n                        <div class=\"bg-dark p-3 rounded mb-3 border border-secondary\">\n                            <div class=\"form-check form-switch mb-2\">\n                                <input class=\"form-check-input\" type=\"checkbox\" id=\"reflexMode\" checked>\n                                <label class=\"form-check-label small text-info fw-bold\" for=\"reflexMode\">REFLEX SYNC (AUTO)<\/label>\n                            <\/div>\n\n                            <div class=\"form-check form-switch mb-2\">\n                                <input class=\"form-check-input\" type=\"checkbox\" id=\"autoPilotMode\">\n                                <label class=\"form-check-label small text-warning fw-bold\" for=\"autoPilotMode\">AUTO PILOT ENABLED<\/label>\n                            <\/div>\n\n                            <label class=\"small text-secondary mb-1\">GOAL \/ INTENT<\/label>\n                            <input type=\"text\" id=\"auto-goal\" class=\"form-control form-control-sm bg-black text-white border-secondary mb-2\" placeholder=\"e.g., Transcendence\">\n                            \n                            <label class=\"small text-secondary mb-1\">TIMEOUT: <span id=\"timer-val\">5<\/span>s<\/label>\n                            <input type=\"range\" id=\"auto-timer\" class=\"form-range\" min=\"0.5\" max=\"30\" step=\"0.5\" value=\"5\" oninput=\"document.getElementById('timer-val').innerText = this.value\">\n                            \n                            <div id=\"auto-countdown\" class=\"text-center text-danger fw-bold mt-2\" style=\"display:none; font-family: 'JetBrains Mono';\">\n                                AUTO-ADJUST IN: <span id=\"countdown-sec\">5<\/span>s\n                            <\/div>\n\n                            <hr class=\"border-secondary\">\n\n                            <label class=\"small text-secondary mb-1\">STRATEGY<\/label>\n                            <select id=\"reflexStrategy\" class=\"form-select form-select-sm bg-black text-white border-secondary mb-3\">\n                                <option value=\"first\">First Word Detected<\/option>\n                                <option value=\"last\">Last Word Detected<\/option>\n                                <option value=\"most\">Most Frequent<\/option>\n                                <option value=\"least\">Least Frequent (Outlier)<\/option>\n                            <\/select>\n                            <label class=\"small text-secondary mb-1\">INJECTION WEIGHT<\/label>\n                            <input type=\"range\" id=\"chk-weight\" class=\"form-range\" min=\"1\" max=\"100\" value=\"50\">\n                        <\/div>\n\n                        <input type=\"text\" id=\"chk-word\" class=\"form-control bg-black text-white border-info mb-2\" placeholder=\"Manual Override...\">\n                        <button class=\"btn btn-info w-100 fw-bold mb-3\" onclick=\"app.commitCheckpoint()\">FORCE SYNC<\/button>\n                        <button class=\"btn btn-danger w-100 fw-bold btn-sm mb-2\" onclick=\"app.exportPDF()\"><i class=\"fas fa-file-pdf me-2\"><\/i>EXPORT SESSION DATA<\/button>\n                        \n                        <button class=\"btn btn-warning w-100 fw-bold btn-sm shadow\" style=\"box-shadow: 0 0 10px rgba(255, 255, 0, 0.4) !important;\" onclick=\"app.transmitToBlueprint()\">\n                            <i class=\"fas fa-rocket me-2\"><\/i>TRANSMIT TO BLUEPRINT\n                        <\/button>\n\n                    <\/div>\n\n                    <div class=\"col-md-7\">\n                        <div class=\"d-flex justify-content-between align-items-center mb-2\">\n                            <span class=\"small text-info fw-bold\"><i class=\"fas fa-satellite-dish me-2\"><\/i>DIVA DIAGNOSTICS (LIVE NLP)<\/span>\n                            <span class=\"badge bg-danger pulse\">LISTENING<\/span>\n                        <\/div>\n                        <div id=\"diag-terminal\" class=\"diag-terminal\"><\/div>\n                    <\/div>\n                <\/div>\n            <\/div>\n        <\/div>\n\n        <div class=\"modal fade\" id=\"nodeEditorModal\" tabindex=\"-1\">\n            <div class=\"modal-dialog modal-dialog-centered\"><div class=\"modal-content bg-black border border-info\">\n                <div class=\"modal-header border-secondary\">\n                    <h5 class=\"modal-title text-info fw-bold\">NEURAL ANCHOR EDITOR<\/h5>\n                    <button type=\"button\" class=\"btn-close btn-close-white\" data-bs-dismiss=\"modal\"><\/button>\n                <\/div>\n                <div class=\"modal-body\">\n                    <input type=\"hidden\" id=\"edit-node-id\">\n                    <label class=\"small text-secondary\">ANCHOR NAME<\/label>\n                    <input type=\"text\" id=\"edit-node-name\" class=\"form-control bg-dark text-white border-secondary mb-3\">\n                    <label class=\"small text-secondary\">ACTIVE RADIUS (METERS)<\/label>\n                    <input type=\"number\" id=\"edit-node-radius\" class=\"form-control bg-dark text-white border-secondary mb-3\">\n                    <label class=\"small text-secondary\">INFLUENCE TYPE<\/label>\n                    <select id=\"edit-node-influence\" class=\"form-select bg-dark text-white border-secondary mb-3\">\n                        <option value=\"essence\">Essence (Thematic & Implicit - Primary)<\/option>\n                        <option value=\"literal\">Literal (Explicit Name Insertion)<\/option>\n                    <\/select>\n                    <label class=\"small text-secondary\">META \/ CONTEXT<\/label>\n                    <textarea id=\"edit-node-meta\" class=\"form-control bg-dark text-white border-secondary mb-3\" rows=\"3\" placeholder=\"Describe the feeling...\"><\/textarea>\n                <\/div>\n                <div class=\"modal-footer border-secondary\">\n                    <button type=\"button\" class=\"btn btn-danger btn-sm me-auto\" onclick=\"app.deleteNode()\">DELETE<\/button>\n                    <button type=\"button\" class=\"btn btn-info fw-bold\" onclick=\"app.saveNodeEdit()\">UPDATE ANCHOR<\/button>\n                <\/div>\n            <\/div><\/div>\n        <\/div>\n\n        <div class=\"modal fade\" id=\"lexiconEditorModal\" tabindex=\"-1\">\n            <div class=\"modal-dialog modal-dialog-centered\"><div class=\"modal-content bg-black border border-warning\">\n                <div class=\"modal-header border-secondary\">\n                    <h5 class=\"modal-title text-warning fw-bold\">LEXICON NODE EDITOR<\/h5>\n                    <button type=\"button\" class=\"btn-close btn-close-white\" data-bs-dismiss=\"modal\"><\/button>\n                <\/div>\n                <div class=\"modal-body\">\n                    <label class=\"small text-secondary\">NODE WORD<\/label>\n                    <input type=\"text\" id=\"edit-lex-word\" class=\"form-control bg-dark text-white border-secondary mb-3\" readonly>\n                    <label class=\"small text-secondary\">SYNAPTIC WEIGHT<\/label>\n                    <input type=\"number\" id=\"edit-lex-weight\" class=\"form-control bg-dark text-white border-secondary mb-3\">\n                    <label class=\"small text-secondary\">INFLUENCE TYPE<\/label>\n                    <select id=\"edit-lex-influence\" class=\"form-select bg-dark text-white border-secondary mb-3\">\n                        <option value=\"essence\">Essence (Thematic Integration - Primary)<\/option>\n                        <option value=\"literal\">Literal (Direct Word Insertion)<\/option>\n                    <\/select>\n                    <label class=\"small text-secondary\">ADDITIONAL CONTEXT<\/label>\n                    <textarea id=\"edit-lex-context\" class=\"form-control bg-dark text-white border-secondary mb-3\" rows=\"3\" placeholder=\"Provide deeper meaning...\"><\/textarea>\n                <\/div>\n                <div class=\"modal-footer border-secondary\">\n                    <button type=\"button\" class=\"btn btn-danger btn-sm me-auto\" onclick=\"app.deleteLexiconWord()\">REMOVE NODE<\/button>\n                    <button type=\"button\" class=\"btn btn-warning fw-bold text-dark\" onclick=\"app.saveLexiconEdit()\">UPDATE NODE<\/button>\n                <\/div>\n            <\/div><\/div>\n        <\/div>\n\n        <div class=\"container-fluid py-3 h-100\">\n            <div class=\"row g-3 h-100\">\n                <div class=\"col-lg-4\">\n                    <div class=\"dash-panel\">\n                        <div id=\"geo-hud-container\">\n                            <div class=\"d-flex justify-content-between align-items-center mb-2\">\n                                <span class=\"small text-info fw-bold\"><i class=\"fas fa-map-marked-alt me-2\"><\/i>SPATIAL ENGINE<\/span>\n                                <span id=\"gps-status\" class=\"badge bg-secondary\">OFFLINE<\/span>\n                            <\/div>\n                            <div class=\"geo-data\">\n                                <span id=\"geo-coords\">LAT: -- | LNG: -- | ALT: --<\/span>\n                                <span id=\"geo-anchor\" class=\"text-white\">NO ANCHOR<\/span>\n                            <\/div>\n                            <div id=\"geo-map\"><\/div>\n                            <div class=\"btn-group w-100 mt-2\" role=\"group\">\n                                <button class=\"btn btn-outline-info btn-sm\" onclick=\"app.tagLocation()\"><i class=\"fas fa-thumbtack\"><\/i> TAG<\/button>\n                                <button class=\"btn btn-outline-info btn-sm\" onclick=\"app.toggleFullMap()\"><i class=\"fas fa-expand\"><\/i> MAP<\/button>\n                                <button class=\"btn btn-outline-secondary btn-sm\" onclick=\"app.exportAnchors()\"><i class=\"fas fa-download\"><\/i><\/button>\n                                <button class=\"btn btn-outline-secondary btn-sm\" onclick=\"document.getElementById('import-anchors').click()\"><i class=\"fas fa-upload\"><\/i><\/button>\n                            <\/div>\n                            <input type=\"file\" id=\"import-anchors\" style=\"display:none;\" accept=\".json\" onchange=\"app.importAnchors(event)\">\n                        <\/div>\n\n                        <h6 class=\"text-secondary small fw-bold mb-2 mt-2\">SOURCE SYNC<\/h6>\n                        \n                        <div class=\"input-group mb-2\">\n                            <button class=\"btn btn-outline-secondary btn-sm\" onclick=\"document.getElementById('manual-url').value='https:\/\/www.telegraph.co.uk\/'\" title=\"Target: The Telegraph\"><i class=\"fas fa-newspaper\"><\/i><\/button>\n                            <input type=\"text\" id=\"manual-url\" class=\"form-control form-control-sm bg-black text-white border-secondary\" value=\"https:\/\/qrjournal.org\/todays-note\/\">\n                            <button id=\"sync-btn\" class=\"btn btn-secondary btn-sm btn-sync\" onclick=\"app.processInput(document.getElementById('manual-url').value)\">\n                                <i class=\"fas fa-sync spin-icon\"><\/i>SYNC\n                            <\/button>\n                        <\/div>\n                        \n                        <button class=\"btn btn-outline-info btn-sm w-100 mb-2 fw-bold\" onclick=\"app.showInterceptions()\">\n                            <i class=\"fas fa-folder-open me-2\"><\/i>SCANNED WORKS ARCHIVE\n                        <\/button>\n\n                        <button class=\"btn btn-outline-warning w-100 mb-2 btn-sm\" onclick=\"app.toggleScanner()\">\n                            <i class=\"fas fa-qrcode me-2\"><\/i>QR CAMERA\n                        <\/button>\n                        <div id=\"qr-reader\" class=\"mb-3 border border-secondary\" style=\"display:none; height: 200px;\"><\/div>\n\n                        <div class=\"d-flex justify-content-between align-items-center border-bottom border-secondary pb-1 mb-2\">\n                            <span class=\"small text-secondary fw-bold\">ACTIVE LEXICON<\/span>\n                            <div class=\"btn-group\" role=\"group\">\n                                <button class=\"btn btn-outline-secondary btn-sm py-0\" onclick=\"app.exportLexicon()\" title=\"Export Lexicon\"><i class=\"fas fa-download\"><\/i><\/button>\n                                <button class=\"btn btn-outline-secondary btn-sm py-0\" onclick=\"document.getElementById('import-lexicon').click()\" title=\"Import Lexicon\"><i class=\"fas fa-upload\"><\/i><\/button>\n                            <\/div>\n                            <input type=\"file\" id=\"import-lexicon\" style=\"display:none;\" accept=\".json\" onchange=\"app.importLexicon(event)\">\n                        <\/div>\n                        \n                        <div id=\"lex-list\" style=\"flex-grow:1; overflow-y:auto; max-height: 250px;\"><\/div>\n\n                        <div class=\"mt-auto pt-3 border-top border-secondary\">\n                            <div class=\"d-flex justify-content-between small mb-2\">\n                                <span class=\"text-secondary\" id=\"drift-status\">Passive Drift: 0\/10<\/span>\n                                <span class=\"text-warning\" id=\"voice-status\">Voice: STANDBY<\/span>\n                            <\/div>\n                            <button class=\"btn btn-info w-100 fw-bold\" onclick=\"app.generate()\">GENERATE STREAM<\/button>\n                        <\/div>\n                    <\/div>\n                <\/div>\n                \n                <div class=\"col-lg-8\">\n                    <div class=\"dash-panel align-items-center justify-content-center text-center\">\n                        <h1 class=\"display-4 fw-900 mb-0\">ISOCHRONIC<\/h1>\n                        <p class=\"text-secondary small mb-5\">v4.0 | SPATIAL-NEURAL CORE<\/p>\n                    <\/div>\n                <\/div>\n            <\/div>\n        <\/div>\n\n        <div id=\"launch-btn-container\" class=\"position-fixed bottom-0 start-50 translate-middle-x mb-4 d-none\" style=\"z-index: 1050;\"><\/div>\n\n        <div class=\"modal fade\" id=\"streamModal\" tabindex=\"-1\" data-bs-backdrop=\"static\">\n            <div class=\"modal-dialog modal-fullscreen\"><div class=\"modal-content bg-black border-0\">\n                <div class=\"position-absolute top-0 end-0 p-3\" style=\"z-index: 2000;\">\n                    <button class=\"btn btn-outline-warning btn-sm fw-bold me-2\" onclick=\"app.triggerCheckpoint()\"><i class=\"fas fa-hand-paper me-1\"><\/i> MANUAL CHECKPOINT<\/button>\n                    <button class=\"btn btn-outline-info btn-sm fw-bold me-2\" onclick=\"app.manualAdvance()\">NEXT MESSAGE <i class=\"fas fa-forward\"><\/i><\/button>\n                    <button class=\"btn btn-outline-light btn-sm fw-bold\" onclick=\"app.closeStream()\">EXIT<\/button>\n                <\/div>\n                <div class=\"modal-body overflow-auto\" id=\"modalScroll\" style=\"padding-top: 45vh; padding-bottom: 60vh;\">\n                    <div id=\"waterfall-area\"><\/div>\n                <\/div>\n            <\/div><\/div>\n        <\/div>\n\n        <div id=\"full-map-overlay\" style=\"display:none; position:fixed; top:0; left:0; width:100vw; height:100vh; background:#000; z-index:12000;\">\n            <div class=\"position-absolute top-0 start-0 p-3 w-100 d-flex justify-content-between align-items-center\" style=\"z-index: 12001; background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);\">\n                <h5 class=\"text-info fw-bold mb-0\"><i class=\"fas fa-satellite me-2\"><\/i>TOPOGRAPHY LINK<\/h5>\n                <button class=\"btn btn-outline-light btn-sm fw-bold\" onclick=\"app.toggleFullMap()\">CLOSE<\/button>\n            <\/div>\n            <div id=\"full-geo-map\" style=\"width:100%; height:100%;\"><\/div>\n        <\/div>\n    <\/div> \n    \n    <script>\n    document.body.classList.add('isochronic-active');\n\n    const ajaxurl = 'https:\/\/demo.qrjournal.org\/wp-admin\/admin-ajax.php';\n    let streamModal, nodeEditorModal, lexiconEditorModal, html5QrCode;\n\n    setTimeout(() => {\n        streamModal = new bootstrap.Modal(document.getElementById('streamModal'));\n        nodeEditorModal = new bootstrap.Modal(document.getElementById('nodeEditorModal'));\n        lexiconEditorModal = new bootstrap.Modal(document.getElementById('lexiconEditorModal'));\n    }, 100);\n\n    const app = {\n        state: { \n            lexicon: {}, \n            diagLogs: [], \n            sentences: [], \n            waypoints: [], \n            interceptions: [], \n            currentPos: { lat: 0, lng: 0, alt: 0 },\n            activeAnchor: null,\n            lastIdx: 0, \n            loading: false, \n            passiveCount: 0, \n            isLocked: false, \n            reflex: true, \n            playing: false,\n            autoPilotActive: false,\n            countdownInterval: null,\n            narrativeHistory: [],\n            maxHistory: 10,\n            isFullMap: false,\n            fallbackTimer: null\n        },\n\n        init() {\n            const hasWaypoints = !!localStorage.getItem('iso_waypoints');\n            const hasLexicon = !!localStorage.getItem('iso_lexicon');\n            const hasInterceptions = !!localStorage.getItem('iso_interceptions');\n\n            const sessionBox = document.getElementById('isoSessionOptions');\n            const btnInit = document.getElementById('initCoreBtn');\n            const btnFresh = document.getElementById('isoStartFreshBtn');\n\n            if (hasWaypoints || hasLexicon || hasInterceptions) {\n                sessionBox.style.display = 'block';\n                if (hasWaypoints) document.getElementById('toggleWaypointsContainer').style.display = 'block';\n                if (hasLexicon) document.getElementById('toggleLexiconContainer').style.display = 'block';\n                if (hasInterceptions) document.getElementById('toggleInterceptionsContainer').style.display = 'block';\n            }\n\n            btnFresh.addEventListener('click', () => {\n                if(confirm(\"This will permanently sever previous neural links. Proceed?\")) {\n                    localStorage.removeItem('iso_waypoints');\n                    localStorage.removeItem('iso_lexicon');\n                    localStorage.removeItem('iso_interceptions');\n                    sessionBox.style.display = 'none';\n                    if(document.getElementById('importWaypoints')) document.getElementById('importWaypoints').checked = false;\n                    if(document.getElementById('importLexiconData')) document.getElementById('importLexiconData').checked = false;\n                    if(document.getElementById('importInterceptions')) document.getElementById('importInterceptions').checked = false;\n                }\n            });\n\n            btnInit.addEventListener('click', () => {\n                if (hasWaypoints && !document.getElementById('importWaypoints').checked) localStorage.removeItem('iso_waypoints');\n                if (hasLexicon && !document.getElementById('importLexiconData').checked) localStorage.removeItem('iso_lexicon');\n                if (hasInterceptions && !document.getElementById('importInterceptions').checked) localStorage.removeItem('iso_interceptions');\n\n                this.loadState(); \n                this.loadLexiconState(); \n                this.loadInterceptionsState(); \n                \n                const interceptedUrl = localStorage.getItem('iso_target_url');\n                if (interceptedUrl) {\n                    document.getElementById('manual-url').value = interceptedUrl;\n                    this.logDiag(\"System Transfer\", \"Intercepted Target URL loaded into sync queue.\");\n                }\n                \n                document.getElementById('reflexMode').onchange = (e) => this.state.reflex = e.target.checked;\n                document.getElementById('autoPilotMode').onchange = (e) => this.state.autoPilotActive = e.target.checked;\n                \n                if(Object.keys(this.state.lexicon).length === 0) {\n                    this.state.lexicon = { \n                        \"coherence\": { weight: 20, context: \"State of synchrony\", influence: \"essence\" }, \n                        \"quantum\": { weight: 15, context: \"Subatomic potentials\", influence: \"essence\" }, \n                        \"resonance\": { weight: 15, context: \"Vibrational matching\", influence: \"literal\" } \n                    };\n                    this.saveLexiconState();\n                }\n                \n                this.renderLex();\n                this.renderMap();\n                setInterval(() => this.bufferManager(), 3000);\n                \n                this.startSystem();\n            });\n        },\n\n        transmitToBlueprint() {\n            this.logDiag(\"System Transfer\", \"Packaging Neural State for Blueprint...\");\n            const transferData = {\n                glossary: this.state.lexicon,\n                anchors: this.state.waypoints,\n                interceptions: this.state.interceptions\n            };\n            \n            localStorage.setItem('blueprint_transfer_data', JSON.stringify(transferData));\n            window.location.href = \"https:\/\/demo.qrjournal.org\/blueprint\/\"; \n        },\n\n        startSystem() {\n            const btn = document.getElementById('initCoreBtn');\n            btn.innerText = \"REQUESTING UPLINK...\";\n            btn.classList.replace('btn-outline-info', 'btn-warning');\n\n            if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n                navigator.mediaDevices.getUserMedia({ audio: true })\n                .then(stream => {\n                    this.initVoice();\n                    this.initGeo();\n                    document.getElementById('init-overlay').style.display = 'none';\n                })\n                .catch(err => {\n                    alert(\"Microphone denied. Voice reflexes will be offline.\");\n                    this.initVoice(); \n                    this.initGeo();   \n                    document.getElementById('init-overlay').style.display = 'none';\n                });\n            } else {\n                this.initVoice();\n                this.initGeo();\n                document.getElementById('init-overlay').style.display = 'none';\n            }\n        },\n\n        initGeo() {\n            if (\"geolocation\" in navigator) {\n                navigator.geolocation.watchPosition((pos) => {\n                    const altRaw = pos.coords.altitude;\n                    const altDisplay = altRaw ? altRaw.toFixed(1) + 'm' : 'N\/A';\n\n                    this.state.currentPos = { \n                        lat: pos.coords.latitude, \n                        lng: pos.coords.longitude,\n                        alt: altRaw || 0\n                    };\n                    \n                    document.getElementById('geo-coords').innerText = `LAT: ${this.state.currentPos.lat.toFixed(4)} | LNG: ${this.state.currentPos.lng.toFixed(4)} | ALT: ${altDisplay}`;\n                    document.getElementById('gps-status').className = \"badge bg-success pulse\";\n                    document.getElementById('gps-status').innerText = \"LIVE\";\n\n                    this.checkSpatialAnchors();\n                    this.renderMap();\n                }, (err) => {\n                    console.error(err);\n                    document.getElementById('gps-status').className = \"badge bg-danger\";\n                    document.getElementById('gps-status').innerText = \"ERR\";\n                }, { enableHighAccuracy: true });\n            }\n        },\n\n        tagLocation() {\n            if(this.state.currentPos.lat === 0) return alert(\"Waiting for GPS Lock...\");\n            const name = prompt(\"Name this Neural Anchor:\", \"New Waypoint\");\n            if(!name) return;\n\n            const altStr = this.state.currentPos.alt ? `${this.state.currentPos.alt.toFixed(1)}m` : 'Unknown';\n\n            const newNode = {\n                id: Date.now(),\n                name: name,\n                lat: this.state.currentPos.lat,\n                lng: this.state.currentPos.lng,\n                radius: 50, \n                meta: `User tagged location. Altitude: ${altStr}`,\n                influence: \"essence\" \n            };\n\n            this.state.waypoints.push(newNode);\n            this.saveState();\n            this.logDiag(\"Spatial Engine\", `Anchor Created: ${name} (Alt: ${altStr})`);\n            this.renderMap();\n        },\n\n        exportAnchors() {\n            if(this.state.waypoints.length === 0) return alert(\"No anchors to export.\");\n            const dataStr = \"data:text\/json;charset=utf-8,\" + encodeURIComponent(JSON.stringify(this.state.waypoints));\n            const downloadAnchorNode = document.createElement('a');\n            downloadAnchorNode.setAttribute(\"href\", dataStr);\n            downloadAnchorNode.setAttribute(\"download\", `isochronic_anchors_${Date.now()}.json`);\n            document.body.appendChild(downloadAnchorNode);\n            downloadAnchorNode.click();\n            downloadAnchorNode.remove();\n            this.logDiag(\"Spatial Engine\", \"Exported Spatial Anchors.\");\n        },\n\n        importAnchors(event) {\n            const file = event.target.files[0];\n            if (!file) return;\n            const reader = new FileReader();\n            reader.onload = (e) => {\n                try {\n                    const imported = JSON.parse(e.target.result);\n                    if (Array.isArray(imported)) {\n                        const currentIds = new Set(this.state.waypoints.map(w => w.id));\n                        let count = 0;\n                        imported.forEach(wp => {\n                            if (!currentIds.has(wp.id)) {\n                                if(!wp.influence) wp.influence = \"essence\"; \n                                this.state.waypoints.push(wp);\n                                currentIds.add(wp.id);\n                                count++;\n                            }\n                        });\n                        this.saveState();\n                        this.renderMap();\n                        this.checkSpatialAnchors();\n                        this.logDiag(\"Spatial Engine\", `Imported ${count} new Anchors.`);\n                    }\n                } catch (err) {\n                    alert(\"Invalid JSON file. Please upload a valid exported anchors file.\");\n                    this.logDiag(\"Spatial Engine\", \"Failed to import anchors - Invalid JSON.\");\n                }\n                event.target.value = ''; \n            };\n            reader.readAsText(file);\n        },\n\n        checkSpatialAnchors() {\n            const R = 6371e3; \n            let nearest = null;\n            let minDist = Infinity;\n\n            this.state.waypoints.forEach(wp => {\n                const \u03c61 = this.state.currentPos.lat * Math.PI\/180;\n                const \u03c62 = wp.lat * Math.PI\/180;\n                const \u0394\u03c6 = (wp.lat - this.state.currentPos.lat) * Math.PI\/180;\n                const \u0394\u03bb = (wp.lng - this.state.currentPos.lng) * Math.PI\/180;\n\n                const a = Math.sin(\u0394\u03c6\/2) * Math.sin(\u0394\u03c6\/2) + Math.cos(\u03c61) * Math.cos(\u03c62) * Math.sin(\u0394\u03bb\/2) * Math.sin(\u0394\u03bb\/2);\n                const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n                const d = R * c;\n\n                if(d < wp.radius && d < minDist) { minDist = d; nearest = wp; }\n            });\n\n            this.state.activeAnchor = nearest;\n            const anchorLabel = document.getElementById('geo-anchor');\n            if(nearest) {\n                anchorLabel.innerText = nearest.name.toUpperCase();\n                anchorLabel.className = \"text-info fw-bold blink\";\n            } else {\n                anchorLabel.innerText = \"NO ANCHOR\";\n                anchorLabel.className = \"text-secondary\";\n            }\n        },\n\n        toggleFullMap() {\n            this.state.isFullMap = !this.state.isFullMap;\n            const overlay = document.getElementById('full-map-overlay');\n            if(this.state.isFullMap) {\n                overlay.style.display = 'block';\n                this.renderMap();\n            } else {\n                overlay.style.display = 'none';\n            }\n        },\n\n        renderMap() {\n            const hudContainer = document.getElementById('geo-map');\n            this.drawD3Map('#geo-map', hudContainer.clientWidth, 150);\n            \n            if (this.state.isFullMap) {\n                this.drawD3Map('#full-geo-map', window.innerWidth, window.innerHeight);\n            }\n        },\n\n        drawD3Map(containerSelector, w, h) {\n            const container = document.querySelector(containerSelector);\n            if(!container) return;\n            container.innerHTML = ''; \n            \n            const svg = d3.select(containerSelector).append(\"svg\")\n                .attr(\"width\", w).attr(\"height\", h);\n\n            const g = svg.append(\"g\");\n\n            const zoom = d3.zoom()\n                .scaleExtent([0.5, 10]) \n                .on(\"zoom\", (event) => {\n                    g.attr(\"transform\", event.transform);\n                });\n            \n            svg.call(zoom);\n\n            const points = [...this.state.waypoints, { lat: this.state.currentPos.lat, lng: this.state.currentPos.lng }];\n            \n            if(points.length < 2) {\n                 g.append(\"circle\").attr(\"cx\", w\/2).attr(\"cy\", h\/2).attr(\"r\", 5).attr(\"class\", \"user-point\");\n                 return;\n            }\n\n            const latExtent = d3.extent(points, d => d.lat);\n            const lngExtent = d3.extent(points, d => d.lng);\n            const pad = 0.001; \n\n            const xScale = d3.scaleLinear().domain([lngExtent[0]-pad, lngExtent[1]+pad]).range([20, w-20]);\n            const yScale = d3.scaleLinear().domain([latExtent[0]-pad, latExtent[1]+pad]).range([h-20, 20]); \n\n            g.selectAll(\".node-point\").data(this.state.waypoints).enter().append(\"circle\")\n                .attr(\"class\", \"node-point\").attr(\"cx\", d => xScale(d.lng)).attr(\"cy\", d => yScale(d.lat)).attr(\"r\", 5)\n                .on(\"click\", (e, d) => this.openNodeEditor(d));\n\n            g.append(\"circle\").attr(\"cx\", xScale(this.state.currentPos.lng)).attr(\"cy\", yScale(this.state.currentPos.lat))\n                .attr(\"r\", 4).attr(\"class\", \"user-point\");\n\n            g.selectAll(\".node-label\").data(this.state.waypoints).enter().append(\"text\")\n                .attr(\"class\", \"node-label\").attr(\"x\", d => xScale(d.lng) + 8).attr(\"y\", d => yScale(d.lat) + 3).text(d => d.name);\n        },\n\n        openNodeEditor(node) {\n            document.getElementById('edit-node-id').value = node.id;\n            document.getElementById('edit-node-name').value = node.name;\n            document.getElementById('edit-node-radius').value = node.radius;\n            document.getElementById('edit-node-meta').value = node.meta;\n            document.getElementById('edit-node-influence').value = node.influence || 'essence';\n            nodeEditorModal.show();\n        },\n\n        saveNodeEdit() {\n            const id = parseInt(document.getElementById('edit-node-id').value);\n            const idx = this.state.waypoints.findIndex(w => w.id === id);\n            if(idx > -1) {\n                this.state.waypoints[idx].name = document.getElementById('edit-node-name').value;\n                this.state.waypoints[idx].radius = parseFloat(document.getElementById('edit-node-radius').value);\n                this.state.waypoints[idx].meta = document.getElementById('edit-node-meta').value;\n                this.state.waypoints[idx].influence = document.getElementById('edit-node-influence').value;\n                this.saveState();\n                this.renderMap();\n                nodeEditorModal.hide();\n            }\n        },\n\n        deleteNode() {\n            if(!confirm(\"Destroy this Neural Anchor?\")) return;\n            const id = parseInt(document.getElementById('edit-node-id').value);\n            this.state.waypoints = this.state.waypoints.filter(w => w.id !== id);\n            this.saveState();\n            this.renderMap();\n            nodeEditorModal.hide();\n        },\n\n        saveState() { localStorage.setItem('iso_waypoints', JSON.stringify(this.state.waypoints)); },\n        loadState() {\n            const saved = localStorage.getItem('iso_waypoints');\n            if(saved) this.state.waypoints = JSON.parse(saved);\n        },\n\n        saveInterceptionsState() { localStorage.setItem('iso_interceptions', JSON.stringify(this.state.interceptions)); },\n        loadInterceptionsState() {\n            const saved = localStorage.getItem('iso_interceptions');\n            if(saved) this.state.interceptions = JSON.parse(saved);\n        },\n\n        showInterceptions() {\n            const list = document.getElementById('interceptions-list');\n            if(this.state.interceptions.length === 0) {\n                list.innerHTML = '<p class=\"text-secondary text-center p-4\">No intercepted works found.<\/p>';\n            } else {\n                list.innerHTML = this.state.interceptions.map((item, idx) => `\n                    <div class=\"border border-secondary p-3 mb-3 rounded bg-dark\">\n                        <div class=\"d-flex justify-content-between align-items-center mb-2\">\n                            <h6 class=\"text-info fw-bold mb-0\">${item.title}<\/h6>\n                            <span class=\"small text-secondary\">${item.time}<\/span>\n                        <\/div>\n                        <p class=\"small text-light mb-2\" style=\"font-family: 'JetBrains Mono'; font-size: 0.8rem; line-height: 1.4;\">${item.snippet}<\/p>\n                        <div class=\"d-flex gap-2 border-top border-secondary pt-2 mt-2\">\n                            <a href=\"${item.url}\" target=\"_blank\" class=\"btn btn-sm btn-outline-warning fw-bold\"><i class=\"fas fa-external-link-alt me-2\"><\/i>VISIT SOURCE<\/a>\n                            <button class=\"btn btn-sm btn-outline-danger\" onclick=\"app.removeInterception(${idx})\"><i class=\"fas fa-trash\"><\/i><\/button>\n                        <\/div>\n                    <\/div>\n                `).join('');\n            }\n            new bootstrap.Modal(document.getElementById('interceptionsModal')).show();\n        },\n\n        removeInterception(idx) {\n            if(!confirm(\"Remove this log from archives?\")) return;\n            this.state.interceptions.splice(idx, 1);\n            this.saveInterceptionsState();\n            this.showInterceptions(); \n        },\n\n        saveLexiconState() { localStorage.setItem('iso_lexicon', JSON.stringify(this.state.lexicon)); },\n        loadLexiconState() {\n            const saved = localStorage.getItem('iso_lexicon');\n            if(saved) this.state.lexicon = JSON.parse(saved);\n        },\n\n        exportLexicon() {\n            if(Object.keys(this.state.lexicon).length === 0) return alert(\"Lexicon is empty.\");\n            const dataStr = \"data:text\/json;charset=utf-8,\" + encodeURIComponent(JSON.stringify(this.state.lexicon));\n            const downloadNode = document.createElement('a');\n            downloadNode.setAttribute(\"href\", dataStr);\n            downloadNode.setAttribute(\"download\", `isochronic_lexicon_${Date.now()}.json`);\n            document.body.appendChild(downloadNode);\n            downloadNode.click();\n            downloadNode.remove();\n            this.logDiag(\"Lexicon Engine\", \"Exported Lexicon State.\");\n        },\n\n        importLexicon(event) {\n            const file = event.target.files[0];\n            if (!file) return;\n            const reader = new FileReader();\n            reader.onload = (e) => {\n                try {\n                    const imported = JSON.parse(e.target.result);\n                    if (typeof imported === 'object' && !Array.isArray(imported)) {\n                        let count = 0;\n                        Object.entries(imported).forEach(([word, data]) => {\n                            if(!this.state.lexicon[word]) {\n                                this.state.lexicon[word] = { \n                                    weight: data.weight || 10, \n                                    context: data.context || \"\", \n                                    influence: data.influence || \"essence\" \n                                };\n                                count++;\n                            } else {\n                                this.state.lexicon[word].weight += (data.weight || 0);\n                            }\n                        });\n                        this.saveLexiconState();\n                        this.renderLex();\n                        this.logDiag(\"Lexicon Engine\", `Merged ${count} new Lexicon Nodes.`);\n                    }\n                } catch (err) {\n                    alert(\"Invalid JSON file.\");\n                    this.logDiag(\"Lexicon Engine\", \"Failed to import Lexicon - Invalid JSON.\");\n                }\n                event.target.value = ''; \n            };\n            reader.readAsText(file);\n        },\n\n        openLexiconEditor(word) {\n            const data = this.state.lexicon[word];\n            document.getElementById('edit-lex-word').value = word;\n            document.getElementById('edit-lex-weight').value = Math.round(data.weight);\n            document.getElementById('edit-lex-context').value = data.context || '';\n            document.getElementById('edit-lex-influence').value = data.influence || 'essence';\n            lexiconEditorModal.show();\n        },\n\n        saveLexiconEdit() {\n            const word = document.getElementById('edit-lex-word').value;\n            if(this.state.lexicon[word]) {\n                this.state.lexicon[word].weight = parseFloat(document.getElementById('edit-lex-weight').value);\n                this.state.lexicon[word].context = document.getElementById('edit-lex-context').value;\n                this.state.lexicon[word].influence = document.getElementById('edit-lex-influence').value;\n                this.saveLexiconState();\n                this.renderLex();\n                lexiconEditorModal.hide();\n            }\n        },\n\n        deleteLexiconWord() {\n            if(!confirm(\"Sever this Lexicon Node?\")) return;\n            const word = document.getElementById('edit-lex-word').value;\n            delete this.state.lexicon[word];\n            this.saveLexiconState();\n            this.renderLex();\n            lexiconEditorModal.hide();\n        },\n\n        initVoice() {\n            if (annyang) {\n                document.getElementById('voice-status').innerText = \"Voice: ACTIVE\";\n                annyang.addCallback('result', (phrases) => {\n                    const primary = phrases[0];\n                    const alternates = phrases.slice(1);\n                    this.logDiag(\"Voice Capture\", primary, alternates);\n                    \n                    if (this.state.isLocked && this.state.countdownInterval) {\n                        clearInterval(this.state.countdownInterval);\n                        document.getElementById('auto-countdown').style.display = 'none';\n                        this.logDiag(\"Auto Pilot\", \"Manual voice input detected; auto-timer aborted.\");\n                    }\n\n                    if (!this.state.isLocked) {\n                        this.processReflex(primary, false); \n                    } else if (this.state.reflex) {\n                        this.processReflex(primary, true);\n                    }\n                });\n\n                annyang.addCommands({\n                    'add :word': (w) => { this.commitWord(w, 50, \"Voice Manual\"); },\n                    'continue': () => { this.commitCheckpoint(); },\n                    'tag location': () => { this.tagLocation(); }\n                });\n                \n                annyang.start();\n            } else {\n                document.getElementById('voice-status').innerText = \"Voice: UNAVAILABLE\";\n                document.getElementById('voice-status').className = \"text-danger\";\n            }\n        },\n\n        logDiag(label, msg, alts = []) {\n            const time = new Date().toLocaleTimeString();\n            const bufferSnap = this.state.sentences.slice(this.state.lastIdx, this.state.lastIdx + 3).join(\" | \");\n            \n            let spatialTag = \"\";\n            if(this.state.activeAnchor) {\n                spatialTag = `[${this.state.activeAnchor.name}]`;\n                label = `${spatialTag} ${label}`;\n            }\n\n            this.state.diagLogs.push({ time, label, msg, alts, bufferSnap, location: this.state.activeAnchor ? this.state.activeAnchor.name : \"Drift\" });\n            \n            const term = document.getElementById('diag-terminal');\n            const entry = document.createElement('div');\n            entry.className = 'diag-entry';\n            let altHtml = alts.length > 0 ? `<span class=\"diag-alt\">Alts: ${alts.join(', ')}<\/span>` : '';\n            entry.innerHTML = `<span class=\"text-info\">[${time}]<\/span> <strong>${label}:<\/strong> ${msg} ${altHtml}`;\n            term.prepend(entry);\n        },\n\n        processReflex(sentence, isCheckpoint) {\n            const words = sentence.toLowerCase().match(\/\\b([a-z]{4,})\\b\/g) || [];\n            if (words.length === 0) return;\n\n            const strategy = document.getElementById('reflexStrategy').value;\n            let selected = words[0];\n\n            if (strategy === 'last') selected = words[words.length - 1];\n            else if (strategy === 'most' || strategy === 'least') {\n                const counts = {};\n                words.forEach(w => counts[w] = (counts[w] || 0) + 1);\n                const sorted = Object.entries(counts).sort((a,b) => strategy === 'most' ? b[1]-a[1] : a[1]-b[1]);\n                selected = sorted[0][0];\n            }\n\n            this.logDiag(\"Reflex Action\", `Synched word: \"${selected}\"`);\n            \n            const weightValue = isCheckpoint ? document.getElementById('chk-weight').value : 25;\n            this.commitWord(selected, weightValue, \"Reflex Sync\");\n\n            if (isCheckpoint) {\n                document.getElementById('chk-word').value = selected;\n                setTimeout(() => this.commitCheckpoint(), 800);\n            }\n        },\n\n        toggleScanner() {\n            const reader = document.getElementById('qr-reader');\n            if (reader.style.display === 'none') {\n                reader.style.display = 'block';\n                html5QrCode = new Html5Qrcode(\"qr-reader\");\n                html5QrCode.start({ facingMode: \"environment\" }, { fps: 10, qrbox: 200 }, (text) => {\n                    this.processInput(text);\n                    this.toggleScanner(); \n                });\n            } else {\n                html5QrCode.stop();\n                reader.style.display = 'none';\n            }\n        },\n\n        processInput(rawUrl) {\n            let url = rawUrl.trim();\n            if (!url.startsWith('http')) url = 'https:\/\/' + url;\n            this.crawl(url);\n        },\n\n        async crawl(url) {\n            const btn = document.getElementById('sync-btn');\n            btn.classList.add('active');\n            document.getElementById('crawl-overlay').style.display = 'block';\n            const spawner = setInterval(() => this.spawnIcon(), 150);\n            \n            this.logDiag(\"Crawler\", `Targeting: ${url}`);\n            this.renderLex(); \n\n            try {\n                const res = await fetch(`https:\/\/api.allorigins.win\/get?url=${encodeURIComponent(url)}`);\n                const data = await res.json();\n                const doc = new DOMParser().parseFromString(data.contents, 'text\/html');\n\n                const titleMatch = doc.querySelector('title');\n                const pageTitle = titleMatch ? titleMatch.innerText : new URL(url).hostname;\n                let snippetText = \"\";\n                const firstP = doc.querySelector('p');\n                if (firstP) {\n                    snippetText = firstP.innerText.substring(0, 200) + '...';\n                } else {\n                    snippetText = doc.body.innerText.substring(0, 200).replace(\/\\s+\/g, ' ') + '...';\n                }\n\n                this.state.interceptions.unshift({\n                    url: url,\n                    title: pageTitle,\n                    time: new Date().toLocaleTimeString(),\n                    snippet: snippetText\n                });\n                this.saveInterceptionsState();\n\n                const targets = doc.querySelectorAll('p, h1, h2, h3, h4, li, span, blockquote');\n                targets.forEach(tag => {\n                    const text = tag.innerText.toLowerCase();\n                    const words = text.match(\/\\b([a-z]{6,})\\b\/g) || [];\n                    const isEmph = tag.closest('strong, b, em, i, u') !== null;\n                    const weight = isEmph ? 50 : 10;\n\n                    words.forEach(w => {\n                        if (!this.state.lexicon[w]) {\n                            this.state.lexicon[w] = { weight: 0, context: `Sync: ${new URL(url).hostname}`, influence: 'essence' };\n                        }\n                        this.state.lexicon[w].weight += weight;\n                    });\n                });\n                \n                this.saveLexiconState();\n                requestAnimationFrame(() => this.renderLex());\n                this.logDiag(\"Crawler\", \"Sync Complete\");\n            } catch(e) { \n                this.logDiag(\"API Sync Failure\", \"Crawl Failed (CORS\/Net)\");\n            }\n            finally {\n                clearInterval(spawner);\n                btn.classList.remove('active');\n                document.getElementById('crawl-overlay').style.display = 'none';\n                this.renderLex();\n            }\n        },\n\n        spawnIcon() {\n            const icons = ['fa-bolt', 'fa-dna', 'fa-network-wired', 'fa-satellite-dish', 'fa-microchip'];\n            const i = document.createElement('i');\n            i.className = `fas ${icons[Math.floor(Math.random() * icons.length)]} spawn-icon`;\n            i.style.left = Math.random() * 95 + 'vw';\n            i.style.top = Math.random() * 95 + 'vh';\n            document.getElementById('crawl-overlay').appendChild(i);\n            setTimeout(() => i.remove(), 1500);\n        },\n\n        commitWord(word, weight, context = \"Manual\") {\n            const clean = word.toLowerCase().replace(\/[^\\w]\/g, '');\n            if (clean) {\n                if (this.state.lexicon[clean]) {\n                    this.state.lexicon[clean].weight += parseFloat(weight);\n                } else {\n                    this.state.lexicon[clean] = { weight: parseFloat(weight), context, influence: 'essence' };\n                }\n                this.saveLexiconState();\n                this.renderLex();\n                if (!this.state.loading && this.state.playing) this.generate();\n            }\n        },\n\n        renderLex() {\n            const list = document.getElementById('lex-list');\n            const sorted = Object.entries(this.state.lexicon).sort((a,b) => b[1].weight - a[1].weight).slice(0, 40);\n            list.innerHTML = sorted.map(([w, d]) => `\n                <div class=\"lex-entry ${d.weight > 40 ? 'weight-high' : ''}\">\n                    <div style=\"flex-grow:1; cursor:pointer;\" onclick=\"app.commitWord('${w}', 5, 'Reinforce')\">\n                        <span class=\"fw-bold\">${w.toUpperCase()}<\/span> \n                        <span class=\"badge ${d.influence === 'literal' ? 'bg-danger' : 'bg-secondary'} border border-dark ms-1\" style=\"font-size: 0.55rem;\">\n                            ${d.influence === 'literal' ? 'LITERAL' : 'ESSENCE'}\n                        <\/span>\n                        <div class=\"text-secondary\" style=\"font-size: 0.65rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px;\">\n                            ${d.context || 'No specific context.'}\n                        <\/div>\n                    <\/div>\n                    <div class=\"d-flex align-items-center\">\n                        <span class=\"me-3 text-warning fw-bold\">${Math.round(d.weight)}<\/span>\n                        <button class=\"btn btn-sm btn-outline-info py-0 px-2\" onclick=\"app.openLexiconEditor('${w}')\"><i class=\"fas fa-edit\"><\/i><\/button>\n                    <\/div>\n                <\/div>\n            `).join('');\n        },\n\n        async exportPDF() {\n            const { jsPDF } = window.jspdf;\n            const doc = new jsPDF();\n            let y = 20;\n            const margin = 20;\n            const pageWidth = 170; \n\n            doc.setFontSize(18); doc.text(\"ISOCHRONIC 4.0 | SPATIAL SESSION REPORT\", margin, y);\n            y += 10; doc.setFontSize(10); doc.text(`Timestamp: ${new Date().toLocaleString()}`, margin, y);\n\n            y += 15; doc.setFontSize(14); doc.text(\"SPATIAL NODES (NEURAL ANCHORS)\", margin, y);\n            y += 10; doc.setFontSize(8);\n            if(this.state.waypoints.length === 0) {\n                doc.text(\"No spatial anchors recorded.\", margin + 5, y);\n                y += 5;\n            } else {\n                this.state.waypoints.forEach(wp => {\n                    const txt = `[${wp.name.toUpperCase()}] Lat: ${wp.lat.toFixed(5)}, Lng: ${wp.lng.toFixed(5)} | Rad: ${wp.radius}m | Inf: ${wp.influence} | Meta: ${wp.meta}`;\n                    const lines = doc.splitTextToSize(txt, pageWidth);\n                    doc.text(lines, margin + 5, y);\n                    y += (lines.length * 5);\n                });\n            }\n\n            y += 10; doc.setFontSize(14); doc.text(\"WEIGHTED LEXICON\", margin, y);\n            y += 10; doc.setFontSize(8);\n            Object.entries(this.state.lexicon).sort((a,b)=>b[1].weight-a[1].weight).slice(0,50).forEach(([w,d]) => {\n                const entryText = `${w.toUpperCase()} (Wt: ${Math.round(d.weight)} | ${d.influence.toUpperCase()}) - ${d.context || 'N\/A'}`;\n                const entryLines = doc.splitTextToSize(entryText, pageWidth);\n                doc.text(entryLines, margin + 5, y);\n                y += (entryLines.length * 5);\n                if (y > 270) { doc.addPage(); y = 20; }\n            });\n\n            doc.addPage(); y = 20;\n            doc.setFontSize(14); doc.text(\"SYSTEM DIAGNOSTICS & SPATIAL LOGS\", margin, y);\n            y += 10; doc.setFontSize(8);\n            this.state.diagLogs.forEach(l => {\n                const mainMsg = `[${l.time}] ${l.label.toUpperCase()}: ${l.msg}`;\n                const mainLines = doc.splitTextToSize(mainMsg, pageWidth);\n                doc.text(mainLines, margin, y);\n                y += (mainLines.length * 5);\n\n                if (l.bufferSnap) {\n                    doc.setTextColor(150);\n                    const snapLines = doc.splitTextToSize(`   Buffer: ${l.bufferSnap}`, pageWidth - 10);\n                    doc.text(snapLines, margin + 5, y);\n                    y += (snapLines.length * 4);\n                    doc.setTextColor(0);\n                }\n                y += 2;\n                if (y > 270) { doc.addPage(); y = 20; }\n            });\n\n            doc.save(`isochronic_spatial_export_${Date.now()}.pdf`);\n        },\n\n        async generate() {\n            if (this.state.loading) return;\n            this.state.loading = true;\n            document.getElementById('gen-overlay').style.display = 'flex';\n            \n            const sortedLex = Object.entries(this.state.lexicon).sort((a,b) => b[1].weight - a[1].weight).slice(0, 15);\n            const literalWords = sortedLex.filter(e => e[1].influence === 'literal').map(e => e[0]);\n            const essenceWords = sortedLex.filter(e => e[1].influence !== 'literal').map(e => `${e[0]} (Context: ${e[1].context || 'None'})`);\n\n            const recentCache = this.state.narrativeHistory.slice(-5).join(\" \");\n            \n            let spatialContext = \"No specific spatial anchor active.\";\n            if (this.state.activeAnchor) {\n                const inf = this.state.activeAnchor.influence || 'essence';\n                if (inf === 'literal') {\n                    spatialContext = `Active Location: \"${this.state.activeAnchor.name}\". You MUST explicitly mention this location and heavily utilize its context: ${this.state.activeAnchor.meta}.`;\n                } else {\n                    spatialContext = `Active Location Concept: \"${this.state.activeAnchor.name}\". Context: ${this.state.activeAnchor.meta}. Implicitly weave the thematic essence, emotion, and atmosphere of this location into the narrative. Do NOT explicitly name it.`;\n                }\n            }\n\n            const prompt = `\n                Task: Synthesize prose.\n                \n                Literal Constraints (MUST incorporate these words directly): ${literalWords.length ? literalWords.join(', ') : 'None'}.\n                \n                Thematic Essence (Let these concepts and their contexts heavily guide the tone and meaning): ${essenceWords.length ? essenceWords.join(' | ') : 'None'}.\n                \n                Spatial Context: ${spatialContext}\n                \n                Narrative Cache (DO NOT REPEAT PHRASING FROM THIS): ${recentCache}.\n                \n                Protocol: Ensure narrative progression. The \"Essence\" elements and Spatial Concept should be the primary drivers of the narrative's soul and direction, outweighing direct word insertion. Do not recycle previous sentence structures or vocabulary.\n            `;\n\n            try {\n                const formData = new FormData();\n                formData.append('action', 'blueprint_generate_story');\n                formData.append('prompt', prompt);\n\n                const res = await fetch(ajaxurl, {\n                    method: \"POST\",\n                    body: formData\n                });\n                \n                if (!res.ok) throw new Error(`Server Error: ${res.status}`);\n                \n                const data = await res.json();\n                \n                if (!data.success) throw new Error(data.data || 'Generation failed');\n                \n                const text = data.data.story;\n                \n                this.state.narrativeHistory.push(text);\n                if(this.state.narrativeHistory.length > this.state.maxHistory) this.state.narrativeHistory.shift();\n\n                this.processText(text);\n                this.logDiag(\"API Buffer Refreshed\", \"Content synthesized via Influence Engine.\");\n                \n                \/\/ Auto-start the stream if it hasn't been launched yet\n                if (!this.state.playing) {\n                    this.openStream();\n                }\n            } catch(e) { \n                this.logDiag(\"API Sync Failure\", e.message); \n                console.error(\"Full Generation Error:\", e);\n            }\n            finally { \n                this.state.loading = false; \n                document.getElementById('gen-overlay').style.display = 'none'; \n            }\n        },\n\n        processText(text) {\n            const lines = text.match(\/[^\\.!\\?]+[\\.!\\?]+\/g) || [text];\n            lines.forEach((s) => {\n                const idx = this.state.sentences.length;\n                this.state.sentences.push(s.trim());\n                const div = document.createElement('div');\n                div.className = 'spectrum-line';\n                div.id = `wf-${idx}`;\n                div.innerHTML = s.trim().split(' ').map(w => {\n                    const clean = w.toLowerCase().replace(\/[^\\w]\/g,'');\n                    return `<span class=\"token ${this.state.lexicon[clean] ? 'text-warning fw-bold' : ''}\" onclick=\"app.commitWord('${clean}', 10)\">${w}<\/span>`;\n                }).join(' ');\n                document.getElementById('waterfall-area').appendChild(div);\n            });\n        },\n\n        openStream() { \n            this.state.playing = true; \n            document.getElementById('launch-btn-container').classList.add('d-none'); \n            streamModal.show(); \n            \n            \/\/ Instantly open the checkpoint to start off before streaming begins\n            setTimeout(() => {\n                this.triggerCheckpoint(true);\n            }, 600); \n        },\n\n        triggerCheckpoint(isInitial = false) {\n            if (!this.state.playing) return;\n            this.state.isLocked = true;\n            if (window.speechSynthesis) window.speechSynthesis.cancel();\n            if (this.state.fallbackTimer) clearTimeout(this.state.fallbackTimer);\n            \n            document.getElementById('checkpointOverlay').style.display = 'flex';\n            this.logDiag(\"System\", isInitial === true ? \"Initial Neural Checkpoint Established.\" : \"Manual Neural Checkpoint Triggered.\");\n            \n            if (this.state.autoPilotActive) {\n                this.startAutoPilotCountdown();\n            }\n        },\n\n        manualAdvance() {\n            if (!this.state.playing || this.state.isLocked) return;\n            if (window.speechSynthesis) window.speechSynthesis.cancel();\n            if (this.state.fallbackTimer) clearTimeout(this.state.fallbackTimer);\n            \n            if (!document.getElementById(`wf-${this.state.lastIdx}`)?.classList.contains('active-focus')) {\n                 this.focusLine(this.state.lastIdx);\n                 this.state.passiveCount++;\n            }\n\n            this.state.lastIdx++;\n            this.updateUI();\n            setTimeout(() => this.streamLoop(), 100);\n        },\n        \n        streamLoop() {\n            if (!this.state.playing || this.state.isLocked || this.state.lastIdx >= this.state.sentences.length) return;\n            \n            if (this.state.passiveCount >= 10) {\n                this.state.isLocked = true;\n                if (window.speechSynthesis) window.speechSynthesis.cancel();\n                document.getElementById('checkpointOverlay').style.display = 'flex';\n                this.logDiag(\"System\", \"Neural Checkpoint Triggered.\");\n                \n                if (this.state.autoPilotActive) {\n                    this.startAutoPilotCountdown();\n                }\n                return;\n            }\n\n            const currentText = this.state.sentences[this.state.lastIdx];\n            \n            const availableVoices = window.speechSynthesis ? window.speechSynthesis.getVoices() : [];\n            \n            if (!window.speechSynthesis || availableVoices.length === 0) {\n                this.focusLine(this.state.lastIdx);\n                this.state.passiveCount++;\n                this.updateUI();\n                \n                const wordCount = currentText.split(' ').length;\n                const readDelayMs = Math.max(2000, wordCount * 300); \n                \n                this.state.fallbackTimer = setTimeout(() => {\n                    if (this.state.playing && !this.state.isLocked) {\n                        this.state.lastIdx++;\n                        this.streamLoop();\n                    }\n                }, readDelayMs);\n                return;\n            }\n\n            const utter = new SpeechSynthesisUtterance(currentText);\n            utter.onstart = () => { \n                this.focusLine(this.state.lastIdx); \n                this.state.passiveCount++; \n                this.updateUI(); \n            };\n            utter.onend = () => { this.state.lastIdx++; setTimeout(() => this.streamLoop(), 200); };\n            speechSynthesis.speak(utter);\n        },\n\n        startAutoPilotCountdown() {\n            const duration = parseFloat(document.getElementById('auto-timer').value);\n            let remaining = duration;\n            const display = document.getElementById('auto-countdown');\n            const secSpan = document.getElementById('countdown-sec');\n            \n            display.style.display = 'block';\n            secSpan.innerText = remaining.toFixed(1);\n\n            this.state.countdownInterval = setInterval(async () => {\n                remaining -= 0.5;\n                secSpan.innerText = remaining.toFixed(1);\n                \n                if (remaining <= 0) {\n                    clearInterval(this.state.countdownInterval);\n                    this.logDiag(\"Auto Pilot\", \"Timer expired. Synchronizing goal alignment...\");\n                    await this.runAutoPilotAdjustment();\n                }\n            }, 500);\n        },\n\n        async runAutoPilotAdjustment() {\n            const goal = document.getElementById('auto-goal').value || \"System Autonomy\";\n            const currentLex = Object.keys(this.state.lexicon).join(\", \");\n            \n            const prompt = `Goal: ${goal}. Current Lexicon: ${currentLex}. \n            Provide a JSON response containing:\n            1. \"weights\": A dictionary updating 3 existing lexicon words with higher weights (50-100) to meet the goal.\n            2. \"newWords\": 3 additional lexicon words that provide guidance toward this goal.\n            Return ONLY valid JSON.`;\n\n            try {\n                const formData = new FormData();\n                formData.append('action', 'blueprint_generate_story');\n                formData.append('prompt', prompt);\n\n                const res = await fetch(ajaxurl, {\n                    method: \"POST\",\n                    body: formData\n                });\n                \n                if (!res.ok) throw new Error(`Server Error: ${res.status}`);\n                \n                const data = await res.json();\n                \n                if (!data.success) throw new Error(data.data || 'Generation failed');\n\n                const cleanJson = data.data.story.replace(\/```json|```\/g, \"\").trim();\n                const adjustment = JSON.parse(cleanJson);\n\n                Object.entries(adjustment.weights).forEach(([word, wt]) => this.commitWord(word, wt, \"AutoPilot Weight Shift\"));\n                adjustment.newWords.forEach(word => this.commitWord(word, 75, \"AutoPilot Goal Injection\"));\n\n                this.logDiag(\"Auto Pilot\", `Goal aligned: ${goal}`);\n                this.commitCheckpoint();\n            } catch (e) {\n                this.logDiag(\"Auto Pilot Error\", e.message);\n                console.error(\"AutoPilot Error:\", e);\n                this.commitCheckpoint();\n            }\n        },\n\n        focusLine(idx) {\n            document.querySelectorAll('.spectrum-line').forEach(l => l.classList.remove('active-focus'));\n            const el = document.getElementById(`wf-${idx}`);\n            if (el) { \n                el.classList.add('active-focus'); \n                document.getElementById('modalScroll').scrollTo({ top: el.offsetTop - 350, behavior: 'smooth' }); \n            }\n        },\n\n        commitCheckpoint() {\n            if (this.state.countdownInterval) clearInterval(this.state.countdownInterval);\n            document.getElementById('auto-countdown').style.display = 'none';\n\n            const w = document.getElementById('chk-word').value;\n            const wt = document.getElementById('chk-weight').value;\n            if (w) this.commitWord(w, wt, \"Checkpoint Manual\");\n            document.getElementById('checkpointOverlay').style.display = 'none';\n            this.state.isLocked = false;\n            this.state.passiveCount = 0;\n            if (window.annyang) window.annyang.resume(); \n            this.streamLoop();\n        },\n\n        updateUI() { document.getElementById('drift-status').innerText = `Passive Drift: ${this.state.passiveCount}\/10`; },\n        bufferManager() { \n            if (this.state.sentences.length - this.state.lastIdx <= 3 && this.state.playing && !this.state.loading) {\n                this.logDiag(\"v2.6 Core Latency\", \"50% Threshold Active.\");\n                this.generate(); \n            }\n        },\n        closeStream() { \n            this.state.playing = false; \n            if (this.state.countdownInterval) clearInterval(this.state.countdownInterval);\n            if (window.speechSynthesis) window.speechSynthesis.cancel(); \n            if (this.state.fallbackTimer) clearTimeout(this.state.fallbackTimer);\n            streamModal.hide(); \n        }\n    };\n\n    \/\/ Initialize when the DOM inside the shortcode is ready\n    if (document.readyState === 'loading') {\n        document.addEventListener('DOMContentLoaded', () => app.init());\n    } else {\n        app.init();\n    }\n    <\/script>\n    \n    \n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"page-full.php","meta":{"footnotes":""},"class_list":["post-36","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/demo.qrjournal.org\/index.php\/wp-json\/wp\/v2\/pages\/36","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/demo.qrjournal.org\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/demo.qrjournal.org\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/demo.qrjournal.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/demo.qrjournal.org\/index.php\/wp-json\/wp\/v2\/comments?post=36"}],"version-history":[{"count":1,"href":"https:\/\/demo.qrjournal.org\/index.php\/wp-json\/wp\/v2\/pages\/36\/revisions"}],"predecessor-version":[{"id":37,"href":"https:\/\/demo.qrjournal.org\/index.php\/wp-json\/wp\/v2\/pages\/36\/revisions\/37"}],"wp:attachment":[{"href":"https:\/\/demo.qrjournal.org\/index.php\/wp-json\/wp\/v2\/media?parent=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}