@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.
Files changed (894) hide show
  1. package/AGENTS.md +309 -130
  2. package/AISB/catalog/aisb.b1.agentic_coding.yaml +244 -0
  3. package/AISB/catalog/aisb.b10.climate_earth.yaml +235 -0
  4. package/AISB/catalog/aisb.b11.model_efficiency.yaml +231 -0
  5. package/AISB/catalog/aisb.b12.embodied_ai.yaml +238 -0
  6. package/AISB/catalog/aisb.b2.agent_systems.yaml +229 -0
  7. package/AISB/catalog/aisb.b3.self_evolving_rl.yaml +237 -0
  8. package/AISB/catalog/aisb.b4.lm_reasoning.yaml +240 -0
  9. package/AISB/catalog/aisb.b5.math_proof.yaml +235 -0
  10. package/AISB/catalog/aisb.b6.research_process.yaml +243 -0
  11. package/AISB/catalog/aisb.b7.multimodal_fusion.yaml +232 -0
  12. package/AISB/catalog/aisb.b8.lifesci_drug.yaml +275 -0
  13. package/AISB/catalog/aisb.b9.material_science.yaml +237 -0
  14. package/AISB/catalog/aisb.t3.001_savvy.yaml +159 -0
  15. package/AISB/catalog/aisb.t3.001_savvy.zh.yaml +121 -0
  16. package/AISB/catalog/aisb.t3.002_pinet.yaml +189 -0
  17. package/AISB/catalog/aisb.t3.002_pinet.zh.yaml +130 -0
  18. package/AISB/catalog/aisb.t3.004_decentralattn.yaml +184 -0
  19. package/AISB/catalog/aisb.t3.004_decentralattn.zh.yaml +153 -0
  20. package/AISB/catalog/aisb.t3.005_tsae.yaml +193 -0
  21. package/AISB/catalog/aisb.t3.005_tsae.zh.yaml +139 -0
  22. package/AISB/catalog/aisb.t3.006_physense.yaml +194 -0
  23. package/AISB/catalog/aisb.t3.006_physense.zh.yaml +118 -0
  24. package/AISB/catalog/aisb.t3.007_reasoningiqa.yaml +169 -0
  25. package/AISB/catalog/aisb.t3.007_reasoningiqa.zh.yaml +133 -0
  26. package/AISB/catalog/aisb.t3.008_meanflows.yaml +188 -0
  27. package/AISB/catalog/aisb.t3.008_meanflows.zh.yaml +140 -0
  28. package/AISB/catalog/aisb.t3.009_scoremissing.yaml +179 -0
  29. package/AISB/catalog/aisb.t3.009_scoremissing.zh.yaml +119 -0
  30. package/AISB/catalog/aisb.t3.010_suitabilityfilter.yaml +221 -0
  31. package/AISB/catalog/aisb.t3.010_suitabilityfilter.zh.yaml +141 -0
  32. package/AISB/catalog/aisb.t3.011_osd.yaml +206 -0
  33. package/AISB/catalog/aisb.t3.011_osd.zh.yaml +163 -0
  34. package/AISB/catalog/aisb.t3.012_efficientqat.yaml +206 -0
  35. package/AISB/catalog/aisb.t3.012_efficientqat.zh.yaml +159 -0
  36. package/AISB/catalog/aisb.t3.013_appl.yaml +152 -0
  37. package/AISB/catalog/aisb.t3.013_appl.zh.yaml +126 -0
  38. package/AISB/catalog/aisb.t3.014_piguard.yaml +207 -0
  39. package/AISB/catalog/aisb.t3.014_piguard.zh.yaml +164 -0
  40. package/AISB/catalog/aisb.t3.015_frspec.yaml +209 -0
  41. package/AISB/catalog/aisb.t3.015_frspec.zh.yaml +163 -0
  42. package/AISB/catalog/aisb.t3.016_mathfusion.yaml +166 -0
  43. package/AISB/catalog/aisb.t3.016_mathfusion.zh.yaml +145 -0
  44. package/AISB/catalog/aisb.t3.017_multimodalglp.yaml +171 -0
  45. package/AISB/catalog/aisb.t3.017_multimodalglp.zh.yaml +122 -0
  46. package/AISB/catalog/aisb.t3.018_cotsynth.yaml +206 -0
  47. package/AISB/catalog/aisb.t3.018_cotsynth.zh.yaml +162 -0
  48. package/AISB/catalog/aisb.t3.019_dyscaleut.yaml +211 -0
  49. package/AISB/catalog/aisb.t3.019_dyscaleut.zh.yaml +148 -0
  50. package/AISB/catalog/aisb.t3.020_aristotle.yaml +173 -0
  51. package/AISB/catalog/aisb.t3.020_aristotle.zh.yaml +119 -0
  52. package/AISB/catalog/aisb.t3.021_tokenrecycling.yaml +160 -0
  53. package/AISB/catalog/aisb.t3.021_tokenrecycling.zh.yaml +129 -0
  54. package/AISB/catalog/aisb.t3.022_chainofreasoning.yaml +204 -0
  55. package/AISB/catalog/aisb.t3.022_chainofreasoning.zh.yaml +161 -0
  56. package/AISB/catalog/aisb.t3.023_guidedembed.yaml +211 -0
  57. package/AISB/catalog/aisb.t3.023_guidedembed.zh.yaml +189 -0
  58. package/AISB/catalog/aisb.t3.024_outputcentric.yaml +148 -0
  59. package/AISB/catalog/aisb.t3.024_outputcentric.zh.yaml +131 -0
  60. package/AISB/catalog/aisb.t3.025_deeper.yaml +143 -0
  61. package/AISB/catalog/aisb.t3.025_deeper.zh.yaml +116 -0
  62. package/AISB/catalog/aisb.t3.026_gartkg.yaml +195 -0
  63. package/AISB/catalog/aisb.t3.026_gartkg.zh.yaml +127 -0
  64. package/AISB/catalog/aisb.t3.027_citeeval.yaml +182 -0
  65. package/AISB/catalog/aisb.t3.027_citeeval.zh.yaml +135 -0
  66. package/AISB/catalog/aisb.t3.028_sbam.yaml +206 -0
  67. package/AISB/catalog/aisb.t3.028_sbam.zh.yaml +166 -0
  68. package/AISB/catalog/aisb.t3.029_cdqgeoembed.yaml +224 -0
  69. package/AISB/catalog/aisb.t3.029_cdqgeoembed.zh.yaml +142 -0
  70. package/AISB/catalog/aisb.t3.030_processrm.yaml +211 -0
  71. package/AISB/catalog/aisb.t3.030_processrm.zh.yaml +166 -0
  72. package/AISB/catalog/aisb.t3.031_circuitstability.yaml +172 -0
  73. package/AISB/catalog/aisb.t3.031_circuitstability.zh.yaml +134 -0
  74. package/AISB/catalog/aisb.t3.032_ptsolver.yaml +169 -0
  75. package/AISB/catalog/aisb.t3.032_ptsolver.zh.yaml +135 -0
  76. package/AISB/catalog/aisb.t3.033_gcse.yaml +144 -0
  77. package/AISB/catalog/aisb.t3.033_gcse.zh.yaml +126 -0
  78. package/AISB/catalog/aisb.t3.034_ensemblewm.yaml +183 -0
  79. package/AISB/catalog/aisb.t3.034_ensemblewm.zh.yaml +146 -0
  80. package/AISB/catalog/aisb.t3.035_moralvalueswa.yaml +207 -0
  81. package/AISB/catalog/aisb.t3.035_moralvalueswa.zh.yaml +165 -0
  82. package/AISB/catalog/aisb.t3.036_weakstrongpref.yaml +210 -0
  83. package/AISB/catalog/aisb.t3.036_weakstrongpref.zh.yaml +194 -0
  84. package/AISB/catalog/aisb.t3.037_dementiamask.yaml +172 -0
  85. package/AISB/catalog/aisb.t3.037_dementiamask.zh.yaml +132 -0
  86. package/AISB/catalog/aisb.t3.038_tinysam.yaml +284 -0
  87. package/AISB/catalog/aisb.t3.038_tinysam.zh.yaml +240 -0
  88. package/AISB/catalog/aisb.t3.039_calf.yaml +224 -0
  89. package/AISB/catalog/aisb.t3.039_calf.zh.yaml +194 -0
  90. package/AISB/catalog/aisb.t3.040_graniteguardian.yaml +199 -0
  91. package/AISB/catalog/aisb.t3.040_graniteguardian.zh.yaml +174 -0
  92. package/AISB/catalog/aisb.t3.041_amdm.yaml +149 -0
  93. package/AISB/catalog/aisb.t3.041_amdm.zh.yaml +137 -0
  94. package/AISB/catalog/aisb.t3.042_xpatch.yaml +216 -0
  95. package/AISB/catalog/aisb.t3.042_xpatch.zh.yaml +182 -0
  96. package/AISB/catalog/aisb.t3.043_vhm.yaml +268 -0
  97. package/AISB/catalog/aisb.t3.043_vhm.zh.yaml +193 -0
  98. package/AISB/catalog/aisb.t3.044_rgvi.yaml +224 -0
  99. package/AISB/catalog/aisb.t3.044_rgvi.zh.yaml +176 -0
  100. package/AISB/catalog/aisb.t3.045_pslstm.yaml +203 -0
  101. package/AISB/catalog/aisb.t3.045_pslstm.zh.yaml +179 -0
  102. package/AISB/catalog/aisb.t3.046_nonstatts.yaml +208 -0
  103. package/AISB/catalog/aisb.t3.046_nonstatts.zh.yaml +194 -0
  104. package/AISB/catalog/aisb.t3.047_timepfn.yaml +156 -0
  105. package/AISB/catalog/aisb.t3.047_timepfn.zh.yaml +124 -0
  106. package/AISB/catalog/aisb.t3.048_proxyspex.yaml +148 -0
  107. package/AISB/catalog/aisb.t3.048_proxyspex.zh.yaml +125 -0
  108. package/AISB/catalog/aisb.t3.049_hogwildinference.yaml +183 -0
  109. package/AISB/catalog/aisb.t3.049_hogwildinference.zh.yaml +138 -0
  110. package/AISB/catalog/aisb.t3.050_causalpfn.yaml +214 -0
  111. package/AISB/catalog/aisb.t3.050_causalpfn.zh.yaml +190 -0
  112. package/AISB/catalog/aisb.t3.051_flashtp.yaml +169 -0
  113. package/AISB/catalog/aisb.t3.051_flashtp.zh.yaml +124 -0
  114. package/AISB/catalog/aisb.t3.052_nsdiff.yaml +155 -0
  115. package/AISB/catalog/aisb.t3.052_nsdiff.zh.yaml +138 -0
  116. package/AISB/catalog/aisb.t3.053_k2vae.yaml +158 -0
  117. package/AISB/catalog/aisb.t3.053_k2vae.zh.yaml +132 -0
  118. package/AISB/catalog/aisb.t3.054_timebase.yaml +178 -0
  119. package/AISB/catalog/aisb.t3.054_timebase.zh.yaml +158 -0
  120. package/AISB/catalog/aisb.t3.055_csbrain.yaml +238 -0
  121. package/AISB/catalog/aisb.t3.055_csbrain.zh.yaml +184 -0
  122. package/AISB/catalog/aisb.t3.056_infosam.yaml +224 -0
  123. package/AISB/catalog/aisb.t3.056_infosam.zh.yaml +189 -0
  124. package/AISB/catalog/aisb.t3.057_mdreid.yaml +129 -0
  125. package/AISB/catalog/aisb.t3.057_mdreid.zh.yaml +117 -0
  126. package/AISB/catalog/aisb.t3.058_mindglitch.yaml +171 -0
  127. package/AISB/catalog/aisb.t3.058_mindglitch.zh.yaml +145 -0
  128. package/AISB/catalog/aisb.t3.059_selfsupervised.yaml +154 -0
  129. package/AISB/catalog/aisb.t3.059_selfsupervised.zh.yaml +125 -0
  130. package/AISB/catalog/aisb.t3.060_iaggad.yaml +121 -0
  131. package/AISB/catalog/aisb.t3.060_iaggad.zh.yaml +100 -0
  132. package/AISB/catalog/aisb.t3.061_hsgkn.yaml +136 -0
  133. package/AISB/catalog/aisb.t3.061_hsgkn.zh.yaml +113 -0
  134. package/AISB/catalog/aisb.t3.062_visionts.yaml +237 -0
  135. package/AISB/catalog/aisb.t3.062_visionts.zh.yaml +216 -0
  136. package/AISB/catalog/aisb.t3.063_tsrag.yaml +162 -0
  137. package/AISB/catalog/aisb.t3.063_tsrag.zh.yaml +138 -0
  138. package/AISB/catalog/aisb.t3.064_pir.yaml +221 -0
  139. package/AISB/catalog/aisb.t3.064_pir.zh.yaml +197 -0
  140. package/AISB/catalog/aisb.t3.065_proteinbinding.yaml +234 -0
  141. package/AISB/catalog/aisb.t3.065_proteinbinding.zh.yaml +167 -0
  142. package/AISB/catalog/aisb.t3.066_tropicalattention.yaml +267 -0
  143. package/AISB/catalog/aisb.t3.066_tropicalattention.zh.yaml +229 -0
  144. package/AISB/catalog/aisb.t3.067_kanad.yaml +193 -0
  145. package/AISB/catalog/aisb.t3.067_kanad.zh.yaml +167 -0
  146. package/AISB/catalog/aisb.t3.068_sempo.yaml +187 -0
  147. package/AISB/catalog/aisb.t3.068_sempo.zh.yaml +148 -0
  148. package/AISB/catalog/aisb.t3.069_treehfd.yaml +129 -0
  149. package/AISB/catalog/aisb.t3.069_treehfd.zh.yaml +111 -0
  150. package/AISB/catalog/aisb.t3.070_certifiedunlearning.yaml +224 -0
  151. package/AISB/catalog/aisb.t3.070_certifiedunlearning.zh.yaml +171 -0
  152. package/AISB/catalog/aisb.t3.071_neuralmjd.yaml +142 -0
  153. package/AISB/catalog/aisb.t3.071_neuralmjd.zh.yaml +120 -0
  154. package/AISB/catalog/aisb.t3.072_fedgmt.yaml +181 -0
  155. package/AISB/catalog/aisb.t3.072_fedgmt.zh.yaml +158 -0
  156. package/AISB/catalog/aisb.t3.073_rld.yaml +161 -0
  157. package/AISB/catalog/aisb.t3.073_rld.zh.yaml +129 -0
  158. package/AISB/catalog/aisb.t3.074_lsvi.yaml +163 -0
  159. package/AISB/catalog/aisb.t3.074_lsvi.zh.yaml +129 -0
  160. package/AISB/catalog/aisb.t3.075_treeslicedentropy.yaml +201 -0
  161. package/AISB/catalog/aisb.t3.075_treeslicedentropy.zh.yaml +148 -0
  162. package/AISB/catalog/aisb.t3.076_aanet.yaml +169 -0
  163. package/AISB/catalog/aisb.t3.076_aanet.zh.yaml +129 -0
  164. package/AISB/catalog/aisb.t3.077_cmnn.yaml +199 -0
  165. package/AISB/catalog/aisb.t3.077_cmnn.zh.yaml +165 -0
  166. package/AISB/catalog/aisb.t3.078_conformalanomaly.yaml +146 -0
  167. package/AISB/catalog/aisb.t3.078_conformalanomaly.zh.yaml +117 -0
  168. package/AISB/catalog/aisb.t3.079_dpfkmeans.yaml +131 -0
  169. package/AISB/catalog/aisb.t3.079_dpfkmeans.zh.yaml +104 -0
  170. package/AISB/catalog/aisb.t3.080_latentscorereweight.yaml +169 -0
  171. package/AISB/catalog/aisb.t3.080_latentscorereweight.zh.yaml +123 -0
  172. package/AISB/catalog/aisb.t3.081_qmamba.yaml +150 -0
  173. package/AISB/catalog/aisb.t3.081_qmamba.zh.yaml +117 -0
  174. package/AISB/catalog/aisb.t3.082_onlinellmrouting.yaml +160 -0
  175. package/AISB/catalog/aisb.t3.082_onlinellmrouting.zh.yaml +133 -0
  176. package/AISB/catalog/aisb.t3.083_starformer.yaml +178 -0
  177. package/AISB/catalog/aisb.t3.083_starformer.zh.yaml +140 -0
  178. package/AISB/catalog/aisb.t3.084_ift.yaml +139 -0
  179. package/AISB/catalog/aisb.t3.084_ift.zh.yaml +111 -0
  180. package/AISB/catalog/aisb.t3.085_neuralsurv.yaml +183 -0
  181. package/AISB/catalog/aisb.t3.085_neuralsurv.zh.yaml +143 -0
  182. package/AISB/catalog/aisb.t3.086_stella.yaml +197 -0
  183. package/AISB/catalog/aisb.t3.086_stella.zh.yaml +142 -0
  184. package/AISB/catalog/aisb.t3.087_moses.yaml +167 -0
  185. package/AISB/catalog/aisb.t3.087_moses.zh.yaml +132 -0
  186. package/AISB/catalog/aisb.t3.088_channelnorm.yaml +140 -0
  187. package/AISB/catalog/aisb.t3.088_channelnorm.zh.yaml +109 -0
  188. package/AISB/catalog/aisb.t3.089_causalvelocity.yaml +730 -0
  189. package/AISB/catalog/aisb.t3.089_causalvelocity.zh.yaml +668 -0
  190. package/AISB/catalog/aisb.t3.090_rstib.yaml +144 -0
  191. package/AISB/catalog/aisb.t3.090_rstib.zh.yaml +109 -0
  192. package/AISB/catalog/aisb.t3.091_timeawarecausal.yaml +132 -0
  193. package/AISB/catalog/aisb.t3.091_timeawarecausal.zh.yaml +107 -0
  194. package/AISB/catalog/aisb.t3.092_kmeanslocalopt.yaml +138 -0
  195. package/AISB/catalog/aisb.t3.092_kmeanslocalopt.zh.yaml +110 -0
  196. package/AISB/catalog/aisb.t3.093_fedwmsam.yaml +134 -0
  197. package/AISB/catalog/aisb.t3.093_fedwmsam.zh.yaml +106 -0
  198. package/AISB/catalog/aisb.t3.094_boundre.yaml +147 -0
  199. package/AISB/catalog/aisb.t3.094_boundre.zh.yaml +114 -0
  200. package/AISB/catalog/aisb.t3.095_fastfeaturecp.yaml +153 -0
  201. package/AISB/catalog/aisb.t3.095_fastfeaturecp.zh.yaml +118 -0
  202. package/AISB/catalog/aisb.t3.096_m3svm.yaml +189 -0
  203. package/AISB/catalog/aisb.t3.096_m3svm.zh.yaml +149 -0
  204. package/AISB/catalog/aisb.t3.097_wassersteintl.yaml +212 -0
  205. package/AISB/catalog/aisb.t3.097_wassersteintl.zh.yaml +169 -0
  206. package/AISB/catalog/aisb.t3.098_xmahalanobis.yaml +171 -0
  207. package/AISB/catalog/aisb.t3.098_xmahalanobis.zh.yaml +127 -0
  208. package/AISB/catalog/aisb.t3.099_ollalanding.yaml +248 -0
  209. package/AISB/catalog/aisb.t3.099_ollalanding.zh.yaml +182 -0
  210. package/AISB/catalog/aisb.t3.100_invmissingdata.yaml +179 -0
  211. package/AISB/catalog/aisb.t3.100_invmissingdata.zh.yaml +150 -0
  212. package/AISB/catalog/aisb.t3.101_acia.yaml +164 -0
  213. package/AISB/catalog/aisb.t3.101_acia.zh.yaml +109 -0
  214. package/AISB/catalog/aisb.t3.102_stochasticff.yaml +178 -0
  215. package/AISB/catalog/aisb.t3.102_stochasticff.zh.yaml +130 -0
  216. package/AISB/catalog/aisb.t3.103_qdcp.yaml +150 -0
  217. package/AISB/catalog/aisb.t3.103_qdcp.zh.yaml +116 -0
  218. package/AISB/catalog/aisb.t3.104_balancedactiveinf.yaml +137 -0
  219. package/AISB/catalog/aisb.t3.104_balancedactiveinf.zh.yaml +104 -0
  220. package/AISB/catalog/aisb.t3.105_binaryclasseval.yaml +161 -0
  221. package/AISB/catalog/aisb.t3.105_binaryclasseval.zh.yaml +130 -0
  222. package/AISB/image/001_aisb.t3.001_savvy.jpg +0 -0
  223. package/AISB/image/002_aisb.t3.002_pinet.jpg +0 -0
  224. package/AISB/image/003_aisb.t3.003_dmsqd.jpg +0 -0
  225. package/AISB/image/004_aisb.t3.004_decentralattn.jpg +0 -0
  226. package/AISB/image/005_aisb.t3.005_tsae.jpg +0 -0
  227. package/AISB/image/006_aisb.t3.006_physense.jpg +0 -0
  228. package/AISB/image/007_aisb.t3.007_reasoningiqa.jpg +0 -0
  229. package/AISB/image/008_aisb.t3.008_meanflows.jpg +0 -0
  230. package/AISB/image/009_aisb.t3.009_scoremissing.jpg +0 -0
  231. package/AISB/image/010_aisb.t3.010_suitabilityfilter.jpg +0 -0
  232. package/AISB/image/011_aisb.t3.011_osd.jpg +0 -0
  233. package/AISB/image/012_aisb.t3.012_efficientqat.jpg +0 -0
  234. package/AISB/image/013_aisb.t3.013_appl.jpg +0 -0
  235. package/AISB/image/014_aisb.t3.014_piguard.jpg +0 -0
  236. package/AISB/image/015_aisb.t3.015_frspec.jpg +0 -0
  237. package/AISB/image/016_aisb.t3.016_mathfusion.jpg +0 -0
  238. package/AISB/image/017_aisb.t3.017_multimodalglp.jpg +0 -0
  239. package/AISB/image/018_aisb.t3.018_cotsynth.jpg +0 -0
  240. package/AISB/image/019_aisb.t3.019_dyscaleut.jpg +0 -0
  241. package/AISB/image/020_aisb.t3.020_aristotle.jpg +0 -0
  242. package/AISB/image/021_aisb.t3.021_tokenrecycling.jpg +0 -0
  243. package/AISB/image/022_aisb.t3.022_chainofreasoning.jpg +0 -0
  244. package/AISB/image/023_aisb.t3.023_guidedembed.jpg +0 -0
  245. package/AISB/image/024_aisb.t3.024_outputcentric.jpg +0 -0
  246. package/AISB/image/025_aisb.t3.025_deeper.jpg +0 -0
  247. package/AISB/image/026_aisb.t3.026_gartkg.jpg +0 -0
  248. package/AISB/image/027_aisb.t3.027_citeeval.jpg +0 -0
  249. package/AISB/image/028_aisb.t3.028_sbam.jpg +0 -0
  250. package/AISB/image/029_aisb.t3.029_cdqgeoembed.jpg +0 -0
  251. package/AISB/image/030_aisb.t3.030_processrm.jpg +0 -0
  252. package/AISB/image/031_aisb.t3.031_circuitstability.jpg +0 -0
  253. package/AISB/image/032_aisb.t3.032_ptsolver.jpg +0 -0
  254. package/AISB/image/033_aisb.t3.033_gcse.jpg +0 -0
  255. package/AISB/image/034_aisb.t3.034_ensemblewm.jpg +0 -0
  256. package/AISB/image/035_aisb.t3.035_moralvalueswa.jpg +0 -0
  257. package/AISB/image/036_aisb.t3.036_weakstrongpref.jpg +0 -0
  258. package/AISB/image/037_aisb.t3.037_dementiamask.jpg +0 -0
  259. package/AISB/image/038_aisb.t3.038_tinysam.jpg +0 -0
  260. package/AISB/image/039_aisb.t3.039_calf.jpg +0 -0
  261. package/AISB/image/040_aisb.t3.040_graniteguardian.jpg +0 -0
  262. package/AISB/image/041_aisb.t3.041_amdm.jpg +0 -0
  263. package/AISB/image/042_aisb.t3.042_xpatch.jpg +0 -0
  264. package/AISB/image/043_aisb.t3.043_vhm.jpg +0 -0
  265. package/AISB/image/044_aisb.t3.044_rgvi.jpg +0 -0
  266. package/AISB/image/045_aisb.t3.045_pslstm.jpg +0 -0
  267. package/AISB/image/046_aisb.t3.046_nonstatts.jpg +0 -0
  268. package/AISB/image/047_aisb.t3.047_timepfn.jpg +0 -0
  269. package/AISB/image/048_aisb.t3.048_proxyspex.jpg +0 -0
  270. package/AISB/image/049_aisb.t3.049_hogwildinference.jpg +0 -0
  271. package/AISB/image/050_aisb.t3.050_causalpfn.jpg +0 -0
  272. package/AISB/image/051_aisb.t3.051_flashtp.jpg +0 -0
  273. package/AISB/image/052_aisb.t3.052_nsdiff.jpg +0 -0
  274. package/AISB/image/053_aisb.t3.053_k2vae.jpg +0 -0
  275. package/AISB/image/054_aisb.t3.054_timebase.jpg +0 -0
  276. package/AISB/image/055_aisb.t3.055_csbrain.jpg +0 -0
  277. package/AISB/image/056_aisb.t3.056_infosam.jpg +0 -0
  278. package/AISB/image/057_aisb.t3.057_mdreid.jpg +0 -0
  279. package/AISB/image/058_aisb.t3.058_mindglitch.jpg +0 -0
  280. package/AISB/image/059_aisb.t3.059_selfsupervised.jpg +0 -0
  281. package/AISB/image/060_aisb.t3.060_iaggad.jpg +0 -0
  282. package/AISB/image/061_aisb.t3.061_hsgkn.jpg +0 -0
  283. package/AISB/image/062_aisb.t3.062_visionts.jpg +0 -0
  284. package/AISB/image/063_aisb.t3.063_tsrag.jpg +0 -0
  285. package/AISB/image/064_aisb.t3.064_pir.jpg +0 -0
  286. package/AISB/image/065_aisb.t3.065_proteinbinding.jpg +0 -0
  287. package/AISB/image/066_aisb.t3.066_tropicalattention.jpg +0 -0
  288. package/AISB/image/067_aisb.t3.067_kanad.jpg +0 -0
  289. package/AISB/image/068_aisb.t3.068_sempo.jpg +0 -0
  290. package/AISB/image/069_aisb.t3.069_treehfd.jpg +0 -0
  291. package/AISB/image/070_aisb.t3.070_certifiedunlearning.jpg +0 -0
  292. package/AISB/image/071_aisb.t3.071_neuralmjd.jpg +0 -0
  293. package/AISB/image/072_aisb.t3.072_fedgmt.jpg +0 -0
  294. package/AISB/image/073_aisb.t3.073_rld.jpg +0 -0
  295. package/AISB/image/074_aisb.t3.074_lsvi.jpg +0 -0
  296. package/AISB/image/075_aisb.t3.075_treeslicedentropy.jpg +0 -0
  297. package/AISB/image/076_aisb.t3.076_aanet.jpg +0 -0
  298. package/AISB/image/077_aisb.t3.077_cmnn.jpg +0 -0
  299. package/AISB/image/078_aisb.t3.078_conformalanomaly.jpg +0 -0
  300. package/AISB/image/079_aisb.t3.079_dpfkmeans.jpg +0 -0
  301. package/AISB/image/080_aisb.t3.080_latentscorereweight.jpg +0 -0
  302. package/AISB/image/081_aisb.t3.081_qmamba.jpg +0 -0
  303. package/AISB/image/082_aisb.t3.082_onlinellmrouting.jpg +0 -0
  304. package/AISB/image/083_aisb.t3.083_starformer.jpg +0 -0
  305. package/AISB/image/084_aisb.t3.084_ift.jpg +0 -0
  306. package/AISB/image/085_aisb.t3.085_neuralsurv.jpg +0 -0
  307. package/AISB/image/086_aisb.t3.086_stella.jpg +0 -0
  308. package/AISB/image/087_aisb.t3.087_moses.jpg +0 -0
  309. package/AISB/image/088_aisb.t3.088_channelnorm.jpg +0 -0
  310. package/AISB/image/089_aisb.t3.089_causalvelocity.jpg +0 -0
  311. package/AISB/image/090_aisb.t3.090_rstib.jpg +0 -0
  312. package/AISB/image/091_aisb.t3.091_timeawarecausal.jpg +0 -0
  313. package/AISB/image/092_aisb.t3.092_kmeanslocalopt.jpg +0 -0
  314. package/AISB/image/093_aisb.t3.093_fedwmsam.jpg +0 -0
  315. package/AISB/image/094_aisb.t3.094_boundre.jpg +0 -0
  316. package/AISB/image/095_aisb.t3.095_fastfeaturecp.jpg +0 -0
  317. package/AISB/image/096_aisb.t3.096_m3svm.jpg +0 -0
  318. package/AISB/image/097_aisb.t3.097_wassersteintl.jpg +0 -0
  319. package/AISB/image/098_aisb.t3.098_xmahalanobis.jpg +0 -0
  320. package/AISB/image/099_aisb.t3.099_ollalanding.jpg +0 -0
  321. package/AISB/image/100_aisb.t3.100_invmissingdata.jpg +0 -0
  322. package/AISB/image/101_aisb.t3.101_acia.jpg +0 -0
  323. package/AISB/image/102_aisb.t3.102_stochasticff.jpg +0 -0
  324. package/AISB/image/103_aisb.t3.103_qdcp.jpg +0 -0
  325. package/AISB/image/104_aisb.t3.104_balancedactiveinf.jpg +0 -0
  326. package/AISB/image/105_aisb.t3.105_binaryclasseval.jpg +0 -0
  327. package/AISB/image/106_aisb.t1.reasoning_lite.jpg +0 -0
  328. package/AISB/image/107_aisb.t2.paper_audit.jpg +0 -0
  329. package/AISB/image/108_aisb.t3.multi_gpu_search.jpg +0 -0
  330. package/AISB/image/109_aisb.t3.tdc_admet.jpg +0 -0
  331. package/AISB/image/aisb.b1.agentic_coding.svg +16 -0
  332. package/AISB/image/aisb.b10.climate_earth.svg +16 -0
  333. package/AISB/image/aisb.b11.model_efficiency.svg +16 -0
  334. package/AISB/image/aisb.b12.embodied_ai.svg +16 -0
  335. package/AISB/image/aisb.b2.agent_systems.svg +16 -0
  336. package/AISB/image/aisb.b3.self_evolving_rl.svg +16 -0
  337. package/AISB/image/aisb.b4.lm_reasoning.svg +16 -0
  338. package/AISB/image/aisb.b5.math_proof.svg +16 -0
  339. package/AISB/image/aisb.b6.research_process.svg +16 -0
  340. package/AISB/image/aisb.b7.multimodal_fusion.svg +16 -0
  341. package/AISB/image/aisb.b8.lifesci_drug.svg +16 -0
  342. package/AISB/image/aisb.b9.material_science.svg +16 -0
  343. package/README.md +132 -11
  344. package/bin/ds.js +376 -49
  345. package/docs/en/00_QUICK_START.md +135 -18
  346. package/docs/en/01_SETTINGS_REFERENCE.md +468 -96
  347. package/docs/en/02_START_RESEARCH_GUIDE.md +26 -5
  348. package/docs/en/03_QQ_CONNECTOR_GUIDE.md +14 -3
  349. package/docs/en/04_LINGZHU_CONNECTOR_GUIDE.md +2 -0
  350. package/docs/en/05_TUI_GUIDE.md +171 -2
  351. package/docs/en/07_MEMORY_AND_MCP.md +38 -2
  352. package/docs/en/09_DOCTOR.md +64 -4
  353. package/docs/en/10_WEIXIN_CONNECTOR_GUIDE.md +38 -1
  354. package/docs/en/11_LICENSE_AND_RISK.md +4 -0
  355. package/docs/en/12_GUIDED_WORKFLOW_TOUR.md +15 -0
  356. package/docs/en/14_PROMPT_SKILLS_AND_MCP_GUIDE.md +9 -0
  357. package/docs/en/15_CODEX_PROVIDER_SETUP.md +622 -187
  358. package/docs/en/16_TELEGRAM_CONNECTOR_GUIDE.md +14 -0
  359. package/docs/en/17_WHATSAPP_CONNECTOR_GUIDE.md +14 -0
  360. package/docs/en/18_FEISHU_CONNECTOR_GUIDE.md +14 -0
  361. package/docs/en/21_LOCAL_MODEL_BACKENDS_GUIDE.md +105 -2
  362. package/docs/en/22_BENCHSTORE_YAML_REFERENCE.md +469 -0
  363. package/docs/en/23_BENCHSTORE_GITHUB_RELEASES_SPEC.md +316 -0
  364. package/docs/en/24_CLAUDE_CODE_PROVIDER_SETUP.md +469 -0
  365. package/docs/en/25_OPENCODE_PROVIDER_SETUP.md +653 -0
  366. package/docs/en/26_CITATION_AND_ATTRIBUTION.md +119 -0
  367. package/docs/en/27_KIMI_CODE_PROVIDER_SETUP.md +180 -0
  368. package/docs/en/28_DISCORD_CONNECTOR_GUIDE.md +61 -0
  369. package/docs/en/29_SLACK_CONNECTOR_GUIDE.md +60 -0
  370. package/docs/en/30_SETTINGS_CONTROL_CENTER_GUIDE.md +371 -0
  371. package/docs/en/{19_LOCAL_BROWSER_AUTH.md → 31_LOCAL_BROWSER_AUTH.md} +1 -1
  372. package/docs/en/32_WINDOWS_WSL2_DEPLOYMENT_GUIDE.md +273 -0
  373. package/docs/en/33_WORKSPACE_EXPLORER_QA.md +121 -0
  374. package/docs/en/91_DEVELOPMENT.md +29 -0
  375. package/docs/en/99_ACKNOWLEDGEMENTS.md +24 -19
  376. package/docs/en/README.md +44 -7
  377. package/docs/images/admin/admin-connectors-health-en.png +0 -0
  378. package/docs/images/admin/admin-controllers-en.png +0 -0
  379. package/docs/images/admin/admin-diagnostics-en.png +0 -0
  380. package/docs/images/admin/admin-errors-en.png +0 -0
  381. package/docs/images/admin/admin-issues-en.png +0 -0
  382. package/docs/images/admin/admin-logs-en.png +0 -0
  383. package/docs/images/admin/admin-quest-detail-en.png +0 -0
  384. package/docs/images/admin/admin-quests-en.png +0 -0
  385. package/docs/images/admin/admin-repairs-en.png +0 -0
  386. package/docs/images/admin/admin-runtime-en.png +0 -0
  387. package/docs/images/admin/admin-search-en.png +0 -0
  388. package/docs/images/admin/admin-stats-en.png +0 -0
  389. package/docs/images/admin/admin-summary-en.png +0 -0
  390. package/docs/images/connectors/connector-discord-en.png +0 -0
  391. package/docs/images/connectors/connector-feishu-en.png +0 -0
  392. package/docs/images/connectors/connector-lingzhu-en.png +0 -0
  393. package/docs/images/connectors/connector-qq-en.png +0 -0
  394. package/docs/images/connectors/connector-slack-en.png +0 -0
  395. package/docs/images/connectors/connector-telegram-en.png +0 -0
  396. package/docs/images/connectors/connector-weixin-en.png +0 -0
  397. package/docs/images/connectors/connector-whatsapp-en.png +0 -0
  398. package/docs/images/settings/settings-baselines-en.png +0 -0
  399. package/docs/images/settings/settings-config-en.png +0 -0
  400. package/docs/images/settings/settings-connectors-overview-en.png +0 -0
  401. package/docs/images/settings/settings-deepxiv-en.png +0 -0
  402. package/docs/images/settings/settings-mcp-servers-en.png +0 -0
  403. package/docs/images/settings/settings-plugins-en.png +0 -0
  404. package/docs/images/settings/settings-runners-en.png +0 -0
  405. package/docs/zh/00_QUICK_START.md +92 -17
  406. package/docs/zh/01_SETTINGS_REFERENCE.md +219 -98
  407. package/docs/zh/02_START_RESEARCH_GUIDE.md +26 -5
  408. package/docs/zh/05_TUI_GUIDE.md +171 -2
  409. package/docs/zh/07_MEMORY_AND_MCP.md +29 -2
  410. package/docs/zh/09_DOCTOR.md +39 -4
  411. package/docs/zh/10_WEIXIN_CONNECTOR_GUIDE.md +24 -1
  412. package/docs/zh/11_LICENSE_AND_RISK.md +4 -0
  413. package/docs/zh/12_GUIDED_WORKFLOW_TOUR.md +15 -0
  414. package/docs/zh/14_PROMPT_SKILLS_AND_MCP_GUIDE.md +9 -0
  415. package/docs/zh/15_CODEX_PROVIDER_SETUP.md +550 -188
  416. package/docs/zh/21_LOCAL_MODEL_BACKENDS_GUIDE.md +105 -2
  417. package/docs/zh/22_BENCHSTORE_YAML_REFERENCE.md +459 -0
  418. package/docs/zh/23_BENCHSTORE_GITHUB_RELEASES_SPEC.md +287 -0
  419. package/docs/zh/23_CLAUDE_RUNNER_GUIDE.md +103 -0
  420. package/docs/zh/24_CLAUDE_CODE_PROVIDER_SETUP.md +460 -0
  421. package/docs/zh/25_OPENCODE_PROVIDER_SETUP.md +660 -0
  422. package/docs/zh/26_CITATION_AND_ATTRIBUTION.md +102 -0
  423. package/docs/zh/27_KIMI_CODE_PROVIDER_SETUP.md +51 -0
  424. package/docs/zh/{19_LOCAL_BROWSER_AUTH.md → 31_LOCAL_BROWSER_AUTH.md} +1 -1
  425. package/docs/zh/32_WINDOWS_WSL2_DEPLOYMENT_GUIDE.md +264 -0
  426. package/docs/zh/33_WORKSPACE_EXPLORER_QA.md +127 -0
  427. package/docs/zh/99_ACKNOWLEDGEMENTS.md +23 -19
  428. package/docs/zh/README.md +29 -7
  429. package/install.sh +122 -16
  430. package/package.json +4 -1
  431. package/pyproject.toml +2 -1
  432. package/src/deepscientist/__init__.py +1 -1
  433. package/src/deepscientist/acp/envelope.py +13 -0
  434. package/src/deepscientist/admin/__init__.py +3 -0
  435. package/src/deepscientist/admin/charts.py +681 -0
  436. package/src/deepscientist/admin/logs.py +119 -0
  437. package/src/deepscientist/admin/repairs.py +217 -0
  438. package/src/deepscientist/admin/service.py +1310 -0
  439. package/src/deepscientist/admin/system_info.py +700 -0
  440. package/src/deepscientist/admin/tasks.py +465 -0
  441. package/src/deepscientist/admin/tool_metrics.py +600 -0
  442. package/src/deepscientist/artifact/guidance.py +8 -4
  443. package/src/deepscientist/artifact/schemas.py +115 -0
  444. package/src/deepscientist/artifact/service.py +4268 -260
  445. package/src/deepscientist/bash_exec/monitor.py +30 -3
  446. package/src/deepscientist/bash_exec/service.py +134 -1
  447. package/src/deepscientist/benchstore/__init__.py +4 -0
  448. package/src/deepscientist/benchstore/prompt_builder.py +224 -0
  449. package/src/deepscientist/benchstore/service.py +1716 -0
  450. package/src/deepscientist/channels/weixin_ilink.py +8 -1
  451. package/src/deepscientist/cli.py +92 -17
  452. package/src/deepscientist/codex_cli_compat.py +2 -2
  453. package/src/deepscientist/config/models.py +82 -11
  454. package/src/deepscientist/config/service.py +927 -91
  455. package/src/deepscientist/connector/weixin_support.py +48 -17
  456. package/src/deepscientist/daemon/api/handlers.py +697 -210
  457. package/src/deepscientist/daemon/api/router.py +76 -1
  458. package/src/deepscientist/daemon/app.py +1054 -51
  459. package/src/deepscientist/diagnostics/runner_failures.py +147 -0
  460. package/src/deepscientist/doctor.py +212 -65
  461. package/src/deepscientist/evidence_packets.py +590 -0
  462. package/src/deepscientist/home.py +52 -4
  463. package/src/deepscientist/kimi_cli_compat.py +50 -0
  464. package/src/deepscientist/latex_runtime.py +2 -2
  465. package/src/deepscientist/mcp/context.py +2 -0
  466. package/src/deepscientist/mcp/schemas.py +114 -0
  467. package/src/deepscientist/mcp/server.py +1566 -126
  468. package/src/deepscientist/memory/service.py +203 -16
  469. package/src/deepscientist/process_control.py +8 -1
  470. package/src/deepscientist/prompts/builder.py +836 -92
  471. package/src/deepscientist/quest/__init__.py +2 -2
  472. package/src/deepscientist/quest/layout.py +12 -1
  473. package/src/deepscientist/quest/node_traces.py +10 -0
  474. package/src/deepscientist/quest/service.py +1430 -139
  475. package/src/deepscientist/quest/stage_views.py +1 -1
  476. package/src/deepscientist/runners/__init__.py +18 -0
  477. package/src/deepscientist/runners/base.py +89 -1
  478. package/src/deepscientist/runners/builtins.py +13 -1
  479. package/src/deepscientist/runners/claude.py +391 -0
  480. package/src/deepscientist/runners/codex.py +421 -21
  481. package/src/deepscientist/runners/codex_telemetry.py +127 -0
  482. package/src/deepscientist/runners/kimi.py +334 -0
  483. package/src/deepscientist/runners/metadata.py +68 -0
  484. package/src/deepscientist/runners/opencode.py +414 -0
  485. package/src/deepscientist/runners/runtime_overrides.py +100 -0
  486. package/src/deepscientist/runners/simple_cli.py +538 -0
  487. package/src/deepscientist/runtime_storage.py +303 -0
  488. package/src/deepscientist/shared.py +61 -16
  489. package/src/deepscientist/skills/installer.py +37 -0
  490. package/src/deepscientist/skills/registry.py +2 -0
  491. package/src/deepscientist/tinytex.py +2 -2
  492. package/src/deepscientist/tui.py +10 -3
  493. package/src/prompts/benchstore/system.md +77 -0
  494. package/src/prompts/connectors/qq.md +33 -2
  495. package/src/prompts/connectors/weixin.md +208 -23
  496. package/src/prompts/contracts/admin_ops.md +74 -0
  497. package/src/prompts/contracts/admin_ops_knowledge.md +138 -0
  498. package/src/prompts/contracts/shared_interaction.md +5 -11
  499. package/src/prompts/start_setup/system.md +422 -0
  500. package/src/prompts/system.md +409 -315
  501. package/src/prompts/system_copilot.md +88 -12
  502. package/src/skills/analysis-campaign/SKILL.md +239 -578
  503. package/src/skills/analysis-campaign/references/artifact-flow-examples.md +102 -0
  504. package/src/skills/analysis-campaign/references/boundary-cases.md +98 -0
  505. package/src/skills/analysis-campaign/references/campaign-checklist-template.md +39 -24
  506. package/src/skills/analysis-campaign/references/campaign-design.md +26 -10
  507. package/src/skills/analysis-campaign/references/campaign-plan-template.md +53 -54
  508. package/src/skills/analysis-campaign/references/operational-guidance.md +97 -0
  509. package/src/skills/analysis-campaign/references/writing-facing-slice-examples.md +10 -20
  510. package/src/skills/baseline/SKILL.md +183 -461
  511. package/src/skills/baseline/references/artifact-flow-examples.md +106 -0
  512. package/src/skills/baseline/references/artifact-payload-examples.md +1 -1
  513. package/src/skills/baseline/references/baseline-checklist-template.md +27 -35
  514. package/src/skills/baseline/references/baseline-plan-template.md +37 -76
  515. package/src/skills/baseline/references/boundary-cases.md +86 -0
  516. package/src/skills/baseline/references/codebase-audit-checklist.md +2 -6
  517. package/src/skills/baseline/references/comparability-contract.md +7 -12
  518. package/src/skills/baseline/references/operational-guidance.md +56 -0
  519. package/src/skills/baseline/references/route-selection.md +5 -25
  520. package/src/skills/decision/SKILL.md +113 -306
  521. package/src/skills/decision/references/checkpoint-memory-template.md +47 -0
  522. package/src/skills/decision/references/operational-guidance.md +94 -0
  523. package/src/skills/decision/references/research-route-criteria.md +7 -8
  524. package/src/skills/decision/references/strategic-decision-template.md +13 -26
  525. package/src/skills/experiment/SKILL.md +132 -670
  526. package/src/skills/experiment/references/execution-playbook.md +374 -0
  527. package/src/skills/experiment/references/main-experiment-checklist-template.md +26 -2
  528. package/src/skills/experiment/references/main-experiment-plan-template.md +28 -17
  529. package/src/skills/experiment/references/operational-guidance.md +108 -0
  530. package/src/skills/finalize/SKILL.md +62 -0
  531. package/src/skills/finalize/references/checkpoint-memory-template.md +49 -0
  532. package/src/skills/finalize/references/resume-packet-template.md +7 -0
  533. package/src/skills/idea/SKILL.md +228 -15
  534. package/src/skills/idea/references/controlled-brainstorming-playbook.md +78 -0
  535. package/src/skills/idea/references/current-board-packet-template.md +61 -0
  536. package/src/skills/idea/references/high-value-idea-sourcing.md +119 -0
  537. package/src/skills/idea/references/idea-generation-playbook.md +21 -0
  538. package/src/skills/idea/references/idea-thinking-flow.md +6 -0
  539. package/src/skills/idea/references/literature-survey-template.md +3 -0
  540. package/src/skills/idea/references/objective-contract-template.md +54 -0
  541. package/src/skills/idea/references/outline-seeding-example.md +56 -0
  542. package/src/skills/idea/references/pre-idea-draft-template.md +105 -0
  543. package/src/skills/idea/references/related-work-playbook.md +75 -2
  544. package/src/skills/idea/references/research-history-playbook.md +114 -0
  545. package/src/skills/idea/references/selection-gate.md +58 -6
  546. package/src/skills/intake-audit/SKILL.md +43 -2
  547. package/src/skills/intake-audit/references/state-audit-template.md +10 -0
  548. package/src/skills/nature-data/SKILL.md +128 -0
  549. package/src/skills/nature-data/UPSTREAM_LICENSE.txt +21 -0
  550. package/src/skills/nature-data/agents/openai.yaml +4 -0
  551. package/src/skills/nature-data/references/chinese-author-alignment.md +84 -0
  552. package/src/skills/nature-data/references/fair-metadata-checklist.md +105 -0
  553. package/src/skills/nature-data/references/policy-principles.md +103 -0
  554. package/src/skills/nature-data/references/repository-and-identifiers.md +96 -0
  555. package/src/skills/nature-data/references/source-basis.md +54 -0
  556. package/src/skills/nature-data/references/statement-patterns.md +153 -0
  557. package/src/skills/nature-figure/SKILL.md +197 -0
  558. package/src/skills/nature-figure/UPSTREAM_LICENSE.txt +21 -0
  559. package/src/skills/nature-figure/agents/openai.yaml +4 -0
  560. package/src/skills/nature-figure/evals/evals.json +37 -0
  561. package/src/skills/nature-figure/references/api.md +428 -0
  562. package/src/skills/nature-figure/references/backend-selection.md +100 -0
  563. package/src/skills/nature-figure/references/chart-types.md +281 -0
  564. package/src/skills/nature-figure/references/common-patterns.md +349 -0
  565. package/src/skills/nature-figure/references/design-theory.md +436 -0
  566. package/src/skills/nature-figure/references/figure-contract.md +93 -0
  567. package/src/skills/nature-figure/references/nature-2026-observations.md +112 -0
  568. package/src/skills/nature-figure/references/qa-contract.md +119 -0
  569. package/src/skills/nature-figure/references/r-template-index.md +66 -0
  570. package/src/skills/nature-figure/references/r-workflow.md +161 -0
  571. package/src/skills/nature-figure/references/tutorials.md +250 -0
  572. package/src/skills/nature-paper2ppt/SKILL.md +507 -0
  573. package/src/skills/nature-paper2ppt/UPSTREAM_LICENSE.txt +21 -0
  574. package/src/skills/nature-paper2ppt/agents/openai.yaml +4 -0
  575. package/src/skills/nature-polishing/SKILL.md +385 -0
  576. package/src/skills/nature-polishing/UPSTREAM_LICENSE.txt +21 -0
  577. package/src/skills/nature-polishing/agents/openai.yaml +4 -0
  578. package/src/skills/nature-polishing/references/phrasebank-playbook.md +162 -0
  579. package/src/skills/nature-polishing/references/section-moves.md +240 -0
  580. package/src/skills/nature-polishing/references/style-guardrails.md +94 -0
  581. package/src/skills/nature-polishing/references/writing-strategy.md +148 -0
  582. package/src/skills/optimize/SKILL.md +177 -1568
  583. package/src/skills/optimize/references/brief-shaping-playbook.md +95 -0
  584. package/src/skills/optimize/references/candidate-board-template.md +13 -0
  585. package/src/skills/optimize/references/candidate-ranking-template.md +51 -0
  586. package/src/skills/optimize/references/codegen-route-playbook.md +50 -0
  587. package/src/skills/optimize/references/debug-response-template.md +29 -0
  588. package/src/skills/optimize/references/frontier-review-template.md +32 -0
  589. package/src/skills/optimize/references/fusion-playbook.md +36 -0
  590. package/src/skills/optimize/references/method-brief-template.md +73 -0
  591. package/src/skills/optimize/references/operational-guidance.md +621 -0
  592. package/src/skills/optimize/references/optimization-memory-template.md +30 -0
  593. package/src/skills/optimize/references/optimize-checklist-template.md +18 -0
  594. package/src/skills/optimize/references/plateau-response-playbook.md +28 -0
  595. package/src/skills/optimize/references/prompt-patterns.md +49 -0
  596. package/src/skills/paper-outline/SKILL.md +227 -0
  597. package/src/skills/paper-outline/references/outline-patterns.md +87 -0
  598. package/src/skills/paper-plot/SKILL.md +79 -0
  599. package/src/skills/paper-plot/agents/openai.yaml +4 -0
  600. package/src/skills/paper-plot/references/bar_grouped_hatch.md +96 -0
  601. package/src/skills/paper-plot/references/bar_paired_delta.md +72 -0
  602. package/src/skills/paper-plot/references/line_confidence_band.md +75 -0
  603. package/src/skills/paper-plot/references/line_loss_with_inset.md +65 -0
  604. package/src/skills/paper-plot/references/line_training_curve.md +44 -0
  605. package/src/skills/paper-plot/references/radar_dual_series.md +59 -0
  606. package/src/skills/paper-plot/references/scatter_broken_axis.md +59 -0
  607. package/src/skills/paper-plot/references/scatter_tsne_cluster.md +72 -0
  608. package/src/skills/paper-plot/scripts/bar_memevolve.py +109 -0
  609. package/src/skills/paper-plot/scripts/bar_spice.py +166 -0
  610. package/src/skills/paper-plot/scripts/line_aime.py +94 -0
  611. package/src/skills/paper-plot/scripts/line_loss_inset.py +157 -0
  612. package/src/skills/paper-plot/scripts/line_selfdistill.py +168 -0
  613. package/src/skills/paper-plot/scripts/radar_dora.py +151 -0
  614. package/src/skills/paper-plot/scripts/scatter_break.py +169 -0
  615. package/src/skills/paper-plot/scripts/scatter_tsne.py +133 -0
  616. package/src/skills/rebuttal/SKILL.md +9 -0
  617. package/src/skills/references/tool-usage-by-stage.md +438 -0
  618. package/src/skills/review/SKILL.md +105 -7
  619. package/src/skills/science/PROVENANCE.md +44 -0
  620. package/src/skills/science/SKILL.md +137 -0
  621. package/src/skills/science/references/artifact-science-tool.md +110 -0
  622. package/src/skills/science/references/claim-type-discipline.md +56 -0
  623. package/src/skills/science/references/domain-index.md +422 -0
  624. package/src/skills/science/references/hpc-via-bash-exec.md +42 -0
  625. package/src/skills/science/references/package-check-playbook.md +64 -0
  626. package/src/skills/science/references/package-index.min.json +3616 -0
  627. package/src/skills/science/references/packages/abinit.md +80 -0
  628. package/src/skills/science/references/packages/acts.md +73 -0
  629. package/src/skills/science/references/packages/aiida-core.md +80 -0
  630. package/src/skills/science/references/packages/alamode.md +80 -0
  631. package/src/skills/science/references/packages/amuse.md +88 -0
  632. package/src/skills/science/references/packages/anndata.md +88 -0
  633. package/src/skills/science/references/packages/arbor.md +80 -0
  634. package/src/skills/science/references/packages/arc.md +73 -0
  635. package/src/skills/science/references/packages/astropy.md +88 -0
  636. package/src/skills/science/references/packages/astroquery.md +88 -0
  637. package/src/skills/science/references/packages/atomate2.md +80 -0
  638. package/src/skills/science/references/packages/atomsmltr.md +73 -0
  639. package/src/skills/science/references/packages/awkward.md +73 -0
  640. package/src/skills/science/references/packages/batman.md +88 -0
  641. package/src/skills/science/references/packages/biopython.md +88 -0
  642. package/src/skills/science/references/packages/bloqade.md +73 -0
  643. package/src/skills/science/references/packages/brian2.md +73 -0
  644. package/src/skills/science/references/packages/bullet3.md +73 -0
  645. package/src/skills/science/references/packages/calculix.md +80 -0
  646. package/src/skills/science/references/packages/cantera.md +73 -0
  647. package/src/skills/science/references/packages/cavity-md-ipi.md +80 -0
  648. package/src/skills/science/references/packages/ccdproc.md +88 -0
  649. package/src/skills/science/references/packages/celerite2.md +88 -0
  650. package/src/skills/science/references/packages/cellrank.md +73 -0
  651. package/src/skills/science/references/packages/cesm.md +80 -0
  652. package/src/skills/science/references/packages/chemicals.md +73 -0
  653. package/src/skills/science/references/packages/chempy.md +73 -0
  654. package/src/skills/science/references/packages/cirq.md +73 -0
  655. package/src/skills/science/references/packages/coffea.md +73 -0
  656. package/src/skills/science/references/packages/cp2k.md +88 -0
  657. package/src/skills/science/references/packages/custodian.md +80 -0
  658. package/src/skills/science/references/packages/dart.md +73 -0
  659. package/src/skills/science/references/packages/datamol.md +88 -0
  660. package/src/skills/science/references/packages/dd4hep.md +73 -0
  661. package/src/skills/science/references/packages/dealii.md +80 -0
  662. package/src/skills/science/references/packages/deepchem.md +88 -0
  663. package/src/skills/science/references/packages/delphes.md +73 -0
  664. package/src/skills/science/references/packages/devito.md +80 -0
  665. package/src/skills/science/references/packages/dftb.md +88 -0
  666. package/src/skills/science/references/packages/dftd4.md +88 -0
  667. package/src/skills/science/references/packages/dftk-jl.md +80 -0
  668. package/src/skills/science/references/packages/dolfinx.md +80 -0
  669. package/src/skills/science/references/packages/drake.md +73 -0
  670. package/src/skills/science/references/packages/dumux.md +73 -0
  671. package/src/skills/science/references/packages/elk.md +80 -0
  672. package/src/skills/science/references/packages/elmerfem.md +80 -0
  673. package/src/skills/science/references/packages/enzo-e.md +88 -0
  674. package/src/skills/science/references/packages/espresso.md +80 -0
  675. package/src/skills/science/references/packages/exoplanet.md +88 -0
  676. package/src/skills/science/references/packages/fairroot.md +73 -0
  677. package/src/skills/science/references/packages/fbpic.md +80 -0
  678. package/src/skills/science/references/packages/fdtdbath-meep.md +80 -0
  679. package/src/skills/science/references/packages/geant4.md +73 -0
  680. package/src/skills/science/references/packages/geosx.md +80 -0
  681. package/src/skills/science/references/packages/gprmax.md +80 -0
  682. package/src/skills/science/references/packages/gromacs.md +80 -0
  683. package/src/skills/science/references/packages/gwaslab.md +73 -0
  684. package/src/skills/science/references/packages/gz-sim.md +73 -0
  685. package/src/skills/science/references/packages/hail.md +88 -0
  686. package/src/skills/science/references/packages/hiphive.md +80 -0
  687. package/src/skills/science/references/packages/hoomd-blue.md +80 -0
  688. package/src/skills/science/references/packages/itensor.md +73 -0
  689. package/src/skills/science/references/packages/itensors-jl.md +73 -0
  690. package/src/skills/science/references/packages/jdftx.md +73 -0
  691. package/src/skills/science/references/packages/jobflow.md +80 -0
  692. package/src/skills/science/references/packages/kadanoffbaym-jl.md +73 -0
  693. package/src/skills/science/references/packages/kite.md +80 -0
  694. package/src/skills/science/references/packages/kratos.md +80 -0
  695. package/src/skills/science/references/packages/kwant.md +73 -0
  696. package/src/skills/science/references/packages/lammps.md +80 -0
  697. package/src/skills/science/references/packages/lightkurve.md +88 -0
  698. package/src/skills/science/references/packages/limix.md +73 -0
  699. package/src/skills/science/references/packages/maxwelllink.md +80 -0
  700. package/src/skills/science/references/packages/mcdc.md +73 -0
  701. package/src/skills/science/references/packages/meep.md +80 -0
  702. package/src/skills/science/references/packages/mfem.md +80 -0
  703. package/src/skills/science/references/packages/mitgcm.md +73 -0
  704. package/src/skills/science/references/packages/modflow6.md +73 -0
  705. package/src/skills/science/references/packages/molecool.md +73 -0
  706. package/src/skills/science/references/packages/mom6.md +73 -0
  707. package/src/skills/science/references/packages/moose.md +80 -0
  708. package/src/skills/science/references/packages/mpas-model.md +73 -0
  709. package/src/skills/science/references/packages/mujoco.md +73 -0
  710. package/src/skills/science/references/packages/mumax3.md +73 -0
  711. package/src/skills/science/references/packages/nekrs.md +80 -0
  712. package/src/skills/science/references/packages/nessi.md +73 -0
  713. package/src/skills/science/references/packages/nest-simulator.md +73 -0
  714. package/src/skills/science/references/packages/netket.md +73 -0
  715. package/src/skills/science/references/packages/neuron.md +73 -0
  716. package/src/skills/science/references/packages/nextflow.md +88 -0
  717. package/src/skills/science/references/packages/nwchem.md +88 -0
  718. package/src/skills/science/references/packages/openbabel.md +88 -0
  719. package/src/skills/science/references/packages/openems.md +80 -0
  720. package/src/skills/science/references/packages/openff-toolkit.md +88 -0
  721. package/src/skills/science/references/packages/openfoam-dev.md +80 -0
  722. package/src/skills/science/references/packages/openmc.md +73 -0
  723. package/src/skills/science/references/packages/openmm.md +80 -0
  724. package/src/skills/science/references/packages/openmoc.md +73 -0
  725. package/src/skills/science/references/packages/openmx.md +80 -0
  726. package/src/skills/science/references/packages/opensees.md +80 -0
  727. package/src/skills/science/references/packages/opensn.md +80 -0
  728. package/src/skills/science/references/packages/opm-simulators.md +73 -0
  729. package/src/skills/science/references/packages/oqupy.md +73 -0
  730. package/src/skills/science/references/packages/packmol.md +80 -0
  731. package/src/skills/science/references/packages/palabos.md +80 -0
  732. package/src/skills/science/references/packages/parflow.md +80 -0
  733. package/src/skills/science/references/packages/pennylane.md +88 -0
  734. package/src/skills/science/references/packages/perceval.md +73 -0
  735. package/src/skills/science/references/packages/phono3py.md +73 -0
  736. package/src/skills/science/references/packages/phonopy.md +73 -0
  737. package/src/skills/science/references/packages/photutils.md +88 -0
  738. package/src/skills/science/references/packages/picongpu.md +80 -0
  739. package/src/skills/science/references/packages/plink-ng.md +88 -0
  740. package/src/skills/science/references/packages/precice.md +73 -0
  741. package/src/skills/science/references/packages/psc.md +80 -0
  742. package/src/skills/science/references/packages/psi4.md +88 -0
  743. package/src/skills/science/references/packages/pybinding.md +73 -0
  744. package/src/skills/science/references/packages/pyfr.md +80 -0
  745. package/src/skills/science/references/packages/pyhf.md +73 -0
  746. package/src/skills/science/references/packages/pyiron_base.md +80 -0
  747. package/src/skills/science/references/packages/pylcp.md +73 -0
  748. package/src/skills/science/references/packages/pylith.md +80 -0
  749. package/src/skills/science/references/packages/pynbody.md +88 -0
  750. package/src/skills/science/references/packages/pysam.md +88 -0
  751. package/src/skills/science/references/packages/pyscf.md +88 -0
  752. package/src/skills/science/references/packages/q-e.md +73 -0
  753. package/src/skills/science/references/packages/qibo.md +73 -0
  754. package/src/skills/science/references/packages/qiskit.md +73 -0
  755. package/src/skills/science/references/packages/quantica-jl.md +73 -0
  756. package/src/skills/science/references/packages/quantumoptics-jl.md +73 -0
  757. package/src/skills/science/references/packages/quimb.md +73 -0
  758. package/src/skills/science/references/packages/qulacs.md +73 -0
  759. package/src/skills/science/references/packages/qutip.md +73 -0
  760. package/src/skills/science/references/packages/rdkit.md +88 -0
  761. package/src/skills/science/references/packages/rmg-py.md +73 -0
  762. package/src/skills/science/references/packages/root.md +73 -0
  763. package/src/skills/science/references/packages/scanpy.md +88 -0
  764. package/src/skills/science/references/packages/scikit-allel.md +88 -0
  765. package/src/skills/science/references/packages/scikit-bio.md +88 -0
  766. package/src/skills/science/references/packages/scqubits.md +73 -0
  767. package/src/skills/science/references/packages/scuff-em.md +80 -0
  768. package/src/skills/science/references/packages/scvi-tools.md +73 -0
  769. package/src/skills/science/references/packages/seissol.md +73 -0
  770. package/src/skills/science/references/packages/sfepy.md +80 -0
  771. package/src/skills/science/references/packages/sisl.md +73 -0
  772. package/src/skills/science/references/packages/smilei.md +80 -0
  773. package/src/skills/science/references/packages/snakemake.md +88 -0
  774. package/src/skills/science/references/packages/specfem3d-globe.md +80 -0
  775. package/src/skills/science/references/packages/specutils.md +88 -0
  776. package/src/skills/science/references/packages/spglib.md +80 -0
  777. package/src/skills/science/references/packages/squidpy.md +88 -0
  778. package/src/skills/science/references/packages/starry.md +88 -0
  779. package/src/skills/science/references/packages/strawberryfields.md +73 -0
  780. package/src/skills/science/references/packages/su2.md +80 -0
  781. package/src/skills/science/references/packages/sunny-jl.md +73 -0
  782. package/src/skills/science/references/packages/sw4.md +73 -0
  783. package/src/skills/science/references/packages/swift.md +88 -0
  784. package/src/skills/science/references/packages/tdnegf.md +73 -0
  785. package/src/skills/science/references/packages/tenpy.md +73 -0
  786. package/src/skills/science/references/packages/thermo.md +73 -0
  787. package/src/skills/science/references/packages/tkwant.md +73 -0
  788. package/src/skills/science/references/packages/tvb-root.md +73 -0
  789. package/src/skills/science/references/packages/uproot5.md +73 -0
  790. package/src/skills/science/references/packages/vampire.md +80 -0
  791. package/src/skills/science/references/packages/wannier_tools.md +73 -0
  792. package/src/skills/science/references/packages/warpx.md +80 -0
  793. package/src/skills/science/references/packages/wrf.md +73 -0
  794. package/src/skills/science/references/packages/xtb.md +88 -0
  795. package/src/skills/science/references/packages/yt.md +73 -0
  796. package/src/skills/science/references/science-task-brief-template.md +71 -0
  797. package/src/skills/scout/SKILL.md +83 -425
  798. package/src/skills/scout/references/literature-scout-template.md +5 -24
  799. package/src/skills/scout/references/operational-guidance.md +191 -0
  800. package/src/skills/scout/references/paper-triage-playbook.md +11 -35
  801. package/src/skills/write/SKILL.md +744 -1246
  802. package/src/skills/write/references/experiments_analysis_patterns.md +129 -0
  803. package/src/skills/write/references/oral_package_patterns.md +252 -0
  804. package/src/skills/write/references/oral_writing_principles.md +291 -0
  805. package/src/skills/write/references/section_rewrite_checklist.md +234 -0
  806. package/src/tui/dist/app/AppContainer.js +1314 -27
  807. package/src/tui/dist/components/Composer.js +26 -1
  808. package/src/tui/dist/components/ConfigScreen.js +2 -1
  809. package/src/tui/dist/components/InputPrompt.js +25 -9
  810. package/src/tui/dist/components/MainContent.js +18 -3
  811. package/src/tui/dist/components/QuestScreen.js +3 -2
  812. package/src/tui/dist/components/UtilityScreen.js +37 -0
  813. package/src/tui/dist/hooks/useSafeInput.js +10 -0
  814. package/src/tui/dist/index.js +13 -1
  815. package/src/tui/dist/layouts/DefaultAppLayout.js +11 -8
  816. package/src/tui/dist/lib/api.js +89 -1
  817. package/src/tui/package.json +1 -1
  818. package/src/ui/dist/assets/{AnalysisPlugin-BCKAfjba.js → AnalysisPlugin-CA94NGmI.js} +1 -1
  819. package/src/ui/dist/assets/CliPlugin-DHBzphZU.js +79 -0
  820. package/src/ui/dist/assets/CodeEditorPlugin-BOFwD2rn.js +2 -0
  821. package/src/ui/dist/assets/{CodeViewerPlugin-CbaFRrUU.js → CodeViewerPlugin-CqDpgjik.js} +4 -4
  822. package/src/ui/dist/assets/{DocViewerPlugin-DAjLVeQD.js → DocViewerPlugin-UDBgt8-4.js} +3 -3
  823. package/src/ui/dist/assets/GitCommitViewerPlugin-BmHtZ0bZ.js +6 -0
  824. package/src/ui/dist/assets/{GitDiffViewerPlugin-CQACjoAA.js → GitDiffViewerPlugin-CAxjNorQ.js} +2 -2
  825. package/src/ui/dist/assets/{GitSnapshotViewer-0r4nLPke.js → GitSnapshotViewer-CweA6VON.js} +2 -2
  826. package/src/ui/dist/assets/{ImageViewerPlugin-nBOmI2v_.js → ImageViewerPlugin-C8wHGvGN.js} +5 -5
  827. package/src/ui/dist/assets/LabPlugin-COyyLUol.js +32 -0
  828. package/src/ui/dist/assets/{LatexPlugin-ZwtV8pIp.js → LatexPlugin-BQjAaA5J.js} +4 -4
  829. package/src/ui/dist/assets/{MarkdownViewerPlugin-DKqVfKyW.js → MarkdownViewerPlugin-Dy1NE2dI.js} +3 -3
  830. package/src/ui/dist/assets/{MarketplacePlugin-BwxStZ9D.js → MarketplacePlugin-DMIZtEJ2.js} +2 -2
  831. package/src/ui/dist/assets/NotebookEditor-CFHMq_Qt.js +91 -0
  832. package/src/ui/dist/assets/{NotebookEditor-DB9N_T9q.js → NotebookEditor-WFyd8Ybt.js} +3 -3
  833. package/src/ui/dist/assets/{PdfLoader-eWBONbQP.js → PdfLoader-CLE5u5TS.js} +3 -3
  834. package/src/ui/dist/assets/{PdfMarkdownPlugin-D22YOZL3.js → PdfMarkdownPlugin-_iNK_H83.js} +1 -1
  835. package/src/ui/dist/assets/PdfViewerPlugin-DgWsbInT.js +22 -0
  836. package/src/ui/dist/assets/SearchPlugin-DrZmn5iw.js +11 -0
  837. package/src/ui/dist/assets/{TextViewerPlugin-C5xqeeUH.js → TextViewerPlugin-D1-T3aC7.js} +4 -4
  838. package/src/ui/dist/assets/branding/runner-claude.svg +107 -0
  839. package/src/ui/dist/assets/branding/runner-codex.svg +10 -0
  840. package/src/ui/dist/assets/branding/runner-kimi.svg +14 -0
  841. package/src/ui/dist/assets/branding/runner-opencode.svg +7 -0
  842. package/src/ui/dist/assets/cli-store-CoZ-x5Ip.js +1 -0
  843. package/src/ui/dist/assets/{code-WlFHE7z_.js → code-DbsmSd3Y.js} +1 -1
  844. package/src/ui/dist/assets/file-diff-panel-DsvyRz47.js +1 -0
  845. package/src/ui/dist/assets/{wrap-text-BC-Hltpd.js → file-jump-queue-DeQBikaw.js} +3 -3
  846. package/src/ui/dist/assets/{file-socket-CfQPKQKj.js → file-socket-DA5XIx88.js} +1 -1
  847. package/src/ui/dist/assets/fonts/ds-fonts.css +50 -4
  848. package/src/ui/dist/assets/images/deepxiv/register-guide.png +0 -0
  849. package/src/ui/dist/assets/index-39vY9LmZ.js +1 -0
  850. package/src/ui/dist/assets/{index-CwNu1aH4.js → index-BsO46tJA.js} +1 -1
  851. package/src/ui/dist/assets/index-CHzJ2xtB.js +3530 -0
  852. package/src/ui/dist/assets/index-DH-zxoZ3.css +33 -0
  853. package/src/ui/dist/assets/{plugin-notebook-HbW2K-1c.js → plugin-notebook-JRhysCqj.js} +2 -2
  854. package/src/ui/dist/assets/{project-sync-C9IdzdZW.js → project-sync-DPmWKmKD.js} +1 -1
  855. package/src/ui/dist/assets/{zoom-out-E_gaeAxL.js → zoom-out-DAukFWen.js} +3 -3
  856. package/src/ui/dist/index.html +3 -3
  857. package/src/skills/analysis-campaign/references/artifact-orchestration.md +0 -58
  858. package/src/skills/baseline/references/memory-playbook.md +0 -40
  859. package/src/skills/baseline/references/publishable-baseline-package.md +0 -30
  860. package/src/skills/write/references/outline-evidence-contract-example.md +0 -107
  861. package/src/skills/write/references/paper-experiment-matrix-template.md +0 -131
  862. package/src/skills/write/references/paper-section-playbook.md +0 -64
  863. package/src/skills/write/references/reviewer-first-writing.md +0 -64
  864. package/src/skills/write/references/revision-checklist.md +0 -70
  865. package/src/skills/write/references/section-contracts.md +0 -82
  866. package/src/skills/write/references/sentence-level-proofing.md +0 -49
  867. package/src/ui/dist/assets/AiManusChatView-Bv-Z8YpU.js +0 -204
  868. package/src/ui/dist/assets/CliPlugin-BCKcpc35.js +0 -109
  869. package/src/ui/dist/assets/CodeEditorPlugin-DbOfSJ8K.js +0 -2
  870. package/src/ui/dist/assets/GitCommitViewerPlugin-CIUqbUDO.js +0 -1
  871. package/src/ui/dist/assets/LabCopilotPanel-BHxOxF4z.js +0 -14
  872. package/src/ui/dist/assets/LabPlugin-BKoZGs95.js +0 -22
  873. package/src/ui/dist/assets/NotebookEditor-BEQhaQbt.js +0 -81
  874. package/src/ui/dist/assets/PdfViewerPlugin-c-RK9DLM.js +0 -17
  875. package/src/ui/dist/assets/SearchPlugin-CxF9ytAx.js +0 -16
  876. package/src/ui/dist/assets/VNCViewer-BoLGLnHz.js +0 -11
  877. package/src/ui/dist/assets/bot-DREQOxzP.js +0 -6
  878. package/src/ui/dist/assets/chevron-up-C9Qpx4DE.js +0 -6
  879. package/src/ui/dist/assets/file-content-BZMz3RYp.js +0 -1
  880. package/src/ui/dist/assets/file-diff-panel-CQhw0jS2.js +0 -1
  881. package/src/ui/dist/assets/file-jump-queue-DA-SdG__.js +0 -1
  882. package/src/ui/dist/assets/git-commit-horizontal-DxZ8DCZh.js +0 -6
  883. package/src/ui/dist/assets/image-Bgl4VIyx.js +0 -6
  884. package/src/ui/dist/assets/index-BpV6lusQ.css +0 -33
  885. package/src/ui/dist/assets/index-CBNVuWcP.js +0 -2496
  886. package/src/ui/dist/assets/index-DrUnlf6K.js +0 -1
  887. package/src/ui/dist/assets/index-NW-h8VzN.js +0 -1
  888. package/src/ui/dist/assets/pdf-effect-queue-J8OnM0jE.js +0 -6
  889. package/src/ui/dist/assets/popover-CLc0pPP8.js +0 -1
  890. package/src/ui/dist/assets/select-Cs2PmzwL.js +0 -11
  891. package/src/ui/dist/assets/sigma-ClKcHAXm.js +0 -6
  892. package/src/ui/dist/assets/trash-DwpbFr3w.js +0 -11
  893. package/src/ui/dist/assets/useCliAccess-NQ8m0Let.js +0 -1
  894. package/src/ui/dist/assets/useFileDiffOverlay-FuhcnKiw.js +0 -1
