citeclaw 2.0.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 (1723) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +152 -0
  3. package/app.js +318 -0
  4. package/config.dev.yaml +124 -0
  5. package/config.prod.yaml +123 -0
  6. package/config.yaml +0 -0
  7. package/lib/Citation.js +101 -0
  8. package/lib/CitoidError.js +61 -0
  9. package/lib/CitoidRequest.js +150 -0
  10. package/lib/CitoidResponse.js +44 -0
  11. package/lib/CitoidService.js +1118 -0
  12. package/lib/Exporter.js +1052 -0
  13. package/lib/OutgoingRequestThrottle.js +96 -0
  14. package/lib/Scraper.js +617 -0
  15. package/lib/Translator.js +76 -0
  16. package/lib/ZoteroService.js +220 -0
  17. package/lib/api-util.js +125 -0
  18. package/lib/external-apis/CrossRefService.js +122 -0
  19. package/lib/external-apis/OpenAlexService.js +245 -0
  20. package/lib/external-apis/PubMedService.js +82 -0
  21. package/lib/external-apis/SemanticScholarService.js +221 -0
  22. package/lib/external-apis/WaybackMachine.js +92 -0
  23. package/lib/hostIsAllowed.js +128 -0
  24. package/lib/swagger-ui.js +104 -0
  25. package/lib/translators/README.md +12 -0
  26. package/lib/translators/bePress.js +319 -0
  27. package/lib/translators/coins.js +360 -0
  28. package/lib/translators/crossRef.js +485 -0
  29. package/lib/translators/dublinCore.js +215 -0
  30. package/lib/translators/general.js +157 -0
  31. package/lib/translators/openGraph.js +177 -0
  32. package/lib/translators/util/index.js +209 -0
  33. package/lib/unshorten.js +109 -0
  34. package/lib/util.js +410 -0
  35. package/lib/zotero/cachedTypes.js +232 -0
  36. package/lib/zotero/typeSchemaData.js +366 -0
  37. package/package.json +121 -0
  38. package/routes/citoid.js +101 -0
  39. package/routes/info.js +81 -0
  40. package/routes/root.js +51 -0
  41. package/scripts/botcite.js +5021 -0
  42. package/scripts/citeclaw.js +10 -0
  43. package/server.js +12 -0
  44. package/spec.yaml +156 -0
  45. package/targets.yaml +2 -0
  46. package/vendor/translators-official/ABC News Australia.js +224 -0
  47. package/vendor/translators-official/ACLS Humanities EBook.js +165 -0
  48. package/vendor/translators-official/ACLWeb.js +600 -0
  49. package/vendor/translators-official/ACM Digital Library.js +708 -0
  50. package/vendor/translators-official/ACM Queue.js +391 -0
  51. package/vendor/translators-official/ACS Publications.js +633 -0
  52. package/vendor/translators-official/ADS Bibcode.js +664 -0
  53. package/vendor/translators-official/AEA Web.js +450 -0
  54. package/vendor/translators-official/AGRIS.js +311 -0
  55. package/vendor/translators-official/AIP.js +295 -0
  56. package/vendor/translators-official/AMS Journals.js +136 -0
  57. package/vendor/translators-official/AMS MathSciNet (Legacy).js +313 -0
  58. package/vendor/translators-official/AMS MathSciNet.js +288 -0
  59. package/vendor/translators-official/APA PsycNET.js +915 -0
  60. package/vendor/translators-official/APN.ru.js +132 -0
  61. package/vendor/translators-official/APS-Physics.js +204 -0
  62. package/vendor/translators-official/APS.js +542 -0
  63. package/vendor/translators-official/ARTFL Encyclopedie.js +283 -0
  64. package/vendor/translators-official/ARTnews.js +155 -0
  65. package/vendor/translators-official/ARTstor.js +619 -0
  66. package/vendor/translators-official/ASCE.js +199 -0
  67. package/vendor/translators-official/ASCO Meeting Library.js +153 -0
  68. package/vendor/translators-official/ASTIS.js +337 -0
  69. package/vendor/translators-official/ATS International Journal.js +290 -0
  70. package/vendor/translators-official/Access Engineering.js +384 -0
  71. package/vendor/translators-official/Access Medicine.js +343 -0
  72. package/vendor/translators-official/Access Science.js +391 -0
  73. package/vendor/translators-official/Adam Matthew Digital.js +405 -0
  74. package/vendor/translators-official/Agencia del ISBN.js +77 -0
  75. package/vendor/translators-official/Ahval News.js +309 -0
  76. package/vendor/translators-official/Air University Journals.js +236 -0
  77. package/vendor/translators-official/Airiti.js +423 -0
  78. package/vendor/translators-official/Alexander Street Press.js +198 -0
  79. package/vendor/translators-official/AllAfrica.js +291 -0
  80. package/vendor/translators-official/Alsharekh.js +242 -0
  81. package/vendor/translators-official/AlterNet.js +134 -0
  82. package/vendor/translators-official/Aluka.js +261 -0
  83. package/vendor/translators-official/Amazon.js +1043 -0
  84. package/vendor/translators-official/American Archive of Public Broadcasting.js +592 -0
  85. package/vendor/translators-official/American Institute of Aeronautics and Astronautics.js +210 -0
  86. package/vendor/translators-official/American Prospect.js +114 -0
  87. package/vendor/translators-official/Anarchist Library.js +382 -0
  88. package/vendor/translators-official/Ancestry.com US Federal Census.js +164 -0
  89. package/vendor/translators-official/Annual Reviews.js +329 -0
  90. package/vendor/translators-official/Antikvarium.hu.js +280 -0
  91. package/vendor/translators-official/AquaDocs.js +390 -0
  92. package/vendor/translators-official/Archeion.js +249 -0
  93. package/vendor/translators-official/Archiv fuer Sozialgeschichte.js +157 -0
  94. package/vendor/translators-official/Archive Ouverte en Sciences de l'Information et de la Communication (AOSIC).js +179 -0
  95. package/vendor/translators-official/Archives Canada.js +142 -0
  96. package/vendor/translators-official/Ariana News.js +203 -0
  97. package/vendor/translators-official/Art Institute of Chicago.js +279 -0
  98. package/vendor/translators-official/Artefacts Canada.js +192 -0
  99. package/vendor/translators-official/Artforum.js +438 -0
  100. package/vendor/translators-official/Atlanta Journal-Constitution.js +311 -0
  101. package/vendor/translators-official/Atypon Journals.js +1204 -0
  102. package/vendor/translators-official/AustLII and NZLII.js +604 -0
  103. package/vendor/translators-official/Australian Dictionary of Biography.js +196 -0
  104. package/vendor/translators-official/BAILII.js +176 -0
  105. package/vendor/translators-official/BBC Genome.js +254 -0
  106. package/vendor/translators-official/BBC.js +430 -0
  107. package/vendor/translators-official/BIBSYS.js +112 -0
  108. package/vendor/translators-official/BOCC.js +217 -0
  109. package/vendor/translators-official/BOE.js +229 -0
  110. package/vendor/translators-official/BOFiP-Impots.js +132 -0
  111. package/vendor/translators-official/Baidu Scholar.js +276 -0
  112. package/vendor/translators-official/Bangkok Post.js +216 -0
  113. package/vendor/translators-official/Baruch Foundation.js +175 -0
  114. package/vendor/translators-official/Beobachter.js +175 -0
  115. package/vendor/translators-official/Bezneng Gajit.js +92 -0
  116. package/vendor/translators-official/BibLaTeX.js +888 -0
  117. package/vendor/translators-official/BibTeX.js +4236 -0
  118. package/vendor/translators-official/Biblio.com.js +216 -0
  119. package/vendor/translators-official/Bibliontology RDF.js +1166 -0
  120. package/vendor/translators-official/Biblioteca Nacional de Maestros.js +213 -0
  121. package/vendor/translators-official/Bibliotheque et Archives Nationale du Quebec (Pistard).js +147 -0
  122. package/vendor/translators-official/Bibliotheque et Archives Nationales du Quebec.js +266 -0
  123. package/vendor/translators-official/Bibliotheque nationale de France.js +872 -0
  124. package/vendor/translators-official/BioMed Central.js +585 -0
  125. package/vendor/translators-official/BioOne.js +233 -0
  126. package/vendor/translators-official/Bioconductor.js +343 -0
  127. package/vendor/translators-official/Blaetter.js +192 -0
  128. package/vendor/translators-official/Blogger.js +244 -0
  129. package/vendor/translators-official/Bloomberg.js +205 -0
  130. package/vendor/translators-official/Bloomsbury Food Library.js +296 -0
  131. package/vendor/translators-official/Bluesky.js +195 -0
  132. package/vendor/translators-official/BnF ISBN.js +129 -0
  133. package/vendor/translators-official/Bookmarks.js +282 -0
  134. package/vendor/translators-official/Bookshop.org.js +223 -0
  135. package/vendor/translators-official/Boston Review.js +332 -0
  136. package/vendor/translators-official/Bosworth Toller's Anglo-Saxon Dictionary Online.js +496 -0
  137. package/vendor/translators-official/Bracero History Archive.js +200 -0
  138. package/vendor/translators-official/Brill.js +434 -0
  139. package/vendor/translators-official/Brukerhandboken.js +153 -0
  140. package/vendor/translators-official/Bryn Mawr Classical Review.js +303 -0
  141. package/vendor/translators-official/Bundesgesetzblatt.js +231 -0
  142. package/vendor/translators-official/Business Standard.js +151 -0
  143. package/vendor/translators-official/CABI - CAB Abstracts.js +317 -0
  144. package/vendor/translators-official/CAOD.js +260 -0
  145. package/vendor/translators-official/CBC.js +439 -0
  146. package/vendor/translators-official/CCfr (BnF).js +162 -0
  147. package/vendor/translators-official/CERN Document Server.js +277 -0
  148. package/vendor/translators-official/CEUR Workshop Proceedings.js +145 -0
  149. package/vendor/translators-official/CFF References.js +170 -0
  150. package/vendor/translators-official/CFF.js +113 -0
  151. package/vendor/translators-official/CIA World Factbook.js +128 -0
  152. package/vendor/translators-official/CLACSO.js +226 -0
  153. package/vendor/translators-official/CLASE.js +135 -0
  154. package/vendor/translators-official/CNKI.js +731 -0
  155. package/vendor/translators-official/COBISS.js +1945 -0
  156. package/vendor/translators-official/COinS.js +336 -0
  157. package/vendor/translators-official/CQ Press.js +418 -0
  158. package/vendor/translators-official/CROSBI.js +227 -0
  159. package/vendor/translators-official/CSIRO Publishing.js +139 -0
  160. package/vendor/translators-official/CSL JSON.js +203 -0
  161. package/vendor/translators-official/CSV.js +294 -0
  162. package/vendor/translators-official/Cairn.info.js +368 -0
  163. package/vendor/translators-official/CalMatters.js +228 -0
  164. package/vendor/translators-official/Calisphere.js +355 -0
  165. package/vendor/translators-official/Camara Brasileira do Livro ISBN.js +842 -0
  166. package/vendor/translators-official/Cambridge Core.js +580 -0
  167. package/vendor/translators-official/Cambridge Engage Preprints.js +276 -0
  168. package/vendor/translators-official/CanLII.js +284 -0
  169. package/vendor/translators-official/Canada.com.js +171 -0
  170. package/vendor/translators-official/Canadian Letters and Images.js +148 -0
  171. package/vendor/translators-official/Canadiana.ca.js +196 -0
  172. package/vendor/translators-official/Cascadilla Proceedings Project.js +390 -0
  173. package/vendor/translators-official/Cell Press.js +516 -0
  174. package/vendor/translators-official/Central and Eastern European Online Library Journals.js +313 -0
  175. package/vendor/translators-official/Champlain Society - Collection.js +220 -0
  176. package/vendor/translators-official/ChatGPT.js +185 -0
  177. package/vendor/translators-official/Chicago Journal of Theoretical Computer Science.js +203 -0
  178. package/vendor/translators-official/Christian Science Monitor.js +148 -0
  179. package/vendor/translators-official/Chronicling America.js +131 -0
  180. package/vendor/translators-official/CiNii Research.js +168 -0
  181. package/vendor/translators-official/Citavi 5 XML.js +516 -0
  182. package/vendor/translators-official/CiteSeer.js +196 -0
  183. package/vendor/translators-official/Citizen Lab.js +347 -0
  184. package/vendor/translators-official/Civilization.ca.js +146 -0
  185. package/vendor/translators-official/Climate Change and Human Health Literature Portal.js +283 -0
  186. package/vendor/translators-official/Clinical Key.js +367 -0
  187. package/vendor/translators-official/Code4Lib Journal.js +143 -0
  188. package/vendor/translators-official/Colorado State Legislature.js +215 -0
  189. package/vendor/translators-official/Columbia University Press.js +238 -0
  190. package/vendor/translators-official/Common-Place.js +218 -0
  191. package/vendor/translators-official/Computer History Museum Archive.js +1319 -0
  192. package/vendor/translators-official/Copernicus.js +461 -0
  193. package/vendor/translators-official/Cornell LII.js +252 -0
  194. package/vendor/translators-official/Cornell University Press.js +235 -0
  195. package/vendor/translators-official/CourtListener.js +265 -0
  196. package/vendor/translators-official/Crossref REST.js +1757 -0
  197. package/vendor/translators-official/Crossref Unixref XML.js +965 -0
  198. package/vendor/translators-official/Current Affairs.js +160 -0
  199. package/vendor/translators-official/DABI.js +476 -0
  200. package/vendor/translators-official/DAI-Zenon.js +392 -0
  201. package/vendor/translators-official/DART-Europe.js +176 -0
  202. package/vendor/translators-official/DBLP Computer Science Bibliography.js +462 -0
  203. package/vendor/translators-official/DBpia.js +233 -0
  204. package/vendor/translators-official/DEPATISnet.js +373 -0
  205. package/vendor/translators-official/DOAJ.js +243 -0
  206. package/vendor/translators-official/DOI Content Negotiation.js +352 -0
  207. package/vendor/translators-official/DOI.js +322 -0
  208. package/vendor/translators-official/DPLA.js +425 -0
  209. package/vendor/translators-official/DSpace Intermediate Metadata.js +208 -0
  210. package/vendor/translators-official/Dagens Nyheter.js +369 -0
  211. package/vendor/translators-official/Dagstuhl Research Online Publication Server.js +276 -0
  212. package/vendor/translators-official/Dar Almandumah.js +253 -0
  213. package/vendor/translators-official/Data.gov.js +225 -0
  214. package/vendor/translators-official/Databrary.js +184 -0
  215. package/vendor/translators-official/Datacite JSON.js +1182 -0
  216. package/vendor/translators-official/Dataverse.js +418 -0
  217. package/vendor/translators-official/Daum News.js +139 -0
  218. package/vendor/translators-official/De Gruyter Brill.js +460 -0
  219. package/vendor/translators-official/Defense Technical Information Center.js +146 -0
  220. package/vendor/translators-official/Delpher.js +413 -0
  221. package/vendor/translators-official/Demographic Research.js +164 -0
  222. package/vendor/translators-official/Denik CZ.js +273 -0
  223. package/vendor/translators-official/Der Freitag.js +236 -0
  224. package/vendor/translators-official/Der Spiegel.js +479 -0
  225. package/vendor/translators-official/Desiring God.js +216 -0
  226. package/vendor/translators-official/Deutsche Fotothek.js +364 -0
  227. package/vendor/translators-official/Deutsche Nationalbibliothek.js +594 -0
  228. package/vendor/translators-official/Dialnet.js +258 -0
  229. package/vendor/translators-official/Die Zeit.js +378 -0
  230. package/vendor/translators-official/DigiZeitschriften.js +269 -0
  231. package/vendor/translators-official/Digital Humanities Quarterly.js +207 -0
  232. package/vendor/translators-official/Digital Spy.js +215 -0
  233. package/vendor/translators-official/Dimensions.js +233 -0
  234. package/vendor/translators-official/Douban.js +316 -0
  235. package/vendor/translators-official/Dreier Neuerscheinungsdienst.js +209 -0
  236. package/vendor/translators-official/DrugBank.ca.js +209 -0
  237. package/vendor/translators-official/Dryad Digital Repository.js +323 -0
  238. package/vendor/translators-official/Duke University Press Books.js +250 -0
  239. package/vendor/translators-official/E-periodica Switzerland.js +347 -0
  240. package/vendor/translators-official/EBSCO Discovery Layer.js +159 -0
  241. package/vendor/translators-official/EBSCOhost.js +592 -0
  242. package/vendor/translators-official/EIDR.js +184 -0
  243. package/vendor/translators-official/EPA National Library Catalog.js +245 -0
  244. package/vendor/translators-official/ERIC.js +986 -0
  245. package/vendor/translators-official/ESpacenet.js +465 -0
  246. package/vendor/translators-official/EUR-Lex.js +418 -0
  247. package/vendor/translators-official/Eastview.js +336 -0
  248. package/vendor/translators-official/Edinburgh University Press Journals.js +178 -0
  249. package/vendor/translators-official/Education Week.js +197 -0
  250. package/vendor/translators-official/El Comercio (Peru).js +347 -0
  251. package/vendor/translators-official/El Pais.js +262 -0
  252. package/vendor/translators-official/Electronic Colloquium on Computational Complexity.js +230 -0
  253. package/vendor/translators-official/Elicit.js +120 -0
  254. package/vendor/translators-official/Elsevier Health Journals.js +531 -0
  255. package/vendor/translators-official/Elsevier Pure.js +420 -0
  256. package/vendor/translators-official/Embedded Metadata.js +1978 -0
  257. package/vendor/translators-official/Emerald Insight.js +626 -0
  258. package/vendor/translators-official/Encyclopedia of Chicago.js +162 -0
  259. package/vendor/translators-official/Encyclopedia of Korean Culture.js +221 -0
  260. package/vendor/translators-official/Endnote XML.js +1407 -0
  261. package/vendor/translators-official/Engineering Village.js +139 -0
  262. package/vendor/translators-official/Envidat.js +331 -0
  263. package/vendor/translators-official/Epicurious.js +144 -0
  264. package/vendor/translators-official/Erudit.js +272 -0
  265. package/vendor/translators-official/Euclid.js +220 -0
  266. package/vendor/translators-official/EurasiaNet.js +109 -0
  267. package/vendor/translators-official/EurogamerUSgamer.js +380 -0
  268. package/vendor/translators-official/Europe PMC.js +448 -0
  269. package/vendor/translators-official/Evernote.js +104 -0
  270. package/vendor/translators-official/F1000 Research.js +655 -0
  271. package/vendor/translators-official/FAO Knowledge Repository.js +598 -0
  272. package/vendor/translators-official/FAOLEX Database.js +811 -0
  273. package/vendor/translators-official/FAZ.NET.js +231 -0
  274. package/vendor/translators-official/Fachportal Padagogik.js +839 -0
  275. package/vendor/translators-official/Factiva.js +302 -0
  276. package/vendor/translators-official/Failed Architecture.js +114 -0
  277. package/vendor/translators-official/Fairfax Australia.js +200 -0
  278. package/vendor/translators-official/Fatcat.js +425 -0
  279. package/vendor/translators-official/Figshare.js +191 -0
  280. package/vendor/translators-official/Financial Times.js +187 -0
  281. package/vendor/translators-official/Finna.js +357 -0
  282. package/vendor/translators-official/Flickr.js +318 -0
  283. package/vendor/translators-official/Foreign Affairs.js +485 -0
  284. package/vendor/translators-official/Foreign Policy.js +146 -0
  285. package/vendor/translators-official/FreeCite.js +95 -0
  286. package/vendor/translators-official/FreePatentsOnline.js +265 -0
  287. package/vendor/translators-official/Frieze.js +243 -0
  288. package/vendor/translators-official/Frontiers.js +667 -0
  289. package/vendor/translators-official/GMS German Medical Science.js +319 -0
  290. package/vendor/translators-official/GPO Access e-CFR.js +134 -0
  291. package/vendor/translators-official/Gale Databases.js +324 -0
  292. package/vendor/translators-official/GaleGDC.js +189 -0
  293. package/vendor/translators-official/Galegroup.js +327 -0
  294. package/vendor/translators-official/Gallica.js +194 -0
  295. package/vendor/translators-official/Game Studies.js +155 -0
  296. package/vendor/translators-official/GameSpot.js +199 -0
  297. package/vendor/translators-official/GameStar GamePro.js +198 -0
  298. package/vendor/translators-official/Gasyrlar Awazy.js +156 -0
  299. package/vendor/translators-official/Gemeinsamer Bibliotheksverbund ISBN.js +23 -0
  300. package/vendor/translators-official/Gene Ontology.js +128 -0
  301. package/vendor/translators-official/GitHub.js +501 -0
  302. package/vendor/translators-official/Globes.js +243 -0
  303. package/vendor/translators-official/Gmail.js +64 -0
  304. package/vendor/translators-official/Goodreads.js +219 -0
  305. package/vendor/translators-official/Google Books.js +552 -0
  306. package/vendor/translators-official/Google Gemini.js +116 -0
  307. package/vendor/translators-official/Google Patents.js +959 -0
  308. package/vendor/translators-official/Google Play.js +186 -0
  309. package/vendor/translators-official/Google Presentation.js +104 -0
  310. package/vendor/translators-official/Google Research.js +221 -0
  311. package/vendor/translators-official/Google Scholar.js +1361 -0
  312. package/vendor/translators-official/Gulag Many Days, Many Lives.js +179 -0
  313. package/vendor/translators-official/HAL.js +536 -0
  314. package/vendor/translators-official/HCSP.js +312 -0
  315. package/vendor/translators-official/HUDOC.js +650 -0
  316. package/vendor/translators-official/Haaretz.js +562 -0
  317. package/vendor/translators-official/Habr.js +232 -0
  318. package/vendor/translators-official/Handelszeitung.js +273 -0
  319. package/vendor/translators-official/Hanrei Watch.js +123 -0
  320. package/vendor/translators-official/Harper's Magazine.js +365 -0
  321. package/vendor/translators-official/Harvard Business Review.js +326 -0
  322. package/vendor/translators-official/Harvard Caselaw Access Project.js +244 -0
  323. package/vendor/translators-official/Harvard University Press Books.js +286 -0
  324. package/vendor/translators-official/HathiTrust.js +311 -0
  325. package/vendor/translators-official/HeinOnline.js +280 -0
  326. package/vendor/translators-official/Heise.js +200 -0
  327. package/vendor/translators-official/Herder.js +236 -0
  328. package/vendor/translators-official/HighBeam.js +198 -0
  329. package/vendor/translators-official/HighWire 2.0.js +1355 -0
  330. package/vendor/translators-official/HighWire.js +209 -0
  331. package/vendor/translators-official/Hindawi Publishers.js +177 -0
  332. package/vendor/translators-official/Hispanic-American Periodical Index.js +236 -0
  333. package/vendor/translators-official/Homeland Security Digital Library.js +426 -0
  334. package/vendor/translators-official/Hrvatska enciklopedija.js +118 -0
  335. package/vendor/translators-official/Huff Post.js +223 -0
  336. package/vendor/translators-official/Human Rights Watch.js +450 -0
  337. package/vendor/translators-official/IBISWorld.js +171 -0
  338. package/vendor/translators-official/IDEA ALM.js +536 -0
  339. package/vendor/translators-official/IEEE Computer Society.js +429 -0
  340. package/vendor/translators-official/IEEE Xplore.js +1000 -0
  341. package/vendor/translators-official/IETF.js +451 -0
  342. package/vendor/translators-official/IGN.js +136 -0
  343. package/vendor/translators-official/IMDb.js +566 -0
  344. package/vendor/translators-official/INSPIRE.js +247 -0
  345. package/vendor/translators-official/IPCC.js +757 -0
  346. package/vendor/translators-official/ISTC.js +181 -0
  347. package/vendor/translators-official/Idref.js +179 -0
  348. package/vendor/translators-official/In These Times.js +196 -0
  349. package/vendor/translators-official/Ined.js +558 -0
  350. package/vendor/translators-official/InfoTrac.js +279 -0
  351. package/vendor/translators-official/Informationssystem Medienpaedagogik.js +305 -0
  352. package/vendor/translators-official/IngentaConnect.js +312 -0
  353. package/vendor/translators-official/Inside Higher Ed.js +167 -0
  354. package/vendor/translators-official/Insignia OPAC.js +114 -0
  355. package/vendor/translators-official/Institute of Contemporary Art.js +180 -0
  356. package/vendor/translators-official/Institute of Physics.js +340 -0
  357. package/vendor/translators-official/Integrum.js +173 -0
  358. package/vendor/translators-official/Intellixir.js +264 -0
  359. package/vendor/translators-official/Inter-Research Science Center.js +185 -0
  360. package/vendor/translators-official/International Nuclear Information System.js +285 -0
  361. package/vendor/translators-official/Internet Archive Scholar.js +106 -0
  362. package/vendor/translators-official/Internet Archive Wayback Machine.js +152 -0
  363. package/vendor/translators-official/Internet Archive.js +552 -0
  364. package/vendor/translators-official/InvenioRDM.js +1250 -0
  365. package/vendor/translators-official/Isidore.js +235 -0
  366. package/vendor/translators-official/J-Stage.js +272 -0
  367. package/vendor/translators-official/JETS.js +122 -0
  368. package/vendor/translators-official/JISC Historical Texts.js +273 -0
  369. package/vendor/translators-official/JRC Publications Repository.js +569 -0
  370. package/vendor/translators-official/JSTOR.js +821 -0
  371. package/vendor/translators-official/Jahrbuch.js +213 -0
  372. package/vendor/translators-official/Japan Times Online.js +138 -0
  373. package/vendor/translators-official/Journal of Electronic Publishing.js +147 -0
  374. package/vendor/translators-official/Journal of Extension.js +288 -0
  375. package/vendor/translators-official/Journal of Machine Learning Research.js +441 -0
  376. package/vendor/translators-official/Journal of Religion and Society.js +174 -0
  377. package/vendor/translators-official/JurPC.js +274 -0
  378. package/vendor/translators-official/Juricaf.js +141 -0
  379. package/vendor/translators-official/Juris.js +728 -0
  380. package/vendor/translators-official/K10plus ISBN.js +386 -0
  381. package/vendor/translators-official/KStudy.js +632 -0
  382. package/vendor/translators-official/Kanopy.js +358 -0
  383. package/vendor/translators-official/Khaama Press.js +249 -0
  384. package/vendor/translators-official/KiM.js +259 -0
  385. package/vendor/translators-official/KitapYurdu.com.js +376 -0
  386. package/vendor/translators-official/Kommersant.js +174 -0
  387. package/vendor/translators-official/Korean National Library.js +621 -0
  388. package/vendor/translators-official/L'Annee Philologique.js +267 -0
  389. package/vendor/translators-official/LA Times.js +239 -0
  390. package/vendor/translators-official/LIBRIS ISBN.js +103 -0
  391. package/vendor/translators-official/LIVIVO.js +260 -0
  392. package/vendor/translators-official/LWN.net.js +350 -0
  393. package/vendor/translators-official/La Croix.js +237 -0
  394. package/vendor/translators-official/La Nacion (Argentina).js +231 -0
  395. package/vendor/translators-official/La Presse.js +218 -0
  396. package/vendor/translators-official/La Republica (Peru).js +174 -0
  397. package/vendor/translators-official/Lagen.nu.js +214 -0
  398. package/vendor/translators-official/Landesbibliographie Baden-Wurttemberg.js +324 -0
  399. package/vendor/translators-official/Lapham's Quarterly.js +1062 -0
  400. package/vendor/translators-official/Le Devoir.js +167 -0
  401. package/vendor/translators-official/Le Figaro.js +225 -0
  402. package/vendor/translators-official/Le Maitron.js +484 -0
  403. package/vendor/translators-official/Le Monde.js +245 -0
  404. package/vendor/translators-official/Le monde diplomatique.js +200 -0
  405. package/vendor/translators-official/Legifrance.js +641 -0
  406. package/vendor/translators-official/Legislative Insight.js +406 -0
  407. package/vendor/translators-official/Lexis+.js +264 -0
  408. package/vendor/translators-official/LexisNexis.js +505 -0
  409. package/vendor/translators-official/Libraries Tasmania.js +778 -0
  410. package/vendor/translators-official/Library Catalog (Aleph).js +385 -0
  411. package/vendor/translators-official/Library Catalog (Amicus).js +254 -0
  412. package/vendor/translators-official/Library Catalog (Aquabrowser).js +253 -0
  413. package/vendor/translators-official/Library Catalog (BiblioCommons).js +249 -0
  414. package/vendor/translators-official/Library Catalog (Blacklight).js +341 -0
  415. package/vendor/translators-official/Library Catalog (Capita Prism).js +162 -0
  416. package/vendor/translators-official/Library Catalog (DRA).js +203 -0
  417. package/vendor/translators-official/Library Catalog (Dynix).js +315 -0
  418. package/vendor/translators-official/Library Catalog (EBSCO Locate).js +442 -0
  419. package/vendor/translators-official/Library Catalog (Encore).js +211 -0
  420. package/vendor/translators-official/Library Catalog (InnoPAC).js +305 -0
  421. package/vendor/translators-official/Library Catalog (Koha).js +225 -0
  422. package/vendor/translators-official/Library Catalog (Mango).js +285 -0
  423. package/vendor/translators-official/Library Catalog (OPALS).js +200 -0
  424. package/vendor/translators-official/Library Catalog (PICA).js +2120 -0
  425. package/vendor/translators-official/Library Catalog (PICA2).js +331 -0
  426. package/vendor/translators-official/Library Catalog (Pika).js +488 -0
  427. package/vendor/translators-official/Library Catalog (Polaris).js +183 -0
  428. package/vendor/translators-official/Library Catalog (Quolto).js +320 -0
  429. package/vendor/translators-official/Library Catalog (RERO ILS).js +754 -0
  430. package/vendor/translators-official/Library Catalog (SIRSI eLibrary).js +407 -0
  431. package/vendor/translators-official/Library Catalog (SIRSI).js +452 -0
  432. package/vendor/translators-official/Library Catalog (SLIMS).js +146 -0
  433. package/vendor/translators-official/Library Catalog (TIND ILS).js +773 -0
  434. package/vendor/translators-official/Library Catalog (TLCYouSeeMore).js +132 -0
  435. package/vendor/translators-official/Library Catalog (TinREAD).js +277 -0
  436. package/vendor/translators-official/Library Catalog (VTLS).js +125 -0
  437. package/vendor/translators-official/Library Catalog (Visual Library 2021).js +765 -0
  438. package/vendor/translators-official/Library Catalog (Voyager 7).js +199 -0
  439. package/vendor/translators-official/Library Catalog (Voyager).js +212 -0
  440. package/vendor/translators-official/Library Genesis.js +337 -0
  441. package/vendor/translators-official/Library Hub Discover.js +359 -0
  442. package/vendor/translators-official/Library of Congress Digital Collections.js +869 -0
  443. package/vendor/translators-official/Library of Congress ISBN.js +86 -0
  444. package/vendor/translators-official/LingBuzz.js +359 -0
  445. package/vendor/translators-official/Lippincott Williams and Wilkins.js +341 -0
  446. package/vendor/translators-official/Literary Hub.js +950 -0
  447. package/vendor/translators-official/Litres.js +236 -0
  448. package/vendor/translators-official/LiveJournal.js +219 -0
  449. package/vendor/translators-official/London Review of Books.js +291 -0
  450. package/vendor/translators-official/LookUs.js +260 -0
  451. package/vendor/translators-official/Lulu.js +264 -0
  452. package/vendor/translators-official/MAB2.js +373 -0
  453. package/vendor/translators-official/MARC.js +1080 -0
  454. package/vendor/translators-official/MARCXML.js +489 -0
  455. package/vendor/translators-official/MCV.js +258 -0
  456. package/vendor/translators-official/MDPI Journals.js +356 -0
  457. package/vendor/translators-official/MEDLINEnbib.js +1561 -0
  458. package/vendor/translators-official/METS.js +384 -0
  459. package/vendor/translators-official/MIDAS Journals.js +343 -0
  460. package/vendor/translators-official/MIT Press Books.js +637 -0
  461. package/vendor/translators-official/MODS.js +2545 -0
  462. package/vendor/translators-official/MPG PuRe.js +541 -0
  463. package/vendor/translators-official/Mailman.js +136 -0
  464. package/vendor/translators-official/Mainichi Daily News.js +189 -0
  465. package/vendor/translators-official/Mastodon.js +198 -0
  466. package/vendor/translators-official/Matbugat.ru.js +110 -0
  467. package/vendor/translators-official/Max Planck Institute for the History of Science Virtual Laboratory Library.js +136 -0
  468. package/vendor/translators-official/Medium.js +208 -0
  469. package/vendor/translators-official/MetaLib.js +126 -0
  470. package/vendor/translators-official/Microbiology Society Journals.js +343 -0
  471. package/vendor/translators-official/Microsoft Academic.js +424 -0
  472. package/vendor/translators-official/Mikromarc.js +207 -0
  473. package/vendor/translators-official/Milli Kutuphane.js +244 -0
  474. package/vendor/translators-official/Musee du Louvre.js +265 -0
  475. package/vendor/translators-official/NASA ADS.js +889 -0
  476. package/vendor/translators-official/NASA NTRS.js +610 -0
  477. package/vendor/translators-official/NCBI Nucleotide.js +227 -0
  478. package/vendor/translators-official/NPR.js +341 -0
  479. package/vendor/translators-official/NRC Research Press.js +181 -0
  480. package/vendor/translators-official/NRC.nl.js +226 -0
  481. package/vendor/translators-official/NTSB Accident Reports.js +226 -0
  482. package/vendor/translators-official/NYPL Menus.js +275 -0
  483. package/vendor/translators-official/NYPL Research Catalog.js +458 -0
  484. package/vendor/translators-official/NYTimes.com.js +947 -0
  485. package/vendor/translators-official/NZZ.ch.js +272 -0
  486. package/vendor/translators-official/Nagoya University OPAC.js +336 -0
  487. package/vendor/translators-official/National Academies Press.js +243 -0
  488. package/vendor/translators-official/National Agriculture Library.js +524 -0
  489. package/vendor/translators-official/National Archives UK Case Law.js +509 -0
  490. package/vendor/translators-official/National Archives of Australia.js +522 -0
  491. package/vendor/translators-official/National Archives of South Africa.js +122 -0
  492. package/vendor/translators-official/National Bureau of Economic Research.js +363 -0
  493. package/vendor/translators-official/National Diet Library Catalogue.js +333 -0
  494. package/vendor/translators-official/National Gallery of Art - USA.js +149 -0
  495. package/vendor/translators-official/National Gallery of Australia.js +252 -0
  496. package/vendor/translators-official/National Library of Australia (new catalog).js +223 -0
  497. package/vendor/translators-official/National Library of Belarus.js +171 -0
  498. package/vendor/translators-official/National Library of Norway.js +310 -0
  499. package/vendor/translators-official/National Library of Poland ISBN.js +140 -0
  500. package/vendor/translators-official/National Post.js +186 -0
  501. package/vendor/translators-official/National Technical Reports Library.js +276 -0
  502. package/vendor/translators-official/National Transportation Library ROSA P.js +562 -0
  503. package/vendor/translators-official/Nature Publishing Group.js +3394 -0
  504. package/vendor/translators-official/Neural Information Processing Systems.js +385 -0
  505. package/vendor/translators-official/New Left Review.js +245 -0
  506. package/vendor/translators-official/New Zealand Herald.js +282 -0
  507. package/vendor/translators-official/Newlines Magazine.js +190 -0
  508. package/vendor/translators-official/News Corp Australia.js +251 -0
  509. package/vendor/translators-official/NewsBank.js +202 -0
  510. package/vendor/translators-official/NewsnetTamedia.js +509 -0
  511. package/vendor/translators-official/Noor Digital Library.js +267 -0
  512. package/vendor/translators-official/Note HTML.js +206 -0
  513. package/vendor/translators-official/Note Markdown.js +1638 -0
  514. package/vendor/translators-official/Notre Dame Philosophical Reviews.js +201 -0
  515. package/vendor/translators-official/OAPEN.js +331 -0
  516. package/vendor/translators-official/OCLC WorldCat FirstSearch.js +213 -0
  517. package/vendor/translators-official/OECD.js +216 -0
  518. package/vendor/translators-official/ORCID.js +104 -0
  519. package/vendor/translators-official/OSF Preprints.js +1287 -0
  520. package/vendor/translators-official/OSTI Energy Citations.js +202 -0
  521. package/vendor/translators-official/OVID Tagged.js +1226 -0
  522. package/vendor/translators-official/OZON.ru.js +465 -0
  523. package/vendor/translators-official/OhioLINK.js +43 -0
  524. package/vendor/translators-official/Old Bailey Online.js +315 -0
  525. package/vendor/translators-official/Open Conf.js +172 -0
  526. package/vendor/translators-official/Open Knowledge Repository.js +811 -0
  527. package/vendor/translators-official/Open WorldCat.js +1394 -0
  528. package/vendor/translators-official/OpenAlex JSON.js +740 -0
  529. package/vendor/translators-official/OpenAlex.js +444 -0
  530. package/vendor/translators-official/OpenEdition Books.js +155 -0
  531. package/vendor/translators-official/OpenEdition Journals.js +432 -0
  532. package/vendor/translators-official/Optical Society of America.js +562 -0
  533. package/vendor/translators-official/Optimization Online.js +418 -0
  534. package/vendor/translators-official/Ovid OCE.js +353 -0
  535. package/vendor/translators-official/Ovid.js +302 -0
  536. package/vendor/translators-official/Oxford Dictionaries Premium.js +194 -0
  537. package/vendor/translators-official/Oxford English Dictionary.js +122 -0
  538. package/vendor/translators-official/Oxford Music and Art Online.js +120 -0
  539. package/vendor/translators-official/Oxford Reference.js +202 -0
  540. package/vendor/translators-official/Oxford University Press.js +277 -0
  541. package/vendor/translators-official/PC Gamer.js +302 -0
  542. package/vendor/translators-official/PC Games.js +128 -0
  543. package/vendor/translators-official/PEI Archival Information Network.js +242 -0
  544. package/vendor/translators-official/PEP Web.js +165 -0
  545. package/vendor/translators-official/PKP Catalog Systems.js +1455 -0
  546. package/vendor/translators-official/PLoS Journals.js +284 -0
  547. package/vendor/translators-official/PRC History Review.js +298 -0
  548. package/vendor/translators-official/Pajhwok Afghan News.js +198 -0
  549. package/vendor/translators-official/Papers Past.js +509 -0
  550. package/vendor/translators-official/Paris Review.js +227 -0
  551. package/vendor/translators-official/Pastebin.js +199 -0
  552. package/vendor/translators-official/Patents - USPTO.js +210 -0
  553. package/vendor/translators-official/Peeters.js +587 -0
  554. package/vendor/translators-official/Perceiving Systems.js +350 -0
  555. package/vendor/translators-official/Perlego.js +416 -0
  556. package/vendor/translators-official/PhilPapers.js +233 -0
  557. package/vendor/translators-official/Philosopher's Imprint.js +169 -0
  558. package/vendor/translators-official/Pleade.js +329 -0
  559. package/vendor/translators-official/Polygon.js +270 -0
  560. package/vendor/translators-official/Potsdamer Neueste Nachrichten.js +188 -0
  561. package/vendor/translators-official/Premium Times.js +144 -0
  562. package/vendor/translators-official/Preprints.org.js +305 -0
  563. package/vendor/translators-official/Prime 9ja Online.js +402 -0
  564. package/vendor/translators-official/Primo 2018.js +126 -0
  565. package/vendor/translators-official/Primo Normalized XML.js +1075 -0
  566. package/vendor/translators-official/Primo.js +322 -0
  567. package/vendor/translators-official/ProMED.js +66 -0
  568. package/vendor/translators-official/ProQuest Ebook Central.js +226 -0
  569. package/vendor/translators-official/ProQuest PolicyFile.js +115 -0
  570. package/vendor/translators-official/ProQuest.js +2210 -0
  571. package/vendor/translators-official/Probing the Past.js +151 -0
  572. package/vendor/translators-official/Project Gutenberg.js +191 -0
  573. package/vendor/translators-official/Project MUSE.js +451 -0
  574. package/vendor/translators-official/Protein Data Bank.js +445 -0
  575. package/vendor/translators-official/PubFactory Journals.js +712 -0
  576. package/vendor/translators-official/PubMed Central.js +563 -0
  577. package/vendor/translators-official/PubMed XML.js +1240 -0
  578. package/vendor/translators-official/PubMed.js +1317 -0
  579. package/vendor/translators-official/PubPub.js +530 -0
  580. package/vendor/translators-official/Public Record Office Victoria.js +252 -0
  581. package/vendor/translators-official/Publications Office of the European Union.js +540 -0
  582. package/vendor/translators-official/Publications du Quebec.js +225 -0
  583. package/vendor/translators-official/PyPI.js +288 -0
  584. package/vendor/translators-official/Qatar Digital Library.js +802 -0
  585. package/vendor/translators-official/Queensland State Archives.js +303 -0
  586. package/vendor/translators-official/R-Packages.js +410 -0
  587. package/vendor/translators-official/RAND.js +283 -0
  588. package/vendor/translators-official/RDF.js +1782 -0
  589. package/vendor/translators-official/REDALYC.js +196 -0
  590. package/vendor/translators-official/RIS.js +7292 -0
  591. package/vendor/translators-official/RSC Publishing.js +250 -0
  592. package/vendor/translators-official/Radio Free Europe Radio Liberty.js +706 -0
  593. package/vendor/translators-official/RePEc - Econpapers.js +725 -0
  594. package/vendor/translators-official/RePEc - IDEAS.js +337 -0
  595. package/vendor/translators-official/Rechtspraak.nl.js +295 -0
  596. package/vendor/translators-official/RefWorks Tagged.js +1185 -0
  597. package/vendor/translators-official/ReferBibIX.js +463 -0
  598. package/vendor/translators-official/Regeringskansliet.js +89 -0
  599. package/vendor/translators-official/Research Square.js +335 -0
  600. package/vendor/translators-official/ResearchGate.js +394 -0
  601. package/vendor/translators-official/Retsinformation.js +348 -0
  602. package/vendor/translators-official/Reuters.js +255 -0
  603. package/vendor/translators-official/Rock, Paper, Shotgun.js +304 -0
  604. package/vendor/translators-official/Roll Call.js +173 -0
  605. package/vendor/translators-official/Russian State Library.js +1517 -0
  606. package/vendor/translators-official/SAE Papers.js +241 -0
  607. package/vendor/translators-official/SAGE Journals.js +429 -0
  608. package/vendor/translators-official/SAGE Knowledge.js +505 -0
  609. package/vendor/translators-official/SAILDART.js +364 -0
  610. package/vendor/translators-official/SALT Research Archives.js +196 -0
  611. package/vendor/translators-official/SFU IPinCH.js +946 -0
  612. package/vendor/translators-official/SIPRI.js +256 -0
  613. package/vendor/translators-official/SIRS Knowledge Source.js +546 -0
  614. package/vendor/translators-official/SLUB Dresden.js +300 -0
  615. package/vendor/translators-official/SORA.js +340 -0
  616. package/vendor/translators-official/SSOAR.js +399 -0
  617. package/vendor/translators-official/SSRN.js +235 -0
  618. package/vendor/translators-official/SVT Nyheter.js +381 -0
  619. package/vendor/translators-official/Sacramento Bee.js +274 -0
  620. package/vendor/translators-official/Safari Books Online.js +391 -0
  621. package/vendor/translators-official/Scholars Portal Journals.js +220 -0
  622. package/vendor/translators-official/Scholia.js +189 -0
  623. package/vendor/translators-official/Schweizer Radio und Fernsehen SRF.js +152 -0
  624. package/vendor/translators-official/SciELO.js +440 -0
  625. package/vendor/translators-official/ScienceDirect.js +1306 -0
  626. package/vendor/translators-official/Scopus.js +418 -0
  627. package/vendor/translators-official/Semantic Scholar.js +513 -0
  628. package/vendor/translators-official/Silverchair.js +886 -0
  629. package/vendor/translators-official/Slate.js +228 -0
  630. package/vendor/translators-official/SlideShare.js +112 -0
  631. package/vendor/translators-official/Springer Link.js +696 -0
  632. package/vendor/translators-official/Stack Exchange.js +134 -0
  633. package/vendor/translators-official/Standard Ebooks.js +198 -0
  634. package/vendor/translators-official/Stanford Encyclopedia of Philosophy.js +285 -0
  635. package/vendor/translators-official/Stanford University Press.js +343 -0
  636. package/vendor/translators-official/State Records Office of Western Australia.js +439 -0
  637. package/vendor/translators-official/Stitcher.js +141 -0
  638. package/vendor/translators-official/Store norske leksikon.js +291 -0
  639. package/vendor/translators-official/Stuff.co.nz.js +446 -0
  640. package/vendor/translators-official/Substack.js +237 -0
  641. package/vendor/translators-official/Sud Ouest.js +181 -0
  642. package/vendor/translators-official/Sueddeutsche.de.js +205 -0
  643. package/vendor/translators-official/Summon 2.js +117 -0
  644. package/vendor/translators-official/Superlib.js +647 -0
  645. package/vendor/translators-official/Svenska Dagbladet.js +274 -0
  646. package/vendor/translators-official/Sveriges radio.js +416 -0
  647. package/vendor/translators-official/TEI.js +648 -0
  648. package/vendor/translators-official/TV by the Numbers.js +194 -0
  649. package/vendor/translators-official/TVNZ.js +165 -0
  650. package/vendor/translators-official/Tagesspiegel.js +249 -0
  651. package/vendor/translators-official/Talis Aspire.js +316 -0
  652. package/vendor/translators-official/TalisPrism.js +445 -0
  653. package/vendor/translators-official/Tatknigafund.js +174 -0
  654. package/vendor/translators-official/Tatpressa.ru.js +121 -0
  655. package/vendor/translators-official/Taylor & Francis eBooks.js +334 -0
  656. package/vendor/translators-official/Taylor and Francis+NEJM.js +813 -0
  657. package/vendor/translators-official/Tesis Doctorals en Xarxa.js +233 -0
  658. package/vendor/translators-official/The Art Newspaper.js +268 -0
  659. package/vendor/translators-official/The Atlantic.js +535 -0
  660. package/vendor/translators-official/The Boston Globe.js +285 -0
  661. package/vendor/translators-official/The Chronicle of Higher Education.js +308 -0
  662. package/vendor/translators-official/The Daily Beast.js +183 -0
  663. package/vendor/translators-official/The Economic Times - The Times of India.js +305 -0
  664. package/vendor/translators-official/The Economist.js +207 -0
  665. package/vendor/translators-official/The Free Dictionary.js +58 -0
  666. package/vendor/translators-official/The Globe and Mail.js +241 -0
  667. package/vendor/translators-official/The Guardian.js +717 -0
  668. package/vendor/translators-official/The Hamilton Spectator.js +129 -0
  669. package/vendor/translators-official/The Hindu.js +318 -0
  670. package/vendor/translators-official/The Independent.js +184 -0
  671. package/vendor/translators-official/The Intercept.js +258 -0
  672. package/vendor/translators-official/The Met.js +276 -0
  673. package/vendor/translators-official/The Microfinance Gateway.js +174 -0
  674. package/vendor/translators-official/The Nation.js +188 -0
  675. package/vendor/translators-official/The National Archives (UK).js +242 -0
  676. package/vendor/translators-official/The New Republic.js +160 -0
  677. package/vendor/translators-official/The New York Review of Books.js +467 -0
  678. package/vendor/translators-official/The New Yorker.js +360 -0
  679. package/vendor/translators-official/The Open Library.js +220 -0
  680. package/vendor/translators-official/The Straits Times.js +528 -0
  681. package/vendor/translators-official/The Telegraph.js +337 -0
  682. package/vendor/translators-official/The Times and Sunday Times.js +180 -0
  683. package/vendor/translators-official/The Times of Israel.js +151 -0
  684. package/vendor/translators-official/TheMarker.js +108 -0
  685. package/vendor/translators-official/Theory of Computing.js +488 -0
  686. package/vendor/translators-official/ThesesFR.js +405 -0
  687. package/vendor/translators-official/Thieme.js +326 -0
  688. package/vendor/translators-official/Time.com.js +557 -0
  689. package/vendor/translators-official/TimesMachine.js +222 -0
  690. package/vendor/translators-official/Tony Blair Institute for Global Change.js +195 -0
  691. package/vendor/translators-official/Toronto Star.js +298 -0
  692. package/vendor/translators-official/Transportation Research Board.js +253 -0
  693. package/vendor/translators-official/Treesearch.js +535 -0
  694. package/vendor/translators-official/Trove.js +616 -0
  695. package/vendor/translators-official/Tumblr.js +179 -0
  696. package/vendor/translators-official/Twitter.js +413 -0
  697. package/vendor/translators-official/UChicago VuFind.js +907 -0
  698. package/vendor/translators-official/UNZ Print Archive.js +276 -0
  699. package/vendor/translators-official/UPCommons.js +227 -0
  700. package/vendor/translators-official/US National Archives Research Catalog.js +275 -0
  701. package/vendor/translators-official/USENIX.js +151 -0
  702. package/vendor/translators-official/Ubiquity Journals.js +228 -0
  703. package/vendor/translators-official/University Press Scholarship.js +301 -0
  704. package/vendor/translators-official/University of California Press Books.js +403 -0
  705. package/vendor/translators-official/University of Chicago Press Books.js +378 -0
  706. package/vendor/translators-official/University of Wisconsin-Madison Libraries Catalog.js +298 -0
  707. package/vendor/translators-official/Unqualified Dublin Core RDF.js +153 -0
  708. package/vendor/translators-official/UpToDate References.js +203 -0
  709. package/vendor/translators-official/Vanity Fair.js +242 -0
  710. package/vendor/translators-official/Verniana-Jules Verne Studies.js +190 -0
  711. package/vendor/translators-official/Verso Books.js +311 -0
  712. package/vendor/translators-official/Vice.js +445 -0
  713. package/vendor/translators-official/Victoria & Albert Museum.js +277 -0
  714. package/vendor/translators-official/Vimeo.js +188 -0
  715. package/vendor/translators-official/VoxEU.js +151 -0
  716. package/vendor/translators-official/WHO.js +458 -0
  717. package/vendor/translators-official/WIPO.js +189 -0
  718. package/vendor/translators-official/Wall Street Journal.js +809 -0
  719. package/vendor/translators-official/Wanfang Data.js +310 -0
  720. package/vendor/translators-official/Washington Monthly.js +195 -0
  721. package/vendor/translators-official/Washington Post.js +447 -0
  722. package/vendor/translators-official/Web of Science Nextgen.js +832 -0
  723. package/vendor/translators-official/Web of Science Tagged.js +1247 -0
  724. package/vendor/translators-official/Web of Science.js +228 -0
  725. package/vendor/translators-official/Welt Online.js +161 -0
  726. package/vendor/translators-official/WestLaw UK.js +190 -0
  727. package/vendor/translators-official/WikiLeaks PlusD.js +182 -0
  728. package/vendor/translators-official/Wikidata QuickStatements.js +324 -0
  729. package/vendor/translators-official/Wikidata.js +911 -0
  730. package/vendor/translators-official/Wikimedia Commons.js +285 -0
  731. package/vendor/translators-official/Wikipedia Citation Templates.js +432 -0
  732. package/vendor/translators-official/Wikipedia.js +385 -0
  733. package/vendor/translators-official/Wikisource.js +399 -0
  734. package/vendor/translators-official/Wikiwand.js +122 -0
  735. package/vendor/translators-official/Wiktionary.js +141 -0
  736. package/vendor/translators-official/Wildlife Biology in Practice.js +172 -0
  737. package/vendor/translators-official/Wiley Online Library.js +1412 -0
  738. package/vendor/translators-official/Wilson Center Digital Archive.js +321 -0
  739. package/vendor/translators-official/Winnipeg Free Press.js +204 -0
  740. package/vendor/translators-official/Wired.js +362 -0
  741. package/vendor/translators-official/Womennews.js +230 -0
  742. package/vendor/translators-official/World Digital Library.js +403 -0
  743. package/vendor/translators-official/World History Connected.js +185 -0
  744. package/vendor/translators-official/World Shakespeare Bibliography Online.js +595 -0
  745. package/vendor/translators-official/WorldCat Discovery Service.js +630 -0
  746. package/vendor/translators-official/XML ContextObject.js +274 -0
  747. package/vendor/translators-official/YPSF.js +224 -0
  748. package/vendor/translators-official/Yandex Books.js +265 -0
  749. package/vendor/translators-official/Ynet.js +171 -0
  750. package/vendor/translators-official/YouTube.js +209 -0
  751. package/vendor/translators-official/ZIPonline.js +267 -0
  752. package/vendor/translators-official/ZOBODAT.js +341 -0
  753. package/vendor/translators-official/Zotero RDF.js +588 -0
  754. package/vendor/translators-official/ZoteroBib.js +94 -0
  755. package/vendor/translators-official/arXiv.org.js +1100 -0
  756. package/vendor/translators-official/artnet.js +207 -0
  757. package/vendor/translators-official/beck-online.js +1339 -0
  758. package/vendor/translators-official/clinicaltrials.gov.js +331 -0
  759. package/vendor/translators-official/dLibra.js +367 -0
  760. package/vendor/translators-official/dejure.org.js +242 -0
  761. package/vendor/translators-official/dhistory.js +103 -0
  762. package/vendor/translators-official/digibib.net.js +245 -0
  763. package/vendor/translators-official/eLibrary.ru.js +867 -0
  764. package/vendor/translators-official/eLife.js +462 -0
  765. package/vendor/translators-official/eMJA.js +246 -0
  766. package/vendor/translators-official/eMedicine.js +123 -0
  767. package/vendor/translators-official/ePrint IACR.js +608 -0
  768. package/vendor/translators-official/ebrary.js +140 -0
  769. package/vendor/translators-official/etatar.ru.js +104 -0
  770. package/vendor/translators-official/feb-web.ru.js +167 -0
  771. package/vendor/translators-official/fishpond.co.nz.js +224 -0
  772. package/vendor/translators-official/fr-online.de.js +209 -0
  773. package/vendor/translators-official/govinfo.js +189 -0
  774. package/vendor/translators-official/informIT database.js +248 -0
  775. package/vendor/translators-official/io-port.js +68 -0
  776. package/vendor/translators-official/jurion.js +377 -0
  777. package/vendor/translators-official/mEDRA.js +597 -0
  778. package/vendor/translators-official/magazines.russ.ru.js +120 -0
  779. package/vendor/translators-official/medes.js +284 -0
  780. package/vendor/translators-official/newshub.co.nz.js +206 -0
  781. package/vendor/translators-official/newspapers.com.js +335 -0
  782. package/vendor/translators-official/openJur.js +161 -0
  783. package/vendor/translators-official/reddit.js +275 -0
  784. package/vendor/translators-official/sbn.it.js +186 -0
  785. package/vendor/translators-official/scinapse.js +273 -0
  786. package/vendor/translators-official/semantics Visual Library.js +643 -0
  787. package/vendor/translators-official/taz.de.js +200 -0
  788. package/vendor/translators-official/unAPI.js +481 -0
  789. package/vendor/translators-official/wiso.js +314 -0
  790. package/vendor/translators-official/zbMATH.js +278 -0
  791. package/vendor/translators-official/zotero.org.js +311 -0
  792. package/vendor/translators_CN/Angle.js +468 -0
  793. package/vendor/translators_CN/Baidu Baike.js +152 -0
  794. package/vendor/translators_CN/Baidu Scholar.js +639 -0
  795. package/vendor/translators_CN/Belt and Road Database.js +496 -0
  796. package/vendor/translators_CN/BiliBili.js +776 -0
  797. package/vendor/translators_CN/CCPINFO.js +416 -0
  798. package/vendor/translators_CN/CHINESE JOURNAL OF LAW.js +169 -0
  799. package/vendor/translators_CN/CNBKSY.js +385 -0
  800. package/vendor/translators_CN/CNKI CHKD.js +692 -0
  801. package/vendor/translators_CN/CNKI Gongjushu.js +271 -0
  802. package/vendor/translators_CN/CNKI Industry.js +726 -0
  803. package/vendor/translators_CN/CNKI Law.js +842 -0
  804. package/vendor/translators_CN/CNKI RefWorks.js +826 -0
  805. package/vendor/translators_CN/CNKI Refer.js +811 -0
  806. package/vendor/translators_CN/CNKI Scholar.js +656 -0
  807. package/vendor/translators_CN/CNKI TIKS.js +1028 -0
  808. package/vendor/translators_CN/CNKI e-Books.js +309 -0
  809. package/vendor/translators_CN/CNKI thinker.js +274 -0
  810. package/vendor/translators_CN/CNKI.js +2381 -0
  811. package/vendor/translators_CN/CNSDA.js +382 -0
  812. package/vendor/translators_CN/CQVIP Knowledge.js +969 -0
  813. package/vendor/translators_CN/CQVIP Qikan.js +418 -0
  814. package/vendor/translators_CN/CQVIP.js +686 -0
  815. package/vendor/translators_CN/CSDN.js +153 -0
  816. package/vendor/translators_CN/China Judgements Online.js +282 -0
  817. package/vendor/translators_CN/China Social Science Library.js +533 -0
  818. package/vendor/translators_CN/ChinaXiv.js +375 -0
  819. package/vendor/translators_CN/Cubox.js +246 -0
  820. package/vendor/translators_CN/Dangdang.js +176 -0
  821. package/vendor/translators_CN/Douban.js +984 -0
  822. package/vendor/translators_CN/Duxiu.js +746 -0
  823. package/vendor/translators_CN/E-Tiller.js +555 -0
  824. package/vendor/translators_CN/Encyclopedia of China 3rd.js +177 -0
  825. package/vendor/translators_CN/Founder.js +483 -0
  826. package/vendor/translators_CN/GFSOSO.js +694 -0
  827. package/vendor/translators_CN/Jd.js +235 -0
  828. package/vendor/translators_CN/Jikan Full Text Database.js +188 -0
  829. package/vendor/translators_CN/KouShare.js +139 -0
  830. package/vendor/translators_CN/LICENSE +661 -0
  831. package/vendor/translators_CN/Lawbank.js +818 -0
  832. package/vendor/translators_CN/MagTech.js +473 -0
  833. package/vendor/translators_CN/Modern History.js +788 -0
  834. package/vendor/translators_CN/NDLTD.js +404 -0
  835. package/vendor/translators_CN/NTU Digital Library of Buddhist Studies.js +957 -0
  836. package/vendor/translators_CN/National Public Service Platform for Standards Information - China.js +348 -0
  837. package/vendor/translators_CN/National Science and Technology Library - China.js +646 -0
  838. package/vendor/translators_CN/National Science and Technology Report Service - China.js +271 -0
  839. package/vendor/translators_CN/National Standards Open System - China.js +296 -0
  840. package/vendor/translators_CN/Ncpssd.js +555 -0
  841. package/vendor/translators_CN/PKULaw.js +1123 -0
  842. package/vendor/translators_CN/PatentStar.js +386 -0
  843. package/vendor/translators_CN/People's Daily Database.js +186 -0
  844. package/vendor/translators_CN/People's Daily Epaper.js +279 -0
  845. package/vendor/translators_CN/People's Daily Online.js +292 -0
  846. package/vendor/translators_CN/Pishu Database.js +383 -0
  847. package/vendor/translators_CN/ProQuestCN Thesis.js +329 -0
  848. package/vendor/translators_CN/Pss-System.js +199 -0
  849. package/vendor/translators_CN/PubScholar.js +588 -0
  850. package/vendor/translators_CN/Publications Data Center - China.js +1119 -0
  851. package/vendor/translators_CN/QStheory.js +251 -0
  852. package/vendor/translators_CN/RDFYBK.js +396 -0
  853. package/vendor/translators_CN/README.md +42 -0
  854. package/vendor/translators_CN/RHHZ.js +383 -0
  855. package/vendor/translators_CN/Rural Studies Database.js +402 -0
  856. package/vendor/translators_CN/SKCTK.js +177 -0
  857. package/vendor/translators_CN/Samson.js +768 -0
  858. package/vendor/translators_CN/SciEngine.js +450 -0
  859. package/vendor/translators_CN/Science Reading.js +338 -0
  860. package/vendor/translators_CN/Sina Weibo.js +254 -0
  861. package/vendor/translators_CN/Soopat.js +427 -0
  862. package/vendor/translators_CN/Spc.org.cn.js +275 -0
  863. package/vendor/translators_CN/Standard Full-text Database - NLC.js +230 -0
  864. package/vendor/translators_CN/SuperLib.js +757 -0
  865. package/vendor/translators_CN/TOAJ.js +422 -0
  866. package/vendor/translators_CN/Wanfang Data.js +3433 -0
  867. package/vendor/translators_CN/Wanfang Med.js +671 -0
  868. package/vendor/translators_CN/Web of Science Tagged.js +1341 -0
  869. package/vendor/translators_CN/Weixin.js +130 -0
  870. package/vendor/translators_CN/Wenjin.js +492 -0
  871. package/vendor/translators_CN/Xinhuanet.js +283 -0
  872. package/vendor/translators_CN/Yiigle.js +394 -0
  873. package/vendor/translators_CN/Zhihu.js +530 -0
  874. package/vendor/translators_CN/Zhihuiya.js +246 -0
  875. package/vendor/translators_CN/Zhizhen.js +869 -0
  876. package/vendor/translators_CN/chaoxingqikan.js +360 -0
  877. package/vendor/translators_CN/doc.taixueshu.js +355 -0
  878. package/vendor/translators_CN/dpaper.js +183 -0
  879. package/vendor/translators_CN/epaper.gmw.cn.js +286 -0
  880. package/vendor/translators_CN/flk.npc.gov.cn.js +344 -0
  881. package/vendor/translators_CN/gov.cn Policy.js +559 -0
  882. package/vendor/translators_CN/incoPat.js +195 -0
  883. package/vendor/translators_CN/pm.tsgyun.js +177 -0
  884. package/vendor/translators_CN/sanmin.com.tw.js +327 -0
  885. package/vendor/translators_CN/sharing.com.tw.js +333 -0
  886. package/vendor/translators_CN/stats.gov.cn.js +170 -0
  887. package/vendor/translators_CN/xiaoyuzhoufm.js +162 -0
  888. package/vendor/translators_CN/zhangqiaokeyan.js +1130 -0
  889. package/vendor/zotero/README.md +120 -0
  890. package/vendor/zotero/config/custom-environment-variables.json +3 -0
  891. package/vendor/zotero/config/default.json5 +16 -0
  892. package/vendor/zotero/config/production.json5 +7 -0
  893. package/vendor/zotero/config/test.json5 +4 -0
  894. package/vendor/zotero/modules/translate/README.md +43 -0
  895. package/vendor/zotero/modules/translate/src/debug.js +186 -0
  896. package/vendor/zotero/modules/translate/src/http.js +158 -0
  897. package/vendor/zotero/modules/translate/src/promise.js +73 -0
  898. package/vendor/zotero/modules/translate/src/proxy.js +354 -0
  899. package/vendor/zotero/modules/translate/src/rdf/identity.js +503 -0
  900. package/vendor/zotero/modules/translate/src/rdf/init.js +56 -0
  901. package/vendor/zotero/modules/translate/src/rdf/n3parser.js +1392 -0
  902. package/vendor/zotero/modules/translate/src/rdf/rdfparser.js +578 -0
  903. package/vendor/zotero/modules/translate/src/rdf/serialize.js +886 -0
  904. package/vendor/zotero/modules/translate/src/rdf/term.js +524 -0
  905. package/vendor/zotero/modules/translate/src/rdf/uri.js +147 -0
  906. package/vendor/zotero/modules/translate/src/repo.js +80 -0
  907. package/vendor/zotero/modules/translate/src/tlds.js +274 -0
  908. package/vendor/zotero/modules/translate/src/translation/sandboxManager.js +112 -0
  909. package/vendor/zotero/modules/translate/src/translation/translate.js +3283 -0
  910. package/vendor/zotero/modules/translate/src/translation/translate_item.js +120 -0
  911. package/vendor/zotero/modules/translate/src/translator.js +186 -0
  912. package/vendor/zotero/modules/translate/src/translators.js +174 -0
  913. package/vendor/zotero/modules/translate/src/utilities_translate.js +487 -0
  914. package/vendor/zotero/modules/translate/src/zotero.js +94 -0
  915. package/vendor/zotero/modules/translators/A Contra Corriente.js +206 -0
  916. package/vendor/zotero/modules/translators/ABC News Australia.js +224 -0
  917. package/vendor/zotero/modules/translators/ACLS Humanities EBook.js +165 -0
  918. package/vendor/zotero/modules/translators/ACLWeb.js +600 -0
  919. package/vendor/zotero/modules/translators/ACM Digital Library.js +710 -0
  920. package/vendor/zotero/modules/translators/ACS Publications.js +633 -0
  921. package/vendor/zotero/modules/translators/ADS Bibcode.js +664 -0
  922. package/vendor/zotero/modules/translators/AEA Web.js +450 -0
  923. package/vendor/zotero/modules/translators/AGRIS.js +311 -0
  924. package/vendor/zotero/modules/translators/AIP.js +295 -0
  925. package/vendor/zotero/modules/translators/AMS Journals.js +136 -0
  926. package/vendor/zotero/modules/translators/AMS MathSciNet (Legacy).js +313 -0
  927. package/vendor/zotero/modules/translators/AMS MathSciNet.js +288 -0
  928. package/vendor/zotero/modules/translators/APA PsycNET.js +915 -0
  929. package/vendor/zotero/modules/translators/APN.ru.js +132 -0
  930. package/vendor/zotero/modules/translators/APS-Physics.js +204 -0
  931. package/vendor/zotero/modules/translators/APS.js +542 -0
  932. package/vendor/zotero/modules/translators/ARTFL Encyclopedie.js +283 -0
  933. package/vendor/zotero/modules/translators/ARTnews.js +155 -0
  934. package/vendor/zotero/modules/translators/ARTstor.js +619 -0
  935. package/vendor/zotero/modules/translators/ASCE.js +199 -0
  936. package/vendor/zotero/modules/translators/ASCO Meeting Library.js +153 -0
  937. package/vendor/zotero/modules/translators/ASTIS.js +337 -0
  938. package/vendor/zotero/modules/translators/ATS International Journal.js +290 -0
  939. package/vendor/zotero/modules/translators/Access Engineering.js +384 -0
  940. package/vendor/zotero/modules/translators/Access Medicine.js +343 -0
  941. package/vendor/zotero/modules/translators/Access Science.js +391 -0
  942. package/vendor/zotero/modules/translators/Adam Matthew Digital.js +405 -0
  943. package/vendor/zotero/modules/translators/Agencia del ISBN.js +77 -0
  944. package/vendor/zotero/modules/translators/Ahval News.js +309 -0
  945. package/vendor/zotero/modules/translators/Air University Journals.js +236 -0
  946. package/vendor/zotero/modules/translators/Airiti.js +423 -0
  947. package/vendor/zotero/modules/translators/Alexander Street Press.js +198 -0
  948. package/vendor/zotero/modules/translators/AllAfrica.js +291 -0
  949. package/vendor/zotero/modules/translators/Alsharekh.js +242 -0
  950. package/vendor/zotero/modules/translators/AlterNet.js +134 -0
  951. package/vendor/zotero/modules/translators/Aluka.js +261 -0
  952. package/vendor/zotero/modules/translators/Amazon.js +1043 -0
  953. package/vendor/zotero/modules/translators/American Archive of Public Broadcasting.js +592 -0
  954. package/vendor/zotero/modules/translators/American Institute of Aeronautics and Astronautics.js +210 -0
  955. package/vendor/zotero/modules/translators/American Prospect.js +114 -0
  956. package/vendor/zotero/modules/translators/Ancestry.com US Federal Census.js +164 -0
  957. package/vendor/zotero/modules/translators/Annual Reviews.js +329 -0
  958. package/vendor/zotero/modules/translators/Antikvarium.hu.js +280 -0
  959. package/vendor/zotero/modules/translators/AquaDocs.js +390 -0
  960. package/vendor/zotero/modules/translators/Archeion.js +249 -0
  961. package/vendor/zotero/modules/translators/Archiv fuer Sozialgeschichte.js +157 -0
  962. package/vendor/zotero/modules/translators/Archive Ouverte en Sciences de l'Information et de la Communication (AOSIC).js +179 -0
  963. package/vendor/zotero/modules/translators/Archives Canada.js +142 -0
  964. package/vendor/zotero/modules/translators/Ariana News.js +203 -0
  965. package/vendor/zotero/modules/translators/Art Institute of Chicago.js +279 -0
  966. package/vendor/zotero/modules/translators/Artefacts Canada.js +192 -0
  967. package/vendor/zotero/modules/translators/Artforum.js +438 -0
  968. package/vendor/zotero/modules/translators/Atlanta Journal Constitution.js +155 -0
  969. package/vendor/zotero/modules/translators/Atlanta Journal-Constitution.js +311 -0
  970. package/vendor/zotero/modules/translators/Atypon Journals.js +1204 -0
  971. package/vendor/zotero/modules/translators/AustLII and NZLII.js +604 -0
  972. package/vendor/zotero/modules/translators/Australian Dictionary of Biography.js +196 -0
  973. package/vendor/zotero/modules/translators/BAILII.js +176 -0
  974. package/vendor/zotero/modules/translators/BBC Genome.js +254 -0
  975. package/vendor/zotero/modules/translators/BBC.js +430 -0
  976. package/vendor/zotero/modules/translators/BIBSYS.js +112 -0
  977. package/vendor/zotero/modules/translators/BOCC.js +217 -0
  978. package/vendor/zotero/modules/translators/BOE.js +229 -0
  979. package/vendor/zotero/modules/translators/BOFiP-Impots.js +132 -0
  980. package/vendor/zotero/modules/translators/Baidu Scholar.js +276 -0
  981. package/vendor/zotero/modules/translators/Bangkok Post.js +216 -0
  982. package/vendor/zotero/modules/translators/Baruch Foundation.js +175 -0
  983. package/vendor/zotero/modules/translators/Beobachter.js +175 -0
  984. package/vendor/zotero/modules/translators/Bezneng Gajit.js +92 -0
  985. package/vendor/zotero/modules/translators/BibLaTeX.js +888 -0
  986. package/vendor/zotero/modules/translators/BibTeX.js +4236 -0
  987. package/vendor/zotero/modules/translators/Biblio.com.js +216 -0
  988. package/vendor/zotero/modules/translators/Bibliontology RDF.js +1166 -0
  989. package/vendor/zotero/modules/translators/Biblioteca Nacional de Maestros.js +213 -0
  990. package/vendor/zotero/modules/translators/Bibliotheque et Archives Nationale du Quebec (Pistard).js +147 -0
  991. package/vendor/zotero/modules/translators/Bibliotheque et Archives Nationales du Quebec.js +266 -0
  992. package/vendor/zotero/modules/translators/Bibliotheque nationale de France.js +872 -0
  993. package/vendor/zotero/modules/translators/BioMed Central.js +585 -0
  994. package/vendor/zotero/modules/translators/BioOne.js +233 -0
  995. package/vendor/zotero/modules/translators/Bioconductor.js +343 -0
  996. package/vendor/zotero/modules/translators/Blaetter.js +192 -0
  997. package/vendor/zotero/modules/translators/Blogger.js +244 -0
  998. package/vendor/zotero/modules/translators/Bloomberg.js +205 -0
  999. package/vendor/zotero/modules/translators/Bloomsbury Food Library.js +296 -0
  1000. package/vendor/zotero/modules/translators/Bluesky.js +195 -0
  1001. package/vendor/zotero/modules/translators/BnF ISBN.js +129 -0
  1002. package/vendor/zotero/modules/translators/Bookmarks.js +282 -0
  1003. package/vendor/zotero/modules/translators/Bookshop.org.js +223 -0
  1004. package/vendor/zotero/modules/translators/Boston Review.js +332 -0
  1005. package/vendor/zotero/modules/translators/Bosworth Toller's Anglo-Saxon Dictionary Online.js +496 -0
  1006. package/vendor/zotero/modules/translators/Bracero History Archive.js +200 -0
  1007. package/vendor/zotero/modules/translators/Brill Journals.js +168 -0
  1008. package/vendor/zotero/modules/translators/Brill.js +434 -0
  1009. package/vendor/zotero/modules/translators/Brukerhandboken.js +153 -0
  1010. package/vendor/zotero/modules/translators/Bryn Mawr Classical Review.js +303 -0
  1011. package/vendor/zotero/modules/translators/Bundesgesetzblatt.js +231 -0
  1012. package/vendor/zotero/modules/translators/Business Standard.js +151 -0
  1013. package/vendor/zotero/modules/translators/CABI - CAB Abstracts.js +317 -0
  1014. package/vendor/zotero/modules/translators/CAOD.js +260 -0
  1015. package/vendor/zotero/modules/translators/CBC.js +439 -0
  1016. package/vendor/zotero/modules/translators/CCfr (BnF).js +162 -0
  1017. package/vendor/zotero/modules/translators/CERN Document Server.js +277 -0
  1018. package/vendor/zotero/modules/translators/CEUR Workshop Proceedings.js +145 -0
  1019. package/vendor/zotero/modules/translators/CFF References.js +170 -0
  1020. package/vendor/zotero/modules/translators/CFF.js +113 -0
  1021. package/vendor/zotero/modules/translators/CIA World Factbook.js +128 -0
  1022. package/vendor/zotero/modules/translators/CLACSO.js +226 -0
  1023. package/vendor/zotero/modules/translators/CLASE.js +135 -0
  1024. package/vendor/zotero/modules/translators/CNKI.js +731 -0
  1025. package/vendor/zotero/modules/translators/COBISS.js +1945 -0
  1026. package/vendor/zotero/modules/translators/COinS.js +336 -0
  1027. package/vendor/zotero/modules/translators/CQ Press.js +418 -0
  1028. package/vendor/zotero/modules/translators/CROSBI.js +227 -0
  1029. package/vendor/zotero/modules/translators/CSIRO Publishing.js +139 -0
  1030. package/vendor/zotero/modules/translators/CSL JSON.js +203 -0
  1031. package/vendor/zotero/modules/translators/CSV.js +294 -0
  1032. package/vendor/zotero/modules/translators/Cairn.info.js +368 -0
  1033. package/vendor/zotero/modules/translators/CalMatters.js +228 -0
  1034. package/vendor/zotero/modules/translators/Calisphere.js +355 -0
  1035. package/vendor/zotero/modules/translators/Camara Brasileira do Livro ISBN.js +842 -0
  1036. package/vendor/zotero/modules/translators/Cambridge Core.js +580 -0
  1037. package/vendor/zotero/modules/translators/Cambridge Engage Preprints.js +276 -0
  1038. package/vendor/zotero/modules/translators/CanLII.js +284 -0
  1039. package/vendor/zotero/modules/translators/Canada.com.js +171 -0
  1040. package/vendor/zotero/modules/translators/Canadian Letters and Images.js +148 -0
  1041. package/vendor/zotero/modules/translators/Canadiana.ca.js +196 -0
  1042. package/vendor/zotero/modules/translators/Cascadilla Proceedings Project.js +390 -0
  1043. package/vendor/zotero/modules/translators/Cell Press.js +516 -0
  1044. package/vendor/zotero/modules/translators/Central and Eastern European Online Library Journals.js +313 -0
  1045. package/vendor/zotero/modules/translators/Champlain Society - Collection.js +220 -0
  1046. package/vendor/zotero/modules/translators/Chicago Journal of Theoretical Computer Science.js +203 -0
  1047. package/vendor/zotero/modules/translators/Christian Science Monitor.js +148 -0
  1048. package/vendor/zotero/modules/translators/Chronicling America.js +131 -0
  1049. package/vendor/zotero/modules/translators/CiNii Research.js +168 -0
  1050. package/vendor/zotero/modules/translators/Citavi 5 XML.js +516 -0
  1051. package/vendor/zotero/modules/translators/CiteSeer.js +196 -0
  1052. package/vendor/zotero/modules/translators/CiteULike.js +170 -0
  1053. package/vendor/zotero/modules/translators/Citizen Lab.js +347 -0
  1054. package/vendor/zotero/modules/translators/Civilization.ca.js +146 -0
  1055. package/vendor/zotero/modules/translators/Climate Change and Human Health Literature Portal.js +283 -0
  1056. package/vendor/zotero/modules/translators/Clinical Key.js +367 -0
  1057. package/vendor/zotero/modules/translators/Code4Lib Journal.js +143 -0
  1058. package/vendor/zotero/modules/translators/Colorado State Legislature.js +215 -0
  1059. package/vendor/zotero/modules/translators/Columbia University Press.js +238 -0
  1060. package/vendor/zotero/modules/translators/Common-Place.js +218 -0
  1061. package/vendor/zotero/modules/translators/Computer History Museum Archive.js +1319 -0
  1062. package/vendor/zotero/modules/translators/Copernicus.js +461 -0
  1063. package/vendor/zotero/modules/translators/Cornell LII.js +252 -0
  1064. package/vendor/zotero/modules/translators/Cornell University Press.js +235 -0
  1065. package/vendor/zotero/modules/translators/CourtListener.js +265 -0
  1066. package/vendor/zotero/modules/translators/CrossRef.js +486 -0
  1067. package/vendor/zotero/modules/translators/Crossref REST.js +1757 -0
  1068. package/vendor/zotero/modules/translators/Crossref Unixref XML.js +965 -0
  1069. package/vendor/zotero/modules/translators/Current Affairs.js +160 -0
  1070. package/vendor/zotero/modules/translators/Cyberpresse.js +131 -0
  1071. package/vendor/zotero/modules/translators/DABI.js +476 -0
  1072. package/vendor/zotero/modules/translators/DAI-Zenon.js +392 -0
  1073. package/vendor/zotero/modules/translators/DART-Europe.js +176 -0
  1074. package/vendor/zotero/modules/translators/DBLP Computer Science Bibliography.js +462 -0
  1075. package/vendor/zotero/modules/translators/DBpia.js +233 -0
  1076. package/vendor/zotero/modules/translators/DEPATISnet.js +373 -0
  1077. package/vendor/zotero/modules/translators/DOAJ.js +243 -0
  1078. package/vendor/zotero/modules/translators/DOI Content Negotiation.js +352 -0
  1079. package/vendor/zotero/modules/translators/DOI.js +322 -0
  1080. package/vendor/zotero/modules/translators/DPLA.js +425 -0
  1081. package/vendor/zotero/modules/translators/DSpace Intermediate Metadata.js +208 -0
  1082. package/vendor/zotero/modules/translators/DTU Orbit.js +155 -0
  1083. package/vendor/zotero/modules/translators/Dagens Nyheter.js +369 -0
  1084. package/vendor/zotero/modules/translators/Dagstuhl Research Online Publication Server.js +276 -0
  1085. package/vendor/zotero/modules/translators/Dar Almandumah.js +253 -0
  1086. package/vendor/zotero/modules/translators/Data.gov.js +225 -0
  1087. package/vendor/zotero/modules/translators/DataCite.js +125 -0
  1088. package/vendor/zotero/modules/translators/Databrary.js +184 -0
  1089. package/vendor/zotero/modules/translators/Datacite JSON.js +1182 -0
  1090. package/vendor/zotero/modules/translators/Dataverse.js +418 -0
  1091. package/vendor/zotero/modules/translators/Daum News.js +139 -0
  1092. package/vendor/zotero/modules/translators/De Gruyter Brill.js +674 -0
  1093. package/vendor/zotero/modules/translators/DeGruyter.js +457 -0
  1094. package/vendor/zotero/modules/translators/Defense Technical Information Center.js +146 -0
  1095. package/vendor/zotero/modules/translators/Delpher.js +413 -0
  1096. package/vendor/zotero/modules/translators/Demographic Research.js +164 -0
  1097. package/vendor/zotero/modules/translators/Denik CZ.js +273 -0
  1098. package/vendor/zotero/modules/translators/Der Freitag.js +236 -0
  1099. package/vendor/zotero/modules/translators/Der Spiegel.js +479 -0
  1100. package/vendor/zotero/modules/translators/Desiring God.js +216 -0
  1101. package/vendor/zotero/modules/translators/Deutsche Fotothek.js +364 -0
  1102. package/vendor/zotero/modules/translators/Deutsche Nationalbibliothek.js +594 -0
  1103. package/vendor/zotero/modules/translators/Dialnet.js +258 -0
  1104. package/vendor/zotero/modules/translators/Die Zeit.js +378 -0
  1105. package/vendor/zotero/modules/translators/DigiZeitschriften.js +269 -0
  1106. package/vendor/zotero/modules/translators/Digital Humanities Quarterly.js +207 -0
  1107. package/vendor/zotero/modules/translators/Digital Medievalist.js +149 -0
  1108. package/vendor/zotero/modules/translators/Digital Spy.js +215 -0
  1109. package/vendor/zotero/modules/translators/Dimensions.js +233 -0
  1110. package/vendor/zotero/modules/translators/Douban.js +316 -0
  1111. package/vendor/zotero/modules/translators/Dreier Neuerscheinungsdienst.js +209 -0
  1112. package/vendor/zotero/modules/translators/DrugBank.ca.js +209 -0
  1113. package/vendor/zotero/modules/translators/Dryad Digital Repository.js +323 -0
  1114. package/vendor/zotero/modules/translators/Duke University Press Books.js +250 -0
  1115. package/vendor/zotero/modules/translators/E-periodica Switzerland.js +347 -0
  1116. package/vendor/zotero/modules/translators/EBSCO Discovery Layer.js +147 -0
  1117. package/vendor/zotero/modules/translators/EBSCOhost.js +592 -0
  1118. package/vendor/zotero/modules/translators/EIDR.js +184 -0
  1119. package/vendor/zotero/modules/translators/EPA National Library Catalog.js +245 -0
  1120. package/vendor/zotero/modules/translators/ERIC.js +986 -0
  1121. package/vendor/zotero/modules/translators/ESpacenet.js +465 -0
  1122. package/vendor/zotero/modules/translators/EUR-Lex.js +423 -0
  1123. package/vendor/zotero/modules/translators/Eastview.js +336 -0
  1124. package/vendor/zotero/modules/translators/Edinburgh University Press Journals.js +178 -0
  1125. package/vendor/zotero/modules/translators/Education Week.js +197 -0
  1126. package/vendor/zotero/modules/translators/El Comercio (Peru).js +347 -0
  1127. package/vendor/zotero/modules/translators/El Pais.js +262 -0
  1128. package/vendor/zotero/modules/translators/Electronic Colloquium on Computational Complexity.js +230 -0
  1129. package/vendor/zotero/modules/translators/Elicit.js +120 -0
  1130. package/vendor/zotero/modules/translators/Elsevier Health Journals.js +531 -0
  1131. package/vendor/zotero/modules/translators/Elsevier Pure.js +420 -0
  1132. package/vendor/zotero/modules/translators/Embedded Metadata.js +1951 -0
  1133. package/vendor/zotero/modules/translators/Emerald Insight.js +626 -0
  1134. package/vendor/zotero/modules/translators/Encyclopedia of Chicago.js +162 -0
  1135. package/vendor/zotero/modules/translators/Encyclopedia of Korean Culture.js +221 -0
  1136. package/vendor/zotero/modules/translators/Endnote XML.js +1407 -0
  1137. package/vendor/zotero/modules/translators/Engineering Village.js +139 -0
  1138. package/vendor/zotero/modules/translators/Envidat.js +331 -0
  1139. package/vendor/zotero/modules/translators/Epicurious.js +144 -0
  1140. package/vendor/zotero/modules/translators/Erudit.js +272 -0
  1141. package/vendor/zotero/modules/translators/Euclid.js +220 -0
  1142. package/vendor/zotero/modules/translators/EurasiaNet.js +109 -0
  1143. package/vendor/zotero/modules/translators/Eurogamer.js +112 -0
  1144. package/vendor/zotero/modules/translators/EurogamerUSgamer.js +380 -0
  1145. package/vendor/zotero/modules/translators/Europe PMC.js +448 -0
  1146. package/vendor/zotero/modules/translators/Evernote.js +104 -0
  1147. package/vendor/zotero/modules/translators/F1000 Research.js +655 -0
  1148. package/vendor/zotero/modules/translators/FAO Publications.js +1139 -0
  1149. package/vendor/zotero/modules/translators/FAZ.NET.js +231 -0
  1150. package/vendor/zotero/modules/translators/Fachportal Padagogik.js +839 -0
  1151. package/vendor/zotero/modules/translators/Factiva.js +302 -0
  1152. package/vendor/zotero/modules/translators/Failed Architecture.js +114 -0
  1153. package/vendor/zotero/modules/translators/Fairfax Australia.js +200 -0
  1154. package/vendor/zotero/modules/translators/Fatcat.js +425 -0
  1155. package/vendor/zotero/modules/translators/Figshare.js +191 -0
  1156. package/vendor/zotero/modules/translators/Financial Times.js +187 -0
  1157. package/vendor/zotero/modules/translators/Finna.js +357 -0
  1158. package/vendor/zotero/modules/translators/Flickr.js +318 -0
  1159. package/vendor/zotero/modules/translators/Foreign Affairs.js +485 -0
  1160. package/vendor/zotero/modules/translators/Foreign Policy.js +146 -0
  1161. package/vendor/zotero/modules/translators/FreeCite.js +95 -0
  1162. package/vendor/zotero/modules/translators/FreePatentsOnline.js +265 -0
  1163. package/vendor/zotero/modules/translators/Frieze.js +243 -0
  1164. package/vendor/zotero/modules/translators/Frontiers.js +667 -0
  1165. package/vendor/zotero/modules/translators/GMS German Medical Science.js +319 -0
  1166. package/vendor/zotero/modules/translators/GPO Access e-CFR.js +134 -0
  1167. package/vendor/zotero/modules/translators/Gale Databases.js +324 -0
  1168. package/vendor/zotero/modules/translators/GaleGDC.js +189 -0
  1169. package/vendor/zotero/modules/translators/Galegroup.js +327 -0
  1170. package/vendor/zotero/modules/translators/Gallica.js +194 -0
  1171. package/vendor/zotero/modules/translators/Game Studies.js +155 -0
  1172. package/vendor/zotero/modules/translators/GameSpot.js +199 -0
  1173. package/vendor/zotero/modules/translators/GameStar GamePro.js +198 -0
  1174. package/vendor/zotero/modules/translators/Gasyrlar Awazy.js +156 -0
  1175. package/vendor/zotero/modules/translators/Gemeinsamer Bibliotheksverbund ISBN.js +23 -0
  1176. package/vendor/zotero/modules/translators/Gene Ontology.js +128 -0
  1177. package/vendor/zotero/modules/translators/Github.js +268 -0
  1178. package/vendor/zotero/modules/translators/Globes.js +243 -0
  1179. package/vendor/zotero/modules/translators/Gmail.js +64 -0
  1180. package/vendor/zotero/modules/translators/Goodreads.js +219 -0
  1181. package/vendor/zotero/modules/translators/Google Books.js +552 -0
  1182. package/vendor/zotero/modules/translators/Google Patents.js +959 -0
  1183. package/vendor/zotero/modules/translators/Google Play.js +186 -0
  1184. package/vendor/zotero/modules/translators/Google Presentation.js +104 -0
  1185. package/vendor/zotero/modules/translators/Google Research.js +221 -0
  1186. package/vendor/zotero/modules/translators/Google Scholar.js +1361 -0
  1187. package/vendor/zotero/modules/translators/Gulag Many Days, Many Lives.js +179 -0
  1188. package/vendor/zotero/modules/translators/HAL Archives Ouvertes.js +429 -0
  1189. package/vendor/zotero/modules/translators/HCSP.js +312 -0
  1190. package/vendor/zotero/modules/translators/HUDOC.js +650 -0
  1191. package/vendor/zotero/modules/translators/Haaretz.js +562 -0
  1192. package/vendor/zotero/modules/translators/Habr.js +232 -0
  1193. package/vendor/zotero/modules/translators/Handelszeitung.js +273 -0
  1194. package/vendor/zotero/modules/translators/Hanrei Watch.js +123 -0
  1195. package/vendor/zotero/modules/translators/Harper's Magazine.js +365 -0
  1196. package/vendor/zotero/modules/translators/Harpers.js +209 -0
  1197. package/vendor/zotero/modules/translators/Harvard Business Review.js +326 -0
  1198. package/vendor/zotero/modules/translators/Harvard Caselaw Access Project.js +244 -0
  1199. package/vendor/zotero/modules/translators/Harvard University Press Books.js +286 -0
  1200. package/vendor/zotero/modules/translators/Hathi Trust.js +164 -0
  1201. package/vendor/zotero/modules/translators/HathiTrust.js +311 -0
  1202. package/vendor/zotero/modules/translators/HeinOnline.js +266 -0
  1203. package/vendor/zotero/modules/translators/Heise.js +200 -0
  1204. package/vendor/zotero/modules/translators/Herder.js +236 -0
  1205. package/vendor/zotero/modules/translators/HighBeam.js +198 -0
  1206. package/vendor/zotero/modules/translators/HighWire 2.0.js +1355 -0
  1207. package/vendor/zotero/modules/translators/HighWire.js +209 -0
  1208. package/vendor/zotero/modules/translators/Hindawi Publishers.js +177 -0
  1209. package/vendor/zotero/modules/translators/Hispanic-American Periodical Index.js +236 -0
  1210. package/vendor/zotero/modules/translators/Homeland Security Digital Library.js +426 -0
  1211. package/vendor/zotero/modules/translators/Hoovers.js +89 -0
  1212. package/vendor/zotero/modules/translators/Huff Post.js +223 -0
  1213. package/vendor/zotero/modules/translators/Human Rights Watch.js +450 -0
  1214. package/vendor/zotero/modules/translators/IBISWorld.js +171 -0
  1215. package/vendor/zotero/modules/translators/IDEA ALM.js +536 -0
  1216. package/vendor/zotero/modules/translators/IEEE Computer Society.js +429 -0
  1217. package/vendor/zotero/modules/translators/IEEE Xplore.js +1000 -0
  1218. package/vendor/zotero/modules/translators/IETF.js +451 -0
  1219. package/vendor/zotero/modules/translators/IGN.js +136 -0
  1220. package/vendor/zotero/modules/translators/IMDb.js +566 -0
  1221. package/vendor/zotero/modules/translators/INSPIRE.js +247 -0
  1222. package/vendor/zotero/modules/translators/IPCC.js +757 -0
  1223. package/vendor/zotero/modules/translators/ISTC.js +181 -0
  1224. package/vendor/zotero/modules/translators/Idref.js +179 -0
  1225. package/vendor/zotero/modules/translators/In These Times.js +196 -0
  1226. package/vendor/zotero/modules/translators/InfoTrac.js +279 -0
  1227. package/vendor/zotero/modules/translators/Informationssystem Medienpaedagogik.js +305 -0
  1228. package/vendor/zotero/modules/translators/IngentaConnect.js +312 -0
  1229. package/vendor/zotero/modules/translators/Inside Higher Ed.js +167 -0
  1230. package/vendor/zotero/modules/translators/Insignia OPAC.js +114 -0
  1231. package/vendor/zotero/modules/translators/Institute of Contemporary Art.js +180 -0
  1232. package/vendor/zotero/modules/translators/Institute of Physics.js +340 -0
  1233. package/vendor/zotero/modules/translators/Integrum.js +173 -0
  1234. package/vendor/zotero/modules/translators/Intellixir.js +264 -0
  1235. package/vendor/zotero/modules/translators/Inter-Research Science Center.js +185 -0
  1236. package/vendor/zotero/modules/translators/International Nuclear Information System.js +285 -0
  1237. package/vendor/zotero/modules/translators/Internet Archive Scholar.js +106 -0
  1238. package/vendor/zotero/modules/translators/Internet Archive Wayback Machine.js +152 -0
  1239. package/vendor/zotero/modules/translators/Internet Archive.js +552 -0
  1240. package/vendor/zotero/modules/translators/InvenioRDM.js +1260 -0
  1241. package/vendor/zotero/modules/translators/Isidore.js +235 -0
  1242. package/vendor/zotero/modules/translators/J-Stage.js +272 -0
  1243. package/vendor/zotero/modules/translators/JETS.js +122 -0
  1244. package/vendor/zotero/modules/translators/JISC Historical Texts.js +273 -0
  1245. package/vendor/zotero/modules/translators/JRC Publications Repository.js +569 -0
  1246. package/vendor/zotero/modules/translators/JSTOR.js +821 -0
  1247. package/vendor/zotero/modules/translators/Jahrbuch.js +213 -0
  1248. package/vendor/zotero/modules/translators/Japan Times Online.js +138 -0
  1249. package/vendor/zotero/modules/translators/Journal of Electronic Publishing.js +147 -0
  1250. package/vendor/zotero/modules/translators/Journal of Extension.js +288 -0
  1251. package/vendor/zotero/modules/translators/Journal of Machine Learning Research.js +441 -0
  1252. package/vendor/zotero/modules/translators/Journal of Religion and Society.js +174 -0
  1253. package/vendor/zotero/modules/translators/JurPC.js +274 -0
  1254. package/vendor/zotero/modules/translators/Juricaf.js +141 -0
  1255. package/vendor/zotero/modules/translators/Juris.js +728 -0
  1256. package/vendor/zotero/modules/translators/K10plus ISBN.js +386 -0
  1257. package/vendor/zotero/modules/translators/KStudy.js +632 -0
  1258. package/vendor/zotero/modules/translators/Kanopy.js +358 -0
  1259. package/vendor/zotero/modules/translators/Khaama Press.js +249 -0
  1260. package/vendor/zotero/modules/translators/KitapYurdu.com.js +376 -0
  1261. package/vendor/zotero/modules/translators/Kommersant.js +174 -0
  1262. package/vendor/zotero/modules/translators/Korean National Library.js +621 -0
  1263. package/vendor/zotero/modules/translators/L'Annee Philologique.js +267 -0
  1264. package/vendor/zotero/modules/translators/LA Times.js +239 -0
  1265. package/vendor/zotero/modules/translators/LIBRIS ISBN.js +103 -0
  1266. package/vendor/zotero/modules/translators/LIVIVO.js +260 -0
  1267. package/vendor/zotero/modules/translators/LWN.net.js +350 -0
  1268. package/vendor/zotero/modules/translators/La Croix.js +237 -0
  1269. package/vendor/zotero/modules/translators/La Nacion (Argentina).js +231 -0
  1270. package/vendor/zotero/modules/translators/La Presse.js +218 -0
  1271. package/vendor/zotero/modules/translators/La Republica (Peru).js +174 -0
  1272. package/vendor/zotero/modules/translators/Lagen.nu.js +214 -0
  1273. package/vendor/zotero/modules/translators/Landesbibliographie Baden-Wurttemberg.js +324 -0
  1274. package/vendor/zotero/modules/translators/Lapham's Quarterly.js +1062 -0
  1275. package/vendor/zotero/modules/translators/Le Devoir.js +167 -0
  1276. package/vendor/zotero/modules/translators/Le Figaro.js +225 -0
  1277. package/vendor/zotero/modules/translators/Le Maitron.js +484 -0
  1278. package/vendor/zotero/modules/translators/Le Monde.js +258 -0
  1279. package/vendor/zotero/modules/translators/Le monde diplomatique.js +200 -0
  1280. package/vendor/zotero/modules/translators/Legifrance.js +641 -0
  1281. package/vendor/zotero/modules/translators/Legislative Insight.js +406 -0
  1282. package/vendor/zotero/modules/translators/Lexis+.js +264 -0
  1283. package/vendor/zotero/modules/translators/LexisNexis.js +505 -0
  1284. package/vendor/zotero/modules/translators/Libraries Tasmania.js +778 -0
  1285. package/vendor/zotero/modules/translators/Library Catalog (Aleph).js +385 -0
  1286. package/vendor/zotero/modules/translators/Library Catalog (Amicus).js +254 -0
  1287. package/vendor/zotero/modules/translators/Library Catalog (Aquabrowser).js +253 -0
  1288. package/vendor/zotero/modules/translators/Library Catalog (BiblioCommons).js +249 -0
  1289. package/vendor/zotero/modules/translators/Library Catalog (Blacklight).js +341 -0
  1290. package/vendor/zotero/modules/translators/Library Catalog (Capita Prism).js +162 -0
  1291. package/vendor/zotero/modules/translators/Library Catalog (DRA).js +203 -0
  1292. package/vendor/zotero/modules/translators/Library Catalog (Dynix).js +315 -0
  1293. package/vendor/zotero/modules/translators/Library Catalog (EBSCO Locate).js +349 -0
  1294. package/vendor/zotero/modules/translators/Library Catalog (Encore).js +211 -0
  1295. package/vendor/zotero/modules/translators/Library Catalog (GEAC).js +104 -0
  1296. package/vendor/zotero/modules/translators/Library Catalog (InnoPAC).js +305 -0
  1297. package/vendor/zotero/modules/translators/Library Catalog (Koha).js +225 -0
  1298. package/vendor/zotero/modules/translators/Library Catalog (Mango).js +285 -0
  1299. package/vendor/zotero/modules/translators/Library Catalog (OPALS).js +200 -0
  1300. package/vendor/zotero/modules/translators/Library Catalog (PICA).js +2120 -0
  1301. package/vendor/zotero/modules/translators/Library Catalog (PICA2).js +331 -0
  1302. package/vendor/zotero/modules/translators/Library Catalog (Pika).js +488 -0
  1303. package/vendor/zotero/modules/translators/Library Catalog (Polaris).js +183 -0
  1304. package/vendor/zotero/modules/translators/Library Catalog (Quolto).js +320 -0
  1305. package/vendor/zotero/modules/translators/Library Catalog (RERO ILS).js +754 -0
  1306. package/vendor/zotero/modules/translators/Library Catalog (SIRSI eLibrary).js +407 -0
  1307. package/vendor/zotero/modules/translators/Library Catalog (SIRSI).js +452 -0
  1308. package/vendor/zotero/modules/translators/Library Catalog (SLIMS).js +146 -0
  1309. package/vendor/zotero/modules/translators/Library Catalog (TIND ILS).js +773 -0
  1310. package/vendor/zotero/modules/translators/Library Catalog (TLCYouSeeMore).js +132 -0
  1311. package/vendor/zotero/modules/translators/Library Catalog (TinREAD).js +277 -0
  1312. package/vendor/zotero/modules/translators/Library Catalog (VTLS).js +125 -0
  1313. package/vendor/zotero/modules/translators/Library Catalog (Visual Library 2021).js +765 -0
  1314. package/vendor/zotero/modules/translators/Library Catalog (Voyager 7).js +199 -0
  1315. package/vendor/zotero/modules/translators/Library Catalog (Voyager).js +212 -0
  1316. package/vendor/zotero/modules/translators/Library Genesis.js +337 -0
  1317. package/vendor/zotero/modules/translators/Library Hub Discover.js +359 -0
  1318. package/vendor/zotero/modules/translators/Library of Congress Digital Collections.js +869 -0
  1319. package/vendor/zotero/modules/translators/Library of Congress ISBN.js +86 -0
  1320. package/vendor/zotero/modules/translators/LingBuzz.js +359 -0
  1321. package/vendor/zotero/modules/translators/Lippincott Williams and Wilkins.js +341 -0
  1322. package/vendor/zotero/modules/translators/Literary Hub.js +950 -0
  1323. package/vendor/zotero/modules/translators/Litres.js +236 -0
  1324. package/vendor/zotero/modules/translators/LiveJournal.js +219 -0
  1325. package/vendor/zotero/modules/translators/London Review of Books.js +291 -0
  1326. package/vendor/zotero/modules/translators/LookUs.js +260 -0
  1327. package/vendor/zotero/modules/translators/Lulu.js +264 -0
  1328. package/vendor/zotero/modules/translators/MAB2.js +373 -0
  1329. package/vendor/zotero/modules/translators/MARC.js +1080 -0
  1330. package/vendor/zotero/modules/translators/MARCXML.js +489 -0
  1331. package/vendor/zotero/modules/translators/MCV.js +258 -0
  1332. package/vendor/zotero/modules/translators/MDPI Journals.js +356 -0
  1333. package/vendor/zotero/modules/translators/MEDLINEnbib.js +1561 -0
  1334. package/vendor/zotero/modules/translators/METS.js +384 -0
  1335. package/vendor/zotero/modules/translators/MIDAS Journals.js +343 -0
  1336. package/vendor/zotero/modules/translators/MIT Press Books.js +637 -0
  1337. package/vendor/zotero/modules/translators/MIT Press Journals.js +176 -0
  1338. package/vendor/zotero/modules/translators/MODS.js +2545 -0
  1339. package/vendor/zotero/modules/translators/MPG PuRe.js +541 -0
  1340. package/vendor/zotero/modules/translators/Mailman.js +136 -0
  1341. package/vendor/zotero/modules/translators/Mainichi Daily News.js +189 -0
  1342. package/vendor/zotero/modules/translators/Mastodon.js +198 -0
  1343. package/vendor/zotero/modules/translators/Matbugat.ru.js +110 -0
  1344. package/vendor/zotero/modules/translators/Max Planck Institute for the History of Science Virtual Laboratory Library.js +136 -0
  1345. package/vendor/zotero/modules/translators/Medium.js +208 -0
  1346. package/vendor/zotero/modules/translators/MetaLib.js +126 -0
  1347. package/vendor/zotero/modules/translators/Microbiology Society Journals.js +343 -0
  1348. package/vendor/zotero/modules/translators/Microsoft Academic.js +424 -0
  1349. package/vendor/zotero/modules/translators/Mikromarc.js +207 -0
  1350. package/vendor/zotero/modules/translators/Milli Kutuphane.js +244 -0
  1351. package/vendor/zotero/modules/translators/Musee du Louvre.js +265 -0
  1352. package/vendor/zotero/modules/translators/NASA ADS.js +889 -0
  1353. package/vendor/zotero/modules/translators/NASA NTRS.js +610 -0
  1354. package/vendor/zotero/modules/translators/NCBI Nucleotide.js +227 -0
  1355. package/vendor/zotero/modules/translators/NPR.js +341 -0
  1356. package/vendor/zotero/modules/translators/NRC Research Press.js +181 -0
  1357. package/vendor/zotero/modules/translators/NRC.nl.js +226 -0
  1358. package/vendor/zotero/modules/translators/NTSB Accident Reports.js +226 -0
  1359. package/vendor/zotero/modules/translators/NYPL Menus.js +275 -0
  1360. package/vendor/zotero/modules/translators/NYPL Research Catalog.js +458 -0
  1361. package/vendor/zotero/modules/translators/NYTimes.com.js +858 -0
  1362. package/vendor/zotero/modules/translators/NZZ.ch.js +272 -0
  1363. package/vendor/zotero/modules/translators/Nagoya University OPAC.js +336 -0
  1364. package/vendor/zotero/modules/translators/National Academies Press.js +243 -0
  1365. package/vendor/zotero/modules/translators/National Agriculture Library.js +524 -0
  1366. package/vendor/zotero/modules/translators/National Archive of the UK.js +237 -0
  1367. package/vendor/zotero/modules/translators/National Archives of Australia.js +522 -0
  1368. package/vendor/zotero/modules/translators/National Archives of South Africa.js +122 -0
  1369. package/vendor/zotero/modules/translators/National Archives of the United States.js +278 -0
  1370. package/vendor/zotero/modules/translators/National Bureau of Economic Research.js +363 -0
  1371. package/vendor/zotero/modules/translators/National Diet Library Catalogue.js +333 -0
  1372. package/vendor/zotero/modules/translators/National Gallery of Art - USA.js +149 -0
  1373. package/vendor/zotero/modules/translators/National Gallery of Australia.js +252 -0
  1374. package/vendor/zotero/modules/translators/National Library of Australia (new catalog).js +223 -0
  1375. package/vendor/zotero/modules/translators/National Library of Belarus.js +171 -0
  1376. package/vendor/zotero/modules/translators/National Library of Norway.js +310 -0
  1377. package/vendor/zotero/modules/translators/National Library of Poland ISBN.js +140 -0
  1378. package/vendor/zotero/modules/translators/National Post.js +186 -0
  1379. package/vendor/zotero/modules/translators/National Technical Reports Library.js +276 -0
  1380. package/vendor/zotero/modules/translators/National Transportation Library ROSA P.js +562 -0
  1381. package/vendor/zotero/modules/translators/Nature Publishing Group.js +3394 -0
  1382. package/vendor/zotero/modules/translators/Neural Information Processing Systems.js +385 -0
  1383. package/vendor/zotero/modules/translators/New Left Review.js +245 -0
  1384. package/vendor/zotero/modules/translators/New Zealand Herald.js +282 -0
  1385. package/vendor/zotero/modules/translators/Newlines Magazine.js +190 -0
  1386. package/vendor/zotero/modules/translators/News Corp Australia.js +251 -0
  1387. package/vendor/zotero/modules/translators/NewsBank.js +202 -0
  1388. package/vendor/zotero/modules/translators/NewsnetTamedia.js +509 -0
  1389. package/vendor/zotero/modules/translators/Noor Digital Library.js +267 -0
  1390. package/vendor/zotero/modules/translators/Note HTML.js +206 -0
  1391. package/vendor/zotero/modules/translators/Note Markdown.js +1638 -0
  1392. package/vendor/zotero/modules/translators/Notre Dame Philosophical Reviews.js +201 -0
  1393. package/vendor/zotero/modules/translators/Nuclear Receptor Signaling.js +241 -0
  1394. package/vendor/zotero/modules/translators/OAPEN.js +331 -0
  1395. package/vendor/zotero/modules/translators/OECD.js +216 -0
  1396. package/vendor/zotero/modules/translators/ORCID.js +104 -0
  1397. package/vendor/zotero/modules/translators/OSF Preprints.js +417 -0
  1398. package/vendor/zotero/modules/translators/OSTI Energy Citations.js +202 -0
  1399. package/vendor/zotero/modules/translators/OVID Tagged.js +1226 -0
  1400. package/vendor/zotero/modules/translators/OZON.ru.js +465 -0
  1401. package/vendor/zotero/modules/translators/OhioLINK.js +43 -0
  1402. package/vendor/zotero/modules/translators/Old Bailey Online.js +315 -0
  1403. package/vendor/zotero/modules/translators/Open Conf.js +172 -0
  1404. package/vendor/zotero/modules/translators/Open Journal Systems.js +729 -0
  1405. package/vendor/zotero/modules/translators/Open Knowledge Repository.js +811 -0
  1406. package/vendor/zotero/modules/translators/OpenAlex JSON.js +740 -0
  1407. package/vendor/zotero/modules/translators/OpenAlex.js +444 -0
  1408. package/vendor/zotero/modules/translators/OpenEdition Books.js +155 -0
  1409. package/vendor/zotero/modules/translators/OpenEdition Journals.js +432 -0
  1410. package/vendor/zotero/modules/translators/Optical Society of America.js +562 -0
  1411. package/vendor/zotero/modules/translators/Optimization Online.js +418 -0
  1412. package/vendor/zotero/modules/translators/Ovid OCE.js +353 -0
  1413. package/vendor/zotero/modules/translators/Ovid.js +302 -0
  1414. package/vendor/zotero/modules/translators/Oxford Dictionaries Premium.js +194 -0
  1415. package/vendor/zotero/modules/translators/Oxford English Dictionary.js +122 -0
  1416. package/vendor/zotero/modules/translators/Oxford Music and Art Online.js +120 -0
  1417. package/vendor/zotero/modules/translators/Oxford Reference.js +202 -0
  1418. package/vendor/zotero/modules/translators/Oxford University Press.js +277 -0
  1419. package/vendor/zotero/modules/translators/PC Gamer.js +302 -0
  1420. package/vendor/zotero/modules/translators/PC Games.js +128 -0
  1421. package/vendor/zotero/modules/translators/PEI Archival Information Network.js +242 -0
  1422. package/vendor/zotero/modules/translators/PEP Web.js +165 -0
  1423. package/vendor/zotero/modules/translators/PKP Catalog Systems.js +1455 -0
  1424. package/vendor/zotero/modules/translators/PLoS Journals.js +284 -0
  1425. package/vendor/zotero/modules/translators/PRC History Review.js +298 -0
  1426. package/vendor/zotero/modules/translators/Pajhwok Afghan News.js +198 -0
  1427. package/vendor/zotero/modules/translators/Papers Past.js +297 -0
  1428. package/vendor/zotero/modules/translators/Paris Review.js +227 -0
  1429. package/vendor/zotero/modules/translators/Pastebin.js +199 -0
  1430. package/vendor/zotero/modules/translators/Patents - USPTO.js +210 -0
  1431. package/vendor/zotero/modules/translators/Peeters.js +587 -0
  1432. package/vendor/zotero/modules/translators/Perceiving Systems.js +350 -0
  1433. package/vendor/zotero/modules/translators/Perlego.js +416 -0
  1434. package/vendor/zotero/modules/translators/PhilPapers.js +233 -0
  1435. package/vendor/zotero/modules/translators/Philosopher's Imprint.js +169 -0
  1436. package/vendor/zotero/modules/translators/Pleade.js +329 -0
  1437. package/vendor/zotero/modules/translators/Polygon.js +270 -0
  1438. package/vendor/zotero/modules/translators/Potsdamer Neueste Nachrichten.js +188 -0
  1439. package/vendor/zotero/modules/translators/Premium Times.js +144 -0
  1440. package/vendor/zotero/modules/translators/Preprints.org.js +305 -0
  1441. package/vendor/zotero/modules/translators/Prime 9ja Online.js +289 -0
  1442. package/vendor/zotero/modules/translators/Primo 2018.js +126 -0
  1443. package/vendor/zotero/modules/translators/Primo Normalized XML.js +987 -0
  1444. package/vendor/zotero/modules/translators/Primo.js +322 -0
  1445. package/vendor/zotero/modules/translators/ProMED.js +66 -0
  1446. package/vendor/zotero/modules/translators/ProQuest Ebook Central.js +226 -0
  1447. package/vendor/zotero/modules/translators/ProQuest PolicyFile.js +115 -0
  1448. package/vendor/zotero/modules/translators/ProQuest.js +2210 -0
  1449. package/vendor/zotero/modules/translators/Probing the Past.js +151 -0
  1450. package/vendor/zotero/modules/translators/Project Gutenberg.js +191 -0
  1451. package/vendor/zotero/modules/translators/Project MUSE.js +451 -0
  1452. package/vendor/zotero/modules/translators/Protein Data Bank.js +445 -0
  1453. package/vendor/zotero/modules/translators/PubFactory Journals.js +712 -0
  1454. package/vendor/zotero/modules/translators/PubMed Central.js +577 -0
  1455. package/vendor/zotero/modules/translators/PubMed XML.js +1139 -0
  1456. package/vendor/zotero/modules/translators/PubMed.js +1317 -0
  1457. package/vendor/zotero/modules/translators/PubPub.js +530 -0
  1458. package/vendor/zotero/modules/translators/Pubget.js +164 -0
  1459. package/vendor/zotero/modules/translators/Public Record Office Victoria.js +252 -0
  1460. package/vendor/zotero/modules/translators/Publications Office of the European Union.js +540 -0
  1461. package/vendor/zotero/modules/translators/Publications du Quebec.js +225 -0
  1462. package/vendor/zotero/modules/translators/PyPI.js +288 -0
  1463. package/vendor/zotero/modules/translators/Qatar Digital Library.js +802 -0
  1464. package/vendor/zotero/modules/translators/Queensland State Archives.js +303 -0
  1465. package/vendor/zotero/modules/translators/R-Packages.js +410 -0
  1466. package/vendor/zotero/modules/translators/RAND.js +283 -0
  1467. package/vendor/zotero/modules/translators/RDF.js +1780 -0
  1468. package/vendor/zotero/modules/translators/REDALYC.js +196 -0
  1469. package/vendor/zotero/modules/translators/RIS.js +7265 -0
  1470. package/vendor/zotero/modules/translators/RSC Publishing.js +250 -0
  1471. package/vendor/zotero/modules/translators/Radio Free Europe Radio Liberty.js +706 -0
  1472. package/vendor/zotero/modules/translators/RePEc - Econpapers.js +725 -0
  1473. package/vendor/zotero/modules/translators/RePEc - IDEAS.js +337 -0
  1474. package/vendor/zotero/modules/translators/Rechtspraak.nl.js +295 -0
  1475. package/vendor/zotero/modules/translators/RefWorks Tagged.js +1185 -0
  1476. package/vendor/zotero/modules/translators/ReferBibIX.js +463 -0
  1477. package/vendor/zotero/modules/translators/Regeringskansliet.js +89 -0
  1478. package/vendor/zotero/modules/translators/Research Square.js +335 -0
  1479. package/vendor/zotero/modules/translators/ResearchGate.js +394 -0
  1480. package/vendor/zotero/modules/translators/Retsinformation.js +348 -0
  1481. package/vendor/zotero/modules/translators/Reuters.js +255 -0
  1482. package/vendor/zotero/modules/translators/Revues.org.js +378 -0
  1483. package/vendor/zotero/modules/translators/Rock, Paper, Shotgun.js +304 -0
  1484. package/vendor/zotero/modules/translators/Roll Call.js +173 -0
  1485. package/vendor/zotero/modules/translators/Russian State Library.js +1517 -0
  1486. package/vendor/zotero/modules/translators/SAE Papers.js +241 -0
  1487. package/vendor/zotero/modules/translators/SAGE Journals.js +427 -0
  1488. package/vendor/zotero/modules/translators/SAGE Knowledge.js +505 -0
  1489. package/vendor/zotero/modules/translators/SAILDART.js +364 -0
  1490. package/vendor/zotero/modules/translators/SALT Research Archives.js +196 -0
  1491. package/vendor/zotero/modules/translators/SFU IPinCH.js +946 -0
  1492. package/vendor/zotero/modules/translators/SIPRI.js +256 -0
  1493. package/vendor/zotero/modules/translators/SIRS Knowledge Source.js +546 -0
  1494. package/vendor/zotero/modules/translators/SLUB Dresden.js +300 -0
  1495. package/vendor/zotero/modules/translators/SORA.js +340 -0
  1496. package/vendor/zotero/modules/translators/SSOAR.js +399 -0
  1497. package/vendor/zotero/modules/translators/SSRN.js +235 -0
  1498. package/vendor/zotero/modules/translators/SVT Nyheter.js +381 -0
  1499. package/vendor/zotero/modules/translators/Sacramento Bee.js +274 -0
  1500. package/vendor/zotero/modules/translators/Safari Books Online.js +391 -0
  1501. package/vendor/zotero/modules/translators/Scholars Portal Journals.js +220 -0
  1502. package/vendor/zotero/modules/translators/Scholia.js +189 -0
  1503. package/vendor/zotero/modules/translators/Schweizer Radio und Fernsehen SRF.js +152 -0
  1504. package/vendor/zotero/modules/translators/SciELO.js +440 -0
  1505. package/vendor/zotero/modules/translators/ScienceDirect.js +1304 -0
  1506. package/vendor/zotero/modules/translators/Scopus.js +418 -0
  1507. package/vendor/zotero/modules/translators/Semantic Scholar.js +513 -0
  1508. package/vendor/zotero/modules/translators/Silverchair.js +886 -0
  1509. package/vendor/zotero/modules/translators/Slate.js +228 -0
  1510. package/vendor/zotero/modules/translators/SlideShare.js +112 -0
  1511. package/vendor/zotero/modules/translators/Spiegel Online.js +343 -0
  1512. package/vendor/zotero/modules/translators/Springer Link.js +696 -0
  1513. package/vendor/zotero/modules/translators/Stack Exchange.js +134 -0
  1514. package/vendor/zotero/modules/translators/Standard Ebooks.js +198 -0
  1515. package/vendor/zotero/modules/translators/Stanford Encyclopedia of Philosophy.js +285 -0
  1516. package/vendor/zotero/modules/translators/Stanford University Press.js +343 -0
  1517. package/vendor/zotero/modules/translators/State Records Office of Western Australia.js +439 -0
  1518. package/vendor/zotero/modules/translators/Stitcher.js +141 -0
  1519. package/vendor/zotero/modules/translators/Store norske leksikon.js +291 -0
  1520. package/vendor/zotero/modules/translators/Stuff.co.nz.js +446 -0
  1521. package/vendor/zotero/modules/translators/Substack.js +237 -0
  1522. package/vendor/zotero/modules/translators/Sud Ouest.js +181 -0
  1523. package/vendor/zotero/modules/translators/Sueddeutsche.de.js +205 -0
  1524. package/vendor/zotero/modules/translators/Summon 2.js +117 -0
  1525. package/vendor/zotero/modules/translators/Superlib.js +647 -0
  1526. package/vendor/zotero/modules/translators/Svenska Dagbladet.js +274 -0
  1527. package/vendor/zotero/modules/translators/Sveriges radio.js +416 -0
  1528. package/vendor/zotero/modules/translators/TEI.js +648 -0
  1529. package/vendor/zotero/modules/translators/TV by the Numbers.js +194 -0
  1530. package/vendor/zotero/modules/translators/TVNZ.js +165 -0
  1531. package/vendor/zotero/modules/translators/Tagesspiegel.js +249 -0
  1532. package/vendor/zotero/modules/translators/Talis Aspire.js +316 -0
  1533. package/vendor/zotero/modules/translators/TalisPrism.js +445 -0
  1534. package/vendor/zotero/modules/translators/Tatknigafund.js +174 -0
  1535. package/vendor/zotero/modules/translators/Tatpressa.ru.js +121 -0
  1536. package/vendor/zotero/modules/translators/Taylor & Francis eBooks.js +334 -0
  1537. package/vendor/zotero/modules/translators/Taylor and Francis+NEJM.js +813 -0
  1538. package/vendor/zotero/modules/translators/Tesis Doctorals en Xarxa.js +233 -0
  1539. package/vendor/zotero/modules/translators/The Art Newspaper.js +268 -0
  1540. package/vendor/zotero/modules/translators/The Atlantic.js +535 -0
  1541. package/vendor/zotero/modules/translators/The Australian.js +105 -0
  1542. package/vendor/zotero/modules/translators/The Boston Globe.js +285 -0
  1543. package/vendor/zotero/modules/translators/The Chronicle of Higher Education.js +308 -0
  1544. package/vendor/zotero/modules/translators/The Daily Beast.js +183 -0
  1545. package/vendor/zotero/modules/translators/The Economic Times - The Times of India.js +305 -0
  1546. package/vendor/zotero/modules/translators/The Economic Times.js +191 -0
  1547. package/vendor/zotero/modules/translators/The Economist.js +207 -0
  1548. package/vendor/zotero/modules/translators/The Free Dictionary.js +58 -0
  1549. package/vendor/zotero/modules/translators/The Globe and Mail.js +241 -0
  1550. package/vendor/zotero/modules/translators/The Guardian.js +717 -0
  1551. package/vendor/zotero/modules/translators/The Hamilton Spectator.js +129 -0
  1552. package/vendor/zotero/modules/translators/The Hindu (old).js +128 -0
  1553. package/vendor/zotero/modules/translators/The Hindu.js +318 -0
  1554. package/vendor/zotero/modules/translators/The Independent.js +184 -0
  1555. package/vendor/zotero/modules/translators/The Intercept.js +258 -0
  1556. package/vendor/zotero/modules/translators/The Met.js +300 -0
  1557. package/vendor/zotero/modules/translators/The Microfinance Gateway.js +174 -0
  1558. package/vendor/zotero/modules/translators/The Nation.js +188 -0
  1559. package/vendor/zotero/modules/translators/The National Archives (UK).js +242 -0
  1560. package/vendor/zotero/modules/translators/The New Republic.js +160 -0
  1561. package/vendor/zotero/modules/translators/The New York Review of Books.js +467 -0
  1562. package/vendor/zotero/modules/translators/The New Yorker.js +360 -0
  1563. package/vendor/zotero/modules/translators/The Open Library.js +220 -0
  1564. package/vendor/zotero/modules/translators/The Straits Times.js +528 -0
  1565. package/vendor/zotero/modules/translators/The Telegraph.js +337 -0
  1566. package/vendor/zotero/modules/translators/The Times and Sunday Times.js +180 -0
  1567. package/vendor/zotero/modules/translators/The Times of Israel.js +151 -0
  1568. package/vendor/zotero/modules/translators/TheMarker.js +108 -0
  1569. package/vendor/zotero/modules/translators/Theory of Computing.js +488 -0
  1570. package/vendor/zotero/modules/translators/ThesesFR.js +350 -0
  1571. package/vendor/zotero/modules/translators/Thieme.js +326 -0
  1572. package/vendor/zotero/modules/translators/Time.com.js +557 -0
  1573. package/vendor/zotero/modules/translators/TimesMachine.js +222 -0
  1574. package/vendor/zotero/modules/translators/Tony Blair Institute for Global Change.js +195 -0
  1575. package/vendor/zotero/modules/translators/Toronto Star.js +331 -0
  1576. package/vendor/zotero/modules/translators/Transportation Research Board.js +253 -0
  1577. package/vendor/zotero/modules/translators/Treesearch.js +535 -0
  1578. package/vendor/zotero/modules/translators/Trove.js +616 -0
  1579. package/vendor/zotero/modules/translators/Tumblr.js +179 -0
  1580. package/vendor/zotero/modules/translators/Twitter.js +413 -0
  1581. package/vendor/zotero/modules/translators/UChicago VuFind.js +907 -0
  1582. package/vendor/zotero/modules/translators/UNZ Print Archive.js +276 -0
  1583. package/vendor/zotero/modules/translators/UPCommons.js +227 -0
  1584. package/vendor/zotero/modules/translators/US National Archives Research Catalog.js +275 -0
  1585. package/vendor/zotero/modules/translators/USENIX.js +151 -0
  1586. package/vendor/zotero/modules/translators/USgamer.js +120 -0
  1587. package/vendor/zotero/modules/translators/Ubiquity Journals.js +228 -0
  1588. package/vendor/zotero/modules/translators/University Press Scholarship.js +301 -0
  1589. package/vendor/zotero/modules/translators/University of California Press Books.js +403 -0
  1590. package/vendor/zotero/modules/translators/University of Chicago Press Books.js +378 -0
  1591. package/vendor/zotero/modules/translators/University of Wisconsin-Madison Libraries Catalog.js +298 -0
  1592. package/vendor/zotero/modules/translators/Unqualified Dublin Core RDF.js +153 -0
  1593. package/vendor/zotero/modules/translators/UpToDate References.js +203 -0
  1594. package/vendor/zotero/modules/translators/Vanity Fair.js +242 -0
  1595. package/vendor/zotero/modules/translators/Verniana-Jules Verne Studies.js +190 -0
  1596. package/vendor/zotero/modules/translators/Verso Books.js +311 -0
  1597. package/vendor/zotero/modules/translators/Vice.js +445 -0
  1598. package/vendor/zotero/modules/translators/Victoria & Albert Museum.js +277 -0
  1599. package/vendor/zotero/modules/translators/Vimeo.js +188 -0
  1600. package/vendor/zotero/modules/translators/VoxEU.js +151 -0
  1601. package/vendor/zotero/modules/translators/WHO.js +458 -0
  1602. package/vendor/zotero/modules/translators/WIPO.js +189 -0
  1603. package/vendor/zotero/modules/translators/Wall Street Journal.js +525 -0
  1604. package/vendor/zotero/modules/translators/Wanfang Data.js +310 -0
  1605. package/vendor/zotero/modules/translators/Washington Monthly.js +195 -0
  1606. package/vendor/zotero/modules/translators/Washington Post.js +447 -0
  1607. package/vendor/zotero/modules/translators/Web of Science Nextgen.js +832 -0
  1608. package/vendor/zotero/modules/translators/Web of Science Tagged.js +1247 -0
  1609. package/vendor/zotero/modules/translators/Web of Science.js +228 -0
  1610. package/vendor/zotero/modules/translators/Welt Online.js +161 -0
  1611. package/vendor/zotero/modules/translators/WestLaw UK.js +190 -0
  1612. package/vendor/zotero/modules/translators/WikiLeaks PlusD.js +182 -0
  1613. package/vendor/zotero/modules/translators/Wikidata QuickStatements.js +324 -0
  1614. package/vendor/zotero/modules/translators/Wikidata.js +911 -0
  1615. package/vendor/zotero/modules/translators/Wikimedia Commons.js +285 -0
  1616. package/vendor/zotero/modules/translators/Wikipedia Citation Templates.js +432 -0
  1617. package/vendor/zotero/modules/translators/Wikipedia.js +385 -0
  1618. package/vendor/zotero/modules/translators/Wikisource.js +399 -0
  1619. package/vendor/zotero/modules/translators/Wikiwand.js +122 -0
  1620. package/vendor/zotero/modules/translators/Wiktionary.js +141 -0
  1621. package/vendor/zotero/modules/translators/Wildlife Biology in Practice.js +172 -0
  1622. package/vendor/zotero/modules/translators/Wiley Online Library.js +1412 -0
  1623. package/vendor/zotero/modules/translators/Wilson Center Digital Archive.js +321 -0
  1624. package/vendor/zotero/modules/translators/Winnipeg Free Press.js +204 -0
  1625. package/vendor/zotero/modules/translators/Wired.js +249 -0
  1626. package/vendor/zotero/modules/translators/Womennews.js +230 -0
  1627. package/vendor/zotero/modules/translators/World Digital Library.js +403 -0
  1628. package/vendor/zotero/modules/translators/World History Connected.js +185 -0
  1629. package/vendor/zotero/modules/translators/World Shakespeare Bibliography Online.js +595 -0
  1630. package/vendor/zotero/modules/translators/XML ContextObject.js +274 -0
  1631. package/vendor/zotero/modules/translators/YPSF.js +224 -0
  1632. package/vendor/zotero/modules/translators/Yandex Books.js +265 -0
  1633. package/vendor/zotero/modules/translators/Ynet.js +171 -0
  1634. package/vendor/zotero/modules/translators/YouTube.js +209 -0
  1635. package/vendor/zotero/modules/translators/ZIPonline.js +267 -0
  1636. package/vendor/zotero/modules/translators/ZOBODAT.js +341 -0
  1637. package/vendor/zotero/modules/translators/Zotero RDF.js +583 -0
  1638. package/vendor/zotero/modules/translators/ZoteroBib.js +94 -0
  1639. package/vendor/zotero/modules/translators/arXiv.org.js +1099 -0
  1640. package/vendor/zotero/modules/translators/artnet.js +207 -0
  1641. package/vendor/zotero/modules/translators/beck-online.js +1339 -0
  1642. package/vendor/zotero/modules/translators/clinicaltrials.gov.js +331 -0
  1643. package/vendor/zotero/modules/translators/dLibra.js +367 -0
  1644. package/vendor/zotero/modules/translators/dejure.org.js +242 -0
  1645. package/vendor/zotero/modules/translators/dhistory.js +103 -0
  1646. package/vendor/zotero/modules/translators/digibib.net.js +245 -0
  1647. package/vendor/zotero/modules/translators/eLibrary.ru.js +867 -0
  1648. package/vendor/zotero/modules/translators/eLife.js +462 -0
  1649. package/vendor/zotero/modules/translators/eMJA.js +246 -0
  1650. package/vendor/zotero/modules/translators/eMedicine.js +123 -0
  1651. package/vendor/zotero/modules/translators/ePrint IACR.js +608 -0
  1652. package/vendor/zotero/modules/translators/ebrary.js +140 -0
  1653. package/vendor/zotero/modules/translators/etatar.ru.js +104 -0
  1654. package/vendor/zotero/modules/translators/feb-web.ru.js +167 -0
  1655. package/vendor/zotero/modules/translators/fishpond.co.nz.js +224 -0
  1656. package/vendor/zotero/modules/translators/fr-online.de.js +209 -0
  1657. package/vendor/zotero/modules/translators/govinfo.js +189 -0
  1658. package/vendor/zotero/modules/translators/informIT database.js +248 -0
  1659. package/vendor/zotero/modules/translators/io-port.js +68 -0
  1660. package/vendor/zotero/modules/translators/jmlr.js +299 -0
  1661. package/vendor/zotero/modules/translators/jurion.js +377 -0
  1662. package/vendor/zotero/modules/translators/mEDRA.js +597 -0
  1663. package/vendor/zotero/modules/translators/magazines.russ.ru.js +120 -0
  1664. package/vendor/zotero/modules/translators/medes.js +284 -0
  1665. package/vendor/zotero/modules/translators/newshub.co.nz.js +206 -0
  1666. package/vendor/zotero/modules/translators/newspapers.com.js +335 -0
  1667. package/vendor/zotero/modules/translators/openJur.js +161 -0
  1668. package/vendor/zotero/modules/translators/reddit.js +275 -0
  1669. package/vendor/zotero/modules/translators/sbn.it.js +186 -0
  1670. package/vendor/zotero/modules/translators/scinapse.js +273 -0
  1671. package/vendor/zotero/modules/translators/semantics Visual Library.js +643 -0
  1672. package/vendor/zotero/modules/translators/taz.de.js +200 -0
  1673. package/vendor/zotero/modules/translators/unAPI.js +481 -0
  1674. package/vendor/zotero/modules/translators/washingtonpost.com.js +257 -0
  1675. package/vendor/zotero/modules/translators/wiso.js +314 -0
  1676. package/vendor/zotero/modules/translators/zbMATH.js +278 -0
  1677. package/vendor/zotero/modules/translators/zotero.org.js +311 -0
  1678. package/vendor/zotero/modules/utilities/README.md +25 -0
  1679. package/vendor/zotero/modules/utilities/cachedTypes.js +193 -0
  1680. package/vendor/zotero/modules/utilities/date.js +958 -0
  1681. package/vendor/zotero/modules/utilities/openurl.js +458 -0
  1682. package/vendor/zotero/modules/utilities/resource/README.md +4 -0
  1683. package/vendor/zotero/modules/utilities/resource/dateFormats.json +1322 -0
  1684. package/vendor/zotero/modules/utilities/resource/schema/global/README.md +15 -0
  1685. package/vendor/zotero/modules/utilities/resource/schema/global/schema.json +12072 -0
  1686. package/vendor/zotero/modules/utilities/resource/zoteroTypeSchemaData.js +5 -0
  1687. package/vendor/zotero/modules/utilities/schema.js +65 -0
  1688. package/vendor/zotero/modules/utilities/utilities.js +1841 -0
  1689. package/vendor/zotero/modules/utilities/utilities_item.js +1082 -0
  1690. package/vendor/zotero/modules/utilities/xregexp-all.js +4652 -0
  1691. package/vendor/zotero/modules/utilities/xregexp-unicode-zotero.js +58 -0
  1692. package/vendor/zotero/modules/zotero-schema/README.md +15 -0
  1693. package/vendor/zotero/modules/zotero-schema/schema.json +12072 -0
  1694. package/vendor/zotero/package-lock.json +4332 -0
  1695. package/vendor/zotero/package.json +44 -0
  1696. package/vendor/zotero/spec.yaml +142 -0
  1697. package/vendor/zotero/src/args.js +43 -0
  1698. package/vendor/zotero/src/cors.js +28 -0
  1699. package/vendor/zotero/src/debug.js +189 -0
  1700. package/vendor/zotero/src/exportEndpoint.js +97 -0
  1701. package/vendor/zotero/src/formats.js +43 -0
  1702. package/vendor/zotero/src/http.js +478 -0
  1703. package/vendor/zotero/src/importEndpoint.js +54 -0
  1704. package/vendor/zotero/src/lambda.js +75 -0
  1705. package/vendor/zotero/src/proxy.js +356 -0
  1706. package/vendor/zotero/src/searchEndpoint.js +97 -0
  1707. package/vendor/zotero/src/server.js +85 -0
  1708. package/vendor/zotero/src/specEndpoint.js +135 -0
  1709. package/vendor/zotero/src/testEndpoint.js +50 -0
  1710. package/vendor/zotero/src/textSearch.js +527 -0
  1711. package/vendor/zotero/src/translation/sandboxManager.js +109 -0
  1712. package/vendor/zotero/src/translation/translate.js +101 -0
  1713. package/vendor/zotero/src/translation/translate_item.js +88 -0
  1714. package/vendor/zotero/src/translators.js +264 -0
  1715. package/vendor/zotero/src/utilities.js +49 -0
  1716. package/vendor/zotero/src/webEndpoint.js +113 -0
  1717. package/vendor/zotero/src/webSession.js +476 -0
  1718. package/vendor/zotero/src/zotero.js +117 -0
  1719. package/vendor/zotero/translate_export +10 -0
  1720. package/vendor/zotero/translate_search +9 -0
  1721. package/vendor/zotero/translate_url +9 -0
  1722. package/vendor/zotero/translate_url_multiple +9 -0
  1723. package/vendor/zotero/translate_url_single +9 -0
