@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,81 +0,0 @@
|
|
|
1
|
-
import{y as j,j as e,J as B,l as Be,d as re,b as Y,bu as rt,c3 as at,c4 as U,c5 as it,c6 as lt,u as fe,n as ct,Y as me,L as Fe,e as dt,C as ut,f as mt,a8 as ft,c7 as pt,c8 as ht,c9 as Ce,Z as Ae}from"./index-CBNVuWcP.js";import{r as a}from"./plugin-monaco-C8UgLomw.js";import{m as gt,l as xt,w as se,P as Pe,g as W,s as oe,q as bt,u as ce,r as Ee,d as vt,J as de,U as kt,I as yt,T as wt,B as jt,O as Nt,S as Tt,K as Ct,G as Me,c as At,i as Et}from"./NotebookEditor-DB9N_T9q.js";import{D as Mt,e as It,a as Ie,m as Rt,u as D,f as St,C as zt}from"./plugin-notebook-HbW2K-1c.js";import{P as Dt}from"./project-sync-C9IdzdZW.js";import{S as He}from"./index-CwNu1aH4.js";import{C as pe}from"./code-WlFHE7z_.js";import{I as Lt}from"./image-Bgl4VIyx.js";import{P as he,a as ge,b as xe}from"./popover-CLc0pPP8.js";import{T as _t,A as Bt}from"./trash-DwpbFr3w.js";import{S as Ft}from"./sigma-ClKcHAXm.js";import{u as Pt}from"./useFileDiffOverlay-FuhcnKiw.js";import{F as Ht}from"./file-diff-panel-CQhw0jS2.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 Ut=[["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"}]],Ot=j("bold",Ut);/**
|
|
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 Vt=[["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"}]],be=j("heading-1",Vt);/**
|
|
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 qt=[["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"}]],Ue=j("heading-2",qt);/**
|
|
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 $t=[["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"}]],Oe=j("heading-3",$t);/**
|
|
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 Yt=[["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"}]],Kt=j("italic",Yt);/**
|
|
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 Gt=[["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"}]],Ve=j("list-ordered",Gt);/**
|
|
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 Qt=[["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"}]],qe=j("list",Qt);/**
|
|
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 Wt=[["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"}]],Jt=j("message-square-plus",Wt);/**
|
|
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 Xt=[["path",{d:"M5 12h14",key:"1ays0h"}]],Re=j("minus",Xt);/**
|
|
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 Zt=[["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"}]],eo=j("strikethrough",Zt);/**
|
|
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 to=[["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"}]],oo=j("table-2",to);/**
|
|
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 no=[["path",{d:"M17 6H3",key:"16j9eg"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 18H8",key:"1wfozv"}],["path",{d:"M3 12v6",key:"fv4c87"}]],$e=j("text-quote",no);/**
|
|
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 so=[["path",{d:"M15 18H3",key:"olowqp"}],["path",{d:"M17 6H3",key:"16j9eg"}],["path",{d:"M21 12H3",key:"2avoz0"}]],Ye=j("text",so);/**
|
|
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 ro=[["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"}]],ao=j("twitter",ro);/**
|
|
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 io=[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]],lo=j("underline",io);/**
|
|
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 co=[["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"}]],uo=j("youtube",co),mo=new Set([".md",".markdown",".mdx"]),fo=new Set(["text/markdown","text/x-markdown"]);function po(o){if(!o)return null;const n=o.lastIndexOf(".");return n<0?null:o.slice(n).toLowerCase()}function ho(o,n){if(n&&fo.has(n))return!0;const t=po(o);return t?mo.has(t):!1}function go(o){const n=o.customData?.docKind;if(n==="markdown"||n==="notebook")return n;if(o.type==="notebook")return"notebook";const t=o.customData,l=typeof o.mimeType=="string"?o.mimeType:typeof t?.mimeType=="string"?t.mimeType:typeof t?.fileMeta?.mimeType=="string"?t.fileMeta.mimeType:void 0;return ho(o.resourceName,l)?"markdown":"notebook"}const ue="ds-remote";async function xo(o){const{projectId:n,notebookId:t,readonly:l=!1,onStatus:d,onReset:r}=o,u=new Dt(n,{authMode:"user",docKind:"notebook"}),p=new Mt;let y=!1,x=null,M=null,g=[];const w=h=>{d&&(d(h),h==="saved"&&(M!=null&&window.clearTimeout(M),M=window.setTimeout(()=>d("idle"),1500)))},ve=()=>{x!=null&&window.clearTimeout(x),x=window.setTimeout(()=>void f(),250)},f=async()=>{if(y||l||g.length===0)return;const h=g;g=[];try{w("saving");const v=h.length===1?h[0]:Rt(h);await u.pushDocUpdate(t,v),w("saved")}catch(v){console.error("[NovelYjsProvider] Failed to push update:",v),w("error")}};await u.connect();const T=await u.loadDoc(t,It(p));T?.missing&&Ie(p,T.missing,ue);const K=u.onDocUpdate(h=>{h.docId===t&&Ie(p,h.update,ue)}),I=u.onDocReset(h=>{h.docId===t&&r?.({timestamp:h.timestamp,reason:h.reason,actorUserId:h.actorUserId??null})}),E=(h,v)=>{v!==ue&&(l||(g.push(h),ve()))};return p.on("update",E),{ydoc:p,dispose:()=>{y=!0,x!=null&&window.clearTimeout(x),M!=null&&window.clearTimeout(M),p.off("update",E),K?.(),I?.(),u.disconnect()}}}function bo(o){return[{title:"Send Feedback",description:"Let us know how we can improve.",icon:e.jsx(Jt,{size:18}),command:({editor:n,range:t})=>{n.chain().focus().deleteRange(t).run(),window.open("/feedback","_blank")}},{title:"Text",description:"Just start typing with plain text.",searchTerms:["p","paragraph"],icon:e.jsx(Ye,{size:18}),command:({editor:n,range:t})=>{n.chain().focus().deleteRange(t).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(He,{size:18}),command:({editor:n,range:t})=>{n.chain().focus().deleteRange(t).toggleTaskList().run()}},{title:"Heading 1",description:"Big section heading.",searchTerms:["title","big","large"],icon:e.jsx(be,{size:18}),command:({editor:n,range:t})=>{n.chain().focus().deleteRange(t).setNode("heading",{level:1}).run()}},{title:"Heading 2",description:"Medium section heading.",searchTerms:["subtitle","medium"],icon:e.jsx(Ue,{size:18}),command:({editor:n,range:t})=>{n.chain().focus().deleteRange(t).setNode("heading",{level:2}).run()}},{title:"Heading 3",description:"Small section heading.",searchTerms:["subtitle","small"],icon:e.jsx(Oe,{size:18}),command:({editor:n,range:t})=>{n.chain().focus().deleteRange(t).setNode("heading",{level:3}).run()}},{title:"Bullet List",description:"Create a simple bullet list.",searchTerms:["unordered","point"],icon:e.jsx(qe,{size:18}),command:({editor:n,range:t})=>{n.chain().focus().deleteRange(t).toggleBulletList().run()}},{title:"Numbered List",description:"Create a list with numbering.",searchTerms:["ordered"],icon:e.jsx(Ve,{size:18}),command:({editor:n,range:t})=>{n.chain().focus().deleteRange(t).toggleOrderedList().run()}},{title:"Quote",description:"Capture a quote.",searchTerms:["blockquote"],icon:e.jsx($e,{size:18}),command:({editor:n,range:t})=>n.chain().focus().deleteRange(t).toggleNode("paragraph","paragraph").toggleBlockquote().run()},{title:"Code",description:"Capture a code snippet.",searchTerms:["codeblock"],icon:e.jsx(pe,{size:18}),command:({editor:n,range:t})=>n.chain().focus().deleteRange(t).toggleCodeBlock().run()},{title:"Table",description:"Insert a table with rows and columns.",searchTerms:["table","grid","spreadsheet","data"],icon:e.jsx(oo,{size:18}),command:({editor:n,range:t})=>{n.chain().focus().deleteRange(t).insertTable({rows:3,cols:3,withHeaderRow:!0}).run()}},{title:"Image",description:"Upload an image from your computer.",searchTerms:["photo","picture","media"],icon:e.jsx(Lt,{size:18}),command:({editor:n,range:t})=>{n.chain().focus().deleteRange(t).run();const l=document.createElement("input");l.type="file",l.accept="image/*",l.onchange=async()=>{if(l.files?.length){const d=l.files[0];await o(d,n)}},l.click()}},{title:"Youtube",description:"Embed a Youtube video.",searchTerms:["video","youtube","embed"],icon:e.jsx(uo,{size:18}),command:({editor:n,range:t})=>{const l=prompt("Please enter Youtube Video Link");if(!l)return;new RegExp(/^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)(\S+)?$/).test(l)?n.chain().focus().deleteRange(t).setYoutubeVideo({src:l}).run():alert("Please enter a correct Youtube Video Link")}},{title:"Twitter",description:"Embed a Tweet.",searchTerms:["twitter","embed"],icon:e.jsx(ao,{size:18}),command:({editor:n,range:t})=>{const l=prompt("Please enter Twitter Link");if(!l)return;new RegExp(/^https?:\/\/(www\.)?x\.com\/([a-zA-Z0-9_]{1,15})(\/status\/(\d+))?(\/\S*)?$/).test(l)?n.chain().focus().deleteRange(t).setTweet({src:l}).run():alert("Please enter a correct Twitter Link")}}]}function vo(o){return gt.configure({suggestion:{items:()=>o,render:xt}})}const Se=[{name:"Text",icon:Ye,command:o=>o.chain().focus().clearNodes().run(),isActive:o=>o.isActive("paragraph")&&!o.isActive("bulletList")&&!o.isActive("orderedList")},{name:"Heading 1",icon:be,command:o=>o.chain().focus().clearNodes().toggleHeading({level:1}).run(),isActive:o=>o.isActive("heading",{level:1})},{name:"Heading 2",icon:Ue,command:o=>o.chain().focus().clearNodes().toggleHeading({level:2}).run(),isActive:o=>o.isActive("heading",{level:2})},{name:"Heading 3",icon:Oe,command:o=>o.chain().focus().clearNodes().toggleHeading({level:3}).run(),isActive:o=>o.isActive("heading",{level:3})},{name:"To-do List",icon:He,command:o=>o.chain().focus().clearNodes().toggleTaskList().run(),isActive:o=>o.isActive("taskItem")},{name:"Bullet List",icon:qe,command:o=>o.chain().focus().clearNodes().toggleBulletList().run(),isActive:o=>o.isActive("bulletList")},{name:"Numbered List",icon:Ve,command:o=>o.chain().focus().clearNodes().toggleOrderedList().run(),isActive:o=>o.isActive("orderedList")},{name:"Quote",icon:$e,command:o=>o.chain().focus().clearNodes().toggleBlockquote().run(),isActive:o=>o.isActive("blockquote")},{name:"Code",icon:pe,command:o=>o.chain().focus().clearNodes().toggleCodeBlock().run(),isActive:o=>o.isActive("codeBlock")}],ko=({open:o,onOpenChange:n})=>{const{editor:t}=D();if(!t)return null;const l=Se.filter(d=>d.isActive(t)).pop()??{name:"Multiple"};return e.jsxs(he,{open:o,onOpenChange:n,children:[e.jsx(ge,{asChild:!0,children:e.jsxs(B,{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:l.name}),e.jsx(Be,{className:"h-4 w-4"})]})}),e.jsx(xe,{sideOffset:5,align:"start",className:"w-48 p-1",children:Se.map(d=>e.jsxs(se,{onSelect:r=>{d.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(d.icon,{className:"h-3 w-3"})}),e.jsx("span",{children:d.name})]}),l.name===d.name&&e.jsx(re,{className:"h-4 w-4"})]},d.name))})]})},yo=()=>{const{editor:o}=D();if(!o)return null;const n=[{name:"bold",isActive:t=>t.isActive("bold"),command:t=>t.chain().focus().toggleBold().run(),icon:Ot},{name:"italic",isActive:t=>t.isActive("italic"),command:t=>t.chain().focus().toggleItalic().run(),icon:Kt},{name:"underline",isActive:t=>t.isActive("underline"),command:t=>t.chain().focus().toggleUnderline().run(),icon:lo},{name:"strike",isActive:t=>t.isActive("strike"),command:t=>t.chain().focus().toggleStrike().run(),icon:eo},{name:"code",isActive:t=>t.isActive("code"),command:t=>t.chain().focus().toggleCode().run(),icon:pe}];return e.jsx("div",{className:"flex",children:n.map(t=>e.jsx(se,{onSelect:l=>{t.command(l)},children:e.jsx(B,{size:"sm",className:"rounded-none",variant:"ghost",type:"button",children:e.jsx(t.icon,{className:Y("h-4 w-4",{"text-blue-500":t.isActive(o)})})})},t.name))})};function wo(o){try{return new URL(o),!0}catch{return!1}}function jo(o){if(wo(o))return o;try{if(o.includes(".")&&!o.includes(" "))return new URL(`https://${o}`).toString()}catch{return null}return null}const No=({open:o,onOpenChange:n})=>{const t=a.useRef(null),{editor:l}=D();return a.useEffect(()=>{o&&t.current?.focus()},[o]),l?e.jsxs(he,{open:o,onOpenChange:n,children:[e.jsx(ge,{asChild:!0,children:e.jsxs(B,{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":l.isActive("link")}),children:"Link"})]})}),e.jsx(xe,{align:"start",className:"w-60 p-0",sideOffset:10,children:e.jsxs("form",{onSubmit:d=>{const r=d.currentTarget;d.preventDefault();const u=r[0],p=jo(u.value);p&&(l.chain().focus().setLink({href:p}).run(),n(!1))},className:"flex p-1",children:[e.jsx("input",{ref:t,type:"text",placeholder:"Paste a link",className:"flex-1 bg-background p-1 text-sm outline-none",defaultValue:l.getAttributes("link").href||""}),l.getAttributes("link").href?e.jsx(B,{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:()=>{l.chain().focus().unsetLink().run(),t.current&&(t.current.value=""),n(!1)},children:e.jsx(_t,{className:"h-4 w-4"})}):e.jsx(B,{size:"icon",type:"submit",className:"h-8",children:e.jsx(re,{className:"h-4 w-4"})})]})})]}):null},ze=[{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"}],De=[{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)"}],To=({open:o,onOpenChange:n})=>{const{editor:t}=D();if(!t)return null;const l=ze.find(({color:r})=>t.isActive("textStyle",{color:r})),d=De.find(({color:r})=>t.isActive("highlight",{color:r}));return e.jsxs(he,{open:o,onOpenChange:n,children:[e.jsx(ge,{asChild:!0,children:e.jsxs(B,{size:"sm",className:"gap-2 rounded-none",variant:"ghost",children:[e.jsx("span",{className:"rounded-sm px-1",style:{color:l?.color,backgroundColor:d?.color},children:"A"}),e.jsx(Be,{className:"h-4 w-4"})]})}),e.jsxs(xe,{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"}),ze.map(({name:r,color:u})=>e.jsx(se,{onSelect:()=>{t.commands.unsetColor(),r!=="Default"&&t.chain().focus().setColor(u||"").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:u},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"}),De.map(({name:r,color:u})=>e.jsxs(se,{onSelect:()=>{t.commands.unsetHighlight(),r!=="Default"&&t.chain().focus().setHighlight({color:u}).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:u},children:"A"}),e.jsx("span",{children:r})]}),t.isActive("highlight",{color:u})&&e.jsx(re,{className:"h-4 w-4"})]},r))]})]})]})},Co=()=>{const{editor:o}=D();return o?e.jsx(B,{variant:"ghost",size:"sm",className:"rounded-none w-12",onClick:()=>{if(o.isActive("math"))o.chain().focus().unsetLatex().run();else{const{from:n,to:t}=o.state.selection,l=o.state.doc.textBetween(n,t);if(!l)return;o.chain().focus().setLatex({latex:l}).run()}},children:e.jsx(Ft,{className:Y("size-4",{"text-blue-500":o.isActive("math")}),strokeWidth:2.3})}):null},Ao="notebook-table-bubble-menu",_=({label:o,onClick:n,disabled:t,icon:l,tone:d="default"})=>e.jsx(B,{type:"button",size:"icon",variant:"ghost",disabled:t,onClick:n,title:o,className:Y("h-8 w-8",d==="destructive"&&"text-destructive hover:text-destructive"),children:e.jsx(l,{className:"h-4 w-4"})}),Ke=({className:o})=>{const{editor:n}=D();if(!n)return null;const t=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",o),children:[e.jsx(_,{label:"Add column before",icon:rt,onClick:()=>n.chain().focus().addColumnBefore().run(),disabled:!t.addColumnBefore()}),e.jsx(_,{label:"Add column after",icon:at,onClick:()=>n.chain().focus().addColumnAfter().run(),disabled:!t.addColumnAfter()}),e.jsx(U,{orientation:"vertical",className:"h-5"}),e.jsx(_,{label:"Add row above",icon:it,onClick:()=>n.chain().focus().addRowBefore().run(),disabled:!t.addRowBefore()}),e.jsx(_,{label:"Add row below",icon:Bt,onClick:()=>n.chain().focus().addRowAfter().run(),disabled:!t.addRowAfter()}),e.jsx(U,{orientation:"vertical",className:"h-5"}),e.jsx(_,{label:"Toggle header row",icon:be,onClick:()=>n.chain().focus().toggleHeaderRow().run(),disabled:!t.toggleHeaderRow()}),e.jsx(U,{orientation:"vertical",className:"h-5"}),e.jsx(_,{label:"Delete column",icon:Re,onClick:()=>n.chain().focus().deleteColumn().run(),disabled:!t.deleteColumn()}),e.jsx(_,{label:"Delete row",icon:Re,onClick:()=>n.chain().focus().deleteRow().run(),disabled:!t.deleteRow()}),e.jsx(_,{label:"Delete table",icon:lt,onClick:()=>n.chain().focus().deleteTable().run(),disabled:!t.deleteTable(),tone:"destructive"})]})};function Eo(o){const{$from:n}=o.state.selection,t=St(n,d=>d.type.name==="table");if(!t)return null;const l=o.view.nodeDOM(t.pos);return l instanceof HTMLElement?l:null}const Mo=({className:o})=>{const{editor:n}=D();return!n||n.isDestroyed?null:e.jsx(Pe,{pluginKey:Ao,shouldShow:({editor:t})=>t.isEditable&&t.isActive("table"),tippyOptions:{placement:"bottom",moveTransition:"transform 0.15s ease-out"},children:e.jsx(Ke,{className:o})})},Io=({className:o})=>{const{editor:n}=D(),[t,l]=a.useState(null),d=a.useCallback(()=>{if(!n||n.isDestroyed||!n.isEditable){l(null);return}if(!n.isActive("table")){l(null);return}const u=Eo(n);if(!u){l(null);return}const p=n.view.dom.parentElement||n.view.dom,y=p.getBoundingClientRect(),x=u.getBoundingClientRect(),M=x.top-y.top+p.scrollTop-12,g=x.left-y.left+p.scrollLeft;l({top:M,left:g,width:x.width})},[n]),r=a.useMemo(()=>{let u=0;return()=>{u||(u=window.requestAnimationFrame(()=>{u=0,d()}))}},[d]);return a.useEffect(()=>{if(!n||n.isDestroyed)return;const u=n.view.dom.parentElement||n.view.dom;return d(),n.on("selectionUpdate",r),n.on("transaction",r),n.on("focus",r),n.on("blur",r),u.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),u.removeEventListener("scroll",r),window.removeEventListener("resize",r)}},[n,r,d]),!n||n.isDestroyed||!t?null:e.jsx("div",{className:Y("absolute z-30",o),style:{top:t.top,left:t.left,width:t.width},children:e.jsx(Ke,{className:"w-full justify-start"})})},Ro=()=>{const{editor:o}=D(),[n,t]=a.useState(!1),[l,d]=a.useState(!1),[r,u]=a.useState(!1);return o?e.jsx(Pe,{tippyOptions:{placement:"top",onHidden:()=>{t(!1),d(!1),u(!1)}},className:"flex w-fit max-w-[90vw] overflow-hidden rounded-md border border-muted bg-background shadow-xl",children:e.jsxs(a.Fragment,{children:[e.jsx(ko,{open:n,onOpenChange:t}),e.jsx(U,{orientation:"vertical"}),e.jsx(No,{open:r,onOpenChange:u}),e.jsx(U,{orientation:"vertical"}),e.jsx(Co,{}),e.jsx(U,{orientation:"vertical"}),e.jsx(yo,{}),e.jsx(U,{orientation:"vertical"}),e.jsx(To,{open:l,onOpenChange:d})]})}):null};function O({width:o,className:n=""}){return e.jsx("div",{className:`h-4 bg-muted rounded animate-pulse ${n}`,style:{width:o}})}function ne(){return e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{width:"85%"}),e.jsx(O,{width:"70%"}),e.jsx(O,{width:"90%"})]})}function Le({message:o="Loading..."}){const{t:n}=fe("notebook"),t=o==="Loading..."?n("loading"):o;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(ne,{}),e.jsx(ne,{}),e.jsx("div",{className:"pt-4",children:e.jsx("div",{className:"h-6 bg-muted rounded animate-pulse w-1/2"})}),e.jsx(ne,{}),e.jsxs("div",{className:"bg-muted/50 rounded-md p-4 space-y-2",children:[e.jsx(O,{width:"60%",className:"h-3"}),e.jsx(O,{width:"80%",className:"h-3"}),e.jsx(O,{width:"45%",className:"h-3"}),e.jsx(O,{width:"70%",className:"h-3"})]}),e.jsx(ne,{})]})]})}),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:t})]})})]})}function So({status:o}){const{t:n}=fe("notebook");switch(o){case"saving":return e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(Fe,{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(re,{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(ut,{className:"w-3 h-3"}),e.jsx("span",{children:n("save_failed")})]});default:return null}}function zo({notebookId:o,autoSaveStatus:n,getMarkdown:t,allowCopy:l=!0}){const[d,r]=a.useState(!1),{toast:u}=ct(),{t:p}=fe("notebook"),y=l&&(!!o||!!t),x=a.useCallback(async()=>{if(t){const g=await Promise.resolve(t());if(typeof g=="string")return g}return o?await me(o):""},[t,o]),M=a.useCallback(async()=>{if(y){r(!0);try{const g=await x();if(navigator?.clipboard?.writeText)await navigator.clipboard.writeText(g);else{const w=document.createElement("textarea");w.value=g,w.style.position="fixed",w.style.opacity="0",document.body.appendChild(w),w.focus(),w.select(),document.execCommand("copy"),w.remove()}u({title:p("copy_success_title"),description:p("copy_success_desc"),variant:"success"})}catch(g){console.error("[NotebookToolbar] Copy failed:",g),u({title:p("copy_failed_title"),description:p("try_again"),variant:"destructive"})}finally{r(!1)}}},[y,x,p,u]);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(So,{status:n})}),e.jsx("div",{className:"flex items-center gap-1",children:y?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:M,title:p("copy"),children:d?e.jsx(Fe,{className:"w-4 h-4 animate-spin"}):e.jsx(dt,{className:"w-4 h-4"})}):null})]})}const Do={type:"doc",content:[{type:"paragraph"}]},_e="prosemirror";function Lo(o){const n=o.state.doc;if(n.childCount!==1)return!1;const t=n.firstChild;return t?t.type.name!=="paragraph"?!1:t.content.size===0&&n.textContent.trim().length===0:!0}function Jo({context:o,setDirty:n,setTitle:t,className:l,onMarkdownChange:d}){const r=o.resourceId,u=o.resourceName||"Untitled Notebook",p=typeof o.customData?.inlineMarkdown=="string"?o.customData.inlineMarkdown:null,y=p!==null,x=o.customData?.readonly===!0||y,M=mt(s=>s.projectId),g=typeof o.customData?.projectId=="string"?o.customData.projectId:M||void 0,w=o.resourcePath??void 0,f=go(o)==="markdown",T=a.useMemo(()=>f?ft(r):null,[f,r]),K=a.useRef(null),I=a.useRef(g),E=a.useRef(null),F=a.useRef(null),h=a.useRef(null),v=a.useRef(null),ke=a.useRef(null),R=a.useRef(!1),[b,ye]=a.useState(null),[V,ae]=a.useState(null),[k,ie]=a.useState(null),S=a.useRef(null),[Ge,J]=a.useState(null),[Qe,P]=a.useState(!0),[we,G]=a.useState(null),[X,N]=a.useState("idle"),[We,Je]=a.useState(0),{diffEvent:Q,clearDiff:Xe}=Pt({fileId:r??void 0,filePath:w,projectId:g}),Ze=a.useCallback(()=>b?W(b):typeof k=="string"?k:typeof S.current=="string"?S.current:"",[b,k]),q=a.useCallback(s=>f?pt(s,T):s,[f,T]),je=a.useCallback(s=>f?ht(s,T):s,[f,T]),Z=a.useCallback(async s=>{if(!b||!r||!f)return;const c=W(b),i=h.current??c;if(!(!s&&c!==i))try{const m=q(await me(r));R.current=!0,oe(b,m),h.current=m}catch(m){console.warn("[NotebookEditor] Failed to refresh markdown",m)}},[b,f,r,q]),$=r??null;ke.current!==$&&(ke.current=$,v.current=null),a.useEffect(()=>{Q?.diff&&Z(!1)},[Q,Z]),a.useEffect(()=>{if(!r||y)return;const s=c=>{const i=c.detail;i&&(i.fileId&&i.fileId!==r||!i.fileId&&i.filePath&&w&&i.filePath!==w||!i.fileId&&!i.filePath||Z(!!i.force))};return window.addEventListener("ds:file:reload",s),()=>window.removeEventListener("ds:file:reload",s)},[w,y,r,Z]);const C=a.useMemo(()=>bt({onUpload:async s=>{const c=I.current;if(!c)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}),f&&T){const i=await Ce(c,T.baseDocumentId,s,"image");return String(Ee(i.asset_url))}return ce(c,s,"image")},validateFn:s=>{try{return I.current?Et(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}}}),[f,T]);a.useEffect(()=>{I.current=g},[g]);const ee=a.useCallback(async s=>{const c=I.current;if(!b||!c)return;const i=s.filter(m=>m.type.startsWith("video/"));if(i.length!==0)for(const m of i)try{console.debug("[NotebookEditor] video upload start",{fileName:m.name,fileType:m.type,fileSize:m.size});const A=await ce(c,m,"video");b.chain().focus().insertContent({type:"video",attrs:{src:A}}).run()}catch(A){console.error("[NotebookEditor] Video upload failed:",A)}},[b]);a.useEffect(()=>{t(u)},[u,t]),a.useEffect(()=>{n(X==="saving"||X==="error")},[X,n]),a.useEffect(()=>{!b||k===null||r&&v.current===r&&k.trim()&&Lo(b)&&(R.current=!0,oe(b,k),f?h.current=k:S.current=k)},[b,k,f,r]),a.useEffect(()=>{d&&f&&k!==null&&d(k)},[k,f,d]);const Ne=a.useCallback(async(s,c)=>{const i=I.current;if(i)try{console.debug("[NotebookEditor] image upload start",{fileName:s.name,fileType:s.type,fileSize:s.size});const m=f&&T?String(Ee((await Ce(i,T.baseDocumentId,s,"image")).asset_url)):await ce(i,s,"image");c.chain().focus().setImage({src:m}).run()}catch(m){console.error("[NotebookEditor] Image upload failed:",m)}},[f,T]),le=a.useMemo(()=>bo(Ne),[Ne]),Te=a.useMemo(()=>vo(le),[le]),et=a.useMemo(()=>{const s=[...vt,Te];return V&&s.unshift(zt.configure({document:V,field:_e})),s},[V,Te]);a.useEffect(()=>{if(y){G(null),P(!1),N("idle"),ie(q(p??"")),ae(null),J($),h.current=q(p??""),S.current=p??"",R.current=!1,v.current=$;return}if(!r){G("No notebook ID provided"),P(!1);return}G(null),P(!0),N("idle"),ie(null),ae(null),J(null),h.current=null,S.current=null,R.current=!1,v.current=null;let s=!1;return(async()=>{try{let i=null;try{i=await me(r)}catch(z){if(f)throw z;console.warn("[NotebookEditor] Failed to load markdown for notebook:",z)}if(s)return;const m=q(i??"");if(ie(m),S.current=i??"",f){h.current=m,v.current=r,J(r),P(!1);return}if(!g){G("No project ID provided"),P(!1);return}const A=await xo({projectId:g,notebookId:r,readonly:x,onStatus:N,onReset:()=>{setHistoryOpen(!1),setCollaboratorsOpen(!1),Je(z=>z+1)}});if(s){A.dispose();return}K.current=A,ae(A.ydoc),v.current=r,J(r),P(!1)}catch(i){if(s)return;console.error("[NotebookEditor] Initialization failed:",i),G(i instanceof Error?i.message:"Failed to initialize editor"),P(!1)}})(),()=>{s=!0,E.current&&(clearTimeout(E.current),E.current=null),F.current&&(clearTimeout(F.current),F.current=null),v.current=null,K.current?.dispose(),K.current=null,ye(null)}},[p,y,r,$,g,f,x,We,q]);const tt=a.useCallback(s=>{if(x||!f||!r||v.current!==r)return;if(R.current){R.current=!1;return}if(d){F.current&&clearTimeout(F.current);const i=r;F.current=setTimeout(()=>{v.current===i&&d(W(s))},120)}E.current&&clearTimeout(E.current),N("saving");const c=r;E.current=setTimeout(async()=>{try{if(v.current!==c)return;const i=W(s),m=je(i);if(h.current===i){N("saved"),setTimeout(()=>N("idle"),1500);return}await Ae(c,m),h.current=i,N("saved"),setTimeout(()=>N("idle"),1500)}catch(i){console.error("[NotebookEditor] Markdown save failed:",i),N("error")}},1500)},[x,f,r,d,je]),ot=a.useCallback(s=>{if(x||f||!r||v.current!==r)return;if(R.current){R.current=!1;return}E.current&&clearTimeout(E.current),N("saving");const c=r;E.current=setTimeout(async()=>{try{if(v.current!==c)return;const i=W(s);if(S.current===i){N("saved"),setTimeout(()=>N("idle"),1500);return}await Ae(c,i),S.current=i,N("saved"),setTimeout(()=>N("idle"),1500)}catch(i){console.error("[NotebookEditor] Notebook markdown save failed:",i),N("error")}},1500)},[x,f,r]),H=a.useCallback(s=>s?s.files&&s.files.length>0?!0:(s.items?Array.from(s.items):[]).some(i=>i.kind==="file"):!1,[]),te=a.useCallback(s=>{if(!s)return[];if(!H(s))return[];if(s.files&&s.files.length>0)return Array.from(s.files);const c=s.items?Array.from(s.items):[],i=[];for(const m of c)if(m.kind==="file"){const A=m.getAsFile();A&&i.push(A)}return i},[H]),nt=a.useCallback(s=>{if(b?.view.dragging||!H(s.dataTransfer))return;const c=te(s.dataTransfer);c.length&&(s.preventDefault(),s.dataTransfer.dropEffect="copy",console.debug("[NotebookEditor] dragover",{fileCount:c.length,fileTypes:c.map(i=>i.type||"unknown"),dataTypes:Array.from(s.dataTransfer.types??[]),projectId:I.current}))},[b,te,H]),st=a.useCallback(s=>{if(b?.view.dragging||!H(s.dataTransfer))return;const c=te(s.dataTransfer);if(console.debug("[NotebookEditor] container drop",{fileCount:c.length,fileTypes:c.map(m=>m.type||"unknown"),dataTypes:Array.from(s.dataTransfer.types??[]),hasUploadFn:!!C,projectId:I.current}),!c.length)return;if(s.preventDefault(),s.stopPropagation(),!b){console.warn("[NotebookEditor] container drop ignored: editor missing");return}if(c.some(m=>m.type.startsWith("video/"))&&ee(c),C){const m=de(b.view,s.nativeEvent,!1,C);console.debug("[NotebookEditor] container drop handled",{handled:m})}else console.warn("[NotebookEditor] container drop ignored: uploadFn missing")},[b,te,ee,C,H]);return we?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:we}),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"})})]})}):Ge===$&&!Qe?!f&&!V?e.jsx(Le,{message:"Loading document..."}):e.jsxs("div",{className:`notebook-editor flex flex-col flex-1 min-h-0 ${l||""}`,children:[e.jsx(zo,{notebookId:!y&&r?r:"",autoSaveStatus:X,getMarkdown:Ze}),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:nt,onDrop:st,children:[Q?.diff?e.jsx(Ht,{diff:Q.diff,changeType:Q.changeType,title:"AI change",subtitle:u,onClose:Xe,className:"absolute right-4 top-4 z-20 w-[min(420px,46vw)]"}):null,e.jsx(kt,{children:e.jsxs(yt,{extensions:et,className:"notebook-doc-editor relative h-full w-full overflow-y-auto",editorProps:{handleDOMEvents:{keydown:(s,c)=>At(c)},handlePaste:(s,c)=>{const i=Array.from(c.clipboardData?.files??[]);return i.some(A=>A.type.startsWith("video/"))?(c.preventDefault(),ee(i),C&&Me(s,c,C),!0):C?Me(s,c,C):!1},handleDrop:(s,c,i,m)=>{if(!H(c.dataTransfer))return!1;if(m)return console.debug("[NotebookEditor] drop ignored: internal move",{moved:m,projectId:I.current}),!1;const z=Array.from(c.dataTransfer?.files??[]);if(console.debug("[NotebookEditor] drop",{moved:m,fileCount:z.length,fileTypes:z.map(L=>L.type||"unknown"),dataTypes:Array.from(c.dataTransfer?.types??[]),hasUploadFn:!!C,projectId:I.current}),z.some(L=>L.type.startsWith("video/"))){if(c.preventDefault(),ee(z),C){const L=de(s,c,m,C);console.debug("[NotebookEditor] drop handled (video+image)",{handled:L})}return!0}if(C){const L=de(s,c,m,C);return console.debug("[NotebookEditor] drop handled (image)",{handled:L}),L}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(ye(s),f&&k!==null&&(R.current=!0,oe(s,k),h.current=k),!f&&V){const c=V.getXmlFragment(_e);c.length===0&&k!==null?(R.current=!0,oe(s,k),S.current=k):c.length===0&&!x&&s.commands.setContent(Do)}x&&s.setEditable(!1)},onUpdate:({editor:s})=>{tt(s),ot(s)},slotAfter:e.jsx(Ct,{}),children:[e.jsxs(wt,{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(jt,{className:"px-2 text-muted-foreground",children:"No results"}),e.jsx(Nt,{children:le.map(s=>e.jsxs(Tt,{value:s.title,onCommand:c=>s.command?.(c),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(Io,{}),e.jsx(Mo,{}),e.jsx(Ro,{})]})})]})})})]}):e.jsx(Le,{message:"Initializing editor..."})}export{Le as E,Jo as N,zo as a};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CBNVuWcP.js","assets/plugin-monaco-C8UgLomw.js","assets/plugin-terminal-MXFIPun8.js","assets/plugin-notebook-HbW2K-1c.js","assets/index-BpV6lusQ.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{y as zt,u as ne,j as n,a3 as Pn,I as Fn,b as M,h as On,k as Ln,X as Kt,l as Hn,aa as $n,r as ce,aQ as Gt,H as Bn,bO as nt,bP as Un,J as pe,bQ as it,bR as at,bS as ct,bT as lt,bU as dt,bV as Vn,bo as mt,bW as Xt,i as Qn,bX as qn,bY as Wn,m as zn,f as Kn,a as ot,n as Gn,o as Ft,x as Xn,q as Zn,c as Jn,U as Ot,s as Lt,bZ as Yn,b_ as eo,_ as Ht,A as to,b$ as no,O as Zt,T as oo,c0 as ro,c1 as rt,c2 as so}from"./index-CBNVuWcP.js";import{r as c}from"./plugin-monaco-C8UgLomw.js";import{a as io}from"./file-socket-CfQPKQKj.js";import{M as ao,i as co,m as lo,c as uo}from"./pdf-effect-queue-J8OnM0jE.js";import{Z as K,R as fo,g as mo,a as po,e as go,b as bo,c as ho,d as xo}from"./PdfLoader-eWBONbQP.js";import{Z as yo,a as vo}from"./zoom-out-E_gaeAxL.js";import{C as wo}from"./chevron-up-C9Qpx4DE.js";import{S as Jt}from"./index-CwNu1aH4.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";import"./plugin-pdf-CR8hgQBV.js";/**
|
|
3
|
-
* @license lucide-react v0.511.0 - ISC
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the ISC license.
|
|
6
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const _o=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],ko=zt("panel-right",_o);/**
|
|
8
|
-
* @license lucide-react v0.511.0 - ISC
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the ISC license.
|
|
11
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/const No=[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]],Yt=zt("sticky-note",No),jo=c.memo(function({scale:o,onScaleChange:r}){const{t:i}=ne("pdf_viewer"),m=()=>{const d=K.findIndex(v=>v>=o);d>0&&r(K[d-1])},b=()=>{const d=K.findIndex(v=>v>=o);d<K.length-1&&r(K[d+1])},s=d=>{r(parseFloat(d.target.value))};return n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{onClick:m,disabled:o<=K[0],className:M("p-1.5 rounded hover:bg-muted transition-colors","disabled:opacity-50 disabled:cursor-not-allowed"),title:i("zoom_out"),children:n.jsx(yo,{className:"w-4 h-4"})}),n.jsx("select",{value:o,onChange:s,className:M("w-20 px-2 py-1 text-sm rounded","bg-muted/50 border border-border","focus:outline-none focus:ring-2 focus:ring-primary/50"),children:K.map(d=>n.jsxs("option",{value:d,children:[Math.round(d*100),"%"]},d))}),n.jsx("button",{onClick:b,disabled:o>=K[K.length-1],className:M("p-1.5 rounded hover:bg-muted transition-colors","disabled:opacity-50 disabled:cursor-not-allowed"),title:i("zoom_in"),children:n.jsx(vo,{className:"w-4 h-4"})})]})}),So=c.memo(function({currentPage:o,totalPages:r,onPageChange:i}){const{t:m}=ne("pdf_viewer"),[b,s]=c.useState(String(o)),d=c.useRef(null);c.useEffect(()=>{s(String(o))},[o]);const v=()=>{o>1&&i(o-1)},g=()=>{o<r&&i(o+1)},f=R=>{s(R.target.value)},x=()=>{const R=parseInt(b,10);!isNaN(R)&&R>=1&&R<=r?i(R):s(String(o))},j=R=>{R.key==="Enter"?(x(),d.current?.blur()):R.key==="Escape"&&(s(String(o)),d.current?.blur())};return n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{onClick:v,disabled:o<=1,className:M("p-1.5 rounded hover:bg-muted transition-colors","disabled:opacity-50 disabled:cursor-not-allowed"),title:m("previous_page"),children:n.jsx(wo,{className:"w-4 h-4"})}),n.jsxs("div",{className:"flex items-center gap-1 text-sm whitespace-nowrap",children:[n.jsx("input",{ref:d,type:"text",value:b,onChange:f,onBlur:x,onKeyDown:j,className:M("w-12 px-2 py-1 text-center rounded","bg-muted/50 border border-border","focus:outline-none focus:ring-2 focus:ring-primary/50")}),n.jsxs("span",{className:"shrink-0 whitespace-nowrap text-muted-foreground",children:["/ ",r]})]}),n.jsx("button",{onClick:g,disabled:o>=r,className:M("p-1.5 rounded hover:bg-muted transition-colors","disabled:opacity-50 disabled:cursor-not-allowed"),title:m("next_page"),children:n.jsx(Hn,{className:"w-4 h-4"})})]})}),Ro=c.memo(function({value:o,onChange:r,placeholder:i}){const{t:m}=ne("pdf_viewer"),b=c.useRef(null),s=()=>{r(""),b.current?.focus()};return n.jsxs("div",{className:"relative flex items-center",children:[n.jsx(Ln,{className:"absolute left-2 w-4 h-4 text-muted-foreground pointer-events-none"}),n.jsx("input",{ref:b,type:"text",value:o,onChange:d=>r(d.target.value),placeholder:i||m("search_placeholder"),className:M("w-48 pl-8 pr-8 py-1.5 text-sm rounded","bg-muted/50 border border-border","placeholder:text-muted-foreground/60","focus:outline-none focus:ring-2 focus:ring-primary/50")}),o&&n.jsx("button",{onClick:s,className:"absolute right-2 p-0.5 rounded hover:bg-muted/80 transition-colors",children:n.jsx(Kt,{className:"w-3 h-3 text-muted-foreground"})})]})});function $t(){return n.jsx("div",{className:"w-px h-6 bg-border mx-2"})}const Io=c.memo(function({scale:o,onScaleChange:r,currentPage:i,totalPages:m,onPageChange:b,sidebarVisible:s,onSidebarToggle:d,searchQuery:v="",onSearchChange:g,onDownload:f,onInfo:x,infoDisabled:j=!1,markdownActive:R,onMarkdownToggle:P,markdownLabel:D,markdownTitle:S,reviewOpinionActive:C,onReviewOpinionToggle:k,reviewOpinionLabel:E,reviewOpinionTitle:u}){const{t:y}=ne("pdf_viewer"),a=!!R,p=typeof P=="function",_=D?.trim()||y("markdown"),A=S?.trim()||y("open_markdown"),I=!!C,h=typeof k=="function",H=E?.trim()||y("review_opinion"),U=u?.trim()||y("open_review_opinion"),F=typeof x=="function",G=!!(g||f||F);return n.jsxs("div",{className:M("flex flex-wrap items-center gap-3 px-4 py-2","bg-muted/30 border-b border-border"),children:[n.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-2",children:[g?n.jsx(Ro,{value:v,onChange:g,placeholder:y("search_pdf_placeholder")}):null,f?n.jsx("button",{onClick:f,className:"p-1.5 rounded hover:bg-muted transition-colors",title:y("download_pdf"),children:n.jsx(Pn,{className:"w-4 h-4"})}):null,F?n.jsx("button",{onClick:x,disabled:j,className:M("p-1.5 rounded transition-colors","hover:bg-muted",j&&"opacity-50 cursor-not-allowed"),title:y("paper_info"),"aria-label":y("paper_info"),children:n.jsx(Fn,{className:"h-4 w-4"})}):null,G?n.jsx($t,{}):null,n.jsx(jo,{scale:o,onScaleChange:r}),n.jsx($t,{}),n.jsx(So,{currentPage:i,totalPages:m,onPageChange:b})]}),n.jsxs("div",{className:"ml-auto flex items-center justify-end gap-2",children:[p?n.jsxs("button",{type:"button",onClick:P,className:M("flex items-center gap-2 px-3 py-1.5 rounded-full border transition-colors text-sm","bg-background hover:bg-muted/60 border-border",a&&"bg-primary/10 text-primary border-primary/20"),title:A,children:[n.jsx(On,{className:"w-4 h-4"}),_]}):null,h?n.jsxs("button",{type:"button",onClick:k,className:M("flex items-center gap-2 px-3 py-1.5 rounded-full border transition-colors text-sm","bg-background hover:bg-muted/60 border-border",I&&"bg-primary/10 text-primary border-primary/20"),title:U,children:[n.jsx(ao,{className:"w-4 h-4"}),H]}):null,n.jsxs("button",{type:"button",onClick:d,className:M("flex items-center gap-2 px-3 py-1.5 rounded-full border transition-colors text-sm","bg-background hover:bg-muted/60 border-border",s&&"bg-primary/10 text-primary border-primary/20"),title:y(s?"hide_annotations":"show_annotations"),children:[n.jsx(ko,{className:"w-4 h-4"}),y(s?"hide":"show")]})]})]})}),Bt={scale:1,fitMode:"custom",currentPage:1,totalPages:0,scrollTop:0,searchQuery:"",searchResults:[],currentSearchIndex:-1,sidebarVisible:!1,selectedAnnotationId:null},en=$n((e,o)=>({...Bt,setScale:r=>{const i=Math.max(K[0],Math.min(K[K.length-1],r));e({scale:i,fitMode:"custom"})},setFitMode:r=>{e({fitMode:r})},setCurrentPage:r=>{const{totalPages:i}=o(),m=Math.max(1,Math.min(r,i||1));e({currentPage:m})},setTotalPages:r=>{e({totalPages:r})},setScrollTop:r=>{e({scrollTop:r})},scrollToPage:r=>{const{totalPages:i,setCurrentPage:m}=o(),b=Math.max(1,Math.min(r,i||1));m(b)},setSearchQuery:r=>{e({searchQuery:r,currentSearchIndex:-1})},setSearchResults:r=>{e({searchResults:r,currentSearchIndex:r.length>0?0:-1})},nextSearchResult:()=>{const{searchResults:r,currentSearchIndex:i}=o();if(r.length===0)return;const m=(i+1)%r.length;e({currentSearchIndex:m})},prevSearchResult:()=>{const{searchResults:r,currentSearchIndex:i}=o();if(r.length===0)return;const m=i<=0?r.length-1:i-1;e({currentSearchIndex:m})},toggleSidebar:()=>{e(r=>({sidebarVisible:!r.sidebarVisible}))},selectAnnotation:r=>{e({selectedAnnotationId:r})},scrollToAnnotation:r=>{e({selectedAnnotationId:r})},reset:()=>{e(Bt)}}));function me(e){const o=e.position?{...e.position,boundingRect:{...e.position.boundingRect,width:e.position.boundingRect?.width??100,height:e.position.boundingRect?.height??100},rects:Array.isArray(e.position.rects)?e.position.rects.map(i=>({...i,width:i?.width??100,height:i?.height??100})):[]}:void 0,r=e.content;return{id:String(e.id),position:o,content:r,comment:String(e.comment??""),kind:e.kind==="question"||e.kind==="task"?e.kind:"note",color:String(e.color??"#F1E9D0"),tags:Array.isArray(e.tags)?e.tags.map(String):[],createdBy:String(e.created_by??e.createdBy??""),author:e.author?{id:String(e.author.id),handle:String(e.author.handle??"user"),color:String(e.author.color??"#F1E9D0")}:null,createdAt:String(e.created_at??e.createdAt??new Date().toISOString()),updatedAt:String(e.updated_at??e.updatedAt??new Date().toISOString()),fileId:String(e.file_id??e.fileId??""),projectId:String(e.project_id??e.projectId??"")}}function Eo(e){return{file_id:e.fileId,position:e.position,content:e.content,comment:e.comment??"",kind:e.kind??"note",color:e.color,tags:e.tags??[]}}function Co(e){return{comment:e.comment,kind:e.kind,position:e.position,content:e.content,color:e.color,tags:e.tags}}const _e={list:e=>`/api/v1/annotations/file/${e}`,create:()=>"/api/v1/annotations/",get:e=>`/api/v1/annotations/${e}`,update:e=>`/api/v1/annotations/${e}`,delete:e=>`/api/v1/annotations/${e}`,search:e=>`/api/v1/annotations/project/${e}`},We={async listAnnotations(e){const o=await ce.get(_e.list(e));return Array.isArray(o.data)?o.data.map(me):(o.data.items||[]).map(me)},async createAnnotation(e){const o=await ce.post(_e.create(),Eo(e));return me(o.data)},async getAnnotation(e){const o=await ce.get(_e.get(e));return me(o.data)},async updateAnnotation(e,o){const r=await ce.patch(_e.update(e),Co(o));return me(r.data)},async deleteAnnotation(e){await ce.delete(_e.delete(e))},async searchAnnotations(e,o,r){const i=new URLSearchParams;o&&i.set("q",o),r?.color&&i.set("color",r.color),r?.tag&&i.set("tag",r.tag),r?.page&&i.set("page",String(r.page)),r?.limit&&i.set("limit",String(r.limit));const m=`${_e.search(e)}${i.toString()?`?${i.toString()}`:""}`,b=await ce.get(m);return Array.isArray(b.data)?b.data.map(me):(b.data.items||[]).map(me)}},le={all:["annotations"],lists:()=>[...le.all,"list"],list:e=>[...le.lists(),e],details:()=>[...le.all,"detail"],detail:e=>[...le.details(),e]};function Ao(e){const o=Gt(),r=le.list(e),{data:i=[],isLoading:m,error:b,refetch:s,isFetching:d}=Bn({queryKey:r,queryFn:()=>We.listAnnotations(e),staleTime:30*1e3,enabled:!!e}),v=nt({mutationFn:u=>We.createAnnotation(u),onSuccess:u=>{o.setQueryData(r,(y=[])=>[u,...y.filter(a=>a.id!==u.id)])},onSettled:()=>o.invalidateQueries({queryKey:r})}),g=nt({mutationFn:({id:u,updates:y})=>We.updateAnnotation(u,y),onMutate:async({id:u,updates:y})=>{await o.cancelQueries({queryKey:r});const a=o.getQueryData(r);return o.setQueryData(r,(p=[])=>p.map(_=>_.id===u?{..._,...y,updatedAt:new Date().toISOString()}:_)),{previousAnnotations:a}},onError:(u,y,a)=>{a?.previousAnnotations&&o.setQueryData(r,a.previousAnnotations)},onSuccess:u=>{o.setQueryData(r,(y=[])=>y.map(a=>a.id===u.id?u:a))},onSettled:()=>{o.invalidateQueries({queryKey:r})}}),f=nt({mutationFn:u=>We.deleteAnnotation(u),onMutate:async u=>{await o.cancelQueries({queryKey:r});const y=o.getQueryData(r);return o.setQueryData(r,(a=[])=>a.filter(p=>p.id!==u)),{previousAnnotations:y}},onError:(u,y,a)=>{a?.previousAnnotations&&o.setQueryData(r,a.previousAnnotations)},onSettled:()=>{o.invalidateQueries({queryKey:r})}});return{annotations:i,isLoading:m,isFetching:d,error:b,createAnnotation:async u=>v.mutateAsync(u),updateAnnotation:async(u,y)=>g.mutateAsync({id:u,updates:y}),deleteAnnotation:async u=>f.mutateAsync(u),refreshAnnotations:()=>s(),getAnnotationById:u=>i.find(y=>y.id===u),getAnnotationsByPage:u=>i.filter(y=>y.position.pageNumber===u),getAnnotationsByTag:u=>i.filter(y=>y.tags.includes(u)),getAnnotationsByColor:u=>i.filter(y=>y.color===u),getAllTags:()=>{const u=new Set;return i.forEach(y=>y.tags.forEach(a=>u.add(a))),Array.from(u).sort()},isCreating:v.isPending,isUpdating:g.isPending,isDeleting:f.isPending,createError:v.error,updateError:g.error,deleteError:f.error}}const To="_tip_14ms1_1",Mo="_tipNote_14ms1_38",Do="_tipQuestion_14ms1_42",Po="_tipTask_14ms1_46",ze={tip:To,tipNote:Mo,tipQuestion:Do,tipTask:Po};function Fo({onConfirm:e,onCancel:o,onOpen:r,onUpdate:i,onAskCopilot:m,authorColor:b,authorHandle:s,showAuthorHandle:d,onToggleAuthorHandle:v}){const{t:g}=ne("pdf_viewer"),[f,x]=c.useState("note"),[j,R]=c.useState("");c.useEffect(()=>{r(),i?.()},[]),c.useEffect(()=>{i?.()},[f,i]);const P=c.useMemo(()=>{switch(f){case"question":return g("type_question");case"task":return g("type_task");default:return g("add_note_optional")}},[f,g]),D=()=>{e({text:j.trim(),emoji:f})};return n.jsxs(Un,{className:M("w-80 border border-border bg-popover text-popover-foreground shadow-soft-lg","backdrop-blur supports-[backdrop-filter]:bg-popover/95",ze.tip,f==="note"&&ze.tipNote,f==="question"&&ze.tipQuestion,f==="task"&&ze.tipTask),children:[n.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b",children:[n.jsx("div",{className:"flex items-center gap-2 text-sm font-medium",children:n.jsx("span",{className:"text-muted-foreground",children:g("add_annotation")})}),n.jsx(pe,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",onClick:o,"aria-label":g("close"),children:n.jsx(Kt,{className:"h-4 w-4"})})]}),n.jsxs("div",{className:"px-3 py-3 space-y-3",children:[n.jsx("div",{className:"flex items-center justify-between",children:n.jsxs(it,{children:[n.jsx(at,{asChild:!0,children:n.jsxs("button",{type:"button",className:"flex items-center gap-2 rounded-md px-2 py-1 text-xs text-muted-foreground hover:text-foreground hover:bg-muted/40 transition-colors",title:s||g("author"),children:[n.jsx("span",{className:"h-2 w-2 rounded-full border border-border",style:{backgroundColor:b||"#F1E9D0"}}),d?n.jsx("span",{className:"text-[11px]",children:s||"user"}):n.jsx("span",{className:"text-[11px]",children:g("author")})]})}),n.jsxs(ct,{align:"start",children:[n.jsx(lt,{children:g("author")}),n.jsx(dt,{disabled:!0,children:s||"user"}),v?n.jsx(dt,{onSelect:S=>{S.preventDefault(),v()},children:g(d?"hide_name":"show_name")}):null]})]})}),n.jsx(Vn,{value:f,onValueChange:x,size:"sm",ariaLabel:g("type_label"),items:[{value:"note",label:g("type_note"),icon:n.jsx(Yt,{className:"h-4 w-4"})},{value:"question",label:"Q",icon:n.jsx(mt,{className:"h-4 w-4"})},{value:"task",label:g("type_task"),icon:n.jsx(Jt,{className:"h-4 w-4"})}],className:"w-full justify-between"}),n.jsx(Xt,{autoFocus:!0,value:j,onChange:S=>R(S.target.value),placeholder:P,className:"min-h-[92px] resize-none",onKeyDown:S=>{if(S.key==="Escape"){S.preventDefault(),o?.();return}(S.metaKey||S.ctrlKey)&&S.key==="Enter"&&(S.preventDefault(),D())}}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:g("save_shortcut")}),n.jsxs("div",{className:"flex items-center gap-2",children:[m?n.jsx(pe,{type:"button",variant:"outline",onClick:m,className:"h-8",children:g("ask_copilot")}):null,n.jsx(pe,{type:"button",onClick:D,className:"h-8",children:g("save")})]})]})]})]})}const Oo="_highlight_dilkk_1",Lo="_parts_dilkk_12",Ho="_part_dilkk_12",$o="_partFocused_dilkk_30",Bo="_scrolledTo_dilkk_38",Uo="_partNote_dilkk_77",Vo="_partQuestion_dilkk_82",Qo="_partTask_dilkk_88",qo="_hintChip_dilkk_94",Wo="_hintChipFocused_dilkk_139",zo="_hintPrimaryLine_dilkk_146",Ko="_hintSecondaryLine_dilkk_159",z={highlight:Oo,parts:Lo,part:Ho,partFocused:$o,scrolledTo:Bo,partNote:Uo,partQuestion:Vo,partTask:Qo,hintChip:qo,hintChipFocused:Wo,hintPrimaryLine:zo,hintSecondaryLine:Ko};function Go(e){return Math.max(0,Math.min(1,e))}function Xo(e){const o=/^#?([0-9a-f]{6})$/i.exec(e.trim());if(!o)return null;const r=Number.parseInt(o[1],16);return{r:r>>16&255,g:r>>8&255,b:r&255}}function Zo(e,o){const r=Xo(e),i=Go(o);return r?`rgba(${r.r}, ${r.g}, ${r.b}, ${i})`:`rgba(241, 233, 208, ${i})`}function Jo({position:e,onClick:o,onMouseOver:r,onMouseOut:i,comment:m,color:b,isScrolledTo:s,hidden:d=!1,emphasized:v=!1,onHoverStart:g,onHoverEnd:f,showOverlayHint:x=!1,overlayHintText:j="View details",overlayHintTitle:R,overlayHintBorderColor:P,overlayHintTextColor:D,overlayHintBackgroundColor:S,overlayHintOffsetY:C=0,overlayHintTopPx:k,overlayHintLeftPx:E,overlayHintWidthPx:u,overlayHintPageHeightPx:y,onOverlayHintClick:a}){if(d)return null;const{rects:p}=e,_=String(j||"").trim()||"Annotation",[A,I]=_.split(`
|
|
13
|
-
`).filter(Boolean),h=m?.emoji==="question"||m?.emoji==="task"?m.emoji:"note",H=h==="question"?z.partQuestion:h==="task"?z.partTask:z.partNote,U=h==="question"?.1:h==="task"?.08:.14,F=p[0],G=F?Math.max(0,Number(F.top||0)+Number(F.height||0)*.5-9):0,se=88,X=typeof k=="number"&&Number.isFinite(k),Z=X?Math.max(0,k):Math.max(0,G+C),W=X||!(typeof y=="number"&&Number.isFinite(y))?Z:Math.max(0,Math.min(Z,y-se));return n.jsxs("div",{className:`Highlight ${z.highlight} ${s?z.scrolledTo:""}`,children:[n.jsx("div",{className:`Highlight__parts ${z.parts}`,children:p.map((J,ge)=>n.jsx("div",{onMouseOver:()=>{r?.(),g?.()},onMouseOut:()=>{i?.(),f?.()},onClick:o,"data-ds-highlight-target":"true",style:{...J,backgroundColor:Zo(b||"#F1E9D0",U)},className:M("Highlight__part",z.part,H,v?z.partFocused:null)},ge))}),x&&F?n.jsxs("button",{type:"button","data-ds-overlay-hint":"true",onClick:J=>{if(J.preventDefault(),J.stopPropagation(),a){a();return}o?.()},onMouseEnter:()=>g?.(),onMouseLeave:()=>f?.(),className:M(z.hintChip,v?z.hintChipFocused:null),style:{top:W,...typeof E=="number"&&Number.isFinite(E)?{left:E}:{},...typeof u=="number"&&Number.isFinite(u)?{width:u,maxWidth:u}:{},...P?{borderColor:P}:{},...D?{color:D}:{},...S?{background:S}:{}},"aria-label":R||_,children:[n.jsx("div",{className:z.hintPrimaryLine,children:A||_}),I?n.jsx("div",{className:z.hintSecondaryLine,children:I}):null]}):null]})}const Yo="_areaHighlight_7ldrr_1",er="_part_7ldrr_8",tr="_scrolledTo_7ldrr_20",nr="_focused_7ldrr_28",Ke={areaHighlight:Yo,part:er,scrolledTo:tr,focused:nr};function or({highlight:e,onChange:o,isScrolledTo:r,onSelect:i,hidden:m=!1,emphasized:b=!1,onHoverStart:s,onHoverEnd:d,...v}){return m?null:n.jsx("div",{className:`${Ke.areaHighlight} ${r?Ke.scrolledTo:""} ${b?Ke.focused:""}`,children:n.jsx(fo,{className:Ke.part,"data-ds-highlight-target":"true",onDragStop:(g,f)=>{const x={...e.position.boundingRect,top:f.y,left:f.x};o(x)},onResizeStop:(g,f,x,j,R)=>{const P={top:R.y,left:R.x,width:x.offsetWidth,height:x.offsetHeight,pageNumber:mo(x)?.number||-1};o(P)},position:{x:e.position.boundingRect.left,y:e.position.boundingRect.top},size:{width:e.position.boundingRect.width,height:e.position.boundingRect.height},onClick:g=>{g.stopPropagation(),g.preventDefault(),i?.()},onMouseEnter:()=>s?.(),onMouseLeave:()=>d?.(),...v})})}function te(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const o=Number(e);if(Number.isFinite(o))return o}return null}function L(e){if(typeof e!="string")return null;const o=e.trim();return o.length>0?o:null}function rr(e){if(!e)return null;const o=e.trim().toLowerCase();return o?o==="evidence"?"suggestion":o==="issue"||o==="suggestion"||o==="verification"?o:o==="needs_verification"||o==="needs verification"||o==="verify"||o==="uncertain"?"verification":null:null}function Ge(e,o){if(!e||typeof e!="object")return null;const r=e,i=te(r.x1),m=te(r.y1),b=te(r.x2),s=te(r.y2);if(i===null||m===null||b===null||s===null)return null;const d=te(r.width),v=te(r.height),g=d&&d>0?d:100,f=v&&v>0?v:100,x=te(r.pageNumber),j=x&&x>0?Math.trunc(x):o;return{x1:Math.min(i,b),y1:Math.min(m,s),x2:Math.max(i,b),y2:Math.max(m,s),width:g,height:f,...j?{pageNumber:j}:{}}}function sr(e){const o=L(e.annotation_id)||L(e.annotationId)||L(e.id);if(!o)return null;const r=te(e.page_number)||te(e.pageNumber)||te(e.position?.pageNumber),i=r&&r>0?Math.trunc(r):null;if(!i)return null;const b=(Array.isArray(e.rects)?e.rects:[]).map(k=>Ge(k,i)).filter(k=>!!k),s=Ge(e.bounding_rect,i)||Ge(e.boundingRect,i)||Ge(e.position?.boundingRect,i)||null,d=b.length?b.reduce((k,E)=>({x1:Math.min(k.x1,E.x1),y1:Math.min(k.y1,E.y1),x2:Math.max(k.x2,E.x2),y2:Math.max(k.y2,E.y2),width:k.width||E.width||100,height:k.height||E.height||100,pageNumber:i}),{...b[0],pageNumber:i}):null,v=s||d;if(!v)return null;const g=L(e.color)||"#F1E9D0",f=rr(L(e.object_type)),x=L(e.severity),j=L(e.review_item_id),R=L(e.display_text)||L(e.content_text)||L(e.content?.text)||"",P=L(e.comment)||L(e.comment_data?.text)||R,D=L(e.summary)||L(e.content?.summary)||L(e.comment_data?.summary)||null,S=Array.isArray(e.tags)?e.tags.map(k=>L(k)).filter(k=>!!k):[],C=new Set(S.map(k=>k.toLowerCase()));return C.add("review_annotation"),f&&(f==="issue"||f==="suggestion"||f==="verification")&&C.add(`review_object:${f}`),x&&C.add(`severity:${x.toLowerCase()}`),j&&C.add(`review_item:${j}`),{id:o,position:{pageNumber:i,rects:b.length?b:[v],boundingRect:v},content:{text:R},comment:{text:P,emoji:"note"},color:g,tags:Array.from(C),previewSummary:D,author:null}}function Me(e){return e==="question"||e==="task"?e:"note"}const ir={note:{label:"Note",dotClass:"bg-amber-400",iconClass:"text-amber-600",Icon:Yt},question:{label:"Q",dotClass:"bg-indigo-400",iconClass:"text-indigo-600",Icon:mt},task:{label:"Task",dotClass:"bg-emerald-400",iconClass:"text-emerald-600",Icon:Jt}},ar={issue:{label:"Issue",dotClass:"bg-rose-500",iconClass:"text-rose-600",Icon:oo},suggestion:{label:"Suggestion",dotClass:"bg-emerald-500",iconClass:"text-emerald-600",Icon:Zt},verification:{label:"Needs Verification",dotClass:"bg-amber-500",iconClass:"text-amber-600",Icon:mt}};function ut(e){let o=!1;for(const r of e||[]){const i=String(r||"").trim().toLowerCase();if(i==="review_annotation"){o=!0;continue}if(i==="review_object:issue")return"issue";if(i==="review_object:suggestion")return"suggestion";if(i==="review_object:verification"||i==="review_object:needs_verification")return"verification";if(i==="review_object:evidence")return"suggestion"}if(!o)return null;for(const r of e||[]){const i=String(r||"").trim().toLowerCase();if(i==="ds_kind:question")return"issue";if(i==="ds_kind:note"||i==="ds_kind:task")return"suggestion"}return null}function ft(e){for(const o of e||[]){const r=String(o||"").trim().toLowerCase();if(r==="ds_kind:question")return"question";if(r==="ds_kind:task")return"task";if(r==="ds_kind:note")return"note"}return null}function tn(e){for(const o of e||[]){const r=String(o||"").trim();if(!r||!r.toLowerCase().startsWith("review_item:"))continue;const i=r.slice(12).trim();if(i)return i}return null}function nn(e){const o=Me(e.comment?.emoji||ft(e.tags)||void 0),r=ut(e.tags);return r?{kind:o,reviewObjectType:r,...ar[r]}:{kind:o,reviewObjectType:null,...ir[o]}}function cr(e,o){return o(e==="question"?"type_question":e==="task"?"type_task":"type_note")}function lr(e,o){return o(e==="issue"?"review_type_issue":e==="verification"?"review_type_verification":"review_type_suggestion")}function on(e,o){return e.reviewObjectType?lr(e.reviewObjectType,o):cr(e.kind,o)}function dr(e){return{borderColor:"rgba(140, 118, 72, 0.95)",textColor:"rgba(15, 15, 15, 0.96)",backgroundColor:"rgba(255, 255, 255, 0.98)"}}function rn(e,o){const r=String(e||"").normalize("NFKC").replace(/\uFFFD/g," ").replace(/\s+/g," ").trim();if(!r||o<=0)return"";const i=r.split(" ");return i.length<=o?r:`${i.slice(0,o).join(" ")}…`}const Ut="__DS_ANNOTATION_MD_CODE_BLOCK__",Vt="__DS_ANNOTATION_MD_INLINE_CODE__",ur=/(^|\n)(```|~~~)[\s\S]*?\n\2[^\n]*($|\n)/g,fr=/`[^`\n]*`/g,mr=/\\\[([\s\S]+?)\\\]/g,pr=/\\\((.+?)\\\)/g;function Qt(e,o,r){const i=[];return{text:e.replace(o,b=>{const s=i.length;return i.push(b),`${r}${s}__`}),segments:i}}function qt(e,o,r){let i=e;return o.forEach((m,b)=>{i=i.replace(`${r}${b}__`,m)}),i}function gr(e){if(!e)return e;const{text:o,segments:r}=Qt(e,ur,Ut),{text:i,segments:m}=Qt(o,fr,Vt);let b=i;b=b.replace(mr,(d,v)=>{const g=String(v||"").trim();return g?`$$
|
|
14
|
-
${g}
|
|
15
|
-
$$`:""}),b=b.replace(pr,(d,v)=>{const g=String(v||"").trim();return g?`$${g}$`:""});const s=qt(b,m,Vt);return qt(s,r,Ut)}const br=[".md",".markdown",".mdx"];function hr(e){const o=e.toLowerCase();return br.some(r=>o.endsWith(r))}function Wt(e){return String(e||"").replace(/[\u2010-\u2015]/g,"-").replace(/\s+/g," ").trim()}function xr(e,o){const r=Wt(e),i=Wt(o);if(!r||!i||i.length<12)return null;const m=r.indexOf(i);if(m>=0){const f=Math.max(0,m-160),x=Math.min(r.length,m+i.length+160);return r.slice(f,x).trim()}const b=i.split(" ").filter(Boolean).slice(0,8);if(b.length<3)return null;const s=b.map(f=>f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*?"),d=r.match(new RegExp(s,"i"));if(!d||typeof d.index!="number")return null;const v=Math.max(0,d.index-160),g=Math.min(r.length,d.index+d[0].length+160);return r.slice(v,g).trim()}function st(){const{t:e}=ne("pdf_viewer");return n.jsx("div",{className:"flex h-full items-center justify-center bg-muted/20",children:n.jsxs("div",{className:"flex flex-col items-center gap-3 text-muted-foreground",children:[n.jsx("div",{className:"h-8 w-8 rounded-full border-2 border-primary/60 border-t-transparent animate-spin"}),n.jsx("span",{className:"text-sm",children:e("loading_pdf")})]})})}function yr({highlight:e,selected:o,followed:r,flash:i,onSelect:m,onDelete:b,onUpdateKind:s,onUpdateComment:d,readOnly:v,registerItemRef:g}){const{t:f}=ne("pdf_viewer"),x=nn(e),j=x.kind,R=on(x,f),D=tn(e.tags)||String(e.id||"").slice(0,8),S=D.length>10?`${D.slice(0,10)}…`:D,C=e.author?.color||e.color||"#F1E9D0",k=e.author?.handle||"user",E=e.tags?.some(h=>h.toLowerCase()==="ai"),u=e.content?.text?String(e.content.text).trim():e.content?.image?f("area_highlight"):"",y=e.content?.text?rn(u,20):u,a=c.useRef(null),[p,_]=c.useState(!1),[A,I]=c.useState(e.comment?.text||"");return c.useEffect(()=>{p||I(e.comment?.text||"")},[e.comment?.text,p]),c.useEffect(()=>{i&&a.current?.scrollIntoView({block:"nearest",behavior:"smooth"})},[i]),c.useEffect(()=>{o&&a.current?.scrollIntoView({block:"nearest",behavior:"smooth"})},[o]),n.jsxs("div",{ref:h=>{a.current=h,g?.(e.id,h)},className:M("group relative p-3 rounded-lg border transition-all cursor-pointer",o?"border-primary bg-primary/5":r?"border-border bg-muted/30 hover:bg-muted/45":"border-border/60 hover:bg-muted/40",i?"ring-2 ring-primary/30 bg-primary/10 shadow-soft-card":null),onClick:m,children:[n.jsx("span",{className:M("absolute left-2 top-2 h-2 w-2 rounded-full",x.dotClass),"aria-hidden":!0}),n.jsxs(it,{children:[n.jsx(at,{asChild:!0,children:n.jsx("button",{type:"button",className:"absolute right-2 top-2 h-5 w-5 rounded-md border border-border bg-background/70 backdrop-blur flex items-center justify-center shadow-soft-sm",onClick:h=>h.stopPropagation(),title:k,children:n.jsx("span",{className:"h-2.5 w-2.5 rounded-full border border-border",style:{backgroundColor:C}})})}),n.jsxs(ct,{align:"end",children:[n.jsx(lt,{children:f("author")}),n.jsx(dt,{disabled:!0,children:k})]})]}),n.jsxs("div",{className:"flex items-start gap-3",children:[v?n.jsx("div",{className:M("mt-0.5 h-8 w-8 rounded-lg border border-border bg-background","flex items-center justify-center flex-shrink-0 shadow-soft-sm"),title:f("type_label"),children:n.jsx(x.Icon,{className:M("h-4 w-4",x.iconClass)})}):n.jsxs(it,{children:[n.jsx(at,{asChild:!0,children:n.jsx("button",{type:"button",className:M("mt-0.5 h-8 w-8 rounded-lg border border-border bg-background","flex items-center justify-center flex-shrink-0 shadow-soft-sm"),title:f("change_type"),onClick:h=>h.stopPropagation(),children:n.jsx(x.Icon,{className:M("h-4 w-4",x.iconClass)})})}),n.jsxs(ct,{align:"start",children:[n.jsx(lt,{children:f("type_label")}),n.jsxs(ro,{value:j,onValueChange:h=>s(Me(h)),children:[n.jsx(rt,{value:"note",children:f("type_note")}),n.jsx(rt,{value:"question",children:f("type_question")}),n.jsx(rt,{value:"task",children:f("type_task")})]})]})]}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-[11px] font-medium text-foreground/90",children:R}),E?n.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-border bg-muted/40 px-2 py-0.5 text-[9px] uppercase tracking-wide text-foreground/70",children:[n.jsx(Zt,{className:"h-3 w-3"}),"AI"]}):null,typeof e.position?.pageNumber=="number"?n.jsx("span",{className:"text-[9px] text-muted-foreground/70",children:f("page",{page:e.position.pageNumber})}):null,S?n.jsxs("span",{className:"text-[9px] text-muted-foreground/60",title:`ID ${D}`,children:["ID ",S]}):null]}),p?n.jsx(Xt,{value:A,onChange:h=>I(h.target.value),onClick:h=>h.stopPropagation(),className:"mt-2 min-h-[84px] text-[11px] leading-5",placeholder:f("add_comment_placeholder")}):n.jsx("div",{className:"mt-1 rounded-md border border-border/60 bg-background/70 px-2.5 py-2",children:e.comment?.text?.trim()?n.jsx(so,{content:gr(e.comment.text),rewriteDocsImages:!1,rewriteDocsLinks:!1,className:M("review-annotation-markdown text-[11px] leading-5 text-foreground/85 break-words","[&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1 [&_li]:my-0.5","[&_pre]:my-1 [&_pre]:max-w-full [&_pre]:overflow-x-auto","[&_pre]:whitespace-pre-wrap [&_code]:break-words","[&_.katex]:[word-break:normal] [&_.katex]:[overflow-wrap:normal]","[&_.katex]:whitespace-nowrap [&_.katex-display]:whitespace-normal","[&_.katex-display]:my-1 [&_.katex-display]:overflow-x-auto","[&_.katex-display]:overflow-y-hidden")}):n.jsx("p",{className:"review-annotation-text-fallback text-[11px] text-foreground/80 whitespace-pre-wrap break-words",children:f("no_comment_yet")})}),n.jsxs("div",{className:"mt-2 flex items-start justify-between gap-2",children:[n.jsx("p",{className:"review-annotation-text-fallback text-[9px] text-muted-foreground/60 whitespace-pre-wrap break-words",title:u||void 0,children:y}),v?n.jsx("div",{className:"text-[9px] text-muted-foreground",children:f("read_only")}):n.jsxs("div",{className:"flex items-center gap-1",children:[p?n.jsxs(n.Fragment,{children:[n.jsx(pe,{type:"button",variant:"secondary",size:"sm",className:"h-7 px-2 text-[10px]",onClick:h=>{h.stopPropagation(),_(!1),I(e.comment?.text||"")},children:"Cancel"}),n.jsx(pe,{type:"button",size:"sm",className:"h-7 px-2 text-[10px]",onClick:h=>{h.stopPropagation(),d(A.trim()),_(!1)},children:"Save"})]}):n.jsx(pe,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-[10px]",onClick:h=>{h.stopPropagation(),_(!0)},children:"Edit"}),n.jsx(pe,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-[10px] text-muted-foreground hover:text-foreground",onClick:h=>{h.stopPropagation(),b()},children:f("delete")})]})]})]})]})]})}function vr({highlights:e,selectedId:o,currentPage:r,flashId:i,onSelect:m,onDelete:b,onUpdateKind:s,onUpdateComment:d,showOverlayHints:v,readOnly:g}){const{t:f}=ne("pdf_viewer"),[x,j]=c.useState("all"),R=c.useRef(new Map),P=c.useRef(o),D=c.useRef(!1),S=c.useCallback((a,p)=>{const _=Number(a.position?.pageNumber||0),A=Number(p.position?.pageNumber||0),I=Number.isFinite(_)&&_>0?_:Number.MAX_SAFE_INTEGER,h=Number.isFinite(A)&&A>0?A:Number.MAX_SAFE_INTEGER;if(I!==h)return I-h;const H=Number(a.position?.boundingRect?.y1??a.position?.rects?.[0]?.y1??Number.MAX_SAFE_INTEGER),U=Number(p.position?.boundingRect?.y1??p.position?.rects?.[0]?.y1??Number.MAX_SAFE_INTEGER),F=Number.isFinite(H)?H:Number.MAX_SAFE_INTEGER,G=Number.isFinite(U)?U:Number.MAX_SAFE_INTEGER;if(F!==G)return F-G;const se=Number(a.position?.boundingRect?.x1??a.position?.rects?.[0]?.x1??Number.MAX_SAFE_INTEGER),X=Number(p.position?.boundingRect?.x1??p.position?.rects?.[0]?.x1??Number.MAX_SAFE_INTEGER),Z=Number.isFinite(se)?se:Number.MAX_SAFE_INTEGER,W=Number.isFinite(X)?X:Number.MAX_SAFE_INTEGER;return Z!==W?Z-W:a.id.localeCompare(p.id)},[]),C=c.useMemo(()=>{const a={all:e.length,issue:0,suggestion:0,verification:0,note:0,question:0,task:0};for(const p of e){const _=ut(p.tags);if(_){a[_]+=1;continue}const A=Me(p.comment?.emoji||ft(p.tags)||void 0);a[A]+=1}return a},[e]),k=c.useMemo(()=>{const a=[{key:"all",label:f("filter_all"),count:C.all}],p=[{key:"issue",label:f("review_type_issue"),count:C.issue},{key:"suggestion",label:f("review_type_suggestion"),count:C.suggestion},{key:"verification",label:f("review_type_verification"),count:C.verification}],_=[{key:"note",label:f("type_note"),count:C.note},{key:"question",label:f("type_question"),count:C.question},{key:"task",label:f("type_task"),count:C.task}],A=p.some(h=>h.count>0),I=_.some(h=>h.count>0);return A&&a.push(...p.filter(h=>h.count>0)),I&&a.push(..._.filter(h=>h.count>0)),a},[C,f]);c.useEffect(()=>{x!=="all"&&(k.some(a=>a.key===x)||j("all"))},[k,x]),c.useEffect(()=>{P.current&&!o&&(D.current=!0),P.current=o},[o]);const E=c.useMemo(()=>[...e.filter(p=>{if(x==="all")return!0;const _=ut(p.tags);return x==="issue"||x==="suggestion"||x==="verification"?_===x:_?!1:Me(p.comment?.emoji||ft(p.tags)||void 0)===x})].sort(S),[e,x,S]),u=c.useMemo(()=>{if(o||E.length===0)return null;const a=E.map(I=>({id:I.id,page:Number(I.position?.pageNumber||0)})).filter(I=>Number.isFinite(I.page)&&I.page>0);if(a.length===0)return null;const p=a.find(I=>I.page===r);if(p)return p.id;let _=a[0],A=Math.abs(a[0].page-r);for(let I=1;I<a.length;I+=1){const h=a[I],H=Math.abs(h.page-r);if(H<A){_=h,A=H;continue}H===A&&h.page<_.page&&(_=h)}return _.id},[r,E,o]);c.useEffect(()=>{if(!u)return;if(D.current){D.current=!1;return}const a=R.current.get(u);a&&a.scrollIntoView({block:"nearest",behavior:"smooth"})},[u]);const y=c.useCallback((a,p)=>{if(a){if(!p){R.current.delete(a);return}R.current.set(a,p)}},[]);return e.length===0?n.jsxs("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[n.jsx("div",{className:"text-4xl mb-2 opacity-30",children:"📝"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:f("no_annotations")}),n.jsx("p",{className:"text-[11px] text-muted-foreground/60 mt-1",children:f(g?"read_only_annotation_desc":"select_text_to_highlight")})]}):n.jsxs("div",{className:"flex flex-col h-full",children:[n.jsxs("div",{className:"p-3 border-b space-y-2",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("h3",{className:"font-medium text-xs",children:[f("annotations")," (",E.length,"/",e.length,")"]}),n.jsx("span",{className:M("inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-medium tracking-wide",v?"border-black/10 bg-white text-foreground/70":"border-border bg-background text-muted-foreground"),title:f("all_markers_shown"),children:f("markers_on")})]}),n.jsx("div",{className:"flex items-center gap-1",children:k.map(a=>{const p=x===a.key;return n.jsxs("button",{type:"button",onClick:()=>j(a.key),className:M("inline-flex min-w-0 flex-1 items-center justify-center rounded-md border px-2 py-1 text-[10px] transition-colors",p?"border-primary/40 bg-primary/10 text-foreground":"border-border/70 bg-background text-muted-foreground hover:text-foreground"),title:f("filter_annotations_title",{label:a.label}),children:[a.label," (",a.count,")"]},a.key)})})]}),E.length===0?n.jsx("div",{className:"flex flex-1 items-center justify-center px-4 text-center text-xs text-muted-foreground",children:"No annotations for current filter."}):n.jsx("div",{className:"flex-1 overflow-auto p-2 space-y-2",children:E.map(a=>n.jsx(yr,{highlight:a,selected:o===a.id,followed:!!(u&&u===a.id),flash:!!(i&&i===a.id),onSelect:()=>m(a.id),onDelete:()=>b(a.id),onUpdateKind:p=>s(a.id,p),onUpdateComment:p=>d(a.id,p),readOnly:g,registerItemRef:y},a.id))})]})}function wr({pdfDocument:e,scale:o,highlights:r,selectedId:i,onSelect:m,onAdd:b,onUpdate:s,onScrollRef:d,onPageChange:v,pdfHighlighterRef:g,authorColor:f,authorHandle:x,showOverlayHints:j,tipPlacementMode:R,readOnly:P,onAskCopilot:D}){const{t:S}=ne("pdf_viewer"),{setTotalPages:C}=en(),[k,E]=c.useState(null),u=o===1?"page-width":`page-width:${o}`,y=k||i||null;return c.useEffect(()=>{C(e.numPages)},[e.numPages,C]),n.jsx(xo,{ref:g,pdfDocument:e,pdfScaleValue:u,tipPlacementMode:R,onPageChange:v,enableAreaSelection:a=>P?!1:a.altKey,onScrollChange:()=>{},scrollRef:d,highlights:r,onSelectionFinished:(a,p,_,A)=>P?null:n.jsx(Fo,{onOpen:A,onCancel:_,onConfirm:I=>{b({content:p,position:a,comment:I}),_()},onAskCopilot:()=>{D?.(p,a),_()},authorColor:f,authorHandle:x,showAuthorHandle:!1}),highlightTransform:(a,p,_,A,I,h,H,U)=>{const F=!!a.__dsGhost,G=a.__dsGhostOpacity??1,se=a.__dsGhostMode,X=!a.content?.image,Z=nn({comment:a.comment,tags:a.tags}),W=String(on(Z,S)||S("annotation_label")),J=tn(a.tags),ge=L(a.previewSummary),be=J?`#${J} · ${W}`:`P${a.position.pageNumber} · ${W}`,ie=ge||rn(a.comment?.text||"",8),ke=J?ie?`${be}
|
|
16
|
-
${ie}`:be:ie?`${be}
|
|
17
|
-
${ie}`:be,Ne=`${W} · ${S("page",{page:a.position.pageNumber})} · ${S("open_details_hint")}`,de=dr(),he=y===a.id,je=!!(y&&!he),Se=X?n.jsx(Jo,{isScrolledTo:H||a.id===i,position:a.position,comment:a.comment,color:a.color,hidden:je,emphasized:he,onHoverStart:F?void 0:()=>E(a.id),onHoverEnd:F?void 0:()=>E(Y=>Y===a.id?null:Y),onClick:F?void 0:()=>m(a.id,{allowToggleClose:!1,skipAutoScroll:!0}),showOverlayHint:!F&&j&&!je,overlayHintText:ke,overlayHintTitle:Ne,overlayHintBorderColor:de.borderColor,overlayHintTextColor:de.textColor,overlayHintBackgroundColor:de.backgroundColor,overlayHintTopPx:U.overlayHintTopById?.[a.id],overlayHintLeftPx:U.overlayHintLeftPx,overlayHintWidthPx:U.overlayHintWidthPx,overlayHintPageHeightPx:U.height,onOverlayHintClick:F?void 0:()=>{m(a.id,{skipAutoScroll:!0})}}):n.jsx(or,{isScrolledTo:H||a.id===i,highlight:a,hidden:je,emphasized:he,onHoverStart:F?void 0:()=>E(a.id),onHoverEnd:F?void 0:()=>E(Y=>Y===a.id?null:Y),onSelect:F?void 0:()=>m(a.id,{allowToggleClose:!1,skipAutoScroll:!0}),onChange:Y=>{P||s(a.id,{boundingRect:I(Y)},{image:h(Y)})}});return F?n.jsx("div",{className:M("pointer-events-none",se==="annotate"?"ds-pdf-ghost-annotate":"ds-pdf-ghost-guide"),style:{opacity:G,transition:"opacity 0.8s ease"},children:Se},`ghost-${p}`):Se}})}function Dr({context:e,tabId:o,setDirty:r,setTitle:i}){const{t:m}=ne("pdf_viewer"),b=e.resourceId??(typeof e.customData?.fileId=="string"?e.customData.fileId:null),s=b?String(b):"",d=Qn(s),v=typeof e.customData?.reviewRouteId=="string"?e.customData.reviewRouteId.trim():"",g=typeof e.customData?.rebuttalRouteId=="string"?e.customData.rebuttalRouteId.trim():"",f=v.length>0,x=g.length>0,j=f||x,P=(f?v:g).startsWith("shared-"),D=P?.8:1,S=x?P?"ds:rebuttal:pdf:annotation-sidebar-width:shared:v1":"ds:rebuttal:pdf:annotation-sidebar-width:v1":P?"ds:review:pdf:annotation-sidebar-width:shared:v1":"ds:review:pdf:annotation-sidebar-width:v4",C=Math.round(336*D),k=Math.round(816*D),E=Math.round(673*D),u=!!(typeof e.customData?.readOnlyMode=="boolean"&&e.customData.readOnlyMode),y=c.useMemo(()=>{if(!u)return[];const t=e.customData?.readOnlyAnnotations;return Array.isArray(t)?t.map(l=>sr(l)).filter(l=>!!l):[]},[e.customData?.readOnlyAnnotations,u]),a=c.useRef(!1),p=e.resourceName||"Untitled.pdf",_=typeof e.customData?.externalPdfUrl=="string"?e.customData.externalPdfUrl.trim():"",A=_.length>0,I=(ce.defaults.baseURL||"").replace(/\/$/,""),h=qn(s),H=c.useMemo(()=>s&&h?Wn(s):null,[s,h]),U=c.useMemo(()=>(typeof e.customData?.projectId=="string"?e.customData.projectId.trim():"")||null,[e.customData]),[F,G]=c.useState(null),[se,X]=c.useState(!1),[Z,W]=c.useState(null),[J,ge]=c.useState(null),[be,ie]=c.useState(!1),[ke,Ne]=c.useState(null),de=A?_:d?F||"":h?J||"":s?`${I}/api/v1/files/${s}/content`:"https://mozilla.github.io/pdf.js/web/compressed.tracemonkey-pldi-09.pdf",he=typeof window<"u"?localStorage.getItem("ds_access_token"):null,je=he&&(A||!d&&!h&&s)?{Authorization:`Bearer ${he}`}:void 0,{scale:Se,setScale:Y,currentPage:De,setCurrentPage:ue,totalPages:sn,sidebarVisible:B,toggleSidebar:V,selectedAnnotationId:ae,selectAnnotation:oe}=en(),Pe=zn(t=>t.updateTabPlugin),pt=Kn(t=>t.findNode),gt=ot(t=>t.updateTabState),bt=ot(t=>t.addReference),Xe=ot(t=>t.updateReference),Fe=typeof e.customData?.onOpenMarkdownView=="function"?e.customData.onOpenMarkdownView:null,ht=typeof e.customData?.onOpenReviewOpinionView=="function"?e.customData.onOpenReviewOpinionView:null,an=!!(typeof e.customData?.reviewOpinionAvailable=="boolean"&&e.customData.reviewOpinionAvailable),cn=(typeof e.customData?.reviewViewMode=="string"?e.customData.reviewViewMode:"")==="ai_review",ln=typeof e.customData?.reviewOpinionLabel=="string"?e.customData.reviewOpinionLabel:void 0,dn=typeof e.customData?.reviewOpinionTitle=="string"?e.customData.reviewOpinionTitle:void 0,Re=Gt(),{addToast:xt}=Gn(),Ze=Ft(t=>t.items),un=Ft(t=>t.errors),Oe=c.useMemo(()=>e.customData?.arxiv??null,[e.customData]),Q=!!Oe||!!(s&&Ze.some(t=>t.fileId===s)),fn=d||!s||u?"":s,{annotations:Le,createAnnotation:yt,updateAnnotation:xe,deleteAnnotation:vt}=Ao(fn),He=Xn(t=>t.user),[fe,wt]=c.useState(null),[mn,pn]=c.useState("#F1E9D0"),[gn,_t]=c.useState(!1),kt=c.useRef({}),Je=c.useRef({}),Nt=!0,[jt,Ye]=c.useState([]),Ie=c.useRef(new Map),Ee=c.useRef(null),[bn,St]=c.useState(null),[ye,hn]=c.useState(()=>{if(typeof window>"u")return E;const t=window.localStorage.getItem(S),l=t?Number(t):NaN;return Number.isFinite(l)?Math.max(C,Math.min(k,l)):E}),Rt=c.useRef(ye),Ce=c.useRef(null),It=c.useRef(B),Et=c.useRef(V),et=c.useRef(()=>{}),ve=c.useRef(null),Ct=c.useRef(null),we=c.useRef(!1),tt=hr(p);c.useEffect(()=>{Rt.current=ye},[ye]),c.useEffect(()=>{!j||typeof window>"u"||window.localStorage.setItem(S,String(ye))},[S,j,ye]);const At=c.useCallback(t=>{const l=typeof window<"u"?Math.max(C,Math.min(k,Math.floor(window.innerWidth*.75))):k;return Math.max(C,Math.min(l,t))},[k,C]),xn=c.useCallback(t=>{if(!j||t.button!==0)return;t.preventDefault(),t.stopPropagation();const l=t.clientX,N=Rt.current;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const w=O=>{const q=l-O.clientX;hn(At(N+q))},T=()=>{document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",T)};document.addEventListener("mousemove",w),document.addEventListener("mouseup",T)},[At,j]),$=c.useMemo(()=>Oe||s&&Ze.find(t=>t.fileId===s)||null,[Oe,Ze,s]),yn=$?un[$.arxivId]:void 0,vn=!!(s&&!d&&(!Q||$?.overview?.trim()||$?.abstract?.trim())),wn=m(Q?"summary":"markdown"),_n=m(Q?"open_summary":"open_markdown");c.useEffect(()=>{It.current=B},[B]),c.useEffect(()=>{Et.current=V},[V]);const kn=c.useCallback(async()=>{if(!$)return;const t=Zn($),l=await Jn(t);xt({type:l?"success":"error",title:m(l?"toast_bibtex_copied_title":"toast_copy_failed_title"),description:l?$.title||$.arxivId:m("try_again"),duration:1800})},[xt,$,m]),Nn=c.useCallback(()=>{$?.arxivId&&window.open(`https://arxiv.org/abs/${$.arxivId}`,"_blank","noopener,noreferrer")},[$]),Tt=c.useCallback(()=>{const t=String(e.resourcePath||"").trim();if(t.startsWith("/FILES"))return t;if(s){const l=pt(s);if(l?.path)return Ot(l.path)}if(t)return Ot(t)},[e.resourcePath,s,pt]),$e=c.useCallback(async()=>{if(!s||d||Q)return null;const t=kt.current[s];if(t)return t;const l=Je.current[s];if(l)return l;const N=ce.get(`/api/v1/pdf/markdown/${s}`,{responseType:"text",transformResponse:[w=>w]}).then(w=>{const T=typeof w.data=="string"?w.data:String(w.data||"");return T?(kt.current[s]=T,T):null}).finally(()=>{delete Je.current[s]});return Je.current[s]=N,N},[s,Q,d]),Mt=c.useCallback(async(t,l)=>{if(!(!s||d||Q))try{const N=await $e(),w=xr(N||"",l);Xe(t,{markdownExcerpt:w||void 0,excerptStatus:w?"ready":"error"})}catch{Xe(t,{excerptStatus:"error"})}},[s,Q,d,$e,Xe]);c.useEffect(()=>{!s||d||Q||$e().catch(()=>{})},[s,Q,d,$e]);const jn=c.useCallback((t,l)=>{const N=String(t?.text||"").trim();if(!N)return;const w=typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`pdf-ref-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,T=l.boundingRect?[{left:l.boundingRect.x1,top:l.boundingRect.y1,width:l.boundingRect.width,height:l.boundingRect.height,pageNumber:l.boundingRect.pageNumber}]:[];bt({id:w,kind:"pdf_text",tabId:o,fileId:s||void 0,resourceId:s||void 0,resourcePath:Tt(),resourceName:p,pageNumber:l.pageNumber,selectedText:N,markdownExcerpt:void 0,excerptStatus:s&&!d&&!Q?"loading":"idle",rects:l.rects?.map(O=>({left:O.x1,top:O.y1,width:O.width,height:O.height,pageNumber:O.pageNumber}))||T,createdAt:new Date().toISOString()}),window.dispatchEvent(new CustomEvent("ds:copilot:focus",{detail:{focus:!0}})),s&&!d&&!Q&&Mt(w,N)},[bt,Mt,s,p,Q,d,Tt,o]);c.useEffect(()=>{tt&&Pe(o,Lt.NOTEBOOK,{...e,resourceId:s,resourceName:p,mimeType:e.mimeType??"text/markdown",customData:{...e.customData||{},docKind:"markdown"}})},[e,s,p,tt,o,Pe]),c.useEffect(()=>{i(p)},[p,i]),c.useEffect(()=>{r(!1)},[r]),c.useEffect(()=>{gt(o,{contentKind:"pdf",documentMode:"pdf",pageNumber:De,isReadOnly:u})},[De,u,o,gt]),c.useEffect(()=>{const t=U||H;if(t){wt(t);return}!s||d||Yn(s).then(l=>{l?.project_id&&wt(String(l.project_id))}).catch(()=>{})},[s,A,d,U,H]),c.useEffect(()=>{if(!s||!d){G(null),X(!1),W(null);return}let t=!1,l=null;return X(!0),W(null),(async()=>{try{const{createFileObjectUrl:w}=await Ht(async()=>{const{createFileObjectUrl:T}=await import("./index-CBNVuWcP.js").then(O=>O.em);return{createFileObjectUrl:T}},__vite__mapDeps([0,1,2,3,4]));if(l=await w(s),t){URL.revokeObjectURL(l);return}G(l)}catch{t||W("Failed to load PDF from CLI server.")}finally{t||X(!1)}})(),()=>{t=!0,l&&URL.revokeObjectURL(l)}},[s,d]),c.useEffect(()=>{if(!s||!h||d){ge(null),ie(!1),Ne(null);return}let t=!1,l=null;return ie(!0),Ne(null),(async()=>{try{if(l=await no(s),t){URL.revokeObjectURL(l);return}ge(l)}catch{t||Ne("Failed to load PDF document.")}finally{t||ie(!1)}})(),()=>{t=!0,l&&URL.revokeObjectURL(l)}},[s,d,h]),c.useEffect(()=>{if(!fe)return;const t=He?.id;t&&eo(fe).then(l=>{const N=l.find(w=>w.user_id===t);N?.annotation_color&&pn(String(N.annotation_color))}).catch(()=>{})},[fe,He?.id]),c.useEffect(()=>{if(!fe||!s||d||u)return;const{socket:t,release:l}=io();Ct.current={socket:t,release:l};const N=async()=>{if(!we.current&&t.connected)try{we.current=!0,await t.emitWithAck("file:join",{projectId:fe,fileId:s,clientVersion:"1.0.0"})}catch{we.current=!1}},w=()=>void N(),T=()=>{we.current=!1},O=q=>{if(q?.fileId&&String(q.fileId)!==String(s))return;Re.invalidateQueries({queryKey:le.list(s)});const qe=typeof q?.annotationId=="string"&&q.annotationId.trim()?q.annotationId.trim():null;qe&&(Ee.current=qe,It.current||Et.current?.())};return t.on("connect",w),t.on("disconnect",T),t.on("annotation:created",O),t.on("annotation:updated",O),t.on("annotation:deleted",O),t.connected&&N(),()=>{try{t.off("connect",w),t.off("disconnect",T),t.off("annotation:created",O),t.off("annotation:updated",O),t.off("annotation:deleted",O),we.current&&t.emit("file:leave",{projectId:fe,fileId:s})}finally{we.current=!1,Ct.current=null,l()}}},[fe,s,d,u]);const re=c.useMemo(()=>u?y:Le.map(t=>({id:t.id,position:t.position,content:t.content,comment:{text:t.comment||"",emoji:t.kind},color:t.color,author:t.author??null,tags:t.tags,previewSummary:typeof t.content?.summary=="string"&&String(t.content.summary||"").trim()||null})),[Le,u,y]),Sn=c.useMemo(()=>[...re,...jt],[re,jt]);c.useEffect(()=>{const t=Ee.current;if(!t)return;const l=re.find(N=>N.id===t);l&&(oe(l.id),ue(l.position.pageNumber),et.current(l),Ee.current=null,St(l.id),Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(()=>St(null),2200))},[re,oe,ue]),c.useEffect(()=>{const t=ve.current;return()=>{t?.setPinnedTipForHighlight(null),Ce.current&&clearTimeout(Ce.current)}},[]),c.useEffect(()=>{if(!u){a.current=!1;return}a.current||re.length!==0&&(a.current=!0,B||V())},[re.length,u,B,V]);const Ae=c.useCallback(t=>{ue(t),ve.current?.scrollToPage(t)},[ue]),Dt=c.useCallback(t=>{const l=`ai-ghost-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,N=t.rects.map(ee=>({...ee,width:ee.width??100,height:ee.height??100,pageNumber:ee.pageNumber??t.page})),w={...t.boundingRect,width:t.boundingRect.width??100,height:t.boundingRect.height??100,pageNumber:t.boundingRect.pageNumber??t.page},T={id:l,position:{boundingRect:w,rects:N,pageNumber:t.page},content:{text:t.text||""},comment:{text:"",emoji:"note"},color:t.color||"#3F5A6B",__dsGhost:!0,__dsGhostOpacity:1,__dsGhostMode:t.mode||"guide"};Ye(ee=>[...ee,T]);const O=t.durationMs??3e3,q=setTimeout(()=>{Ye(ee=>ee.map(Te=>Te.id===l?{...Te,__dsGhostOpacity:0}:Te))},O),qe=setTimeout(()=>{Ye(ee=>ee.filter(Te=>Te.id!==l)),Ie.current.delete(l),Ie.current.delete(`${l}:fade`)},O+800);Ie.current.set(l,qe),Ie.current.set(`${l}:fade`,q)},[]);c.useEffect(()=>{const t=Ie.current;return()=>{t.forEach(l=>clearTimeout(l)),t.clear()}},[]);const Be=c.useCallback(t=>{const l=typeof t?.__dsEffectId=="string"?t.__dsEffectId:null;return l?co(l)?!0:(lo(l),!1):!1},[]),Ue=c.useCallback(t=>{!t||t.fileId!==s||Be(t)||(Re.invalidateQueries({queryKey:le.list(s)}),t.page&&Ae(t.page),t.rects&&t.boundingRect&&Dt({page:t.page||1,rects:t.rects,boundingRect:t.boundingRect,color:t.color,mode:t.mode||"guide",durationMs:t.durationMs,text:t.text}),t.annotationId&&(Ee.current=t.annotationId),(t.annotationId||t.__dsEffectId)&&!B&&V())},[Dt,s,Re,Ae,B,V,Be]),Ve=c.useCallback(t=>{!t||t.fileId!==s||Be(t)||(Re.invalidateQueries({queryKey:le.list(s)}),t.page&&Ae(t.page),t.annotationId&&(Ee.current=t.annotationId,B||V()))},[s,Re,Ae,B,V,Be]),Qe=c.useCallback(()=>{if(!s)return;const t=uo(s);t.length!==0&&t.forEach(l=>{l.name==="pdf:jump"?Ue(l.data):Ve(l.data)})},[Ve,Ue,s]);c.useEffect(()=>{s&&Qe()},[s,Qe]),c.useEffect(()=>{if(typeof window>"u"||!s)return;const t=w=>{const T=w.detail;Ue(T)},l=w=>{const T=w.detail;Ve(T)},N=w=>{const T=w.detail;!T||T.fileId!==s||Qe()};return window.addEventListener("pdf:navigate",t),window.addEventListener("pdf:annotation_created",l),window.addEventListener("ds:pdf:queue",N),()=>{window.removeEventListener("pdf:navigate",t),window.removeEventListener("pdf:annotation_created",l),window.removeEventListener("ds:pdf:queue",N)}},[Ve,Ue,s,Qe]);const Rn=c.useCallback(async t=>{if(!(u||d||!s))try{const l=Me(t.comment?.emoji);(await yt({fileId:s,position:t.position,content:t.content,comment:t.comment?.text||"",kind:l,tags:[]}))?.id&&!B&&V()}catch(l){console.warn("[PdfViewerPlugin] Failed to create annotation:",l)}},[yt,s,d,u,B,V]),In=c.useCallback(async(t,l,N)=>{if(!(u||d||!s))try{const w=Le.find(q=>q.id===t);if(!w)return;const T={...w.position,...l,boundingRect:{...w.position.boundingRect,...l.boundingRect}},O={...w.content,...N};await xe(t,{position:T,content:O})}catch(w){console.warn("[PdfViewerPlugin] Failed to update annotation position/content:",w)}},[Le,s,d,u,xe]),Pt=c.useCallback((t,l)=>{const N=re.find(q=>q.id===t);if(!N)return;const w=l?.allowToggleClose!==!1,T=l?.skipAutoScroll===!0;if(w&&ae===t){oe(null),ve.current?.setPinnedTipForHighlight(null);return}B||V(),oe(t),ve.current?.setPinnedTipForHighlight(null),T||(ue(N.position.pageNumber),et.current(N))},[re,ae,B,oe,ue,V]),En=c.useCallback(t=>{const l=t.target;l&&(l.closest("[data-ds-highlight-target='true']")||l.closest("[data-ds-overlay-hint='true']")||ae&&(oe(null),ve.current?.setPinnedTipForHighlight(null)))},[ae,oe]),Cn=c.useCallback(async t=>{if(!(u||d||!s))try{await vt(t),ae===t&&oe(null)}catch(l){console.warn("[PdfViewerPlugin] Failed to delete annotation:",l)}},[vt,s,d,u,ae,oe]),An=c.useCallback(async(t,l)=>{if(!(u||d||!s))try{await xe(t,{kind:l})}catch(N){console.warn("[PdfViewerPlugin] Failed to update annotation kind:",N)}},[s,d,u,xe]),Tn=c.useCallback(async(t,l)=>{if(!(u||d||!s))try{await xe(t,{comment:l})}catch(N){console.warn("[PdfViewerPlugin] Failed to update annotation comment:",N)}},[s,d,u,xe]),Mn=c.useCallback(()=>{if(!s){window.open(de,"_blank");return}(async()=>{const{downloadFileById:t}=await Ht(async()=>{const{downloadFileById:l}=await import("./index-CBNVuWcP.js").then(N=>N.em);return{downloadFileById:l}},__vite__mapDeps([0,1,2,3,4]));await t(s,p)})()},[s,p,de]),Dn=c.useCallback(()=>{if(Fe){Fe();return}!s||d||Pe(o,Lt.PDF_MARKDOWN,{...e,customData:{...e.customData||{},pdfView:Q?"summary":"markdown"}})},[e,s,Q,d,Fe,o,Pe]);return tt?n.jsx("div",{className:"flex h-full items-center justify-center bg-muted/20",children:n.jsx("div",{className:"text-sm text-muted-foreground",children:"Switching to Markdown editor..."})}):d&&(se||Z)&&!F?n.jsx("div",{className:"h-full flex items-center justify-center bg-background",children:Z?n.jsx("div",{className:"text-sm text-muted-foreground",children:Z}):n.jsx(st,{})}):h&&(be||ke)&&!J?n.jsx("div",{className:"h-full flex items-center justify-center bg-background",children:ke?n.jsx("div",{className:"text-sm text-muted-foreground",children:ke}):n.jsx(st,{})}):n.jsxs("div",{className:"h-full flex flex-col bg-background",children:[n.jsx(Io,{scale:Se,onScaleChange:Y,currentPage:De,totalPages:sn,onPageChange:Ae,sidebarVisible:B,onSidebarToggle:V,onDownload:Mn,onInfo:$?()=>_t(!0):void 0,onMarkdownToggle:Fe||vn?Dn:void 0,markdownLabel:wn,markdownTitle:_n,reviewOpinionActive:cn,onReviewOpinionToggle:an&&ht?ht:void 0,reviewOpinionLabel:ln,reviewOpinionTitle:dn}),n.jsxs("div",{className:"flex-1 flex overflow-hidden bg-muted/10",children:[n.jsx("div",{className:"flex-1 overflow-hidden flex",children:n.jsx("div",{className:"relative h-full w-full",children:n.jsx("div",{className:"relative h-full overflow-hidden border border-border bg-background shadow-soft-card",onPointerDown:En,children:n.jsx(po,{url:de,httpHeaders:je,workerSrc:ho,cMapUrl:bo,cMapPacked:go,beforeLoad:n.jsx(st,{}),children:t=>n.jsx(wr,{pdfDocument:t,scale:Se,highlights:Sn,selectedId:ae,onSelect:Pt,onAdd:Rn,onUpdate:In,onScrollRef:l=>{et.current=l},onPageChange:l=>ue(l),pdfHighlighterRef:ve,authorColor:mn,authorHandle:(He?.email?He.email.split("@",1)[0]:"")||"user",showOverlayHints:Nt,tipPlacementMode:j?"right":"auto",readOnly:u,onAskCopilot:jn})})})})}),B&&n.jsxs("div",{className:M("relative border-l bg-background/60 backdrop-blur flex-shrink-0",j?"":"w-72"),style:j?{width:ye}:void 0,children:[j?n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":m("resize_annotation_sidebar"),tabIndex:0,className:"group absolute inset-y-0 left-0 z-20 w-3 -translate-x-1/2 cursor-ew-resize touch-none",onPointerDown:xn,children:n.jsx("span",{className:"pointer-events-none absolute top-1/2 left-1/2 h-16 w-[2px] -translate-x-1/2 -translate-y-1/2 rounded-full bg-black/20 opacity-0 transition-opacity group-hover:opacity-100"})}):null,n.jsx(vr,{highlights:re,selectedId:ae,currentPage:De,flashId:bn,onSelect:Pt,onDelete:Cn,onUpdateKind:An,onUpdateComment:Tn,showOverlayHints:Nt,readOnly:u})]})]}),n.jsx(to,{open:gn,onClose:()=>_t(!1),paper:$,errorCode:yn,onCopyBibtex:$?kn:void 0,onOpenArxiv:$?Nn:void 0})]})}function Pr(){console.debug("[PdfViewerPlugin] Activated")}function Fr(){console.debug("[PdfViewerPlugin] Deactivated")}export{Dr as default,Pr as onPdfViewerActivate,Fr as onPdfViewerDeactivate};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{y as le,u as Ue,f as M,m as ce,ao as Ke,ad as Ge,ap as We,aq as Xe,ar as Je,as as Ye,s as we,at as Ce,au as Le,av as Qe,aw as Ze,j as s,k as Ee,X as es,b as ss,ax as ts}from"./index-CBNVuWcP.js";import{r as n}from"./plugin-monaco-C8UgLomw.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.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 as=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],ns=le("corner-down-left",as);/**
|
|
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 rs=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],Te=le("map",rs);/**
|
|
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 cs=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],ls=le("user",cs),$e="ds:lab:focus";function is(h){const I=h.customData?.projectId;return typeof I=="string"?I:null}function ds(h){return!!h.customData?.readOnly}function fs({context:h,setTitle:I}){const{t:a}=Ue("search");n.useEffect(()=>I(a("title")),[I,a]);const c=is(h),ie=ds(h),Me=typeof h.customData?.query=="string"?h.customData.query:"",Ae=M(e=>e.nodes),k=M(e=>e.findNode),de=M(e=>e.projectId),Re=M(e=>e.isLoading),A=M(e=>e.loadFiles),ue=ce(e=>e.openTab),oe=ce(e=>e.setActiveTab),he=ce(e=>e.tabs),me=Ke(e=>e.activeQuestId),{openFileInTab:fe}=Ge(),pe=n.useRef(null),[p,ve]=n.useState(Me),[be,R]=n.useState([]),[xe,F]=n.useState(!1),[O,U]=n.useState(null),[Fe,D]=n.useState(!1),[j,De]=n.useState("all"),w=n.useRef(0),[je,K]=n.useState([]),[B,G]=n.useState([]),[W,ye]=n.useState(!1),[C,X]=n.useState(null),[J,N]=n.useState([]),[Be,q]=n.useState(null),[Pe,g]=n.useState(!1),[Y,_e]=n.useState(!1),[Ne,S]=n.useState(null),Z=n.useRef(0),ee=n.useRef(new Set);n.useEffect(()=>{pe.current?.focus()},[]),n.useEffect(()=>{c&&de!==c&&A(c)},[c,de,A]),n.useEffect(()=>{if(!c){K([]),G([]),X(null);return}let e=!0;return ye(!0),X(null),Promise.all([We(c),Xe(c)]).then(([t,r])=>{e&&(K(t.items??[]),G(r.items??[]))}).catch(()=>{e&&(X("Lab search is unavailable right now."),K([]),G([]))}).finally(()=>{e&&ye(!1)}),()=>{e=!1}},[c]);const qe=n.useCallback(e=>{const r=e.trim().replace(/^\/+/,"");return r?/[*?\[]/.test(r)?r:`*${r}*`:""},[]),o=n.useMemo(()=>{const e=p.trim();if(!e)return{questId:null,queryText:"",types:void 0};const t=/(\w+):(".*?"|\S+)/g;let r=null;const i=new Set,l=[];let d=e.replace(t,(H,He,Oe)=>{const re=String(He).toLowerCase(),_=String(Oe||"").replace(/^"|"$/g,"");return re==="quest"?(r=_||r,""):re==="event"?(i.add("event"),_&&l.push(_),""):re==="branch"?(i.add("branch"),_&&l.push(_),""):(_&&l.push(_),"")});d=d.replace(t,"").trim(),d&&l.push(d);const b=l.join(" ").trim(),f=typeof h.customData?.questId=="string"?h.customData.questId:null;return{questId:r||f||me||null,queryText:b,types:i.size?Array.from(i).join(","):void 0}},[me,h.customData?.questId,p]);n.useEffect(()=>{const e=p.trim();if(!c||e.length===0){R([]),D(!1),U(null),F(!1);return}const t=w.current+1;w.current=t,F(!0),U(null);const r=setTimeout(()=>{const i=qe(e);if(!i){R([]),D(!1),F(!1);return}(async()=>{try{const l=await Je(c,{pattern:i,include_folders:!1,limit:50,sort_by:"updated_at",sort_order:"desc"});if(w.current!==t)return;R(l.items??[]),D(!!l.truncated)}catch{if(w.current!==t)return;U("Search failed. Please try again."),R([]),D(!1)}finally{w.current===t&&F(!1)}})()},200);return()=>{clearTimeout(r)}},[qe,c,p]);const se=n.useCallback(async(e,t)=>{if(c&&o.questId&&o.queryText.trim()){_e(!0),S(null);try{const r=await Ye(c,o.questId,{query:o.queryText,types:o.types,limit:20,cursor:e??void 0}),i=r.items??[],l=r.next_cursor??null,d=!!(r.has_more||l);t||(ee.current=new Set),N(b=>{const f=t?[...b]:[];return i.forEach(x=>{const H=x.item_type==="event"?`event:${x.event?.event_id??""}`:`branch:${x.branch?.node_id??""}`;!H||ee.current.has(H)||(ee.current.add(H),f.push(x))}),f}),q(l),g(d)}catch{S("Quest search is unavailable right now."),N([]),q(null),g(!1)}finally{_e(!1)}}},[c,o]);n.useEffect(()=>{if(!c||j==="files"){N([]),q(null),g(!1),S(null);return}if(!p.trim()){N([]),q(null),g(!1),S(null);return}if(!o.questId){N([]),q(null),g(!1),S("Add quest:<id> to search quest graph.");return}if(!o.queryText.trim()){N([]),q(null),g(!1),S("Add search terms after quest:<id>.");return}const t=Z.current+1;Z.current=t;const r=setTimeout(()=>{Z.current===t&&se(null,!1).catch(()=>{})},200);return()=>clearTimeout(r)},[se,c,p,o,j]);const te=n.useCallback(async e=>{if(!c)return;let t=k(e.id);if(t||(await A(c),t=k(e.id)),!t||t.type!=="file"&&t.type!=="notebook")return;await fe(t,{customData:{projectId:c}})},[k,A,fe,c]),v=n.useCallback((e,t,r,i)=>{if(!c)return;const l={projectId:c,focusType:e,focusId:t,branch:r??null,eventId:i??null},d=window;d.__dsLabPendingFocus=l;const b=he.find(f=>f.pluginId!==we.LAB||f.context.type!=="custom"?!1:f.context.customData?.projectId===c);if(b){oe(b.id),window.dispatchEvent(new CustomEvent($e,{detail:l}));return}ue({pluginId:we.LAB,context:{type:"custom",customData:{projectId:c,readOnly:ie}},title:"Home"}),window.requestAnimationFrame(()=>{window.dispatchEvent(new CustomEvent($e,{detail:l}))})},[ue,c,ie,oe,he]),ae=!!c,ge=p.trim(),y=ge.toLowerCase(),L=n.useMemo(()=>be.map(e=>{const t=k(e.id);return{item:e,node:t??void 0,name:t?.name??e.name,type:t?.type??e.type,mimeType:t?.mimeType??e.mime_type,path:t?.path??e.path??"—"}}),[be,k,Ae]),Se=n.useMemo(()=>new Map(B.map(e=>[e.quest_id,e])),[B]),m=n.useCallback(e=>!y||!e?!1:e.toLowerCase().includes(y),[y]),Q=n.useMemo(()=>y?je.filter(e=>{const t=Ce(e),r=Le(e);return m(t)||m(r)||m(e.agent_id)||m(e.template_id)}).map(e=>{const t=Ce(e),r=Le(e),i=e.active_quest_id?Se.get(e.active_quest_id):null,l=e.status?.trim()?e.status:i?`Quest: ${Qe(i)}`:"Idle";return{kind:"agent",id:e.instance_id,title:t,subtitle:`${r} · ${l}`,accent:e.avatar_frame_color??void 0,agent:e}}).slice(0,20):[],[je,m,y,Se]),E=n.useMemo(()=>y?B.filter(e=>{const t=e.tags??[];return m(e.title)||m(e.description)||m(e.quest_id)||t.some(r=>m(r))}).map(e=>{const t=Qe(e),r=e.description?.trim()||"Quest pipeline";return{kind:"quest",id:e.quest_id,title:t,subtitle:r,meta:e.tags?.join(", "),accent:"#4d7c84",quest:e}}).slice(0,20):[],[B,m,y]),T=n.useMemo(()=>!J.length||!o.questId?[]:J.map(e=>{if(e.item_type==="event"){const d=e.event??null,b=d?.event_type||"Event",f=d?.reply_to_pi||d?.payload_summary||"Quest event",x=`${d?.branch_name||"main"} · ${Ze(d?.created_at)}`;return{id:d?.event_id||`${b}-${x}`,kind:"quest-event",questId:o.questId,title:b,subtitle:f,meta:x,event:d,branch:null}}const t=e.branch??null,r=t?.branch_name||"Branch",i=t?.idea_id?`Idea ${t.idea_id}`:t?.status||"Quest branch",l=t?.verdict?`Verdict: ${t.verdict}`:null;return{id:t?.node_id||`${r}-${i}`,kind:"quest-branch",questId:o.questId,title:r,subtitle:i,meta:l||void 0,event:null,branch:t}}),[o.questId,J]),Ie=j!=="lab",ke=j!=="files",P=Q.length,V=E.length,z=T.length,ne=P+V+z,$=L.length,Ve=ke&&ne>0||Ie&&$>0,u=n.useMemo(()=>j==="lab"?T[0]??Q[0]??E[0]??null:j==="files"?L[0]??null:T[0]??Q[0]??E[0]??L[0]??null,[Q,L,E,T,j]),ze=n.useCallback(()=>{if(u){if("item"in u){te(u.item);return}if("kind"in u)switch(u.kind){case"quest-event":v("quest-event",u.questId,u.event?.branch_name,u.event?.event_id);return;case"quest-branch":v("quest-branch",u.questId,u.branch?.branch_name,null);return;case"agent":u.agent&&v("agent",u.agent.instance_id);return;case"quest":u.quest&&v("quest",u.quest.quest_id);return;default:return}}},[v,te,u]);return s.jsx("div",{className:"ds-search-surface",children:s.jsxs("div",{className:"ds-search-shell",children:[s.jsxs("div",{className:"ds-search-header",children:[s.jsxs("div",{children:[s.jsx("div",{className:"ds-search-kicker",children:a("kicker")}),s.jsx("h1",{className:"ds-search-title",children:a("title")}),s.jsx("p",{className:"ds-search-subtitle",children:a("subtitle")})]}),s.jsxs("div",{className:"ds-search-shortcut",children:[s.jsx("span",{children:a("shortcut")}),s.jsx("kbd",{children:"⌘K"})]})]}),s.jsxs("div",{className:ss("ds-search-field",!ae&&"opacity-60"),children:[s.jsx(Ee,{className:"h-4 w-4 text-[#6f5c46]"}),s.jsx("input",{ref:pe,value:p,onChange:e=>ve(e.target.value),onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),ze())},placeholder:a(ae?Re?"placeholder_indexing":"placeholder_default":"placeholder_disabled"),className:"ds-search-input",disabled:!ae}),p?s.jsx("button",{type:"button",onClick:()=>ve(""),className:"ds-search-clear","aria-label":a("clear_search"),children:s.jsx(es,{className:"h-4 w-4"})}):null]}),s.jsx("div",{className:"ds-search-scope",children:[{id:"all",label:a("scope_all"),count:$+ne},{id:"files",label:a("scope_files"),count:$},{id:"lab",label:a("scope_lab"),count:ne}].map(e=>s.jsxs("button",{type:"button",className:"ds-search-chip","data-active":j===e.id,onClick:()=>De(e.id),children:[e.label,s.jsx("span",{children:e.count})]},e.id))}),s.jsx("div",{className:"ds-search-panel",children:ge.length===0?s.jsxs("div",{className:"ds-search-empty",children:[s.jsx("h3",{children:a("try_title")}),s.jsxs("ul",{className:"space-y-1 list-disc pl-5",children:[s.jsx("li",{children:a("try_goals")}),s.jsx("li",{children:a("try_agents")}),s.jsx("li",{children:a("try_paths")})]}),s.jsxs("div",{className:"ds-search-hint",children:[s.jsx(ns,{className:"h-3.5 w-3.5"}),a("press_enter_hint")]})]}):s.jsxs("div",{children:[ke?s.jsxs("div",{children:[s.jsx("div",{className:"ds-search-section",style:{"--ds-delay":"0s"},children:s.jsxs("div",{className:"ds-search-section-title",children:[s.jsx("span",{children:a("section_agents")}),s.jsx("span",{className:"ds-search-section-meta",children:a("results_count",{count:P})})]})}),W&&P===0?s.jsx("div",{className:"ds-search-status",children:a("loading_lab_agents")}):C?s.jsx("div",{className:"ds-search-status",children:C}):P===0?s.jsx("div",{className:"ds-search-status",children:a("no_agents")}):s.jsx("div",{className:"ds-search-result-list",children:Q.map((e,t)=>s.jsxs("button",{type:"button",className:"ds-search-result",style:{"--ds-search-accent":e.accent??"#c2a15c","--ds-delay":`${t*.04}s`},onClick:()=>{e.agent&&v("agent",e.agent.instance_id)},children:[s.jsx("span",{className:"ds-search-result-mark",children:s.jsx(ls,{className:"h-4 w-4"})}),s.jsxs("div",{className:"ds-search-result-body",children:[s.jsx("div",{className:"ds-search-result-title",children:e.title}),s.jsx("div",{className:"ds-search-result-subtitle",children:e.subtitle})]}),s.jsx("span",{className:"ds-search-badge",children:a("badge_agent")})]},e.id))}),s.jsx("div",{className:"ds-search-section",style:{"--ds-delay":"0.04s"},children:s.jsxs("div",{className:"ds-search-section-title",children:[s.jsx("span",{children:a("section_quest_graph")}),s.jsx("span",{className:"ds-search-section-meta",children:a("results_count",{count:z})})]})}),Y&&z===0?s.jsx("div",{className:"ds-search-status",children:a("searching_quest_graph")}):Ne?s.jsx("div",{className:"ds-search-status",children:Ne}):z===0?s.jsx("div",{className:"ds-search-status",children:a("no_quest_graph")}):s.jsxs("div",{className:"ds-search-result-list",children:[T.map((e,t)=>s.jsxs("button",{type:"button",className:"ds-search-result",style:{"--ds-search-accent":"#a67c52","--ds-delay":`${t*.04}s`},onClick:()=>{if(e.kind==="quest-event"){v("quest-event",e.questId,e.event?.branch_name,e.event?.event_id);return}v("quest-branch",e.questId,e.branch?.branch_name,null)},children:[s.jsx("span",{className:"ds-search-result-mark",children:e.kind==="quest-event"?s.jsx(Ee,{className:"h-4 w-4"}):s.jsx(Te,{className:"h-4 w-4"})}),s.jsxs("div",{className:"ds-search-result-body",children:[s.jsx("div",{className:"ds-search-result-title",children:e.title}),s.jsx("div",{className:"ds-search-result-subtitle",children:e.subtitle}),e.meta?s.jsx("div",{className:"ds-search-result-meta",children:e.meta}):null]}),s.jsx("span",{className:"ds-search-badge",children:e.kind==="quest-event"?a("badge_event"):a("badge_branch")})]},e.id)),Pe?s.jsx("button",{type:"button",className:"ds-search-load",onClick:()=>se(Be,!0),disabled:Y,children:a(Y?"loading_more":"load_more")}):null]}),s.jsx("div",{className:"ds-search-section",style:{"--ds-delay":"0.04s"},children:s.jsxs("div",{className:"ds-search-section-title",children:[s.jsx("span",{children:a("section_quests")}),s.jsx("span",{className:"ds-search-section-meta",children:a("results_count",{count:V})})]})}),W&&V===0?s.jsx("div",{className:"ds-search-status",children:a("loading_quests")}):C?s.jsx("div",{className:"ds-search-status",children:C}):V===0?s.jsx("div",{className:"ds-search-status",children:a("no_quests")}):s.jsx("div",{className:"ds-search-result-list",children:E.map((e,t)=>s.jsxs("button",{type:"button",className:"ds-search-result",style:{"--ds-search-accent":e.accent??"#4d7c84","--ds-delay":`${t*.04}s`},onClick:()=>{e.quest&&v("quest",e.quest.quest_id)},children:[s.jsx("span",{className:"ds-search-result-mark",children:s.jsx(Te,{className:"h-4 w-4"})}),s.jsxs("div",{className:"ds-search-result-body",children:[s.jsx("div",{className:"ds-search-result-title",children:e.title}),s.jsx("div",{className:"ds-search-result-subtitle",children:e.subtitle}),e.meta?s.jsx("div",{className:"ds-search-result-meta",children:e.meta}):null]}),s.jsx("span",{className:"ds-search-badge",children:a("badge_quest")})]},e.id))})]}):null,Ie?s.jsxs("div",{children:[s.jsx("div",{className:"ds-search-section",style:{"--ds-delay":"0.08s"},children:s.jsxs("div",{className:"ds-search-section-title",children:[s.jsx("span",{children:a("section_files")}),s.jsx("span",{className:"ds-search-section-meta",children:a("results_count",{count:$})})]})}),O?s.jsx("div",{className:"ds-search-status",children:O}):xe?s.jsx("div",{className:"ds-search-status",children:a("searching_files")}):$===0?s.jsx("div",{className:"ds-search-status",children:a("no_files")}):s.jsxs("div",{className:"ds-search-result-list",children:[L.map((e,t)=>s.jsxs("button",{type:"button",className:"ds-search-result",style:{"--ds-delay":`${t*.03}s`},onClick:()=>void te(e.item),children:[s.jsx("span",{className:"ds-search-result-mark",children:s.jsx(ts,{type:e.type,mimeType:e.mimeType,name:e.name,className:"h-4 w-4"})}),s.jsxs("div",{className:"ds-search-result-body",children:[s.jsx("div",{className:"ds-search-result-title",children:e.name}),s.jsx("div",{className:"ds-search-result-subtitle",children:e.path})]}),s.jsx("span",{className:"ds-search-badge",children:a("badge_file")})]},e.item.id)),Fe?s.jsx("div",{className:"ds-search-status",children:a("truncated")}):null]})]}):null,!Ve&&!xe&&!W&&!O&&!C?s.jsx("div",{className:"ds-search-status",children:a("no_results")}):null]})})]})})}export{fs as default};
|