1function createCharacterCounter(e){if(e.dataset.counterInitialized==="1")return;e.dataset.counterInitialized="1";const t=document.createElement("div");t.className="form-text text-end text-muted",t.setAttribute("aria-live","polite");const a=e.dataset.counterLabel||"caracteres",s=e.dataset.counterRichtext==="true",o=e.dataset.counterMax||e.getAttribute("maxlength"),i=window.jQuery||window.$||null,r=()=>{const n=s?e.closest(".trumbowyg-box, .trumbowyg-editor-box"):null;if(n){t.previousElementSibling!==n&&n.insertAdjacentElement("afterend",t);return}t.previousElementSibling!==e&&e.insertAdjacentElement("afterend",t)};r();const c=e=>{if(!s)return Array.from(e).length;const t=document.createElement("div");return t.innerHTML=e,Array.from(t.textContent||"").length},l=()=>{if(s&&i)try{const t=i(e);if(t.data("trumbowyg"))return t.trumbowyg("html")||""}catch{}return e.value||""},n=()=>{r();const n=l(),e=c(n);if(t.textContent=o?`${e}/${o} ${a}`:`${e} ${a}`,o&&e>Number.parseInt(o,10)){t.classList.remove("text-muted"),t.classList.add("text-warning","fw-bold");return}t.classList.remove("text-warning","fw-bold"),t.classList.add("text-muted")};if(e.addEventListener("input",n),e.addEventListener("tbwchange",n),e.addEventListener("tbwblur",n),e.addEventListener("tbwfocus",n),s){const t=()=>{if(!i)return!1;try{const t=i(e);return!!t.data("trumbowyg")&&(t.on("tbwchange tbwblur tbwfocus tbwpaste",n),n(),!0)}catch{return!1}};if(!t()){const e=window.setInterval(()=>{t()&&window.clearInterval(e)},300);window.setTimeout(()=>window.clearInterval(e),8e3)}}n()}const gaugeProfiles={"sur-title":{fullAt:50,ranges:[[0,"empty","Vide"],[9,"warning","Améliorable"],[40,"ideal","Idéal"],[49,"warning","Améliorable"],[1/0,"too-long","Trop long"]]},title:{fullAt:100,ranges:[[0,"empty","Vide"],[49,"too-short","Trop court"],[59,"warning","Améliorable"],[90,"ideal","Idéal"],[100,"warning","Améliorable"],[1/0,"too-long","Trop long"]]},chapo:{fullAt:300,ranges:[[0,"empty","Vide"],[99,"too-short","Trop court"],[149,"warning","Améliorable"],[249,"ideal","Idéal"],[299,"warning","Améliorable"],[1/0,"too-long","Trop long"]]},body:{fullAt:4500,ranges:[[0,"empty","Vide"],[1499,"too-short","Trop court"],[1999,"warning","Améliorable"],[3e3,"ideal","Idéal"],[4499,"warning","Améliorable"],[1/0,"too-long","Trop long"]]}};function createFieldGauge(e){if(e.dataset.gaugeInitialized==="1")return;const t=document.getElementById(e.dataset.target),n=gaugeProfiles[e.dataset.gaugeProfile];if(!t||!n)return;const r=e.querySelector("[data-field-gauge-label]"),o=e.querySelector("[data-field-gauge-progress]");if(!r||!o)return;e.dataset.gaugeInitialized="1";const a=e.dataset.richtext==="true",i=window.jQuery||window.$||null,c=()=>{if(a&&i)try{const e=i(t);if(e.data("trumbowyg"))return e.trumbowyg("html")||""}catch{}return t.value||""},l=()=>{const e=c();if(!a)return Array.from(e).length;const t=document.createElement("div");return t.innerHTML=e,Array.from((t.textContent||"").replace(/\u00a0/g," ")).length},s=()=>{const t=l(),[,i,s]=n.ranges.find(([e])=>t<=e);r.textContent=`${t} signes - ${s}`,e.style.setProperty("--field-gauge-ratio",String(Math.min(t/n.fullAt,1))),o.setAttribute("aria-valuenow",String(Math.min(t,n.fullAt))),o.setAttribute("aria-valuemax",String(n.fullAt)),o.setAttribute("aria-valuetext",`${t} signes - ${s}`),e.classList.remove("field-gauge--empty","field-gauge--too-short","field-gauge--ideal","field-gauge--warning","field-gauge--too-long"),e.classList.add(`field-gauge--${i}`)};if(["input","change","keyup","focus","blur"].forEach(e=>{t.addEventListener(e,s)}),["paste","cut"].forEach(e=>{t.addEventListener(e,()=>window.setTimeout(s,0))}),a&&i){const e=()=>{try{const e=i(t);return!!e.data("trumbowyg")&&(e.on("tbwchange tbwblur tbwfocus tbwpaste",s),s(),!0)}catch{return!1}};if(!e()){const t=window.setInterval(()=>{e()&&window.clearInterval(t)},300);window.setTimeout(()=>window.clearInterval(t),8e3)}}s()}export function initCharacterCounters(e=".js-character-counter"){document.querySelectorAll(e).forEach(createCharacterCounter),document.querySelectorAll("[data-field-gauge]").forEach(createFieldGauge)}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.