javascripts/pagy.js in pagy-8.4.2 vs javascripts/pagy.js in pagy-8.4.3

- old
+ new

@@ -1,3 +1,6 @@ -window.Pagy=(()=>{const x=new ResizeObserver((B)=>B.forEach((D)=>D.target.querySelectorAll(".pagy-rjs").forEach((E)=>E.pagyRender()))),A=(B,[D,E,z,G])=>{const F=B.parentElement??B,K=Object.keys(E).map((H)=>parseInt(H)).sort((H,M)=>M-H);let L=-1;const T=(H,M,Q)=>H.replace(/__pagy_page__/g,M).replace(/__pagy_label__/g,Q);if((B.pagyRender=function(){const H=K.find((R)=>R<F.clientWidth)||0;if(H===L)return;let M=D.before;const Q=E[H.toString()],Y=z?.[H.toString()]??Q.map((R)=>R.toString());for(let R in Q){const U=Q[R],j=Y[R];let X;if(typeof U==="number")X=T(D.a,U.toString(),j);else if(U==="gap")X=D.gap;else X=T(D.current,U,j);M+=typeof G==="string"&&U==1?$(X,G):X}M+=D.after,B.innerHTML="",B.insertAdjacentHTML("afterbegin",M),L=H})(),B.classList.contains("pagy-rjs"))x.observe(F)},C=(B,[D,E])=>Z(B,(z)=>[z,D.replace(/__pagy_page__/,z)],E),J=(B,[D,E,z])=>{Z(B,(G)=>{const F=Math.max(Math.ceil(D/parseInt(G)),1).toString(),K=E.replace(/__pagy_page__/,F).replace(/__pagy_items__/,G);return[F,K]},z)},Z=(B,D,E)=>{const z=B.querySelector("input"),G=B.querySelector("a"),F=z.value,K=function(){if(z.value===F)return;const[L,T,H]=[z.min,z.value,z.max].map((Y)=>parseInt(Y)||0);if(T<L||T>H){z.value=F,z.select();return}let[M,Q]=D(z.value);if(typeof E==="string"&&M==="1")Q=$(Q,E);G.href=Q,G.click()};["change","focus"].forEach((L)=>z.addEventListener(L,z.select)),z.addEventListener("focusout",K),z.addEventListener("keypress",(L)=>{if(L.key==="Enter")K()})},$=(B,D)=>B.replace(new RegExp(`[?&]${D}=1\\b(?!&)|\\b${D}=1&`),"");return{version:"8.4.2",init(B){const E=(B instanceof Element?B:document).querySelectorAll("[data-pagy]");for(let z of E)try{const G=Uint8Array.from(atob(z.getAttribute("data-pagy")),(L)=>L.charCodeAt(0)),[F,...K]=JSON.parse((new TextDecoder()).decode(G));if(F==="nav")A(z,K);else if(F==="combo")C(z,K);else if(F==="selector")J(z,K);else console.warn("Skipped Pagy.init() for: %o\nUnknown keyword '%s'",z,F)}catch(G){console.warn("Skipped Pagy.init() for: %o\n%s",z,G)}}}})(); +window.Pagy=(()=>{const j=new ResizeObserver((z)=>z.forEach((B)=>B.target.querySelectorAll(".pagy-rjs").forEach((D)=>D.pagyRender()))),A=(z,[B,D,x,F])=>{const E=z.parentElement??z,H=Object.keys(D).map((G)=>parseInt(G)).sort((G,L)=>L-G);let K=-1;const R=(G,L,M)=>G.replace(/__pagy_page__/g,L).replace(/__pagy_label__/g,M);if((z.pagyRender=function(){const G=H.find((Q)=>Q<E.clientWidth)||0;if(G===K)return;let L=B.before;const M=D[G.toString()],X=x?.[G.toString()]??M.map((Q)=>Q.toString());for(let Q in M){const T=M[Q],$=X[Q];let U;if(typeof T==="number")U=R(B.a,T.toString(),$);else if(T==="gap")U=B.gap;else U=R(B.current,T,$);L+=typeof F==="string"&&T==1?Z(U,F):U}L+=B.after,z.innerHTML="",z.insertAdjacentHTML("afterbegin",L),K=G})(),z.classList.contains("pagy-rjs"))j.observe(E)},C=(z,[B,D])=>Y(z,(x)=>[x,B.replace(/__pagy_page__/,x)],D),J=(z,[B,D,x])=>{Y(z,(F)=>{const E=Math.max(Math.ceil(B/parseInt(F)),1).toString(),H=D.replace(/__pagy_page__/,E).replace(/__pagy_items__/,F);return[E,H]},x)},Y=(z,B,D)=>{const x=z.querySelector("input"),F=z.querySelector("a"),E=x.value,H=function(){if(x.value===E)return;const[K,R,G]=[x.min,x.value,x.max].map((X)=>parseInt(X)||0);if(R<K||R>G){x.value=E,x.select();return}let[L,M]=B(x.value);if(typeof D==="string"&&L==="1")M=Z(M,D);F.href=M,F.click()};["change","focus"].forEach((K)=>x.addEventListener(K,x.select)),x.addEventListener("focusout",H),x.addEventListener("keypress",(K)=>{if(K.key==="Enter")H()})},Z=(z,B)=>z.replace(new RegExp(`[?&]${B}=1\\b(?!&)|\\b${B}=1&`),"");return{version:"8.4.3",init(z){const D=(z instanceof Element?z:document).querySelectorAll("[data-pagy]");for(let x of D)try{const F=Uint8Array.from(atob(x.getAttribute("data-pagy")),(K)=>K.charCodeAt(0)),[E,...H]=JSON.parse((new TextDecoder()).decode(F));if(E==="nav")A(x,H);else if(E==="combo")C(x,H);else if(E==="selector")J(x,H);else console.warn("Skipped Pagy.init() for: %o\nUnknown keyword '%s'",x,E)}catch(F){console.warn("Skipped Pagy.init() for: %o\n%s",x,F)}}}})(); + +//# debugId=C131CFD0ECFFDA8364756e2164756e21 +//# sourceMappingURL=pagy.min.js.map