Aller au contenu

Utilisateur:Poslovitch/RechercheDico.js

La bibliothèque libre.

Note : après avoir enregistré vos modifications, il se peut que vous deviez forcer le rechargement complet du cache de votre navigateur pour voir les changements.

  • Firefox / Safari : Maintenez la touche Maj (Shift) en cliquant sur le bouton Actualiser ou pressez Ctrl-F5 ou Ctrl-R (⌘-R sur un Mac) ;
  • Google Chrome : Appuyez sur Ctrl-Maj-R (⌘-Shift-R sur un Mac) ;
  • Internet Explorer : Maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl-F5 ;
  • Opera : Allez dans Menu → Settings (Opera → Préférences sur un Mac) et ensuite à Confidentialité & sécurité → Effacer les données d'exploration → Images et fichiers en cache.
mw.loader.using( [ 'vue', '@wikimedia/codex', 'pinia' ] ).then( function ( require ) {
self.vue = require( 'vue' );
self.pinia = require( 'pinia' );
self["@wikimedia/codex"] = require('@wikimedia/codex');
const dictionariesIds = [
    'Q19164492',
    'Q19164883',
    'Q60379293',
    'Q105176431',
    'Q117168334',
    'Q54099419',
    'Q19164851',
    'Q15641561',
    'Q19164501',
    'Q117206147',
    'Q19164846',
    'Q20961706',
    'Q19164898',
    'Q117206256',
    'Q19151100',
    'Q24230258',
    'Q117197922',
    'Q84768893',
    'Q42122780',
    'Q117275279',
    'Q19216625',
    'Q118424016',
    'Q106167910',
    'Q120720219',
    'Q118744882',
    'Q19164385',
    'Q118779837',
    'Q20617358'
  ];
const api = new mw.Api();
const subPagesDenylist = [
    'Index alphabétique -'
  ];
// Code de la dicotheque, disponible en clair sur https://gitlab.wikimedia.org/poslovitch/dicotheque
(()=>{"use strict";var e={744:(e,t)=>{t.Z=(e,t)=>{const i=e.__vccOpts||e;for(const[e,a]of t)i[e]=a;return i}}},t={};function i(a){var n=t[a];if(void 0!==n)return n.exports;var o=t[a]={exports:{}};return e[a](o,o.exports,i),o.exports}(()=>{const e=self.vue,t=self.pinia,a={style:{display:"flex","flex-direction":"row"}},n={style:{flex:"1"}},o={style:{flex:"3"}},r={key:2},l={key:3},c={style:{display:"flex","flex-direction":"row"}},s={key:1,style:{display:"flex","flex-direction":"row","flex-wrap":"wrap"}},d={style:{flex:"1"}},u={class:"dctq-searchpanel"},m={class:"dctq-searchresults"},p=self["@wikimedia/codex"],g=(0,t.defineStore)("dicotheque",{state:()=>({word:""})}),k={name:"SearchBar",components:{CdxSearchInput:p.CdxSearchInput,CdxToggleSwitch:p.CdxToggleSwitch},props:{strict:{type:Boolean,required:!0}},emits:["update","toggle-strict"],setup(){const e=g();return{value:e.word,store:e}},methods:{search:function(){this.store.word=this.value,this.$emit("update")}}};var v=i(744);const f=(0,v.Z)(k,[["render",function(t,i,a,n,o,r){const l=(0,e.resolveComponent)("cdx-search-input"),c=(0,e.resolveComponent)("cdx-toggle-switch");return(0,e.openBlock)(),(0,e.createElementBlock)("div",u,[(0,e.createVNode)(l,{modelValue:n.value,"onUpdate:modelValue":i[0]||(i[0]=e=>n.value=e),placeholder:"Entrez votre recherche",clearable:!0,"button-label":"Rechercher",onSubmitClick:r.search},null,8,["modelValue","onSubmitClick"]),(0,e.createElementVNode)("div",m,[(0,e.createVNode)(c,(0,e.mergeProps)(a.strict,{"onUpdate:modelValue":i[1]||(i[1]=e=>t.$emit("toggle-strict"))}),{default:(0,e.withCtx)((()=>[(0,e.createTextVNode)(" Recherche stricte ")])),_:1},16)])])}]]),h={class:"dctq-sidepanel"},y=(0,e.createElementVNode)("span",null,"Filtres",-1),b=(0,e.createElementVNode)("hr",null,null,-1),w=(0,e.createElementVNode)("span",null,"Genres",-1),E=(0,e.createElementVNode)("span",null,"Sujets",-1),x=(0,e.createElementVNode)("span",null,"Langues",-1),B={class:"dctq-selector-item"},N=["checked"],V={key:0,class:"dctq-filter-picker"},S={key:1,class:"dctq-filter-picker dctq-filter-picker-inactive"},C={name:"FilterPickerItem",props:{filter:{type:{name:String,active:Boolean},required:!0},availableCount:{type:Number,required:!0,validator(e){return e<this.count}},count:{type:Number,required:!0}}},D={name:"FiltersSelector",components:{FilterPickerItem:(0,v.Z)(C,[["render",function(t,i,a,n,o,r){return(0,e.openBlock)(),(0,e.createElementBlock)("li",B,[(0,e.createElementVNode)("input",{type:"checkbox",checked:a.filter.active,onClick:i[0]||(i[0]=e=>a.filter.active=!a.filter.active)},null,8,N),0!==a.availableCount?((0,e.openBlock)(),(0,e.createElementBlock)("span",V,(0,e.toDisplayString)(a.filter.name)+" ("+(0,e.toDisplayString)(a.availableCount)+"/"+(0,e.toDisplayString)(a.count)+")",1)):((0,e.openBlock)(),(0,e.createElementBlock)("span",S,(0,e.toDisplayString)(a.filter.name)+" ("+(0,e.toDisplayString)(a.availableCount)+"/"+(0,e.toDisplayString)(a.count)+")",1))])}]])},props:{filters:{type:Object,required:!0},dictionaries:{type:Array,required:!0},availableDictionaries:{type:Array,required:!0}},methods:{getDictionariesCount:function(e,t,i){return e.map(i).filter((e=>e.includes(t.qid))).length},toggleFilters:function(e,t){e.forEach((e=>e.active=t))},orderFilters:function(e,t){return e.sort(((e,i)=>t(e.name,i.name)))},alphabeticalOrder:function(e,t){return"Non précisé"===e||"Non précisée"===e?-1:e.localeCompare(t,"fr")}}},q=(0,v.Z)(D,[["render",function(t,i,a,n,o,r){const l=(0,e.resolveComponent)("filter-picker-item");return(0,e.openBlock)(),(0,e.createElementBlock)("div",h,[y,b,w,(0,e.createElementVNode)("button",{onClick:i[0]||(i[0]=e=>r.toggleFilters(a.filters.genres,!0))}," Tout cocher "),(0,e.createElementVNode)("button",{onClick:i[1]||(i[1]=e=>r.toggleFilters(a.filters.genres,!1))}," Tout décocher "),(0,e.createElementVNode)("ul",null,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(r.orderFilters(a.filters.genres,r.alphabeticalOrder),((t,i)=>((0,e.openBlock)(),(0,e.createBlock)(l,{key:i,filter:t,count:r.getDictionariesCount(a.dictionaries,t,(e=>e.genre)),"available-count":r.getDictionariesCount(a.availableDictionaries,t,(e=>e.genre))},null,8,["filter","count","available-count"])))),128))]),E,(0,e.createElementVNode)("button",{onClick:i[2]||(i[2]=e=>r.toggleFilters(a.filters.subjects,!0))}," Tout cocher "),(0,e.createElementVNode)("button",{onClick:i[3]||(i[3]=e=>r.toggleFilters(a.filters.subjects,!1))}," Tout décocher "),(0,e.createElementVNode)("ul",null,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(r.orderFilters(a.filters.subjects,r.alphabeticalOrder),((t,i)=>((0,e.openBlock)(),(0,e.createBlock)(l,{key:i,filter:t,count:r.getDictionariesCount(a.dictionaries,t,(e=>e.subject)),"available-count":r.getDictionariesCount(a.availableDictionaries,t,(e=>e.subject))},null,8,["filter","count","available-count"])))),128))]),x,(0,e.createElementVNode)("button",{onClick:i[4]||(i[4]=e=>r.toggleFilters(a.filters.languages,!0))}," Tout cocher "),(0,e.createElementVNode)("button",{onClick:i[5]||(i[5]=e=>r.toggleFilters(a.filters.languages,!1))}," Tout décocher "),(0,e.createElementVNode)("ul",null,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(r.orderFilters(a.filters.languages,r.alphabeticalOrder),((t,i)=>((0,e.openBlock)(),(0,e.createBlock)(l,{key:i,filter:t,count:r.getDictionariesCount(a.dictionaries,t,(e=>e.language)),"available-count":r.getDictionariesCount(a.availableDictionaries,t,(e=>e.language))},null,8,["filter","count","available-count"])))),128))])])}]]),j={style:{display:"flex","justify-content":"space-between"}},P=(0,e.createElementVNode)("span",null,"Min",-1),T=(0,e.createElementVNode)("span",null,"Max",-1),Y={style:{display:"flex"}},L={style:{flex:"1"}},M=["min","max"],F=["min","max"],z={id:"dico-timeline-books",style:{height:"15px",position:"relative","margin-left":"3em","margin-right":"3em"}},O=["title"],I={name:"DictionariesTimeline",props:{dictionaries:{type:Array,required:!0}},setup(t){const i=parseInt(t.dictionaries[0].date),a=parseInt(t.dictionaries[t.dictionaries.length-1].date);return{minYear:i,maxYear:a,activeMinYear:(0,e.ref)(i),activeMaxYear:(0,e.ref)(a)}},data:()=>({style:{wrapper:{padding:"1em"},slider:{height:"5px",top:"5px",borderRadius:"5px",background:"#ddd",position:"relative"},activeSlider:{height:"5px",borderRadius:"5px",background:"#608ab4",position:"absolute",left:"0%",right:"0%"},rangeInputWrapper:{position:"relative"},rangeInput:{position:"absolute",height:"5px",borderRadius:"5px",width:"100%",background:"none",appearance:"none",zIndex:"2"},dicoPoint:{position:"absolute",height:"10px",borderRadius:"50%",width:"10px",backgroundColor:"#608ab4"}}}),methods:{onSliderChange:function(e){this.activeMaxYear-this.activeMinYear<=2&&("dico-timeline-range-max"===e.target.id?(this.activeMaxYear=this.activeMinYear+2,e.target.value=this.activeMaxYear):(this.activeMinYear=this.activeMaxYear-2,e.target.value=this.activeMinYear)),this.updateActiveSlider(),this.updateDictionariesAvailability()},updateActiveSlider:function(){this.style.activeSlider.left=(this.activeMinYear-this.minYear)/(this.maxYear-this.minYear)*100+"%",this.style.activeSlider.right=100-(this.activeMaxYear-this.minYear)/(this.maxYear-this.minYear)*100+"%"},updateDictionariesAvailability:function(){for(const e of this.dictionaries){const t=parseInt(e.date);e.available=t>=this.activeMinYear&&t<=this.activeMaxYear}},getPositionForDictionary:function(e){const t={};return t.left=(e.date-this.minYear)/(this.maxYear-this.minYear)*100+"%",e.available||(t.backgroundColor="#ddd"),t}},watch:{activeMinYear:function(){this.updateActiveSlider(),this.updateDictionariesAvailability()},activeMaxYear:function(){this.updateActiveSlider(),this.updateDictionariesAvailability()}}},A=(0,v.Z)(I,[["render",function(t,i,a,n,o,r){return(0,e.openBlock)(),(0,e.createElementBlock)("div",{style:(0,e.normalizeStyle)(t.style.wrapper)},[(0,e.createElementVNode)("div",j,[(0,e.createElementVNode)("div",null,[P,(0,e.withDirectives)((0,e.createElementVNode)("input",{id:"dico-timeline-min","onUpdate:modelValue":i[0]||(i[0]=e=>n.activeMinYear=e),type:"number",style:{"max-width":"4em","-moz-appearance":"textfield"}},null,512),[[e.vModelText,n.activeMinYear]])]),(0,e.createElementVNode)("div",null,[T,(0,e.withDirectives)((0,e.createElementVNode)("input",{id:"dico-timeline-max","onUpdate:modelValue":i[1]||(i[1]=e=>n.activeMaxYear=e),type:"number",style:{"max-width":"4em","-moz-appearance":"textfield"}},null,512),[[e.vModelText,n.activeMaxYear]])])]),(0,e.createElementVNode)("div",Y,[(0,e.createElementVNode)("span",null,(0,e.toDisplayString)(n.minYear),1),(0,e.createElementVNode)("div",L,[(0,e.createElementVNode)("div",{id:"dico-timeline-slider",style:(0,e.normalizeStyle)(t.style.slider)},[(0,e.createElementVNode)("div",{id:"dico-timeline-slider-active",style:(0,e.normalizeStyle)(t.style.activeSlider)},null,4)],4),(0,e.createElementVNode)("div",{id:"dico-timeline-range-input",style:(0,e.normalizeStyle)(t.style.rangeInputWrapper)},[(0,e.withDirectives)((0,e.createElementVNode)("input",{id:"dico-timeline-range-min","onUpdate:modelValue":i[2]||(i[2]=e=>n.activeMinYear=e),type:"range",min:n.minYear,max:n.maxYear,style:(0,e.normalizeStyle)(t.style.rangeInput),onInput:i[3]||(i[3]=e=>r.onSliderChange(e))},null,44,M),[[e.vModelText,n.activeMinYear]]),(0,e.withDirectives)((0,e.createElementVNode)("input",{id:"dico-timeline-range-max","onUpdate:modelValue":i[4]||(i[4]=e=>n.activeMaxYear=e),type:"range",min:n.minYear,max:n.maxYear,style:(0,e.normalizeStyle)(t.style.rangeInput),onInput:i[5]||(i[5]=e=>r.onSliderChange(e))},null,44,F),[[e.vModelText,n.activeMaxYear]])],4)]),(0,e.createElementVNode)("span",null,(0,e.toDisplayString)(n.maxYear),1)]),(0,e.createElementVNode)("div",z,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.dictionaries,(i=>((0,e.openBlock)(),(0,e.createElementBlock)("div",{key:i.wikidata,title:i.title,style:(0,e.normalizeStyle)([t.style.dicoPoint,r.getPositionForDictionary(i)])},null,12,O)))),128))])],4)}]]),_={class:"dctq-sidepanel"},W=(0,e.createElementVNode)("hr",null,null,-1),R={class:"dctq-selector-item"},U={key:0,style:{background:"#ffcba4",padding:"0.5em 1em 0.5em 1em"}},Z=(0,e.createElementVNode)("img",{src:"https://upload.wikimedia.org/wikipedia/commons/4/4c/OOjs_UI_icon_notice-warning.svg"},null,-1),G=["checked"],H={key:1,style:{"text-align":"left"}},$=["href"],J={key:2},K={style:{"text-align":"right","font-size":"0.8em"}},Q=["href"],X={key:0},ee=["href"],te={name:"DictionaryPickerItem",props:{dictionary:{type:Object,required:!0},labels:{type:Object,required:!0}},setup(e){const t=e.dictionary.missing;return{error:0!==t.length,missingValues:t.join(", "),wikidataLink:"https://www.wikidata.org/wiki/"+e.dictionary.wikidata,workWikidataLink:"https://www.wikidata.org/wiki/"+e.dictionary.work,wikisourceLink:"https://fr.wikisource.org/wiki/"+e.dictionary.wikisource}}},ie={name:"DictionariesList",components:{DictionaryPickerItem:(0,v.Z)(te,[["render",function(t,i,a,n,o,r){return(0,e.openBlock)(),(0,e.createElementBlock)("li",R,[n.error?((0,e.openBlock)(),(0,e.createElementBlock)("div",U,[Z,(0,e.createTextVNode)(" Données manquantes : "+(0,e.toDisplayString)(n.missingValues),1)])):(0,e.createCommentVNode)("v-if",!0),(0,e.createElementVNode)("input",{type:"checkbox",checked:a.dictionary.enabled,onClick:i[0]||(i[0]=e=>a.dictionary.enabled=!a.dictionary.enabled)},null,8,G),a.dictionary.title?((0,e.openBlock)(),(0,e.createElementBlock)("span",H,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.dictionary.authors,(t=>((0,e.openBlock)(),(0,e.createElementBlock)("span",null,(0,e.toDisplayString)(t.name?t.name:a.labels[t.qid])+", ",1)))),256)),(0,e.createElementVNode)("a",{rel:"nofollow",target:"_blank",href:n.wikisourceLink},(0,e.toDisplayString)(a.dictionary.title),9,$),(0,e.createTextVNode)(", "),((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.dictionary.publishers,(t=>((0,e.openBlock)(),(0,e.createElementBlock)("span",null,(0,e.toDisplayString)(t.name?t.name:a.labels[t.qid])+", ",1)))),256)),((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.dictionary.publicationPlaces,(t=>((0,e.openBlock)(),(0,e.createElementBlock)("span",null,(0,e.toDisplayString)(a.labels[t.qid])+", ",1)))),256)),(0,e.createTextVNode)(" "+(0,e.toDisplayString)(a.dictionary.date),1)])):((0,e.openBlock)(),(0,e.createElementBlock)("span",J,(0,e.toDisplayString)(a.dictionary.wikidata),1)),(0,e.createElementVNode)("div",K,[(0,e.createTextVNode)(" ("),(0,e.createElementVNode)("a",{class:"external text",rel:"nofollow",target:"_blank",href:n.wikidataLink},"édition",8,Q),a.dictionary.work?((0,e.openBlock)(),(0,e.createElementBlock)("span",X,[(0,e.createTextVNode)(", "),(0,e.createElementVNode)("a",{class:"external text",rel:"nofollow",target:"_blank",href:n.workWikidataLink},"œuvre",8,ee)])):(0,e.createCommentVNode)("v-if",!0),(0,e.createTextVNode)(") ")])])}]])},props:{availableDictionaries:{type:Array,required:!0},labels:{type:Object,required:!0}},methods:{setEnabledForAllDictionaries:function(e){for(const t of this.availableDictionaries)t.enabled=e}}},ae=(0,v.Z)(ie,[["render",function(t,i,a,n,o,r){const l=(0,e.resolveComponent)("dictionary-picker-item");return(0,e.openBlock)(),(0,e.createElementBlock)("div",_,[(0,e.createElementVNode)("span",null,"Dictionnaires ("+(0,e.toDisplayString)(a.availableDictionaries.length)+")",1),(0,e.createElementVNode)("button",{onClick:i[0]||(i[0]=e=>r.setEnabledForAllDictionaries(!0))}," Tout cocher "),(0,e.createElementVNode)("button",{onClick:i[1]||(i[1]=e=>r.setEnabledForAllDictionaries(!1))}," Tout décocher "),W,(0,e.createElementVNode)("ul",null,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(a.availableDictionaries,(t=>((0,e.openBlock)(),(0,e.createBlock)(l,{key:t.wikidata,dictionary:t,labels:a.labels},null,8,["dictionary","labels"])))),128))])])}]]),ne={style:{"min-height":"fit-content","box-shadow":"0 0 0.2em #999999","border-radius":"0.2em",margin:"0.5em 0.5em 1em 0.5em",background:"#f8f9fa"}},oe={style:{background:"#eaecf0","border-radius":"0.2em 0.2em 0 0",padding:"0.5em 1em 0.5em 1em"}},re={style:{color:"#000000","font-weight":"bold"}},le=["href"],ce={key:0,style:{background:"#ffcba4",padding:"0.5em 1em 0.5em 1em"}},se=(0,e.createElementVNode)("img",{src:"https://upload.wikimedia.org/wikipedia/commons/4/4c/OOjs_UI_icon_notice-warning.svg"},null,-1),de={style:{float:"right"}},ue=["href"],me={key:0,style:{position:"absolute",top:"0",left:"0",height:"100%",width:"100%","background-image":"linear-gradient(rgba(96, 138, 180, 0) 85%, rgba(96, 138, 180, 1))","pointer-events":"none"}},pe={style:{display:"flex","justify-content":"space-evenly",background:"#f4f5f6"}},ge={key:0},ke={key:1},ve={key:1},fe={key:1},he=["innerHTML"],ye={style:{float:"right"}},be=["href"],we={key:2,style:{background:"#608ab4"}},Ee={name:"DefinitionCard",props:{pagename:{type:String,required:!0},dictionary:{type:Object,required:!0},wordcount:{type:Number,required:!0}},emits:["go-to-word"],async setup(t){const i={action:"parse",format:"json",page:t.pagename,prop:["text"]},a=g(),n="https://fr.wikisource.org/wiki/"+t.pagename,o="https://fr.wikisource.org/wiki/"+t.dictionary.wikisource;let r="";await new Promise((e=>{api.get(i).done((function(t){r=t.parse.text["*"],e()}))}));const l=(new DOMParser).parseFromString(r,"text/html");let c="",s=!1,d="",u="";const m=(0,e.ref)(t.wordcount>300),p=(0,e.ref)(t.wordcount>300);try{c=l.getElementsByClassName("headertemplate-reference")[0].outerText;const e=l.getElementById("headerprevious");e&&(d=e.childNodes[1].outerText);const t=l.getElementById("headernext");t&&(u=t.childNodes[0].outerText),l.querySelector("div[itemscope]").remove(),r=l.getElementsByClassName("prp-pages-output")[0].innerHTML}catch(e){mw.log.warn("Got an error when parsing: "+t.pagename),mw.log.warn(e),s=!0,r=""}return{store:a,content:r,reference:c,prev:d,next:u,error:s,minimizable:m,minimized:p,wikisourceLink:n,wikisourceTitleLink:o,minimizedCss:{maxHeight:"250px",overflow:"hidden"}}},methods:{minimize:function(){this.minimized=!0},unminimize:function(){this.minimized=!1},goToWord:function(e){this.store.word=e,this.$emit("go-to-word")}}},xe={name:"App",components:{DefinitionCard:(0,v.Z)(Ee,[["render",function(t,i,a,n,o,r){return(0,e.openBlock)(),(0,e.createElementBlock)("div",ne,[(0,e.createElementVNode)("div",oe,[(0,e.createElementVNode)("span",re,[(0,e.createElementVNode)("a",{rel:"nofollow",target:"_blank",href:n.wikisourceTitleLink},[(0,e.createElementVNode)("i",null,(0,e.toDisplayString)(a.dictionary.title),1)],8,le),(0,e.createTextVNode)(", "+(0,e.toDisplayString)(n.reference),1)])]),n.error?((0,e.openBlock)(),(0,e.createElementBlock)("div",ce,[se,(0,e.createTextVNode)(" Une erreur est survenue lors du chargement de cette définition. Cette page utilise probablement une mise en forme obsolète. "),(0,e.createElementVNode)("div",de,[(0,e.createElementVNode)("a",{style:{"font-style":"italic"},rel:"nofollow",target:"_blank",href:n.wikisourceLink},"Voir la page sur Wikisource",8,ue)])])):((0,e.openBlock)(),(0,e.createElementBlock)("div",{key:1,style:(0,e.normalizeStyle)([{position:"relative",padding:"0.5em 1em 0.5em 1em"},n.minimized?[n.minimizedCss]:""])},[n.minimized?((0,e.openBlock)(),(0,e.createElementBlock)("div",me)):(0,e.createCommentVNode)("v-if",!0),(0,e.createElementVNode)("div",pe,[n.prev?((0,e.openBlock)(),(0,e.createElementBlock)("div",ge,[(0,e.createTextVNode)(" ◄ "),n.prev.toLowerCase()!==n.store.word.toLowerCase()?((0,e.openBlock)(),(0,e.createElementBlock)("button",{key:0,onClick:i[0]||(i[0]=e=>r.goToWord(n.prev))},(0,e.toDisplayString)(n.prev),1)):((0,e.openBlock)(),(0,e.createElementBlock)("b",ke,(0,e.toDisplayString)(n.prev),1))])):(0,e.createCommentVNode)("v-if",!0),n.next?((0,e.openBlock)(),(0,e.createElementBlock)("div",ve,[n.next.toLowerCase()!==n.store.word.toLowerCase()?((0,e.openBlock)(),(0,e.createElementBlock)("button",{key:0,onClick:i[1]||(i[1]=e=>r.goToWord(n.next))},(0,e.toDisplayString)(n.next),1)):((0,e.openBlock)(),(0,e.createElementBlock)("b",fe,(0,e.toDisplayString)(n.next),1)),(0,e.createTextVNode)(" ► ")])):(0,e.createCommentVNode)("v-if",!0)]),(0,e.createElementVNode)("div",{innerHTML:n.content},null,8,he),(0,e.createElementVNode)("div",ye,[(0,e.createElementVNode)("a",{style:{"font-style":"italic"},rel:"nofollow",target:"_blank",href:n.wikisourceLink},"Voir la page sur Wikisource",8,be)])],4)),n.minimizable&&!n.error?((0,e.openBlock)(),(0,e.createElementBlock)("div",we,[n.minimized?((0,e.openBlock)(),(0,e.createElementBlock)("button",{key:0,onClick:i[2]||(i[2]=(...e)=>r.unminimize&&r.unminimize(...e))}," Agrandir ")):((0,e.openBlock)(),(0,e.createElementBlock)("button",{key:1,onClick:i[3]||(i[3]=(...e)=>r.minimize&&r.minimize(...e))}," Réduire "))])):(0,e.createCommentVNode)("v-if",!0)])}]]),DictionariesList:ae,DictionariesTimeline:A,FiltersSelector:q,SearchBar:f},setup(){const t=g(),i=(0,e.ref)(dictionariesIds.map((e=>({wikidata:e,enabled:!0,available:!0,missing:[],subject:[void 0],genre:[void 0],language:[void 0]})))),a=(0,e.ref)({languages:[{name:"Non précisée",active:!0,qid:void 0}],subjects:[{name:"Non précisé",active:!0,qid:void 0}],genres:[{name:"Non précisé",active:!0,qid:void 0}]}),n=(0,e.ref)(!1),o=(0,e.ref)({}),r=(e,t,i)=>{let a=e.value.filter(t).map(t).flat().filter((e=>void 0!==e.qid)).map((e=>"https://www.wikidata.org/wiki/Special:EntityData/"+e.qid+".json"));return i&&(a=[...new Set(a)]),a.map((e=>fetch(e)))},l=e=>e.forEach((e=>{const t=Object.keys(e.entities)[0],i=e.entities[t];o.value[t]=i.labels.fr.value})),c=()=>Promise.all(r(i,(e=>e.authors),!0)),s=()=>Promise.all(r(i,(e=>e.publishers),!0)),d=()=>Promise.all(r(i,(e=>e.publicationPlaces),!0));return(async()=>{let e=i.value.map((e=>"https://www.wikidata.org/wiki/Special:EntityData/"+e.wikidata+".json")),t=e.map((e=>fetch(e)));await Promise.all(t).then((e=>Promise.all(e.map((e=>e.json()))))).then((e=>e.forEach((e=>function(e){const t=Object.keys(e.entities)[0],a=i.value.indexOf(i.value.find((e=>e.wikidata===t))),n=i.value[a],o=e.entities[t];if(o.claims.P1476?n.title=o.claims.P1476[0].mainsnak.datavalue.value.text:n.missing.push("titre"),o.claims.P577?n.date=o.claims.P577[0].mainsnak.datavalue.value.time.slice(1,5):n.missing.push("date"),o.claims.P629?n.work=o.claims.P629[0].mainsnak.datavalue.value.id:n.missing.push("édition ou traduction de"),o.claims.P407){n.language=[];for(const e of o.claims.P407)n.language.push(e.mainsnak.datavalue.value.id)}else n.missing.push("langue");if(o.claims.P50){n.authors=[];for(const e of o.claims.P50)"somevalue"===e.mainsnak.snaktype?n.authors.push({name:"Inconnu",qid:void 0}):n.authors.push({name:e.qualifiers?.P1932?e.qualifiers.P1932[0].datavalue.value:void 0,qid:e.mainsnak.datavalue.value.id})}else n.missing.push("auteur ou autrice");if(o.claims.P291){n.publicationPlaces=[];for(const e of o.claims.P291)n.publicationPlaces.push({name:void 0,qid:e.mainsnak.datavalue.value.id})}if(o.claims.P123){n.publishers=[];for(const e of o.claims.P123)"somevalue"===e.mainsnak.snaktype?n.publishers.push({name:"Inconnu",qid:void 0}):n.publishers.push({name:e.qualifiers?.P1932?e.qualifiers.P1932[0].datavalue.value:void 0,qid:e.mainsnak.datavalue.value.id})}o.sitelinks.frwikisource?n.wikisource=o.sitelinks.frwikisource.title:n.missing.push("lien wikisource")}(e))))).then(c).then((e=>Promise.all(e.map((e=>e.json()))))).then(l).then(s).then((e=>Promise.all(e.map((e=>e.json()))))).then(l).then(d).then((e=>Promise.all(e.map((e=>e.json()))))).then(l).then((()=>(e=[...new Set(i.value.filter((e=>e.work)).map((e=>"https://www.wikidata.org/wiki/Special:EntityData/"+e.work+".json")))],t=e.map((e=>fetch(e))),Promise.all(t)))).then((e=>Promise.all(e.map((e=>e.json()))))).then((n=>(n.forEach((e=>function(e){const t=Object.keys(e.entities)[0],a=i.value[i.value.indexOf(i.value.find((e=>e.work===t)))],n=e.entities[t];if(n.claims.P921){a.subject=[];for(const e of n.claims.P921)a.subject.push(e.mainsnak.datavalue.value.id)}if(n.claims.P136){a.genre=[];for(const e of n.claims.P136)a.genre.push(e.mainsnak.datavalue.value.id)}}(e))),i.value.forEach((e=>{if(e.subject)for(const t of e.subject)a.value.subjects.some((e=>e.qid===t))||a.value.subjects.push({name:"",qid:t,active:!0});if(e.genre)for(const t of e.genre)a.value.genres.some((e=>e.qid===t))||a.value.genres.push({name:"",qid:t,active:!0});if(e.language)for(const t of e.language)a.value.languages.some((e=>e.qid===t))||a.value.languages.push({name:"",qid:t,active:!0})})),e=a.value.languages.filter((e=>void 0!==e.qid)).map((e=>"https://www.wikidata.org/wiki/Special:EntityData/"+e.qid+".json")),t=e.map((e=>fetch(e))),Promise.all(t)))).then((e=>Promise.all(e.map((e=>e.json()))))).then((i=>(i.forEach((e=>{const t=Object.keys(e.entities)[0],i=a.value.languages.indexOf(a.value.languages.find((e=>e.qid===t))),n=a.value.languages[i],o=e.entities[t];o.labels.fr?n.name=o.labels.fr.value:n.name=t})),e=a.value.subjects.filter((e=>void 0!==e.qid)).map((e=>"https://www.wikidata.org/wiki/Special:EntityData/"+e.qid+".json")),t=e.map((e=>fetch(e))),Promise.all(t)))).then((e=>Promise.all(e.map((e=>e.json()))))).then((i=>(i.forEach((e=>{const t=Object.keys(e.entities)[0],i=a.value.subjects.indexOf(a.value.subjects.find((e=>e.qid===t))),n=a.value.subjects[i],o=e.entities[t];o.labels.fr?n.name=o.labels.fr.value:n.name=t})),e=a.value.genres.filter((e=>void 0!==e.qid)).map((e=>"https://www.wikidata.org/wiki/Special:EntityData/"+e.qid+".json")),t=e.map((e=>fetch(e))),Promise.all(t)))).then((e=>Promise.all(e.map((e=>e.json()))))).then((e=>{e.forEach((e=>{const t=Object.keys(e.entities)[0],i=a.value.genres.indexOf(a.value.genres.find((e=>e.qid===t))),n=a.value.genres[i],o=e.entities[t];o.labels.fr?n.name=o.labels.fr.value:n.name=t})),i.value.map((e=>e.genre)).some((e=>e.includes(void 0)))||a.value.genres.splice(0,1),i.value.map((e=>e.subject)).some((e=>e.includes(void 0)))||a.value.subjects.splice(0,1),i.value.map((e=>e.language)).some((e=>e.includes(void 0)))||a.value.languages.splice(0,1),i.value.sort(((e,t)=>e.date-t.date)),n.value=!0}))})(),{store:t,entries:(0,e.ref)([]),dictionaries:i,filters:a,strictSearch:!1,dictionariesReady:n,labels:o}},computed:{availableDictionaries:function(){return this.dictionaries.filter((e=>e.available&&this.filters.subjects.filter((e=>e.active)).some((t=>e.subject.includes(t.qid)))&&this.filters.genres.filter((e=>e.active)).some((t=>e.genre.includes(t.qid)))&&this.filters.languages.filter((e=>e.active)).some((t=>e.language.includes(t.qid)))))}},methods:{getEntries:function(){const e=g();if(e.word){e.word=e.word.trim(),this.entries=[],mw.log.warn("Searching for: "+e.word);for(const t of this.availableDictionaries){if(!t.enabled)continue;const i={action:"query",format:"json",list:"search",srsearch:"intitle:/[^\\/]*\\/"+e.word+'/i prefix:"'+t.wikisource+'/"',srnamespace:"0",srlimit:"50",srwhat:"text",srsort:"just_match"};(function(t){api.get(i).done(function(i){this.entries=this.entries.concat(i.query.search.map((e=>({title:e.title,dictionary:t,wordcount:e.wordcount})))),this.entries=this.entries.filter((t=>{const i=t.title.split("/").pop();return!subPagesDenylist.some((e=>i.startsWith(e)))&&i.toLowerCase().includes(e.word.toLowerCase())})),this.strictSearch&&(this.entries=this.entries.filter((t=>t.title.split("/").pop().toLowerCase()===e.word.toLowerCase())))}.bind(this))}).bind(this)(t)}}},toggleStrictSearch:function(){this.strictSearch=!this.strictSearch}}},Be=(0,v.Z)(xe,[["render",function(t,i,u,m,p,g){const k=(0,e.resolveComponent)("filters-selector"),v=(0,e.resolveComponent)("dictionaries-timeline"),f=(0,e.resolveComponent)("search-bar"),h=(0,e.resolveComponent)("definition-card"),y=(0,e.resolveComponent)("dictionaries-list");return(0,e.openBlock)(),(0,e.createElementBlock)("div",a,[(0,e.createElementVNode)("div",n,[m.dictionariesReady?((0,e.openBlock)(),(0,e.createBlock)(k,{key:0,filters:m.filters,dictionaries:m.dictionaries,"available-dictionaries":g.availableDictionaries},null,8,["filters","dictionaries","available-dictionaries"])):(0,e.createCommentVNode)("v-if",!0)]),(0,e.createElementVNode)("div",o,[m.dictionariesReady?((0,e.openBlock)(),(0,e.createBlock)(v,{key:0,dictionaries:m.dictionaries},null,8,["dictionaries"])):(0,e.createCommentVNode)("v-if",!0),m.dictionariesReady?((0,e.openBlock)(),(0,e.createBlock)(f,{key:1,strict:m.strictSearch,onUpdate:g.getEntries,onToggleStrict:g.toggleStrictSearch},null,8,["strict","onUpdate","onToggleStrict"])):(0,e.createCommentVNode)("v-if",!0),m.dictionariesReady?(0,e.createCommentVNode)("v-if",!0):((0,e.openBlock)(),(0,e.createElementBlock)("p",r," Chargement des dictionnaires... Veuillez patienter... ")),m.store.word?((0,e.openBlock)(),(0,e.createElementBlock)("div",l,[(0,e.createElementVNode)("p",null,"Nombre de définitions trouvées : "+(0,e.toDisplayString)(m.entries.length),1),(0,e.createElementVNode)("div",c,[1===m.entries.length?((0,e.openBlock)(),(0,e.createBlock)(e.Suspense,{key:0},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(h,{pagename:m.entries[0].title,dictionary:m.entries[0].dictionary,wordcount:m.entries[0].wordcount,onGoToWord:g.getEntries},null,8,["pagename","dictionary","wordcount","onGoToWord"])])),fallback:(0,e.withCtx)((()=>[(0,e.createTextVNode)(" Loading... ")])),_:1})):((0,e.openBlock)(),(0,e.createElementBlock)("div",s,[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(m.entries,(t=>((0,e.openBlock)(),(0,e.createBlock)(e.Suspense,{key:t.dictionary.wikidata},{default:(0,e.withCtx)((()=>[(0,e.createVNode)(h,{style:{width:"48%"},pagename:t.title,dictionary:t.dictionary,wordcount:t.wordcount,onGoToWord:g.getEntries},null,8,["pagename","dictionary","wordcount","onGoToWord"])])),fallback:(0,e.withCtx)((()=>[])),_:2},1024)))),128))]))])])):(0,e.createCommentVNode)("v-if",!0)]),(0,e.createElementVNode)("div",d,[m.dictionariesReady?((0,e.openBlock)(),(0,e.createBlock)(y,{key:0,"available-dictionaries":g.availableDictionaries,labels:m.labels},null,8,["available-dictionaries","labels"])):(0,e.createCommentVNode)("v-if",!0)])])}]]),Ne=(0,t.createPinia)(),Ve=mw.config.get(["wgNamespaceNumber","wgTitle"]);4===Ve.wgNamespaceNumber&&"Dicothèque"===Ve.wgTitle&&(0,e.createApp)(Be).use(Ne).mount("#dicotheque")})()})();
});