@researai/deepscientist 1.5.17 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +309 -130
- package/AISB/catalog/aisb.b1.agentic_coding.yaml +244 -0
- package/AISB/catalog/aisb.b10.climate_earth.yaml +235 -0
- package/AISB/catalog/aisb.b11.model_efficiency.yaml +231 -0
- package/AISB/catalog/aisb.b12.embodied_ai.yaml +238 -0
- package/AISB/catalog/aisb.b2.agent_systems.yaml +229 -0
- package/AISB/catalog/aisb.b3.self_evolving_rl.yaml +237 -0
- package/AISB/catalog/aisb.b4.lm_reasoning.yaml +240 -0
- package/AISB/catalog/aisb.b5.math_proof.yaml +235 -0
- package/AISB/catalog/aisb.b6.research_process.yaml +243 -0
- package/AISB/catalog/aisb.b7.multimodal_fusion.yaml +232 -0
- package/AISB/catalog/aisb.b8.lifesci_drug.yaml +275 -0
- package/AISB/catalog/aisb.b9.material_science.yaml +237 -0
- package/AISB/catalog/aisb.t3.001_savvy.yaml +159 -0
- package/AISB/catalog/aisb.t3.001_savvy.zh.yaml +121 -0
- package/AISB/catalog/aisb.t3.002_pinet.yaml +189 -0
- package/AISB/catalog/aisb.t3.002_pinet.zh.yaml +130 -0
- package/AISB/catalog/aisb.t3.004_decentralattn.yaml +184 -0
- package/AISB/catalog/aisb.t3.004_decentralattn.zh.yaml +153 -0
- package/AISB/catalog/aisb.t3.005_tsae.yaml +193 -0
- package/AISB/catalog/aisb.t3.005_tsae.zh.yaml +139 -0
- package/AISB/catalog/aisb.t3.006_physense.yaml +194 -0
- package/AISB/catalog/aisb.t3.006_physense.zh.yaml +118 -0
- package/AISB/catalog/aisb.t3.007_reasoningiqa.yaml +169 -0
- package/AISB/catalog/aisb.t3.007_reasoningiqa.zh.yaml +133 -0
- package/AISB/catalog/aisb.t3.008_meanflows.yaml +188 -0
- package/AISB/catalog/aisb.t3.008_meanflows.zh.yaml +140 -0
- package/AISB/catalog/aisb.t3.009_scoremissing.yaml +179 -0
- package/AISB/catalog/aisb.t3.009_scoremissing.zh.yaml +119 -0
- package/AISB/catalog/aisb.t3.010_suitabilityfilter.yaml +221 -0
- package/AISB/catalog/aisb.t3.010_suitabilityfilter.zh.yaml +141 -0
- package/AISB/catalog/aisb.t3.011_osd.yaml +206 -0
- package/AISB/catalog/aisb.t3.011_osd.zh.yaml +163 -0
- package/AISB/catalog/aisb.t3.012_efficientqat.yaml +206 -0
- package/AISB/catalog/aisb.t3.012_efficientqat.zh.yaml +159 -0
- package/AISB/catalog/aisb.t3.013_appl.yaml +152 -0
- package/AISB/catalog/aisb.t3.013_appl.zh.yaml +126 -0
- package/AISB/catalog/aisb.t3.014_piguard.yaml +207 -0
- package/AISB/catalog/aisb.t3.014_piguard.zh.yaml +164 -0
- package/AISB/catalog/aisb.t3.015_frspec.yaml +209 -0
- package/AISB/catalog/aisb.t3.015_frspec.zh.yaml +163 -0
- package/AISB/catalog/aisb.t3.016_mathfusion.yaml +166 -0
- package/AISB/catalog/aisb.t3.016_mathfusion.zh.yaml +145 -0
- package/AISB/catalog/aisb.t3.017_multimodalglp.yaml +171 -0
- package/AISB/catalog/aisb.t3.017_multimodalglp.zh.yaml +122 -0
- package/AISB/catalog/aisb.t3.018_cotsynth.yaml +206 -0
- package/AISB/catalog/aisb.t3.018_cotsynth.zh.yaml +162 -0
- package/AISB/catalog/aisb.t3.019_dyscaleut.yaml +211 -0
- package/AISB/catalog/aisb.t3.019_dyscaleut.zh.yaml +148 -0
- package/AISB/catalog/aisb.t3.020_aristotle.yaml +173 -0
- package/AISB/catalog/aisb.t3.020_aristotle.zh.yaml +119 -0
- package/AISB/catalog/aisb.t3.021_tokenrecycling.yaml +160 -0
- package/AISB/catalog/aisb.t3.021_tokenrecycling.zh.yaml +129 -0
- package/AISB/catalog/aisb.t3.022_chainofreasoning.yaml +204 -0
- package/AISB/catalog/aisb.t3.022_chainofreasoning.zh.yaml +161 -0
- package/AISB/catalog/aisb.t3.023_guidedembed.yaml +211 -0
- package/AISB/catalog/aisb.t3.023_guidedembed.zh.yaml +189 -0
- package/AISB/catalog/aisb.t3.024_outputcentric.yaml +148 -0
- package/AISB/catalog/aisb.t3.024_outputcentric.zh.yaml +131 -0
- package/AISB/catalog/aisb.t3.025_deeper.yaml +143 -0
- package/AISB/catalog/aisb.t3.025_deeper.zh.yaml +116 -0
- package/AISB/catalog/aisb.t3.026_gartkg.yaml +195 -0
- package/AISB/catalog/aisb.t3.026_gartkg.zh.yaml +127 -0
- package/AISB/catalog/aisb.t3.027_citeeval.yaml +182 -0
- package/AISB/catalog/aisb.t3.027_citeeval.zh.yaml +135 -0
- package/AISB/catalog/aisb.t3.028_sbam.yaml +206 -0
- package/AISB/catalog/aisb.t3.028_sbam.zh.yaml +166 -0
- package/AISB/catalog/aisb.t3.029_cdqgeoembed.yaml +224 -0
- package/AISB/catalog/aisb.t3.029_cdqgeoembed.zh.yaml +142 -0
- package/AISB/catalog/aisb.t3.030_processrm.yaml +211 -0
- package/AISB/catalog/aisb.t3.030_processrm.zh.yaml +166 -0
- package/AISB/catalog/aisb.t3.031_circuitstability.yaml +172 -0
- package/AISB/catalog/aisb.t3.031_circuitstability.zh.yaml +134 -0
- package/AISB/catalog/aisb.t3.032_ptsolver.yaml +169 -0
- package/AISB/catalog/aisb.t3.032_ptsolver.zh.yaml +135 -0
- package/AISB/catalog/aisb.t3.033_gcse.yaml +144 -0
- package/AISB/catalog/aisb.t3.033_gcse.zh.yaml +126 -0
- package/AISB/catalog/aisb.t3.034_ensemblewm.yaml +183 -0
- package/AISB/catalog/aisb.t3.034_ensemblewm.zh.yaml +146 -0
- package/AISB/catalog/aisb.t3.035_moralvalueswa.yaml +207 -0
- package/AISB/catalog/aisb.t3.035_moralvalueswa.zh.yaml +165 -0
- package/AISB/catalog/aisb.t3.036_weakstrongpref.yaml +210 -0
- package/AISB/catalog/aisb.t3.036_weakstrongpref.zh.yaml +194 -0
- package/AISB/catalog/aisb.t3.037_dementiamask.yaml +172 -0
- package/AISB/catalog/aisb.t3.037_dementiamask.zh.yaml +132 -0
- package/AISB/catalog/aisb.t3.038_tinysam.yaml +284 -0
- package/AISB/catalog/aisb.t3.038_tinysam.zh.yaml +240 -0
- package/AISB/catalog/aisb.t3.039_calf.yaml +224 -0
- package/AISB/catalog/aisb.t3.039_calf.zh.yaml +194 -0
- package/AISB/catalog/aisb.t3.040_graniteguardian.yaml +199 -0
- package/AISB/catalog/aisb.t3.040_graniteguardian.zh.yaml +174 -0
- package/AISB/catalog/aisb.t3.041_amdm.yaml +149 -0
- package/AISB/catalog/aisb.t3.041_amdm.zh.yaml +137 -0
- package/AISB/catalog/aisb.t3.042_xpatch.yaml +216 -0
- package/AISB/catalog/aisb.t3.042_xpatch.zh.yaml +182 -0
- package/AISB/catalog/aisb.t3.043_vhm.yaml +268 -0
- package/AISB/catalog/aisb.t3.043_vhm.zh.yaml +193 -0
- package/AISB/catalog/aisb.t3.044_rgvi.yaml +224 -0
- package/AISB/catalog/aisb.t3.044_rgvi.zh.yaml +176 -0
- package/AISB/catalog/aisb.t3.045_pslstm.yaml +203 -0
- package/AISB/catalog/aisb.t3.045_pslstm.zh.yaml +179 -0
- package/AISB/catalog/aisb.t3.046_nonstatts.yaml +208 -0
- package/AISB/catalog/aisb.t3.046_nonstatts.zh.yaml +194 -0
- package/AISB/catalog/aisb.t3.047_timepfn.yaml +156 -0
- package/AISB/catalog/aisb.t3.047_timepfn.zh.yaml +124 -0
- package/AISB/catalog/aisb.t3.048_proxyspex.yaml +148 -0
- package/AISB/catalog/aisb.t3.048_proxyspex.zh.yaml +125 -0
- package/AISB/catalog/aisb.t3.049_hogwildinference.yaml +183 -0
- package/AISB/catalog/aisb.t3.049_hogwildinference.zh.yaml +138 -0
- package/AISB/catalog/aisb.t3.050_causalpfn.yaml +214 -0
- package/AISB/catalog/aisb.t3.050_causalpfn.zh.yaml +190 -0
- package/AISB/catalog/aisb.t3.051_flashtp.yaml +169 -0
- package/AISB/catalog/aisb.t3.051_flashtp.zh.yaml +124 -0
- package/AISB/catalog/aisb.t3.052_nsdiff.yaml +155 -0
- package/AISB/catalog/aisb.t3.052_nsdiff.zh.yaml +138 -0
- package/AISB/catalog/aisb.t3.053_k2vae.yaml +158 -0
- package/AISB/catalog/aisb.t3.053_k2vae.zh.yaml +132 -0
- package/AISB/catalog/aisb.t3.054_timebase.yaml +178 -0
- package/AISB/catalog/aisb.t3.054_timebase.zh.yaml +158 -0
- package/AISB/catalog/aisb.t3.055_csbrain.yaml +238 -0
- package/AISB/catalog/aisb.t3.055_csbrain.zh.yaml +184 -0
- package/AISB/catalog/aisb.t3.056_infosam.yaml +224 -0
- package/AISB/catalog/aisb.t3.056_infosam.zh.yaml +189 -0
- package/AISB/catalog/aisb.t3.057_mdreid.yaml +129 -0
- package/AISB/catalog/aisb.t3.057_mdreid.zh.yaml +117 -0
- package/AISB/catalog/aisb.t3.058_mindglitch.yaml +171 -0
- package/AISB/catalog/aisb.t3.058_mindglitch.zh.yaml +145 -0
- package/AISB/catalog/aisb.t3.059_selfsupervised.yaml +154 -0
- package/AISB/catalog/aisb.t3.059_selfsupervised.zh.yaml +125 -0
- package/AISB/catalog/aisb.t3.060_iaggad.yaml +121 -0
- package/AISB/catalog/aisb.t3.060_iaggad.zh.yaml +100 -0
- package/AISB/catalog/aisb.t3.061_hsgkn.yaml +136 -0
- package/AISB/catalog/aisb.t3.061_hsgkn.zh.yaml +113 -0
- package/AISB/catalog/aisb.t3.062_visionts.yaml +237 -0
- package/AISB/catalog/aisb.t3.062_visionts.zh.yaml +216 -0
- package/AISB/catalog/aisb.t3.063_tsrag.yaml +162 -0
- package/AISB/catalog/aisb.t3.063_tsrag.zh.yaml +138 -0
- package/AISB/catalog/aisb.t3.064_pir.yaml +221 -0
- package/AISB/catalog/aisb.t3.064_pir.zh.yaml +197 -0
- package/AISB/catalog/aisb.t3.065_proteinbinding.yaml +234 -0
- package/AISB/catalog/aisb.t3.065_proteinbinding.zh.yaml +167 -0
- package/AISB/catalog/aisb.t3.066_tropicalattention.yaml +267 -0
- package/AISB/catalog/aisb.t3.066_tropicalattention.zh.yaml +229 -0
- package/AISB/catalog/aisb.t3.067_kanad.yaml +193 -0
- package/AISB/catalog/aisb.t3.067_kanad.zh.yaml +167 -0
- package/AISB/catalog/aisb.t3.068_sempo.yaml +187 -0
- package/AISB/catalog/aisb.t3.068_sempo.zh.yaml +148 -0
- package/AISB/catalog/aisb.t3.069_treehfd.yaml +129 -0
- package/AISB/catalog/aisb.t3.069_treehfd.zh.yaml +111 -0
- package/AISB/catalog/aisb.t3.070_certifiedunlearning.yaml +224 -0
- package/AISB/catalog/aisb.t3.070_certifiedunlearning.zh.yaml +171 -0
- package/AISB/catalog/aisb.t3.071_neuralmjd.yaml +142 -0
- package/AISB/catalog/aisb.t3.071_neuralmjd.zh.yaml +120 -0
- package/AISB/catalog/aisb.t3.072_fedgmt.yaml +181 -0
- package/AISB/catalog/aisb.t3.072_fedgmt.zh.yaml +158 -0
- package/AISB/catalog/aisb.t3.073_rld.yaml +161 -0
- package/AISB/catalog/aisb.t3.073_rld.zh.yaml +129 -0
- package/AISB/catalog/aisb.t3.074_lsvi.yaml +163 -0
- package/AISB/catalog/aisb.t3.074_lsvi.zh.yaml +129 -0
- package/AISB/catalog/aisb.t3.075_treeslicedentropy.yaml +201 -0
- package/AISB/catalog/aisb.t3.075_treeslicedentropy.zh.yaml +148 -0
- package/AISB/catalog/aisb.t3.076_aanet.yaml +169 -0
- package/AISB/catalog/aisb.t3.076_aanet.zh.yaml +129 -0
- package/AISB/catalog/aisb.t3.077_cmnn.yaml +199 -0
- package/AISB/catalog/aisb.t3.077_cmnn.zh.yaml +165 -0
- package/AISB/catalog/aisb.t3.078_conformalanomaly.yaml +146 -0
- package/AISB/catalog/aisb.t3.078_conformalanomaly.zh.yaml +117 -0
- package/AISB/catalog/aisb.t3.079_dpfkmeans.yaml +131 -0
- package/AISB/catalog/aisb.t3.079_dpfkmeans.zh.yaml +104 -0
- package/AISB/catalog/aisb.t3.080_latentscorereweight.yaml +169 -0
- package/AISB/catalog/aisb.t3.080_latentscorereweight.zh.yaml +123 -0
- package/AISB/catalog/aisb.t3.081_qmamba.yaml +150 -0
- package/AISB/catalog/aisb.t3.081_qmamba.zh.yaml +117 -0
- package/AISB/catalog/aisb.t3.082_onlinellmrouting.yaml +160 -0
- package/AISB/catalog/aisb.t3.082_onlinellmrouting.zh.yaml +133 -0
- package/AISB/catalog/aisb.t3.083_starformer.yaml +178 -0
- package/AISB/catalog/aisb.t3.083_starformer.zh.yaml +140 -0
- package/AISB/catalog/aisb.t3.084_ift.yaml +139 -0
- package/AISB/catalog/aisb.t3.084_ift.zh.yaml +111 -0
- package/AISB/catalog/aisb.t3.085_neuralsurv.yaml +183 -0
- package/AISB/catalog/aisb.t3.085_neuralsurv.zh.yaml +143 -0
- package/AISB/catalog/aisb.t3.086_stella.yaml +197 -0
- package/AISB/catalog/aisb.t3.086_stella.zh.yaml +142 -0
- package/AISB/catalog/aisb.t3.087_moses.yaml +167 -0
- package/AISB/catalog/aisb.t3.087_moses.zh.yaml +132 -0
- package/AISB/catalog/aisb.t3.088_channelnorm.yaml +140 -0
- package/AISB/catalog/aisb.t3.088_channelnorm.zh.yaml +109 -0
- package/AISB/catalog/aisb.t3.089_causalvelocity.yaml +730 -0
- package/AISB/catalog/aisb.t3.089_causalvelocity.zh.yaml +668 -0
- package/AISB/catalog/aisb.t3.090_rstib.yaml +144 -0
- package/AISB/catalog/aisb.t3.090_rstib.zh.yaml +109 -0
- package/AISB/catalog/aisb.t3.091_timeawarecausal.yaml +132 -0
- package/AISB/catalog/aisb.t3.091_timeawarecausal.zh.yaml +107 -0
- package/AISB/catalog/aisb.t3.092_kmeanslocalopt.yaml +138 -0
- package/AISB/catalog/aisb.t3.092_kmeanslocalopt.zh.yaml +110 -0
- package/AISB/catalog/aisb.t3.093_fedwmsam.yaml +134 -0
- package/AISB/catalog/aisb.t3.093_fedwmsam.zh.yaml +106 -0
- package/AISB/catalog/aisb.t3.094_boundre.yaml +147 -0
- package/AISB/catalog/aisb.t3.094_boundre.zh.yaml +114 -0
- package/AISB/catalog/aisb.t3.095_fastfeaturecp.yaml +153 -0
- package/AISB/catalog/aisb.t3.095_fastfeaturecp.zh.yaml +118 -0
- package/AISB/catalog/aisb.t3.096_m3svm.yaml +189 -0
- package/AISB/catalog/aisb.t3.096_m3svm.zh.yaml +149 -0
- package/AISB/catalog/aisb.t3.097_wassersteintl.yaml +212 -0
- package/AISB/catalog/aisb.t3.097_wassersteintl.zh.yaml +169 -0
- package/AISB/catalog/aisb.t3.098_xmahalanobis.yaml +171 -0
- package/AISB/catalog/aisb.t3.098_xmahalanobis.zh.yaml +127 -0
- package/AISB/catalog/aisb.t3.099_ollalanding.yaml +248 -0
- package/AISB/catalog/aisb.t3.099_ollalanding.zh.yaml +182 -0
- package/AISB/catalog/aisb.t3.100_invmissingdata.yaml +179 -0
- package/AISB/catalog/aisb.t3.100_invmissingdata.zh.yaml +150 -0
- package/AISB/catalog/aisb.t3.101_acia.yaml +164 -0
- package/AISB/catalog/aisb.t3.101_acia.zh.yaml +109 -0
- package/AISB/catalog/aisb.t3.102_stochasticff.yaml +178 -0
- package/AISB/catalog/aisb.t3.102_stochasticff.zh.yaml +130 -0
- package/AISB/catalog/aisb.t3.103_qdcp.yaml +150 -0
- package/AISB/catalog/aisb.t3.103_qdcp.zh.yaml +116 -0
- package/AISB/catalog/aisb.t3.104_balancedactiveinf.yaml +137 -0
- package/AISB/catalog/aisb.t3.104_balancedactiveinf.zh.yaml +104 -0
- package/AISB/catalog/aisb.t3.105_binaryclasseval.yaml +161 -0
- package/AISB/catalog/aisb.t3.105_binaryclasseval.zh.yaml +130 -0
- package/AISB/image/001_aisb.t3.001_savvy.jpg +0 -0
- package/AISB/image/002_aisb.t3.002_pinet.jpg +0 -0
- package/AISB/image/003_aisb.t3.003_dmsqd.jpg +0 -0
- package/AISB/image/004_aisb.t3.004_decentralattn.jpg +0 -0
- package/AISB/image/005_aisb.t3.005_tsae.jpg +0 -0
- package/AISB/image/006_aisb.t3.006_physense.jpg +0 -0
- package/AISB/image/007_aisb.t3.007_reasoningiqa.jpg +0 -0
- package/AISB/image/008_aisb.t3.008_meanflows.jpg +0 -0
- package/AISB/image/009_aisb.t3.009_scoremissing.jpg +0 -0
- package/AISB/image/010_aisb.t3.010_suitabilityfilter.jpg +0 -0
- package/AISB/image/011_aisb.t3.011_osd.jpg +0 -0
- package/AISB/image/012_aisb.t3.012_efficientqat.jpg +0 -0
- package/AISB/image/013_aisb.t3.013_appl.jpg +0 -0
- package/AISB/image/014_aisb.t3.014_piguard.jpg +0 -0
- package/AISB/image/015_aisb.t3.015_frspec.jpg +0 -0
- package/AISB/image/016_aisb.t3.016_mathfusion.jpg +0 -0
- package/AISB/image/017_aisb.t3.017_multimodalglp.jpg +0 -0
- package/AISB/image/018_aisb.t3.018_cotsynth.jpg +0 -0
- package/AISB/image/019_aisb.t3.019_dyscaleut.jpg +0 -0
- package/AISB/image/020_aisb.t3.020_aristotle.jpg +0 -0
- package/AISB/image/021_aisb.t3.021_tokenrecycling.jpg +0 -0
- package/AISB/image/022_aisb.t3.022_chainofreasoning.jpg +0 -0
- package/AISB/image/023_aisb.t3.023_guidedembed.jpg +0 -0
- package/AISB/image/024_aisb.t3.024_outputcentric.jpg +0 -0
- package/AISB/image/025_aisb.t3.025_deeper.jpg +0 -0
- package/AISB/image/026_aisb.t3.026_gartkg.jpg +0 -0
- package/AISB/image/027_aisb.t3.027_citeeval.jpg +0 -0
- package/AISB/image/028_aisb.t3.028_sbam.jpg +0 -0
- package/AISB/image/029_aisb.t3.029_cdqgeoembed.jpg +0 -0
- package/AISB/image/030_aisb.t3.030_processrm.jpg +0 -0
- package/AISB/image/031_aisb.t3.031_circuitstability.jpg +0 -0
- package/AISB/image/032_aisb.t3.032_ptsolver.jpg +0 -0
- package/AISB/image/033_aisb.t3.033_gcse.jpg +0 -0
- package/AISB/image/034_aisb.t3.034_ensemblewm.jpg +0 -0
- package/AISB/image/035_aisb.t3.035_moralvalueswa.jpg +0 -0
- package/AISB/image/036_aisb.t3.036_weakstrongpref.jpg +0 -0
- package/AISB/image/037_aisb.t3.037_dementiamask.jpg +0 -0
- package/AISB/image/038_aisb.t3.038_tinysam.jpg +0 -0
- package/AISB/image/039_aisb.t3.039_calf.jpg +0 -0
- package/AISB/image/040_aisb.t3.040_graniteguardian.jpg +0 -0
- package/AISB/image/041_aisb.t3.041_amdm.jpg +0 -0
- package/AISB/image/042_aisb.t3.042_xpatch.jpg +0 -0
- package/AISB/image/043_aisb.t3.043_vhm.jpg +0 -0
- package/AISB/image/044_aisb.t3.044_rgvi.jpg +0 -0
- package/AISB/image/045_aisb.t3.045_pslstm.jpg +0 -0
- package/AISB/image/046_aisb.t3.046_nonstatts.jpg +0 -0
- package/AISB/image/047_aisb.t3.047_timepfn.jpg +0 -0
- package/AISB/image/048_aisb.t3.048_proxyspex.jpg +0 -0
- package/AISB/image/049_aisb.t3.049_hogwildinference.jpg +0 -0
- package/AISB/image/050_aisb.t3.050_causalpfn.jpg +0 -0
- package/AISB/image/051_aisb.t3.051_flashtp.jpg +0 -0
- package/AISB/image/052_aisb.t3.052_nsdiff.jpg +0 -0
- package/AISB/image/053_aisb.t3.053_k2vae.jpg +0 -0
- package/AISB/image/054_aisb.t3.054_timebase.jpg +0 -0
- package/AISB/image/055_aisb.t3.055_csbrain.jpg +0 -0
- package/AISB/image/056_aisb.t3.056_infosam.jpg +0 -0
- package/AISB/image/057_aisb.t3.057_mdreid.jpg +0 -0
- package/AISB/image/058_aisb.t3.058_mindglitch.jpg +0 -0
- package/AISB/image/059_aisb.t3.059_selfsupervised.jpg +0 -0
- package/AISB/image/060_aisb.t3.060_iaggad.jpg +0 -0
- package/AISB/image/061_aisb.t3.061_hsgkn.jpg +0 -0
- package/AISB/image/062_aisb.t3.062_visionts.jpg +0 -0
- package/AISB/image/063_aisb.t3.063_tsrag.jpg +0 -0
- package/AISB/image/064_aisb.t3.064_pir.jpg +0 -0
- package/AISB/image/065_aisb.t3.065_proteinbinding.jpg +0 -0
- package/AISB/image/066_aisb.t3.066_tropicalattention.jpg +0 -0
- package/AISB/image/067_aisb.t3.067_kanad.jpg +0 -0
- package/AISB/image/068_aisb.t3.068_sempo.jpg +0 -0
- package/AISB/image/069_aisb.t3.069_treehfd.jpg +0 -0
- package/AISB/image/070_aisb.t3.070_certifiedunlearning.jpg +0 -0
- package/AISB/image/071_aisb.t3.071_neuralmjd.jpg +0 -0
- package/AISB/image/072_aisb.t3.072_fedgmt.jpg +0 -0
- package/AISB/image/073_aisb.t3.073_rld.jpg +0 -0
- package/AISB/image/074_aisb.t3.074_lsvi.jpg +0 -0
- package/AISB/image/075_aisb.t3.075_treeslicedentropy.jpg +0 -0
- package/AISB/image/076_aisb.t3.076_aanet.jpg +0 -0
- package/AISB/image/077_aisb.t3.077_cmnn.jpg +0 -0
- package/AISB/image/078_aisb.t3.078_conformalanomaly.jpg +0 -0
- package/AISB/image/079_aisb.t3.079_dpfkmeans.jpg +0 -0
- package/AISB/image/080_aisb.t3.080_latentscorereweight.jpg +0 -0
- package/AISB/image/081_aisb.t3.081_qmamba.jpg +0 -0
- package/AISB/image/082_aisb.t3.082_onlinellmrouting.jpg +0 -0
- package/AISB/image/083_aisb.t3.083_starformer.jpg +0 -0
- package/AISB/image/084_aisb.t3.084_ift.jpg +0 -0
- package/AISB/image/085_aisb.t3.085_neuralsurv.jpg +0 -0
- package/AISB/image/086_aisb.t3.086_stella.jpg +0 -0
- package/AISB/image/087_aisb.t3.087_moses.jpg +0 -0
- package/AISB/image/088_aisb.t3.088_channelnorm.jpg +0 -0
- package/AISB/image/089_aisb.t3.089_causalvelocity.jpg +0 -0
- package/AISB/image/090_aisb.t3.090_rstib.jpg +0 -0
- package/AISB/image/091_aisb.t3.091_timeawarecausal.jpg +0 -0
- package/AISB/image/092_aisb.t3.092_kmeanslocalopt.jpg +0 -0
- package/AISB/image/093_aisb.t3.093_fedwmsam.jpg +0 -0
- package/AISB/image/094_aisb.t3.094_boundre.jpg +0 -0
- package/AISB/image/095_aisb.t3.095_fastfeaturecp.jpg +0 -0
- package/AISB/image/096_aisb.t3.096_m3svm.jpg +0 -0
- package/AISB/image/097_aisb.t3.097_wassersteintl.jpg +0 -0
- package/AISB/image/098_aisb.t3.098_xmahalanobis.jpg +0 -0
- package/AISB/image/099_aisb.t3.099_ollalanding.jpg +0 -0
- package/AISB/image/100_aisb.t3.100_invmissingdata.jpg +0 -0
- package/AISB/image/101_aisb.t3.101_acia.jpg +0 -0
- package/AISB/image/102_aisb.t3.102_stochasticff.jpg +0 -0
- package/AISB/image/103_aisb.t3.103_qdcp.jpg +0 -0
- package/AISB/image/104_aisb.t3.104_balancedactiveinf.jpg +0 -0
- package/AISB/image/105_aisb.t3.105_binaryclasseval.jpg +0 -0
- package/AISB/image/106_aisb.t1.reasoning_lite.jpg +0 -0
- package/AISB/image/107_aisb.t2.paper_audit.jpg +0 -0
- package/AISB/image/108_aisb.t3.multi_gpu_search.jpg +0 -0
- package/AISB/image/109_aisb.t3.tdc_admet.jpg +0 -0
- package/AISB/image/aisb.b1.agentic_coding.svg +16 -0
- package/AISB/image/aisb.b10.climate_earth.svg +16 -0
- package/AISB/image/aisb.b11.model_efficiency.svg +16 -0
- package/AISB/image/aisb.b12.embodied_ai.svg +16 -0
- package/AISB/image/aisb.b2.agent_systems.svg +16 -0
- package/AISB/image/aisb.b3.self_evolving_rl.svg +16 -0
- package/AISB/image/aisb.b4.lm_reasoning.svg +16 -0
- package/AISB/image/aisb.b5.math_proof.svg +16 -0
- package/AISB/image/aisb.b6.research_process.svg +16 -0
- package/AISB/image/aisb.b7.multimodal_fusion.svg +16 -0
- package/AISB/image/aisb.b8.lifesci_drug.svg +16 -0
- package/AISB/image/aisb.b9.material_science.svg +16 -0
- package/README.md +132 -11
- package/bin/ds.js +376 -49
- package/docs/en/00_QUICK_START.md +135 -18
- package/docs/en/01_SETTINGS_REFERENCE.md +468 -96
- package/docs/en/02_START_RESEARCH_GUIDE.md +26 -5
- package/docs/en/03_QQ_CONNECTOR_GUIDE.md +14 -3
- package/docs/en/04_LINGZHU_CONNECTOR_GUIDE.md +2 -0
- package/docs/en/05_TUI_GUIDE.md +171 -2
- package/docs/en/07_MEMORY_AND_MCP.md +38 -2
- package/docs/en/09_DOCTOR.md +64 -4
- package/docs/en/10_WEIXIN_CONNECTOR_GUIDE.md +38 -1
- package/docs/en/11_LICENSE_AND_RISK.md +4 -0
- package/docs/en/12_GUIDED_WORKFLOW_TOUR.md +15 -0
- package/docs/en/14_PROMPT_SKILLS_AND_MCP_GUIDE.md +9 -0
- package/docs/en/15_CODEX_PROVIDER_SETUP.md +622 -187
- package/docs/en/16_TELEGRAM_CONNECTOR_GUIDE.md +14 -0
- package/docs/en/17_WHATSAPP_CONNECTOR_GUIDE.md +14 -0
- package/docs/en/18_FEISHU_CONNECTOR_GUIDE.md +14 -0
- package/docs/en/21_LOCAL_MODEL_BACKENDS_GUIDE.md +105 -2
- package/docs/en/22_BENCHSTORE_YAML_REFERENCE.md +469 -0
- package/docs/en/23_BENCHSTORE_GITHUB_RELEASES_SPEC.md +316 -0
- package/docs/en/24_CLAUDE_CODE_PROVIDER_SETUP.md +469 -0
- package/docs/en/25_OPENCODE_PROVIDER_SETUP.md +653 -0
- package/docs/en/26_CITATION_AND_ATTRIBUTION.md +119 -0
- package/docs/en/27_KIMI_CODE_PROVIDER_SETUP.md +180 -0
- package/docs/en/28_DISCORD_CONNECTOR_GUIDE.md +61 -0
- package/docs/en/29_SLACK_CONNECTOR_GUIDE.md +60 -0
- package/docs/en/30_SETTINGS_CONTROL_CENTER_GUIDE.md +371 -0
- package/docs/en/{19_LOCAL_BROWSER_AUTH.md → 31_LOCAL_BROWSER_AUTH.md} +1 -1
- package/docs/en/32_WINDOWS_WSL2_DEPLOYMENT_GUIDE.md +273 -0
- package/docs/en/33_WORKSPACE_EXPLORER_QA.md +121 -0
- package/docs/en/91_DEVELOPMENT.md +29 -0
- package/docs/en/99_ACKNOWLEDGEMENTS.md +24 -19
- package/docs/en/README.md +44 -7
- package/docs/images/admin/admin-connectors-health-en.png +0 -0
- package/docs/images/admin/admin-controllers-en.png +0 -0
- package/docs/images/admin/admin-diagnostics-en.png +0 -0
- package/docs/images/admin/admin-errors-en.png +0 -0
- package/docs/images/admin/admin-issues-en.png +0 -0
- package/docs/images/admin/admin-logs-en.png +0 -0
- package/docs/images/admin/admin-quest-detail-en.png +0 -0
- package/docs/images/admin/admin-quests-en.png +0 -0
- package/docs/images/admin/admin-repairs-en.png +0 -0
- package/docs/images/admin/admin-runtime-en.png +0 -0
- package/docs/images/admin/admin-search-en.png +0 -0
- package/docs/images/admin/admin-stats-en.png +0 -0
- package/docs/images/admin/admin-summary-en.png +0 -0
- package/docs/images/connectors/connector-discord-en.png +0 -0
- package/docs/images/connectors/connector-feishu-en.png +0 -0
- package/docs/images/connectors/connector-lingzhu-en.png +0 -0
- package/docs/images/connectors/connector-qq-en.png +0 -0
- package/docs/images/connectors/connector-slack-en.png +0 -0
- package/docs/images/connectors/connector-telegram-en.png +0 -0
- package/docs/images/connectors/connector-weixin-en.png +0 -0
- package/docs/images/connectors/connector-whatsapp-en.png +0 -0
- package/docs/images/settings/settings-baselines-en.png +0 -0
- package/docs/images/settings/settings-config-en.png +0 -0
- package/docs/images/settings/settings-connectors-overview-en.png +0 -0
- package/docs/images/settings/settings-deepxiv-en.png +0 -0
- package/docs/images/settings/settings-mcp-servers-en.png +0 -0
- package/docs/images/settings/settings-plugins-en.png +0 -0
- package/docs/images/settings/settings-runners-en.png +0 -0
- package/docs/zh/00_QUICK_START.md +92 -17
- package/docs/zh/01_SETTINGS_REFERENCE.md +219 -98
- package/docs/zh/02_START_RESEARCH_GUIDE.md +26 -5
- package/docs/zh/05_TUI_GUIDE.md +171 -2
- package/docs/zh/07_MEMORY_AND_MCP.md +29 -2
- package/docs/zh/09_DOCTOR.md +39 -4
- package/docs/zh/10_WEIXIN_CONNECTOR_GUIDE.md +24 -1
- package/docs/zh/11_LICENSE_AND_RISK.md +4 -0
- package/docs/zh/12_GUIDED_WORKFLOW_TOUR.md +15 -0
- package/docs/zh/14_PROMPT_SKILLS_AND_MCP_GUIDE.md +9 -0
- package/docs/zh/15_CODEX_PROVIDER_SETUP.md +550 -188
- package/docs/zh/21_LOCAL_MODEL_BACKENDS_GUIDE.md +105 -2
- package/docs/zh/22_BENCHSTORE_YAML_REFERENCE.md +459 -0
- package/docs/zh/23_BENCHSTORE_GITHUB_RELEASES_SPEC.md +287 -0
- package/docs/zh/23_CLAUDE_RUNNER_GUIDE.md +103 -0
- package/docs/zh/24_CLAUDE_CODE_PROVIDER_SETUP.md +460 -0
- package/docs/zh/25_OPENCODE_PROVIDER_SETUP.md +660 -0
- package/docs/zh/26_CITATION_AND_ATTRIBUTION.md +102 -0
- package/docs/zh/27_KIMI_CODE_PROVIDER_SETUP.md +51 -0
- package/docs/zh/{19_LOCAL_BROWSER_AUTH.md → 31_LOCAL_BROWSER_AUTH.md} +1 -1
- package/docs/zh/32_WINDOWS_WSL2_DEPLOYMENT_GUIDE.md +264 -0
- package/docs/zh/33_WORKSPACE_EXPLORER_QA.md +127 -0
- package/docs/zh/99_ACKNOWLEDGEMENTS.md +23 -19
- package/docs/zh/README.md +29 -7
- package/install.sh +122 -16
- package/package.json +4 -1
- package/pyproject.toml +2 -1
- package/src/deepscientist/__init__.py +1 -1
- package/src/deepscientist/acp/envelope.py +13 -0
- package/src/deepscientist/admin/__init__.py +3 -0
- package/src/deepscientist/admin/charts.py +681 -0
- package/src/deepscientist/admin/logs.py +119 -0
- package/src/deepscientist/admin/repairs.py +217 -0
- package/src/deepscientist/admin/service.py +1310 -0
- package/src/deepscientist/admin/system_info.py +700 -0
- package/src/deepscientist/admin/tasks.py +465 -0
- package/src/deepscientist/admin/tool_metrics.py +600 -0
- package/src/deepscientist/artifact/guidance.py +8 -4
- package/src/deepscientist/artifact/schemas.py +115 -0
- package/src/deepscientist/artifact/service.py +4268 -260
- package/src/deepscientist/bash_exec/monitor.py +30 -3
- package/src/deepscientist/bash_exec/service.py +134 -1
- package/src/deepscientist/benchstore/__init__.py +4 -0
- package/src/deepscientist/benchstore/prompt_builder.py +224 -0
- package/src/deepscientist/benchstore/service.py +1716 -0
- package/src/deepscientist/channels/weixin_ilink.py +8 -1
- package/src/deepscientist/cli.py +92 -17
- package/src/deepscientist/codex_cli_compat.py +2 -2
- package/src/deepscientist/config/models.py +82 -11
- package/src/deepscientist/config/service.py +927 -91
- package/src/deepscientist/connector/weixin_support.py +48 -17
- package/src/deepscientist/daemon/api/handlers.py +697 -210
- package/src/deepscientist/daemon/api/router.py +76 -1
- package/src/deepscientist/daemon/app.py +1054 -51
- package/src/deepscientist/diagnostics/runner_failures.py +147 -0
- package/src/deepscientist/doctor.py +212 -65
- package/src/deepscientist/evidence_packets.py +590 -0
- package/src/deepscientist/home.py +52 -4
- package/src/deepscientist/kimi_cli_compat.py +50 -0
- package/src/deepscientist/latex_runtime.py +2 -2
- package/src/deepscientist/mcp/context.py +2 -0
- package/src/deepscientist/mcp/schemas.py +114 -0
- package/src/deepscientist/mcp/server.py +1566 -126
- package/src/deepscientist/memory/service.py +203 -16
- package/src/deepscientist/process_control.py +8 -1
- package/src/deepscientist/prompts/builder.py +836 -92
- package/src/deepscientist/quest/__init__.py +2 -2
- package/src/deepscientist/quest/layout.py +12 -1
- package/src/deepscientist/quest/node_traces.py +10 -0
- package/src/deepscientist/quest/service.py +1430 -139
- package/src/deepscientist/quest/stage_views.py +1 -1
- package/src/deepscientist/runners/__init__.py +18 -0
- package/src/deepscientist/runners/base.py +89 -1
- package/src/deepscientist/runners/builtins.py +13 -1
- package/src/deepscientist/runners/claude.py +391 -0
- package/src/deepscientist/runners/codex.py +421 -21
- package/src/deepscientist/runners/codex_telemetry.py +127 -0
- package/src/deepscientist/runners/kimi.py +334 -0
- package/src/deepscientist/runners/metadata.py +68 -0
- package/src/deepscientist/runners/opencode.py +414 -0
- package/src/deepscientist/runners/runtime_overrides.py +100 -0
- package/src/deepscientist/runners/simple_cli.py +538 -0
- package/src/deepscientist/runtime_storage.py +303 -0
- package/src/deepscientist/shared.py +61 -16
- package/src/deepscientist/skills/installer.py +37 -0
- package/src/deepscientist/skills/registry.py +2 -0
- package/src/deepscientist/tinytex.py +2 -2
- package/src/deepscientist/tui.py +10 -3
- package/src/prompts/benchstore/system.md +77 -0
- package/src/prompts/connectors/qq.md +33 -2
- package/src/prompts/connectors/weixin.md +208 -23
- package/src/prompts/contracts/admin_ops.md +74 -0
- package/src/prompts/contracts/admin_ops_knowledge.md +138 -0
- package/src/prompts/contracts/shared_interaction.md +5 -11
- package/src/prompts/start_setup/system.md +422 -0
- package/src/prompts/system.md +409 -315
- package/src/prompts/system_copilot.md +88 -12
- package/src/skills/analysis-campaign/SKILL.md +239 -578
- package/src/skills/analysis-campaign/references/artifact-flow-examples.md +102 -0
- package/src/skills/analysis-campaign/references/boundary-cases.md +98 -0
- package/src/skills/analysis-campaign/references/campaign-checklist-template.md +39 -24
- package/src/skills/analysis-campaign/references/campaign-design.md +26 -10
- package/src/skills/analysis-campaign/references/campaign-plan-template.md +53 -54
- package/src/skills/analysis-campaign/references/operational-guidance.md +97 -0
- package/src/skills/analysis-campaign/references/writing-facing-slice-examples.md +10 -20
- package/src/skills/baseline/SKILL.md +183 -461
- package/src/skills/baseline/references/artifact-flow-examples.md +106 -0
- package/src/skills/baseline/references/artifact-payload-examples.md +1 -1
- package/src/skills/baseline/references/baseline-checklist-template.md +27 -35
- package/src/skills/baseline/references/baseline-plan-template.md +37 -76
- package/src/skills/baseline/references/boundary-cases.md +86 -0
- package/src/skills/baseline/references/codebase-audit-checklist.md +2 -6
- package/src/skills/baseline/references/comparability-contract.md +7 -12
- package/src/skills/baseline/references/operational-guidance.md +56 -0
- package/src/skills/baseline/references/route-selection.md +5 -25
- package/src/skills/decision/SKILL.md +113 -306
- package/src/skills/decision/references/checkpoint-memory-template.md +47 -0
- package/src/skills/decision/references/operational-guidance.md +94 -0
- package/src/skills/decision/references/research-route-criteria.md +7 -8
- package/src/skills/decision/references/strategic-decision-template.md +13 -26
- package/src/skills/experiment/SKILL.md +132 -670
- package/src/skills/experiment/references/execution-playbook.md +374 -0
- package/src/skills/experiment/references/main-experiment-checklist-template.md +26 -2
- package/src/skills/experiment/references/main-experiment-plan-template.md +28 -17
- package/src/skills/experiment/references/operational-guidance.md +108 -0
- package/src/skills/finalize/SKILL.md +62 -0
- package/src/skills/finalize/references/checkpoint-memory-template.md +49 -0
- package/src/skills/finalize/references/resume-packet-template.md +7 -0
- package/src/skills/idea/SKILL.md +228 -15
- package/src/skills/idea/references/controlled-brainstorming-playbook.md +78 -0
- package/src/skills/idea/references/current-board-packet-template.md +61 -0
- package/src/skills/idea/references/high-value-idea-sourcing.md +119 -0
- package/src/skills/idea/references/idea-generation-playbook.md +21 -0
- package/src/skills/idea/references/idea-thinking-flow.md +6 -0
- package/src/skills/idea/references/literature-survey-template.md +3 -0
- package/src/skills/idea/references/objective-contract-template.md +54 -0
- package/src/skills/idea/references/outline-seeding-example.md +56 -0
- package/src/skills/idea/references/pre-idea-draft-template.md +105 -0
- package/src/skills/idea/references/related-work-playbook.md +75 -2
- package/src/skills/idea/references/research-history-playbook.md +114 -0
- package/src/skills/idea/references/selection-gate.md +58 -6
- package/src/skills/intake-audit/SKILL.md +43 -2
- package/src/skills/intake-audit/references/state-audit-template.md +10 -0
- package/src/skills/nature-data/SKILL.md +128 -0
- package/src/skills/nature-data/UPSTREAM_LICENSE.txt +21 -0
- package/src/skills/nature-data/agents/openai.yaml +4 -0
- package/src/skills/nature-data/references/chinese-author-alignment.md +84 -0
- package/src/skills/nature-data/references/fair-metadata-checklist.md +105 -0
- package/src/skills/nature-data/references/policy-principles.md +103 -0
- package/src/skills/nature-data/references/repository-and-identifiers.md +96 -0
- package/src/skills/nature-data/references/source-basis.md +54 -0
- package/src/skills/nature-data/references/statement-patterns.md +153 -0
- package/src/skills/nature-figure/SKILL.md +197 -0
- package/src/skills/nature-figure/UPSTREAM_LICENSE.txt +21 -0
- package/src/skills/nature-figure/agents/openai.yaml +4 -0
- package/src/skills/nature-figure/evals/evals.json +37 -0
- package/src/skills/nature-figure/references/api.md +428 -0
- package/src/skills/nature-figure/references/backend-selection.md +100 -0
- package/src/skills/nature-figure/references/chart-types.md +281 -0
- package/src/skills/nature-figure/references/common-patterns.md +349 -0
- package/src/skills/nature-figure/references/design-theory.md +436 -0
- package/src/skills/nature-figure/references/figure-contract.md +93 -0
- package/src/skills/nature-figure/references/nature-2026-observations.md +112 -0
- package/src/skills/nature-figure/references/qa-contract.md +119 -0
- package/src/skills/nature-figure/references/r-template-index.md +66 -0
- package/src/skills/nature-figure/references/r-workflow.md +161 -0
- package/src/skills/nature-figure/references/tutorials.md +250 -0
- package/src/skills/nature-paper2ppt/SKILL.md +507 -0
- package/src/skills/nature-paper2ppt/UPSTREAM_LICENSE.txt +21 -0
- package/src/skills/nature-paper2ppt/agents/openai.yaml +4 -0
- package/src/skills/nature-polishing/SKILL.md +385 -0
- package/src/skills/nature-polishing/UPSTREAM_LICENSE.txt +21 -0
- package/src/skills/nature-polishing/agents/openai.yaml +4 -0
- package/src/skills/nature-polishing/references/phrasebank-playbook.md +162 -0
- package/src/skills/nature-polishing/references/section-moves.md +240 -0
- package/src/skills/nature-polishing/references/style-guardrails.md +94 -0
- package/src/skills/nature-polishing/references/writing-strategy.md +148 -0
- package/src/skills/optimize/SKILL.md +177 -1568
- package/src/skills/optimize/references/brief-shaping-playbook.md +95 -0
- package/src/skills/optimize/references/candidate-board-template.md +13 -0
- package/src/skills/optimize/references/candidate-ranking-template.md +51 -0
- package/src/skills/optimize/references/codegen-route-playbook.md +50 -0
- package/src/skills/optimize/references/debug-response-template.md +29 -0
- package/src/skills/optimize/references/frontier-review-template.md +32 -0
- package/src/skills/optimize/references/fusion-playbook.md +36 -0
- package/src/skills/optimize/references/method-brief-template.md +73 -0
- package/src/skills/optimize/references/operational-guidance.md +621 -0
- package/src/skills/optimize/references/optimization-memory-template.md +30 -0
- package/src/skills/optimize/references/optimize-checklist-template.md +18 -0
- package/src/skills/optimize/references/plateau-response-playbook.md +28 -0
- package/src/skills/optimize/references/prompt-patterns.md +49 -0
- package/src/skills/paper-outline/SKILL.md +227 -0
- package/src/skills/paper-outline/references/outline-patterns.md +87 -0
- package/src/skills/paper-plot/SKILL.md +79 -0
- package/src/skills/paper-plot/agents/openai.yaml +4 -0
- package/src/skills/paper-plot/references/bar_grouped_hatch.md +96 -0
- package/src/skills/paper-plot/references/bar_paired_delta.md +72 -0
- package/src/skills/paper-plot/references/line_confidence_band.md +75 -0
- package/src/skills/paper-plot/references/line_loss_with_inset.md +65 -0
- package/src/skills/paper-plot/references/line_training_curve.md +44 -0
- package/src/skills/paper-plot/references/radar_dual_series.md +59 -0
- package/src/skills/paper-plot/references/scatter_broken_axis.md +59 -0
- package/src/skills/paper-plot/references/scatter_tsne_cluster.md +72 -0
- package/src/skills/paper-plot/scripts/bar_memevolve.py +109 -0
- package/src/skills/paper-plot/scripts/bar_spice.py +166 -0
- package/src/skills/paper-plot/scripts/line_aime.py +94 -0
- package/src/skills/paper-plot/scripts/line_loss_inset.py +157 -0
- package/src/skills/paper-plot/scripts/line_selfdistill.py +168 -0
- package/src/skills/paper-plot/scripts/radar_dora.py +151 -0
- package/src/skills/paper-plot/scripts/scatter_break.py +169 -0
- package/src/skills/paper-plot/scripts/scatter_tsne.py +133 -0
- package/src/skills/rebuttal/SKILL.md +9 -0
- package/src/skills/references/tool-usage-by-stage.md +438 -0
- package/src/skills/review/SKILL.md +105 -7
- package/src/skills/science/PROVENANCE.md +44 -0
- package/src/skills/science/SKILL.md +137 -0
- package/src/skills/science/references/artifact-science-tool.md +110 -0
- package/src/skills/science/references/claim-type-discipline.md +56 -0
- package/src/skills/science/references/domain-index.md +422 -0
- package/src/skills/science/references/hpc-via-bash-exec.md +42 -0
- package/src/skills/science/references/package-check-playbook.md +64 -0
- package/src/skills/science/references/package-index.min.json +3616 -0
- package/src/skills/science/references/packages/abinit.md +80 -0
- package/src/skills/science/references/packages/acts.md +73 -0
- package/src/skills/science/references/packages/aiida-core.md +80 -0
- package/src/skills/science/references/packages/alamode.md +80 -0
- package/src/skills/science/references/packages/amuse.md +88 -0
- package/src/skills/science/references/packages/anndata.md +88 -0
- package/src/skills/science/references/packages/arbor.md +80 -0
- package/src/skills/science/references/packages/arc.md +73 -0
- package/src/skills/science/references/packages/astropy.md +88 -0
- package/src/skills/science/references/packages/astroquery.md +88 -0
- package/src/skills/science/references/packages/atomate2.md +80 -0
- package/src/skills/science/references/packages/atomsmltr.md +73 -0
- package/src/skills/science/references/packages/awkward.md +73 -0
- package/src/skills/science/references/packages/batman.md +88 -0
- package/src/skills/science/references/packages/biopython.md +88 -0
- package/src/skills/science/references/packages/bloqade.md +73 -0
- package/src/skills/science/references/packages/brian2.md +73 -0
- package/src/skills/science/references/packages/bullet3.md +73 -0
- package/src/skills/science/references/packages/calculix.md +80 -0
- package/src/skills/science/references/packages/cantera.md +73 -0
- package/src/skills/science/references/packages/cavity-md-ipi.md +80 -0
- package/src/skills/science/references/packages/ccdproc.md +88 -0
- package/src/skills/science/references/packages/celerite2.md +88 -0
- package/src/skills/science/references/packages/cellrank.md +73 -0
- package/src/skills/science/references/packages/cesm.md +80 -0
- package/src/skills/science/references/packages/chemicals.md +73 -0
- package/src/skills/science/references/packages/chempy.md +73 -0
- package/src/skills/science/references/packages/cirq.md +73 -0
- package/src/skills/science/references/packages/coffea.md +73 -0
- package/src/skills/science/references/packages/cp2k.md +88 -0
- package/src/skills/science/references/packages/custodian.md +80 -0
- package/src/skills/science/references/packages/dart.md +73 -0
- package/src/skills/science/references/packages/datamol.md +88 -0
- package/src/skills/science/references/packages/dd4hep.md +73 -0
- package/src/skills/science/references/packages/dealii.md +80 -0
- package/src/skills/science/references/packages/deepchem.md +88 -0
- package/src/skills/science/references/packages/delphes.md +73 -0
- package/src/skills/science/references/packages/devito.md +80 -0
- package/src/skills/science/references/packages/dftb.md +88 -0
- package/src/skills/science/references/packages/dftd4.md +88 -0
- package/src/skills/science/references/packages/dftk-jl.md +80 -0
- package/src/skills/science/references/packages/dolfinx.md +80 -0
- package/src/skills/science/references/packages/drake.md +73 -0
- package/src/skills/science/references/packages/dumux.md +73 -0
- package/src/skills/science/references/packages/elk.md +80 -0
- package/src/skills/science/references/packages/elmerfem.md +80 -0
- package/src/skills/science/references/packages/enzo-e.md +88 -0
- package/src/skills/science/references/packages/espresso.md +80 -0
- package/src/skills/science/references/packages/exoplanet.md +88 -0
- package/src/skills/science/references/packages/fairroot.md +73 -0
- package/src/skills/science/references/packages/fbpic.md +80 -0
- package/src/skills/science/references/packages/fdtdbath-meep.md +80 -0
- package/src/skills/science/references/packages/geant4.md +73 -0
- package/src/skills/science/references/packages/geosx.md +80 -0
- package/src/skills/science/references/packages/gprmax.md +80 -0
- package/src/skills/science/references/packages/gromacs.md +80 -0
- package/src/skills/science/references/packages/gwaslab.md +73 -0
- package/src/skills/science/references/packages/gz-sim.md +73 -0
- package/src/skills/science/references/packages/hail.md +88 -0
- package/src/skills/science/references/packages/hiphive.md +80 -0
- package/src/skills/science/references/packages/hoomd-blue.md +80 -0
- package/src/skills/science/references/packages/itensor.md +73 -0
- package/src/skills/science/references/packages/itensors-jl.md +73 -0
- package/src/skills/science/references/packages/jdftx.md +73 -0
- package/src/skills/science/references/packages/jobflow.md +80 -0
- package/src/skills/science/references/packages/kadanoffbaym-jl.md +73 -0
- package/src/skills/science/references/packages/kite.md +80 -0
- package/src/skills/science/references/packages/kratos.md +80 -0
- package/src/skills/science/references/packages/kwant.md +73 -0
- package/src/skills/science/references/packages/lammps.md +80 -0
- package/src/skills/science/references/packages/lightkurve.md +88 -0
- package/src/skills/science/references/packages/limix.md +73 -0
- package/src/skills/science/references/packages/maxwelllink.md +80 -0
- package/src/skills/science/references/packages/mcdc.md +73 -0
- package/src/skills/science/references/packages/meep.md +80 -0
- package/src/skills/science/references/packages/mfem.md +80 -0
- package/src/skills/science/references/packages/mitgcm.md +73 -0
- package/src/skills/science/references/packages/modflow6.md +73 -0
- package/src/skills/science/references/packages/molecool.md +73 -0
- package/src/skills/science/references/packages/mom6.md +73 -0
- package/src/skills/science/references/packages/moose.md +80 -0
- package/src/skills/science/references/packages/mpas-model.md +73 -0
- package/src/skills/science/references/packages/mujoco.md +73 -0
- package/src/skills/science/references/packages/mumax3.md +73 -0
- package/src/skills/science/references/packages/nekrs.md +80 -0
- package/src/skills/science/references/packages/nessi.md +73 -0
- package/src/skills/science/references/packages/nest-simulator.md +73 -0
- package/src/skills/science/references/packages/netket.md +73 -0
- package/src/skills/science/references/packages/neuron.md +73 -0
- package/src/skills/science/references/packages/nextflow.md +88 -0
- package/src/skills/science/references/packages/nwchem.md +88 -0
- package/src/skills/science/references/packages/openbabel.md +88 -0
- package/src/skills/science/references/packages/openems.md +80 -0
- package/src/skills/science/references/packages/openff-toolkit.md +88 -0
- package/src/skills/science/references/packages/openfoam-dev.md +80 -0
- package/src/skills/science/references/packages/openmc.md +73 -0
- package/src/skills/science/references/packages/openmm.md +80 -0
- package/src/skills/science/references/packages/openmoc.md +73 -0
- package/src/skills/science/references/packages/openmx.md +80 -0
- package/src/skills/science/references/packages/opensees.md +80 -0
- package/src/skills/science/references/packages/opensn.md +80 -0
- package/src/skills/science/references/packages/opm-simulators.md +73 -0
- package/src/skills/science/references/packages/oqupy.md +73 -0
- package/src/skills/science/references/packages/packmol.md +80 -0
- package/src/skills/science/references/packages/palabos.md +80 -0
- package/src/skills/science/references/packages/parflow.md +80 -0
- package/src/skills/science/references/packages/pennylane.md +88 -0
- package/src/skills/science/references/packages/perceval.md +73 -0
- package/src/skills/science/references/packages/phono3py.md +73 -0
- package/src/skills/science/references/packages/phonopy.md +73 -0
- package/src/skills/science/references/packages/photutils.md +88 -0
- package/src/skills/science/references/packages/picongpu.md +80 -0
- package/src/skills/science/references/packages/plink-ng.md +88 -0
- package/src/skills/science/references/packages/precice.md +73 -0
- package/src/skills/science/references/packages/psc.md +80 -0
- package/src/skills/science/references/packages/psi4.md +88 -0
- package/src/skills/science/references/packages/pybinding.md +73 -0
- package/src/skills/science/references/packages/pyfr.md +80 -0
- package/src/skills/science/references/packages/pyhf.md +73 -0
- package/src/skills/science/references/packages/pyiron_base.md +80 -0
- package/src/skills/science/references/packages/pylcp.md +73 -0
- package/src/skills/science/references/packages/pylith.md +80 -0
- package/src/skills/science/references/packages/pynbody.md +88 -0
- package/src/skills/science/references/packages/pysam.md +88 -0
- package/src/skills/science/references/packages/pyscf.md +88 -0
- package/src/skills/science/references/packages/q-e.md +73 -0
- package/src/skills/science/references/packages/qibo.md +73 -0
- package/src/skills/science/references/packages/qiskit.md +73 -0
- package/src/skills/science/references/packages/quantica-jl.md +73 -0
- package/src/skills/science/references/packages/quantumoptics-jl.md +73 -0
- package/src/skills/science/references/packages/quimb.md +73 -0
- package/src/skills/science/references/packages/qulacs.md +73 -0
- package/src/skills/science/references/packages/qutip.md +73 -0
- package/src/skills/science/references/packages/rdkit.md +88 -0
- package/src/skills/science/references/packages/rmg-py.md +73 -0
- package/src/skills/science/references/packages/root.md +73 -0
- package/src/skills/science/references/packages/scanpy.md +88 -0
- package/src/skills/science/references/packages/scikit-allel.md +88 -0
- package/src/skills/science/references/packages/scikit-bio.md +88 -0
- package/src/skills/science/references/packages/scqubits.md +73 -0
- package/src/skills/science/references/packages/scuff-em.md +80 -0
- package/src/skills/science/references/packages/scvi-tools.md +73 -0
- package/src/skills/science/references/packages/seissol.md +73 -0
- package/src/skills/science/references/packages/sfepy.md +80 -0
- package/src/skills/science/references/packages/sisl.md +73 -0
- package/src/skills/science/references/packages/smilei.md +80 -0
- package/src/skills/science/references/packages/snakemake.md +88 -0
- package/src/skills/science/references/packages/specfem3d-globe.md +80 -0
- package/src/skills/science/references/packages/specutils.md +88 -0
- package/src/skills/science/references/packages/spglib.md +80 -0
- package/src/skills/science/references/packages/squidpy.md +88 -0
- package/src/skills/science/references/packages/starry.md +88 -0
- package/src/skills/science/references/packages/strawberryfields.md +73 -0
- package/src/skills/science/references/packages/su2.md +80 -0
- package/src/skills/science/references/packages/sunny-jl.md +73 -0
- package/src/skills/science/references/packages/sw4.md +73 -0
- package/src/skills/science/references/packages/swift.md +88 -0
- package/src/skills/science/references/packages/tdnegf.md +73 -0
- package/src/skills/science/references/packages/tenpy.md +73 -0
- package/src/skills/science/references/packages/thermo.md +73 -0
- package/src/skills/science/references/packages/tkwant.md +73 -0
- package/src/skills/science/references/packages/tvb-root.md +73 -0
- package/src/skills/science/references/packages/uproot5.md +73 -0
- package/src/skills/science/references/packages/vampire.md +80 -0
- package/src/skills/science/references/packages/wannier_tools.md +73 -0
- package/src/skills/science/references/packages/warpx.md +80 -0
- package/src/skills/science/references/packages/wrf.md +73 -0
- package/src/skills/science/references/packages/xtb.md +88 -0
- package/src/skills/science/references/packages/yt.md +73 -0
- package/src/skills/science/references/science-task-brief-template.md +71 -0
- package/src/skills/scout/SKILL.md +83 -425
- package/src/skills/scout/references/literature-scout-template.md +5 -24
- package/src/skills/scout/references/operational-guidance.md +191 -0
- package/src/skills/scout/references/paper-triage-playbook.md +11 -35
- package/src/skills/write/SKILL.md +744 -1246
- package/src/skills/write/references/experiments_analysis_patterns.md +129 -0
- package/src/skills/write/references/oral_package_patterns.md +252 -0
- package/src/skills/write/references/oral_writing_principles.md +291 -0
- package/src/skills/write/references/section_rewrite_checklist.md +234 -0
- package/src/tui/dist/app/AppContainer.js +1314 -27
- package/src/tui/dist/components/Composer.js +26 -1
- package/src/tui/dist/components/ConfigScreen.js +2 -1
- package/src/tui/dist/components/InputPrompt.js +25 -9
- package/src/tui/dist/components/MainContent.js +18 -3
- package/src/tui/dist/components/QuestScreen.js +3 -2
- package/src/tui/dist/components/UtilityScreen.js +37 -0
- package/src/tui/dist/hooks/useSafeInput.js +10 -0
- package/src/tui/dist/index.js +13 -1
- package/src/tui/dist/layouts/DefaultAppLayout.js +11 -8
- package/src/tui/dist/lib/api.js +89 -1
- package/src/tui/package.json +1 -1
- package/src/ui/dist/assets/{AnalysisPlugin-BCKAfjba.js → AnalysisPlugin-CA94NGmI.js} +1 -1
- package/src/ui/dist/assets/CliPlugin-DHBzphZU.js +79 -0
- package/src/ui/dist/assets/CodeEditorPlugin-BOFwD2rn.js +2 -0
- package/src/ui/dist/assets/{CodeViewerPlugin-CbaFRrUU.js → CodeViewerPlugin-CqDpgjik.js} +4 -4
- package/src/ui/dist/assets/{DocViewerPlugin-DAjLVeQD.js → DocViewerPlugin-UDBgt8-4.js} +3 -3
- package/src/ui/dist/assets/GitCommitViewerPlugin-BmHtZ0bZ.js +6 -0
- package/src/ui/dist/assets/{GitDiffViewerPlugin-CQACjoAA.js → GitDiffViewerPlugin-CAxjNorQ.js} +2 -2
- package/src/ui/dist/assets/{GitSnapshotViewer-0r4nLPke.js → GitSnapshotViewer-CweA6VON.js} +2 -2
- package/src/ui/dist/assets/{ImageViewerPlugin-nBOmI2v_.js → ImageViewerPlugin-C8wHGvGN.js} +5 -5
- package/src/ui/dist/assets/LabPlugin-COyyLUol.js +32 -0
- package/src/ui/dist/assets/{LatexPlugin-ZwtV8pIp.js → LatexPlugin-BQjAaA5J.js} +4 -4
- package/src/ui/dist/assets/{MarkdownViewerPlugin-DKqVfKyW.js → MarkdownViewerPlugin-Dy1NE2dI.js} +3 -3
- package/src/ui/dist/assets/{MarketplacePlugin-BwxStZ9D.js → MarketplacePlugin-DMIZtEJ2.js} +2 -2
- package/src/ui/dist/assets/NotebookEditor-CFHMq_Qt.js +91 -0
- package/src/ui/dist/assets/{NotebookEditor-DB9N_T9q.js → NotebookEditor-WFyd8Ybt.js} +3 -3
- package/src/ui/dist/assets/{PdfLoader-eWBONbQP.js → PdfLoader-CLE5u5TS.js} +3 -3
- package/src/ui/dist/assets/{PdfMarkdownPlugin-D22YOZL3.js → PdfMarkdownPlugin-_iNK_H83.js} +1 -1
- package/src/ui/dist/assets/PdfViewerPlugin-DgWsbInT.js +22 -0
- package/src/ui/dist/assets/SearchPlugin-DrZmn5iw.js +11 -0
- package/src/ui/dist/assets/{TextViewerPlugin-C5xqeeUH.js → TextViewerPlugin-D1-T3aC7.js} +4 -4
- package/src/ui/dist/assets/branding/runner-claude.svg +107 -0
- package/src/ui/dist/assets/branding/runner-codex.svg +10 -0
- package/src/ui/dist/assets/branding/runner-kimi.svg +14 -0
- package/src/ui/dist/assets/branding/runner-opencode.svg +7 -0
- package/src/ui/dist/assets/cli-store-CoZ-x5Ip.js +1 -0
- package/src/ui/dist/assets/{code-WlFHE7z_.js → code-DbsmSd3Y.js} +1 -1
- package/src/ui/dist/assets/file-diff-panel-DsvyRz47.js +1 -0
- package/src/ui/dist/assets/{wrap-text-BC-Hltpd.js → file-jump-queue-DeQBikaw.js} +3 -3
- package/src/ui/dist/assets/{file-socket-CfQPKQKj.js → file-socket-DA5XIx88.js} +1 -1
- package/src/ui/dist/assets/fonts/ds-fonts.css +50 -4
- package/src/ui/dist/assets/images/deepxiv/register-guide.png +0 -0
- package/src/ui/dist/assets/index-39vY9LmZ.js +1 -0
- package/src/ui/dist/assets/{index-CwNu1aH4.js → index-BsO46tJA.js} +1 -1
- package/src/ui/dist/assets/index-CHzJ2xtB.js +3530 -0
- package/src/ui/dist/assets/index-DH-zxoZ3.css +33 -0
- package/src/ui/dist/assets/{plugin-notebook-HbW2K-1c.js → plugin-notebook-JRhysCqj.js} +2 -2
- package/src/ui/dist/assets/{project-sync-C9IdzdZW.js → project-sync-DPmWKmKD.js} +1 -1
- package/src/ui/dist/assets/{zoom-out-E_gaeAxL.js → zoom-out-DAukFWen.js} +3 -3
- package/src/ui/dist/index.html +3 -3
- package/src/skills/analysis-campaign/references/artifact-orchestration.md +0 -58
- package/src/skills/baseline/references/memory-playbook.md +0 -40
- package/src/skills/baseline/references/publishable-baseline-package.md +0 -30
- package/src/skills/write/references/outline-evidence-contract-example.md +0 -107
- package/src/skills/write/references/paper-experiment-matrix-template.md +0 -131
- package/src/skills/write/references/paper-section-playbook.md +0 -64
- package/src/skills/write/references/reviewer-first-writing.md +0 -64
- package/src/skills/write/references/revision-checklist.md +0 -70
- package/src/skills/write/references/section-contracts.md +0 -82
- package/src/skills/write/references/sentence-level-proofing.md +0 -49
- package/src/ui/dist/assets/AiManusChatView-Bv-Z8YpU.js +0 -204
- package/src/ui/dist/assets/CliPlugin-BCKcpc35.js +0 -109
- package/src/ui/dist/assets/CodeEditorPlugin-DbOfSJ8K.js +0 -2
- package/src/ui/dist/assets/GitCommitViewerPlugin-CIUqbUDO.js +0 -1
- package/src/ui/dist/assets/LabCopilotPanel-BHxOxF4z.js +0 -14
- package/src/ui/dist/assets/LabPlugin-BKoZGs95.js +0 -22
- package/src/ui/dist/assets/NotebookEditor-BEQhaQbt.js +0 -81
- package/src/ui/dist/assets/PdfViewerPlugin-c-RK9DLM.js +0 -17
- package/src/ui/dist/assets/SearchPlugin-CxF9ytAx.js +0 -16
- package/src/ui/dist/assets/VNCViewer-BoLGLnHz.js +0 -11
- package/src/ui/dist/assets/bot-DREQOxzP.js +0 -6
- package/src/ui/dist/assets/chevron-up-C9Qpx4DE.js +0 -6
- package/src/ui/dist/assets/file-content-BZMz3RYp.js +0 -1
- package/src/ui/dist/assets/file-diff-panel-CQhw0jS2.js +0 -1
- package/src/ui/dist/assets/file-jump-queue-DA-SdG__.js +0 -1
- package/src/ui/dist/assets/git-commit-horizontal-DxZ8DCZh.js +0 -6
- package/src/ui/dist/assets/image-Bgl4VIyx.js +0 -6
- package/src/ui/dist/assets/index-BpV6lusQ.css +0 -33
- package/src/ui/dist/assets/index-CBNVuWcP.js +0 -2496
- package/src/ui/dist/assets/index-DrUnlf6K.js +0 -1
- package/src/ui/dist/assets/index-NW-h8VzN.js +0 -1
- package/src/ui/dist/assets/pdf-effect-queue-J8OnM0jE.js +0 -6
- package/src/ui/dist/assets/popover-CLc0pPP8.js +0 -1
- package/src/ui/dist/assets/select-Cs2PmzwL.js +0 -11
- package/src/ui/dist/assets/sigma-ClKcHAXm.js +0 -6
- package/src/ui/dist/assets/trash-DwpbFr3w.js +0 -11
- package/src/ui/dist/assets/useCliAccess-NQ8m0Let.js +0 -1
- package/src/ui/dist/assets/useFileDiffOverlay-FuhcnKiw.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/plugin-monaco-C8UgLomw.js","assets/plugin-terminal-MXFIPun8.js","assets/plugin-notebook-
|
|
2
|
-
import{
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/plugin-monaco-C8UgLomw.js","assets/plugin-terminal-MXFIPun8.js","assets/plugin-notebook-JRhysCqj.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as ur,q as fr,u as mr,a as nt,J as br,s as hr,K as st,N as xr,O as gr,P as pr,Q as Ee,_ as lt,U as wr,V as vr,W as kr,j as n,b as P,f as yr,Y as _r,L as ge,Z as Nr,$ as jr,T as Et,a0 as Sr,a1 as Lr,a2 as Cr,a3 as Ar,a4 as Ir}from"./index-CHzJ2xtB.js";import{r as s}from"./plugin-monaco-C8UgLomw.js";import{P as Rr}from"./project-sync-DPmWKmKD.js";import{c as Er}from"./monaco-CiHMMNH_.js";import{P as ot,a as Pr,b as Fr,c as Mr,Z as D,d as Br}from"./PdfLoader-CLE5u5TS.js";import{Z as $r,a as Tr}from"./zoom-out-DAukFWen.js";import"./plugin-notebook-JRhysCqj.js";import"./plugin-terminal-MXFIPun8.js";import"./plugin-pdf-CR8hgQBV.js";/**
|
|
3
3
|
* @license lucide-react v0.511.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
6
6
|
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const Or=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],Ur=ur("at-sign",Or),Dr=Ir(()=>lt(()=>import("./plugin-monaco-C8UgLomw.js").then(u=>u.i),__vite__mapDeps([0,1])),{});Er();function Wr(){const[u,h]=s.useState(()=>typeof document>"u"?!1:document.documentElement.classList.contains("dark"));return s.useEffect(()=>{const f=document.documentElement,R=new MutationObserver(()=>{h(f.classList.contains("dark"))});return R.observe(f,{attributes:!0,attributeFilter:["class"]}),()=>R.disconnect()},[]),u}function
|
|
7
|
+
*/const Or=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],Ur=ur("at-sign",Or),Dr=Ir(()=>lt(()=>import("./plugin-monaco-C8UgLomw.js").then(u=>u.i),__vite__mapDeps([0,1])),{});Er();function Wr(){const[u,h]=s.useState(()=>typeof document>"u"?!1:document.documentElement.classList.contains("dark"));return s.useEffect(()=>{const f=document.documentElement,R=new MutationObserver(()=>{h(f.classList.contains("dark"))});return R.observe(f,{attributes:!0,attributeFilter:["class"]}),()=>R.disconnect()},[]),u}function Pe(u){return[u.resourcePath||u.resourceName||"",u.line||0,u.severity,u.message].join("::")}const Pt=(u,h)=>Array.isArray(h)&&h.length>0?h.map(f=>({path:f.file??null,line:typeof f.line=="number"?f.line:null,message:f.message,severity:f.severity==="warning"?"warning":"error"})):Array.isArray(u)?u:[],zr=["pdflatex","xelatex","lualatex"],at=[{id:"article",labelKey:"bib_snippet_article",snippet:`@article{key,
|
|
8
8
|
title = {},
|
|
9
9
|
author = {},
|
|
10
10
|
journal = {},
|
|
@@ -22,4 +22,4 @@ import{y as ur,x as fr,u as mr,a as nt,f as br,t as hr,U as st,V as xr,K as gr,W
|
|
|
22
22
|
year = {},
|
|
23
23
|
note = {},
|
|
24
24
|
}
|
|
25
|
-
`}];function Pe(u){return u==="xelatex"||u==="lualatex"?u:"pdflatex"}function it(u){return String(u||"").trim().replace(/\\/g,"/").replace(/^\.\/+/,"").replace(/^\/+/,"").toLowerCase()}function qr(u,h){const f=[],R=String(u||""),E=/@([a-zA-Z]+)\s*\{\s*([^,\s]+)\s*,([\s\S]*?)\n\}/g;let c=null;for(;c=E.exec(R);){const x=c[3]||"",C=x.match(/title\s*=\s*[\{"']([^}"']+)/i)?.[1]?.trim(),O=x.match(/author\s*=\s*[\{"']([^}"']+)/i)?.[1]?.trim();f.push({key:c[2].trim(),title:C,author:O,sourceFile:h})}return f}function Vr(u,h){const f=[],R=String(u||""),E=/\\label\{([^}]+)\}/g;let c=null;for(;c=E.exec(R);)f.push({key:c[1].trim(),sourceFile:h});return f}function Pt(u,h){const f=it(h);if(!f)return null;const R=u.find(C=>it(C.name)===f);if(R)return R.id;const E=f.split("/").filter(Boolean).pop();if(!E)return null;const c=u.find(C=>it(C.name).endsWith(`/${E}`));return c?c.id:u.find(C=>C.name.toLowerCase()===E)?.id??null}function Kr({pdfDocument:u,zoomFactor:h,highlights:f,onPageWidth:R}){s.useEffect(()=>{let x=!1;return u.getPage(1).then(C=>{if(x)return;const O=C.getViewport({scale:1});O?.width&&R(O.width)}).catch(()=>{x||R(ot.A4_WIDTH)}),()=>{x=!0}},[R,u]);const E=Number.isFinite(h)&&h>0?h:1,c=Math.abs(E-1)<.001?"page-width":`page-width:${E}`;return n.jsx(Br,{pdfDocument:u,pdfScaleValue:c,highlights:f,highlightTransform:()=>n.jsx(n.Fragment,{}),onScrollChange:()=>{},scrollRef:()=>{},onSelectionFinished:(x,C,O,a)=>null,enableAreaSelection:()=>!1})}function nn({context:u,tabId:h,setDirty:f,setTitle:R}){const E=u.customData??{},c=E.projectId??void 0,x=E.latexFolderId??u.resourceId??void 0,C=!!E.readOnly,O=fr(e=>e.user),{t:a,language:Mt}=mr("latex"),ct=nt(e=>e.updateTabState),J=nt(e=>e.setActiveIssue),[Bt,Me]=s.useState(null),$t=Wr(),dt=br(e=>e.updateFileMeta),[_,Tt]=s.useState([]),Ot=E.openFileId??E.mainFileId??null,[d,Be]=s.useState(Ot),[P,pe]=s.useState("main.tex"),[Ut,ut]=s.useState(""),[we,ve]=s.useState("idle"),[K,ke]=s.useState("idle"),[Dt,$e]=s.useState(null),[U,G]=s.useState(!1),[W,Te]=s.useState(null),[p,Q]=s.useState("idle"),[Wt,oe]=s.useState(null),[M,ye]=s.useState([]),[ce,_e]=s.useState("pdflatex"),[ft,Oe]=s.useState(null),[Z,zt]=s.useState(null),[Ne,Ue]=s.useState(null),[Y,mt]=s.useState(1),[De,qt]=s.useState(ot.A4_WIDTH),[We,Vt]=s.useState(0),[ze,Kt]=s.useState(.58),[qe,bt]=s.useState(!1),[ee,Zt]=s.useState(!1),[te,je]=s.useState(!1),[ht,Ve]=s.useState(!1),[de,re]=s.useState(""),[ue,Ke]=s.useState([]),[fe,Ze]=s.useState([]),Ht=s.useMemo(()=>[],[]),He=s.useRef(""),ne=s.useRef(null),H=s.useRef(null),Xe=s.useRef(null),xt=s.useRef(""),Se=s.useRef([]),X=s.useRef(null),z=s.useRef(null),me=s.useRef(!1),gt=s.useRef(0),Je=s.useRef(!1),[Ge,Xt]=s.useState(0),se=s.useRef(null),pt=s.useRef(null),Qe=s.useRef(null),wt=s.useRef(null),be=s.useRef(null),Ye=s.useRef(null),vt=s.useRef([]),kt=s.useRef([]),Le=s.useRef([]),w=C||Bt===!1,yt="user",_t=hr(),Ce=P.toLowerCase().endsWith(".bib");s.useEffect(()=>{const e=_.find(t=>t.id===d)??_.find(t=>t.name===P)??null;ct(h,{contentKind:"latex",documentMode:"source",resourceName:e?.name||P||u.resourceName||"main.tex",resourcePath:e?.path?st(e.path):void 0,isReadOnly:w,compileState:p==="queued"||p==="running"?"compiling":K==="saving"?"saving":p==="error"?"error":"idle",diagnostics:{errors:M.filter(t=>t.severity!=="warning").length,warnings:M.filter(t=>t.severity==="warning").length}})},[d,P,M,p,u.resourceName,w,_,K,h,ct]),s.useEffect(()=>{R(u.resourceName||a("title"))},[u.resourceName,R,a]),s.useEffect(()=>{if(!c)return;if(C){Me(null);return}let e=!1;return(async()=>{try{const t=await xr(c);if(e)return;const r=String(t?.role??"");Me(r==="owner"||r==="admin"||r==="editor")}catch{if(e)return;Me(null)}})(),()=>{e=!0}},[c,C]),s.useEffect(()=>{if(!c){Oe(null);return}let e=!1;return gr.session(c).then(t=>{if(e)return;const r=t?.snapshot,i=typeof r?.current_workspace_branch=="string"&&r.current_workspace_branch.trim()?r.current_workspace_branch.trim():typeof r?.branch=="string"&&r.branch.trim()?r.branch.trim():null;Oe(i)}).catch(()=>{e||Oe(null)}),()=>{e=!0}},[c]),s.useEffect(()=>{if(!c||!x)return;let e=!1;return(async()=>{try{const t=await pr(c,x);if(e)return;const r=t.filter(i=>i.type==="file").map(i=>({id:i.id,name:i.name,path:i.path||void 0})).sort((i,l)=>i.name.localeCompare(l.name));if(Tt(r),d){const i=r.find(l=>l.id===d);i&&pe(i.name)}else{const i=r.find(l=>l.name.toLowerCase()==="main.tex")??r.find(l=>l.name.toLowerCase().endsWith(".tex"))??r[0];i&&(Be(i.id),pe(i.name))}}catch(t){console.error("[LatexPlugin] Failed to list files:",t),$e(t instanceof Error?t.message:a("load_files_failed"))}})(),()=>{e=!0}},[c,x]),s.useEffect(()=>{vt.current=ue},[ue]),s.useEffect(()=>{kt.current=fe},[fe]),s.useEffect(()=>()=>{Le.current.forEach(e=>{try{e?.dispose?.()}catch{}}),Le.current=[]},[]),s.useEffect(()=>{if(!c||_.length===0){Ke([]),Ze([]);return}let e=!1;const t=_.filter(r=>r.name.toLowerCase().endsWith(".bib")||r.name.toLowerCase().endsWith(".tex"));return(async()=>{try{const r=await Promise.all(t.map(async o=>{try{const N=await Ee(o.id);return{file:o,content:N}}catch{return{file:o,content:""}}}));if(e)return;const i=r.filter(o=>o.file.name.toLowerCase().endsWith(".bib")).flatMap(o=>qr(o.content,o.file.name)).sort((o,N)=>o.key.localeCompare(N.key)),l=r.filter(o=>o.file.name.toLowerCase().endsWith(".tex")).flatMap(o=>Vr(o.content,o.file.name)).sort((o,N)=>o.key.localeCompare(N.key));Ke(i),Ze(l)}catch{e||(Ke([]),Ze([]))}})(),()=>{e=!0}},[_,c]),s.useEffect(()=>()=>{try{z.current?.()}finally{z.current=null}},[d]),s.useEffect(()=>{if(!c||!d)return;let e=!1,t=null;return ve("loading"),$e(null),(async()=>{const{Doc:r,applyUpdate:i,encodeStateVector:l,encodeStateAsUpdate:o,mergeUpdates:N}=await lt(async()=>{const{Doc:g,applyUpdate:v,encodeStateVector:V,encodeStateAsUpdate:Re,mergeUpdates:T}=await import("./plugin-notebook-HbW2K-1c.js").then(xe=>xe.a8);return{Doc:g,applyUpdate:v,encodeStateVector:V,encodeStateAsUpdate:Re,mergeUpdates:T}},__vite__mapDeps([2,0,1])),S=new r,A=S.getText("content");if(ne.current=S,H.current=A,!_t){const g=await Ee(d);S.transact(()=>{const V=A.length||0;V&&A.delete(0,V),g&&A.insert(0,g)},"ds-local-seed");const v=A.toString();ut(v),He.current=v,G(!1),f(!1),ve("ready"),t=()=>{try{z.current?.()}finally{z.current=null,ne.current===S&&(ne.current=null),H.current===A&&(H.current=null)}};return}const j=new Rr(c,{authMode:yt,docKind:"latex"});Xe.current=j,await j.connect();const m=`ds-remote:${c}:${d}:${Date.now()}`;xt.current=m;const b=await j.loadDoc(d,l(S));if(b?.missing&&i(S,b.missing,m),Je.current){const g=await Ee(d);if(S.transact(()=>{const v=A.length||0;v&&A.delete(0,v),g&&A.insert(0,g)},"ds-reset"),!w){const v=o(S);await j.pushDocUpdate(d,v)}Je.current=!1}if(!b){const g=await Ee(d);if(S.transact(()=>{A.insert(0,g)},"ds-seed"),!w){const v=o(S);await j.pushDocUpdate(d,v)}}const L=j.onDocUpdate(g=>{g.docId===d&&i(S,g.update,m)}),k=j.onDocReset(g=>{if(g.docId!==d)return;const v=Number(g.timestamp||0);v&&v===gt.current||(gt.current=v||Date.now(),!e&&(Je.current=!0,Xt(V=>V+1)))}),B=()=>{X.current!=null&&window.clearTimeout(X.current),X.current=window.setTimeout(async()=>{X.current=null;const g=Se.current;if(g.length){Se.current=[];try{const v=g.length===1?g[0]:N(g);await j.pushDocUpdate(d,v)}catch(v){console.error("[LatexPlugin] Failed to push update:",v)}}},300)},y=(g,v)=>{v!==m&&(w||(Se.current.push(g),B()))};S.on("update",y);let I=null,$=null,le=null,Ie=null;if(!w)try{const{Awareness:g,encodeAwarenessUpdate:v,applyAwarenessUpdate:V}=await lt(async()=>{const{Awareness:T,encodeAwarenessUpdate:xe,applyAwarenessUpdate:tt}=await import("./plugin-notebook-HbW2K-1c.js").then(rt=>rt.a9);return{Awareness:T,encodeAwarenessUpdate:xe,applyAwarenessUpdate:tt}},__vite__mapDeps([2,0,1]));I=new g(S),I.setLocalStateField("user",{id:O?.id??null,name:O?.username??"User"}),await j.joinAwareness(d);const Re=`ds-awareness:${c}:${d}:${Date.now()}`;$=j.onAwarenessUpdate(d,T=>{V(I,T,Re)}),le=j.onAwarenessCollect(d,()=>{const T=v(I,[I.clientID]);j.broadcastAwareness(d,T)}),Ie=(T,xe)=>{if(xe===Re)return;const tt=[...T?.added??[],...T?.updated??[],...T?.removed??[]],rt=v(I,tt);j.broadcastAwareness(d,rt)},I.on("change",Ie),j.requestAwarenesses(d)}catch(g){console.warn("[LatexPlugin] Awareness init failed:",g)}const Rt=A.toString();ut(Rt),He.current=Rt,G(!1),f(!1),ve("ready"),t=()=>{try{try{z.current?.()}finally{z.current=null}L?.(),k?.();try{S.off("update",y)}catch{}if(X.current!=null&&(window.clearTimeout(X.current),X.current=null),Se.current=[],$&&$(),le&&le(),I&&Ie)try{I.off("change",Ie)}catch{}if(!w)try{j.leaveAwareness(d)}catch{}}finally{try{j.disconnect()}catch{}Xe.current===j&&(Xe.current=null),ne.current===S&&(ne.current=null),H.current===A&&(H.current=null)}}})().catch(r=>{console.error("[LatexPlugin] Sync init failed:",r),!e&&(ve("error"),$e(r instanceof Error?r.message:a("collaboration_failed")))}),()=>{e=!0,t?.()}},[d,_t,w,c,Ge,f,yt,a,O?.id,O?.username]);const Nt=s.useCallback(e=>{const t=be.current;if(!t)return!1;const r=t.getModel?.();if(!r)return!1;const i=Math.max(1,Number(r.getLineCount?.()??1)),l=Math.min(Math.max(1,Math.round(e||1)),i);return t.revealLineInCenter?.(l),t.setPosition?.({lineNumber:l,column:1}),t.setSelection?.({startLineNumber:l,startColumn:1,endLineNumber:l,endColumn:Number(r.getLineMaxColumn?.(l)??1)}),t.focus?.(),!0},[]),ae=s.useCallback(()=>{const e=Ye.current;e&&(e.fileId&&e.fileId!==d||Nt(e.line)&&(Ye.current=null))},[d,Nt]),q=s.useCallback(e=>{const t=be.current;if(!t||w)return;const r=t.getSelection?.();r&&(t.executeEdits?.("ds-latex-assist",[{range:r,text:e,forceMoveMarkers:!0}]),t.focus?.(),G(!0),f(!0))},[w,f]),Jt=s.useCallback((e,t="\\cite")=>{const r=be.current,i=r?.getModel?.(),l=r?.getPosition?.();if(!r||!i||!l){q(`${t}{${e.key}}`);return}const o=i.getValueInRange({startLineNumber:l.lineNumber,startColumn:1,endLineNumber:l.lineNumber,endColumn:l.column}),N=/\\(?:cite|citet|citep|autocite|parencite)\{[^}]*$/i.test(o);q(N?e.key:`${t}{${e.key}}`),je(!1),re("")},[q]),Gt=s.useCallback((e,t="\\ref")=>{const r=be.current,i=r?.getModel?.(),l=r?.getPosition?.();if(!r||!i||!l){q(`${t}{${e.key}}`);return}const o=i.getValueInRange({startLineNumber:l.lineNumber,startColumn:1,endLineNumber:l.lineNumber,endColumn:l.column}),N=/\\(?:ref|eqref)\{[^}]*$/i.test(o);q(N?e.key:`${t}{${e.key}}`),je(!1),re("")},[q]),Qt=s.useCallback(e=>{q(e),Ve(!1),re("")},[q]),jt=s.useMemo(()=>{const e=de.trim().toLowerCase();return e?ue.filter(t=>[t.key,t.title,t.author,t.sourceFile].some(r=>String(r||"").toLowerCase().includes(e))).slice(0,12):ue.slice(0,12)},[de,ue]),St=s.useMemo(()=>{const e=de.trim().toLowerCase();return e?fe.filter(t=>[t.key,t.sourceFile].some(r=>String(r||"").toLowerCase().includes(e))).slice(0,10):fe.slice(0,10)},[de,fe]),Yt=te||ht,er=s.useCallback((e,t)=>{be.current=e;const r=H.current,i=ne.current,l=xt.current;if(!r||!i)return;const o=e.getModel?.();if(!o)return;const N=m=>{(t.languages.getLanguages?.()||[]).some(L=>L.id===m)||t.languages.register({id:m})};N("latex-ds"),N("bibtex-ds"),t.editor.setModelLanguage(o,Ce?"bibtex-ds":"latex-ds"),Le.current.forEach(m=>{try{m?.dispose?.()}catch{}}),Le.current=[t.languages.registerCompletionItemProvider("latex-ds",{triggerCharacters:["\\","{"],provideCompletionItems:(m,b)=>{const L=m.getValueInRange({startLineNumber:b.lineNumber,startColumn:1,endLineNumber:b.lineNumber,endColumn:b.column}),k=m.getWordUntilPosition(b),B=new t.Range(b.lineNumber,k.startColumn,b.lineNumber,k.endColumn);return/\\(?:cite|citet|citep|autocite|parencite)\{[^}]*$/i.test(L)?{suggestions:vt.current.slice(0,40).map(y=>({label:y.key,kind:t.languages.CompletionItemKind.Reference,insertText:y.key,detail:y.title||y.author||y.sourceFile,documentation:[y.author,y.title].filter(Boolean).join(" · "),range:B}))}:/\\(?:ref|eqref)\{[^}]*$/i.test(L)?{suggestions:kt.current.slice(0,40).map(y=>({label:y.key,kind:t.languages.CompletionItemKind.Reference,insertText:y.key,detail:y.sourceFile,range:B}))}:{suggestions:[]}}}),t.languages.registerCompletionItemProvider("bibtex-ds",{triggerCharacters:["@"],provideCompletionItems:(m,b)=>{const L=new t.Range(b.lineNumber,b.column,b.lineNumber,b.column);return{suggestions:at.map(k=>({label:k.id,kind:t.languages.CompletionItemKind.Snippet,insertText:k.snippet,insertTextRules:t.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:a(k.labelKey),range:L}))}}})],z.current?.(),me.current=!0;try{o.setValue(r.toString())}finally{me.current=!1}const S=m=>{if(!Array.isArray(m)||m.length===0)return;const b=[];let L=0;for(const k of m){const B=typeof k?.retain=="number"?k.retain:0;B&&(L+=B);const y=typeof k?.insert=="string"?k.insert:null;if(y!=null){const $=o.getPositionAt(L);b.push({range:new t.Range($.lineNumber,$.column,$.lineNumber,$.column),text:y,forceMoveMarkers:!0}),L+=y.length}const I=typeof k?.delete=="number"?k.delete:0;if(I){const $=o.getPositionAt(L),le=o.getPositionAt(L+I);b.push({range:new t.Range($.lineNumber,$.column,le.lineNumber,le.column),text:"",forceMoveMarkers:!0})}}if(b.length){me.current=!0;try{o.applyEdits(b)}finally{me.current=!1}}},A=m=>{m?.transaction?.origin===l&&(S(m.delta??[]),G(!0))};r.observe(A);const j=o.onDidChangeContent(m=>{if(me.current||w)return;const b=Array.isArray(m?.changes)?m.changes:[];b.length&&(i.transact(()=>{const L=[...b].sort((k,B)=>(B.rangeOffset??0)-(k.rangeOffset??0));for(const k of L){const B=Number(k.rangeOffset??0),y=Number(k.rangeLength??0),I=String(k.text??"");y&&r.delete(B,y),I&&r.insert(B,I)}},"ds-monaco"),G(!0))});z.current=()=>{try{j?.dispose?.()}catch{}try{r.unobserve(A)}catch{}},window.requestAnimationFrame(()=>{ae()})},[w,ae,Ce,f,a]);s.useEffect(()=>{we==="ready"&&ae()},[d,ae,Ge,we]);const et=s.useCallback(async()=>{if(!d||w)return!1;const e=H.current;if(!e)return!1;try{ke("saving");const t=String(e.toString?.()??""),r=await wr(d,t);return He.current=t,ke("idle"),G(!1),f(!1),r?.updated_at&&dt(d,{updatedAt:r.updated_at,size:typeof r.size=="number"?r.size:void 0,mimeType:r.mime_type}),!0}catch(t){return console.error("[LatexPlugin] Save failed:",t),ke("error"),window.setTimeout(()=>ke("idle"),1400),!1}},[d,w,f,dt]),tr=s.useCallback(async e=>{if(!(!c||!x)&&!C&&!(U&&!w&&!await et()))try{oe(null),ye([]),Ue(null),Q("queued");const t=await vr(c,x,{compiler:ce,auto:!!e?.auto,stop_on_first_error:!1});Te(t.build_id),_e(Pe(t.compiler)),Q(t.status??"queued")}catch(t){console.error("[LatexPlugin] Compile failed:",t),oe(t instanceof Error?t.message:a("compile_request_failed")),Q("error")}},[ce,w,U,x,c,et,a,C]);s.useEffect(()=>{if(!c||!x)return;const e=t=>{const r=t.detail;r&&(r.projectId!==c||r.folderId!==x||(r.buildId&&Te(r.buildId),Q(r.status??"queued"),oe(r.errorMessage??null),ye([]),Ue(null)))};return window.addEventListener("ds:latex-build",e),()=>{window.removeEventListener("ds:latex-build",e)}},[x,c]),s.useEffect(()=>{if(!c||!x||W)return;let e=!1;return(async()=>{try{const t=await kr(c,x,1);if(e)return;const r=t?.[0];r?.build_id&&(Te(r.build_id),_e(Pe(r.compiler)),Q(r.status??"idle"),oe(r.error_message??null),ye(Ft(r.errors,r.log_items)))}catch{}})(),()=>{e=!0}},[W,x,c]),s.useEffect(()=>{if(!c||!x||!W)return;let e=!1,t=null;const r=async()=>{try{const i=await Lr(c,x,W);if(e)return;if(_e(Pe(i.compiler)),Q(i.status),oe(i.error_message??null),ye(Ft(i.errors,i.log_items)),i.status==="success"&&i.pdf_ready&&pt.current!==W)try{const l=await Cr(c,x,W);if(e)return;const o=URL.createObjectURL(l);if(se.current)try{URL.revokeObjectURL(se.current)}catch{}se.current=o,zt(o),pt.current=W}catch(l){console.warn("[LatexPlugin] Failed to fetch PDF:",l)}if(i.status==="error"&&i.log_ready&&!Ne)try{const l=await Ar(c,x,W);if(e)return;Ue(l)}catch(l){console.warn("[LatexPlugin] Failed to fetch log:",l)}(i.status==="queued"||i.status==="running")&&(t=window.setTimeout(r,1e3))}catch{if(e)return;t=window.setTimeout(r,1500)}};return r(),()=>{e=!0,t!=null&&window.clearTimeout(t)}},[W,x,Ne,c]),s.useEffect(()=>()=>{if(se.current){try{URL.revokeObjectURL(se.current)}catch{}se.current=null}},[]),s.useEffect(()=>{f(U)},[U,f]),s.useEffect(()=>{if(typeof window>"u")return;const e=window.matchMedia("(min-width: 1024px)"),t=e,r=()=>Zt(e.matches);return r(),typeof e.addEventListener=="function"?(e.addEventListener("change",r),()=>e.removeEventListener("change",r)):(t.addListener?.(r),()=>t.removeListener?.(r))},[]),s.useEffect(()=>{const e=wt.current;if(!e)return;let t=null;const r=new ResizeObserver(i=>{const l=i[0];l&&(t!=null&&window.cancelAnimationFrame(t),t=window.requestAnimationFrame(()=>{Vt(l.contentRect.width)}))});return r.observe(e),()=>{t!=null&&window.cancelAnimationFrame(t),r.disconnect()}},[]);const rr=s.useMemo(()=>`${P?P.replace(/\.tex$/i,""):"document"}.pdf`,[P]),ie=s.useMemo(()=>M.filter(e=>e.severity==="warning"),[M]),nr=s.useMemo(()=>a(`compiler_${ce}`),[ce,a]),Lt=s.useMemo(()=>w?{label:a("status_read_only"),className:"border-black/10 bg-white/60 text-muted-foreground dark:bg-white/[0.04] dark:border-white/10"}:p==="queued"||p==="running"?{label:a("status_compiling"),className:"border-[#8FA3B8]/30 bg-[#8FA3B8]/10 text-[#52667a] dark:bg-[#8FA3B8]/12 dark:text-[#c8d4df]"}:K==="saving"?{label:a("status_saving"),className:"border-[#A6B0B6]/30 bg-[#A6B0B6]/12 text-[#5c666b] dark:bg-[#A6B0B6]/12 dark:text-[#d8dde0]"}:U?{label:a("status_unsaved"),className:"border-[#B7A59A]/30 bg-[#B7A59A]/12 text-[#7e695d] dark:bg-[#B7A59A]/12 dark:text-[#eadfd8]"}:p==="error"?{label:a("status_compile_failed"),className:"border-red-400/30 bg-red-50/80 text-red-600 dark:bg-red-500/10 dark:text-red-200"}:{label:a("status_saved"),className:"border-[#9AA79A]/30 bg-[#9AA79A]/12 text-[#5f6b5f] dark:bg-[#9AA79A]/12 dark:text-[#dbe4db]"},[p,w,U,K,a]),he=s.useCallback(e=>{const t=Pt(_,e.path)??d??_.find(N=>N.name.toLowerCase()==="main.tex")?.id??_[0]?.id??null,r=t?_.find(N=>N.id===t)??null:null,i=r?.name||e.path||P||"main.tex",l=r?.path?st(r.path):e.path?st(e.path):"",o=e.severity==="warning"?"warning":"error";return{kind:"latex_error",tabId:h,fileId:t||void 0,resourceId:t||void 0,resourcePath:l&&l!=="/FILES"?l:void 0,resourceName:i,line:typeof e.line=="number"?Math.max(1,Number(e.line||1)):void 0,message:e.message,severity:o,excerpt:e.path||e.line?`${e.path||i}${e.line?`:${e.line}`:""}`:void 0,createdAt:new Date().toISOString()}},[d,P,_,h]),Ae=s.useCallback(e=>{const t=he(e);return J(h,t),t},[he,J,h]);s.useEffect(()=>{if(p==="success"){J(h,null);return}if(M.length===0){p==="error"&&J(h,null);return}const e=M.find(l=>l.severity!=="warning")??M[0]??null;if(!e)return;const t=nt.getState().activeIssueByTabId[h],r=t?.kind==="latex_error"?M.find(l=>Fe(he(l))===Fe(t))??null:null,i=he(r??e);t&&Fe(t)===Fe(i)||J(h,i)},[M,he,p,J,h]);const Ct=s.useCallback(e=>{const r=Ae(e)?.fileId??Pt(_,e.path)??d??_.find(l=>l.name.toLowerCase()==="main.tex")?.id??_[0]?.id??null;if(!r)return;const i=_.find(l=>l.id===r);if(Ye.current={fileId:r,line:Math.max(1,Number(e.line||1))},i?.name&&i.name!==P&&pe(i.name),r!==d){Be(r);return}ae()},[d,P,_,ae,Ae]),At=s.useCallback(e=>{const t=Ae(e),r=e.severity==="warning"?a("warning_badge"):a("error_badge"),i=t?.line&&t.resourceName?`${t.resourceName}:${t.line}`:t?.resourceName||e.path||P||"main.tex",l=t?.resourcePath||t?.resourceName||e.path||P||"main.tex",o=typeof t?.line=="number"&&Number.isFinite(t.line)?String(Math.max(1,t.line)):a("issue_unknown_line"),N=a("issue_action_prompt",{severity:r,branch:ft||a("issue_unknown_branch"),file:l,line:o,location:i,message:e.message});window.dispatchEvent(new CustomEvent("ds:copilot:prefill",{detail:{text:N,focus:!0}}))},[P,ft,Ae,a]),It=s.useCallback((e,t,r)=>{const i=!!(e.path||e.line)&&!!(d||_.length),l=`${e.path??r}-${e.line??"0"}-${t}`,o=n.jsxs(n.Fragment,{children:[n.jsx("span",{className:F("px-1.5 py-0.5 rounded-full text-[10px] uppercase border",e.severity==="warning"?"text-amber-700 border-amber-400/40 bg-amber-50/70 dark:bg-amber-500/10":"text-red-600 border-red-400/40 bg-red-50/70 dark:bg-red-500/10"),children:e.severity==="warning"?a("warning_badge"):a("error_badge")}),n.jsxs("span",{className:"text-muted-foreground font-mono",children:[e.path||"main.tex",e.line?`:${e.line}`:""]}),n.jsx("span",{className:"text-muted-foreground break-words",children:e.message}),i?n.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-muted-foreground/80",children:a("issue_hint_clickable")}):null]});return n.jsxs("div",{className:"flex items-start gap-2",children:[i?n.jsx("button",{type:"button",onClick:()=>Ct(e),className:"min-w-0 flex flex-1 items-start gap-2 rounded-lg px-2 py-1.5 text-left hover:bg-black/5 dark:hover:bg-white/[0.04]",title:e.line?a("issue_jump_to_line",{line:e.line}):a("issue_jump_to_file",{file:e.path||"main.tex"}),children:o}):n.jsx("div",{className:"min-w-0 flex flex-1 items-start gap-2 px-2 py-1.5",children:o}),n.jsx("div",{className:"flex shrink-0 items-center gap-1 pt-1",children:n.jsx("button",{type:"button",onClick:()=>At(e),className:"rounded-md border border-black/10 dark:border-white/10 bg-white/70 dark:bg-white/[0.05] px-2 py-1 text-[11px] font-medium text-muted-foreground hover:bg-black/5 dark:hover:bg-white/[0.08]",title:a("issue_action_ask_deepscientist"),children:a("issue_action_ask_deepscientist")})})]},l)},[d,_,At,Ct,a]),sr=!Z||Y<=D[0],ar=!Z||Y>=D[D.length-1],ir=()=>{const e=D.findIndex(r=>r>=Y),t=e===-1?D.length-1:e;t<=0||mt(D[t-1])},lr=()=>{const e=D.findIndex(r=>r>=Y),t=e===-1?D.length-1:e;t>=D.length-1||mt(D[t+1])},or=s.useMemo(()=>{if(!We||!De)return 1;const e=Math.max(We-32,120);return Math.max(e/De,.2)},[We,De])*Y,cr=s.useCallback(e=>{qt(e||ot.A4_WIDTH)},[]),dr=s.useCallback(e=>{if(!ee||!Qe.current||e.button!==0)return;e.preventDefault();const r=Qe.current.getBoundingClientRect(),i=e.clientX,l=r.width*ze,o=360,S=Math.max(r.width-320,o),A=document.body.style.cursor,j=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none",bt(!0);let m=null;const b=k=>{const B=l+(k.clientX-i),I=Math.min(Math.max(B,o),S)/r.width;m!=null&&window.cancelAnimationFrame(m),m=window.requestAnimationFrame(()=>{Kt(I)})},L=()=>{m!=null&&window.cancelAnimationFrame(m),bt(!1),document.body.style.cursor=A,document.body.style.userSelect=j,window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",L)};window.addEventListener("pointermove",b),window.addEventListener("pointerup",L)},[ee,ze]);return n.jsx("div",{className:"h-full flex flex-col bg-white/70 dark:bg-black/30",children:n.jsxs("div",{ref:Qe,className:"flex-1 min-h-0 flex flex-col lg:flex-row",children:[n.jsxs("div",{className:F("min-h-0 flex flex-col min-w-0",ee?"lg:border-r-0":"border-b border-black/5 dark:border-white/10",qe?"transition-none":"transition-[flex-basis] duration-200 ease-out"),style:ee?{flexBasis:`${ze*100}%`,flexGrow:0,flexShrink:0}:void 0,children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-3 py-2 border-b border-black/5 dark:border-white/10",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx(yr,{className:"h-4 w-4 text-muted-foreground shrink-0"}),n.jsx("select",{className:F("h-8 rounded-lg px-2 text-sm bg-white/70 border border-black/10","dark:bg-white/[0.04] dark:border-white/10","min-w-[160px] max-w-[260px] truncate",w&&"opacity-70"),value:d??"",onChange:e=>{const t=e.target.value||null,r=_.find(i=>i.id===t);r&&pe(r.name),Be(t)},disabled:_.length===0,"aria-label":a("file_label"),title:P,children:_.map(e=>n.jsx("option",{value:e.id,children:e.name},e.id))})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:a("compiler_label")}),n.jsx("select",{className:F("h-8 rounded-lg px-2 text-sm bg-white/70 border border-black/10","dark:bg-white/[0.04] dark:border-white/10","min-w-[122px]",p==="queued"||p==="running"?"opacity-70":""),value:ce,onChange:e=>_e(Pe(e.target.value)),disabled:p==="queued"||p==="running","aria-label":a("compiler_label"),title:nr,children:zr.map(e=>n.jsx("option",{value:e,children:a(`compiler_${e}`)},e))})]}),Ce?null:n.jsxs("button",{type:"button",onClick:()=>{je(e=>{const t=!e;return t&&Ve(!1),t||re(""),t})},className:F("h-8 px-3 rounded-lg text-sm border inline-flex items-center gap-2","bg-white/70 border-black/10 hover:bg-white/90","dark:bg-white/[0.04] dark:border-white/10 dark:hover:bg-white/[0.08]",te&&"border-[#8FA3B8]/28 bg-[#8FA3B8]/12 text-[#405267]"),"aria-label":a("assist_references"),title:a("assist_references"),children:[n.jsx(_r,{className:"h-4 w-4"}),a("assist_references")]}),Ce?n.jsxs("button",{type:"button",onClick:()=>{Ve(e=>{const t=!e;return t&&je(!1),t||re(""),t})},className:F("h-8 px-3 rounded-lg text-sm border inline-flex items-center gap-2","bg-white/70 border-black/10 hover:bg-white/90","dark:bg-white/[0.04] dark:border-white/10 dark:hover:bg-white/[0.08]",ht&&"border-[#A99EBE]/28 bg-[#A99EBE]/12 text-[#564f6a]"),"aria-label":a("assist_bibtex"),title:a("assist_bibtex"),children:[n.jsx(Ur,{className:"h-4 w-4"}),a("assist_bibtex")]}):null,n.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[n.jsx("span",{className:F("text-xs px-2 py-0.5 rounded-full border",Lt.className),children:Lt.label}),n.jsx("button",{type:"button",onClick:et,disabled:w||K==="saving"||!U,className:F("h-8 px-3 rounded-lg text-sm font-medium border","bg-white/70 border-black/10 hover:bg-white/90","dark:bg-white/[0.04] dark:border-white/10 dark:hover:bg-white/[0.08]","disabled:opacity-50 disabled:cursor-not-allowed",U&&!w&&"border-black/20"),children:K==="saving"?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(ge,{className:"h-4 w-4 animate-spin"}),a("button_saving")]}):n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Nr,{className:"h-4 w-4"}),a("button_save")]})}),n.jsx("button",{type:"button",onClick:()=>void tr({auto:!1}),disabled:C||K==="saving"||p==="queued"||p==="running",className:F("h-8 px-3 rounded-lg text-sm font-medium border","bg-[#8FA3B8]/14 border-[#8FA3B8]/28 text-[#405267] hover:bg-[#8FA3B8]/20","dark:bg-[#8FA3B8]/14 dark:border-[#8FA3B8]/22 dark:text-[#dbe6ef] dark:hover:bg-[#8FA3B8]/20","disabled:opacity-50 disabled:cursor-not-allowed"),title:a(C?"compile_disabled_read_only":U&&!w?"button_save_and_compile":"button_compile"),children:p==="queued"||p==="running"?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(ge,{className:"h-4 w-4 animate-spin"}),a("button_compiling")]}):n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(jr,{className:"h-4 w-4"}),a(U&&!w?"button_save_and_compile":"button_compile")]})})]})]}),Yt?n.jsxs("div",{className:"border-b border-black/5 dark:border-white/10 bg-black/[0.02] dark:bg-white/[0.02] px-3 py-3",children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-sm font-medium text-foreground",children:a(te?"assist_references_title":"assist_bibtex_title")}),n.jsx("div",{className:"text-xs text-muted-foreground",children:a(te?"assist_reference_hint":"assist_bibtex_hint")})]}),te?n.jsx("input",{value:de,onChange:e=>re(e.target.value),placeholder:a("assist_search_placeholder"),className:F("h-8 w-full rounded-lg border border-black/10 bg-white/80 px-3 text-sm","sm:w-[280px] dark:border-white/10 dark:bg-white/[0.05]")}):null]}),te?n.jsxs("div",{className:"mt-3 grid gap-3 lg:grid-cols-2",children:[n.jsxs("div",{className:"rounded-xl border border-black/5 bg-white/70 p-3 dark:border-white/10 dark:bg-white/[0.03]",children:[n.jsx("div",{className:"mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:a("assist_citations")}),n.jsx("div",{className:"space-y-2",children:jt.length>0?jt.map(e=>n.jsxs("button",{type:"button",onClick:()=>Jt(e),className:"w-full rounded-lg border border-black/5 bg-black/[0.02] px-3 py-2 text-left hover:bg-black/[0.04] dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/[0.05]",title:e.title||e.key,children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("span",{className:"font-mono text-xs text-foreground",children:e.key}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:a("assist_insert_citation")})]}),e.title?n.jsx("div",{className:"mt-1 truncate text-xs text-muted-foreground",children:e.title}):null,n.jsx("div",{className:"mt-1 truncate text-[10px] text-muted-foreground/80",children:e.author||e.sourceFile})]},`${e.sourceFile}:${e.key}`)):n.jsx("div",{className:"rounded-lg border border-dashed border-black/10 px-3 py-4 text-xs text-muted-foreground dark:border-white/10",children:a("assist_empty_citations")})})]}),n.jsxs("div",{className:"rounded-xl border border-black/5 bg-white/70 p-3 dark:border-white/10 dark:bg-white/[0.03]",children:[n.jsx("div",{className:"mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:a("assist_labels")}),n.jsx("div",{className:"space-y-2",children:St.length>0?St.map(e=>n.jsxs("button",{type:"button",onClick:()=>Gt(e),className:"w-full rounded-lg border border-black/5 bg-black/[0.02] px-3 py-2 text-left hover:bg-black/[0.04] dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/[0.05]",title:e.key,children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("span",{className:"font-mono text-xs text-foreground",children:e.key}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:a("assist_insert_reference")})]}),n.jsx("div",{className:"mt-1 truncate text-[10px] text-muted-foreground/80",children:e.sourceFile})]},`${e.sourceFile}:${e.key}`)):n.jsx("div",{className:"rounded-lg border border-dashed border-black/10 px-3 py-4 text-xs text-muted-foreground dark:border-white/10",children:a("assist_empty_labels")})})]})]}):n.jsx("div",{className:"mt-3 grid gap-2 md:grid-cols-3",children:at.length>0?at.map(e=>n.jsxs("button",{type:"button",onClick:()=>Qt(e.snippet),className:"rounded-xl border border-black/5 bg-white/70 px-3 py-3 text-left hover:bg-white/90 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/[0.05]",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("span",{className:"font-mono text-sm text-foreground",children:["@",e.id]}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:a("assist_insert_snippet")})]}),n.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:a(e.labelKey)})]},e.id)):n.jsx("div",{className:"rounded-lg border border-dashed border-black/10 px-3 py-4 text-xs text-muted-foreground dark:border-white/10",children:a("assist_empty_bib")})})]}):null,n.jsx("div",{className:"flex-1 min-h-0",children:we==="loading"?n.jsxs("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:[n.jsx(ge,{className:"h-5 w-5 animate-spin mr-2"}),a("connecting")]}):we==="error"?n.jsx("div",{className:"h-full flex items-center justify-center text-sm text-red-600",children:Dt??a("load_files_failed")}):n.jsx(Dr,{defaultValue:Ut,language:"plaintext",theme:$t?"vs-dark":"light",onMount:(e,t)=>{try{er(e,t)}catch(r){console.error("[LatexPlugin] Failed to bind editor:",r)}},options:{readOnly:w,minimap:{enabled:!1},wordWrap:"on",fontSize:13,scrollBeyondLastLine:!1}},`${d??"latex"}:${Ge}`)}),p==="error"?n.jsxs("div",{className:"border-t border-black/5 dark:border-white/10 p-4 text-sm max-h-[35vh] overflow-auto",children:[n.jsxs("div",{className:"flex items-start gap-2 text-red-600",children:[n.jsx(Et,{className:"h-4 w-4 mt-0.5"}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"font-medium",children:a("compile_failed_title")}),n.jsx("div",{className:"text-xs opacity-90 break-words",children:Wt??a("compile_failed_fallback")})]})]}),M.length>0?n.jsxs("div",{className:"mt-3 space-y-2 text-xs",children:[M.slice(0,12).map((e,t)=>It(e,t,"error")),M.length>12?n.jsx("div",{className:"text-muted-foreground",children:a("more_items",{count:M.length-12})}):null]}):null,Ne?n.jsx("pre",{className:"mt-3 text-xs whitespace-pre-wrap break-words text-muted-foreground max-h-[40vh] overflow-auto rounded-lg border border-black/10 dark:border-white/10 bg-white/60 dark:bg-white/[0.03] p-3",children:Ne.slice(0,8e3)}):null]}):null,p!=="error"&&ie.length>0?n.jsxs("div",{className:"border-t border-black/5 dark:border-white/10 p-4 text-sm max-h-[35vh] overflow-auto",children:[n.jsxs("div",{className:"flex items-start gap-2 text-amber-700",children:[n.jsx(Et,{className:"h-4 w-4 mt-0.5"}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"font-medium",children:a("warnings_title")}),n.jsx("div",{className:"text-xs opacity-90 break-words",children:a("warnings_reported",{count:ie.length,suffix:Mt==="zh-CN"||ie.length===1?"":"s"})})]})]}),n.jsxs("div",{className:"mt-3 space-y-2 text-xs",children:[ie.slice(0,12).map((e,t)=>It(e,t,"warning")),ie.length>12?n.jsx("div",{className:"text-muted-foreground",children:a("more_items",{count:ie.length-12})}):null]})]}):null]}),ee?n.jsx("div",{className:F("hidden lg:flex w-3 relative items-stretch cursor-col-resize",qe?"bg-primary/10":"hover:bg-black/5 dark:hover:bg-white/[0.06]"),onPointerDown:dr,role:"separator","aria-orientation":"vertical","aria-label":a("resize_panels_aria"),children:n.jsx("div",{className:F("absolute inset-y-0 left-1/2 w-px",qe?"bg-primary/60":"bg-black/10 dark:bg-white/10")})}):null,n.jsx("div",{className:"min-h-0 flex flex-1 flex-col min-w-0",children:n.jsxs("div",{ref:wt,className:"relative flex-1 min-h-0 overflow-hidden",children:[n.jsxs("div",{className:F("absolute z-10 flex flex-col gap-2",ee?"left-3 top-1/2 -translate-y-1/2":"right-3 top-3","rounded-full border border-black/10 bg-white/80 p-1 shadow-sm","backdrop-blur dark:border-white/10 dark:bg-black/40"),onPointerDown:e=>e.stopPropagation(),children:[n.jsx("button",{type:"button",onClick:ir,disabled:sr,className:F("h-7 w-7 rounded-full flex items-center justify-center","text-muted-foreground hover:text-foreground hover:bg-black/5","dark:hover:bg-white/[0.08]","disabled:opacity-40 disabled:cursor-not-allowed"),"aria-label":a("zoom_out"),title:a("zoom_out"),children:n.jsx($r,{className:"h-4 w-4"})}),n.jsx("div",{className:"text-[11px] font-medium text-muted-foreground text-center",children:Z?`${Math.round(or*100)}%`:"--"}),n.jsx("button",{type:"button",onClick:lr,disabled:ar,className:F("h-7 w-7 rounded-full flex items-center justify-center","text-muted-foreground hover:text-foreground hover:bg-black/5","dark:hover:bg-white/[0.08]","disabled:opacity-40 disabled:cursor-not-allowed"),"aria-label":a("zoom_in"),title:a("zoom_in"),children:n.jsx(Tr,{className:"h-4 w-4"})}),n.jsx("a",{href:Z??"#",download:rr,className:F("h-7 w-7 rounded-full text-xs font-medium border flex items-center justify-center","bg-white/70 border-black/10 hover:bg-white/90","dark:bg-white/[0.04] dark:border-white/10 dark:hover:bg-white/[0.08]",!Z&&"opacity-50 pointer-events-none"),title:a("download_pdf"),children:n.jsx(Sr,{className:"h-3.5 w-3.5"})})]}),Z?n.jsx(Fr,{url:Z,workerSrc:Mr,cMapUrl:Pr,cMapPacked:!0,beforeLoad:n.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:[n.jsx(ge,{className:"h-5 w-5 animate-spin mr-2"}),a("loading_pdf")]}),children:e=>n.jsx(Kr,{pdfDocument:e,zoomFactor:Y,highlights:Ht,onPageWidth:cr})}):p==="queued"||p==="running"?n.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:[n.jsx(ge,{className:"h-5 w-5 animate-spin mr-2"}),a("preview_compiling")]}):p==="error"?n.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:a("preview_no_output")}):n.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:a("preview_empty")})]})})]})})}export{nn as default};
|
|
25
|
+
`}];function Fe(u){return u==="xelatex"||u==="lualatex"?u:"pdflatex"}function it(u){return String(u||"").trim().replace(/\\/g,"/").replace(/^\.\/+/,"").replace(/^\/+/,"").toLowerCase()}function qr(u,h){const f=[],R=String(u||""),E=/@([a-zA-Z]+)\s*\{\s*([^,\s]+)\s*,([\s\S]*?)\n\}/g;let c=null;for(;c=E.exec(R);){const x=c[3]||"",C=x.match(/title\s*=\s*[\{"']([^}"']+)/i)?.[1]?.trim(),O=x.match(/author\s*=\s*[\{"']([^}"']+)/i)?.[1]?.trim();f.push({key:c[2].trim(),title:C,author:O,sourceFile:h})}return f}function Vr(u,h){const f=[],R=String(u||""),E=/\\label\{([^}]+)\}/g;let c=null;for(;c=E.exec(R);)f.push({key:c[1].trim(),sourceFile:h});return f}function Ft(u,h){const f=it(h);if(!f)return null;const R=u.find(C=>it(C.name)===f);if(R)return R.id;const E=f.split("/").filter(Boolean).pop();if(!E)return null;const c=u.find(C=>it(C.name).endsWith(`/${E}`));return c?c.id:u.find(C=>C.name.toLowerCase()===E)?.id??null}function Kr({pdfDocument:u,zoomFactor:h,highlights:f,onPageWidth:R}){s.useEffect(()=>{let x=!1;return u.getPage(1).then(C=>{if(x)return;const O=C.getViewport({scale:1});O?.width&&R(O.width)}).catch(()=>{x||R(ot.A4_WIDTH)}),()=>{x=!0}},[R,u]);const E=Number.isFinite(h)&&h>0?h:1,c=Math.abs(E-1)<.001?"page-width":`page-width:${E}`;return n.jsx(Br,{pdfDocument:u,pdfScaleValue:c,highlights:f,highlightTransform:()=>n.jsx(n.Fragment,{}),onScrollChange:()=>{},scrollRef:()=>{},onSelectionFinished:(x,C,O,a)=>null,enableAreaSelection:()=>!1})}function nn({context:u,tabId:h,setDirty:f,setTitle:R}){const E=u.customData??{},c=E.projectId??void 0,x=E.latexFolderId??u.resourceId??void 0,C=!!E.readOnly,O=fr(e=>e.user),{t:a,language:Mt}=mr("latex"),ct=nt(e=>e.updateTabState),X=nt(e=>e.setActiveIssue),[Bt,Me]=s.useState(null),$t=Wr(),dt=br(e=>e.updateFileMeta),[_,Tt]=s.useState([]),Ot=E.openFileId??E.mainFileId??null,[d,Be]=s.useState(Ot),[F,pe]=s.useState("main.tex"),[Ut,ut]=s.useState(""),[we,ve]=s.useState("idle"),[K,ke]=s.useState("idle"),[Dt,$e]=s.useState(null),[U,Q]=s.useState(!1),[W,Te]=s.useState(null),[p,G]=s.useState("idle"),[Wt,oe]=s.useState(null),[M,ye]=s.useState([]),[ce,_e]=s.useState("pdflatex"),[ft,Oe]=s.useState(null),[Z,zt]=s.useState(null),[Ne,Ue]=s.useState(null),[Y,mt]=s.useState(1),[De,qt]=s.useState(ot.A4_WIDTH),[We,Vt]=s.useState(0),[ze,Kt]=s.useState(.58),[qe,bt]=s.useState(!1),[ee,Zt]=s.useState(!1),[te,je]=s.useState(!1),[ht,Ve]=s.useState(!1),[de,re]=s.useState(""),[ue,Ke]=s.useState([]),[fe,Ze]=s.useState([]),Ht=s.useMemo(()=>[],[]),He=s.useRef(""),ne=s.useRef(null),H=s.useRef(null),Je=s.useRef(null),xt=s.useRef(""),Se=s.useRef([]),J=s.useRef(null),z=s.useRef(null),me=s.useRef(!1),gt=s.useRef(0),Xe=s.useRef(!1),[Qe,Jt]=s.useState(0),se=s.useRef(null),pt=s.useRef(null),Ge=s.useRef(null),wt=s.useRef(null),be=s.useRef(null),Ye=s.useRef(null),vt=s.useRef([]),kt=s.useRef([]),Le=s.useRef([]),w=C||Bt===!1,yt="user",_t=hr(),Ce=F.toLowerCase().endsWith(".bib");s.useEffect(()=>{const e=_.find(t=>t.id===d)??_.find(t=>t.name===F)??null;ct(h,{contentKind:"latex",documentMode:"source",resourceName:e?.name||F||u.resourceName||"main.tex",resourcePath:e?.path?st(e.path):void 0,isReadOnly:w,compileState:p==="queued"||p==="running"?"compiling":K==="saving"?"saving":p==="error"?"error":"idle",diagnostics:{errors:M.filter(t=>t.severity!=="warning").length,warnings:M.filter(t=>t.severity==="warning").length}})},[d,F,M,p,u.resourceName,w,_,K,h,ct]),s.useEffect(()=>{R(u.resourceName||a("title"))},[u.resourceName,R,a]),s.useEffect(()=>{if(!c)return;if(C){Me(null);return}let e=!1;return(async()=>{try{const t=await xr(c);if(e)return;const r=String(t?.role??"");Me(r==="owner"||r==="admin"||r==="editor")}catch{if(e)return;Me(null)}})(),()=>{e=!0}},[c,C]),s.useEffect(()=>{if(!c){Oe(null);return}let e=!1;return gr.session(c).then(t=>{if(e)return;const r=t?.snapshot,i=typeof r?.current_workspace_branch=="string"&&r.current_workspace_branch.trim()?r.current_workspace_branch.trim():typeof r?.branch=="string"&&r.branch.trim()?r.branch.trim():null;Oe(i)}).catch(()=>{e||Oe(null)}),()=>{e=!0}},[c]),s.useEffect(()=>{if(!c||!x)return;let e=!1;return(async()=>{try{const t=await pr(c,x);if(e)return;const r=t.filter(i=>i.type==="file").map(i=>({id:i.id,name:i.name,path:i.path||void 0})).sort((i,l)=>i.name.localeCompare(l.name));if(Tt(r),d){const i=r.find(l=>l.id===d);i&&pe(i.name)}else{const i=r.find(l=>l.name.toLowerCase()==="main.tex")??r.find(l=>l.name.toLowerCase().endsWith(".tex"))??r[0];i&&(Be(i.id),pe(i.name))}}catch(t){console.error("[LatexPlugin] Failed to list files:",t),$e(t instanceof Error?t.message:a("load_files_failed"))}})(),()=>{e=!0}},[c,x]),s.useEffect(()=>{vt.current=ue},[ue]),s.useEffect(()=>{kt.current=fe},[fe]),s.useEffect(()=>()=>{Le.current.forEach(e=>{try{e?.dispose?.()}catch{}}),Le.current=[]},[]),s.useEffect(()=>{if(!c||_.length===0){Ke([]),Ze([]);return}let e=!1;const t=_.filter(r=>r.name.toLowerCase().endsWith(".bib")||r.name.toLowerCase().endsWith(".tex"));return(async()=>{try{const r=await Promise.all(t.map(async o=>{try{const N=await Ee(o.id);return{file:o,content:N}}catch{return{file:o,content:""}}}));if(e)return;const i=r.filter(o=>o.file.name.toLowerCase().endsWith(".bib")).flatMap(o=>qr(o.content,o.file.name)).sort((o,N)=>o.key.localeCompare(N.key)),l=r.filter(o=>o.file.name.toLowerCase().endsWith(".tex")).flatMap(o=>Vr(o.content,o.file.name)).sort((o,N)=>o.key.localeCompare(N.key));Ke(i),Ze(l)}catch{e||(Ke([]),Ze([]))}})(),()=>{e=!0}},[_,c]),s.useEffect(()=>()=>{try{z.current?.()}finally{z.current=null}},[d]),s.useEffect(()=>{if(!c||!d)return;let e=!1,t=null;return ve("loading"),$e(null),(async()=>{const{Doc:r,applyUpdate:i,encodeStateVector:l,encodeStateAsUpdate:o,mergeUpdates:N}=await lt(async()=>{const{Doc:g,applyUpdate:v,encodeStateVector:V,encodeStateAsUpdate:Re,mergeUpdates:T}=await import("./plugin-notebook-JRhysCqj.js").then(xe=>xe.a8);return{Doc:g,applyUpdate:v,encodeStateVector:V,encodeStateAsUpdate:Re,mergeUpdates:T}},__vite__mapDeps([2,0,1])),S=new r,A=S.getText("content");if(ne.current=S,H.current=A,!_t){const g=await Ee(d);S.transact(()=>{const V=A.length||0;V&&A.delete(0,V),g&&A.insert(0,g)},"ds-local-seed");const v=A.toString();ut(v),He.current=v,Q(!1),f(!1),ve("ready"),t=()=>{try{z.current?.()}finally{z.current=null,ne.current===S&&(ne.current=null),H.current===A&&(H.current=null)}};return}const j=new Rr(c,{authMode:yt,docKind:"latex"});Je.current=j,await j.connect();const m=`ds-remote:${c}:${d}:${Date.now()}`;xt.current=m;const b=await j.loadDoc(d,l(S));if(b?.missing&&i(S,b.missing,m),Xe.current){const g=await Ee(d);if(S.transact(()=>{const v=A.length||0;v&&A.delete(0,v),g&&A.insert(0,g)},"ds-reset"),!w){const v=o(S);await j.pushDocUpdate(d,v)}Xe.current=!1}if(!b){const g=await Ee(d);if(S.transact(()=>{A.insert(0,g)},"ds-seed"),!w){const v=o(S);await j.pushDocUpdate(d,v)}}const L=j.onDocUpdate(g=>{g.docId===d&&i(S,g.update,m)}),k=j.onDocReset(g=>{if(g.docId!==d)return;const v=Number(g.timestamp||0);v&&v===gt.current||(gt.current=v||Date.now(),!e&&(Xe.current=!0,Jt(V=>V+1)))}),B=()=>{J.current!=null&&window.clearTimeout(J.current),J.current=window.setTimeout(async()=>{J.current=null;const g=Se.current;if(g.length){Se.current=[];try{const v=g.length===1?g[0]:N(g);await j.pushDocUpdate(d,v)}catch(v){console.error("[LatexPlugin] Failed to push update:",v)}}},300)},y=(g,v)=>{v!==m&&(w||(Se.current.push(g),B()))};S.on("update",y);let I=null,$=null,le=null,Ie=null;if(!w)try{const{Awareness:g,encodeAwarenessUpdate:v,applyAwarenessUpdate:V}=await lt(async()=>{const{Awareness:T,encodeAwarenessUpdate:xe,applyAwarenessUpdate:tt}=await import("./plugin-notebook-JRhysCqj.js").then(rt=>rt.a9);return{Awareness:T,encodeAwarenessUpdate:xe,applyAwarenessUpdate:tt}},__vite__mapDeps([2,0,1]));I=new g(S),I.setLocalStateField("user",{id:O?.id??null,name:O?.username??"User"}),await j.joinAwareness(d);const Re=`ds-awareness:${c}:${d}:${Date.now()}`;$=j.onAwarenessUpdate(d,T=>{V(I,T,Re)}),le=j.onAwarenessCollect(d,()=>{const T=v(I,[I.clientID]);j.broadcastAwareness(d,T)}),Ie=(T,xe)=>{if(xe===Re)return;const tt=[...T?.added??[],...T?.updated??[],...T?.removed??[]],rt=v(I,tt);j.broadcastAwareness(d,rt)},I.on("change",Ie),j.requestAwarenesses(d)}catch(g){console.warn("[LatexPlugin] Awareness init failed:",g)}const Rt=A.toString();ut(Rt),He.current=Rt,Q(!1),f(!1),ve("ready"),t=()=>{try{try{z.current?.()}finally{z.current=null}L?.(),k?.();try{S.off("update",y)}catch{}if(J.current!=null&&(window.clearTimeout(J.current),J.current=null),Se.current=[],$&&$(),le&&le(),I&&Ie)try{I.off("change",Ie)}catch{}if(!w)try{j.leaveAwareness(d)}catch{}}finally{try{j.disconnect()}catch{}Je.current===j&&(Je.current=null),ne.current===S&&(ne.current=null),H.current===A&&(H.current=null)}}})().catch(r=>{console.error("[LatexPlugin] Sync init failed:",r),!e&&(ve("error"),$e(r instanceof Error?r.message:a("collaboration_failed")))}),()=>{e=!0,t?.()}},[d,_t,w,c,Qe,f,yt,a,O?.id,O?.username]);const Nt=s.useCallback(e=>{const t=be.current;if(!t)return!1;const r=t.getModel?.();if(!r)return!1;const i=Math.max(1,Number(r.getLineCount?.()??1)),l=Math.min(Math.max(1,Math.round(e||1)),i);return t.revealLineInCenter?.(l),t.setPosition?.({lineNumber:l,column:1}),t.setSelection?.({startLineNumber:l,startColumn:1,endLineNumber:l,endColumn:Number(r.getLineMaxColumn?.(l)??1)}),t.focus?.(),!0},[]),ae=s.useCallback(()=>{const e=Ye.current;e&&(e.fileId&&e.fileId!==d||Nt(e.line)&&(Ye.current=null))},[d,Nt]),q=s.useCallback(e=>{const t=be.current;if(!t||w)return;const r=t.getSelection?.();r&&(t.executeEdits?.("ds-latex-assist",[{range:r,text:e,forceMoveMarkers:!0}]),t.focus?.(),Q(!0),f(!0))},[w,f]),Xt=s.useCallback((e,t="\\cite")=>{const r=be.current,i=r?.getModel?.(),l=r?.getPosition?.();if(!r||!i||!l){q(`${t}{${e.key}}`);return}const o=i.getValueInRange({startLineNumber:l.lineNumber,startColumn:1,endLineNumber:l.lineNumber,endColumn:l.column}),N=/\\(?:cite|citet|citep|autocite|parencite)\{[^}]*$/i.test(o);q(N?e.key:`${t}{${e.key}}`),je(!1),re("")},[q]),Qt=s.useCallback((e,t="\\ref")=>{const r=be.current,i=r?.getModel?.(),l=r?.getPosition?.();if(!r||!i||!l){q(`${t}{${e.key}}`);return}const o=i.getValueInRange({startLineNumber:l.lineNumber,startColumn:1,endLineNumber:l.lineNumber,endColumn:l.column}),N=/\\(?:ref|eqref)\{[^}]*$/i.test(o);q(N?e.key:`${t}{${e.key}}`),je(!1),re("")},[q]),Gt=s.useCallback(e=>{q(e),Ve(!1),re("")},[q]),jt=s.useMemo(()=>{const e=de.trim().toLowerCase();return e?ue.filter(t=>[t.key,t.title,t.author,t.sourceFile].some(r=>String(r||"").toLowerCase().includes(e))).slice(0,12):ue.slice(0,12)},[de,ue]),St=s.useMemo(()=>{const e=de.trim().toLowerCase();return e?fe.filter(t=>[t.key,t.sourceFile].some(r=>String(r||"").toLowerCase().includes(e))).slice(0,10):fe.slice(0,10)},[de,fe]),Yt=te||ht,er=s.useCallback((e,t)=>{be.current=e;const r=H.current,i=ne.current,l=xt.current;if(!r||!i)return;const o=e.getModel?.();if(!o)return;const N=m=>{(t.languages.getLanguages?.()||[]).some(L=>L.id===m)||t.languages.register({id:m})};N("latex-ds"),N("bibtex-ds"),t.editor.setModelLanguage(o,Ce?"bibtex-ds":"latex-ds"),Le.current.forEach(m=>{try{m?.dispose?.()}catch{}}),Le.current=[t.languages.registerCompletionItemProvider("latex-ds",{triggerCharacters:["\\","{"],provideCompletionItems:(m,b)=>{const L=m.getValueInRange({startLineNumber:b.lineNumber,startColumn:1,endLineNumber:b.lineNumber,endColumn:b.column}),k=m.getWordUntilPosition(b),B=new t.Range(b.lineNumber,k.startColumn,b.lineNumber,k.endColumn);return/\\(?:cite|citet|citep|autocite|parencite)\{[^}]*$/i.test(L)?{suggestions:vt.current.slice(0,40).map(y=>({label:y.key,kind:t.languages.CompletionItemKind.Reference,insertText:y.key,detail:y.title||y.author||y.sourceFile,documentation:[y.author,y.title].filter(Boolean).join(" · "),range:B}))}:/\\(?:ref|eqref)\{[^}]*$/i.test(L)?{suggestions:kt.current.slice(0,40).map(y=>({label:y.key,kind:t.languages.CompletionItemKind.Reference,insertText:y.key,detail:y.sourceFile,range:B}))}:{suggestions:[]}}}),t.languages.registerCompletionItemProvider("bibtex-ds",{triggerCharacters:["@"],provideCompletionItems:(m,b)=>{const L=new t.Range(b.lineNumber,b.column,b.lineNumber,b.column);return{suggestions:at.map(k=>({label:k.id,kind:t.languages.CompletionItemKind.Snippet,insertText:k.snippet,insertTextRules:t.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:a(k.labelKey),range:L}))}}})],z.current?.(),me.current=!0;try{o.setValue(r.toString())}finally{me.current=!1}const S=m=>{if(!Array.isArray(m)||m.length===0)return;const b=[];let L=0;for(const k of m){const B=typeof k?.retain=="number"?k.retain:0;B&&(L+=B);const y=typeof k?.insert=="string"?k.insert:null;if(y!=null){const $=o.getPositionAt(L);b.push({range:new t.Range($.lineNumber,$.column,$.lineNumber,$.column),text:y,forceMoveMarkers:!0}),L+=y.length}const I=typeof k?.delete=="number"?k.delete:0;if(I){const $=o.getPositionAt(L),le=o.getPositionAt(L+I);b.push({range:new t.Range($.lineNumber,$.column,le.lineNumber,le.column),text:"",forceMoveMarkers:!0})}}if(b.length){me.current=!0;try{o.applyEdits(b)}finally{me.current=!1}}},A=m=>{m?.transaction?.origin===l&&(S(m.delta??[]),Q(!0))};r.observe(A);const j=o.onDidChangeContent(m=>{if(me.current||w)return;const b=Array.isArray(m?.changes)?m.changes:[];b.length&&(i.transact(()=>{const L=[...b].sort((k,B)=>(B.rangeOffset??0)-(k.rangeOffset??0));for(const k of L){const B=Number(k.rangeOffset??0),y=Number(k.rangeLength??0),I=String(k.text??"");y&&r.delete(B,y),I&&r.insert(B,I)}},"ds-monaco"),Q(!0))});z.current=()=>{try{j?.dispose?.()}catch{}try{r.unobserve(A)}catch{}},window.requestAnimationFrame(()=>{ae()})},[w,ae,Ce,f,a]);s.useEffect(()=>{we==="ready"&&ae()},[d,ae,Qe,we]);const et=s.useCallback(async()=>{if(!d||w)return!1;const e=H.current;if(!e)return!1;try{ke("saving");const t=String(e.toString?.()??""),r=await wr(d,t);return He.current=t,ke("idle"),Q(!1),f(!1),r?.updated_at&&dt(d,{updatedAt:r.updated_at,size:typeof r.size=="number"?r.size:void 0,mimeType:r.mime_type}),!0}catch(t){return console.error("[LatexPlugin] Save failed:",t),ke("error"),window.setTimeout(()=>ke("idle"),1400),!1}},[d,w,f,dt]),tr=s.useCallback(async e=>{if(!(!c||!x)&&!C&&!(U&&!w&&!await et()))try{oe(null),ye([]),Ue(null),G("queued");const t=await vr(c,x,{compiler:ce,auto:!!e?.auto,stop_on_first_error:!1});Te(t.build_id),_e(Fe(t.compiler)),G(t.status??"queued")}catch(t){console.error("[LatexPlugin] Compile failed:",t),oe(t instanceof Error?t.message:a("compile_request_failed")),G("error")}},[ce,w,U,x,c,et,a,C]);s.useEffect(()=>{if(!c||!x)return;const e=t=>{const r=t.detail;r&&(r.projectId!==c||r.folderId!==x||(r.buildId&&Te(r.buildId),G(r.status??"queued"),oe(r.errorMessage??null),ye([]),Ue(null)))};return window.addEventListener("ds:latex-build",e),()=>{window.removeEventListener("ds:latex-build",e)}},[x,c]),s.useEffect(()=>{if(!c||!x||W)return;let e=!1;return(async()=>{try{const t=await kr(c,x,1);if(e)return;const r=t?.[0];r?.build_id&&(Te(r.build_id),_e(Fe(r.compiler)),G(r.status??"idle"),oe(r.error_message??null),ye(Pt(r.errors,r.log_items)))}catch{}})(),()=>{e=!0}},[W,x,c]),s.useEffect(()=>{if(!c||!x||!W)return;let e=!1,t=null;const r=async()=>{try{const i=await Lr(c,x,W);if(e)return;if(_e(Fe(i.compiler)),G(i.status),oe(i.error_message??null),ye(Pt(i.errors,i.log_items)),i.status==="success"&&i.pdf_ready&&pt.current!==W)try{const l=await Cr(c,x,W);if(e)return;const o=URL.createObjectURL(l);if(se.current)try{URL.revokeObjectURL(se.current)}catch{}se.current=o,zt(o),pt.current=W}catch(l){console.warn("[LatexPlugin] Failed to fetch PDF:",l)}if(i.status==="error"&&i.log_ready&&!Ne)try{const l=await Ar(c,x,W);if(e)return;Ue(l)}catch(l){console.warn("[LatexPlugin] Failed to fetch log:",l)}(i.status==="queued"||i.status==="running")&&(t=window.setTimeout(r,1e3))}catch{if(e)return;t=window.setTimeout(r,1500)}};return r(),()=>{e=!0,t!=null&&window.clearTimeout(t)}},[W,x,Ne,c]),s.useEffect(()=>()=>{if(se.current){try{URL.revokeObjectURL(se.current)}catch{}se.current=null}},[]),s.useEffect(()=>{f(U)},[U,f]),s.useEffect(()=>{if(typeof window>"u")return;const e=window.matchMedia("(min-width: 1024px)"),t=e,r=()=>Zt(e.matches);return r(),typeof e.addEventListener=="function"?(e.addEventListener("change",r),()=>e.removeEventListener("change",r)):(t.addListener?.(r),()=>t.removeListener?.(r))},[]),s.useEffect(()=>{const e=wt.current;if(!e)return;let t=null;const r=new ResizeObserver(i=>{const l=i[0];l&&(t!=null&&window.cancelAnimationFrame(t),t=window.requestAnimationFrame(()=>{Vt(l.contentRect.width)}))});return r.observe(e),()=>{t!=null&&window.cancelAnimationFrame(t),r.disconnect()}},[]);const rr=s.useMemo(()=>`${F?F.replace(/\.tex$/i,""):"document"}.pdf`,[F]),ie=s.useMemo(()=>M.filter(e=>e.severity==="warning"),[M]),nr=s.useMemo(()=>a(`compiler_${ce}`),[ce,a]),Lt=s.useMemo(()=>w?{label:a("status_read_only"),className:"border-black/10 bg-white/60 text-muted-foreground dark:bg-white/[0.04] dark:border-white/10"}:p==="queued"||p==="running"?{label:a("status_compiling"),className:"border-[#8FA3B8]/30 bg-[#8FA3B8]/10 text-[#52667a] dark:bg-[#8FA3B8]/12 dark:text-[#c8d4df]"}:K==="saving"?{label:a("status_saving"),className:"border-[#A6B0B6]/30 bg-[#A6B0B6]/12 text-[#5c666b] dark:bg-[#A6B0B6]/12 dark:text-[#d8dde0]"}:U?{label:a("status_unsaved"),className:"border-[#B7A59A]/30 bg-[#B7A59A]/12 text-[#7e695d] dark:bg-[#B7A59A]/12 dark:text-[#eadfd8]"}:p==="error"?{label:a("status_compile_failed"),className:"border-red-400/30 bg-red-50/80 text-red-600 dark:bg-red-500/10 dark:text-red-200"}:{label:a("status_saved"),className:"border-[#9AA79A]/30 bg-[#9AA79A]/12 text-[#5f6b5f] dark:bg-[#9AA79A]/12 dark:text-[#dbe4db]"},[p,w,U,K,a]),he=s.useCallback(e=>{const t=Ft(_,e.path)??d??_.find(N=>N.name.toLowerCase()==="main.tex")?.id??_[0]?.id??null,r=t?_.find(N=>N.id===t)??null:null,i=r?.name||e.path||F||"main.tex",l=r?.path?st(r.path):e.path?st(e.path):"",o=e.severity==="warning"?"warning":"error";return{kind:"latex_error",tabId:h,fileId:t||void 0,resourceId:t||void 0,resourcePath:l&&l!=="/FILES"?l:void 0,resourceName:i,line:typeof e.line=="number"?Math.max(1,Number(e.line||1)):void 0,message:e.message,severity:o,excerpt:e.path||e.line?`${e.path||i}${e.line?`:${e.line}`:""}`:void 0,createdAt:new Date().toISOString()}},[d,F,_,h]),Ae=s.useCallback(e=>{const t=he(e);return X(h,t),t},[he,X,h]);s.useEffect(()=>{if(p==="success"){X(h,null);return}if(M.length===0){p==="error"&&X(h,null);return}const e=M.find(l=>l.severity!=="warning")??M[0]??null;if(!e)return;const t=nt.getState().activeIssueByTabId[h],r=t?.kind==="latex_error"?M.find(l=>Pe(he(l))===Pe(t))??null:null,i=he(r??e);t&&Pe(t)===Pe(i)||X(h,i)},[M,he,p,X,h]);const Ct=s.useCallback(e=>{const r=Ae(e)?.fileId??Ft(_,e.path)??d??_.find(l=>l.name.toLowerCase()==="main.tex")?.id??_[0]?.id??null;if(!r)return;const i=_.find(l=>l.id===r);if(Ye.current={fileId:r,line:Math.max(1,Number(e.line||1))},i?.name&&i.name!==F&&pe(i.name),r!==d){Be(r);return}ae()},[d,F,_,ae,Ae]),At=s.useCallback(e=>{const t=Ae(e),r=e.severity==="warning"?a("warning_badge"):a("error_badge"),i=t?.line&&t.resourceName?`${t.resourceName}:${t.line}`:t?.resourceName||e.path||F||"main.tex",l=t?.resourcePath||t?.resourceName||e.path||F||"main.tex",o=typeof t?.line=="number"&&Number.isFinite(t.line)?String(Math.max(1,t.line)):a("issue_unknown_line"),N=a("issue_action_prompt",{severity:r,branch:ft||a("issue_unknown_branch"),file:l,line:o,location:i,message:e.message});window.dispatchEvent(new CustomEvent("ds:copilot:prefill",{detail:{text:N,focus:!0}}))},[F,ft,Ae,a]),It=s.useCallback((e,t,r)=>{const i=!!(e.path||e.line)&&!!(d||_.length),l=`${e.path??r}-${e.line??"0"}-${t}`,o=n.jsxs(n.Fragment,{children:[n.jsx("span",{className:P("px-1.5 py-0.5 rounded-full text-[10px] uppercase border",e.severity==="warning"?"text-amber-700 border-amber-400/40 bg-amber-50/70 dark:bg-amber-500/10":"text-red-600 border-red-400/40 bg-red-50/70 dark:bg-red-500/10"),children:e.severity==="warning"?a("warning_badge"):a("error_badge")}),n.jsxs("span",{className:"text-muted-foreground font-mono",children:[e.path||"main.tex",e.line?`:${e.line}`:""]}),n.jsx("span",{className:"text-muted-foreground break-words",children:e.message}),i?n.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-muted-foreground/80",children:a("issue_hint_clickable")}):null]});return n.jsxs("div",{className:"flex items-start gap-2",children:[i?n.jsx("button",{type:"button",onClick:()=>Ct(e),className:"min-w-0 flex flex-1 items-start gap-2 rounded-lg px-2 py-1.5 text-left hover:bg-black/5 dark:hover:bg-white/[0.04]",title:e.line?a("issue_jump_to_line",{line:e.line}):a("issue_jump_to_file",{file:e.path||"main.tex"}),children:o}):n.jsx("div",{className:"min-w-0 flex flex-1 items-start gap-2 px-2 py-1.5",children:o}),n.jsx("div",{className:"flex shrink-0 items-center gap-1 pt-1",children:n.jsx("button",{type:"button",onClick:()=>At(e),className:"rounded-md border border-black/10 dark:border-white/10 bg-white/70 dark:bg-white/[0.05] px-2 py-1 text-[11px] font-medium text-muted-foreground hover:bg-black/5 dark:hover:bg-white/[0.08]",title:a("issue_action_ask_deepscientist"),children:a("issue_action_ask_deepscientist")})})]},l)},[d,_,At,Ct,a]),sr=!Z||Y<=D[0],ar=!Z||Y>=D[D.length-1],ir=()=>{const e=D.findIndex(r=>r>=Y),t=e===-1?D.length-1:e;t<=0||mt(D[t-1])},lr=()=>{const e=D.findIndex(r=>r>=Y),t=e===-1?D.length-1:e;t>=D.length-1||mt(D[t+1])},or=s.useMemo(()=>{if(!We||!De)return 1;const e=Math.max(We-32,120);return Math.max(e/De,.2)},[We,De])*Y,cr=s.useCallback(e=>{qt(e||ot.A4_WIDTH)},[]),dr=s.useCallback(e=>{if(!ee||!Ge.current||e.button!==0)return;e.preventDefault();const r=Ge.current.getBoundingClientRect(),i=e.clientX,l=r.width*ze,o=360,S=Math.max(r.width-320,o),A=document.body.style.cursor,j=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none",bt(!0);let m=null;const b=k=>{const B=l+(k.clientX-i),I=Math.min(Math.max(B,o),S)/r.width;m!=null&&window.cancelAnimationFrame(m),m=window.requestAnimationFrame(()=>{Kt(I)})},L=()=>{m!=null&&window.cancelAnimationFrame(m),bt(!1),document.body.style.cursor=A,document.body.style.userSelect=j,window.removeEventListener("pointermove",b),window.removeEventListener("pointerup",L)};window.addEventListener("pointermove",b),window.addEventListener("pointerup",L)},[ee,ze]);return n.jsx("div",{className:"h-full flex flex-col bg-white/70 dark:bg-black/30",children:n.jsxs("div",{ref:Ge,className:"flex-1 min-h-0 flex flex-col lg:flex-row",children:[n.jsxs("div",{className:P("min-h-0 flex flex-col min-w-0",ee?"lg:border-r-0":"border-b border-black/5 dark:border-white/10",qe?"transition-none":"transition-[flex-basis] duration-200 ease-out"),style:ee?{flexBasis:`${ze*100}%`,flexGrow:0,flexShrink:0}:void 0,children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-3 py-2 border-b border-black/5 dark:border-white/10",children:[n.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[n.jsx(yr,{className:"h-4 w-4 text-muted-foreground shrink-0"}),n.jsx("select",{className:P("h-8 rounded-lg px-2 text-sm bg-white/70 border border-black/10","dark:bg-white/[0.04] dark:border-white/10","min-w-[160px] max-w-[260px] truncate",w&&"opacity-70"),value:d??"",onChange:e=>{const t=e.target.value||null,r=_.find(i=>i.id===t);r&&pe(r.name),Be(t)},disabled:_.length===0,"aria-label":a("file_label"),title:F,children:_.map(e=>n.jsx("option",{value:e.id,children:e.name},e.id))})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:a("compiler_label")}),n.jsx("select",{className:P("h-8 rounded-lg px-2 text-sm bg-white/70 border border-black/10","dark:bg-white/[0.04] dark:border-white/10","min-w-[122px]",p==="queued"||p==="running"?"opacity-70":""),value:ce,onChange:e=>_e(Fe(e.target.value)),disabled:p==="queued"||p==="running","aria-label":a("compiler_label"),title:nr,children:zr.map(e=>n.jsx("option",{value:e,children:a(`compiler_${e}`)},e))})]}),Ce?null:n.jsxs("button",{type:"button",onClick:()=>{je(e=>{const t=!e;return t&&Ve(!1),t||re(""),t})},className:P("h-8 px-3 rounded-lg text-sm border inline-flex items-center gap-2","bg-white/70 border-black/10 hover:bg-white/90","dark:bg-white/[0.04] dark:border-white/10 dark:hover:bg-white/[0.08]",te&&"border-[#8FA3B8]/28 bg-[#8FA3B8]/12 text-[#405267]"),"aria-label":a("assist_references"),title:a("assist_references"),children:[n.jsx(_r,{className:"h-4 w-4"}),a("assist_references")]}),Ce?n.jsxs("button",{type:"button",onClick:()=>{Ve(e=>{const t=!e;return t&&je(!1),t||re(""),t})},className:P("h-8 px-3 rounded-lg text-sm border inline-flex items-center gap-2","bg-white/70 border-black/10 hover:bg-white/90","dark:bg-white/[0.04] dark:border-white/10 dark:hover:bg-white/[0.08]",ht&&"border-[#A99EBE]/28 bg-[#A99EBE]/12 text-[#564f6a]"),"aria-label":a("assist_bibtex"),title:a("assist_bibtex"),children:[n.jsx(Ur,{className:"h-4 w-4"}),a("assist_bibtex")]}):null,n.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[n.jsx("span",{className:P("text-xs px-2 py-0.5 rounded-full border",Lt.className),children:Lt.label}),n.jsx("button",{type:"button",onClick:et,disabled:w||K==="saving"||!U,className:P("h-8 px-3 rounded-lg text-sm font-medium border","bg-white/70 border-black/10 hover:bg-white/90","dark:bg-white/[0.04] dark:border-white/10 dark:hover:bg-white/[0.08]","disabled:opacity-50 disabled:cursor-not-allowed",U&&!w&&"border-black/20"),children:K==="saving"?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(ge,{className:"h-4 w-4 animate-spin"}),a("button_saving")]}):n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Nr,{className:"h-4 w-4"}),a("button_save")]})}),n.jsx("button",{type:"button",onClick:()=>void tr({auto:!1}),disabled:C||K==="saving"||p==="queued"||p==="running",className:P("h-8 px-3 rounded-lg text-sm font-medium border","bg-[#8FA3B8]/14 border-[#8FA3B8]/28 text-[#405267] hover:bg-[#8FA3B8]/20","dark:bg-[#8FA3B8]/14 dark:border-[#8FA3B8]/22 dark:text-[#dbe6ef] dark:hover:bg-[#8FA3B8]/20","disabled:opacity-50 disabled:cursor-not-allowed"),title:a(C?"compile_disabled_read_only":U&&!w?"button_save_and_compile":"button_compile"),children:p==="queued"||p==="running"?n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(ge,{className:"h-4 w-4 animate-spin"}),a("button_compiling")]}):n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(jr,{className:"h-4 w-4"}),a(U&&!w?"button_save_and_compile":"button_compile")]})})]})]}),Yt?n.jsxs("div",{className:"border-b border-black/5 dark:border-white/10 bg-black/[0.02] dark:bg-white/[0.02] px-3 py-3",children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-sm font-medium text-foreground",children:a(te?"assist_references_title":"assist_bibtex_title")}),n.jsx("div",{className:"text-xs text-muted-foreground",children:a(te?"assist_reference_hint":"assist_bibtex_hint")})]}),te?n.jsx("input",{value:de,onChange:e=>re(e.target.value),placeholder:a("assist_search_placeholder"),className:P("h-8 w-full rounded-lg border border-black/10 bg-white/80 px-3 text-sm","sm:w-[280px] dark:border-white/10 dark:bg-white/[0.05]")}):null]}),te?n.jsxs("div",{className:"mt-3 grid gap-3 lg:grid-cols-2",children:[n.jsxs("div",{className:"rounded-xl border border-black/5 bg-white/70 p-3 dark:border-white/10 dark:bg-white/[0.03]",children:[n.jsx("div",{className:"mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:a("assist_citations")}),n.jsx("div",{className:"space-y-2",children:jt.length>0?jt.map(e=>n.jsxs("button",{type:"button",onClick:()=>Xt(e),className:"w-full rounded-lg border border-black/5 bg-black/[0.02] px-3 py-2 text-left hover:bg-black/[0.04] dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/[0.05]",title:e.title||e.key,children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("span",{className:"font-mono text-xs text-foreground",children:e.key}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:a("assist_insert_citation")})]}),e.title?n.jsx("div",{className:"mt-1 truncate text-xs text-muted-foreground",children:e.title}):null,n.jsx("div",{className:"mt-1 truncate text-[10px] text-muted-foreground/80",children:e.author||e.sourceFile})]},`${e.sourceFile}:${e.key}`)):n.jsx("div",{className:"rounded-lg border border-dashed border-black/10 px-3 py-4 text-xs text-muted-foreground dark:border-white/10",children:a("assist_empty_citations")})})]}),n.jsxs("div",{className:"rounded-xl border border-black/5 bg-white/70 p-3 dark:border-white/10 dark:bg-white/[0.03]",children:[n.jsx("div",{className:"mb-2 text-xs font-medium uppercase tracking-wide text-muted-foreground",children:a("assist_labels")}),n.jsx("div",{className:"space-y-2",children:St.length>0?St.map(e=>n.jsxs("button",{type:"button",onClick:()=>Qt(e),className:"w-full rounded-lg border border-black/5 bg-black/[0.02] px-3 py-2 text-left hover:bg-black/[0.04] dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/[0.05]",title:e.key,children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("span",{className:"font-mono text-xs text-foreground",children:e.key}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:a("assist_insert_reference")})]}),n.jsx("div",{className:"mt-1 truncate text-[10px] text-muted-foreground/80",children:e.sourceFile})]},`${e.sourceFile}:${e.key}`)):n.jsx("div",{className:"rounded-lg border border-dashed border-black/10 px-3 py-4 text-xs text-muted-foreground dark:border-white/10",children:a("assist_empty_labels")})})]})]}):n.jsx("div",{className:"mt-3 grid gap-2 md:grid-cols-3",children:at.length>0?at.map(e=>n.jsxs("button",{type:"button",onClick:()=>Gt(e.snippet),className:"rounded-xl border border-black/5 bg-white/70 px-3 py-3 text-left hover:bg-white/90 dark:border-white/10 dark:bg-white/[0.03] dark:hover:bg-white/[0.05]",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("span",{className:"font-mono text-sm text-foreground",children:["@",e.id]}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:a("assist_insert_snippet")})]}),n.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:a(e.labelKey)})]},e.id)):n.jsx("div",{className:"rounded-lg border border-dashed border-black/10 px-3 py-4 text-xs text-muted-foreground dark:border-white/10",children:a("assist_empty_bib")})})]}):null,n.jsx("div",{className:"flex-1 min-h-0",children:we==="loading"?n.jsxs("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:[n.jsx(ge,{className:"h-5 w-5 animate-spin mr-2"}),a("connecting")]}):we==="error"?n.jsx("div",{className:"h-full flex items-center justify-center text-sm text-red-600",children:Dt??a("load_files_failed")}):n.jsx(Dr,{defaultValue:Ut,language:"plaintext",theme:$t?"vs-dark":"light",onMount:(e,t)=>{try{er(e,t)}catch(r){console.error("[LatexPlugin] Failed to bind editor:",r)}},options:{readOnly:w,minimap:{enabled:!1},wordWrap:"on",fontSize:13,scrollBeyondLastLine:!1}},`${d??"latex"}:${Qe}`)}),p==="error"?n.jsxs("div",{className:"border-t border-black/5 dark:border-white/10 p-4 text-sm max-h-[35vh] overflow-auto",children:[n.jsxs("div",{className:"flex items-start gap-2 text-red-600",children:[n.jsx(Et,{className:"h-4 w-4 mt-0.5"}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"font-medium",children:a("compile_failed_title")}),n.jsx("div",{className:"text-xs opacity-90 break-words",children:Wt??a("compile_failed_fallback")})]})]}),M.length>0?n.jsxs("div",{className:"mt-3 space-y-2 text-xs",children:[M.slice(0,12).map((e,t)=>It(e,t,"error")),M.length>12?n.jsx("div",{className:"text-muted-foreground",children:a("more_items",{count:M.length-12})}):null]}):null,Ne?n.jsx("pre",{className:"mt-3 text-xs whitespace-pre-wrap break-words text-muted-foreground max-h-[40vh] overflow-auto rounded-lg border border-black/10 dark:border-white/10 bg-white/60 dark:bg-white/[0.03] p-3",children:Ne.slice(0,8e3)}):null]}):null,p!=="error"&&ie.length>0?n.jsxs("div",{className:"border-t border-black/5 dark:border-white/10 p-4 text-sm max-h-[35vh] overflow-auto",children:[n.jsxs("div",{className:"flex items-start gap-2 text-amber-700",children:[n.jsx(Et,{className:"h-4 w-4 mt-0.5"}),n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"font-medium",children:a("warnings_title")}),n.jsx("div",{className:"text-xs opacity-90 break-words",children:a("warnings_reported",{count:ie.length,suffix:Mt==="zh-CN"||ie.length===1?"":"s"})})]})]}),n.jsxs("div",{className:"mt-3 space-y-2 text-xs",children:[ie.slice(0,12).map((e,t)=>It(e,t,"warning")),ie.length>12?n.jsx("div",{className:"text-muted-foreground",children:a("more_items",{count:ie.length-12})}):null]})]}):null]}),ee?n.jsx("div",{className:P("hidden lg:flex w-3 relative items-stretch cursor-col-resize",qe?"bg-primary/10":"hover:bg-black/5 dark:hover:bg-white/[0.06]"),onPointerDown:dr,role:"separator","aria-orientation":"vertical","aria-label":a("resize_panels_aria"),children:n.jsx("div",{className:P("absolute inset-y-0 left-1/2 w-px",qe?"bg-primary/60":"bg-black/10 dark:bg-white/10")})}):null,n.jsx("div",{className:"min-h-0 flex flex-1 flex-col min-w-0",children:n.jsxs("div",{ref:wt,className:"relative flex-1 min-h-0 overflow-hidden",children:[n.jsxs("div",{className:P("absolute z-10 flex flex-col gap-2",ee?"left-3 top-1/2 -translate-y-1/2":"right-3 top-3","rounded-full border border-black/10 bg-white/80 p-1 shadow-sm","backdrop-blur dark:border-white/10 dark:bg-black/40"),onPointerDown:e=>e.stopPropagation(),children:[n.jsx("button",{type:"button",onClick:ir,disabled:sr,className:P("h-7 w-7 rounded-full flex items-center justify-center","text-muted-foreground hover:text-foreground hover:bg-black/5","dark:hover:bg-white/[0.08]","disabled:opacity-40 disabled:cursor-not-allowed"),"aria-label":a("zoom_out"),title:a("zoom_out"),children:n.jsx($r,{className:"h-4 w-4"})}),n.jsx("div",{className:"text-[11px] font-medium text-muted-foreground text-center",children:Z?`${Math.round(or*100)}%`:"--"}),n.jsx("button",{type:"button",onClick:lr,disabled:ar,className:P("h-7 w-7 rounded-full flex items-center justify-center","text-muted-foreground hover:text-foreground hover:bg-black/5","dark:hover:bg-white/[0.08]","disabled:opacity-40 disabled:cursor-not-allowed"),"aria-label":a("zoom_in"),title:a("zoom_in"),children:n.jsx(Tr,{className:"h-4 w-4"})}),n.jsx("a",{href:Z??"#",download:rr,className:P("h-7 w-7 rounded-full text-xs font-medium border flex items-center justify-center","bg-white/70 border-black/10 hover:bg-white/90","dark:bg-white/[0.04] dark:border-white/10 dark:hover:bg-white/[0.08]",!Z&&"opacity-50 pointer-events-none"),title:a("download_pdf"),children:n.jsx(Sr,{className:"h-3.5 w-3.5"})})]}),Z?n.jsx(Pr,{url:Z,workerSrc:Mr,cMapUrl:Fr,cMapPacked:!0,beforeLoad:n.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:[n.jsx(ge,{className:"h-5 w-5 animate-spin mr-2"}),a("loading_pdf")]}),children:e=>n.jsx(Kr,{pdfDocument:e,zoomFactor:Y,highlights:Ht,onPageWidth:cr})}):p==="queued"||p==="running"?n.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:[n.jsx(ge,{className:"h-5 w-5 animate-spin mr-2"}),a("preview_compiling")]}):p==="error"?n.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:a("preview_no_output")}):n.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:a("preview_empty")})]})})]})})}export{nn as default};
|
package/src/ui/dist/assets/{MarkdownViewerPlugin-DKqVfKyW.js → MarkdownViewerPlugin-Dy1NE2dI.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{u as E,a as F,a8 as I,c as $,j as e,L as T,C as L,a9 as R,
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CHzJ2xtB.js","assets/plugin-monaco-C8UgLomw.js","assets/plugin-terminal-MXFIPun8.js","assets/plugin-notebook-JRhysCqj.js","assets/index-DH-zxoZ3.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as E,a as F,a8 as I,c as $,j as e,L as T,C as L,a9 as R,f as P,E as H,b as k,d as O,e as W,M as A,_ as V}from"./index-CHzJ2xtB.js";import{r as n,R as G}from"./plugin-monaco-C8UgLomw.js";import{C as q}from"./code-DbsmSd3Y.js";import"./plugin-notebook-JRhysCqj.js";import"./plugin-terminal-MXFIPun8.js";function B(t){return t?/\.mdx$/i.test(t.trim()):!1}function K(t){if(!t.startsWith("---"))return t;const i=t.match(/^---\s*\n[\s\S]*?\n---\s*\n?/);return i?t.slice(i[0].length):t}function U(t,i={}){if(!i.isMdx)return t;const l=K(t).split(/\r?\n/),r=[];let a=!1,c=!1;for(const s of l){const o=s.trim();if(/^(```|~~~)/.test(o)){a=!a,c=!0,r.push(s);continue}if(a){r.push(s);continue}if(!c){if(!o||/^(import|export)\s/.test(o)||/^\{\/\*.*\*\/\}$/.test(o))continue;c=!0}/^\{\/\*.*\*\/\}$/.test(o)||r.push(s)}return r.join(`
|
|
3
3
|
`)}const z=`# DeepScientist Markdown Viewer
|
|
4
4
|
|
|
5
5
|
Welcome to the **Markdown Viewer** plugin. This viewer supports [GitHub Flavored Markdown](https://github.github.com/gfm/) with additional features.
|
|
@@ -125,4 +125,4 @@ $$
|
|
|
125
125
|
4. 使用复制按钮复制源内容
|
|
126
126
|
|
|
127
127
|
祝你写作顺利!:rocket:
|
|
128
|
-
`;function te({context:t,tabId:i,setDirty:y,setTitle:l}){const{t:r,language:a}=E("markdown_viewer"),c=F(
|
|
128
|
+
`;function te({context:t,tabId:i,setDirty:y,setTitle:l}){const{t:r,language:a}=E("markdown_viewer"),c=F(x=>x.updateTabState),[s,o]=n.useState(""),[j,f]=n.useState(!0),[h,g]=n.useState(null),[M,w]=n.useState(!1),[d,b]=n.useState("rendered"),u=t.resourceName||t.resourcePath||"Untitled.md",m=B(u),v=U(s,{isMdx:m}),N=G.useMemo(()=>I(t.resourceId),[t.resourceId]);n.useEffect(()=>{l(u)},[u,l]),n.useEffect(()=>{c(i,{contentKind:m?"mdx":"markdown",documentMode:d,isReadOnly:!0})},[m,i,c,d]),n.useEffect(()=>{(async()=>{f(!0),g(null);try{if(!t.resourceId){o(a==="zh-CN"?Q:z),f(!1);return}const{getFileContent:p}=await V(async()=>{const{getFileContent:S}=await import("./index-CHzJ2xtB.js").then(_=>_.d8);return{getFileContent:S}},__vite__mapDeps([0,1,2,3,4])),D=await p(t.resourceId);o(D)}catch(p){g(p instanceof Error?p.message:r("load_failed"))}finally{f(!1)}})()},[t.resourceId,a,r]);const C=n.useCallback(async()=>{await $(s)&&(w(!0),setTimeout(()=>w(!1),2e3))},[s]);return j?e.jsx("div",{className:"flex items-center justify-center h-full bg-background",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-muted-foreground",children:[e.jsx(T,{className:"w-8 h-8 animate-spin"}),e.jsx("span",{children:r("loading")})]})}):h?e.jsx("div",{className:"flex items-center justify-center h-full bg-background",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 text-destructive",children:[e.jsx(L,{className:"w-8 h-8"}),e.jsx("span",{children:h}),e.jsx("button",{className:"px-4 py-2 text-sm bg-destructive/10 hover:bg-destructive/20 rounded-lg transition-colors",onClick:()=>window.location.reload(),children:r("retry")})]})}):e.jsxs("div",{className:"flex flex-col h-full bg-background text-foreground",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:R}}),e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(P,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-foreground",children:u}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:m?"MDX":"Markdown"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("div",{className:"flex items-center border border-border rounded-md mr-2",children:[e.jsx("button",{onClick:()=>b("rendered"),className:k("p-2 rounded-l-md transition-colors",d==="rendered"?"bg-primary text-primary-foreground":"hover:bg-accent text-muted-foreground"),title:r("rendered_view"),children:e.jsx(H,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>b("source"),className:k("p-2 rounded-r-md transition-colors",d==="source"?"bg-primary text-primary-foreground":"hover:bg-accent text-muted-foreground"),title:r("source_view"),children:e.jsx(q,{className:"w-4 h-4"})})]}),e.jsx("button",{onClick:C,className:"p-2 rounded hover:bg-accent transition-colors text-muted-foreground hover:text-foreground",title:r("copy_source"),children:M?e.jsx(O,{className:"w-4 h-4 text-green-500"}):e.jsx(W,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:d==="rendered"?e.jsx("div",{className:"max-w-4xl mx-auto p-8",children:e.jsx(A,{content:v,questContext:N})}):e.jsx("pre",{className:"p-4 font-mono text-sm whitespace-pre-wrap",children:s})})]})}export{te as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{t as F,ad as R,i as O,ae as D,J as m,B as o,j as t,S,z as A,af as C,ag as V,ah as _,ai as E,aj as X,f as w,ak as W,al as q,b as P}from"./index-CHzJ2xtB.js";import{r as f}from"./plugin-monaco-C8UgLomw.js";import"./plugin-notebook-JRhysCqj.js";import"./plugin-terminal-MXFIPun8.js";/**
|
|
2
2
|
* @license lucide-react v0.511.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -10,4 +10,4 @@ import{y as F,ac as O,m as R,ad as D,f as m,s as o,j as t,k as S,O as A,ae as C,
|
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
11
|
*/const $=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],z=F("scroll-text",$);function G(d){const a=d.customData?.projectId;return typeof a=="string"?a:null}function U(d,a){const r=d.trim();return!r||r.includes(".")?r:`${r}${a}`}function K(d){const a=U(d,".md"),p=`# ${a.replace(/\.md$/i,"")}
|
|
12
12
|
|
|
13
|
-
`;return new File([p],a,{type:"text/markdown"})}function T(d){const a=new Date().toISOString().slice(0,10),r=Math.random().toString(36).slice(2,6);return`${d}-${a}-${r}`}const H=[{id:o.SEARCH,title:"Search",description:"Find files by name or path.",icon:S,badge:"tool",requiresProject:!0},{id:"@ds/plugin-analysis",title:"Analysis",description:"Reusable prompts and analysis recipes.",icon:A,badge:"tool",requiresProject:!0},{id:o.CLI,title:"CLI",description:"Remote CLI sessions and agent tooling.",icon:C,badge:"tool",requiresProject:!0},{id:o.SETTINGS,title:"Settings",description:"Quest-focused settings and workspace preferences.",icon:V,badge:"system"},{id:"@ds/plugin-marketplace",title:"Plugin Marketplace",description:"Browse and organize installed plugins.",icon:_,badge:"system"}],
|
|
13
|
+
`;return new File([p],a,{type:"text/markdown"})}function T(d){const a=new Date().toISOString().slice(0,10),r=Math.random().toString(36).slice(2,6);return`${d}-${a}-${r}`}const H=[{id:o.SEARCH,title:"Search",description:"Find files by name or path.",icon:S,badge:"tool",requiresProject:!0},{id:"@ds/plugin-analysis",title:"Analysis",description:"Reusable prompts and analysis recipes.",icon:A,badge:"tool",requiresProject:!0},{id:o.CLI,title:"CLI",description:"Remote CLI sessions and agent tooling.",icon:C,badge:"tool",requiresProject:!0},{id:o.SETTINGS,title:"Settings",description:"Quest-focused settings and workspace preferences.",icon:V,badge:"system"},{id:"@ds/plugin-marketplace",title:"Plugin Marketplace",description:"Browse and organize installed plugins.",icon:_,badge:"system"}],J=[{id:o.NOTEBOOK,title:"Notebook",description:"Create a new markdown notebook file.",icon:E,badge:"authoring",requiresProject:!0,openLabel:"New"},{id:o.LATEX,title:"LaTeX",description:"Create a new LaTeX project folder.",icon:X,badge:"authoring",requiresProject:!0,openLabel:"New"}],Q=[{id:o.PDF_VIEWER,title:"PDF Viewer",description:"View and annotate PDFs with highlights.",icon:w,badge:"pdf",openMode:"disabled",openLabel:"Auto",disabledReason:"Opens when you select a PDF file."},{id:o.PDF_MARKDOWN,title:"PDF Markdown",description:"Read MinerU Markdown output from PDFs.",icon:W,badge:"pdf",openMode:"disabled",openLabel:"Auto",disabledReason:"Opens after selecting a PDF and switching to Markdown view."}],Y=[{id:o.CODE_EDITOR,title:"Code Editor",description:"Monaco editor with autosave.",icon:M,badge:"viewer",openMode:"disabled",openLabel:"Auto",disabledReason:"Opens when you select a code file."},{id:o.CODE_VIEWER,title:"Code Viewer",description:"Read-only viewer with syntax highlighting.",icon:M,badge:"viewer",openMode:"disabled",openLabel:"Auto",disabledReason:"Opens when you select a supported code file."},{id:o.MARKDOWN_VIEWER,title:"Markdown Viewer",description:"Render Markdown with GFM + math.",icon:z,badge:"viewer",openMode:"disabled",openLabel:"Auto",disabledReason:"Opens when you select a Markdown file."},{id:o.TEXT_VIEWER,title:"Text Viewer",description:"Plain text viewer with search tools.",icon:w,badge:"viewer",openMode:"disabled",openLabel:"Auto",disabledReason:"Opens when you select a text file."},{id:o.IMAGE_VIEWER,title:"Image Viewer",description:"Zoom, pan, and inspect images.",icon:q,badge:"viewer",openMode:"disabled",openLabel:"Auto",disabledReason:"Opens when you select an image file."},{id:"@ds/plugin-doc-viewer",title:"Document Viewer",description:"Preview Word, Excel, and PowerPoint files.",icon:w,badge:"viewer",openMode:"disabled",openLabel:"Auto",disabledReason:"Opens when you select a document file."}],Z=[{id:"panel:arxiv",title:"ArXiv Import",description:"Import papers from arXiv into your workspace.",icon:E,badge:"integration",openMode:"disabled",openLabel:"Use sidebar",disabledReason:"Use the ArXiv panel in the left sidebar."}],ee=[{id:"workspace-tools",title:"Workspace tools",subtitle:"Openable as tabs",plugins:H},{id:"authoring",title:"Authoring",subtitle:"Notes and documents",plugins:J},{id:"pdf-tools",title:"PDF workflow",subtitle:"View, extract, and publish",plugins:Q},{id:"file-viewers",title:"Viewers & editors",subtitle:"Auto-picked based on file type",plugins:Y},{id:"integrations",title:"Integrations",subtitle:"External sources",plugins:Z}];function ne({context:d,setTitle:a}){f.useEffect(()=>a("Plugin Marketplace"),[a]);const r=R(),p=O(e=>e.openTab),{openFileInTab:j}=D(),y=m(e=>e.projectId),N=m(e=>e.loadFiles),k=m(e=>e.upload),v=m(e=>e.createLatexProject),x=m(e=>e.highlightFile),s=G(d),h=f.useCallback(async()=>s?(y!==s&&await N(s),!0):!1,[N,s,y]),L=f.useCallback(async e=>{if(e.openMode==="disabled"||e.requiresProject&&!s)return;if(e.id===o.SETTINGS){r("/settings");return}if(e.id===o.NOTEBOOK){try{if(!await h()||!s)return;const c=T("Notebook"),n=K(c),b=await k(null,[n]),u=b.find(g=>g.type==="file")||b[0];u&&(x(u.id),await j(u,{customData:{projectId:s}}))}catch(l){console.error("[MarketplacePlugin] Failed to create notebook file:",l)}return}if(e.id===o.LATEX){try{if(!await h()||!s)return;const c=T("LaTeX"),n=await v(null,c);x(n.id),p({pluginId:e.id,context:{type:"custom",resourceId:n.id,resourceName:n.name,customData:{projectId:s,latexFolderId:n.id,mainFileId:n.latex?.mainFileId??null}},title:n.name})}catch(l){console.error("[MarketplacePlugin] Failed to create LaTeX project:",l)}return}const i={type:e.contextType??"custom",resourceName:e.resourceName??e.title,resourcePath:e.resourcePath,mimeType:e.mimeType,customData:s?{projectId:s,...e.customData??{}}:e.customData};p({pluginId:e.id,context:i,title:e.tabTitle??e.resourceName??e.title})},[v,h,x,j,p,s,k,r]);return t.jsx("div",{className:"h-full",children:t.jsxs("div",{className:"max-w-5xl",children:[t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:"Plugin Marketplace"}),t.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Browse built-in plugins and jump straight in. File-based viewers open automatically when you select a file."})]}),t.jsx("div",{className:"hidden sm:flex items-center gap-2 text-xs text-muted-foreground",children:t.jsx("span",{className:"px-2 py-1 rounded-full border border-border bg-muted/30",children:"Built-in"})})]}),ee.map(e=>t.jsxs("div",{className:"mt-8",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-sm font-semibold text-foreground",children:e.title}),e.subtitle?t.jsx("div",{className:"text-xs text-muted-foreground",children:e.subtitle}):null]}),t.jsx("div",{className:"mt-3 grid grid-cols-1 md:grid-cols-2 gap-4",children:e.plugins.map(i=>{const l=i.icon,c=i.id==="@ds/plugin-marketplace",n=i.requiresProject&&!s,b=i.openMode!=="disabled"||n,u=c||n,g=c?"You're here":n?"Requires project":i.openLabel??"Open",I=n?"Open a project to use this plugin.":i.disabledReason;return t.jsxs("div",{className:P("rounded-2xl border border-border bg-card/90 backdrop-blur p-5","shadow-sm hover:shadow-md transition-shadow"),children:[t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[t.jsx("span",{className:"inline-flex h-10 w-10 items-center justify-center rounded-xl bg-muted text-foreground",children:t.jsx(l,{className:"h-5 w-5"})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-sm font-semibold text-foreground",children:i.title}),t.jsx("div",{className:"mt-0.5 text-xs text-muted-foreground",children:i.description}),t.jsx("div",{className:"mt-2 text-[11px] font-mono text-muted-foreground truncate",children:i.id})]})]}),t.jsx("span",{className:"shrink-0 px-2 py-1 rounded-full border border-border bg-muted/30 text-[10px] text-muted-foreground",children:i.badge??"built-in"})]}),t.jsxs("div",{className:"mt-4",children:[b?t.jsx("button",{type:"button",onClick:()=>void L(i),disabled:u,className:P("inline-flex items-center justify-center px-3 py-1.5 rounded-xl text-sm","border border-border bg-background hover:bg-accent/40 transition-colors text-foreground",u&&"opacity-50 cursor-not-allowed"),children:g}):t.jsx("span",{className:"inline-flex items-center px-3 py-1.5 rounded-xl text-xs border border-border bg-muted/30 text-muted-foreground",children:i.openLabel??"Auto"}),I?t.jsx("div",{className:"mt-2 text-[11px] text-muted-foreground",children:I}):null]})]},i.id)})})]},e.id)),t.jsx("div",{className:"mt-8 text-xs text-muted-foreground",children:"Want external plugins? That's next: sandboxing, permissions, and a loader that can fetch + verify bundles."})]})})}export{ne as default};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import{t as N,j as e,al as Rt,bv as Tt,bw as Pt,bx as Mt,by as St,bz as Ue,bA as ee,bB as Ve,bC as qe,bD as Ye,bE as _t,bF as It,bG as Dt,bH as zt,bI as Ot,bJ as Lt,bK as Ft,bL as Bt,b as Y,a6 as L,h as Ke,d as de,aj as Ht,a_ as $t,bM as Ut,bN as V,bO as Vt,bP as qt,u as ye,k as Yt,Q as be,L as We,e as Kt,C as Wt,J as Gt,a8 as Qt,bQ as Jt,bR as Xt,bS as Se,U as _e}from"./index-CHzJ2xtB.js";import{r as c}from"./plugin-monaco-C8UgLomw.js";import{m as Zt,l as eo,w as le,P as Ge,g as Z,s as ie,q as to,u as ge,r as Ie,d as oo,J as xe,U as no,I as ro,T as so,B as ao,O as io,S as co,K as lo,G as De,c as uo,i as fo}from"./NotebookEditor-WFyd8Ybt.js";import{D as po,e as mo,a as ze,m as ho,u as D,f as go,C as xo}from"./plugin-notebook-JRhysCqj.js";import{P as vo}from"./project-sync-DPmWKmKD.js";import{S as Qe}from"./index-BsO46tJA.js";import{C as we}from"./code-DbsmSd3Y.js";import{u as bo,F as yo}from"./file-diff-panel-DsvyRz47.js";/**
|
|
2
|
+
* @license lucide-react v0.511.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const wo=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ko=N("arrow-down",wo);/**
|
|
7
|
+
* @license lucide-react v0.511.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const jo=[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]],No=N("bold",jo);/**
|
|
12
|
+
* @license lucide-react v0.511.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const Co=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]],ke=N("heading-1",Co);/**
|
|
17
|
+
* @license lucide-react v0.511.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const Ao=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]],Je=N("heading-2",Ao);/**
|
|
22
|
+
* @license lucide-react v0.511.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const Eo=[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]],Xe=N("heading-3",Eo);/**
|
|
27
|
+
* @license lucide-react v0.511.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const Ro=[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]],To=N("italic",Ro);/**
|
|
32
|
+
* @license lucide-react v0.511.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const Po=[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]],Ze=N("list-ordered",Po);/**
|
|
37
|
+
* @license lucide-react v0.511.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const Mo=[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]],et=N("list",Mo);/**
|
|
42
|
+
* @license lucide-react v0.511.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/const So=[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]],_o=N("message-square-plus",So);/**
|
|
47
|
+
* @license lucide-react v0.511.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/const Io=[["path",{d:"M5 12h14",key:"1ays0h"}]],Oe=N("minus",Io);/**
|
|
52
|
+
* @license lucide-react v0.511.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const Do=[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]],zo=N("strikethrough",Do);/**
|
|
57
|
+
* @license lucide-react v0.511.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/const Oo=[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]],Lo=N("table-2",Oo);/**
|
|
62
|
+
* @license lucide-react v0.511.0 - ISC
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the ISC license.
|
|
65
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/const Fo=[["path",{d:"M17 6H3",key:"16j9eg"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 18H8",key:"1wfozv"}],["path",{d:"M3 12v6",key:"fv4c87"}]],tt=N("text-quote",Fo);/**
|
|
67
|
+
* @license lucide-react v0.511.0 - ISC
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the ISC license.
|
|
70
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
+
*/const Bo=[["path",{d:"M15 18H3",key:"olowqp"}],["path",{d:"M17 6H3",key:"16j9eg"}],["path",{d:"M21 12H3",key:"2avoz0"}]],ot=N("text",Bo);/**
|
|
72
|
+
* @license lucide-react v0.511.0 - ISC
|
|
73
|
+
*
|
|
74
|
+
* This source code is licensed under the ISC license.
|
|
75
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
+
*/const Ho=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]],$o=N("trash",Ho);/**
|
|
77
|
+
* @license lucide-react v0.511.0 - ISC
|
|
78
|
+
*
|
|
79
|
+
* This source code is licensed under the ISC license.
|
|
80
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
+
*/const Uo=[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]],Vo=N("twitter",Uo);/**
|
|
82
|
+
* @license lucide-react v0.511.0 - ISC
|
|
83
|
+
*
|
|
84
|
+
* This source code is licensed under the ISC license.
|
|
85
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
+
*/const qo=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],Yo=N("underline",qo);/**
|
|
87
|
+
* @license lucide-react v0.511.0 - ISC
|
|
88
|
+
*
|
|
89
|
+
* This source code is licensed under the ISC license.
|
|
90
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
+
*/const Ko=[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]],Wo=N("youtube",Ko),Go=new Set([".md",".markdown",".mdx"]),Qo=new Set(["text/markdown","text/x-markdown"]);function Jo(t){if(!t)return null;const n=t.lastIndexOf(".");return n<0?null:t.slice(n).toLowerCase()}function Xo(t,n){if(n&&Qo.has(n))return!0;const o=Jo(t);return o?Go.has(o):!1}function Zo(t){const n=t.customData?.docKind;if(n==="markdown"||n==="notebook")return n;if(t.type==="notebook")return"notebook";const o=t.customData,a=typeof t.mimeType=="string"?t.mimeType:typeof o?.mimeType=="string"?o.mimeType:typeof o?.fileMeta?.mimeType=="string"?o.fileMeta.mimeType:void 0;return Xo(t.resourceName,a)?"markdown":"notebook"}const ve="ds-remote";async function en(t){const{projectId:n,notebookId:o,readonly:a=!1,onStatus:i,onReset:r}=t,l=new vo(n,{authMode:"user",docKind:"notebook"}),d=new po;let p=!1,m=null,y=null,h=[];const v=b=>{i&&(i(b),b==="saved"&&(y!=null&&window.clearTimeout(y),y=window.setTimeout(()=>i("idle"),1500)))},M=()=>{m!=null&&window.clearTimeout(m),m=window.setTimeout(()=>void x(),250)},x=async()=>{if(p||a||h.length===0)return;const b=h;h=[];try{v("saving");const k=b.length===1?b[0]:ho(b);await l.pushDocUpdate(o,k),v("saved")}catch(k){console.error("[NovelYjsProvider] Failed to push update:",k),v("error")}};await l.connect();const C=await l.loadDoc(o,mo(d));C?.missing&&ze(d,C.missing,ve);const B=l.onDocUpdate(b=>{b.docId===o&&ze(d,b.update,ve)}),P=l.onDocReset(b=>{b.docId===o&&r?.({timestamp:b.timestamp,reason:b.reason,actorUserId:b.actorUserId??null})}),T=(b,k)=>{k!==ve&&(a||(h.push(b),M()))};return d.on("update",T),{ydoc:d,dispose:()=>{p=!0,m!=null&&window.clearTimeout(m),y!=null&&window.clearTimeout(y),d.off("update",T),B?.(),P?.(),l.disconnect()}}}function tn(t){return[{title:"Send Feedback",description:"Let us know how we can improve.",icon:e.jsx(_o,{size:18}),command:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).run(),window.open("/feedback","_blank")}},{title:"Text",description:"Just start typing with plain text.",searchTerms:["p","paragraph"],icon:e.jsx(ot,{size:18}),command:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).toggleNode("paragraph","paragraph").run()}},{title:"To-do List",description:"Track tasks with a to-do list.",searchTerms:["todo","task","list","check","checkbox"],icon:e.jsx(Qe,{size:18}),command:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).toggleTaskList().run()}},{title:"Heading 1",description:"Big section heading.",searchTerms:["title","big","large"],icon:e.jsx(ke,{size:18}),command:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).setNode("heading",{level:1}).run()}},{title:"Heading 2",description:"Medium section heading.",searchTerms:["subtitle","medium"],icon:e.jsx(Je,{size:18}),command:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).setNode("heading",{level:2}).run()}},{title:"Heading 3",description:"Small section heading.",searchTerms:["subtitle","small"],icon:e.jsx(Xe,{size:18}),command:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).setNode("heading",{level:3}).run()}},{title:"Bullet List",description:"Create a simple bullet list.",searchTerms:["unordered","point"],icon:e.jsx(et,{size:18}),command:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).toggleBulletList().run()}},{title:"Numbered List",description:"Create a list with numbering.",searchTerms:["ordered"],icon:e.jsx(Ze,{size:18}),command:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).toggleOrderedList().run()}},{title:"Quote",description:"Capture a quote.",searchTerms:["blockquote"],icon:e.jsx(tt,{size:18}),command:({editor:n,range:o})=>n.chain().focus().deleteRange(o).toggleNode("paragraph","paragraph").toggleBlockquote().run()},{title:"Code",description:"Capture a code snippet.",searchTerms:["codeblock"],icon:e.jsx(we,{size:18}),command:({editor:n,range:o})=>n.chain().focus().deleteRange(o).toggleCodeBlock().run()},{title:"Table",description:"Insert a table with rows and columns.",searchTerms:["table","grid","spreadsheet","data"],icon:e.jsx(Lo,{size:18}),command:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).insertTable({rows:3,cols:3,withHeaderRow:!0}).run()}},{title:"Image",description:"Upload an image from your computer.",searchTerms:["photo","picture","media"],icon:e.jsx(Rt,{size:18}),command:({editor:n,range:o})=>{n.chain().focus().deleteRange(o).run();const a=document.createElement("input");a.type="file",a.accept="image/*",a.onchange=async()=>{if(a.files?.length){const i=a.files[0];await t(i,n)}},a.click()}},{title:"Youtube",description:"Embed a Youtube video.",searchTerms:["video","youtube","embed"],icon:e.jsx(Wo,{size:18}),command:({editor:n,range:o})=>{const a=prompt("Please enter Youtube Video Link");if(!a)return;new RegExp(/^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)(\S+)?$/).test(a)?n.chain().focus().deleteRange(o).setYoutubeVideo({src:a}).run():alert("Please enter a correct Youtube Video Link")}},{title:"Twitter",description:"Embed a Tweet.",searchTerms:["twitter","embed"],icon:e.jsx(Vo,{size:18}),command:({editor:n,range:o})=>{const a=prompt("Please enter Twitter Link");if(!a)return;new RegExp(/^https?:\/\/(www\.)?x\.com\/([a-zA-Z0-9_]{1,15})(\/status\/(\d+))?(\/\S*)?$/).test(a)?n.chain().focus().deleteRange(o).setTweet({src:a}).run():alert("Please enter a correct Twitter Link")}}]}function on(t){return Zt.configure({suggestion:{items:()=>t,render:eo}})}function nn(t,n=[]){let o=[];function a(r,l){const d=c.createContext(l),p=o.length;o=[...o,l];const m=h=>{const{scope:v,children:M,...x}=h,C=v?.[t]?.[p]||d,B=c.useMemo(()=>x,Object.values(x));return e.jsx(C.Provider,{value:B,children:M})};m.displayName=r+"Provider";function y(h,v){const M=v?.[t]?.[p]||d,x=c.useContext(M);if(x)return x;if(l!==void 0)return l;throw new Error(`\`${h}\` must be used within \`${r}\``)}return[m,y]}const i=()=>{const r=o.map(l=>c.createContext(l));return function(d){const p=d?.[t]||r;return c.useMemo(()=>({[`__scope${t}`]:{...d,[t]:p}}),[d,p])}};return i.scopeName=t,[a,rn(i,...n)]}function rn(...t){const n=t[0];if(t.length===1)return n;const o=()=>{const a=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(r){const l=a.reduce((d,{useScope:p,scopeName:m})=>{const h=p(r)[`__scope${m}`];return{...d,...h}},{});return c.useMemo(()=>({[`__scope${n.scopeName}`]:l}),[l])}};return o.scopeName=n.scopeName,o}function nt(t){const n=sn(t),o=c.forwardRef((a,i)=>{const{children:r,...l}=a,d=c.Children.toArray(r),p=d.find(cn);if(p){const m=p.props.children,y=d.map(h=>h===p?c.Children.count(m)>1?c.Children.only(null):c.isValidElement(m)?m.props.children:null:h);return e.jsx(n,{...l,ref:i,children:c.isValidElement(m)?c.cloneElement(m,void 0,y):null})}return e.jsx(n,{...l,ref:i,children:r})});return o.displayName=`${t}.Slot`,o}function sn(t){const n=c.forwardRef((o,a)=>{const{children:i,...r}=o;if(c.isValidElement(i)){const l=dn(i),d=ln(r,i.props);return i.type!==c.Fragment&&(d.ref=a?Tt(a,l):l),c.cloneElement(i,d)}return c.Children.count(i)>1?c.Children.only(null):null});return n.displayName=`${t}.SlotClone`,n}var an=Symbol("radix.slottable");function cn(t){return c.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===an}function ln(t,n){const o={...n};for(const a in n){const i=t[a],r=n[a];/^on[A-Z]/.test(a)?i&&r?o[a]=(...d)=>{const p=r(...d);return i(...d),p}:i&&(o[a]=i):a==="style"?o[a]={...i,...r}:a==="className"&&(o[a]=[i,r].filter(Boolean).join(" "))}return{...t,...o}}function dn(t){let n=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,o=n&&"isReactWarning"in n&&n.isReactWarning;return o?t.ref:(n=Object.getOwnPropertyDescriptor(t,"ref")?.get,o=n&&"isReactWarning"in n&&n.isReactWarning,o?t.props.ref:t.props.ref||t.ref)}var un=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],rt=un.reduce((t,n)=>{const o=nt(`Primitive.${n}`),a=c.forwardRef((i,r)=>{const{asChild:l,...d}=i,p=l?o:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(p,{...d,ref:r})});return a.displayName=`Primitive.${n}`,{...t,[n]:a}},{}),ue="Popover",[st]=nn(ue,[qe]),te=qe(),[fn,F]=st(ue),at=t=>{const{__scopePopover:n,children:o,open:a,defaultOpen:i,onOpenChange:r,modal:l=!1}=t,d=te(n),p=c.useRef(null),[m,y]=c.useState(!1),[h,v]=Pt({prop:a,defaultProp:i??!1,onChange:r,caller:ue});return e.jsx(Mt,{...d,children:e.jsx(fn,{scope:n,contentId:St(),triggerRef:p,open:h,onOpenChange:v,onOpenToggle:c.useCallback(()=>v(M=>!M),[v]),hasCustomAnchor:m,onCustomAnchorAdd:c.useCallback(()=>y(!0),[]),onCustomAnchorRemove:c.useCallback(()=>y(!1),[]),modal:l,children:o})})};at.displayName=ue;var it="PopoverAnchor",pn=c.forwardRef((t,n)=>{const{__scopePopover:o,...a}=t,i=F(it,o),r=te(o),{onCustomAnchorAdd:l,onCustomAnchorRemove:d}=i;return c.useEffect(()=>(l(),()=>d()),[l,d]),e.jsx(Ve,{...r,...a,ref:n})});pn.displayName=it;var ct="PopoverTrigger",lt=c.forwardRef((t,n)=>{const{__scopePopover:o,...a}=t,i=F(ct,o),r=te(o),l=Ue(n,i.triggerRef),d=e.jsx(rt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":mt(i.open),...a,ref:l,onClick:ee(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?d:e.jsx(Ve,{asChild:!0,...r,children:d})});lt.displayName=ct;var je="PopoverPortal",[mn,hn]=st(je,{forceMount:void 0}),dt=t=>{const{__scopePopover:n,forceMount:o,children:a,container:i}=t,r=F(je,n);return e.jsx(mn,{scope:n,forceMount:o,children:e.jsx(Ye,{present:o||r.open,children:e.jsx(_t,{asChild:!0,container:i,children:a})})})};dt.displayName=je;var Q="PopoverContent",ut=c.forwardRef((t,n)=>{const o=hn(Q,t.__scopePopover),{forceMount:a=o.forceMount,...i}=t,r=F(Q,t.__scopePopover);return e.jsx(Ye,{present:a||r.open,children:r.modal?e.jsx(xn,{...i,ref:n}):e.jsx(vn,{...i,ref:n})})});ut.displayName=Q;var gn=nt("PopoverContent.RemoveScroll"),xn=c.forwardRef((t,n)=>{const o=F(Q,t.__scopePopover),a=c.useRef(null),i=Ue(n,a),r=c.useRef(!1);return c.useEffect(()=>{const l=a.current;if(l)return It(l)},[]),e.jsx(Dt,{as:gn,allowPinchZoom:!0,children:e.jsx(ft,{...t,ref:i,trapFocus:o.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ee(t.onCloseAutoFocus,l=>{l.preventDefault(),r.current||o.triggerRef.current?.focus()}),onPointerDownOutside:ee(t.onPointerDownOutside,l=>{const d=l.detail.originalEvent,p=d.button===0&&d.ctrlKey===!0,m=d.button===2||p;r.current=m},{checkForDefaultPrevented:!1}),onFocusOutside:ee(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),vn=c.forwardRef((t,n)=>{const o=F(Q,t.__scopePopover),a=c.useRef(!1),i=c.useRef(!1);return e.jsx(ft,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{t.onCloseAutoFocus?.(r),r.defaultPrevented||(a.current||o.triggerRef.current?.focus(),r.preventDefault()),a.current=!1,i.current=!1},onInteractOutside:r=>{t.onInteractOutside?.(r),r.defaultPrevented||(a.current=!0,r.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const l=r.target;o.triggerRef.current?.contains(l)&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&i.current&&r.preventDefault()}})}),ft=c.forwardRef((t,n)=>{const{__scopePopover:o,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:r,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:m,onInteractOutside:y,...h}=t,v=F(Q,o),M=te(o);return zt(),e.jsx(Ot,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:i,onUnmountAutoFocus:r,children:e.jsx(Lt,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:y,onEscapeKeyDown:d,onPointerDownOutside:p,onFocusOutside:m,onDismiss:()=>v.onOpenChange(!1),children:e.jsx(Ft,{"data-state":mt(v.open),role:"dialog",id:v.contentId,...M,...h,ref:n,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),pt="PopoverClose",bn=c.forwardRef((t,n)=>{const{__scopePopover:o,...a}=t,i=F(pt,o);return e.jsx(rt.button,{type:"button",...a,ref:n,onClick:ee(t.onClick,()=>i.onOpenChange(!1))})});bn.displayName=pt;var yn="PopoverArrow",wn=c.forwardRef((t,n)=>{const{__scopePopover:o,...a}=t,i=te(o);return e.jsx(Bt,{...i,...a,ref:n})});wn.displayName=yn;function mt(t){return t?"open":"closed"}var kn=at,jn=lt,Nn=dt,ht=ut;const Ne=kn,Ce=jn,fe=c.forwardRef(({className:t,align:n="center",sideOffset:o=4,...a},i)=>e.jsx(Nn,{children:e.jsx(ht,{ref:i,align:n,sideOffset:o,className:Y("feed-scrollbar z-[10002] w-72 max-w-[calc(100vw-1rem)] max-h-[min(24rem,calc(100dvh-1rem))] overflow-y-auto overscroll-contain rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a})}));fe.displayName=ht.displayName;const Le=[{name:"Text",icon:ot,command:t=>t.chain().focus().clearNodes().run(),isActive:t=>t.isActive("paragraph")&&!t.isActive("bulletList")&&!t.isActive("orderedList")},{name:"Heading 1",icon:ke,command:t=>t.chain().focus().clearNodes().toggleHeading({level:1}).run(),isActive:t=>t.isActive("heading",{level:1})},{name:"Heading 2",icon:Je,command:t=>t.chain().focus().clearNodes().toggleHeading({level:2}).run(),isActive:t=>t.isActive("heading",{level:2})},{name:"Heading 3",icon:Xe,command:t=>t.chain().focus().clearNodes().toggleHeading({level:3}).run(),isActive:t=>t.isActive("heading",{level:3})},{name:"To-do List",icon:Qe,command:t=>t.chain().focus().clearNodes().toggleTaskList().run(),isActive:t=>t.isActive("taskItem")},{name:"Bullet List",icon:et,command:t=>t.chain().focus().clearNodes().toggleBulletList().run(),isActive:t=>t.isActive("bulletList")},{name:"Numbered List",icon:Ze,command:t=>t.chain().focus().clearNodes().toggleOrderedList().run(),isActive:t=>t.isActive("orderedList")},{name:"Quote",icon:tt,command:t=>t.chain().focus().clearNodes().toggleBlockquote().run(),isActive:t=>t.isActive("blockquote")},{name:"Code",icon:we,command:t=>t.chain().focus().clearNodes().toggleCodeBlock().run(),isActive:t=>t.isActive("codeBlock")}],Cn=({open:t,onOpenChange:n})=>{const{editor:o}=D();if(!o)return null;const a=Le.filter(i=>i.isActive(o)).pop()??{name:"Multiple"};return e.jsxs(Ne,{open:t,onOpenChange:n,children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(L,{size:"sm",variant:"ghost",className:"gap-2 rounded-none border-none hover:bg-accent focus:ring-0",children:[e.jsx("span",{className:"whitespace-nowrap text-sm",children:a.name}),e.jsx(Ke,{className:"h-4 w-4"})]})}),e.jsx(fe,{sideOffset:5,align:"start",className:"w-48 p-1",children:Le.map(i=>e.jsxs(le,{onSelect:r=>{i.command(r),n(!1)},className:"flex cursor-pointer items-center justify-between rounded-sm px-2 py-1 text-sm hover:bg-accent",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:"rounded-sm border p-1",children:e.jsx(i.icon,{className:"h-3 w-3"})}),e.jsx("span",{children:i.name})]}),a.name===i.name&&e.jsx(de,{className:"h-4 w-4"})]},i.name))})]})},An=()=>{const{editor:t}=D();if(!t)return null;const n=[{name:"bold",isActive:o=>o.isActive("bold"),command:o=>o.chain().focus().toggleBold().run(),icon:No},{name:"italic",isActive:o=>o.isActive("italic"),command:o=>o.chain().focus().toggleItalic().run(),icon:To},{name:"underline",isActive:o=>o.isActive("underline"),command:o=>o.chain().focus().toggleUnderline().run(),icon:Yo},{name:"strike",isActive:o=>o.isActive("strike"),command:o=>o.chain().focus().toggleStrike().run(),icon:zo},{name:"code",isActive:o=>o.isActive("code"),command:o=>o.chain().focus().toggleCode().run(),icon:we}];return e.jsx("div",{className:"flex",children:n.map(o=>e.jsx(le,{onSelect:a=>{o.command(a)},children:e.jsx(L,{size:"sm",className:"rounded-none",variant:"ghost",type:"button",children:e.jsx(o.icon,{className:Y("h-4 w-4",{"text-blue-500":o.isActive(t)})})})},o.name))})};function En(t){try{return new URL(t),!0}catch{return!1}}function Rn(t){if(En(t))return t;try{if(t.includes(".")&&!t.includes(" "))return new URL(`https://${t}`).toString()}catch{return null}return null}const Tn=({open:t,onOpenChange:n})=>{const o=c.useRef(null),{editor:a}=D();return c.useEffect(()=>{t&&o.current?.focus()},[t]),a?e.jsxs(Ne,{open:t,onOpenChange:n,children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(L,{size:"sm",variant:"ghost",className:"gap-2 rounded-none border-none",children:[e.jsx("p",{className:"text-base",children:"↗"}),e.jsx("p",{className:Y("underline decoration-stone-400 underline-offset-4",{"text-blue-500":a.isActive("link")}),children:"Link"})]})}),e.jsx(fe,{align:"start",className:"w-60 p-0",sideOffset:10,children:e.jsxs("form",{onSubmit:i=>{const r=i.currentTarget;i.preventDefault();const l=r[0],d=Rn(l.value);d&&(a.chain().focus().setLink({href:d}).run(),n(!1))},className:"flex p-1",children:[e.jsx("input",{ref:o,type:"text",placeholder:"Paste a link",className:"flex-1 bg-background p-1 text-sm outline-none",defaultValue:a.getAttributes("link").href||""}),a.getAttributes("link").href?e.jsx(L,{size:"icon",variant:"outline",type:"button",className:"flex h-8 items-center rounded-sm p-1 text-red-600 transition-all hover:bg-red-100 dark:hover:bg-red-800",onClick:()=>{a.chain().focus().unsetLink().run(),o.current&&(o.current.value=""),n(!1)},children:e.jsx($o,{className:"h-4 w-4"})}):e.jsx(L,{size:"icon",type:"submit",className:"h-8",children:e.jsx(de,{className:"h-4 w-4"})})]})})]}):null},Fe=[{name:"Default",color:"var(--novel-black)"},{name:"Purple",color:"#9333EA"},{name:"Red",color:"#E00000"},{name:"Yellow",color:"#EAB308"},{name:"Blue",color:"#2563EB"},{name:"Green",color:"#008A00"},{name:"Orange",color:"#FFA500"},{name:"Pink",color:"#BA4081"},{name:"Gray",color:"#A8A29E"}],Be=[{name:"Default",color:"var(--novel-highlight-default)"},{name:"Purple",color:"var(--novel-highlight-purple)"},{name:"Red",color:"var(--novel-highlight-red)"},{name:"Yellow",color:"var(--novel-highlight-yellow)"},{name:"Blue",color:"var(--novel-highlight-blue)"},{name:"Green",color:"var(--novel-highlight-green)"},{name:"Orange",color:"var(--novel-highlight-orange)"},{name:"Pink",color:"var(--novel-highlight-pink)"},{name:"Gray",color:"var(--novel-highlight-gray)"}],Pn=({open:t,onOpenChange:n})=>{const{editor:o}=D();if(!o)return null;const a=Fe.find(({color:r})=>o.isActive("textStyle",{color:r})),i=Be.find(({color:r})=>o.isActive("highlight",{color:r}));return e.jsxs(Ne,{open:t,onOpenChange:n,children:[e.jsx(Ce,{asChild:!0,children:e.jsxs(L,{size:"sm",className:"gap-2 rounded-none",variant:"ghost",children:[e.jsx("span",{className:"rounded-sm px-1",style:{color:a?.color,backgroundColor:i?.color},children:"A"}),e.jsx(Ke,{className:"h-4 w-4"})]})}),e.jsxs(fe,{sideOffset:5,className:"my-1 flex max-h-80 w-48 flex-col overflow-hidden overflow-y-auto rounded border p-1 shadow-xl",align:"start",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"my-1 px-2 text-sm font-semibold text-muted-foreground",children:"Color"}),Fe.map(({name:r,color:l})=>e.jsx(le,{onSelect:()=>{o.commands.unsetColor(),r!=="Default"&&o.chain().focus().setColor(l||"").run(),n(!1)},className:"flex cursor-pointer items-center justify-between px-2 py-1 text-sm hover:bg-accent",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"rounded-sm border px-2 py-px font-medium",style:{color:l},children:"A"}),e.jsx("span",{children:r})]})},r))]}),e.jsxs("div",{children:[e.jsx("div",{className:"my-1 px-2 text-sm font-semibold text-muted-foreground",children:"Background"}),Be.map(({name:r,color:l})=>e.jsxs(le,{onSelect:()=>{o.commands.unsetHighlight(),r!=="Default"&&o.chain().focus().setHighlight({color:l}).run(),n(!1)},className:"flex cursor-pointer items-center justify-between px-2 py-1 text-sm hover:bg-accent",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"rounded-sm border px-2 py-px font-medium",style:{backgroundColor:l},children:"A"}),e.jsx("span",{children:r})]}),o.isActive("highlight",{color:l})&&e.jsx(de,{className:"h-4 w-4"})]},r))]})]})]})},Mn=()=>{const{editor:t}=D();return t?e.jsx(L,{variant:"ghost",size:"sm",className:"rounded-none w-12",onClick:()=>{if(t.isActive("math"))t.chain().focus().unsetLatex().run();else{const{from:n,to:o}=t.state.selection,a=t.state.doc.textBetween(n,o);if(!a)return;t.chain().focus().setLatex({latex:a}).run()}},children:e.jsx(Ht,{className:Y("size-4",{"text-blue-500":t.isActive("math")}),strokeWidth:2.3})}):null},Sn="notebook-table-bubble-menu",O=({label:t,onClick:n,disabled:o,icon:a,tone:i="default"})=>e.jsx(L,{type:"button",size:"icon",variant:"ghost",disabled:o,onClick:n,title:t,className:Y("h-8 w-8",i==="destructive"&&"text-destructive hover:text-destructive"),children:e.jsx(a,{className:"h-4 w-4"})}),gt=({className:t})=>{const{editor:n}=D();if(!n)return null;const o=n.can();return e.jsxs("div",{className:Y("flex flex-wrap items-center gap-1 rounded-md border border-muted bg-background p-1 shadow-md",t),children:[e.jsx(O,{label:"Add column before",icon:$t,onClick:()=>n.chain().focus().addColumnBefore().run(),disabled:!o.addColumnBefore()}),e.jsx(O,{label:"Add column after",icon:Ut,onClick:()=>n.chain().focus().addColumnAfter().run(),disabled:!o.addColumnAfter()}),e.jsx(V,{orientation:"vertical",className:"h-5"}),e.jsx(O,{label:"Add row above",icon:Vt,onClick:()=>n.chain().focus().addRowBefore().run(),disabled:!o.addRowBefore()}),e.jsx(O,{label:"Add row below",icon:ko,onClick:()=>n.chain().focus().addRowAfter().run(),disabled:!o.addRowAfter()}),e.jsx(V,{orientation:"vertical",className:"h-5"}),e.jsx(O,{label:"Toggle header row",icon:ke,onClick:()=>n.chain().focus().toggleHeaderRow().run(),disabled:!o.toggleHeaderRow()}),e.jsx(V,{orientation:"vertical",className:"h-5"}),e.jsx(O,{label:"Delete column",icon:Oe,onClick:()=>n.chain().focus().deleteColumn().run(),disabled:!o.deleteColumn()}),e.jsx(O,{label:"Delete row",icon:Oe,onClick:()=>n.chain().focus().deleteRow().run(),disabled:!o.deleteRow()}),e.jsx(O,{label:"Delete table",icon:qt,onClick:()=>n.chain().focus().deleteTable().run(),disabled:!o.deleteTable(),tone:"destructive"})]})};function _n(t){const{$from:n}=t.state.selection,o=go(n,i=>i.type.name==="table");if(!o)return null;const a=t.view.nodeDOM(o.pos);return a instanceof HTMLElement?a:null}const In=({className:t})=>{const{editor:n}=D();return!n||n.isDestroyed?null:e.jsx(Ge,{pluginKey:Sn,shouldShow:({editor:o})=>o.isEditable&&o.isActive("table"),tippyOptions:{placement:"bottom",moveTransition:"transform 0.15s ease-out"},children:e.jsx(gt,{className:t})})},Dn=({className:t})=>{const{editor:n}=D(),[o,a]=c.useState(null),i=c.useCallback(()=>{if(!n||n.isDestroyed||!n.isEditable){a(null);return}if(!n.isActive("table")){a(null);return}const l=_n(n);if(!l){a(null);return}const d=n.view.dom.parentElement||n.view.dom,p=d.getBoundingClientRect(),m=l.getBoundingClientRect(),y=m.top-p.top+d.scrollTop-12,h=m.left-p.left+d.scrollLeft;a({top:y,left:h,width:m.width})},[n]),r=c.useMemo(()=>{let l=0;return()=>{l||(l=window.requestAnimationFrame(()=>{l=0,i()}))}},[i]);return c.useEffect(()=>{if(!n||n.isDestroyed)return;const l=n.view.dom.parentElement||n.view.dom;return i(),n.on("selectionUpdate",r),n.on("transaction",r),n.on("focus",r),n.on("blur",r),l.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),()=>{n.off("selectionUpdate",r),n.off("transaction",r),n.off("focus",r),n.off("blur",r),l.removeEventListener("scroll",r),window.removeEventListener("resize",r)}},[n,r,i]),!n||n.isDestroyed||!o?null:e.jsx("div",{className:Y("absolute z-30",t),style:{top:o.top,left:o.left,width:o.width},children:e.jsx(gt,{className:"w-full justify-start"})})},zn=()=>{const{editor:t}=D(),[n,o]=c.useState(!1),[a,i]=c.useState(!1),[r,l]=c.useState(!1);return t?e.jsx(Ge,{tippyOptions:{placement:"top",onHidden:()=>{o(!1),i(!1),l(!1)}},className:"flex w-fit max-w-[90vw] overflow-hidden rounded-md border border-muted bg-background shadow-xl",children:e.jsxs(c.Fragment,{children:[e.jsx(Cn,{open:n,onOpenChange:o}),e.jsx(V,{orientation:"vertical"}),e.jsx(Tn,{open:r,onOpenChange:l}),e.jsx(V,{orientation:"vertical"}),e.jsx(Mn,{}),e.jsx(V,{orientation:"vertical"}),e.jsx(An,{}),e.jsx(V,{orientation:"vertical"}),e.jsx(Pn,{open:a,onOpenChange:i})]})}):null};function q({width:t,className:n=""}){return e.jsx("div",{className:`h-4 bg-muted rounded animate-pulse ${n}`,style:{width:t}})}function ce(){return e.jsxs("div",{className:"space-y-2",children:[e.jsx(q,{width:"85%"}),e.jsx(q,{width:"70%"}),e.jsx(q,{width:"90%"})]})}function He({message:t="Loading..."}){const{t:n}=ye("notebook"),o=t==="Loading..."?n("loading"):t;return e.jsxs("div",{className:"editor-loading h-full flex flex-col bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsx("div",{className:"w-32 h-7 bg-muted rounded animate-pulse"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"w-8 h-8 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"w-8 h-8 bg-muted rounded animate-pulse"})]})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsxs("div",{className:"max-w-[900px] mx-auto px-16 py-12 space-y-8",children:[e.jsx("div",{className:"h-10 bg-muted rounded animate-pulse w-2/3"}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(ce,{}),e.jsx(ce,{}),e.jsx("div",{className:"pt-4",children:e.jsx("div",{className:"h-6 bg-muted rounded animate-pulse w-1/2"})}),e.jsx(ce,{}),e.jsxs("div",{className:"bg-muted/50 rounded-md p-4 space-y-2",children:[e.jsx(q,{width:"60%",className:"h-3"}),e.jsx(q,{width:"80%",className:"h-3"}),e.jsx(q,{width:"45%",className:"h-3"}),e.jsx(q,{width:"70%",className:"h-3"})]}),e.jsx(ce,{})]})]})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:e.jsxs("div",{className:"flex flex-col items-center gap-3 bg-background/80 px-6 py-4 rounded-lg shadow-lg backdrop-blur-sm",children:[e.jsxs("div",{className:"relative w-8 h-8",children:[e.jsx("div",{className:"absolute inset-0 border-2 border-muted rounded-full"}),e.jsx("div",{className:"absolute inset-0 border-2 border-primary border-t-transparent rounded-full animate-spin"})]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:o})]})})]})}function On({status:t}){const{t:n}=ye("notebook");switch(t){case"saving":return e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(We,{className:"w-3 h-3 animate-spin"}),e.jsx("span",{children:n("saving")})]});case"saved":return e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-green-600",children:[e.jsx(de,{className:"w-3 h-3"}),e.jsx("span",{children:n("saved")})]});case"error":return e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[e.jsx(Wt,{className:"w-3 h-3"}),e.jsx("span",{children:n("save_failed")})]});default:return null}}function Ln({notebookId:t,autoSaveStatus:n,getMarkdown:o,allowCopy:a=!0}){const[i,r]=c.useState(!1),{toast:l}=Yt(),{t:d}=ye("notebook"),p=a&&(!!t||!!o),m=c.useCallback(async()=>{if(o){const h=await Promise.resolve(o());if(typeof h=="string")return h}return t?await be(t):""},[o,t]),y=c.useCallback(async()=>{if(p){r(!0);try{const h=await m();if(navigator?.clipboard?.writeText)await navigator.clipboard.writeText(h);else{const v=document.createElement("textarea");v.value=h,v.style.position="fixed",v.style.opacity="0",document.body.appendChild(v),v.focus(),v.select(),document.execCommand("copy"),v.remove()}l({title:d("copy_success_title"),description:d("copy_success_desc"),variant:"success"})}catch(h){console.error("[NotebookToolbar] Copy failed:",h),l({title:d("copy_failed_title"),description:d("try_again"),variant:"destructive"})}finally{r(!1)}}},[p,m,d,l]);return e.jsxs("div",{className:"notebook-toolbar flex items-center justify-between px-4 py-2 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsx(On,{status:n})}),e.jsx("div",{className:"flex items-center gap-1",children:p?e.jsx("button",{type:"button",className:"flex items-center gap-1.5 px-2.5 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted rounded-md transition-colors",onClick:y,title:d("copy"),children:i?e.jsx(We,{className:"w-4 h-4 animate-spin"}):e.jsx(Kt,{className:"w-4 h-4"})}):null})]})}const Fn={type:"doc",content:[{type:"paragraph"}]},$e="prosemirror";function Bn(t){const n=t.state.doc;if(n.childCount!==1)return!1;const o=n.firstChild;return o?o.type.name!=="paragraph"?!1:o.content.size===0&&n.textContent.trim().length===0:!0}function Jn({context:t,setDirty:n,setTitle:o,className:a,onMarkdownChange:i}){const r=t.resourceId,l=t.resourceName||"Untitled Notebook",d=typeof t.customData?.inlineMarkdown=="string"?t.customData.inlineMarkdown:null,p=d!==null,m=t.customData?.readonly===!0||p,y=Gt(s=>s.projectId),h=typeof t.customData?.projectId=="string"?t.customData.projectId:y||void 0,v=t.resourcePath??void 0,x=Zo(t)==="markdown",C=c.useMemo(()=>x?Qt(r):null,[x,r]),B=c.useRef(null),P=c.useRef(h),T=c.useRef(null),H=c.useRef(null),b=c.useRef(null),k=c.useRef(null),Ae=c.useRef(null),S=c.useRef(!1),[w,Ee]=c.useState(null),[K,pe]=c.useState(null),[j,me]=c.useState(null),_=c.useRef(null),[xt,oe]=c.useState(null),[vt,$]=c.useState(!0),[Re,J]=c.useState(null),[ne,A]=c.useState("idle"),[bt,yt]=c.useState(0),{diffEvent:X,clearDiff:wt}=bo({fileId:r??void 0,filePath:v,projectId:h}),kt=c.useCallback(()=>w?Z(w):typeof j=="string"?j:typeof _.current=="string"?_.current:"",[w,j]),W=c.useCallback(s=>x?Jt(s,C):s,[x,C]),Te=c.useCallback(s=>x?Xt(s,C):s,[x,C]),re=c.useCallback(async s=>{if(!w||!r||!x)return;const f=Z(w),u=b.current??f;if(!(!s&&f!==u))try{const g=W(await be(r));S.current=!0,ie(w,g),b.current=g}catch(g){console.warn("[NotebookEditor] Failed to refresh markdown",g)}},[w,x,r,W]),G=r??null;Ae.current!==G&&(Ae.current=G,k.current=null),c.useEffect(()=>{X?.diff&&re(!1)},[X,re]),c.useEffect(()=>{if(!r||p)return;const s=f=>{const u=f.detail;u&&(u.fileId&&u.fileId!==r||!u.fileId&&u.filePath&&v&&u.filePath!==v||!u.fileId&&!u.filePath||re(!!u.force))};return window.addEventListener("ds:file:reload",s),()=>window.removeEventListener("ds:file:reload",s)},[v,p,r,re]);const E=c.useMemo(()=>to({onUpload:async s=>{const f=P.current;if(!f)throw console.warn("[NotebookEditor] upload skipped: missing projectId",{fileName:s.name,fileType:s.type}),new Error("Missing project ID for upload.");if(console.debug("[NotebookEditor] upload start",{fileName:s.name,fileType:s.type,fileSize:s.size}),x&&C){const u=await Se(f,C.baseDocumentId,s,"image");return String(Ie(u.asset_url))}return ge(f,s,"image")},validateFn:s=>{try{return P.current?fo(s,"image")?s.size>10*1024*1024?(console.warn("[NotebookEditor] validate failed: size limit",{fileName:s.name,fileSize:s.size}),!1):!0:(console.warn("[NotebookEditor] validate failed: unsupported image",{fileName:s.name,fileType:s.type}),!1):(console.warn("[NotebookEditor] validate failed: missing projectId",{fileName:s.name,fileType:s.type}),!1)}catch{return console.warn("[NotebookEditor] validate failed: unexpected error",{fileName:s.name,fileType:s.type}),!1}}}),[x,C]);c.useEffect(()=>{P.current=h},[h]);const se=c.useCallback(async s=>{const f=P.current;if(!w||!f)return;const u=s.filter(g=>g.type.startsWith("video/"));if(u.length!==0)for(const g of u)try{console.debug("[NotebookEditor] video upload start",{fileName:g.name,fileType:g.type,fileSize:g.size});const R=await ge(f,g,"video");w.chain().focus().insertContent({type:"video",attrs:{src:R}}).run()}catch(R){console.error("[NotebookEditor] Video upload failed:",R)}},[w]);c.useEffect(()=>{o(l)},[l,o]),c.useEffect(()=>{n(ne==="saving"||ne==="error")},[ne,n]),c.useEffect(()=>{!w||j===null||r&&k.current===r&&j.trim()&&Bn(w)&&(S.current=!0,ie(w,j),x?b.current=j:_.current=j)},[w,j,x,r]),c.useEffect(()=>{i&&x&&j!==null&&i(j)},[j,x,i]);const Pe=c.useCallback(async(s,f)=>{const u=P.current;if(u)try{console.debug("[NotebookEditor] image upload start",{fileName:s.name,fileType:s.type,fileSize:s.size});const g=x&&C?String(Ie((await Se(u,C.baseDocumentId,s,"image")).asset_url)):await ge(u,s,"image");f.chain().focus().setImage({src:g}).run()}catch(g){console.error("[NotebookEditor] Image upload failed:",g)}},[x,C]),he=c.useMemo(()=>tn(Pe),[Pe]),Me=c.useMemo(()=>on(he),[he]),jt=c.useMemo(()=>{const s=[...oo,Me];return K&&s.unshift(xo.configure({document:K,field:$e})),s},[K,Me]);c.useEffect(()=>{if(p){J(null),$(!1),A("idle"),me(W(d??"")),pe(null),oe(G),b.current=W(d??""),_.current=d??"",S.current=!1,k.current=G;return}if(!r){J("No notebook ID provided"),$(!1);return}J(null),$(!0),A("idle"),me(null),pe(null),oe(null),b.current=null,_.current=null,S.current=!1,k.current=null;let s=!1;return(async()=>{try{let u=null;try{u=await be(r)}catch(I){if(x)throw I;console.warn("[NotebookEditor] Failed to load markdown for notebook:",I)}if(s)return;const g=W(u??"");if(me(g),_.current=u??"",x){b.current=g,k.current=r,oe(r),$(!1);return}if(!h){J("No project ID provided"),$(!1);return}const R=await en({projectId:h,notebookId:r,readonly:m,onStatus:A,onReset:()=>{setHistoryOpen(!1),setCollaboratorsOpen(!1),yt(I=>I+1)}});if(s){R.dispose();return}B.current=R,pe(R.ydoc),k.current=r,oe(r),$(!1)}catch(u){if(s)return;console.error("[NotebookEditor] Initialization failed:",u),J(u instanceof Error?u.message:"Failed to initialize editor"),$(!1)}})(),()=>{s=!0,T.current&&(clearTimeout(T.current),T.current=null),H.current&&(clearTimeout(H.current),H.current=null),k.current=null,B.current?.dispose(),B.current=null,Ee(null)}},[d,p,r,G,h,x,m,bt,W]);const Nt=c.useCallback(s=>{if(m||!x||!r||k.current!==r)return;if(S.current){S.current=!1;return}if(i){H.current&&clearTimeout(H.current);const u=r;H.current=setTimeout(()=>{k.current===u&&i(Z(s))},120)}T.current&&clearTimeout(T.current),A("saving");const f=r;T.current=setTimeout(async()=>{try{if(k.current!==f)return;const u=Z(s),g=Te(u);if(b.current===u){A("saved"),setTimeout(()=>A("idle"),1500);return}await _e(f,g),b.current=u,A("saved"),setTimeout(()=>A("idle"),1500)}catch(u){console.error("[NotebookEditor] Markdown save failed:",u),A("error")}},1500)},[m,x,r,i,Te]),Ct=c.useCallback(s=>{if(m||x||!r||k.current!==r)return;if(S.current){S.current=!1;return}T.current&&clearTimeout(T.current),A("saving");const f=r;T.current=setTimeout(async()=>{try{if(k.current!==f)return;const u=Z(s);if(_.current===u){A("saved"),setTimeout(()=>A("idle"),1500);return}await _e(f,u),_.current=u,A("saved"),setTimeout(()=>A("idle"),1500)}catch(u){console.error("[NotebookEditor] Notebook markdown save failed:",u),A("error")}},1500)},[m,x,r]),U=c.useCallback(s=>s?s.files&&s.files.length>0?!0:(s.items?Array.from(s.items):[]).some(u=>u.kind==="file"):!1,[]),ae=c.useCallback(s=>{if(!s)return[];if(!U(s))return[];if(s.files&&s.files.length>0)return Array.from(s.files);const f=s.items?Array.from(s.items):[],u=[];for(const g of f)if(g.kind==="file"){const R=g.getAsFile();R&&u.push(R)}return u},[U]),At=c.useCallback(s=>{if(w?.view.dragging||!U(s.dataTransfer))return;const f=ae(s.dataTransfer);f.length&&(s.preventDefault(),s.dataTransfer.dropEffect="copy",console.debug("[NotebookEditor] dragover",{fileCount:f.length,fileTypes:f.map(u=>u.type||"unknown"),dataTypes:Array.from(s.dataTransfer.types??[]),projectId:P.current}))},[w,ae,U]),Et=c.useCallback(s=>{if(w?.view.dragging||!U(s.dataTransfer))return;const f=ae(s.dataTransfer);if(console.debug("[NotebookEditor] container drop",{fileCount:f.length,fileTypes:f.map(g=>g.type||"unknown"),dataTypes:Array.from(s.dataTransfer.types??[]),hasUploadFn:!!E,projectId:P.current}),!f.length)return;if(s.preventDefault(),s.stopPropagation(),!w){console.warn("[NotebookEditor] container drop ignored: editor missing");return}if(f.some(g=>g.type.startsWith("video/"))&&se(f),E){const g=xe(w.view,s.nativeEvent,!1,E);console.debug("[NotebookEditor] container drop handled",{handled:g})}else console.warn("[NotebookEditor] container drop ignored: uploadFn missing")},[w,ae,se,E,U]);return Re?e.jsx("div",{className:"notebook-editor-error h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center space-y-4 p-8 max-w-md",children:[e.jsx("div",{className:"text-destructive text-lg font-medium",children:"Failed to load notebook"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:Re}),e.jsx("div",{className:"flex gap-2 justify-center",children:e.jsx("button",{className:"px-4 py-2 bg-primary text-primary-foreground rounded-md text-sm",onClick:()=>window.location.reload(),children:"Retry"})})]})}):xt===G&&!vt?!x&&!K?e.jsx(He,{message:"Loading document..."}):e.jsxs("div",{className:`notebook-editor flex flex-col flex-1 min-h-0 ${a||""}`,children:[e.jsx(Ln,{notebookId:!p&&r?r:"",autoSaveStatus:ne,getMarkdown:kt}),e.jsx("div",{className:"flex-1 min-h-0 overflow-hidden flex justify-center px-4 py-4 bg-muted/10",children:e.jsx("div",{className:"relative h-full w-[min(62.5vw,100%)] max-w-[70rem]",children:e.jsxs("div",{className:"notebook-editor-container relative h-full overflow-hidden rounded-2xl border border-border bg-background shadow-soft-card","data-notebook-id":r,onDragOver:At,onDrop:Et,children:[X?.diff?e.jsx(yo,{diff:X.diff,changeType:X.changeType,title:"AI change",subtitle:l,onClose:wt,className:"absolute right-4 top-4 z-20 w-[min(420px,46vw)]"}):null,e.jsx(no,{children:e.jsxs(ro,{extensions:jt,className:"notebook-doc-editor relative h-full w-full overflow-y-auto",editorProps:{handleDOMEvents:{keydown:(s,f)=>uo(f)},handlePaste:(s,f)=>{const u=Array.from(f.clipboardData?.files??[]);return u.some(R=>R.type.startsWith("video/"))?(f.preventDefault(),se(u),E&&De(s,f,E),!0):E?De(s,f,E):!1},handleDrop:(s,f,u,g)=>{if(!U(f.dataTransfer))return!1;if(g)return console.debug("[NotebookEditor] drop ignored: internal move",{moved:g,projectId:P.current}),!1;const I=Array.from(f.dataTransfer?.files??[]);if(console.debug("[NotebookEditor] drop",{moved:g,fileCount:I.length,fileTypes:I.map(z=>z.type||"unknown"),dataTypes:Array.from(f.dataTransfer?.types??[]),hasUploadFn:!!E,projectId:P.current}),I.some(z=>z.type.startsWith("video/"))){if(f.preventDefault(),se(I),E){const z=xe(s,f,g,E);console.debug("[NotebookEditor] drop handled (video+image)",{handled:z})}return!0}if(E){const z=xe(s,f,g,E);return console.debug("[NotebookEditor] drop handled (image)",{handled:z}),z}return console.warn("[NotebookEditor] drop ignored: uploadFn missing"),!1},attributes:{class:"prose prose-lg dark:prose-invert prose-headings:font-title font-default focus:outline-none max-w-full"}},onCreate:({editor:s})=>{if(Ee(s),x&&j!==null&&(S.current=!0,ie(s,j),b.current=j),!x&&K){const f=K.getXmlFragment($e);f.length===0&&j!==null?(S.current=!0,ie(s,j),_.current=j):f.length===0&&!m&&s.commands.setContent(Fn)}m&&s.setEditable(!1)},onUpdate:({editor:s})=>{Nt(s),Ct(s)},slotAfter:e.jsx(lo,{}),children:[e.jsxs(so,{className:"z-50 h-auto max-h-[330px] overflow-y-auto rounded-md border border-muted bg-background px-1 py-2 text-foreground shadow-md transition-all",children:[e.jsx(ao,{className:"px-2 text-muted-foreground",children:"No results"}),e.jsx(io,{children:he.map(s=>e.jsxs(co,{value:s.title,onCommand:f=>s.command?.(f),className:"flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm hover:bg-accent aria-selected:bg-accent",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border border-muted bg-background text-foreground",children:s.icon}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]})]},s.title))})]}),e.jsx(Dn,{}),e.jsx(In,{}),e.jsx(zn,{})]})})]})})})]}):e.jsx(He,{message:"Initializing editor..."})}export{He as E,Jn as N,Ln as a};
|