import{o as oe,c as re,e as le,a as se,p as n,v as b,g as ie,s as D,b as h,d as ne,f as x,h as u,m as c,i as t,r as m,t as $,k as F,u as ce,q as E,w as _}from"../../custom-element.js";import{i as B}from"../../if.js";import{e as de,i as me}from"../../each.js";import{f as ve,s as R,d as pe}from"../../attributes.js";import{s as Y,g as G}from"../../Condition20.js";import{B as H}from"../button/Button.js";import{I as J}from"../iconbutton/IconButton.js";import"../../branches.js";import"../../slot.js";import"../../this.js";import"../loader/Loader.js";var ue=x("<option> </option>"),ge=x('<div class="mc-pagination__field"><div class="mc-select mc-pagination__select svelte-19eta05"><select class="mc-select__control svelte-19eta05"></select></div></div>'),fe=x('<span class="mc-pagination__label svelte-19eta05" aria-current="page"> </span>'),be=x('<nav class="mc-pagination svelte-19eta05" aria-label="pagination"><!> <!> <!></nav>');const he={hash:"svelte-19eta05",code:`/**
 * Do not edit directly, this file was auto-generated.
 */.mc-pagination.svelte-19eta05 {align-items:center;display:flex;justify-content:center;gap:0.5rem;}.mc-pagination__label.svelte-19eta05 {clip-path:inset(100%);clip:rect(1px, 1px, 1px, 1px);height:1px;overflow:hidden;position:absolute;white-space:nowrap;padding:0;width:1px;}

/* stylelint-disable string-no-newline */.mc-select.svelte-19eta05 {position:relative;display:block;width:100%;}.mc-select.svelte-19eta05::after {content:"";pointer-events:none;position:absolute;top:50%;right:1rem;transform:translateY(-50%);width:1rem;height:1rem;background-color:var(--forms-color-icon-interactive, #000000);mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1rem' width='1rem' viewBox='0 0 16 16'%3E%3Cpath d='M8 11.5a1 1 0 01-.71-.29l-5-5a1 1 0 011.42-1.42L8 9.09l4.29-4.3a1 1 0 111.42 1.42l-5 5a1 1 0 01-.71.29z'/%3E%3C/svg%3E") no-repeat center/contain;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' aria-hidden='true' height='1rem' width='1rem' viewBox='0 0 16 16'%3E%3Cpath d='M8 11.5a1 1 0 01-.71-.29l-5-5a1 1 0 011.42-1.42L8 9.09l4.29-4.3a1 1 0 111.42 1.42l-5 5a1 1 0 01-.71.29z'/%3E%3C/svg%3E") no-repeat center/contain;}.mc-select__control.svelte-19eta05 {appearance:none;font-family:inherit;transition:box-shadow 200ms ease;font-size:var(--font-size-150, 1rem);line-height:var(--line-height-s, 1.3);height:3rem;padding:0 3rem 0 0.75rem;background-position:right 1rem center;border:var(--border-width-s, 0.0625rem) solid var(--forms-color-border-default, #666666);display:block;width:100%;color:var(--forms-color-text-default, #000000);background-color:var(--forms-color-background-default, #ffffff);text-overflow:ellipsis;border-radius:var(--border-radius-s, 0.25rem);}.mc-select__control.svelte-19eta05:hover {border-color:var(--forms-color-border-hover, #4d4d4d);box-shadow:0 0 0 var(--border-width-s, 0.0625rem) var(--forms-color-border-hover, #4d4d4d);}.mc-select__control.svelte-19eta05:focus {box-shadow:0 0 0 0.125rem var(--focus-color-mid, var(--focus-color-outline-mid, #ffffff)), 0 0 0 0.25rem var(--focus-color-outer, var(--focus-color-outline-outer, #000000));outline:0.125rem solid transparent;outline-offset:0.125rem;}.mc-select__control.svelte-19eta05:disabled {background-color:var(--forms-color-background-disabled, #d9d9d9);border-color:transparent;cursor:not-allowed;box-shadow:none;color:var(--forms-color-text-disabled, #737373);}

/* stylelint-enable string-no-newline */`};function _e(z,s){le(s,!0),se(z,he);let w=n(s,"id",7),v=n(s,"value",15,1),i=n(s,"total",7,10),p=n(s,"compact",7),k=n(s,"selectLabel",7,"Page selector"),g=n(s,"prefixlabel",7,"Page"),f=n(s,"pagelabel",7,"of"),l=b(ie(Number(v())));const y=b(()=>t(l)<=1),P=b(()=>t(l)>=i()),K=b(()=>Array.from({length:i()},(e,a)=>a+1));function I(){t(y)()||E(l,Number(t(l))-1)}function M(){t(P)()||E(l,Number(t(l))+1)}function O(e){const a=Number(e.target.value);v(a)}var Q={get id(){return w()},set id(e){w(e),c()},get value(){return v()},set value(e=1){v(e),c()},get total(){return i()},set total(e=10){i(e),c()},get compact(){return p()},set compact(e){p(e),c()},get selectLabel(){return k()},set selectLabel(e="Page selector"){k(e),c()},get prefixlabel(){return g()},set prefixlabel(e="Page"){g(e),c()},get pagelabel(){return f()},set pagelabel(e="of"){f(e),c()}},C=be(),S=u(C);{var T=e=>{{let a=_(()=>t(y)());H(e,{iconposition:"only","aria-label":"Previous page",get disabled(){return t(a)},onclick:I,$$slots:{icon:(o,r)=>{Y(o,{slot:"icon"})}}})}},U=e=>{{let a=_(()=>t(y)());J(e,{outlined:!0,"aria-label":"Previous page",get disabled(){return t(a)},onclick:I,$$slots:{icon:(o,r)=>{Y(o,{slot:"icon"})}}})}};B(S,e=>{p()?e(U,-1):e(T)})}var j=D(S,2);{var V=e=>{var a=ge(),o=u(a),r=u(o);de(r,21,()=>t(K)(),me,(L,N)=>{var d=ue(),te=u(d);m(d);var q={};$((ae,A)=>{ve(d,ae),F(te,`${g()??""}
              ${t(N)??""}
              ${f()??""}
              ${i()??""}`),q!==(q=A)&&(d.value=(d.__value=A)??"")},[()=>Number(t(N))==Number(t(l)),()=>Number(t(N))]),h(L,d)}),m(r),m(o),m(a),$(()=>{R(r,"id",w()),R(r,"aria-label",k()),r.disabled=i()<=1}),ce("change",r,O),pe(r,()=>t(l),L=>E(l,L)),h(e,a)},W=e=>{var a=fe(),o=u(a);m(a),$(()=>F(o,`${g()??""}
      ${v()??""}
      ${f()??""}
      ${i()??""}`)),h(e,a)};B(j,e=>{p()?e(W,-1):e(V)})}var X=D(j,2);{var Z=e=>{{let a=_(()=>t(P)());H(e,{iconposition:"only","aria-label":"Next page",get disabled(){return t(a)},onclick:M,$$slots:{icon:(o,r)=>{G(o,{slot:"icon"})}}})}},ee=e=>{{let a=_(()=>t(P)());J(e,{outlined:!0,"aria-label":"Next page",get disabled(){return t(a)},onclick:M,$$slots:{icon:(o,r)=>{G(o,{slot:"icon"})}}})}};B(X,e=>{p()?e(ee,-1):e(Z)})}return m(C),h(z,C),ne(Q)}oe(["change"]);customElements.define("m-pagination",re(_e,{compact:{attribute:"compact",reflect:!0,type:"Boolean"},id:{},value:{},total:{},selectLabel:{},prefixlabel:{},pagelabel:{}},[],[],{mode:"open"}));
//# sourceMappingURL=Pagination.js.map