@@ -0,0 +1,3283 @@
1
+ /*
2
+ ***** BEGIN LICENSE BLOCK *****
3
+
4
+ Copyright © 2009 Center for History and New Media
5
+ George Mason University, Fairfax, Virginia, USA
6
+ http://zotero.org
7
+
8
+ This file is part of Zotero.
9
+
10
+ Zotero is free software: you can redistribute it and/or modify
11
+ it under the terms of the GNU Affero General Public License as published by
12
+ the Free Software Foundation, either version 3 of the License, or
13
+ (at your option) any later version.
14
+
15
+ Zotero is distributed in the hope that it will be useful,
16
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ GNU Affero General Public License for more details.
19
+
20
+ You should have received a copy of the GNU Affero General Public License
21
+ along with Zotero. If not, see <http://www.gnu.org/licenses/>.
22
+
23
+ ***** END LICENSE BLOCK *****
24
+ */
25
+
26
+ /**
27
+ * @class
28
+ * Deprecated class for creating new Zotero.Translate instances<br/>
29
+ * <br/>
30
+ * New code should use Zotero.Translate.Web, Zotero.Translate.Import, Zotero.Translate.Export, or
31
+ * Zotero.Translate.Search
32
+ */
33
+ Zotero.Translate = function(type) {
34
+ Zotero.debug("Translate: WARNING: new Zotero.Translate() is deprecated; please don't use this if you don't have to");
35
+ // hack
36
+ var translate = Zotero.Translate.newInstance(type);
37
+ for(var i in translate) {
38
+ this[i] = translate[i];
39
+ }
40
+ this.constructor = translate.constructor;
41
+ this.__proto__ = translate.__proto__;
42
+ }
43
+
44
+ /**
45
+ * Create a new translator by a string type
46
+ */
47
+ Zotero.Translate.newInstance = function(type) {
48
+ return new Zotero.Translate[type.substr(0, 1).toUpperCase()+type.substr(1).toLowerCase()];
49
+ }
50
+
51
+ /**
52
+ * Namespace for Zotero sandboxes
53
+ * @namespace
54
+ */
55
+ Zotero.Translate.Sandbox = {
56
+ /**
57
+ * Combines a sandbox with the base sandbox
58
+ */
59
+ "_inheritFromBase":function(sandboxToMerge) {
60
+ var newSandbox = {};
61
+
62
+ for(var method in Zotero.Translate.Sandbox.Base) {
63
+ newSandbox[method] = Zotero.Translate.Sandbox.Base[method];
64
+ }
65
+
66
+ for(var method in sandboxToMerge) {
67
+ newSandbox[method] = sandboxToMerge[method];
68
+ }
69
+
70
+ return newSandbox;
71
+ },
72
+
73
+ /**
74
+ * Base sandbox. These methods are available to all translators.
75
+ * @namespace
76
+ */
77
+ "Base": {
78
+ /**
79
+ * Called as {@link Zotero.Item#complete} from translators to save items to the database.
80
+ * @param {Zotero.Translate} translate
81
+ * @param {SandboxItem} An item created using the Zotero.Item class from the sandbox
82
+ */
83
+ _itemDone: function (translate, item) {
84
+ // https://github.com/zotero/translators/issues/1353
85
+ var asyncTranslator = !(translate instanceof Zotero.Translate.Web)
86
+ && translate.translator[0].configOptions
87
+ && translate.translator[0].configOptions.async;
88
+
89
+ var run = async function (async) {
90
+ Zotero.debug("Translate: Saving item");
91
+
92
+ // warn if itemDone called after translation completed
93
+ if(translate._complete) {
94
+ Zotero.debug("Translate: WARNING: Zotero.Item#complete() called after Zotero.done(); please fix your code", 2);
95
+ }
96
+
97
+ const allowedObjects = [
98
+ "complete",
99
+ "attachments",
100
+ "creators",
101
+ "tags",
102
+ "notes",
103
+ "relations",
104
+ // Is this still needed?
105
+ "seeAlso"
106
+ ];
107
+
108
+ // Create a new object here, normalizing properties with object values
109
+ var newItem = {};
110
+ for (let i in item) {
111
+ var val = item[i];
112
+ if(!val && val !== 0) continue;
113
+
114
+ var type = typeof val;
115
+ var isObject = type === "object" || type === "xml" || type === "function",
116
+ shouldBeObject = allowedObjects.indexOf(i) !== -1;
117
+ if(isObject && !shouldBeObject) {
118
+ // Convert things that shouldn't be objects to objects
119
+ translate._debug("Translate: WARNING: typeof "+i+" is "+type+"; converting to string");
120
+ newItem[i] = val.toString();
121
+ } else if(shouldBeObject && !isObject) {
122
+ translate._debug("Translate: WARNING: typeof "+i+" is "+type+"; converting to array");
123
+ newItem[i] = [val];
124
+ } else if(type === "string") {
125
+ // trim strings
126
+ newItem[i] = val.trim();
127
+ } else {
128
+ newItem[i] = val;
129
+ }
130
+ }
131
+ item = newItem;
132
+
133
+ if (item.title) {
134
+ item.title = translate._cleanTitle(item.title, item.itemType);
135
+ // Short Title is added before this in the web itemDone, so if we removed
136
+ // a suffix (e.g., ": a novel") and the short title now matches the title,
137
+ // remove it
138
+ if (item.title == item.shortTitle) {
139
+ delete item.shortTitle;
140
+ }
141
+ }
142
+
143
+ // Clean empty creators
144
+ if (item.creators) {
145
+ for (var i=0; i<item.creators.length; i++) {
146
+ var creator = item.creators[i];
147
+ if (!creator.firstName && !creator.lastName) {
148
+ item.creators.splice(i, 1);
149
+ i--;
150
+ }
151
+ }
152
+ }
153
+
154
+ // If we're not in a child translator, canonicalize tags
155
+ if (!translate._parentTranslator) {
156
+ if(item.tags) item.tags = translate._cleanTags(item.tags);
157
+ }
158
+
159
+ if(item.attachments) {
160
+ var attachments = item.attachments;
161
+ for(var j=0; j<attachments.length; j++) {
162
+ var attachment = attachments[j];
163
+
164
+ // Don't save documents as documents in connector, since we can't pass them around
165
+ if((Zotero.isConnector || Zotero.isServer) && attachment.document) {
166
+ attachment.url = attachment.document.documentURI || attachment.document.URL;
167
+ attachment.mimeType = "text/html";
168
+ delete attachment.document;
169
+ }
170
+
171
+ // If we're not in a child translator, canonicalize tags
172
+ if (!translate._parentTranslator) {
173
+ if(attachment.tags !== undefined) attachment.tags = translate._cleanTags(attachment.tags);
174
+ }
175
+ }
176
+ }
177
+
178
+ // if we're not supposed to save the item or we're in a child translator,
179
+ // just return the item array
180
+ if(translate._libraryID === false || translate._parentTranslator) {
181
+ translate.newItems.push(item);
182
+ return translate._runHandler("itemDone", item, item);
183
+ }
184
+
185
+ // We use this within the connector to keep track of items as they are saved
186
+ if(!item.id) item.id = Zotero.Utilities.randomString();
187
+
188
+ if(item.notes) {
189
+ var notes = item.notes;
190
+ for(var j=0; j<notes.length; j++) {
191
+ var note = notes[j];
192
+ if(!note) {
193
+ notes.splice(j--, 1);
194
+ } else if(typeof(note) != "object") {
195
+ // Convert to object
196
+ notes[j] = {"note":note.toString()}
197
+ }
198
+ // If we're not in a child translator, canonicalize tags
199
+ if (!translate._parentTranslator) {
200
+ if(note.tags !== undefined) note.tags = translate._cleanTags(note.tags);
201
+ }
202
+ }
203
+ }
204
+
205
+ if (item.version) {
206
+ translate._debug("Translate: item.version is deprecated; set item.versionNumber instead");
207
+ item.versionNumber = item.version;
208
+ }
209
+
210
+ if (item.accessDate) {
211
+ if (Zotero.Date.isSQLDateTime(item.accessDate)) {
212
+ translate._debug("Translate: Passing accessDate as SQL is deprecated; pass an ISO 8601 date instead");
213
+ item.accessDate = Zotero.Date.sqlToISO8601(item.accessDate);
214
+ }
215
+ }
216
+
217
+ // Fire itemSaving event
218
+ translate._runHandler("itemSaving", item);
219
+ translate._savingItems++;
220
+
221
+ // For synchronous import (when Promise isn't available in the sandbox or the do*
222
+ // function doesn't use it) and web translators, queue saves
223
+ if (!async || !asyncTranslator) {
224
+ Zotero.debug("Translate: Saving via queue");
225
+ translate.saveQueue.push(item);
226
+ }
227
+ // For async import, save items immediately
228
+ else {
229
+ Zotero.debug("Translate: Saving now");
230
+ translate.incrementAsyncProcesses("Zotero.Translate#_saveItems()");
231
+ return translate._saveItems([item])
232
+ .then(() => translate.decrementAsyncProcesses("Zotero.Translate#_saveItems()"));
233
+ }
234
+ };
235
+
236
+ return run(asyncTranslator);
237
+ },
238
+
239
+ /**
240
+ * Gets translator options that were defined in displayOptions in translator header
241
+ *
242
+ * @param {Zotero.Translate} translate
243
+ * @param {String} option Option to be retrieved
244
+ */
245
+ "getOption":function(translate, option) {
246
+ if(typeof option !== "string") {
247
+ throw(new Error("getOption: option must be a string"));
248
+ return;
249
+ }
250
+
251
+ return translate._displayOptions[option];
252
+ },
253
+
254
+ /**
255
+ * Gets a hidden preference that can be defined by hiddenPrefs in translator header
256
+ *
257
+ * @param {Zotero.Translate} translate
258
+ * @param {String} pref Preference to be retrieved
259
+ */
260
+ "getHiddenPref":function(translate, pref) {
261
+ if(typeof(pref) != "string") {
262
+ throw(new Error("getPref: preference must be a string"));
263
+ }
264
+
265
+ var hp = translate._translatorInfo.hiddenPrefs || {};
266
+
267
+ var value;
268
+ try {
269
+ value = Zotero.Prefs.get('translators.' + pref);
270
+ } catch(e) {}
271
+
272
+ return (value !== undefined ? value : hp[pref]);
273
+ },
274
+
275
+ /**
276
+ * For loading other translators and accessing their methods
277
+ *
278
+ * @param {Zotero.Translate} translate
279
+ * @param {String} type Translator type ("web", "import", "export", or "search")
280
+ * @returns {Object} A safeTranslator object, which operates mostly like Zotero.Translate
281
+ */
282
+ "loadTranslator":function(translate, type) {
283
+ const setDefaultHandlers = function(translate, translation) {
284
+ if(type !== "export"
285
+ && (!translation._handlers['itemDone'] || !translation._handlers['itemDone'].length)) {
286
+ translation.setHandler("itemDone", function(obj, item) {
287
+ translate.Sandbox._itemDone(translate, item);
288
+ });
289
+ }
290
+ if(!translation._handlers['selectItems'] || !translation._handlers['selectItems'].length) {
291
+ translation.setHandler("selectItems", translate._handlers["selectItems"]);
292
+ }
293
+ }
294
+
295
+ if(typeof type !== "string") {
296
+ throw(new Error("loadTranslator: type must be a string"));
297
+ return;
298
+ }
299
+
300
+ Zotero.debug("Translate: Creating translate instance of type "+type+" in sandbox");
301
+ var translation = Zotero.Translate.newInstance(type);
302
+ translation._parentTranslator = translate;
303
+ translation.setTranslatorProvider(translate._translatorProvider);
304
+
305
+ if(translation instanceof Zotero.Translate.Export && !(translation instanceof Zotero.Translate.Export)) {
306
+ throw(new Error("Only export translators may call other export translators"));
307
+ }
308
+
309
+ /**
310
+ * @class Wrapper for {@link Zotero.Translate} for safely calling another translator
311
+ * from inside an existing translator
312
+ * @inner
313
+ */
314
+ var safeTranslator = {};
315
+ safeTranslator.setSearch = function(arg) {
316
+ if(!Zotero.isBookmarklet) arg = JSON.parse(JSON.stringify(arg));
317
+ return translation.setSearch(arg);
318
+ };
319
+ safeTranslator.setDocument = function(arg) {
320
+ if (Zotero.isFx && !Zotero.isBookmarklet) {
321
+ return translation.setDocument(
322
+ Zotero.Translate.DOMWrapper.wrap(arg, arg.SpecialPowers_wrapperOverrides)
323
+ );
324
+ } else {
325
+ return translation.setDocument(arg);
326
+ }
327
+ };
328
+ var errorHandlerSet = false;
329
+ safeTranslator.setHandler = function(arg1, arg2) {
330
+ if(arg1 === "error") errorHandlerSet = true;
331
+ translation.setHandler(arg1,
332
+ function(obj, item) {
333
+ try {
334
+ item = item.wrappedJSObject ? item.wrappedJSObject : item;
335
+ if(arg1 == "itemDone") {
336
+ Object.defineProperty(
337
+ item,
338
+ "complete",
339
+ {
340
+ value: translate._sandboxZotero.Item.prototype.complete,
341
+ enumerable: false,
342
+ }
343
+ );
344
+ }
345
+ arg2(obj, item);
346
+ } catch(e) {
347
+ translate.complete(false, e);
348
+ }
349
+ }
350
+ );
351
+ };
352
+ safeTranslator.setString = function(arg) { translation.setString(arg) };
353
+ safeTranslator.setTranslator = function(arg) {
354
+ var success = translation.setTranslator(arg);
355
+ if(!success) {
356
+ throw new Error("Translator "+translate.translator[0].translatorID+" attempted to call invalid translatorID "+arg);
357
+ }
358
+ };
359
+
360
+ var translatorsHandlerSet = false;
361
+ safeTranslator.getTranslators = async function () {
362
+ if(!translation._handlers["translators"] || !translation._handlers["translators"].length) {
363
+ throw new Error('Translator must register a "translators" handler to '+
364
+ 'call getTranslators() in this translation environment.');
365
+ }
366
+ if(!translatorsHandlerSet) {
367
+ translation.setHandler("translators", function() {
368
+ translate.decrementAsyncProcesses("safeTranslator#getTranslators()");
369
+ });
370
+ }
371
+ translate.incrementAsyncProcesses("safeTranslator#getTranslators()");
372
+ return translation.getTranslators();
373
+ };
374
+
375
+ var doneHandlerSet = false;
376
+ safeTranslator.translate = async function () {
377
+ translate.incrementAsyncProcesses("safeTranslator#translate()");
378
+ setDefaultHandlers(translate, translation);
379
+ if(!doneHandlerSet) {
380
+ doneHandlerSet = true;
381
+ translation.setHandler("done", function() { translate.decrementAsyncProcesses("safeTranslator#translate()") });
382
+ }
383
+ if(!errorHandlerSet) {
384
+ errorHandlerSet = true;
385
+ translation.setHandler("error", function(obj, error) { translate.complete(false, error) });
386
+ }
387
+ return translation.translate(false);
388
+ };
389
+
390
+ safeTranslator.getTranslatorObject = function (callback) {
391
+ translate.incrementAsyncProcesses("safeTranslator#getTranslatorObject()");
392
+
393
+ var translator = translation.translator[0];
394
+ translator = typeof translator === "object"
395
+ ? translator
396
+ : translation._translatorProvider.get(translator);
397
+ // Zotero.Translators.get returns a value in the client and a promise in connectors
398
+ // so we normalize the value to a promise here
399
+ var promise = Zotero.Promise.resolve(translator)
400
+ .then(function (translator) {
401
+ return translation._loadTranslator(translator);
402
+ })
403
+ .then(function () {
404
+ return translation._prepareTranslation();
405
+ })
406
+ .then(function () {
407
+ setDefaultHandlers(translate, translation);
408
+ var sandbox = translation._sandboxManager.sandbox;
409
+ if (!Zotero.Utilities.isEmpty(sandbox.exports)) {
410
+ sandbox.exports.Zotero = sandbox.Zotero;
411
+ sandbox = sandbox.exports;
412
+ }
413
+ else {
414
+ translate._debug("COMPAT WARNING: " + translation.translator[0].label + " does "
415
+ + "not export any properties. Only detect" + translation._entryFunctionSuffix
416
+ + " and do" + translation._entryFunctionSuffix + " will be available in "
417
+ + "connectors.");
418
+ }
419
+
420
+ if (callback) callback(sandbox);
421
+ translate.decrementAsyncProcesses("safeTranslator#getTranslatorObject()");
422
+
423
+ return sandbox;
424
+ })
425
+ .catch(function (e) {
426
+ translate.complete(false, e);
427
+ });
428
+
429
+ if (!callback) {
430
+ return promise;
431
+ }
432
+ };
433
+
434
+ return safeTranslator;
435
+ },
436
+
437
+ /**
438
+ * Enables asynchronous detection or translation
439
+ * @param {Zotero.Translate} translate
440
+ * @deprecated
441
+ */
442
+ "wait":function(translate) {},
443
+
444
+ /**
445
+ * Sets the return value for detection
446
+ *
447
+ * @param {Zotero.Translate} translate
448
+ */
449
+ "done":function(translate, returnValue) {
450
+ if(translate._currentState === "detect") {
451
+ translate._returnValue = returnValue;
452
+ }
453
+ },
454
+
455
+ /**
456
+ * Proxy for translator _debug function
457
+ *
458
+ * @param {Zotero.Translate} translate
459
+ * @param {String} string String to write to console
460
+ * @param {String} [level] Level to log as (1 to 5)
461
+ */
462
+ "debug":function(translate, string, level) {
463
+ translate._debug(string, level);
464
+ }
465
+ },
466
+
467
+ /**
468
+ * Web functions exposed to sandbox
469
+ * @namespace
470
+ */
471
+ "Web": {
472
+ /**
473
+ * Lets user pick which items s/he wants to put in his/her library
474
+ * @param {Zotero.Translate} translate
475
+ * @param {Object} items An set of id => name pairs in object format
476
+ * @param {Function} callback If provided, called with a copy of `items`
477
+ * filtered to the items that the user selected.
478
+ * @returns {Promise<Object?>} If no callback is passed: resolves to
479
+ * the same object that would be passed to the callback.
480
+ */
481
+ selectItems: function (translate, items, callback) {
482
+ function helper(translate, items, callback) {
483
+ if (Zotero.Utilities.isEmpty(items)) {
484
+ throw new Error("Translator called selectItems with no items");
485
+ }
486
+
487
+ // Some translators pass an array rather than an object to Zotero.selectItems.
488
+ // This will break messaging outside of Firefox, so we need to fix it.
489
+ if (Object.prototype.toString.call(items) === "[object Array]") {
490
+ translate._debug("WARNING: Zotero.selectItems should be called with an object, not an array");
491
+ let itemsObj = {};
492
+ for (var i in items) itemsObj[i] = items[i];
493
+ items = itemsObj;
494
+ }
495
+
496
+ if (translate._selectedItems) {
497
+ // if we have a set of selected items for this translation, use them
498
+ return translate._selectedItems;
499
+ }
500
+ else if (translate._handlers.select) {
501
+ // whether the handler operates asynchronously
502
+ var haveAsyncHandler = false;
503
+ var returnedItems = null;
504
+
505
+ var callbackExecuted = false;
506
+ // if this translator provides an async callback for selectItems, rig things
507
+ // up to pop off the async process
508
+ var newCallback = function (selectedItems) {
509
+ callbackExecuted = true;
510
+ try {
511
+ callback(selectedItems);
512
+ }
513
+ catch (e) {
514
+ translate.complete(false, e);
515
+ return false;
516
+ }
517
+ if (haveAsyncHandler) translate.decrementAsyncProcesses("Zotero.selectItems()");
518
+ };
519
+
520
+ if (Zotero.isFx && !Zotero.isBookmarklet) {
521
+ items = Components.utils.cloneInto(items, {});
522
+ }
523
+
524
+ var returnValue = translate._runHandler("select", items, newCallback);
525
+ if (returnValue !== undefined) {
526
+ // handler may have returned a value, which makes callback unnecessary
527
+ Zotero.debug("WARNING: Returning items from a select handler is deprecated. "
528
+ + "Please pass items as to the callback provided as the third argument to "
529
+ + "the handler.");
530
+
531
+ returnedItems = returnValue;
532
+ haveAsyncHandler = false;
533
+ }
534
+ else {
535
+ // if we don't have returnedItems set already, the handler is asynchronous
536
+ haveAsyncHandler = !callbackExecuted;
537
+ }
538
+
539
+ if (haveAsyncHandler) {
540
+ // we are running asynchronously, so increment async processes
541
+ translate.incrementAsyncProcesses("Zotero.selectItems()");
542
+ }
543
+ else if (!callbackExecuted) {
544
+ // callback didn't get called from handler, so call it here
545
+ callback(returnedItems);
546
+ }
547
+ return false;
548
+ }
549
+ else { // no handler defined; assume they want all of them
550
+ callback(items);
551
+ return items;
552
+ }
553
+ }
554
+
555
+ if (callback) {
556
+ return helper(translate, items, callback);
557
+ }
558
+ else {
559
+ return new Promise(resolve => helper(translate, items, resolve));
560
+ }
561
+ },
562
+
563
+ /**
564
+ * Overloads {@link Zotero.Translate.Sandbox.Base._itemDone} to ensure that no standalone
565
+ * items are saved, that an item type is specified, and to add a libraryCatalog and
566
+ * shortTitle if relevant.
567
+ * @param {Zotero.Translate} translate
568
+ * @param {SandboxItem} An item created using the Zotero.Item class from the sandbox
569
+ */
570
+ "_itemDone":function(translate, item) {
571
+ // Only apply checks if there is no parent translator
572
+ if(!translate._parentTranslator) {
573
+ if(!item.itemType) {
574
+ item.itemType = "webpage";
575
+ translate._debug("WARNING: No item type specified");
576
+ }
577
+
578
+ if(item.type == "attachment" || item.type == "note") {
579
+ Zotero.debug("Translate: Discarding standalone "+item.type+" in non-import translator", 2);
580
+ return;
581
+ }
582
+
583
+ // store library catalog if this item was captured from a website, and
584
+ // libraryCatalog is truly undefined (not false or "")
585
+ if(item.repository !== undefined) {
586
+ Zotero.debug("Translate: 'repository' field is now 'libraryCatalog'; please fix your code", 2);
587
+ item.libraryCatalog = item.repository;
588
+ delete item.repository;
589
+ }
590
+
591
+ // automatically set library catalog
592
+ if(item.libraryCatalog === undefined && item.itemType != "webpage") {
593
+ item.libraryCatalog = translate.translator[0].label;
594
+ }
595
+
596
+ // Remove library catalog if not valid for type, so it doesn't get saved to Extra
597
+ if (item.libraryCatalog) {
598
+ let itemTypeID = Zotero.ItemTypes.getID(item.itemType);
599
+ let fieldID = Zotero.ItemFields.getID('libraryCatalog');
600
+ if (!Zotero.ItemFields.isValidForType(fieldID, itemTypeID)) {
601
+ delete item.libraryCatalog;
602
+ }
603
+ }
604
+
605
+ // automatically set access date if URL is set
606
+ if(item.url && typeof item.accessDate == 'undefined') {
607
+ item.accessDate = Zotero.Date.dateToISO(new Date());
608
+ }
609
+
610
+ //consider type-specific "title" alternatives
611
+ var altTitle = Zotero.ItemFields.getName(Zotero.ItemFields.getFieldIDFromTypeAndBase(item.itemType, 'title'));
612
+ if(altTitle && item[altTitle]) item.title = item[altTitle];
613
+
614
+ if(!item.title) {
615
+ translate.complete(false, new Error("No title specified for item"));
616
+ return;
617
+ }
618
+
619
+ // create short title
620
+ if(item.shortTitle === undefined && Zotero.Utilities.fieldIsValidForType("shortTitle", item.itemType)) {
621
+ // only set if changes have been made
622
+ var setShortTitle = false;
623
+ var title = item.title;
624
+
625
+ // shorten to before first colon
626
+ var index = title.indexOf(":");
627
+ if(index !== -1) {
628
+ title = title.substr(0, index);
629
+ setShortTitle = true;
630
+ }
631
+ // shorten to after first question mark
632
+ index = title.indexOf("?");
633
+ if(index !== -1) {
634
+ index++;
635
+ if(index != title.length) {
636
+ title = title.substr(0, index);
637
+ setShortTitle = true;
638
+ }
639
+ }
640
+
641
+ if(setShortTitle) item.shortTitle = title;
642
+ }
643
+
644
+ /* Clean up ISBNs
645
+ * Allow multiple ISBNs, but...
646
+ * (1) validate all ISBNs
647
+ * (2) convert all ISBNs to ISBN-13
648
+ * (3) remove any duplicates
649
+ * (4) separate them with space
650
+ */
651
+ if (item.ISBN) {
652
+ // Match ISBNs with groups separated by various dashes or even spaces
653
+ var isbnRe = /\b(?:97[89][\s\x2D\xAD\u2010-\u2015\u2043\u2212]*)?(?:\d[\s\x2D\xAD\u2010-\u2015\u2043\u2212]*){9}[\dx](?![\x2D\xAD\u2010-\u2015\u2043\u2212])\b/gi,
654
+ validISBNs = [],
655
+ isbn;
656
+ while (isbn = isbnRe.exec(item.ISBN)) {
657
+ var validISBN = Zotero.Utilities.cleanISBN(isbn[0]);
658
+ if (!validISBN) {
659
+ // Back up and move up one character
660
+ isbnRe.lastIndex = isbn.index + 1;
661
+ continue;
662
+ }
663
+
664
+ var isbn13 = Zotero.Utilities.toISBN13(validISBN);
665
+ if (validISBNs.indexOf(isbn13) == -1) validISBNs.push(isbn13);
666
+ }
667
+ item.ISBN = validISBNs.join(' ');
668
+ }
669
+
670
+ // refuse to save very long tags
671
+ if(item.tags) {
672
+ for(var i=0; i<item.tags.length; i++) {
673
+ var tag = item.tags[i],
674
+ tagString = typeof tag === "string" ? tag :
675
+ typeof tag === "object" ? (tag.tag || tag.name) : null;
676
+ if(tagString && tagString.length > 255) {
677
+ translate._debug("WARNING: Skipping unsynchable tag "+JSON.stringify(tagString));
678
+ item.tags.splice(i--, 1);
679
+ }
680
+ }
681
+ }
682
+
683
+ for(var i=0; i<item.attachments.length; i++) {
684
+ var attachment = item.attachments[i];
685
+
686
+ // Web translators are not allowed to use attachment.path
687
+ if (attachment.path) {
688
+ if (!attachment.url) attachment.url = attachment.path;
689
+ delete attachment.path;
690
+ }
691
+
692
+ if (attachment.url) {
693
+ // Remap attachment (but not link) URLs
694
+ // TODO: provide both proxied and un-proxied URLs (also for documents)
695
+ // because whether the attachment is attached as link or file
696
+ // depends on Zotero preferences as well.
697
+ attachment.url = translate.resolveURL(
698
+ attachment.url,
699
+ attachment.proxy === false || attachment.snapshot === false
700
+ );
701
+ }
702
+ }
703
+ }
704
+
705
+ // call super
706
+ Zotero.Translate.Sandbox.Base._itemDone(translate, item);
707
+ },
708
+
709
+ /**
710
+ * Tells Zotero to monitor changes to the DOM and re-trigger detectWeb
711
+ * Can only be set during the detectWeb call
712
+ * @param {DOMNode} target Document node to monitor for changes
713
+ * @param {MutationObserverInit} [config] specifies which DOM mutations should be reported
714
+ */
715
+ "monitorDOMChanges":function(translate, target, config) {
716
+ if(translate._currentState != "detect") {
717
+ Zotero.debug("Translate: monitorDOMChanges can only be called during the 'detect' stage");
718
+ return;
719
+ }
720
+
721
+ var window = translate.document.defaultView
722
+ var mutationObserver = window && ( window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver );
723
+ if(!mutationObserver) {
724
+ Zotero.debug("Translate: This browser does not support mutation observers.");
725
+ return;
726
+ }
727
+
728
+ var translator = translate._potentialTranslators[0];
729
+ if(!translate._registeredDOMObservers[translator.translatorID])
730
+ translate._registeredDOMObservers[translator.translatorID] = [];
731
+ var obs = translate._registeredDOMObservers[translator.translatorID];
732
+
733
+ //do not re-register observer by the same translator for the same node
734
+ if(obs.indexOf(target) != -1) {
735
+ Zotero.debug("Translate: Already monitoring this node");
736
+ return;
737
+ }
738
+
739
+ obs.push(target);
740
+
741
+ var observer = new mutationObserver(function(mutations, observer) {
742
+ obs.splice(obs.indexOf(target),1);
743
+ observer.disconnect();
744
+
745
+ Zotero.debug("Translate: Page modified.");
746
+ //we don't really care what got updated
747
+ var doc = mutations[0].target.ownerDocument;
748
+ translate._runHandler("pageModified", doc);
749
+ });
750
+
751
+ observer.observe(target, config || {childList: true, subtree: true});
752
+ Zotero.debug("Translate: Mutation observer registered on <" + target.nodeName + "> node");
753
+ }
754
+ },
755
+
756
+ /**
757
+ * Import functions exposed to sandbox
758
+ * @namespace
759
+ */
760
+ "Import":{
761
+ /**
762
+ * Saves a collection to the DB
763
+ * Called as {@link Zotero.Collection#complete} from the sandbox
764
+ * @param {Zotero.Translate} translate
765
+ * @param {SandboxCollection} collection
766
+ */
767
+ "_collectionDone":function(translate, collection) {
768
+ translate.newCollections.push(collection);
769
+ if(translate._libraryID == false) {
770
+ translate._runHandler("collectionDone", collection);
771
+ }
772
+ },
773
+
774
+ /**
775
+ * Sets the value of the progress indicator associated with export as a percentage
776
+ * @param {Zotero.Translate} translate
777
+ * @param {Number} value
778
+ */
779
+ "setProgress":function(translate, value) {
780
+ if(typeof value !== "number") {
781
+ translate._progress = null;
782
+ } else {
783
+ translate._progress = value;
784
+ }
785
+ }
786
+ },
787
+
788
+ /**
789
+ * Export functions exposed to sandbox
790
+ * @namespace
791
+ */
792
+ "Export":{
793
+ /**
794
+ * Retrieves the next item to be exported
795
+ * @param {Zotero.Translate} translate
796
+ * @return {SandboxItem}
797
+ */
798
+ "nextItem":function(translate) {
799
+ var item = translate._itemGetter.nextItem();
800
+
801
+ if(translate._displayOptions.hasOwnProperty("exportTags") && !translate._displayOptions["exportTags"]) {
802
+ item.tags = [];
803
+ }
804
+
805
+ translate._runHandler("itemDone", item);
806
+
807
+ return item;
808
+ },
809
+
810
+ /**
811
+ * Retrieves the next collection to be exported
812
+ * @param {Zotero.Translate} translate
813
+ * @return {SandboxCollection}
814
+ */
815
+ "nextCollection":function(translate) {
816
+ if(!translate._translatorInfo.configOptions || !translate._translatorInfo.configOptions.getCollections) {
817
+ throw(new Error("getCollections configure option not set; cannot retrieve collection"));
818
+ }
819
+
820
+ return translate._itemGetter.nextCollection();
821
+ },
822
+
823
+ /**
824
+ * @borrows Zotero.Translate.Sandbox.Import.setProgress as this.setProgress
825
+ */
826
+ "setProgress":function(translate, value) {
827
+ Zotero.Translate.Sandbox.Import.setProgress(translate, value);
828
+ }
829
+ },
830
+
831
+ /**
832
+ * Search functions exposed to sandbox
833
+ * @namespace
834
+ */
835
+ "Search":{
836
+ /**
837
+ * @borrows Zotero.Translate.Sandbox.Web._itemDone as this._itemDone
838
+ */
839
+ "_itemDone":function(translate, item) {
840
+ // Always set library catalog, even if we have a parent translator
841
+ if(item.libraryCatalog === undefined) {
842
+ item.libraryCatalog = translate.translator[0].label;
843
+ }
844
+
845
+ Zotero.Translate.Sandbox.Web._itemDone(translate, item);
846
+ }
847
+ }
848
+ }
849
+
850
+ /**
851
+ * @class Base class for all translation types
852
+ *
853
+ * @property {String} type The type of translator. This is deprecated; use instanceof instead.
854
+ * @property {Zotero.Translator[]} translator The translator currently in use. Usually, only the
855
+ * first entry of the Zotero.Translator array is populated; subsequent entries represent
856
+ * translators to be used if the first fails.
857
+ * @property {String} path The path or URI string of the target
858
+ * @property {String} newItems Items created when translate() was called
859
+ * @property {String} newCollections Collections created when translate() was called
860
+ * @property {Number} runningAsyncProcesses The number of async processes that are running. These
861
+ * need to terminate before Zotero.done() is called.
862
+ */
863
+ Zotero.Translate.Base = function() {}
864
+ Zotero.Translate.Base.prototype = {
865
+ /**
866
+ * Initializes a Zotero.Translate instance
867
+ */
868
+ "init":function() {
869
+ this._handlers = [];
870
+ this._currentState = null;
871
+ this._translatorInfo = null;
872
+ this._translatorProvider = Zotero.Translators;
873
+ this.document = null;
874
+ this.location = null;
875
+ },
876
+
877
+ /**
878
+ * Sets the location to operate upon
879
+ *
880
+ * @param {String|nsIFile} location The URL to which the sandbox should be bound or path to local file
881
+ */
882
+ "setLocation":function(location) {
883
+ this.location = location;
884
+ if(typeof this.location == "object") { // if a file
885
+ this.path = location.path;
886
+ } else { // if a url
887
+ this.path = location;
888
+ }
889
+ },
890
+
891
+ /**
892
+ * Sets the translator to be used for import/export
893
+ *
894
+ * @param {Array{Zotero.Translator}|Zotero.Translator|string} Translator object or ID
895
+ */
896
+ "setTranslator":function(translator) {
897
+ // Accept an array of translators
898
+ if (Array.isArray(translator)) {
899
+ this.translator = translator;
900
+ return true;
901
+ }
902
+ if(!translator) {
903
+ throw new Error("No translator specified");
904
+ }
905
+
906
+ this.translator = null;
907
+
908
+ if(typeof(translator) == "object") { // passed an object and not an ID
909
+ if(translator.translatorID) {
910
+ this.translator = [translator];
911
+ } else {
912
+ throw(new Error("No translatorID specified"));
913
+ }
914
+ } else {
915
+ this.translator = [translator];
916
+ }
917
+
918
+ return !!this.translator;
919
+ },
920
+
921
+ /**
922
+ * Registers a handler function to be called when translation is complete
923
+ *
924
+ * @param {String} type Type of handler to register. Legal values are:
925
+ * select
926
+ * valid: web
927
+ * called: when the user needs to select from a list of available items
928
+ * passed: an associative array in the form id => text
929
+ * returns: a numerically indexed array of ids, as extracted from the passed
930
+ * string
931
+ * itemDone
932
+ * valid: import, web, search
933
+ * called: when an item has been processed; may be called asynchronously
934
+ * passed: an item object (see Zotero.Item)
935
+ * returns: N/A
936
+ * collectionDone
937
+ * valid: import
938
+ * called: when a collection has been processed, after all items have been
939
+ * added; may be called asynchronously
940
+ * passed: a collection object (see Zotero.Collection)
941
+ * returns: N/A
942
+ * done
943
+ * valid: all
944
+ * called: when all processing is finished
945
+ * passed: true if successful, false if an error occurred
946
+ * returns: N/A
947
+ * debug
948
+ * valid: all
949
+ * called: when Zotero.debug() is called
950
+ * passed: string debug message
951
+ * returns: true if message should be logged to the console, false if not
952
+ * error
953
+ * valid: all
954
+ * called: when a fatal error occurs
955
+ * passed: error object (or string)
956
+ * returns: N/A
957
+ * translators
958
+ * valid: all
959
+ * called: when a translator search initiated with Zotero.Translate.getTranslators() is
960
+ * complete
961
+ * passed: an array of appropriate translators
962
+ * returns: N/A
963
+ * pageModified
964
+ * valid: web
965
+ * called: when a web page has been modified
966
+ * passed: the document object for the modified page
967
+ * returns: N/A
968
+ * @param {Function} handler Callback function. All handlers will be passed the current
969
+ * translate instance as the first argument. The second argument is dependent on the handler.
970
+ */
971
+ "setHandler":function(type, handler) {
972
+ if(!this._handlers[type]) {
973
+ this._handlers[type] = new Array();
974
+ }
975
+ this._handlers[type].push(handler);
976
+ },
977
+
978
+ /**
979
+ * Clears all handlers for a given function
980
+ * @param {String} type See {@link Zotero.Translate.Base#setHandler} for valid values
981
+ */
982
+ "clearHandlers":function(type) {
983
+ this._handlers[type] = new Array();
984
+ },
985
+
986
+ /**
987
+ * Clears a single handler for a given function
988
+ * @param {String} type See {@link Zotero.Translate.Base#setHandler} for valid values
989
+ * @param {Function} handler Callback function to remove
990
+ */
991
+ "removeHandler":function(type, handler) {
992
+ var handlerIndex = this._handlers[type].indexOf(handler);
993
+ if(handlerIndex !== -1) this._handlers[type].splice(handlerIndex, 1);
994
+ },
995
+
996
+ /**
997
+ * Set custom translator provider, as returned by Zotero.Translators.makeTranslatorProvider()
998
+ *
999
+ * Used by Scaffold to substitute external translator files
1000
+ *
1001
+ * @param {Object} translatorProvider
1002
+ */
1003
+ setTranslatorProvider: function (translatorProvider) {
1004
+ this._translatorProvider = translatorProvider;
1005
+ },
1006
+
1007
+ /**
1008
+ * Indicates that a new async process is running
1009
+ */
1010
+ "incrementAsyncProcesses":function(f) {
1011
+ this._runningAsyncProcesses++;
1012
+ if(this._parentTranslator) {
1013
+ this._parentTranslator.incrementAsyncProcesses(f+" from child translator");
1014
+ } else {
1015
+ //Zotero.debug("Translate: Incremented asynchronous processes to "+this._runningAsyncProcesses+" for "+f, 4);
1016
+ //Zotero.debug((new Error()).stack);
1017
+ }
1018
+ },
1019
+
1020
+ /**
1021
+ * Indicates that a new async process is finished
1022
+ */
1023
+ "decrementAsyncProcesses":function(f, by) {
1024
+ this._runningAsyncProcesses -= (by ? by : 1);
1025
+ if(!this._parentTranslator) {
1026
+ //Zotero.debug("Translate: Decremented asynchronous processes to "+this._runningAsyncProcesses+" for "+f, 4);
1027
+ //Zotero.debug((new Error()).stack);
1028
+ }
1029
+ if(this._runningAsyncProcesses === 0) {
1030
+ this.complete();
1031
+ }
1032
+ if(this._parentTranslator) this._parentTranslator.decrementAsyncProcesses(f+" from child translator", by);
1033
+ },
1034
+
1035
+ /**
1036
+ * Clears all handlers for a given function
1037
+ * @param {String} type See {@link Zotero.Translate.Base#setHandler} for valid values
1038
+ * @param {Any} argument Argument to be passed to handler
1039
+ */
1040
+ "_runHandler":function(type) {
1041
+ var returnValue = undefined;
1042
+ if(this._handlers[type]) {
1043
+ // compile list of arguments
1044
+ if(this._parentTranslator) {
1045
+ // if there is a parent translator, make sure we don't pass the Zotero.Translate
1046
+ // object, since it could open a security hole
1047
+ var args = [null];
1048
+ } else {
1049
+ var args = [this];
1050
+ }
1051
+ for(var i=1; i<arguments.length; i++) {
1052
+ args.push(arguments[i]);
1053
+ }
1054
+
1055
+ var handlers = this._handlers[type].slice();
1056
+ for(var i=0, n=handlers.length; i<n; i++) {
1057
+ if (type != 'debug') {
1058
+ Zotero.debug(`Translate: Running handler ${i} for ${type}`, 5);
1059
+ }
1060
+ try {
1061
+ returnValue = handlers[i].apply(null, args);
1062
+ } catch(e) {
1063
+ if(this._parentTranslator) {
1064
+ // throw handler errors if they occur when a translator is
1065
+ // called from another translator, so that the
1066
+ // "Could Not Translate" dialog will appear if necessary
1067
+ throw(e);
1068
+ } else {
1069
+ // otherwise, fail silently, so as not to interfere with
1070
+ // interface cleanup
1071
+ Zotero.debug("Translate: "+e+' in handler '+i+' for '+type, 5);
1072
+ Zotero.logError(e);
1073
+ }
1074
+ }
1075
+ }
1076
+ }
1077
+ return returnValue;
1078
+ },
1079
+
1080
+ /**
1081
+ * Gets all applicable translators of a given type
1082
+ *
1083
+ * For import, you should call this after setLocation; otherwise, you'll just get a list of all
1084
+ * import filters, not filters equipped to handle a specific file
1085
+ *
1086
+ * @param {Boolean} [getAllTranslators] Whether all applicable translators should be returned,
1087
+ * rather than just the first available.
1088
+ * @param {Boolean} [checkSetTranslator] If true, the appropriate detect function is run on the
1089
+ * set document/text/etc. using the translator set by setTranslator.
1090
+ * getAllTranslators parameter is meaningless in this context.
1091
+ * @return {Promise} Promise for an array of {@link Zotero.Translator} objects
1092
+ */
1093
+ getTranslators: Zotero.Promise.method(function (getAllTranslators, checkSetTranslator) {
1094
+ var potentialTranslators;
1095
+
1096
+ // do not allow simultaneous instances of getTranslators
1097
+ if(this._currentState === "detect") throw new Error("getTranslators: detection is already running");
1098
+ this._currentState = "detect";
1099
+ this._getAllTranslators = getAllTranslators;
1100
+ this._potentialTranslators = [];
1101
+ this._foundTranslators = [];
1102
+
1103
+ if(checkSetTranslator) {
1104
+ // setTranslator must be called beforehand if checkSetTranslator is set
1105
+ if( !this.translator || !this.translator[0] ) {
1106
+ return Zotero.Promise.reject(new Error("getTranslators: translator must be set via setTranslator before calling" +
1107
+ " getTranslators with the checkSetTranslator flag"));
1108
+ }
1109
+ var promises = new Array();
1110
+ var t;
1111
+ for(var i=0, n=this.translator.length; i<n; i++) {
1112
+ if(typeof(this.translator[i]) == 'string') {
1113
+ t = this._translatorProvider.get(this.translator[i]);
1114
+ if(!t) Zotero.debug("getTranslators: could not retrieve translator '" + this.translator[i] + "'");
1115
+ } else {
1116
+ t = this.translator[i];
1117
+ }
1118
+ /**TODO: check that the translator is of appropriate type?*/
1119
+ if(t) promises.push(t);
1120
+ }
1121
+ if(!promises.length) return Zotero.Promise.reject(new Error("getTranslators: no valid translators were set"));
1122
+ potentialTranslators = Zotero.Promise.all(promises).then(val => [val]);
1123
+ } else {
1124
+ potentialTranslators = this._getTranslatorsGetPotentialTranslators();
1125
+ }
1126
+
1127
+ // if detection returns immediately, return found translators
1128
+ return potentialTranslators.then(function(result) {
1129
+ var allPotentialTranslators = result[0];
1130
+ var proxies = result[1];
1131
+
1132
+ // this gets passed out by Zotero.Translators.getWebTranslatorsForLocation() because it is
1133
+ // specific for each translator, but we want to avoid making a copy of a translator whenever
1134
+ // possible.
1135
+ this._proxies = proxies ? [] : null;
1136
+ this._waitingForRPC = false;
1137
+
1138
+ for(var i=0, n=allPotentialTranslators.length; i<n; i++) {
1139
+ var translator = allPotentialTranslators[i];
1140
+ if(translator.runMode === Zotero.Translator.RUN_MODE_IN_BROWSER) {
1141
+ this._potentialTranslators.push(translator);
1142
+ if (proxies) {
1143
+ this._proxies.push(proxies[i]);
1144
+ }
1145
+ } else if (this instanceof Zotero.Translate.Web && Zotero.Connector) {
1146
+ this._waitingForRPC = true;
1147
+ }
1148
+ }
1149
+
1150
+ // Attach handler for translators, so that we can return a
1151
+ // promise that provides them.
1152
+ // TODO make this._detect() return a promise
1153
+ var deferred = Zotero.Promise.defer();
1154
+ var translatorsHandler = function(obj, translators) {
1155
+ this.removeHandler("translators", translatorsHandler);
1156
+ deferred.resolve(translators);
1157
+ }.bind(this);
1158
+ this.setHandler("translators", translatorsHandler);
1159
+ this._detect();
1160
+
1161
+ if(this._waitingForRPC) {
1162
+ // Try detect in Zotero Standalone. If this fails, it fails; we shouldn't
1163
+ // get hung up about it.
1164
+ let html = this.document.documentElement.innerHTML;
1165
+ html = html.replace(new RegExp(Zotero.Utilities.quotemeta(ZOTERO_CONFIG.BOOKMARKLET_URL), 'g'), "about:blank");
1166
+ Zotero.Connector.callMethod(
1167
+ "detect",
1168
+ {
1169
+ uri: this.location.toString(),
1170
+ cookie: this.document.cookie,
1171
+ html
1172
+ }).catch(() => false).then(function (rpcTranslators) {
1173
+ this._waitingForRPC = false;
1174
+
1175
+ // if there are translators, add them to the list of found translators
1176
+ if (rpcTranslators) {
1177
+ for(var i=0, n=rpcTranslators.length; i<n; i++) {
1178
+ rpcTranslators[i] = new Zotero.Translator(rpcTranslators[i]);
1179
+ rpcTranslators[i].runMode = Zotero.Translator.RUN_MODE_ZOTERO_STANDALONE;
1180
+ rpcTranslators[i].proxy = rpcTranslators[i].proxy ? new Zotero.Proxy(rpcTranslators[i].proxy) : null;
1181
+ }
1182
+ this._foundTranslators = this._foundTranslators.concat(rpcTranslators);
1183
+ }
1184
+
1185
+ // call _detectTranslatorsCollected to return detected translators
1186
+ if (this._currentState === null) {
1187
+ this._detectTranslatorsCollected();
1188
+ }
1189
+ }.bind(this));
1190
+ }
1191
+
1192
+ return deferred.promise;
1193
+ }.bind(this))
1194
+ .catch(function(e) {
1195
+ Zotero.logError(e);
1196
+ this.complete(false, e);
1197
+ }.bind(this));
1198
+ }),
1199
+
1200
+ /**
1201
+ * Get all potential translators (without running detect)
1202
+ * @return {Promise} Promise for an array of {@link Zotero.Translator} objects
1203
+ */
1204
+ _getTranslatorsGetPotentialTranslators: async function () {
1205
+ var translators = await this._translatorProvider.getAllForType(this.type);
1206
+ return [translators];
1207
+ },
1208
+
1209
+ /**
1210
+ * Begins the actual translation. At present, this returns immediately for import/export
1211
+ * translators, but new code should use {@link Zotero.Translate.Base#setHandler} to register a
1212
+ * "done" handler to determine when execution of web/search translators is complete.
1213
+ *
1214
+ * @param {Integer|FALSE} [libraryID] Library in which to save items,
1215
+ * or NULL for default library;
1216
+ * if FALSE, don't save items
1217
+ * @param {Boolean} [saveAttachments=true] Exclude attachments (e.g., snapshots) on import
1218
+ * @param {Boolean} [linkFiles=false] - Save linked files instead of stored files
1219
+ * @returns {Promise} Promise resolved with saved items
1220
+ * when translation complete
1221
+ */
1222
+ translate: Zotero.Promise.method(function (options = {}, ...args) { // initialize properties specific to each translation
1223
+ if (typeof options == 'number') {
1224
+ Zotero.debug("Translate: translate() now takes an object -- update your code", 2);
1225
+ options = {
1226
+ libraryID: options,
1227
+ saveAttachments: args[0],
1228
+ selectedItems: args[1]
1229
+ };
1230
+ }
1231
+
1232
+ var me = this;
1233
+ var deferred = Zotero.Promise.defer()
1234
+
1235
+ if(!this.translator || !this.translator.length) {
1236
+ Zotero.debug("Translate: translate called without specifying a translator. Running detection first.");
1237
+ this.setHandler('translators', function(me, translators) {
1238
+ if(!translators.length) {
1239
+ me.complete(false, "Could not find an appropriate translator");
1240
+ } else {
1241
+ me.setTranslator(translators);
1242
+ deferred.resolve(Zotero.Translate.Base.prototype.translate.call(me, options));
1243
+ }
1244
+ });
1245
+ this.getTranslators();
1246
+ return deferred.promise;
1247
+ }
1248
+
1249
+ this._currentState = "translate";
1250
+
1251
+ this._sessionID = options.sessionID;
1252
+ this._libraryID = options.libraryID;
1253
+ if (options.collections && !Array.isArray(options.collections)) {
1254
+ throw new Error("'collections' must be an array");
1255
+ }
1256
+ this._collections = options.collections;
1257
+ this._saveAttachments = options.saveAttachments === undefined || options.saveAttachments;
1258
+ this._linkFiles = options.linkFiles;
1259
+ this._forceTagType = options.forceTagType;
1260
+ this._saveOptions = options.saveOptions;
1261
+
1262
+ this._savingAttachments = [];
1263
+ this._savingItems = 0;
1264
+ this._waitingForSave = false;
1265
+
1266
+ // Attach handlers for promise
1267
+ var me = this;
1268
+ var doneHandler = function (obj, returnValue) {
1269
+ if (returnValue) deferred.resolve(me.newItems);
1270
+ me.removeHandler("done", doneHandler);
1271
+ me.removeHandler("error", errorHandler);
1272
+ };
1273
+ var errorHandler = function (obj, error) {
1274
+ deferred.reject(error);
1275
+ me.removeHandler("done", doneHandler);
1276
+ me.removeHandler("error", errorHandler);
1277
+ };
1278
+ this.setHandler("done", doneHandler);
1279
+ this.setHandler("error", errorHandler);
1280
+
1281
+ // need to get translator first
1282
+ if (typeof this.translator[0] !== "object") {
1283
+ this.translator[0] = this._translatorProvider.get(this.translator[0]);
1284
+ }
1285
+
1286
+ // Zotero.Translators.get() returns a promise in the connectors, but we don't expect it to
1287
+ // otherwise
1288
+ if (!Zotero.isConnector && this.translator[0].then) {
1289
+ throw new Error("Translator should not be a promise in non-connector mode");
1290
+ }
1291
+
1292
+ if (this.noWait) {
1293
+ var loadPromise = this._loadTranslator(this.translator[0]);
1294
+ if (!loadPromise.isResolved()) {
1295
+ return Zotero.Promise.reject(new Error("Load promise is not resolved in noWait mode"));
1296
+ }
1297
+ this._translateTranslatorLoaded();
1298
+ }
1299
+ else if (this.translator[0].then) {
1300
+ Zotero.Promise.resolve(this.translator[0])
1301
+ .then(function (translator) {
1302
+ this.translator[0] = translator;
1303
+ this._loadTranslator(translator)
1304
+ .then(() => this._translateTranslatorLoaded())
1305
+ .catch(e => deferred.reject(e));
1306
+ }.bind(this));
1307
+ }
1308
+ else {
1309
+ this._loadTranslator(this.translator[0])
1310
+ .then(() => this._translateTranslatorLoaded())
1311
+ .catch(e => deferred.reject(e));
1312
+ }
1313
+
1314
+ return deferred.promise;
1315
+ }),
1316
+
1317
+ /**
1318
+ * Called when translator has been retrieved and loaded
1319
+ */
1320
+ "_translateTranslatorLoaded": Zotero.Promise.method(function() {
1321
+ // set display options to default if they don't exist
1322
+ if(!this._displayOptions) this._displayOptions = this._translatorInfo.displayOptions || {};
1323
+
1324
+ var loadPromise = this._prepareTranslation();
1325
+ if (this.noWait) {
1326
+ if (!loadPromise.isResolved()) {
1327
+ throw new Error("Load promise is not resolved in noWait mode");
1328
+ }
1329
+ rest.apply(this, arguments);
1330
+ } else {
1331
+ return loadPromise.then(() => rest.apply(this, arguments))
1332
+ }
1333
+
1334
+ function rest() {
1335
+ Zotero.debug("Translate: Beginning translation with " + this.translator[0].label);
1336
+
1337
+ this.incrementAsyncProcesses("Zotero.Translate#translate()");
1338
+
1339
+ // translate
1340
+ try {
1341
+ let fn = this._sandboxManager.sandbox["do" + this._entryFunctionSuffix];
1342
+ if (!fn) {
1343
+ this.complete(false, new Error(`Translator has no do${this._entryFunctionSuffix} function`));
1344
+ }
1345
+
1346
+ let maybePromise = Function.prototype.apply.call(
1347
+ fn,
1348
+ null,
1349
+ this._getParameters()
1350
+ );
1351
+
1352
+ if (maybePromise) {
1353
+ maybePromise
1354
+ .then(() => this.decrementAsyncProcesses("Zotero.Translate#translate()"))
1355
+ .catch(e => this.complete(false, e));
1356
+ return;
1357
+ }
1358
+ } catch (e) {
1359
+ this.complete(false, e);
1360
+ return false;
1361
+ }
1362
+
1363
+ this.decrementAsyncProcesses("Zotero.Translate#translate()");
1364
+ }
1365
+ }),
1366
+
1367
+ /**
1368
+ * Return the progress of the import operation, or null if progress cannot be determined
1369
+ */
1370
+ "getProgress":function() { return null },
1371
+
1372
+ /**
1373
+ * Translate a URL to a form that goes through the appropriate proxy, or
1374
+ * convert a relative URL to an absolute one
1375
+ *
1376
+ * @param {String} url
1377
+ * @param {Boolean} dontUseProxy If true, don't convert URLs to variants
1378
+ * that use the proxy
1379
+ * @type String
1380
+ * @private
1381
+ */
1382
+ "resolveURL":function(url, dontUseProxy) {
1383
+ Zotero.debug("Translate: resolving URL " + url);
1384
+
1385
+ const hostPortRe = /^([A-Z][-A-Z0-9+.]*):\/\/[^\/]+/i;
1386
+ const allowedSchemes = ['http', 'https', 'ftp'];
1387
+
1388
+ var m = url.match(hostPortRe),
1389
+ resolved;
1390
+ if (!m) {
1391
+ if (this.location) {
1392
+ if (Zotero.isFx) {
1393
+ resolved = Services.io.newURI(this.location, "", null).resolve(url);
1394
+ }
1395
+ else {
1396
+ resolved = new URL(url, this.location).toString();
1397
+ }
1398
+ }
1399
+ else if (url.startsWith('//')) {
1400
+ // Use HTTPS by default for protocol-relative URL with no associated web page
1401
+ resolved = 'https:' + url;
1402
+ }
1403
+ else {
1404
+ throw new Error('Cannot resolve relative URL without an associated web page: ' + url);
1405
+ }
1406
+ } else if (allowedSchemes.indexOf(m[1].toLowerCase()) == -1) {
1407
+ Zotero.debug("Translate: unsupported scheme " + m[1]);
1408
+ return url;
1409
+ } else {
1410
+ resolved = url;
1411
+ }
1412
+
1413
+ Zotero.debug("Translate: resolved to " + resolved);
1414
+
1415
+ // convert proxy to proper if applicable
1416
+ if(!dontUseProxy && this.translator && this.translator[0]
1417
+ && this._proxy) {
1418
+ var proxiedURL = this._proxy.toProxy(resolved);
1419
+ if (proxiedURL != resolved) {
1420
+ Zotero.debug("Translate: proxified to " + proxiedURL);
1421
+ }
1422
+ resolved = proxiedURL;
1423
+ }
1424
+
1425
+ /*var m = hostPortRe.exec(resolved);
1426
+ if(!m) {
1427
+ throw new Error("Invalid URL supplied for HTTP request: "+url);
1428
+ } else if(this._translate.document && this._translate.document.location) {
1429
+ var loc = this._translate.document.location;
1430
+ if(this._translate._currentState !== "translate" && loc
1431
+ && (m[1].toLowerCase() !== loc.protocol.toLowerCase()
1432
+ || m[2].toLowerCase() !== loc.host.toLowerCase())) {
1433
+ throw new Error("Attempt to access "+m[1]+"//"+m[2]+" from "+loc.protocol+"//"+loc.host
1434
+ +" blocked: Cross-site requests are only allowed during translation");
1435
+ }
1436
+ }*/
1437
+
1438
+ return resolved;
1439
+ },
1440
+
1441
+ /**
1442
+ * Executed on translator completion, either automatically from a synchronous scraper or as
1443
+ * done() from an asynchronous scraper. Finishes things up and calls callback function(s).
1444
+ * @param {Boolean|String} returnValue An item type or a boolean true or false
1445
+ * @param {String|Exception} [error] An error that occurred during translation.
1446
+ * @return {String|NULL} The exception serialized to a string, or null if translation
1447
+ * completed successfully.
1448
+ */
1449
+ "complete":function(returnValue, error) {
1450
+ // allow translation to be aborted for re-running after selecting items
1451
+ if(this._aborted) return;
1452
+
1453
+ // Make sure this isn't called twice
1454
+ if(this._currentState === null) {
1455
+ if(!returnValue) {
1456
+ Zotero.debug("Translate: WARNING: Zotero.done() called after translator completion with error");
1457
+ Zotero.debug(error);
1458
+ } else {
1459
+ var e = new Error();
1460
+ Zotero.debug("Translate: WARNING: Zotero.done() called after translation completion. This should never happen. Please examine the stack below.");
1461
+ Zotero.debug(e.stack);
1462
+ }
1463
+ return;
1464
+ }
1465
+
1466
+ // reset async processes and propagate them to parent
1467
+ if(this._parentTranslator && this._runningAsyncProcesses) {
1468
+ this._parentTranslator.decrementAsyncProcesses("Zotero.Translate#complete", this._runningAsyncProcesses);
1469
+ }
1470
+ this._runningAsyncProcesses = 0;
1471
+
1472
+ if(!returnValue && this._returnValue) returnValue = this._returnValue;
1473
+
1474
+ var errorString = null;
1475
+ if(!returnValue && error) errorString = this._generateErrorString(error);
1476
+ if(this._currentState === "detect") {
1477
+ if(this._potentialTranslators.length) {
1478
+ var lastTranslator = this._potentialTranslators.shift();
1479
+ var lastProxy = this._proxies ? this._proxies.shift() : null;
1480
+
1481
+ if (returnValue) {
1482
+ var dupeTranslator = {proxy: lastProxy ? new Zotero.Proxy(lastProxy) : null};
1483
+
1484
+ for (var i in lastTranslator) dupeTranslator[i] = lastTranslator[i];
1485
+ if (Zotero.isBookmarklet && returnValue === "server") {
1486
+ // In the bookmarklet, the return value from detectWeb can be "server" to
1487
+ // indicate the translator should be run on the Zotero server
1488
+ dupeTranslator.runMode = Zotero.Translator.RUN_MODE_ZOTERO_SERVER;
1489
+ } else {
1490
+ // Usually the return value from detectWeb will be either an item type or
1491
+ // the string "multiple"
1492
+ dupeTranslator.itemType = returnValue;
1493
+ }
1494
+
1495
+ this._foundTranslators.push(dupeTranslator);
1496
+ } else if(error) {
1497
+ this._debug("Detect using "+lastTranslator.label+" failed: \n"+errorString, 2);
1498
+ }
1499
+ }
1500
+
1501
+ if(this._potentialTranslators.length && (this._getAllTranslators || !returnValue)) {
1502
+ // more translators to try; proceed to next translator
1503
+ this._detect();
1504
+ } else {
1505
+ this._currentState = null;
1506
+ if(!this._waitingForRPC) this._detectTranslatorsCollected();
1507
+ }
1508
+ } else {
1509
+ // unset return value is equivalent to true
1510
+ if(returnValue === undefined) returnValue = true;
1511
+
1512
+ if(returnValue) {
1513
+ if(this.saveQueue.length) {
1514
+ this._waitingForSave = true;
1515
+ this._saveItems(this.saveQueue)
1516
+ .catch(e => this._runHandler("error", e))
1517
+ .then(() => this.saveQueue = []);
1518
+ return;
1519
+ }
1520
+ this._debug("Translation successful");
1521
+ } else {
1522
+ if(error) {
1523
+ if (!this._parentTranslator) {
1524
+ // store in error log if it's the root translator,
1525
+ // otherwise it's up to the root translator whether it wants to
1526
+ // log an error or not in this case
1527
+ Zotero.logError(error);
1528
+ }
1529
+
1530
+ // report error to debug log
1531
+ this._debug("Translation using "+(this.translator && this.translator[0] && this.translator[0].label ? this.translator[0].label : "no translator")+" failed: \n"+errorString, 2);
1532
+ }
1533
+
1534
+ this._runHandler("error", error);
1535
+ }
1536
+
1537
+ this._currentState = null;
1538
+
1539
+ // call handlers
1540
+ this._runHandler("itemsDone", returnValue);
1541
+ if(returnValue) {
1542
+ this._checkIfDone();
1543
+ } else {
1544
+ this._runHandler("done", returnValue);
1545
+ }
1546
+ }
1547
+
1548
+ return errorString;
1549
+ },
1550
+
1551
+ _cleanTitle: function (title, itemType) {
1552
+ if (itemType == 'book' || itemType == 'bookSection') {
1553
+ return title.replace(/\s*:\s*a novel\s*$/i, '');
1554
+ }
1555
+ return title;
1556
+ },
1557
+
1558
+ /**
1559
+ * Canonicalize an array of tags such that they are all objects with the tag stored in the
1560
+ * "tag" property and a type (if specified) is stored in the "type" property
1561
+ * @returns {Object[]} Array of new tag objects
1562
+ */
1563
+ "_cleanTags":function(tags) {
1564
+ var newTags = [];
1565
+ if(!tags) return newTags;
1566
+ for(var i=0; i<tags.length; i++) {
1567
+ var tag = tags[i];
1568
+ if(!tag) continue;
1569
+ if(typeof(tag) == "object") {
1570
+ var tagString = tag.tag || tag.name;
1571
+ if(tagString) {
1572
+ var newTag = {"tag":tagString};
1573
+ if(tag.type) newTag.type = tag.type;
1574
+ newTags.push(newTag);
1575
+ }
1576
+ } else {
1577
+ newTags.push({"tag":tag.toString()});
1578
+ }
1579
+ }
1580
+ return newTags;
1581
+ },
1582
+
1583
+ /**
1584
+ * Saves items to the database, taking care to defer attachmentProgress notifications
1585
+ * until after save
1586
+ */
1587
+ _saveItems: Zotero.Promise.method(function (items) {
1588
+ var itemDoneEventsDispatched = false;
1589
+ var deferredProgress = [];
1590
+ var attachmentsWithProgress = [];
1591
+
1592
+ function attachmentCallback(attachment, progress, error) {
1593
+ // Find by id if available (used in the connector)
1594
+ if (attachment.id) {
1595
+ var attachmentIndex = this._savingAttachments.findIndex(x => x.id == attachment.id);
1596
+ }
1597
+ else {
1598
+ var attachmentIndex = this._savingAttachments.indexOf(attachment);
1599
+ }
1600
+ if(progress === false || progress === 100) {
1601
+ if(attachmentIndex !== -1) {
1602
+ this._savingAttachments.splice(attachmentIndex, 1);
1603
+ }
1604
+ } else if(attachmentIndex === -1) {
1605
+ this._savingAttachments.push(attachment);
1606
+ }
1607
+
1608
+ if(itemDoneEventsDispatched) {
1609
+ // itemDone event has already fired, so we can fire attachmentProgress
1610
+ // notifications
1611
+ this._runHandler("attachmentProgress", attachment, progress, error);
1612
+ this._checkIfDone();
1613
+ } else {
1614
+ // Defer until after we fire the itemDone event
1615
+ deferredProgress.push([attachment, progress, error]);
1616
+ attachmentsWithProgress.push(attachment);
1617
+ }
1618
+ }
1619
+
1620
+ return this._itemSaver.saveItems(items.slice(), attachmentCallback.bind(this),
1621
+ function(newItems) {
1622
+ this._runHandler("itemsDone", newItems);
1623
+ // Remove attachments not being saved from item.attachments
1624
+ for(var i=0; i<items.length; i++) {
1625
+ var item = items[i];
1626
+ for(var j=0; j<item.attachments.length; j++) {
1627
+ if(attachmentsWithProgress.indexOf(item.attachments[j]) === -1) {
1628
+ item.attachments.splice(j--, 1);
1629
+ }
1630
+ }
1631
+ }
1632
+
1633
+ // Trigger itemDone events, waiting for them if they return promises
1634
+ var maybePromises = [];
1635
+ for(var i=0, nItems = items.length; i<nItems; i++) {
1636
+ maybePromises.push(this._runHandler("itemDone", newItems[i], items[i]));
1637
+ }
1638
+ return Zotero.Promise.all(maybePromises).then(() => newItems);
1639
+ }.bind(this))
1640
+ .then(function (newItems) {
1641
+ // Specify that itemDone event was dispatched, so that we don't defer
1642
+ // attachmentProgress notifications anymore
1643
+ itemDoneEventsDispatched = true;
1644
+
1645
+ // Run deferred attachmentProgress notifications
1646
+ for(var i=0; i<deferredProgress.length; i++) {
1647
+ this._runHandler("attachmentProgress", deferredProgress[i][0],
1648
+ deferredProgress[i][1], deferredProgress[i][2]);
1649
+ }
1650
+
1651
+ this._savingItems -= items.length;
1652
+ this.newItems = this.newItems.concat(newItems);
1653
+ this._checkIfDone();
1654
+ }.bind(this))
1655
+ .catch((e) => {
1656
+ this._savingItems -= items.length;
1657
+ this.complete(false, e);
1658
+ throw e;
1659
+ });
1660
+ }),
1661
+
1662
+ /**
1663
+ * Checks if saving done, and if so, fires done event
1664
+ */
1665
+ "_checkIfDone":function() {
1666
+ if(!this._savingItems && !this._savingAttachments.length && (!this._currentState || this._waitingForSave)) {
1667
+ if (this.newCollections
1668
+ && this._libraryID !== false
1669
+ && this._itemSaver.saveCollections) {
1670
+ var me = this;
1671
+ this._itemSaver.saveCollections(this.newCollections)
1672
+ .then(function (newCollections) {
1673
+ me.newCollections = newCollections;
1674
+ me._runHandler("done", true);
1675
+ })
1676
+ .catch(function (err) {
1677
+ me._runHandler("error", err);
1678
+ me._runHandler("done", false);
1679
+ });
1680
+ } else {
1681
+ this._runHandler("done", true);
1682
+ }
1683
+ }
1684
+ },
1685
+
1686
+ /**
1687
+ * Begins running detect code for a translator, first loading it
1688
+ */
1689
+ _detect: async function() {
1690
+ // there won't be any translators if we need an RPC call
1691
+ if(!this._potentialTranslators.length) {
1692
+ this.complete(true);
1693
+ return null;
1694
+ }
1695
+
1696
+ try {
1697
+ await this._loadTranslator(this._potentialTranslators[0]);
1698
+ return await this._detectTranslatorLoaded();
1699
+ }
1700
+ catch (e) {
1701
+ this.complete(false, e);
1702
+ }
1703
+ },
1704
+
1705
+ /**
1706
+ * Runs detect code for a translator
1707
+ */
1708
+ _detectTranslatorLoaded: async function () {
1709
+ this._prepareDetection();
1710
+
1711
+ this.incrementAsyncProcesses("Zotero.Translate#getTranslators");
1712
+
1713
+ let fn = this._sandboxManager.sandbox["detect" + this._entryFunctionSuffix];
1714
+ if (!fn) {
1715
+ this.complete(false, new Error(`Translator has no detect${this._entryFunctionSuffix} function`));
1716
+ }
1717
+
1718
+ var maybePromise = Function.prototype.apply.call(
1719
+ fn,
1720
+ null,
1721
+ this._getParameters()
1722
+ );
1723
+ // If detect* returns a promise, wait for it
1724
+ var returnValue = (maybePromise && maybePromise.then) ? await maybePromise : maybePromise;
1725
+
1726
+ if (returnValue !== undefined) this._returnValue = returnValue;
1727
+ this.decrementAsyncProcesses("Zotero.Translate#getTranslators");
1728
+
1729
+ // If the translator started an async process in detect* (like loading another translator),
1730
+ // wait for it in the promise we return
1731
+ if (this._runningAsyncProcesses) {
1732
+ return new Promise((resolve, reject) => {
1733
+ this.setHandler('translators', () => resolve(this._returnValue));
1734
+ this.setHandler('error', (_, err) => reject(err));
1735
+ });
1736
+ }
1737
+
1738
+ // Otherwise, immediately return what detect* returned
1739
+ return returnValue;
1740
+ },
1741
+
1742
+ /**
1743
+ * Called when all translators have been collected for detection
1744
+ */
1745
+ "_detectTranslatorsCollected":function() {
1746
+ Zotero.debug("Translate: All translator detect calls and RPC calls complete:");
1747
+ this._foundTranslators.sort(function(a, b) {
1748
+ // If priority is equal, prioritize translators that run in browser over the client
1749
+ if (a.priority == b.priority) {
1750
+ return a.runMode - b.runMode;
1751
+ }
1752
+ return a.priority-b.priority;
1753
+ });
1754
+ if (this._foundTranslators.length) {
1755
+ this._foundTranslators.forEach(function(t) {
1756
+ Zotero.debug("\t" + t.label + ": " + t.priority);
1757
+ });
1758
+ } else {
1759
+ Zotero.debug("\tNo suitable translators found");
1760
+ }
1761
+ this._runHandler("translators", this._foundTranslators);
1762
+ },
1763
+
1764
+ /**
1765
+ * Loads the translator into its sandbox
1766
+ * @param {Zotero.Translator} translator
1767
+ * @return {Promise}
1768
+ */
1769
+ _loadTranslator: Zotero.Promise.method(function (translator) {
1770
+ var sandboxLocation = this._getSandboxLocation();
1771
+ if(!this._sandboxLocation || sandboxLocation !== this._sandboxLocation) {
1772
+ this._sandboxLocation = sandboxLocation;
1773
+ this._generateSandbox();
1774
+ }
1775
+
1776
+ this._currentTranslator = translator;
1777
+
1778
+ if (this.type == 'web') {
1779
+ // Pass on the proxy of the parent translate
1780
+ if (this._parentTranslator) {
1781
+ this._proxy = this._parentTranslator._proxy;
1782
+ } else {
1783
+ this._proxy = translator.proxy;
1784
+ }
1785
+ } else {
1786
+ // Use proxy only for web translators
1787
+ this._proxy = null;
1788
+ }
1789
+ this._runningAsyncProcesses = 0;
1790
+ this._returnValue = undefined;
1791
+ this._aborted = false;
1792
+ this.saveQueue = [];
1793
+
1794
+ var parse = function(code) {
1795
+ Zotero.debug("Translate: Parsing code for " + translator.label + " "
1796
+ + "(" + translator.translatorID + ", " + translator.lastUpdated + ")", 4);
1797
+ // This might throw but it's better than catching and calling complete(false) here
1798
+ // since then other execution paths are not aware of this failing and continue running
1799
+ // at least in Import translation detection, causing weird race conditions.
1800
+ // The code that calls this function (which is really only code in this file)
1801
+ // should expect a throw and call complete(false) after catching.
1802
+ this._sandboxManager.eval(
1803
+ "var exports = {}, ZOTERO_TRANSLATOR_INFO = " + code,
1804
+ [
1805
+ "detect" + this._entryFunctionSuffix,
1806
+ "do" + this._entryFunctionSuffix,
1807
+ "exports",
1808
+ "ZOTERO_TRANSLATOR_INFO"
1809
+ ],
1810
+ (translator.file ? translator.file.path : translator.label)
1811
+ );
1812
+
1813
+ this._translatorInfo = this._sandboxManager.sandbox.ZOTERO_TRANSLATOR_INFO;
1814
+ }.bind(this);
1815
+
1816
+ if (this.noWait) {
1817
+ let codePromise = this._translatorProvider.getCodeForTranslator(translator);
1818
+ if (!codePromise.isResolved()) {
1819
+ throw new Error("Code promise is not resolved in noWait mode");
1820
+ }
1821
+ parse(codePromise.value());
1822
+ }
1823
+ else {
1824
+ return this._translatorProvider.getCodeForTranslator(translator).then(parse);
1825
+ }
1826
+ }),
1827
+
1828
+ /**
1829
+ * Generates a sandbox for scraping/scraper detection
1830
+ */
1831
+ "_generateSandbox":function() {
1832
+ Zotero.debug("Translate: Binding sandbox to "+(typeof this._sandboxLocation == "object" ? this._sandboxLocation.document.location : this._sandboxLocation), 4);
1833
+ this._sandboxManager = new Zotero.Translate.SandboxManager(this._sandboxLocation);
1834
+
1835
+ this._sandboxManager.importObject(this.Sandbox, this);
1836
+ this._sandboxManager.importObject({"Utilities":new Zotero.Utilities.Translate(this)});
1837
+
1838
+ this._sandboxZotero = this._sandboxManager.sandbox.Zotero;
1839
+
1840
+ this._sandboxZotero.Item = this._makeSandboxItem();
1841
+ if (this instanceof Zotero.Translate.Export || this instanceof Zotero.Translate.Import) {
1842
+ this._sandboxZotero.Collection = this._makeSandboxCollection();
1843
+ }
1844
+
1845
+ this._sandboxZotero.Utilities.HTTP = this._sandboxZotero.Utilities;
1846
+
1847
+ this._sandboxZotero.isBookmarklet = Zotero.isBookmarklet || false;
1848
+ this._sandboxZotero.isConnector = Zotero.isConnector || false;
1849
+ this._sandboxZotero.isServer = Zotero.isServer || false;
1850
+ this._sandboxZotero.parentTranslator = this._parentTranslator
1851
+ && this._parentTranslator._currentTranslator ?
1852
+ this._parentTranslator._currentTranslator.translatorID : null;
1853
+
1854
+ // create shortcuts
1855
+ this._sandboxManager.sandbox.Z = this._sandboxZotero;
1856
+ this._sandboxManager.sandbox.ZU = this._sandboxZotero.Utilities;
1857
+
1858
+ // Add helper functions
1859
+ if (this.type == 'web' || this.type == 'search') {
1860
+ this._sandboxManager.sandbox.attr = this._attr.bind(this);
1861
+ this._sandboxManager.sandbox.text = this._text.bind(this);
1862
+ this._sandboxManager.sandbox.innerText = this._innerText.bind(this);
1863
+ this._sandboxManager.sandbox.request = this._sandboxZotero.Utilities.request.bind(this._sandboxZotero.Utilities);
1864
+ this._sandboxManager.sandbox.requestText = this._sandboxZotero.Utilities.requestText.bind(this._sandboxZotero.Utilities);
1865
+ this._sandboxManager.sandbox.requestJSON = this._sandboxZotero.Utilities.requestJSON.bind(this._sandboxZotero.Utilities);
1866
+ this._sandboxManager.sandbox.requestDocument = this._sandboxZotero.Utilities.requestDocument.bind(this._sandboxZotero.Utilities);
1867
+ }
1868
+ },
1869
+
1870
+ /**
1871
+ * Helper function to extract HTML attribute text
1872
+ *
1873
+ * Text is automatically trimmed
1874
+ */
1875
+ _attr: function (selector, attr, index) {
1876
+ if (typeof arguments[0] == 'string') {
1877
+ var docOrElem = this.document;
1878
+ }
1879
+ // Document or element passed as first argument
1880
+ else {
1881
+ [docOrElem, selector, attr, index] = arguments;
1882
+ }
1883
+ var elem = index
1884
+ ? docOrElem.querySelectorAll(selector).item(index)
1885
+ : docOrElem.querySelector(selector);
1886
+ if (!elem) return "";
1887
+ return (elem.hasAttribute(attr) ? elem.getAttribute(attr) : "").trim();
1888
+ },
1889
+
1890
+ /**
1891
+ * Helper function to extract HTML element text
1892
+ *
1893
+ * Text is extracted using textContent and is automatically trimmed
1894
+ */
1895
+ _text: function (selector, index) {
1896
+ if (typeof arguments[0] == 'string') {
1897
+ var docOrElem = this.document;
1898
+ }
1899
+ // Document or element passed as first argument
1900
+ else {
1901
+ [docOrElem, selector, index] = arguments;
1902
+ }
1903
+ var elem = index
1904
+ ? docOrElem.querySelectorAll(selector).item(index)
1905
+ : docOrElem.querySelector(selector);
1906
+ return (elem ? elem.textContent : "").trim();
1907
+ },
1908
+
1909
+ /**
1910
+ * Helper function to extract rendered HTML element text
1911
+ *
1912
+ * Text is extracted using innerText, not textContent, so it reflects the rendered content, and
1913
+ * is automatically trimmed
1914
+ */
1915
+ _innerText: function (selector, index) {
1916
+ if (typeof arguments[0] == 'string') {
1917
+ var docOrElem = this.document;
1918
+ }
1919
+ // Document or element passed as first argument
1920
+ else {
1921
+ [docOrElem, selector, index] = arguments;
1922
+ }
1923
+ var elem = index
1924
+ ? docOrElem.querySelectorAll(selector).item(index)
1925
+ : docOrElem.querySelector(selector);
1926
+ return (elem ? elem.innerText : "").trim();
1927
+ },
1928
+
1929
+ _makeSandboxItem() {
1930
+ let sandboxZotero = this._sandboxZotero;
1931
+ if (!sandboxZotero) {
1932
+ throw new Error('Sandbox must be initialized');
1933
+ }
1934
+
1935
+ return class {
1936
+ itemType;
1937
+
1938
+ creators = [];
1939
+
1940
+ notes = [];
1941
+
1942
+ tags = [];
1943
+
1944
+ seeAlso = [];
1945
+
1946
+ attachments = [];
1947
+
1948
+ constructor(itemType) {
1949
+ this.itemType = itemType;
1950
+ }
1951
+
1952
+ setExtra(field, value) {
1953
+ let lines = String(this.extra || '').split('\n');
1954
+ let existingIndex = lines.findIndex(line => line.startsWith(field + ': '));
1955
+ if (existingIndex !== -1) {
1956
+ lines[existingIndex] = `${field}: ${value}`;
1957
+ }
1958
+ else {
1959
+ lines.push(`${field}: ${value}`);
1960
+ }
1961
+ this.extra = lines.join('\n');
1962
+ }
1963
+
1964
+ complete() {
1965
+ return sandboxZotero._itemDone(this);
1966
+ }
1967
+ };
1968
+ },
1969
+
1970
+ _makeSandboxCollection() {
1971
+ let sandboxZotero = this._sandboxZotero;
1972
+ if (!sandboxZotero) {
1973
+ throw new Error('Sandbox must be initialized');
1974
+ }
1975
+
1976
+ return class {
1977
+ complete() {
1978
+ return sandboxZotero._collectionDone(this);
1979
+ }
1980
+ };
1981
+ },
1982
+
1983
+ /**
1984
+ * Logs a debugging message
1985
+ * @param {String} string Debug string to log
1986
+ * @param {Integer} level Log level (1-5, higher numbers are higher priority)
1987
+ */
1988
+ "_debug":function(string, level) {
1989
+ if(level !== undefined && typeof level !== "number") {
1990
+ Zotero.debug("debug: level must be an integer");
1991
+ return;
1992
+ }
1993
+
1994
+ // if handler does not return anything explicitly false, show debug
1995
+ // message in console
1996
+ if(this._runHandler("debug", string) !== false) {
1997
+ if(typeof string == "string") string = "Translate: "+string;
1998
+ Zotero.debug(string, level);
1999
+ }
2000
+ },
2001
+ /**
2002
+ * Generates a string from an exception
2003
+ * @param {String|Exception} error
2004
+ */
2005
+ _generateErrorString: function (error) {
2006
+ var errorString = error;
2007
+ if (error.stack && error) {
2008
+ let stack = error.stack;
2009
+ if (Zotero.isFx) {
2010
+ stack = Zotero.Debug.filterStack(stack);
2011
+ }
2012
+ errorString += "\n\n" + stack;
2013
+ }
2014
+ if (this.path) {
2015
+ errorString += `\nurl => ${this.path}`;
2016
+ }
2017
+ if (Zotero.Prefs.get("downloadAssociatedFiles")) {
2018
+ errorString += "\ndownloadAssociatedFiles => true";
2019
+ }
2020
+ if (Zotero.Prefs.get("automaticSnapshots")) {
2021
+ errorString += "\nautomaticSnapshots => true";
2022
+ }
2023
+ return errorString;
2024
+ },
2025
+
2026
+ /**
2027
+ * Determines the location where the sandbox should be bound
2028
+ * @return {String|document} The location to which to bind the sandbox
2029
+ */
2030
+ "_getSandboxLocation":function() {
2031
+ return (this._parentTranslator ? this._parentTranslator._sandboxLocation : "http://www.example.com/");
2032
+ },
2033
+
2034
+ /**
2035
+ * Gets parameters to be passed to detect* and do* functions
2036
+ * @return {Array} A list of parameters
2037
+ */
2038
+ "_getParameters":function() { return []; },
2039
+
2040
+ /**
2041
+ * No-op for preparing detection
2042
+ */
2043
+ "_prepareDetection":function() {},
2044
+
2045
+ /**
2046
+ * No-op for preparing translation
2047
+ */
2048
+ "_prepareTranslation": function () { return Zotero.Promise.resolve(); }
2049
+ }
2050
+
2051
+ /**
2052
+ * @class Web translation
2053
+ *
2054
+ * @property {Document} document The document object to be used for web scraping (set with setDocument)
2055
+ * @property {Zotero.CookieSandbox} cookieSandbox A CookieSandbox to manage cookies for
2056
+ * this Translate instance.
2057
+ */
2058
+ Zotero.Translate.Web = function() {
2059
+ this._registeredDOMObservers = {}
2060
+ this.init();
2061
+ }
2062
+ Zotero.Translate.Web.prototype = new Zotero.Translate.Base();
2063
+ Zotero.Translate.Web.prototype.type = "web";
2064
+ Zotero.Translate.Web.prototype._entryFunctionSuffix = "Web";
2065
+ Zotero.Translate.Web.prototype.Sandbox = Zotero.Translate.Sandbox._inheritFromBase(Zotero.Translate.Sandbox.Web);
2066
+
2067
+ /**
2068
+ * Sets the browser to be used for web translation
2069
+ * @param {Document} doc An HTML document
2070
+ */
2071
+ Zotero.Translate.Web.prototype.setDocument = function(doc) {
2072
+ this.document = doc;
2073
+ try {
2074
+ this.rootDocument = doc.defaultView.top.document;
2075
+ } catch (e) {
2076
+ // Cross-origin frames won't be able to access top.document and will throw an error
2077
+ }
2078
+ if (!this.rootDocument) {
2079
+ this.rootDocument = doc;
2080
+ }
2081
+ this.setLocation(doc.location.href, this.rootDocument.location.href);
2082
+ }
2083
+
2084
+ /**
2085
+ * Sets a Zotero.CookieSandbox to handle cookie management for XHRs initiated from this
2086
+ * translate instance
2087
+ *
2088
+ * @param {Zotero.CookieSandbox} cookieSandbox
2089
+ */
2090
+ Zotero.Translate.Web.prototype.setCookieSandbox = function(cookieSandbox) {
2091
+ this.cookieSandbox = cookieSandbox;
2092
+ }
2093
+
2094
+ /**
2095
+ * Sets headers to include in HTTP requests. Used by translation-server.
2096
+ */
2097
+ Zotero.Translate.Web.prototype.setRequestHeaders = function (headers) {
2098
+ this.requestHeaders = headers;
2099
+ };
2100
+
2101
+ /**
2102
+ * Sets the location to operate upon
2103
+ *
2104
+ * @param {String} location The URL of the page to translate
2105
+ * @param {String} rootLocation The URL of the root page, within which `location` is embedded
2106
+ */
2107
+ Zotero.Translate.Web.prototype.setLocation = function(location, rootLocation) {
2108
+ this.location = location;
2109
+ this.rootLocation = rootLocation || location;
2110
+ this.path = this.location;
2111
+ }
2112
+
2113
+ /**
2114
+ * Get potential web translators
2115
+ */
2116
+ Zotero.Translate.Web.prototype._getTranslatorsGetPotentialTranslators = function() {
2117
+ return this._translatorProvider.getWebTranslatorsForLocation(this.location, this.rootLocation);
2118
+ }
2119
+
2120
+ /**
2121
+ * Bind sandbox to document being translated
2122
+ */
2123
+ Zotero.Translate.Web.prototype._getSandboxLocation = function() {
2124
+ if(this._parentTranslator) {
2125
+ return this._parentTranslator._sandboxLocation;
2126
+ } else if(this.document.defaultView
2127
+ && (this.document.defaultView.toString().indexOf("Window") !== -1
2128
+ || this.document.defaultView.toString().indexOf("XrayWrapper") !== -1)) {
2129
+ return this.document.defaultView;
2130
+ } else {
2131
+ return this.document.location.toString();
2132
+ }
2133
+ }
2134
+
2135
+ /**
2136
+ * Pass document and location to detect* and do* functions
2137
+ */
2138
+ Zotero.Translate.Web.prototype._getParameters = function() {
2139
+ return [this.document, this.location];
2140
+ };
2141
+
2142
+ /**
2143
+ * Prepare translation
2144
+ */
2145
+ Zotero.Translate.Web.prototype._prepareTranslation = Zotero.Promise.method(function () {
2146
+ this._itemSaver = new Zotero.Translate.ItemSaver({
2147
+ libraryID: this._libraryID,
2148
+ collections: this._collections,
2149
+ attachmentMode: Zotero.Translate.ItemSaver[(this._saveAttachments ? "ATTACHMENT_MODE_DOWNLOAD" : "ATTACHMENT_MODE_IGNORE")],
2150
+ forceTagType: 1,
2151
+ sessionID: this._sessionID,
2152
+ cookieSandbox: this._cookieSandbox,
2153
+ proxy: this._proxy,
2154
+ baseURI: this.location
2155
+ });
2156
+ this.newItems = [];
2157
+ });
2158
+
2159
+ /**
2160
+ * Overload translate to set selectedItems
2161
+ */
2162
+ Zotero.Translate.Web.prototype.translate = function (options = {}, ...args) {
2163
+ if (typeof options == 'number' || options === false) {
2164
+ Zotero.debug("Translate: translate() now takes an object -- update your code", 2);
2165
+ options = {
2166
+ libraryID: options,
2167
+ saveAttachments: args[0],
2168
+ selectedItems: args[1]
2169
+ };
2170
+ }
2171
+ this._selectedItems = options.selectedItems;
2172
+ return Zotero.Translate.Base.prototype.translate.call(this, options);
2173
+ }
2174
+
2175
+ /**
2176
+ * Overload _translateTranslatorLoaded to send an RPC call if necessary
2177
+ */
2178
+ Zotero.Translate.Web.prototype._translateTranslatorLoaded = async function() {
2179
+ var runMode = this.translator[0].runMode;
2180
+ if(runMode === Zotero.Translator.RUN_MODE_IN_BROWSER || this._parentTranslator) {
2181
+ Zotero.Translate.Base.prototype._translateTranslatorLoaded.apply(this);
2182
+ } else if(runMode === Zotero.Translator.RUN_MODE_ZOTERO_STANDALONE ||
2183
+ (runMode === Zotero.Translator.RUN_MODE_ZOTERO_SERVER && await Zotero.Connector.checkIsOnline())) {
2184
+ var me = this;
2185
+ let html = this.document.documentElement.innerHTML;
2186
+ html = html.replace(new RegExp(Zotero.Utilities.quotemeta(ZOTERO_CONFIG.BOOKMARKLET_URL), 'g'), "about:blank")
2187
+ // Higher timeout since translation might take a while if additional HTTP requests are made
2188
+ Zotero.Connector.callMethod({method: "savePage", timeout: 60*1000}, {
2189
+ sessionID: this._sessionID,
2190
+ uri: this.location.toString(),
2191
+ translatorID: (typeof this.translator[0] === "object"
2192
+ ? this.translator[0].translatorID : this.translator[0]),
2193
+ cookie: this.document.cookie,
2194
+ proxy: this._proxy ? this._proxy.toJSON() : null,
2195
+ html
2196
+ }).then(me._translateRPCComplete.bind(me), me._translateRPCComplete.bind(me, null));
2197
+ } else if(runMode === Zotero.Translator.RUN_MODE_ZOTERO_SERVER) {
2198
+ var me = this;
2199
+ Zotero.API.createItem({"url":this.document.location.href.toString()}).then(function(response) {
2200
+ me._translateServerComplete(201, response);
2201
+ }, function(error) {
2202
+ me._translateServerComplete(error.status, error.responseText);
2203
+ });
2204
+ }
2205
+ }
2206
+
2207
+ /**
2208
+ * Called when an call to Zotero Standalone for translation completes
2209
+ */
2210
+ Zotero.Translate.Web.prototype._translateRPCComplete = async function(obj, failureCode) {
2211
+ if(!obj) return this.complete(false, failureCode);
2212
+
2213
+ if(obj.selectItems) {
2214
+ // if we have to select items, call the selectItems handler and do it
2215
+ var me = this;
2216
+ this._runHandler("select", obj.selectItems,
2217
+ function(selectedItems) {
2218
+ Zotero.Connector.callMethod("selectItems",
2219
+ {"instanceID":obj.instanceID, "selectedItems":selectedItems})
2220
+ .then((obj) => me._translateRPCComplete(obj))
2221
+ }
2222
+ );
2223
+ } else {
2224
+ // if we don't have to select items, continue
2225
+ for(var i=0, n=obj.items.length; i<n; i++) {
2226
+ this._runHandler("itemDone", null, obj.items[i]);
2227
+ }
2228
+ this.newItems = obj.items;
2229
+ let itemSaver = new Zotero.Translate.ItemSaver({
2230
+ libraryID: this._libraryID,
2231
+ collections: this._collections,
2232
+ attachmentMode: Zotero.Translate.ItemSaver[(this._saveAttachments ? "ATTACHMENT_MODE_DOWNLOAD" : "ATTACHMENT_MODE_IGNORE")],
2233
+ forceTagType: 1,
2234
+ sessionID: this._sessionID,
2235
+ cookieSandbox: this._cookieSandbox,
2236
+ proxy: this._proxy,
2237
+ baseURI: this.location
2238
+ });
2239
+ await itemSaver._pollForProgress(obj.items, this._runHandler.bind(this, 'attachmentProgress'));
2240
+ this.complete(true);
2241
+ }
2242
+ }
2243
+
2244
+ /**
2245
+ * Called when an call to the Zotero Translator Server for translation completes
2246
+ */
2247
+ Zotero.Translate.Web.prototype._translateServerComplete = function(statusCode, response) {
2248
+ if(statusCode === 300) {
2249
+ // Multiple Choices
2250
+ try {
2251
+ response = JSON.parse(response);
2252
+ } catch(e) {
2253
+ Zotero.logError(e);
2254
+ this.complete(false, "Invalid JSON response received from server");
2255
+ return;
2256
+ }
2257
+ var me = this;
2258
+ this._runHandler("select", response.items,
2259
+ function(selectedItems) {
2260
+ Zotero.API.createItem({
2261
+ url: me.document.location.href.toString(),
2262
+ items: selectedItems,
2263
+ token: response.token
2264
+ }).then(function(response) {
2265
+ me._translateServerComplete(201, response);
2266
+ }, function(error) {
2267
+ me._translateServerComplete(error.status, error.responseText);
2268
+ });
2269
+ }
2270
+ );
2271
+ } else if(statusCode === 201) {
2272
+ // Created
2273
+ try {
2274
+ response = JSON.parse(response);
2275
+ } catch(e) {
2276
+ Zotero.logError(e);
2277
+ this.complete(false, "Invalid JSON response received from server");
2278
+ return;
2279
+ }
2280
+
2281
+ let items = [];
2282
+ for (let key in response.successful) {
2283
+ var item = response.successful[key].data;
2284
+
2285
+ if(!("attachments" in item)) item.attachments = [];
2286
+ this._runHandler("itemDone", null, item);
2287
+ items.push(item);
2288
+ }
2289
+ this.newItems = items;
2290
+ this._runHandler("itemsDone", null, item);
2291
+ this.complete(true);
2292
+ } else {
2293
+ this.complete(false, response);
2294
+ }
2295
+ }
2296
+
2297
+ /**
2298
+ * Overload complete to report translation failure
2299
+ */
2300
+ Zotero.Translate.Web.prototype.complete = async function(returnValue, error) {
2301
+ // call super
2302
+ var oldState = this._currentState;
2303
+ var errorString = Zotero.Translate.Base.prototype.complete.apply(this, [returnValue, error]);
2304
+
2305
+ var promise;
2306
+ if (Zotero.Prefs.getAsync) {
2307
+ promise = Zotero.Prefs.getAsync('reportTranslationFailure');
2308
+ } else {
2309
+ promise = Zotero.Promise.resolve(Zotero.Prefs.get("reportTranslationFailure"));
2310
+ }
2311
+ var reportTranslationFailure = await promise;
2312
+ // Report translation failure if we failed
2313
+ if(oldState == "translate" && errorString && !this._parentTranslator && this.translator.length
2314
+ && this.translator[0].inRepository && reportTranslationFailure) {
2315
+ // Don't report failure if in private browsing mode
2316
+ if (Zotero.isConnector && !Zotero.isBookmarklet && await Zotero.Connector_Browser.isIncognito()) {
2317
+ return
2318
+ }
2319
+
2320
+ var translator = this.translator[0];
2321
+ var info = await Zotero.getSystemInfo();
2322
+
2323
+ var postBody = "id=" + encodeURIComponent(translator.translatorID) +
2324
+ "&lastUpdated=" + encodeURIComponent(translator.lastUpdated) +
2325
+ "&diagnostic=" + encodeURIComponent(info) +
2326
+ "&errorData=" + encodeURIComponent(errorString);
2327
+ return Zotero.HTTP.doPost(ZOTERO_CONFIG.REPOSITORY_URL + "report", postBody);
2328
+ }
2329
+ }
2330
+
2331
+ /**
2332
+ * @class Import translation
2333
+ */
2334
+ Zotero.Translate.Import = function() {
2335
+ this.init();
2336
+ }
2337
+ Zotero.Translate.Import.prototype = new Zotero.Translate.Base();
2338
+ Zotero.Translate.Import.prototype.type = "import";
2339
+ Zotero.Translate.Import.prototype._entryFunctionSuffix = "Import";
2340
+ Zotero.Translate.Import.prototype._io = false;
2341
+
2342
+ Zotero.Translate.Import.prototype.Sandbox = Zotero.Translate.Sandbox._inheritFromBase(Zotero.Translate.Sandbox.Import);
2343
+
2344
+ /**
2345
+ * Sets string for translation and initializes string IO
2346
+ */
2347
+ Zotero.Translate.Import.prototype.setString = function(string) {
2348
+ this._string = string;
2349
+ this._io = false;
2350
+ }
2351
+
2352
+ /**
2353
+ * Overload {@link Zotero.Translate.Base#complete} to close file
2354
+ */
2355
+ Zotero.Translate.Import.prototype.complete = function(returnValue, error) {
2356
+ if(this._io) {
2357
+ this._progress = null;
2358
+ this._io.close(false);
2359
+ }
2360
+
2361
+ // call super
2362
+ Zotero.Translate.Base.prototype.complete.apply(this, [returnValue, error]);
2363
+ }
2364
+
2365
+ /**
2366
+ * Get all potential import translators, ordering translators with the right file extension first
2367
+ */
2368
+ Zotero.Translate.Import.prototype._getTranslatorsGetPotentialTranslators = async function () {
2369
+ var translators = await (this.location
2370
+ ? this._translatorProvider.getImportTranslatorsForLocation(this.location)
2371
+ : this._translatorProvider.getAllForType(this.type));
2372
+ return [translators];
2373
+ }
2374
+
2375
+ /**
2376
+ * Overload {@link Zotero.Translate.Base#getTranslators} to return all translators immediately only
2377
+ * if no string or location is set
2378
+ */
2379
+ Zotero.Translate.Import.prototype.getTranslators = function() {
2380
+ if(!this._string && !this.location) {
2381
+ if(this._currentState === "detect") throw new Error("getTranslators: detection is already running");
2382
+ this._currentState = "detect";
2383
+ var me = this;
2384
+ return this._translatorProvider.getAllForType(this.type).
2385
+ then(function(translators) {
2386
+ me._potentialTranslators = [];
2387
+ me._foundTranslators = translators;
2388
+ me.complete(true);
2389
+ return me._foundTranslators;
2390
+ });
2391
+ } else {
2392
+ return Zotero.Translate.Base.prototype.getTranslators.call(this);
2393
+ }
2394
+ }
2395
+
2396
+ /**
2397
+ * Overload {@link Zotero.Translate.Base#_loadTranslator} to prepare translator IO
2398
+ */
2399
+ Zotero.Translate.Import.prototype._loadTranslator = function(translator) {
2400
+ return Zotero.Translate.Base.prototype._loadTranslator.call(this, translator)
2401
+ .then(function() {
2402
+ return this._loadTranslatorPrepareIO(translator);
2403
+ }.bind(this));
2404
+ }
2405
+
2406
+ /**
2407
+ * Prepare translator IO
2408
+ */
2409
+ Zotero.Translate.Import.prototype._loadTranslatorPrepareIO = Zotero.Promise.method(function (translator) {
2410
+ var configOptions = this._translatorInfo.configOptions;
2411
+ var dataMode = configOptions ? configOptions["dataMode"] : "";
2412
+
2413
+ if(!this._io) {
2414
+ if(Zotero.Translate.IO.Read && this.location && this.location instanceof Components.interfaces.nsIFile) {
2415
+ this._io = new Zotero.Translate.IO.Read(this.location, this._sandboxManager);
2416
+ } else {
2417
+ this._io = new Zotero.Translate.IO.String(this._string, this.path ? this.path : "", this._sandboxManager);
2418
+ }
2419
+ }
2420
+
2421
+ this._io.init(dataMode);
2422
+ this._sandboxManager.importObject(this._io);
2423
+ });
2424
+
2425
+ /**
2426
+ * Prepare translation
2427
+ */
2428
+ Zotero.Translate.Import.prototype._prepareTranslation = Zotero.Promise.method(function () {
2429
+ this._progress = undefined;
2430
+
2431
+ var baseURI = null;
2432
+ if(this.location) {
2433
+ try {
2434
+ baseURI = Components.classes["@mozilla.org/network/io-service;1"].
2435
+ getService(Components.interfaces.nsIIOService).newFileURI(this.location);
2436
+ } catch(e) {}
2437
+ }
2438
+
2439
+ this._itemSaver = new Zotero.Translate.ItemSaver({
2440
+ libraryID: this._libraryID,
2441
+ collections: this._collections,
2442
+ forceTagType: this._forceTagType,
2443
+ attachmentMode: Zotero.Translate.ItemSaver[(this._saveAttachments ? "ATTACHMENT_MODE_FILE" : "ATTACHMENT_MODE_IGNORE")],
2444
+ linkFiles: this._linkFiles,
2445
+ baseURI,
2446
+ saveOptions: Object.assign(
2447
+ {
2448
+ skipSelect: true
2449
+ },
2450
+ this._saveOptions || {}
2451
+ )
2452
+ });
2453
+ this.newItems = [];
2454
+ this.newCollections = [];
2455
+ });
2456
+
2457
+ /**
2458
+ * Return the progress of the import operation, or null if progress cannot be determined
2459
+ */
2460
+ Zotero.Translate.Import.prototype.getProgress = function() {
2461
+ if(this._progress !== undefined) return this._progress;
2462
+ if(Zotero.Translate.IO.rdfDataModes.indexOf(this._mode) !== -1 || this._mode === "xml/e4x" || this._mode == "xml/dom" || !this._io) {
2463
+ return null;
2464
+ }
2465
+ return this._io.bytesRead/this._io.contentLength*100;
2466
+ };
2467
+
2468
+
2469
+ /**
2470
+ * @class Export translation
2471
+ */
2472
+ Zotero.Translate.Export = function() {
2473
+ this.init();
2474
+ }
2475
+ Zotero.Translate.Export.prototype = new Zotero.Translate.Base();
2476
+ Zotero.Translate.Export.prototype.type = "export";
2477
+ Zotero.Translate.Export.prototype._entryFunctionSuffix = "Export";
2478
+ Zotero.Translate.Export.prototype.Sandbox = Zotero.Translate.Sandbox._inheritFromBase(Zotero.Translate.Sandbox.Export);
2479
+
2480
+ /**
2481
+ * Sets the items to be exported
2482
+ * @param {Zotero.Item[]} items
2483
+ */
2484
+ Zotero.Translate.Export.prototype.setItems = function(items) {
2485
+ this._export = {type: 'items', items: items};
2486
+ }
2487
+
2488
+ /**
2489
+ * Sets the group to be exported (overrides setItems/setCollection)
2490
+ * @param {Zotero.Group[]} group
2491
+ */
2492
+ Zotero.Translate.Export.prototype.setLibraryID = function(libraryID) {
2493
+ this._export = {type: 'library', id: libraryID};
2494
+ }
2495
+
2496
+ /**
2497
+ * Sets the collection to be exported (overrides setItems/setGroup)
2498
+ * @param {Zotero.Collection[]} collection
2499
+ */
2500
+ Zotero.Translate.Export.prototype.setCollection = function(collection) {
2501
+ this._export = {type: 'collection', collection: collection};
2502
+ }
2503
+
2504
+ /**
2505
+ * Sets the translator to be used for export
2506
+ *
2507
+ * @param {Zotero.Translator|string} Translator object or ID. If this contains a displayOptions
2508
+ * attribute, setDisplayOptions is automatically called with the specified value.
2509
+ */
2510
+ Zotero.Translate.Export.prototype.setTranslator = function(translator) {
2511
+ if(typeof translator == "object" && translator.displayOptions) {
2512
+ this._displayOptions = translator.displayOptions;
2513
+ }
2514
+ return Zotero.Translate.Base.prototype.setTranslator.apply(this, [translator]);
2515
+ }
2516
+
2517
+ /**
2518
+ * Sets translator display options. you can also pass a translator (not ID) to
2519
+ * setTranslator that includes a displayOptions argument
2520
+ */
2521
+ Zotero.Translate.Export.prototype.setDisplayOptions = function(displayOptions) {
2522
+ this._displayOptions = displayOptions;
2523
+ }
2524
+
2525
+ /**
2526
+ * Overload {@link Zotero.Translate.Base#complete} to close file and set complete
2527
+ */
2528
+ Zotero.Translate.Export.prototype.complete = function(returnValue, error) {
2529
+ if(this._io) {
2530
+ this._progress = null;
2531
+ this._io.close(true);
2532
+ if(this._io instanceof Zotero.Translate.IO.String) {
2533
+ this.string = this._io.string;
2534
+ }
2535
+ }
2536
+
2537
+ // call super
2538
+ Zotero.Translate.Base.prototype.complete.apply(this, [returnValue, error]);
2539
+ }
2540
+
2541
+ /**
2542
+ * Overload {@link Zotero.Translate.Base#getTranslators} to return all translators immediately
2543
+ */
2544
+ Zotero.Translate.Export.prototype.getTranslators = function() {
2545
+ if(this._currentState === "detect") {
2546
+ return Zotero.Promise.reject(new Error("getTranslators: detection is already running"));
2547
+ }
2548
+ var me = this;
2549
+ return this._translatorProvider.getAllForType(this.type).then(function(translators) {
2550
+ me._currentState = "detect";
2551
+ me._foundTranslators = translators;
2552
+ me._potentialTranslators = [];
2553
+ me.complete(true);
2554
+ return me._foundTranslators;
2555
+ });
2556
+ }
2557
+
2558
+ /**
2559
+ * Does the actual export, after code has been loaded and parsed
2560
+ */
2561
+ Zotero.Translate.Export.prototype._prepareTranslation = Zotero.Promise.method(function () {
2562
+ this._progress = undefined;
2563
+
2564
+ // initialize ItemGetter
2565
+ this._itemGetter = new Zotero.Translate.ItemGetter();
2566
+
2567
+ // Toggle legacy mode for translators pre-4.0.27
2568
+ this._itemGetter.legacy = Zotero.Utilities.semverCompare('4.0.27', this._translatorInfo.minVersion) > 0;
2569
+
2570
+ var configOptions = this._translatorInfo.configOptions || {},
2571
+ getCollections = configOptions.getCollections || false;
2572
+ var loadPromise = Zotero.Promise.resolve();
2573
+ switch (this._export.type) {
2574
+ case 'collection':
2575
+ this._itemGetter.setCollection(this._export.collection, getCollections);
2576
+ break;
2577
+ case 'items':
2578
+ this._itemGetter.setItems(this._export.items);
2579
+ break;
2580
+ case 'library':
2581
+ loadPromise = this._itemGetter.setAll(this._export.id, getCollections);
2582
+ break;
2583
+ default:
2584
+ throw new Error('No export set up');
2585
+ break;
2586
+ }
2587
+ delete this._export;
2588
+
2589
+ if (this.noWait) {
2590
+ if (!loadPromise.isResolved()) {
2591
+ throw new Error("Load promise is not resolved in noWait mode");
2592
+ }
2593
+ rest.apply(this, arguments);
2594
+ } else {
2595
+ return loadPromise.then(() => rest.apply(this, arguments))
2596
+ }
2597
+
2598
+ function rest() {
2599
+ // export file data, if requested
2600
+ if (this._displayOptions.exportFileData) {
2601
+ this.location = this._itemGetter.exportFiles(
2602
+ this.location,
2603
+ this.translator[0].target,
2604
+ {
2605
+ includeAnnotations: this._displayOptions.includeAnnotations
2606
+ }
2607
+ );
2608
+ }
2609
+
2610
+ // initialize IO
2611
+ // this is currently hackish since we pass null callbacks to the init function (they have
2612
+ // callbacks to be consistent with import, but they are synchronous, so we ignore them)
2613
+ if(!this.location) {
2614
+ this._io = new Zotero.Translate.IO.String(null, this.path ? this.path : "", this._sandboxManager);
2615
+ this._io.init(configOptions["dataMode"], function() {});
2616
+ } else if(!Zotero.Translate.IO.Write) {
2617
+ throw new Error("Writing to files is not supported in this build of Zotero.");
2618
+ } else {
2619
+ this._io = new Zotero.Translate.IO.Write(this.location);
2620
+ this._io.init(configOptions["dataMode"],
2621
+ this._displayOptions["exportCharset"] ? this._displayOptions["exportCharset"] : null,
2622
+ function() {});
2623
+
2624
+ // For the Note Markdown translator, replace the zotero:// URI scheme in the output if
2625
+ // not the official Zotero app
2626
+ if (this.translator.translatorID == '1412e9e2-51e1-42ec-aa35-e036a895534b'
2627
+ && ZOTERO_CONFIG.ID != 'zotero') {
2628
+ this._io.setDataProcessor((data) => {
2629
+ return data.replace(/zotero:\/\//g, ZOTERO_CONFIG.ID + '://');
2630
+ });
2631
+ }
2632
+ }
2633
+
2634
+ this._sandboxManager.importObject(this._io);
2635
+ }
2636
+ });
2637
+
2638
+ /**
2639
+ * Overload Zotero.Translate.Base#translate to make sure that
2640
+ * Zotero.Translate.Export#translate is not called without setting a
2641
+ * translator first. Doesn't make sense to run detection for export.
2642
+ */
2643
+ Zotero.Translate.Export.prototype.translate = function() {
2644
+ if(!this.translator || !this.translator.length) {
2645
+ this.complete(false, new Error("Export translation initiated without setting a translator"));
2646
+ } else {
2647
+ return Zotero.Translate.Base.prototype.translate.apply(this, arguments);
2648
+ }
2649
+ };
2650
+
2651
+ /**
2652
+ * Return the progress of the import operation, or null if progress cannot be determined
2653
+ */
2654
+ Zotero.Translate.Export.prototype.getProgress = function() {
2655
+ if(this._progress !== undefined) return this._progress;
2656
+ if(!this._itemGetter) {
2657
+ return null;
2658
+ }
2659
+ return (1-this._itemGetter.numItemsRemaining/this._itemGetter.numItems)*100;
2660
+ };
2661
+
2662
+ /**
2663
+ * @class Search translation
2664
+ * @property {Array[]} search Item (in {@link Zotero.Item#serialize} format) to extrapolate data
2665
+ * (set with setSearch)
2666
+ */
2667
+ Zotero.Translate.Search = function() {
2668
+ this.init();
2669
+ };
2670
+ Zotero.Translate.Search.prototype = new Zotero.Translate.Base();
2671
+ Zotero.Translate.Search.prototype.type = "search";
2672
+ Zotero.Translate.Search.prototype._entryFunctionSuffix = "Search";
2673
+ Zotero.Translate.Search.prototype.Sandbox = Zotero.Translate.Sandbox._inheritFromBase(Zotero.Translate.Sandbox.Search);
2674
+ Zotero.Translate.Search.prototype.ERROR_NO_RESULTS = "No items returned from any translator";
2675
+
2676
+ /**
2677
+ * @borrows Zotero.Translate.Web#setCookieSandbox
2678
+ */
2679
+ Zotero.Translate.Search.prototype.setCookieSandbox = Zotero.Translate.Web.prototype.setCookieSandbox;
2680
+
2681
+ /**
2682
+ * Sets the item to be used for searching
2683
+ * @param {Object} item An item, with as many fields as desired, in the format returned by
2684
+ * {@link Zotero.Item#serialize}
2685
+ */
2686
+ Zotero.Translate.Search.prototype.setSearch = function(search) {
2687
+ this.search = search;
2688
+ }
2689
+
2690
+ /**
2691
+ * Set an identifier to use for searching
2692
+ *
2693
+ * @param {Object} identifier - An object with 'DOI', 'ISBN', or 'PMID'
2694
+ */
2695
+ Zotero.Translate.Search.prototype.setIdentifier = function (identifier) {
2696
+ var search;
2697
+ if (identifier.DOI) {
2698
+ search = {
2699
+ itemType: "journalArticle",
2700
+ DOI: identifier.DOI
2701
+ };
2702
+ }
2703
+ else if (identifier.ISBN) {
2704
+ search = {
2705
+ itemType: "book",
2706
+ ISBN: identifier.ISBN
2707
+ };
2708
+ }
2709
+ else if (identifier.PMID) {
2710
+ search = {
2711
+ itemType: "journalArticle",
2712
+ contextObject: "rft_id=info:pmid/" + identifier.PMID
2713
+ };
2714
+ }
2715
+ else if (identifier.arXiv) {
2716
+ search = {
2717
+ itemType: "journalArticle",
2718
+ arXiv: identifier.arXiv
2719
+ };
2720
+ }
2721
+ else if (identifier.adsBibcode) {
2722
+ search = {
2723
+ itemType: "journalArticle",
2724
+ adsBibcode: identifier.adsBibcode
2725
+ };
2726
+ }
2727
+ else {
2728
+ throw new Error("Unrecognized identifier");
2729
+ }
2730
+ this.setSearch(search);
2731
+ }
2732
+
2733
+ /**
2734
+ * Overloads {@link Zotero.Translate.Base#getTranslators} to always return all potential translators
2735
+ */
2736
+ Zotero.Translate.Search.prototype.getTranslators = function() {
2737
+ return Zotero.Translate.Base.prototype.getTranslators.call(this, true);
2738
+ }
2739
+
2740
+ /**
2741
+ * Overload Zotero.Translate.Base#complete to move onto the next translator if
2742
+ * translation fails
2743
+ */
2744
+ Zotero.Translate.Search.prototype.complete = function(returnValue, error) {
2745
+ if(this._currentState == "translate"
2746
+ && (!this.newItems || !this.newItems.length)
2747
+ && !this._savingItems
2748
+ //length is 0 only when translate was called without translators
2749
+ && this.translator.length) {
2750
+ Zotero.debug("Translate: Could not find a result using " + this.translator[0].label
2751
+ + (this.translator.length > 1 ? " -- trying next translator" : ""), 3);
2752
+ if(error) Zotero.debug(this._generateErrorString(error), 3);
2753
+ if(this.translator.length > 1) {
2754
+ this.translator.shift();
2755
+ // reset async processes and propagate them to parent
2756
+ if(this._parentTranslator && this._runningAsyncProcesses) {
2757
+ this._parentTranslator.decrementAsyncProcesses("Zotero.Translate.Search#complete", this._runningAsyncProcesses);
2758
+ }
2759
+ this._runningAsyncProcesses = 0;
2760
+ this.translate({
2761
+ libraryID: this._libraryID,
2762
+ saveAttachments: this._saveAttachments,
2763
+ collections: this._collections
2764
+ });
2765
+ return;
2766
+ } else {
2767
+ Zotero.debug("No more translators to try");
2768
+ error = this.ERROR_NO_RESULTS;
2769
+ returnValue = false;
2770
+ }
2771
+ }
2772
+
2773
+ // call super
2774
+ Zotero.Translate.Base.prototype.complete.apply(this, [returnValue, error]);
2775
+ }
2776
+
2777
+ /**
2778
+ * Pass search item to detect* and do* functions
2779
+ */
2780
+ Zotero.Translate.Search.prototype._getParameters = function() {
2781
+ return [this.search];
2782
+ };
2783
+
2784
+ /**
2785
+ * Extract sandbox location from translator target
2786
+ */
2787
+ Zotero.Translate.Search.prototype._getSandboxLocation = function() {
2788
+ // generate sandbox for search by extracting domain from translator target
2789
+ if(this.translator && this.translator[0] && this.translator[0].target) {
2790
+ // so that web translators work too
2791
+ const searchSandboxRe = /^http:\/\/[\w.]+\//;
2792
+ var tempURL = this.translator[0].target.replace(/\\/g, "").replace(/\^/g, "");
2793
+ var m = searchSandboxRe.exec(tempURL);
2794
+ if(m) return m[0];
2795
+ }
2796
+ return Zotero.Translate.Base.prototype._getSandboxLocation.call(this);
2797
+ }
2798
+
2799
+ Zotero.Translate.Search.prototype._prepareTranslation = Zotero.Translate.Web.prototype._prepareTranslation;
2800
+
2801
+ /**
2802
+ * IO-related functions
2803
+ * @namespace
2804
+ */
2805
+ Zotero.Translate.IO = {
2806
+ /**
2807
+ * Parses XML using DOMParser
2808
+ */
2809
+ "parseDOMXML":function(input, charset, size) {
2810
+ try {
2811
+ var dp = new DOMParser();
2812
+ } catch(e) {
2813
+ try {
2814
+ var dp = Components.classes["@mozilla.org/xmlextras/domparser;1"]
2815
+ .createInstance(Components.interfaces.nsIDOMParser);
2816
+ } catch(e) {
2817
+ throw new Error("DOMParser not supported");
2818
+ }
2819
+ }
2820
+
2821
+ if(typeof input == "string") {
2822
+ var nodes = dp.parseFromString(input, "text/xml");
2823
+ } else {
2824
+ var nodes = dp.parseFromStream(input, charset, size, "text/xml");
2825
+ }
2826
+
2827
+ if(nodes.getElementsByTagName("parsererror").length) {
2828
+ throw new Error("DOMParser error: loading data into data store failed");
2829
+ }
2830
+
2831
+ if("normalize" in nodes) nodes.normalize();
2832
+
2833
+ return nodes;
2834
+ },
2835
+
2836
+ /**
2837
+ * Names of RDF data modes
2838
+ */
2839
+ "rdfDataModes":["rdf", "rdf/xml", "rdf/n3"]
2840
+ };
2841
+
2842
+ /******* String support *******/
2843
+
2844
+ /**
2845
+ * @class Translate backend for translating from a string
2846
+ */
2847
+ Zotero.Translate.IO.String = function(string, uri, sandboxManager) {
2848
+ if(string && typeof string === "string") {
2849
+ this.string = string;
2850
+ } else {
2851
+ this.string = "";
2852
+ }
2853
+ this.contentLength = this.string.length;
2854
+ this.bytesRead = 0;
2855
+ this._uri = uri;
2856
+ this._sandboxManager = sandboxManager;
2857
+ }
2858
+
2859
+ Zotero.Translate.IO.String.prototype = {
2860
+ "__exposedProps__":{
2861
+ "RDF":"r",
2862
+ "read":"r",
2863
+ "write":"r",
2864
+ "setCharacterSet":"r",
2865
+ "getXML":"r"
2866
+ },
2867
+
2868
+ "_initRDF": function () {
2869
+ Zotero.debug("Translate: Initializing RDF data store");
2870
+ this._dataStore = new Zotero.RDF.AJAW.IndexedFormula();
2871
+ this.RDF = new Zotero.Translate.IO._RDFSandbox(this._dataStore);
2872
+
2873
+ if(this.contentLength) {
2874
+ try {
2875
+ var xml = Zotero.Translate.IO.parseDOMXML(this.string);
2876
+ } catch(e) {
2877
+ this._xmlInvalid = true;
2878
+ throw e;
2879
+ }
2880
+ var parser = new Zotero.RDF.AJAW.RDFParser(this._dataStore);
2881
+ parser.parse(xml, this._uri);
2882
+ }
2883
+ },
2884
+
2885
+ "setCharacterSet":function(charset) {},
2886
+
2887
+ "read":function(bytes) {
2888
+ // if we are reading in RDF data mode and no string is set, serialize current RDF to the
2889
+ // string
2890
+ if(Zotero.Translate.IO.rdfDataModes.indexOf(this._mode) !== -1 && this.string === "") {
2891
+ this.string = this.RDF.serialize();
2892
+ }
2893
+
2894
+ // return false if string has been read
2895
+ if(this.bytesRead >= this.contentLength) {
2896
+ return false;
2897
+ }
2898
+
2899
+ if(bytes !== undefined) {
2900
+ if(this.bytesRead >= this.contentLength) return false;
2901
+ var oldPointer = this.bytesRead;
2902
+ this.bytesRead += bytes;
2903
+ return this.string.substr(oldPointer, bytes);
2904
+ } else {
2905
+ // bytes not specified; read a line
2906
+ var oldPointer = this.bytesRead;
2907
+ var lfIndex = this.string.indexOf("\n", this.bytesRead);
2908
+
2909
+ if(lfIndex !== -1) {
2910
+ // in case we have a CRLF
2911
+ this.bytesRead = lfIndex+1;
2912
+ if(this.contentLength > lfIndex && this.string.substr(lfIndex-1, 1) === "\r") {
2913
+ lfIndex--;
2914
+ }
2915
+ return this.string.substr(oldPointer, lfIndex-oldPointer);
2916
+ }
2917
+
2918
+ if(!this._noCR) {
2919
+ var crIndex = this.string.indexOf("\r", this.bytesRead);
2920
+ if(crIndex === -1) {
2921
+ this._noCR = true;
2922
+ } else {
2923
+ this.bytesRead = crIndex+1;
2924
+ return this.string.substr(oldPointer, crIndex-oldPointer-1);
2925
+ }
2926
+ }
2927
+
2928
+ this.bytesRead = this.contentLength;
2929
+ return this.string.substr(oldPointer);
2930
+ }
2931
+ },
2932
+
2933
+ "write":function(data) {
2934
+ this.string += data;
2935
+ this.contentLength = this.string.length;
2936
+ },
2937
+
2938
+ "getXML":function() {
2939
+ try {
2940
+ var xml = Zotero.Translate.IO.parseDOMXML(this.string);
2941
+ } catch(e) {
2942
+ this._xmlInvalid = true;
2943
+ throw e;
2944
+ }
2945
+ return xml;
2946
+ },
2947
+
2948
+ init: function (newMode) {
2949
+ this.bytesRead = 0;
2950
+ this._noCR = undefined;
2951
+
2952
+ this._mode = newMode;
2953
+ if(newMode === "xml/e4x") {
2954
+ throw new Error("E4X is not supported");
2955
+ } else if(newMode && (Zotero.Translate.IO.rdfDataModes.indexOf(newMode) !== -1
2956
+ || newMode.substr(0, 3) === "xml/dom") && this._xmlInvalid) {
2957
+ throw new Error("XML known invalid");
2958
+ } else if(Zotero.Translate.IO.rdfDataModes.indexOf(this._mode) !== -1) {
2959
+ this._initRDF();
2960
+ }
2961
+ },
2962
+
2963
+ "close":function(serialize) {
2964
+ // if we are writing in RDF data mode and no string is set, serialize current RDF to the
2965
+ // string
2966
+ if(serialize && Zotero.Translate.IO.rdfDataModes.indexOf(this._mode) !== -1 && this.string === "") {
2967
+ this.string = this.RDF.serialize();
2968
+ }
2969
+ }
2970
+ }
2971
+
2972
+ /****** RDF DATA MODE ******/
2973
+
2974
+ /**
2975
+ * @class An API for handling RDF from the sandbox. This is exposed to translators as Zotero.RDF.
2976
+ *
2977
+ * @property {Zotero.RDF.AJAW.IndexedFormula} _dataStore
2978
+ * @property {Integer[]} _containerCounts
2979
+ * @param {Zotero.RDF.AJAW.IndexedFormula} dataStore
2980
+ */
2981
+ Zotero.Translate.IO._RDFSandbox = function(dataStore) {
2982
+ this._dataStore = dataStore;
2983
+ }
2984
+
2985
+ Zotero.Translate.IO._RDFSandbox.prototype = {
2986
+ "_containerCounts":[],
2987
+ "__exposedProps__":{
2988
+ "addStatement":"r",
2989
+ "newResource":"r",
2990
+ "newContainer":"r",
2991
+ "addContainerElement":"r",
2992
+ "getContainerElements":"r",
2993
+ "addNamespace":"r",
2994
+ "getAllResources":"r",
2995
+ "getResourceURI":"r",
2996
+ "getArcsIn":"r",
2997
+ "getArcsOut":"r",
2998
+ "getSources":"r",
2999
+ "getTargets":"r",
3000
+ "getStatementsMatching":"r",
3001
+ "serialize":"r"
3002
+ },
3003
+
3004
+ /**
3005
+ * Gets a resource as a Zotero.RDF.AJAW.Symbol, rather than a string
3006
+ * @param {String|Zotero.RDF.AJAW.Symbol} about
3007
+ * @return {Zotero.RDF.AJAW.Symbol}
3008
+ */
3009
+ "_getResource":function(about) {
3010
+ return (typeof about == "object" ? about : new Zotero.RDF.AJAW.Symbol(about));
3011
+ },
3012
+
3013
+ /**
3014
+ * Runs a callback to initialize this RDF store
3015
+ */
3016
+ "_init":function() {
3017
+ if(this._prepFunction) {
3018
+ this._dataStore = this._prepFunction();
3019
+ delete this._prepFunction;
3020
+ }
3021
+ },
3022
+
3023
+ /**
3024
+ * Serializes the current RDF to a string
3025
+ */
3026
+ "serialize":function(dataMode) {
3027
+ var serializer = Zotero.RDF.AJAW.Serializer(this._dataStore);
3028
+
3029
+ for(var prefix in this._dataStore.namespaces) {
3030
+ serializer.suggestPrefix(prefix, this._dataStore.namespaces[prefix]);
3031
+ }
3032
+
3033
+ // serialize in appropriate format
3034
+ if(dataMode == "rdf/n3") {
3035
+ return serializer.statementsToN3(this._dataStore.statements);
3036
+ }
3037
+
3038
+ return serializer.statementsToXML(this._dataStore.statements);
3039
+ },
3040
+
3041
+ /**
3042
+ * Adds an RDF triple
3043
+ * @param {String|Zotero.RDF.AJAW.Symbol} about
3044
+ * @param {String|Zotero.RDF.AJAW.Symbol} relation
3045
+ * @param {String|Zotero.RDF.AJAW.Symbol} value
3046
+ * @param {Boolean} literal Whether value should be treated as a literal (true) or a resource
3047
+ * (false)
3048
+ */
3049
+ "addStatement":function(about, relation, value, literal) {
3050
+ if(about === null || about === undefined) {
3051
+ throw new Error("about must be defined in Zotero.RDF.addStatement");
3052
+ }
3053
+ if(relation === null || relation === undefined) {
3054
+ throw new Error("relation must be defined in Zotero.RDF.addStatement");
3055
+ }
3056
+ if(value === null || value === undefined) {
3057
+ throw new Error("value must be defined in Zotero.RDF.addStatement");
3058
+ }
3059
+
3060
+ if(literal) {
3061
+ // zap chars that Mozilla will mangle
3062
+ value = value.toString().replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, '');
3063
+ } else {
3064
+ value = this._getResource(value);
3065
+ }
3066
+
3067
+ this._dataStore.add(this._getResource(about), this._getResource(relation), value);
3068
+ },
3069
+
3070
+ /**
3071
+ * Creates a new anonymous resource
3072
+ * @return {Zotero.RDF.AJAW.Symbol}
3073
+ */
3074
+ "newResource":function() {
3075
+ return new Zotero.RDF.AJAW.BlankNode();
3076
+ },
3077
+
3078
+ /**
3079
+ * Creates a new container resource
3080
+ * @param {String} type The type of the container ("bag", "seq", or "alt")
3081
+ * @param {String|Zotero.RDF.AJAW.Symbol} about The URI of the resource
3082
+ * @return {Zotero.Translate.RDF.prototype.newContainer
3083
+ */
3084
+ "newContainer":function(type, about) {
3085
+ const rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
3086
+ const containerTypes = {"bag":"Bag", "seq":"Seq", "alt":"Alt"};
3087
+
3088
+ type = type.toLowerCase();
3089
+ if(!containerTypes[type]) {
3090
+ throw new Error("Invalid container type in Zotero.RDF.newContainer");
3091
+ }
3092
+
3093
+ var about = this._getResource(about);
3094
+ this.addStatement(about, rdf+"type", rdf+containerTypes[type], false);
3095
+ this._containerCounts[about.toNT()] = 1;
3096
+
3097
+ return about;
3098
+ },
3099
+
3100
+ /**
3101
+ * Adds a new element to a container
3102
+ * @param {String|Zotero.RDF.AJAW.Symbol} about The container
3103
+ * @param {String|Zotero.RDF.AJAW.Symbol} element The element to add to the container
3104
+ * @param {Boolean} literal Whether element should be treated as a literal (true) or a resource
3105
+ * (false)
3106
+ */
3107
+ "addContainerElement":function(about, element, literal) {
3108
+ const rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
3109
+
3110
+ var about = this._getResource(about);
3111
+ this._dataStore.add(about, new Zotero.RDF.AJAW.Symbol(rdf+"_"+(this._containerCounts[about.toNT()]++)), element, literal);
3112
+ },
3113
+
3114
+ /**
3115
+ * Gets all elements within a container
3116
+ * @param {String|Zotero.RDF.AJAW.Symbol} about The container
3117
+ * @return {Zotero.RDF.AJAW.Symbol[]}
3118
+ */
3119
+ "getContainerElements":function(about) {
3120
+ const liPrefix = "http://www.w3.org/1999/02/22-rdf-syntax-ns#_";
3121
+
3122
+ var about = this._getResource(about);
3123
+ var statements = this._dataStore.statementsMatching(about);
3124
+ var containerElements = [];
3125
+
3126
+ // loop over arcs out looking for list items
3127
+ for(var i=0; i<statements.length; i++) {
3128
+ var statement = statements[i];
3129
+ if(statement.predicate.uri.substr(0, liPrefix.length) == liPrefix) {
3130
+ var number = statement.predicate.uri.substr(liPrefix.length);
3131
+
3132
+ // make sure these are actually numeric list items
3133
+ var intNumber = parseInt(number);
3134
+ if(number == intNumber.toString()) {
3135
+ // add to element array
3136
+ containerElements[intNumber-1] = (statement.object.termType == "literal" ? statement.object.toString() : statement.object);
3137
+ }
3138
+ }
3139
+ }
3140
+
3141
+ return containerElements;
3142
+ },
3143
+
3144
+ /**
3145
+ * Adds a namespace for a specific URI
3146
+ * @param {String} prefix Namespace prefix
3147
+ * @param {String} uri Namespace URI
3148
+ */
3149
+ "addNamespace":function(prefix, uri) {
3150
+ this._dataStore.setPrefixForURI(prefix, uri);
3151
+ },
3152
+
3153
+ /**
3154
+ * Gets the URI a specific resource
3155
+ * @param {String|Zotero.RDF.AJAW.Symbol} resource
3156
+ * @return {String}
3157
+ */
3158
+ "getResourceURI":function(resource) {
3159
+ if(typeof(resource) == "string") return resource;
3160
+
3161
+ if (resource.uri) return resource.uri;
3162
+
3163
+ const rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
3164
+ var values = this.getStatementsMatching(resource, rdf + 'value');
3165
+ if (values && values.length) {
3166
+ return values[0][2];
3167
+ }
3168
+
3169
+ if(resource.toNT == undefined) throw new Error("Zotero.RDF: getResourceURI called on invalid resource");
3170
+ return resource.toNT();
3171
+ },
3172
+
3173
+ /**
3174
+ * Gets all resources in the RDF data store
3175
+ * @return {Zotero.RDF.AJAW.Symbol[]}
3176
+ */
3177
+ "getAllResources":function() {
3178
+ var returnArray = [];
3179
+ for(var i in this._dataStore.subjectIndex) {
3180
+ returnArray.push(this._dataStore.subjectIndex[i][0].subject);
3181
+ }
3182
+ return returnArray;
3183
+ },
3184
+
3185
+ /**
3186
+ * Gets all arcs (predicates) into a resource
3187
+ * @return {Zotero.RDF.AJAW.Symbol[]}
3188
+ * @deprecated Since 2.1. Use {@link Zotero.Translate.IO["rdf"]._RDFBase#getStatementsMatching}
3189
+ */
3190
+ "getArcsIn":function(resource) {
3191
+ var statements = this._dataStore.objectIndex[this._dataStore.canon(this._getResource(resource))];
3192
+ if(!statements) return false;
3193
+
3194
+ var returnArray = [];
3195
+ for(var i=0; i<statements.length; i++) {
3196
+ returnArray.push(statements[i].predicate.uri);
3197
+ }
3198
+ return returnArray;
3199
+ },
3200
+
3201
+ /**
3202
+ * Gets all arcs (predicates) out of a resource
3203
+ * @return {Zotero.RDF.AJAW.Symbol[]}
3204
+ * @deprecated Since 2.1. Use {@link Zotero.Translate.IO["rdf"]._RDFBase#getStatementsMatching}
3205
+ */
3206
+ "getArcsOut":function(resource) {
3207
+ var statements = this._dataStore.subjectIndex[this._dataStore.canon(this._getResource(resource))];
3208
+ if(!statements) return false;
3209
+
3210
+ var returnArray = [];
3211
+ for(var i=0; i<statements.length; i++) {
3212
+ returnArray.push(statements[i].predicate.uri);
3213
+ }
3214
+ return returnArray;
3215
+ },
3216
+
3217
+ /**
3218
+ * Gets all subjects whose predicates point to a resource
3219
+ * @param {String|Zotero.RDF.AJAW.Symbol} resource Subject that predicates should point to
3220
+ * @param {String|Zotero.RDF.AJAW.Symbol} property Predicate
3221
+ * @return {Zotero.RDF.AJAW.Symbol[]}
3222
+ * @deprecated Since 2.1. Use {@link Zotero.Translate.IO["rdf"]._RDFBase#getStatementsMatching}
3223
+ */
3224
+ "getSources":function(resource, property) {
3225
+ var statements = this._dataStore.statementsMatching(undefined, this._getResource(property), this._getResource(resource));
3226
+ if(!statements.length) return false;
3227
+
3228
+ var returnArray = [];
3229
+ for(var i=0; i<statements.length; i++) {
3230
+ returnArray.push(statements[i].subject);
3231
+ }
3232
+ return returnArray;
3233
+ },
3234
+
3235
+ /**
3236
+ * Gets all objects of a given subject with a given predicate
3237
+ * @param {String|Zotero.RDF.AJAW.Symbol} resource Subject
3238
+ * @param {String|Zotero.RDF.AJAW.Symbol} property Predicate
3239
+ * @return {Zotero.RDF.AJAW.Symbol[]}
3240
+ * @deprecated Since 2.1. Use {@link Zotero.Translate.IO["rdf"]._RDFBase#getStatementsMatching}
3241
+ */
3242
+ "getTargets":function(resource, property) {
3243
+ var statements = this._dataStore.statementsMatching(this._getResource(resource), this._getResource(property));
3244
+ if(!statements.length) return false;
3245
+
3246
+ var returnArray = [];
3247
+ for(var i=0; i<statements.length; i++) {
3248
+ returnArray.push(statements[i].object.termType == "literal" ? statements[i].object.toString() : statements[i].object);
3249
+ }
3250
+ return returnArray;
3251
+ },
3252
+
3253
+ /**
3254
+ * Gets statements matching a certain pattern
3255
+ *
3256
+ * @param {String|Zotero.RDF.AJAW.Symbol} subj Subject
3257
+ * @param {String|Zotero.RDF.AJAW.Symbol} predicate Predicate
3258
+ * @param {String|Zotero.RDF.AJAW.Symbol} obj Object
3259
+ * @param {Boolean} objLiteral Whether the object is a literal (as
3260
+ * opposed to a URI)
3261
+ * @param {Boolean} justOne Whether to stop when a single result is
3262
+ * retrieved
3263
+ */
3264
+ "getStatementsMatching":function(subj, pred, obj, objLiteral, justOne) {
3265
+ var statements = this._dataStore.statementsMatching(
3266
+ (subj ? this._getResource(subj) : undefined),
3267
+ (pred ? this._getResource(pred) : undefined),
3268
+ (obj ? (objLiteral ? objLiteral : this._getResource(obj)) : undefined),
3269
+ undefined, justOne);
3270
+ if(!statements.length) return false;
3271
+
3272
+
3273
+ var returnArray = [];
3274
+ for(var i=0; i<statements.length; i++) {
3275
+ returnArray.push([statements[i].subject, statements[i].predicate, (statements[i].object.termType == "literal" ? statements[i].object.toString() : statements[i].object)]);
3276
+ }
3277
+ return returnArray;
3278
+ }
3279
+ };
3280
+
3281
+ if (typeof process === 'object' && process + '' === '[object process]'){
3282
+ module.exports = Zotero.Translate;
3283
+ }