PageSourceSearch

https://baibaoshu.net/assets/StudyZen-_VjAcxWJ.js

js baibaoshu.net collected 2026-10-02 16:09:25 UTC 201,380 bytes, 1 lines download raw bytes

1import{m as e,l as t,R as n}from"./vendor-misc-DUP22bK2.js";import{aq as a,bR as r,eF as o,h5 as s,ak as i,bN as l,T as d,eq as c,ar as h,c8 as u,dN as m,gg as p,g$ as x,a0 as b,a1 as f,fi as g,gl as w,gm as k,a7 as v,a as y,c3 as j,ck as Z,fY as N,aI as C,gn as E,c2 as T,bT as F,eb as I,dk as S,f6 as A,eQ as D,bU as _,B,U as $,fj as L,af as M,ai as q,eN as z,bd as P,fq as O,h6 as R,gz as H,gq as W,t as G,z as U,h3 as J,dn as V}from"./index-x7cAXa-6.js";import{g as K,c as Y,r as Q,b as X,S as ee}from"./StudySheet-DZx2eQ2R.js";import{c as te,S as ne}from"./useVerseMemorize-CqsgXgOv.js";import{f as ae,s as re,b as oe}from"./tierSections-C4onGmjG.js";import{b as se,g as ie,t as le}from"./contentFavorites-DdSYU7Dg.js";import{trackLiteEvent as de}from"./liteAnalytics-B8ZwBBt0.js";import{u as ce,r as he,c as ue,a as me}from"./useNextStepTracking-9_FBL6pO.js";import{C as pe}from"./ChapterQuizEntry-CaPONtas.js";import{fetchAvailableChapters as xe}from"./chapterQuiz-BFkxeZDw.js";import{textForLang as be,convertToSimplified as fe,convertToTraditional as ge,htmlForLang as we}from"./traditional-chinese-2pkNGbDt.js";import{chapterQuizKey as ke}from"./chapterQuizCore-BDm58LAE.js";import{G as ve,cZ as ye,bi as je,f as Ze,c5 as Ne,br as Ce,b1 as Ee,d7 as Te,cb as Fe,cm as Ie,aa as Se,b7 as Ae,d0 as De,cw as _e,ay as Be,cP as $e,ci as Le,b_ as Me,bm as qe,bZ as ze,P as Pe,t as Oe,at as Re,au as He,bc as We,u as Ge,aQ as Ue,cU as Je,cM as Ve,c4 as Ke,M as Ye,R as Qe,O as Xe,Q as et,aP as tt,v as nt,cp as at,S as rt,T as ot,e as st,ap as it}from"./vendor-icons-vC33TuHE.js";import{f as lt}from"./fillTemplate-D-zmJcmb.js";import{a as dt,s as ct}from"./textToSpeech-0TfR-IcC.js";import{u as ht,i as ut,f as mt,c as pt,r as xt,S as bt,b as ft,a as gt,A as wt,g as kt,h as vt}from"./copyWithToast-B9hFO_J-.js";import{O as yt,o as jt}from"./originalLanguageSources-zWUCGb7d.js";import{s as Zt,b as Nt}from"./langLab-DdXGK4Gd.js";import{f as Ct}from"./originalPronunciation-BKAMblHB.js";import{f as Et}from"./langLab-1xDgjord.js";import{f as Tt,G as Ft}from"./GrammarHelperSheet-DTqmbbfY.js";import{E as It}from"./ExhibitDrawer-B-pHI1u5.js";import{fetchExhibit as St}from"./museum-BJ-U0RNl.js";import{u as At,I as Dt}from"./InlineMdBoldToolbar-Dw4XKJVD.js";import{u as _t}from"./useScripturePeek-Cvk9aoWN.js";import{b as Bt}from"./AnnotationNoteSheet-eNoX1e7o.js";import{E as $t}from"./admin-ckK65VX3.js";import{a as Lt,u as Mt,s as qt}from"./bibleIllustrations-Dacd2bJh.js";import{p as zt}from"./markdownParser-DEIJFl6v.js";import{u as Pt}from"./vendor-i18n-B2TU2mS1.js";import{R as Ot}from"./RelatedPosters-DsFKYb7j.js";import"./vendor-supabase-TkIFdNNf.js";import"./chinese-language-CLYDn-o3.js";import"./ChapterBadges-Bchl3jlh.js";import"./scriptureRef-CfrgaEkT.js";import"./geminiTTS-DwaZdgye.js";import"./ChapterQuizSheet-CMeBROgQ.js";import"./inlineMarkdown-xGO4AIxO.js";import"./ContentRating-BGnsLYkl.js";import"./contentRatings-Dx3VUgMK.js";import"./googleTTS-BRO7Ma83.js";import"./annotationCard-BlMhJwDP.js";import"./clipboard-CvMPH2Rq.js";import"./ScripturePeekSheet-DhADNULZ.js";import"./VersesMissingNotice-BjB06FJP.js";import"./catalog-BIvy0mVU.js";function Rt(e,t){var n,a;if(!e||!t.length)return e;if("undefined"==typeof window||"undefined"==typeof DOMParser)return e;const r=t.map(e=>e.toLowerCase()).filter(Boolean);if(!r.length)return e;try{const t=(new DOMParser).parseFromString(e,"text/html"),o=t.createTreeWalker(t.body,NodeFilter.SHOW_TEXT,null),s=[];for(;;){const e=o.nextNode();if(!e)break;const t=e.parentElement;if(!t)continue;const n=t.tagName;if("SCRIPT"===n||"STYLE"===n||t.closest("[data-bible-search-mark]"))continue;if("http://www.w3.org/2000/svg"===t.namespaceURI&&!t.closest("text"))continue;const a=(e.nodeValue||"").toLowerCase();r.some(e=>a.includes(e))&&s.push(e)}for(const e of s){const o=e.nodeValue||"",s=o.toLowerCase(),i=[];for(const e of r){let t=0;for(;;){const n=s.indexOf(e,t);if(n<0)break;i.push([n,n+e.length]),t=n+e.length}}i.sort((e,t)=>e[0]-t[0]||t[1]-e[1]);const l=[];let d=-1;for(const[e,t]of i)e>=d&&(l.push([e,t]),d=t);if(!l.length)continue;const c=t.createDocumentFragment();let h=0;for(const[a,r]of l){a>h&&c.appendChild(t.createTextNode(o.slice(h,a)));const s="http://www.w3.org/2000/svg"===(null==(n=e.parentElement)?void 0:n.namespaceURI)?t.createElementNS("http://www.w3.org/2000/svg","tspan"):t.createElement("mark");s.setAttribute("data-bible-search-mark","1"),s.textContent=o.slice(a,r),c.appendChild(s),h=r}h<o.length&&c.appendChild(t.createTextNode(o.slice(h))),null==(a=e.parentNode)||a.replaceChild(c,e)}return t.body.innerHTML}catch{return e}}let Ht=null;async function Wt(e,t){if(!e||!Number.isFinite(t)||t<1)return null;Ht||(Ht=async function(){const e=new Map;try{const t=[...await r()||[]].sort((e,t)=>
1(e.weekNum||0)-(t.weekNum||0));for(const n of t){const t=o(n.scripture);if(t)for(const r of t.chapters){const t=a(r.book,r.chapter);e.has(t)||e.set(t,{weekNum:n.weekNum,questId:n.id,title:String(n.title||"")})}}}catch{}return e}());return(await Ht).get(a(e,t))??null}const Gt={"1 Corinthians:12":[{nationId:"vn",nationZh:"越南",workTitleZh:"恋恋三季"},{nationId:"za",nationZh:"南非",workTitleZh:"布料"},{nationId:"it",nationZh:"意大利",workTitleZh:"我的天才女友"},{nationId:"ar",nationZh:"阿根廷",workTitleZh:"永航员"},{nationId:"ug",nationZh:"乌干达",workTitleZh:"卡推女王"},{nationId:"am",nationZh:"亚美尼亚",workTitleZh:"美国人"}],"1 Corinthians:13":[{nationId:"sa",nationZh:"沙特阿拉伯",workTitleZh:"巴拉卡遇上巴拉卡"},{nationId:"hu",nationZh:"匈牙利",workTitleZh:"《门》"}],"1 Corinthians:3":[{nationId:"kr",nationZh:"韩国",workTitleZh:"米纳里"}],"1 Corinthians:6":[{nationId:"mn",nationZh:"蒙古",workTitleZh:"售货员"},{nationId:"bd",nationZh:"孟加拉国",workTitleZh:"电视机"},{nationId:"ht",nationZh:"海地",workTitleZh:"呼吸、眼睛、记忆"}],"1 John:4":[{nationId:"ph",nationZh:"菲律宾",workTitleZh:"奇迹"}],"1 Kings:17":[{nationId:"sy",nationZh:"叙利亚",workTitleZh:"我失去了影子的那天"}],"1 Kings:19":[{nationId:"kr",nationZh:"韩国",workTitleZh:"独自生活的人们"},{nationId:"au",nationZh:"澳大利亚",workTitleZh:"参孙和大利拉"},{nationId:"ir",nationZh:"伊朗",workTitleZh:"樱桃的滋味"},{nationId:"is",nationZh:"冰岛",workTitleZh:"《宇宙的天使》"}],"1 Peter:3":[{nationId:"mn",nationZh:"蒙古",workTitleZh:"风之城"}],"1 Samuel:16":[{nationId:"dz",nationZh:"阿尔及利亚",workTitleZh:"帕皮卡"}],"1 Samuel:8":[{nationId:"pk",nationZh:"巴基斯坦",workTitleZh:"一个芒果爆炸的案件"}],"1 Thessalonians:5":[{nationId:"iq",nationZh:"伊拉克",workTitleZh:"梦"}],"1 Timothy:3":[{nationId:"ng",nationZh:"尼日利亚",workTitleZh:"紫木槿"}],"1 Timothy:5":[{nationId:"th",nationZh:"泰国",workTitleZh:"姥姥的外孙"},{nationId:"pe",nationZh:"秘鲁",workTitleZh:"永恒"}],"2 Corinthians:1":[{nationId:"ca",nationZh:"加拿大",workTitleZh:"拉扎老师"}],"2 Corinthians:4":[{nationId:"tr",nationZh:"土耳其",workTitleZh:"雪"},{nationId:"cl",nationZh:"智利",workTitleZh:"不"}],"Acts:17":[{nationId:"ca",nationZh:"加拿大",workTitleZh:"快跑者阿塔纳朱阿特"},{nationId:"gr",nationZh:"希腊",workTitleZh:"狗牙"},{nationId:"lb",nationZh:"黎巴嫩",workTitleZh:"先知"},{nationId:"pg",nationZh:"巴布亚新几内亚",workTitleZh:"一生一万年"}],"Acts:2":[{nationId:"nz",nationZh:"新西兰",workTitleZh:"鲸骑士"},{nationId:"ua",nationZh:"乌克兰",workTitleZh:"诗集《科布扎尔》"},{nationId:"pg",nationZh:"巴布亚新几内亚",workTitleZh:"母亲叫我亚尔特普"}],"Acts:5":[{nationId:"ro",nationZh:"罗马尼亚",workTitleZh:"绞刑者之林"},{nationId:"tz",nationZh:"坦桑尼亚",workTitleZh:"拉锯"},{nationId:"cz",nationZh:"捷克",workTitleZh:"好兵帅克"}],"Colossians:2":[{nationId:"my",nationZh:"马来西亚",workTitleZh:"南巫"},{nationId:"it",nationZh:"意大利",workTitleZh:"奇迹"}],"Colossians:3":[{nationId:"nl",nationZh:"荷兰",workTitleZh:"性格"},{nationId:"no",nationZh:"挪威",workTitleZh:"星期日的另一面"}],"Deuteronomy:10":[{nationId:"gr",nationZh:"希腊",workTitleZh:"香料共和国"},{nationId:"pk",nationZh:"巴基斯坦",workTitleZh:"游隼"},{nationId:"be",nationZh:"比利时",workTitleZh:"托里与洛奇塔"}],"Deuteronomy:16":[{nationId:"ar",nationZh:"阿根廷",workTitleZh:"谜一样的双眼"}],"Deuteronomy:19":[{nationId:"dk",nationZh:"丹麦",workTitleZh:"狩猎"},{nationId:"sy",nationZh:"叙利亚",workTitleZh:"越境"}],"Deuteronomy:24":[{nationId:"ph",nationZh:"菲律宾",workTitleZh:"星期日选美皇后"},{nationId:"be",nationZh:"比利时",workTitleZh:"罗塞塔"},{nationId:"mm",nationZh:"缅甸",workTitleZh:"再见瓦城"}],"Ecclesiastes:12":[{nationId:"es",nationZh:"西班牙",workTitleZh:"风之影"}],"Ecclesiastes:3":[{nationId:"cz",nationZh:"捷克",workTitleZh:"严密监视的列车"}],"Ecclesiastes:4":[{nationId:"sd",nationZh:"苏丹",workTitleZh:"谈论树木"},{nationId:"kp",nationZh:"朝鲜",workTitleZh:"控诉"}
1],"Ecclesiastes:8":[{nationId:"mx",nationZh:"墨西哥",workTitleZh:"佩德罗·巴拉莫"}],"Ecclesiastes:9":[{nationId:"ps",nationZh:"巴勒斯坦",workTitleZh:"加沙,我的爱"}],"Ephesians:1":[{nationId:"ca",nationZh:"加拿大",workTitleZh:"绿山墙的安妮"}],"Ephesians:2":[{nationId:"gb",nationZh:"英国",workTitleZh:"轻轻摇晃"},{nationId:"fr",nationZh:"法国",workTitleZh:"悲惨世界"},{nationId:"mx",nationZh:"墨西哥",workTitleZh:"我已不在这里"},{nationId:"it",nationZh:"意大利",workTitleZh:"阿杜阿"},{nationId:"lb",nationZh:"黎巴嫩",workTitleZh:"西贝鲁特"},{nationId:"kw",nationZh:"科威特",workTitleZh:"竹竿"}],"Ephesians:4":[{nationId:"za",nationZh:"南非",workTitleZh:"除了真相,别无所有"},{nationId:"es",nationZh:"西班牙",workTitleZh:"蜂巢幽灵"},{nationId:"cz",nationZh:"捷克",workTitleZh:"无权者的权力"},{nationId:"mm",nationZh:"缅甸",workTitleZh:"钱有四条腿"}],"Ephesians:5":[{nationId:"kr",nationZh:"韩国",workTitleZh:"熔炉"},{nationId:"ph",nationZh:"菲律宾",workTitleZh:"七十年代"},{nationId:"nz",nationZh:"新西兰",workTitleZh:"战士奇兵"},{nationId:"cl",nationZh:"智利",workTitleZh:"幽灵之家"},{nationId:"ro",nationZh:"罗马尼亚",workTitleZh:"集体"},{nationId:"cu",nationZh:"古巴",workTitleZh:"露西亚"},{nationId:"mz",nationZh:"莫桑比克",workTitleZh:"《妮凯切:一则多妻婚姻故事》"},{nationId:"pt",nationZh:"葡萄牙",workTitleZh:"《里卡多·雷伊斯逝世之年》"}],"Ephesians:6":[{nationId:"my",nationZh:"马来西亚",workTitleZh:"一路有你"},{nationId:"ca",nationZh:"加拿大",workTitleZh:"双喜"},{nationId:"mn",nationZh:"蒙古",workTitleZh:"小黄狗的窝"},{nationId:"ug",nationZh:"乌干达",workTitleZh:"阿比西尼亚编年史"}],"Exodus:18":[{nationId:"kg",nationZh:"吉尔吉斯斯坦",workTitleZh:"偷光的人"}],"Exodus:20":[{nationId:"ge",nationZh:"格鲁吉亚",workTitleZh:"第八种人生(献给布里尔卡)"}],"Exodus:35":[{nationId:"ug",nationZh:"乌干达",workTitleZh:"谁杀了亚历克斯队长?"},{nationId:"cd",nationZh:"刚果民主共和国",workTitleZh:"金沙萨交响曲"},{nationId:"am",nationZh:"亚美尼亚",workTitleZh:"石榴的颜色"}],"Ezekiel:18":[{nationId:"sy",nationZh:"叙利亚",workTitleZh:"爱情的黑暗面"}],"Ezekiel:34":[{nationId:"pl",nationZh:"波兰",workTitleZh:"基督圣体"}],"Galatians:3":[{nationId:"us",nationZh:"美国",workTitleZh:"为奴十二年"},{nationId:"eg",nationZh:"埃及",workTitleZh:"请勿见怪"},{nationId:"np",nationZh:"尼泊尔",workTitleZh:"黑母鸡"}],"Galatians:5":[{nationId:"tr",nationZh:"土耳其",workTitleZh:"自由之路"}],"Galatians:6":[{nationId:"se",nationZh:"瑞典",workTitleZh:"一个叫欧维的男人决定去死"},{nationId:"no",nationZh:"挪威",workTitleZh:"克里斯汀·拉夫兰斯达特"},{nationId:"cz",nationZh:"捷克",workTitleZh:"生命中不能承受之轻"},{nationId:"ge",nationZh:"格鲁吉亚",workTitleZh:"我的快乐家庭"}],"Genesis:1":[{nationId:"sd",nationZh:"苏丹",workTitleZh:"北迁季节"}],"Genesis:16":[{nationId:"be",nationZh:"比利时",workTitleZh:"黑姐妹街"},{nationId:"uz",nationZh:"乌兹别克斯坦",workTitleZh:"法丽达的两千首歌"},{nationId:"jo",nationZh:"约旦",workTitleZh:"盐柱"}],"Genesis:2":[{nationId:"cr",nationZh:"哥斯达黎加",workTitleZh:"《甘多卡的疯女人》"}],"Genesis:33":[{nationId:"cu",nationZh:"古巴",workTitleZh:"梦见古巴"}],"Habakkuk:2":[{nationId:"cd",nationZh:"刚果民主共和国",workTitleZh:"83 号电车"}],"Hebrews:13":[{nationId:"au",nationZh:"澳大利亚",workTitleZh:"幸运里程"},{nationId:"se",nationZh:"瑞典",workTitleZh:"移民"},{nationId:"ru",nationZh:"俄罗斯",workTitleZh:"伊万·杰尼索维奇的一天"},{nationId:"il",nationZh:"以色列(现代国家)",workTitleZh:"乐队来访"}],"Hebrews:9":[{nationId:"th",nationZh:"泰国",workTitleZh:"能召回前世的布米叔叔"}],"Isaiah:1":[{nationId:"et",nationZh:"埃塞俄比亚",workTitleZh:"勇气"},{nationId:"ua",nationZh:"乌克兰",workTitleZh:"克朗代克"},{nationId:"jo",nationZh:"约旦",workTitleZh:"但愿是男孩"},{nationId:"sa",nationZh:"沙特阿拉伯",workTitleZh:"鸽子的项圈"},{nationId:"af",nationZh:"阿富汗",workTitleZh:"致总统的信"}],"Isaiah:10":[{nationId:"dz",nationZh:"阿尔及利亚",workTitleZh:"阿尔及尔之战"}],"Isaiah:42":[{nationId:"lk",nationZh:"斯里兰卡",workTitleZh:"滑稽小子"},{nationId:"mn",nationZh:"蒙古",workTitleZh:"哭泣的骆驼"},{nationId:"ru",nationZh:"俄罗斯",workTitleZh:"高个儿"}],"Isaiah:5":[{nationId:"be",nationZh:"比利时",workTitleZh:"比利时的悲伤"}],"Isaiah:58":[{nationId:"br",nationZh:"巴西",workTitleZh:"上帝之城"}
1,{nationId:"ma",nationZh:"摩洛哥",workTitleZh:"只为面包"},{nationId:"ht",nationZh:"海地",workTitleZh:"露水主人"},{nationId:"ps",nationZh:"巴勒斯坦",workTitleZh:"200 米"}],"James:1":[{nationId:"ph",nationZh:"菲律宾",workTitleZh:"小圈子"},{nationId:"fr",nationZh:"法国",workTitleZh:"怒火青春"},{nationId:"eg",nationZh:"埃及",workTitleZh:"碰撞"},{nationId:"tz",nationZh:"坦桑尼亚",workTitleZh:"坦桑尼亚列车"},{nationId:"uz",nationZh:"乌兹别克斯坦",workTitleZh:"你不是孤儿"},{nationId:"cu",nationZh:"古巴",workTitleZh:"草莓与巧克力"},{nationId:"ge",nationZh:"格鲁吉亚",workTitleZh:"蓝色山脉,或不可思议的故事"}],"James:2":[{nationId:"kr",nationZh:"韩国",workTitleZh:"寄生虫"},{nationId:"eg",nationZh:"埃及",workTitleZh:"亚库比恩公寓"},{nationId:"it",nationZh:"意大利",workTitleZh:"偷自行车的人"},{nationId:"se",nationZh:"瑞典",workTitleZh:"吃睡死"},{nationId:"pl",nationZh:"波兰",workTitleZh:"玩偶"},{nationId:"bd",nationZh:"孟加拉国",workTitleZh:"泥鸟"},{nationId:"no",nationZh:"挪威",workTitleZh:"饥饿"},{nationId:"cl",nationZh:"智利",workTitleZh:"马丘卡"},{nationId:"np",nationZh:"尼泊尔",workTitleZh:"白日"},{nationId:"ir",nationZh:"伊朗",workTitleZh:"小鞋子"},{nationId:"kh",nationZh:"柬埔寨",workTitleZh:"稻田人"},{nationId:"dz",nationZh:"阿尔及利亚",workTitleZh:"穷人之子"}],"James:3":[{nationId:"th",nationZh:"泰国",workTitleZh:"判决"},{nationId:"fr",nationZh:"法国",workTitleZh:"墙壁之间"},{nationId:"cl",nationZh:"智利",workTitleZh:"普通女人"}],"James:5":[{nationId:"us",nationZh:"美国",workTitleZh:"美国工厂"},{nationId:"bd",nationZh:"孟加拉国",workTitleZh:"孟加拉制造"},{nationId:"nl",nationZh:"荷兰",workTitleZh:"马克斯·哈弗拉尔"},{nationId:"ec",nationZh:"厄瓜多尔",workTitleZh:"瓦西蓬戈"}],"Jeremiah:29":[{nationId:"ir",nationZh:"伊朗",workTitleZh:"我在伊朗长大"}],"Jeremiah:31":[{nationId:"mg",nationZh:"马达加斯加",workTitleZh:"《努尔,1947》"}],"Jeremiah:6":[{nationId:"lk",nationZh:"斯里兰卡",workTitleZh:"被遗忘的土地"}],"Job:19":[{nationId:"ru",nationZh:"俄罗斯",workTitleZh:"利维坦"}],"John:1":[{nationId:"ng",nationZh:"尼日利亚",workTitleZh:"瓦解"},{nationId:"pe",nationZh:"秘鲁",workTitleZh:"彩塑男孩"},{nationId:"pk",nationZh:"巴基斯坦",workTitleZh:"乐土"},{nationId:"ma",nationZh:"摩洛哥",workTitleZh:"蓝色长袍"},{nationId:"ae",nationZh:"阿联酋",workTitleZh:"海之影"}],"John:10":[{nationId:"fr",nationZh:"法国",workTitleZh:"人与神"},{nationId:"ma",nationZh:"摩洛哥",workTitleZh:"上帝的马"},{nationId:"sd",nationZh:"苏丹",workTitleZh:"你会在二十岁时死去"}],"John:11":[{nationId:"be",nationZh:"比利时",workTitleZh:"亲密"}],"John:12":[{nationId:"ke",nationZh:"肯尼亚",workTitleZh:"一粒麦种"}],"John:19":[{nationId:"iq",nationZh:"伊拉克",workTitleZh:"洗尸人"}],"John:4":[{nationId:"kg",nationZh:"吉尔吉斯斯坦",workTitleZh:"贾米拉"}],"John:8":[{nationId:"ar",nationZh:"阿根廷",workTitleZh:"官方说法"},{nationId:"lb",nationZh:"黎巴嫩",workTitleZh:"焦糖"},{nationId:"mu",nationZh:"毛里求斯",workTitleZh:"《伊芙走出废墟》"}],"John:9":[{nationId:"za",nationZh:"南非",workTitleZh:"昨日"},{nationId:"ug",nationZh:"乌干达",workTitleZh:"金图"},{nationId:"pg",nationZh:"巴布亚新几内亚",workTitleZh:"鳄鱼"}],"Jonah:4":[{nationId:"kr",nationZh:"韩国",workTitleZh:"密阳"}],"Leviticus:19":[{nationId:"ng",nationZh:"尼日利亚",workTitleZh:"这就是我的愿望"},{nationId:"kz",nationZh:"哈萨克斯坦",workTitleZh:"给斯大林的礼物"},{nationId:"lk",nationZh:"斯里兰卡",workTitleZh:"流浪的迪潘"},{nationId:"gr",nationZh:"希腊",workTitleZh:"仙尼亚"}],"Leviticus:25":[{nationId:"au",nationZh:"澳大利亚",workTitleZh:"城堡"}],"Luke:10":[{nationId:"ro",nationZh:"罗马尼亚",workTitleZh:"山之外"},{nationId:"tz",nationZh:"坦桑尼亚",workTitleZh:"女儿们"},{nationId:"ec",nationZh:"厄瓜多尔",workTitleZh:"有多远"},{nationId:"sy",nationZh:"叙利亚",workTitleZh:"洞穴里的医院"}],"Luke:12":[{nationId:"lr",nationZh:"利比里亚",workTitleZh:"《糖滩之屋》"}
1],"Luke:14":[{nationId:"pg",nationZh:"巴布亚新几内亚",workTitleZh:"图卡纳:谁该负责"}],"Luke:15":[{nationId:"jp",nationZh:"日本",workTitleZh:"无缘社会"},{nationId:"id",nationZh:"印度尼西亚",workTitleZh:"照看隔壁店"},{nationId:"iq",nationZh:"伊拉克",workTitleZh:"巴比伦之子"}],"Luke:18":[{nationId:"mx",nationZh:"墨西哥",workTitleZh:"暴风雨"},{nationId:"cd",nationZh:"刚果民主共和国",workTitleZh:"顺流而下到金沙萨"}],"Luke:19":[{nationId:"za",nationZh:"南非",workTitleZh:"黑帮暴徒"},{nationId:"se",nationZh:"瑞典",workTitleZh:"同一血缘"},{nationId:"ke",nationZh:"肯尼亚",workTitleZh:"内罗毕半条命"},{nationId:"es",nationZh:"西班牙",workTitleZh:"平行母亲"},{nationId:"ec",nationZh:"厄瓜多尔",workTitleZh:"鼠、耗子与窃贼"},{nationId:"af",nationZh:"阿富汗",workTitleZh:"追风筝的人"}],"Luke:22":[{nationId:"jp",nationZh:"日本",workTitleZh:"沉默"}],"Luke:24":[{nationId:"dk",nationZh:"丹麦",workTitleZh:"巴贝特之宴"}],"Luke:3":[{nationId:"sd",nationZh:"苏丹",workTitleZh:"再见,朱莉娅"}],"Mark:10":[{nationId:"eg",nationZh:"埃及",workTitleZh:"开罗三部曲"},{nationId:"it",nationZh:"意大利",workTitleZh:"豹"},{nationId:"ke",nationZh:"肯尼亚",workTitleZh:"绝症女孩"},{nationId:"lb",nationZh:"黎巴嫩",workTitleZh:"何以为家"},{nationId:"uz",nationZh:"乌兹别克斯坦",workTitleZh:"淘气包"},{nationId:"mm",nationZh:"缅甸",workTitleZh:"僧侣"},{nationId:"sa",nationZh:"沙特阿拉伯",workTitleZh:"瓦嘉达"},{nationId:"af",nationZh:"阿富汗",workTitleZh:"奥萨玛"}],"Mark:12":[{nationId:"np",nationZh:"尼泊尔",workTitleZh:"白色大地"}],"Mark:3":[{nationId:"nl",nationZh:"荷兰",workTitleZh:"安东尼娅家族"}],"Mark:7":[{nationId:"kz",nationZh:"哈萨克斯坦",workTitleZh:"阿拜之路"}],"Mark:8":[{nationId:"mm",nationZh:"缅甸",workTitleZh:"玻璃宫殿"}],"Mark:9":[{nationId:"se",nationZh:"瑞典",workTitleZh:"第七封印"},{nationId:"ec",nationZh:"厄瓜多尔",workTitleZh:"水之女王"},{nationId:"iq",nationZh:"伊拉克",workTitleZh:"乌龟也会飞"}],"Matthew:10":[{nationId:"in",nationZh:"印度",workTitleZh:"三傻大闹宝莱坞"}],"Matthew:13":[{nationId:"id",nationZh:"印度尼西亚",workTitleZh:"天虹战队小学"}],"Matthew:18":[{nationId:"au",nationZh:"澳大利亚",workTitleZh:"防兔篱笆"},{nationId:"tr",nationZh:"土耳其",workTitleZh:"野马"},{nationId:"cz",nationZh:"捷克",workTitleZh:"给我一个爸"},{nationId:"kg",nationZh:"吉尔吉斯斯坦",workTitleZh:"白轮船"},{nationId:"kh",nationZh:"柬埔寨",workTitleZh:"他们先杀了我父亲"}
1,{nationId:"jo",nationZh:"约旦",workTitleZh:"希布"},{nationId:"ru",nationZh:"俄罗斯",workTitleZh:"卡拉马佐夫兄弟"},{nationId:"cu",nationZh:"古巴",workTitleZh:"行为"},{nationId:"am",nationZh:"亚美尼亚",workTitleZh:"我们和我们的山"},{nationId:"il",nationZh:"以色列(现代国家)",workTitleZh:"承诺"}],"Matthew:19":[{nationId:"uz",nationZh:"乌兹别克斯坦",workTitleZh:"旧日"}],"Matthew:2":[{nationId:"mx",nationZh:"墨西哥",workTitleZh:"火夜"}],"Matthew:23":[{nationId:"ph",nationZh:"菲律宾",workTitleZh:"不许犯我"},{nationId:"ro",nationZh:"罗马尼亚",workTitleZh:"四月三周两天"}],"Matthew:25":[{nationId:"gb",nationZh:"英国",workTitleZh:"我是布莱克"},{nationId:"fr",nationZh:"法国",workTitleZh:"再见,孩子们"},{nationId:"pl",nationZh:"波兰",workTitleZh:"绿色边境"}],"Matthew:5":[{nationId:"fi",nationZh:"芬兰",workTitleZh:"《无名士兵》"}],"Matthew:7":[{nationId:"cu",nationZh:"古巴",workTitleZh:"低度开发的回忆"}],"Micah:2":[{nationId:"kz",nationZh:"哈萨克斯坦",workTitleZh:"房主"},{nationId:"ke",nationZh:"肯尼亚",workTitleZh:"走出非洲"},{nationId:"kh",nationZh:"柬埔寨",workTitleZh:"白楼"},{nationId:"ru",nationZh:"俄罗斯",workTitleZh:"祖雷伊卡睁开了眼睛"},{nationId:"dz",nationZh:"阿尔及利亚",workTitleZh:"烽火岁月"}],"Micah:4":[{nationId:"es",nationZh:"西班牙",workTitleZh:"阿尔卡拉斯"}],"Micah:6":[{nationId:"za",nationZh:"南非",workTitleZh:"哭泣吧,亲爱的祖国"},{nationId:"ar",nationZh:"阿根廷",workTitleZh:"阿根廷,1985"},{nationId:"lb",nationZh:"黎巴嫩",workTitleZh:"羞辱"},{nationId:"uz",nationZh:"乌兹别克斯坦",workTitleZh:"夜与昼"},{nationId:"cd",nationZh:"刚果民主共和国",workTitleZh:"维瓦·里瓦!"},{nationId:"ht",nationZh:"海地",workTitleZh:"帕科特谋杀案"},{nationId:"il",nationZh:"以色列(现代国家)",workTitleZh:"离婚诉讼"},{nationId:"ch",nationZh:"瑞士",workTitleZh:"《老妇还乡》"}],"Nehemiah:8":[{nationId:"pg",nationZh:"巴布亚新几内亚",workTitleZh:"白先生"}],"Numbers:35":[{nationId:"mn",nationZh:"蒙古",workTitleZh:"世界的血管"}],"Philemon:16":[{nationId:"sg",nationZh:"新加坡",workTitleZh:"爸妈不在家"},{nationId:"tz",nationZh:"坦桑尼亚",workTitleZh:"天堂"},{nationId:"om",nationZh:"阿曼",workTitleZh:"天体"}],"Philippians:1":[{nationId:"de",nationZh:"德国",workTitleZh:"狱中书简"},{nationId:"dz",nationZh:"阿尔及利亚",workTitleZh:"人与上帝"}],"Philippians:2":[{nationId:"mx",nationZh:"墨西哥",workTitleZh:"罗马"},{nationId:"cd",nationZh:"刚果民主共和国",workTitleZh:"毒木圣经"},{nationId:"am",nationZh:"亚美尼亚",workTitleZh:"日历"}],"Proverbs:11":[{nationId:"sa",nationZh:"沙特阿拉伯",workTitleZh:"利雅得女孩"}],"Proverbs:15":[{nationId:"ro",nationZh:"罗马尼亚",workTitleZh:"莫罗梅特一家"}],"Proverbs:18":[{nationId:"lk",nationZh:"斯里兰卡",workTitleZh:"丛林里的村庄"},{nationId:"tr",nationZh:"土耳其",workTitleZh:"小亚细亚往事"},{nationId:"nl",nationZh:"荷兰",workTitleZh:"袭击"},{nationId:"pk",nationZh:"巴基斯坦",workTitleZh:"飞蛾之烟"},{nationId:"ir",nationZh:"伊朗",workTitleZh:"一次别离"},{nationId:"jo",nationZh:"约旦",workTitleZh:"法尔哈"},{nationId:"sd",nationZh:"苏丹",workTitleZh:"喀土穆"},{nationId:"ge",nationZh:"格鲁吉亚",workTitleZh:"高加索山脉的诗意国度:格鲁吉亚"},{nationId:"il",nationZh:"以色列(现代国家)",workTitleZh:"阿贾米"}],"Proverbs:23":[{nationId:"dk",nationZh:"丹麦",workTitleZh:"酒精计划"}],"Proverbs:24":[{nationId:"ua",nationZh:"乌克兰",workTitleZh:"孤儿院"}],"Proverbs:31":[{nationId:"eg",nationZh:"埃及",workTitleZh:"广场"},{nationId:"nz",nationZh:"新西兰",workTitleZh:"钢琴课"},{nationId:"pe",nationZh:"秘鲁",workTitleZh:"无名之歌"},{nationId:"es",nationZh:"西班牙",workTitleZh:"沉默正义"},{nationId:"bd",nationZh:"孟加拉国",workTitleZh:"一条叫提塔斯的河"},{nationId:"nl",nationZh:"荷兰",workTitleZh:"安妮日记"},{nationId:"np",nationZh:"尼泊尔",workTitleZh:"帕尔帕萨咖啡馆"},{nationId:"jo",nationZh:"约旦",workTitleZh:"阿布·拉伊德船长"},{nationId:"sa",nationZh:"沙特阿拉伯",workTitleZh:"完美候选人"},{nationId:"af",nationZh:"阿富汗",workTitleZh:"养家之人"},{nationId:"ie",nationZh:"爱尔兰",workTitleZh:"《像这样的小事》"}],"Proverbs:4":[{nationId:"ke",nationZh:"肯尼亚",workTitleZh:"最年长的小学生"}],"Psalms:10":[{nationId:"lk",nationZh:"斯里兰卡",workTitleZh:"马里·阿尔梅达的七个月亮"},{nationId:"tz",nationZh:"坦桑尼亚",workTitleZh:"来世"},{nationId:"sy",nationZh:"叙利亚",workTitleZh:"壳"},{nationId:"il",nationZh:"以色列(现代国家)",workTitleZh:"细节"},{nationId:"ly",nationZh:"利比亚",workTitleZh:"《归来》"}],"Psalms:103":[{nationId:"np",nationZh:"尼泊尔",workTitleZh:"卡纳利蓝调"}],"Psalms:104":[{nationId:"kz",nationZh:"哈萨克斯坦",workTitleZh:"郁金香"}],"Psalms:126":[{nationId:"ht",nationZh:"海地",workTitleZh:"海地ï¼
1Œæˆ‘的爱"}],"Psalms:13":[{nationId:"cl",nationZh:"智利",workTitleZh:"荒凉"},{nationId:"dk",nationZh:"丹麦",workTitleZh:"花谷"}],"Psalms:137":[{nationId:"au",nationZh:"澳大利亚",workTitleZh:"蓝宝石"},{nationId:"pe",nationZh:"秘鲁",workTitleZh:"深沉的河流"},{nationId:"ua",nationZh:"乌克兰",workTitleZh:"橙色的土地"},{nationId:"mm",nationZh:"缅甸",workTitleZh:"来自绿鬼之地"}],"Psalms:139":[{nationId:"gb",nationZh:"英国",workTitleZh:"混沌少年时"},{nationId:"kg",nationZh:"吉尔吉斯斯坦",workTitleZh:"贝什肯皮尔"}],"Psalms:24":[{nationId:"ge",nationZh:"格鲁吉亚",workTitleZh:"玉米岛"}],"Psalms:27":[{nationId:"nz",nationZh:"新西兰",workTitleZh:"毛利男孩"}],"Psalms:56":[{nationId:"ca",nationZh:"加拿大",workTitleZh:"印第安马"},{nationId:"pe",nationZh:"秘鲁",workTitleZh:"伤心的奶水"},{nationId:"pk",nationZh:"巴基斯坦",workTitleZh:"静默之水"},{nationId:"kh",nationZh:"柬埔寨",workTitleZh:"残缺影像"}],"Psalms:68":[{nationId:"nz",nationZh:"新西兰",workTitleZh:"追捕野蛮人"},{nationId:"ec",nationZh:"厄瓜多尔",workTitleZh:"阿尔芭"},{nationId:"ma",nationZh:"摩洛哥",workTitleZh:"阿里·扎瓦:街头王子"}],"Psalms:78":[{nationId:"ps",nationZh:"巴勒斯坦",workTitleZh:"剩下的时光"}],"Psalms:82":[{nationId:"af",nationZh:"阿富汗",workTitleZh:"灿烂千阳"},{nationId:"ps",nationZh:"巴勒斯坦",workTitleZh:"守门人"}],"Psalms:88":[{nationId:"ir",nationZh:"伊朗",workTitleZh:"盲枭"}],"Psalms:9":[{nationId:"tr",nationZh:"土耳其",workTitleZh:"切口"}],"Psalms:90":[{nationId:"us",nationZh:"美国",workTitleZh:"别告诉她"},{nationId:"gr",nationZh:"希腊",workTitleZh:"永恒和一日"},{nationId:"no",nationZh:"挪威",workTitleZh:"世界上最糟糕的人"},{nationId:"ps",nationZh:"巴勒斯坦",workTitleZh:"盐屋"}],"Revelation:7":[{nationId:"no",nationZh:"挪威",workTitleZh:"开路先锋"},{nationId:"ug",nationZh:"乌干达",workTitleZh:"拉维诺之歌"}],"Romans:11":[{nationId:"pl",nationZh:"波兰",workTitleZh:"修女伊达"}],"Romans:12":[{nationId:"ng",nationZh:"尼日利亚",workTitleZh:"半轮黄日"},{nationId:"pl",nationZh:"波兰",workTitleZh:"灰烬与钻石"},{nationId:"ar",nationZh:"阿根廷",workTitleZh:"荒蛮故事"},{nationId:"gr",nationZh:"希腊",workTitleZh:"苹果"},{nationId:"bd",nationZh:"孟加拉国",workTitleZh:"黄金时代"},{nationId:"ua",nationZh:"乌克兰",workTitleZh:"被遗忘祖先的阴影"},{nationId:"kh",nationZh:"柬埔寨",workTitleZh:"音乐人生"},{nationId:"iq",nationZh:"伊拉克",workTitleZh:"巴格达怪客"},{nationId:"am",nationZh:"亚美尼亚",workTitleZh:"切肤之歌"},{nationId:"al",nationZh:"阿尔巴尼亚",workTitleZh:"《石头城纪事》"}],"Romans:16":[{nationId:"ma",nationZh:"摩洛哥",workTitleZh:"大象之年"}],"Romans:2":[{nationId:"id",nationZh:"印度尼西亚",workTitleZh:"杀戮演绎"}],"Romans:7":[{nationId:"dk",nationZh:"丹麦",workTitleZh:"哥本哈根三部曲"}],"Ruth:1":[{nationId:"kg",nationZh:"吉尔吉斯斯坦",workTitleZh:"天上的游牧"},{nationId:"ht",nationZh:"海地",workTitleZh:"弗雷达"}],"Song of Solomon:8":[{nationId:"kz",nationZh:"哈萨克斯坦",workTitleZh:"少女吉别克"}]};const Ut=({tone:e,bg:n,icon:a,title:r,meta:o,onClick:s,target:i})=>t.jsxs("button",{"data-next-target":i,onClick:s,className:"group flex items-center gap-2.5 px-3.5 py-3 rounded-xl bg-white border border-[#E6E2D6] transition-colors text-left hover:border-[color:var(--cns-tone)]",style:{"--cns-tone":`${e}99`},children:[t.jsx("span",{className:"flex-none w-8 h-8 rounded-lg flex items-center justify-center",style:{background:n},children:a}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block text-[13px] font-medium text-[#2D2A22] truncate",children:r}),t.jsx("span",{className:"block text-[13px] text-[#64748B] truncate",children:o})]}),t.jsx(Ze,{className:"flex-none w-4 h-4 text-[#64748B] transition-colors"})]}),Jt=({book:n,chapter:a,bookZh:r,onReady:o})=>{const m=s(),p=ce("wiki",a>=1?`${n}:${a}`:null),[x,b]=e.useState(null),[f,g]=e.useState([]),[w,k]=e.useState(!1),[v,y]=e.useState(!1),[j,Z]=e.useState(!1),N=a>=1?function(e,t){return!e||!Number.isFinite(t)||t<1?[]:Gt[`${e}:${t}`]??[]}(n,a):[],C=h(n),E=i(r);if(e.useEffect(()=>{if(!n||a<1)return void y(!0);let e=!1;return y(!1),Promise.all([Wt(n,a),l(n,a).catch(()=>[])]).then(([t,n])=>{e||(b(t),g((n||[]).slice(0,2).map(e=>({slug:e.slug,title:String(e.title||"")}))),y(!0))}).catch(()=>{e||y(!0)}),()=>{e=!0}},[n,a]),e.useEffect(()=>{if(!n||a<1)return void Z(!0);let e=!0;return Z(!1),xe().then(t=>{e&&(k(t.has(ke(n,a))),Z(!0))}).catch(()=>{e&&Z(!0)}),()=>{e=!1}},[n,a]),e.useEffect(()=>{v&&j&&(null==o||o())},[v,j,o]),a<1)return null;if(!w&&!x&&0===f.length&&0===N.length)return null;const T=u();return t.jsxs("section",{ref:p.ref,onClickCapture:p.onClickCapture,className:"mt-8 px-4 py-4 rounded-2xl bg-[#FFFCF5] border-2 border-[#
1E6E2D6]",children:[t.jsx("h3",{className:"text-[13px] font-semibold text-[#6B6557] mb-1",children:m("读完这一章,还可以往哪儿走?")}),t.jsx("p",{className:"text-[13px] text-[#64748B] mb-3 leading-relaxed",children:`${E} ${a} ${m(C)}${m("——同一段经文,站内还有这几条路。")}`}),t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[w&&t.jsx("div",{"data-next-target":"chapterQuiz",className:"contents",children:t.jsx(pe,{book:n,chapter:a,variant:"card",isAvailable:!0})}),x&&t.jsx(Ut,{tone:d.reading.tone,bg:d.reading.bg,icon:t.jsx(ve,{className:"w-4 h-4",style:{color:d.reading.tone}}),title:m("跟着通读读这一周"),meta:`${m(d.reading.nameZh)} · ${m("第")} ${x.weekNum} ${m("周")}${x.title?` · ${be(x.title,T)}`:""}`,onClick:()=>c("bibleJourneyRPG",{bibleJourneyQuestId:x.questId}),target:"reading"}),N.slice(0,2).map(e=>t.jsx(Ut,{tone:d.nations.tone,bg:d.nations.bg,icon:t.jsx(ye,{className:"w-4 h-4",style:{color:d.nations.tone}}),title:m("有一份以这段经文共看的指南"),meta:`${m(d.nations.nameZh)} · ${m(e.nationZh)}《${m(e.workTitleZh)}》`,onClick:()=>c("nations",{nationId:e.nationId}),target:"nations"},e.nationId+e.workTitleZh)),f.map(e=>t.jsx(Ut,{tone:d.library.tone,bg:d.library.bg,icon:t.jsx(je,{className:"w-4 h-4",style:{color:d.library.tone}}),title:be(e.title,T),meta:`${m(d.library.nameZh)} · ${m("讲到这一章")}`,onClick:()=>c("libraryArticle",{librarySlug:e.slug}),target:"library"},e.slug))]})]})},Vt="wiki-handout-print-portal",Kt=`\n#${Vt} { display: none; }\n@media print {\n  html, body {\n    height: auto !important;\n    min-height: 0 !important;\n    overflow: visible !important;\n    background: #fff !important;\n  }\n  body.wiki-handout-printing > *:not(#${Vt}) { display: none !important; }\n  body.wiki-handout-printing > #${Vt} {\n    position: static !important;\n    display: block !important;\n    width: auto !important;\n    height: auto !important;\n    overflow: visible !important;\n  }\n  #${Vt} #wiki-handout-print-region {\n    position: static !important;\n    display: block !important;\n    width: 100% !important;\n    height: auto !important;\n    margin: 0 !important;\n    padding: 0 !important;\n    overflow: visible !important;\n    border: none !important;\n    border-radius: 0 !important;\n    background: #fff !important;\n  }\n  @page { size: A4 portrait; margin: 14mm 16mm; }\n  .bw-handout-rich { font-size: 11.5pt; line-height: 1.75; }\n  .bw-handout-questions { break-inside: auto; }\n  .bw-handout-q { break-inside: avoid; }\n  .bw-handout-prayer-block { break-inside: avoid; }\n  .bw-handout-prayer-notes { min-height: 38mm; }\n  .bw-handout-h2 { font-size: 13.5pt; }\n  .bw-handout-qtext, .bw-handout-qnum, .bw-handout-prayer { font-size: 11.5pt; line-height: 1.7; }\n  .bw-handout-qhint { font-size: 10pt; }\n  .bw-handout-qlabel { font-size: 9pt; }\n}\n@keyframes bw-handout-sheet-up {\n  from { transform: translateY(24px); opacity: 0.7; }\n  to { transform: translateY(0); opacity: 1; }\n}\n.bw-handout-sheet { animation: bw-handout-sheet-up 220ms cubic-bezier(0.22, 1, 0.36, 1); }\n@media (min-width: 768px) {\n  .bw-handout-sheet { animation: none; }\n}\n.bw-handout-rich { font-size: 17px; line-height: 1.85; color: #3A352B; overflow-wrap: break-word; }\n.bw-handout-rich h2 { font-family: "Noto Serif SC", "Songti SC", serif; font-size: 1.18em; font-weight: 600; color: #3D5A2D; border-bottom: 1px solid #DDD8CC; padding-bottom: 0.25em; margin: 1.4em 0 0.7em; }\n.bw-handout-rich h3 { font-size: 1.06em; font-weight: 600; color: #4F5B45; margin: 1.2em 0 0.5em; }\n.bw-handout-rich p { margin: 0.55em 0; }\n.bw-handout-rich ul, .bw-handout-rich ol { padding-inline-start: 1.5em; margin: 0.55em 0; }\n.bw-handout-rich li { margin: 0.3em 0; }\n.bw-handout-rich blockquote { border-inline-start: 3px solid #9CB58A; background: rgba(156, 181, 138, 0.10); margin: 0.8em 0; padding: 0.5em 0.9em; border-radius: 6px; }\n.bw-handout-rich blockquote p { margin: 0.3em 0; }\n.bw-handout-rich table { border-collapse: collapse; margin: 0.9em 0; font-size: 0.92em; }\n.bw-handout-rich th, .bw-handout-rich td { border: 1px solid #DDD8CC; padding: 0.35em 0.6em; text-align: start; }\n.bw-handout-rich th { background: #F5F1E8; }\n.bw-handout-rich strong { color: #3D5A2D; }\n/* 深色模式(#199):上面这批用 tag 选择器写死了色号,全局 tailwind 暗色覆盖层\n   够不着(它按 text-*、bg-* 类名匹配),暗底上正文与标题看不清;\n   @media screen 是为了让打印时仍走上面的默认深字白纸,不被夜间色带走 */\n@media screen {\n  html.dark .bw-handout-rich { color: #E6DED0; }\n  html.dark .bw-handout-rich h2 { color: #9DCB78; border-bottom-color: #38332A; }\n  html.dark .bw-handout-rich h3 { color: #A8BCA0; }\n  html.dark .bw-handout-rich blockquote { border-inline-start-color: #8FAE6E; background: rgba(156, 181, 138, 0.16); }\n  html.dark .bw-handout-rich th, html.dark .bw-handout-rich td { border-color: #38332A; }\n  html.dark .bw-handout-rich th { background: #2A251E; color: #ECE6D8; }\n  html.dark .bw-handout-rich strong { color: #9DCB78; }\n}\n\n/* 讨论题 / 应用祷告排版:跟正文 .bct-rich-text 同一套缩放阶梯(桌面/手机默认/放大/超大),\n   否则讨论题固定 16px 会比正文小一截——手机与放大档尤其明显。 */\n.bw-handout-h2 { font-size: 20px; }\n.bw-handout-qnum { font-size: 17px; }\n.bw-handout-qlabel { font-size: 13px; }\n.bw-handout-qtext { font-size: 17px; line-height: 1.85; }\n.bw-handout-qhint { font-size: 14px; line-height: 1.7; }\n.bw-handout-prayer { font-size: 17px; line-height: 1.9; }\n.bw-handout-prayer-notes {\n  min-height: 144px;\n  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 34px, #DDD8CC 35px);\n}\nhtml.text-scale-large .bw-handout-h2 { font-size: 20px; }\nhtml.text-scale-large .bw-handout-qtext,\nhtml.text-scale-large .bw-handout-qnum,\nhtml.text-scale-large .bw-handout-prayer { font-size: 18px; }\nhtml.text-scale-large .bw-handout-qhint { font-size: 14.5px; }\nhtml.text-scale-xlarge .bw-handout-h2 { font-size: 22px; }\nhtml.text-scale-xlarge .bw-handout-qtext,\nhtml.text-scale-xlarge .bw-handout-qnum,\nhtml.text-scale-xlarge .bw-handout-prayer { font-size: 20px; }\nhtml.text-scale-xlarge .bw-handout-qhint { font-size: 15px; }\n@media (max-width: 768px) {\n  .bw-handout-h2 { font-size: 20px; }\n  .bw-handout-qnum { font-size: 18px; }\n  .bw-handout-qlabel { font-size: 13px; }\n  .bw-handout-qtext { font-size: 18px; }\n  .bw-handout-qhint { font-size: 14.5px; }\n  .bw-handout-prayer { font-size: 18px; }\n  html.text-scale-large .bw-handout-h2 { font-size: 22px; }\n  html.text-scale-large .bw-handout-qtext,\n  html.text-scale-large .bw-handout-qnum,\n  html.text-scale-large .bw-handout-prayer { font-size: 20px; }\n  html.text-scale-large .bw-handout-qhint { font-size: 15px; }\n  html.text-scale-xlarge .bw-handout-h2 { font-size: 24px; }\n  html.text-scale-xlarge .bw-handout-qtext,\n  html.text-scale-xlarge .bw-handout-qnum,\n  html.text-scale-xlarge .bw-handout-prayer { font-size: 22px; }\n  html.text-scale-xlarge .bw-handout-qhint { font-size: 15.5px; }\n}
1\n`,Yt=["warmup","observe","interpret","apply"];function Qt(){if("undefined"==typeof navigator)return!1;const e=navigator.userAgent||"",t=/AppleWebKit/i.test(e),n=(navigator.maxTouchPoints||0)>1||"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches;return t&&n}const Xt=({book:a,chapter:r,bookZh:o,articleTitle:i,simpleHtml:l,standardHtml:d,onClose:c})=>{const h=s(),y=x(),j=e.useRef(null),[Z,N]=e.useState(!0),[C,E]=e.useState(!1),[T,F]=e.useState(!0),[I,S]=e.useState(!0),[A,D]=e.useState(null),[_,B]=e.useState(""),[$,L]=e.useState(!1),[M,q]=e.useState(!1),[z,P]=e.useState(!1),[O,R]=e.useState(""),[H,W]=e.useState(""),[G,U]=e.useState(null);e.useEffect(()=>(null==y||y.setOverlayOpen(!0),()=>null==y?void 0:y.setOverlayOpen(!1)),[y]);const J=n.useCallback(()=>{L(!0),q(!1),(async(e,t,n)=>{if(!m())throw new Error("OFFLINE");const{data:a,error:r}=await p.from("bible_wiki_study_questions").select("questions, prayer").eq("book",e).eq("chapter",t).maybeSingle();if(!r&&Array.isArray(null==a?void 0:a.questions)&&a.questions.length>=4)return{questions:a.questions,prayer:"string"==typeof a.prayer?a.prayer:""};const{data:o,error:s}=await p.functions.invoke("wiki-study-questions",{body:{book:e,chapter:t,bookZh:n}});if(s)throw new Error(s.message||(null==r?void 0:r.message)||"study questions failed");if(!(null==o?void 0:o.success)||!Array.isArray(o.questions))throw new Error((null==o?void 0:o.message)||"study questions failed");return{questions:o.questions,prayer:"string"==typeof o.prayer?o.prayer:""}})(a,r,o).then(e=>{D(e.questions),B(e.prayer)}).catch(e=>{console.error("wiki handout study questions failed:",e),q(!0)}).finally(()=>L(!1))},[a,r,o]);e.useEffect(()=>{J()},[J]);const V=n.useCallback(()=>{var e;null==(e=document.getElementById(Vt))||e.remove(),document.body.classList.remove("wiki-handout-printing")},[]),K=n.useCallback(()=>{const e=j.current;if(!e)return;V();const t=document.createElement("div");t.id=Vt,t.setAttribute("aria-hidden","true"),t.appendChild(e.cloneNode(!0)),document.body.appendChild(t),document.body.classList.add("wiki-handout-printing")},[V]);e.useEffect(()=>(window.addEventListener("beforeprint",K),window.addEventListener("afterprint",V),()=>{window.removeEventListener("beforeprint",K),window.removeEventListener("afterprint",V),V()}),[V,K]);const Y=()=>{try{if(K(),"function"!=typeof window.print)return void w(h("导出失败:当前环境不支持打印导出"));window.print(),Qt()&&window.setTimeout(()=>{k(h("若没有弹出打印面板,请用浏览器菜单里的「打印」或「分享」保存 PDF。"))},700)}catch(e){V(),w(h("导出失败:当前环境不支持打印导出")),console.error("wiki handout print failed:",e)}},Q=e.useMemo(()=>{if(!A)return[];const e=u();return Yt.flatMap(e=>A.filter(t=>t.section===e)).map(t=>({...t,q:be(t.q,e),hint:t.hint?be(t.hint,e):void 0}))},[A]),X={warmup:h("暖场"),observe:h("观察经文"),interpret:h("理解信息"),apply:h("生活应用")},ee=0===r?`《${o}》· ${h("全卷综览")}`:`《${o}》${h("第 {0} 章").replace("{0}",String(r))}`,te=(new Date).toLocaleDateString("zh-CN",{year:"numeric",month:"long",day:"numeric"}),ne=async()=>{if(j.current){P(!0);try{await async function(){var e;
1(null==(e=document.fonts)?void 0:e.ready)&&await Promise.race([document.fonts.ready.then(()=>{}),new Promise(e=>window.setTimeout(e,1500))])}();const{toPng:e}=await v(async()=>{const{toPng:e}=await import("./vendor-shared-CDq_mVLO.js");return{toPng:e}},[]),t=await e(j.current,{pixelRatio:2,backgroundColor:"#FFFCF5",cacheBust:!0}),n=`${o}${r>0?`-${r}`:""}-${h("查经讲义")}.png`;if(Qt())return U({src:t,filename:n}),void k(h("手机端:长按图片 → 保存图片;电脑端:点击下载"));const a=document.createElement("a");a.href=t,a.download=n,document.body.appendChild(a),a.click(),a.remove()}catch(e){w(h("生成长图失败,可改用「打印 / 存 PDF」。")),console.error("wiki handout long-image export failed:",e)}finally{P(!1)}}},ae=e=>"inline-flex h-9 items-center gap-1.5 rounded-full border px-3.5 text-[13px] font-semibold transition "+(e?"border-[#8FAE6E] bg-[#CFE0BB] text-[#3D5A2D]":"border-[#DED6C8] bg-[#FFFCF5] text-[#6B6557] hover:bg-[#F0EDE2]"),re=e=>"inline-flex h-10 min-w-0 items-center justify-center rounded-xl border px-1 text-[13px] font-semibold transition "+(e?"border-[#8FAE6E] bg-[#DDE8D0] text-[#3D5A2D] shadow-[inset_0_0_0_1px_rgba(143,174,110,0.12)]":"border-[#DED6C8] bg-[#FFFCF5] text-[#797266]");return t.jsxs("div",{className:"bw-handout-overlay fixed inset-x-0 top-0 bottom-[calc(64px+env(safe-area-inset-bottom,0px))] z-[60] flex items-end bg-[rgba(20,18,12,0.48)] backdrop-blur-[2px] md:inset-0 md:block md:overflow-auto md:bg-[rgba(20,18,12,0.55)]",children:[t.jsx("style",{children:Kt}),t.jsx("button",{type:"button",onClick:c,className:"wiki-handout-noprint absolute inset-0 md:hidden","aria-label":h("关闭查经讲义")}),t.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":`${ee} · ${h("查经讲义")}`,className:"bw-handout-shell bw-handout-sheet relative z-[1] flex max-h-[calc(88*var(--vh-unit)_-_64px_-_env(safe-area-inset-bottom,0px))] w-full flex-col overflow-hidden rounded-t-[28px] bg-[#F4F2EC] shadow-[0_-12px_40px_rgba(40,35,25,0.16)] md:min-h-full md:max-h-none md:overflow-visible md:rounded-none md:bg-transparent md:shadow-none",children:[t.jsxs("div",{className:"wiki-handout-noprint shrink-0 border-b border-[#DDD8CC] bg-[#F4F2EC] px-4 pb-3 pt-2 md:hidden",children:[t.jsx("div",{className:"mx-auto mb-2 h-1 w-11 rounded-full bg-[#D2CCBE]","aria-hidden":"true"}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("span",{className:"min-w-0 truncate text-[16px] font-semibold text-[#2D2A22]",style:{fontFamily:'"Noto Serif SC","Songti SC",serif'},children:[ee," · ",h("查经讲义")]}),t.jsx(b,{onClick:c,label:h("关闭")})]}),t.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[t.jsxs("button",{type:"button",onClick:Y,className:"inline-flex h-11 items-center justify-center gap-2 rounded-xl bg-[#4F7942] px-3 text-[14px] font-semibold text-white transition active:bg-[#43663A]",children:[t.jsx(Ne,{className:"h-[18px] w-[18px]"}),h("打印 / 存 PDF")]}),t.jsxs("button",{type:"button",disabled:z,onClick:ne,className:"inline-flex h-11 items-center justify-center gap-2 rounded-xl border border-[#BFCDB2] bg-[#F7FAF3] px-3 text-[14px] font-semibold text-[#4F7942] transition active:bg-[#EAF1E3] disabled:opacity-60",children:[z?t.jsx(Ce,{className:"h-[18px] w-[18px] animate-spin"}):t.jsx(Ee,{className:"h-[18px] w-[18px]"}),h("保存长图")]})]}),t.jsxs("div",{className:"mt-2.5 grid grid-cols-4 gap-1.5",children:[t.jsx("button",{type:"button","aria-pressed":Z,"aria-label":h(0===r?"全书导读":"本章导读"),title:h(0===r?"全书导读":"本章导读"),onClick:()=>N(e=>!e),className:re(Z),children:h("导读")}),t.jsx("button",{type:"button","aria-pressed":C,"aria-label":h(0===r?"全书详解":"逐节详解"),title:h(0===r?"全书详解":"逐节详解"),onClick:()=>E(e=>!e),className:re(C),children:h("详解")}),t.jsx("button",{type:"button","aria-pressed":T,"aria-label":h("查经讨论题"),title:h("查经讨论题"),onClick:()=>F(e=>!e),className:re(T),children:h("讨论题")}),t.jsx("button",{type:"button","aria-pressed":I,"aria-label":h("应用祷告"),title:h("应用祷告"),onClick:()=>S(e=>!e),className:re(I),children:h("祷告")})]}),t.jsxs("div",{className:"mt-2.5 grid grid-cols-2 gap-2",children:[t.jsx("input",{type:"text",value:O,onChange:e=>R(e.target.value),placeholder:h("带领人(选填)"),"aria-label":h("带领人(选填)"),className:"h-10 min-w-0 rounded-xl border border-[#DED6C8] bg-[#FFFCF5] px-3 text-[16px] text-[#3A352B] placeholder:text-[#AAA294] focus:border-[#8FAE6E] focus:outline-none"}),t.jsx("input",{type:"text",value:H,onChange:e=>W(e.target.value),placeholder:h("小组名(选填)"),"aria-label":h("小组名(选填)"),className:"h-10 min-w-0 rounded-xl border border-[#DED6C8] bg-[#FFFCF5] px-3 text-[16px] text-[#3A352B] placeholder:text-[#AAA294] focus:border-[#8FAE6E] focus:outline-none"})]})]}),t.jsxs("div",{className:"wiki-handout-noprint sticky top-0 z-10 hidden bg-[#F4F2EC] px-4 py-3 shadow-sm md:block",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("span",{className:"min-w-0 truncate text-[14px] font-semibold text-[#2D2A22]",style:{fontFamily:'"Noto Serif SC","Songti SC",serif'},children:[ee," · ",h("查经讲义")]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsxs("button",{type:"button",onClick:Y,className:"inline-flex h-9 items-center gap-1.5 rounded-full bg-[#4F7942] px-3.5 text-[13px] font-semibold text-white transition hover:bg-[#43663A]",children:[t.jsx(Ne,{className:"h-4 w-4"}),h("打印 / 存 PDF")]}),t.jsxs("button",{type:"button",disabled:z,onClick:ne,className:"hidden sm:inline-flex h-9 items-center gap-1.5 rounded-full border border-[#DED6C8] bg-[#FFFCF5] px-3.5 text-[13px] font-semibold text-[#4F7942] transition hover:bg-[#F1F7EA] disabled:opacity-60",children:[z?t.jsx(Ce,{className:"h-4 w-4 animate-spin"}):t.jsx(Ee,{className:"h-4 w-4"}),h("保存长图")]}),t.jsx("button",{type:"button",onClick:c,className:"inline-flex h-9 w-9 items-center justify-center rounded-full border border-[#DED6C8] bg-[#FFFCF5] text-[#42526B] transition hover:bg-[#F1EBDD]","aria-label":h("关闭"),children:t.jsx(Te,{className:"h-5 w-5"})})]})]}),t.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[t.jsx("button",{type:"button",onClick:()=>N(e=>!e),className:ae(Z),children:h(0===r?"全书导读":"本章导读")}),t.jsx("button",{type:"button",onClick:()=>E(e=>!e),className:ae(C),children:h(0===r?"全书详解":"逐节详解")}),t.jsx("button",{type:"button",onClick:()=>F(e=>!e),className:ae(T),children:h("查经讨论题")}),t.jsx("button",{type:"button",onClick:()=>S(e=>!e),className:ae(I),children:h("应用祷告")}),t.jsxs("button",{type:"button",disabled:z,onClick:ne,className:`sm:hidden ${ae(!1)}`,children:[z?t.jsx(Ce,{className:"h-4 w-4 animate-spin"}):t.jsx(Ee,{className:"h-4 w-4"}),h("保存长图")]})]}),t.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[t.jsx("input",{type:"text",value:O,onChange:e=>R(e.target.value),placeholder:h("带领人(选填)"),className:"h-9 w-[128px] rounded-full border border-[#DED6C8] bg-[#FFFCF5] px-3.5 text-[13px] text-[#3A352B] placeholder:text-[#B3AC9C] focus:outline-none focus:border-[#8FAE6E]"}),t.jsx("input",{type:"text",value:H,onChange:e=>W(e.target.value),placeholder:h("小组名(选填)"),className:"h-9 w-[128px] rounded-full border border-[#DED6C8] bg-[#FFFCF5] px-3.5 text-[13px] text-[#3A352B] placeholder:text-[#B3AC9C] focus:outline-none focus:border-[#8FAE6E]"})]})]}),t.jsxs("div",{className:"bw-handout-scroll min-h-0 flex-1 overflow-y-auto overscroll-contain md:overflow-visible",children:[t.jsx("div",{className:"mx-auto mb-4 mt-3 max-w-[760px] px-3 md:my-4",children:t.jsxs("div",{id:"wiki-handout-print-region",ref:j,className:"rounded-[10px] bg-[#FFFCF5] p-6 sm:p-8",children:[t.jsxs("div",{className:"mb-5 border-b-2 border-[#DDD8CC] pb-4 text-center",children:[t.jsx("p",{className:"text-[13px] tracking-wide text-[#64748B]",children:h("百宝解经 · 查经讲义")}),t.jsx("h1",{className:"mt-1.5 text-[26px] font-bold text-[#2D2A22]",style:{fontFamily:'"Noto Serif SC","Songti SC",serif'},children:ee}),i&&t.jsx("p",{className:"mt-1 text-[15px] text-[#6B6557]",children:be(i,u())}),t.jsx("p",{className:"mt-1.5 text-[13px] text-[#64748B]",children:te}),t.jsxs("div",{className:"mt-2 flex items-center justify-center gap-5 text-[13px] text-[#64748B]",children:[t.jsxs("span",{className:"inline-flex items-center gap-1",children:[h("带领人"),":",t.jsx("span",{className:O.trim()?"font-medium text-[#3A352B]":"inline-block h-4 min-w-[64px] border-b border-[#C9C2AE]",children:O.trim()})]}),t.jsxs("span",{className:"inline-flex items-center gap-1",children:[h("小组"),":",t.jsx("span",{className:H.trim()?"font-medium text-[#3A352B]":"inline-block h-4 min-w-[64px] border-b border-[#C9C2AE]",children:H.trim()})]})]})]}),Z&&!!l&&t.jsx("div",{className:"bw-handout-rich bct-rich-text",dangerouslySetInnerHTML:{__html:l}}
1),C&&!!d&&t.jsx("div",{className:Z?"mt-6 border-t border-[#E6E2D6] pt-4":"",children:t.jsx("div",{className:"bw-handout-rich bct-rich-text",dangerouslySetInnerHTML:{__html:d}})}),T&&t.jsxs("div",{className:"bw-handout-questions mt-7 border-t-2 border-[#DDD8CC] pt-5",children:[t.jsx("h2",{className:"bw-handout-h2 font-semibold text-[#3D5A2D]",style:{fontFamily:'"Noto Serif SC","Songti SC",serif'},children:h("小组讨论题")}),$&&t.jsxs("div",{id:"wiki-handout-q-loading",className:"mt-3 flex items-center gap-2 text-[14px] text-[#64748B]",children:[t.jsx(Ce,{className:"h-4 w-4 animate-spin"}),h("正在预备讨论题…(本章首次生成约需半分钟)")]}),!$&&M&&t.jsxs("div",{className:"mt-3 flex items-center gap-2.5 text-[14px] text-[#64748B]",children:[t.jsx("span",{children:h("讨论题暂时没能预备好。")}),t.jsxs("button",{type:"button",onClick:J,className:"inline-flex items-center gap-1 rounded-full border border-[#DED6C8] bg-[#FFFCF5] px-2.5 py-1 text-[13px] font-semibold text-[#4F7942] hover:bg-[#F1F7EA]",children:[t.jsx(Fe,{className:"h-3.5 w-3.5"}),h("重试")]})]}),!$&&!M&&Q.length>0&&t.jsx("ol",{className:"mt-3 space-y-3.5",children:Q.map((e,n)=>t.jsx("li",{className:"bw-handout-q",children:t.jsxs("div",{className:"flex items-baseline gap-2",children:[t.jsxs("span",{className:"bw-handout-qnum shrink-0 font-bold text-[#4F7942]",style:{fontFamily:'"Noto Serif SC","Songti SC",serif'},children:[n+1,"."]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("span",{className:"bw-handout-qlabel me-1.5 inline-block rounded bg-[#EFE9DC] px-1.5 py-0.5 align-[2px] text-[#64748B]",children:X[e.section]}),t.jsx("span",{className:"bw-handout-qtext text-[#3A352B]",children:e.q}),e.hint&&t.jsxs("p",{className:"bw-handout-qhint mt-1 text-[#64748B]",children:[h("带领提示"),":",e.hint]})]})]})},n))})]}),I&&t.jsxs("div",{className:"bw-handout-prayer-block mt-7 border-t-2 border-[#DDD8CC] pt-5",children:[t.jsx("h2",{className:"bw-handout-h2 font-semibold text-[#3D5A2D]",style:{fontFamily:'"Noto Serif SC","Songti SC",serif'},children:h("应用祷告")}),$&&!T&&t.jsxs("div",{className:"mt-3 flex items-center gap-2 text-[14px] text-[#64748B]",children:[t.jsx(Ce,{className:"h-4 w-4 animate-spin"}),h("正在预备讨论题…(本章首次生成约需半分钟)")]}),!$&&M&&!T&&t.jsxs("div",{className:"mt-3 flex items-center gap-2.5 text-[14px] text-[#64748B]",children:[t.jsx("span",{children:h("祷告文暂时没能预备好。")}),t.jsxs("button",{type:"button",onClick:J,className:"inline-flex items-center gap-1 rounded-full border border-[#DED6C8] bg-[#FFFCF5] px-2.5 py-1 text-[13px] font-semibold text-[#4F7942] hover:bg-[#F1F7EA]",children:[t.jsx(Fe,{className:"h-3.5 w-3.5"}),h("重试")]})]}),!$&&!M&&_&&t.jsx("div",{className:"bw-handout-prayer mt-3 rounded-[6px] px-4 py-3.5 text-[#3A352B]",style:{borderInlineStart:"3px solid #9CB58A",background:"rgba(156, 181, 138, 0.10)"},children:be(_,u())}),t.jsx("div",{className:"bw-handout-prayer-notes mt-3","aria-hidden":"true"})]}),t.jsx("div",{className:"mt-8 border-t border-[#E6E2D6] pt-3 text-center text-[13px] text-[#64748B]",children:h("圣经·百宝书 · baibaoshu.net")})]})}),t.jsx(f,{className:"wiki-handout-noprint mx-auto mb-2 max-w-[760px] md:hidden",onOpenFeedback:()=>{c(),g()},showSeparatorsOnMobile:!0})]})]}),G&&t.jsx("div",{className:"fixed inset-0 z-[80] flex items-center justify-center bg-black/55 p-4",onClick:()=>U(null),children:t.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":h("保存长图"),className:"max-h-[88vh] w-full max-w-[460px] overflow-hidden rounded-2xl bg-[#F4F2EC] shadow-2xl",onClick:e=>e.stopPropagation(),children:[t.jsxs("div",{className:"flex items-center justify-between border-b border-[#DDD8CC] px-4 py-3",children:[t.jsx("span",{className:"text-[15px] font-semibold text-[#2D2A22]",children:h("保存长图")}),t.jsx("button",{type:"button",onClick:()=>U(null),className:"inline-flex h-9 w-9 items-center justify-center rounded-full text-[#6B6557] hover:bg-[#E9E4D8]","aria-label":h("关闭"),children:t.jsx(Te,{className:"h-5 w-5"})})]}),t.jsx("div",{className:"max-h-[calc(88vh-112px)] overflow-auto bg-[#EDE8DC] p-3",children:t.jsx("img",{src:G.src,alt:h("查经讲义"),className:"mx-auto block w-full max-w-[360px] rounded-lg bg-white shadow"})}),t.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-[#DDD8CC] px-4 py-3",children:[t.jsx("p",{className:"min-w-0 text-[13px] leading-relaxed text-[#6B6557]",children:h("手机端:长按图片 â
1†’ 保存图片;电脑端:点击下载")}),t.jsx("a",{href:G.src,download:G.filename,className:"shrink-0 rounded-full bg-[#4F7942] px-3.5 py-2 text-[13px] font-semibold text-white",children:h("保存图片")})]})]})})]})},en=/^\s*\d+[\.、.\s]/,tn=/^\s*[((][一二三四五六七八九十]+[))]/;function nn(e){if(!e||"undefined"==typeof DOMParser)return e;const t=(new DOMParser).parseFromString(`<body>${e}</body>`,"text/html"),n=t.body,a=Array.from(n.querySelectorAll("h2"));if(0===a.length)return e;a.forEach((e,t)=>{e.id=`wiki-section-${t}`});const r=a[0],o=Array.from(n.querySelectorAll("strong, b")).filter(e=>{var t,n;if(n=e,!(r.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING))return!1;const a=e.parentElement;if(!a)return!1;const o=(null==(t=a.textContent)?void 0:t.trim())||"";return en.test(o)||tn.test(o)}),s=Math.min(o.length,a.length);for(let i=0;i<s;i++){const e=o[i],n=t.createElement("a");for(n.className="wiki-section-link",n.setAttribute("href",`#wiki-section-${i}`);e.firstChild;)n.appendChild(e.firstChild);e.appendChild(n)}return n.innerHTML}const an=/^[\s【\[]*本章钥节[\s】\]]*$/;const rn={"旧约背景":"ctx","旧约原意":"ctx","为何引用":"why","新约引用":"why","应验":"fulfil","今日应用":"apply"},on=/<li>\s*(旧约背景|旧约原意|为何引用|新约引用|应验|今日应用):/g,sn=/<ul([^>]*)>(\s*<li class="bw-ot-step)/g,ln=new RegExp("<h3([^>]*)>(\\d[^<()]*?)((直接预言应验|双重应验|预表应验|主题应验|综合性概括|综合引用·字根关联|直接引用|暗引典故)(·[^()]*?)? · ([^()]*?))</h3>","g"),dn=(e,t)=>{const n=e.match(/\sclass="([^"]*)"/);return n?e.replace(n[0],` class="${n[1]} ${t}"`):`${e} class="${t}"`};const cn=/^(\s*)(\d{1,3}\s*ç« )(?=\s*[::])/,hn=/^(\s*)([①②③④⑤⑥⑦⑧⑨⑩]\s*\d{1,3}(?::\d{1,3}(?:\s*[–—-]\s*\d{1,3})?)?\s*[·・.]\s*[^::,,]+?)(?=\s*[::,,])/,un=/^\d{1,3}\s*ç« (?:\s*[::]|$)/,mn=/^[①②③④⑤⑥⑦⑧⑨⑩]\s*\d{1,3}(?::\d{1,3}(?:\s*[–—-]\s*\d{1,3})?)?\s*[·・.]/,pn=e=>{const t=e.textContent||"",n=(e=>{for(const t of Array.from(e.childNodes))if(3!==t.nodeType||(t.textContent||"").trim())return t;return null})(e);if(!n)return null;if(1===n.nodeType&&"STRONG"===n.tagName){const e=(n.textContent||"").trim();return un.test(e)?{kind:"chapter",bold:!0,start:0,end:0}:mn.test(e)?{kind:"section",bold:!0,start:0,end:0}:null}const a=t.match(cn);if(a){const e=a[1].length;return{kind:"chapter",bold:!1,start:e,end:e+a[2].length}}const r=t.match(hn);if(r){const e=r[1].length;return{kind:"section",bold:!1,start:e,end:e+r[2].length}}return null},xn=(e,t)=>{const n=[],a=e=>{3!==e.nodeType?e.childNodes.forEach(a):n.push(e)};a(e);let r=0;for(const o of n){const e=o.data.length;if(t<=r+e)return{node:o,offset:t-r};r+=e}return null};function bn(e){if(!e||"undefined"==typeof DOMParser)return e;const t=(new DOMParser).parseFromString(`<body>${e}</body>`,"text/html");return t.body.querySelectorAll("ul, ol").forEach(e=>{const n=Array.from(e.children).filter(e=>"LI"===e.tagName).map(e=>({li:e,match:pn(e)})).filter(e=>!!e.match);["chapter","section"].forEach(e=>{const a=n.filter(t=>t.match.kind===e);a.some(e=>e.match.bold)&&a.some(e=>!e.match.bold)&&a.forEach(e=>{e.match.bold||((e,t,n)=>{const a=xn(t,n.start),r=xn(t,n.end);if(!a||!r)return;const o=e.createRange();o.setStart(a.node,a.offset),o.setEnd(r.node,r.offset);const s=e.createElement("strong");s.appendChild(o.extractContents()),o.insertNode(s)})(t,e.li,e.match)})})}),t.body.innerHTML}const fn=["救恩","圣灵","祷告","盟约","复活","称义","怜悯","应许"];function gn(e,t){const n=fe(t).replace(/ /g," ").split(/\s+/).filter(Boolean);if(!n.length)return 0;const a=e.toLowerCase();let r=0;for(const o of n)for(const e of new Set([o,ge(o)])){const t=e.toLowerCase();if(!t)continue;let n=0;for(;;){const e=a.indexOf(t,n);if(e<0)break;r++,n=e+t.length}}return r}const wn=({open:n,onClose:a,chapterLabel:r,tierPlainTexts:o,onHighlightInChapter:i,onWholeBibleSearch:l})=>{const d=s(),[c,h]=e.useState(""),[u,m]=e.useState([]),p=e.useRef(null),x=c.trim();e.useEffect(()=>{if(!n)return;h(""),m(K());const e=setTimeout(()=>{var e;return null==(e=p.current)?void 0:e.focus()},360);return()=>clearTimeout(e)},[n]);const b=e.useMemo(()=>x?function(e,t){for(const n of e){const e=gn(n,t);if(e>0)return e}return 0}(o,x):0,[o,x]),f=()=>
1{x&&(m(X(x)),a(),i(x))};return t.jsxs(y,{open:n,onClose:a,title:d("搜索"),meta:r,children:[t.jsxs("div",{className:"relative mb-3",children:[t.jsx(Ie,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-[#64748B] pointer-events-none"}),t.jsx("input",{ref:p,type:"search",value:c,onChange:e=>h(e.target.value),onKeyDown:e=>{"Enter"===e.key&&f()},placeholder:d("在本章中查找…"),className:"w-full pl-9 pr-9 py-2.5 rounded-xl bg-white border border-stone-200 text-[15px] text-slate-800 placeholder:text-slate-400 focus:outline-none focus:border-[#7A9C5E] focus:ring-2 focus:ring-[#7A9C5E]/25 transition-colors",enterKeyHint:"search"}),c&&t.jsx("button",{type:"button",onClick:()=>{var e;h(""),null==(e=p.current)||e.focus()},className:"absolute right-2.5 top-1/2 -translate-y-1/2 p-1 rounded-full text-slate-500 hover:text-slate-700 hover:bg-slate-100 transition-colors","aria-label":d("清除"),children:t.jsx(Te,{className:"w-4 h-4"})})]}),x?t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",onClick:f,disabled:0===b,className:"w-full flex items-center gap-3 mb-2.5 px-3.5 py-3 rounded-xl border text-left transition-colors "+(b>0?"bg-[#EEF7D8] border-[#9CB58A] hover:bg-[#E4F1C8]":"bg-[#F5F1E8] border-stone-200 cursor-default"),children:[t.jsx(Ie,{className:"w-5 h-5 flex-shrink-0 "+(b>0?"text-[#4F7942]":"text-slate-500"),strokeWidth:1.6}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-[15px] font-semibold "+(b>0?"text-[#3D5A2D]":"text-slate-500"),children:b>0?t.jsxs(t.Fragment,{children:[d("本章找到")," ",b," ",d("处")]}):t.jsxs(t.Fragment,{children:[d("本章未找到"),"「",x,"」"]})}),t.jsx("div",{className:"text-[13px] text-slate-500",children:d(b>0?"在本章内高亮定位":"试试扩展到整本圣经")})]}),b>0&&t.jsx(Ze,{className:"w-4 h-4 text-[#4F7942] flex-shrink-0"})]}),t.jsxs("button",{type:"button",onClick:()=>{x&&X(x),a(),l(x)},className:"w-full flex items-center gap-3 px-3.5 py-3 rounded-xl border border-[#E6E2D6] bg-[#FFFCF5] hover:border-[#7A9C5E]/70 text-left transition-colors",children:[t.jsx(Ie,{className:"w-5 h-5 text-slate-500 flex-shrink-0",strokeWidth:1.6}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"text-[15px] font-medium text-slate-800",children:[d("在整本圣经中搜索"),"「",x,"」"]}),t.jsx("div",{className:"text-[13px] text-slate-500",children:d("解经全文 / 只看经文 · 旧约 / 新约")})]}),t.jsx(Ze,{className:"w-4 h-4 text-slate-500 flex-shrink-0"})]})]}):t.jsxs("div",{className:"space-y-4",children:[u.length>0&&t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[t.jsx(Se,{className:"w-3.5 h-3.5 text-slate-500"}),t.jsx("span",{className:"text-[13px] text-slate-500",children:d("最近搜索")}),t.jsx("button",{type:"button",onClick:()=>{Y(),m([])},className:"ml-auto text-[13px] text-slate-500 hover:text-slate-600 transition-colors",children:d("清除")})]}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:u.map(e=>t.jsxs("span",{className:"inline-flex items-center gap-1 pl-2.5 pr-1.5 py-1 rounded-full bg-white border border-stone-200 text-[13px] text-slate-600 hover:border-[#7A9C5E]/70 transition-colors",children:[t.jsx("button",{type:"button",onClick:()=>{var t;h(e),null==(t=p.current)||t.focus()},className:"max-w-[10rem] truncate",children:e}),t.jsx("button",{type:"button",onClick:()=>{m(Q(e))},"aria-label":d("删除"),className:"p-0.5 rounded-full text-slate-500 hover:text-slate-600 hover:bg-slate-100 transition-colors",children:t.jsx(Te,{className:"w-3 h-3"})})]},e))})]}),t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[t.jsx(Ie,{className:"w-3.5 h-3.5 text-slate-500"}),t.jsx("span",{className:"text-[13px] text-slate-500",children:d("试试搜索")})]}),t.jsx("div",{className:"flex flex-wrap gap-1.5",children:fn.map(e=>t.jsx("button",{type:"button",onClick:()=>{var t;h(e),null==(t=p.current)||t.focus()},className:"px-2.5 py-1 rounded-full bg-white border border-stone-200 text-[13px] text-slate-600 hover:border-[#7A9C5E]/70 transition-colors",children:e},e))})]})]})]})};function kn(e,t,n){return!e||n<1||e.book!==t||e.chapter!==n||!Number.isInteger(e.verse)||e.verse<1?null:e}yt.MORPHGNT.name,yt.MORPHGNT.attribution,yt.MORPHGNT.license;const vn={"N-":"名词","V-":"动词","A-":"形容词",RA:"冠词",RP:"人称代词",RR:"关系代词",RD:"指示代词",RI:"疑问/不定代词","C-":"连词","D-":"副词","P-":"介词","I-":"感叹词","X-":"小品词"},yn={1:"第一人称",2:"第二人称",3:"第三人称"},jn={P:"现在时",I:"未完成时",F:"将来时",A:"不定过去时",X:"完成时",Y:"过去完成时"},Zn={A:"主动",M:"中动",P:"被动"},Nn={I:"直说语气",D:"命令语气",S:"虚拟语气",O:"祈愿语气",N:"不定式",P:"分词"},Cn={N:"主格",G:"属格",D:"与格",A:"宾格",V:"呼格"}
1,En={S:"单数",P:"复数"},Tn={M:"阳性",F:"阴性",N:"中性"},Fn={C:"比较级",S:"最高级"};const In={"α":"a","β":"b","γ":"g","δ":"d","ε":"e","ζ":"z","η":"ē","θ":"th","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"x","ο":"o","π":"p","ρ":"r","σ":"s","ς":"s","τ":"t","υ":"y","φ":"ph","χ":"ch","ψ":"ps","ω":"ō"};function Sn(e){const t=Array.from(e.normalize("NFD").toLowerCase());let n="";for(let a=0;a<t.length;a+=1){const e=t[a],r=In[e];if(!r)continue;const o=[];for(;a+1<t.length&&new RegExp("\\p{M}","u").test(t[a+1]);)o.push(t[++a]);const s=o.includes("̔");let i=r+(o.includes("ͅ")?"i":"");s&&(i="ρ"===e?"rh":`h${i}`),n+=i}return n}function An(e){return e.normalize("NFD").replace(/[̀-ͯ᾽-῾]/g,"").normalize("NFC").toLowerCase().replace(/[^Ͱ-Ͽἀ-῿]/g,"")}const Dn={n:"名词",v:"动词",a:"形容词",ai:"疑问形容词",r:"代词",rp:"人称代词",rd:"指示代词",ri:"疑问代词",rr:"关系代词",ru:"不定代词",rf:"反身代词",ra:"冠词",c:"连词",x:"连词/助语词",i:"感叹词",p:"介词",d:"副词",dr:"关系副词",drp:"副词加人称代词",crp:"连词加人称代词",rre:"相互代词",t:"质词"},_n={n:"主格",g:"属格",d:"与格",a:"宾格",v:"呼格"},Bn={s:"单数",p:"复数",d:"双数"},$n={m:"阳性",f:"阴性",n:"中性"},Ln={1:"第一人称",2:"第二人称",3:"第三人称"},Mn={c:"比较级",s:"最高级"},qn={p:"现在时",i:"未完成时",f:"将来时",a:"简单过去时",b:"第二简单过去时",e:"过去时",x:"完成时",c:"第二完成时",d:"完成时",y:"过去完成时"},zn={a:"主动",m:"中动",p:"被动",n:"中动形主动意",o:"被动形主动意"},Pn={i:"直说语气",d:"命令语气",s:"虚拟语气",o:"祈愿语气",n:"不定式",p:"分词"},On=new Set(["n","a","ai","r","rp","rd","ri","rr","ru","rf","ra","rre"]);function Rn(e){return e.normalize("NFD").replace(new RegExp("\\p{M}
1","gu"),"").replace(/[^\u05d0-\u05ea]/g,"")}function Hn(e,t){const n=String(t||"").trim().match(/^[GH]?0*(\d{1,5})$/i);if(!n)return null;const a=Number(n[1]);return!Number.isInteger(a)||a<1?null:"hbo"===e&&a>8674?{short:`FHL ${a}`,label:"FHL 词形编号",kind:"fhl-form"}:{short:`${"hbo"===e?"H":"G"}${a}`,label:"Strong 编号",kind:"strong"}}const Wn="var(--readable-card, #FFFCF5)",Gn="var(--readable-paper, #FAF9F6)",Un="#F5F1E8",Jn="var(--readable-line, #E6E2D6)",Vn="#4F7942",Kn="var(--readable-green-wash, #E1ECD5)",Yn='"Noto Serif SC", "Source Han Serif SC", "Songti SC", serif',Qn="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#4F7942]/40 focus-visible:ring-offset-2";function Xn(e,n="data"){const a="ai"===n?{color:"var(--readable-gold, #7A4F11)",background:"#FBE7B6"}:{color:"var(--readable-sage, #3D5A2D)",background:Kn};return t.jsx("span",{className:"inline-flex min-h-7 items-center rounded-full px-2.5 text-[13px] font-medium",style:a,children:e})}function ea(e,n){const a={fact:{color:"var(--readable-sage, #3D5A2D)",background:Kn},grammar:{color:"#2C5E73",background:"#E2F0F3"},interpretation:{color:"var(--readable-gold, #70470F)",background:"#FFF0C8"},pastoral:{color:"#6B5135",background:"#EFE5D4"}};return t.jsx("span",{className:"inline-flex min-h-7 items-center rounded-full px-2.5 text-[13px] font-semibold",style:a[n],children:e})}const ta={high:"推论把握较高",medium:"推论需更多上下文",low:"较谨慎的推论"};function na(e,t){var n,a;const r=t.corpus.startsWith("FHL_");return{parseLabel:"grc"===e?r?function(e,t){const n=(e||"").trim().toLowerCase(),a=(t||"").trim().toLowerCase(),r=[Dn[n]].filter(Boolean);return"v"===n?(r.push(qn[a[0]],zn[a[1]],Pn[a[2]]),"p"===a[2]&&a.length>=6?r.push(_n[a[3]],Bn[a[4]],$n[a[5]]):r.push(Ln[a[3]],Bn[a[4]])):On.has(n)&&(r.push(_n[a[0]],Bn[a[1]],$n[a[2]]),"a"===n||"ai"===n?r.push(Mn[a[3]]):r.push(Ln[a[3]])),r.filter(Boolean).join("·")}(t.pos,t.parse):function(e,t){const n=vn[(e||"").trim()]||"",a=(t||"").padEnd(8,"-");return[n,...[yn[a[0]],jn[a[1]],Zn[a[2]],Nn[a[3]],Cn[a[4]],En[a[5]],Tn[a[6]],Fn[a[7]]].filter(Boolean)].filter(Boolean).join("·")||n||""}(t.pos,t.parse):t.morphologyZh||"",beginnerNote:"grc"===e?r?function(e,t){const n=(e||"").trim().toLowerCase(),a=(t||"").trim().toLowerCase(),r=[];if("ra"===n&&r.push("冠词帮助认出它所限定的名词,中文常不会逐字译出来"),"p"===n&&r.push("介词表达词与词之间的关系,要连同后面的格位一起理解"),"c"!==n&&"x"!==n||r.push("这个连接词把前后意思接起来,要留意并列、转折或因果关系"),"v"===n){const e={p:"现在时通常从持续或进行的角度观察动作",i:"未完成时通常描写过去正在进行或反复发生的动作",f:"将来时把动作放在将来或预期中",a:"简单过去时通常把动作作为一个整体来观察,不等于动作只发生一次",b:"第二简单过去时通常把动作作为一个整体来观察,不等于动作只发生一次",x:"完成时强调动作已经发生,并关注仍然存在的结果",c:"完成时强调动作已经发生,并关注仍然存在的结果",d:"完成时强调动作已经发生,并关注仍然存在的结果",y:"过去完成时关注过去某一点以前已经形成的结果"},t={m:"中动表示动作与主语自身有密切关系",p:"被动表示主语承受这个动作",n:"这个词采用中动词形,但意义按主动理解",o:"这个词采用被动词形,但意义按主动理解"},n={d:"命令语气带出命令、请求或劝勉",s:"虚拟语气常表达目的、可能或期待,具体意思要看上下文",n:"不定式把动作当作一个整体概念来使用",p:"分词用来补充动作或描述,和主句的关系要看上下文"};e[a[0]]&&r.push(e[a[0]]),t[a[1]]&&r.push(t[a[1]]),n[a[2]]&&r.push(n[a[2]])}else if(On.has(n)){const e={n:"主格通常标出主语或表语",g:"属格通常表达所属、来源或关系",d:"与格通常表达对象、工具或所在",a:"宾格通常标出动作的对象,也可能表达方向或范围",v:"呼格用于直接称呼某人"};e[a[0]]&&r.push(e[a[0]])}return r.slice(0,3).join(";")}(t.pos,t.parse):function(e,t){const n=(e||"").trim(),a=(t||"").padEnd(8,"-"),r=[];if("RA"===n&&r.push("冠词帮助认出它所限定的名词,中文常不会逐字译出来"),"P-"===n&&r.push("介词表达词与词之间的关系,要连同后面的格位一起理解"),"C-"===n&&r.push("连词把前后意思接起来,留意它是在并列、转折还是说明原因"),"V-"===n){const e={P:"现在时通常从持续或进行的角度观察动作",I:"未完成时通常描写过去正在进行或反复发生的动作",F:"将来时把动作放在将来或预期中",A:"不定过去时通常把动作作为一个整体来观察,不等于动作只发生一次",X:"完成时强调动作已经发生,并关注仍然存在的结果",Y:"过去完成时关注过去某一点以前已经形成的结果"},t={M:"中动表示动作与主语自身有密切关系",P:"被动表示主语承受这个动作"},n={D:"命令语气带出命令、请求或劝勉",S:"虚拟语气常表达目的、可能或期待,具体意思要看上下文",N:"不定式把动作当作一个整体概念来使用",P:"分词用来补充动ä
1½œæˆ–描述,和主句的关系要看上下文"};e[a[1]]&&r.push(e[a[1]]),t[a[2]]&&r.push(t[a[2]]),n[a[3]]&&r.push(n[a[3]])}else{const e={N:"主格通常标出主语或表语",G:"属格通常表达所属、来源或关系",D:"与格通常表达对象、工具或所在",A:"宾格通常标出动作的对象,也可能表达方向或范围",V:"呼格用于直接称呼某人"};e[a[4]]&&r.push(e[a[4]])}return r.slice(0,3).join(";")}(t.pos,t.parse):"",compactMorphology:(null==(a=null==(n=t.morphologyZh)?void 0:n.split(/[,;。]/)[0])?void 0:a.trim())||"",surfaceTranslit:"grc"===e?Sn(t.surface):"",lemmaTranslit:t.transliteration||("grc"===e?Sn(t.lemma):""),numberLabel:Hn(e,t.strongNo)}}const aa=({bookKey:n,bookZh:a,bookEn:r,chapter:o,verse:s,lang:i,onClose:l})=>{var d,c,h,u,m;const[b,f]=e.useState(null),[g,w]=e.useState(""),[k,v]=e.useState(""),[y,Z]=e.useState(""),[N,C]=e.useState(null),[E,T]=e.useState(!1),[F,I]=e.useState({}),[S,A]=e.useState(null),[D,_]=e.useState(null),[B,$]=e.useState(null),[L,M]=e.useState(null),[q,z]=e.useState(!1),[P,O]=e.useState(null),R=e.useId(),H=e.useRef(null),W=e.useRef(null),G=e.useRef(null),U=e.useRef(null),J=e.useRef(null),V=e.useRef(0),K=x(),Y=null==K?void 0:K.setOverlayOpen,Q="hbo"===i,X=function(e,t,n,a){if("grc"===e)return"greek";if("jeremiah"===t&&10===n&&11===a)return"aramaic";if("ezra"===t){if(4===n&&a>=8)return"aramaic";if(5===n)return"aramaic";if(6===n&&a<=18)return"aramaic";if(7===n&&a>=12&&a<=26)return"aramaic"}if("daniel"===t){if(2===n&&4===a)return"hebrew-aramaic";if(2===n&&a>=5)return"aramaic";if(n>=3&&n<=6)return"aramaic";if(7===n&&a<=28)return"aramaic"}return"hebrew"}(i,n,o,s),ee="greek"===(te=X)?"希腊文":"aramaic"===te?"亚兰文":"hebrew-aramaic"===te?"希伯来文与亚兰文混合":"希伯来文";var te;const ne=function(e){return"greek"===e||"hebrew"===e}(X),ae="grc"===i?"el-GR":"he-IL",re="grc"===i?"TISCH":"WLC",oe="grc"===i?"Tischendorf 8th(公有领域)":"Westminster Leningrad Codex(公有领域)",se="grc"===i?"现代希腊语 WaveNet 语音":"现代以色列希伯来语 WaveNet 语音",ie="grc"===i?`采用 Google ${se};这是现代希腊语读法,与新约时代的读音不同,只用来帮助认出、记住原文。`:`采用 Google ${se};这是现代以色列希伯来语读法,与旧约时代的读音不同,只用来帮助认出、记住原文。`,le="hebrew-aramaic"===X?"本节横跨希伯来文与亚兰文,暂不提供整节或逐词读音,以免用现代希伯来语冒充亚兰文。":"本段是亚兰文,暂不提供读音,以免用现代希伯来语冒充亚兰文。",de=e.useCallback(()=>{var e;V.current+=1,null==(e=U.current)||e.pause(),U.current=null,J.current&&URL.revokeObjectURL(J.current),J.current=null,"undefined"!=typeof window&&window.speechSynthesis&&window.speechSynthesis.cancel(),_(null)},[]);e.useEffect(()=>{let e=!0;return de(),f(null),w(""),v(""),Z(""),async function(e,t,n,a){const r=await p.rpc("get_original_words_for_verse",{p_lang:e,p_book_key:t,p_chapter:n,p_verse:a});let o=r.data||[],s=!r.error;if(r.error){console.error("[originalWords] 逐节 RPC 暂不可用,尝试迁移期只读降级",r.error);const i=await p.from("bible_original_words").select("corpus, position, surface, lemma, pos, parse, strong_no, gloss_zh, morphology_zh, remark_zh, source_revision").eq("lang",e).eq("book_key",t).eq("chapter",n).eq("verse",a).order("position",{ascending:!0});if(i.error)return console.error("[originalWords] 读取逐词失败",i.error),[];o=i.data||[],s=!1}const i=o.map(e=>({corpus:e.corpus,position:e.position,surface:e.surface,lemma:e.lemma,pos:e.pos,parse:e.parse,strongNo:e.strong_no||void 0,sourceGloss:e.gloss_zh||void 0,morphologyZh:e.morphology_zh||void 0,remarkZh:e.remark_zh||void 0,sourceRevision:e.source_revision||void 0,occurrences:e.occurrences??void 0,sourceName:e.source_name||void 0,sourceLicense:e.source_license||void 0,sourceUrl:e.source_url||void 0,licenseUrl:e.license_url||void 0})),l="hbo"===e?"FHL_WLC":"FHL_WH",d=i.filter(e=>e.corpus===l),c=d.length?d:i;if(!c.length)return[];const h=[...new Set(c.map(e=>e.lemma))],u=[...new Set(c.map(e=>e.corpus))],m=new Map;
1if(s)for(const p of c)"number"==typeof p.occurrences&&m.set(`${p.corpus}|${p.lemma}`,p.occurrences);else{const{data:t,error:n}=await p.from("bible_lemma_stats").select("corpus, lemma, occurrences").eq("lang",e).in("corpus",u).in("lemma",h);n&&console.error("[originalWords] 读取词频失败",n);for(const e of t||[])m.set(`${e.corpus}|${e.lemma}`,e.occurrences)}const{data:x,error:b}=await p.from("original_vocab").select("lemma, transliteration, gloss_zh, pos_zh, note").eq("lang",e).eq("published",!0).in("lemma",h);b&&console.error("[originalWords] 读取已核词条失败",b);const f=new Map((x||[]).map(e=>[e.lemma,e]));return c.map(e=>{const t=f.get(e.lemma);return{...e,occurrences:m.get(`${e.corpus}|${e.lemma}`)??e.occurrences,transliteration:null==t?void 0:t.transliteration,gloss:(null==t?void 0:t.gloss_zh)||e.sourceGloss,posZh:null==t?void 0:t.pos_zh,vocabNote:(null==t?void 0:t.note)??void 0}})}(i,n,o,s).then(t=>{e&&f(t)}).catch(()=>{e&&f([])}),Promise.all([j(r,o,re).catch(()=>[]),j(r,o,"CUV").catch(()=>[]),j(r,o,"WEB").catch(()=>[])]).then(([t,n,a])=>{var r,o,i;e&&(w((null==(r=t.find(e=>e.verse===s))?void 0:r.text)||""),v((null==(o=n.find(e=>e.verse===s))?void 0:o.text)||""),Z((null==(i=a.find(e=>e.verse===s))?void 0:i.text)||""))}),C(null),T(!1),I({}),A(null),_(null),$(null),M(null),O(null),()=>{e=!1}},[i,n,r,o,s,re,de]),e.useEffect(()=>()=>{var e;V.current+=1,null==(e=U.current)||e.pause(),J.current&&URL.revokeObjectURL(J.current),"undefined"!=typeof window&&window.speechSynthesis&&window.speechSynthesis.cancel()},[]),e.useEffect(()=>{G.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const e=document.body.style.overflow;document.body.style.overflow="hidden",null==Y||Y(!0);const t=window.requestAnimationFrame(()=>{var e;return null==(e=W.current)?void 0:e.focus()}),n=e=>{if("Escape"===e.key)return e.preventDefault(),void l();if("Tab"!==e.key||!H.current)return;const t=Array.from(H.current.querySelectorAll('button:not([disabled]), summary, a[href], [tabindex]:not([tabindex="-1"])')).filter(e=>!e.hasAttribute("disabled"));if(!t.length)return;const n=t[0],a=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),a.focus()):e.shiftKey||document.activeElement!==a||(e.preventDefault(),n.focus())};return document.addEventListener("keydown",n),()=>{var a;window.cancelAnimationFrame(t),document.removeEventListener("keydown",n),document.body.style.overflow=e,null==Y||Y(!1),null==(a=G.current)||a.focus()}},[l,Y]);const ce=e.useMemo(()=>Boolean(g)&&Boolean(null==b?void 0:b.length)&&("grc"===i?!function(e,t){const n=e.split(/\s+/).map(An).filter(Boolean),a=t.map(An).filter(Boolean);return n.length===a.length&&n.every((e,t)=>e===a[t])}(g,(b||[]).map(e=>e.surface)):!function(e,t){const n=Rn(e),a=Rn(t.join(""));return Boolean(n)&&n===a}(g,(b||[]).map(e=>e.surface))),[i,g,b]),he=e.useMemo(()=>(null==b?void 0:b.length)?jt(b[0].corpus):null,[b]),ue=e.useMemo(()=>[...new Set((b||[]).map(e=>e.sourceRevision).filter(Boolean))].join("、"),[b]),me=e.useMemo(()=>null===N?null:(null==b?void 0:b.find(e=>e.position===N))||null,[N,b]),pe=e.useMemo(()=>me?na(i,me):null,[me,i]),xe=me?`${me.corpus}|${me.lemma}`:"",be=me?F[xe]:void 0,fe=(null==be?void 0:be.filter(e=>e!==s))||[],ge=me?`surface:${me.position}:${me.surface}`:"",we=me?`lemma:${me.position}:${me.lemma}`:"",ke=e.useMemo(()=>{if(!me||!pe)return[];const e=["词典形",pe.parseLabel,me.morphologyZh,me.posZh].filter(Boolean).join(" · ");return Tt(i,e)},[me,pe,i]),ve=e.useCallback(async(e,t,n,a)=>{if(!ne)return void A(le);if((null==D?void 0:D.key)===n)return void de();de();const r=V.current+1;V.current=r,A(null),_({key:n,status:"loading"});try{const o=await Ct(e,i,a);if(V.current!==r)return;const s=URL.createObjectURL(new Blob([o],{type:"audio/mpeg"})),l=new Audio(s);U.current=l,J.current=s;const d=()=>{V.current===r&&de()},c=()=>{V.current===r&&(de(),Zt(e,ae,!0)?A(`云端音频播放失败,已改用这台设备的${"grc"===i?"希腊语":"希伯来语"}语音播放${t}。`):A(`音频播放失败,这台设备也没有可用的${"grc"===i?"希腊语":"希伯来语"}语音,暂时无法播放${t}。`))};l.addEventListener("ended",d,{once:!0}),l.addEventListener("error",c,{once:!0}),await l.play(),V.current===r&&_({key:n,status:"playing"})}catch{if(V.current!==r)return;_(null),Zt(e,ae,!0)?A(`Google 语音暂时不可用,已改用这台设备的${"grc"===i?"希腊语":"希伯来语"}语音播放${t}。`):A(`Google 语音暂时不可用,这台设备也没有可用的${"grc"===i?"希腊语":"希伯来语"}语音,暂时无法播放${t}。`)}},[le,i,ne,ae,null==D?void 0:D.key,de]),ye=e.useCallback(e=>{const t=N!==e.position,a=`surface:${e.position}:${e.surface}`;if($(null),C(t?e.position:null),!t)return void((null==D?void 0:D.key)===a&&de());ne&&ve(e.surface,"本节词形",a,"word");const r=`${e.corpus}|${e.lemma}`;void 0===F[r]&&(I(e=>({...e,[r]:null})),async function(e,t,n,a,r){const{data:o,error:s}=await p.rpc("get_original_lemma_verses_in_chapter",{p_lang:e,p_corpus:t,p_lemma:n,p_book_key:a,p_chapter:r});return s?(console.error("[originalWords] 读取本章同词失败",s),[]):[...new Set((o||[]).map(e=>e.verse))]}(i,e.corpus,e.lemma,n,o).then(e=>I(t=>({...t,[r]:e}))).catch(()=>I(e=>({...e,[r]:[]}))))}
1,[N,n,o,F,i,ve,ne,null==D?void 0:D.key,de]),je=e.useCallback(async()=>{const e=Et(i),t=null==e?void 0:e.versions[0];if(e&&t){z(!0),O(null);try{const r=await Nt({lang:i,versionCode:t.code,langName:e.nameZh,versionName:t.nameZh,bookKey:n,chapter:o,verse:s,refZh:`${a} ${o}:${s}`,registerNote:e.registerNote,traps:e.learnerTraps,analysisMode:!0});M(r.lesson)}catch(r){O(r instanceof Error?r.message:"深入解释生成失败,请再试一次")}finally{z(!1)}}},[i,n,a,o,s]);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"fixed inset-0 z-[90]",style:{background:"rgba(20,18,12,0.45)",backdropFilter:"blur(2px)"},onClick:l,"aria-hidden":"true"}),t.jsxs("div",{ref:H,className:"fixed inset-x-0 bottom-0 z-[95] mx-auto flex max-h-[calc(88*var(--vh-unit))] max-w-[620px] flex-col shadow-sm",style:{background:Wn,borderRadius:"18px 18px 0 0"},role:"dialog","aria-modal":"true","aria-labelledby":R,children:[t.jsxs("div",{className:"px-5 pt-3",style:{background:"var(--readable-warm, #F4F2EC)",borderRadius:"18px 18px 0 0"},children:[t.jsx("div",{className:"mx-auto mb-3 h-1 w-9 rounded-full",style:{background:"#DDD8CC"}}),t.jsxs("div",{className:"flex items-center justify-between gap-3 pb-3",children:[t.jsxs("h2",{id:R,className:"text-[21px] text-slate-800",style:{fontFamily:Yn},children:[a," ",o,":",s," · 原文"]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("button",{type:"button",onClick:()=>T(e=>!e),className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-full ${Qn}`,style:{color:"var(--readable-sage, #3D5A2D)",background:E?Kn:Un},"aria-label":"查看发音、词形与编号说明","aria-expanded":E,"aria-controls":`${R}-reference-help`,children:t.jsx(Ae,{size:19,"aria-hidden":"true"})}),t.jsx("button",{ref:W,type:"button",onClick:l,className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-full ${Qn}`,"aria-label":"关闭原文抽屉",children:t.jsx(Te,{size:20,className:"text-slate-600","aria-hidden":"true"})})]})]})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto px-5 pb-8 pt-4",children:[E&&t.jsxs("div",{id:`${R}-reference-help`,className:"mb-4 space-y-2 rounded-2xl border-2 p-4 text-[15px] leading-[1.8] text-slate-700",style:{borderColor:Jn,background:Un},children:[t.jsxs("p",{children:[t.jsx("span",{className:"font-semibold",style:{color:"var(--readable-sage, #3D5A2D)"},children:"发音:"}),ne?ie:le]}),t.jsxs("p",{children:[t.jsx("span",{className:"font-semibold",style:{color:"var(--readable-sage, #3D5A2D)"},children:"词形:"}),"这项资料帮助认出前缀、词干或词尾;它在本句中的具体作用,仍要结合前后文判断。"]}),t.jsxs("p",{children:[t.jsx("span",{className:"font-semibold",style:{color:"var(--readable-sage, #3D5A2D)"},children:"编号:"}),"G/H 是 Strong 编号,FHL 是信望爱的词形检索编号;编号帮助查词典,不直接决定本句词义。"]}),t.jsxs("p",{children:[t.jsx("span",{className:"font-semibold",style:{color:"var(--readable-sage, #3D5A2D)"},children:"底本:"}),"整节经文与逐词资料分别标明来源;不同底本可能有字面差异,不能机械对齐。"]}),t.jsxs("p",{children:[t.jsx("span",{className:"font-semibold",style:{color:"var(--readable-sage, #3D5A2D)"},children:"转写:"}),"字母转写只是把原文字母换写成拉丁字母,不等同于读音。"]})]}),t.jsxs("section",{"aria-label":"经文与原文",children:[t.jsxs("div",{className:"space-y-3",children:[(k||y)&&t.jsxs("div",{className:"rounded-2xl border-2 p-4",style:{borderColor:Jn,background:Gn},children:[k&&t.jsxs("div",{children:[t.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[t.jsx("span",{className:"text-[15px] font-semibold text-slate-700",children:"和合本"}),Xn("中英译本")]}),t.jsx("p",{className:"text-[18px] leading-[1.9] text-slate-800",children:k})]}),y&&t.jsxs("div",{className:k?"mt-4 border-t-2 pt-4":"",style:k?{borderColor:Jn}:void 0,children:[t.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[t.jsx("span",{className:"text-[15px] font-semibold text-slate-700",children:"WEB · World English Bible"}),!k&&Xn("中英译本")]}),t.jsx("p",{className:"text-[18px] leading-[1.8] text-slate-700",lang:"en",children:y})]})]}),g&&t.jsxs("div",{className:"rounded-2xl border-2 p-4",style:{borderColor:Jn,background:Wn},children:[t.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[t.jsxs("span",{className:"text-[15px] font-semibold text-slate-700",children:[ee,"原文"]}),ne?t.jsxs("button",{type:"button",onClick:()=>{ve(g,"整节原文","whole-verse","verse")},className:`inline-flex min-h-9 items-center gap-1.5 rounded-full px-3 text-[13px] font-semibold ${Qn}`,style:{color:"var(--readable-sage, #3D5A2D)",background:Kn},children:["whole-verse"===(null==D?void 0:D.key)&&"loading"===D.status?t.jsx(Ce,{size:15,className:"animate-spin","aria-hidden":"true"}):t.jsx(De,{size:15,"aria-hidden":"true"}),"whole-verse"===(null==D?void 0:D.key)?"loading"===D.status?"正在准备…":"播放中 · 点此停止":"听整节原文"]}):Xn("暂不提供朗读")]}),(!(null==b?void 0:b.length)||ce)&&t.jsx("p",{className:"text-[24px] leading-[1.9] text-slate-800",dir:Q?"rtl":void 0,children:g}),null===b&&t.jsxs("div",{className:"mt-3 flex items-center gap-2 text-[15px] text-slate-600",children:[t.jsx(Ce,{size:17,className:"animate-spin",style:{color:"var(--readable-sage, #4F7942)"},"aria-hidden":"true"}),"正在取这一节的逐词资料…"]}),0===(null==b?void 0:b.length)&&t.jsx("p",{className:"mt-3 text-[15px] leading-[1.8] text-slate-600",children:"这一节暂时没有可核对的逐词资料,请先从整节原文与译本对照阅读。"}),(null==b?void 0:b.length)?t.jsxs("div",{className:ce?"mt-4 border-t-2 pt-4":"",style:ce?{borderColor:Jn}:void 0,children:[t.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[t.jsx("span",{className:"text-[15px] font-semibold text-slate-700",children:ce?"逐词标注底本 · 点词查看":"点一个词,查看原型与 Strong 编号"}),Xn(`${b[0].corpus} · 每词可点`)]}),Q&&t.jsxs("p",{className:"mb-1 text-[13px] leading-relaxed text-slate-500",children:["阅读提示:",ee,"请从右向左读。"]}),t.jsx("div",{className:"flex flex-wrap items-start gap-x-1 gap-y-2",dir:Q?"rtl":"ltr",lang:"hbo"===i?"he":"el",role:"list","aria-label":`${ee}逐词原文;每个词都可点击查看资料`,children:b.map(e=>{const n=N===e.position,a=Hn(i,e.strongNo);return t.jsx("span",{role:"listitem",className:"inline",children:t.jsxs("button",{type:"button",onClick:()=>ye(e),className:`inline-flex min-h-[56px] flex-col items-center justify-start rounded-md px-0.5 py-1 transition-colors ${Qn}`,style:{color:n?"var(--readable-sage, #3D5A2D)":"#1E293B",background:"transparent"},"aria-expanded":n,"aria-controls":n?`${R}-selected-word`:void 0,"aria-label":`第 ${e.position} 词,${e.surface}${a?`,${a.short}`:""};播放本节词形并查看词语资料`,children:[t.jsx("span",{className:"border-b-2 pb-0.5 text-[24px] leading-tight",style:{borderBottomColor:n?Vn:"transparent"},children:e.surface}),a&&t.jsx("span",{className:"mt-0.5 text-[13px] font-medium tabular-nums text-slate-500",dir:"ltr",children:a.short})]})},`verse-word-${e.corpus}-${e.position}`)}
1)}),me&&pe&&t.jsxs("div",{id:`${R}-selected-word`,className:"mt-3 rounded-2xl border-2 p-4",style:{borderColor:Vn,background:"var(--readable-green-wash, #F3F7EC)"},"aria-live":"polite",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsxs("span",{className:"text-[15px] font-semibold",style:{color:"var(--readable-sage, #3D5A2D)"},children:["第 ",me.position," 词"]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[ea("词典事实","fact"),pe.numberLabel&&t.jsx("span",{className:"inline-flex min-h-7 items-center rounded-full px-2.5 text-[13px] font-semibold tabular-nums",dir:"ltr",style:{color:"var(--readable-sage, #3D5A2D)",background:Wn},children:pe.numberLabel.short})]})]}),t.jsxs("div",{className:"mt-2 flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[t.jsx("span",{className:"text-[26px] text-slate-800",dir:Q?"rtl":void 0,children:me.surface}),pe.surfaceTranslit&&t.jsxs("span",{className:"text-[15px] text-slate-600",children:["字母转写 ",pe.surfaceTranslit]})]}),t.jsxs("div",{className:"mt-2 flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[t.jsx("span",{className:"text-[15px] font-medium text-slate-600",children:"词典形"}),t.jsx("span",{className:"text-[23px] text-slate-800",dir:Q?"rtl":void 0,children:me.lemma}),pe.lemmaTranslit&&t.jsxs("span",{className:"text-[15px] text-slate-600",children:["字母转写 ",pe.lemmaTranslit]})]}),ne&&t.jsxs("div",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:[t.jsxs("button",{type:"button",onClick:()=>{ve(me.surface,"本节词形",ge,"word")},className:`flex min-h-11 items-center justify-center gap-2 rounded-xl border-2 px-3 text-[15px] font-medium ${Qn}`,style:{borderColor:Jn,color:"var(--readable-sage, #3D5A2D)",background:Wn},children:[(null==D?void 0:D.key)===ge&&"loading"===D.status?t.jsx(Ce,{size:17,className:"animate-spin","aria-hidden":"true"}):t.jsx(De,{size:17,"aria-hidden":"true"}),(null==D?void 0:D.key)===ge?"loading"===D.status?"正在准备…":"播放中 · 点此停止":"重听本节词形"]}),t.jsxs("button",{type:"button",onClick:()=>{ve(me.lemma,"词典形",we,"word")},className:`flex min-h-11 items-center justify-center gap-2 rounded-xl border-2 px-3 text-[15px] font-medium ${Qn}`,style:{borderColor:Vn,color:"var(--readable-sage, #3D5A2D)",background:Kn},children:[(null==D?void 0:D.key)===we&&"loading"===D.status?t.jsx(Ce,{size:17,className:"animate-spin","aria-hidden":"true"}):t.jsx(De,{size:17,"aria-hidden":"true"}),(null==D?void 0:D.key)===we?"loading"===D.status?"正在准备…":"播放中 · 点此停止":"听词典形"]})]}),t.jsxs("dl",{className:"mt-2 space-y-1 text-[15px] leading-[1.8] text-slate-700",children:[(me.gloss||me.sourceGloss)&&t.jsxs("div",{className:"flex gap-2",children:[t.jsx("dt",{className:"shrink-0 text-slate-500",children:"简义"}),t.jsx("dd",{children:me.gloss||me.sourceGloss})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx("dt",{className:"shrink-0 text-slate-500",children:"词形"}),t.jsx("dd",{children:pe.parseLabel||pe.compactMorphology||me.posZh||"暂无附带形态标注"})]})]}),ke.length>0&&t.jsxs("div",{className:"mt-3",children:[t.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[15px] font-semibold",style:{color:"var(--readable-sage, #3D5A2D)"},children:[t.jsx(Ae,{size:16,"aria-hidden":"true"}),"看懂这些标签"]}),t.jsx("div",{className:"flex flex-wrap gap-2","aria-label":"与这个词有关的简明语法",children:ke.map(({entry:e,label:n})=>t.jsxs("button",{type:"button",onClick:()=>$({entryId:e.id,label:n}),className:`inline-flex min-h-10 items-center gap-1.5 rounded-full border-2 px-3 text-[15px] font-medium ${Qn}`,style:{borderColor:"#C7DDE3",color:"#2C5E73",background:"#F3F9FA"},"aria-label":`查看${n}的简明语法说明`,children:[n,t.jsx(Ae,{size:14,"aria-hidden":"true"})]},e.id))})]}),(pe.beginnerNote||me.vocabNote||me.remarkZh)&&t.jsxs("div",{className:"mt-3 rounded-xl border-2 p-3",style:{borderColor:Jn,background:Wn},children:[t.jsx("div",{className:"text-[15px] font-semibold",style:{color:"var(--readable-sage, #3D5A2D)"},children:"grc"===i&&pe.beginnerNote?"这一词形在句中做什么":"词语补充"}),pe.beginnerNote&&t.jsx("p",{className:"mt-1 text-[18px] leading-[1.8] text-slate-700",children:pe.beginnerNote}),me.vocabNote&&t.jsx("p",{className:"mt-2 text-[15px] leading-[1.8] text-slate-600",children:me.vocabNote.replace(/\*\*/g,"")}),me.remarkZh&&me.remarkZh!==me.vocabNote&&t.jsx("p",{className:"mt-2 text-[15px] leading-[1.8] text-slate-600",children:me.remarkZh})]}),t.jsxs("div",{className:"mt-3 text-[15px] leading-[1.8] text-slate-600",children:["number"==typeof me.occurrences&&t.jsxs("p",{children:["这个词典形在","grc"===i?"新约":"旧约","出现 ",t.jsx("span",{className:"font-semibold",style:{color:"var(--readable-sage, #3D5A2D)"},children:me.occurrences})," 次。"]}
1),pe.numberLabel&&t.jsxs("p",{children:[pe.numberLabel.label,":",t.jsx("span",{dir:"ltr",className:"tabular-nums",children:pe.numberLabel.short})]}),null===be&&t.jsx("p",{children:"正在找本章里的同词…"}),fe.length>0&&t.jsxs("p",{children:["本章还出现在第 ",fe.join("、")," 节。"]}),be&&0===fe.length&&t.jsx("p",{children:"本章其他经节没有再出现这个词典形。"})]}),t.jsxs("details",{className:"mt-3 rounded-xl border-2 px-3 py-2",style:{borderColor:Jn,background:Wn},children:[t.jsx("summary",{className:`min-h-11 cursor-pointer py-2 text-[15px] font-medium text-slate-600 ${Qn}`,children:"学术标签"}),t.jsxs("p",{className:"pb-2 text-[15px] leading-[1.8] text-slate-600",children:[pe.parseLabel||me.morphologyZh||"这一个词没有附带形态标注。",me.pos||me.parse?`(${[me.pos,me.parse].filter(Boolean).join(" · ")})`:""]})]})]})]}):null,!ne&&t.jsx("p",{className:"mt-3 rounded-xl border-2 p-3 text-[15px] leading-[1.8] text-slate-700",style:{borderColor:"#D6B36A",background:"#FFF7DF"},children:le})]})]}),ce&&t.jsx("p",{className:"mt-3 rounded-xl border-2 p-3 text-[15px] leading-[1.8] text-slate-700",style:{borderColor:"#D6B36A",background:"#FFF7DF"},children:"grc"===i?"本节展示经文与逐词标注采用的希腊文底本有字面差异,请不要把两行机械地逐字对齐。":`本节展示的 ${ee} 经文与逐词资料有字面或分词差异,请先按整节理解,不要机械逐字对齐。`}),t.jsx("p",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:S||("loading"===(null==D?void 0:D.status)?"正在准备原文读音":"playing"===(null==D?void 0:D.status)?"正在播放原文读音":"")}),S&&t.jsx("p",{className:"mt-3 rounded-xl border-2 p-3 text-[15px] leading-[1.8] text-slate-700",style:{borderColor:Jn,background:Un},children:S})]}),t.jsxs("section",{className:"mt-6","aria-labelledby":`${R}-insight`,children:[t.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[t.jsx("h3",{id:`${R}-insight`,className:"text-[19px] font-semibold text-slate-800",style:{fontFamily:Yn},children:"深入读这一节"}),Xn("AI 辅助","ai")]}),t.jsx("p",{className:"text-[15px] leading-[1.8] text-slate-600",children:"AI 根据可核对的经文与词形资料整理解释;下方依据和推论把握由 AI 给出,未经原文教师逐条审核。请结合上下文查考。"}),t.jsxs("div",{className:"mt-3 flex flex-wrap gap-2","aria-label":"原文分析的四个层次",children:[ea("1 资料事实","fact"),ea("2 语法解释","grammar"),ea("3 释经推论","interpretation"),ea("4 牧养应用","pastoral")]}),!L&&t.jsx("button",{type:"button",onClick:je,disabled:q,className:`mt-3 flex min-h-12 w-full items-center justify-center gap-2 rounded-full border-2 px-4 text-[15px] font-medium disabled:opacity-70 ${Qn}`,style:{borderColor:Vn,color:"var(--readable-sage, #3D5A2D)",background:Kn},children:q?t.jsxs(t.Fragment,{children:[t.jsx(Ce,{size:17,className:"animate-spin","aria-hidden":"true"})," 正在按四个层次整理这节经文…"]}):t.jsxs(t.Fragment,{children:[t.jsx(_e,{size:17,"aria-hidden":"true"})," 深入读这一节"]})}),P&&t.jsx("p",{className:"mt-2 text-[15px] leading-[1.7] text-red-700",role:"alert",children:P}),L&&t.jsxs("div",{className:"mt-4 space-y-3",children:[L.contextScope&&t.jsxs("p",{className:"text-[15px] leading-[1.8] text-slate-600",children:["本次上下文:",L.contextScope]}),L.verseConfidence&&"high"!==L.verseConfidence&&t.jsxs("p",{className:"rounded-xl border-2 p-3 text-[15px] leading-[1.8]",style:{borderColor:"#D6B36A",background:"#FFF7DF",color:"var(--readable-gold, #70470F)"},children:["这一处与和合本编号可能没有完全对齐,以下解释的原文措辞需要再核对。",L.verseNote?`(${L.verseNote})`:""]}),L.literal&&t.jsxs("div",{className:"rounded-2xl border-2 p-4",style:{borderColor:Jn,background:Gn},children:[t.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[t.jsx("span",{className:"text-[15px] font-semibold",style:{color:"var(--readable-sage, #3D5A2D)"},children:"贴近原文的辅助直译"}),Xn("不是唯一译法","ai")]}),t.jsx("p",{className:"text-[18px] leading-[1.9] text-slate-800",children:L.literal})]}),((null==(d=L.context)?void 0:d.before)||(null==(c=L.context)?void 0:c.after))&&t.jsxs("div",{className:"rounded-2xl border-2 p-4",style:{borderColor:Jn,background:Wn},children:[t.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2",children:[t.jsx("span",{className:"text-[15px] font-semibold text-slate-700",children:"放回前后文"}),ea("释经推论","interpretation")]}),t.jsxs("div",{className:"space-y-3",children:[L.context.before&&t.jsxs("p",{className:"text-[18px] leading-[1.8] text-slate-700",children:[t.jsx("span",{className:"font-semibold text-slate-800",children:"前文怎样引入:"}),L.context.before]}),L.context.after&&t.jsxs("p",{className:"text-[18px] leading-[1.8] text-slate-700",children:[t.jsx("span",{className:"font-semibold text-slate-800",children:"后文怎样推进:"}),L.context.after]})]})]}),(null==(h=L.grammar)?void 0:h.length)?t.jsxs("div",{className:"rounded-2xl border-2 p-4",style:{borderColor:"#C7DDE3",background:"#F3F9FA"},children:[t.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2",children:[t.jsx("span",{className:"text-[15px] font-semibold text-slate-700",children:"这些语法怎样帮助理解"}),ea("语法解释","grammar")]}),t.jsx("div",{className:"space-y-3",children:L.grammar.map((e,n)=>t.jsxs("p",{className:"text-[18px] leading-[1.8] text-slate-700",children:[t.jsx("span",{className:"font-semibold text-slate-800",children:e.point}),":",e.explain]},`grammar-${n}`))})]}):null,(null==(u=L.interpretation)?void 0:u.length)?t.jsxs("div",{className:"rounded-2xl border-2 p-4",style:{borderColor:"#E2C98F",background:"#FFF9EA"},children:[t.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-2",children:[t.jsx("span",{className:"text-[15px] font-semibold text-slate-700",children:"这节经文可以怎样理解"}),ea("释经推论","interpretation")]}),t.jsx("div",{className:"space-y-4",children:L.interpretation.map((e,n)=>t.jsxs("div",{children:[t.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[t.jsx("p",{className:"text-[18px] font-semibold leading-[1.8] text-slate-800",children:e.claim}),t.jsx("span",{className:"text-[13px] text-slate-500",children:ta[e.confidence]})]}),t.jsxs("p",{className:"mt-1 text-[15px] leading-[1.8] text-slate-600",children:["依据:",e.basis]})]},`interpretation-${n}`))})]}):null,(null==(m=L.pitfalls)?void 0:m.length)?t.jsxs("div",{className:"rounded-2xl border-2 p-4",style:{borderColor:Jn,background:Un},children:[t.jsx("div",{className:"mb-2 text-[15px] font-semibold text-slate-700",children:"解释边界"}),t.jsx("ul",{className:"list-disc space-y-1 ps-5",children:L.pitfalls.map((e,n)=>t.jsx("li",{className:"text-[18px] leading-[1.8] text-slate-700",children:e},n))})]}):null,L.application&&t.jsxs("div",{className:"rounded-2xl border-2 p-4",style:{borderColor:"#CFE0BB",background:Kn},children:[t.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[t.jsx("span",{className:"text-[15px] font-semibold",style:{color:"var(--readable-sage, #3D5A2D)"},children:"默想与回应"}),ea("牧养应用","pastoral")]}),t.jsx("p",{className:"text-[18px] leading-[1.9] text-slate-800",children:L.application})]})]})]}),t.jsxs("div",{className:"mt-6 border-t-2 pt-3 text-[13px] leading-[1.8] text-slate-500",style:{borderColor:Jn},children:[t.jsxs("p",{children:["和合本:本站经文库上帝版 · 原文:",oe]}),he?t.jsxs("p",{children:["逐词资料:",t.jsx("a",{className:"underline underline-offset-2",href:he.sourceUrl,target:"_blank",rel:"noreferrer",children:he.attribution})," · ",t.jsx("a",{className:"underline underline-offset-2",href:he.licenseUrl,target:"_blank",rel:"noreferrer",children:he.license}),ue?` · 资料版本 ${ue}`:""]}):null,t.jsx("p",{children:"AI 内容已与词典事实分层,请结合整段上下文查考。"})]})]})]}),B&&t.jsx(Ft,{lang:i,initialEntryId:B.entryId,matchedLabel:B.label,manageOverlayNav:!1,onClose:()=>$(null)})]})},ra=(e,t)=>`bct_modinvite_${e}_${t}`,oa="days",sa="declined",ia="snooze",la="done",da=e=>{try{return localStorage.getItem(e)||""}catch{return""}},ca=(e,t)=>{try{localStorage.setItem(e,t)}catch{}};
1function ha(e,t=Z(),n=Date.now()){if(t.includes(e))return ca(ra(e,la),"1"),!1;if(function(e){return"1"===da(ra(e,la))}(e))return!1;const a=n<(Number(da(ra(e,ia)))||0),r=(e=>new Date(e).toISOString().slice(0,10))(n),o=da(ra(e,oa)).split(",").filter(Boolean);return o.includes(r)||(o.push(r),ca(ra(e,oa),o.slice(-10).join(","))),!a&&o.length>=2}const ua=({open:n,onClose:a,book:r,chapter:o,userId:i,onSaved:l})=>{const d=s(),[c,h]=e.useState(!1),[u,m]=e.useState(!1),[p,x]=e.useState(""),[b,f]=e.useState(""),[g,k]=e.useState(""),[v,y]=e.useState(null);e.useEffect(()=>{n&&(y(null),h(!0),ae(r,o).then(e=>{e?(x(e.markdown),f(e.markdown),k(e.hash)):(y(d("未找到该章节的 MD 真身(DB 中无此章)")),x(""),f(""),k(""))}).catch(e=>{console.error("[BibleWikiMdEditorSheet] fetch error:",e),y(`${d("拉取 MD 失败")}:${(null==e?void 0:e.message)||e}`),x(""),f(""),k("")}).finally(()=>h(!1)))},[n,r,o,d]),e.useEffect(()=>{if(!n)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",document.body.classList.add("editing-md"),()=>{document.body.style.overflow=e,document.body.classList.remove("editing-md")}},[n]);const j=p!==b,Z=async()=>{if(j&&!u){if(!(await C({title:d("放弃未保存的修改?"),message:d("关闭后未保存的内容会丢失。"),confirmText:d("放弃"),cancelText:d("继续编辑"),danger:!0})))return}a()};return n?t.jsx("div",{className:"fixed inset-0 z-[60] flex items-end bg-black/40 backdrop-blur-sm",onClick:e=>{e.target===e.currentTarget&&Z()},children:t.jsxs("div",{className:"w-full bg-[#FAF9F6] rounded-t-2xl shadow-2xl flex flex-col",style:{height:"92vh"},children:[t.jsx("div",{className:"flex justify-center py-2",children:t.jsx("div",{className:"w-10 h-1 rounded-full bg-[#D4CFC0]"})}),t.jsxs("div",{className:"flex items-center justify-between px-4 pb-2",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx(Be,{className:"w-4 h-4 text-[#7A4F11] flex-shrink-0"}),t.jsxs("h2",{className:"text-base font-bold text-[#2D2A22] truncate",children:[d("编辑 MD 真身")," · ",r," ",0===o?d("导论"):o]})]}),t.jsx("button",{onClick:Z,className:"p-1.5 rounded-lg hover:bg-[#F0EDE2] text-[#6B6557] flex-shrink-0","aria-label":d("关闭"),children:t.jsx(Te,{className:"w-5 h-5"})})]}),t.jsx("div",{className:"px-4 pb-2",children:t.jsx("div",{className:"text-[13px] text-[#7A6F50] bg-[#FFF7E0] border border-[#F0E0B0] rounded-lg px-3 py-2 leading-relaxed",children:d("保存后立即写入 DB source_md(线上访问者刷新即可看到新版)。旧版本会自动归档到 history 表,可随时回滚。本地 MD 文件每天 03:00 UTC 自动同步回 git。")})}),t.jsx("div",{className:"flex-1 min-h-0 overflow-hidden px-3 pb-2",children:c?t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx(Ce,{className:"w-6 h-6 animate-spin text-amber-500"})}):t.jsx("textarea",{value:p,onChange:e=>x(e.target.value),spellCheck:!1,className:"w-full h-full resize-none rounded-lg border border-[#E6E2D6] bg-white p-3 font-mono text-[13px] leading-[1.7] text-[#2D2A22] focus:outline-none focus:border-amber-400",placeholder:d("在此粘贴或编辑 Markdown 全文…")})}),v&&t.jsx("div",{className:"px-4 pb-2",children:t.jsxs("div",{className:"flex items-start gap-2 text-[13px] text-red-700 bg-red-50 border border-red-200 rounded-lg px-3 py-2",children:[t.jsx($e,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),t.jsx("span",{className:"leading-relaxed",children:v})]})}),t.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 border-t border-[#E6E2D6] bg-[#FAF9F6]",children:[t.jsxs("div",{className:"text-[13px] text-[#6B6557] flex items-center gap-2 flex-wrap",children:[t.jsxs("span",{children:[p.length.toLocaleString()," ",d("字符")]}),j&&t.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-100 text-amber-800 font-medium",children:d("有未保存修改")})]}),t.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[t.jsx("button",{onClick:Z,disabled:u,className:"px-3 py-1.5 rounded-lg text-sm border border-[#E6E2D6] text-[#6B6557] bg-[#FFFCF5] hover:bg-[#F0EDE2] disabled:opacity-50",children:d("取消")}),t.jsxs("button",{onClick:async()=>{var e;if(!j)return void w(d("内容没有变化"));m(!0),y(null);const t=await re(p,i,{savedVia:"web",expectedDbHash:g});if(m(!1),!t.success)return void(t.conflict?y(d("保存冲突:DB 自你打开后已被别人改过。请关闭后重新打开以拉最新版(你的内容仍在剪贴板可复制保留)。")):y(t.message||d("保存失败")));const n=(null==(e=t.warnings)?void 0:e.length)||0;E(n>
10?d("已保存")+` · ${n} `+d("个警告(见控制台)"):d("已保存")),n>0&&t.warnings,null==l||l(),a()},disabled:u||!j||c,className:"inline-flex items-center gap-1.5 px-4 py-1.5 rounded-lg text-sm font-medium bg-amber-500 text-white hover:bg-amber-600 disabled:opacity-50 disabled:cursor-not-allowed",children:[u?t.jsx(Ce,{className:"w-4 h-4 animate-spin"}):t.jsx(Le,{className:"w-4 h-4"}),d("保存")]})]})]})]})}):null},ma={heading:"标题",paragraph:"段落",blockquote:"引用",list:"列表",table:"表格",code:"代码",html:"HTML",diagram:"结构图"},pa=({open:n,onClose:a,sourceMd:r,expectedDbHash:o,target:i,book:l,chapter:d,userId:c,onSaved:h})=>{const u=s(),[m,p]=e.useState(""),[x,b]=e.useState(""),[f,g]=e.useState(!1),[k,v]=e.useState(null),y=e.useRef(null);e.useLayoutEffect(()=>{const e=y.current;e&&n&&(e.style.height="auto",e.style.height=e.scrollHeight+"px")},[m,n]),e.useEffect(()=>{if(!n||!i)return p(""),b(""),void v(null);const e=r.slice(i.start,i.end);p(e),b(e),v(null)},[n,i,r]),e.useEffect(()=>{if(!n)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",document.body.classList.add("editing-md"),()=>{document.body.style.overflow=e,document.body.classList.remove("editing-md")}},[n]);const j=m!==x,Z=async()=>{if(j&&!f){if(!(await C({title:u("放弃未保存的修改?"),message:u("关闭后这一段的修改会丢失。"),confirmText:u("放弃"),cancelText:u("继续编辑"),danger:!0})))return}a()};return n&&i?t.jsx("div",{className:"fixed inset-0 z-[60] flex items-end bg-black/40 backdrop-blur-sm",onClick:e=>{e.target===e.currentTarget&&Z()},children:t.jsxs("div",{className:"w-full bg-[#FAF9F6] rounded-t-2xl shadow-2xl flex flex-col",style:{maxHeight:"90vh"},children:[t.jsx("div",{className:"flex justify-center py-2",children:t.jsx("div",{className:"w-10 h-1 rounded-full bg-[#D4CFC0]"})}),t.jsxs("div",{className:"flex items-center justify-between px-4 pb-2",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx(Me,{className:"w-4 h-4 text-[#7A4F11] flex-shrink-0"}),t.jsxs("h2",{className:"text-base font-bold text-[#2D2A22] truncate",children:[u("编辑")," · ",ma[i.type]||i.type," ·"," ",t.jsxs("span",{className:"text-[#6B6557] font-normal",children:[l," ",0===d?u("导论"):d]})]})]}),t.jsx("button",{onClick:Z,className:"p-1.5 rounded-lg hover:bg-[#F0EDE2] text-[#6B6557] flex-shrink-0","aria-label":u("关闭"),children:t.jsx(Te,{className:"w-5 h-5"})})]}),t.jsx("div",{className:"px-4 pb-2",children:t.jsxs("div",{className:"text-[13px] text-[#7A6F50] bg-[#FFF7E0] border border-[#F0E0B0] rounded-lg px-3 py-1.5 leading-relaxed",children:[u("只编辑这一段;保存后整篇 source_md 会用新内容替换 ["),i.start,"–",i.end,u("],旧版自动归档到 history。")]})}),t.jsx("div",{className:"px-3 pb-2 overflow-y-auto",children:t.jsx("textarea",{ref:y,value:m,onChange:e=>p(e.target.value),spellCheck:!1,autoFocus:!0,rows:4,className:"w-full resize-none rounded-lg border border-[#E6E2D6] bg-white p-3 font-mono text-[13px] leading-[1.7] text-[#2D2A22] focus:outline-none focus:border-amber-400 overflow-hidden"})}),k&&t.jsx("div",{className:"px-4 pb-2",children:t.jsxs("div",{className:"flex items-start gap-2 text-[13px] text-red-700 bg-red-50 border border-red-200 rounded-lg px-3 py-2",children:[t.jsx($e,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),t.jsx("span",{className:"leading-relaxed",children:k})]})}),t.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3 border-t border-[#E6E2D6] bg-[#FAF9F6]",children:[t.jsxs("div",{className:"text-[13px] text-[#6B6557] flex items-center gap-2 flex-wrap",children:[t.jsxs("span",{children:[m.length," ",u("字符")]}),j&&t.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-100 text-amber-800 font-medium",children:u("有未保存修改")})]}),t.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[t.jsx("button",{onClick:Z,disabled:f,className:"px-3 py-1.5 rounded-lg text-sm border border-[#E6E2D6] text-[#6B6557] bg-[#FFFCF5] hover:bg-[#F0EDE2] disabled:opacity-50",children:u("取消")}),t.jsxs("button",{onClick:async()=>
1{if(!i)return;if(!j)return void w(u("内容没有变化"));let e;try{e=he(r,i.start,i.end,m)}catch(n){return void v((null==n?void 0:n.message)||u("替换失败"))}g(!0),v(null);const t=await re(e,c,{savedVia:"web",expectedDbHash:o});g(!1),t.success?(E(u("已保存")),null==h||h(e),a()):t.conflict?v(u("保存冲突:DB 自你打开后已被改过。请关闭后重新打开以拉最新版(你这一段的内容可先复制到别处保留)。")):v(t.message||u("保存失败"))},disabled:f||!j,className:"inline-flex items-center gap-1.5 px-4 py-1.5 rounded-lg text-sm font-medium bg-amber-500 text-white hover:bg-amber-600 disabled:opacity-50 disabled:cursor-not-allowed",children:[f?t.jsx(Ce,{className:"w-4 h-4 animate-spin"}):t.jsx(Le,{className:"w-4 h-4"}),u("保存")]})]})]})]})}):null},xa=new Set(["baibaoshu.net","www.baibaoshu.net","scripturetrove.com","www.scripturetrove.com"]),ba={amber:"[&_h2]:text-[#7A4F11] [&_h2]:border-[#E6BA59]/60 [&_h3[data-bw-collapsible]]:text-[#7A4F11] [&_th]:bg-[#FBE7B6] [&_th]:text-[#7A4F11] [&_blockquote]:border-[#E6BA59] [&_blockquote]:bg-[#FBE7B6]/45 [&_a]:text-[#7A4F11] dark:[&_h2]:text-[#E0C078] dark:[&_h2]:border-[#7A6234] dark:[&_h3[data-bw-collapsible]]:text-[#E0C078] dark:[&_th]:bg-[#3A3220] dark:[&_th]:text-[#E6C888] dark:[&_blockquote]:border-[#7A6234] dark:[&_blockquote]:bg-[#2E2A1C] dark:[&_a]:text-[#E6C888]",emerald:"[&_h2]:text-[#4F7942] [&_h2]:border-[#9CB58A]/60 [&_h3[data-bw-collapsible]]:text-[#4F7942] [&_th]:bg-[#E8F4D0] [&_th]:text-[#3D5A2D] [&_blockquote]:border-[#9CB58A] [&_blockquote]:bg-[#EEF7D8]/80 [&_a]:text-[#4F7942] dark:[&_h2]:text-[#9DCB78] dark:[&_h2]:border-[#5C7A4A] dark:[&_h3[data-bw-collapsible]]:text-[#9DCB78] dark:[&_th]:bg-[#26311E] dark:[&_th]:text-[#AAD088] dark:[&_blockquote]:border-[#5C7A4A] dark:[&_blockquote]:bg-[#222A1A] dark:[&_a]:text-[#AAD088]",indigo:"[&_h2]:text-[#245B83] [&_h2]:border-[#B7D7EA]/70 [&_h3[data-bw-collapsible]]:text-[#245B83] [&_th]:bg-[#E4F2FB] [&_th]:text-[#245B83] [&_blockquote]:border-[#B7D7EA] [&_blockquote]:bg-[#E4F2FB]/60 [&_a]:text-[#245B83] dark:[&_h2]:text-[#9CC7E8] dark:[&_h2]:border-[#4F6F88] dark:[&_h3[data-bw-collapsible]]:text-[#9CC7E8] dark:[&_th]:bg-[#1E2C35] dark:[&_th]:text-[#B8DAF0] dark:[&_blockquote]:border-[#4F6F88] dark:[&_blockquote]:bg-[#1B2830] dark:[&_a]:text-[#B8DAF0]"},fa=({children:e,className:n=""})=>t.jsxs("div",{className:`xl:grid xl:grid-cols-[minmax(0,50rem)_184px] xl:justify-center xl:gap-6 xl:items-start ${n}`,children:[t.jsx("div",{className:"min-w-0",children:e}),t.jsx("div",{className:"hidden xl:block w-[184px]","aria-hidden":!0})]}),ga=(e,t)=>`bwiki-expanded-${e}-${t}`,wa=(e,t)=>{try{const n=sessionStorage.getItem(ga(e,t));return n?JSON.parse(n):{}}catch{return{}}},ka=(e,t,n)=>{try{const a=wa(e,t);sessionStorage.setItem(ga(e,t),JSON.stringify({...a,...n}))}catch{}},va=(e,t,n)=>e,ya=({book:n,chapter:a,user:r,zenMode:o=!1,onShowAllBooks:l,onCloseAllBooks:d,allBooksOpen:h=!1,mobileNavAboveOverlay:m=!1})=>{const p=s(),{linkify:b,linkifyBare:f,openScriptureRef:g,openScripture:v,closeScripture:y,scriptureOpen:j,sheet:C}=_t(),[R,W]=e.useState(null),[U,J]=e.useState(!0),V=`${n}:${a}`,[K,Y]=e.useState(null),Q=e.useCallback(()=>Y(V),[V]),X=e.useRef(null),[ee,ne]=e.useState(!1),[ae,ce]=e.useState([]),he=x();e.useEffect(()=>{var e;if(!ee)return;null==he||he.setOverlayOpen(!0);const t=new Set,n=[];return null==(e=X.current)||e.querySelectorAll("h2[id]").forEach(e=>{const a=e.getAttribute("id")||"",r=(e.textContent||"").replace(/\s+/g," ").trim();a&&r&&!t.has(a)&&(t.add(a),n.push({id:a,text:r}))}),ce(n),()=>null==he?void 0:he.setOverlayOpen(!1)},[ee]);const[pe,xe]=e.useState([]),[we,ke]=e.useState(null),ve=kn(we,n,a);e.useEffect(()=>{ke(e=>kn(e,n,a))},[n,a]);const ye="bct_wiki_show_original_chip",[je,Ze]=e.useState(()=>{try{return"1"===localStorage.getItem(ye)}catch{return!1}}),Ne=e.useCallback(()=>{Ze(e=>{const t=!e;try{localStorage.setItem(ye,t?"1":"0")}catch{}return t&&ha("originalLang")&&Ie(!0),t})},[]),[Fe,Ie]=e.useState(!1);e.useEffect(()=>{let e=!1;if(n&&!(a<=0))return T(n,a).then(t=>{e||xe(t)}),()=>{e=!0};xe([])},[n,a]);const[Se,Ae]=e.useState(()=>!(!r||!r.isPlatformAdmin&&!r.isSystemAdmin)),[De,_e]=e.useState(!1),[$e,Me]=e.useState(null),[et,tt]=e.useState(null),[nt,at]=e.useState(null),rt=e.useRef(()=>{}),[ot,st]=e.useState(!1),[it,vt]=e.useState(null),[yt,jt]=e.useState(null),[Zt,Nt]=e.useState(null);e.useEffect(()=>{if(!r)return void Ae(!1);if(r.isPlatformAdmin||r.isSystemAdmin)return void Ae(!0);if(!r.isQuestionBankAdmin)return void Ae(!1);let e=!1;return $t(r.id).then(t=>{e||Ae(t.some(e=>
1"bible_wiki"===e.permissionType&&"all"===e.resourceId))}).catch(()=>{e||Ae(!1)}),()=>{e=!0}},[null==r?void 0:r.id,null==r?void 0:r.isPlatformAdmin,null==r?void 0:r.isSystemAdmin,null==r?void 0:r.isQuestionBankAdmin]);const[Ct,Et]=e.useState(!1),[Tt,Ft]=e.useState("overview"),Pt=At({sourceMd:null==R?void 0:R.sourceMd,enabled:!!(Se&&De&&"overview"===Tt&&r),containerRef:X,saveMd:async e=>{if(!r)return{success:!1,message:"未登录"};const t=await re(e,r.id,{savedVia:"web",expectedDbHash:null==R?void 0:R.sourceMdHash});if(t.success&&t.newHash&&W(e=>e?{...e,sourceMdHash:t.newHash}:e),!t.success&&t.conflict){try{const e=await F(n,a,{bypassEdge:!0});e&&W(e)}catch(o){}return{success:!1,message:"保存被取消:这一章已被他人或后台修改,已自动加载最新版本,请重新尝试。"}}return{success:t.success,message:t.message}},onSourceMdChanged:e=>{const t=window.scrollY;W(t=>t?{...t,sourceMd:e}:t);const n=()=>window.scrollTo({top:t,behavior:"auto"});requestAnimationFrame(()=>{n(),requestAnimationFrame(()=>{n(),setTimeout(n,50),setTimeout(n,200)})})}}),[Ot,Ht]=e.useState(()=>wa(n,a).simple??!0),[Wt,Gt]=e.useState(()=>!!wa(n,a).standard),[Ut,Vt]=e.useState(()=>!!wa(n,a).advanced),Kt=e.useCallback(()=>{I(n,a,null==r?void 0:r.id)&&Ma(S())},[n,a,null==r?void 0:r.id]);e.useEffect(()=>{de("page_view","/study-article",{category:"study",dedupKey:"pv:study"})},[]);const Yt=e.useCallback(()=>{Ht(e=>{const t=!e;return ka(n,a,{simple:t}),t&&Kt(),t})},[n,a,Kt]),Qt=e.useCallback(()=>{Gt(e=>{const t=!e;return ka(n,a,{standard:t}),t&&Kt(),t})},[n,a,Kt]),en=e.useCallback(()=>{Vt(e=>{const t=!e;return ka(n,a,{advanced:t}),t&&Kt(),t})},[n,a,Kt]),[tn,cn]=e.useState(null),[hn,un]=e.useState(null),[mn,pn]=e.useState(!1),xn=e.useRef(null),fn=e.useRef(0),[gn,vn]=e.useState(!1),[yn,jn]=e.useState(0),Zn=e.useRef(null),Nn=e.useRef(null),[Cn,En]=e.useState(null),Tn=[.75,1,1.25,1.5,1.75,2],Fn="bct_wiki_narrator_rate",[In,Sn]=e.useState(()=>{try{const e=Number(localStorage.getItem(Fn));return Tn.includes(e)?e:1}catch{return 1}}),[An,Dn]=e.useState(!1),_n=e.useRef(null),[Bn,$n]=e.useState({simple:new Map,standard:new Map}),Ln=e.useCallback(()=>{const e=X.current;e&&e.querySelectorAll(".tts-section-btn").forEach(e=>{const t=e;t.classList.remove("animate-pulse"),t.style.background="transparent",t.style.color=t.classList.contains("tts-has-audio")?"#8B6BB3":"#64748B"})},[]),Mn=e.useCallback((e,t,n)=>{const a=X.current;if(!a)return;Ln();const r=a.querySelector(`.tts-section-btn[data-tts-tier="${e}"][data-tts-section="${t}"]`);r&&("loading"===n?(r.style.color="#8B6BB3",r.classList.add("animate-pulse")):(r.style.color="#fff",r.style.background="#8B6BB3"))},[Ln]),qn=e.useCallback((e,t)=>{if(Zn.current){const n=String(t||0);Zn.current.max!==n&&(Zn.current.max=n),Zn.current.value=String(Math.min(e,t||0))}Nn.current&&(Nn.current.textContent=`${ja(e)} / ${ja(t)}`)},[]),zn=e.useCallback(()=>{fn.current++;const e=xn.current;e&&(e.pause(),e.src=""),xn.current=null,cn(null),un(null),pn(!1),vn(!1),jn(0),En(null),Dn(!1),Ln()},[Ln]);e.useEffect(()=>{zn()},[n,a,zn]),e.useEffect(()=>{hn&&qn(0,0)},[hn,qn]);const Pn=e.useCallback(e=>{const t=xn.current;t&&isFinite(e)&&(t.currentTime=e,qn(e,t.duration||0))},[qn]);e.useCallback(e=>{const t=xn.current;t&&Pn(Math.max(0,Math.min(t.duration||0,t.currentTime+e)))},[Pn]),e.useCallback(e=>{Sn(e);try{localStorage.setItem(Fn,String(e))}catch{}const t=xn.current;t&&(t.playbackRate=e),Dn(!1)},[]),e.useEffect(()=>{if(!An)return;const e=e=>{_n.current&&!_n.current.contains(e.target)&&Dn(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}},[An]);const On=e.useRef([]),Rn=e.useRef(!1),Hn=e.useRef(!1),Wn=e.useRef(0),[Gn,Un]=e.useState(null),[Jn,Vn]=e.useState(null),Kn=e.useCallback(e=>{var t;const n=X.current;if(!n)return;const a=[];let r=e.parentElement;for(;r&&r!==n;)r.classList.contains("bw-collapsible-content")&&"none"===r.style.display&&a.push(r),r=r.parentElement;for(let o=a.length-1;o>=0;o--){const e=a[o];"none"===e.style.display&&(null==(t=e.previousElementSibling)||t.click())}},[]),Yn=e.useCallback((e,t)=>{const n=()=>{const e=X.current,t=(null==Jn?void 0:Jn.tier)?null==e?void 0:e.querySelector(`[data-bible-tier="${Jn.tier}"]`):e;return Array.from((null==t?void 0:t.querySelectorAll("[data-bible-search-mark]"))||[])},a=n();
1if(On.current=a,!a.length)return;Rn.current=!0;const r=!1!==(null==t?void 0:t.scroll),o=(e%a.length+a.length)%a.length;Wn.current=o,a.forEach((e,t)=>e.setAttribute("data-current",t===o?"1":"0"));const s=a[o];Kn(s),Un(e=>e?{...e,current:o}:{total:a.length,current:o}),r&&requestAnimationFrame(()=>requestAnimationFrame(()=>{if(Wn.current!==o)return;const e=n();On.current=e,e.forEach((e,t)=>e.setAttribute("data-current",t===o?"1":"0"));const t=e[o];(null==t?void 0:t.isConnected)&&t.scrollIntoView({behavior:"smooth",block:"center"})}))},[Kn,Jn]),Qn=e.useCallback(()=>{On.current=[],Un(null),Vn(null)},[]);e.useEffect(()=>()=>{On.current=[],Rn.current=!1,Hn.current=!1,Wn.current=0,Un(null),Vn(null)},[n,a]),e.useEffect(()=>{if(U||!R)return;let e=null,t=null,n=null;try{const a=new URLSearchParams(window.location.search);e=a.get("q"),t=a.get("tier"),n=a.get("verse")}catch{return}if(!e||e.length<1)return;"simple"===t?Ht(!0):"standard"===t?Gt(!0):"advanced"===t&&Vt(!0);const a=e,r=n&&parseInt(n,10)||null;Vn(e=>e&&e.query===a&&e.tier===t&&e.verse===r?e:(Rn.current=!1,Hn.current=!1,Wn.current=0,{query:a,tier:t,verse:r}))},[U,R,n,a]),e.useEffect(()=>{if(U||!R)return;let e=null,t=null,n=!1;try{const a=new URLSearchParams(window.location.search);e=a.get("tier"),t=a.get("verse"),n=!!a.get("q")}catch{return}if(n)return;if(!e)return;"simple"===e?Ht(!0):"standard"===e?Gt(!0):"advanced"===e&&Vt(!0);const r=t?parseInt(t,10):0;if(!r||r<1)return;let o=0,s=0,i=null;const l=()=>{const t=X.current;if(!t)return o++,void(o<30&&(i=setTimeout(l,100)));const n=t.querySelector(`[data-bible-tier="${e}"]`);if(!n)return o++,void(o<30&&(i=setTimeout(l,100)));const d=Array.from(n.querySelectorAll("h2, h3")),c=new RegExp(`(?:^|[^\\d])${a}\\s*[::]\\s*(\\d+)(?:\\s*[-–]\\s*(\\d+))?`);let h=null;for(const e of d){const t=(e.textContent||"").match(c);if(!t)continue;const n=parseInt(t[1],10),a=t[2]?parseInt(t[2],10):n;if(r>=n&&r<=a){h=e;break}}if(!h)return o++,o<30?void(i=setTimeout(l,100)):void 0;if(("H2"===h.tagName||"H3"===h.tagName)&&"1"!==h.dataset.bwCollapsible&&(o++,o<30))return void(i=setTimeout(l,100));Kn(h);const u=h.nextElementSibling;!!u&&u.classList.contains("bw-collapsible-content")&&"none"===u.style.display&&h.click();const m=h.nextElementSibling;let p=h;if(null==m?void 0:m.classList.contains("bw-collapsible-content")){const e=m.querySelectorAll('blockquote[data-bw-collapsible="1"]'),t=new RegExp(`^${a}\\s*[::]\\s*(\\d+)(?:\\s*[-–,]\\s*(\\d+))?`);for(const n of Array.from(e)){const e=n.querySelector("strong, b"),a=((null==e?void 0:e.textContent)||"").trim().match(t);if(!a)continue;const o=parseInt(a[1],10),s=a[2]?parseInt(a[2],10):o;if(r>=o&&r<=s){const e=n.nextElementSibling;!!e&&e.classList.contains("bw-collapsible-content")&&"none"===e.style.display&&n.click(),p=n;break}}}if(p.setAttribute("data-bible-verse-mark","1"),!document.getElementById("bw-verse-pulse-style")){const e=document.createElement("style");e.id="bw-verse-pulse-style",e.textContent='@keyframes bwVersePulse{0%{background:#FBE7B6}70%{background:#FFF6E0}100%{background:transparent}}[data-bible-verse-mark="1"]{animation:bwVersePulse 3.2s ease forwards;border-radius:6px;padding:0.15em 0.4em;margin-left:-0.4em}',document.head.appendChild(e)}const x=p,b=()=>x.scrollIntoView({behavior:"auto",block:"start"});requestAnimationFrame(()=>{requestAnimationFrame(()=>{b(),setTimeout(b,150),setTimeout(b,400)})}),++s<8&&(i=setTimeout(l,250))};return i=setTimeout(l,250),()=>{i&&clearTimeout(i)}},[U,R,n,a]);const[Xn,ea]=e.useState(null),[ta,na]=e.useState(!1),[oa,ma]=e.useState(!1),[ba,ga]=e.useState(!1),[ya,Za]=e.useState(!1),[Na,Ca]=e.useState([]),[Ea,Ta]=e.useState(null),[Fa,Ia]=e.useState(null),[Sa,Aa]=e.useState(!1),[Da,_a]=e.useState(new Set),[Ba,$a]=e.useState(()=>(null==r?void 0:r.id)?se(r.id,"wiki"):new Set),[La,Ma]=e.useState(()=>(A(),S())),qa=`${n}:${a}`,Wa=Ba.has(qa);e.useEffect(()=>{if(!(null==r?void 0:r.id))return;let e=!1;return ie(r.id,"wiki").then(t=>{e||$a(t)}),D(r.id).then(t=>{e||Ma(t)}),()=>{e=!0}},[null==r?void 0:r.id]);const Ga=()=>{var e;if(!(null==r?void 0:r.id))return void k(p("登录后才能收藏"));const t=Wa;$a(e=>{const n=new Set(e);return t?n.delete(qa):n.add(qa),n});const o=(null==(e=B.find(e=>e.name===n))?void 0:e.nameZh)||n;le(r.id,{kind:"wiki",refId:qa,title:0===a?`${o} 导论`:`${o} 第${a}章`,nav:{bibleWikiBook:n,bibleWikiChapter:String(a)}}).then(e=>{e.success||($a(e=>{const n=new Set(e);return t?n.add(qa):n.delete(qa),n}),w(e.message||p("收藏没保存成功,请再试一次")))})},Ua=async()=>{var e,t;if(!R)return;const n=i((null==(e=B.find(e=>e.name===R.book))?void 0:e.nameZh)||R.book),a=0===R.chapter?`${n} ${p("导论")}`:p("{0} {1} 章").replace("{0}",n).replace("{1}",String(R.chapter)),r=`${z()}/bibleWikiArticle?book=${encodeURIComponent(R.book)}&chapter=${R.chapter}`,o=`《${a}》· ${p($.study.zh)}`,s=(R.sourceMd||"").replace(/^---[\s\S]*?---\s*/,"").match(/【\s*上下文脉\s*】([\s\S]*?)(?=【[^】]+】|={3,}|$)/),l=((null==s?void 0:s[1])||"").replace(/[#*>`_~\-=\[\]\(\)]/g,"").replace(/\s+/g," ").trim(),d=be(l||(R.title||"").trim(),u())||p($.study.zh),c=`${o}\n\n${d}\n\n${r}`,h="https:"===window.location.protocol||"localhost"===window.location.hostname;if("function"==typeof navigator.share&&h)try{return await navigator.share({title:o,text:d,url:r}),void E(p("分享成功"))}catch(m){if("AbortError"===(null==m?void 0:m.name))return}try{if(null==(t=navigator.clipboard)?void 0:t.writeText)await navigator.clipboard.writeText(c);else{const e=document.createElement("textarea");e.value=c,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}E(p("已复制(标题 + 简介 + 链接),可粘贴分享给弟兄姐妹"))}catch{w(p("复制失败"))}},Ja=e.useRef(Ua);Ja.current=Ua,e.useEffect(()=>{const e=()=>{Ja.current()};return window.addEventListener("bcct:wiki-share",e),()=>window.removeEventListener("bcct:wiki-share",e)},[]),e.useEffect(()=>{let e=!1;return _().then(t=>{if(e)return;const a=new Set;
1t.forEach(e=>{e.book===n&&a.add(e.chapter)}),_a(a)}).catch(()=>{}),()=>{e=!0}},[n]);const Va=e.useMemo(()=>B.find(e=>e.name===n),[n]),{pct:Ka,scrollable:Ya}=function(t,n=!0){const[a,r]=e.useState(0),[o,s]=e.useState(!1);return e.useEffect(()=>{r(0),s(!1)},[t]),e.useEffect(()=>{if(!n)return;const e=()=>{const e=document.documentElement.scrollHeight-window.innerHeight,t=e>240;if(s(t),!t)return;const n=Math.max(0,Math.min(100,window.scrollY/e*100));r(e=>Math.abs(e-n)>=1||0===n||n>=100?n:e)};return e(),window.addEventListener("scroll",e,{passive:!0}),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e),window.removeEventListener("resize",e)}},[t,n]),{pct:a,scrollable:o}}(`${n}:${a}`,!!R),Qa=e.useMemo(()=>B.findIndex(e=>e.name===n),[n]);e.useEffect(()=>{if(!n)return;let e=!1;J(!0),Ft("overview"),ma(!1),ea(null),ga(!1);const t=wa(n,a);return Ht(t.simple??!0),Gt(!!t.standard),Vt(!!t.advanced),F(n,a,{bypassEdge:Se}).then(t=>{e||(W(t),J(!1))}).catch(()=>{e||J(!1)}),Lt(n,a).then(t=>{e||(ea(t),ma(!0))}).catch(()=>{}),()=>{e=!0}},[n,a,Se]),e.useEffect(()=>{var e;if(n&&a>=0){const t=i((null==(e=B.find(e=>e.name===n))?void 0:e.nameZh)||n),r=0===a?`${t} ${p("导论")}`:p("{0} {1} 章").replace("{0}",t).replace("{1}",String(a)),o=((null==R?void 0:R.title)||"").trim(),s=0===a&&o?o:o?`${o} · ${r}`:r,l=document.title;return document.title=`${s} · ${p($.study.zh)}`,()=>{document.title=l}}},[n,a,null==R?void 0:R.title]),e.useEffect(()=>{var e;if(!n||a<0||!R||R.book!==n||R.chapter!==a)return;const t=(null==(e=B.find(e=>e.name===n))?void 0:e.nameZh)||n,r=0===a?`${t} 全书导论`:`${t} ${a} 章`;return window.dispatchEvent(new CustomEvent("ai-chat:page-resource",{detail:{resource:`${$.study.zh} · ${r}`,key:`bibleWikiArticle:${n}-${a}`}})),()=>{window.dispatchEvent(new CustomEvent("ai-chat:page-resource",{detail:null}))}},[n,a,null==R?void 0:R.book,null==R?void 0:R.chapter]),e.useEffect(()=>{"scrollRestoration"in history&&(history.scrollRestoration="manual")},[]),e.useEffect(()=>{const e=`bwiki-scroll-${n}-${a}`;let t;const r=()=>{try{sessionStorage.setItem(e,String(Math.round(window.scrollY)))}catch{}},o=()=>{clearTimeout(t),t=setTimeout(r,200)},s=()=>{clearTimeout(t),r()};return window.addEventListener("scroll",o,{passive:!0}),window.addEventListener("beforeunload",s),window.addEventListener("pagehide",s),()=>{clearTimeout(t),window.removeEventListener("scroll",o),window.removeEventListener("beforeunload",s),window.removeEventListener("pagehide",s)}},[n,a]),e.useLayoutEffect(()=>{if(U||K!==V)return;try{const e=new URLSearchParams(window.location.search);if(e.get("tier")||e.get("verse")||e.get("q"))return}catch{}const e=wa(n,a);if(!e.simple&&!e.standard&&!e.advanced)return void window.scrollTo({top:0,behavior:"auto"});const t=`bwiki-scroll-${n}-${a}`,r=sessionStorage.getItem(t);if(!r)return void window.scrollTo({top:0,behavior:"auto"});const o=parseInt(r,10);if(!o)return void window.scrollTo({top:0,behavior:"auto"});const s=()=>{const e=Math.max(0,document.documentElement.scrollHeight-window.innerHeight);window.scrollTo({top:Math.min(o,e),behavior:"auto"})},i=[];let l=0,d=0,c=0;const h=()=>{c++;document.documentElement.scrollHeight>=o+.5*window.innerHeight&&s(),c<8&&i.push(setTimeout(h,80))};return l=requestAnimationFrame(()=>{s(),d=requestAnimationFrame(h)}),i.push(setTimeout(s,250)),i.push(setTimeout(s,600)),()=>{cancelAnimationFrame(l),cancelAnimationFrame(d),i.forEach(clearTimeout)}},[U,K,V,n,a]),e.useCallback(()=>{oa||ta||(na(!0),Lt(n,a).then(e=>{ea(e),na(!1),ma(!0)}))},[n,a,oa,ta]);const Xa=async(e,t)=>{Ia(e);try{const r=await Mt(n,a,t),o=[...Na];o[e]={...o[e],url:r},o[e].title||(o[e].title=t.name.replace(/\.[^.]+$/,"").replace(/[_-]/g," ")),Ca(o)}catch(r){w((null==r?void 0:r.message)||p("上传失败"))}finally{Ia(null)}},er=e.useMemo(()=>{if(a>0)return{book:n,chapter:a-1};if(Qa>0){const e=B[Qa-1];return{book:e.name,chapter:e.chapters}}return null},[n,a,Qa]),tr=e.useMemo(()=>{if(Va&&a<Va.chapters)return{book:n,chapter:a+1};if(Qa<B.length-1){return{book:B[Qa+1].name,chapter:0}}return null},[n,a,Va,Qa]),nr=(null==Va?void 0:Va.nameZh)||n,ar=e=>e?dt(function(e){if(!e||"undefined"==typeof DOMParser)return e;const t=(new DOMParser).parseFromString(`<body>${e}</body>`,"text/html").body,n=Array.from(t.querySelectorAll("h2"));for(const a of n){const e=(a.textContent||"").trim();if(!an.test(e))continue;let t=a.nextElementSibling;for(;t;){const e=t.tagName.toLowerCase();if("h1"===e||"h2"===e||"hr"===e)break;"blockquote"===e&&t.classList.add("key-verse"),t=t.nextElementSibling}}return t.innerHTML}(nn((e=>{if(!e||"undefined"==typeof DOMParser)return e;const t=(new DOMParser).parseFromString(`<body>${e}</body>`,"text/html");
1return t.body.querySelectorAll(".play-ancient").forEach(e=>e.remove()),t.body.querySelectorAll(".ancient-text").forEach(e=>{const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}),t.body.innerHTML})(O(e))))):"",rr=e=>{if(!e)return"";let t=b(e);return t=bn(t),t=function(e){if(!e)return e;const t=-1!==e.indexOf("旧约背景:");ln.lastIndex=0;const n=ln.test(e);if(ln.lastIndex=0,!t&&!n)return e;let a=e;return t&&(a=a.replace(on,(e,t)=>`<li class="bw-ot-step bw-ot-${rn[t]}"><span class="bw-ot-label">${t}</span>`),a=a.replace(sn,(e,t,n)=>`<ul${dn(t,"bw-ot-steps")}>${n}`)),n&&(a=a.replace(ln,(e,t,n,a,r,o)=>{const s=r?`${r.slice(1)} · `:"";return`<h3${dn(t,"bw-ot-entry")}>${n.trim()}<span class="bw-ot-tag bw-ot-tag-${(e=>/应验$/.test(e)||e.startsWith("综合")?"fulfil":"cite")(a)}">${a}</span><span class="bw-ot-src">${s}${o}</span></h3>`})),a}(t),t=f(t,`《${nr}》`),P(t,e=>be(e,u()))},or=e.useMemo(()=>{if(!(null==R?void 0:R.sourceMd))return null;const e=zt(R.sourceMd),t=ue(R.sourceMd);return{simple:me(e.contentSimpleMd,e.contentSimpleHtml,t.simple),standard:me(e.contentStandardMd,e.contentStandardHtml,t.standard),advanced:me(e.contentAdvancedMd,e.contentAdvancedHtml,t.advanced),simpleMd:e.contentSimpleMd,standardMd:e.contentStandardMd,simpleHtmlRaw:e.contentSimpleHtml,standardHtmlRaw:e.contentStandardHtml}},[null==R?void 0:R.sourceMd]),[sr,ir]=e.useState(!1),lr=e.useMemo(()=>{if(!sr||!or)return null;const e=e=>P(bn(O(e||"")),e=>be(e,u()));return{simple:e(or.simpleHtmlRaw),standard:e(or.standardHtmlRaw)}},[sr,or]),dr=e.useMemo(()=>({simple:oe((null==or?void 0:or.simpleMd)||""),standard:oe((null==or?void 0:or.standardMd)||"")}),[or]),cr=e.useCallback(async(e,t)=>{},[dr,tn,zn,n,a,In,qn,p,Mn,Ln]);e.useCallback(()=>{const e=xn.current;e&&(e.paused?e.play().then(()=>vn(!0)).catch(()=>{}):(e.pause(),vn(!1)))},[]),e.useEffect(()=>{$n({simple:new Map,standard:new Map})},[n,a]);const hr=(null==or?void 0:or.simple)??"",ur=(null==or?void 0:or.standard)??"",mr=(null==or?void 0:or.advanced)??"",pr=e.useMemo(()=>ar(hr),[hr,u()]),xr=e.useMemo(()=>ar(ur),[ur,u()]),br=e.useMemo(()=>ar(mr),[mr,u()]),fr=e.useMemo(()=>te(rr(pr)),[pr,b,f,nr,u()]),gr=e.useMemo(()=>te(rr(xr)),[xr,b,f,nr,u()]),wr=e.useMemo(()=>function(e,t,n,a){if(!e||!n.length||"undefined"==typeof DOMParser)return e;const r=new Map,o=[];for(const u of n)if("verse"===u.anchorType&&null!=u.verseStart){const e=r.get(u.verseStart)||[];e.push(u),r.set(u.verseStart,e)}else o.push(u);const s=(new DOMParser).parseFromString(`<body>${e}</body>`,"text/html"),i=s.body,l=new RegExp(`^\\s*${t}:(\\d+)`),d=e=>{if("BLOCKQUOTE"!==e.tagName)return null;const t=e.querySelector("strong");if(!t)return null;const n=(t.textContent||"").match(l);return n?parseInt(n[1],10):null},c=(e,t,n="verse")=>{const r=s.createElement("div");r.className="bw-related",r.setAttribute("data-bw-related-scope",n),r.setAttribute("contenteditable","false");const o=s.createElement("div");o.className="bw-related-label",o.textContent=t,r.appendChild(o);for(const i of e){const e=s.createElement("button");e.type="button",e.className="bw-related-link",e.setAttribute("data-related-slug",i.slug);const t=s.createElement("span");t.className="bw-related-title",t.textContent=i.title,e.appendChild(t);const n=a(i.category);if(n){const t=s.createElement("span");t.className="bw-related-cat",t.textContent=n,e.appendChild(t)}r.appendChild(e)}return r},h=[];i.querySelectorAll("blockquote").forEach(e=>{const t=d(e);null!=t&&h.push({verse:t,el:e})});for(const[u,m]of r){const e=h.findIndex(e=>e.verse===u);if(-1===e){o.push(...m);continue}const t=h[e].el;let n=t.nextSibling,a=null;for(;n;){if(1===n.nodeType){const e=n;if(null!=d(e)||"H2"===e.tagName||"H3"===e.tagName){a=e;break}}n=n.nextSibling}const r=c(m,"延伸阅读");a&&a.parentNode===t.parentNode?t.parentNode.insertBefore(r,a):t.parentNode.appendChild(r)}return o.length&&i.appendChild(c(o,"本章延伸阅读","chapter")),i.innerHTML}(gr,a,pe,e=>{const t=G.find(t=>t.id===e);return t?p(t.label):""}),[gr,a,pe,p]),kr=e.useMemo(()=>je?function(e,t,n="原文"){if(!e||!Number.isInteger(t)||t<1||"undefined"==typeof DOMParser)return e;const a=(new DOMParser).parseFromString(`<body>${e}</body>`,"text/html"),r=new RegExp(`^\\s*${t}:(\\d+)(?:\\s*[-–—~]\\s*(\\d+)(?!:))?`);let o=0;
1return a.body.querySelectorAll("blockquote").forEach(e=>{const t=e.querySelector("strong");if(!t)return;const s=(t.textContent||"").match(r);if(!s)return;if(e.querySelector("[data-original-verse]"))return;const i=parseInt(s[1],10),l=s[2]?parseInt(s[2],10):i,d=l>i&&l-i+1<=6?Array.from({length:l-i+1},(e,t)=>i+t):[i],c=t.parentElement||e;d.forEach(e=>{const t=a.createElement("button");t.className="bw-original-chip",t.setAttribute("data-original-verse",String(e)),t.setAttribute("contenteditable","false"),t.setAttribute("type","button"),t.textContent=d.length>1?`${n} ${e}`:n,c.appendChild(t),o+=1})}),o?a.body.innerHTML:e}(wr,a,p("原文")):wr,[wr,a,p,je]),vr=e.useMemo(()=>te(rr(br)),[br,b,f,nr,u()]),yr=!!(fr||gr||vr),jr=e.useMemo(()=>{if(!Jn)return[];const e=Jn.query.replace(/ /g," ").split(/\s+/).filter(Boolean);return Array.from(new Set(e.flatMap(e=>[e,ge(e)]))).filter(Boolean)},[Jn]),Zr=e.useMemo(()=>new Set(Bn.simple.keys()),[Bn]),Nr=e.useMemo(()=>new Set(Bn.standard.keys()),[Bn]),{annotations:Cr,create:Er,update:Tr,remove:Fr}=ht({module:"wiki",refKey:R?`${n}:${a}`:null,userId:(null==r?void 0:r.id)??null,enabled:!!R}),Ir="overview"===Tt&&!De&&!!R,{selection:Sr,clear:Ar,liveRange:Dr}=ut({enabled:Ir,containerRef:X}),_r=e.useMemo(()=>{if(!Sr)return null;const e=Dr();if(!e)return null;const t=e.startContainer,n=1===t.nodeType?t:t.parentElement,a=null==n?void 0:n.closest("[data-bible-tier]");if(!a)return null;const r=a.getAttribute("data-bible-tier"),o=mt(a,e);return o&&r?{tier:r,anchor:o}:null},[Sr]),Br=(e,t)=>Cr.find(n=>n.tier===e&&t.mdStart<n.mdEnd&&n.mdStart<t.mdEnd),$r=()=>{var e;const t=i((null==(e=B.find(e=>e.name===n))?void 0:e.nameZh)||n);return a?p("{0} {1} 章").replace("{0}",t).replace("{1}",String(a)):t},Lr=e=>lt(p("我在读《百宝解经》{0},读到「{1}」这句话,能帮我理解一下吗?"),$r(),e);rt.current=(e,t)=>{const n=Cr.find(t=>t.id===e);n&&Me({annotation:n,rect:t})},e.useEffect(()=>{if(!Cr.length)return;let e="";try{e=sessionStorage.getItem("bct:anno-scroll")||""}catch{}if(!e)return;const t=Cr.find(t=>t.id===e);if(!t)return;try{sessionStorage.removeItem("bct:anno-scroll")}catch{}"simple"===t.tier?Ht(!0):"standard"===t.tier?Gt(!0):"advanced"===t.tier&&Vt(!0);let n=0;const a=()=>{const t=document.querySelector(`.anno-hl[data-anno-id="${e}"]`);if(t){Kn(t),window.setTimeout(()=>{const n=document.querySelector(`.anno-hl[data-anno-id="${e}"]`)||t;n.scrollIntoView({behavior:"smooth",block:"center"}),n.classList.add("anno-flash")},200);try{history.replaceState(history.state,"",window.location.pathname+window.location.search)}catch{}}else n++<30&&window.setTimeout(a,160)};window.setTimeout(a,300)},[Cr.length,n,a]);const Mr=e=>!!Jn&&jr.length>0&&(!Jn.tier||Jn.tier===e),qr=e.useMemo(()=>va(Mr("simple")?Rt(fr,jr):fr),[fr,jr,Jn,Zr]),zr=e.useMemo(()=>va(Mr("standard")?Rt(kr,jr):kr),[kr,jr,Jn,Nr]),Pr=e.useMemo(()=>Mr("advanced")?Rt(vr,jr):vr,[vr,jr,Jn]),Or=e.useMemo(()=>pt(qr,Cr.filter(e=>"simple"===e.tier),new Set,xt),[qr,Cr]),Rr=e.useMemo(()=>pt(zr,Cr.filter(e=>"standard"===e.tier),new Set,xt),[zr,Cr]),Hr=e.useMemo(()=>pt(Pr,Cr.filter(e=>"advanced"===e.tier),new Set,xt),[Pr,Cr]);e.useEffect(()=>{tn&&(mn?Mn(tn.tier,tn.idx,"loading"):gn&&Mn(tn.tier,tn.idx,"playing"))},[qr,zr,mn,gn,tn,Mn]),e.useEffect(()=>{if(!Jn||U||!R||!jr.length)return;if(!document.getElementById("bw-search-mark-style")){const e=document.createElement("style");e.id="bw-search-mark-style",e.textContent='[data-bible-search-mark]{background:#FCF26B;color:#1A1A1A;border-radius:3px;padding:0 1px;}[data-bible-search-mark][data-current="1"]{background:#FFE13D;color:#1A1A1A;box-shadow:0 0 0 1.5px #E8C400;}tspan[data-bible-search-mark]{fill:#1A1A1A;stroke:#FCF26B;stroke-width:3px;stroke-linejoin:round;paint-order:stroke fill;}tspan[data-bible-search-mark][data-current="1"]{stroke:#E8C400;stroke-width:4px;}',document.head.appendChild(e)}const e=[],t=()=>{var e;const t=X.current;if(!t)return;const n=(Jn.tier?t.querySelector(`[data-bible-tier="${Jn.tier}"]`):t)||t;if(null!==n.querySelector("h2")&&!n.querySelector('[data-bw-collapsible="1"]'))return;const r=Array.from(n.querySelectorAll("[data-bible-search-mark]"));if(!r.length)return;On.current=r;let o=Math.min(Wn.current,r.length-1);if(!Rn.current&&Jn.verse){const e=r.findIndex(e=>function(e,t,n,a){let r=e.parentElement;for(;r&&r!==a;){if("BLOCKQUOTE"===r.tagName){const e=r.querySelector("strong, b"),a=((null==e?void 0:e.textContent)||"").trim().match(/^(\d+)\s*[::]\s*(\d+)[a-z]?(?:\s*[-–,]\s*(\d+))?/);if(a&&parseInt(a[1],10)===n){const e=parseInt(a[2],10),n=a[3]?parseInt(a[3],10):e;return t>=e&&t<=n}return!1}r=r.parentElement}return!1}(e,Jn.verse,a,n));e>=0&&(o=e)}Wn.current=o,Un(e=>e&&e.total===r.length&&e.current===o?e:{total:r.length,current:o}),"1"!==(null==(e=r[o])?void 0:e.getAttribute("data-current"))&&r.forEach((e,t)=>e.setAttribute("data-current",t===o?"1":"0")),Kn(r[o])};let n=0;const r=()=>{if(t(),!Hn.current&&!Rn.current){const e=On.current[Wn.current];e&&e.isConnected&&null!==e.offsetParent&&(e.scrollIntoView({behavior:"auto",block:"center"}),Hn.current=!0)}++n<16&&e.push(setTimeout(r,200))};return e.push(setTimeout(r,250)),()=>{e.forEach(clearTimeout)}},[Jn,U,R,jr,qr,zr,Pr,Yn]);const[Wr,Gr]=e.useState(!1);e.useEffect(()=>{const e=()=>Gr(!0);return window.addEventListener("bcct:wiki-article-search",e),()=>window.removeEventListener("bcct:wiki-article-search",e)},[]);const Ur=e.useMemo(()=>[fr,kr,vr].map(e=>(e||"").replace(/<[^>]+>/g," ")),[fr,kr,vr]),Jr=e.useMemo(()=>{var e;const t=i((null==(e=B.find(e=>e.name===n))?void 0:e.nameZh)||n);return 0===a?`${t} · ${p("导论")}`:`${t} ${a} ${p("章")}`},[n,a,p]),Vr=e.useCallback(e=>
1{const t=fe(e),n=Array.from(new Set([t,ge(t)])).filter(Boolean).map(e=>e.toLowerCase()),a=e=>{const t=e.replace(/<[^>]+>/g," ").toLowerCase();return n.some(e=>e&&t.includes(e))},r=a(fr)?"simple":a(kr)?"standard":a(vr)?"advanced":"simple";"simple"===r?Ht(!0):"standard"===r?Gt(!0):Vt(!0),Rn.current=!1,Hn.current=!1,Wn.current=0,Vn({query:e,tier:r,verse:null})},[fr,kr,vr]),Kr=e.useCallback(e=>{window.dispatchEvent(new CustomEvent("bcct:wiki-whole-search",{detail:{q:e}}))},[]);e.useEffect(()=>{const e=X.current;if(!e)return;const t=t=>{const r=t.target,o=null==r?void 0:r.closest(".lib-scripture-ref");if(o)return t.preventDefault(),t.stopPropagation(),void g(o);null==r||r.closest(".tts-section-btn");const s=null==r?void 0:r.closest("[data-related-slug]");if(s){t.preventDefault();const e=s.getAttribute("data-related-slug");return void(e&&c("libraryArticle",{librarySlug:e}))}const i=null==r?void 0:r.closest("[data-original-verse]");if(i){t.preventDefault();const e=parseInt(i.getAttribute("data-original-verse")||"",10);return void(Number.isInteger(e)&&e>0&&a>0&&ke({book:n,chapter:a,verse:e}))}const l=null==r?void 0:r.closest("a[href]");if(l&&0===t.button&&!t.metaKey&&!t.ctrlKey&&!t.shiftKey&&!t.altKey&&!l.hasAttribute("download")){const e=l.getAttribute("href")||"",n=(e=>{const t=e.trim();if(!t||t.startsWith("#")||/^(mailto|tel|sms):/i.test(t))return null;try{const e=/^museum(\?|#|$)/.test(t)?`/${t}`:t,n="undefined"!=typeof window?window.location.origin:"https://baibaoshu.net",a=new URL(e,n),r="undefined"!=typeof window?window.location.hostname:a.hostname;if(a.hostname!==r&&!xa.has(a.hostname))return null;if("/museum"!==(a.pathname.replace(/\/+$/,"")||"/"))return null;const o=a.searchParams.get("exhibit")||void 0,s=a.searchParams.get("hall")||void 0;return o||s?{museumExhibit:o,museumHall:s}:null}catch{return null}})(e);if(n)return t.preventDefault(),t.stopPropagation(),void(n.museumExhibit?St(n.museumExhibit).then(e=>{e&&Nt(e)}):c("museum",n));const a=(e=>{const t=e.trim();if(!t||t.startsWith("#")||/^(mailto|tel|sms):/i.test(t))return null;try{const e=/^libraryArticle(\?|#|$)/.test(t)?`/${t}`:t,n="undefined"!=typeof window?window.location.origin:"https://baibaoshu.net",a=new URL(e,n),r="undefined"!=typeof window?window.location.hostname:a.hostname;if(a.hostname!==r&&!xa.has(a.hostname))return null;if("/libraryArticle"!==(a.pathname.replace(/\/+$/,"")||"/"))return null;const o=a.searchParams.get("slug")||"";return o?{librarySlug:o,libraryQuery:a.searchParams.get("q")||void 0}:null}catch{return null}})(e);if(a)return t.preventDefault(),t.stopPropagation(),void c("libraryArticle",a)}const d=null==r?void 0:r.closest("button.play-ancient");if(d){t.preventDefault(),t.stopPropagation();const e=d.getAttribute("data-text")||"",n=d.getAttribute("data-lang")||"he-IL";if(!e)return;const a={"he-IL":"he-IL-Wavenet-D","el-GR":"el-GR-Wavenet-A"};return d.classList.add("play-ancient-active"),void ct(e,void 0,()=>d.classList.remove("play-ancient-active"),()=>d.classList.remove("play-ancient-active"),void 0,{voiceName:a[n],languageCode:n,forceGoogle:!0,speakingRate:.85})}const h=null==r?void 0:r.closest(".anno-hl");if(h){t.preventDefault(),t.stopPropagation();const e=h.getAttribute("data-anno-id");return void(e&&rt.current(e,h.getBoundingClientRect()))}const u=null==r?void 0:r.closest("a");if(!u)return;const m=u.getAttribute("href")||"";if(u.classList.contains("wiki-section-link")){t.preventDefault();const n=m.replace("#","");if(!n)return;const a=e.querySelector(`#${CSS.escape(n)}`);a&&a.scrollIntoView({behavior:"smooth",block:"start"})}};return e.addEventListener("click",t),()=>e.removeEventListener("click",t)},[fr,gr,vr,cr,g]),e.useEffect(()=>{const e=X.current;if(!e||!Se)return;let t=!1;const n=()=>{t||(t=!0,requestAnimationFrame(()=>{t=!1,(()=>{const t=Array.from(e.querySelectorAll('[data-md-editable="1"]'));for(const e of t){if(e.querySelector(":scope > .md-edit-pen"))continue;const t=document.createElement("button");t.type="button",t.className="md-edit-pen",t.setAttribute("aria-label","编辑这一段"),t.title="编辑这一段",t.innerHTML='<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4z"/></svg>',e.appendChild(t)}})()}))};n();const a=setTimeout(n,80),r=setTimeout(n,250),o=new MutationObserver(()=>n());o.observe(e,{childList:!0,subtree:!0});const s=e=>{const t=e.target,n=null==t?void 0:t.closest(".md-edit-pen");if(!n)return;e.preventDefault(),e.stopPropagation();const a=n.parentElement;if(!a)return;const r=Number(a.getAttribute("data-md-start")),o=Number(a.getAttribute("data-md-end")),s=a.getAttribute("data-md-type")||"paragraph";!Number.isFinite(r)||!Number.isFinite(o)||r<0||o<0||vt({start:r,end:o,type:s})};
1return e.addEventListener("click",s,!0),()=>{clearTimeout(a),clearTimeout(r),o.disconnect(),e.removeEventListener("click",s,!0)}},[Se,fr,gr,vr,Ot,Wt,Ut]),e.useEffect(()=>{const e=X.current;if(!e)return;const t=e=>{const t=e.target;if(null==t?void 0:t.closest(".md-edit-pen"))return;const n=null==t?void 0:t.closest(".bw-diagram-wrap");if(!n)return;const a=n.querySelector("svg");if(!a)return;const r=Number((a.getAttribute("viewBox")||"").split(" ")[2])||720;jt({svg:a.outerHTML,w:r})};return e.addEventListener("click",t),()=>e.removeEventListener("click",t)},[fr,gr,vr]),e.useEffect(()=>{if(!yt)return;const e=e=>{"Escape"===e.key&&jt(null)};return document.addEventListener("keydown",e),document.body.classList.add("zoom-open"),()=>{document.removeEventListener("keydown",e),document.body.classList.remove("zoom-open")}},[yt]);const Yr=e=>{c("bibleWikiArticle",{bibleWikiBook:e.book,bibleWikiChapter:String(e.chapter)})},Qr="shrink-0 h-10 sm:h-9 inline-flex items-center justify-center gap-1.5 px-3 rounded-lg text-[13px] sm:text-sm text-[#6B6557] hover:bg-[#F0EDE2] hover:text-[#2D2A22] bg-[#FFFCF5] border border-[#E6E2D6] transition-colors whitespace-nowrap";return t.jsxs("div",{className:"min-h-screen bg-[#FAF9F6] dark:bg-[#1A1714]",children:[Ya&&t.jsx("div",{className:"fixed top-0 left-0 right-0 z-[90] h-[3px] bg-transparent pointer-events-none","aria-hidden":"true",children:t.jsx("div",{className:"h-full bg-gradient-to-r from-[#FFA989] to-[#B85138] transition-[width] duration-150 ease-out",style:{width:`${Ka}%`}})}),t.jsx(Dt,{selection:Pt.selection,saving:Pt.saving,onToggle:Pt.toggle}),Sr&&Ir&&t.jsx(bt,{range:Dr()||Sr.range}),Sr&&Ir&&t.jsx(ft,{rect:Sr.rect,canAnnotate:!!_r,onHighlight:e=>{if(_r){const t=Br(_r.tier,_r.anchor);t?Tr(t.id,{color:e}):Er({anchor:_r.anchor,color:e,tier:_r.tier})}Ar()},onNote:()=>{_r&&Sr&&at({mode:"create",quote:Sr.text,color:"yellow",note:"",tier:_r.tier,anchor:_r.anchor}),Ar()},onCopy:()=>{Sr&&kt(Sr.text,p),Ar()},onReportError:()=>{L(Sr.text),Ar()},onAskBond:()=>{Sr&&M(Lr(Sr.text)),Ar()},onMakeCard:()=>{Sr&&tt({quote:Sr.text,source:$r(),track:{module:"wiki",entry:"toolbar"}}),Ar()}}),nt&&t.jsx(Bt,{open:!!nt,mode:nt.mode,quote:nt.quote,initialColor:nt.color,initialNote:nt.note,onSave:(e,t)=>{if(nt){if("create"===nt.mode&&nt.anchor&&nt.tier){const n=Br(nt.tier,nt.anchor);n?Tr(n.id,{color:e,note:t}):Er({anchor:nt.anchor,color:e,note:t,tier:nt.tier})}else"edit"===nt.mode&&nt.annoId&&Tr(nt.annoId,{color:e,note:t});at(null)}},onClose:()=>at(null),onDelete:"edit"===nt.mode&&nt.annoId?()=>{nt.annoId&&Fr(nt.annoId),at(null)}:void 0}),$e&&t.jsx(gt,{annotation:$e.annotation,rect:$e.rect,onChangeColor:e=>{Tr($e.annotation.id,{color:e}),Me(t=>t?{...t,annotation:{...t.annotation,color:e}}:null)},onEditNote:()=>{const e=$e.annotation;at({mode:"edit",quote:e.quote,color:e.color,note:e.note||"",annoId:e.id}),Me(null)},onDelete:()=>{Fr($e.annotation.id),Me(null)},onAskBond:()=>{M(Lr($e.annotation.quote)),Me(null)},onMakeCard:()=>{const e=$e.annotation;tt({quote:e.quote,note:e.note||void 0,source:$r(),track:{module:"wiki",entry:"popover"}}),Me(null)},onClose:()=>Me(null)}),t.jsx(wt,{data:et,onClose:()=>tt(null)}),ve&&Va&&t.jsx(aa,{bookKey:Va.name.toLowerCase().replace(/\s+/g,""),bookZh:Va.nameZh,bookEn:Va.name,chapter:ve.chapter,verse:ve.verse,lang:"NT"===Va.testament?"grc":"hbo",onClose:()=>ke(null)}),sr&&lr&&t.jsx(Xt,{book:n,chapter:a,bookZh:Va?q(Va):n,articleTitle:(null==R?void 0:R.title)||"",simpleHtml:lr.simple,standardHtml:lr.standard,onClose:()=>ir(!1)}),!U&&R&&t.jsx("button",{onClick:()=>ne(!0),"aria-label":p("本章目录"),title:p("本章目录(跳到各小节)"),className:"wiki-left-fab bct-tuck-left fixed left-4 md:left-6 z-40 w-12 h-12 rounded-full flex items-center justify-center bg-[#FFFCF5] text-[#4F7942] border border-[#E6E2D6] transition-all active:scale-95 hover:scale-105 hover:border-[#8FAE6E] shadow-[0_3px_10px_rgba(28,25,23,0.08),0_6px_20px_rgba(28,25,23,0.06)] "+(Se?"bottom-52 md:bottom-56":"bottom-[calc(4.5rem+env(safe-area-inset-bottom,0px))] md:bottom-24"),children:t.jsx(qe,{className:"w-5 h-5"})}),ee&&t.jsxs("div",{className:"fixed inset-0 z-[60]",role:"dialog","aria-modal":"true",children:[t.jsx("div",{className:"absolute inset-0 bg-[rgba(20,18,12,0.45)]",style:{backdropFilter:"blur(2px)",animation:"bwTocFade 0.28s ease"},onClick:()=>ne(!1)}),t.jsxs("div",{className:"absolute bottom-0 left-0 right-0 mx-auto max-w-[560px] bg-[#FFFCF5] rounded-t-[18px] max-h-[82vh] flex flex-col",style:{animation:"bwTocUp 0.32s cubic-bezier(.16,1,.3,1)"},children:[t.jsx("div",{className:"flex-shrink-0 pt-2 pb-1 flex justify-center",children:t.jsx("div",{className:"w-9 h-1 rounded-full bg-[#DDD8CC]"})}),t.jsxs("div",{className:"flex-shrink-0 px-5 py-2.5 flex items-center justify-between bg-[#F4F2EC] rounded-t-[18px]",children:[t.jsx("span",{className:"text-[18px] font-semibold text-slate-800",style:{fontFamily:'"Noto Serif SC", "Source Han Serif SC", serif'},children:p("本章目录")}),t.jsx("button",{onClick:()=>ne(!1),"aria-label":p("关闭"),className:"w-9 h-9 rounded-full hover:bg-[#
1EDE9DD] flex items-center justify-center transition-colors",children:t.jsx(Te,{className:"w-5 h-5 text-slate-600"})})]}),t.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-2 pb-6",children:0===ae.length?t.jsx("div",{className:"px-2 py-8 text-center text-[15px] text-slate-500",children:p("本章暂无可跳转的小节")}):ae.map(e=>t.jsx("button",{onClick:()=>{const t=document.getElementById(e.id);null==t||t.scrollIntoView({behavior:"smooth",block:"start"}),ne(!1)},className:"w-full text-left px-3 py-2.5 rounded-xl hover:bg-[#F5F1E8] active:bg-[#EFEAE0] transition-colors text-[16px] text-slate-700 leading-snug",children:e.text},e.id))})]})]}),Se&&(null==R?void 0:R.sourceMd)&&t.jsx("button",{onClick:()=>_e(e=>!e),"aria-pressed":De,"aria-label":p(De?"退出加粗模式":"开启加粗模式"),title:p(De?"退出加粗模式(再点一下)":"开启加粗模式(选中文字 → 浮层加粗)"),className:"wiki-left-fab fixed bottom-[calc(4.5rem+env(safe-area-inset-bottom,0px))] left-4 md:bottom-24 md:left-6 z-40 w-12 h-12 rounded-full font-bold text-base flex items-center justify-center transition-all active:scale-95 hover:scale-105 "+(De?"bg-amber-500 text-white shadow-[0_3px_10px_rgba(245,158,11,0.4),0_6px_20px_rgba(28,25,23,0.12)] hover:bg-amber-600":"bg-white text-slate-500 border border-slate-200 shadow-[0_3px_10px_rgba(28,25,23,0.08),0_6px_20px_rgba(28,25,23,0.06)] hover:text-amber-700 hover:border-amber-300"),children:"B"}),Se&&R&&r&&t.jsx("button",{onClick:()=>st(!0),"aria-label":p("编辑 MD 真身"),title:p("编辑 MD 真身(整篇 Markdown)"),className:"wiki-left-fab fixed bottom-[calc(8rem+env(safe-area-inset-bottom,0px))] left-4 md:bottom-40 md:left-6 z-40 w-12 h-12 rounded-full flex items-center justify-center transition-all active:scale-95 hover:scale-105 bg-white text-slate-500 border border-slate-200 shadow-[0_3px_10px_rgba(28,25,23,0.08),0_6px_20px_rgba(28,25,23,0.06)] hover:text-amber-700 hover:border-amber-300",children:t.jsx(ze,{className:"w-5 h-5"})}),Se&&r&&t.jsx(ua,{open:ot,onClose:()=>st(!1),book:n,chapter:a,userId:r.id,onSaved:()=>{F(n,a,{bypassEdge:!0}).then(e=>W(e))}}),Se&&r&&(null==R?void 0:R.sourceMd)&&t.jsx(pa,{open:!!it,onClose:()=>vt(null),sourceMd:R.sourceMd,expectedDbHash:R.sourceMdHash||"",target:it,book:n,chapter:a,userId:r.id,onSaved:e=>{W(t=>t?{...t,sourceMd:e}:t),F(n,a,{bypassEdge:!0}).then(e=>W(e))}}),t.jsx(It,{exhibit:Zt,onClose:()=>Nt(null),onOpenScripture:(e,t,n)=>{Nt(null),c("bibleWikiArticle",{bibleWikiBook:e,bibleWikiChapter:String(t),bibleWikiVerse:n?String(n):void 0})},onOpenPlace:e=>{Nt(null),c("geography",{geoPlace:e})}}),yt&&t.jsxs("div",{className:"fixed inset-0 z-[100] bg-black/80 overflow-auto bw-zoom flex items-center justify-center p-3",onClick:()=>jt(null),role:"dialog","aria-modal":"true",children:[t.jsx("button",{onClick:e=>{e.stopPropagation(),jt(null)},"aria-label":p("关闭"),className:"fixed top-4 right-4 z-[101] w-11 h-11 rounded-full bg-white text-slate-700 flex items-center justify-center shadow-xl active:scale-95 hover:bg-slate-100",children:t.jsx(Te,{className:"w-5 h-5"})}),t.jsx("div",{onClick:e=>e.stopPropagation(),style:{width:`max(${yt.w}px, 92vw)`},dangerouslySetInnerHTML:{__html:yt.svg}})]}),t.jsx("style",{children:"\n        /* 逐节详解每节旁的「原文」徽章:克制、不抢经文 */\n        .bw-original-chip {\n          display: inline-flex; align-items: center;\n          margin-inline-start: 6px; padding: 1px 7px;\n          border: 1px solid #E6E2D6; border-radius: 999px;\n          background: #FFFCF5; color: #4F7942;\n          font-size: 13px; line-height: 1.6; vertical-align: middle;\n          cursor: pointer; user-select: none;\n        }\n        .bw-original-chip:active { background: #E1ECD5; }\n      "}),Se&&t.jsx("style",{children:'\n          [data-md-editable="1"] {\n            position: relative;\n          }\n          [data-md-editable="1"] > .md-edit-pen {\n            position: absolute;\n            top: 4px;\n            right: 4px;\n            width: 22px;\n            height: 22px;\n            display: inline-flex;\n            align-items: center;\n            justify-content: center;\n            border-radius: 6px;\n            border: 1px solid #E6E2D6;\n            background: var(--paper-card, #FFFCF5);\n            color: #7A4F11;\n            cursor: pointer;\n            opacity: 0;\n            transition: opacity 0.12s ease, background 0.12s ease;\n            z-index: 5;\n            padding: 0;\n            line-height: 0;\n          }\n          [data-md-editable="1"]:hover > .md-edit-pen,\n          [data-md-editable="1"] > .md-edit-pen:focus-visible,\n          [data-md-editable="1"] > .md-edit-pen:hover {\n            opacity: 1;\n          }\n          [data-md-editable="1"] > .md-edit-pen:hover {\n            background: #FFF7E0;\n            border-color: #F0E0B0;\n          }\n          /* 标题折叠按钮区与笔图标会争 right-4px,给笔图标多让一些 */\n          h2[data-md-editable="1"] > .md-edit-pen,\n          h3[data-md-editable="1"] > .md-edit-pen {\n            right: 32px;\n          }\n'}),C,!o&&t.jsx("div",{className:"sticky top-0 z-10 backdrop-blur-md border-b border-[#
1E6E2D6] dark:border-[#38332A] px-4 py-3 bg-[rgba(250,249,246,0.92)] dark:bg-[rgba(26,23,20,0.92)]",style:{paddingTop:"calc(0.75rem + env(safe-area-inset-top, 0px))"},children:t.jsxs("div",{className:"max-w-5xl mx-auto flex items-center gap-3",children:[t.jsx("button",{onClick:()=>{if(n)try{sessionStorage.setItem("bibleWikiScrollTo",n)}catch{}c("bibleWiki",Va?{bibleWikiTestament:Va.testament}:void 0)},className:"p-1.5 rounded-lg hover:bg-[#F0EDE2] dark:hover:bg-[#2E2920] transition-colors",children:t.jsx(Pe,{className:"w-5 h-5 text-[#6B6557] dark:text-[#B3AC9C]"})}),t.jsx(Oe,{className:"w-5 h-5 text-[#7A4F11] dark:text-[#D9A44B]"}),t.jsxs("h1",{className:"text-lg font-bold text-[#2D2A22] dark:text-[#ECE6D8] truncate",children:[p((null==Va?void 0:Va.nameZh)||n)," ",0===a?p("导论"):p("第{0}章").replace("{0}",String(a))]})]})}),t.jsx("div",{className:"max-w-7xl mx-auto px-3 sm:px-4 py-5 "+(o?"pb-[calc(6rem+env(safe-area-inset-bottom,0px))] md:pb-20":"pb-[calc(6rem+env(safe-area-inset-bottom,0px))] md:pb-24"),children:U?t.jsxs("div",{className:"max-w-5xl mx-auto space-y-4",role:"status","aria-live":"polite",children:[t.jsxs("div",{className:"rounded-2xl border-2 border-[#E6E2D6] bg-[#FFFCF5] px-4 py-4",children:[t.jsxs("div",{className:"flex items-center gap-2 text-[#6B6557]",children:[t.jsx(Ce,{className:"w-4 h-4 animate-spin text-[#4F7942]"}),t.jsxs("span",{className:"text-[15px] font-medium",children:[p("正在加载")," ",p((null==Va?void 0:Va.nameZh)||n)," ",0===a?p("导论"):p("第{0}章").replace("{0}",String(a))]})]}),t.jsxs("div",{className:"mt-4 space-y-2.5 animate-pulse","aria-hidden":!0,children:[t.jsx("div",{className:"h-4 w-3/4 rounded bg-[#EFEAE0]"}),t.jsx("div",{className:"h-4 w-full rounded bg-[#F1ECE1]"}),t.jsx("div",{className:"h-4 w-10/12 rounded bg-[#F1ECE1]"})]})]}),t.jsx("div",{className:"animate-pulse space-y-3","aria-hidden":!0,children:[["#FBE7B6","#E6BA59"],["#EEF7D8","#9CB58A"],["#E4F2FB","#B7D7EA"]].map(([e,n],a)=>t.jsx("div",{className:"rounded-xl overflow-hidden bg-[#FFFCF5]",children:t.jsx("div",{className:"border-l-4 px-4 py-3",style:{backgroundColor:`${e}55`,borderLeftColor:n},children:t.jsx("div",{className:"h-5 w-32 rounded bg-[#EFEAE0]"})})},a))})]}):R||0!==a?t.jsxs(t.Fragment,{children:[(null==R?void 0:R.title)&&t.jsx("h2",{className:"text-xl font-bold text-slate-800 mb-4",children:be(R.title,u())}),t.jsx(fa,{className:"mb-4",children:t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[t.jsx(Oa,{variant:"top",book:n,chapter:a,currentBook:Va,prev:er,next:tr,isLearned:Wa,zenMode:o,navButtonClass:Qr,goTo:Yr,onOpenChapterPicker:()=>Aa(!0),onOpenScripture:v,onToggleLearned:Ga,onOpenHandout:()=>ir(!0),onShare:Ua}),t.jsxs("div",{className:"flex gap-1 flex-shrink-0 items-center flex-wrap",children:[t.jsxs("button",{type:"button",onClick:()=>c("myAnnotations"),"aria-label":p("我的笔记本"),title:p("我的笔记本"),className:`${Qr} md:hidden`,children:[t.jsx(Oe,{className:"w-4 h-4"}),t.jsx("span",{children:p("我的笔记")})]}),t.jsx(Pa,{className:"md:hidden",isLearned:Wa,onToggle:Ga}),Se&&R&&t.jsx("button",{onClick:async()=>{if(!r||!R||Ct)return;const e="published"===R.status?"draft":"published",t=R.status;W(t=>t?{...t,status:e}:t),Et(!0);const n=await H(r.id,R.id,e);if(Et(!1),!n.success)return W(e=>e?{...e,status:t}:e),void w(n.message||p("切换发布状态失败"));E(p("published"===e?"已发布":"已撤回为草稿"))},disabled:Ct,title:"published"===R.status?p("点击撤回为草稿"):p("点击发布"),"aria-pressed":"published"===R.status,className:"inline-flex items-center gap-1 px-2 py-0.5 text-[13px] font-medium rounded border transition-colors mr-1 disabled:opacity-60 "+("published"===R.status?"bg-emerald-50 text-emerald-700 border-emerald-300 hover:bg-emerald-100":"bg-amber-100 text-amber-800 border-amber-300 hover:bg-amber-200"),children:"published"===R.status?t.jsxs(t.Fragment,{children:[t.jsx(Re,{className:"w-3 h-3"})," ",p("已发布")]}):t.jsxs(t.Fragment,{children:[t.jsx(He,{className:"w-3 h-3"})," ",p("未发布")]})}),!o&&t.jsxs("button",{onClick:()=>Ft("overview"),className:"flex items-center gap-1.5 px-3.5 py-2 text-base font-medium rounded-lg transition-all",style:"overview"===Tt?{background:"#C9912E",color:"white"}:{background:"#FBE7B6",color:"#7A4F11"},onMouseEnter:e=>{"overview"!==Tt&&(e.currentTarget.style.background="#F8DC95")},onMouseLeave:e=>{"overview"!==Tt&&(e.currentTarget.style.background="#FBE7B6")},children:[t.jsx(Oe,{className:"w-4 h-4"})," ",p("导览")]}),!1,t.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[t.jsx(We,{className:"w-4 h-4",style:{color:"var(--readable-sage, #4F7942)"}}),t.jsx("span",{className:"text-base font-medium",style:{color:"var(--readable-sage, #4F7942)"},children:p("原文")}),t.jsx("button",{type:"button",onClick:Ne,role:"switch","aria-checked":je,"aria-label":p("原文查词开关"),title:p(je?"关闭原文查词":"开启原文查词"),className:"relative inline-flex h-6 w-10 items-center rounded-full transition-colors duration-300 flex-shrink-0 "+(je?"bg-[#4F7942]":"bg-[#DED6C8]"),children:t.jsx("span",{className:"inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition-transform duration-300 "+(je?"translate-x-5":"translate-x-1")})})]})]}),Fe&&t.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 rounded-xl px-3 py-2 text-[13px]",style:{background:"#F3F6EC",color:"#3D
15A2D"},children:[t.jsx(We,{className:"w-4 h-4 flex-shrink-0"}),t.jsx("span",{className:"flex-1 min-w-[10rem]",children:p("常看原文的话,可以把「圣经原文」放到首页,随时进得去。")}),t.jsx("button",{type:"button",className:"rounded-lg px-3 py-1 font-medium",style:{background:"#4F7942",color:"#FFFDF7"},onClick:()=>{!function(e){const t=Z();t.includes(e)||N([...t,e]),ca(ra(e,la),"1")}("originalLang"),Ie(!1)},children:p("放到首页")}),t.jsx("button",{type:"button",className:"rounded-lg px-3 py-1",style:{color:"#6B7A5A"},onClick:()=>{!function(e,t=Date.now()){const n=(Number(da(ra(e,sa)))||0)+1;ca(ra(e,sa),String(n)),n>=2?ca(ra(e,la),"1"):ca(ra(e,ia),String(t+2592e6))}("originalLang"),Ie(!1)},children:p("不用")})]})]})}),"overview"===Tt&&t.jsxs("div",{className:"xl:grid xl:grid-cols-[minmax(0,50rem)_184px] xl:justify-center xl:gap-6 xl:items-start",children:[t.jsx("article",{ref:X,className:"space-y-4 mb-8 min-w-0",children:yr?t.jsxs(t.Fragment,{children:[fr&&t.jsx(Ha,{id:"bwiki-tier-simple",title:p(0===a?"全书导读":"本章导读"),subtitle:p(0===a?"这卷书 · 作者与写作背景 · 牧者的心 · 反思":"上下文脉 · 段落结构 · 钥节 · 牧者的心 · 反思"),icon:t.jsx(Oe,{className:"w-5 h-5"}),expanded:Ot,onToggle:Yt,bgClass:"bg-[#FFFCF5] dark:bg-[#242019]",borderClass:"border-l-4 border-l-[#E6BA59] dark:border-l-[#8A6E32] bg-[#FBE7B6]/30 dark:bg-[#E6BA59]/10",headerClass:"text-[#7A4F11] dark:text-[#E0C078]",accent:"amber",html:Or,tier:"simple",book:n,chapter:a}),gr&&t.jsx(Ha,{id:"bwiki-tier-standard",title:p(0===a?"全书详解":"逐节详解"),subtitle:p(0===a?"全书结构 · 主线脉络 · 核心主题":"段落精解 · 逐节释义"),icon:t.jsx(Be,{className:"w-5 h-5"}),expanded:Wt,onToggle:Qt,bgClass:"bg-[#FFFCF5] dark:bg-[#242019]",borderClass:"border-l-4 border-l-[#9CB58A] dark:border-l-[#5C7A4A] bg-[#EEF7D8]/50 dark:bg-[#9CB58A]/12",headerClass:"text-[#3D5A2D] dark:text-[#9DCB78]",accent:"emerald",html:Rr,tier:"standard",book:n,chapter:a}),vr&&t.jsx(Ha,{id:"bwiki-tier-advanced",title:p("神学进深"),subtitle:p(0===a?"关键词 · 文体与修辞 · 神学史 · 新约回响 · 古近东":"词汇 · 神学要点 · 人物分析 · 新约回响 · 主题追踪"),icon:t.jsx(Ge,{className:"w-5 h-5"}),expanded:Ut,onToggle:en,bgClass:"bg-[#FFFCF5] dark:bg-[#242019]",borderClass:"border-l-4 border-l-[#B7D7EA] dark:border-l-[#4F6F88] bg-[#E4F2FB]/60 dark:bg-[#B7D7EA]/12",headerClass:"text-[#245B83] dark:text-[#9CC7E8]",accent:"indigo",html:Hr,tier:"advanced",book:n,chapter:a})]}):t.jsxs("div",{className:"text-center py-12",children:[t.jsx(Be,{className:"w-10 h-10 text-slate-500 mx-auto mb-3"}),t.jsx("p",{className:"text-sm text-slate-500",children:p("暂无释经内容")})]})},(null==R?void 0:R.sourceMd)??""),t.jsx(za,{hasAnyContent:yr,articleRef:X,chapter:a,simpleExpanded:Ot,standardExpanded:Wt,advancedExpanded:Ut,hasSimple:!!fr,hasStandard:!!gr,hasAdvanced:!!vr,goToTier:e=>{"simple"!==e||Ot||Yt(),"standard"!==e||Wt||Qt(),"advanced"!==e||Ut||en(),window.setTimeout(()=>{var t;null==(t=document.getElementById(`bwiki-tier-${e}`))||t.scrollIntoView({behavior:"smooth",block:"start"})},30)}})]}),"illustrations"===Tt&&t.jsxs("div",{className:"space-y-4 mb-8",children:[Se&&!ba&&oa&&t.jsx("div",{className:"flex justify-end",children:t.jsxs("button",{onClick:()=>{Ca((null==Xn?void 0:Xn.images)?JSON.parse(JSON.stringify(Xn.images)):[]),ga(!0)},className:"flex items-center gap-1 px-3 py-1.5 text-sm text-teal-700 hover:bg-teal-50 rounded-lg border border-teal-200 transition-colors",children:[t.jsx(ze,{className:"w-3.5 h-3.5"})," ",p("编辑图解")]})}),ba&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"bg-teal-50 border border-teal-200 rounded-lg p-4",children:[t.jsxs("p",{className:"text-sm text-teal-800 mb-3",children:[t.jsx("strong",{children:p("编辑模式:")}),p("上传图片或填写URL,设置标题和说明。")]}),t.jsx("div",{className:"space-y-3",children:Na.map((e,n)=>t.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-3 flex gap-3 items-start",children:[t.jsx("div",{className:"text-slate-500 pt-2",children:t.jsx(Ue,{className:"w-4 h-4"})}),t.jsxs("div",{className:"flex-1 space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx("input",{type:"text",value:e.url,onChange:e=>{const t=[...Na];t[n]={...t[n],url:e.target.value},Ca(t)},placeholder:p("图片 URL(或点右侧上传)"),className:"flex-1 px-3 py-2 border border-slate-300 rounded-lg text-sm"}),t.jsxs("label",{className:"flex items-center gap-1 px-3 py-2 rounded-lg text-sm font-medium cursor-pointer transition-colors "+(Fa===n?"bg-slate-100 text-slate-500 cursor-wait":"bg-teal-50 text-teal-700 hover:bg-teal-100 border border-teal-200"),children:[Fa===n?t.jsx(Ce,{className:"w-4 h-4 animate-spin"}):t.jsx(Je,{className:"w-4 h-4"}),t.jsx("span",{className:"hidden sm:inline",children:p(Fa===n?"上传中":"上传")}),t.jsx("input",{type:"file",accept:"image/*",className:"hidden",disabled:null!==Fa,onChange:e=>{var t;const a=null==(t=e.target.files)?void 0:t[0];
1a&&Xa(n,a),e.target.value=""}})]})]}),t.jsx("input",{type:"text",value:e.title,onChange:e=>{const t=[...Na];t[n]={...t[n],title:e.target.value},Ca(t)},placeholder:p("标题(如:以色列出埃及路线图)"),className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm"}),t.jsx("input",{type:"text",value:e.description||"",onChange:e=>{const t=[...Na];t[n]={...t[n],description:e.target.value},Ca(t)},placeholder:p("说明(可选)"),className:"w-full px-3 py-2 border border-slate-300 rounded-lg text-sm"}),e.url&&t.jsx("img",{src:e.url,alt:e.title,className:"max-h-32 rounded-lg border border-slate-200 object-contain"})]}),t.jsx("button",{onClick:()=>Ca(Na.filter((e,t)=>t!==n)),className:"p-1.5 text-red-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors",children:t.jsx(Ve,{className:"w-4 h-4"})})]},n))}),t.jsxs("div",{className:"mt-3 flex gap-2",children:[t.jsxs("button",{onClick:()=>Ca([...Na,{url:"",title:"",description:""}]),className:"flex-1 flex items-center gap-1 px-3 py-2 text-sm text-teal-700 hover:bg-teal-100 rounded-lg border border-dashed border-teal-300 transition-colors justify-center",children:[t.jsx(Ke,{className:"w-4 h-4"})," ",p("添加(填URL)")]}),t.jsxs("label",{className:"flex-1 flex items-center gap-1 px-3 py-2 text-sm text-teal-700 hover:bg-teal-100 rounded-lg border border-dashed border-teal-300 transition-colors justify-center cursor-pointer",children:[t.jsx(Je,{className:"w-4 h-4"})," ",p("上传图片"),t.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",disabled:null!==Fa,onChange:async e=>{const t=e.target.files;if(t&&0!==t.length){for(const e of Array.from(t)){const t=Na.length;Ca(t=>[...t,{url:"",title:e.name.replace(/\.[^.]+$/,"").replace(/[_-]/g," "),description:""}]),await Xa(t,e)}e.target.value=""}}})]})]})]}),t.jsxs("div",{className:"flex justify-end gap-3",children:[t.jsxs("button",{onClick:()=>ga(!1),className:"px-4 py-2 text-sm text-slate-600 hover:bg-slate-100 rounded-lg border border-slate-300",children:[t.jsx(Te,{className:"w-4 h-4 inline mr-1"}),p("取消")]}),t.jsxs("button",{onClick:async()=>{if(!r)return;Za(!0);const e=await qt(r.id,n,a,Na.filter(e=>e.url.trim()));if(Za(!1),e.success){E(p("保存成功")),ga(!1);const e=await Lt(n,a);ea(e)}else w(e.message||p("保存失败"))},disabled:ya,className:"flex items-center gap-2 px-5 py-2 bg-teal-600 hover:bg-teal-700 text-white rounded-lg text-sm font-medium disabled:opacity-50",children:[ya?t.jsx(Ce,{className:"w-4 h-4 animate-spin"}):t.jsx(Le,{className:"w-4 h-4"}),p("保存")]})]})]}),!ba&&(ta?t.jsx("div",{className:"flex items-center justify-center py-20",children:t.jsx(Ce,{className:"w-6 h-6 animate-spin text-teal-500"})}):Xn&&Xn.images.length>0?t.jsx("div",{className:"space-y-6",children:Xn.images.map((e,n)=>t.jsxs("div",{className:"bg-white rounded-xl border border-slate-200 overflow-hidden shadow-sm",children:[t.jsx("div",{className:"cursor-zoom-in",onClick:()=>Ta(e.url),children:t.jsx("img",{src:e.url,alt:e.title,className:"w-full object-contain max-h-[70vh]",loading:"lazy"})}),t.jsxs("div",{className:"px-4 py-3 text-center",children:[t.jsx("h3",{className:"font-semibold text-slate-800 text-[15px]",children:e.title}),e.description&&t.jsx("p",{className:"text-sm text-slate-600 mt-1 leading-relaxed",children:e.description})]})]},n))}):t.jsxs("div",{className:"text-center py-12",children:[t.jsx(Ee,{className:"w-10 h-10 text-slate-500 mx-auto mb-3"}),t.jsx("p",{className:"text-sm text-slate-500",children:p("暂无图解内容")})]})),Ea&&t.jsxs("div",{className:"fixed inset-0 z-50 bg-black/80 flex items-center justify-center p-4",onClick:()=>Ta(null),children:[t.jsx("button",{className:"absolute top-4 right-4 text-white/80 hover:text-white p-2",onClick:()=>Ta(null),children:t.jsx(Te,{className:"w-6 h-6"})}),t.jsx("img",{src:Ea,alt:"",className:"max-w-full max-h-full object-contain rounded-lg",onClick:e=>e.stopPropagation()})]})]}),t.jsx(fa,{children:t.jsx(Jt,{book:n,chapter:a,bookZh:(null==Va?void 0:Va.nameZh)||n,onReady:Q},`chapter-next-step-${n}-${a}`)}),t.jsx(fa,{children:t.jsx("div",{className:"flex justify-between pt-4 border-t border-slate-200",children:t.jsx(Oa,{book:n,chapter:a,currentBook:Va,prev:er,next:tr,isLearned:Wa,zenMode:o,navButtonClass:Qr,goTo:Yr,onOpenChapterPicker:()=>Aa(!0),onOpenScripture:v,onToggleLearned:Ga,onOpenHandout:()=>ir(!0),onShare:Ua})})})]}):t.jsxs("div",{className:"text-center py-20",children:[t.jsx(Be,{className:"w-12 h-12 text-slate-500 mx-auto mb-4"}),t.jsxs("h3",{className:"text-lg font-semibold text-slate-500 mb-2",children:[p((null==Va?void 0:Va.nameZh)||n)," ",0===a?p("导论"):p("第{0}章").replace("{0}",String(a))]}),t.jsx("p",{className:"text-sm text-slate-500 mb-6",children:p("暂无释经内容")}),t.jsx("div",{className:"flex justify-center",children:t.jsx(Oa,{book:n,chapter:a,currentBook:Va,prev:er,next:tr,isLearned:Wa,zenMode:o,navButtonClass:Qr,goTo:Yr,onOpenChapterPicker:()=>Aa(!0),onOpenScripture:v,onToggleLearned:Ga,onOpenHandout:()=>ir(!0),onShare:Ua})})]})}),!U&&R&&Va&&!ee&&!Sa&&t.jsx(Ra,{book:n,chapter:a,currentBook:Va,mobileNavAboveOverlay:m,allBooksOpen:h,scriptureOpen:j,handoutOpen:sr,canOpenHandout:!!or,onCloseAllBooks:d,onOpenAllBooks:()=>{l?l():Aa(!0)},onCloseScripture:y,onSetHandoutOpen:ir,onSetChapterPickerOpen:Aa,onOpenScripture:v}),Sa&&Va&&t.jsxs(t.Fragment,{children:[t.jsx("style",{children:"\n            @keyframes chpicker-slide-up {\n              from { transform: translateX(-50%) translateY(100%); }\n              to   { transform: translateX(-50%) translateY(0); }\n            }\n            @keyframes chpicker-fade-in { from { opacity: 0; } to { opacity: 1; } }\n          "}),t.jsx("div",{className:"fixed inset-0 z-[60]",style:{background:"rgba(20, 18, 12, 0.45)",backdropFilter:"blur(2px)",animation:"chpicker-fade-in 0.25s ease-out"},onClick:()=>Aa(!1),"aria-hidden":"true"}),t.jsxs("aside",{className:"fixed bottom-0 left-1/2 w-full max-w-[440px] z-[70] bg-[#FAF9F6] rounded-t-3xl max-h-[82vh] flex flex-col shadow-2xl",style:{transform:"translateX(-50%)",animation:"chpicker-slide-up 0.32s cubic-bezier(0.16, 1, 0.3, 1)"},onClick:e=>e.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":p("选择章节"),children:[t.jsxs("header",{className:"px-5 pt-2.5 pb-3 border-b border-stone-200/60 flex-shrink-0",children:[t.jsx("button",{type:"button",onClick:()=>Aa(!1),"aria-label":p("关闭"),className:"block w-9 h-1 bg-stone-300 rounded-full mx-auto mb-3 hover:bg-stone-400 transition-colors"}),t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("h3",{className:"text-[16px] font-medium text-slate-800 tracking-[0.04em] m-0 truncate",style:{fontFamily:'"Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif'},children:[q(Va)," · ",p("选择章节")]}),t.jsx("button",{type:"button",onClick:()=>{Aa(!1),l?l():c("bibleWiki")},className:"flex-shrink-0 inline-flex items-center px-3 py-1.5 rounded-full text-[13px] font-medium border border-stone-200 bg-white text-slate-600 hover:bg-stone-50 hover:text-slate-800 transition-colors",style:{fontFamily:'"Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif'},children:p("全部书卷")})]})]}),t.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:t.jsxs("div",{className:"grid grid-cols-6 sm:grid-cols-8 gap-1.5",children:[(()=>{const e=Da.has(0),r=Ba.has(`${n}:0`),o=La.has(`${n}:0`);return t.jsxs("button",{onClick:e?()=>{Aa(!1),Yr({book:n,chapter:0})}:void 0,disabled:!e,className:`relative col-span-2 h-9 rounded-lg text-[13px] font-medium border transition-colors ${e?"bg-[#CFE0BB] text-[#3D5A2D] border-[#8FAE6E] hover:bg-[#BED4A4]":"bg-[#F5F1E8] text-[#64748B] border-[#
1E6E2D6] cursor-default"} ${0===a?"ring-2 ring-[#3D5A2D]":""}`,children:[p("导论"),r?t.jsx("span",{className:"absolute -bottom-1 -right-1 w-3.5 h-3.5 rounded-full bg-[#3D5A2D] ring-2 ring-[#FAF9F6] dark:ring-[#1A1714] flex items-center justify-center",children:t.jsx(Ye,{className:"w-2.5 h-2.5 text-white",strokeWidth:3.5})}):o&&t.jsx("span",{className:"absolute -bottom-1 -right-1 w-2 h-2 rounded-full bg-[#7A9C5E] dark:bg-[#9CB58A] ring-2 ring-[#FAF9F6] dark:ring-[#1A1714]",title:p("读过")})]})})(),Array.from({length:Va.chapters},(e,t)=>t+1).map(e=>{const r=Da.has(e),o=Ba.has(`${n}:${e}`),s=La.has(`${n}:${e}`);return t.jsxs("button",{onClick:r?()=>{Aa(!1),Yr({book:n,chapter:e})}:void 0,disabled:!r,className:`relative h-9 rounded-lg text-[13px] font-medium border transition-colors ${r?"bg-[#CFE0BB] text-[#3D5A2D] border-[#8FAE6E] hover:bg-[#BED4A4]":"bg-[#F5F1E8] text-[#64748B] border-[#E6E2D6] cursor-default"} ${a===e?"ring-2 ring-[#3D5A2D]":""}`,children:[e,o?t.jsx("span",{className:"absolute -bottom-1 -right-1 w-3.5 h-3.5 rounded-full bg-[#3D5A2D] ring-2 ring-[#FAF9F6] dark:ring-[#1A1714] flex items-center justify-center",children:t.jsx(Ye,{className:"w-2.5 h-2.5 text-white",strokeWidth:3.5})}):s&&t.jsx("span",{className:"absolute -bottom-1 -right-1 w-2 h-2 rounded-full bg-[#7A9C5E] dark:bg-[#9CB58A] ring-2 ring-[#FAF9F6] dark:ring-[#1A1714]",title:p("读过")})]},e)})]})})]})]}),t.jsx(wn,{open:Wr,onClose:()=>Gr(!1),chapterLabel:Jr,tierPlainTexts:Ur,onHighlightInChapter:Vr,onWholeBibleSearch:Kr}),Gn&&Gn.total>0&&t.jsxs("div",{className:"fixed left-1/2 -translate-x-1/2 z-[80] flex items-center gap-0.5 pl-3 pr-1.5 py-1.5 rounded-full bg-white/95 backdrop-blur border border-stone-200 shadow-lg",style:{bottom:"calc(env(safe-area-inset-bottom, 0px) + 16px)"},children:[t.jsxs("span",{className:"text-[13px] text-slate-600 tabular-nums mr-1",children:[Gn.current+1,"/",Gn.total]}),t.jsx("button",{type:"button",onClick:()=>Yn(Gn.current-1),"aria-label":p("上一处"),className:"w-8 h-8 rounded-full flex items-center justify-center text-slate-600 hover:bg-slate-100 transition-colors",children:t.jsx(Qe,{className:"w-4 h-4"})}),t.jsx("button",{type:"button",onClick:()=>Yn(Gn.current+1),"aria-label":p("下一处"),className:"w-8 h-8 rounded-full flex items-center justify-center text-slate-600 hover:bg-slate-100 transition-colors",children:t.jsx(Xe,{className:"w-4 h-4"})}),t.jsx("span",{className:"w-px h-5 bg-stone-200 mx-0.5"}),t.jsx("button",{type:"button",onClick:Qn,"aria-label":p("关闭"),className:"w-8 h-8 rounded-full flex items-center justify-center text-slate-500 hover:bg-slate-100 transition-colors",children:t.jsx(Te,{className:"w-4 h-4"})})]}),false]})};function ja(e){if(!isFinite(e)||e<0)return"0:00";const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,"0")}`}function Za(e,t){if("1"===e.dataset.bwCollapsible)return;const n=[];let a=e.nextElementSibling;for(;a&&!t(a);)n.push(a),a=a.nextElementSibling;if(e.dataset.bwCollapsible="1",0===n.length)return;const r=document.createElement("div");r.className=`bw-collapsible-content bw-collapsible-content-${e.tagName.toLowerCase()}`,r.style.display="none",n.forEach(e=>r.appendChild(e)),e.insertAdjacentElement("afterend",r),e.style.cursor="pointer",e.style.userSelect="none",e.style.position="relative",e.style.paddingRight="44px","H2"===e.tagName?(e.style.marginTop="24px",e.style.marginBottom="8px"):"H3"===e.tagName&&(e.style.marginTop="14px",e.style.marginBottom="6px");const o=document.createElement("button");o.type="button",o.className="bw-collapse-indicator",o.dataset.state="collapsed",o.setAttribute("aria-label",W("展开或收起本段")),o.title=W("展开或收起本段"),o.innerHTML=Ta;const s="H2"===e.tagName||"H3"===e.tagName?"top:50%;transform:translateY(-50%);":"top:14px;";o.style.cssText=`position:absolute;${s}right:12px;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;color:currentColor;opacity:0.7;flex-shrink:0;border:0;background:transparent;padding:0;cursor:pointer;touch-action:manipulation;`,e.appendChild(o)}
1const Na=/^\d+\s*:\s*\d+[a-z]?(?:\s*[–\-,]\s*\d+[a-z]?)*(?=$|\s|["'“”「『])/i,Ca=/^\d+\s*:\s*\d+[a-z]?(?:\s*[–\-,]\s*\d+[a-z]?)*\s*$/i;function Ea(e){const t=e.firstElementChild,n=t&&"P"===t.tagName?t:e,a=(n.textContent||"").replace(/\s+/g," ").trim();if(Na.test(a))return!0;const r=n.querySelector("strong, b");if(r){const e=n.firstChild;if(e&&e.nodeType===Node.TEXT_NODE){if((e.textContent||"").trim().length>0)return!1}const t=(r.textContent||"").trim();if(Ca.test(t))return!0}return Na.test(a)}const Ta='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>',Fa='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="18 15 12 9 6 15"></polyline></svg>',Ia=(e,t)=>`bwiki-collapsible-${e}-${t}`,Sa=(e,t)=>{try{const n=sessionStorage.getItem(Ia(e,t));return n?JSON.parse(n):{}}catch{return{}}},Aa=(e,t,n,a)=>{const r=Sa(t,n);if("simple"===a&&void 0===r[a]){const t=e.querySelector("h2");return new Set(t?[_a(t)]:[])}return new Set(r[a]||[])},Da=(e,t,n,a)=>{try{const r=Sa(e,t);r[n]=a,sessionStorage.setItem(Ia(e,t),JSON.stringify(r))}catch{}},_a=e=>fe((e.textContent||"").trim()).slice(0,80),Ba=e=>{const t=e.nextElementSibling;(null==t?void 0:t.classList.contains("bw-collapsible-content"))&&(t.style.display="");const n=e.querySelector(".bw-collapse-indicator");n&&(n.innerHTML=Fa,n.dataset.state="expanded"),"BLOCKQUOTE"===e.tagName&&(e.style.borderLeftColor="transparent")},$a=e=>{const t=e.nextElementSibling;(null==t?void 0:t.classList.contains("bw-collapsible-content"))&&(t.style.display="none");const n=e.querySelector(".bw-collapse-indicator");n&&(n.innerHTML=Ta,n.dataset.state="collapsed"),"BLOCKQUOTE"===e.tagName&&(e.style.borderLeftColor="")},La=(e,t)=>{Array.from(e.querySelectorAll("blockquote")).forEach(e=>{Ea(e)&&(Za(e,e=>"chapter"===e.dataset.bwRelatedScope||("H2"===e.tagName||"H3"===e.tagName||"BLOCKQUOTE"===e.tagName&&Ea(e))),(null==t?void 0:t.has(_a(e)))&&Ba(e))})},Ma=(e,t)=>{Array.from(e.querySelectorAll("h2")).forEach(e=>{Za(e,e=>"H2"===e.tagName),(null==t?void 0:t.has(_a(e)))&&Ba(e)});Array.from(e.querySelectorAll("h3")).forEach(e=>{Za(e,e=>"H2"===e.tagName||"H3"===e.tagName),(null==t?void 0:t.has(_a(e)))&&Ba(e)})};function qa(e,t,n,a,r){const o=!(!n||"number"!=typeof a||!t);let s=null,i=!1,l=null,d=!1,c=0,h=!1;const u=e=>{const t=e.touches[0];if(!t)return;const n=e.target;s={x:t.clientX,y:t.clientY},i=!1,c=0,h=!!(null==n?void 0:n.closest('[data-bw-collapsible="1"]'))},m=e=>{if(!s)return;const t=e.touches[0];t&&Math.hypot(t.clientX-s.x,t.clientY-s.y)>8&&(i=!0,h=!1)},p=e=>{const t=e.target;l={x:e.clientX,y:e.clientY},d=!1,c=0,h=!!(null==t?void 0:t.closest('[data-bw-collapsible="1"]'))},x=e=>{l&&Math.hypot(e.clientX-l.x,e.clientY-l.y)>8&&(d=!0,h=!1)},b=()=>{c=Date.now()+800,h=!1},f=u=>{if(Date.now()<c||i||d)return s=null,i=!1,l=null,d=!1,c=0,void(h=!1);const m=u.target;if(!m)return;const p=m.closest(".bw-collapse-indicator");if(m.closest("a, button, input, textarea, .lib-scripture-ref, .anno-hl")&&!p)return;const x=m.closest('[data-bw-collapsible="1"]');if(!x||!e.contains(x))return;const b=x.nextElementSibling;if(!b||!b.classList.contains("bw-collapsible-content"))return;const f="none"!==b.style.display;if(f&&!h)return;b.style.display=f?"none":"";const g=x.querySelector(".bw-collapse-indicator");g&&(g.innerHTML=f?Ta:Fa,g.dataset.state=f?"collapsed":"expanded"),"BLOCKQUOTE"===x.tagName&&(x.style.borderLeftColor=f?"":"transparent"),(()=>{if(!o)return;const r=[];Array.from(e.querySelectorAll('[data-bw-collapsible="1"]')).forEach(e=>{const t=e.querySelector(".bw-collapse-indicator");"expanded"===(null==t?void 0:t.dataset.state)&&r.push(_a(e))}),Da(n,a,t,r)})(),null==r||r(),h=!1};return e.addEventListener("touchstart",u,{passive:!0}),e.addEventListener("touchmove",m,{passive:!0}),e.addEventListener("pointerdown",p,{passive:!0}),e.addEventListener("pointermove",x,{passive:!0}),e.addEventListener("wheel",b,{passive:!0}),e.addEventListener("click",f),()=>{e.removeEventListener("touchstart",u),e.removeEventListener("touchmove",m),e.removeEventListener("pointerdown",p),e.removeEventListener("pointermove",x),e.removeEventListener("wheel",b),e.removeEventListener("click",f)}}const za=({hasAnyContent:n,articleRef:a,chapter:r,simpleExpanded:o,standardExpanded:i,advancedExpanded:l,hasSimple:d,hasStandard:c,hasAdvanced:h,goToTier:u})=>{const m=s(),[p,x]=e.useState(null);if(e.useLayoutEffect(()=>{if(!n)return;let e=0;const t=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{var e;const t=document.querySelector(".online-users-sidebar"),n=t?window.getComputedStyle(t):null,r=t&&"none"!==(null==n?void 0:n.display)?t.getBoundingClientRect():null,o=((null==r?void 0:r.left)||window.innerWidth)-184-24,s=null==(e=a.current)?void 0:e.getBoundingClientRect(),i=s?s.right+24:o;x(Math.max(16,Math.min(i,o)))})};t();const r=[window.setTimeout(t,120),window.setTimeout(t,500)];return window.addEventListener("resize",t),()=>{cancelAnimationFrame(e),r.forEach(window.clearTimeout),window.removeEventListener("resize",t)}},[n,a]),!n)return null;const b=[{key:"simple",label:m(0===r?"全书导读":"本章导读"),hint:m(0===r?"背景 · 结构 · 反思":"脉络 · 钥节 · 反思"),color:"#7A4F11",bg:"#FFF7E0",border:"#E6BA59",active:o,show:d},{key:"standard",label:m(0===r?"全书详解":"逐节详解"),hint:m(0===r?"结构 · 主线":"段落 · 释义"),color:"#3D
15A2D",bg:"#F0F7E6",border:"#CFE0BB",active:i,show:c},{key:"advanced",label:m("神学进深"),hint:m("词汇 · 主题 · 回响"),color:"#245B83",bg:"#E4F2FB",border:"#B7D7EA",active:l,show:h}].filter(e=>e.show);return t.jsx("aside",{className:"hidden xl:block fixed top-24 z-[9] w-[184px] max-h-[calc(100vh-7rem)] overflow-y-auto",style:null==p?{visibility:"hidden"}:{left:`${p}px`},children:t.jsxs("div",{className:"border-l border-[#E6E2D6] pl-4 py-1",children:[t.jsx("div",{className:"text-[13px] text-slate-500 mb-2",children:m("本章目录")}),t.jsx("div",{className:"space-y-1.5",children:b.map(e=>t.jsxs("button",{type:"button",onClick:()=>u(e.key),className:"w-full text-left rounded-lg border px-3 py-2 transition-colors hover:brightness-[0.98]",style:{backgroundColor:e.bg,borderColor:e.active?e.border:"transparent",boxShadow:e.active?`inset 3px 0 0 ${e.border}`:void 0,color:e.color},"aria-pressed":e.active,children:[t.jsx("span",{className:"block text-[14px] font-medium leading-5",children:e.label}),t.jsx("span",{className:"block text-[13px] leading-4 mt-0.5 opacity-75",children:e.hint})]},e.key))})]})})},Pa=({className:e="",isLearned:n,onToggle:a})=>{const r=s();return t.jsxs("button",{type:"button",onClick:a,"aria-pressed":n,title:r(n?"取消收藏":"收藏本章"),className:`shrink-0 h-10 sm:h-9 inline-flex items-center justify-center gap-1.5 px-3 rounded-lg text-[13px] sm:text-sm border transition-colors whitespace-nowrap ${n?"bg-[#CFE0BB] text-[#3D5A2D] border-[#8FAE6E] hover:bg-[#BED4A4]":"bg-[#FFFCF5] text-[#6B6557] border-[#E6E2D6] hover:bg-[#F0EDE2] hover:text-[#2D2A22]"} ${e}`,children:[t.jsx(Ye,{className:"w-4 h-4",strokeWidth:n?2.5:2}),t.jsx("span",{children:r(n?"已收藏":"收藏本章")})]})},Oa=({variant:e="bottom",book:n,chapter:a,currentBook:r,prev:o,next:i,isLearned:l,zenMode:d,navButtonClass:h,goTo:u,onOpenChapterPicker:m,onOpenScripture:p,onToggleLearned:x,onOpenHandout:b,onShare:f})=>{const g=s(),w="top"===e,k=0===a?1:a;return t.jsxs("div",{className:(w?"hidden md:flex":"flex")+" items-center gap-2 w-full sm:w-auto flex-wrap",children:[!w&&(o?t.jsxs("button",{onClick:()=>u(o),className:h,title:0===o.chapter?g("导论"):g("上一章"),children:[t.jsx(Pe,{className:"w-4 h-4"}),t.jsx("span",{children:0===o.chapter?g("导论"):g("上一章")})]}):t.jsx("div",{})),!w&&(i?t.jsxs("button",{onClick:()=>u(i),className:h,title:0===i.chapter?g("导论"):g("下一章"),children:[t.jsx("span",{children:0===i.chapter?g("导论"):g("下一章")}),t.jsx(et,{className:"w-4 h-4"})]}):t.jsx("div",{})),r&&t.jsxs("button",{onClick:m,className:`${h} ${w?"":"max-md:hidden"}`,title:g("全部章节"),children:[t.jsx(tt,{className:"w-4 h-4"}),t.jsx("span",{children:g("全部")})]}),r&&R()&&t.jsxs("button",{onClick:()=>p({book:n,chapter:k,bookZh:q(r),mode:"chapter"}),className:`${h} ${w?"":"max-md:hidden"}`,title:g("读本章经文"),children:[t.jsx(nt,{className:"w-4 h-4"}),t.jsx("span",{children:g("本章经文")})]}),!w&&t.jsxs("button",{onClick:x,title:g(l?"取消收藏":"收藏本章"),className:"max-md:hidden shrink-0 h-10 sm:h-9 md:inline-flex items-center justify-center gap-1.5 px-3 rounded-lg text-[13px] sm:text-sm border transition-colors whitespace-nowrap "+(l?"bg-[#CFE0BB] text-[#3D5A2D] border-[#8FAE6E] hover:bg-[#BED4A4]":"bg-[#FFFCF5] text-[#6B6557] border-[#E6E2D6] hover:bg-[#F0EDE2] hover:text-[#2D2A22]"),children:[t.jsx(Ye,{className:"w-4 h-4",strokeWidth:l?2.5:2}),t.jsx("span",{children:g(l?"已收藏":"收藏本章")})]}),t.jsxs("button",{onClick:b,title:g("查经讲义(打印 / 存 PDF / 讨论题)"),className:`${h} ${w?"":"max-md:hidden"}`,children:[t.jsx(Be,{className:"w-4 h-4"}),t.jsx("span",{children:g("查经讲义")})]}),t.jsxs("button",{onClick:()=>c("myAnnotations"),title:g("我的笔记本"),className:`${h} ${w?"":"max-md:hidden"}`,children:[t.jsx(Oe,{className:"w-4 h-4"}),t.jsx("span",{children:g("我的笔记")})]}),!w&&!d&&t.jsxs("button",{onClick:f,title:g("分享给弟兄姐妹"),className:h,children:[t.jsx(at,{className:"w-4 h-4"}),t.jsx("span",{children:g("分享")})]})]})},Ra=({book:e,chapter:n,currentBook:a,mobileNavAboveOverlay:r,allBooksOpen:o,scriptureOpen:i,handoutOpen:l,canOpenHandout:d,onCloseAllBooks:c,onOpenAllBooks:h,onCloseScripture:u,onSetHandoutOpen:m,onSetChapterPickerOpen:p,onOpenScripture:x})=>{const b=s(),f=!!a&&!!R(),g=0===n?1:n;return t.jsx("nav",{className:`fixed inset-x-0 bottom-0 ${r?"z-[80]":"z-30"} md:hidden`,"aria-label":b("主导航"),children:t.jsxs("div",{className:"grid grid-cols-3 border-t border-stone-200/70 bg-[#FAF9F6]",style:{paddingBottom:"env(safe-area-inset-bottom, 0px)"},children:[t.jsxs("button",{type:"button",onClick:()=>{o?null==c||c():(u(),m(!1),h())},"aria-pressed":o,"aria-label":b("全部章节"),title:b("全部章节"),className:"flex min-h-[56px] flex-col items-center justify-center gap-1 py-2 text-[13px] font-semibold tracking-[0.02em] text-[#6B6557] transition-colors hover:text-[#3D5A2D]",children:[t.jsx(tt,{className:"h-[22px] w-[22px]",strokeWidth:2}),t.jsx("span",{children:b("全部")}
1)]}),t.jsxs("button",{type:"button",onClick:()=>{if(f&&a){if(i)return void u();m(!1),p(!1),null==c||c(),x({book:e,chapter:g,bookZh:q(a),mode:"chapter",presentation:"wiki-mobile-nav"})}},disabled:!f,"aria-pressed":i,"aria-label":b("本章经文"),title:b("读本章经文"),className:"flex min-h-[56px] flex-col items-center justify-center gap-1 py-2 text-[13px] font-semibold tracking-[0.02em] text-[#6B6557] transition-colors hover:text-[#3D5A2D] disabled:cursor-not-allowed disabled:text-slate-300",children:[t.jsx(nt,{className:"h-[22px] w-[22px]",strokeWidth:2}),t.jsx("span",{children:b("本章经文")})]}),t.jsxs("button",{type:"button",onClick:()=>{l?m(!1):(u(),p(!1),null==c||c(),m(!0))},disabled:!d,"aria-pressed":l,"aria-label":b("查经讲义"),title:b("查经讲义(打印 / 存 PDF / 讨论题)"),className:"flex min-h-[56px] flex-col items-center justify-center gap-1 py-2 text-[13px] font-semibold tracking-[0.02em] text-[#6B6557] transition-colors hover:text-[#3D5A2D] disabled:cursor-not-allowed disabled:text-slate-300",children:[t.jsx(Be,{className:"h-[22px] w-[22px]",strokeWidth:2}),t.jsx("span",{children:b("查经讲义")})]})]})})},Ha=({id:n,title:a,subtitle:r,icon:o,expanded:i,onToggle:l,bgClass:d,headerClass:c,borderClass:h,accent:u="amber",html:m,tier:p,book:x,chapter:b})=>{const f=e.useRef(null),{i18n:g}=Pt(),w=s(),[k,v]=e.useState(0),[y,j]=e.useState({total:0,open:0}),Z=e.useRef({wheelGhostClickUntil:0,closeArmed:!1,pointerStart:null,pointerMoved:!1,touchStart:null,touchMoved:!1}),N=e.useMemo(()=>we(vt(function(e,t,n,a){if(!e||"undefined"==typeof DOMParser)return e;try{const r=(new DOMParser).parseFromString(`<body>${e}</body>`,"text/html").body,o=n&&"number"==typeof a&&t?Aa(r,n,a,t):new Set;return Ma(r,o),"standard"===t&&La(r,o),r.innerHTML}catch{return e}}(m,p,x,b),g.language),g.language),[m,p,x,b,k,g.language]);e.useLayoutEffect(()=>{if(!i)return void j({total:0,open:0});const e=f.current;if(!e)return;const t=x&&"number"==typeof b&&p?Aa(e,x,b,p):void 0;return Ma(e,t),"standard"===p&&La(e,t),t&&((e,t)=>{const n=Array.from(e.querySelectorAll('[data-bw-collapsible="1"]'));for(const a of n)t.has(_a(a))?Ba(a):$a(a)})(e,t),j((e=>{const t=Array.from(e.querySelectorAll('[data-bw-collapsible="1"]'));let n=0;for(const a of t){const e=a.nextElementSibling;(null==e?void 0:e.classList.contains("bw-collapsible-content"))&&"none"!==e.style.display&&n++}return{total:t.length,open:n}})(e)),qa(e,p,x,b,()=>v(e=>e+1))},[N,i,p,x,b]);const C=y.total>0&&y.open>=y.total;return t.jsxs("div",{id:n,className:`rounded-xl overflow-hidden ${d}`,children:[t.jsx("div",{className:`flex items-center ${h||""}`,children:t.jsxs("button",{onClick:e=>{const t=Z.current;if(Date.now()<t.wheelGhostClickUntil||t.pointerMoved||t.touchMoved)return t.wheelGhostClickUntil=0,t.pointerStart=null,t.touchStart=null,t.pointerMoved=!1,t.touchMoved=!1,void(t.closeArmed=!1);i&&!t.closeArmed||(l(),t.closeArmed=!1)},onWheel:()=>{Z.current.wheelGhostClickUntil=Date.now()+800,Z.current.closeArmed=!1},onPointerDown:e=>{Z.current.wheelGhostClickUntil=0,Z.current.closeArmed=i,Z.current.pointerStart={x:e.clientX,y:e.clientY},Z.current.pointerMoved=!1},onPointerMove:e=>{const t=Z.current.pointerStart;t&&Math.hypot(e.clientX-t.x,e.clientY-t.y)>8&&(Z.current.pointerMoved=!0,Z.current.closeArmed=!1)},onTouchStart:e=>{const t=e.touches[0];t&&(Z.current.wheelGhostClickUntil=0,Z.current.closeArmed=i,Z.current.touchStart={x:t.clientX,y:t.clientY},Z.current.touchMoved=!1)},onTouchMove:e=>{const t=Z.current.touchStart,n=e.touches[0];t&&n&&Math.hypot(n.clientX-t.x,n.clientY-t.y)>8&&(Z.current.touchMoved=!0,Z.current.closeArmed=!1)},className:"flex-1 min-w-0 px-4 py-3 flex items-center justify-between hover:opacity-80 transition-opacity",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("span",{className:c,children:o}),t.jsx("span",{className:`font-semibold text-base ${c}`,children:a}),t.jsx("span",{className:"text-sm text-[#78716C] dark:text-[#B3AC9C] hidden sm:inline truncate",children:r})]}),i?t.jsx(Qe,{className:"w-4 h-4 text-slate-500 flex-shrink-0"}):t.jsx(Xe,{className:"w-4 h-4 text-slate-500 flex-shrink-0"})]})}),i&&y.total>0&&t.jsx("div",{className:"px-4 pb-1 -mt-1 flex justify-end",children:t.jsxs("button",{type:"button",onClick:()=>{const e=f.current;e&&(((e,t,n,a,r)=>{const o=Array.from(e.querySelectorAll('[data-bw-collapsible="1"]'));
1o.forEach(e=>t?Ba(e):$a(e)),a&&"number"==typeof r&&n&&Da(a,r,n,t?o.map(_a):[])})(e,!C,p,x,b),v(e=>e+1))},className:"inline-flex items-center gap-1 rounded-full border border-[#E6E2D6] dark:border-[#3A3730] px-2.5 py-1 text-[13px] text-[#4F7942] dark:text-[#9CB58A] hover:bg-[#EDE9DD] dark:hover:bg-[#2C2A25] transition-colors",children:[C?t.jsx(rt,{className:"w-3.5 h-3.5",strokeWidth:1.8}):t.jsx(ot,{className:"w-3.5 h-3.5",strokeWidth:1.8}),w(C?"收起全部":"展开全部")]})}),i&&t.jsx(ne,{ref:f,className:`px-4 pb-4 bct-rich-text bible-wiki-rich-text max-w-none text-[17px] leading-[1.85] text-slate-700\n  [&_p]:my-4\n  [&_img]:rounded-xl [&_img]:max-w-full [&_img]:h-auto [&_img]:my-3\n  [&_h1]:text-[21px] [&_h1]:font-bold [&_h1]:text-slate-800 dark:[&_h1]:text-[#ECE6D8] [&_h1]:mt-5 [&_h1]:mb-2.5 [&_h1]:leading-snug\n  [&_h2]:text-[19px] [&_h2]:font-bold [&_h2]:mt-11 [&_h2]:mb-3 [&_h2]:leading-snug [&_h2]:pb-2.5 [&_h2]:border-b [&_h2]:border-dashed\n  [&_h2[id]]:scroll-mt-16\n  [&_h3]:text-[17px] [&_h3]:font-semibold [&_h3]:text-slate-800 dark:[&_h3]:text-[#ECE6D8] [&_h3]:mt-5 [&_h3]:mb-2 [&_h3]:leading-snug\n  [&_h3[data-bw-collapsible]]:ml-3 sm:[&_h3[data-bw-collapsible]]:ml-4 [&_.bw-collapsible-content-h3]:ml-3 sm:[&_.bw-collapsible-content-h3]:ml-4\n  [&_h4]:text-[15px] [&_h4]:font-semibold [&_h4]:text-slate-800 dark:[&_h4]:text-[#ECE6D8] [&_h4]:mt-3 [&_h4]:mb-1.5\n  [&_table]:block [&_table]:w-max [&_table]:max-w-full [&_table]:overflow-x-auto [&_table]:border-collapse [&_table]:my-4 [&_table]:text-[15px] [&_table]:rounded-lg [&_table]:border [&_table]:border-slate-200 dark:[&_table]:border-[#38332A]\n  [&_th]:font-semibold [&_th]:px-2.5 [&_th]:py-2 [&_th]:text-left [&_th]:align-top [&_th]:border [&_th]:border-slate-200 dark:[&_th]:border-[#403A2F]\n  [&_td]:px-2.5 [&_td]:py-2 [&_td]:align-top [&_td]:break-words [&_td]:max-w-[24em] [&_td]:border [&_td]:border-slate-200 dark:[&_td]:border-[#38332A]\n  [&_tr:nth-child(even)]:bg-slate-50 dark:[&_tr:nth-child(even)]:bg-[#201C15]\n  [&_blockquote]:my-4 [&_blockquote]:px-4 [&_blockquote]:py-3 [&_blockquote]:border-l-4 [&_blockquote]:rounded-r-lg [&_blockquote]:italic\n  [&_blockquote_p]:my-1.5\n  [&_ul]:my-3.5 [&_ul]:pl-6 [&_ul]:list-disc\n  [&_ol]:my-3.5 [&_ol]:pl-6 [&_ol]:list-decimal\n  [&_li]:my-1.5\n  [&_hr]:border-0 [&_hr]:border-t [&_hr]:border-slate-200 dark:[&_hr]:border-[#38332A] [&_hr]:my-5\n  [&_strong]:text-slate-800 dark:[&_strong]:text-[#ECE6D8]\n  [&_a]:underline\n  [&_.wiki-section-link]:text-[#4F7942] dark:[&_.wiki-section-link]:text-[#9DCB78] [&_.wiki-section-link]:decoration-dotted [&_.wiki-section-link:hover]:decoration-solid\n  [&_.wiki-deep-link]:text-indigo-600 dark:[&_.wiki-deep-link]:text-[#A9C0E8] [&_.wiki-deep-link]:no-underline [&_.wiki-deep-link:hover]:underline\n  [&_.verse-chip]:text-[#4F7942] dark:[&_.verse-chip]:text-[#9DCB78] [&_.verse-chip]:underline [&_.verse-chip]:decoration-dotted [&_.verse-chip]:decoration-[#9CB58A]/60 [&_.verse-chip]:underline-offset-[3px] [&_.verse-chip]:cursor-pointer [&_.verse-chip]:whitespace-nowrap\n  [&_.ancient-text]:font-serif [&_.ancient-text]:text-slate-900 dark:[&_.ancient-text]:text-[#F2ECDE]\n  [&_.play-ancient]:inline-flex [&_.play-ancient]:items-center [&_.play-ancient]:justify-center\n  [&_.play-ancient]:ml-1 [&_.play-ancient]:mr-0.5 [&_.play-ancient]:bg-transparent [&_.play-ancient]:border-0 [&_.play-ancient]:p-0\n  [&_.play-ancient]:text-indigo-600 [&_.play-ancient]:cursor-pointer [&_.play-ancient]:align-middle [&_.play-ancient]:transition-colors\n  [&_.play-ancient:hover]:text-indigo-800\n  [&_.play-ancient-active]:text-indigo-700 [&_.play-ancient-active]:animate-pulse\n  [&_pre]:bg-slate-100 dark:[&_pre]:bg-[#211D16] [&_pre]:rounded-lg [&_pre]:p-4 [&_pre]:overflow-x-auto [&_pre]:my-3 [&_pre]:text-[14px]\n  [&_code]:bg-slate-100 dark:[&_code]:bg-[#2A251E] [&_code]:rounded [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:text-[14px] ${ba[u]}`,"data-bible-tier":p,html:N})]})},Wa={fontFamily:'"Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif'},Ga="bct_study_book",Ua=({user:n,initialBook:a,initialChapter:r})=>{const o=s(),i=B.find(e=>e.name===a||e.nameZh===a),l=(null==i?void 0:i.name)||a,d="number"==typeof r&&r>=0?r:1,[h,u]=e.useState(!1),[m,p]=e.useState(!1),[x,b]=e.useState(!1),[f,g]=e.useState("");e.useEffect(()=>{const e=e=>{var t;const n=(null==(t=e.detail)?void 0:t.q)||"";g(n),b(!0),p(!1),u(!0)};return window.addEventListener("bcct:wiki-whole-search",e),()=>window.removeEventListener("bcct:wiki-whole-search",e)},[]);const w=e.useContext(U).size>0,k=J(),[v,y]=e.useState(48),j=e.useRef(null);e.useEffect(()=>{const e=()=>{j.current&&y(j.current.offsetHeight)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e.useEffect(()=>{if(i)try{localStorage.setItem(Ga,JSON.stringify({testament:"OT"===i.testament?"旧约":"新约",name:i.nameZh,chapter:d}))}catch{}}
1,[i,d]);return t.jsxs("div",{className:"min-h-screen flex flex-col",style:{background:"var(--paper, #FAF9F6)",paddingBottom:"env(safe-area-inset-bottom, 0px)",paddingTop:v},children:[t.jsx("div",{ref:j,className:`fixed top-0 left-0 right-0 ${w?"lg:right-48":""} z-30 transition-transform duration-300 ${k?"translate-y-0":"-translate-y-full"}`,style:{background:"var(--paper, #FAF9F6)",paddingTop:"env(safe-area-inset-top, 0px)"},children:t.jsxs("div",{className:"relative px-4 pt-2 pb-2 max-w-5xl mx-auto w-full flex items-center min-h-[36px]",children:[t.jsxs("button",{type:"button",onClick:()=>V(()=>c("dashboard")),"aria-label":o("返回"),className:"inline-flex items-center gap-1.5 text-[14px] text-slate-500 hover:text-slate-800 transition-colors px-2 py-1 -ml-2",style:Wa,children:[t.jsx(st,{className:"w-4 h-4",strokeWidth:1.6}),o("返回")]}),i&&t.jsxs("button",{type:"button",onClick:()=>{b(!1),p(!0),u(!0)},"aria-label":o("换一卷或换一章"),title:o("换一卷或换一章"),className:"absolute left-1/2 -translate-x-1/2 max-w-[56%] inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[15px] font-medium text-slate-800 tracking-[0.06em] whitespace-nowrap hover:bg-slate-100 active:bg-slate-100 transition-colors",style:Wa,children:[t.jsxs("span",{className:"truncate",children:[o(i.nameZh),0===d?o(" · 导论"):` ${o("第{0}章").replace("{0}",String(d))}`]}),t.jsx(Xe,{className:"w-3.5 h-3.5 shrink-0 text-slate-500",strokeWidth:1.8,"aria-hidden":!0})]}),t.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[i&&t.jsx("button",{type:"button",onClick:()=>c("geography",{geoBook:l}),"aria-label":o("本卷地图"),title:o("在圣经地图上看本卷地名"),className:"inline-flex items-center justify-center w-9 h-9 rounded-full text-slate-600 hover:bg-sky-50 hover:text-sky-600 transition-colors",children:t.jsx(it,{className:"w-[18px] h-[18px]",strokeWidth:1.6})}),t.jsx("button",{type:"button",onClick:()=>window.dispatchEvent(new CustomEvent("bcct:wiki-article-search")),"aria-label":o("搜索"),title:o("搜索经文"),className:"inline-flex items-center justify-center w-9 h-9 rounded-full text-slate-600 hover:bg-slate-100 hover:text-slate-800 transition-colors",children:t.jsx(Ie,{className:"w-[18px] h-[18px]",strokeWidth:1.6})}),t.jsx("button",{type:"button",onClick:()=>window.dispatchEvent(new CustomEvent("bcct:wiki-share")),"aria-label":o("分享"),title:o("分享给弟兄姐妹"),className:"inline-flex items-center justify-center w-9 h-9 rounded-full text-slate-600 hover:bg-slate-100 hover:text-slate-800 transition-colors",children:t.jsx(at,{className:"w-[18px] h-[18px]",strokeWidth:1.6})})]})]})}),t.jsx("div",{className:"flex-1",children:t.jsx(ya,{book:l,chapter:d,user:n,zenMode:!0,allBooksOpen:h,mobileNavAboveOverlay:m,onShowAllBooks:()=>{b(!1),p(!0),u(!0)},onCloseAllBooks:()=>{u(!1),p(!1),b(!1),g("")}})}),t.jsx(Ot,{book:l,chapter:d}),t.jsx(ee,{open:h,onClose:()=>{u(!1),p(!1),b(!1),g("")},currentBookName:(null==i?void 0:i.nameZh)??"",currentChapter:d,user:n,onSelect:e=>{const t=B.find(t=>t.nameZh===e.name);if(t){try{localStorage.setItem(Ga,JSON.stringify({testament:e.testament,name:e.name,chapter:e.chapter??1}))}catch{}u(!1),p(!1),c("bibleWikiArticle",{bibleWikiBook:t.name,bibleWikiChapter:String(e.chapter??1)})}},keepBottomNavVisible:m,autoFocusSearch:x,initialQuery:f})]})};export{Ua as StudyZen};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.