@@ -1,6 +1,6 @@
1
- import{j as L,_ as he,ca as ce}from"./index-CBNVuWcP.js";import{r as z,R as st}from"./plugin-monaco-C8UgLomw.js";import{a as ue,g as pe}from"./plugin-terminal-MXFIPun8.js";import{r as dt}from"./plugin-notebook-HbW2K-1c.js";import{p as de,_ as fe,a as ge}from"./plugin-pdf-CR8hgQBV.js";const an={A4_WIDTH:595},ln=[.5,.75,1,1.25,1.5,2],me=de,ve=void 0,be=!1;function Mt(i,t){let e;return(...n)=>{e&&clearTimeout(e),e=setTimeout(()=>i(...n),t)}}const Dt=(i,{width:t,height:e})=>({x1:i.left,y1:i.top,x2:i.left+i.width,y2:i.top+i.height,width:t,height:e,pageNumber:i.pageNumber}),we=(i,t)=>{const[e,n,o,r]=t.convertToViewportRectangle([i.x1,i.y1,i.x2,i.y2]);return{left:Math.min(e,o),top:Math.min(n,r),width:Math.abs(o-e),height:Math.abs(n-r),pageNumber:i.pageNumber}},bt=(i,t,e=!1)=>{const{width:n,height:o}=t;if(e)return we(i,t);if(i.x1===void 0)throw new Error("You are using old position format, please update");const r=n*i.x1/i.width,s=o*i.y1/i.height,a=n*i.x2/i.width,h=o*i.y2/i.height;return{left:r,top:s,width:a-r,height:h-s,pageNumber:i.pageNumber}},jt=i=>i.ownerDocument||document,rt=i=>jt(i).defaultView||window,Z=i=>i!=null&&(i instanceof HTMLElement||i instanceof rt(i).HTMLElement),ye=i=>i instanceof HTMLCanvasElement||i instanceof rt(i).HTMLCanvasElement,pt=i=>{const t=i.closest(".page");if(!Z(t))return null;const e=Number(t.dataset.pageNumber);return{node:t,number:e}},Et=i=>{const t=i.startContainer.parentElement,e=i.endContainer.parentElement;if(!Z(t)||!Z(e))return[];const n=pt(t),o=pt(e);if(!n?.number||!o?.number)return[];if(n.number===o.number)return[n];if(n.number===o.number-1)return[n,o];const r=[];let s=n.number;const a=n.node.ownerDocument;for(;s<=o.number;){const h=pt(a.querySelector(`[data-page-number='${s}'`));h&&r.push(h),s++}return r},Se=(i,t,e)=>{const n=jt(i);let o=i.querySelector(e);return o||(o=n.createElement("div"),o.className=t,i.appendChild(o)),o},xe=(i,t)=>{const{left:e,top:n,width:o,height:r}=t,a=(i?i.ownerDocument:null)?.createElement("canvas");if(!a||!ye(a))return"";a.width=o,a.height=r;const h=a.getContext("2d");if(!h||!i)return"";const l=window.devicePixelRatio;return h.drawImage(i,e*l,n*l,o*l,r*l,0,0,o,r),a.toDataURL("image/png")},Ht=i=>{const t=Array.from(i).map(u=>{const{left:g,top:w,width:b,height:y,pageNumber:S}=u,P=g,x=g+b,f=w,p=w+y;return{X0:P,X1:x,Y0:f,Y1:p,pageNumber:S}});let e=Number.MAX_SAFE_INTEGER;for(const u of t)e=Math.min(e,u.pageNumber??e);const n=t.filter(u=>(u.X0>0||u.X1>0||u.Y0>0||u.Y1>0)&&u.pageNumber===e),o=n.reduce((u,g)=>({X0:Math.min(u.X0,g.X0),X1:Math.max(u.X1,g.X1),Y0:Math.min(u.Y0,g.Y0),Y1:Math.max(u.Y1,g.Y1),pageNumber:e}),n[0]),{X0:r,X1:s,Y0:a,Y1:h,pageNumber:l}=o;return{left:r,top:a,width:s-r,height:h-a,pageNumber:l}},Pe=i=>i.sort((t,e)=>{const n=(t.pageNumber||0)*t.top-(e.pageNumber||0)*e.top;return n===0?t.left-e.left:n}),Re=(i,t)=>i.pageNumber===t.pageNumber&&i.left<=t.left&&t.left<=i.left+i.width,ze=(i,t,e=5)=>i.pageNumber===t.pageNumber&&Math.abs(i.top-t.top)<e&&Math.abs(i.height-t.height)<e,De=(i,t)=>i.pageNumber===t.pageNumber&&i.top>t.top&&i.left>t.left&&i.top+i.height<t.top+t.height&&i.left+i.width<t.left+t.width,Te=(i,t,e=10)=>{const n=i.left+i.width,o=t.left+t.width;return i.pageNumber===t.pageNumber&&i.left<=t.left&&n<=o&&t.left-n<=e},Lt=(i,t)=>{i.width=Math.max(t.width-i.left+t.left,i.width)},_e=i=>{const t=Pe(i),e=new Set,n=t.filter(r=>t.every(s=>!De(r,s)));let o=0;for(;o<=2;){for(const r of n)for(const s of n)r===s||e.has(r)||e.has(s)||ze(r,s)&&(Re(r,s)&&(Lt(r,s),r.height=Math.max(r.height,s.height),e.add(s)),Te(r,s)&&(Lt(r,s),e.add(s)));o+=1}return n.filter(r=>!e.has(r))},Ne=(i,t)=>!(i.top<t.top||i.bottom>t.bottom||i.right>t.right||i.left<t.left),Wt=(i,t,e=!0)=>{const n=Array.from(i.getClientRects()),o=[];for(const r of n)for(const s of t){const a=s.node.getBoundingClientRect();if(Ne(r,a)&&r.width>0&&r.height>0&&r.width<a.width&&r.height<a.height){const h={top:r.top+s.node.scrollTop-a.top,left:r.left+s.node.scrollLeft-a.left,width:r.width,height:r.height,pageNumber:s.number};o.push(h)}}return e?_e(o):o},Ce="_container_1vvir_1",Me="_highlightLayer_1vvir_8",Ee="_disableSelection_1vvir_20",wt={container:Ce,highlightLayer:Me,disableSelection:Ee},Ot=10,yt=12,It=8,He=14,Le=17,We=62,Oe=22;function St(i,t,e){return Math.min(Math.max(i,t),e)}function $t(i){return String(i||"").normalize("NFKC").replace(/\uFFFD/g," ").replace(/\s+/g," ").trim()}function Ie(i,t){const e=i.position?.rects?.[0]||i.position?.boundingRect||null;if(!e)return 0;const n=Number(e.top||0),o=Number(e.height||0);return Number.isFinite(n)?Number.isFinite(o)?Math.max(0,n+o*.5-t*.5):Math.max(0,n):0}function Ae(i,t){const e=$t(i);if(!e)return"";const n=e.split(/\s+/).filter(Boolean);return n.length<=t?n.join(" "):`${n.slice(0,t).join(" ")} …`}function Fe(i){const t=i.previewSummary;if(typeof t=="string"&&t.trim())return $t(t);const e=typeof i.comment?.text=="string"?i.comment.text:"";return Ae(e,8)}function Ve(i,t){const e=Fe(i),n=e.length>0,o=Math.max(120,t-Oe),s=Math.max(14,Math.floor(o/6.1)),a=n?Math.max(1,Math.ceil(e.length/s)):0,h=14,l=n?4:0,u=h+He+l+a*Le;return Math.max(We,Math.ceil(u))}function Be(i,t,e){const n=Number.isFinite(t)&&t>0?t:0,o=Number.isFinite(e)&&e>0?e:0,r=Math.max(140,n-yt*2),s=St(n*.34,190,320),a=Math.min(r,s),h=Math.max(yt,n-a-yt),l=i.filter(c=>!c.content?.image).filter(c=>!c.__dsGhost).map(c=>{const m=c,v=Ve(m,a);return{id:String(c.id),cardHeightPx:v,anchorTop:Ie(m,v)}}).sort((c,m)=>c.anchorTop===m.anchorTop?c.id.localeCompare(m.id):c.anchorTop-m.anchorTop),u={};if(l.length===0)return{hintTopById:u,hintLeftPx:h,hintWidthPx:a};const g=It,w=Math.max(g,o-It),b=Math.max(0,w-g),y=l.reduce((c,m)=>c+m.cardHeightPx,0);let S=Ot;if(l.length>1){const c=Math.floor((b-y)/(l.length-1));Number.isFinite(c)&&(S=Math.max(0,Math.min(Ot,c)))}else S=0;const P=new Array(l.length).fill(0);for(let c=l.length-1;c>=0;c-=1){const m=c+1<l.length?P[c+1]:0;P[c]=l[c].cardHeightPx+m}const x=[];let f=g;for(let c=0;c<l.length;c+=1){const m=l[c],v=l.length-c-1,R=P[c]+Math.max(0,v)*Math.max(0,S),_=Math.max(g,w-R),D=St(m.anchorTop,g,_),N=Math.max(D,f);x.push({id:m.id,top:N,cardHeightPx:m.cardHeightPx}),f=N+m.cardHeightPx+S}const p=x[x.length-1],d=p?p.top+p.cardHeightPx:g;if(d>w){const c=d-w;for(let m=0;m<x.length;m+=1)x[m].top=Math.max(g,x[m].top-c)}for(let c=1;c<x.length;c+=1){const m=x[c-1],v=x[c],R=m.top+m.cardHeightPx+S;v.top<R&&(v.top=R)}for(const c of x){const m=Math.max(g,w-c.cardHeightPx);u[c.id]=Math.round(St(c.top,g,m))}return{hintTopById:u,hintLeftPx:h,hintWidthPx:a}}function ke({highlightsByPage:i,scaledPositionToViewport:t,pageNumber:e,scrolledToHighlightId:n,highlightTransform:o,tip:r,hideTipAndSelection:s,viewer:a,screenshot:h,showTip:l,setTip:u}){const g=i[String(e)]||[],w=Number.parseInt(e,10),b=a.getPageView(w-1),y=b?.div?.offsetWidth||b?.div?.getBoundingClientRect().width||b?.viewport?.width||0,S=b?.div?.offsetHeight||b?.div?.getBoundingClientRect().height||b?.viewport?.height||0,P=g.map(f=>({...f,position:t(f.position)})),x=Be(P,y,S);return L.jsx("div",{children:P.map((f,p)=>{const d=f;r&&r.highlight.id===String(d.id)&&l(f,r.callback(f));const c=n===d.id;return o(f,p,(m,v)=>{u({highlight:m,callback:v}),l(m,v(m))},s,m=>{const v=a.getPageView((m.pageNumber||Number.parseInt(e))-1).viewport;return Dt(m,v)},m=>h(m,Number.parseInt(e)),c,{width:y,height:S,pageNumber:w,overlayHintTopById:x.hintTopById,overlayHintLeftPx:x.hintLeftPx,overlayHintWidthPx:x.hintWidthPx})})})}const Xe="_mouseSelection_1p43j_1",Ye={mouseSelection:Xe},At=(i,t)=>({left:Math.min(t.x,i.x),top:Math.min(t.y,i.y),width:Math.abs(t.x-i.x),height:Math.abs(t.y-i.y)}),Ue=i=>i.width>=1&&i.height>=1;function Ge({onSelection:i,onDragStart:t,onDragEnd:e,shouldStart:n,onChange:o}){const[r,s]=z.useState(!1),[a,h]=z.useState(null),[l,u]=z.useState(null),g=z.useRef(null),w=z.useRef(a),b=z.useRef(r);z.useEffect(()=>{w.current=a},[a]),z.useEffect(()=>{b.current=r},[r]);const y=z.useCallback(()=>{e(),h(null),u(null),s(!1)},[e]);return z.useEffect(()=>{o(!!(a&&l))},[a,l,o]),z.useEffect(()=>{const S=g.current;if(!S)return;const P=S.parentElement;if(!P||!Z(P))return;const x=(d,c)=>{const m=P.getBoundingClientRect();return{x:d-m.left+P.scrollLeft,y:c-m.top+P.scrollTop-window.scrollY}},f=d=>{!w.current||b.current||u(x(d.pageX,d.pageY))},p=d=>{if(!n(d)){y();return}const c=d.target;if(!(c instanceof Element)||!Z(c))return;t(),h(x(d.pageX,d.pageY)),u(null),s(!1);const m=R=>{R.currentTarget?.removeEventListener("mouseup",m);const _=w.current;if(!_||!(R instanceof MouseEvent))return;const D=x(R.pageX,R.pageY),N=At(_,D);if(!(R.target instanceof Element)||!Z(R.target)||!P.contains(R.target)||!Ue(N)){y();return}u(D),s(!0),i(c,N,y),e()},v=P.ownerDocument;v?.body&&v.body.addEventListener("mouseup",m)};return P.addEventListener("mousemove",f),P.addEventListener("mousedown",p),()=>{P.removeEventListener("mousemove",f),P.removeEventListener("mousedown",p)}},[n,t,e,i,y]),L.jsx("div",{ref:g,children:a&&l&&L.jsx("div",{className:Ye.mouseSelection,style:At(a,l)})})}const je="_tipContainer_f56kr_1",$e={tipContainer:je};function nt(i,t,e){return Math.min(Math.max(i,t),e)}function qe({children:i,style:t,scrollTop:e,pageBoundingRect:n,pageOffset:o,tipPlacementMode:r="auto"}){const[s,a]=z.useState(0),[h,l]=z.useState(0),u=z.useRef(null),g=z.useCallback(()=>{if(!u.current)return;const{offsetHeight:M,offsetWidth:$}=u.current;a(M),l($)},[]);z.useEffect(()=>{setTimeout(g,0)},[g]),z.useEffect(()=>{if(!u.current||typeof ResizeObserver>"u")return;const M=new ResizeObserver(()=>{g()});return M.observe(u.current),()=>M.disconnect()},[g]);const w=h===0&&s===0,b=12,y=o.left,S=o.top,P=y+b,x=y+n.width-h-b,f=S+b,p=S+n.height-s-b,d=(t.selectionLeft+t.selectionRight)/2,c=y+n.width-t.selectionRight-b,m=t.selectionLeft-y-b;let v=nt(d-h/2,P,x),R=nt(t.selectionTop,f,p);const _=c>=h,D=m>=h,N=r==="overlay",T=r==="right",O=t.selectionTop-s-b<e;if(T){v=x;const M=t.selectionTop+(t.selectionBottom-t.selectionTop)/2-s/2;R=nt(M,f,p)}else!N&&_?v=t.selectionRight+b:!N&&D?v=t.selectionLeft-h-b:(R=O?t.selectionBottom+b:t.selectionTop-s-b,R=nt(R,f,p),v=nt(d-h/2,P,x));const B=z.useCallback(()=>{l(0),a(0),setTimeout(g,0)},[g]),Y=st.Children.map(i,M=>M!=null?st.cloneElement(M,{onUpdate:B,popup:{position:O?"below":"above"}}):null);return L.jsx("div",{id:"PdfHighlighter__tip-container",className:$e.tipContainer,style:{visibility:w?"hidden":"visible",top:R,left:v},ref:u,children:Y})}const Ft="empty-id",Ke="__ds_ghost__";class hn extends z.PureComponent{static defaultProps={pdfScaleValue:"auto"};state={ghostHighlight:null,isCollapsed:!0,range:null,scrolledToHighlightId:Ft,isAreaSelectionInProgress:!1,tip:null,tipPosition:null,tipChildren:null,pinnedTipHighlightId:null};viewer;resizeObserver=null;containerNode=null;containerNodeRef;highlightRoots={};highlightRootByContainer=new WeakMap;unsubscribe=()=>{};selectionRafId=null;scrollPageIntoViewPatched=!1;scrollMatchIntoViewPatched=!1;constructor(t){super(t),typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(this.debouncedScaleValue)),this.containerNodeRef=st.createRef()}componentDidMount(){this.init()}onPageChanging=t=>{const e=t?.pageNumber;typeof e=="number"&&this.props.onPageChange?.(e)};attachRef=t=>{const{resizeObserver:e}=this;if(this.containerNode=this.containerNodeRef.current,this.unsubscribe(),this.containerNode){const{ownerDocument:n}=this.containerNode;t.on("textlayerrendered",this.onTextLayerRendered),t.on("pagesinit",this.onDocumentReady),t.on("pagechanging",this.onPageChanging),n.addEventListener("selectionchange",this.onSelectionChange),n.addEventListener("keydown",this.handleKeyDown),n.defaultView?.addEventListener("resize",this.debouncedScaleValue),e&&e.observe(this.containerNode),this.unsubscribe=()=>{t.off("pagesinit",this.onDocumentReady),t.off("textlayerrendered",this.onTextLayerRendered),t.off("pagechanging",this.onPageChanging),n.removeEventListener("selectionchange",this.onSelectionChange),n.removeEventListener("keydown",this.handleKeyDown),n.defaultView?.removeEventListener("resize",this.debouncedScaleValue),e&&e.disconnect()}}};componentDidUpdate(t){if(t.pdfDocument!==this.props.pdfDocument){this.init();return}if(t.pdfScaleValue!==this.props.pdfScaleValue&&this.handleScaleValue(),t.highlights!==this.props.highlights){this.renderHighlightLayers();const e=this.state.pinnedTipHighlightId;if(e){const n=this.state.tip&&String(this.state.tip.highlight.id)===e?this.state.tip.callback:void 0;this.setPinnedTipForHighlight(e,n)}}}findViewportHighlightById(t){const e=this.props.highlights.find(n=>String(n.id)===String(t));return e?{...e,position:this.scaledPositionToViewport(e.position)}:null}setPinnedTipForHighlight=(t,e)=>{if(!t){this.setState({pinnedTipHighlightId:null,tip:null,tipPosition:null,tipChildren:null},()=>this.renderHighlightLayers());return}const n=this.findViewportHighlightById(t);if(!n){this.setState({pinnedTipHighlightId:null,tip:null,tipPosition:null,tipChildren:null},()=>this.renderHighlightLayers());return}const o=e||(this.state.tip&&String(this.state.tip.highlight.id)===String(t)?this.state.tip.callback:void 0);o&&this.setState({pinnedTipHighlightId:String(t),tip:{highlight:n,callback:o}},()=>{this.setTip(n.position,o(n)),this.renderHighlightLayers()})};async init(){const{pdfDocument:t,pdfViewerOptions:e}=this.props,n=await he(()=>import("./plugin-pdf-CR8hgQBV.js").then(s=>s.b),[]),o=new n.EventBus,r=new n.PDFLinkService({eventBus:o,externalLinkTarget:2});this.containerNodeRef.current&&(this.viewer=this.viewer||new n.PDFViewer({container:this.containerNodeRef.current,eventBus:o,textLayerMode:2,removePageBorders:!0,linkService:r,...e}),this.patchScrollPageIntoView(),this.patchScrollMatchIntoView(n),r.setDocument(t),r.setViewer(this.viewer),this.viewer.setDocument(t),this.attachRef(o))}patchScrollPageIntoView(){if(this.scrollPageIntoViewPatched||!this.viewer)return;const t=this.viewer.scrollPageIntoView.bind(this.viewer);this.viewer.scrollPageIntoView=e=>{if(!this.isViewerScrollable())return;const n=e?.pageNumber;if(typeof n=="number"){const o=this.viewer.getPageView(n-1);if(!o?.div||!o.div.offsetParent)return}t(e)},this.scrollPageIntoViewPatched=!0}patchScrollMatchIntoView(t){if(this.scrollMatchIntoViewPatched)return;const e=t?.PDFFindController?.prototype;if(!e||typeof e.scrollMatchIntoView!="function")return;const n=e.scrollMatchIntoView;e.scrollMatchIntoView=function(o={}){const r=o.element;if(!(!r||!r.isConnected||!r.offsetParent))return n.call(this,o)},this.scrollMatchIntoViewPatched=!0}componentWillUnmount(){Object.values(this.highlightRoots).forEach(t=>{try{t.reactRoot.unmount()}catch{}}),this.highlightRoots={},this.highlightRootByContainer=new WeakMap,this.unsubscribe()}findOrCreateHighlightLayer(t){if(!this.viewer)return null;const{textLayer:e}=this.viewer.getPageView(t-1)||{};return e?Se(e.div,`PdfHighlighter__highlight-layer ${wt.highlightLayer}`,".PdfHighlighter__highlight-layer"):null}groupHighlightsByPage(t){const{ghostHighlight:e}=this.state,n=[...t,e].filter(Boolean),o=new Set;for(const s of n){o.add(s.position.pageNumber);for(const a of s.position.rects)a.pageNumber&&o.add(a.pageNumber)}const r={};for(const s of o){r[s]=r[s]||[];for(const a of n){const h={...a,position:{pageNumber:s,boundingRect:a.position.boundingRect,rects:[],usePdfCoordinates:a.position.usePdfCoordinates}};let l=!1;for(const u of a.position.rects)s===(u.pageNumber||a.position.pageNumber)&&(h.position.rects.push(u),l=!0);(l||s===a.position.pageNumber)&&r[s].push(h)}}return r}showTip(t,e){const{isCollapsed:n,ghostHighlight:o,isAreaSelectionInProgress:r,pinnedTipHighlightId:s}=this.state;s&&String(t.id)!==String(s)||!n||o||r||this.setTip(t.position,e)}scaledPositionToViewport({pageNumber:t,boundingRect:e,rects:n,usePdfCoordinates:o}){const r=this.viewer.getPageView(t-1).viewport;return{boundingRect:bt(e,r,o),rects:(n||[]).map(s=>bt(s,r,o)),pageNumber:t}}viewportPositionToScaled({pageNumber:t,boundingRect:e,rects:n}){const o=this.viewer.getPageView(t-1).viewport;return{boundingRect:Dt(e,o),rects:(n||[]).map(r=>Dt(r,o)),pageNumber:t}}screenshot(t,e){const n=this.viewer.getPageView(e-1).canvas;return xe(n,t)}hideTipAndSelection=()=>{if(this.state.pinnedTipHighlightId)return;this.selectionRafId!=null&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null);const t=this.containerNode;t&&rt(t).getSelection()?.removeAllRanges(),this.setState({tipPosition:null,tipChildren:null,ghostHighlight:null,tip:null,range:null,isCollapsed:!0},()=>this.renderHighlightLayers())};buildGhostHighlight(t,e){return{__dsGhost:!0,id:Ke,position:t,content:e?{text:e}:void 0,comment:{text:"",emoji:"note"}}}scheduleGhostHighlightUpdate(t){this.selectionRafId!=null&&cancelAnimationFrame(this.selectionRafId),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{isAreaSelectionInProgress:e}=this.state;if(e)return;const n=Et(t);if(!n||n.length===0)return;const o=Wt(t,n);if(o.length===0)return;const s={boundingRect:Ht(o),rects:o,pageNumber:n[0].number},a=this.viewportPositionToScaled(s),h=this.buildGhostHighlight(a,t.toString());this.setState({ghostHighlight:h},()=>this.renderHighlightLayers())})}setTip(t,e){this.setState({tipPosition:t,tipChildren:e})}renderTip=()=>{const{tipPosition:t,tipChildren:e}=this.state;if(!t)return null;const{boundingRect:n,pageNumber:o}=t,r={node:this.viewer.getPageView((n.pageNumber||o)-1).div,pageNumber:n.pageNumber||o},s=r.node.getBoundingClientRect(),a={bottom:s.bottom,height:s.height,left:s.left,right:s.right,top:s.top,width:s.width,x:s.x,y:s.y,pageNumber:r.pageNumber},h=r.node.offsetLeft+n.left,l=h+n.width,u=n.top+r.node.offsetTop,g=u+n.height;return L.jsx(qe,{scrollTop:this.viewer.container.scrollTop,pageBoundingRect:a,pageOffset:{left:r.node.offsetLeft,top:r.node.offsetTop},tipPlacementMode:this.props.tipPlacementMode,style:{selectionLeft:h,selectionRight:l,selectionTop:u,selectionBottom:g},children:e})};onTextLayerRendered=()=>{this.renderHighlightLayers()};isViewerScrollable=()=>{const t=this.viewer?.container;return!t||!t.isConnected?!1:!!t.offsetParent};scrollTo=t=>{const{pageNumber:e,boundingRect:n,usePdfCoordinates:o}=t.position;if(!this.isViewerScrollable()){this.setState({scrolledToHighlightId:t.id},()=>this.renderHighlightLayers());return}const r=this.viewer.getPageView(e-1);if(!r?.div||!r.div.offsetParent)return;this.viewer.container.removeEventListener("scroll",this.onScroll);const s=r.viewport;this.viewer.scrollPageIntoView({pageNumber:e,destArray:[null,{name:"XYZ"},...s.convertToPdfPoint(0,bt(n,s,o).top-10),0]}),this.setState({scrolledToHighlightId:t.id},()=>this.renderHighlightLayers()),setTimeout(()=>{this.viewer.container.addEventListener("scroll",this.onScroll)},100)};scrollToPage=t=>{this.viewer&&this.isViewerScrollable()&&(this.viewer.currentPageNumber=t)};onDocumentReady=()=>{const{scrollRef:t}=this.props;this.handleScaleValue(),t(this.scrollTo),this.props.onPageChange?.(this.viewer.currentPageNumber||1)};onSelectionChange=()=>{const t=this.containerNode;if(!t)return;const e=rt(t).getSelection();if(!e)return;const n=e.rangeCount>0?e.getRangeAt(0):null;if(e.isCollapsed){this.setState({isCollapsed:!0,range:null,ghostHighlight:null},()=>this.renderHighlightLayers());return}if(!n||!t||!t.contains(n.commonAncestorContainer))return;const o=n.cloneRange();this.setState({isCollapsed:!1,range:o}),this.scheduleGhostHighlightUpdate(o),this.debouncedAfterSelection()};onScroll=()=>{const{onScrollChange:t}=this.props;t(),this.setState({scrolledToHighlightId:Ft},()=>this.renderHighlightLayers()),this.viewer.container.removeEventListener("scroll",this.onScroll)};onMouseDown=t=>{this.state.pinnedTipHighlightId||!(t.target instanceof Element)||!Z(t.target)||t.target.closest("#PdfHighlighter__tip-container")||this.hideTipAndSelection()};handleKeyDown=t=>{this.state.pinnedTipHighlightId||t.code==="Escape"&&this.hideTipAndSelection()};afterSelection=()=>{const{onSelectionFinished:t}=this.props,e=this.containerNode;if(!e)return;const n=rt(e).getSelection(),o=n&&n.rangeCount>0?n.getRangeAt(0):null,{isCollapsed:r}=this.state;if(!o||r||n?.isCollapsed)return;const s=o.cloneRange(),a=Et(s);if(!a||a.length===0)return;const h=Wt(s,a);if(h.length===0)return;const u={boundingRect:Ht(h),rects:h,pageNumber:a[0].number},g={text:s.toString()},w=this.viewportPositionToScaled(u);this.setTip(u,t(w,g,()=>this.hideTipAndSelection(),()=>this.setState({ghostHighlight:this.buildGhostHighlight(w,g.text)},()=>this.renderHighlightLayers())))};debouncedAfterSelection=Mt(this.afterSelection,320);toggleTextSelection(t){this.viewer.viewer&&this.viewer.viewer.classList.toggle(wt.disableSelection,t)}handleScaleValue=()=>{if(!this.viewer)return;const t=this.props.pdfScaleValue,e="page-width:";if(t.startsWith(e)){const n=Number.parseFloat(t.slice(e.length));if(!Number.isFinite(n)||n<=0){this.viewer.currentScaleValue="page-width";return}this.viewer.currentScaleValue="page-width";const o=this.viewer.currentScale;if(!Number.isFinite(o)||o<=0)return;this.viewer.currentScaleValue=String(o*n);return}this.viewer.currentScaleValue=t};debouncedScaleValue=Mt(this.handleScaleValue,500);render(){const{onSelectionFinished:t,enableAreaSelection:e}=this.props;return L.jsx("div",{onPointerDown:this.onMouseDown,children:L.jsxs("div",{ref:this.containerNodeRef,className:wt.container,style:{position:"absolute",width:"100%",height:"100%",overflow:"auto"},onContextMenu:n=>n.preventDefault(),children:[L.jsx("div",{className:"pdfViewer"}),this.renderTip(),typeof e=="function"?L.jsx(Ge,{onDragStart:()=>this.toggleTextSelection(!0),onDragEnd:()=>this.toggleTextSelection(!1),onChange:n=>this.setState({isAreaSelectionInProgress:n}),shouldStart:n=>e(n)&&n.target instanceof Element&&Z(n.target)&&!!n.target.closest(".page"),onSelection:(n,o,r)=>{const s=pt(n);if(!s)return;const a={...o,top:o.top-s.node.offsetTop,left:o.left-s.node.offsetLeft,pageNumber:s.number},h={boundingRect:a,rects:[],pageNumber:s.number},l=this.viewportPositionToScaled(h),u=this.screenshot(a,a.pageNumber);this.setTip(h,t(l,{image:u},()=>this.hideTipAndSelection(),()=>{console.log("setting ghost highlight",l),this.setState({ghostHighlight:{position:l,content:{image:u}}},()=>{r(),this.renderHighlightLayers()})}))}}):null]})})}renderHighlightLayers(){const{pdfDocument:t}=this.props;if(this.viewer)for(let e=1;e<=t.numPages;e++){const n=this.highlightRoots[e];if(n?.container.isConnected)this.renderHighlightLayer(n.reactRoot,e);else{const o=this.findOrCreateHighlightLayer(e);if(o){const r=this.getOrCreateHighlightRoot(o);this.highlightRoots[e]={reactRoot:r,container:o},this.renderHighlightLayer(r,e)}}}}getOrCreateHighlightRoot(t){const e=this.highlightRootByContainer.get(t);if(e)return e;const n=ce(t);return this.highlightRootByContainer.set(t,n),n}renderHighlightLayer(t,e){const{highlightTransform:n,highlights:o}=this.props,{tip:r,scrolledToHighlightId:s}=this.state;t.render(L.jsx(ke,{highlightsByPage:this.groupHighlightsByPage(o),pageNumber:e.toString(),scrolledToHighlightId:s,highlightTransform:n,tip:r,scaledPositionToViewport:this.scaledPositionToViewport.bind(this),hideTipAndSelection:this.hideTipAndSelection.bind(this),viewer:this.viewer,screenshot:this.screenshot.bind(this),showTip:this.showTip.bind(this),setTip:a=>{this.state.pinnedTipHighlightId&&String(a.highlight.id)!==String(this.state.pinnedTipHighlightId)||this.setState({tip:a})}}))}}var ft={exports:{}},qt={},Kt={exports:{}},Ze="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Je=Ze,Qe=Je;function Zt(){}function Jt(){}Jt.resetWarningCache=Zt;var ti=function(){function i(n,o,r,s,a,h){if(h!==Qe){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}i.isRequired=i;function t(){return i}var e={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:t,element:i,elementType:i,instanceOf:t,node:i,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Jt,resetWarningCache:Zt};return e.PropTypes=e,e};Kt.exports=ti();var Qt=Kt.exports;function te(i){var t,e,n="";if(typeof i=="string"||typeof i=="number")n+=i;else if(typeof i=="object")if(Array.isArray(i))for(t=0;t<i.length;t++)i[t]&&(e=te(i[t]))&&(n&&(n+=" "),n+=e);else for(t in i)i[t]&&(n&&(n+=" "),n+=t);return n}function Vt(){for(var i,t,e=0,n="";e<arguments.length;)(i=arguments[e++])&&(t=te(i))&&(n&&(n+=" "),n+=t);return n}const ei=Object.freeze(Object.defineProperty({__proto__:null,clsx:Vt,default:Vt},Symbol.toStringTag,{value:"Module"})),ii=ue(ei);var C={},G={};Object.defineProperty(G,"__esModule",{value:!0});G.dontSetMe=ai;G.findInArray=ni;G.int=si;G.isFunction=oi;G.isNum=ri;function ni(i,t){for(let e=0,n=i.length;e<n;e++)if(t.apply(t,[i[e],e,i]))return i[e]}function oi(i){return typeof i=="function"||Object.prototype.toString.call(i)==="[object Function]"}function ri(i){return typeof i=="number"&&!isNaN(i)}function si(i){return parseInt(i,10)}function ai(i,t,e){if(i[t])return new Error("Invalid prop ".concat(t," passed to ").concat(e," - do not set this, set it on the child."))}var J={};Object.defineProperty(J,"__esModule",{value:!0});J.browserPrefixToKey=ie;J.browserPrefixToStyle=li;J.default=void 0;J.getPrefix=ee;const xt=["Moz","Webkit","O","ms"];function ee(){var i;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const e=(i=window.document)===null||i===void 0||(i=i.documentElement)===null||i===void 0?void 0:i.style;if(!e||t in e)return"";for(let n=0;n<xt.length;n++)if(ie(t,xt[n])in e)return xt[n];return""}function ie(i,t){return t?"".concat(t).concat(hi(i)):i}function li(i,t){return t?"-".concat(t.toLowerCase(),"-").concat(i):i}function hi(i){let t="",e=!0;for(let n=0;n<i.length;n++)e?(t+=i[n].toUpperCase(),e=!1):i[n]==="-"?e=!0:t+=i[n];return t}J.default=ee();Object.defineProperty(C,"__esModule",{value:!0});C.addClassName=re;C.addEvent=pi;C.addUserSelectStyles=Pi;C.createCSSTransform=wi;C.createSVGTransform=yi;C.getTouch=Si;C.getTouchIdentifier=xi;C.getTranslation=_t;C.innerHeight=mi;C.innerWidth=vi;C.matchesSelector=oe;C.matchesSelectorAndParentsTo=ui;C.offsetXYFromParent=bi;C.outerHeight=fi;C.outerWidth=gi;C.removeClassName=se;C.removeEvent=di;C.removeUserSelectStyles=Ri;var V=G,Bt=ci(J);function ne(i){if(typeof WeakMap!="function")return null;var t=new WeakMap,e=new WeakMap;return(ne=function(n){return n?e:t})(i)}function ci(i,t){if(i&&i.__esModule)return i;if(i===null||typeof i!="object"&&typeof i!="function")return{default:i};var e=ne(t);if(e&&e.has(i))return e.get(i);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in i)if(r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)){var s=o?Object.getOwnPropertyDescriptor(i,r):null;s&&(s.get||s.set)?Object.defineProperty(n,r,s):n[r]=i[r]}return n.default=i,e&&e.set(i,n),n}let at="";function oe(i,t){return at||(at=(0,V.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(e){return(0,V.isFunction)(i[e])})),(0,V.isFunction)(i[at])?i[at](t):!1}function ui(i,t,e){let n=i;do{if(oe(n,t))return!0;if(n===e)return!1;n=n.parentNode}while(n);return!1}function pi(i,t,e,n){if(!i)return;const o={capture:!0,...n};i.addEventListener?i.addEventListener(t,e,o):i.attachEvent?i.attachEvent("on"+t,e):i["on"+t]=e}function di(i,t,e,n){if(!i)return;const o={capture:!0,...n};i.removeEventListener?i.removeEventListener(t,e,o):i.detachEvent?i.detachEvent("on"+t,e):i["on"+t]=null}function fi(i){let t=i.clientHeight;const e=i.ownerDocument.defaultView.getComputedStyle(i);return t+=(0,V.int)(e.borderTopWidth),t+=(0,V.int)(e.borderBottomWidth),t}function gi(i){let t=i.clientWidth;const e=i.ownerDocument.defaultView.getComputedStyle(i);return t+=(0,V.int)(e.borderLeftWidth),t+=(0,V.int)(e.borderRightWidth),t}function mi(i){let t=i.clientHeight;const e=i.ownerDocument.defaultView.getComputedStyle(i);return t-=(0,V.int)(e.paddingTop),t-=(0,V.int)(e.paddingBottom),t}function vi(i){let t=i.clientWidth;const e=i.ownerDocument.defaultView.getComputedStyle(i);return t-=(0,V.int)(e.paddingLeft),t-=(0,V.int)(e.paddingRight),t}function bi(i,t,e){const o=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),r=(i.clientX+t.scrollLeft-o.left)/e,s=(i.clientY+t.scrollTop-o.top)/e;return{x:r,y:s}}function wi(i,t){const e=_t(i,t,"px");return{[(0,Bt.browserPrefixToKey)("transform",Bt.default)]:e}}function yi(i,t){return _t(i,t,"")}function _t(i,t,e){let{x:n,y:o}=i,r="translate(".concat(n).concat(e,",").concat(o).concat(e,")");if(t){const s="".concat(typeof t.x=="string"?t.x:t.x+e),a="".concat(typeof t.y=="string"?t.y:t.y+e);r="translate(".concat(s,", ").concat(a,")")+r}return r}function Si(i,t){return i.targetTouches&&(0,V.findInArray)(i.targetTouches,e=>t===e.identifier)||i.changedTouches&&(0,V.findInArray)(i.changedTouches,e=>t===e.identifier)}function xi(i){if(i.targetTouches&&i.targetTouches[0])return i.targetTouches[0].identifier;if(i.changedTouches&&i.changedTouches[0])return i.changedTouches[0].identifier}function Pi(i){if(!i)return;let t=i.getElementById("react-draggable-style-el");t||(t=i.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
1
+ import{j as L,_ as he,bT as ce}from"./index-CHzJ2xtB.js";import{r as z,R as st}from"./plugin-monaco-C8UgLomw.js";import{a as ue,g as pe}from"./plugin-terminal-MXFIPun8.js";import{r as dt}from"./plugin-notebook-JRhysCqj.js";import{p as de,_ as fe,a as ge}from"./plugin-pdf-CR8hgQBV.js";const an={A4_WIDTH:595},ln=[.5,.75,1,1.25,1.5,2],me=de,ve=void 0,be=!1;function Mt(i,t){let e;return(...n)=>{e&&clearTimeout(e),e=setTimeout(()=>i(...n),t)}}const Dt=(i,{width:t,height:e})=>({x1:i.left,y1:i.top,x2:i.left+i.width,y2:i.top+i.height,width:t,height:e,pageNumber:i.pageNumber}),ye=(i,t)=>{const[e,n,o,r]=t.convertToViewportRectangle([i.x1,i.y1,i.x2,i.y2]);return{left:Math.min(e,o),top:Math.min(n,r),width:Math.abs(o-e),height:Math.abs(n-r),pageNumber:i.pageNumber}},bt=(i,t,e=!1)=>{const{width:n,height:o}=t;if(e)return ye(i,t);if(i.x1===void 0)throw new Error("You are using old position format, please update");const r=n*i.x1/i.width,s=o*i.y1/i.height,a=n*i.x2/i.width,h=o*i.y2/i.height;return{left:r,top:s,width:a-r,height:h-s,pageNumber:i.pageNumber}},jt=i=>i.ownerDocument||document,rt=i=>jt(i).defaultView||window,Z=i=>i!=null&&(i instanceof HTMLElement||i instanceof rt(i).HTMLElement),we=i=>i instanceof HTMLCanvasElement||i instanceof rt(i).HTMLCanvasElement,pt=i=>{const t=i.closest(".page");if(!Z(t))return null;const e=Number(t.dataset.pageNumber);return{node:t,number:e}},Et=i=>{const t=i.startContainer.parentElement,e=i.endContainer.parentElement;if(!Z(t)||!Z(e))return[];const n=pt(t),o=pt(e);if(!n?.number||!o?.number)return[];if(n.number===o.number)return[n];if(n.number===o.number-1)return[n,o];const r=[];let s=n.number;const a=n.node.ownerDocument;for(;s<=o.number;){const h=pt(a.querySelector(`[data-page-number='${s}'`));h&&r.push(h),s++}return r},Se=(i,t,e)=>{const n=jt(i);let o=i.querySelector(e);return o||(o=n.createElement("div"),o.className=t,i.appendChild(o)),o},xe=(i,t)=>{const{left:e,top:n,width:o,height:r}=t,a=(i?i.ownerDocument:null)?.createElement("canvas");if(!a||!we(a))return"";a.width=o,a.height=r;const h=a.getContext("2d");if(!h||!i)return"";const l=window.devicePixelRatio;return h.drawImage(i,e*l,n*l,o*l,r*l,0,0,o,r),a.toDataURL("image/png")},Ht=i=>{const t=Array.from(i).map(c=>{const{left:g,top:y,width:b,height:w,pageNumber:S}=c,P=g,x=g+b,f=y,p=y+w;return{X0:P,X1:x,Y0:f,Y1:p,pageNumber:S}});let e=Number.MAX_SAFE_INTEGER;for(const c of t)e=Math.min(e,c.pageNumber??e);const n=t.filter(c=>(c.X0>0||c.X1>0||c.Y0>0||c.Y1>0)&&c.pageNumber===e),o=n.reduce((c,g)=>({X0:Math.min(c.X0,g.X0),X1:Math.max(c.X1,g.X1),Y0:Math.min(c.Y0,g.Y0),Y1:Math.max(c.Y1,g.Y1),pageNumber:e}),n[0]),{X0:r,X1:s,Y0:a,Y1:h,pageNumber:l}=o;return{left:r,top:a,width:s-r,height:h-a,pageNumber:l}},Pe=i=>i.sort((t,e)=>{const n=(t.pageNumber||0)*t.top-(e.pageNumber||0)*e.top;return n===0?t.left-e.left:n}),Re=(i,t)=>i.pageNumber===t.pageNumber&&i.left<=t.left&&t.left<=i.left+i.width,ze=(i,t,e=5)=>i.pageNumber===t.pageNumber&&Math.abs(i.top-t.top)<e&&Math.abs(i.height-t.height)<e,De=(i,t)=>i.pageNumber===t.pageNumber&&i.top>t.top&&i.left>t.left&&i.top+i.height<t.top+t.height&&i.left+i.width<t.left+t.width,Te=(i,t,e=10)=>{const n=i.left+i.width,o=t.left+t.width;return i.pageNumber===t.pageNumber&&i.left<=t.left&&n<=o&&t.left-n<=e},Lt=(i,t)=>{i.width=Math.max(t.width-i.left+t.left,i.width)},_e=i=>{const t=Pe(i),e=new Set,n=t.filter(r=>t.every(s=>!De(r,s)));let o=0;for(;o<=2;){for(const r of n)for(const s of n)r===s||e.has(r)||e.has(s)||ze(r,s)&&(Re(r,s)&&(Lt(r,s),r.height=Math.max(r.height,s.height),e.add(s)),Te(r,s)&&(Lt(r,s),e.add(s)));o+=1}return n.filter(r=>!e.has(r))},Ne=(i,t)=>!(i.top<t.top||i.bottom>t.bottom||i.right>t.right||i.left<t.left),Wt=(i,t,e=!0)=>{const n=Array.from(i.getClientRects()),o=[];for(const r of n)for(const s of t){const a=s.node.getBoundingClientRect();if(Ne(r,a)&&r.width>0&&r.height>0&&r.width<a.width&&r.height<a.height){const h={top:r.top+s.node.scrollTop-a.top,left:r.left+s.node.scrollLeft-a.left,width:r.width,height:r.height,pageNumber:s.number};o.push(h)}}return e?_e(o):o},Ce="_container_1vvir_1",Me="_highlightLayer_1vvir_8",Ee="_disableSelection_1vvir_20",yt={container:Ce,highlightLayer:Me,disableSelection:Ee},Ot=10,wt=12,It=8,He=14,Le=17,We=62,Oe=22;function St(i,t,e){return Math.min(Math.max(i,t),e)}function $t(i){return String(i||"").normalize("NFKC").replace(/\uFFFD/g," ").replace(/\s+/g," ").trim()}function Ie(i,t){const e=i.position?.rects?.[0]||i.position?.boundingRect||null;if(!e)return 0;const n=Number(e.top||0),o=Number(e.height||0);return Number.isFinite(n)?Number.isFinite(o)?Math.max(0,n+o*.5-t*.5):Math.max(0,n):0}function Ae(i,t){const e=$t(i);if(!e)return"";const n=e.split(/\s+/).filter(Boolean);return n.length<=t?n.join(" "):`${n.slice(0,t).join(" ")} …`}function Fe(i){const t=i.previewSummary;if(typeof t=="string"&&t.trim())return $t(t);const e=typeof i.comment?.text=="string"?i.comment.text:"";return Ae(e,8)}function ke(i,t){const e=Fe(i),n=e.length>0,o=Math.max(120,t-Oe),s=Math.max(14,Math.floor(o/6.1)),a=n?Math.max(1,Math.ceil(e.length/s)):0,h=14,l=n?4:0,c=h+He+l+a*Le;return Math.max(We,Math.ceil(c))}function Ve(i,t,e){const n=Number.isFinite(t)&&t>0?t:0,o=Number.isFinite(e)&&e>0?e:0,r=Math.max(140,n-wt*2),s=St(n*.34,190,320),a=Math.min(r,s),h=Math.max(wt,n-a-wt),l=i.filter(u=>!u.content?.image).filter(u=>!u.__dsGhost).map(u=>{const m=u,v=ke(m,a);return{id:String(u.id),cardHeightPx:v,anchorTop:Ie(m,v)}}).sort((u,m)=>u.anchorTop===m.anchorTop?u.id.localeCompare(m.id):u.anchorTop-m.anchorTop),c={};if(l.length===0)return{hintTopById:c,hintLeftPx:h,hintWidthPx:a};const g=It,y=Math.max(g,o-It),b=Math.max(0,y-g),w=l.reduce((u,m)=>u+m.cardHeightPx,0);let S=Ot;if(l.length>1){const u=Math.floor((b-w)/(l.length-1));Number.isFinite(u)&&(S=Math.max(0,Math.min(Ot,u)))}else S=0;const P=new Array(l.length).fill(0);for(let u=l.length-1;u>=0;u-=1){const m=u+1<l.length?P[u+1]:0;P[u]=l[u].cardHeightPx+m}const x=[];let f=g;for(let u=0;u<l.length;u+=1){const m=l[u],v=l.length-u-1,R=P[u]+Math.max(0,v)*Math.max(0,S),_=Math.max(g,y-R),D=St(m.anchorTop,g,_),N=Math.max(D,f);x.push({id:m.id,top:N,cardHeightPx:m.cardHeightPx}),f=N+m.cardHeightPx+S}const p=x[x.length-1],d=p?p.top+p.cardHeightPx:g;if(d>y){const u=d-y;for(let m=0;m<x.length;m+=1)x[m].top=Math.max(g,x[m].top-u)}for(let u=1;u<x.length;u+=1){const m=x[u-1],v=x[u],R=m.top+m.cardHeightPx+S;v.top<R&&(v.top=R)}for(const u of x){const m=Math.max(g,y-u.cardHeightPx);c[u.id]=Math.round(St(u.top,g,m))}return{hintTopById:c,hintLeftPx:h,hintWidthPx:a}}function Be({highlightsByPage:i,scaledPositionToViewport:t,pageNumber:e,scrolledToHighlightId:n,highlightTransform:o,tip:r,hideTipAndSelection:s,viewer:a,screenshot:h,showTip:l,setTip:c}){const g=i[String(e)]||[],y=Number.parseInt(e,10),b=a.getPageView(y-1),w=b?.div?.offsetWidth||b?.div?.getBoundingClientRect().width||b?.viewport?.width||0,S=b?.div?.offsetHeight||b?.div?.getBoundingClientRect().height||b?.viewport?.height||0,P=g.map(f=>({...f,position:t(f.position)})),x=Ve(P,w,S);return L.jsx("div",{children:P.map((f,p)=>{const d=f;r&&r.highlight.id===String(d.id)&&l(f,r.callback(f));const u=n===d.id;return o(f,p,(m,v)=>{c({highlight:m,callback:v}),l(m,v(m))},s,m=>{const v=a.getPageView((m.pageNumber||Number.parseInt(e))-1).viewport;return Dt(m,v)},m=>h(m,Number.parseInt(e)),u,{width:w,height:S,pageNumber:y,overlayHintTopById:x.hintTopById,overlayHintLeftPx:x.hintLeftPx,overlayHintWidthPx:x.hintWidthPx})})})}const Xe="_mouseSelection_1p43j_1",Ye={mouseSelection:Xe},At=(i,t)=>({left:Math.min(t.x,i.x),top:Math.min(t.y,i.y),width:Math.abs(t.x-i.x),height:Math.abs(t.y-i.y)}),Ue=i=>i.width>=1&&i.height>=1;function Ge({onSelection:i,onDragStart:t,onDragEnd:e,shouldStart:n,onChange:o}){const[r,s]=z.useState(!1),[a,h]=z.useState(null),[l,c]=z.useState(null),g=z.useRef(null),y=z.useRef(a),b=z.useRef(r);z.useEffect(()=>{y.current=a},[a]),z.useEffect(()=>{b.current=r},[r]);const w=z.useCallback(()=>{e(),h(null),c(null),s(!1)},[e]);return z.useEffect(()=>{o(!!(a&&l))},[a,l,o]),z.useEffect(()=>{const S=g.current;if(!S)return;const P=S.parentElement;if(!P||!Z(P))return;const x=(d,u)=>{const m=P.getBoundingClientRect();return{x:d-m.left+P.scrollLeft,y:u-m.top+P.scrollTop-window.scrollY}},f=d=>{!y.current||b.current||c(x(d.pageX,d.pageY))},p=d=>{if(!n(d)){w();return}const u=d.target;if(!(u instanceof Element)||!Z(u))return;t(),h(x(d.pageX,d.pageY)),c(null),s(!1);const m=R=>{R.currentTarget?.removeEventListener("mouseup",m);const _=y.current;if(!_||!(R instanceof MouseEvent))return;const D=x(R.pageX,R.pageY),N=At(_,D);if(!(R.target instanceof Element)||!Z(R.target)||!P.contains(R.target)||!Ue(N)){w();return}c(D),s(!0),i(u,N,w),e()},v=P.ownerDocument;v?.body&&v.body.addEventListener("mouseup",m)};return P.addEventListener("mousemove",f),P.addEventListener("mousedown",p),()=>{P.removeEventListener("mousemove",f),P.removeEventListener("mousedown",p)}},[n,t,e,i,w]),L.jsx("div",{ref:g,children:a&&l&&L.jsx("div",{className:Ye.mouseSelection,style:At(a,l)})})}const je="_tipContainer_f56kr_1",$e={tipContainer:je};function nt(i,t,e){return Math.min(Math.max(i,t),e)}function qe({children:i,style:t,scrollTop:e,pageBoundingRect:n,pageOffset:o,tipPlacementMode:r="auto"}){const[s,a]=z.useState(0),[h,l]=z.useState(0),c=z.useRef(null),g=z.useCallback(()=>{if(!c.current)return;const{offsetHeight:M,offsetWidth:$}=c.current;a(M),l($)},[]);z.useEffect(()=>{setTimeout(g,0)},[g]),z.useEffect(()=>{if(!c.current||typeof ResizeObserver>"u")return;const M=new ResizeObserver(()=>{g()});return M.observe(c.current),()=>M.disconnect()},[g]);const y=h===0&&s===0,b=12,w=o.left,S=o.top,P=w+b,x=w+n.width-h-b,f=S+b,p=S+n.height-s-b,d=(t.selectionLeft+t.selectionRight)/2,u=w+n.width-t.selectionRight-b,m=t.selectionLeft-w-b;let v=nt(d-h/2,P,x),R=nt(t.selectionTop,f,p);const _=u>=h,D=m>=h,N=r==="overlay",T=r==="right",O=t.selectionTop-s-b<e;if(T){v=x;const M=t.selectionTop+(t.selectionBottom-t.selectionTop)/2-s/2;R=nt(M,f,p)}else!N&&_?v=t.selectionRight+b:!N&&D?v=t.selectionLeft-h-b:(R=O?t.selectionBottom+b:t.selectionTop-s-b,R=nt(R,f,p),v=nt(d-h/2,P,x));const V=z.useCallback(()=>{l(0),a(0),setTimeout(g,0)},[g]),Y=st.Children.map(i,M=>M!=null?st.cloneElement(M,{onUpdate:V,popup:{position:O?"below":"above"}}):null);return L.jsx("div",{id:"PdfHighlighter__tip-container",className:$e.tipContainer,style:{visibility:y?"hidden":"visible",top:R,left:v},ref:c,children:Y})}const Ft="empty-id",Ke="__ds_ghost__";class hn extends z.PureComponent{static defaultProps={pdfScaleValue:"auto"};state={ghostHighlight:null,isCollapsed:!0,range:null,scrolledToHighlightId:Ft,isAreaSelectionInProgress:!1,tip:null,tipPosition:null,tipChildren:null,pinnedTipHighlightId:null};viewer;resizeObserver=null;containerNode=null;containerNodeRef;highlightRoots={};highlightRootByContainer=new WeakMap;unsubscribe=()=>{};selectionRafId=null;scrollPageIntoViewPatched=!1;scrollMatchIntoViewPatched=!1;constructor(t){super(t),typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(this.debouncedScaleValue)),this.containerNodeRef=st.createRef()}componentDidMount(){this.init()}onPageChanging=t=>{const e=t?.pageNumber;typeof e=="number"&&this.props.onPageChange?.(e)};attachRef=t=>{const{resizeObserver:e}=this;if(this.containerNode=this.containerNodeRef.current,this.unsubscribe(),this.containerNode){const{ownerDocument:n}=this.containerNode;t.on("textlayerrendered",this.onTextLayerRendered),t.on("pagesinit",this.onDocumentReady),t.on("pagechanging",this.onPageChanging),n.addEventListener("selectionchange",this.onSelectionChange),n.addEventListener("keydown",this.handleKeyDown),n.defaultView?.addEventListener("resize",this.debouncedScaleValue),e&&e.observe(this.containerNode),this.unsubscribe=()=>{t.off("pagesinit",this.onDocumentReady),t.off("textlayerrendered",this.onTextLayerRendered),t.off("pagechanging",this.onPageChanging),n.removeEventListener("selectionchange",this.onSelectionChange),n.removeEventListener("keydown",this.handleKeyDown),n.defaultView?.removeEventListener("resize",this.debouncedScaleValue),e&&e.disconnect()}}};componentDidUpdate(t){if(t.pdfDocument!==this.props.pdfDocument){this.init();return}if(t.pdfScaleValue!==this.props.pdfScaleValue&&this.handleScaleValue(),t.highlights!==this.props.highlights){this.renderHighlightLayers();const e=this.state.pinnedTipHighlightId;if(e){const n=this.state.tip&&String(this.state.tip.highlight.id)===e?this.state.tip.callback:void 0;this.setPinnedTipForHighlight(e,n)}}}findViewportHighlightById(t){const e=this.props.highlights.find(n=>String(n.id)===String(t));return e?{...e,position:this.scaledPositionToViewport(e.position)}:null}setPinnedTipForHighlight=(t,e)=>{if(!t){this.setState({pinnedTipHighlightId:null,tip:null,tipPosition:null,tipChildren:null},()=>this.renderHighlightLayers());return}const n=this.findViewportHighlightById(t);if(!n){this.setState({pinnedTipHighlightId:null,tip:null,tipPosition:null,tipChildren:null},()=>this.renderHighlightLayers());return}const o=e||(this.state.tip&&String(this.state.tip.highlight.id)===String(t)?this.state.tip.callback:void 0);o&&this.setState({pinnedTipHighlightId:String(t),tip:{highlight:n,callback:o}},()=>{this.setTip(n.position,o(n)),this.renderHighlightLayers()})};async init(){const{pdfDocument:t,pdfViewerOptions:e}=this.props,n=await he(()=>import("./plugin-pdf-CR8hgQBV.js").then(s=>s.b),[]),o=new n.EventBus,r=new n.PDFLinkService({eventBus:o,externalLinkTarget:2});this.containerNodeRef.current&&(this.viewer=this.viewer||new n.PDFViewer({container:this.containerNodeRef.current,eventBus:o,textLayerMode:2,removePageBorders:!0,linkService:r,...e}),this.patchScrollPageIntoView(),this.patchScrollMatchIntoView(n),r.setDocument(t),r.setViewer(this.viewer),this.viewer.setDocument(t),this.attachRef(o))}patchScrollPageIntoView(){if(this.scrollPageIntoViewPatched||!this.viewer)return;const t=this.viewer.scrollPageIntoView.bind(this.viewer);this.viewer.scrollPageIntoView=e=>{if(!this.isViewerScrollable())return;const n=e?.pageNumber;if(typeof n=="number"){const o=this.viewer.getPageView(n-1);if(!o?.div||!o.div.offsetParent)return}t(e)},this.scrollPageIntoViewPatched=!0}patchScrollMatchIntoView(t){if(this.scrollMatchIntoViewPatched)return;const e=t?.PDFFindController?.prototype;if(!e||typeof e.scrollMatchIntoView!="function")return;const n=e.scrollMatchIntoView;e.scrollMatchIntoView=function(o={}){const r=o.element;if(!(!r||!r.isConnected||!r.offsetParent))return n.call(this,o)},this.scrollMatchIntoViewPatched=!0}componentWillUnmount(){Object.values(this.highlightRoots).forEach(t=>{try{t.reactRoot.unmount()}catch{}}),this.highlightRoots={},this.highlightRootByContainer=new WeakMap,this.unsubscribe()}findOrCreateHighlightLayer(t){if(!this.viewer)return null;const{textLayer:e}=this.viewer.getPageView(t-1)||{};return e?Se(e.div,`PdfHighlighter__highlight-layer ${yt.highlightLayer}`,".PdfHighlighter__highlight-layer"):null}groupHighlightsByPage(t){const{ghostHighlight:e}=this.state,n=[...t,e].filter(Boolean),o=new Set;for(const s of n){o.add(s.position.pageNumber);for(const a of s.position.rects)a.pageNumber&&o.add(a.pageNumber)}const r={};for(const s of o){r[s]=r[s]||[];for(const a of n){const h={...a,position:{pageNumber:s,boundingRect:a.position.boundingRect,rects:[],usePdfCoordinates:a.position.usePdfCoordinates}};let l=!1;for(const c of a.position.rects)s===(c.pageNumber||a.position.pageNumber)&&(h.position.rects.push(c),l=!0);(l||s===a.position.pageNumber)&&r[s].push(h)}}return r}showTip(t,e){const{isCollapsed:n,ghostHighlight:o,isAreaSelectionInProgress:r,pinnedTipHighlightId:s}=this.state;s&&String(t.id)!==String(s)||!n||o||r||this.setTip(t.position,e)}scaledPositionToViewport({pageNumber:t,boundingRect:e,rects:n,usePdfCoordinates:o}){const r=this.viewer.getPageView(t-1).viewport;return{boundingRect:bt(e,r,o),rects:(n||[]).map(s=>bt(s,r,o)),pageNumber:t}}viewportPositionToScaled({pageNumber:t,boundingRect:e,rects:n}){const o=this.viewer.getPageView(t-1).viewport;return{boundingRect:Dt(e,o),rects:(n||[]).map(r=>Dt(r,o)),pageNumber:t}}screenshot(t,e){const n=this.viewer.getPageView(e-1).canvas;return xe(n,t)}hideTipAndSelection=()=>{if(this.state.pinnedTipHighlightId)return;this.selectionRafId!=null&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null);const t=this.containerNode;t&&rt(t).getSelection()?.removeAllRanges(),this.setState({tipPosition:null,tipChildren:null,ghostHighlight:null,tip:null,range:null,isCollapsed:!0},()=>this.renderHighlightLayers())};buildGhostHighlight(t,e){return{__dsGhost:!0,id:Ke,position:t,content:e?{text:e}:void 0,comment:{text:"",emoji:"note"}}}scheduleGhostHighlightUpdate(t){this.selectionRafId!=null&&cancelAnimationFrame(this.selectionRafId),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{isAreaSelectionInProgress:e}=this.state;if(e)return;const n=Et(t);if(!n||n.length===0)return;const o=Wt(t,n);if(o.length===0)return;const s={boundingRect:Ht(o),rects:o,pageNumber:n[0].number},a=this.viewportPositionToScaled(s),h=this.buildGhostHighlight(a,t.toString());this.setState({ghostHighlight:h},()=>this.renderHighlightLayers())})}setTip(t,e){this.setState({tipPosition:t,tipChildren:e})}renderTip=()=>{const{tipPosition:t,tipChildren:e}=this.state;if(!t)return null;const{boundingRect:n,pageNumber:o}=t,r={node:this.viewer.getPageView((n.pageNumber||o)-1).div,pageNumber:n.pageNumber||o},s=r.node.getBoundingClientRect(),a={bottom:s.bottom,height:s.height,left:s.left,right:s.right,top:s.top,width:s.width,x:s.x,y:s.y,pageNumber:r.pageNumber},h=r.node.offsetLeft+n.left,l=h+n.width,c=n.top+r.node.offsetTop,g=c+n.height;return L.jsx(qe,{scrollTop:this.viewer.container.scrollTop,pageBoundingRect:a,pageOffset:{left:r.node.offsetLeft,top:r.node.offsetTop},tipPlacementMode:this.props.tipPlacementMode,style:{selectionLeft:h,selectionRight:l,selectionTop:c,selectionBottom:g},children:e})};onTextLayerRendered=()=>{this.renderHighlightLayers()};isViewerScrollable=()=>{const t=this.viewer?.container;return!t||!t.isConnected?!1:!!t.offsetParent};scrollTo=t=>{const{pageNumber:e,boundingRect:n,usePdfCoordinates:o}=t.position;if(!this.isViewerScrollable()){this.setState({scrolledToHighlightId:t.id},()=>this.renderHighlightLayers());return}const r=this.viewer.getPageView(e-1);if(!r?.div||!r.div.offsetParent)return;this.viewer.container.removeEventListener("scroll",this.onScroll);const s=r.viewport;this.viewer.scrollPageIntoView({pageNumber:e,destArray:[null,{name:"XYZ"},...s.convertToPdfPoint(0,bt(n,s,o).top-10),0]}),this.setState({scrolledToHighlightId:t.id},()=>this.renderHighlightLayers()),setTimeout(()=>{this.viewer.container.addEventListener("scroll",this.onScroll)},100)};scrollToPage=t=>{this.viewer&&this.isViewerScrollable()&&(this.viewer.currentPageNumber=t)};onDocumentReady=()=>{const{scrollRef:t}=this.props;this.handleScaleValue(),t(this.scrollTo),this.props.onPageChange?.(this.viewer.currentPageNumber||1)};onSelectionChange=()=>{const t=this.containerNode;if(!t)return;const e=rt(t).getSelection();if(!e)return;const n=e.rangeCount>0?e.getRangeAt(0):null;if(e.isCollapsed){this.setState({isCollapsed:!0,range:null,ghostHighlight:null},()=>this.renderHighlightLayers());return}if(!n||!t||!t.contains(n.commonAncestorContainer))return;const o=n.cloneRange();this.setState({isCollapsed:!1,range:o}),this.scheduleGhostHighlightUpdate(o),this.debouncedAfterSelection()};onScroll=()=>{const{onScrollChange:t}=this.props;t(),this.setState({scrolledToHighlightId:Ft},()=>this.renderHighlightLayers()),this.viewer.container.removeEventListener("scroll",this.onScroll)};onMouseDown=t=>{this.state.pinnedTipHighlightId||!(t.target instanceof Element)||!Z(t.target)||t.target.closest("#PdfHighlighter__tip-container")||this.hideTipAndSelection()};handleKeyDown=t=>{this.state.pinnedTipHighlightId||t.code==="Escape"&&this.hideTipAndSelection()};afterSelection=()=>{const{onSelectionFinished:t}=this.props,e=this.containerNode;if(!e)return;const n=rt(e).getSelection(),o=n&&n.rangeCount>0?n.getRangeAt(0):null,{isCollapsed:r}=this.state;if(!o||r||n?.isCollapsed)return;const s=o.cloneRange(),a=Et(s);if(!a||a.length===0)return;const h=Wt(s,a);if(h.length===0)return;const c={boundingRect:Ht(h),rects:h,pageNumber:a[0].number},g={text:s.toString()},y=this.viewportPositionToScaled(c);this.setTip(c,t(y,g,()=>this.hideTipAndSelection(),()=>this.setState({ghostHighlight:this.buildGhostHighlight(y,g.text)},()=>this.renderHighlightLayers())))};debouncedAfterSelection=Mt(this.afterSelection,320);toggleTextSelection(t){this.viewer.viewer&&this.viewer.viewer.classList.toggle(yt.disableSelection,t)}handleScaleValue=()=>{if(!this.viewer)return;const t=this.props.pdfScaleValue,e="page-width:";if(t.startsWith(e)){const n=Number.parseFloat(t.slice(e.length));if(!Number.isFinite(n)||n<=0){this.viewer.currentScaleValue="page-width";return}this.viewer.currentScaleValue="page-width";const o=this.viewer.currentScale;if(!Number.isFinite(o)||o<=0)return;this.viewer.currentScaleValue=String(o*n);return}this.viewer.currentScaleValue=t};debouncedScaleValue=Mt(this.handleScaleValue,500);render(){const{onSelectionFinished:t,enableAreaSelection:e}=this.props;return L.jsx("div",{onPointerDown:this.onMouseDown,children:L.jsxs("div",{ref:this.containerNodeRef,className:yt.container,style:{position:"absolute",width:"100%",height:"100%",overflow:"auto"},onContextMenu:n=>n.preventDefault(),children:[L.jsx("div",{className:"pdfViewer"}),this.renderTip(),typeof e=="function"?L.jsx(Ge,{onDragStart:()=>this.toggleTextSelection(!0),onDragEnd:()=>this.toggleTextSelection(!1),onChange:n=>this.setState({isAreaSelectionInProgress:n}),shouldStart:n=>e(n)&&n.target instanceof Element&&Z(n.target)&&!!n.target.closest(".page"),onSelection:(n,o,r)=>{const s=pt(n);if(!s)return;const a={...o,top:o.top-s.node.offsetTop,left:o.left-s.node.offsetLeft,pageNumber:s.number},h={boundingRect:a,rects:[],pageNumber:s.number},l=this.viewportPositionToScaled(h),c=this.screenshot(a,a.pageNumber);this.setTip(h,t(l,{image:c},()=>this.hideTipAndSelection(),()=>{console.log("setting ghost highlight",l),this.setState({ghostHighlight:{position:l,content:{image:c}}},()=>{r(),this.renderHighlightLayers()})}))}}):null]})})}renderHighlightLayers(){const{pdfDocument:t}=this.props;if(this.viewer)for(let e=1;e<=t.numPages;e++){const n=this.highlightRoots[e];if(n?.container.isConnected)this.renderHighlightLayer(n.reactRoot,e);else{const o=this.findOrCreateHighlightLayer(e);if(o){const r=this.getOrCreateHighlightRoot(o);this.highlightRoots[e]={reactRoot:r,container:o},this.renderHighlightLayer(r,e)}}}}getOrCreateHighlightRoot(t){const e=this.highlightRootByContainer.get(t);if(e)return e;const n=ce(t);return this.highlightRootByContainer.set(t,n),n}renderHighlightLayer(t,e){const{highlightTransform:n,highlights:o}=this.props,{tip:r,scrolledToHighlightId:s}=this.state;t.render(L.jsx(Be,{highlightsByPage:this.groupHighlightsByPage(o),pageNumber:e.toString(),scrolledToHighlightId:s,highlightTransform:n,tip:r,scaledPositionToViewport:this.scaledPositionToViewport.bind(this),hideTipAndSelection:this.hideTipAndSelection.bind(this),viewer:this.viewer,screenshot:this.screenshot.bind(this),showTip:this.showTip.bind(this),setTip:a=>{this.state.pinnedTipHighlightId&&String(a.highlight.id)!==String(this.state.pinnedTipHighlightId)||this.setState({tip:a})}}))}}var ft={exports:{}},qt={},Kt={exports:{}},Ze="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Je=Ze,Qe=Je;function Zt(){}function Jt(){}Jt.resetWarningCache=Zt;var ti=function(){function i(n,o,r,s,a,h){if(h!==Qe){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}i.isRequired=i;function t(){return i}var e={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:t,element:i,elementType:i,instanceOf:t,node:i,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Jt,resetWarningCache:Zt};return e.PropTypes=e,e};Kt.exports=ti();var Qt=Kt.exports;function te(i){var t,e,n="";if(typeof i=="string"||typeof i=="number")n+=i;else if(typeof i=="object")if(Array.isArray(i))for(t=0;t<i.length;t++)i[t]&&(e=te(i[t]))&&(n&&(n+=" "),n+=e);else for(t in i)i[t]&&(n&&(n+=" "),n+=t);return n}function kt(){for(var i,t,e=0,n="";e<arguments.length;)(i=arguments[e++])&&(t=te(i))&&(n&&(n+=" "),n+=t);return n}const ei=Object.freeze(Object.defineProperty({__proto__:null,clsx:kt,default:kt},Symbol.toStringTag,{value:"Module"})),ii=ue(ei);var C={},G={};Object.defineProperty(G,"__esModule",{value:!0});G.dontSetMe=ai;G.findInArray=ni;G.int=si;G.isFunction=oi;G.isNum=ri;function ni(i,t){for(let e=0,n=i.length;e<n;e++)if(t.apply(t,[i[e],e,i]))return i[e]}function oi(i){return typeof i=="function"||Object.prototype.toString.call(i)==="[object Function]"}function ri(i){return typeof i=="number"&&!isNaN(i)}function si(i){return parseInt(i,10)}function ai(i,t,e){if(i[t])return new Error("Invalid prop ".concat(t," passed to ").concat(e," - do not set this, set it on the child."))}var J={};Object.defineProperty(J,"__esModule",{value:!0});J.browserPrefixToKey=ie;J.browserPrefixToStyle=li;J.default=void 0;J.getPrefix=ee;const xt=["Moz","Webkit","O","ms"];function ee(){var i;let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const e=(i=window.document)===null||i===void 0||(i=i.documentElement)===null||i===void 0?void 0:i.style;if(!e||t in e)return"";for(let n=0;n<xt.length;n++)if(ie(t,xt[n])in e)return xt[n];return""}function ie(i,t){return t?"".concat(t).concat(hi(i)):i}function li(i,t){return t?"-".concat(t.toLowerCase(),"-").concat(i):i}function hi(i){let t="",e=!0;for(let n=0;n<i.length;n++)e?(t+=i[n].toUpperCase(),e=!1):i[n]==="-"?e=!0:t+=i[n];return t}J.default=ee();Object.defineProperty(C,"__esModule",{value:!0});C.addClassName=re;C.addEvent=pi;C.addUserSelectStyles=Pi;C.createCSSTransform=yi;C.createSVGTransform=wi;C.getTouch=Si;C.getTouchIdentifier=xi;C.getTranslation=_t;C.innerHeight=mi;C.innerWidth=vi;C.matchesSelector=oe;C.matchesSelectorAndParentsTo=ui;C.offsetXYFromParent=bi;C.outerHeight=fi;C.outerWidth=gi;C.removeClassName=se;C.removeEvent=di;C.removeUserSelectStyles=Ri;var k=G,Vt=ci(J);function ne(i){if(typeof WeakMap!="function")return null;var t=new WeakMap,e=new WeakMap;return(ne=function(n){return n?e:t})(i)}function ci(i,t){if(i&&i.__esModule)return i;if(i===null||typeof i!="object"&&typeof i!="function")return{default:i};var e=ne(t);if(e&&e.has(i))return e.get(i);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in i)if(r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)){var s=o?Object.getOwnPropertyDescriptor(i,r):null;s&&(s.get||s.set)?Object.defineProperty(n,r,s):n[r]=i[r]}return n.default=i,e&&e.set(i,n),n}let at="";function oe(i,t){return at||(at=(0,k.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(e){return(0,k.isFunction)(i[e])})),(0,k.isFunction)(i[at])?i[at](t):!1}function ui(i,t,e){let n=i;do{if(oe(n,t))return!0;if(n===e)return!1;n=n.parentNode}while(n);return!1}function pi(i,t,e,n){if(!i)return;const o={capture:!0,...n};i.addEventListener?i.addEventListener(t,e,o):i.attachEvent?i.attachEvent("on"+t,e):i["on"+t]=e}function di(i,t,e,n){if(!i)return;const o={capture:!0,...n};i.removeEventListener?i.removeEventListener(t,e,o):i.detachEvent?i.detachEvent("on"+t,e):i["on"+t]=null}function fi(i){let t=i.clientHeight;const e=i.ownerDocument.defaultView.getComputedStyle(i);return t+=(0,k.int)(e.borderTopWidth),t+=(0,k.int)(e.borderBottomWidth),t}function gi(i){let t=i.clientWidth;const e=i.ownerDocument.defaultView.getComputedStyle(i);return t+=(0,k.int)(e.borderLeftWidth),t+=(0,k.int)(e.borderRightWidth),t}function mi(i){let t=i.clientHeight;const e=i.ownerDocument.defaultView.getComputedStyle(i);return t-=(0,k.int)(e.paddingTop),t-=(0,k.int)(e.paddingBottom),t}function vi(i){let t=i.clientWidth;const e=i.ownerDocument.defaultView.getComputedStyle(i);return t-=(0,k.int)(e.paddingLeft),t-=(0,k.int)(e.paddingRight),t}function bi(i,t,e){const o=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),r=(i.clientX+t.scrollLeft-o.left)/e,s=(i.clientY+t.scrollTop-o.top)/e;return{x:r,y:s}}function yi(i,t){const e=_t(i,t,"px");return{[(0,Vt.browserPrefixToKey)("transform",Vt.default)]:e}}function wi(i,t){return _t(i,t,"")}function _t(i,t,e){let{x:n,y:o}=i,r="translate(".concat(n).concat(e,",").concat(o).concat(e,")");if(t){const s="".concat(typeof t.x=="string"?t.x:t.x+e),a="".concat(typeof t.y=="string"?t.y:t.y+e);r="translate(".concat(s,", ").concat(a,")")+r}return r}function Si(i,t){return i.targetTouches&&(0,k.findInArray)(i.targetTouches,e=>t===e.identifier)||i.changedTouches&&(0,k.findInArray)(i.changedTouches,e=>t===e.identifier)}function xi(i){if(i.targetTouches&&i.targetTouches[0])return i.targetTouches[0].identifier;if(i.changedTouches&&i.changedTouches[0])return i.changedTouches[0].identifier}function Pi(i){if(!i)return;let t=i.getElementById("react-draggable-style-el");t||(t=i.createElement("style"),t.type="text/css",t.id="react-draggable-style-el",t.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
2
2
  `,t.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
3
- `,i.getElementsByTagName("head")[0].appendChild(t)),i.body&&re(i.body,"react-draggable-transparent-selection")}function Ri(i){if(i)try{if(i.body&&se(i.body,"react-draggable-transparent-selection"),i.selection)i.selection.empty();else{const t=(i.defaultView||window).getSelection();t&&t.type!=="Caret"&&t.removeAllRanges()}}catch{}}function re(i,t){i.classList?i.classList.add(t):i.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(i.className+=" ".concat(t))}function se(i,t){i.classList?i.classList.remove(t):i.className=i.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var j={};Object.defineProperty(j,"__esModule",{value:!0});j.canDragX=Ti;j.canDragY=_i;j.createCoreData=Ci;j.createDraggableData=Mi;j.getBoundPosition=zi;j.getControlPosition=Ni;j.snapToGrid=Di;var F=G,it=C;function zi(i,t,e){if(!i.props.bounds)return[t,e];let{bounds:n}=i.props;n=typeof n=="string"?n:Ei(n);const o=Nt(i);if(typeof n=="string"){const{ownerDocument:r}=o,s=r.defaultView;let a;if(n==="parent"?a=o.parentNode:a=r.querySelector(n),!(a instanceof s.HTMLElement))throw new Error('Bounds selector "'+n+'" could not find an element.');const h=a,l=s.getComputedStyle(o),u=s.getComputedStyle(h);n={left:-o.offsetLeft+(0,F.int)(u.paddingLeft)+(0,F.int)(l.marginLeft),top:-o.offsetTop+(0,F.int)(u.paddingTop)+(0,F.int)(l.marginTop),right:(0,it.innerWidth)(h)-(0,it.outerWidth)(o)-o.offsetLeft+(0,F.int)(u.paddingRight)-(0,F.int)(l.marginRight),bottom:(0,it.innerHeight)(h)-(0,it.outerHeight)(o)-o.offsetTop+(0,F.int)(u.paddingBottom)-(0,F.int)(l.marginBottom)}}return(0,F.isNum)(n.right)&&(t=Math.min(t,n.right)),(0,F.isNum)(n.bottom)&&(e=Math.min(e,n.bottom)),(0,F.isNum)(n.left)&&(t=Math.max(t,n.left)),(0,F.isNum)(n.top)&&(e=Math.max(e,n.top)),[t,e]}function Di(i,t,e){const n=Math.round(t/i[0])*i[0],o=Math.round(e/i[1])*i[1];return[n,o]}function Ti(i){return i.props.axis==="both"||i.props.axis==="x"}function _i(i){return i.props.axis==="both"||i.props.axis==="y"}function Ni(i,t,e){const n=typeof t=="number"?(0,it.getTouch)(i,t):null;if(typeof t=="number"&&!n)return null;const o=Nt(e),r=e.props.offsetParent||o.offsetParent||o.ownerDocument.body;return(0,it.offsetXYFromParent)(n||i,r,e.props.scale)}function Ci(i,t,e){const n=!(0,F.isNum)(i.lastX),o=Nt(i);return n?{node:o,deltaX:0,deltaY:0,lastX:t,lastY:e,x:t,y:e}:{node:o,deltaX:t-i.lastX,deltaY:e-i.lastY,lastX:i.lastX,lastY:i.lastY,x:t,y:e}}function Mi(i,t){const e=i.props.scale;return{node:t.node,x:i.state.x+t.deltaX/e,y:i.state.y+t.deltaY/e,deltaX:t.deltaX/e,deltaY:t.deltaY/e,lastX:i.state.x,lastY:i.state.y}}function Ei(i){return{left:i.left,top:i.top,right:i.right,bottom:i.bottom}}function Nt(i){const t=i.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var gt={},mt={};Object.defineProperty(mt,"__esModule",{value:!0});mt.default=Hi;function Hi(){}Object.defineProperty(gt,"__esModule",{value:!0});gt.default=void 0;var Pt=Wi(z),A=Ct(Qt),Li=Ct(dt),W=C,q=j,Rt=G,ot=Ct(mt);function Ct(i){return i&&i.__esModule?i:{default:i}}function ae(i){if(typeof WeakMap!="function")return null;var t=new WeakMap,e=new WeakMap;return(ae=function(n){return n?e:t})(i)}function Wi(i,t){if(i&&i.__esModule)return i;if(i===null||typeof i!="object"&&typeof i!="function")return{default:i};var e=ae(t);if(e&&e.has(i))return e.get(i);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in i)if(r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)){var s=o?Object.getOwnPropertyDescriptor(i,r):null;s&&(s.get||s.set)?Object.defineProperty(n,r,s):n[r]=i[r]}return n.default=i,e&&e.set(i,n),n}function I(i,t,e){return t=Oi(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Oi(i){var t=Ii(i,"string");return typeof t=="symbol"?t:String(t)}function Ii(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}const X={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let K=X.mouse,vt=class extends Pt.Component{constructor(){super(...arguments),I(this,"dragging",!1),I(this,"lastX",NaN),I(this,"lastY",NaN),I(this,"touchIdentifier",null),I(this,"mounted",!1),I(this,"handleDragStart",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&typeof t.button=="number"&&t.button!==0)return!1;const e=this.findDOMNode();if(!e||!e.ownerDocument||!e.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:n}=e;if(this.props.disabled||!(t.target instanceof n.defaultView.Node)||this.props.handle&&!(0,W.matchesSelectorAndParentsTo)(t.target,this.props.handle,e)||this.props.cancel&&(0,W.matchesSelectorAndParentsTo)(t.target,this.props.cancel,e))return;t.type==="touchstart"&&t.preventDefault();const o=(0,W.getTouchIdentifier)(t);this.touchIdentifier=o;const r=(0,q.getControlPosition)(t,o,this);if(r==null)return;const{x:s,y:a}=r,h=(0,q.createCoreData)(this,s,a);(0,ot.default)("DraggableCore: handleDragStart: %j",h),(0,ot.default)("calling",this.props.onStart),!(this.props.onStart(t,h)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,W.addUserSelectStyles)(n),this.dragging=!0,this.lastX=s,this.lastY=a,(0,W.addEvent)(n,K.move,this.handleDrag),(0,W.addEvent)(n,K.stop,this.handleDragStop))}),I(this,"handleDrag",t=>{const e=(0,q.getControlPosition)(t,this.touchIdentifier,this);if(e==null)return;let{x:n,y:o}=e;if(Array.isArray(this.props.grid)){let a=n-this.lastX,h=o-this.lastY;if([a,h]=(0,q.snapToGrid)(this.props.grid,a,h),!a&&!h)return;n=this.lastX+a,o=this.lastY+h}const r=(0,q.createCoreData)(this,n,o);if((0,ot.default)("DraggableCore: handleDrag: %j",r),this.props.onDrag(t,r)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const h=document.createEvent("MouseEvents");h.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(h)}return}this.lastX=n,this.lastY=o}),I(this,"handleDragStop",t=>{if(!this.dragging)return;const e=(0,q.getControlPosition)(t,this.touchIdentifier,this);if(e==null)return;let{x:n,y:o}=e;if(Array.isArray(this.props.grid)){let h=n-this.lastX||0,l=o-this.lastY||0;[h,l]=(0,q.snapToGrid)(this.props.grid,h,l),n=this.lastX+h,o=this.lastY+l}const r=(0,q.createCoreData)(this,n,o);if(this.props.onStop(t,r)===!1||this.mounted===!1)return!1;const a=this.findDOMNode();a&&this.props.enableUserSelectHack&&(0,W.removeUserSelectStyles)(a.ownerDocument),(0,ot.default)("DraggableCore: handleDragStop: %j",r),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&((0,ot.default)("DraggableCore: Removing handlers"),(0,W.removeEvent)(a.ownerDocument,K.move,this.handleDrag),(0,W.removeEvent)(a.ownerDocument,K.stop,this.handleDragStop))}),I(this,"onMouseDown",t=>(K=X.mouse,this.handleDragStart(t))),I(this,"onMouseUp",t=>(K=X.mouse,this.handleDragStop(t))),I(this,"onTouchStart",t=>(K=X.touch,this.handleDragStart(t))),I(this,"onTouchEnd",t=>(K=X.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,W.addEvent)(t,X.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:e}=t;(0,W.removeEvent)(e,X.mouse.move,this.handleDrag),(0,W.removeEvent)(e,X.touch.move,this.handleDrag),(0,W.removeEvent)(e,X.mouse.stop,this.handleDragStop),(0,W.removeEvent)(e,X.touch.stop,this.handleDragStop),(0,W.removeEvent)(t,X.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,W.removeUserSelectStyles)(e)}}findDOMNode(){var t,e;return(t=this.props)!==null&&t!==void 0&&t.nodeRef?(e=this.props)===null||e===void 0||(e=e.nodeRef)===null||e===void 0?void 0:e.current:Li.default.findDOMNode(this)}render(){return Pt.cloneElement(Pt.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};gt.default=vt;I(vt,"displayName","DraggableCore");I(vt,"propTypes",{allowAnyClick:A.default.bool,children:A.default.node.isRequired,disabled:A.default.bool,enableUserSelectHack:A.default.bool,offsetParent:function(i,t){if(i[t]&&i[t].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:A.default.arrayOf(A.default.number),handle:A.default.string,cancel:A.default.string,nodeRef:A.default.object,onStart:A.default.func,onDrag:A.default.func,onStop:A.default.func,onMouseDown:A.default.func,scale:A.default.number,className:Rt.dontSetMe,style:Rt.dontSetMe,transform:Rt.dontSetMe});I(vt,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"DraggableCore",{enumerable:!0,get:function(){return h.default}}),i.default=void 0;var t=w(z),e=u(Qt),n=u(dt),o=u(ii),r=C,s=j,a=G,h=u(gt),l=u(mt);function u(f){return f&&f.__esModule?f:{default:f}}function g(f){if(typeof WeakMap!="function")return null;var p=new WeakMap,d=new WeakMap;return(g=function(c){return c?d:p})(f)}function w(f,p){if(f&&f.__esModule)return f;if(f===null||typeof f!="object"&&typeof f!="function")return{default:f};var d=g(p);if(d&&d.has(f))return d.get(f);var c={},m=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var v in f)if(v!=="default"&&Object.prototype.hasOwnProperty.call(f,v)){var R=m?Object.getOwnPropertyDescriptor(f,v):null;R&&(R.get||R.set)?Object.defineProperty(c,v,R):c[v]=f[v]}return c.default=f,d&&d.set(f,c),c}function b(){return b=Object.assign?Object.assign.bind():function(f){for(var p=1;p<arguments.length;p++){var d=arguments[p];for(var c in d)Object.prototype.hasOwnProperty.call(d,c)&&(f[c]=d[c])}return f},b.apply(this,arguments)}function y(f,p,d){return p=S(p),p in f?Object.defineProperty(f,p,{value:d,enumerable:!0,configurable:!0,writable:!0}):f[p]=d,f}function S(f){var p=P(f,"string");return typeof p=="symbol"?p:String(p)}function P(f,p){if(typeof f!="object"||f===null)return f;var d=f[Symbol.toPrimitive];if(d!==void 0){var c=d.call(f,p);if(typeof c!="object")return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return(p==="string"?String:Number)(f)}class x extends t.Component{static getDerivedStateFromProps(p,d){let{position:c}=p,{prevPropsPosition:m}=d;return c&&(!m||c.x!==m.x||c.y!==m.y)?((0,l.default)("Draggable: getDerivedStateFromProps %j",{position:c,prevPropsPosition:m}),{x:c.x,y:c.y,prevPropsPosition:{...c}}):null}constructor(p){super(p),y(this,"onDragStart",(d,c)=>{if((0,l.default)("Draggable: onDragStart: %j",c),this.props.onStart(d,(0,s.createDraggableData)(this,c))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),y(this,"onDrag",(d,c)=>{if(!this.state.dragging)return!1;(0,l.default)("Draggable: onDrag: %j",c);const m=(0,s.createDraggableData)(this,c),v={x:m.x,y:m.y,slackX:0,slackY:0};if(this.props.bounds){const{x:_,y:D}=v;v.x+=this.state.slackX,v.y+=this.state.slackY;const[N,T]=(0,s.getBoundPosition)(this,v.x,v.y);v.x=N,v.y=T,v.slackX=this.state.slackX+(_-v.x),v.slackY=this.state.slackY+(D-v.y),m.x=v.x,m.y=v.y,m.deltaX=v.x-this.state.x,m.deltaY=v.y-this.state.y}if(this.props.onDrag(d,m)===!1)return!1;this.setState(v)}),y(this,"onDragStop",(d,c)=>{if(!this.state.dragging||this.props.onStop(d,(0,s.createDraggableData)(this,c))===!1)return!1;(0,l.default)("Draggable: onDragStop: %j",c);const v={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:_,y:D}=this.props.position;v.x=_,v.y=D}this.setState(v)}),this.state={dragging:!1,dragged:!1,x:p.position?p.position.x:p.defaultPosition.x,y:p.position?p.position.y:p.defaultPosition.y,prevPropsPosition:{...p.position},slackX:0,slackY:0,isElementSVG:!1},p.position&&!(p.onDrag||p.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var p,d;return(p=(d=this.props)===null||d===void 0||(d=d.nodeRef)===null||d===void 0?void 0:d.current)!==null&&p!==void 0?p:n.default.findDOMNode(this)}render(){const{axis:p,bounds:d,children:c,defaultPosition:m,defaultClassName:v,defaultClassNameDragging:R,defaultClassNameDragged:_,position:D,positionOffset:N,scale:T,...O}=this.props;let B={},Y=null;const $=!!!D||this.state.dragging,Q=D||m,tt={x:(0,s.canDragX)(this)&&$?this.state.x:Q.x,y:(0,s.canDragY)(this)&&$?this.state.y:Q.y};this.state.isElementSVG?Y=(0,r.createSVGTransform)(tt,N):B=(0,r.createCSSTransform)(tt,N);const k=(0,o.default)(c.props.className||"",v,{[R]:this.state.dragging,[_]:this.state.dragged});return t.createElement(h.default,b({},O,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(c),{className:k,style:{...c.props.style,...B},transform:Y}))}}i.default=x,y(x,"displayName","Draggable"),y(x,"propTypes",{...h.default.propTypes,axis:e.default.oneOf(["both","x","y","none"]),bounds:e.default.oneOfType([e.default.shape({left:e.default.number,right:e.default.number,top:e.default.number,bottom:e.default.number}),e.default.string,e.default.oneOf([!1])]),defaultClassName:e.default.string,defaultClassNameDragging:e.default.string,defaultClassNameDragged:e.default.string,defaultPosition:e.default.shape({x:e.default.number,y:e.default.number}),positionOffset:e.default.shape({x:e.default.oneOfType([e.default.number,e.default.string]),y:e.default.oneOfType([e.default.number,e.default.string])}),position:e.default.shape({x:e.default.number,y:e.default.number}),className:a.dontSetMe,style:a.dontSetMe,transform:a.dontSetMe}),y(x,"defaultProps",{...h.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(qt);const{default:le,DraggableCore:Ai}=qt;ft.exports=le;ft.exports.default=le;ft.exports.DraggableCore=Ai;var Fi=ft.exports;const Vi=pe(Fi);var E=function(){return E=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(i[o]=t[o])}return i},E.apply(this,arguments)},kt={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},Xt={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},lt={width:"20px",height:"20px",position:"absolute",zIndex:1},Bi={top:E(E({},kt),{top:"-5px"}),right:E(E({},Xt),{left:void 0,right:"-5px"}),bottom:E(E({},kt),{top:void 0,bottom:"-5px"}),left:E(E({},Xt),{left:"-5px"}),topRight:E(E({},lt),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:E(E({},lt),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:E(E({},lt),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:E(E({},lt),{left:"-10px",top:"-10px",cursor:"nw-resize"})},ki=z.memo(function(i){var t=i.onResizeStart,e=i.direction,n=i.children,o=i.replaceStyles,r=i.className,s=z.useCallback(function(l){t(l,e)},[t,e]),a=z.useCallback(function(l){t(l,e)},[t,e]),h=z.useMemo(function(){return E(E({position:"absolute",userSelect:"none"},Bi[e]),o??{})},[o,e]);return L.jsx("div",{className:r||void 0,style:h,onMouseDown:s,onTouchStart:a,children:n})}),Xi=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n[r]=o[r])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),U=function(){return U=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(i[o]=t[o])}return i},U.apply(this,arguments)},Yi={width:"auto",height:"auto"},ht=function(i,t,e){return Math.max(Math.min(i,e),t)},Yt=function(i,t,e){var n=Math.round(i/t);return n*t+e*(n-1)},et=function(i,t){return new RegExp(i,"i").test(t)},ct=function(i){return!!(i.touches&&i.touches.length)},Ui=function(i){return!!((i.clientX||i.clientX===0)&&(i.clientY||i.clientY===0))},Ut=function(i,t,e){e===void 0&&(e=0);var n=t.reduce(function(r,s,a){return Math.abs(s-i)<Math.abs(t[r]-i)?a:r},0),o=Math.abs(t[n]-i);return e===0||o<e?t[n]:i},zt=function(i){return i=i.toString(),i==="auto"||i.endsWith("px")||i.endsWith("%")||i.endsWith("vh")||i.endsWith("vw")||i.endsWith("vmax")||i.endsWith("vmin")?i:"".concat(i,"px")},ut=function(i,t,e,n){if(i&&typeof i=="string"){if(i.endsWith("px"))return Number(i.replace("px",""));if(i.endsWith("%")){var o=Number(i.replace("%",""))/100;return t*o}if(i.endsWith("vw")){var o=Number(i.replace("vw",""))/100;return e*o}if(i.endsWith("vh")){var o=Number(i.replace("vh",""))/100;return n*o}}return i},Gi=function(i,t,e,n,o,r,s){return n=ut(n,i.width,t,e),o=ut(o,i.height,t,e),r=ut(r,i.width,t,e),s=ut(s,i.height,t,e),{maxWidth:typeof n>"u"?void 0:Number(n),maxHeight:typeof o>"u"?void 0:Number(o),minWidth:typeof r>"u"?void 0:Number(r),minHeight:typeof s>"u"?void 0:Number(s)}},ji=function(i){return Array.isArray(i)?i:[i,i]},$i=["as","ref","style","className","grid","gridGap","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],Gt="__resizable_base__",qi=function(i){Xi(t,i);function t(e){var n,o,r,s,a=i.call(this,e)||this;return a.ratio=1,a.resizable=null,a.parentLeft=0,a.parentTop=0,a.resizableLeft=0,a.resizableRight=0,a.resizableTop=0,a.resizableBottom=0,a.targetLeft=0,a.targetTop=0,a.delta={width:0,height:0},a.appendBase=function(){if(!a.resizable||!a.window)return null;var h=a.parentNode;if(!h)return null;var l=a.window.document.createElement("div");return l.style.width="100%",l.style.height="100%",l.style.position="absolute",l.style.transform="scale(0, 0)",l.style.left="0",l.style.flex="0 0 100%",l.classList?l.classList.add(Gt):l.className+=Gt,h.appendChild(l),l},a.removeBase=function(h){var l=a.parentNode;l&&l.removeChild(h)},a.state={isResizing:!1,width:(o=(n=a.propsSize)===null||n===void 0?void 0:n.width)!==null&&o!==void 0?o:"auto",height:(s=(r=a.propsSize)===null||r===void 0?void 0:r.height)!==null&&s!==void 0?s:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},a.onResizeStart=a.onResizeStart.bind(a),a.onMouseMove=a.onMouseMove.bind(a),a.onMouseUp=a.onMouseUp.bind(a),a}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||Yi},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var e=0,n=0;if(this.resizable&&this.window){var o=this.resizable.offsetWidth,r=this.resizable.offsetHeight,s=this.resizable.style.position;s!=="relative"&&(this.resizable.style.position="relative"),e=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:o,n=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:r,this.resizable.style.position=s}return{width:e,height:n}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var e=this,n=this.props.size,o=function(a){var h;if(typeof e.state[a]>"u"||e.state[a]==="auto")return"auto";if(e.propsSize&&e.propsSize[a]&&(!((h=e.propsSize[a])===null||h===void 0)&&h.toString().endsWith("%"))){if(e.state[a].toString().endsWith("%"))return e.state[a].toString();var l=e.getParentSize(),u=Number(e.state[a].toString().replace("px","")),g=u/l[a]*100;return"".concat(g,"%")}return zt(e.state[a])},r=n&&typeof n.width<"u"&&!this.state.isResizing?zt(n.width):o("width"),s=n&&typeof n.height<"u"&&!this.state.isResizing?zt(n.height):o("height");return{width:r,height:s}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var e=this.appendBase();if(!e)return{width:0,height:0};var n=!1,o=this.parentNode.style.flexWrap;o!=="wrap"&&(n=!0,this.parentNode.style.flexWrap="wrap"),e.style.position="relative",e.style.minWidth="100%",e.style.minHeight="100%";var r={width:e.offsetWidth,height:e.offsetHeight};return n&&(this.parentNode.style.flexWrap=o),this.removeBase(e),r},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var e=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:e.flexBasis!=="auto"?e.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(e,n){var o=this.propsSize&&this.propsSize[n];return this.state[n]==="auto"&&this.state.original[n]===e&&(typeof o>"u"||o==="auto")?"auto":e},t.prototype.calculateNewMaxFromBoundary=function(e,n){var o=this.props.boundsByDirection,r=this.state.direction,s=o&&et("left",r),a=o&&et("top",r),h,l;if(this.props.bounds==="parent"){var u=this.parentNode;u&&(h=s?this.resizableRight-this.parentLeft:u.offsetWidth+(this.parentLeft-this.resizableLeft),l=a?this.resizableBottom-this.parentTop:u.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(h=s?this.resizableRight:this.window.innerWidth-this.resizableLeft,l=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(h=s?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),l=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return h&&Number.isFinite(h)&&(e=e&&e<h?e:h),l&&Number.isFinite(l)&&(n=n&&n<l?n:l),{maxWidth:e,maxHeight:n}},t.prototype.calculateNewSizeFromDirection=function(e,n){var o=this.props.scale||1,r=ji(this.props.resizeRatio||1),s=r[0],a=r[1],h=this.state,l=h.direction,u=h.original,g=this.props,w=g.lockAspectRatio,b=g.lockAspectRatioExtraHeight,y=g.lockAspectRatioExtraWidth,S=u.width,P=u.height,x=b||0,f=y||0;return et("right",l)&&(S=u.width+(e-u.x)*s/o,w&&(P=(S-f)/this.ratio+x)),et("left",l)&&(S=u.width-(e-u.x)*s/o,w&&(P=(S-f)/this.ratio+x)),et("bottom",l)&&(P=u.height+(n-u.y)*a/o,w&&(S=(P-x)*this.ratio+f)),et("top",l)&&(P=u.height-(n-u.y)*a/o,w&&(S=(P-x)*this.ratio+f)),{newWidth:S,newHeight:P}},t.prototype.calculateNewSizeFromAspectRatio=function(e,n,o,r){var s=this.props,a=s.lockAspectRatio,h=s.lockAspectRatioExtraHeight,l=s.lockAspectRatioExtraWidth,u=typeof r.width>"u"?10:r.width,g=typeof o.width>"u"||o.width<0?e:o.width,w=typeof r.height>"u"?10:r.height,b=typeof o.height>"u"||o.height<0?n:o.height,y=h||0,S=l||0;if(a){var P=(w-y)*this.ratio+S,x=(b-y)*this.ratio+S,f=(u-S)/this.ratio+y,p=(g-S)/this.ratio+y,d=Math.max(u,P),c=Math.min(g,x),m=Math.max(w,f),v=Math.min(b,p);e=ht(e,d,c),n=ht(n,m,v)}else e=ht(e,u,g),n=ht(n,w,b);return{newWidth:e,newHeight:n}},t.prototype.setBoundingClientRect=function(){var e=1/(this.props.scale||1);if(this.props.bounds==="parent"){var n=this.parentNode;if(n){var o=n.getBoundingClientRect();this.parentLeft=o.left*e,this.parentTop=o.top*e}}if(this.props.bounds&&typeof this.props.bounds!="string"){var r=this.props.bounds.getBoundingClientRect();this.targetLeft=r.left*e,this.targetTop=r.top*e}if(this.resizable){var s=this.resizable.getBoundingClientRect(),a=s.left,h=s.top,l=s.right,u=s.bottom;this.resizableLeft=a*e,this.resizableRight=l*e,this.resizableTop=h*e,this.resizableBottom=u*e}},t.prototype.onResizeStart=function(e,n){if(!(!this.resizable||!this.window)){var o=0,r=0;if(e.nativeEvent&&Ui(e.nativeEvent)?(o=e.nativeEvent.clientX,r=e.nativeEvent.clientY):e.nativeEvent&&ct(e.nativeEvent)&&(o=e.nativeEvent.touches[0].clientX,r=e.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var s=this.props.onResizeStart(e,n,this.resizable);if(s===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var a,h=this.window.getComputedStyle(this.resizable);if(h.flexBasis!=="auto"){var l=this.parentNode;if(l){var u=this.window.getComputedStyle(l).flexDirection;this.flexDir=u.startsWith("row")?"row":"column",a=h.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var g={original:{x:o,y:r,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:U(U({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(e.target).cursor||"auto"}),direction:n,flexBasis:a};this.setState(g)}},t.prototype.onMouseMove=function(e){var n=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&ct(e))try{e.preventDefault(),e.stopPropagation()}catch{}var o=this.props,r=o.maxWidth,s=o.maxHeight,a=o.minWidth,h=o.minHeight,l=ct(e)?e.touches[0].clientX:e.clientX,u=ct(e)?e.touches[0].clientY:e.clientY,g=this.state,w=g.direction,b=g.original,y=g.width,S=g.height,P=this.getParentSize(),x=Gi(P,this.window.innerWidth,this.window.innerHeight,r,s,a,h);r=x.maxWidth,s=x.maxHeight,a=x.minWidth,h=x.minHeight;var f=this.calculateNewSizeFromDirection(l,u),p=f.newHeight,d=f.newWidth,c=this.calculateNewMaxFromBoundary(r,s);this.props.snap&&this.props.snap.x&&(d=Ut(d,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(p=Ut(p,this.props.snap.y,this.props.snapGap));var m=this.calculateNewSizeFromAspectRatio(d,p,{width:c.maxWidth,height:c.maxHeight},{width:a,height:h});if(d=m.newWidth,p=m.newHeight,this.props.grid){var v=Yt(d,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),R=Yt(p,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),_=this.props.snapGap||0,D=_===0||Math.abs(v-d)<=_?v:d,N=_===0||Math.abs(R-p)<=_?R:p;d=D,p=N}var T={width:d-b.width,height:p-b.height};if(this.delta=T,y&&typeof y=="string"){if(y.endsWith("%")){var O=d/P.width*100;d="".concat(O,"%")}else if(y.endsWith("vw")){var B=d/this.window.innerWidth*100;d="".concat(B,"vw")}else if(y.endsWith("vh")){var Y=d/this.window.innerHeight*100;d="".concat(Y,"vh")}}if(S&&typeof S=="string"){if(S.endsWith("%")){var O=p/P.height*100;p="".concat(O,"%")}else if(S.endsWith("vw")){var B=p/this.window.innerWidth*100;p="".concat(B,"vw")}else if(S.endsWith("vh")){var Y=p/this.window.innerHeight*100;p="".concat(Y,"vh")}}var M={width:this.createSizeForCssProperty(d,"width"),height:this.createSizeForCssProperty(p,"height")};this.flexDir==="row"?M.flexBasis=M.width:this.flexDir==="column"&&(M.flexBasis=M.height);var $=this.state.width!==M.width,Q=this.state.height!==M.height,tt=this.state.flexBasis!==M.flexBasis,k=$||Q||tt;k&&dt.flushSync(function(){n.setState(M)}),this.props.onResize&&k&&this.props.onResize(e,w,this.resizable,T)}},t.prototype.onMouseUp=function(e){var n,o,r=this.state,s=r.isResizing,a=r.direction;r.original,!(!s||!this.resizable)&&(this.props.onResizeStop&&this.props.onResizeStop(e,a,this.resizable,this.delta),this.props.size&&this.setState({width:(n=this.props.size.width)!==null&&n!==void 0?n:"auto",height:(o=this.props.size.height)!==null&&o!==void 0?o:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:U(U({},this.state.backgroundStyle),{cursor:"auto"})}))},t.prototype.updateSize=function(e){var n,o;this.setState({width:(n=e.width)!==null&&n!==void 0?n:"auto",height:(o=e.height)!==null&&o!==void 0?o:"auto"})},t.prototype.renderResizer=function(){var e=this,n=this.props,o=n.enable,r=n.handleStyles,s=n.handleClasses,a=n.handleWrapperStyle,h=n.handleWrapperClass,l=n.handleComponent;if(!o)return null;var u=Object.keys(o).map(function(g){return o[g]!==!1?L.jsx(ki,{direction:g,onResizeStart:e.onResizeStart,replaceStyles:r&&r[g],className:s&&s[g],children:l&&l[g]?l[g]:null},g):null});return L.jsx("div",{className:h,style:a,children:u})},t.prototype.render=function(){var e=this,n=Object.keys(this.props).reduce(function(s,a){return $i.indexOf(a)!==-1||(s[a]=e.props[a]),s},{}),o=U(U(U({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(o.flexBasis=this.state.flexBasis);var r=this.props.as||"div";return L.jsxs(r,U({style:o,className:this.props.className},n,{ref:function(s){s&&(e.resizable=s)},children:[this.state.isResizing&&L.jsx("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer()]}))},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(z.PureComponent);/*! *****************************************************************************
3
+ `,i.getElementsByTagName("head")[0].appendChild(t)),i.body&&re(i.body,"react-draggable-transparent-selection")}function Ri(i){if(i)try{if(i.body&&se(i.body,"react-draggable-transparent-selection"),i.selection)i.selection.empty();else{const t=(i.defaultView||window).getSelection();t&&t.type!=="Caret"&&t.removeAllRanges()}}catch{}}function re(i,t){i.classList?i.classList.add(t):i.className.match(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)")))||(i.className+=" ".concat(t))}function se(i,t){i.classList?i.classList.remove(t):i.className=i.className.replace(new RegExp("(?:^|\\s)".concat(t,"(?!\\S)"),"g"),"")}var j={};Object.defineProperty(j,"__esModule",{value:!0});j.canDragX=Ti;j.canDragY=_i;j.createCoreData=Ci;j.createDraggableData=Mi;j.getBoundPosition=zi;j.getControlPosition=Ni;j.snapToGrid=Di;var F=G,it=C;function zi(i,t,e){if(!i.props.bounds)return[t,e];let{bounds:n}=i.props;n=typeof n=="string"?n:Ei(n);const o=Nt(i);if(typeof n=="string"){const{ownerDocument:r}=o,s=r.defaultView;let a;if(n==="parent"?a=o.parentNode:a=r.querySelector(n),!(a instanceof s.HTMLElement))throw new Error('Bounds selector "'+n+'" could not find an element.');const h=a,l=s.getComputedStyle(o),c=s.getComputedStyle(h);n={left:-o.offsetLeft+(0,F.int)(c.paddingLeft)+(0,F.int)(l.marginLeft),top:-o.offsetTop+(0,F.int)(c.paddingTop)+(0,F.int)(l.marginTop),right:(0,it.innerWidth)(h)-(0,it.outerWidth)(o)-o.offsetLeft+(0,F.int)(c.paddingRight)-(0,F.int)(l.marginRight),bottom:(0,it.innerHeight)(h)-(0,it.outerHeight)(o)-o.offsetTop+(0,F.int)(c.paddingBottom)-(0,F.int)(l.marginBottom)}}return(0,F.isNum)(n.right)&&(t=Math.min(t,n.right)),(0,F.isNum)(n.bottom)&&(e=Math.min(e,n.bottom)),(0,F.isNum)(n.left)&&(t=Math.max(t,n.left)),(0,F.isNum)(n.top)&&(e=Math.max(e,n.top)),[t,e]}function Di(i,t,e){const n=Math.round(t/i[0])*i[0],o=Math.round(e/i[1])*i[1];return[n,o]}function Ti(i){return i.props.axis==="both"||i.props.axis==="x"}function _i(i){return i.props.axis==="both"||i.props.axis==="y"}function Ni(i,t,e){const n=typeof t=="number"?(0,it.getTouch)(i,t):null;if(typeof t=="number"&&!n)return null;const o=Nt(e),r=e.props.offsetParent||o.offsetParent||o.ownerDocument.body;return(0,it.offsetXYFromParent)(n||i,r,e.props.scale)}function Ci(i,t,e){const n=!(0,F.isNum)(i.lastX),o=Nt(i);return n?{node:o,deltaX:0,deltaY:0,lastX:t,lastY:e,x:t,y:e}:{node:o,deltaX:t-i.lastX,deltaY:e-i.lastY,lastX:i.lastX,lastY:i.lastY,x:t,y:e}}function Mi(i,t){const e=i.props.scale;return{node:t.node,x:i.state.x+t.deltaX/e,y:i.state.y+t.deltaY/e,deltaX:t.deltaX/e,deltaY:t.deltaY/e,lastX:i.state.x,lastY:i.state.y}}function Ei(i){return{left:i.left,top:i.top,right:i.right,bottom:i.bottom}}function Nt(i){const t=i.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var gt={},mt={};Object.defineProperty(mt,"__esModule",{value:!0});mt.default=Hi;function Hi(){}Object.defineProperty(gt,"__esModule",{value:!0});gt.default=void 0;var Pt=Wi(z),A=Ct(Qt),Li=Ct(dt),W=C,q=j,Rt=G,ot=Ct(mt);function Ct(i){return i&&i.__esModule?i:{default:i}}function ae(i){if(typeof WeakMap!="function")return null;var t=new WeakMap,e=new WeakMap;return(ae=function(n){return n?e:t})(i)}function Wi(i,t){if(i&&i.__esModule)return i;if(i===null||typeof i!="object"&&typeof i!="function")return{default:i};var e=ae(t);if(e&&e.has(i))return e.get(i);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in i)if(r!=="default"&&Object.prototype.hasOwnProperty.call(i,r)){var s=o?Object.getOwnPropertyDescriptor(i,r):null;s&&(s.get||s.set)?Object.defineProperty(n,r,s):n[r]=i[r]}return n.default=i,e&&e.set(i,n),n}function I(i,t,e){return t=Oi(t),t in i?Object.defineProperty(i,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):i[t]=e,i}function Oi(i){var t=Ii(i,"string");return typeof t=="symbol"?t:String(t)}function Ii(i,t){if(typeof i!="object"||i===null)return i;var e=i[Symbol.toPrimitive];if(e!==void 0){var n=e.call(i,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(i)}const X={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let K=X.mouse,vt=class extends Pt.Component{constructor(){super(...arguments),I(this,"dragging",!1),I(this,"lastX",NaN),I(this,"lastY",NaN),I(this,"touchIdentifier",null),I(this,"mounted",!1),I(this,"handleDragStart",t=>{if(this.props.onMouseDown(t),!this.props.allowAnyClick&&typeof t.button=="number"&&t.button!==0)return!1;const e=this.findDOMNode();if(!e||!e.ownerDocument||!e.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:n}=e;if(this.props.disabled||!(t.target instanceof n.defaultView.Node)||this.props.handle&&!(0,W.matchesSelectorAndParentsTo)(t.target,this.props.handle,e)||this.props.cancel&&(0,W.matchesSelectorAndParentsTo)(t.target,this.props.cancel,e))return;t.type==="touchstart"&&t.preventDefault();const o=(0,W.getTouchIdentifier)(t);this.touchIdentifier=o;const r=(0,q.getControlPosition)(t,o,this);if(r==null)return;const{x:s,y:a}=r,h=(0,q.createCoreData)(this,s,a);(0,ot.default)("DraggableCore: handleDragStart: %j",h),(0,ot.default)("calling",this.props.onStart),!(this.props.onStart(t,h)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,W.addUserSelectStyles)(n),this.dragging=!0,this.lastX=s,this.lastY=a,(0,W.addEvent)(n,K.move,this.handleDrag),(0,W.addEvent)(n,K.stop,this.handleDragStop))}),I(this,"handleDrag",t=>{const e=(0,q.getControlPosition)(t,this.touchIdentifier,this);if(e==null)return;let{x:n,y:o}=e;if(Array.isArray(this.props.grid)){let a=n-this.lastX,h=o-this.lastY;if([a,h]=(0,q.snapToGrid)(this.props.grid,a,h),!a&&!h)return;n=this.lastX+a,o=this.lastY+h}const r=(0,q.createCoreData)(this,n,o);if((0,ot.default)("DraggableCore: handleDrag: %j",r),this.props.onDrag(t,r)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const h=document.createEvent("MouseEvents");h.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(h)}return}this.lastX=n,this.lastY=o}),I(this,"handleDragStop",t=>{if(!this.dragging)return;const e=(0,q.getControlPosition)(t,this.touchIdentifier,this);if(e==null)return;let{x:n,y:o}=e;if(Array.isArray(this.props.grid)){let h=n-this.lastX||0,l=o-this.lastY||0;[h,l]=(0,q.snapToGrid)(this.props.grid,h,l),n=this.lastX+h,o=this.lastY+l}const r=(0,q.createCoreData)(this,n,o);if(this.props.onStop(t,r)===!1||this.mounted===!1)return!1;const a=this.findDOMNode();a&&this.props.enableUserSelectHack&&(0,W.removeUserSelectStyles)(a.ownerDocument),(0,ot.default)("DraggableCore: handleDragStop: %j",r),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&((0,ot.default)("DraggableCore: Removing handlers"),(0,W.removeEvent)(a.ownerDocument,K.move,this.handleDrag),(0,W.removeEvent)(a.ownerDocument,K.stop,this.handleDragStop))}),I(this,"onMouseDown",t=>(K=X.mouse,this.handleDragStart(t))),I(this,"onMouseUp",t=>(K=X.mouse,this.handleDragStop(t))),I(this,"onTouchStart",t=>(K=X.touch,this.handleDragStart(t))),I(this,"onTouchEnd",t=>(K=X.touch,this.handleDragStop(t)))}componentDidMount(){this.mounted=!0;const t=this.findDOMNode();t&&(0,W.addEvent)(t,X.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const t=this.findDOMNode();if(t){const{ownerDocument:e}=t;(0,W.removeEvent)(e,X.mouse.move,this.handleDrag),(0,W.removeEvent)(e,X.touch.move,this.handleDrag),(0,W.removeEvent)(e,X.mouse.stop,this.handleDragStop),(0,W.removeEvent)(e,X.touch.stop,this.handleDragStop),(0,W.removeEvent)(t,X.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,W.removeUserSelectStyles)(e)}}findDOMNode(){var t,e;return(t=this.props)!==null&&t!==void 0&&t.nodeRef?(e=this.props)===null||e===void 0||(e=e.nodeRef)===null||e===void 0?void 0:e.current:Li.default.findDOMNode(this)}render(){return Pt.cloneElement(Pt.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};gt.default=vt;I(vt,"displayName","DraggableCore");I(vt,"propTypes",{allowAnyClick:A.default.bool,children:A.default.node.isRequired,disabled:A.default.bool,enableUserSelectHack:A.default.bool,offsetParent:function(i,t){if(i[t]&&i[t].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:A.default.arrayOf(A.default.number),handle:A.default.string,cancel:A.default.string,nodeRef:A.default.object,onStart:A.default.func,onDrag:A.default.func,onStop:A.default.func,onMouseDown:A.default.func,scale:A.default.number,className:Rt.dontSetMe,style:Rt.dontSetMe,transform:Rt.dontSetMe});I(vt,"defaultProps",{allowAnyClick:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1});(function(i){Object.defineProperty(i,"__esModule",{value:!0}),Object.defineProperty(i,"DraggableCore",{enumerable:!0,get:function(){return h.default}}),i.default=void 0;var t=y(z),e=c(Qt),n=c(dt),o=c(ii),r=C,s=j,a=G,h=c(gt),l=c(mt);function c(f){return f&&f.__esModule?f:{default:f}}function g(f){if(typeof WeakMap!="function")return null;var p=new WeakMap,d=new WeakMap;return(g=function(u){return u?d:p})(f)}function y(f,p){if(f&&f.__esModule)return f;if(f===null||typeof f!="object"&&typeof f!="function")return{default:f};var d=g(p);if(d&&d.has(f))return d.get(f);var u={},m=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var v in f)if(v!=="default"&&Object.prototype.hasOwnProperty.call(f,v)){var R=m?Object.getOwnPropertyDescriptor(f,v):null;R&&(R.get||R.set)?Object.defineProperty(u,v,R):u[v]=f[v]}return u.default=f,d&&d.set(f,u),u}function b(){return b=Object.assign?Object.assign.bind():function(f){for(var p=1;p<arguments.length;p++){var d=arguments[p];for(var u in d)Object.prototype.hasOwnProperty.call(d,u)&&(f[u]=d[u])}return f},b.apply(this,arguments)}function w(f,p,d){return p=S(p),p in f?Object.defineProperty(f,p,{value:d,enumerable:!0,configurable:!0,writable:!0}):f[p]=d,f}function S(f){var p=P(f,"string");return typeof p=="symbol"?p:String(p)}function P(f,p){if(typeof f!="object"||f===null)return f;var d=f[Symbol.toPrimitive];if(d!==void 0){var u=d.call(f,p);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(p==="string"?String:Number)(f)}class x extends t.Component{static getDerivedStateFromProps(p,d){let{position:u}=p,{prevPropsPosition:m}=d;return u&&(!m||u.x!==m.x||u.y!==m.y)?((0,l.default)("Draggable: getDerivedStateFromProps %j",{position:u,prevPropsPosition:m}),{x:u.x,y:u.y,prevPropsPosition:{...u}}):null}constructor(p){super(p),w(this,"onDragStart",(d,u)=>{if((0,l.default)("Draggable: onDragStart: %j",u),this.props.onStart(d,(0,s.createDraggableData)(this,u))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),w(this,"onDrag",(d,u)=>{if(!this.state.dragging)return!1;(0,l.default)("Draggable: onDrag: %j",u);const m=(0,s.createDraggableData)(this,u),v={x:m.x,y:m.y,slackX:0,slackY:0};if(this.props.bounds){const{x:_,y:D}=v;v.x+=this.state.slackX,v.y+=this.state.slackY;const[N,T]=(0,s.getBoundPosition)(this,v.x,v.y);v.x=N,v.y=T,v.slackX=this.state.slackX+(_-v.x),v.slackY=this.state.slackY+(D-v.y),m.x=v.x,m.y=v.y,m.deltaX=v.x-this.state.x,m.deltaY=v.y-this.state.y}if(this.props.onDrag(d,m)===!1)return!1;this.setState(v)}),w(this,"onDragStop",(d,u)=>{if(!this.state.dragging||this.props.onStop(d,(0,s.createDraggableData)(this,u))===!1)return!1;(0,l.default)("Draggable: onDragStop: %j",u);const v={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:_,y:D}=this.props.position;v.x=_,v.y=D}this.setState(v)}),this.state={dragging:!1,dragged:!1,x:p.position?p.position.x:p.defaultPosition.x,y:p.position?p.position.y:p.defaultPosition.y,prevPropsPosition:{...p.position},slackX:0,slackY:0,isElementSVG:!1},p.position&&!(p.onDrag||p.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.setState({dragging:!1})}findDOMNode(){var p,d;return(p=(d=this.props)===null||d===void 0||(d=d.nodeRef)===null||d===void 0?void 0:d.current)!==null&&p!==void 0?p:n.default.findDOMNode(this)}render(){const{axis:p,bounds:d,children:u,defaultPosition:m,defaultClassName:v,defaultClassNameDragging:R,defaultClassNameDragged:_,position:D,positionOffset:N,scale:T,...O}=this.props;let V={},Y=null;const $=!!!D||this.state.dragging,Q=D||m,tt={x:(0,s.canDragX)(this)&&$?this.state.x:Q.x,y:(0,s.canDragY)(this)&&$?this.state.y:Q.y};this.state.isElementSVG?Y=(0,r.createSVGTransform)(tt,N):V=(0,r.createCSSTransform)(tt,N);const B=(0,o.default)(u.props.className||"",v,{[R]:this.state.dragging,[_]:this.state.dragged});return t.createElement(h.default,b({},O,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),t.cloneElement(t.Children.only(u),{className:B,style:{...u.props.style,...V},transform:Y}))}}i.default=x,w(x,"displayName","Draggable"),w(x,"propTypes",{...h.default.propTypes,axis:e.default.oneOf(["both","x","y","none"]),bounds:e.default.oneOfType([e.default.shape({left:e.default.number,right:e.default.number,top:e.default.number,bottom:e.default.number}),e.default.string,e.default.oneOf([!1])]),defaultClassName:e.default.string,defaultClassNameDragging:e.default.string,defaultClassNameDragged:e.default.string,defaultPosition:e.default.shape({x:e.default.number,y:e.default.number}),positionOffset:e.default.shape({x:e.default.oneOfType([e.default.number,e.default.string]),y:e.default.oneOfType([e.default.number,e.default.string])}),position:e.default.shape({x:e.default.number,y:e.default.number}),className:a.dontSetMe,style:a.dontSetMe,transform:a.dontSetMe}),w(x,"defaultProps",{...h.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(qt);const{default:le,DraggableCore:Ai}=qt;ft.exports=le;ft.exports.default=le;ft.exports.DraggableCore=Ai;var Fi=ft.exports;const ki=pe(Fi);var E=function(){return E=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(i[o]=t[o])}return i},E.apply(this,arguments)},Bt={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},Xt={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},lt={width:"20px",height:"20px",position:"absolute",zIndex:1},Vi={top:E(E({},Bt),{top:"-5px"}),right:E(E({},Xt),{left:void 0,right:"-5px"}),bottom:E(E({},Bt),{top:void 0,bottom:"-5px"}),left:E(E({},Xt),{left:"-5px"}),topRight:E(E({},lt),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:E(E({},lt),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:E(E({},lt),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:E(E({},lt),{left:"-10px",top:"-10px",cursor:"nw-resize"})},Bi=z.memo(function(i){var t=i.onResizeStart,e=i.direction,n=i.children,o=i.replaceStyles,r=i.className,s=z.useCallback(function(l){t(l,e)},[t,e]),a=z.useCallback(function(l){t(l,e)},[t,e]),h=z.useMemo(function(){return E(E({position:"absolute",userSelect:"none"},Vi[e]),o??{})},[o,e]);return L.jsx("div",{className:r||void 0,style:h,onMouseDown:s,onTouchStart:a,children:n})}),Xi=function(){var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(n[r]=o[r])},i(t,e)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");i(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}}(),U=function(){return U=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(i[o]=t[o])}return i},U.apply(this,arguments)},Yi={width:"auto",height:"auto"},ht=function(i,t,e){return Math.max(Math.min(i,e),t)},Yt=function(i,t,e){var n=Math.round(i/t);return n*t+e*(n-1)},et=function(i,t){return new RegExp(i,"i").test(t)},ct=function(i){return!!(i.touches&&i.touches.length)},Ui=function(i){return!!((i.clientX||i.clientX===0)&&(i.clientY||i.clientY===0))},Ut=function(i,t,e){e===void 0&&(e=0);var n=t.reduce(function(r,s,a){return Math.abs(s-i)<Math.abs(t[r]-i)?a:r},0),o=Math.abs(t[n]-i);return e===0||o<e?t[n]:i},zt=function(i){return i=i.toString(),i==="auto"||i.endsWith("px")||i.endsWith("%")||i.endsWith("vh")||i.endsWith("vw")||i.endsWith("vmax")||i.endsWith("vmin")?i:"".concat(i,"px")},ut=function(i,t,e,n){if(i&&typeof i=="string"){if(i.endsWith("px"))return Number(i.replace("px",""));if(i.endsWith("%")){var o=Number(i.replace("%",""))/100;return t*o}if(i.endsWith("vw")){var o=Number(i.replace("vw",""))/100;return e*o}if(i.endsWith("vh")){var o=Number(i.replace("vh",""))/100;return n*o}}return i},Gi=function(i,t,e,n,o,r,s){return n=ut(n,i.width,t,e),o=ut(o,i.height,t,e),r=ut(r,i.width,t,e),s=ut(s,i.height,t,e),{maxWidth:typeof n>"u"?void 0:Number(n),maxHeight:typeof o>"u"?void 0:Number(o),minWidth:typeof r>"u"?void 0:Number(r),minHeight:typeof s>"u"?void 0:Number(s)}},ji=function(i){return Array.isArray(i)?i:[i,i]},$i=["as","ref","style","className","grid","gridGap","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],Gt="__resizable_base__",qi=function(i){Xi(t,i);function t(e){var n,o,r,s,a=i.call(this,e)||this;return a.ratio=1,a.resizable=null,a.parentLeft=0,a.parentTop=0,a.resizableLeft=0,a.resizableRight=0,a.resizableTop=0,a.resizableBottom=0,a.targetLeft=0,a.targetTop=0,a.delta={width:0,height:0},a.appendBase=function(){if(!a.resizable||!a.window)return null;var h=a.parentNode;if(!h)return null;var l=a.window.document.createElement("div");return l.style.width="100%",l.style.height="100%",l.style.position="absolute",l.style.transform="scale(0, 0)",l.style.left="0",l.style.flex="0 0 100%",l.classList?l.classList.add(Gt):l.className+=Gt,h.appendChild(l),l},a.removeBase=function(h){var l=a.parentNode;l&&l.removeChild(h)},a.state={isResizing:!1,width:(o=(n=a.propsSize)===null||n===void 0?void 0:n.width)!==null&&o!==void 0?o:"auto",height:(s=(r=a.propsSize)===null||r===void 0?void 0:r.height)!==null&&s!==void 0?s:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},a.onResizeStart=a.onResizeStart.bind(a),a.onMouseMove=a.onMouseMove.bind(a),a.onMouseUp=a.onMouseUp.bind(a),a}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||Yi},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var e=0,n=0;if(this.resizable&&this.window){var o=this.resizable.offsetWidth,r=this.resizable.offsetHeight,s=this.resizable.style.position;s!=="relative"&&(this.resizable.style.position="relative"),e=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:o,n=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:r,this.resizable.style.position=s}return{width:e,height:n}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var e=this,n=this.props.size,o=function(a){var h;if(typeof e.state[a]>"u"||e.state[a]==="auto")return"auto";if(e.propsSize&&e.propsSize[a]&&(!((h=e.propsSize[a])===null||h===void 0)&&h.toString().endsWith("%"))){if(e.state[a].toString().endsWith("%"))return e.state[a].toString();var l=e.getParentSize(),c=Number(e.state[a].toString().replace("px","")),g=c/l[a]*100;return"".concat(g,"%")}return zt(e.state[a])},r=n&&typeof n.width<"u"&&!this.state.isResizing?zt(n.width):o("width"),s=n&&typeof n.height<"u"&&!this.state.isResizing?zt(n.height):o("height");return{width:r,height:s}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var e=this.appendBase();if(!e)return{width:0,height:0};var n=!1,o=this.parentNode.style.flexWrap;o!=="wrap"&&(n=!0,this.parentNode.style.flexWrap="wrap"),e.style.position="relative",e.style.minWidth="100%",e.style.minHeight="100%";var r={width:e.offsetWidth,height:e.offsetHeight};return n&&(this.parentNode.style.flexWrap=o),this.removeBase(e),r},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var e=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:e.flexBasis!=="auto"?e.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(e,n){var o=this.propsSize&&this.propsSize[n];return this.state[n]==="auto"&&this.state.original[n]===e&&(typeof o>"u"||o==="auto")?"auto":e},t.prototype.calculateNewMaxFromBoundary=function(e,n){var o=this.props.boundsByDirection,r=this.state.direction,s=o&&et("left",r),a=o&&et("top",r),h,l;if(this.props.bounds==="parent"){var c=this.parentNode;c&&(h=s?this.resizableRight-this.parentLeft:c.offsetWidth+(this.parentLeft-this.resizableLeft),l=a?this.resizableBottom-this.parentTop:c.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(h=s?this.resizableRight:this.window.innerWidth-this.resizableLeft,l=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(h=s?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),l=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return h&&Number.isFinite(h)&&(e=e&&e<h?e:h),l&&Number.isFinite(l)&&(n=n&&n<l?n:l),{maxWidth:e,maxHeight:n}},t.prototype.calculateNewSizeFromDirection=function(e,n){var o=this.props.scale||1,r=ji(this.props.resizeRatio||1),s=r[0],a=r[1],h=this.state,l=h.direction,c=h.original,g=this.props,y=g.lockAspectRatio,b=g.lockAspectRatioExtraHeight,w=g.lockAspectRatioExtraWidth,S=c.width,P=c.height,x=b||0,f=w||0;return et("right",l)&&(S=c.width+(e-c.x)*s/o,y&&(P=(S-f)/this.ratio+x)),et("left",l)&&(S=c.width-(e-c.x)*s/o,y&&(P=(S-f)/this.ratio+x)),et("bottom",l)&&(P=c.height+(n-c.y)*a/o,y&&(S=(P-x)*this.ratio+f)),et("top",l)&&(P=c.height-(n-c.y)*a/o,y&&(S=(P-x)*this.ratio+f)),{newWidth:S,newHeight:P}},t.prototype.calculateNewSizeFromAspectRatio=function(e,n,o,r){var s=this.props,a=s.lockAspectRatio,h=s.lockAspectRatioExtraHeight,l=s.lockAspectRatioExtraWidth,c=typeof r.width>"u"?10:r.width,g=typeof o.width>"u"||o.width<0?e:o.width,y=typeof r.height>"u"?10:r.height,b=typeof o.height>"u"||o.height<0?n:o.height,w=h||0,S=l||0;if(a){var P=(y-w)*this.ratio+S,x=(b-w)*this.ratio+S,f=(c-S)/this.ratio+w,p=(g-S)/this.ratio+w,d=Math.max(c,P),u=Math.min(g,x),m=Math.max(y,f),v=Math.min(b,p);e=ht(e,d,u),n=ht(n,m,v)}else e=ht(e,c,g),n=ht(n,y,b);return{newWidth:e,newHeight:n}},t.prototype.setBoundingClientRect=function(){var e=1/(this.props.scale||1);if(this.props.bounds==="parent"){var n=this.parentNode;if(n){var o=n.getBoundingClientRect();this.parentLeft=o.left*e,this.parentTop=o.top*e}}if(this.props.bounds&&typeof this.props.bounds!="string"){var r=this.props.bounds.getBoundingClientRect();this.targetLeft=r.left*e,this.targetTop=r.top*e}if(this.resizable){var s=this.resizable.getBoundingClientRect(),a=s.left,h=s.top,l=s.right,c=s.bottom;this.resizableLeft=a*e,this.resizableRight=l*e,this.resizableTop=h*e,this.resizableBottom=c*e}},t.prototype.onResizeStart=function(e,n){if(!(!this.resizable||!this.window)){var o=0,r=0;if(e.nativeEvent&&Ui(e.nativeEvent)?(o=e.nativeEvent.clientX,r=e.nativeEvent.clientY):e.nativeEvent&&ct(e.nativeEvent)&&(o=e.nativeEvent.touches[0].clientX,r=e.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var s=this.props.onResizeStart(e,n,this.resizable);if(s===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var a,h=this.window.getComputedStyle(this.resizable);if(h.flexBasis!=="auto"){var l=this.parentNode;if(l){var c=this.window.getComputedStyle(l).flexDirection;this.flexDir=c.startsWith("row")?"row":"column",a=h.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var g={original:{x:o,y:r,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:U(U({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(e.target).cursor||"auto"}),direction:n,flexBasis:a};this.setState(g)}},t.prototype.onMouseMove=function(e){var n=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&ct(e))try{e.preventDefault(),e.stopPropagation()}catch{}var o=this.props,r=o.maxWidth,s=o.maxHeight,a=o.minWidth,h=o.minHeight,l=ct(e)?e.touches[0].clientX:e.clientX,c=ct(e)?e.touches[0].clientY:e.clientY,g=this.state,y=g.direction,b=g.original,w=g.width,S=g.height,P=this.getParentSize(),x=Gi(P,this.window.innerWidth,this.window.innerHeight,r,s,a,h);r=x.maxWidth,s=x.maxHeight,a=x.minWidth,h=x.minHeight;var f=this.calculateNewSizeFromDirection(l,c),p=f.newHeight,d=f.newWidth,u=this.calculateNewMaxFromBoundary(r,s);this.props.snap&&this.props.snap.x&&(d=Ut(d,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(p=Ut(p,this.props.snap.y,this.props.snapGap));var m=this.calculateNewSizeFromAspectRatio(d,p,{width:u.maxWidth,height:u.maxHeight},{width:a,height:h});if(d=m.newWidth,p=m.newHeight,this.props.grid){var v=Yt(d,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),R=Yt(p,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),_=this.props.snapGap||0,D=_===0||Math.abs(v-d)<=_?v:d,N=_===0||Math.abs(R-p)<=_?R:p;d=D,p=N}var T={width:d-b.width,height:p-b.height};if(this.delta=T,w&&typeof w=="string"){if(w.endsWith("%")){var O=d/P.width*100;d="".concat(O,"%")}else if(w.endsWith("vw")){var V=d/this.window.innerWidth*100;d="".concat(V,"vw")}else if(w.endsWith("vh")){var Y=d/this.window.innerHeight*100;d="".concat(Y,"vh")}}if(S&&typeof S=="string"){if(S.endsWith("%")){var O=p/P.height*100;p="".concat(O,"%")}else if(S.endsWith("vw")){var V=p/this.window.innerWidth*100;p="".concat(V,"vw")}else if(S.endsWith("vh")){var Y=p/this.window.innerHeight*100;p="".concat(Y,"vh")}}var M={width:this.createSizeForCssProperty(d,"width"),height:this.createSizeForCssProperty(p,"height")};this.flexDir==="row"?M.flexBasis=M.width:this.flexDir==="column"&&(M.flexBasis=M.height);var $=this.state.width!==M.width,Q=this.state.height!==M.height,tt=this.state.flexBasis!==M.flexBasis,B=$||Q||tt;B&&dt.flushSync(function(){n.setState(M)}),this.props.onResize&&B&&this.props.onResize(e,y,this.resizable,T)}},t.prototype.onMouseUp=function(e){var n,o,r=this.state,s=r.isResizing,a=r.direction;r.original,!(!s||!this.resizable)&&(this.props.onResizeStop&&this.props.onResizeStop(e,a,this.resizable,this.delta),this.props.size&&this.setState({width:(n=this.props.size.width)!==null&&n!==void 0?n:"auto",height:(o=this.props.size.height)!==null&&o!==void 0?o:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:U(U({},this.state.backgroundStyle),{cursor:"auto"})}))},t.prototype.updateSize=function(e){var n,o;this.setState({width:(n=e.width)!==null&&n!==void 0?n:"auto",height:(o=e.height)!==null&&o!==void 0?o:"auto"})},t.prototype.renderResizer=function(){var e=this,n=this.props,o=n.enable,r=n.handleStyles,s=n.handleClasses,a=n.handleWrapperStyle,h=n.handleWrapperClass,l=n.handleComponent;if(!o)return null;var c=Object.keys(o).map(function(g){return o[g]!==!1?L.jsx(Bi,{direction:g,onResizeStart:e.onResizeStart,replaceStyles:r&&r[g],className:s&&s[g],children:l&&l[g]?l[g]:null},g):null});return L.jsx("div",{className:h,style:a,children:c})},t.prototype.render=function(){var e=this,n=Object.keys(this.props).reduce(function(s,a){return $i.indexOf(a)!==-1||(s[a]=e.props[a]),s},{}),o=U(U(U({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(o.flexBasis=this.state.flexBasis);var r=this.props.as||"div";return L.jsxs(r,U({style:o,className:this.props.className},n,{ref:function(s){s&&(e.resizable=s)},children:[this.state.isResizing&&L.jsx("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer()]}))},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(z.PureComponent);/*! *****************************************************************************
4
4
  Copyright (c) Microsoft Corporation. All rights reserved.
5
5
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
6
6
  this file except in compliance with the License. You may obtain a copy of the
@@ -13,4 +13,4 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
13
13
 
14
14
  See the Apache Version 2.0 License for specific language governing permissions
15
15
  and limitations under the License.
16
- ***************************************************************************** */var Tt=function(i,t){return Tt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var o in n)n.hasOwnProperty(o)&&(e[o]=n[o])},Tt(i,t)};function Ki(i,t){Tt(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var H=function(){return H=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},H.apply(this,arguments)};function Zi(i,t){var e={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&t.indexOf(n)<0&&(e[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(i);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(i,n[o])&&(e[n[o]]=i[n[o]]);return e}var Ji={width:"auto",height:"auto",display:"inline-block",position:"absolute",top:0,left:0},Qi=function(i){return{bottom:i,bottomLeft:i,bottomRight:i,left:i,right:i,top:i,topLeft:i,topRight:i}},un=function(i){Ki(t,i);function t(e){var n=i.call(this,e)||this;return n.resizingPosition={x:0,y:0},n.offsetFromParent={left:0,top:0},n.resizableElement={current:null},n.originalPosition={x:0,y:0},n.state={resizing:!1,bounds:{top:0,right:0,bottom:0,left:0},maxWidth:e.maxWidth,maxHeight:e.maxHeight},n.onResizeStart=n.onResizeStart.bind(n),n.onResize=n.onResize.bind(n),n.onResizeStop=n.onResizeStop.bind(n),n.onDragStart=n.onDragStart.bind(n),n.onDrag=n.onDrag.bind(n),n.onDragStop=n.onDragStop.bind(n),n.getMaxSizesFromProps=n.getMaxSizesFromProps.bind(n),n}return t.prototype.componentDidMount=function(){this.updateOffsetFromParent();var e=this.offsetFromParent,n=e.left,o=e.top,r=this.getDraggablePosition(),s=r.x,a=r.y;this.draggable.setState({x:s-n,y:a-o}),this.forceUpdate()},t.prototype.getDraggablePosition=function(){var e=this.draggable.state,n=e.x,o=e.y;return{x:n,y:o}},t.prototype.getParent=function(){return this.resizable&&this.resizable.parentNode},t.prototype.getParentSize=function(){return this.resizable.getParentSize()},t.prototype.getMaxSizesFromProps=function(){var e=typeof this.props.maxWidth>"u"?Number.MAX_SAFE_INTEGER:this.props.maxWidth,n=typeof this.props.maxHeight>"u"?Number.MAX_SAFE_INTEGER:this.props.maxHeight;return{maxWidth:e,maxHeight:n}},t.prototype.getSelfElement=function(){return this.resizable&&this.resizable.resizable},t.prototype.getOffsetHeight=function(e){var n=this.props.scale;switch(this.props.bounds){case"window":return window.innerHeight/n;case"body":return document.body.offsetHeight/n;default:return e.offsetHeight}},t.prototype.getOffsetWidth=function(e){var n=this.props.scale;switch(this.props.bounds){case"window":return window.innerWidth/n;case"body":return document.body.offsetWidth/n;default:return e.offsetWidth}},t.prototype.onDragStart=function(e,n){this.props.onDragStart&&this.props.onDragStart(e,n);var o=this.getDraggablePosition();if(this.originalPosition=o,!!this.props.bounds){var r=this.getParent(),s=this.props.scale,a;if(this.props.bounds==="parent")a=r;else if(this.props.bounds==="body"){var h=r.getBoundingClientRect(),l=h.left,u=h.top,g=document.body.getBoundingClientRect(),w=-(l-r.offsetLeft*s-g.left)/s,b=-(u-r.offsetTop*s-g.top)/s,y=(document.body.offsetWidth-this.resizable.size.width*s)/s+w,S=(document.body.offsetHeight-this.resizable.size.height*s)/s+b;return this.setState({bounds:{top:b,right:y,bottom:S,left:w}})}else if(this.props.bounds==="window"){if(!this.resizable)return;var P=r.getBoundingClientRect(),x=P.left,f=P.top,p=-(x-r.offsetLeft*s)/s,d=-(f-r.offsetTop*s)/s,y=(window.innerWidth-this.resizable.size.width*s)/s+p,S=(window.innerHeight-this.resizable.size.height*s)/s+d;return this.setState({bounds:{top:d,right:y,bottom:S,left:p}})}else typeof this.props.bounds=="string"?a=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(a=this.props.bounds);if(!(!(a instanceof HTMLElement)||!(r instanceof HTMLElement))){var c=a.getBoundingClientRect(),m=c.left,v=c.top,R=r.getBoundingClientRect(),_=R.left,D=R.top,N=(m-_)/s,T=v-D;if(this.resizable){this.updateOffsetFromParent();var O=this.offsetFromParent;this.setState({bounds:{top:T-O.top,right:N+(a.offsetWidth-this.resizable.size.width)-O.left/s,bottom:T+(a.offsetHeight-this.resizable.size.height)-O.top,left:N-O.left/s}})}}}},t.prototype.onDrag=function(e,n){if(this.props.onDrag){var o=this.offsetFromParent,r=o.left,s=o.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDrag(e,H(H({},n),{x:n.x+r,y:n.y+s}));if(this.props.dragAxis==="x")return this.props.onDrag(e,H(H({},n),{x:n.x+r,y:this.originalPosition.y+s,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDrag(e,H(H({},n),{x:this.originalPosition.x+r,y:n.y+s,deltaX:0}))}},t.prototype.onDragStop=function(e,n){if(this.props.onDragStop){var o=this.offsetFromParent,r=o.left,s=o.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDragStop(e,H(H({},n),{x:n.x+r,y:n.y+s}));if(this.props.dragAxis==="x")return this.props.onDragStop(e,H(H({},n),{x:n.x+r,y:this.originalPosition.y+s,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDragStop(e,H(H({},n),{x:this.originalPosition.x+r,y:n.y+s,deltaX:0}))}},t.prototype.onResizeStart=function(e,n,o){e.stopPropagation(),this.setState({resizing:!0});var r=this.props.scale,s=this.offsetFromParent,a=this.getDraggablePosition();if(this.resizingPosition={x:a.x+s.left,y:a.y+s.top},this.originalPosition=a,this.props.bounds){var h=this.getParent(),l=void 0;this.props.bounds==="parent"?l=h:this.props.bounds==="body"?l=document.body:this.props.bounds==="window"?l=window:typeof this.props.bounds=="string"?l=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(l=this.props.bounds);var u=this.getSelfElement();if(u instanceof Element&&(l instanceof HTMLElement||l===window)&&h instanceof HTMLElement){var g=this.getMaxSizesFromProps(),w=g.maxWidth,b=g.maxHeight,y=this.getParentSize();if(w&&typeof w=="string")if(w.endsWith("%")){var S=Number(w.replace("%",""))/100;w=y.width*S}else w.endsWith("px")&&(w=Number(w.replace("px","")));if(b&&typeof b=="string")if(b.endsWith("%")){var S=Number(b.replace("%",""))/100;b=y.height*S}else b.endsWith("px")&&(b=Number(b.replace("px","")));var P=u.getBoundingClientRect(),x=P.left,f=P.top,p=this.props.bounds==="window"?{left:0,top:0}:l.getBoundingClientRect(),d=p.left,c=p.top,m=this.getOffsetWidth(l),v=this.getOffsetHeight(l),R=n.toLowerCase().endsWith("left"),_=n.toLowerCase().endsWith("right"),D=n.startsWith("top"),N=n.startsWith("bottom");if((R||D)&&this.resizable){var T=(x-d)/r+this.resizable.size.width;this.setState({maxWidth:T>Number(w)?w:T})}if(_||this.props.lockAspectRatio&&!R&&!D){var T=m+(d-x)/r;this.setState({maxWidth:T>Number(w)?w:T})}if((D||R)&&this.resizable){var T=(f-c)/r+this.resizable.size.height;this.setState({maxHeight:T>Number(b)?b:T})}if(N||this.props.lockAspectRatio&&!D&&!R){var T=v+(c-f)/r;this.setState({maxHeight:T>Number(b)?b:T})}}}else this.setState({maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight});this.props.onResizeStart&&this.props.onResizeStart(e,n,o)},t.prototype.onResize=function(e,n,o,r){var s=this,a={x:this.originalPosition.x,y:this.originalPosition.y},h=-r.width,l=-r.height,u=["top","left","topLeft","bottomLeft","topRight"];u.includes(n)&&(n==="bottomLeft"?a.x+=h:(n==="topRight"||(a.x+=h),a.y+=l));var g=this.draggable.state;(a.x!==g.x||a.y!==g.y)&&dt.flushSync(function(){s.draggable.setState(a)}),this.updateOffsetFromParent();var w=this.offsetFromParent,b=this.getDraggablePosition().x+w.left,y=this.getDraggablePosition().y+w.top;this.resizingPosition={x:b,y},this.props.onResize&&this.props.onResize(e,n,o,r,{x:b,y})},t.prototype.onResizeStop=function(e,n,o,r){this.setState({resizing:!1});var s=this.getMaxSizesFromProps(),a=s.maxWidth,h=s.maxHeight;this.setState({maxWidth:a,maxHeight:h}),this.props.onResizeStop&&this.props.onResizeStop(e,n,o,r,this.resizingPosition)},t.prototype.updateSize=function(e){this.resizable&&this.resizable.updateSize({width:e.width,height:e.height})},t.prototype.updatePosition=function(e){this.draggable.setState(e)},t.prototype.updateOffsetFromParent=function(){var e=this.props.scale,n=this.getParent(),o=this.getSelfElement();if(!n||o===null)return{top:0,left:0};var r=n.getBoundingClientRect(),s=r.left,a=r.top,h=o.getBoundingClientRect(),l=this.getDraggablePosition(),u=n.scrollLeft,g=n.scrollTop;this.offsetFromParent={left:h.left-s+u-l.x*e,top:h.top-a+g-l.y*e}},t.prototype.render=function(){var e=this,n=this.props,o=n.disableDragging,r=n.style,s=n.dragHandleClassName,a=n.position,h=n.onMouseDown,l=n.onMouseUp,u=n.dragAxis,g=n.dragGrid,w=n.bounds,b=n.enableUserSelectHack,y=n.cancel,S=n.children;n.onResizeStart,n.onResize,n.onResizeStop,n.onDragStart,n.onDrag,n.onDragStop;var P=n.resizeHandleStyles,x=n.resizeHandleClasses,f=n.resizeHandleComponent,p=n.enableResizing,d=n.resizeGrid,c=n.resizeHandleWrapperClass,m=n.resizeHandleWrapperStyle,v=n.scale,R=n.allowAnyClick,_=n.dragPositionOffset,D=Zi(n,["disableDragging","style","dragHandleClassName","position","onMouseDown","onMouseUp","dragAxis","dragGrid","bounds","enableUserSelectHack","cancel","children","onResizeStart","onResize","onResizeStop","onDragStart","onDrag","onDragStop","resizeHandleStyles","resizeHandleClasses","resizeHandleComponent","enableResizing","resizeGrid","resizeHandleWrapperClass","resizeHandleWrapperStyle","scale","allowAnyClick","dragPositionOffset"]),N=this.props.default?H({},this.props.default):void 0;delete D.default;var T=o||s?{cursor:"auto"}:{cursor:"move"},O=H(H(H({},Ji),T),r),B=this.offsetFromParent,Y=B.left,M=B.top,$;a&&($={x:a.x-Y,y:a.y-M});var Q=this.state.resizing?void 0:$,tt=this.state.resizing?"both":u;return z.createElement(Vi,{ref:function(k){k&&(e.draggable=k)},handle:s?".".concat(s):void 0,defaultPosition:N,onMouseDown:h,onMouseUp:l,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,axis:tt,disabled:o,grid:g,bounds:w?this.state.bounds:void 0,position:Q,enableUserSelectHack:b,cancel:y,scale:v,allowAnyClick:R,nodeRef:this.resizableElement,positionOffset:_},z.createElement(qi,H({},D,{ref:function(k){k&&(e.resizable=k,e.resizableElement.current=k.resizable)},defaultSize:N,size:this.props.size,enable:typeof p=="boolean"?Qi(p):p,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,style:O,minWidth:this.props.minWidth,minHeight:this.props.minHeight,maxWidth:this.state.resizing?this.state.maxWidth:this.props.maxWidth,maxHeight:this.state.resizing?this.state.maxHeight:this.props.maxHeight,grid:d,handleWrapperClass:c,handleWrapperStyle:m,lockAspectRatio:this.props.lockAspectRatio,lockAspectRatioExtraWidth:this.props.lockAspectRatioExtraWidth,lockAspectRatioExtraHeight:this.props.lockAspectRatioExtraHeight,handleStyles:P,handleClasses:x,handleComponent:f,scale:this.props.scale}),S))},t.defaultProps={maxWidth:Number.MAX_SAFE_INTEGER,maxHeight:Number.MAX_SAFE_INTEGER,scale:1,onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},onDragStart:function(){},onDrag:function(){},onDragStop:function(){}},t}(z.PureComponent);class pn extends z.Component{state={pdfDocument:null,error:null};static defaultProps={workerSrc:me,cMapUrl:ve,cMapPacked:be};documentRef=st.createRef();componentDidMount(){this.load()}componentWillUnmount(){const{pdfDocument:t}=this.state;t&&t.destroy()}componentDidUpdate({url:t}){this.props.url!==t&&this.load()}componentDidCatch(t){const{onError:e}=this.props;e&&e(t),this.setState({pdfDocument:null,error:t})}load(){const{ownerDocument:t=document}=this.documentRef.current||{},{url:e,cMapUrl:n,cMapPacked:o,workerSrc:r}=this.props,{pdfDocument:s}=this.state;this.setState({pdfDocument:null,error:null}),typeof r=="string"&&(fe.workerSrc=r),Promise.resolve().then(()=>s?.destroy()).then(()=>{if(!e)return;const a={...this.props,ownerDocument:t,...n?{cMapUrl:n,cMapPacked:o}:{}};return ge(a).promise.then(h=>{this.setState({pdfDocument:h})})}).catch(a=>this.componentDidCatch(a))}render(){const{children:t,beforeLoad:e}=this.props,{pdfDocument:n,error:o}=this.state;return L.jsxs(L.Fragment,{children:[L.jsx("span",{ref:this.documentRef}),o?this.renderError():!n||!t?e:t(n)]})}renderError(){const{errorMessage:t}=this.props;return t?st.cloneElement(t,{error:this.state.error}):null}}export{an as P,un as R,ln as Z,pn as a,ve as b,me as c,hn as d,be as e,pt as g};
16
+ ***************************************************************************** */var Tt=function(i,t){return Tt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var o in n)n.hasOwnProperty(o)&&(e[o]=n[o])},Tt(i,t)};function Ki(i,t){Tt(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var H=function(){return H=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++){e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},H.apply(this,arguments)};function Zi(i,t){var e={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&t.indexOf(n)<0&&(e[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(i);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(i,n[o])&&(e[n[o]]=i[n[o]]);return e}var Ji={width:"auto",height:"auto",display:"inline-block",position:"absolute",top:0,left:0},Qi=function(i){return{bottom:i,bottomLeft:i,bottomRight:i,left:i,right:i,top:i,topLeft:i,topRight:i}},un=function(i){Ki(t,i);function t(e){var n=i.call(this,e)||this;return n.resizingPosition={x:0,y:0},n.offsetFromParent={left:0,top:0},n.resizableElement={current:null},n.originalPosition={x:0,y:0},n.state={resizing:!1,bounds:{top:0,right:0,bottom:0,left:0},maxWidth:e.maxWidth,maxHeight:e.maxHeight},n.onResizeStart=n.onResizeStart.bind(n),n.onResize=n.onResize.bind(n),n.onResizeStop=n.onResizeStop.bind(n),n.onDragStart=n.onDragStart.bind(n),n.onDrag=n.onDrag.bind(n),n.onDragStop=n.onDragStop.bind(n),n.getMaxSizesFromProps=n.getMaxSizesFromProps.bind(n),n}return t.prototype.componentDidMount=function(){this.updateOffsetFromParent();var e=this.offsetFromParent,n=e.left,o=e.top,r=this.getDraggablePosition(),s=r.x,a=r.y;this.draggable.setState({x:s-n,y:a-o}),this.forceUpdate()},t.prototype.getDraggablePosition=function(){var e=this.draggable.state,n=e.x,o=e.y;return{x:n,y:o}},t.prototype.getParent=function(){return this.resizable&&this.resizable.parentNode},t.prototype.getParentSize=function(){return this.resizable.getParentSize()},t.prototype.getMaxSizesFromProps=function(){var e=typeof this.props.maxWidth>"u"?Number.MAX_SAFE_INTEGER:this.props.maxWidth,n=typeof this.props.maxHeight>"u"?Number.MAX_SAFE_INTEGER:this.props.maxHeight;return{maxWidth:e,maxHeight:n}},t.prototype.getSelfElement=function(){return this.resizable&&this.resizable.resizable},t.prototype.getOffsetHeight=function(e){var n=this.props.scale;switch(this.props.bounds){case"window":return window.innerHeight/n;case"body":return document.body.offsetHeight/n;default:return e.offsetHeight}},t.prototype.getOffsetWidth=function(e){var n=this.props.scale;switch(this.props.bounds){case"window":return window.innerWidth/n;case"body":return document.body.offsetWidth/n;default:return e.offsetWidth}},t.prototype.onDragStart=function(e,n){this.props.onDragStart&&this.props.onDragStart(e,n);var o=this.getDraggablePosition();if(this.originalPosition=o,!!this.props.bounds){var r=this.getParent(),s=this.props.scale,a;if(this.props.bounds==="parent")a=r;else if(this.props.bounds==="body"){var h=r.getBoundingClientRect(),l=h.left,c=h.top,g=document.body.getBoundingClientRect(),y=-(l-r.offsetLeft*s-g.left)/s,b=-(c-r.offsetTop*s-g.top)/s,w=(document.body.offsetWidth-this.resizable.size.width*s)/s+y,S=(document.body.offsetHeight-this.resizable.size.height*s)/s+b;return this.setState({bounds:{top:b,right:w,bottom:S,left:y}})}else if(this.props.bounds==="window"){if(!this.resizable)return;var P=r.getBoundingClientRect(),x=P.left,f=P.top,p=-(x-r.offsetLeft*s)/s,d=-(f-r.offsetTop*s)/s,w=(window.innerWidth-this.resizable.size.width*s)/s+p,S=(window.innerHeight-this.resizable.size.height*s)/s+d;return this.setState({bounds:{top:d,right:w,bottom:S,left:p}})}else typeof this.props.bounds=="string"?a=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(a=this.props.bounds);if(!(!(a instanceof HTMLElement)||!(r instanceof HTMLElement))){var u=a.getBoundingClientRect(),m=u.left,v=u.top,R=r.getBoundingClientRect(),_=R.left,D=R.top,N=(m-_)/s,T=v-D;if(this.resizable){this.updateOffsetFromParent();var O=this.offsetFromParent;this.setState({bounds:{top:T-O.top,right:N+(a.offsetWidth-this.resizable.size.width)-O.left/s,bottom:T+(a.offsetHeight-this.resizable.size.height)-O.top,left:N-O.left/s}})}}}},t.prototype.onDrag=function(e,n){if(this.props.onDrag){var o=this.offsetFromParent,r=o.left,s=o.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDrag(e,H(H({},n),{x:n.x+r,y:n.y+s}));if(this.props.dragAxis==="x")return this.props.onDrag(e,H(H({},n),{x:n.x+r,y:this.originalPosition.y+s,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDrag(e,H(H({},n),{x:this.originalPosition.x+r,y:n.y+s,deltaX:0}))}},t.prototype.onDragStop=function(e,n){if(this.props.onDragStop){var o=this.offsetFromParent,r=o.left,s=o.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDragStop(e,H(H({},n),{x:n.x+r,y:n.y+s}));if(this.props.dragAxis==="x")return this.props.onDragStop(e,H(H({},n),{x:n.x+r,y:this.originalPosition.y+s,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDragStop(e,H(H({},n),{x:this.originalPosition.x+r,y:n.y+s,deltaX:0}))}},t.prototype.onResizeStart=function(e,n,o){e.stopPropagation(),this.setState({resizing:!0});var r=this.props.scale,s=this.offsetFromParent,a=this.getDraggablePosition();if(this.resizingPosition={x:a.x+s.left,y:a.y+s.top},this.originalPosition=a,this.props.bounds){var h=this.getParent(),l=void 0;this.props.bounds==="parent"?l=h:this.props.bounds==="body"?l=document.body:this.props.bounds==="window"?l=window:typeof this.props.bounds=="string"?l=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(l=this.props.bounds);var c=this.getSelfElement();if(c instanceof Element&&(l instanceof HTMLElement||l===window)&&h instanceof HTMLElement){var g=this.getMaxSizesFromProps(),y=g.maxWidth,b=g.maxHeight,w=this.getParentSize();if(y&&typeof y=="string")if(y.endsWith("%")){var S=Number(y.replace("%",""))/100;y=w.width*S}else y.endsWith("px")&&(y=Number(y.replace("px","")));if(b&&typeof b=="string")if(b.endsWith("%")){var S=Number(b.replace("%",""))/100;b=w.height*S}else b.endsWith("px")&&(b=Number(b.replace("px","")));var P=c.getBoundingClientRect(),x=P.left,f=P.top,p=this.props.bounds==="window"?{left:0,top:0}:l.getBoundingClientRect(),d=p.left,u=p.top,m=this.getOffsetWidth(l),v=this.getOffsetHeight(l),R=n.toLowerCase().endsWith("left"),_=n.toLowerCase().endsWith("right"),D=n.startsWith("top"),N=n.startsWith("bottom");if((R||D)&&this.resizable){var T=(x-d)/r+this.resizable.size.width;this.setState({maxWidth:T>Number(y)?y:T})}if(_||this.props.lockAspectRatio&&!R&&!D){var T=m+(d-x)/r;this.setState({maxWidth:T>Number(y)?y:T})}if((D||R)&&this.resizable){var T=(f-u)/r+this.resizable.size.height;this.setState({maxHeight:T>Number(b)?b:T})}if(N||this.props.lockAspectRatio&&!D&&!R){var T=v+(u-f)/r;this.setState({maxHeight:T>Number(b)?b:T})}}}else this.setState({maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight});this.props.onResizeStart&&this.props.onResizeStart(e,n,o)},t.prototype.onResize=function(e,n,o,r){var s=this,a={x:this.originalPosition.x,y:this.originalPosition.y},h=-r.width,l=-r.height,c=["top","left","topLeft","bottomLeft","topRight"];c.includes(n)&&(n==="bottomLeft"?a.x+=h:(n==="topRight"||(a.x+=h),a.y+=l));var g=this.draggable.state;(a.x!==g.x||a.y!==g.y)&&dt.flushSync(function(){s.draggable.setState(a)}),this.updateOffsetFromParent();var y=this.offsetFromParent,b=this.getDraggablePosition().x+y.left,w=this.getDraggablePosition().y+y.top;this.resizingPosition={x:b,y:w},this.props.onResize&&this.props.onResize(e,n,o,r,{x:b,y:w})},t.prototype.onResizeStop=function(e,n,o,r){this.setState({resizing:!1});var s=this.getMaxSizesFromProps(),a=s.maxWidth,h=s.maxHeight;this.setState({maxWidth:a,maxHeight:h}),this.props.onResizeStop&&this.props.onResizeStop(e,n,o,r,this.resizingPosition)},t.prototype.updateSize=function(e){this.resizable&&this.resizable.updateSize({width:e.width,height:e.height})},t.prototype.updatePosition=function(e){this.draggable.setState(e)},t.prototype.updateOffsetFromParent=function(){var e=this.props.scale,n=this.getParent(),o=this.getSelfElement();if(!n||o===null)return{top:0,left:0};var r=n.getBoundingClientRect(),s=r.left,a=r.top,h=o.getBoundingClientRect(),l=this.getDraggablePosition(),c=n.scrollLeft,g=n.scrollTop;this.offsetFromParent={left:h.left-s+c-l.x*e,top:h.top-a+g-l.y*e}},t.prototype.render=function(){var e=this,n=this.props,o=n.disableDragging,r=n.style,s=n.dragHandleClassName,a=n.position,h=n.onMouseDown,l=n.onMouseUp,c=n.dragAxis,g=n.dragGrid,y=n.bounds,b=n.enableUserSelectHack,w=n.cancel,S=n.children;n.onResizeStart,n.onResize,n.onResizeStop,n.onDragStart,n.onDrag,n.onDragStop;var P=n.resizeHandleStyles,x=n.resizeHandleClasses,f=n.resizeHandleComponent,p=n.enableResizing,d=n.resizeGrid,u=n.resizeHandleWrapperClass,m=n.resizeHandleWrapperStyle,v=n.scale,R=n.allowAnyClick,_=n.dragPositionOffset,D=Zi(n,["disableDragging","style","dragHandleClassName","position","onMouseDown","onMouseUp","dragAxis","dragGrid","bounds","enableUserSelectHack","cancel","children","onResizeStart","onResize","onResizeStop","onDragStart","onDrag","onDragStop","resizeHandleStyles","resizeHandleClasses","resizeHandleComponent","enableResizing","resizeGrid","resizeHandleWrapperClass","resizeHandleWrapperStyle","scale","allowAnyClick","dragPositionOffset"]),N=this.props.default?H({},this.props.default):void 0;delete D.default;var T=o||s?{cursor:"auto"}:{cursor:"move"},O=H(H(H({},Ji),T),r),V=this.offsetFromParent,Y=V.left,M=V.top,$;a&&($={x:a.x-Y,y:a.y-M});var Q=this.state.resizing?void 0:$,tt=this.state.resizing?"both":c;return z.createElement(ki,{ref:function(B){B&&(e.draggable=B)},handle:s?".".concat(s):void 0,defaultPosition:N,onMouseDown:h,onMouseUp:l,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,axis:tt,disabled:o,grid:g,bounds:y?this.state.bounds:void 0,position:Q,enableUserSelectHack:b,cancel:w,scale:v,allowAnyClick:R,nodeRef:this.resizableElement,positionOffset:_},z.createElement(qi,H({},D,{ref:function(B){B&&(e.resizable=B,e.resizableElement.current=B.resizable)},defaultSize:N,size:this.props.size,enable:typeof p=="boolean"?Qi(p):p,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,style:O,minWidth:this.props.minWidth,minHeight:this.props.minHeight,maxWidth:this.state.resizing?this.state.maxWidth:this.props.maxWidth,maxHeight:this.state.resizing?this.state.maxHeight:this.props.maxHeight,grid:d,handleWrapperClass:u,handleWrapperStyle:m,lockAspectRatio:this.props.lockAspectRatio,lockAspectRatioExtraWidth:this.props.lockAspectRatioExtraWidth,lockAspectRatioExtraHeight:this.props.lockAspectRatioExtraHeight,handleStyles:P,handleClasses:x,handleComponent:f,scale:this.props.scale}),S))},t.defaultProps={maxWidth:Number.MAX_SAFE_INTEGER,maxHeight:Number.MAX_SAFE_INTEGER,scale:1,onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},onDragStart:function(){},onDrag:function(){},onDragStop:function(){}},t}(z.PureComponent);class pn extends z.Component{state={pdfDocument:null,error:null};static defaultProps={workerSrc:me,cMapUrl:ve,cMapPacked:be};documentRef=st.createRef();loadingTask=null;loadGeneration=0;componentDidMount(){this.load()}componentWillUnmount(){this.loadGeneration+=1,this.destroyLoadingTask();const{pdfDocument:t}=this.state;t&&t.destroy()}componentDidUpdate({url:t}){this.props.url!==t&&this.load()}componentDidCatch(t){const{onError:e}=this.props;e&&e(t),this.setState({pdfDocument:null,error:t})}destroyLoadingTask(){if(!this.loadingTask)return;const t=this.loadingTask;this.loadingTask=null;try{t.destroy()}catch{}}load(){const{ownerDocument:t=document}=this.documentRef.current||{},{url:e,cMapUrl:n,cMapPacked:o,workerSrc:r}=this.props,{pdfDocument:s}=this.state,a=this.loadGeneration+1;this.loadGeneration=a,this.destroyLoadingTask(),this.setState({pdfDocument:null,error:null}),typeof r=="string"&&(fe.workerSrc=r),Promise.resolve().then(()=>s?.destroy()).then(()=>{if(!e)return;const h={...this.props,ownerDocument:t,...n?{cMapUrl:n,cMapPacked:o}:{}},l=ge(h);return this.loadingTask=l,l.promise.then(c=>{if(this.loadGeneration!==a){c.destroy();return}this.loadingTask=null,this.setState({pdfDocument:c})})}).catch(h=>{this.loadGeneration===a&&(this.loadingTask=null,this.componentDidCatch(h))})}render(){const{children:t,beforeLoad:e}=this.props,{pdfDocument:n,error:o}=this.state;return L.jsxs(L.Fragment,{children:[L.jsx("span",{ref:this.documentRef}),o?this.renderError():!n||!t?e:t(n)]})}renderError(){const{errorMessage:t}=this.props;return t?st.cloneElement(t,{error:this.state.error}):null}}export{an as P,un as R,ln as Z,pn as a,ve as b,me as c,hn as d,be as e,pt as g};
@@ -1 +1 @@
1
- import{m as ee,a as re,n as te,o as X,p as se,q as oe,c as ae,r as _,s as ne,j as e,h as k,I as q,b as c,M as V,A as G,R as E}from"./index-CBNVuWcP.js";import{r as s}from"./plugin-monaco-C8UgLomw.js";import{d as ie,s as le,U as de,I as ce,r as ue}from"./NotebookEditor-DB9N_T9q.js";import"./plugin-notebook-HbW2K-1c.js";import"./plugin-terminal-MXFIPun8.js";function fe(a,u){if(!a)return a;const p=`/api/v1/pdf/markdown/${u}/assets/`;return a.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(m,t,n)=>{const f=String(n||"").trim();if(!f||f.startsWith("http")||f.startsWith("data:")||f.startsWith("/api/"))return m;const y=f.replace(/^\.?\//,"");return`![${t}](${p}${y})`})}function me(a){return a&&a.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(u,p,m)=>{const t=String(m||"").trim();if(!t)return u;const n=ue(t);return n?`![${p}](${n})`:u})}function ve({context:a,tabId:u,setTitle:p}){const m=a.resourceId??(typeof a.customData?.fileId=="string"?a.customData.fileId:null),t=m?String(m):"",n=a.resourceName||"PDF Markdown",f=ee(r=>r.updateTabPlugin),y=re(r=>r.updateTabState),{addToast:D}=te(),R=X(r=>r.items),K=X(r=>r.errors),[v,z]=s.useState(null),[b,F]=s.useState(""),[i,x]=s.useState("idle"),[g,N]=s.useState("novel"),[$,S]=s.useState(null),[H,w]=s.useState(null),[l,B]=s.useState(!1),[A,M]=s.useState(!1),P=s.useRef(!1),J=s.useMemo(()=>[...ie],[]),I=s.useMemo(()=>a.customData?.arxiv??null,[a.customData]),o=s.useMemo(()=>I||t&&R.find(r=>r.fileId===t)||null,[I,R,t]),U=o?K[o.arxivId]:void 0,j=!!o,Q=s.useMemo(()=>se(o),[o]),O=s.useCallback(async()=>{if(!o)return;const r=oe(o),d=await ae(r);D({type:d?"success":"error",title:d?"BibTeX copied":"Copy failed",description:d?o.title||o.arxivId:"Please try again.",duration:1800})},[D,o]),W=s.useCallback(()=>{o?.arxivId&&window.open(`https://arxiv.org/abs/${o.arxivId}`,"_blank","noopener,noreferrer")},[o]);s.useEffect(()=>{p(j?`${n} Summary`:n)},[n,j,p]),s.useEffect(()=>{P.current=!1,N("novel"),S(null)},[t]);const C=s.useCallback(async(r=!1)=>{if(!t)return!1;w(null);try{const d=r?"?force=1":"";return await _.post(`/api/v1/pdf/parse/${t}${d}`),x("processing"),!0}catch(d){return w(d?.response?.data?.detail||d?.message||"Failed to start MinerU parsing"),x("error"),!1}},[t]),h=s.useCallback(async()=>{if(t){x("loading"),w(null);try{const r=await _.get(`/api/v1/pdf/markdown/${t}`,{responseType:"text"}),d=typeof r.data=="string"?r.data:String(r.data??""),Z=fe(d,t);F(Z),N("novel"),S(null),x("ready")}catch(r){if(r?.response?.status===409){x("processing"),P.current||(P.current=!0,await C());return}w(r?.response?.data?.detail||r?.message||"Failed to load PDF markdown"),x("error")}}},[t,C]),T=s.useCallback(async()=>{if(!t||l)return;B(!0),P.current=!0,await C(!0)&&await h(),B(!1)},[t,l,h,C]);s.useEffect(()=>{if(j){x("idle"),F(""),w(null);return}t&&h()},[t,j,h]),s.useEffect(()=>{y(u,{contentKind:"pdf",documentMode:"markdown",isReadOnly:!0})},[u,y]),s.useEffect(()=>{if(i!=="processing")return;const r=window.setTimeout(()=>{h()},5e3);return()=>window.clearTimeout(r)},[i,h]),s.useEffect(()=>{if(!(!v||i!=="ready"||g!=="novel"))try{le(v,b),v.setEditable(!1),!(v.state.doc.textContent.trim().length>0)&&b.trim().length>0&&N("markdown")}catch(r){S(r?.message||"Markdown parse failed"),N("markdown")}},[v,b,g,i]);const Y=s.useMemo(()=>g==="markdown"?me(b):b,[b,g]),L=s.useCallback(()=>{t&&f(u,ne.PDF_VIEWER,{...a,resourceId:a.resourceId??t,resourceName:a.resourceName??n,customData:{...a.customData||{},pdfView:"pdf",fileId:t}})},[a,t,n,u,f]);return t?j?e.jsxs("div",{className:"flex flex-col h-full bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(k,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-foreground",children:n}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground uppercase",children:"Summary"}),e.jsx("button",{type:"button",onClick:()=>M(!0),className:c("flex h-7 w-7 items-center justify-center rounded-full","text-muted-foreground transition-colors","hover:bg-muted hover:text-foreground"),title:"Paper info","aria-label":"Paper info",children:e.jsx(q,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("button",{type:"button",onClick:L,className:c("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"),title:"Back to PDF view",children:[e.jsx(k,{className:"w-4 h-4"}),"PDF"]})})]}),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.jsx("div",{className:"notebook-editor-container relative h-full overflow-hidden rounded-2xl border border-border bg-background shadow-soft-card",children:e.jsx("div",{className:"notebook-doc-editor relative h-full w-full overflow-y-auto p-8",children:e.jsx(V,{content:Q,className:"prose prose-lg dark:prose-invert max-w-full"})})})})}),e.jsx(G,{open:A,onClose:()=>M(!1),paper:o,errorCode:U,onCopyBibtex:o?O:void 0,onOpenArxiv:o?W:void 0})]}):e.jsxs("div",{className:"flex flex-col h-full bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(k,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-foreground",children:n}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground uppercase",children:"Markdown"}),o?e.jsx("button",{type:"button",onClick:()=>M(!0),className:c("flex h-7 w-7 items-center justify-center rounded-full","text-muted-foreground transition-colors","hover:bg-muted hover:text-foreground"),title:"Paper info","aria-label":"Paper info",children:e.jsx(q,{className:"h-4 w-4"})}):null]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t?e.jsxs("button",{type:"button",onClick:L,className:c("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"),title:"Back to PDF view",children:[e.jsx(k,{className:"w-4 h-4"}),"PDF"]}):null,i==="error"&&e.jsxs("button",{onClick:T,disabled:l,className:c("inline-flex items-center gap-2 text-xs transition-colors","text-muted-foreground hover:text-foreground",l&&"opacity-60 cursor-not-allowed"),children:[e.jsx(E,{className:c("w-3.5 h-3.5",l&&"animate-spin")}),"Retry parse"]}),i==="processing"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:"Parsing..."}),e.jsxs("button",{onClick:T,disabled:l,className:c("inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 transition-colors","border-border bg-background hover:bg-muted/60",l&&"opacity-60 cursor-not-allowed"),children:[e.jsx(E,{className:c("h-3 w-3",l&&"animate-spin")}),"Retry"]})]})]})]}),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:c("notebook-editor-container relative h-full overflow-hidden rounded-2xl border border-border bg-background shadow-soft-card",i!=="ready"&&"flex items-center justify-center"),children:[i==="loading"&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading Markdown..."}),i==="processing"&&e.jsxs("div",{className:"flex flex-col items-center gap-3 text-sm text-muted-foreground",children:[e.jsx("span",{children:"MinerU parsing in progress..."}),e.jsxs("button",{onClick:T,disabled:l,className:c("inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs transition-colors","border-border bg-background hover:bg-muted/60",l&&"opacity-60 cursor-not-allowed"),children:[e.jsx(E,{className:c("h-3.5 w-3.5",l&&"animate-spin")}),"Retry MinerU"]})]}),i==="error"&&e.jsx("div",{className:"text-sm text-destructive px-6 text-center",children:H||"Failed to load PDF markdown"}),i==="ready"&&g==="novel"&&e.jsx(de,{children:e.jsx(ce,{extensions:J,className:"notebook-doc-editor relative h-full w-full overflow-y-auto",editorProps:{attributes:{class:"prose prose-lg dark:prose-invert prose-headings:font-title font-default focus:outline-none max-w-full"}},onCreate:({editor:r})=>{z(r)}})}),i==="ready"&&g==="markdown"&&e.jsxs("div",{className:"notebook-doc-editor relative h-full w-full overflow-y-auto p-8",children:[$?e.jsxs("div",{className:"text-xs text-muted-foreground mb-3",children:[$,". Rendering with Markdown viewer."]}):null,e.jsx(V,{content:Y,className:"prose prose-lg dark:prose-invert max-w-full"})]})]})})}),e.jsx(G,{open:A,onClose:()=>M(!1),paper:o,errorCode:U,onCopyBibtex:o?O:void 0,onOpenArxiv:o?W:void 0})]}):e.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:e.jsxs("div",{className:"max-w-md text-center space-y-3",children:[e.jsx(k,{className:"mx-auto h-10 w-10 text-muted-foreground"}),e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Open a PDF to view Markdown"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a PDF in the file tree or import one from arXiv, then open the Markdown view to see MinerU output."})]})})}export{ve as default};
1
+ import{i as ee,a as re,k as te,l as X,m as se,n as oe,c as ae,o as _,B as ne,j as e,f as k,I as V,b as c,M as q,A as G,R as E}from"./index-CHzJ2xtB.js";import{r as s}from"./plugin-monaco-C8UgLomw.js";import{d as ie,s as le,U as de,I as ce,r as ue}from"./NotebookEditor-WFyd8Ybt.js";import"./plugin-notebook-JRhysCqj.js";import"./plugin-terminal-MXFIPun8.js";function fe(a,u){if(!a)return a;const p=`/api/v1/pdf/markdown/${u}/assets/`;return a.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(m,t,n)=>{const f=String(n||"").trim();if(!f||f.startsWith("http")||f.startsWith("data:")||f.startsWith("/api/"))return m;const y=f.replace(/^\.?\//,"");return`![${t}](${p}${y})`})}function me(a){return a&&a.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(u,p,m)=>{const t=String(m||"").trim();if(!t)return u;const n=ue(t);return n?`![${p}](${n})`:u})}function ve({context:a,tabId:u,setTitle:p}){const m=a.resourceId??(typeof a.customData?.fileId=="string"?a.customData.fileId:null),t=m?String(m):"",n=a.resourceName||"PDF Markdown",f=ee(r=>r.updateTabPlugin),y=re(r=>r.updateTabState),{addToast:D}=te(),R=X(r=>r.items),K=X(r=>r.errors),[v,z]=s.useState(null),[b,F]=s.useState(""),[i,x]=s.useState("idle"),[g,N]=s.useState("novel"),[B,S]=s.useState(null),[H,w]=s.useState(null),[l,$]=s.useState(!1),[A,M]=s.useState(!1),P=s.useRef(!1),J=s.useMemo(()=>[...ie],[]),I=s.useMemo(()=>a.customData?.arxiv??null,[a.customData]),o=s.useMemo(()=>I||t&&R.find(r=>r.fileId===t)||null,[I,R,t]),U=o?K[o.arxivId]:void 0,j=!!o,Q=s.useMemo(()=>se(o),[o]),O=s.useCallback(async()=>{if(!o)return;const r=oe(o),d=await ae(r);D({type:d?"success":"error",title:d?"BibTeX copied":"Copy failed",description:d?o.title||o.arxivId:"Please try again.",duration:1800})},[D,o]),W=s.useCallback(()=>{o?.arxivId&&window.open(`https://arxiv.org/abs/${o.arxivId}`,"_blank","noopener,noreferrer")},[o]);s.useEffect(()=>{p(j?`${n} Summary`:n)},[n,j,p]),s.useEffect(()=>{P.current=!1,N("novel"),S(null)},[t]);const C=s.useCallback(async(r=!1)=>{if(!t)return!1;w(null);try{const d=r?"?force=1":"";return await _.post(`/api/v1/pdf/parse/${t}${d}`),x("processing"),!0}catch(d){return w(d?.response?.data?.detail||d?.message||"Failed to start MinerU parsing"),x("error"),!1}},[t]),h=s.useCallback(async()=>{if(t){x("loading"),w(null);try{const r=await _.get(`/api/v1/pdf/markdown/${t}`,{responseType:"text"}),d=typeof r.data=="string"?r.data:String(r.data??""),Z=fe(d,t);F(Z),N("novel"),S(null),x("ready")}catch(r){if(r?.response?.status===409){x("processing"),P.current||(P.current=!0,await C());return}w(r?.response?.data?.detail||r?.message||"Failed to load PDF markdown"),x("error")}}},[t,C]),T=s.useCallback(async()=>{if(!t||l)return;$(!0),P.current=!0,await C(!0)&&await h(),$(!1)},[t,l,h,C]);s.useEffect(()=>{if(j){x("idle"),F(""),w(null);return}t&&h()},[t,j,h]),s.useEffect(()=>{y(u,{contentKind:"pdf",documentMode:"markdown",isReadOnly:!0})},[u,y]),s.useEffect(()=>{if(i!=="processing")return;const r=window.setTimeout(()=>{h()},5e3);return()=>window.clearTimeout(r)},[i,h]),s.useEffect(()=>{if(!(!v||i!=="ready"||g!=="novel"))try{le(v,b),v.setEditable(!1),!(v.state.doc.textContent.trim().length>0)&&b.trim().length>0&&N("markdown")}catch(r){S(r?.message||"Markdown parse failed"),N("markdown")}},[v,b,g,i]);const Y=s.useMemo(()=>g==="markdown"?me(b):b,[b,g]),L=s.useCallback(()=>{t&&f(u,ne.PDF_VIEWER,{...a,resourceId:a.resourceId??t,resourceName:a.resourceName??n,customData:{...a.customData||{},pdfView:"pdf",fileId:t}})},[a,t,n,u,f]);return t?j?e.jsxs("div",{className:"flex flex-col h-full bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(k,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-foreground",children:n}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground uppercase",children:"Summary"}),e.jsx("button",{type:"button",onClick:()=>M(!0),className:c("flex h-7 w-7 items-center justify-center rounded-full","text-muted-foreground transition-colors","hover:bg-muted hover:text-foreground"),title:"Paper info","aria-label":"Paper info",children:e.jsx(V,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("button",{type:"button",onClick:L,className:c("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"),title:"Back to PDF view",children:[e.jsx(k,{className:"w-4 h-4"}),"PDF"]})})]}),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.jsx("div",{className:"notebook-editor-container relative h-full overflow-hidden rounded-2xl border border-border bg-background shadow-soft-card",children:e.jsx("div",{className:"notebook-doc-editor relative h-full w-full overflow-y-auto p-8",children:e.jsx(q,{content:Q,className:"prose prose-lg dark:prose-invert max-w-full"})})})})}),e.jsx(G,{open:A,onClose:()=>M(!1),paper:o,errorCode:U,onCopyBibtex:o?O:void 0,onOpenArxiv:o?W:void 0})]}):e.jsxs("div",{className:"flex flex-col h-full bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/30",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(k,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-foreground",children:n}),e.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground uppercase",children:"Markdown"}),o?e.jsx("button",{type:"button",onClick:()=>M(!0),className:c("flex h-7 w-7 items-center justify-center rounded-full","text-muted-foreground transition-colors","hover:bg-muted hover:text-foreground"),title:"Paper info","aria-label":"Paper info",children:e.jsx(V,{className:"h-4 w-4"})}):null]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t?e.jsxs("button",{type:"button",onClick:L,className:c("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"),title:"Back to PDF view",children:[e.jsx(k,{className:"w-4 h-4"}),"PDF"]}):null,i==="error"&&e.jsxs("button",{onClick:T,disabled:l,className:c("inline-flex items-center gap-2 text-xs transition-colors","text-muted-foreground hover:text-foreground",l&&"opacity-60 cursor-not-allowed"),children:[e.jsx(E,{className:c("w-3.5 h-3.5",l&&"animate-spin")}),"Retry parse"]}),i==="processing"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:"Parsing..."}),e.jsxs("button",{onClick:T,disabled:l,className:c("inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 transition-colors","border-border bg-background hover:bg-muted/60",l&&"opacity-60 cursor-not-allowed"),children:[e.jsx(E,{className:c("h-3 w-3",l&&"animate-spin")}),"Retry"]})]})]})]}),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:c("notebook-editor-container relative h-full overflow-hidden rounded-2xl border border-border bg-background shadow-soft-card",i!=="ready"&&"flex items-center justify-center"),children:[i==="loading"&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading Markdown..."}),i==="processing"&&e.jsxs("div",{className:"flex flex-col items-center gap-3 text-sm text-muted-foreground",children:[e.jsx("span",{children:"MinerU parsing in progress..."}),e.jsxs("button",{onClick:T,disabled:l,className:c("inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs transition-colors","border-border bg-background hover:bg-muted/60",l&&"opacity-60 cursor-not-allowed"),children:[e.jsx(E,{className:c("h-3.5 w-3.5",l&&"animate-spin")}),"Retry MinerU"]})]}),i==="error"&&e.jsx("div",{className:"text-sm text-destructive px-6 text-center",children:H||"Failed to load PDF markdown"}),i==="ready"&&g==="novel"&&e.jsx(de,{children:e.jsx(ce,{extensions:J,className:"notebook-doc-editor relative h-full w-full overflow-y-auto",editorProps:{attributes:{class:"prose prose-lg dark:prose-invert prose-headings:font-title font-default focus:outline-none max-w-full"}},onCreate:({editor:r})=>{z(r)}})}),i==="ready"&&g==="markdown"&&e.jsxs("div",{className:"notebook-doc-editor relative h-full w-full overflow-y-auto p-8",children:[B?e.jsxs("div",{className:"text-xs text-muted-foreground mb-3",children:[B,". Rendering with Markdown viewer."]}):null,e.jsx(q,{content:Y,className:"prose prose-lg dark:prose-invert max-w-full"})]})]})})}),e.jsx(G,{open:A,onClose:()=>M(!1),paper:o,errorCode:U,onCopyBibtex:o?O:void 0,onOpenArxiv:o?W:void 0})]}):e.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:e.jsxs("div",{className:"max-w-md text-center space-y-3",children:[e.jsx(k,{className:"mx-auto h-10 w-10 text-muted-foreground"}),e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Open a PDF to view Markdown"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a PDF in the file tree or import one from arXiv, then open the Markdown view to see MinerU output."})]})})}export{ve as default};