p&&v>=m&&(l.scrollLeft=m,P=!0),b&&m"u"?n.length>0?n[0].scrollTop:null:n.scrollTo(void 0,e,t,r,o)}function ed(...a){let[e,t,r,o]=a;a.length===3&&typeof r=="function"&&([e,t,o,r]=a);let n=this;return typeof e>"u"?n.length>0?n[0].scrollLeft:null:n.scrollTo(e,void 0,t,r,o)}function td(a,e){let t=Z(),r=this,o={props:Object.assign({},a),params:Object.assign({duration:300,easing:"swing"},e),elements:r,animating:!1,que:[],easingProgress(s,c){return s==="swing"?.5-Math.cos(c*Math.PI)/2:typeof s=="function"?s(c):c},stop(){o.frameId&&t.cancelAnimationFrame(o.frameId),o.animating=!1,o.elements.each(s=>{let c=s;delete c.dom7AnimateInstance}),o.que=[]},done(s){if(o.animating=!1,o.elements.each(c=>{let l=c;delete l.dom7AnimateInstance}),s&&s(r),o.que.length>0){let c=o.que.shift();o.animate(c[0],c[1])}},animate(s,c){if(o.animating)return o.que.push([s,c]),o;let l=[];o.elements.each((v,w)=>{let b,k,y,C,E;v.dom7AnimateInstance||(o.elements[w].dom7AnimateInstance=o),l[w]={container:v},Object.keys(s).forEach(S=>{b=t.getComputedStyle(v,null).getPropertyValue(S).replace(",","."),k=parseFloat(b),y=b.replace(k,""),C=parseFloat(s[S]),E=s[S]+y,l[w][S]={initialFullValue:b,initialValue:k,unit:y,finalValue:C,finalFullValue:E,currentValue:k}})});let d=null,p,f=0,u=0,h,m=!1;o.animating=!0;function g(){p=new Date().getTime();let v,w;m||(m=!0,c.begin&&c.begin(r)),d===null&&(d=p),c.progress&&c.progress(r,Math.max(Math.min((p-d)/c.duration,1),0),d+c.duration-p<0?0:d+c.duration-p,d),l.forEach(b=>{let k=b;h||k.done||Object.keys(s).forEach(y=>{if(h||k.done)return;v=Math.max(Math.min((p-d)/c.duration,1),0),w=o.easingProgress(c.easing,v);let{initialValue:C,finalValue:E,unit:S}=k[y];k[y].currentValue=C+w*(E-C);let P=k[y].currentValue;if((E>C&&P>=E||E"u"){for(let r=0;r{a!=="$"&&(ve.fn[a]=Tr[a])});var x=ve;var Pr={};to(Pr,{bindMethods:()=>ze,cancelAnimationFrame:()=>Nd,colorHexToRgb:()=>ut,colorHsbToHsl:()=>Qe,colorHslToHsb:()=>Xt,colorHslToRgb:()=>Rt,colorRgbToHex:()=>mt,colorRgbToHsl:()=>dr,colorThemeCSSProperties:()=>ya,colorThemeCSSStyles:()=>Wd,deleteProps:()=>he,eventNameToColonCase:()=>Ze,extend:()=>D,flattenArray:()=>Ut,getTranslate:()=>jt,id:()=>at,iosPreloaderContent:()=>ot,isObject:()=>Tt,mdPreloaderContent:()=>it,merge:()=>Gt,nextFrame:()=>De,nextTick:()=>$e,now:()=>Be,parseUrlQuery:()=>zt,requestAnimationFrame:()=>ka,serializeObject:()=>kt,uniqueNumber:()=>Yd});function We(a){return a<0?-1:a===0?0:1}function lr(a,e,t){return(1-t)*a+t*e}function Td(a,e,t){return te?e:t}function zr(a,e,t){return te?e:t}function va(a){return(a%=360)<0&&(a+=360),a}function zd(a,e){return va(e-a)<=180?1:-1}function Ad(a,e){return 180-Math.abs(Math.abs(a-e)-180)}function ua(a,e){return[a[0]*e[0][0]+a[1]*e[0][1]+a[2]*e[0][2],a[0]*e[1][0]+a[1]*e[1][1]+a[2]*e[1][2],a[0]*e[2][0]+a[1]*e[2][1]+a[2]*e[2][2]]}var Md=[[.41233895,.35762064,.18051042],[.2126,.7152,.0722],[.01932141,.11916382,.95034478]],Pd=[[3.2413774792388685,-1.5376652402851851,-.49885366846268053],[-.9691452513005321,1.8758853451067872,.04156585616912061],[.05562093689691305,-.20395524564742123,1.0571799111220335]],Id=[95.047,100,108.883];function wa(a,e,t){return(255<<24|(255&a)<<16|(255&e)<<8|255&t)>>>0}function oo(a){return wa(Ot(a[0]),Ot(a[1]),Ot(a[2]))}function no(a){return a>>16&255}function so(a){return a>>8&255}function lo(a){return 255&a}function Bd(a,e,t){let r=Pd,o=r[0][0]*a+r[0][1]*e+r[0][2]*t,n=r[1][0]*a+r[1][1]*e+r[1][2]*t,s=r[2][0]*a+r[2][1]*e+r[2][2]*t;return wa(Ot(o),Ot(n),Ot(s))}function Od(a){return ua([Wt(no(a)),Wt(so(a)),Wt(lo(a))],Md)}function Dd(a){let e=Ot($t(a));return wa(e,e,e)}function ma(a){return 116*co(Od(a)[1]/100)-16}function $t(a){return 100*Ld((a+16)/116)}function ha(a){return 116*co(a/100)-16}function Wt(a){let e=a/255;return e<=.040449936?e/12.92*100:100*Math.pow((e+.055)/1.055,2.4)}function Ot(a){let e=a/100,t=0;return t=e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055,Td(0,255,Math.round(255*t))}function Rd(){return Id}function co(a){return a>216/24389?Math.pow(a,1/3):(903.2962962962963*a+16)/116}function Ld(a){let e=a*a*a;return e>216/24389?e:(116*a-16)/903.2962962962963}var rt=class a{static make(e,t,r,o,n){e===void 0&&(e=Rd()),t===void 0&&(t=200/Math.PI*$t(50)/100),r===void 0&&(r=50),o===void 0&&(o=2),n===void 0&&(n=!1);let s=e,c=.401288*s[0]+.650173*s[1]+-.051461*s[2],l=-.250268*s[0]+1.204414*s[1]+.045854*s[2],d=-.002079*s[0]+.048952*s[1]+.953127*s[2],p=.8+o/10,f=p>=.9?lr(.59,.69,10*(p-.9)):lr(.525,.59,10*(p-.8)),u=n?1:p*(1-1/3.6*Math.exp((-t-42)/92));u=u>1?1:u<0?0:u;let h=p,m=[u*(100/c)+1-u,u*(100/l)+1-u,u*(100/d)+1-u],g=1/(5*t+1),v=g*g*g*g,w=1-v,b=v*t+.1*w*w*Math.cbrt(5*t),k=$t(r)/e[1],y=1.48+Math.sqrt(k),C=.725/Math.pow(k,.2),E=C,S=[Math.pow(b*m[0]*c/100,.42),Math.pow(b*m[1]*l/100,.42),Math.pow(b*m[2]*d/100,.42)],P=[400*S[0]/(S[0]+27.13),400*S[1]/(S[1]+27.13),400*S[2]/(S[2]+27.13)];return new a(k,(2*P[0]+P[1]+.05*P[2])*C,C,E,f,h,m,b,Math.pow(b,.25),y)}constructor(e,t,r,o,n,s,c,l,d,p){this.n=e,this.aw=t,this.nbb=r,this.ncb=o,this.c=n,this.nc=s,this.rgbD=c,this.fl=l,this.fLRoot=d,this.z=p}};rt.DEFAULT=rt.make();var Ke=class a{constructor(e,t,r,o,n,s,c,l,d){this.hue=e,this.chroma=t,this.j=r,this.q=o,this.m=n,this.s=s,this.jstar=c,this.astar=l,this.bstar=d}distance(e){let t=this.jstar-e.jstar,r=this.astar-e.astar,o=this.bstar-e.bstar,n=Math.sqrt(t*t+r*r+o*o);return 1.41*Math.pow(n,.63)}static fromInt(e){return a.fromIntInViewingConditions(e,rt.DEFAULT)}static fromIntInViewingConditions(e,t){let r=(65280&e)>>8,o=255&e,n=Wt((16711680&e)>>16),s=Wt(r),c=Wt(o),l=.41233895*n+.35762064*s+.18051042*c,d=.2126*n+.7152*s+.0722*c,p=.01932141*n+.11916382*s+.95034478*c,f=.401288*l+.650173*d-.051461*p,u=-.250268*l+1.204414*d+.045854*p,h=-.002079*l+.048952*d+.953127*p,m=t.rgbD[0]*f,g=t.rgbD[1]*u,v=t.rgbD[2]*h,w=Math.pow(t.fl*Math.abs(m)/100,.42),b=Math.pow(t.fl*Math.abs(g)/100,.42),k=Math.pow(t.fl*Math.abs(v)/100,.42),y=400*We(m)*w/(w+27.13),C=400*We(g)*b/(b+27.13),E=400*We(v)*k/(k+27.13),S=(11*y+-12*C+E)/11,P=(y+C-2*E)/9,z=(20*y+20*C+21*E)/20,R=(40*y+20*C+E)/20,A=180*Math.atan2(P,S)/Math.PI,B=A<0?A+360:A>=360?A-360:A,I=B*Math.PI/180,M=R*t.nbb,L=100*Math.pow(M/t.aw,t.c*t.z),Y=4/t.c*Math.sqrt(L/100)*(t.aw+4)*t.fLRoot,H=B<20.14?B+360:B,F=5e4/13*(.25*(Math.cos(H*Math.PI/180+2)+3.8))*t.nc*t.ncb*Math.sqrt(S*S+P*P)/(z+.305),O=Math.pow(F,.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),N=O*Math.sqrt(L/100),V=N*t.fLRoot,X=50*Math.sqrt(O*t.c/(t.aw+4)),G=(1+100*.007)*L/(1+.007*L),U=1/.0228*Math.log(1+.0228*V),te=U*Math.cos(I),q=U*Math.sin(I);return new a(B,N,L,Y,V,X,G,te,q)}static fromJch(e,t,r){return a.fromJchInViewingConditions(e,t,r,rt.DEFAULT)}static fromJchInViewingConditions(e,t,r,o){let n=4/o.c*Math.sqrt(e/100)*(o.aw+4)*o.fLRoot,s=t*o.fLRoot,c=t/Math.sqrt(e/100),l=50*Math.sqrt(c*o.c/(o.aw+4)),d=r*Math.PI/180,p=(1+100*.007)*e/(1+.007*e),f=1/.0228*Math.log(1+.0228*s),u=f*Math.cos(d),h=f*Math.sin(d);return new a(r,t,e,n,s,l,p,u,h)}static fromUcs(e,t,r){return a.fromUcsInViewingConditions(e,t,r,rt.DEFAULT)}static fromUcsInViewingConditions(e,t,r,o){let n=t,s=r,c=Math.sqrt(n*n+s*s),l=(Math.exp(.0228*c)-1)/.0228/o.fLRoot,d=Math.atan2(s,n)*(180/Math.PI);d<0&&(d+=360);let p=e/(1-.007*(e-100));return a.fromJchInViewingConditions(p,l,d,o)}toInt(){return this.viewed(rt.DEFAULT)}viewed(e){let t=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),r=Math.pow(t/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),o=this.hue*Math.PI/180,n=.25*(Math.cos(o+2)+3.8),s=e.aw*Math.pow(this.j/100,1/e.c/e.z),c=n*(5e4/13)*e.nc*e.ncb,l=s/e.nbb,d=Math.sin(o),p=Math.cos(o),f=23*(l+.305)*r/(23*c+11*r*p+108*r*d),u=f*p,h=f*d,m=(460*l+451*u+288*h)/1403,g=(460*l-891*u-261*h)/1403,v=(460*l-220*u-6300*h)/1403,w=Math.max(0,27.13*Math.abs(m)/(400-Math.abs(m))),b=We(m)*(100/e.fl)*Math.pow(w,1/.42),k=Math.max(0,27.13*Math.abs(g)/(400-Math.abs(g))),y=We(g)*(100/e.fl)*Math.pow(k,1/.42),C=Math.max(0,27.13*Math.abs(v)/(400-Math.abs(v))),E=We(v)*(100/e.fl)*Math.pow(C,1/.42),S=b/e.rgbD[0],P=y/e.rgbD[1],z=E/e.rgbD[2];return Bd(1.86206786*S-1.01125463*P+.14918677*z,.38752654*S+.62144744*P-.00897398*z,-.0158415*S-.03412294*P+1.04996444*z)}static fromXyzInViewingConditions(e,t,r,o){let n=.401288*e+.650173*t-.051461*r,s=-.250268*e+1.204414*t+.045854*r,c=-.002079*e+.048952*t+.953127*r,l=o.rgbD[0]*n,d=o.rgbD[1]*s,p=o.rgbD[2]*c,f=Math.pow(o.fl*Math.abs(l)/100,.42),u=Math.pow(o.fl*Math.abs(d)/100,.42),h=Math.pow(o.fl*Math.abs(p)/100,.42),m=400*We(l)*f/(f+27.13),g=400*We(d)*u/(u+27.13),v=400*We(p)*h/(h+27.13),w=(11*m+-12*g+v)/11,b=(m+g-2*v)/9,k=(20*m+20*g+21*v)/20,y=(40*m+20*g+v)/20,C=180*Math.atan2(b,w)/Math.PI,E=C<0?C+360:C>=360?C-360:C,S=E*Math.PI/180,P=y*o.nbb,z=100*Math.pow(P/o.aw,o.c*o.z),R=4/o.c*Math.sqrt(z/100)*(o.aw+4)*o.fLRoot,A=E<20.14?E+360:E,B=5e4/13*(1/4*(Math.cos(A*Math.PI/180+2)+3.8))*o.nc*o.ncb*Math.sqrt(w*w+b*b)/(k+.305),I=Math.pow(B,.9)*Math.pow(1.64-Math.pow(.29,o.n),.73),M=I*Math.sqrt(z/100),L=M*o.fLRoot,Y=50*Math.sqrt(I*o.c/(o.aw+4)),H=(1+100*.007)*z/(1+.007*z),F=Math.log(1+.0228*L)/.0228,O=F*Math.cos(S),N=F*Math.sin(S);return new a(E,M,z,R,L,Y,H,O,N)}xyzInViewingConditions(e){let t=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),r=Math.pow(t/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),o=this.hue*Math.PI/180,n=.25*(Math.cos(o+2)+3.8),s=e.aw*Math.pow(this.j/100,1/e.c/e.z),c=n*(5e4/13)*e.nc*e.ncb,l=s/e.nbb,d=Math.sin(o),p=Math.cos(o),f=23*(l+.305)*r/(23*c+11*r*p+108*r*d),u=f*p,h=f*d,m=(460*l+451*u+288*h)/1403,g=(460*l-891*u-261*h)/1403,v=(460*l-220*u-6300*h)/1403,w=Math.max(0,27.13*Math.abs(m)/(400-Math.abs(m))),b=We(m)*(100/e.fl)*Math.pow(w,1/.42),k=Math.max(0,27.13*Math.abs(g)/(400-Math.abs(g))),y=We(g)*(100/e.fl)*Math.pow(k,1/.42),C=Math.max(0,27.13*Math.abs(v)/(400-Math.abs(v))),E=We(v)*(100/e.fl)*Math.pow(C,1/.42),S=b/e.rgbD[0],P=y/e.rgbD[1],z=E/e.rgbD[2];return[1.86206786*S-1.01125463*P+.14918677*z,.38752654*S+.62144744*P-.00897398*z,-.0158415*S-.03412294*P+1.04996444*z]}},ft=class a{static sanitizeRadians(e){return(e+8*Math.PI)%(2*Math.PI)}static trueDelinearized(e){let t=e/100,r=0;return r=t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,255*r}static chromaticAdaptation(e){let t=Math.pow(Math.abs(e),.42);return 400*We(e)*t/(t+27.13)}static hueOf(e){let t=ua(e,a.SCALED_DISCOUNT_FROM_LINRGB),r=a.chromaticAdaptation(t[0]),o=a.chromaticAdaptation(t[1]),n=a.chromaticAdaptation(t[2]),s=(11*r+-12*o+n)/11,c=(r+o-2*n)/9;return Math.atan2(c,s)}static areInCyclicOrder(e,t,r){return a.sanitizeRadians(t-e)100.01||C[1]>100.01||C[2]>100.01?0:oo(C);o-=(z-r)*o/(2*z)}return 0}static solveToInt(e,t,r){if(t<1e-4||r<1e-4||r>99.9999)return Dd(r);let o=(e=va(e))/180*Math.PI,n=$t(r),s=a.findResultByJ(o,t,n);return s!==0?s:oo(a.bisectToLimit(n,o))}static solveToCam(e,t,r){return Ke.fromInt(a.solveToInt(e,t,r))}};ft.SCALED_DISCOUNT_FROM_LINRGB=[[.001200833568784504,.002389694492170889,.0002795742885861124],[.0005891086651375999,.0029785502573438758,.0003270666104008398],[.00010146692491640572,.0005364214359186694,.0032979401770712076]],ft.LINRGB_FROM_SCALED_DISCOUNT=[[1373.2198709594231,-1100.4251190754821,-7.278681089101213],[-271.815969077903,559.6580465940733,-32.46047482791194],[1.9622899599665666,-57.173814538844006,308.7233197812385]],ft.Y_FROM_LINRGB=[.2126,.7152,.0722],ft.CRITICAL_PLANES=[.015176349177441876,.045529047532325624,.07588174588720938,.10623444424209313,.13658714259697685,.16693984095186062,.19729253930674434,.2276452376616281,.2579979360165119,.28835063437139563,.3188300904430532,.350925934958123,.3848314933096426,.42057480301049466,.458183274052838,.4976837250274023,.5391024159806381,.5824650784040898,.6277969426914107,.6751227633498623,.7244668422128921,.775853049866786,.829304845476233,.8848452951698498,.942497089126609,1.0022825574869039,1.0642236851973577,1.1283421258858297,1.1946592148522128,1.2631959812511864,1.3339731595349034,1.407011200216447,1.4823302800086415,1.5599503113873272,1.6398909516233677,1.7221716113234105,1.8068114625156377,1.8938294463134073,1.9832442801866852,2.075074464868551,2.1693382909216234,2.2660538449872063,2.36523901573795,2.4669114995532007,2.5710888059345764,2.6777882626779785,2.7870270208169257,2.898822059350997,3.0131901897720907,3.1301480604002863,3.2497121605402226,3.3718988244681087,3.4967242352587946,3.624204428461639,3.754355295633311,3.887192587735158,4.022731918402185,4.160988767090289,4.301978482107941,4.445716283538092,4.592217266055746,4.741496401646282,4.893568542229298,5.048448422192488,5.20615066083972,5.3666897647573375,5.5300801301023865,5.696336044816294,5.865471690767354,6.037501145825082,6.212438385869475,6.390297286737924,6.571091626112461,6.7548350853498045,6.941541251256611,7.131223617812143,7.323895587840543,7.5195704746346665,7.7182615035334345,7.919981813454504,8.124744458384042,8.332562408825165,8.543448553206703,8.757415699253682,8.974476575321063,9.194643831691977,9.417930041841839,9.644347703669503,9.873909240696694,10.106627003236781,10.342513269534024,10.58158024687427,10.8238400726681,11.069304815507364,11.317986476196008,11.569896988756009,11.825048221409341,12.083451977536606,12.345119996613247,12.610063955123938,12.878295467455942,13.149826086772048,13.42466730586372,13.702830557985108,13.984327217668513,14.269168601521828,14.55736596900856,14.848930523210871,15.143873411576273,15.44220572664832,15.743938506781891,16.04908273684337,16.35764934889634,16.66964922287304,16.985093187232053,17.30399201960269,17.62635644741625,17.95219714852476,18.281524751807332,18.614349837764564,18.95068293910138,19.290534541298456,19.633915083172692,19.98083495742689,20.331304511189067,20.685334046541502,21.042933821039977,21.404114048223256,21.76888489811322,22.137256497705877,22.50923893145328,22.884842241736916,23.264076429332462,23.6469514538663,24.033477234264016,24.42366364919083,24.817520537484558,25.21505769858089,25.61628489293138,26.021211842414342,26.429848230738664,26.842203703840827,27.258287870275353,27.678110301598522,28.10168053274597,28.529008062403893,28.96010235337422,29.39497283293396,29.83362889318845,30.276079891419332,30.722335150426627,31.172403958865512,31.62629557157785,32.08401920991837,32.54558406207592,33.010999283389665,33.4802739966603,33.953417292456834,34.430438229418264,34.911345834551085,35.39614910352207,35.88485700094671,36.37747846067349,36.87402238606382,37.37449765026789,37.87891309649659,38.38727753828926,38.89959975977785,39.41588851594697,39.93615253289054,40.460400508064545,40.98864111053629,41.520882981230194,42.05713473317016,42.597404951718396,43.141702194811224,43.6900349931913,44.24241185063697,44.798841244188324,45.35933162437017,45.92389141541209,46.49252901546552,47.065252796817916,47.64207110610409,48.22299226451468,48.808024568002054,49.3971762874833,49.9904556690408,50.587870934119984,51.189430279724725,51.79514187861014,52.40501387947288,53.0190544071392,53.637271562750364,54.259673423945976,54.88626804504493,55.517063457223934,56.15206766869424,56.79128866487574,57.43473440856916,58.08241284012621,58.734331877617365,59.39049941699807,60.05092333227251,60.715611475655585,61.38457167773311,62.057811747619894,62.7353394731159,63.417162620860914,64.10328893648692,64.79372614476921,65.48848194977529,66.18756403501224,66.89098006357258,67.59873767827808,68.31084450182222,69.02730813691093,69.74813616640164,70.47333615344107,71.20291564160104,71.93688215501312,72.67524319850172,73.41800625771542,74.16517879925733,74.9167682708136,75.67278210128072,76.43322770089146,77.1981124613393,77.96744375590167,78.74122893956174,79.51947534912904,80.30219030335869,81.08938110306934,81.88105503125999,82.67721935322541,83.4778813166706,84.28304815182372,85.09272707154808,85.90692527145302,86.72564993000343,87.54890820862819,88.3767072518277,89.2090541872801,90.04595612594655,90.88742016217518,91.73345337380438,92.58406282226491,93.43925555268066,94.29903859396902,95.16341895893969,96.03240364439274,96.9059996312159,97.78421388448044,98.6670533535366,99.55452497210776];var Ye=class a{static from(e,t,r){return new a(ft.solveToInt(e,t,r))}static fromInt(e){return new a(e)}toInt(){return this.argb}get hue(){return this.internalHue}set hue(e){this.setInternalState(ft.solveToInt(e,this.internalChroma,this.internalTone))}get chroma(){return this.internalChroma}set chroma(e){this.setInternalState(ft.solveToInt(this.internalHue,e,this.internalTone))}get tone(){return this.internalTone}set tone(e){this.setInternalState(ft.solveToInt(this.internalHue,this.internalChroma,e))}constructor(e){this.argb=e;let t=Ke.fromInt(e);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=ma(e),this.argb=e}setInternalState(e){let t=Ke.fromInt(e);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=ma(e),this.argb=e}inViewingConditions(e){let t=Ke.fromInt(this.toInt()).xyzInViewingConditions(e),r=Ke.fromXyzInViewingConditions(t[0],t[1],t[2],rt.make());return a.from(r.hue,r.chroma,ha(t[1]))}},ga=class a{static harmonize(e,t){let r=Ye.fromInt(e),o=Ye.fromInt(t),n=Ad(r.hue,o.hue),s=Math.min(.5*n,15),c=va(r.hue+s*zd(r.hue,o.hue));return Ye.from(c,r.chroma,r.tone).toInt()}static hctHue(e,t,r){let o=a.cam16Ucs(e,t,r),n=Ke.fromInt(o),s=Ke.fromInt(e);return Ye.from(n.hue,s.chroma,ma(e)).toInt()}static cam16Ucs(e,t,r){let o=Ke.fromInt(e),n=Ke.fromInt(t),s=o.jstar,c=o.astar,l=o.bstar,d=s+(n.jstar-s)*r,p=c+(n.astar-c)*r,f=l+(n.bstar-l)*r;return Ke.fromUcs(d,p,f).toInt()}},je=class a{static ratioOfTones(e,t){return e=zr(0,100,e),t=zr(0,100,t),a.ratioOfYs($t(e),$t(t))}static ratioOfYs(e,t){let r=e>t?e:t;return(r+5)/((r===t?e:t)+5)}static lighter(e,t){if(e<0||e>100)return-1;let r=$t(e),o=t*(r+5)-5,n=a.ratioOfYs(o,r),s=Math.abs(n-t);if(n.04)return-1;let c=ha(o)+.4;return c<0||c>100?-1:c}static darker(e,t){if(e<0||e>100)return-1;let r=$t(e),o=(r+5)/t-5,n=a.ratioOfYs(r,o),s=Math.abs(n-t);if(n.04)return-1;let c=ha(o)-.4;return c<0||c>100?-1:c}static lighterUnsafe(e,t){let r=a.lighter(e,t);return r<0?100:r}static darkerUnsafe(e,t){let r=a.darker(e,t);return r<0?0:r}},ba=class a{static isDisliked(e){let t=Math.round(e.hue)>=90&&Math.round(e.hue)<=111,r=Math.round(e.chroma)>16,o=Math.round(e.tone)<65;return t&&r&&o}static fixIfDisliked(e){return a.isDisliked(e)?Ye.from(e.hue,e.chroma,70):e}},se=class a{static fromPalette(e){return new a(e.name??"",e.palette,e.tone,e.isBackground??!1,e.background,e.secondBackground,e.contrastCurve,e.toneDeltaPair)}constructor(e,t,r,o,n,s,c,l){if(this.name=e,this.palette=t,this.tone=r,this.isBackground=o,this.background=n,this.secondBackground=s,this.contrastCurve=c,this.toneDeltaPair=l,this.hctCache=new Map,!n&&s)throw new Error(`Color ${e} has secondBackgrounddefined, but background is not defined.`);if(!n&&c)throw new Error(`Color ${e} has contrastCurvedefined, but background is not defined.`);if(n&&!c)throw new Error(`Color ${e} has backgrounddefined, but contrastCurve is not defined.`)}getArgb(e){return this.getHct(e).toInt()}getHct(e){let t=this.hctCache.get(e);if(t!=null)return t;let r=this.getTone(e),o=this.palette(e).getHct(r);return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(e,o),o}getTone(e){let t=e.contrastLevel<0;if(this.toneDeltaPair){let r=this.toneDeltaPair(e),o=r.roleA,n=r.roleB,s=r.delta,c=r.polarity,l=r.stayTogether,d=this.background(e).getTone(e),p=c==="nearer"||c==="lighter"&&!e.isDark||c==="darker"&&e.isDark,f=p?o:n,u=p?n:o,h=this.name===f.name,m=e.isDark?1:-1,g=f.contrastCurve.getContrast(e.contrastLevel),v=u.contrastCurve.getContrast(e.contrastLevel),w=f.tone(e),b=je.ratioOfTones(d,w)>=g?w:a.foregroundTone(d,g),k=u.tone(e),y=je.ratioOfTones(d,k)>=v?k:a.foregroundTone(d,v);return t&&(b=a.foregroundTone(d,g),y=a.foregroundTone(d,v)),(y-b)*m>=s||(y=zr(0,100,b+s*m),(y-b)*m>=s||(b=zr(0,100,y-s*m))),50<=b&&b<60?m>0?(b=60,y=Math.max(y,b+s*m)):(b=49,y=Math.min(y,b+s*m)):50<=y&&y<60&&(l?m>0?(b=60,y=Math.max(y,b+s*m)):(b=49,y=Math.min(y,b+s*m)):y=m>0?60:49),h?b:y}{let r=this.tone(e);if(this.background==null)return r;let o=this.background(e).getTone(e),n=this.contrastCurve.getContrast(e.contrastLevel);if(je.ratioOfTones(o,r)>=n||(r=a.foregroundTone(o,n)),t&&(r=a.foregroundTone(o,n)),this.isBackground&&50<=r&&r<60&&(r=je.ratioOfTones(49,o)>=n?49:60),this.secondBackground){let[s,c]=[this.background,this.secondBackground],[l,d]=[s(e).getTone(e),c(e).getTone(e)],[p,f]=[Math.max(l,d),Math.min(l,d)];if(je.ratioOfTones(p,r)>=n&&je.ratioOfTones(f,r)>=n)return r;let u=je.lighter(p,n),h=je.darker(f,n),m=[];return u!==-1&&m.push(u),h!==-1&&m.push(h),a.tonePrefersLightForeground(l)||a.tonePrefersLightForeground(d)?u<0?100:u:m.length===1?m[0]:h<0?0:h}return r}}static foregroundTone(e,t){let r=je.lighterUnsafe(e,t),o=je.darkerUnsafe(e,t),n=je.ratioOfTones(r,e),s=je.ratioOfTones(o,e);if(a.tonePrefersLightForeground(e)){let c=Math.abs(n-s)<.1&&n=t||n>=s||c?r:o}return s>=t||s>=n?o:r}static tonePrefersLightForeground(e){return Math.round(e)<60}static toneAllowsLightForeground(e){return Math.round(e)<=49}static enableLightForeground(e){return a.tonePrefersLightForeground(e)&&!a.toneAllowsLightForeground(e)?49:e}},cr;(function(a){a[a.MONOCHROME=0]="MONOCHROME",a[a.NEUTRAL=1]="NEUTRAL",a[a.TONAL_SPOT=2]="TONAL_SPOT",a[a.VIBRANT=3]="VIBRANT",a[a.EXPRESSIVE=4]="EXPRESSIVE",a[a.FIDELITY=5]="FIDELITY",a[a.CONTENT=6]="CONTENT",a[a.RAINBOW=7]="RAINBOW",a[a.FRUIT_SALAD=8]="FRUIT_SALAD"})(cr||(cr={}));var ke=class{constructor(e,t,r,o){this.low=e,this.normal=t,this.medium=r,this.high=o}getContrast(e){return e<=-1?this.low:e<0?lr(this.low,this.normal,(e- -1)/1):e<.5?lr(this.normal,this.medium,(e-0)/.5):e<1?lr(this.medium,this.high,(e-.5)/.5):this.high}},Ve=class{constructor(e,t,r,o,n){this.roleA=e,this.roleB=t,this.delta=r,this.polarity=o,this.stayTogether=n}};function Nt(a){return a.variant===cr.FIDELITY||a.variant===cr.CONTENT}function Re(a){return a.variant===cr.MONOCHROME}function Fd(a,e,t,r){let o=t,n=Ye.from(a,e,t);if(n.chromac.chroma||Math.abs(c.chroma-e)<.4)break;Math.abs(c.chroma-e)a.primaryPalette,tone:a=>a.primaryPalette.keyColor.tone}),W.secondaryPaletteKeyColor=se.fromPalette({name:"secondary_palette_key_color",palette:a=>a.secondaryPalette,tone:a=>a.secondaryPalette.keyColor.tone}),W.tertiaryPaletteKeyColor=se.fromPalette({name:"tertiary_palette_key_color",palette:a=>a.tertiaryPalette,tone:a=>a.tertiaryPalette.keyColor.tone}),W.neutralPaletteKeyColor=se.fromPalette({name:"neutral_palette_key_color",palette:a=>a.neutralPalette,tone:a=>a.neutralPalette.keyColor.tone}),W.neutralVariantPaletteKeyColor=se.fromPalette({name:"neutral_variant_palette_key_color",palette:a=>a.neutralVariantPalette,tone:a=>a.neutralVariantPalette.keyColor.tone}),W.background=se.fromPalette({name:"background",palette:a=>a.neutralPalette,tone:a=>a.isDark?6:98,isBackground:!0}),W.onBackground=se.fromPalette({name:"on_background",palette:a=>a.neutralPalette,tone:a=>a.isDark?90:10,background:a=>W.background,contrastCurve:new ke(3,3,4.5,7)}),W.surface=se.fromPalette({name:"surface",palette:a=>a.neutralPalette,tone:a=>a.isDark?6:98,isBackground:!0}),W.surfaceDim=se.fromPalette({name:"surface_dim",palette:a=>a.neutralPalette,tone:a=>a.isDark?6:87,isBackground:!0}),W.surfaceBright=se.fromPalette({name:"surface_bright",palette:a=>a.neutralPalette,tone:a=>a.isDark?24:98,isBackground:!0}),W.surfaceContainerLowest=se.fromPalette({name:"surface_container_lowest",palette:a=>a.neutralPalette,tone:a=>a.isDark?4:100,isBackground:!0}),W.surfaceContainerLow=se.fromPalette({name:"surface_container_low",palette:a=>a.neutralPalette,tone:a=>a.isDark?10:96,isBackground:!0}),W.surfaceContainer=se.fromPalette({name:"surface_container",palette:a=>a.neutralPalette,tone:a=>a.isDark?12:94,isBackground:!0}),W.surfaceContainerHigh=se.fromPalette({name:"surface_container_high",palette:a=>a.neutralPalette,tone:a=>a.isDark?17:92,isBackground:!0}),W.surfaceContainerHighest=se.fromPalette({name:"surface_container_highest",palette:a=>a.neutralPalette,tone:a=>a.isDark?22:90,isBackground:!0}),W.onSurface=se.fromPalette({name:"on_surface",palette:a=>a.neutralPalette,tone:a=>a.isDark?90:10,background:a=>W.highestSurface(a),contrastCurve:new ke(4.5,7,11,21)}),W.surfaceVariant=se.fromPalette({name:"surface_variant",palette:a=>a.neutralVariantPalette,tone:a=>a.isDark?30:90,isBackground:!0}),W.onSurfaceVariant=se.fromPalette({name:"on_surface_variant",palette:a=>a.neutralVariantPalette,tone:a=>a.isDark?80:30,background:a=>W.highestSurface(a),contrastCurve:new ke(3,4.5,7,11)}),W.inverseSurface=se.fromPalette({name:"inverse_surface",palette:a=>a.neutralPalette,tone:a=>a.isDark?90:20}),W.inverseOnSurface=se.fromPalette({name:"inverse_on_surface",palette:a=>a.neutralPalette,tone:a=>a.isDark?20:95,background:a=>W.inverseSurface,contrastCurve:new ke(4.5,7,11,21)}),W.outline=se.fromPalette({name:"outline",palette:a=>a.neutralVariantPalette,tone:a=>a.isDark?60:50,background:a=>W.highestSurface(a),contrastCurve:new ke(1.5,3,4.5,7)}),W.outlineVariant=se.fromPalette({name:"outline_variant",palette:a=>a.neutralVariantPalette,tone:a=>a.isDark?30:80,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7)}),W.shadow=se.fromPalette({name:"shadow",palette:a=>a.neutralPalette,tone:a=>0}),W.scrim=se.fromPalette({name:"scrim",palette:a=>a.neutralPalette,tone:a=>0}),W.surfaceTint=se.fromPalette({name:"surface_tint",palette:a=>a.primaryPalette,tone:a=>a.isDark?80:40,isBackground:!0}),W.primary=se.fromPalette({name:"primary",palette:a=>a.primaryPalette,tone:a=>Re(a)?a.isDark?100:0:a.isDark?80:40,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(3,4.5,7,11),toneDeltaPair:a=>new Ve(W.primaryContainer,W.primary,15,"nearer",!1)}),W.onPrimary=se.fromPalette({name:"on_primary",palette:a=>a.primaryPalette,tone:a=>Re(a)?a.isDark?10:90:a.isDark?20:100,background:a=>W.primary,contrastCurve:new ke(4.5,7,11,21)}),W.primaryContainer=se.fromPalette({name:"primary_container",palette:a=>a.primaryPalette,tone:a=>Nt(a)?fa(a.sourceColorHct,a):Re(a)?a.isDark?85:25:a.isDark?30:90,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.primaryContainer,W.primary,15,"nearer",!1)}),W.onPrimaryContainer=se.fromPalette({name:"on_primary_container",palette:a=>a.primaryPalette,tone:a=>Nt(a)?se.foregroundTone(W.primaryContainer.tone(a),4.5):Re(a)?a.isDark?0:100:a.isDark?90:10,background:a=>W.primaryContainer,contrastCurve:new ke(4.5,7,11,21)}),W.inversePrimary=se.fromPalette({name:"inverse_primary",palette:a=>a.primaryPalette,tone:a=>a.isDark?40:80,background:a=>W.inverseSurface,contrastCurve:new ke(3,4.5,7,11)}),W.secondary=se.fromPalette({name:"secondary",palette:a=>a.secondaryPalette,tone:a=>a.isDark?80:40,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(3,4.5,7,11),toneDeltaPair:a=>new Ve(W.secondaryContainer,W.secondary,15,"nearer",!1)}),W.onSecondary=se.fromPalette({name:"on_secondary",palette:a=>a.secondaryPalette,tone:a=>Re(a)?a.isDark?10:100:a.isDark?20:100,background:a=>W.secondary,contrastCurve:new ke(4.5,7,11,21)}),W.secondaryContainer=se.fromPalette({name:"secondary_container",palette:a=>a.secondaryPalette,tone:a=>{let e=a.isDark?30:90;if(Re(a))return a.isDark?30:85;if(!Nt(a))return e;let t=Fd(a.secondaryPalette.hue,a.secondaryPalette.chroma,e,!a.isDark);return t=fa(a.secondaryPalette.getHct(t),a),t},isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.secondaryContainer,W.secondary,15,"nearer",!1)}),W.onSecondaryContainer=se.fromPalette({name:"on_secondary_container",palette:a=>a.secondaryPalette,tone:a=>Nt(a)?se.foregroundTone(W.secondaryContainer.tone(a),4.5):a.isDark?90:10,background:a=>W.secondaryContainer,contrastCurve:new ke(4.5,7,11,21)}),W.tertiary=se.fromPalette({name:"tertiary",palette:a=>a.tertiaryPalette,tone:a=>Re(a)?a.isDark?90:25:a.isDark?80:40,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(3,4.5,7,11),toneDeltaPair:a=>new Ve(W.tertiaryContainer,W.tertiary,15,"nearer",!1)}),W.onTertiary=se.fromPalette({name:"on_tertiary",palette:a=>a.tertiaryPalette,tone:a=>Re(a)?a.isDark?10:90:a.isDark?20:100,background:a=>W.tertiary,contrastCurve:new ke(4.5,7,11,21)}),W.tertiaryContainer=se.fromPalette({name:"tertiary_container",palette:a=>a.tertiaryPalette,tone:a=>{if(Re(a))return a.isDark?60:49;if(!Nt(a))return a.isDark?30:90;let e=fa(a.tertiaryPalette.getHct(a.sourceColorHct.tone),a),t=a.tertiaryPalette.getHct(e);return ba.fixIfDisliked(t).tone},isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.tertiaryContainer,W.tertiary,15,"nearer",!1)}),W.onTertiaryContainer=se.fromPalette({name:"on_tertiary_container",palette:a=>a.tertiaryPalette,tone:a=>Re(a)?a.isDark?0:100:Nt(a)?se.foregroundTone(W.tertiaryContainer.tone(a),4.5):a.isDark?90:10,background:a=>W.tertiaryContainer,contrastCurve:new ke(4.5,7,11,21)}),W.error=se.fromPalette({name:"error",palette:a=>a.errorPalette,tone:a=>a.isDark?80:40,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(3,4.5,7,11),toneDeltaPair:a=>new Ve(W.errorContainer,W.error,15,"nearer",!1)}),W.onError=se.fromPalette({name:"on_error",palette:a=>a.errorPalette,tone:a=>a.isDark?20:100,background:a=>W.error,contrastCurve:new ke(4.5,7,11,21)}),W.errorContainer=se.fromPalette({name:"error_container",palette:a=>a.errorPalette,tone:a=>a.isDark?30:90,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.errorContainer,W.error,15,"nearer",!1)}),W.onErrorContainer=se.fromPalette({name:"on_error_container",palette:a=>a.errorPalette,tone:a=>a.isDark?90:10,background:a=>W.errorContainer,contrastCurve:new ke(4.5,7,11,21)}),W.primaryFixed=se.fromPalette({name:"primary_fixed",palette:a=>a.primaryPalette,tone:a=>Re(a)?40:90,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.primaryFixed,W.primaryFixedDim,10,"lighter",!0)}),W.primaryFixedDim=se.fromPalette({name:"primary_fixed_dim",palette:a=>a.primaryPalette,tone:a=>Re(a)?30:80,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.primaryFixed,W.primaryFixedDim,10,"lighter",!0)}),W.onPrimaryFixed=se.fromPalette({name:"on_primary_fixed",palette:a=>a.primaryPalette,tone:a=>Re(a)?100:10,background:a=>W.primaryFixedDim,secondBackground:a=>W.primaryFixed,contrastCurve:new ke(4.5,7,11,21)}),W.onPrimaryFixedVariant=se.fromPalette({name:"on_primary_fixed_variant",palette:a=>a.primaryPalette,tone:a=>Re(a)?90:30,background:a=>W.primaryFixedDim,secondBackground:a=>W.primaryFixed,contrastCurve:new ke(3,4.5,7,11)}),W.secondaryFixed=se.fromPalette({name:"secondary_fixed",palette:a=>a.secondaryPalette,tone:a=>Re(a)?80:90,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.secondaryFixed,W.secondaryFixedDim,10,"lighter",!0)}),W.secondaryFixedDim=se.fromPalette({name:"secondary_fixed_dim",palette:a=>a.secondaryPalette,tone:a=>Re(a)?70:80,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.secondaryFixed,W.secondaryFixedDim,10,"lighter",!0)}),W.onSecondaryFixed=se.fromPalette({name:"on_secondary_fixed",palette:a=>a.secondaryPalette,tone:a=>10,background:a=>W.secondaryFixedDim,secondBackground:a=>W.secondaryFixed,contrastCurve:new ke(4.5,7,11,21)}),W.onSecondaryFixedVariant=se.fromPalette({name:"on_secondary_fixed_variant",palette:a=>a.secondaryPalette,tone:a=>Re(a)?25:30,background:a=>W.secondaryFixedDim,secondBackground:a=>W.secondaryFixed,contrastCurve:new ke(3,4.5,7,11)}),W.tertiaryFixed=se.fromPalette({name:"tertiary_fixed",palette:a=>a.tertiaryPalette,tone:a=>Re(a)?40:90,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.tertiaryFixed,W.tertiaryFixedDim,10,"lighter",!0)}),W.tertiaryFixedDim=se.fromPalette({name:"tertiary_fixed_dim",palette:a=>a.tertiaryPalette,tone:a=>Re(a)?30:80,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.tertiaryFixed,W.tertiaryFixedDim,10,"lighter",!0)}),W.onTertiaryFixed=se.fromPalette({name:"on_tertiary_fixed",palette:a=>a.tertiaryPalette,tone:a=>Re(a)?100:10,background:a=>W.tertiaryFixedDim,secondBackground:a=>W.tertiaryFixed,contrastCurve:new ke(4.5,7,11,21)}),W.onTertiaryFixedVariant=se.fromPalette({name:"on_tertiary_fixed_variant",palette:a=>a.tertiaryPalette,tone:a=>Re(a)?90:30,background:a=>W.tertiaryFixedDim,secondBackground:a=>W.tertiaryFixed,contrastCurve:new ke(3,4.5,7,11)});var qe=class a{static fromInt(e){let t=Ye.fromInt(e);return a.fromHct(t)}static fromHct(e){return new a(e.hue,e.chroma,e)}static fromHueAndChroma(e,t){return new a(e,t,a.createKeyColor(e,t))}constructor(e,t,r){this.hue=e,this.chroma=t,this.keyColor=r,this.cache=new Map}static createKeyColor(e,t){let r=Ye.from(e,t,50),o=Math.abs(r.chroma-t);for(let n=1;n<50;n+=1){if(Math.round(t)===Math.round(r.chroma))return r;let s=Ye.from(e,t,50+n),c=Math.abs(s.chroma-t);c>>0}function xt(a){return parseInt(a,16)}function po(a,e){e===void 0&&(e=[]);let t=St.of(a);return{source:a,schemes:{light:Ar.light(a),dark:Ar.dark(a)},palettes:{primary:t.a1,secondary:t.a2,tertiary:t.a3,neutral:t.n1,neutralVariant:t.n2,error:t.error},customColors:e.map(r=>Vd(a,r))}}function Vd(a,e){let t=e.value,r=t,o=a;e.blend&&(t=ga.harmonize(r,o));let n=St.of(t).a1;return{color:e,value:t,light:{color:n.tone(40),onColor:n.tone(100),colorContainer:n.tone(90),onColorContainer:n.tone(10)},dark:{color:n.tone(80),onColor:n.tone(20),colorContainer:n.tone(30),onColorContainer:n.tone(90)}}}function fo(a){let e=Math.round,t=a.length,r={};return a.slice(0,3).toLowerCase()==="rgb"?(a=a.replace(" ","").split(","),r[0]=parseInt(a[0].slice(a[3].toLowerCase()==="a"?5:4),10),r[1]=parseInt(a[1],10),r[2]=parseInt(a[2],10),r[3]=a[3]?parseFloat(a[3]):-1):(t<6?a=parseInt(String(a[1])+a[1]+a[2]+a[2]+a[3]+a[3]+(t>4?String(a[4])+a[4]:""),16):a=parseInt(a.slice(1),16),r[0]=a>>16&255,r[1]=a>>8&255,r[2]=a&255,r[3]=t===9||t===5?e((a>>24&255)/255*1e4)/1e4:-1),r}function uo(a,e,t){t===void 0&&(t=.5);let r=Math.round;a=a.trim(),e=e.trim(),t=t<0?t*-1:t;let n=fo(a),s=fo(e);return e[0]==="r"?"rgb"+(e[3]==="a"?"a(":"(")+r((s[0]-n[0])*t+n[0])+","+r((s[1]-n[1])*t+n[1])+","+r((s[2]-n[2])*t+n[2])+(n[3]<0&&s[3]<0?"":","+(n[3]>-1&&s[3]>-1?r(((s[3]-n[3])*t+n[3])*1e4)/1e4:s[3]<0?n[3]:s[3]))+")":"#"+(4294967296+(n[3]>-1&&s[3]>-1?r(((s[3]-n[3])*t+n[3])*255):s[3]>-1?r(s[3]*255):n[3]>-1?r(n[3]*255):255)*16777216+r((s[0]-n[0])*t+n[0])*65536+r((s[1]-n[1])*t+n[1])*256+r((s[2]-n[2])*t+n[2])).toString(16).slice(n[3]>-1||s[3]>-1?1:3)}var mo=function(a){a===void 0&&(a="");let e=po(Mr(`#${a.replace("#","")}`));[.05,.08,.11,.12,.14].forEach((s,c)=>{e.schemes.light.props[`surface${c+1}`]=Mr(uo(Dt(e.schemes.light.props.surface),Dt(e.schemes.light.props.primary),s)),e.schemes.dark.props[`surface${c+1}`]=Mr(uo(Dt(e.schemes.dark.props.surface),Dt(e.schemes.dark.props.primary),s))});let t=s=>s.split("").map(c=>c.toUpperCase()===c&&c!=="-"&&c!=="7"?`-${c.toLowerCase()}`:c).join(""),r=s=>["tertiary","shadow","scrim","error","background"].filter(l=>s.toLowerCase().includes(l)).length>0,o={},n={};return Object.keys(e.schemes.light.props).forEach(s=>{r(s)||(o[t(`--f7-md-${s}`)]=Dt(e.schemes.light.props[s]))}),Object.keys(e.schemes.dark.props).forEach(s=>{r(s)||(n[t(`--f7-md-${s}`)]=Dt(e.schemes.dark.props[s]))}),{light:o,dark:n}};var ho=0;function Yd(){return ho+=1,ho}function at(a,e){a===void 0&&(a="xxxxxxxxxx"),e===void 0&&(e="0123456789abcdef");let t=e.length;return a.replace(/x/g,()=>e[Math.floor(Math.random()*t)])}var it=`
+var Wl=Object.defineProperty;var to=(a,e)=>{for(var t in e)Wl(a,t,{get:e[t],enumerable:!0})};var Tr={};to(Tr,{$:()=>ve,add:()=>Qc,addClass:()=>Zl,animate:()=>td,animationEnd:()=>hc,append:()=>Ic,appendTo:()=>Bc,attr:()=>Kl,blur:()=>od,change:()=>ud,children:()=>Uc,click:()=>id,closest:()=>Gc,css:()=>Ec,data:()=>rc,dataset:()=>ic,default:()=>Sd,detach:()=>Zc,each:()=>$c,empty:()=>Jc,eq:()=>Pc,filter:()=>Sc,find:()=>Xc,focus:()=>nd,focusin:()=>sd,focusout:()=>ld,hasClass:()=>_l,height:()=>vc,hide:()=>kc,html:()=>Tc,index:()=>Mc,insertAfter:()=>Lc,insertBefore:()=>Rc,is:()=>Ac,keydown:()=>dd,keypress:()=>pd,keyup:()=>cd,mousedown:()=>md,mouseenter:()=>bd,mouseleave:()=>vd,mousemove:()=>hd,mouseout:()=>wd,mouseover:()=>xd,mouseup:()=>gd,next:()=>Fc,nextAll:()=>Hc,off:()=>dc,offset:()=>xc,on:()=>cc,once:()=>pc,outerHeight:()=>wc,outerWidth:()=>bc,parent:()=>Wc,parents:()=>jc,prepend:()=>Oc,prependTo:()=>Dc,prev:()=>Vc,prevAll:()=>Yc,prop:()=>tc,remove:()=>qc,removeAttr:()=>ec,removeClass:()=>Ql,removeData:()=>ac,resize:()=>Ed,scroll:()=>$d,scrollLeft:()=>ed,scrollTo:()=>_c,scrollTop:()=>Kc,show:()=>yc,siblings:()=>Nc,stop:()=>rd,styles:()=>Cc,submit:()=>fd,text:()=>zc,toggleClass:()=>Jl,touchend:()=>yd,touchmove:()=>Cd,touchstart:()=>kd,transform:()=>sc,transition:()=>lc,transitionEnd:()=>mc,transitionStart:()=>uc,trigger:()=>fc,val:()=>oc,value:()=>nc,width:()=>gc});function ro(a){return a!==null&&typeof a=="object"&&"constructor"in a&&a.constructor===Object}function pa(a={},e={}){Object.keys(e).forEach(t=>{typeof a[t]>"u"?a[t]=e[t]:ro(e[t])&&ro(a[t])&&Object.keys(e[t]).length>0&&pa(a[t],e[t])})}var ao={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector(){return null},querySelectorAll(){return[]},getElementById(){return null},createEvent(){return{initEvent(){}}},createElement(){return{children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName(){return[]}}},createElementNS(){return{}},importNode(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function re(){let a=typeof document<"u"?document:{};return pa(a,ao),a}var jl={document:ao,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle(){return{getPropertyValue(){return""}}},Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia(){return{}},requestAnimationFrame(a){return typeof setTimeout>"u"?(a(),null):setTimeout(a,0)},cancelAnimationFrame(a){typeof setTimeout>"u"||clearTimeout(a)}};function Z(){let a=typeof window<"u"?window:{};return pa(a,jl),a}function Gl(a){let e=a.__proto__;Object.defineProperty(a,"__proto__",{get(){return e},set(t){e.__proto__=t}})}var pt=class extends Array{constructor(e){typeof e=="number"?super(e):(super(...e||[]),Gl(this))}};function sr(a=[]){let e=[];return a.forEach(t=>{Array.isArray(t)?e.push(...sr(t)):e.push(t)}),e}function io(a,e){return Array.prototype.filter.call(a,e)}function Xl(a){let e=[];for(let t=0;tt.toUpperCase())}function ql(a,e){if(typeof a!="string")return[a];let t=[],r=e.querySelectorAll(a);for(let o=0;o=0&&n.indexOf(">")>=0){let s="div";n.indexOf("t.split(" ")));return this.forEach(t=>{t.classList.add(...e)}),this}function Ql(...a){let e=sr(a.map(t=>t.split(" ")));return this.forEach(t=>{t.classList.remove(...e)}),this}function Jl(...a){let e=sr(a.map(t=>t.split(" ")));this.forEach(t=>{e.forEach(r=>{t.classList.toggle(r)})})}function _l(...a){let e=sr(a.map(t=>t.split(" ")));return io(this,t=>e.filter(r=>t.classList.contains(r)).length>0).length>0}function Kl(a,e){if(arguments.length===1&&typeof a=="string")return this[0]?this[0].getAttribute(a):void 0;for(let t=0;t"u"){if(t=this[0],!t)return;if(t.dom7ElementDataStorage&&a in t.dom7ElementDataStorage)return t.dom7ElementDataStorage[a];let r=t.getAttribute(`data-${a}`);return r||void 0}for(let r=0;r=0&&(e[Ul(r.name.split("data-")[1])]=r.value)}for(let t in e)e[t]==="false"?e[t]=!1:e[t]==="true"?e[t]=!0:parseFloat(e[t])===e[t]*1&&(e[t]*=1);return e}function oc(a){if(typeof a>"u"){let e=this[0];if(!e)return;if(e.multiple&&e.nodeName.toLowerCase()==="select"){let t=[];for(let r=0;r=0;else t.value=a}return this}function nc(a){return this.val(a)}function sc(a){for(let e=0;e=0;f-=1){let u=p[f];r&&u.listener===r||r&&u.listener&&u.listener.dom7proxy&&u.listener.dom7proxy===r?(d.removeEventListener(c,u.proxyListener,o),p.splice(f,1)):r||(d.removeEventListener(c,u.proxyListener,o),p.splice(f,1))}}}return this}function pc(...a){let e=this,[t,r,o,n]=a;typeof a[1]=="function"&&([t,o,n]=a,r=void 0);function s(...c){o.apply(this,c),e.off(t,r,s,n),s.dom7proxy&&delete s.dom7proxy}return s.dom7proxy=o,e.on(t,r,s,n)}function fc(...a){let e=Z(),t=a[0].split(" "),r=a[1];for(let o=0;op>0),c.dispatchEvent(l),c.dom7EventData=[],delete c.dom7EventData}}}return this}function uc(a){let e=this;function t(r){r.target===this&&(a.call(this,r),e.off("transitionstart",t))}return a&&e.on("transitionstart",t),this}function mc(a){let e=this;function t(r){r.target===this&&(a.call(this,r),e.off("transitionend",t))}return a&&e.on("transitionend",t),this}function hc(a){let e=this;function t(r){r.target===this&&(a.call(this,r),e.off("animationend",t))}return a&&e.on("animationend",t),this}function gc(){let a=Z();return this[0]===a?a.innerWidth:this.length>0?parseFloat(this.css("width")):null}function bc(a){if(this.length>0){if(a){let e=this.styles();return this[0].offsetWidth+parseFloat(e.getPropertyValue("margin-right"))+parseFloat(e.getPropertyValue("margin-left"))}return this[0].offsetWidth}return null}function vc(){let a=Z();return this[0]===a?a.innerHeight:this.length>0?parseFloat(this.css("height")):null}function wc(a){if(this.length>0){if(a){let e=this.styles();return this[0].offsetHeight+parseFloat(e.getPropertyValue("margin-top"))+parseFloat(e.getPropertyValue("margin-bottom"))}return this[0].offsetHeight}return null}function xc(){if(this.length>0){let a=Z(),e=re(),t=this[0],r=t.getBoundingClientRect(),o=e.body,n=t.clientTop||o.clientTop||0,s=t.clientLeft||o.clientLeft||0,c=t===a?a.scrollY:t.scrollTop,l=t===a?a.scrollX:t.scrollLeft;return{top:r.top+c-n,left:r.left+l-s}}return null}function kc(){for(let a=0;a{a.apply(e,[e,t])}),this):this}function Sc(a){let e=io(this,a);return ve(e)}function Tc(a){if(typeof a>"u")return this[0]?this[0].innerHTML:null;for(let e=0;e"u")return this[0]?this[0].textContent.trim():null;for(let e=0;e"u")return!1;if(typeof a=="string"){if(r.matches)return r.matches(a);if(r.webkitMatchesSelector)return r.webkitMatchesSelector(a);if(r.msMatchesSelector)return r.msMatchesSelector(a);for(o=ve(a),n=0;n"u")return this;let e=this.length;if(a>e-1)return ve([]);if(a<0){let t=e+a;return t<0?ve([]):ve([this[t]])}return ve([this[a]])}function Ic(...a){let e,t=re();for(let r=0;r=0;r-=1)this[t].insertBefore(o.childNodes[r],this[t].childNodes[0])}else if(a instanceof pt)for(r=0;r1)for(let r=0;r1)for(let r=0;r0?a?this[0].nextElementSibling&&ve(this[0].nextElementSibling).is(a)?ve([this[0].nextElementSibling]):ve([]):this[0].nextElementSibling?ve([this[0].nextElementSibling]):ve([]):ve([])}function Hc(a){let e=[],t=this[0];if(!t)return ve([]);for(;t.nextElementSibling;){let r=t.nextElementSibling;a?ve(r).is(a)&&e.push(r):e.push(r),t=r}return ve(e)}function Vc(a){if(this.length>0){let e=this[0];return a?e.previousElementSibling&&ve(e.previousElementSibling).is(a)?ve([e.previousElementSibling]):ve([]):e.previousElementSibling?ve([e.previousElementSibling]):ve([])}return ve([])}function Yc(a){let e=[],t=this[0];if(!t)return ve([]);for(;t.previousElementSibling;){let r=t.previousElementSibling;a?ve(r).is(a)&&e.push(r):e.push(r),t=r}return ve(e)}function Nc(a){return this.nextAll(a).add(this.prevAll(a))}function Wc(a){let e=[];for(let t=0;t"u"?ve([]):(e.is(a)||(e=e.parents(a).eq(0)),e)}function Xc(a){let e=[];for(let t=0;t"u"&&(n="swing"),this.each(function(){let l=this,d,p,f,u,h,m,g,v,w=r>0||r===0,b=t>0||t===0;if(typeof n>"u"&&(n="swing"),w&&(d=l.scrollTop,o||(l.scrollTop=r)),b&&(p=l.scrollLeft,o||(l.scrollLeft=t)),!o)return;w&&(f=l.scrollHeight-l.offsetHeight,h=Math.max(Math.min(r,f),0)),b&&(u=l.scrollWidth-l.offsetWidth,m=Math.max(Math.min(t,u),0));let k=null;w&&h===d&&(w=!1),b&&m===p&&(b=!1);function y(C=new Date().getTime()){k===null&&(k=C);let E=Math.max(Math.min((C-k)/o,1),0),S=n==="linear"?E:.5-Math.cos(E*Math.PI)/2,P;if(w&&(g=d+S*(h-d)),b&&(v=p+S*(m-p)),w&&h>d&&g>=h&&(l.scrollTop=h,P=!0),w&&hp&&v>=m&&(l.scrollLeft=m,P=!0),b&&m"u"?n.length>0?n[0].scrollTop:null:n.scrollTo(void 0,e,t,r,o)}function ed(...a){let[e,t,r,o]=a;a.length===3&&typeof r=="function"&&([e,t,o,r]=a);let n=this;return typeof e>"u"?n.length>0?n[0].scrollLeft:null:n.scrollTo(e,void 0,t,r,o)}function td(a,e){let t=Z(),r=this,o={props:Object.assign({},a),params:Object.assign({duration:300,easing:"swing"},e),elements:r,animating:!1,que:[],easingProgress(s,c){return s==="swing"?.5-Math.cos(c*Math.PI)/2:typeof s=="function"?s(c):c},stop(){o.frameId&&t.cancelAnimationFrame(o.frameId),o.animating=!1,o.elements.each(s=>{let c=s;delete c.dom7AnimateInstance}),o.que=[]},done(s){if(o.animating=!1,o.elements.each(c=>{let l=c;delete l.dom7AnimateInstance}),s&&s(r),o.que.length>0){let c=o.que.shift();o.animate(c[0],c[1])}},animate(s,c){if(o.animating)return o.que.push([s,c]),o;let l=[];o.elements.each((v,w)=>{let b,k,y,C,E;v.dom7AnimateInstance||(o.elements[w].dom7AnimateInstance=o),l[w]={container:v},Object.keys(s).forEach(S=>{b=t.getComputedStyle(v,null).getPropertyValue(S).replace(",","."),k=parseFloat(b),y=b.replace(k,""),C=parseFloat(s[S]),E=s[S]+y,l[w][S]={initialFullValue:b,initialValue:k,unit:y,finalValue:C,finalFullValue:E,currentValue:k}})});let d=null,p,f=0,u=0,h,m=!1;o.animating=!0;function g(){p=new Date().getTime();let v,w;m||(m=!0,c.begin&&c.begin(r)),d===null&&(d=p),c.progress&&c.progress(r,Math.max(Math.min((p-d)/c.duration,1),0),d+c.duration-p<0?0:d+c.duration-p,d),l.forEach(b=>{let k=b;h||k.done||Object.keys(s).forEach(y=>{if(h||k.done)return;v=Math.max(Math.min((p-d)/c.duration,1),0),w=o.easingProgress(c.easing,v);let{initialValue:C,finalValue:E,unit:S}=k[y];k[y].currentValue=C+w*(E-C);let P=k[y].currentValue;if((E>C&&P>=E||E"u"){for(let r=0;r{a!=="$"&&(ve.fn[a]=Tr[a])});var x=ve;var Pr={};to(Pr,{bindMethods:()=>ze,cancelAnimationFrame:()=>Nd,colorHexToRgb:()=>ut,colorHsbToHsl:()=>Qe,colorHslToHsb:()=>Xt,colorHslToRgb:()=>Rt,colorRgbToHex:()=>mt,colorRgbToHsl:()=>dr,colorThemeCSSProperties:()=>ya,colorThemeCSSStyles:()=>Wd,deleteProps:()=>he,eventNameToColonCase:()=>Ze,extend:()=>D,flattenArray:()=>Ut,getTranslate:()=>jt,id:()=>at,iosPreloaderContent:()=>ot,isObject:()=>Tt,mdPreloaderContent:()=>it,merge:()=>Gt,nextFrame:()=>De,nextTick:()=>$e,now:()=>Be,parseUrlQuery:()=>zt,requestAnimationFrame:()=>ka,serializeObject:()=>kt,uniqueNumber:()=>Yd});function We(a){return a<0?-1:a===0?0:1}function lr(a,e,t){return(1-t)*a+t*e}function Td(a,e,t){return te?e:t}function zr(a,e,t){return te?e:t}function va(a){return(a%=360)<0&&(a+=360),a}function zd(a,e){return va(e-a)<=180?1:-1}function Ad(a,e){return 180-Math.abs(Math.abs(a-e)-180)}function ua(a,e){return[a[0]*e[0][0]+a[1]*e[0][1]+a[2]*e[0][2],a[0]*e[1][0]+a[1]*e[1][1]+a[2]*e[1][2],a[0]*e[2][0]+a[1]*e[2][1]+a[2]*e[2][2]]}var Md=[[.41233895,.35762064,.18051042],[.2126,.7152,.0722],[.01932141,.11916382,.95034478]],Pd=[[3.2413774792388685,-1.5376652402851851,-.49885366846268053],[-.9691452513005321,1.8758853451067872,.04156585616912061],[.05562093689691305,-.20395524564742123,1.0571799111220335]],Id=[95.047,100,108.883];function wa(a,e,t){return(255<<24|(255&a)<<16|(255&e)<<8|255&t)>>>0}function oo(a){return wa(Ot(a[0]),Ot(a[1]),Ot(a[2]))}function no(a){return a>>16&255}function so(a){return a>>8&255}function lo(a){return 255&a}function Bd(a,e,t){let r=Pd,o=r[0][0]*a+r[0][1]*e+r[0][2]*t,n=r[1][0]*a+r[1][1]*e+r[1][2]*t,s=r[2][0]*a+r[2][1]*e+r[2][2]*t;return wa(Ot(o),Ot(n),Ot(s))}function Od(a){return ua([Wt(no(a)),Wt(so(a)),Wt(lo(a))],Md)}function Dd(a){let e=Ot($t(a));return wa(e,e,e)}function ma(a){return 116*co(Od(a)[1]/100)-16}function $t(a){return 100*Ld((a+16)/116)}function ha(a){return 116*co(a/100)-16}function Wt(a){let e=a/255;return e<=.040449936?e/12.92*100:100*Math.pow((e+.055)/1.055,2.4)}function Ot(a){let e=a/100,t=0;return t=e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055,Td(0,255,Math.round(255*t))}function Rd(){return Id}function co(a){return a>216/24389?Math.pow(a,1/3):(903.2962962962963*a+16)/116}function Ld(a){let e=a*a*a;return e>216/24389?e:(116*a-16)/903.2962962962963}var rt=class a{static make(e,t,r,o,n){e===void 0&&(e=Rd()),t===void 0&&(t=200/Math.PI*$t(50)/100),r===void 0&&(r=50),o===void 0&&(o=2),n===void 0&&(n=!1);let s=e,c=.401288*s[0]+.650173*s[1]+-.051461*s[2],l=-.250268*s[0]+1.204414*s[1]+.045854*s[2],d=-.002079*s[0]+.048952*s[1]+.953127*s[2],p=.8+o/10,f=p>=.9?lr(.59,.69,10*(p-.9)):lr(.525,.59,10*(p-.8)),u=n?1:p*(1-1/3.6*Math.exp((-t-42)/92));u=u>1?1:u<0?0:u;let h=p,m=[u*(100/c)+1-u,u*(100/l)+1-u,u*(100/d)+1-u],g=1/(5*t+1),v=g*g*g*g,w=1-v,b=v*t+.1*w*w*Math.cbrt(5*t),k=$t(r)/e[1],y=1.48+Math.sqrt(k),C=.725/Math.pow(k,.2),E=C,S=[Math.pow(b*m[0]*c/100,.42),Math.pow(b*m[1]*l/100,.42),Math.pow(b*m[2]*d/100,.42)],P=[400*S[0]/(S[0]+27.13),400*S[1]/(S[1]+27.13),400*S[2]/(S[2]+27.13)];return new a(k,(2*P[0]+P[1]+.05*P[2])*C,C,E,f,h,m,b,Math.pow(b,.25),y)}constructor(e,t,r,o,n,s,c,l,d,p){this.n=e,this.aw=t,this.nbb=r,this.ncb=o,this.c=n,this.nc=s,this.rgbD=c,this.fl=l,this.fLRoot=d,this.z=p}};rt.DEFAULT=rt.make();var Ke=class a{constructor(e,t,r,o,n,s,c,l,d){this.hue=e,this.chroma=t,this.j=r,this.q=o,this.m=n,this.s=s,this.jstar=c,this.astar=l,this.bstar=d}distance(e){let t=this.jstar-e.jstar,r=this.astar-e.astar,o=this.bstar-e.bstar,n=Math.sqrt(t*t+r*r+o*o);return 1.41*Math.pow(n,.63)}static fromInt(e){return a.fromIntInViewingConditions(e,rt.DEFAULT)}static fromIntInViewingConditions(e,t){let r=(65280&e)>>8,o=255&e,n=Wt((16711680&e)>>16),s=Wt(r),c=Wt(o),l=.41233895*n+.35762064*s+.18051042*c,d=.2126*n+.7152*s+.0722*c,p=.01932141*n+.11916382*s+.95034478*c,f=.401288*l+.650173*d-.051461*p,u=-.250268*l+1.204414*d+.045854*p,h=-.002079*l+.048952*d+.953127*p,m=t.rgbD[0]*f,g=t.rgbD[1]*u,v=t.rgbD[2]*h,w=Math.pow(t.fl*Math.abs(m)/100,.42),b=Math.pow(t.fl*Math.abs(g)/100,.42),k=Math.pow(t.fl*Math.abs(v)/100,.42),y=400*We(m)*w/(w+27.13),C=400*We(g)*b/(b+27.13),E=400*We(v)*k/(k+27.13),S=(11*y+-12*C+E)/11,P=(y+C-2*E)/9,z=(20*y+20*C+21*E)/20,R=(40*y+20*C+E)/20,A=180*Math.atan2(P,S)/Math.PI,B=A<0?A+360:A>=360?A-360:A,I=B*Math.PI/180,M=R*t.nbb,L=100*Math.pow(M/t.aw,t.c*t.z),Y=4/t.c*Math.sqrt(L/100)*(t.aw+4)*t.fLRoot,H=B<20.14?B+360:B,F=5e4/13*(.25*(Math.cos(H*Math.PI/180+2)+3.8))*t.nc*t.ncb*Math.sqrt(S*S+P*P)/(z+.305),O=Math.pow(F,.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),N=O*Math.sqrt(L/100),V=N*t.fLRoot,X=50*Math.sqrt(O*t.c/(t.aw+4)),G=(1+100*.007)*L/(1+.007*L),U=1/.0228*Math.log(1+.0228*V),te=U*Math.cos(I),q=U*Math.sin(I);return new a(B,N,L,Y,V,X,G,te,q)}static fromJch(e,t,r){return a.fromJchInViewingConditions(e,t,r,rt.DEFAULT)}static fromJchInViewingConditions(e,t,r,o){let n=4/o.c*Math.sqrt(e/100)*(o.aw+4)*o.fLRoot,s=t*o.fLRoot,c=t/Math.sqrt(e/100),l=50*Math.sqrt(c*o.c/(o.aw+4)),d=r*Math.PI/180,p=(1+100*.007)*e/(1+.007*e),f=1/.0228*Math.log(1+.0228*s),u=f*Math.cos(d),h=f*Math.sin(d);return new a(r,t,e,n,s,l,p,u,h)}static fromUcs(e,t,r){return a.fromUcsInViewingConditions(e,t,r,rt.DEFAULT)}static fromUcsInViewingConditions(e,t,r,o){let n=t,s=r,c=Math.sqrt(n*n+s*s),l=(Math.exp(.0228*c)-1)/.0228/o.fLRoot,d=Math.atan2(s,n)*(180/Math.PI);d<0&&(d+=360);let p=e/(1-.007*(e-100));return a.fromJchInViewingConditions(p,l,d,o)}toInt(){return this.viewed(rt.DEFAULT)}viewed(e){let t=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),r=Math.pow(t/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),o=this.hue*Math.PI/180,n=.25*(Math.cos(o+2)+3.8),s=e.aw*Math.pow(this.j/100,1/e.c/e.z),c=n*(5e4/13)*e.nc*e.ncb,l=s/e.nbb,d=Math.sin(o),p=Math.cos(o),f=23*(l+.305)*r/(23*c+11*r*p+108*r*d),u=f*p,h=f*d,m=(460*l+451*u+288*h)/1403,g=(460*l-891*u-261*h)/1403,v=(460*l-220*u-6300*h)/1403,w=Math.max(0,27.13*Math.abs(m)/(400-Math.abs(m))),b=We(m)*(100/e.fl)*Math.pow(w,1/.42),k=Math.max(0,27.13*Math.abs(g)/(400-Math.abs(g))),y=We(g)*(100/e.fl)*Math.pow(k,1/.42),C=Math.max(0,27.13*Math.abs(v)/(400-Math.abs(v))),E=We(v)*(100/e.fl)*Math.pow(C,1/.42),S=b/e.rgbD[0],P=y/e.rgbD[1],z=E/e.rgbD[2];return Bd(1.86206786*S-1.01125463*P+.14918677*z,.38752654*S+.62144744*P-.00897398*z,-.0158415*S-.03412294*P+1.04996444*z)}static fromXyzInViewingConditions(e,t,r,o){let n=.401288*e+.650173*t-.051461*r,s=-.250268*e+1.204414*t+.045854*r,c=-.002079*e+.048952*t+.953127*r,l=o.rgbD[0]*n,d=o.rgbD[1]*s,p=o.rgbD[2]*c,f=Math.pow(o.fl*Math.abs(l)/100,.42),u=Math.pow(o.fl*Math.abs(d)/100,.42),h=Math.pow(o.fl*Math.abs(p)/100,.42),m=400*We(l)*f/(f+27.13),g=400*We(d)*u/(u+27.13),v=400*We(p)*h/(h+27.13),w=(11*m+-12*g+v)/11,b=(m+g-2*v)/9,k=(20*m+20*g+21*v)/20,y=(40*m+20*g+v)/20,C=180*Math.atan2(b,w)/Math.PI,E=C<0?C+360:C>=360?C-360:C,S=E*Math.PI/180,P=y*o.nbb,z=100*Math.pow(P/o.aw,o.c*o.z),R=4/o.c*Math.sqrt(z/100)*(o.aw+4)*o.fLRoot,A=E<20.14?E+360:E,B=5e4/13*(1/4*(Math.cos(A*Math.PI/180+2)+3.8))*o.nc*o.ncb*Math.sqrt(w*w+b*b)/(k+.305),I=Math.pow(B,.9)*Math.pow(1.64-Math.pow(.29,o.n),.73),M=I*Math.sqrt(z/100),L=M*o.fLRoot,Y=50*Math.sqrt(I*o.c/(o.aw+4)),H=(1+100*.007)*z/(1+.007*z),F=Math.log(1+.0228*L)/.0228,O=F*Math.cos(S),N=F*Math.sin(S);return new a(E,M,z,R,L,Y,H,O,N)}xyzInViewingConditions(e){let t=this.chroma===0||this.j===0?0:this.chroma/Math.sqrt(this.j/100),r=Math.pow(t/Math.pow(1.64-Math.pow(.29,e.n),.73),1/.9),o=this.hue*Math.PI/180,n=.25*(Math.cos(o+2)+3.8),s=e.aw*Math.pow(this.j/100,1/e.c/e.z),c=n*(5e4/13)*e.nc*e.ncb,l=s/e.nbb,d=Math.sin(o),p=Math.cos(o),f=23*(l+.305)*r/(23*c+11*r*p+108*r*d),u=f*p,h=f*d,m=(460*l+451*u+288*h)/1403,g=(460*l-891*u-261*h)/1403,v=(460*l-220*u-6300*h)/1403,w=Math.max(0,27.13*Math.abs(m)/(400-Math.abs(m))),b=We(m)*(100/e.fl)*Math.pow(w,1/.42),k=Math.max(0,27.13*Math.abs(g)/(400-Math.abs(g))),y=We(g)*(100/e.fl)*Math.pow(k,1/.42),C=Math.max(0,27.13*Math.abs(v)/(400-Math.abs(v))),E=We(v)*(100/e.fl)*Math.pow(C,1/.42),S=b/e.rgbD[0],P=y/e.rgbD[1],z=E/e.rgbD[2];return[1.86206786*S-1.01125463*P+.14918677*z,.38752654*S+.62144744*P-.00897398*z,-.0158415*S-.03412294*P+1.04996444*z]}},ft=class a{static sanitizeRadians(e){return(e+8*Math.PI)%(2*Math.PI)}static trueDelinearized(e){let t=e/100,r=0;return r=t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055,255*r}static chromaticAdaptation(e){let t=Math.pow(Math.abs(e),.42);return 400*We(e)*t/(t+27.13)}static hueOf(e){let t=ua(e,a.SCALED_DISCOUNT_FROM_LINRGB),r=a.chromaticAdaptation(t[0]),o=a.chromaticAdaptation(t[1]),n=a.chromaticAdaptation(t[2]),s=(11*r+-12*o+n)/11,c=(r+o-2*n)/9;return Math.atan2(c,s)}static areInCyclicOrder(e,t,r){return a.sanitizeRadians(t-e)100.01||C[1]>100.01||C[2]>100.01?0:oo(C);o-=(z-r)*o/(2*z)}return 0}static solveToInt(e,t,r){if(t<1e-4||r<1e-4||r>99.9999)return Dd(r);let o=(e=va(e))/180*Math.PI,n=$t(r),s=a.findResultByJ(o,t,n);return s!==0?s:oo(a.bisectToLimit(n,o))}static solveToCam(e,t,r){return Ke.fromInt(a.solveToInt(e,t,r))}};ft.SCALED_DISCOUNT_FROM_LINRGB=[[.001200833568784504,.002389694492170889,.0002795742885861124],[.0005891086651375999,.0029785502573438758,.0003270666104008398],[.00010146692491640572,.0005364214359186694,.0032979401770712076]],ft.LINRGB_FROM_SCALED_DISCOUNT=[[1373.2198709594231,-1100.4251190754821,-7.278681089101213],[-271.815969077903,559.6580465940733,-32.46047482791194],[1.9622899599665666,-57.173814538844006,308.7233197812385]],ft.Y_FROM_LINRGB=[.2126,.7152,.0722],ft.CRITICAL_PLANES=[.015176349177441876,.045529047532325624,.07588174588720938,.10623444424209313,.13658714259697685,.16693984095186062,.19729253930674434,.2276452376616281,.2579979360165119,.28835063437139563,.3188300904430532,.350925934958123,.3848314933096426,.42057480301049466,.458183274052838,.4976837250274023,.5391024159806381,.5824650784040898,.6277969426914107,.6751227633498623,.7244668422128921,.775853049866786,.829304845476233,.8848452951698498,.942497089126609,1.0022825574869039,1.0642236851973577,1.1283421258858297,1.1946592148522128,1.2631959812511864,1.3339731595349034,1.407011200216447,1.4823302800086415,1.5599503113873272,1.6398909516233677,1.7221716113234105,1.8068114625156377,1.8938294463134073,1.9832442801866852,2.075074464868551,2.1693382909216234,2.2660538449872063,2.36523901573795,2.4669114995532007,2.5710888059345764,2.6777882626779785,2.7870270208169257,2.898822059350997,3.0131901897720907,3.1301480604002863,3.2497121605402226,3.3718988244681087,3.4967242352587946,3.624204428461639,3.754355295633311,3.887192587735158,4.022731918402185,4.160988767090289,4.301978482107941,4.445716283538092,4.592217266055746,4.741496401646282,4.893568542229298,5.048448422192488,5.20615066083972,5.3666897647573375,5.5300801301023865,5.696336044816294,5.865471690767354,6.037501145825082,6.212438385869475,6.390297286737924,6.571091626112461,6.7548350853498045,6.941541251256611,7.131223617812143,7.323895587840543,7.5195704746346665,7.7182615035334345,7.919981813454504,8.124744458384042,8.332562408825165,8.543448553206703,8.757415699253682,8.974476575321063,9.194643831691977,9.417930041841839,9.644347703669503,9.873909240696694,10.106627003236781,10.342513269534024,10.58158024687427,10.8238400726681,11.069304815507364,11.317986476196008,11.569896988756009,11.825048221409341,12.083451977536606,12.345119996613247,12.610063955123938,12.878295467455942,13.149826086772048,13.42466730586372,13.702830557985108,13.984327217668513,14.269168601521828,14.55736596900856,14.848930523210871,15.143873411576273,15.44220572664832,15.743938506781891,16.04908273684337,16.35764934889634,16.66964922287304,16.985093187232053,17.30399201960269,17.62635644741625,17.95219714852476,18.281524751807332,18.614349837764564,18.95068293910138,19.290534541298456,19.633915083172692,19.98083495742689,20.331304511189067,20.685334046541502,21.042933821039977,21.404114048223256,21.76888489811322,22.137256497705877,22.50923893145328,22.884842241736916,23.264076429332462,23.6469514538663,24.033477234264016,24.42366364919083,24.817520537484558,25.21505769858089,25.61628489293138,26.021211842414342,26.429848230738664,26.842203703840827,27.258287870275353,27.678110301598522,28.10168053274597,28.529008062403893,28.96010235337422,29.39497283293396,29.83362889318845,30.276079891419332,30.722335150426627,31.172403958865512,31.62629557157785,32.08401920991837,32.54558406207592,33.010999283389665,33.4802739966603,33.953417292456834,34.430438229418264,34.911345834551085,35.39614910352207,35.88485700094671,36.37747846067349,36.87402238606382,37.37449765026789,37.87891309649659,38.38727753828926,38.89959975977785,39.41588851594697,39.93615253289054,40.460400508064545,40.98864111053629,41.520882981230194,42.05713473317016,42.597404951718396,43.141702194811224,43.6900349931913,44.24241185063697,44.798841244188324,45.35933162437017,45.92389141541209,46.49252901546552,47.065252796817916,47.64207110610409,48.22299226451468,48.808024568002054,49.3971762874833,49.9904556690408,50.587870934119984,51.189430279724725,51.79514187861014,52.40501387947288,53.0190544071392,53.637271562750364,54.259673423945976,54.88626804504493,55.517063457223934,56.15206766869424,56.79128866487574,57.43473440856916,58.08241284012621,58.734331877617365,59.39049941699807,60.05092333227251,60.715611475655585,61.38457167773311,62.057811747619894,62.7353394731159,63.417162620860914,64.10328893648692,64.79372614476921,65.48848194977529,66.18756403501224,66.89098006357258,67.59873767827808,68.31084450182222,69.02730813691093,69.74813616640164,70.47333615344107,71.20291564160104,71.93688215501312,72.67524319850172,73.41800625771542,74.16517879925733,74.9167682708136,75.67278210128072,76.43322770089146,77.1981124613393,77.96744375590167,78.74122893956174,79.51947534912904,80.30219030335869,81.08938110306934,81.88105503125999,82.67721935322541,83.4778813166706,84.28304815182372,85.09272707154808,85.90692527145302,86.72564993000343,87.54890820862819,88.3767072518277,89.2090541872801,90.04595612594655,90.88742016217518,91.73345337380438,92.58406282226491,93.43925555268066,94.29903859396902,95.16341895893969,96.03240364439274,96.9059996312159,97.78421388448044,98.6670533535366,99.55452497210776];var Ye=class a{static from(e,t,r){return new a(ft.solveToInt(e,t,r))}static fromInt(e){return new a(e)}toInt(){return this.argb}get hue(){return this.internalHue}set hue(e){this.setInternalState(ft.solveToInt(e,this.internalChroma,this.internalTone))}get chroma(){return this.internalChroma}set chroma(e){this.setInternalState(ft.solveToInt(this.internalHue,e,this.internalTone))}get tone(){return this.internalTone}set tone(e){this.setInternalState(ft.solveToInt(this.internalHue,this.internalChroma,e))}constructor(e){this.argb=e;let t=Ke.fromInt(e);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=ma(e),this.argb=e}setInternalState(e){let t=Ke.fromInt(e);this.internalHue=t.hue,this.internalChroma=t.chroma,this.internalTone=ma(e),this.argb=e}inViewingConditions(e){let t=Ke.fromInt(this.toInt()).xyzInViewingConditions(e),r=Ke.fromXyzInViewingConditions(t[0],t[1],t[2],rt.make());return a.from(r.hue,r.chroma,ha(t[1]))}},ga=class a{static harmonize(e,t){let r=Ye.fromInt(e),o=Ye.fromInt(t),n=Ad(r.hue,o.hue),s=Math.min(.5*n,15),c=va(r.hue+s*zd(r.hue,o.hue));return Ye.from(c,r.chroma,r.tone).toInt()}static hctHue(e,t,r){let o=a.cam16Ucs(e,t,r),n=Ke.fromInt(o),s=Ke.fromInt(e);return Ye.from(n.hue,s.chroma,ma(e)).toInt()}static cam16Ucs(e,t,r){let o=Ke.fromInt(e),n=Ke.fromInt(t),s=o.jstar,c=o.astar,l=o.bstar,d=s+(n.jstar-s)*r,p=c+(n.astar-c)*r,f=l+(n.bstar-l)*r;return Ke.fromUcs(d,p,f).toInt()}},je=class a{static ratioOfTones(e,t){return e=zr(0,100,e),t=zr(0,100,t),a.ratioOfYs($t(e),$t(t))}static ratioOfYs(e,t){let r=e>t?e:t;return(r+5)/((r===t?e:t)+5)}static lighter(e,t){if(e<0||e>100)return-1;let r=$t(e),o=t*(r+5)-5,n=a.ratioOfYs(o,r),s=Math.abs(n-t);if(n.04)return-1;let c=ha(o)+.4;return c<0||c>100?-1:c}static darker(e,t){if(e<0||e>100)return-1;let r=$t(e),o=(r+5)/t-5,n=a.ratioOfYs(r,o),s=Math.abs(n-t);if(n.04)return-1;let c=ha(o)-.4;return c<0||c>100?-1:c}static lighterUnsafe(e,t){let r=a.lighter(e,t);return r<0?100:r}static darkerUnsafe(e,t){let r=a.darker(e,t);return r<0?0:r}},ba=class a{static isDisliked(e){let t=Math.round(e.hue)>=90&&Math.round(e.hue)<=111,r=Math.round(e.chroma)>16,o=Math.round(e.tone)<65;return t&&r&&o}static fixIfDisliked(e){return a.isDisliked(e)?Ye.from(e.hue,e.chroma,70):e}},se=class a{static fromPalette(e){return new a(e.name??"",e.palette,e.tone,e.isBackground??!1,e.background,e.secondBackground,e.contrastCurve,e.toneDeltaPair)}constructor(e,t,r,o,n,s,c,l){if(this.name=e,this.palette=t,this.tone=r,this.isBackground=o,this.background=n,this.secondBackground=s,this.contrastCurve=c,this.toneDeltaPair=l,this.hctCache=new Map,!n&&s)throw new Error(`Color ${e} has secondBackgrounddefined, but background is not defined.`);if(!n&&c)throw new Error(`Color ${e} has contrastCurvedefined, but background is not defined.`);if(n&&!c)throw new Error(`Color ${e} has backgrounddefined, but contrastCurve is not defined.`)}getArgb(e){return this.getHct(e).toInt()}getHct(e){let t=this.hctCache.get(e);if(t!=null)return t;let r=this.getTone(e),o=this.palette(e).getHct(r);return this.hctCache.size>4&&this.hctCache.clear(),this.hctCache.set(e,o),o}getTone(e){let t=e.contrastLevel<0;if(this.toneDeltaPair){let r=this.toneDeltaPair(e),o=r.roleA,n=r.roleB,s=r.delta,c=r.polarity,l=r.stayTogether,d=this.background(e).getTone(e),p=c==="nearer"||c==="lighter"&&!e.isDark||c==="darker"&&e.isDark,f=p?o:n,u=p?n:o,h=this.name===f.name,m=e.isDark?1:-1,g=f.contrastCurve.getContrast(e.contrastLevel),v=u.contrastCurve.getContrast(e.contrastLevel),w=f.tone(e),b=je.ratioOfTones(d,w)>=g?w:a.foregroundTone(d,g),k=u.tone(e),y=je.ratioOfTones(d,k)>=v?k:a.foregroundTone(d,v);return t&&(b=a.foregroundTone(d,g),y=a.foregroundTone(d,v)),(y-b)*m>=s||(y=zr(0,100,b+s*m),(y-b)*m>=s||(b=zr(0,100,y-s*m))),50<=b&&b<60?m>0?(b=60,y=Math.max(y,b+s*m)):(b=49,y=Math.min(y,b+s*m)):50<=y&&y<60&&(l?m>0?(b=60,y=Math.max(y,b+s*m)):(b=49,y=Math.min(y,b+s*m)):y=m>0?60:49),h?b:y}{let r=this.tone(e);if(this.background==null)return r;let o=this.background(e).getTone(e),n=this.contrastCurve.getContrast(e.contrastLevel);if(je.ratioOfTones(o,r)>=n||(r=a.foregroundTone(o,n)),t&&(r=a.foregroundTone(o,n)),this.isBackground&&50<=r&&r<60&&(r=je.ratioOfTones(49,o)>=n?49:60),this.secondBackground){let[s,c]=[this.background,this.secondBackground],[l,d]=[s(e).getTone(e),c(e).getTone(e)],[p,f]=[Math.max(l,d),Math.min(l,d)];if(je.ratioOfTones(p,r)>=n&&je.ratioOfTones(f,r)>=n)return r;let u=je.lighter(p,n),h=je.darker(f,n),m=[];return u!==-1&&m.push(u),h!==-1&&m.push(h),a.tonePrefersLightForeground(l)||a.tonePrefersLightForeground(d)?u<0?100:u:m.length===1?m[0]:h<0?0:h}return r}}static foregroundTone(e,t){let r=je.lighterUnsafe(e,t),o=je.darkerUnsafe(e,t),n=je.ratioOfTones(r,e),s=je.ratioOfTones(o,e);if(a.tonePrefersLightForeground(e)){let c=Math.abs(n-s)<.1&&n=t||n>=s||c?r:o}return s>=t||s>=n?o:r}static tonePrefersLightForeground(e){return Math.round(e)<60}static toneAllowsLightForeground(e){return Math.round(e)<=49}static enableLightForeground(e){return a.tonePrefersLightForeground(e)&&!a.toneAllowsLightForeground(e)?49:e}},cr;(function(a){a[a.MONOCHROME=0]="MONOCHROME",a[a.NEUTRAL=1]="NEUTRAL",a[a.TONAL_SPOT=2]="TONAL_SPOT",a[a.VIBRANT=3]="VIBRANT",a[a.EXPRESSIVE=4]="EXPRESSIVE",a[a.FIDELITY=5]="FIDELITY",a[a.CONTENT=6]="CONTENT",a[a.RAINBOW=7]="RAINBOW",a[a.FRUIT_SALAD=8]="FRUIT_SALAD"})(cr||(cr={}));var ke=class{constructor(e,t,r,o){this.low=e,this.normal=t,this.medium=r,this.high=o}getContrast(e){return e<=-1?this.low:e<0?lr(this.low,this.normal,(e- -1)/1):e<.5?lr(this.normal,this.medium,(e-0)/.5):e<1?lr(this.medium,this.high,(e-.5)/.5):this.high}},Ve=class{constructor(e,t,r,o,n){this.roleA=e,this.roleB=t,this.delta=r,this.polarity=o,this.stayTogether=n}};function Nt(a){return a.variant===cr.FIDELITY||a.variant===cr.CONTENT}function Re(a){return a.variant===cr.MONOCHROME}function Fd(a,e,t,r){let o=t,n=Ye.from(a,e,t);if(n.chromac.chroma||Math.abs(c.chroma-e)<.4)break;Math.abs(c.chroma-e)a.primaryPalette,tone:a=>a.primaryPalette.keyColor.tone}),W.secondaryPaletteKeyColor=se.fromPalette({name:"secondary_palette_key_color",palette:a=>a.secondaryPalette,tone:a=>a.secondaryPalette.keyColor.tone}),W.tertiaryPaletteKeyColor=se.fromPalette({name:"tertiary_palette_key_color",palette:a=>a.tertiaryPalette,tone:a=>a.tertiaryPalette.keyColor.tone}),W.neutralPaletteKeyColor=se.fromPalette({name:"neutral_palette_key_color",palette:a=>a.neutralPalette,tone:a=>a.neutralPalette.keyColor.tone}),W.neutralVariantPaletteKeyColor=se.fromPalette({name:"neutral_variant_palette_key_color",palette:a=>a.neutralVariantPalette,tone:a=>a.neutralVariantPalette.keyColor.tone}),W.background=se.fromPalette({name:"background",palette:a=>a.neutralPalette,tone:a=>a.isDark?6:98,isBackground:!0}),W.onBackground=se.fromPalette({name:"on_background",palette:a=>a.neutralPalette,tone:a=>a.isDark?90:10,background:a=>W.background,contrastCurve:new ke(3,3,4.5,7)}),W.surface=se.fromPalette({name:"surface",palette:a=>a.neutralPalette,tone:a=>a.isDark?6:98,isBackground:!0}),W.surfaceDim=se.fromPalette({name:"surface_dim",palette:a=>a.neutralPalette,tone:a=>a.isDark?6:87,isBackground:!0}),W.surfaceBright=se.fromPalette({name:"surface_bright",palette:a=>a.neutralPalette,tone:a=>a.isDark?24:98,isBackground:!0}),W.surfaceContainerLowest=se.fromPalette({name:"surface_container_lowest",palette:a=>a.neutralPalette,tone:a=>a.isDark?4:100,isBackground:!0}),W.surfaceContainerLow=se.fromPalette({name:"surface_container_low",palette:a=>a.neutralPalette,tone:a=>a.isDark?10:96,isBackground:!0}),W.surfaceContainer=se.fromPalette({name:"surface_container",palette:a=>a.neutralPalette,tone:a=>a.isDark?12:94,isBackground:!0}),W.surfaceContainerHigh=se.fromPalette({name:"surface_container_high",palette:a=>a.neutralPalette,tone:a=>a.isDark?17:92,isBackground:!0}),W.surfaceContainerHighest=se.fromPalette({name:"surface_container_highest",palette:a=>a.neutralPalette,tone:a=>a.isDark?22:90,isBackground:!0}),W.onSurface=se.fromPalette({name:"on_surface",palette:a=>a.neutralPalette,tone:a=>a.isDark?90:10,background:a=>W.highestSurface(a),contrastCurve:new ke(4.5,7,11,21)}),W.surfaceVariant=se.fromPalette({name:"surface_variant",palette:a=>a.neutralVariantPalette,tone:a=>a.isDark?30:90,isBackground:!0}),W.onSurfaceVariant=se.fromPalette({name:"on_surface_variant",palette:a=>a.neutralVariantPalette,tone:a=>a.isDark?80:30,background:a=>W.highestSurface(a),contrastCurve:new ke(3,4.5,7,11)}),W.inverseSurface=se.fromPalette({name:"inverse_surface",palette:a=>a.neutralPalette,tone:a=>a.isDark?90:20}),W.inverseOnSurface=se.fromPalette({name:"inverse_on_surface",palette:a=>a.neutralPalette,tone:a=>a.isDark?20:95,background:a=>W.inverseSurface,contrastCurve:new ke(4.5,7,11,21)}),W.outline=se.fromPalette({name:"outline",palette:a=>a.neutralVariantPalette,tone:a=>a.isDark?60:50,background:a=>W.highestSurface(a),contrastCurve:new ke(1.5,3,4.5,7)}),W.outlineVariant=se.fromPalette({name:"outline_variant",palette:a=>a.neutralVariantPalette,tone:a=>a.isDark?30:80,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7)}),W.shadow=se.fromPalette({name:"shadow",palette:a=>a.neutralPalette,tone:a=>0}),W.scrim=se.fromPalette({name:"scrim",palette:a=>a.neutralPalette,tone:a=>0}),W.surfaceTint=se.fromPalette({name:"surface_tint",palette:a=>a.primaryPalette,tone:a=>a.isDark?80:40,isBackground:!0}),W.primary=se.fromPalette({name:"primary",palette:a=>a.primaryPalette,tone:a=>Re(a)?a.isDark?100:0:a.isDark?80:40,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(3,4.5,7,11),toneDeltaPair:a=>new Ve(W.primaryContainer,W.primary,15,"nearer",!1)}),W.onPrimary=se.fromPalette({name:"on_primary",palette:a=>a.primaryPalette,tone:a=>Re(a)?a.isDark?10:90:a.isDark?20:100,background:a=>W.primary,contrastCurve:new ke(4.5,7,11,21)}),W.primaryContainer=se.fromPalette({name:"primary_container",palette:a=>a.primaryPalette,tone:a=>Nt(a)?fa(a.sourceColorHct,a):Re(a)?a.isDark?85:25:a.isDark?30:90,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.primaryContainer,W.primary,15,"nearer",!1)}),W.onPrimaryContainer=se.fromPalette({name:"on_primary_container",palette:a=>a.primaryPalette,tone:a=>Nt(a)?se.foregroundTone(W.primaryContainer.tone(a),4.5):Re(a)?a.isDark?0:100:a.isDark?90:10,background:a=>W.primaryContainer,contrastCurve:new ke(4.5,7,11,21)}),W.inversePrimary=se.fromPalette({name:"inverse_primary",palette:a=>a.primaryPalette,tone:a=>a.isDark?40:80,background:a=>W.inverseSurface,contrastCurve:new ke(3,4.5,7,11)}),W.secondary=se.fromPalette({name:"secondary",palette:a=>a.secondaryPalette,tone:a=>a.isDark?80:40,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(3,4.5,7,11),toneDeltaPair:a=>new Ve(W.secondaryContainer,W.secondary,15,"nearer",!1)}),W.onSecondary=se.fromPalette({name:"on_secondary",palette:a=>a.secondaryPalette,tone:a=>Re(a)?a.isDark?10:100:a.isDark?20:100,background:a=>W.secondary,contrastCurve:new ke(4.5,7,11,21)}),W.secondaryContainer=se.fromPalette({name:"secondary_container",palette:a=>a.secondaryPalette,tone:a=>{let e=a.isDark?30:90;if(Re(a))return a.isDark?30:85;if(!Nt(a))return e;let t=Fd(a.secondaryPalette.hue,a.secondaryPalette.chroma,e,!a.isDark);return t=fa(a.secondaryPalette.getHct(t),a),t},isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.secondaryContainer,W.secondary,15,"nearer",!1)}),W.onSecondaryContainer=se.fromPalette({name:"on_secondary_container",palette:a=>a.secondaryPalette,tone:a=>Nt(a)?se.foregroundTone(W.secondaryContainer.tone(a),4.5):a.isDark?90:10,background:a=>W.secondaryContainer,contrastCurve:new ke(4.5,7,11,21)}),W.tertiary=se.fromPalette({name:"tertiary",palette:a=>a.tertiaryPalette,tone:a=>Re(a)?a.isDark?90:25:a.isDark?80:40,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(3,4.5,7,11),toneDeltaPair:a=>new Ve(W.tertiaryContainer,W.tertiary,15,"nearer",!1)}),W.onTertiary=se.fromPalette({name:"on_tertiary",palette:a=>a.tertiaryPalette,tone:a=>Re(a)?a.isDark?10:90:a.isDark?20:100,background:a=>W.tertiary,contrastCurve:new ke(4.5,7,11,21)}),W.tertiaryContainer=se.fromPalette({name:"tertiary_container",palette:a=>a.tertiaryPalette,tone:a=>{if(Re(a))return a.isDark?60:49;if(!Nt(a))return a.isDark?30:90;let e=fa(a.tertiaryPalette.getHct(a.sourceColorHct.tone),a),t=a.tertiaryPalette.getHct(e);return ba.fixIfDisliked(t).tone},isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.tertiaryContainer,W.tertiary,15,"nearer",!1)}),W.onTertiaryContainer=se.fromPalette({name:"on_tertiary_container",palette:a=>a.tertiaryPalette,tone:a=>Re(a)?a.isDark?0:100:Nt(a)?se.foregroundTone(W.tertiaryContainer.tone(a),4.5):a.isDark?90:10,background:a=>W.tertiaryContainer,contrastCurve:new ke(4.5,7,11,21)}),W.error=se.fromPalette({name:"error",palette:a=>a.errorPalette,tone:a=>a.isDark?80:40,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(3,4.5,7,11),toneDeltaPair:a=>new Ve(W.errorContainer,W.error,15,"nearer",!1)}),W.onError=se.fromPalette({name:"on_error",palette:a=>a.errorPalette,tone:a=>a.isDark?20:100,background:a=>W.error,contrastCurve:new ke(4.5,7,11,21)}),W.errorContainer=se.fromPalette({name:"error_container",palette:a=>a.errorPalette,tone:a=>a.isDark?30:90,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.errorContainer,W.error,15,"nearer",!1)}),W.onErrorContainer=se.fromPalette({name:"on_error_container",palette:a=>a.errorPalette,tone:a=>a.isDark?90:10,background:a=>W.errorContainer,contrastCurve:new ke(4.5,7,11,21)}),W.primaryFixed=se.fromPalette({name:"primary_fixed",palette:a=>a.primaryPalette,tone:a=>Re(a)?40:90,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.primaryFixed,W.primaryFixedDim,10,"lighter",!0)}),W.primaryFixedDim=se.fromPalette({name:"primary_fixed_dim",palette:a=>a.primaryPalette,tone:a=>Re(a)?30:80,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.primaryFixed,W.primaryFixedDim,10,"lighter",!0)}),W.onPrimaryFixed=se.fromPalette({name:"on_primary_fixed",palette:a=>a.primaryPalette,tone:a=>Re(a)?100:10,background:a=>W.primaryFixedDim,secondBackground:a=>W.primaryFixed,contrastCurve:new ke(4.5,7,11,21)}),W.onPrimaryFixedVariant=se.fromPalette({name:"on_primary_fixed_variant",palette:a=>a.primaryPalette,tone:a=>Re(a)?90:30,background:a=>W.primaryFixedDim,secondBackground:a=>W.primaryFixed,contrastCurve:new ke(3,4.5,7,11)}),W.secondaryFixed=se.fromPalette({name:"secondary_fixed",palette:a=>a.secondaryPalette,tone:a=>Re(a)?80:90,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.secondaryFixed,W.secondaryFixedDim,10,"lighter",!0)}),W.secondaryFixedDim=se.fromPalette({name:"secondary_fixed_dim",palette:a=>a.secondaryPalette,tone:a=>Re(a)?70:80,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.secondaryFixed,W.secondaryFixedDim,10,"lighter",!0)}),W.onSecondaryFixed=se.fromPalette({name:"on_secondary_fixed",palette:a=>a.secondaryPalette,tone:a=>10,background:a=>W.secondaryFixedDim,secondBackground:a=>W.secondaryFixed,contrastCurve:new ke(4.5,7,11,21)}),W.onSecondaryFixedVariant=se.fromPalette({name:"on_secondary_fixed_variant",palette:a=>a.secondaryPalette,tone:a=>Re(a)?25:30,background:a=>W.secondaryFixedDim,secondBackground:a=>W.secondaryFixed,contrastCurve:new ke(3,4.5,7,11)}),W.tertiaryFixed=se.fromPalette({name:"tertiary_fixed",palette:a=>a.tertiaryPalette,tone:a=>Re(a)?40:90,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.tertiaryFixed,W.tertiaryFixedDim,10,"lighter",!0)}),W.tertiaryFixedDim=se.fromPalette({name:"tertiary_fixed_dim",palette:a=>a.tertiaryPalette,tone:a=>Re(a)?30:80,isBackground:!0,background:a=>W.highestSurface(a),contrastCurve:new ke(1,1,3,7),toneDeltaPair:a=>new Ve(W.tertiaryFixed,W.tertiaryFixedDim,10,"lighter",!0)}),W.onTertiaryFixed=se.fromPalette({name:"on_tertiary_fixed",palette:a=>a.tertiaryPalette,tone:a=>Re(a)?100:10,background:a=>W.tertiaryFixedDim,secondBackground:a=>W.tertiaryFixed,contrastCurve:new ke(4.5,7,11,21)}),W.onTertiaryFixedVariant=se.fromPalette({name:"on_tertiary_fixed_variant",palette:a=>a.tertiaryPalette,tone:a=>Re(a)?90:30,background:a=>W.tertiaryFixedDim,secondBackground:a=>W.tertiaryFixed,contrastCurve:new ke(3,4.5,7,11)});var qe=class a{static fromInt(e){let t=Ye.fromInt(e);return a.fromHct(t)}static fromHct(e){return new a(e.hue,e.chroma,e)}static fromHueAndChroma(e,t){return new a(e,t,a.createKeyColor(e,t))}constructor(e,t,r){this.hue=e,this.chroma=t,this.keyColor=r,this.cache=new Map}static createKeyColor(e,t){let r=Ye.from(e,t,50),o=Math.abs(r.chroma-t);for(let n=1;n<50;n+=1){if(Math.round(t)===Math.round(r.chroma))return r;let s=Ye.from(e,t,50+n),c=Math.abs(s.chroma-t);c>>0}function xt(a){return parseInt(a,16)}function po(a,e){e===void 0&&(e=[]);let t=St.of(a);return{source:a,schemes:{light:Ar.light(a),dark:Ar.dark(a)},palettes:{primary:t.a1,secondary:t.a2,tertiary:t.a3,neutral:t.n1,neutralVariant:t.n2,error:t.error},customColors:e.map(r=>Vd(a,r))}}function Vd(a,e){let t=e.value,r=t,o=a;e.blend&&(t=ga.harmonize(r,o));let n=St.of(t).a1;return{color:e,value:t,light:{color:n.tone(40),onColor:n.tone(100),colorContainer:n.tone(90),onColorContainer:n.tone(10)},dark:{color:n.tone(80),onColor:n.tone(20),colorContainer:n.tone(30),onColorContainer:n.tone(90)}}}function fo(a){let e=Math.round,t=a.length,r={};return a.slice(0,3).toLowerCase()==="rgb"?(a=a.replace(" ","").split(","),r[0]=parseInt(a[0].slice(a[3].toLowerCase()==="a"?5:4),10),r[1]=parseInt(a[1],10),r[2]=parseInt(a[2],10),r[3]=a[3]?parseFloat(a[3]):-1):(t<6?a=parseInt(String(a[1])+a[1]+a[2]+a[2]+a[3]+a[3]+(t>4?String(a[4])+a[4]:""),16):a=parseInt(a.slice(1),16),r[0]=a>>16&255,r[1]=a>>8&255,r[2]=a&255,r[3]=t===9||t===5?e((a>>24&255)/255*1e4)/1e4:-1),r}function uo(a,e,t){t===void 0&&(t=.5);let r=Math.round;a=a.trim(),e=e.trim(),t=t<0?t*-1:t;let n=fo(a),s=fo(e);return e[0]==="r"?"rgb"+(e[3]==="a"?"a(":"(")+r((s[0]-n[0])*t+n[0])+","+r((s[1]-n[1])*t+n[1])+","+r((s[2]-n[2])*t+n[2])+(n[3]<0&&s[3]<0?"":","+(n[3]>-1&&s[3]>-1?r(((s[3]-n[3])*t+n[3])*1e4)/1e4:s[3]<0?n[3]:s[3]))+")":"#"+(4294967296+(n[3]>-1&&s[3]>-1?r(((s[3]-n[3])*t+n[3])*255):s[3]>-1?r(s[3]*255):n[3]>-1?r(n[3]*255):255)*16777216+r((s[0]-n[0])*t+n[0])*65536+r((s[1]-n[1])*t+n[1])*256+r((s[2]-n[2])*t+n[2])).toString(16).slice(n[3]>-1||s[3]>-1?1:3)}var mo=function(a){a===void 0&&(a="");let e=po(Mr(`#${a.replace("#","")}`));[.05,.08,.11,.12,.14].forEach((s,c)=>{e.schemes.light.props[`surface${c+1}`]=Mr(uo(Dt(e.schemes.light.props.surface),Dt(e.schemes.light.props.primary),s)),e.schemes.dark.props[`surface${c+1}`]=Mr(uo(Dt(e.schemes.dark.props.surface),Dt(e.schemes.dark.props.primary),s))});let t=s=>s.split("").map(c=>c.toUpperCase()===c&&c!=="-"&&c!=="7"?`-${c.toLowerCase()}`:c).join(""),r=s=>["tertiary","shadow","scrim","error","background"].filter(l=>s.toLowerCase().includes(l)).length>0,o={},n={};return Object.keys(e.schemes.light.props).forEach(s=>{r(s)||(o[t(`--f7-md-${s}`)]=Dt(e.schemes.light.props[s]))}),Object.keys(e.schemes.dark.props).forEach(s=>{r(s)||(n[t(`--f7-md-${s}`)]=Dt(e.schemes.dark.props[s]))}),{light:o,dark:n}};var ho=0;function Yd(){return ho+=1,ho}function at(a,e){a===void 0&&(a="xxxxxxxxxx"),e===void 0&&(e="0123456789abcdef");let t=e.length;return a.replace(/x/g,()=>e[Math.floor(Math.random()*t)])}var it=`
', ' transform-origin=\"center\" transform=\"rotate(180)\"/>');\n }\n cssStyles() {\n return [SwiperCSS,\n // eslint-disable-line\n ...(this.injectStyles && Array.isArray(this.injectStyles) ? this.injectStyles : [])].join('\\n');\n }\n cssLinks() {\n return this.injectStylesUrls || [];\n }\n calcSlideSlots() {\n const currentSideSlots = this.slideSlots || 0;\n // slide slots\n const slideSlotChildren = [...this.querySelectorAll(`[slot^=slide-]`)].map(child => {\n return parseInt(child.getAttribute('slot').split('slide-')[1], 10);\n });\n this.slideSlots = slideSlotChildren.length ? Math.max(...slideSlotChildren) + 1 : 0;\n if (!this.rendered) return;\n if (this.slideSlots > currentSideSlots) {\n for (let i = currentSideSlots; i < this.slideSlots; i += 1) {\n const slideEl = document.createElement('swiper-slide');\n slideEl.setAttribute('part', `slide slide-${i + 1}`);\n const slotEl = document.createElement('slot');\n slotEl.setAttribute('name', `slide-${i + 1}`);\n slideEl.appendChild(slotEl);\n this.shadowRoot.querySelector('.swiper-wrapper').appendChild(slideEl);\n }\n } else if (this.slideSlots < currentSideSlots) {\n const slides = this.swiper.slides;\n for (let i = slides.length - 1; i >= 0; i -= 1) {\n if (i > this.slideSlots) {\n slides[i].remove();\n }\n }\n }\n }\n render() {\n if (this.rendered) return;\n this.calcSlideSlots();\n\n // local styles\n let localStyles = this.cssStyles();\n if (this.slideSlots > 0) {\n localStyles = localStyles.replace(/::slotted\\(([a-z-0-9.]*)\\)/g, '$1');\n }\n if (localStyles.length) {\n addStyle(this.shadowRoot, localStyles);\n }\n this.cssLinks().forEach(url => {\n const linkExists = this.shadowRoot.querySelector(`link[href=\"${url}\"]`);\n if (linkExists) return;\n const linkEl = document.createElement('link');\n linkEl.rel = 'stylesheet';\n linkEl.href = url;\n this.shadowRoot.appendChild(linkEl);\n });\n // prettier-ignore\n const el = document.createElement('div');\n el.classList.add('swiper');\n el.part = 'container';\n\n // prettier-ignore\n el.innerHTML = `\n \n \n \n ${Array.from({\n length: this.slideSlots\n }).map((_, index) => `\n \n \n \n `).join('')}\n
\n \n ${needsNavigation(this.passedParams) ? `\n ${this.constructor.prevButtonSvg}
\n ${this.constructor.nextButtonSvg}
\n ` : ''}\n ${needsPagination(this.passedParams) ? `\n \n ` : ''}\n ${needsScrollbar(this.passedParams) ? `\n \n ` : ''}\n `;\n this.shadowRoot.appendChild(el);\n this.rendered = true;\n }\n initialize() {\n var _this = this;\n if (this.initialized) return;\n this.initialized = true;\n const {\n params: swiperParams,\n passedParams\n } = getParams(this);\n this.swiperParams = swiperParams;\n this.passedParams = passedParams;\n delete this.swiperParams.init;\n this.render();\n\n // eslint-disable-next-line\n this.swiper = new Swiper(this.shadowRoot.querySelector('.swiper'), {\n ...(swiperParams.virtual ? {} : {\n observer: true,\n observeSlideChildren: this.slideSlots > 0\n }),\n ...swiperParams,\n touchEventsTarget: 'container',\n onAny: function (name) {\n if (name === 'observerUpdate') {\n _this.calcSlideSlots();\n }\n const eventName = swiperParams.eventsPrefix ? `${swiperParams.eventsPrefix}${name.toLowerCase()}` : name.toLowerCase();\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n const event = new CustomEvent(eventName, {\n detail: args,\n bubbles: name !== 'hashChange',\n cancelable: true\n });\n _this.dispatchEvent(event);\n }\n });\n }\n connectedCallback() {\n if (this.initialized && this.nested && this.closest('swiper-slide') && this.closest('swiper-slide').swiperLoopMoveDOM) {\n return;\n }\n if (this.init === false || this.getAttribute('init') === 'false') {\n return;\n }\n this.initialize();\n }\n disconnectedCallback() {\n if (this.nested && this.closest('swiper-slide') && this.closest('swiper-slide').swiperLoopMoveDOM) {\n return;\n }\n if (this.swiper && this.swiper.destroy) {\n this.swiper.destroy();\n }\n this.initialized = false;\n }\n updateSwiperOnPropChange(propName, propValue) {\n const {\n params: swiperParams,\n passedParams\n } = getParams(this, propName, propValue);\n this.passedParams = passedParams;\n this.swiperParams = swiperParams;\n updateSwiper({\n swiper: this.swiper,\n passedParams: this.passedParams,\n changedParams: [attrToProp(propName)],\n ...(propName === 'navigation' && passedParams[propName] ? {\n prevEl: '.swiper-button-prev',\n nextEl: '.swiper-button-next'\n } : {}),\n ...(propName === 'pagination' && passedParams[propName] ? {\n paginationEl: '.swiper-pagination'\n } : {}),\n ...(propName === 'scrollbar' && passedParams[propName] ? {\n scrollbarEl: '.swiper-scrollbar'\n } : {})\n });\n }\n attributeChangedCallback(attr, prevValue, newValue) {\n if (!this.initialized) return;\n if (prevValue === 'true' && newValue === null) {\n newValue = false;\n }\n this.updateSwiperOnPropChange(attr, newValue);\n }\n static get observedAttributes() {\n const attrs = paramsList.filter(param => param.includes('_')).map(param => param.replace(/[A-Z]/g, v => `-${v}`).replace('_', '').toLowerCase());\n return attrs;\n }\n}\nparamsList.forEach(paramName => {\n if (paramName === 'init') return;\n paramName = paramName.replace('_', '');\n Object.defineProperty(SwiperContainer.prototype, paramName, {\n configurable: true,\n get() {\n return (this.passedParams || {})[paramName];\n },\n set(value) {\n if (!this.passedParams) this.passedParams = {};\n this.passedParams[paramName] = value;\n if (!this.initialized) return;\n this.updateSwiperOnPropChange(paramName, value);\n }\n });\n});\nclass SwiperSlide extends ClassToExtend {\n constructor() {\n super();\n this.attachShadow({\n mode: 'open'\n });\n }\n render() {\n const lazy = this.lazy || this.getAttribute('lazy') === '' || this.getAttribute('lazy') === 'true';\n addStyle(this.shadowRoot, SwiperSlideCSS);\n this.shadowRoot.appendChild(document.createElement('slot'));\n if (lazy) {\n const lazyDiv = document.createElement('div');\n lazyDiv.classList.add('swiper-lazy-preloader');\n lazyDiv.part.add('preloader');\n this.shadowRoot.appendChild(lazyDiv);\n }\n }\n initialize() {\n this.render();\n }\n connectedCallback() {\n this.initialize();\n }\n}\n\n// eslint-disable-next-line\nconst register = () => {\n if (typeof window === 'undefined') return;\n if (!window.customElements.get('swiper-container')) window.customElements.define('swiper-container', SwiperContainer);\n if (!window.customElements.get('swiper-slide')) window.customElements.define('swiper-slide', SwiperSlide);\n};\nif (typeof window !== 'undefined') {\n window.SwiperElementRegisterParams = params => {\n paramsList.push(...params);\n };\n}\n\nexport { SwiperContainer, SwiperSlide, register };\n", "// eslint-disable-next-line\nimport Swiper from 'swiper/bundle';\n// eslint-disable-next-line\nimport { register } from 'swiper/element/bundle';\nimport $ from '../../shared/dom7.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nregister();\n\n\n\nfunction initSwiper(swiperEl) {\n const app = this;\n const $swiperEl = $(swiperEl);\n if ($swiperEl.length === 0) return;\n const isElement = $swiperEl[0].swiper && $swiperEl[0].swiper.isElement;\n if ($swiperEl[0].swiper && !$swiperEl[0].swiper.isElement) return;\n let initialSlide;\n let params = {};\n let isTabs;\n let isRoutableTabs;\n if ($swiperEl.hasClass('tabs')) {\n initialSlide = $swiperEl.children('swiper-slide').indexOf($swiperEl.children('.tab-active')[0]);\n isTabs = true;\n isRoutableTabs = $swiperEl.find('.tabs-routable').length > 0;\n }\n if ($swiperEl.attr('data-swiper')) {\n params = JSON.parse($swiperEl.attr('data-swiper'));\n } else if ($swiperEl[0].f7SwiperParams) {\n params = $swiperEl[0].f7SwiperParams;\n } else {\n params = $swiperEl.dataset();\n Object.keys(params).forEach(key => {\n const value = params[key];\n if (typeof value === 'string' && value.indexOf('{') === 0 && value.indexOf('}') > 0) {\n try {\n params[key] = JSON.parse(value);\n } catch (e) {\n // not JSON\n }\n }\n });\n }\n if (typeof params.initialSlide === 'undefined' && typeof initialSlide !== 'undefined') {\n params.initialSlide = initialSlide;\n }\n const swiper = isElement ? $swiperEl[0].swiper : app.swiper.create($swiperEl[0], params);\n if (isElement) {\n swiper.slideTo(initialSlide, 0);\n }\n function updateSwiper() {\n swiper.update();\n }\n const $tabEl = $swiperEl.parents('.tab').filter(tabEl => {\n return $(tabEl).parent('.tabs').parent('.tabs-animated-wrap, swiper-container.tabs').length === 0;\n }).eq(0);\n $swiperEl.parents('.popup, .login-screen, .sheet-modal, .popover').on('modal:open', updateSwiper);\n $swiperEl.parents('.panel').on('panel:open', updateSwiper);\n if ($tabEl && $tabEl.length) {\n $tabEl.on('tab:show', updateSwiper);\n }\n swiper.on('beforeDestroy', () => {\n $swiperEl.parents('.popup, .login-screen, .sheet-modal, .popover').off('modal:open', updateSwiper);\n $swiperEl.parents('.panel').off('panel:open', updateSwiper);\n if ($tabEl && $tabEl.length) {\n $tabEl.off('tab:show', updateSwiper);\n }\n });\n if (isTabs) {\n swiper.on('slideChange', () => {\n if (isRoutableTabs) {\n let view = app.views.get($swiperEl.parents('.view'));\n if (!view) view = app.views.main;\n const router = view.router;\n const tabRouteUrl = router.findTabRouteUrl($(swiper.slides).eq(swiper.activeIndex)[0]);\n if (tabRouteUrl) {\n setTimeout(() => {\n router.navigate(tabRouteUrl);\n }, 0);\n }\n } else {\n app.tab.show({\n tabEl: $(swiper.slides).eq(swiper.activeIndex)\n });\n }\n });\n }\n}\nexport default {\n name: 'swiper',\n static: {\n Swiper\n },\n create() {\n const app = this;\n app.swiper = ConstructorMethods({\n defaultSelector: '.swiper',\n constructor: Swiper,\n domProp: 'swiper'\n });\n },\n on: {\n pageMounted(page) {\n const app = this;\n page.$el.find('swiper-container.tabs').each(swiperEl => {\n initSwiper.call(app, swiperEl);\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('swiper-container.tabs').each(swiperEl => {\n initSwiper.call(app, swiperEl);\n });\n },\n pageReinit(page) {\n const app = this;\n page.$el.find('swiper-container.tabs').each(swiperEl => {\n const swiper = app.swiper.get(swiperEl);\n if (swiper && swiper.update) swiper.update();\n });\n },\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('swiper-container.tabs').each(swiperEl => {\n initSwiper.call(app, swiperEl);\n });\n },\n tabShow(tabEl) {\n const app = this;\n $(tabEl).find('swiper-container.tabs').each(swiperEl => {\n const swiper = app.swiper.get(swiperEl);\n if (swiper && swiper.update) swiper.update();\n });\n },\n tabBeforeRemove(tabEl) {\n const app = this;\n $(tabEl).find('swiper-container.tabs').each(swiperEl => {\n app.swiper.destroy(swiperEl);\n });\n }\n }\n};", "/* eslint indent: [\"off\"] */\nimport { getWindow } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend, now, nextTick, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass PhotoBrowser extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const pb = this;\n pb.app = app;\n const defaults = extend({\n on: {}\n }, app.params.photoBrowser);\n\n // Extend defaults with modules params\n pb.useModulesParams(defaults);\n pb.params = extend(defaults, params);\n extend(pb, {\n exposed: false,\n opened: false,\n activeIndex: pb.params.swiper.initialSlide,\n url: pb.params.url,\n swipeToClose: {\n allow: true,\n isTouched: false,\n diff: undefined,\n start: undefined,\n current: undefined,\n started: false,\n activeSlide: undefined,\n timeStart: undefined\n }\n });\n\n // Install Modules\n pb.useModules();\n\n // Init\n pb.init();\n }\n get view() {\n const {\n params,\n app\n } = this;\n return params.view || app.views.main;\n }\n onSlideChange(swiper) {\n const pb = this;\n pb.activeIndex = swiper.activeIndex;\n let current = swiper.activeIndex + 1;\n let total = pb.params.virtualSlides ? pb.params.photos.length : swiper.slides.length;\n if (swiper.params.loop) {\n total -= 2;\n current -= swiper.loopedSlides;\n if (current < 1) current = total + current;\n if (current > total) current -= total;\n }\n const $activeSlideEl = pb.params.virtualSlides ? $(swiper.wrapperEl).find(`.swiper-slide[data-swiper-slide-index=\"${swiper.activeIndex}\"]`) : $(swiper.slides).eq(swiper.activeIndex);\n const $previousSlideEl = pb.params.virtualSlides ? $(swiper.wrapperEl).find(`.swiper-slide[data-swiper-slide-index=\"${swiper.previousIndex}\"]`) : $(swiper.slides).eq(swiper.previousIndex);\n let $currentEl = pb.$el.find('.photo-browser-current');\n let $totalEl = pb.$el.find('.photo-browser-total');\n let navbarEl;\n if (pb.params.type === 'page' && pb.params.navbar && $currentEl.length === 0 && pb.app.theme === 'ios') {\n navbarEl = pb.app.navbar.getElByPage(pb.$el);\n if (navbarEl) {\n $currentEl = $(navbarEl).find('.photo-browser-current');\n $totalEl = $(navbarEl).find('.photo-browser-total');\n }\n }\n if ($currentEl.length && $totalEl.length) {\n $currentEl.text(current);\n $totalEl.text(total);\n if (!navbarEl) navbarEl = $currentEl.parents('.navbar')[0];\n if (navbarEl) {\n pb.app.navbar.size(navbarEl);\n }\n }\n\n // Update captions\n if (pb.captions.length > 0) {\n const captionIndex = swiper.params.loop ? $activeSlideEl.attr('data-swiper-slide-index') : pb.activeIndex;\n pb.$captionsContainerEl.find('.photo-browser-caption-active').removeClass('photo-browser-caption-active');\n pb.$captionsContainerEl.find(`[data-caption-index=\"${captionIndex}\"]`).addClass('photo-browser-caption-active');\n }\n\n // Stop Video\n const previousSlideVideo = $previousSlideEl.find('video');\n if (previousSlideVideo.length > 0) {\n if ('pause' in previousSlideVideo[0]) previousSlideVideo[0].pause();\n }\n }\n onTouchStart() {\n const pb = this;\n const swipeToClose = pb.swipeToClose;\n if (!swipeToClose.allow) return;\n swipeToClose.isTouched = true;\n }\n onTouchMove(e) {\n const pb = this;\n const swipeToClose = pb.swipeToClose;\n if (!swipeToClose.isTouched) return;\n if (!swipeToClose.started) {\n swipeToClose.started = true;\n swipeToClose.start = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n if (pb.params.virtualSlides) {\n swipeToClose.activeSlide = $(pb.swiper.wrapperEl).children('.swiper-slide-active');\n } else {\n swipeToClose.activeSlide = $(pb.swiper.slides).eq(pb.swiper.activeIndex);\n }\n swipeToClose.timeStart = now();\n }\n e.preventDefault();\n swipeToClose.current = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n swipeToClose.diff = swipeToClose.start - swipeToClose.current;\n pb.$el.transition(0).transform(`translate3d(0,${-swipeToClose.diff}px,0)`);\n }\n onTouchEnd() {\n const pb = this;\n const swipeToClose = pb.swipeToClose;\n swipeToClose.isTouched = false;\n if (!swipeToClose.started) {\n swipeToClose.started = false;\n return;\n }\n swipeToClose.started = false;\n swipeToClose.allow = false;\n const diff = Math.abs(swipeToClose.diff);\n const timeDiff = new Date().getTime() - swipeToClose.timeStart;\n if (timeDiff < 300 && diff > 20 || timeDiff >= 300 && diff > 100) {\n nextTick(() => {\n if (pb.$el) {\n if (swipeToClose.diff < 0) pb.$el.addClass('swipe-close-to-bottom');else pb.$el.addClass('swipe-close-to-top');\n }\n pb.emit('local::swipeToClose', pb);\n pb.$el.transform('').transition('');\n pb.close();\n swipeToClose.allow = true;\n });\n return;\n }\n if (diff !== 0) {\n pb.$el.addClass('photo-browser-transitioning').transitionEnd(() => {\n swipeToClose.allow = true;\n pb.$el.removeClass('photo-browser-transitioning');\n });\n } else {\n swipeToClose.allow = true;\n }\n nextTick(() => {\n pb.$el.transform('').transition('');\n });\n }\n\n // Render Functions\n renderNavbar() {\n const pb = this;\n if (pb.params.renderNavbar) return pb.params.renderNavbar.call(pb);\n const iconsColor = pb.params.iconsColor;\n const pageBackLinkText = pb.app.theme === 'ios' && pb.params.pageBackLinkText ? pb.params.pageBackLinkText : '';\n const renderNavbarCount = typeof pb.params.navbarShowCount === 'undefined' ? pb.params.photos.length > 1 : pb.params.navbarShowCount;\n const isPopup = pb.params.type !== 'page';\n return $jsx(\"div\", {\n class: `navbar navbar-photo-browser ${pb.params.theme === 'dark' ? 'navbar-photo-browser-dark' : ''}`\n }, $jsx(\"div\", {\n class: \"navbar-bg\"\n }), $jsx(\"div\", {\n class: \"navbar-inner navbar-inner-centered-title sliding\"\n }, !isPopup && $jsx(\"div\", {\n class: \"left\"\n }, $jsx(\"a\", {\n class: `link ${!pageBackLinkText ? 'icon-only' : ''} back`\n }, $jsx(\"i\", {\n class: `icon icon-back ${iconsColor ? `color-${iconsColor}` : ''}`\n }), pageBackLinkText && $jsx(\"span\", null, pageBackLinkText))), renderNavbarCount && $jsx(\"div\", {\n class: \"title\"\n }, $jsx(\"span\", {\n class: \"photo-browser-current\"\n }), $jsx(\"span\", {\n class: \"photo-browser-of\"\n }, pb.params.navbarOfText), $jsx(\"span\", {\n class: \"photo-browser-total\"\n })), isPopup && (pb.params.popupCloseLinkText || pb.params.popupCloseLinkIcon) && $jsx(\"div\", {\n class: \"right\"\n }, $jsx(\"a\", {\n class: \"link popup-close\",\n \"data-popup\": \".photo-browser-popup\"\n }, pb.params.popupCloseLinkIcon && pb.app.theme === 'ios' && $jsx(\"i\", null, $jsx(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"56\",\n height: \"56\",\n viewBox: \"0 0 56 56\"\n }, $jsx(\"path\", {\n fill: \"currentColor\",\n d: \"M 10.0234 43.0234 C 9.2266 43.8203 9.2031 45.1797 10.0234 45.9766 C 10.8438 46.7734 12.1797 46.7734 13.0000 45.9766 L 28.0000 30.9766 L 43.0000 45.9766 C 43.7969 46.7734 45.1563 46.7969 45.9766 45.9766 C 46.7734 45.1562 46.7734 43.8203 45.9766 43.0234 L 30.9531 28.0000 L 45.9766 13.0000 C 46.7734 12.2031 46.7969 10.8437 45.9766 10.0469 C 45.1328 9.2266 43.7969 9.2266 43.0000 10.0469 L 28.0000 25.0469 L 13.0000 10.0469 C 12.1797 9.2266 10.8203 9.2031 10.0234 10.0469 C 9.2266 10.8672 9.2266 12.2031 10.0234 13.0000 L 25.0234 28.0000 Z\"\n }))), pb.params.popupCloseLinkIcon && pb.app.theme === 'md' && $jsx(\"i\", null, $jsx(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n height: \"24px\",\n viewBox: \"0 0 24 24\",\n width: \"24px\",\n fill: \"currentColor\"\n }, $jsx(\"path\", {\n d: \"M0 0h24v24H0V0z\",\n fill: \"none\"\n }), $jsx(\"path\", {\n d: \"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"\n }))), pb.params.popupCloseLinkText && $jsx(\"span\", null, pb.params.popupCloseLinkText)))));\n }\n renderToolbar() {\n const pb = this;\n if (pb.params.renderToolbar) return pb.params.renderToolbar.call(pb);\n const iconsColor = pb.params.iconsColor;\n return $jsx(\"div\", {\n class: \"toolbar toolbar-bottom tabbar\"\n }, $jsx(\"div\", {\n class: \"toolbar-inner\"\n }, $jsx(\"a\", {\n class: \"link photo-browser-prev\"\n }, $jsx(\"i\", {\n class: `icon icon-back ${iconsColor ? `color-${iconsColor}` : ''}`\n })), $jsx(\"a\", {\n class: \"link photo-browser-next\"\n }, $jsx(\"i\", {\n class: `icon icon-forward ${iconsColor ? `color-${iconsColor}` : ''}`\n }))));\n }\n renderThumbs() {\n const pb = this;\n return $jsx(\"div\", {\n class: \"toolbar toolbar-bottom photo-browser-thumbs\"\n }, $jsx(\"div\", {\n class: \"swiper\"\n }, $jsx(\"div\", {\n class: \"swiper-wrapper\"\n }, pb.params.thumbs.map((thumb, index) => pb.renderThumb(thumb, index)))));\n }\n renderCaption(caption, index) {\n const pb = this;\n if (pb.params.renderCaption) return pb.params.renderCaption.call(pb, caption, index);\n return $jsx(\"div\", {\n class: \"photo-browser-caption\",\n \"data-caption-index\": index\n }, caption);\n }\n renderObject(photo, index) {\n const pb = this;\n if (pb.params.renderObject) return pb.params.renderObject.call(pb, photo, index);\n return $jsx(\"div\", {\n class: \"photo-browser-slide photo-browser-object-slide swiper-slide\",\n \"data-swiper-slide-index\": index\n }, photo.html ? photo.html : photo);\n }\n renderLazyPhoto(photo, index) {\n const pb = this;\n if (pb.params.renderLazyPhoto) return pb.params.renderLazyPhoto.call(pb, photo, index);\n return $jsx(\"div\", {\n class: \"photo-browser-slide photo-browser-slide-lazy swiper-slide\",\n \"data-swiper-slide-index\": index\n }, $jsx(\"div\", {\n class: \"swiper-lazy-preloader\"\n }), $jsx(\"span\", {\n class: \"swiper-zoom-container\"\n }, $jsx(\"img\", {\n loading: \"lazy\",\n src: photo.url ? photo.url : photo\n })));\n }\n renderPhoto(photo, index) {\n const pb = this;\n if (pb.params.renderPhoto) return pb.params.renderPhoto.call(pb, photo, index);\n return $jsx(\"div\", {\n class: \"photo-browser-slide swiper-slide\",\n \"data-swiper-slide-index\": index\n }, $jsx(\"span\", {\n class: \"swiper-zoom-container\"\n }, $jsx(\"img\", {\n src: photo.url ? photo.url : photo\n })));\n }\n renderThumb(thumb, index) {\n const pb = this;\n const url = typeof thumb === 'string' ? thumb : thumb.url;\n if (pb.params.renderThumb) return pb.params.renderThumb.call(pb, thumb, index);\n return $jsx(\"div\", {\n class: \"photo-browser-thumbs-slide swiper-slide\",\n \"data-swiper-slide-index\": index\n }, url && $jsx(\"img\", {\n src: url,\n loading: \"lazy\"\n }));\n }\n render() {\n const pb = this;\n if (pb.params.render) return pb.params.render.call(pb, pb.params);\n return $jsx(\"div\", {\n class: `photo-browser photo-browser-${pb.params.theme}`\n }, $jsx(\"div\", {\n class: \"view\"\n }, $jsx(\"div\", {\n class: `page photo-browser-page photo-browser-page-${pb.params.theme} no-toolbar ${!pb.params.navbar ? 'no-navbar' : ''}`,\n \"data-name\": \"photo-browser-page\"\n }, pb.params.navbar && pb.renderNavbar(), pb.params.toolbar && pb.renderToolbar(), pb.params.thumbs && pb.params.thumbs.length && pb.renderThumbs(), $jsx(\"div\", {\n class: `photo-browser-captions photo-browser-captions-${pb.params.captionsTheme || pb.params.theme}`\n }, pb.params.photos.map((photo, index) => {\n if (photo.caption) return pb.renderCaption(photo.caption, index);\n return '';\n })), $jsx(\"div\", {\n class: \"photo-browser-swiper-container swiper\"\n }, $jsx(\"div\", {\n class: \"photo-browser-swiper-wrapper swiper-wrapper\"\n }, !pb.params.virtualSlides && pb.params.photos.map((photo, index) => {\n if (photo.html || (typeof photo === 'string' || photo instanceof String) && photo.indexOf('<') >= 0 && photo.indexOf('>') >= 0) {\n return pb.renderObject(photo, index);\n }\n if (pb.params.lazy === true) {\n return pb.renderLazyPhoto(photo, index);\n }\n return pb.renderPhoto(photo, index);\n }))))));\n }\n renderStandalone() {\n const pb = this;\n if (pb.params.renderStandalone) return pb.params.renderStandalone.call(pb);\n const standaloneHtml = ``;\n return standaloneHtml;\n }\n renderPage() {\n const pb = this;\n if (pb.params.renderPage) return pb.params.renderPage.call(pb);\n const pageHtml = pb.render();\n return pageHtml;\n }\n renderPopup() {\n const pb = this;\n if (pb.params.renderPopup) return pb.params.renderPopup.call(pb);\n const popupHtml = ``;\n return popupHtml;\n }\n\n // Callbacks\n onOpen(type, el) {\n const pb = this;\n const app = pb.app;\n const $el = $(el);\n $el[0].f7PhotoBrowser = pb;\n pb.$el = $el;\n pb.el = $el[0];\n pb.openedIn = type;\n pb.opened = true;\n pb.$swiperContainerEl = pb.$el.find('.photo-browser-swiper-container');\n pb.$swiperWrapperEl = pb.$el.find('.photo-browser-swiper-wrapper');\n pb.slides = pb.$el.find('.photo-browser-slide');\n pb.$captionsContainerEl = pb.$el.find('.photo-browser-captions');\n pb.captions = pb.$el.find('.photo-browser-caption');\n const hasThumbs = pb.params.thumbs && pb.params.thumbs.length > 0;\n\n // Init Swiper\n let clickTimeout;\n let preventThumbsSlide;\n let preventMainSlide;\n const initialSlide = pb.activeIndex;\n const swiperParams = extend({}, pb.params.swiper, {\n initialSlide,\n // cssMode:\n // typeof pb.params.swiper.cssMode === 'undefined' && (app.device.ios || app.device.android)\n // ? true\n // : pb.params.swiper.cssMode,\n on: {\n click(e) {\n clearTimeout(clickTimeout);\n if (pb.params.exposition) {\n clickTimeout = setTimeout(() => {\n pb.expositionToggle();\n }, 350);\n }\n pb.emit('local::tap', e);\n pb.emit('local::click', e);\n },\n doubleClick(e) {\n clearTimeout(clickTimeout);\n pb.emit('local::doubleTap', e);\n pb.emit('local::doubleClick', e);\n },\n slideChange() {\n const swiper = this;\n if (hasThumbs && pb.thumbsSwiper && !preventMainSlide) {\n preventThumbsSlide = true;\n pb.thumbsSwiper.slideTo(pb.swiper.activeIndex);\n setTimeout(() => {\n preventThumbsSlide = false;\n });\n }\n pb.onSlideChange(swiper);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n pb.emit('local::slideChange', ...args);\n },\n transitionStart() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n pb.emit('local::transitionStart', ...args);\n },\n transitionEnd() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n pb.emit('local::transitionEnd', ...args);\n },\n slideChangeTransitionStart() {\n const swiper = this;\n pb.onSlideChange(swiper);\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n pb.emit('local::slideChangeTransitionStart', ...args);\n },\n slideChangeTransitionEnd() {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n pb.emit('local::slideChangeTransitionEnd', ...args);\n }\n }\n });\n if (pb.params.swipeToClose && pb.params.type !== 'page') {\n extend(swiperParams.on, {\n touchStart(swiper, e) {\n pb.onTouchStart(e);\n pb.emit('local::touchStart', e);\n },\n touchMoveOpposite(swiper, e) {\n pb.onTouchMove(e);\n pb.emit('local::touchMoveOpposite', e);\n },\n touchEnd(swiper, e) {\n pb.onTouchEnd(e);\n pb.emit('local::touchEnd', e);\n }\n });\n }\n if (pb.params.virtualSlides) {\n extend(swiperParams, {\n virtual: {\n slides: pb.params.photos,\n renderSlide(photo, index) {\n if (photo.html || (typeof photo === 'string' || photo instanceof String) && photo.indexOf('<') >= 0 && photo.indexOf('>') >= 0) {\n return pb.renderObject(photo, index);\n }\n if (pb.params.lazy === true) {\n return pb.renderLazyPhoto(photo, index);\n }\n return pb.renderPhoto(photo, index);\n }\n }\n });\n }\n const window = getWindow();\n pb.swiper = app.swiper ? app.swiper.create(pb.$swiperContainerEl[0], swiperParams) : new window.Swiper(pb.$swiperContainerEl[0], swiperParams);\n if (pb.activeIndex === 0 || pb.params.virtualSlides) {\n pb.onSlideChange(pb.swiper);\n }\n if (hasThumbs) {\n const thumbsSwiperParams = {\n el: pb.$el.find('.photo-browser-thumbs .swiper')[0],\n slidesPerView: 'auto',\n centeredSlides: true,\n spaceBetween: 4,\n watchSlidesProgress: true,\n initialSlide,\n on: {\n touchMove() {\n preventMainSlide = true;\n },\n touchEnd() {\n preventMainSlide = false;\n },\n slideChange(s) {\n if (preventThumbsSlide) return;\n pb.swiper.slideTo(s.activeIndex, 0);\n },\n click(s) {\n if (!s.clickedSlide) return;\n const index = parseInt($(s.clickedSlide).attr('data-swiper-slide-index'), 10);\n s.slideTo(index, 0);\n }\n }\n };\n pb.thumbsSwiper = app.swiper ? app.swiper.create(thumbsSwiperParams) : new window.Swiper(thumbsSwiperParams);\n }\n if (pb.$el) {\n pb.$el.trigger('photobrowser:open');\n }\n pb.emit('local::open photoBrowserOpen', pb);\n }\n onOpened() {\n const pb = this;\n if (pb.$el && pb.params.type === 'standalone') {\n pb.$el.css('animation', 'none');\n }\n if (pb.$el) {\n pb.$el.trigger('photobrowser:opened');\n }\n pb.emit('local::opened photoBrowserOpened', pb);\n }\n onClose() {\n const pb = this;\n if (pb.destroyed) return;\n\n // Destroy Swiper\n if (pb.swiper && pb.swiper.destroy) {\n pb.swiper.destroy(true, false);\n pb.swiper = null;\n delete pb.swiper;\n }\n if (pb.thumbsSwiper && pb.thumbsSwiper.destroy) {\n pb.thumbsSwiper.destroy(true, false);\n pb.thumbsSwiper = null;\n delete pb.thumbsSwiper;\n }\n if (pb.$el) {\n pb.$el.trigger('photobrowser:close');\n }\n pb.emit('local::close photoBrowserClose', pb);\n }\n onClosed() {\n const pb = this;\n if (pb.destroyed) return;\n pb.opened = false;\n pb.$el = null;\n pb.el = null;\n delete pb.$el;\n delete pb.el;\n if (pb.$el) {\n pb.$el.trigger('photobrowser:closed');\n }\n pb.emit('local::closed photoBrowserClosed', pb);\n }\n\n // Open\n openPage() {\n const pb = this;\n if (pb.opened) return pb;\n const pageHtml = pb.renderPage();\n pb.view.router.navigate({\n url: pb.url,\n route: {\n content: pageHtml,\n path: pb.url,\n on: {\n pageBeforeIn(e, page) {\n pb.view.$el.addClass(`with-photo-browser-page with-photo-browser-page-${pb.params.theme}`);\n pb.onOpen('page', page.el);\n },\n pageAfterIn(e, page) {\n pb.onOpened('page', page.el);\n },\n pageBeforeOut(e, page) {\n pb.view.$el.removeClass(`with-photo-browser-page with-photo-browser-page-exposed with-photo-browser-page-${pb.params.theme}`);\n pb.onClose('page', page.el);\n },\n pageAfterOut(e, page) {\n pb.onClosed('page', page.el);\n }\n }\n }\n });\n return pb;\n }\n openStandalone() {\n const pb = this;\n if (pb.opened) return pb;\n const standaloneHtml = pb.renderStandalone();\n const popupParams = {\n backdrop: false,\n content: standaloneHtml,\n on: {\n popupOpen(popup) {\n pb.onOpen('popup', popup.el);\n },\n popupOpened(popup) {\n pb.onOpened('popup', popup.el);\n },\n popupClose(popup) {\n pb.onClose('popup', popup.el);\n },\n popupClosed(popup) {\n pb.onClosed('popup', popup.el);\n }\n }\n };\n if (pb.params.routableModals && pb.view) {\n pb.view.router.navigate({\n url: pb.url,\n route: {\n path: pb.url,\n popup: popupParams\n }\n });\n } else {\n pb.modal = pb.app.popup.create(popupParams).open();\n }\n return pb;\n }\n openPopup() {\n const pb = this;\n if (pb.opened) return pb;\n const popupHtml = pb.renderPopup();\n const popupParams = {\n content: popupHtml,\n push: pb.params.popupPush,\n closeByBackdropClick: pb.params.closeByBackdropClick,\n on: {\n popupOpen(popup) {\n pb.onOpen('popup', popup.el);\n },\n popupOpened(popup) {\n pb.onOpened('popup', popup.el);\n },\n popupClose(popup) {\n pb.onClose('popup', popup.el);\n },\n popupClosed(popup) {\n pb.onClosed('popup', popup.el);\n }\n }\n };\n if (pb.params.routableModals && pb.view) {\n pb.view.router.navigate({\n url: pb.url,\n route: {\n path: pb.url,\n popup: popupParams\n }\n });\n } else {\n pb.modal = pb.app.popup.create(popupParams).open();\n }\n return pb;\n }\n\n // Exposition\n expositionEnable() {\n const pb = this;\n if (pb.params.type === 'page') {\n pb.view.$el.addClass('with-photo-browser-page-exposed');\n }\n if (pb.$el) pb.$el.addClass('photo-browser-exposed');\n if (pb.params.expositionHideCaptions) pb.$captionsContainerEl.addClass('photo-browser-captions-exposed');\n pb.exposed = true;\n return pb;\n }\n expositionDisable() {\n const pb = this;\n if (pb.params.type === 'page') {\n pb.view.$el.removeClass('with-photo-browser-page-exposed');\n }\n if (pb.$el) pb.$el.removeClass('photo-browser-exposed');\n if (pb.params.expositionHideCaptions) pb.$captionsContainerEl.removeClass('photo-browser-captions-exposed');\n pb.exposed = false;\n return pb;\n }\n expositionToggle() {\n const pb = this;\n if (pb.params.type === 'page') {\n pb.view.$el.toggleClass('with-photo-browser-page-exposed');\n }\n if (pb.$el) pb.$el.toggleClass('photo-browser-exposed');\n if (pb.params.expositionHideCaptions) pb.$captionsContainerEl.toggleClass('photo-browser-captions-exposed');\n pb.exposed = !pb.exposed;\n return pb;\n }\n open(index) {\n const pb = this;\n const type = pb.params.type;\n if (pb.opened) {\n if (pb.swiper && typeof index !== 'undefined') {\n pb.swiper.slideTo(parseInt(index, 10));\n }\n return pb;\n }\n if (typeof index !== 'undefined') {\n pb.activeIndex = index;\n }\n if (type === 'standalone') {\n pb.openStandalone();\n }\n if (type === 'page') {\n pb.openPage();\n }\n if (type === 'popup') {\n pb.openPopup();\n }\n return pb;\n }\n close() {\n const pb = this;\n if (!pb.opened) return pb;\n if (pb.params.routableModals && pb.view || pb.openedIn === 'page') {\n pb.view.router.back();\n } else {\n pb.modal.once('modalClosed', () => {\n nextTick(() => {\n if (pb.destroyed) return;\n pb.modal.destroy();\n delete pb.modal;\n });\n });\n pb.modal.close();\n }\n return pb;\n }\n // eslint-disable-next-line\n init() {}\n destroy() {\n let pb = this;\n pb.emit('local::beforeDestroy photoBrowserBeforeDestroy', pb);\n if (pb.$el) {\n pb.$el.trigger('photobrowser:beforedestroy');\n pb.$el[0].f7PhotoBrowser = null;\n delete pb.$el[0].f7PhotoBrowser;\n }\n deleteProps(pb);\n pb.destroyed = true;\n pb = null;\n }\n}\nexport default PhotoBrowser;", "import PhotoBrowser from './photo-browser-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'photoBrowser',\n params: {\n photoBrowser: {\n photos: [],\n thumbs: [],\n exposition: true,\n expositionHideCaptions: false,\n type: 'standalone',\n navbar: true,\n toolbar: true,\n theme: 'light',\n captionsTheme: undefined,\n iconsColor: undefined,\n popupPush: false,\n swipeToClose: true,\n pageBackLinkText: 'Back',\n popupCloseLinkText: undefined,\n popupCloseLinkIcon: true,\n navbarOfText: 'of',\n navbarShowCount: undefined,\n view: undefined,\n url: 'photos/',\n routableModals: false,\n virtualSlides: true,\n lazy: true,\n closeByBackdropClick: true,\n renderNavbar: undefined,\n renderToolbar: undefined,\n renderCaption: undefined,\n renderObject: undefined,\n renderLazyPhoto: undefined,\n renderPhoto: undefined,\n renderThumb: undefined,\n renderPage: undefined,\n renderPopup: undefined,\n renderStandalone: undefined,\n swiper: {\n cssMode: false,\n initialSlide: 0,\n spaceBetween: 20,\n speed: 300,\n loop: false,\n keyboard: {\n enabled: true\n },\n navigation: {\n nextEl: '.photo-browser-next',\n prevEl: '.photo-browser-prev'\n },\n zoom: {\n enabled: true,\n maxRatio: 3,\n minRatio: 1\n }\n }\n }\n },\n create() {\n const app = this;\n app.photoBrowser = ConstructorMethods({\n defaultSelector: '.photo-browser-popup, .photo-browser-page',\n constructor: PhotoBrowser,\n app,\n domProp: 'f7PhotoBrowser'\n });\n },\n static: {\n PhotoBrowser\n }\n};", "import $ from '../../shared/dom7.js';\nimport { extend, now, nextTick } from '../../shared/utils.js';\nimport Modal from '../modal/modal-class.js';\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass Notification extends Modal {\n constructor(app, params) {\n const extendedParams = extend({\n on: {}\n }, app.params.notification, params);\n\n // Extends with open/close Modal methods;\n super(app, extendedParams);\n const notification = this;\n notification.app = app;\n notification.params = extendedParams;\n const {\n icon,\n title,\n titleRightText,\n subtitle,\n text,\n closeButton,\n closeTimeout,\n cssClass,\n closeOnClick\n } = notification.params;\n let $el;\n if (!notification.params.el) {\n // Find Element\n const notificationHtml = notification.render({\n icon,\n title,\n titleRightText,\n subtitle,\n text,\n closeButton,\n cssClass\n });\n $el = $(notificationHtml);\n } else {\n $el = $(notification.params.el);\n }\n if ($el && $el.length > 0 && $el[0].f7Modal) {\n return $el[0].f7Modal;\n }\n if ($el.length === 0) {\n return notification.destroy();\n }\n extend(notification, {\n $el,\n el: $el[0],\n type: 'notification'\n });\n $el[0].f7Modal = notification;\n if (closeButton) {\n $el.find('.notification-close-button').on('click', () => {\n notification.close();\n });\n }\n $el.on('click', e => {\n if (closeButton && $(e.target).closest('.notification-close-button').length) {\n return;\n }\n notification.emit('local::click notificationClick', notification);\n if (closeOnClick) notification.close();\n });\n notification.on('beforeDestroy', () => {\n $el.off('click');\n });\n\n /* Touch Events */\n let isTouched;\n let isMoved;\n let isScrolling;\n let touchesDiff;\n let touchStartTime;\n let notificationHeight;\n const touchesStart = {};\n function handleTouchStart(e) {\n if (isTouched) return;\n isTouched = true;\n isMoved = false;\n isScrolling = undefined;\n touchStartTime = now();\n touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n }\n function handleTouchMove(e) {\n if (!isTouched) return;\n const pageX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n const pageY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n if (typeof isScrolling === 'undefined') {\n isScrolling = !!(isScrolling || Math.abs(pageY - touchesStart.y) < Math.abs(pageX - touchesStart.x));\n }\n if (isScrolling) {\n isTouched = false;\n return;\n }\n e.preventDefault();\n if (!isMoved) {\n notification.$el.removeClass('notification-transitioning');\n notification.$el.transition(0);\n notificationHeight = notification.$el[0].offsetHeight / 2;\n }\n isMoved = true;\n touchesDiff = pageY - touchesStart.y;\n let newTranslate = touchesDiff;\n if (touchesDiff > 0) {\n newTranslate = touchesDiff ** 0.8;\n }\n notification.$el.transform(`translate3d(0, ${newTranslate}px, 0)`);\n }\n function handleTouchEnd() {\n if (!isTouched || !isMoved) {\n isTouched = false;\n isMoved = false;\n return;\n }\n isTouched = false;\n isMoved = false;\n if (touchesDiff === 0) {\n return;\n }\n const timeDiff = now() - touchStartTime;\n notification.$el.transition('');\n notification.$el.addClass('notification-transitioning');\n notification.$el.transform('');\n if (touchesDiff < -10 && timeDiff < 300 || -touchesDiff >= notificationHeight / 1) {\n notification.close();\n }\n }\n function attachTouchEvents() {\n notification.$el.on(app.touchEvents.start, handleTouchStart, {\n passive: true\n });\n app.on('touchmove:active', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n }\n function detachTouchEvents() {\n notification.$el.off(app.touchEvents.start, handleTouchStart, {\n passive: true\n });\n app.off('touchmove:active', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n }\n let timeoutId;\n function closeOnTimeout() {\n timeoutId = nextTick(() => {\n if (isTouched && isMoved) {\n closeOnTimeout();\n return;\n }\n notification.close();\n }, closeTimeout);\n }\n notification.on('open', () => {\n if (notification.params.swipeToClose) {\n attachTouchEvents();\n }\n $('.notification.modal-in').each(openedEl => {\n const notificationInstance = app.notification.get(openedEl);\n if (openedEl !== notification.el && notificationInstance) {\n notificationInstance.close();\n }\n });\n if (closeTimeout) {\n closeOnTimeout();\n }\n });\n notification.on('close beforeDestroy', () => {\n if (notification.params.swipeToClose) {\n detachTouchEvents();\n }\n clearTimeout(timeoutId);\n });\n return notification;\n }\n render() {\n const notification = this;\n if (notification.params.render) return notification.params.render.call(notification, notification);\n const {\n icon,\n title,\n titleRightText,\n subtitle,\n text,\n closeButton,\n cssClass\n } = notification.params;\n return $jsx(\"div\", {\n class: `notification ${icon ? 'notification-with-icon' : ''} ${cssClass || ''}`\n }, $jsx(\"div\", {\n class: \"notification-header\"\n }, icon && $jsx(\"div\", {\n class: \"notification-icon\"\n }, icon), title && $jsx(\"div\", {\n class: \"notification-title\"\n }, title), titleRightText && $jsx(\"div\", {\n class: \"notification-title-right-text\"\n }, titleRightText), closeButton && $jsx(\"span\", {\n class: \"notification-close-button\"\n })), $jsx(\"div\", {\n class: \"notification-content\"\n }, subtitle && $jsx(\"div\", {\n class: \"notification-subtitle\"\n }, subtitle), text && $jsx(\"div\", {\n class: \"notification-text\"\n }, text)));\n }\n}\nexport default Notification;", "import { extend } from '../../shared/utils.js';\nimport Notification from './notification-class.js';\nimport ModalMethods from '../../shared/modal-methods.js';\nexport default {\n name: 'notification',\n static: {\n Notification\n },\n create() {\n const app = this;\n app.notification = extend({}, ModalMethods({\n app,\n constructor: Notification,\n defaultSelector: '.notification.modal-in'\n }));\n },\n params: {\n notification: {\n icon: null,\n title: null,\n titleRightText: null,\n subtitle: null,\n text: null,\n closeButton: false,\n closeTimeout: null,\n closeOnClick: false,\n swipeToClose: true,\n cssClass: null,\n render: null,\n containerEl: null\n }\n }\n};", "/* eslint \"no-useless-escape\": \"off\" */\nimport $ from '../../shared/dom7.js';\nimport { extend, id, nextTick, deleteProps, iosPreloaderContent, mdPreloaderContent } from '../../shared/utils.js';\nimport { getDevice } from '../../shared/get-device.js';\nimport Framework7Class from '../../shared/class.js';\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass Autocomplete extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const ac = this;\n ac.app = app;\n const device = getDevice();\n const defaults = extend({\n on: {}\n }, app.params.autocomplete);\n\n // Extend defaults with modules params\n ac.useModulesParams(defaults);\n ac.params = extend(defaults, params);\n let $openerEl;\n if (ac.params.openerEl) {\n $openerEl = $(ac.params.openerEl);\n if ($openerEl.length) $openerEl[0].f7Autocomplete = ac;\n }\n let $inputEl;\n if (ac.params.inputEl) {\n $inputEl = $(ac.params.inputEl);\n if ($inputEl.length) $inputEl[0].f7Autocomplete = ac;\n }\n const uniqueId = id();\n let url = params.url;\n if (!url && $openerEl && $openerEl.length) {\n if ($openerEl.attr('href')) url = $openerEl.attr('href');else if ($openerEl.find('a').length > 0) {\n url = $openerEl.find('a').attr('href');\n }\n }\n if (!url || url === '#' || url === '') url = ac.params.url;\n const inputType = ac.params.multiple ? 'checkbox' : 'radio';\n extend(ac, {\n $openerEl,\n openerEl: $openerEl && $openerEl[0],\n $inputEl,\n inputEl: $inputEl && $inputEl[0],\n id: uniqueId,\n url,\n value: ac.params.value || [],\n inputType,\n inputName: `${inputType}-${uniqueId}`,\n $modalEl: undefined,\n $dropdownEl: undefined\n });\n let previousQuery = '';\n function onInputChange() {\n let query = ac.$inputEl.val().trim();\n if (!ac.params.source) return;\n ac.params.source.call(ac, query, items => {\n let itemsHTML = '';\n const limit = ac.params.limit ? Math.min(ac.params.limit, items.length) : items.length;\n ac.items = items;\n let regExp;\n if (ac.params.highlightMatches) {\n query = query.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, '\\\\$&');\n regExp = new RegExp(`(${query})`, 'i');\n }\n let firstValue;\n let firstItem;\n for (let i = 0; i < limit; i += 1) {\n const itemValue = typeof items[i] === 'object' ? items[i][ac.params.valueProperty] : items[i];\n const itemText = typeof items[i] === 'object' ? items[i][ac.params.textProperty] : items[i];\n if (i === 0) {\n firstValue = itemValue;\n firstItem = ac.items[i];\n }\n itemsHTML += ac.renderItem({\n value: itemValue,\n text: ac.params.highlightMatches ? itemText.replace(regExp, '$1') : itemText\n }, i);\n }\n if (itemsHTML === '' && query === '' && ac.params.dropdownPlaceholderText) {\n itemsHTML += ac.renderItem({\n placeholder: true,\n text: ac.params.dropdownPlaceholderText\n });\n }\n ac.$dropdownEl.find('ul').html(itemsHTML);\n if (ac.params.typeahead) {\n if (!firstValue || !firstItem) {\n return;\n }\n if (firstValue.toLowerCase().indexOf(query.toLowerCase()) !== 0) {\n return;\n }\n if (previousQuery.toLowerCase() === query.toLowerCase()) {\n ac.value = [];\n return;\n }\n if (previousQuery.toLowerCase().indexOf(query.toLowerCase()) === 0) {\n previousQuery = query;\n ac.value = [];\n return;\n }\n $inputEl.val(firstValue);\n $inputEl[0].setSelectionRange(query.length, firstValue.length);\n const previousValue = typeof ac.value[0] === 'object' ? ac.value[0][ac.params.valueProperty] : ac.value[0];\n if (!previousValue || firstValue.toLowerCase() !== previousValue.toLowerCase()) {\n ac.value = [firstItem];\n ac.emit('local::change autocompleteChange', [firstItem]);\n }\n }\n previousQuery = query;\n });\n }\n function onPageInputChange() {\n const inputEl = this;\n const value = inputEl.value;\n const isValues = $(inputEl).parents('.autocomplete-values').length > 0;\n let item;\n let itemValue;\n let aValue;\n if (isValues) {\n if (ac.inputType === 'checkbox' && !inputEl.checked) {\n for (let i = 0; i < ac.value.length; i += 1) {\n aValue = typeof ac.value[i] === 'string' ? ac.value[i] : ac.value[i][ac.params.valueProperty];\n if (aValue === value || aValue * 1 === value * 1) {\n ac.value.splice(i, 1);\n }\n }\n ac.updateValues();\n ac.emit('local::change autocompleteChange', ac.value);\n }\n return;\n }\n\n // Find Related Item\n for (let i = 0; i < ac.items.length; i += 1) {\n itemValue = typeof ac.items[i] === 'object' ? ac.items[i][ac.params.valueProperty] : ac.items[i];\n if (itemValue === value || itemValue * 1 === value * 1) item = ac.items[i];\n }\n if (ac.inputType === 'radio') {\n ac.value = [item];\n } else if (inputEl.checked) {\n ac.value.push(item);\n } else {\n for (let i = 0; i < ac.value.length; i += 1) {\n aValue = typeof ac.value[i] === 'object' ? ac.value[i][ac.params.valueProperty] : ac.value[i];\n if (aValue === value || aValue * 1 === value * 1) {\n ac.value.splice(i, 1);\n }\n }\n }\n\n // Update Values Block\n ac.updateValues();\n\n // On Select Callback\n if (ac.inputType === 'radio' && inputEl.checked || ac.inputType === 'checkbox') {\n ac.emit('local::change autocompleteChange', ac.value);\n }\n }\n function onHtmlClick(e) {\n const $targetEl = $(e.target);\n if ($targetEl.is(ac.$inputEl[0]) || ac.$dropdownEl && $targetEl.closest(ac.$dropdownEl[0]).length) return;\n ac.close();\n }\n function onOpenerClick() {\n ac.open();\n }\n function onInputFocus() {\n ac.open();\n }\n function onInputBlur() {\n if (ac.$dropdownEl.find('label.active-state').length > 0) return;\n setTimeout(() => {\n ac.close();\n }, 0);\n }\n function onResize() {\n ac.positionDropdown();\n }\n function onKeyDown(e) {\n if (!ac.opened) return;\n if (e.keyCode === 27) {\n // ESC\n e.preventDefault();\n ac.$inputEl.blur();\n return;\n }\n if (e.keyCode === 13) {\n // Enter\n const $selectedItemLabel = ac.$dropdownEl.find('.autocomplete-dropdown-selected label');\n if ($selectedItemLabel.length) {\n e.preventDefault();\n $selectedItemLabel.trigger('click');\n ac.$inputEl.blur();\n return;\n }\n if (ac.params.typeahead) {\n e.preventDefault();\n ac.$inputEl.blur();\n }\n return;\n }\n if (e.keyCode !== 40 && e.keyCode !== 38) return;\n e.preventDefault();\n const $selectedItem = ac.$dropdownEl.find('.autocomplete-dropdown-selected');\n let $newItem;\n if ($selectedItem.length) {\n $newItem = $selectedItem[e.keyCode === 40 ? 'next' : 'prev']('li');\n if (!$newItem.length) {\n $newItem = ac.$dropdownEl.find('li').eq(e.keyCode === 40 ? 0 : ac.$dropdownEl.find('li').length - 1);\n }\n } else {\n $newItem = ac.$dropdownEl.find('li').eq(e.keyCode === 40 ? 0 : ac.$dropdownEl.find('li').length - 1);\n }\n if ($newItem.hasClass('autocomplete-dropdown-placeholder')) return;\n $selectedItem.removeClass('autocomplete-dropdown-selected');\n $newItem.addClass('autocomplete-dropdown-selected');\n }\n function onDropdownClick() {\n const $clickedEl = $(this);\n let clickedItem;\n for (let i = 0; i < ac.items.length; i += 1) {\n const itemValue = typeof ac.items[i] === 'object' ? ac.items[i][ac.params.valueProperty] : ac.items[i];\n const value = $clickedEl.attr('data-value');\n if (itemValue === value || itemValue * 1 === value * 1) {\n clickedItem = ac.items[i];\n }\n }\n if (ac.params.updateInputValueOnSelect) {\n ac.$inputEl.val(typeof clickedItem === 'object' ? clickedItem[ac.params.valueProperty] : clickedItem);\n ac.$inputEl.trigger('input change');\n }\n ac.value = [clickedItem];\n ac.emit('local::change autocompleteChange', [clickedItem]);\n ac.close();\n }\n ac.attachEvents = function attachEvents() {\n if (ac.params.openIn !== 'dropdown' && ac.$openerEl) {\n ac.$openerEl.on('click', onOpenerClick);\n }\n if (ac.params.openIn === 'dropdown' && ac.$inputEl) {\n ac.$inputEl.on('focus', onInputFocus);\n ac.$inputEl.on(ac.params.inputEvents, onInputChange);\n if (device.android) {\n $('html').on('click', onHtmlClick);\n } else {\n ac.$inputEl.on('blur', onInputBlur);\n }\n ac.$inputEl.on('keydown', onKeyDown);\n }\n };\n ac.detachEvents = function attachEvents() {\n if (ac.params.openIn !== 'dropdown' && ac.$openerEl) {\n ac.$openerEl.off('click', onOpenerClick);\n }\n if (ac.params.openIn === 'dropdown' && ac.$inputEl) {\n ac.$inputEl.off('focus', onInputFocus);\n ac.$inputEl.off(ac.params.inputEvents, onInputChange);\n if (device.android) {\n $('html').off('click', onHtmlClick);\n } else {\n ac.$inputEl.off('blur', onInputBlur);\n }\n ac.$inputEl.off('keydown', onKeyDown);\n }\n };\n ac.attachDropdownEvents = function attachDropdownEvents() {\n ac.$dropdownEl.on('click', 'label', onDropdownClick);\n app.on('resize', onResize);\n };\n ac.detachDropdownEvents = function detachDropdownEvents() {\n ac.$dropdownEl.off('click', 'label', onDropdownClick);\n app.off('resize', onResize);\n };\n ac.attachPageEvents = function attachPageEvents() {\n ac.$el.on('change', 'input[type=\"radio\"], input[type=\"checkbox\"]', onPageInputChange);\n if (ac.params.closeOnSelect && !ac.params.multiple) {\n ac.$el.once('click', '.list label', () => {\n nextTick(() => {\n ac.close();\n });\n });\n }\n };\n ac.detachPageEvents = function detachPageEvents() {\n ac.$el.off('change', 'input[type=\"radio\"], input[type=\"checkbox\"]', onPageInputChange);\n };\n\n // Install Modules\n ac.useModules();\n\n // Init\n ac.init();\n return ac;\n }\n get view() {\n const ac = this;\n const {\n $openerEl,\n $inputEl,\n app\n } = ac;\n let view;\n if (ac.params.view) {\n view = ac.params.view;\n } else if ($openerEl || $inputEl) {\n const $el = $openerEl || $inputEl;\n view = $el.closest('.view').length && $el.closest('.view')[0].f7View;\n }\n if (!view) view = app.views.main;\n return view;\n }\n positionDropdown() {\n const ac = this;\n const {\n $inputEl,\n app,\n $dropdownEl\n } = ac;\n const $pageContentEl = $inputEl.parents('.page-content');\n if ($pageContentEl.length === 0) return;\n const inputOffset = $inputEl.offset();\n const inputOffsetWidth = $inputEl[0].offsetWidth;\n const inputOffsetHeight = $inputEl[0].offsetHeight;\n const $listEl = $inputEl.parents('.list');\n let $listParent;\n $listEl.parents().each(parentEl => {\n if ($listParent) return;\n const $parentEl = $(parentEl);\n if ($parentEl.parent($pageContentEl).length) $listParent = $parentEl;\n });\n const listOffset = $listEl.offset();\n const paddingBottom = parseInt($pageContentEl.css('padding-bottom'), 10);\n const listOffsetLeft = $listEl.length > 0 ? listOffset.left - $pageContentEl.offset().left : 0;\n const inputOffsetLeft = inputOffset.left - ($listEl.length > 0 ? listOffset.left : 0) - (app.rtl ? 0 : 0);\n const inputOffsetTop = inputOffset.top - ($pageContentEl.offset().top - $pageContentEl[0].scrollTop);\n const maxHeight = $pageContentEl[0].scrollHeight - paddingBottom - (inputOffsetTop + $pageContentEl[0].scrollTop) - $inputEl[0].offsetHeight;\n const paddingProp = app.rtl ? 'padding-right' : 'padding-left';\n let paddingValue;\n if ($listEl.length) {\n paddingValue = (app.rtl ? $listEl[0].offsetWidth - inputOffsetLeft - inputOffsetWidth : inputOffsetLeft) - (app.theme === 'md' ? 16 : 15);\n }\n $dropdownEl.css({\n left: `${$listEl.length > 0 ? listOffsetLeft : inputOffsetLeft}px`,\n top: `${inputOffsetTop + $pageContentEl[0].scrollTop + inputOffsetHeight}px`,\n width: `${$listEl.length > 0 ? $listEl[0].offsetWidth : inputOffsetWidth}px`\n });\n $dropdownEl.children('.autocomplete-dropdown-inner').css({\n maxHeight: `${maxHeight}px`,\n [paddingProp]: $listEl.length > 0 ? `${paddingValue}px` : ''\n });\n }\n focus() {\n const ac = this;\n ac.$el.find('input[type=search]').focus();\n }\n source(query) {\n const ac = this;\n if (!ac.params.source) return;\n const {\n $el\n } = ac;\n ac.params.source.call(ac, query, items => {\n let itemsHTML = '';\n const limit = ac.params.limit ? Math.min(ac.params.limit, items.length) : items.length;\n ac.items = items;\n for (let i = 0; i < limit; i += 1) {\n let selected = false;\n const itemValue = typeof items[i] === 'object' ? items[i][ac.params.valueProperty] : items[i];\n for (let j = 0; j < ac.value.length; j += 1) {\n const aValue = typeof ac.value[j] === 'object' ? ac.value[j][ac.params.valueProperty] : ac.value[j];\n if (aValue === itemValue || aValue * 1 === itemValue * 1) selected = true;\n }\n itemsHTML += ac.renderItem({\n value: itemValue,\n text: typeof items[i] === 'object' ? items[i][ac.params.textProperty] : items[i],\n inputType: ac.inputType,\n id: ac.id,\n inputName: ac.inputName,\n selected\n }, i);\n }\n $el.find('.autocomplete-found ul').html(itemsHTML);\n if (items.length === 0) {\n if (query.length !== 0) {\n $el.find('.autocomplete-not-found').show();\n $el.find('.autocomplete-found, .autocomplete-values').hide();\n } else {\n $el.find('.autocomplete-values').show();\n $el.find('.autocomplete-found, .autocomplete-not-found').hide();\n }\n } else {\n $el.find('.autocomplete-found').show();\n $el.find('.autocomplete-not-found, .autocomplete-values').hide();\n }\n });\n }\n updateValues() {\n const ac = this;\n let valuesHTML = '';\n for (let i = 0; i < ac.value.length; i += 1) {\n valuesHTML += ac.renderItem({\n value: typeof ac.value[i] === 'object' ? ac.value[i][ac.params.valueProperty] : ac.value[i],\n text: typeof ac.value[i] === 'object' ? ac.value[i][ac.params.textProperty] : ac.value[i],\n inputType: ac.inputType,\n id: ac.id,\n inputName: `${ac.inputName}-checked}`,\n selected: true\n }, i);\n }\n ac.$el.find('.autocomplete-values ul').html(valuesHTML);\n }\n preloaderHide() {\n const ac = this;\n if (ac.params.openIn === 'dropdown' && ac.$dropdownEl) {\n ac.$dropdownEl.find('.autocomplete-preloader').removeClass('autocomplete-preloader-visible');\n } else {\n $('.autocomplete-preloader').removeClass('autocomplete-preloader-visible');\n }\n }\n preloaderShow() {\n const ac = this;\n if (ac.params.openIn === 'dropdown' && ac.$dropdownEl) {\n ac.$dropdownEl.find('.autocomplete-preloader').addClass('autocomplete-preloader-visible');\n } else {\n $('.autocomplete-preloader').addClass('autocomplete-preloader-visible');\n }\n }\n renderPreloader() {\n const ac = this;\n const preloaders = {\n iosPreloaderContent,\n mdPreloaderContent\n };\n return $jsx(\"div\", {\n class: `autocomplete-preloader preloader ${ac.params.preloaderColor ? `color-${ac.params.preloaderColor}` : ''}`\n }, preloaders[`${ac.app.theme}PreloaderContent`] || '');\n }\n renderSearchbar() {\n const ac = this;\n if (ac.params.renderSearchbar) return ac.params.renderSearchbar.call(ac);\n return $jsx(\"form\", {\n class: \"searchbar\"\n }, $jsx(\"div\", {\n class: \"searchbar-inner\"\n }, $jsx(\"div\", {\n class: \"searchbar-input-wrap\"\n }, $jsx(\"input\", {\n type: \"search\",\n spellcheck: ac.params.searchbarSpellcheck || 'false',\n placeholder: ac.params.searchbarPlaceholder\n }), $jsx(\"i\", {\n class: \"searchbar-icon\"\n }), $jsx(\"span\", {\n class: \"input-clear-button\"\n })), ac.params.searchbarDisableButton && $jsx(\"span\", {\n class: \"searchbar-disable-button\"\n }, ac.params.searchbarDisableText)));\n }\n renderItem(item, index) {\n const ac = this;\n if (ac.params.renderItem) return ac.params.renderItem.call(ac, item, index);\n const itemValue = item.value && typeof item.value === 'string' ? item.value.replace(/\"/g, '"') : item.value;\n if (ac.params.openIn !== 'dropdown') {\n return $jsx(\"li\", null, $jsx(\"label\", {\n class: `item-${item.inputType} item-content`\n }, $jsx(\"input\", {\n type: item.inputType,\n name: item.inputName,\n value: itemValue,\n _checked: item.selected\n }), $jsx(\"i\", {\n class: `icon icon-${item.inputType}`\n }), $jsx(\"div\", {\n class: \"item-inner\"\n }, $jsx(\"div\", {\n class: \"item-title\"\n }, item.text))));\n }\n // Dropdown\n if (!item.placeholder) {\n return $jsx(\"li\", null, $jsx(\"label\", {\n class: \"item-radio item-content\",\n \"data-value\": itemValue\n }, $jsx(\"div\", {\n class: \"item-inner\"\n }, $jsx(\"div\", {\n class: \"item-title\"\n }, item.text))));\n }\n\n // Dropwdown placeholder\n return $jsx(\"li\", {\n class: \"autocomplete-dropdown-placeholder\"\n }, $jsx(\"label\", {\n class: \"item-content\"\n }, $jsx(\"div\", {\n class: \"item-inner\"\n }, $jsx(\"div\", {\n class: \"item-title\"\n }, item.text))));\n }\n renderNavbar() {\n const ac = this;\n if (ac.params.renderNavbar) return ac.params.renderNavbar.call(ac);\n let pageTitle = ac.params.pageTitle;\n if (typeof pageTitle === 'undefined' && ac.$openerEl && ac.$openerEl.length) {\n pageTitle = ac.$openerEl.find('.item-title').text().trim();\n }\n const inPopup = ac.params.openIn === 'popup';\n\n // eslint-disable-next-line\n const navbarLeft = inPopup ? ac.params.preloader && $jsx(\"div\", {\n class: \"left\"\n }, ac.renderPreloader()) : $jsx(\"div\", {\n class: \"left sliding\"\n }, $jsx(\"a\", {\n class: \"link back\"\n }, $jsx(\"i\", {\n class: \"icon icon-back\"\n }), $jsx(\"span\", {\n class: \"if-not-md\"\n }, ac.params.pageBackLinkText)));\n const navbarRight = inPopup ? $jsx(\"div\", {\n class: \"right\"\n }, $jsx(\"a\", {\n class: \"link popup-close\",\n \"data-popup\": \".autocomplete-popup\"\n }, ac.params.popupCloseLinkText)) : ac.params.preloader && $jsx(\"div\", {\n class: \"right\"\n }, ac.renderPreloader());\n return $jsx(\"div\", {\n class: `navbar ${ac.params.navbarColorTheme ? `color-${ac.params.navbarColorTheme}` : ''}`\n }, $jsx(\"div\", {\n class: \"navbar-bg\"\n }), $jsx(\"div\", {\n class: `navbar-inner ${ac.params.navbarColorTheme ? `color-${ac.params.navbarColorTheme}` : ''}`\n }, navbarLeft, pageTitle && $jsx(\"div\", {\n class: \"title sliding\"\n }, pageTitle), navbarRight, $jsx(\"div\", {\n class: \"subnavbar sliding\"\n }, ac.renderSearchbar())));\n }\n renderDropdown() {\n const ac = this;\n if (ac.params.renderDropdown) return ac.params.renderDropdown.call(ac, ac.items);\n return $jsx(\"div\", {\n class: \"autocomplete-dropdown\"\n }, $jsx(\"div\", {\n class: \"autocomplete-dropdown-inner\"\n }, $jsx(\"div\", {\n class: `list no-safe-areas`\n }, $jsx(\"ul\", null))), ac.params.preloader && ac.renderPreloader());\n }\n renderPage(inPopup) {\n const ac = this;\n if (ac.params.renderPage) return ac.params.renderPage.call(ac, ac.items);\n return $jsx(\"div\", {\n class: \"page page-with-subnavbar autocomplete-page\",\n \"data-name\": \"autocomplete-page\"\n }, ac.renderNavbar(inPopup), $jsx(\"div\", {\n class: \"searchbar-backdrop\"\n }), $jsx(\"div\", {\n class: \"page-content\"\n }, $jsx(\"div\", {\n class: `list autocomplete-list autocomplete-found autocomplete-list-${ac.id} ${ac.params.formColorTheme ? `color-${ac.params.formColorTheme}` : ''}`\n }, $jsx(\"ul\", null)), $jsx(\"div\", {\n class: \"list autocomplete-not-found\"\n }, $jsx(\"ul\", null, $jsx(\"li\", {\n class: \"item-content\"\n }, $jsx(\"div\", {\n class: \"item-inner\"\n }, $jsx(\"div\", {\n class: \"item-title\"\n }, ac.params.notFoundText))))), $jsx(\"div\", {\n class: \"list autocomplete-values\"\n }, $jsx(\"ul\", null))));\n }\n renderPopup() {\n const ac = this;\n if (ac.params.renderPopup) return ac.params.renderPopup.call(ac, ac.items);\n return $jsx(\"div\", {\n class: \"popup autocomplete-popup\"\n }, $jsx(\"div\", {\n class: \"view\"\n }, ac.renderPage(true), \";\"));\n }\n onOpen(type, el) {\n const ac = this;\n const app = ac.app;\n const $el = $(el);\n ac.$el = $el;\n ac.el = $el[0];\n ac.openedIn = type;\n ac.opened = true;\n if (ac.params.openIn === 'dropdown') {\n ac.attachDropdownEvents();\n ac.$dropdownEl.addClass('autocomplete-dropdown-in');\n ac.$inputEl.trigger('input');\n } else {\n // Init SB\n let $searchbarEl = $el.find('.searchbar');\n if (ac.params.openIn === 'page' && app.theme === 'ios' && $searchbarEl.length === 0) {\n $searchbarEl = $(app.navbar.getElByPage($el)).find('.searchbar');\n }\n ac.searchbar = app.searchbar.create({\n el: $searchbarEl,\n backdropEl: $el.find('.searchbar-backdrop'),\n customSearch: true,\n on: {\n search(sb, query) {\n if (query.length === 0 && ac.searchbar.enabled) {\n ac.searchbar.backdropShow();\n } else {\n ac.searchbar.backdropHide();\n }\n ac.source(query);\n }\n }\n });\n\n // Attach page events\n ac.attachPageEvents();\n\n // Update Values On Page Init\n ac.updateValues();\n\n // Source on load\n if (ac.params.requestSourceOnOpen) ac.source('');\n }\n ac.emit('local::open autocompleteOpen', ac);\n }\n autoFocus() {\n const ac = this;\n if (ac.searchbar && ac.searchbar.$inputEl) {\n ac.searchbar.$inputEl.focus();\n }\n return ac;\n }\n onOpened() {\n const ac = this;\n if (ac.params.openIn !== 'dropdown' && ac.params.autoFocus) {\n ac.autoFocus();\n }\n ac.emit('local::opened autocompleteOpened', ac);\n }\n onClose() {\n const ac = this;\n if (ac.destroyed) return;\n\n // Destroy SB\n if (ac.searchbar && ac.searchbar.destroy) {\n ac.searchbar.destroy();\n ac.searchbar = null;\n delete ac.searchbar;\n }\n if (ac.params.openIn === 'dropdown') {\n ac.detachDropdownEvents();\n ac.$dropdownEl.removeClass('autocomplete-dropdown-in').remove();\n } else {\n ac.detachPageEvents();\n }\n ac.emit('local::close autocompleteClose', ac);\n }\n onClosed() {\n const ac = this;\n if (ac.destroyed) return;\n ac.opened = false;\n ac.$el = null;\n ac.el = null;\n delete ac.$el;\n delete ac.el;\n ac.emit('local::closed autocompleteClosed', ac);\n }\n openPage() {\n const ac = this;\n if (ac.opened) return ac;\n const pageHtml = ac.renderPage();\n ac.view.router.navigate({\n url: ac.url,\n route: {\n content: pageHtml,\n path: ac.url,\n on: {\n pageBeforeIn(e, page) {\n ac.onOpen('page', page.el);\n },\n pageAfterIn(e, page) {\n ac.onOpened('page', page.el);\n },\n pageBeforeOut(e, page) {\n ac.onClose('page', page.el);\n },\n pageAfterOut(e, page) {\n ac.onClosed('page', page.el);\n }\n },\n options: {\n animate: ac.params.animate\n }\n }\n });\n return ac;\n }\n openPopup() {\n const ac = this;\n if (ac.opened) return ac;\n const popupHtml = ac.renderPopup();\n const popupParams = {\n content: popupHtml,\n animate: ac.params.animate,\n push: ac.params.popupPush,\n swipeToClose: ac.params.popupSwipeToClose,\n on: {\n popupOpen(popup) {\n ac.onOpen('popup', popup.el);\n },\n popupOpened(popup) {\n ac.onOpened('popup', popup.el);\n },\n popupClose(popup) {\n ac.onClose('popup', popup.el);\n },\n popupClosed(popup) {\n ac.onClosed('popup', popup.el);\n }\n }\n };\n if (ac.params.routableModals && ac.view) {\n ac.view.router.navigate({\n url: ac.url,\n route: {\n path: ac.url,\n popup: popupParams\n }\n });\n } else {\n ac.modal = ac.app.popup.create(popupParams).open(ac.params.animate);\n }\n return ac;\n }\n openDropdown() {\n const ac = this;\n if (!ac.$dropdownEl) {\n ac.$dropdownEl = $(ac.renderDropdown());\n }\n const $pageContentEl = ac.$inputEl.parents('.page-content');\n if (ac.params.dropdownContainerEl) {\n $(ac.params.dropdownContainerEl).append(ac.$dropdownEl);\n } else if ($pageContentEl.length === 0) {\n ac.$dropdownEl.insertAfter(ac.$inputEl);\n } else {\n ac.positionDropdown();\n $pageContentEl.append(ac.$dropdownEl);\n }\n ac.onOpen('dropdown', ac.$dropdownEl);\n ac.onOpened('dropdown', ac.$dropdownEl);\n }\n open() {\n const ac = this;\n if (ac.opened) return ac;\n const openIn = ac.params.openIn;\n ac[`open${openIn.split('').map((el, index) => {\n if (index === 0) return el.toUpperCase();\n return el;\n }).join('')}`]();\n return ac;\n }\n close() {\n const ac = this;\n if (!ac.opened) return ac;\n if (ac.params.openIn === 'dropdown') {\n ac.onClose();\n ac.onClosed();\n } else if (ac.params.routableModals && ac.view || ac.openedIn === 'page') {\n ac.view.router.back({\n animate: ac.params.animate\n });\n } else {\n ac.modal.once('modalClosed', () => {\n nextTick(() => {\n if (ac.destroyed) return;\n ac.modal.destroy();\n delete ac.modal;\n });\n });\n ac.modal.close();\n }\n return ac;\n }\n init() {\n const ac = this;\n ac.attachEvents();\n }\n destroy() {\n const ac = this;\n ac.emit('local::beforeDestroy autocompleteBeforeDestroy', ac);\n ac.detachEvents();\n if (ac.$inputEl && ac.$inputEl[0]) {\n delete ac.$inputEl[0].f7Autocomplete;\n }\n if (ac.$openerEl && ac.$openerEl[0]) {\n delete ac.$openerEl[0].f7Autocomplete;\n }\n deleteProps(ac);\n ac.destroyed = true;\n }\n}\nexport default Autocomplete;", "import { extend } from '../../shared/utils.js';\nimport Autocomplete from './autocomplete-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'autocomplete',\n params: {\n autocomplete: {\n openerEl: undefined,\n inputEl: undefined,\n view: undefined,\n // DropDown\n dropdownContainerEl: undefined,\n dropdownPlaceholderText: undefined,\n typeahead: false,\n highlightMatches: true,\n updateInputValueOnSelect: true,\n inputEvents: 'input',\n value: undefined,\n multiple: false,\n source: undefined,\n limit: undefined,\n valueProperty: 'id',\n textProperty: 'text',\n openIn: 'page',\n // or 'popup' or 'dropdown'\n pageBackLinkText: 'Back',\n popupCloseLinkText: 'Close',\n pageTitle: undefined,\n searchbarPlaceholder: 'Search...',\n searchbarDisableText: 'Cancel',\n searchbarDisableButton: true,\n searchbarSpellcheck: false,\n popupPush: false,\n popupSwipeToClose: undefined,\n animate: true,\n autoFocus: false,\n closeOnSelect: false,\n notFoundText: 'Nothing found',\n requestSourceOnOpen: false,\n // Preloader\n preloaderColor: undefined,\n preloader: false,\n // Colors\n formColorTheme: undefined,\n navbarColorTheme: undefined,\n // Routing\n routableModals: false,\n url: 'select/',\n // Custom render functions\n renderDropdown: undefined,\n renderPage: undefined,\n renderPopup: undefined,\n renderItem: undefined,\n renderSearchbar: undefined,\n renderNavbar: undefined\n }\n },\n static: {\n Autocomplete\n },\n create() {\n const app = this;\n app.autocomplete = extend(ConstructorMethods({\n defaultSelector: undefined,\n constructor: Autocomplete,\n app,\n domProp: 'f7Autocomplete'\n }), {\n open(autocompleteEl) {\n const ac = app.autocomplete.get(autocompleteEl);\n if (ac && ac.open) return ac.open();\n return undefined;\n },\n close(autocompleteEl) {\n const ac = app.autocomplete.get(autocompleteEl);\n if (ac && ac.close) return ac.close();\n return undefined;\n }\n });\n }\n};", "import { getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport { getSupport } from '../../shared/get-support.js';\nimport Framework7Class from '../../shared/class.js';\nclass Tooltip extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const tooltip = this;\n const support = getSupport();\n const defaults = extend({}, app.params.tooltip);\n const document = getDocument();\n\n // Extend defaults with modules params\n tooltip.useModulesParams(defaults);\n tooltip.params = extend(defaults, params);\n if (typeof params.offset === 'undefined' && support.touch && tooltip.params.trigger === 'hover') {\n tooltip.params.offset = 10;\n }\n const {\n targetEl,\n containerEl\n } = tooltip.params;\n if (!targetEl && !tooltip.params.delegated) return tooltip;\n const $targetEl = $(targetEl);\n if ($targetEl.length === 0 && !tooltip.params.delegated) return tooltip;\n if ($targetEl[0] && $targetEl[0].f7Tooltip && !tooltip.params.delegated) return $targetEl[0].f7Tooltip;\n let $containerEl = $(containerEl || app.$el).eq(0);\n if ($containerEl.length === 0) {\n $containerEl = app.$el;\n }\n const $el = $(tooltip.render()).eq(0);\n extend(tooltip, {\n app,\n $targetEl,\n targetEl: $targetEl && $targetEl[0],\n $containerEl,\n containerEl: $containerEl && $containerEl[0],\n $el,\n el: $el && $el[0],\n text: tooltip.params.text || '',\n visible: false,\n opened: false\n });\n if ($targetEl[0]) $targetEl[0].f7Tooltip = tooltip;\n const touchesStart = {};\n let isTouched;\n function handleClick() {\n if (tooltip.opened) tooltip.hide();else tooltip.show(this);\n }\n function handleClickOut(e) {\n if (tooltip.opened && ($(e.target).closest($targetEl).length || $(e.target).closest(tooltip.$el).length)) return;\n tooltip.hide();\n }\n function handleTouchStart(e) {\n if (isTouched) return;\n isTouched = true;\n touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n tooltip.show(this);\n }\n function handleTouchMove(e) {\n if (!isTouched) return;\n const x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n const y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n const distance = ((x - touchesStart.x) ** 2 + (y - touchesStart.y) ** 2) ** 0.5;\n if (distance > 50) {\n isTouched = false;\n tooltip.hide();\n }\n }\n function handleTouchEnd() {\n if (!isTouched) return;\n isTouched = false;\n tooltip.hide();\n }\n function handleMouseEnter() {\n tooltip.show(this);\n }\n function handleMouseLeave() {\n tooltip.hide();\n }\n function handleTransitionEnd() {\n if (!$el.hasClass('tooltip-in')) {\n $el.removeClass('tooltip-out').remove();\n }\n }\n tooltip.attachEvents = function attachEvents() {\n $el.on('transitionend', handleTransitionEnd);\n if (tooltip.params.trigger === 'click') {\n if (tooltip.params.delegated) {\n $(document).on('click', tooltip.params.targetEl, handleClick);\n } else {\n tooltip.$targetEl.on('click', handleClick);\n }\n $('html').on('click', handleClickOut);\n return;\n }\n if (tooltip.params.trigger === 'manual') return;\n if (support.touch) {\n const passive = support.passiveListener ? {\n passive: true\n } : false;\n if (tooltip.params.delegated) {\n $(document).on(app.touchEvents.start, tooltip.params.targetEl, handleTouchStart, passive);\n } else {\n tooltip.$targetEl.on(app.touchEvents.start, handleTouchStart, passive);\n }\n app.on('touchmove', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n } else {\n // eslint-disable-next-line\n if (tooltip.params.delegated) {\n $(document).on(support.pointerEvents ? 'pointerenter' : 'mouseenter', tooltip.params.targetEl, handleMouseEnter, true);\n $(document).on(support.pointerEvents ? 'pointerleave' : 'mouseleave', tooltip.params.targetEl, handleMouseLeave, true);\n } else {\n tooltip.$targetEl.on(support.pointerEvents ? 'pointerenter' : 'mouseenter', handleMouseEnter);\n tooltip.$targetEl.on(support.pointerEvents ? 'pointerleave' : 'mouseleave', handleMouseLeave);\n }\n }\n };\n tooltip.detachEvents = function detachEvents() {\n $el.off('transitionend', handleTransitionEnd);\n if (tooltip.params.trigger === 'click') {\n if (tooltip.params.delegated) {\n $(document).on('click', tooltip.params.targetEl, handleClick);\n } else {\n tooltip.$targetEl.off('click', handleClick);\n }\n $('html').off('click', handleClickOut);\n return;\n }\n if (tooltip.params.trigger === 'manual') return;\n if (support.touch) {\n const passive = support.passiveListener ? {\n passive: true\n } : false;\n if (tooltip.params.delegated) {\n $(document).off(app.touchEvents.start, tooltip.params.targetEl, handleTouchStart, passive);\n } else {\n tooltip.$targetEl.off(app.touchEvents.start, handleTouchStart, passive);\n }\n app.off('touchmove', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n } else {\n // eslint-disable-next-line\n if (tooltip.params.delegated) {\n $(document).off(support.pointerEvents ? 'pointerenter' : 'mouseenter', tooltip.params.targetEl, handleMouseEnter, true);\n $(document).off(support.pointerEvents ? 'pointerleave' : 'mouseleave', tooltip.params.targetEl, handleMouseLeave, true);\n } else {\n tooltip.$targetEl.off(support.pointerEvents ? 'pointerenter' : 'mouseenter', handleMouseEnter);\n tooltip.$targetEl.off(support.pointerEvents ? 'pointerleave' : 'mouseleave', handleMouseLeave);\n }\n }\n };\n\n // Install Modules\n tooltip.useModules();\n tooltip.init();\n return tooltip;\n }\n setTargetEl(targetEl) {\n const tooltip = this;\n tooltip.detachEvents();\n tooltip.$targetEl = $(targetEl);\n tooltip.targetEl = tooltip.$targetEl[0];\n tooltip.attachEvents();\n return tooltip;\n }\n position(targetEl) {\n const tooltip = this;\n const {\n $el,\n app,\n $containerEl\n } = tooltip;\n const hasContainerEl = !!tooltip.params.containerEl;\n const tooltipOffset = tooltip.params.offset || 0;\n $el.css({\n left: '',\n top: ''\n });\n const $targetEl = $(targetEl || tooltip.targetEl);\n const [width, height] = [$el.width(), $el.height()];\n $el.css({\n left: '',\n top: ''\n });\n let targetWidth;\n let targetHeight;\n let targetOffsetLeft;\n let targetOffsetTop;\n const boundaries = hasContainerEl && $containerEl.length ? $containerEl[0].getBoundingClientRect() : app;\n if ($targetEl && $targetEl.length > 0) {\n targetWidth = $targetEl.outerWidth();\n targetHeight = $targetEl.outerHeight();\n if (typeof targetWidth === 'undefined' && typeof targetHeight === 'undefined') {\n const clientRect = $targetEl[0].getBoundingClientRect();\n targetWidth = clientRect.width;\n targetHeight = clientRect.height;\n }\n const targetOffset = $targetEl.offset();\n targetOffsetLeft = targetOffset.left - boundaries.left;\n targetOffsetTop = targetOffset.top - boundaries.top;\n const targetParentPage = $targetEl.parents('.page');\n if (targetParentPage.length > 0) {\n targetOffsetTop -= targetParentPage[0].scrollTop;\n }\n }\n let [left, top] = [0, 0, 0];\n\n // Top Position\n let position = 'top';\n if (height + tooltipOffset < targetOffsetTop) {\n // On top\n top = targetOffsetTop - height - tooltipOffset;\n } else if (height < boundaries.height - targetOffsetTop - targetHeight) {\n // On bottom\n position = 'bottom';\n top = targetOffsetTop + targetHeight + tooltipOffset;\n } else {\n // On middle\n position = 'middle';\n top = targetHeight / 2 + targetOffsetTop - height / 2;\n if (top <= 0) {\n top = 8;\n } else if (top + height >= boundaries.height) {\n top = boundaries.height - height - 8;\n }\n }\n\n // Horizontal Position\n if (position === 'top' || position === 'bottom') {\n left = targetWidth / 2 + targetOffsetLeft - width / 2;\n if (left < 8) left = 8;\n if (left + width > boundaries.width) left = boundaries.width - width - 8;\n if (left < 0) left = 0;\n } else if (position === 'middle') {\n left = targetOffsetLeft - width;\n if (left < 8 || left + width > boundaries.width) {\n if (left < 8) left = targetOffsetLeft + targetWidth;\n if (left + width > boundaries.width) left = boundaries.width - width - 8;\n }\n }\n\n // Apply Styles\n $el.css({\n top: `${top}px`,\n left: `${left}px`\n });\n }\n show(aroundEl) {\n const tooltip = this;\n const {\n $el,\n $targetEl,\n $containerEl\n } = tooltip;\n if ($containerEl[0] && $el[0] && !$containerEl[0].contains($el[0])) {\n $containerEl.append($el);\n }\n tooltip.position(aroundEl);\n const $aroundEl = $(aroundEl);\n tooltip.visible = true;\n tooltip.opened = true;\n $targetEl.trigger('tooltip:show');\n $el.trigger('tooltip:show');\n if ($aroundEl.length && $aroundEl[0] !== $targetEl[0]) {\n $aroundEl.trigger('tooltip:show');\n }\n tooltip.emit('local::show tooltipShow', tooltip);\n $el.removeClass('tooltip-out').addClass('tooltip-in');\n return tooltip;\n }\n hide() {\n const tooltip = this;\n const {\n $el,\n $targetEl\n } = tooltip;\n tooltip.visible = false;\n tooltip.opened = false;\n $targetEl.trigger('tooltip:hide');\n $el.trigger('tooltip:hide');\n tooltip.emit('local::hide tooltipHide', tooltip);\n $el.addClass('tooltip-out').removeClass('tooltip-in');\n return tooltip;\n }\n render() {\n const tooltip = this;\n if (tooltip.params.render) return tooltip.params.render.call(tooltip, tooltip);\n const {\n cssClass,\n text\n } = tooltip.params;\n return `\n \n `.trim();\n }\n setText(newText) {\n const tooltip = this;\n if (typeof newText === 'undefined') {\n return tooltip;\n }\n tooltip.params.text = newText;\n tooltip.text = newText;\n if (tooltip.$el) {\n tooltip.$el.children('.tooltip-content').html(newText);\n }\n if (tooltip.opened) {\n tooltip.position();\n }\n return tooltip;\n }\n init() {\n const tooltip = this;\n tooltip.attachEvents();\n }\n destroy() {\n const tooltip = this;\n if (!tooltip.$targetEl || tooltip.destroyed) return;\n tooltip.$targetEl.trigger('tooltip:beforedestroy');\n tooltip.emit('local::beforeDestroy tooltipBeforeDestroy', tooltip);\n tooltip.$el.remove();\n if (tooltip.$targetEl[0]) delete tooltip.$targetEl[0].f7Tooltip;\n tooltip.detachEvents();\n deleteProps(tooltip);\n tooltip.destroyed = true;\n }\n}\nexport default Tooltip;", "import $ from '../../shared/dom7.js';\nimport Tooltip from './tooltip-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'tooltip',\n static: {\n Tooltip\n },\n create() {\n const app = this;\n app.tooltip = ConstructorMethods({\n defaultSelector: '.tooltip',\n constructor: Tooltip,\n app,\n domProp: 'f7Tooltip'\n });\n app.tooltip.show = function show(el) {\n const $el = $(el);\n if ($el.length === 0) return undefined;\n const tooltip = $el[0].f7Tooltip;\n if (!tooltip) return undefined;\n tooltip.show($el[0]);\n return tooltip;\n };\n app.tooltip.hide = function hide(el) {\n const $el = $(el);\n if ($el.length === 0) return undefined;\n const tooltip = $el[0].f7Tooltip;\n if (!tooltip) return undefined;\n tooltip.hide();\n return tooltip;\n };\n app.tooltip.setText = function text(el, newText) {\n const $el = $(el);\n if ($el.length === 0) return undefined;\n const tooltip = $el[0].f7Tooltip;\n if (!tooltip) return undefined;\n tooltip.setText(newText);\n return tooltip;\n };\n },\n params: {\n tooltip: {\n targetEl: null,\n delegated: false,\n text: null,\n cssClass: null,\n render: null,\n offset: 0,\n trigger: 'hover',\n containerEl: undefined\n }\n },\n on: {\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.tooltip-init').each(el => {\n const text = $(el).attr('data-tooltip');\n if (!text) return;\n app.tooltip.create({\n targetEl: el,\n text\n });\n });\n },\n tabBeforeRemove(tabEl) {\n $(tabEl).find('.tooltip-init').each(el => {\n if (el.f7Tooltip) el.f7Tooltip.destroy();\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.tooltip-init').each(el => {\n const text = $(el).attr('data-tooltip');\n if (!text) return;\n app.tooltip.create({\n targetEl: el,\n text\n });\n });\n if (app.theme === 'ios' && page.view && page.view.router.dynamicNavbar && page.$navbarEl && page.$navbarEl.length > 0) {\n page.$navbarEl.find('.tooltip-init').each(el => {\n const text = $(el).attr('data-tooltip');\n if (!text) return;\n app.tooltip.create({\n targetEl: el,\n text\n });\n });\n }\n },\n pageBeforeRemove(page) {\n const app = this;\n page.$el.find('.tooltip-init').each(el => {\n if (el.f7Tooltip) el.f7Tooltip.destroy();\n });\n if (app.theme === 'ios' && page.view && page.view.router.dynamicNavbar && page.$navbarEl && page.$navbarEl.length > 0) {\n page.$navbarEl.find('.tooltip-init').each(el => {\n if (el.f7Tooltip) el.f7Tooltip.destroy();\n });\n }\n }\n },\n vnode: {\n 'tooltip-init': {\n insert(vnode) {\n const app = this;\n const el = vnode.elm;\n const text = $(el).attr('data-tooltip');\n if (!text) return;\n app.tooltip.create({\n targetEl: el,\n text\n });\n },\n update(vnode) {\n const el = vnode.elm;\n if (!el.f7Tooltip) return;\n if (vnode && vnode.data && vnode.data.attrs && vnode.data.attrs['data-tooltip']) {\n el.f7Tooltip.setText(vnode.data.attrs['data-tooltip']);\n }\n },\n destroy(vnode) {\n const el = vnode.elm;\n if (el.f7Tooltip) el.f7Tooltip.destroy();\n }\n }\n }\n};", "/* eslint no-nested-ternary: off */\nimport { getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass Gauge extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const self = this;\n const defaults = extend({}, app.params.gauge);\n\n // Extend defaults with modules params\n self.useModulesParams(defaults);\n self.params = extend(defaults, params);\n const {\n el\n } = self.params;\n if (!el) return self;\n const $el = $(el);\n if ($el.length === 0) return self;\n if ($el[0].f7Gauge) return $el[0].f7Gauge;\n extend(self, {\n app,\n $el,\n el: $el && $el[0]\n });\n $el[0].f7Gauge = self;\n\n // Install Modules\n self.useModules();\n self.init();\n return self;\n }\n calcRadius() {\n const self = this;\n const {\n size,\n borderWidth\n } = self.params;\n return size / 2 - borderWidth / 2;\n }\n calcBorderLength() {\n const self = this;\n const radius = self.calcRadius();\n return 2 * Math.PI * radius;\n }\n render() {\n const self = this;\n if (self.params.render) return self.params.render.call(self, self);\n const {\n type,\n value,\n size,\n bgColor,\n borderBgColor,\n borderColor,\n borderWidth,\n valueText,\n valueTextColor,\n valueFontSize,\n valueFontWeight,\n labelText,\n labelTextColor,\n labelFontSize,\n labelFontWeight\n } = self.params;\n const semiCircle = type === 'semicircle';\n const radius = self.calcRadius();\n const length = self.calcBorderLength();\n const progress = Math.max(Math.min(value, 1), 0);\n return $jsx(\"svg\", {\n class: \"gauge-svg\",\n width: `${size}px`,\n height: `${semiCircle ? size / 2 : size}px`,\n viewBox: `0 0 ${size} ${semiCircle ? size / 2 : size}`\n }, semiCircle && $jsx(\"path\", {\n class: \"gauge-back-semi\",\n d: `M${size - borderWidth / 2},${size / 2} a1,1 0 0,0 -${size - borderWidth},0`,\n stroke: borderBgColor,\n \"stroke-width\": borderWidth,\n fill: bgColor || 'none'\n }), semiCircle && $jsx(\"path\", {\n class: \"gauge-front-semi\",\n d: `M${size - borderWidth / 2},${size / 2} a1,1 0 0,0 -${size - borderWidth},0`,\n stroke: borderColor,\n \"stroke-width\": borderWidth,\n \"stroke-dasharray\": length / 2,\n \"stroke-dashoffset\": length / 2 * (1 + progress),\n fill: borderBgColor ? 'none' : bgColor || 'none'\n }), !semiCircle && borderBgColor && $jsx(\"circle\", {\n class: \"gauge-back-circle\",\n stroke: borderBgColor,\n \"stroke-width\": borderWidth,\n fill: bgColor || 'none',\n cx: size / 2,\n cy: size / 2,\n r: radius\n }), !semiCircle && $jsx(\"circle\", {\n class: \"gauge-front-circle\",\n transform: `rotate(-90 ${size / 2} ${size / 2})`,\n stroke: borderColor,\n \"stroke-width\": borderWidth,\n \"stroke-dasharray\": length,\n \"stroke-dashoffset\": length * (1 - progress),\n fill: borderBgColor ? 'none' : bgColor || 'none',\n cx: size / 2,\n cy: size / 2,\n r: radius\n }), valueText && $jsx(\"text\", {\n class: \"gauge-value-text\",\n x: \"50%\",\n y: semiCircle ? '100%' : '50%',\n \"font-weight\": valueFontWeight,\n \"font-size\": valueFontSize,\n fill: valueTextColor,\n dy: semiCircle ? labelText ? -labelFontSize - 15 : -5 : 0,\n \"text-anchor\": \"middle\",\n \"dominant-baseline\": !semiCircle && 'middle'\n }, valueText), labelText && $jsx(\"text\", {\n class: \"gauge-label-text\",\n x: \"50%\",\n y: semiCircle ? '100%' : '50%',\n \"font-weight\": labelFontWeight,\n \"font-size\": labelFontSize,\n fill: labelTextColor,\n dy: semiCircle ? -5 : valueText ? valueFontSize / 2 + 10 : 0,\n \"text-anchor\": \"middle\",\n \"dominant-baseline\": !semiCircle && 'middle'\n }, labelText));\n }\n update(newParams) {\n if (newParams === void 0) {\n newParams = {};\n }\n const self = this;\n const document = getDocument();\n const {\n params,\n $svgEl\n } = self;\n Object.keys(newParams).forEach(param => {\n if (typeof newParams[param] !== 'undefined') {\n params[param] = newParams[param];\n }\n });\n if ($svgEl.length === 0) return self;\n const {\n value,\n size,\n bgColor,\n borderBgColor,\n borderColor,\n borderWidth,\n valueText,\n valueTextColor,\n valueFontSize,\n valueFontWeight,\n labelText,\n labelTextColor,\n labelFontSize,\n labelFontWeight\n } = params;\n const length = self.calcBorderLength();\n const progress = Math.max(Math.min(value, 1), 0);\n const radius = self.calcRadius();\n const semiCircle = params.type === 'semicircle';\n const svgAttrs = {\n width: `${size}px`,\n height: `${semiCircle ? size / 2 : size}px`,\n viewBox: `0 0 ${size} ${semiCircle ? size / 2 : size}`\n };\n Object.keys(svgAttrs).forEach(attr => {\n $svgEl.attr(attr, svgAttrs[attr]);\n });\n if (semiCircle) {\n const backAttrs = {\n d: `M${size - borderWidth / 2},${size / 2} a1,1 0 0,0 -${size - borderWidth},0`,\n stroke: borderBgColor,\n 'stroke-width': borderWidth,\n fill: bgColor || 'none'\n };\n const frontAttrs = {\n d: `M${size - borderWidth / 2},${size / 2} a1,1 0 0,0 -${size - borderWidth},0`,\n stroke: borderColor,\n 'stroke-width': borderWidth,\n 'stroke-dasharray': length / 2,\n 'stroke-dashoffset': length / 2 * (1 + progress),\n fill: borderBgColor ? 'none' : bgColor || 'none'\n };\n Object.keys(backAttrs).forEach(attr => {\n $svgEl.find('.gauge-back-semi').attr(attr, backAttrs[attr]);\n });\n Object.keys(frontAttrs).forEach(attr => {\n $svgEl.find('.gauge-front-semi').attr(attr, frontAttrs[attr]);\n });\n } else {\n const backAttrs = {\n stroke: borderBgColor,\n 'stroke-width': borderWidth,\n fill: bgColor || 'none',\n cx: size / 2,\n cy: size / 2,\n r: radius\n };\n const frontAttrs = {\n transform: `rotate(-90 ${size / 2} ${size / 2})`,\n stroke: borderColor,\n 'stroke-width': borderWidth,\n 'stroke-dasharray': length,\n 'stroke-dashoffset': length * (1 - progress),\n fill: borderBgColor ? 'none' : bgColor || 'none',\n cx: size / 2,\n cy: size / 2,\n r: radius\n };\n Object.keys(backAttrs).forEach(attr => {\n $svgEl.find('.gauge-back-circle').attr(attr, backAttrs[attr]);\n });\n Object.keys(frontAttrs).forEach(attr => {\n $svgEl.find('.gauge-front-circle').attr(attr, frontAttrs[attr]);\n });\n }\n if (valueText) {\n if (!$svgEl.find('.gauge-value-text').length) {\n const textEl = document.createElementNS('http://www.w3.org/2000/svg', 'text');\n textEl.classList.add('gauge-value-text');\n $svgEl.append(textEl);\n }\n const textAttrs = {\n x: '50%',\n y: semiCircle ? '100%' : '50%',\n 'font-weight': valueFontWeight,\n 'font-size': valueFontSize,\n fill: valueTextColor,\n dy: semiCircle ? labelText ? -labelFontSize - 15 : -5 : 0,\n 'text-anchor': 'middle',\n 'dominant-baseline': !semiCircle && 'middle'\n };\n Object.keys(textAttrs).forEach(attr => {\n $svgEl.find('.gauge-value-text').attr(attr, textAttrs[attr]);\n });\n $svgEl.find('.gauge-value-text').text(valueText);\n } else {\n $svgEl.find('.gauge-value-text').remove();\n }\n if (labelText) {\n if (!$svgEl.find('.gauge-label-text').length) {\n const textEl = document.createElementNS('http://www.w3.org/2000/svg', 'text');\n textEl.classList.add('gauge-label-text');\n $svgEl.append(textEl);\n }\n const labelAttrs = {\n x: '50%',\n y: semiCircle ? '100%' : '50%',\n 'font-weight': labelFontWeight,\n 'font-size': labelFontSize,\n fill: labelTextColor,\n dy: semiCircle ? -5 : valueText ? valueFontSize / 2 + 10 : 0,\n 'text-anchor': 'middle',\n 'dominant-baseline': !semiCircle && 'middle'\n };\n Object.keys(labelAttrs).forEach(attr => {\n $svgEl.find('.gauge-label-text').attr(attr, labelAttrs[attr]);\n });\n $svgEl.find('.gauge-label-text').text(labelText);\n } else {\n $svgEl.find('.gauge-label-text').remove();\n }\n return self;\n }\n init() {\n const self = this;\n const $svgEl = $(self.render()).eq(0);\n $svgEl.f7Gauge = self;\n extend(self, {\n $svgEl,\n svgEl: $svgEl && $svgEl[0]\n });\n self.$el.append($svgEl);\n return self;\n }\n destroy() {\n const self = this;\n if (!self.$el || self.destroyed) return;\n self.$el.trigger('gauge:beforedestroy');\n self.emit('local::beforeDestroy gaugeBeforeDestroy', self);\n self.$svgEl.remove();\n delete self.$el[0].f7Gauge;\n deleteProps(self);\n self.destroyed = true;\n }\n}\nexport default Gauge;", "import $ from '../../shared/dom7.js';\nimport Gauge from './gauge-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nimport { extend } from '../../shared/utils.js';\nexport default {\n name: 'gauge',\n static: {\n Gauge\n },\n create() {\n const app = this;\n app.gauge = ConstructorMethods({\n defaultSelector: '.gauge',\n constructor: Gauge,\n app,\n domProp: 'f7Gauge'\n });\n app.gauge.update = function update(el, newParams) {\n const $el = $(el);\n if ($el.length === 0) return undefined;\n const gauge = app.gauge.get(el);\n if (!gauge) return undefined;\n gauge.update(newParams);\n return gauge;\n };\n },\n params: {\n gauge: {\n el: null,\n type: 'circle',\n value: 0,\n size: 200,\n bgColor: 'transparent',\n borderBgColor: '#eeeeee',\n borderColor: '#000000',\n borderWidth: 10,\n valueText: null,\n valueTextColor: '#000000',\n valueFontSize: 31,\n valueFontWeight: 500,\n labelText: null,\n labelTextColor: '#888888',\n labelFontSize: 14,\n labelFontWeight: 400\n }\n },\n on: {\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.gauge-init').each(el => {\n app.gauge.create(extend({\n el\n }, $(el).dataset() || {}));\n });\n },\n tabBeforeRemove(tabEl) {\n $(tabEl).find('.gauge-init').each(el => {\n if (el.f7Gauge) el.f7Gauge.destroy();\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.gauge-init').each(el => {\n app.gauge.create(extend({\n el\n }, $(el).dataset() || {}));\n });\n },\n pageBeforeRemove(page) {\n page.$el.find('.gauge-init').each(el => {\n if (el.f7Gauge) el.f7Gauge.destroy();\n });\n }\n },\n vnode: {\n 'gauge-init': {\n insert(vnode) {\n const app = this;\n const el = vnode.elm;\n app.gauge.create(extend({\n el\n }, $(el).dataset() || {}));\n },\n destroy(vnode) {\n const el = vnode.elm;\n if (el.f7Gauge) el.f7Gauge.destroy();\n }\n }\n }\n};", "export default {\n name: 'skeleton'\n};", "/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render(self) {\n const {\n sliderLabel,\n sliderValue,\n sliderValueEditable,\n alphaLabelText\n } = self.params;\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-alpha-slider\"\n }, $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, alphaLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-alpha\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"0.01\",\n min: \"0\",\n max: \"1\",\n class: \"color-picker-value-alpha\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-alpha\"\n }))));\n },\n init(self) {\n self.alphaRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-alpha'),\n min: 0,\n max: 1,\n step: 0.01,\n value: 1,\n on: {\n change(range, value) {\n const alpha = Math.floor(value * 100) / 100;\n self.setValue({\n alpha\n });\n }\n }\n });\n function handleInputChange(e) {\n const alpha = self.value.alpha;\n let value = parseFloat(e.target.value);\n if (Number.isNaN(value)) {\n e.target.value = alpha;\n return;\n }\n value = Math.max(0, Math.min(1, value));\n self.setValue({\n alpha: value\n });\n }\n self.$el.on('change', '.color-picker-module-alpha-slider input', handleInputChange);\n self.destroyAlphaSliderEvents = function destroyAlphaSliderEvents() {\n self.$el.off('change', '.color-picker-module-alpha-slider input', handleInputChange);\n };\n },\n update(self) {\n const {\n value\n } = self;\n const {\n sliderValue,\n sliderValueEditable\n } = self.params;\n const {\n alpha\n } = value;\n self.alphaRangeSlider.value = alpha;\n self.alphaRangeSlider.layout();\n if (sliderValue && sliderValueEditable) {\n self.$el.find('input.color-picker-value-alpha').val(alpha);\n } else {\n self.$el.find('span.color-picker-value-alpha').text(alpha);\n }\n },\n destroy(self) {\n if (self.alphaRangeSlider && self.alphaRangeSlider.destroy) {\n self.alphaRangeSlider.destroy();\n }\n delete self.alphaRangeSlider;\n if (self.destroyAlphaSliderEvents) self.destroyAlphaSliderEvents();\n delete self.destroyAlphaSliderEvents;\n }\n};", "/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render() {\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-current-color\"\n }, $jsx(\"div\", {\n class: \"color-picker-current-color\"\n }));\n },\n update(self) {\n self.$el.find('.color-picker-module-current-color .color-picker-current-color').css('background-color', self.value.hex);\n }\n};", "/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render(self) {\n const {\n hexLabel,\n hexLabelText,\n hexValueEditable\n } = self.params;\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-hex\"\n }, $jsx(\"div\", {\n class: \"color-picker-hex-wrap\"\n }, hexLabel && $jsx(\"div\", {\n class: \"color-picker-hex-label\"\n }, hexLabelText), $jsx(\"div\", {\n class: \"color-picker-hex-value\"\n }, hexValueEditable ? $jsx(\"input\", {\n type: \"text\",\n class: \"color-picker-value-hex\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-hex\"\n }))));\n },\n init(self) {\n function handleInputChange(e) {\n const hex = self.value.hex;\n let value = e.target.value.replace(/#/g, '');\n if (Number.isNaN(value) || !value || value.length !== 3 && value.length !== 6) {\n e.target.value = hex;\n return;\n }\n const min = 0;\n const current = parseInt(value, 16);\n const max = parseInt('ffffff', 16); // eslint-disable-line\n if (current > max) {\n value = 'fff';\n }\n if (current < min) {\n value = '000';\n }\n self.setValue({\n hex: value\n });\n }\n self.$el.on('change', '.color-picker-module-hex input', handleInputChange);\n self.destroyHexEvents = function destroyHexEvents() {\n self.$el.off('change', '.color-picker-module-hex input', handleInputChange);\n };\n },\n update(self) {\n const {\n value\n } = self;\n const {\n hexValueEditable\n } = self.params;\n const {\n hex\n } = value;\n if (hexValueEditable) {\n self.$el.find('input.color-picker-value-hex').val(hex);\n } else {\n self.$el.find('span.color-picker-value-hex').text(hex);\n }\n },\n destroy(self) {\n if (self.destroyHexEvents) self.destroyHexEvents();\n delete self.destroyHexEvents;\n }\n};", "import $ from '../../../shared/dom7.js';\nimport { colorHsbToHsl } from '../../../shared/utils.js';\n/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render(self) {\n const {\n sliderLabel,\n sliderValue,\n sliderValueEditable,\n hueLabelText,\n saturationLabelText,\n brightnessLabelText\n } = self.params;\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-hsb-sliders\"\n }, $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, hueLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-hue\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"0.1\",\n min: \"0\",\n max: \"360\",\n class: \"color-picker-value-hue\",\n \"data-color-index\": \"0\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-hue\"\n }))), $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, saturationLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-saturation\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"0.1\",\n min: \"0\",\n max: \"100\",\n class: \"color-picker-value-saturation\",\n \"data-color-index\": \"1\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-saturation\"\n }))), $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, brightnessLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-brightness\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"0.1\",\n min: \"0\",\n max: \"100\",\n class: \"color-picker-value-brightness\",\n \"data-color-index\": \"2\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-brightness\"\n }))));\n },\n init(self) {\n self.hueRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-hue'),\n min: 0,\n max: 360,\n step: 0.1,\n value: 0,\n on: {\n change(range, value) {\n self.setValue({\n hue: value\n });\n }\n }\n });\n self.saturationRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-saturation'),\n min: 0,\n max: 1,\n step: 0.001,\n value: 0,\n on: {\n change(range, value) {\n const s = Math.floor(value * 1000) / 1000;\n self.setValue({\n hsb: [self.value.hsb[0], s, self.value.hsb[2]]\n });\n }\n }\n });\n self.brightnessRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-brightness'),\n min: 0,\n max: 1,\n step: 0.001,\n value: 0,\n on: {\n change(range, value) {\n const b = Math.floor(value * 1000) / 1000;\n self.setValue({\n hsb: [self.value.hsb[0], self.value.hsb[1], b]\n });\n }\n }\n });\n function handleInputChange(e) {\n const hsb = [...self.value.hsb];\n const index = parseInt($(e.target).attr('data-color-index'), 10);\n let value = parseFloat(e.target.value);\n if (Number.isNaN(value)) {\n e.target.value = hsb[index];\n return;\n }\n if (index === 0) {\n value = Math.max(0, Math.min(360, value));\n } else {\n value = Math.max(0, Math.min(100, value)) / 100;\n }\n hsb[index] = value;\n self.setValue({\n hsb\n });\n }\n self.$el.on('change', '.color-picker-module-hsb-sliders input', handleInputChange);\n self.destroyHsbSlidersEvents = function destroyHsbSlidersEvents() {\n self.$el.off('change', '.color-picker-module-hsb-sliders input', handleInputChange);\n };\n },\n update(self) {\n const {\n app,\n value\n } = self;\n const {\n sliderValue,\n sliderValueEditable\n } = self.params;\n const {\n hsb,\n hue\n } = value;\n self.hueRangeSlider.value = hue;\n self.saturationRangeSlider.value = hsb[1];\n self.brightnessRangeSlider.value = hsb[2];\n self.hueRangeSlider.layout();\n self.saturationRangeSlider.layout();\n self.brightnessRangeSlider.layout();\n const hslCurrent = colorHsbToHsl(hsb[0], hsb[1], 1);\n const hslLeft = colorHsbToHsl(hsb[0], 0, 1);\n const hslRight = colorHsbToHsl(hsb[0], 1, 1);\n const brightness = hsb[2];\n self.hueRangeSlider.$el[0].style.setProperty('--f7-range-knob-color', `hsl(${hue}, 100%, 50%)`);\n self.saturationRangeSlider.$el[0].style.setProperty('--f7-range-knob-color', `hsl(${hslCurrent[0]}, ${hslCurrent[1] * 100}%, ${hslCurrent[2] * 100}%)`);\n self.brightnessRangeSlider.$el[0].style.setProperty('--f7-range-knob-color', `rgb(${brightness * 255}, ${brightness * 255}, ${brightness * 255})`);\n self.saturationRangeSlider.$el.find('.range-bar').css('background-image', `linear-gradient(${app.rtl ? 'to left' : 'to right'}, hsl(${hslLeft[0]}, ${hslLeft[1] * 100}%, ${hslLeft[2] * 100}%), hsl(${hslRight[0]}, ${hslRight[1] * 100}%, ${hslRight[2] * 100}%))`);\n if (sliderValue && sliderValueEditable) {\n self.$el.find('input.color-picker-value-hue').val(`${hue}`);\n self.$el.find('input.color-picker-value-saturation').val(`${hsb[1] * 1000 / 10}`);\n self.$el.find('input.color-picker-value-brightness').val(`${hsb[2] * 1000 / 10}`);\n } else if (sliderValue) {\n self.$el.find('span.color-picker-value-hue').text(`${hue}`);\n self.$el.find('span.color-picker-value-saturation').text(`${hsb[1] * 1000 / 10}`);\n self.$el.find('span.color-picker-value-brightness').text(`${hsb[2] * 1000 / 10}`);\n }\n },\n destroy(self) {\n if (self.hueRangeSlider && self.hueRangeSlider.destroy) {\n self.hueRangeSlider.destroy();\n }\n if (self.saturationRangeSlider && self.saturationRangeSlider.destroy) {\n self.saturationRangeSlider.destroy();\n }\n if (self.brightnessRangeSlider && self.brightnessRangeSlider.destroy) {\n self.brightnessRangeSlider.destroy();\n }\n delete self.hueRangeSlider;\n delete self.saturationRangeSlider;\n delete self.brightnessRangeSlider;\n if (self.destroyHsbSlidersEvents) self.destroyHsbSlidersEvents();\n delete self.destroyHsbSlidersEvents;\n }\n};", "/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render(self) {\n const {\n sliderLabel,\n sliderValue,\n sliderValueEditable,\n hueLabelText\n } = self.params;\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-hue-slider\"\n }, $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, hueLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-hue\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"0.1\",\n min: \"0\",\n max: \"360\",\n class: \"color-picker-value-hue\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-hue\"\n }))));\n },\n init(self) {\n self.hueRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-hue'),\n min: 0,\n max: 360,\n step: 0.1,\n value: 0,\n on: {\n change(range, value) {\n self.setValue({\n hue: value\n });\n }\n }\n });\n },\n update(self) {\n const {\n value\n } = self;\n const {\n sliderValue,\n sliderValueEditable\n } = self.params;\n const {\n hue\n } = value;\n self.hueRangeSlider.value = hue;\n self.hueRangeSlider.layout();\n self.hueRangeSlider.$el[0].style.setProperty('--f7-range-knob-color', `hsl(${hue}, 100%, 50%)`);\n if (sliderValue && sliderValueEditable) {\n self.$el.find('input.color-picker-value-hue').val(`${hue}`);\n } else if (sliderValue) {\n self.$el.find('span.color-picker-value-hue').text(`${hue}`);\n }\n },\n destroy(self) {\n if (self.hueRangeSlider && self.hueRangeSlider.destroy) {\n self.hueRangeSlider.destroy();\n }\n delete self.hueRangeSlider;\n }\n};", "import { colorHsbToHsl } from '../../../shared/utils.js';\n/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render(self) {\n const {\n sliderLabel,\n sliderValue,\n sliderValueEditable,\n brightnessLabelText\n } = self.params;\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-brightness-slider\"\n }, $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, brightnessLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-brightness\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"0.1\",\n min: \"0\",\n max: \"100\",\n class: \"color-picker-value-brightness\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-brightness\"\n }))));\n },\n init(self) {\n self.brightnessRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-brightness'),\n min: 0,\n max: 1,\n step: 0.001,\n value: 0,\n on: {\n change(range, value) {\n const b = Math.floor(value * 1000) / 1000;\n self.setValue({\n hsb: [self.value.hsb[0], self.value.hsb[1], b]\n });\n }\n }\n });\n },\n update(self) {\n const {\n value,\n app\n } = self;\n const {\n sliderValue,\n sliderValueEditable\n } = self.params;\n const {\n hsb\n } = value;\n self.brightnessRangeSlider.value = hsb[2];\n self.brightnessRangeSlider.layout();\n const hslCurrent = colorHsbToHsl(hsb[0], hsb[1], hsb[2]);\n const hslLeft = colorHsbToHsl(hsb[0], hsb[1], 0);\n const hslRight = colorHsbToHsl(hsb[0], hsb[1], 1);\n self.brightnessRangeSlider.$el[0].style.setProperty('--f7-range-knob-color', `hsl(${hslCurrent[0]}, ${hslCurrent[1] * 100}%, ${hslCurrent[2] * 100}%)`);\n self.brightnessRangeSlider.$el.find('.range-bar').css('background-image', `linear-gradient(${app.rtl ? 'to left' : 'to right'}, hsl(${hslLeft[0]}, ${hslLeft[1] * 100}%, ${hslLeft[2] * 100}%), hsl(${hslRight[0]}, ${hslRight[1] * 100}%, ${hslRight[2] * 100}%))`);\n if (sliderValue && sliderValueEditable) {\n self.$el.find('input.color-picker-value-brightness').val(`${hsb[2] * 1000 / 10}`);\n } else if (sliderValue) {\n self.$el.find('span.color-picker-value-brightness').text(`${hsb[2] * 1000 / 10}`);\n }\n },\n destroy(self) {\n if (self.brightnessRangeSlider && self.brightnessRangeSlider.destroy) {\n self.brightnessRangeSlider.destroy();\n }\n delete self.brightnessRangeSlider;\n }\n};", "/* eslint indent: [\"off\"] */\nimport $ from '../../../shared/dom7.js';\n/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render(self) {\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-palette\"\n }, $jsx(\"div\", {\n class: \"color-picker-palette\"\n }, self.params.palette.map(p => {\n if (Array.isArray(p)) {\n let row = '';\n // prettier-ignore\n row += p.map(c => `\n
\n `).join('');\n row += '
';\n return row;\n }\n return $jsx(\"div\", {\n class: \"color-picker-palette-value\",\n \"data-palette-color\": p,\n style: `background-color: ${p}`\n });\n })));\n },\n init(self) {\n function handlePaletteClick(e) {\n const hex = $(e.target).attr('data-palette-color');\n self.setValue({\n hex\n });\n }\n self.$el.on('click', '.color-picker-module-palette .color-picker-palette-value', handlePaletteClick);\n self.destroyPaletteEvents = function destroyPaletteEvents() {\n self.$el.off('click', '.color-picker-module-hex input', handlePaletteClick);\n };\n },\n destroy(self) {\n if (self.destroyPaletteEvents) {\n self.destroyPaletteEvents();\n }\n delete self.destroyPaletteEvents;\n }\n};", "/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render() {\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-initial-current-colors\"\n }, $jsx(\"div\", {\n class: \"color-picker-initial-current-colors\"\n }, $jsx(\"div\", {\n class: \"color-picker-initial-color\"\n }), $jsx(\"div\", {\n class: \"color-picker-current-color\"\n })));\n },\n init(self) {\n function handleInitialColorClick() {\n if (self.initialValue) {\n const {\n hex,\n alpha\n } = self.initialValue;\n self.setValue({\n hex,\n alpha\n });\n }\n }\n self.$el.on('click', '.color-picker-initial-color', handleInitialColorClick);\n self.destroyInitialCurrentEvents = function destroyInitialCurrentEvents() {\n self.$el.off('click', '.color-picker-initial-color', handleInitialColorClick);\n };\n },\n update(self) {\n self.$el.find('.color-picker-module-initial-current-colors .color-picker-initial-color').css('background-color', self.initialValue.hex);\n self.$el.find('.color-picker-module-initial-current-colors .color-picker-current-color').css('background-color', self.value.hex);\n },\n destroy(self) {\n if (self.destroyInitialCurrentEvents) {\n self.destroyInitialCurrentEvents();\n }\n delete self.destroyInitialCurrentEvents;\n }\n};", "import $ from '../../../shared/dom7.js';\n/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render(self) {\n const {\n barLabel,\n barValue,\n barValueEditable,\n redLabelText,\n greenLabelText,\n blueLabelText\n } = self.params;\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-rgb-bars\"\n }, $jsx(\"div\", {\n class: \"color-picker-bar-wrap\"\n }, barLabel && $jsx(\"div\", {\n class: \"color-picker-bar-label\"\n }, redLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-bar color-picker-bar-red\"\n }), barValue && $jsx(\"div\", {\n class: \"color-picker-bar-value\"\n }, barValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"1\",\n min: \"0\",\n max: \"255\",\n class: \"color-picker-value-bar-red\",\n \"data-color-index\": \"0\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-bar-red\"\n }))), $jsx(\"div\", {\n class: \"color-picker-bar-wrap\"\n }, barLabel && $jsx(\"div\", {\n class: \"color-picker-bar-label\"\n }, greenLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-bar color-picker-bar-green\"\n }), barValue && $jsx(\"div\", {\n class: \"color-picker-bar-value\"\n }, barValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"1\",\n min: \"0\",\n max: \"255\",\n class: \"color-picker-value-bar-green\",\n \"data-color-index\": \"1\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-bar-green\"\n }))), $jsx(\"div\", {\n class: \"color-picker-bar-wrap\"\n }, barLabel && $jsx(\"div\", {\n class: \"color-picker-bar-label\"\n }, blueLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-bar color-picker-bar-blue\"\n }), barValue && $jsx(\"div\", {\n class: \"color-picker-bar-value\"\n }, barValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"1\",\n min: \"0\",\n max: \"255\",\n class: \"color-picker-value-bar-blue\",\n \"data-color-index\": \"2\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-bar-blue\"\n }))));\n },\n init(self) {\n self.redBar = self.app.range.create({\n el: self.$el.find('.color-picker-bar-red'),\n min: 0,\n max: 255,\n step: 1,\n value: 0,\n vertical: true,\n on: {\n change(range, value) {\n self.setValue({\n rgb: [value, self.value.rgb[1], self.value.rgb[2]]\n });\n }\n }\n });\n self.greenBar = self.app.range.create({\n el: self.$el.find('.color-picker-bar-green'),\n min: 0,\n max: 255,\n step: 1,\n value: 0,\n vertical: true,\n on: {\n change(range, value) {\n self.setValue({\n rgb: [self.value.rgb[0], value, self.value.rgb[2]]\n });\n }\n }\n });\n self.blueBar = self.app.range.create({\n el: self.$el.find('.color-picker-bar-blue'),\n min: 0,\n max: 255,\n step: 1,\n value: 0,\n vertical: true,\n on: {\n change(range, value) {\n self.setValue({\n rgb: [self.value.rgb[0], self.value.rgb[1], value]\n });\n }\n }\n });\n function handleInputChange(e) {\n const rgb = [...self.value.rgb];\n const index = parseInt($(e.target).attr('data-color-index'), 10);\n let value = parseInt(e.target.value, 10);\n if (Number.isNaN(value)) {\n e.target.value = rgb[index];\n return;\n }\n value = Math.max(0, Math.min(255, value));\n rgb[index] = value;\n self.setValue({\n rgb\n });\n }\n self.$el.on('change', '.color-picker-module-rgb-bars input', handleInputChange);\n self.destroyRgbBarsEvents = function destroyRgbBarsEvents() {\n self.$el.off('change', '.color-picker-module-rgb-bars input', handleInputChange);\n };\n },\n update(self) {\n const {\n value,\n redBar,\n greenBar,\n blueBar\n } = self;\n const {\n barValue,\n barValueEditable\n } = self.params;\n const {\n rgb\n } = value;\n redBar.value = rgb[0];\n greenBar.value = rgb[1];\n blueBar.value = rgb[2];\n redBar.layout();\n greenBar.layout();\n blueBar.layout();\n redBar.$el.find('.range-bar').css('background-image', `linear-gradient(to top, rgb(0, ${rgb[1]}, ${rgb[2]}), rgb(255, ${rgb[1]}, ${rgb[2]}))`);\n greenBar.$el.find('.range-bar').css('background-image', `linear-gradient(to top, rgb(${rgb[0]}, 0, ${rgb[2]}), rgb(${rgb[0]}, 255, ${rgb[2]}))`);\n blueBar.$el.find('.range-bar').css('background-image', `linear-gradient(to top, rgb(${rgb[0]}, ${rgb[1]}, 0), rgb(${rgb[0]}, ${rgb[1]}, 255))`);\n if (barValue && barValueEditable) {\n self.$el.find('input.color-picker-value-bar-red').val(rgb[0]);\n self.$el.find('input.color-picker-value-bar-green').val(rgb[1]);\n self.$el.find('input.color-picker-value-bar-blue').val(rgb[2]);\n } else if (barValue) {\n self.$el.find('span.color-picker-value-bar-red').text(rgb[0]);\n self.$el.find('span.color-picker-value-bar-green').text(rgb[1]);\n self.$el.find('span.color-picker-value-bar-blue').text(rgb[2]);\n }\n },\n destroy(self) {\n if (self.redBar && self.redBar.destroy) {\n self.redBar.destroy();\n }\n if (self.greenBar && self.greenBar.destroy) {\n self.greenBar.destroy();\n }\n if (self.blueBar && self.blueBar.destroy) {\n self.blueBar.destroy();\n }\n delete self.redBar;\n delete self.greenBar;\n delete self.blueBar;\n if (self.destroyRgbBarsEvents) self.destroyRgbBarsEvents();\n delete self.destroyRgbBarsEvents;\n }\n};", "import $ from '../../../shared/dom7.js';\n/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render(self) {\n const {\n sliderLabel,\n sliderValue,\n sliderValueEditable,\n redLabelText,\n greenLabelText,\n blueLabelText\n } = self.params;\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-rgb-sliders\"\n }, $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, redLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-red\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"1\",\n min: \"0\",\n max: \"255\",\n class: \"color-picker-value-red\",\n \"data-color-index\": \"0\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-red\"\n }))), $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, greenLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-green\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"1\",\n min: \"0\",\n max: \"255\",\n class: \"color-picker-value-green\",\n \"data-color-index\": \"1\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-green\"\n }))), $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, blueLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-blue\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"1\",\n min: \"0\",\n max: \"255\",\n class: \"color-picker-value-blue\",\n \"data-color-index\": \"2\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-blue\"\n }))));\n },\n init(self) {\n self.redRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-red'),\n min: 0,\n max: 255,\n step: 1,\n value: 0,\n on: {\n change(range, value) {\n self.setValue({\n rgb: [value, self.value.rgb[1], self.value.rgb[2]]\n });\n }\n }\n });\n self.greenRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-green'),\n min: 0,\n max: 255,\n step: 1,\n value: 0,\n on: {\n change(range, value) {\n self.setValue({\n rgb: [self.value.rgb[0], value, self.value.rgb[2]]\n });\n }\n }\n });\n self.blueRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-blue'),\n min: 0,\n max: 255,\n step: 1,\n value: 0,\n on: {\n change(range, value) {\n self.setValue({\n rgb: [self.value.rgb[0], self.value.rgb[1], value]\n });\n }\n }\n });\n function handleInputChange(e) {\n const rgb = [...self.value.rgb];\n const index = parseInt($(e.target).attr('data-color-index'), 10);\n let value = parseInt(e.target.value, 10);\n if (Number.isNaN(value)) {\n e.target.value = rgb[index];\n return;\n }\n value = Math.max(0, Math.min(255, value));\n rgb[index] = value;\n self.setValue({\n rgb\n });\n }\n self.$el.on('change', '.color-picker-module-rgb-sliders input', handleInputChange);\n self.destroyRgbSlidersEvents = function destroyRgbSlidersEvents() {\n self.$el.off('change', '.color-picker-module-rgb-sliders input', handleInputChange);\n };\n },\n update(self) {\n const {\n app,\n value,\n redRangeSlider,\n greenRangeSlider,\n blueRangeSlider\n } = self;\n const {\n sliderValue,\n sliderValueEditable\n } = self.params;\n const {\n rgb\n } = value;\n redRangeSlider.value = rgb[0];\n greenRangeSlider.value = rgb[1];\n blueRangeSlider.value = rgb[2];\n redRangeSlider.layout();\n greenRangeSlider.layout();\n blueRangeSlider.layout();\n redRangeSlider.$el[0].style.setProperty('--f7-range-knob-color', `rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`);\n greenRangeSlider.$el[0].style.setProperty('--f7-range-knob-color', `rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`);\n blueRangeSlider.$el[0].style.setProperty('--f7-range-knob-color', `rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`);\n const direction = app.rtl ? 'to left' : 'to right';\n redRangeSlider.$el.find('.range-bar').css('background-image', `linear-gradient(${direction}, rgb(0, ${rgb[1]}, ${rgb[2]}), rgb(255, ${rgb[1]}, ${rgb[2]}))`);\n greenRangeSlider.$el.find('.range-bar').css('background-image', `linear-gradient(${direction}, rgb(${rgb[0]}, 0, ${rgb[2]}), rgb(${rgb[0]}, 255, ${rgb[2]}))`);\n blueRangeSlider.$el.find('.range-bar').css('background-image', `linear-gradient(${direction}, rgb(${rgb[0]}, ${rgb[1]}, 0), rgb(${rgb[0]}, ${rgb[1]}, 255))`);\n if (sliderValue && sliderValueEditable) {\n self.$el.find('input.color-picker-value-red').val(rgb[0]);\n self.$el.find('input.color-picker-value-green').val(rgb[1]);\n self.$el.find('input.color-picker-value-blue').val(rgb[2]);\n } else if (sliderValue) {\n self.$el.find('span.color-picker-value-red').text(rgb[0]);\n self.$el.find('span.color-picker-value-green').text(rgb[1]);\n self.$el.find('span.color-picker-value-blue').text(rgb[2]);\n }\n },\n destroy(self) {\n if (self.redRangeSlider && self.redRangeSlider.destroy) {\n self.redRangeSlider.destroy();\n }\n if (self.greenRangeSlider && self.greenRangeSlider.destroy) {\n self.greenRangeSlider.destroy();\n }\n if (self.blueRangeSlider && self.blueRangeSlider.destroy) {\n self.blueRangeSlider.destroy();\n }\n delete self.redRangeSlider;\n delete self.greenRangeSlider;\n delete self.blueRangeSlider;\n if (self.destroyRgbSlidersEvents) self.destroyRgbSlidersEvents();\n delete self.destroyRgbSlidersEvents;\n }\n};", "import $ from '../../../shared/dom7.js';\nimport { getSupport } from '../../../shared/get-support.js';\n/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render() {\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-sb-spectrum\"\n }, $jsx(\"div\", {\n class: \"color-picker-sb-spectrum\",\n style: \"background-color: hsl(0, 100%, 50%)\"\n }, $jsx(\"div\", {\n class: \"color-picker-sb-spectrum-handle\"\n })));\n },\n init(self) {\n const {\n app\n } = self;\n let isTouched;\n let isMoved;\n let touchStartX;\n let touchStartY;\n let touchCurrentX;\n let touchCurrentY;\n let specterRect;\n let specterIsTouched;\n let specterHandleIsTouched;\n const {\n $el\n } = self;\n function setSBFromSpecterCoords(x, y) {\n let s = (x - specterRect.left) / specterRect.width;\n let b = (y - specterRect.top) / specterRect.height;\n s = Math.max(0, Math.min(1, s));\n b = 1 - Math.max(0, Math.min(1, b));\n self.setValue({\n hsb: [self.value.hue, s, b]\n });\n }\n function handleTouchStart(e) {\n if (isMoved || isTouched) return;\n touchStartX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchCurrentX = touchStartX;\n touchStartY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n touchCurrentY = touchStartY;\n const $targetEl = $(e.target);\n specterHandleIsTouched = $targetEl.closest('.color-picker-sb-spectrum-handle').length > 0;\n if (!specterHandleIsTouched) {\n specterIsTouched = $targetEl.closest('.color-picker-sb-spectrum').length > 0;\n }\n if (specterIsTouched) {\n specterRect = $el.find('.color-picker-sb-spectrum')[0].getBoundingClientRect();\n setSBFromSpecterCoords(touchStartX, touchStartY);\n }\n if (specterHandleIsTouched || specterIsTouched) {\n $el.find('.color-picker-sb-spectrum-handle').addClass('color-picker-sb-spectrum-handle-pressed');\n }\n }\n function handleTouchMove(e) {\n if (!(specterIsTouched || specterHandleIsTouched)) return;\n touchCurrentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n touchCurrentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n e.preventDefault();\n if (!isMoved) {\n // First move\n isMoved = true;\n if (specterHandleIsTouched) {\n specterRect = $el.find('.color-picker-sb-spectrum')[0].getBoundingClientRect();\n }\n }\n if (specterIsTouched || specterHandleIsTouched) {\n setSBFromSpecterCoords(touchCurrentX, touchCurrentY);\n }\n }\n function handleTouchEnd() {\n isMoved = false;\n if (specterIsTouched || specterHandleIsTouched) {\n $el.find('.color-picker-sb-spectrum-handle').removeClass('color-picker-sb-spectrum-handle-pressed');\n }\n specterIsTouched = false;\n specterHandleIsTouched = false;\n }\n function handleResize() {\n self.modules['sb-spectrum'].update(self);\n }\n const passiveListener = app.touchEvents.start === 'touchstart' && getSupport().passiveListener ? {\n passive: true,\n capture: false\n } : false;\n self.$el.on(app.touchEvents.start, handleTouchStart, passiveListener);\n app.on('touchmove:active', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n app.on('resize', handleResize);\n self.destroySpectrumEvents = function destroySpectrumEvents() {\n self.$el.off(app.touchEvents.start, handleTouchStart, passiveListener);\n app.off('touchmove:active', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n app.off('resize', handleResize);\n };\n },\n update(self) {\n const {\n value\n } = self;\n const {\n hsl,\n hsb\n } = value;\n const specterWidth = self.$el.find('.color-picker-sb-spectrum')[0].offsetWidth;\n const specterHeight = self.$el.find('.color-picker-sb-spectrum')[0].offsetHeight;\n self.$el.find('.color-picker-sb-spectrum').css('background-color', `hsl(${hsl[0]}, 100%, 50%)`);\n self.$el.find('.color-picker-sb-spectrum-handle').css('background-color', `hsl(${hsl[0]}, ${hsl[1] * 100}%, ${hsl[2] * 100}%)`).transform(`translate(${specterWidth * hsb[1]}px, ${specterHeight * (1 - hsb[2])}px)`);\n },\n destroy(self) {\n if (self.destroySpectrumEvents) self.destroySpectrumEvents();\n delete self.destroySpectrumEvents;\n }\n};", "import $ from '../../../shared/dom7.js';\nimport { colorHsbToHsl } from '../../../shared/utils.js';\nimport { getSupport } from '../../../shared/get-support.js';\n/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render() {\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-hs-spectrum\"\n }, $jsx(\"div\", {\n class: \"color-picker-hs-spectrum\"\n }, $jsx(\"div\", {\n class: \"color-picker-hs-spectrum-handle\"\n })));\n },\n init(self) {\n const {\n app\n } = self;\n let isTouched;\n let isMoved;\n let touchStartX;\n let touchStartY;\n let touchCurrentX;\n let touchCurrentY;\n let specterRect;\n let specterIsTouched;\n let specterHandleIsTouched;\n const {\n $el\n } = self;\n function setHSFromSpecterCoords(x, y) {\n let h = (x - specterRect.left) / specterRect.width * 360;\n let s = (y - specterRect.top) / specterRect.height;\n h = Math.max(0, Math.min(360, h));\n s = 1 - Math.max(0, Math.min(1, s));\n self.setValue({\n hsb: [h, s, self.value.hsb[2]]\n });\n }\n function handleTouchStart(e) {\n if (isMoved || isTouched) return;\n touchStartX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchCurrentX = touchStartX;\n touchStartY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n touchCurrentY = touchStartY;\n const $targetEl = $(e.target);\n specterHandleIsTouched = $targetEl.closest('.color-picker-hs-spectrum-handle').length > 0;\n if (!specterHandleIsTouched) {\n specterIsTouched = $targetEl.closest('.color-picker-hs-spectrum').length > 0;\n }\n if (specterIsTouched) {\n specterRect = $el.find('.color-picker-hs-spectrum')[0].getBoundingClientRect();\n setHSFromSpecterCoords(touchStartX, touchStartY);\n }\n if (specterHandleIsTouched || specterIsTouched) {\n $el.find('.color-picker-hs-spectrum-handle').addClass('color-picker-hs-spectrum-handle-pressed');\n }\n }\n function handleTouchMove(e) {\n if (!(specterIsTouched || specterHandleIsTouched)) return;\n touchCurrentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n touchCurrentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n e.preventDefault();\n if (!isMoved) {\n // First move\n isMoved = true;\n if (specterHandleIsTouched) {\n specterRect = $el.find('.color-picker-hs-spectrum')[0].getBoundingClientRect();\n }\n }\n if (specterIsTouched || specterHandleIsTouched) {\n setHSFromSpecterCoords(touchCurrentX, touchCurrentY);\n }\n }\n function handleTouchEnd() {\n isMoved = false;\n if (specterIsTouched || specterHandleIsTouched) {\n $el.find('.color-picker-hs-spectrum-handle').removeClass('color-picker-hs-spectrum-handle-pressed');\n }\n specterIsTouched = false;\n specterHandleIsTouched = false;\n }\n function handleResize() {\n self.modules['hs-spectrum'].update(self);\n }\n const passiveListener = app.touchEvents.start === 'touchstart' && getSupport().passiveListener ? {\n passive: true,\n capture: false\n } : false;\n self.$el.on(app.touchEvents.start, handleTouchStart, passiveListener);\n app.on('touchmove:active', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n app.on('resize', handleResize);\n self.destroySpectrumEvents = function destroySpectrumEvents() {\n self.$el.off(app.touchEvents.start, handleTouchStart, passiveListener);\n app.off('touchmove:active', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n app.off('resize', handleResize);\n };\n },\n update(self) {\n const {\n value\n } = self;\n const {\n hsb\n } = value;\n const specterWidth = self.$el.find('.color-picker-hs-spectrum')[0].offsetWidth;\n const specterHeight = self.$el.find('.color-picker-hs-spectrum')[0].offsetHeight;\n const hslBright = colorHsbToHsl(hsb[0], hsb[1], 1);\n self.$el.find('.color-picker-hs-spectrum-handle').css('background-color', `hsl(${hslBright[0]}, ${hslBright[1] * 100}%, ${hslBright[2] * 100}%)`).transform(`translate(${specterWidth * (hsb[0] / 360)}px, ${specterHeight * (1 - hsb[1])}px)`);\n },\n destroy(self) {\n if (self.destroySpectrumEvents) self.destroySpectrumEvents();\n delete self.destroySpectrumEvents;\n }\n};", "import $ from '../../../shared/dom7.js';\nimport { getSupport } from '../../../shared/get-support.js';\n/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nfunction svgWheelCircles() {\n const total = 256;\n let circles = '';\n for (let i = total; i > 0; i -= 1) {\n const angle = i * Math.PI / (total / 2);\n const hue = 360 / total * i;\n circles += ``;\n }\n return circles;\n}\nexport default {\n render() {\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-wheel\"\n }, $jsx(\"div\", {\n class: \"color-picker-wheel\"\n }, $jsx(\"svg\", {\n viewBox: \"0 0 300 300\",\n width: \"300\",\n height: \"300\"\n }, svgWheelCircles()), $jsx(\"div\", {\n class: \"color-picker-wheel-handle\"\n }), $jsx(\"div\", {\n class: \"color-picker-sb-spectrum\",\n style: \"background-color: hsl(0, 100%, 50%)\"\n }, $jsx(\"div\", {\n class: \"color-picker-sb-spectrum-handle\"\n }))));\n },\n init(self) {\n const {\n app\n } = self;\n let isTouched;\n let isMoved;\n let touchStartX;\n let touchStartY;\n let touchCurrentX;\n let touchCurrentY;\n let wheelRect;\n let wheelIsTouched;\n let wheelHandleIsTouched;\n let specterRect;\n let specterIsTouched;\n let specterHandleIsTouched;\n const {\n $el\n } = self;\n function setHueFromWheelCoords(x, y) {\n const wheelCenterX = wheelRect.left + wheelRect.width / 2;\n const wheelCenterY = wheelRect.top + wheelRect.height / 2;\n const angleRad = Math.atan2(y - wheelCenterY, x - wheelCenterX);\n let angleDeg = angleRad * 180 / Math.PI + 90;\n if (angleDeg < 0) angleDeg += 360;\n angleDeg = 360 - angleDeg;\n self.setValue({\n hue: angleDeg\n });\n }\n function setSBFromSpecterCoords(x, y) {\n let s = (x - specterRect.left) / specterRect.width;\n let b = (y - specterRect.top) / specterRect.height;\n s = Math.max(0, Math.min(1, s));\n b = 1 - Math.max(0, Math.min(1, b));\n self.setValue({\n hsb: [self.value.hue, s, b]\n });\n }\n function handleTouchStart(e) {\n if (isMoved || isTouched) return;\n touchStartX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchCurrentX = touchStartX;\n touchStartY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n touchCurrentY = touchStartY;\n const $targetEl = $(e.target);\n wheelHandleIsTouched = $targetEl.closest('.color-picker-wheel-handle').length > 0;\n wheelIsTouched = $targetEl.closest('circle').length > 0;\n specterHandleIsTouched = $targetEl.closest('.color-picker-sb-spectrum-handle').length > 0;\n if (!specterHandleIsTouched) {\n specterIsTouched = $targetEl.closest('.color-picker-sb-spectrum').length > 0;\n }\n if (wheelIsTouched) {\n wheelRect = $el.find('.color-picker-wheel')[0].getBoundingClientRect();\n setHueFromWheelCoords(touchStartX, touchStartY);\n }\n if (specterIsTouched) {\n specterRect = $el.find('.color-picker-sb-spectrum')[0].getBoundingClientRect();\n setSBFromSpecterCoords(touchStartX, touchStartY);\n }\n if (specterHandleIsTouched || specterIsTouched) {\n $el.find('.color-picker-sb-spectrum-handle').addClass('color-picker-sb-spectrum-handle-pressed');\n }\n }\n function handleTouchMove(e) {\n if (!(wheelIsTouched || wheelHandleIsTouched) && !(specterIsTouched || specterHandleIsTouched)) return;\n touchCurrentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n touchCurrentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n e.preventDefault();\n if (!isMoved) {\n // First move\n isMoved = true;\n if (wheelHandleIsTouched) {\n wheelRect = $el.find('.color-picker-wheel')[0].getBoundingClientRect();\n }\n if (specterHandleIsTouched) {\n specterRect = $el.find('.color-picker-sb-spectrum')[0].getBoundingClientRect();\n }\n }\n if (wheelIsTouched || wheelHandleIsTouched) {\n setHueFromWheelCoords(touchCurrentX, touchCurrentY);\n }\n if (specterIsTouched || specterHandleIsTouched) {\n setSBFromSpecterCoords(touchCurrentX, touchCurrentY);\n }\n }\n function handleTouchEnd() {\n isMoved = false;\n if (specterIsTouched || specterHandleIsTouched) {\n $el.find('.color-picker-sb-spectrum-handle').removeClass('color-picker-sb-spectrum-handle-pressed');\n }\n wheelIsTouched = false;\n wheelHandleIsTouched = false;\n specterIsTouched = false;\n specterHandleIsTouched = false;\n }\n function handleResize() {\n self.modules.wheel.update(self);\n }\n const passiveListener = app.touchEvents.start === 'touchstart' && getSupport().passiveListener ? {\n passive: true,\n capture: false\n } : false;\n self.$el.on(app.touchEvents.start, handleTouchStart, passiveListener);\n app.on('touchmove:active', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n app.on('resize', handleResize);\n self.destroyWheelEvents = function destroyWheelEvents() {\n self.$el.off(app.touchEvents.start, handleTouchStart, passiveListener);\n app.off('touchmove:active', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n app.off('resize', handleResize);\n };\n },\n update(self) {\n const {\n value\n } = self;\n const {\n hsl,\n hsb\n } = value;\n const specterWidth = self.$el.find('.color-picker-sb-spectrum')[0].offsetWidth;\n const specterHeight = self.$el.find('.color-picker-sb-spectrum')[0].offsetHeight;\n const wheelSize = self.$el.find('.color-picker-wheel')[0].offsetWidth;\n const wheelHalfSize = wheelSize / 2;\n const angleRad = value.hue * Math.PI / 180;\n const handleSize = wheelSize / 6;\n const handleHalfSize = handleSize / 2;\n const tX = wheelHalfSize - Math.sin(angleRad) * (wheelHalfSize - handleHalfSize) - handleHalfSize;\n const tY = wheelHalfSize - Math.cos(angleRad) * (wheelHalfSize - handleHalfSize) - handleHalfSize;\n self.$el.find('.color-picker-wheel-handle').css('background-color', `hsl(${hsl[0]}, 100%, 50%)`).transform(`translate(${tX}px, ${tY}px)`);\n self.$el.find('.color-picker-sb-spectrum').css('background-color', `hsl(${hsl[0]}, 100%, 50%)`);\n self.$el.find('.color-picker-sb-spectrum-handle').css('background-color', `hsl(${hsl[0]}, ${hsl[1] * 100}%, ${hsl[2] * 100}%)`).transform(`translate(${specterWidth * hsb[1]}px, ${specterHeight * (1 - hsb[2])}px)`);\n },\n destroy(self) {\n if (self.destroyWheelEvents) self.destroyWheelEvents();\n delete self.destroyWheelEvents;\n }\n};", "import { extend, colorRgbToHex, colorRgbToHsl, colorHslToHsb, colorHslToRgb, colorHsbToHsl, colorHexToRgb, nextTick, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\nimport $ from '../../shared/dom7.js';\nimport { getDevice } from '../../shared/get-device.js';\nimport moduleAlphaSlider from './modules/alpha-slider.js';\nimport moduleCurrentColor from './modules/current-color.js';\nimport moduleHex from './modules/hex.js';\nimport moduleHsbSliders from './modules/hsb-sliders.js';\nimport moduleHueSlider from './modules/hue-slider.js';\nimport moduleBrightnessSlider from './modules/brightness-slider.js';\nimport modulePalette from './modules/palette.js';\nimport moduleInitialCurrentColors from './modules/initial-current-colors.js';\nimport moduleRgbBars from './modules/rgb-bars.js';\nimport moduleRgbSliders from './modules/rgb-sliders.js';\nimport moduleSbSpectrum from './modules/sb-spectrum.js';\nimport moduleHsSpectrum from './modules/hs-spectrum.js';\nimport moduleWheel from './modules/wheel.js';\n\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass ColorPicker extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const self = this;\n self.params = extend({}, app.params.colorPicker, params);\n let $containerEl;\n if (self.params.containerEl) {\n $containerEl = $(self.params.containerEl);\n if ($containerEl.length === 0) return self;\n }\n let $inputEl;\n if (self.params.inputEl) {\n $inputEl = $(self.params.inputEl);\n }\n let $targetEl;\n if (self.params.targetEl) {\n $targetEl = $(self.params.targetEl);\n }\n extend(self, {\n app,\n $containerEl,\n containerEl: $containerEl && $containerEl[0],\n inline: $containerEl && $containerEl.length > 0,\n $inputEl,\n inputEl: $inputEl && $inputEl[0],\n $targetEl,\n targetEl: $targetEl && $targetEl[0],\n initialized: false,\n opened: false,\n url: self.params.url,\n modules: {\n 'alpha-slider': moduleAlphaSlider,\n 'current-color': moduleCurrentColor,\n hex: moduleHex,\n // eslint-disable-line\n 'hsb-sliders': moduleHsbSliders,\n 'hue-slider': moduleHueSlider,\n 'brightness-slider': moduleBrightnessSlider,\n palette: modulePalette,\n // eslint-disable-line\n 'initial-current-colors': moduleInitialCurrentColors,\n 'rgb-bars': moduleRgbBars,\n 'rgb-sliders': moduleRgbSliders,\n 'sb-spectrum': moduleSbSpectrum,\n 'hs-spectrum': moduleHsSpectrum,\n wheel: moduleWheel // eslint-disable-line\n }\n });\n\n function onInputClick() {\n self.open();\n }\n function onInputFocus(e) {\n e.preventDefault();\n }\n function onTargetClick() {\n self.open();\n }\n function onHtmlClick(e) {\n if (self.destroyed || !self.params) return;\n if (self.params.openIn === 'page') return;\n const $clickTargetEl = $(e.target);\n if (!self.opened || self.closing) return;\n if ($clickTargetEl.closest('[class*=\"backdrop\"]').length) return;\n if ($clickTargetEl.closest('.color-picker-popup, .color-picker-popover').length) return;\n if ($inputEl && $inputEl.length > 0) {\n if ($clickTargetEl[0] !== $inputEl[0] && $clickTargetEl.closest('.sheet-modal').length === 0) {\n self.close();\n }\n } else if ($(e.target).closest('.sheet-modal').length === 0) {\n self.close();\n }\n }\n\n // Events\n extend(self, {\n attachInputEvents() {\n self.$inputEl.on('click', onInputClick);\n if (self.params.inputReadOnly) {\n self.$inputEl.on('focus mousedown', onInputFocus);\n if (self.$inputEl[0]) {\n self.$inputEl[0].f7ValidateReadonly = true;\n }\n }\n },\n detachInputEvents() {\n self.$inputEl.off('click', onInputClick);\n if (self.params.inputReadOnly) {\n self.$inputEl.off('focus mousedown', onInputFocus);\n if (self.$inputEl[0]) {\n delete self.$inputEl[0].f7ValidateReadonly;\n }\n }\n },\n attachTargetEvents() {\n self.$targetEl.on('click', onTargetClick);\n },\n detachTargetEvents() {\n self.$targetEl.off('click', onTargetClick);\n },\n attachHtmlEvents() {\n app.on('click', onHtmlClick);\n },\n detachHtmlEvents() {\n app.off('click', onHtmlClick);\n }\n });\n self.init();\n return self;\n }\n get view() {\n const {\n $inputEl,\n $targetEl,\n app,\n params\n } = this;\n let view;\n if (params.view) {\n view = params.view;\n } else {\n if ($inputEl) {\n view = $inputEl.parents('.view').length && $inputEl.parents('.view')[0].f7View;\n }\n if (!view && $targetEl) {\n view = $targetEl.parents('.view').length && $targetEl.parents('.view')[0].f7View;\n }\n }\n if (!view) view = app.views.main;\n return view;\n }\n attachEvents() {\n const self = this;\n self.centerModules = self.centerModules.bind(self);\n if (self.params.centerModules) {\n self.app.on('resize', self.centerModules);\n }\n }\n detachEvents() {\n const self = this;\n if (self.params.centerModules) {\n self.app.off('resize', self.centerModules);\n }\n }\n centerModules() {\n const self = this;\n if (!self.opened || !self.$el || self.inline) return;\n const $pageContentEl = self.$el.find('.page-content');\n if (!$pageContentEl.length) return;\n const {\n scrollHeight,\n offsetHeight\n } = $pageContentEl[0];\n if (scrollHeight <= offsetHeight) {\n $pageContentEl.addClass('justify-content-center');\n } else {\n $pageContentEl.removeClass('justify-content-center');\n }\n }\n initInput() {\n const self = this;\n if (!self.$inputEl) return;\n if (self.params.inputReadOnly) self.$inputEl.prop('readOnly', true);\n }\n getModalType() {\n const self = this;\n const {\n app,\n modal,\n params\n } = self;\n const {\n openIn,\n openInPhone\n } = params;\n const device = getDevice();\n if (modal && modal.type) return modal.type;\n if (openIn !== 'auto') return openIn;\n if (self.inline) return null;\n if (device.ios) {\n return device.ipad ? 'popover' : openInPhone;\n }\n if (app.width >= 768) {\n return 'popover';\n }\n return openInPhone;\n }\n formatValue() {\n const self = this;\n const {\n value\n } = self;\n if (self.params.formatValue) {\n return self.params.formatValue.call(self, value);\n }\n return value.hex;\n }\n\n // eslint-disable-next-line\n normalizeHsValues(arr) {\n return [Math.floor(arr[0] * 10) / 10, Math.floor(arr[1] * 1000) / 1000, Math.floor(arr[2] * 1000) / 1000];\n }\n setValue(value, updateModules) {\n if (value === void 0) {\n value = {};\n }\n if (updateModules === void 0) {\n updateModules = true;\n }\n const self = this;\n if (typeof value === 'undefined') return;\n let {\n hex,\n rgb,\n hsl,\n hsb,\n alpha = 1,\n hue,\n rgba,\n hsla\n } = self.value || {};\n const needChangeEvent = self.value || !self.value && !self.params.value;\n let valueChanged;\n Object.keys(value).forEach(k => {\n if (!self.value || typeof self.value[k] === 'undefined') {\n valueChanged = true;\n return;\n }\n const v = value[k];\n if (Array.isArray(v)) {\n v.forEach((subV, subIndex) => {\n if (subV !== self.value[k][subIndex]) {\n valueChanged = true;\n }\n });\n } else if (v !== self.value[k]) {\n valueChanged = true;\n }\n });\n if (!valueChanged) return;\n if (value.rgb || value.rgba) {\n const [r, g, b, a = alpha] = value.rgb || value.rgba;\n rgb = [r, g, b];\n hex = colorRgbToHex(...rgb);\n hsl = colorRgbToHsl(...rgb);\n hsb = colorHslToHsb(...hsl);\n hsl = self.normalizeHsValues(hsl);\n hsb = self.normalizeHsValues(hsb);\n hue = hsb[0];\n alpha = a;\n rgba = [rgb[0], rgb[1], rgb[2], a];\n hsla = [hsl[0], hsl[1], hsl[2], a];\n }\n if (value.hsl || value.hsla) {\n const [h, s, l, a = alpha] = value.hsl || value.hsla;\n hsl = [h, s, l];\n rgb = colorHslToRgb(...hsl);\n hex = colorRgbToHex(...rgb);\n hsb = colorHslToHsb(...hsl);\n hsl = self.normalizeHsValues(hsl);\n hsb = self.normalizeHsValues(hsb);\n hue = hsb[0];\n alpha = a;\n rgba = [rgb[0], rgb[1], rgb[2], a];\n hsla = [hsl[0], hsl[1], hsl[2], a];\n }\n if (value.hsb) {\n const [h, s, b, a = alpha] = value.hsb;\n hsb = [h, s, b];\n hsl = colorHsbToHsl(...hsb);\n rgb = colorHslToRgb(...hsl);\n hex = colorRgbToHex(...rgb);\n hsl = self.normalizeHsValues(hsl);\n hsb = self.normalizeHsValues(hsb);\n hue = hsb[0];\n alpha = a;\n rgba = [rgb[0], rgb[1], rgb[2], a];\n hsla = [hsl[0], hsl[1], hsl[2], a];\n }\n if (value.hex) {\n rgb = colorHexToRgb(value.hex);\n hex = colorRgbToHex(...rgb);\n hsl = colorRgbToHsl(...rgb);\n hsb = colorHslToHsb(...hsl);\n hsl = self.normalizeHsValues(hsl);\n hsb = self.normalizeHsValues(hsb);\n hue = hsb[0];\n rgba = [rgb[0], rgb[1], rgb[2], alpha];\n hsla = [hsl[0], hsl[1], hsl[2], alpha];\n }\n if (typeof value.alpha !== 'undefined') {\n alpha = value.alpha;\n if (typeof rgb !== 'undefined') {\n rgba = [rgb[0], rgb[1], rgb[2], alpha];\n }\n if (typeof hsl !== 'undefined') {\n hsla = [hsl[0], hsl[1], hsl[2], alpha];\n }\n }\n if (typeof value.hue !== 'undefined') {\n const [h, s, l] = hsl; // eslint-disable-line\n hsl = [value.hue, s, l];\n hsb = colorHslToHsb(...hsl);\n rgb = colorHslToRgb(...hsl);\n hex = colorRgbToHex(...rgb);\n hsl = self.normalizeHsValues(hsl);\n hsb = self.normalizeHsValues(hsb);\n hue = hsb[0];\n rgba = [rgb[0], rgb[1], rgb[2], alpha];\n hsla = [hsl[0], hsl[1], hsl[2], alpha];\n }\n self.value = {\n hex,\n alpha,\n hue,\n rgb,\n hsl,\n hsb,\n rgba,\n hsla\n };\n if (!self.initialValue) self.initialValue = extend({}, self.value);\n self.updateValue(needChangeEvent);\n if (self.opened && updateModules) {\n self.updateModules();\n }\n }\n getValue() {\n const self = this;\n return self.value;\n }\n updateValue(fireEvents) {\n if (fireEvents === void 0) {\n fireEvents = true;\n }\n const self = this;\n const {\n $inputEl,\n value,\n $targetEl\n } = self;\n if ($targetEl && self.params.targetElSetBackgroundColor) {\n const {\n rgba\n } = value;\n $targetEl.css('background-color', `rgba(${rgba.join(', ')})`);\n }\n if (fireEvents) {\n self.emit('local::change colorPickerChange', self, value);\n }\n if ($inputEl && $inputEl.length) {\n const inputValue = self.formatValue(value);\n if ($inputEl && $inputEl.length) {\n $inputEl.val(inputValue);\n if (fireEvents) {\n $inputEl.trigger('change');\n }\n }\n }\n }\n updateModules() {\n const self = this;\n const {\n modules\n } = self;\n self.params.modules.forEach(m => {\n if (typeof m === 'string' && modules[m] && modules[m].update) {\n modules[m].update(self);\n } else if (m && m.update) {\n m.update(self);\n }\n });\n }\n update() {\n const self = this;\n self.updateModules();\n }\n renderPicker() {\n const self = this;\n const {\n params,\n modules\n } = self;\n let html = '';\n params.modules.forEach(m => {\n if (typeof m === 'string' && modules[m] && modules[m].render) {\n html += modules[m].render(self);\n } else if (m && m.render) {\n html += m.render(self);\n }\n });\n return html;\n }\n renderNavbar() {\n const self = this;\n if (self.params.renderNavbar) {\n return self.params.renderNavbar.call(self, self);\n }\n const {\n openIn,\n navbarTitleText,\n navbarBackLinkText,\n navbarCloseText\n } = self.params;\n return $jsx(\"div\", {\n class: \"navbar\"\n }, $jsx(\"div\", {\n class: \"navbar-bg\"\n }), $jsx(\"div\", {\n class: \"navbar-inner sliding\"\n }, openIn === 'page' && $jsx(\"div\", {\n class: \"left\"\n }, $jsx(\"a\", {\n class: \"link back\"\n }, $jsx(\"i\", {\n class: \"icon icon-back\"\n }), $jsx(\"span\", {\n class: \"if-not-md\"\n }, navbarBackLinkText))), $jsx(\"div\", {\n class: \"title\"\n }, navbarTitleText), openIn !== 'page' && $jsx(\"div\", {\n class: \"right\"\n }, $jsx(\"a\", {\n class: \"link popup-close\",\n \"data-popup\": \".color-picker-popup\"\n }, navbarCloseText))));\n }\n renderToolbar() {\n const self = this;\n if (self.params.renderToolbar) {\n return self.params.renderToolbar.call(self, self);\n }\n return $jsx(\"div\", {\n class: \"toolbar toolbar-top\"\n }, $jsx(\"div\", {\n class: \"toolbar-inner\"\n }, $jsx(\"div\", {\n class: \"left\"\n }), $jsx(\"div\", {\n class: \"right\"\n }, $jsx(\"a\", {\n class: \"link sheet-close popover-close\",\n \"data-sheet\": \".color-picker-sheet-modal\",\n \"data-popover\": \".color-picker-popover\"\n }, self.params.toolbarCloseText))));\n }\n renderInline() {\n const self = this;\n const {\n cssClass,\n groupedModules\n } = self.params;\n return $jsx(\"div\", {\n class: `color-picker color-picker-inline ${groupedModules ? 'color-picker-grouped-modules' : ''} ${cssClass || ''}`\n }, self.renderPicker());\n }\n renderSheet() {\n const self = this;\n const {\n cssClass,\n toolbarSheet,\n groupedModules\n } = self.params;\n return $jsx(\"div\", {\n class: `sheet-modal color-picker color-picker-sheet-modal ${groupedModules ? 'color-picker-grouped-modules' : ''} ${cssClass || ''}`\n }, toolbarSheet && self.renderToolbar(), $jsx(\"div\", {\n class: \"sheet-modal-inner\"\n }, $jsx(\"div\", {\n class: \"page-content\"\n }, self.renderPicker())));\n }\n renderPopover() {\n const self = this;\n const {\n cssClass,\n toolbarPopover,\n groupedModules\n } = self.params;\n return $jsx(\"div\", {\n class: `popover color-picker-popover ${cssClass || ''}`\n }, $jsx(\"div\", {\n class: \"popover-inner\"\n }, $jsx(\"div\", {\n class: `color-picker ${groupedModules ? 'color-picker-grouped-modules' : ''}`\n }, toolbarPopover && self.renderToolbar(), $jsx(\"div\", {\n class: \"page-content\"\n }, self.renderPicker()))));\n }\n renderPopup() {\n const self = this;\n const {\n cssClass,\n navbarPopup,\n groupedModules\n } = self.params;\n return $jsx(\"div\", {\n class: `popup color-picker-popup ${cssClass || ''}`\n }, $jsx(\"div\", {\n class: \"page\"\n }, navbarPopup && self.renderNavbar(), $jsx(\"div\", {\n class: `color-picker ${groupedModules ? 'color-picker-grouped-modules' : ''}`\n }, $jsx(\"div\", {\n class: \"page-content\"\n }, self.renderPicker()))));\n }\n renderPage() {\n const self = this;\n const {\n cssClass,\n groupedModules\n } = self.params;\n return $jsx(\"div\", {\n class: `page color-picker-page ${cssClass || ''}`,\n \"data-name\": \"color-picker-page\"\n }, self.renderNavbar(), $jsx(\"div\", {\n class: `color-picker ${groupedModules ? 'color-picker-grouped-modules' : ''}`\n }, $jsx(\"div\", {\n class: \"page-content\"\n }, self.renderPicker())));\n }\n\n // eslint-disable-next-line\n render() {\n const self = this;\n const {\n params\n } = self;\n if (params.render) return params.render.call(self);\n if (self.inline) return self.renderInline();\n if (params.openIn === 'page') {\n return self.renderPage();\n }\n const modalType = self.getModalType();\n if (modalType === 'popover') return self.renderPopover();\n if (modalType === 'sheet') return self.renderSheet();\n if (modalType === 'popup') return self.renderPopup();\n }\n onOpen() {\n const self = this;\n const {\n initialized,\n $el,\n app,\n $inputEl,\n inline,\n value,\n params,\n modules\n } = self;\n self.closing = false;\n self.opened = true;\n self.opening = true;\n\n // Init main events\n self.attachEvents();\n params.modules.forEach(m => {\n if (typeof m === 'string' && modules[m] && modules[m].init) {\n modules[m].init(self);\n } else if (m && m.init) {\n m.init(self);\n }\n });\n const updateValue = !value && params.value;\n\n // Set value\n if (!initialized) {\n if (value) self.setValue(value);else if (params.value) {\n self.setValue(params.value, false);\n } else if (!params.value) {\n self.setValue({\n hex: '#ff0000'\n }, false);\n }\n } else if (value) {\n self.initialValue = extend({}, value);\n self.setValue(value, false);\n }\n\n // Update input value\n if (updateValue) self.updateValue();\n self.updateModules();\n\n // Center modules\n if (params.centerModules) {\n self.centerModules();\n }\n\n // Extra focus\n if (!inline && $inputEl && $inputEl.length && app.theme === 'md') {\n $inputEl.trigger('focus');\n }\n self.initialized = true;\n\n // Trigger events\n if ($el) {\n $el.trigger('colorpicker:open');\n }\n if ($inputEl) {\n $inputEl.trigger('colorpicker:open');\n }\n self.emit('local::open colorPickerOpen', self);\n }\n onOpened() {\n const self = this;\n self.opening = false;\n if (self.$el) {\n self.$el.trigger('colorpicker:opened');\n }\n if (self.$inputEl) {\n self.$inputEl.trigger('colorpicker:opened');\n }\n self.emit('local::opened colorPickerOpened', self);\n }\n onClose() {\n const self = this;\n const {\n app,\n params,\n modules\n } = self;\n self.opening = false;\n self.closing = true;\n\n // Detach events\n self.detachEvents();\n if (self.$inputEl) {\n if (app.theme === 'md') {\n self.$inputEl.trigger('blur');\n } else {\n const validate = self.$inputEl.attr('validate');\n const required = self.$inputEl.attr('required');\n if (validate && required) {\n app.input.validate(self.$inputEl);\n }\n }\n }\n params.modules.forEach(m => {\n if (typeof m === 'string' && modules[m] && modules[m].destroy) {\n modules[m].destroy(self);\n } else if (m && m.destroy) {\n m.destroy(self);\n }\n });\n if (self.$el) {\n self.$el.trigger('colorpicker:close');\n }\n if (self.$inputEl) {\n self.$inputEl.trigger('colorpicker:close');\n }\n self.emit('local::close colorPickerClose', self);\n }\n onClosed() {\n const self = this;\n self.opened = false;\n self.closing = false;\n if (!self.inline) {\n nextTick(() => {\n if (self.modal && self.modal.el && self.modal.destroy) {\n if (!self.params.routableModals) {\n self.modal.destroy();\n }\n }\n delete self.modal;\n });\n }\n if (self.$el) {\n self.$el.trigger('colorpicker:closed');\n }\n if (self.$inputEl) {\n self.$inputEl.trigger('colorpicker:closed');\n }\n self.emit('local::closed colorPickerClosed', self);\n }\n open() {\n const self = this;\n const {\n app,\n opened,\n inline,\n $inputEl,\n $targetEl,\n params\n } = self;\n if (opened) return;\n if (inline) {\n self.$el = $(self.render());\n self.$el[0].f7ColorPicker = self;\n self.$containerEl.append(self.$el);\n self.onOpen();\n self.onOpened();\n return;\n }\n const colorPickerContent = self.render();\n if (params.openIn === 'page') {\n self.view.router.navigate({\n url: self.url,\n route: {\n content: colorPickerContent,\n path: self.url,\n on: {\n pageBeforeIn(e, page) {\n self.$el = page.$el.find('.color-picker');\n self.$el[0].f7ColorPicker = self;\n self.onOpen();\n },\n pageAfterIn() {\n self.onOpened();\n },\n pageBeforeOut() {\n self.onClose();\n },\n pageAfterOut() {\n self.onClosed();\n if (self.$el && self.$el[0]) {\n self.$el[0].f7ColorPicker = null;\n delete self.$el[0].f7ColorPicker;\n }\n }\n }\n }\n });\n } else {\n const modalType = self.getModalType();\n let backdrop = params.backdrop;\n if (backdrop === null || typeof backdrop === 'undefined') {\n if (modalType === 'popover' && app.params.popover.backdrop !== false) backdrop = true;\n if (modalType === 'popup') backdrop = true;\n }\n const modalParams = {\n targetEl: $targetEl || $inputEl,\n scrollToEl: params.scrollToInput ? $targetEl || $inputEl : undefined,\n content: colorPickerContent,\n backdrop,\n closeByBackdropClick: params.closeByBackdropClick,\n on: {\n open() {\n const modal = this;\n self.modal = modal;\n self.$el = modalType === 'popover' || modalType === 'popup' ? modal.$el.find('.color-picker') : modal.$el;\n self.$el[0].f7ColorPicker = self;\n self.onOpen();\n },\n opened() {\n self.onOpened();\n },\n close() {\n self.onClose();\n },\n closed() {\n self.onClosed();\n if (self.$el && self.$el[0]) {\n self.$el[0].f7ColorPicker = null;\n delete self.$el[0].f7ColorPicker;\n }\n }\n }\n };\n if (modalType === 'popup') {\n modalParams.push = params.popupPush;\n modalParams.swipeToClose = params.popupSwipeToClose;\n }\n if (modalType === 'sheet') {\n modalParams.push = params.sheetPush;\n modalParams.swipeToClose = params.sheetSwipeToClose;\n }\n if (params.routableModals && self.view) {\n self.view.router.navigate({\n url: self.url,\n route: {\n path: self.url,\n [modalType]: modalParams\n }\n });\n } else {\n self.modal = app[modalType].create(modalParams);\n self.modal.open();\n }\n }\n }\n close() {\n const self = this;\n const {\n opened,\n inline\n } = self;\n if (!opened) return;\n if (inline) {\n self.onClose();\n self.onClosed();\n return;\n }\n if (self.params.routableModals && self.view || self.params.openIn === 'page') {\n self.view.router.back();\n } else {\n self.modal.close();\n }\n }\n init() {\n const self = this;\n self.initInput();\n if (self.inline) {\n self.open();\n self.emit('local::init colorPickerInit', self);\n return;\n }\n if (!self.initialized && self.params.value) {\n self.setValue(self.params.value);\n }\n\n // Attach input Events\n if (self.$inputEl) {\n self.attachInputEvents();\n }\n if (self.$targetEl) {\n self.attachTargetEvents();\n }\n if (self.params.closeByOutsideClick) {\n self.attachHtmlEvents();\n }\n self.emit('local::init colorPickerInit', self);\n }\n destroy() {\n const self = this;\n if (self.destroyed) return;\n const {\n $el\n } = self;\n self.emit('local::beforeDestroy colorPickerBeforeDestroy', self);\n if ($el) $el.trigger('colorpicker:beforedestroy');\n self.close();\n\n // Detach Events\n self.detachEvents();\n if (self.$inputEl) {\n self.detachInputEvents();\n }\n if (self.$targetEl) {\n self.detachTargetEvents();\n }\n if (self.params.closeByOutsideClick) {\n self.detachHtmlEvents();\n }\n if ($el && $el.length) delete self.$el[0].f7ColorPicker;\n deleteProps(self);\n self.destroyed = true;\n }\n}\nexport default ColorPicker;", "import $ from '../../shared/dom7.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nimport ColorPicker from './color-picker-class.js';\nexport default {\n name: 'colorPicker',\n static: {\n ColorPicker\n },\n create() {\n const app = this;\n app.colorPicker = ConstructorMethods({\n defaultSelector: '.color-picker',\n constructor: ColorPicker,\n app,\n domProp: 'f7ColorPicker'\n });\n app.colorPicker.close = function close(el) {\n if (el === void 0) {\n el = '.color-picker';\n }\n const $el = $(el);\n if ($el.length === 0) return;\n const colorPicker = $el[0].f7ColorPicker;\n if (!colorPicker || colorPicker && !colorPicker.opened) return;\n colorPicker.close();\n };\n },\n params: {\n colorPicker: {\n // Color picker settings\n value: null,\n modules: ['wheel'],\n palette: [['#FFEBEE', '#FFCDD2', '#EF9A9A', '#E57373', '#EF5350', '#F44336', '#E53935', '#D32F2F', '#C62828', '#B71C1C'], ['#F3E5F5', '#E1BEE7', '#CE93D8', '#BA68C8', '#AB47BC', '#9C27B0', '#8E24AA', '#7B1FA2', '#6A1B9A', '#4A148C'], ['#E8EAF6', '#C5CAE9', '#9FA8DA', '#7986CB', '#5C6BC0', '#3F51B5', '#3949AB', '#303F9F', '#283593', '#1A237E'], ['#E1F5FE', '#B3E5FC', '#81D4FA', '#4FC3F7', '#29B6F6', '#03A9F4', '#039BE5', '#0288D1', '#0277BD', '#01579B'], ['#E0F2F1', '#B2DFDB', '#80CBC4', '#4DB6AC', '#26A69A', '#009688', '#00897B', '#00796B', '#00695C', '#004D40'], ['#F1F8E9', '#DCEDC8', '#C5E1A5', '#AED581', '#9CCC65', '#8BC34A', '#7CB342', '#689F38', '#558B2F', '#33691E'], ['#FFFDE7', '#FFF9C4', '#FFF59D', '#FFF176', '#FFEE58', '#FFEB3B', '#FDD835', '#FBC02D', '#F9A825', '#F57F17'], ['#FFF3E0', '#FFE0B2', '#FFCC80', '#FFB74D', '#FFA726', '#FF9800', '#FB8C00', '#F57C00', '#EF6C00', '#E65100']],\n groupedModules: false,\n centerModules: true,\n sliderLabel: false,\n sliderValue: false,\n sliderValueEdiable: false,\n barLabel: false,\n barValue: false,\n barValueEdiable: false,\n hexLabel: false,\n hexValueEditable: false,\n redLabelText: 'R',\n greenLabelText: 'G',\n blueLabelText: 'B',\n hueLabelText: 'H',\n saturationLabelText: 'S',\n brightnessLabelText: 'B',\n hexLabelText: 'HEX',\n alphaLabelText: 'A',\n // Common opener settings\n containerEl: null,\n openIn: 'popover',\n // or 'popover' or 'sheet' or 'popup' or 'page' or 'auto'\n openInPhone: 'popup',\n // or 'popover' or 'sheet' or 'popup' or 'page'\n popupPush: false,\n popupSwipeToClose: undefined,\n sheetPush: false,\n sheetSwipeToClose: undefined,\n formatValue: null,\n targetEl: null,\n targetElSetBackgroundColor: false,\n inputEl: null,\n inputReadOnly: true,\n closeByOutsideClick: true,\n scrollToInput: true,\n toolbarSheet: true,\n toolbarPopover: false,\n toolbarCloseText: 'Done',\n navbarPopup: true,\n navbarCloseText: 'Done',\n navbarTitleText: 'Color',\n navbarBackLinkText: 'Back',\n cssClass: null,\n routableModals: false,\n view: null,\n url: 'color/',\n backdrop: null,\n closeByBackdropClick: true,\n // Render functions\n renderToolbar: null,\n renderNavbar: null,\n renderInline: null,\n renderPopover: null,\n renderSheet: null,\n renderPopup: null,\n render: null\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { bindMethods, iosPreloaderContent, mdPreloaderContent } from '../../shared/utils.js';\nconst Treeview = {\n open(itemEl) {\n const app = this;\n const $itemEl = $(itemEl).eq(0);\n if (!$itemEl.length) return;\n $itemEl.addClass('treeview-item-opened');\n $itemEl.trigger('treeview:open');\n app.emit('treeviewOpen', $itemEl[0]);\n function done(cancel) {\n if (cancel) {\n $itemEl.removeClass('treeview-item-opened');\n $itemEl.trigger('treeview:close');\n app.emit('treeviewClose', $itemEl[0]);\n } else {\n $itemEl[0].f7TreeviewChildrenLoaded = true;\n }\n $itemEl.find('.treeview-toggle').removeClass('treeview-toggle-hidden');\n $itemEl.find('.treeview-preloader').remove();\n }\n if ($itemEl.hasClass('treeview-load-children') && !$itemEl[0].f7TreeviewChildrenLoaded) {\n const preloaders = {\n iosPreloaderContent,\n mdPreloaderContent\n };\n $itemEl.trigger('treeview:loadchildren', done);\n app.emit('treeviewLoadChildren', $itemEl[0], done);\n $itemEl.find('.treeview-toggle').addClass('treeview-toggle-hidden');\n $itemEl.find('.treeview-item-root').prepend(`${preloaders[`${app.theme}PreloaderContent`]}
`);\n }\n },\n close(itemEl) {\n const app = this;\n const $itemEl = $(itemEl).eq(0);\n if (!$itemEl.length) return;\n $itemEl.removeClass('treeview-item-opened');\n $itemEl.trigger('treeview:close');\n app.emit('treeviewClose', $itemEl[0]);\n },\n toggle(itemEl) {\n const app = this;\n const $itemEl = $(itemEl).eq(0);\n if (!$itemEl.length) return;\n const wasOpened = $itemEl.hasClass('treeview-item-opened');\n app.treeview[wasOpened ? 'close' : 'open']($itemEl);\n }\n};\nexport default {\n name: 'treeview',\n create() {\n const app = this;\n bindMethods(app, {\n treeview: Treeview\n });\n },\n clicks: {\n '.treeview-toggle': function toggle($clickedEl, clickedData, e) {\n const app = this;\n if ($clickedEl.parents('.treeview-item-toggle').length) return;\n const $treeviewItemEl = $clickedEl.parents('.treeview-item').eq(0);\n if (!$treeviewItemEl.length) return;\n e.preventF7Router = true;\n app.treeview.toggle($treeviewItemEl[0]);\n },\n '.treeview-item-toggle': function toggle($clickedEl, clickedData, e) {\n const app = this;\n const $treeviewItemEl = $clickedEl.closest('.treeview-item').eq(0);\n if (!$treeviewItemEl.length) return;\n e.preventF7Router = true;\n app.treeview.toggle($treeviewItemEl[0]);\n }\n }\n};", "import { getWindow, getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\nimport { getDevice } from '../../shared/get-device.js';\nconst textEditorButtonsMap = {\n // f7-icon, material-icon, command\n bold: ['bold', 'format_bold', 'bold'],\n italic: ['italic', 'format_italic', 'italic'],\n underline: ['underline', 'format_underlined', 'underline'],\n strikeThrough: ['strikethrough', 'strikethrough_s', 'strikeThrough'],\n orderedList: ['list_number', 'format_list_numbered', 'insertOrderedList'],\n unorderedList: ['list_bullet', 'format_list_bulleted', 'insertUnorderedList'],\n link: ['link', 'link', 'createLink'],\n image: ['photo', 'image', 'insertImage'],\n paragraph: ['paragraph', '\u00B6', 'formatBlock.P'],\n h1: ['H1', 'H1', 'formatBlock.H1'],\n h2: ['H2', 'H2', 'formatBlock.H2'],\n h3: ['H3', 'H3', 'formatBlock.H3'],\n alignLeft: ['text_alignleft', 'format_align_left', 'justifyLeft'],\n alignCenter: ['text_aligncenter', 'format_align_center', 'justifyCenter'],\n alignRight: ['text_alignright', 'format_align_right', 'justifyRight'],\n alignJustify: ['text_justify', 'format_align_justify', 'justifyFull'],\n subscript: ['textformat_subscript', 'A1', 'subscript'],\n superscript: ['textformat_superscript', 'A1', 'superscript'],\n indent: ['increase_indent', 'format_indent_increase', 'indent'],\n outdent: ['decrease_indent', 'format_indent_decrease', 'outdent']\n};\nclass TextEditor extends Framework7Class {\n constructor(app, params) {\n super(params, [app]);\n const self = this;\n const document = getDocument();\n const device = getDevice();\n const defaults = extend({}, app.params.textEditor);\n\n // Extend defaults with modules params\n self.useModulesParams(defaults);\n self.params = extend(defaults, params);\n const el = self.params.el;\n if (!el) return self;\n const $el = $(el);\n if ($el.length === 0) return self;\n if ($el[0].f7TextEditor) return $el[0].f7TextEditor;\n let $contentEl = $el.children('.text-editor-content');\n if (!$contentEl.length) {\n $el.append('');\n $contentEl = $el.children('.text-editor-content');\n }\n extend(self, {\n app,\n $el,\n el: $el[0],\n $contentEl,\n contentEl: $contentEl[0]\n });\n if ('value' in params) {\n self.value = self.params.value;\n }\n if (self.params.mode === 'keyboard-toolbar') {\n if (!(device.cordova || device.capacitor) && !device.android) {\n self.params.mode = 'popover';\n }\n }\n if (typeof self.params.buttons === 'string') {\n try {\n self.params.buttons = JSON.parse(self.params.buttons);\n } catch (err) {\n throw new Error('Framework7: TextEditor: wrong \"buttons\" parameter format');\n }\n }\n $el[0].f7TextEditor = self;\n\n // Bind\n self.onButtonClick = self.onButtonClick.bind(self);\n self.onFocus = self.onFocus.bind(self);\n self.onBlur = self.onBlur.bind(self);\n self.onInput = self.onInput.bind(self);\n self.onPaste = self.onPaste.bind(self);\n self.onSelectionChange = self.onSelectionChange.bind(self);\n self.closeKeyboardToolbar = self.closeKeyboardToolbar.bind(self);\n\n // Handle Events\n self.attachEvents = function attachEvents() {\n if (self.params.mode === 'toolbar') {\n self.$el.find('.text-editor-toolbar').on('click', 'button', self.onButtonClick);\n }\n if (self.params.mode === 'keyboard-toolbar') {\n self.$keyboardToolbarEl.on('click', 'button', self.onButtonClick);\n self.$el.parents('.page').on('page:beforeout', self.closeKeyboardToolbar);\n }\n if (self.params.mode === 'popover' && self.popover) {\n self.popover.$el.on('click', 'button', self.onButtonClick);\n }\n self.$contentEl.on('paste', self.onPaste);\n self.$contentEl.on('focus', self.onFocus);\n self.$contentEl.on('blur', self.onBlur);\n self.$contentEl.on('input', self.onInput, true);\n $(document).on('selectionchange', self.onSelectionChange);\n };\n self.detachEvents = function detachEvents() {\n if (self.params.mode === 'toolbar') {\n self.$el.find('.text-editor-toolbar').off('click', 'button', self.onButtonClick);\n }\n if (self.params.mode === 'keyboard-toolbar') {\n self.$keyboardToolbarEl.off('click', 'button', self.onButtonClick);\n self.$el.parents('.page').off('page:beforeout', self.closeKeyboardToolbar);\n }\n if (self.params.mode === 'popover' && self.popover) {\n self.popover.$el.off('click', 'button', self.onButtonClick);\n }\n self.$contentEl.off('paste', self.onPaste);\n self.$contentEl.off('focus', self.onFocus);\n self.$contentEl.off('blur', self.onBlur);\n self.$contentEl.off('input', self.onInput, true);\n $(document).off('selectionchange', self.onSelectionChange);\n };\n\n // Install Modules\n self.useModules();\n\n // Init\n self.init();\n return self;\n }\n setValue(newValue) {\n const self = this;\n const currentValue = self.value;\n if (currentValue === newValue) return self;\n self.value = newValue;\n self.$contentEl.html(newValue);\n self.$el.trigger('texteditor:change', self.value);\n self.emit('local::change textEditorChange', self, self.value);\n return self;\n }\n getValue() {\n const self = this;\n return self.value;\n }\n clearValue() {\n const self = this;\n self.setValue('');\n if (self.params.placeholder && !self.$contentEl.html()) {\n self.insertPlaceholder();\n }\n return self;\n }\n createLink() {\n const self = this;\n const window = getWindow();\n const document = getDocument();\n const currentSelection = window.getSelection();\n const selectedNodes = [];\n let $selectedLinks;\n if (currentSelection && currentSelection.anchorNode && $(currentSelection.anchorNode).parents(self.$el).length) {\n let anchorNode = currentSelection.anchorNode;\n while (anchorNode) {\n selectedNodes.push(anchorNode);\n if (!anchorNode.nextSibling || anchorNode === currentSelection.focusNode) {\n anchorNode = null;\n }\n if (anchorNode) {\n anchorNode = anchorNode.nextSibling;\n }\n }\n const selectedNodesLinks = [];\n const $selectedNodes = $(selectedNodes);\n for (let i = 0; i < $selectedNodes.length; i += 1) {\n const childNodes = $selectedNodes[i].children;\n if (childNodes) {\n for (let j = 0; j < childNodes.length; j += 1) {\n if ($(childNodes[j]).is('a')) {\n selectedNodesLinks.push(childNodes[j]);\n }\n }\n }\n }\n $selectedLinks = $selectedNodes.closest('a').add($(selectedNodesLinks));\n }\n if ($selectedLinks && $selectedLinks.length) {\n $selectedLinks.each(linkNode => {\n const selection = window.getSelection();\n const range = document.createRange();\n range.selectNodeContents(linkNode);\n selection.removeAllRanges();\n selection.addRange(range);\n document.execCommand('unlink', false);\n selection.removeAllRanges();\n });\n return self;\n }\n const currentRange = self.getSelectionRange();\n if (!currentRange) return self;\n const dialog = self.app.dialog.prompt('', self.params.linkUrlText, link => {\n if (link && link.trim().length) {\n self.setSelectionRange(currentRange);\n document.execCommand('createLink', false, link.trim());\n self.$el.trigger('texteditor:insertlink', {\n url: link.trim()\n });\n self.emit('local:insertLink textEditorInsertLink', self, link.trim());\n }\n });\n dialog.$el.find('input').focus();\n return self;\n }\n insertImage() {\n const self = this;\n const document = getDocument();\n const currentRange = self.getSelectionRange();\n if (!currentRange) return self;\n const dialog = self.app.dialog.prompt('', self.params.imageUrlText, imageUrl => {\n if (imageUrl && imageUrl.trim().length) {\n self.setSelectionRange(currentRange);\n document.execCommand('insertImage', false, imageUrl.trim());\n self.$el.trigger('texteditor:insertimage', {\n url: imageUrl.trim()\n });\n self.emit('local:insertImage textEditorInsertImage', self, imageUrl.trim());\n }\n });\n dialog.$el.find('input').focus();\n return self;\n }\n removePlaceholder() {\n const self = this;\n self.$contentEl.find('.text-editor-placeholder').remove();\n }\n insertPlaceholder() {\n const self = this;\n self.$contentEl.append(`${self.params.placeholder}
`);\n }\n onSelectionChange() {\n const self = this;\n const window = getWindow();\n const document = getDocument();\n if (self.params.mode === 'toolbar') return;\n const selection = window.getSelection();\n const selectionIsInContent = $(selection.anchorNode).parents(self.contentEl).length || selection.anchorNode === self.contentEl;\n if (self.params.mode === 'keyboard-toolbar') {\n if (!selectionIsInContent) {\n self.closeKeyboardToolbar();\n } else {\n self.openKeyboardToolbar();\n }\n return;\n }\n if (self.params.mode === 'popover') {\n const selectionIsInPopover = $(selection.anchorNode).parents(self.popover.el).length || selection.anchorNode === self.popover.el;\n if (!selectionIsInContent && !selectionIsInPopover) {\n self.closePopover();\n return;\n }\n if (!selection.isCollapsed && selection.rangeCount) {\n const range = selection.getRangeAt(0);\n const rect = range.getBoundingClientRect();\n const rootEl = self.app.$el[0] || document.body;\n self.openPopover(rect.x + (window.scrollX || 0) - rootEl.offsetLeft, rect.y + (window.scrollY || 0) - rootEl.offsetTop, rect.width, rect.height);\n } else if (selection.isCollapsed) {\n self.closePopover();\n }\n }\n }\n onPaste(e) {\n const self = this;\n const document = getDocument();\n if (self.params.clearFormattingOnPaste && e.clipboardData && e.clipboardData.getData) {\n const text = e.clipboardData.getData('text/plain');\n e.preventDefault();\n document.execCommand('insertText', false, text);\n }\n }\n onInput() {\n const self = this;\n const value = self.$contentEl.html();\n self.value = value;\n self.$el.trigger('texteditor:input');\n self.emit('local:input textEditorInput', self, self.value);\n self.$el.trigger('texteditor:change', self.value);\n self.emit('local::change textEditorChange', self, self.value);\n }\n onFocus() {\n const self = this;\n self.removePlaceholder();\n self.$contentEl.focus();\n self.$el.trigger('texteditor:focus');\n self.emit('local::focus textEditorFocus', self);\n }\n onBlur() {\n const self = this;\n const window = getWindow();\n const document = getDocument();\n if (self.params.placeholder && self.$contentEl.html() === '') {\n self.insertPlaceholder();\n }\n if (self.params.mode === 'popover') {\n const selection = window.getSelection();\n const selectionIsInContent = $(selection.anchorNode).parents(self.contentEl).length || selection.anchorNode === self.contentEl;\n const inPopover = document.activeElement && self.popover && $(document.activeElement).closest(self.popover.$el).length;\n if (!inPopover && !selectionIsInContent) {\n self.closePopover();\n }\n }\n if (self.params.mode === 'keyboard-toolbar') {\n const selection = window.getSelection();\n const selectionIsInContent = $(selection.anchorNode).parents(self.contentEl).length || selection.anchorNode === self.contentEl;\n if (!selectionIsInContent) {\n self.closeKeyboardToolbar();\n }\n }\n self.$el.trigger('texteditor:blur');\n self.emit('local::blur textEditorBlur', self);\n }\n onButtonClick(e) {\n const self = this;\n const window = getWindow();\n const document = getDocument();\n const selection = window.getSelection();\n const selectionIsInContent = $(selection.anchorNode).parents(self.contentEl).length || selection.anchorNode === self.contentEl;\n if (!selectionIsInContent) return;\n const $buttonEl = $(e.target).closest('button');\n if ($buttonEl.parents('form').length) {\n e.preventDefault();\n }\n const button = $buttonEl.attr('data-button');\n const buttonData = self.params.customButtons && self.params.customButtons[button];\n if (!button || !(textEditorButtonsMap[button] || buttonData)) return;\n $buttonEl.trigger('texteditor:buttonclick', button);\n self.emit('local::buttonClick textEditorButtonClick', self, button);\n if (buttonData) {\n if (buttonData.onClick) buttonData.onClick(self, $buttonEl[0]);\n return;\n }\n const command = textEditorButtonsMap[button][2];\n if (command === 'createLink') {\n self.createLink();\n return;\n }\n if (command === 'insertImage') {\n self.insertImage();\n return;\n }\n if (command.indexOf('formatBlock') === 0) {\n const tagName = command.split('.')[1];\n const $anchorNode = $(selection.anchorNode);\n if ($anchorNode.parents(tagName.toLowerCase()).length || $anchorNode.is(tagName)) {\n document.execCommand('formatBlock', false, 'div');\n } else {\n document.execCommand('formatBlock', false, tagName);\n }\n return;\n }\n document.execCommand(command, false);\n }\n\n // eslint-disable-next-line\n getSelectionRange() {\n const window = getWindow();\n const document = getDocument();\n if (window.getSelection) {\n const sel = window.getSelection();\n if (sel.getRangeAt && sel.rangeCount) {\n return sel.getRangeAt(0);\n }\n } else if (document.selection && document.selection.createRange) {\n return document.selection.createRange();\n }\n return null;\n }\n\n // eslint-disable-next-line\n setSelectionRange(range) {\n const window = getWindow();\n const document = getDocument();\n if (range) {\n if (window.getSelection) {\n const sel = window.getSelection();\n sel.removeAllRanges();\n sel.addRange(range);\n } else if (document.selection && range.select) {\n range.select();\n }\n }\n }\n renderButtons() {\n const self = this;\n let html = '';\n function renderButton(button) {\n const iconClass = self.app.theme === 'md' ? 'material-icons' : 'f7-icons';\n if (self.params.customButtons && self.params.customButtons[button]) {\n const buttonData = self.params.customButtons[button];\n return ``;\n }\n if (!textEditorButtonsMap[button]) return '';\n const iconContent = textEditorButtonsMap[button][self.app.theme === 'md' ? 1 : 0];\n return ``.trim();\n }\n self.params.buttons.forEach((button, buttonIndex) => {\n if (Array.isArray(button)) {\n button.forEach(b => {\n html += renderButton(b);\n });\n if (buttonIndex < self.params.buttons.length - 1 && self.params.dividers) {\n html += '';\n }\n } else {\n html += renderButton(button);\n }\n });\n return html;\n }\n createToolbar() {\n const self = this;\n self.$el.prepend(`${self.renderButtons()}
`);\n }\n createKeyboardToolbar() {\n const self = this;\n self.$keyboardToolbarEl = $(``);\n }\n createPopover() {\n const self = this;\n self.popover = self.app.popover.create({\n content: `\n \n
${self.renderButtons()}
\n
\n `,\n closeByOutsideClick: false,\n backdrop: false\n });\n }\n openKeyboardToolbar() {\n const self = this;\n if (self.$keyboardToolbarEl.parent(self.app.$el).length) return;\n self.$el.trigger('texteditor:keyboardopen');\n self.emit('local::keyboardOpen textEditorKeyboardOpen', self);\n self.app.$el.append(self.$keyboardToolbarEl);\n }\n closeKeyboardToolbar() {\n const self = this;\n self.$keyboardToolbarEl.remove();\n self.$el.trigger('texteditor:keyboardclose');\n self.emit('local::keyboardClose textEditorKeyboardClose', self);\n }\n openPopover(targetX, targetY, targetWidth, targetHeight) {\n const self = this;\n if (!self.popover) return;\n Object.assign(self.popover.params, {\n targetX,\n targetY,\n targetWidth,\n targetHeight\n });\n clearTimeout(self.popoverTimeout);\n self.popoverTimeout = setTimeout(() => {\n if (!self.popover) return;\n if (self.popover.opened) {\n self.popover.resize();\n } else {\n self.$el.trigger('texteditor:popoveropen');\n self.emit('local::popoverOpen textEditorPopoverOpen', self);\n self.popover.open();\n }\n }, 400);\n }\n closePopover() {\n const self = this;\n clearTimeout(self.popoverTimeout);\n if (!self.popover || !self.popover.opened) return;\n self.popoverTimeout = setTimeout(() => {\n if (!self.popover) return;\n self.$el.trigger('texteditor:popoverclose');\n self.emit('local::popoverClose textEditorPopoverClose', self);\n self.popover.close();\n }, 400);\n }\n init() {\n const self = this;\n if (self.value) {\n self.$contentEl.html(self.value);\n } else {\n self.value = self.$contentEl.html();\n }\n if (self.params.placeholder && self.value === '') {\n self.insertPlaceholder();\n }\n if (self.params.mode === 'toolbar') {\n self.createToolbar();\n } else if (self.params.mode === 'popover') {\n self.createPopover();\n } else if (self.params.mode === 'keyboard-toolbar') {\n self.createKeyboardToolbar();\n }\n self.attachEvents();\n self.$el.trigger('texteditor:init');\n self.emit('local::init textEditorInit', self);\n return self;\n }\n destroy() {\n let self = this;\n self.$el.trigger('texteditor:beforedestroy');\n self.emit('local::beforeDestroy textEditorBeforeDestroy', self);\n self.detachEvents();\n if (self.params.mode === 'keyboard-toolbar' && self.$keyboardToolbarEl) {\n self.$keyboardToolbarEl.remove();\n }\n if (self.popover) {\n self.popover.close(false);\n self.popover.destroy();\n }\n delete self.$el[0].f7TextEditor;\n deleteProps(self);\n self = null;\n }\n}\nexport default TextEditor;", "import $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nimport TextEditor from './text-editor-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'textEditor',\n params: {\n textEditor: {\n el: null,\n mode: 'toolbar',\n // or 'popover'\n value: undefined,\n // will use html content\n customButtons: null,\n buttons: [['bold', 'italic', 'underline', 'strikeThrough'], ['orderedList', 'unorderedList'], ['link', 'image'], ['paragraph', 'h1', 'h2', 'h3'], ['alignLeft', 'alignCenter', 'alignRight', 'alignJustify'], ['subscript', 'superscript'], ['indent', 'outdent']],\n dividers: true,\n imageUrlText: 'Insert image URL',\n linkUrlText: 'Insert link URL',\n placeholder: null,\n clearFormattingOnPaste: true\n }\n },\n create() {\n const app = this;\n app.textEditor = extend(ConstructorMethods({\n defaultSelector: '.text-editor',\n constructor: TextEditor,\n app,\n domProp: 'f7TextEditor'\n }));\n },\n static: {\n TextEditor\n },\n on: {\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.text-editor-init').each(editorEl => {\n const dataset = $(editorEl).dataset();\n app.textEditor.create(extend({\n el: editorEl\n }, dataset || {}));\n });\n },\n tabBeforeRemove(tabEl) {\n $(tabEl).find('.text-editor-init').each(editorEl => {\n if (editorEl.f7TextEditor) editorEl.f7TextEditor.destroy();\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.text-editor-init').each(editorEl => {\n const dataset = $(editorEl).dataset();\n app.textEditor.create(extend({\n el: editorEl\n }, dataset || {}));\n });\n },\n pageBeforeRemove(page) {\n page.$el.find('.text-editor-init').each(editorEl => {\n if (editorEl.f7TextEditor) editorEl.f7TextEditor.destroy();\n });\n }\n },\n vnode: {\n 'text-editor-init': {\n insert(vnode) {\n const app = this;\n const editorEl = vnode.elm;\n const dataset = $(editorEl).dataset();\n app.textEditor.create(extend({\n el: editorEl\n }, dataset || {}));\n },\n destroy(vnode) {\n const editorEl = vnode.elm;\n if (editorEl.f7TextEditor) editorEl.f7TextEditor.destroy();\n }\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass PieChart extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const self = this;\n const defaults = extend({}, app.params.pieChart);\n\n // Extend defaults with modules params\n self.useModulesParams(defaults);\n self.params = extend(defaults, params);\n const {\n el\n } = self.params;\n if (!el) return self;\n const $el = $(el);\n if ($el.length === 0) return self;\n if ($el[0].f7PieChart) return $el[0].f7PieChart;\n extend(self, {\n app,\n $el,\n el: $el && $el[0],\n currentIndex: null,\n f7Tooltip: null\n });\n $el[0].f7PieChart = self;\n\n // Install Modules\n self.useModules();\n self.showTooltip = self.showTooltip.bind(this);\n self.hideTooltip = self.hideTooltip.bind(this);\n self.init();\n return self;\n }\n getSummValue() {\n const {\n datasets\n } = this.params;\n let summ = 0;\n datasets.map(d => d.value || 0).forEach(value => {\n summ += value;\n });\n return summ;\n }\n getPaths() {\n const {\n datasets,\n size\n } = this.params;\n const paths = [];\n let cumulativePercentage = 0;\n function getCoordinatesForPercentage(percentage) {\n const x = Math.cos(2 * Math.PI * percentage) * (size / 3);\n const y = Math.sin(2 * Math.PI * percentage) * (size / 3);\n return [x, y];\n }\n datasets.forEach(_ref => {\n let {\n value,\n label,\n color\n } = _ref;\n const percentage = value / this.getSummValue();\n const [startX, startY] = getCoordinatesForPercentage(cumulativePercentage);\n cumulativePercentage += percentage;\n const [endX, endY] = getCoordinatesForPercentage(cumulativePercentage);\n const largeArcFlag = percentage > 0.5 ? 1 : 0;\n const points = [`M ${startX} ${startY}`,\n // Move\n `A ${size / 3} ${size / 3} 0 ${largeArcFlag} 1 ${endX} ${endY}`,\n // Arc\n 'L 0 0' // Line\n ].join(' ');\n paths.push({\n points,\n label,\n color\n });\n });\n return paths;\n }\n formatTooltipText() {\n const {\n datasets\n } = this.params;\n const {\n currentIndex\n } = this;\n if (currentIndex === null) return '';\n const {\n value,\n label,\n color\n } = datasets[currentIndex];\n const percentage = value / this.getSummValue() * 100;\n const round = v => {\n if (parseInt(v, 10) === v) return v;\n return Math.round(v * 100) / 100;\n };\n if (this.params.formatTooltip) {\n return this.params.formatTooltip.call(this, {\n index: currentIndex,\n value,\n label,\n color,\n percentage\n });\n }\n const tooltipText = `${label ? `${label}: ` : ''}${round(value)} (${round(percentage)}%)`;\n return `\n \n ${tooltipText}\n
\n `;\n }\n setTooltip() {\n const self = this;\n const {\n currentIndex,\n el,\n app,\n params\n } = self;\n const {\n tooltip\n } = params;\n if (currentIndex === null && !self.f7Tooltip) return;\n if (!tooltip || !el) return;\n if (currentIndex !== null && !self.f7Tooltip) {\n self.f7Tooltip = app.tooltip.create({\n trigger: 'manual',\n containerEl: el,\n targetEl: el.querySelector(`path[data-index=\"${currentIndex}\"]`),\n text: self.formatTooltipText(),\n cssClass: 'pie-chart-tooltip'\n });\n self.f7Tooltip.show();\n return;\n }\n if (!self.f7Tooltip) return;\n if (currentIndex !== null) {\n self.f7Tooltip.setText(self.formatTooltipText());\n self.f7Tooltip.setTargetEl(el.querySelector(`path[data-index=\"${currentIndex}\"]`));\n self.f7Tooltip.show();\n } else {\n self.f7Tooltip.hide();\n }\n }\n render() {\n const self = this;\n const size = self.params.size;\n const paths = self.getPaths();\n return $jsx(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: size,\n viewBox: `-${size / 3} -${size / 3} ${size * 2 / 3} ${size * 2 / 3}`,\n style: \"transform: rotate(-90deg)\"\n }, paths.map((path, index) => $jsx(\"path\", {\n d: path.points,\n fill: path.color,\n \"data-index\": index\n })));\n }\n update(newParams) {\n if (newParams === void 0) {\n newParams = {};\n }\n const self = this;\n const {\n params\n } = self;\n Object.keys(newParams).forEach(param => {\n if (typeof newParams[param] !== 'undefined') {\n params[param] = newParams[param];\n }\n });\n if (self.$svgEl.length === 0) return self;\n self.$svgEl.remove();\n delete self.$svgEl.f7PieChart;\n const $svgEl = $(self.render()).eq(0);\n $svgEl.f7PieChart = self;\n extend(self, {\n $svgEl,\n svgEl: $svgEl && $svgEl[0]\n });\n self.$el.append($svgEl);\n return self;\n }\n setCurrentIndex(index) {\n const self = this;\n if (index === self.currentIndex) return;\n const {\n datasets\n } = self.params;\n self.currentIndex = index;\n self.$el.trigger('piechart:select', {\n index,\n dataset: datasets[index]\n });\n self.emit('local::select pieChartSelect', self, index, datasets[index]);\n }\n showTooltip(e) {\n const newIndex = parseInt(e.target.getAttribute('data-index'), 10);\n this.setCurrentIndex(newIndex);\n this.$svgEl.find('path').removeClass('pie-chart-hidden').forEach((el, index) => {\n if (index !== this.currentIndex) $(el).addClass('pie-chart-hidden');\n });\n this.setTooltip();\n }\n hideTooltip() {\n this.setCurrentIndex(null);\n this.$svgEl.find('path').removeClass('pie-chart-hidden');\n this.setTooltip();\n }\n init() {\n const self = this;\n const $svgEl = $(self.render()).eq(0);\n $svgEl.f7PieChart = self;\n extend(self, {\n $svgEl,\n svgEl: $svgEl && $svgEl[0]\n });\n self.$el.append($svgEl);\n self.$el.on('click mouseenter', 'path', self.showTooltip, true);\n self.$el.on('mouseleave', 'path', self.hideTooltip, true);\n return self;\n }\n destroy() {\n const self = this;\n if (!self.$el || self.destroyed) return;\n self.$el.trigger('piechart:beforedestroy');\n self.emit('local::beforeDestroy pieChartBeforeDestroy', self);\n self.$el.off('click mouseenter', 'path', self.showTooltip, true);\n self.$el.off('mouseleave', 'path', self.hideTooltip, true);\n self.$svgEl.remove();\n if (self.f7Tooltip && self.f7Tooltip.destroy) {\n self.f7Tooltip.destroy();\n }\n delete self.$el[0].f7PieChart;\n deleteProps(self);\n self.destroyed = true;\n }\n}\nexport default PieChart;", "import $ from '../../shared/dom7.js';\nimport PieChart from './pie-chart-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'pieChart',\n params: {\n pieChart: {\n el: null,\n datasets: [],\n size: 320,\n tooltip: false,\n formatTooltip: null\n }\n },\n create() {\n const app = this;\n app.pieChart = ConstructorMethods({\n defaultSelector: '.pie-chart',\n constructor: PieChart,\n app,\n domProp: 'f7PieChart'\n });\n app.pieChart.update = function update(el, newParams) {\n const $el = $(el);\n if ($el.length === 0) return undefined;\n const pieChart = app.pieChart.get(el);\n if (!pieChart) return undefined;\n pieChart.update(newParams);\n return pieChart;\n };\n }\n};", "import $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass AreaChart extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const self = this;\n const defaults = extend({}, app.params.areaChart);\n\n // Extend defaults with modules params\n self.useModulesParams(defaults);\n self.params = extend(defaults, params);\n const {\n el\n } = self.params;\n if (!el) return self;\n const $el = $(el);\n if ($el.length === 0) return self;\n if ($el[0].f7AreaChart) return $el[0].f7AreaChart;\n extend(self, {\n app,\n $el,\n el: $el && $el[0],\n currentIndex: null,\n hiddenDatasets: [],\n f7Tooltip: null,\n linesOffsets: null\n });\n $el[0].f7AreaChart = self;\n\n // Install Modules\n self.useModules();\n self.onMouseEnter = self.onMouseEnter.bind(self);\n self.onMouseMove = self.onMouseMove.bind(self);\n self.onMouseLeave = self.onMouseLeave.bind(self);\n self.onLegendClick = self.onLegendClick.bind(self);\n self.init();\n return self;\n }\n getVisibleLabels() {\n const {\n maxAxisLabels,\n axisLabels\n } = this.params;\n if (!maxAxisLabels || axisLabels.length <= maxAxisLabels) return axisLabels;\n const skipStep = Math.ceil(axisLabels.length / maxAxisLabels);\n const filtered = axisLabels.filter((label, index) => index % skipStep === 0);\n return filtered;\n }\n getSummValues() {\n const {\n datasets\n } = this.params;\n const {\n hiddenDatasets\n } = this;\n const summValues = [];\n datasets.filter((dataset, index) => !hiddenDatasets.includes(index)).forEach(_ref => {\n let {\n values\n } = _ref;\n values.forEach((value, valueIndex) => {\n if (!summValues[valueIndex]) summValues[valueIndex] = 0;\n summValues[valueIndex] += value;\n });\n });\n return summValues;\n }\n getChartData() {\n const {\n datasets,\n lineChart,\n width,\n height\n } = this.params;\n const {\n hiddenDatasets\n } = this;\n const data = [];\n if (!datasets.length) {\n return data;\n }\n const lastValues = datasets[0].values.map(() => 0);\n let maxValue = 0;\n if (lineChart) {\n datasets.filter((dataset, index) => !hiddenDatasets.includes(index)).forEach(_ref2 => {\n let {\n values\n } = _ref2;\n const datasetMaxValue = Math.max(...values);\n if (datasetMaxValue > maxValue) maxValue = datasetMaxValue;\n });\n } else {\n maxValue = Math.max(...this.getSummValues());\n }\n datasets.filter((dataset, index) => !hiddenDatasets.includes(index)).forEach(_ref3 => {\n let {\n label,\n values,\n color\n } = _ref3;\n const points = values.map((originalValue, valueIndex) => {\n lastValues[valueIndex] += originalValue;\n const value = lineChart ? originalValue : lastValues[valueIndex];\n const x = valueIndex / (values.length - 1) * width;\n const y = height - value / maxValue * height;\n if (lineChart) {\n return `${valueIndex === 0 ? 'M' : 'L'}${x},${y}`;\n }\n return `${x} ${y}`;\n });\n if (!lineChart) {\n points.push(`${width} ${height} 0 ${height}`);\n }\n data.push({\n label,\n points: points.join(' '),\n color\n });\n });\n return data.reverse();\n }\n getVerticalLines() {\n const {\n datasets,\n width\n } = this.params;\n const lines = [];\n if (!datasets.length) {\n return lines;\n }\n const values = datasets[0].values;\n values.forEach((value, valueIndex) => {\n const x = valueIndex / (values.length - 1) * width;\n lines.push(x);\n });\n return lines;\n }\n toggleDataset(index) {\n const {\n hiddenDatasets,\n params: {\n toggleDatasets\n }\n } = this;\n if (!toggleDatasets) return;\n if (hiddenDatasets.includes(index)) {\n hiddenDatasets.splice(hiddenDatasets.indexOf(index), 1);\n } else {\n hiddenDatasets.push(index);\n }\n if (this.$legendEl) {\n this.$legendEl.find('.area-chart-legend-item').removeClass('area-chart-legend-item-hidden');\n hiddenDatasets.forEach(i => {\n this.$legendEl.find(`.area-chart-legend-item[data-index=\"${i}\"]`).addClass('area-chart-legend-item-hidden');\n });\n }\n this.update({}, true);\n }\n formatAxisLabel(label) {\n const {\n formatAxisLabel\n } = this.params;\n if (formatAxisLabel) return formatAxisLabel.call(this, label);\n return label;\n }\n formatLegendLabel(label) {\n const {\n formatLegendLabel\n } = this.params;\n if (formatLegendLabel) return formatLegendLabel.call(this, label);\n return label;\n }\n calcLinesOffsets() {\n const lines = this.svgEl.querySelectorAll('line');\n this.linesOffsets = [];\n for (let i = 0; i < lines.length; i += 1) {\n this.linesOffsets.push(lines[i].getBoundingClientRect().left);\n }\n }\n formatTooltip() {\n const self = this;\n const {\n currentIndex,\n hiddenDatasets,\n params: {\n datasets,\n axisLabels,\n formatTooltip,\n formatTooltipTotal,\n formatTooltipAxisLabel,\n formatTooltipDataset\n }\n } = self;\n if (currentIndex === null) return '';\n let total = 0;\n const currentValues = datasets.filter((dataset, index) => !hiddenDatasets.includes(index)).map(dataset => ({\n color: dataset.color,\n label: dataset.label,\n value: dataset.values[currentIndex]\n }));\n currentValues.forEach(dataset => {\n total += dataset.value;\n });\n if (formatTooltip) {\n return formatTooltip({\n index: currentIndex,\n total,\n datasets: currentValues\n });\n }\n let labelText = formatTooltipAxisLabel ? formatTooltipAxisLabel.call(self, axisLabels[currentIndex]) : this.formatAxisLabel(axisLabels[currentIndex]);\n if (!labelText) labelText = '';\n const totalText = formatTooltipTotal ? formatTooltipTotal.call(self, total) : total;\n // prettier-ignore\n const datasetsText = currentValues.length > 0 ? `\n ` : '';\n // prettier-ignore\n return `\n ${labelText}
\n ${totalText}
\n ${datasetsText}\n `;\n }\n setTooltip() {\n const self = this;\n const {\n app,\n el,\n svgEl,\n hiddenDatasets,\n currentIndex,\n params: {\n tooltip,\n datasets\n }\n } = self;\n if (!tooltip) return;\n const hasVisibleDataSets = datasets.filter((dataset, index) => !hiddenDatasets.includes(index)).length > 0;\n if (!hasVisibleDataSets) {\n if (self.f7Tooltip && self.f7Tooltip.hide) self.f7Tooltip.hide();\n return;\n }\n if (currentIndex !== null && !self.f7Tooltip) {\n self.f7Tooltip = app.tooltip.create({\n trigger: 'manual',\n containerEl: el,\n targetEl: svgEl.querySelector(`line[data-index=\"${currentIndex}\"]`),\n text: self.formatTooltip(),\n cssClass: 'area-chart-tooltip'\n });\n if (self.f7Tooltip && self.f7Tooltip.show) {\n self.f7Tooltip.show();\n }\n return;\n }\n if (!self.f7Tooltip || !self.f7Tooltip.hide || !self.f7Tooltip.show) {\n return;\n }\n if (currentIndex !== null) {\n self.f7Tooltip.setText(self.formatTooltip());\n self.f7Tooltip.setTargetEl(svgEl.querySelector(`line[data-index=\"${currentIndex}\"]`));\n self.f7Tooltip.show();\n } else {\n self.f7Tooltip.hide();\n }\n }\n setCurrentIndex(index) {\n if (index === this.currentIndex) return;\n this.currentIndex = index;\n this.$el.trigger('areachart:select', {\n index\n });\n this.emit('local::select areaChartSelect', this, index);\n this.$svgEl.find('line').removeClass('area-chart-current-line');\n this.$svgEl.find(`line[data-index=\"${index}\"]`).addClass('area-chart-current-line');\n this.setTooltip();\n }\n onLegendClick(e) {\n const index = parseInt($(e.target).closest('.area-chart-legend-item').attr('data-index'), 10);\n this.toggleDataset(index);\n }\n onMouseEnter() {\n this.calcLinesOffsets();\n }\n onMouseMove(e) {\n const self = this;\n if (!self.linesOffsets) {\n self.calcLinesOffsets();\n }\n let currentLeft = e.pageX;\n if (typeof currentLeft === 'undefined') currentLeft = 0;\n const distances = self.linesOffsets.map(left => Math.abs(currentLeft - left));\n const minDistance = Math.min(...distances);\n const closestIndex = distances.indexOf(minDistance);\n self.setCurrentIndex(closestIndex);\n }\n onMouseLeave() {\n this.setCurrentIndex(null);\n }\n attachEvents() {\n const {\n svgEl,\n $el\n } = this;\n if (!svgEl) return;\n svgEl.addEventListener('mouseenter', this.onMouseEnter);\n svgEl.addEventListener('mousemove', this.onMouseMove);\n svgEl.addEventListener('mouseleave', this.onMouseLeave);\n $el.on('click', '.area-chart-legend-item', this.onLegendClick);\n }\n detachEvents() {\n const {\n svgEl,\n $el\n } = this;\n if (!svgEl) return;\n svgEl.removeEventListener('mouseenter', this.onMouseEnter);\n svgEl.removeEventListener('mousemove', this.onMouseMove);\n svgEl.removeEventListener('mouseleave', this.onMouseLeave);\n $el.off('click', '.area-chart-legend-item', this.onLegendClick);\n }\n render() {\n const self = this;\n const {\n lineChart,\n toggleDatasets,\n width,\n height,\n axis,\n axisLabels,\n legend,\n datasets\n } = self.params;\n const chartData = self.getChartData();\n const verticalLines = self.getVerticalLines();\n const visibleLegends = self.getVisibleLabels();\n const LegendItemTag = toggleDatasets ? 'button' : 'span';\n return $jsx(\"div\", null, $jsx(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: width,\n height: height,\n viewBox: `0 0 ${width} ${height}`,\n preserveAspectRatio: \"none\"\n }, chartData.map(data => lineChart ? $jsx(\"path\", {\n stroke: data.color,\n \"fill-rule\": \"evenodd\",\n d: data.points\n }) : $jsx(\"polygon\", {\n fill: data.color,\n \"fill-rule\": \"evenodd\",\n points: data.points\n })), verticalLines.map((line, index) => $jsx(\"line\", {\n \"data-index\": index,\n fill: \"#000\",\n x1: line,\n y1: 0,\n x2: line,\n y2: height\n }))), axis && $jsx(\"div\", {\n class: \"area-chart-axis\"\n }, axisLabels.map(label => $jsx(\"span\", null, visibleLegends.includes(label) && $jsx(\"span\", null, self.formatAxisLabel(label))))), legend && $jsx(\"div\", {\n class: \"area-chart-legend\"\n }, datasets.map((dataset, index) => $jsx(LegendItemTag, {\n \"data-index\": index,\n class: `area-chart-legend-item ${toggleDatasets ? 'area-chart-legend-button' : ''}`,\n _type: toggleDatasets ? 'button' : undefined\n }, $jsx(\"span\", {\n style: `background-color: ${dataset.color}`\n }), self.formatLegendLabel(dataset.label)))));\n }\n update(newParams, onlySvg) {\n if (newParams === void 0) {\n newParams = {};\n }\n if (onlySvg === void 0) {\n onlySvg = false;\n }\n const self = this;\n const {\n params\n } = self;\n Object.keys(newParams).forEach(param => {\n if (typeof newParams[param] !== 'undefined') {\n params[param] = newParams[param];\n }\n });\n if (self.$svgEl.length === 0) return self;\n self.detachEvents();\n self.$svgEl.remove();\n if (!onlySvg) {\n self.$axisEl.remove();\n self.$legendEl.remove();\n }\n const $rendered = $(self.render());\n const $svgEl = $rendered.find('svg');\n extend(self, {\n svgEl: $svgEl && $svgEl[0],\n $svgEl\n });\n if (!onlySvg) {\n const $axisEl = $rendered.find('.area-chart-axis');\n const $legendEl = $rendered.find('.area-chart-legend');\n extend(self, {\n $axisEl,\n $legendEl\n });\n self.$el.append($axisEl);\n self.$el.append($legendEl);\n }\n self.$el.prepend($svgEl);\n self.attachEvents();\n return self;\n }\n init() {\n const self = this;\n const $rendered = $(self.render());\n const $svgEl = $rendered.find('svg');\n const $axisEl = $rendered.find('.area-chart-axis');\n const $legendEl = $rendered.find('.area-chart-legend');\n extend(self, {\n svgEl: $svgEl && $svgEl[0],\n $svgEl,\n $axisEl,\n $legendEl\n });\n self.$el.append($svgEl);\n self.$el.append($axisEl);\n self.$el.append($legendEl);\n self.attachEvents();\n return self;\n }\n destroy() {\n const self = this;\n if (!self.$el || self.destroyed) return;\n self.$el.trigger('piechart:beforedestroy');\n self.emit('local::beforeDestroy areaChartBeforeDestroy', self);\n self.detachEvents();\n self.$svgEl.remove();\n self.$axisEl.remove();\n self.$legendEl.remove();\n if (self.f7Tooltip && self.f7Tooltip.destroy) {\n self.f7Tooltip.destroy();\n }\n delete self.$el[0].f7AreaChart;\n deleteProps(self);\n self.destroyed = true;\n }\n}\nexport default AreaChart;", "import $ from '../../shared/dom7.js';\nimport AreaChart from './area-chart-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'areaChart',\n params: {\n areaChart: {\n el: null,\n lineChart: false,\n datasets: [],\n axis: false,\n axisLabels: [],\n tooltip: false,\n legend: false,\n toggleDatasets: false,\n width: 640,\n height: 320,\n maxAxisLabels: 8,\n formatAxisLabel: null,\n formatLegendLabel: null,\n formatTooltip: null,\n formatTooltipAxisLabel: null,\n formatTooltipTotal: null,\n formatTooltipDataset: null\n }\n },\n create() {\n const app = this;\n app.areaChart = ConstructorMethods({\n defaultSelector: '.area-chart',\n constructor: AreaChart,\n app,\n domProp: 'f7AreaChart'\n });\n app.areaChart.update = function update(el, newParams) {\n const $el = $(el);\n if ($el.length === 0) return undefined;\n const areaChart = app.areaChart.get(el);\n if (!areaChart) return undefined;\n areaChart.update(newParams);\n return areaChart;\n };\n }\n};", "import { bindMethods } from '../../shared/utils.js';\nconst Breadcrumbs = {};\nexport default {\n name: 'breadrumbs',\n create() {\n const app = this;\n bindMethods(app, {\n breadrumbs: Breadcrumbs\n });\n }\n};", "export default {\n name: 'typography'\n};", "/**\n * Framework7 8.3.2\n * Full featured mobile HTML framework for building iOS & Android apps\n * https://framework7.io/\n *\n * Copyright 2014-2024 Vladimir Kharlampidi\n *\n * Released under the MIT License\n *\n * Released on: February 27, 2024\n */\n\nimport $ from './shared/dom7.js';\nimport Framework7 from './components/app/app-class.js';\nimport * as utils from './shared/utils.js';\nimport { getSupport } from './shared/get-support.js';\nimport { getDevice } from './shared/get-device.js';\nimport DeviceModule from './modules/device/device.js';\nimport SupportModule from './modules/support/support.js';\nimport UtilsModule from './modules/utils/utils.js';\nimport ResizeModule from './modules/resize/resize.js';\nimport TouchModule from './modules/touch/touch.js';\nimport ClicksModule from './modules/clicks/clicks.js';\nimport RouterModule from './modules/router/router.js';\nimport RouterComponentLoaderModule from './modules/router/component-loader.js';\nimport ComponentModule, { Component, $jsx } from './modules/component/component.js';\nimport HistoryModule from './modules/history/history.js';\nimport ServiceWorkerModule from './modules/service-worker/service-worker.js';\nimport StoreModule, { createStore } from './modules/store/store.js';\nimport Statusbar from './components/statusbar/statusbar.js';\nimport View from './components/view/view.js';\nimport Navbar from './components/navbar/navbar.js';\nimport Toolbar from './components/toolbar/toolbar.js';\nimport Subnavbar from './components/subnavbar/subnavbar.js';\nimport TouchRipple from './components/touch-ripple/touch-ripple.js';\nimport Modal from './components/modal/modal.js';\nimport Router from './modules/router/router-class.js';\nimport Dialog from './components/dialog/dialog.js';\nimport Popup from './components/popup/popup.js';\nimport LoginScreen from './components/login-screen/login-screen.js';\nimport Popover from './components/popover/popover.js';\nimport Actions from './components/actions/actions.js';\nimport Sheet from './components/sheet/sheet.js';\nimport Toast from './components/toast/toast.js';\nimport Preloader from './components/preloader/preloader.js';\nimport Progressbar from './components/progressbar/progressbar.js';\nimport Sortable from './components/sortable/sortable.js';\nimport Swipeout from './components/swipeout/swipeout.js';\nimport Accordion from './components/accordion/accordion.js';\nimport ContactsList from './components/contacts-list/contacts-list.js';\nimport VirtualList from './components/virtual-list/virtual-list.js';\nimport ListIndex from './components/list-index/list-index.js';\nimport Timeline from './components/timeline/timeline.js';\nimport Tabs from './components/tabs/tabs.js';\nimport Panel from './components/panel/panel.js';\nimport Card from './components/card/card.js';\nimport Chip from './components/chip/chip.js';\nimport Form from './components/form/form.js';\nimport Input from './components/input/input.js';\nimport Checkbox from './components/checkbox/checkbox.js';\nimport Radio from './components/radio/radio.js';\nimport Toggle from './components/toggle/toggle.js';\nimport Range from './components/range/range.js';\nimport Stepper from './components/stepper/stepper.js';\nimport SmartSelect from './components/smart-select/smart-select.js';\nimport Grid from './components/grid/grid.js';\nimport Calendar from './components/calendar/calendar.js';\nimport Picker from './components/picker/picker.js';\nimport InfiniteScroll from './components/infinite-scroll/infinite-scroll.js';\nimport PullToRefresh from './components/pull-to-refresh/pull-to-refresh.js';\nimport DataTable from './components/data-table/data-table.js';\nimport Fab from './components/fab/fab.js';\nimport Searchbar from './components/searchbar/searchbar.js';\nimport Messages from './components/messages/messages.js';\nimport Messagebar from './components/messagebar/messagebar.js';\nimport Swiper from './components/swiper/swiper.js';\nimport PhotoBrowser from './components/photo-browser/photo-browser.js';\nimport Notification from './components/notification/notification.js';\nimport Autocomplete from './components/autocomplete/autocomplete.js';\nimport Tooltip from './components/tooltip/tooltip.js';\nimport Gauge from './components/gauge/gauge.js';\nimport Skeleton from './components/skeleton/skeleton.js';\nimport ColorPicker from './components/color-picker/color-picker.js';\nimport Treeview from './components/treeview/treeview.js';\nimport TextEditor from './components/text-editor/text-editor.js';\nimport PieChart from './components/pie-chart/pie-chart.js';\nimport AreaChart from './components/area-chart/area-chart.js';\nimport Breadcrumbs from './components/breadcrumbs/breadcrumbs.js';\nimport Typography from './components/typography/typography.js';\nRouter.use([RouterComponentLoaderModule]);\nFramework7.use([DeviceModule, SupportModule, UtilsModule, ResizeModule, TouchModule, ClicksModule, RouterModule, HistoryModule, ComponentModule, ServiceWorkerModule, StoreModule, Statusbar, View, Navbar, Toolbar, Subnavbar, TouchRipple, Modal, Dialog, Popup, LoginScreen, Popover, Actions, Sheet, Toast, Preloader, Progressbar, Sortable, Swipeout, Accordion, ContactsList, VirtualList, ListIndex, Timeline, Tabs, Panel, Card, Chip, Form, Input, Checkbox, Radio, Toggle, Range, Stepper, SmartSelect, Grid, Calendar, Picker, InfiniteScroll, PullToRefresh, DataTable, Fab, Searchbar, Messages, Messagebar, Swiper, PhotoBrowser, Notification, Autocomplete, Tooltip, Gauge, Skeleton, ColorPicker, Treeview, TextEditor, PieChart, AreaChart, Breadcrumbs, Typography]);\nexport { Component, $jsx, $ as Dom7, utils, getDevice, getSupport, createStore };\nexport default Framework7;\n", "/**\n * Framework7 8.3.2\n * Full featured mobile HTML framework for building iOS & Android apps\n * https://framework7.io/\n *\n * Copyright 2014-2024 Vladimir Kharlampidi\n *\n * Released under the MIT License\n *\n * Released on: February 27, 2024\n */\n\nimport $ from './shared/dom7.js';\nimport Framework7 from './components/app/app-class.js';\nimport * as utils from './shared/utils.js';\nimport { getSupport } from './shared/get-support.js';\nimport { getDevice } from './shared/get-device.js';\nimport DeviceModule from './modules/device/device.js';\nimport SupportModule from './modules/support/support.js';\nimport UtilsModule from './modules/utils/utils.js';\nimport ResizeModule from './modules/resize/resize.js';\nimport TouchModule from './modules/touch/touch.js';\nimport ClicksModule from './modules/clicks/clicks.js';\nimport RouterModule from './modules/router/router.js';\nimport RouterComponentLoaderModule from './modules/router/component-loader.js';\nimport ComponentModule, { Component, $jsx } from './modules/component/component.js';\nimport HistoryModule from './modules/history/history.js';\nimport ServiceWorkerModule from './modules/service-worker/service-worker.js';\nimport StoreModule, { createStore } from './modules/store/store.js';\nimport Statusbar from './components/statusbar/statusbar.js';\nimport View from './components/view/view.js';\nimport Navbar from './components/navbar/navbar.js';\nimport Toolbar from './components/toolbar/toolbar.js';\nimport Subnavbar from './components/subnavbar/subnavbar.js';\nimport TouchRipple from './components/touch-ripple/touch-ripple.js';\nimport Modal from './components/modal/modal.js';\nimport Router from './modules/router/router-class.js';\nRouter.use([RouterComponentLoaderModule]);\nFramework7.use([DeviceModule, SupportModule, UtilsModule, ResizeModule, TouchModule, ClicksModule, RouterModule, HistoryModule, ComponentModule, ServiceWorkerModule, StoreModule, Statusbar, View, Navbar, Toolbar, Subnavbar, TouchRipple, Modal]);\nexport { Component, $jsx, $ as Dom7, utils, getDevice, getSupport, createStore };\nexport default Framework7;\n", "import { createStore } from 'framework7';\n\nexport const setConfig = () => {\n // collect all data elements stored in body\n let config = $(document).find(\"script[data-for='app']\");\n config = JSON.parse(config.html());\n\n // always erase existing root value just in case the user changes the root.\n // This may be harmful\n config.el = \"#app\";\n\n // check if the app is intended to be a PWA\n let isPWA = $('body').attr('data-pwa') === \"true\";\n\n if (isPWA) {\n config.serviceWorker = {\n path: window.location.pathname + \"service-worker.js\",\n scope: window.location.pathname\n };\n }\n\n // Widgets cache\n config.store = createStore({\n state: {\n // any other widget type to cache ...\n popovers: [],\n tooltips: [],\n actions: [],\n preloaders: [],\n // For some widgets, we must match the widget name\n // that's why no 's' at the end even if there\n // are multiple gauges ...\n gauge: [],\n popup: [],\n swiper: [],\n searchbar: [],\n listIndex: [],\n photoBrowser: [],\n // Input elements: TBD??\n },\n actions: {\n //toggleDarkTheme: function() {\n // let self = this;\n // let $html = self.$(\"html\");\n // $html.toggleClass(\"theme-dark\");\n //}\n }\n });\n\n return config;\n};\n", "// Style for touch plugin\nconst setTouchStyle = config => {\n if (config.hasOwnProperty(\"touch\")) {\n if (config.touch.tapHold) {\n $(\"')[0];\n }\n if (componentString.indexOf('')[0];\n }\n\n // Parse Script\n let scriptContent;\n if (componentString.indexOf('')[0].trim();\n } else {\n scriptContent = 'return () => {return $render}';\n }\n if (!scriptContent || !scriptContent.trim()) scriptContent = 'return () => {return $render}';\n\n // Parse Template\n if (template) {\n scriptContent = scriptContent.replace('$render', `function ($$ctx) {\n var $ = $$ctx.$$;\n var $h = $$ctx.$h;\n var $root = $$ctx.$root;\n var $f7 = $$ctx.$f7;\n var $f7route = $$ctx.$f7route;\n var $f7router = $$ctx.$f7router;\n var $theme = $$ctx.$theme;\n var $update = $$ctx.$update;\n var $store = $$ctx.$store;\n var $ref = $$ctx.$ref;\n var $useState = $$ctx.$useState;\n\n return $h\\`${template}\\`\n }\n `).replace(/export default/g, 'return');\n }\n\n // Execute Script\n scriptContent = `window.${callbackCreateName} = function () {${scriptContent}}`;\n\n // Insert Script El\n const scriptEl = document.createElement('script');\n scriptEl.innerHTML = scriptContent;\n $('head').append(scriptEl);\n const component = window[callbackCreateName]();\n\n // Remove Script El\n $(scriptEl).remove();\n window[callbackCreateName] = null;\n delete window[callbackCreateName];\n\n // Assign Style\n if (style) {\n component.style = style;\n }\n\n // Component ID\n component.id = componentId;\n return component;\n}\nexport default parseComponent;", "import Component from './component-class.js';\nimport parseComponent from './parse-component.js';\nimport customComponents from './custom-components.js';\nimport $jsx from './$jsx.js';\nfunction registerComponent(tagName, component) {\n customComponents[tagName] = component;\n}\nfunction unregisterComponent(tagName) {\n delete customComponents[tagName];\n}\nexport { Component, $jsx };\nexport default {\n name: 'component',\n static: {\n Component,\n parseComponent,\n registerComponent,\n unregisterComponent\n },\n create() {\n const app = this;\n app.component = {\n registerComponent,\n unregisterComponent,\n parse(componentString) {\n return parseComponent(componentString);\n },\n create(component, props, _ref) {\n let {\n root,\n el,\n context,\n children\n } = _ref;\n return new Component(app, component, props, {\n root,\n el,\n context,\n children\n });\n }\n };\n }\n};", "import History from '../../shared/history.js';\nexport default {\n name: 'history',\n static: {\n history: History\n },\n on: {\n init() {\n History.init(this);\n }\n }\n};", "import { getWindow } from 'ssr-window';\nimport { extend } from '../../shared/utils.js';\nconst SW = {\n registrations: [],\n register(path, scope) {\n const app = this;\n const window = getWindow();\n if (!('serviceWorker' in window.navigator) || !app.serviceWorker.container) {\n return new Promise((resolve, reject) => {\n reject(new Error('Service worker is not supported'));\n });\n }\n return new Promise((resolve, reject) => {\n app.serviceWorker.container.register(path, scope ? {\n scope\n } : {}).then(reg => {\n SW.registrations.push(reg);\n app.emit('serviceWorkerRegisterSuccess', reg);\n resolve(reg);\n }).catch(error => {\n app.emit('serviceWorkerRegisterError', error);\n reject(error);\n });\n });\n },\n unregister(registration) {\n const app = this;\n const window = getWindow();\n if (!('serviceWorker' in window.navigator) || !app.serviceWorker.container) {\n return new Promise((resolve, reject) => {\n reject(new Error('Service worker is not supported'));\n });\n }\n let registrations;\n if (!registration) registrations = SW.registrations;else if (Array.isArray(registration)) registrations = registration;else registrations = [registration];\n return Promise.all(registrations.map(reg => new Promise((resolve, reject) => {\n reg.unregister().then(() => {\n if (SW.registrations.indexOf(reg) >= 0) {\n SW.registrations.splice(SW.registrations.indexOf(reg), 1);\n }\n app.emit('serviceWorkerUnregisterSuccess', reg);\n resolve();\n }).catch(error => {\n app.emit('serviceWorkerUnregisterError', reg, error);\n reject(error);\n });\n })));\n }\n};\nexport default {\n name: 'sw',\n params: {\n serviceWorker: {\n path: undefined,\n scope: undefined\n }\n },\n create() {\n const app = this;\n const window = getWindow();\n extend(app, {\n serviceWorker: {\n container: 'serviceWorker' in window.navigator ? window.navigator.serviceWorker : undefined,\n registrations: SW.registrations,\n register: SW.register.bind(app),\n unregister: SW.unregister.bind(app)\n }\n });\n },\n on: {\n init() {\n const window = getWindow();\n if (!('serviceWorker' in window.navigator)) return;\n const app = this;\n if (app.device.cordova || window.Capacitor && window.Capacitor.isNative) return;\n if (!app.serviceWorker.container) return;\n const paths = app.params.serviceWorker.path;\n const scope = app.params.serviceWorker.scope;\n if (!paths || Array.isArray(paths) && !paths.length) return;\n const toRegister = Array.isArray(paths) ? paths : [paths];\n toRegister.forEach(path => {\n app.serviceWorker.register(path, scope);\n });\n }\n }\n};", "/* eslint-disable no-underscore-dangle */\nimport { extend } from '../../shared/utils.js';\nfunction createStore(storeParams) {\n if (storeParams === void 0) {\n storeParams = {};\n }\n const store = {\n __store: true\n };\n const originalState = {\n ...(storeParams.state || {})\n };\n const actions = {\n ...(storeParams.actions || {})\n };\n const getters = {\n ...(storeParams.getters || {})\n };\n const state = extend({}, originalState);\n let propsQueue = [];\n const gettersDependencies = {};\n const gettersCallbacks = {};\n Object.keys(getters).forEach(getterKey => {\n gettersDependencies[getterKey] = [];\n gettersCallbacks[getterKey] = [];\n });\n const getGetterValue = getterKey => {\n return getters[getterKey]({\n state: store.state\n });\n };\n const addGetterDependencies = (getterKey, deps) => {\n if (!gettersDependencies[getterKey]) gettersDependencies[getterKey] = [];\n deps.forEach(dep => {\n if (gettersDependencies[getterKey].indexOf(dep) < 0) {\n gettersDependencies[getterKey].push(dep);\n }\n });\n };\n const addGetterCallback = (getterKey, callback) => {\n if (!gettersCallbacks[getterKey]) gettersCallbacks[getterKey] = [];\n gettersCallbacks[getterKey].push(callback);\n };\n const runGetterCallbacks = stateKey => {\n const keys = Object.keys(gettersDependencies).filter(getterKey => {\n return gettersDependencies[getterKey].indexOf(stateKey) >= 0;\n });\n keys.forEach(getterKey => {\n if (!gettersCallbacks[getterKey] || !gettersCallbacks[getterKey].length) return;\n gettersCallbacks[getterKey].forEach(callback => {\n callback(getGetterValue(getterKey));\n });\n });\n };\n const removeGetterCallback = callback => {\n Object.keys(gettersCallbacks).forEach(stateKey => {\n const callbacks = gettersCallbacks[stateKey];\n if (callbacks.indexOf(callback) >= 0) {\n callbacks.splice(callbacks.indexOf(callback), 1);\n }\n });\n };\n\n // eslint-disable-next-line\n store.__removeCallback = callback => {\n removeGetterCallback(callback);\n };\n const getterValue = function (getterKey, addCallback) {\n if (addCallback === void 0) {\n addCallback = true;\n }\n if (getterKey === 'constructor') return undefined;\n propsQueue = [];\n const value = getGetterValue(getterKey);\n addGetterDependencies(getterKey, propsQueue);\n const onUpdated = callback => {\n addGetterCallback(getterKey, callback);\n };\n const obj = {\n value,\n onUpdated\n };\n if (!addCallback) {\n return obj;\n }\n const callback = v => {\n obj.value = v;\n };\n obj.__callback = callback;\n addGetterCallback(getterKey, callback);\n // eslint-disable-next-line\n return obj;\n };\n store.state = new Proxy(state, {\n set: (target, prop, value) => {\n target[prop] = value;\n runGetterCallbacks(prop);\n return true;\n },\n get: (target, prop) => {\n propsQueue.push(prop);\n return target[prop];\n }\n });\n store.getters = new Proxy(getters, {\n set: () => false,\n get: (target, prop) => {\n if (!target[prop]) {\n return undefined;\n }\n return getterValue(prop, true);\n }\n });\n store._gettersPlain = new Proxy(getters, {\n set: () => false,\n get: (target, prop) => {\n if (!target[prop]) {\n return undefined;\n }\n return getterValue(prop, false);\n }\n });\n store.dispatch = (actionName, data) => {\n return new Promise((resolve, reject) => {\n if (!actions[actionName]) {\n reject();\n throw new Error(`Framework7: Store action \"${actionName}\" is not found`);\n }\n const result = actions[actionName]({\n state: store.state,\n dispatch: store.dispatch\n }, data);\n resolve(result);\n });\n };\n return store;\n}\nexport default createStore;", "import createStore from './create-store.js';\nexport { createStore };\nexport default {\n name: 'store',\n static: {\n createStore\n },\n proto: {\n createStore\n }\n};", "import { getWindow } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { bindMethods } from '../../shared/utils.js';\nimport { getDevice } from '../../shared/get-device.js';\nconst isCapacitor = () => {\n const window = getWindow();\n return window.Capacitor && window.Capacitor.isNative && window.Capacitor.Plugins && window.Capacitor.Plugins.StatusBar;\n};\nconst Statusbar = {\n hide() {\n const window = getWindow();\n const device = getDevice();\n if (device.cordova && window.StatusBar) {\n window.StatusBar.hide();\n }\n if (isCapacitor()) {\n window.Capacitor.Plugins.StatusBar.hide();\n }\n },\n show() {\n const window = getWindow();\n const device = getDevice();\n if (device.cordova && window.StatusBar) {\n window.StatusBar.show();\n }\n if (isCapacitor()) {\n window.Capacitor.Plugins.StatusBar.show();\n }\n },\n onClick() {\n const app = this;\n let pageContent;\n if ($('.popup.modal-in').length > 0) {\n // Check for opened popup\n pageContent = $('.popup.modal-in').find('.page:not(.page-previous):not(.page-next):not(.cached)').find('.page-content');\n } else if ($('.panel.panel-in').length > 0) {\n // Check for opened panel\n pageContent = $('.panel.panel-in').find('.page:not(.page-previous):not(.page-next):not(.cached)').find('.page-content');\n } else if ($('.views > .view.tab-active').length > 0) {\n // View in tab bar app layout\n pageContent = $('.views > .view.tab-active').find('.page:not(.page-previous):not(.page-next):not(.cached)').find('.page-content');\n } else if ($('.views').length > 0) {\n pageContent = $('.views').find('.page:not(.page-previous):not(.page-next):not(.cached)').find('.page-content');\n } else {\n pageContent = app.$el.children('.view').find('.page:not(.page-previous):not(.page-next):not(.cached)').find('.page-content');\n }\n if (pageContent && pageContent.length > 0) {\n // Check for tab\n if (pageContent.hasClass('tab')) {\n pageContent = pageContent.parent('.tabs').children('.page-content.tab-active');\n }\n if (pageContent.length > 0) pageContent.scrollTop(0, 300);\n }\n },\n setTextColor(color) {\n const window = getWindow();\n const device = getDevice();\n if (device.cordova && window.StatusBar) {\n if (color === 'white') {\n window.StatusBar.styleLightContent();\n } else {\n window.StatusBar.styleDefault();\n }\n }\n if (isCapacitor()) {\n if (color === 'white') {\n window.Capacitor.Plugins.StatusBar.setStyle({\n style: 'DARK'\n });\n } else {\n window.Capacitor.Plugins.StatusBar.setStyle({\n style: 'LIGHT'\n });\n }\n }\n },\n setBackgroundColor(color) {\n const window = getWindow();\n const device = getDevice();\n if (device.cordova && window.StatusBar) {\n window.StatusBar.backgroundColorByHexString(color);\n }\n if (isCapacitor()) {\n window.Capacitor.Plugins.StatusBar.setBackgroundColor({\n color\n });\n }\n },\n isVisible() {\n const window = getWindow();\n const device = getDevice();\n return new Promise(resolve => {\n if (device.cordova && window.StatusBar) {\n resolve(window.StatusBar.isVisible);\n }\n if (isCapacitor()) {\n window.Capacitor.Plugins.StatusBar.getInfo().then(info => {\n resolve(info.visible);\n });\n }\n resolve(false);\n });\n },\n overlaysWebView(overlays) {\n if (overlays === void 0) {\n overlays = true;\n }\n const window = getWindow();\n const device = getDevice();\n if (device.cordova && window.StatusBar) {\n window.StatusBar.overlaysWebView(overlays);\n }\n if (isCapacitor()) {\n window.Capacitor.Plugins.StatusBar.setOverlaysWebView({\n overlay: overlays\n });\n }\n },\n init() {\n const app = this;\n const window = getWindow();\n const device = getDevice();\n const params = app.params.statusbar;\n if (!params.enabled) return;\n const isCordova = device.cordova && window.StatusBar;\n const isCap = isCapacitor();\n if (isCordova || isCap) {\n if (params.scrollTopOnClick) {\n $(window).on('statusTap', Statusbar.onClick.bind(app));\n }\n if (device.ios) {\n if (params.iosOverlaysWebView) {\n Statusbar.overlaysWebView(true);\n } else {\n Statusbar.overlaysWebView(false);\n }\n if (params.iosTextColor === 'white') {\n Statusbar.setTextColor('white');\n } else {\n Statusbar.setTextColor('black');\n }\n }\n if (device.android) {\n if (params.androidOverlaysWebView) {\n Statusbar.overlaysWebView(true);\n } else {\n Statusbar.overlaysWebView(false);\n }\n if (params.androidTextColor === 'white') {\n Statusbar.setTextColor('white');\n } else {\n Statusbar.setTextColor('black');\n }\n }\n }\n if (params.iosBackgroundColor && device.ios) {\n Statusbar.setBackgroundColor(params.iosBackgroundColor);\n }\n if (params.androidBackgroundColor && device.android) {\n Statusbar.setBackgroundColor(params.androidBackgroundColor);\n }\n }\n};\nexport default {\n name: 'statusbar',\n params: {\n statusbar: {\n enabled: true,\n scrollTopOnClick: true,\n iosOverlaysWebView: true,\n iosTextColor: 'black',\n iosBackgroundColor: null,\n androidOverlaysWebView: false,\n androidTextColor: 'black',\n androidBackgroundColor: null\n }\n },\n create() {\n const app = this;\n bindMethods(app, {\n statusbar: Statusbar\n });\n },\n on: {\n init() {\n const app = this;\n Statusbar.init.call(app);\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nimport View from './view-class.js';\nfunction getCurrentView(app) {\n const $popoverView = $('.popover.modal-in .view');\n const $popupView = $('.popup.modal-in .view');\n const $panelView = $('.panel.panel-in .view');\n let $viewsEl = $('.views');\n if ($viewsEl.length === 0) $viewsEl = app.$el;\n // Find active view as tab\n let $viewEl = $viewsEl.children('.view');\n if ($viewEl.length === 0) {\n $viewEl = $viewsEl.children('.tabs').children('.view');\n }\n // Propably in tabs or split view\n if ($viewEl.length > 1) {\n if ($viewEl.hasClass('tab')) {\n // Tabs\n $viewEl = $viewsEl.children('.view.tab-active');\n if ($viewEl.length === 0) {\n $viewEl = $viewsEl.children('.tabs').children('.view.tab-active');\n }\n } else {\n // Split View, leave appView intact\n }\n }\n if ($popoverView.length > 0 && $popoverView[0].f7View) return $popoverView[0].f7View;\n if ($popupView.length > 0 && $popupView[0].f7View) return $popupView[0].f7View;\n if ($panelView.length > 0 && $panelView[0].f7View) return $panelView[0].f7View;\n if ($viewEl.length > 0) {\n if ($viewEl.length === 1 && $viewEl[0].f7View) return $viewEl[0].f7View;\n if ($viewEl.length > 1) {\n return app.views.main;\n }\n }\n return undefined;\n}\nexport default {\n name: 'view',\n params: {\n view: {\n init: true,\n initRouterOnTabShow: false,\n name: undefined,\n main: false,\n router: true,\n linksView: null,\n xhrCache: true,\n xhrCacheIgnore: [],\n xhrCacheIgnoreGetParameters: false,\n xhrCacheDuration: 1000 * 60 * 10,\n // Ten minutes\n componentCache: true,\n preloadPreviousPage: true,\n allowDuplicateUrls: false,\n reloadPages: false,\n reloadDetail: false,\n masterDetailBreakpoint: 0,\n masterDetailResizable: false,\n removeElements: true,\n removeElementsWithTimeout: false,\n removeElementsTimeout: 0,\n restoreScrollTopOnBack: true,\n unloadTabContent: true,\n passRouteQueryToRequest: true,\n passRouteParamsToRequest: false,\n loadInitialPage: true,\n // Swipe Back\n iosSwipeBack: true,\n iosSwipeBackAnimateShadow: true,\n iosSwipeBackAnimateOpacity: true,\n iosSwipeBackActiveArea: 30,\n iosSwipeBackThreshold: 0,\n mdSwipeBack: false,\n mdSwipeBackAnimateShadow: true,\n mdSwipeBackAnimateOpacity: false,\n mdSwipeBackActiveArea: 30,\n mdSwipeBackThreshold: 0,\n // Push State\n browserHistory: false,\n browserHistoryRoot: undefined,\n browserHistoryAnimate: true,\n browserHistoryAnimateOnLoad: false,\n browserHistorySeparator: '#!',\n browserHistoryOnLoad: true,\n browserHistoryInitialMatch: false,\n browserHistoryStoreHistory: true,\n browserHistoryTabs: 'replace',\n // Animate Pages\n animate: true,\n // iOS Dynamic Navbar\n iosDynamicNavbar: true,\n // Animate iOS Navbar Back Icon\n iosAnimateNavbarBackIcon: true,\n // Delays\n iosPageLoadDelay: 0,\n mdPageLoadDelay: 0,\n // Routes hooks\n routesBeforeEnter: null,\n routesBeforeLeave: null\n }\n },\n static: {\n View\n },\n create() {\n const app = this;\n extend(app, {\n views: extend([], {\n create(el, params) {\n return new View(app, el, params);\n },\n get(viewEl) {\n const $viewEl = $(viewEl);\n if ($viewEl.length && $viewEl[0].f7View) return $viewEl[0].f7View;\n return undefined;\n }\n })\n });\n Object.defineProperty(app.views, 'current', {\n enumerable: true,\n configurable: true,\n get() {\n return getCurrentView(app);\n }\n });\n // Alias\n app.view = app.views;\n },\n on: {\n init() {\n const app = this;\n $('.view-init').each(viewEl => {\n if (viewEl.f7View) return;\n const viewParams = $(viewEl).dataset();\n app.views.create(viewEl, viewParams);\n });\n },\n 'modalOpen panelOpen': function onOpen(instance) {\n const app = this;\n instance.$el.find('.view-init').each(viewEl => {\n if (viewEl.f7View) return;\n const viewParams = $(viewEl).dataset();\n app.views.create(viewEl, viewParams);\n });\n },\n 'modalBeforeDestroy panelBeforeDestroy': function onClose(instance) {\n if (!instance || !instance.$el) return;\n instance.$el.find('.view-init').each(viewEl => {\n const view = viewEl.f7View;\n if (!view) return;\n view.destroy();\n });\n }\n },\n vnode: {\n 'view-init': {\n insert(vnode) {\n const app = this;\n const viewEl = vnode.elm;\n if (viewEl.f7View) return;\n const viewParams = $(viewEl).dataset();\n app.views.create(viewEl, viewParams);\n },\n destroy(vnode) {\n const viewEl = vnode.elm;\n const view = viewEl.f7View;\n if (!view) return;\n view.destroy();\n }\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { bindMethods } from '../../shared/utils.js';\nimport { getSupport } from '../../shared/get-support.js';\nconst Navbar = {\n size(el) {\n const app = this;\n let $el = $(el);\n if ($el.hasClass('navbars')) {\n $el = $el.children('.navbar').each(navbarEl => {\n app.navbar.size(navbarEl);\n });\n return;\n }\n const $innerEl = $el.children('.navbar-inner');\n if (!$innerEl.length) return;\n const needCenterTitle = $innerEl.hasClass('navbar-inner-centered-title') || app.params.navbar[`${app.theme}CenterTitle`];\n const needLeftTitle = app.theme === 'ios' && !app.params.navbar[`${app.theme}CenterTitle`];\n if (!needCenterTitle && !needLeftTitle) return;\n if ($el.parents('.tab:not(.tab-active)').length > 0 || $el.parents('.popup:not(.modal-in)').length > 0) {\n return;\n }\n if (app.theme !== 'ios' && app.params.navbar[`${app.theme}CenterTitle`]) {\n $innerEl.addClass('navbar-inner-centered-title');\n }\n if (app.theme === 'ios' && !app.params.navbar.iosCenterTitle) {\n $innerEl.addClass('navbar-inner-left-title');\n }\n const $viewEl = $el.parents('.view').eq(0);\n const left = app.rtl ? $innerEl.children('.right') : $innerEl.children('.left');\n const right = app.rtl ? $innerEl.children('.left') : $innerEl.children('.right');\n const title = $innerEl.children('.title');\n const subnavbar = $innerEl.children('.subnavbar');\n const noLeft = left.length === 0;\n const noRight = right.length === 0;\n const leftWidth = noLeft ? 0 : left.outerWidth(true);\n const rightWidth = noRight ? 0 : right.outerWidth(true);\n const titleWidth = title.outerWidth(true);\n const navbarStyles = $innerEl.styles();\n const navbarWidth = $innerEl[0].offsetWidth;\n const navbarInnerWidth = navbarWidth - parseInt(navbarStyles.paddingLeft, 10) - parseInt(navbarStyles.paddingRight, 10);\n const isPrevious = $el.hasClass('navbar-previous');\n const sliding = $innerEl.hasClass('sliding');\n let router;\n let dynamicNavbar;\n if ($viewEl.length > 0 && $viewEl[0].f7View) {\n router = $viewEl[0].f7View.router;\n dynamicNavbar = router && router.dynamicNavbar;\n }\n let currLeft;\n let diff;\n if (noRight) {\n currLeft = navbarInnerWidth - titleWidth;\n }\n if (noLeft) {\n currLeft = 0;\n }\n if (!noLeft && !noRight) {\n currLeft = (navbarInnerWidth - rightWidth - titleWidth + leftWidth) / 2;\n }\n let requiredLeft = (navbarInnerWidth - titleWidth) / 2;\n if (navbarInnerWidth - leftWidth - rightWidth > titleWidth) {\n if (requiredLeft < leftWidth) {\n requiredLeft = leftWidth;\n }\n if (requiredLeft + titleWidth > navbarInnerWidth - rightWidth) {\n requiredLeft = navbarInnerWidth - rightWidth - titleWidth;\n }\n diff = requiredLeft - currLeft;\n } else {\n diff = 0;\n }\n\n // RTL inverter\n const inverter = app.rtl ? -1 : 1;\n if (dynamicNavbar && app.theme === 'ios') {\n if (title.hasClass('sliding') || title.length > 0 && sliding) {\n let titleLeftOffset = -(currLeft + diff) * inverter;\n const titleRightOffset = (navbarInnerWidth - currLeft - diff - titleWidth) * inverter;\n if (isPrevious) {\n if (router && router.params.iosAnimateNavbarBackIcon) {\n const activeNavbarBackLink = $el.parent().find('.navbar-current').children('.left.sliding').find('.back .icon ~ span');\n if (activeNavbarBackLink.length > 0) {\n titleLeftOffset += activeNavbarBackLink[0].offsetLeft;\n }\n }\n }\n title[0].f7NavbarLeftOffset = titleLeftOffset;\n title[0].f7NavbarRightOffset = titleRightOffset;\n }\n if (!noLeft && (left.hasClass('sliding') || sliding)) {\n if (app.rtl) {\n left[0].f7NavbarLeftOffset = -(navbarInnerWidth - left[0].offsetWidth) / 2 * inverter;\n left[0].f7NavbarRightOffset = leftWidth * inverter;\n } else {\n left[0].f7NavbarLeftOffset = -leftWidth;\n left[0].f7NavbarRightOffset = (navbarInnerWidth - left[0].offsetWidth) / 2;\n if (router && router.params.iosAnimateNavbarBackIcon && left.find('.back .icon').length > 0) {\n if (left.find('.back .icon ~ span').length) {\n const leftOffset = left[0].f7NavbarLeftOffset;\n const rightOffset = left[0].f7NavbarRightOffset;\n left[0].f7NavbarLeftOffset = 0;\n left[0].f7NavbarRightOffset = 0;\n left.find('.back .icon ~ span')[0].f7NavbarLeftOffset = leftOffset;\n left.find('.back .icon ~ span')[0].f7NavbarRightOffset = rightOffset - left.find('.back .icon')[0].offsetWidth;\n }\n }\n }\n }\n if (!noRight && (right.hasClass('sliding') || sliding)) {\n if (app.rtl) {\n right[0].f7NavbarLeftOffset = -rightWidth * inverter;\n right[0].f7NavbarRightOffset = (navbarInnerWidth - right[0].offsetWidth) / 2 * inverter;\n } else {\n right[0].f7NavbarLeftOffset = -(navbarInnerWidth - right[0].offsetWidth) / 2;\n right[0].f7NavbarRightOffset = rightWidth;\n }\n }\n if (subnavbar.length && (subnavbar.hasClass('sliding') || sliding)) {\n subnavbar[0].f7NavbarLeftOffset = app.rtl ? subnavbar[0].offsetWidth : -subnavbar[0].offsetWidth;\n subnavbar[0].f7NavbarRightOffset = -subnavbar[0].f7NavbarLeftOffset;\n }\n }\n\n // Center title\n if (needCenterTitle) {\n let titleLeft = diff;\n if (app.rtl && noLeft && noRight && title.length > 0) titleLeft = -titleLeft;\n title.css({\n left: `${titleLeft}px`\n });\n }\n },\n hide(el, animate, hideStatusbar, hideOnlyCurrent) {\n if (animate === void 0) {\n animate = true;\n }\n if (hideStatusbar === void 0) {\n hideStatusbar = false;\n }\n if (hideOnlyCurrent === void 0) {\n hideOnlyCurrent = false;\n }\n const app = this;\n let $el = $(el);\n const isDynamic = $el.hasClass('navbar') && $el.parent('.navbars').length && !hideOnlyCurrent;\n if (isDynamic) $el = $el.parents('.navbars');\n if (!$el.length) return;\n if ($el.hasClass('navbar-hidden')) return;\n let className = `navbar-hidden${animate ? ' navbar-transitioning' : ''}`;\n const currentIsLarge = isDynamic ? $el.find('.navbar-current .title-large').length : $el.find('.title-large').length;\n if (currentIsLarge) {\n className += ' navbar-large-hidden';\n }\n if (hideStatusbar) {\n className += ' navbar-hidden-statusbar';\n }\n $el.transitionEnd(() => {\n $el.removeClass('navbar-transitioning');\n });\n $el.addClass(className);\n if (isDynamic) {\n $el.children('.navbar').each(subEl => {\n $(subEl).trigger('navbar:hide');\n app.emit('navbarHide', subEl);\n });\n } else {\n $el.trigger('navbar:hide');\n app.emit('navbarHide', $el[0]);\n }\n },\n show(el, animate, hideOnlyCurrent) {\n if (el === void 0) {\n el = '.navbar-hidden';\n }\n if (animate === void 0) {\n animate = true;\n }\n if (hideOnlyCurrent === void 0) {\n hideOnlyCurrent = false;\n }\n const app = this;\n let $el = $(el);\n const isDynamic = $el.hasClass('navbar') && $el.parent('.navbars').length && !hideOnlyCurrent;\n if (isDynamic) $el = $el.parents('.navbars');\n if (!$el.length) return;\n if (!$el.hasClass('navbar-hidden')) return;\n if (animate) {\n $el.addClass('navbar-transitioning');\n $el.transitionEnd(() => {\n $el.removeClass('navbar-transitioning');\n });\n }\n $el.removeClass('navbar-hidden navbar-large-hidden navbar-hidden-statusbar');\n if (isDynamic) {\n $el.children('.navbar').each(subEl => {\n $(subEl).trigger('navbar:show');\n app.emit('navbarShow', subEl);\n });\n } else {\n $el.trigger('navbar:show');\n app.emit('navbarShow', $el[0]);\n }\n },\n getElByPage(page) {\n let $pageEl;\n let $navbarEl;\n let pageData;\n if (page.$navbarEl || page.$el) {\n pageData = page;\n $pageEl = page.$el;\n } else {\n $pageEl = $(page);\n if ($pageEl.length > 0) pageData = $pageEl[0].f7Page;\n }\n if (pageData && pageData.$navbarEl && pageData.$navbarEl.length > 0) {\n $navbarEl = pageData.$navbarEl;\n } else if ($pageEl) {\n $navbarEl = $pageEl.children('.navbar');\n }\n if (!$navbarEl || $navbarEl && $navbarEl.length === 0) return undefined;\n return $navbarEl[0];\n },\n getPageByEl(navbarEl) {\n const $navbarEl = $(navbarEl);\n if ($navbarEl.parents('.page').length) {\n return $navbarEl.parents('.page')[0];\n }\n let pageEl;\n $navbarEl.parents('.view').find('.page').each(el => {\n if (el && el.f7Page && el.f7Page.navbarEl && $navbarEl[0] === el.f7Page.navbarEl) {\n pageEl = el;\n }\n });\n return pageEl;\n },\n collapseLargeTitle(navbarEl) {\n const app = this;\n let $navbarEl = $(navbarEl);\n if ($navbarEl.hasClass('navbars')) {\n $navbarEl = $navbarEl.find('.navbar');\n if ($navbarEl.length > 1) {\n $navbarEl = $(navbarEl).find('.navbar-large.navbar-current');\n }\n if ($navbarEl.length > 1 || !$navbarEl.length) {\n return;\n }\n }\n const $pageEl = $(app.navbar.getPageByEl($navbarEl));\n $navbarEl.addClass('navbar-large-collapsed');\n $pageEl.eq(0).addClass('page-with-navbar-large-collapsed').trigger('page:navbarlargecollapsed');\n app.emit('pageNavbarLargeCollapsed', $pageEl[0]);\n $navbarEl.trigger('navbar:collapse');\n app.emit('navbarCollapse', $navbarEl[0]);\n },\n expandLargeTitle(navbarEl) {\n const app = this;\n let $navbarEl = $(navbarEl);\n if ($navbarEl.hasClass('navbars')) {\n $navbarEl = $navbarEl.find('.navbar-large');\n if ($navbarEl.length > 1) {\n $navbarEl = $(navbarEl).find('.navbar-large.navbar-current');\n }\n if ($navbarEl.length > 1 || !$navbarEl.length) {\n return;\n }\n }\n const $pageEl = $(app.navbar.getPageByEl($navbarEl));\n $navbarEl.removeClass('navbar-large-collapsed');\n $pageEl.eq(0).removeClass('page-with-navbar-large-collapsed').trigger('page:navbarlargeexpanded');\n app.emit('pageNavbarLargeExpanded', $pageEl[0]);\n $navbarEl.trigger('navbar:expand');\n app.emit('navbarExpand', $navbarEl[0]);\n },\n toggleLargeTitle(navbarEl) {\n const app = this;\n let $navbarEl = $(navbarEl);\n if ($navbarEl.hasClass('navbars')) {\n $navbarEl = $navbarEl.find('.navbar-large');\n if ($navbarEl.length > 1) {\n $navbarEl = $(navbarEl).find('.navbar-large.navbar-current');\n }\n if ($navbarEl.length > 1 || !$navbarEl.length) {\n return;\n }\n }\n if ($navbarEl.hasClass('navbar-large-collapsed')) {\n app.navbar.expandLargeTitle($navbarEl);\n } else {\n app.navbar.collapseLargeTitle($navbarEl);\n }\n },\n initNavbarOnScroll(pageEl, navbarEl, needHide, needCollapse, needTransparent) {\n const app = this;\n const support = getSupport();\n const $pageEl = $(pageEl);\n const $navbarEl = $(navbarEl);\n const $titleLargeEl = $navbarEl.find('.title-large');\n const isLarge = $titleLargeEl.length || $navbarEl.hasClass('.navbar-large');\n let navbarHideHeight = 44;\n const snapPageScrollToLargeTitle = app.params.navbar.snapPageScrollToLargeTitle;\n const snapPageScrollToTransparentNavbar = app.params.navbar.snapPageScrollToTransparentNavbar;\n let previousScrollTop;\n let currentScrollTop;\n let scrollHeight;\n let offsetHeight;\n let reachEnd;\n let action;\n let navbarHidden;\n let navbarCollapsed;\n let navbarTitleLargeHeight;\n let navbarOffsetHeight;\n if (needCollapse || needHide && isLarge) {\n navbarTitleLargeHeight = $navbarEl.css('--f7-navbar-large-title-height');\n if (navbarTitleLargeHeight && navbarTitleLargeHeight.indexOf('px') >= 0) {\n navbarTitleLargeHeight = parseInt(navbarTitleLargeHeight, 10);\n if (Number.isNaN(navbarTitleLargeHeight) && $titleLargeEl.length) {\n navbarTitleLargeHeight = $titleLargeEl[0].offsetHeight;\n } else if (Number.isNaN(navbarTitleLargeHeight)) {\n if (app.theme === 'ios') navbarTitleLargeHeight = 52;else if (app.theme === 'md') navbarTitleLargeHeight = 88;\n }\n } else if ($titleLargeEl.length) {\n navbarTitleLargeHeight = $titleLargeEl[0].offsetHeight;\n } else {\n // eslint-disable-next-line\n if (app.theme === 'ios') navbarTitleLargeHeight = 52;else if (app.theme === 'md') navbarTitleLargeHeight = 88;\n }\n }\n if (needHide && isLarge) {\n navbarHideHeight += navbarTitleLargeHeight;\n }\n let scrollChanged;\n let scrollContent;\n let scrollTimeoutId;\n let touchEndTimeoutId;\n const touchSnapTimeout = 70;\n const desktopSnapTimeout = 300;\n function calcScrollableDistance() {\n $pageEl.find('.page-content').each(pageContentEl => {\n pageContentEl.f7ScrollableDistance = pageContentEl.scrollHeight - pageContentEl.offsetHeight;\n });\n }\n function snapLargeNavbar() {\n const inSearchbarExpanded = $navbarEl.hasClass('with-searchbar-expandable-enabled');\n if (inSearchbarExpanded) return;\n if (!scrollContent || currentScrollTop < 0) return;\n if (currentScrollTop >= navbarTitleLargeHeight / 2 && currentScrollTop < navbarTitleLargeHeight) {\n $(scrollContent).scrollTop(navbarTitleLargeHeight, 100);\n } else if (currentScrollTop < navbarTitleLargeHeight) {\n $(scrollContent).scrollTop(0, 200);\n }\n }\n function snapTransparentNavbar() {\n const inSearchbarExpanded = $navbarEl.hasClass('with-searchbar-expandable-enabled');\n if (inSearchbarExpanded) return;\n if (!scrollContent || currentScrollTop < 0) return;\n if (currentScrollTop >= navbarOffsetHeight / 2 && currentScrollTop < navbarOffsetHeight) {\n $(scrollContent).scrollTop(navbarOffsetHeight, 100);\n } else if (currentScrollTop < navbarOffsetHeight) {\n $(scrollContent).scrollTop(0, 200);\n }\n }\n function handleNavbarTransparent() {\n const isHidden = $navbarEl.hasClass('navbar-hidden') || $navbarEl.parent('.navbars').hasClass('navbar-hidden');\n const inSearchbarExpanded = $navbarEl.hasClass('with-searchbar-expandable-enabled');\n if (inSearchbarExpanded || isHidden) return;\n if (!navbarOffsetHeight) {\n navbarOffsetHeight = navbarEl.offsetHeight;\n }\n let opacity = currentScrollTop / navbarOffsetHeight;\n const notTransparent = $navbarEl.hasClass('navbar-transparent-visible');\n opacity = Math.max(Math.min(opacity, 1), 0);\n if (notTransparent && opacity === 1 || !notTransparent && opacity === 0) {\n $navbarEl.find('.navbar-bg, .title').css('opacity', '');\n return;\n }\n if (notTransparent && opacity === 0) {\n $navbarEl.trigger('navbar:transparenthide');\n app.emit('navbarTransparentHide', $navbarEl[0]);\n $navbarEl.removeClass('navbar-transparent-visible');\n $navbarEl.find('.navbar-bg, .title').css('opacity', '');\n return;\n }\n if (!notTransparent && opacity === 1) {\n $navbarEl.trigger('navbar:transparentshow');\n app.emit('navbarTransparentShow', $navbarEl[0]);\n $navbarEl.addClass('navbar-transparent-visible');\n $navbarEl.find('.navbar-bg, .title').css('opacity', '');\n return;\n }\n $navbarEl.find('.navbar-bg, .title').css('opacity', opacity);\n if (snapPageScrollToTransparentNavbar) {\n if (!support.touch) {\n clearTimeout(scrollTimeoutId);\n scrollTimeoutId = setTimeout(() => {\n snapTransparentNavbar();\n }, desktopSnapTimeout);\n } else if (touchEndTimeoutId) {\n clearTimeout(touchEndTimeoutId);\n touchEndTimeoutId = null;\n touchEndTimeoutId = setTimeout(() => {\n snapTransparentNavbar();\n clearTimeout(touchEndTimeoutId);\n touchEndTimeoutId = null;\n }, touchSnapTimeout);\n }\n }\n }\n let previousCollapseProgress = null;\n let collapseProgress = null;\n function handleLargeNavbarCollapse(pageContentEl) {\n const isHidden = $navbarEl.hasClass('navbar-hidden') || $navbarEl.parent('.navbars').hasClass('navbar-hidden');\n if (isHidden) return;\n const isLargeTransparent = $navbarEl.hasClass('navbar-large-transparent') || $navbarEl.hasClass('navbar-large') && $navbarEl.hasClass('navbar-transparent');\n previousCollapseProgress = collapseProgress;\n const scrollableDistance = Math.min(navbarTitleLargeHeight, pageContentEl.f7ScrollableDistance || navbarTitleLargeHeight);\n collapseProgress = Math.min(Math.max(currentScrollTop / scrollableDistance, 0), 1);\n const previousCollapseWasInMiddle = previousCollapseProgress > 0 && previousCollapseProgress < 1;\n const inSearchbarExpanded = $navbarEl.hasClass('with-searchbar-expandable-enabled');\n if (inSearchbarExpanded) return;\n navbarCollapsed = $navbarEl.hasClass('navbar-large-collapsed');\n const $bgEl = $navbarEl.find('.navbar-bg');\n if (collapseProgress === 0 && navbarCollapsed) {\n app.navbar.expandLargeTitle($navbarEl[0]);\n } else if (collapseProgress === 1 && !navbarCollapsed) {\n app.navbar.collapseLargeTitle($navbarEl[0]);\n }\n if (collapseProgress === 0 && navbarCollapsed || collapseProgress === 0 && previousCollapseWasInMiddle || collapseProgress === 1 && !navbarCollapsed || collapseProgress === 1 && previousCollapseWasInMiddle) {\n if (app.theme === 'md') {\n $navbarEl.find('.navbar-inner').css('overflow', '');\n }\n $navbarEl.find('.title').css('opacity', '');\n $navbarEl.find('.title-large-text, .subnavbar').css('transform', '');\n $navbarEl.find('.title-large-text').css('opacity', '');\n if (isLargeTransparent) {\n $bgEl.css('opacity', '');\n }\n $bgEl.css('transform', '');\n } else if (collapseProgress > 0 && collapseProgress < 1) {\n if (app.theme === 'md') {\n $navbarEl.find('.navbar-inner').css('overflow', 'visible');\n }\n $navbarEl.find('.title').css('opacity', -0.5 + collapseProgress * 1.5);\n $navbarEl.find('.title-large-text, .subnavbar').css('transform', `translate3d(0px, ${-1 * collapseProgress * navbarTitleLargeHeight}px, 0)`);\n $navbarEl.find('.title-large-text').css('opacity', 1 - collapseProgress * 2);\n if (isLargeTransparent) {\n $bgEl.css('opacity', collapseProgress);\n }\n $bgEl.css('transform', `translate3d(0px, ${-1 * collapseProgress * navbarTitleLargeHeight}px, 0)`);\n }\n if (snapPageScrollToLargeTitle) {\n if (!support.touch) {\n clearTimeout(scrollTimeoutId);\n scrollTimeoutId = setTimeout(() => {\n snapLargeNavbar();\n }, desktopSnapTimeout);\n } else if (touchEndTimeoutId) {\n clearTimeout(touchEndTimeoutId);\n touchEndTimeoutId = null;\n touchEndTimeoutId = setTimeout(() => {\n snapLargeNavbar();\n clearTimeout(touchEndTimeoutId);\n touchEndTimeoutId = null;\n }, touchSnapTimeout);\n }\n }\n }\n function handleTitleHideShow() {\n if ($pageEl.hasClass('page-with-card-opened')) return;\n scrollHeight = scrollContent.scrollHeight;\n offsetHeight = scrollContent.offsetHeight;\n reachEnd = currentScrollTop + offsetHeight >= scrollHeight;\n navbarHidden = $navbarEl.hasClass('navbar-hidden') || $navbarEl.parent('.navbars').hasClass('navbar-hidden');\n if (reachEnd) {\n if (app.params.navbar.showOnPageScrollEnd) {\n action = 'show';\n }\n } else if (previousScrollTop > currentScrollTop) {\n if (app.params.navbar.showOnPageScrollTop || currentScrollTop <= navbarHideHeight) {\n action = 'show';\n } else {\n action = 'hide';\n }\n } else if (currentScrollTop > navbarHideHeight) {\n action = 'hide';\n } else {\n action = 'show';\n }\n if (action === 'show' && navbarHidden) {\n app.navbar.show($navbarEl, true, true);\n navbarHidden = false;\n } else if (action === 'hide' && !navbarHidden) {\n app.navbar.hide($navbarEl, true, false, true);\n navbarHidden = true;\n }\n previousScrollTop = currentScrollTop;\n }\n function handleScroll(e) {\n scrollContent = this;\n if (e && e.target && e.target !== scrollContent) {\n return;\n }\n currentScrollTop = scrollContent.scrollTop;\n scrollChanged = currentScrollTop;\n if (needCollapse) {\n handleLargeNavbarCollapse(scrollContent);\n } else if (needTransparent) {\n handleNavbarTransparent();\n }\n if ($pageEl.hasClass('page-previous')) return;\n if (needHide) {\n handleTitleHideShow();\n }\n }\n function handeTouchStart() {\n scrollChanged = false;\n }\n function handleTouchEnd() {\n clearTimeout(touchEndTimeoutId);\n touchEndTimeoutId = null;\n touchEndTimeoutId = setTimeout(() => {\n if (scrollChanged !== false) {\n if (needTransparent && !needCollapse) {\n snapTransparentNavbar();\n } else {\n snapLargeNavbar();\n }\n clearTimeout(touchEndTimeoutId);\n touchEndTimeoutId = null;\n }\n }, touchSnapTimeout);\n }\n $pageEl.on('scroll', '.page-content', handleScroll, true);\n if (support.touch && (needCollapse && snapPageScrollToLargeTitle || needTransparent && snapPageScrollToTransparentNavbar)) {\n app.on('touchstart:passive', handeTouchStart);\n app.on('touchend:passive', handleTouchEnd);\n }\n calcScrollableDistance();\n if (needCollapse || needTransparent) {\n $pageEl.find('.page-content').each(pageContentEl => {\n if (pageContentEl.scrollTop > 0) handleScroll.call(pageContentEl);\n });\n }\n app.on('resize', calcScrollableDistance);\n $pageEl[0].f7DetachNavbarScrollHandlers = function f7DetachNavbarScrollHandlers() {\n app.off('resize', calcScrollableDistance);\n delete $pageEl[0].f7DetachNavbarScrollHandlers;\n $pageEl.off('scroll', '.page-content', handleScroll, true);\n if (support.touch && (needCollapse && snapPageScrollToLargeTitle || needTransparent && snapPageScrollToTransparentNavbar)) {\n app.off('touchstart:passive', handeTouchStart);\n app.off('touchend:passive', handleTouchEnd);\n }\n };\n }\n};\nexport default {\n name: 'navbar',\n create() {\n const app = this;\n bindMethods(app, {\n navbar: Navbar\n });\n },\n params: {\n navbar: {\n scrollTopOnTitleClick: true,\n iosCenterTitle: true,\n mdCenterTitle: false,\n hideOnPageScroll: false,\n showOnPageScrollEnd: true,\n showOnPageScrollTop: true,\n collapseLargeTitleOnScroll: true,\n snapPageScrollToLargeTitle: true,\n snapPageScrollToTransparentNavbar: true\n }\n },\n on: {\n 'panelBreakpoint panelCollapsedBreakpoint panelResize viewResize resize viewMasterDetailBreakpoint': function onPanelResize() {\n const app = this;\n $('.navbar').each(navbarEl => {\n app.navbar.size(navbarEl);\n });\n },\n pageBeforeRemove(page) {\n if (page.$el[0].f7DetachNavbarScrollHandlers) {\n page.$el[0].f7DetachNavbarScrollHandlers();\n }\n },\n pageBeforeIn(page) {\n const app = this;\n if (app.theme !== 'ios') return;\n let $navbarsEl;\n const view = page.$el.parents('.view')[0].f7View;\n const navbarEl = app.navbar.getElByPage(page);\n if (!navbarEl) {\n $navbarsEl = page.$el.parents('.view').children('.navbars');\n } else {\n $navbarsEl = $(navbarEl).parents('.navbars');\n }\n if (page.$el.hasClass('no-navbar') || view.router.dynamicNavbar && !navbarEl) {\n const animate = !!(page.pageFrom && page.router.history.length > 0);\n app.navbar.hide($navbarsEl, animate);\n } else {\n app.navbar.show($navbarsEl);\n }\n },\n pageReinit(page) {\n const app = this;\n const $navbarEl = $(app.navbar.getElByPage(page));\n if (!$navbarEl || $navbarEl.length === 0) return;\n app.navbar.size($navbarEl);\n },\n pageInit(page) {\n const app = this;\n const $navbarEl = $(app.navbar.getElByPage(page));\n if (!$navbarEl || $navbarEl.length === 0) return;\n\n // Size\n app.navbar.size($navbarEl);\n\n // Need Collapse On Scroll\n let needCollapseOnScrollHandler;\n if ($navbarEl.find('.title-large').length > 0) {\n $navbarEl.addClass('navbar-large');\n }\n if ($navbarEl.hasClass('navbar-large')) {\n if (app.params.navbar.collapseLargeTitleOnScroll) needCollapseOnScrollHandler = true;\n page.$el.addClass('page-with-navbar-large');\n }\n\n // Need transparent on scroll\n let needTransparentOnScroll;\n if (!needCollapseOnScrollHandler && $navbarEl.hasClass('navbar-transparent')) {\n needTransparentOnScroll = true;\n }\n\n // Need Hide On Scroll\n let needHideOnScrollHandler;\n if (app.params.navbar.hideOnPageScroll || page.$el.find('.hide-navbar-on-scroll').length || page.$el.hasClass('hide-navbar-on-scroll') || page.$el.find('.hide-bars-on-scroll').length || page.$el.hasClass('hide-bars-on-scroll')) {\n if (page.$el.find('.keep-navbar-on-scroll').length || page.$el.hasClass('keep-navbar-on-scroll') || page.$el.find('.keep-bars-on-scroll').length || page.$el.hasClass('keep-bars-on-scroll')) {\n needHideOnScrollHandler = false;\n } else {\n needHideOnScrollHandler = true;\n }\n }\n if (needCollapseOnScrollHandler || needHideOnScrollHandler || needTransparentOnScroll) {\n app.navbar.initNavbarOnScroll(page.el, $navbarEl[0], needHideOnScrollHandler, needCollapseOnScrollHandler, needTransparentOnScroll);\n }\n },\n 'panelOpen panelSwipeOpen modalOpen': function onPanelModalOpen(instance) {\n const app = this;\n instance.$el.find('.navbar:not(.navbar-previous)').each(navbarEl => {\n app.navbar.size(navbarEl);\n });\n },\n tabShow(tabEl) {\n const app = this;\n $(tabEl).find('.navbar:not(.navbar-previous)').each(navbarEl => {\n app.navbar.size(navbarEl);\n });\n }\n },\n clicks: {\n '.navbar .title': function onTitleClick($clickedEl, clickedData, e) {\n const app = this;\n if (!app.params.navbar.scrollTopOnTitleClick) return;\n if ($(e.target).closest('a, button').length > 0) {\n return;\n }\n let $pageContentEl;\n\n // Find active page\n const $navbarEl = $clickedEl.parents('.navbar');\n const $navbarsEl = $navbarEl.parents('.navbars');\n\n // Static Layout\n $pageContentEl = $navbarEl.parents('.page-content');\n if ($pageContentEl.length === 0) {\n // Fixed Layout\n if ($navbarEl.parents('.page').length > 0) {\n $pageContentEl = $navbarEl.parents('.page').find('.page-content');\n }\n // Through Layout iOS\n if ($pageContentEl.length === 0 && $navbarsEl.length) {\n if ($navbarsEl.nextAll('.page-current').length > 0) {\n $pageContentEl = $navbarsEl.nextAll('.page-current').find('.page-content');\n }\n }\n // Through Layout\n if ($pageContentEl.length === 0) {\n if ($navbarEl.nextAll('.page-current').length > 0) {\n $pageContentEl = $navbarEl.nextAll('.page-current').find('.page-content');\n }\n }\n }\n if ($pageContentEl && $pageContentEl.length > 0) {\n // Check for tab\n if ($pageContentEl.hasClass('tab')) {\n $pageContentEl = $pageContentEl.parent('.tabs').children('.page-content.tab-active');\n }\n if ($pageContentEl.length > 0) $pageContentEl.scrollTop(0, 300);\n }\n }\n },\n vnode: {\n navbar: {\n postpatch(vnode) {\n const app = this;\n app.navbar.size(vnode.elm);\n }\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { nextFrame, bindMethods } from '../../shared/utils.js';\nconst Toolbar = {\n setHighlight(tabbarEl) {\n const app = this;\n const $tabbarEl = $(tabbarEl);\n if (app.theme === 'ios' && !$tabbarEl.hasClass('tabbar-highlight')) return;\n if ($tabbarEl.length === 0 || !($tabbarEl.hasClass('tabbar') || $tabbarEl.hasClass('tabbar-icons'))) return;\n let $highlightEl = $tabbarEl.find('.tab-link-highlight');\n const tabLinksCount = $tabbarEl.find('.tab-link').length;\n if (tabLinksCount === 0) {\n $highlightEl.remove();\n return;\n }\n if ($highlightEl.length === 0) {\n $tabbarEl.children('.toolbar-inner').append('');\n $highlightEl = $tabbarEl.find('.tab-link-highlight');\n } else if ($highlightEl.next().length) {\n $tabbarEl.children('.toolbar-inner').append($highlightEl);\n }\n const $activeLink = $tabbarEl.find('.tab-link-active');\n let highlightWidth;\n let highlightTranslate;\n if ($tabbarEl.hasClass('tabbar-scrollable') && $activeLink && $activeLink[0]) {\n highlightWidth = `${$activeLink[0].offsetWidth}px`;\n highlightTranslate = `${$activeLink[0].offsetLeft}px`;\n } else {\n const activeIndex = $activeLink.index();\n highlightWidth = `${100 / tabLinksCount}%`;\n highlightTranslate = `${(app.rtl ? -activeIndex : activeIndex) * 100}%`;\n }\n nextFrame(() => {\n $highlightEl.css('width', highlightWidth).transform(`translate3d(${highlightTranslate},0,0)`);\n });\n },\n init(tabbarEl) {\n const app = this;\n app.toolbar.setHighlight(tabbarEl);\n },\n hide(el, animate) {\n if (animate === void 0) {\n animate = true;\n }\n const app = this;\n const $el = $(el);\n if ($el.hasClass('toolbar-hidden')) return;\n const className = `toolbar-hidden${animate ? ' toolbar-transitioning' : ''}`;\n $el.transitionEnd(() => {\n $el.removeClass('toolbar-transitioning');\n });\n $el.addClass(className);\n $el.trigger('toolbar:hide');\n app.emit('toolbarHide', $el[0]);\n },\n show(el, animate) {\n if (animate === void 0) {\n animate = true;\n }\n const app = this;\n const $el = $(el);\n if (!$el.hasClass('toolbar-hidden')) return;\n if (animate) {\n $el.addClass('toolbar-transitioning');\n $el.transitionEnd(() => {\n $el.removeClass('toolbar-transitioning');\n });\n }\n $el.removeClass('toolbar-hidden');\n $el.trigger('toolbar:show');\n app.emit('toolbarShow', $el[0]);\n },\n initToolbarOnScroll(pageEl) {\n const app = this;\n const $pageEl = $(pageEl);\n let $toolbarEl = $pageEl.parents('.view').children('.toolbar');\n if ($toolbarEl.length === 0) {\n $toolbarEl = $pageEl.find('.toolbar');\n }\n if ($toolbarEl.length === 0) {\n $toolbarEl = $pageEl.parents('.views').children('.tabbar, .tabbar-icons');\n }\n if ($toolbarEl.length === 0) {\n return;\n }\n let previousScrollTop;\n let currentScrollTop;\n let scrollHeight;\n let offsetHeight;\n let reachEnd;\n let action;\n let toolbarHidden;\n function handleScroll(e) {\n if ($pageEl.hasClass('page-with-card-opened')) return;\n if ($pageEl.hasClass('page-previous')) return;\n const scrollContent = this;\n if (e && e.target && e.target !== scrollContent) {\n return;\n }\n currentScrollTop = scrollContent.scrollTop;\n scrollHeight = scrollContent.scrollHeight;\n offsetHeight = scrollContent.offsetHeight;\n reachEnd = currentScrollTop + offsetHeight >= scrollHeight;\n toolbarHidden = $toolbarEl.hasClass('toolbar-hidden');\n if (reachEnd) {\n if (app.params.toolbar.showOnPageScrollEnd) {\n action = 'show';\n }\n } else if (previousScrollTop > currentScrollTop) {\n if (app.params.toolbar.showOnPageScrollTop || currentScrollTop <= 44) {\n action = 'show';\n } else {\n action = 'hide';\n }\n } else if (currentScrollTop > 44) {\n action = 'hide';\n } else {\n action = 'show';\n }\n if (action === 'show' && toolbarHidden) {\n app.toolbar.show($toolbarEl);\n toolbarHidden = false;\n } else if (action === 'hide' && !toolbarHidden) {\n app.toolbar.hide($toolbarEl);\n toolbarHidden = true;\n }\n previousScrollTop = currentScrollTop;\n }\n $pageEl.on('scroll', '.page-content', handleScroll, true);\n $pageEl[0].f7ScrollToolbarHandler = handleScroll;\n }\n};\nexport default {\n name: 'toolbar',\n create() {\n const app = this;\n bindMethods(app, {\n toolbar: Toolbar\n });\n },\n params: {\n toolbar: {\n hideOnPageScroll: false,\n showOnPageScrollEnd: true,\n showOnPageScrollTop: true\n }\n },\n on: {\n pageBeforeRemove(page) {\n if (page.$el[0].f7ScrollToolbarHandler) {\n page.$el.off('scroll', '.page-content', page.$el[0].f7ScrollToolbarHandler, true);\n }\n },\n pageBeforeIn(page) {\n const app = this;\n let $toolbarEl = page.$el.parents('.view').children('.toolbar');\n if ($toolbarEl.length === 0) {\n $toolbarEl = page.$el.parents('.views').children('.tabbar, .tabbar-icons');\n }\n if ($toolbarEl.length === 0) {\n $toolbarEl = page.$el.find('.toolbar');\n }\n if ($toolbarEl.length === 0) {\n return;\n }\n if (page.$el.hasClass('no-toolbar')) {\n app.toolbar.hide($toolbarEl);\n } else {\n app.toolbar.show($toolbarEl);\n }\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.tabbar, .tabbar-icons').each(tabbarEl => {\n app.toolbar.init(tabbarEl);\n });\n if (app.params.toolbar.hideOnPageScroll || page.$el.find('.hide-toolbar-on-scroll').length || page.$el.hasClass('hide-toolbar-on-scroll') || page.$el.find('.hide-bars-on-scroll').length || page.$el.hasClass('hide-bars-on-scroll')) {\n if (page.$el.find('.keep-toolbar-on-scroll').length || page.$el.hasClass('keep-toolbar-on-scroll') || page.$el.find('.keep-bars-on-scroll').length || page.$el.hasClass('keep-bars-on-scroll')) {\n return;\n }\n app.toolbar.initToolbarOnScroll(page.el);\n }\n },\n init() {\n const app = this;\n app.$el.find('.tabbar, .tabbar-icons').each(tabbarEl => {\n app.toolbar.init(tabbarEl);\n });\n }\n },\n vnode: {\n tabbar: {\n insert(vnode) {\n const app = this;\n app.toolbar.init(vnode.elm);\n }\n }\n }\n};", "import $ from '../../shared/dom7.js';\nexport default {\n name: 'subnavbar',\n on: {\n pageInit(page) {\n if (page.$navbarEl && page.$navbarEl.length && page.$navbarEl.find('.subnavbar').length) {\n page.$el.addClass('page-with-subnavbar');\n }\n const $innerSubnavbars = page.$el.find('.subnavbar').filter(subnavbarEl => {\n return $(subnavbarEl).parents('.page')[0] === page.$el[0];\n });\n if ($innerSubnavbars.length) {\n page.$el.addClass('page-with-subnavbar');\n }\n }\n }\n};", "import $ from '../../shared/dom7.js';\nexport default class TouchRipple {\n constructor(app, $el, x, y) {\n const ripple = this;\n if (!$el) return undefined;\n const {\n left,\n top,\n width,\n height\n } = $el[0].getBoundingClientRect();\n const center = {\n x: x - left,\n y: y - top\n };\n let diameter = Math.max((height ** 2 + width ** 2) ** 0.5, 48);\n let isInset = false;\n const insetElements = app.params.touch.touchRippleInsetElements || '';\n if (insetElements && $el.is(insetElements)) {\n isInset = true;\n }\n if (isInset) {\n diameter = Math.max(Math.min(width, height), 48);\n }\n if (!isInset && $el.css('overflow') === 'hidden') {\n const distanceFromCenter = ((center.x - width / 2) ** 2 + (center.y - height / 2) ** 2) ** 0.5;\n const scale = (diameter / 2 + distanceFromCenter) / (diameter / 2);\n ripple.rippleTransform = `translate3d(0px, 0px, 0) scale(${scale * 2})`;\n } else {\n // prettier-ignore\n ripple.rippleTransform = `translate3d(${-center.x + width / 2}px, ${-center.y + height / 2}px, 0) scale(1)`;\n }\n if (isInset) {\n $el.addClass('ripple-inset');\n }\n ripple.$rippleWaveEl = $(``);\n $el.prepend(ripple.$rippleWaveEl);\n ripple.$rippleWaveEl.animationEnd(() => {\n if (!ripple.$rippleWaveEl) return;\n if (ripple.$rippleWaveEl.hasClass('ripple-wave-out')) return;\n ripple.$rippleWaveEl.addClass('ripple-wave-in');\n if (ripple.shouldBeRemoved) {\n ripple.out();\n }\n });\n return ripple;\n }\n destroy() {\n let ripple = this;\n if (ripple.$rippleWaveEl) {\n ripple.$rippleWaveEl.remove();\n }\n Object.keys(ripple).forEach(key => {\n ripple[key] = null;\n delete ripple[key];\n });\n ripple = null;\n }\n out() {\n const ripple = this;\n const {\n $rippleWaveEl\n } = this;\n clearTimeout(ripple.removeTimeout);\n $rippleWaveEl.addClass('ripple-wave-out');\n ripple.removeTimeout = setTimeout(() => {\n ripple.destroy();\n }, 300);\n $rippleWaveEl.animationEnd(() => {\n clearTimeout(ripple.removeTimeout);\n ripple.destroy();\n });\n }\n remove() {\n const ripple = this;\n if (ripple.shouldBeRemoved) return;\n ripple.removeTimeout = setTimeout(() => {\n ripple.destroy();\n }, 400);\n ripple.shouldBeRemoved = true;\n if (ripple.$rippleWaveEl.hasClass('ripple-wave-in')) {\n ripple.out();\n }\n }\n}", "import TouchRipple from './touch-ripple-class.js';\nexport default {\n name: 'touch-ripple',\n static: {\n TouchRipple\n },\n create() {\n const app = this;\n app.touchRipple = {\n create() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return new TouchRipple(...args);\n }\n };\n }\n};", "import { getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\nconst openedModals = [];\nconst dialogsQueue = [];\nfunction clearDialogsQueue() {\n if (dialogsQueue.length === 0) return;\n const dialog = dialogsQueue.shift();\n dialog.open();\n}\nclass Modal extends Framework7Class {\n constructor(app, params) {\n super(params, [app]);\n const modal = this;\n const defaults = {};\n\n // Extend defaults with modules params\n modal.useModulesParams(defaults);\n modal.params = extend(defaults, params);\n modal.opened = false;\n let $containerEl = modal.params.containerEl ? $(modal.params.containerEl).eq(0) : app.$el;\n if (!$containerEl.length) $containerEl = app.$el;\n modal.$containerEl = $containerEl;\n modal.containerEl = $containerEl[0];\n\n // Install Modules\n modal.useModules();\n return this;\n }\n onOpen() {\n const modal = this;\n modal.opened = true;\n openedModals.push(modal);\n $('html').addClass(`with-modal-${modal.type.toLowerCase()}`);\n modal.$el.trigger(`modal:open ${modal.type.toLowerCase()}:open`);\n modal.emit(`local::open modalOpen ${modal.type}Open`, modal);\n }\n onOpened() {\n const modal = this;\n modal.$el.trigger(`modal:opened ${modal.type.toLowerCase()}:opened`);\n modal.emit(`local::opened modalOpened ${modal.type}Opened`, modal);\n }\n onClose() {\n const modal = this;\n modal.opened = false;\n if (!modal.type || !modal.$el) return;\n openedModals.splice(openedModals.indexOf(modal), 1);\n $('html').removeClass(`with-modal-${modal.type.toLowerCase()}`);\n modal.$el.trigger(`modal:close ${modal.type.toLowerCase()}:close`);\n modal.emit(`local::close modalClose ${modal.type}Close`, modal);\n }\n onClosed() {\n const modal = this;\n if (!modal.type || !modal.$el) return;\n modal.$el.removeClass('modal-out');\n modal.$el.hide();\n if (modal.params.backdrop && (modal.params.backdropUnique || modal.forceBackdropUnique) && modal.$backdropEl) {\n modal.$backdropEl.remove();\n }\n modal.$el.trigger(`modal:closed ${modal.type.toLowerCase()}:closed`);\n modal.emit(`local::closed modalClosed ${modal.type}Closed`, modal);\n }\n open(animateModal, force) {\n const modal = this;\n const document = getDocument();\n const app = modal.app;\n const $el = modal.$el;\n const $backdropEl = modal.$backdropEl;\n const type = modal.type;\n let animate = true;\n if (typeof animateModal !== 'undefined') animate = animateModal;else if (typeof modal.params.animate !== 'undefined') {\n animate = modal.params.animate;\n }\n if (!$el || $el.hasClass('modal-in')) {\n if (animateModal === false && $el[0] && type !== 'dialog') {\n $el[0].style.display = 'block';\n }\n if (!force) return modal;\n }\n if (type === 'dialog' && app.params.modal.queueDialogs) {\n let pushToQueue;\n if ($('.dialog.modal-in').length > 0) {\n pushToQueue = true;\n } else if (openedModals.length > 0) {\n openedModals.forEach(openedModal => {\n if (openedModal.type === 'dialog') pushToQueue = true;\n });\n }\n if (pushToQueue) {\n dialogsQueue.push(modal);\n return modal;\n }\n }\n const $modalParentEl = $el.parent();\n const wasInDom = $el.parents(document).length > 0;\n if (!$modalParentEl.is(modal.$containerEl)) {\n modal.$containerEl.append($el);\n modal.once(`${type}Closed`, () => {\n if (wasInDom) {\n $modalParentEl.append($el);\n } else {\n $el.remove();\n }\n });\n }\n // Show Modal\n $el.show();\n if (modal.params.backdrop && (modal.params.backdropUnique || modal.forceBackdropUnique) && modal.$backdropEl) {\n modal.$backdropEl.insertBefore($el);\n }\n\n /* eslint no-underscore-dangle: [\"error\", { \"allow\": [\"_clientLeft\"] }] */\n modal._clientLeft = $el[0].clientLeft;\n\n // Modal\n function transitionEnd() {\n if ($el.hasClass('modal-out')) {\n modal.onClosed();\n } else if ($el.hasClass('modal-in')) {\n modal.onOpened();\n }\n }\n if (animate) {\n if ($backdropEl) {\n $backdropEl.removeClass('not-animated');\n $backdropEl.addClass('backdrop-in');\n }\n $el.animationEnd(() => {\n transitionEnd();\n });\n $el.transitionEnd(() => {\n transitionEnd();\n });\n $el.removeClass('modal-out not-animated').addClass('modal-in');\n modal.onOpen();\n } else {\n if ($backdropEl) {\n $backdropEl.addClass('backdrop-in not-animated');\n }\n $el.removeClass('modal-out').addClass('modal-in not-animated');\n modal.onOpen();\n modal.onOpened();\n }\n return modal;\n }\n close(animateModal) {\n const modal = this;\n const $el = modal.$el;\n const $backdropEl = modal.$backdropEl;\n let animate = true;\n if (typeof animateModal !== 'undefined') animate = animateModal;else if (typeof modal.params.animate !== 'undefined') {\n animate = modal.params.animate;\n }\n if (!$el || !$el.hasClass('modal-in')) {\n if (dialogsQueue.indexOf(modal) >= 0) {\n dialogsQueue.splice(dialogsQueue.indexOf(modal), 1);\n }\n return modal;\n }\n\n // backdrop\n if ($backdropEl) {\n let needToHideBackdrop = true;\n if (modal.type === 'popup') {\n modal.$el.prevAll('.popup.modal-in').add(modal.$el.nextAll('.popup.modal-in')).each(popupEl => {\n const popupInstance = popupEl.f7Modal;\n if (!popupInstance) return;\n if (popupInstance.params.closeByBackdropClick && popupInstance.params.backdrop && popupInstance.backdropEl === modal.backdropEl) {\n needToHideBackdrop = false;\n }\n });\n }\n if (needToHideBackdrop) {\n $backdropEl[animate ? 'removeClass' : 'addClass']('not-animated');\n $backdropEl.removeClass('backdrop-in');\n }\n }\n\n // Modal\n $el[animate ? 'removeClass' : 'addClass']('not-animated');\n function transitionEnd() {\n if ($el.hasClass('modal-out')) {\n modal.onClosed();\n } else if ($el.hasClass('modal-in')) {\n modal.onOpened();\n }\n }\n if (animate) {\n $el.animationEnd(() => {\n transitionEnd();\n });\n $el.transitionEnd(() => {\n transitionEnd();\n });\n $el.removeClass('modal-in').addClass('modal-out');\n // Emit close\n modal.onClose();\n } else {\n $el.addClass('not-animated').removeClass('modal-in').addClass('modal-out');\n // Emit close\n modal.onClose();\n modal.onClosed();\n }\n if (modal.type === 'dialog') {\n clearDialogsQueue();\n }\n return modal;\n }\n destroy() {\n const modal = this;\n if (modal.destroyed) return;\n modal.emit(`local::beforeDestroy modalBeforeDestroy ${modal.type}BeforeDestroy`, modal);\n if (modal.$el) {\n modal.$el.trigger(`modal:beforedestroy ${modal.type.toLowerCase()}:beforedestroy`);\n if (modal.$el.length && modal.$el[0].f7Modal) {\n delete modal.$el[0].f7Modal;\n }\n }\n deleteProps(modal);\n modal.destroyed = true;\n }\n}\nexport default Modal;", "import $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nimport Modal from './modal-class.js';\nclass CustomModal extends Modal {\n constructor(app, params) {\n const extendedParams = extend({\n backdrop: true,\n closeByBackdropClick: true,\n on: {}\n }, params);\n\n // Extends with open/close Modal methods;\n super(app, extendedParams);\n const customModal = this;\n customModal.params = extendedParams;\n\n // Find Element\n let $el;\n if (!customModal.params.el) {\n $el = $(customModal.params.content);\n } else {\n $el = $(customModal.params.el);\n }\n if ($el && $el.length > 0 && $el[0].f7Modal) {\n return $el[0].f7Modal;\n }\n if ($el.length === 0) {\n return customModal.destroy();\n }\n let $backdropEl;\n if (customModal.params.backdrop) {\n $backdropEl = app.$el.children('.custom-modal-backdrop');\n if ($backdropEl.length === 0) {\n $backdropEl = $('');\n app.$el.append($backdropEl);\n }\n }\n function handleClick(e) {\n if (!customModal || customModal.destroyed) return;\n if ($backdropEl && e.target === $backdropEl[0]) {\n customModal.close();\n }\n }\n customModal.on('customModalOpened', () => {\n if (customModal.params.closeByBackdropClick && customModal.params.backdrop) {\n app.on('click', handleClick);\n }\n });\n customModal.on('customModalClose', () => {\n if (customModal.params.closeByBackdropClick && customModal.params.backdrop) {\n app.off('click', handleClick);\n }\n });\n extend(customModal, {\n app,\n $el,\n el: $el[0],\n $backdropEl,\n backdropEl: $backdropEl && $backdropEl[0],\n type: 'customModal'\n });\n $el[0].f7Modal = customModal;\n return customModal;\n }\n}\nexport default CustomModal;", "import Modal from './modal-class.js';\nimport CustomModal from './custom-modal-class.js';\nexport default {\n name: 'modal',\n static: {\n Modal,\n CustomModal\n },\n create() {\n const app = this;\n app.customModal = {\n create(params) {\n return new CustomModal(app, params);\n }\n };\n },\n params: {\n modal: {\n queueDialogs: true\n }\n }\n};", "import { getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nimport { getDevice } from '../../shared/get-device.js';\nimport Modal from '../modal/modal-class.js';\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass Dialog extends Modal {\n constructor(app, params) {\n const extendedParams = extend({\n title: app.params.dialog.title,\n text: undefined,\n content: '',\n buttons: [],\n verticalButtons: false,\n onClick: undefined,\n cssClass: undefined,\n destroyOnClose: false,\n on: {}\n }, params);\n if (typeof extendedParams.closeByBackdropClick === 'undefined') {\n extendedParams.closeByBackdropClick = app.params.dialog.closeByBackdropClick;\n }\n if (typeof extendedParams.backdrop === 'undefined') {\n extendedParams.backdrop = app.params.dialog.backdrop;\n }\n\n // Extends with open/close Modal methods;\n super(app, extendedParams);\n const dialog = this;\n const device = getDevice();\n const document = getDocument();\n const {\n title,\n text,\n content,\n buttons,\n verticalButtons,\n cssClass,\n backdrop\n } = extendedParams;\n dialog.params = extendedParams;\n\n // Find Element\n let $el;\n if (!dialog.params.el) {\n const dialogClasses = ['dialog'];\n if (buttons.length === 0) dialogClasses.push('dialog-no-buttons');\n if (buttons.length > 0) dialogClasses.push(`dialog-buttons-${buttons.length}`);\n if (verticalButtons) dialogClasses.push('dialog-buttons-vertical');\n if (cssClass) dialogClasses.push(cssClass);\n let buttonsHTML = '';\n if (buttons.length > 0) {\n buttonsHTML = $jsx(\"div\", {\n class: \"dialog-buttons\"\n }, buttons.map(button => $jsx(\"span\", {\n class: `dialog-button${button.strong ? ' dialog-button-strong' : ''}${button.color ? ` color-${button.color}` : ''}${button.cssClass ? ` ${button.cssClass}` : ''}`\n }, button.text)));\n }\n const dialogHtml = $jsx(\"div\", {\n class: dialogClasses.join(' ')\n }, $jsx(\"div\", {\n class: \"dialog-inner\"\n }, title && $jsx(\"div\", {\n class: \"dialog-title\"\n }, title), text && $jsx(\"div\", {\n class: \"dialog-text\"\n }, text), content), buttonsHTML);\n $el = $(dialogHtml);\n } else {\n $el = $(dialog.params.el);\n }\n if ($el && $el.length > 0 && $el[0].f7Modal) {\n return $el[0].f7Modal;\n }\n if ($el.length === 0) {\n return dialog.destroy();\n }\n let $backdropEl;\n if (backdrop) {\n $backdropEl = app.$el.children('.dialog-backdrop');\n if ($backdropEl.length === 0) {\n $backdropEl = $('');\n app.$el.append($backdropEl);\n }\n }\n\n // Assign events\n function buttonOnClick(e) {\n const buttonEl = this;\n const index = $(buttonEl).index();\n const button = buttons[index];\n if (button.onClick) button.onClick(dialog, e);\n if (dialog.params.onClick) dialog.params.onClick(dialog, index);\n if (button.close !== false) dialog.close();\n }\n let addKeyboardHander;\n function onKeyDown(e) {\n const keyCode = e.keyCode;\n buttons.forEach((button, index) => {\n if (button.keyCodes && button.keyCodes.indexOf(keyCode) >= 0) {\n if (document.activeElement) document.activeElement.blur();\n if (button.onClick) button.onClick(dialog, e);\n if (dialog.params.onClick) dialog.params.onClick(dialog, index);\n if (button.close !== false) dialog.close();\n }\n });\n }\n if (buttons && buttons.length > 0) {\n dialog.on('open', () => {\n $el.find('.dialog-button').each((buttonEl, index) => {\n const button = buttons[index];\n if (button.keyCodes) addKeyboardHander = true;\n $(buttonEl).on('click', buttonOnClick);\n });\n if (addKeyboardHander && !device.ios && !device.android && !device.cordova && !device.capacitor) {\n $(document).on('keydown', onKeyDown);\n }\n });\n dialog.on('close', () => {\n $el.find('.dialog-button').each(buttonEl => {\n $(buttonEl).off('click', buttonOnClick);\n });\n if (addKeyboardHander && !device.ios && !device.android && !device.cordova && !device.capacitor) {\n $(document).off('keydown', onKeyDown);\n }\n addKeyboardHander = false;\n });\n }\n extend(dialog, {\n app,\n $el,\n el: $el[0],\n $backdropEl,\n backdropEl: $backdropEl && $backdropEl[0],\n type: 'dialog',\n setProgress(progress, duration) {\n app.progressbar.set($el.find('.progressbar'), progress, duration);\n return dialog;\n },\n setText(newText) {\n let $textEl = $el.find('.dialog-text');\n if ($textEl.length === 0) {\n $textEl = $('');\n if (typeof title !== 'undefined') {\n $textEl.insertAfter($el.find('.dialog-title'));\n } else {\n $el.find('.dialog-inner').prepend($textEl);\n }\n }\n $textEl.html(newText);\n dialog.params.text = newText;\n return dialog;\n },\n setTitle(newTitle) {\n let $titleEl = $el.find('.dialog-title');\n if ($titleEl.length === 0) {\n $titleEl = $('');\n $el.find('.dialog-inner').prepend($titleEl);\n }\n $titleEl.html(newTitle);\n dialog.params.title = newTitle;\n return dialog;\n }\n });\n function handleClick(e) {\n const target = e.target;\n const $target = $(target);\n if ($target.closest(dialog.el).length === 0) {\n if (dialog.params.closeByBackdropClick && dialog.backdropEl && dialog.backdropEl === target) {\n dialog.close();\n }\n }\n }\n dialog.on('opened', () => {\n if (dialog.params.closeByBackdropClick) {\n app.on('click', handleClick);\n }\n });\n dialog.on('close', () => {\n if (dialog.params.closeByBackdropClick) {\n app.off('click', handleClick);\n }\n });\n $el[0].f7Modal = dialog;\n if (dialog.params.destroyOnClose) {\n dialog.once('closed', () => {\n setTimeout(() => {\n dialog.destroy();\n }, 0);\n });\n }\n return dialog;\n }\n}\nexport default Dialog;", "import { extend, iosPreloaderContent, mdPreloaderContent } from '../../shared/utils.js';\nimport Dialog from './dialog-class.js';\nimport ModalMethods from '../../shared/modal-methods.js';\nexport default {\n name: 'dialog',\n params: {\n dialog: {\n title: undefined,\n buttonOk: 'OK',\n buttonCancel: 'Cancel',\n usernamePlaceholder: 'Username',\n passwordPlaceholder: 'Password',\n preloaderTitle: 'Loading... ',\n progressTitle: 'Loading... ',\n backdrop: true,\n closeByBackdropClick: false,\n destroyPredefinedDialogs: true,\n keyboardActions: true,\n autoFocus: true\n }\n },\n static: {\n Dialog\n },\n create() {\n const app = this;\n function defaultDialogTitle() {\n return app.params.dialog.title || app.name;\n }\n const destroyOnClose = app.params.dialog.destroyPredefinedDialogs;\n const keyboardActions = app.params.dialog.keyboardActions;\n const autoFocus = app.params.dialog.autoFocus;\n const autoFocusHandler = autoFocus ? {\n on: {\n opened(dialog) {\n dialog.$el.find('input').eq(0).focus();\n }\n }\n } : {};\n const isIosTheme = app.theme === 'ios';\n app.dialog = extend(ModalMethods({\n app,\n constructor: Dialog,\n defaultSelector: '.dialog.modal-in'\n }), {\n // Shortcuts\n alert() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n let [text, title, callbackOk] = args;\n if (args.length === 2 && typeof args[1] === 'function') {\n [text, callbackOk, title] = args;\n }\n return new Dialog(app, {\n title: typeof title === 'undefined' ? defaultDialogTitle() : title,\n text,\n buttons: [{\n text: app.params.dialog.buttonOk,\n strong: isIosTheme,\n onClick: callbackOk,\n keyCodes: keyboardActions ? [13, 27] : null\n }],\n destroyOnClose\n }).open();\n },\n prompt() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n let [text, title, callbackOk, callbackCancel, defaultValue] = args;\n if (typeof args[1] === 'function') {\n [text, callbackOk, callbackCancel, defaultValue, title] = args;\n }\n defaultValue = typeof defaultValue === 'undefined' || defaultValue === null ? '' : defaultValue;\n return new Dialog(app, {\n title: typeof title === 'undefined' ? defaultDialogTitle() : title,\n text,\n content: ``,\n buttons: [{\n text: app.params.dialog.buttonCancel,\n keyCodes: keyboardActions ? [27] : null,\n color: null\n }, {\n text: app.params.dialog.buttonOk,\n strong: isIosTheme,\n keyCodes: keyboardActions ? [13] : null\n }],\n onClick(dialog, index) {\n const inputValue = dialog.$el.find('.dialog-input').val();\n if (index === 0 && callbackCancel) callbackCancel(inputValue);\n if (index === 1 && callbackOk) callbackOk(inputValue);\n },\n destroyOnClose,\n ...autoFocusHandler\n }).open();\n },\n confirm() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n let [text, title, callbackOk, callbackCancel] = args;\n if (typeof args[1] === 'function') {\n [text, callbackOk, callbackCancel, title] = args;\n }\n return new Dialog(app, {\n title: typeof title === 'undefined' ? defaultDialogTitle() : title,\n text,\n buttons: [{\n text: app.params.dialog.buttonCancel,\n onClick: callbackCancel,\n keyCodes: keyboardActions ? [27] : null,\n color: null\n }, {\n text: app.params.dialog.buttonOk,\n strong: isIosTheme,\n onClick: callbackOk,\n keyCodes: keyboardActions ? [13] : null\n }],\n destroyOnClose\n }).open();\n },\n login() {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n let [text, title, callbackOk, callbackCancel] = args;\n if (typeof args[1] === 'function') {\n [text, callbackOk, callbackCancel, title] = args;\n }\n return new Dialog(app, {\n title: typeof title === 'undefined' ? defaultDialogTitle() : title,\n text,\n // prettier-ignore\n content: `\n \n \n
\n \n \n
`,\n buttons: [{\n text: app.params.dialog.buttonCancel,\n keyCodes: keyboardActions ? [27] : null,\n color: null\n }, {\n text: app.params.dialog.buttonOk,\n strong: isIosTheme,\n keyCodes: keyboardActions ? [13] : null\n }],\n onClick(dialog, index) {\n const username = dialog.$el.find('[name=\"dialog-username\"]').val();\n const password = dialog.$el.find('[name=\"dialog-password\"]').val();\n if (index === 0 && callbackCancel) callbackCancel(username, password);\n if (index === 1 && callbackOk) callbackOk(username, password);\n },\n destroyOnClose,\n ...autoFocusHandler\n }).open();\n },\n password() {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n let [text, title, callbackOk, callbackCancel] = args;\n if (typeof args[1] === 'function') {\n [text, callbackOk, callbackCancel, title] = args;\n }\n return new Dialog(app, {\n title: typeof title === 'undefined' ? defaultDialogTitle() : title,\n text,\n // prettier-ignore\n content: `\n \n \n
`,\n buttons: [{\n text: app.params.dialog.buttonCancel,\n keyCodes: keyboardActions ? [27] : null,\n color: null\n }, {\n text: app.params.dialog.buttonOk,\n strong: isIosTheme,\n keyCodes: keyboardActions ? [13] : null\n }],\n onClick(dialog, index) {\n const password = dialog.$el.find('[name=\"dialog-password\"]').val();\n if (index === 0 && callbackCancel) callbackCancel(password);\n if (index === 1 && callbackOk) callbackOk(password);\n },\n destroyOnClose,\n ...autoFocusHandler\n }).open();\n },\n preloader(title, color) {\n const preloaders = {\n iosPreloaderContent,\n mdPreloaderContent\n };\n const preloaderInner = preloaders[`${app.theme}PreloaderContent`] || '';\n return new Dialog(app, {\n title: typeof title === 'undefined' || title === null ? app.params.dialog.preloaderTitle : title,\n // prettier-ignore\n content: `${preloaderInner}
`,\n cssClass: 'dialog-preloader',\n destroyOnClose\n }).open();\n },\n progress() {\n for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n args[_key6] = arguments[_key6];\n }\n let [title, progress, color] = args;\n if (args.length === 2) {\n if (typeof args[0] === 'number') {\n [progress, color, title] = args;\n } else if (typeof args[0] === 'string' && typeof args[1] === 'string') {\n [title, color, progress] = args;\n }\n } else if (args.length === 1) {\n if (typeof args[0] === 'number') {\n [progress, title, color] = args;\n }\n }\n const infinite = typeof progress === 'undefined';\n const dialog = new Dialog(app, {\n title: typeof title === 'undefined' ? app.params.dialog.progressTitle : title,\n cssClass: 'dialog-progress',\n // prettier-ignore\n content: `\n \n ${!infinite ? '' : ''}\n
\n `,\n destroyOnClose\n });\n if (!infinite) dialog.setProgress(progress);\n return dialog.open();\n }\n });\n }\n};", "import { getWindow, getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend, now, nextTick } from '../../shared/utils.js';\nimport { getSupport } from '../../shared/get-support.js';\nimport { getDevice } from '../../shared/get-device.js';\nimport Modal from '../modal/modal-class.js';\nclass Popup extends Modal {\n constructor(app, params) {\n const extendedParams = extend({\n on: {}\n }, app.params.popup, params);\n\n // Extends with open/close Modal methods;\n super(app, extendedParams);\n const popup = this;\n const window = getWindow();\n const document = getDocument();\n const support = getSupport();\n const device = getDevice();\n popup.params = extendedParams;\n\n // Find Element\n let $el;\n if (!popup.params.el) {\n $el = $(popup.params.content).filter(node => node.nodeType === 1).eq(0);\n } else {\n $el = $(popup.params.el).eq(0);\n }\n if ($el && $el.length > 0 && $el[0].f7Modal) {\n return $el[0].f7Modal;\n }\n if ($el.length === 0) {\n return popup.destroy();\n }\n let $backdropEl;\n if (popup.params.backdrop && popup.params.backdropEl) {\n $backdropEl = $(popup.params.backdropEl);\n } else if (popup.params.backdrop) {\n if (popup.params.backdropUnique) {\n $backdropEl = $('');\n popup.$containerEl.append($backdropEl);\n } else {\n $backdropEl = popup.$containerEl.children('.popup-backdrop');\n }\n if ($backdropEl.length === 0) {\n $backdropEl = $('');\n popup.$containerEl.append($backdropEl);\n }\n }\n extend(popup, {\n app,\n push: $el.hasClass('popup-push') || popup.params.push,\n $el,\n el: $el[0],\n $backdropEl,\n backdropEl: $backdropEl && $backdropEl[0],\n type: 'popup',\n $htmlEl: $('html')\n });\n if (popup.params.push) {\n $el.addClass('popup-push');\n }\n function handleClick(e) {\n const target = e.target;\n const $target = $(target);\n const keyboardOpened = !device.desktop && device.cordova && (window.Keyboard && window.Keyboard.isVisible || window.cordova.plugins && window.cordova.plugins.Keyboard && window.cordova.plugins.Keyboard.isVisible);\n if (keyboardOpened) return;\n if ($target.closest(popup.el).length === 0) {\n if (popup.params && popup.params.closeByBackdropClick && popup.params.backdrop && popup.backdropEl && popup.backdropEl === target) {\n let needToClose = true;\n popup.$el.nextAll('.popup.modal-in').each(popupEl => {\n const popupInstance = popupEl.f7Modal;\n if (!popupInstance) return;\n if (popupInstance.params.closeByBackdropClick && popupInstance.params.backdrop && popupInstance.backdropEl === popup.backdropEl) {\n needToClose = false;\n }\n });\n if (needToClose) {\n popup.close();\n }\n }\n }\n }\n function onKeyDown(e) {\n const keyCode = e.keyCode;\n if (keyCode === 27 && popup.params.closeOnEscape) {\n popup.close();\n }\n }\n let pushOffset;\n let isPush;\n function pushViewScale(offset) {\n return (app.height - offset * 2) / app.height;\n }\n let allowSwipeToClose = true;\n let isTouched = false;\n let startTouch;\n let currentTouch;\n let isScrolling;\n let touchStartTime;\n let touchesDiff;\n let isMoved = false;\n let pageContentEl;\n let pageContentScrollTop;\n let pageContentOffsetHeight;\n let pageContentScrollHeight;\n let popupHeight;\n let $pushEl;\n function handleTouchStart(e) {\n if (isTouched || !allowSwipeToClose || !popup.params.swipeToClose || !e.isTrusted) return;\n if (popup.params.swipeHandler && $(e.target).closest(popup.params.swipeHandler).length === 0) {\n return;\n }\n if ($(e.target).closest('.sortable-handler').length > 0) return;\n isTouched = true;\n isMoved = false;\n startTouch = {\n x: e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX,\n y: e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY\n };\n touchStartTime = now();\n isScrolling = undefined;\n if (!popup.params.swipeHandler && e.type === 'touchstart') {\n pageContentEl = $(e.target).closest('.page-content')[0];\n }\n }\n function handleTouchMove(e) {\n if (!isTouched || !e.isTrusted) return;\n currentTouch = {\n x: e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX,\n y: e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY\n };\n if (typeof isScrolling === 'undefined') {\n isScrolling = !!(isScrolling || Math.abs(currentTouch.x - startTouch.x) > Math.abs(currentTouch.y - startTouch.y));\n }\n if (isScrolling) {\n isTouched = false;\n isMoved = false;\n return;\n }\n touchesDiff = startTouch.y - currentTouch.y;\n if (isPush && pushOffset && touchesDiff > 0) {\n touchesDiff = 0;\n }\n const direction = touchesDiff < 0 ? 'to-bottom' : 'to-top';\n $el.transition(0);\n if (typeof popup.params.swipeToClose === 'string' && direction !== popup.params.swipeToClose) {\n $el.transform('');\n $el.transition('');\n return;\n }\n if (!isMoved) {\n if (isPush && pushOffset) {\n popupHeight = $el[0].offsetHeight;\n $pushEl = $el.prevAll('.popup.modal-in').eq(0);\n if ($pushEl.length === 0) {\n $pushEl = app.$el.children('.view, .views');\n }\n }\n if (pageContentEl) {\n pageContentScrollTop = pageContentEl.scrollTop;\n pageContentScrollHeight = pageContentEl.scrollHeight;\n pageContentOffsetHeight = pageContentEl.offsetHeight;\n if (!(pageContentScrollHeight === pageContentOffsetHeight) && !(direction === 'to-bottom' && pageContentScrollTop === 0) && !(direction === 'to-top' && pageContentScrollTop === pageContentScrollHeight - pageContentOffsetHeight)) {\n $el.transform('');\n $el.transition('');\n isTouched = false;\n isMoved = false;\n return;\n }\n }\n isMoved = true;\n popup.emit('local::swipeStart popupSwipeStart', popup);\n popup.$el.trigger('popup:swipestart');\n } else {\n popup.emit('local::swipeMove popupSwipeMove', popup);\n popup.$el.trigger('popup:swipemove');\n }\n e.preventDefault();\n if (isPush && pushOffset) {\n const pushProgress = 1 - Math.abs(touchesDiff / popupHeight);\n const scale = 1 - (1 - pushViewScale(pushOffset)) * pushProgress;\n if ($pushEl.hasClass('popup')) {\n if ($pushEl.hasClass('popup-push')) {\n $pushEl.transition(0).forEach(el => {\n el.style.setProperty('transform', `translate3d(0, calc(-1 * ${pushProgress} * (var(--f7-popup-push-offset) + 10px)) , 0px) scale(${scale})`, 'important');\n });\n } else {\n $pushEl.transition(0).forEach(el => {\n el.style.setProperty('transform', `translate3d(0, 0px , 0px) scale(${scale})`, 'important');\n });\n }\n } else {\n $pushEl.transition(0).forEach(el => {\n el.style.setProperty('transform', `translate3d(0,0,0) scale(${scale})`, 'important');\n });\n }\n }\n $el.transition(0).transform(`translate3d(0,${-touchesDiff}px,0)`);\n }\n function handleTouchEnd(e) {\n if (!e.isTrusted) return;\n isTouched = false;\n if (!isMoved) {\n return;\n }\n popup.emit('local::swipeEnd popupSwipeEnd', popup);\n popup.$el.trigger('popup:swipeend');\n isMoved = false;\n allowSwipeToClose = false;\n $el.transition('');\n if (isPush && pushOffset) {\n $pushEl.transition('').transform('');\n }\n const direction = touchesDiff <= 0 ? 'to-bottom' : 'to-top';\n if (typeof popup.params.swipeToClose === 'string' && direction !== popup.params.swipeToClose) {\n $el.transform('');\n allowSwipeToClose = true;\n return;\n }\n const diff = Math.abs(touchesDiff);\n const timeDiff = new Date().getTime() - touchStartTime;\n if (timeDiff < 300 && diff > 20 || timeDiff >= 300 && diff > 100) {\n nextTick(() => {\n if (direction === 'to-bottom') {\n $el.addClass('swipe-close-to-bottom');\n } else {\n $el.addClass('swipe-close-to-top');\n }\n $el.transform('');\n popup.emit('local::swipeclose popupSwipeClose', popup);\n popup.$el.trigger('popup:swipeclose');\n popup.close();\n allowSwipeToClose = true;\n });\n return;\n }\n allowSwipeToClose = true;\n $el.transform('');\n }\n const passive = support.passiveListener ? {\n passive: true\n } : false;\n if (popup.params.swipeToClose) {\n $el.on(app.touchEvents.start, handleTouchStart, passive);\n app.on('touchmove', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n popup.once('popupDestroy', () => {\n $el.off(app.touchEvents.start, handleTouchStart, passive);\n app.off('touchmove', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n });\n }\n let hasPreviousPushPopup;\n const updatePushOffset = () => {\n const wasPush = isPush;\n if (popup.push) {\n isPush = popup.push && (app.width < 630 || app.height < 630 || $el.hasClass('popup-tablet-fullscreen'));\n }\n if (isPush && !wasPush) {\n // eslint-disable-next-line\n setPushOffset();\n } else if (isPush && wasPush) {\n popup.$htmlEl[0].style.setProperty('--f7-popup-push-scale', pushViewScale(pushOffset));\n } else if (!isPush && wasPush) {\n popup.$htmlEl.removeClass('with-modal-popup-push');\n popup.$htmlEl[0].style.removeProperty('--f7-popup-push-scale');\n }\n };\n const setPushOffset = () => {\n app.off('resize', updatePushOffset);\n if (popup.push) {\n isPush = popup.push && (app.width < 630 || app.height < 630 || $el.hasClass('popup-tablet-fullscreen'));\n }\n if (isPush) {\n pushOffset = parseInt($el.css('--f7-popup-push-offset'), 10);\n if (Number.isNaN(pushOffset)) {\n pushOffset = 0;\n }\n if (!pushOffset) pushOffset = app.theme === 'ios' ? 44 : 48;\n popup.$htmlEl[0].style.setProperty('--f7-popup-push-offset', `${pushOffset}px`);\n $el.addClass('popup-push');\n popup.$htmlEl.addClass('with-modal-popup-push');\n popup.$htmlEl[0].style.setProperty('--f7-popup-push-scale', pushViewScale(pushOffset));\n }\n app.on('resize', updatePushOffset);\n };\n popup.on('open', () => {\n hasPreviousPushPopup = false;\n if (popup.params.closeOnEscape) {\n $(document).on('keydown', onKeyDown);\n }\n $el.prevAll('.popup.modal-in').addClass('popup-behind');\n setPushOffset();\n });\n popup.on('opened', () => {\n $el.removeClass('swipe-close-to-bottom swipe-close-to-top');\n if (popup.params.closeByBackdropClick) {\n app.on('click', handleClick);\n }\n });\n popup.on('close', () => {\n hasPreviousPushPopup = popup.$el.prevAll('.popup-push.modal-in').length > 0;\n if (popup.params.closeOnEscape) {\n $(document).off('keydown', onKeyDown);\n }\n if (popup.params.closeByBackdropClick) {\n app.off('click', handleClick);\n }\n $el.prevAll('.popup.modal-in').eq(0).removeClass('popup-behind');\n if (isPush && pushOffset && !hasPreviousPushPopup) {\n popup.$htmlEl.removeClass('with-modal-popup-push');\n popup.$htmlEl.addClass('with-modal-popup-push-closing');\n }\n app.off('resize', updatePushOffset);\n });\n popup.on('closed', () => {\n $el.removeClass('popup-behind');\n if (isPush && pushOffset && !hasPreviousPushPopup) {\n popup.$htmlEl.removeClass('with-modal-popup-push-closing');\n popup.$htmlEl[0].style.removeProperty('--f7-popup-push-scale');\n popup.$htmlEl[0].style.removeProperty('--f7-popup-push-offset');\n }\n });\n $el[0].f7Modal = popup;\n return popup;\n }\n}\nexport default Popup;", "import Popup from './popup-class.js';\nimport ModalMethods from '../../shared/modal-methods.js';\nexport default {\n name: 'popup',\n params: {\n popup: {\n backdrop: true,\n backdropEl: undefined,\n backdropUnique: false,\n closeByBackdropClick: true,\n closeOnEscape: false,\n swipeToClose: false,\n swipeHandler: null,\n push: false,\n containerEl: null\n }\n },\n static: {\n Popup\n },\n create() {\n const app = this;\n app.popup = ModalMethods({\n app,\n constructor: Popup,\n defaultSelector: '.popup.modal-in',\n parentSelector: '.popup'\n });\n },\n clicks: {\n '.popup-open': function openPopup($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.popup.open(data.popup, data.animate, $clickedEl);\n },\n '.popup-close': function closePopup($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.popup.close(data.popup, data.animate, $clickedEl);\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nimport Modal from '../modal/modal-class.js';\nclass LoginScreen extends Modal {\n constructor(app, params) {\n const extendedParams = extend({\n on: {}\n }, params);\n\n // Extends with open/close Modal methods;\n super(app, extendedParams);\n const loginScreen = this;\n loginScreen.params = extendedParams;\n\n // Find Element\n let $el;\n if (!loginScreen.params.el) {\n $el = $(loginScreen.params.content).filter(node => node.nodeType === 1).eq(0);\n } else {\n $el = $(loginScreen.params.el).eq(0);\n }\n if ($el && $el.length > 0 && $el[0].f7Modal) {\n return $el[0].f7Modal;\n }\n if ($el.length === 0) {\n return loginScreen.destroy();\n }\n extend(loginScreen, {\n app,\n $el,\n el: $el[0],\n type: 'loginScreen'\n });\n $el[0].f7Modal = loginScreen;\n return loginScreen;\n }\n}\nexport default LoginScreen;", "import LoginScreen from './login-screen-class.js';\nimport ModalMethods from '../../shared/modal-methods.js';\nexport default {\n name: 'loginScreen',\n static: {\n LoginScreen\n },\n create() {\n const app = this;\n app.loginScreen = ModalMethods({\n app,\n constructor: LoginScreen,\n defaultSelector: '.login-screen.modal-in'\n });\n },\n clicks: {\n '.login-screen-open': function openLoginScreen($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.loginScreen.open(data.loginScreen, data.animate, $clickedEl);\n },\n '.login-screen-close': function closeLoginScreen($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.loginScreen.close(data.loginScreen, data.animate, $clickedEl);\n }\n }\n};", "import { getWindow, getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nimport { getDevice } from '../../shared/get-device.js';\nimport Modal from '../modal/modal-class.js';\nclass Popover extends Modal {\n constructor(app, params) {\n const extendedParams = extend({\n on: {}\n }, app.params.popover, params);\n\n // Extends with open/close Modal methods;\n super(app, extendedParams);\n const popover = this;\n const device = getDevice();\n const window = getWindow();\n const document = getDocument();\n popover.params = extendedParams;\n\n // Find Element\n let $el;\n if (!popover.params.el) {\n $el = $(popover.params.content).filter(node => node.nodeType === 1).eq(0);\n } else {\n $el = $(popover.params.el).eq(0);\n }\n if ($el && $el.length > 0 && $el[0].f7Modal) {\n return $el[0].f7Modal;\n }\n\n // Find Target\n const $targetEl = $(popover.params.targetEl).eq(0);\n if ($el.length === 0) {\n return popover.destroy();\n }\n\n // Backdrop\n let $backdropEl;\n const forceBackdropUnique = popover.params.backdrop && app.$el.find('.popover.modal-in').filter(anotherPopoverEl => anotherPopoverEl !== $el[0]).length > 0;\n if (popover.params.backdrop && popover.params.backdropEl) {\n $backdropEl = $(popover.params.backdropEl);\n } else if (popover.params.backdrop) {\n if (popover.params.backdropUnique || forceBackdropUnique) {\n $backdropEl = $('');\n $backdropEl[0].f7PopoverRef = popover;\n popover.$containerEl.append($backdropEl);\n } else {\n $backdropEl = popover.$containerEl.children('.popover-backdrop');\n }\n if ($backdropEl.length === 0) {\n $backdropEl = $('');\n popover.$containerEl.append($backdropEl);\n }\n }\n\n // Find Arrow\n let $arrowEl;\n if ($el.find('.popover-arrow').length === 0 && popover.params.arrow) {\n $arrowEl = $('');\n $el.prepend($arrowEl);\n } else {\n $arrowEl = $el.find('.popover-arrow');\n }\n\n // Open\n const originalOpen = popover.open;\n extend(popover, {\n app,\n $el,\n el: $el[0],\n $targetEl,\n targetEl: $targetEl[0],\n $arrowEl,\n arrowEl: $arrowEl[0],\n $backdropEl,\n backdropEl: $backdropEl && $backdropEl[0],\n type: 'popover',\n forceBackdropUnique,\n open() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n let [targetEl, animate] = args;\n if (typeof args[0] === 'boolean') [animate, targetEl] = args;\n if (targetEl) {\n popover.$targetEl = $(targetEl);\n popover.targetEl = popover.$targetEl[0];\n }\n return originalOpen.call(popover, animate);\n }\n });\n function handleResize() {\n popover.resize();\n }\n popover.on('popoverOpen', () => {\n popover.resize();\n app.on('resize', handleResize);\n $(window).on('keyboardDidShow keyboardDidHide', handleResize);\n popover.on('popoverClose popoverBeforeDestroy', () => {\n app.off('resize', handleResize);\n $(window).off('keyboardDidShow keyboardDidHide', handleResize);\n });\n });\n let touchStartTarget = null;\n function handleTouchStart(e) {\n touchStartTarget = e.target;\n }\n function handleClick(e) {\n const target = e.target;\n const $target = $(target);\n const keyboardOpened = !device.desktop && device.cordova && (window.Keyboard && window.Keyboard.isVisible || window.cordova.plugins && window.cordova.plugins.Keyboard && window.cordova.plugins.Keyboard.isVisible);\n if (keyboardOpened) return;\n if ($target.closest(popover.el).length === 0) {\n if (popover.params.closeByBackdropClick && popover.params.backdrop && popover.backdropEl && popover.backdropEl === target && touchStartTarget === target) {\n popover.close();\n } else if (popover.params.closeByOutsideClick && touchStartTarget === target) {\n const isAnotherPopoverBackdrop = $target.hasClass('popover-backdrop-unique') && target.f7PopoverRef !== popover || $target.hasClass('popover-backdrop') && target !== popover.backdropEl;\n const isAnotherPopoverTarget = target.closest('.popover') && target.closest('.popover') !== popover.$el[0];\n if (!isAnotherPopoverBackdrop && !isAnotherPopoverTarget) {\n popover.close();\n }\n }\n }\n }\n function onKeyDown(e) {\n const keyCode = e.keyCode;\n if (keyCode === 27 && popover.params.closeOnEscape) {\n popover.close();\n }\n }\n if (popover.params.closeOnEscape) {\n popover.on('popoverOpen', () => {\n $(document).on('keydown', onKeyDown);\n });\n popover.on('popoverClose', () => {\n $(document).off('keydown', onKeyDown);\n });\n }\n popover.on('popoverOpened', () => {\n if (popover.params.closeByOutsideClick || popover.params.closeByBackdropClick) {\n app.on('touchstart', handleTouchStart);\n app.on('click', handleClick);\n }\n });\n popover.on('popoverClose', () => {\n if (popover.params.closeByOutsideClick || popover.params.closeByBackdropClick) {\n app.off('touchstart', handleTouchStart);\n app.off('click', handleClick);\n }\n });\n $el[0].f7Modal = popover;\n return popover;\n }\n resize() {\n const popover = this;\n const {\n app,\n $el,\n $targetEl,\n $arrowEl\n } = popover;\n const {\n targetX,\n targetY,\n verticalPosition\n } = popover.params;\n $el.css({\n left: '',\n top: ''\n });\n const [width, height] = [$el.width(), $el.height()];\n let arrowSize = 0;\n let arrowLeft;\n let arrowTop;\n const hasArrow = $arrowEl.length > 0;\n const arrowMin = app.theme === 'ios' ? 13 : 24;\n if (hasArrow) {\n $arrowEl.removeClass('on-left on-right on-top on-bottom').css({\n left: '',\n top: ''\n });\n arrowSize = $arrowEl.width() / 2;\n }\n $el.removeClass('popover-on-left popover-on-right popover-on-top popover-on-bottom popover-on-middle').css({\n left: '',\n top: ''\n });\n let targetWidth;\n let targetHeight;\n let targetOffsetLeft;\n let targetOffsetTop;\n let safeAreaTop = parseInt($('html').css('--f7-safe-area-top'), 10);\n let safeAreaLeft = parseInt($('html').css('--f7-safe-area-left'), 10);\n let safeAreaRight = parseInt($('html').css('--f7-safe-area-right'), 10);\n if (Number.isNaN(safeAreaTop)) safeAreaTop = 0;\n if (Number.isNaN(safeAreaLeft)) safeAreaLeft = 0;\n if (Number.isNaN(safeAreaRight)) safeAreaRight = 0;\n if ($targetEl && $targetEl.length > 0) {\n targetWidth = $targetEl.outerWidth();\n targetHeight = $targetEl.outerHeight();\n const targetOffset = $targetEl.offset();\n targetOffsetLeft = targetOffset.left - app.left;\n targetOffsetTop = targetOffset.top - app.top;\n const targetParentPage = $targetEl.parents('.page');\n if (targetParentPage.length > 0) {\n targetOffsetTop -= targetParentPage[0].scrollTop;\n }\n } else if (typeof targetX !== 'undefined' && targetY !== 'undefined') {\n targetOffsetLeft = targetX;\n targetOffsetTop = targetY;\n targetWidth = popover.params.targetWidth || 0;\n targetHeight = popover.params.targetHeight || 0;\n }\n let [left, top, diff] = [0, 0, 0];\n // Top Position\n const forcedPosition = verticalPosition === 'auto' ? false : verticalPosition;\n let position = forcedPosition || 'top';\n if (forcedPosition === 'top' || !forcedPosition && height + arrowSize < targetOffsetTop - safeAreaTop) {\n // On top\n top = targetOffsetTop - height - arrowSize;\n } else if (forcedPosition === 'bottom' || !forcedPosition && height + arrowSize < app.height - targetOffsetTop - targetHeight) {\n // On bottom\n position = 'bottom';\n top = targetOffsetTop + targetHeight + arrowSize;\n } else {\n // On middle\n position = 'middle';\n top = targetHeight / 2 + targetOffsetTop - height / 2;\n diff = top;\n top = Math.max(5, Math.min(top, app.height - height - 5));\n diff -= top;\n }\n\n // Horizontal Position\n if (position === 'top' || position === 'bottom') {\n left = targetWidth / 2 + targetOffsetLeft - width / 2;\n diff = left;\n left = Math.max(5, Math.min(left, app.width - width - 5));\n if (safeAreaLeft) {\n left = Math.max(left, safeAreaLeft);\n }\n if (safeAreaRight && left + width > app.width - 5 - safeAreaRight) {\n left = app.width - 5 - safeAreaRight - width;\n }\n diff -= left;\n if (hasArrow) {\n if (position === 'top') {\n $arrowEl.addClass('on-bottom');\n }\n if (position === 'bottom') {\n $arrowEl.addClass('on-top');\n }\n arrowLeft = width / 2 - arrowSize + diff;\n arrowLeft = Math.max(Math.min(arrowLeft, width - arrowSize * 2 - arrowMin), arrowMin);\n $arrowEl.css({\n left: `${arrowLeft}px`\n });\n }\n } else if (position === 'middle') {\n left = targetOffsetLeft - width - arrowSize;\n if (hasArrow) $arrowEl.addClass('on-right');\n if (left < 5 || left + width + safeAreaRight > app.width || left < safeAreaLeft) {\n if (left < 5) left = targetOffsetLeft + targetWidth + arrowSize;\n if (left + width + safeAreaRight > app.width) left = app.width - width - 5 - safeAreaRight;\n if (left < safeAreaLeft) left = safeAreaLeft;\n if (hasArrow) $arrowEl.removeClass('on-right').addClass('on-left');\n }\n if (hasArrow) {\n arrowTop = height / 2 - arrowSize + diff;\n arrowTop = Math.max(Math.min(arrowTop, height - arrowSize * 2 - arrowMin), arrowMin);\n $arrowEl.css({\n top: `${arrowTop}px`\n });\n }\n }\n\n // Horizontal Position\n let hPosition;\n if (targetOffsetLeft < app.width / 2) {\n hPosition = 'right';\n } else {\n hPosition = 'left';\n }\n $el.addClass(`popover-on-${position} popover-on-${hPosition}`);\n\n // Apply Styles\n $el.css({\n top: `${top}px`,\n left: `${left}px`\n });\n }\n}\nexport default Popover;", "import $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nimport Popover from './popover-class.js';\nimport ModalMethods from '../../shared/modal-methods.js';\nexport default {\n name: 'popover',\n params: {\n popover: {\n verticalPosition: 'auto',\n arrow: true,\n backdrop: true,\n backdropEl: undefined,\n backdropUnique: false,\n closeByBackdropClick: true,\n closeByOutsideClick: true,\n closeOnEscape: false,\n containerEl: null\n }\n },\n static: {\n Popover\n },\n create() {\n const app = this;\n app.popover = extend(ModalMethods({\n app,\n constructor: Popover,\n defaultSelector: '.popover.modal-in'\n }), {\n open(popoverEl, targetEl, animate) {\n let $popoverEl = $(popoverEl);\n if ($popoverEl.length > 1) {\n // check if same popover in other page\n const $targetPage = $(targetEl).parents('.page');\n if ($targetPage.length) {\n $popoverEl.each(el => {\n const $el = $(el);\n if ($el.parents($targetPage)[0] === $targetPage[0]) {\n $popoverEl = $el;\n }\n });\n }\n }\n if ($popoverEl.length > 1) {\n $popoverEl = $popoverEl.eq($popoverEl.length - 1);\n }\n let popover = $popoverEl[0].f7Modal;\n const data = $popoverEl.dataset();\n if (!popover) {\n popover = new Popover(app, Object.assign({\n el: $popoverEl,\n targetEl\n }, data));\n }\n return popover.open(targetEl, animate);\n }\n });\n },\n clicks: {\n '.popover-open': function openPopover($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.popover.open(data.popover, $clickedEl, data.animate);\n },\n '.popover-close': function closePopover($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.popover.close(data.popover, data.animate, $clickedEl);\n }\n }\n};", "/* eslint indent: [\"off\"] */\nimport { getWindow, getDocument } from 'ssr-window';\nimport { getDevice } from '../../shared/get-device.js';\nimport { extend, nextTick } from '../../shared/utils.js';\nimport Modal from '../modal/modal-class.js';\nimport $ from '../../shared/dom7.js';\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass Actions extends Modal {\n constructor(app, params) {\n const extendedParams = extend({\n on: {}\n }, app.params.actions, params);\n\n // Extends with open/close Modal methods;\n super(app, extendedParams);\n const actions = this;\n const device = getDevice();\n const window = getWindow();\n const document = getDocument();\n actions.params = extendedParams;\n\n // Buttons\n let groups;\n if (actions.params.buttons) {\n groups = actions.params.buttons;\n if (!Array.isArray(groups[0])) groups = [groups];\n }\n actions.groups = groups;\n\n // Find Element\n let $el;\n if (actions.params.el) {\n $el = $(actions.params.el).eq(0);\n } else if (actions.params.content) {\n $el = $(actions.params.content).filter(node => node.nodeType === 1).eq(0);\n } else if (actions.params.buttons) {\n if (actions.params.convertToPopover) {\n actions.popoverHtml = actions.renderPopover();\n }\n actions.actionsHtml = actions.render();\n }\n if ($el && $el.length > 0 && $el[0].f7Modal) {\n return $el[0].f7Modal;\n }\n if ($el && $el.length === 0 && !(actions.actionsHtml || actions.popoverHtml)) {\n return actions.destroy();\n }\n\n // Backdrop\n let $backdropEl;\n if (actions.params.backdrop && actions.params.backdropEl) {\n $backdropEl = $(actions.params.backdropEl);\n } else if (actions.params.backdrop) {\n if (actions.params.backdropUnique) {\n $backdropEl = $('');\n actions.$containerEl.append($backdropEl);\n } else {\n $backdropEl = actions.$containerEl.children('.actions-backdrop');\n }\n if ($backdropEl.length === 0) {\n $backdropEl = $('');\n actions.$containerEl.append($backdropEl);\n }\n }\n const originalOpen = actions.open;\n const originalClose = actions.close;\n let popover;\n function buttonOnClick(e) {\n const $buttonEl = $(this);\n let buttonIndex;\n let groupIndex;\n if ($buttonEl.hasClass('list-button') || $buttonEl.hasClass('item-link')) {\n buttonIndex = $buttonEl.parents('li').index();\n groupIndex = $buttonEl.parents('.list').index();\n } else {\n buttonIndex = $buttonEl.index();\n groupIndex = $buttonEl.parents('.actions-group').index();\n }\n if (typeof groups !== 'undefined') {\n const button = groups[groupIndex][buttonIndex];\n if (button.onClick) button.onClick(actions, e);\n if (actions.params.onClick) actions.params.onClick(actions, e);\n if (button.close !== false) actions.close();\n }\n }\n actions.open = function open(animate) {\n let convertToPopover = false;\n const {\n targetEl,\n targetX,\n targetY,\n targetWidth,\n targetHeight\n } = actions.params;\n if (actions.params.convertToPopover && (targetEl || targetX !== undefined && targetY !== undefined)) {\n // Popover\n if (actions.params.forceToPopover || device.ios && device.ipad || app.width >= 768 || device.desktop) {\n convertToPopover = true;\n }\n }\n if (convertToPopover && actions.popoverHtml) {\n popover = app.popover.create({\n containerEl: actions.params.containerEl,\n content: actions.popoverHtml,\n backdrop: actions.params.backdrop,\n targetEl,\n targetX,\n targetY,\n targetWidth,\n targetHeight,\n on: {\n open() {\n if (!actions.$el) {\n actions.$el = popover.$el;\n }\n actions.$el.trigger(`modal:open ${actions.type.toLowerCase()}:open`);\n actions.emit(`local::open modalOpen ${actions.type}Open`, actions);\n },\n opened() {\n if (!actions.$el) {\n actions.$el = popover.$el;\n }\n actions.$el.trigger(`modal:opened ${actions.type.toLowerCase()}:opened`);\n actions.emit(`local::opened modalOpened ${actions.type}Opened`, actions);\n },\n close() {\n if (!actions.$el) {\n actions.$el = popover.$el;\n }\n actions.$el.trigger(`modal:close ${actions.type.toLowerCase()}:close`);\n actions.emit(`local::close modalClose ${actions.type}Close`, actions);\n },\n closed() {\n if (!actions.$el) {\n actions.$el = popover.$el;\n }\n actions.$el.trigger(`modal:closed ${actions.type.toLowerCase()}:closed`);\n actions.emit(`local::closed modalClosed ${actions.type}Closed`, actions);\n }\n }\n });\n popover.open(animate);\n popover.once('popoverOpened', () => {\n popover.$el.find('.list-button, .item-link').each(buttonEl => {\n $(buttonEl).on('click', buttonOnClick);\n });\n });\n popover.once('popoverClosed', () => {\n popover.$el.find('.list-button, .item-link').each(buttonEl => {\n $(buttonEl).off('click', buttonOnClick);\n });\n nextTick(() => {\n popover.destroy();\n popover = undefined;\n });\n });\n } else {\n actions.$el = actions.actionsHtml ? $(actions.actionsHtml) : actions.$el;\n actions.$el[0].f7Modal = actions;\n if (actions.groups) {\n actions.$el.find('.actions-button').each(buttonEl => {\n $(buttonEl).on('click', buttonOnClick);\n });\n actions.once('actionsClosed', () => {\n actions.$el.find('.actions-button').each(buttonEl => {\n $(buttonEl).off('click', buttonOnClick);\n });\n });\n }\n actions.el = actions.$el[0];\n originalOpen.call(actions, animate);\n }\n return actions;\n };\n actions.close = function close(animate) {\n if (popover) {\n popover.close(animate);\n } else {\n originalClose.call(actions, animate);\n }\n return actions;\n };\n extend(actions, {\n app,\n $el,\n el: $el ? $el[0] : undefined,\n $backdropEl,\n backdropEl: $backdropEl && $backdropEl[0],\n type: 'actions'\n });\n function handleClick(e) {\n const target = e.target;\n const $target = $(target);\n const keyboardOpened = !device.desktop && device.cordova && (window.Keyboard && window.Keyboard.isVisible || window.cordova.plugins && window.cordova.plugins.Keyboard && window.cordova.plugins.Keyboard.isVisible);\n if (keyboardOpened) return;\n if ($target.closest(actions.el).length === 0) {\n if (actions.params.closeByBackdropClick && actions.params.backdrop && actions.backdropEl && actions.backdropEl === target) {\n actions.close();\n } else if (actions.params.closeByOutsideClick) {\n actions.close();\n }\n }\n }\n function onKeyDown(e) {\n const keyCode = e.keyCode;\n if (keyCode === 27 && actions.params.closeOnEscape) {\n actions.close();\n }\n }\n if (actions.params.closeOnEscape) {\n actions.on('open', () => {\n $(document).on('keydown', onKeyDown);\n });\n actions.on('close', () => {\n $(document).off('keydown', onKeyDown);\n });\n }\n actions.on('opened', () => {\n if (actions.params.closeByBackdropClick || actions.params.closeByOutsideClick) {\n app.on('click', handleClick);\n }\n });\n actions.on('close', () => {\n if (actions.params.closeByBackdropClick || actions.params.closeByOutsideClick) {\n app.off('click', handleClick);\n }\n });\n if ($el) {\n $el[0].f7Modal = actions;\n }\n return actions;\n }\n render() {\n const actions = this;\n if (actions.params.render) return actions.params.render.call(actions, actions);\n const {\n groups\n } = actions;\n const cssClass = actions.params.cssClass;\n return $jsx(\"div\", {\n class: `actions-modal${actions.params.grid ? ' actions-grid' : ''} ${cssClass || ''}`\n }, groups.map(group => $jsx(\"div\", {\n class: \"actions-group\"\n }, group.map(button => {\n const buttonClasses = [`actions-${button.label ? 'label' : 'button'}`];\n const {\n color,\n bg,\n strong,\n disabled,\n label,\n text,\n icon\n } = button;\n if (color) buttonClasses.push(`color-${color}`);\n if (bg) buttonClasses.push(`bg-color-${bg}`);\n if (strong) buttonClasses.push('actions-button-strong');\n if (disabled) buttonClasses.push('disabled');\n if (label) {\n return $jsx(\"div\", {\n class: buttonClasses.join(' ')\n }, text);\n }\n return $jsx(\"div\", {\n class: buttonClasses.join(' ')\n }, icon && $jsx(\"div\", {\n class: \"actions-button-media\"\n }, icon), $jsx(\"div\", {\n class: \"actions-button-text\"\n }, text));\n }))));\n }\n renderPopover() {\n const actions = this;\n if (actions.params.renderPopover) return actions.params.renderPopover.call(actions, actions);\n const {\n groups\n } = actions;\n const cssClass = actions.params.cssClass;\n return $jsx(\"div\", {\n class: `popover popover-from-actions ${cssClass || ''}`\n }, $jsx(\"div\", {\n class: \"popover-inner\"\n }, groups.map(group => $jsx(\"div\", {\n class: \"list\"\n }, $jsx(\"ul\", null, group.map(button => {\n const itemClasses = [];\n const {\n color,\n bg,\n strong,\n disabled,\n label,\n text,\n icon\n } = button;\n if (color) itemClasses.push(`color-${color}`);\n if (bg) itemClasses.push(`bg-color-${bg}`);\n if (strong) itemClasses.push('popover-from-actions-strong');\n if (disabled) itemClasses.push('disabled');\n if (label) {\n itemClasses.push('popover-from-actions-label');\n return `${text}`;\n }\n if (icon) {\n itemClasses.push('item-link item-content');\n return $jsx(\"li\", null, $jsx(\"a\", {\n class: itemClasses.join(' ')\n }, $jsx(\"div\", {\n class: \"item-media\"\n }, icon), $jsx(\"div\", {\n class: \"item-inner\"\n }, $jsx(\"div\", {\n class: \"item-title\"\n }, text))));\n }\n itemClasses.push('list-button');\n return $jsx(\"li\", null, $jsx(\"a\", {\n class: itemClasses.join(' ')\n }, text));\n }))))));\n }\n}\nexport default Actions;", "import Actions from './actions-class.js';\nimport ModalMethods from '../../shared/modal-methods.js';\nexport default {\n name: 'actions',\n params: {\n actions: {\n convertToPopover: true,\n forceToPopover: false,\n backdrop: true,\n backdropEl: undefined,\n backdropUnique: false,\n cssClass: null,\n closeByBackdropClick: true,\n closeOnEscape: false,\n render: null,\n renderPopover: null,\n containerEl: null\n }\n },\n static: {\n Actions\n },\n create() {\n const app = this;\n app.actions = ModalMethods({\n app,\n constructor: Actions,\n defaultSelector: '.actions-modal.modal-in'\n });\n },\n clicks: {\n '.actions-open': function openActions($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.actions.open(data.actions, data.animate, $clickedEl);\n },\n '.actions-close': function closeActions($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.actions.close(data.actions, data.animate, $clickedEl);\n }\n }\n};", "import { getWindow, getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend, now, getTranslate } from '../../shared/utils.js';\nimport { getSupport } from '../../shared/get-support.js';\nimport { getDevice } from '../../shared/get-device.js';\nimport Modal from '../modal/modal-class.js';\nclass Sheet extends Modal {\n constructor(app, params) {\n const extendedParams = extend({\n on: {}\n }, app.params.sheet, params);\n\n // Extends with open/close Modal methods;\n super(app, extendedParams);\n const sheet = this;\n const window = getWindow();\n const document = getDocument();\n const support = getSupport();\n const device = getDevice();\n sheet.params = extendedParams;\n if (typeof sheet.params.backdrop === 'undefined') {\n sheet.params.backdrop = app.theme !== 'ios';\n }\n\n // Find Element\n let $el;\n if (!sheet.params.el) {\n $el = $(sheet.params.content).filter(node => node.nodeType === 1).eq(0);\n } else {\n $el = $(sheet.params.el).eq(0);\n }\n if ($el && $el.length > 0 && $el[0].f7Modal) {\n return $el[0].f7Modal;\n }\n if ($el.length === 0) {\n return sheet.destroy();\n }\n let $backdropEl;\n if (sheet.params.backdrop && sheet.params.backdropEl) {\n $backdropEl = $(sheet.params.backdropEl);\n } else if (sheet.params.backdrop) {\n if (sheet.params.backdropUnique) {\n $backdropEl = $('');\n sheet.$containerEl.append($backdropEl);\n } else {\n $backdropEl = sheet.$containerEl.children('.sheet-backdrop');\n }\n if ($backdropEl.length === 0) {\n $backdropEl = $('');\n sheet.$containerEl.append($backdropEl);\n }\n }\n extend(sheet, {\n app,\n push: $el.hasClass('sheet-modal-push') || sheet.params.push,\n $el,\n el: $el[0],\n $backdropEl,\n backdropEl: $backdropEl && $backdropEl[0],\n type: 'sheet',\n $htmlEl: $('html')\n });\n if (sheet.params.push) {\n $el.addClass('sheet-modal-push');\n }\n let $pageContentEl;\n function scrollToElementOnOpen() {\n const $scrollEl = $(sheet.params.scrollToEl).eq(0);\n if ($scrollEl.length === 0) return;\n $pageContentEl = $scrollEl.parents('.page-content');\n if ($pageContentEl.length === 0) return;\n const paddingTop = parseInt($pageContentEl.css('padding-top'), 10);\n const paddingBottom = parseInt($pageContentEl.css('padding-bottom'), 10);\n const pageHeight = $pageContentEl[0].offsetHeight - paddingTop - $el.height();\n const pageScrollHeight = $pageContentEl[0].scrollHeight - paddingTop - $el.height();\n const pageScroll = $pageContentEl.scrollTop();\n let newPaddingBottom;\n const scrollElTop = $scrollEl.offset().top - paddingTop + $scrollEl[0].offsetHeight;\n if (scrollElTop > pageHeight) {\n const scrollTop = pageScroll + scrollElTop - pageHeight;\n if (scrollTop + pageHeight > pageScrollHeight) {\n newPaddingBottom = scrollTop + pageHeight - pageScrollHeight + paddingBottom;\n if (pageHeight === pageScrollHeight) {\n newPaddingBottom = $el.height();\n }\n $pageContentEl.css({\n 'padding-bottom': `${newPaddingBottom}px`\n });\n }\n $pageContentEl.scrollTop(scrollTop, 300);\n }\n }\n function scrollToElementOnClose() {\n if ($pageContentEl && $pageContentEl.length > 0) {\n $pageContentEl.css({\n 'padding-bottom': ''\n });\n }\n }\n function handleClick(e) {\n const target = e.target;\n const $target = $(target);\n const keyboardOpened = !device.desktop && device.cordova && (window.Keyboard && window.Keyboard.isVisible || window.cordova.plugins && window.cordova.plugins.Keyboard && window.cordova.plugins.Keyboard.isVisible);\n if (keyboardOpened) return;\n if ($target.closest(sheet.el).length === 0) {\n if (sheet.params.closeByBackdropClick && sheet.params.backdrop && sheet.backdropEl && sheet.backdropEl === target) {\n sheet.close();\n } else if (sheet.params.closeByOutsideClick) {\n sheet.close();\n }\n }\n }\n function onKeyDown(e) {\n const keyCode = e.keyCode;\n if (keyCode === 27 && sheet.params.closeOnEscape) {\n sheet.close();\n }\n }\n let pushOffset;\n function pushViewScale(offset) {\n return (app.height - offset * 2) / app.height;\n }\n const useBreakpoints = sheet.params.breakpoints && sheet.params.breakpoints.length > 0;\n let isTouched = false;\n let startTouch;\n let currentTouch;\n let isScrolling;\n let touchStartTime;\n let touchesDiff;\n let isMoved = false;\n let isTopSheetModal;\n let swipeStepTranslate;\n let startTranslate;\n let currentTranslate;\n let sheetElOffsetHeight;\n let minTranslate;\n let maxTranslate;\n let $pushViewEl;\n let pushBorderRadius;\n let sheetPageContentEl;\n let sheetPageContentScrollTop;\n let sheetPageContentScrollHeight;\n let sheetPageContentOffsetHeight;\n let breakpointsTranslate = [];\n let currentBreakpointIndex;\n let backdropBreakpointSet = true;\n function handleTouchStart(e) {\n if (isTouched || !(sheet.params.swipeToClose || sheet.params.swipeToStep) || !e.isTrusted) return;\n if (sheet.params.swipeHandler && $(e.target).closest(sheet.params.swipeHandler).length === 0) {\n return;\n }\n if ($(e.target).closest('.sortable-handler').length > 0) return;\n isTouched = true;\n isMoved = false;\n startTouch = {\n x: e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX,\n y: e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY\n };\n touchStartTime = now();\n isScrolling = undefined;\n isTopSheetModal = $el.hasClass('sheet-modal-top');\n if (!sheet.params.swipeHandler && e.type === 'touchstart') {\n sheetPageContentEl = $(e.target).closest('.page-content')[0];\n }\n }\n function handleTouchMove(e) {\n if (!isTouched || !e.isTrusted) return;\n currentTouch = {\n x: e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX,\n y: e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY\n };\n if (typeof isScrolling === 'undefined') {\n isScrolling = !!(isScrolling || Math.abs(currentTouch.x - startTouch.x) > Math.abs(currentTouch.y - startTouch.y));\n }\n if (isScrolling) {\n isTouched = false;\n isMoved = false;\n return;\n }\n touchesDiff = startTouch.y - currentTouch.y;\n const direction = touchesDiff < 0 ? 'to-bottom' : 'to-top';\n if (!isMoved) {\n if (sheetPageContentEl && !$el.hasClass('modal-in-swipe-step')) {\n sheetPageContentScrollTop = sheetPageContentEl.scrollTop;\n sheetPageContentScrollHeight = sheetPageContentEl.scrollHeight;\n sheetPageContentOffsetHeight = sheetPageContentEl.offsetHeight;\n if (!(sheetPageContentScrollHeight === sheetPageContentOffsetHeight) && !(direction === 'to-bottom' && sheetPageContentScrollTop === 0) && !(direction === 'to-top' && sheetPageContentScrollTop === sheetPageContentScrollHeight - sheetPageContentOffsetHeight)) {\n $el.transform('');\n isTouched = false;\n isMoved = false;\n return;\n }\n }\n if (sheet.push && pushOffset) {\n $pushViewEl = app.$el.children('.view, .views');\n }\n sheetElOffsetHeight = $el[0].offsetHeight;\n startTranslate = getTranslate($el[0], 'y');\n if (isTopSheetModal) {\n minTranslate = sheet.params.swipeToClose ? -sheetElOffsetHeight : -swipeStepTranslate;\n maxTranslate = 0;\n } else {\n minTranslate = 0;\n maxTranslate = sheet.params.swipeToClose ? sheetElOffsetHeight : useBreakpoints ? breakpointsTranslate[0] : swipeStepTranslate;\n }\n isMoved = true;\n }\n currentTranslate = startTranslate - touchesDiff;\n currentTranslate = Math.min(Math.max(currentTranslate, minTranslate), maxTranslate);\n e.preventDefault();\n if (useBreakpoints) {\n let progress = isTopSheetModal ? 1 + currentTranslate / sheetElOffsetHeight : 1 - currentTranslate / sheetElOffsetHeight;\n progress = Math.abs(progress);\n progress = Math.min(Math.max(progress, 0), 1);\n // eslint-disable-next-line\n setBackdropBreakpoint(progress);\n // eslint-disable-next-line\n setPushBreakpoint(progress);\n }\n if (sheet.push && pushOffset && !useBreakpoints) {\n let progress = (currentTranslate - startTranslate) / sheetElOffsetHeight;\n if (sheet.params.swipeToStep) {\n if (isTopSheetModal) {\n progress = currentTranslate / swipeStepTranslate;\n } else {\n progress = 1 - (swipeStepTranslate - currentTranslate) / swipeStepTranslate;\n }\n }\n progress = Math.abs(progress);\n progress = Math.min(Math.max(progress, 0), 1);\n const pushProgress = 1 - progress;\n const scale = 1 - (1 - pushViewScale(pushOffset)) * pushProgress;\n $pushViewEl.transition(0).forEach(el => {\n el.style.setProperty('transform', `translate3d(0,0,0) scale(${scale})`, 'important');\n });\n if (sheet.params.swipeToStep) {\n $pushViewEl.css('border-radius', `${pushBorderRadius * pushProgress}px`);\n }\n }\n $el.transition(0).transform(`translate3d(0,${currentTranslate}px,0)`);\n if (sheet.params.swipeToStep) {\n let progress;\n if (isTopSheetModal) {\n progress = 1 - currentTranslate / swipeStepTranslate;\n } else {\n progress = (swipeStepTranslate - currentTranslate) / swipeStepTranslate;\n }\n progress = Math.min(Math.max(progress, 0), 1);\n $el.trigger('sheet:stepprogress', progress);\n sheet.emit('local::stepProgress sheetStepProgress', sheet, progress);\n }\n }\n function handleTouchEnd() {\n isTouched = false;\n if (!isMoved) {\n return;\n }\n isMoved = false;\n $el.transform('').transition('');\n if (sheet.push && pushOffset) {\n $pushViewEl.transition('');\n if (!useBreakpoints) {\n $pushViewEl.transform('');\n $pushViewEl.css('border-radius', '');\n }\n }\n const direction = touchesDiff < 0 ? 'to-bottom' : 'to-top';\n const diff = Math.abs(touchesDiff);\n if (diff === 0 || currentTranslate === startTranslate) return;\n const timeDiff = new Date().getTime() - touchStartTime;\n if (!sheet.params.swipeToStep && !useBreakpoints) {\n if (direction !== (isTopSheetModal ? 'to-top' : 'to-bottom')) {\n return;\n }\n if (timeDiff < 300 && diff > 20 || timeDiff >= 300 && diff > sheetElOffsetHeight / 2) {\n sheet.close();\n }\n return;\n }\n const openDirection = isTopSheetModal ? 'to-bottom' : 'to-top';\n const closeDirection = isTopSheetModal ? 'to-top' : 'to-bottom';\n const absCurrentTranslate = Math.abs(currentTranslate);\n const absSwipeStepTranslate = Math.abs(swipeStepTranslate);\n if (timeDiff < 300 && diff > 10 && useBreakpoints) {\n // SHORT SWIPES BREAKPOINTS\n if (direction === openDirection && typeof currentBreakpointIndex !== 'undefined') {\n if (currentBreakpointIndex === params.breakpoints.length - 1) {\n // open\n sheet.setBreakpoint(1);\n } else {\n // move to next breakpoint\n currentBreakpointIndex = Math.min(breakpointsTranslate.length - 1, currentBreakpointIndex + 1);\n sheet.setBreakpoint(params.breakpoints[currentBreakpointIndex]);\n }\n }\n if (direction === closeDirection) {\n if (currentBreakpointIndex === 0) {\n // close\n sheet.close();\n } else {\n // move to prev breakpoint\n if (typeof currentBreakpointIndex === 'undefined') {\n currentBreakpointIndex = params.breakpoints.length - 1;\n } else {\n currentBreakpointIndex = Math.max(0, currentBreakpointIndex - 1);\n }\n sheet.setBreakpoint(params.breakpoints[currentBreakpointIndex]);\n }\n }\n } else if (timeDiff < 300 && diff > 10) {\n // SHORT SWIPES SWIPE STEP\n if (direction === openDirection && absCurrentTranslate < absSwipeStepTranslate) {\n // open step\n $el.removeClass('modal-in-swipe-step');\n $el.trigger('sheet:stepprogress', 1);\n sheet.emit('local::stepProgress sheetStepProgress', sheet, 1);\n sheet.emit('local::_swipeStep', false);\n $el.trigger('sheet:stepopen');\n sheet.emit('local::stepOpen sheetStepOpen', sheet);\n if (sheet.push && pushOffset) {\n sheet.$htmlEl[0].style.setProperty('--f7-sheet-push-scale', pushViewScale(pushOffset));\n $pushViewEl.css('border-radius', '');\n }\n }\n if (direction === closeDirection && absCurrentTranslate > absSwipeStepTranslate) {\n // close sheet\n if (sheet.params.swipeToClose) {\n sheet.close();\n } else {\n // close step\n $el.addClass('modal-in-swipe-step');\n $el.trigger('sheet:stepprogress', 0);\n sheet.emit('local::stepProgress sheetStepProgress', sheet, 0);\n sheet.emit('local::_swipeStep', true);\n $el.trigger('sheet:stepclose');\n sheet.emit('local::stepClose sheetStepClose', sheet);\n if (sheet.push && pushOffset) {\n sheet.$htmlEl[0].style.removeProperty('--f7-sheet-push-scale');\n $pushViewEl.css('border-radius', '0px');\n }\n }\n }\n if (direction === closeDirection && absCurrentTranslate <= absSwipeStepTranslate) {\n // close step\n $el.addClass('modal-in-swipe-step');\n $el.trigger('sheet:stepprogress', 0);\n sheet.emit('local::stepProgress sheetStepProgress', sheet, 0);\n sheet.emit('local::_swipeStep', true);\n $el.trigger('sheet:stepclose');\n sheet.emit('local::stepClose sheetStepClose', sheet);\n if (sheet.push && pushOffset) {\n sheet.$htmlEl[0].style.removeProperty('--f7-sheet-push-scale');\n $pushViewEl.css('border-radius', '0px');\n }\n }\n return;\n }\n if (timeDiff >= 300 && useBreakpoints) {\n // LONG SWIPES BREAKPOINTS\n const allBreakpoints = [sheetElOffsetHeight, ...breakpointsTranslate, 0];\n const closestTranslate = allBreakpoints.reduce((prev, curr) => {\n return Math.abs(curr - currentTranslate) < Math.abs(prev - currentTranslate) ? curr : prev;\n });\n const closestIndex = allBreakpoints.indexOf(closestTranslate);\n if (closestTranslate === 0) {\n // open\n sheet.setBreakpoint(1);\n } else if (closestIndex === 0) {\n // close\n sheet.close();\n } else {\n // set bp\n currentBreakpointIndex = closestIndex - 1;\n sheet.setBreakpoint(params.breakpoints[currentBreakpointIndex]);\n }\n } else if (timeDiff >= 300) {\n // LONG SWIPES SWIPE STEP\n const stepOpened = !$el.hasClass('modal-in-swipe-step');\n if (!stepOpened) {\n if (absCurrentTranslate < absSwipeStepTranslate / 2) {\n // open step\n $el.removeClass('modal-in-swipe-step');\n $el.trigger('sheet:stepprogress', 1);\n sheet.emit('local::stepProgress sheetStepProgress', sheet, 1);\n sheet.emit('local::_swipeStep', false);\n $el.trigger('sheet:stepopen');\n sheet.emit('local::stepOpen sheetStepOpen', sheet);\n if (sheet.push && pushOffset) {\n sheet.$htmlEl[0].style.setProperty('--f7-sheet-push-scale', pushViewScale(pushOffset));\n $pushViewEl.css('border-radius', '');\n }\n } else if (absCurrentTranslate - absSwipeStepTranslate > (sheetElOffsetHeight - absSwipeStepTranslate) / 2) {\n // close sheet\n if (sheet.params.swipeToClose) sheet.close();\n }\n } else if (stepOpened) {\n if (absCurrentTranslate > absSwipeStepTranslate + (sheetElOffsetHeight - absSwipeStepTranslate) / 2) {\n // close sheet\n if (sheet.params.swipeToClose) sheet.close();\n } else if (absCurrentTranslate > absSwipeStepTranslate / 2) {\n // close step\n $el.addClass('modal-in-swipe-step');\n $el.trigger('sheet:stepprogress', 0);\n sheet.emit('local::stepProgress sheetStepProgress', sheet, 0);\n sheet.emit('local::_swipeStep', true);\n $el.trigger('sheet:stepclose');\n sheet.emit('local::stepClose sheetStepClose', sheet);\n if (sheet.push && pushOffset) {\n sheet.$htmlEl[0].style.removeProperty('--f7-sheet-push-scale');\n $pushViewEl.css('border-radius', '0px');\n }\n }\n }\n }\n }\n const setPushBreakpoint = breakpoint => {\n const {\n pushBreakpoint\n } = params;\n if (pushBreakpoint === null || typeof pushBreakpoint === 'undefined' || !sheet.push || !pushOffset) return;\n if (breakpoint >= pushBreakpoint) {\n sheet.$htmlEl.addClass('with-modal-sheet-push').removeClass('with-modal-sheet-push-closing');\n $pushViewEl.transition('').forEach(el => {\n el.style.setProperty('transform', `translate3d(0,0,0) scale(${pushViewScale(pushOffset)})`, 'important');\n });\n $pushViewEl.css('border-radius', `${pushBorderRadius * 1}px`);\n } else {\n const pushBreakpoints = [0, ...params.breakpoints, 1];\n const pushTransparentBreakpoint = pushBreakpoints[pushBreakpoints.indexOf(pushBreakpoint) - 1];\n if (breakpoint <= pushTransparentBreakpoint) {\n $pushViewEl.transition('').css('transform', '');\n $pushViewEl.css('border-radius', '');\n sheet.$htmlEl.removeClass('with-modal-sheet-push');\n if (breakpoint === pushTransparentBreakpoint) {\n sheet.$htmlEl.addClass('with-modal-sheet-push-closing');\n }\n } else {\n const progress = (breakpoint - pushTransparentBreakpoint) / (pushBreakpoint - pushTransparentBreakpoint);\n sheet.$htmlEl.addClass('with-modal-sheet-push').removeClass('with-modal-sheet-push-closing');\n $pushViewEl.transition(0).forEach(el => {\n el.style.setProperty('transform', `translate3d(0,0,0) scale(${1 - (1 - pushViewScale(pushOffset)) * progress})`, 'important');\n });\n $pushViewEl.css('border-radius', `${pushBorderRadius * progress}px`);\n }\n }\n };\n const setBackdropBreakpoint = breakpoint => {\n const {\n backdrop,\n backdropBreakpoint\n } = params;\n if (!backdropBreakpoint || !backdrop || !$backdropEl.length) return;\n if (breakpoint >= backdropBreakpoint) {\n if (!backdropBreakpointSet) {\n $backdropEl.transition('').css({\n opacity: '',\n pointerEvents: ''\n });\n }\n backdropBreakpointSet = true;\n } else {\n const backdropBreakpoints = [0, ...params.breakpoints, 1];\n const backdropTransparentBreakpoint = backdropBreakpoints[backdropBreakpoints.indexOf(backdropBreakpoint) - 1];\n if (breakpoint <= backdropTransparentBreakpoint) {\n if (backdropBreakpointSet) {\n $backdropEl.transition('').css({\n opacity: 0,\n pointerEvents: 'none'\n });\n }\n backdropBreakpointSet = false;\n } else {\n const progress = (breakpoint - backdropTransparentBreakpoint) / (backdropBreakpoint - backdropTransparentBreakpoint);\n $backdropEl.transition(0).css({\n opacity: progress,\n pointerEvents: 'auto'\n });\n }\n }\n };\n sheet.calcBreakpoints = () => {\n if (!useBreakpoints) {\n return;\n }\n const fullSize = $el[0].offsetHeight;\n // eslint-disable-next-line\n const isTopSheetModal = $el.hasClass('sheet-modal-top');\n breakpointsTranslate = [];\n sheet.params.breakpoints.forEach(ratio => {\n breakpointsTranslate.push((fullSize - fullSize * ratio) * (isTopSheetModal ? -1 : 1));\n });\n };\n sheet.setBreakpoint = value => {\n if (!useBreakpoints) {\n return sheet;\n }\n if (value === 1) {\n // open\n if (!sheet.opened) {\n sheet.open();\n }\n $el.removeClass('modal-in-breakpoint');\n currentBreakpointIndex = undefined;\n setBackdropBreakpoint(value);\n setPushBreakpoint(value);\n $el.trigger('sheet:breakpoint', value);\n sheet.emit('local::breakpoint sheetBreakpoint', sheet, value);\n } else if (value === 0) {\n // close\n $el.trigger('sheet:breakpoint', value);\n sheet.emit('local::breakpoint sheetBreakpoint', sheet, value);\n sheet.close();\n } else {\n const index = params.breakpoints.indexOf(value);\n if (index < 0) return sheet;\n if (!sheet.opened) {\n sheet.open();\n }\n setBackdropBreakpoint(value);\n setPushBreakpoint(value);\n $el.trigger('sheet:breakpoint', value);\n sheet.emit('local::breakpoint sheetBreakpoint', sheet, value);\n currentBreakpointIndex = index;\n $el[0].style.setProperty('--f7-sheet-breakpoint', `${breakpointsTranslate[index]}px`);\n $el.addClass('modal-in-breakpoint');\n }\n return sheet;\n };\n const setBreakpointsOnResize = () => {\n sheet.calcBreakpoints();\n if (typeof currentBreakpointIndex !== 'undefined') {\n sheet.setBreakpoint(params.breakpoints[currentBreakpointIndex]);\n }\n };\n sheet.setSwipeStep = function setSwipeStep(byResize) {\n if (byResize === void 0) {\n byResize = true;\n }\n const $swipeStepEl = $el.find('.sheet-modal-swipe-step').eq(0);\n if (!$swipeStepEl.length) return;\n\n // eslint-disable-next-line\n if ($el.hasClass('sheet-modal-top')) {\n swipeStepTranslate = -($swipeStepEl.offset().top - $el.offset().top + $swipeStepEl[0].offsetHeight);\n } else {\n swipeStepTranslate = $el[0].offsetHeight - ($swipeStepEl.offset().top - $el.offset().top + $swipeStepEl[0].offsetHeight);\n }\n $el[0].style.setProperty('--f7-sheet-swipe-step', `${swipeStepTranslate}px`);\n if (!byResize) {\n $el.addClass('modal-in-swipe-step');\n sheet.emit('local::_swipeStep', true);\n }\n };\n function onResize() {\n if (useBreakpoints) {\n setBreakpointsOnResize();\n } else {\n sheet.setSwipeStep(true);\n }\n }\n const passive = support.passiveListener ? {\n passive: true\n } : false;\n if (sheet.params.swipeToClose || sheet.params.swipeToStep || useBreakpoints) {\n $el.on(app.touchEvents.start, handleTouchStart, passive);\n app.on('touchmove', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n sheet.once('sheetDestroy', () => {\n $el.off(app.touchEvents.start, handleTouchStart, passive);\n app.off('touchmove', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n });\n }\n sheet.on('open', () => {\n if (sheet.params.closeOnEscape) {\n $(document).on('keydown', onKeyDown);\n }\n $el.prevAll('.popup.modal-in').addClass('popup-behind');\n app.on('resize', onResize);\n if (sheet.params.scrollToEl) {\n scrollToElementOnOpen();\n }\n if (sheet.push) {\n pushOffset = parseInt($el.css('--f7-sheet-push-offset'), 10);\n if (Number.isNaN(pushOffset)) pushOffset = 0;\n if (!pushOffset) pushOffset = app.theme === 'ios' ? 44 : 48;\n sheet.$htmlEl[0].style.setProperty('--f7-sheet-push-offset', `${pushOffset}px`);\n $el.addClass('sheet-modal-push');\n if (!useBreakpoints) {\n sheet.$htmlEl.addClass('with-modal-sheet-push');\n }\n if (!sheet.params.swipeToStep && !useBreakpoints) {\n sheet.$htmlEl[0].style.setProperty('--f7-sheet-push-scale', pushViewScale(pushOffset));\n } else {\n $pushViewEl = app.$el.children('.view, .views');\n pushBorderRadius = app.theme === 'ios' ? 10 : 16;\n $pushViewEl.css('border-radius', '0px');\n }\n }\n if (useBreakpoints) {\n sheet.calcBreakpoints();\n sheet.setBreakpoint(params.breakpoints[0]);\n } else if (sheet.params.swipeToStep) {\n sheet.setSwipeStep(false);\n }\n });\n sheet.on('opened', () => {\n if (sheet.params.closeByOutsideClick || sheet.params.closeByBackdropClick) {\n app.on('click', handleClick);\n }\n });\n sheet.on('close', () => {\n currentBreakpointIndex = undefined;\n if (sheet.params.swipeToStep || useBreakpoints) {\n $el.removeClass('modal-in-swipe-step modal-in-breakpoint');\n sheet.emit('local::_swipeStep', false);\n }\n app.off('resize', onResize);\n if (sheet.params.closeOnEscape) {\n $(document).off('keydown', onKeyDown);\n }\n if (sheet.params.scrollToEl) {\n scrollToElementOnClose();\n }\n if (sheet.params.closeByOutsideClick || sheet.params.closeByBackdropClick) {\n app.off('click', handleClick);\n }\n $el.prevAll('.popup.modal-in').eq(0).removeClass('popup-behind');\n if (sheet.push && pushOffset) {\n sheet.$htmlEl.removeClass('with-modal-sheet-push');\n sheet.$htmlEl.addClass('with-modal-sheet-push-closing');\n if ($pushViewEl) {\n $pushViewEl.transform('');\n $pushViewEl.css('border-radius', '');\n }\n }\n });\n sheet.on('closed', () => {\n if (sheet.push && pushOffset) {\n sheet.$htmlEl.removeClass('with-modal-sheet-push-closing');\n sheet.$htmlEl[0].style.removeProperty('--f7-sheet-push-scale');\n sheet.$htmlEl[0].style.removeProperty('--f7-sheet-push-offset');\n }\n });\n sheet.stepOpen = function stepOpen() {\n $el.removeClass('modal-in-swipe-step');\n sheet.emit('local::_swipeStep', false);\n if (sheet.push) {\n if (!pushOffset) {\n pushOffset = parseInt($el.css('--f7-sheet-push-offset'), 10);\n if (Number.isNaN(pushOffset)) pushOffset = 0;\n }\n if (pushOffset) {\n sheet.$htmlEl[0].style.setProperty('--f7-sheet-push-scale', pushViewScale(pushOffset));\n }\n }\n };\n sheet.stepClose = function stepClose() {\n $el.addClass('modal-in-swipe-step');\n sheet.emit('local::_swipeStep', true);\n if (sheet.push) {\n sheet.$htmlEl[0].style.removeProperty('--f7-sheet-push-scale');\n }\n };\n sheet.stepToggle = function stepToggle() {\n $el.toggleClass('modal-in-swipe-step');\n sheet.emit('local::_swipeStep', $el.hasClass('modal-in-swipe-step'));\n };\n $el[0].f7Modal = sheet;\n return sheet;\n }\n}\nexport default Sheet;", "import $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nimport Sheet from './sheet-class.js';\nimport ModalMethods from '../../shared/modal-methods.js';\nexport default {\n name: 'sheet',\n params: {\n sheet: {\n push: false,\n backdrop: undefined,\n backdropEl: undefined,\n backdropUnique: false,\n closeByBackdropClick: true,\n closeByOutsideClick: false,\n closeOnEscape: false,\n swipeToClose: false,\n swipeToStep: false,\n breakpoints: [],\n backdropBreakpoint: 0,\n pushBreakpoint: 0,\n swipeHandler: null,\n containerEl: null\n }\n },\n static: {\n Sheet\n },\n create() {\n const app = this;\n app.sheet = extend({}, ModalMethods({\n app,\n constructor: Sheet,\n defaultSelector: '.sheet-modal.modal-in'\n }), {\n stepOpen(sheet) {\n const sheetInstance = app.sheet.get(sheet);\n if (sheetInstance && sheetInstance.stepOpen) return sheetInstance.stepOpen();\n return undefined;\n },\n stepClose(sheet) {\n const sheetInstance = app.sheet.get(sheet);\n if (sheetInstance && sheetInstance.stepClose) return sheetInstance.stepClose();\n return undefined;\n },\n stepToggle(sheet) {\n const sheetInstance = app.sheet.get(sheet);\n if (sheetInstance && sheetInstance.stepToggle) return sheetInstance.stepToggle();\n return undefined;\n },\n setBreakpoint(sheet, breakpoint) {\n const sheetInstance = app.sheet.get(sheet);\n if (sheetInstance && sheetInstance.setBreakpoint) return sheetInstance.setBreakpoint(breakpoint);\n return undefined;\n }\n });\n },\n clicks: {\n '.sheet-open': function openSheet($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n if ($('.sheet-modal.modal-in').length > 0 && data.sheet && $(data.sheet)[0] !== $('.sheet-modal.modal-in')[0]) {\n app.sheet.close('.sheet-modal.modal-in');\n }\n app.sheet.open(data.sheet, data.animate, $clickedEl);\n },\n '.sheet-close': function closeSheet($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.sheet.close(data.sheet, data.animate, $clickedEl);\n }\n }\n};", "import { getWindow } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend, nextTick } from '../../shared/utils.js';\nimport Modal from '../modal/modal-class.js';\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass Toast extends Modal {\n constructor(app, params) {\n const extendedParams = extend({\n on: {}\n }, app.params.toast, params);\n\n // Extends with open/close Modal methods;\n super(app, extendedParams);\n const toast = this;\n const window = getWindow();\n toast.app = app;\n toast.params = extendedParams;\n const {\n closeButton,\n closeTimeout\n } = toast.params;\n let $el;\n if (!toast.params.el) {\n // Find Element\n const toastHtml = toast.render();\n $el = $(toastHtml);\n } else {\n $el = $(toast.params.el);\n }\n if ($el && $el.length > 0 && $el[0].f7Modal) {\n return $el[0].f7Modal;\n }\n if ($el.length === 0) {\n return toast.destroy();\n }\n extend(toast, {\n $el,\n el: $el[0],\n type: 'toast'\n });\n $el[0].f7Modal = toast;\n if (closeButton) {\n $el.find('.toast-button').on('click', () => {\n toast.emit('local::closeButtonClick toastCloseButtonClick', toast);\n toast.close();\n });\n toast.on('beforeDestroy', () => {\n $el.find('.toast-button').off('click');\n });\n }\n let timeoutId;\n toast.on('open', () => {\n $('.toast.modal-in').each(openedEl => {\n const toastInstance = app.toast.get(openedEl);\n if (openedEl !== toast.el && toastInstance) {\n toastInstance.close();\n }\n });\n if (closeTimeout) {\n timeoutId = nextTick(() => {\n toast.close();\n }, closeTimeout);\n }\n });\n toast.on('close', () => {\n window.clearTimeout(timeoutId);\n });\n if (toast.params.destroyOnClose) {\n toast.once('closed', () => {\n setTimeout(() => {\n toast.destroy();\n }, 0);\n });\n }\n return toast;\n }\n render() {\n const toast = this;\n if (toast.params.render) return toast.params.render.call(toast, toast);\n const {\n position,\n horizontalPosition,\n cssClass,\n icon,\n text,\n closeButton,\n closeButtonColor,\n closeButtonText\n } = toast.params;\n const horizontalClass = position === 'top' || position === 'bottom' ? `toast-horizontal-${horizontalPosition}` : '';\n return $jsx(\"div\", {\n class: `toast toast-${position} ${horizontalClass} ${cssClass || ''} ${icon ? 'toast-with-icon' : ''}`\n }, $jsx(\"div\", {\n class: \"toast-content\"\n }, icon && $jsx(\"div\", {\n class: \"toast-icon\"\n }, icon), $jsx(\"div\", {\n class: \"toast-text\"\n }, text), closeButton && !icon && $jsx(\"a\", {\n class: `toast-button button ${closeButtonColor ? `color-${closeButtonColor}` : ''}`\n }, closeButtonText)));\n }\n}\nexport default Toast;", "import { extend } from '../../shared/utils.js';\nimport Toast from './toast-class.js';\nimport ModalMethods from '../../shared/modal-methods.js';\nexport default {\n name: 'toast',\n static: {\n Toast\n },\n create() {\n const app = this;\n app.toast = extend({}, ModalMethods({\n app,\n constructor: Toast,\n defaultSelector: '.toast.modal-in'\n }), {\n // Shortcuts\n show(params) {\n extend(params, {\n destroyOnClose: true\n });\n return new Toast(app, params).open();\n }\n });\n },\n params: {\n toast: {\n icon: null,\n text: null,\n position: 'bottom',\n horizontalPosition: 'left',\n closeButton: false,\n closeButtonColor: null,\n closeButtonText: 'Ok',\n closeTimeout: null,\n cssClass: null,\n render: null,\n containerEl: null\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { bindMethods, iosPreloaderContent, mdPreloaderContent } from '../../shared/utils.js';\nconst Preloader = {\n init(el) {\n const app = this;\n const preloaders = {\n iosPreloaderContent,\n mdPreloaderContent\n };\n const $el = $(el);\n if ($el.length === 0 || $el.children('.preloader-inner').length > 0 || $el.children('.preloader-inner-line').length > 0) return;\n $el.append(preloaders[`${app.theme}PreloaderContent`]);\n },\n // Modal\n visible: false,\n show(color) {\n if (color === void 0) {\n color = 'white';\n }\n const app = this;\n if (Preloader.visible) return;\n const preloaders = {\n iosPreloaderContent,\n mdPreloaderContent\n };\n const preloaderInner = preloaders[`${app.theme}PreloaderContent`] || '';\n $('html').addClass('with-modal-preloader');\n // prettier-ignore\n app.$el.append(`\n \n \n `);\n Preloader.visible = true;\n },\n showIn(el, color) {\n if (color === void 0) {\n color = 'white';\n }\n const app = this;\n const preloaders = {\n iosPreloaderContent,\n mdPreloaderContent\n };\n const preloaderInner = preloaders[`${app.theme}PreloaderContent`] || '';\n $(el || 'html').addClass('with-modal-preloader');\n // prettier-ignore\n $(el || app.$el).append(`\n \n \n `);\n },\n hide() {\n const app = this;\n if (!Preloader.visible) return;\n $('html').removeClass('with-modal-preloader');\n app.$el.find('.preloader-backdrop, .preloader-modal').remove();\n Preloader.visible = false;\n },\n hideIn(el) {\n const app = this;\n $(el || 'html').removeClass('with-modal-preloader');\n $(el || app.$el).find('.preloader-backdrop, .preloader-modal').remove();\n }\n};\nexport default {\n name: 'preloader',\n create() {\n const app = this;\n bindMethods(app, {\n preloader: Preloader\n });\n },\n on: {\n photoBrowserOpen(pb) {\n const app = this;\n pb.$el.find('.preloader').each(preloaderEl => {\n app.preloader.init(preloaderEl);\n });\n },\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.preloader').each(preloaderEl => {\n app.preloader.init(preloaderEl);\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.preloader').each(preloaderEl => {\n app.preloader.init(preloaderEl);\n });\n }\n },\n vnode: {\n preloader: {\n insert(vnode) {\n const app = this;\n const preloaderEl = vnode.elm;\n app.preloader.init(preloaderEl);\n }\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { bindMethods } from '../../shared/utils.js';\nconst Progressbar = {\n set() {\n const app = this;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n let [el, progress, duration] = args;\n if (typeof args[0] === 'number') {\n [progress, duration] = args;\n el = app.$el;\n }\n if (typeof progress === 'undefined' || progress === null) return el;\n if (!progress) progress = 0;\n const $el = $(el || app.$el);\n if ($el.length === 0) {\n return el;\n }\n const progressNormalized = Math.min(Math.max(progress, 0), 100);\n let $progressbarEl;\n if ($el.hasClass('progressbar')) $progressbarEl = $el.eq(0);else {\n $progressbarEl = $el.children('.progressbar');\n }\n if ($progressbarEl.length === 0 || $progressbarEl.hasClass('progressbar-infinite')) {\n return $progressbarEl;\n }\n let $progressbarLine = $progressbarEl.children('span');\n if ($progressbarLine.length === 0) {\n $progressbarLine = $('');\n $progressbarEl.append($progressbarLine);\n }\n $progressbarLine.transition(typeof duration !== 'undefined' ? duration : '').transform(`translate3d(${(-100 + progressNormalized) * (app.rtl ? -1 : 1)}%,0,0)`);\n return $progressbarEl[0];\n },\n show() {\n const app = this;\n\n // '.page', 50, 'multi'\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n let [el, progress, color] = args;\n let type = 'determined';\n if (args.length === 2) {\n if ((typeof args[0] === 'string' || typeof args[0] === 'object') && typeof args[1] === 'string') {\n // '.page', 'multi'\n [el, color, progress] = args;\n type = 'infinite';\n } else if (typeof args[0] === 'number' && typeof args[1] === 'string') {\n // 50, 'multi'\n [progress, color] = args;\n el = app.$el;\n }\n } else if (args.length === 1) {\n if (typeof args[0] === 'number') {\n el = app.$el;\n progress = args[0];\n } else if (typeof args[0] === 'string') {\n type = 'infinite';\n el = app.$el;\n color = args[0];\n }\n } else if (args.length === 0) {\n type = 'infinite';\n el = app.$el;\n }\n const $el = $(el);\n if ($el.length === 0) return undefined;\n let $progressbarEl;\n if ($el.hasClass('progressbar') || $el.hasClass('progressbar-infinite')) {\n $progressbarEl = $el;\n } else {\n $progressbarEl = $el.children('.progressbar:not(.progressbar-out), .progressbar-infinite:not(.progressbar-out)');\n if ($progressbarEl.length === 0) {\n $progressbarEl = $(`\n \n ${type === 'infinite' ? '' : ''}\n `);\n $el.append($progressbarEl);\n }\n }\n if (typeof progress !== 'undefined') {\n app.progressbar.set($progressbarEl, progress);\n }\n return $progressbarEl[0];\n },\n hide(el, removeAfterHide) {\n if (removeAfterHide === void 0) {\n removeAfterHide = true;\n }\n const app = this;\n const $el = $(el || app.$el);\n if ($el.length === 0) return undefined;\n let $progressbarEl;\n if ($el.hasClass('progressbar') || $el.hasClass('progressbar-infinite')) {\n $progressbarEl = $el;\n } else {\n $progressbarEl = $el.children('.progressbar, .progressbar-infinite');\n }\n if ($progressbarEl.length === 0 || !$progressbarEl.hasClass('progressbar-in') || $progressbarEl.hasClass('progressbar-out')) {\n return $progressbarEl;\n }\n $progressbarEl.removeClass('progressbar-in').addClass('progressbar-out').animationEnd(() => {\n if (removeAfterHide) {\n $progressbarEl.remove();\n }\n });\n return $progressbarEl;\n }\n};\nexport default {\n name: 'progressbar',\n create() {\n const app = this;\n bindMethods(app, {\n progressbar: Progressbar\n });\n },\n on: {\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.progressbar').each(progressbarEl => {\n const $progressbarEl = $(progressbarEl);\n app.progressbar.set($progressbarEl, $progressbarEl.attr('data-progress'));\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.progressbar').each(progressbarEl => {\n const $progressbarEl = $(progressbarEl);\n app.progressbar.set($progressbarEl, $progressbarEl.attr('data-progress'));\n });\n }\n },\n vnode: {\n progressbar: {\n insert(vnode) {\n const app = this;\n const el = vnode.elm;\n app.progressbar.set(el, el.getAttribute('data-progress'));\n },\n update(vnode) {\n const app = this;\n const el = vnode.elm;\n app.progressbar.set(el, el.getAttribute('data-progress'));\n }\n }\n }\n};", "import { getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { bindMethods } from '../../shared/utils.js';\nimport { getSupport } from '../../shared/get-support.js';\nconst Sortable = {\n init() {\n const app = this;\n const document = getDocument();\n let isTouched;\n let isMoved;\n let touchStartY;\n let touchesDiff;\n let $sortingEl;\n let $sortingItems;\n let $sortableContainer;\n let sortingElHeight;\n let minTop;\n let maxTop;\n let $insertAfterEl;\n let $insertBeforeEl;\n let indexFrom;\n let $pageEl;\n let $pageContentEl;\n let pageHeight;\n let pageOffset;\n let sortingElOffsetLocal;\n let sortingElOffsetTop;\n let initialScrollTop;\n let wasTapHold;\n function handleTouchStart(e, isTapHold) {\n isMoved = false;\n isTouched = true;\n wasTapHold = false;\n touchStartY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n $sortingEl = $(e.target).closest('li').eq(0);\n indexFrom = $sortingEl.index();\n $sortableContainer = $sortingEl.parents('.sortable');\n const $listGroup = $sortingEl.parents('.list-group');\n if ($listGroup.length && $listGroup.parents($sortableContainer).length) {\n $sortableContainer = $listGroup;\n }\n $sortingItems = $sortableContainer.children('ul').children('li:not(.disallow-sorting):not(.no-sorting)');\n if (app.panel) app.panel.allowOpen = false;\n if (app.swipeout) app.swipeout.allow = false;\n if (isTapHold) {\n $sortingEl.addClass('sorting');\n $sortableContainer.addClass('sortable-sorting');\n wasTapHold = true;\n }\n }\n function handleTouchMove(e) {\n if (!isTouched || !$sortingEl) return;\n const pageY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n if (!isMoved) {\n $pageEl = $sortingEl.parents('.page');\n $pageContentEl = $sortingEl.parents('.page-content');\n const paddingTop = parseInt($pageContentEl.css('padding-top'), 10);\n const paddingBottom = parseInt($pageContentEl.css('padding-bottom'), 10);\n initialScrollTop = $pageContentEl[0].scrollTop;\n pageOffset = $pageEl.offset().top + paddingTop;\n pageHeight = $pageEl.height() - paddingTop - paddingBottom;\n $sortingEl.addClass('sorting');\n $sortableContainer.addClass('sortable-sorting');\n sortingElOffsetLocal = $sortingEl[0].offsetTop;\n minTop = $sortingEl[0].offsetTop;\n maxTop = $sortingEl.parent().height() - sortingElOffsetLocal - $sortingEl.height();\n sortingElHeight = $sortingEl[0].offsetHeight;\n sortingElOffsetTop = $sortingEl.offset().top;\n }\n isMoved = true;\n e.preventDefault();\n e.f7PreventSwipePanel = true;\n touchesDiff = pageY - touchStartY;\n const translateScrollOffset = $pageContentEl[0].scrollTop - initialScrollTop;\n const translate = Math.min(Math.max(touchesDiff + translateScrollOffset, -minTop), maxTop);\n $sortingEl.transform(`translate3d(0,${translate}px,0)`);\n const scrollAddition = 44;\n let allowScroll = true;\n if (touchesDiff + translateScrollOffset + scrollAddition < -minTop) {\n allowScroll = false;\n }\n if (touchesDiff + translateScrollOffset - scrollAddition > maxTop) {\n allowScroll = false;\n }\n $insertBeforeEl = undefined;\n $insertAfterEl = undefined;\n let scrollDiff;\n if (allowScroll) {\n if (sortingElOffsetTop + touchesDiff + sortingElHeight + scrollAddition > pageOffset + pageHeight) {\n // To Bottom\n scrollDiff = sortingElOffsetTop + touchesDiff + sortingElHeight + scrollAddition - (pageOffset + pageHeight);\n }\n if (sortingElOffsetTop + touchesDiff < pageOffset + scrollAddition) {\n // To Top\n scrollDiff = sortingElOffsetTop + touchesDiff - pageOffset - scrollAddition;\n }\n if (scrollDiff) {\n $pageContentEl[0].scrollTop += scrollDiff;\n }\n }\n $sortingItems.each(el => {\n const $currentEl = $(el);\n if ($currentEl[0] === $sortingEl[0]) return;\n const currentElOffset = $currentEl[0].offsetTop;\n const currentElHeight = $currentEl.height();\n const sortingElOffset = sortingElOffsetLocal + translate;\n let currentTranslate;\n const prevTranslate = $currentEl[0].f7Translate;\n if (sortingElOffset >= currentElOffset - currentElHeight / 2 && $sortingEl.index() < $currentEl.index()) {\n currentTranslate = -sortingElHeight;\n $currentEl.transform(`translate3d(0, ${currentTranslate}px,0)`);\n $insertAfterEl = $currentEl;\n $insertBeforeEl = undefined;\n } else if (sortingElOffset <= currentElOffset + currentElHeight / 2 && $sortingEl.index() > $currentEl.index()) {\n currentTranslate = sortingElHeight;\n $currentEl[0].f7Translate = currentTranslate;\n $currentEl.transform(`translate3d(0, ${currentTranslate}px,0)`);\n $insertAfterEl = undefined;\n if (!$insertBeforeEl) $insertBeforeEl = $currentEl;\n } else {\n currentTranslate = undefined;\n $currentEl.transform('translate3d(0, 0%,0)');\n }\n if (prevTranslate !== currentTranslate) {\n $currentEl.trigger('sortable:move');\n app.emit('sortableMove', $currentEl[0], $sortableContainer[0]);\n }\n $currentEl[0].f7Translate = currentTranslate;\n });\n }\n function handleTouchEnd() {\n if (!isTouched || !isMoved) {\n if (isTouched && !isMoved) {\n if (app.panel) app.panel.allowOpen = true;\n if (app.swipeout) app.swipeout.allow = true;\n if (wasTapHold) {\n $sortingEl.removeClass('sorting');\n $sortableContainer.removeClass('sortable-sorting');\n }\n }\n isTouched = false;\n isMoved = false;\n return;\n }\n if (app.panel) app.panel.allowOpen = true;\n if (app.swipeout) app.swipeout.allow = true;\n $sortingItems.transform('');\n $sortingEl.removeClass('sorting');\n $sortableContainer.removeClass('sortable-sorting');\n let indexTo;\n if ($insertAfterEl) indexTo = $insertAfterEl.index();else if ($insertBeforeEl) indexTo = $insertBeforeEl.index();\n let moveElements = $sortableContainer.dataset().sortableMoveElements;\n if (typeof moveElements === 'undefined') {\n moveElements = app.params.sortable.moveElements;\n }\n if (moveElements) {\n if ($insertAfterEl) {\n $sortingEl.insertAfter($insertAfterEl);\n }\n if ($insertBeforeEl) {\n $sortingEl.insertBefore($insertBeforeEl);\n }\n }\n if (($insertAfterEl || $insertBeforeEl) && $sortableContainer.hasClass('virtual-list')) {\n indexFrom = $sortingEl[0].f7VirtualListIndex;\n if (typeof indexFrom === 'undefined') indexFrom = $sortingEl.attr('data-virtual-list-index');\n if ($insertBeforeEl) {\n indexTo = $insertBeforeEl[0].f7VirtualListIndex;\n if (typeof indexTo === 'undefined') indexTo = $insertBeforeEl.attr('data-virtual-list-index');\n } else {\n indexTo = $insertAfterEl[0].f7VirtualListIndex;\n if (typeof indexTo === 'undefined') indexTo = $insertAfterEl.attr('data-virtual-list-index');\n }\n if (indexTo !== null) indexTo = parseInt(indexTo, 10);else indexTo = undefined;\n const virtualList = $sortableContainer[0].f7VirtualList;\n if (indexFrom) indexFrom = parseInt(indexFrom, 10);\n if (indexTo) indexTo = parseInt(indexTo, 10);\n if (virtualList) virtualList.moveItem(indexFrom, indexTo);\n }\n if (typeof indexTo !== 'undefined' && !Number.isNaN(indexTo) && indexTo !== indexFrom) {\n $sortingEl.trigger('sortable:sort', {\n from: indexFrom,\n to: indexTo\n });\n app.emit('sortableSort', $sortingEl[0], {\n from: indexFrom,\n to: indexTo,\n el: $sortingEl[0]\n }, $sortableContainer[0]);\n }\n $insertBeforeEl = undefined;\n $insertAfterEl = undefined;\n isTouched = false;\n isMoved = false;\n }\n const activeListener = getSupport().passiveListener ? {\n passive: false,\n capture: false\n } : false;\n $(document).on(app.touchEvents.start, '.list.sortable .sortable-handler', handleTouchStart, activeListener);\n app.on('touchmove:active', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n $(document).on('taphold', '.sortable-tap-hold', (e, pointerEvent) => {\n handleTouchStart(pointerEvent, true);\n });\n },\n enable(el) {\n if (el === void 0) {\n el = '.list.sortable';\n }\n const app = this;\n const $el = $(el);\n if ($el.length === 0) return;\n $el.addClass('sortable-enabled');\n $el.trigger('sortable:enable');\n app.emit('sortableEnable', $el[0]);\n },\n disable(el) {\n if (el === void 0) {\n el = '.list.sortable';\n }\n const app = this;\n const $el = $(el);\n if ($el.length === 0) return;\n $el.removeClass('sortable-enabled');\n $el.trigger('sortable:disable');\n app.emit('sortableDisable', $el[0]);\n },\n toggle(el) {\n if (el === void 0) {\n el = '.list.sortable';\n }\n const app = this;\n const $el = $(el);\n if ($el.length === 0) return;\n if ($el.hasClass('sortable-enabled')) {\n app.sortable.disable($el);\n } else {\n app.sortable.enable($el);\n }\n }\n};\nexport default {\n name: 'sortable',\n params: {\n sortable: {\n moveElements: true\n }\n },\n create() {\n const app = this;\n bindMethods(app, {\n sortable: Sortable\n });\n },\n on: {\n init() {\n const app = this;\n if (!app.params.sortable) return;\n app.sortable.init();\n }\n },\n clicks: {\n '.sortable-enable': function enable($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.sortable.enable(data.sortable);\n },\n '.sortable-disable': function disable($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.sortable.disable(data.sortable);\n },\n '.sortable-toggle': function toggle($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.sortable.toggle(data.sortable);\n }\n }\n};", "import { getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { nextFrame, bindMethods } from '../../shared/utils.js';\nimport { getSupport } from '../../shared/get-support.js';\nconst Swipeout = {\n init() {\n const app = this;\n const document = getDocument();\n const touchesStart = {};\n let isTouched;\n let isMoved;\n let isScrolling;\n let touchStartTime;\n let touchesDiff;\n let $swipeoutEl;\n let $swipeoutContent;\n let $actionsRight;\n let $actionsLeft;\n let actionsLeftWidth;\n let actionsRightWidth;\n let translate;\n let opened;\n let openedActionsSide;\n let $leftButtons;\n let $rightButtons;\n let direction;\n let $overswipeLeftButton;\n let $overswipeRightButton;\n let overswipeLeft;\n let overswipeRight;\n function handleTouchStart(e) {\n if (!app.swipeout.allow) return;\n isMoved = false;\n isTouched = true;\n isScrolling = undefined;\n touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n touchStartTime = new Date().getTime();\n $swipeoutEl = $(this);\n }\n function handleTouchMove(e) {\n if (!isTouched) return;\n const pageX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n const pageY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n if (typeof isScrolling === 'undefined') {\n isScrolling = !!(isScrolling || Math.abs(pageY - touchesStart.y) > Math.abs(pageX - touchesStart.x));\n }\n if (isScrolling) {\n isTouched = false;\n return;\n }\n if (!isMoved) {\n if ($('.list.sortable-opened').length > 0) return;\n $swipeoutContent = $swipeoutEl.find('.swipeout-content');\n $actionsRight = $swipeoutEl.find('.swipeout-actions-right');\n $actionsLeft = $swipeoutEl.find('.swipeout-actions-left');\n actionsLeftWidth = null;\n actionsRightWidth = null;\n $leftButtons = null;\n $rightButtons = null;\n $overswipeRightButton = null;\n $overswipeLeftButton = null;\n if ($actionsLeft.length > 0) {\n actionsLeftWidth = $actionsLeft.outerWidth();\n $leftButtons = $actionsLeft.children('a');\n $overswipeLeftButton = $actionsLeft.find('.swipeout-overswipe');\n }\n if ($actionsRight.length > 0) {\n actionsRightWidth = $actionsRight.outerWidth();\n $rightButtons = $actionsRight.children('a');\n $overswipeRightButton = $actionsRight.find('.swipeout-overswipe');\n }\n opened = $swipeoutEl.hasClass('swipeout-opened');\n if (opened) {\n openedActionsSide = $swipeoutEl.find('.swipeout-actions-left.swipeout-actions-opened').length > 0 ? 'left' : 'right';\n }\n $swipeoutEl.removeClass('swipeout-transitioning');\n if (!app.params.swipeout.noFollow) {\n $swipeoutEl.find('.swipeout-actions-opened').removeClass('swipeout-actions-opened');\n $swipeoutEl.removeClass('swipeout-opened');\n }\n }\n isMoved = true;\n if (e.cancelable) {\n e.preventDefault();\n }\n touchesDiff = pageX - touchesStart.x;\n translate = touchesDiff;\n if (opened) {\n if (openedActionsSide === 'right') translate -= actionsRightWidth;else translate += actionsLeftWidth;\n }\n if (translate > 0 && $actionsLeft.length === 0 || translate < 0 && $actionsRight.length === 0) {\n if (!opened) {\n isTouched = false;\n isMoved = false;\n $swipeoutContent.transform('');\n if ($rightButtons && $rightButtons.length > 0) {\n $rightButtons.transform('');\n }\n if ($leftButtons && $leftButtons.length > 0) {\n $leftButtons.transform('');\n }\n return;\n }\n translate = 0;\n }\n if (translate < 0) direction = 'to-left';else if (translate > 0) direction = 'to-right';else if (!direction) direction = 'to-left';\n let buttonOffset;\n let progress;\n e.f7PreventSwipePanel = true;\n if (app.params.swipeout.noFollow) {\n if (opened) {\n if (openedActionsSide === 'right' && touchesDiff > 0) {\n app.swipeout.close($swipeoutEl);\n }\n if (openedActionsSide === 'left' && touchesDiff < 0) {\n app.swipeout.close($swipeoutEl);\n }\n } else {\n if (touchesDiff < 0 && $actionsRight.length > 0) {\n app.swipeout.open($swipeoutEl, 'right');\n }\n if (touchesDiff > 0 && $actionsLeft.length > 0) {\n app.swipeout.open($swipeoutEl, 'left');\n }\n }\n isTouched = false;\n isMoved = false;\n return;\n }\n overswipeLeft = false;\n overswipeRight = false;\n if ($actionsRight.length > 0) {\n // Show right actions\n let buttonTranslate = translate;\n progress = buttonTranslate / actionsRightWidth;\n if (buttonTranslate < -actionsRightWidth) {\n const ratio = buttonTranslate / -actionsRightWidth;\n buttonTranslate = -actionsRightWidth - (-buttonTranslate - actionsRightWidth) ** 0.8;\n translate = buttonTranslate;\n if ($overswipeRightButton.length > 0 && ratio > app.params.swipeout.overswipeRatio) {\n overswipeRight = true;\n }\n }\n if (direction !== 'to-left') {\n progress = 0;\n buttonTranslate = 0;\n }\n $rightButtons.each(buttonEl => {\n const $buttonEl = $(buttonEl);\n if (typeof buttonEl.f7SwipeoutButtonOffset === 'undefined') {\n $buttonEl[0].f7SwipeoutButtonOffset = buttonEl.offsetLeft;\n }\n buttonOffset = buttonEl.f7SwipeoutButtonOffset;\n if ($overswipeRightButton.length > 0 && $buttonEl.hasClass('swipeout-overswipe') && direction === 'to-left') {\n $buttonEl.css({\n left: `${overswipeRight ? -buttonOffset : 0}px`\n });\n if (overswipeRight) {\n if (!$buttonEl.hasClass('swipeout-overswipe-active')) {\n $swipeoutEl.trigger('swipeout:overswipeenter');\n app.emit('swipeoutOverswipeEnter', $swipeoutEl[0]);\n }\n $buttonEl.addClass('swipeout-overswipe-active');\n } else {\n if ($buttonEl.hasClass('swipeout-overswipe-active')) {\n $swipeoutEl.trigger('swipeout:overswipeexit');\n app.emit('swipeoutOverswipeExit', $swipeoutEl[0]);\n }\n $buttonEl.removeClass('swipeout-overswipe-active');\n }\n }\n $buttonEl.transform(`translate3d(${buttonTranslate - buttonOffset * (1 + Math.max(progress, -1))}px,0,0)`);\n });\n }\n if ($actionsLeft.length > 0) {\n // Show left actions\n let buttonTranslate = translate;\n progress = buttonTranslate / actionsLeftWidth;\n if (buttonTranslate > actionsLeftWidth) {\n const ratio = buttonTranslate / actionsRightWidth;\n buttonTranslate = actionsLeftWidth + (buttonTranslate - actionsLeftWidth) ** 0.8;\n translate = buttonTranslate;\n if ($overswipeLeftButton.length > 0 && ratio > app.params.swipeout.overswipeRatio) {\n overswipeLeft = true;\n }\n }\n if (direction !== 'to-right') {\n buttonTranslate = 0;\n progress = 0;\n }\n $leftButtons.each((buttonEl, index) => {\n const $buttonEl = $(buttonEl);\n if (typeof buttonEl.f7SwipeoutButtonOffset === 'undefined') {\n $buttonEl[0].f7SwipeoutButtonOffset = actionsLeftWidth - buttonEl.offsetLeft - buttonEl.offsetWidth;\n }\n buttonOffset = buttonEl.f7SwipeoutButtonOffset;\n if ($overswipeLeftButton.length > 0 && $buttonEl.hasClass('swipeout-overswipe') && direction === 'to-right') {\n $buttonEl.css({\n left: `${overswipeLeft ? buttonOffset : 0}px`\n });\n if (overswipeLeft) {\n if (!$buttonEl.hasClass('swipeout-overswipe-active')) {\n $swipeoutEl.trigger('swipeout:overswipeenter');\n app.emit('swipeoutOverswipeEnter', $swipeoutEl[0]);\n }\n $buttonEl.addClass('swipeout-overswipe-active');\n } else {\n if ($buttonEl.hasClass('swipeout-overswipe-active')) {\n $swipeoutEl.trigger('swipeout:overswipeexit');\n app.emit('swipeoutOverswipeExit', $swipeoutEl[0]);\n }\n $buttonEl.removeClass('swipeout-overswipe-active');\n }\n }\n if ($leftButtons.length > 1) {\n $buttonEl.css('z-index', $leftButtons.length - index);\n }\n $buttonEl.transform(`translate3d(${buttonTranslate + buttonOffset * (1 - Math.min(progress, 1))}px,0,0)`);\n });\n }\n $swipeoutEl.trigger('swipeout', progress);\n app.emit('swipeout', $swipeoutEl[0], progress);\n $swipeoutContent.transform(`translate3d(${translate}px,0,0)`);\n }\n function handleTouchEnd() {\n if (!isTouched || !isMoved) {\n isTouched = false;\n isMoved = false;\n return;\n }\n isTouched = false;\n isMoved = false;\n const timeDiff = new Date().getTime() - touchStartTime;\n const $actions = direction === 'to-left' ? $actionsRight : $actionsLeft;\n const actionsWidth = direction === 'to-left' ? actionsRightWidth : actionsLeftWidth;\n let action;\n let $buttons;\n let i;\n if (timeDiff < 300 && (touchesDiff < -10 && direction === 'to-left' || touchesDiff > 10 && direction === 'to-right') || timeDiff >= 300 && Math.abs(translate) > actionsWidth / 2) {\n action = 'open';\n } else {\n action = 'close';\n }\n if (timeDiff < 300) {\n if (Math.abs(translate) === 0) action = 'close';\n if (Math.abs(translate) === actionsWidth) action = 'open';\n }\n if (action === 'open') {\n Swipeout.el = $swipeoutEl[0];\n $swipeoutEl.trigger('swipeout:open');\n app.emit('swipeoutOpen', $swipeoutEl[0]);\n $swipeoutEl.addClass('swipeout-opened swipeout-transitioning');\n const newTranslate = direction === 'to-left' ? -actionsWidth : actionsWidth;\n $swipeoutContent.transform(`translate3d(${newTranslate}px,0,0)`);\n $actions.addClass('swipeout-actions-opened');\n $buttons = direction === 'to-left' ? $rightButtons : $leftButtons;\n if ($buttons) {\n for (i = 0; i < $buttons.length; i += 1) {\n $($buttons[i]).transform(`translate3d(${newTranslate}px,0,0)`);\n }\n }\n if (overswipeRight) {\n $actionsRight.find('.swipeout-overswipe').trigger('click', 'f7Overswipe');\n }\n if (overswipeLeft) {\n $actionsLeft.find('.swipeout-overswipe').trigger('click', 'f7Overswipe');\n }\n } else {\n $swipeoutEl.trigger('swipeout:close');\n app.emit('swipeoutClose', $swipeoutEl[0]);\n Swipeout.el = undefined;\n $swipeoutEl.addClass('swipeout-transitioning').removeClass('swipeout-opened');\n $swipeoutContent.transform('');\n $actions.removeClass('swipeout-actions-opened');\n }\n let buttonOffset;\n if ($leftButtons && $leftButtons.length > 0 && $leftButtons !== $buttons) {\n $leftButtons.each(buttonEl => {\n const $buttonEl = $(buttonEl);\n buttonOffset = buttonEl.f7SwipeoutButtonOffset;\n if (typeof buttonOffset === 'undefined') {\n $buttonEl[0].f7SwipeoutButtonOffset = actionsLeftWidth - buttonEl.offsetLeft - buttonEl.offsetWidth;\n }\n $buttonEl.transform(`translate3d(${buttonOffset}px,0,0)`);\n });\n }\n if ($rightButtons && $rightButtons.length > 0 && $rightButtons !== $buttons) {\n $rightButtons.each(buttonEl => {\n const $buttonEl = $(buttonEl);\n buttonOffset = buttonEl.f7SwipeoutButtonOffset;\n if (typeof buttonOffset === 'undefined') {\n $buttonEl[0].f7SwipeoutButtonOffset = buttonEl.offsetLeft;\n }\n $buttonEl.transform(`translate3d(${-buttonOffset}px,0,0)`);\n });\n }\n $swipeoutContent.transitionEnd(() => {\n if (opened && action === 'open' || !opened && action === 'close') return;\n $swipeoutEl.trigger(action === 'open' ? 'swipeout:opened' : 'swipeout:closed');\n app.emit(action === 'open' ? 'swipeoutOpened' : 'swipeoutClosed', $swipeoutEl[0]);\n $swipeoutEl.removeClass('swipeout-transitioning');\n if (opened && action === 'close') {\n if ($actionsRight.length > 0) {\n $rightButtons.transform('');\n }\n if ($actionsLeft.length > 0) {\n $leftButtons.transform('');\n }\n }\n });\n }\n const passiveListener = getSupport().passiveListener ? {\n passive: true\n } : false;\n app.on('touchstart', e => {\n if (Swipeout.el) {\n const $targetEl = $(e.target);\n if (!($(Swipeout.el).is($targetEl[0]) || $targetEl.parents('.swipeout').is(Swipeout.el) || $targetEl.hasClass('modal-in') || ($targetEl.attr('class') || '').indexOf('-backdrop') > 0 || $targetEl.hasClass('actions-modal') || $targetEl.parents('.actions-modal.modal-in, .dialog.modal-in').length > 0)) {\n app.swipeout.close(Swipeout.el);\n }\n }\n });\n $(document).on(app.touchEvents.start, 'li.swipeout', handleTouchStart, passiveListener);\n app.on('touchmove:active', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n },\n allow: true,\n el: undefined,\n open() {\n const app = this;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n let [el, side, callback] = args;\n if (typeof args[1] === 'function') {\n [el, callback, side] = args;\n }\n const $el = $(el).eq(0);\n if ($el.length === 0) return;\n if (!$el.hasClass('swipeout') || $el.hasClass('swipeout-opened')) return;\n if (!side) {\n if ($el.find('.swipeout-actions-right').length > 0) side = 'right';else side = 'left';\n }\n const $swipeoutActions = $el.find(`.swipeout-actions-${side}`);\n const $swipeoutContent = $el.find('.swipeout-content');\n if ($swipeoutActions.length === 0) return;\n $el.trigger('swipeout:open').addClass('swipeout-opened').removeClass('swipeout-transitioning');\n app.emit('swipeoutOpen', $el[0]);\n $swipeoutActions.addClass('swipeout-actions-opened');\n const $buttons = $swipeoutActions.children('a');\n const swipeoutActionsWidth = $swipeoutActions.outerWidth();\n const translate = side === 'right' ? -swipeoutActionsWidth : swipeoutActionsWidth;\n if ($buttons.length > 1) {\n $buttons.each((buttonEl, buttonIndex) => {\n const $buttonEl = $(buttonEl);\n if (side === 'right') {\n $buttonEl.transform(`translate3d(${-buttonEl.offsetLeft}px,0,0)`);\n } else {\n $buttonEl.css('z-index', $buttons.length - buttonIndex).transform(`translate3d(${swipeoutActionsWidth - buttonEl.offsetWidth - buttonEl.offsetLeft}px,0,0)`);\n }\n });\n }\n $el.addClass('swipeout-transitioning');\n $swipeoutContent.transitionEnd(() => {\n $el.trigger('swipeout:opened');\n app.emit('swipeoutOpened', $el[0]);\n if (callback) callback.call($el[0]);\n });\n nextFrame(() => {\n $buttons.transform(`translate3d(${translate}px,0,0)`);\n $swipeoutContent.transform(`translate3d(${translate}px,0,0)`);\n });\n Swipeout.el = $el[0];\n },\n close(el, callback) {\n const app = this;\n const $el = $(el).eq(0);\n if ($el.length === 0) return;\n if (!$el.hasClass('swipeout-opened')) return;\n const side = $el.find('.swipeout-actions-opened').hasClass('swipeout-actions-right') ? 'right' : 'left';\n const $swipeoutActions = $el.find('.swipeout-actions-opened').removeClass('swipeout-actions-opened');\n const $buttons = $swipeoutActions.children('a');\n const swipeoutActionsWidth = $swipeoutActions.outerWidth();\n app.swipeout.allow = false;\n $el.trigger('swipeout:close');\n app.emit('swipeoutClose', $el[0]);\n $el.removeClass('swipeout-opened').addClass('swipeout-transitioning');\n let closeTimeout;\n function onSwipeoutClose() {\n app.swipeout.allow = true;\n if ($el.hasClass('swipeout-opened')) return;\n $el.removeClass('swipeout-transitioning');\n $buttons.transform('');\n $el.trigger('swipeout:closed');\n app.emit('swipeoutClosed', $el[0]);\n if (callback) callback.call($el[0]);\n if (closeTimeout) clearTimeout(closeTimeout);\n }\n $el.find('.swipeout-content').transform('').transitionEnd(onSwipeoutClose);\n closeTimeout = setTimeout(onSwipeoutClose, 500);\n $buttons.each(buttonEl => {\n const $buttonEl = $(buttonEl);\n if (side === 'right') {\n $buttonEl.transform(`translate3d(${-buttonEl.offsetLeft}px,0,0)`);\n } else {\n $buttonEl.transform(`translate3d(${swipeoutActionsWidth - buttonEl.offsetWidth - buttonEl.offsetLeft}px,0,0)`);\n }\n $buttonEl.css({\n left: '0px'\n }).removeClass('swipeout-overswipe-active');\n });\n if (Swipeout.el && Swipeout.el === $el[0]) Swipeout.el = undefined;\n },\n delete(el, callback) {\n const app = this;\n const $el = $(el).eq(0);\n if ($el.length === 0) return;\n Swipeout.el = undefined;\n $el.trigger('swipeout:delete');\n app.emit('swipeoutDelete', $el[0]);\n $el.css({\n height: `${$el.outerHeight()}px`\n });\n $el.transitionEnd(() => {\n $el.trigger('swipeout:deleted');\n app.emit('swipeoutDeleted', $el[0]);\n if (callback) callback.call($el[0]);\n if ($el.parents('.virtual-list').length > 0) {\n const virtualList = $el.parents('.virtual-list')[0].f7VirtualList;\n const virtualIndex = $el[0].f7VirtualListIndex;\n if (virtualList && typeof virtualIndex !== 'undefined') virtualList.deleteItem(virtualIndex);\n } else if (app.params.swipeout.removeElements) {\n if (app.params.swipeout.removeElementsWithTimeout) {\n setTimeout(() => {\n $el.remove();\n }, app.params.swipeout.removeElementsTimeout);\n } else {\n $el.remove();\n }\n } else {\n $el.removeClass('swipeout-deleting swipeout-transitioning');\n }\n });\n // eslint-disable-next-line\n // $el[0]._clientLeft = $el[0].clientLeft;\n nextFrame(() => {\n $el.addClass('swipeout-deleting swipeout-transitioning').css({\n height: '0px'\n }).find('.swipeout-content').transform('translate3d(-100%,0,0)');\n });\n }\n};\nexport default {\n name: 'swipeout',\n params: {\n swipeout: {\n actionsNoFold: false,\n noFollow: false,\n removeElements: true,\n removeElementsWithTimeout: false,\n removeElementsTimeout: 0,\n overswipeRatio: 1.2\n }\n },\n create() {\n const app = this;\n bindMethods(app, {\n swipeout: Swipeout\n });\n },\n clicks: {\n '.swipeout-open': function openSwipeout($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.swipeout.open(data.swipeout, data.side);\n },\n '.swipeout-close': function closeSwipeout($clickedEl) {\n const app = this;\n const $swipeoutEl = $clickedEl.closest('.swipeout');\n if ($swipeoutEl.length === 0) return;\n app.swipeout.close($swipeoutEl);\n },\n '.swipeout-delete': function deleteSwipeout($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n const $swipeoutEl = $clickedEl.closest('.swipeout');\n if ($swipeoutEl.length === 0) return;\n const {\n confirm,\n confirmTitle\n } = data;\n if (data.confirm) {\n app.dialog.confirm(confirm, confirmTitle, () => {\n app.swipeout.delete($swipeoutEl);\n });\n } else {\n app.swipeout.delete($swipeoutEl);\n }\n }\n },\n on: {\n init() {\n const app = this;\n if (!app.params.swipeout) return;\n app.swipeout.init();\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { nextFrame, bindMethods } from '../../shared/utils.js';\nconst Accordion = {\n toggleClicked($clickedEl) {\n const app = this;\n let $accordionItemEl = $clickedEl.closest('.accordion-item').eq(0);\n if (!$accordionItemEl.length) $accordionItemEl = $clickedEl.parents('li').eq(0);\n const $accordionContent = $clickedEl.parents('.accordion-item-content').eq(0);\n if ($accordionContent.length) {\n if ($accordionContent.parents($accordionItemEl).length) return;\n }\n if ($clickedEl.parents('li').length > 1 && $clickedEl.parents('li')[0] !== $accordionItemEl[0]) return;\n app.accordion.toggle($accordionItemEl);\n },\n open(el) {\n const app = this;\n const $el = $(el);\n let prevented = false;\n function prevent() {\n prevented = true;\n }\n $el.trigger('accordion:beforeopen', {\n prevent\n }, prevent);\n app.emit('accordionBeforeOpen', $el[0], prevent);\n if (prevented) return;\n const $list = $el.parents('.accordion-list').eq(0);\n let $contentEl = $el.children('.accordion-item-content');\n $contentEl.removeAttr('aria-hidden');\n if ($contentEl.length === 0) $contentEl = $el.find('.accordion-item-content');\n if ($contentEl.length === 0) return;\n const $openedItem = $list.length > 0 && $el.parent().children('.accordion-item-opened');\n if ($openedItem.length > 0) {\n app.accordion.close($openedItem);\n }\n $contentEl.transitionEnd(() => {\n if ($el.hasClass('accordion-item-opened')) {\n $contentEl.transition(0);\n $contentEl.css('height', 'auto');\n nextFrame(() => {\n $contentEl.transition('');\n $el.trigger('accordion:opened');\n app.emit('accordionOpened', $el[0]);\n });\n } else {\n $contentEl.css('height', '');\n $el.trigger('accordion:closed');\n app.emit('accordionClosed', $el[0]);\n }\n });\n $contentEl.css('height', `${$contentEl[0].scrollHeight}px`);\n $el.trigger('accordion:open');\n $el.addClass('accordion-item-opened');\n app.emit('accordionOpen', $el[0]);\n },\n close(el) {\n const app = this;\n const $el = $(el);\n let prevented = false;\n function prevent() {\n prevented = true;\n }\n $el.trigger('accordion:beforeclose', {\n prevent\n }, prevent);\n app.emit('accordionBeforeClose', $el[0], prevent);\n if (prevented) return;\n let $contentEl = $el.children('.accordion-item-content');\n if ($contentEl.length === 0) $contentEl = $el.find('.accordion-item-content');\n $el.removeClass('accordion-item-opened');\n $contentEl.attr('aria-hidden', true);\n $contentEl.transition(0);\n $contentEl.css('height', `${$contentEl[0].scrollHeight}px`);\n // Close\n $contentEl.transitionEnd(() => {\n if ($el.hasClass('accordion-item-opened')) {\n $contentEl.transition(0);\n $contentEl.css('height', 'auto');\n nextFrame(() => {\n $contentEl.transition('');\n $el.trigger('accordion:opened');\n app.emit('accordionOpened', $el[0]);\n });\n } else {\n $contentEl.css('height', '');\n $el.trigger('accordion:closed');\n app.emit('accordionClosed', $el[0]);\n }\n });\n nextFrame(() => {\n $contentEl.transition('');\n $contentEl.css('height', '');\n $el.trigger('accordion:close');\n app.emit('accordionClose', $el[0]);\n });\n },\n toggle(el) {\n const app = this;\n const $el = $(el);\n if ($el.length === 0) return;\n if ($el.hasClass('accordion-item-opened')) app.accordion.close(el);else app.accordion.open(el);\n }\n};\nexport default {\n name: 'accordion',\n create() {\n const app = this;\n bindMethods(app, {\n accordion: Accordion\n });\n },\n clicks: {\n '.accordion-item .item-link, .accordion-item-toggle, .links-list.accordion-list > ul > li > a': function open($clickedEl) {\n const app = this;\n Accordion.toggleClicked.call(app, $clickedEl);\n }\n }\n};", "export default {\n name: 'contactsList'\n};", "import { getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\nimport { getDevice } from '../../shared/get-device.js';\nclass VirtualList extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const vl = this;\n const device = getDevice();\n const document = getDocument();\n let defaultHeight;\n if (app.theme === 'md') {\n defaultHeight = 48;\n } else if (app.theme === 'ios') {\n defaultHeight = 44;\n }\n const defaults = {\n cols: 1,\n height: defaultHeight,\n cache: true,\n dynamicHeightBufferSize: 1,\n showFilteredItemsOnly: false,\n renderExternal: undefined,\n setListHeight: true,\n searchByItem: undefined,\n searchAll: undefined,\n ul: null,\n createUl: true,\n scrollableParentEl: undefined,\n renderItem(item) {\n return `\n \n \n \n `.trim();\n },\n on: {}\n };\n\n // Extend defaults with modules params\n vl.useModulesParams(defaults);\n vl.params = extend(defaults, params);\n if (vl.params.height === undefined || !vl.params.height) {\n vl.params.height = defaultHeight;\n }\n vl.$el = $(params.el);\n vl.el = vl.$el[0];\n if (vl.$el.length === 0) return undefined;\n vl.$el[0].f7VirtualList = vl;\n vl.items = vl.params.items;\n if (vl.params.showFilteredItemsOnly) {\n vl.filteredItems = [];\n }\n if (vl.params.renderItem) {\n vl.renderItem = vl.params.renderItem;\n }\n vl.$pageContentEl = vl.$el.parents('.page-content');\n vl.pageContentEl = vl.$pageContentEl[0];\n vl.$scrollableParentEl = vl.params.scrollableParentEl ? $(vl.params.scrollableParentEl).eq(0) : vl.$pageContentEl;\n if (!vl.$scrollableParentEl.length && vl.$pageContentEl.length) {\n vl.$scrollableParentEl = vl.$pageContentEl;\n }\n vl.scrollableParentEl = vl.$scrollableParentEl[0];\n\n // Bad scroll\n if (typeof vl.params.updatableScroll !== 'undefined') {\n vl.updatableScroll = vl.params.updatableScroll;\n } else {\n vl.updatableScroll = true;\n if (device.ios && device.osVersion.split('.')[0] < 8) {\n vl.updatableScroll = false;\n }\n }\n\n // Append \n const ul = vl.params.ul;\n vl.$ul = ul ? $(vl.params.ul) : vl.$el.children('ul');\n if (vl.$ul.length === 0 && vl.params.createUl) {\n vl.$el.append('');\n vl.$ul = vl.$el.children('ul');\n }\n vl.ul = vl.$ul[0];\n let $itemsWrapEl;\n if (!vl.ul && !vl.params.createUl) $itemsWrapEl = vl.$el;else $itemsWrapEl = vl.$ul;\n extend(vl, {\n $itemsWrapEl,\n itemsWrapEl: $itemsWrapEl[0],\n // DOM cached items\n domCache: {},\n // Temporary DOM Element\n tempDomElement: document.createElement('ul'),\n // Last repain position\n lastRepaintY: null,\n // Fragment\n fragment: document.createDocumentFragment(),\n // Props\n pageHeight: undefined,\n rowsPerScreen: undefined,\n rowsBefore: undefined,\n rowsAfter: undefined,\n rowsToRender: undefined,\n maxBufferHeight: 0,\n listHeight: undefined,\n dynamicHeight: typeof vl.params.height === 'function',\n autoHeight: vl.params.height === 'auto'\n });\n\n // Install Modules\n vl.useModules();\n\n // Attach events\n const handleScrollBound = vl.handleScroll.bind(vl);\n const handleResizeBound = vl.handleResize.bind(vl);\n let $pageEl;\n let $tabEl;\n let $panelEl;\n let $popupEl;\n vl.attachEvents = function attachEvents() {\n $pageEl = vl.$el.parents('.page').eq(0);\n $tabEl = vl.$el.parents('.tab').filter(tabEl => {\n return $(tabEl).parent('.tabs').parent('.tabs-animated-wrap, swiper-container.tabs').length === 0;\n }).eq(0);\n $panelEl = vl.$el.parents('.panel').eq(0);\n $popupEl = vl.$el.parents('.popup').eq(0);\n vl.$scrollableParentEl.on('scroll', handleScrollBound);\n if ($pageEl.length) $pageEl.on('page:reinit', handleResizeBound);\n if ($tabEl.length) $tabEl.on('tab:show', handleResizeBound);\n if ($panelEl.length) $panelEl.on('panel:open', handleResizeBound);\n if ($popupEl.length) $popupEl.on('popup:open', handleResizeBound);\n app.on('resize', handleResizeBound);\n };\n vl.detachEvents = function attachEvents() {\n vl.$scrollableParentEl.off('scroll', handleScrollBound);\n if ($pageEl.length) $pageEl.off('page:reinit', handleResizeBound);\n if ($tabEl.length) $tabEl.off('tab:show', handleResizeBound);\n if ($panelEl.length) $panelEl.off('panel:open', handleResizeBound);\n if ($popupEl.length) $popupEl.off('popup:open', handleResizeBound);\n app.off('resize', handleResizeBound);\n };\n // Init\n vl.init();\n return vl;\n }\n setListSize(autoHeightRerender) {\n const vl = this;\n const items = vl.filteredItems || vl.items;\n if (!autoHeightRerender) {\n vl.pageHeight = vl.$scrollableParentEl[0].offsetHeight;\n }\n if (vl.dynamicHeight) {\n vl.listHeight = 0;\n vl.heights = [];\n for (let i = 0; i < items.length; i += 1) {\n const itemHeight = vl.params.height(items[i]);\n vl.listHeight += itemHeight;\n vl.heights.push(itemHeight);\n }\n } else if (vl.autoHeight) {\n vl.listHeight = 0;\n if (!vl.heights) vl.heights = [];\n if (!vl.heightsCalculated) vl.heightsCalculated = [];\n const renderedItems = {};\n vl.$itemsWrapEl.find(`[data-virtual-list-index]`).forEach(el => {\n renderedItems[parseInt(el.getAttribute('data-virtual-list-index'), 10)] = el;\n });\n for (let i = 0; i < items.length; i += 1) {\n const itemIndex = vl.items.indexOf(items[i]);\n const renderedItem = renderedItems[itemIndex];\n if (renderedItem) {\n if (!vl.heightsCalculated.includes(itemIndex)) {\n vl.heights[itemIndex] = renderedItem.offsetHeight;\n vl.heightsCalculated.push(itemIndex);\n }\n }\n if (typeof vl.heights[i] === 'undefined') {\n vl.heights[itemIndex] = 40;\n }\n vl.listHeight += vl.heights[itemIndex];\n }\n } else {\n vl.listHeight = Math.ceil(items.length / vl.params.cols) * vl.params.height;\n vl.rowsPerScreen = Math.ceil(vl.pageHeight / vl.params.height);\n vl.rowsBefore = vl.params.rowsBefore || vl.rowsPerScreen * 2;\n vl.rowsAfter = vl.params.rowsAfter || vl.rowsPerScreen;\n vl.rowsToRender = vl.rowsPerScreen + vl.rowsBefore + vl.rowsAfter;\n vl.maxBufferHeight = vl.rowsBefore / 2 * vl.params.height;\n }\n if (vl.updatableScroll || vl.params.setListHeight) {\n vl.$itemsWrapEl.css({\n height: `${vl.listHeight}px`\n });\n }\n }\n render(force, forceScrollTop) {\n const vl = this;\n if (force) vl.lastRepaintY = null;\n let scrollTop = -(vl.$el[0].getBoundingClientRect().top - vl.$scrollableParentEl[0].getBoundingClientRect().top);\n if (typeof forceScrollTop !== 'undefined') scrollTop = forceScrollTop;\n if (vl.lastRepaintY === null || Math.abs(scrollTop - vl.lastRepaintY) > vl.maxBufferHeight || !vl.updatableScroll && vl.$scrollableParentEl[0].scrollTop + vl.pageHeight >= vl.$scrollableParentEl[0].scrollHeight) {\n vl.lastRepaintY = scrollTop;\n } else {\n return;\n }\n const items = vl.filteredItems || vl.items;\n let fromIndex;\n let toIndex;\n let heightBeforeFirstItem = 0;\n let heightBeforeLastItem = 0;\n if (vl.dynamicHeight || vl.autoHeight) {\n let itemTop = 0;\n let itemHeight;\n vl.maxBufferHeight = vl.pageHeight;\n for (let j = 0; j < vl.heights.length; j += 1) {\n itemHeight = vl.heights[j];\n if (typeof fromIndex === 'undefined') {\n if (itemTop + itemHeight >= scrollTop - vl.pageHeight * 2 * vl.params.dynamicHeightBufferSize) fromIndex = j;else heightBeforeFirstItem += itemHeight;\n }\n if (typeof toIndex === 'undefined') {\n if (itemTop + itemHeight >= scrollTop + vl.pageHeight * 2 * vl.params.dynamicHeightBufferSize || j === vl.heights.length - 1) toIndex = j + 1;\n heightBeforeLastItem += itemHeight;\n }\n itemTop += itemHeight;\n }\n toIndex = Math.min(toIndex, items.length);\n } else {\n fromIndex = (parseInt(scrollTop / vl.params.height, 10) - vl.rowsBefore) * vl.params.cols;\n if (fromIndex < 0) {\n fromIndex = 0;\n }\n toIndex = Math.min(fromIndex + vl.rowsToRender * vl.params.cols, items.length);\n }\n let topPosition;\n const renderExternalItems = [];\n vl.reachEnd = false;\n let i;\n for (i = fromIndex; i < toIndex; i += 1) {\n let itemEl;\n // Define real item index\n const index = vl.items.indexOf(items[i]);\n if (i === fromIndex) vl.currentFromIndex = index;\n if (i === toIndex - 1) vl.currentToIndex = index;\n if (vl.filteredItems) {\n if (vl.items[index] === vl.filteredItems[vl.filteredItems.length - 1]) vl.reachEnd = true;\n } else if (index === vl.items.length - 1) vl.reachEnd = true;\n\n // Find items\n if (vl.params.renderExternal) {\n renderExternalItems.push(items[i]);\n } else if (vl.domCache[index]) {\n itemEl = vl.domCache[index];\n itemEl.f7VirtualListIndex = index;\n } else {\n if (vl.renderItem) {\n vl.tempDomElement.innerHTML = vl.renderItem(items[i], index).trim();\n } else {\n vl.tempDomElement.innerHTML = items[i].toString().trim();\n }\n itemEl = vl.tempDomElement.childNodes[0];\n if (vl.params.cache) vl.domCache[index] = itemEl;\n itemEl.f7VirtualListIndex = index;\n }\n\n // Set item top position\n if (i === fromIndex) {\n if (vl.dynamicHeight || vl.autoHeight) {\n topPosition = heightBeforeFirstItem;\n } else {\n topPosition = i * vl.params.height / vl.params.cols;\n }\n }\n if (!vl.params.renderExternal) {\n itemEl.style.top = `${topPosition}px`;\n\n // Before item insert\n vl.emit('local::itemBeforeInsert vlItemBeforeInsert', vl, itemEl, items[i]);\n\n // Append item to fragment\n vl.fragment.appendChild(itemEl);\n }\n }\n\n // Update list height with not updatable scroll\n if (!vl.updatableScroll) {\n if (vl.dynamicHeight || vl.autoHeight) {\n vl.itemsWrapEl.style.height = `${heightBeforeLastItem}px`;\n } else {\n vl.itemsWrapEl.style.height = `${i * vl.params.height / vl.params.cols}px`;\n }\n }\n\n // Update list html\n if (vl.params.renderExternal) {\n if (items && items.length === 0) {\n vl.reachEnd = true;\n }\n } else {\n vl.emit('local::beforeClear vlBeforeClear', vl, vl.fragment);\n vl.itemsWrapEl.innerHTML = '';\n vl.emit('local::itemsBeforeInsert vlItemsBeforeInsert', vl, vl.fragment);\n if (items && items.length === 0) {\n vl.reachEnd = true;\n if (vl.params.emptyTemplate) vl.itemsWrapEl.innerHTML = vl.params.emptyTemplate;\n } else {\n vl.itemsWrapEl.appendChild(vl.fragment);\n }\n vl.emit('local::itemsAfterInsert vlItemsAfterInsert', vl, vl.fragment);\n }\n if (typeof forceScrollTop !== 'undefined' && force) {\n vl.$scrollableParentEl.scrollTop(forceScrollTop, 0);\n }\n if (vl.params.renderExternal) {\n vl.params.renderExternal(vl, {\n fromIndex,\n toIndex,\n listHeight: vl.listHeight,\n topPosition,\n items: renderExternalItems\n });\n }\n if (vl.autoHeight) {\n requestAnimationFrame(() => {\n vl.setListSize(true);\n });\n }\n }\n\n // Filter\n filterItems(indexes, resetScrollTop) {\n if (resetScrollTop === void 0) {\n resetScrollTop = true;\n }\n const vl = this;\n vl.filteredItems = [];\n for (let i = 0; i < indexes.length; i += 1) {\n vl.filteredItems.push(vl.items[indexes[i]]);\n }\n if (resetScrollTop) {\n vl.$scrollableParentEl[0].scrollTop = 0;\n }\n vl.update();\n }\n resetFilter() {\n const vl = this;\n if (vl.params.showFilteredItemsOnly) {\n vl.filteredItems = [];\n } else {\n vl.filteredItems = null;\n delete vl.filteredItems;\n }\n vl.update();\n }\n scrollToItem(index) {\n const vl = this;\n if (index > vl.items.length) return false;\n let itemTop = 0;\n if (vl.dynamicHeight || vl.autoHeight) {\n for (let i = 0; i < index; i += 1) {\n itemTop += vl.heights[i];\n }\n } else {\n itemTop = index * vl.params.height;\n }\n const listTop = vl.$el[0].offsetTop;\n vl.render(true, listTop + itemTop - parseInt(vl.$scrollableParentEl.css('padding-top'), 10));\n return true;\n }\n handleScroll() {\n const vl = this;\n vl.render();\n }\n\n // Handle resize event\n isVisible() {\n const vl = this;\n return !!(vl.el.offsetWidth || vl.el.offsetHeight || vl.el.getClientRects().length);\n }\n handleResize() {\n const vl = this;\n if (vl.isVisible()) {\n vl.heightsCalculated = [];\n vl.setListSize();\n vl.render(true);\n }\n }\n\n // Append\n appendItems(items) {\n const vl = this;\n for (let i = 0; i < items.length; i += 1) {\n vl.items.push(items[i]);\n }\n vl.update();\n }\n appendItem(item) {\n const vl = this;\n vl.appendItems([item]);\n }\n\n // Replace\n replaceAllItems(items) {\n const vl = this;\n vl.items = items;\n delete vl.filteredItems;\n vl.domCache = {};\n vl.update();\n }\n replaceItem(index, item) {\n const vl = this;\n vl.items[index] = item;\n if (vl.params.cache) delete vl.domCache[index];\n vl.update();\n }\n\n // Prepend\n prependItems(items) {\n const vl = this;\n for (let i = items.length - 1; i >= 0; i -= 1) {\n vl.items.unshift(items[i]);\n }\n if (vl.params.cache) {\n const newCache = {};\n Object.keys(vl.domCache).forEach(cached => {\n newCache[parseInt(cached, 10) + items.length] = vl.domCache[cached];\n });\n vl.domCache = newCache;\n }\n vl.update();\n }\n prependItem(item) {\n const vl = this;\n vl.prependItems([item]);\n }\n\n // Move\n moveItem(from, to) {\n const vl = this;\n const fromIndex = from;\n let toIndex = to;\n if (fromIndex === toIndex) return;\n // remove item from array\n const item = vl.items.splice(fromIndex, 1)[0];\n if (toIndex >= vl.items.length) {\n // Add item to the end\n vl.items.push(item);\n toIndex = vl.items.length - 1;\n } else {\n // Add item to new index\n vl.items.splice(toIndex, 0, item);\n }\n // Update cache\n if (vl.params.cache) {\n const newCache = {};\n Object.keys(vl.domCache).forEach(cached => {\n const cachedIndex = parseInt(cached, 10);\n const leftIndex = fromIndex < toIndex ? fromIndex : toIndex;\n const rightIndex = fromIndex < toIndex ? toIndex : fromIndex;\n const indexShift = fromIndex < toIndex ? -1 : 1;\n if (cachedIndex < leftIndex || cachedIndex > rightIndex) newCache[cachedIndex] = vl.domCache[cachedIndex];\n if (cachedIndex === leftIndex) newCache[rightIndex] = vl.domCache[cachedIndex];\n if (cachedIndex > leftIndex && cachedIndex <= rightIndex) newCache[cachedIndex + indexShift] = vl.domCache[cachedIndex];\n });\n vl.domCache = newCache;\n }\n vl.update();\n }\n\n // Insert before\n insertItemBefore(index, item) {\n const vl = this;\n if (index === 0) {\n vl.prependItem(item);\n return;\n }\n if (index >= vl.items.length) {\n vl.appendItem(item);\n return;\n }\n vl.items.splice(index, 0, item);\n // Update cache\n if (vl.params.cache) {\n const newCache = {};\n Object.keys(vl.domCache).forEach(cached => {\n const cachedIndex = parseInt(cached, 10);\n if (cachedIndex >= index) {\n newCache[cachedIndex + 1] = vl.domCache[cachedIndex];\n }\n });\n vl.domCache = newCache;\n }\n vl.update();\n }\n\n // Delete\n deleteItems(indexes) {\n const vl = this;\n let prevIndex;\n let indexShift = 0;\n for (let i = 0; i < indexes.length; i += 1) {\n let index = indexes[i];\n if (typeof prevIndex !== 'undefined') {\n if (index > prevIndex) {\n indexShift = -i;\n }\n }\n index += indexShift;\n prevIndex = indexes[i];\n // Delete item\n const deletedItem = vl.items.splice(index, 1)[0];\n\n // Delete from filtered\n if (vl.filteredItems && vl.filteredItems.indexOf(deletedItem) >= 0) {\n vl.filteredItems.splice(vl.filteredItems.indexOf(deletedItem), 1);\n }\n // Update cache\n if (vl.params.cache) {\n const newCache = {};\n Object.keys(vl.domCache).forEach(cached => {\n const cachedIndex = parseInt(cached, 10);\n if (cachedIndex === index) {\n delete vl.domCache[index];\n } else if (parseInt(cached, 10) > index) {\n newCache[cachedIndex - 1] = vl.domCache[cached];\n } else {\n newCache[cachedIndex] = vl.domCache[cached];\n }\n });\n vl.domCache = newCache;\n }\n }\n vl.update();\n }\n deleteAllItems() {\n const vl = this;\n vl.items = [];\n delete vl.filteredItems;\n if (vl.params.cache) vl.domCache = {};\n vl.update();\n }\n deleteItem(index) {\n const vl = this;\n vl.deleteItems([index]);\n }\n\n // Clear cache\n clearCache() {\n const vl = this;\n vl.domCache = {};\n }\n\n // Update Virtual List\n update(deleteCache) {\n const vl = this;\n if (deleteCache && vl.params.cache) {\n vl.domCache = {};\n }\n vl.heightsCalculated = [];\n vl.setListSize();\n vl.render(true);\n }\n init() {\n const vl = this;\n vl.attachEvents();\n vl.setListSize();\n vl.render();\n }\n destroy() {\n let vl = this;\n vl.detachEvents();\n vl.$el[0].f7VirtualList = null;\n delete vl.$el[0].f7VirtualList;\n deleteProps(vl);\n vl = null;\n }\n}\nexport default VirtualList;", "import VirtualList from './virtual-list-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'virtualList',\n static: {\n VirtualList\n },\n create() {\n const app = this;\n app.virtualList = ConstructorMethods({\n defaultSelector: '.virtual-list',\n constructor: VirtualList,\n app,\n domProp: 'f7VirtualList'\n });\n }\n};", "import $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\nimport { getSupport } from '../../shared/get-support.js';\nclass ListIndex extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const index = this;\n const defaults = {\n el: null,\n // where to render indexes\n listEl: null,\n // list el to generate indexes\n indexes: 'auto',\n // or array of indexes\n iosItemHeight: 14,\n mdItemHeight: 14,\n scrollList: true,\n label: false,\n // eslint-disable-next-line\n renderItem(itemContent, itemIndex) {\n return `\n - ${itemContent}
\n `.trim();\n },\n renderSkipPlaceholder() {\n return '';\n },\n on: {}\n };\n\n // Extend defaults with modules params\n index.useModulesParams(defaults);\n index.params = extend(defaults, params);\n let $el;\n let $listEl;\n let $pageContentEl;\n let $ul;\n if (index.params.el) {\n $el = $(index.params.el);\n } else {\n return index;\n }\n if ($el[0].f7ListIndex) {\n return $el[0].f7ListIndex;\n }\n $ul = $el.find('ul');\n if ($ul.length === 0) {\n $ul = $('');\n $el.append($ul);\n }\n if (index.params.listEl) {\n $listEl = $(index.params.listEl);\n }\n if (index.params.indexes === 'auto' && !$listEl) {\n return index;\n }\n if ($listEl) {\n $pageContentEl = $listEl.parents('.page-content').eq(0);\n } else {\n $pageContentEl = $el.siblings('.page-content').eq(0);\n if ($pageContentEl.length === 0) {\n $pageContentEl = $el.parents('.page').eq(0).find('.page-content').eq(0);\n }\n }\n $el[0].f7ListIndex = index;\n extend(index, {\n app,\n $el,\n el: $el && $el[0],\n $ul,\n ul: $ul && $ul[0],\n $listEl,\n listEl: $listEl && $listEl[0],\n $pageContentEl,\n pageContentEl: $pageContentEl && $pageContentEl[0],\n indexes: params.indexes,\n height: 0,\n skipRate: 0\n });\n\n // Install Modules\n index.useModules();\n\n // Attach events\n function handleResize() {\n const height = {\n index\n };\n index.calcSize();\n if (height !== index.height) {\n index.render();\n }\n }\n function handleClick(e) {\n const $clickedLi = $(e.target).closest('li');\n if (!$clickedLi.length) return;\n let itemIndex = $clickedLi.index();\n if (index.skipRate > 0) {\n const percentage = itemIndex / ($clickedLi.siblings('li').length - 1);\n itemIndex = Math.round((index.indexes.length - 1) * percentage);\n }\n const itemContent = index.indexes[itemIndex];\n index.$el.trigger('listindex:click', {\n content: itemContent,\n index: itemIndex\n });\n index.emit('local::click listIndexClick', index, itemContent, itemIndex);\n index.$el.trigger('listindex:select', {\n content: itemContent,\n index: itemIndex\n });\n index.emit('local::select listIndexSelect', index, itemContent, itemIndex);\n if (index.$listEl && index.params.scrollList) {\n index.scrollListToIndex(itemContent, itemIndex);\n }\n }\n const touchesStart = {};\n let isTouched;\n let isMoved;\n let topPoint;\n let bottomPoint;\n let $labelEl;\n let previousIndex = null;\n function handleTouchStart(e) {\n const $children = $ul.children();\n if (!$children.length) return;\n topPoint = $children[0].getBoundingClientRect().top;\n bottomPoint = $children[$children.length - 1].getBoundingClientRect().top + $children[0].offsetHeight;\n touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n isTouched = true;\n isMoved = false;\n previousIndex = null;\n }\n function handleTouchMove(e) {\n if (!isTouched) return;\n if (!isMoved && index.params.label) {\n $labelEl = $('');\n $el.append($labelEl);\n }\n isMoved = true;\n const pageY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n e.preventDefault();\n let percentage = (pageY - topPoint) / (bottomPoint - topPoint);\n percentage = Math.min(Math.max(percentage, 0), 1);\n const itemIndex = Math.round((index.indexes.length - 1) * percentage);\n const itemContent = index.indexes[itemIndex];\n const ulHeight = bottomPoint - topPoint;\n const bubbleBottom = (index.height - ulHeight) / 2 + (1 - percentage) * ulHeight;\n if (itemIndex !== previousIndex) {\n if (index.params.label) {\n $labelEl.html(itemContent).transform(`translateY(-${bubbleBottom}px)`);\n }\n if (index.$listEl && index.params.scrollList) {\n index.scrollListToIndex(itemContent, itemIndex);\n }\n }\n previousIndex = itemIndex;\n index.$el.trigger('listindex:select');\n index.emit('local::select listIndexSelect', index, itemContent, itemIndex);\n }\n function handleTouchEnd() {\n if (!isTouched) return;\n isTouched = false;\n isMoved = false;\n if (index.params.label) {\n if ($labelEl) $labelEl.remove();\n $labelEl = undefined;\n }\n }\n const passiveListener = getSupport().passiveListener ? {\n passive: true\n } : false;\n index.attachEvents = function attachEvents() {\n $el.parents('.tab').on('tab:show', handleResize);\n $el.parents('.page').on('page:reinit', handleResize);\n $el.parents('.panel').on('panel:open', handleResize);\n $el.parents('.sheet-modal, .actions-modal, .popup, .popover, .login-screen, .dialog, .toast').on('modal:open', handleResize);\n app.on('resize', handleResize);\n $el.on('click', handleClick);\n $el.on(app.touchEvents.start, handleTouchStart, passiveListener);\n app.on('touchmove:active', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n };\n index.detachEvents = function attachEvents() {\n $el.parents('.tab').off('tab:show', handleResize);\n $el.parents('.page').off('page:reinit', handleResize);\n $el.parents('.panel').off('panel:open', handleResize);\n $el.parents('.sheet-modal, .actions-modal, .popup, .popover, .login-screen, .dialog, .toast').off('modal:open', handleResize);\n app.off('resize', handleResize);\n $el.off('click', handleClick);\n $el.off(app.touchEvents.start, handleTouchStart, passiveListener);\n app.off('touchmove:active', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n };\n // Init\n index.init();\n return index;\n }\n // eslint-disable-next-line\n scrollListToIndex(itemContent, itemIndex) {\n const index = this;\n const {\n $listEl,\n $pageContentEl,\n app\n } = index;\n if (!$listEl || !$pageContentEl || $pageContentEl.length === 0) return index;\n let $scrollToEl;\n $listEl.find('.list-group-title').each(el => {\n if ($scrollToEl) return;\n const $el = $(el);\n if ($el.text() === itemContent) {\n $scrollToEl = $el;\n }\n });\n if (!$scrollToEl || $scrollToEl.length === 0) return index;\n const parentTop = $scrollToEl.parent().offset().top;\n let paddingTop = parseInt($pageContentEl.css('padding-top'), 10);\n const scrollTop = $pageContentEl[0].scrollTop;\n const scrollToElTop = $scrollToEl.offset().top;\n if ($pageContentEl.parents('.page-with-navbar-large').length) {\n const navbarInnerEl = app.navbar.getElByPage($pageContentEl.parents('.page-with-navbar-large').eq(0));\n const $titleLargeEl = $(navbarInnerEl).find('.title-large');\n if ($titleLargeEl.length) {\n paddingTop -= $titleLargeEl[0].offsetHeight || 0;\n }\n }\n if (parentTop <= paddingTop) {\n $pageContentEl.scrollTop(parentTop + scrollTop - paddingTop);\n } else {\n $pageContentEl.scrollTop(scrollToElTop + scrollTop - paddingTop);\n }\n return index;\n }\n renderSkipPlaceholder() {\n const index = this;\n return index.params.renderSkipPlaceholder.call(index);\n }\n renderItem(itemContent, itemIndex) {\n const index = this;\n return index.params.renderItem.call(index, itemContent, itemIndex);\n }\n render() {\n const index = this;\n const {\n $ul,\n indexes,\n skipRate\n } = index;\n let wasSkipped;\n const html = indexes.map((itemContent, itemIndex) => {\n if (itemIndex % skipRate !== 0 && skipRate > 0) {\n wasSkipped = true;\n return '';\n }\n let itemHtml = index.renderItem(itemContent, itemIndex);\n if (wasSkipped) {\n itemHtml = index.renderSkipPlaceholder() + itemHtml;\n }\n wasSkipped = false;\n return itemHtml;\n }).join('');\n $ul.html(html);\n return index;\n }\n calcSize() {\n const index = this;\n const {\n app,\n params,\n el,\n indexes\n } = index;\n const height = el.offsetHeight;\n const itemHeight = params[`${app.theme}ItemHeight`];\n const maxItems = Math.floor(height / itemHeight);\n const items = indexes.length;\n let skipRate = 0;\n if (items > maxItems) {\n skipRate = Math.ceil((items * 2 - 1) / maxItems);\n }\n index.height = height;\n index.skipRate = skipRate;\n return index;\n }\n calcIndexes() {\n const index = this;\n if (index.params.indexes === 'auto') {\n index.indexes = [];\n index.$listEl.find('.list-group-title').each(el => {\n const elContent = $(el).text();\n if (index.indexes.indexOf(elContent) < 0) {\n index.indexes.push(elContent);\n }\n });\n } else {\n index.indexes = index.params.indexes;\n }\n return index;\n }\n update() {\n const index = this;\n index.calcIndexes();\n index.calcSize();\n index.render();\n return index;\n }\n init() {\n const index = this;\n index.calcIndexes();\n index.calcSize();\n index.render();\n index.attachEvents();\n }\n destroy() {\n let index = this;\n index.$el.trigger('listindex:beforedestroy', index);\n index.emit('local::beforeDestroy listIndexBeforeDestroy');\n index.detachEvents();\n if (index.$el[0]) {\n index.$el[0].f7ListIndex = null;\n delete index.$el[0].f7ListIndex;\n }\n deleteProps(index);\n index = null;\n }\n}\nexport default ListIndex;", "import $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nimport ListIndex from './list-index-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'listIndex',\n static: {\n ListIndex\n },\n create() {\n const app = this;\n app.listIndex = ConstructorMethods({\n defaultSelector: '.list-index',\n constructor: ListIndex,\n app,\n domProp: 'f7ListIndex'\n });\n },\n on: {\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.list-index-init').each(listIndexEl => {\n const params = extend($(listIndexEl).dataset(), {\n el: listIndexEl\n });\n app.listIndex.create(params);\n });\n },\n tabBeforeRemove(tabEl) {\n $(tabEl).find('.list-index-init').each(listIndexEl => {\n if (listIndexEl.f7ListIndex) listIndexEl.f7ListIndex.destroy();\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.list-index-init').each(listIndexEl => {\n const params = extend($(listIndexEl).dataset(), {\n el: listIndexEl\n });\n app.listIndex.create(params);\n });\n },\n pageBeforeRemove(page) {\n page.$el.find('.list-index-init').each(listIndexEl => {\n if (listIndexEl.f7ListIndex) listIndexEl.f7ListIndex.destroy();\n });\n }\n },\n vnode: {\n 'list-index-init': {\n insert(vnode) {\n const app = this;\n const listIndexEl = vnode.elm;\n const params = extend($(listIndexEl).dataset(), {\n el: listIndexEl\n });\n app.listIndex.create(params);\n },\n destroy(vnode) {\n const listIndexEl = vnode.elm;\n if (listIndexEl.f7ListIndex) listIndexEl.f7ListIndex.destroy();\n }\n }\n }\n};", "export default {\n name: 'timeline'\n};", "import $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nconst Tab = {\n show() {\n const app = this;\n let tabEl;\n let tabLinkEl;\n let animate;\n let tabRoute;\n let animatedInit;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (args.length === 1 && args[0] && args[0].constructor === Object) {\n tabEl = args[0].tabEl;\n tabLinkEl = args[0].tabLinkEl;\n animate = args[0].animate;\n tabRoute = args[0].tabRoute;\n animatedInit = args[0].animatedInit;\n } else {\n [tabEl, tabLinkEl, animate, tabRoute] = args;\n if (typeof args[1] === 'boolean') {\n [tabEl, animate, tabLinkEl, tabRoute] = args;\n if (args.length > 2 && tabLinkEl.constructor === Object) {\n [tabEl, animate, tabRoute, tabLinkEl] = args;\n }\n }\n }\n if (typeof animate === 'undefined') animate = true;\n const $newTabEl = $(tabEl);\n if (tabRoute && $newTabEl[0]) {\n $newTabEl[0].f7TabRoute = tabRoute;\n }\n if (!animatedInit && ($newTabEl.length === 0 || $newTabEl.hasClass('tab-active'))) {\n return {\n $newTabEl,\n newTabEl: $newTabEl[0]\n };\n }\n let $tabLinkEl;\n if (tabLinkEl) $tabLinkEl = $(tabLinkEl);\n const $tabsEl = $newTabEl.parent('.tabs');\n if ($tabsEl.length === 0) {\n return {\n $newTabEl,\n newTabEl: $newTabEl[0]\n };\n }\n\n // Release swipeouts in hidden tabs\n if (app.swipeout) app.swipeout.allowOpen = true;\n\n // Animated tabs\n const tabsChangedCallbacks = [];\n function onTabsChanged(callback) {\n tabsChangedCallbacks.push(callback);\n }\n function tabsChanged() {\n tabsChangedCallbacks.forEach(callback => {\n callback();\n });\n }\n let animated = false;\n if ($tabsEl.parent().hasClass('tabs-animated-wrap')) {\n $tabsEl.parent()[animate ? 'removeClass' : 'addClass']('not-animated');\n const transitionDuration = parseFloat($tabsEl.css('transition-duration').replace(',', '.'));\n if (animate && transitionDuration) {\n $tabsEl.transitionEnd(tabsChanged);\n animated = true;\n }\n const tabsTranslate = (app.rtl ? $newTabEl.index() : -$newTabEl.index()) * 100;\n $tabsEl.transform(`translate3d(${tabsTranslate}%,0,0)`);\n }\n\n // Swipeable tabs\n let swiper;\n if ($tabsEl[0].nodeName.toLowerCase() === 'swiper-container' && app.swiper) {\n swiper = $tabsEl[0].swiper;\n const newTabIndex = swiper.slides.indexOf($newTabEl[0]);\n if (swiper && swiper.activeIndex !== newTabIndex) {\n animated = true;\n swiper.once('slideChangeTransitionEnd', () => {\n tabsChanged();\n }).slideTo(newTabIndex, animate ? undefined : 0);\n } else if (swiper && swiper.animating) {\n animated = true;\n swiper.once('slideChangeTransitionEnd', () => {\n tabsChanged();\n });\n }\n }\n\n // Remove active class from old tabs\n const $oldTabEl = $tabsEl.children('.tab-active');\n $oldTabEl.removeClass('tab-active');\n if (!animatedInit && (!swiper || swiper && !swiper.animating || swiper && tabRoute)) {\n if ($oldTabEl.hasClass('view') && $oldTabEl.children('.page').length) {\n $oldTabEl.children('.page').each(pageEl => {\n $(pageEl).trigger('page:tabhide');\n app.emit('pageTabHide', pageEl);\n });\n }\n $oldTabEl.trigger('tab:hide');\n app.emit('tabHide', $oldTabEl[0]);\n }\n\n // Trigger 'show' event on new tab\n $newTabEl.addClass('tab-active');\n if (!animatedInit && (!swiper || swiper && !swiper.animating || swiper && tabRoute)) {\n if ($newTabEl.hasClass('view') && $newTabEl.children('.page').length) {\n $newTabEl.children('.page').each(pageEl => {\n $(pageEl).trigger('page:tabshow');\n app.emit('pageTabShow', pageEl);\n });\n }\n $newTabEl.trigger('tab:show');\n app.emit('tabShow', $newTabEl[0]);\n }\n\n // Find related link for new tab\n if (!$tabLinkEl) {\n // Search by id\n if (typeof tabEl === 'string') $tabLinkEl = $(`.tab-link[href=\"${tabEl}\"]`);else $tabLinkEl = $(`.tab-link[href=\"#${$newTabEl.attr('id')}\"]`);\n // Search by data-tab\n if (!$tabLinkEl || $tabLinkEl && $tabLinkEl.length === 0) {\n $('[data-tab]').each(el => {\n if ($newTabEl.is($(el).attr('data-tab'))) $tabLinkEl = $(el);\n });\n }\n if (tabRoute && (!$tabLinkEl || $tabLinkEl && $tabLinkEl.length === 0)) {\n $tabLinkEl = $(`[data-route-tab-id=\"${tabRoute.route.tab.id}\"]`);\n if ($tabLinkEl.length === 0) {\n $tabLinkEl = $(`.tab-link[href=\"${tabRoute.url}\"]`);\n }\n }\n if ($tabLinkEl.length > 1 && $newTabEl.parents('.page').length) {\n // eslint-disable-next-line\n $tabLinkEl = $tabLinkEl.filter(tabLinkElement => {\n return $(tabLinkElement).parents('.page')[0] === $newTabEl.parents('.page')[0];\n });\n if (app.theme === 'ios' && $tabLinkEl.length === 0 && tabRoute) {\n const $pageEl = $newTabEl.parents('.page');\n const $navbarEl = $(app.navbar.getElByPage($pageEl));\n $tabLinkEl = $navbarEl.find(`[data-route-tab-id=\"${tabRoute.route.tab.id}\"]`);\n if ($tabLinkEl.length === 0) {\n $tabLinkEl = $navbarEl.find(`.tab-link[href=\"${tabRoute.url}\"]`);\n }\n }\n }\n }\n if ($tabLinkEl.length > 0) {\n // Find related link for old tab\n let $oldTabLinkEl;\n if ($oldTabEl && $oldTabEl.length > 0) {\n // Search by id\n const oldTabId = $oldTabEl.attr('id');\n if (oldTabId) {\n $oldTabLinkEl = $(`.tab-link[href=\"#${oldTabId}\"]`);\n // Search by data-route-tab-id\n if (!$oldTabLinkEl || $oldTabLinkEl && $oldTabLinkEl.length === 0) {\n $oldTabLinkEl = $(`.tab-link[data-route-tab-id=\"${oldTabId}\"]`);\n }\n }\n // Search by data-tab\n if (!$oldTabLinkEl || $oldTabLinkEl && $oldTabLinkEl.length === 0) {\n $('[data-tab]').each(tabLinkElement => {\n if ($oldTabEl.is($(tabLinkElement).attr('data-tab'))) $oldTabLinkEl = $(tabLinkElement);\n });\n }\n if (!$oldTabLinkEl || $oldTabLinkEl && $oldTabLinkEl.length === 0) {\n $oldTabLinkEl = $tabLinkEl.siblings('.tab-link-active');\n }\n } else if (tabRoute) {\n $oldTabLinkEl = $tabLinkEl.siblings('.tab-link-active');\n }\n if ($oldTabLinkEl && $oldTabLinkEl.length > 1 && $oldTabEl && $oldTabEl.parents('.page').length) {\n // eslint-disable-next-line\n $oldTabLinkEl = $oldTabLinkEl.filter(tabLinkElement => {\n return $(tabLinkElement).parents('.page')[0] === $oldTabEl.parents('.page')[0];\n });\n }\n if ($oldTabLinkEl && $oldTabLinkEl.length > 0) $oldTabLinkEl.removeClass('tab-link-active');\n\n // Update links' classes\n if ($tabLinkEl && $tabLinkEl.length > 0) {\n $tabLinkEl.addClass('tab-link-active');\n // Material Highlight\n const $tabbarEl = $tabLinkEl.parents('.tabbar, .tabbar-icons');\n const hasHighlight = app.toolbar && $tabbarEl.length > 0 && ($tabbarEl.hasClass('tabbar-highlight') || app.theme !== 'ios');\n if (hasHighlight) {\n app.toolbar.setHighlight($tabbarEl);\n }\n }\n }\n return {\n $newTabEl,\n newTabEl: $newTabEl[0],\n $oldTabEl,\n oldTabEl: $oldTabEl[0],\n onTabsChanged,\n animated\n };\n }\n};\nexport default {\n name: 'tabs',\n create() {\n const app = this;\n extend(app, {\n tab: {\n show: Tab.show.bind(app)\n }\n });\n },\n on: {\n 'pageInit tabMounted': function onInit(pageOrTabEl) {\n const $el = $(pageOrTabEl.el || pageOrTabEl);\n const animatedTabEl = $el.find('.tabs-animated-wrap > .tabs > .tab-active')[0];\n if (!animatedTabEl) return;\n const app = this;\n app.tab.show({\n tabEl: animatedTabEl,\n animatedInit: true,\n animate: false\n });\n }\n },\n clicks: {\n '.tab-link': function tabLinkClick($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n if ($clickedEl.attr('href') && $clickedEl.attr('href').indexOf('#') === 0 || $clickedEl.attr('data-tab')) {\n const app = this;\n app.tab.show({\n tabEl: data.tab || $clickedEl.attr('href'),\n tabLinkEl: $clickedEl,\n animate: data.animate\n });\n }\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { extend, now, nextFrame } from '../../shared/utils.js';\nfunction swipePanel(panel) {\n const app = panel.app;\n if (panel.swipeInitialized) {\n return;\n }\n extend(panel, {\n swipeable: true,\n swipeInitialized: true\n });\n const params = panel.params;\n const {\n $el,\n $backdropEl,\n side,\n effect\n } = panel;\n let otherPanel;\n let isTouched;\n let isGestureStarted;\n let isMoved;\n let isScrolling;\n let isInterrupted;\n const touchesStart = {};\n let touchStartTime;\n let touchesDiff;\n let translate;\n let backdropOpacity;\n let panelWidth;\n let direction;\n let $viewEl;\n let touchMoves = 0;\n function handleTouchStart(e) {\n if (!panel.swipeable || isGestureStarted) return;\n if (!app.panel.allowOpen || !params.swipe && !params.swipeOnlyClose || isTouched) return;\n if ($('.modal-in:not(.toast):not(.notification), .photo-browser-in').length > 0) return;\n otherPanel = app.panel.get(side === 'left' ? 'right' : 'left') || {};\n const otherPanelOpened = otherPanel.opened && otherPanel.$el && !otherPanel.$el.hasClass('panel-in-breakpoint');\n if (!panel.opened && otherPanelOpened) {\n return;\n }\n if (!params.swipeOnlyClose) {\n if (otherPanelOpened) return;\n }\n if (e.target && e.target.nodeName.toLowerCase() === 'input' && e.target.type === 'range') return;\n if ($(e.target).closest('.range-slider, swiper-container.tabs, .calendar-months, .no-swipe-panel, .card-opened').length > 0) return;\n touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n if (params.swipeOnlyClose && !panel.opened) {\n return;\n }\n if (params.swipeActiveArea && !panel.opened) {\n if (side === 'left') {\n if (touchesStart.x > params.swipeActiveArea) return;\n }\n if (side === 'right') {\n if (touchesStart.x < app.width - params.swipeActiveArea) return;\n }\n }\n touchMoves = 0;\n $viewEl = $(panel.getViewEl());\n isMoved = false;\n isTouched = true;\n isScrolling = undefined;\n isInterrupted = false;\n touchStartTime = now();\n direction = undefined;\n }\n function handleTouchMove(e) {\n if (!isTouched || isGestureStarted || isInterrupted) return;\n touchMoves += 1;\n if (touchMoves < 2) return;\n if (e.f7PreventSwipePanel || app.preventSwipePanelBySwipeBack || app.preventSwipePanel) {\n isTouched = false;\n return;\n }\n const pageX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n const pageY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n if (typeof isScrolling === 'undefined') {\n isScrolling = !!(isScrolling || Math.abs(pageY - touchesStart.y) > Math.abs(pageX - touchesStart.x));\n }\n if (isScrolling) {\n isTouched = false;\n return;\n }\n if (!direction) {\n if (pageX > touchesStart.x) {\n direction = 'to-right';\n } else {\n direction = 'to-left';\n }\n if (params.swipeActiveArea > 0 && !panel.opened) {\n if (side === 'left' && touchesStart.x > params.swipeActiveArea) {\n isTouched = false;\n return;\n }\n if (side === 'right' && touchesStart.x < app.width - params.swipeActiveArea) {\n isTouched = false;\n return;\n }\n }\n if ($el.hasClass('panel-in-breakpoint')) {\n isTouched = false;\n return;\n }\n if (side === 'left' && direction === 'to-left' && !$el.hasClass('panel-in') || side === 'right' && direction === 'to-right' && !$el.hasClass('panel-in')) {\n isTouched = false;\n return;\n }\n }\n let threshold = panel.opened ? 0 : -params.swipeThreshold;\n if (side === 'right') threshold = -threshold;\n if (!isMoved) {\n if (!panel.opened) {\n panel.insertToRoot();\n $el.addClass('panel-in-swipe');\n if ($backdropEl) $backdropEl.css('visibility', 'visible');\n $el.trigger('panel:swipeopen');\n panel.emit('local::swipeOpen panelSwipeOpen', panel);\n }\n panelWidth = $el[0].offsetWidth;\n if (effect === 'reveal' && $el.hasClass('panel-in-collapsed')) {\n panelWidth -= parseFloat($viewEl.css(`margin-${side}`));\n }\n $el.transition(0);\n }\n isMoved = true;\n if (e.cancelable) {\n e.preventDefault();\n }\n touchesDiff = pageX - touchesStart.x + threshold;\n const startTranslate = effect === 'floating' ? 8 : 0;\n if (side === 'right') {\n if (effect === 'cover' || effect === 'push' || effect === 'floating') {\n translate = touchesDiff + (panel.opened ? startTranslate : panelWidth);\n if (translate < 0 - startTranslate) translate = -startTranslate;\n if (translate > panelWidth) {\n translate = panelWidth;\n }\n } else {\n translate = touchesDiff - (panel.opened ? panelWidth : 0);\n if (translate > 0) translate = 0;\n if (translate < -panelWidth) {\n translate = -panelWidth;\n }\n }\n } else {\n translate = touchesDiff + (panel.opened ? panelWidth : startTranslate);\n if (translate < 0) translate = 0;\n if (translate > panelWidth + startTranslate) {\n translate = panelWidth + startTranslate;\n }\n }\n const noFollowProgress = Math.abs(translate / panelWidth);\n if (effect === 'reveal') {\n if (!params.swipeNoFollow) {\n $viewEl.transform(`translate3d(${translate}px,0,0)`).transition(0);\n if ($backdropEl) $backdropEl.transform(`translate3d(${translate}px,0,0)`).transition(0);\n }\n $el.trigger('panel:swipe', Math.abs(translate / panelWidth));\n panel.emit('local::swipe panelSwipe', panel, Math.abs(translate / panelWidth));\n } else {\n if (side === 'left') translate -= panelWidth;\n if (!params.swipeNoFollow) {\n backdropOpacity = 1 - Math.abs(translate / panelWidth);\n if ($backdropEl) {\n $backdropEl.transition(0);\n $backdropEl.css({\n opacity: backdropOpacity\n });\n }\n $el.transform(`translate3d(${translate}px,0,0)`).transition(0);\n if (effect === 'push') {\n const viewTranslate = side === 'left' ? translate + panelWidth : translate - panelWidth;\n $viewEl.transform(`translate3d(${viewTranslate}px,0,0)`).transition(0);\n if ($backdropEl) {\n $backdropEl.transform(`translate3d(${viewTranslate}px,0,0)`).transition(0);\n }\n }\n }\n $el.trigger('panel:swipe', Math.abs(translate / panelWidth));\n panel.emit('local::swipe panelSwipe', panel, Math.abs(translate / panelWidth));\n }\n if (params.swipeNoFollow) {\n const stateChanged = panel.opened && noFollowProgress === 0 || !panel.opened && noFollowProgress === 1;\n if (stateChanged) {\n isInterrupted = true;\n // eslint-disable-next-line\n handleTouchEnd(e);\n }\n }\n }\n function handleTouchEnd(e) {\n if (!isTouched || !isMoved) {\n isTouched = false;\n isMoved = false;\n return;\n }\n const isGesture = e.type === 'gesturestart' || isGestureStarted;\n isTouched = false;\n isMoved = false;\n const timeDiff = new Date().getTime() - touchStartTime;\n let action;\n const startTranslate = effect === 'floating' ? side === 'left' ? 8 : -8 : 0;\n const edge = (translate === startTranslate || Math.abs(translate) === panelWidth) && !params.swipeNoFollow;\n const threshold = params.swipeThreshold || 0;\n if (isGesture) {\n action = 'reset';\n } else if (!panel.opened) {\n if (Math.abs(touchesDiff) < threshold) {\n action = 'reset';\n } else if (effect === 'cover' || effect === 'push' || effect === 'floating') {\n if (translate === 0 + startTranslate) {\n action = 'swap'; // open\n } else if (timeDiff < 300 && Math.abs(translate) > 0) {\n action = 'swap'; // open\n } else if (timeDiff >= 300 && Math.abs(translate) < panelWidth / 2) {\n action = 'swap'; // open\n } else {\n action = 'reset'; // close\n }\n } else if (translate === 0) {\n action = 'reset';\n } else if (timeDiff < 300 && Math.abs(translate) > 0 || timeDiff >= 300 && Math.abs(translate) >= panelWidth / 2) {\n action = 'swap';\n } else {\n action = 'reset';\n }\n } else if (effect === 'cover' || effect === 'push' || effect === 'floating') {\n if (translate === 0) {\n action = 'reset'; // open\n } else if (timeDiff < 300 && Math.abs(translate) > 0) {\n action = 'swap'; // open\n } else if (timeDiff >= 300 && Math.abs(translate) < panelWidth / 2) {\n action = 'reset'; // open\n } else {\n action = 'swap'; // close\n }\n } else if (translate === -panelWidth) {\n action = 'reset';\n } else if (timeDiff < 300 && Math.abs(translate) >= 0 || timeDiff >= 300 && Math.abs(translate) <= panelWidth / 2) {\n if (side === 'left' && translate === panelWidth) action = 'reset';else action = 'swap';\n } else {\n action = 'reset';\n }\n if (action === 'swap') {\n if (panel.opened) {\n panel.close(!edge);\n } else {\n panel.open(!edge);\n }\n }\n let removePanelInClass = true;\n if (action === 'reset') {\n if (!panel.opened) {\n if (edge) {\n // edge position\n $el.removeClass('panel-in-swipe');\n } else {\n removePanelInClass = false;\n const target = effect === 'reveal' ? $viewEl : $el;\n panel.setStateClasses('before-closing');\n target.transitionEnd(() => {\n if ($el.hasClass('panel-in')) return;\n $el.removeClass('panel-in-swipe');\n panel.setStateClasses('after-closing');\n });\n }\n }\n }\n if (effect === 'reveal' || effect === 'push') {\n nextFrame(() => {\n $viewEl.transition('');\n $viewEl.transform('');\n });\n }\n if (removePanelInClass) {\n $el.removeClass('panel-in-swipe');\n }\n $el.transition('').transform('');\n if ($backdropEl) {\n $backdropEl.transform('').transition('').css({\n opacity: '',\n visibility: ''\n });\n }\n }\n function handleGestureStart(e) {\n isGestureStarted = true;\n handleTouchEnd(e);\n }\n function handleGestureEnd() {\n isGestureStarted = false;\n }\n\n // Add Events\n app.on('touchstart:passive', handleTouchStart);\n app.on('touchmove:active', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n app.on('gesturestart', handleGestureStart);\n app.on('gestureend', handleGestureEnd);\n panel.on('panelDestroy', () => {\n app.off('touchstart:passive', handleTouchStart);\n app.off('touchmove:active', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n app.off('gesturestart', handleGestureStart);\n app.off('gestureend', handleGestureEnd);\n });\n}\nexport default swipePanel;", "import $ from '../../shared/dom7.js';\nimport { extend, nextFrame } from '../../shared/utils.js';\nimport { getSupport } from '../../shared/get-support.js';\nfunction resizablePanel(panel) {\n const app = panel.app;\n const support = getSupport();\n if (panel.resizableInitialized) return;\n extend(panel, {\n resizable: true,\n resizableWidth: null,\n resizableInitialized: true\n });\n const $htmlEl = $('html');\n const {\n $el,\n $backdropEl,\n side,\n effect\n } = panel;\n if (!$el) return;\n let isTouched;\n let isMoved;\n const touchesStart = {};\n let touchesDiff;\n let panelWidth;\n let $viewEl;\n let panelMinWidth;\n let panelMaxWidth;\n let visibleByBreakpoint;\n const isPushingPanel = effect !== 'cover' && effect !== 'floating';\n function transformCSSWidth(v) {\n if (!v) return null;\n if (v.indexOf('%') >= 0 || v.indexOf('vw') >= 0) {\n return parseInt(v, 10) / 100 * app.width;\n }\n const newV = parseInt(v, 10);\n if (Number.isNaN(newV)) return null;\n return newV;\n }\n function isResizable() {\n return panel.resizable && $el.hasClass('panel-resizable');\n }\n function handleTouchStart(e) {\n if (!isResizable()) return;\n touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n isMoved = false;\n isTouched = true;\n panelMinWidth = transformCSSWidth($el.css('min-width'));\n panelMaxWidth = transformCSSWidth($el.css('max-width'));\n visibleByBreakpoint = $el.hasClass('panel-in-breakpoint');\n }\n function handleTouchMove(e) {\n if (!isTouched) return;\n const pageX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n if (!isMoved) {\n panelWidth = $el[0].offsetWidth;\n $el.transition(0);\n $el.addClass('panel-resizing');\n $htmlEl.css('cursor', 'col-resize');\n if (isPushingPanel || visibleByBreakpoint) {\n $viewEl = $(panel.getViewEl());\n if (panel.$containerEl && panel.$containerEl.hasClass('page')) {\n $viewEl.add(panel.$containerEl.children('.page-content, .tabs, .fab'));\n }\n }\n if (isPushingPanel && !visibleByBreakpoint) {\n $backdropEl.transition(0);\n $viewEl.transition(0);\n }\n }\n isMoved = true;\n e.preventDefault();\n touchesDiff = pageX - touchesStart.x;\n let newPanelWidth = side === 'left' ? panelWidth + touchesDiff : panelWidth - touchesDiff;\n if (panelMinWidth && !Number.isNaN(panelMinWidth)) {\n newPanelWidth = Math.max(newPanelWidth, panelMinWidth);\n }\n if (panelMaxWidth && !Number.isNaN(panelMaxWidth)) {\n newPanelWidth = Math.min(newPanelWidth, panelMaxWidth);\n }\n newPanelWidth = Math.min(Math.max(newPanelWidth, 0), app.width);\n panel.resizableWidth = newPanelWidth;\n $el[0].style.width = `${newPanelWidth}px`;\n if (isPushingPanel && !visibleByBreakpoint) {\n if ($viewEl) {\n $viewEl.transform(`translate3d(${side === 'left' ? newPanelWidth : -newPanelWidth}px, 0, 0)`);\n }\n if ($backdropEl) {\n $backdropEl.transform(`translate3d(${side === 'left' ? newPanelWidth : -newPanelWidth}px, 0, 0)`);\n }\n } else if (visibleByBreakpoint && $viewEl) {\n $viewEl.css(`margin-${side}`, `${newPanelWidth}px`);\n }\n $el.trigger('panel:resize', newPanelWidth);\n panel.emit('local::resize panelResize', panel, newPanelWidth);\n }\n function handleTouchEnd() {\n $('html').css('cursor', '');\n if (!isTouched || !isMoved) {\n isTouched = false;\n isMoved = false;\n return;\n }\n isTouched = false;\n isMoved = false;\n $htmlEl[0].style.setProperty(`--f7-panel-${side}-width`, `${panel.resizableWidth}px`);\n $el[0].style.width = '';\n if (isPushingPanel && !visibleByBreakpoint) {\n $viewEl.transform('');\n $backdropEl.transform('');\n }\n $el.removeClass('panel-resizing');\n nextFrame(() => {\n $el.transition('');\n if (isPushingPanel) {\n $backdropEl.transition('');\n if ($viewEl) $viewEl.transition('');\n }\n });\n }\n function handleResize() {\n if (!panel.opened || !panel.resizableWidth) return;\n panelMinWidth = transformCSSWidth($el.css('min-width'));\n panelMaxWidth = transformCSSWidth($el.css('max-width'));\n if (panelMinWidth && !Number.isNaN(panelMinWidth) && panel.resizableWidth < panelMinWidth) {\n panel.resizableWidth = Math.max(panel.resizableWidth, panelMinWidth);\n }\n if (panelMaxWidth && !Number.isNaN(panelMaxWidth) && panel.resizableWidth > panelMaxWidth) {\n panel.resizableWidth = Math.min(panel.resizableWidth, panelMaxWidth);\n }\n panel.resizableWidth = Math.min(Math.max(panel.resizableWidth, 0), app.width);\n $htmlEl[0].style.setProperty(`--f7-panel-${side}-width`, `${panel.resizableWidth}px`);\n }\n if (panel.$el.find('.panel-resize-handler').length === 0) {\n panel.$el.append('');\n }\n panel.$resizeHandlerEl = panel.$el.children('.panel-resize-handler');\n $el.addClass('panel-resizable');\n\n // Add Events\n const passive = support.passiveListener ? {\n passive: true\n } : false;\n panel.$el.on(app.touchEvents.start, '.panel-resize-handler', handleTouchStart, passive);\n app.on('touchmove:active', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n app.on('resize', handleResize);\n panel.on('beforeOpen', handleResize);\n panel.once('panelDestroy', () => {\n $el.removeClass('panel-resizable');\n panel.$resizeHandlerEl.remove();\n panel.$el.off(app.touchEvents.start, '.panel-resize-handler', handleTouchStart, passive);\n app.off('touchmove:active', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n app.off('resize', handleResize);\n panel.off('beforeOpen', handleResize);\n });\n}\nexport default resizablePanel;", "import { getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\nimport swipePanel from './swipe-panel.js';\nimport resizablePanel from './resizable-panel.js';\nclass Panel extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n const extendedParams = extend({\n on: {}\n }, app.params.panel, params);\n super(extendedParams, [app]);\n const panel = this;\n panel.params = extendedParams;\n panel.$containerEl = panel.params.containerEl ? $(panel.params.containerEl).eq(0) : app.$el;\n panel.containerEl = panel.$containerEl[0];\n if (!panel.containerEl) {\n panel.$containerEl = app.$el;\n panel.containerEl = app.$el[0];\n }\n let $el;\n if (panel.params.el) {\n $el = $(panel.params.el).eq(0);\n } else if (panel.params.content) {\n $el = $(panel.params.content).filter(node => node.nodeType === 1).eq(0);\n }\n if ($el.length === 0) return panel;\n if ($el[0].f7Panel) return $el[0].f7Panel;\n $el[0].f7Panel = panel;\n let {\n side,\n effect,\n resizable\n } = panel.params;\n if (typeof side === 'undefined') side = $el.hasClass('panel-left') ? 'left' : 'right';\n if (typeof effect === 'undefined')\n // eslint-disable-next-line\n effect = $el.hasClass('panel-cover') ? 'cover' : $el.hasClass('panel-push') ? 'push' : $el.hasClass('panel-floating') ? 'floating' : 'reveal';\n if (typeof resizable === 'undefined') resizable = $el.hasClass('panel-resizable');\n let $backdropEl;\n if (panel.params.backdrop && panel.params.backdropEl) {\n $backdropEl = $(panel.params.backdropEl);\n } else if (panel.params.backdrop) {\n $backdropEl = panel.$containerEl.children('.panel-backdrop');\n if ($backdropEl.length === 0) {\n $backdropEl = $('');\n panel.$containerEl.prepend($backdropEl);\n }\n }\n extend(panel, {\n app,\n side,\n effect,\n resizable,\n $el,\n el: $el[0],\n opened: false,\n $backdropEl,\n backdropEl: $backdropEl && $backdropEl[0]\n });\n\n // Install Modules\n panel.useModules();\n\n // Init\n panel.init();\n return panel;\n }\n getViewEl() {\n const panel = this;\n let viewEl;\n if (panel.$containerEl.children('.views').length > 0) {\n viewEl = panel.$containerEl.children('.views')[0];\n } else {\n viewEl = panel.$containerEl.children('.view')[0];\n }\n return viewEl;\n }\n setStateClasses(state) {\n const panel = this;\n const {\n side,\n el,\n effect\n } = panel;\n const viewEl = panel.getViewEl();\n const panelInView = viewEl && viewEl.contains(el);\n const $targetEl = !viewEl || panelInView ? panel.$containerEl : $('html');\n if (state === 'open') {\n $targetEl.addClass(`with-panel with-panel-${panel.side}-${panel.effect}`);\n }\n if (state === 'before-closing') {\n $targetEl.addClass('with-panel-closing');\n }\n if (state === 'closing') {\n $targetEl.addClass('with-panel-closing');\n $targetEl.removeClass(`with-panel with-panel-${panel.side}-${panel.effect}`);\n }\n if (state === 'after-closing') {\n $targetEl.removeClass('with-panel-closing');\n }\n if (state === 'closed') {\n $targetEl.removeClass(`with-panel-${side}-${effect}`);\n }\n }\n enableVisibleBreakpoint() {\n const panel = this;\n panel.visibleBreakpointDisabled = false;\n panel.setVisibleBreakpoint();\n return panel;\n }\n disableVisibleBreakpoint() {\n const panel = this;\n panel.visibleBreakpointDisabled = true;\n panel.setVisibleBreakpoint();\n return panel;\n }\n toggleVisibleBreakpoint() {\n const panel = this;\n panel.visibleBreakpointDisabled = !panel.visibleBreakpointDisabled;\n panel.setVisibleBreakpoint();\n return panel;\n }\n setVisibleBreakpoint(emitEvents) {\n if (emitEvents === void 0) {\n emitEvents = true;\n }\n const panel = this;\n const app = panel.app;\n if (!panel.visibleBreakpointResizeHandler) {\n panel.visibleBreakpointResizeHandler = function visibleBreakpointResizeHandler() {\n panel.setVisibleBreakpoint();\n };\n app.on('resize', panel.visibleBreakpointResizeHandler);\n }\n const {\n side,\n $el,\n $containerEl,\n params,\n visibleBreakpointDisabled\n } = panel;\n const breakpoint = params.visibleBreakpoint;\n const $viewEl = $(panel.getViewEl());\n const wasVisible = $el.hasClass('panel-in-breakpoint');\n if ($containerEl && $containerEl.hasClass('page')) {\n $viewEl.add($containerEl.children('.page-content, .tabs, .fab'));\n }\n if (app.width >= breakpoint && typeof breakpoint !== 'undefined' && breakpoint !== null && !visibleBreakpointDisabled) {\n if (!wasVisible) {\n panel.setStateClasses('closed');\n $el.addClass('panel-in-breakpoint').removeClass('panel-in panel-in-collapsed');\n panel.onOpen(false);\n panel.onOpened();\n $viewEl.css({\n [`margin-${side}`]: `${$el.width()}px`\n });\n app.allowPanelOpen = true;\n if (emitEvents) {\n panel.emit('local::breakpoint panelBreakpoint', panel);\n panel.$el.trigger('panel:breakpoint');\n }\n } else {\n $viewEl.css({\n [`margin-${side}`]: `${$el.width()}px`\n });\n }\n } else if (wasVisible) {\n $el.removeClass('panel-in-breakpoint panel-in');\n panel.onClose();\n panel.onClosed();\n $viewEl.css({\n [`margin-${side}`]: ''\n });\n if (emitEvents) {\n panel.emit('local::breakpoint panelBreakpoint', panel);\n panel.$el.trigger('panel:breakpoint');\n }\n }\n }\n enableCollapsedBreakpoint() {\n const panel = this;\n panel.collapsedBreakpointDisabled = false;\n panel.setCollapsedBreakpoint();\n return panel;\n }\n disableCollapsedBreakpoint() {\n const panel = this;\n panel.collapsedBreakpointDisabled = true;\n panel.setCollapsedBreakpoint();\n return panel;\n }\n toggleCollapsedBreakpoint() {\n const panel = this;\n panel.collapsedBreakpointDisabled = !panel.collapsedBreakpointDisabled;\n panel.setCollapsedBreakpoint();\n return panel;\n }\n setCollapsedBreakpoint(emitEvents) {\n if (emitEvents === void 0) {\n emitEvents = true;\n }\n const panel = this;\n const app = panel.app;\n if (!panel.collapsedBreakpointResizeHandler) {\n panel.collapsedBreakpointResizeHandler = function collapsedBreakpointResizeHandler() {\n panel.setCollapsedBreakpoint();\n };\n app.on('resize', panel.collapsedBreakpointResizeHandler);\n }\n const {\n $el,\n params,\n collapsedBreakpointDisabled\n } = panel;\n if ($el.hasClass('panel-in-breakpoint')) return;\n const breakpoint = params.collapsedBreakpoint;\n const wasVisible = $el.hasClass('panel-in-collapsed');\n if (app.width >= breakpoint && typeof breakpoint !== 'undefined' && breakpoint !== null && !collapsedBreakpointDisabled) {\n if (!wasVisible) {\n panel.setStateClasses('closed');\n $el.addClass('panel-in-collapsed').removeClass('panel-in');\n panel.collapsed = true;\n app.allowPanelOpen = true;\n if (emitEvents) {\n panel.emit('local::collapsedBreakpoint panelCollapsedBreakpoint', panel);\n panel.$el.trigger('panel:collapsedbreakpoint');\n }\n }\n } else if (wasVisible) {\n $el.removeClass('panel-in-collapsed panel-in');\n panel.collapsed = false;\n if (emitEvents) {\n panel.emit('local::collapsedBreakpoint panelCollapsedBreakpoint', panel);\n panel.$el.trigger('panel:collapsedbreakpoint');\n }\n }\n }\n enableResizable() {\n const panel = this;\n if (panel.resizableInitialized) {\n panel.resizable = true;\n panel.$el.addClass('panel-resizable');\n } else {\n resizablePanel(panel);\n }\n return panel;\n }\n disableResizable() {\n const panel = this;\n panel.resizable = false;\n panel.$el.removeClass('panel-resizable');\n return panel;\n }\n enableSwipe() {\n const panel = this;\n if (panel.swipeInitialized) {\n panel.swipeable = true;\n } else {\n swipePanel(panel);\n }\n return panel;\n }\n disableSwipe() {\n const panel = this;\n panel.swipeable = false;\n return panel;\n }\n onOpen(modifyHtmlClasses) {\n if (modifyHtmlClasses === void 0) {\n modifyHtmlClasses = true;\n }\n const panel = this;\n // eslint-disable-next-line\n panel._openTransitionStarted = false;\n const app = panel.app;\n panel.opened = true;\n app.panel.allowOpen = false;\n panel.$el.trigger('panel:beforeopen');\n panel.emit('local::beforeOpen panelBeforeOpen', panel);\n if (modifyHtmlClasses) {\n panel.setStateClasses('open');\n }\n panel.$el.trigger('panel:open');\n panel.emit('local::open panelOpen', panel);\n }\n onOpened() {\n const panel = this;\n const app = panel.app;\n app.panel.allowOpen = true;\n panel.$el.trigger('panel:opened');\n panel.emit('local::opened panelOpened', panel);\n }\n onClose() {\n const panel = this;\n const app = panel.app;\n panel.opened = false;\n app.panel.allowOpen = false;\n panel.$el.trigger('panel:beforeclose');\n panel.emit('local::beforeClose panelBeforeClose', panel);\n panel.setStateClasses('closing');\n panel.$el.trigger('panel:close');\n panel.emit('local::close panelClose', panel);\n }\n onClosed() {\n const panel = this;\n const app = panel.app;\n app.panel.allowOpen = true;\n panel.setStateClasses('after-closing');\n panel.$el.removeClass('panel-out');\n if (panel.$backdropEl) {\n const otherPanel = app.panel.get('.panel-in');\n const shouldHideBackdrop = !otherPanel || otherPanel && !otherPanel.$backdropEl;\n if (shouldHideBackdrop) {\n panel.$backdropEl.removeClass('panel-backdrop-in');\n }\n }\n panel.$el.trigger('panel:closed');\n panel.emit('local::closed panelClosed', panel);\n }\n toggle(animate) {\n if (animate === void 0) {\n animate = true;\n }\n const panel = this;\n const breakpoint = panel.params.visibleBreakpoint;\n const app = panel.app;\n if (app.width >= breakpoint && typeof breakpoint !== 'undefined' && breakpoint !== null) {\n return panel.toggleVisibleBreakpoint();\n }\n if (panel.opened) panel.close(animate);else panel.open(animate);\n return panel;\n }\n insertToRoot() {\n const panel = this;\n const document = getDocument();\n const {\n $el,\n $backdropEl,\n $containerEl\n } = panel;\n const $panelParentEl = $el.parent();\n const wasInDom = $el.parents(document).length > 0;\n if (!$panelParentEl.is($containerEl) || $el.prevAll('.views, .view').length) {\n const $insertBeforeEl = $containerEl.children('.panel, .views, .view').eq(0);\n const $insertAfterEl = $containerEl.children('.panel-backdrop').eq(0);\n if ($insertBeforeEl.length) {\n $el.insertBefore($insertBeforeEl);\n } else if ($insertAfterEl) {\n $el.insertBefore($insertAfterEl);\n } else {\n $containerEl.prepend($el);\n }\n if ($backdropEl && $backdropEl.length && (!$backdropEl.parent().is($containerEl) && $backdropEl.nextAll('.panel').length === 0 || $backdropEl.parent().is($containerEl) && $backdropEl.nextAll('.panel').length === 0)) {\n $backdropEl.insertBefore($el);\n }\n panel.once('panelClosed', () => {\n if (wasInDom) {\n $panelParentEl.append($el);\n } else {\n $el.remove();\n }\n });\n }\n }\n open(animate) {\n if (animate === void 0) {\n animate = true;\n }\n const panel = this;\n const app = panel.app;\n if (!app.panel.allowOpen) return false;\n const {\n effect,\n $el,\n $backdropEl,\n opened,\n $containerEl\n } = panel;\n if (!$el || $el.hasClass('panel-in')) {\n return panel;\n }\n panel.insertToRoot();\n\n // Ignore if opened\n if (opened || $el.hasClass('panel-in-breakpoint') || $el.hasClass('panel-in')) return false;\n\n // Close if some panel is opened\n const otherOpenedPanel = app.panel.get('.panel-in');\n if (otherOpenedPanel && otherOpenedPanel !== panel) {\n otherOpenedPanel.close(animate);\n }\n $el[animate ? 'removeClass' : 'addClass']('not-animated');\n $el.addClass('panel-in');\n if ($backdropEl) {\n $backdropEl.addClass('panel-backdrop-in');\n $backdropEl[animate ? 'removeClass' : 'addClass']('not-animated');\n }\n if (['cover', 'push', 'floating'].includes(panel.effect)) {\n /* eslint no-underscore-dangle: [\"error\", { \"allow\": [\"_clientLeft\"] }] */\n panel._clientLeft = $el[0].clientLeft;\n }\n\n // Transitionend\n const $viewEl = $(panel.getViewEl());\n if ($containerEl && $containerEl.hasClass('page')) {\n $viewEl.add($containerEl.children('.page-content, .tabs'));\n }\n const transitionEndTarget = effect === 'reveal' ? $viewEl : $el;\n function panelTransitionStart() {\n transitionEndTarget.transitionStart(() => {\n // eslint-disable-next-line\n panel._openTransitionStarted = true;\n });\n }\n function panelTransitionEnd() {\n transitionEndTarget.transitionEnd(e => {\n if ($(e.target).is(transitionEndTarget)) {\n if ($el.hasClass('panel-out')) {\n panel.onClosed();\n } else {\n panel.onOpened();\n }\n } else panelTransitionEnd();\n });\n }\n if (animate) {\n if ($backdropEl) {\n $backdropEl.removeClass('not-animated');\n }\n panelTransitionStart();\n panelTransitionEnd();\n $el.removeClass('panel-out not-animated').addClass('panel-in');\n panel.onOpen();\n } else {\n if ($backdropEl) {\n $backdropEl.addClass('not-animated');\n }\n $el.removeClass('panel-out').addClass('panel-in not-animated');\n panel.onOpen();\n panel.onOpened();\n // eslint-disable-next-line\n panel._openTransitionStarted = true;\n }\n return true;\n }\n close(animate) {\n if (animate === void 0) {\n animate = true;\n }\n const panel = this;\n const {\n effect,\n $el,\n $backdropEl,\n opened,\n $containerEl\n } = panel;\n if (!opened || $el.hasClass('panel-in-breakpoint') || !$el.hasClass('panel-in')) return panel;\n $el[animate ? 'removeClass' : 'addClass']('not-animated');\n if ($backdropEl) {\n $backdropEl[animate ? 'removeClass' : 'addClass']('not-animated');\n }\n const $viewEl = $(panel.getViewEl());\n if ($containerEl && $containerEl.hasClass('page')) {\n $viewEl.add($containerEl.children('.page-content, .tabs'));\n }\n const transitionEndTarget = effect === 'reveal' ? $viewEl : $el;\n // eslint-disable-next-line\n if (!panel._openTransitionStarted) {\n // eslint-disable-next-line\n animate = false;\n }\n function transitionEnd() {\n if ($el.hasClass('panel-out')) {\n panel.onClosed();\n } else if ($el.hasClass('panel-in')) {\n panel.onOpened();\n }\n panel.setStateClasses('after-closing');\n }\n if (animate) {\n transitionEndTarget.transitionEnd(() => {\n transitionEnd();\n });\n $el.removeClass('panel-in').addClass('panel-out');\n // Emit close\n panel.onClose();\n } else {\n $el.addClass('not-animated').removeClass('panel-in').addClass('panel-out');\n // Emit close\n panel.onClose();\n panel.onClosed();\n }\n return panel;\n }\n init() {\n const panel = this;\n // const app = panel.app;\n if (typeof panel.params.visibleBreakpoint !== 'undefined') {\n panel.setVisibleBreakpoint();\n }\n if (typeof panel.params.collapsedBreakpoint !== 'undefined') {\n panel.setCollapsedBreakpoint();\n }\n if (panel.params.swipe) {\n panel.enableSwipe();\n }\n if (panel.resizable) {\n panel.enableResizable();\n }\n }\n destroy() {\n let panel = this;\n const app = panel.app;\n const {\n $containerEl\n } = panel;\n if (!panel.$el) {\n // Panel already destroyed\n return;\n }\n panel.emit('local::beforeDestroy panelBeforeDestroy', panel);\n panel.$el.trigger('panel:beforedestroy');\n if (panel.visibleBreakpointResizeHandler) {\n app.off('resize', panel.visibleBreakpointResizeHandler);\n }\n if (panel.collapsedBreakpointResizeHandler) {\n app.off('resize', panel.collapsedBreakpointResizeHandler);\n }\n if (panel.$el.hasClass('panel-in-breakpoint') || panel.$el.hasClass('panel-in-collapsed')) {\n const $viewEl = $(panel.getViewEl());\n if ($containerEl && $containerEl.hasClass('page')) {\n $viewEl.add($containerEl.children('.page-content, .tabs'));\n }\n panel.$el.removeClass('panel-in-breakpoint panel-in-collapsed panel-in');\n $viewEl.css({\n [`margin-${panel.side}`]: ''\n });\n panel.emit('local::breakpoint panelBreakpoint', panel);\n panel.$el.trigger('panel:breakpoint');\n }\n panel.$el.trigger('panel:destroy');\n panel.emit('local::destroy panelDestroy', panel);\n if (panel.el) {\n panel.el.f7Panel = null;\n delete panel.el.f7Panel;\n }\n deleteProps(panel);\n panel = null;\n }\n}\nexport default Panel;", "import $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nimport Panel from './panel-class.js';\nexport default {\n name: 'panel',\n params: {\n panel: {\n opened: undefined,\n // default based on panel-in class\n side: undefined,\n // default based on panel class\n effect: undefined,\n // default based on panel class\n resizable: undefined,\n // default based on panel-resizable class\n backdrop: true,\n backdropEl: undefined,\n visibleBreakpoint: undefined,\n collapsedBreakpoint: undefined,\n swipe: false,\n // or true\n swipeNoFollow: false,\n // or true\n swipeOnlyClose: false,\n swipeActiveArea: 0,\n swipeThreshold: 0,\n closeByBackdropClick: true,\n containerEl: undefined\n }\n },\n static: {\n Panel\n },\n create() {\n const app = this;\n extend(app, {\n panel: {\n allowOpen: true,\n create(params) {\n return new Panel(app, params);\n },\n get(el) {\n if (el === void 0) {\n el = '.panel';\n }\n if (el instanceof Panel) return el;\n if (el === 'left' || el === 'right') el = `.panel-${el}`; // eslint-disable-line\n const $el = $(el);\n if ($el.length === 0 || $el.length > 1) return undefined;\n return $el[0].f7Panel;\n },\n destroy(el) {\n if (el === void 0) {\n el = '.panel';\n }\n const panel = app.panel.get(el);\n if (panel && panel.destroy) return panel.destroy();\n return undefined;\n },\n open(el, animate) {\n if (el === void 0) {\n el = '.panel';\n }\n if (el === 'left' || el === 'right') el = `.panel-${el}`; // eslint-disable-line\n let panel = app.panel.get(el);\n if (panel && panel.open) return panel.open(animate);\n if (!panel) {\n panel = app.panel.create({\n el\n });\n return panel.open(animate);\n }\n return undefined;\n },\n close(el, animate) {\n if (el === void 0) {\n el = '.panel-in';\n }\n if (el === 'left' || el === 'right') el = `.panel-${el}`; // eslint-disable-line\n let panel = app.panel.get(el);\n if (panel && panel.open) return panel.close(animate);\n if (!panel) {\n panel = app.panel.create({\n el\n });\n return panel.close(animate);\n }\n return undefined;\n },\n toggle(el, animate) {\n if (el === void 0) {\n el = '.panel';\n }\n if (el === 'left' || el === 'right') el = `.panel-${el}`; // eslint-disable-line\n let panel = app.panel.get(el);\n if (panel && panel.toggle) return panel.toggle(animate);\n if (!panel) {\n panel = app.panel.create({\n el\n });\n return panel.toggle(animate);\n }\n return undefined;\n }\n }\n });\n },\n on: {\n init() {\n const app = this;\n $('.panel-init').each(panelEl => {\n const params = Object.assign({\n el: panelEl\n }, $(panelEl).dataset() || {});\n app.panel.create(params);\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.panel-init').each(panelEl => {\n const params = Object.assign({\n el: panelEl\n }, $(panelEl).dataset() || {});\n app.panel.create(params);\n });\n },\n pageBeforeRemove(page) {\n const app = this;\n page.$el.find('.panel-init').each(panelEl => {\n const panel = app.panel.get(panelEl);\n if (panel && panel.destroy) panel.destroy();\n });\n }\n },\n vnode: {\n 'panel-init': {\n insert(vnode) {\n const app = this;\n const panelEl = vnode.elm;\n const params = Object.assign({\n el: panelEl\n }, $(panelEl).dataset() || {});\n app.panel.create(params);\n },\n destroy(vnode) {\n const app = this;\n const panelEl = vnode.elm;\n const panel = app.panel.get(panelEl);\n if (panel && panel.destroy) panel.destroy();\n }\n }\n },\n clicks: {\n '.panel-open': function open(clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.panel.open(data.panel, data.animate);\n },\n '.panel-close': function close(clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.panel.close(data.panel, data.animate);\n },\n '.panel-toggle': function close(clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.panel.toggle(data.panel, data.animate);\n },\n '.panel-backdrop': function close() {\n const app = this;\n const $panelEl = $('.panel-in:not(.panel-out)');\n if (!$panelEl.length) return;\n const instance = $panelEl[0] && $panelEl[0].f7Panel;\n $panelEl.trigger('panel:backdrop-click');\n if (instance) {\n instance.emit('backdropClick', instance);\n }\n app.emit('panelBackdropClick', instance || $panelEl[0]);\n if (instance && instance.params.closeByBackdropClick === false) return;\n if (app.params.panel.closeByBackdropClick) app.panel.close();\n }\n }\n};", "/* eslint no-param-reassign: \"off\" */\nimport { getDocument } from 'ssr-window';\nimport { bindMethods } from '../../shared/utils.js';\nimport { getSupport } from '../../shared/get-support.js';\nimport { getDevice } from '../../shared/get-device.js';\nimport $ from '../../shared/dom7.js';\nconst CardExpandable = {\n open(cardEl, animate) {\n if (cardEl === void 0) {\n cardEl = '.card-expandable';\n }\n if (animate === void 0) {\n animate = true;\n }\n const app = this;\n const device = getDevice();\n const document = getDocument();\n const support = getSupport();\n const $cardEl = $(cardEl).eq(0);\n if (!$cardEl || !$cardEl.length) return;\n if ($cardEl.hasClass('card-opened') || $cardEl.hasClass('card-opening') || $cardEl.hasClass('card-closing')) return;\n const $pageEl = $cardEl.parents('.page').eq(0);\n if (!$pageEl.length) return;\n if ($pageEl.find('.card-opened').length) {\n return;\n }\n let prevented;\n function prevent() {\n prevented = true;\n }\n $cardEl.trigger('card:beforeopen', {\n prevent\n });\n app.emit('cardBeforeOpen', $cardEl[0], prevent);\n if (prevented) return;\n const cardParams = Object.assign({\n animate\n }, app.params.card, $cardEl.dataset());\n const $pageContentEl = $cardEl.parents('.page-content');\n let $backdropEl;\n if ($cardEl.attr('data-backdrop-el')) {\n $backdropEl = $($cardEl.attr('data-backdrop-el'));\n }\n if (!$backdropEl && cardParams.backdrop) {\n $backdropEl = $pageContentEl.find('.card-backdrop');\n if (!$backdropEl.length) {\n $backdropEl = $('');\n $pageContentEl.append($backdropEl);\n }\n }\n let $navbarEl;\n let $toolbarEl;\n if (cardParams.hideNavbarOnOpen) {\n $navbarEl = $pageEl.children('.navbar');\n if (!$navbarEl.length) {\n if ($pageEl[0].f7Page) $navbarEl = $pageEl[0].f7Page.$navbarEl;\n }\n }\n if (cardParams.hideToolbarOnOpen) {\n $toolbarEl = $pageEl.children('.toolbar');\n if (!$toolbarEl.length) {\n $toolbarEl = $pageEl.parents('.view').children('.toolbar');\n }\n if (!$toolbarEl.length) {\n $toolbarEl = $pageEl.parents('.views').children('.toolbar');\n }\n }\n const currTransform = $cardEl.css('transform');\n let hasTransform;\n if (currTransform && currTransform.match(/[2-9]/)) {\n hasTransform = true;\n }\n const $cardContentEl = $cardEl.children('.card-content');\n const $cardSizeEl = $(document.createElement('div')).addClass('card-expandable-size');\n $cardEl.append($cardSizeEl);\n let cardWidth = $cardEl[0].offsetWidth;\n let cardHeight = $cardEl[0].offsetHeight;\n let pageWidth = $pageEl[0].offsetWidth;\n let pageHeight = $pageEl[0].offsetHeight;\n let maxWidth = $cardSizeEl[0].offsetWidth || pageWidth;\n let maxHeight = $cardSizeEl[0].offsetHeight || pageHeight;\n let statusbarHeight;\n if ($navbarEl && !cardParams.hideStatusbarOnOpen && maxHeight === pageHeight) {\n statusbarHeight = parseInt($navbarEl.css('--f7-safe-area-top'), 10);\n if (Number.isNaN(statusbarHeight)) statusbarHeight = 0;\n }\n if (statusbarHeight) {\n maxHeight -= statusbarHeight;\n }\n let scaleX = maxWidth / cardWidth;\n let scaleY = maxHeight / cardHeight;\n let offset = $cardEl.offset();\n let pageOffset = $pageEl.offset();\n if (statusbarHeight) {\n pageOffset.top += statusbarHeight / 2;\n }\n offset.left -= pageOffset.left;\n let cardLeftOffset;\n let cardTopOffset;\n if (hasTransform) {\n const transformValues = currTransform.replace(/matrix\\(|\\)/g, '').split(',').map(el => el.trim());\n if (transformValues && transformValues.length > 1) {\n const scale = parseFloat(transformValues[0]);\n cardLeftOffset = offset.left - cardWidth * (1 - scale) / 2;\n cardTopOffset = offset.top - pageOffset.top - cardHeight * (1 - scale) / 2;\n if (app.rtl) cardLeftOffset -= $cardEl[0].scrollLeft;\n } else {\n cardLeftOffset = $cardEl[0].offsetLeft;\n cardTopOffset = $cardEl[0].offsetTop - ($pageContentEl.length ? $pageContentEl[0].scrollTop : 0);\n }\n } else {\n cardLeftOffset = offset.left;\n cardTopOffset = offset.top - pageOffset.top;\n if (app.rtl) cardLeftOffset -= $cardEl[0].scrollLeft;\n }\n cardLeftOffset -= (pageWidth - maxWidth) / 2;\n cardTopOffset -= (pageHeight - maxHeight) / 2;\n let cardRightOffset = maxWidth - cardWidth - cardLeftOffset;\n if (app.rtl) {\n [cardLeftOffset, cardRightOffset] = [cardRightOffset, cardLeftOffset];\n }\n let cardBottomOffset = maxHeight - cardHeight - cardTopOffset;\n let translateX = (cardRightOffset - cardLeftOffset) / 2;\n let translateY = (cardBottomOffset - cardTopOffset) / 2;\n if (cardParams.hideNavbarOnOpen && $navbarEl && $navbarEl.length) {\n if ($navbarEl.closest('.navbar-hidden').length) {\n // Was hidden\n $cardEl[0].f7KeepNavbarOnClose = true;\n } else {\n delete $cardEl[0].f7KeepNavbarOnClose;\n app.navbar.hide($navbarEl, cardParams.animate, cardParams.hideStatusbarOnOpen, true);\n }\n }\n if (cardParams.hideToolbarOnOpen && $toolbarEl && $toolbarEl.length) {\n if ($toolbarEl.closest('.toolbar-hidden').length) {\n // Was hidden\n $cardEl[0].f7KeepToolbarOnClose = true;\n } else {\n delete $cardEl[0].f7KeepToolbarOnClose;\n app.toolbar.hide($toolbarEl, cardParams.animate);\n }\n }\n if ($backdropEl) {\n $backdropEl.removeClass('card-backdrop-out').addClass('card-backdrop-in');\n }\n $cardEl.removeClass('card-transitioning');\n if (cardParams.animate) {\n $cardEl.addClass('card-opening');\n }\n $cardEl.trigger('card:open');\n app.emit('cardOpen', $cardEl[0]);\n function transitionEnd() {\n $pageEl.addClass('page-with-card-opened');\n if (device.ios && $pageContentEl.length) {\n $pageContentEl.css('height', `${$pageContentEl[0].offsetHeight + 1}px`);\n setTimeout(() => {\n $pageContentEl.css('height', '');\n });\n }\n $cardEl.addClass('card-opened');\n $cardEl.removeClass('card-opening');\n $cardEl.trigger('card:opened');\n app.emit('cardOpened', $cardEl[0], $pageEl[0]);\n }\n $cardContentEl.css({\n width: `${maxWidth}px`,\n height: `${maxHeight}px`\n }).transform(`translate3d(${app.rtl ? cardLeftOffset + translateX : -cardLeftOffset - translateX}px, 0px, 0) scale(${1 / scaleX}, ${1 / scaleY})`);\n $cardEl.transform(`translate3d(${app.rtl ? -translateX : translateX}px, ${translateY}px, 0) scale(${scaleX}, ${scaleY})`);\n if (cardParams.animate) {\n $cardEl.transitionEnd(() => {\n transitionEnd();\n });\n } else {\n transitionEnd();\n }\n function onResize() {\n $cardEl.removeClass('card-transitioning');\n cardWidth = $cardEl[0].offsetWidth;\n cardHeight = $cardEl[0].offsetHeight;\n pageWidth = $pageEl[0].offsetWidth;\n pageHeight = $pageEl[0].offsetHeight;\n maxWidth = $cardSizeEl[0].offsetWidth || pageWidth;\n maxHeight = $cardSizeEl[0].offsetHeight || pageHeight;\n statusbarHeight = 0;\n if ($navbarEl && !cardParams.hideStatusbarOnOpen && maxHeight === pageHeight) {\n statusbarHeight = parseInt($navbarEl.css('--f7-safe-area-top'), 10);\n if (Number.isNaN(statusbarHeight)) statusbarHeight = 0;\n }\n if (statusbarHeight) {\n maxHeight -= statusbarHeight;\n }\n scaleX = maxWidth / cardWidth;\n scaleY = maxHeight / cardHeight;\n $cardEl.transform('translate3d(0px, 0px, 0) scale(1)');\n offset = $cardEl.offset();\n pageOffset = $pageEl.offset();\n if (statusbarHeight) {\n pageOffset.top += statusbarHeight / 2;\n }\n offset.left -= pageOffset.left;\n offset.top -= pageOffset.top;\n cardLeftOffset = offset.left - (pageWidth - maxWidth) / 2;\n if (app.rtl) cardLeftOffset -= $cardEl[0].scrollLeft;\n cardTopOffset = offset.top - (pageHeight - maxHeight) / 2;\n cardRightOffset = maxWidth - cardWidth - cardLeftOffset;\n cardBottomOffset = maxHeight - cardHeight - cardTopOffset;\n if (app.rtl) {\n [cardLeftOffset, cardRightOffset] = [cardRightOffset, cardLeftOffset];\n }\n translateX = (cardRightOffset - cardLeftOffset) / 2;\n translateY = (cardBottomOffset - cardTopOffset) / 2;\n $cardEl.transform(`translate3d(${app.rtl ? -translateX : translateX}px, ${translateY}px, 0) scale(${scaleX}, ${scaleY})`);\n $cardContentEl.css({\n width: `${maxWidth}px`,\n height: `${maxHeight}px`\n }).transform(`translate3d(${app.rtl ? cardLeftOffset + translateX : -cardLeftOffset - translateX}px, 0px, 0) scale(${1 / scaleX}, ${1 / scaleY})`);\n }\n let cardScrollTop;\n let isTouched;\n let isMoved;\n let touchStartX;\n let touchStartY;\n let touchEndX;\n let touchEndY;\n let isScrolling;\n let progress;\n let isV;\n let isH;\n let $cardScrollableEl;\n function onTouchStart(e) {\n if (!$(e.target).closest($cardEl).length || !e.isTrusted) return;\n if (!$cardEl.hasClass('card-opened')) return;\n $cardScrollableEl = $cardEl.find(cardParams.scrollableEl);\n if ($cardScrollableEl[0] && $cardScrollableEl[0] !== $cardContentEl[0] && !$cardScrollableEl[0].contains(e.target)) {\n cardScrollTop = 0;\n } else {\n cardScrollTop = $cardScrollableEl.scrollTop();\n }\n isTouched = true;\n touchStartX = e.targetTouches[0].pageX;\n touchStartY = e.targetTouches[0].pageY;\n isScrolling = undefined;\n isV = false;\n isH = false;\n }\n function onTouchMove(e) {\n if (!isTouched || !e.isTrusted) return;\n touchEndX = e.targetTouches[0].pageX;\n touchEndY = e.targetTouches[0].pageY;\n if (typeof isScrolling === 'undefined') {\n isScrolling = !!(isScrolling || Math.abs(touchEndY - touchStartY) > Math.abs(touchEndX - touchStartX));\n }\n if (!isH && !isV) {\n if (!isScrolling && e.targetTouches[0].clientX <= 50) {\n isH = true;\n } else {\n isV = true;\n }\n }\n if (!(isH || isV) || isV && cardScrollTop !== 0) {\n isTouched = true;\n isMoved = true;\n return;\n }\n if (!isMoved) {\n $cardEl.removeClass('card-transitioning');\n }\n isMoved = true;\n progress = isV ? Math.max((touchEndY - touchStartY) / 150, 0) : Math.max((touchEndX - touchStartX) / (cardWidth / 2), 0);\n if (progress > 0 && isV || isH) {\n if (isV && device.ios && $cardScrollableEl[0] === $cardContentEl[0]) {\n $cardScrollableEl.css('-webkit-overflow-scrolling', 'auto');\n $cardScrollableEl.scrollTop(0);\n }\n e.preventDefault();\n }\n if (progress > 1) progress **= 0.3;\n if (progress > (isV ? 1.3 : 1.1)) {\n isTouched = false;\n isMoved = false;\n app.card.close($cardEl);\n } else {\n $cardEl.transform(`translate3d(${app.rtl ? -translateX : translateX}px, ${translateY}px, 0) scale(${scaleX * (1 - progress * 0.2)}, ${scaleY * (1 - progress * 0.2)})`);\n }\n }\n function onTouchEnd(e) {\n if (!isTouched || !isMoved || !e.isTrusted) return;\n isTouched = false;\n isMoved = false;\n if (device.ios) {\n $cardScrollableEl.css('-webkit-overflow-scrolling', '');\n }\n if (progress >= 0.8) {\n app.card.close($cardEl);\n } else {\n $cardEl.addClass('card-transitioning').transform(`translate3d(${app.rtl ? -translateX : translateX}px, ${translateY}px, 0) scale(${scaleX}, ${scaleY})`);\n }\n }\n $cardEl[0].detachEventHandlers = function detachEventHandlers() {\n app.off('resize', onResize);\n if (support.touch && cardParams.swipeToClose) {\n app.off('touchstart:passive', onTouchStart);\n app.off('touchmove:active', onTouchMove);\n app.off('touchend:passive', onTouchEnd);\n }\n };\n app.on('resize', onResize);\n if (support.touch && cardParams.swipeToClose) {\n app.on('touchstart:passive', onTouchStart);\n app.on('touchmove:active', onTouchMove);\n app.on('touchend:passive', onTouchEnd);\n }\n },\n close(cardEl, animate) {\n if (cardEl === void 0) {\n cardEl = '.card-expandable.card-opened';\n }\n if (animate === void 0) {\n animate = true;\n }\n const app = this;\n const device = getDevice();\n const $cardEl = $(cardEl).eq(0);\n if (!$cardEl || !$cardEl.length) return;\n if (!$cardEl.hasClass('card-opened') || $cardEl.hasClass('card-opening') || $cardEl.hasClass('card-closing')) return;\n const $cardContentEl = $cardEl.children('.card-content');\n const $pageContentEl = $cardEl.parents('.page-content');\n const $pageEl = $cardEl.parents('.page').eq(0);\n if (!$pageEl.length) return;\n const cardParams = Object.assign({\n animate\n }, app.params.card, $cardEl.dataset());\n const $cardScrollableEl = $cardEl.find(cardParams.scrollableEl);\n let $navbarEl;\n let $toolbarEl;\n let $backdropEl;\n if ($cardEl.attr('data-backdrop-el')) {\n $backdropEl = $($cardEl.attr('data-backdrop-el'));\n }\n if (cardParams.backdrop) {\n $backdropEl = $cardEl.parents('.page-content').find('.card-backdrop');\n }\n if (cardParams.hideNavbarOnOpen) {\n $navbarEl = $pageEl.children('.navbar');\n if (!$navbarEl.length) {\n if ($pageEl[0].f7Page) $navbarEl = $pageEl[0].f7Page.$navbarEl;\n }\n if ($navbarEl && $navbarEl.length && !$cardEl[0].f7KeepNavbarOnClose) {\n app.navbar.show($navbarEl, cardParams.animate, true);\n }\n }\n if (cardParams.hideToolbarOnOpen) {\n $toolbarEl = $pageEl.children('.toolbar');\n if (!$toolbarEl.length) {\n $toolbarEl = $pageEl.parents('.view').children('.toolbar');\n }\n if (!$toolbarEl.length) {\n $toolbarEl = $pageEl.parents('.views').children('.toolbar');\n }\n if ($toolbarEl && $toolbarEl.length && !$cardEl[0].f7KeepToolbarOnClose) {\n app.toolbar.show($toolbarEl, cardParams.animate);\n }\n }\n $pageEl.removeClass('page-with-card-opened');\n if (device.ios && $pageContentEl.length) {\n $pageContentEl.css('height', `${$pageContentEl[0].offsetHeight + 1}px`);\n setTimeout(() => {\n $pageContentEl.css('height', '');\n });\n }\n if ($backdropEl && $backdropEl.length) {\n $backdropEl.removeClass('card-backdrop-in').addClass('card-backdrop-out');\n }\n $cardEl.removeClass('card-opened card-transitioning');\n if (cardParams.animate) {\n $cardEl.addClass('card-closing');\n } else {\n $cardEl.addClass('card-no-transition');\n }\n $cardEl.transform('');\n $cardEl.trigger('card:close');\n app.emit('cardClose', $cardEl[0], $pageEl[0]);\n const animateWidth = $cardEl.hasClass('card-expandable-animate-width');\n function transitionEnd() {\n if (!animateWidth) {\n $cardContentEl.css({\n width: '',\n height: ''\n });\n }\n if ($backdropEl && $backdropEl.length) {\n $backdropEl.removeClass('card-backdrop-in card-backdrop-out');\n }\n $cardEl.removeClass('card-closing card-no-transition');\n $cardEl.trigger('card:closed');\n $cardEl.find('.card-expandable-size').remove();\n app.emit('cardClosed', $cardEl[0], $pageEl[0]);\n }\n if (animateWidth) {\n $cardContentEl.css({\n width: '',\n height: ''\n });\n }\n $cardContentEl.transform('').scrollTop(0, animate ? 300 : 0);\n if ($cardScrollableEl.length && $cardScrollableEl[0] !== $cardContentEl[0]) {\n $cardScrollableEl.scrollTop(0, animate ? 300 : 0);\n }\n if (animate) {\n $cardContentEl.transitionEnd(() => {\n transitionEnd();\n });\n } else {\n transitionEnd();\n }\n if ($cardEl[0].detachEventHandlers) {\n $cardEl[0].detachEventHandlers();\n delete $cardEl[0].detachEventHandlers;\n }\n },\n toggle(cardEl, animate) {\n if (cardEl === void 0) {\n cardEl = '.card-expandable';\n }\n const app = this;\n const $cardEl = $(cardEl).eq(0);\n if (!$cardEl.length) return;\n if ($cardEl.hasClass('card-opened')) {\n app.card.close($cardEl, animate);\n } else {\n app.card.open($cardEl, animate);\n }\n }\n};\nexport default {\n name: 'card',\n params: {\n card: {\n hideNavbarOnOpen: true,\n hideStatusbarOnOpen: true,\n hideToolbarOnOpen: true,\n scrollableEl: '.card-content',\n swipeToClose: true,\n closeByBackdropClick: true,\n backdrop: true\n }\n },\n create() {\n const app = this;\n bindMethods(app, {\n card: CardExpandable\n });\n },\n on: {\n pageBeforeIn(page) {\n const app = this;\n if (app.params.card.hideNavbarOnOpen && page.navbarEl && page.$el.find('.card-opened.card-expandable').length) {\n app.navbar.hide(page.navbarEl, true, app.params.card.hideStatusbarOnOpen, true);\n }\n if (app.params.card.hideToolbarOnOpen && page.$el.find('.card-opened.card-expandable').length) {\n let $toolbarEl = page.$el.children('.toolbar');\n if (!$toolbarEl.length) {\n $toolbarEl = page.$el.parents('.view').children('.toolbar');\n }\n if (!$toolbarEl.length) {\n $toolbarEl = page.$el.parents('.views').children('.toolbar');\n }\n if ($toolbarEl && $toolbarEl.length) {\n app.toolbar.hide($toolbarEl);\n }\n }\n }\n },\n clicks: {\n '.card-close': function closeCard($clickedEl, data) {\n const app = this;\n app.card.close(data.card, data.animate);\n },\n '.card-open': function closeCard($clickedEl, data) {\n const app = this;\n app.card.open(data.card, data.animate);\n },\n '.card-expandable': function toggleExpandableCard($clickedEl, data, e) {\n const app = this;\n if ($clickedEl.hasClass('card-opened') || $clickedEl.hasClass('card-opening') || $clickedEl.hasClass('card-closing')) return;\n if ($(e.target).closest('.card-prevent-open, .card-close').length) return;\n app.card.open($clickedEl);\n },\n '.card-backdrop-in': function onBackdropClick() {\n const app = this;\n let needToClose = false;\n if (app.params.card.closeByBackdropClick) needToClose = true;\n const $openedCardEl = $('.card-opened');\n if (!$openedCardEl.length) return;\n if ($openedCardEl.attr('data-close-by-backdrop-click') === 'true') {\n needToClose = true;\n } else if ($openedCardEl.attr('data-close-by-backdrop-click') === 'false') {\n needToClose = false;\n }\n if (needToClose) app.card.close($openedCardEl);\n }\n }\n};", "export default {\n name: 'chip'\n};", "import { getWindow, getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend, serializeObject } from '../../shared/utils.js';\n\n// Form Data\nconst FormData = {\n store(form, data) {\n const app = this;\n const window = getWindow();\n let formId = form;\n const $formEl = $(form);\n if ($formEl.length && $formEl.is('form') && $formEl.attr('id')) {\n formId = $formEl.attr('id');\n }\n // Store form data in app.formsData\n app.form.data[`form-${formId}`] = data;\n\n // Store form data in local storage also\n window.localStorage[`f7form-${formId}`] = JSON.stringify(data);\n },\n get(form) {\n const app = this;\n const window = getWindow();\n let formId = form;\n const $formEl = $(form);\n if ($formEl.length && $formEl.is('form') && $formEl.attr('id')) {\n formId = $formEl.attr('id');\n }\n if (window.localStorage[`f7form-${formId}`]) {\n return JSON.parse(window.localStorage[`f7form-${formId}`]);\n }\n if (app.form.data[`form-${formId}`]) {\n return app.form.data[`form-${formId}`];\n }\n return undefined;\n },\n remove(form) {\n const app = this;\n const window = getWindow();\n let formId = form;\n const $formEl = $(form);\n if ($formEl.length && $formEl.is('form') && $formEl.attr('id')) {\n formId = $formEl.attr('id');\n }\n\n // Delete form data from app.formsData\n if (app.form.data[`form-${formId}`]) {\n app.form.data[`form-${formId}`] = '';\n delete app.form.data[`form-${formId}`];\n }\n\n // Delete form data from local storage also\n if (window.localStorage[`f7form-${formId}`]) {\n window.localStorage[`f7form-${formId}`] = '';\n window.localStorage.removeItem(`f7form-${formId}`);\n }\n }\n};\n\n// Form Storage\nconst FormStorage = {\n init(formEl) {\n const app = this;\n const $formEl = $(formEl);\n const formId = $formEl.attr('id');\n if (!formId) return;\n const initialData = app.form.getFormData(formId);\n if (initialData) {\n app.form.fillFromData($formEl, initialData);\n }\n function store() {\n const data = app.form.convertToData($formEl);\n if (!data) return;\n app.form.storeFormData(formId, data);\n $formEl.trigger('form:storedata', data);\n app.emit('formStoreData', $formEl[0], data);\n }\n $formEl.on('change submit', store);\n },\n destroy(formEl) {\n const $formEl = $(formEl);\n $formEl.off('change submit');\n }\n};\n\n// Form To/From Data\nfunction formToData(formEl) {\n const app = this;\n const $formEl = $(formEl).eq(0);\n if ($formEl.length === 0) return undefined;\n\n // Form data\n const data = {};\n\n // Skip input types\n const skipTypes = ['submit', 'image', 'button', 'file'];\n const skipNames = [];\n $formEl.find('input, select, textarea').each(inputEl => {\n const $inputEl = $(inputEl);\n if ($inputEl.hasClass('ignore-store-data') || $inputEl.hasClass('no-store-data')) {\n return;\n }\n const name = $inputEl.attr('name');\n const type = $inputEl.attr('type');\n const tag = inputEl.nodeName.toLowerCase();\n if (skipTypes.indexOf(type) >= 0) return;\n if (skipNames.indexOf(name) >= 0 || !name) return;\n if (tag === 'select' && $inputEl.prop('multiple')) {\n skipNames.push(name);\n data[name] = [];\n $formEl.find(`select[name=\"${name}\"] option`).each(el => {\n if (el.selected) data[name].push(el.value);\n });\n } else {\n switch (type) {\n case 'checkbox':\n skipNames.push(name);\n data[name] = [];\n $formEl.find(`input[name=\"${name}\"]`).each(el => {\n if (el.checked) data[name].push(el.value);\n });\n break;\n case 'radio':\n skipNames.push(name);\n $formEl.find(`input[name=\"${name}\"]`).each(el => {\n if (el.checked) data[name] = el.value;\n });\n break;\n default:\n data[name] = $inputEl.val();\n break;\n }\n }\n });\n $formEl.trigger('form:todata', data);\n app.emit('formToData', $formEl[0], data);\n return data;\n}\nfunction formFromData(formEl, formData) {\n const app = this;\n const $formEl = $(formEl).eq(0);\n if (!$formEl.length) return;\n let data = formData;\n const formId = $formEl.attr('id');\n if (!data && formId) {\n data = app.form.getFormData(formId);\n }\n if (!data) return;\n\n // Skip input types\n const skipTypes = ['submit', 'image', 'button', 'file'];\n const skipNames = [];\n $formEl.find('input, select, textarea').each(inputEl => {\n const $inputEl = $(inputEl);\n if ($inputEl.hasClass('ignore-store-data') || $inputEl.hasClass('no-store-data')) {\n return;\n }\n const name = $inputEl.attr('name');\n const type = $inputEl.attr('type');\n const tag = inputEl.nodeName.toLowerCase();\n if (typeof data[name] === 'undefined' || data[name] === null) return;\n if (skipTypes.indexOf(type) >= 0) return;\n if (skipNames.indexOf(name) >= 0 || !name) return;\n if (tag === 'select' && $inputEl.prop('multiple')) {\n skipNames.push(name);\n $formEl.find(`select[name=\"${name}\"] option`).each(el => {\n const selectEl = el;\n if (data[name].indexOf(el.value) >= 0) selectEl.selected = true;else selectEl.selected = false;\n });\n } else {\n switch (type) {\n case 'checkbox':\n skipNames.push(name);\n $formEl.find(`input[name=\"${name}\"]`).each(el => {\n const checkboxEl = el;\n if (data[name].indexOf(el.value) >= 0) checkboxEl.checked = true;else checkboxEl.checked = false;\n });\n break;\n case 'radio':\n skipNames.push(name);\n $formEl.find(`input[name=\"${name}\"]`).each(el => {\n const radioEl = el;\n if (data[name] === el.value) radioEl.checked = true;else radioEl.checked = false;\n });\n break;\n default:\n $inputEl.val(data[name]);\n break;\n }\n }\n if (tag === 'select' || tag === 'input' || tag === 'textarea') {\n $inputEl.trigger('change', 'fromdata');\n }\n });\n $formEl.trigger('form:fromdata', data);\n app.emit('formFromData', $formEl[0], data);\n}\nfunction initAjaxForm() {\n const app = this;\n const window = getWindow();\n const document = getDocument();\n function onSubmitChange(e, fromData) {\n const $formEl = $(this);\n if (e.type === 'change' && !$formEl.hasClass('form-ajax-submit-onchange')) return;\n if (e.type === 'submit') e.preventDefault();\n if (e.type === 'change' && fromData === 'fromdata') return;\n const method = ($formEl.attr('method') || 'GET').toUpperCase();\n const contentType = $formEl.attr('enctype') || $formEl.prop('enctype');\n let url = $formEl.attr('action');\n if (!url) return;\n let data;\n if (method === 'POST') {\n if (contentType === 'application/x-www-form-urlencoded' || contentType === 'application/json') {\n data = app.form.convertToData($formEl[0]);\n if (contentType === 'application/json') {\n data = JSON.stringify(data);\n }\n } else {\n data = new window.FormData($formEl[0]);\n }\n } else {\n data = serializeObject(app.form.convertToData($formEl[0]));\n if (url.includes('?')) {\n url += `&${data}`;\n } else {\n url += `?${data}`;\n }\n }\n $formEl.trigger('formajax:beforesend', {\n data\n });\n app.emit('formAjaxBeforeSend', $formEl[0], data);\n fetch(url, {\n method,\n headers: {\n 'Content-Type': contentType || 'application/x-www-form-urlencoded'\n },\n ...(method === 'POST' || method === 'PUT' ? {\n body: data\n } : {})\n }).then(response => {\n $formEl.trigger('formajax:complete', {\n data,\n response\n });\n app.emit('formAjaxComplete', $formEl[0], data, response);\n $formEl.trigger('formajax:success', {\n data,\n response\n });\n app.emit('formAjaxSuccess', $formEl[0], data, response);\n }).catch(error => {\n $formEl.trigger('formajax:error', {\n data,\n error\n });\n app.emit('formAjaxError', $formEl[0], data, error);\n });\n }\n $(document).on('submit change', 'form.form-ajax-submit, form.form-ajax-submit-onchange', onSubmitChange);\n}\nexport default {\n name: 'form',\n create() {\n const app = this;\n extend(app, {\n form: {\n data: {},\n storeFormData: FormData.store.bind(app),\n getFormData: FormData.get.bind(app),\n removeFormData: FormData.remove.bind(app),\n convertToData: formToData.bind(app),\n fillFromData: formFromData.bind(app),\n storage: {\n init: FormStorage.init.bind(app),\n destroy: FormStorage.destroy.bind(app)\n }\n }\n });\n },\n on: {\n init() {\n const app = this;\n initAjaxForm.call(app);\n },\n tabBeforeRemove(tabEl) {\n const app = this;\n $(tabEl).find('.form-store-data').each(formEl => {\n app.form.storage.destroy(formEl);\n });\n },\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.form-store-data').each(formEl => {\n app.form.storage.init(formEl);\n });\n },\n pageBeforeRemove(page) {\n const app = this;\n page.$el.find('.form-store-data').each(formEl => {\n app.form.storage.destroy(formEl);\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.form-store-data').each(formEl => {\n app.form.storage.init(formEl);\n });\n }\n }\n};", "import { getWindow, getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { bindMethods } from '../../shared/utils.js';\nimport { getDevice } from '../../shared/get-device.js';\nconst Input = {\n ignoreTypes: ['checkbox', 'button', 'submit', 'range', 'radio', 'image'],\n createTextareaResizableShadow() {\n const document = getDocument();\n const $shadowEl = $(document.createElement('textarea'));\n $shadowEl.addClass('textarea-resizable-shadow');\n $shadowEl.prop({\n disabled: true,\n readonly: true\n });\n Input.textareaResizableShadow = $shadowEl;\n },\n textareaResizableShadow: undefined,\n resizeTextarea(textareaEl) {\n const app = this;\n const window = getWindow();\n const $textareaEl = $(textareaEl);\n if (!Input.textareaResizableShadow) {\n Input.createTextareaResizableShadow();\n }\n const $shadowEl = Input.textareaResizableShadow;\n if (!$textareaEl.length) return;\n if (!$textareaEl.hasClass('resizable')) return;\n if (Input.textareaResizableShadow.parents().length === 0) {\n app.$el.append($shadowEl);\n }\n const styles = window.getComputedStyle($textareaEl[0]);\n 'padding-top padding-bottom padding-left padding-right margin-left margin-right margin-top margin-bottom width font-size font-family font-style font-weight line-height font-variant text-transform letter-spacing border box-sizing display'.split(' ').forEach(style => {\n let styleValue = styles[style];\n if ('font-size line-height letter-spacing width'.split(' ').indexOf(style) >= 0) {\n styleValue = styleValue.replace(',', '.');\n }\n $shadowEl.css(style, styleValue);\n });\n const currentHeight = $textareaEl[0].clientHeight;\n $shadowEl.val('');\n const initialHeight = $shadowEl[0].scrollHeight;\n $shadowEl.val($textareaEl.val());\n $shadowEl.css('height', 0);\n const scrollHeight = $shadowEl[0].scrollHeight;\n if (currentHeight !== scrollHeight) {\n if (scrollHeight > initialHeight) {\n $textareaEl.css('height', `${scrollHeight}px`);\n } else if (scrollHeight < currentHeight) {\n $textareaEl.css('height', '');\n }\n if (scrollHeight > initialHeight || scrollHeight < currentHeight) {\n $textareaEl.trigger('textarea:resize', {\n initialHeight,\n currentHeight,\n scrollHeight\n });\n app.emit('textareaResize', {\n initialHeight,\n currentHeight,\n scrollHeight\n });\n }\n }\n },\n validate(inputEl) {\n const $inputEl = $(inputEl);\n if (!$inputEl.length) return true;\n const $itemInputEl = $inputEl.parents('.item-input');\n const $inputWrapEl = $inputEl.parents('.input');\n function unsetReadonly() {\n if ($inputEl[0].f7ValidateReadonly) {\n $inputEl[0].readOnly = false;\n }\n }\n function setReadonly() {\n if ($inputEl[0].f7ValidateReadonly) {\n $inputEl[0].readOnly = true;\n }\n }\n unsetReadonly();\n const validity = $inputEl[0].validity;\n const validationMessage = $inputEl.dataset().errorMessage || $inputEl[0].validationMessage || '';\n if (!validity) {\n setReadonly();\n return true;\n }\n if (!validity.valid) {\n let $errorEl = $inputEl.nextAll('.item-input-error-message, .input-error-message');\n if (validationMessage) {\n if ($errorEl.length === 0) {\n $errorEl = $(``);\n $errorEl.insertAfter($inputEl);\n }\n $errorEl.text(validationMessage);\n }\n if ($errorEl.length > 0) {\n $itemInputEl.addClass('item-input-with-error-message');\n $inputWrapEl.addClass('input-with-error-message');\n }\n $itemInputEl.addClass('item-input-invalid');\n $inputWrapEl.addClass('input-invalid');\n $inputEl.addClass('input-invalid');\n setReadonly();\n return false;\n }\n $itemInputEl.removeClass('item-input-invalid item-input-with-error-message');\n $inputWrapEl.removeClass('input-invalid input-with-error-message');\n $inputEl.removeClass('input-invalid');\n setReadonly();\n return true;\n },\n validateInputs(el) {\n const app = this;\n const validates = $(el).find('input, textarea, select').map(inputEl => app.input.validate(inputEl));\n return validates.indexOf(false) < 0;\n },\n focus(inputEl) {\n const $inputEl = $(inputEl);\n const type = $inputEl.attr('type');\n if (Input.ignoreTypes.indexOf(type) >= 0) return;\n $inputEl.parents('.item-input').addClass('item-input-focused');\n $inputEl.parents('.input').addClass('input-focused');\n $inputEl.addClass('input-focused');\n },\n blur(inputEl) {\n const $inputEl = $(inputEl);\n $inputEl.parents('.item-input').removeClass('item-input-focused');\n $inputEl.parents('.input').removeClass('input-focused');\n $inputEl.removeClass('input-focused');\n },\n checkEmptyState(inputEl) {\n const app = this;\n let $inputEl = $(inputEl);\n if (!$inputEl.is('input, select, textarea, .item-input [contenteditable]')) {\n $inputEl = $inputEl.find('input, select, textarea, .item-input [contenteditable]').eq(0);\n }\n if (!$inputEl.length) return;\n const isContentEditable = $inputEl[0].hasAttribute('contenteditable');\n let value;\n if (isContentEditable) {\n if ($inputEl.find('.text-editor-placeholder').length) value = '';else value = $inputEl.html();\n } else {\n value = $inputEl.val();\n }\n const $itemInputEl = $inputEl.parents('.item-input');\n const $inputWrapEl = $inputEl.parents('.input');\n if (value && typeof value === 'string' && value.trim() !== '' || Array.isArray(value) && value.length > 0) {\n $itemInputEl.addClass('item-input-with-value');\n $inputWrapEl.addClass('input-with-value');\n $inputEl.addClass('input-with-value');\n $inputEl.trigger('input:notempty');\n app.emit('inputNotEmpty', $inputEl[0]);\n } else {\n $itemInputEl.removeClass('item-input-with-value');\n $inputWrapEl.removeClass('input-with-value');\n $inputEl.removeClass('input-with-value');\n $inputEl.trigger('input:empty');\n app.emit('inputEmpty', $inputEl[0]);\n }\n },\n scrollIntoView(inputEl, duration, centered, force) {\n if (duration === void 0) {\n duration = 0;\n }\n const $inputEl = $(inputEl);\n const $scrollableEl = $inputEl.parents('.page-content, .panel, .card-expandable .card-content').eq(0);\n if (!$scrollableEl.length) {\n return false;\n }\n const contentHeight = $scrollableEl[0].offsetHeight;\n const contentScrollTop = $scrollableEl[0].scrollTop;\n const contentPaddingTop = parseInt($scrollableEl.css('padding-top'), 10);\n const contentPaddingBottom = parseInt($scrollableEl.css('padding-bottom'), 10);\n const contentOffsetTop = $scrollableEl.offset().top - contentScrollTop;\n const inputOffsetTop = $inputEl.offset().top - contentOffsetTop;\n const inputHeight = $inputEl[0].offsetHeight;\n const min = inputOffsetTop + contentScrollTop - contentPaddingTop;\n const max = inputOffsetTop + contentScrollTop - contentHeight + contentPaddingBottom + inputHeight;\n const centeredPosition = min + (max - min) / 2;\n if (contentScrollTop > min) {\n $scrollableEl.scrollTop(centered ? centeredPosition : min, duration);\n return true;\n }\n if (contentScrollTop < max) {\n $scrollableEl.scrollTop(centered ? centeredPosition : max, duration);\n return true;\n }\n if (force) {\n $scrollableEl.scrollTop(centered ? centeredPosition : max, duration);\n }\n return false;\n },\n init() {\n const app = this;\n const device = getDevice();\n const window = getWindow();\n const document = getDocument();\n Input.createTextareaResizableShadow();\n function onFocus() {\n const inputEl = this;\n if (app.params.input.scrollIntoViewOnFocus) {\n if (device.android) {\n $(window).once('resize', () => {\n if (document && document.activeElement === inputEl) {\n app.input.scrollIntoView(inputEl, app.params.input.scrollIntoViewDuration, app.params.input.scrollIntoViewCentered, app.params.input.scrollIntoViewAlways);\n }\n });\n } else {\n app.input.scrollIntoView(inputEl, app.params.input.scrollIntoViewDuration, app.params.input.scrollIntoViewCentered, app.params.input.scrollIntoViewAlways);\n }\n }\n app.input.focus(inputEl);\n }\n function onBlur() {\n const $inputEl = $(this);\n const tag = $inputEl[0].nodeName.toLowerCase();\n app.input.blur($inputEl);\n if ($inputEl.dataset().validate || $inputEl.attr('validate') !== null || $inputEl.attr('data-validate-on-blur') !== null) {\n app.input.validate($inputEl);\n }\n // Resize textarea\n if (tag === 'textarea' && $inputEl.hasClass('resizable')) {\n if (Input.textareaResizableShadow) Input.textareaResizableShadow.remove();\n }\n }\n function onChange() {\n const $inputEl = $(this);\n const type = $inputEl.attr('type');\n const tag = $inputEl[0].nodeName.toLowerCase();\n const isContentEditable = $inputEl[0].hasAttribute('contenteditable');\n if (Input.ignoreTypes.indexOf(type) >= 0) return;\n\n // Check Empty State\n app.input.checkEmptyState($inputEl);\n if (isContentEditable) return;\n\n // Check validation\n if ($inputEl.attr('data-validate-on-blur') === null && ($inputEl.dataset().validate || $inputEl.attr('validate') !== null)) {\n app.input.validate($inputEl);\n }\n\n // Resize textarea\n if (tag === 'textarea' && $inputEl.hasClass('resizable')) {\n app.input.resizeTextarea($inputEl);\n }\n }\n function onInvalid(e) {\n const $inputEl = $(this);\n if ($inputEl.attr('data-validate-on-blur') === null && ($inputEl.dataset().validate || $inputEl.attr('validate') !== null)) {\n e.preventDefault();\n app.input.validate($inputEl);\n }\n }\n function clearInput() {\n const $clicked = $(this);\n const $inputEl = $clicked.siblings('input, textarea').eq(0);\n const previousValue = $inputEl.val();\n $inputEl.val('').trigger('input change').focus().trigger('input:clear', previousValue);\n app.emit('inputClear', previousValue);\n }\n function preventDefault(e) {\n e.preventDefault();\n }\n $(document).on('click', '.input-clear-button', clearInput);\n $(document).on('mousedown', '.input-clear-button', preventDefault);\n $(document).on('change input', 'input, textarea, select, .item-input [contenteditable]', onChange, true);\n $(document).on('focus', 'input, textarea, select, .item-input [contenteditable]', onFocus, true);\n $(document).on('blur', 'input, textarea, select, .item-input [contenteditable]', onBlur, true);\n $(document).on('invalid', 'input, textarea, select', onInvalid, true);\n }\n};\nexport default {\n name: 'input',\n params: {\n input: {\n scrollIntoViewOnFocus: undefined,\n scrollIntoViewCentered: false,\n scrollIntoViewDuration: 0,\n scrollIntoViewAlways: false\n }\n },\n create() {\n const app = this;\n if (typeof app.params.input.scrollIntoViewOnFocus === 'undefined') {\n app.params.input.scrollIntoViewOnFocus = getDevice().android;\n }\n bindMethods(app, {\n input: Input\n });\n },\n on: {\n init() {\n const app = this;\n app.input.init();\n },\n tabMounted(tabEl) {\n const app = this;\n const $tabEl = $(tabEl);\n $tabEl.find('.item-input, .input').each(itemInputEl => {\n const $itemInputEl = $(itemInputEl);\n $itemInputEl.find('input, select, textarea, [contenteditable]').each(inputEl => {\n const $inputEl = $(inputEl);\n if (Input.ignoreTypes.indexOf($inputEl.attr('type')) >= 0) return;\n app.input.checkEmptyState($inputEl);\n });\n });\n $tabEl.find('textarea.resizable').each(textareaEl => {\n app.input.resizeTextarea(textareaEl);\n });\n },\n pageInit(page) {\n const app = this;\n const $pageEl = page.$el;\n $pageEl.find('.item-input, .input').each(itemInputEl => {\n const $itemInputEl = $(itemInputEl);\n $itemInputEl.find('input, select, textarea, [contenteditable]').each(inputEl => {\n const $inputEl = $(inputEl);\n if (Input.ignoreTypes.indexOf($inputEl.attr('type')) >= 0) return;\n app.input.checkEmptyState($inputEl);\n });\n });\n $pageEl.find('textarea.resizable').each(textareaEl => {\n app.input.resizeTextarea(textareaEl);\n });\n },\n 'panelBreakpoint panelCollapsedBreakpoint panelResize panelOpen panelSwipeOpen resize viewMasterDetailBreakpoint': function onPanelOpen(instance) {\n const app = this;\n if (instance && instance.$el) {\n instance.$el.find('textarea.resizable').each(textareaEl => {\n app.input.resizeTextarea(textareaEl);\n });\n } else {\n $('textarea.resizable').each(textareaEl => {\n app.input.resizeTextarea(textareaEl);\n });\n }\n }\n }\n};", "export default {\n name: 'checkbox'\n};", "export default {\n name: 'radio'\n};", "import $ from '../../shared/dom7.js';\nimport { extend, now, nextTick, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\nimport { getSupport } from '../../shared/get-support.js';\nclass Toggle extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const toggle = this;\n const support = getSupport();\n const defaults = {};\n\n // Extend defaults with modules params\n toggle.useModulesParams(defaults);\n toggle.params = extend(defaults, params);\n const el = toggle.params.el;\n if (!el) return toggle;\n const $el = $(el);\n if ($el.length === 0) return toggle;\n if ($el[0].f7Toggle) return $el[0].f7Toggle;\n const $inputEl = $el.children('input[type=\"checkbox\"]');\n extend(toggle, {\n app,\n $el,\n el: $el[0],\n $inputEl,\n inputEl: $inputEl[0],\n disabled: $el.hasClass('disabled') || $inputEl.hasClass('disabled') || $inputEl.attr('disabled') || $inputEl[0].disabled\n });\n Object.defineProperty(toggle, 'checked', {\n enumerable: true,\n configurable: true,\n set(checked) {\n if (!toggle || typeof toggle.$inputEl === 'undefined') return;\n if (toggle.checked === checked) return;\n $inputEl[0].checked = checked;\n toggle.$inputEl.trigger('change');\n },\n get() {\n return $inputEl[0].checked;\n }\n });\n $el[0].f7Toggle = toggle;\n let isTouched;\n const touchesStart = {};\n let isScrolling;\n let touchesDiff;\n let toggleWidth;\n let touchStartTime;\n let touchStartChecked;\n function handleTouchStart(e) {\n if (isTouched || toggle.disabled) return;\n touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n touchesDiff = 0;\n isTouched = true;\n isScrolling = undefined;\n touchStartTime = now();\n touchStartChecked = toggle.checked;\n toggleWidth = $el[0].offsetWidth;\n nextTick(() => {\n if (isTouched) {\n $el.addClass('toggle-active-state');\n }\n });\n }\n function handleTouchMove(e) {\n if (!isTouched || toggle.disabled) return;\n const pageX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n const pageY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n const inverter = app.rtl ? -1 : 1;\n if (typeof isScrolling === 'undefined') {\n isScrolling = !!(isScrolling || Math.abs(pageY - touchesStart.y) > Math.abs(pageX - touchesStart.x));\n }\n if (isScrolling) {\n isTouched = false;\n return;\n }\n e.preventDefault();\n touchesDiff = pageX - touchesStart.x;\n let changed;\n if (touchesDiff * inverter < 0 && Math.abs(touchesDiff) > toggleWidth / 3 && touchStartChecked) {\n changed = true;\n }\n if (touchesDiff * inverter > 0 && Math.abs(touchesDiff) > toggleWidth / 3 && !touchStartChecked) {\n changed = true;\n }\n if (changed) {\n touchesStart.x = pageX;\n toggle.checked = !touchStartChecked;\n touchStartChecked = !touchStartChecked;\n }\n }\n function handleTouchEnd() {\n if (!isTouched || toggle.disabled) {\n if (isScrolling) $el.removeClass('toggle-active-state');\n isTouched = false;\n return;\n }\n const inverter = app.rtl ? -1 : 1;\n isTouched = false;\n $el.removeClass('toggle-active-state');\n let changed;\n if (now() - touchStartTime < 300) {\n if (touchesDiff * inverter < 0 && touchStartChecked) {\n changed = true;\n }\n if (touchesDiff * inverter > 0 && !touchStartChecked) {\n changed = true;\n }\n if (changed) {\n toggle.checked = !touchStartChecked;\n }\n }\n }\n function handleInputChange() {\n toggle.$el.trigger('toggle:change');\n toggle.emit('local::change toggleChange', toggle);\n }\n toggle.attachEvents = function attachEvents() {\n const passive = support.passiveListener ? {\n passive: true\n } : false;\n $el.on(app.touchEvents.start, handleTouchStart, passive);\n app.on('touchmove', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n toggle.$inputEl.on('change', handleInputChange);\n };\n toggle.detachEvents = function detachEvents() {\n const passive = support.passiveListener ? {\n passive: true\n } : false;\n $el.off(app.touchEvents.start, handleTouchStart, passive);\n app.off('touchmove', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n toggle.$inputEl.off('change', handleInputChange);\n };\n\n // Install Modules\n toggle.useModules();\n\n // Init\n toggle.init();\n }\n toggle() {\n const toggle = this;\n toggle.checked = !toggle.checked;\n }\n init() {\n const toggle = this;\n toggle.attachEvents();\n }\n destroy() {\n let toggle = this;\n toggle.$el.trigger('toggle:beforedestroy');\n toggle.emit('local::beforeDestroy toggleBeforeDestroy', toggle);\n delete toggle.$el[0].f7Toggle;\n toggle.detachEvents();\n deleteProps(toggle);\n toggle = null;\n }\n}\nexport default Toggle;", "import $ from '../../shared/dom7.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nimport Toggle from './toggle-class.js';\nexport default {\n name: 'toggle',\n create() {\n const app = this;\n app.toggle = ConstructorMethods({\n defaultSelector: '.toggle',\n constructor: Toggle,\n app,\n domProp: 'f7Toggle'\n });\n },\n static: {\n Toggle\n },\n on: {\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.toggle-init').each(toggleEl => app.toggle.create({\n el: toggleEl\n }));\n },\n tabBeforeRemove(tabEl) {\n $(tabEl).find('.toggle-init').each(toggleEl => {\n if (toggleEl.f7Toggle) toggleEl.f7Toggle.destroy();\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.toggle-init').each(toggleEl => app.toggle.create({\n el: toggleEl\n }));\n },\n pageBeforeRemove(page) {\n page.$el.find('.toggle-init').each(toggleEl => {\n if (toggleEl.f7Toggle) toggleEl.f7Toggle.destroy();\n });\n }\n },\n vnode: {\n 'toggle-init': {\n insert(vnode) {\n const app = this;\n const toggleEl = vnode.elm;\n app.toggle.create({\n el: toggleEl\n });\n },\n destroy(vnode) {\n const toggleEl = vnode.elm;\n if (toggleEl.f7Toggle) toggleEl.f7Toggle.destroy();\n }\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { extend, nextTick, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\nimport { getSupport } from '../../shared/get-support.js';\nclass Range extends Framework7Class {\n constructor(app, params) {\n super(params, [app]);\n const range = this;\n const support = getSupport();\n const defaults = {\n el: null,\n inputEl: null,\n dual: false,\n step: 1,\n label: false,\n min: 0,\n max: 100,\n value: 0,\n draggableBar: true,\n vertical: false,\n verticalReversed: false,\n formatLabel: null,\n scale: false,\n scaleSteps: 5,\n scaleSubSteps: 0,\n formatScaleLabel: null,\n limitKnobPosition: app.theme === 'ios'\n };\n\n // Extend defaults with modules params\n range.useModulesParams(defaults);\n range.params = extend(defaults, params);\n const el = range.params.el;\n if (!el) return range;\n const $el = $(el);\n if ($el.length === 0) return range;\n if ($el[0].f7Range) return $el[0].f7Range;\n const dataset = $el.dataset();\n 'step min max value scaleSteps scaleSubSteps'.split(' ').forEach(paramName => {\n if (typeof params[paramName] === 'undefined' && typeof dataset[paramName] !== 'undefined') {\n range.params[paramName] = parseFloat(dataset[paramName]);\n }\n });\n 'dual label vertical verticalReversed scale'.split(' ').forEach(paramName => {\n if (typeof params[paramName] === 'undefined' && typeof dataset[paramName] !== 'undefined') {\n range.params[paramName] = dataset[paramName];\n }\n });\n if (!range.params.value) {\n if (typeof dataset.value !== 'undefined') range.params.value = dataset.value;\n if (typeof dataset.valueLeft !== 'undefined' && typeof dataset.valueRight !== 'undefined') {\n range.params.value = [parseFloat(dataset.valueLeft), parseFloat(dataset.valueRight)];\n }\n }\n let $inputEl;\n if (!range.params.dual) {\n if (range.params.inputEl) {\n $inputEl = $(range.params.inputEl);\n } else if ($el.find('input[type=\"range\"]').length) {\n $inputEl = $el.find('input[type=\"range\"]').eq(0);\n }\n }\n const {\n dual,\n step,\n label,\n min,\n max,\n value,\n vertical,\n verticalReversed,\n scale,\n scaleSteps,\n scaleSubSteps,\n limitKnobPosition\n } = range.params;\n extend(range, {\n app,\n $el,\n el: $el[0],\n $inputEl,\n inputEl: $inputEl ? $inputEl[0] : undefined,\n dual,\n step,\n label,\n min,\n max,\n value,\n previousValue: value,\n vertical,\n verticalReversed,\n scale,\n scaleSteps,\n scaleSubSteps,\n limitKnobPosition\n });\n if ($inputEl) {\n 'step min max'.split(' ').forEach(paramName => {\n if (!params[paramName] && $inputEl.attr(paramName)) {\n range.params[paramName] = parseFloat($inputEl.attr(paramName));\n range[paramName] = parseFloat($inputEl.attr(paramName));\n }\n });\n if (typeof $inputEl.val() !== 'undefined') {\n range.params.value = parseFloat($inputEl.val());\n range.value = parseFloat($inputEl.val());\n }\n }\n\n // Dual\n if (range.dual) {\n $el.addClass('range-slider-dual');\n }\n if (range.label) {\n $el.addClass('range-slider-label');\n }\n\n // Vertical\n if (range.vertical) {\n $el.addClass('range-slider-vertical');\n if (range.verticalReversed) {\n $el.addClass('range-slider-vertical-reversed');\n }\n } else {\n $el.addClass('range-slider-horizontal');\n }\n\n // Check for layout\n const $barEl = $('');\n const $barActiveEl = $('');\n $barEl.append($barActiveEl);\n\n // Create Knobs\n // prettier-ignore\n const knobHTML = `\n \n
\n ${range.label ? '
' : ''}\n
\n `;\n const knobs = [$(knobHTML)];\n if (range.dual) {\n knobs.push($(knobHTML));\n }\n $el.append($barEl);\n knobs.forEach($knobEl => {\n $el.append($knobEl);\n });\n\n // Labels\n const labels = [];\n if (range.label) {\n labels.push(knobs[0].find('.range-knob-label'));\n if (range.dual) {\n labels.push(knobs[1].find('.range-knob-label'));\n }\n }\n\n // Scale\n let $scaleEl;\n if (range.scale && range.scaleSteps >= 1) {\n $scaleEl = $(`\n \n ${range.renderScale()}\n
\n `);\n $el.append($scaleEl);\n }\n extend(range, {\n knobs,\n labels,\n $barEl,\n $barActiveEl,\n $scaleEl\n });\n $el[0].f7Range = range;\n\n // Touch Events\n let isTouched;\n const touchesStart = {};\n let isScrolling;\n let rangeOffset;\n let rangeOffsetLeft;\n let rangeOffsetTop;\n let $touchedKnobEl;\n let dualValueIndex;\n let valueChangedByTouch;\n let targetTouchIdentifier;\n function onTouchChange() {\n valueChangedByTouch = true;\n }\n function handleTouchStart(e) {\n if (isTouched) return;\n if (!range.params.draggableBar) {\n if ($(e.target).closest('.range-knob').length === 0) {\n return;\n }\n }\n valueChangedByTouch = false;\n touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n if (e.type === 'touchstart') {\n targetTouchIdentifier = e.targetTouches[0].identifier;\n }\n isTouched = true;\n isScrolling = undefined;\n rangeOffset = $el.offset();\n rangeOffsetLeft = rangeOffset.left;\n rangeOffsetTop = rangeOffset.top;\n let progress;\n if (range.vertical) {\n progress = (touchesStart.y - rangeOffsetTop) / range.rangeHeight;\n if (!range.verticalReversed) progress = 1 - progress;\n } else if (range.app.rtl) {\n progress = (rangeOffsetLeft + range.rangeWidth - touchesStart.x) / range.rangeWidth;\n } else {\n progress = (touchesStart.x - rangeOffsetLeft) / range.rangeWidth;\n }\n let newValue = progress * (range.max - range.min) + range.min;\n if (range.dual) {\n if (Math.abs(range.value[0] - newValue) < Math.abs(range.value[1] - newValue)) {\n dualValueIndex = 0;\n $touchedKnobEl = range.knobs[0];\n newValue = [newValue, range.value[1]];\n } else {\n dualValueIndex = 1;\n $touchedKnobEl = range.knobs[1];\n newValue = [range.value[0], newValue];\n }\n } else {\n $touchedKnobEl = range.knobs[0];\n newValue = progress * (range.max - range.min) + range.min;\n }\n nextTick(() => {\n if (isTouched) $touchedKnobEl.addClass('range-knob-active-state');\n }, 70);\n range.on('change', onTouchChange);\n range.setValue(newValue, true);\n }\n function handleTouchMove(e) {\n if (!isTouched) return;\n let pageX;\n let pageY;\n if (e.type === 'touchmove') {\n for (let i = 0; i < e.targetTouches.length; i += 1) {\n if (e.targetTouches[i].identifier === targetTouchIdentifier) {\n pageX = e.targetTouches[i].pageX;\n pageY = e.targetTouches[i].pageY;\n }\n }\n } else {\n pageX = e.pageX;\n pageY = e.pageY;\n }\n if (typeof pageX === 'undefined' && typeof pageY === 'undefined') return;\n if (typeof isScrolling === 'undefined' && !range.vertical) {\n isScrolling = !!(isScrolling || Math.abs(pageY - touchesStart.y) > Math.abs(pageX - touchesStart.x));\n }\n if (isScrolling) {\n isTouched = false;\n return;\n }\n e.preventDefault();\n let progress;\n if (range.vertical) {\n progress = (pageY - rangeOffsetTop) / range.rangeHeight;\n if (!range.verticalReversed) progress = 1 - progress;\n } else if (range.app.rtl) {\n progress = (rangeOffsetLeft + range.rangeWidth - pageX) / range.rangeWidth;\n } else {\n progress = (pageX - rangeOffsetLeft) / range.rangeWidth;\n }\n let newValue = progress * (range.max - range.min) + range.min;\n if (range.dual) {\n let leftValue;\n let rightValue;\n if (dualValueIndex === 0) {\n leftValue = newValue;\n rightValue = range.value[1];\n if (leftValue > rightValue) {\n rightValue = leftValue;\n }\n } else {\n leftValue = range.value[0];\n rightValue = newValue;\n if (rightValue < leftValue) {\n leftValue = rightValue;\n }\n }\n newValue = [leftValue, rightValue];\n }\n range.setValue(newValue, true);\n }\n function handleTouchEnd(e) {\n if (e.type === 'touchend') {\n let touchEnded;\n for (let i = 0; i < e.changedTouches.length; i += 1) {\n if (e.changedTouches[i].identifier === targetTouchIdentifier) touchEnded = true;\n }\n if (!touchEnded) return;\n }\n if (!isTouched) {\n if (isScrolling) $touchedKnobEl.removeClass('range-knob-active-state');\n isTouched = false;\n return;\n }\n range.off('change', onTouchChange);\n isTouched = false;\n $touchedKnobEl.removeClass('range-knob-active-state');\n if (valueChangedByTouch && range.$inputEl && !range.dual) {\n range.$inputEl.trigger('change');\n }\n valueChangedByTouch = false;\n if (typeof range.previousValue !== 'undefined') {\n if (range.dual && (range.previousValue[0] !== range.value[0] || range.previousValue[1] !== range.value[1]) || !range.dual && range.previousValue !== range.value) {\n range.$el.trigger('range:changed', range.value);\n range.emit('local::changed rangeChanged', range, range.value);\n }\n }\n }\n function handleResize() {\n range.calcSize();\n range.layout();\n }\n let parentModals;\n let parentPanel;\n let parentPage;\n range.attachEvents = function attachEvents() {\n const passive = support.passiveListener ? {\n passive: true\n } : false;\n range.$el.on(app.touchEvents.start, handleTouchStart, passive);\n app.on('touchmove', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n app.on('tabShow', handleResize);\n app.on('resize', handleResize);\n parentModals = range.$el.parents('.sheet-modal, .actions-modal, .popup, .popover, .login-screen, .dialog, .toast');\n parentModals.on('modal:open', handleResize);\n parentPanel = range.$el.parents('.panel');\n parentPanel.on('panel:open panel:resize', handleResize);\n parentPage = range.$el.parents('.page').eq(0);\n parentPage.on('page:reinit', handleResize);\n };\n range.detachEvents = function detachEvents() {\n const passive = support.passiveListener ? {\n passive: true\n } : false;\n range.$el.off(app.touchEvents.start, handleTouchStart, passive);\n app.off('touchmove', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n app.off('tabShow', handleResize);\n app.off('resize', handleResize);\n if (parentModals) {\n parentModals.off('modal:open', handleResize);\n }\n if (parentPanel) {\n parentPanel.off('panel:open panel:resize', handleResize);\n }\n if (parentPage) {\n parentPage.off('page:reinit', handleResize);\n }\n parentModals = null;\n parentPanel = null;\n parentPage = null;\n };\n\n // Install Modules\n range.useModules();\n\n // Init\n range.init();\n return range;\n }\n calcSize() {\n const range = this;\n if (range.vertical) {\n const height = range.$el.outerHeight();\n if (height === 0) return;\n range.rangeHeight = height;\n range.knobHeight = range.knobs[0].outerHeight();\n } else {\n const width = range.$el.outerWidth();\n if (width === 0) return;\n range.rangeWidth = width;\n range.knobWidth = range.knobs[0].outerWidth();\n }\n }\n layout() {\n const range = this;\n const {\n app,\n knobWidth,\n knobHeight,\n rangeWidth,\n rangeHeight,\n min,\n max,\n knobs,\n $barActiveEl,\n value,\n label,\n labels,\n vertical,\n verticalReversed,\n limitKnobPosition\n } = range;\n const knobSize = vertical ? knobHeight : knobWidth;\n const rangeSize = vertical ? rangeHeight : rangeWidth;\n // eslint-disable-next-line\n const positionProperty = vertical ? verticalReversed ? 'top' : 'bottom' : app.rtl ? 'right' : 'left';\n if (range.dual) {\n const progress = [(value[0] - min) / (max - min), (value[1] - min) / (max - min)];\n $barActiveEl.css({\n [positionProperty]: `${progress[0] * 100}%`,\n [vertical ? 'height' : 'width']: `${(progress[1] - progress[0]) * 100}%`\n });\n knobs.forEach(($knobEl, knobIndex) => {\n let startPos = rangeSize * progress[knobIndex];\n if (limitKnobPosition) {\n const realStartPos = rangeSize * progress[knobIndex] - knobSize / 2;\n if (realStartPos < 0) startPos = knobSize / 2;\n if (realStartPos + knobSize > rangeSize) startPos = rangeSize - knobSize / 2;\n }\n $knobEl.css(positionProperty, `${startPos}px`);\n if (label) labels[knobIndex].text(range.formatLabel(value[knobIndex], labels[knobIndex][0]));\n });\n } else {\n const progress = (value - min) / (max - min);\n $barActiveEl.css(vertical ? 'height' : 'width', `${progress * 100}%`);\n let startPos = rangeSize * progress;\n if (limitKnobPosition) {\n const realStartPos = rangeSize * progress - knobSize / 2;\n if (realStartPos < 0) startPos = knobSize / 2;\n if (realStartPos + knobSize > rangeSize) startPos = rangeSize - knobSize / 2;\n }\n knobs[0].css(positionProperty, `${startPos}px`);\n if (label) labels[0].text(range.formatLabel(value, labels[0][0]));\n }\n if (range.dual && value.indexOf(min) >= 0 || !range.dual && value === min) {\n range.$el.addClass('range-slider-min');\n } else {\n range.$el.removeClass('range-slider-min');\n }\n if (range.dual && value.indexOf(max) >= 0 || !range.dual && value === max) {\n range.$el.addClass('range-slider-max');\n } else {\n range.$el.removeClass('range-slider-max');\n }\n }\n setValue(newValue, byTouchMove) {\n const range = this;\n const {\n step,\n min,\n max\n } = range;\n let valueChanged;\n let oldValue;\n if (range.dual) {\n oldValue = [range.value[0], range.value[1]];\n let newValues = newValue;\n if (!Array.isArray(newValues)) newValues = [newValue, newValue];\n if (newValue[0] > newValue[1]) {\n newValues = [newValues[0], newValues[0]];\n }\n newValues = newValues.map(value => Math.max(Math.min(Math.round(value / step) * step, max), min));\n if (newValues[0] === range.value[0] && newValues[1] === range.value[1]) {\n return range;\n }\n newValues.forEach((value, valueIndex) => {\n range.value[valueIndex] = value;\n });\n valueChanged = oldValue[0] !== newValues[0] || oldValue[1] !== newValues[1];\n range.layout();\n } else {\n oldValue = range.value;\n const value = Math.max(Math.min(Math.round(newValue / step) * step, max), min);\n range.value = value;\n range.layout();\n valueChanged = oldValue !== value;\n }\n if (valueChanged) {\n range.previousValue = oldValue;\n }\n // Events\n if (!valueChanged) return range;\n range.$el.trigger('range:change', range.value);\n if (range.$inputEl && !range.dual) {\n range.$inputEl.val(range.value);\n if (!byTouchMove) {\n range.$inputEl.trigger('input change');\n } else {\n range.$inputEl.trigger('input');\n }\n }\n if (!byTouchMove) {\n range.$el.trigger('range:changed', range.value);\n range.emit('local::changed rangeChanged', range, range.value);\n }\n range.emit('local::change rangeChange', range, range.value);\n return range;\n }\n getValue() {\n return this.value;\n }\n formatLabel(value, labelEl) {\n const range = this;\n if (range.params.formatLabel) return range.params.formatLabel.call(range, value, labelEl);\n return value;\n }\n formatScaleLabel(value) {\n const range = this;\n if (range.params.formatScaleLabel) return range.params.formatScaleLabel.call(range, value);\n return value;\n }\n renderScale() {\n const range = this;\n const {\n app,\n verticalReversed,\n vertical\n } = range;\n\n // eslint-disable-next-line\n const positionProperty = vertical ? verticalReversed ? 'top' : 'bottom' : app.rtl ? 'right' : 'left';\n let html = '';\n Array.from({\n length: range.scaleSteps + 1\n }).forEach((scaleEl, index) => {\n const scaleStepValue = (range.max - range.min) / range.scaleSteps;\n const scaleValue = range.min + scaleStepValue * index;\n const progress = (scaleValue - range.min) / (range.max - range.min);\n html += `${range.formatScaleLabel(scaleValue)}
`;\n if (range.scaleSubSteps && range.scaleSubSteps > 1 && index < range.scaleSteps) {\n Array.from({\n length: range.scaleSubSteps - 1\n }).forEach((subStepEl, subIndex) => {\n const subStep = scaleStepValue / range.scaleSubSteps;\n const scaleSubValue = scaleValue + subStep * (subIndex + 1);\n const subProgress = (scaleSubValue - range.min) / (range.max - range.min);\n html += ``;\n });\n }\n });\n return html;\n }\n updateScale() {\n const range = this;\n if (!range.scale || range.scaleSteps < 1) {\n if (range.$scaleEl) range.$scaleEl.remove();\n delete range.$scaleEl;\n return;\n }\n if (!range.$scaleEl) {\n range.$scaleEl = $('');\n range.$el.append(range.$scaleEl);\n }\n range.$scaleEl.html(range.renderScale());\n }\n init() {\n const range = this;\n range.calcSize();\n range.layout();\n range.attachEvents();\n return range;\n }\n destroy() {\n let range = this;\n range.$el.trigger('range:beforedestroy');\n range.emit('local::beforeDestroy rangeBeforeDestroy', range);\n delete range.$el[0].f7Range;\n range.detachEvents();\n deleteProps(range);\n range = null;\n }\n}\nexport default Range;", "import $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nimport Range from './range-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'range',\n create() {\n const app = this;\n app.range = extend(ConstructorMethods({\n defaultSelector: '.range-slider',\n constructor: Range,\n app,\n domProp: 'f7Range'\n }), {\n getValue(el) {\n if (el === void 0) {\n el = '.range-slider';\n }\n const range = app.range.get(el);\n if (range) return range.getValue();\n return undefined;\n },\n setValue(el, value) {\n if (el === void 0) {\n el = '.range-slider';\n }\n const range = app.range.get(el);\n if (range) return range.setValue(value);\n return undefined;\n }\n });\n },\n static: {\n Range\n },\n on: {\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.range-slider-init').each(rangeEl => new Range(app, {\n el: rangeEl\n }));\n },\n tabBeforeRemove(tabEl) {\n $(tabEl).find('.range-slider-init').each(rangeEl => {\n if (rangeEl.f7Range) rangeEl.f7Range.destroy();\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.range-slider-init').each(rangeEl => new Range(app, {\n el: rangeEl\n }));\n },\n pageBeforeRemove(page) {\n page.$el.find('.range-slider-init').each(rangeEl => {\n if (rangeEl.f7Range) rangeEl.f7Range.destroy();\n });\n }\n },\n vnode: {\n 'range-slider-init': {\n insert(vnode) {\n const rangeEl = vnode.elm;\n const app = this;\n app.range.create({\n el: rangeEl\n });\n },\n destroy(vnode) {\n const rangeEl = vnode.elm;\n if (rangeEl.f7Range) rangeEl.f7Range.destroy();\n }\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\nclass Stepper extends Framework7Class {\n constructor(app, params) {\n super(params, [app]);\n const stepper = this;\n const defaults = {\n el: null,\n inputEl: null,\n valueEl: null,\n value: 0,\n formatValue: null,\n step: 1,\n min: 0,\n max: 100,\n watchInput: true,\n autorepeat: false,\n autorepeatDynamic: false,\n wraps: false,\n manualInputMode: false,\n decimalPoint: 4,\n buttonsEndInputMode: true\n };\n\n // Extend defaults with modules params\n stepper.useModulesParams(defaults);\n stepper.params = extend(defaults, params);\n if (stepper.params.value < stepper.params.min) {\n stepper.params.value = stepper.params.min;\n }\n if (stepper.params.value > stepper.params.max) {\n stepper.params.value = stepper.params.max;\n }\n const el = stepper.params.el;\n if (!el) return stepper;\n const $el = $(el);\n if ($el.length === 0) return stepper;\n if ($el[0].f7Stepper) return $el[0].f7Stepper;\n let $inputEl;\n if (stepper.params.inputEl) {\n $inputEl = $(stepper.params.inputEl);\n } else if ($el.find('.stepper-input-wrap').find('input, textarea').length) {\n $inputEl = $el.find('.stepper-input-wrap').find('input, textarea').eq(0);\n }\n if ($inputEl && $inputEl.length) {\n 'step min max'.split(' ').forEach(paramName => {\n if (!params[paramName] && $inputEl.attr(paramName)) {\n stepper.params[paramName] = parseFloat($inputEl.attr(paramName));\n }\n });\n const decimalPoint = parseInt(stepper.params.decimalPoint, 10);\n if (Number.isNaN(decimalPoint)) {\n stepper.params.decimalPoint = 0;\n } else {\n stepper.params.decimalPoint = decimalPoint;\n }\n const inputValue = parseFloat($inputEl.val());\n if (typeof params.value === 'undefined' && !Number.isNaN(inputValue) && (inputValue || inputValue === 0)) {\n stepper.params.value = inputValue;\n }\n }\n let $valueEl;\n if (stepper.params.valueEl) {\n $valueEl = $(stepper.params.valueEl);\n } else if ($el.find('.stepper-value').length) {\n $valueEl = $el.find('.stepper-value').eq(0);\n }\n const $buttonPlusEl = $el.find('.stepper-button-plus');\n const $buttonMinusEl = $el.find('.stepper-button-minus');\n const {\n step,\n min,\n max,\n value,\n decimalPoint\n } = stepper.params;\n extend(stepper, {\n app,\n $el,\n el: $el[0],\n $buttonPlusEl,\n buttonPlusEl: $buttonPlusEl[0],\n $buttonMinusEl,\n buttonMinusEl: $buttonMinusEl[0],\n $inputEl,\n inputEl: $inputEl ? $inputEl[0] : undefined,\n $valueEl,\n valueEl: $valueEl ? $valueEl[0] : undefined,\n step,\n min,\n max,\n value,\n decimalPoint,\n typeModeChanged: false\n });\n $el[0].f7Stepper = stepper;\n\n // Handle Events\n const touchesStart = {};\n let isTouched;\n let isScrolling;\n let preventButtonClick;\n let intervalId;\n let timeoutId;\n let autorepeatAction = null;\n let autorepeatInAction = false;\n let manualInput = false;\n function dynamicRepeat(current, progressions, startsIn, progressionStep, repeatEvery, action) {\n clearTimeout(timeoutId);\n timeoutId = setTimeout(() => {\n if (current === 1) {\n preventButtonClick = true;\n autorepeatInAction = true;\n }\n clearInterval(intervalId);\n action();\n intervalId = setInterval(() => {\n action();\n }, repeatEvery);\n if (current < progressions) {\n dynamicRepeat(current + 1, progressions, startsIn, progressionStep, repeatEvery / 2, action);\n }\n }, current === 1 ? startsIn : progressionStep);\n }\n function onTouchStart(e) {\n if (isTouched) return;\n if (manualInput) {\n return;\n }\n if ($(e.target).closest($buttonPlusEl).length) {\n autorepeatAction = 'increment';\n } else if ($(e.target).closest($buttonMinusEl).length) {\n autorepeatAction = 'decrement';\n }\n if (!autorepeatAction) return;\n touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n isTouched = true;\n isScrolling = undefined;\n const progressions = stepper.params.autorepeatDynamic ? 4 : 1;\n dynamicRepeat(1, progressions, 500, 1000, 300, () => {\n stepper[autorepeatAction]();\n });\n }\n function onTouchMove(e) {\n if (!isTouched) return;\n if (manualInput) {\n return;\n }\n const pageX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n const pageY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n if (typeof isScrolling === 'undefined' && !autorepeatInAction) {\n isScrolling = !!(isScrolling || Math.abs(pageY - touchesStart.y) > Math.abs(pageX - touchesStart.x));\n }\n const distance = ((pageX - touchesStart.x) ** 2 + (pageY - touchesStart.y) ** 2) ** 0.5;\n if (isScrolling || distance > 20) {\n isTouched = false;\n clearTimeout(timeoutId);\n clearInterval(intervalId);\n }\n }\n function onTouchEnd() {\n clearTimeout(timeoutId);\n clearInterval(intervalId);\n autorepeatAction = null;\n autorepeatInAction = false;\n isTouched = false;\n }\n function onMinusClick() {\n if (manualInput) {\n if (stepper.params.buttonsEndInputMode) {\n manualInput = false;\n stepper.endTypeMode(true);\n }\n return;\n }\n if (preventButtonClick) {\n preventButtonClick = false;\n return;\n }\n stepper.decrement(true);\n }\n function onPlusClick() {\n if (manualInput) {\n if (stepper.params.buttonsEndInputMode) {\n manualInput = false;\n stepper.endTypeMode(true);\n }\n return;\n }\n if (preventButtonClick) {\n preventButtonClick = false;\n return;\n }\n stepper.increment(true);\n }\n function onInputClick(e) {\n if (!e.target.readOnly && stepper.params.manualInputMode) {\n manualInput = true;\n if (typeof e.target.selectionStart === 'number') {\n e.target.selectionStart = e.target.value.length;\n e.target.selectionEnd = e.target.value.length;\n }\n }\n }\n function onInputKey(e) {\n if (e.keyCode === 13 || e.which === 13) {\n e.preventDefault();\n manualInput = false;\n stepper.endTypeMode();\n }\n }\n function onInputBlur() {\n manualInput = false;\n stepper.endTypeMode(true);\n }\n function onInput(e) {\n if (manualInput) {\n stepper.typeValue(e.target.value);\n return;\n }\n if (e.detail && e.detail.sentByF7Stepper) return;\n stepper.setValue(e.target.value, true);\n }\n stepper.attachEvents = function attachEvents() {\n $buttonMinusEl.on('click', onMinusClick);\n $buttonPlusEl.on('click', onPlusClick);\n if (stepper.params.watchInput && $inputEl && $inputEl.length) {\n $inputEl.on('input', onInput);\n $inputEl.on('click', onInputClick);\n $inputEl.on('blur', onInputBlur);\n $inputEl.on('keyup', onInputKey);\n }\n if (stepper.params.autorepeat) {\n app.on('touchstart:passive', onTouchStart);\n app.on('touchmove:active', onTouchMove);\n app.on('touchend:passive', onTouchEnd);\n }\n };\n stepper.detachEvents = function detachEvents() {\n $buttonMinusEl.off('click', onMinusClick);\n $buttonPlusEl.off('click', onPlusClick);\n if (stepper.params.watchInput && $inputEl && $inputEl.length) {\n $inputEl.off('input', onInput);\n $inputEl.off('click', onInputClick);\n $inputEl.off('blur', onInputBlur);\n $inputEl.off('keyup', onInputKey);\n }\n };\n\n // Install Modules\n stepper.useModules();\n\n // Init\n stepper.init();\n return stepper;\n }\n minus() {\n return this.decrement();\n }\n plus() {\n return this.increment();\n }\n decrement() {\n const stepper = this;\n return stepper.setValue(stepper.value - stepper.step, false, true);\n }\n increment() {\n const stepper = this;\n return stepper.setValue(stepper.value + stepper.step, false, true);\n }\n setValue(newValue, forceUpdate, withWraps) {\n const stepper = this;\n const {\n step,\n min,\n max\n } = stepper;\n const oldValue = stepper.value;\n let value = Math.round(newValue / step) * step;\n if (stepper.params.wraps && withWraps) {\n if (value > max) value = min;\n if (value < min) value = max;\n } else {\n value = Math.max(Math.min(value, max), min);\n }\n if (Number.isNaN(value)) {\n value = oldValue;\n }\n stepper.value = value;\n const valueChanged = oldValue !== value;\n\n // Events\n if (!valueChanged && !forceUpdate) return stepper;\n stepper.$el.trigger('stepper:change', stepper.value);\n const formattedValue = stepper.formatValue(stepper.value);\n if (stepper.$inputEl && stepper.$inputEl.length) {\n stepper.$inputEl.val(formattedValue);\n stepper.$inputEl.trigger('input change', {\n sentByF7Stepper: true\n });\n }\n if (stepper.$valueEl && stepper.$valueEl.length) {\n stepper.$valueEl.html(formattedValue);\n }\n stepper.emit('local::change stepperChange', stepper, stepper.value);\n return stepper;\n }\n endTypeMode(noBlur) {\n const stepper = this;\n const {\n min,\n max\n } = stepper;\n let value = parseFloat(stepper.value);\n if (Number.isNaN(value)) value = 0;\n value = Math.max(Math.min(value, max), min);\n stepper.value = value;\n if (!stepper.typeModeChanged) {\n if (stepper.$inputEl && stepper.$inputEl.length && !noBlur) {\n stepper.$inputEl.blur();\n }\n return stepper;\n }\n stepper.typeModeChanged = false;\n stepper.$el.trigger('stepper:change', stepper.value);\n const formattedValue = stepper.formatValue(stepper.value);\n if (stepper.$inputEl && stepper.$inputEl.length) {\n stepper.$inputEl.val(formattedValue);\n stepper.$inputEl.trigger('input change', {\n sentByF7Stepper: true\n });\n if (!noBlur) stepper.$inputEl.blur();\n }\n if (stepper.$valueEl && stepper.$valueEl.length) {\n stepper.$valueEl.html(formattedValue);\n }\n stepper.emit('local::change stepperChange', stepper, stepper.value);\n return stepper;\n }\n typeValue(value) {\n const stepper = this;\n stepper.typeModeChanged = true;\n let inputTxt = String(value);\n if (inputTxt.length === 1 && inputTxt === '-') return stepper;\n if (inputTxt.lastIndexOf('.') + 1 === inputTxt.length || inputTxt.lastIndexOf(',') + 1 === inputTxt.length) {\n if (inputTxt.lastIndexOf('.') !== inputTxt.indexOf('.') || inputTxt.lastIndexOf(',') !== inputTxt.indexOf(',')) {\n inputTxt = inputTxt.slice(0, -1);\n stepper.value = inputTxt;\n stepper.$inputEl.val(stepper.value);\n return stepper;\n }\n } else {\n let newValue = parseFloat(inputTxt.replace(',', '.'));\n if (newValue === 0) {\n stepper.value = inputTxt.replace(',', '.');\n stepper.$inputEl.val(stepper.value);\n return stepper;\n }\n if (Number.isNaN(newValue)) {\n stepper.value = 0;\n stepper.$inputEl.val(stepper.value);\n return stepper;\n }\n const powVal = 10 ** stepper.params.decimalPoint;\n newValue = Math.round(newValue * powVal).toFixed(stepper.params.decimalPoint + 1) / powVal;\n stepper.value = parseFloat(String(newValue).replace(',', '.'));\n stepper.$inputEl.val(stepper.value);\n return stepper;\n }\n stepper.value = inputTxt;\n stepper.$inputEl.val(inputTxt);\n return stepper;\n }\n getValue() {\n return this.value;\n }\n formatValue(value) {\n const stepper = this;\n if (!stepper.params.formatValue) return value;\n return stepper.params.formatValue.call(stepper, value);\n }\n init() {\n const stepper = this;\n stepper.attachEvents();\n if (stepper.$valueEl && stepper.$valueEl.length) {\n const formattedValue = stepper.formatValue(stepper.value);\n stepper.$valueEl.html(formattedValue);\n }\n return stepper;\n }\n destroy() {\n let stepper = this;\n stepper.$el.trigger('stepper:beforedestroy');\n stepper.emit('local::beforeDestroy stepperBeforeDestroy', stepper);\n delete stepper.$el[0].f7Stepper;\n stepper.detachEvents();\n deleteProps(stepper);\n stepper = null;\n }\n}\nexport default Stepper;", "import $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nimport Stepper from './stepper-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'stepper',\n create() {\n const app = this;\n app.stepper = extend(ConstructorMethods({\n defaultSelector: '.stepper',\n constructor: Stepper,\n app,\n domProp: 'f7Stepper'\n }), {\n getValue(el) {\n if (el === void 0) {\n el = '.stepper';\n }\n const stepper = app.stepper.get(el);\n if (stepper) return stepper.getValue();\n return undefined;\n },\n setValue(el, value) {\n if (el === void 0) {\n el = '.stepper';\n }\n const stepper = app.stepper.get(el);\n if (stepper) return stepper.setValue(value);\n return undefined;\n }\n });\n },\n static: {\n Stepper\n },\n on: {\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.stepper-init').each(stepperEl => {\n const dataset = $(stepperEl).dataset();\n app.stepper.create(extend({\n el: stepperEl\n }, dataset || {}));\n });\n },\n tabBeforeRemove(tabEl) {\n $(tabEl).find('.stepper-init').each(stepperEl => {\n if (stepperEl.f7Stepper) stepperEl.f7Stepper.destroy();\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.stepper-init').each(stepperEl => {\n const dataset = $(stepperEl).dataset();\n app.stepper.create(extend({\n el: stepperEl\n }, dataset || {}));\n });\n },\n pageBeforeRemove(page) {\n page.$el.find('.stepper-init').each(stepperEl => {\n if (stepperEl.f7Stepper) stepperEl.f7Stepper.destroy();\n });\n }\n },\n vnode: {\n 'stepper-init': {\n insert(vnode) {\n const app = this;\n const stepperEl = vnode.elm;\n const dataset = $(stepperEl).dataset();\n app.stepper.create(extend({\n el: stepperEl\n }, dataset || {}));\n },\n destroy(vnode) {\n const stepperEl = vnode.elm;\n if (stepperEl.f7Stepper) stepperEl.f7Stepper.destroy();\n }\n }\n }\n};", "/* eslint no-control-regex: \"off\" */\nconst defaultDiacriticsRemovalap = [{\n base: 'A',\n letters: '\\u0041\\u24B6\\uFF21\\u00C0\\u00C1\\u00C2\\u1EA6\\u1EA4\\u1EAA\\u1EA8\\u00C3\\u0100\\u0102\\u1EB0\\u1EAE\\u1EB4\\u1EB2\\u0226\\u01E0\\u00C4\\u01DE\\u1EA2\\u00C5\\u01FA\\u01CD\\u0200\\u0202\\u1EA0\\u1EAC\\u1EB6\\u1E00\\u0104\\u023A\\u2C6F'\n}, {\n base: 'AA',\n letters: '\\uA732'\n}, {\n base: 'AE',\n letters: '\\u00C6\\u01FC\\u01E2'\n}, {\n base: 'AO',\n letters: '\\uA734'\n}, {\n base: 'AU',\n letters: '\\uA736'\n}, {\n base: 'AV',\n letters: '\\uA738\\uA73A'\n}, {\n base: 'AY',\n letters: '\\uA73C'\n}, {\n base: 'B',\n letters: '\\u0042\\u24B7\\uFF22\\u1E02\\u1E04\\u1E06\\u0243\\u0182\\u0181'\n}, {\n base: 'C',\n letters: '\\u0043\\u24B8\\uFF23\\u0106\\u0108\\u010A\\u010C\\u00C7\\u1E08\\u0187\\u023B\\uA73E'\n}, {\n base: 'D',\n letters: '\\u0044\\u24B9\\uFF24\\u1E0A\\u010E\\u1E0C\\u1E10\\u1E12\\u1E0E\\u0110\\u018B\\u018A\\u0189\\uA779'\n}, {\n base: 'DZ',\n letters: '\\u01F1\\u01C4'\n}, {\n base: 'Dz',\n letters: '\\u01F2\\u01C5'\n}, {\n base: 'E',\n letters: '\\u0045\\u24BA\\uFF25\\u00C8\\u00C9\\u00CA\\u1EC0\\u1EBE\\u1EC4\\u1EC2\\u1EBC\\u0112\\u1E14\\u1E16\\u0114\\u0116\\u00CB\\u1EBA\\u011A\\u0204\\u0206\\u1EB8\\u1EC6\\u0228\\u1E1C\\u0118\\u1E18\\u1E1A\\u0190\\u018E'\n}, {\n base: 'F',\n letters: '\\u0046\\u24BB\\uFF26\\u1E1E\\u0191\\uA77B'\n}, {\n base: 'G',\n letters: '\\u0047\\u24BC\\uFF27\\u01F4\\u011C\\u1E20\\u011E\\u0120\\u01E6\\u0122\\u01E4\\u0193\\uA7A0\\uA77D\\uA77E'\n}, {\n base: 'H',\n letters: '\\u0048\\u24BD\\uFF28\\u0124\\u1E22\\u1E26\\u021E\\u1E24\\u1E28\\u1E2A\\u0126\\u2C67\\u2C75\\uA78D'\n}, {\n base: 'I',\n letters: '\\u0049\\u24BE\\uFF29\\u00CC\\u00CD\\u00CE\\u0128\\u012A\\u012C\\u0130\\u00CF\\u1E2E\\u1EC8\\u01CF\\u0208\\u020A\\u1ECA\\u012E\\u1E2C\\u0197'\n}, {\n base: 'J',\n letters: '\\u004A\\u24BF\\uFF2A\\u0134\\u0248'\n}, {\n base: 'K',\n letters: '\\u004B\\u24C0\\uFF2B\\u1E30\\u01E8\\u1E32\\u0136\\u1E34\\u0198\\u2C69\\uA740\\uA742\\uA744\\uA7A2'\n}, {\n base: 'L',\n letters: '\\u004C\\u24C1\\uFF2C\\u013F\\u0139\\u013D\\u1E36\\u1E38\\u013B\\u1E3C\\u1E3A\\u0141\\u023D\\u2C62\\u2C60\\uA748\\uA746\\uA780'\n}, {\n base: 'LJ',\n letters: '\\u01C7'\n}, {\n base: 'Lj',\n letters: '\\u01C8'\n}, {\n base: 'M',\n letters: '\\u004D\\u24C2\\uFF2D\\u1E3E\\u1E40\\u1E42\\u2C6E\\u019C'\n}, {\n base: 'N',\n letters: '\\u004E\\u24C3\\uFF2E\\u01F8\\u0143\\u00D1\\u1E44\\u0147\\u1E46\\u0145\\u1E4A\\u1E48\\u0220\\u019D\\uA790\\uA7A4'\n}, {\n base: 'NJ',\n letters: '\\u01CA'\n}, {\n base: 'Nj',\n letters: '\\u01CB'\n}, {\n base: 'O',\n letters: '\\u004F\\u24C4\\uFF2F\\u00D2\\u00D3\\u00D4\\u1ED2\\u1ED0\\u1ED6\\u1ED4\\u00D5\\u1E4C\\u022C\\u1E4E\\u014C\\u1E50\\u1E52\\u014E\\u022E\\u0230\\u00D6\\u022A\\u1ECE\\u0150\\u01D1\\u020C\\u020E\\u01A0\\u1EDC\\u1EDA\\u1EE0\\u1EDE\\u1EE2\\u1ECC\\u1ED8\\u01EA\\u01EC\\u00D8\\u01FE\\u0186\\u019F\\uA74A\\uA74C'\n}, {\n base: 'OI',\n letters: '\\u01A2'\n}, {\n base: 'OO',\n letters: '\\uA74E'\n}, {\n base: 'OU',\n letters: '\\u0222'\n}, {\n base: 'OE',\n letters: '\\u008C\\u0152'\n}, {\n base: 'oe',\n letters: '\\u009C\\u0153'\n}, {\n base: 'P',\n letters: '\\u0050\\u24C5\\uFF30\\u1E54\\u1E56\\u01A4\\u2C63\\uA750\\uA752\\uA754'\n}, {\n base: 'Q',\n letters: '\\u0051\\u24C6\\uFF31\\uA756\\uA758\\u024A'\n}, {\n base: 'R',\n letters: '\\u0052\\u24C7\\uFF32\\u0154\\u1E58\\u0158\\u0210\\u0212\\u1E5A\\u1E5C\\u0156\\u1E5E\\u024C\\u2C64\\uA75A\\uA7A6\\uA782'\n}, {\n base: 'S',\n letters: '\\u0053\\u24C8\\uFF33\\u1E9E\\u015A\\u1E64\\u015C\\u1E60\\u0160\\u1E66\\u1E62\\u1E68\\u0218\\u015E\\u2C7E\\uA7A8\\uA784'\n}, {\n base: 'T',\n letters: '\\u0054\\u24C9\\uFF34\\u1E6A\\u0164\\u1E6C\\u021A\\u0162\\u1E70\\u1E6E\\u0166\\u01AC\\u01AE\\u023E\\uA786'\n}, {\n base: 'TZ',\n letters: '\\uA728'\n}, {\n base: 'U',\n letters: '\\u0055\\u24CA\\uFF35\\u00D9\\u00DA\\u00DB\\u0168\\u1E78\\u016A\\u1E7A\\u016C\\u00DC\\u01DB\\u01D7\\u01D5\\u01D9\\u1EE6\\u016E\\u0170\\u01D3\\u0214\\u0216\\u01AF\\u1EEA\\u1EE8\\u1EEE\\u1EEC\\u1EF0\\u1EE4\\u1E72\\u0172\\u1E76\\u1E74\\u0244'\n}, {\n base: 'V',\n letters: '\\u0056\\u24CB\\uFF36\\u1E7C\\u1E7E\\u01B2\\uA75E\\u0245'\n}, {\n base: 'VY',\n letters: '\\uA760'\n}, {\n base: 'W',\n letters: '\\u0057\\u24CC\\uFF37\\u1E80\\u1E82\\u0174\\u1E86\\u1E84\\u1E88\\u2C72'\n}, {\n base: 'X',\n letters: '\\u0058\\u24CD\\uFF38\\u1E8A\\u1E8C'\n}, {\n base: 'Y',\n letters: '\\u0059\\u24CE\\uFF39\\u1EF2\\u00DD\\u0176\\u1EF8\\u0232\\u1E8E\\u0178\\u1EF6\\u1EF4\\u01B3\\u024E\\u1EFE'\n}, {\n base: 'Z',\n letters: '\\u005A\\u24CF\\uFF3A\\u0179\\u1E90\\u017B\\u017D\\u1E92\\u1E94\\u01B5\\u0224\\u2C7F\\u2C6B\\uA762'\n}, {\n base: 'a',\n letters: '\\u0061\\u24D0\\uFF41\\u1E9A\\u00E0\\u00E1\\u00E2\\u1EA7\\u1EA5\\u1EAB\\u1EA9\\u00E3\\u0101\\u0103\\u1EB1\\u1EAF\\u1EB5\\u1EB3\\u0227\\u01E1\\u00E4\\u01DF\\u1EA3\\u00E5\\u01FB\\u01CE\\u0201\\u0203\\u1EA1\\u1EAD\\u1EB7\\u1E01\\u0105\\u2C65\\u0250'\n}, {\n base: 'aa',\n letters: '\\uA733'\n}, {\n base: 'ae',\n letters: '\\u00E6\\u01FD\\u01E3'\n}, {\n base: 'ao',\n letters: '\\uA735'\n}, {\n base: 'au',\n letters: '\\uA737'\n}, {\n base: 'av',\n letters: '\\uA739\\uA73B'\n}, {\n base: 'ay',\n letters: '\\uA73D'\n}, {\n base: 'b',\n letters: '\\u0062\\u24D1\\uFF42\\u1E03\\u1E05\\u1E07\\u0180\\u0183\\u0253'\n}, {\n base: 'c',\n letters: '\\u0063\\u24D2\\uFF43\\u0107\\u0109\\u010B\\u010D\\u00E7\\u1E09\\u0188\\u023C\\uA73F\\u2184'\n}, {\n base: 'd',\n letters: '\\u0064\\u24D3\\uFF44\\u1E0B\\u010F\\u1E0D\\u1E11\\u1E13\\u1E0F\\u0111\\u018C\\u0256\\u0257\\uA77A'\n}, {\n base: 'dz',\n letters: '\\u01F3\\u01C6'\n}, {\n base: 'e',\n letters: '\\u0065\\u24D4\\uFF45\\u00E8\\u00E9\\u00EA\\u1EC1\\u1EBF\\u1EC5\\u1EC3\\u1EBD\\u0113\\u1E15\\u1E17\\u0115\\u0117\\u00EB\\u1EBB\\u011B\\u0205\\u0207\\u1EB9\\u1EC7\\u0229\\u1E1D\\u0119\\u1E19\\u1E1B\\u0247\\u025B\\u01DD'\n}, {\n base: 'f',\n letters: '\\u0066\\u24D5\\uFF46\\u1E1F\\u0192\\uA77C'\n}, {\n base: 'g',\n letters: '\\u0067\\u24D6\\uFF47\\u01F5\\u011D\\u1E21\\u011F\\u0121\\u01E7\\u0123\\u01E5\\u0260\\uA7A1\\u1D79\\uA77F'\n}, {\n base: 'h',\n letters: '\\u0068\\u24D7\\uFF48\\u0125\\u1E23\\u1E27\\u021F\\u1E25\\u1E29\\u1E2B\\u1E96\\u0127\\u2C68\\u2C76\\u0265'\n}, {\n base: 'hv',\n letters: '\\u0195'\n}, {\n base: 'i',\n letters: '\\u0069\\u24D8\\uFF49\\u00EC\\u00ED\\u00EE\\u0129\\u012B\\u012D\\u00EF\\u1E2F\\u1EC9\\u01D0\\u0209\\u020B\\u1ECB\\u012F\\u1E2D\\u0268\\u0131'\n}, {\n base: 'j',\n letters: '\\u006A\\u24D9\\uFF4A\\u0135\\u01F0\\u0249'\n}, {\n base: 'k',\n letters: '\\u006B\\u24DA\\uFF4B\\u1E31\\u01E9\\u1E33\\u0137\\u1E35\\u0199\\u2C6A\\uA741\\uA743\\uA745\\uA7A3'\n}, {\n base: 'l',\n letters: '\\u006C\\u24DB\\uFF4C\\u0140\\u013A\\u013E\\u1E37\\u1E39\\u013C\\u1E3D\\u1E3B\\u017F\\u0142\\u019A\\u026B\\u2C61\\uA749\\uA781\\uA747'\n}, {\n base: 'lj',\n letters: '\\u01C9'\n}, {\n base: 'm',\n letters: '\\u006D\\u24DC\\uFF4D\\u1E3F\\u1E41\\u1E43\\u0271\\u026F'\n}, {\n base: 'n',\n letters: '\\u006E\\u24DD\\uFF4E\\u01F9\\u0144\\u00F1\\u1E45\\u0148\\u1E47\\u0146\\u1E4B\\u1E49\\u019E\\u0272\\u0149\\uA791\\uA7A5'\n}, {\n base: 'nj',\n letters: '\\u01CC'\n}, {\n base: 'o',\n letters: '\\u006F\\u24DE\\uFF4F\\u00F2\\u00F3\\u00F4\\u1ED3\\u1ED1\\u1ED7\\u1ED5\\u00F5\\u1E4D\\u022D\\u1E4F\\u014D\\u1E51\\u1E53\\u014F\\u022F\\u0231\\u00F6\\u022B\\u1ECF\\u0151\\u01D2\\u020D\\u020F\\u01A1\\u1EDD\\u1EDB\\u1EE1\\u1EDF\\u1EE3\\u1ECD\\u1ED9\\u01EB\\u01ED\\u00F8\\u01FF\\u0254\\uA74B\\uA74D\\u0275'\n}, {\n base: 'oi',\n letters: '\\u01A3'\n}, {\n base: 'ou',\n letters: '\\u0223'\n}, {\n base: 'oo',\n letters: '\\uA74F'\n}, {\n base: 'p',\n letters: '\\u0070\\u24DF\\uFF50\\u1E55\\u1E57\\u01A5\\u1D7D\\uA751\\uA753\\uA755'\n}, {\n base: 'q',\n letters: '\\u0071\\u24E0\\uFF51\\u024B\\uA757\\uA759'\n}, {\n base: 'r',\n letters: '\\u0072\\u24E1\\uFF52\\u0155\\u1E59\\u0159\\u0211\\u0213\\u1E5B\\u1E5D\\u0157\\u1E5F\\u024D\\u027D\\uA75B\\uA7A7\\uA783'\n}, {\n base: 's',\n letters: '\\u0073\\u24E2\\uFF53\\u00DF\\u015B\\u1E65\\u015D\\u1E61\\u0161\\u1E67\\u1E63\\u1E69\\u0219\\u015F\\u023F\\uA7A9\\uA785\\u1E9B'\n}, {\n base: 't',\n letters: '\\u0074\\u24E3\\uFF54\\u1E6B\\u1E97\\u0165\\u1E6D\\u021B\\u0163\\u1E71\\u1E6F\\u0167\\u01AD\\u0288\\u2C66\\uA787'\n}, {\n base: 'tz',\n letters: '\\uA729'\n}, {\n base: 'u',\n letters: '\\u0075\\u24E4\\uFF55\\u00F9\\u00FA\\u00FB\\u0169\\u1E79\\u016B\\u1E7B\\u016D\\u00FC\\u01DC\\u01D8\\u01D6\\u01DA\\u1EE7\\u016F\\u0171\\u01D4\\u0215\\u0217\\u01B0\\u1EEB\\u1EE9\\u1EEF\\u1EED\\u1EF1\\u1EE5\\u1E73\\u0173\\u1E77\\u1E75\\u0289'\n}, {\n base: 'v',\n letters: '\\u0076\\u24E5\\uFF56\\u1E7D\\u1E7F\\u028B\\uA75F\\u028C'\n}, {\n base: 'vy',\n letters: '\\uA761'\n}, {\n base: 'w',\n letters: '\\u0077\\u24E6\\uFF57\\u1E81\\u1E83\\u0175\\u1E87\\u1E85\\u1E98\\u1E89\\u2C73'\n}, {\n base: 'x',\n letters: '\\u0078\\u24E7\\uFF58\\u1E8B\\u1E8D'\n}, {\n base: 'y',\n letters: '\\u0079\\u24E8\\uFF59\\u1EF3\\u00FD\\u0177\\u1EF9\\u0233\\u1E8F\\u00FF\\u1EF7\\u1E99\\u1EF5\\u01B4\\u024F\\u1EFF'\n}, {\n base: 'z',\n letters: '\\u007A\\u24E9\\uFF5A\\u017A\\u1E91\\u017C\\u017E\\u1E93\\u1E95\\u01B6\\u0225\\u0240\\u2C6C\\uA763'\n}];\nconst diacriticsMap = {};\nfor (let i = 0; i < defaultDiacriticsRemovalap.length; i += 1) {\n const letters = defaultDiacriticsRemovalap[i].letters;\n for (let j = 0; j < letters.length; j += 1) {\n diacriticsMap[letters[j]] = defaultDiacriticsRemovalap[i].base;\n }\n}\nfunction removeDiacritics(str) {\n return str.replace(/[^\\u0000-\\u007E]/g, a => diacriticsMap[a] || a);\n}\nexport default removeDiacritics;", "import $ from '../../shared/dom7.js';\nimport { extend, deleteProps, id, nextTick } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\nimport removeDiacritics from '../searchbar/remove-diacritics.js';\n\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass SmartSelect extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const ss = this;\n const defaults = extend({\n on: {}\n }, app.params.smartSelect);\n\n // Extend defaults with modules params\n ss.useModulesParams(defaults);\n ss.params = extend({}, defaults, params);\n ss.app = app;\n const $el = $(ss.params.el).eq(0);\n if ($el.length === 0) return ss;\n if ($el[0].f7SmartSelect) return $el[0].f7SmartSelect;\n const $selectEl = $el.find('select').eq(0);\n if ($selectEl.length === 0) return ss;\n let $valueEl;\n if (ss.params.setValueText) {\n $valueEl = $(ss.params.valueEl);\n if ($valueEl.length === 0) {\n $valueEl = $el.find('.item-after');\n }\n if ($valueEl.length === 0) {\n $valueEl = $('');\n $valueEl.insertAfter($el.find('.item-title'));\n }\n }\n\n // Url\n let url = params.url;\n if (!url) {\n if ($el.attr('href') && $el.attr('href') !== '#') url = $el.attr('href');else if ($selectEl.attr('name')) url = `${$selectEl.attr('name').toLowerCase()}-select/`;\n }\n if (!url) url = ss.params.url;\n const multiple = $selectEl[0].multiple;\n const inputType = multiple ? 'checkbox' : 'radio';\n const selectId = id();\n extend(ss, {\n $el,\n el: $el[0],\n $selectEl,\n selectEl: $selectEl[0],\n $valueEl,\n valueEl: $valueEl && $valueEl[0],\n url,\n multiple,\n inputType,\n id: selectId,\n inputName: `${inputType}-${selectId}`,\n selectName: $selectEl.attr('name'),\n maxLength: $selectEl.attr('maxlength') || params.maxLength\n });\n $el[0].f7SmartSelect = ss;\n\n // Events\n function onClick() {\n ss.open();\n }\n function onChange() {\n const value = ss.$selectEl.val();\n ss.$el.trigger('smartselect:change', value);\n ss.emit('local::change smartSelectChange', ss, value);\n if (ss.vl) {\n ss.vl.clearCache();\n }\n ss.setValueText();\n }\n ss.attachEvents = function attachEvents() {\n $el.on('click', onClick);\n $el.on('change', 'select', onChange);\n };\n ss.detachEvents = function detachEvents() {\n $el.off('click', onClick);\n $el.off('change', 'select', onChange);\n };\n function handleInputChange() {\n let optionEl;\n let text;\n const inputEl = this;\n const value = inputEl.value;\n let optionText = [];\n let displayAs;\n if (inputEl.type === 'checkbox') {\n for (let i = 0; i < ss.selectEl.options.length; i += 1) {\n optionEl = ss.selectEl.options[i];\n if (optionEl.value === value) {\n optionEl.selected = inputEl.checked;\n }\n if (optionEl.selected) {\n displayAs = optionEl.dataset ? optionEl.dataset.displayAs : $(optionEl).data('display-value-as');\n text = displayAs && typeof displayAs !== 'undefined' ? displayAs : optionEl.textContent;\n optionText.push(text.trim());\n }\n }\n if (ss.maxLength) {\n ss.checkMaxLength();\n }\n } else {\n optionEl = ss.$selectEl.find(`option[value=\"${value}\"]`)[0];\n if (!optionEl) {\n optionEl = ss.$selectEl.find('option').filter(optEl => optEl.value === value)[0];\n }\n displayAs = optionEl.dataset ? optionEl.dataset.displayAs : $(optionEl).data('display-as');\n text = displayAs && typeof displayAs !== 'undefined' ? displayAs : optionEl.textContent;\n optionText = [text];\n ss.selectEl.value = value;\n }\n ss.$selectEl.trigger('change');\n if (ss.params.setValueText) {\n ss.formatValueTextContent(optionText);\n }\n if (ss.params.closeOnSelect && ss.inputType === 'radio') {\n ss.close();\n }\n }\n ss.attachInputsEvents = function attachInputsEvents() {\n ss.$containerEl.on('change', 'input[type=\"checkbox\"], input[type=\"radio\"]', handleInputChange);\n };\n ss.detachInputsEvents = function detachInputsEvents() {\n ss.$containerEl.off('change', 'input[type=\"checkbox\"], input[type=\"radio\"]', handleInputChange);\n };\n\n // Install Modules\n ss.useModules();\n\n // Init\n ss.init();\n return ss;\n }\n setValue(value) {\n const ss = this;\n let newValue = value;\n let optionText = [];\n let optionEl;\n let displayAs;\n let text;\n if (ss.multiple) {\n if (!Array.isArray(newValue)) newValue = [newValue];\n for (let i = 0; i < ss.selectEl.options.length; i += 1) {\n optionEl = ss.selectEl.options[i];\n if (newValue.indexOf(optionEl.value) >= 0) {\n optionEl.selected = true;\n } else {\n optionEl.selected = false;\n }\n if (optionEl.selected) {\n displayAs = optionEl.dataset ? optionEl.dataset.displayAs : $(optionEl).data('display-value-as');\n text = displayAs && typeof displayAs !== 'undefined' ? displayAs : optionEl.textContent;\n optionText.push(text.trim());\n }\n }\n } else {\n optionEl = ss.$selectEl.find(`option[value=\"${newValue}\"]`)[0];\n if (optionEl) {\n displayAs = optionEl.dataset ? optionEl.dataset.displayAs : $(optionEl).data('display-as');\n text = displayAs && typeof displayAs !== 'undefined' ? displayAs : optionEl.textContent;\n optionText = [text];\n }\n ss.selectEl.value = newValue;\n }\n if (ss.params.setValueText) {\n ss.formatValueTextContent(optionText);\n }\n ss.$selectEl.trigger('change');\n return ss;\n }\n unsetValue() {\n const ss = this;\n if (ss.params.setValueText) {\n ss.formatValueTextContent([]);\n }\n ss.$selectEl.find('option').each(optionEl => {\n optionEl.selected = false;\n optionEl.checked = false;\n });\n ss.$selectEl[0].value = null;\n if (ss.$containerEl) {\n ss.$containerEl.find(`input[name=\"${ss.inputName}\"][type=\"checkbox\"], input[name=\"${ss.inputName}\"][type=\"radio\"]`).prop('checked', false);\n }\n ss.$selectEl.trigger('change');\n }\n getValue() {\n const ss = this;\n return ss.$selectEl.val();\n }\n get view() {\n const {\n params,\n $el\n } = this;\n let view;\n if (params.view) {\n view = params.view;\n }\n if (!view) {\n view = $el.parents('.view').length && $el.parents('.view')[0].f7View;\n }\n if (!view && params.openIn === 'page') {\n throw Error('Smart Select requires initialized View');\n }\n return view;\n }\n checkMaxLength() {\n const ss = this;\n const $containerEl = ss.$containerEl;\n if (ss.selectEl.selectedOptions.length >= ss.maxLength) {\n $containerEl.find('input[type=\"checkbox\"]').each(inputEl => {\n if (!inputEl.checked) {\n $(inputEl).parents('li').addClass('disabled');\n } else {\n $(inputEl).parents('li').removeClass('disabled');\n }\n });\n } else {\n $containerEl.find('.disabled').removeClass('disabled');\n }\n }\n formatValueTextContent(values) {\n const ss = this;\n const valueFormatted = ss.formatValueText(values);\n if (valueFormatted.includes('<') && valueFormatted.includes('>')) {\n ss.$valueEl.html(valueFormatted);\n } else {\n ss.$valueEl.text(valueFormatted);\n }\n }\n formatValueText(values) {\n const ss = this;\n let textValue;\n if (ss.params.formatValueText) {\n textValue = ss.params.formatValueText.call(ss, values, ss);\n } else {\n textValue = values.join(', ');\n }\n return textValue;\n }\n setValueText(value) {\n const ss = this;\n let valueArray = [];\n if (typeof value !== 'undefined') {\n if (Array.isArray(value)) {\n valueArray = value;\n } else {\n valueArray = [value];\n }\n } else {\n ss.$selectEl.find('option').each(optionEl => {\n const $optionEl = $(optionEl);\n if (optionEl.selected) {\n const displayAs = optionEl.dataset ? optionEl.dataset.displayAs : $optionEl.data('display-value-as');\n if (displayAs && typeof displayAs !== 'undefined') {\n valueArray.push(displayAs);\n } else {\n valueArray.push(optionEl.textContent.trim());\n }\n }\n });\n }\n if (ss.params.setValueText) {\n ss.formatValueTextContent(valueArray);\n }\n }\n getItemsData() {\n const ss = this;\n const theme = ss.app.theme;\n const items = [];\n let previousGroupEl;\n ss.$selectEl.find('option').each(optionEl => {\n const $optionEl = $(optionEl);\n const optionData = $optionEl.dataset();\n const optionImage = optionData.optionImage || ss.params.optionImage;\n const optionIcon = optionData.optionIcon || ss.params.optionIcon;\n const optionIconIos = theme === 'ios' && (optionData.optionIconIos || ss.params.optionIconIos);\n const optionIconMd = theme === 'md' && (optionData.optionIconMd || ss.params.optionIconMd);\n const optionInputIconPosition = optionData.inputIconPosition || ss.params.inputIconPosition || '';\n const optionHasMedia = optionImage || optionIcon || optionIconIos || optionIconMd;\n const optionColor = optionData.optionColor;\n let optionClassName = optionData.optionClass || '';\n if ($optionEl[0].disabled) optionClassName += ' disabled';\n const optionGroupEl = $optionEl.parent('optgroup')[0];\n const optionGroupLabel = optionGroupEl && optionGroupEl.label;\n let optionIsLabel = false;\n if (optionGroupEl && optionGroupEl !== previousGroupEl) {\n optionIsLabel = true;\n previousGroupEl = optionGroupEl;\n items.push({\n groupLabel: optionGroupLabel,\n isLabel: optionIsLabel\n });\n }\n items.push({\n value: $optionEl[0].value,\n text: $optionEl[0].textContent.trim(),\n selected: $optionEl[0].selected,\n groupEl: optionGroupEl,\n groupLabel: optionGroupLabel,\n image: optionImage,\n icon: optionIcon,\n iconIos: optionIconIos,\n iconMd: optionIconMd,\n inputIconPosition: optionInputIconPosition,\n color: optionColor,\n className: optionClassName,\n disabled: $optionEl[0].disabled,\n id: ss.id,\n hasMedia: optionHasMedia,\n checkbox: ss.inputType === 'checkbox',\n radio: ss.inputType === 'radio',\n inputName: ss.inputName,\n inputType: ss.inputType\n });\n });\n ss.items = items;\n return items;\n }\n renderSearchbar() {\n const ss = this;\n if (ss.params.renderSearchbar) return ss.params.renderSearchbar.call(ss);\n return $jsx(\"form\", {\n class: \"searchbar\"\n }, $jsx(\"div\", {\n class: \"searchbar-inner\"\n }, $jsx(\"div\", {\n class: \"searchbar-input-wrap\"\n }, $jsx(\"input\", {\n type: \"search\",\n spellcheck: ss.params.searchbarSpellcheck || 'false',\n placeholder: ss.params.searchbarPlaceholder\n }), $jsx(\"i\", {\n class: \"searchbar-icon\"\n }), $jsx(\"span\", {\n class: \"input-clear-button\"\n })), ss.params.searchbarDisableButton && $jsx(\"span\", {\n class: \"searchbar-disable-button\"\n }, ss.params.searchbarDisableText)));\n }\n renderItem(item, index) {\n const ss = this;\n if (ss.params.renderItem) return ss.params.renderItem.call(ss, item, index);\n function getIconContent(iconValue) {\n if (iconValue === void 0) {\n iconValue = '';\n }\n if (iconValue.indexOf(':') >= 0) {\n return iconValue.split(':')[1];\n }\n return '';\n }\n function getIconClass(iconValue) {\n if (iconValue === void 0) {\n iconValue = '';\n }\n if (iconValue.indexOf(':') >= 0) {\n let className = iconValue.split(':')[0];\n if (className === 'f7') className = 'f7-icons';\n if (className === 'material') className = 'material-icons';\n return className;\n }\n return iconValue;\n }\n let itemHtml;\n if (item.isLabel) {\n itemHtml = `- ${item.groupLabel}
`;\n } else {\n let selected = item.selected;\n let disabled;\n if (ss.params.virtualList) {\n const ssValue = ss.getValue();\n selected = ss.multiple ? ssValue.indexOf(item.value) >= 0 : ssValue === item.value;\n if (ss.multiple) {\n disabled = ss.multiple && !selected && ssValue.length === parseInt(ss.maxLength, 10);\n }\n }\n const {\n icon,\n iconIos,\n iconMd\n } = item;\n const hasIcon = icon || iconIos || iconMd;\n const iconContent = getIconContent(icon || iconIos || iconMd || '');\n const iconClass = getIconClass(icon || iconIos || iconMd || '');\n itemHtml = $jsx(\"li\", {\n class: `${item.className || ''}${disabled ? ' disabled' : ''}`\n }, $jsx(\"label\", {\n class: `item-${item.inputType} ${item.inputIconPosition ? `item-${item.inputType}-icon-${item.inputIconPosition}` : ''} item-content`\n }, $jsx(\"input\", {\n type: item.inputType,\n name: item.inputName,\n value: item.value,\n _checked: selected\n }), $jsx(\"i\", {\n class: `icon icon-${item.inputType}`\n }), item.hasMedia && $jsx(\"div\", {\n class: \"item-media\"\n }, hasIcon && $jsx(\"i\", {\n class: `icon ${iconClass}`\n }, iconContent), item.image && $jsx(\"img\", {\n src: item.image\n })), $jsx(\"div\", {\n class: \"item-inner\"\n }, $jsx(\"div\", {\n class: `item-title${item.color ? ` text-color-${item.color}` : ''}`\n }, item.text))));\n }\n return itemHtml;\n }\n renderItems() {\n const ss = this;\n if (ss.params.renderItems) return ss.params.renderItems.call(ss, ss.items);\n const itemsHtml = `\n ${ss.items.map((item, index) => `${ss.renderItem(item, index)}`).join('')}\n `;\n return itemsHtml;\n }\n renderPage() {\n const ss = this;\n if (ss.params.renderPage) return ss.params.renderPage.call(ss, ss.items);\n let pageTitle = ss.params.pageTitle;\n if (typeof pageTitle === 'undefined') {\n const $itemTitleEl = ss.$el.find('.item-title');\n pageTitle = $itemTitleEl.length ? $itemTitleEl.text().trim() : '';\n }\n const cssClass = ss.params.cssClass;\n return $jsx(\"div\", {\n class: `page smart-select-page ${cssClass}`,\n \"data-name\": \"smart-select-page\",\n \"data-select-name\": ss.selectName\n }, $jsx(\"div\", {\n class: `navbar ${ss.params.navbarColorTheme ? `color-${ss.params.navbarColorTheme}` : ''}`\n }, $jsx(\"div\", {\n class: \"navbar-bg\"\n }), $jsx(\"div\", {\n class: `navbar-inner sliding ${ss.params.navbarColorTheme ? `color-${ss.params.navbarColorTheme}` : ''}`\n }, $jsx(\"div\", {\n class: \"left\"\n }, $jsx(\"a\", {\n class: \"link back\"\n }, $jsx(\"i\", {\n class: \"icon icon-back\"\n }), $jsx(\"span\", {\n class: \"if-not-md\"\n }, ss.params.pageBackLinkText))), pageTitle && $jsx(\"div\", {\n class: \"title\"\n }, pageTitle), ss.params.searchbar && $jsx(\"div\", {\n class: \"subnavbar\"\n }, ss.renderSearchbar()))), ss.params.searchbar && $jsx(\"div\", {\n class: \"searchbar-backdrop\"\n }), $jsx(\"div\", {\n class: \"page-content\"\n }, $jsx(\"div\", {\n class: `list list-outline-ios list-strong-ios list-dividers-ios smart-select-list-${ss.id} ${ss.params.virtualList ? ' virtual-list' : ''} ${ss.params.formColorTheme ? `color-${ss.params.formColorTheme}` : ''}`\n }, $jsx(\"ul\", null, !ss.params.virtualList && ss.renderItems(ss.items)))));\n }\n renderPopup() {\n const ss = this;\n if (ss.params.renderPopup) return ss.params.renderPopup.call(ss, ss.items);\n let pageTitle = ss.params.pageTitle;\n if (typeof pageTitle === 'undefined') {\n const $itemTitleEl = ss.$el.find('.item-title');\n pageTitle = $itemTitleEl.length ? $itemTitleEl.text().trim() : '';\n }\n const cssClass = ss.params.cssClass || '';\n return $jsx(\"div\", {\n class: `popup smart-select-popup ${cssClass} ${ss.params.popupTabletFullscreen ? 'popup-tablet-fullscreen' : ''}`,\n \"data-select-name\": ss.selectName\n }, $jsx(\"div\", {\n class: \"view\"\n }, $jsx(\"div\", {\n class: `page smart-select-page ${ss.params.searchbar ? 'page-with-subnavbar' : ''}`,\n \"data-name\": \"smart-select-page\"\n }, $jsx(\"div\", {\n class: `navbar ${ss.params.navbarColorTheme ? `color-${ss.params.navbarColorTheme}` : ''}`\n }, $jsx(\"div\", {\n class: \"navbar-bg\"\n }), $jsx(\"div\", {\n class: \"navbar-inner sliding\"\n }, pageTitle && $jsx(\"div\", {\n class: \"title\"\n }, pageTitle), $jsx(\"div\", {\n class: \"right\"\n }, $jsx(\"a\", {\n class: \"link popup-close\",\n \"data-popup\": `.smart-select-popup[data-select-name='${ss.selectName}']`\n }, ss.params.popupCloseLinkText)), ss.params.searchbar && $jsx(\"div\", {\n class: \"subnavbar\"\n }, ss.renderSearchbar()))), ss.params.searchbar && $jsx(\"div\", {\n class: \"searchbar-backdrop\"\n }), $jsx(\"div\", {\n class: \"page-content\"\n }, $jsx(\"div\", {\n class: `list list-outline-ios list-strong-ios list-dividers-ios smart-select-list-${ss.id} ${ss.params.virtualList ? ' virtual-list' : ''} ${ss.params.formColorTheme ? `color-${ss.params.formColorTheme}` : ''}`\n }, $jsx(\"ul\", null, !ss.params.virtualList && ss.renderItems(ss.items)))))));\n }\n renderSheet() {\n const ss = this;\n if (ss.params.renderSheet) return ss.params.renderSheet.call(ss, ss.items);\n const cssClass = ss.params.cssClass;\n // prettier-ignore\n return $jsx(\"div\", {\n class: `sheet-modal smart-select-sheet ${cssClass}`,\n \"data-select-name\": ss.selectName\n }, $jsx(\"div\", {\n class: `toolbar toolbar-top ${ss.params.toolbarColorTheme ? `color-${ss.params.toolbarColorTheme}` : ''}`\n }, $jsx(\"div\", {\n class: \"toolbar-inner\"\n }, $jsx(\"div\", {\n class: \"left\"\n }), $jsx(\"div\", {\n class: \"right\"\n }, $jsx(\"a\", {\n class: \"link sheet-close\"\n }, ss.params.sheetCloseLinkText)))), $jsx(\"div\", {\n class: \"sheet-modal-inner\"\n }, $jsx(\"div\", {\n class: \"page-content\"\n }, $jsx(\"div\", {\n class: `list list-strong-ios list-dividers-ios smart-select-list-${ss.id} ${ss.params.virtualList ? ' virtual-list' : ''} ${ss.params.formColorTheme ? `color-${ss.params.formColorTheme}` : ''}`\n }, $jsx(\"ul\", null, !ss.params.virtualList && ss.renderItems(ss.items))))));\n }\n renderPopover() {\n const ss = this;\n if (ss.params.renderPopover) return ss.params.renderPopover.call(ss, ss.items);\n const cssClass = ss.params.cssClass;\n // prettier-ignore\n return $jsx(\"div\", {\n class: `popover smart-select-popover ${cssClass}`,\n \"data-select-name\": ss.selectName\n }, $jsx(\"div\", {\n class: \"popover-inner\"\n }, $jsx(\"div\", {\n class: `list list-strong-ios list-dividers-ios smart-select-list-${ss.id} ${ss.params.virtualList ? ' virtual-list' : ''} ${ss.params.formColorTheme ? `color-${ss.params.formColorTheme}` : ''}`\n }, $jsx(\"ul\", null, !ss.params.virtualList && ss.renderItems(ss.items)))));\n }\n scrollToSelectedItem() {\n const ss = this;\n const {\n params,\n $containerEl\n } = ss;\n if (!ss.opened) return ss;\n if (params.virtualList) {\n let selectedIndex;\n ss.vl.items.forEach((item, index) => {\n if (typeof selectedIndex === 'undefined' && item.selected) {\n selectedIndex = index;\n }\n });\n if (typeof selectedIndex !== 'undefined') {\n ss.vl.scrollToItem(selectedIndex);\n }\n } else {\n const $selectedItemEl = $containerEl.find('input:checked').parents('li');\n if (!$selectedItemEl.length) return ss;\n const $scrollableEl = $containerEl.find('.page-content, .popover-inner');\n if (!$scrollableEl.length) return ss;\n $scrollableEl.scrollTop($selectedItemEl.offset().top - $scrollableEl.offset().top - parseInt($scrollableEl.css('padding-top'), 10));\n }\n return ss;\n }\n onOpen(type, containerEl) {\n const ss = this;\n const app = ss.app;\n const $containerEl = $(containerEl);\n ss.$containerEl = $containerEl;\n ss.openedIn = type;\n ss.opened = true;\n\n // Init VL\n if (ss.params.virtualList) {\n ss.vl = app.virtualList.create({\n el: $containerEl.find('.virtual-list'),\n items: ss.items,\n renderItem: ss.renderItem.bind(ss),\n height: ss.params.virtualListHeight,\n searchByItem(query, item) {\n if (item.text && removeDiacritics(item.text).toLowerCase().indexOf(query.trim().toLowerCase()) >= 0) return true;\n return false;\n }\n });\n }\n if (ss.params.scrollToSelectedItem) {\n ss.scrollToSelectedItem();\n }\n\n // Init SB\n if (ss.params.searchbar) {\n let $searchbarEl = $containerEl.find('.searchbar');\n if (type === 'page' && app.theme === 'ios') {\n $searchbarEl = $(app.navbar.getElByPage($containerEl)).find('.searchbar');\n }\n if (ss.params.appendSearchbarNotFound && (type === 'page' || type === 'popup')) {\n let $notFoundEl = null;\n if (typeof ss.params.appendSearchbarNotFound === 'string') {\n $notFoundEl = $(`${ss.params.appendSearchbarNotFound}
`);\n } else if (typeof ss.params.appendSearchbarNotFound === 'boolean') {\n $notFoundEl = $('Nothing found
');\n } else {\n $notFoundEl = ss.params.appendSearchbarNotFound;\n }\n if ($notFoundEl) {\n $containerEl.find('.page-content').append($notFoundEl[0]);\n }\n }\n const searchbarParams = extend({\n el: $searchbarEl,\n backdropEl: $containerEl.find('.searchbar-backdrop'),\n searchContainer: `.smart-select-list-${ss.id}`,\n searchIn: '.item-title'\n }, typeof ss.params.searchbar === 'object' ? ss.params.searchbar : {});\n ss.searchbar = app.searchbar.create(searchbarParams);\n }\n\n // Check for max length\n if (ss.maxLength) {\n ss.checkMaxLength();\n }\n\n // Close on select\n if (ss.params.closeOnSelect) {\n ss.$containerEl.find(`input[type=\"radio\"][name=\"${ss.inputName}\"]:checked`).parents('label').once('click', () => {\n ss.close();\n });\n }\n\n // Attach input events\n ss.attachInputsEvents();\n ss.$el.trigger('smartselect:open');\n ss.emit('local::open smartSelectOpen', ss);\n }\n onOpened() {\n const ss = this;\n ss.$el.trigger('smartselect:opened');\n ss.emit('local::opened smartSelectOpened', ss);\n }\n onClose() {\n const ss = this;\n if (ss.destroyed) return;\n\n // Destroy VL\n if (ss.vl && ss.vl.destroy) {\n ss.vl.destroy();\n ss.vl = null;\n delete ss.vl;\n }\n\n // Destroy SB\n if (ss.searchbar && ss.searchbar.destroy) {\n ss.searchbar.destroy();\n ss.searchbar = null;\n delete ss.searchbar;\n }\n // Detach events\n ss.detachInputsEvents();\n ss.$el.trigger('smartselect:close');\n ss.emit('local::close smartSelectClose', ss);\n }\n onClosed() {\n const ss = this;\n if (ss.destroyed) return;\n ss.opened = false;\n ss.$containerEl = null;\n delete ss.$containerEl;\n ss.$el.trigger('smartselect:closed');\n ss.emit('local::closed smartSelectClosed', ss);\n }\n openPage() {\n const ss = this;\n if (ss.opened) return ss;\n ss.getItemsData();\n const pageHtml = ss.renderPage(ss.items);\n ss.view.router.navigate({\n url: ss.url,\n route: {\n content: pageHtml,\n path: ss.url,\n on: {\n pageBeforeIn(e, page) {\n ss.onOpen('page', page.el);\n },\n pageAfterIn(e, page) {\n ss.onOpened('page', page.el);\n },\n pageBeforeOut(e, page) {\n ss.onClose('page', page.el);\n },\n pageAfterOut(e, page) {\n ss.onClosed('page', page.el);\n }\n }\n }\n });\n return ss;\n }\n openPopup() {\n const ss = this;\n if (ss.opened) return ss;\n ss.getItemsData();\n const popupHtml = ss.renderPopup(ss.items);\n const popupParams = {\n content: popupHtml,\n push: ss.params.popupPush,\n swipeToClose: ss.params.popupSwipeToClose,\n closeByBackdropClick: ss.params.closeByBackdropClick,\n on: {\n popupOpen(popup) {\n ss.onOpen('popup', popup.el);\n },\n popupOpened(popup) {\n ss.onOpened('popup', popup.el);\n },\n popupClose(popup) {\n ss.onClose('popup', popup.el);\n },\n popupClosed(popup) {\n ss.onClosed('popup', popup.el);\n }\n }\n };\n if (ss.params.routableModals && ss.view) {\n ss.view.router.navigate({\n url: ss.url,\n route: {\n path: ss.url,\n popup: popupParams\n }\n });\n } else {\n ss.modal = ss.app.popup.create(popupParams).open();\n }\n return ss;\n }\n openSheet() {\n const ss = this;\n if (ss.opened) return ss;\n ss.getItemsData();\n const sheetHtml = ss.renderSheet(ss.items);\n const sheetParams = {\n content: sheetHtml,\n backdrop: ss.params.sheetBackdrop,\n scrollToEl: ss.$el,\n closeByOutsideClick: true,\n push: ss.params.sheetPush,\n swipeToClose: ss.params.sheetSwipeToClose,\n closeByBackdropClick: ss.params.closeByBackdropClick,\n on: {\n sheetOpen(sheet) {\n ss.onOpen('sheet', sheet.el);\n },\n sheetOpened(sheet) {\n ss.onOpened('sheet', sheet.el);\n },\n sheetClose(sheet) {\n ss.onClose('sheet', sheet.el);\n },\n sheetClosed(sheet) {\n ss.onClosed('sheet', sheet.el);\n }\n }\n };\n if (ss.params.routableModals && ss.view) {\n ss.view.router.navigate({\n url: ss.url,\n route: {\n path: ss.url,\n sheet: sheetParams\n }\n });\n } else {\n ss.modal = ss.app.sheet.create(sheetParams).open();\n }\n return ss;\n }\n openPopover() {\n const ss = this;\n if (ss.opened) return ss;\n ss.getItemsData();\n const popoverHtml = ss.renderPopover(ss.items);\n const popoverParams = {\n content: popoverHtml,\n targetEl: ss.$el,\n closeByBackdropClick: ss.params.closeByBackdropClick,\n on: {\n popoverOpen(popover) {\n ss.onOpen('popover', popover.el);\n },\n popoverOpened(popover) {\n ss.onOpened('popover', popover.el);\n },\n popoverClose(popover) {\n ss.onClose('popover', popover.el);\n },\n popoverClosed(popover) {\n ss.onClosed('popover', popover.el);\n }\n }\n };\n if (ss.params.routableModals && ss.view) {\n ss.view.router.navigate({\n url: ss.url,\n route: {\n path: ss.url,\n popover: popoverParams\n }\n });\n } else {\n ss.modal = ss.app.popover.create(popoverParams).open();\n }\n return ss;\n }\n open(type) {\n const ss = this;\n if (ss.opened) return ss;\n let prevented = false;\n function prevent() {\n prevented = true;\n }\n if (ss.$el) {\n ss.$el.trigger('smartselect:beforeopen', {\n prevent\n });\n }\n ss.emit('local::beforeOpen smartSelectBeforeOpen', ss, prevent);\n if (prevented) return ss;\n const openIn = type || ss.params.openIn;\n ss[`open${openIn.split('').map((el, index) => {\n if (index === 0) return el.toUpperCase();\n return el;\n }).join('')}`]();\n return ss;\n }\n close() {\n const ss = this;\n if (!ss.opened) return ss;\n if (ss.params.routableModals && ss.view || ss.openedIn === 'page') {\n ss.view.router.back();\n } else {\n ss.modal.once('modalClosed', () => {\n nextTick(() => {\n if (ss.destroyed) return;\n ss.modal.destroy();\n delete ss.modal;\n });\n });\n ss.modal.close();\n }\n return ss;\n }\n init() {\n const ss = this;\n ss.attachEvents();\n ss.setValueText();\n }\n destroy() {\n const ss = this;\n ss.emit('local::beforeDestroy smartSelectBeforeDestroy', ss);\n ss.$el.trigger('smartselect:beforedestroy');\n ss.detachEvents();\n delete ss.$el[0].f7SmartSelect;\n deleteProps(ss);\n ss.destroyed = true;\n }\n}\nexport default SmartSelect;", "import $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nimport SmartSelect from './smart-select-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'smartSelect',\n params: {\n smartSelect: {\n el: undefined,\n valueEl: undefined,\n setValueText: true,\n formatValueText: null,\n openIn: 'page',\n // or 'popup' or 'sheet' or 'popover'\n popupPush: false,\n popupSwipeToClose: undefined,\n // defaults to app\n sheetPush: false,\n sheetSwipeToClose: undefined,\n // defaults to app\n sheetBackdrop: false,\n pageTitle: undefined,\n pageBackLinkText: 'Back',\n popupCloseLinkText: 'Close',\n popupTabletFullscreen: false,\n closeByBackdropClick: true,\n sheetCloseLinkText: 'Done',\n searchbar: false,\n searchbarPlaceholder: 'Search',\n searchbarDisableText: 'Cancel',\n searchbarDisableButton: true,\n searchbarSpellcheck: false,\n closeOnSelect: false,\n virtualList: false,\n virtualListHeight: undefined,\n scrollToSelectedItem: false,\n formColorTheme: undefined,\n navbarColorTheme: undefined,\n routableModals: false,\n url: 'select/',\n inputIconPosition: 'start',\n cssClass: '',\n /*\n Custom render functions\n */\n renderPage: undefined,\n renderPopup: undefined,\n renderSheet: undefined,\n renderPopover: undefined,\n renderItems: undefined,\n renderItem: undefined,\n renderSearchbar: undefined\n }\n },\n static: {\n SmartSelect\n },\n create() {\n const app = this;\n app.smartSelect = extend(ConstructorMethods({\n defaultSelector: '.smart-select',\n constructor: SmartSelect,\n app,\n domProp: 'f7SmartSelect'\n }), {\n open(smartSelectEl) {\n const ss = app.smartSelect.get(smartSelectEl);\n if (ss && ss.open) return ss.open();\n return undefined;\n },\n close(smartSelectEl) {\n const ss = app.smartSelect.get(smartSelectEl);\n if (ss && ss.close) return ss.close();\n return undefined;\n }\n });\n },\n on: {\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.smart-select-init').each(smartSelectEl => {\n app.smartSelect.create(extend({\n el: smartSelectEl\n }, $(smartSelectEl).dataset()));\n });\n },\n tabBeforeRemove(tabEl) {\n $(tabEl).find('.smart-select-init').each(smartSelectEl => {\n if (smartSelectEl.f7SmartSelect && smartSelectEl.f7SmartSelect.destroy) {\n smartSelectEl.f7SmartSelect.destroy();\n }\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.smart-select-init').each(smartSelectEl => {\n app.smartSelect.create(extend({\n el: smartSelectEl\n }, $(smartSelectEl).dataset()));\n });\n },\n pageBeforeRemove(page) {\n page.$el.find('.smart-select-init').each(smartSelectEl => {\n if (smartSelectEl.f7SmartSelect && smartSelectEl.f7SmartSelect.destroy) {\n smartSelectEl.f7SmartSelect.destroy();\n }\n });\n }\n },\n clicks: {\n '.smart-select': function open($clickedEl, data) {\n const app = this;\n if (!$clickedEl[0].f7SmartSelect) {\n const ss = app.smartSelect.create(extend({\n el: $clickedEl\n }, data));\n ss.open();\n }\n }\n },\n vnode: {\n 'smart-select-init': {\n insert(vnode) {\n const app = this;\n const smartSelectEl = vnode.elm;\n app.smartSelect.create(extend({\n el: smartSelectEl\n }, $(smartSelectEl).dataset()));\n },\n destroy(vnode) {\n const smartSelectEl = vnode.elm;\n if (smartSelectEl.f7SmartSelect && smartSelectEl.f7SmartSelect.destroy) {\n smartSelectEl.f7SmartSelect.destroy();\n }\n }\n }\n }\n};", "export default {\n name: 'grid'\n};", "import { extend, nextTick, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\nimport $ from '../../shared/dom7.js';\nimport { getDevice } from '../../shared/get-device.js';\nimport { getSupport } from '../../shared/get-support.js';\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass Calendar extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const calendar = this;\n calendar.params = extend({}, app.params.calendar, params);\n let $containerEl;\n if (calendar.params.containerEl) {\n $containerEl = $(calendar.params.containerEl);\n if ($containerEl.length === 0) return calendar;\n }\n let $inputEl;\n if (calendar.params.inputEl) {\n $inputEl = $(calendar.params.inputEl);\n }\n const isHorizontal = calendar.params.direction === 'horizontal';\n let inverter = 1;\n if (isHorizontal) {\n inverter = app.rtl ? -1 : 1;\n }\n extend(calendar, {\n app,\n $containerEl,\n containerEl: $containerEl && $containerEl[0],\n inline: $containerEl && $containerEl.length > 0,\n $inputEl,\n inputEl: $inputEl && $inputEl[0],\n initialized: false,\n opened: false,\n url: calendar.params.url,\n isHorizontal,\n inverter,\n animating: false,\n allowTouchMove: true,\n hasTimePicker: calendar.params.timePicker && !calendar.params.rangePicker && !calendar.params.multiple\n });\n calendar.dayFormatter = date => {\n const formatter = new Intl.DateTimeFormat(calendar.params.locale, {\n day: 'numeric'\n });\n return formatter.format(date).replace(/\u65E5/, '');\n };\n calendar.monthFormatter = date => {\n const formatter = new Intl.DateTimeFormat(calendar.params.locale, {\n month: 'long'\n });\n return formatter.format(date);\n };\n calendar.yearFormatter = date => {\n const formatter = new Intl.DateTimeFormat(calendar.params.locale, {\n year: 'numeric'\n });\n return formatter.format(date);\n };\n calendar.timeSelectorFormatter = date => {\n const formatter = new Intl.DateTimeFormat(calendar.params.locale, calendar.params.timePickerFormat);\n return formatter.format(date);\n };\n const timeFormatCheckDate = calendar.timeSelectorFormatter(new Date()).toLowerCase();\n calendar.is12HoursFormat = timeFormatCheckDate.indexOf('pm') >= 0 || timeFormatCheckDate.indexOf('am') >= 0;\n\n // Auto names\n let {\n monthNames,\n monthNamesShort,\n dayNames,\n dayNamesShort\n } = calendar.params;\n const {\n monthNamesIntl,\n monthNamesShortIntl,\n dayNamesIntl,\n dayNamesShortIntl\n } = calendar.getIntlNames();\n if (monthNames === 'auto') monthNames = monthNamesIntl;\n if (monthNamesShort === 'auto') monthNamesShort = monthNamesShortIntl;\n if (dayNames === 'auto') dayNames = dayNamesIntl;\n if (dayNamesShort === 'auto') dayNamesShort = dayNamesShortIntl;\n extend(calendar, {\n monthNames,\n monthNamesShort,\n dayNames,\n dayNamesShort\n });\n function onInputClick() {\n calendar.open();\n }\n function onInputFocus(e) {\n e.preventDefault();\n }\n function onInputClear() {\n calendar.setValue([]);\n if (calendar.opened) {\n calendar.update();\n }\n }\n function onHtmlClick(e) {\n const $targetEl = $(e.target);\n if (calendar.destroyed || !calendar.params) return;\n if (calendar.isPopover()) return;\n if (!calendar.opened || calendar.closing) return;\n if ($targetEl.closest('[class*=\"backdrop\"]').length) return;\n if (calendar.monthPickerPopover || calendar.yearPickerPopover || calendar.timePickerPopover) return;\n if ($inputEl && $inputEl.length > 0) {\n if ($targetEl[0] !== $inputEl[0] && $targetEl.closest('.sheet-modal, .calendar-modal').length === 0) {\n calendar.close();\n }\n } else if ($(e.target).closest('.sheet-modal, .calendar-modal').length === 0) {\n calendar.close();\n }\n }\n\n // Events\n extend(calendar, {\n attachInputEvents() {\n calendar.$inputEl.on('click', onInputClick);\n calendar.$inputEl.on('input:clear', onInputClear);\n if (calendar.params.inputReadOnly) {\n calendar.$inputEl.on('focus mousedown', onInputFocus);\n if (calendar.$inputEl[0]) {\n calendar.$inputEl[0].f7ValidateReadonly = true;\n }\n }\n },\n detachInputEvents() {\n calendar.$inputEl.off('click', onInputClick);\n calendar.$inputEl.off('input:clear', onInputClear);\n if (calendar.params.inputReadOnly) {\n calendar.$inputEl.off('focus mousedown', onInputFocus);\n if (calendar.$inputEl[0]) {\n delete calendar.$inputEl[0].f7ValidateReadonly;\n }\n }\n },\n attachHtmlEvents() {\n app.on('click', onHtmlClick);\n },\n detachHtmlEvents() {\n app.off('click', onHtmlClick);\n }\n });\n calendar.attachCalendarEvents = function attachCalendarEvents() {\n let allowItemClick = true;\n let isTouched;\n let isMoved;\n let touchStartX;\n let touchStartY;\n let touchCurrentX;\n let touchCurrentY;\n let touchStartTime;\n let touchEndTime;\n let currentTranslate;\n let wrapperWidth;\n let wrapperHeight;\n let percentage;\n let touchesDiff;\n let isScrolling;\n const {\n $el,\n $wrapperEl\n } = calendar;\n function handleTouchStart(e) {\n if (isMoved || isTouched || !e.isTrusted) return;\n isTouched = true;\n touchStartX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchCurrentX = touchStartX;\n touchStartY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n touchCurrentY = touchStartY;\n touchStartTime = new Date().getTime();\n percentage = 0;\n allowItemClick = true;\n isScrolling = undefined;\n currentTranslate = calendar.monthsTranslate;\n }\n function handleTouchMove(e) {\n if (!isTouched || !e.isTrusted) return;\n const {\n isHorizontal: isH\n } = calendar;\n touchCurrentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n touchCurrentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n if (typeof isScrolling === 'undefined') {\n isScrolling = !!(isScrolling || Math.abs(touchCurrentY - touchStartY) > Math.abs(touchCurrentX - touchStartX));\n }\n if (isH && isScrolling || !calendar.allowTouchMove) {\n isTouched = false;\n return;\n }\n e.preventDefault();\n if (calendar.animating) {\n isTouched = false;\n return;\n }\n allowItemClick = false;\n if (!isMoved) {\n // First move\n isMoved = true;\n wrapperWidth = $wrapperEl[0].offsetWidth;\n wrapperHeight = $wrapperEl[0].offsetHeight;\n $wrapperEl.transition(0);\n }\n touchesDiff = isH ? touchCurrentX - touchStartX : touchCurrentY - touchStartY;\n percentage = touchesDiff / (isH ? wrapperWidth : wrapperHeight);\n currentTranslate = (calendar.monthsTranslate * calendar.inverter + percentage) * 100;\n\n // Transform wrapper\n $wrapperEl.transform(`translate3d(${isH ? currentTranslate : 0}%, ${isH ? 0 : currentTranslate}%, 0)`);\n }\n function handleTouchEnd(e) {\n if (!isTouched || !isMoved || !e.isTrusted) {\n isTouched = false;\n isMoved = false;\n return;\n }\n isTouched = false;\n isMoved = false;\n touchEndTime = new Date().getTime();\n if (touchEndTime - touchStartTime < 300) {\n if (Math.abs(touchesDiff) < 10) {\n calendar.resetMonth();\n } else if (touchesDiff >= 10) {\n if (app.rtl) calendar.nextMonth();else calendar.prevMonth();\n } else if (app.rtl) calendar.prevMonth();else calendar.nextMonth();\n } else if (percentage <= -0.5) {\n if (app.rtl) calendar.prevMonth();else calendar.nextMonth();\n } else if (percentage >= 0.5) {\n if (app.rtl) calendar.nextMonth();else calendar.prevMonth();\n } else {\n calendar.resetMonth();\n }\n\n // Allow click\n setTimeout(() => {\n allowItemClick = true;\n }, 100);\n }\n function handleDayClick(e) {\n if (!allowItemClick) return;\n let $dayEl = $(e.target).parents('.calendar-day');\n if ($dayEl.length === 0 && $(e.target).hasClass('calendar-day')) {\n $dayEl = $(e.target);\n }\n if ($dayEl.length === 0) return;\n if ($dayEl.hasClass('calendar-day-disabled')) return;\n if (!calendar.params.rangePicker) {\n if ($dayEl.hasClass('calendar-day-next')) calendar.nextMonth();\n if ($dayEl.hasClass('calendar-day-prev')) calendar.prevMonth();\n }\n const dateYear = parseInt($dayEl.attr('data-year'), 10);\n const dateMonth = parseInt($dayEl.attr('data-month'), 10);\n const dateDay = parseInt($dayEl.attr('data-day'), 10);\n calendar.emit('local::dayClick calendarDayClick', calendar, $dayEl[0], dateYear, dateMonth, dateDay);\n if (!$dayEl.hasClass('calendar-day-selected') || calendar.params.multiple || calendar.params.rangePicker) {\n const valueToAdd = new Date(dateYear, dateMonth, dateDay, 0, 0, 0);\n if (calendar.hasTimePicker) {\n if (calendar.value && calendar.value[0]) {\n valueToAdd.setHours(calendar.value[0].getHours(), calendar.value[0].getMinutes());\n } else {\n valueToAdd.setHours(new Date().getHours(), new Date().getMinutes());\n }\n }\n calendar.addValue(valueToAdd);\n }\n if (calendar.params.closeOnSelect) {\n if (calendar.params.rangePicker && calendar.value.length === 2 || !calendar.params.rangePicker) {\n calendar.close();\n }\n }\n }\n function onNextMonthClick() {\n calendar.nextMonth();\n }\n function onPrevMonthClick() {\n calendar.prevMonth();\n }\n function onNextYearClick() {\n calendar.nextYear();\n }\n function onPrevYearClick() {\n calendar.prevYear();\n }\n function onMonthSelectorClick() {\n calendar.openMonthPicker();\n }\n function onYearSelectorClick() {\n calendar.openYearPicker();\n }\n function onTimeSelectorClick() {\n calendar.openTimePicker();\n }\n const passiveListener = app.touchEvents.start === 'touchstart' && getSupport().passiveListener ? {\n passive: true,\n capture: false\n } : false;\n // Selectors clicks\n $el.find('.calendar-prev-month-button').on('click', onPrevMonthClick);\n $el.find('.calendar-next-month-button').on('click', onNextMonthClick);\n $el.find('.calendar-prev-year-button').on('click', onPrevYearClick);\n $el.find('.calendar-next-year-button').on('click', onNextYearClick);\n if (calendar.params.monthPicker) {\n $el.find('.current-month-value').on('click', onMonthSelectorClick);\n }\n if (calendar.params.yearPicker) {\n $el.find('.current-year-value').on('click', onYearSelectorClick);\n }\n if (calendar.hasTimePicker) {\n $el.find('.calendar-time-selector a').on('click', onTimeSelectorClick);\n }\n // Day clicks\n $wrapperEl.on('click', handleDayClick);\n // Touch events\n if (calendar.params.touchMove) {\n $wrapperEl.on(app.touchEvents.start, handleTouchStart, passiveListener);\n app.on('touchmove:active', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n }\n calendar.detachCalendarEvents = function detachCalendarEvents() {\n $el.find('.calendar-prev-month-button').off('click', onPrevMonthClick);\n $el.find('.calendar-next-month-button').off('click', onNextMonthClick);\n $el.find('.calendar-prev-year-button').off('click', onPrevYearClick);\n $el.find('.calendar-next-year-button').off('click', onNextYearClick);\n if (calendar.params.monthPicker) {\n $el.find('.current-month-value').off('click', onMonthSelectorClick);\n }\n if (calendar.params.yearPicker) {\n $el.find('.current-year-value').off('click', onYearSelectorClick);\n }\n if (calendar.hasTimePicker) {\n $el.find('.calendar-time-selector a').off('click', onTimeSelectorClick);\n }\n $wrapperEl.off('click', handleDayClick);\n if (calendar.params.touchMove) {\n $wrapperEl.off(app.touchEvents.start, handleTouchStart, passiveListener);\n app.off('touchmove:active', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n }\n };\n };\n calendar.init();\n return calendar;\n }\n get view() {\n const {\n $inputEl,\n app,\n params\n } = this;\n let view;\n if (params.view) {\n view = params.view;\n } else if ($inputEl) {\n view = $inputEl.parents('.view').length && $inputEl.parents('.view')[0].f7View;\n }\n if (!view) view = app.views.main;\n return view;\n }\n getIntlNames() {\n const calendar = this;\n const locale = calendar.params.locale;\n const monthNamesIntl = [];\n const monthNamesShortIntl = [];\n const dayNamesIntl = [];\n const dayNamesShortIntl = [];\n const formatterMonthNames = new Intl.DateTimeFormat(locale, {\n month: 'long'\n });\n const formatterMonthNamesShort = new Intl.DateTimeFormat(locale, {\n month: 'short'\n });\n const formatterDayNames = new Intl.DateTimeFormat(locale, {\n weekday: 'long'\n });\n const formatterDayNamesShort = new Intl.DateTimeFormat(locale, {\n weekday: 'short'\n });\n let year;\n let yearStarted;\n let yearEnded;\n for (let i = 0; i < 24; i += 1) {\n const date = new Date().setMonth(i, 1);\n const currentYear = calendar.yearFormatter(date);\n if (year && currentYear !== year) {\n if (yearStarted) yearEnded = true;\n yearStarted = true;\n year = currentYear;\n }\n if (!year) {\n year = currentYear;\n }\n if (yearStarted && year === currentYear && !yearEnded) {\n monthNamesIntl.push(formatterMonthNames.format(date));\n monthNamesShortIntl.push(formatterMonthNamesShort.format(date));\n }\n }\n const weekDay = new Date().getDay();\n for (let i = 0; i < 7; i += 1) {\n const date = new Date().getTime() + (i - weekDay) * 24 * 60 * 60 * 1000;\n dayNamesIntl.push(formatterDayNames.format(date));\n dayNamesShortIntl.push(formatterDayNamesShort.format(date));\n }\n return {\n monthNamesIntl,\n monthNamesShortIntl,\n dayNamesIntl,\n dayNamesShortIntl\n };\n }\n normalizeDate(date) {\n const calendar = this;\n const d = new Date(date);\n if (calendar.hasTimePicker) {\n return new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes());\n }\n return new Date(d.getFullYear(), d.getMonth(), d.getDate());\n }\n normalizeValues(values) {\n const calendar = this;\n let newValues = [];\n if (values && Array.isArray(values)) {\n newValues = values.map(val => calendar.normalizeDate(val));\n }\n return newValues;\n }\n initInput() {\n const calendar = this;\n if (!calendar.$inputEl) return;\n if (calendar.params.inputReadOnly) calendar.$inputEl.prop('readOnly', true);\n }\n isPopover() {\n const calendar = this;\n const {\n app,\n modal,\n params\n } = calendar;\n const device = getDevice();\n if (params.openIn === 'sheet') return false;\n if (modal && modal.type !== 'popover') return false;\n if (!calendar.inline && calendar.inputEl) {\n if (params.openIn === 'popover') return true;\n if (device.ios) {\n return !!device.ipad;\n }\n if (app.width >= 768) {\n return true;\n }\n }\n return false;\n }\n formatDate(d) {\n const calendar = this;\n const date = new Date(d);\n const year = date.getFullYear();\n const month = date.getMonth();\n const month1 = month + 1;\n const day = date.getDate();\n const weekDay = date.getDay();\n const {\n monthNames,\n monthNamesShort,\n dayNames,\n dayNamesShort\n } = calendar;\n const {\n dateFormat,\n locale\n } = calendar.params;\n function twoDigits(number) {\n return number < 10 ? `0${number}` : number;\n }\n if (typeof dateFormat === 'string') {\n const tokens = {\n yyyy: year,\n yy: String(year).substring(2),\n mm: twoDigits(month1),\n m: month1,\n MM: monthNames[month],\n M: monthNamesShort[month],\n dd: twoDigits(day),\n d: day,\n DD: dayNames[weekDay],\n D: dayNamesShort[weekDay]\n };\n if (calendar.params.timePicker) {\n const hours = date.getHours();\n const minutes = date.getMinutes();\n const seconds = date.getSeconds();\n let hours12 = hours;\n if (hours > 12) hours12 = hours - 12;\n if (hours === 0) hours12 = 12;\n const a = hours >= 12 && hours !== 0 ? 'pm' : 'am';\n Object.assign(tokens, {\n HH: twoDigits(hours),\n H: hours,\n hh: twoDigits(hours12),\n h: hours12,\n ss: twoDigits(seconds),\n s: seconds,\n ':mm': twoDigits(minutes),\n ':m': minutes,\n a,\n A: a.toUpperCase()\n });\n }\n const regexp = new RegExp(Object.keys(tokens).map(t => `(${t})`).join('|'), 'g');\n return dateFormat.replace(regexp, token => {\n if (token in tokens) return tokens[token];\n return token;\n });\n }\n if (typeof dateFormat === 'function') {\n return dateFormat(date);\n }\n // Intl Object\n const formatter = new Intl.DateTimeFormat(locale, dateFormat);\n return formatter.format(date);\n }\n formatValue() {\n const calendar = this;\n const {\n value\n } = calendar;\n if (calendar.params.formatValue) {\n return calendar.params.formatValue.call(calendar, value);\n }\n return value.map(v => calendar.formatDate(v)).join(calendar.params.rangePicker ? ' - ' : ', ');\n }\n addValue(newValue) {\n const calendar = this;\n const {\n multiple,\n rangePicker,\n rangePickerMinDays,\n rangePickerMaxDays\n } = calendar.params;\n if (multiple) {\n if (!calendar.value) calendar.value = [];\n let inValuesIndex;\n for (let i = 0; i < calendar.value.length; i += 1) {\n if (new Date(newValue).getTime() === new Date(calendar.value[i]).getTime()) {\n inValuesIndex = i;\n }\n }\n if (typeof inValuesIndex === 'undefined') {\n calendar.value.push(newValue);\n } else {\n calendar.value.splice(inValuesIndex, 1);\n }\n calendar.updateValue();\n } else if (rangePicker) {\n if (!calendar.value) calendar.value = [];\n if (calendar.value.length === 2 || calendar.value.length === 0) {\n calendar.value = [];\n }\n if (calendar.value.length === 0 || Math.abs(calendar.value[0].getTime() - newValue.getTime()) >= (rangePickerMinDays - 1) * 60 * 60 * 24 * 1000 && (rangePickerMaxDays === 0 || Math.abs(calendar.value[0].getTime() - newValue.getTime()) <= (rangePickerMaxDays - 1) * 60 * 60 * 24 * 1000)) calendar.value.push(newValue);else calendar.value = [];\n calendar.value.sort((a, b) => a - b);\n calendar.updateValue();\n } else {\n calendar.value = [newValue];\n calendar.updateValue();\n }\n }\n setValue(values) {\n const calendar = this;\n const currentValue = calendar.value;\n if (Array.isArray(currentValue) && Array.isArray(values) && currentValue.length === values.length) {\n let equal = true;\n currentValue.forEach((v, index) => {\n if (v !== values[index]) equal = false;\n });\n if (equal) return;\n }\n calendar.value = values;\n calendar.updateValue();\n }\n getValue() {\n const calendar = this;\n return calendar.value;\n }\n updateValue(onlyHeader) {\n const calendar = this;\n const {\n $el,\n $wrapperEl,\n $inputEl,\n value,\n params\n } = calendar;\n let i;\n if ($el && $el.length > 0) {\n $wrapperEl.find('.calendar-day-selected').removeClass('calendar-day-selected calendar-day-selected-range calendar-day-selected-left calendar-day-selected-right');\n let valueDate;\n if (params.rangePicker && value.length === 2) {\n const leftDate = new Date(value[0]).getTime();\n const rightDate = new Date(value[1]).getTime();\n for (i = leftDate; i <= rightDate; i += 24 * 60 * 60 * 1000) {\n valueDate = new Date(i);\n let addClass = 'calendar-day-selected';\n if (leftDate !== rightDate) {\n if (i !== leftDate && i !== rightDate) {\n addClass += ' calendar-day-selected-range';\n }\n if (i === leftDate) {\n addClass += ' calendar-day-selected-left';\n }\n if (i === rightDate) {\n addClass += ' calendar-day-selected-right';\n }\n }\n $wrapperEl.find(`.calendar-day[data-date=\"${valueDate.getFullYear()}-${valueDate.getMonth()}-${valueDate.getDate()}\"]`).addClass(addClass);\n }\n valueDate = new Date(leftDate);\n $wrapperEl.find(`.calendar-day[data-date=\"${valueDate.getFullYear()}-${valueDate.getMonth()}-${valueDate.getDate()}\"]`).removeClass('calendar-day-selected-range').addClass('calendar-day-selected calendar-day-selected-left');\n valueDate = new Date(rightDate);\n $wrapperEl.find(`.calendar-day[data-date=\"${valueDate.getFullYear()}-${valueDate.getMonth()}-${valueDate.getDate()}\"]`).removeClass('calendar-day-selected-range').addClass('calendar-day-selected calendar-day-selected-right');\n } else {\n for (i = 0; i < calendar.value.length; i += 1) {\n valueDate = new Date(value[i]);\n $wrapperEl.find(`.calendar-day[data-date=\"${valueDate.getFullYear()}-${valueDate.getMonth()}-${valueDate.getDate()}\"]`).addClass('calendar-day-selected');\n }\n }\n }\n if (!onlyHeader) {\n calendar.emit('local::change calendarChange', calendar, value);\n }\n if ($el && $el.length > 0 && calendar.hasTimePicker) {\n $el.find('.calendar-time-selector a').text(value && value.length ? calendar.timeSelectorFormatter(value[0]) : calendar.params.timePickerPlaceholder);\n }\n if ($inputEl && $inputEl.length || params.header) {\n const inputValue = calendar.formatValue(value);\n if (params.header && $el && $el.length) {\n $el.find('.calendar-selected-date').text(inputValue);\n }\n if ($inputEl && $inputEl.length && !onlyHeader) {\n $inputEl.val(inputValue);\n $inputEl.trigger('change');\n }\n }\n }\n updateCurrentMonthYear(dir) {\n const calendar = this;\n const {\n $months,\n $el,\n monthNames\n } = calendar;\n let currentLocaleMonth;\n let currentLocaleYear;\n if (typeof dir === 'undefined') {\n calendar.currentMonth = parseInt($months.eq(1).attr('data-month'), 10);\n calendar.currentYear = parseInt($months.eq(1).attr('data-year'), 10);\n currentLocaleMonth = $months.eq(1).attr('data-locale-month');\n currentLocaleYear = $months.eq(1).attr('data-locale-year');\n } else {\n calendar.currentMonth = parseInt($months.eq(dir === 'next' ? $months.length - 1 : 0).attr('data-month'), 10);\n calendar.currentYear = parseInt($months.eq(dir === 'next' ? $months.length - 1 : 0).attr('data-year'), 10);\n currentLocaleMonth = $months.eq(dir === 'next' ? $months.length - 1 : 0).attr('data-locale-month');\n currentLocaleYear = $months.eq(dir === 'next' ? $months.length - 1 : 0).attr('data-locale-year');\n }\n $el.find('.current-month-value').text(monthNames[currentLocaleMonth]);\n $el.find('.current-year-value').text(currentLocaleYear);\n }\n update() {\n const calendar = this;\n const {\n currentYear,\n currentMonth,\n $wrapperEl\n } = calendar;\n const currentDate = new Date(currentYear, currentMonth);\n const prevMonthHtml = calendar.renderMonth(currentDate, 'prev');\n const currentMonthHtml = calendar.renderMonth(currentDate);\n const nextMonthHtml = calendar.renderMonth(currentDate, 'next');\n $wrapperEl.transition(0).html(`${prevMonthHtml}${currentMonthHtml}${nextMonthHtml}`).transform('translate3d(0,0,0)');\n calendar.$months = $wrapperEl.find('.calendar-month');\n calendar.monthsTranslate = 0;\n calendar.setMonthsTranslate();\n calendar.$months.each(monthEl => {\n calendar.emit('local::monthAdd calendarMonthAdd', monthEl);\n });\n }\n onMonthChangeStart(dir) {\n const calendar = this;\n const {\n $months,\n currentYear,\n currentMonth\n } = calendar;\n calendar.updateCurrentMonthYear(dir);\n $months.removeClass('calendar-month-current calendar-month-prev calendar-month-next');\n const currentIndex = dir === 'next' ? $months.length - 1 : 0;\n $months.eq(currentIndex).addClass('calendar-month-current');\n $months.eq(dir === 'next' ? currentIndex - 1 : currentIndex + 1).addClass(dir === 'next' ? 'calendar-month-prev' : 'calendar-month-next');\n calendar.emit('local::monthYearChangeStart calendarMonthYearChangeStart', calendar, currentYear, currentMonth);\n }\n onMonthChangeEnd(dir, rebuildBoth) {\n const calendar = this;\n const {\n currentYear,\n currentMonth,\n $wrapperEl,\n monthsTranslate\n } = calendar;\n calendar.animating = false;\n let nextMonthHtml;\n let prevMonthHtml;\n let currentMonthHtml;\n $wrapperEl.find('.calendar-month:not(.calendar-month-prev):not(.calendar-month-current):not(.calendar-month-next)').remove();\n if (typeof dir === 'undefined') {\n dir = 'next'; // eslint-disable-line\n rebuildBoth = true; // eslint-disable-line\n }\n\n if (!rebuildBoth) {\n currentMonthHtml = calendar.renderMonth(new Date(currentYear, currentMonth), dir);\n } else {\n $wrapperEl.find('.calendar-month-next, .calendar-month-prev').remove();\n prevMonthHtml = calendar.renderMonth(new Date(currentYear, currentMonth), 'prev');\n nextMonthHtml = calendar.renderMonth(new Date(currentYear, currentMonth), 'next');\n }\n if (dir === 'next' || rebuildBoth) {\n $wrapperEl.append(currentMonthHtml || nextMonthHtml);\n }\n if (dir === 'prev' || rebuildBoth) {\n $wrapperEl.prepend(currentMonthHtml || prevMonthHtml);\n }\n const $months = $wrapperEl.find('.calendar-month');\n calendar.$months = $months;\n calendar.setMonthsTranslate(monthsTranslate);\n calendar.emit('local::monthAdd calendarMonthAdd', calendar, dir === 'next' ? $months.eq($months.length - 1)[0] : $months.eq(0)[0]);\n calendar.emit('local::monthYearChangeEnd calendarMonthYearChangeEnd', calendar, currentYear, currentMonth);\n }\n setMonthsTranslate(translate) {\n const calendar = this;\n const {\n $months,\n isHorizontal: isH,\n inverter\n } = calendar;\n // eslint-disable-next-line\n translate = translate || calendar.monthsTranslate || 0;\n if (typeof calendar.monthsTranslate === 'undefined') {\n calendar.monthsTranslate = translate;\n }\n $months.removeClass('calendar-month-current calendar-month-prev calendar-month-next');\n const prevMonthTranslate = -(translate + 1) * 100 * inverter;\n const currentMonthTranslate = -translate * 100 * inverter;\n const nextMonthTranslate = -(translate - 1) * 100 * inverter;\n $months.eq(0).transform(`translate3d(${isH ? prevMonthTranslate : 0}%, ${isH ? 0 : prevMonthTranslate}%, 0)`).addClass('calendar-month-prev');\n $months.eq(1).transform(`translate3d(${isH ? currentMonthTranslate : 0}%, ${isH ? 0 : currentMonthTranslate}%, 0)`).addClass('calendar-month-current');\n $months.eq(2).transform(`translate3d(${isH ? nextMonthTranslate : 0}%, ${isH ? 0 : nextMonthTranslate}%, 0)`).addClass('calendar-month-next');\n }\n nextMonth(transition) {\n const calendar = this;\n const {\n params,\n $wrapperEl,\n inverter,\n isHorizontal: isH\n } = calendar;\n if (typeof transition === 'undefined' || typeof transition === 'object') {\n transition = ''; // eslint-disable-line\n if (!params.animate) transition = 0; // eslint-disable-line\n }\n\n const nextMonth = parseInt(calendar.$months.eq(calendar.$months.length - 1).attr('data-month'), 10);\n const nextYear = parseInt(calendar.$months.eq(calendar.$months.length - 1).attr('data-year'), 10);\n const nextDate = new Date(nextYear, nextMonth);\n const nextDateTime = nextDate.getTime();\n const transitionEndCallback = !calendar.animating;\n if (params.maxDate) {\n if (nextDateTime > new Date(params.maxDate).getTime()) {\n calendar.resetMonth();\n return;\n }\n }\n calendar.monthsTranslate -= 1;\n if (nextMonth === calendar.currentMonth) {\n const nextMonthTranslate = -calendar.monthsTranslate * 100 * inverter;\n const nextMonthHtml = $(calendar.renderMonth(nextDateTime, 'next')).transform(`translate3d(${isH ? nextMonthTranslate : 0}%, ${isH ? 0 : nextMonthTranslate}%, 0)`).addClass('calendar-month-next');\n $wrapperEl.append(nextMonthHtml[0]);\n calendar.$months = $wrapperEl.find('.calendar-month');\n calendar.emit('local::monthAdd calendarMonthAdd', calendar.$months.eq(calendar.$months.length - 1)[0]);\n }\n calendar.animating = true;\n calendar.onMonthChangeStart('next');\n const translate = calendar.monthsTranslate * 100 * inverter;\n $wrapperEl.transition(transition).transform(`translate3d(${isH ? translate : 0}%, ${isH ? 0 : translate}%, 0)`);\n if (transitionEndCallback) {\n $wrapperEl.transitionEnd(() => {\n calendar.onMonthChangeEnd('next');\n });\n }\n if (!params.animate) {\n calendar.onMonthChangeEnd('next');\n }\n }\n prevMonth(transition) {\n const calendar = this;\n const {\n params,\n $wrapperEl,\n inverter,\n isHorizontal: isH\n } = calendar;\n if (typeof transition === 'undefined' || typeof transition === 'object') {\n transition = ''; // eslint-disable-line\n if (!params.animate) transition = 0; // eslint-disable-line\n }\n\n const prevMonth = parseInt(calendar.$months.eq(0).attr('data-month'), 10);\n const prevYear = parseInt(calendar.$months.eq(0).attr('data-year'), 10);\n const prevDate = new Date(prevYear, prevMonth + 1, -1);\n const prevDateTime = prevDate.getTime();\n const transitionEndCallback = !calendar.animating;\n if (params.minDate) {\n let minDate = new Date(params.minDate);\n minDate = new Date(minDate.getFullYear(), minDate.getMonth(), 1);\n if (prevDateTime < minDate.getTime()) {\n calendar.resetMonth();\n return;\n }\n }\n calendar.monthsTranslate += 1;\n if (prevMonth === calendar.currentMonth) {\n const prevMonthTranslate = -calendar.monthsTranslate * 100 * inverter;\n const prevMonthHtml = $(calendar.renderMonth(prevDateTime, 'prev')).transform(`translate3d(${isH ? prevMonthTranslate : 0}%, ${isH ? 0 : prevMonthTranslate}%, 0)`).addClass('calendar-month-prev');\n $wrapperEl.prepend(prevMonthHtml[0]);\n calendar.$months = $wrapperEl.find('.calendar-month');\n calendar.emit('local::monthAdd calendarMonthAdd', calendar.$months.eq(0)[0]);\n }\n calendar.animating = true;\n calendar.onMonthChangeStart('prev');\n const translate = calendar.monthsTranslate * 100 * inverter;\n $wrapperEl.transition(transition).transform(`translate3d(${isH ? translate : 0}%, ${isH ? 0 : translate}%, 0)`);\n if (transitionEndCallback) {\n $wrapperEl.transitionEnd(() => {\n calendar.onMonthChangeEnd('prev');\n });\n }\n if (!params.animate) {\n calendar.onMonthChangeEnd('prev');\n }\n }\n resetMonth(transition) {\n if (transition === void 0) {\n transition = '';\n }\n const calendar = this;\n const {\n $wrapperEl,\n inverter,\n isHorizontal: isH,\n monthsTranslate\n } = calendar;\n const translate = monthsTranslate * 100 * inverter;\n $wrapperEl.transition(transition).transform(`translate3d(${isH ? translate : 0}%, ${isH ? 0 : translate}%, 0)`);\n }\n // eslint-disable-next-line\n setYearMonth(year, month, transition) {\n const calendar = this;\n const {\n params,\n isHorizontal: isH,\n $wrapperEl,\n inverter\n } = calendar;\n // eslint-disable-next-line\n if (typeof year === 'undefined') year = calendar.currentYear;\n // eslint-disable-next-line\n if (typeof month === 'undefined') month = calendar.currentMonth;\n if (typeof transition === 'undefined' || typeof transition === 'object') {\n // eslint-disable-next-line\n transition = '';\n // eslint-disable-next-line\n if (!params.animate) transition = 0;\n }\n let targetDate;\n if (year < calendar.currentYear) {\n targetDate = new Date(year, month + 1, -1).getTime();\n } else {\n targetDate = new Date(year, month).getTime();\n }\n if (params.maxDate && targetDate > new Date(params.maxDate).getTime()) {\n return false;\n }\n if (params.minDate) {\n let minDate = new Date(params.minDate);\n minDate = new Date(minDate.getFullYear(), minDate.getMonth(), 1);\n if (targetDate < minDate.getTime()) {\n return false;\n }\n }\n const currentDate = new Date(calendar.currentYear, calendar.currentMonth).getTime();\n const dir = targetDate > currentDate ? 'next' : 'prev';\n const newMonthHTML = calendar.renderMonth(new Date(year, month));\n calendar.monthsTranslate = calendar.monthsTranslate || 0;\n const prevTranslate = calendar.monthsTranslate;\n let monthTranslate;\n const transitionEndCallback = !calendar.animating && transition !== 0;\n if (targetDate > currentDate) {\n // To next\n calendar.monthsTranslate -= 1;\n if (!calendar.animating) calendar.$months.eq(calendar.$months.length - 1).remove();\n $wrapperEl.append(newMonthHTML);\n calendar.$months = $wrapperEl.find('.calendar-month');\n monthTranslate = -(prevTranslate - 1) * 100 * inverter;\n calendar.$months.eq(calendar.$months.length - 1).transform(`translate3d(${isH ? monthTranslate : 0}%, ${isH ? 0 : monthTranslate}%, 0)`).addClass('calendar-month-next');\n } else {\n // To prev\n calendar.monthsTranslate += 1;\n if (!calendar.animating) calendar.$months.eq(0).remove();\n $wrapperEl.prepend(newMonthHTML);\n calendar.$months = $wrapperEl.find('.calendar-month');\n monthTranslate = -(prevTranslate + 1) * 100 * inverter;\n calendar.$months.eq(0).transform(`translate3d(${isH ? monthTranslate : 0}%, ${isH ? 0 : monthTranslate}%, 0)`).addClass('calendar-month-prev');\n }\n calendar.emit('local::monthAdd calendarMonthAdd', dir === 'next' ? calendar.$months.eq(calendar.$months.length - 1)[0] : calendar.$months.eq(0)[0]);\n calendar.animating = true;\n calendar.onMonthChangeStart(dir);\n const wrapperTranslate = calendar.monthsTranslate * 100 * inverter;\n $wrapperEl.transition(transition).transform(`translate3d(${isH ? wrapperTranslate : 0}%, ${isH ? 0 : wrapperTranslate}%, 0)`);\n if (transitionEndCallback) {\n $wrapperEl.transitionEnd(() => {\n calendar.onMonthChangeEnd(dir, true);\n });\n }\n if (!params.animate || transition === 0) {\n calendar.onMonthChangeEnd(dir, true);\n }\n }\n nextYear() {\n const calendar = this;\n calendar.setYearMonth(calendar.currentYear + 1);\n }\n prevYear() {\n const calendar = this;\n calendar.setYearMonth(calendar.currentYear - 1);\n }\n // eslint-disable-next-line\n dateInRange(dayDate, range) {\n let match = false;\n let i;\n if (!range) return false;\n if (Array.isArray(range)) {\n for (i = 0; i < range.length; i += 1) {\n if (range[i].from || range[i].to) {\n if (range[i].from && range[i].to) {\n if (dayDate <= new Date(range[i].to).getTime() && dayDate >= new Date(range[i].from).getTime()) {\n match = true;\n }\n } else if (range[i].from) {\n if (dayDate >= new Date(range[i].from).getTime()) {\n match = true;\n }\n } else if (range[i].to) {\n if (dayDate <= new Date(range[i].to).getTime()) {\n match = true;\n }\n }\n } else if (range[i].date) {\n if (dayDate === new Date(range[i].date).getTime()) {\n match = true;\n }\n } else if (dayDate === new Date(range[i]).getTime()) {\n match = true;\n }\n }\n } else if (range.from || range.to) {\n if (range.from && range.to) {\n if (dayDate <= new Date(range.to).getTime() && dayDate >= new Date(range.from).getTime()) {\n match = true;\n }\n } else if (range.from) {\n if (dayDate >= new Date(range.from).getTime()) {\n match = true;\n }\n } else if (range.to) {\n if (dayDate <= new Date(range.to).getTime()) {\n match = true;\n }\n }\n } else if (range.date) {\n match = dayDate === new Date(range.date).getTime();\n } else if (typeof range === 'function') {\n match = range(new Date(dayDate));\n }\n return match;\n }\n // eslint-disable-next-line\n daysInMonth(date) {\n const d = new Date(date);\n return new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate();\n }\n renderMonths(date) {\n const calendar = this;\n if (calendar.params.renderMonths) {\n return calendar.params.renderMonths.call(calendar, date);\n }\n return $jsx(\"div\", {\n class: \"calendar-months-wrapper\"\n }, calendar.renderMonth(date, 'prev'), calendar.renderMonth(date), calendar.renderMonth(date, 'next'));\n }\n renderMonth(d, offset) {\n const calendar = this;\n const {\n params,\n value\n } = calendar;\n if (params.renderMonth) {\n return params.renderMonth.call(calendar, d, offset);\n }\n let date = new Date(d);\n let year = date.getFullYear();\n let month = date.getMonth();\n let localeMonth = calendar.monthNames.indexOf(calendar.monthFormatter(date));\n if (localeMonth < 0) localeMonth = month;\n let localeYear = calendar.yearFormatter(date);\n if (offset === 'next') {\n if (month === 11) date = new Date(year + 1, 0);else date = new Date(year, month + 1, 1);\n }\n if (offset === 'prev') {\n if (month === 0) date = new Date(year - 1, 11);else date = new Date(year, month - 1, 1);\n }\n if (offset === 'next' || offset === 'prev') {\n month = date.getMonth();\n year = date.getFullYear();\n localeMonth = calendar.monthNames.indexOf(calendar.monthFormatter(date));\n if (localeMonth < 0) localeMonth = month;\n localeYear = calendar.yearFormatter(date);\n }\n const currentValues = [];\n const today = new Date().setHours(0, 0, 0, 0);\n const minDate = params.minDate ? new Date(params.minDate).getTime() : null;\n const maxDate = params.maxDate ? new Date(params.maxDate).getTime() : null;\n const rows = 6;\n const cols = 7;\n const daysInPrevMonth = calendar.daysInMonth(new Date(date.getFullYear(), date.getMonth()).getTime() - 10 * 24 * 60 * 60 * 1000);\n const daysInMonth = calendar.daysInMonth(date);\n const minDayNumber = params.firstDay === 6 ? 0 : 1;\n let monthHtml = '';\n let dayIndex = 0 + (params.firstDay - 1);\n let disabled;\n let hasEvents;\n let firstDayOfMonthIndex = new Date(date.getFullYear(), date.getMonth()).getDay();\n if (firstDayOfMonthIndex === 0) firstDayOfMonthIndex = 7;\n if (value && value.length) {\n for (let i = 0; i < value.length; i += 1) {\n currentValues.push(new Date(value[i]).setHours(0, 0, 0, 0));\n }\n }\n for (let row = 1; row <= rows; row += 1) {\n let rowHtml = '';\n for (let col = 1; col <= cols; col += 1) {\n dayIndex += 1;\n let dayDate;\n let dayNumber = dayIndex - firstDayOfMonthIndex;\n let addClass = '';\n if (row === 1 && col === 1 && dayNumber > minDayNumber && params.firstDay !== 1) {\n dayIndex -= 7;\n dayNumber = dayIndex - firstDayOfMonthIndex;\n }\n const weekDayIndex = col - 1 + params.firstDay > 6 ? col - 1 - 7 + params.firstDay : col - 1 + params.firstDay;\n if (dayNumber < 0) {\n dayNumber = daysInPrevMonth + dayNumber + 1;\n addClass += ' calendar-day-prev';\n dayDate = new Date(month - 1 < 0 ? year - 1 : year, month - 1 < 0 ? 11 : month - 1, dayNumber).getTime();\n } else {\n dayNumber += 1;\n if (dayNumber > daysInMonth) {\n dayNumber -= daysInMonth;\n addClass += ' calendar-day-next';\n dayDate = new Date(month + 1 > 11 ? year + 1 : year, month + 1 > 11 ? 0 : month + 1, dayNumber).getTime();\n } else {\n dayDate = new Date(year, month, dayNumber).getTime();\n }\n }\n // Today\n if (dayDate === today) addClass += ' calendar-day-today';\n\n // Selected\n if (params.rangePicker && currentValues.length === 2) {\n if (dayDate >= currentValues[0] && dayDate <= currentValues[1]) {\n addClass += ' calendar-day-selected';\n }\n if (currentValues[0] !== currentValues[1]) {\n if (dayDate > currentValues[0] && dayDate < currentValues[1]) {\n addClass += ' calendar-day-selected-range';\n }\n if (dayDate === currentValues[0]) {\n addClass += ' calendar-day-selected-left';\n }\n if (dayDate === currentValues[1]) {\n addClass += ' calendar-day-selected-right';\n }\n }\n } else if (currentValues.indexOf(dayDate) >= 0) addClass += ' calendar-day-selected';\n // Weekend\n if (params.weekendDays.indexOf(weekDayIndex) >= 0) {\n addClass += ' calendar-day-weekend';\n }\n // Events\n let eventsHtml = '';\n hasEvents = false;\n if (params.events) {\n if (calendar.dateInRange(dayDate, params.events)) {\n hasEvents = true;\n }\n }\n if (hasEvents) {\n addClass += ' calendar-day-has-events';\n // prettier-ignore\n eventsHtml = `\n \n \n \n `;\n if (Array.isArray(params.events)) {\n const eventDots = [];\n params.events.forEach(ev => {\n const color = ev.color || '';\n if (eventDots.indexOf(color) < 0 && calendar.dateInRange(dayDate, ev)) {\n eventDots.push(color);\n }\n });\n // prettier-ignore\n eventsHtml = `\n \n ${eventDots.map(color => `\n \n `.trim()).join('')}\n \n `;\n }\n }\n // Custom Ranges\n if (params.rangesClasses) {\n for (let k = 0; k < params.rangesClasses.length; k += 1) {\n if (calendar.dateInRange(dayDate, params.rangesClasses[k].range)) {\n addClass += ` ${params.rangesClasses[k].cssClass}`;\n }\n }\n }\n // Disabled\n disabled = false;\n if (minDate && dayDate < minDate || maxDate && dayDate > maxDate) {\n disabled = true;\n }\n if (params.disabled) {\n if (calendar.dateInRange(dayDate, params.disabled)) {\n disabled = true;\n }\n }\n if (disabled) {\n addClass += ' calendar-day-disabled';\n }\n dayDate = new Date(dayDate);\n const dayYear = dayDate.getFullYear();\n const dayMonth = dayDate.getMonth();\n const dayNumberDisplay = calendar.dayFormatter(dayDate);\n // prettier-ignore\n rowHtml += `\n \n ${dayNumberDisplay}${eventsHtml}\n
`.trim();\n }\n monthHtml += `${rowHtml}
`;\n }\n monthHtml = `${monthHtml}
`;\n return monthHtml;\n }\n renderWeekHeader() {\n const calendar = this;\n if (calendar.params.renderWeekHeader) {\n return calendar.params.renderWeekHeader.call(calendar);\n }\n const {\n params\n } = calendar;\n let weekDaysHtml = '';\n for (let i = 0; i < 7; i += 1) {\n const dayIndex = i + params.firstDay > 6 ? i - 7 + params.firstDay : i + params.firstDay;\n const dayName = calendar.dayNamesShort[dayIndex];\n weekDaysHtml += `${dayName}
`;\n }\n return $jsx(\"div\", {\n class: \"calendar-week-header\"\n }, weekDaysHtml);\n }\n renderMonthSelector() {\n const calendar = this;\n if (calendar.params.renderMonthSelector) {\n return calendar.params.renderMonthSelector.call(calendar);\n }\n return $jsx(\"div\", {\n class: \"calendar-month-selector\"\n }, $jsx(\"a\", {\n class: \"link icon-only calendar-prev-month-button\"\n }, $jsx(\"i\", {\n class: \"icon icon-prev\"\n })), calendar.params.monthPicker ? $jsx(\"a\", {\n class: \"current-month-value link\"\n }) : $jsx(\"span\", {\n class: \"current-month-value\"\n }), $jsx(\"a\", {\n class: \"link icon-only calendar-next-month-button\"\n }, $jsx(\"i\", {\n class: \"icon icon-next\"\n })));\n }\n renderYearSelector() {\n const calendar = this;\n if (calendar.params.renderYearSelector) {\n return calendar.params.renderYearSelector.call(calendar);\n }\n return $jsx(\"div\", {\n class: \"calendar-year-selector\"\n }, $jsx(\"a\", {\n class: \"link icon-only calendar-prev-year-button\"\n }, $jsx(\"i\", {\n class: \"icon icon-prev\"\n })), calendar.params.yearPicker ? $jsx(\"a\", {\n class: \"current-year-value link\"\n }) : $jsx(\"span\", {\n class: \"current-year-value\"\n }), $jsx(\"a\", {\n class: \"link icon-only calendar-next-year-button\"\n }, $jsx(\"i\", {\n class: \"icon icon-next\"\n })));\n }\n\n // eslint-disable-next-line\n renderTimeSelector() {\n const calendar = this;\n const value = calendar.value && calendar.value[0];\n let timeString;\n if (value) timeString = calendar.timeSelectorFormatter(value);\n return $jsx(\"div\", {\n class: \"calendar-time-selector\"\n }, $jsx(\"span\", null, calendar.params.timePickerLabel), $jsx(\"a\", {\n class: \"link\"\n }, timeString || calendar.params.timePickerPlaceholder));\n }\n renderHeader() {\n const calendar = this;\n if (calendar.params.renderHeader) {\n return calendar.params.renderHeader.call(calendar);\n }\n return $jsx(\"div\", {\n class: \"calendar-header\"\n }, $jsx(\"div\", {\n class: \"calendar-selected-date\"\n }, calendar.params.headerPlaceholder));\n }\n renderFooter() {\n const calendar = this;\n const app = calendar.app;\n if (calendar.params.renderFooter) {\n return calendar.params.renderFooter.call(calendar);\n }\n return $jsx(\"div\", {\n class: \"calendar-footer\"\n }, $jsx(\"a\", {\n class: `${app.theme === 'md' ? 'button button-round' : 'link'} calendar-close sheet-close popover-close`\n }, calendar.params.toolbarCloseText));\n }\n renderToolbar() {\n const calendar = this;\n if (calendar.params.renderToolbar) {\n return calendar.params.renderToolbar.call(calendar, calendar);\n }\n // prettier-ignore\n return $jsx(\"div\", {\n class: \"toolbar toolbar-top\"\n }, $jsx(\"div\", {\n class: \"toolbar-inner\"\n }, calendar.params.monthSelector ? calendar.renderMonthSelector() : '', calendar.params.yearSelector ? calendar.renderYearSelector() : ''));\n }\n // eslint-disable-next-line\n renderInline() {\n const calendar = this;\n const {\n cssClass,\n toolbar,\n header,\n footer,\n rangePicker,\n weekHeader\n } = calendar.params;\n const {\n value,\n hasTimePicker\n } = calendar;\n const date = value && value.length ? value[0] : new Date().setHours(0, 0, 0);\n return $jsx(\"div\", {\n class: `calendar calendar-inline ${rangePicker ? 'calendar-range' : ''} ${cssClass || ''}`\n }, header && calendar.renderHeader(), toolbar && calendar.renderToolbar(), weekHeader && calendar.renderWeekHeader(), $jsx(\"div\", {\n class: \"calendar-months\"\n }, calendar.renderMonths(date)), hasTimePicker && calendar.renderTimeSelector(), footer && calendar.renderFooter());\n }\n renderCustomModal() {\n const calendar = this;\n const {\n cssClass,\n toolbar,\n header,\n footer,\n rangePicker,\n weekHeader\n } = calendar.params;\n const {\n value,\n hasTimePicker\n } = calendar;\n const date = value && value.length ? value[0] : new Date().setHours(0, 0, 0);\n return $jsx(\"div\", {\n class: `calendar calendar-modal ${rangePicker ? 'calendar-range' : ''} ${cssClass || ''}`\n }, header && calendar.renderHeader(), toolbar && calendar.renderToolbar(), weekHeader && calendar.renderWeekHeader(), $jsx(\"div\", {\n class: \"calendar-months\"\n }, calendar.renderMonths(date)), hasTimePicker && calendar.renderTimeSelector(), footer && calendar.renderFooter());\n }\n renderSheet() {\n const calendar = this;\n const {\n cssClass,\n toolbar,\n header,\n footer,\n rangePicker,\n weekHeader\n } = calendar.params;\n const {\n value,\n hasTimePicker\n } = calendar;\n const date = value && value.length ? value[0] : new Date().setHours(0, 0, 0);\n return $jsx(\"div\", {\n class: `sheet-modal calendar calendar-sheet ${rangePicker ? 'calendar-range' : ''} ${cssClass || ''}`\n }, header && calendar.renderHeader(), toolbar && calendar.renderToolbar(), weekHeader && calendar.renderWeekHeader(), $jsx(\"div\", {\n class: \"sheet-modal-inner calendar-months\"\n }, calendar.renderMonths(date)), hasTimePicker && calendar.renderTimeSelector(), footer && calendar.renderFooter());\n }\n renderPopover() {\n const calendar = this;\n const {\n cssClass,\n toolbar,\n header,\n footer,\n rangePicker,\n weekHeader\n } = calendar.params;\n const {\n value,\n hasTimePicker\n } = calendar;\n const date = value && value.length ? value[0] : new Date().setHours(0, 0, 0);\n return $jsx(\"div\", {\n class: \"popover calendar-popover\"\n }, $jsx(\"div\", {\n class: \"popover-inner\"\n }, $jsx(\"div\", {\n class: `calendar ${rangePicker ? 'calendar-range' : ''} ${cssClass || ''}`\n }, header && calendar.renderHeader(), toolbar && calendar.renderToolbar(), weekHeader && calendar.renderWeekHeader(), $jsx(\"div\", {\n class: \"calendar-months\"\n }, calendar.renderMonths(date)), hasTimePicker && calendar.renderTimeSelector(), footer && calendar.renderFooter())));\n }\n render() {\n const calendar = this;\n const {\n params\n } = calendar;\n if (params.render) return params.render.call(calendar);\n if (!calendar.inline) {\n let modalType = params.openIn;\n if (modalType === 'auto') modalType = calendar.isPopover() ? 'popover' : 'sheet';\n if (modalType === 'popover') return calendar.renderPopover();\n if (modalType === 'sheet') return calendar.renderSheet();\n return calendar.renderCustomModal();\n }\n return calendar.renderInline();\n }\n openMonthPicker() {\n const calendar = this;\n const {\n $el,\n app\n } = calendar;\n if (!$el || !$el.length) return;\n $el.append('');\n calendar.monthPickerPopover = app.popover.create({\n el: $el.find('.calendar-month-picker-popover'),\n targetEl: $el.find('.calendar-month-selector'),\n backdrop: true,\n backdropUnique: true,\n on: {\n close() {\n calendar.closeMonthPicker();\n },\n closed() {\n if (calendar.monthPickerPopover.$el) calendar.monthPickerPopover.$el.remove();\n calendar.monthPickerPopover.destroy();\n if (calendar.monthPickerInstance) {\n calendar.monthPickerInstance.close();\n calendar.monthPickerInstance.destroy();\n }\n delete calendar.monthPickerInstance;\n delete calendar.monthPickerPopover;\n }\n }\n });\n calendar.monthPickerPopover.open();\n const localeMonth = parseInt(calendar.$el.find('.calendar-month-current').attr('data-locale-month'), 10);\n const values = [];\n const displayValues = [];\n calendar.monthNames.forEach((m, index) => {\n values.push(index);\n displayValues.push(m);\n });\n calendar.monthPickerInstance = app.picker.create({\n containerEl: calendar.monthPickerPopover.$el.find('.calendar-month-picker'),\n value: [localeMonth],\n toolbar: calendar.params.monthPickerToolbar,\n rotateEffect: false,\n toolbarCloseText: calendar.params.monthPickerCloseText,\n cols: [{\n values,\n displayValues\n }]\n });\n }\n closeMonthPicker() {\n const calendar = this;\n if (calendar.monthPickerPopover && calendar.monthPickerPopover.opened) calendar.monthPickerPopover.close();\n const index = calendar.monthPickerInstance.value[0];\n const localeMonthIndex = parseInt(calendar.$el.find('.calendar-month-current').attr('data-locale-month'), 10);\n const monthIndex = calendar.currentMonth;\n const diff = localeMonthIndex - monthIndex;\n const diffIndex = index - diff;\n calendar.setYearMonth(calendar.currentYear, diffIndex, 0);\n }\n openYearPicker() {\n const calendar = this;\n const {\n $el,\n app\n } = calendar;\n if (!$el || !$el.length) return;\n $el.append('');\n calendar.yearPickerPopover = app.popover.create({\n el: $el.find('.calendar-year-picker-popover'),\n targetEl: $el.find('.calendar-year-selector'),\n backdrop: true,\n backdropUnique: true,\n on: {\n close() {\n calendar.closeYearPicker();\n },\n closed() {\n if (calendar.yearPickerPopover.$el) calendar.yearPickerPopover.$el.remove();\n calendar.yearPickerPopover.destroy();\n if (calendar.yearPickerInstance) {\n calendar.yearPickerInstance.close();\n calendar.yearPickerInstance.destroy();\n }\n delete calendar.yearPickerInstance;\n delete calendar.yearPickerPopover;\n }\n }\n });\n calendar.yearPickerPopover.open();\n const currentYear = calendar.currentYear;\n let yearMin = calendar.params.yearPickerMin || new Date().getFullYear() - 100;\n if (calendar.params.minDate) {\n yearMin = Math.max(yearMin, new Date(calendar.params.minDate).getFullYear());\n }\n let yearMax = calendar.params.yearPickerMax || new Date().getFullYear() + 100;\n if (calendar.params.maxDate) {\n yearMax = Math.min(yearMax, new Date(calendar.params.maxDate).getFullYear());\n }\n const years = [];\n for (let i = yearMin; i <= yearMax; i += 1) {\n years.push(i);\n }\n calendar.yearPickerInstance = app.picker.create({\n containerEl: calendar.yearPickerPopover.$el.find('.calendar-year-picker'),\n value: [currentYear],\n toolbar: calendar.params.yearPickerToolbar,\n rotateEffect: false,\n toolbarCloseText: calendar.params.yearPickerCloseText,\n cols: [{\n values: years\n }]\n });\n }\n closeYearPicker() {\n const calendar = this;\n if (calendar.yearPickerPopover && calendar.yearPickerPopover.opened) calendar.yearPickerPopover.close();\n calendar.setYearMonth(calendar.yearPickerInstance.value[0], undefined, 0);\n }\n openTimePicker() {\n const calendar = this;\n const {\n $el,\n app,\n is12HoursFormat\n } = calendar;\n if (!$el || !$el.length) return;\n $el.append('');\n const hoursArr = [];\n const minutesArr = [];\n const hoursMin = is12HoursFormat ? 1 : 0;\n const hoursMax = is12HoursFormat ? 12 : 23;\n for (let i = hoursMin; i <= hoursMax; i += 1) {\n hoursArr.push(i);\n }\n for (let i = 0; i <= 59; i += 1) {\n minutesArr.push(i);\n }\n let value;\n if (calendar.value && calendar.value.length) {\n value = [calendar.value[0].getHours(), calendar.value[0].getMinutes()];\n } else {\n value = [new Date().getHours(), new Date().getMinutes()];\n }\n if (is12HoursFormat) {\n value.push(value[0] < 12 ? 'AM' : 'PM');\n if (value[0] > 12) value[0] -= 12;\n if (value[0] === 0) value[0] = 12;\n }\n calendar.timePickerPopover = app.popover.create({\n el: $el.find('.calendar-time-picker-popover'),\n targetEl: $el.find('.calendar-time-selector .link'),\n backdrop: true,\n backdropUnique: true,\n on: {\n close() {\n calendar.closeTimePicker();\n },\n closed() {\n if (calendar.timePickerPopover.$el) calendar.timePickerPopover.$el.remove();\n calendar.timePickerPopover.destroy();\n if (calendar.timePickerInstance) {\n calendar.timePickerInstance.close();\n calendar.timePickerInstance.destroy();\n }\n delete calendar.timePickerInstance;\n delete calendar.timePickerPopover;\n }\n }\n });\n calendar.timePickerPopover.open();\n calendar.timePickerInstance = app.picker.create({\n containerEl: calendar.timePickerPopover.$el.find('.calendar-time-picker'),\n value,\n toolbar: calendar.params.timePickerToolbar,\n rotateEffect: false,\n toolbarCloseText: calendar.params.timePickerCloseText,\n cols: [{\n values: hoursArr\n }, {\n divider: true,\n content: ':'\n }, {\n values: minutesArr,\n displayValues: minutesArr.map(m => m < 10 ? `0${m}` : m)\n }, ...(is12HoursFormat ? [{\n values: ['AM', 'PM']\n }] : [])]\n });\n }\n closeTimePicker() {\n const calendar = this;\n const {\n is12HoursFormat\n } = calendar;\n if (calendar.timePickerInstance) {\n const timePickerValue = calendar.timePickerInstance.value;\n let hours = parseInt(timePickerValue[0], 10);\n const minutes = parseInt(timePickerValue[1], 10);\n const period = calendar.timePickerInstance.value[2];\n if (is12HoursFormat) {\n if (period === 'AM' && hours === 12) {\n hours = 0;\n } else if (period === 'PM' && hours !== 12) {\n hours += 12;\n }\n }\n let value = calendar.value && calendar.value.length && calendar.value[0];\n if (!value) {\n value = new Date();\n value.setHours(hours, minutes, 0, 0);\n } else {\n value = new Date(value);\n value.setHours(hours, minutes);\n }\n calendar.setValue([value]);\n if (calendar.timePickerPopover && calendar.timePickerPopover.opened) calendar.timePickerPopover.close();\n }\n }\n onOpen() {\n const calendar = this;\n const {\n initialized,\n $el,\n app,\n $inputEl,\n inline,\n value,\n params\n } = calendar;\n calendar.closing = false;\n calendar.opened = true;\n calendar.opening = true;\n\n // Init main events\n calendar.attachCalendarEvents();\n const updateValue = !value && params.value;\n\n // Set value\n if (!initialized) {\n if (value) calendar.setValue(value, 0);else if (params.value) {\n calendar.setValue(calendar.normalizeValues(params.value), 0);\n }\n } else if (value) {\n calendar.setValue(value, 0);\n }\n\n // Update current month and year\n calendar.updateCurrentMonthYear();\n\n // Set initial translate\n calendar.monthsTranslate = 0;\n calendar.setMonthsTranslate();\n\n // Update input value\n if (updateValue) calendar.updateValue();else if (params.header && value) {\n calendar.updateValue(true);\n }\n\n // Extra focus\n if (!inline && $inputEl && $inputEl.length && app.theme === 'md') {\n $inputEl.trigger('focus');\n }\n calendar.initialized = true;\n calendar.$months.each(monthEl => {\n calendar.emit('local::monthAdd calendarMonthAdd', monthEl);\n });\n\n // Trigger events\n if ($el) {\n $el.trigger('calendar:open');\n }\n if ($inputEl) {\n $inputEl.trigger('calendar:open');\n }\n calendar.emit('local::open calendarOpen', calendar);\n }\n onOpened() {\n const calendar = this;\n calendar.opening = false;\n if (calendar.$el) {\n calendar.$el.trigger('calendar:opened');\n }\n if (calendar.$inputEl) {\n calendar.$inputEl.trigger('calendar:opened');\n }\n calendar.emit('local::opened calendarOpened', calendar);\n }\n onClose() {\n const calendar = this;\n const app = calendar.app;\n calendar.opening = false;\n calendar.closing = true;\n if (calendar.$inputEl) {\n if (app.theme === 'md') {\n calendar.$inputEl.trigger('blur');\n } else {\n const validate = calendar.$inputEl.attr('validate');\n const required = calendar.$inputEl.attr('required');\n if (validate && required) {\n app.input.validate(calendar.$inputEl);\n }\n }\n }\n if (calendar.detachCalendarEvents) {\n calendar.detachCalendarEvents();\n }\n if (calendar.$el) {\n calendar.$el.trigger('calendar:close');\n }\n if (calendar.$inputEl) {\n calendar.$inputEl.trigger('calendar:close');\n }\n calendar.emit('local::close calendarClose', calendar);\n }\n onClosed() {\n const calendar = this;\n calendar.opened = false;\n calendar.closing = false;\n if (!calendar.inline) {\n nextTick(() => {\n if (calendar.modal && calendar.modal.el && calendar.modal.destroy) {\n if (!calendar.params.routableModals) {\n calendar.modal.destroy();\n }\n }\n delete calendar.modal;\n });\n }\n if (calendar.timePickerInstance) {\n if (calendar.timePickerInstance.destroy) calendar.timePickerInstance.destroy();\n delete calendar.timePickerInstance;\n }\n if (calendar.$el) {\n calendar.$el.trigger('calendar:closed');\n }\n if (calendar.$inputEl) {\n calendar.$inputEl.trigger('calendar:closed');\n }\n calendar.emit('local::closed calendarClosed', calendar);\n }\n open() {\n const calendar = this;\n const {\n app,\n opened,\n inline,\n $inputEl,\n params\n } = calendar;\n if (opened) return;\n if (inline) {\n calendar.$el = $(calendar.render());\n calendar.$el[0].f7Calendar = calendar;\n calendar.$wrapperEl = calendar.$el.find('.calendar-months-wrapper');\n calendar.$months = calendar.$wrapperEl.find('.calendar-month');\n calendar.$containerEl.append(calendar.$el);\n calendar.onOpen();\n calendar.onOpened();\n return;\n }\n let modalType = params.openIn;\n if (modalType === 'auto') {\n modalType = calendar.isPopover() ? 'popover' : 'sheet';\n }\n const modalContent = calendar.render();\n const modalParams = {\n targetEl: $inputEl,\n scrollToEl: params.scrollToInput ? $inputEl : undefined,\n content: modalContent,\n backdrop: params.backdrop === true || (modalType === 'popover' || modalType === 'customModal') && app.params.popover.backdrop !== false && params.backdrop !== false,\n closeByBackdropClick: params.closeByBackdropClick,\n on: {\n open() {\n const modal = this;\n calendar.modal = modal;\n calendar.$el = modalType === 'popover' ? modal.$el.find('.calendar') : modal.$el;\n calendar.$wrapperEl = calendar.$el.find('.calendar-months-wrapper');\n calendar.$months = calendar.$wrapperEl.find('.calendar-month');\n calendar.$el[0].f7Calendar = calendar;\n if (modalType === 'customModal') {\n $(calendar.$el).find('.calendar-close').once('click', () => {\n calendar.close();\n });\n }\n calendar.onOpen();\n },\n opened() {\n calendar.onOpened();\n },\n close() {\n calendar.onClose();\n },\n closed() {\n calendar.onClosed();\n }\n }\n };\n if (modalType === 'sheet') {\n modalParams.push = params.sheetPush;\n modalParams.swipeToClose = params.sheetSwipeToClose;\n }\n if (params.routableModals && calendar.view) {\n calendar.view.router.navigate({\n url: calendar.url,\n route: {\n path: calendar.url,\n [modalType]: modalParams\n }\n });\n } else {\n calendar.modal = app[modalType].create(modalParams);\n calendar.modal.open();\n }\n }\n close() {\n const calendar = this;\n const {\n opened,\n inline\n } = calendar;\n if (!opened) return;\n if (inline) {\n calendar.onClose();\n calendar.onClosed();\n return;\n }\n if (calendar.params.routableModals && calendar.view) {\n calendar.view.router.back();\n } else {\n calendar.modal.close();\n }\n }\n init() {\n const calendar = this;\n calendar.initInput();\n if (calendar.inline) {\n calendar.open();\n calendar.emit('local::init calendarInit', calendar);\n return;\n }\n if (!calendar.initialized && calendar.params.value) {\n calendar.setValue(calendar.normalizeValues(calendar.params.value));\n }\n\n // Attach input Events\n if (calendar.$inputEl) {\n calendar.attachInputEvents();\n }\n if (calendar.params.closeByOutsideClick) {\n calendar.attachHtmlEvents();\n }\n calendar.emit('local::init calendarInit', calendar);\n }\n destroy() {\n const calendar = this;\n if (calendar.destroyed) return;\n const {\n $el\n } = calendar;\n calendar.emit('local::beforeDestroy calendarBeforeDestroy', calendar);\n if ($el) $el.trigger('calendar:beforedestroy');\n calendar.close();\n\n // Detach Events\n if (calendar.$inputEl) {\n calendar.detachInputEvents();\n }\n if (calendar.params.closeByOutsideClick) {\n calendar.detachHtmlEvents();\n }\n if (calendar.timePickerInstance) {\n if (calendar.timePickerInstance.destroy) calendar.timePickerInstance.destroy();\n delete calendar.timePickerInstance;\n }\n if ($el && $el.length) delete calendar.$el[0].f7Calendar;\n deleteProps(calendar);\n calendar.destroyed = true;\n }\n}\nexport default Calendar;", "import ConstructorMethods from '../../shared/constructor-methods.js';\nimport Calendar from './calendar-class.js';\nimport $ from '../../shared/dom7.js';\nexport default {\n name: 'calendar',\n static: {\n Calendar\n },\n create() {\n const app = this;\n app.calendar = ConstructorMethods({\n defaultSelector: '.calendar',\n constructor: Calendar,\n app,\n domProp: 'f7Calendar'\n });\n app.calendar.close = function close(el) {\n if (el === void 0) {\n el = '.calendar';\n }\n const $el = $(el);\n if ($el.length === 0) return;\n const calendar = $el[0].f7Calendar;\n if (!calendar || calendar && !calendar.opened) return;\n calendar.close();\n };\n },\n params: {\n calendar: {\n // Calendar settings\n dateFormat: undefined,\n monthNames: 'auto',\n monthNamesShort: 'auto',\n dayNames: 'auto',\n dayNamesShort: 'auto',\n locale: undefined,\n firstDay: 1,\n // First day of the week, Monday\n weekendDays: [0, 6],\n // Sunday and Saturday\n multiple: false,\n rangePicker: false,\n rangePickerMinDays: 1,\n // when calendar is used as rangePicker\n rangePickerMaxDays: 0,\n // when calendar is used as rangePicker, 0 means unlimited\n direction: 'horizontal',\n // or 'vertical'\n minDate: null,\n maxDate: null,\n disabled: null,\n // dates range of disabled days\n events: null,\n // dates range of days with events\n rangesClasses: null,\n // array with custom classes date ranges\n touchMove: true,\n animate: true,\n closeOnSelect: false,\n monthSelector: true,\n monthPicker: true,\n monthPickerToolbar: true,\n monthPickerCloseText: 'Done',\n yearSelector: true,\n yearPicker: true,\n yearPickerToolbar: true,\n yearPickerMin: undefined,\n yearPickerMax: undefined,\n yearPickerCloseText: 'Done',\n timePicker: false,\n timePickerToolbar: true,\n timePickerLabel: 'Time',\n timePickerFormat: {\n hour: 'numeric',\n minute: 'numeric'\n },\n timePickerPlaceholder: 'Select time',\n timePickerCloseText: 'Done',\n weekHeader: true,\n value: null,\n // Common opener settings\n containerEl: null,\n openIn: 'auto',\n // or 'popover' or 'sheet' or 'customModal'\n sheetPush: false,\n sheetSwipeToClose: undefined,\n formatValue: null,\n inputEl: null,\n inputReadOnly: true,\n closeByOutsideClick: true,\n scrollToInput: true,\n header: false,\n headerPlaceholder: 'Select date',\n toolbar: true,\n toolbarCloseText: 'Done',\n footer: false,\n cssClass: null,\n routableModals: false,\n view: null,\n url: 'date/',\n backdrop: null,\n closeByBackdropClick: true,\n // Render functions\n renderWeekHeader: null,\n renderMonths: null,\n renderMonth: null,\n renderMonthSelector: null,\n renderYearSelector: null,\n renderHeader: null,\n renderFooter: null,\n renderToolbar: null,\n renderInline: null,\n renderPopover: null,\n renderSheet: null,\n render: null\n }\n }\n};", "import $ from '../../shared/dom7.js';\nexport default function pickerColumn(colEl, updateItems) {\n const picker = this;\n // const app = picker.app;\n const $colEl = $(colEl);\n const colIndex = $colEl.index();\n const col = picker.cols[colIndex];\n if (col.divider) return;\n col.$el = $colEl;\n col.el = $colEl[0];\n col.$itemsEl = col.$el.find('.picker-items');\n col.items = col.$itemsEl.find('.picker-item');\n let itemHeight;\n let colHeight;\n col.replaceValues = function replaceColValues(values, displayValues) {\n col.detachEvents();\n col.values = values;\n col.displayValues = displayValues;\n col.$itemsEl.html(picker.renderColumn(col, true));\n col.items = col.$itemsEl.find('.picker-item');\n col.calcSize();\n col.setValue(col.values[0], true);\n col.attachEvents();\n };\n col.calcSize = function calcColSize() {\n colHeight = col.$el[0].offsetHeight;\n itemHeight = col.items[0].offsetHeight;\n const hadPadding = col.el.style.getPropertyValue('--f7-picker-scroll-padding');\n col.el.style.setProperty('--f7-picker-scroll-padding', `${(colHeight - itemHeight) / 2}px`);\n if (!hadPadding) {\n col.$itemsEl[0].scrollTop = 0;\n }\n };\n col.setValue = function setColValue(newValue, valueCallbacks) {\n const newActiveIndex = col.$itemsEl.find(`.picker-item[data-picker-value=\"${newValue}\"]`).index();\n if (typeof newActiveIndex === 'undefined' || newActiveIndex === -1) {\n return;\n }\n const newScrollTop = newActiveIndex * itemHeight;\n col.$itemsEl[0].scrollTop = newScrollTop;\n\n // Update items\n col.updateItems(newActiveIndex, newScrollTop, valueCallbacks);\n };\n col.updateItems = function updateColItems(activeIndex, scrollTop, valueCallbacks) {\n if (typeof scrollTop === 'undefined') {\n // eslint-disable-next-line\n scrollTop = col.$itemsEl[0].scrollTop;\n }\n\n /* eslint-disable no-param-reassign */\n if (typeof activeIndex === 'undefined') {\n activeIndex = Math.round(scrollTop / itemHeight);\n }\n if (activeIndex < 0) activeIndex = 0;\n if (activeIndex >= col.items.length) activeIndex = col.items.length - 1;\n /* eslint-enable no-param-reassign */\n const previousActiveIndex = col.activeIndex;\n col.activeIndex = activeIndex;\n col.$itemsEl.find('.picker-item-selected').removeClass('picker-item-selected');\n const selectedItem = col.items.eq(activeIndex);\n selectedItem.addClass('picker-item-selected').children().transform('');\n // Set 3D rotate effect\n if (picker.params.rotateEffect) {\n col.items.each(itemEl => {\n const $itemEl = $(itemEl);\n const itemOffset = itemEl.offsetTop - (colHeight - itemHeight) / 2 - scrollTop;\n const percentage = itemOffset / itemHeight;\n const itemsFit = Math.ceil(col.height / itemHeight / 2) + 1;\n let angle = -24 * percentage;\n if (angle > 180) angle = 180;\n if (angle < -180) angle = -180;\n if (Math.abs(percentage) > itemsFit) {\n $itemEl.addClass('picker-item-far');\n } else {\n $itemEl.removeClass('picker-item-far');\n }\n $itemEl.children('span').transform(`translate3d(0, ${-percentage * itemHeight}px, -100px) rotateX(${angle}deg)`);\n });\n }\n if (valueCallbacks || typeof valueCallbacks === 'undefined') {\n // Update values\n col.value = selectedItem.attr('data-picker-value');\n col.displayValue = col.displayValues ? col.displayValues[activeIndex] : col.value;\n // On change callback\n if (previousActiveIndex !== activeIndex) {\n if (col.onChange) {\n col.onChange(picker, col.value, col.displayValue);\n }\n picker.updateValue();\n }\n }\n };\n function handleScroll() {\n col.updateItems();\n }\n function handleClick() {\n const value = $(this).attr('data-picker-value');\n col.setValue(value);\n }\n col.attachEvents = function attachColEvents() {\n col.$itemsEl.on('scroll', handleScroll);\n col.items.on('click', handleClick);\n };\n col.detachEvents = function detachColEvents() {\n col.items.off('click', handleClick);\n };\n col.init = function initCol() {\n col.calcSize();\n if (colIndex === 0) col.$el.addClass('picker-column-first');\n if (colIndex === picker.cols.length - 1) col.$el.addClass('picker-column-last');\n if (picker.params.freeMode) col.$el.addClass('picker-column-free-mode');\n // Update items on init\n if (updateItems) col.updateItems(0);\n col.attachEvents();\n };\n col.destroy = function destroyCol() {\n col.detachEvents();\n };\n col.init();\n}", "import { getWindow } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend, nextTick, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\nimport { getDevice } from '../../shared/get-device.js';\nimport pickerColumn from './picker-column.js';\n\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass Picker extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const picker = this;\n const device = getDevice();\n const window = getWindow();\n picker.params = extend({}, app.params.picker, params);\n let $containerEl;\n if (picker.params.containerEl) {\n $containerEl = $(picker.params.containerEl);\n if ($containerEl.length === 0) return picker;\n }\n let $inputEl;\n if (picker.params.inputEl) {\n $inputEl = $(picker.params.inputEl);\n }\n let $scrollToEl = picker.params.scrollToInput ? $inputEl : undefined;\n if (picker.params.scrollToEl) {\n const scrollToEl = $(picker.params.scrollToEl);\n if (scrollToEl.length > 0) {\n $scrollToEl = scrollToEl;\n }\n }\n extend(picker, {\n app,\n $containerEl,\n containerEl: $containerEl && $containerEl[0],\n inline: $containerEl && $containerEl.length > 0,\n needsOriginFix: device.ios || window.navigator.userAgent.toLowerCase().indexOf('safari') >= 0 && window.navigator.userAgent.toLowerCase().indexOf('chrome') < 0 && !device.android,\n cols: [],\n $inputEl,\n inputEl: $inputEl && $inputEl[0],\n $scrollToEl,\n initialized: false,\n opened: false,\n url: picker.params.url\n });\n function onResize() {\n picker.resizeCols();\n }\n function onInputClick() {\n picker.open();\n }\n function onInputFocus(e) {\n e.preventDefault();\n }\n let htmlTouchStartTarget = null;\n function onHtmlTouchStart(e) {\n htmlTouchStartTarget = e.target;\n }\n function onHtmlClick(e) {\n if (picker.destroyed || !picker.params) return;\n const $targetEl = $(e.target);\n if (picker.isPopover()) return;\n if (!picker.opened || picker.closing) return;\n if ($targetEl.closest('[class*=\"backdrop\"]').length) return;\n if ($inputEl && $inputEl.length > 0) {\n if (htmlTouchStartTarget === e.target && $targetEl[0] !== $inputEl[0] && $targetEl.closest('.sheet-modal').length === 0) {\n picker.close();\n }\n } else if ($(e.target).closest('.sheet-modal').length === 0) {\n picker.close();\n }\n }\n\n // Events\n extend(picker, {\n attachResizeEvent() {\n app.on('resize', onResize);\n },\n detachResizeEvent() {\n app.off('resize', onResize);\n },\n attachInputEvents() {\n picker.$inputEl.on('click', onInputClick);\n if (picker.params.inputReadOnly) {\n picker.$inputEl.on('focus mousedown', onInputFocus);\n if (picker.$inputEl[0]) {\n picker.$inputEl[0].f7ValidateReadonly = true;\n }\n }\n },\n detachInputEvents() {\n picker.$inputEl.off('click', onInputClick);\n if (picker.params.inputReadOnly) {\n picker.$inputEl.off('focus mousedown', onInputFocus);\n if (picker.$inputEl[0]) {\n delete picker.$inputEl[0].f7ValidateReadonly;\n }\n }\n },\n attachHtmlEvents() {\n app.on('click', onHtmlClick);\n app.on('touchstart', onHtmlTouchStart);\n },\n detachHtmlEvents() {\n app.off('click', onHtmlClick);\n app.off('touchstart', onHtmlTouchStart);\n }\n });\n picker.init();\n return picker;\n }\n get view() {\n const {\n app,\n params,\n $inputEl\n } = this;\n let view;\n if (params.view) {\n view = params.view;\n } else if ($inputEl) {\n view = $inputEl.parents('.view').length && $inputEl.parents('.view')[0].f7View;\n }\n if (!view) view = app.views.main;\n return view;\n }\n initInput() {\n const picker = this;\n if (!picker.$inputEl) return;\n if (picker.params.inputReadOnly) picker.$inputEl.prop('readOnly', true);\n }\n resizeCols() {\n const picker = this;\n if (!picker.opened) return;\n for (let i = 0; i < picker.cols.length; i += 1) {\n if (!picker.cols[i].divider) {\n picker.cols[i].calcSize();\n picker.cols[i].setValue(picker.cols[i].value, false);\n }\n }\n }\n isPopover() {\n const picker = this;\n const {\n app,\n modal,\n params\n } = picker;\n const device = getDevice();\n if (params.openIn === 'sheet') return false;\n if (modal && modal.type !== 'popover') return false;\n if (!picker.inline && picker.inputEl) {\n if (params.openIn === 'popover') return true;\n if (device.ios) {\n return !!device.ipad;\n }\n if (app.width >= 768) {\n return true;\n }\n }\n return false;\n }\n formatValue() {\n const picker = this;\n const {\n value,\n displayValue\n } = picker;\n if (picker.params.formatValue) {\n return picker.params.formatValue.call(picker, value, displayValue);\n }\n return value.join(' ');\n }\n setValue(values) {\n const picker = this;\n let valueIndex = 0;\n if (picker.cols.length === 0) {\n picker.value = values;\n picker.updateValue(values);\n return;\n }\n for (let i = 0; i < picker.cols.length; i += 1) {\n if (picker.cols[i] && !picker.cols[i].divider) {\n picker.cols[i].setValue(values[valueIndex]);\n valueIndex += 1;\n }\n }\n }\n getValue() {\n const picker = this;\n return picker.value;\n }\n updateValue(forceValues) {\n const picker = this;\n const newValue = forceValues || [];\n const newDisplayValue = [];\n let column;\n if (picker.cols.length === 0) {\n const noDividerColumns = picker.params.cols.filter(c => !c.divider);\n for (let i = 0; i < noDividerColumns.length; i += 1) {\n column = noDividerColumns[i];\n if (column.displayValues !== undefined && column.values !== undefined && column.values.indexOf(newValue[i]) !== -1) {\n newDisplayValue.push(column.displayValues[column.values.indexOf(newValue[i])]);\n } else {\n newDisplayValue.push(newValue[i]);\n }\n }\n } else {\n for (let i = 0; i < picker.cols.length; i += 1) {\n if (!picker.cols[i].divider) {\n newValue.push(picker.cols[i].value);\n newDisplayValue.push(picker.cols[i].displayValue);\n }\n }\n }\n if (newValue.indexOf(undefined) >= 0) {\n return;\n }\n picker.value = newValue;\n picker.displayValue = newDisplayValue;\n picker.emit('local::change pickerChange', picker, picker.value, picker.displayValue);\n if (picker.inputEl) {\n picker.$inputEl.val(picker.formatValue());\n picker.$inputEl.trigger('change');\n }\n }\n initColumn(colEl, updateItems) {\n const picker = this;\n pickerColumn.call(picker, colEl, updateItems);\n }\n // eslint-disable-next-line\n destroyColumn(colEl) {\n const picker = this;\n const $colEl = $(colEl);\n const index = $colEl.index();\n if (picker.cols[index] && picker.cols[index].destroy) {\n picker.cols[index].destroy();\n }\n }\n renderToolbar() {\n const picker = this;\n if (picker.params.renderToolbar) return picker.params.renderToolbar.call(picker, picker);\n return $jsx(\"div\", {\n class: \"toolbar toolbar-top\"\n }, $jsx(\"div\", {\n class: \"toolbar-inner\"\n }, $jsx(\"div\", {\n class: \"left\"\n }), $jsx(\"div\", {\n class: \"right\"\n }, $jsx(\"a\", {\n class: \"link sheet-close popover-close\"\n }, picker.params.toolbarCloseText))));\n }\n // eslint-disable-next-line\n renderColumn(col, onlyItems) {\n const colClasses = `picker-column ${col.textAlign ? `picker-column-${col.textAlign}` : ''} ${col.cssClass || ''}`;\n let columnHtml;\n let columnItemsHtml;\n if (col.divider) {\n // prettier-ignore\n columnHtml = `\n ${col.content}
\n `;\n } else {\n // prettier-ignore\n columnItemsHtml = col.values.map((value, index) => `\n \n ${col.displayValues ? col.displayValues[index] : value}\n
\n `).join('');\n // prettier-ignore\n columnHtml = `\n \n `;\n }\n return onlyItems ? columnItemsHtml.trim() : columnHtml.trim();\n }\n renderInline() {\n const picker = this;\n const {\n rotateEffect,\n cssClass,\n toolbar\n } = picker.params;\n const inlineHtml = $jsx(\"div\", {\n class: `picker picker-inline ${rotateEffect ? 'picker-3d' : ''} ${cssClass || ''}`\n }, toolbar && picker.renderToolbar(), $jsx(\"div\", {\n class: \"picker-columns\"\n }, picker.cols.map(col => picker.renderColumn(col)), $jsx(\"div\", {\n class: \"picker-center-highlight\"\n })));\n return inlineHtml;\n }\n renderSheet() {\n const picker = this;\n const {\n rotateEffect,\n cssClass,\n toolbar\n } = picker.params;\n const sheetHtml = $jsx(\"div\", {\n class: `sheet-modal picker picker-sheet ${rotateEffect ? 'picker-3d' : ''} ${cssClass || ''}`\n }, toolbar && picker.renderToolbar(), $jsx(\"div\", {\n class: \"sheet-modal-inner picker-columns\"\n }, picker.cols.map(col => picker.renderColumn(col)), $jsx(\"div\", {\n class: \"picker-center-highlight\"\n })));\n return sheetHtml;\n }\n renderPopover() {\n const picker = this;\n const {\n rotateEffect,\n cssClass,\n toolbar\n } = picker.params;\n const popoverHtml = $jsx(\"div\", {\n class: \"popover picker-popover\"\n }, $jsx(\"div\", {\n class: \"popover-inner\"\n }, $jsx(\"div\", {\n class: `picker ${rotateEffect ? 'picker-3d' : ''} ${cssClass || ''}`\n }, toolbar && picker.renderToolbar(), $jsx(\"div\", {\n class: \"picker-columns\"\n }, picker.cols.map(col => picker.renderColumn(col)), $jsx(\"div\", {\n class: \"picker-center-highlight\"\n })))));\n return popoverHtml;\n }\n render() {\n const picker = this;\n if (picker.params.render) return picker.params.render.call(picker);\n if (!picker.inline) {\n if (picker.isPopover()) return picker.renderPopover();\n return picker.renderSheet();\n }\n return picker.renderInline();\n }\n onOpen() {\n const picker = this;\n const {\n initialized,\n $el,\n app,\n $inputEl,\n inline,\n value,\n params\n } = picker;\n picker.opened = true;\n picker.closing = false;\n picker.opening = true;\n\n // Init main events\n picker.attachResizeEvent();\n\n // Init cols\n $el.find('.picker-column').each(colEl => {\n let updateItems = true;\n if (!initialized && params.value || initialized && value) {\n updateItems = false;\n }\n picker.initColumn(colEl, updateItems);\n });\n\n // Set value\n if (!initialized) {\n if (value) picker.setValue(value);else if (params.value) {\n picker.setValue(params.value);\n }\n } else if (value) {\n picker.setValue(value);\n }\n\n // Extra focus\n if (!inline && $inputEl && $inputEl.length && app.theme === 'md') {\n $inputEl.trigger('focus');\n }\n picker.initialized = true;\n\n // Trigger events\n if ($el) {\n $el.trigger('picker:open');\n }\n if ($inputEl) {\n $inputEl.trigger('picker:open');\n }\n picker.emit('local::open pickerOpen', picker);\n }\n onOpened() {\n const picker = this;\n picker.opening = false;\n if (picker.$el) {\n picker.$el.trigger('picker:opened');\n }\n if (picker.$inputEl) {\n picker.$inputEl.trigger('picker:opened');\n }\n picker.emit('local::opened pickerOpened', picker);\n }\n onClose() {\n const picker = this;\n const app = picker.app;\n picker.opening = false;\n picker.closing = true;\n\n // Detach events\n picker.detachResizeEvent();\n picker.cols.forEach(col => {\n if (col.destroy) col.destroy();\n });\n if (picker.$inputEl) {\n if (app.theme === 'md') {\n picker.$inputEl.trigger('blur');\n } else {\n const validate = picker.$inputEl.attr('validate');\n const required = picker.$inputEl.attr('required');\n if (validate && required) {\n app.input.validate(picker.$inputEl);\n }\n }\n }\n if (picker.$el) {\n picker.$el.trigger('picker:close');\n }\n if (picker.$inputEl) {\n picker.$inputEl.trigger('picker:close');\n }\n picker.emit('local::close pickerClose', picker);\n }\n onClosed() {\n const picker = this;\n picker.opened = false;\n picker.closing = false;\n if (!picker.inline) {\n nextTick(() => {\n if (picker.modal && picker.modal.el && picker.modal.destroy) {\n if (!picker.params.routableModals) {\n picker.modal.destroy();\n }\n }\n delete picker.modal;\n });\n }\n if (picker.$el) {\n picker.$el.trigger('picker:closed');\n }\n if (picker.$inputEl) {\n picker.$inputEl.trigger('picker:closed');\n }\n picker.emit('local::closed pickerClosed', picker);\n }\n open() {\n const picker = this;\n const {\n app,\n opened,\n inline,\n $inputEl,\n $scrollToEl,\n params\n } = picker;\n if (opened) return;\n if (picker.cols.length === 0 && params.cols.length) {\n params.cols.forEach(col => {\n picker.cols.push(col);\n });\n }\n if (inline) {\n picker.$el = $(picker.render());\n picker.$el[0].f7Picker = picker;\n picker.$containerEl.append(picker.$el);\n picker.onOpen();\n picker.onOpened();\n return;\n }\n const isPopover = picker.isPopover();\n const modalType = isPopover ? 'popover' : 'sheet';\n const modalParams = {\n targetEl: $inputEl,\n scrollToEl: $scrollToEl,\n content: picker.render(),\n backdrop: typeof params.backdrop !== 'undefined' ? params.backdrop : isPopover,\n on: {\n open() {\n const modal = this;\n picker.modal = modal;\n picker.$el = isPopover ? modal.$el.find('.picker') : modal.$el;\n picker.$el[0].f7Picker = picker;\n picker.onOpen();\n },\n opened() {\n picker.onOpened();\n },\n close() {\n picker.onClose();\n },\n closed() {\n picker.onClosed();\n }\n }\n };\n if (modalType === 'sheet') {\n modalParams.push = params.sheetPush;\n modalParams.swipeToClose = params.sheetSwipeToClose;\n }\n if (params.routableModals && picker.view) {\n picker.view.router.navigate({\n url: picker.url,\n route: {\n path: picker.url,\n [modalType]: modalParams\n }\n });\n } else {\n picker.modal = app[modalType].create(modalParams);\n picker.modal.open();\n }\n }\n close() {\n const picker = this;\n const {\n opened,\n inline\n } = picker;\n if (!opened) return;\n if (inline) {\n picker.onClose();\n picker.onClosed();\n return;\n }\n if (picker.params.routableModals && picker.view) {\n picker.view.router.back();\n } else {\n picker.modal.close();\n }\n }\n init() {\n const picker = this;\n picker.initInput();\n if (picker.inline) {\n picker.open();\n picker.emit('local::init pickerInit', picker);\n return;\n }\n if (!picker.initialized && picker.params.value) {\n picker.setValue(picker.params.value);\n }\n\n // Attach input Events\n if (picker.$inputEl) {\n picker.attachInputEvents();\n }\n if (picker.params.closeByOutsideClick) {\n picker.attachHtmlEvents();\n }\n picker.emit('local::init pickerInit', picker);\n }\n destroy() {\n const picker = this;\n if (picker.destroyed) return;\n const {\n $el\n } = picker;\n picker.emit('local::beforeDestroy pickerBeforeDestroy', picker);\n if ($el) $el.trigger('picker:beforedestroy');\n picker.close();\n\n // Detach Events\n if (picker.$inputEl) {\n picker.detachInputEvents();\n }\n if (picker.params.closeByOutsideClick) {\n picker.detachHtmlEvents();\n }\n if ($el && $el.length) delete picker.$el[0].f7Picker;\n deleteProps(picker);\n picker.destroyed = true;\n }\n}\nexport default Picker;", "import $ from '../../shared/dom7.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nimport Picker from './picker-class.js';\nexport default {\n name: 'picker',\n static: {\n Picker\n },\n create() {\n const app = this;\n app.picker = ConstructorMethods({\n defaultSelector: '.picker',\n constructor: Picker,\n app,\n domProp: 'f7Picker'\n });\n app.picker.close = function close(el) {\n if (el === void 0) {\n el = '.picker';\n }\n const $el = $(el);\n if ($el.length === 0) return;\n const picker = $el[0].f7Picker;\n if (!picker || picker && !picker.opened) return;\n picker.close();\n };\n },\n params: {\n picker: {\n // Picker settings\n rotateEffect: false,\n freeMode: false,\n cols: [],\n // Common opener settings\n containerEl: null,\n openIn: 'auto',\n // or 'popover' or 'sheet'\n sheetPush: false,\n sheetSwipeToClose: undefined,\n backdrop: undefined,\n // uses Popover or Sheet defaults\n formatValue: null,\n inputEl: null,\n inputReadOnly: true,\n closeByOutsideClick: true,\n scrollToInput: true,\n scrollToEl: undefined,\n toolbar: true,\n toolbarCloseText: 'Done',\n cssClass: null,\n routableModals: false,\n view: null,\n url: 'select/',\n // Render functions\n renderToolbar: null,\n render: null\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { bindMethods } from '../../shared/utils.js';\nconst InfiniteScroll = {\n handle(el, e) {\n const app = this;\n const $el = $(el);\n const scrollTop = $el[0].scrollTop;\n const scrollHeight = $el[0].scrollHeight;\n const height = $el[0].offsetHeight;\n let distance = $el[0].getAttribute('data-infinite-distance');\n const virtualListContainer = $el.find('.virtual-list');\n let virtualList;\n const onTop = $el.hasClass('infinite-scroll-top');\n if (!distance) distance = 50;\n if (typeof distance === 'string' && distance.indexOf('%') >= 0) {\n distance = parseInt(distance, 10) / 100 * height;\n }\n if (distance > height) distance = height;\n if (onTop) {\n if (scrollTop < distance) {\n $el.trigger('infinite', e);\n app.emit('infinite', $el[0], e);\n }\n } else if (scrollTop + height >= scrollHeight - distance) {\n if (virtualListContainer.length > 0) {\n virtualList = virtualListContainer.eq(-1)[0].f7VirtualList;\n if (virtualList && !virtualList.reachEnd && !virtualList.params.updatableScroll) {\n return;\n }\n }\n $el.trigger('infinite', e);\n app.emit('infinite', $el[0], e);\n }\n },\n create(el) {\n const $el = $(el);\n const app = this;\n function scrollHandler(e) {\n app.infiniteScroll.handle(this, e);\n }\n $el.each(element => {\n element.f7InfiniteScrollHandler = scrollHandler;\n element.addEventListener('scroll', element.f7InfiniteScrollHandler);\n });\n },\n destroy(el) {\n const $el = $(el);\n $el.each(element => {\n element.removeEventListener('scroll', element.f7InfiniteScrollHandler);\n delete element.f7InfiniteScrollHandler;\n });\n }\n};\nexport default {\n name: 'infiniteScroll',\n create() {\n const app = this;\n bindMethods(app, {\n infiniteScroll: InfiniteScroll\n });\n },\n on: {\n tabMounted(tabEl) {\n const app = this;\n const $tabEl = $(tabEl);\n const $isEls = $tabEl.find('.infinite-scroll-content');\n if ($tabEl.is('.infinite-scroll-content')) $isEls.add($tabEl);\n $isEls.each(el => {\n app.infiniteScroll.create(el);\n });\n },\n tabBeforeRemove(tabEl) {\n const $tabEl = $(tabEl);\n const app = this;\n const $isEls = $tabEl.find('.infinite-scroll-content');\n if ($tabEl.is('.infinite-scroll-content')) $isEls.add($tabEl);\n $isEls.each(el => {\n app.infiniteScroll.destroy(el);\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.infinite-scroll-content').each(el => {\n app.infiniteScroll.create(el);\n });\n },\n pageBeforeRemove(page) {\n const app = this;\n page.$el.find('.infinite-scroll-content').each(el => {\n app.infiniteScroll.destroy(el);\n });\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\nimport { getSupport } from '../../shared/get-support.js';\nimport { getDevice } from '../../shared/get-device.js';\nclass PullToRefresh extends Framework7Class {\n constructor(app, el) {\n super({}, [app]);\n const ptr = this;\n const device = getDevice();\n const support = getSupport();\n const $el = $(el);\n const $preloaderEl = $el.find('.ptr-preloader');\n ptr.$el = $el;\n ptr.el = $el[0];\n ptr.app = app;\n ptr.bottom = ptr.$el.hasClass('ptr-bottom');\n\n // Extend defaults with modules params\n ptr.useModulesParams({});\n const isMaterial = app.theme === 'md';\n const isIos = app.theme === 'ios';\n\n // Done\n ptr.done = function done() {\n const $transitionTarget = isMaterial ? $preloaderEl : $el;\n const onTranstionEnd = e => {\n if ($(e.target).closest($preloaderEl).length) return;\n $el.removeClass('ptr-transitioning ptr-pull-up ptr-pull-down ptr-closing');\n $el.trigger('ptr:done');\n ptr.emit('local::done ptrDone', $el[0]);\n $transitionTarget.off('transitionend', onTranstionEnd);\n };\n $transitionTarget.on('transitionend', onTranstionEnd);\n $el.removeClass('ptr-refreshing').addClass('ptr-transitioning ptr-closing');\n return ptr;\n };\n ptr.refresh = function refresh() {\n if ($el.hasClass('ptr-refreshing')) return ptr;\n $el.addClass('ptr-transitioning ptr-refreshing');\n $el.trigger('ptr:refresh', ptr.done);\n ptr.emit('local::refresh ptrRefresh', $el[0], ptr.done);\n return ptr;\n };\n\n // Mousewheel\n ptr.mousewheel = $el.attr('data-ptr-mousewheel') === 'true';\n\n // Events handling\n let touchId;\n let isTouched;\n let isMoved;\n const touchesStart = {};\n let isScrolling;\n let touchesDiff;\n let refresh = false;\n let useTranslate = false;\n let forceUseTranslate = false;\n let startTranslate = 0;\n let translate;\n let scrollTop;\n let wasScrolled;\n let triggerDistance;\n let dynamicTriggerDistance;\n let pullStarted;\n let hasNavbar = false;\n let scrollHeight;\n let offsetHeight;\n let maxScrollTop;\n const $pageEl = $el.parents('.page');\n if ($pageEl.find('.navbar').length > 0 || $pageEl.parents('.view').children('.navbars').length > 0) hasNavbar = true;\n if ($pageEl.hasClass('no-navbar')) hasNavbar = false;\n if (!ptr.bottom) {\n const pageNavbarEl = app.navbar.getElByPage($pageEl[0]);\n if (pageNavbarEl) {\n const $pageNavbarEl = $(pageNavbarEl);\n const isLargeTransparent = $pageNavbarEl.hasClass('navbar-large-transparent') || $pageNavbarEl.hasClass('navbar-large') && $pageNavbarEl.hasClass('navbar-transparent');\n const isTransparent = $pageNavbarEl.hasClass('navbar-transparent') && !$pageNavbarEl.hasClass('navbar-large');\n if (isLargeTransparent) {\n $el.addClass('ptr-with-navbar-large-transparent');\n } else if (isTransparent) {\n $el.addClass('ptr-with-navbar-transparent');\n }\n }\n }\n if (!hasNavbar && !ptr.bottom) $el.addClass('ptr-no-navbar');\n\n // Define trigger distance\n if ($el.attr('data-ptr-distance')) {\n dynamicTriggerDistance = true;\n } else if (isMaterial) {\n triggerDistance = 66;\n } else if (isIos) {\n triggerDistance = 44;\n }\n function setPreloaderProgress(progress) {\n if (progress === void 0) {\n progress = 0;\n }\n const $bars = $preloaderEl.find('.preloader-inner-line');\n const perBarProgress = 1 / $bars.length;\n $bars.forEach((barEl, barIndex) => {\n const barProgress = (progress - barIndex * perBarProgress) / perBarProgress;\n barEl.style.opacity = Math.max(Math.min(barProgress, 1), 0) * 0.27;\n });\n }\n function unsetPreloaderProgress() {\n $preloaderEl.find('.preloader-inner-line').css('opacity', '');\n }\n function handleTouchStart(e) {\n if (!e.isTrusted) return;\n if (isTouched) {\n if (device.os === 'android') {\n if ('targetTouches' in e && e.targetTouches.length > 1) return;\n } else return;\n }\n if ($el.hasClass('ptr-refreshing')) {\n return;\n }\n if ($(e.target).closest('.sortable-handler, .ptr-ignore, .card-expandable.card-opened').length) return;\n isMoved = false;\n pullStarted = false;\n isTouched = true;\n isScrolling = undefined;\n wasScrolled = undefined;\n if (e.type === 'touchstart') touchId = e.targetTouches[0].identifier;\n touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n }\n function handleTouchMove(e) {\n if (!isTouched || !e.isTrusted) return;\n let pageX;\n let pageY;\n let touch;\n if (e.type === 'touchmove') {\n if (touchId && e.touches) {\n for (let i = 0; i < e.touches.length; i += 1) {\n if (e.touches[i].identifier === touchId) {\n touch = e.touches[i];\n }\n }\n }\n if (!touch) touch = e.targetTouches[0];\n pageX = touch.pageX;\n pageY = touch.pageY;\n } else {\n pageX = e.pageX;\n pageY = e.pageY;\n }\n if (!pageX || !pageY) return;\n if (typeof isScrolling === 'undefined') {\n isScrolling = !!(isScrolling || Math.abs(pageY - touchesStart.y) > Math.abs(pageX - touchesStart.x));\n }\n if (!isScrolling) {\n isTouched = false;\n return;\n }\n scrollTop = $el[0].scrollTop;\n if (!isMoved) {\n $el.removeClass('ptr-transitioning');\n if (isIos) {\n setPreloaderProgress(0);\n }\n let targetIsScrollable;\n scrollHeight = $el[0].scrollHeight;\n offsetHeight = $el[0].offsetHeight;\n if (ptr.bottom) {\n maxScrollTop = scrollHeight - offsetHeight;\n }\n if (scrollTop > scrollHeight) {\n isTouched = false;\n return;\n }\n const $ptrWatchScrollable = $(e.target).closest('.ptr-watch-scroll');\n if ($ptrWatchScrollable.length) {\n $ptrWatchScrollable.each(ptrScrollableEl => {\n if (ptrScrollableEl === el) return;\n if (ptrScrollableEl.scrollHeight > ptrScrollableEl.offsetHeight && $(ptrScrollableEl).css('overflow') === 'auto' && (!ptr.bottom && ptrScrollableEl.scrollTop > 0 || ptr.bottom && ptrScrollableEl.scrollTop < ptrScrollableEl.scrollHeight - ptrScrollableEl.offsetHeight)) {\n targetIsScrollable = true;\n }\n });\n }\n if (targetIsScrollable) {\n isTouched = false;\n return;\n }\n if (dynamicTriggerDistance) {\n triggerDistance = $el.attr('data-ptr-distance');\n if (triggerDistance.indexOf('%') >= 0) triggerDistance = scrollHeight * parseInt(triggerDistance, 10) / 100;\n }\n startTranslate = $el.hasClass('ptr-refreshing') ? triggerDistance : 0;\n if (scrollHeight === offsetHeight || device.os !== 'ios' || isMaterial) {\n useTranslate = true;\n } else {\n useTranslate = false;\n }\n forceUseTranslate = false;\n }\n isMoved = true;\n touchesDiff = pageY - touchesStart.y;\n if (typeof wasScrolled === 'undefined' && (ptr.bottom ? scrollTop !== maxScrollTop : scrollTop !== 0)) wasScrolled = true;\n const ptrStarted = ptr.bottom ? touchesDiff < 0 && scrollTop >= maxScrollTop || scrollTop > maxScrollTop : touchesDiff > 0 && scrollTop <= 0 || scrollTop < 0;\n if (ptrStarted) {\n // iOS 8 fix\n if (device.os === 'ios' && parseInt(device.osVersion.split('.')[0], 10) > 7) {\n if (!ptr.bottom && scrollTop === 0 && !wasScrolled) useTranslate = true;\n if (ptr.bottom && scrollTop === maxScrollTop && !wasScrolled) useTranslate = true;\n }\n if (!useTranslate && ptr.bottom && !isMaterial) {\n $el.css('-webkit-overflow-scrolling', 'auto');\n $el.scrollTop(maxScrollTop);\n forceUseTranslate = true;\n }\n if (useTranslate || forceUseTranslate) {\n if (e.cancelable) {\n e.preventDefault();\n }\n translate = (ptr.bottom ? -1 * Math.abs(touchesDiff) ** 0.85 : touchesDiff ** 0.85) + startTranslate;\n if (isMaterial) {\n $preloaderEl.transform(`translate3d(0,${translate}px,0)`).find('.ptr-arrow').transform(`rotate(${180 * (Math.abs(touchesDiff) / 66) + 100}deg)`);\n } else {\n // eslint-disable-next-line\n if (ptr.bottom || isIos) {\n $el.children().transform(`translate3d(0,${translate}px,0)`);\n } else {\n // eslint-disable-next-line\n $el.transform(`translate3d(0,${translate}px,0)`);\n }\n if (isIos) {\n $preloaderEl.transform(`translate3d(0,0px,0)`);\n }\n }\n } else if (isIos && !ptr.bottom) {\n $preloaderEl.transform(`translate3d(0,${scrollTop}px,0)`);\n }\n let progress;\n if (isIos && !refresh) {\n progress = useTranslate || forceUseTranslate ? Math.abs(touchesDiff) ** 0.85 / triggerDistance : Math.abs(touchesDiff) / (triggerDistance * 2);\n setPreloaderProgress(progress);\n }\n if ((useTranslate || forceUseTranslate) && Math.abs(touchesDiff) ** 0.85 > triggerDistance || !useTranslate && Math.abs(touchesDiff) >= triggerDistance * 2) {\n refresh = true;\n $el.addClass('ptr-pull-up').removeClass('ptr-pull-down');\n unsetPreloaderProgress();\n } else {\n refresh = false;\n $el.removeClass('ptr-pull-up').addClass('ptr-pull-down');\n }\n if (!pullStarted) {\n $el.trigger('ptr:pullstart');\n ptr.emit('local::pullStart ptrPullStart', $el[0]);\n pullStarted = true;\n }\n $el.trigger('ptr:pullmove', {\n event: e,\n scrollTop,\n translate,\n touchesDiff\n });\n ptr.emit('local::pullMove ptrPullMove', $el[0], {\n event: e,\n scrollTop,\n translate,\n touchesDiff\n });\n } else {\n pullStarted = false;\n $el.removeClass('ptr-pull-up ptr-pull-down');\n refresh = false;\n }\n }\n function handleTouchEnd(e) {\n if (!e.isTrusted) return;\n if (e.type === 'touchend' && e.changedTouches && e.changedTouches.length > 0 && touchId) {\n if (e.changedTouches[0].identifier !== touchId) {\n isTouched = false;\n isScrolling = false;\n isMoved = false;\n touchId = null;\n return;\n }\n }\n if (!isTouched || !isMoved) {\n isTouched = false;\n isMoved = false;\n return;\n }\n if (translate) {\n $el.addClass('ptr-transitioning');\n translate = 0;\n }\n if (isMaterial) {\n $preloaderEl.transform('').find('.ptr-arrow').transform('');\n } else {\n $preloaderEl.transform('');\n if (ptr.bottom || isIos) {\n $el.children().transform('');\n } else {\n $el.transform('');\n }\n }\n if (!useTranslate && ptr.bottom && !isMaterial) {\n $el.css('-webkit-overflow-scrolling', '');\n }\n if (refresh) {\n $el.addClass('ptr-refreshing');\n $el.trigger('ptr:refresh', ptr.done);\n ptr.emit('local::refresh ptrRefresh', $el[0], ptr.done);\n } else {\n $el.removeClass('ptr-pull-down');\n }\n isTouched = false;\n isMoved = false;\n if (pullStarted) {\n $el.trigger('ptr:pullend');\n ptr.emit('local::pullEnd ptrPullEnd', $el[0]);\n }\n }\n let mousewheelTimeout;\n let mousewheelMoved;\n let mousewheelAllow = true;\n let mousewheelTranslate = 0;\n function handleMouseWheelRelease() {\n mousewheelAllow = true;\n mousewheelMoved = false;\n mousewheelTranslate = 0;\n if (translate) {\n $el.addClass('ptr-transitioning');\n translate = 0;\n }\n if (isMaterial) {\n $preloaderEl.transform('').find('.ptr-arrow').transform('');\n } else {\n $preloaderEl.transform('');\n if (ptr.bottom) {\n $el.children().transform('');\n } else {\n $el.transform('');\n }\n }\n if (refresh) {\n $el.addClass('ptr-refreshing');\n $el.trigger('ptr:refresh', ptr.done);\n ptr.emit('local::refresh ptrRefresh', $el[0], ptr.done);\n } else {\n $el.removeClass('ptr-pull-down');\n }\n if (pullStarted) {\n $el.trigger('ptr:pullend');\n ptr.emit('local::pullEnd ptrPullEnd', $el[0]);\n }\n }\n function handleMouseWheel(e) {\n if (!mousewheelAllow) return;\n const {\n deltaX,\n deltaY\n } = e;\n if (Math.abs(deltaX) > Math.abs(deltaY)) return;\n if ($el.hasClass('ptr-refreshing')) {\n return;\n }\n if ($(e.target).closest('.sortable-handler, .ptr-ignore, .card-expandable.card-opened').length) return;\n clearTimeout(mousewheelTimeout);\n scrollTop = $el[0].scrollTop;\n if (!mousewheelMoved) {\n $el.removeClass('ptr-transitioning');\n if (isIos) {\n setPreloaderProgress(0);\n }\n let targetIsScrollable;\n scrollHeight = $el[0].scrollHeight;\n offsetHeight = $el[0].offsetHeight;\n if (ptr.bottom) {\n maxScrollTop = scrollHeight - offsetHeight;\n }\n if (scrollTop > scrollHeight) {\n mousewheelAllow = false;\n return;\n }\n const $ptrWatchScrollable = $(e.target).closest('.ptr-watch-scroll');\n if ($ptrWatchScrollable.length) {\n $ptrWatchScrollable.each(ptrScrollableEl => {\n if (ptrScrollableEl === el) return;\n if (ptrScrollableEl.scrollHeight > ptrScrollableEl.offsetHeight && $(ptrScrollableEl).css('overflow') === 'auto' && (!ptr.bottom && ptrScrollableEl.scrollTop > 0 || ptr.bottom && ptrScrollableEl.scrollTop < ptrScrollableEl.scrollHeight - ptrScrollableEl.offsetHeight)) {\n targetIsScrollable = true;\n }\n });\n }\n if (targetIsScrollable) {\n mousewheelAllow = false;\n return;\n }\n if (dynamicTriggerDistance) {\n triggerDistance = $el.attr('data-ptr-distance');\n if (triggerDistance.indexOf('%') >= 0) triggerDistance = scrollHeight * parseInt(triggerDistance, 10) / 100;\n }\n }\n isMoved = true;\n mousewheelTranslate -= deltaY;\n touchesDiff = mousewheelTranslate; // pageY - touchesStart.y;\n\n if (typeof wasScrolled === 'undefined' && (ptr.bottom ? scrollTop !== maxScrollTop : scrollTop !== 0)) wasScrolled = true;\n const ptrStarted = ptr.bottom ? touchesDiff < 0 && scrollTop >= maxScrollTop || scrollTop > maxScrollTop : touchesDiff > 0 && scrollTop <= 0 || scrollTop < 0;\n if (ptrStarted) {\n if (e.cancelable) {\n e.preventDefault();\n }\n translate = touchesDiff;\n if (Math.abs(translate) > triggerDistance) {\n translate = triggerDistance + (Math.abs(translate) - triggerDistance) ** 0.7;\n if (ptr.bottom) translate = -translate;\n }\n if (isMaterial) {\n $preloaderEl.transform(`translate3d(0,${translate}px,0)`).find('.ptr-arrow').transform(`rotate(${180 * (Math.abs(touchesDiff) / 66) + 100}deg)`);\n } else {\n // eslint-disable-next-line\n if (ptr.bottom) {\n $el.children().transform(`translate3d(0,${translate}px,0)`);\n } else {\n $el.transform(`translate3d(0,${translate}px,0)`);\n if (isIos) {\n $preloaderEl.transform(`translate3d(0,${-translate}px,0)`);\n }\n }\n }\n let progress;\n if (isIos && !refresh) {\n progress = Math.abs(translate) / triggerDistance;\n setPreloaderProgress(progress);\n }\n if (Math.abs(translate) > triggerDistance) {\n refresh = true;\n $el.addClass('ptr-pull-up').removeClass('ptr-pull-down');\n unsetPreloaderProgress();\n } else {\n refresh = false;\n $el.removeClass('ptr-pull-up').addClass('ptr-pull-down');\n }\n if (!pullStarted) {\n $el.trigger('ptr:pullstart');\n ptr.emit('local::pullStart ptrPullStart', $el[0]);\n pullStarted = true;\n }\n $el.trigger('ptr:pullmove', {\n event: e,\n scrollTop,\n translate,\n touchesDiff\n });\n ptr.emit('local::pullMove ptrPullMove', $el[0], {\n event: e,\n scrollTop,\n translate,\n touchesDiff\n });\n } else {\n pullStarted = false;\n $el.removeClass('ptr-pull-up ptr-pull-down');\n refresh = false;\n }\n mousewheelTimeout = setTimeout(handleMouseWheelRelease, 300);\n }\n if (!$pageEl.length || !$el.length) return ptr;\n $el[0].f7PullToRefresh = ptr;\n\n // Events\n ptr.attachEvents = function attachEvents() {\n const passive = support.passiveListener ? {\n passive: true\n } : false;\n $el.on(app.touchEvents.start, handleTouchStart, passive);\n app.on('touchmove:active', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n if (ptr.mousewheel && !ptr.bottom) {\n $el.on('wheel', handleMouseWheel);\n }\n };\n ptr.detachEvents = function detachEvents() {\n const passive = support.passiveListener ? {\n passive: true\n } : false;\n $el.off(app.touchEvents.start, handleTouchStart, passive);\n app.off('touchmove:active', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n if (ptr.mousewheel && !ptr.bottom) {\n $el.off('wheel', handleMouseWheel);\n }\n };\n\n // Install Modules\n ptr.useModules();\n\n // Init\n ptr.init();\n return ptr;\n }\n init() {\n const ptr = this;\n ptr.attachEvents();\n }\n destroy() {\n let ptr = this;\n ptr.emit('local::beforeDestroy ptrBeforeDestroy', ptr);\n ptr.$el.trigger('ptr:beforedestroy');\n delete ptr.el.f7PullToRefresh;\n ptr.detachEvents();\n deleteProps(ptr);\n ptr = null;\n }\n}\nexport default PullToRefresh;", "import $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nimport PullToRefresh from './pull-to-refresh-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'pullToRefresh',\n create() {\n const app = this;\n app.ptr = extend(ConstructorMethods({\n defaultSelector: '.ptr-content',\n constructor: PullToRefresh,\n app,\n domProp: 'f7PullToRefresh'\n }), {\n done(el) {\n const ptr = app.ptr.get(el);\n if (ptr) return ptr.done();\n return undefined;\n },\n refresh(el) {\n const ptr = app.ptr.get(el);\n if (ptr) return ptr.refresh();\n return undefined;\n }\n });\n },\n static: {\n PullToRefresh\n },\n on: {\n tabMounted(tabEl) {\n const app = this;\n const $tabEl = $(tabEl);\n const $ptrEls = $tabEl.find('.ptr-content');\n if ($tabEl.is('.ptr-content')) $ptrEls.add($tabEl);\n $ptrEls.each(el => {\n app.ptr.create(el);\n });\n },\n tabBeforeRemove(tabEl) {\n const $tabEl = $(tabEl);\n const app = this;\n const $ptrEls = $tabEl.find('.ptr-content');\n if ($tabEl.is('.ptr-content')) $ptrEls.add($tabEl);\n $ptrEls.each(el => {\n app.ptr.destroy(el);\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.ptr-content').each(el => {\n app.ptr.create(el);\n });\n },\n pageBeforeRemove(page) {\n const app = this;\n page.$el.find('.ptr-content').each(el => {\n app.ptr.destroy(el);\n });\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\nclass DataTable extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const table = this;\n const defaults = {};\n\n // Extend defaults with modules params\n table.useModulesParams(defaults);\n table.params = extend(defaults, params);\n\n // El\n const $el = $(table.params.el);\n if ($el.length === 0) return undefined;\n table.$el = $el;\n table.el = $el[0];\n if (table.$el[0].f7DataTable) {\n const instance = table.$el[0].f7DataTable;\n table.destroy();\n return instance;\n }\n table.$el[0].f7DataTable = table;\n extend(table, {\n collapsible: $el.hasClass('data-table-collapsible'),\n // Headers\n $headerEl: $el.find('.data-table-header'),\n $headerSelectedEl: $el.find('.data-table-header-selected')\n });\n\n // Events\n function handleChange(e) {\n if (e.detail && e.detail.sentByF7DataTable) {\n // Scripted event, don't do anything\n return;\n }\n const $inputEl = $(this);\n const checked = $inputEl[0].checked;\n const columnIndex = $inputEl.parents('td,th').index();\n if ($inputEl.parents('thead').length > 0) {\n if (columnIndex === 0) {\n $el.find('tbody tr')[checked ? 'addClass' : 'removeClass']('data-table-row-selected');\n }\n $el.find(`tbody tr td:nth-child(${columnIndex + 1}) input`).prop('checked', checked).trigger('change', {\n sentByF7DataTable: true\n });\n $inputEl.prop('indeterminate', false);\n } else {\n if (columnIndex === 0) {\n $inputEl.parents('tr')[checked ? 'addClass' : 'removeClass']('data-table-row-selected');\n }\n const checkedRows = $el.find(`tbody .checkbox-cell:nth-child(${columnIndex + 1}) input[type=\"checkbox\"]:checked`).length;\n const totalRows = $el.find('tbody tr').length;\n const $headCheckboxEl = $el.find(`thead .checkbox-cell:nth-child(${columnIndex + 1}) input[type=\"checkbox\"]`);\n if (!checked) {\n $headCheckboxEl.prop('checked', false);\n } else if (checkedRows === totalRows) {\n $headCheckboxEl.prop('checked', true).trigger('change', {\n sentByF7DataTable: true\n });\n }\n $headCheckboxEl.prop('indeterminate', checkedRows > 0 && checkedRows < totalRows);\n }\n table.checkSelectedHeader();\n }\n function handleSortableClick() {\n const $cellEl = $(this);\n const isActive = $cellEl.hasClass('sortable-cell-active');\n const currentSort = $cellEl.hasClass('sortable-desc') ? 'desc' : 'asc';\n let newSort;\n if (isActive) {\n newSort = currentSort === 'desc' ? 'asc' : 'desc';\n $cellEl.removeClass('sortable-desc sortable-asc').addClass(`sortable-${newSort}`);\n } else {\n $el.find('thead .sortable-cell-active').removeClass('sortable-cell-active');\n $cellEl.addClass('sortable-cell-active');\n newSort = currentSort;\n }\n $cellEl.trigger('datatable:sort', newSort);\n table.emit('local::sort dataTableSort', table, newSort);\n }\n table.attachEvents = function attachEvents() {\n table.$el.on('change', '.checkbox-cell input[type=\"checkbox\"]', handleChange);\n table.$el.find('thead .sortable-cell').on('click', handleSortableClick);\n };\n table.detachEvents = function detachEvents() {\n table.$el.off('change', '.checkbox-cell input[type=\"checkbox\"]', handleChange);\n table.$el.find('thead .sortable-cell').off('click', handleSortableClick);\n };\n\n // Install Modules\n table.useModules();\n\n // Init\n table.init();\n return table;\n }\n setCollapsibleLabels() {\n const table = this;\n if (!table.collapsible) return;\n table.$el.find('tbody td:not(.checkbox-cell)').each(el => {\n const $el = $(el);\n const elIndex = $el.index();\n const collapsibleTitle = $el.attr('data-collapsible-title');\n if (!collapsibleTitle && collapsibleTitle !== '') {\n $el.attr('data-collapsible-title', table.$el.find('thead th').eq(elIndex).text());\n }\n });\n }\n checkSelectedHeader() {\n const table = this;\n if (table.$headerEl.length > 0 && table.$headerSelectedEl.length > 0) {\n const checkedItems = table.$el.find('tbody .checkbox-cell input:checked').length;\n table.$el[checkedItems > 0 ? 'addClass' : 'removeClass']('data-table-has-checked');\n table.$headerSelectedEl.find('.data-table-selected-count').text(checkedItems);\n }\n }\n init() {\n const table = this;\n table.attachEvents();\n table.setCollapsibleLabels();\n table.checkSelectedHeader();\n }\n destroy() {\n let table = this;\n table.$el.trigger('datatable:beforedestroy');\n table.emit('local::beforeDestroy dataTableBeforeDestroy', table);\n table.detachEvents();\n if (table.$el[0]) {\n table.$el[0].f7DataTable = null;\n delete table.$el[0].f7DataTable;\n }\n deleteProps(table);\n table = null;\n }\n}\nexport default DataTable;", "import $ from '../../shared/dom7.js';\nimport DataTable from './data-table-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'dataTable',\n static: {\n DataTable\n },\n create() {\n const app = this;\n app.dataTable = ConstructorMethods({\n defaultSelector: '.data-table',\n constructor: DataTable,\n app,\n domProp: 'f7DataTable'\n });\n },\n on: {\n tabBeforeRemove(tabEl) {\n const app = this;\n $(tabEl).find('.data-table-init').each(tableEl => {\n app.dataTable.destroy(tableEl);\n });\n },\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.data-table-init').each(tableEl => {\n app.dataTable.create({\n el: tableEl\n });\n });\n },\n pageBeforeRemove(page) {\n const app = this;\n page.$el.find('.data-table-init').each(tableEl => {\n app.dataTable.destroy(tableEl);\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.data-table-init').each(tableEl => {\n app.dataTable.create({\n el: tableEl\n });\n });\n }\n },\n vnode: {\n 'data-table-init': {\n insert(vnode) {\n const app = this;\n const tableEl = vnode.elm;\n app.dataTable.create({\n el: tableEl\n });\n },\n destroy(vnode) {\n const app = this;\n const tableEl = vnode.elm;\n app.dataTable.destroy(tableEl);\n }\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { bindMethods, getTranslate, nextFrame } from '../../shared/utils.js';\nconst Fab = {\n morphOpen(fabEl, targetEl) {\n const app = this;\n const $fabEl = $(fabEl);\n const $targetEl = $(targetEl);\n if ($targetEl.length === 0) return;\n $targetEl.transition(0).addClass('fab-morph-target-visible');\n const target = {\n width: $targetEl[0].offsetWidth,\n height: $targetEl[0].offsetHeight,\n offset: $targetEl.offset(),\n borderRadius: $targetEl.css('border-radius'),\n zIndex: $targetEl.css('z-index')\n };\n const fab = {\n width: $fabEl[0].offsetWidth,\n height: $fabEl[0].offsetHeight,\n offset: $fabEl.offset(),\n translateX: getTranslate($fabEl[0], 'x'),\n translateY: getTranslate($fabEl[0], 'y')\n };\n $fabEl[0].f7FabMorphData = {\n $targetEl,\n target,\n fab\n };\n const diffX = fab.offset.left + fab.width / 2 - (target.offset.left + target.width / 2) - fab.translateX;\n const diffY = fab.offset.top + fab.height / 2 - (target.offset.top + target.height / 2) - fab.translateY;\n const scaleX = target.width / fab.width;\n const scaleY = target.height / fab.height;\n let borderRadius = Math.ceil(parseInt(target.borderRadius, 10) / Math.max(scaleX, scaleY));\n if (borderRadius > 0) borderRadius += 2;\n $fabEl[0].f7FabMorphResizeHandler = function resizeHandler() {\n $fabEl.transition(0).transform('');\n $targetEl.transition(0);\n target.width = $targetEl[0].offsetWidth;\n target.height = $targetEl[0].offsetHeight;\n target.offset = $targetEl.offset();\n fab.offset = $fabEl.offset();\n const diffXNew = fab.offset.left + fab.width / 2 - (target.offset.left + target.width / 2) - fab.translateX;\n const diffYNew = fab.offset.top + fab.height / 2 - (target.offset.top + target.height / 2) - fab.translateY;\n const scaleXNew = target.width / fab.width;\n const scaleYNew = target.height / fab.height;\n $fabEl.transform(`translate3d(${-diffXNew}px, ${-diffYNew}px, 0) scale(${scaleXNew}, ${scaleYNew})`);\n };\n $targetEl.css('opacity', 0).transform(`scale(${1 / scaleX}, ${1 / scaleY})`);\n $fabEl.addClass('fab-opened').css('z-index', target.zIndex - 1).transform(`translate3d(${-diffX}px, ${-diffY}px, 0)`);\n $fabEl.transitionEnd(() => {\n $targetEl.transition('');\n nextFrame(() => {\n $targetEl.css('opacity', 1).transform('scale(1,1)');\n $fabEl.transform(`translate3d(${-diffX}px, ${-diffY}px, 0) scale(${scaleX}, ${scaleY})`).css('border-radius', `${borderRadius}px`).css('box-shadow', 'none').css('opacity', '0');\n });\n app.on('resize', $fabEl[0].f7FabMorphResizeHandler);\n if ($targetEl.parents('.page-content').length > 0) {\n $targetEl.parents('.page-content').on('scroll', $fabEl[0].f7FabMorphResizeHandler);\n }\n });\n },\n morphClose(fabEl) {\n const app = this;\n const $fabEl = $(fabEl);\n const morphData = $fabEl[0].f7FabMorphData;\n if (!morphData) return;\n const {\n $targetEl,\n target,\n fab\n } = morphData;\n if ($targetEl.length === 0) return;\n const diffX = fab.offset.left + fab.width / 2 - (target.offset.left + target.width / 2) - fab.translateX;\n const diffY = fab.offset.top + fab.height / 2 - (target.offset.top + target.height / 2) - fab.translateY;\n const scaleX = target.width / fab.width;\n const scaleY = target.height / fab.height;\n app.off('resize', $fabEl[0].f7FabMorphResizeHandler);\n if ($targetEl.parents('.page-content').length > 0) {\n $targetEl.parents('.page-content').off('scroll', $fabEl[0].f7FabMorphResizeHandler);\n }\n $targetEl.css('opacity', 0).transform(`scale(${1 / scaleX}, ${1 / scaleY})`);\n $fabEl.transition('').css('box-shadow', '').css('border-radius', '').css('opacity', '1').transform(`translate3d(${-diffX}px, ${-diffY}px, 0)`);\n $fabEl.transitionEnd(() => {\n $fabEl.css('z-index', '').removeClass('fab-opened').transform('');\n nextFrame(() => {\n $fabEl.transitionEnd(() => {\n $targetEl.removeClass('fab-morph-target-visible').css('opacity', '').transform('').transition('');\n });\n });\n });\n },\n open(fabEl, targetEl) {\n const app = this;\n const $fabEl = $(fabEl).eq(0);\n const $buttonsEl = $fabEl.find('.fab-buttons');\n if (!$fabEl.length) return;\n if ($fabEl.hasClass('fab-opened')) return;\n if (!$buttonsEl.length && !$fabEl.hasClass('fab-morph')) return;\n if (app.fab.openedEl) {\n if (app.fab.openedEl === $fabEl[0]) return;\n app.fab.close(app.fab.openedEl);\n }\n app.fab.openedEl = $fabEl[0];\n if ($fabEl.hasClass('fab-morph')) {\n app.fab.morphOpen($fabEl, targetEl || $fabEl.attr('data-morph-to'));\n } else {\n $fabEl.addClass('fab-opened');\n }\n $fabEl.siblings('.fab-backdrop').addClass('backdrop-in');\n $fabEl.trigger('fab:open');\n },\n close(fabEl) {\n if (fabEl === void 0) {\n fabEl = '.fab-opened';\n }\n const app = this;\n const $fabEl = $(fabEl).eq(0);\n const $buttonsEl = $fabEl.find('.fab-buttons');\n if (!$fabEl.length) return;\n if (!$fabEl.hasClass('fab-opened')) return;\n if (!$buttonsEl.length && !$fabEl.hasClass('fab-morph')) return;\n app.fab.openedEl = null;\n if ($fabEl.hasClass('fab-morph')) {\n app.fab.morphClose($fabEl);\n } else {\n $fabEl.removeClass('fab-opened');\n }\n $fabEl.siblings('.fab-backdrop').removeClass('backdrop-in');\n $fabEl.trigger('fab:close');\n },\n toggle(fabEl) {\n const app = this;\n const $fabEl = $(fabEl);\n if (!$fabEl.hasClass('fab-opened')) app.fab.open(fabEl);else app.fab.close(fabEl);\n }\n};\nexport default {\n name: 'fab',\n create() {\n const app = this;\n bindMethods(app, {\n fab: {\n openedEl: null,\n ...Fab\n }\n });\n },\n clicks: {\n '.fab > a': function open($clickedEl) {\n const app = this;\n app.fab.toggle($clickedEl.parents('.fab'));\n },\n '.fab-open': function open($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.fab.open(data.fab);\n },\n '.fab-close': function close($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n app.fab.close(data.fab);\n },\n '.fab-backdrop': function close() {\n const app = this;\n app.fab.close();\n }\n }\n};", "import { getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend, nextTick, deleteProps } from '../../shared/utils.js';\nimport FrameworkClass from '../../shared/class.js';\nimport { getDevice } from '../../shared/get-device.js';\nimport removeDiacritics from './remove-diacritics.js';\nclass Searchbar extends FrameworkClass {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const sb = this;\n const defaults = {\n el: undefined,\n inputEl: undefined,\n inputEvents: 'change input compositionend',\n disableButton: true,\n disableButtonEl: undefined,\n backdropEl: undefined,\n searchContainer: undefined,\n // container to search, HTMLElement or CSS selector\n searchItem: 'li',\n // single item selector, CSS selector\n searchIn: undefined,\n // where to search in item, CSS selector\n searchGroup: '.list-group',\n searchGroupTitle: '.list-group-title',\n ignore: '.searchbar-ignore',\n foundEl: '.searchbar-found',\n notFoundEl: '.searchbar-not-found',\n hideOnEnableEl: '.searchbar-hide-on-enable',\n hideOnSearchEl: '.searchbar-hide-on-search',\n backdrop: true,\n removeDiacritics: true,\n customSearch: false,\n hideGroupTitles: true,\n hideGroups: true,\n disableOnBackdropClick: true,\n expandable: false,\n inline: false\n };\n\n // Extend defaults with modules params\n sb.useModulesParams(defaults);\n sb.params = extend(defaults, params);\n const $el = $(sb.params.el);\n if ($el.length === 0) return sb;\n if ($el[0].f7Searchbar) return $el[0].f7Searchbar;\n $el[0].f7Searchbar = sb;\n let $pageEl;\n const $navbarEl = $el.parents('.navbar');\n if ($el.parents('.page').length > 0) {\n $pageEl = $el.parents('.page');\n } else if ($navbarEl.length > 0) {\n $pageEl = $(app.navbar.getPageByEl($navbarEl[0]));\n if (!$pageEl.length) {\n const $currentPageEl = $el.parents('.view').find('.page-current');\n if ($currentPageEl[0] && $currentPageEl[0].f7Page && $currentPageEl[0].f7Page.navbarEl === $navbarEl[0]) {\n $pageEl = $currentPageEl;\n }\n }\n }\n let $foundEl;\n if (params.foundEl) {\n $foundEl = $(params.foundEl);\n } else if (typeof sb.params.foundEl === 'string' && $pageEl) {\n $foundEl = $pageEl.find(sb.params.foundEl);\n }\n let $notFoundEl;\n if (params.notFoundEl) {\n $notFoundEl = $(params.notFoundEl);\n } else if (typeof sb.params.notFoundEl === 'string' && $pageEl) {\n $notFoundEl = $pageEl.find(sb.params.notFoundEl);\n }\n let $hideOnEnableEl;\n if (params.hideOnEnableEl) {\n $hideOnEnableEl = $(params.hideOnEnableEl);\n } else if (typeof sb.params.hideOnEnableEl === 'string' && $pageEl) {\n $hideOnEnableEl = $pageEl.find(sb.params.hideOnEnableEl);\n }\n let $hideOnSearchEl;\n if (params.hideOnSearchEl) {\n $hideOnSearchEl = $(params.hideOnSearchEl);\n } else if (typeof sb.params.hideOnSearchEl === 'string' && $pageEl) {\n $hideOnSearchEl = $pageEl.find(sb.params.hideOnSearchEl);\n }\n const expandable = sb.params.expandable || $el.hasClass('searchbar-expandable');\n const inline = sb.params.inline || $el.hasClass('searchbar-inline');\n if (typeof sb.params.backdrop === 'undefined') {\n sb.params.backdrop = !inline;\n }\n let $backdropEl;\n if (sb.params.backdrop) {\n if (sb.params.backdropEl) {\n $backdropEl = $(sb.params.backdropEl);\n } else if ($pageEl && $pageEl.length > 0) {\n $backdropEl = $pageEl.find('.searchbar-backdrop');\n } else {\n $backdropEl = $el.siblings('.searchbar-backdrop');\n }\n if ($backdropEl.length === 0) {\n $backdropEl = $('');\n if ($pageEl && $pageEl.length) {\n if ($el.parents($pageEl).length > 0 && $navbarEl && $el.parents($navbarEl).length === 0) {\n $backdropEl.insertBefore($el);\n } else {\n $backdropEl.insertBefore($pageEl.find('.page-content').eq(0));\n }\n } else {\n $backdropEl.insertBefore($el);\n }\n }\n }\n let $searchContainer;\n if (sb.params.searchContainer) {\n $searchContainer = $(sb.params.searchContainer);\n }\n let $inputEl;\n if (sb.params.inputEl) {\n $inputEl = $(sb.params.inputEl);\n } else {\n $inputEl = $el.find('input[type=\"search\"]').eq(0);\n }\n let $disableButtonEl;\n if (sb.params.disableButton) {\n if (sb.params.disableButtonEl) {\n $disableButtonEl = $(sb.params.disableButtonEl);\n } else {\n $disableButtonEl = $el.find('.searchbar-disable-button');\n }\n }\n extend(sb, {\n app,\n view: app.views.get($el.parents('.view')),\n $el,\n el: $el[0],\n $backdropEl,\n backdropEl: $backdropEl && $backdropEl[0],\n $searchContainer,\n searchContainer: $searchContainer && $searchContainer[0],\n $inputEl,\n inputEl: $inputEl[0],\n $disableButtonEl,\n disableButtonEl: $disableButtonEl && $disableButtonEl[0],\n disableButtonHasMargin: false,\n $pageEl,\n pageEl: $pageEl && $pageEl[0],\n $navbarEl,\n navbarEl: $navbarEl && $navbarEl[0],\n $foundEl,\n foundEl: $foundEl && $foundEl[0],\n $notFoundEl,\n notFoundEl: $notFoundEl && $notFoundEl[0],\n $hideOnEnableEl,\n hideOnEnableEl: $hideOnEnableEl && $hideOnEnableEl[0],\n $hideOnSearchEl,\n hideOnSearchEl: $hideOnSearchEl && $hideOnSearchEl[0],\n previousQuery: '',\n query: '',\n isVirtualList: $searchContainer && $searchContainer.hasClass('virtual-list'),\n virtualList: undefined,\n enabled: false,\n expandable,\n inline\n });\n\n // Events\n function preventSubmit(e) {\n e.preventDefault();\n }\n function onInputFocus(e) {\n sb.enable(e);\n sb.$el.addClass('searchbar-focused');\n }\n function onInputBlur() {\n sb.$el.removeClass('searchbar-focused');\n }\n function onInputChange() {\n const value = sb.$inputEl.val().trim();\n if (sb.$searchContainer && sb.$searchContainer.length > 0 && (sb.params.searchIn || sb.isVirtualList || sb.params.searchIn === sb.params.searchItem) || sb.params.customSearch) {\n sb.search(value, true);\n }\n }\n function onInputClear(e, previousValue) {\n sb.$el.trigger('searchbar:clear', previousValue);\n sb.emit('local::clear searchbarClear', sb, previousValue);\n }\n function disableOnClick(e) {\n sb.disable(e);\n }\n function onPageBeforeOut() {\n if (!sb || sb && !sb.$el) return;\n if (sb.enabled) {\n sb.$el.removeClass('searchbar-enabled');\n if (sb.expandable) {\n sb.$el.parents('.navbar').removeClass('with-searchbar-expandable-enabled with-searchbar-expandable-enabled-no-transition');\n }\n }\n }\n function onPageBeforeIn() {\n if (!sb || sb && !sb.$el) return;\n if (sb.enabled) {\n sb.$el.addClass('searchbar-enabled');\n if (sb.expandable) {\n sb.$el.parents('.navbar').addClass('with-searchbar-expandable-enabled-no-transition');\n }\n }\n }\n sb.attachEvents = function attachEvents() {\n $el.on('submit', preventSubmit);\n if (sb.params.disableButton) {\n sb.$disableButtonEl.on('click', disableOnClick);\n }\n if (sb.params.disableOnBackdropClick && sb.$backdropEl) {\n sb.$backdropEl.on('click', disableOnClick);\n }\n if (sb.expandable && app.theme === 'ios' && sb.view && $navbarEl.length && sb.$pageEl) {\n sb.$pageEl.on('page:beforeout', onPageBeforeOut);\n sb.$pageEl.on('page:beforein', onPageBeforeIn);\n }\n sb.$inputEl.on('focus', onInputFocus);\n sb.$inputEl.on('blur', onInputBlur);\n sb.$inputEl.on(sb.params.inputEvents, onInputChange);\n sb.$inputEl.on('input:clear', onInputClear);\n };\n sb.detachEvents = function detachEvents() {\n $el.off('submit', preventSubmit);\n if (sb.params.disableButton) {\n sb.$disableButtonEl.off('click', disableOnClick);\n }\n if (sb.params.disableOnBackdropClick && sb.$backdropEl) {\n sb.$backdropEl.off('click', disableOnClick);\n }\n if (sb.expandable && app.theme === 'ios' && sb.view && $navbarEl.length && sb.$pageEl) {\n sb.$pageEl.off('page:beforeout', onPageBeforeOut);\n sb.$pageEl.off('page:beforein', onPageBeforeIn);\n }\n sb.$inputEl.off('focus', onInputFocus);\n sb.$inputEl.off('blur', onInputBlur);\n sb.$inputEl.off(sb.params.inputEvents, onInputChange);\n sb.$inputEl.off('input:clear', onInputClear);\n };\n\n // Install Modules\n sb.useModules();\n\n // Init\n sb.init();\n return sb;\n }\n clear(e) {\n const sb = this;\n if (!sb.query && e && $(e.target).hasClass('searchbar-clear')) {\n sb.disable();\n return sb;\n }\n const previousQuery = sb.value;\n sb.$inputEl.val('').trigger('change').focus();\n sb.$el.trigger('searchbar:clear', previousQuery);\n sb.emit('local::clear searchbarClear', sb, previousQuery);\n return sb;\n }\n setDisableButtonMargin() {\n const sb = this;\n if (sb.expandable) return;\n const app = sb.app;\n sb.$disableButtonEl.transition(0).show();\n sb.$disableButtonEl.css(`margin-${app.rtl ? 'left' : 'right'}`, `${-sb.disableButtonEl.offsetWidth}px`);\n /* eslint no-underscore-dangle: [\"error\", { \"allow\": [\"_clientLeft\"] }] */\n sb._clientLeft = sb.$disableButtonEl[0].clientLeft;\n sb.$disableButtonEl.transition('');\n sb.disableButtonHasMargin = true;\n }\n enable(setFocus) {\n const sb = this;\n if (sb.enabled) return sb;\n const app = sb.app;\n const document = getDocument();\n const device = getDevice();\n sb.enabled = true;\n function enable() {\n if (sb.$backdropEl && (sb.$searchContainer && sb.$searchContainer.length || sb.params.customSearch) && !sb.$el.hasClass('searchbar-enabled') && !sb.query) {\n sb.backdropShow();\n }\n sb.$el.addClass('searchbar-enabled');\n if (!sb.$disableButtonEl || sb.$disableButtonEl && sb.$disableButtonEl.length === 0) {\n sb.$el.addClass('searchbar-enabled-no-disable-button');\n }\n if (!sb.expandable && sb.$disableButtonEl && sb.$disableButtonEl.length > 0 && app.theme !== 'md') {\n if (!sb.disableButtonHasMargin) {\n sb.setDisableButtonMargin();\n }\n sb.$disableButtonEl.css(`margin-${app.rtl ? 'left' : 'right'}`, '0px');\n }\n if (sb.expandable) {\n const $navbarEl = sb.$el.parents('.navbar');\n if ($navbarEl.hasClass('navbar-large') && sb.$pageEl) {\n const $pageContentEl = sb.$pageEl.find('.page-content');\n const $titleLargeEl = $navbarEl.find('.title-large');\n $pageContentEl.addClass('with-searchbar-expandable-enabled');\n if ($navbarEl.hasClass('navbar-large') && $navbarEl.hasClass('navbar-large-collapsed') && $titleLargeEl.length && $pageContentEl.length) {\n $pageContentEl.transition(0);\n $pageContentEl[0].scrollTop -= $titleLargeEl[0].offsetHeight;\n setTimeout(() => {\n $pageContentEl.transition('');\n }, 200);\n }\n }\n if (app.theme === 'md' && $navbarEl.length) {\n $navbarEl.addClass('with-searchbar-expandable-enabled');\n } else {\n $navbarEl.addClass('with-searchbar-expandable-enabled');\n if ($navbarEl.hasClass('navbar-large')) {\n $navbarEl.addClass('navbar-large-collapsed');\n }\n }\n }\n if (sb.$hideOnEnableEl) sb.$hideOnEnableEl.addClass('hidden-by-searchbar');\n sb.$el.trigger('searchbar:enable');\n sb.emit('local::enable searchbarEnable', sb);\n }\n let needsFocus = false;\n if (setFocus === true) {\n if (document.activeElement !== sb.inputEl) {\n needsFocus = true;\n }\n }\n const isIos = device.ios && app.theme === 'ios';\n if (isIos) {\n if (sb.expandable) {\n if (needsFocus) sb.$inputEl.focus();\n enable();\n } else {\n if (needsFocus) sb.$inputEl.focus();\n if (setFocus && (setFocus.type === 'focus' || setFocus === true)) {\n nextTick(() => {\n enable();\n }, 400);\n } else {\n enable();\n }\n }\n } else {\n if (needsFocus) sb.$inputEl.focus();\n if (app.theme === 'md' && sb.expandable) {\n sb.$el.parents('.page, .view, .navbar-inner, .navbar').scrollLeft(app.rtl ? 100 : 0);\n }\n enable();\n }\n return sb;\n }\n disable() {\n const sb = this;\n if (!sb.enabled) return sb;\n const app = sb.app;\n sb.$inputEl.val('').trigger('change');\n sb.$el.removeClass('searchbar-enabled searchbar-focused searchbar-enabled-no-disable-button');\n if (sb.expandable) {\n const $navbarEl = sb.$el.parents('.navbar');\n const $pageContentEl = sb.$pageEl && sb.$pageEl.find('.page-content');\n if ($navbarEl.hasClass('navbar-large') && $pageContentEl.length) {\n const $titleLargeEl = $navbarEl.find('.title-large');\n sb.$el.transitionEnd(() => {\n $pageContentEl.removeClass('with-searchbar-expandable-closing');\n });\n if ($navbarEl.hasClass('navbar-large') && $navbarEl.hasClass('navbar-large-collapsed') && $titleLargeEl.length) {\n const scrollTop = $pageContentEl[0].scrollTop;\n const titleLargeHeight = $titleLargeEl[0].offsetHeight;\n if (scrollTop > titleLargeHeight) {\n $pageContentEl.transition(0);\n $pageContentEl[0].scrollTop = scrollTop + titleLargeHeight;\n setTimeout(() => {\n $pageContentEl.transition('');\n }, 200);\n }\n }\n $pageContentEl.removeClass('with-searchbar-expandable-enabled').addClass('with-searchbar-expandable-closing');\n }\n if (app.theme === 'md' && $navbarEl.length) {\n $navbarEl.removeClass('with-searchbar-expandable-enabled with-searchbar-expandable-enabled-no-transition').addClass('with-searchbar-expandable-closing');\n sb.$el.transitionEnd(() => {\n $navbarEl.removeClass('with-searchbar-expandable-closing');\n });\n } else {\n $navbarEl.removeClass('with-searchbar-expandable-enabled with-searchbar-expandable-enabled-no-transition').addClass('with-searchbar-expandable-closing');\n sb.$el.transitionEnd(() => {\n $navbarEl.removeClass('with-searchbar-expandable-closing');\n });\n if (sb.$pageEl) {\n sb.$pageEl.find('.page-content').trigger('scroll');\n }\n }\n }\n if (!sb.expandable && sb.$disableButtonEl && sb.$disableButtonEl.length > 0 && app.theme !== 'md') {\n sb.$disableButtonEl.css(`margin-${app.rtl ? 'left' : 'right'}`, `${-sb.disableButtonEl.offsetWidth}px`);\n }\n if (sb.$backdropEl && (sb.$searchContainer && sb.$searchContainer.length || sb.params.customSearch)) {\n sb.backdropHide();\n }\n sb.enabled = false;\n sb.$inputEl.blur();\n if (sb.$hideOnEnableEl) sb.$hideOnEnableEl.removeClass('hidden-by-searchbar');\n sb.$el.trigger('searchbar:disable');\n sb.emit('local::disable searchbarDisable', sb);\n return sb;\n }\n toggle() {\n const sb = this;\n if (sb.enabled) sb.disable();else sb.enable(true);\n return sb;\n }\n backdropShow() {\n const sb = this;\n if (sb.$backdropEl) {\n sb.$backdropEl.addClass('searchbar-backdrop-in');\n }\n return sb;\n }\n backdropHide() {\n const sb = this;\n if (sb.$backdropEl) {\n sb.$backdropEl.removeClass('searchbar-backdrop-in');\n }\n return sb;\n }\n search(query, internal) {\n const sb = this;\n sb.previousQuery = sb.query || '';\n if (query === sb.previousQuery) return sb;\n if (!internal) {\n if (!sb.enabled) {\n sb.enable();\n }\n sb.$inputEl.val(query);\n sb.$inputEl.trigger('input');\n }\n sb.query = query;\n sb.value = query;\n const {\n $searchContainer,\n $el,\n $foundEl,\n $notFoundEl,\n $hideOnSearchEl,\n isVirtualList\n } = sb;\n\n // Hide on search element\n if (query.length > 0 && $hideOnSearchEl) {\n $hideOnSearchEl.addClass('hidden-by-searchbar');\n } else if ($hideOnSearchEl) {\n $hideOnSearchEl.removeClass('hidden-by-searchbar');\n }\n // Add active/inactive classes on overlay\n if ($searchContainer && $searchContainer.length && $el.hasClass('searchbar-enabled') || sb.params.customSearch && $el.hasClass('searchbar-enabled')) {\n if (query.length === 0) {\n sb.backdropShow();\n } else {\n sb.backdropHide();\n }\n }\n if (sb.params.customSearch) {\n $el.trigger('searchbar:search', {\n query,\n previousQuery: sb.previousQuery\n });\n sb.emit('local::search searchbarSearch', sb, query, sb.previousQuery);\n return sb;\n }\n let foundItems = [];\n let vlQuery;\n if (isVirtualList) {\n sb.virtualList = $searchContainer[0].f7VirtualList;\n if (query.trim() === '') {\n sb.virtualList.resetFilter();\n if ($notFoundEl) $notFoundEl.hide();\n if ($foundEl) $foundEl.show();\n $el.trigger('searchbar:search', {\n query,\n previousQuery: sb.previousQuery\n });\n sb.emit('local::search searchbarSearch', sb, query, sb.previousQuery);\n return sb;\n }\n vlQuery = sb.params.removeDiacritics ? removeDiacritics(query) : query;\n if (sb.virtualList.params.searchAll) {\n foundItems = sb.virtualList.params.searchAll(vlQuery, sb.virtualList.items) || [];\n } else if (sb.virtualList.params.searchByItem) {\n for (let i = 0; i < sb.virtualList.items.length; i += 1) {\n if (sb.virtualList.params.searchByItem(vlQuery, sb.virtualList.items[i], i)) {\n foundItems.push(i);\n }\n }\n }\n } else {\n let values;\n if (sb.params.removeDiacritics) values = removeDiacritics(query.trim().toLowerCase()).split(' ');else {\n values = query.trim().toLowerCase().split(' ');\n }\n $searchContainer.find(sb.params.searchItem).removeClass('hidden-by-searchbar').each(itemEl => {\n const $itemEl = $(itemEl);\n let compareWithText = [];\n let $searchIn = sb.params.searchIn ? $itemEl.find(sb.params.searchIn) : $itemEl;\n if (sb.params.searchIn === sb.params.searchItem) {\n $searchIn = $itemEl;\n }\n $searchIn.each(searchInEl => {\n let itemText = $(searchInEl).text().trim().toLowerCase();\n if (sb.params.removeDiacritics) itemText = removeDiacritics(itemText);\n compareWithText.push(itemText);\n });\n compareWithText = compareWithText.join(' ');\n let wordsMatch = 0;\n for (let i = 0; i < values.length; i += 1) {\n if (compareWithText.indexOf(values[i]) >= 0) wordsMatch += 1;\n }\n if (wordsMatch !== values.length && !(sb.params.ignore && $itemEl.is(sb.params.ignore))) {\n $itemEl.addClass('hidden-by-searchbar');\n } else {\n foundItems.push($itemEl[0]);\n }\n });\n if (sb.params.hideGroupTitles) {\n $searchContainer.find(sb.params.searchGroupTitle).each(titleEl => {\n const $titleEl = $(titleEl);\n const $nextElements = $titleEl.nextAll(sb.params.searchItem);\n let hide = true;\n for (let i = 0; i < $nextElements.length; i += 1) {\n const $nextEl = $nextElements.eq(i);\n if ($nextEl.is(sb.params.searchGroupTitle)) break;\n if (!$nextEl.hasClass('hidden-by-searchbar')) {\n hide = false;\n }\n }\n const ignore = sb.params.ignore && $titleEl.is(sb.params.ignore);\n if (hide && !ignore) $titleEl.addClass('hidden-by-searchbar');else $titleEl.removeClass('hidden-by-searchbar');\n });\n }\n if (sb.params.hideGroups) {\n $searchContainer.find(sb.params.searchGroup).each(groupEl => {\n const $groupEl = $(groupEl);\n const ignore = sb.params.ignore && $groupEl.is(sb.params.ignore);\n // eslint-disable-next-line\n const notHidden = $groupEl.find(sb.params.searchItem).filter(el => {\n return !$(el).hasClass('hidden-by-searchbar');\n });\n if (notHidden.length === 0 && !ignore) {\n $groupEl.addClass('hidden-by-searchbar');\n } else {\n $groupEl.removeClass('hidden-by-searchbar');\n }\n });\n }\n }\n if (foundItems.length === 0) {\n if ($notFoundEl) $notFoundEl.show();\n if ($foundEl) $foundEl.hide();\n } else {\n if ($notFoundEl) $notFoundEl.hide();\n if ($foundEl) $foundEl.show();\n }\n if (isVirtualList && sb.virtualList) {\n sb.virtualList.filterItems(foundItems);\n }\n $el.trigger('searchbar:search', {\n query,\n previousQuery: sb.previousQuery,\n foundItems\n });\n sb.emit('local::search searchbarSearch', sb, query, sb.previousQuery, foundItems);\n return sb;\n }\n init() {\n const sb = this;\n if (sb.expandable && sb.$el) sb.$el.addClass('searchbar-expandable');\n if (sb.inline && sb.$el) sb.$el.addClass('searchbar-inline');\n sb.attachEvents();\n }\n destroy() {\n const sb = this;\n sb.emit('local::beforeDestroy searchbarBeforeDestroy', sb);\n sb.$el.trigger('searchbar:beforedestroy');\n sb.detachEvents();\n if (sb.$el[0]) {\n sb.$el[0].f7Searchbar = null;\n delete sb.$el[0].f7Searchbar;\n }\n deleteProps(sb);\n }\n}\nexport default Searchbar;", "import $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nimport Searchbar from './searchbar-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'searchbar',\n static: {\n Searchbar\n },\n create() {\n const app = this;\n app.searchbar = ConstructorMethods({\n defaultSelector: '.searchbar',\n constructor: Searchbar,\n app,\n domProp: 'f7Searchbar',\n addMethods: 'clear enable disable toggle search'.split(' ')\n });\n },\n on: {\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.searchbar-init').each(searchbarEl => {\n const $searchbarEl = $(searchbarEl);\n app.searchbar.create(extend($searchbarEl.dataset(), {\n el: searchbarEl\n }));\n });\n },\n tabBeforeRemove(tabEl) {\n $(tabEl).find('.searchbar-init').each(searchbarEl => {\n if (searchbarEl.f7Searchbar && searchbarEl.f7Searchbar.destroy) {\n searchbarEl.f7Searchbar.destroy();\n }\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.searchbar-init').each(searchbarEl => {\n const $searchbarEl = $(searchbarEl);\n app.searchbar.create(extend($searchbarEl.dataset(), {\n el: searchbarEl\n }));\n });\n if (app.theme === 'ios' && page.view && page.view.router.dynamicNavbar && page.$navbarEl && page.$navbarEl.length > 0) {\n page.$navbarEl.find('.searchbar-init').each(searchbarEl => {\n const $searchbarEl = $(searchbarEl);\n app.searchbar.create(extend($searchbarEl.dataset(), {\n el: searchbarEl\n }));\n });\n }\n },\n pageBeforeRemove(page) {\n const app = this;\n page.$el.find('.searchbar-init').each(searchbarEl => {\n if (searchbarEl.f7Searchbar && searchbarEl.f7Searchbar.destroy) {\n searchbarEl.f7Searchbar.destroy();\n }\n });\n if (app.theme === 'ios' && page.view && page.view.router.dynamicNavbar && page.$navbarEl && page.$navbarEl.length > 0) {\n page.$navbarEl.find('.searchbar-init').each(searchbarEl => {\n if (searchbarEl.f7Searchbar && searchbarEl.f7Searchbar.destroy) {\n searchbarEl.f7Searchbar.destroy();\n }\n });\n }\n }\n },\n clicks: {\n '.searchbar-clear': function clear($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n const sb = app.searchbar.get(data.searchbar);\n if (sb) sb.clear();\n },\n '.searchbar-enable': function enable($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n const sb = app.searchbar.get(data.searchbar);\n if (sb) sb.enable(true);\n },\n '.searchbar-disable': function disable($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n const sb = app.searchbar.get(data.searchbar);\n if (sb) sb.disable();\n },\n '.searchbar-toggle': function toggle($clickedEl, data) {\n if (data === void 0) {\n data = {};\n }\n const app = this;\n const sb = app.searchbar.get(data.searchbar);\n if (sb) sb.toggle();\n }\n },\n vnode: {\n 'searchbar-init': {\n insert(vnode) {\n const app = this;\n const searchbarEl = vnode.elm;\n const $searchbarEl = $(searchbarEl);\n app.searchbar.create(extend($searchbarEl.dataset(), {\n el: searchbarEl\n }));\n },\n destroy(vnode) {\n const searchbarEl = vnode.elm;\n if (searchbarEl.f7Searchbar && searchbarEl.f7Searchbar.destroy) {\n searchbarEl.f7Searchbar.destroy();\n }\n }\n }\n }\n};", "function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nimport $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass Messages extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const m = this;\n const defaults = {\n autoLayout: true,\n messages: [],\n newMessagesFirst: false,\n scrollMessages: true,\n scrollMessagesOnEdge: true,\n firstMessageRule: undefined,\n lastMessageRule: undefined,\n tailMessageRule: undefined,\n sameNameMessageRule: undefined,\n sameHeaderMessageRule: undefined,\n sameFooterMessageRule: undefined,\n sameAvatarMessageRule: undefined,\n customClassMessageRule: undefined,\n renderMessage: undefined\n };\n\n // Extend defaults with modules params\n m.useModulesParams(defaults);\n m.params = extend(defaults, params);\n const $el = $(params.el).eq(0);\n if ($el.length === 0) return m;\n if ($el[0].f7Messages) return $el[0].f7Messages;\n $el[0].f7Messages = m;\n const $pageContentEl = $el.closest('.page-content').eq(0);\n extend(m, {\n messages: m.params.messages,\n $el,\n el: $el[0],\n $pageContentEl,\n pageContentEl: $pageContentEl[0]\n });\n // Install Modules\n m.useModules();\n\n // Init\n m.init();\n return m;\n }\n // eslint-disable-next-line\n getMessageData(messageEl) {\n const $messageEl = $(messageEl);\n const data = {\n name: $messageEl.find('.message-name').html(),\n header: $messageEl.find('.message-header').html(),\n textHeader: $messageEl.find('.message-text-header').html(),\n textFooter: $messageEl.find('.message-text-footer').html(),\n footer: $messageEl.find('.message-footer').html(),\n isTitle: $messageEl.hasClass('messages-title'),\n type: $messageEl.hasClass('message-sent') ? 'sent' : 'received',\n text: $messageEl.find('.message-text').html(),\n image: $messageEl.find('.message-image').html(),\n imageSrc: $messageEl.find('.message-image img').attr('src'),\n typing: $messageEl.hasClass('message-typing')\n };\n if (data.isTitle) {\n data.text = $messageEl.html();\n }\n if (data.text && data.textHeader) {\n data.text = data.text.replace(``, '');\n }\n if (data.text && data.textFooter) {\n data.text = data.text.replace(``, '');\n }\n let avatar = $messageEl.find('.message-avatar').css('background-image');\n if (avatar === 'none' || avatar === '') avatar = undefined;\n if (avatar && typeof avatar === 'string') {\n avatar = avatar.replace('url(', '').replace(')', '').replace(/\"/g, '').replace(/'/g, '');\n } else {\n avatar = undefined;\n }\n data.avatar = avatar;\n return data;\n }\n getMessagesData() {\n const m = this;\n const data = [];\n m.$el.find('.message, .messages-title').each(messageEl => {\n data.push(m.getMessageData(messageEl));\n });\n return data;\n }\n renderMessage(messageToRender) {\n const m = this;\n const message = extend({\n type: 'sent',\n attrs: {}\n }, messageToRender);\n if (m.params.renderMessage) {\n return m.params.renderMessage.call(m, message);\n }\n if (message.isTitle) {\n return `${message.text}
`;\n }\n return $jsx(\"div\", _extends({\n class: `message message-${message.type} ${message.isTyping ? 'message-typing' : ''} ${message.cssClass || ''}`\n }, message.attrs), message.avatar && $jsx(\"div\", {\n class: \"message-avatar\",\n style: `background-image:url(${message.avatar})`\n }), $jsx(\"div\", {\n class: \"message-content\"\n }, message.name && $jsx(\"div\", {\n class: \"message-name\"\n }, message.name), message.header && $jsx(\"div\", {\n class: \"message-header\"\n }, message.header), $jsx(\"div\", {\n class: \"message-bubble\"\n }, message.textHeader && $jsx(\"div\", {\n class: \"message-text-header\"\n }, message.textHeader), message.image && $jsx(\"div\", {\n class: \"message-image\"\n }, message.image), message.imageSrc && !message.image && $jsx(\"div\", {\n class: \"message-image\"\n }, $jsx(\"img\", {\n src: message.imageSrc\n })), (message.text || message.isTyping) && $jsx(\"div\", {\n class: \"message-text\"\n }, message.text || '', message.isTyping && $jsx(\"div\", {\n class: \"message-typing-indicator\"\n }, $jsx(\"div\", null), $jsx(\"div\", null), $jsx(\"div\", null))), message.textFooter && $jsx(\"div\", {\n class: \"message-text-footer\"\n }, message.textFooter)), message.footer && $jsx(\"div\", {\n class: \"message-footer\"\n }, message.footer)));\n }\n renderMessages(messagesToRender, method) {\n if (messagesToRender === void 0) {\n messagesToRender = this.messages;\n }\n if (method === void 0) {\n method = this.params.newMessagesFirst ? 'prepend' : 'append';\n }\n const m = this;\n const html = messagesToRender.map(message => m.renderMessage(message)).join('');\n m.$el[method](html);\n }\n isFirstMessage() {\n const m = this;\n if (m.params.firstMessageRule) return m.params.firstMessageRule(...arguments);\n return false;\n }\n isLastMessage() {\n const m = this;\n if (m.params.lastMessageRule) return m.params.lastMessageRule(...arguments);\n return false;\n }\n isTailMessage() {\n const m = this;\n if (m.params.tailMessageRule) return m.params.tailMessageRule(...arguments);\n return false;\n }\n isSameNameMessage() {\n const m = this;\n if (m.params.sameNameMessageRule) return m.params.sameNameMessageRule(...arguments);\n return false;\n }\n isSameHeaderMessage() {\n const m = this;\n if (m.params.sameHeaderMessageRule) return m.params.sameHeaderMessageRule(...arguments);\n return false;\n }\n isSameFooterMessage() {\n const m = this;\n if (m.params.sameFooterMessageRule) return m.params.sameFooterMessageRule(...arguments);\n return false;\n }\n isSameAvatarMessage() {\n const m = this;\n if (m.params.sameAvatarMessageRule) return m.params.sameAvatarMessageRule(...arguments);\n return false;\n }\n isCustomClassMessage() {\n const m = this;\n if (m.params.customClassMessageRule) return m.params.customClassMessageRule(...arguments);\n return undefined;\n }\n layout() {\n const m = this;\n m.$el.find('.message, .messages-title').each((messageEl, index) => {\n const $messageEl = $(messageEl);\n if (!m.messages) {\n m.messages = m.getMessagesData();\n }\n const classes = [];\n const message = m.messages[index];\n const previousMessage = m.messages[index - 1];\n const nextMessage = m.messages[index + 1];\n if (m.isFirstMessage(message, previousMessage, nextMessage)) {\n classes.push('message-first');\n }\n if (m.isLastMessage(message, previousMessage, nextMessage)) {\n classes.push('message-last');\n }\n if (m.isTailMessage(message, previousMessage, nextMessage)) {\n classes.push('message-tail');\n }\n if (m.isSameNameMessage(message, previousMessage, nextMessage)) {\n classes.push('message-same-name');\n }\n if (m.isSameHeaderMessage(message, previousMessage, nextMessage)) {\n classes.push('message-same-header');\n }\n if (m.isSameFooterMessage(message, previousMessage, nextMessage)) {\n classes.push('message-same-footer');\n }\n if (m.isSameAvatarMessage(message, previousMessage, nextMessage)) {\n classes.push('message-same-avatar');\n }\n let customMessageClasses = m.isCustomClassMessage(message, previousMessage, nextMessage);\n if (customMessageClasses && customMessageClasses.length) {\n if (typeof customMessageClasses === 'string') {\n customMessageClasses = customMessageClasses.split(' ');\n }\n customMessageClasses.forEach(customClass => {\n classes.push(customClass);\n });\n }\n $messageEl.removeClass('message-first message-last message-tail message-same-name message-same-header message-same-footer message-same-avatar');\n classes.forEach(className => {\n $messageEl.addClass(className);\n });\n });\n }\n clear() {\n const m = this;\n m.messages = [];\n m.$el.html('');\n }\n removeMessage(messageToRemove, layout) {\n if (layout === void 0) {\n layout = true;\n }\n const m = this;\n // Index or El\n let index;\n let $el;\n if (typeof messageToRemove === 'number') {\n index = messageToRemove;\n $el = m.$el.find('.message, .messages-title').eq(index);\n } else if (m.messages && m.messages.indexOf(messageToRemove) >= 0) {\n index = m.messages.indexOf(messageToRemove);\n $el = m.$el.children().eq(index);\n } else {\n $el = $(messageToRemove);\n index = $el.index();\n }\n if ($el.length === 0) {\n return m;\n }\n $el.remove();\n m.messages.splice(index, 1);\n if (m.params.autoLayout && layout) m.layout();\n return m;\n }\n removeMessages(messagesToRemove, layout) {\n if (layout === void 0) {\n layout = true;\n }\n const m = this;\n if (Array.isArray(messagesToRemove)) {\n const messagesToRemoveEls = [];\n messagesToRemove.forEach(messageToRemoveIndex => {\n messagesToRemoveEls.push(m.$el.find('.message, .messages-title').eq(messageToRemoveIndex));\n });\n messagesToRemoveEls.forEach(messageToRemove => {\n m.removeMessage(messageToRemove, false);\n });\n } else {\n $(messagesToRemove).each(messageToRemove => {\n m.removeMessage(messageToRemove, false);\n });\n }\n if (m.params.autoLayout && layout) m.layout();\n return m;\n }\n addMessage() {\n const m = this;\n let messageToAdd;\n let animate;\n let method;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (typeof args[1] === 'boolean') {\n [messageToAdd, animate, method] = args;\n } else {\n [messageToAdd, method, animate] = args;\n }\n if (typeof animate === 'undefined') {\n animate = true;\n }\n if (typeof method === 'undefined') {\n method = m.params.newMessagesFirst ? 'prepend' : 'append';\n }\n return m.addMessages([messageToAdd], animate, method);\n }\n setScrollData() {\n const m = this;\n // Define scroll positions before new messages added\n const scrollHeightBefore = m.pageContentEl.scrollHeight;\n const heightBefore = m.pageContentEl.offsetHeight;\n const scrollBefore = m.pageContentEl.scrollTop;\n m.scrollData = {\n scrollHeightBefore,\n heightBefore,\n scrollBefore\n };\n return {\n scrollHeightBefore,\n heightBefore,\n scrollBefore\n };\n }\n addMessages() {\n const m = this;\n let messagesToAdd;\n let animate;\n let method;\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n if (typeof args[1] === 'boolean') {\n [messagesToAdd, animate, method] = args;\n } else {\n [messagesToAdd, method, animate] = args;\n }\n if (typeof animate === 'undefined') {\n animate = true;\n }\n if (typeof method === 'undefined') {\n method = m.params.newMessagesFirst ? 'prepend' : 'append';\n }\n const {\n scrollHeightBefore,\n scrollBefore\n } = m.setScrollData();\n\n // Add message to DOM and data\n let messagesHTML = '';\n const typingMessage = m.messages.filter(el => el.isTyping)[0];\n messagesToAdd.forEach(messageToAdd => {\n if (typingMessage) {\n if (method === 'append') {\n m.messages.splice(m.messages.indexOf(typingMessage), 0, messageToAdd);\n } else {\n m.messages.splice(m.messages.indexOf(typingMessage) + 1, 0, messageToAdd);\n }\n } else {\n m.messages[method === 'append' ? 'push' : 'unshift'](messageToAdd);\n }\n messagesHTML += m.renderMessage(messageToAdd);\n });\n const $messagesEls = $(messagesHTML);\n if (animate) {\n if (method === 'append' && !m.params.newMessagesFirst) {\n $messagesEls.addClass('message-appear-from-bottom');\n }\n if (method === 'prepend' && m.params.newMessagesFirst) {\n $messagesEls.addClass('message-appear-from-top');\n }\n }\n if (typingMessage) {\n if (method === 'append') {\n $messagesEls.insertBefore(m.$el.find('.message-typing'));\n } else {\n $messagesEls.insertAfter(m.$el.find('.message-typing'));\n }\n } else {\n m.$el[method]($messagesEls);\n }\n\n // Layout\n if (m.params.autoLayout) m.layout();\n if (method === 'prepend' && !typingMessage) {\n m.pageContentEl.scrollTop = scrollBefore + (m.pageContentEl.scrollHeight - scrollHeightBefore);\n }\n if (m.params.scrollMessages && (method === 'append' && !m.params.newMessagesFirst || method === 'prepend' && m.params.newMessagesFirst && !typingMessage)) {\n m.scrollWithEdgeCheck(animate);\n }\n return m;\n }\n showTyping(message) {\n if (message === void 0) {\n message = {};\n }\n const m = this;\n const typingMessage = m.messages.filter(el => el.isTyping)[0];\n if (typingMessage) {\n m.removeMessage(m.messages.indexOf(typingMessage));\n }\n m.addMessage(extend({\n type: 'received',\n isTyping: true\n }, message));\n return m;\n }\n hideTyping() {\n const m = this;\n let typingMessageIndex;\n let typingFound;\n m.messages.forEach((message, index) => {\n if (message.isTyping) typingMessageIndex = index;\n });\n if (typeof typingMessageIndex !== 'undefined') {\n if (m.$el.find('.message').eq(typingMessageIndex).hasClass('message-typing')) {\n typingFound = true;\n m.removeMessage(typingMessageIndex);\n }\n }\n if (!typingFound) {\n const $typingMessageEl = m.$el.find('.message-typing');\n if ($typingMessageEl.length) {\n m.removeMessage($typingMessageEl);\n }\n }\n return m;\n }\n scrollWithEdgeCheck(animate) {\n const m = this;\n const {\n scrollBefore,\n scrollHeightBefore,\n heightBefore\n } = m.scrollData;\n if (m.params.scrollMessagesOnEdge) {\n let onEdge = false;\n if (m.params.newMessagesFirst && scrollBefore === 0) {\n onEdge = true;\n }\n if (!m.params.newMessagesFirst && scrollBefore - (scrollHeightBefore - heightBefore) >= -10) {\n onEdge = true;\n }\n if (onEdge) m.scroll(animate ? undefined : 0);\n } else {\n m.scroll(animate ? undefined : 0);\n }\n }\n scroll(duration, scrollTop) {\n if (duration === void 0) {\n duration = 300;\n }\n const m = this;\n const currentScroll = m.pageContentEl.scrollTop;\n let newScrollTop;\n if (typeof scrollTop !== 'undefined') newScrollTop = scrollTop;else {\n newScrollTop = m.params.newMessagesFirst ? 0 : m.pageContentEl.scrollHeight - m.pageContentEl.offsetHeight;\n if (newScrollTop === currentScroll) return m;\n }\n m.$pageContentEl.scrollTop(newScrollTop, duration);\n return m;\n }\n init() {\n const m = this;\n if (!m.messages || m.messages.length === 0) {\n m.messages = m.getMessagesData();\n }\n if (m.params.messages && m.params.messages.length) {\n m.renderMessages();\n }\n if (m.params.autoLayout) m.layout();\n if (m.params.scrollMessages) m.scroll(0);\n }\n destroy() {\n const m = this;\n m.emit('local::beforeDestroy messagesBeforeDestroy', m);\n m.$el.trigger('messages:beforedestroy');\n if (m.$el[0]) {\n m.$el[0].f7Messages = null;\n delete m.$el[0].f7Messages;\n }\n deleteProps(m);\n }\n}\nexport default Messages;", "import $ from '../../shared/dom7.js';\nimport Messages from './messages-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'messages',\n static: {\n Messages\n },\n create() {\n const app = this;\n app.messages = ConstructorMethods({\n defaultSelector: '.messages',\n constructor: Messages,\n app,\n domProp: 'f7Messages',\n addMethods: 'renderMessages layout scroll clear removeMessage removeMessages addMessage addMessages'.split(' ')\n });\n },\n on: {\n tabBeforeRemove(tabEl) {\n const app = this;\n $(tabEl).find('.messages-init').each(messagesEl => {\n app.messages.destroy(messagesEl);\n });\n },\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.messages-init').each(messagesEl => {\n app.messages.create({\n el: messagesEl\n });\n });\n },\n pageBeforeRemove(page) {\n const app = this;\n page.$el.find('.messages-init').each(messagesEl => {\n app.messages.destroy(messagesEl);\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.messages-init').each(messagesEl => {\n app.messages.create({\n el: messagesEl\n });\n });\n }\n },\n vnode: {\n 'messages-init': {\n insert(vnode) {\n const app = this;\n const messagesEl = vnode.elm;\n app.messages.create({\n el: messagesEl\n });\n },\n destroy(vnode) {\n const app = this;\n const messagesEl = vnode.elm;\n app.messages.destroy(messagesEl);\n }\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\nclass Messagebar extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const messagebar = this;\n const defaults = {\n top: false,\n topOffset: 0,\n bottomOffset: 0,\n attachments: [],\n renderAttachments: undefined,\n renderAttachment: undefined,\n maxHeight: null,\n resizePage: true\n };\n\n // Extend defaults with modules params\n messagebar.useModulesParams(defaults);\n messagebar.params = extend(defaults, params);\n\n // El\n const $el = $(messagebar.params.el);\n if ($el.length === 0) return messagebar;\n if ($el[0].f7Messagebar) return $el[0].f7Messagebar;\n $el[0].f7Messagebar = messagebar;\n\n // Page and PageContent\n const $pageEl = $el.parents('.page').eq(0);\n const $pageContentEl = $pageEl.find('.page-content').eq(0);\n\n // Area\n const $areaEl = $el.find('.messagebar-area');\n\n // Textarea\n let $textareaEl;\n if (messagebar.params.textareaEl) {\n $textareaEl = $(messagebar.params.textareaEl);\n } else {\n $textareaEl = $el.find('textarea');\n }\n\n // Attachments & Library\n const $attachmentsEl = $el.find('.messagebar-attachments');\n const $sheetEl = $el.find('.messagebar-sheet');\n if (messagebar.params.top) {\n $el.addClass('messagebar-top');\n }\n extend(messagebar, {\n $el,\n el: $el[0],\n $areaEl,\n areaEl: $areaEl[0],\n $textareaEl,\n textareaEl: $textareaEl[0],\n $attachmentsEl,\n attachmentsEl: $attachmentsEl[0],\n attachmentsVisible: $attachmentsEl.hasClass('messagebar-attachments-visible'),\n $sheetEl,\n sheetEl: $sheetEl[0],\n sheetVisible: $sheetEl.hasClass('messagebar-sheet-visible'),\n $pageEl,\n pageEl: $pageEl[0],\n $pageContentEl,\n pageContentEl: $pageContentEl,\n top: $el.hasClass('messagebar-top') || messagebar.params.top,\n attachments: []\n });\n\n // Events\n function onAppResize() {\n if (messagebar.params.resizePage) {\n messagebar.resizePage();\n }\n }\n function onSubmit(e) {\n e.preventDefault();\n }\n function onAttachmentClick(e) {\n const index = $(this).index();\n if ($(e.target).closest('.messagebar-attachment-delete').length) {\n $(this).trigger('messagebar:attachmentdelete', index);\n messagebar.emit('local::attachmentDelete messagebarAttachmentDelete', messagebar, this, index);\n } else {\n $(this).trigger('messagebar:attachmentclick', index);\n messagebar.emit('local::attachmentClick messagebarAttachmentClick', messagebar, this, index);\n }\n }\n function onTextareaChange() {\n messagebar.checkEmptyState();\n messagebar.$el.trigger('messagebar:change');\n messagebar.emit('local::change messagebarChange', messagebar);\n }\n function onTextareaFocus() {\n messagebar.sheetHide();\n messagebar.$el.addClass('messagebar-focused');\n messagebar.$el.trigger('messagebar:focus');\n messagebar.emit('local::focus messagebarFocus', messagebar);\n }\n function onTextareaBlur() {\n messagebar.$el.removeClass('messagebar-focused');\n messagebar.$el.trigger('messagebar:blur');\n messagebar.emit('local::blur messagebarBlur', messagebar);\n }\n messagebar.attachEvents = function attachEvents() {\n $el.on('textarea:resize', onAppResize);\n $el.on('submit', onSubmit);\n $el.on('click', '.messagebar-attachment', onAttachmentClick);\n $textareaEl.on('change input', onTextareaChange);\n $textareaEl.on('focus', onTextareaFocus);\n $textareaEl.on('blur', onTextareaBlur);\n app.on('resize', onAppResize);\n };\n messagebar.detachEvents = function detachEvents() {\n $el.off('textarea:resize', onAppResize);\n $el.off('submit', onSubmit);\n $el.off('click', '.messagebar-attachment', onAttachmentClick);\n $textareaEl.off('change input', onTextareaChange);\n $textareaEl.off('focus', onTextareaFocus);\n $textareaEl.off('blur', onTextareaBlur);\n app.off('resize', onAppResize);\n };\n\n // Install Modules\n messagebar.useModules();\n\n // Init\n messagebar.init();\n return messagebar;\n }\n focus() {\n const messagebar = this;\n messagebar.$textareaEl.focus();\n return messagebar;\n }\n blur() {\n const messagebar = this;\n messagebar.$textareaEl.blur();\n return messagebar;\n }\n clear() {\n const messagebar = this;\n messagebar.$textareaEl.val('').trigger('change');\n return messagebar;\n }\n getValue() {\n const messagebar = this;\n return messagebar.$textareaEl.val().trim();\n }\n setValue(value) {\n const messagebar = this;\n messagebar.$textareaEl.val(value).trigger('change');\n return messagebar;\n }\n setPlaceholder(placeholder) {\n const messagebar = this;\n messagebar.$textareaEl.attr('placeholder', placeholder);\n return messagebar;\n }\n resizePage() {\n const messagebar = this;\n const {\n params,\n $el,\n top,\n $pageEl,\n $pageContentEl,\n $areaEl,\n $textareaEl,\n $sheetEl,\n $attachmentsEl\n } = messagebar;\n const elHeight = $el[0].offsetHeight;\n let maxHeight = params.maxHeight;\n if (top) {\n /*\n Disable at the moment\n const requiredPaddingTop = elHeight + params.topOffset;\n const currentPaddingTop = parseInt($pageContentEl.css('padding-top'), 10);\n if (requiredPaddingTop !== currentPaddingTop) {\n if (!maxHeight) {\n maxHeight = $pageEl[0].offsetHeight - currentPaddingTop - $sheetEl.outerHeight() - $attachmentsEl.outerHeight() - parseInt($areaEl.css('margin-top'), 10) - parseInt($areaEl.css('margin-bottom'), 10);\n }\n $textareaEl.css('max-height', `${maxHeight}px`);\n $pageContentEl.css('padding-top', `${requiredPaddingTop}px`);\n $el.trigger('messagebar:resizePage');\n messagebar.emit('local::resizepage messagebarResizePage');\n }\n */\n } else {\n const currentPaddingBottom = parseInt($pageContentEl.css('padding-bottom'), 10);\n const requiredPaddingBottom = elHeight + params.bottomOffset;\n if (requiredPaddingBottom !== currentPaddingBottom && $pageContentEl.length) {\n const currentPaddingTop = parseInt($pageContentEl.css('padding-top'), 10);\n const pageScrollHeight = $pageContentEl[0].scrollHeight;\n const pageOffsetHeight = $pageContentEl[0].offsetHeight;\n const pageScrollTop = $pageContentEl[0].scrollTop;\n const scrollOnBottom = pageScrollTop === pageScrollHeight - pageOffsetHeight;\n if (!maxHeight) {\n maxHeight = $pageEl[0].offsetHeight - currentPaddingTop - $sheetEl.outerHeight() - $attachmentsEl.outerHeight() - parseInt($areaEl.css('margin-top'), 10) - parseInt($areaEl.css('margin-bottom'), 10);\n }\n $textareaEl.css('max-height', `${maxHeight}px`);\n $pageContentEl.css('padding-bottom', `${requiredPaddingBottom}px`);\n if (scrollOnBottom) {\n $pageContentEl.scrollTop($pageContentEl[0].scrollHeight - pageOffsetHeight);\n }\n $el.trigger('messagebar:resizepage');\n messagebar.emit('local::resizePage messagebarResizePage', messagebar);\n }\n }\n }\n checkEmptyState() {\n const messagebar = this;\n const {\n $el,\n $textareaEl\n } = messagebar;\n const value = $textareaEl.val().trim();\n if (value && value.length) {\n $el.addClass('messagebar-with-value');\n } else {\n $el.removeClass('messagebar-with-value');\n }\n }\n attachmentsCreate(innerHTML) {\n if (innerHTML === void 0) {\n innerHTML = '';\n }\n const messagebar = this;\n const $attachmentsEl = $(`${innerHTML}
`);\n $attachmentsEl.insertBefore(messagebar.$textareaEl);\n extend(messagebar, {\n $attachmentsEl,\n attachmentsEl: $attachmentsEl[0]\n });\n return messagebar;\n }\n attachmentsShow(innerHTML) {\n if (innerHTML === void 0) {\n innerHTML = '';\n }\n const messagebar = this;\n messagebar.$attachmentsEl = messagebar.$el.find('.messagebar-attachments');\n if (messagebar.$attachmentsEl.length === 0) {\n messagebar.attachmentsCreate(innerHTML);\n }\n messagebar.$el.addClass('messagebar-attachments-visible');\n messagebar.attachmentsVisible = true;\n if (messagebar.params.resizePage) {\n messagebar.resizePage();\n }\n return messagebar;\n }\n attachmentsHide() {\n const messagebar = this;\n messagebar.$el.removeClass('messagebar-attachments-visible');\n messagebar.attachmentsVisible = false;\n if (messagebar.params.resizePage) {\n messagebar.resizePage();\n }\n return messagebar;\n }\n attachmentsToggle() {\n const messagebar = this;\n if (messagebar.attachmentsVisible) {\n messagebar.attachmentsHide();\n } else {\n messagebar.attachmentsShow();\n }\n return messagebar;\n }\n renderAttachment(attachment) {\n const messagebar = this;\n if (messagebar.params.renderAttachment) {\n return messagebar.params.renderAttachment.call(messagebar, attachment);\n }\n return `\n \n
\n
\n
\n `;\n }\n renderAttachments() {\n const messagebar = this;\n let html;\n if (messagebar.params.renderAttachments) {\n html = messagebar.params.renderAttachments.call(messagebar, messagebar.attachments);\n } else {\n html = `${messagebar.attachments.map(attachment => messagebar.renderAttachment(attachment)).join('')}`;\n }\n if (messagebar.$attachmentsEl.length === 0) {\n messagebar.attachmentsCreate(html);\n } else {\n messagebar.$attachmentsEl.html(html);\n }\n }\n sheetCreate(innerHTML) {\n if (innerHTML === void 0) {\n innerHTML = '';\n }\n const messagebar = this;\n const $sheetEl = $(`${innerHTML}
`);\n messagebar.$el.append($sheetEl);\n extend(messagebar, {\n $sheetEl,\n sheetEl: $sheetEl[0]\n });\n return messagebar;\n }\n sheetShow(innerHTML) {\n if (innerHTML === void 0) {\n innerHTML = '';\n }\n const messagebar = this;\n messagebar.$sheetEl = messagebar.$el.find('.messagebar-sheet');\n if (messagebar.$sheetEl.length === 0) {\n messagebar.sheetCreate(innerHTML);\n }\n messagebar.$el.addClass('messagebar-sheet-visible');\n messagebar.sheetVisible = true;\n if (messagebar.params.resizePage) {\n messagebar.resizePage();\n }\n return messagebar;\n }\n sheetHide() {\n const messagebar = this;\n messagebar.$el.removeClass('messagebar-sheet-visible');\n messagebar.sheetVisible = false;\n if (messagebar.params.resizePage) {\n messagebar.resizePage();\n }\n return messagebar;\n }\n sheetToggle() {\n const messagebar = this;\n if (messagebar.sheetVisible) {\n messagebar.sheetHide();\n } else {\n messagebar.sheetShow();\n }\n return messagebar;\n }\n init() {\n const messagebar = this;\n messagebar.attachEvents();\n messagebar.checkEmptyState();\n return messagebar;\n }\n destroy() {\n const messagebar = this;\n messagebar.emit('local::beforeDestroy messagebarBeforeDestroy', messagebar);\n messagebar.$el.trigger('messagebar:beforedestroy');\n messagebar.detachEvents();\n if (messagebar.$el[0]) {\n messagebar.$el[0].f7Messagebar = null;\n delete messagebar.$el[0].f7Messagebar;\n }\n deleteProps(messagebar);\n }\n}\nexport default Messagebar;", "import $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nimport Messagebar from './messagebar-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'messagebar',\n static: {\n Messagebar\n },\n create() {\n const app = this;\n app.messagebar = ConstructorMethods({\n defaultSelector: '.messagebar',\n constructor: Messagebar,\n app,\n domProp: 'f7Messagebar',\n addMethods: 'clear getValue setValue setPlaceholder resizePage focus blur attachmentsCreate attachmentsShow attachmentsHide attachmentsToggle renderAttachments sheetCreate sheetShow sheetHide sheetToggle'.split(' ')\n });\n },\n on: {\n tabBeforeRemove(tabEl) {\n const app = this;\n $(tabEl).find('.messagebar-init').each(messagebarEl => {\n app.messagebar.destroy(messagebarEl);\n });\n },\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.messagebar-init').each(messagebarEl => {\n app.messagebar.create(extend({\n el: messagebarEl\n }, $(messagebarEl).dataset()));\n });\n },\n pageBeforeRemove(page) {\n const app = this;\n page.$el.find('.messagebar-init').each(messagebarEl => {\n app.messagebar.destroy(messagebarEl);\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.messagebar-init').each(messagebarEl => {\n app.messagebar.create(extend({\n el: messagebarEl\n }, $(messagebarEl).dataset()));\n });\n }\n },\n vnode: {\n 'messagebar-init': {\n insert(vnode) {\n const app = this;\n const messagebarEl = vnode.elm;\n app.messagebar.create(extend({\n el: messagebarEl\n }, $(messagebarEl).dataset()));\n },\n destroy(vnode) {\n const app = this;\n const messagebarEl = vnode.elm;\n app.messagebar.destroy(messagebarEl);\n }\n }\n }\n};", "/**\n * SSR Window 4.0.2\n * Better handling for window object in SSR environment\n * https://github.com/nolimits4web/ssr-window\n *\n * Copyright 2021, Vladimir Kharlampidi\n *\n * Licensed under MIT\n *\n * Released on: December 13, 2021\n */\n/* eslint-disable no-param-reassign */\nfunction isObject(obj) {\n return obj !== null && typeof obj === 'object' && 'constructor' in obj && obj.constructor === Object;\n}\nfunction extend(target, src) {\n if (target === void 0) {\n target = {};\n }\n if (src === void 0) {\n src = {};\n }\n Object.keys(src).forEach(key => {\n if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) {\n extend(target[key], src[key]);\n }\n });\n}\nconst ssrDocument = {\n body: {},\n addEventListener() {},\n removeEventListener() {},\n activeElement: {\n blur() {},\n nodeName: ''\n },\n querySelector() {\n return null;\n },\n querySelectorAll() {\n return [];\n },\n getElementById() {\n return null;\n },\n createEvent() {\n return {\n initEvent() {}\n };\n },\n createElement() {\n return {\n children: [],\n childNodes: [],\n style: {},\n setAttribute() {},\n getElementsByTagName() {\n return [];\n }\n };\n },\n createElementNS() {\n return {};\n },\n importNode() {\n return null;\n },\n location: {\n hash: '',\n host: '',\n hostname: '',\n href: '',\n origin: '',\n pathname: '',\n protocol: '',\n search: ''\n }\n};\nfunction getDocument() {\n const doc = typeof document !== 'undefined' ? document : {};\n extend(doc, ssrDocument);\n return doc;\n}\nconst ssrWindow = {\n document: ssrDocument,\n navigator: {\n userAgent: ''\n },\n location: {\n hash: '',\n host: '',\n hostname: '',\n href: '',\n origin: '',\n pathname: '',\n protocol: '',\n search: ''\n },\n history: {\n replaceState() {},\n pushState() {},\n go() {},\n back() {}\n },\n CustomEvent: function CustomEvent() {\n return this;\n },\n addEventListener() {},\n removeEventListener() {},\n getComputedStyle() {\n return {\n getPropertyValue() {\n return '';\n }\n };\n },\n Image() {},\n Date() {},\n screen: {},\n setTimeout() {},\n clearTimeout() {},\n matchMedia() {\n return {};\n },\n requestAnimationFrame(callback) {\n if (typeof setTimeout === 'undefined') {\n callback();\n return null;\n }\n return setTimeout(callback, 0);\n },\n cancelAnimationFrame(id) {\n if (typeof setTimeout === 'undefined') {\n return;\n }\n clearTimeout(id);\n }\n};\nfunction getWindow() {\n const win = typeof window !== 'undefined' ? window : {};\n extend(win, ssrWindow);\n return win;\n}\n\nexport { getWindow as a, getDocument as g };\n", "import { a as getWindow, g as getDocument } from './ssr-window.esm.mjs';\n\nfunction deleteProps(obj) {\n const object = obj;\n Object.keys(object).forEach(key => {\n try {\n object[key] = null;\n } catch (e) {\n // no getter for object\n }\n try {\n delete object[key];\n } catch (e) {\n // something got wrong\n }\n });\n}\nfunction nextTick(callback, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n return setTimeout(callback, delay);\n}\nfunction now() {\n return Date.now();\n}\nfunction getComputedStyle(el) {\n const window = getWindow();\n let style;\n if (window.getComputedStyle) {\n style = window.getComputedStyle(el, null);\n }\n if (!style && el.currentStyle) {\n style = el.currentStyle;\n }\n if (!style) {\n style = el.style;\n }\n return style;\n}\nfunction getTranslate(el, axis) {\n if (axis === void 0) {\n axis = 'x';\n }\n const window = getWindow();\n let matrix;\n let curTransform;\n let transformMatrix;\n const curStyle = getComputedStyle(el);\n if (window.WebKitCSSMatrix) {\n curTransform = curStyle.transform || curStyle.webkitTransform;\n if (curTransform.split(',').length > 6) {\n curTransform = curTransform.split(', ').map(a => a.replace(',', '.')).join(', ');\n }\n // Some old versions of Webkit choke when 'none' is passed; pass\n // empty string instead in this case\n transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);\n } else {\n transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');\n matrix = transformMatrix.toString().split(',');\n }\n if (axis === 'x') {\n // Latest Chrome and webkits Fix\n if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41;\n // Crazy IE10 Matrix\n else if (matrix.length === 16) curTransform = parseFloat(matrix[12]);\n // Normal Browsers\n else curTransform = parseFloat(matrix[4]);\n }\n if (axis === 'y') {\n // Latest Chrome and webkits Fix\n if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42;\n // Crazy IE10 Matrix\n else if (matrix.length === 16) curTransform = parseFloat(matrix[13]);\n // Normal Browsers\n else curTransform = parseFloat(matrix[5]);\n }\n return curTransform || 0;\n}\nfunction isObject(o) {\n return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object';\n}\nfunction isNode(node) {\n // eslint-disable-next-line\n if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') {\n return node instanceof HTMLElement;\n }\n return node && (node.nodeType === 1 || node.nodeType === 11);\n}\nfunction extend() {\n const to = Object(arguments.length <= 0 ? undefined : arguments[0]);\n const noExtend = ['__proto__', 'constructor', 'prototype'];\n for (let i = 1; i < arguments.length; i += 1) {\n const nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i];\n if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) {\n const keysArray = Object.keys(Object(nextSource)).filter(key => noExtend.indexOf(key) < 0);\n for (let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) {\n const nextKey = keysArray[nextIndex];\n const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);\n if (desc !== undefined && desc.enumerable) {\n if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) {\n if (nextSource[nextKey].__swiper__) {\n to[nextKey] = nextSource[nextKey];\n } else {\n extend(to[nextKey], nextSource[nextKey]);\n }\n } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) {\n to[nextKey] = {};\n if (nextSource[nextKey].__swiper__) {\n to[nextKey] = nextSource[nextKey];\n } else {\n extend(to[nextKey], nextSource[nextKey]);\n }\n } else {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n }\n }\n return to;\n}\nfunction setCSSProperty(el, varName, varValue) {\n el.style.setProperty(varName, varValue);\n}\nfunction animateCSSModeScroll(_ref) {\n let {\n swiper,\n targetPosition,\n side\n } = _ref;\n const window = getWindow();\n const startPosition = -swiper.translate;\n let startTime = null;\n let time;\n const duration = swiper.params.speed;\n swiper.wrapperEl.style.scrollSnapType = 'none';\n window.cancelAnimationFrame(swiper.cssModeFrameID);\n const dir = targetPosition > startPosition ? 'next' : 'prev';\n const isOutOfBound = (current, target) => {\n return dir === 'next' && current >= target || dir === 'prev' && current <= target;\n };\n const animate = () => {\n time = new Date().getTime();\n if (startTime === null) {\n startTime = time;\n }\n const progress = Math.max(Math.min((time - startTime) / duration, 1), 0);\n const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2;\n let currentPosition = startPosition + easeProgress * (targetPosition - startPosition);\n if (isOutOfBound(currentPosition, targetPosition)) {\n currentPosition = targetPosition;\n }\n swiper.wrapperEl.scrollTo({\n [side]: currentPosition\n });\n if (isOutOfBound(currentPosition, targetPosition)) {\n swiper.wrapperEl.style.overflow = 'hidden';\n swiper.wrapperEl.style.scrollSnapType = '';\n setTimeout(() => {\n swiper.wrapperEl.style.overflow = '';\n swiper.wrapperEl.scrollTo({\n [side]: currentPosition\n });\n });\n window.cancelAnimationFrame(swiper.cssModeFrameID);\n return;\n }\n swiper.cssModeFrameID = window.requestAnimationFrame(animate);\n };\n animate();\n}\nfunction getSlideTransformEl(slideEl) {\n return slideEl.querySelector('.swiper-slide-transform') || slideEl.shadowRoot && slideEl.shadowRoot.querySelector('.swiper-slide-transform') || slideEl;\n}\nfunction elementChildren(element, selector) {\n if (selector === void 0) {\n selector = '';\n }\n return [...element.children].filter(el => el.matches(selector));\n}\nfunction createElement(tag, classes) {\n if (classes === void 0) {\n classes = [];\n }\n const el = document.createElement(tag);\n el.classList.add(...(Array.isArray(classes) ? classes : [classes]));\n return el;\n}\nfunction elementOffset(el) {\n const window = getWindow();\n const document = getDocument();\n const box = el.getBoundingClientRect();\n const body = document.body;\n const clientTop = el.clientTop || body.clientTop || 0;\n const clientLeft = el.clientLeft || body.clientLeft || 0;\n const scrollTop = el === window ? window.scrollY : el.scrollTop;\n const scrollLeft = el === window ? window.scrollX : el.scrollLeft;\n return {\n top: box.top + scrollTop - clientTop,\n left: box.left + scrollLeft - clientLeft\n };\n}\nfunction elementPrevAll(el, selector) {\n const prevEls = [];\n while (el.previousElementSibling) {\n const prev = el.previousElementSibling; // eslint-disable-line\n if (selector) {\n if (prev.matches(selector)) prevEls.push(prev);\n } else prevEls.push(prev);\n el = prev;\n }\n return prevEls;\n}\nfunction elementNextAll(el, selector) {\n const nextEls = [];\n while (el.nextElementSibling) {\n const next = el.nextElementSibling; // eslint-disable-line\n if (selector) {\n if (next.matches(selector)) nextEls.push(next);\n } else nextEls.push(next);\n el = next;\n }\n return nextEls;\n}\nfunction elementStyle(el, prop) {\n const window = getWindow();\n return window.getComputedStyle(el, null).getPropertyValue(prop);\n}\nfunction elementIndex(el) {\n let child = el;\n let i;\n if (child) {\n i = 0;\n // eslint-disable-next-line\n while ((child = child.previousSibling) !== null) {\n if (child.nodeType === 1) i += 1;\n }\n return i;\n }\n return undefined;\n}\nfunction elementParents(el, selector) {\n const parents = []; // eslint-disable-line\n let parent = el.parentElement; // eslint-disable-line\n while (parent) {\n if (selector) {\n if (parent.matches(selector)) parents.push(parent);\n } else {\n parents.push(parent);\n }\n parent = parent.parentElement;\n }\n return parents;\n}\nfunction elementTransitionEnd(el, callback) {\n function fireCallBack(e) {\n if (e.target !== el) return;\n callback.call(el, e);\n el.removeEventListener('transitionend', fireCallBack);\n }\n if (callback) {\n el.addEventListener('transitionend', fireCallBack);\n }\n}\nfunction elementOuterSize(el, size, includeMargins) {\n const window = getWindow();\n if (includeMargins) {\n return el[size === 'width' ? 'offsetWidth' : 'offsetHeight'] + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-right' : 'margin-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue(size === 'width' ? 'margin-left' : 'margin-bottom'));\n }\n return el.offsetWidth;\n}\n\nexport { elementParents as a, elementOffset as b, createElement as c, now as d, elementChildren as e, elementOuterSize as f, elementIndex as g, getTranslate as h, elementTransitionEnd as i, isObject as j, getSlideTransformEl as k, elementStyle as l, elementNextAll as m, nextTick as n, elementPrevAll as o, animateCSSModeScroll as p, extend as q, deleteProps as r, setCSSProperty as s };\n", "import { a as getWindow, g as getDocument } from './ssr-window.esm.mjs';\nimport { a as elementParents, l as elementStyle, e as elementChildren, s as setCSSProperty, f as elementOuterSize, m as elementNextAll, o as elementPrevAll, h as getTranslate, p as animateCSSModeScroll, n as nextTick, d as now, q as extend, g as elementIndex, c as createElement, r as deleteProps } from './utils.mjs';\n\nlet support;\nfunction calcSupport() {\n const window = getWindow();\n const document = getDocument();\n return {\n smoothScroll: document.documentElement && document.documentElement.style && 'scrollBehavior' in document.documentElement.style,\n touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch)\n };\n}\nfunction getSupport() {\n if (!support) {\n support = calcSupport();\n }\n return support;\n}\n\nlet deviceCached;\nfunction calcDevice(_temp) {\n let {\n userAgent\n } = _temp === void 0 ? {} : _temp;\n const support = getSupport();\n const window = getWindow();\n const platform = window.navigator.platform;\n const ua = userAgent || window.navigator.userAgent;\n const device = {\n ios: false,\n android: false\n };\n const screenWidth = window.screen.width;\n const screenHeight = window.screen.height;\n const android = ua.match(/(Android);?[\\s\\/]+([\\d.]+)?/); // eslint-disable-line\n let ipad = ua.match(/(iPad).*OS\\s([\\d_]+)/);\n const ipod = ua.match(/(iPod)(.*OS\\s([\\d_]+))?/);\n const iphone = !ipad && ua.match(/(iPhone\\sOS|iOS)\\s([\\d_]+)/);\n const windows = platform === 'Win32';\n let macos = platform === 'MacIntel';\n\n // iPadOs 13 fix\n const iPadScreens = ['1024x1366', '1366x1024', '834x1194', '1194x834', '834x1112', '1112x834', '768x1024', '1024x768', '820x1180', '1180x820', '810x1080', '1080x810'];\n if (!ipad && macos && support.touch && iPadScreens.indexOf(`${screenWidth}x${screenHeight}`) >= 0) {\n ipad = ua.match(/(Version)\\/([\\d.]+)/);\n if (!ipad) ipad = [0, 1, '13_0_0'];\n macos = false;\n }\n\n // Android\n if (android && !windows) {\n device.os = 'android';\n device.android = true;\n }\n if (ipad || iphone || ipod) {\n device.os = 'ios';\n device.ios = true;\n }\n\n // Export object\n return device;\n}\nfunction getDevice(overrides) {\n if (overrides === void 0) {\n overrides = {};\n }\n if (!deviceCached) {\n deviceCached = calcDevice(overrides);\n }\n return deviceCached;\n}\n\nlet browser;\nfunction calcBrowser() {\n const window = getWindow();\n let needPerspectiveFix = false;\n function isSafari() {\n const ua = window.navigator.userAgent.toLowerCase();\n return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;\n }\n if (isSafari()) {\n const ua = String(window.navigator.userAgent);\n if (ua.includes('Version/')) {\n const [major, minor] = ua.split('Version/')[1].split(' ')[0].split('.').map(num => Number(num));\n needPerspectiveFix = major < 16 || major === 16 && minor < 2;\n }\n }\n return {\n isSafari: needPerspectiveFix || isSafari(),\n needPerspectiveFix,\n isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent)\n };\n}\nfunction getBrowser() {\n if (!browser) {\n browser = calcBrowser();\n }\n return browser;\n}\n\nfunction Resize(_ref) {\n let {\n swiper,\n on,\n emit\n } = _ref;\n const window = getWindow();\n let observer = null;\n let animationFrame = null;\n const resizeHandler = () => {\n if (!swiper || swiper.destroyed || !swiper.initialized) return;\n emit('beforeResize');\n emit('resize');\n };\n const createObserver = () => {\n if (!swiper || swiper.destroyed || !swiper.initialized) return;\n observer = new ResizeObserver(entries => {\n animationFrame = window.requestAnimationFrame(() => {\n const {\n width,\n height\n } = swiper;\n let newWidth = width;\n let newHeight = height;\n entries.forEach(_ref2 => {\n let {\n contentBoxSize,\n contentRect,\n target\n } = _ref2;\n if (target && target !== swiper.el) return;\n newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize;\n newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize;\n });\n if (newWidth !== width || newHeight !== height) {\n resizeHandler();\n }\n });\n });\n observer.observe(swiper.el);\n };\n const removeObserver = () => {\n if (animationFrame) {\n window.cancelAnimationFrame(animationFrame);\n }\n if (observer && observer.unobserve && swiper.el) {\n observer.unobserve(swiper.el);\n observer = null;\n }\n };\n const orientationChangeHandler = () => {\n if (!swiper || swiper.destroyed || !swiper.initialized) return;\n emit('orientationchange');\n };\n on('init', () => {\n if (swiper.params.resizeObserver && typeof window.ResizeObserver !== 'undefined') {\n createObserver();\n return;\n }\n window.addEventListener('resize', resizeHandler);\n window.addEventListener('orientationchange', orientationChangeHandler);\n });\n on('destroy', () => {\n removeObserver();\n window.removeEventListener('resize', resizeHandler);\n window.removeEventListener('orientationchange', orientationChangeHandler);\n });\n}\n\nfunction Observer(_ref) {\n let {\n swiper,\n extendParams,\n on,\n emit\n } = _ref;\n const observers = [];\n const window = getWindow();\n const attach = function (target, options) {\n if (options === void 0) {\n options = {};\n }\n const ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;\n const observer = new ObserverFunc(mutations => {\n // The observerUpdate event should only be triggered\n // once despite the number of mutations. Additional\n // triggers are redundant and are very costly\n if (swiper.__preventObserver__) return;\n if (mutations.length === 1) {\n emit('observerUpdate', mutations[0]);\n return;\n }\n const observerUpdate = function observerUpdate() {\n emit('observerUpdate', mutations[0]);\n };\n if (window.requestAnimationFrame) {\n window.requestAnimationFrame(observerUpdate);\n } else {\n window.setTimeout(observerUpdate, 0);\n }\n });\n observer.observe(target, {\n attributes: typeof options.attributes === 'undefined' ? true : options.attributes,\n childList: typeof options.childList === 'undefined' ? true : options.childList,\n characterData: typeof options.characterData === 'undefined' ? true : options.characterData\n });\n observers.push(observer);\n };\n const init = () => {\n if (!swiper.params.observer) return;\n if (swiper.params.observeParents) {\n const containerParents = elementParents(swiper.hostEl);\n for (let i = 0; i < containerParents.length; i += 1) {\n attach(containerParents[i]);\n }\n }\n // Observe container\n attach(swiper.hostEl, {\n childList: swiper.params.observeSlideChildren\n });\n\n // Observe wrapper\n attach(swiper.wrapperEl, {\n attributes: false\n });\n };\n const destroy = () => {\n observers.forEach(observer => {\n observer.disconnect();\n });\n observers.splice(0, observers.length);\n };\n extendParams({\n observer: false,\n observeParents: false,\n observeSlideChildren: false\n });\n on('init', init);\n on('destroy', destroy);\n}\n\n/* eslint-disable no-underscore-dangle */\n\nvar eventsEmitter = {\n on(events, handler, priority) {\n const self = this;\n if (!self.eventsListeners || self.destroyed) return self;\n if (typeof handler !== 'function') return self;\n const method = priority ? 'unshift' : 'push';\n events.split(' ').forEach(event => {\n if (!self.eventsListeners[event]) self.eventsListeners[event] = [];\n self.eventsListeners[event][method](handler);\n });\n return self;\n },\n once(events, handler, priority) {\n const self = this;\n if (!self.eventsListeners || self.destroyed) return self;\n if (typeof handler !== 'function') return self;\n function onceHandler() {\n self.off(events, onceHandler);\n if (onceHandler.__emitterProxy) {\n delete onceHandler.__emitterProxy;\n }\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n handler.apply(self, args);\n }\n onceHandler.__emitterProxy = handler;\n return self.on(events, onceHandler, priority);\n },\n onAny(handler, priority) {\n const self = this;\n if (!self.eventsListeners || self.destroyed) return self;\n if (typeof handler !== 'function') return self;\n const method = priority ? 'unshift' : 'push';\n if (self.eventsAnyListeners.indexOf(handler) < 0) {\n self.eventsAnyListeners[method](handler);\n }\n return self;\n },\n offAny(handler) {\n const self = this;\n if (!self.eventsListeners || self.destroyed) return self;\n if (!self.eventsAnyListeners) return self;\n const index = self.eventsAnyListeners.indexOf(handler);\n if (index >= 0) {\n self.eventsAnyListeners.splice(index, 1);\n }\n return self;\n },\n off(events, handler) {\n const self = this;\n if (!self.eventsListeners || self.destroyed) return self;\n if (!self.eventsListeners) return self;\n events.split(' ').forEach(event => {\n if (typeof handler === 'undefined') {\n self.eventsListeners[event] = [];\n } else if (self.eventsListeners[event]) {\n self.eventsListeners[event].forEach((eventHandler, index) => {\n if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) {\n self.eventsListeners[event].splice(index, 1);\n }\n });\n }\n });\n return self;\n },\n emit() {\n const self = this;\n if (!self.eventsListeners || self.destroyed) return self;\n if (!self.eventsListeners) return self;\n let events;\n let data;\n let context;\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n if (typeof args[0] === 'string' || Array.isArray(args[0])) {\n events = args[0];\n data = args.slice(1, args.length);\n context = self;\n } else {\n events = args[0].events;\n data = args[0].data;\n context = args[0].context || self;\n }\n data.unshift(context);\n const eventsArray = Array.isArray(events) ? events : events.split(' ');\n eventsArray.forEach(event => {\n if (self.eventsAnyListeners && self.eventsAnyListeners.length) {\n self.eventsAnyListeners.forEach(eventHandler => {\n eventHandler.apply(context, [event, ...data]);\n });\n }\n if (self.eventsListeners && self.eventsListeners[event]) {\n self.eventsListeners[event].forEach(eventHandler => {\n eventHandler.apply(context, data);\n });\n }\n });\n return self;\n }\n};\n\nfunction updateSize() {\n const swiper = this;\n let width;\n let height;\n const el = swiper.el;\n if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) {\n width = swiper.params.width;\n } else {\n width = el.clientWidth;\n }\n if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) {\n height = swiper.params.height;\n } else {\n height = el.clientHeight;\n }\n if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) {\n return;\n }\n\n // Subtract paddings\n width = width - parseInt(elementStyle(el, 'padding-left') || 0, 10) - parseInt(elementStyle(el, 'padding-right') || 0, 10);\n height = height - parseInt(elementStyle(el, 'padding-top') || 0, 10) - parseInt(elementStyle(el, 'padding-bottom') || 0, 10);\n if (Number.isNaN(width)) width = 0;\n if (Number.isNaN(height)) height = 0;\n Object.assign(swiper, {\n width,\n height,\n size: swiper.isHorizontal() ? width : height\n });\n}\n\nfunction updateSlides() {\n const swiper = this;\n function getDirectionLabel(property) {\n if (swiper.isHorizontal()) {\n return property;\n }\n // prettier-ignore\n return {\n 'width': 'height',\n 'margin-top': 'margin-left',\n 'margin-bottom ': 'margin-right',\n 'margin-left': 'margin-top',\n 'margin-right': 'margin-bottom',\n 'padding-left': 'padding-top',\n 'padding-right': 'padding-bottom',\n 'marginRight': 'marginBottom'\n }[property];\n }\n function getDirectionPropertyValue(node, label) {\n return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0);\n }\n const params = swiper.params;\n const {\n wrapperEl,\n slidesEl,\n size: swiperSize,\n rtlTranslate: rtl,\n wrongRTL\n } = swiper;\n const isVirtual = swiper.virtual && params.virtual.enabled;\n const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length;\n const slides = elementChildren(slidesEl, `.${swiper.params.slideClass}, swiper-slide`);\n const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length;\n let snapGrid = [];\n const slidesGrid = [];\n const slidesSizesGrid = [];\n let offsetBefore = params.slidesOffsetBefore;\n if (typeof offsetBefore === 'function') {\n offsetBefore = params.slidesOffsetBefore.call(swiper);\n }\n let offsetAfter = params.slidesOffsetAfter;\n if (typeof offsetAfter === 'function') {\n offsetAfter = params.slidesOffsetAfter.call(swiper);\n }\n const previousSnapGridLength = swiper.snapGrid.length;\n const previousSlidesGridLength = swiper.slidesGrid.length;\n let spaceBetween = params.spaceBetween;\n let slidePosition = -offsetBefore;\n let prevSlideSize = 0;\n let index = 0;\n if (typeof swiperSize === 'undefined') {\n return;\n }\n if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {\n spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize;\n } else if (typeof spaceBetween === 'string') {\n spaceBetween = parseFloat(spaceBetween);\n }\n swiper.virtualSize = -spaceBetween;\n\n // reset margins\n slides.forEach(slideEl => {\n if (rtl) {\n slideEl.style.marginLeft = '';\n } else {\n slideEl.style.marginRight = '';\n }\n slideEl.style.marginBottom = '';\n slideEl.style.marginTop = '';\n });\n\n // reset cssMode offsets\n if (params.centeredSlides && params.cssMode) {\n setCSSProperty(wrapperEl, '--swiper-centered-offset-before', '');\n setCSSProperty(wrapperEl, '--swiper-centered-offset-after', '');\n }\n const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;\n if (gridEnabled) {\n swiper.grid.initSlides(slidesLength);\n }\n\n // Calc slides\n let slideSize;\n const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key => {\n return typeof params.breakpoints[key].slidesPerView !== 'undefined';\n }).length > 0;\n for (let i = 0; i < slidesLength; i += 1) {\n slideSize = 0;\n let slide;\n if (slides[i]) slide = slides[i];\n if (gridEnabled) {\n swiper.grid.updateSlide(i, slide, slidesLength, getDirectionLabel);\n }\n if (slides[i] && elementStyle(slide, 'display') === 'none') continue; // eslint-disable-line\n\n if (params.slidesPerView === 'auto') {\n if (shouldResetSlideSize) {\n slides[i].style[getDirectionLabel('width')] = ``;\n }\n const slideStyles = getComputedStyle(slide);\n const currentTransform = slide.style.transform;\n const currentWebKitTransform = slide.style.webkitTransform;\n if (currentTransform) {\n slide.style.transform = 'none';\n }\n if (currentWebKitTransform) {\n slide.style.webkitTransform = 'none';\n }\n if (params.roundLengths) {\n slideSize = swiper.isHorizontal() ? elementOuterSize(slide, 'width', true) : elementOuterSize(slide, 'height', true);\n } else {\n // eslint-disable-next-line\n const width = getDirectionPropertyValue(slideStyles, 'width');\n const paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left');\n const paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right');\n const marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left');\n const marginRight = getDirectionPropertyValue(slideStyles, 'margin-right');\n const boxSizing = slideStyles.getPropertyValue('box-sizing');\n if (boxSizing && boxSizing === 'border-box') {\n slideSize = width + marginLeft + marginRight;\n } else {\n const {\n clientWidth,\n offsetWidth\n } = slide;\n slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth);\n }\n }\n if (currentTransform) {\n slide.style.transform = currentTransform;\n }\n if (currentWebKitTransform) {\n slide.style.webkitTransform = currentWebKitTransform;\n }\n if (params.roundLengths) slideSize = Math.floor(slideSize);\n } else {\n slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;\n if (params.roundLengths) slideSize = Math.floor(slideSize);\n if (slides[i]) {\n slides[i].style[getDirectionLabel('width')] = `${slideSize}px`;\n }\n }\n if (slides[i]) {\n slides[i].swiperSlideSize = slideSize;\n }\n slidesSizesGrid.push(slideSize);\n if (params.centeredSlides) {\n slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;\n if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;\n if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;\n if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;\n if (params.roundLengths) slidePosition = Math.floor(slidePosition);\n if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition);\n slidesGrid.push(slidePosition);\n } else {\n if (params.roundLengths) slidePosition = Math.floor(slidePosition);\n if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition);\n slidesGrid.push(slidePosition);\n slidePosition = slidePosition + slideSize + spaceBetween;\n }\n swiper.virtualSize += slideSize + spaceBetween;\n prevSlideSize = slideSize;\n index += 1;\n }\n swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter;\n if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) {\n wrapperEl.style.width = `${swiper.virtualSize + spaceBetween}px`;\n }\n if (params.setWrapperSize) {\n wrapperEl.style[getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;\n }\n if (gridEnabled) {\n swiper.grid.updateWrapperSize(slideSize, snapGrid, getDirectionLabel);\n }\n\n // Remove last grid elements depending on width\n if (!params.centeredSlides) {\n const newSlidesGrid = [];\n for (let i = 0; i < snapGrid.length; i += 1) {\n let slidesGridItem = snapGrid[i];\n if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);\n if (snapGrid[i] <= swiper.virtualSize - swiperSize) {\n newSlidesGrid.push(slidesGridItem);\n }\n }\n snapGrid = newSlidesGrid;\n if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {\n snapGrid.push(swiper.virtualSize - swiperSize);\n }\n }\n if (isVirtual && params.loop) {\n const size = slidesSizesGrid[0] + spaceBetween;\n if (params.slidesPerGroup > 1) {\n const groups = Math.ceil((swiper.virtual.slidesBefore + swiper.virtual.slidesAfter) / params.slidesPerGroup);\n const groupSize = size * params.slidesPerGroup;\n for (let i = 0; i < groups; i += 1) {\n snapGrid.push(snapGrid[snapGrid.length - 1] + groupSize);\n }\n }\n for (let i = 0; i < swiper.virtual.slidesBefore + swiper.virtual.slidesAfter; i += 1) {\n if (params.slidesPerGroup === 1) {\n snapGrid.push(snapGrid[snapGrid.length - 1] + size);\n }\n slidesGrid.push(slidesGrid[slidesGrid.length - 1] + size);\n swiper.virtualSize += size;\n }\n }\n if (snapGrid.length === 0) snapGrid = [0];\n if (spaceBetween !== 0) {\n const key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight');\n slides.filter((_, slideIndex) => {\n if (!params.cssMode || params.loop) return true;\n if (slideIndex === slides.length - 1) {\n return false;\n }\n return true;\n }).forEach(slideEl => {\n slideEl.style[key] = `${spaceBetween}px`;\n });\n }\n if (params.centeredSlides && params.centeredSlidesBounds) {\n let allSlidesSize = 0;\n slidesSizesGrid.forEach(slideSizeValue => {\n allSlidesSize += slideSizeValue + (spaceBetween || 0);\n });\n allSlidesSize -= spaceBetween;\n const maxSnap = allSlidesSize - swiperSize;\n snapGrid = snapGrid.map(snap => {\n if (snap <= 0) return -offsetBefore;\n if (snap > maxSnap) return maxSnap + offsetAfter;\n return snap;\n });\n }\n if (params.centerInsufficientSlides) {\n let allSlidesSize = 0;\n slidesSizesGrid.forEach(slideSizeValue => {\n allSlidesSize += slideSizeValue + (spaceBetween || 0);\n });\n allSlidesSize -= spaceBetween;\n if (allSlidesSize < swiperSize) {\n const allSlidesOffset = (swiperSize - allSlidesSize) / 2;\n snapGrid.forEach((snap, snapIndex) => {\n snapGrid[snapIndex] = snap - allSlidesOffset;\n });\n slidesGrid.forEach((snap, snapIndex) => {\n slidesGrid[snapIndex] = snap + allSlidesOffset;\n });\n }\n }\n Object.assign(swiper, {\n slides,\n snapGrid,\n slidesGrid,\n slidesSizesGrid\n });\n if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) {\n setCSSProperty(wrapperEl, '--swiper-centered-offset-before', `${-snapGrid[0]}px`);\n setCSSProperty(wrapperEl, '--swiper-centered-offset-after', `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`);\n const addToSnapGrid = -swiper.snapGrid[0];\n const addToSlidesGrid = -swiper.slidesGrid[0];\n swiper.snapGrid = swiper.snapGrid.map(v => v + addToSnapGrid);\n swiper.slidesGrid = swiper.slidesGrid.map(v => v + addToSlidesGrid);\n }\n if (slidesLength !== previousSlidesLength) {\n swiper.emit('slidesLengthChange');\n }\n if (snapGrid.length !== previousSnapGridLength) {\n if (swiper.params.watchOverflow) swiper.checkOverflow();\n swiper.emit('snapGridLengthChange');\n }\n if (slidesGrid.length !== previousSlidesGridLength) {\n swiper.emit('slidesGridLengthChange');\n }\n if (params.watchSlidesProgress) {\n swiper.updateSlidesOffset();\n }\n if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) {\n const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`;\n const hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass);\n if (slidesLength <= params.maxBackfaceHiddenSlides) {\n if (!hasClassBackfaceClassAdded) swiper.el.classList.add(backFaceHiddenClass);\n } else if (hasClassBackfaceClassAdded) {\n swiper.el.classList.remove(backFaceHiddenClass);\n }\n }\n}\n\nfunction updateAutoHeight(speed) {\n const swiper = this;\n const activeSlides = [];\n const isVirtual = swiper.virtual && swiper.params.virtual.enabled;\n let newHeight = 0;\n let i;\n if (typeof speed === 'number') {\n swiper.setTransition(speed);\n } else if (speed === true) {\n swiper.setTransition(swiper.params.speed);\n }\n const getSlideByIndex = index => {\n if (isVirtual) {\n return swiper.slides[swiper.getSlideIndexByData(index)];\n }\n return swiper.slides[index];\n };\n // Find slides currently in view\n if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) {\n if (swiper.params.centeredSlides) {\n (swiper.visibleSlides || []).forEach(slide => {\n activeSlides.push(slide);\n });\n } else {\n for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) {\n const index = swiper.activeIndex + i;\n if (index > swiper.slides.length && !isVirtual) break;\n activeSlides.push(getSlideByIndex(index));\n }\n }\n } else {\n activeSlides.push(getSlideByIndex(swiper.activeIndex));\n }\n\n // Find new height from highest slide in view\n for (i = 0; i < activeSlides.length; i += 1) {\n if (typeof activeSlides[i] !== 'undefined') {\n const height = activeSlides[i].offsetHeight;\n newHeight = height > newHeight ? height : newHeight;\n }\n }\n\n // Update Height\n if (newHeight || newHeight === 0) swiper.wrapperEl.style.height = `${newHeight}px`;\n}\n\nfunction updateSlidesOffset() {\n const swiper = this;\n const slides = swiper.slides;\n // eslint-disable-next-line\n const minusOffset = swiper.isElement ? swiper.isHorizontal() ? swiper.wrapperEl.offsetLeft : swiper.wrapperEl.offsetTop : 0;\n for (let i = 0; i < slides.length; i += 1) {\n slides[i].swiperSlideOffset = (swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop) - minusOffset - swiper.cssOverflowAdjustment();\n }\n}\n\nfunction updateSlidesProgress(translate) {\n if (translate === void 0) {\n translate = this && this.translate || 0;\n }\n const swiper = this;\n const params = swiper.params;\n const {\n slides,\n rtlTranslate: rtl,\n snapGrid\n } = swiper;\n if (slides.length === 0) return;\n if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset();\n let offsetCenter = -translate;\n if (rtl) offsetCenter = translate;\n\n // Visible Slides\n slides.forEach(slideEl => {\n slideEl.classList.remove(params.slideVisibleClass);\n });\n swiper.visibleSlidesIndexes = [];\n swiper.visibleSlides = [];\n let spaceBetween = params.spaceBetween;\n if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {\n spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size;\n } else if (typeof spaceBetween === 'string') {\n spaceBetween = parseFloat(spaceBetween);\n }\n for (let i = 0; i < slides.length; i += 1) {\n const slide = slides[i];\n let slideOffset = slide.swiperSlideOffset;\n if (params.cssMode && params.centeredSlides) {\n slideOffset -= slides[0].swiperSlideOffset;\n }\n const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween);\n const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + spaceBetween);\n const slideBefore = -(offsetCenter - slideOffset);\n const slideAfter = slideBefore + swiper.slidesSizesGrid[i];\n const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size;\n if (isVisible) {\n swiper.visibleSlides.push(slide);\n swiper.visibleSlidesIndexes.push(i);\n slides[i].classList.add(params.slideVisibleClass);\n }\n slide.progress = rtl ? -slideProgress : slideProgress;\n slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress;\n }\n}\n\nfunction updateProgress(translate) {\n const swiper = this;\n if (typeof translate === 'undefined') {\n const multiplier = swiper.rtlTranslate ? -1 : 1;\n // eslint-disable-next-line\n translate = swiper && swiper.translate && swiper.translate * multiplier || 0;\n }\n const params = swiper.params;\n const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();\n let {\n progress,\n isBeginning,\n isEnd,\n progressLoop\n } = swiper;\n const wasBeginning = isBeginning;\n const wasEnd = isEnd;\n if (translatesDiff === 0) {\n progress = 0;\n isBeginning = true;\n isEnd = true;\n } else {\n progress = (translate - swiper.minTranslate()) / translatesDiff;\n const isBeginningRounded = Math.abs(translate - swiper.minTranslate()) < 1;\n const isEndRounded = Math.abs(translate - swiper.maxTranslate()) < 1;\n isBeginning = isBeginningRounded || progress <= 0;\n isEnd = isEndRounded || progress >= 1;\n if (isBeginningRounded) progress = 0;\n if (isEndRounded) progress = 1;\n }\n if (params.loop) {\n const firstSlideIndex = swiper.getSlideIndexByData(0);\n const lastSlideIndex = swiper.getSlideIndexByData(swiper.slides.length - 1);\n const firstSlideTranslate = swiper.slidesGrid[firstSlideIndex];\n const lastSlideTranslate = swiper.slidesGrid[lastSlideIndex];\n const translateMax = swiper.slidesGrid[swiper.slidesGrid.length - 1];\n const translateAbs = Math.abs(translate);\n if (translateAbs >= firstSlideTranslate) {\n progressLoop = (translateAbs - firstSlideTranslate) / translateMax;\n } else {\n progressLoop = (translateAbs + translateMax - lastSlideTranslate) / translateMax;\n }\n if (progressLoop > 1) progressLoop -= 1;\n }\n Object.assign(swiper, {\n progress,\n progressLoop,\n isBeginning,\n isEnd\n });\n if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate);\n if (isBeginning && !wasBeginning) {\n swiper.emit('reachBeginning toEdge');\n }\n if (isEnd && !wasEnd) {\n swiper.emit('reachEnd toEdge');\n }\n if (wasBeginning && !isBeginning || wasEnd && !isEnd) {\n swiper.emit('fromEdge');\n }\n swiper.emit('progress', progress);\n}\n\nfunction updateSlidesClasses() {\n const swiper = this;\n const {\n slides,\n params,\n slidesEl,\n activeIndex\n } = swiper;\n const isVirtual = swiper.virtual && params.virtual.enabled;\n const getFilteredSlide = selector => {\n return elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0];\n };\n slides.forEach(slideEl => {\n slideEl.classList.remove(params.slideActiveClass, params.slideNextClass, params.slidePrevClass);\n });\n let activeSlide;\n if (isVirtual) {\n if (params.loop) {\n let slideIndex = activeIndex - swiper.virtual.slidesBefore;\n if (slideIndex < 0) slideIndex = swiper.virtual.slides.length + slideIndex;\n if (slideIndex >= swiper.virtual.slides.length) slideIndex -= swiper.virtual.slides.length;\n activeSlide = getFilteredSlide(`[data-swiper-slide-index=\"${slideIndex}\"]`);\n } else {\n activeSlide = getFilteredSlide(`[data-swiper-slide-index=\"${activeIndex}\"]`);\n }\n } else {\n activeSlide = slides[activeIndex];\n }\n if (activeSlide) {\n // Active classes\n activeSlide.classList.add(params.slideActiveClass);\n\n // Next Slide\n let nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];\n if (params.loop && !nextSlide) {\n nextSlide = slides[0];\n }\n if (nextSlide) {\n nextSlide.classList.add(params.slideNextClass);\n }\n // Prev Slide\n let prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];\n if (params.loop && !prevSlide === 0) {\n prevSlide = slides[slides.length - 1];\n }\n if (prevSlide) {\n prevSlide.classList.add(params.slidePrevClass);\n }\n }\n swiper.emitSlidesClasses();\n}\n\nconst processLazyPreloader = (swiper, imageEl) => {\n if (!swiper || swiper.destroyed || !swiper.params) return;\n const slideSelector = () => swiper.isElement ? `swiper-slide` : `.${swiper.params.slideClass}`;\n const slideEl = imageEl.closest(slideSelector());\n if (slideEl) {\n let lazyEl = slideEl.querySelector(`.${swiper.params.lazyPreloaderClass}`);\n if (!lazyEl && swiper.isElement) {\n if (slideEl.shadowRoot) {\n lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`);\n } else {\n // init later\n requestAnimationFrame(() => {\n if (slideEl.shadowRoot) {\n lazyEl = slideEl.shadowRoot.querySelector(`.${swiper.params.lazyPreloaderClass}`);\n if (lazyEl) lazyEl.remove();\n }\n });\n }\n }\n if (lazyEl) lazyEl.remove();\n }\n};\nconst unlazy = (swiper, index) => {\n if (!swiper.slides[index]) return;\n const imageEl = swiper.slides[index].querySelector('[loading=\"lazy\"]');\n if (imageEl) imageEl.removeAttribute('loading');\n};\nconst preload = swiper => {\n if (!swiper || swiper.destroyed || !swiper.params) return;\n let amount = swiper.params.lazyPreloadPrevNext;\n const len = swiper.slides.length;\n if (!len || !amount || amount < 0) return;\n amount = Math.min(amount, len);\n const slidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(swiper.params.slidesPerView);\n const activeIndex = swiper.activeIndex;\n if (swiper.params.grid && swiper.params.grid.rows > 1) {\n const activeColumn = activeIndex;\n const preloadColumns = [activeColumn - amount];\n preloadColumns.push(...Array.from({\n length: amount\n }).map((_, i) => {\n return activeColumn + slidesPerView + i;\n }));\n swiper.slides.forEach((slideEl, i) => {\n if (preloadColumns.includes(slideEl.column)) unlazy(swiper, i);\n });\n return;\n }\n const slideIndexLastInView = activeIndex + slidesPerView - 1;\n if (swiper.params.rewind || swiper.params.loop) {\n for (let i = activeIndex - amount; i <= slideIndexLastInView + amount; i += 1) {\n const realIndex = (i % len + len) % len;\n if (realIndex < activeIndex || realIndex > slideIndexLastInView) unlazy(swiper, realIndex);\n }\n } else {\n for (let i = Math.max(activeIndex - amount, 0); i <= Math.min(slideIndexLastInView + amount, len - 1); i += 1) {\n if (i !== activeIndex && (i > slideIndexLastInView || i < activeIndex)) {\n unlazy(swiper, i);\n }\n }\n }\n};\n\nfunction getActiveIndexByTranslate(swiper) {\n const {\n slidesGrid,\n params\n } = swiper;\n const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;\n let activeIndex;\n for (let i = 0; i < slidesGrid.length; i += 1) {\n if (typeof slidesGrid[i + 1] !== 'undefined') {\n if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) {\n activeIndex = i;\n } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) {\n activeIndex = i + 1;\n }\n } else if (translate >= slidesGrid[i]) {\n activeIndex = i;\n }\n }\n // Normalize slideIndex\n if (params.normalizeSlideIndex) {\n if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0;\n }\n return activeIndex;\n}\nfunction updateActiveIndex(newActiveIndex) {\n const swiper = this;\n const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;\n const {\n snapGrid,\n params,\n activeIndex: previousIndex,\n realIndex: previousRealIndex,\n snapIndex: previousSnapIndex\n } = swiper;\n let activeIndex = newActiveIndex;\n let snapIndex;\n const getVirtualRealIndex = aIndex => {\n let realIndex = aIndex - swiper.virtual.slidesBefore;\n if (realIndex < 0) {\n realIndex = swiper.virtual.slides.length + realIndex;\n }\n if (realIndex >= swiper.virtual.slides.length) {\n realIndex -= swiper.virtual.slides.length;\n }\n return realIndex;\n };\n if (typeof activeIndex === 'undefined') {\n activeIndex = getActiveIndexByTranslate(swiper);\n }\n if (snapGrid.indexOf(translate) >= 0) {\n snapIndex = snapGrid.indexOf(translate);\n } else {\n const skip = Math.min(params.slidesPerGroupSkip, activeIndex);\n snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup);\n }\n if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;\n if (activeIndex === previousIndex) {\n if (snapIndex !== previousSnapIndex) {\n swiper.snapIndex = snapIndex;\n swiper.emit('snapIndexChange');\n }\n if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {\n swiper.realIndex = getVirtualRealIndex(activeIndex);\n }\n return;\n }\n // Get real index\n let realIndex;\n if (swiper.virtual && params.virtual.enabled && params.loop) {\n realIndex = getVirtualRealIndex(activeIndex);\n } else if (swiper.slides[activeIndex]) {\n realIndex = parseInt(swiper.slides[activeIndex].getAttribute('data-swiper-slide-index') || activeIndex, 10);\n } else {\n realIndex = activeIndex;\n }\n Object.assign(swiper, {\n previousSnapIndex,\n snapIndex,\n previousRealIndex,\n realIndex,\n previousIndex,\n activeIndex\n });\n if (swiper.initialized) {\n preload(swiper);\n }\n swiper.emit('activeIndexChange');\n swiper.emit('snapIndexChange');\n if (swiper.initialized || swiper.params.runCallbacksOnInit) {\n if (previousRealIndex !== realIndex) {\n swiper.emit('realIndexChange');\n }\n swiper.emit('slideChange');\n }\n}\n\nfunction updateClickedSlide(el, path) {\n const swiper = this;\n const params = swiper.params;\n let slide = el.closest(`.${params.slideClass}, swiper-slide`);\n if (!slide && swiper.isElement && path && path.length > 1 && path.includes(el)) {\n [...path.slice(path.indexOf(el) + 1, path.length)].forEach(pathEl => {\n if (!slide && pathEl.matches && pathEl.matches(`.${params.slideClass}, swiper-slide`)) {\n slide = pathEl;\n }\n });\n }\n let slideFound = false;\n let slideIndex;\n if (slide) {\n for (let i = 0; i < swiper.slides.length; i += 1) {\n if (swiper.slides[i] === slide) {\n slideFound = true;\n slideIndex = i;\n break;\n }\n }\n }\n if (slide && slideFound) {\n swiper.clickedSlide = slide;\n if (swiper.virtual && swiper.params.virtual.enabled) {\n swiper.clickedIndex = parseInt(slide.getAttribute('data-swiper-slide-index'), 10);\n } else {\n swiper.clickedIndex = slideIndex;\n }\n } else {\n swiper.clickedSlide = undefined;\n swiper.clickedIndex = undefined;\n return;\n }\n if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) {\n swiper.slideToClickedSlide();\n }\n}\n\nvar update = {\n updateSize,\n updateSlides,\n updateAutoHeight,\n updateSlidesOffset,\n updateSlidesProgress,\n updateProgress,\n updateSlidesClasses,\n updateActiveIndex,\n updateClickedSlide\n};\n\nfunction getSwiperTranslate(axis) {\n if (axis === void 0) {\n axis = this.isHorizontal() ? 'x' : 'y';\n }\n const swiper = this;\n const {\n params,\n rtlTranslate: rtl,\n translate,\n wrapperEl\n } = swiper;\n if (params.virtualTranslate) {\n return rtl ? -translate : translate;\n }\n if (params.cssMode) {\n return translate;\n }\n let currentTranslate = getTranslate(wrapperEl, axis);\n currentTranslate += swiper.cssOverflowAdjustment();\n if (rtl) currentTranslate = -currentTranslate;\n return currentTranslate || 0;\n}\n\nfunction setTranslate(translate, byController) {\n const swiper = this;\n const {\n rtlTranslate: rtl,\n params,\n wrapperEl,\n progress\n } = swiper;\n let x = 0;\n let y = 0;\n const z = 0;\n if (swiper.isHorizontal()) {\n x = rtl ? -translate : translate;\n } else {\n y = translate;\n }\n if (params.roundLengths) {\n x = Math.floor(x);\n y = Math.floor(y);\n }\n swiper.previousTranslate = swiper.translate;\n swiper.translate = swiper.isHorizontal() ? x : y;\n if (params.cssMode) {\n wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y;\n } else if (!params.virtualTranslate) {\n if (swiper.isHorizontal()) {\n x -= swiper.cssOverflowAdjustment();\n } else {\n y -= swiper.cssOverflowAdjustment();\n }\n wrapperEl.style.transform = `translate3d(${x}px, ${y}px, ${z}px)`;\n }\n\n // Check if we need to update progress\n let newProgress;\n const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();\n if (translatesDiff === 0) {\n newProgress = 0;\n } else {\n newProgress = (translate - swiper.minTranslate()) / translatesDiff;\n }\n if (newProgress !== progress) {\n swiper.updateProgress(translate);\n }\n swiper.emit('setTranslate', swiper.translate, byController);\n}\n\nfunction minTranslate() {\n return -this.snapGrid[0];\n}\n\nfunction maxTranslate() {\n return -this.snapGrid[this.snapGrid.length - 1];\n}\n\nfunction translateTo(translate, speed, runCallbacks, translateBounds, internal) {\n if (translate === void 0) {\n translate = 0;\n }\n if (speed === void 0) {\n speed = this.params.speed;\n }\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n if (translateBounds === void 0) {\n translateBounds = true;\n }\n const swiper = this;\n const {\n params,\n wrapperEl\n } = swiper;\n if (swiper.animating && params.preventInteractionOnTransition) {\n return false;\n }\n const minTranslate = swiper.minTranslate();\n const maxTranslate = swiper.maxTranslate();\n let newTranslate;\n if (translateBounds && translate > minTranslate) newTranslate = minTranslate;else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate;else newTranslate = translate;\n\n // Update progress\n swiper.updateProgress(newTranslate);\n if (params.cssMode) {\n const isH = swiper.isHorizontal();\n if (speed === 0) {\n wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate;\n } else {\n if (!swiper.support.smoothScroll) {\n animateCSSModeScroll({\n swiper,\n targetPosition: -newTranslate,\n side: isH ? 'left' : 'top'\n });\n return true;\n }\n wrapperEl.scrollTo({\n [isH ? 'left' : 'top']: -newTranslate,\n behavior: 'smooth'\n });\n }\n return true;\n }\n if (speed === 0) {\n swiper.setTransition(0);\n swiper.setTranslate(newTranslate);\n if (runCallbacks) {\n swiper.emit('beforeTransitionStart', speed, internal);\n swiper.emit('transitionEnd');\n }\n } else {\n swiper.setTransition(speed);\n swiper.setTranslate(newTranslate);\n if (runCallbacks) {\n swiper.emit('beforeTransitionStart', speed, internal);\n swiper.emit('transitionStart');\n }\n if (!swiper.animating) {\n swiper.animating = true;\n if (!swiper.onTranslateToWrapperTransitionEnd) {\n swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) {\n if (!swiper || swiper.destroyed) return;\n if (e.target !== this) return;\n swiper.wrapperEl.removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);\n swiper.onTranslateToWrapperTransitionEnd = null;\n delete swiper.onTranslateToWrapperTransitionEnd;\n if (runCallbacks) {\n swiper.emit('transitionEnd');\n }\n };\n }\n swiper.wrapperEl.addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);\n }\n }\n return true;\n}\n\nvar translate = {\n getTranslate: getSwiperTranslate,\n setTranslate,\n minTranslate,\n maxTranslate,\n translateTo\n};\n\nfunction setTransition(duration, byController) {\n const swiper = this;\n if (!swiper.params.cssMode) {\n swiper.wrapperEl.style.transitionDuration = `${duration}ms`;\n swiper.wrapperEl.style.transitionDelay = duration === 0 ? `0ms` : '';\n }\n swiper.emit('setTransition', duration, byController);\n}\n\nfunction transitionEmit(_ref) {\n let {\n swiper,\n runCallbacks,\n direction,\n step\n } = _ref;\n const {\n activeIndex,\n previousIndex\n } = swiper;\n let dir = direction;\n if (!dir) {\n if (activeIndex > previousIndex) dir = 'next';else if (activeIndex < previousIndex) dir = 'prev';else dir = 'reset';\n }\n swiper.emit(`transition${step}`);\n if (runCallbacks && activeIndex !== previousIndex) {\n if (dir === 'reset') {\n swiper.emit(`slideResetTransition${step}`);\n return;\n }\n swiper.emit(`slideChangeTransition${step}`);\n if (dir === 'next') {\n swiper.emit(`slideNextTransition${step}`);\n } else {\n swiper.emit(`slidePrevTransition${step}`);\n }\n }\n}\n\nfunction transitionStart(runCallbacks, direction) {\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n const swiper = this;\n const {\n params\n } = swiper;\n if (params.cssMode) return;\n if (params.autoHeight) {\n swiper.updateAutoHeight();\n }\n transitionEmit({\n swiper,\n runCallbacks,\n direction,\n step: 'Start'\n });\n}\n\nfunction transitionEnd(runCallbacks, direction) {\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n const swiper = this;\n const {\n params\n } = swiper;\n swiper.animating = false;\n if (params.cssMode) return;\n swiper.setTransition(0);\n transitionEmit({\n swiper,\n runCallbacks,\n direction,\n step: 'End'\n });\n}\n\nvar transition = {\n setTransition,\n transitionStart,\n transitionEnd\n};\n\nfunction slideTo(index, speed, runCallbacks, internal, initial) {\n if (index === void 0) {\n index = 0;\n }\n if (speed === void 0) {\n speed = this.params.speed;\n }\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n if (typeof index === 'string') {\n index = parseInt(index, 10);\n }\n const swiper = this;\n let slideIndex = index;\n if (slideIndex < 0) slideIndex = 0;\n const {\n params,\n snapGrid,\n slidesGrid,\n previousIndex,\n activeIndex,\n rtlTranslate: rtl,\n wrapperEl,\n enabled\n } = swiper;\n if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial) {\n return false;\n }\n const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);\n let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);\n if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;\n const translate = -snapGrid[snapIndex];\n // Normalize slideIndex\n if (params.normalizeSlideIndex) {\n for (let i = 0; i < slidesGrid.length; i += 1) {\n const normalizedTranslate = -Math.floor(translate * 100);\n const normalizedGrid = Math.floor(slidesGrid[i] * 100);\n const normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100);\n if (typeof slidesGrid[i + 1] !== 'undefined') {\n if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) {\n slideIndex = i;\n } else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) {\n slideIndex = i + 1;\n }\n } else if (normalizedTranslate >= normalizedGrid) {\n slideIndex = i;\n }\n }\n }\n // Directions locks\n if (swiper.initialized && slideIndex !== activeIndex) {\n if (!swiper.allowSlideNext && (rtl ? translate > swiper.translate && translate > swiper.minTranslate() : translate < swiper.translate && translate < swiper.minTranslate())) {\n return false;\n }\n if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) {\n if ((activeIndex || 0) !== slideIndex) {\n return false;\n }\n }\n }\n if (slideIndex !== (previousIndex || 0) && runCallbacks) {\n swiper.emit('beforeSlideChangeStart');\n }\n\n // Update progress\n swiper.updateProgress(translate);\n let direction;\n if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset';\n\n // Update Index\n if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) {\n swiper.updateActiveIndex(slideIndex);\n // Update Height\n if (params.autoHeight) {\n swiper.updateAutoHeight();\n }\n swiper.updateSlidesClasses();\n if (params.effect !== 'slide') {\n swiper.setTranslate(translate);\n }\n if (direction !== 'reset') {\n swiper.transitionStart(runCallbacks, direction);\n swiper.transitionEnd(runCallbacks, direction);\n }\n return false;\n }\n if (params.cssMode) {\n const isH = swiper.isHorizontal();\n const t = rtl ? translate : -translate;\n if (speed === 0) {\n const isVirtual = swiper.virtual && swiper.params.virtual.enabled;\n if (isVirtual) {\n swiper.wrapperEl.style.scrollSnapType = 'none';\n swiper._immediateVirtual = true;\n }\n if (isVirtual && !swiper._cssModeVirtualInitialSet && swiper.params.initialSlide > 0) {\n swiper._cssModeVirtualInitialSet = true;\n requestAnimationFrame(() => {\n wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;\n });\n } else {\n wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;\n }\n if (isVirtual) {\n requestAnimationFrame(() => {\n swiper.wrapperEl.style.scrollSnapType = '';\n swiper._immediateVirtual = false;\n });\n }\n } else {\n if (!swiper.support.smoothScroll) {\n animateCSSModeScroll({\n swiper,\n targetPosition: t,\n side: isH ? 'left' : 'top'\n });\n return true;\n }\n wrapperEl.scrollTo({\n [isH ? 'left' : 'top']: t,\n behavior: 'smooth'\n });\n }\n return true;\n }\n swiper.setTransition(speed);\n swiper.setTranslate(translate);\n swiper.updateActiveIndex(slideIndex);\n swiper.updateSlidesClasses();\n swiper.emit('beforeTransitionStart', speed, internal);\n swiper.transitionStart(runCallbacks, direction);\n if (speed === 0) {\n swiper.transitionEnd(runCallbacks, direction);\n } else if (!swiper.animating) {\n swiper.animating = true;\n if (!swiper.onSlideToWrapperTransitionEnd) {\n swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) {\n if (!swiper || swiper.destroyed) return;\n if (e.target !== this) return;\n swiper.wrapperEl.removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);\n swiper.onSlideToWrapperTransitionEnd = null;\n delete swiper.onSlideToWrapperTransitionEnd;\n swiper.transitionEnd(runCallbacks, direction);\n };\n }\n swiper.wrapperEl.addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd);\n }\n return true;\n}\n\nfunction slideToLoop(index, speed, runCallbacks, internal) {\n if (index === void 0) {\n index = 0;\n }\n if (speed === void 0) {\n speed = this.params.speed;\n }\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n if (typeof index === 'string') {\n const indexAsNumber = parseInt(index, 10);\n index = indexAsNumber;\n }\n const swiper = this;\n let newIndex = index;\n if (swiper.params.loop) {\n if (swiper.virtual && swiper.params.virtual.enabled) {\n // eslint-disable-next-line\n newIndex = newIndex + swiper.virtual.slidesBefore;\n } else {\n newIndex = swiper.getSlideIndexByData(newIndex);\n }\n }\n return swiper.slideTo(newIndex, speed, runCallbacks, internal);\n}\n\n/* eslint no-unused-vars: \"off\" */\nfunction slideNext(speed, runCallbacks, internal) {\n if (speed === void 0) {\n speed = this.params.speed;\n }\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n const swiper = this;\n const {\n enabled,\n params,\n animating\n } = swiper;\n if (!enabled) return swiper;\n let perGroup = params.slidesPerGroup;\n if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {\n perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1);\n }\n const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup;\n const isVirtual = swiper.virtual && params.virtual.enabled;\n if (params.loop) {\n if (animating && !isVirtual && params.loopPreventsSliding) return false;\n swiper.loopFix({\n direction: 'next'\n });\n // eslint-disable-next-line\n swiper._clientLeft = swiper.wrapperEl.clientLeft;\n if (swiper.activeIndex === swiper.slides.length - 1 && params.cssMode) {\n requestAnimationFrame(() => {\n swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);\n });\n return true;\n }\n }\n if (params.rewind && swiper.isEnd) {\n return swiper.slideTo(0, speed, runCallbacks, internal);\n }\n return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal);\n}\n\n/* eslint no-unused-vars: \"off\" */\nfunction slidePrev(speed, runCallbacks, internal) {\n if (speed === void 0) {\n speed = this.params.speed;\n }\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n const swiper = this;\n const {\n params,\n snapGrid,\n slidesGrid,\n rtlTranslate,\n enabled,\n animating\n } = swiper;\n if (!enabled) return swiper;\n const isVirtual = swiper.virtual && params.virtual.enabled;\n if (params.loop) {\n if (animating && !isVirtual && params.loopPreventsSliding) return false;\n swiper.loopFix({\n direction: 'prev'\n });\n // eslint-disable-next-line\n swiper._clientLeft = swiper.wrapperEl.clientLeft;\n }\n const translate = rtlTranslate ? swiper.translate : -swiper.translate;\n function normalize(val) {\n if (val < 0) return -Math.floor(Math.abs(val));\n return Math.floor(val);\n }\n const normalizedTranslate = normalize(translate);\n const normalizedSnapGrid = snapGrid.map(val => normalize(val));\n let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];\n if (typeof prevSnap === 'undefined' && params.cssMode) {\n let prevSnapIndex;\n snapGrid.forEach((snap, snapIndex) => {\n if (normalizedTranslate >= snap) {\n // prevSnap = snap;\n prevSnapIndex = snapIndex;\n }\n });\n if (typeof prevSnapIndex !== 'undefined') {\n prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex];\n }\n }\n let prevIndex = 0;\n if (typeof prevSnap !== 'undefined') {\n prevIndex = slidesGrid.indexOf(prevSnap);\n if (prevIndex < 0) prevIndex = swiper.activeIndex - 1;\n if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {\n prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1;\n prevIndex = Math.max(prevIndex, 0);\n }\n }\n if (params.rewind && swiper.isBeginning) {\n const lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;\n return swiper.slideTo(lastIndex, speed, runCallbacks, internal);\n } else if (params.loop && swiper.activeIndex === 0 && params.cssMode) {\n requestAnimationFrame(() => {\n swiper.slideTo(prevIndex, speed, runCallbacks, internal);\n });\n return true;\n }\n return swiper.slideTo(prevIndex, speed, runCallbacks, internal);\n}\n\n/* eslint no-unused-vars: \"off\" */\nfunction slideReset(speed, runCallbacks, internal) {\n if (speed === void 0) {\n speed = this.params.speed;\n }\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n const swiper = this;\n return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);\n}\n\n/* eslint no-unused-vars: \"off\" */\nfunction slideToClosest(speed, runCallbacks, internal, threshold) {\n if (speed === void 0) {\n speed = this.params.speed;\n }\n if (runCallbacks === void 0) {\n runCallbacks = true;\n }\n if (threshold === void 0) {\n threshold = 0.5;\n }\n const swiper = this;\n let index = swiper.activeIndex;\n const skip = Math.min(swiper.params.slidesPerGroupSkip, index);\n const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);\n const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate;\n if (translate >= swiper.snapGrid[snapIndex]) {\n // The current translate is on or after the current snap index, so the choice\n // is between the current index and the one after it.\n const currentSnap = swiper.snapGrid[snapIndex];\n const nextSnap = swiper.snapGrid[snapIndex + 1];\n if (translate - currentSnap > (nextSnap - currentSnap) * threshold) {\n index += swiper.params.slidesPerGroup;\n }\n } else {\n // The current translate is before the current snap index, so the choice\n // is between the current index and the one before it.\n const prevSnap = swiper.snapGrid[snapIndex - 1];\n const currentSnap = swiper.snapGrid[snapIndex];\n if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) {\n index -= swiper.params.slidesPerGroup;\n }\n }\n index = Math.max(index, 0);\n index = Math.min(index, swiper.slidesGrid.length - 1);\n return swiper.slideTo(index, speed, runCallbacks, internal);\n}\n\nfunction slideToClickedSlide() {\n const swiper = this;\n const {\n params,\n slidesEl\n } = swiper;\n const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;\n let slideToIndex = swiper.clickedIndex;\n let realIndex;\n const slideSelector = swiper.isElement ? `swiper-slide` : `.${params.slideClass}`;\n if (params.loop) {\n if (swiper.animating) return;\n realIndex = parseInt(swiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10);\n if (params.centeredSlides) {\n if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) {\n swiper.loopFix();\n slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index=\"${realIndex}\"]`)[0]);\n nextTick(() => {\n swiper.slideTo(slideToIndex);\n });\n } else {\n swiper.slideTo(slideToIndex);\n }\n } else if (slideToIndex > swiper.slides.length - slidesPerView) {\n swiper.loopFix();\n slideToIndex = swiper.getSlideIndex(elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index=\"${realIndex}\"]`)[0]);\n nextTick(() => {\n swiper.slideTo(slideToIndex);\n });\n } else {\n swiper.slideTo(slideToIndex);\n }\n } else {\n swiper.slideTo(slideToIndex);\n }\n}\n\nvar slide = {\n slideTo,\n slideToLoop,\n slideNext,\n slidePrev,\n slideReset,\n slideToClosest,\n slideToClickedSlide\n};\n\nfunction loopCreate(slideRealIndex) {\n const swiper = this;\n const {\n params,\n slidesEl\n } = swiper;\n if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;\n const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);\n slides.forEach((el, index) => {\n el.setAttribute('data-swiper-slide-index', index);\n });\n swiper.loopFix({\n slideRealIndex,\n direction: params.centeredSlides ? undefined : 'next'\n });\n}\n\nfunction loopFix(_temp) {\n let {\n slideRealIndex,\n slideTo = true,\n direction,\n setTranslate,\n activeSlideIndex,\n byController,\n byMousewheel\n } = _temp === void 0 ? {} : _temp;\n const swiper = this;\n if (!swiper.params.loop) return;\n swiper.emit('beforeLoopFix');\n const {\n slides,\n allowSlidePrev,\n allowSlideNext,\n slidesEl,\n params\n } = swiper;\n swiper.allowSlidePrev = true;\n swiper.allowSlideNext = true;\n if (swiper.virtual && params.virtual.enabled) {\n if (slideTo) {\n if (!params.centeredSlides && swiper.snapIndex === 0) {\n swiper.slideTo(swiper.virtual.slides.length, 0, false, true);\n } else if (params.centeredSlides && swiper.snapIndex < params.slidesPerView) {\n swiper.slideTo(swiper.virtual.slides.length + swiper.snapIndex, 0, false, true);\n } else if (swiper.snapIndex === swiper.snapGrid.length - 1) {\n swiper.slideTo(swiper.virtual.slidesBefore, 0, false, true);\n }\n }\n swiper.allowSlidePrev = allowSlidePrev;\n swiper.allowSlideNext = allowSlideNext;\n swiper.emit('loopFix');\n return;\n }\n const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10));\n let loopedSlides = params.loopedSlides || slidesPerView;\n if (loopedSlides % params.slidesPerGroup !== 0) {\n loopedSlides += params.slidesPerGroup - loopedSlides % params.slidesPerGroup;\n }\n swiper.loopedSlides = loopedSlides;\n const prependSlidesIndexes = [];\n const appendSlidesIndexes = [];\n let activeIndex = swiper.activeIndex;\n if (typeof activeSlideIndex === 'undefined') {\n activeSlideIndex = swiper.getSlideIndex(swiper.slides.filter(el => el.classList.contains(params.slideActiveClass))[0]);\n } else {\n activeIndex = activeSlideIndex;\n }\n const isNext = direction === 'next' || !direction;\n const isPrev = direction === 'prev' || !direction;\n let slidesPrepended = 0;\n let slidesAppended = 0;\n // prepend last slides before start\n if (activeSlideIndex < loopedSlides) {\n slidesPrepended = Math.max(loopedSlides - activeSlideIndex, params.slidesPerGroup);\n for (let i = 0; i < loopedSlides - activeSlideIndex; i += 1) {\n const index = i - Math.floor(i / slides.length) * slides.length;\n prependSlidesIndexes.push(slides.length - index - 1);\n }\n } else if (activeSlideIndex /* + slidesPerView */ > swiper.slides.length - loopedSlides * 2) {\n slidesAppended = Math.max(activeSlideIndex - (swiper.slides.length - loopedSlides * 2), params.slidesPerGroup);\n for (let i = 0; i < slidesAppended; i += 1) {\n const index = i - Math.floor(i / slides.length) * slides.length;\n appendSlidesIndexes.push(index);\n }\n }\n if (isPrev) {\n prependSlidesIndexes.forEach(index => {\n swiper.slides[index].swiperLoopMoveDOM = true;\n slidesEl.prepend(swiper.slides[index]);\n swiper.slides[index].swiperLoopMoveDOM = false;\n });\n }\n if (isNext) {\n appendSlidesIndexes.forEach(index => {\n swiper.slides[index].swiperLoopMoveDOM = true;\n slidesEl.append(swiper.slides[index]);\n swiper.slides[index].swiperLoopMoveDOM = false;\n });\n }\n swiper.recalcSlides();\n if (params.slidesPerView === 'auto') {\n swiper.updateSlides();\n }\n if (params.watchSlidesProgress) {\n swiper.updateSlidesOffset();\n }\n if (slideTo) {\n if (prependSlidesIndexes.length > 0 && isPrev) {\n if (typeof slideRealIndex === 'undefined') {\n const currentSlideTranslate = swiper.slidesGrid[activeIndex];\n const newSlideTranslate = swiper.slidesGrid[activeIndex + slidesPrepended];\n const diff = newSlideTranslate - currentSlideTranslate;\n if (byMousewheel) {\n swiper.setTranslate(swiper.translate - diff);\n } else {\n swiper.slideTo(activeIndex + slidesPrepended, 0, false, true);\n if (setTranslate) {\n swiper.touches[swiper.isHorizontal() ? 'startX' : 'startY'] += diff;\n swiper.touchEventsData.currentTranslate = swiper.translate;\n }\n }\n } else {\n if (setTranslate) {\n swiper.slideToLoop(slideRealIndex, 0, false, true);\n swiper.touchEventsData.currentTranslate = swiper.translate;\n }\n }\n } else if (appendSlidesIndexes.length > 0 && isNext) {\n if (typeof slideRealIndex === 'undefined') {\n const currentSlideTranslate = swiper.slidesGrid[activeIndex];\n const newSlideTranslate = swiper.slidesGrid[activeIndex - slidesAppended];\n const diff = newSlideTranslate - currentSlideTranslate;\n if (byMousewheel) {\n swiper.setTranslate(swiper.translate - diff);\n } else {\n swiper.slideTo(activeIndex - slidesAppended, 0, false, true);\n if (setTranslate) {\n swiper.touches[swiper.isHorizontal() ? 'startX' : 'startY'] += diff;\n swiper.touchEventsData.currentTranslate = swiper.translate;\n }\n }\n } else {\n swiper.slideToLoop(slideRealIndex, 0, false, true);\n }\n }\n }\n swiper.allowSlidePrev = allowSlidePrev;\n swiper.allowSlideNext = allowSlideNext;\n if (swiper.controller && swiper.controller.control && !byController) {\n const loopParams = {\n slideRealIndex,\n direction,\n setTranslate,\n activeSlideIndex,\n byController: true\n };\n if (Array.isArray(swiper.controller.control)) {\n swiper.controller.control.forEach(c => {\n if (!c.destroyed && c.params.loop) c.loopFix({\n ...loopParams,\n slideTo: c.params.slidesPerView === params.slidesPerView ? slideTo : false\n });\n });\n } else if (swiper.controller.control instanceof swiper.constructor && swiper.controller.control.params.loop) {\n swiper.controller.control.loopFix({\n ...loopParams,\n slideTo: swiper.controller.control.params.slidesPerView === params.slidesPerView ? slideTo : false\n });\n }\n }\n swiper.emit('loopFix');\n}\n\nfunction loopDestroy() {\n const swiper = this;\n const {\n params,\n slidesEl\n } = swiper;\n if (!params.loop || swiper.virtual && swiper.params.virtual.enabled) return;\n swiper.recalcSlides();\n const newSlidesOrder = [];\n swiper.slides.forEach(slideEl => {\n const index = typeof slideEl.swiperSlideIndex === 'undefined' ? slideEl.getAttribute('data-swiper-slide-index') * 1 : slideEl.swiperSlideIndex;\n newSlidesOrder[index] = slideEl;\n });\n swiper.slides.forEach(slideEl => {\n slideEl.removeAttribute('data-swiper-slide-index');\n });\n newSlidesOrder.forEach(slideEl => {\n slidesEl.append(slideEl);\n });\n swiper.recalcSlides();\n swiper.slideTo(swiper.realIndex, 0);\n}\n\nvar loop = {\n loopCreate,\n loopFix,\n loopDestroy\n};\n\nfunction setGrabCursor(moving) {\n const swiper = this;\n if (!swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return;\n const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl;\n if (swiper.isElement) {\n swiper.__preventObserver__ = true;\n }\n el.style.cursor = 'move';\n el.style.cursor = moving ? 'grabbing' : 'grab';\n if (swiper.isElement) {\n requestAnimationFrame(() => {\n swiper.__preventObserver__ = false;\n });\n }\n}\n\nfunction unsetGrabCursor() {\n const swiper = this;\n if (swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) {\n return;\n }\n if (swiper.isElement) {\n swiper.__preventObserver__ = true;\n }\n swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = '';\n if (swiper.isElement) {\n requestAnimationFrame(() => {\n swiper.__preventObserver__ = false;\n });\n }\n}\n\nvar grabCursor = {\n setGrabCursor,\n unsetGrabCursor\n};\n\n// Modified from https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd\nfunction closestElement(selector, base) {\n if (base === void 0) {\n base = this;\n }\n function __closestFrom(el) {\n if (!el || el === getDocument() || el === getWindow()) return null;\n if (el.assignedSlot) el = el.assignedSlot;\n const found = el.closest(selector);\n if (!found && !el.getRootNode) {\n return null;\n }\n return found || __closestFrom(el.getRootNode().host);\n }\n return __closestFrom(base);\n}\nfunction onTouchStart(event) {\n const swiper = this;\n const document = getDocument();\n const window = getWindow();\n const data = swiper.touchEventsData;\n data.evCache.push(event);\n const {\n params,\n touches,\n enabled\n } = swiper;\n if (!enabled) return;\n if (!params.simulateTouch && event.pointerType === 'mouse') return;\n if (swiper.animating && params.preventInteractionOnTransition) {\n return;\n }\n if (!swiper.animating && params.cssMode && params.loop) {\n swiper.loopFix();\n }\n let e = event;\n if (e.originalEvent) e = e.originalEvent;\n let targetEl = e.target;\n if (params.touchEventsTarget === 'wrapper') {\n if (!swiper.wrapperEl.contains(targetEl)) return;\n }\n if ('which' in e && e.which === 3) return;\n if ('button' in e && e.button > 0) return;\n if (data.isTouched && data.isMoved) return;\n\n // change target el for shadow root component\n const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';\n // eslint-disable-next-line\n const eventPath = event.composedPath ? event.composedPath() : event.path;\n if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) {\n targetEl = eventPath[0];\n }\n const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`;\n const isTargetShadow = !!(e.target && e.target.shadowRoot);\n\n // use closestElement for shadow root element to get the actual closest for nested shadow root element\n if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, targetEl) : targetEl.closest(noSwipingSelector))) {\n swiper.allowClick = true;\n return;\n }\n if (params.swipeHandler) {\n if (!targetEl.closest(params.swipeHandler)) return;\n }\n touches.currentX = e.pageX;\n touches.currentY = e.pageY;\n const startX = touches.currentX;\n const startY = touches.currentY;\n\n // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore\n\n const edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection;\n const edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold;\n if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window.innerWidth - edgeSwipeThreshold)) {\n if (edgeSwipeDetection === 'prevent') {\n event.preventDefault();\n } else {\n return;\n }\n }\n Object.assign(data, {\n isTouched: true,\n isMoved: false,\n allowTouchCallbacks: true,\n isScrolling: undefined,\n startMoving: undefined\n });\n touches.startX = startX;\n touches.startY = startY;\n data.touchStartTime = now();\n swiper.allowClick = true;\n swiper.updateSize();\n swiper.swipeDirection = undefined;\n if (params.threshold > 0) data.allowThresholdMove = false;\n let preventDefault = true;\n if (targetEl.matches(data.focusableElements)) {\n preventDefault = false;\n if (targetEl.nodeName === 'SELECT') {\n data.isTouched = false;\n }\n }\n if (document.activeElement && document.activeElement.matches(data.focusableElements) && document.activeElement !== targetEl) {\n document.activeElement.blur();\n }\n const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault;\n if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !targetEl.isContentEditable) {\n e.preventDefault();\n }\n if (params.freeMode && params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) {\n swiper.freeMode.onTouchStart();\n }\n swiper.emit('touchStart', e);\n}\n\nfunction onTouchMove(event) {\n const document = getDocument();\n const swiper = this;\n const data = swiper.touchEventsData;\n const {\n params,\n touches,\n rtlTranslate: rtl,\n enabled\n } = swiper;\n if (!enabled) return;\n if (!params.simulateTouch && event.pointerType === 'mouse') return;\n let e = event;\n if (e.originalEvent) e = e.originalEvent;\n if (!data.isTouched) {\n if (data.startMoving && data.isScrolling) {\n swiper.emit('touchMoveOpposite', e);\n }\n return;\n }\n const pointerIndex = data.evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId);\n if (pointerIndex >= 0) data.evCache[pointerIndex] = e;\n const targetTouch = data.evCache.length > 1 ? data.evCache[0] : e;\n const pageX = targetTouch.pageX;\n const pageY = targetTouch.pageY;\n if (e.preventedByNestedSwiper) {\n touches.startX = pageX;\n touches.startY = pageY;\n return;\n }\n if (!swiper.allowTouchMove) {\n if (!e.target.matches(data.focusableElements)) {\n swiper.allowClick = false;\n }\n if (data.isTouched) {\n Object.assign(touches, {\n startX: pageX,\n startY: pageY,\n prevX: swiper.touches.currentX,\n prevY: swiper.touches.currentY,\n currentX: pageX,\n currentY: pageY\n });\n data.touchStartTime = now();\n }\n return;\n }\n if (params.touchReleaseOnEdges && !params.loop) {\n if (swiper.isVertical()) {\n // Vertical\n if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) {\n data.isTouched = false;\n data.isMoved = false;\n return;\n }\n } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) {\n return;\n }\n }\n if (document.activeElement) {\n if (e.target === document.activeElement && e.target.matches(data.focusableElements)) {\n data.isMoved = true;\n swiper.allowClick = false;\n return;\n }\n }\n if (data.allowTouchCallbacks) {\n swiper.emit('touchMove', e);\n }\n if (e.targetTouches && e.targetTouches.length > 1) return;\n touches.currentX = pageX;\n touches.currentY = pageY;\n const diffX = touches.currentX - touches.startX;\n const diffY = touches.currentY - touches.startY;\n if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return;\n if (typeof data.isScrolling === 'undefined') {\n let touchAngle;\n if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) {\n data.isScrolling = false;\n } else {\n // eslint-disable-next-line\n if (diffX * diffX + diffY * diffY >= 25) {\n touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI;\n data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle;\n }\n }\n }\n if (data.isScrolling) {\n swiper.emit('touchMoveOpposite', e);\n }\n if (typeof data.startMoving === 'undefined') {\n if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) {\n data.startMoving = true;\n }\n }\n if (data.isScrolling || swiper.zoom && swiper.params.zoom && swiper.params.zoom.enabled && data.evCache.length > 1) {\n data.isTouched = false;\n return;\n }\n if (!data.startMoving) {\n return;\n }\n swiper.allowClick = false;\n if (!params.cssMode && e.cancelable) {\n e.preventDefault();\n }\n if (params.touchMoveStopPropagation && !params.nested) {\n e.stopPropagation();\n }\n let diff = swiper.isHorizontal() ? diffX : diffY;\n let touchesDiff = swiper.isHorizontal() ? touches.currentX - touches.previousX : touches.currentY - touches.previousY;\n if (params.oneWayMovement) {\n diff = Math.abs(diff) * (rtl ? 1 : -1);\n touchesDiff = Math.abs(touchesDiff) * (rtl ? 1 : -1);\n }\n touches.diff = diff;\n diff *= params.touchRatio;\n if (rtl) {\n diff = -diff;\n touchesDiff = -touchesDiff;\n }\n const prevTouchesDirection = swiper.touchesDirection;\n swiper.swipeDirection = diff > 0 ? 'prev' : 'next';\n swiper.touchesDirection = touchesDiff > 0 ? 'prev' : 'next';\n const isLoop = swiper.params.loop && !params.cssMode;\n const allowLoopFix = swiper.swipeDirection === 'next' && swiper.allowSlideNext || swiper.swipeDirection === 'prev' && swiper.allowSlidePrev;\n if (!data.isMoved) {\n if (isLoop && allowLoopFix) {\n swiper.loopFix({\n direction: swiper.swipeDirection\n });\n }\n data.startTranslate = swiper.getTranslate();\n swiper.setTransition(0);\n if (swiper.animating) {\n const evt = new window.CustomEvent('transitionend', {\n bubbles: true,\n cancelable: true\n });\n swiper.wrapperEl.dispatchEvent(evt);\n }\n data.allowMomentumBounce = false;\n // Grab Cursor\n if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {\n swiper.setGrabCursor(true);\n }\n swiper.emit('sliderFirstMove', e);\n }\n let loopFixed;\n if (data.isMoved && prevTouchesDirection !== swiper.touchesDirection && isLoop && allowLoopFix && Math.abs(diff) >= 1) {\n // need another loop fix\n swiper.loopFix({\n direction: swiper.swipeDirection,\n setTranslate: true\n });\n loopFixed = true;\n }\n swiper.emit('sliderMove', e);\n data.isMoved = true;\n data.currentTranslate = diff + data.startTranslate;\n let disableParentSwiper = true;\n let resistanceRatio = params.resistanceRatio;\n if (params.touchReleaseOnEdges) {\n resistanceRatio = 0;\n }\n if (diff > 0) {\n if (isLoop && allowLoopFix && !loopFixed && data.currentTranslate > (params.centeredSlides ? swiper.minTranslate() - swiper.size / 2 : swiper.minTranslate())) {\n swiper.loopFix({\n direction: 'prev',\n setTranslate: true,\n activeSlideIndex: 0\n });\n }\n if (data.currentTranslate > swiper.minTranslate()) {\n disableParentSwiper = false;\n if (params.resistance) {\n data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio;\n }\n }\n } else if (diff < 0) {\n if (isLoop && allowLoopFix && !loopFixed && data.currentTranslate < (params.centeredSlides ? swiper.maxTranslate() + swiper.size / 2 : swiper.maxTranslate())) {\n swiper.loopFix({\n direction: 'next',\n setTranslate: true,\n activeSlideIndex: swiper.slides.length - (params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10)))\n });\n }\n if (data.currentTranslate < swiper.maxTranslate()) {\n disableParentSwiper = false;\n if (params.resistance) {\n data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio;\n }\n }\n }\n if (disableParentSwiper) {\n e.preventedByNestedSwiper = true;\n }\n\n // Directions locks\n if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) {\n data.currentTranslate = data.startTranslate;\n }\n if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) {\n data.currentTranslate = data.startTranslate;\n }\n if (!swiper.allowSlidePrev && !swiper.allowSlideNext) {\n data.currentTranslate = data.startTranslate;\n }\n\n // Threshold\n if (params.threshold > 0) {\n if (Math.abs(diff) > params.threshold || data.allowThresholdMove) {\n if (!data.allowThresholdMove) {\n data.allowThresholdMove = true;\n touches.startX = touches.currentX;\n touches.startY = touches.currentY;\n data.currentTranslate = data.startTranslate;\n touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY;\n return;\n }\n } else {\n data.currentTranslate = data.startTranslate;\n return;\n }\n }\n if (!params.followFinger || params.cssMode) return;\n\n // Update active index in free mode\n if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) {\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n }\n if (params.freeMode && params.freeMode.enabled && swiper.freeMode) {\n swiper.freeMode.onTouchMove();\n }\n // Update progress\n swiper.updateProgress(data.currentTranslate);\n // Update translate\n swiper.setTranslate(data.currentTranslate);\n}\n\nfunction onTouchEnd(event) {\n const swiper = this;\n const data = swiper.touchEventsData;\n const pointerIndex = data.evCache.findIndex(cachedEv => cachedEv.pointerId === event.pointerId);\n if (pointerIndex >= 0) {\n data.evCache.splice(pointerIndex, 1);\n }\n if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(event.type)) {\n const proceed = ['pointercancel', 'contextmenu'].includes(event.type) && (swiper.browser.isSafari || swiper.browser.isWebView);\n if (!proceed) {\n return;\n }\n }\n const {\n params,\n touches,\n rtlTranslate: rtl,\n slidesGrid,\n enabled\n } = swiper;\n if (!enabled) return;\n if (!params.simulateTouch && event.pointerType === 'mouse') return;\n let e = event;\n if (e.originalEvent) e = e.originalEvent;\n if (data.allowTouchCallbacks) {\n swiper.emit('touchEnd', e);\n }\n data.allowTouchCallbacks = false;\n if (!data.isTouched) {\n if (data.isMoved && params.grabCursor) {\n swiper.setGrabCursor(false);\n }\n data.isMoved = false;\n data.startMoving = false;\n return;\n }\n // Return Grab Cursor\n if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {\n swiper.setGrabCursor(false);\n }\n\n // Time diff\n const touchEndTime = now();\n const timeDiff = touchEndTime - data.touchStartTime;\n\n // Tap, doubleTap, Click\n if (swiper.allowClick) {\n const pathTree = e.path || e.composedPath && e.composedPath();\n swiper.updateClickedSlide(pathTree && pathTree[0] || e.target, pathTree);\n swiper.emit('tap click', e);\n if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) {\n swiper.emit('doubleTap doubleClick', e);\n }\n }\n data.lastClickTime = now();\n nextTick(() => {\n if (!swiper.destroyed) swiper.allowClick = true;\n });\n if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) {\n data.isTouched = false;\n data.isMoved = false;\n data.startMoving = false;\n return;\n }\n data.isTouched = false;\n data.isMoved = false;\n data.startMoving = false;\n let currentPos;\n if (params.followFinger) {\n currentPos = rtl ? swiper.translate : -swiper.translate;\n } else {\n currentPos = -data.currentTranslate;\n }\n if (params.cssMode) {\n return;\n }\n if (params.freeMode && params.freeMode.enabled) {\n swiper.freeMode.onTouchEnd({\n currentPos\n });\n return;\n }\n\n // Find current slide\n let stopIndex = 0;\n let groupSize = swiper.slidesSizesGrid[0];\n for (let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup) {\n const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;\n if (typeof slidesGrid[i + increment] !== 'undefined') {\n if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) {\n stopIndex = i;\n groupSize = slidesGrid[i + increment] - slidesGrid[i];\n }\n } else if (currentPos >= slidesGrid[i]) {\n stopIndex = i;\n groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2];\n }\n }\n let rewindFirstIndex = null;\n let rewindLastIndex = null;\n if (params.rewind) {\n if (swiper.isBeginning) {\n rewindLastIndex = params.virtual && params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1;\n } else if (swiper.isEnd) {\n rewindFirstIndex = 0;\n }\n }\n // Find current slide size\n const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize;\n const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;\n if (timeDiff > params.longSwipesMs) {\n // Long touches\n if (!params.longSwipes) {\n swiper.slideTo(swiper.activeIndex);\n return;\n }\n if (swiper.swipeDirection === 'next') {\n if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment);else swiper.slideTo(stopIndex);\n }\n if (swiper.swipeDirection === 'prev') {\n if (ratio > 1 - params.longSwipesRatio) {\n swiper.slideTo(stopIndex + increment);\n } else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) {\n swiper.slideTo(rewindLastIndex);\n } else {\n swiper.slideTo(stopIndex);\n }\n }\n } else {\n // Short swipes\n if (!params.shortSwipes) {\n swiper.slideTo(swiper.activeIndex);\n return;\n }\n const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl);\n if (!isNavButtonTarget) {\n if (swiper.swipeDirection === 'next') {\n swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment);\n }\n if (swiper.swipeDirection === 'prev') {\n swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex);\n }\n } else if (e.target === swiper.navigation.nextEl) {\n swiper.slideTo(stopIndex + increment);\n } else {\n swiper.slideTo(stopIndex);\n }\n }\n}\n\nfunction onResize() {\n const swiper = this;\n const {\n params,\n el\n } = swiper;\n if (el && el.offsetWidth === 0) return;\n\n // Breakpoints\n if (params.breakpoints) {\n swiper.setBreakpoint();\n }\n\n // Save locks\n const {\n allowSlideNext,\n allowSlidePrev,\n snapGrid\n } = swiper;\n const isVirtual = swiper.virtual && swiper.params.virtual.enabled;\n\n // Disable locks on resize\n swiper.allowSlideNext = true;\n swiper.allowSlidePrev = true;\n swiper.updateSize();\n swiper.updateSlides();\n swiper.updateSlidesClasses();\n const isVirtualLoop = isVirtual && params.loop;\n if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides && !isVirtualLoop) {\n swiper.slideTo(swiper.slides.length - 1, 0, false, true);\n } else {\n if (swiper.params.loop && !isVirtual) {\n swiper.slideToLoop(swiper.realIndex, 0, false, true);\n } else {\n swiper.slideTo(swiper.activeIndex, 0, false, true);\n }\n }\n if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {\n clearTimeout(swiper.autoplay.resizeTimeout);\n swiper.autoplay.resizeTimeout = setTimeout(() => {\n if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {\n swiper.autoplay.resume();\n }\n }, 500);\n }\n // Return locks after resize\n swiper.allowSlidePrev = allowSlidePrev;\n swiper.allowSlideNext = allowSlideNext;\n if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) {\n swiper.checkOverflow();\n }\n}\n\nfunction onClick(e) {\n const swiper = this;\n if (!swiper.enabled) return;\n if (!swiper.allowClick) {\n if (swiper.params.preventClicks) e.preventDefault();\n if (swiper.params.preventClicksPropagation && swiper.animating) {\n e.stopPropagation();\n e.stopImmediatePropagation();\n }\n }\n}\n\nfunction onScroll() {\n const swiper = this;\n const {\n wrapperEl,\n rtlTranslate,\n enabled\n } = swiper;\n if (!enabled) return;\n swiper.previousTranslate = swiper.translate;\n if (swiper.isHorizontal()) {\n swiper.translate = -wrapperEl.scrollLeft;\n } else {\n swiper.translate = -wrapperEl.scrollTop;\n }\n // eslint-disable-next-line\n if (swiper.translate === 0) swiper.translate = 0;\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n let newProgress;\n const translatesDiff = swiper.maxTranslate() - swiper.minTranslate();\n if (translatesDiff === 0) {\n newProgress = 0;\n } else {\n newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff;\n }\n if (newProgress !== swiper.progress) {\n swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate);\n }\n swiper.emit('setTranslate', swiper.translate, false);\n}\n\nfunction onLoad(e) {\n const swiper = this;\n processLazyPreloader(swiper, e.target);\n if (swiper.params.cssMode || swiper.params.slidesPerView !== 'auto' && !swiper.params.autoHeight) {\n return;\n }\n swiper.update();\n}\n\nlet dummyEventAttached = false;\nfunction dummyEventListener() {}\nconst events = (swiper, method) => {\n const document = getDocument();\n const {\n params,\n el,\n wrapperEl,\n device\n } = swiper;\n const capture = !!params.nested;\n const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener';\n const swiperMethod = method;\n\n // Touch Events\n el[domMethod]('pointerdown', swiper.onTouchStart, {\n passive: false\n });\n document[domMethod]('pointermove', swiper.onTouchMove, {\n passive: false,\n capture\n });\n document[domMethod]('pointerup', swiper.onTouchEnd, {\n passive: true\n });\n document[domMethod]('pointercancel', swiper.onTouchEnd, {\n passive: true\n });\n document[domMethod]('pointerout', swiper.onTouchEnd, {\n passive: true\n });\n document[domMethod]('pointerleave', swiper.onTouchEnd, {\n passive: true\n });\n document[domMethod]('contextmenu', swiper.onTouchEnd, {\n passive: true\n });\n\n // Prevent Links Clicks\n if (params.preventClicks || params.preventClicksPropagation) {\n el[domMethod]('click', swiper.onClick, true);\n }\n if (params.cssMode) {\n wrapperEl[domMethod]('scroll', swiper.onScroll);\n }\n\n // Resize handler\n if (params.updateOnWindowResize) {\n swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true);\n } else {\n swiper[swiperMethod]('observerUpdate', onResize, true);\n }\n\n // Images loader\n el[domMethod]('load', swiper.onLoad, {\n capture: true\n });\n};\nfunction attachEvents() {\n const swiper = this;\n const document = getDocument();\n const {\n params\n } = swiper;\n swiper.onTouchStart = onTouchStart.bind(swiper);\n swiper.onTouchMove = onTouchMove.bind(swiper);\n swiper.onTouchEnd = onTouchEnd.bind(swiper);\n if (params.cssMode) {\n swiper.onScroll = onScroll.bind(swiper);\n }\n swiper.onClick = onClick.bind(swiper);\n swiper.onLoad = onLoad.bind(swiper);\n if (!dummyEventAttached) {\n document.addEventListener('touchstart', dummyEventListener);\n dummyEventAttached = true;\n }\n events(swiper, 'on');\n}\nfunction detachEvents() {\n const swiper = this;\n events(swiper, 'off');\n}\nvar events$1 = {\n attachEvents,\n detachEvents\n};\n\nconst isGridEnabled = (swiper, params) => {\n return swiper.grid && params.grid && params.grid.rows > 1;\n};\nfunction setBreakpoint() {\n const swiper = this;\n const {\n realIndex,\n initialized,\n params,\n el\n } = swiper;\n const breakpoints = params.breakpoints;\n if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return;\n\n // Get breakpoint for window width and update parameters\n const breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el);\n if (!breakpoint || swiper.currentBreakpoint === breakpoint) return;\n const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;\n const breakpointParams = breakpointOnlyParams || swiper.originalParams;\n const wasMultiRow = isGridEnabled(swiper, params);\n const isMultiRow = isGridEnabled(swiper, breakpointParams);\n const wasEnabled = params.enabled;\n if (wasMultiRow && !isMultiRow) {\n el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`);\n swiper.emitContainerClasses();\n } else if (!wasMultiRow && isMultiRow) {\n el.classList.add(`${params.containerModifierClass}grid`);\n if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') {\n el.classList.add(`${params.containerModifierClass}grid-column`);\n }\n swiper.emitContainerClasses();\n }\n\n // Toggle navigation, pagination, scrollbar\n ['navigation', 'pagination', 'scrollbar'].forEach(prop => {\n if (typeof breakpointParams[prop] === 'undefined') return;\n const wasModuleEnabled = params[prop] && params[prop].enabled;\n const isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled;\n if (wasModuleEnabled && !isModuleEnabled) {\n swiper[prop].disable();\n }\n if (!wasModuleEnabled && isModuleEnabled) {\n swiper[prop].enable();\n }\n });\n const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;\n const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);\n const wasLoop = params.loop;\n if (directionChanged && initialized) {\n swiper.changeDirection();\n }\n extend(swiper.params, breakpointParams);\n const isEnabled = swiper.params.enabled;\n const hasLoop = swiper.params.loop;\n Object.assign(swiper, {\n allowTouchMove: swiper.params.allowTouchMove,\n allowSlideNext: swiper.params.allowSlideNext,\n allowSlidePrev: swiper.params.allowSlidePrev\n });\n if (wasEnabled && !isEnabled) {\n swiper.disable();\n } else if (!wasEnabled && isEnabled) {\n swiper.enable();\n }\n swiper.currentBreakpoint = breakpoint;\n swiper.emit('_beforeBreakpoint', breakpointParams);\n if (initialized) {\n if (needsReLoop) {\n swiper.loopDestroy();\n swiper.loopCreate(realIndex);\n swiper.updateSlides();\n } else if (!wasLoop && hasLoop) {\n swiper.loopCreate(realIndex);\n swiper.updateSlides();\n } else if (wasLoop && !hasLoop) {\n swiper.loopDestroy();\n }\n }\n swiper.emit('breakpoint', breakpointParams);\n}\n\nfunction getBreakpoint(breakpoints, base, containerEl) {\n if (base === void 0) {\n base = 'window';\n }\n if (!breakpoints || base === 'container' && !containerEl) return undefined;\n let breakpoint = false;\n const window = getWindow();\n const currentHeight = base === 'window' ? window.innerHeight : containerEl.clientHeight;\n const points = Object.keys(breakpoints).map(point => {\n if (typeof point === 'string' && point.indexOf('@') === 0) {\n const minRatio = parseFloat(point.substr(1));\n const value = currentHeight * minRatio;\n return {\n value,\n point\n };\n }\n return {\n value: point,\n point\n };\n });\n points.sort((a, b) => parseInt(a.value, 10) - parseInt(b.value, 10));\n for (let i = 0; i < points.length; i += 1) {\n const {\n point,\n value\n } = points[i];\n if (base === 'window') {\n if (window.matchMedia(`(min-width: ${value}px)`).matches) {\n breakpoint = point;\n }\n } else if (value <= containerEl.clientWidth) {\n breakpoint = point;\n }\n }\n return breakpoint || 'max';\n}\n\nvar breakpoints = {\n setBreakpoint,\n getBreakpoint\n};\n\nfunction prepareClasses(entries, prefix) {\n const resultClasses = [];\n entries.forEach(item => {\n if (typeof item === 'object') {\n Object.keys(item).forEach(classNames => {\n if (item[classNames]) {\n resultClasses.push(prefix + classNames);\n }\n });\n } else if (typeof item === 'string') {\n resultClasses.push(prefix + item);\n }\n });\n return resultClasses;\n}\nfunction addClasses() {\n const swiper = this;\n const {\n classNames,\n params,\n rtl,\n el,\n device\n } = swiper;\n // prettier-ignore\n const suffixes = prepareClasses(['initialized', params.direction, {\n 'free-mode': swiper.params.freeMode && params.freeMode.enabled\n }, {\n 'autoheight': params.autoHeight\n }, {\n 'rtl': rtl\n }, {\n 'grid': params.grid && params.grid.rows > 1\n }, {\n 'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column'\n }, {\n 'android': device.android\n }, {\n 'ios': device.ios\n }, {\n 'css-mode': params.cssMode\n }, {\n 'centered': params.cssMode && params.centeredSlides\n }, {\n 'watch-progress': params.watchSlidesProgress\n }], params.containerModifierClass);\n classNames.push(...suffixes);\n el.classList.add(...classNames);\n swiper.emitContainerClasses();\n}\n\nfunction removeClasses() {\n const swiper = this;\n const {\n el,\n classNames\n } = swiper;\n el.classList.remove(...classNames);\n swiper.emitContainerClasses();\n}\n\nvar classes = {\n addClasses,\n removeClasses\n};\n\nfunction checkOverflow() {\n const swiper = this;\n const {\n isLocked: wasLocked,\n params\n } = swiper;\n const {\n slidesOffsetBefore\n } = params;\n if (slidesOffsetBefore) {\n const lastSlideIndex = swiper.slides.length - 1;\n const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2;\n swiper.isLocked = swiper.size > lastSlideRightEdge;\n } else {\n swiper.isLocked = swiper.snapGrid.length === 1;\n }\n if (params.allowSlideNext === true) {\n swiper.allowSlideNext = !swiper.isLocked;\n }\n if (params.allowSlidePrev === true) {\n swiper.allowSlidePrev = !swiper.isLocked;\n }\n if (wasLocked && wasLocked !== swiper.isLocked) {\n swiper.isEnd = false;\n }\n if (wasLocked !== swiper.isLocked) {\n swiper.emit(swiper.isLocked ? 'lock' : 'unlock');\n }\n}\nvar checkOverflow$1 = {\n checkOverflow\n};\n\nvar defaults = {\n init: true,\n direction: 'horizontal',\n oneWayMovement: false,\n touchEventsTarget: 'wrapper',\n initialSlide: 0,\n speed: 300,\n cssMode: false,\n updateOnWindowResize: true,\n resizeObserver: true,\n nested: false,\n createElements: false,\n enabled: true,\n focusableElements: 'input, select, option, textarea, button, video, label',\n // Overrides\n width: null,\n height: null,\n //\n preventInteractionOnTransition: false,\n // ssr\n userAgent: null,\n url: null,\n // To support iOS's swipe-to-go-back gesture (when being used in-app).\n edgeSwipeDetection: false,\n edgeSwipeThreshold: 20,\n // Autoheight\n autoHeight: false,\n // Set wrapper width\n setWrapperSize: false,\n // Virtual Translate\n virtualTranslate: false,\n // Effects\n effect: 'slide',\n // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'\n\n // Breakpoints\n breakpoints: undefined,\n breakpointsBase: 'window',\n // Slides grid\n spaceBetween: 0,\n slidesPerView: 1,\n slidesPerGroup: 1,\n slidesPerGroupSkip: 0,\n slidesPerGroupAuto: false,\n centeredSlides: false,\n centeredSlidesBounds: false,\n slidesOffsetBefore: 0,\n // in px\n slidesOffsetAfter: 0,\n // in px\n normalizeSlideIndex: true,\n centerInsufficientSlides: false,\n // Disable swiper and hide navigation when container not overflow\n watchOverflow: true,\n // Round length\n roundLengths: false,\n // Touches\n touchRatio: 1,\n touchAngle: 45,\n simulateTouch: true,\n shortSwipes: true,\n longSwipes: true,\n longSwipesRatio: 0.5,\n longSwipesMs: 300,\n followFinger: true,\n allowTouchMove: true,\n threshold: 5,\n touchMoveStopPropagation: false,\n touchStartPreventDefault: true,\n touchStartForcePreventDefault: false,\n touchReleaseOnEdges: false,\n // Unique Navigation Elements\n uniqueNavElements: true,\n // Resistance\n resistance: true,\n resistanceRatio: 0.85,\n // Progress\n watchSlidesProgress: false,\n // Cursor\n grabCursor: false,\n // Clicks\n preventClicks: true,\n preventClicksPropagation: true,\n slideToClickedSlide: false,\n // loop\n loop: false,\n loopedSlides: null,\n loopPreventsSliding: true,\n // rewind\n rewind: false,\n // Swiping/no swiping\n allowSlidePrev: true,\n allowSlideNext: true,\n swipeHandler: null,\n // '.swipe-handler',\n noSwiping: true,\n noSwipingClass: 'swiper-no-swiping',\n noSwipingSelector: null,\n // Passive Listeners\n passiveListeners: true,\n maxBackfaceHiddenSlides: 10,\n // NS\n containerModifierClass: 'swiper-',\n // NEW\n slideClass: 'swiper-slide',\n slideActiveClass: 'swiper-slide-active',\n slideVisibleClass: 'swiper-slide-visible',\n slideNextClass: 'swiper-slide-next',\n slidePrevClass: 'swiper-slide-prev',\n wrapperClass: 'swiper-wrapper',\n lazyPreloaderClass: 'swiper-lazy-preloader',\n lazyPreloadPrevNext: 0,\n // Callbacks\n runCallbacksOnInit: true,\n // Internals\n _emitClasses: false\n};\n\nfunction moduleExtendParams(params, allModulesParams) {\n return function extendParams(obj) {\n if (obj === void 0) {\n obj = {};\n }\n const moduleParamName = Object.keys(obj)[0];\n const moduleParams = obj[moduleParamName];\n if (typeof moduleParams !== 'object' || moduleParams === null) {\n extend(allModulesParams, obj);\n return;\n }\n if (params[moduleParamName] === true) {\n params[moduleParamName] = {\n enabled: true\n };\n }\n if (moduleParamName === 'navigation' && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].prevEl && !params[moduleParamName].nextEl) {\n params[moduleParamName].auto = true;\n }\n if (['pagination', 'scrollbar'].indexOf(moduleParamName) >= 0 && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].el) {\n params[moduleParamName].auto = true;\n }\n if (!(moduleParamName in params && 'enabled' in moduleParams)) {\n extend(allModulesParams, obj);\n return;\n }\n if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) {\n params[moduleParamName].enabled = true;\n }\n if (!params[moduleParamName]) params[moduleParamName] = {\n enabled: false\n };\n extend(allModulesParams, obj);\n };\n}\n\n/* eslint no-param-reassign: \"off\" */\nconst prototypes = {\n eventsEmitter,\n update,\n translate,\n transition,\n slide,\n loop,\n grabCursor,\n events: events$1,\n breakpoints,\n checkOverflow: checkOverflow$1,\n classes\n};\nconst extendedDefaults = {};\nclass Swiper {\n constructor() {\n let el;\n let params;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') {\n params = args[0];\n } else {\n [el, params] = args;\n }\n if (!params) params = {};\n params = extend({}, params);\n if (el && !params.el) params.el = el;\n const document = getDocument();\n if (params.el && typeof params.el === 'string' && document.querySelectorAll(params.el).length > 1) {\n const swipers = [];\n document.querySelectorAll(params.el).forEach(containerEl => {\n const newParams = extend({}, params, {\n el: containerEl\n });\n swipers.push(new Swiper(newParams));\n });\n // eslint-disable-next-line no-constructor-return\n return swipers;\n }\n\n // Swiper Instance\n const swiper = this;\n swiper.__swiper__ = true;\n swiper.support = getSupport();\n swiper.device = getDevice({\n userAgent: params.userAgent\n });\n swiper.browser = getBrowser();\n swiper.eventsListeners = {};\n swiper.eventsAnyListeners = [];\n swiper.modules = [...swiper.__modules__];\n if (params.modules && Array.isArray(params.modules)) {\n swiper.modules.push(...params.modules);\n }\n const allModulesParams = {};\n swiper.modules.forEach(mod => {\n mod({\n params,\n swiper,\n extendParams: moduleExtendParams(params, allModulesParams),\n on: swiper.on.bind(swiper),\n once: swiper.once.bind(swiper),\n off: swiper.off.bind(swiper),\n emit: swiper.emit.bind(swiper)\n });\n });\n\n // Extend defaults with modules params\n const swiperParams = extend({}, defaults, allModulesParams);\n\n // Extend defaults with passed params\n swiper.params = extend({}, swiperParams, extendedDefaults, params);\n swiper.originalParams = extend({}, swiper.params);\n swiper.passedParams = extend({}, params);\n\n // add event listeners\n if (swiper.params && swiper.params.on) {\n Object.keys(swiper.params.on).forEach(eventName => {\n swiper.on(eventName, swiper.params.on[eventName]);\n });\n }\n if (swiper.params && swiper.params.onAny) {\n swiper.onAny(swiper.params.onAny);\n }\n\n // Extend Swiper\n Object.assign(swiper, {\n enabled: swiper.params.enabled,\n el,\n // Classes\n classNames: [],\n // Slides\n slides: [],\n slidesGrid: [],\n snapGrid: [],\n slidesSizesGrid: [],\n // isDirection\n isHorizontal() {\n return swiper.params.direction === 'horizontal';\n },\n isVertical() {\n return swiper.params.direction === 'vertical';\n },\n // Indexes\n activeIndex: 0,\n realIndex: 0,\n //\n isBeginning: true,\n isEnd: false,\n // Props\n translate: 0,\n previousTranslate: 0,\n progress: 0,\n velocity: 0,\n animating: false,\n cssOverflowAdjustment() {\n // Returns 0 unless `translate` is > 2**23\n // Should be subtracted from css values to prevent overflow\n return Math.trunc(this.translate / 2 ** 23) * 2 ** 23;\n },\n // Locks\n allowSlideNext: swiper.params.allowSlideNext,\n allowSlidePrev: swiper.params.allowSlidePrev,\n // Touch Events\n touchEventsData: {\n isTouched: undefined,\n isMoved: undefined,\n allowTouchCallbacks: undefined,\n touchStartTime: undefined,\n isScrolling: undefined,\n currentTranslate: undefined,\n startTranslate: undefined,\n allowThresholdMove: undefined,\n // Form elements to match\n focusableElements: swiper.params.focusableElements,\n // Last click time\n lastClickTime: 0,\n clickTimeout: undefined,\n // Velocities\n velocities: [],\n allowMomentumBounce: undefined,\n startMoving: undefined,\n evCache: []\n },\n // Clicks\n allowClick: true,\n // Touches\n allowTouchMove: swiper.params.allowTouchMove,\n touches: {\n startX: 0,\n startY: 0,\n currentX: 0,\n currentY: 0,\n diff: 0\n },\n // Images\n imagesToLoad: [],\n imagesLoaded: 0\n });\n swiper.emit('_swiper');\n\n // Init\n if (swiper.params.init) {\n swiper.init();\n }\n\n // Return app instance\n // eslint-disable-next-line no-constructor-return\n return swiper;\n }\n getSlideIndex(slideEl) {\n const {\n slidesEl,\n params\n } = this;\n const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);\n const firstSlideIndex = elementIndex(slides[0]);\n return elementIndex(slideEl) - firstSlideIndex;\n }\n getSlideIndexByData(index) {\n return this.getSlideIndex(this.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === index)[0]);\n }\n recalcSlides() {\n const swiper = this;\n const {\n slidesEl,\n params\n } = swiper;\n swiper.slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);\n }\n enable() {\n const swiper = this;\n if (swiper.enabled) return;\n swiper.enabled = true;\n if (swiper.params.grabCursor) {\n swiper.setGrabCursor();\n }\n swiper.emit('enable');\n }\n disable() {\n const swiper = this;\n if (!swiper.enabled) return;\n swiper.enabled = false;\n if (swiper.params.grabCursor) {\n swiper.unsetGrabCursor();\n }\n swiper.emit('disable');\n }\n setProgress(progress, speed) {\n const swiper = this;\n progress = Math.min(Math.max(progress, 0), 1);\n const min = swiper.minTranslate();\n const max = swiper.maxTranslate();\n const current = (max - min) * progress + min;\n swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed);\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n }\n emitContainerClasses() {\n const swiper = this;\n if (!swiper.params._emitClasses || !swiper.el) return;\n const cls = swiper.el.className.split(' ').filter(className => {\n return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0;\n });\n swiper.emit('_containerClasses', cls.join(' '));\n }\n getSlideClasses(slideEl) {\n const swiper = this;\n if (swiper.destroyed) return '';\n return slideEl.className.split(' ').filter(className => {\n return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0;\n }).join(' ');\n }\n emitSlidesClasses() {\n const swiper = this;\n if (!swiper.params._emitClasses || !swiper.el) return;\n const updates = [];\n swiper.slides.forEach(slideEl => {\n const classNames = swiper.getSlideClasses(slideEl);\n updates.push({\n slideEl,\n classNames\n });\n swiper.emit('_slideClass', slideEl, classNames);\n });\n swiper.emit('_slideClasses', updates);\n }\n slidesPerViewDynamic(view, exact) {\n if (view === void 0) {\n view = 'current';\n }\n if (exact === void 0) {\n exact = false;\n }\n const swiper = this;\n const {\n params,\n slides,\n slidesGrid,\n slidesSizesGrid,\n size: swiperSize,\n activeIndex\n } = swiper;\n let spv = 1;\n if (typeof params.slidesPerView === 'number') return params.slidesPerView;\n if (params.centeredSlides) {\n let slideSize = slides[activeIndex] ? slides[activeIndex].swiperSlideSize : 0;\n let breakLoop;\n for (let i = activeIndex + 1; i < slides.length; i += 1) {\n if (slides[i] && !breakLoop) {\n slideSize += slides[i].swiperSlideSize;\n spv += 1;\n if (slideSize > swiperSize) breakLoop = true;\n }\n }\n for (let i = activeIndex - 1; i >= 0; i -= 1) {\n if (slides[i] && !breakLoop) {\n slideSize += slides[i].swiperSlideSize;\n spv += 1;\n if (slideSize > swiperSize) breakLoop = true;\n }\n }\n } else {\n // eslint-disable-next-line\n if (view === 'current') {\n for (let i = activeIndex + 1; i < slides.length; i += 1) {\n const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize;\n if (slideInView) {\n spv += 1;\n }\n }\n } else {\n // previous\n for (let i = activeIndex - 1; i >= 0; i -= 1) {\n const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize;\n if (slideInView) {\n spv += 1;\n }\n }\n }\n }\n return spv;\n }\n update() {\n const swiper = this;\n if (!swiper || swiper.destroyed) return;\n const {\n snapGrid,\n params\n } = swiper;\n // Breakpoints\n if (params.breakpoints) {\n swiper.setBreakpoint();\n }\n [...swiper.el.querySelectorAll('[loading=\"lazy\"]')].forEach(imageEl => {\n if (imageEl.complete) {\n processLazyPreloader(swiper, imageEl);\n }\n });\n swiper.updateSize();\n swiper.updateSlides();\n swiper.updateProgress();\n swiper.updateSlidesClasses();\n function setTranslate() {\n const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate;\n const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate());\n swiper.setTranslate(newTranslate);\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n }\n let translated;\n if (params.freeMode && params.freeMode.enabled && !params.cssMode) {\n setTranslate();\n if (params.autoHeight) {\n swiper.updateAutoHeight();\n }\n } else {\n if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !params.centeredSlides) {\n const slides = swiper.virtual && params.virtual.enabled ? swiper.virtual.slides : swiper.slides;\n translated = swiper.slideTo(slides.length - 1, 0, false, true);\n } else {\n translated = swiper.slideTo(swiper.activeIndex, 0, false, true);\n }\n if (!translated) {\n setTranslate();\n }\n }\n if (params.watchOverflow && snapGrid !== swiper.snapGrid) {\n swiper.checkOverflow();\n }\n swiper.emit('update');\n }\n changeDirection(newDirection, needUpdate) {\n if (needUpdate === void 0) {\n needUpdate = true;\n }\n const swiper = this;\n const currentDirection = swiper.params.direction;\n if (!newDirection) {\n // eslint-disable-next-line\n newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal';\n }\n if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') {\n return swiper;\n }\n swiper.el.classList.remove(`${swiper.params.containerModifierClass}${currentDirection}`);\n swiper.el.classList.add(`${swiper.params.containerModifierClass}${newDirection}`);\n swiper.emitContainerClasses();\n swiper.params.direction = newDirection;\n swiper.slides.forEach(slideEl => {\n if (newDirection === 'vertical') {\n slideEl.style.width = '';\n } else {\n slideEl.style.height = '';\n }\n });\n swiper.emit('changeDirection');\n if (needUpdate) swiper.update();\n return swiper;\n }\n changeLanguageDirection(direction) {\n const swiper = this;\n if (swiper.rtl && direction === 'rtl' || !swiper.rtl && direction === 'ltr') return;\n swiper.rtl = direction === 'rtl';\n swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl;\n if (swiper.rtl) {\n swiper.el.classList.add(`${swiper.params.containerModifierClass}rtl`);\n swiper.el.dir = 'rtl';\n } else {\n swiper.el.classList.remove(`${swiper.params.containerModifierClass}rtl`);\n swiper.el.dir = 'ltr';\n }\n swiper.update();\n }\n mount(element) {\n const swiper = this;\n if (swiper.mounted) return true;\n\n // Find el\n let el = element || swiper.params.el;\n if (typeof el === 'string') {\n el = document.querySelector(el);\n }\n if (!el) {\n return false;\n }\n el.swiper = swiper;\n if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === 'SWIPER-CONTAINER') {\n swiper.isElement = true;\n }\n const getWrapperSelector = () => {\n return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`;\n };\n const getWrapper = () => {\n if (el && el.shadowRoot && el.shadowRoot.querySelector) {\n const res = el.shadowRoot.querySelector(getWrapperSelector());\n // Children needs to return slot items\n return res;\n }\n return elementChildren(el, getWrapperSelector())[0];\n };\n // Find Wrapper\n let wrapperEl = getWrapper();\n if (!wrapperEl && swiper.params.createElements) {\n wrapperEl = createElement('div', swiper.params.wrapperClass);\n el.append(wrapperEl);\n elementChildren(el, `.${swiper.params.slideClass}`).forEach(slideEl => {\n wrapperEl.append(slideEl);\n });\n }\n Object.assign(swiper, {\n el,\n wrapperEl,\n slidesEl: swiper.isElement && !el.parentNode.host.slideSlots ? el.parentNode.host : wrapperEl,\n hostEl: swiper.isElement ? el.parentNode.host : el,\n mounted: true,\n // RTL\n rtl: el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl',\n rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl'),\n wrongRTL: elementStyle(wrapperEl, 'display') === '-webkit-box'\n });\n return true;\n }\n init(el) {\n const swiper = this;\n if (swiper.initialized) return swiper;\n const mounted = swiper.mount(el);\n if (mounted === false) return swiper;\n swiper.emit('beforeInit');\n\n // Set breakpoint\n if (swiper.params.breakpoints) {\n swiper.setBreakpoint();\n }\n\n // Add Classes\n swiper.addClasses();\n\n // Update size\n swiper.updateSize();\n\n // Update slides\n swiper.updateSlides();\n if (swiper.params.watchOverflow) {\n swiper.checkOverflow();\n }\n\n // Set Grab Cursor\n if (swiper.params.grabCursor && swiper.enabled) {\n swiper.setGrabCursor();\n }\n\n // Slide To Initial Slide\n if (swiper.params.loop && swiper.virtual && swiper.params.virtual.enabled) {\n swiper.slideTo(swiper.params.initialSlide + swiper.virtual.slidesBefore, 0, swiper.params.runCallbacksOnInit, false, true);\n } else {\n swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true);\n }\n\n // Create loop\n if (swiper.params.loop) {\n swiper.loopCreate();\n }\n\n // Attach events\n swiper.attachEvents();\n const lazyElements = [...swiper.el.querySelectorAll('[loading=\"lazy\"]')];\n if (swiper.isElement) {\n lazyElements.push(...swiper.hostEl.querySelectorAll('[loading=\"lazy\"]'));\n }\n lazyElements.forEach(imageEl => {\n if (imageEl.complete) {\n processLazyPreloader(swiper, imageEl);\n } else {\n imageEl.addEventListener('load', e => {\n processLazyPreloader(swiper, e.target);\n });\n }\n });\n preload(swiper);\n\n // Init Flag\n swiper.initialized = true;\n preload(swiper);\n\n // Emit\n swiper.emit('init');\n swiper.emit('afterInit');\n return swiper;\n }\n destroy(deleteInstance, cleanStyles) {\n if (deleteInstance === void 0) {\n deleteInstance = true;\n }\n if (cleanStyles === void 0) {\n cleanStyles = true;\n }\n const swiper = this;\n const {\n params,\n el,\n wrapperEl,\n slides\n } = swiper;\n if (typeof swiper.params === 'undefined' || swiper.destroyed) {\n return null;\n }\n swiper.emit('beforeDestroy');\n\n // Init Flag\n swiper.initialized = false;\n\n // Detach events\n swiper.detachEvents();\n\n // Destroy loop\n if (params.loop) {\n swiper.loopDestroy();\n }\n\n // Cleanup styles\n if (cleanStyles) {\n swiper.removeClasses();\n el.removeAttribute('style');\n wrapperEl.removeAttribute('style');\n if (slides && slides.length) {\n slides.forEach(slideEl => {\n slideEl.classList.remove(params.slideVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);\n slideEl.removeAttribute('style');\n slideEl.removeAttribute('data-swiper-slide-index');\n });\n }\n }\n swiper.emit('destroy');\n\n // Detach emitter events\n Object.keys(swiper.eventsListeners).forEach(eventName => {\n swiper.off(eventName);\n });\n if (deleteInstance !== false) {\n swiper.el.swiper = null;\n deleteProps(swiper);\n }\n swiper.destroyed = true;\n return null;\n }\n static extendDefaults(newDefaults) {\n extend(extendedDefaults, newDefaults);\n }\n static get extendedDefaults() {\n return extendedDefaults;\n }\n static get defaults() {\n return defaults;\n }\n static installModule(mod) {\n if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = [];\n const modules = Swiper.prototype.__modules__;\n if (typeof mod === 'function' && modules.indexOf(mod) < 0) {\n modules.push(mod);\n }\n }\n static use(module) {\n if (Array.isArray(module)) {\n module.forEach(m => Swiper.installModule(m));\n return Swiper;\n }\n Swiper.installModule(module);\n return Swiper;\n }\n}\nObject.keys(prototypes).forEach(prototypeGroup => {\n Object.keys(prototypes[prototypeGroup]).forEach(protoMethod => {\n Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod];\n });\n});\nSwiper.use([Resize, Observer]);\n\nexport { Swiper as S, defaults as d };\n", "import { g as getDocument } from '../shared/ssr-window.esm.mjs';\nimport { s as setCSSProperty, e as elementChildren, c as createElement } from '../shared/utils.mjs';\n\nfunction Virtual(_ref) {\n let {\n swiper,\n extendParams,\n on,\n emit\n } = _ref;\n extendParams({\n virtual: {\n enabled: false,\n slides: [],\n cache: true,\n renderSlide: null,\n renderExternal: null,\n renderExternalUpdate: true,\n addSlidesBefore: 0,\n addSlidesAfter: 0\n }\n });\n let cssModeTimeout;\n const document = getDocument();\n swiper.virtual = {\n cache: {},\n from: undefined,\n to: undefined,\n slides: [],\n offset: 0,\n slidesGrid: []\n };\n const tempDOM = document.createElement('div');\n function renderSlide(slide, index) {\n const params = swiper.params.virtual;\n if (params.cache && swiper.virtual.cache[index]) {\n return swiper.virtual.cache[index];\n }\n // eslint-disable-next-line\n let slideEl;\n if (params.renderSlide) {\n slideEl = params.renderSlide.call(swiper, slide, index);\n if (typeof slideEl === 'string') {\n tempDOM.innerHTML = slideEl;\n slideEl = tempDOM.children[0];\n }\n } else if (swiper.isElement) {\n slideEl = createElement('swiper-slide');\n } else {\n slideEl = createElement('div', swiper.params.slideClass);\n }\n slideEl.setAttribute('data-swiper-slide-index', index);\n if (!params.renderSlide) {\n slideEl.innerHTML = slide;\n }\n if (params.cache) {\n swiper.virtual.cache[index] = slideEl;\n }\n return slideEl;\n }\n function update(force) {\n const {\n slidesPerView,\n slidesPerGroup,\n centeredSlides,\n loop: isLoop\n } = swiper.params;\n const {\n addSlidesBefore,\n addSlidesAfter\n } = swiper.params.virtual;\n const {\n from: previousFrom,\n to: previousTo,\n slides,\n slidesGrid: previousSlidesGrid,\n offset: previousOffset\n } = swiper.virtual;\n if (!swiper.params.cssMode) {\n swiper.updateActiveIndex();\n }\n const activeIndex = swiper.activeIndex || 0;\n let offsetProp;\n if (swiper.rtlTranslate) offsetProp = 'right';else offsetProp = swiper.isHorizontal() ? 'left' : 'top';\n let slidesAfter;\n let slidesBefore;\n if (centeredSlides) {\n slidesAfter = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesAfter;\n slidesBefore = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesBefore;\n } else {\n slidesAfter = slidesPerView + (slidesPerGroup - 1) + addSlidesAfter;\n slidesBefore = (isLoop ? slidesPerView : slidesPerGroup) + addSlidesBefore;\n }\n let from = activeIndex - slidesBefore;\n let to = activeIndex + slidesAfter;\n if (!isLoop) {\n from = Math.max(from, 0);\n to = Math.min(to, slides.length - 1);\n }\n let offset = (swiper.slidesGrid[from] || 0) - (swiper.slidesGrid[0] || 0);\n if (isLoop && activeIndex >= slidesBefore) {\n from -= slidesBefore;\n if (!centeredSlides) offset += swiper.slidesGrid[0];\n } else if (isLoop && activeIndex < slidesBefore) {\n from = -slidesBefore;\n if (centeredSlides) offset += swiper.slidesGrid[0];\n }\n Object.assign(swiper.virtual, {\n from,\n to,\n offset,\n slidesGrid: swiper.slidesGrid,\n slidesBefore,\n slidesAfter\n });\n function onRendered() {\n swiper.updateSlides();\n swiper.updateProgress();\n swiper.updateSlidesClasses();\n emit('virtualUpdate');\n }\n if (previousFrom === from && previousTo === to && !force) {\n if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) {\n swiper.slides.forEach(slideEl => {\n slideEl.style[offsetProp] = `${offset - Math.abs(swiper.cssOverflowAdjustment())}px`;\n });\n }\n swiper.updateProgress();\n emit('virtualUpdate');\n return;\n }\n if (swiper.params.virtual.renderExternal) {\n swiper.params.virtual.renderExternal.call(swiper, {\n offset,\n from,\n to,\n slides: function getSlides() {\n const slidesToRender = [];\n for (let i = from; i <= to; i += 1) {\n slidesToRender.push(slides[i]);\n }\n return slidesToRender;\n }()\n });\n if (swiper.params.virtual.renderExternalUpdate) {\n onRendered();\n } else {\n emit('virtualUpdate');\n }\n return;\n }\n const prependIndexes = [];\n const appendIndexes = [];\n const getSlideIndex = index => {\n let slideIndex = index;\n if (index < 0) {\n slideIndex = slides.length + index;\n } else if (slideIndex >= slides.length) {\n // eslint-disable-next-line\n slideIndex = slideIndex - slides.length;\n }\n return slideIndex;\n };\n if (force) {\n swiper.slides.filter(el => el.matches(`.${swiper.params.slideClass}, swiper-slide`)).forEach(slideEl => {\n slideEl.remove();\n });\n } else {\n for (let i = previousFrom; i <= previousTo; i += 1) {\n if (i < from || i > to) {\n const slideIndex = getSlideIndex(i);\n swiper.slides.filter(el => el.matches(`.${swiper.params.slideClass}[data-swiper-slide-index=\"${slideIndex}\"], swiper-slide[data-swiper-slide-index=\"${slideIndex}\"]`)).forEach(slideEl => {\n slideEl.remove();\n });\n }\n }\n }\n const loopFrom = isLoop ? -slides.length : 0;\n const loopTo = isLoop ? slides.length * 2 : slides.length;\n for (let i = loopFrom; i < loopTo; i += 1) {\n if (i >= from && i <= to) {\n const slideIndex = getSlideIndex(i);\n if (typeof previousTo === 'undefined' || force) {\n appendIndexes.push(slideIndex);\n } else {\n if (i > previousTo) appendIndexes.push(slideIndex);\n if (i < previousFrom) prependIndexes.push(slideIndex);\n }\n }\n }\n appendIndexes.forEach(index => {\n swiper.slidesEl.append(renderSlide(slides[index], index));\n });\n if (isLoop) {\n for (let i = prependIndexes.length - 1; i >= 0; i -= 1) {\n const index = prependIndexes[i];\n swiper.slidesEl.prepend(renderSlide(slides[index], index));\n }\n } else {\n prependIndexes.sort((a, b) => b - a);\n prependIndexes.forEach(index => {\n swiper.slidesEl.prepend(renderSlide(slides[index], index));\n });\n }\n elementChildren(swiper.slidesEl, '.swiper-slide, swiper-slide').forEach(slideEl => {\n slideEl.style[offsetProp] = `${offset - Math.abs(swiper.cssOverflowAdjustment())}px`;\n });\n onRendered();\n }\n function appendSlide(slides) {\n if (typeof slides === 'object' && 'length' in slides) {\n for (let i = 0; i < slides.length; i += 1) {\n if (slides[i]) swiper.virtual.slides.push(slides[i]);\n }\n } else {\n swiper.virtual.slides.push(slides);\n }\n update(true);\n }\n function prependSlide(slides) {\n const activeIndex = swiper.activeIndex;\n let newActiveIndex = activeIndex + 1;\n let numberOfNewSlides = 1;\n if (Array.isArray(slides)) {\n for (let i = 0; i < slides.length; i += 1) {\n if (slides[i]) swiper.virtual.slides.unshift(slides[i]);\n }\n newActiveIndex = activeIndex + slides.length;\n numberOfNewSlides = slides.length;\n } else {\n swiper.virtual.slides.unshift(slides);\n }\n if (swiper.params.virtual.cache) {\n const cache = swiper.virtual.cache;\n const newCache = {};\n Object.keys(cache).forEach(cachedIndex => {\n const cachedEl = cache[cachedIndex];\n const cachedElIndex = cachedEl.getAttribute('data-swiper-slide-index');\n if (cachedElIndex) {\n cachedEl.setAttribute('data-swiper-slide-index', parseInt(cachedElIndex, 10) + numberOfNewSlides);\n }\n newCache[parseInt(cachedIndex, 10) + numberOfNewSlides] = cachedEl;\n });\n swiper.virtual.cache = newCache;\n }\n update(true);\n swiper.slideTo(newActiveIndex, 0);\n }\n function removeSlide(slidesIndexes) {\n if (typeof slidesIndexes === 'undefined' || slidesIndexes === null) return;\n let activeIndex = swiper.activeIndex;\n if (Array.isArray(slidesIndexes)) {\n for (let i = slidesIndexes.length - 1; i >= 0; i -= 1) {\n if (swiper.params.virtual.cache) {\n delete swiper.virtual.cache[slidesIndexes[i]];\n // shift cache indexes\n Object.keys(swiper.virtual.cache).forEach(key => {\n if (key > slidesIndexes) {\n swiper.virtual.cache[key - 1] = swiper.virtual.cache[key];\n swiper.virtual.cache[key - 1].setAttribute('data-swiper-slide-index', key - 1);\n delete swiper.virtual.cache[key];\n }\n });\n }\n swiper.virtual.slides.splice(slidesIndexes[i], 1);\n if (slidesIndexes[i] < activeIndex) activeIndex -= 1;\n activeIndex = Math.max(activeIndex, 0);\n }\n } else {\n if (swiper.params.virtual.cache) {\n delete swiper.virtual.cache[slidesIndexes];\n // shift cache indexes\n Object.keys(swiper.virtual.cache).forEach(key => {\n if (key > slidesIndexes) {\n swiper.virtual.cache[key - 1] = swiper.virtual.cache[key];\n swiper.virtual.cache[key - 1].setAttribute('data-swiper-slide-index', key - 1);\n delete swiper.virtual.cache[key];\n }\n });\n }\n swiper.virtual.slides.splice(slidesIndexes, 1);\n if (slidesIndexes < activeIndex) activeIndex -= 1;\n activeIndex = Math.max(activeIndex, 0);\n }\n update(true);\n swiper.slideTo(activeIndex, 0);\n }\n function removeAllSlides() {\n swiper.virtual.slides = [];\n if (swiper.params.virtual.cache) {\n swiper.virtual.cache = {};\n }\n update(true);\n swiper.slideTo(0, 0);\n }\n on('beforeInit', () => {\n if (!swiper.params.virtual.enabled) return;\n let domSlidesAssigned;\n if (typeof swiper.passedParams.virtual.slides === 'undefined') {\n const slides = [...swiper.slidesEl.children].filter(el => el.matches(`.${swiper.params.slideClass}, swiper-slide`));\n if (slides && slides.length) {\n swiper.virtual.slides = [...slides];\n domSlidesAssigned = true;\n slides.forEach((slideEl, slideIndex) => {\n slideEl.setAttribute('data-swiper-slide-index', slideIndex);\n swiper.virtual.cache[slideIndex] = slideEl;\n slideEl.remove();\n });\n }\n }\n if (!domSlidesAssigned) {\n swiper.virtual.slides = swiper.params.virtual.slides;\n }\n swiper.classNames.push(`${swiper.params.containerModifierClass}virtual`);\n swiper.params.watchSlidesProgress = true;\n swiper.originalParams.watchSlidesProgress = true;\n update();\n });\n on('setTranslate', () => {\n if (!swiper.params.virtual.enabled) return;\n if (swiper.params.cssMode && !swiper._immediateVirtual) {\n clearTimeout(cssModeTimeout);\n cssModeTimeout = setTimeout(() => {\n update();\n }, 100);\n } else {\n update();\n }\n });\n on('init update resize', () => {\n if (!swiper.params.virtual.enabled) return;\n if (swiper.params.cssMode) {\n setCSSProperty(swiper.wrapperEl, '--swiper-virtual-size', `${swiper.virtualSize}px`);\n }\n });\n Object.assign(swiper.virtual, {\n appendSlide,\n prependSlide,\n removeSlide,\n removeAllSlides,\n update\n });\n}\n\nexport { Virtual as default };\n", "import { g as getDocument, a as getWindow } from '../shared/ssr-window.esm.mjs';\nimport { a as elementParents, b as elementOffset } from '../shared/utils.mjs';\n\n/* eslint-disable consistent-return */\nfunction Keyboard(_ref) {\n let {\n swiper,\n extendParams,\n on,\n emit\n } = _ref;\n const document = getDocument();\n const window = getWindow();\n swiper.keyboard = {\n enabled: false\n };\n extendParams({\n keyboard: {\n enabled: false,\n onlyInViewport: true,\n pageUpDown: true\n }\n });\n function handle(event) {\n if (!swiper.enabled) return;\n const {\n rtlTranslate: rtl\n } = swiper;\n let e = event;\n if (e.originalEvent) e = e.originalEvent; // jquery fix\n const kc = e.keyCode || e.charCode;\n const pageUpDown = swiper.params.keyboard.pageUpDown;\n const isPageUp = pageUpDown && kc === 33;\n const isPageDown = pageUpDown && kc === 34;\n const isArrowLeft = kc === 37;\n const isArrowRight = kc === 39;\n const isArrowUp = kc === 38;\n const isArrowDown = kc === 40;\n // Directions locks\n if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) {\n return false;\n }\n if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) {\n return false;\n }\n if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {\n return undefined;\n }\n if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {\n return undefined;\n }\n if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) {\n let inView = false;\n // Check that swiper should be inside of visible area of window\n if (elementParents(swiper.el, `.${swiper.params.slideClass}, swiper-slide`).length > 0 && elementParents(swiper.el, `.${swiper.params.slideActiveClass}`).length === 0) {\n return undefined;\n }\n const el = swiper.el;\n const swiperWidth = el.clientWidth;\n const swiperHeight = el.clientHeight;\n const windowWidth = window.innerWidth;\n const windowHeight = window.innerHeight;\n const swiperOffset = elementOffset(el);\n if (rtl) swiperOffset.left -= el.scrollLeft;\n const swiperCoord = [[swiperOffset.left, swiperOffset.top], [swiperOffset.left + swiperWidth, swiperOffset.top], [swiperOffset.left, swiperOffset.top + swiperHeight], [swiperOffset.left + swiperWidth, swiperOffset.top + swiperHeight]];\n for (let i = 0; i < swiperCoord.length; i += 1) {\n const point = swiperCoord[i];\n if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) {\n if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line\n inView = true;\n }\n }\n if (!inView) return undefined;\n }\n if (swiper.isHorizontal()) {\n if (isPageUp || isPageDown || isArrowLeft || isArrowRight) {\n if (e.preventDefault) e.preventDefault();else e.returnValue = false;\n }\n if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext();\n if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev();\n } else {\n if (isPageUp || isPageDown || isArrowUp || isArrowDown) {\n if (e.preventDefault) e.preventDefault();else e.returnValue = false;\n }\n if (isPageDown || isArrowDown) swiper.slideNext();\n if (isPageUp || isArrowUp) swiper.slidePrev();\n }\n emit('keyPress', kc);\n return undefined;\n }\n function enable() {\n if (swiper.keyboard.enabled) return;\n document.addEventListener('keydown', handle);\n swiper.keyboard.enabled = true;\n }\n function disable() {\n if (!swiper.keyboard.enabled) return;\n document.removeEventListener('keydown', handle);\n swiper.keyboard.enabled = false;\n }\n on('init', () => {\n if (swiper.params.keyboard.enabled) {\n enable();\n }\n });\n on('destroy', () => {\n if (swiper.keyboard.enabled) {\n disable();\n }\n });\n Object.assign(swiper.keyboard, {\n enable,\n disable\n });\n}\n\nexport { Keyboard as default };\n", "import { a as getWindow } from '../shared/ssr-window.esm.mjs';\nimport { n as nextTick, d as now } from '../shared/utils.mjs';\n\n/* eslint-disable consistent-return */\nfunction Mousewheel(_ref) {\n let {\n swiper,\n extendParams,\n on,\n emit\n } = _ref;\n const window = getWindow();\n extendParams({\n mousewheel: {\n enabled: false,\n releaseOnEdges: false,\n invert: false,\n forceToAxis: false,\n sensitivity: 1,\n eventsTarget: 'container',\n thresholdDelta: null,\n thresholdTime: null,\n noMousewheelClass: 'swiper-no-mousewheel'\n }\n });\n swiper.mousewheel = {\n enabled: false\n };\n let timeout;\n let lastScrollTime = now();\n let lastEventBeforeSnap;\n const recentWheelEvents = [];\n function normalize(e) {\n // Reasonable defaults\n const PIXEL_STEP = 10;\n const LINE_HEIGHT = 40;\n const PAGE_HEIGHT = 800;\n let sX = 0;\n let sY = 0; // spinX, spinY\n let pX = 0;\n let pY = 0; // pixelX, pixelY\n\n // Legacy\n if ('detail' in e) {\n sY = e.detail;\n }\n if ('wheelDelta' in e) {\n sY = -e.wheelDelta / 120;\n }\n if ('wheelDeltaY' in e) {\n sY = -e.wheelDeltaY / 120;\n }\n if ('wheelDeltaX' in e) {\n sX = -e.wheelDeltaX / 120;\n }\n\n // side scrolling on FF with DOMMouseScroll\n if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) {\n sX = sY;\n sY = 0;\n }\n pX = sX * PIXEL_STEP;\n pY = sY * PIXEL_STEP;\n if ('deltaY' in e) {\n pY = e.deltaY;\n }\n if ('deltaX' in e) {\n pX = e.deltaX;\n }\n if (e.shiftKey && !pX) {\n // if user scrolls with shift he wants horizontal scroll\n pX = pY;\n pY = 0;\n }\n if ((pX || pY) && e.deltaMode) {\n if (e.deltaMode === 1) {\n // delta in LINE units\n pX *= LINE_HEIGHT;\n pY *= LINE_HEIGHT;\n } else {\n // delta in PAGE units\n pX *= PAGE_HEIGHT;\n pY *= PAGE_HEIGHT;\n }\n }\n\n // Fall-back if spin cannot be determined\n if (pX && !sX) {\n sX = pX < 1 ? -1 : 1;\n }\n if (pY && !sY) {\n sY = pY < 1 ? -1 : 1;\n }\n return {\n spinX: sX,\n spinY: sY,\n pixelX: pX,\n pixelY: pY\n };\n }\n function handleMouseEnter() {\n if (!swiper.enabled) return;\n swiper.mouseEntered = true;\n }\n function handleMouseLeave() {\n if (!swiper.enabled) return;\n swiper.mouseEntered = false;\n }\n function animateSlider(newEvent) {\n if (swiper.params.mousewheel.thresholdDelta && newEvent.delta < swiper.params.mousewheel.thresholdDelta) {\n // Prevent if delta of wheel scroll delta is below configured threshold\n return false;\n }\n if (swiper.params.mousewheel.thresholdTime && now() - lastScrollTime < swiper.params.mousewheel.thresholdTime) {\n // Prevent if time between scrolls is below configured threshold\n return false;\n }\n\n // If the movement is NOT big enough and\n // if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider):\n // Don't go any further (avoid insignificant scroll movement).\n if (newEvent.delta >= 6 && now() - lastScrollTime < 60) {\n // Return false as a default\n return true;\n }\n // If user is scrolling towards the end:\n // If the slider hasn't hit the latest slide or\n // if the slider is a loop and\n // if the slider isn't moving right now:\n // Go to next slide and\n // emit a scroll event.\n // Else (the user is scrolling towards the beginning) and\n // if the slider hasn't hit the first slide or\n // if the slider is a loop and\n // if the slider isn't moving right now:\n // Go to prev slide and\n // emit a scroll event.\n if (newEvent.direction < 0) {\n if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) {\n swiper.slideNext();\n emit('scroll', newEvent.raw);\n }\n } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) {\n swiper.slidePrev();\n emit('scroll', newEvent.raw);\n }\n // If you got here is because an animation has been triggered so store the current time\n lastScrollTime = new window.Date().getTime();\n // Return false as a default\n return false;\n }\n function releaseScroll(newEvent) {\n const params = swiper.params.mousewheel;\n if (newEvent.direction < 0) {\n if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) {\n // Return true to animate scroll on edges\n return true;\n }\n } else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) {\n // Return true to animate scroll on edges\n return true;\n }\n return false;\n }\n function handle(event) {\n let e = event;\n let disableParentSwiper = true;\n if (!swiper.enabled) return;\n\n // Ignore event if the target or its parents have the swiper-no-mousewheel class\n if (event.target.closest(`.${swiper.params.mousewheel.noMousewheelClass}`)) return;\n const params = swiper.params.mousewheel;\n if (swiper.params.cssMode) {\n e.preventDefault();\n }\n let targetEl = swiper.el;\n if (swiper.params.mousewheel.eventsTarget !== 'container') {\n targetEl = document.querySelector(swiper.params.mousewheel.eventsTarget);\n }\n const targetElContainsTarget = targetEl && targetEl.contains(e.target);\n if (!swiper.mouseEntered && !targetElContainsTarget && !params.releaseOnEdges) return true;\n if (e.originalEvent) e = e.originalEvent; // jquery fix\n let delta = 0;\n const rtlFactor = swiper.rtlTranslate ? -1 : 1;\n const data = normalize(e);\n if (params.forceToAxis) {\n if (swiper.isHorizontal()) {\n if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = -data.pixelX * rtlFactor;else return true;\n } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = -data.pixelY;else return true;\n } else {\n delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY;\n }\n if (delta === 0) return true;\n if (params.invert) delta = -delta;\n\n // Get the scroll positions\n let positions = swiper.getTranslate() + delta * params.sensitivity;\n if (positions >= swiper.minTranslate()) positions = swiper.minTranslate();\n if (positions <= swiper.maxTranslate()) positions = swiper.maxTranslate();\n\n // When loop is true:\n // the disableParentSwiper will be true.\n // When loop is false:\n // if the scroll positions is not on edge,\n // then the disableParentSwiper will be true.\n // if the scroll on edge positions,\n // then the disableParentSwiper will be false.\n disableParentSwiper = swiper.params.loop ? true : !(positions === swiper.minTranslate() || positions === swiper.maxTranslate());\n if (disableParentSwiper && swiper.params.nested) e.stopPropagation();\n if (!swiper.params.freeMode || !swiper.params.freeMode.enabled) {\n // Register the new event in a variable which stores the relevant data\n const newEvent = {\n time: now(),\n delta: Math.abs(delta),\n direction: Math.sign(delta),\n raw: event\n };\n\n // Keep the most recent events\n if (recentWheelEvents.length >= 2) {\n recentWheelEvents.shift(); // only store the last N events\n }\n\n const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined;\n recentWheelEvents.push(newEvent);\n\n // If there is at least one previous recorded event:\n // If direction has changed or\n // if the scroll is quicker than the previous one:\n // Animate the slider.\n // Else (this is the first time the wheel is moved):\n // Animate the slider.\n if (prevEvent) {\n if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta || newEvent.time > prevEvent.time + 150) {\n animateSlider(newEvent);\n }\n } else {\n animateSlider(newEvent);\n }\n\n // If it's time to release the scroll:\n // Return now so you don't hit the preventDefault.\n if (releaseScroll(newEvent)) {\n return true;\n }\n } else {\n // Freemode or scrollContainer:\n\n // If we recently snapped after a momentum scroll, then ignore wheel events\n // to give time for the deceleration to finish. Stop ignoring after 500 msecs\n // or if it's a new scroll (larger delta or inverse sign as last event before\n // an end-of-momentum snap).\n const newEvent = {\n time: now(),\n delta: Math.abs(delta),\n direction: Math.sign(delta)\n };\n const ignoreWheelEvents = lastEventBeforeSnap && newEvent.time < lastEventBeforeSnap.time + 500 && newEvent.delta <= lastEventBeforeSnap.delta && newEvent.direction === lastEventBeforeSnap.direction;\n if (!ignoreWheelEvents) {\n lastEventBeforeSnap = undefined;\n let position = swiper.getTranslate() + delta * params.sensitivity;\n const wasBeginning = swiper.isBeginning;\n const wasEnd = swiper.isEnd;\n if (position >= swiper.minTranslate()) position = swiper.minTranslate();\n if (position <= swiper.maxTranslate()) position = swiper.maxTranslate();\n swiper.setTransition(0);\n swiper.setTranslate(position);\n swiper.updateProgress();\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n if (!wasBeginning && swiper.isBeginning || !wasEnd && swiper.isEnd) {\n swiper.updateSlidesClasses();\n }\n if (swiper.params.loop) {\n swiper.loopFix({\n direction: newEvent.direction < 0 ? 'next' : 'prev',\n byMousewheel: true\n });\n }\n if (swiper.params.freeMode.sticky) {\n // When wheel scrolling starts with sticky (aka snap) enabled, then detect\n // the end of a momentum scroll by storing recent (N=15?) wheel events.\n // 1. do all N events have decreasing or same (absolute value) delta?\n // 2. did all N events arrive in the last M (M=500?) msecs?\n // 3. does the earliest event have an (absolute value) delta that's\n // at least P (P=1?) larger than the most recent event's delta?\n // 4. does the latest event have a delta that's smaller than Q (Q=6?) pixels?\n // If 1-4 are \"yes\" then we're near the end of a momentum scroll deceleration.\n // Snap immediately and ignore remaining wheel events in this scroll.\n // See comment above for \"remaining wheel events in this scroll\" determination.\n // If 1-4 aren't satisfied, then wait to snap until 500ms after the last event.\n clearTimeout(timeout);\n timeout = undefined;\n if (recentWheelEvents.length >= 15) {\n recentWheelEvents.shift(); // only store the last N events\n }\n\n const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined;\n const firstEvent = recentWheelEvents[0];\n recentWheelEvents.push(newEvent);\n if (prevEvent && (newEvent.delta > prevEvent.delta || newEvent.direction !== prevEvent.direction)) {\n // Increasing or reverse-sign delta means the user started scrolling again. Clear the wheel event log.\n recentWheelEvents.splice(0);\n } else if (recentWheelEvents.length >= 15 && newEvent.time - firstEvent.time < 500 && firstEvent.delta - newEvent.delta >= 1 && newEvent.delta <= 6) {\n // We're at the end of the deceleration of a momentum scroll, so there's no need\n // to wait for more events. Snap ASAP on the next tick.\n // Also, because there's some remaining momentum we'll bias the snap in the\n // direction of the ongoing scroll because it's better UX for the scroll to snap\n // in the same direction as the scroll instead of reversing to snap. Therefore,\n // if it's already scrolled more than 20% in the current direction, keep going.\n const snapToThreshold = delta > 0 ? 0.8 : 0.2;\n lastEventBeforeSnap = newEvent;\n recentWheelEvents.splice(0);\n timeout = nextTick(() => {\n swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold);\n }, 0); // no delay; move on next tick\n }\n\n if (!timeout) {\n // if we get here, then we haven't detected the end of a momentum scroll, so\n // we'll consider a scroll \"complete\" when there haven't been any wheel events\n // for 500ms.\n timeout = nextTick(() => {\n const snapToThreshold = 0.5;\n lastEventBeforeSnap = newEvent;\n recentWheelEvents.splice(0);\n swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold);\n }, 500);\n }\n }\n\n // Emit event\n if (!ignoreWheelEvents) emit('scroll', e);\n\n // Stop autoplay\n if (swiper.params.autoplay && swiper.params.autoplayDisableOnInteraction) swiper.autoplay.stop();\n // Return page scroll on edge positions\n if (params.releaseOnEdges && (position === swiper.minTranslate() || position === swiper.maxTranslate())) {\n return true;\n }\n }\n }\n if (e.preventDefault) e.preventDefault();else e.returnValue = false;\n return false;\n }\n function events(method) {\n let targetEl = swiper.el;\n if (swiper.params.mousewheel.eventsTarget !== 'container') {\n targetEl = document.querySelector(swiper.params.mousewheel.eventsTarget);\n }\n targetEl[method]('mouseenter', handleMouseEnter);\n targetEl[method]('mouseleave', handleMouseLeave);\n targetEl[method]('wheel', handle);\n }\n function enable() {\n if (swiper.params.cssMode) {\n swiper.wrapperEl.removeEventListener('wheel', handle);\n return true;\n }\n if (swiper.mousewheel.enabled) return false;\n events('addEventListener');\n swiper.mousewheel.enabled = true;\n return true;\n }\n function disable() {\n if (swiper.params.cssMode) {\n swiper.wrapperEl.addEventListener(event, handle);\n return true;\n }\n if (!swiper.mousewheel.enabled) return false;\n events('removeEventListener');\n swiper.mousewheel.enabled = false;\n return true;\n }\n on('init', () => {\n if (!swiper.params.mousewheel.enabled && swiper.params.cssMode) {\n disable();\n }\n if (swiper.params.mousewheel.enabled) enable();\n });\n on('destroy', () => {\n if (swiper.params.cssMode) {\n enable();\n }\n if (swiper.mousewheel.enabled) disable();\n });\n Object.assign(swiper.mousewheel, {\n enable,\n disable\n });\n}\n\nexport { Mousewheel as default };\n", "import { e as elementChildren, c as createElement } from './utils.mjs';\n\nfunction createElementIfNotDefined(swiper, originalParams, params, checkProps) {\n if (swiper.params.createElements) {\n Object.keys(checkProps).forEach(key => {\n if (!params[key] && params.auto === true) {\n let element = elementChildren(swiper.el, `.${checkProps[key]}`)[0];\n if (!element) {\n element = createElement('div', checkProps[key]);\n element.className = checkProps[key];\n swiper.el.append(element);\n }\n params[key] = element;\n originalParams[key] = element;\n }\n });\n }\n return params;\n}\n\nexport { createElementIfNotDefined as c };\n", "import { c as createElementIfNotDefined } from '../shared/create-element-if-not-defined.mjs';\n\nfunction Navigation(_ref) {\n let {\n swiper,\n extendParams,\n on,\n emit\n } = _ref;\n extendParams({\n navigation: {\n nextEl: null,\n prevEl: null,\n hideOnClick: false,\n disabledClass: 'swiper-button-disabled',\n hiddenClass: 'swiper-button-hidden',\n lockClass: 'swiper-button-lock',\n navigationDisabledClass: 'swiper-navigation-disabled'\n }\n });\n swiper.navigation = {\n nextEl: null,\n prevEl: null\n };\n const makeElementsArray = el => (Array.isArray(el) ? el : [el]).filter(e => !!e);\n function getEl(el) {\n let res;\n if (el && typeof el === 'string' && swiper.isElement) {\n res = swiper.el.querySelector(el);\n if (res) return res;\n }\n if (el) {\n if (typeof el === 'string') res = [...document.querySelectorAll(el)];\n if (swiper.params.uniqueNavElements && typeof el === 'string' && res.length > 1 && swiper.el.querySelectorAll(el).length === 1) {\n res = swiper.el.querySelector(el);\n }\n }\n if (el && !res) return el;\n // if (Array.isArray(res) && res.length === 1) res = res[0];\n return res;\n }\n function toggleEl(el, disabled) {\n const params = swiper.params.navigation;\n el = makeElementsArray(el);\n el.forEach(subEl => {\n if (subEl) {\n subEl.classList[disabled ? 'add' : 'remove'](...params.disabledClass.split(' '));\n if (subEl.tagName === 'BUTTON') subEl.disabled = disabled;\n if (swiper.params.watchOverflow && swiper.enabled) {\n subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);\n }\n }\n });\n }\n function update() {\n // Update Navigation Buttons\n const {\n nextEl,\n prevEl\n } = swiper.navigation;\n if (swiper.params.loop) {\n toggleEl(prevEl, false);\n toggleEl(nextEl, false);\n return;\n }\n toggleEl(prevEl, swiper.isBeginning && !swiper.params.rewind);\n toggleEl(nextEl, swiper.isEnd && !swiper.params.rewind);\n }\n function onPrevClick(e) {\n e.preventDefault();\n if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return;\n swiper.slidePrev();\n emit('navigationPrev');\n }\n function onNextClick(e) {\n e.preventDefault();\n if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return;\n swiper.slideNext();\n emit('navigationNext');\n }\n function init() {\n const params = swiper.params.navigation;\n swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, {\n nextEl: 'swiper-button-next',\n prevEl: 'swiper-button-prev'\n });\n if (!(params.nextEl || params.prevEl)) return;\n let nextEl = getEl(params.nextEl);\n let prevEl = getEl(params.prevEl);\n Object.assign(swiper.navigation, {\n nextEl,\n prevEl\n });\n nextEl = makeElementsArray(nextEl);\n prevEl = makeElementsArray(prevEl);\n const initButton = (el, dir) => {\n if (el) {\n el.addEventListener('click', dir === 'next' ? onNextClick : onPrevClick);\n }\n if (!swiper.enabled && el) {\n el.classList.add(...params.lockClass.split(' '));\n }\n };\n nextEl.forEach(el => initButton(el, 'next'));\n prevEl.forEach(el => initButton(el, 'prev'));\n }\n function destroy() {\n let {\n nextEl,\n prevEl\n } = swiper.navigation;\n nextEl = makeElementsArray(nextEl);\n prevEl = makeElementsArray(prevEl);\n const destroyButton = (el, dir) => {\n el.removeEventListener('click', dir === 'next' ? onNextClick : onPrevClick);\n el.classList.remove(...swiper.params.navigation.disabledClass.split(' '));\n };\n nextEl.forEach(el => destroyButton(el, 'next'));\n prevEl.forEach(el => destroyButton(el, 'prev'));\n }\n on('init', () => {\n if (swiper.params.navigation.enabled === false) {\n // eslint-disable-next-line\n disable();\n } else {\n init();\n update();\n }\n });\n on('toEdge fromEdge lock unlock', () => {\n update();\n });\n on('destroy', () => {\n destroy();\n });\n on('enable disable', () => {\n let {\n nextEl,\n prevEl\n } = swiper.navigation;\n nextEl = makeElementsArray(nextEl);\n prevEl = makeElementsArray(prevEl);\n if (swiper.enabled) {\n update();\n return;\n }\n [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.add(swiper.params.navigation.lockClass));\n });\n on('click', (_s, e) => {\n let {\n nextEl,\n prevEl\n } = swiper.navigation;\n nextEl = makeElementsArray(nextEl);\n prevEl = makeElementsArray(prevEl);\n const targetEl = e.target;\n if (swiper.params.navigation.hideOnClick && !prevEl.includes(targetEl) && !nextEl.includes(targetEl)) {\n if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return;\n let isHidden;\n if (nextEl.length) {\n isHidden = nextEl[0].classList.contains(swiper.params.navigation.hiddenClass);\n } else if (prevEl.length) {\n isHidden = prevEl[0].classList.contains(swiper.params.navigation.hiddenClass);\n }\n if (isHidden === true) {\n emit('navigationShow');\n } else {\n emit('navigationHide');\n }\n [...nextEl, ...prevEl].filter(el => !!el).forEach(el => el.classList.toggle(swiper.params.navigation.hiddenClass));\n }\n });\n const enable = () => {\n swiper.el.classList.remove(...swiper.params.navigation.navigationDisabledClass.split(' '));\n init();\n update();\n };\n const disable = () => {\n swiper.el.classList.add(...swiper.params.navigation.navigationDisabledClass.split(' '));\n destroy();\n };\n Object.assign(swiper.navigation, {\n enable,\n disable,\n update,\n init,\n destroy\n });\n}\n\nexport { Navigation as default };\n", "function classesToSelector(classes) {\n if (classes === void 0) {\n classes = '';\n }\n return `.${classes.trim().replace(/([\\.:!+\\/])/g, '\\\\$1') // eslint-disable-line\n .replace(/ /g, '.')}`;\n}\n\nexport { classesToSelector as c };\n", "import { c as classesToSelector } from '../shared/classes-to-selector.mjs';\nimport { c as createElementIfNotDefined } from '../shared/create-element-if-not-defined.mjs';\nimport { f as elementOuterSize, g as elementIndex, a as elementParents } from '../shared/utils.mjs';\n\nfunction Pagination(_ref) {\n let {\n swiper,\n extendParams,\n on,\n emit\n } = _ref;\n const pfx = 'swiper-pagination';\n extendParams({\n pagination: {\n el: null,\n bulletElement: 'span',\n clickable: false,\n hideOnClick: false,\n renderBullet: null,\n renderProgressbar: null,\n renderFraction: null,\n renderCustom: null,\n progressbarOpposite: false,\n type: 'bullets',\n // 'bullets' or 'progressbar' or 'fraction' or 'custom'\n dynamicBullets: false,\n dynamicMainBullets: 1,\n formatFractionCurrent: number => number,\n formatFractionTotal: number => number,\n bulletClass: `${pfx}-bullet`,\n bulletActiveClass: `${pfx}-bullet-active`,\n modifierClass: `${pfx}-`,\n currentClass: `${pfx}-current`,\n totalClass: `${pfx}-total`,\n hiddenClass: `${pfx}-hidden`,\n progressbarFillClass: `${pfx}-progressbar-fill`,\n progressbarOppositeClass: `${pfx}-progressbar-opposite`,\n clickableClass: `${pfx}-clickable`,\n lockClass: `${pfx}-lock`,\n horizontalClass: `${pfx}-horizontal`,\n verticalClass: `${pfx}-vertical`,\n paginationDisabledClass: `${pfx}-disabled`\n }\n });\n swiper.pagination = {\n el: null,\n bullets: []\n };\n let bulletSize;\n let dynamicBulletIndex = 0;\n const makeElementsArray = el => (Array.isArray(el) ? el : [el]).filter(e => !!e);\n function isPaginationDisabled() {\n return !swiper.params.pagination.el || !swiper.pagination.el || Array.isArray(swiper.pagination.el) && swiper.pagination.el.length === 0;\n }\n function setSideBullets(bulletEl, position) {\n const {\n bulletActiveClass\n } = swiper.params.pagination;\n if (!bulletEl) return;\n bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];\n if (bulletEl) {\n bulletEl.classList.add(`${bulletActiveClass}-${position}`);\n bulletEl = bulletEl[`${position === 'prev' ? 'previous' : 'next'}ElementSibling`];\n if (bulletEl) {\n bulletEl.classList.add(`${bulletActiveClass}-${position}-${position}`);\n }\n }\n }\n function onBulletClick(e) {\n const bulletEl = e.target.closest(classesToSelector(swiper.params.pagination.bulletClass));\n if (!bulletEl) {\n return;\n }\n e.preventDefault();\n const index = elementIndex(bulletEl) * swiper.params.slidesPerGroup;\n if (swiper.params.loop) {\n if (swiper.realIndex === index) return;\n const realIndex = swiper.realIndex;\n const newSlideIndex = swiper.getSlideIndexByData(index);\n const currentSlideIndex = swiper.getSlideIndexByData(swiper.realIndex);\n const loopFix = dir => {\n const indexBeforeLoopFix = swiper.activeIndex;\n swiper.loopFix({\n direction: dir,\n activeSlideIndex: newSlideIndex,\n slideTo: false\n });\n const indexAfterFix = swiper.activeIndex;\n if (indexBeforeLoopFix === indexAfterFix) {\n swiper.slideToLoop(realIndex, 0, false, true);\n }\n };\n if (newSlideIndex > swiper.slides.length - swiper.loopedSlides) {\n loopFix(newSlideIndex > currentSlideIndex ? 'next' : 'prev');\n } else if (swiper.params.centeredSlides) {\n const slidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(swiper.params.slidesPerView, 10));\n if (newSlideIndex < Math.floor(slidesPerView / 2)) {\n loopFix('prev');\n }\n }\n swiper.slideToLoop(index);\n } else {\n swiper.slideTo(index);\n }\n }\n function update() {\n // Render || Update Pagination bullets/items\n const rtl = swiper.rtl;\n const params = swiper.params.pagination;\n if (isPaginationDisabled()) return;\n let el = swiper.pagination.el;\n el = makeElementsArray(el);\n // Current/Total\n let current;\n let previousIndex;\n const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;\n const total = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;\n if (swiper.params.loop) {\n previousIndex = swiper.previousRealIndex || 0;\n current = swiper.params.slidesPerGroup > 1 ? Math.floor(swiper.realIndex / swiper.params.slidesPerGroup) : swiper.realIndex;\n } else if (typeof swiper.snapIndex !== 'undefined') {\n current = swiper.snapIndex;\n previousIndex = swiper.previousSnapIndex;\n } else {\n previousIndex = swiper.previousIndex || 0;\n current = swiper.activeIndex || 0;\n }\n // Types\n if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {\n const bullets = swiper.pagination.bullets;\n let firstIndex;\n let lastIndex;\n let midIndex;\n if (params.dynamicBullets) {\n bulletSize = elementOuterSize(bullets[0], swiper.isHorizontal() ? 'width' : 'height', true);\n el.forEach(subEl => {\n subEl.style[swiper.isHorizontal() ? 'width' : 'height'] = `${bulletSize * (params.dynamicMainBullets + 4)}px`;\n });\n if (params.dynamicMainBullets > 1 && previousIndex !== undefined) {\n dynamicBulletIndex += current - (previousIndex || 0);\n if (dynamicBulletIndex > params.dynamicMainBullets - 1) {\n dynamicBulletIndex = params.dynamicMainBullets - 1;\n } else if (dynamicBulletIndex < 0) {\n dynamicBulletIndex = 0;\n }\n }\n firstIndex = Math.max(current - dynamicBulletIndex, 0);\n lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1);\n midIndex = (lastIndex + firstIndex) / 2;\n }\n bullets.forEach(bulletEl => {\n const classesToRemove = [...['', '-next', '-next-next', '-prev', '-prev-prev', '-main'].map(suffix => `${params.bulletActiveClass}${suffix}`)].map(s => typeof s === 'string' && s.includes(' ') ? s.split(' ') : s).flat();\n bulletEl.classList.remove(...classesToRemove);\n });\n if (el.length > 1) {\n bullets.forEach(bullet => {\n const bulletIndex = elementIndex(bullet);\n if (bulletIndex === current) {\n bullet.classList.add(...params.bulletActiveClass.split(' '));\n } else if (swiper.isElement) {\n bullet.setAttribute('part', 'bullet');\n }\n if (params.dynamicBullets) {\n if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) {\n bullet.classList.add(...`${params.bulletActiveClass}-main`.split(' '));\n }\n if (bulletIndex === firstIndex) {\n setSideBullets(bullet, 'prev');\n }\n if (bulletIndex === lastIndex) {\n setSideBullets(bullet, 'next');\n }\n }\n });\n } else {\n const bullet = bullets[current];\n if (bullet) {\n bullet.classList.add(...params.bulletActiveClass.split(' '));\n }\n if (swiper.isElement) {\n bullets.forEach((bulletEl, bulletIndex) => {\n bulletEl.setAttribute('part', bulletIndex === current ? 'bullet-active' : 'bullet');\n });\n }\n if (params.dynamicBullets) {\n const firstDisplayedBullet = bullets[firstIndex];\n const lastDisplayedBullet = bullets[lastIndex];\n for (let i = firstIndex; i <= lastIndex; i += 1) {\n if (bullets[i]) {\n bullets[i].classList.add(...`${params.bulletActiveClass}-main`.split(' '));\n }\n }\n setSideBullets(firstDisplayedBullet, 'prev');\n setSideBullets(lastDisplayedBullet, 'next');\n }\n }\n if (params.dynamicBullets) {\n const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4);\n const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize;\n const offsetProp = rtl ? 'right' : 'left';\n bullets.forEach(bullet => {\n bullet.style[swiper.isHorizontal() ? offsetProp : 'top'] = `${bulletsOffset}px`;\n });\n }\n }\n el.forEach((subEl, subElIndex) => {\n if (params.type === 'fraction') {\n subEl.querySelectorAll(classesToSelector(params.currentClass)).forEach(fractionEl => {\n fractionEl.textContent = params.formatFractionCurrent(current + 1);\n });\n subEl.querySelectorAll(classesToSelector(params.totalClass)).forEach(totalEl => {\n totalEl.textContent = params.formatFractionTotal(total);\n });\n }\n if (params.type === 'progressbar') {\n let progressbarDirection;\n if (params.progressbarOpposite) {\n progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal';\n } else {\n progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical';\n }\n const scale = (current + 1) / total;\n let scaleX = 1;\n let scaleY = 1;\n if (progressbarDirection === 'horizontal') {\n scaleX = scale;\n } else {\n scaleY = scale;\n }\n subEl.querySelectorAll(classesToSelector(params.progressbarFillClass)).forEach(progressEl => {\n progressEl.style.transform = `translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`;\n progressEl.style.transitionDuration = `${swiper.params.speed}ms`;\n });\n }\n if (params.type === 'custom' && params.renderCustom) {\n subEl.innerHTML = params.renderCustom(swiper, current + 1, total);\n if (subElIndex === 0) emit('paginationRender', subEl);\n } else {\n if (subElIndex === 0) emit('paginationRender', subEl);\n emit('paginationUpdate', subEl);\n }\n if (swiper.params.watchOverflow && swiper.enabled) {\n subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);\n }\n });\n }\n function render() {\n // Render Container\n const params = swiper.params.pagination;\n if (isPaginationDisabled()) return;\n const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;\n let el = swiper.pagination.el;\n el = makeElementsArray(el);\n let paginationHTML = '';\n if (params.type === 'bullets') {\n let numberOfBullets = swiper.params.loop ? Math.ceil(slidesLength / swiper.params.slidesPerGroup) : swiper.snapGrid.length;\n if (swiper.params.freeMode && swiper.params.freeMode.enabled && numberOfBullets > slidesLength) {\n numberOfBullets = slidesLength;\n }\n for (let i = 0; i < numberOfBullets; i += 1) {\n if (params.renderBullet) {\n paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass);\n } else {\n // prettier-ignore\n paginationHTML += `<${params.bulletElement} ${swiper.isElement ? 'part=\"bullet\"' : ''} class=\"${params.bulletClass}\">${params.bulletElement}>`;\n }\n }\n }\n if (params.type === 'fraction') {\n if (params.renderFraction) {\n paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass);\n } else {\n paginationHTML = `` + ' / ' + ``;\n }\n }\n if (params.type === 'progressbar') {\n if (params.renderProgressbar) {\n paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass);\n } else {\n paginationHTML = ``;\n }\n }\n swiper.pagination.bullets = [];\n el.forEach(subEl => {\n if (params.type !== 'custom') {\n subEl.innerHTML = paginationHTML || '';\n }\n if (params.type === 'bullets') {\n swiper.pagination.bullets.push(...subEl.querySelectorAll(classesToSelector(params.bulletClass)));\n }\n });\n if (params.type !== 'custom') {\n emit('paginationRender', el[0]);\n }\n }\n function init() {\n swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, {\n el: 'swiper-pagination'\n });\n const params = swiper.params.pagination;\n if (!params.el) return;\n let el;\n if (typeof params.el === 'string' && swiper.isElement) {\n el = swiper.el.querySelector(params.el);\n }\n if (!el && typeof params.el === 'string') {\n el = [...document.querySelectorAll(params.el)];\n }\n if (!el) {\n el = params.el;\n }\n if (!el || el.length === 0) return;\n if (swiper.params.uniqueNavElements && typeof params.el === 'string' && Array.isArray(el) && el.length > 1) {\n el = [...swiper.el.querySelectorAll(params.el)];\n // check if it belongs to another nested Swiper\n if (el.length > 1) {\n el = el.filter(subEl => {\n if (elementParents(subEl, '.swiper')[0] !== swiper.el) return false;\n return true;\n })[0];\n }\n }\n if (Array.isArray(el) && el.length === 1) el = el[0];\n Object.assign(swiper.pagination, {\n el\n });\n el = makeElementsArray(el);\n el.forEach(subEl => {\n if (params.type === 'bullets' && params.clickable) {\n subEl.classList.add(...(params.clickableClass || '').split(' '));\n }\n subEl.classList.add(params.modifierClass + params.type);\n subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);\n if (params.type === 'bullets' && params.dynamicBullets) {\n subEl.classList.add(`${params.modifierClass}${params.type}-dynamic`);\n dynamicBulletIndex = 0;\n if (params.dynamicMainBullets < 1) {\n params.dynamicMainBullets = 1;\n }\n }\n if (params.type === 'progressbar' && params.progressbarOpposite) {\n subEl.classList.add(params.progressbarOppositeClass);\n }\n if (params.clickable) {\n subEl.addEventListener('click', onBulletClick);\n }\n if (!swiper.enabled) {\n subEl.classList.add(params.lockClass);\n }\n });\n }\n function destroy() {\n const params = swiper.params.pagination;\n if (isPaginationDisabled()) return;\n let el = swiper.pagination.el;\n if (el) {\n el = makeElementsArray(el);\n el.forEach(subEl => {\n subEl.classList.remove(params.hiddenClass);\n subEl.classList.remove(params.modifierClass + params.type);\n subEl.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);\n if (params.clickable) {\n subEl.classList.remove(...(params.clickableClass || '').split(' '));\n subEl.removeEventListener('click', onBulletClick);\n }\n });\n }\n if (swiper.pagination.bullets) swiper.pagination.bullets.forEach(subEl => subEl.classList.remove(...params.bulletActiveClass.split(' ')));\n }\n on('changeDirection', () => {\n if (!swiper.pagination || !swiper.pagination.el) return;\n const params = swiper.params.pagination;\n let {\n el\n } = swiper.pagination;\n el = makeElementsArray(el);\n el.forEach(subEl => {\n subEl.classList.remove(params.horizontalClass, params.verticalClass);\n subEl.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);\n });\n });\n on('init', () => {\n if (swiper.params.pagination.enabled === false) {\n // eslint-disable-next-line\n disable();\n } else {\n init();\n render();\n update();\n }\n });\n on('activeIndexChange', () => {\n if (typeof swiper.snapIndex === 'undefined') {\n update();\n }\n });\n on('snapIndexChange', () => {\n update();\n });\n on('snapGridLengthChange', () => {\n render();\n update();\n });\n on('destroy', () => {\n destroy();\n });\n on('enable disable', () => {\n let {\n el\n } = swiper.pagination;\n if (el) {\n el = makeElementsArray(el);\n el.forEach(subEl => subEl.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.pagination.lockClass));\n }\n });\n on('lock unlock', () => {\n update();\n });\n on('click', (_s, e) => {\n const targetEl = e.target;\n const el = makeElementsArray(swiper.pagination.el);\n if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && el && el.length > 0 && !targetEl.classList.contains(swiper.params.pagination.bulletClass)) {\n if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return;\n const isHidden = el[0].classList.contains(swiper.params.pagination.hiddenClass);\n if (isHidden === true) {\n emit('paginationShow');\n } else {\n emit('paginationHide');\n }\n el.forEach(subEl => subEl.classList.toggle(swiper.params.pagination.hiddenClass));\n }\n });\n const enable = () => {\n swiper.el.classList.remove(swiper.params.pagination.paginationDisabledClass);\n let {\n el\n } = swiper.pagination;\n if (el) {\n el = makeElementsArray(el);\n el.forEach(subEl => subEl.classList.remove(swiper.params.pagination.paginationDisabledClass));\n }\n init();\n render();\n update();\n };\n const disable = () => {\n swiper.el.classList.add(swiper.params.pagination.paginationDisabledClass);\n let {\n el\n } = swiper.pagination;\n if (el) {\n el = makeElementsArray(el);\n el.forEach(subEl => subEl.classList.add(swiper.params.pagination.paginationDisabledClass));\n }\n destroy();\n };\n Object.assign(swiper.pagination, {\n enable,\n disable,\n render,\n update,\n init,\n destroy\n });\n}\n\nexport { Pagination as default };\n", "import { g as getDocument } from '../shared/ssr-window.esm.mjs';\nimport { c as createElement, n as nextTick, b as elementOffset } from '../shared/utils.mjs';\nimport { c as createElementIfNotDefined } from '../shared/create-element-if-not-defined.mjs';\n\nfunction Scrollbar(_ref) {\n let {\n swiper,\n extendParams,\n on,\n emit\n } = _ref;\n const document = getDocument();\n let isTouched = false;\n let timeout = null;\n let dragTimeout = null;\n let dragStartPos;\n let dragSize;\n let trackSize;\n let divider;\n extendParams({\n scrollbar: {\n el: null,\n dragSize: 'auto',\n hide: false,\n draggable: false,\n snapOnRelease: true,\n lockClass: 'swiper-scrollbar-lock',\n dragClass: 'swiper-scrollbar-drag',\n scrollbarDisabledClass: 'swiper-scrollbar-disabled',\n horizontalClass: `swiper-scrollbar-horizontal`,\n verticalClass: `swiper-scrollbar-vertical`\n }\n });\n swiper.scrollbar = {\n el: null,\n dragEl: null\n };\n function setTranslate() {\n if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;\n const {\n scrollbar,\n rtlTranslate: rtl\n } = swiper;\n const {\n dragEl,\n el\n } = scrollbar;\n const params = swiper.params.scrollbar;\n const progress = swiper.params.loop ? swiper.progressLoop : swiper.progress;\n let newSize = dragSize;\n let newPos = (trackSize - dragSize) * progress;\n if (rtl) {\n newPos = -newPos;\n if (newPos > 0) {\n newSize = dragSize - newPos;\n newPos = 0;\n } else if (-newPos + dragSize > trackSize) {\n newSize = trackSize + newPos;\n }\n } else if (newPos < 0) {\n newSize = dragSize + newPos;\n newPos = 0;\n } else if (newPos + dragSize > trackSize) {\n newSize = trackSize - newPos;\n }\n if (swiper.isHorizontal()) {\n dragEl.style.transform = `translate3d(${newPos}px, 0, 0)`;\n dragEl.style.width = `${newSize}px`;\n } else {\n dragEl.style.transform = `translate3d(0px, ${newPos}px, 0)`;\n dragEl.style.height = `${newSize}px`;\n }\n if (params.hide) {\n clearTimeout(timeout);\n el.style.opacity = 1;\n timeout = setTimeout(() => {\n el.style.opacity = 0;\n el.style.transitionDuration = '400ms';\n }, 1000);\n }\n }\n function setTransition(duration) {\n if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;\n swiper.scrollbar.dragEl.style.transitionDuration = `${duration}ms`;\n }\n function updateSize() {\n if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;\n const {\n scrollbar\n } = swiper;\n const {\n dragEl,\n el\n } = scrollbar;\n dragEl.style.width = '';\n dragEl.style.height = '';\n trackSize = swiper.isHorizontal() ? el.offsetWidth : el.offsetHeight;\n divider = swiper.size / (swiper.virtualSize + swiper.params.slidesOffsetBefore - (swiper.params.centeredSlides ? swiper.snapGrid[0] : 0));\n if (swiper.params.scrollbar.dragSize === 'auto') {\n dragSize = trackSize * divider;\n } else {\n dragSize = parseInt(swiper.params.scrollbar.dragSize, 10);\n }\n if (swiper.isHorizontal()) {\n dragEl.style.width = `${dragSize}px`;\n } else {\n dragEl.style.height = `${dragSize}px`;\n }\n if (divider >= 1) {\n el.style.display = 'none';\n } else {\n el.style.display = '';\n }\n if (swiper.params.scrollbar.hide) {\n el.style.opacity = 0;\n }\n if (swiper.params.watchOverflow && swiper.enabled) {\n scrollbar.el.classList[swiper.isLocked ? 'add' : 'remove'](swiper.params.scrollbar.lockClass);\n }\n }\n function getPointerPosition(e) {\n return swiper.isHorizontal() ? e.clientX : e.clientY;\n }\n function setDragPosition(e) {\n const {\n scrollbar,\n rtlTranslate: rtl\n } = swiper;\n const {\n el\n } = scrollbar;\n let positionRatio;\n positionRatio = (getPointerPosition(e) - elementOffset(el)[swiper.isHorizontal() ? 'left' : 'top'] - (dragStartPos !== null ? dragStartPos : dragSize / 2)) / (trackSize - dragSize);\n positionRatio = Math.max(Math.min(positionRatio, 1), 0);\n if (rtl) {\n positionRatio = 1 - positionRatio;\n }\n const position = swiper.minTranslate() + (swiper.maxTranslate() - swiper.minTranslate()) * positionRatio;\n swiper.updateProgress(position);\n swiper.setTranslate(position);\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n }\n function onDragStart(e) {\n const params = swiper.params.scrollbar;\n const {\n scrollbar,\n wrapperEl\n } = swiper;\n const {\n el,\n dragEl\n } = scrollbar;\n isTouched = true;\n dragStartPos = e.target === dragEl ? getPointerPosition(e) - e.target.getBoundingClientRect()[swiper.isHorizontal() ? 'left' : 'top'] : null;\n e.preventDefault();\n e.stopPropagation();\n wrapperEl.style.transitionDuration = '100ms';\n dragEl.style.transitionDuration = '100ms';\n setDragPosition(e);\n clearTimeout(dragTimeout);\n el.style.transitionDuration = '0ms';\n if (params.hide) {\n el.style.opacity = 1;\n }\n if (swiper.params.cssMode) {\n swiper.wrapperEl.style['scroll-snap-type'] = 'none';\n }\n emit('scrollbarDragStart', e);\n }\n function onDragMove(e) {\n const {\n scrollbar,\n wrapperEl\n } = swiper;\n const {\n el,\n dragEl\n } = scrollbar;\n if (!isTouched) return;\n if (e.preventDefault) e.preventDefault();else e.returnValue = false;\n setDragPosition(e);\n wrapperEl.style.transitionDuration = '0ms';\n el.style.transitionDuration = '0ms';\n dragEl.style.transitionDuration = '0ms';\n emit('scrollbarDragMove', e);\n }\n function onDragEnd(e) {\n const params = swiper.params.scrollbar;\n const {\n scrollbar,\n wrapperEl\n } = swiper;\n const {\n el\n } = scrollbar;\n if (!isTouched) return;\n isTouched = false;\n if (swiper.params.cssMode) {\n swiper.wrapperEl.style['scroll-snap-type'] = '';\n wrapperEl.style.transitionDuration = '';\n }\n if (params.hide) {\n clearTimeout(dragTimeout);\n dragTimeout = nextTick(() => {\n el.style.opacity = 0;\n el.style.transitionDuration = '400ms';\n }, 1000);\n }\n emit('scrollbarDragEnd', e);\n if (params.snapOnRelease) {\n swiper.slideToClosest();\n }\n }\n function events(method) {\n const {\n scrollbar,\n params\n } = swiper;\n const el = scrollbar.el;\n if (!el) return;\n const target = el;\n const activeListener = params.passiveListeners ? {\n passive: false,\n capture: false\n } : false;\n const passiveListener = params.passiveListeners ? {\n passive: true,\n capture: false\n } : false;\n if (!target) return;\n const eventMethod = method === 'on' ? 'addEventListener' : 'removeEventListener';\n target[eventMethod]('pointerdown', onDragStart, activeListener);\n document[eventMethod]('pointermove', onDragMove, activeListener);\n document[eventMethod]('pointerup', onDragEnd, passiveListener);\n }\n function enableDraggable() {\n if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;\n events('on');\n }\n function disableDraggable() {\n if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return;\n events('off');\n }\n function init() {\n const {\n scrollbar,\n el: swiperEl\n } = swiper;\n swiper.params.scrollbar = createElementIfNotDefined(swiper, swiper.originalParams.scrollbar, swiper.params.scrollbar, {\n el: 'swiper-scrollbar'\n });\n const params = swiper.params.scrollbar;\n if (!params.el) return;\n let el;\n if (typeof params.el === 'string' && swiper.isElement) {\n el = swiper.el.querySelector(params.el);\n }\n if (!el && typeof params.el === 'string') {\n el = document.querySelectorAll(params.el);\n } else if (!el) {\n el = params.el;\n }\n if (swiper.params.uniqueNavElements && typeof params.el === 'string' && el.length > 1 && swiperEl.querySelectorAll(params.el).length === 1) {\n el = swiperEl.querySelector(params.el);\n }\n if (el.length > 0) el = el[0];\n el.classList.add(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);\n let dragEl;\n if (el) {\n dragEl = el.querySelector(`.${swiper.params.scrollbar.dragClass}`);\n if (!dragEl) {\n dragEl = createElement('div', swiper.params.scrollbar.dragClass);\n el.append(dragEl);\n }\n }\n Object.assign(scrollbar, {\n el,\n dragEl\n });\n if (params.draggable) {\n enableDraggable();\n }\n if (el) {\n el.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.scrollbar.lockClass);\n }\n }\n function destroy() {\n const params = swiper.params.scrollbar;\n const el = swiper.scrollbar.el;\n if (el) {\n el.classList.remove(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass);\n }\n disableDraggable();\n }\n on('init', () => {\n if (swiper.params.scrollbar.enabled === false) {\n // eslint-disable-next-line\n disable();\n } else {\n init();\n updateSize();\n setTranslate();\n }\n });\n on('update resize observerUpdate lock unlock', () => {\n updateSize();\n });\n on('setTranslate', () => {\n setTranslate();\n });\n on('setTransition', (_s, duration) => {\n setTransition(duration);\n });\n on('enable disable', () => {\n const {\n el\n } = swiper.scrollbar;\n if (el) {\n el.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.scrollbar.lockClass);\n }\n });\n on('destroy', () => {\n destroy();\n });\n const enable = () => {\n swiper.el.classList.remove(swiper.params.scrollbar.scrollbarDisabledClass);\n if (swiper.scrollbar.el) {\n swiper.scrollbar.el.classList.remove(swiper.params.scrollbar.scrollbarDisabledClass);\n }\n init();\n updateSize();\n setTranslate();\n };\n const disable = () => {\n swiper.el.classList.add(swiper.params.scrollbar.scrollbarDisabledClass);\n if (swiper.scrollbar.el) {\n swiper.scrollbar.el.classList.add(swiper.params.scrollbar.scrollbarDisabledClass);\n }\n destroy();\n };\n Object.assign(swiper.scrollbar, {\n enable,\n disable,\n updateSize,\n setTranslate,\n init,\n destroy\n });\n}\n\nexport { Scrollbar as default };\n", "import { e as elementChildren } from '../shared/utils.mjs';\n\nfunction Parallax(_ref) {\n let {\n swiper,\n extendParams,\n on\n } = _ref;\n extendParams({\n parallax: {\n enabled: false\n }\n });\n const elementsSelector = '[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]';\n const setTransform = (el, progress) => {\n const {\n rtl\n } = swiper;\n const rtlFactor = rtl ? -1 : 1;\n const p = el.getAttribute('data-swiper-parallax') || '0';\n let x = el.getAttribute('data-swiper-parallax-x');\n let y = el.getAttribute('data-swiper-parallax-y');\n const scale = el.getAttribute('data-swiper-parallax-scale');\n const opacity = el.getAttribute('data-swiper-parallax-opacity');\n const rotate = el.getAttribute('data-swiper-parallax-rotate');\n if (x || y) {\n x = x || '0';\n y = y || '0';\n } else if (swiper.isHorizontal()) {\n x = p;\n y = '0';\n } else {\n y = p;\n x = '0';\n }\n if (x.indexOf('%') >= 0) {\n x = `${parseInt(x, 10) * progress * rtlFactor}%`;\n } else {\n x = `${x * progress * rtlFactor}px`;\n }\n if (y.indexOf('%') >= 0) {\n y = `${parseInt(y, 10) * progress}%`;\n } else {\n y = `${y * progress}px`;\n }\n if (typeof opacity !== 'undefined' && opacity !== null) {\n const currentOpacity = opacity - (opacity - 1) * (1 - Math.abs(progress));\n el.style.opacity = currentOpacity;\n }\n let transform = `translate3d(${x}, ${y}, 0px)`;\n if (typeof scale !== 'undefined' && scale !== null) {\n const currentScale = scale - (scale - 1) * (1 - Math.abs(progress));\n transform += ` scale(${currentScale})`;\n }\n if (rotate && typeof rotate !== 'undefined' && rotate !== null) {\n const currentRotate = rotate * progress * -1;\n transform += ` rotate(${currentRotate}deg)`;\n }\n el.style.transform = transform;\n };\n const setTranslate = () => {\n const {\n el,\n slides,\n progress,\n snapGrid,\n isElement\n } = swiper;\n const elements = elementChildren(el, elementsSelector);\n if (swiper.isElement) {\n elements.push(...elementChildren(swiper.hostEl, elementsSelector));\n }\n elements.forEach(subEl => {\n setTransform(subEl, progress);\n });\n slides.forEach((slideEl, slideIndex) => {\n let slideProgress = slideEl.progress;\n if (swiper.params.slidesPerGroup > 1 && swiper.params.slidesPerView !== 'auto') {\n slideProgress += Math.ceil(slideIndex / 2) - progress * (snapGrid.length - 1);\n }\n slideProgress = Math.min(Math.max(slideProgress, -1), 1);\n slideEl.querySelectorAll(`${elementsSelector}, [data-swiper-parallax-rotate]`).forEach(subEl => {\n setTransform(subEl, slideProgress);\n });\n });\n };\n const setTransition = function (duration) {\n if (duration === void 0) {\n duration = swiper.params.speed;\n }\n const {\n el,\n hostEl\n } = swiper;\n const elements = [...el.querySelectorAll(elementsSelector)];\n if (swiper.isElement) {\n elements.push(...hostEl.querySelectorAll(elementsSelector));\n }\n elements.forEach(parallaxEl => {\n let parallaxDuration = parseInt(parallaxEl.getAttribute('data-swiper-parallax-duration'), 10) || duration;\n if (duration === 0) parallaxDuration = 0;\n parallaxEl.style.transitionDuration = `${parallaxDuration}ms`;\n });\n };\n on('beforeInit', () => {\n if (!swiper.params.parallax.enabled) return;\n swiper.params.watchSlidesProgress = true;\n swiper.originalParams.watchSlidesProgress = true;\n });\n on('init', () => {\n if (!swiper.params.parallax.enabled) return;\n setTranslate();\n });\n on('setTranslate', () => {\n if (!swiper.params.parallax.enabled) return;\n setTranslate();\n });\n on('setTransition', (_swiper, duration) => {\n if (!swiper.params.parallax.enabled) return;\n setTransition(duration);\n });\n}\n\nexport { Parallax as default };\n", "import { a as getWindow } from '../shared/ssr-window.esm.mjs';\nimport { e as elementChildren, a as elementParents, b as elementOffset, h as getTranslate } from '../shared/utils.mjs';\n\nfunction Zoom(_ref) {\n let {\n swiper,\n extendParams,\n on,\n emit\n } = _ref;\n const window = getWindow();\n extendParams({\n zoom: {\n enabled: false,\n maxRatio: 3,\n minRatio: 1,\n toggle: true,\n containerClass: 'swiper-zoom-container',\n zoomedSlideClass: 'swiper-slide-zoomed'\n }\n });\n swiper.zoom = {\n enabled: false\n };\n let currentScale = 1;\n let isScaling = false;\n let fakeGestureTouched;\n let fakeGestureMoved;\n const evCache = [];\n const gesture = {\n originX: 0,\n originY: 0,\n slideEl: undefined,\n slideWidth: undefined,\n slideHeight: undefined,\n imageEl: undefined,\n imageWrapEl: undefined,\n maxRatio: 3\n };\n const image = {\n isTouched: undefined,\n isMoved: undefined,\n currentX: undefined,\n currentY: undefined,\n minX: undefined,\n minY: undefined,\n maxX: undefined,\n maxY: undefined,\n width: undefined,\n height: undefined,\n startX: undefined,\n startY: undefined,\n touchesStart: {},\n touchesCurrent: {}\n };\n const velocity = {\n x: undefined,\n y: undefined,\n prevPositionX: undefined,\n prevPositionY: undefined,\n prevTime: undefined\n };\n let scale = 1;\n Object.defineProperty(swiper.zoom, 'scale', {\n get() {\n return scale;\n },\n set(value) {\n if (scale !== value) {\n const imageEl = gesture.imageEl;\n const slideEl = gesture.slideEl;\n emit('zoomChange', value, imageEl, slideEl);\n }\n scale = value;\n }\n });\n function getDistanceBetweenTouches() {\n if (evCache.length < 2) return 1;\n const x1 = evCache[0].pageX;\n const y1 = evCache[0].pageY;\n const x2 = evCache[1].pageX;\n const y2 = evCache[1].pageY;\n const distance = Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2);\n return distance;\n }\n function getScaleOrigin() {\n if (evCache.length < 2) return {\n x: null,\n y: null\n };\n const box = gesture.imageEl.getBoundingClientRect();\n return [(evCache[0].pageX + (evCache[1].pageX - evCache[0].pageX) / 2 - box.x - window.scrollX) / currentScale, (evCache[0].pageY + (evCache[1].pageY - evCache[0].pageY) / 2 - box.y - window.scrollY) / currentScale];\n }\n function getSlideSelector() {\n return swiper.isElement ? `swiper-slide` : `.${swiper.params.slideClass}`;\n }\n function eventWithinSlide(e) {\n const slideSelector = getSlideSelector();\n if (e.target.matches(slideSelector)) return true;\n if (swiper.slides.filter(slideEl => slideEl.contains(e.target)).length > 0) return true;\n return false;\n }\n function eventWithinZoomContainer(e) {\n const selector = `.${swiper.params.zoom.containerClass}`;\n if (e.target.matches(selector)) return true;\n if ([...swiper.hostEl.querySelectorAll(selector)].filter(containerEl => containerEl.contains(e.target)).length > 0) return true;\n return false;\n }\n\n // Events\n function onGestureStart(e) {\n if (e.pointerType === 'mouse') {\n evCache.splice(0, evCache.length);\n }\n if (!eventWithinSlide(e)) return;\n const params = swiper.params.zoom;\n fakeGestureTouched = false;\n fakeGestureMoved = false;\n evCache.push(e);\n if (evCache.length < 2) {\n return;\n }\n fakeGestureTouched = true;\n gesture.scaleStart = getDistanceBetweenTouches();\n if (!gesture.slideEl) {\n gesture.slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`);\n if (!gesture.slideEl) gesture.slideEl = swiper.slides[swiper.activeIndex];\n let imageEl = gesture.slideEl.querySelector(`.${params.containerClass}`);\n if (imageEl) {\n imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0];\n }\n gesture.imageEl = imageEl;\n if (imageEl) {\n gesture.imageWrapEl = elementParents(gesture.imageEl, `.${params.containerClass}`)[0];\n } else {\n gesture.imageWrapEl = undefined;\n }\n if (!gesture.imageWrapEl) {\n gesture.imageEl = undefined;\n return;\n }\n gesture.maxRatio = gesture.imageWrapEl.getAttribute('data-swiper-zoom') || params.maxRatio;\n }\n if (gesture.imageEl) {\n const [originX, originY] = getScaleOrigin();\n gesture.originX = originX;\n gesture.originY = originY;\n gesture.imageEl.style.transitionDuration = '0ms';\n }\n isScaling = true;\n }\n function onGestureChange(e) {\n if (!eventWithinSlide(e)) return;\n const params = swiper.params.zoom;\n const zoom = swiper.zoom;\n const pointerIndex = evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId);\n if (pointerIndex >= 0) evCache[pointerIndex] = e;\n if (evCache.length < 2) {\n return;\n }\n fakeGestureMoved = true;\n gesture.scaleMove = getDistanceBetweenTouches();\n if (!gesture.imageEl) {\n return;\n }\n zoom.scale = gesture.scaleMove / gesture.scaleStart * currentScale;\n if (zoom.scale > gesture.maxRatio) {\n zoom.scale = gesture.maxRatio - 1 + (zoom.scale - gesture.maxRatio + 1) ** 0.5;\n }\n if (zoom.scale < params.minRatio) {\n zoom.scale = params.minRatio + 1 - (params.minRatio - zoom.scale + 1) ** 0.5;\n }\n gesture.imageEl.style.transform = `translate3d(0,0,0) scale(${zoom.scale})`;\n }\n function onGestureEnd(e) {\n if (!eventWithinSlide(e)) return;\n if (e.pointerType === 'mouse' && e.type === 'pointerout') return;\n const params = swiper.params.zoom;\n const zoom = swiper.zoom;\n const pointerIndex = evCache.findIndex(cachedEv => cachedEv.pointerId === e.pointerId);\n if (pointerIndex >= 0) evCache.splice(pointerIndex, 1);\n if (!fakeGestureTouched || !fakeGestureMoved) {\n return;\n }\n fakeGestureTouched = false;\n fakeGestureMoved = false;\n if (!gesture.imageEl) return;\n zoom.scale = Math.max(Math.min(zoom.scale, gesture.maxRatio), params.minRatio);\n gesture.imageEl.style.transitionDuration = `${swiper.params.speed}ms`;\n gesture.imageEl.style.transform = `translate3d(0,0,0) scale(${zoom.scale})`;\n currentScale = zoom.scale;\n isScaling = false;\n if (zoom.scale > 1 && gesture.slideEl) {\n gesture.slideEl.classList.add(`${params.zoomedSlideClass}`);\n } else if (zoom.scale <= 1 && gesture.slideEl) {\n gesture.slideEl.classList.remove(`${params.zoomedSlideClass}`);\n }\n if (zoom.scale === 1) {\n gesture.originX = 0;\n gesture.originY = 0;\n gesture.slideEl = undefined;\n }\n }\n function onTouchStart(e) {\n const device = swiper.device;\n if (!gesture.imageEl) return;\n if (image.isTouched) return;\n if (device.android && e.cancelable) e.preventDefault();\n image.isTouched = true;\n const event = evCache.length > 0 ? evCache[0] : e;\n image.touchesStart.x = event.pageX;\n image.touchesStart.y = event.pageY;\n }\n function onTouchMove(e) {\n if (!eventWithinSlide(e) || !eventWithinZoomContainer(e)) return;\n const zoom = swiper.zoom;\n if (!gesture.imageEl) return;\n if (!image.isTouched || !gesture.slideEl) return;\n if (!image.isMoved) {\n image.width = gesture.imageEl.offsetWidth;\n image.height = gesture.imageEl.offsetHeight;\n image.startX = getTranslate(gesture.imageWrapEl, 'x') || 0;\n image.startY = getTranslate(gesture.imageWrapEl, 'y') || 0;\n gesture.slideWidth = gesture.slideEl.offsetWidth;\n gesture.slideHeight = gesture.slideEl.offsetHeight;\n gesture.imageWrapEl.style.transitionDuration = '0ms';\n }\n // Define if we need image drag\n const scaledWidth = image.width * zoom.scale;\n const scaledHeight = image.height * zoom.scale;\n if (scaledWidth < gesture.slideWidth && scaledHeight < gesture.slideHeight) return;\n image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0);\n image.maxX = -image.minX;\n image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0);\n image.maxY = -image.minY;\n image.touchesCurrent.x = evCache.length > 0 ? evCache[0].pageX : e.pageX;\n image.touchesCurrent.y = evCache.length > 0 ? evCache[0].pageY : e.pageY;\n const touchesDiff = Math.max(Math.abs(image.touchesCurrent.x - image.touchesStart.x), Math.abs(image.touchesCurrent.y - image.touchesStart.y));\n if (touchesDiff > 5) {\n swiper.allowClick = false;\n }\n if (!image.isMoved && !isScaling) {\n if (swiper.isHorizontal() && (Math.floor(image.minX) === Math.floor(image.startX) && image.touchesCurrent.x < image.touchesStart.x || Math.floor(image.maxX) === Math.floor(image.startX) && image.touchesCurrent.x > image.touchesStart.x)) {\n image.isTouched = false;\n return;\n }\n if (!swiper.isHorizontal() && (Math.floor(image.minY) === Math.floor(image.startY) && image.touchesCurrent.y < image.touchesStart.y || Math.floor(image.maxY) === Math.floor(image.startY) && image.touchesCurrent.y > image.touchesStart.y)) {\n image.isTouched = false;\n return;\n }\n }\n if (e.cancelable) {\n e.preventDefault();\n }\n e.stopPropagation();\n image.isMoved = true;\n const scaleRatio = (zoom.scale - currentScale) / (gesture.maxRatio - swiper.params.zoom.minRatio);\n const {\n originX,\n originY\n } = gesture;\n image.currentX = image.touchesCurrent.x - image.touchesStart.x + image.startX + scaleRatio * (image.width - originX * 2);\n image.currentY = image.touchesCurrent.y - image.touchesStart.y + image.startY + scaleRatio * (image.height - originY * 2);\n if (image.currentX < image.minX) {\n image.currentX = image.minX + 1 - (image.minX - image.currentX + 1) ** 0.8;\n }\n if (image.currentX > image.maxX) {\n image.currentX = image.maxX - 1 + (image.currentX - image.maxX + 1) ** 0.8;\n }\n if (image.currentY < image.minY) {\n image.currentY = image.minY + 1 - (image.minY - image.currentY + 1) ** 0.8;\n }\n if (image.currentY > image.maxY) {\n image.currentY = image.maxY - 1 + (image.currentY - image.maxY + 1) ** 0.8;\n }\n\n // Velocity\n if (!velocity.prevPositionX) velocity.prevPositionX = image.touchesCurrent.x;\n if (!velocity.prevPositionY) velocity.prevPositionY = image.touchesCurrent.y;\n if (!velocity.prevTime) velocity.prevTime = Date.now();\n velocity.x = (image.touchesCurrent.x - velocity.prevPositionX) / (Date.now() - velocity.prevTime) / 2;\n velocity.y = (image.touchesCurrent.y - velocity.prevPositionY) / (Date.now() - velocity.prevTime) / 2;\n if (Math.abs(image.touchesCurrent.x - velocity.prevPositionX) < 2) velocity.x = 0;\n if (Math.abs(image.touchesCurrent.y - velocity.prevPositionY) < 2) velocity.y = 0;\n velocity.prevPositionX = image.touchesCurrent.x;\n velocity.prevPositionY = image.touchesCurrent.y;\n velocity.prevTime = Date.now();\n gesture.imageWrapEl.style.transform = `translate3d(${image.currentX}px, ${image.currentY}px,0)`;\n }\n function onTouchEnd() {\n const zoom = swiper.zoom;\n if (!gesture.imageEl) return;\n if (!image.isTouched || !image.isMoved) {\n image.isTouched = false;\n image.isMoved = false;\n return;\n }\n image.isTouched = false;\n image.isMoved = false;\n let momentumDurationX = 300;\n let momentumDurationY = 300;\n const momentumDistanceX = velocity.x * momentumDurationX;\n const newPositionX = image.currentX + momentumDistanceX;\n const momentumDistanceY = velocity.y * momentumDurationY;\n const newPositionY = image.currentY + momentumDistanceY;\n\n // Fix duration\n if (velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - image.currentX) / velocity.x);\n if (velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - image.currentY) / velocity.y);\n const momentumDuration = Math.max(momentumDurationX, momentumDurationY);\n image.currentX = newPositionX;\n image.currentY = newPositionY;\n // Define if we need image drag\n const scaledWidth = image.width * zoom.scale;\n const scaledHeight = image.height * zoom.scale;\n image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0);\n image.maxX = -image.minX;\n image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0);\n image.maxY = -image.minY;\n image.currentX = Math.max(Math.min(image.currentX, image.maxX), image.minX);\n image.currentY = Math.max(Math.min(image.currentY, image.maxY), image.minY);\n gesture.imageWrapEl.style.transitionDuration = `${momentumDuration}ms`;\n gesture.imageWrapEl.style.transform = `translate3d(${image.currentX}px, ${image.currentY}px,0)`;\n }\n function onTransitionEnd() {\n const zoom = swiper.zoom;\n if (gesture.slideEl && swiper.activeIndex !== swiper.slides.indexOf(gesture.slideEl)) {\n if (gesture.imageEl) {\n gesture.imageEl.style.transform = 'translate3d(0,0,0) scale(1)';\n }\n if (gesture.imageWrapEl) {\n gesture.imageWrapEl.style.transform = 'translate3d(0,0,0)';\n }\n gesture.slideEl.classList.remove(`${swiper.params.zoom.zoomedSlideClass}`);\n zoom.scale = 1;\n currentScale = 1;\n gesture.slideEl = undefined;\n gesture.imageEl = undefined;\n gesture.imageWrapEl = undefined;\n gesture.originX = 0;\n gesture.originY = 0;\n }\n }\n function zoomIn(e) {\n const zoom = swiper.zoom;\n const params = swiper.params.zoom;\n if (!gesture.slideEl) {\n if (e && e.target) {\n gesture.slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`);\n }\n if (!gesture.slideEl) {\n if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) {\n gesture.slideEl = elementChildren(swiper.slidesEl, `.${swiper.params.slideActiveClass}`)[0];\n } else {\n gesture.slideEl = swiper.slides[swiper.activeIndex];\n }\n }\n let imageEl = gesture.slideEl.querySelector(`.${params.containerClass}`);\n if (imageEl) {\n imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0];\n }\n gesture.imageEl = imageEl;\n if (imageEl) {\n gesture.imageWrapEl = elementParents(gesture.imageEl, `.${params.containerClass}`)[0];\n } else {\n gesture.imageWrapEl = undefined;\n }\n }\n if (!gesture.imageEl || !gesture.imageWrapEl) return;\n if (swiper.params.cssMode) {\n swiper.wrapperEl.style.overflow = 'hidden';\n swiper.wrapperEl.style.touchAction = 'none';\n }\n gesture.slideEl.classList.add(`${params.zoomedSlideClass}`);\n let touchX;\n let touchY;\n let offsetX;\n let offsetY;\n let diffX;\n let diffY;\n let translateX;\n let translateY;\n let imageWidth;\n let imageHeight;\n let scaledWidth;\n let scaledHeight;\n let translateMinX;\n let translateMinY;\n let translateMaxX;\n let translateMaxY;\n let slideWidth;\n let slideHeight;\n if (typeof image.touchesStart.x === 'undefined' && e) {\n touchX = e.pageX;\n touchY = e.pageY;\n } else {\n touchX = image.touchesStart.x;\n touchY = image.touchesStart.y;\n }\n const forceZoomRatio = typeof e === 'number' ? e : null;\n if (currentScale === 1 && forceZoomRatio) {\n touchX = undefined;\n touchY = undefined;\n }\n zoom.scale = forceZoomRatio || gesture.imageWrapEl.getAttribute('data-swiper-zoom') || params.maxRatio;\n currentScale = forceZoomRatio || gesture.imageWrapEl.getAttribute('data-swiper-zoom') || params.maxRatio;\n if (e && !(currentScale === 1 && forceZoomRatio)) {\n slideWidth = gesture.slideEl.offsetWidth;\n slideHeight = gesture.slideEl.offsetHeight;\n offsetX = elementOffset(gesture.slideEl).left + window.scrollX;\n offsetY = elementOffset(gesture.slideEl).top + window.scrollY;\n diffX = offsetX + slideWidth / 2 - touchX;\n diffY = offsetY + slideHeight / 2 - touchY;\n imageWidth = gesture.imageEl.offsetWidth;\n imageHeight = gesture.imageEl.offsetHeight;\n scaledWidth = imageWidth * zoom.scale;\n scaledHeight = imageHeight * zoom.scale;\n translateMinX = Math.min(slideWidth / 2 - scaledWidth / 2, 0);\n translateMinY = Math.min(slideHeight / 2 - scaledHeight / 2, 0);\n translateMaxX = -translateMinX;\n translateMaxY = -translateMinY;\n translateX = diffX * zoom.scale;\n translateY = diffY * zoom.scale;\n if (translateX < translateMinX) {\n translateX = translateMinX;\n }\n if (translateX > translateMaxX) {\n translateX = translateMaxX;\n }\n if (translateY < translateMinY) {\n translateY = translateMinY;\n }\n if (translateY > translateMaxY) {\n translateY = translateMaxY;\n }\n } else {\n translateX = 0;\n translateY = 0;\n }\n if (forceZoomRatio && zoom.scale === 1) {\n gesture.originX = 0;\n gesture.originY = 0;\n }\n gesture.imageWrapEl.style.transitionDuration = '300ms';\n gesture.imageWrapEl.style.transform = `translate3d(${translateX}px, ${translateY}px,0)`;\n gesture.imageEl.style.transitionDuration = '300ms';\n gesture.imageEl.style.transform = `translate3d(0,0,0) scale(${zoom.scale})`;\n }\n function zoomOut() {\n const zoom = swiper.zoom;\n const params = swiper.params.zoom;\n if (!gesture.slideEl) {\n if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) {\n gesture.slideEl = elementChildren(swiper.slidesEl, `.${swiper.params.slideActiveClass}`)[0];\n } else {\n gesture.slideEl = swiper.slides[swiper.activeIndex];\n }\n let imageEl = gesture.slideEl.querySelector(`.${params.containerClass}`);\n if (imageEl) {\n imageEl = imageEl.querySelectorAll('picture, img, svg, canvas, .swiper-zoom-target')[0];\n }\n gesture.imageEl = imageEl;\n if (imageEl) {\n gesture.imageWrapEl = elementParents(gesture.imageEl, `.${params.containerClass}`)[0];\n } else {\n gesture.imageWrapEl = undefined;\n }\n }\n if (!gesture.imageEl || !gesture.imageWrapEl) return;\n if (swiper.params.cssMode) {\n swiper.wrapperEl.style.overflow = '';\n swiper.wrapperEl.style.touchAction = '';\n }\n zoom.scale = 1;\n currentScale = 1;\n gesture.imageWrapEl.style.transitionDuration = '300ms';\n gesture.imageWrapEl.style.transform = 'translate3d(0,0,0)';\n gesture.imageEl.style.transitionDuration = '300ms';\n gesture.imageEl.style.transform = 'translate3d(0,0,0) scale(1)';\n gesture.slideEl.classList.remove(`${params.zoomedSlideClass}`);\n gesture.slideEl = undefined;\n gesture.originX = 0;\n gesture.originY = 0;\n }\n\n // Toggle Zoom\n function zoomToggle(e) {\n const zoom = swiper.zoom;\n if (zoom.scale && zoom.scale !== 1) {\n // Zoom Out\n zoomOut();\n } else {\n // Zoom In\n zoomIn(e);\n }\n }\n function getListeners() {\n const passiveListener = swiper.params.passiveListeners ? {\n passive: true,\n capture: false\n } : false;\n const activeListenerWithCapture = swiper.params.passiveListeners ? {\n passive: false,\n capture: true\n } : true;\n return {\n passiveListener,\n activeListenerWithCapture\n };\n }\n\n // Attach/Detach Events\n function enable() {\n const zoom = swiper.zoom;\n if (zoom.enabled) return;\n zoom.enabled = true;\n const {\n passiveListener,\n activeListenerWithCapture\n } = getListeners();\n\n // Scale image\n swiper.wrapperEl.addEventListener('pointerdown', onGestureStart, passiveListener);\n swiper.wrapperEl.addEventListener('pointermove', onGestureChange, activeListenerWithCapture);\n ['pointerup', 'pointercancel', 'pointerout'].forEach(eventName => {\n swiper.wrapperEl.addEventListener(eventName, onGestureEnd, passiveListener);\n });\n\n // Move image\n swiper.wrapperEl.addEventListener('pointermove', onTouchMove, activeListenerWithCapture);\n }\n function disable() {\n const zoom = swiper.zoom;\n if (!zoom.enabled) return;\n zoom.enabled = false;\n const {\n passiveListener,\n activeListenerWithCapture\n } = getListeners();\n\n // Scale image\n swiper.wrapperEl.removeEventListener('pointerdown', onGestureStart, passiveListener);\n swiper.wrapperEl.removeEventListener('pointermove', onGestureChange, activeListenerWithCapture);\n ['pointerup', 'pointercancel', 'pointerout'].forEach(eventName => {\n swiper.wrapperEl.removeEventListener(eventName, onGestureEnd, passiveListener);\n });\n\n // Move image\n swiper.wrapperEl.removeEventListener('pointermove', onTouchMove, activeListenerWithCapture);\n }\n on('init', () => {\n if (swiper.params.zoom.enabled) {\n enable();\n }\n });\n on('destroy', () => {\n disable();\n });\n on('touchStart', (_s, e) => {\n if (!swiper.zoom.enabled) return;\n onTouchStart(e);\n });\n on('touchEnd', (_s, e) => {\n if (!swiper.zoom.enabled) return;\n onTouchEnd();\n });\n on('doubleTap', (_s, e) => {\n if (!swiper.animating && swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) {\n zoomToggle(e);\n }\n });\n on('transitionEnd', () => {\n if (swiper.zoom.enabled && swiper.params.zoom.enabled) {\n onTransitionEnd();\n }\n });\n on('slideChange', () => {\n if (swiper.zoom.enabled && swiper.params.zoom.enabled && swiper.params.cssMode) {\n onTransitionEnd();\n }\n });\n Object.assign(swiper.zoom, {\n enable,\n disable,\n in: zoomIn,\n out: zoomOut,\n toggle: zoomToggle\n });\n}\n\nexport { Zoom as default };\n", "import { n as nextTick, i as elementTransitionEnd } from '../shared/utils.mjs';\n\n/* eslint no-bitwise: [\"error\", { \"allow\": [\">>\"] }] */\nfunction Controller(_ref) {\n let {\n swiper,\n extendParams,\n on\n } = _ref;\n extendParams({\n controller: {\n control: undefined,\n inverse: false,\n by: 'slide' // or 'container'\n }\n });\n\n swiper.controller = {\n control: undefined\n };\n function LinearSpline(x, y) {\n const binarySearch = function search() {\n let maxIndex;\n let minIndex;\n let guess;\n return (array, val) => {\n minIndex = -1;\n maxIndex = array.length;\n while (maxIndex - minIndex > 1) {\n guess = maxIndex + minIndex >> 1;\n if (array[guess] <= val) {\n minIndex = guess;\n } else {\n maxIndex = guess;\n }\n }\n return maxIndex;\n };\n }();\n this.x = x;\n this.y = y;\n this.lastIndex = x.length - 1;\n // Given an x value (x2), return the expected y2 value:\n // (x1,y1) is the known point before given value,\n // (x3,y3) is the known point after given value.\n let i1;\n let i3;\n this.interpolate = function interpolate(x2) {\n if (!x2) return 0;\n\n // Get the indexes of x1 and x3 (the array indexes before and after given x2):\n i3 = binarySearch(this.x, x2);\n i1 = i3 - 1;\n\n // We have our indexes i1 & i3, so we can calculate already:\n // y2 := ((x2\u2212x1) \u00D7 (y3\u2212y1)) \u00F7 (x3\u2212x1) + y1\n return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1];\n };\n return this;\n }\n function getInterpolateFunction(c) {\n swiper.controller.spline = swiper.params.loop ? new LinearSpline(swiper.slidesGrid, c.slidesGrid) : new LinearSpline(swiper.snapGrid, c.snapGrid);\n }\n function setTranslate(_t, byController) {\n const controlled = swiper.controller.control;\n let multiplier;\n let controlledTranslate;\n const Swiper = swiper.constructor;\n function setControlledTranslate(c) {\n if (c.destroyed) return;\n\n // this will create an Interpolate function based on the snapGrids\n // x is the Grid of the scrolled scroller and y will be the controlled scroller\n // it makes sense to create this only once and recall it for the interpolation\n // the function does a lot of value caching for performance\n const translate = swiper.rtlTranslate ? -swiper.translate : swiper.translate;\n if (swiper.params.controller.by === 'slide') {\n getInterpolateFunction(c);\n // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid\n // but it did not work out\n controlledTranslate = -swiper.controller.spline.interpolate(-translate);\n }\n if (!controlledTranslate || swiper.params.controller.by === 'container') {\n multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate());\n if (Number.isNaN(multiplier) || !Number.isFinite(multiplier)) {\n multiplier = 1;\n }\n controlledTranslate = (translate - swiper.minTranslate()) * multiplier + c.minTranslate();\n }\n if (swiper.params.controller.inverse) {\n controlledTranslate = c.maxTranslate() - controlledTranslate;\n }\n c.updateProgress(controlledTranslate);\n c.setTranslate(controlledTranslate, swiper);\n c.updateActiveIndex();\n c.updateSlidesClasses();\n }\n if (Array.isArray(controlled)) {\n for (let i = 0; i < controlled.length; i += 1) {\n if (controlled[i] !== byController && controlled[i] instanceof Swiper) {\n setControlledTranslate(controlled[i]);\n }\n }\n } else if (controlled instanceof Swiper && byController !== controlled) {\n setControlledTranslate(controlled);\n }\n }\n function setTransition(duration, byController) {\n const Swiper = swiper.constructor;\n const controlled = swiper.controller.control;\n let i;\n function setControlledTransition(c) {\n if (c.destroyed) return;\n c.setTransition(duration, swiper);\n if (duration !== 0) {\n c.transitionStart();\n if (c.params.autoHeight) {\n nextTick(() => {\n c.updateAutoHeight();\n });\n }\n elementTransitionEnd(c.wrapperEl, () => {\n if (!controlled) return;\n c.transitionEnd();\n });\n }\n }\n if (Array.isArray(controlled)) {\n for (i = 0; i < controlled.length; i += 1) {\n if (controlled[i] !== byController && controlled[i] instanceof Swiper) {\n setControlledTransition(controlled[i]);\n }\n }\n } else if (controlled instanceof Swiper && byController !== controlled) {\n setControlledTransition(controlled);\n }\n }\n function removeSpline() {\n if (!swiper.controller.control) return;\n if (swiper.controller.spline) {\n swiper.controller.spline = undefined;\n delete swiper.controller.spline;\n }\n }\n on('beforeInit', () => {\n if (typeof window !== 'undefined' && (\n // eslint-disable-line\n typeof swiper.params.controller.control === 'string' || swiper.params.controller.control instanceof HTMLElement)) {\n const controlElement = document.querySelector(swiper.params.controller.control);\n if (controlElement && controlElement.swiper) {\n swiper.controller.control = controlElement.swiper;\n } else if (controlElement) {\n const onControllerSwiper = e => {\n swiper.controller.control = e.detail[0];\n swiper.update();\n controlElement.removeEventListener('init', onControllerSwiper);\n };\n controlElement.addEventListener('init', onControllerSwiper);\n }\n return;\n }\n swiper.controller.control = swiper.params.controller.control;\n });\n on('update', () => {\n removeSpline();\n });\n on('resize', () => {\n removeSpline();\n });\n on('observerUpdate', () => {\n removeSpline();\n });\n on('setTranslate', (_s, translate, byController) => {\n if (!swiper.controller.control || swiper.controller.control.destroyed) return;\n swiper.controller.setTranslate(translate, byController);\n });\n on('setTransition', (_s, duration, byController) => {\n if (!swiper.controller.control || swiper.controller.control.destroyed) return;\n swiper.controller.setTransition(duration, byController);\n });\n Object.assign(swiper.controller, {\n setTranslate,\n setTransition\n });\n}\n\nexport { Controller as default };\n", "import { c as classesToSelector } from '../shared/classes-to-selector.mjs';\nimport { c as createElement, g as elementIndex } from '../shared/utils.mjs';\n\nfunction A11y(_ref) {\n let {\n swiper,\n extendParams,\n on\n } = _ref;\n extendParams({\n a11y: {\n enabled: true,\n notificationClass: 'swiper-notification',\n prevSlideMessage: 'Previous slide',\n nextSlideMessage: 'Next slide',\n firstSlideMessage: 'This is the first slide',\n lastSlideMessage: 'This is the last slide',\n paginationBulletMessage: 'Go to slide {{index}}',\n slideLabelMessage: '{{index}} / {{slidesLength}}',\n containerMessage: null,\n containerRoleDescriptionMessage: null,\n itemRoleDescriptionMessage: null,\n slideRole: 'group',\n id: null\n }\n });\n swiper.a11y = {\n clicked: false\n };\n let liveRegion = null;\n function notify(message) {\n const notification = liveRegion;\n if (notification.length === 0) return;\n notification.innerHTML = '';\n notification.innerHTML = message;\n }\n const makeElementsArray = el => (Array.isArray(el) ? el : [el]).filter(e => !!e);\n function getRandomNumber(size) {\n if (size === void 0) {\n size = 16;\n }\n const randomChar = () => Math.round(16 * Math.random()).toString(16);\n return 'x'.repeat(size).replace(/x/g, randomChar);\n }\n function makeElFocusable(el) {\n el = makeElementsArray(el);\n el.forEach(subEl => {\n subEl.setAttribute('tabIndex', '0');\n });\n }\n function makeElNotFocusable(el) {\n el = makeElementsArray(el);\n el.forEach(subEl => {\n subEl.setAttribute('tabIndex', '-1');\n });\n }\n function addElRole(el, role) {\n el = makeElementsArray(el);\n el.forEach(subEl => {\n subEl.setAttribute('role', role);\n });\n }\n function addElRoleDescription(el, description) {\n el = makeElementsArray(el);\n el.forEach(subEl => {\n subEl.setAttribute('aria-roledescription', description);\n });\n }\n function addElControls(el, controls) {\n el = makeElementsArray(el);\n el.forEach(subEl => {\n subEl.setAttribute('aria-controls', controls);\n });\n }\n function addElLabel(el, label) {\n el = makeElementsArray(el);\n el.forEach(subEl => {\n subEl.setAttribute('aria-label', label);\n });\n }\n function addElId(el, id) {\n el = makeElementsArray(el);\n el.forEach(subEl => {\n subEl.setAttribute('id', id);\n });\n }\n function addElLive(el, live) {\n el = makeElementsArray(el);\n el.forEach(subEl => {\n subEl.setAttribute('aria-live', live);\n });\n }\n function disableEl(el) {\n el = makeElementsArray(el);\n el.forEach(subEl => {\n subEl.setAttribute('aria-disabled', true);\n });\n }\n function enableEl(el) {\n el = makeElementsArray(el);\n el.forEach(subEl => {\n subEl.setAttribute('aria-disabled', false);\n });\n }\n function onEnterOrSpaceKey(e) {\n if (e.keyCode !== 13 && e.keyCode !== 32) return;\n const params = swiper.params.a11y;\n const targetEl = e.target;\n if (swiper.pagination && swiper.pagination.el && (targetEl === swiper.pagination.el || swiper.pagination.el.contains(e.target))) {\n if (!e.target.matches(classesToSelector(swiper.params.pagination.bulletClass))) return;\n }\n if (swiper.navigation && swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl) {\n if (!(swiper.isEnd && !swiper.params.loop)) {\n swiper.slideNext();\n }\n if (swiper.isEnd) {\n notify(params.lastSlideMessage);\n } else {\n notify(params.nextSlideMessage);\n }\n }\n if (swiper.navigation && swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl) {\n if (!(swiper.isBeginning && !swiper.params.loop)) {\n swiper.slidePrev();\n }\n if (swiper.isBeginning) {\n notify(params.firstSlideMessage);\n } else {\n notify(params.prevSlideMessage);\n }\n }\n if (swiper.pagination && targetEl.matches(classesToSelector(swiper.params.pagination.bulletClass))) {\n targetEl.click();\n }\n }\n function updateNavigation() {\n if (swiper.params.loop || swiper.params.rewind || !swiper.navigation) return;\n const {\n nextEl,\n prevEl\n } = swiper.navigation;\n if (prevEl) {\n if (swiper.isBeginning) {\n disableEl(prevEl);\n makeElNotFocusable(prevEl);\n } else {\n enableEl(prevEl);\n makeElFocusable(prevEl);\n }\n }\n if (nextEl) {\n if (swiper.isEnd) {\n disableEl(nextEl);\n makeElNotFocusable(nextEl);\n } else {\n enableEl(nextEl);\n makeElFocusable(nextEl);\n }\n }\n }\n function hasPagination() {\n return swiper.pagination && swiper.pagination.bullets && swiper.pagination.bullets.length;\n }\n function hasClickablePagination() {\n return hasPagination() && swiper.params.pagination.clickable;\n }\n function updatePagination() {\n const params = swiper.params.a11y;\n if (!hasPagination()) return;\n swiper.pagination.bullets.forEach(bulletEl => {\n if (swiper.params.pagination.clickable) {\n makeElFocusable(bulletEl);\n if (!swiper.params.pagination.renderBullet) {\n addElRole(bulletEl, 'button');\n addElLabel(bulletEl, params.paginationBulletMessage.replace(/\\{\\{index\\}\\}/, elementIndex(bulletEl) + 1));\n }\n }\n if (bulletEl.matches(classesToSelector(swiper.params.pagination.bulletActiveClass))) {\n bulletEl.setAttribute('aria-current', 'true');\n } else {\n bulletEl.removeAttribute('aria-current');\n }\n });\n }\n const initNavEl = (el, wrapperId, message) => {\n makeElFocusable(el);\n if (el.tagName !== 'BUTTON') {\n addElRole(el, 'button');\n el.addEventListener('keydown', onEnterOrSpaceKey);\n }\n addElLabel(el, message);\n addElControls(el, wrapperId);\n };\n const handlePointerDown = () => {\n swiper.a11y.clicked = true;\n };\n const handlePointerUp = () => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (!swiper.destroyed) {\n swiper.a11y.clicked = false;\n }\n });\n });\n };\n const handleFocus = e => {\n if (swiper.a11y.clicked) return;\n const slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`);\n if (!slideEl || !swiper.slides.includes(slideEl)) return;\n const isActive = swiper.slides.indexOf(slideEl) === swiper.activeIndex;\n const isVisible = swiper.params.watchSlidesProgress && swiper.visibleSlides && swiper.visibleSlides.includes(slideEl);\n if (isActive || isVisible) return;\n if (e.sourceCapabilities && e.sourceCapabilities.firesTouchEvents) return;\n if (swiper.isHorizontal()) {\n swiper.el.scrollLeft = 0;\n } else {\n swiper.el.scrollTop = 0;\n }\n swiper.slideTo(swiper.slides.indexOf(slideEl), 0);\n };\n const initSlides = () => {\n const params = swiper.params.a11y;\n if (params.itemRoleDescriptionMessage) {\n addElRoleDescription(swiper.slides, params.itemRoleDescriptionMessage);\n }\n if (params.slideRole) {\n addElRole(swiper.slides, params.slideRole);\n }\n const slidesLength = swiper.slides.length;\n if (params.slideLabelMessage) {\n swiper.slides.forEach((slideEl, index) => {\n const slideIndex = swiper.params.loop ? parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10) : index;\n const ariaLabelMessage = params.slideLabelMessage.replace(/\\{\\{index\\}\\}/, slideIndex + 1).replace(/\\{\\{slidesLength\\}\\}/, slidesLength);\n addElLabel(slideEl, ariaLabelMessage);\n });\n }\n };\n const init = () => {\n const params = swiper.params.a11y;\n swiper.el.append(liveRegion);\n\n // Container\n const containerEl = swiper.el;\n if (params.containerRoleDescriptionMessage) {\n addElRoleDescription(containerEl, params.containerRoleDescriptionMessage);\n }\n if (params.containerMessage) {\n addElLabel(containerEl, params.containerMessage);\n }\n\n // Wrapper\n const wrapperEl = swiper.wrapperEl;\n const wrapperId = params.id || wrapperEl.getAttribute('id') || `swiper-wrapper-${getRandomNumber(16)}`;\n const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite';\n addElId(wrapperEl, wrapperId);\n addElLive(wrapperEl, live);\n\n // Slide\n initSlides();\n\n // Navigation\n let {\n nextEl,\n prevEl\n } = swiper.navigation ? swiper.navigation : {};\n nextEl = makeElementsArray(nextEl);\n prevEl = makeElementsArray(prevEl);\n if (nextEl) {\n nextEl.forEach(el => initNavEl(el, wrapperId, params.nextSlideMessage));\n }\n if (prevEl) {\n prevEl.forEach(el => initNavEl(el, wrapperId, params.prevSlideMessage));\n }\n\n // Pagination\n if (hasClickablePagination()) {\n const paginationEl = Array.isArray(swiper.pagination.el) ? swiper.pagination.el : [swiper.pagination.el];\n paginationEl.forEach(el => {\n el.addEventListener('keydown', onEnterOrSpaceKey);\n });\n }\n\n // Tab focus\n swiper.el.addEventListener('focus', handleFocus, true);\n swiper.el.addEventListener('pointerdown', handlePointerDown, true);\n swiper.el.addEventListener('pointerup', handlePointerUp, true);\n };\n function destroy() {\n if (liveRegion) liveRegion.remove();\n let {\n nextEl,\n prevEl\n } = swiper.navigation ? swiper.navigation : {};\n nextEl = makeElementsArray(nextEl);\n prevEl = makeElementsArray(prevEl);\n if (nextEl) {\n nextEl.forEach(el => el.removeEventListener('keydown', onEnterOrSpaceKey));\n }\n if (prevEl) {\n prevEl.forEach(el => el.removeEventListener('keydown', onEnterOrSpaceKey));\n }\n\n // Pagination\n if (hasClickablePagination()) {\n const paginationEl = Array.isArray(swiper.pagination.el) ? swiper.pagination.el : [swiper.pagination.el];\n paginationEl.forEach(el => {\n el.removeEventListener('keydown', onEnterOrSpaceKey);\n });\n }\n\n // Tab focus\n swiper.el.removeEventListener('focus', handleFocus, true);\n swiper.el.removeEventListener('pointerdown', handlePointerDown, true);\n swiper.el.removeEventListener('pointerup', handlePointerUp, true);\n }\n on('beforeInit', () => {\n liveRegion = createElement('span', swiper.params.a11y.notificationClass);\n liveRegion.setAttribute('aria-live', 'assertive');\n liveRegion.setAttribute('aria-atomic', 'true');\n });\n on('afterInit', () => {\n if (!swiper.params.a11y.enabled) return;\n init();\n });\n on('slidesLengthChange snapGridLengthChange slidesGridLengthChange', () => {\n if (!swiper.params.a11y.enabled) return;\n initSlides();\n });\n on('fromEdge toEdge afterInit lock unlock', () => {\n if (!swiper.params.a11y.enabled) return;\n updateNavigation();\n });\n on('paginationUpdate', () => {\n if (!swiper.params.a11y.enabled) return;\n updatePagination();\n });\n on('destroy', () => {\n if (!swiper.params.a11y.enabled) return;\n destroy();\n });\n}\n\nexport { A11y as default };\n", "import { a as getWindow } from '../shared/ssr-window.esm.mjs';\n\nfunction History(_ref) {\n let {\n swiper,\n extendParams,\n on\n } = _ref;\n extendParams({\n history: {\n enabled: false,\n root: '',\n replaceState: false,\n key: 'slides',\n keepQuery: false\n }\n });\n let initialized = false;\n let paths = {};\n const slugify = text => {\n return text.toString().replace(/\\s+/g, '-').replace(/[^\\w-]+/g, '').replace(/--+/g, '-').replace(/^-+/, '').replace(/-+$/, '');\n };\n const getPathValues = urlOverride => {\n const window = getWindow();\n let location;\n if (urlOverride) {\n location = new URL(urlOverride);\n } else {\n location = window.location;\n }\n const pathArray = location.pathname.slice(1).split('/').filter(part => part !== '');\n const total = pathArray.length;\n const key = pathArray[total - 2];\n const value = pathArray[total - 1];\n return {\n key,\n value\n };\n };\n const setHistory = (key, index) => {\n const window = getWindow();\n if (!initialized || !swiper.params.history.enabled) return;\n let location;\n if (swiper.params.url) {\n location = new URL(swiper.params.url);\n } else {\n location = window.location;\n }\n const slide = swiper.slides[index];\n let value = slugify(slide.getAttribute('data-history'));\n if (swiper.params.history.root.length > 0) {\n let root = swiper.params.history.root;\n if (root[root.length - 1] === '/') root = root.slice(0, root.length - 1);\n value = `${root}/${key ? `${key}/` : ''}${value}`;\n } else if (!location.pathname.includes(key)) {\n value = `${key ? `${key}/` : ''}${value}`;\n }\n if (swiper.params.history.keepQuery) {\n value += location.search;\n }\n const currentState = window.history.state;\n if (currentState && currentState.value === value) {\n return;\n }\n if (swiper.params.history.replaceState) {\n window.history.replaceState({\n value\n }, null, value);\n } else {\n window.history.pushState({\n value\n }, null, value);\n }\n };\n const scrollToSlide = (speed, value, runCallbacks) => {\n if (value) {\n for (let i = 0, length = swiper.slides.length; i < length; i += 1) {\n const slide = swiper.slides[i];\n const slideHistory = slugify(slide.getAttribute('data-history'));\n if (slideHistory === value) {\n const index = swiper.getSlideIndex(slide);\n swiper.slideTo(index, speed, runCallbacks);\n }\n }\n } else {\n swiper.slideTo(0, speed, runCallbacks);\n }\n };\n const setHistoryPopState = () => {\n paths = getPathValues(swiper.params.url);\n scrollToSlide(swiper.params.speed, paths.value, false);\n };\n const init = () => {\n const window = getWindow();\n if (!swiper.params.history) return;\n if (!window.history || !window.history.pushState) {\n swiper.params.history.enabled = false;\n swiper.params.hashNavigation.enabled = true;\n return;\n }\n initialized = true;\n paths = getPathValues(swiper.params.url);\n if (!paths.key && !paths.value) {\n if (!swiper.params.history.replaceState) {\n window.addEventListener('popstate', setHistoryPopState);\n }\n return;\n }\n scrollToSlide(0, paths.value, swiper.params.runCallbacksOnInit);\n if (!swiper.params.history.replaceState) {\n window.addEventListener('popstate', setHistoryPopState);\n }\n };\n const destroy = () => {\n const window = getWindow();\n if (!swiper.params.history.replaceState) {\n window.removeEventListener('popstate', setHistoryPopState);\n }\n };\n on('init', () => {\n if (swiper.params.history.enabled) {\n init();\n }\n });\n on('destroy', () => {\n if (swiper.params.history.enabled) {\n destroy();\n }\n });\n on('transitionEnd _freeModeNoMomentumRelease', () => {\n if (initialized) {\n setHistory(swiper.params.history.key, swiper.activeIndex);\n }\n });\n on('slideChange', () => {\n if (initialized && swiper.params.cssMode) {\n setHistory(swiper.params.history.key, swiper.activeIndex);\n }\n });\n}\n\nexport { History as default };\n", "import { g as getDocument, a as getWindow } from '../shared/ssr-window.esm.mjs';\nimport { e as elementChildren } from '../shared/utils.mjs';\n\nfunction HashNavigation(_ref) {\n let {\n swiper,\n extendParams,\n emit,\n on\n } = _ref;\n let initialized = false;\n const document = getDocument();\n const window = getWindow();\n extendParams({\n hashNavigation: {\n enabled: false,\n replaceState: false,\n watchState: false,\n getSlideIndex(_s, hash) {\n if (swiper.virtual && swiper.params.virtual.enabled) {\n const slideWithHash = swiper.slides.filter(slideEl => slideEl.getAttribute('data-hash') === hash)[0];\n if (!slideWithHash) return 0;\n const index = parseInt(slideWithHash.getAttribute('data-swiper-slide-index'), 10);\n return index;\n }\n return swiper.getSlideIndex(elementChildren(swiper.slidesEl, `.${swiper.params.slideClass}[data-hash=\"${hash}\"], swiper-slide[data-hash=\"${hash}\"]`)[0]);\n }\n }\n });\n const onHashChange = () => {\n emit('hashChange');\n const newHash = document.location.hash.replace('#', '');\n const activeSlideEl = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector(`[data-swiper-slide-index=\"${swiper.activeIndex}\"]`) : swiper.slides[swiper.activeIndex];\n const activeSlideHash = activeSlideEl ? activeSlideEl.getAttribute('data-hash') : '';\n if (newHash !== activeSlideHash) {\n const newIndex = swiper.params.hashNavigation.getSlideIndex(swiper, newHash);\n if (typeof newIndex === 'undefined' || Number.isNaN(newIndex)) return;\n swiper.slideTo(newIndex);\n }\n };\n const setHash = () => {\n if (!initialized || !swiper.params.hashNavigation.enabled) return;\n const activeSlideEl = swiper.virtual && swiper.params.virtual.enabled ? swiper.slidesEl.querySelector(`[data-swiper-slide-index=\"${swiper.activeIndex}\"]`) : swiper.slides[swiper.activeIndex];\n const activeSlideHash = activeSlideEl ? activeSlideEl.getAttribute('data-hash') || activeSlideEl.getAttribute('data-history') : '';\n if (swiper.params.hashNavigation.replaceState && window.history && window.history.replaceState) {\n window.history.replaceState(null, null, `#${activeSlideHash}` || '');\n emit('hashSet');\n } else {\n document.location.hash = activeSlideHash || '';\n emit('hashSet');\n }\n };\n const init = () => {\n if (!swiper.params.hashNavigation.enabled || swiper.params.history && swiper.params.history.enabled) return;\n initialized = true;\n const hash = document.location.hash.replace('#', '');\n if (hash) {\n const speed = 0;\n const index = swiper.params.hashNavigation.getSlideIndex(swiper, hash);\n swiper.slideTo(index || 0, speed, swiper.params.runCallbacksOnInit, true);\n }\n if (swiper.params.hashNavigation.watchState) {\n window.addEventListener('hashchange', onHashChange);\n }\n };\n const destroy = () => {\n if (swiper.params.hashNavigation.watchState) {\n window.removeEventListener('hashchange', onHashChange);\n }\n };\n on('init', () => {\n if (swiper.params.hashNavigation.enabled) {\n init();\n }\n });\n on('destroy', () => {\n if (swiper.params.hashNavigation.enabled) {\n destroy();\n }\n });\n on('transitionEnd _freeModeNoMomentumRelease', () => {\n if (initialized) {\n setHash();\n }\n });\n on('slideChange', () => {\n if (initialized && swiper.params.cssMode) {\n setHash();\n }\n });\n}\n\nexport { HashNavigation as default };\n", "import { g as getDocument } from '../shared/ssr-window.esm.mjs';\n\n/* eslint no-underscore-dangle: \"off\" */\n/* eslint no-use-before-define: \"off\" */\nfunction Autoplay(_ref) {\n let {\n swiper,\n extendParams,\n on,\n emit,\n params\n } = _ref;\n swiper.autoplay = {\n running: false,\n paused: false,\n timeLeft: 0\n };\n extendParams({\n autoplay: {\n enabled: false,\n delay: 3000,\n waitForTransition: true,\n disableOnInteraction: true,\n stopOnLastSlide: false,\n reverseDirection: false,\n pauseOnMouseEnter: false\n }\n });\n let timeout;\n let raf;\n let autoplayDelayTotal = params && params.autoplay ? params.autoplay.delay : 3000;\n let autoplayDelayCurrent = params && params.autoplay ? params.autoplay.delay : 3000;\n let autoplayTimeLeft;\n let autoplayStartTime = new Date().getTime;\n let wasPaused;\n let isTouched;\n let pausedByTouch;\n let touchStartTimeout;\n let slideChanged;\n let pausedByInteraction;\n function onTransitionEnd(e) {\n if (!swiper || swiper.destroyed || !swiper.wrapperEl) return;\n if (e.target !== swiper.wrapperEl) return;\n swiper.wrapperEl.removeEventListener('transitionend', onTransitionEnd);\n resume();\n }\n const calcTimeLeft = () => {\n if (swiper.destroyed || !swiper.autoplay.running) return;\n if (swiper.autoplay.paused) {\n wasPaused = true;\n } else if (wasPaused) {\n autoplayDelayCurrent = autoplayTimeLeft;\n wasPaused = false;\n }\n const timeLeft = swiper.autoplay.paused ? autoplayTimeLeft : autoplayStartTime + autoplayDelayCurrent - new Date().getTime();\n swiper.autoplay.timeLeft = timeLeft;\n emit('autoplayTimeLeft', timeLeft, timeLeft / autoplayDelayTotal);\n raf = requestAnimationFrame(() => {\n calcTimeLeft();\n });\n };\n const getSlideDelay = () => {\n let activeSlideEl;\n if (swiper.virtual && swiper.params.virtual.enabled) {\n activeSlideEl = swiper.slides.filter(slideEl => slideEl.classList.contains('swiper-slide-active'))[0];\n } else {\n activeSlideEl = swiper.slides[swiper.activeIndex];\n }\n if (!activeSlideEl) return undefined;\n const currentSlideDelay = parseInt(activeSlideEl.getAttribute('data-swiper-autoplay'), 10);\n return currentSlideDelay;\n };\n const run = delayForce => {\n if (swiper.destroyed || !swiper.autoplay.running) return;\n cancelAnimationFrame(raf);\n calcTimeLeft();\n let delay = typeof delayForce === 'undefined' ? swiper.params.autoplay.delay : delayForce;\n autoplayDelayTotal = swiper.params.autoplay.delay;\n autoplayDelayCurrent = swiper.params.autoplay.delay;\n const currentSlideDelay = getSlideDelay();\n if (!Number.isNaN(currentSlideDelay) && currentSlideDelay > 0 && typeof delayForce === 'undefined') {\n delay = currentSlideDelay;\n autoplayDelayTotal = currentSlideDelay;\n autoplayDelayCurrent = currentSlideDelay;\n }\n autoplayTimeLeft = delay;\n const speed = swiper.params.speed;\n const proceed = () => {\n if (!swiper || swiper.destroyed) return;\n if (swiper.params.autoplay.reverseDirection) {\n if (!swiper.isBeginning || swiper.params.loop || swiper.params.rewind) {\n swiper.slidePrev(speed, true, true);\n emit('autoplay');\n } else if (!swiper.params.autoplay.stopOnLastSlide) {\n swiper.slideTo(swiper.slides.length - 1, speed, true, true);\n emit('autoplay');\n }\n } else {\n if (!swiper.isEnd || swiper.params.loop || swiper.params.rewind) {\n swiper.slideNext(speed, true, true);\n emit('autoplay');\n } else if (!swiper.params.autoplay.stopOnLastSlide) {\n swiper.slideTo(0, speed, true, true);\n emit('autoplay');\n }\n }\n if (swiper.params.cssMode) {\n autoplayStartTime = new Date().getTime();\n requestAnimationFrame(() => {\n run();\n });\n }\n };\n if (delay > 0) {\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n proceed();\n }, delay);\n } else {\n requestAnimationFrame(() => {\n proceed();\n });\n }\n\n // eslint-disable-next-line\n return delay;\n };\n const start = () => {\n swiper.autoplay.running = true;\n run();\n emit('autoplayStart');\n };\n const stop = () => {\n swiper.autoplay.running = false;\n clearTimeout(timeout);\n cancelAnimationFrame(raf);\n emit('autoplayStop');\n };\n const pause = (internal, reset) => {\n if (swiper.destroyed || !swiper.autoplay.running) return;\n clearTimeout(timeout);\n if (!internal) {\n pausedByInteraction = true;\n }\n const proceed = () => {\n emit('autoplayPause');\n if (swiper.params.autoplay.waitForTransition) {\n swiper.wrapperEl.addEventListener('transitionend', onTransitionEnd);\n } else {\n resume();\n }\n };\n swiper.autoplay.paused = true;\n if (reset) {\n if (slideChanged) {\n autoplayTimeLeft = swiper.params.autoplay.delay;\n }\n slideChanged = false;\n proceed();\n return;\n }\n const delay = autoplayTimeLeft || swiper.params.autoplay.delay;\n autoplayTimeLeft = delay - (new Date().getTime() - autoplayStartTime);\n if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop) return;\n if (autoplayTimeLeft < 0) autoplayTimeLeft = 0;\n proceed();\n };\n const resume = () => {\n if (swiper.isEnd && autoplayTimeLeft < 0 && !swiper.params.loop || swiper.destroyed || !swiper.autoplay.running) return;\n autoplayStartTime = new Date().getTime();\n if (pausedByInteraction) {\n pausedByInteraction = false;\n run(autoplayTimeLeft);\n } else {\n run();\n }\n swiper.autoplay.paused = false;\n emit('autoplayResume');\n };\n const onVisibilityChange = () => {\n if (swiper.destroyed || !swiper.autoplay.running) return;\n const document = getDocument();\n if (document.visibilityState === 'hidden') {\n pausedByInteraction = true;\n pause(true);\n }\n if (document.visibilityState === 'visible') {\n resume();\n }\n };\n const onPointerEnter = e => {\n if (e.pointerType !== 'mouse') return;\n pausedByInteraction = true;\n if (swiper.animating || swiper.autoplay.paused) return;\n pause(true);\n };\n const onPointerLeave = e => {\n if (e.pointerType !== 'mouse') return;\n if (swiper.autoplay.paused) {\n resume();\n }\n };\n const attachMouseEvents = () => {\n if (swiper.params.autoplay.pauseOnMouseEnter) {\n swiper.el.addEventListener('pointerenter', onPointerEnter);\n swiper.el.addEventListener('pointerleave', onPointerLeave);\n }\n };\n const detachMouseEvents = () => {\n swiper.el.removeEventListener('pointerenter', onPointerEnter);\n swiper.el.removeEventListener('pointerleave', onPointerLeave);\n };\n const attachDocumentEvents = () => {\n const document = getDocument();\n document.addEventListener('visibilitychange', onVisibilityChange);\n };\n const detachDocumentEvents = () => {\n const document = getDocument();\n document.removeEventListener('visibilitychange', onVisibilityChange);\n };\n on('init', () => {\n if (swiper.params.autoplay.enabled) {\n attachMouseEvents();\n attachDocumentEvents();\n autoplayStartTime = new Date().getTime();\n start();\n }\n });\n on('destroy', () => {\n detachMouseEvents();\n detachDocumentEvents();\n if (swiper.autoplay.running) {\n stop();\n }\n });\n on('beforeTransitionStart', (_s, speed, internal) => {\n if (swiper.destroyed || !swiper.autoplay.running) return;\n if (internal || !swiper.params.autoplay.disableOnInteraction) {\n pause(true, true);\n } else {\n stop();\n }\n });\n on('sliderFirstMove', () => {\n if (swiper.destroyed || !swiper.autoplay.running) return;\n if (swiper.params.autoplay.disableOnInteraction) {\n stop();\n return;\n }\n isTouched = true;\n pausedByTouch = false;\n pausedByInteraction = false;\n touchStartTimeout = setTimeout(() => {\n pausedByInteraction = true;\n pausedByTouch = true;\n pause(true);\n }, 200);\n });\n on('touchEnd', () => {\n if (swiper.destroyed || !swiper.autoplay.running || !isTouched) return;\n clearTimeout(touchStartTimeout);\n clearTimeout(timeout);\n if (swiper.params.autoplay.disableOnInteraction) {\n pausedByTouch = false;\n isTouched = false;\n return;\n }\n if (pausedByTouch && swiper.params.cssMode) resume();\n pausedByTouch = false;\n isTouched = false;\n });\n on('slideChange', () => {\n if (swiper.destroyed || !swiper.autoplay.running) return;\n slideChanged = true;\n });\n Object.assign(swiper.autoplay, {\n start,\n stop,\n pause,\n resume\n });\n}\n\nexport { Autoplay as default };\n", "import { g as getDocument } from '../shared/ssr-window.esm.mjs';\nimport { j as isObject, e as elementChildren } from '../shared/utils.mjs';\n\nfunction Thumb(_ref) {\n let {\n swiper,\n extendParams,\n on\n } = _ref;\n extendParams({\n thumbs: {\n swiper: null,\n multipleActiveThumbs: true,\n autoScrollOffset: 0,\n slideThumbActiveClass: 'swiper-slide-thumb-active',\n thumbsContainerClass: 'swiper-thumbs'\n }\n });\n let initialized = false;\n let swiperCreated = false;\n swiper.thumbs = {\n swiper: null\n };\n function onThumbClick() {\n const thumbsSwiper = swiper.thumbs.swiper;\n if (!thumbsSwiper || thumbsSwiper.destroyed) return;\n const clickedIndex = thumbsSwiper.clickedIndex;\n const clickedSlide = thumbsSwiper.clickedSlide;\n if (clickedSlide && clickedSlide.classList.contains(swiper.params.thumbs.slideThumbActiveClass)) return;\n if (typeof clickedIndex === 'undefined' || clickedIndex === null) return;\n let slideToIndex;\n if (thumbsSwiper.params.loop) {\n slideToIndex = parseInt(thumbsSwiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10);\n } else {\n slideToIndex = clickedIndex;\n }\n if (swiper.params.loop) {\n swiper.slideToLoop(slideToIndex);\n } else {\n swiper.slideTo(slideToIndex);\n }\n }\n function init() {\n const {\n thumbs: thumbsParams\n } = swiper.params;\n if (initialized) return false;\n initialized = true;\n const SwiperClass = swiper.constructor;\n if (thumbsParams.swiper instanceof SwiperClass) {\n swiper.thumbs.swiper = thumbsParams.swiper;\n Object.assign(swiper.thumbs.swiper.originalParams, {\n watchSlidesProgress: true,\n slideToClickedSlide: false\n });\n Object.assign(swiper.thumbs.swiper.params, {\n watchSlidesProgress: true,\n slideToClickedSlide: false\n });\n swiper.thumbs.swiper.update();\n } else if (isObject(thumbsParams.swiper)) {\n const thumbsSwiperParams = Object.assign({}, thumbsParams.swiper);\n Object.assign(thumbsSwiperParams, {\n watchSlidesProgress: true,\n slideToClickedSlide: false\n });\n swiper.thumbs.swiper = new SwiperClass(thumbsSwiperParams);\n swiperCreated = true;\n }\n swiper.thumbs.swiper.el.classList.add(swiper.params.thumbs.thumbsContainerClass);\n swiper.thumbs.swiper.on('tap', onThumbClick);\n return true;\n }\n function update(initial) {\n const thumbsSwiper = swiper.thumbs.swiper;\n if (!thumbsSwiper || thumbsSwiper.destroyed) return;\n const slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView;\n\n // Activate thumbs\n let thumbsToActivate = 1;\n const thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass;\n if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) {\n thumbsToActivate = swiper.params.slidesPerView;\n }\n if (!swiper.params.thumbs.multipleActiveThumbs) {\n thumbsToActivate = 1;\n }\n thumbsToActivate = Math.floor(thumbsToActivate);\n thumbsSwiper.slides.forEach(slideEl => slideEl.classList.remove(thumbActiveClass));\n if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) {\n for (let i = 0; i < thumbsToActivate; i += 1) {\n elementChildren(thumbsSwiper.slidesEl, `[data-swiper-slide-index=\"${swiper.realIndex + i}\"]`).forEach(slideEl => {\n slideEl.classList.add(thumbActiveClass);\n });\n }\n } else {\n for (let i = 0; i < thumbsToActivate; i += 1) {\n if (thumbsSwiper.slides[swiper.realIndex + i]) {\n thumbsSwiper.slides[swiper.realIndex + i].classList.add(thumbActiveClass);\n }\n }\n }\n const autoScrollOffset = swiper.params.thumbs.autoScrollOffset;\n const useOffset = autoScrollOffset && !thumbsSwiper.params.loop;\n if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) {\n const currentThumbsIndex = thumbsSwiper.activeIndex;\n let newThumbsIndex;\n let direction;\n if (thumbsSwiper.params.loop) {\n const newThumbsSlide = thumbsSwiper.slides.filter(slideEl => slideEl.getAttribute('data-swiper-slide-index') === `${swiper.realIndex}`)[0];\n newThumbsIndex = thumbsSwiper.slides.indexOf(newThumbsSlide);\n direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev';\n } else {\n newThumbsIndex = swiper.realIndex;\n direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev';\n }\n if (useOffset) {\n newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset;\n }\n if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) {\n if (thumbsSwiper.params.centeredSlides) {\n if (newThumbsIndex > currentThumbsIndex) {\n newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1;\n } else {\n newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1;\n }\n } else if (newThumbsIndex > currentThumbsIndex && thumbsSwiper.params.slidesPerGroup === 1) ;\n thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined);\n }\n }\n }\n on('beforeInit', () => {\n const {\n thumbs\n } = swiper.params;\n if (!thumbs || !thumbs.swiper) return;\n if (typeof thumbs.swiper === 'string' || thumbs.swiper instanceof HTMLElement) {\n const document = getDocument();\n const getThumbsElementAndInit = () => {\n const thumbsElement = typeof thumbs.swiper === 'string' ? document.querySelector(thumbs.swiper) : thumbs.swiper;\n if (thumbsElement && thumbsElement.swiper) {\n thumbs.swiper = thumbsElement.swiper;\n init();\n update(true);\n } else if (thumbsElement) {\n const onThumbsSwiper = e => {\n thumbs.swiper = e.detail[0];\n thumbsElement.removeEventListener('init', onThumbsSwiper);\n init();\n update(true);\n thumbs.swiper.update();\n swiper.update();\n };\n thumbsElement.addEventListener('init', onThumbsSwiper);\n }\n return thumbsElement;\n };\n const watchForThumbsToAppear = () => {\n if (swiper.destroyed) return;\n const thumbsElement = getThumbsElementAndInit();\n if (!thumbsElement) {\n requestAnimationFrame(watchForThumbsToAppear);\n }\n };\n requestAnimationFrame(watchForThumbsToAppear);\n } else {\n init();\n update(true);\n }\n });\n on('slideChange update resize observerUpdate', () => {\n update();\n });\n on('setTransition', (_s, duration) => {\n const thumbsSwiper = swiper.thumbs.swiper;\n if (!thumbsSwiper || thumbsSwiper.destroyed) return;\n thumbsSwiper.setTransition(duration);\n });\n on('beforeDestroy', () => {\n const thumbsSwiper = swiper.thumbs.swiper;\n if (!thumbsSwiper || thumbsSwiper.destroyed) return;\n if (swiperCreated) {\n thumbsSwiper.destroy();\n }\n });\n Object.assign(swiper.thumbs, {\n init,\n update\n });\n}\n\nexport { Thumb as default };\n", "import { d as now, i as elementTransitionEnd } from '../shared/utils.mjs';\n\nfunction freeMode(_ref) {\n let {\n swiper,\n extendParams,\n emit,\n once\n } = _ref;\n extendParams({\n freeMode: {\n enabled: false,\n momentum: true,\n momentumRatio: 1,\n momentumBounce: true,\n momentumBounceRatio: 1,\n momentumVelocityRatio: 1,\n sticky: false,\n minimumVelocity: 0.02\n }\n });\n function onTouchStart() {\n if (swiper.params.cssMode) return;\n const translate = swiper.getTranslate();\n swiper.setTranslate(translate);\n swiper.setTransition(0);\n swiper.touchEventsData.velocities.length = 0;\n swiper.freeMode.onTouchEnd({\n currentPos: swiper.rtl ? swiper.translate : -swiper.translate\n });\n }\n function onTouchMove() {\n if (swiper.params.cssMode) return;\n const {\n touchEventsData: data,\n touches\n } = swiper;\n // Velocity\n if (data.velocities.length === 0) {\n data.velocities.push({\n position: touches[swiper.isHorizontal() ? 'startX' : 'startY'],\n time: data.touchStartTime\n });\n }\n data.velocities.push({\n position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'],\n time: now()\n });\n }\n function onTouchEnd(_ref2) {\n let {\n currentPos\n } = _ref2;\n if (swiper.params.cssMode) return;\n const {\n params,\n wrapperEl,\n rtlTranslate: rtl,\n snapGrid,\n touchEventsData: data\n } = swiper;\n // Time diff\n const touchEndTime = now();\n const timeDiff = touchEndTime - data.touchStartTime;\n if (currentPos < -swiper.minTranslate()) {\n swiper.slideTo(swiper.activeIndex);\n return;\n }\n if (currentPos > -swiper.maxTranslate()) {\n if (swiper.slides.length < snapGrid.length) {\n swiper.slideTo(snapGrid.length - 1);\n } else {\n swiper.slideTo(swiper.slides.length - 1);\n }\n return;\n }\n if (params.freeMode.momentum) {\n if (data.velocities.length > 1) {\n const lastMoveEvent = data.velocities.pop();\n const velocityEvent = data.velocities.pop();\n const distance = lastMoveEvent.position - velocityEvent.position;\n const time = lastMoveEvent.time - velocityEvent.time;\n swiper.velocity = distance / time;\n swiper.velocity /= 2;\n if (Math.abs(swiper.velocity) < params.freeMode.minimumVelocity) {\n swiper.velocity = 0;\n }\n // this implies that the user stopped moving a finger then released.\n // There would be no events with distance zero, so the last event is stale.\n if (time > 150 || now() - lastMoveEvent.time > 300) {\n swiper.velocity = 0;\n }\n } else {\n swiper.velocity = 0;\n }\n swiper.velocity *= params.freeMode.momentumVelocityRatio;\n data.velocities.length = 0;\n let momentumDuration = 1000 * params.freeMode.momentumRatio;\n const momentumDistance = swiper.velocity * momentumDuration;\n let newPosition = swiper.translate + momentumDistance;\n if (rtl) newPosition = -newPosition;\n let doBounce = false;\n let afterBouncePosition;\n const bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeMode.momentumBounceRatio;\n let needsLoopFix;\n if (newPosition < swiper.maxTranslate()) {\n if (params.freeMode.momentumBounce) {\n if (newPosition + swiper.maxTranslate() < -bounceAmount) {\n newPosition = swiper.maxTranslate() - bounceAmount;\n }\n afterBouncePosition = swiper.maxTranslate();\n doBounce = true;\n data.allowMomentumBounce = true;\n } else {\n newPosition = swiper.maxTranslate();\n }\n if (params.loop && params.centeredSlides) needsLoopFix = true;\n } else if (newPosition > swiper.minTranslate()) {\n if (params.freeMode.momentumBounce) {\n if (newPosition - swiper.minTranslate() > bounceAmount) {\n newPosition = swiper.minTranslate() + bounceAmount;\n }\n afterBouncePosition = swiper.minTranslate();\n doBounce = true;\n data.allowMomentumBounce = true;\n } else {\n newPosition = swiper.minTranslate();\n }\n if (params.loop && params.centeredSlides) needsLoopFix = true;\n } else if (params.freeMode.sticky) {\n let nextSlide;\n for (let j = 0; j < snapGrid.length; j += 1) {\n if (snapGrid[j] > -newPosition) {\n nextSlide = j;\n break;\n }\n }\n if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') {\n newPosition = snapGrid[nextSlide];\n } else {\n newPosition = snapGrid[nextSlide - 1];\n }\n newPosition = -newPosition;\n }\n if (needsLoopFix) {\n once('transitionEnd', () => {\n swiper.loopFix();\n });\n }\n // Fix duration\n if (swiper.velocity !== 0) {\n if (rtl) {\n momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity);\n } else {\n momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity);\n }\n if (params.freeMode.sticky) {\n // If freeMode.sticky is active and the user ends a swipe with a slow-velocity\n // event, then durations can be 20+ seconds to slide one (or zero!) slides.\n // It's easy to see this when simulating touch with mouse events. To fix this,\n // limit single-slide swipes to the default slide duration. This also has the\n // nice side effect of matching slide speed if the user stopped moving before\n // lifting finger or mouse vs. moving slowly before lifting the finger/mouse.\n // For faster swipes, also apply limits (albeit higher ones).\n const moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate);\n const currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex];\n if (moveDistance < currentSlideSize) {\n momentumDuration = params.speed;\n } else if (moveDistance < 2 * currentSlideSize) {\n momentumDuration = params.speed * 1.5;\n } else {\n momentumDuration = params.speed * 2.5;\n }\n }\n } else if (params.freeMode.sticky) {\n swiper.slideToClosest();\n return;\n }\n if (params.freeMode.momentumBounce && doBounce) {\n swiper.updateProgress(afterBouncePosition);\n swiper.setTransition(momentumDuration);\n swiper.setTranslate(newPosition);\n swiper.transitionStart(true, swiper.swipeDirection);\n swiper.animating = true;\n elementTransitionEnd(wrapperEl, () => {\n if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return;\n emit('momentumBounce');\n swiper.setTransition(params.speed);\n setTimeout(() => {\n swiper.setTranslate(afterBouncePosition);\n elementTransitionEnd(wrapperEl, () => {\n if (!swiper || swiper.destroyed) return;\n swiper.transitionEnd();\n });\n }, 0);\n });\n } else if (swiper.velocity) {\n emit('_freeModeNoMomentumRelease');\n swiper.updateProgress(newPosition);\n swiper.setTransition(momentumDuration);\n swiper.setTranslate(newPosition);\n swiper.transitionStart(true, swiper.swipeDirection);\n if (!swiper.animating) {\n swiper.animating = true;\n elementTransitionEnd(wrapperEl, () => {\n if (!swiper || swiper.destroyed) return;\n swiper.transitionEnd();\n });\n }\n } else {\n swiper.updateProgress(newPosition);\n }\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n } else if (params.freeMode.sticky) {\n swiper.slideToClosest();\n return;\n } else if (params.freeMode) {\n emit('_freeModeNoMomentumRelease');\n }\n if (!params.freeMode.momentum || timeDiff >= params.longSwipesMs) {\n swiper.updateProgress();\n swiper.updateActiveIndex();\n swiper.updateSlidesClasses();\n }\n }\n Object.assign(swiper, {\n freeMode: {\n onTouchStart,\n onTouchMove,\n onTouchEnd\n }\n });\n}\n\nexport { freeMode as default };\n", "function Grid(_ref) {\n let {\n swiper,\n extendParams,\n on\n } = _ref;\n extendParams({\n grid: {\n rows: 1,\n fill: 'column'\n }\n });\n let slidesNumberEvenToRows;\n let slidesPerRow;\n let numFullColumns;\n let wasMultiRow;\n const getSpaceBetween = () => {\n let spaceBetween = swiper.params.spaceBetween;\n if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {\n spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiper.size;\n } else if (typeof spaceBetween === 'string') {\n spaceBetween = parseFloat(spaceBetween);\n }\n return spaceBetween;\n };\n const initSlides = slidesLength => {\n const {\n slidesPerView\n } = swiper.params;\n const {\n rows,\n fill\n } = swiper.params.grid;\n numFullColumns = Math.floor(slidesLength / rows);\n if (Math.floor(slidesLength / rows) === slidesLength / rows) {\n slidesNumberEvenToRows = slidesLength;\n } else {\n slidesNumberEvenToRows = Math.ceil(slidesLength / rows) * rows;\n }\n if (slidesPerView !== 'auto' && fill === 'row') {\n slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, slidesPerView * rows);\n }\n slidesPerRow = slidesNumberEvenToRows / rows;\n };\n const updateSlide = (i, slide, slidesLength, getDirectionLabel) => {\n const {\n slidesPerGroup\n } = swiper.params;\n const spaceBetween = getSpaceBetween();\n const {\n rows,\n fill\n } = swiper.params.grid;\n // Set slides order\n let newSlideOrderIndex;\n let column;\n let row;\n if (fill === 'row' && slidesPerGroup > 1) {\n const groupIndex = Math.floor(i / (slidesPerGroup * rows));\n const slideIndexInGroup = i - rows * slidesPerGroup * groupIndex;\n const columnsInGroup = groupIndex === 0 ? slidesPerGroup : Math.min(Math.ceil((slidesLength - groupIndex * rows * slidesPerGroup) / rows), slidesPerGroup);\n row = Math.floor(slideIndexInGroup / columnsInGroup);\n column = slideIndexInGroup - row * columnsInGroup + groupIndex * slidesPerGroup;\n newSlideOrderIndex = column + row * slidesNumberEvenToRows / rows;\n slide.style.order = newSlideOrderIndex;\n } else if (fill === 'column') {\n column = Math.floor(i / rows);\n row = i - column * rows;\n if (column > numFullColumns || column === numFullColumns && row === rows - 1) {\n row += 1;\n if (row >= rows) {\n row = 0;\n column += 1;\n }\n }\n } else {\n row = Math.floor(i / slidesPerRow);\n column = i - row * slidesPerRow;\n }\n slide.row = row;\n slide.column = column;\n slide.style[getDirectionLabel('margin-top')] = row !== 0 ? spaceBetween && `${spaceBetween}px` : '';\n };\n const updateWrapperSize = (slideSize, snapGrid, getDirectionLabel) => {\n const {\n centeredSlides,\n roundLengths\n } = swiper.params;\n const spaceBetween = getSpaceBetween();\n const {\n rows\n } = swiper.params.grid;\n swiper.virtualSize = (slideSize + spaceBetween) * slidesNumberEvenToRows;\n swiper.virtualSize = Math.ceil(swiper.virtualSize / rows) - spaceBetween;\n swiper.wrapperEl.style[getDirectionLabel('width')] = `${swiper.virtualSize + spaceBetween}px`;\n if (centeredSlides) {\n const newSlidesGrid = [];\n for (let i = 0; i < snapGrid.length; i += 1) {\n let slidesGridItem = snapGrid[i];\n if (roundLengths) slidesGridItem = Math.floor(slidesGridItem);\n if (snapGrid[i] < swiper.virtualSize + snapGrid[0]) newSlidesGrid.push(slidesGridItem);\n }\n snapGrid.splice(0, snapGrid.length);\n snapGrid.push(...newSlidesGrid);\n }\n };\n const onInit = () => {\n wasMultiRow = swiper.params.grid && swiper.params.grid.rows > 1;\n };\n const onUpdate = () => {\n const {\n params,\n el\n } = swiper;\n const isMultiRow = params.grid && params.grid.rows > 1;\n if (wasMultiRow && !isMultiRow) {\n el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`);\n numFullColumns = 1;\n swiper.emitContainerClasses();\n } else if (!wasMultiRow && isMultiRow) {\n el.classList.add(`${params.containerModifierClass}grid`);\n if (params.grid.fill === 'column') {\n el.classList.add(`${params.containerModifierClass}grid-column`);\n }\n swiper.emitContainerClasses();\n }\n wasMultiRow = isMultiRow;\n };\n on('init', onInit);\n on('update', onUpdate);\n swiper.grid = {\n initSlides,\n updateSlide,\n updateWrapperSize\n };\n}\n\nexport { Grid as default };\n", "function appendSlide(slides) {\n const swiper = this;\n const {\n params,\n slidesEl\n } = swiper;\n if (params.loop) {\n swiper.loopDestroy();\n }\n const appendElement = slideEl => {\n if (typeof slideEl === 'string') {\n const tempDOM = document.createElement('div');\n tempDOM.innerHTML = slideEl;\n slidesEl.append(tempDOM.children[0]);\n tempDOM.innerHTML = '';\n } else {\n slidesEl.append(slideEl);\n }\n };\n if (typeof slides === 'object' && 'length' in slides) {\n for (let i = 0; i < slides.length; i += 1) {\n if (slides[i]) appendElement(slides[i]);\n }\n } else {\n appendElement(slides);\n }\n swiper.recalcSlides();\n if (params.loop) {\n swiper.loopCreate();\n }\n if (!params.observer || swiper.isElement) {\n swiper.update();\n }\n}\n\nfunction prependSlide(slides) {\n const swiper = this;\n const {\n params,\n activeIndex,\n slidesEl\n } = swiper;\n if (params.loop) {\n swiper.loopDestroy();\n }\n let newActiveIndex = activeIndex + 1;\n const prependElement = slideEl => {\n if (typeof slideEl === 'string') {\n const tempDOM = document.createElement('div');\n tempDOM.innerHTML = slideEl;\n slidesEl.prepend(tempDOM.children[0]);\n tempDOM.innerHTML = '';\n } else {\n slidesEl.prepend(slideEl);\n }\n };\n if (typeof slides === 'object' && 'length' in slides) {\n for (let i = 0; i < slides.length; i += 1) {\n if (slides[i]) prependElement(slides[i]);\n }\n newActiveIndex = activeIndex + slides.length;\n } else {\n prependElement(slides);\n }\n swiper.recalcSlides();\n if (params.loop) {\n swiper.loopCreate();\n }\n if (!params.observer || swiper.isElement) {\n swiper.update();\n }\n swiper.slideTo(newActiveIndex, 0, false);\n}\n\nfunction addSlide(index, slides) {\n const swiper = this;\n const {\n params,\n activeIndex,\n slidesEl\n } = swiper;\n let activeIndexBuffer = activeIndex;\n if (params.loop) {\n activeIndexBuffer -= swiper.loopedSlides;\n swiper.loopDestroy();\n swiper.recalcSlides();\n }\n const baseLength = swiper.slides.length;\n if (index <= 0) {\n swiper.prependSlide(slides);\n return;\n }\n if (index >= baseLength) {\n swiper.appendSlide(slides);\n return;\n }\n let newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + 1 : activeIndexBuffer;\n const slidesBuffer = [];\n for (let i = baseLength - 1; i >= index; i -= 1) {\n const currentSlide = swiper.slides[i];\n currentSlide.remove();\n slidesBuffer.unshift(currentSlide);\n }\n if (typeof slides === 'object' && 'length' in slides) {\n for (let i = 0; i < slides.length; i += 1) {\n if (slides[i]) slidesEl.append(slides[i]);\n }\n newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + slides.length : activeIndexBuffer;\n } else {\n slidesEl.append(slides);\n }\n for (let i = 0; i < slidesBuffer.length; i += 1) {\n slidesEl.append(slidesBuffer[i]);\n }\n swiper.recalcSlides();\n if (params.loop) {\n swiper.loopCreate();\n }\n if (!params.observer || swiper.isElement) {\n swiper.update();\n }\n if (params.loop) {\n swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false);\n } else {\n swiper.slideTo(newActiveIndex, 0, false);\n }\n}\n\nfunction removeSlide(slidesIndexes) {\n const swiper = this;\n const {\n params,\n activeIndex\n } = swiper;\n let activeIndexBuffer = activeIndex;\n if (params.loop) {\n activeIndexBuffer -= swiper.loopedSlides;\n swiper.loopDestroy();\n }\n let newActiveIndex = activeIndexBuffer;\n let indexToRemove;\n if (typeof slidesIndexes === 'object' && 'length' in slidesIndexes) {\n for (let i = 0; i < slidesIndexes.length; i += 1) {\n indexToRemove = slidesIndexes[i];\n if (swiper.slides[indexToRemove]) swiper.slides[indexToRemove].remove();\n if (indexToRemove < newActiveIndex) newActiveIndex -= 1;\n }\n newActiveIndex = Math.max(newActiveIndex, 0);\n } else {\n indexToRemove = slidesIndexes;\n if (swiper.slides[indexToRemove]) swiper.slides[indexToRemove].remove();\n if (indexToRemove < newActiveIndex) newActiveIndex -= 1;\n newActiveIndex = Math.max(newActiveIndex, 0);\n }\n swiper.recalcSlides();\n if (params.loop) {\n swiper.loopCreate();\n }\n if (!params.observer || swiper.isElement) {\n swiper.update();\n }\n if (params.loop) {\n swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false);\n } else {\n swiper.slideTo(newActiveIndex, 0, false);\n }\n}\n\nfunction removeAllSlides() {\n const swiper = this;\n const slidesIndexes = [];\n for (let i = 0; i < swiper.slides.length; i += 1) {\n slidesIndexes.push(i);\n }\n swiper.removeSlide(slidesIndexes);\n}\n\nfunction Manipulation(_ref) {\n let {\n swiper\n } = _ref;\n Object.assign(swiper, {\n appendSlide: appendSlide.bind(swiper),\n prependSlide: prependSlide.bind(swiper),\n addSlide: addSlide.bind(swiper),\n removeSlide: removeSlide.bind(swiper),\n removeAllSlides: removeAllSlides.bind(swiper)\n });\n}\n\nexport { Manipulation as default };\n", "function effectInit(params) {\n const {\n effect,\n swiper,\n on,\n setTranslate,\n setTransition,\n overwriteParams,\n perspective,\n recreateShadows,\n getEffectParams\n } = params;\n on('beforeInit', () => {\n if (swiper.params.effect !== effect) return;\n swiper.classNames.push(`${swiper.params.containerModifierClass}${effect}`);\n if (perspective && perspective()) {\n swiper.classNames.push(`${swiper.params.containerModifierClass}3d`);\n }\n const overwriteParamsResult = overwriteParams ? overwriteParams() : {};\n Object.assign(swiper.params, overwriteParamsResult);\n Object.assign(swiper.originalParams, overwriteParamsResult);\n });\n on('setTranslate', () => {\n if (swiper.params.effect !== effect) return;\n setTranslate();\n });\n on('setTransition', (_s, duration) => {\n if (swiper.params.effect !== effect) return;\n setTransition(duration);\n });\n on('transitionEnd', () => {\n if (swiper.params.effect !== effect) return;\n if (recreateShadows) {\n if (!getEffectParams || !getEffectParams().slideShadows) return;\n // remove shadows\n swiper.slides.forEach(slideEl => {\n slideEl.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(shadowEl => shadowEl.remove());\n });\n // create new one\n recreateShadows();\n }\n });\n let requireUpdateOnVirtual;\n on('virtualUpdate', () => {\n if (swiper.params.effect !== effect) return;\n if (!swiper.slides.length) {\n requireUpdateOnVirtual = true;\n }\n requestAnimationFrame(() => {\n if (requireUpdateOnVirtual && swiper.slides && swiper.slides.length) {\n setTranslate();\n requireUpdateOnVirtual = false;\n }\n });\n });\n}\n\nexport { effectInit as e };\n", "import { k as getSlideTransformEl } from './utils.mjs';\n\nfunction effectTarget(effectParams, slideEl) {\n const transformEl = getSlideTransformEl(slideEl);\n if (transformEl !== slideEl) {\n transformEl.style.backfaceVisibility = 'hidden';\n transformEl.style['-webkit-backface-visibility'] = 'hidden';\n }\n return transformEl;\n}\n\nexport { effectTarget as e };\n", "import { i as elementTransitionEnd } from './utils.mjs';\n\nfunction effectVirtualTransitionEnd(_ref) {\n let {\n swiper,\n duration,\n transformElements,\n allSlides\n } = _ref;\n const {\n activeIndex\n } = swiper;\n const getSlide = el => {\n if (!el.parentElement) {\n // assume shadow root\n const slide = swiper.slides.filter(slideEl => slideEl.shadowRoot && slideEl.shadowRoot === el.parentNode)[0];\n return slide;\n }\n return el.parentElement;\n };\n if (swiper.params.virtualTranslate && duration !== 0) {\n let eventTriggered = false;\n let transitionEndTarget;\n if (allSlides) {\n transitionEndTarget = transformElements;\n } else {\n transitionEndTarget = transformElements.filter(transformEl => {\n const el = transformEl.classList.contains('swiper-slide-transform') ? getSlide(transformEl) : transformEl;\n return swiper.getSlideIndex(el) === activeIndex;\n });\n }\n transitionEndTarget.forEach(el => {\n elementTransitionEnd(el, () => {\n if (eventTriggered) return;\n if (!swiper || swiper.destroyed) return;\n eventTriggered = true;\n swiper.animating = false;\n const evt = new window.CustomEvent('transitionend', {\n bubbles: true,\n cancelable: true\n });\n swiper.wrapperEl.dispatchEvent(evt);\n });\n });\n }\n}\n\nexport { effectVirtualTransitionEnd as e };\n", "import { e as effectInit } from '../shared/effect-init.mjs';\nimport { e as effectTarget } from '../shared/effect-target.mjs';\nimport { e as effectVirtualTransitionEnd } from '../shared/effect-virtual-transition-end.mjs';\nimport { k as getSlideTransformEl } from '../shared/utils.mjs';\n\nfunction EffectFade(_ref) {\n let {\n swiper,\n extendParams,\n on\n } = _ref;\n extendParams({\n fadeEffect: {\n crossFade: false\n }\n });\n const setTranslate = () => {\n const {\n slides\n } = swiper;\n const params = swiper.params.fadeEffect;\n for (let i = 0; i < slides.length; i += 1) {\n const slideEl = swiper.slides[i];\n const offset = slideEl.swiperSlideOffset;\n let tx = -offset;\n if (!swiper.params.virtualTranslate) tx -= swiper.translate;\n let ty = 0;\n if (!swiper.isHorizontal()) {\n ty = tx;\n tx = 0;\n }\n const slideOpacity = swiper.params.fadeEffect.crossFade ? Math.max(1 - Math.abs(slideEl.progress), 0) : 1 + Math.min(Math.max(slideEl.progress, -1), 0);\n const targetEl = effectTarget(params, slideEl);\n targetEl.style.opacity = slideOpacity;\n targetEl.style.transform = `translate3d(${tx}px, ${ty}px, 0px)`;\n }\n };\n const setTransition = duration => {\n const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl));\n transformElements.forEach(el => {\n el.style.transitionDuration = `${duration}ms`;\n });\n effectVirtualTransitionEnd({\n swiper,\n duration,\n transformElements,\n allSlides: true\n });\n };\n effectInit({\n effect: 'fade',\n swiper,\n on,\n setTranslate,\n setTransition,\n overwriteParams: () => ({\n slidesPerView: 1,\n slidesPerGroup: 1,\n watchSlidesProgress: true,\n spaceBetween: 0,\n virtualTranslate: !swiper.params.cssMode\n })\n });\n}\n\nexport { EffectFade as default };\n", "import { e as effectInit } from '../shared/effect-init.mjs';\nimport { c as createElement } from '../shared/utils.mjs';\n\nfunction EffectCube(_ref) {\n let {\n swiper,\n extendParams,\n on\n } = _ref;\n extendParams({\n cubeEffect: {\n slideShadows: true,\n shadow: true,\n shadowOffset: 20,\n shadowScale: 0.94\n }\n });\n const createSlideShadows = (slideEl, progress, isHorizontal) => {\n let shadowBefore = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top');\n let shadowAfter = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom');\n if (!shadowBefore) {\n shadowBefore = createElement('div', `swiper-slide-shadow-cube swiper-slide-shadow-${isHorizontal ? 'left' : 'top'}`.split(' '));\n slideEl.append(shadowBefore);\n }\n if (!shadowAfter) {\n shadowAfter = createElement('div', `swiper-slide-shadow-cube swiper-slide-shadow-${isHorizontal ? 'right' : 'bottom'}`.split(' '));\n slideEl.append(shadowAfter);\n }\n if (shadowBefore) shadowBefore.style.opacity = Math.max(-progress, 0);\n if (shadowAfter) shadowAfter.style.opacity = Math.max(progress, 0);\n };\n const recreateShadows = () => {\n // create new ones\n const isHorizontal = swiper.isHorizontal();\n swiper.slides.forEach(slideEl => {\n const progress = Math.max(Math.min(slideEl.progress, 1), -1);\n createSlideShadows(slideEl, progress, isHorizontal);\n });\n };\n const setTranslate = () => {\n const {\n el,\n wrapperEl,\n slides,\n width: swiperWidth,\n height: swiperHeight,\n rtlTranslate: rtl,\n size: swiperSize,\n browser\n } = swiper;\n const params = swiper.params.cubeEffect;\n const isHorizontal = swiper.isHorizontal();\n const isVirtual = swiper.virtual && swiper.params.virtual.enabled;\n let wrapperRotate = 0;\n let cubeShadowEl;\n if (params.shadow) {\n if (isHorizontal) {\n cubeShadowEl = swiper.wrapperEl.querySelector('.swiper-cube-shadow');\n if (!cubeShadowEl) {\n cubeShadowEl = createElement('div', 'swiper-cube-shadow');\n swiper.wrapperEl.append(cubeShadowEl);\n }\n cubeShadowEl.style.height = `${swiperWidth}px`;\n } else {\n cubeShadowEl = el.querySelector('.swiper-cube-shadow');\n if (!cubeShadowEl) {\n cubeShadowEl = createElement('div', 'swiper-cube-shadow');\n el.append(cubeShadowEl);\n }\n }\n }\n for (let i = 0; i < slides.length; i += 1) {\n const slideEl = slides[i];\n let slideIndex = i;\n if (isVirtual) {\n slideIndex = parseInt(slideEl.getAttribute('data-swiper-slide-index'), 10);\n }\n let slideAngle = slideIndex * 90;\n let round = Math.floor(slideAngle / 360);\n if (rtl) {\n slideAngle = -slideAngle;\n round = Math.floor(-slideAngle / 360);\n }\n const progress = Math.max(Math.min(slideEl.progress, 1), -1);\n let tx = 0;\n let ty = 0;\n let tz = 0;\n if (slideIndex % 4 === 0) {\n tx = -round * 4 * swiperSize;\n tz = 0;\n } else if ((slideIndex - 1) % 4 === 0) {\n tx = 0;\n tz = -round * 4 * swiperSize;\n } else if ((slideIndex - 2) % 4 === 0) {\n tx = swiperSize + round * 4 * swiperSize;\n tz = swiperSize;\n } else if ((slideIndex - 3) % 4 === 0) {\n tx = -swiperSize;\n tz = 3 * swiperSize + swiperSize * 4 * round;\n }\n if (rtl) {\n tx = -tx;\n }\n if (!isHorizontal) {\n ty = tx;\n tx = 0;\n }\n const transform = `rotateX(${isHorizontal ? 0 : -slideAngle}deg) rotateY(${isHorizontal ? slideAngle : 0}deg) translate3d(${tx}px, ${ty}px, ${tz}px)`;\n if (progress <= 1 && progress > -1) {\n wrapperRotate = slideIndex * 90 + progress * 90;\n if (rtl) wrapperRotate = -slideIndex * 90 - progress * 90;\n }\n slideEl.style.transform = transform;\n if (params.slideShadows) {\n createSlideShadows(slideEl, progress, isHorizontal);\n }\n }\n wrapperEl.style.transformOrigin = `50% 50% -${swiperSize / 2}px`;\n wrapperEl.style['-webkit-transform-origin'] = `50% 50% -${swiperSize / 2}px`;\n if (params.shadow) {\n if (isHorizontal) {\n cubeShadowEl.style.transform = `translate3d(0px, ${swiperWidth / 2 + params.shadowOffset}px, ${-swiperWidth / 2}px) rotateX(90deg) rotateZ(0deg) scale(${params.shadowScale})`;\n } else {\n const shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;\n const multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);\n const scale1 = params.shadowScale;\n const scale2 = params.shadowScale / multiplier;\n const offset = params.shadowOffset;\n cubeShadowEl.style.transform = `scale3d(${scale1}, 1, ${scale2}) translate3d(0px, ${swiperHeight / 2 + offset}px, ${-swiperHeight / 2 / scale2}px) rotateX(-90deg)`;\n }\n }\n const zFactor = (browser.isSafari || browser.isWebView) && browser.needPerspectiveFix ? -swiperSize / 2 : 0;\n wrapperEl.style.transform = `translate3d(0px,0,${zFactor}px) rotateX(${swiper.isHorizontal() ? 0 : wrapperRotate}deg) rotateY(${swiper.isHorizontal() ? -wrapperRotate : 0}deg)`;\n wrapperEl.style.setProperty('--swiper-cube-translate-z', `${zFactor}px`);\n };\n const setTransition = duration => {\n const {\n el,\n slides\n } = swiper;\n slides.forEach(slideEl => {\n slideEl.style.transitionDuration = `${duration}ms`;\n slideEl.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(subEl => {\n subEl.style.transitionDuration = `${duration}ms`;\n });\n });\n if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) {\n const shadowEl = el.querySelector('.swiper-cube-shadow');\n if (shadowEl) shadowEl.style.transitionDuration = `${duration}ms`;\n }\n };\n effectInit({\n effect: 'cube',\n swiper,\n on,\n setTranslate,\n setTransition,\n recreateShadows,\n getEffectParams: () => swiper.params.cubeEffect,\n perspective: () => true,\n overwriteParams: () => ({\n slidesPerView: 1,\n slidesPerGroup: 1,\n watchSlidesProgress: true,\n resistanceRatio: 0,\n spaceBetween: 0,\n centeredSlides: false,\n virtualTranslate: true\n })\n });\n}\n\nexport { EffectCube as default };\n", "import { k as getSlideTransformEl, c as createElement } from './utils.mjs';\n\nfunction createShadow(suffix, slideEl, side) {\n const shadowClass = `swiper-slide-shadow${side ? `-${side}` : ''}${suffix ? ` swiper-slide-shadow-${suffix}` : ''}`;\n const shadowContainer = getSlideTransformEl(slideEl);\n let shadowEl = shadowContainer.querySelector(`.${shadowClass.split(' ').join('.')}`);\n if (!shadowEl) {\n shadowEl = createElement('div', shadowClass.split(' '));\n shadowContainer.append(shadowEl);\n }\n return shadowEl;\n}\n\nexport { createShadow as c };\n", "import { c as createShadow } from '../shared/create-shadow.mjs';\nimport { e as effectInit } from '../shared/effect-init.mjs';\nimport { e as effectTarget } from '../shared/effect-target.mjs';\nimport { e as effectVirtualTransitionEnd } from '../shared/effect-virtual-transition-end.mjs';\nimport { k as getSlideTransformEl } from '../shared/utils.mjs';\n\nfunction EffectFlip(_ref) {\n let {\n swiper,\n extendParams,\n on\n } = _ref;\n extendParams({\n flipEffect: {\n slideShadows: true,\n limitRotation: true\n }\n });\n const createSlideShadows = (slideEl, progress) => {\n let shadowBefore = swiper.isHorizontal() ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top');\n let shadowAfter = swiper.isHorizontal() ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom');\n if (!shadowBefore) {\n shadowBefore = createShadow('flip', slideEl, swiper.isHorizontal() ? 'left' : 'top');\n }\n if (!shadowAfter) {\n shadowAfter = createShadow('flip', slideEl, swiper.isHorizontal() ? 'right' : 'bottom');\n }\n if (shadowBefore) shadowBefore.style.opacity = Math.max(-progress, 0);\n if (shadowAfter) shadowAfter.style.opacity = Math.max(progress, 0);\n };\n const recreateShadows = () => {\n // Set shadows\n swiper.params.flipEffect;\n swiper.slides.forEach(slideEl => {\n let progress = slideEl.progress;\n if (swiper.params.flipEffect.limitRotation) {\n progress = Math.max(Math.min(slideEl.progress, 1), -1);\n }\n createSlideShadows(slideEl, progress);\n });\n };\n const setTranslate = () => {\n const {\n slides,\n rtlTranslate: rtl\n } = swiper;\n const params = swiper.params.flipEffect;\n for (let i = 0; i < slides.length; i += 1) {\n const slideEl = slides[i];\n let progress = slideEl.progress;\n if (swiper.params.flipEffect.limitRotation) {\n progress = Math.max(Math.min(slideEl.progress, 1), -1);\n }\n const offset = slideEl.swiperSlideOffset;\n const rotate = -180 * progress;\n let rotateY = rotate;\n let rotateX = 0;\n let tx = swiper.params.cssMode ? -offset - swiper.translate : -offset;\n let ty = 0;\n if (!swiper.isHorizontal()) {\n ty = tx;\n tx = 0;\n rotateX = -rotateY;\n rotateY = 0;\n } else if (rtl) {\n rotateY = -rotateY;\n }\n slideEl.style.zIndex = -Math.abs(Math.round(progress)) + slides.length;\n if (params.slideShadows) {\n createSlideShadows(slideEl, progress);\n }\n const transform = `translate3d(${tx}px, ${ty}px, 0px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)`;\n const targetEl = effectTarget(params, slideEl);\n targetEl.style.transform = transform;\n }\n };\n const setTransition = duration => {\n const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl));\n transformElements.forEach(el => {\n el.style.transitionDuration = `${duration}ms`;\n el.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(shadowEl => {\n shadowEl.style.transitionDuration = `${duration}ms`;\n });\n });\n effectVirtualTransitionEnd({\n swiper,\n duration,\n transformElements\n });\n };\n effectInit({\n effect: 'flip',\n swiper,\n on,\n setTranslate,\n setTransition,\n recreateShadows,\n getEffectParams: () => swiper.params.flipEffect,\n perspective: () => true,\n overwriteParams: () => ({\n slidesPerView: 1,\n slidesPerGroup: 1,\n watchSlidesProgress: true,\n spaceBetween: 0,\n virtualTranslate: !swiper.params.cssMode\n })\n });\n}\n\nexport { EffectFlip as default };\n", "import { c as createShadow } from '../shared/create-shadow.mjs';\nimport { e as effectInit } from '../shared/effect-init.mjs';\nimport { e as effectTarget } from '../shared/effect-target.mjs';\nimport { k as getSlideTransformEl } from '../shared/utils.mjs';\n\nfunction EffectCoverflow(_ref) {\n let {\n swiper,\n extendParams,\n on\n } = _ref;\n extendParams({\n coverflowEffect: {\n rotate: 50,\n stretch: 0,\n depth: 100,\n scale: 1,\n modifier: 1,\n slideShadows: true\n }\n });\n const setTranslate = () => {\n const {\n width: swiperWidth,\n height: swiperHeight,\n slides,\n slidesSizesGrid\n } = swiper;\n const params = swiper.params.coverflowEffect;\n const isHorizontal = swiper.isHorizontal();\n const transform = swiper.translate;\n const center = isHorizontal ? -transform + swiperWidth / 2 : -transform + swiperHeight / 2;\n const rotate = isHorizontal ? params.rotate : -params.rotate;\n const translate = params.depth;\n // Each slide offset from center\n for (let i = 0, length = slides.length; i < length; i += 1) {\n const slideEl = slides[i];\n const slideSize = slidesSizesGrid[i];\n const slideOffset = slideEl.swiperSlideOffset;\n const centerOffset = (center - slideOffset - slideSize / 2) / slideSize;\n const offsetMultiplier = typeof params.modifier === 'function' ? params.modifier(centerOffset) : centerOffset * params.modifier;\n let rotateY = isHorizontal ? rotate * offsetMultiplier : 0;\n let rotateX = isHorizontal ? 0 : rotate * offsetMultiplier;\n // var rotateZ = 0\n let translateZ = -translate * Math.abs(offsetMultiplier);\n let stretch = params.stretch;\n // Allow percentage to make a relative stretch for responsive sliders\n if (typeof stretch === 'string' && stretch.indexOf('%') !== -1) {\n stretch = parseFloat(params.stretch) / 100 * slideSize;\n }\n let translateY = isHorizontal ? 0 : stretch * offsetMultiplier;\n let translateX = isHorizontal ? stretch * offsetMultiplier : 0;\n let scale = 1 - (1 - params.scale) * Math.abs(offsetMultiplier);\n\n // Fix for ultra small values\n if (Math.abs(translateX) < 0.001) translateX = 0;\n if (Math.abs(translateY) < 0.001) translateY = 0;\n if (Math.abs(translateZ) < 0.001) translateZ = 0;\n if (Math.abs(rotateY) < 0.001) rotateY = 0;\n if (Math.abs(rotateX) < 0.001) rotateX = 0;\n if (Math.abs(scale) < 0.001) scale = 0;\n const slideTransform = `translate3d(${translateX}px,${translateY}px,${translateZ}px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) scale(${scale})`;\n const targetEl = effectTarget(params, slideEl);\n targetEl.style.transform = slideTransform;\n slideEl.style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;\n if (params.slideShadows) {\n // Set shadows\n let shadowBeforeEl = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-left') : slideEl.querySelector('.swiper-slide-shadow-top');\n let shadowAfterEl = isHorizontal ? slideEl.querySelector('.swiper-slide-shadow-right') : slideEl.querySelector('.swiper-slide-shadow-bottom');\n if (!shadowBeforeEl) {\n shadowBeforeEl = createShadow('coverflow', slideEl, isHorizontal ? 'left' : 'top');\n }\n if (!shadowAfterEl) {\n shadowAfterEl = createShadow('coverflow', slideEl, isHorizontal ? 'right' : 'bottom');\n }\n if (shadowBeforeEl) shadowBeforeEl.style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;\n if (shadowAfterEl) shadowAfterEl.style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0;\n }\n }\n };\n const setTransition = duration => {\n const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl));\n transformElements.forEach(el => {\n el.style.transitionDuration = `${duration}ms`;\n el.querySelectorAll('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').forEach(shadowEl => {\n shadowEl.style.transitionDuration = `${duration}ms`;\n });\n });\n };\n effectInit({\n effect: 'coverflow',\n swiper,\n on,\n setTranslate,\n setTransition,\n perspective: () => true,\n overwriteParams: () => ({\n watchSlidesProgress: true\n })\n });\n}\n\nexport { EffectCoverflow as default };\n", "import { c as createShadow } from '../shared/create-shadow.mjs';\nimport { e as effectInit } from '../shared/effect-init.mjs';\nimport { e as effectTarget } from '../shared/effect-target.mjs';\nimport { e as effectVirtualTransitionEnd } from '../shared/effect-virtual-transition-end.mjs';\nimport { k as getSlideTransformEl } from '../shared/utils.mjs';\n\nfunction EffectCreative(_ref) {\n let {\n swiper,\n extendParams,\n on\n } = _ref;\n extendParams({\n creativeEffect: {\n limitProgress: 1,\n shadowPerProgress: false,\n progressMultiplier: 1,\n perspective: true,\n prev: {\n translate: [0, 0, 0],\n rotate: [0, 0, 0],\n opacity: 1,\n scale: 1\n },\n next: {\n translate: [0, 0, 0],\n rotate: [0, 0, 0],\n opacity: 1,\n scale: 1\n }\n }\n });\n const getTranslateValue = value => {\n if (typeof value === 'string') return value;\n return `${value}px`;\n };\n const setTranslate = () => {\n const {\n slides,\n wrapperEl,\n slidesSizesGrid\n } = swiper;\n const params = swiper.params.creativeEffect;\n const {\n progressMultiplier: multiplier\n } = params;\n const isCenteredSlides = swiper.params.centeredSlides;\n if (isCenteredSlides) {\n const margin = slidesSizesGrid[0] / 2 - swiper.params.slidesOffsetBefore || 0;\n wrapperEl.style.transform = `translateX(calc(50% - ${margin}px))`;\n }\n for (let i = 0; i < slides.length; i += 1) {\n const slideEl = slides[i];\n const slideProgress = slideEl.progress;\n const progress = Math.min(Math.max(slideEl.progress, -params.limitProgress), params.limitProgress);\n let originalProgress = progress;\n if (!isCenteredSlides) {\n originalProgress = Math.min(Math.max(slideEl.originalProgress, -params.limitProgress), params.limitProgress);\n }\n const offset = slideEl.swiperSlideOffset;\n const t = [swiper.params.cssMode ? -offset - swiper.translate : -offset, 0, 0];\n const r = [0, 0, 0];\n let custom = false;\n if (!swiper.isHorizontal()) {\n t[1] = t[0];\n t[0] = 0;\n }\n let data = {\n translate: [0, 0, 0],\n rotate: [0, 0, 0],\n scale: 1,\n opacity: 1\n };\n if (progress < 0) {\n data = params.next;\n custom = true;\n } else if (progress > 0) {\n data = params.prev;\n custom = true;\n }\n // set translate\n t.forEach((value, index) => {\n t[index] = `calc(${value}px + (${getTranslateValue(data.translate[index])} * ${Math.abs(progress * multiplier)}))`;\n });\n // set rotates\n r.forEach((value, index) => {\n r[index] = data.rotate[index] * Math.abs(progress * multiplier);\n });\n slideEl.style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length;\n const translateString = t.join(', ');\n const rotateString = `rotateX(${r[0]}deg) rotateY(${r[1]}deg) rotateZ(${r[2]}deg)`;\n const scaleString = originalProgress < 0 ? `scale(${1 + (1 - data.scale) * originalProgress * multiplier})` : `scale(${1 - (1 - data.scale) * originalProgress * multiplier})`;\n const opacityString = originalProgress < 0 ? 1 + (1 - data.opacity) * originalProgress * multiplier : 1 - (1 - data.opacity) * originalProgress * multiplier;\n const transform = `translate3d(${translateString}) ${rotateString} ${scaleString}`;\n\n // Set shadows\n if (custom && data.shadow || !custom) {\n let shadowEl = slideEl.querySelector('.swiper-slide-shadow');\n if (!shadowEl && data.shadow) {\n shadowEl = createShadow('creative', slideEl);\n }\n if (shadowEl) {\n const shadowOpacity = params.shadowPerProgress ? progress * (1 / params.limitProgress) : progress;\n shadowEl.style.opacity = Math.min(Math.max(Math.abs(shadowOpacity), 0), 1);\n }\n }\n const targetEl = effectTarget(params, slideEl);\n targetEl.style.transform = transform;\n targetEl.style.opacity = opacityString;\n if (data.origin) {\n targetEl.style.transformOrigin = data.origin;\n }\n }\n };\n const setTransition = duration => {\n const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl));\n transformElements.forEach(el => {\n el.style.transitionDuration = `${duration}ms`;\n el.querySelectorAll('.swiper-slide-shadow').forEach(shadowEl => {\n shadowEl.style.transitionDuration = `${duration}ms`;\n });\n });\n effectVirtualTransitionEnd({\n swiper,\n duration,\n transformElements,\n allSlides: true\n });\n };\n effectInit({\n effect: 'creative',\n swiper,\n on,\n setTranslate,\n setTransition,\n perspective: () => swiper.params.creativeEffect.perspective,\n overwriteParams: () => ({\n watchSlidesProgress: true,\n virtualTranslate: !swiper.params.cssMode\n })\n });\n}\n\nexport { EffectCreative as default };\n", "import { c as createShadow } from '../shared/create-shadow.mjs';\nimport { e as effectInit } from '../shared/effect-init.mjs';\nimport { e as effectTarget } from '../shared/effect-target.mjs';\nimport { e as effectVirtualTransitionEnd } from '../shared/effect-virtual-transition-end.mjs';\nimport { k as getSlideTransformEl } from '../shared/utils.mjs';\n\nfunction EffectCards(_ref) {\n let {\n swiper,\n extendParams,\n on\n } = _ref;\n extendParams({\n cardsEffect: {\n slideShadows: true,\n rotate: true,\n perSlideRotate: 2,\n perSlideOffset: 8\n }\n });\n const setTranslate = () => {\n const {\n slides,\n activeIndex,\n rtlTranslate: rtl\n } = swiper;\n const params = swiper.params.cardsEffect;\n const {\n startTranslate,\n isTouched\n } = swiper.touchEventsData;\n const currentTranslate = rtl ? -swiper.translate : swiper.translate;\n for (let i = 0; i < slides.length; i += 1) {\n const slideEl = slides[i];\n const slideProgress = slideEl.progress;\n const progress = Math.min(Math.max(slideProgress, -4), 4);\n let offset = slideEl.swiperSlideOffset;\n if (swiper.params.centeredSlides && !swiper.params.cssMode) {\n swiper.wrapperEl.style.transform = `translateX(${swiper.minTranslate()}px)`;\n }\n if (swiper.params.centeredSlides && swiper.params.cssMode) {\n offset -= slides[0].swiperSlideOffset;\n }\n let tX = swiper.params.cssMode ? -offset - swiper.translate : -offset;\n let tY = 0;\n const tZ = -100 * Math.abs(progress);\n let scale = 1;\n let rotate = -params.perSlideRotate * progress;\n let tXAdd = params.perSlideOffset - Math.abs(progress) * 0.75;\n const slideIndex = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.from + i : i;\n const isSwipeToNext = (slideIndex === activeIndex || slideIndex === activeIndex - 1) && progress > 0 && progress < 1 && (isTouched || swiper.params.cssMode) && currentTranslate < startTranslate;\n const isSwipeToPrev = (slideIndex === activeIndex || slideIndex === activeIndex + 1) && progress < 0 && progress > -1 && (isTouched || swiper.params.cssMode) && currentTranslate > startTranslate;\n if (isSwipeToNext || isSwipeToPrev) {\n const subProgress = (1 - Math.abs((Math.abs(progress) - 0.5) / 0.5)) ** 0.5;\n rotate += -28 * progress * subProgress;\n scale += -0.5 * subProgress;\n tXAdd += 96 * subProgress;\n tY = `${-25 * subProgress * Math.abs(progress)}%`;\n }\n if (progress < 0) {\n // next\n tX = `calc(${tX}px ${rtl ? '-' : '+'} (${tXAdd * Math.abs(progress)}%))`;\n } else if (progress > 0) {\n // prev\n tX = `calc(${tX}px ${rtl ? '-' : '+'} (-${tXAdd * Math.abs(progress)}%))`;\n } else {\n tX = `${tX}px`;\n }\n if (!swiper.isHorizontal()) {\n const prevY = tY;\n tY = tX;\n tX = prevY;\n }\n const scaleString = progress < 0 ? `${1 + (1 - scale) * progress}` : `${1 - (1 - scale) * progress}`;\n\n /* eslint-disable */\n const transform = `\n translate3d(${tX}, ${tY}, ${tZ}px)\n rotateZ(${params.rotate ? rtl ? -rotate : rotate : 0}deg)\n scale(${scaleString})\n `;\n /* eslint-enable */\n\n if (params.slideShadows) {\n // Set shadows\n let shadowEl = slideEl.querySelector('.swiper-slide-shadow');\n if (!shadowEl) {\n shadowEl = createShadow('cards', slideEl);\n }\n if (shadowEl) shadowEl.style.opacity = Math.min(Math.max((Math.abs(progress) - 0.5) / 0.5, 0), 1);\n }\n slideEl.style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length;\n const targetEl = effectTarget(params, slideEl);\n targetEl.style.transform = transform;\n }\n };\n const setTransition = duration => {\n const transformElements = swiper.slides.map(slideEl => getSlideTransformEl(slideEl));\n transformElements.forEach(el => {\n el.style.transitionDuration = `${duration}ms`;\n el.querySelectorAll('.swiper-slide-shadow').forEach(shadowEl => {\n shadowEl.style.transitionDuration = `${duration}ms`;\n });\n });\n effectVirtualTransitionEnd({\n swiper,\n duration,\n transformElements\n });\n };\n effectInit({\n effect: 'cards',\n swiper,\n on,\n setTranslate,\n setTransition,\n perspective: () => true,\n overwriteParams: () => ({\n watchSlidesProgress: true,\n virtualTranslate: !swiper.params.cssMode\n })\n });\n}\n\nexport { EffectCards as default };\n", "/**\n * Swiper 10.3.1\n * Most modern mobile touch slider and framework with hardware accelerated transitions\n * https://swiperjs.com\n *\n * Copyright 2014-2023 Vladimir Kharlampidi\n *\n * Released under the MIT License\n *\n * Released on: September 28, 2023\n */\n\nimport { S as Swiper } from './shared/swiper-core.mjs';\nimport Virtual from './modules/virtual.mjs';\nimport Keyboard from './modules/keyboard.mjs';\nimport Mousewheel from './modules/mousewheel.mjs';\nimport Navigation from './modules/navigation.mjs';\nimport Pagination from './modules/pagination.mjs';\nimport Scrollbar from './modules/scrollbar.mjs';\nimport Parallax from './modules/parallax.mjs';\nimport Zoom from './modules/zoom.mjs';\nimport Controller from './modules/controller.mjs';\nimport A11y from './modules/a11y.mjs';\nimport History from './modules/history.mjs';\nimport HashNavigation from './modules/hash-navigation.mjs';\nimport Autoplay from './modules/autoplay.mjs';\nimport Thumb from './modules/thumbs.mjs';\nimport freeMode from './modules/free-mode.mjs';\nimport Grid from './modules/grid.mjs';\nimport Manipulation from './modules/manipulation.mjs';\nimport EffectFade from './modules/effect-fade.mjs';\nimport EffectCube from './modules/effect-cube.mjs';\nimport EffectFlip from './modules/effect-flip.mjs';\nimport EffectCoverflow from './modules/effect-coverflow.mjs';\nimport EffectCreative from './modules/effect-creative.mjs';\nimport EffectCards from './modules/effect-cards.mjs';\n\n// Swiper Class\nconst modules = [Virtual, Keyboard, Mousewheel, Navigation, Pagination, Scrollbar, Parallax, Zoom, Controller, A11y, History, HashNavigation, Autoplay, Thumb, freeMode, Grid, Manipulation, EffectFade, EffectCube, EffectFlip, EffectCoverflow, EffectCreative, EffectCards];\nSwiper.use(modules);\n\nexport { Swiper, Swiper as default };\n", "/* underscore in name -> watch for changes */\nconst paramsList = ['eventsPrefix', 'injectStyles', 'injectStylesUrls', 'modules', 'init', '_direction', 'oneWayMovement', 'touchEventsTarget', 'initialSlide', '_speed', 'cssMode', 'updateOnWindowResize', 'resizeObserver', 'nested', 'focusableElements', '_enabled', '_width', '_height', 'preventInteractionOnTransition', 'userAgent', 'url', '_edgeSwipeDetection', '_edgeSwipeThreshold', '_freeMode', '_autoHeight', 'setWrapperSize', 'virtualTranslate', '_effect', 'breakpoints', 'breakpointsBase', '_spaceBetween', '_slidesPerView', 'maxBackfaceHiddenSlides', '_grid', '_slidesPerGroup', '_slidesPerGroupSkip', '_slidesPerGroupAuto', '_centeredSlides', '_centeredSlidesBounds', '_slidesOffsetBefore', '_slidesOffsetAfter', 'normalizeSlideIndex', '_centerInsufficientSlides', '_watchOverflow', 'roundLengths', 'touchRatio', 'touchAngle', 'simulateTouch', '_shortSwipes', '_longSwipes', 'longSwipesRatio', 'longSwipesMs', '_followFinger', 'allowTouchMove', '_threshold', 'touchMoveStopPropagation', 'touchStartPreventDefault', 'touchStartForcePreventDefault', 'touchReleaseOnEdges', 'uniqueNavElements', '_resistance', '_resistanceRatio', '_watchSlidesProgress', '_grabCursor', 'preventClicks', 'preventClicksPropagation', '_slideToClickedSlide', '_loop', 'loopedSlides', 'loopPreventsSliding', '_rewind', '_allowSlidePrev', '_allowSlideNext', '_swipeHandler', '_noSwiping', 'noSwipingClass', 'noSwipingSelector', 'passiveListeners', 'containerModifierClass', 'slideClass', 'slideActiveClass', 'slideVisibleClass', 'slideNextClass', 'slidePrevClass', 'wrapperClass', 'lazyPreloaderClass', 'lazyPreloadPrevNext', 'runCallbacksOnInit', 'observer', 'observeParents', 'observeSlideChildren',\n// modules\n'a11y', '_autoplay', '_controller', 'coverflowEffect', 'cubeEffect', 'fadeEffect', 'flipEffect', 'creativeEffect', 'cardsEffect', 'hashNavigation', 'history', 'keyboard', 'mousewheel', '_navigation', '_pagination', 'parallax', '_scrollbar', '_thumbs', 'virtual', 'zoom', 'control'];\n\nfunction isObject(o) {\n return typeof o === 'object' && o !== null && o.constructor && Object.prototype.toString.call(o).slice(8, -1) === 'Object' && !o.__swiper__;\n}\nfunction extend(target, src) {\n const noExtend = ['__proto__', 'constructor', 'prototype'];\n Object.keys(src).filter(key => noExtend.indexOf(key) < 0).forEach(key => {\n if (typeof target[key] === 'undefined') target[key] = src[key];else if (isObject(src[key]) && isObject(target[key]) && Object.keys(src[key]).length > 0) {\n if (src[key].__swiper__) target[key] = src[key];else extend(target[key], src[key]);\n } else {\n target[key] = src[key];\n }\n });\n}\nfunction needsNavigation(params) {\n if (params === void 0) {\n params = {};\n }\n return params.navigation && typeof params.navigation.nextEl === 'undefined' && typeof params.navigation.prevEl === 'undefined';\n}\nfunction needsPagination(params) {\n if (params === void 0) {\n params = {};\n }\n return params.pagination && typeof params.pagination.el === 'undefined';\n}\nfunction needsScrollbar(params) {\n if (params === void 0) {\n params = {};\n }\n return params.scrollbar && typeof params.scrollbar.el === 'undefined';\n}\nfunction uniqueClasses(classNames) {\n if (classNames === void 0) {\n classNames = '';\n }\n const classes = classNames.split(' ').map(c => c.trim()).filter(c => !!c);\n const unique = [];\n classes.forEach(c => {\n if (unique.indexOf(c) < 0) unique.push(c);\n });\n return unique.join(' ');\n}\nfunction attrToProp(attrName) {\n if (attrName === void 0) {\n attrName = '';\n }\n return attrName.replace(/-[a-z]/g, l => l.toUpperCase().replace('-', ''));\n}\nfunction wrapperClass(className) {\n if (className === void 0) {\n className = '';\n }\n if (!className) return 'swiper-wrapper';\n if (!className.includes('swiper-wrapper')) return `swiper-wrapper ${className}`;\n return className;\n}\n\nfunction updateSwiper(_ref) {\n let {\n swiper,\n slides,\n passedParams,\n changedParams,\n nextEl,\n prevEl,\n scrollbarEl,\n paginationEl\n } = _ref;\n const updateParams = changedParams.filter(key => key !== 'children' && key !== 'direction' && key !== 'wrapperClass');\n const {\n params: currentParams,\n pagination,\n navigation,\n scrollbar,\n virtual,\n thumbs\n } = swiper;\n let needThumbsInit;\n let needControllerInit;\n let needPaginationInit;\n let needScrollbarInit;\n let needNavigationInit;\n let loopNeedDestroy;\n let loopNeedEnable;\n let loopNeedReloop;\n if (changedParams.includes('thumbs') && passedParams.thumbs && passedParams.thumbs.swiper && currentParams.thumbs && !currentParams.thumbs.swiper) {\n needThumbsInit = true;\n }\n if (changedParams.includes('controller') && passedParams.controller && passedParams.controller.control && currentParams.controller && !currentParams.controller.control) {\n needControllerInit = true;\n }\n if (changedParams.includes('pagination') && passedParams.pagination && (passedParams.pagination.el || paginationEl) && (currentParams.pagination || currentParams.pagination === false) && pagination && !pagination.el) {\n needPaginationInit = true;\n }\n if (changedParams.includes('scrollbar') && passedParams.scrollbar && (passedParams.scrollbar.el || scrollbarEl) && (currentParams.scrollbar || currentParams.scrollbar === false) && scrollbar && !scrollbar.el) {\n needScrollbarInit = true;\n }\n if (changedParams.includes('navigation') && passedParams.navigation && (passedParams.navigation.prevEl || prevEl) && (passedParams.navigation.nextEl || nextEl) && (currentParams.navigation || currentParams.navigation === false) && navigation && !navigation.prevEl && !navigation.nextEl) {\n needNavigationInit = true;\n }\n const destroyModule = mod => {\n if (!swiper[mod]) return;\n swiper[mod].destroy();\n if (mod === 'navigation') {\n if (swiper.isElement) {\n swiper[mod].prevEl.remove();\n swiper[mod].nextEl.remove();\n }\n currentParams[mod].prevEl = undefined;\n currentParams[mod].nextEl = undefined;\n swiper[mod].prevEl = undefined;\n swiper[mod].nextEl = undefined;\n } else {\n if (swiper.isElement) {\n swiper[mod].el.remove();\n }\n currentParams[mod].el = undefined;\n swiper[mod].el = undefined;\n }\n };\n if (changedParams.includes('loop') && swiper.isElement) {\n if (currentParams.loop && !passedParams.loop) {\n loopNeedDestroy = true;\n } else if (!currentParams.loop && passedParams.loop) {\n loopNeedEnable = true;\n } else {\n loopNeedReloop = true;\n }\n }\n updateParams.forEach(key => {\n if (isObject(currentParams[key]) && isObject(passedParams[key])) {\n extend(currentParams[key], passedParams[key]);\n if ((key === 'navigation' || key === 'pagination' || key === 'scrollbar') && 'enabled' in passedParams[key] && !passedParams[key].enabled) {\n destroyModule(key);\n }\n } else {\n const newValue = passedParams[key];\n if ((newValue === true || newValue === false) && (key === 'navigation' || key === 'pagination' || key === 'scrollbar')) {\n if (newValue === false) {\n destroyModule(key);\n }\n } else {\n currentParams[key] = passedParams[key];\n }\n }\n });\n if (updateParams.includes('controller') && !needControllerInit && swiper.controller && swiper.controller.control && currentParams.controller && currentParams.controller.control) {\n swiper.controller.control = currentParams.controller.control;\n }\n if (changedParams.includes('children') && slides && virtual && currentParams.virtual.enabled) {\n virtual.slides = slides;\n virtual.update(true);\n }\n if (changedParams.includes('children') && slides && currentParams.loop) {\n loopNeedReloop = true;\n }\n if (needThumbsInit) {\n const initialized = thumbs.init();\n if (initialized) thumbs.update(true);\n }\n if (needControllerInit) {\n swiper.controller.control = currentParams.controller.control;\n }\n if (needPaginationInit) {\n if (swiper.isElement && (!paginationEl || typeof paginationEl === 'string')) {\n paginationEl = document.createElement('div');\n paginationEl.classList.add('swiper-pagination');\n paginationEl.part.add('pagination');\n swiper.el.appendChild(paginationEl);\n }\n if (paginationEl) currentParams.pagination.el = paginationEl;\n pagination.init();\n pagination.render();\n pagination.update();\n }\n if (needScrollbarInit) {\n if (swiper.isElement && (!scrollbarEl || typeof scrollbarEl === 'string')) {\n scrollbarEl = document.createElement('div');\n scrollbarEl.classList.add('swiper-scrollbar');\n scrollbarEl.part.add('scrollbar');\n swiper.el.appendChild(scrollbarEl);\n }\n if (scrollbarEl) currentParams.scrollbar.el = scrollbarEl;\n scrollbar.init();\n scrollbar.updateSize();\n scrollbar.setTranslate();\n }\n if (needNavigationInit) {\n if (swiper.isElement) {\n if (!nextEl || typeof nextEl === 'string') {\n nextEl = document.createElement('div');\n nextEl.classList.add('swiper-button-next');\n nextEl.innerHTML = swiper.hostEl.constructor.nextButtonSvg;\n nextEl.part.add('button-next');\n swiper.el.appendChild(nextEl);\n }\n if (!prevEl || typeof prevEl === 'string') {\n prevEl = document.createElement('div');\n prevEl.classList.add('swiper-button-prev');\n prevEl.innerHTML = swiper.hostEl.constructor.prevButtonSvg;\n prevEl.part.add('button-prev');\n swiper.el.appendChild(prevEl);\n }\n }\n if (nextEl) currentParams.navigation.nextEl = nextEl;\n if (prevEl) currentParams.navigation.prevEl = prevEl;\n navigation.init();\n navigation.update();\n }\n if (changedParams.includes('allowSlideNext')) {\n swiper.allowSlideNext = passedParams.allowSlideNext;\n }\n if (changedParams.includes('allowSlidePrev')) {\n swiper.allowSlidePrev = passedParams.allowSlidePrev;\n }\n if (changedParams.includes('direction')) {\n swiper.changeDirection(passedParams.direction, false);\n }\n if (loopNeedDestroy || loopNeedReloop) {\n swiper.loopDestroy();\n }\n if (loopNeedEnable || loopNeedReloop) {\n swiper.loopCreate();\n }\n swiper.update();\n}\n\nexport { needsPagination as a, needsScrollbar as b, attrToProp as c, uniqueClasses as d, extend as e, isObject as i, needsNavigation as n, paramsList as p, updateSwiper as u, wrapperClass as w };\n", "import { e as extend, i as isObject, c as attrToProp, p as paramsList } from './update-swiper.mjs';\nimport { d as defaults } from './swiper-core.mjs';\n\nconst formatValue = val => {\n if (parseFloat(val) === Number(val)) return Number(val);\n if (val === 'true') return true;\n if (val === '') return true;\n if (val === 'false') return false;\n if (val === 'null') return null;\n if (val === 'undefined') return undefined;\n if (typeof val === 'string' && val.includes('{') && val.includes('}') && val.includes('\"')) {\n let v;\n try {\n v = JSON.parse(val);\n } catch (err) {\n v = val;\n }\n return v;\n }\n return val;\n};\nconst modulesParamsList = ['a11y', 'autoplay', 'controller', 'cards-effect', 'coverflow-effect', 'creative-effect', 'cube-effect', 'fade-effect', 'flip-effect', 'free-mode', 'grid', 'hash-navigation', 'history', 'keyboard', 'mousewheel', 'navigation', 'pagination', 'parallax', 'scrollbar', 'thumbs', 'virtual', 'zoom'];\nfunction getParams(element, propName, propValue) {\n const params = {};\n const passedParams = {};\n extend(params, defaults);\n const localParamsList = [...paramsList, 'on'];\n const allowedParams = localParamsList.map(key => key.replace(/_/, ''));\n\n // First check props\n localParamsList.forEach(paramName => {\n paramName = paramName.replace('_', '');\n if (typeof element[paramName] !== 'undefined') {\n passedParams[paramName] = element[paramName];\n }\n });\n\n // Attributes\n const attrsList = [...element.attributes];\n if (typeof propName === 'string' && typeof propValue !== 'undefined') {\n attrsList.push({\n name: propName,\n value: isObject(propValue) ? {\n ...propValue\n } : propValue\n });\n }\n attrsList.forEach(attr => {\n const moduleParam = modulesParamsList.filter(mParam => attr.name.indexOf(`${mParam}-`) === 0)[0];\n if (moduleParam) {\n const parentObjName = attrToProp(moduleParam);\n const subObjName = attrToProp(attr.name.split(`${moduleParam}-`)[1]);\n if (typeof passedParams[parentObjName] === 'undefined') passedParams[parentObjName] = {};\n if (passedParams[parentObjName] === true) {\n passedParams[parentObjName] = {\n enabled: true\n };\n }\n passedParams[parentObjName][subObjName] = formatValue(attr.value);\n } else {\n const name = attrToProp(attr.name);\n if (!allowedParams.includes(name)) return;\n const value = formatValue(attr.value);\n if (passedParams[name] && modulesParamsList.includes(attr.name) && !isObject(value)) {\n if (passedParams[name].constructor !== Object) {\n passedParams[name] = {};\n }\n passedParams[name].enabled = !!value;\n } else {\n passedParams[name] = value;\n }\n }\n });\n extend(params, passedParams);\n if (params.navigation) {\n params.navigation = {\n prevEl: '.swiper-button-prev',\n nextEl: '.swiper-button-next',\n ...(params.navigation !== true ? params.navigation : {})\n };\n } else if (params.navigation === false) {\n delete params.navigation;\n }\n if (params.scrollbar) {\n params.scrollbar = {\n el: '.swiper-scrollbar',\n ...(params.scrollbar !== true ? params.scrollbar : {})\n };\n } else if (params.scrollbar === false) {\n delete params.scrollbar;\n }\n if (params.pagination) {\n params.pagination = {\n el: '.swiper-pagination',\n ...(params.pagination !== true ? params.pagination : {})\n };\n } else if (params.pagination === false) {\n delete params.pagination;\n }\n return {\n params,\n passedParams\n };\n}\n\nexport { getParams as g };\n", "/**\n * Swiper Custom Element 10.3.1\n * Most modern mobile touch slider and framework with hardware accelerated transitions\n * https://swiperjs.com\n *\n * Copyright 2014-2023 Vladimir Kharlampidi\n *\n * Released under the MIT License\n *\n * Released on: September 28, 2023\n */\n\nimport './swiper-bundle.mjs';\nimport { p as paramsList, n as needsNavigation, a as needsPagination, b as needsScrollbar, u as updateSwiper, c as attrToProp } from './shared/update-swiper.mjs';\nimport { g as getParams } from './shared/get-element-params.mjs';\nimport { S as Swiper } from './shared/swiper-core.mjs';\n\n/* eslint-disable spaced-comment */\n\nconst SwiperCSS = `:host{--swiper-theme-color:#007aff}:host{position:relative;display:block;margin-left:auto;margin-right:auto;z-index:1}.swiper{width:100%;height:100%;margin-left:auto;margin-right:auto;position:relative;overflow:hidden;overflow:clip;list-style:none;padding:0;z-index:1;display:block}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:flex;transition-property:transform;transition-timing-function:var(--swiper-wrapper-transition-timing-function,initial);box-sizing:content-box}.swiper-android ::slotted(swiper-slide),.swiper-ios ::slotted(swiper-slide),.swiper-wrapper{transform:translate3d(0px,0,0)}.swiper-horizontal{touch-action:pan-y}.swiper-vertical{touch-action:pan-x}::slotted(swiper-slide){flex-shrink:0;width:100%;height:100%;position:relative;transition-property:transform;display:block}::slotted(.swiper-slide-invisible-blank){visibility:hidden}.swiper-autoheight,.swiper-autoheight ::slotted(swiper-slide){height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform,height}.swiper-backface-hidden ::slotted(swiper-slide){transform:translateZ(0);-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-3d{perspective:1200px}.swiper-3d .swiper-cube-shadow,.swiper-3d ::slotted(swiper-slide){transform-style:preserve-3d}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode ::slotted(swiper-slide){scroll-snap-align:start start}.swiper-css-mode.swiper-horizontal>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-css-mode.swiper-vertical>.swiper-wrapper{scroll-snap-type:y mandatory}.swiper-css-mode.swiper-free-mode>.swiper-wrapper{scroll-snap-type:none}.swiper-css-mode.swiper-free-mode ::slotted(swiper-slide){scroll-snap-align:none}.swiper-css-mode.swiper-centered>.swiper-wrapper::before{content:'';flex-shrink:0;order:9999}.swiper-css-mode.swiper-centered ::slotted(swiper-slide){scroll-snap-align:center center;scroll-snap-stop:always}.swiper-css-mode.swiper-centered.swiper-horizontal ::slotted(swiper-slide):first-child{margin-inline-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper::before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-css-mode.swiper-centered.swiper-vertical ::slotted(swiper-slide):first-child{margin-block-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper::before{width:100%;min-width:1px;height:var(--swiper-centered-offset-after)}.swiper-virtual ::slotted(swiper-slide){-webkit-backface-visibility:hidden;transform:translateZ(0)}.swiper-virtual.swiper-css-mode .swiper-wrapper::after{content:'';position:absolute;left:0;top:0;pointer-events:none}.swiper-virtual.swiper-css-mode.swiper-horizontal .swiper-wrapper::after{height:1px;width:var(--swiper-virtual-size)}.swiper-virtual.swiper-css-mode.swiper-vertical .swiper-wrapper::after{width:1px;height:var(--swiper-virtual-size)}:host{--swiper-navigation-size:44px}.swiper-button-next,.swiper-button-prev{position:absolute;top:var(--swiper-navigation-top-offset,50%);width:calc(var(--swiper-navigation-size)/ 44 * 27);height:var(--swiper-navigation-size);margin-top:calc(0px - (var(--swiper-navigation-size)/ 2));z-index:10;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--swiper-navigation-color,var(--swiper-theme-color))}.swiper-button-next.swiper-button-disabled,.swiper-button-prev.swiper-button-disabled{opacity:.35;cursor:auto;pointer-events:none}.swiper-button-next.swiper-button-hidden,.swiper-button-prev.swiper-button-hidden{opacity:0;cursor:auto;pointer-events:none}.swiper-navigation-disabled .swiper-button-next,.swiper-navigation-disabled .swiper-button-prev{display:none!important}.swiper-button-next svg,.swiper-button-prev svg{width:100%;height:100%;object-fit:contain;transform-origin:center}.swiper-rtl .swiper-button-next svg,.swiper-rtl .swiper-button-prev svg{transform:rotate(180deg)}.swiper-button-prev,.swiper-rtl .swiper-button-next{left:var(--swiper-navigation-sides-offset,10px);right:auto}.swiper-button-next,.swiper-rtl .swiper-button-prev{right:var(--swiper-navigation-sides-offset,10px);left:auto}.swiper-button-lock{display:none}.swiper-pagination{position:absolute;text-align:center;transition:.3s opacity;transform:translate3d(0,0,0);z-index:10}.swiper-pagination.swiper-pagination-hidden{opacity:0}.swiper-pagination-disabled>.swiper-pagination,.swiper-pagination.swiper-pagination-disabled{display:none!important}.swiper-horizontal>.swiper-pagination-bullets,.swiper-pagination-bullets.swiper-pagination-horizontal,.swiper-pagination-custom,.swiper-pagination-fraction{bottom:var(--swiper-pagination-bottom,8px);top:var(--swiper-pagination-top,auto);left:0;width:100%}.swiper-pagination-bullets-dynamic{overflow:hidden;font-size:0}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transform:scale(.33);position:relative}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active{transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main{transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev{transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev{transform:scale(.33)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next{transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next{transform:scale(.33)}.swiper-pagination-bullet{width:var(--swiper-pagination-bullet-width,var(--swiper-pagination-bullet-size,8px));height:var(--swiper-pagination-bullet-height,var(--swiper-pagination-bullet-size,8px));display:inline-block;border-radius:var(--swiper-pagination-bullet-border-radius,50%);background:var(--swiper-pagination-bullet-inactive-color,#000);opacity:var(--swiper-pagination-bullet-inactive-opacity, .2)}button.swiper-pagination-bullet{border:none;margin:0;padding:0;box-shadow:none;-webkit-appearance:none;appearance:none}.swiper-pagination-clickable .swiper-pagination-bullet{cursor:pointer}.swiper-pagination-bullet:only-child{display:none!important}.swiper-pagination-bullet-active{opacity:var(--swiper-pagination-bullet-opacity, 1);background:var(--swiper-pagination-color,var(--swiper-theme-color))}.swiper-pagination-vertical.swiper-pagination-bullets,.swiper-vertical>.swiper-pagination-bullets{right:var(--swiper-pagination-right,8px);left:var(--swiper-pagination-left,auto);top:50%;transform:translate3d(0px,-50%,0)}.swiper-pagination-vertical.swiper-pagination-bullets .swiper-pagination-bullet,.swiper-vertical>.swiper-pagination-bullets .swiper-pagination-bullet{margin:var(--swiper-pagination-bullet-vertical-gap,6px) 0;display:block}.swiper-pagination-vertical.swiper-pagination-bullets.swiper-pagination-bullets-dynamic,.swiper-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{top:50%;transform:translateY(-50%);width:8px}.swiper-pagination-vertical.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet,.swiper-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{display:inline-block;transition:.2s transform,.2s top}.swiper-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet,.swiper-pagination-horizontal.swiper-pagination-bullets .swiper-pagination-bullet{margin:0 var(--swiper-pagination-bullet-horizontal-gap,4px)}.swiper-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic,.swiper-pagination-horizontal.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{left:50%;transform:translateX(-50%);white-space:nowrap}.swiper-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet,.swiper-pagination-horizontal.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transition:.2s transform,.2s left}.swiper-horizontal.swiper-rtl>.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transition:.2s transform,.2s right}.swiper-pagination-fraction{color:var(--swiper-pagination-fraction-color,inherit)}.swiper-pagination-progressbar{background:var(--swiper-pagination-progressbar-bg-color,rgba(0,0,0,.25));position:absolute}.swiper-pagination-progressbar .swiper-pagination-progressbar-fill{background:var(--swiper-pagination-color,var(--swiper-theme-color));position:absolute;left:0;top:0;width:100%;height:100%;transform:scale(0);transform-origin:left top}.swiper-rtl .swiper-pagination-progressbar .swiper-pagination-progressbar-fill{transform-origin:right top}.swiper-horizontal>.swiper-pagination-progressbar,.swiper-pagination-progressbar.swiper-pagination-horizontal,.swiper-pagination-progressbar.swiper-pagination-vertical.swiper-pagination-progressbar-opposite,.swiper-vertical>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite{width:100%;height:var(--swiper-pagination-progressbar-size,4px);left:0;top:0}.swiper-horizontal>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite,.swiper-pagination-progressbar.swiper-pagination-horizontal.swiper-pagination-progressbar-opposite,.swiper-pagination-progressbar.swiper-pagination-vertical,.swiper-vertical>.swiper-pagination-progressbar{width:var(--swiper-pagination-progressbar-size,4px);height:100%;left:0;top:0}.swiper-pagination-lock{display:none}.swiper-scrollbar{border-radius:var(--swiper-scrollbar-border-radius,10px);position:relative;touch-action:none;background:var(--swiper-scrollbar-bg-color,rgba(0,0,0,.1))}.swiper-scrollbar-disabled>.swiper-scrollbar,.swiper-scrollbar.swiper-scrollbar-disabled{display:none!important}.swiper-horizontal>.swiper-scrollbar,.swiper-scrollbar.swiper-scrollbar-horizontal{position:absolute;left:var(--swiper-scrollbar-sides-offset,1%);bottom:var(--swiper-scrollbar-bottom,4px);top:var(--swiper-scrollbar-top,auto);z-index:50;height:var(--swiper-scrollbar-size,4px);width:calc(100% - 2 * var(--swiper-scrollbar-sides-offset,1%))}.swiper-scrollbar.swiper-scrollbar-vertical,.swiper-vertical>.swiper-scrollbar{position:absolute;left:var(--swiper-scrollbar-left,auto);right:var(--swiper-scrollbar-right,4px);top:var(--swiper-scrollbar-sides-offset,1%);z-index:50;width:var(--swiper-scrollbar-size,4px);height:calc(100% - 2 * var(--swiper-scrollbar-sides-offset,1%))}.swiper-scrollbar-drag{height:100%;width:100%;position:relative;background:var(--swiper-scrollbar-drag-bg-color,rgba(0,0,0,.5));border-radius:var(--swiper-scrollbar-border-radius,10px);left:0;top:0}.swiper-scrollbar-cursor-drag{cursor:move}.swiper-scrollbar-lock{display:none}::slotted(.swiper-slide-zoomed){cursor:move;touch-action:none}.swiper .swiper-notification{position:absolute;left:0;top:0;pointer-events:none;opacity:0;z-index:-1000}.swiper-free-mode>.swiper-wrapper{transition-timing-function:ease-out;margin:0 auto}.swiper-grid>.swiper-wrapper{flex-wrap:wrap}.swiper-grid-column>.swiper-wrapper{flex-wrap:wrap;flex-direction:column}.swiper-fade.swiper-free-mode ::slotted(swiper-slide){transition-timing-function:ease-out}.swiper-fade ::slotted(swiper-slide){pointer-events:none;transition-property:opacity}.swiper-fade ::slotted(swiper-slide) ::slotted(swiper-slide){pointer-events:none}.swiper-fade ::slotted(.swiper-slide-active){pointer-events:auto}.swiper-fade ::slotted(.swiper-slide-active) ::slotted(.swiper-slide-active){pointer-events:auto}.swiper-cube{overflow:visible}.swiper-cube ::slotted(swiper-slide){pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1;visibility:hidden;transform-origin:0 0;width:100%;height:100%}.swiper-cube ::slotted(swiper-slide) ::slotted(swiper-slide){pointer-events:none}.swiper-cube.swiper-rtl ::slotted(swiper-slide){transform-origin:100% 0}.swiper-cube ::slotted(.swiper-slide-active),.swiper-cube ::slotted(.swiper-slide-active) ::slotted(.swiper-slide-active){pointer-events:auto}.swiper-cube ::slotted(.swiper-slide-active),.swiper-cube ::slotted(.swiper-slide-next),.swiper-cube ::slotted(.swiper-slide-prev){pointer-events:auto;visibility:visible}.swiper-cube .swiper-cube-shadow{position:absolute;left:0;bottom:0px;width:100%;height:100%;opacity:.6;z-index:0}.swiper-cube .swiper-cube-shadow:before{content:'';background:#000;position:absolute;left:0;top:0;bottom:0;right:0;filter:blur(50px)}.swiper-cube ::slotted(.swiper-slide-next)+::slotted(swiper-slide){pointer-events:auto;visibility:visible}.swiper-flip{overflow:visible}.swiper-flip ::slotted(swiper-slide){pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1}.swiper-flip ::slotted(swiper-slide) ::slotted(swiper-slide){pointer-events:none}.swiper-flip ::slotted(.swiper-slide-active),.swiper-flip ::slotted(.swiper-slide-active) ::slotted(.swiper-slide-active){pointer-events:auto}.swiper-creative ::slotted(swiper-slide){-webkit-backface-visibility:hidden;backface-visibility:hidden;overflow:hidden;transition-property:transform,opacity,height}.swiper-cards{overflow:visible}.swiper-cards ::slotted(swiper-slide){transform-origin:center bottom;-webkit-backface-visibility:hidden;backface-visibility:hidden;overflow:hidden}`\nconst SwiperSlideCSS = `::slotted(.swiper-slide-shadow),::slotted(.swiper-slide-shadow-bottom),::slotted(.swiper-slide-shadow-left),::slotted(.swiper-slide-shadow-right),::slotted(.swiper-slide-shadow-top){position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}::slotted(.swiper-slide-shadow){background:rgba(0,0,0,.15)}::slotted(.swiper-slide-shadow-left){background-image:linear-gradient(to left,rgba(0,0,0,.5),rgba(0,0,0,0))}::slotted(.swiper-slide-shadow-right){background-image:linear-gradient(to right,rgba(0,0,0,.5),rgba(0,0,0,0))}::slotted(.swiper-slide-shadow-top){background-image:linear-gradient(to top,rgba(0,0,0,.5),rgba(0,0,0,0))}::slotted(.swiper-slide-shadow-bottom){background-image:linear-gradient(to bottom,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-lazy-preloader{animation:swiper-preloader-spin 1s infinite linear;width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;transform-origin:50%;box-sizing:border-box;border:4px solid var(--swiper-preloader-color,var(--swiper-theme-color));border-radius:50%;border-top-color:transparent}@keyframes swiper-preloader-spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}::slotted(.swiper-slide-shadow-cube.swiper-slide-shadow-bottom),::slotted(.swiper-slide-shadow-cube.swiper-slide-shadow-left),::slotted(.swiper-slide-shadow-cube.swiper-slide-shadow-right),::slotted(.swiper-slide-shadow-cube.swiper-slide-shadow-top){z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}::slotted(.swiper-slide-shadow-flip.swiper-slide-shadow-bottom),::slotted(.swiper-slide-shadow-flip.swiper-slide-shadow-left),::slotted(.swiper-slide-shadow-flip.swiper-slide-shadow-right),::slotted(.swiper-slide-shadow-flip.swiper-slide-shadow-top){z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}::slotted(.swiper-zoom-container){width:100%;height:100%;display:flex;justify-content:center;align-items:center;text-align:center}::slotted(.swiper-zoom-container)>canvas,::slotted(.swiper-zoom-container)>img,::slotted(.swiper-zoom-container)>svg{max-width:100%;max-height:100%;object-fit:contain}`\n\nclass DummyHTMLElement {}\nconst ClassToExtend = typeof window === 'undefined' || typeof HTMLElement === 'undefined' ? DummyHTMLElement : HTMLElement;\nconst arrowSvg = `\n `;\nconst addStyle = (shadowRoot, styles) => {\n if (typeof CSSStyleSheet !== 'undefined' && shadowRoot.adoptedStyleSheets) {\n const styleSheet = new CSSStyleSheet();\n styleSheet.replaceSync(styles);\n shadowRoot.adoptedStyleSheets = [styleSheet];\n } else {\n const style = document.createElement('style');\n style.rel = 'stylesheet';\n style.textContent = styles;\n shadowRoot.appendChild(style);\n }\n};\nclass SwiperContainer extends ClassToExtend {\n constructor() {\n super();\n this.attachShadow({\n mode: 'open'\n });\n }\n static get nextButtonSvg() {\n return arrowSvg;\n }\n static get prevButtonSvg() {\n return arrowSvg.replace('/>', ' transform-origin=\"center\" transform=\"rotate(180)\"/>');\n }\n cssStyles() {\n return [SwiperCSS,\n // eslint-disable-line\n ...(this.injectStyles && Array.isArray(this.injectStyles) ? this.injectStyles : [])].join('\\n');\n }\n cssLinks() {\n return this.injectStylesUrls || [];\n }\n calcSlideSlots() {\n const currentSideSlots = this.slideSlots || 0;\n // slide slots\n const slideSlotChildren = [...this.querySelectorAll(`[slot^=slide-]`)].map(child => {\n return parseInt(child.getAttribute('slot').split('slide-')[1], 10);\n });\n this.slideSlots = slideSlotChildren.length ? Math.max(...slideSlotChildren) + 1 : 0;\n if (!this.rendered) return;\n if (this.slideSlots > currentSideSlots) {\n for (let i = currentSideSlots; i < this.slideSlots; i += 1) {\n const slideEl = document.createElement('swiper-slide');\n slideEl.setAttribute('part', `slide slide-${i + 1}`);\n const slotEl = document.createElement('slot');\n slotEl.setAttribute('name', `slide-${i + 1}`);\n slideEl.appendChild(slotEl);\n this.shadowRoot.querySelector('.swiper-wrapper').appendChild(slideEl);\n }\n } else if (this.slideSlots < currentSideSlots) {\n const slides = this.swiper.slides;\n for (let i = slides.length - 1; i >= 0; i -= 1) {\n if (i > this.slideSlots) {\n slides[i].remove();\n }\n }\n }\n }\n render() {\n if (this.rendered) return;\n this.calcSlideSlots();\n\n // local styles\n let localStyles = this.cssStyles();\n if (this.slideSlots > 0) {\n localStyles = localStyles.replace(/::slotted\\(([a-z-0-9.]*)\\)/g, '$1');\n }\n if (localStyles.length) {\n addStyle(this.shadowRoot, localStyles);\n }\n this.cssLinks().forEach(url => {\n const linkExists = this.shadowRoot.querySelector(`link[href=\"${url}\"]`);\n if (linkExists) return;\n const linkEl = document.createElement('link');\n linkEl.rel = 'stylesheet';\n linkEl.href = url;\n this.shadowRoot.appendChild(linkEl);\n });\n // prettier-ignore\n const el = document.createElement('div');\n el.classList.add('swiper');\n el.part = 'container';\n\n // prettier-ignore\n el.innerHTML = `\n \n \n \n ${Array.from({\n length: this.slideSlots\n }).map((_, index) => `\n \n \n \n `).join('')}\n
\n \n ${needsNavigation(this.passedParams) ? `\n ${this.constructor.prevButtonSvg}
\n ${this.constructor.nextButtonSvg}
\n ` : ''}\n ${needsPagination(this.passedParams) ? `\n \n ` : ''}\n ${needsScrollbar(this.passedParams) ? `\n \n ` : ''}\n `;\n this.shadowRoot.appendChild(el);\n this.rendered = true;\n }\n initialize() {\n var _this = this;\n if (this.initialized) return;\n this.initialized = true;\n const {\n params: swiperParams,\n passedParams\n } = getParams(this);\n this.swiperParams = swiperParams;\n this.passedParams = passedParams;\n delete this.swiperParams.init;\n this.render();\n\n // eslint-disable-next-line\n this.swiper = new Swiper(this.shadowRoot.querySelector('.swiper'), {\n ...(swiperParams.virtual ? {} : {\n observer: true,\n observeSlideChildren: this.slideSlots > 0\n }),\n ...swiperParams,\n touchEventsTarget: 'container',\n onAny: function (name) {\n if (name === 'observerUpdate') {\n _this.calcSlideSlots();\n }\n const eventName = swiperParams.eventsPrefix ? `${swiperParams.eventsPrefix}${name.toLowerCase()}` : name.toLowerCase();\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n const event = new CustomEvent(eventName, {\n detail: args,\n bubbles: name !== 'hashChange',\n cancelable: true\n });\n _this.dispatchEvent(event);\n }\n });\n }\n connectedCallback() {\n if (this.initialized && this.nested && this.closest('swiper-slide') && this.closest('swiper-slide').swiperLoopMoveDOM) {\n return;\n }\n if (this.init === false || this.getAttribute('init') === 'false') {\n return;\n }\n this.initialize();\n }\n disconnectedCallback() {\n if (this.nested && this.closest('swiper-slide') && this.closest('swiper-slide').swiperLoopMoveDOM) {\n return;\n }\n if (this.swiper && this.swiper.destroy) {\n this.swiper.destroy();\n }\n this.initialized = false;\n }\n updateSwiperOnPropChange(propName, propValue) {\n const {\n params: swiperParams,\n passedParams\n } = getParams(this, propName, propValue);\n this.passedParams = passedParams;\n this.swiperParams = swiperParams;\n updateSwiper({\n swiper: this.swiper,\n passedParams: this.passedParams,\n changedParams: [attrToProp(propName)],\n ...(propName === 'navigation' && passedParams[propName] ? {\n prevEl: '.swiper-button-prev',\n nextEl: '.swiper-button-next'\n } : {}),\n ...(propName === 'pagination' && passedParams[propName] ? {\n paginationEl: '.swiper-pagination'\n } : {}),\n ...(propName === 'scrollbar' && passedParams[propName] ? {\n scrollbarEl: '.swiper-scrollbar'\n } : {})\n });\n }\n attributeChangedCallback(attr, prevValue, newValue) {\n if (!this.initialized) return;\n if (prevValue === 'true' && newValue === null) {\n newValue = false;\n }\n this.updateSwiperOnPropChange(attr, newValue);\n }\n static get observedAttributes() {\n const attrs = paramsList.filter(param => param.includes('_')).map(param => param.replace(/[A-Z]/g, v => `-${v}`).replace('_', '').toLowerCase());\n return attrs;\n }\n}\nparamsList.forEach(paramName => {\n if (paramName === 'init') return;\n paramName = paramName.replace('_', '');\n Object.defineProperty(SwiperContainer.prototype, paramName, {\n configurable: true,\n get() {\n return (this.passedParams || {})[paramName];\n },\n set(value) {\n if (!this.passedParams) this.passedParams = {};\n this.passedParams[paramName] = value;\n if (!this.initialized) return;\n this.updateSwiperOnPropChange(paramName, value);\n }\n });\n});\nclass SwiperSlide extends ClassToExtend {\n constructor() {\n super();\n this.attachShadow({\n mode: 'open'\n });\n }\n render() {\n const lazy = this.lazy || this.getAttribute('lazy') === '' || this.getAttribute('lazy') === 'true';\n addStyle(this.shadowRoot, SwiperSlideCSS);\n this.shadowRoot.appendChild(document.createElement('slot'));\n if (lazy) {\n const lazyDiv = document.createElement('div');\n lazyDiv.classList.add('swiper-lazy-preloader');\n lazyDiv.part.add('preloader');\n this.shadowRoot.appendChild(lazyDiv);\n }\n }\n initialize() {\n this.render();\n }\n connectedCallback() {\n this.initialize();\n }\n}\n\n// eslint-disable-next-line\nconst register = () => {\n if (typeof window === 'undefined') return;\n if (!window.customElements.get('swiper-container')) window.customElements.define('swiper-container', SwiperContainer);\n if (!window.customElements.get('swiper-slide')) window.customElements.define('swiper-slide', SwiperSlide);\n};\nif (typeof window !== 'undefined') {\n window.SwiperElementRegisterParams = params => {\n paramsList.push(...params);\n };\n}\n\nexport { SwiperContainer, SwiperSlide, register };\n", "// eslint-disable-next-line\nimport Swiper from 'swiper/bundle';\n// eslint-disable-next-line\nimport { register } from 'swiper/element/bundle';\nimport $ from '../../shared/dom7.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nregister();\n\n\n\nfunction initSwiper(swiperEl) {\n const app = this;\n const $swiperEl = $(swiperEl);\n if ($swiperEl.length === 0) return;\n const isElement = $swiperEl[0].swiper && $swiperEl[0].swiper.isElement;\n if ($swiperEl[0].swiper && !$swiperEl[0].swiper.isElement) return;\n let initialSlide;\n let params = {};\n let isTabs;\n let isRoutableTabs;\n if ($swiperEl.hasClass('tabs')) {\n initialSlide = $swiperEl.children('swiper-slide').indexOf($swiperEl.children('.tab-active')[0]);\n isTabs = true;\n isRoutableTabs = $swiperEl.find('.tabs-routable').length > 0;\n }\n if ($swiperEl.attr('data-swiper')) {\n params = JSON.parse($swiperEl.attr('data-swiper'));\n } else if ($swiperEl[0].f7SwiperParams) {\n params = $swiperEl[0].f7SwiperParams;\n } else {\n params = $swiperEl.dataset();\n Object.keys(params).forEach(key => {\n const value = params[key];\n if (typeof value === 'string' && value.indexOf('{') === 0 && value.indexOf('}') > 0) {\n try {\n params[key] = JSON.parse(value);\n } catch (e) {\n // not JSON\n }\n }\n });\n }\n if (typeof params.initialSlide === 'undefined' && typeof initialSlide !== 'undefined') {\n params.initialSlide = initialSlide;\n }\n const swiper = isElement ? $swiperEl[0].swiper : app.swiper.create($swiperEl[0], params);\n if (isElement) {\n swiper.slideTo(initialSlide, 0);\n }\n function updateSwiper() {\n swiper.update();\n }\n const $tabEl = $swiperEl.parents('.tab').filter(tabEl => {\n return $(tabEl).parent('.tabs').parent('.tabs-animated-wrap, swiper-container.tabs').length === 0;\n }).eq(0);\n $swiperEl.parents('.popup, .login-screen, .sheet-modal, .popover').on('modal:open', updateSwiper);\n $swiperEl.parents('.panel').on('panel:open', updateSwiper);\n if ($tabEl && $tabEl.length) {\n $tabEl.on('tab:show', updateSwiper);\n }\n swiper.on('beforeDestroy', () => {\n $swiperEl.parents('.popup, .login-screen, .sheet-modal, .popover').off('modal:open', updateSwiper);\n $swiperEl.parents('.panel').off('panel:open', updateSwiper);\n if ($tabEl && $tabEl.length) {\n $tabEl.off('tab:show', updateSwiper);\n }\n });\n if (isTabs) {\n swiper.on('slideChange', () => {\n if (isRoutableTabs) {\n let view = app.views.get($swiperEl.parents('.view'));\n if (!view) view = app.views.main;\n const router = view.router;\n const tabRouteUrl = router.findTabRouteUrl($(swiper.slides).eq(swiper.activeIndex)[0]);\n if (tabRouteUrl) {\n setTimeout(() => {\n router.navigate(tabRouteUrl);\n }, 0);\n }\n } else {\n app.tab.show({\n tabEl: $(swiper.slides).eq(swiper.activeIndex)\n });\n }\n });\n }\n}\nexport default {\n name: 'swiper',\n static: {\n Swiper\n },\n create() {\n const app = this;\n app.swiper = ConstructorMethods({\n defaultSelector: '.swiper',\n constructor: Swiper,\n domProp: 'swiper'\n });\n },\n on: {\n pageMounted(page) {\n const app = this;\n page.$el.find('swiper-container.tabs').each(swiperEl => {\n initSwiper.call(app, swiperEl);\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('swiper-container.tabs').each(swiperEl => {\n initSwiper.call(app, swiperEl);\n });\n },\n pageReinit(page) {\n const app = this;\n page.$el.find('swiper-container.tabs').each(swiperEl => {\n const swiper = app.swiper.get(swiperEl);\n if (swiper && swiper.update) swiper.update();\n });\n },\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('swiper-container.tabs').each(swiperEl => {\n initSwiper.call(app, swiperEl);\n });\n },\n tabShow(tabEl) {\n const app = this;\n $(tabEl).find('swiper-container.tabs').each(swiperEl => {\n const swiper = app.swiper.get(swiperEl);\n if (swiper && swiper.update) swiper.update();\n });\n },\n tabBeforeRemove(tabEl) {\n const app = this;\n $(tabEl).find('swiper-container.tabs').each(swiperEl => {\n app.swiper.destroy(swiperEl);\n });\n }\n }\n};", "/* eslint indent: [\"off\"] */\nimport { getWindow } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend, now, nextTick, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass PhotoBrowser extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const pb = this;\n pb.app = app;\n const defaults = extend({\n on: {}\n }, app.params.photoBrowser);\n\n // Extend defaults with modules params\n pb.useModulesParams(defaults);\n pb.params = extend(defaults, params);\n extend(pb, {\n exposed: false,\n opened: false,\n activeIndex: pb.params.swiper.initialSlide,\n url: pb.params.url,\n swipeToClose: {\n allow: true,\n isTouched: false,\n diff: undefined,\n start: undefined,\n current: undefined,\n started: false,\n activeSlide: undefined,\n timeStart: undefined\n }\n });\n\n // Install Modules\n pb.useModules();\n\n // Init\n pb.init();\n }\n get view() {\n const {\n params,\n app\n } = this;\n return params.view || app.views.main;\n }\n onSlideChange(swiper) {\n const pb = this;\n pb.activeIndex = swiper.activeIndex;\n let current = swiper.activeIndex + 1;\n let total = pb.params.virtualSlides ? pb.params.photos.length : swiper.slides.length;\n if (swiper.params.loop) {\n total -= 2;\n current -= swiper.loopedSlides;\n if (current < 1) current = total + current;\n if (current > total) current -= total;\n }\n const $activeSlideEl = pb.params.virtualSlides ? $(swiper.wrapperEl).find(`.swiper-slide[data-swiper-slide-index=\"${swiper.activeIndex}\"]`) : $(swiper.slides).eq(swiper.activeIndex);\n const $previousSlideEl = pb.params.virtualSlides ? $(swiper.wrapperEl).find(`.swiper-slide[data-swiper-slide-index=\"${swiper.previousIndex}\"]`) : $(swiper.slides).eq(swiper.previousIndex);\n let $currentEl = pb.$el.find('.photo-browser-current');\n let $totalEl = pb.$el.find('.photo-browser-total');\n let navbarEl;\n if (pb.params.type === 'page' && pb.params.navbar && $currentEl.length === 0 && pb.app.theme === 'ios') {\n navbarEl = pb.app.navbar.getElByPage(pb.$el);\n if (navbarEl) {\n $currentEl = $(navbarEl).find('.photo-browser-current');\n $totalEl = $(navbarEl).find('.photo-browser-total');\n }\n }\n if ($currentEl.length && $totalEl.length) {\n $currentEl.text(current);\n $totalEl.text(total);\n if (!navbarEl) navbarEl = $currentEl.parents('.navbar')[0];\n if (navbarEl) {\n pb.app.navbar.size(navbarEl);\n }\n }\n\n // Update captions\n if (pb.captions.length > 0) {\n const captionIndex = swiper.params.loop ? $activeSlideEl.attr('data-swiper-slide-index') : pb.activeIndex;\n pb.$captionsContainerEl.find('.photo-browser-caption-active').removeClass('photo-browser-caption-active');\n pb.$captionsContainerEl.find(`[data-caption-index=\"${captionIndex}\"]`).addClass('photo-browser-caption-active');\n }\n\n // Stop Video\n const previousSlideVideo = $previousSlideEl.find('video');\n if (previousSlideVideo.length > 0) {\n if ('pause' in previousSlideVideo[0]) previousSlideVideo[0].pause();\n }\n }\n onTouchStart() {\n const pb = this;\n const swipeToClose = pb.swipeToClose;\n if (!swipeToClose.allow) return;\n swipeToClose.isTouched = true;\n }\n onTouchMove(e) {\n const pb = this;\n const swipeToClose = pb.swipeToClose;\n if (!swipeToClose.isTouched) return;\n if (!swipeToClose.started) {\n swipeToClose.started = true;\n swipeToClose.start = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n if (pb.params.virtualSlides) {\n swipeToClose.activeSlide = $(pb.swiper.wrapperEl).children('.swiper-slide-active');\n } else {\n swipeToClose.activeSlide = $(pb.swiper.slides).eq(pb.swiper.activeIndex);\n }\n swipeToClose.timeStart = now();\n }\n e.preventDefault();\n swipeToClose.current = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n swipeToClose.diff = swipeToClose.start - swipeToClose.current;\n pb.$el.transition(0).transform(`translate3d(0,${-swipeToClose.diff}px,0)`);\n }\n onTouchEnd() {\n const pb = this;\n const swipeToClose = pb.swipeToClose;\n swipeToClose.isTouched = false;\n if (!swipeToClose.started) {\n swipeToClose.started = false;\n return;\n }\n swipeToClose.started = false;\n swipeToClose.allow = false;\n const diff = Math.abs(swipeToClose.diff);\n const timeDiff = new Date().getTime() - swipeToClose.timeStart;\n if (timeDiff < 300 && diff > 20 || timeDiff >= 300 && diff > 100) {\n nextTick(() => {\n if (pb.$el) {\n if (swipeToClose.diff < 0) pb.$el.addClass('swipe-close-to-bottom');else pb.$el.addClass('swipe-close-to-top');\n }\n pb.emit('local::swipeToClose', pb);\n pb.$el.transform('').transition('');\n pb.close();\n swipeToClose.allow = true;\n });\n return;\n }\n if (diff !== 0) {\n pb.$el.addClass('photo-browser-transitioning').transitionEnd(() => {\n swipeToClose.allow = true;\n pb.$el.removeClass('photo-browser-transitioning');\n });\n } else {\n swipeToClose.allow = true;\n }\n nextTick(() => {\n pb.$el.transform('').transition('');\n });\n }\n\n // Render Functions\n renderNavbar() {\n const pb = this;\n if (pb.params.renderNavbar) return pb.params.renderNavbar.call(pb);\n const iconsColor = pb.params.iconsColor;\n const pageBackLinkText = pb.app.theme === 'ios' && pb.params.pageBackLinkText ? pb.params.pageBackLinkText : '';\n const renderNavbarCount = typeof pb.params.navbarShowCount === 'undefined' ? pb.params.photos.length > 1 : pb.params.navbarShowCount;\n const isPopup = pb.params.type !== 'page';\n return $jsx(\"div\", {\n class: `navbar navbar-photo-browser ${pb.params.theme === 'dark' ? 'navbar-photo-browser-dark' : ''}`\n }, $jsx(\"div\", {\n class: \"navbar-bg\"\n }), $jsx(\"div\", {\n class: \"navbar-inner navbar-inner-centered-title sliding\"\n }, !isPopup && $jsx(\"div\", {\n class: \"left\"\n }, $jsx(\"a\", {\n class: `link ${!pageBackLinkText ? 'icon-only' : ''} back`\n }, $jsx(\"i\", {\n class: `icon icon-back ${iconsColor ? `color-${iconsColor}` : ''}`\n }), pageBackLinkText && $jsx(\"span\", null, pageBackLinkText))), renderNavbarCount && $jsx(\"div\", {\n class: \"title\"\n }, $jsx(\"span\", {\n class: \"photo-browser-current\"\n }), $jsx(\"span\", {\n class: \"photo-browser-of\"\n }, pb.params.navbarOfText), $jsx(\"span\", {\n class: \"photo-browser-total\"\n })), isPopup && (pb.params.popupCloseLinkText || pb.params.popupCloseLinkIcon) && $jsx(\"div\", {\n class: \"right\"\n }, $jsx(\"a\", {\n class: \"link popup-close\",\n \"data-popup\": \".photo-browser-popup\"\n }, pb.params.popupCloseLinkIcon && pb.app.theme === 'ios' && $jsx(\"i\", null, $jsx(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"56\",\n height: \"56\",\n viewBox: \"0 0 56 56\"\n }, $jsx(\"path\", {\n fill: \"currentColor\",\n d: \"M 10.0234 43.0234 C 9.2266 43.8203 9.2031 45.1797 10.0234 45.9766 C 10.8438 46.7734 12.1797 46.7734 13.0000 45.9766 L 28.0000 30.9766 L 43.0000 45.9766 C 43.7969 46.7734 45.1563 46.7969 45.9766 45.9766 C 46.7734 45.1562 46.7734 43.8203 45.9766 43.0234 L 30.9531 28.0000 L 45.9766 13.0000 C 46.7734 12.2031 46.7969 10.8437 45.9766 10.0469 C 45.1328 9.2266 43.7969 9.2266 43.0000 10.0469 L 28.0000 25.0469 L 13.0000 10.0469 C 12.1797 9.2266 10.8203 9.2031 10.0234 10.0469 C 9.2266 10.8672 9.2266 12.2031 10.0234 13.0000 L 25.0234 28.0000 Z\"\n }))), pb.params.popupCloseLinkIcon && pb.app.theme === 'md' && $jsx(\"i\", null, $jsx(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n height: \"24px\",\n viewBox: \"0 0 24 24\",\n width: \"24px\",\n fill: \"currentColor\"\n }, $jsx(\"path\", {\n d: \"M0 0h24v24H0V0z\",\n fill: \"none\"\n }), $jsx(\"path\", {\n d: \"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"\n }))), pb.params.popupCloseLinkText && $jsx(\"span\", null, pb.params.popupCloseLinkText)))));\n }\n renderToolbar() {\n const pb = this;\n if (pb.params.renderToolbar) return pb.params.renderToolbar.call(pb);\n const iconsColor = pb.params.iconsColor;\n return $jsx(\"div\", {\n class: \"toolbar toolbar-bottom tabbar\"\n }, $jsx(\"div\", {\n class: \"toolbar-inner\"\n }, $jsx(\"a\", {\n class: \"link photo-browser-prev\"\n }, $jsx(\"i\", {\n class: `icon icon-back ${iconsColor ? `color-${iconsColor}` : ''}`\n })), $jsx(\"a\", {\n class: \"link photo-browser-next\"\n }, $jsx(\"i\", {\n class: `icon icon-forward ${iconsColor ? `color-${iconsColor}` : ''}`\n }))));\n }\n renderThumbs() {\n const pb = this;\n return $jsx(\"div\", {\n class: \"toolbar toolbar-bottom photo-browser-thumbs\"\n }, $jsx(\"div\", {\n class: \"swiper\"\n }, $jsx(\"div\", {\n class: \"swiper-wrapper\"\n }, pb.params.thumbs.map((thumb, index) => pb.renderThumb(thumb, index)))));\n }\n renderCaption(caption, index) {\n const pb = this;\n if (pb.params.renderCaption) return pb.params.renderCaption.call(pb, caption, index);\n return $jsx(\"div\", {\n class: \"photo-browser-caption\",\n \"data-caption-index\": index\n }, caption);\n }\n renderObject(photo, index) {\n const pb = this;\n if (pb.params.renderObject) return pb.params.renderObject.call(pb, photo, index);\n return $jsx(\"div\", {\n class: \"photo-browser-slide photo-browser-object-slide swiper-slide\",\n \"data-swiper-slide-index\": index\n }, photo.html ? photo.html : photo);\n }\n renderLazyPhoto(photo, index) {\n const pb = this;\n if (pb.params.renderLazyPhoto) return pb.params.renderLazyPhoto.call(pb, photo, index);\n return $jsx(\"div\", {\n class: \"photo-browser-slide photo-browser-slide-lazy swiper-slide\",\n \"data-swiper-slide-index\": index\n }, $jsx(\"div\", {\n class: \"swiper-lazy-preloader\"\n }), $jsx(\"span\", {\n class: \"swiper-zoom-container\"\n }, $jsx(\"img\", {\n loading: \"lazy\",\n src: photo.url ? photo.url : photo\n })));\n }\n renderPhoto(photo, index) {\n const pb = this;\n if (pb.params.renderPhoto) return pb.params.renderPhoto.call(pb, photo, index);\n return $jsx(\"div\", {\n class: \"photo-browser-slide swiper-slide\",\n \"data-swiper-slide-index\": index\n }, $jsx(\"span\", {\n class: \"swiper-zoom-container\"\n }, $jsx(\"img\", {\n src: photo.url ? photo.url : photo\n })));\n }\n renderThumb(thumb, index) {\n const pb = this;\n const url = typeof thumb === 'string' ? thumb : thumb.url;\n if (pb.params.renderThumb) return pb.params.renderThumb.call(pb, thumb, index);\n return $jsx(\"div\", {\n class: \"photo-browser-thumbs-slide swiper-slide\",\n \"data-swiper-slide-index\": index\n }, url && $jsx(\"img\", {\n src: url,\n loading: \"lazy\"\n }));\n }\n render() {\n const pb = this;\n if (pb.params.render) return pb.params.render.call(pb, pb.params);\n return $jsx(\"div\", {\n class: `photo-browser photo-browser-${pb.params.theme}`\n }, $jsx(\"div\", {\n class: \"view\"\n }, $jsx(\"div\", {\n class: `page photo-browser-page photo-browser-page-${pb.params.theme} no-toolbar ${!pb.params.navbar ? 'no-navbar' : ''}`,\n \"data-name\": \"photo-browser-page\"\n }, pb.params.navbar && pb.renderNavbar(), pb.params.toolbar && pb.renderToolbar(), pb.params.thumbs && pb.params.thumbs.length && pb.renderThumbs(), $jsx(\"div\", {\n class: `photo-browser-captions photo-browser-captions-${pb.params.captionsTheme || pb.params.theme}`\n }, pb.params.photos.map((photo, index) => {\n if (photo.caption) return pb.renderCaption(photo.caption, index);\n return '';\n })), $jsx(\"div\", {\n class: \"photo-browser-swiper-container swiper\"\n }, $jsx(\"div\", {\n class: \"photo-browser-swiper-wrapper swiper-wrapper\"\n }, !pb.params.virtualSlides && pb.params.photos.map((photo, index) => {\n if (photo.html || (typeof photo === 'string' || photo instanceof String) && photo.indexOf('<') >= 0 && photo.indexOf('>') >= 0) {\n return pb.renderObject(photo, index);\n }\n if (pb.params.lazy === true) {\n return pb.renderLazyPhoto(photo, index);\n }\n return pb.renderPhoto(photo, index);\n }))))));\n }\n renderStandalone() {\n const pb = this;\n if (pb.params.renderStandalone) return pb.params.renderStandalone.call(pb);\n const standaloneHtml = ``;\n return standaloneHtml;\n }\n renderPage() {\n const pb = this;\n if (pb.params.renderPage) return pb.params.renderPage.call(pb);\n const pageHtml = pb.render();\n return pageHtml;\n }\n renderPopup() {\n const pb = this;\n if (pb.params.renderPopup) return pb.params.renderPopup.call(pb);\n const popupHtml = ``;\n return popupHtml;\n }\n\n // Callbacks\n onOpen(type, el) {\n const pb = this;\n const app = pb.app;\n const $el = $(el);\n $el[0].f7PhotoBrowser = pb;\n pb.$el = $el;\n pb.el = $el[0];\n pb.openedIn = type;\n pb.opened = true;\n pb.$swiperContainerEl = pb.$el.find('.photo-browser-swiper-container');\n pb.$swiperWrapperEl = pb.$el.find('.photo-browser-swiper-wrapper');\n pb.slides = pb.$el.find('.photo-browser-slide');\n pb.$captionsContainerEl = pb.$el.find('.photo-browser-captions');\n pb.captions = pb.$el.find('.photo-browser-caption');\n const hasThumbs = pb.params.thumbs && pb.params.thumbs.length > 0;\n\n // Init Swiper\n let clickTimeout;\n let preventThumbsSlide;\n let preventMainSlide;\n const initialSlide = pb.activeIndex;\n const swiperParams = extend({}, pb.params.swiper, {\n initialSlide,\n // cssMode:\n // typeof pb.params.swiper.cssMode === 'undefined' && (app.device.ios || app.device.android)\n // ? true\n // : pb.params.swiper.cssMode,\n on: {\n click(e) {\n clearTimeout(clickTimeout);\n if (pb.params.exposition) {\n clickTimeout = setTimeout(() => {\n pb.expositionToggle();\n }, 350);\n }\n pb.emit('local::tap', e);\n pb.emit('local::click', e);\n },\n doubleClick(e) {\n clearTimeout(clickTimeout);\n pb.emit('local::doubleTap', e);\n pb.emit('local::doubleClick', e);\n },\n slideChange() {\n const swiper = this;\n if (hasThumbs && pb.thumbsSwiper && !preventMainSlide) {\n preventThumbsSlide = true;\n pb.thumbsSwiper.slideTo(pb.swiper.activeIndex);\n setTimeout(() => {\n preventThumbsSlide = false;\n });\n }\n pb.onSlideChange(swiper);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n pb.emit('local::slideChange', ...args);\n },\n transitionStart() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n pb.emit('local::transitionStart', ...args);\n },\n transitionEnd() {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n pb.emit('local::transitionEnd', ...args);\n },\n slideChangeTransitionStart() {\n const swiper = this;\n pb.onSlideChange(swiper);\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n pb.emit('local::slideChangeTransitionStart', ...args);\n },\n slideChangeTransitionEnd() {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n pb.emit('local::slideChangeTransitionEnd', ...args);\n }\n }\n });\n if (pb.params.swipeToClose && pb.params.type !== 'page') {\n extend(swiperParams.on, {\n touchStart(swiper, e) {\n pb.onTouchStart(e);\n pb.emit('local::touchStart', e);\n },\n touchMoveOpposite(swiper, e) {\n pb.onTouchMove(e);\n pb.emit('local::touchMoveOpposite', e);\n },\n touchEnd(swiper, e) {\n pb.onTouchEnd(e);\n pb.emit('local::touchEnd', e);\n }\n });\n }\n if (pb.params.virtualSlides) {\n extend(swiperParams, {\n virtual: {\n slides: pb.params.photos,\n renderSlide(photo, index) {\n if (photo.html || (typeof photo === 'string' || photo instanceof String) && photo.indexOf('<') >= 0 && photo.indexOf('>') >= 0) {\n return pb.renderObject(photo, index);\n }\n if (pb.params.lazy === true) {\n return pb.renderLazyPhoto(photo, index);\n }\n return pb.renderPhoto(photo, index);\n }\n }\n });\n }\n const window = getWindow();\n pb.swiper = app.swiper ? app.swiper.create(pb.$swiperContainerEl[0], swiperParams) : new window.Swiper(pb.$swiperContainerEl[0], swiperParams);\n if (pb.activeIndex === 0 || pb.params.virtualSlides) {\n pb.onSlideChange(pb.swiper);\n }\n if (hasThumbs) {\n const thumbsSwiperParams = {\n el: pb.$el.find('.photo-browser-thumbs .swiper')[0],\n slidesPerView: 'auto',\n centeredSlides: true,\n spaceBetween: 4,\n watchSlidesProgress: true,\n initialSlide,\n on: {\n touchMove() {\n preventMainSlide = true;\n },\n touchEnd() {\n preventMainSlide = false;\n },\n slideChange(s) {\n if (preventThumbsSlide) return;\n pb.swiper.slideTo(s.activeIndex, 0);\n },\n click(s) {\n if (!s.clickedSlide) return;\n const index = parseInt($(s.clickedSlide).attr('data-swiper-slide-index'), 10);\n s.slideTo(index, 0);\n }\n }\n };\n pb.thumbsSwiper = app.swiper ? app.swiper.create(thumbsSwiperParams) : new window.Swiper(thumbsSwiperParams);\n }\n if (pb.$el) {\n pb.$el.trigger('photobrowser:open');\n }\n pb.emit('local::open photoBrowserOpen', pb);\n }\n onOpened() {\n const pb = this;\n if (pb.$el && pb.params.type === 'standalone') {\n pb.$el.css('animation', 'none');\n }\n if (pb.$el) {\n pb.$el.trigger('photobrowser:opened');\n }\n pb.emit('local::opened photoBrowserOpened', pb);\n }\n onClose() {\n const pb = this;\n if (pb.destroyed) return;\n\n // Destroy Swiper\n if (pb.swiper && pb.swiper.destroy) {\n pb.swiper.destroy(true, false);\n pb.swiper = null;\n delete pb.swiper;\n }\n if (pb.thumbsSwiper && pb.thumbsSwiper.destroy) {\n pb.thumbsSwiper.destroy(true, false);\n pb.thumbsSwiper = null;\n delete pb.thumbsSwiper;\n }\n if (pb.$el) {\n pb.$el.trigger('photobrowser:close');\n }\n pb.emit('local::close photoBrowserClose', pb);\n }\n onClosed() {\n const pb = this;\n if (pb.destroyed) return;\n pb.opened = false;\n pb.$el = null;\n pb.el = null;\n delete pb.$el;\n delete pb.el;\n if (pb.$el) {\n pb.$el.trigger('photobrowser:closed');\n }\n pb.emit('local::closed photoBrowserClosed', pb);\n }\n\n // Open\n openPage() {\n const pb = this;\n if (pb.opened) return pb;\n const pageHtml = pb.renderPage();\n pb.view.router.navigate({\n url: pb.url,\n route: {\n content: pageHtml,\n path: pb.url,\n on: {\n pageBeforeIn(e, page) {\n pb.view.$el.addClass(`with-photo-browser-page with-photo-browser-page-${pb.params.theme}`);\n pb.onOpen('page', page.el);\n },\n pageAfterIn(e, page) {\n pb.onOpened('page', page.el);\n },\n pageBeforeOut(e, page) {\n pb.view.$el.removeClass(`with-photo-browser-page with-photo-browser-page-exposed with-photo-browser-page-${pb.params.theme}`);\n pb.onClose('page', page.el);\n },\n pageAfterOut(e, page) {\n pb.onClosed('page', page.el);\n }\n }\n }\n });\n return pb;\n }\n openStandalone() {\n const pb = this;\n if (pb.opened) return pb;\n const standaloneHtml = pb.renderStandalone();\n const popupParams = {\n backdrop: false,\n content: standaloneHtml,\n on: {\n popupOpen(popup) {\n pb.onOpen('popup', popup.el);\n },\n popupOpened(popup) {\n pb.onOpened('popup', popup.el);\n },\n popupClose(popup) {\n pb.onClose('popup', popup.el);\n },\n popupClosed(popup) {\n pb.onClosed('popup', popup.el);\n }\n }\n };\n if (pb.params.routableModals && pb.view) {\n pb.view.router.navigate({\n url: pb.url,\n route: {\n path: pb.url,\n popup: popupParams\n }\n });\n } else {\n pb.modal = pb.app.popup.create(popupParams).open();\n }\n return pb;\n }\n openPopup() {\n const pb = this;\n if (pb.opened) return pb;\n const popupHtml = pb.renderPopup();\n const popupParams = {\n content: popupHtml,\n push: pb.params.popupPush,\n closeByBackdropClick: pb.params.closeByBackdropClick,\n on: {\n popupOpen(popup) {\n pb.onOpen('popup', popup.el);\n },\n popupOpened(popup) {\n pb.onOpened('popup', popup.el);\n },\n popupClose(popup) {\n pb.onClose('popup', popup.el);\n },\n popupClosed(popup) {\n pb.onClosed('popup', popup.el);\n }\n }\n };\n if (pb.params.routableModals && pb.view) {\n pb.view.router.navigate({\n url: pb.url,\n route: {\n path: pb.url,\n popup: popupParams\n }\n });\n } else {\n pb.modal = pb.app.popup.create(popupParams).open();\n }\n return pb;\n }\n\n // Exposition\n expositionEnable() {\n const pb = this;\n if (pb.params.type === 'page') {\n pb.view.$el.addClass('with-photo-browser-page-exposed');\n }\n if (pb.$el) pb.$el.addClass('photo-browser-exposed');\n if (pb.params.expositionHideCaptions) pb.$captionsContainerEl.addClass('photo-browser-captions-exposed');\n pb.exposed = true;\n return pb;\n }\n expositionDisable() {\n const pb = this;\n if (pb.params.type === 'page') {\n pb.view.$el.removeClass('with-photo-browser-page-exposed');\n }\n if (pb.$el) pb.$el.removeClass('photo-browser-exposed');\n if (pb.params.expositionHideCaptions) pb.$captionsContainerEl.removeClass('photo-browser-captions-exposed');\n pb.exposed = false;\n return pb;\n }\n expositionToggle() {\n const pb = this;\n if (pb.params.type === 'page') {\n pb.view.$el.toggleClass('with-photo-browser-page-exposed');\n }\n if (pb.$el) pb.$el.toggleClass('photo-browser-exposed');\n if (pb.params.expositionHideCaptions) pb.$captionsContainerEl.toggleClass('photo-browser-captions-exposed');\n pb.exposed = !pb.exposed;\n return pb;\n }\n open(index) {\n const pb = this;\n const type = pb.params.type;\n if (pb.opened) {\n if (pb.swiper && typeof index !== 'undefined') {\n pb.swiper.slideTo(parseInt(index, 10));\n }\n return pb;\n }\n if (typeof index !== 'undefined') {\n pb.activeIndex = index;\n }\n if (type === 'standalone') {\n pb.openStandalone();\n }\n if (type === 'page') {\n pb.openPage();\n }\n if (type === 'popup') {\n pb.openPopup();\n }\n return pb;\n }\n close() {\n const pb = this;\n if (!pb.opened) return pb;\n if (pb.params.routableModals && pb.view || pb.openedIn === 'page') {\n pb.view.router.back();\n } else {\n pb.modal.once('modalClosed', () => {\n nextTick(() => {\n if (pb.destroyed) return;\n pb.modal.destroy();\n delete pb.modal;\n });\n });\n pb.modal.close();\n }\n return pb;\n }\n // eslint-disable-next-line\n init() {}\n destroy() {\n let pb = this;\n pb.emit('local::beforeDestroy photoBrowserBeforeDestroy', pb);\n if (pb.$el) {\n pb.$el.trigger('photobrowser:beforedestroy');\n pb.$el[0].f7PhotoBrowser = null;\n delete pb.$el[0].f7PhotoBrowser;\n }\n deleteProps(pb);\n pb.destroyed = true;\n pb = null;\n }\n}\nexport default PhotoBrowser;", "import PhotoBrowser from './photo-browser-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'photoBrowser',\n params: {\n photoBrowser: {\n photos: [],\n thumbs: [],\n exposition: true,\n expositionHideCaptions: false,\n type: 'standalone',\n navbar: true,\n toolbar: true,\n theme: 'light',\n captionsTheme: undefined,\n iconsColor: undefined,\n popupPush: false,\n swipeToClose: true,\n pageBackLinkText: 'Back',\n popupCloseLinkText: undefined,\n popupCloseLinkIcon: true,\n navbarOfText: 'of',\n navbarShowCount: undefined,\n view: undefined,\n url: 'photos/',\n routableModals: false,\n virtualSlides: true,\n lazy: true,\n closeByBackdropClick: true,\n renderNavbar: undefined,\n renderToolbar: undefined,\n renderCaption: undefined,\n renderObject: undefined,\n renderLazyPhoto: undefined,\n renderPhoto: undefined,\n renderThumb: undefined,\n renderPage: undefined,\n renderPopup: undefined,\n renderStandalone: undefined,\n swiper: {\n cssMode: false,\n initialSlide: 0,\n spaceBetween: 20,\n speed: 300,\n loop: false,\n keyboard: {\n enabled: true\n },\n navigation: {\n nextEl: '.photo-browser-next',\n prevEl: '.photo-browser-prev'\n },\n zoom: {\n enabled: true,\n maxRatio: 3,\n minRatio: 1\n }\n }\n }\n },\n create() {\n const app = this;\n app.photoBrowser = ConstructorMethods({\n defaultSelector: '.photo-browser-popup, .photo-browser-page',\n constructor: PhotoBrowser,\n app,\n domProp: 'f7PhotoBrowser'\n });\n },\n static: {\n PhotoBrowser\n }\n};", "import $ from '../../shared/dom7.js';\nimport { extend, now, nextTick } from '../../shared/utils.js';\nimport Modal from '../modal/modal-class.js';\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass Notification extends Modal {\n constructor(app, params) {\n const extendedParams = extend({\n on: {}\n }, app.params.notification, params);\n\n // Extends with open/close Modal methods;\n super(app, extendedParams);\n const notification = this;\n notification.app = app;\n notification.params = extendedParams;\n const {\n icon,\n title,\n titleRightText,\n subtitle,\n text,\n closeButton,\n closeTimeout,\n cssClass,\n closeOnClick\n } = notification.params;\n let $el;\n if (!notification.params.el) {\n // Find Element\n const notificationHtml = notification.render({\n icon,\n title,\n titleRightText,\n subtitle,\n text,\n closeButton,\n cssClass\n });\n $el = $(notificationHtml);\n } else {\n $el = $(notification.params.el);\n }\n if ($el && $el.length > 0 && $el[0].f7Modal) {\n return $el[0].f7Modal;\n }\n if ($el.length === 0) {\n return notification.destroy();\n }\n extend(notification, {\n $el,\n el: $el[0],\n type: 'notification'\n });\n $el[0].f7Modal = notification;\n if (closeButton) {\n $el.find('.notification-close-button').on('click', () => {\n notification.close();\n });\n }\n $el.on('click', e => {\n if (closeButton && $(e.target).closest('.notification-close-button').length) {\n return;\n }\n notification.emit('local::click notificationClick', notification);\n if (closeOnClick) notification.close();\n });\n notification.on('beforeDestroy', () => {\n $el.off('click');\n });\n\n /* Touch Events */\n let isTouched;\n let isMoved;\n let isScrolling;\n let touchesDiff;\n let touchStartTime;\n let notificationHeight;\n const touchesStart = {};\n function handleTouchStart(e) {\n if (isTouched) return;\n isTouched = true;\n isMoved = false;\n isScrolling = undefined;\n touchStartTime = now();\n touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n }\n function handleTouchMove(e) {\n if (!isTouched) return;\n const pageX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n const pageY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n if (typeof isScrolling === 'undefined') {\n isScrolling = !!(isScrolling || Math.abs(pageY - touchesStart.y) < Math.abs(pageX - touchesStart.x));\n }\n if (isScrolling) {\n isTouched = false;\n return;\n }\n e.preventDefault();\n if (!isMoved) {\n notification.$el.removeClass('notification-transitioning');\n notification.$el.transition(0);\n notificationHeight = notification.$el[0].offsetHeight / 2;\n }\n isMoved = true;\n touchesDiff = pageY - touchesStart.y;\n let newTranslate = touchesDiff;\n if (touchesDiff > 0) {\n newTranslate = touchesDiff ** 0.8;\n }\n notification.$el.transform(`translate3d(0, ${newTranslate}px, 0)`);\n }\n function handleTouchEnd() {\n if (!isTouched || !isMoved) {\n isTouched = false;\n isMoved = false;\n return;\n }\n isTouched = false;\n isMoved = false;\n if (touchesDiff === 0) {\n return;\n }\n const timeDiff = now() - touchStartTime;\n notification.$el.transition('');\n notification.$el.addClass('notification-transitioning');\n notification.$el.transform('');\n if (touchesDiff < -10 && timeDiff < 300 || -touchesDiff >= notificationHeight / 1) {\n notification.close();\n }\n }\n function attachTouchEvents() {\n notification.$el.on(app.touchEvents.start, handleTouchStart, {\n passive: true\n });\n app.on('touchmove:active', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n }\n function detachTouchEvents() {\n notification.$el.off(app.touchEvents.start, handleTouchStart, {\n passive: true\n });\n app.off('touchmove:active', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n }\n let timeoutId;\n function closeOnTimeout() {\n timeoutId = nextTick(() => {\n if (isTouched && isMoved) {\n closeOnTimeout();\n return;\n }\n notification.close();\n }, closeTimeout);\n }\n notification.on('open', () => {\n if (notification.params.swipeToClose) {\n attachTouchEvents();\n }\n $('.notification.modal-in').each(openedEl => {\n const notificationInstance = app.notification.get(openedEl);\n if (openedEl !== notification.el && notificationInstance) {\n notificationInstance.close();\n }\n });\n if (closeTimeout) {\n closeOnTimeout();\n }\n });\n notification.on('close beforeDestroy', () => {\n if (notification.params.swipeToClose) {\n detachTouchEvents();\n }\n clearTimeout(timeoutId);\n });\n return notification;\n }\n render() {\n const notification = this;\n if (notification.params.render) return notification.params.render.call(notification, notification);\n const {\n icon,\n title,\n titleRightText,\n subtitle,\n text,\n closeButton,\n cssClass\n } = notification.params;\n return $jsx(\"div\", {\n class: `notification ${icon ? 'notification-with-icon' : ''} ${cssClass || ''}`\n }, $jsx(\"div\", {\n class: \"notification-header\"\n }, icon && $jsx(\"div\", {\n class: \"notification-icon\"\n }, icon), title && $jsx(\"div\", {\n class: \"notification-title\"\n }, title), titleRightText && $jsx(\"div\", {\n class: \"notification-title-right-text\"\n }, titleRightText), closeButton && $jsx(\"span\", {\n class: \"notification-close-button\"\n })), $jsx(\"div\", {\n class: \"notification-content\"\n }, subtitle && $jsx(\"div\", {\n class: \"notification-subtitle\"\n }, subtitle), text && $jsx(\"div\", {\n class: \"notification-text\"\n }, text)));\n }\n}\nexport default Notification;", "import { extend } from '../../shared/utils.js';\nimport Notification from './notification-class.js';\nimport ModalMethods from '../../shared/modal-methods.js';\nexport default {\n name: 'notification',\n static: {\n Notification\n },\n create() {\n const app = this;\n app.notification = extend({}, ModalMethods({\n app,\n constructor: Notification,\n defaultSelector: '.notification.modal-in'\n }));\n },\n params: {\n notification: {\n icon: null,\n title: null,\n titleRightText: null,\n subtitle: null,\n text: null,\n closeButton: false,\n closeTimeout: null,\n closeOnClick: false,\n swipeToClose: true,\n cssClass: null,\n render: null,\n containerEl: null\n }\n }\n};", "/* eslint \"no-useless-escape\": \"off\" */\nimport $ from '../../shared/dom7.js';\nimport { extend, id, nextTick, deleteProps, iosPreloaderContent, mdPreloaderContent } from '../../shared/utils.js';\nimport { getDevice } from '../../shared/get-device.js';\nimport Framework7Class from '../../shared/class.js';\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass Autocomplete extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const ac = this;\n ac.app = app;\n const device = getDevice();\n const defaults = extend({\n on: {}\n }, app.params.autocomplete);\n\n // Extend defaults with modules params\n ac.useModulesParams(defaults);\n ac.params = extend(defaults, params);\n let $openerEl;\n if (ac.params.openerEl) {\n $openerEl = $(ac.params.openerEl);\n if ($openerEl.length) $openerEl[0].f7Autocomplete = ac;\n }\n let $inputEl;\n if (ac.params.inputEl) {\n $inputEl = $(ac.params.inputEl);\n if ($inputEl.length) $inputEl[0].f7Autocomplete = ac;\n }\n const uniqueId = id();\n let url = params.url;\n if (!url && $openerEl && $openerEl.length) {\n if ($openerEl.attr('href')) url = $openerEl.attr('href');else if ($openerEl.find('a').length > 0) {\n url = $openerEl.find('a').attr('href');\n }\n }\n if (!url || url === '#' || url === '') url = ac.params.url;\n const inputType = ac.params.multiple ? 'checkbox' : 'radio';\n extend(ac, {\n $openerEl,\n openerEl: $openerEl && $openerEl[0],\n $inputEl,\n inputEl: $inputEl && $inputEl[0],\n id: uniqueId,\n url,\n value: ac.params.value || [],\n inputType,\n inputName: `${inputType}-${uniqueId}`,\n $modalEl: undefined,\n $dropdownEl: undefined\n });\n let previousQuery = '';\n function onInputChange() {\n let query = ac.$inputEl.val().trim();\n if (!ac.params.source) return;\n ac.params.source.call(ac, query, items => {\n let itemsHTML = '';\n const limit = ac.params.limit ? Math.min(ac.params.limit, items.length) : items.length;\n ac.items = items;\n let regExp;\n if (ac.params.highlightMatches) {\n query = query.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, '\\\\$&');\n regExp = new RegExp(`(${query})`, 'i');\n }\n let firstValue;\n let firstItem;\n for (let i = 0; i < limit; i += 1) {\n const itemValue = typeof items[i] === 'object' ? items[i][ac.params.valueProperty] : items[i];\n const itemText = typeof items[i] === 'object' ? items[i][ac.params.textProperty] : items[i];\n if (i === 0) {\n firstValue = itemValue;\n firstItem = ac.items[i];\n }\n itemsHTML += ac.renderItem({\n value: itemValue,\n text: ac.params.highlightMatches ? itemText.replace(regExp, '$1') : itemText\n }, i);\n }\n if (itemsHTML === '' && query === '' && ac.params.dropdownPlaceholderText) {\n itemsHTML += ac.renderItem({\n placeholder: true,\n text: ac.params.dropdownPlaceholderText\n });\n }\n ac.$dropdownEl.find('ul').html(itemsHTML);\n if (ac.params.typeahead) {\n if (!firstValue || !firstItem) {\n return;\n }\n if (firstValue.toLowerCase().indexOf(query.toLowerCase()) !== 0) {\n return;\n }\n if (previousQuery.toLowerCase() === query.toLowerCase()) {\n ac.value = [];\n return;\n }\n if (previousQuery.toLowerCase().indexOf(query.toLowerCase()) === 0) {\n previousQuery = query;\n ac.value = [];\n return;\n }\n $inputEl.val(firstValue);\n $inputEl[0].setSelectionRange(query.length, firstValue.length);\n const previousValue = typeof ac.value[0] === 'object' ? ac.value[0][ac.params.valueProperty] : ac.value[0];\n if (!previousValue || firstValue.toLowerCase() !== previousValue.toLowerCase()) {\n ac.value = [firstItem];\n ac.emit('local::change autocompleteChange', [firstItem]);\n }\n }\n previousQuery = query;\n });\n }\n function onPageInputChange() {\n const inputEl = this;\n const value = inputEl.value;\n const isValues = $(inputEl).parents('.autocomplete-values').length > 0;\n let item;\n let itemValue;\n let aValue;\n if (isValues) {\n if (ac.inputType === 'checkbox' && !inputEl.checked) {\n for (let i = 0; i < ac.value.length; i += 1) {\n aValue = typeof ac.value[i] === 'string' ? ac.value[i] : ac.value[i][ac.params.valueProperty];\n if (aValue === value || aValue * 1 === value * 1) {\n ac.value.splice(i, 1);\n }\n }\n ac.updateValues();\n ac.emit('local::change autocompleteChange', ac.value);\n }\n return;\n }\n\n // Find Related Item\n for (let i = 0; i < ac.items.length; i += 1) {\n itemValue = typeof ac.items[i] === 'object' ? ac.items[i][ac.params.valueProperty] : ac.items[i];\n if (itemValue === value || itemValue * 1 === value * 1) item = ac.items[i];\n }\n if (ac.inputType === 'radio') {\n ac.value = [item];\n } else if (inputEl.checked) {\n ac.value.push(item);\n } else {\n for (let i = 0; i < ac.value.length; i += 1) {\n aValue = typeof ac.value[i] === 'object' ? ac.value[i][ac.params.valueProperty] : ac.value[i];\n if (aValue === value || aValue * 1 === value * 1) {\n ac.value.splice(i, 1);\n }\n }\n }\n\n // Update Values Block\n ac.updateValues();\n\n // On Select Callback\n if (ac.inputType === 'radio' && inputEl.checked || ac.inputType === 'checkbox') {\n ac.emit('local::change autocompleteChange', ac.value);\n }\n }\n function onHtmlClick(e) {\n const $targetEl = $(e.target);\n if ($targetEl.is(ac.$inputEl[0]) || ac.$dropdownEl && $targetEl.closest(ac.$dropdownEl[0]).length) return;\n ac.close();\n }\n function onOpenerClick() {\n ac.open();\n }\n function onInputFocus() {\n ac.open();\n }\n function onInputBlur() {\n if (ac.$dropdownEl.find('label.active-state').length > 0) return;\n setTimeout(() => {\n ac.close();\n }, 0);\n }\n function onResize() {\n ac.positionDropdown();\n }\n function onKeyDown(e) {\n if (!ac.opened) return;\n if (e.keyCode === 27) {\n // ESC\n e.preventDefault();\n ac.$inputEl.blur();\n return;\n }\n if (e.keyCode === 13) {\n // Enter\n const $selectedItemLabel = ac.$dropdownEl.find('.autocomplete-dropdown-selected label');\n if ($selectedItemLabel.length) {\n e.preventDefault();\n $selectedItemLabel.trigger('click');\n ac.$inputEl.blur();\n return;\n }\n if (ac.params.typeahead) {\n e.preventDefault();\n ac.$inputEl.blur();\n }\n return;\n }\n if (e.keyCode !== 40 && e.keyCode !== 38) return;\n e.preventDefault();\n const $selectedItem = ac.$dropdownEl.find('.autocomplete-dropdown-selected');\n let $newItem;\n if ($selectedItem.length) {\n $newItem = $selectedItem[e.keyCode === 40 ? 'next' : 'prev']('li');\n if (!$newItem.length) {\n $newItem = ac.$dropdownEl.find('li').eq(e.keyCode === 40 ? 0 : ac.$dropdownEl.find('li').length - 1);\n }\n } else {\n $newItem = ac.$dropdownEl.find('li').eq(e.keyCode === 40 ? 0 : ac.$dropdownEl.find('li').length - 1);\n }\n if ($newItem.hasClass('autocomplete-dropdown-placeholder')) return;\n $selectedItem.removeClass('autocomplete-dropdown-selected');\n $newItem.addClass('autocomplete-dropdown-selected');\n }\n function onDropdownClick() {\n const $clickedEl = $(this);\n let clickedItem;\n for (let i = 0; i < ac.items.length; i += 1) {\n const itemValue = typeof ac.items[i] === 'object' ? ac.items[i][ac.params.valueProperty] : ac.items[i];\n const value = $clickedEl.attr('data-value');\n if (itemValue === value || itemValue * 1 === value * 1) {\n clickedItem = ac.items[i];\n }\n }\n if (ac.params.updateInputValueOnSelect) {\n ac.$inputEl.val(typeof clickedItem === 'object' ? clickedItem[ac.params.valueProperty] : clickedItem);\n ac.$inputEl.trigger('input change');\n }\n ac.value = [clickedItem];\n ac.emit('local::change autocompleteChange', [clickedItem]);\n ac.close();\n }\n ac.attachEvents = function attachEvents() {\n if (ac.params.openIn !== 'dropdown' && ac.$openerEl) {\n ac.$openerEl.on('click', onOpenerClick);\n }\n if (ac.params.openIn === 'dropdown' && ac.$inputEl) {\n ac.$inputEl.on('focus', onInputFocus);\n ac.$inputEl.on(ac.params.inputEvents, onInputChange);\n if (device.android) {\n $('html').on('click', onHtmlClick);\n } else {\n ac.$inputEl.on('blur', onInputBlur);\n }\n ac.$inputEl.on('keydown', onKeyDown);\n }\n };\n ac.detachEvents = function attachEvents() {\n if (ac.params.openIn !== 'dropdown' && ac.$openerEl) {\n ac.$openerEl.off('click', onOpenerClick);\n }\n if (ac.params.openIn === 'dropdown' && ac.$inputEl) {\n ac.$inputEl.off('focus', onInputFocus);\n ac.$inputEl.off(ac.params.inputEvents, onInputChange);\n if (device.android) {\n $('html').off('click', onHtmlClick);\n } else {\n ac.$inputEl.off('blur', onInputBlur);\n }\n ac.$inputEl.off('keydown', onKeyDown);\n }\n };\n ac.attachDropdownEvents = function attachDropdownEvents() {\n ac.$dropdownEl.on('click', 'label', onDropdownClick);\n app.on('resize', onResize);\n };\n ac.detachDropdownEvents = function detachDropdownEvents() {\n ac.$dropdownEl.off('click', 'label', onDropdownClick);\n app.off('resize', onResize);\n };\n ac.attachPageEvents = function attachPageEvents() {\n ac.$el.on('change', 'input[type=\"radio\"], input[type=\"checkbox\"]', onPageInputChange);\n if (ac.params.closeOnSelect && !ac.params.multiple) {\n ac.$el.once('click', '.list label', () => {\n nextTick(() => {\n ac.close();\n });\n });\n }\n };\n ac.detachPageEvents = function detachPageEvents() {\n ac.$el.off('change', 'input[type=\"radio\"], input[type=\"checkbox\"]', onPageInputChange);\n };\n\n // Install Modules\n ac.useModules();\n\n // Init\n ac.init();\n return ac;\n }\n get view() {\n const ac = this;\n const {\n $openerEl,\n $inputEl,\n app\n } = ac;\n let view;\n if (ac.params.view) {\n view = ac.params.view;\n } else if ($openerEl || $inputEl) {\n const $el = $openerEl || $inputEl;\n view = $el.closest('.view').length && $el.closest('.view')[0].f7View;\n }\n if (!view) view = app.views.main;\n return view;\n }\n positionDropdown() {\n const ac = this;\n const {\n $inputEl,\n app,\n $dropdownEl\n } = ac;\n const $pageContentEl = $inputEl.parents('.page-content');\n if ($pageContentEl.length === 0) return;\n const inputOffset = $inputEl.offset();\n const inputOffsetWidth = $inputEl[0].offsetWidth;\n const inputOffsetHeight = $inputEl[0].offsetHeight;\n const $listEl = $inputEl.parents('.list');\n let $listParent;\n $listEl.parents().each(parentEl => {\n if ($listParent) return;\n const $parentEl = $(parentEl);\n if ($parentEl.parent($pageContentEl).length) $listParent = $parentEl;\n });\n const listOffset = $listEl.offset();\n const paddingBottom = parseInt($pageContentEl.css('padding-bottom'), 10);\n const listOffsetLeft = $listEl.length > 0 ? listOffset.left - $pageContentEl.offset().left : 0;\n const inputOffsetLeft = inputOffset.left - ($listEl.length > 0 ? listOffset.left : 0) - (app.rtl ? 0 : 0);\n const inputOffsetTop = inputOffset.top - ($pageContentEl.offset().top - $pageContentEl[0].scrollTop);\n const maxHeight = $pageContentEl[0].scrollHeight - paddingBottom - (inputOffsetTop + $pageContentEl[0].scrollTop) - $inputEl[0].offsetHeight;\n const paddingProp = app.rtl ? 'padding-right' : 'padding-left';\n let paddingValue;\n if ($listEl.length) {\n paddingValue = (app.rtl ? $listEl[0].offsetWidth - inputOffsetLeft - inputOffsetWidth : inputOffsetLeft) - (app.theme === 'md' ? 16 : 15);\n }\n $dropdownEl.css({\n left: `${$listEl.length > 0 ? listOffsetLeft : inputOffsetLeft}px`,\n top: `${inputOffsetTop + $pageContentEl[0].scrollTop + inputOffsetHeight}px`,\n width: `${$listEl.length > 0 ? $listEl[0].offsetWidth : inputOffsetWidth}px`\n });\n $dropdownEl.children('.autocomplete-dropdown-inner').css({\n maxHeight: `${maxHeight}px`,\n [paddingProp]: $listEl.length > 0 ? `${paddingValue}px` : ''\n });\n }\n focus() {\n const ac = this;\n ac.$el.find('input[type=search]').focus();\n }\n source(query) {\n const ac = this;\n if (!ac.params.source) return;\n const {\n $el\n } = ac;\n ac.params.source.call(ac, query, items => {\n let itemsHTML = '';\n const limit = ac.params.limit ? Math.min(ac.params.limit, items.length) : items.length;\n ac.items = items;\n for (let i = 0; i < limit; i += 1) {\n let selected = false;\n const itemValue = typeof items[i] === 'object' ? items[i][ac.params.valueProperty] : items[i];\n for (let j = 0; j < ac.value.length; j += 1) {\n const aValue = typeof ac.value[j] === 'object' ? ac.value[j][ac.params.valueProperty] : ac.value[j];\n if (aValue === itemValue || aValue * 1 === itemValue * 1) selected = true;\n }\n itemsHTML += ac.renderItem({\n value: itemValue,\n text: typeof items[i] === 'object' ? items[i][ac.params.textProperty] : items[i],\n inputType: ac.inputType,\n id: ac.id,\n inputName: ac.inputName,\n selected\n }, i);\n }\n $el.find('.autocomplete-found ul').html(itemsHTML);\n if (items.length === 0) {\n if (query.length !== 0) {\n $el.find('.autocomplete-not-found').show();\n $el.find('.autocomplete-found, .autocomplete-values').hide();\n } else {\n $el.find('.autocomplete-values').show();\n $el.find('.autocomplete-found, .autocomplete-not-found').hide();\n }\n } else {\n $el.find('.autocomplete-found').show();\n $el.find('.autocomplete-not-found, .autocomplete-values').hide();\n }\n });\n }\n updateValues() {\n const ac = this;\n let valuesHTML = '';\n for (let i = 0; i < ac.value.length; i += 1) {\n valuesHTML += ac.renderItem({\n value: typeof ac.value[i] === 'object' ? ac.value[i][ac.params.valueProperty] : ac.value[i],\n text: typeof ac.value[i] === 'object' ? ac.value[i][ac.params.textProperty] : ac.value[i],\n inputType: ac.inputType,\n id: ac.id,\n inputName: `${ac.inputName}-checked}`,\n selected: true\n }, i);\n }\n ac.$el.find('.autocomplete-values ul').html(valuesHTML);\n }\n preloaderHide() {\n const ac = this;\n if (ac.params.openIn === 'dropdown' && ac.$dropdownEl) {\n ac.$dropdownEl.find('.autocomplete-preloader').removeClass('autocomplete-preloader-visible');\n } else {\n $('.autocomplete-preloader').removeClass('autocomplete-preloader-visible');\n }\n }\n preloaderShow() {\n const ac = this;\n if (ac.params.openIn === 'dropdown' && ac.$dropdownEl) {\n ac.$dropdownEl.find('.autocomplete-preloader').addClass('autocomplete-preloader-visible');\n } else {\n $('.autocomplete-preloader').addClass('autocomplete-preloader-visible');\n }\n }\n renderPreloader() {\n const ac = this;\n const preloaders = {\n iosPreloaderContent,\n mdPreloaderContent\n };\n return $jsx(\"div\", {\n class: `autocomplete-preloader preloader ${ac.params.preloaderColor ? `color-${ac.params.preloaderColor}` : ''}`\n }, preloaders[`${ac.app.theme}PreloaderContent`] || '');\n }\n renderSearchbar() {\n const ac = this;\n if (ac.params.renderSearchbar) return ac.params.renderSearchbar.call(ac);\n return $jsx(\"form\", {\n class: \"searchbar\"\n }, $jsx(\"div\", {\n class: \"searchbar-inner\"\n }, $jsx(\"div\", {\n class: \"searchbar-input-wrap\"\n }, $jsx(\"input\", {\n type: \"search\",\n spellcheck: ac.params.searchbarSpellcheck || 'false',\n placeholder: ac.params.searchbarPlaceholder\n }), $jsx(\"i\", {\n class: \"searchbar-icon\"\n }), $jsx(\"span\", {\n class: \"input-clear-button\"\n })), ac.params.searchbarDisableButton && $jsx(\"span\", {\n class: \"searchbar-disable-button\"\n }, ac.params.searchbarDisableText)));\n }\n renderItem(item, index) {\n const ac = this;\n if (ac.params.renderItem) return ac.params.renderItem.call(ac, item, index);\n const itemValue = item.value && typeof item.value === 'string' ? item.value.replace(/\"/g, '"') : item.value;\n if (ac.params.openIn !== 'dropdown') {\n return $jsx(\"li\", null, $jsx(\"label\", {\n class: `item-${item.inputType} item-content`\n }, $jsx(\"input\", {\n type: item.inputType,\n name: item.inputName,\n value: itemValue,\n _checked: item.selected\n }), $jsx(\"i\", {\n class: `icon icon-${item.inputType}`\n }), $jsx(\"div\", {\n class: \"item-inner\"\n }, $jsx(\"div\", {\n class: \"item-title\"\n }, item.text))));\n }\n // Dropdown\n if (!item.placeholder) {\n return $jsx(\"li\", null, $jsx(\"label\", {\n class: \"item-radio item-content\",\n \"data-value\": itemValue\n }, $jsx(\"div\", {\n class: \"item-inner\"\n }, $jsx(\"div\", {\n class: \"item-title\"\n }, item.text))));\n }\n\n // Dropwdown placeholder\n return $jsx(\"li\", {\n class: \"autocomplete-dropdown-placeholder\"\n }, $jsx(\"label\", {\n class: \"item-content\"\n }, $jsx(\"div\", {\n class: \"item-inner\"\n }, $jsx(\"div\", {\n class: \"item-title\"\n }, item.text))));\n }\n renderNavbar() {\n const ac = this;\n if (ac.params.renderNavbar) return ac.params.renderNavbar.call(ac);\n let pageTitle = ac.params.pageTitle;\n if (typeof pageTitle === 'undefined' && ac.$openerEl && ac.$openerEl.length) {\n pageTitle = ac.$openerEl.find('.item-title').text().trim();\n }\n const inPopup = ac.params.openIn === 'popup';\n\n // eslint-disable-next-line\n const navbarLeft = inPopup ? ac.params.preloader && $jsx(\"div\", {\n class: \"left\"\n }, ac.renderPreloader()) : $jsx(\"div\", {\n class: \"left sliding\"\n }, $jsx(\"a\", {\n class: \"link back\"\n }, $jsx(\"i\", {\n class: \"icon icon-back\"\n }), $jsx(\"span\", {\n class: \"if-not-md\"\n }, ac.params.pageBackLinkText)));\n const navbarRight = inPopup ? $jsx(\"div\", {\n class: \"right\"\n }, $jsx(\"a\", {\n class: \"link popup-close\",\n \"data-popup\": \".autocomplete-popup\"\n }, ac.params.popupCloseLinkText)) : ac.params.preloader && $jsx(\"div\", {\n class: \"right\"\n }, ac.renderPreloader());\n return $jsx(\"div\", {\n class: `navbar ${ac.params.navbarColorTheme ? `color-${ac.params.navbarColorTheme}` : ''}`\n }, $jsx(\"div\", {\n class: \"navbar-bg\"\n }), $jsx(\"div\", {\n class: `navbar-inner ${ac.params.navbarColorTheme ? `color-${ac.params.navbarColorTheme}` : ''}`\n }, navbarLeft, pageTitle && $jsx(\"div\", {\n class: \"title sliding\"\n }, pageTitle), navbarRight, $jsx(\"div\", {\n class: \"subnavbar sliding\"\n }, ac.renderSearchbar())));\n }\n renderDropdown() {\n const ac = this;\n if (ac.params.renderDropdown) return ac.params.renderDropdown.call(ac, ac.items);\n return $jsx(\"div\", {\n class: \"autocomplete-dropdown\"\n }, $jsx(\"div\", {\n class: \"autocomplete-dropdown-inner\"\n }, $jsx(\"div\", {\n class: `list no-safe-areas`\n }, $jsx(\"ul\", null))), ac.params.preloader && ac.renderPreloader());\n }\n renderPage(inPopup) {\n const ac = this;\n if (ac.params.renderPage) return ac.params.renderPage.call(ac, ac.items);\n return $jsx(\"div\", {\n class: \"page page-with-subnavbar autocomplete-page\",\n \"data-name\": \"autocomplete-page\"\n }, ac.renderNavbar(inPopup), $jsx(\"div\", {\n class: \"searchbar-backdrop\"\n }), $jsx(\"div\", {\n class: \"page-content\"\n }, $jsx(\"div\", {\n class: `list autocomplete-list autocomplete-found autocomplete-list-${ac.id} ${ac.params.formColorTheme ? `color-${ac.params.formColorTheme}` : ''}`\n }, $jsx(\"ul\", null)), $jsx(\"div\", {\n class: \"list autocomplete-not-found\"\n }, $jsx(\"ul\", null, $jsx(\"li\", {\n class: \"item-content\"\n }, $jsx(\"div\", {\n class: \"item-inner\"\n }, $jsx(\"div\", {\n class: \"item-title\"\n }, ac.params.notFoundText))))), $jsx(\"div\", {\n class: \"list autocomplete-values\"\n }, $jsx(\"ul\", null))));\n }\n renderPopup() {\n const ac = this;\n if (ac.params.renderPopup) return ac.params.renderPopup.call(ac, ac.items);\n return $jsx(\"div\", {\n class: \"popup autocomplete-popup\"\n }, $jsx(\"div\", {\n class: \"view\"\n }, ac.renderPage(true), \";\"));\n }\n onOpen(type, el) {\n const ac = this;\n const app = ac.app;\n const $el = $(el);\n ac.$el = $el;\n ac.el = $el[0];\n ac.openedIn = type;\n ac.opened = true;\n if (ac.params.openIn === 'dropdown') {\n ac.attachDropdownEvents();\n ac.$dropdownEl.addClass('autocomplete-dropdown-in');\n ac.$inputEl.trigger('input');\n } else {\n // Init SB\n let $searchbarEl = $el.find('.searchbar');\n if (ac.params.openIn === 'page' && app.theme === 'ios' && $searchbarEl.length === 0) {\n $searchbarEl = $(app.navbar.getElByPage($el)).find('.searchbar');\n }\n ac.searchbar = app.searchbar.create({\n el: $searchbarEl,\n backdropEl: $el.find('.searchbar-backdrop'),\n customSearch: true,\n on: {\n search(sb, query) {\n if (query.length === 0 && ac.searchbar.enabled) {\n ac.searchbar.backdropShow();\n } else {\n ac.searchbar.backdropHide();\n }\n ac.source(query);\n }\n }\n });\n\n // Attach page events\n ac.attachPageEvents();\n\n // Update Values On Page Init\n ac.updateValues();\n\n // Source on load\n if (ac.params.requestSourceOnOpen) ac.source('');\n }\n ac.emit('local::open autocompleteOpen', ac);\n }\n autoFocus() {\n const ac = this;\n if (ac.searchbar && ac.searchbar.$inputEl) {\n ac.searchbar.$inputEl.focus();\n }\n return ac;\n }\n onOpened() {\n const ac = this;\n if (ac.params.openIn !== 'dropdown' && ac.params.autoFocus) {\n ac.autoFocus();\n }\n ac.emit('local::opened autocompleteOpened', ac);\n }\n onClose() {\n const ac = this;\n if (ac.destroyed) return;\n\n // Destroy SB\n if (ac.searchbar && ac.searchbar.destroy) {\n ac.searchbar.destroy();\n ac.searchbar = null;\n delete ac.searchbar;\n }\n if (ac.params.openIn === 'dropdown') {\n ac.detachDropdownEvents();\n ac.$dropdownEl.removeClass('autocomplete-dropdown-in').remove();\n } else {\n ac.detachPageEvents();\n }\n ac.emit('local::close autocompleteClose', ac);\n }\n onClosed() {\n const ac = this;\n if (ac.destroyed) return;\n ac.opened = false;\n ac.$el = null;\n ac.el = null;\n delete ac.$el;\n delete ac.el;\n ac.emit('local::closed autocompleteClosed', ac);\n }\n openPage() {\n const ac = this;\n if (ac.opened) return ac;\n const pageHtml = ac.renderPage();\n ac.view.router.navigate({\n url: ac.url,\n route: {\n content: pageHtml,\n path: ac.url,\n on: {\n pageBeforeIn(e, page) {\n ac.onOpen('page', page.el);\n },\n pageAfterIn(e, page) {\n ac.onOpened('page', page.el);\n },\n pageBeforeOut(e, page) {\n ac.onClose('page', page.el);\n },\n pageAfterOut(e, page) {\n ac.onClosed('page', page.el);\n }\n },\n options: {\n animate: ac.params.animate\n }\n }\n });\n return ac;\n }\n openPopup() {\n const ac = this;\n if (ac.opened) return ac;\n const popupHtml = ac.renderPopup();\n const popupParams = {\n content: popupHtml,\n animate: ac.params.animate,\n push: ac.params.popupPush,\n swipeToClose: ac.params.popupSwipeToClose,\n on: {\n popupOpen(popup) {\n ac.onOpen('popup', popup.el);\n },\n popupOpened(popup) {\n ac.onOpened('popup', popup.el);\n },\n popupClose(popup) {\n ac.onClose('popup', popup.el);\n },\n popupClosed(popup) {\n ac.onClosed('popup', popup.el);\n }\n }\n };\n if (ac.params.routableModals && ac.view) {\n ac.view.router.navigate({\n url: ac.url,\n route: {\n path: ac.url,\n popup: popupParams\n }\n });\n } else {\n ac.modal = ac.app.popup.create(popupParams).open(ac.params.animate);\n }\n return ac;\n }\n openDropdown() {\n const ac = this;\n if (!ac.$dropdownEl) {\n ac.$dropdownEl = $(ac.renderDropdown());\n }\n const $pageContentEl = ac.$inputEl.parents('.page-content');\n if (ac.params.dropdownContainerEl) {\n $(ac.params.dropdownContainerEl).append(ac.$dropdownEl);\n } else if ($pageContentEl.length === 0) {\n ac.$dropdownEl.insertAfter(ac.$inputEl);\n } else {\n ac.positionDropdown();\n $pageContentEl.append(ac.$dropdownEl);\n }\n ac.onOpen('dropdown', ac.$dropdownEl);\n ac.onOpened('dropdown', ac.$dropdownEl);\n }\n open() {\n const ac = this;\n if (ac.opened) return ac;\n const openIn = ac.params.openIn;\n ac[`open${openIn.split('').map((el, index) => {\n if (index === 0) return el.toUpperCase();\n return el;\n }).join('')}`]();\n return ac;\n }\n close() {\n const ac = this;\n if (!ac.opened) return ac;\n if (ac.params.openIn === 'dropdown') {\n ac.onClose();\n ac.onClosed();\n } else if (ac.params.routableModals && ac.view || ac.openedIn === 'page') {\n ac.view.router.back({\n animate: ac.params.animate\n });\n } else {\n ac.modal.once('modalClosed', () => {\n nextTick(() => {\n if (ac.destroyed) return;\n ac.modal.destroy();\n delete ac.modal;\n });\n });\n ac.modal.close();\n }\n return ac;\n }\n init() {\n const ac = this;\n ac.attachEvents();\n }\n destroy() {\n const ac = this;\n ac.emit('local::beforeDestroy autocompleteBeforeDestroy', ac);\n ac.detachEvents();\n if (ac.$inputEl && ac.$inputEl[0]) {\n delete ac.$inputEl[0].f7Autocomplete;\n }\n if (ac.$openerEl && ac.$openerEl[0]) {\n delete ac.$openerEl[0].f7Autocomplete;\n }\n deleteProps(ac);\n ac.destroyed = true;\n }\n}\nexport default Autocomplete;", "import { extend } from '../../shared/utils.js';\nimport Autocomplete from './autocomplete-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'autocomplete',\n params: {\n autocomplete: {\n openerEl: undefined,\n inputEl: undefined,\n view: undefined,\n // DropDown\n dropdownContainerEl: undefined,\n dropdownPlaceholderText: undefined,\n typeahead: false,\n highlightMatches: true,\n updateInputValueOnSelect: true,\n inputEvents: 'input',\n value: undefined,\n multiple: false,\n source: undefined,\n limit: undefined,\n valueProperty: 'id',\n textProperty: 'text',\n openIn: 'page',\n // or 'popup' or 'dropdown'\n pageBackLinkText: 'Back',\n popupCloseLinkText: 'Close',\n pageTitle: undefined,\n searchbarPlaceholder: 'Search...',\n searchbarDisableText: 'Cancel',\n searchbarDisableButton: true,\n searchbarSpellcheck: false,\n popupPush: false,\n popupSwipeToClose: undefined,\n animate: true,\n autoFocus: false,\n closeOnSelect: false,\n notFoundText: 'Nothing found',\n requestSourceOnOpen: false,\n // Preloader\n preloaderColor: undefined,\n preloader: false,\n // Colors\n formColorTheme: undefined,\n navbarColorTheme: undefined,\n // Routing\n routableModals: false,\n url: 'select/',\n // Custom render functions\n renderDropdown: undefined,\n renderPage: undefined,\n renderPopup: undefined,\n renderItem: undefined,\n renderSearchbar: undefined,\n renderNavbar: undefined\n }\n },\n static: {\n Autocomplete\n },\n create() {\n const app = this;\n app.autocomplete = extend(ConstructorMethods({\n defaultSelector: undefined,\n constructor: Autocomplete,\n app,\n domProp: 'f7Autocomplete'\n }), {\n open(autocompleteEl) {\n const ac = app.autocomplete.get(autocompleteEl);\n if (ac && ac.open) return ac.open();\n return undefined;\n },\n close(autocompleteEl) {\n const ac = app.autocomplete.get(autocompleteEl);\n if (ac && ac.close) return ac.close();\n return undefined;\n }\n });\n }\n};", "import { getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport { getSupport } from '../../shared/get-support.js';\nimport Framework7Class from '../../shared/class.js';\nclass Tooltip extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const tooltip = this;\n const support = getSupport();\n const defaults = extend({}, app.params.tooltip);\n const document = getDocument();\n\n // Extend defaults with modules params\n tooltip.useModulesParams(defaults);\n tooltip.params = extend(defaults, params);\n if (typeof params.offset === 'undefined' && support.touch && tooltip.params.trigger === 'hover') {\n tooltip.params.offset = 10;\n }\n const {\n targetEl,\n containerEl\n } = tooltip.params;\n if (!targetEl && !tooltip.params.delegated) return tooltip;\n const $targetEl = $(targetEl);\n if ($targetEl.length === 0 && !tooltip.params.delegated) return tooltip;\n if ($targetEl[0] && $targetEl[0].f7Tooltip && !tooltip.params.delegated) return $targetEl[0].f7Tooltip;\n let $containerEl = $(containerEl || app.$el).eq(0);\n if ($containerEl.length === 0) {\n $containerEl = app.$el;\n }\n const $el = $(tooltip.render()).eq(0);\n extend(tooltip, {\n app,\n $targetEl,\n targetEl: $targetEl && $targetEl[0],\n $containerEl,\n containerEl: $containerEl && $containerEl[0],\n $el,\n el: $el && $el[0],\n text: tooltip.params.text || '',\n visible: false,\n opened: false\n });\n if ($targetEl[0]) $targetEl[0].f7Tooltip = tooltip;\n const touchesStart = {};\n let isTouched;\n function handleClick() {\n if (tooltip.opened) tooltip.hide();else tooltip.show(this);\n }\n function handleClickOut(e) {\n if (tooltip.opened && ($(e.target).closest($targetEl).length || $(e.target).closest(tooltip.$el).length)) return;\n tooltip.hide();\n }\n function handleTouchStart(e) {\n if (isTouched) return;\n isTouched = true;\n touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n tooltip.show(this);\n }\n function handleTouchMove(e) {\n if (!isTouched) return;\n const x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n const y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n const distance = ((x - touchesStart.x) ** 2 + (y - touchesStart.y) ** 2) ** 0.5;\n if (distance > 50) {\n isTouched = false;\n tooltip.hide();\n }\n }\n function handleTouchEnd() {\n if (!isTouched) return;\n isTouched = false;\n tooltip.hide();\n }\n function handleMouseEnter() {\n tooltip.show(this);\n }\n function handleMouseLeave() {\n tooltip.hide();\n }\n function handleTransitionEnd() {\n if (!$el.hasClass('tooltip-in')) {\n $el.removeClass('tooltip-out').remove();\n }\n }\n tooltip.attachEvents = function attachEvents() {\n $el.on('transitionend', handleTransitionEnd);\n if (tooltip.params.trigger === 'click') {\n if (tooltip.params.delegated) {\n $(document).on('click', tooltip.params.targetEl, handleClick);\n } else {\n tooltip.$targetEl.on('click', handleClick);\n }\n $('html').on('click', handleClickOut);\n return;\n }\n if (tooltip.params.trigger === 'manual') return;\n if (support.touch) {\n const passive = support.passiveListener ? {\n passive: true\n } : false;\n if (tooltip.params.delegated) {\n $(document).on(app.touchEvents.start, tooltip.params.targetEl, handleTouchStart, passive);\n } else {\n tooltip.$targetEl.on(app.touchEvents.start, handleTouchStart, passive);\n }\n app.on('touchmove', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n } else {\n // eslint-disable-next-line\n if (tooltip.params.delegated) {\n $(document).on(support.pointerEvents ? 'pointerenter' : 'mouseenter', tooltip.params.targetEl, handleMouseEnter, true);\n $(document).on(support.pointerEvents ? 'pointerleave' : 'mouseleave', tooltip.params.targetEl, handleMouseLeave, true);\n } else {\n tooltip.$targetEl.on(support.pointerEvents ? 'pointerenter' : 'mouseenter', handleMouseEnter);\n tooltip.$targetEl.on(support.pointerEvents ? 'pointerleave' : 'mouseleave', handleMouseLeave);\n }\n }\n };\n tooltip.detachEvents = function detachEvents() {\n $el.off('transitionend', handleTransitionEnd);\n if (tooltip.params.trigger === 'click') {\n if (tooltip.params.delegated) {\n $(document).on('click', tooltip.params.targetEl, handleClick);\n } else {\n tooltip.$targetEl.off('click', handleClick);\n }\n $('html').off('click', handleClickOut);\n return;\n }\n if (tooltip.params.trigger === 'manual') return;\n if (support.touch) {\n const passive = support.passiveListener ? {\n passive: true\n } : false;\n if (tooltip.params.delegated) {\n $(document).off(app.touchEvents.start, tooltip.params.targetEl, handleTouchStart, passive);\n } else {\n tooltip.$targetEl.off(app.touchEvents.start, handleTouchStart, passive);\n }\n app.off('touchmove', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n } else {\n // eslint-disable-next-line\n if (tooltip.params.delegated) {\n $(document).off(support.pointerEvents ? 'pointerenter' : 'mouseenter', tooltip.params.targetEl, handleMouseEnter, true);\n $(document).off(support.pointerEvents ? 'pointerleave' : 'mouseleave', tooltip.params.targetEl, handleMouseLeave, true);\n } else {\n tooltip.$targetEl.off(support.pointerEvents ? 'pointerenter' : 'mouseenter', handleMouseEnter);\n tooltip.$targetEl.off(support.pointerEvents ? 'pointerleave' : 'mouseleave', handleMouseLeave);\n }\n }\n };\n\n // Install Modules\n tooltip.useModules();\n tooltip.init();\n return tooltip;\n }\n setTargetEl(targetEl) {\n const tooltip = this;\n tooltip.detachEvents();\n tooltip.$targetEl = $(targetEl);\n tooltip.targetEl = tooltip.$targetEl[0];\n tooltip.attachEvents();\n return tooltip;\n }\n position(targetEl) {\n const tooltip = this;\n const {\n $el,\n app,\n $containerEl\n } = tooltip;\n const hasContainerEl = !!tooltip.params.containerEl;\n const tooltipOffset = tooltip.params.offset || 0;\n $el.css({\n left: '',\n top: ''\n });\n const $targetEl = $(targetEl || tooltip.targetEl);\n const [width, height] = [$el.width(), $el.height()];\n $el.css({\n left: '',\n top: ''\n });\n let targetWidth;\n let targetHeight;\n let targetOffsetLeft;\n let targetOffsetTop;\n const boundaries = hasContainerEl && $containerEl.length ? $containerEl[0].getBoundingClientRect() : app;\n if ($targetEl && $targetEl.length > 0) {\n targetWidth = $targetEl.outerWidth();\n targetHeight = $targetEl.outerHeight();\n if (typeof targetWidth === 'undefined' && typeof targetHeight === 'undefined') {\n const clientRect = $targetEl[0].getBoundingClientRect();\n targetWidth = clientRect.width;\n targetHeight = clientRect.height;\n }\n const targetOffset = $targetEl.offset();\n targetOffsetLeft = targetOffset.left - boundaries.left;\n targetOffsetTop = targetOffset.top - boundaries.top;\n const targetParentPage = $targetEl.parents('.page');\n if (targetParentPage.length > 0) {\n targetOffsetTop -= targetParentPage[0].scrollTop;\n }\n }\n let [left, top] = [0, 0, 0];\n\n // Top Position\n let position = 'top';\n if (height + tooltipOffset < targetOffsetTop) {\n // On top\n top = targetOffsetTop - height - tooltipOffset;\n } else if (height < boundaries.height - targetOffsetTop - targetHeight) {\n // On bottom\n position = 'bottom';\n top = targetOffsetTop + targetHeight + tooltipOffset;\n } else {\n // On middle\n position = 'middle';\n top = targetHeight / 2 + targetOffsetTop - height / 2;\n if (top <= 0) {\n top = 8;\n } else if (top + height >= boundaries.height) {\n top = boundaries.height - height - 8;\n }\n }\n\n // Horizontal Position\n if (position === 'top' || position === 'bottom') {\n left = targetWidth / 2 + targetOffsetLeft - width / 2;\n if (left < 8) left = 8;\n if (left + width > boundaries.width) left = boundaries.width - width - 8;\n if (left < 0) left = 0;\n } else if (position === 'middle') {\n left = targetOffsetLeft - width;\n if (left < 8 || left + width > boundaries.width) {\n if (left < 8) left = targetOffsetLeft + targetWidth;\n if (left + width > boundaries.width) left = boundaries.width - width - 8;\n }\n }\n\n // Apply Styles\n $el.css({\n top: `${top}px`,\n left: `${left}px`\n });\n }\n show(aroundEl) {\n const tooltip = this;\n const {\n $el,\n $targetEl,\n $containerEl\n } = tooltip;\n if ($containerEl[0] && $el[0] && !$containerEl[0].contains($el[0])) {\n $containerEl.append($el);\n }\n tooltip.position(aroundEl);\n const $aroundEl = $(aroundEl);\n tooltip.visible = true;\n tooltip.opened = true;\n $targetEl.trigger('tooltip:show');\n $el.trigger('tooltip:show');\n if ($aroundEl.length && $aroundEl[0] !== $targetEl[0]) {\n $aroundEl.trigger('tooltip:show');\n }\n tooltip.emit('local::show tooltipShow', tooltip);\n $el.removeClass('tooltip-out').addClass('tooltip-in');\n return tooltip;\n }\n hide() {\n const tooltip = this;\n const {\n $el,\n $targetEl\n } = tooltip;\n tooltip.visible = false;\n tooltip.opened = false;\n $targetEl.trigger('tooltip:hide');\n $el.trigger('tooltip:hide');\n tooltip.emit('local::hide tooltipHide', tooltip);\n $el.addClass('tooltip-out').removeClass('tooltip-in');\n return tooltip;\n }\n render() {\n const tooltip = this;\n if (tooltip.params.render) return tooltip.params.render.call(tooltip, tooltip);\n const {\n cssClass,\n text\n } = tooltip.params;\n return `\n \n `.trim();\n }\n setText(newText) {\n const tooltip = this;\n if (typeof newText === 'undefined') {\n return tooltip;\n }\n tooltip.params.text = newText;\n tooltip.text = newText;\n if (tooltip.$el) {\n tooltip.$el.children('.tooltip-content').html(newText);\n }\n if (tooltip.opened) {\n tooltip.position();\n }\n return tooltip;\n }\n init() {\n const tooltip = this;\n tooltip.attachEvents();\n }\n destroy() {\n const tooltip = this;\n if (!tooltip.$targetEl || tooltip.destroyed) return;\n tooltip.$targetEl.trigger('tooltip:beforedestroy');\n tooltip.emit('local::beforeDestroy tooltipBeforeDestroy', tooltip);\n tooltip.$el.remove();\n if (tooltip.$targetEl[0]) delete tooltip.$targetEl[0].f7Tooltip;\n tooltip.detachEvents();\n deleteProps(tooltip);\n tooltip.destroyed = true;\n }\n}\nexport default Tooltip;", "import $ from '../../shared/dom7.js';\nimport Tooltip from './tooltip-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'tooltip',\n static: {\n Tooltip\n },\n create() {\n const app = this;\n app.tooltip = ConstructorMethods({\n defaultSelector: '.tooltip',\n constructor: Tooltip,\n app,\n domProp: 'f7Tooltip'\n });\n app.tooltip.show = function show(el) {\n const $el = $(el);\n if ($el.length === 0) return undefined;\n const tooltip = $el[0].f7Tooltip;\n if (!tooltip) return undefined;\n tooltip.show($el[0]);\n return tooltip;\n };\n app.tooltip.hide = function hide(el) {\n const $el = $(el);\n if ($el.length === 0) return undefined;\n const tooltip = $el[0].f7Tooltip;\n if (!tooltip) return undefined;\n tooltip.hide();\n return tooltip;\n };\n app.tooltip.setText = function text(el, newText) {\n const $el = $(el);\n if ($el.length === 0) return undefined;\n const tooltip = $el[0].f7Tooltip;\n if (!tooltip) return undefined;\n tooltip.setText(newText);\n return tooltip;\n };\n },\n params: {\n tooltip: {\n targetEl: null,\n delegated: false,\n text: null,\n cssClass: null,\n render: null,\n offset: 0,\n trigger: 'hover',\n containerEl: undefined\n }\n },\n on: {\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.tooltip-init').each(el => {\n const text = $(el).attr('data-tooltip');\n if (!text) return;\n app.tooltip.create({\n targetEl: el,\n text\n });\n });\n },\n tabBeforeRemove(tabEl) {\n $(tabEl).find('.tooltip-init').each(el => {\n if (el.f7Tooltip) el.f7Tooltip.destroy();\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.tooltip-init').each(el => {\n const text = $(el).attr('data-tooltip');\n if (!text) return;\n app.tooltip.create({\n targetEl: el,\n text\n });\n });\n if (app.theme === 'ios' && page.view && page.view.router.dynamicNavbar && page.$navbarEl && page.$navbarEl.length > 0) {\n page.$navbarEl.find('.tooltip-init').each(el => {\n const text = $(el).attr('data-tooltip');\n if (!text) return;\n app.tooltip.create({\n targetEl: el,\n text\n });\n });\n }\n },\n pageBeforeRemove(page) {\n const app = this;\n page.$el.find('.tooltip-init').each(el => {\n if (el.f7Tooltip) el.f7Tooltip.destroy();\n });\n if (app.theme === 'ios' && page.view && page.view.router.dynamicNavbar && page.$navbarEl && page.$navbarEl.length > 0) {\n page.$navbarEl.find('.tooltip-init').each(el => {\n if (el.f7Tooltip) el.f7Tooltip.destroy();\n });\n }\n }\n },\n vnode: {\n 'tooltip-init': {\n insert(vnode) {\n const app = this;\n const el = vnode.elm;\n const text = $(el).attr('data-tooltip');\n if (!text) return;\n app.tooltip.create({\n targetEl: el,\n text\n });\n },\n update(vnode) {\n const el = vnode.elm;\n if (!el.f7Tooltip) return;\n if (vnode && vnode.data && vnode.data.attrs && vnode.data.attrs['data-tooltip']) {\n el.f7Tooltip.setText(vnode.data.attrs['data-tooltip']);\n }\n },\n destroy(vnode) {\n const el = vnode.elm;\n if (el.f7Tooltip) el.f7Tooltip.destroy();\n }\n }\n }\n};", "/* eslint no-nested-ternary: off */\nimport { getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass Gauge extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const self = this;\n const defaults = extend({}, app.params.gauge);\n\n // Extend defaults with modules params\n self.useModulesParams(defaults);\n self.params = extend(defaults, params);\n const {\n el\n } = self.params;\n if (!el) return self;\n const $el = $(el);\n if ($el.length === 0) return self;\n if ($el[0].f7Gauge) return $el[0].f7Gauge;\n extend(self, {\n app,\n $el,\n el: $el && $el[0]\n });\n $el[0].f7Gauge = self;\n\n // Install Modules\n self.useModules();\n self.init();\n return self;\n }\n calcRadius() {\n const self = this;\n const {\n size,\n borderWidth\n } = self.params;\n return size / 2 - borderWidth / 2;\n }\n calcBorderLength() {\n const self = this;\n const radius = self.calcRadius();\n return 2 * Math.PI * radius;\n }\n render() {\n const self = this;\n if (self.params.render) return self.params.render.call(self, self);\n const {\n type,\n value,\n size,\n bgColor,\n borderBgColor,\n borderColor,\n borderWidth,\n valueText,\n valueTextColor,\n valueFontSize,\n valueFontWeight,\n labelText,\n labelTextColor,\n labelFontSize,\n labelFontWeight\n } = self.params;\n const semiCircle = type === 'semicircle';\n const radius = self.calcRadius();\n const length = self.calcBorderLength();\n const progress = Math.max(Math.min(value, 1), 0);\n return $jsx(\"svg\", {\n class: \"gauge-svg\",\n width: `${size}px`,\n height: `${semiCircle ? size / 2 : size}px`,\n viewBox: `0 0 ${size} ${semiCircle ? size / 2 : size}`\n }, semiCircle && $jsx(\"path\", {\n class: \"gauge-back-semi\",\n d: `M${size - borderWidth / 2},${size / 2} a1,1 0 0,0 -${size - borderWidth},0`,\n stroke: borderBgColor,\n \"stroke-width\": borderWidth,\n fill: bgColor || 'none'\n }), semiCircle && $jsx(\"path\", {\n class: \"gauge-front-semi\",\n d: `M${size - borderWidth / 2},${size / 2} a1,1 0 0,0 -${size - borderWidth},0`,\n stroke: borderColor,\n \"stroke-width\": borderWidth,\n \"stroke-dasharray\": length / 2,\n \"stroke-dashoffset\": length / 2 * (1 + progress),\n fill: borderBgColor ? 'none' : bgColor || 'none'\n }), !semiCircle && borderBgColor && $jsx(\"circle\", {\n class: \"gauge-back-circle\",\n stroke: borderBgColor,\n \"stroke-width\": borderWidth,\n fill: bgColor || 'none',\n cx: size / 2,\n cy: size / 2,\n r: radius\n }), !semiCircle && $jsx(\"circle\", {\n class: \"gauge-front-circle\",\n transform: `rotate(-90 ${size / 2} ${size / 2})`,\n stroke: borderColor,\n \"stroke-width\": borderWidth,\n \"stroke-dasharray\": length,\n \"stroke-dashoffset\": length * (1 - progress),\n fill: borderBgColor ? 'none' : bgColor || 'none',\n cx: size / 2,\n cy: size / 2,\n r: radius\n }), valueText && $jsx(\"text\", {\n class: \"gauge-value-text\",\n x: \"50%\",\n y: semiCircle ? '100%' : '50%',\n \"font-weight\": valueFontWeight,\n \"font-size\": valueFontSize,\n fill: valueTextColor,\n dy: semiCircle ? labelText ? -labelFontSize - 15 : -5 : 0,\n \"text-anchor\": \"middle\",\n \"dominant-baseline\": !semiCircle && 'middle'\n }, valueText), labelText && $jsx(\"text\", {\n class: \"gauge-label-text\",\n x: \"50%\",\n y: semiCircle ? '100%' : '50%',\n \"font-weight\": labelFontWeight,\n \"font-size\": labelFontSize,\n fill: labelTextColor,\n dy: semiCircle ? -5 : valueText ? valueFontSize / 2 + 10 : 0,\n \"text-anchor\": \"middle\",\n \"dominant-baseline\": !semiCircle && 'middle'\n }, labelText));\n }\n update(newParams) {\n if (newParams === void 0) {\n newParams = {};\n }\n const self = this;\n const document = getDocument();\n const {\n params,\n $svgEl\n } = self;\n Object.keys(newParams).forEach(param => {\n if (typeof newParams[param] !== 'undefined') {\n params[param] = newParams[param];\n }\n });\n if ($svgEl.length === 0) return self;\n const {\n value,\n size,\n bgColor,\n borderBgColor,\n borderColor,\n borderWidth,\n valueText,\n valueTextColor,\n valueFontSize,\n valueFontWeight,\n labelText,\n labelTextColor,\n labelFontSize,\n labelFontWeight\n } = params;\n const length = self.calcBorderLength();\n const progress = Math.max(Math.min(value, 1), 0);\n const radius = self.calcRadius();\n const semiCircle = params.type === 'semicircle';\n const svgAttrs = {\n width: `${size}px`,\n height: `${semiCircle ? size / 2 : size}px`,\n viewBox: `0 0 ${size} ${semiCircle ? size / 2 : size}`\n };\n Object.keys(svgAttrs).forEach(attr => {\n $svgEl.attr(attr, svgAttrs[attr]);\n });\n if (semiCircle) {\n const backAttrs = {\n d: `M${size - borderWidth / 2},${size / 2} a1,1 0 0,0 -${size - borderWidth},0`,\n stroke: borderBgColor,\n 'stroke-width': borderWidth,\n fill: bgColor || 'none'\n };\n const frontAttrs = {\n d: `M${size - borderWidth / 2},${size / 2} a1,1 0 0,0 -${size - borderWidth},0`,\n stroke: borderColor,\n 'stroke-width': borderWidth,\n 'stroke-dasharray': length / 2,\n 'stroke-dashoffset': length / 2 * (1 + progress),\n fill: borderBgColor ? 'none' : bgColor || 'none'\n };\n Object.keys(backAttrs).forEach(attr => {\n $svgEl.find('.gauge-back-semi').attr(attr, backAttrs[attr]);\n });\n Object.keys(frontAttrs).forEach(attr => {\n $svgEl.find('.gauge-front-semi').attr(attr, frontAttrs[attr]);\n });\n } else {\n const backAttrs = {\n stroke: borderBgColor,\n 'stroke-width': borderWidth,\n fill: bgColor || 'none',\n cx: size / 2,\n cy: size / 2,\n r: radius\n };\n const frontAttrs = {\n transform: `rotate(-90 ${size / 2} ${size / 2})`,\n stroke: borderColor,\n 'stroke-width': borderWidth,\n 'stroke-dasharray': length,\n 'stroke-dashoffset': length * (1 - progress),\n fill: borderBgColor ? 'none' : bgColor || 'none',\n cx: size / 2,\n cy: size / 2,\n r: radius\n };\n Object.keys(backAttrs).forEach(attr => {\n $svgEl.find('.gauge-back-circle').attr(attr, backAttrs[attr]);\n });\n Object.keys(frontAttrs).forEach(attr => {\n $svgEl.find('.gauge-front-circle').attr(attr, frontAttrs[attr]);\n });\n }\n if (valueText) {\n if (!$svgEl.find('.gauge-value-text').length) {\n const textEl = document.createElementNS('http://www.w3.org/2000/svg', 'text');\n textEl.classList.add('gauge-value-text');\n $svgEl.append(textEl);\n }\n const textAttrs = {\n x: '50%',\n y: semiCircle ? '100%' : '50%',\n 'font-weight': valueFontWeight,\n 'font-size': valueFontSize,\n fill: valueTextColor,\n dy: semiCircle ? labelText ? -labelFontSize - 15 : -5 : 0,\n 'text-anchor': 'middle',\n 'dominant-baseline': !semiCircle && 'middle'\n };\n Object.keys(textAttrs).forEach(attr => {\n $svgEl.find('.gauge-value-text').attr(attr, textAttrs[attr]);\n });\n $svgEl.find('.gauge-value-text').text(valueText);\n } else {\n $svgEl.find('.gauge-value-text').remove();\n }\n if (labelText) {\n if (!$svgEl.find('.gauge-label-text').length) {\n const textEl = document.createElementNS('http://www.w3.org/2000/svg', 'text');\n textEl.classList.add('gauge-label-text');\n $svgEl.append(textEl);\n }\n const labelAttrs = {\n x: '50%',\n y: semiCircle ? '100%' : '50%',\n 'font-weight': labelFontWeight,\n 'font-size': labelFontSize,\n fill: labelTextColor,\n dy: semiCircle ? -5 : valueText ? valueFontSize / 2 + 10 : 0,\n 'text-anchor': 'middle',\n 'dominant-baseline': !semiCircle && 'middle'\n };\n Object.keys(labelAttrs).forEach(attr => {\n $svgEl.find('.gauge-label-text').attr(attr, labelAttrs[attr]);\n });\n $svgEl.find('.gauge-label-text').text(labelText);\n } else {\n $svgEl.find('.gauge-label-text').remove();\n }\n return self;\n }\n init() {\n const self = this;\n const $svgEl = $(self.render()).eq(0);\n $svgEl.f7Gauge = self;\n extend(self, {\n $svgEl,\n svgEl: $svgEl && $svgEl[0]\n });\n self.$el.append($svgEl);\n return self;\n }\n destroy() {\n const self = this;\n if (!self.$el || self.destroyed) return;\n self.$el.trigger('gauge:beforedestroy');\n self.emit('local::beforeDestroy gaugeBeforeDestroy', self);\n self.$svgEl.remove();\n delete self.$el[0].f7Gauge;\n deleteProps(self);\n self.destroyed = true;\n }\n}\nexport default Gauge;", "import $ from '../../shared/dom7.js';\nimport Gauge from './gauge-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nimport { extend } from '../../shared/utils.js';\nexport default {\n name: 'gauge',\n static: {\n Gauge\n },\n create() {\n const app = this;\n app.gauge = ConstructorMethods({\n defaultSelector: '.gauge',\n constructor: Gauge,\n app,\n domProp: 'f7Gauge'\n });\n app.gauge.update = function update(el, newParams) {\n const $el = $(el);\n if ($el.length === 0) return undefined;\n const gauge = app.gauge.get(el);\n if (!gauge) return undefined;\n gauge.update(newParams);\n return gauge;\n };\n },\n params: {\n gauge: {\n el: null,\n type: 'circle',\n value: 0,\n size: 200,\n bgColor: 'transparent',\n borderBgColor: '#eeeeee',\n borderColor: '#000000',\n borderWidth: 10,\n valueText: null,\n valueTextColor: '#000000',\n valueFontSize: 31,\n valueFontWeight: 500,\n labelText: null,\n labelTextColor: '#888888',\n labelFontSize: 14,\n labelFontWeight: 400\n }\n },\n on: {\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.gauge-init').each(el => {\n app.gauge.create(extend({\n el\n }, $(el).dataset() || {}));\n });\n },\n tabBeforeRemove(tabEl) {\n $(tabEl).find('.gauge-init').each(el => {\n if (el.f7Gauge) el.f7Gauge.destroy();\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.gauge-init').each(el => {\n app.gauge.create(extend({\n el\n }, $(el).dataset() || {}));\n });\n },\n pageBeforeRemove(page) {\n page.$el.find('.gauge-init').each(el => {\n if (el.f7Gauge) el.f7Gauge.destroy();\n });\n }\n },\n vnode: {\n 'gauge-init': {\n insert(vnode) {\n const app = this;\n const el = vnode.elm;\n app.gauge.create(extend({\n el\n }, $(el).dataset() || {}));\n },\n destroy(vnode) {\n const el = vnode.elm;\n if (el.f7Gauge) el.f7Gauge.destroy();\n }\n }\n }\n};", "export default {\n name: 'skeleton'\n};", "/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render(self) {\n const {\n sliderLabel,\n sliderValue,\n sliderValueEditable,\n alphaLabelText\n } = self.params;\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-alpha-slider\"\n }, $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, alphaLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-alpha\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"0.01\",\n min: \"0\",\n max: \"1\",\n class: \"color-picker-value-alpha\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-alpha\"\n }))));\n },\n init(self) {\n self.alphaRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-alpha'),\n min: 0,\n max: 1,\n step: 0.01,\n value: 1,\n on: {\n change(range, value) {\n const alpha = Math.floor(value * 100) / 100;\n self.setValue({\n alpha\n });\n }\n }\n });\n function handleInputChange(e) {\n const alpha = self.value.alpha;\n let value = parseFloat(e.target.value);\n if (Number.isNaN(value)) {\n e.target.value = alpha;\n return;\n }\n value = Math.max(0, Math.min(1, value));\n self.setValue({\n alpha: value\n });\n }\n self.$el.on('change', '.color-picker-module-alpha-slider input', handleInputChange);\n self.destroyAlphaSliderEvents = function destroyAlphaSliderEvents() {\n self.$el.off('change', '.color-picker-module-alpha-slider input', handleInputChange);\n };\n },\n update(self) {\n const {\n value\n } = self;\n const {\n sliderValue,\n sliderValueEditable\n } = self.params;\n const {\n alpha\n } = value;\n self.alphaRangeSlider.value = alpha;\n self.alphaRangeSlider.layout();\n if (sliderValue && sliderValueEditable) {\n self.$el.find('input.color-picker-value-alpha').val(alpha);\n } else {\n self.$el.find('span.color-picker-value-alpha').text(alpha);\n }\n },\n destroy(self) {\n if (self.alphaRangeSlider && self.alphaRangeSlider.destroy) {\n self.alphaRangeSlider.destroy();\n }\n delete self.alphaRangeSlider;\n if (self.destroyAlphaSliderEvents) self.destroyAlphaSliderEvents();\n delete self.destroyAlphaSliderEvents;\n }\n};", "/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render() {\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-current-color\"\n }, $jsx(\"div\", {\n class: \"color-picker-current-color\"\n }));\n },\n update(self) {\n self.$el.find('.color-picker-module-current-color .color-picker-current-color').css('background-color', self.value.hex);\n }\n};", "/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render(self) {\n const {\n hexLabel,\n hexLabelText,\n hexValueEditable\n } = self.params;\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-hex\"\n }, $jsx(\"div\", {\n class: \"color-picker-hex-wrap\"\n }, hexLabel && $jsx(\"div\", {\n class: \"color-picker-hex-label\"\n }, hexLabelText), $jsx(\"div\", {\n class: \"color-picker-hex-value\"\n }, hexValueEditable ? $jsx(\"input\", {\n type: \"text\",\n class: \"color-picker-value-hex\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-hex\"\n }))));\n },\n init(self) {\n function handleInputChange(e) {\n const hex = self.value.hex;\n let value = e.target.value.replace(/#/g, '');\n if (Number.isNaN(value) || !value || value.length !== 3 && value.length !== 6) {\n e.target.value = hex;\n return;\n }\n const min = 0;\n const current = parseInt(value, 16);\n const max = parseInt('ffffff', 16); // eslint-disable-line\n if (current > max) {\n value = 'fff';\n }\n if (current < min) {\n value = '000';\n }\n self.setValue({\n hex: value\n });\n }\n self.$el.on('change', '.color-picker-module-hex input', handleInputChange);\n self.destroyHexEvents = function destroyHexEvents() {\n self.$el.off('change', '.color-picker-module-hex input', handleInputChange);\n };\n },\n update(self) {\n const {\n value\n } = self;\n const {\n hexValueEditable\n } = self.params;\n const {\n hex\n } = value;\n if (hexValueEditable) {\n self.$el.find('input.color-picker-value-hex').val(hex);\n } else {\n self.$el.find('span.color-picker-value-hex').text(hex);\n }\n },\n destroy(self) {\n if (self.destroyHexEvents) self.destroyHexEvents();\n delete self.destroyHexEvents;\n }\n};", "import $ from '../../../shared/dom7.js';\nimport { colorHsbToHsl } from '../../../shared/utils.js';\n/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render(self) {\n const {\n sliderLabel,\n sliderValue,\n sliderValueEditable,\n hueLabelText,\n saturationLabelText,\n brightnessLabelText\n } = self.params;\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-hsb-sliders\"\n }, $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, hueLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-hue\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"0.1\",\n min: \"0\",\n max: \"360\",\n class: \"color-picker-value-hue\",\n \"data-color-index\": \"0\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-hue\"\n }))), $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, saturationLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-saturation\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"0.1\",\n min: \"0\",\n max: \"100\",\n class: \"color-picker-value-saturation\",\n \"data-color-index\": \"1\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-saturation\"\n }))), $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, brightnessLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-brightness\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"0.1\",\n min: \"0\",\n max: \"100\",\n class: \"color-picker-value-brightness\",\n \"data-color-index\": \"2\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-brightness\"\n }))));\n },\n init(self) {\n self.hueRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-hue'),\n min: 0,\n max: 360,\n step: 0.1,\n value: 0,\n on: {\n change(range, value) {\n self.setValue({\n hue: value\n });\n }\n }\n });\n self.saturationRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-saturation'),\n min: 0,\n max: 1,\n step: 0.001,\n value: 0,\n on: {\n change(range, value) {\n const s = Math.floor(value * 1000) / 1000;\n self.setValue({\n hsb: [self.value.hsb[0], s, self.value.hsb[2]]\n });\n }\n }\n });\n self.brightnessRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-brightness'),\n min: 0,\n max: 1,\n step: 0.001,\n value: 0,\n on: {\n change(range, value) {\n const b = Math.floor(value * 1000) / 1000;\n self.setValue({\n hsb: [self.value.hsb[0], self.value.hsb[1], b]\n });\n }\n }\n });\n function handleInputChange(e) {\n const hsb = [...self.value.hsb];\n const index = parseInt($(e.target).attr('data-color-index'), 10);\n let value = parseFloat(e.target.value);\n if (Number.isNaN(value)) {\n e.target.value = hsb[index];\n return;\n }\n if (index === 0) {\n value = Math.max(0, Math.min(360, value));\n } else {\n value = Math.max(0, Math.min(100, value)) / 100;\n }\n hsb[index] = value;\n self.setValue({\n hsb\n });\n }\n self.$el.on('change', '.color-picker-module-hsb-sliders input', handleInputChange);\n self.destroyHsbSlidersEvents = function destroyHsbSlidersEvents() {\n self.$el.off('change', '.color-picker-module-hsb-sliders input', handleInputChange);\n };\n },\n update(self) {\n const {\n app,\n value\n } = self;\n const {\n sliderValue,\n sliderValueEditable\n } = self.params;\n const {\n hsb,\n hue\n } = value;\n self.hueRangeSlider.value = hue;\n self.saturationRangeSlider.value = hsb[1];\n self.brightnessRangeSlider.value = hsb[2];\n self.hueRangeSlider.layout();\n self.saturationRangeSlider.layout();\n self.brightnessRangeSlider.layout();\n const hslCurrent = colorHsbToHsl(hsb[0], hsb[1], 1);\n const hslLeft = colorHsbToHsl(hsb[0], 0, 1);\n const hslRight = colorHsbToHsl(hsb[0], 1, 1);\n const brightness = hsb[2];\n self.hueRangeSlider.$el[0].style.setProperty('--f7-range-knob-color', `hsl(${hue}, 100%, 50%)`);\n self.saturationRangeSlider.$el[0].style.setProperty('--f7-range-knob-color', `hsl(${hslCurrent[0]}, ${hslCurrent[1] * 100}%, ${hslCurrent[2] * 100}%)`);\n self.brightnessRangeSlider.$el[0].style.setProperty('--f7-range-knob-color', `rgb(${brightness * 255}, ${brightness * 255}, ${brightness * 255})`);\n self.saturationRangeSlider.$el.find('.range-bar').css('background-image', `linear-gradient(${app.rtl ? 'to left' : 'to right'}, hsl(${hslLeft[0]}, ${hslLeft[1] * 100}%, ${hslLeft[2] * 100}%), hsl(${hslRight[0]}, ${hslRight[1] * 100}%, ${hslRight[2] * 100}%))`);\n if (sliderValue && sliderValueEditable) {\n self.$el.find('input.color-picker-value-hue').val(`${hue}`);\n self.$el.find('input.color-picker-value-saturation').val(`${hsb[1] * 1000 / 10}`);\n self.$el.find('input.color-picker-value-brightness').val(`${hsb[2] * 1000 / 10}`);\n } else if (sliderValue) {\n self.$el.find('span.color-picker-value-hue').text(`${hue}`);\n self.$el.find('span.color-picker-value-saturation').text(`${hsb[1] * 1000 / 10}`);\n self.$el.find('span.color-picker-value-brightness').text(`${hsb[2] * 1000 / 10}`);\n }\n },\n destroy(self) {\n if (self.hueRangeSlider && self.hueRangeSlider.destroy) {\n self.hueRangeSlider.destroy();\n }\n if (self.saturationRangeSlider && self.saturationRangeSlider.destroy) {\n self.saturationRangeSlider.destroy();\n }\n if (self.brightnessRangeSlider && self.brightnessRangeSlider.destroy) {\n self.brightnessRangeSlider.destroy();\n }\n delete self.hueRangeSlider;\n delete self.saturationRangeSlider;\n delete self.brightnessRangeSlider;\n if (self.destroyHsbSlidersEvents) self.destroyHsbSlidersEvents();\n delete self.destroyHsbSlidersEvents;\n }\n};", "/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render(self) {\n const {\n sliderLabel,\n sliderValue,\n sliderValueEditable,\n hueLabelText\n } = self.params;\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-hue-slider\"\n }, $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, hueLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-hue\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"0.1\",\n min: \"0\",\n max: \"360\",\n class: \"color-picker-value-hue\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-hue\"\n }))));\n },\n init(self) {\n self.hueRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-hue'),\n min: 0,\n max: 360,\n step: 0.1,\n value: 0,\n on: {\n change(range, value) {\n self.setValue({\n hue: value\n });\n }\n }\n });\n },\n update(self) {\n const {\n value\n } = self;\n const {\n sliderValue,\n sliderValueEditable\n } = self.params;\n const {\n hue\n } = value;\n self.hueRangeSlider.value = hue;\n self.hueRangeSlider.layout();\n self.hueRangeSlider.$el[0].style.setProperty('--f7-range-knob-color', `hsl(${hue}, 100%, 50%)`);\n if (sliderValue && sliderValueEditable) {\n self.$el.find('input.color-picker-value-hue').val(`${hue}`);\n } else if (sliderValue) {\n self.$el.find('span.color-picker-value-hue').text(`${hue}`);\n }\n },\n destroy(self) {\n if (self.hueRangeSlider && self.hueRangeSlider.destroy) {\n self.hueRangeSlider.destroy();\n }\n delete self.hueRangeSlider;\n }\n};", "import { colorHsbToHsl } from '../../../shared/utils.js';\n/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render(self) {\n const {\n sliderLabel,\n sliderValue,\n sliderValueEditable,\n brightnessLabelText\n } = self.params;\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-brightness-slider\"\n }, $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, brightnessLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-brightness\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"0.1\",\n min: \"0\",\n max: \"100\",\n class: \"color-picker-value-brightness\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-brightness\"\n }))));\n },\n init(self) {\n self.brightnessRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-brightness'),\n min: 0,\n max: 1,\n step: 0.001,\n value: 0,\n on: {\n change(range, value) {\n const b = Math.floor(value * 1000) / 1000;\n self.setValue({\n hsb: [self.value.hsb[0], self.value.hsb[1], b]\n });\n }\n }\n });\n },\n update(self) {\n const {\n value,\n app\n } = self;\n const {\n sliderValue,\n sliderValueEditable\n } = self.params;\n const {\n hsb\n } = value;\n self.brightnessRangeSlider.value = hsb[2];\n self.brightnessRangeSlider.layout();\n const hslCurrent = colorHsbToHsl(hsb[0], hsb[1], hsb[2]);\n const hslLeft = colorHsbToHsl(hsb[0], hsb[1], 0);\n const hslRight = colorHsbToHsl(hsb[0], hsb[1], 1);\n self.brightnessRangeSlider.$el[0].style.setProperty('--f7-range-knob-color', `hsl(${hslCurrent[0]}, ${hslCurrent[1] * 100}%, ${hslCurrent[2] * 100}%)`);\n self.brightnessRangeSlider.$el.find('.range-bar').css('background-image', `linear-gradient(${app.rtl ? 'to left' : 'to right'}, hsl(${hslLeft[0]}, ${hslLeft[1] * 100}%, ${hslLeft[2] * 100}%), hsl(${hslRight[0]}, ${hslRight[1] * 100}%, ${hslRight[2] * 100}%))`);\n if (sliderValue && sliderValueEditable) {\n self.$el.find('input.color-picker-value-brightness').val(`${hsb[2] * 1000 / 10}`);\n } else if (sliderValue) {\n self.$el.find('span.color-picker-value-brightness').text(`${hsb[2] * 1000 / 10}`);\n }\n },\n destroy(self) {\n if (self.brightnessRangeSlider && self.brightnessRangeSlider.destroy) {\n self.brightnessRangeSlider.destroy();\n }\n delete self.brightnessRangeSlider;\n }\n};", "/* eslint indent: [\"off\"] */\nimport $ from '../../../shared/dom7.js';\n/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render(self) {\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-palette\"\n }, $jsx(\"div\", {\n class: \"color-picker-palette\"\n }, self.params.palette.map(p => {\n if (Array.isArray(p)) {\n let row = '';\n // prettier-ignore\n row += p.map(c => `\n
\n `).join('');\n row += '
';\n return row;\n }\n return $jsx(\"div\", {\n class: \"color-picker-palette-value\",\n \"data-palette-color\": p,\n style: `background-color: ${p}`\n });\n })));\n },\n init(self) {\n function handlePaletteClick(e) {\n const hex = $(e.target).attr('data-palette-color');\n self.setValue({\n hex\n });\n }\n self.$el.on('click', '.color-picker-module-palette .color-picker-palette-value', handlePaletteClick);\n self.destroyPaletteEvents = function destroyPaletteEvents() {\n self.$el.off('click', '.color-picker-module-hex input', handlePaletteClick);\n };\n },\n destroy(self) {\n if (self.destroyPaletteEvents) {\n self.destroyPaletteEvents();\n }\n delete self.destroyPaletteEvents;\n }\n};", "/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render() {\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-initial-current-colors\"\n }, $jsx(\"div\", {\n class: \"color-picker-initial-current-colors\"\n }, $jsx(\"div\", {\n class: \"color-picker-initial-color\"\n }), $jsx(\"div\", {\n class: \"color-picker-current-color\"\n })));\n },\n init(self) {\n function handleInitialColorClick() {\n if (self.initialValue) {\n const {\n hex,\n alpha\n } = self.initialValue;\n self.setValue({\n hex,\n alpha\n });\n }\n }\n self.$el.on('click', '.color-picker-initial-color', handleInitialColorClick);\n self.destroyInitialCurrentEvents = function destroyInitialCurrentEvents() {\n self.$el.off('click', '.color-picker-initial-color', handleInitialColorClick);\n };\n },\n update(self) {\n self.$el.find('.color-picker-module-initial-current-colors .color-picker-initial-color').css('background-color', self.initialValue.hex);\n self.$el.find('.color-picker-module-initial-current-colors .color-picker-current-color').css('background-color', self.value.hex);\n },\n destroy(self) {\n if (self.destroyInitialCurrentEvents) {\n self.destroyInitialCurrentEvents();\n }\n delete self.destroyInitialCurrentEvents;\n }\n};", "import $ from '../../../shared/dom7.js';\n/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render(self) {\n const {\n barLabel,\n barValue,\n barValueEditable,\n redLabelText,\n greenLabelText,\n blueLabelText\n } = self.params;\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-rgb-bars\"\n }, $jsx(\"div\", {\n class: \"color-picker-bar-wrap\"\n }, barLabel && $jsx(\"div\", {\n class: \"color-picker-bar-label\"\n }, redLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-bar color-picker-bar-red\"\n }), barValue && $jsx(\"div\", {\n class: \"color-picker-bar-value\"\n }, barValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"1\",\n min: \"0\",\n max: \"255\",\n class: \"color-picker-value-bar-red\",\n \"data-color-index\": \"0\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-bar-red\"\n }))), $jsx(\"div\", {\n class: \"color-picker-bar-wrap\"\n }, barLabel && $jsx(\"div\", {\n class: \"color-picker-bar-label\"\n }, greenLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-bar color-picker-bar-green\"\n }), barValue && $jsx(\"div\", {\n class: \"color-picker-bar-value\"\n }, barValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"1\",\n min: \"0\",\n max: \"255\",\n class: \"color-picker-value-bar-green\",\n \"data-color-index\": \"1\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-bar-green\"\n }))), $jsx(\"div\", {\n class: \"color-picker-bar-wrap\"\n }, barLabel && $jsx(\"div\", {\n class: \"color-picker-bar-label\"\n }, blueLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-bar color-picker-bar-blue\"\n }), barValue && $jsx(\"div\", {\n class: \"color-picker-bar-value\"\n }, barValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"1\",\n min: \"0\",\n max: \"255\",\n class: \"color-picker-value-bar-blue\",\n \"data-color-index\": \"2\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-bar-blue\"\n }))));\n },\n init(self) {\n self.redBar = self.app.range.create({\n el: self.$el.find('.color-picker-bar-red'),\n min: 0,\n max: 255,\n step: 1,\n value: 0,\n vertical: true,\n on: {\n change(range, value) {\n self.setValue({\n rgb: [value, self.value.rgb[1], self.value.rgb[2]]\n });\n }\n }\n });\n self.greenBar = self.app.range.create({\n el: self.$el.find('.color-picker-bar-green'),\n min: 0,\n max: 255,\n step: 1,\n value: 0,\n vertical: true,\n on: {\n change(range, value) {\n self.setValue({\n rgb: [self.value.rgb[0], value, self.value.rgb[2]]\n });\n }\n }\n });\n self.blueBar = self.app.range.create({\n el: self.$el.find('.color-picker-bar-blue'),\n min: 0,\n max: 255,\n step: 1,\n value: 0,\n vertical: true,\n on: {\n change(range, value) {\n self.setValue({\n rgb: [self.value.rgb[0], self.value.rgb[1], value]\n });\n }\n }\n });\n function handleInputChange(e) {\n const rgb = [...self.value.rgb];\n const index = parseInt($(e.target).attr('data-color-index'), 10);\n let value = parseInt(e.target.value, 10);\n if (Number.isNaN(value)) {\n e.target.value = rgb[index];\n return;\n }\n value = Math.max(0, Math.min(255, value));\n rgb[index] = value;\n self.setValue({\n rgb\n });\n }\n self.$el.on('change', '.color-picker-module-rgb-bars input', handleInputChange);\n self.destroyRgbBarsEvents = function destroyRgbBarsEvents() {\n self.$el.off('change', '.color-picker-module-rgb-bars input', handleInputChange);\n };\n },\n update(self) {\n const {\n value,\n redBar,\n greenBar,\n blueBar\n } = self;\n const {\n barValue,\n barValueEditable\n } = self.params;\n const {\n rgb\n } = value;\n redBar.value = rgb[0];\n greenBar.value = rgb[1];\n blueBar.value = rgb[2];\n redBar.layout();\n greenBar.layout();\n blueBar.layout();\n redBar.$el.find('.range-bar').css('background-image', `linear-gradient(to top, rgb(0, ${rgb[1]}, ${rgb[2]}), rgb(255, ${rgb[1]}, ${rgb[2]}))`);\n greenBar.$el.find('.range-bar').css('background-image', `linear-gradient(to top, rgb(${rgb[0]}, 0, ${rgb[2]}), rgb(${rgb[0]}, 255, ${rgb[2]}))`);\n blueBar.$el.find('.range-bar').css('background-image', `linear-gradient(to top, rgb(${rgb[0]}, ${rgb[1]}, 0), rgb(${rgb[0]}, ${rgb[1]}, 255))`);\n if (barValue && barValueEditable) {\n self.$el.find('input.color-picker-value-bar-red').val(rgb[0]);\n self.$el.find('input.color-picker-value-bar-green').val(rgb[1]);\n self.$el.find('input.color-picker-value-bar-blue').val(rgb[2]);\n } else if (barValue) {\n self.$el.find('span.color-picker-value-bar-red').text(rgb[0]);\n self.$el.find('span.color-picker-value-bar-green').text(rgb[1]);\n self.$el.find('span.color-picker-value-bar-blue').text(rgb[2]);\n }\n },\n destroy(self) {\n if (self.redBar && self.redBar.destroy) {\n self.redBar.destroy();\n }\n if (self.greenBar && self.greenBar.destroy) {\n self.greenBar.destroy();\n }\n if (self.blueBar && self.blueBar.destroy) {\n self.blueBar.destroy();\n }\n delete self.redBar;\n delete self.greenBar;\n delete self.blueBar;\n if (self.destroyRgbBarsEvents) self.destroyRgbBarsEvents();\n delete self.destroyRgbBarsEvents;\n }\n};", "import $ from '../../../shared/dom7.js';\n/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render(self) {\n const {\n sliderLabel,\n sliderValue,\n sliderValueEditable,\n redLabelText,\n greenLabelText,\n blueLabelText\n } = self.params;\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-rgb-sliders\"\n }, $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, redLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-red\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"1\",\n min: \"0\",\n max: \"255\",\n class: \"color-picker-value-red\",\n \"data-color-index\": \"0\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-red\"\n }))), $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, greenLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-green\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"1\",\n min: \"0\",\n max: \"255\",\n class: \"color-picker-value-green\",\n \"data-color-index\": \"1\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-green\"\n }))), $jsx(\"div\", {\n class: \"color-picker-slider-wrap\"\n }, sliderLabel && $jsx(\"div\", {\n class: \"color-picker-slider-label\"\n }, blueLabelText), $jsx(\"div\", {\n class: \"range-slider color-picker-slider color-picker-slider-blue\"\n }), sliderValue && $jsx(\"div\", {\n class: \"color-picker-slider-value\"\n }, sliderValueEditable ? $jsx(\"input\", {\n type: \"number\",\n step: \"1\",\n min: \"0\",\n max: \"255\",\n class: \"color-picker-value-blue\",\n \"data-color-index\": \"2\"\n }) : $jsx(\"span\", {\n class: \"color-picker-value-blue\"\n }))));\n },\n init(self) {\n self.redRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-red'),\n min: 0,\n max: 255,\n step: 1,\n value: 0,\n on: {\n change(range, value) {\n self.setValue({\n rgb: [value, self.value.rgb[1], self.value.rgb[2]]\n });\n }\n }\n });\n self.greenRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-green'),\n min: 0,\n max: 255,\n step: 1,\n value: 0,\n on: {\n change(range, value) {\n self.setValue({\n rgb: [self.value.rgb[0], value, self.value.rgb[2]]\n });\n }\n }\n });\n self.blueRangeSlider = self.app.range.create({\n el: self.$el.find('.color-picker-slider-blue'),\n min: 0,\n max: 255,\n step: 1,\n value: 0,\n on: {\n change(range, value) {\n self.setValue({\n rgb: [self.value.rgb[0], self.value.rgb[1], value]\n });\n }\n }\n });\n function handleInputChange(e) {\n const rgb = [...self.value.rgb];\n const index = parseInt($(e.target).attr('data-color-index'), 10);\n let value = parseInt(e.target.value, 10);\n if (Number.isNaN(value)) {\n e.target.value = rgb[index];\n return;\n }\n value = Math.max(0, Math.min(255, value));\n rgb[index] = value;\n self.setValue({\n rgb\n });\n }\n self.$el.on('change', '.color-picker-module-rgb-sliders input', handleInputChange);\n self.destroyRgbSlidersEvents = function destroyRgbSlidersEvents() {\n self.$el.off('change', '.color-picker-module-rgb-sliders input', handleInputChange);\n };\n },\n update(self) {\n const {\n app,\n value,\n redRangeSlider,\n greenRangeSlider,\n blueRangeSlider\n } = self;\n const {\n sliderValue,\n sliderValueEditable\n } = self.params;\n const {\n rgb\n } = value;\n redRangeSlider.value = rgb[0];\n greenRangeSlider.value = rgb[1];\n blueRangeSlider.value = rgb[2];\n redRangeSlider.layout();\n greenRangeSlider.layout();\n blueRangeSlider.layout();\n redRangeSlider.$el[0].style.setProperty('--f7-range-knob-color', `rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`);\n greenRangeSlider.$el[0].style.setProperty('--f7-range-knob-color', `rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`);\n blueRangeSlider.$el[0].style.setProperty('--f7-range-knob-color', `rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`);\n const direction = app.rtl ? 'to left' : 'to right';\n redRangeSlider.$el.find('.range-bar').css('background-image', `linear-gradient(${direction}, rgb(0, ${rgb[1]}, ${rgb[2]}), rgb(255, ${rgb[1]}, ${rgb[2]}))`);\n greenRangeSlider.$el.find('.range-bar').css('background-image', `linear-gradient(${direction}, rgb(${rgb[0]}, 0, ${rgb[2]}), rgb(${rgb[0]}, 255, ${rgb[2]}))`);\n blueRangeSlider.$el.find('.range-bar').css('background-image', `linear-gradient(${direction}, rgb(${rgb[0]}, ${rgb[1]}, 0), rgb(${rgb[0]}, ${rgb[1]}, 255))`);\n if (sliderValue && sliderValueEditable) {\n self.$el.find('input.color-picker-value-red').val(rgb[0]);\n self.$el.find('input.color-picker-value-green').val(rgb[1]);\n self.$el.find('input.color-picker-value-blue').val(rgb[2]);\n } else if (sliderValue) {\n self.$el.find('span.color-picker-value-red').text(rgb[0]);\n self.$el.find('span.color-picker-value-green').text(rgb[1]);\n self.$el.find('span.color-picker-value-blue').text(rgb[2]);\n }\n },\n destroy(self) {\n if (self.redRangeSlider && self.redRangeSlider.destroy) {\n self.redRangeSlider.destroy();\n }\n if (self.greenRangeSlider && self.greenRangeSlider.destroy) {\n self.greenRangeSlider.destroy();\n }\n if (self.blueRangeSlider && self.blueRangeSlider.destroy) {\n self.blueRangeSlider.destroy();\n }\n delete self.redRangeSlider;\n delete self.greenRangeSlider;\n delete self.blueRangeSlider;\n if (self.destroyRgbSlidersEvents) self.destroyRgbSlidersEvents();\n delete self.destroyRgbSlidersEvents;\n }\n};", "import $ from '../../../shared/dom7.js';\nimport { getSupport } from '../../../shared/get-support.js';\n/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render() {\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-sb-spectrum\"\n }, $jsx(\"div\", {\n class: \"color-picker-sb-spectrum\",\n style: \"background-color: hsl(0, 100%, 50%)\"\n }, $jsx(\"div\", {\n class: \"color-picker-sb-spectrum-handle\"\n })));\n },\n init(self) {\n const {\n app\n } = self;\n let isTouched;\n let isMoved;\n let touchStartX;\n let touchStartY;\n let touchCurrentX;\n let touchCurrentY;\n let specterRect;\n let specterIsTouched;\n let specterHandleIsTouched;\n const {\n $el\n } = self;\n function setSBFromSpecterCoords(x, y) {\n let s = (x - specterRect.left) / specterRect.width;\n let b = (y - specterRect.top) / specterRect.height;\n s = Math.max(0, Math.min(1, s));\n b = 1 - Math.max(0, Math.min(1, b));\n self.setValue({\n hsb: [self.value.hue, s, b]\n });\n }\n function handleTouchStart(e) {\n if (isMoved || isTouched) return;\n touchStartX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchCurrentX = touchStartX;\n touchStartY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n touchCurrentY = touchStartY;\n const $targetEl = $(e.target);\n specterHandleIsTouched = $targetEl.closest('.color-picker-sb-spectrum-handle').length > 0;\n if (!specterHandleIsTouched) {\n specterIsTouched = $targetEl.closest('.color-picker-sb-spectrum').length > 0;\n }\n if (specterIsTouched) {\n specterRect = $el.find('.color-picker-sb-spectrum')[0].getBoundingClientRect();\n setSBFromSpecterCoords(touchStartX, touchStartY);\n }\n if (specterHandleIsTouched || specterIsTouched) {\n $el.find('.color-picker-sb-spectrum-handle').addClass('color-picker-sb-spectrum-handle-pressed');\n }\n }\n function handleTouchMove(e) {\n if (!(specterIsTouched || specterHandleIsTouched)) return;\n touchCurrentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n touchCurrentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n e.preventDefault();\n if (!isMoved) {\n // First move\n isMoved = true;\n if (specterHandleIsTouched) {\n specterRect = $el.find('.color-picker-sb-spectrum')[0].getBoundingClientRect();\n }\n }\n if (specterIsTouched || specterHandleIsTouched) {\n setSBFromSpecterCoords(touchCurrentX, touchCurrentY);\n }\n }\n function handleTouchEnd() {\n isMoved = false;\n if (specterIsTouched || specterHandleIsTouched) {\n $el.find('.color-picker-sb-spectrum-handle').removeClass('color-picker-sb-spectrum-handle-pressed');\n }\n specterIsTouched = false;\n specterHandleIsTouched = false;\n }\n function handleResize() {\n self.modules['sb-spectrum'].update(self);\n }\n const passiveListener = app.touchEvents.start === 'touchstart' && getSupport().passiveListener ? {\n passive: true,\n capture: false\n } : false;\n self.$el.on(app.touchEvents.start, handleTouchStart, passiveListener);\n app.on('touchmove:active', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n app.on('resize', handleResize);\n self.destroySpectrumEvents = function destroySpectrumEvents() {\n self.$el.off(app.touchEvents.start, handleTouchStart, passiveListener);\n app.off('touchmove:active', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n app.off('resize', handleResize);\n };\n },\n update(self) {\n const {\n value\n } = self;\n const {\n hsl,\n hsb\n } = value;\n const specterWidth = self.$el.find('.color-picker-sb-spectrum')[0].offsetWidth;\n const specterHeight = self.$el.find('.color-picker-sb-spectrum')[0].offsetHeight;\n self.$el.find('.color-picker-sb-spectrum').css('background-color', `hsl(${hsl[0]}, 100%, 50%)`);\n self.$el.find('.color-picker-sb-spectrum-handle').css('background-color', `hsl(${hsl[0]}, ${hsl[1] * 100}%, ${hsl[2] * 100}%)`).transform(`translate(${specterWidth * hsb[1]}px, ${specterHeight * (1 - hsb[2])}px)`);\n },\n destroy(self) {\n if (self.destroySpectrumEvents) self.destroySpectrumEvents();\n delete self.destroySpectrumEvents;\n }\n};", "import $ from '../../../shared/dom7.js';\nimport { colorHsbToHsl } from '../../../shared/utils.js';\nimport { getSupport } from '../../../shared/get-support.js';\n/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nexport default {\n render() {\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-hs-spectrum\"\n }, $jsx(\"div\", {\n class: \"color-picker-hs-spectrum\"\n }, $jsx(\"div\", {\n class: \"color-picker-hs-spectrum-handle\"\n })));\n },\n init(self) {\n const {\n app\n } = self;\n let isTouched;\n let isMoved;\n let touchStartX;\n let touchStartY;\n let touchCurrentX;\n let touchCurrentY;\n let specterRect;\n let specterIsTouched;\n let specterHandleIsTouched;\n const {\n $el\n } = self;\n function setHSFromSpecterCoords(x, y) {\n let h = (x - specterRect.left) / specterRect.width * 360;\n let s = (y - specterRect.top) / specterRect.height;\n h = Math.max(0, Math.min(360, h));\n s = 1 - Math.max(0, Math.min(1, s));\n self.setValue({\n hsb: [h, s, self.value.hsb[2]]\n });\n }\n function handleTouchStart(e) {\n if (isMoved || isTouched) return;\n touchStartX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchCurrentX = touchStartX;\n touchStartY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n touchCurrentY = touchStartY;\n const $targetEl = $(e.target);\n specterHandleIsTouched = $targetEl.closest('.color-picker-hs-spectrum-handle').length > 0;\n if (!specterHandleIsTouched) {\n specterIsTouched = $targetEl.closest('.color-picker-hs-spectrum').length > 0;\n }\n if (specterIsTouched) {\n specterRect = $el.find('.color-picker-hs-spectrum')[0].getBoundingClientRect();\n setHSFromSpecterCoords(touchStartX, touchStartY);\n }\n if (specterHandleIsTouched || specterIsTouched) {\n $el.find('.color-picker-hs-spectrum-handle').addClass('color-picker-hs-spectrum-handle-pressed');\n }\n }\n function handleTouchMove(e) {\n if (!(specterIsTouched || specterHandleIsTouched)) return;\n touchCurrentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n touchCurrentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n e.preventDefault();\n if (!isMoved) {\n // First move\n isMoved = true;\n if (specterHandleIsTouched) {\n specterRect = $el.find('.color-picker-hs-spectrum')[0].getBoundingClientRect();\n }\n }\n if (specterIsTouched || specterHandleIsTouched) {\n setHSFromSpecterCoords(touchCurrentX, touchCurrentY);\n }\n }\n function handleTouchEnd() {\n isMoved = false;\n if (specterIsTouched || specterHandleIsTouched) {\n $el.find('.color-picker-hs-spectrum-handle').removeClass('color-picker-hs-spectrum-handle-pressed');\n }\n specterIsTouched = false;\n specterHandleIsTouched = false;\n }\n function handleResize() {\n self.modules['hs-spectrum'].update(self);\n }\n const passiveListener = app.touchEvents.start === 'touchstart' && getSupport().passiveListener ? {\n passive: true,\n capture: false\n } : false;\n self.$el.on(app.touchEvents.start, handleTouchStart, passiveListener);\n app.on('touchmove:active', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n app.on('resize', handleResize);\n self.destroySpectrumEvents = function destroySpectrumEvents() {\n self.$el.off(app.touchEvents.start, handleTouchStart, passiveListener);\n app.off('touchmove:active', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n app.off('resize', handleResize);\n };\n },\n update(self) {\n const {\n value\n } = self;\n const {\n hsb\n } = value;\n const specterWidth = self.$el.find('.color-picker-hs-spectrum')[0].offsetWidth;\n const specterHeight = self.$el.find('.color-picker-hs-spectrum')[0].offsetHeight;\n const hslBright = colorHsbToHsl(hsb[0], hsb[1], 1);\n self.$el.find('.color-picker-hs-spectrum-handle').css('background-color', `hsl(${hslBright[0]}, ${hslBright[1] * 100}%, ${hslBright[2] * 100}%)`).transform(`translate(${specterWidth * (hsb[0] / 360)}px, ${specterHeight * (1 - hsb[1])}px)`);\n },\n destroy(self) {\n if (self.destroySpectrumEvents) self.destroySpectrumEvents();\n delete self.destroySpectrumEvents;\n }\n};", "import $ from '../../../shared/dom7.js';\nimport { getSupport } from '../../../shared/get-support.js';\n/** @jsx $jsx */\nimport $jsx from '../../../shared/$jsx.js';\nfunction svgWheelCircles() {\n const total = 256;\n let circles = '';\n for (let i = total; i > 0; i -= 1) {\n const angle = i * Math.PI / (total / 2);\n const hue = 360 / total * i;\n circles += ``;\n }\n return circles;\n}\nexport default {\n render() {\n return $jsx(\"div\", {\n class: \"color-picker-module color-picker-module-wheel\"\n }, $jsx(\"div\", {\n class: \"color-picker-wheel\"\n }, $jsx(\"svg\", {\n viewBox: \"0 0 300 300\",\n width: \"300\",\n height: \"300\"\n }, svgWheelCircles()), $jsx(\"div\", {\n class: \"color-picker-wheel-handle\"\n }), $jsx(\"div\", {\n class: \"color-picker-sb-spectrum\",\n style: \"background-color: hsl(0, 100%, 50%)\"\n }, $jsx(\"div\", {\n class: \"color-picker-sb-spectrum-handle\"\n }))));\n },\n init(self) {\n const {\n app\n } = self;\n let isTouched;\n let isMoved;\n let touchStartX;\n let touchStartY;\n let touchCurrentX;\n let touchCurrentY;\n let wheelRect;\n let wheelIsTouched;\n let wheelHandleIsTouched;\n let specterRect;\n let specterIsTouched;\n let specterHandleIsTouched;\n const {\n $el\n } = self;\n function setHueFromWheelCoords(x, y) {\n const wheelCenterX = wheelRect.left + wheelRect.width / 2;\n const wheelCenterY = wheelRect.top + wheelRect.height / 2;\n const angleRad = Math.atan2(y - wheelCenterY, x - wheelCenterX);\n let angleDeg = angleRad * 180 / Math.PI + 90;\n if (angleDeg < 0) angleDeg += 360;\n angleDeg = 360 - angleDeg;\n self.setValue({\n hue: angleDeg\n });\n }\n function setSBFromSpecterCoords(x, y) {\n let s = (x - specterRect.left) / specterRect.width;\n let b = (y - specterRect.top) / specterRect.height;\n s = Math.max(0, Math.min(1, s));\n b = 1 - Math.max(0, Math.min(1, b));\n self.setValue({\n hsb: [self.value.hue, s, b]\n });\n }\n function handleTouchStart(e) {\n if (isMoved || isTouched) return;\n touchStartX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n touchCurrentX = touchStartX;\n touchStartY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n touchCurrentY = touchStartY;\n const $targetEl = $(e.target);\n wheelHandleIsTouched = $targetEl.closest('.color-picker-wheel-handle').length > 0;\n wheelIsTouched = $targetEl.closest('circle').length > 0;\n specterHandleIsTouched = $targetEl.closest('.color-picker-sb-spectrum-handle').length > 0;\n if (!specterHandleIsTouched) {\n specterIsTouched = $targetEl.closest('.color-picker-sb-spectrum').length > 0;\n }\n if (wheelIsTouched) {\n wheelRect = $el.find('.color-picker-wheel')[0].getBoundingClientRect();\n setHueFromWheelCoords(touchStartX, touchStartY);\n }\n if (specterIsTouched) {\n specterRect = $el.find('.color-picker-sb-spectrum')[0].getBoundingClientRect();\n setSBFromSpecterCoords(touchStartX, touchStartY);\n }\n if (specterHandleIsTouched || specterIsTouched) {\n $el.find('.color-picker-sb-spectrum-handle').addClass('color-picker-sb-spectrum-handle-pressed');\n }\n }\n function handleTouchMove(e) {\n if (!(wheelIsTouched || wheelHandleIsTouched) && !(specterIsTouched || specterHandleIsTouched)) return;\n touchCurrentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n touchCurrentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n e.preventDefault();\n if (!isMoved) {\n // First move\n isMoved = true;\n if (wheelHandleIsTouched) {\n wheelRect = $el.find('.color-picker-wheel')[0].getBoundingClientRect();\n }\n if (specterHandleIsTouched) {\n specterRect = $el.find('.color-picker-sb-spectrum')[0].getBoundingClientRect();\n }\n }\n if (wheelIsTouched || wheelHandleIsTouched) {\n setHueFromWheelCoords(touchCurrentX, touchCurrentY);\n }\n if (specterIsTouched || specterHandleIsTouched) {\n setSBFromSpecterCoords(touchCurrentX, touchCurrentY);\n }\n }\n function handleTouchEnd() {\n isMoved = false;\n if (specterIsTouched || specterHandleIsTouched) {\n $el.find('.color-picker-sb-spectrum-handle').removeClass('color-picker-sb-spectrum-handle-pressed');\n }\n wheelIsTouched = false;\n wheelHandleIsTouched = false;\n specterIsTouched = false;\n specterHandleIsTouched = false;\n }\n function handleResize() {\n self.modules.wheel.update(self);\n }\n const passiveListener = app.touchEvents.start === 'touchstart' && getSupport().passiveListener ? {\n passive: true,\n capture: false\n } : false;\n self.$el.on(app.touchEvents.start, handleTouchStart, passiveListener);\n app.on('touchmove:active', handleTouchMove);\n app.on('touchend:passive', handleTouchEnd);\n app.on('resize', handleResize);\n self.destroyWheelEvents = function destroyWheelEvents() {\n self.$el.off(app.touchEvents.start, handleTouchStart, passiveListener);\n app.off('touchmove:active', handleTouchMove);\n app.off('touchend:passive', handleTouchEnd);\n app.off('resize', handleResize);\n };\n },\n update(self) {\n const {\n value\n } = self;\n const {\n hsl,\n hsb\n } = value;\n const specterWidth = self.$el.find('.color-picker-sb-spectrum')[0].offsetWidth;\n const specterHeight = self.$el.find('.color-picker-sb-spectrum')[0].offsetHeight;\n const wheelSize = self.$el.find('.color-picker-wheel')[0].offsetWidth;\n const wheelHalfSize = wheelSize / 2;\n const angleRad = value.hue * Math.PI / 180;\n const handleSize = wheelSize / 6;\n const handleHalfSize = handleSize / 2;\n const tX = wheelHalfSize - Math.sin(angleRad) * (wheelHalfSize - handleHalfSize) - handleHalfSize;\n const tY = wheelHalfSize - Math.cos(angleRad) * (wheelHalfSize - handleHalfSize) - handleHalfSize;\n self.$el.find('.color-picker-wheel-handle').css('background-color', `hsl(${hsl[0]}, 100%, 50%)`).transform(`translate(${tX}px, ${tY}px)`);\n self.$el.find('.color-picker-sb-spectrum').css('background-color', `hsl(${hsl[0]}, 100%, 50%)`);\n self.$el.find('.color-picker-sb-spectrum-handle').css('background-color', `hsl(${hsl[0]}, ${hsl[1] * 100}%, ${hsl[2] * 100}%)`).transform(`translate(${specterWidth * hsb[1]}px, ${specterHeight * (1 - hsb[2])}px)`);\n },\n destroy(self) {\n if (self.destroyWheelEvents) self.destroyWheelEvents();\n delete self.destroyWheelEvents;\n }\n};", "import { extend, colorRgbToHex, colorRgbToHsl, colorHslToHsb, colorHslToRgb, colorHsbToHsl, colorHexToRgb, nextTick, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\nimport $ from '../../shared/dom7.js';\nimport { getDevice } from '../../shared/get-device.js';\nimport moduleAlphaSlider from './modules/alpha-slider.js';\nimport moduleCurrentColor from './modules/current-color.js';\nimport moduleHex from './modules/hex.js';\nimport moduleHsbSliders from './modules/hsb-sliders.js';\nimport moduleHueSlider from './modules/hue-slider.js';\nimport moduleBrightnessSlider from './modules/brightness-slider.js';\nimport modulePalette from './modules/palette.js';\nimport moduleInitialCurrentColors from './modules/initial-current-colors.js';\nimport moduleRgbBars from './modules/rgb-bars.js';\nimport moduleRgbSliders from './modules/rgb-sliders.js';\nimport moduleSbSpectrum from './modules/sb-spectrum.js';\nimport moduleHsSpectrum from './modules/hs-spectrum.js';\nimport moduleWheel from './modules/wheel.js';\n\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass ColorPicker extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const self = this;\n self.params = extend({}, app.params.colorPicker, params);\n let $containerEl;\n if (self.params.containerEl) {\n $containerEl = $(self.params.containerEl);\n if ($containerEl.length === 0) return self;\n }\n let $inputEl;\n if (self.params.inputEl) {\n $inputEl = $(self.params.inputEl);\n }\n let $targetEl;\n if (self.params.targetEl) {\n $targetEl = $(self.params.targetEl);\n }\n extend(self, {\n app,\n $containerEl,\n containerEl: $containerEl && $containerEl[0],\n inline: $containerEl && $containerEl.length > 0,\n $inputEl,\n inputEl: $inputEl && $inputEl[0],\n $targetEl,\n targetEl: $targetEl && $targetEl[0],\n initialized: false,\n opened: false,\n url: self.params.url,\n modules: {\n 'alpha-slider': moduleAlphaSlider,\n 'current-color': moduleCurrentColor,\n hex: moduleHex,\n // eslint-disable-line\n 'hsb-sliders': moduleHsbSliders,\n 'hue-slider': moduleHueSlider,\n 'brightness-slider': moduleBrightnessSlider,\n palette: modulePalette,\n // eslint-disable-line\n 'initial-current-colors': moduleInitialCurrentColors,\n 'rgb-bars': moduleRgbBars,\n 'rgb-sliders': moduleRgbSliders,\n 'sb-spectrum': moduleSbSpectrum,\n 'hs-spectrum': moduleHsSpectrum,\n wheel: moduleWheel // eslint-disable-line\n }\n });\n\n function onInputClick() {\n self.open();\n }\n function onInputFocus(e) {\n e.preventDefault();\n }\n function onTargetClick() {\n self.open();\n }\n function onHtmlClick(e) {\n if (self.destroyed || !self.params) return;\n if (self.params.openIn === 'page') return;\n const $clickTargetEl = $(e.target);\n if (!self.opened || self.closing) return;\n if ($clickTargetEl.closest('[class*=\"backdrop\"]').length) return;\n if ($clickTargetEl.closest('.color-picker-popup, .color-picker-popover').length) return;\n if ($inputEl && $inputEl.length > 0) {\n if ($clickTargetEl[0] !== $inputEl[0] && $clickTargetEl.closest('.sheet-modal').length === 0) {\n self.close();\n }\n } else if ($(e.target).closest('.sheet-modal').length === 0) {\n self.close();\n }\n }\n\n // Events\n extend(self, {\n attachInputEvents() {\n self.$inputEl.on('click', onInputClick);\n if (self.params.inputReadOnly) {\n self.$inputEl.on('focus mousedown', onInputFocus);\n if (self.$inputEl[0]) {\n self.$inputEl[0].f7ValidateReadonly = true;\n }\n }\n },\n detachInputEvents() {\n self.$inputEl.off('click', onInputClick);\n if (self.params.inputReadOnly) {\n self.$inputEl.off('focus mousedown', onInputFocus);\n if (self.$inputEl[0]) {\n delete self.$inputEl[0].f7ValidateReadonly;\n }\n }\n },\n attachTargetEvents() {\n self.$targetEl.on('click', onTargetClick);\n },\n detachTargetEvents() {\n self.$targetEl.off('click', onTargetClick);\n },\n attachHtmlEvents() {\n app.on('click', onHtmlClick);\n },\n detachHtmlEvents() {\n app.off('click', onHtmlClick);\n }\n });\n self.init();\n return self;\n }\n get view() {\n const {\n $inputEl,\n $targetEl,\n app,\n params\n } = this;\n let view;\n if (params.view) {\n view = params.view;\n } else {\n if ($inputEl) {\n view = $inputEl.parents('.view').length && $inputEl.parents('.view')[0].f7View;\n }\n if (!view && $targetEl) {\n view = $targetEl.parents('.view').length && $targetEl.parents('.view')[0].f7View;\n }\n }\n if (!view) view = app.views.main;\n return view;\n }\n attachEvents() {\n const self = this;\n self.centerModules = self.centerModules.bind(self);\n if (self.params.centerModules) {\n self.app.on('resize', self.centerModules);\n }\n }\n detachEvents() {\n const self = this;\n if (self.params.centerModules) {\n self.app.off('resize', self.centerModules);\n }\n }\n centerModules() {\n const self = this;\n if (!self.opened || !self.$el || self.inline) return;\n const $pageContentEl = self.$el.find('.page-content');\n if (!$pageContentEl.length) return;\n const {\n scrollHeight,\n offsetHeight\n } = $pageContentEl[0];\n if (scrollHeight <= offsetHeight) {\n $pageContentEl.addClass('justify-content-center');\n } else {\n $pageContentEl.removeClass('justify-content-center');\n }\n }\n initInput() {\n const self = this;\n if (!self.$inputEl) return;\n if (self.params.inputReadOnly) self.$inputEl.prop('readOnly', true);\n }\n getModalType() {\n const self = this;\n const {\n app,\n modal,\n params\n } = self;\n const {\n openIn,\n openInPhone\n } = params;\n const device = getDevice();\n if (modal && modal.type) return modal.type;\n if (openIn !== 'auto') return openIn;\n if (self.inline) return null;\n if (device.ios) {\n return device.ipad ? 'popover' : openInPhone;\n }\n if (app.width >= 768) {\n return 'popover';\n }\n return openInPhone;\n }\n formatValue() {\n const self = this;\n const {\n value\n } = self;\n if (self.params.formatValue) {\n return self.params.formatValue.call(self, value);\n }\n return value.hex;\n }\n\n // eslint-disable-next-line\n normalizeHsValues(arr) {\n return [Math.floor(arr[0] * 10) / 10, Math.floor(arr[1] * 1000) / 1000, Math.floor(arr[2] * 1000) / 1000];\n }\n setValue(value, updateModules) {\n if (value === void 0) {\n value = {};\n }\n if (updateModules === void 0) {\n updateModules = true;\n }\n const self = this;\n if (typeof value === 'undefined') return;\n let {\n hex,\n rgb,\n hsl,\n hsb,\n alpha = 1,\n hue,\n rgba,\n hsla\n } = self.value || {};\n const needChangeEvent = self.value || !self.value && !self.params.value;\n let valueChanged;\n Object.keys(value).forEach(k => {\n if (!self.value || typeof self.value[k] === 'undefined') {\n valueChanged = true;\n return;\n }\n const v = value[k];\n if (Array.isArray(v)) {\n v.forEach((subV, subIndex) => {\n if (subV !== self.value[k][subIndex]) {\n valueChanged = true;\n }\n });\n } else if (v !== self.value[k]) {\n valueChanged = true;\n }\n });\n if (!valueChanged) return;\n if (value.rgb || value.rgba) {\n const [r, g, b, a = alpha] = value.rgb || value.rgba;\n rgb = [r, g, b];\n hex = colorRgbToHex(...rgb);\n hsl = colorRgbToHsl(...rgb);\n hsb = colorHslToHsb(...hsl);\n hsl = self.normalizeHsValues(hsl);\n hsb = self.normalizeHsValues(hsb);\n hue = hsb[0];\n alpha = a;\n rgba = [rgb[0], rgb[1], rgb[2], a];\n hsla = [hsl[0], hsl[1], hsl[2], a];\n }\n if (value.hsl || value.hsla) {\n const [h, s, l, a = alpha] = value.hsl || value.hsla;\n hsl = [h, s, l];\n rgb = colorHslToRgb(...hsl);\n hex = colorRgbToHex(...rgb);\n hsb = colorHslToHsb(...hsl);\n hsl = self.normalizeHsValues(hsl);\n hsb = self.normalizeHsValues(hsb);\n hue = hsb[0];\n alpha = a;\n rgba = [rgb[0], rgb[1], rgb[2], a];\n hsla = [hsl[0], hsl[1], hsl[2], a];\n }\n if (value.hsb) {\n const [h, s, b, a = alpha] = value.hsb;\n hsb = [h, s, b];\n hsl = colorHsbToHsl(...hsb);\n rgb = colorHslToRgb(...hsl);\n hex = colorRgbToHex(...rgb);\n hsl = self.normalizeHsValues(hsl);\n hsb = self.normalizeHsValues(hsb);\n hue = hsb[0];\n alpha = a;\n rgba = [rgb[0], rgb[1], rgb[2], a];\n hsla = [hsl[0], hsl[1], hsl[2], a];\n }\n if (value.hex) {\n rgb = colorHexToRgb(value.hex);\n hex = colorRgbToHex(...rgb);\n hsl = colorRgbToHsl(...rgb);\n hsb = colorHslToHsb(...hsl);\n hsl = self.normalizeHsValues(hsl);\n hsb = self.normalizeHsValues(hsb);\n hue = hsb[0];\n rgba = [rgb[0], rgb[1], rgb[2], alpha];\n hsla = [hsl[0], hsl[1], hsl[2], alpha];\n }\n if (typeof value.alpha !== 'undefined') {\n alpha = value.alpha;\n if (typeof rgb !== 'undefined') {\n rgba = [rgb[0], rgb[1], rgb[2], alpha];\n }\n if (typeof hsl !== 'undefined') {\n hsla = [hsl[0], hsl[1], hsl[2], alpha];\n }\n }\n if (typeof value.hue !== 'undefined') {\n const [h, s, l] = hsl; // eslint-disable-line\n hsl = [value.hue, s, l];\n hsb = colorHslToHsb(...hsl);\n rgb = colorHslToRgb(...hsl);\n hex = colorRgbToHex(...rgb);\n hsl = self.normalizeHsValues(hsl);\n hsb = self.normalizeHsValues(hsb);\n hue = hsb[0];\n rgba = [rgb[0], rgb[1], rgb[2], alpha];\n hsla = [hsl[0], hsl[1], hsl[2], alpha];\n }\n self.value = {\n hex,\n alpha,\n hue,\n rgb,\n hsl,\n hsb,\n rgba,\n hsla\n };\n if (!self.initialValue) self.initialValue = extend({}, self.value);\n self.updateValue(needChangeEvent);\n if (self.opened && updateModules) {\n self.updateModules();\n }\n }\n getValue() {\n const self = this;\n return self.value;\n }\n updateValue(fireEvents) {\n if (fireEvents === void 0) {\n fireEvents = true;\n }\n const self = this;\n const {\n $inputEl,\n value,\n $targetEl\n } = self;\n if ($targetEl && self.params.targetElSetBackgroundColor) {\n const {\n rgba\n } = value;\n $targetEl.css('background-color', `rgba(${rgba.join(', ')})`);\n }\n if (fireEvents) {\n self.emit('local::change colorPickerChange', self, value);\n }\n if ($inputEl && $inputEl.length) {\n const inputValue = self.formatValue(value);\n if ($inputEl && $inputEl.length) {\n $inputEl.val(inputValue);\n if (fireEvents) {\n $inputEl.trigger('change');\n }\n }\n }\n }\n updateModules() {\n const self = this;\n const {\n modules\n } = self;\n self.params.modules.forEach(m => {\n if (typeof m === 'string' && modules[m] && modules[m].update) {\n modules[m].update(self);\n } else if (m && m.update) {\n m.update(self);\n }\n });\n }\n update() {\n const self = this;\n self.updateModules();\n }\n renderPicker() {\n const self = this;\n const {\n params,\n modules\n } = self;\n let html = '';\n params.modules.forEach(m => {\n if (typeof m === 'string' && modules[m] && modules[m].render) {\n html += modules[m].render(self);\n } else if (m && m.render) {\n html += m.render(self);\n }\n });\n return html;\n }\n renderNavbar() {\n const self = this;\n if (self.params.renderNavbar) {\n return self.params.renderNavbar.call(self, self);\n }\n const {\n openIn,\n navbarTitleText,\n navbarBackLinkText,\n navbarCloseText\n } = self.params;\n return $jsx(\"div\", {\n class: \"navbar\"\n }, $jsx(\"div\", {\n class: \"navbar-bg\"\n }), $jsx(\"div\", {\n class: \"navbar-inner sliding\"\n }, openIn === 'page' && $jsx(\"div\", {\n class: \"left\"\n }, $jsx(\"a\", {\n class: \"link back\"\n }, $jsx(\"i\", {\n class: \"icon icon-back\"\n }), $jsx(\"span\", {\n class: \"if-not-md\"\n }, navbarBackLinkText))), $jsx(\"div\", {\n class: \"title\"\n }, navbarTitleText), openIn !== 'page' && $jsx(\"div\", {\n class: \"right\"\n }, $jsx(\"a\", {\n class: \"link popup-close\",\n \"data-popup\": \".color-picker-popup\"\n }, navbarCloseText))));\n }\n renderToolbar() {\n const self = this;\n if (self.params.renderToolbar) {\n return self.params.renderToolbar.call(self, self);\n }\n return $jsx(\"div\", {\n class: \"toolbar toolbar-top\"\n }, $jsx(\"div\", {\n class: \"toolbar-inner\"\n }, $jsx(\"div\", {\n class: \"left\"\n }), $jsx(\"div\", {\n class: \"right\"\n }, $jsx(\"a\", {\n class: \"link sheet-close popover-close\",\n \"data-sheet\": \".color-picker-sheet-modal\",\n \"data-popover\": \".color-picker-popover\"\n }, self.params.toolbarCloseText))));\n }\n renderInline() {\n const self = this;\n const {\n cssClass,\n groupedModules\n } = self.params;\n return $jsx(\"div\", {\n class: `color-picker color-picker-inline ${groupedModules ? 'color-picker-grouped-modules' : ''} ${cssClass || ''}`\n }, self.renderPicker());\n }\n renderSheet() {\n const self = this;\n const {\n cssClass,\n toolbarSheet,\n groupedModules\n } = self.params;\n return $jsx(\"div\", {\n class: `sheet-modal color-picker color-picker-sheet-modal ${groupedModules ? 'color-picker-grouped-modules' : ''} ${cssClass || ''}`\n }, toolbarSheet && self.renderToolbar(), $jsx(\"div\", {\n class: \"sheet-modal-inner\"\n }, $jsx(\"div\", {\n class: \"page-content\"\n }, self.renderPicker())));\n }\n renderPopover() {\n const self = this;\n const {\n cssClass,\n toolbarPopover,\n groupedModules\n } = self.params;\n return $jsx(\"div\", {\n class: `popover color-picker-popover ${cssClass || ''}`\n }, $jsx(\"div\", {\n class: \"popover-inner\"\n }, $jsx(\"div\", {\n class: `color-picker ${groupedModules ? 'color-picker-grouped-modules' : ''}`\n }, toolbarPopover && self.renderToolbar(), $jsx(\"div\", {\n class: \"page-content\"\n }, self.renderPicker()))));\n }\n renderPopup() {\n const self = this;\n const {\n cssClass,\n navbarPopup,\n groupedModules\n } = self.params;\n return $jsx(\"div\", {\n class: `popup color-picker-popup ${cssClass || ''}`\n }, $jsx(\"div\", {\n class: \"page\"\n }, navbarPopup && self.renderNavbar(), $jsx(\"div\", {\n class: `color-picker ${groupedModules ? 'color-picker-grouped-modules' : ''}`\n }, $jsx(\"div\", {\n class: \"page-content\"\n }, self.renderPicker()))));\n }\n renderPage() {\n const self = this;\n const {\n cssClass,\n groupedModules\n } = self.params;\n return $jsx(\"div\", {\n class: `page color-picker-page ${cssClass || ''}`,\n \"data-name\": \"color-picker-page\"\n }, self.renderNavbar(), $jsx(\"div\", {\n class: `color-picker ${groupedModules ? 'color-picker-grouped-modules' : ''}`\n }, $jsx(\"div\", {\n class: \"page-content\"\n }, self.renderPicker())));\n }\n\n // eslint-disable-next-line\n render() {\n const self = this;\n const {\n params\n } = self;\n if (params.render) return params.render.call(self);\n if (self.inline) return self.renderInline();\n if (params.openIn === 'page') {\n return self.renderPage();\n }\n const modalType = self.getModalType();\n if (modalType === 'popover') return self.renderPopover();\n if (modalType === 'sheet') return self.renderSheet();\n if (modalType === 'popup') return self.renderPopup();\n }\n onOpen() {\n const self = this;\n const {\n initialized,\n $el,\n app,\n $inputEl,\n inline,\n value,\n params,\n modules\n } = self;\n self.closing = false;\n self.opened = true;\n self.opening = true;\n\n // Init main events\n self.attachEvents();\n params.modules.forEach(m => {\n if (typeof m === 'string' && modules[m] && modules[m].init) {\n modules[m].init(self);\n } else if (m && m.init) {\n m.init(self);\n }\n });\n const updateValue = !value && params.value;\n\n // Set value\n if (!initialized) {\n if (value) self.setValue(value);else if (params.value) {\n self.setValue(params.value, false);\n } else if (!params.value) {\n self.setValue({\n hex: '#ff0000'\n }, false);\n }\n } else if (value) {\n self.initialValue = extend({}, value);\n self.setValue(value, false);\n }\n\n // Update input value\n if (updateValue) self.updateValue();\n self.updateModules();\n\n // Center modules\n if (params.centerModules) {\n self.centerModules();\n }\n\n // Extra focus\n if (!inline && $inputEl && $inputEl.length && app.theme === 'md') {\n $inputEl.trigger('focus');\n }\n self.initialized = true;\n\n // Trigger events\n if ($el) {\n $el.trigger('colorpicker:open');\n }\n if ($inputEl) {\n $inputEl.trigger('colorpicker:open');\n }\n self.emit('local::open colorPickerOpen', self);\n }\n onOpened() {\n const self = this;\n self.opening = false;\n if (self.$el) {\n self.$el.trigger('colorpicker:opened');\n }\n if (self.$inputEl) {\n self.$inputEl.trigger('colorpicker:opened');\n }\n self.emit('local::opened colorPickerOpened', self);\n }\n onClose() {\n const self = this;\n const {\n app,\n params,\n modules\n } = self;\n self.opening = false;\n self.closing = true;\n\n // Detach events\n self.detachEvents();\n if (self.$inputEl) {\n if (app.theme === 'md') {\n self.$inputEl.trigger('blur');\n } else {\n const validate = self.$inputEl.attr('validate');\n const required = self.$inputEl.attr('required');\n if (validate && required) {\n app.input.validate(self.$inputEl);\n }\n }\n }\n params.modules.forEach(m => {\n if (typeof m === 'string' && modules[m] && modules[m].destroy) {\n modules[m].destroy(self);\n } else if (m && m.destroy) {\n m.destroy(self);\n }\n });\n if (self.$el) {\n self.$el.trigger('colorpicker:close');\n }\n if (self.$inputEl) {\n self.$inputEl.trigger('colorpicker:close');\n }\n self.emit('local::close colorPickerClose', self);\n }\n onClosed() {\n const self = this;\n self.opened = false;\n self.closing = false;\n if (!self.inline) {\n nextTick(() => {\n if (self.modal && self.modal.el && self.modal.destroy) {\n if (!self.params.routableModals) {\n self.modal.destroy();\n }\n }\n delete self.modal;\n });\n }\n if (self.$el) {\n self.$el.trigger('colorpicker:closed');\n }\n if (self.$inputEl) {\n self.$inputEl.trigger('colorpicker:closed');\n }\n self.emit('local::closed colorPickerClosed', self);\n }\n open() {\n const self = this;\n const {\n app,\n opened,\n inline,\n $inputEl,\n $targetEl,\n params\n } = self;\n if (opened) return;\n if (inline) {\n self.$el = $(self.render());\n self.$el[0].f7ColorPicker = self;\n self.$containerEl.append(self.$el);\n self.onOpen();\n self.onOpened();\n return;\n }\n const colorPickerContent = self.render();\n if (params.openIn === 'page') {\n self.view.router.navigate({\n url: self.url,\n route: {\n content: colorPickerContent,\n path: self.url,\n on: {\n pageBeforeIn(e, page) {\n self.$el = page.$el.find('.color-picker');\n self.$el[0].f7ColorPicker = self;\n self.onOpen();\n },\n pageAfterIn() {\n self.onOpened();\n },\n pageBeforeOut() {\n self.onClose();\n },\n pageAfterOut() {\n self.onClosed();\n if (self.$el && self.$el[0]) {\n self.$el[0].f7ColorPicker = null;\n delete self.$el[0].f7ColorPicker;\n }\n }\n }\n }\n });\n } else {\n const modalType = self.getModalType();\n let backdrop = params.backdrop;\n if (backdrop === null || typeof backdrop === 'undefined') {\n if (modalType === 'popover' && app.params.popover.backdrop !== false) backdrop = true;\n if (modalType === 'popup') backdrop = true;\n }\n const modalParams = {\n targetEl: $targetEl || $inputEl,\n scrollToEl: params.scrollToInput ? $targetEl || $inputEl : undefined,\n content: colorPickerContent,\n backdrop,\n closeByBackdropClick: params.closeByBackdropClick,\n on: {\n open() {\n const modal = this;\n self.modal = modal;\n self.$el = modalType === 'popover' || modalType === 'popup' ? modal.$el.find('.color-picker') : modal.$el;\n self.$el[0].f7ColorPicker = self;\n self.onOpen();\n },\n opened() {\n self.onOpened();\n },\n close() {\n self.onClose();\n },\n closed() {\n self.onClosed();\n if (self.$el && self.$el[0]) {\n self.$el[0].f7ColorPicker = null;\n delete self.$el[0].f7ColorPicker;\n }\n }\n }\n };\n if (modalType === 'popup') {\n modalParams.push = params.popupPush;\n modalParams.swipeToClose = params.popupSwipeToClose;\n }\n if (modalType === 'sheet') {\n modalParams.push = params.sheetPush;\n modalParams.swipeToClose = params.sheetSwipeToClose;\n }\n if (params.routableModals && self.view) {\n self.view.router.navigate({\n url: self.url,\n route: {\n path: self.url,\n [modalType]: modalParams\n }\n });\n } else {\n self.modal = app[modalType].create(modalParams);\n self.modal.open();\n }\n }\n }\n close() {\n const self = this;\n const {\n opened,\n inline\n } = self;\n if (!opened) return;\n if (inline) {\n self.onClose();\n self.onClosed();\n return;\n }\n if (self.params.routableModals && self.view || self.params.openIn === 'page') {\n self.view.router.back();\n } else {\n self.modal.close();\n }\n }\n init() {\n const self = this;\n self.initInput();\n if (self.inline) {\n self.open();\n self.emit('local::init colorPickerInit', self);\n return;\n }\n if (!self.initialized && self.params.value) {\n self.setValue(self.params.value);\n }\n\n // Attach input Events\n if (self.$inputEl) {\n self.attachInputEvents();\n }\n if (self.$targetEl) {\n self.attachTargetEvents();\n }\n if (self.params.closeByOutsideClick) {\n self.attachHtmlEvents();\n }\n self.emit('local::init colorPickerInit', self);\n }\n destroy() {\n const self = this;\n if (self.destroyed) return;\n const {\n $el\n } = self;\n self.emit('local::beforeDestroy colorPickerBeforeDestroy', self);\n if ($el) $el.trigger('colorpicker:beforedestroy');\n self.close();\n\n // Detach Events\n self.detachEvents();\n if (self.$inputEl) {\n self.detachInputEvents();\n }\n if (self.$targetEl) {\n self.detachTargetEvents();\n }\n if (self.params.closeByOutsideClick) {\n self.detachHtmlEvents();\n }\n if ($el && $el.length) delete self.$el[0].f7ColorPicker;\n deleteProps(self);\n self.destroyed = true;\n }\n}\nexport default ColorPicker;", "import $ from '../../shared/dom7.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nimport ColorPicker from './color-picker-class.js';\nexport default {\n name: 'colorPicker',\n static: {\n ColorPicker\n },\n create() {\n const app = this;\n app.colorPicker = ConstructorMethods({\n defaultSelector: '.color-picker',\n constructor: ColorPicker,\n app,\n domProp: 'f7ColorPicker'\n });\n app.colorPicker.close = function close(el) {\n if (el === void 0) {\n el = '.color-picker';\n }\n const $el = $(el);\n if ($el.length === 0) return;\n const colorPicker = $el[0].f7ColorPicker;\n if (!colorPicker || colorPicker && !colorPicker.opened) return;\n colorPicker.close();\n };\n },\n params: {\n colorPicker: {\n // Color picker settings\n value: null,\n modules: ['wheel'],\n palette: [['#FFEBEE', '#FFCDD2', '#EF9A9A', '#E57373', '#EF5350', '#F44336', '#E53935', '#D32F2F', '#C62828', '#B71C1C'], ['#F3E5F5', '#E1BEE7', '#CE93D8', '#BA68C8', '#AB47BC', '#9C27B0', '#8E24AA', '#7B1FA2', '#6A1B9A', '#4A148C'], ['#E8EAF6', '#C5CAE9', '#9FA8DA', '#7986CB', '#5C6BC0', '#3F51B5', '#3949AB', '#303F9F', '#283593', '#1A237E'], ['#E1F5FE', '#B3E5FC', '#81D4FA', '#4FC3F7', '#29B6F6', '#03A9F4', '#039BE5', '#0288D1', '#0277BD', '#01579B'], ['#E0F2F1', '#B2DFDB', '#80CBC4', '#4DB6AC', '#26A69A', '#009688', '#00897B', '#00796B', '#00695C', '#004D40'], ['#F1F8E9', '#DCEDC8', '#C5E1A5', '#AED581', '#9CCC65', '#8BC34A', '#7CB342', '#689F38', '#558B2F', '#33691E'], ['#FFFDE7', '#FFF9C4', '#FFF59D', '#FFF176', '#FFEE58', '#FFEB3B', '#FDD835', '#FBC02D', '#F9A825', '#F57F17'], ['#FFF3E0', '#FFE0B2', '#FFCC80', '#FFB74D', '#FFA726', '#FF9800', '#FB8C00', '#F57C00', '#EF6C00', '#E65100']],\n groupedModules: false,\n centerModules: true,\n sliderLabel: false,\n sliderValue: false,\n sliderValueEdiable: false,\n barLabel: false,\n barValue: false,\n barValueEdiable: false,\n hexLabel: false,\n hexValueEditable: false,\n redLabelText: 'R',\n greenLabelText: 'G',\n blueLabelText: 'B',\n hueLabelText: 'H',\n saturationLabelText: 'S',\n brightnessLabelText: 'B',\n hexLabelText: 'HEX',\n alphaLabelText: 'A',\n // Common opener settings\n containerEl: null,\n openIn: 'popover',\n // or 'popover' or 'sheet' or 'popup' or 'page' or 'auto'\n openInPhone: 'popup',\n // or 'popover' or 'sheet' or 'popup' or 'page'\n popupPush: false,\n popupSwipeToClose: undefined,\n sheetPush: false,\n sheetSwipeToClose: undefined,\n formatValue: null,\n targetEl: null,\n targetElSetBackgroundColor: false,\n inputEl: null,\n inputReadOnly: true,\n closeByOutsideClick: true,\n scrollToInput: true,\n toolbarSheet: true,\n toolbarPopover: false,\n toolbarCloseText: 'Done',\n navbarPopup: true,\n navbarCloseText: 'Done',\n navbarTitleText: 'Color',\n navbarBackLinkText: 'Back',\n cssClass: null,\n routableModals: false,\n view: null,\n url: 'color/',\n backdrop: null,\n closeByBackdropClick: true,\n // Render functions\n renderToolbar: null,\n renderNavbar: null,\n renderInline: null,\n renderPopover: null,\n renderSheet: null,\n renderPopup: null,\n render: null\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { bindMethods, iosPreloaderContent, mdPreloaderContent } from '../../shared/utils.js';\nconst Treeview = {\n open(itemEl) {\n const app = this;\n const $itemEl = $(itemEl).eq(0);\n if (!$itemEl.length) return;\n $itemEl.addClass('treeview-item-opened');\n $itemEl.trigger('treeview:open');\n app.emit('treeviewOpen', $itemEl[0]);\n function done(cancel) {\n if (cancel) {\n $itemEl.removeClass('treeview-item-opened');\n $itemEl.trigger('treeview:close');\n app.emit('treeviewClose', $itemEl[0]);\n } else {\n $itemEl[0].f7TreeviewChildrenLoaded = true;\n }\n $itemEl.find('.treeview-toggle').removeClass('treeview-toggle-hidden');\n $itemEl.find('.treeview-preloader').remove();\n }\n if ($itemEl.hasClass('treeview-load-children') && !$itemEl[0].f7TreeviewChildrenLoaded) {\n const preloaders = {\n iosPreloaderContent,\n mdPreloaderContent\n };\n $itemEl.trigger('treeview:loadchildren', done);\n app.emit('treeviewLoadChildren', $itemEl[0], done);\n $itemEl.find('.treeview-toggle').addClass('treeview-toggle-hidden');\n $itemEl.find('.treeview-item-root').prepend(`${preloaders[`${app.theme}PreloaderContent`]}
`);\n }\n },\n close(itemEl) {\n const app = this;\n const $itemEl = $(itemEl).eq(0);\n if (!$itemEl.length) return;\n $itemEl.removeClass('treeview-item-opened');\n $itemEl.trigger('treeview:close');\n app.emit('treeviewClose', $itemEl[0]);\n },\n toggle(itemEl) {\n const app = this;\n const $itemEl = $(itemEl).eq(0);\n if (!$itemEl.length) return;\n const wasOpened = $itemEl.hasClass('treeview-item-opened');\n app.treeview[wasOpened ? 'close' : 'open']($itemEl);\n }\n};\nexport default {\n name: 'treeview',\n create() {\n const app = this;\n bindMethods(app, {\n treeview: Treeview\n });\n },\n clicks: {\n '.treeview-toggle': function toggle($clickedEl, clickedData, e) {\n const app = this;\n if ($clickedEl.parents('.treeview-item-toggle').length) return;\n const $treeviewItemEl = $clickedEl.parents('.treeview-item').eq(0);\n if (!$treeviewItemEl.length) return;\n e.preventF7Router = true;\n app.treeview.toggle($treeviewItemEl[0]);\n },\n '.treeview-item-toggle': function toggle($clickedEl, clickedData, e) {\n const app = this;\n const $treeviewItemEl = $clickedEl.closest('.treeview-item').eq(0);\n if (!$treeviewItemEl.length) return;\n e.preventF7Router = true;\n app.treeview.toggle($treeviewItemEl[0]);\n }\n }\n};", "import { getWindow, getDocument } from 'ssr-window';\nimport $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\nimport { getDevice } from '../../shared/get-device.js';\nconst textEditorButtonsMap = {\n // f7-icon, material-icon, command\n bold: ['bold', 'format_bold', 'bold'],\n italic: ['italic', 'format_italic', 'italic'],\n underline: ['underline', 'format_underlined', 'underline'],\n strikeThrough: ['strikethrough', 'strikethrough_s', 'strikeThrough'],\n orderedList: ['list_number', 'format_list_numbered', 'insertOrderedList'],\n unorderedList: ['list_bullet', 'format_list_bulleted', 'insertUnorderedList'],\n link: ['link', 'link', 'createLink'],\n image: ['photo', 'image', 'insertImage'],\n paragraph: ['paragraph', '\u00B6', 'formatBlock.P'],\n h1: ['H1', 'H1', 'formatBlock.H1'],\n h2: ['H2', 'H2', 'formatBlock.H2'],\n h3: ['H3', 'H3', 'formatBlock.H3'],\n alignLeft: ['text_alignleft', 'format_align_left', 'justifyLeft'],\n alignCenter: ['text_aligncenter', 'format_align_center', 'justifyCenter'],\n alignRight: ['text_alignright', 'format_align_right', 'justifyRight'],\n alignJustify: ['text_justify', 'format_align_justify', 'justifyFull'],\n subscript: ['textformat_subscript', 'A1', 'subscript'],\n superscript: ['textformat_superscript', 'A1', 'superscript'],\n indent: ['increase_indent', 'format_indent_increase', 'indent'],\n outdent: ['decrease_indent', 'format_indent_decrease', 'outdent']\n};\nclass TextEditor extends Framework7Class {\n constructor(app, params) {\n super(params, [app]);\n const self = this;\n const document = getDocument();\n const device = getDevice();\n const defaults = extend({}, app.params.textEditor);\n\n // Extend defaults with modules params\n self.useModulesParams(defaults);\n self.params = extend(defaults, params);\n const el = self.params.el;\n if (!el) return self;\n const $el = $(el);\n if ($el.length === 0) return self;\n if ($el[0].f7TextEditor) return $el[0].f7TextEditor;\n let $contentEl = $el.children('.text-editor-content');\n if (!$contentEl.length) {\n $el.append('');\n $contentEl = $el.children('.text-editor-content');\n }\n extend(self, {\n app,\n $el,\n el: $el[0],\n $contentEl,\n contentEl: $contentEl[0]\n });\n if ('value' in params) {\n self.value = self.params.value;\n }\n if (self.params.mode === 'keyboard-toolbar') {\n if (!(device.cordova || device.capacitor) && !device.android) {\n self.params.mode = 'popover';\n }\n }\n if (typeof self.params.buttons === 'string') {\n try {\n self.params.buttons = JSON.parse(self.params.buttons);\n } catch (err) {\n throw new Error('Framework7: TextEditor: wrong \"buttons\" parameter format');\n }\n }\n $el[0].f7TextEditor = self;\n\n // Bind\n self.onButtonClick = self.onButtonClick.bind(self);\n self.onFocus = self.onFocus.bind(self);\n self.onBlur = self.onBlur.bind(self);\n self.onInput = self.onInput.bind(self);\n self.onPaste = self.onPaste.bind(self);\n self.onSelectionChange = self.onSelectionChange.bind(self);\n self.closeKeyboardToolbar = self.closeKeyboardToolbar.bind(self);\n\n // Handle Events\n self.attachEvents = function attachEvents() {\n if (self.params.mode === 'toolbar') {\n self.$el.find('.text-editor-toolbar').on('click', 'button', self.onButtonClick);\n }\n if (self.params.mode === 'keyboard-toolbar') {\n self.$keyboardToolbarEl.on('click', 'button', self.onButtonClick);\n self.$el.parents('.page').on('page:beforeout', self.closeKeyboardToolbar);\n }\n if (self.params.mode === 'popover' && self.popover) {\n self.popover.$el.on('click', 'button', self.onButtonClick);\n }\n self.$contentEl.on('paste', self.onPaste);\n self.$contentEl.on('focus', self.onFocus);\n self.$contentEl.on('blur', self.onBlur);\n self.$contentEl.on('input', self.onInput, true);\n $(document).on('selectionchange', self.onSelectionChange);\n };\n self.detachEvents = function detachEvents() {\n if (self.params.mode === 'toolbar') {\n self.$el.find('.text-editor-toolbar').off('click', 'button', self.onButtonClick);\n }\n if (self.params.mode === 'keyboard-toolbar') {\n self.$keyboardToolbarEl.off('click', 'button', self.onButtonClick);\n self.$el.parents('.page').off('page:beforeout', self.closeKeyboardToolbar);\n }\n if (self.params.mode === 'popover' && self.popover) {\n self.popover.$el.off('click', 'button', self.onButtonClick);\n }\n self.$contentEl.off('paste', self.onPaste);\n self.$contentEl.off('focus', self.onFocus);\n self.$contentEl.off('blur', self.onBlur);\n self.$contentEl.off('input', self.onInput, true);\n $(document).off('selectionchange', self.onSelectionChange);\n };\n\n // Install Modules\n self.useModules();\n\n // Init\n self.init();\n return self;\n }\n setValue(newValue) {\n const self = this;\n const currentValue = self.value;\n if (currentValue === newValue) return self;\n self.value = newValue;\n self.$contentEl.html(newValue);\n self.$el.trigger('texteditor:change', self.value);\n self.emit('local::change textEditorChange', self, self.value);\n return self;\n }\n getValue() {\n const self = this;\n return self.value;\n }\n clearValue() {\n const self = this;\n self.setValue('');\n if (self.params.placeholder && !self.$contentEl.html()) {\n self.insertPlaceholder();\n }\n return self;\n }\n createLink() {\n const self = this;\n const window = getWindow();\n const document = getDocument();\n const currentSelection = window.getSelection();\n const selectedNodes = [];\n let $selectedLinks;\n if (currentSelection && currentSelection.anchorNode && $(currentSelection.anchorNode).parents(self.$el).length) {\n let anchorNode = currentSelection.anchorNode;\n while (anchorNode) {\n selectedNodes.push(anchorNode);\n if (!anchorNode.nextSibling || anchorNode === currentSelection.focusNode) {\n anchorNode = null;\n }\n if (anchorNode) {\n anchorNode = anchorNode.nextSibling;\n }\n }\n const selectedNodesLinks = [];\n const $selectedNodes = $(selectedNodes);\n for (let i = 0; i < $selectedNodes.length; i += 1) {\n const childNodes = $selectedNodes[i].children;\n if (childNodes) {\n for (let j = 0; j < childNodes.length; j += 1) {\n if ($(childNodes[j]).is('a')) {\n selectedNodesLinks.push(childNodes[j]);\n }\n }\n }\n }\n $selectedLinks = $selectedNodes.closest('a').add($(selectedNodesLinks));\n }\n if ($selectedLinks && $selectedLinks.length) {\n $selectedLinks.each(linkNode => {\n const selection = window.getSelection();\n const range = document.createRange();\n range.selectNodeContents(linkNode);\n selection.removeAllRanges();\n selection.addRange(range);\n document.execCommand('unlink', false);\n selection.removeAllRanges();\n });\n return self;\n }\n const currentRange = self.getSelectionRange();\n if (!currentRange) return self;\n const dialog = self.app.dialog.prompt('', self.params.linkUrlText, link => {\n if (link && link.trim().length) {\n self.setSelectionRange(currentRange);\n document.execCommand('createLink', false, link.trim());\n self.$el.trigger('texteditor:insertlink', {\n url: link.trim()\n });\n self.emit('local:insertLink textEditorInsertLink', self, link.trim());\n }\n });\n dialog.$el.find('input').focus();\n return self;\n }\n insertImage() {\n const self = this;\n const document = getDocument();\n const currentRange = self.getSelectionRange();\n if (!currentRange) return self;\n const dialog = self.app.dialog.prompt('', self.params.imageUrlText, imageUrl => {\n if (imageUrl && imageUrl.trim().length) {\n self.setSelectionRange(currentRange);\n document.execCommand('insertImage', false, imageUrl.trim());\n self.$el.trigger('texteditor:insertimage', {\n url: imageUrl.trim()\n });\n self.emit('local:insertImage textEditorInsertImage', self, imageUrl.trim());\n }\n });\n dialog.$el.find('input').focus();\n return self;\n }\n removePlaceholder() {\n const self = this;\n self.$contentEl.find('.text-editor-placeholder').remove();\n }\n insertPlaceholder() {\n const self = this;\n self.$contentEl.append(`${self.params.placeholder}
`);\n }\n onSelectionChange() {\n const self = this;\n const window = getWindow();\n const document = getDocument();\n if (self.params.mode === 'toolbar') return;\n const selection = window.getSelection();\n const selectionIsInContent = $(selection.anchorNode).parents(self.contentEl).length || selection.anchorNode === self.contentEl;\n if (self.params.mode === 'keyboard-toolbar') {\n if (!selectionIsInContent) {\n self.closeKeyboardToolbar();\n } else {\n self.openKeyboardToolbar();\n }\n return;\n }\n if (self.params.mode === 'popover') {\n const selectionIsInPopover = $(selection.anchorNode).parents(self.popover.el).length || selection.anchorNode === self.popover.el;\n if (!selectionIsInContent && !selectionIsInPopover) {\n self.closePopover();\n return;\n }\n if (!selection.isCollapsed && selection.rangeCount) {\n const range = selection.getRangeAt(0);\n const rect = range.getBoundingClientRect();\n const rootEl = self.app.$el[0] || document.body;\n self.openPopover(rect.x + (window.scrollX || 0) - rootEl.offsetLeft, rect.y + (window.scrollY || 0) - rootEl.offsetTop, rect.width, rect.height);\n } else if (selection.isCollapsed) {\n self.closePopover();\n }\n }\n }\n onPaste(e) {\n const self = this;\n const document = getDocument();\n if (self.params.clearFormattingOnPaste && e.clipboardData && e.clipboardData.getData) {\n const text = e.clipboardData.getData('text/plain');\n e.preventDefault();\n document.execCommand('insertText', false, text);\n }\n }\n onInput() {\n const self = this;\n const value = self.$contentEl.html();\n self.value = value;\n self.$el.trigger('texteditor:input');\n self.emit('local:input textEditorInput', self, self.value);\n self.$el.trigger('texteditor:change', self.value);\n self.emit('local::change textEditorChange', self, self.value);\n }\n onFocus() {\n const self = this;\n self.removePlaceholder();\n self.$contentEl.focus();\n self.$el.trigger('texteditor:focus');\n self.emit('local::focus textEditorFocus', self);\n }\n onBlur() {\n const self = this;\n const window = getWindow();\n const document = getDocument();\n if (self.params.placeholder && self.$contentEl.html() === '') {\n self.insertPlaceholder();\n }\n if (self.params.mode === 'popover') {\n const selection = window.getSelection();\n const selectionIsInContent = $(selection.anchorNode).parents(self.contentEl).length || selection.anchorNode === self.contentEl;\n const inPopover = document.activeElement && self.popover && $(document.activeElement).closest(self.popover.$el).length;\n if (!inPopover && !selectionIsInContent) {\n self.closePopover();\n }\n }\n if (self.params.mode === 'keyboard-toolbar') {\n const selection = window.getSelection();\n const selectionIsInContent = $(selection.anchorNode).parents(self.contentEl).length || selection.anchorNode === self.contentEl;\n if (!selectionIsInContent) {\n self.closeKeyboardToolbar();\n }\n }\n self.$el.trigger('texteditor:blur');\n self.emit('local::blur textEditorBlur', self);\n }\n onButtonClick(e) {\n const self = this;\n const window = getWindow();\n const document = getDocument();\n const selection = window.getSelection();\n const selectionIsInContent = $(selection.anchorNode).parents(self.contentEl).length || selection.anchorNode === self.contentEl;\n if (!selectionIsInContent) return;\n const $buttonEl = $(e.target).closest('button');\n if ($buttonEl.parents('form').length) {\n e.preventDefault();\n }\n const button = $buttonEl.attr('data-button');\n const buttonData = self.params.customButtons && self.params.customButtons[button];\n if (!button || !(textEditorButtonsMap[button] || buttonData)) return;\n $buttonEl.trigger('texteditor:buttonclick', button);\n self.emit('local::buttonClick textEditorButtonClick', self, button);\n if (buttonData) {\n if (buttonData.onClick) buttonData.onClick(self, $buttonEl[0]);\n return;\n }\n const command = textEditorButtonsMap[button][2];\n if (command === 'createLink') {\n self.createLink();\n return;\n }\n if (command === 'insertImage') {\n self.insertImage();\n return;\n }\n if (command.indexOf('formatBlock') === 0) {\n const tagName = command.split('.')[1];\n const $anchorNode = $(selection.anchorNode);\n if ($anchorNode.parents(tagName.toLowerCase()).length || $anchorNode.is(tagName)) {\n document.execCommand('formatBlock', false, 'div');\n } else {\n document.execCommand('formatBlock', false, tagName);\n }\n return;\n }\n document.execCommand(command, false);\n }\n\n // eslint-disable-next-line\n getSelectionRange() {\n const window = getWindow();\n const document = getDocument();\n if (window.getSelection) {\n const sel = window.getSelection();\n if (sel.getRangeAt && sel.rangeCount) {\n return sel.getRangeAt(0);\n }\n } else if (document.selection && document.selection.createRange) {\n return document.selection.createRange();\n }\n return null;\n }\n\n // eslint-disable-next-line\n setSelectionRange(range) {\n const window = getWindow();\n const document = getDocument();\n if (range) {\n if (window.getSelection) {\n const sel = window.getSelection();\n sel.removeAllRanges();\n sel.addRange(range);\n } else if (document.selection && range.select) {\n range.select();\n }\n }\n }\n renderButtons() {\n const self = this;\n let html = '';\n function renderButton(button) {\n const iconClass = self.app.theme === 'md' ? 'material-icons' : 'f7-icons';\n if (self.params.customButtons && self.params.customButtons[button]) {\n const buttonData = self.params.customButtons[button];\n return ``;\n }\n if (!textEditorButtonsMap[button]) return '';\n const iconContent = textEditorButtonsMap[button][self.app.theme === 'md' ? 1 : 0];\n return ``.trim();\n }\n self.params.buttons.forEach((button, buttonIndex) => {\n if (Array.isArray(button)) {\n button.forEach(b => {\n html += renderButton(b);\n });\n if (buttonIndex < self.params.buttons.length - 1 && self.params.dividers) {\n html += '';\n }\n } else {\n html += renderButton(button);\n }\n });\n return html;\n }\n createToolbar() {\n const self = this;\n self.$el.prepend(`${self.renderButtons()}
`);\n }\n createKeyboardToolbar() {\n const self = this;\n self.$keyboardToolbarEl = $(``);\n }\n createPopover() {\n const self = this;\n self.popover = self.app.popover.create({\n content: `\n \n
${self.renderButtons()}
\n
\n `,\n closeByOutsideClick: false,\n backdrop: false\n });\n }\n openKeyboardToolbar() {\n const self = this;\n if (self.$keyboardToolbarEl.parent(self.app.$el).length) return;\n self.$el.trigger('texteditor:keyboardopen');\n self.emit('local::keyboardOpen textEditorKeyboardOpen', self);\n self.app.$el.append(self.$keyboardToolbarEl);\n }\n closeKeyboardToolbar() {\n const self = this;\n self.$keyboardToolbarEl.remove();\n self.$el.trigger('texteditor:keyboardclose');\n self.emit('local::keyboardClose textEditorKeyboardClose', self);\n }\n openPopover(targetX, targetY, targetWidth, targetHeight) {\n const self = this;\n if (!self.popover) return;\n Object.assign(self.popover.params, {\n targetX,\n targetY,\n targetWidth,\n targetHeight\n });\n clearTimeout(self.popoverTimeout);\n self.popoverTimeout = setTimeout(() => {\n if (!self.popover) return;\n if (self.popover.opened) {\n self.popover.resize();\n } else {\n self.$el.trigger('texteditor:popoveropen');\n self.emit('local::popoverOpen textEditorPopoverOpen', self);\n self.popover.open();\n }\n }, 400);\n }\n closePopover() {\n const self = this;\n clearTimeout(self.popoverTimeout);\n if (!self.popover || !self.popover.opened) return;\n self.popoverTimeout = setTimeout(() => {\n if (!self.popover) return;\n self.$el.trigger('texteditor:popoverclose');\n self.emit('local::popoverClose textEditorPopoverClose', self);\n self.popover.close();\n }, 400);\n }\n init() {\n const self = this;\n if (self.value) {\n self.$contentEl.html(self.value);\n } else {\n self.value = self.$contentEl.html();\n }\n if (self.params.placeholder && self.value === '') {\n self.insertPlaceholder();\n }\n if (self.params.mode === 'toolbar') {\n self.createToolbar();\n } else if (self.params.mode === 'popover') {\n self.createPopover();\n } else if (self.params.mode === 'keyboard-toolbar') {\n self.createKeyboardToolbar();\n }\n self.attachEvents();\n self.$el.trigger('texteditor:init');\n self.emit('local::init textEditorInit', self);\n return self;\n }\n destroy() {\n let self = this;\n self.$el.trigger('texteditor:beforedestroy');\n self.emit('local::beforeDestroy textEditorBeforeDestroy', self);\n self.detachEvents();\n if (self.params.mode === 'keyboard-toolbar' && self.$keyboardToolbarEl) {\n self.$keyboardToolbarEl.remove();\n }\n if (self.popover) {\n self.popover.close(false);\n self.popover.destroy();\n }\n delete self.$el[0].f7TextEditor;\n deleteProps(self);\n self = null;\n }\n}\nexport default TextEditor;", "import $ from '../../shared/dom7.js';\nimport { extend } from '../../shared/utils.js';\nimport TextEditor from './text-editor-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'textEditor',\n params: {\n textEditor: {\n el: null,\n mode: 'toolbar',\n // or 'popover'\n value: undefined,\n // will use html content\n customButtons: null,\n buttons: [['bold', 'italic', 'underline', 'strikeThrough'], ['orderedList', 'unorderedList'], ['link', 'image'], ['paragraph', 'h1', 'h2', 'h3'], ['alignLeft', 'alignCenter', 'alignRight', 'alignJustify'], ['subscript', 'superscript'], ['indent', 'outdent']],\n dividers: true,\n imageUrlText: 'Insert image URL',\n linkUrlText: 'Insert link URL',\n placeholder: null,\n clearFormattingOnPaste: true\n }\n },\n create() {\n const app = this;\n app.textEditor = extend(ConstructorMethods({\n defaultSelector: '.text-editor',\n constructor: TextEditor,\n app,\n domProp: 'f7TextEditor'\n }));\n },\n static: {\n TextEditor\n },\n on: {\n tabMounted(tabEl) {\n const app = this;\n $(tabEl).find('.text-editor-init').each(editorEl => {\n const dataset = $(editorEl).dataset();\n app.textEditor.create(extend({\n el: editorEl\n }, dataset || {}));\n });\n },\n tabBeforeRemove(tabEl) {\n $(tabEl).find('.text-editor-init').each(editorEl => {\n if (editorEl.f7TextEditor) editorEl.f7TextEditor.destroy();\n });\n },\n pageInit(page) {\n const app = this;\n page.$el.find('.text-editor-init').each(editorEl => {\n const dataset = $(editorEl).dataset();\n app.textEditor.create(extend({\n el: editorEl\n }, dataset || {}));\n });\n },\n pageBeforeRemove(page) {\n page.$el.find('.text-editor-init').each(editorEl => {\n if (editorEl.f7TextEditor) editorEl.f7TextEditor.destroy();\n });\n }\n },\n vnode: {\n 'text-editor-init': {\n insert(vnode) {\n const app = this;\n const editorEl = vnode.elm;\n const dataset = $(editorEl).dataset();\n app.textEditor.create(extend({\n el: editorEl\n }, dataset || {}));\n },\n destroy(vnode) {\n const editorEl = vnode.elm;\n if (editorEl.f7TextEditor) editorEl.f7TextEditor.destroy();\n }\n }\n }\n};", "import $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass PieChart extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const self = this;\n const defaults = extend({}, app.params.pieChart);\n\n // Extend defaults with modules params\n self.useModulesParams(defaults);\n self.params = extend(defaults, params);\n const {\n el\n } = self.params;\n if (!el) return self;\n const $el = $(el);\n if ($el.length === 0) return self;\n if ($el[0].f7PieChart) return $el[0].f7PieChart;\n extend(self, {\n app,\n $el,\n el: $el && $el[0],\n currentIndex: null,\n f7Tooltip: null\n });\n $el[0].f7PieChart = self;\n\n // Install Modules\n self.useModules();\n self.showTooltip = self.showTooltip.bind(this);\n self.hideTooltip = self.hideTooltip.bind(this);\n self.init();\n return self;\n }\n getSummValue() {\n const {\n datasets\n } = this.params;\n let summ = 0;\n datasets.map(d => d.value || 0).forEach(value => {\n summ += value;\n });\n return summ;\n }\n getPaths() {\n const {\n datasets,\n size\n } = this.params;\n const paths = [];\n let cumulativePercentage = 0;\n function getCoordinatesForPercentage(percentage) {\n const x = Math.cos(2 * Math.PI * percentage) * (size / 3);\n const y = Math.sin(2 * Math.PI * percentage) * (size / 3);\n return [x, y];\n }\n datasets.forEach(_ref => {\n let {\n value,\n label,\n color\n } = _ref;\n const percentage = value / this.getSummValue();\n const [startX, startY] = getCoordinatesForPercentage(cumulativePercentage);\n cumulativePercentage += percentage;\n const [endX, endY] = getCoordinatesForPercentage(cumulativePercentage);\n const largeArcFlag = percentage > 0.5 ? 1 : 0;\n const points = [`M ${startX} ${startY}`,\n // Move\n `A ${size / 3} ${size / 3} 0 ${largeArcFlag} 1 ${endX} ${endY}`,\n // Arc\n 'L 0 0' // Line\n ].join(' ');\n paths.push({\n points,\n label,\n color\n });\n });\n return paths;\n }\n formatTooltipText() {\n const {\n datasets\n } = this.params;\n const {\n currentIndex\n } = this;\n if (currentIndex === null) return '';\n const {\n value,\n label,\n color\n } = datasets[currentIndex];\n const percentage = value / this.getSummValue() * 100;\n const round = v => {\n if (parseInt(v, 10) === v) return v;\n return Math.round(v * 100) / 100;\n };\n if (this.params.formatTooltip) {\n return this.params.formatTooltip.call(this, {\n index: currentIndex,\n value,\n label,\n color,\n percentage\n });\n }\n const tooltipText = `${label ? `${label}: ` : ''}${round(value)} (${round(percentage)}%)`;\n return `\n \n ${tooltipText}\n
\n `;\n }\n setTooltip() {\n const self = this;\n const {\n currentIndex,\n el,\n app,\n params\n } = self;\n const {\n tooltip\n } = params;\n if (currentIndex === null && !self.f7Tooltip) return;\n if (!tooltip || !el) return;\n if (currentIndex !== null && !self.f7Tooltip) {\n self.f7Tooltip = app.tooltip.create({\n trigger: 'manual',\n containerEl: el,\n targetEl: el.querySelector(`path[data-index=\"${currentIndex}\"]`),\n text: self.formatTooltipText(),\n cssClass: 'pie-chart-tooltip'\n });\n self.f7Tooltip.show();\n return;\n }\n if (!self.f7Tooltip) return;\n if (currentIndex !== null) {\n self.f7Tooltip.setText(self.formatTooltipText());\n self.f7Tooltip.setTargetEl(el.querySelector(`path[data-index=\"${currentIndex}\"]`));\n self.f7Tooltip.show();\n } else {\n self.f7Tooltip.hide();\n }\n }\n render() {\n const self = this;\n const size = self.params.size;\n const paths = self.getPaths();\n return $jsx(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: size,\n viewBox: `-${size / 3} -${size / 3} ${size * 2 / 3} ${size * 2 / 3}`,\n style: \"transform: rotate(-90deg)\"\n }, paths.map((path, index) => $jsx(\"path\", {\n d: path.points,\n fill: path.color,\n \"data-index\": index\n })));\n }\n update(newParams) {\n if (newParams === void 0) {\n newParams = {};\n }\n const self = this;\n const {\n params\n } = self;\n Object.keys(newParams).forEach(param => {\n if (typeof newParams[param] !== 'undefined') {\n params[param] = newParams[param];\n }\n });\n if (self.$svgEl.length === 0) return self;\n self.$svgEl.remove();\n delete self.$svgEl.f7PieChart;\n const $svgEl = $(self.render()).eq(0);\n $svgEl.f7PieChart = self;\n extend(self, {\n $svgEl,\n svgEl: $svgEl && $svgEl[0]\n });\n self.$el.append($svgEl);\n return self;\n }\n setCurrentIndex(index) {\n const self = this;\n if (index === self.currentIndex) return;\n const {\n datasets\n } = self.params;\n self.currentIndex = index;\n self.$el.trigger('piechart:select', {\n index,\n dataset: datasets[index]\n });\n self.emit('local::select pieChartSelect', self, index, datasets[index]);\n }\n showTooltip(e) {\n const newIndex = parseInt(e.target.getAttribute('data-index'), 10);\n this.setCurrentIndex(newIndex);\n this.$svgEl.find('path').removeClass('pie-chart-hidden').forEach((el, index) => {\n if (index !== this.currentIndex) $(el).addClass('pie-chart-hidden');\n });\n this.setTooltip();\n }\n hideTooltip() {\n this.setCurrentIndex(null);\n this.$svgEl.find('path').removeClass('pie-chart-hidden');\n this.setTooltip();\n }\n init() {\n const self = this;\n const $svgEl = $(self.render()).eq(0);\n $svgEl.f7PieChart = self;\n extend(self, {\n $svgEl,\n svgEl: $svgEl && $svgEl[0]\n });\n self.$el.append($svgEl);\n self.$el.on('click mouseenter', 'path', self.showTooltip, true);\n self.$el.on('mouseleave', 'path', self.hideTooltip, true);\n return self;\n }\n destroy() {\n const self = this;\n if (!self.$el || self.destroyed) return;\n self.$el.trigger('piechart:beforedestroy');\n self.emit('local::beforeDestroy pieChartBeforeDestroy', self);\n self.$el.off('click mouseenter', 'path', self.showTooltip, true);\n self.$el.off('mouseleave', 'path', self.hideTooltip, true);\n self.$svgEl.remove();\n if (self.f7Tooltip && self.f7Tooltip.destroy) {\n self.f7Tooltip.destroy();\n }\n delete self.$el[0].f7PieChart;\n deleteProps(self);\n self.destroyed = true;\n }\n}\nexport default PieChart;", "import $ from '../../shared/dom7.js';\nimport PieChart from './pie-chart-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'pieChart',\n params: {\n pieChart: {\n el: null,\n datasets: [],\n size: 320,\n tooltip: false,\n formatTooltip: null\n }\n },\n create() {\n const app = this;\n app.pieChart = ConstructorMethods({\n defaultSelector: '.pie-chart',\n constructor: PieChart,\n app,\n domProp: 'f7PieChart'\n });\n app.pieChart.update = function update(el, newParams) {\n const $el = $(el);\n if ($el.length === 0) return undefined;\n const pieChart = app.pieChart.get(el);\n if (!pieChart) return undefined;\n pieChart.update(newParams);\n return pieChart;\n };\n }\n};", "import $ from '../../shared/dom7.js';\nimport { extend, deleteProps } from '../../shared/utils.js';\nimport Framework7Class from '../../shared/class.js';\n/** @jsx $jsx */\nimport $jsx from '../../shared/$jsx.js';\nclass AreaChart extends Framework7Class {\n constructor(app, params) {\n if (params === void 0) {\n params = {};\n }\n super(params, [app]);\n const self = this;\n const defaults = extend({}, app.params.areaChart);\n\n // Extend defaults with modules params\n self.useModulesParams(defaults);\n self.params = extend(defaults, params);\n const {\n el\n } = self.params;\n if (!el) return self;\n const $el = $(el);\n if ($el.length === 0) return self;\n if ($el[0].f7AreaChart) return $el[0].f7AreaChart;\n extend(self, {\n app,\n $el,\n el: $el && $el[0],\n currentIndex: null,\n hiddenDatasets: [],\n f7Tooltip: null,\n linesOffsets: null\n });\n $el[0].f7AreaChart = self;\n\n // Install Modules\n self.useModules();\n self.onMouseEnter = self.onMouseEnter.bind(self);\n self.onMouseMove = self.onMouseMove.bind(self);\n self.onMouseLeave = self.onMouseLeave.bind(self);\n self.onLegendClick = self.onLegendClick.bind(self);\n self.init();\n return self;\n }\n getVisibleLabels() {\n const {\n maxAxisLabels,\n axisLabels\n } = this.params;\n if (!maxAxisLabels || axisLabels.length <= maxAxisLabels) return axisLabels;\n const skipStep = Math.ceil(axisLabels.length / maxAxisLabels);\n const filtered = axisLabels.filter((label, index) => index % skipStep === 0);\n return filtered;\n }\n getSummValues() {\n const {\n datasets\n } = this.params;\n const {\n hiddenDatasets\n } = this;\n const summValues = [];\n datasets.filter((dataset, index) => !hiddenDatasets.includes(index)).forEach(_ref => {\n let {\n values\n } = _ref;\n values.forEach((value, valueIndex) => {\n if (!summValues[valueIndex]) summValues[valueIndex] = 0;\n summValues[valueIndex] += value;\n });\n });\n return summValues;\n }\n getChartData() {\n const {\n datasets,\n lineChart,\n width,\n height\n } = this.params;\n const {\n hiddenDatasets\n } = this;\n const data = [];\n if (!datasets.length) {\n return data;\n }\n const lastValues = datasets[0].values.map(() => 0);\n let maxValue = 0;\n if (lineChart) {\n datasets.filter((dataset, index) => !hiddenDatasets.includes(index)).forEach(_ref2 => {\n let {\n values\n } = _ref2;\n const datasetMaxValue = Math.max(...values);\n if (datasetMaxValue > maxValue) maxValue = datasetMaxValue;\n });\n } else {\n maxValue = Math.max(...this.getSummValues());\n }\n datasets.filter((dataset, index) => !hiddenDatasets.includes(index)).forEach(_ref3 => {\n let {\n label,\n values,\n color\n } = _ref3;\n const points = values.map((originalValue, valueIndex) => {\n lastValues[valueIndex] += originalValue;\n const value = lineChart ? originalValue : lastValues[valueIndex];\n const x = valueIndex / (values.length - 1) * width;\n const y = height - value / maxValue * height;\n if (lineChart) {\n return `${valueIndex === 0 ? 'M' : 'L'}${x},${y}`;\n }\n return `${x} ${y}`;\n });\n if (!lineChart) {\n points.push(`${width} ${height} 0 ${height}`);\n }\n data.push({\n label,\n points: points.join(' '),\n color\n });\n });\n return data.reverse();\n }\n getVerticalLines() {\n const {\n datasets,\n width\n } = this.params;\n const lines = [];\n if (!datasets.length) {\n return lines;\n }\n const values = datasets[0].values;\n values.forEach((value, valueIndex) => {\n const x = valueIndex / (values.length - 1) * width;\n lines.push(x);\n });\n return lines;\n }\n toggleDataset(index) {\n const {\n hiddenDatasets,\n params: {\n toggleDatasets\n }\n } = this;\n if (!toggleDatasets) return;\n if (hiddenDatasets.includes(index)) {\n hiddenDatasets.splice(hiddenDatasets.indexOf(index), 1);\n } else {\n hiddenDatasets.push(index);\n }\n if (this.$legendEl) {\n this.$legendEl.find('.area-chart-legend-item').removeClass('area-chart-legend-item-hidden');\n hiddenDatasets.forEach(i => {\n this.$legendEl.find(`.area-chart-legend-item[data-index=\"${i}\"]`).addClass('area-chart-legend-item-hidden');\n });\n }\n this.update({}, true);\n }\n formatAxisLabel(label) {\n const {\n formatAxisLabel\n } = this.params;\n if (formatAxisLabel) return formatAxisLabel.call(this, label);\n return label;\n }\n formatLegendLabel(label) {\n const {\n formatLegendLabel\n } = this.params;\n if (formatLegendLabel) return formatLegendLabel.call(this, label);\n return label;\n }\n calcLinesOffsets() {\n const lines = this.svgEl.querySelectorAll('line');\n this.linesOffsets = [];\n for (let i = 0; i < lines.length; i += 1) {\n this.linesOffsets.push(lines[i].getBoundingClientRect().left);\n }\n }\n formatTooltip() {\n const self = this;\n const {\n currentIndex,\n hiddenDatasets,\n params: {\n datasets,\n axisLabels,\n formatTooltip,\n formatTooltipTotal,\n formatTooltipAxisLabel,\n formatTooltipDataset\n }\n } = self;\n if (currentIndex === null) return '';\n let total = 0;\n const currentValues = datasets.filter((dataset, index) => !hiddenDatasets.includes(index)).map(dataset => ({\n color: dataset.color,\n label: dataset.label,\n value: dataset.values[currentIndex]\n }));\n currentValues.forEach(dataset => {\n total += dataset.value;\n });\n if (formatTooltip) {\n return formatTooltip({\n index: currentIndex,\n total,\n datasets: currentValues\n });\n }\n let labelText = formatTooltipAxisLabel ? formatTooltipAxisLabel.call(self, axisLabels[currentIndex]) : this.formatAxisLabel(axisLabels[currentIndex]);\n if (!labelText) labelText = '';\n const totalText = formatTooltipTotal ? formatTooltipTotal.call(self, total) : total;\n // prettier-ignore\n const datasetsText = currentValues.length > 0 ? `\n ` : '';\n // prettier-ignore\n return `\n ${labelText}
\n ${totalText}
\n ${datasetsText}\n `;\n }\n setTooltip() {\n const self = this;\n const {\n app,\n el,\n svgEl,\n hiddenDatasets,\n currentIndex,\n params: {\n tooltip,\n datasets\n }\n } = self;\n if (!tooltip) return;\n const hasVisibleDataSets = datasets.filter((dataset, index) => !hiddenDatasets.includes(index)).length > 0;\n if (!hasVisibleDataSets) {\n if (self.f7Tooltip && self.f7Tooltip.hide) self.f7Tooltip.hide();\n return;\n }\n if (currentIndex !== null && !self.f7Tooltip) {\n self.f7Tooltip = app.tooltip.create({\n trigger: 'manual',\n containerEl: el,\n targetEl: svgEl.querySelector(`line[data-index=\"${currentIndex}\"]`),\n text: self.formatTooltip(),\n cssClass: 'area-chart-tooltip'\n });\n if (self.f7Tooltip && self.f7Tooltip.show) {\n self.f7Tooltip.show();\n }\n return;\n }\n if (!self.f7Tooltip || !self.f7Tooltip.hide || !self.f7Tooltip.show) {\n return;\n }\n if (currentIndex !== null) {\n self.f7Tooltip.setText(self.formatTooltip());\n self.f7Tooltip.setTargetEl(svgEl.querySelector(`line[data-index=\"${currentIndex}\"]`));\n self.f7Tooltip.show();\n } else {\n self.f7Tooltip.hide();\n }\n }\n setCurrentIndex(index) {\n if (index === this.currentIndex) return;\n this.currentIndex = index;\n this.$el.trigger('areachart:select', {\n index\n });\n this.emit('local::select areaChartSelect', this, index);\n this.$svgEl.find('line').removeClass('area-chart-current-line');\n this.$svgEl.find(`line[data-index=\"${index}\"]`).addClass('area-chart-current-line');\n this.setTooltip();\n }\n onLegendClick(e) {\n const index = parseInt($(e.target).closest('.area-chart-legend-item').attr('data-index'), 10);\n this.toggleDataset(index);\n }\n onMouseEnter() {\n this.calcLinesOffsets();\n }\n onMouseMove(e) {\n const self = this;\n if (!self.linesOffsets) {\n self.calcLinesOffsets();\n }\n let currentLeft = e.pageX;\n if (typeof currentLeft === 'undefined') currentLeft = 0;\n const distances = self.linesOffsets.map(left => Math.abs(currentLeft - left));\n const minDistance = Math.min(...distances);\n const closestIndex = distances.indexOf(minDistance);\n self.setCurrentIndex(closestIndex);\n }\n onMouseLeave() {\n this.setCurrentIndex(null);\n }\n attachEvents() {\n const {\n svgEl,\n $el\n } = this;\n if (!svgEl) return;\n svgEl.addEventListener('mouseenter', this.onMouseEnter);\n svgEl.addEventListener('mousemove', this.onMouseMove);\n svgEl.addEventListener('mouseleave', this.onMouseLeave);\n $el.on('click', '.area-chart-legend-item', this.onLegendClick);\n }\n detachEvents() {\n const {\n svgEl,\n $el\n } = this;\n if (!svgEl) return;\n svgEl.removeEventListener('mouseenter', this.onMouseEnter);\n svgEl.removeEventListener('mousemove', this.onMouseMove);\n svgEl.removeEventListener('mouseleave', this.onMouseLeave);\n $el.off('click', '.area-chart-legend-item', this.onLegendClick);\n }\n render() {\n const self = this;\n const {\n lineChart,\n toggleDatasets,\n width,\n height,\n axis,\n axisLabels,\n legend,\n datasets\n } = self.params;\n const chartData = self.getChartData();\n const verticalLines = self.getVerticalLines();\n const visibleLegends = self.getVisibleLabels();\n const LegendItemTag = toggleDatasets ? 'button' : 'span';\n return $jsx(\"div\", null, $jsx(\"svg\", {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: width,\n height: height,\n viewBox: `0 0 ${width} ${height}`,\n preserveAspectRatio: \"none\"\n }, chartData.map(data => lineChart ? $jsx(\"path\", {\n stroke: data.color,\n \"fill-rule\": \"evenodd\",\n d: data.points\n }) : $jsx(\"polygon\", {\n fill: data.color,\n \"fill-rule\": \"evenodd\",\n points: data.points\n })), verticalLines.map((line, index) => $jsx(\"line\", {\n \"data-index\": index,\n fill: \"#000\",\n x1: line,\n y1: 0,\n x2: line,\n y2: height\n }))), axis && $jsx(\"div\", {\n class: \"area-chart-axis\"\n }, axisLabels.map(label => $jsx(\"span\", null, visibleLegends.includes(label) && $jsx(\"span\", null, self.formatAxisLabel(label))))), legend && $jsx(\"div\", {\n class: \"area-chart-legend\"\n }, datasets.map((dataset, index) => $jsx(LegendItemTag, {\n \"data-index\": index,\n class: `area-chart-legend-item ${toggleDatasets ? 'area-chart-legend-button' : ''}`,\n _type: toggleDatasets ? 'button' : undefined\n }, $jsx(\"span\", {\n style: `background-color: ${dataset.color}`\n }), self.formatLegendLabel(dataset.label)))));\n }\n update(newParams, onlySvg) {\n if (newParams === void 0) {\n newParams = {};\n }\n if (onlySvg === void 0) {\n onlySvg = false;\n }\n const self = this;\n const {\n params\n } = self;\n Object.keys(newParams).forEach(param => {\n if (typeof newParams[param] !== 'undefined') {\n params[param] = newParams[param];\n }\n });\n if (self.$svgEl.length === 0) return self;\n self.detachEvents();\n self.$svgEl.remove();\n if (!onlySvg) {\n self.$axisEl.remove();\n self.$legendEl.remove();\n }\n const $rendered = $(self.render());\n const $svgEl = $rendered.find('svg');\n extend(self, {\n svgEl: $svgEl && $svgEl[0],\n $svgEl\n });\n if (!onlySvg) {\n const $axisEl = $rendered.find('.area-chart-axis');\n const $legendEl = $rendered.find('.area-chart-legend');\n extend(self, {\n $axisEl,\n $legendEl\n });\n self.$el.append($axisEl);\n self.$el.append($legendEl);\n }\n self.$el.prepend($svgEl);\n self.attachEvents();\n return self;\n }\n init() {\n const self = this;\n const $rendered = $(self.render());\n const $svgEl = $rendered.find('svg');\n const $axisEl = $rendered.find('.area-chart-axis');\n const $legendEl = $rendered.find('.area-chart-legend');\n extend(self, {\n svgEl: $svgEl && $svgEl[0],\n $svgEl,\n $axisEl,\n $legendEl\n });\n self.$el.append($svgEl);\n self.$el.append($axisEl);\n self.$el.append($legendEl);\n self.attachEvents();\n return self;\n }\n destroy() {\n const self = this;\n if (!self.$el || self.destroyed) return;\n self.$el.trigger('piechart:beforedestroy');\n self.emit('local::beforeDestroy areaChartBeforeDestroy', self);\n self.detachEvents();\n self.$svgEl.remove();\n self.$axisEl.remove();\n self.$legendEl.remove();\n if (self.f7Tooltip && self.f7Tooltip.destroy) {\n self.f7Tooltip.destroy();\n }\n delete self.$el[0].f7AreaChart;\n deleteProps(self);\n self.destroyed = true;\n }\n}\nexport default AreaChart;", "import $ from '../../shared/dom7.js';\nimport AreaChart from './area-chart-class.js';\nimport ConstructorMethods from '../../shared/constructor-methods.js';\nexport default {\n name: 'areaChart',\n params: {\n areaChart: {\n el: null,\n lineChart: false,\n datasets: [],\n axis: false,\n axisLabels: [],\n tooltip: false,\n legend: false,\n toggleDatasets: false,\n width: 640,\n height: 320,\n maxAxisLabels: 8,\n formatAxisLabel: null,\n formatLegendLabel: null,\n formatTooltip: null,\n formatTooltipAxisLabel: null,\n formatTooltipTotal: null,\n formatTooltipDataset: null\n }\n },\n create() {\n const app = this;\n app.areaChart = ConstructorMethods({\n defaultSelector: '.area-chart',\n constructor: AreaChart,\n app,\n domProp: 'f7AreaChart'\n });\n app.areaChart.update = function update(el, newParams) {\n const $el = $(el);\n if ($el.length === 0) return undefined;\n const areaChart = app.areaChart.get(el);\n if (!areaChart) return undefined;\n areaChart.update(newParams);\n return areaChart;\n };\n }\n};", "import { bindMethods } from '../../shared/utils.js';\nconst Breadcrumbs = {};\nexport default {\n name: 'breadrumbs',\n create() {\n const app = this;\n bindMethods(app, {\n breadrumbs: Breadcrumbs\n });\n }\n};", "export default {\n name: 'typography'\n};", "/**\n * Framework7 8.3.3\n * Full featured mobile HTML framework for building iOS & Android apps\n * https://framework7.io/\n *\n * Copyright 2014-2024 Vladimir Kharlampidi\n *\n * Released under the MIT License\n *\n * Released on: March 25, 2024\n */\n\nimport $ from './shared/dom7.js';\nimport Framework7 from './components/app/app-class.js';\nimport * as utils from './shared/utils.js';\nimport { getSupport } from './shared/get-support.js';\nimport { getDevice } from './shared/get-device.js';\nimport DeviceModule from './modules/device/device.js';\nimport SupportModule from './modules/support/support.js';\nimport UtilsModule from './modules/utils/utils.js';\nimport ResizeModule from './modules/resize/resize.js';\nimport TouchModule from './modules/touch/touch.js';\nimport ClicksModule from './modules/clicks/clicks.js';\nimport RouterModule from './modules/router/router.js';\nimport RouterComponentLoaderModule from './modules/router/component-loader.js';\nimport ComponentModule, { Component, $jsx } from './modules/component/component.js';\nimport HistoryModule from './modules/history/history.js';\nimport ServiceWorkerModule from './modules/service-worker/service-worker.js';\nimport StoreModule, { createStore } from './modules/store/store.js';\nimport Statusbar from './components/statusbar/statusbar.js';\nimport View from './components/view/view.js';\nimport Navbar from './components/navbar/navbar.js';\nimport Toolbar from './components/toolbar/toolbar.js';\nimport Subnavbar from './components/subnavbar/subnavbar.js';\nimport TouchRipple from './components/touch-ripple/touch-ripple.js';\nimport Modal from './components/modal/modal.js';\nimport Router from './modules/router/router-class.js';\nimport Dialog from './components/dialog/dialog.js';\nimport Popup from './components/popup/popup.js';\nimport LoginScreen from './components/login-screen/login-screen.js';\nimport Popover from './components/popover/popover.js';\nimport Actions from './components/actions/actions.js';\nimport Sheet from './components/sheet/sheet.js';\nimport Toast from './components/toast/toast.js';\nimport Preloader from './components/preloader/preloader.js';\nimport Progressbar from './components/progressbar/progressbar.js';\nimport Sortable from './components/sortable/sortable.js';\nimport Swipeout from './components/swipeout/swipeout.js';\nimport Accordion from './components/accordion/accordion.js';\nimport ContactsList from './components/contacts-list/contacts-list.js';\nimport VirtualList from './components/virtual-list/virtual-list.js';\nimport ListIndex from './components/list-index/list-index.js';\nimport Timeline from './components/timeline/timeline.js';\nimport Tabs from './components/tabs/tabs.js';\nimport Panel from './components/panel/panel.js';\nimport Card from './components/card/card.js';\nimport Chip from './components/chip/chip.js';\nimport Form from './components/form/form.js';\nimport Input from './components/input/input.js';\nimport Checkbox from './components/checkbox/checkbox.js';\nimport Radio from './components/radio/radio.js';\nimport Toggle from './components/toggle/toggle.js';\nimport Range from './components/range/range.js';\nimport Stepper from './components/stepper/stepper.js';\nimport SmartSelect from './components/smart-select/smart-select.js';\nimport Grid from './components/grid/grid.js';\nimport Calendar from './components/calendar/calendar.js';\nimport Picker from './components/picker/picker.js';\nimport InfiniteScroll from './components/infinite-scroll/infinite-scroll.js';\nimport PullToRefresh from './components/pull-to-refresh/pull-to-refresh.js';\nimport DataTable from './components/data-table/data-table.js';\nimport Fab from './components/fab/fab.js';\nimport Searchbar from './components/searchbar/searchbar.js';\nimport Messages from './components/messages/messages.js';\nimport Messagebar from './components/messagebar/messagebar.js';\nimport Swiper from './components/swiper/swiper.js';\nimport PhotoBrowser from './components/photo-browser/photo-browser.js';\nimport Notification from './components/notification/notification.js';\nimport Autocomplete from './components/autocomplete/autocomplete.js';\nimport Tooltip from './components/tooltip/tooltip.js';\nimport Gauge from './components/gauge/gauge.js';\nimport Skeleton from './components/skeleton/skeleton.js';\nimport ColorPicker from './components/color-picker/color-picker.js';\nimport Treeview from './components/treeview/treeview.js';\nimport TextEditor from './components/text-editor/text-editor.js';\nimport PieChart from './components/pie-chart/pie-chart.js';\nimport AreaChart from './components/area-chart/area-chart.js';\nimport Breadcrumbs from './components/breadcrumbs/breadcrumbs.js';\nimport Typography from './components/typography/typography.js';\nRouter.use([RouterComponentLoaderModule]);\nFramework7.use([DeviceModule, SupportModule, UtilsModule, ResizeModule, TouchModule, ClicksModule, RouterModule, HistoryModule, ComponentModule, ServiceWorkerModule, StoreModule, Statusbar, View, Navbar, Toolbar, Subnavbar, TouchRipple, Modal, Dialog, Popup, LoginScreen, Popover, Actions, Sheet, Toast, Preloader, Progressbar, Sortable, Swipeout, Accordion, ContactsList, VirtualList, ListIndex, Timeline, Tabs, Panel, Card, Chip, Form, Input, Checkbox, Radio, Toggle, Range, Stepper, SmartSelect, Grid, Calendar, Picker, InfiniteScroll, PullToRefresh, DataTable, Fab, Searchbar, Messages, Messagebar, Swiper, PhotoBrowser, Notification, Autocomplete, Tooltip, Gauge, Skeleton, ColorPicker, Treeview, TextEditor, PieChart, AreaChart, Breadcrumbs, Typography]);\nexport { Component, $jsx, $ as Dom7, utils, getDevice, getSupport, createStore };\nexport default Framework7;\n", "/**\n * Framework7 8.3.3\n * Full featured mobile HTML framework for building iOS & Android apps\n * https://framework7.io/\n *\n * Copyright 2014-2024 Vladimir Kharlampidi\n *\n * Released under the MIT License\n *\n * Released on: March 25, 2024\n */\n\nimport $ from './shared/dom7.js';\nimport Framework7 from './components/app/app-class.js';\nimport * as utils from './shared/utils.js';\nimport { getSupport } from './shared/get-support.js';\nimport { getDevice } from './shared/get-device.js';\nimport DeviceModule from './modules/device/device.js';\nimport SupportModule from './modules/support/support.js';\nimport UtilsModule from './modules/utils/utils.js';\nimport ResizeModule from './modules/resize/resize.js';\nimport TouchModule from './modules/touch/touch.js';\nimport ClicksModule from './modules/clicks/clicks.js';\nimport RouterModule from './modules/router/router.js';\nimport RouterComponentLoaderModule from './modules/router/component-loader.js';\nimport ComponentModule, { Component, $jsx } from './modules/component/component.js';\nimport HistoryModule from './modules/history/history.js';\nimport ServiceWorkerModule from './modules/service-worker/service-worker.js';\nimport StoreModule, { createStore } from './modules/store/store.js';\nimport Statusbar from './components/statusbar/statusbar.js';\nimport View from './components/view/view.js';\nimport Navbar from './components/navbar/navbar.js';\nimport Toolbar from './components/toolbar/toolbar.js';\nimport Subnavbar from './components/subnavbar/subnavbar.js';\nimport TouchRipple from './components/touch-ripple/touch-ripple.js';\nimport Modal from './components/modal/modal.js';\nimport Router from './modules/router/router-class.js';\nRouter.use([RouterComponentLoaderModule]);\nFramework7.use([DeviceModule, SupportModule, UtilsModule, ResizeModule, TouchModule, ClicksModule, RouterModule, HistoryModule, ComponentModule, ServiceWorkerModule, StoreModule, Statusbar, View, Navbar, Toolbar, Subnavbar, TouchRipple, Modal]);\nexport { Component, $jsx, $ as Dom7, utils, getDevice, getSupport, createStore };\nexport default Framework7;\n", "import { createStore } from 'framework7';\n\nexport const setConfig = () => {\n // collect all data elements stored in body\n let config = $(document).find(\"script[data-for='app']\");\n config = JSON.parse(config.html());\n\n // always erase existing root value just in case the user changes the root.\n // This may be harmful\n config.el = \"#app\";\n\n // check if the app is intended to be a PWA\n let isPWA = $('body').attr('data-pwa') === \"true\";\n\n if (isPWA) {\n config.serviceWorker = {\n path: window.location.pathname + \"service-worker.js\",\n scope: window.location.pathname\n };\n }\n\n // Widgets cache\n config.store = createStore({\n state: {\n // any other widget type to cache ...\n popovers: [],\n tooltips: [],\n actions: [],\n preloaders: [],\n // For some widgets, we must match the widget name\n // that's why no 's' at the end even if there\n // are multiple gauges ...\n gauge: [],\n popup: [],\n swiper: [],\n searchbar: [],\n listIndex: [],\n photoBrowser: [],\n // Input elements: TBD??\n },\n actions: {\n //toggleDarkTheme: function() {\n // let self = this;\n // let $html = self.$(\"html\");\n // $html.toggleClass(\"theme-dark\");\n //}\n }\n });\n\n return config;\n};\n", "// Style for touch plugin\nconst setTouchStyle = config => {\n if (config.hasOwnProperty(\"touch\")) {\n if (config.touch.tapHold) {\n $(\"