diff --git a/docs/assets/PageA.0d2cb5ba.js b/docs/assets/PageA.0d2cb5ba.js new file mode 100644 index 0000000..b2b2778 --- /dev/null +++ b/docs/assets/PageA.0d2cb5ba.js @@ -0,0 +1 @@ +import{g as E,L as I,W as F,l as L,e as O}from"./api.ddc1e152.js";import{g as y,l as _,m as G,n as H,p as D,o as m,c as b,b as n,w as r,a as s,u as o,t as z,q as N,v as P,s as R,r as g,d as C,x as T,y as A,z as K,F as W,f as B,A as q}from"./vendor.705dcf8c.js";import{_ as Z}from"./index.5c4ccb44.js";const J={style:{"min-height":"100%",width:"100%"}},Q=["onClick"],X={class:"overflow-hidden"},Y={class:"px-4 pt-2 pb-4 border-t border-t-gray-800"},ee={class:"pb-4 text-gray-50 group-hover:text-yellow-300"},oe={class:"pt-3 flex justify-between items-center border-t border-t-gray-600 border-opacity-50"},te={class:"text-gray-50"},le=["onClick"],ne={class:"flex justify-center py-10 bg-gray-900"},S=y({props:{list:{type:Array},options:{type:Object},pageSize:{type:Number,default:100}},emits:{cardClick:null},setup(a,{emit:v}){const t=a,d=_([]),f=_(1),e=_(!0);G(()=>{p()});function p(){E({page:f.value,pageSize:t.pageSize}).then(c=>{d.value.push(...c),f.value+=1})}function l(c,x){d.value.splice(x,1)}function u(c){v("cardClick",c)}function h(c){}function V(c){console.error(`${c}: \u52A0\u8F7D\u5931\u8D25`)}function k(c){console.log(`${c}: \u52A0\u8F7D\u6210\u529F`)}function $(){e.value=!1,console.log("\u8BA1\u7B97\u5B8C\u6210")}return(c,x)=>{const i=H("loading");return D((m(),b("div",J,[n(o(F),{list:d.value,"row-key":a.options.rowKey,gutter:a.options.gutter,"has-around-gutter":a.options.hasAroundGutter,width:a.options.width,breakpoints:a.options.breakpoints,"img-selector":a.options.imgSelector,"background-color":a.options.backgroundColor,"animation-effect":a.options.animationEffect,"animation-duration":a.options.animationDuration,"animation-delay":a.options.animationDelay,lazyload:a.options.lazyload,"load-props":a.options.loadProps,"cross-origin":a.options.crossOrigin,align:a.options.align,onAfterRender:$},{item:r(({item:w,url:U,index:M})=>[s("div",{class:"bg-gray-900 rounded-lg shadow-md overflow-hidden transition-all duration-300 ease-linear hover:shadow-lg hover:shadow-gray-600 group",onClick:j=>u(w)},[s("div",X,[n(o(I),{url:U,title:"title",alt:w.name,class:"cursor-pointer transition-all duration-300 ease-linear group-hover:scale-105",onLoad:h,onError:V,onSuccess:k},null,8,["url","alt"])]),s("div",Y,[s("h2",ee,z(w.name),1),s("div",oe,[s("div",te," $ "+z(w.price),1),s("div",null,[s("button",{class:"px-3 h-7 rounded-full bg-red-500 text-sm text-white shadow-lg transition-all duration-300 hover:bg-red-600",onClick:N(j=>l(w,M),["stop"])}," \u5220\u9664 ",8,le)])])])],8,Q)]),_:1},8,["list","row-key","gutter","has-around-gutter","width","breakpoints","img-selector","background-color","animation-effect","animation-duration","animation-delay","lazyload","load-props","cross-origin","align"]),D(s("div",ne,[s("button",{class:"px-5 py-2 rounded-full bg-gray-700 text-md text-white cursor-pointer hover:bg-gray-800 transition-all duration-300",onClick:p}," \u52A0\u8F7D\u66F4\u591A ")],512),[[P,!e.value]])],512)),[[i,e.value]])}}});const ae=y({props:{visible:{type:Boolean},options:{type:Object}},emits:{"update:visible":null},setup(a,{emit:v}){const t=a,d=R({get(){return t.visible},set(f){v("update:visible",f)}});return(f,e)=>{const p=g("el-drawer");return m(),C(p,{modelValue:o(d),"onUpdate:modelValue":e[0]||(e[0]=l=>T(d)?d.value=l:null),size:"50%","with-header":!1},{default:r(()=>[n(S,{"page-size":20,options:a.options},null,8,["options"])]),_:1},8,["modelValue"])}}}),ie={},se={class:"pb-4 pt-4 flex justify-center bg-gray-900 group",href:"https://github.com/heikaimu/vue3-waterfall-plugin"},re=s("svg",{class:"h-7 w-7 fill-gray-400 transition-all duration-300 group-hover:fill-gray-200",viewBox:"0 0 16 16",version:"1.1","aria-hidden":"true"},[s("path",{d:"M8 0C3.58 0 0 3.58 0 8C0 11.54 2.29 14.53 5.47 15.59C5.87 15.66 6.02 15.42 6.02 15.21C6.02 15.02 6.01 14.39 6.01 13.72C4 14.09 3.48 13.23 3.32 12.78C3.23 12.55 2.84 11.84 2.5 11.65C2.22 11.5 1.82 11.13 2.49 11.12C3.12 11.11 3.57 11.7 3.72 11.94C4.44 13.15 5.59 12.81 6.05 12.6C6.12 12.08 6.33 11.73 6.56 11.53C4.78 11.33 2.92 10.64 2.92 7.58C2.92 6.71 3.23 5.99 3.74 5.43C3.66 5.23 3.38 4.41 3.82 3.31C3.82 3.31 4.49 3.1 6.02 4.13C6.66 3.95 7.34 3.86 8.02 3.86C8.7 3.86 9.38 3.95 10.02 4.13C11.55 3.09 12.22 3.31 12.22 3.31C12.66 4.41 12.38 5.23 12.3 5.43C12.81 5.99 13.12 6.7 13.12 7.58C13.12 10.65 11.25 11.33 9.47 11.53C9.76 11.78 10.01 12.26 10.01 13.01C10.01 14.08 10 14.94 10 15.21C10 15.42 10.15 15.67 10.55 15.59C13.71 14.53 16 11.53 16 8C16 3.58 12.42 0 8 0Z"})],-1),ue=[re];function de(a,v){return m(),b("a",se,ue)}var ce=Z(ie,[["render",de]]);const pe=B(" \u6392\u7248 "),me=B(" \u52A8\u753B "),fe=y({props:{form:{type:Object,default:()=>{}}},setup(a){const t=A(a.form),d=_([{label:"fadeIn",value:"fadeIn"},{label:"fadeInUp",value:"animate__fadeInUp"},{label:"fadeInDown",value:"animate__fadeInDown"},{label:"zoomIn",value:"animate__zoomIn"}]);return(f,e)=>{const p=g("el-input"),l=g("el-form-item"),u=g("el-divider"),h=g("el-input-number"),V=g("el-switch"),k=g("el-option"),$=g("el-select"),c=g("el-color-picker"),x=g("el-form");return m(),C(x,{size:"small","label-position":"top"},{default:r(()=>[n(l,{label:"imgSelector"},{default:r(()=>[n(p,{modelValue:o(t).imgSelector,"onUpdate:modelValue":e[0]||(e[0]=i=>o(t).imgSelector=i),disabled:""},null,8,["modelValue"])]),_:1}),n(u,{"content-position":"left"},{default:r(()=>[pe]),_:1}),n(l,{label:"width"},{default:r(()=>[n(h,{modelValue:o(t).width,"onUpdate:modelValue":e[1]||(e[1]=i=>o(t).width=i),min:0,step:10,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),n(l,{label:"gutter"},{default:r(()=>[n(h,{modelValue:o(t).gutter,"onUpdate:modelValue":e[2]||(e[2]=i=>o(t).gutter=i),min:0,step:2,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),n(l,{label:"hasAroundGutter"},{default:r(()=>[n(V,{modelValue:o(t).hasAroundGutter,"onUpdate:modelValue":e[3]||(e[3]=i=>o(t).hasAroundGutter=i)},null,8,["modelValue"])]),_:1}),n(u,{"content-position":"left"},{default:r(()=>[me]),_:1}),n(l,{label:"animationEffect"},{default:r(()=>[n($,{modelValue:o(t).animationEffect,"onUpdate:modelValue":e[4]||(e[4]=i=>o(t).animationEffect=i),placeholder:"\u8BF7\u9009\u62E9",style:{width:"100%"}},{default:r(()=>[(m(!0),b(W,null,K(d.value,i=>(m(),C(k,{key:i.value,label:i.label,value:i.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),n(l,{label:"animationDuration"},{default:r(()=>[n(h,{modelValue:o(t).animationDuration,"onUpdate:modelValue":e[5]||(e[5]=i=>o(t).animationDuration=i),min:0,step:100,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),n(l,{label:"animationDelay"},{default:r(()=>[n(h,{modelValue:o(t).animationDelay,"onUpdate:modelValue":e[6]||(e[6]=i=>o(t).animationDelay=i),min:0,step:100,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),n(l,{label:"backgroundColor"},{default:r(()=>[n(c,{modelValue:o(t).backgroundColor,"onUpdate:modelValue":e[7]||(e[7]=i=>o(t).backgroundColor=i)},null,8,["modelValue"])]),_:1})]),_:1})}}}),ge={class:"h-screen flex overflow-hidden"},ve={class:"flex-auto overflow-y-auto"},he={class:"h-full flex flex-col justify-between"},_e={class:"p-4 border-b border-b-gray-100 shadow-md"},be=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[s("path",{"fill-rule":"evenodd",d:"M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z","clip-rule":"evenodd"})],-1),we=[be],ye=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[s("path",{"fill-rule":"evenodd",d:"M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z","clip-rule":"evenodd"})],-1),Ce=[ye],xe={class:"p-4 flex-auto overflow-y-auto"},Ve=y({setup(a){function v(){const p=_(!0);function l(u){p.value=u}return{isOpen:p,handleToggleController:l}}const{isOpen:t,handleToggleController:d}=v(),f=A({rowKey:"id",gutter:10,hasAroundGutter:!0,width:320,breakpoints:{1200:{rowPerView:4},800:{rowPerView:3},500:{rowPerView:2}},animationEffect:"animate__fadeInUp",animationDuration:1e3,animationDelay:300,backgroundColor:"#2C2E3A",imgSelector:"src.original",loadProps:{loading:L,error:O,ratioCalculator:(p,l)=>{const u=3/4,h=4/3;return Math.random()>.5?u:h}},lazyload:!0,align:"center"}),e=_(!1);return(p,l)=>(m(),b("div",ge,[n(ae,{visible:e.value,"onUpdate:visible":l[0]||(l[0]=u=>e.value=u),options:o(f)},null,8,["visible","options"]),s("div",ve,[n(S,{options:o(f),onCardClick:l[1]||(l[1]=u=>e.value=!0)},null,8,["options"])]),s("div",he,[s("div",_e,[o(t)?(m(),b("span",{key:0,onClick:l[2]||(l[2]=u=>o(d)(!1))},we)):(m(),b("span",{key:1,onClick:l[3]||(l[3]=u=>o(d)(!0))},Ce))]),s("div",xe,[o(t)?(m(),C(fe,{key:0,form:o(f)},null,8,["form"])):q("",!0)]),n(ce)])]))}}),ze=y({setup(a){return(v,t)=>(m(),C(Ve))}});export{ze as default}; diff --git a/docs/assets/PageA.950c057e.js b/docs/assets/PageA.950c057e.js deleted file mode 100644 index 06cc8fa..0000000 --- a/docs/assets/PageA.950c057e.js +++ /dev/null @@ -1 +0,0 @@ -import{g as A,L as B,W as M,l as j,e as E}from"./api.ac58b069.js";import{g as w,l as y,m as I,o as p,c as b,b as n,w as r,a as s,u as o,t as $,n as L,p as O,r as g,d as C,q as F,s as z,v as G,F as H,f as D,x as N}from"./vendor.89609b2d.js";import{_ as P}from"./index.dd4211c2.js";const T={style:{width:"100%"}},R=["onClick"],K={class:"overflow-hidden"},W={class:"px-4 pt-2 pb-4 border-t border-t-gray-800"},q={class:"pb-4 text-gray-50 group-hover:text-yellow-300"},Z={class:"pt-3 flex justify-between items-center border-t border-t-gray-600 border-opacity-50"},J={class:"text-gray-50"},Q=["onClick"],U=w({props:{list:{type:Array},options:{type:Object},pageSize:{type:Number,default:100}},emits:{cardClick:null},setup(a,{emit:h}){const t=a,d=y([]),m=y(1);I(()=>{e()});function e(){A({page:m.value,pageSize:t.pageSize}).then(c=>{d.value.push(...c),m.value+=1})}function f(c,x){d.value.splice(x,1)}function l(c){h("cardClick",c)}function u(c){}function _(c){console.error(`${c}: \u52A0\u8F7D\u5931\u8D25`)}function V(c){}return(c,x)=>(p(),b("div",T,[n(o(M),{list:d.value,"row-key":a.options.rowKey,gutter:a.options.gutter,"has-around-gutter":a.options.hasAroundGutter,width:a.options.width,breakpoints:a.options.breakpoints,"img-selector":a.options.imgSelector,"background-color":a.options.backgroundColor,"animation-effect":a.options.animationEffect,"animation-duration":a.options.animationDuration,"animation-delay":a.options.animationDelay,lazyload:a.options.lazyload,"load-props":a.options.loadProps,"cross-origin":a.options.crossOrigin,align:a.options.align},{item:r(({item:v,url:k,index:i})=>[s("div",{class:"bg-gray-900 rounded-lg shadow-md overflow-hidden transition-all duration-300 ease-linear hover:shadow-lg hover:shadow-gray-600 group",onClick:S=>l(v)},[s("div",K,[n(o(B),{url:k,title:"title",alt:v.name,class:"cursor-pointer transition-all duration-300 ease-linear group-hover:scale-105",onLoad:u,onError:_,onSuccess:V},null,8,["url","alt"])]),s("div",W,[s("h2",q,$(v.name),1),s("div",Z,[s("div",J," $ "+$(v.price),1),s("div",null,[s("button",{class:"px-3 h-7 rounded-full bg-red-500 text-sm text-white shadow-lg transition-all duration-300 hover:bg-red-600",onClick:L(S=>f(v,i),["stop"])}," \u5220\u9664 ",8,Q)])])])],8,R)]),_:1},8,["list","row-key","gutter","has-around-gutter","width","breakpoints","img-selector","background-color","animation-effect","animation-duration","animation-delay","lazyload","load-props","cross-origin","align"]),s("div",{class:"flex justify-center py-10 bg-gray-900"},[s("button",{class:"px-5 py-2 rounded-full bg-gray-700 text-md text-white cursor-pointer hover:bg-gray-800 transition-all duration-300",onClick:e}," \u52A0\u8F7D\u66F4\u591A ")])]))}});const X=w({props:{visible:{type:Boolean},options:{type:Object}},emits:{"update:visible":null},setup(a,{emit:h}){const t=a,d=O({get(){return t.visible},set(m){h("update:visible",m)}});return(m,e)=>{const f=g("el-drawer");return p(),C(f,{modelValue:o(d),"onUpdate:modelValue":e[0]||(e[0]=l=>F(d)?d.value=l:null),size:"50%","with-header":!1},{default:r(()=>[n(U,{"page-size":20,options:a.options},null,8,["options"])]),_:1},8,["modelValue"])}}}),Y={},ee={class:"pb-4 pt-4 flex justify-center bg-gray-900 group",href:"https://github.com/heikaimu/vue3-waterfall-plugin"},oe=s("svg",{class:"h-7 w-7 fill-gray-400 transition-all duration-300 group-hover:fill-gray-200",viewBox:"0 0 16 16",version:"1.1","aria-hidden":"true"},[s("path",{d:"M8 0C3.58 0 0 3.58 0 8C0 11.54 2.29 14.53 5.47 15.59C5.87 15.66 6.02 15.42 6.02 15.21C6.02 15.02 6.01 14.39 6.01 13.72C4 14.09 3.48 13.23 3.32 12.78C3.23 12.55 2.84 11.84 2.5 11.65C2.22 11.5 1.82 11.13 2.49 11.12C3.12 11.11 3.57 11.7 3.72 11.94C4.44 13.15 5.59 12.81 6.05 12.6C6.12 12.08 6.33 11.73 6.56 11.53C4.78 11.33 2.92 10.64 2.92 7.58C2.92 6.71 3.23 5.99 3.74 5.43C3.66 5.23 3.38 4.41 3.82 3.31C3.82 3.31 4.49 3.1 6.02 4.13C6.66 3.95 7.34 3.86 8.02 3.86C8.7 3.86 9.38 3.95 10.02 4.13C11.55 3.09 12.22 3.31 12.22 3.31C12.66 4.41 12.38 5.23 12.3 5.43C12.81 5.99 13.12 6.7 13.12 7.58C13.12 10.65 11.25 11.33 9.47 11.53C9.76 11.78 10.01 12.26 10.01 13.01C10.01 14.08 10 14.94 10 15.21C10 15.42 10.15 15.67 10.55 15.59C13.71 14.53 16 11.53 16 8C16 3.58 12.42 0 8 0Z"})],-1),te=[oe];function le(a,h){return p(),b("a",ee,te)}var ne=P(Y,[["render",le]]);const ae=D(" \u6392\u7248 "),ie=D(" \u52A8\u753B "),se=w({props:{form:{type:Object,default:()=>{}}},setup(a){const t=z(a.form),d=y([{label:"fadeIn",value:"fadeIn"},{label:"fadeInUp",value:"animate__fadeInUp"},{label:"fadeInDown",value:"animate__fadeInDown"},{label:"zoomIn",value:"animate__zoomIn"}]);return(m,e)=>{const f=g("el-input"),l=g("el-form-item"),u=g("el-divider"),_=g("el-input-number"),V=g("el-switch"),c=g("el-option"),x=g("el-select"),v=g("el-color-picker"),k=g("el-form");return p(),C(k,{size:"small","label-position":"top"},{default:r(()=>[n(l,{label:"imgSelector"},{default:r(()=>[n(f,{modelValue:o(t).imgSelector,"onUpdate:modelValue":e[0]||(e[0]=i=>o(t).imgSelector=i),disabled:""},null,8,["modelValue"])]),_:1}),n(u,{"content-position":"left"},{default:r(()=>[ae]),_:1}),n(l,{label:"width"},{default:r(()=>[n(_,{modelValue:o(t).width,"onUpdate:modelValue":e[1]||(e[1]=i=>o(t).width=i),min:0,step:10,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),n(l,{label:"gutter"},{default:r(()=>[n(_,{modelValue:o(t).gutter,"onUpdate:modelValue":e[2]||(e[2]=i=>o(t).gutter=i),min:0,step:2,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),n(l,{label:"hasAroundGutter"},{default:r(()=>[n(V,{modelValue:o(t).hasAroundGutter,"onUpdate:modelValue":e[3]||(e[3]=i=>o(t).hasAroundGutter=i)},null,8,["modelValue"])]),_:1}),n(u,{"content-position":"left"},{default:r(()=>[ie]),_:1}),n(l,{label:"animationEffect"},{default:r(()=>[n(x,{modelValue:o(t).animationEffect,"onUpdate:modelValue":e[4]||(e[4]=i=>o(t).animationEffect=i),placeholder:"\u8BF7\u9009\u62E9",style:{width:"100%"}},{default:r(()=>[(p(!0),b(H,null,G(d.value,i=>(p(),C(c,{key:i.value,label:i.label,value:i.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),n(l,{label:"animationDuration"},{default:r(()=>[n(_,{modelValue:o(t).animationDuration,"onUpdate:modelValue":e[5]||(e[5]=i=>o(t).animationDuration=i),min:0,step:100,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),n(l,{label:"animationDelay"},{default:r(()=>[n(_,{modelValue:o(t).animationDelay,"onUpdate:modelValue":e[6]||(e[6]=i=>o(t).animationDelay=i),min:0,step:100,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),n(l,{label:"backgroundColor"},{default:r(()=>[n(v,{modelValue:o(t).backgroundColor,"onUpdate:modelValue":e[7]||(e[7]=i=>o(t).backgroundColor=i)},null,8,["modelValue"])]),_:1})]),_:1})}}}),re={class:"h-screen flex overflow-hidden"},ue={class:"flex-auto overflow-y-auto"},de={class:"h-full flex flex-col justify-between"},ce={class:"p-4 border-b border-b-gray-100 shadow-md"},pe=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[s("path",{"fill-rule":"evenodd",d:"M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z","clip-rule":"evenodd"})],-1),me=[pe],fe=s("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[s("path",{"fill-rule":"evenodd",d:"M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z","clip-rule":"evenodd"})],-1),ge=[fe],he={class:"p-4 flex-auto overflow-y-auto"},_e=w({setup(a){function h(){const f=y(!0);function l(u){f.value=u}return{isOpen:f,handleToggleController:l}}const{isOpen:t,handleToggleController:d}=h(),m=z({rowKey:"id",gutter:10,hasAroundGutter:!0,width:320,breakpoints:{1200:{rowPerView:4},800:{rowPerView:3},500:{rowPerView:2}},animationEffect:"animate__fadeInUp",animationDuration:1e3,animationDelay:300,backgroundColor:"#2C2E3A",imgSelector:"src.original",loadProps:{loading:j,error:E,ratioCalculator:(f,l)=>{const u=3/4,_=4/3;return Math.random()>.5?u:_}},lazyload:!0,align:"right"}),e=y(!1);return(f,l)=>(p(),b("div",re,[n(X,{visible:e.value,"onUpdate:visible":l[0]||(l[0]=u=>e.value=u),options:o(m)},null,8,["visible","options"]),s("div",ue,[n(U,{options:o(m),onCardClick:l[1]||(l[1]=u=>e.value=!0)},null,8,["options"])]),s("div",de,[s("div",ce,[o(t)?(p(),b("span",{key:0,onClick:l[2]||(l[2]=u=>o(d)(!1))},me)):(p(),b("span",{key:1,onClick:l[3]||(l[3]=u=>o(d)(!0))},ge))]),s("div",he,[o(t)?(p(),C(se,{key:0,form:o(m)},null,8,["form"])):N("",!0)]),n(ne)])]))}}),ye=w({setup(a){return(h,t)=>(p(),C(_e))}});export{ye as default}; diff --git a/docs/assets/PageB.1e6a7ebb.js b/docs/assets/PageB.1e6a7ebb.js new file mode 100644 index 0000000..f43d776 --- /dev/null +++ b/docs/assets/PageB.1e6a7ebb.js @@ -0,0 +1 @@ +import{l as C,e as L,L as P,W as x,g as z}from"./api.ddc1e152.js";import{_ as S}from"./index.5c4ccb44.js";import{g as B,y as D,m as E,c as l,b as g,w as M,u as e,a as t,F as V,z as A,l as c,o as d,t as p,M as j}from"./vendor.705dcf8c.js";const F={class:"page-b-content"},I={class:"bg-gray-900 rounded-lg shadow-md overflow-hidden transition-all duration-300 ease-linear hover:shadow-lg hover:shadow-gray-600 group"},G={class:"overflow-hidden"},K={class:"px-4 pt-2 pb-4 border-t border-t-gray-800"},N={class:"pb-4 text-gray-50 group-hover:text-yellow-300"},W={class:"page-menus"},$=["onClick"],O=B({setup(U){const _=function(){const r=c([1,2,3,4,5]),s=c(1),a=c([]);function n(i){s.value=i,u()}function u(){z({page:s.value,pageSize:40}).then(i=>{a.value=i})}return{list:a,page:s,pages:r,handleLoadMore:u,handleChangePage:n}},o=D({rowKey:"id",gutter:10,hasAroundGutter:!0,width:320,breakpoints:{1200:{rowPerView:4},800:{rowPerView:3},500:{rowPerView:2}},animationEffect:"animate__fadeInUp",animationDuration:1e3,animationDelay:300,backgroundColor:"#2C2E3A",imgSelector:"src.original",loadProps:{loading:C,error:L},lazyload:!0,crossOrigin:!0}),{list:h,page:m,pages:v,handleLoadMore:f,handleChangePage:w}=_();E(()=>{f()});function y(r){}function b(r){console.error(`${r}: \u52A0\u8F7D\u5931\u8D25`)}function k(r){}return(r,s)=>(d(),l("div",F,[g(e(x),{list:e(h),"row-key":e(o).rowKey,gutter:e(o).gutter,"has-around-gutter":e(o).hasAroundGutter,width:e(o).width,breakpoints:e(o).breakpoints,"img-selector":e(o).imgSelector,"background-color":e(o).backgroundColor,lazyload:e(o).lazyload,"load-props":e(o).loadProps},{item:M(({item:a,url:n})=>[t("div",I,[t("div",G,[g(e(P),{url:n,class:"cursor-pointer transition-all duration-300 ease-linear group-hover:scale-105",onLoad:y,onError:b,onSuccess:k},null,8,["url"])]),t("div",K,[t("h2",N,p(a.name),1)])])]),_:1},8,["list","row-key","gutter","has-around-gutter","width","breakpoints","img-selector","background-color","lazyload","load-props"]),t("div",W,[(d(!0),l(V,null,A(e(v),a=>(d(),l("p",{key:a,class:j(["page-menus__item",{active:a===e(m)}]),onClick:n=>e(w)(a)},p(a),11,$))),128))])]))}});var Q=S(O,[["__scopeId","data-v-2cbce89c"]]);export{Q as default}; diff --git a/docs/assets/PageB.97751dea.js b/docs/assets/PageB.97751dea.js deleted file mode 100644 index 4a4b340..0000000 --- a/docs/assets/PageB.97751dea.js +++ /dev/null @@ -1 +0,0 @@ -import{l as C,e as L,L as P,W as x,g as z}from"./api.ac58b069.js";import{_ as S}from"./index.dd4211c2.js";import{g as B,s as D,m as E,c as l,b as g,w as V,u as e,a as t,F as A,v as I,l as d,o as c,t as p,I as M}from"./vendor.89609b2d.js";const j={class:"page-b-content"},F={class:"bg-gray-900 rounded-lg shadow-md overflow-hidden transition-all duration-300 ease-linear hover:shadow-lg hover:shadow-gray-600 group"},G={class:"overflow-hidden"},K={class:"px-4 pt-2 pb-4 border-t border-t-gray-800"},N={class:"pb-4 text-gray-50 group-hover:text-yellow-300"},W={class:"page-menus"},$=["onClick"],O=B({setup(U){const _=function(){const r=d([1,2,3,4,5]),s=d(1),o=d([]);function n(i){s.value=i,u()}function u(){z({page:s.value,pageSize:40}).then(i=>{o.value=i})}return{list:o,page:s,pages:r,handleLoadMore:u,handleChangePage:n}},a=D({rowKey:"id",gutter:10,hasAroundGutter:!0,width:320,breakpoints:{1200:{rowPerView:4},800:{rowPerView:3},500:{rowPerView:2}},animationEffect:"animate__fadeInUp",animationDuration:1e3,animationDelay:300,backgroundColor:"#2C2E3A",imgSelector:"src.original",loadProps:{loading:C,error:L},lazyload:!0,crossOrigin:!0}),{list:h,page:m,pages:v,handleLoadMore:w,handleChangePage:f}=_();E(()=>{w()});function y(r){}function b(r){console.error(`${r}: \u52A0\u8F7D\u5931\u8D25`)}function k(r){}return(r,s)=>(c(),l("div",j,[g(e(x),{list:e(h),"row-key":e(a).rowKey,gutter:e(a).gutter,"has-around-gutter":e(a).hasAroundGutter,width:e(a).width,breakpoints:e(a).breakpoints,"img-selector":e(a).imgSelector,"background-color":e(a).backgroundColor,lazyload:e(a).lazyload,"load-props":e(a).loadProps},{item:V(({item:o,url:n})=>[t("div",F,[t("div",G,[g(e(P),{url:n,class:"cursor-pointer transition-all duration-300 ease-linear group-hover:scale-105",onLoad:y,onError:b,onSuccess:k},null,8,["url"])]),t("div",K,[t("h2",N,p(o.name),1)])])]),_:1},8,["list","row-key","gutter","has-around-gutter","width","breakpoints","img-selector","background-color","lazyload","load-props"]),t("div",W,[(c(!0),l(A,null,I(e(v),o=>(c(),l("p",{key:o,class:M(["page-menus__item",{active:o===e(m)}]),onClick:n=>e(f)(o)},p(o),11,$))),128))])]))}});var Q=S(O,[["__scopeId","data-v-2cbce89c"]]);export{Q as default}; diff --git a/docs/assets/api.e93543f3.css b/docs/assets/api.2c6172ca.css similarity index 55% rename from docs/assets/api.e93543f3.css rename to docs/assets/api.2c6172ca.css index b4fe4ce..2af7a4c 100644 --- a/docs/assets/api.e93543f3.css +++ b/docs/assets/api.2c6172ca.css @@ -1 +1 @@ -.waterfall-list[data-v-6a0e9c4c]{width:100%;position:relative;overflow:hidden;background-color:var(--b75bd1b4)}.waterfall-item[data-v-6a0e9c4c]{position:absolute;left:0;top:0;transform:translateY(3000px);visibility:hidden}@keyframes fadeIn-6a0e9c4c{0%{opacity:0}to{opacity:1}}.fadeIn[data-v-6a0e9c4c]{animation-name:fadeIn-6a0e9c4c}.lazy__box[data-v-640f8d40]{width:100%;height:0;padding-bottom:100%;overflow:hidden;position:relative}.lazy__resource[data-v-640f8d40]{display:flex;justify-content:center;align-items:center;position:absolute;left:0;top:0;bottom:0;right:0}.lazy__img[data-v-640f8d40]{display:block}.lazy__img[lazy=loading][data-v-640f8d40]{padding:5em 0;width:48px}.lazy__img[lazy=loaded][data-v-640f8d40]{width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.lazy__img[lazy=error][data-v-640f8d40]{padding:5em 0;width:48px;height:auto} +.waterfall-list[data-v-6d3e5303]{width:100%;position:relative;overflow:hidden;background-color:var(--84adae44)}.waterfall-item[data-v-6d3e5303]{position:absolute;left:0;top:0;transform:translateY(3000px);visibility:hidden}@keyframes fadeIn-6d3e5303{0%{opacity:0}to{opacity:1}}.fadeIn[data-v-6d3e5303]{animation-name:fadeIn-6d3e5303}.lazy__box[data-v-640f8d40]{width:100%;height:0;padding-bottom:100%;overflow:hidden;position:relative}.lazy__resource[data-v-640f8d40]{display:flex;justify-content:center;align-items:center;position:absolute;left:0;top:0;bottom:0;right:0}.lazy__img[data-v-640f8d40]{display:block}.lazy__img[lazy=loading][data-v-640f8d40]{padding:5em 0;width:48px}.lazy__img[lazy=loaded][data-v-640f8d40]{width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.lazy__img[lazy=error][data-v-640f8d40]{padding:5em 0;width:48px;height:auto} diff --git a/docs/assets/api.ac58b069.js b/docs/assets/api.ac58b069.js deleted file mode 100644 index 8c698d9..0000000 --- a/docs/assets/api.ac58b069.js +++ /dev/null @@ -1 +0,0 @@ -import{l as m,y as k,p,g as N,z,A as V,B as X,C as J,o as w,c as b,F as q,v as $,a as O,D as tt,E as et,G as F,m as rt,H as nt}from"./vendor.89609b2d.js";import{_ as D}from"./index.dd4211c2.js";var Mt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABNBJREFUaEPtmV1oXEUUx//n3g1JRGqL9k1RsFq/6IMgSky8c2YTQyONiojWYumTQrWKSNH6oO1TS1EQFcTiQwsaK4qIbVdod+/M3Y0IteJDwVr1oVYFEfFFwUY2c2TCbrhZNptNduvuQgf2Ze85M+c359w5Z84l9PigHrcflwCqHrTWsoiUmLn8f3q1bR4wxggRlZxz00EQlCowf19smLYAxHF8NxFNA/gUgAKwGsApD5GC+eNiwLQL4GUi2gNgDIA31ENEKZhzIvK5h5mZmZkeHx//uV0wbQEwxpQADDPzgvny+fyNYRhO1MB42w9674RhWIqi6IdWYFoGMMbcBuA0ER1RSk3GcbyViB4HcBTAMWb+0RtYKpXWlMvlSSKaFBFdCTP/yIrIRxWY08uFaQfAswAeAPAaMx81xhwmojVpQ0TkSxH5QGt9tvp/kiQTzrlJAOsroeYfnXPOHQrD8JhS6qtmYFoGaGaRRjKFQuF6IhononsB+N9gSv4ggENKqYSIpN48cwCFQmF3EARPt2rMcvWZ+ao4ju/TWh+r6hpjRkVkYwXIh+d8qvEw/f39Hw4NDf1T/TMN8AqA/HKNWKk8EWmlVFjZvG0iUiSiIjO/W52zWCyuLZfLm4hoE4DxlHfmQi2bze6uBbih+tKt1LBm9Ky17wN4NAXgN29uiMi/HsS/2FrrA+n5isXi7bOzsx5mdyaTWT8yMvJ9XQC/K80YshIZv2uNAOrM+bWIHKjCWGuPi8g9zDzgZesC+LJgJcYtpeOc27MCAD/taWbeYIy5i4gKzjnvnW29BLCLmfcZY54H8GoQBONRFB3vGYByuXzt2NjYeWPMJwAeTGf8rg8hIvpTKXVlHMe3AogBnNFa+1prbnQ9gIi8rbXeHsfxE0T0DhE9qZSaP526HgDACDNPW2sPicjWvr6+VcPDw3/1jAd8vJ84ceKKTCbjj1NordelT7tu98BRZt5krd0sIlNEtFcp9VLPAIjIFq31lDHmLQBPBUGwIYqiBSV3xz1gjPFlRN3MXz0ujTHf+LKbmS+rTZZdC0BEJ5VSdxYKBR0EQYGIppRSW3oGAEA1++4F8KK/ySmljvQMQDX7Wmt9ZeqP0rqXr24NoZ+Y+TpjzDoiOuvvCszM9YrFbgV4nZmfi+N4JxHtJ6JnlFJv9hLAXPY1xuQAbASwlpnrNsY67oHKlXL+RgbgAjMP5nK5/oGBgd+DIPhNKeU7F3VHxwFq80Cl/fKYMeYRAIdFZL/W+oWeAQDwMDN/7PtLADzEHcx8qmcAUtn3FxFZrbW+vNFVteMhFMexj+/7faKqxP9okiRDzrkvALzHzL5NuejoOEDasiRJJqMo+sxau19EdgZB8FAURf4auTyARgrteJZuq9SbzxhzBsBNi2XfJcvpdhjZaI5GAEmSXOOcO09EsVIqu5QtHe/M1Rpord0hIm8A2MHM/h7QcHQjQMF/P3DOXZ3NZn/teoBKJr4AYLpSPviu4HfMfPNSxvvnCzzgnNvejFKrMmEYDi/S3LWVjx37mHlXM+vUhlAzOm2RISLnu9N+slwut2pwcHCCiCZExH+5mchmsyebWWgOwBgz3+lqRqldMszsd3zByOfzt4yOjn7b7Bod/8TUrKGLyV0CaHUHW9X/D9N93V6azvezAAAAAElFTkSuQmCC",Ct="data:image/png;base64,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";const ot=({breakpoints:t,wrapperWidth:e,gutter:r,hasAroundGutter:n,initWidth:o})=>{const s=Object.keys(t).map(l=>Number(l)).sort((l,A)=>l-A);let i=e,a=!1;for(const l of s)if(e<=l){i=l,a=!0;break}if(!a)return o;const u=t[i].rowPerView;return n?(e-r)/u-r:(e-(u-1)*r)/u};function it(t){const e=m(0),r=m(null);k(r,i=>{const a=i[0],{width:u}=a.contentRect;e.value=u});const n=p(()=>ot({wrapperWidth:e.value,breakpoints:t.breakpoints,gutter:t.gutter,hasAroundGutter:t.hasAroundGutter,initWidth:t.width})),o=p(()=>{const i=t.hasAroundGutter?-t.gutter:t.gutter;return Math.floor((e.value+i)/(n.value+t.gutter))}),s=p(()=>{if(t.align==="left")return 0;if(t.align==="center"){const i=t.hasAroundGutter?t.gutter:-t.gutter,a=o.value*(n.value+t.gutter)+i;return(e.value-a)/2}else{const i=t.hasAroundGutter?t.gutter:-t.gutter,a=o.value*(n.value+t.gutter)+i;return e.value-a}});return{waterfallWrapper:r,wrapperWidth:e,colWidth:n,cols:o,offsetX:s}}function _(t,e){return new RegExp(`(^|\\s)${e}(\\s|$)`).test(t.className)}function j(t,e){if(_(t,e))return;const r=t.className.split(/\s+/);r.push(e),t.className=r.join(" ")}const st=document.createElement("div").style,R=(()=>{const t={webkit:"webkitTransform",Moz:"MozTransform",O:"OTransform",ms:"msTransform",standard:"transform"};for(const e in t){const r=t[e];if(st[r]!==void 0)return e}return!1})();function h(t){return R===!1?!1:R==="standard"?t:R+t.charAt(0).toUpperCase()+t.substr(1)}const B=h("transform"),M=h("animation-duration"),C=h("animation-delay"),L=h("transition"),x=h("animation-fill-mode");function at(t,e,r,n,o){const s=m([]),i=m(0),a=c=>{const d=t.hasAroundGutter?c+1:c;return t.gutter*d+e.value*c+n.value},u=()=>{s.value=new Array(r.value).fill(t.hasAroundGutter?t.gutter:0)},l=ut(t);return{wrapperHeight:i,layoutHandle:async()=>{u();const c=[];if(o&&o.value&&o.value.childNodes.forEach(d=>{d.className==="waterfall-item"&&c.push(d)}),c.length===0)return!1;for(let d=0;d{const Z=t.animationDuration/1e3;L&&(E[L]=`transform ${Z}s`)})}i.value=Math.max.apply(null,s.value)}}}function ut(t){return(e,r)=>{const n=e.firstChild;if(n&&!_(n,t.animationPrefix)){const o=`${t.animationDuration/1e3}s`,s=`${t.animationDelay/1e3}s`,i=n.style;i.visibility="visible",M&&(i[M]=o),C&&(i[C]=s),x&&(i[x]="both"),j(n,t.animationPrefix),j(n,t.animationEffect),r&&setTimeout(()=>{r()},t.animationDuration+t.animationDelay)}}}const lt=typeof window!="undefined"&&window!==null,P=ft(),ct=Object.prototype.propertyIsEnumerable,T=Object.getOwnPropertySymbols;function dt(t,...e){return e.map(n=>n.replace(/\[(\w+)\]/g,".$1").split(".").reduce((o,s)=>o&&o[s],t))}function ft(){return lt&&"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype?("isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get(){return this.intersectionRatio>0}}),!0):!1}function y(t){return typeof t=="function"||toString.call(t)==="[object Object]"}function At(t){return typeof t=="object"?t===null:typeof t!="function"}function mt(t){return t!=="__proto__"&&t!=="constructor"&&t!=="prototype"}function gt(t,...e){if(!y(t))throw new TypeError("expected the first argument to be an object");if(e.length===0||typeof Symbol!="function"||typeof T!="function")return t;for(const r of e){const n=T(r);for(const o of n)ct.call(r,o)&&(t[o]=r[o])}return t}function G(t,...e){let r=0;for(At(t)&&(t=e[r++]),t||(t={});r{const o=new Image;o.onload=()=>{r(o)},o.onerror=()=>{n(new Error("Image load error"))},e&&(o.crossOrigin="Anonymous"),o.src=t})}var g;(function(t){t.LOADING="loading",t.LOADED="loaded",t.ERROR="error"})(g||(g={}));const ht={rootMargin:"0px",threshold:0},K="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",yt="";class vt{constructor(e=!0,r,n=!0){this.lazyActive=!0,this.crossOrigin=!0,this.options={loading:K,error:yt,observerOptions:ht,log:!0,ratioCalculator:(o,s)=>s/o},this._images=new WeakMap,this.lazyActive=e,this.crossOrigin=n,this.config(r)}config(e={}){G(this.options,e),e.ratioCalculator&&(this.options.ratioCalculator=e.ratioCalculator)}mount(e,r,n){const{src:o,loading:s,error:i}=this._valueFormatter(r);e.setAttribute("lazy",g.LOADING),e.setAttribute("src",s||K),this.lazyActive?(P||(this._setImageSrc(e,o,n,i),this._log(()=>{throw new Error("Not support IntersectionObserver!")})),this._initIntersectionObserver(e,o,n,i)):this._setImageSrc(e,o,n,i)}resize(e,r){const n=e.getAttribute("lazy"),o=e.getAttribute("src");n&&n===g.LOADED&&o&&H(o,this.crossOrigin).then(s=>{const{width:i,height:a}=s,u=e.width/i*a;e.height=u;const l=e.style;l.height=`${u}px`,r()})}unmount(e){const r=this._realObserver(e);r&&r.unobserve(e),this._images.delete(e)}_setImageSrc(e,r,n,o){!r||e.getAttribute("src")===r||H(r,this.crossOrigin).then(i=>{var c,d;const{width:a,height:u}=i,l=((d=(c=this.options).ratioCalculator)==null?void 0:d.call(c,a,u))||u/a,A=e.parentNode.parentNode;A.style.paddingBottom=`${l*100}%`,e.setAttribute("lazy",g.LOADED),e.removeAttribute("src"),e.setAttribute("src",r),n(!0)}).catch(()=>{const i=this._realObserver(e);i&&i.disconnect(),o&&(e.setAttribute("lazy",g.ERROR),e.setAttribute("src",o),n(!1)),this._log(()=>{throw new Error(`Image failed to load!And failed src was: ${r} `)})})}_isOpenLazy(){return P&&this.lazyActive}_initIntersectionObserver(e,r,n,o){const s=this.options.observerOptions;this._images.set(e,new IntersectionObserver(a=>{Array.prototype.forEach.call(a,u=>{if(u.isIntersecting){const l=this._realObserver(e);l&&l.unobserve(u.target),this._setImageSrc(e,r,n,o)}})},s));const i=this._realObserver(e);i&&i.observe(e)}_valueFormatter(e){let r=e,n=this.options.loading,o=this.options.error;return y(e)&&(r=e.src,n=e.loading||this.options.loading,o=e.error||this.options.error),{src:r,loading:n,error:o}}_log(e){this.options.log&&e()}_realObserver(e){return this._images.get(e)}}const I=N({props:{list:{type:Array,default:()=>[]},rowKey:{type:String,default:"id"},imgSelector:{type:String,default:"src"},width:{type:Number,default:200},breakpoints:{type:Object,default:()=>({1200:{rowPerView:3},800:{rowPerView:2},500:{rowPerView:1}})},gutter:{type:Number,default:10},hasAroundGutter:{type:Boolean,default:!0},animationPrefix:{type:String,default:"animate__animated"},animationEffect:{type:String,default:"fadeIn"},animationDuration:{type:Number,default:1e3},animationDelay:{type:Number,default:300},backgroundColor:{type:String,default:"#fff"},lazyload:{type:Boolean,default:!0},loadProps:{type:Object,default:()=>{}},crossOrigin:{type:Boolean,default:!0},delay:{type:Number,default:300},align:{type:String,default:"center"}},setup(t){const e=new vt(t.lazyload,t.loadProps,t.crossOrigin);z("lazy",e);const{waterfallWrapper:r,wrapperWidth:n,colWidth:o,cols:s,offsetX:i}=it(t),{wrapperHeight:a,layoutHandle:u}=at(t,o,s,i,r),l=V(()=>{u()},t.delay);X(()=>[n,o,t.list],()=>{n.value>0&&l()},{deep:!0});const A=m(0);return z("sizeChangeTime",A),z("imgLoaded",l),{waterfallWrapper:r,wrapperHeight:a,getRenderURL:f=>dt(f,t.imgSelector)[0],getKey:(f,v)=>f[t.rowKey]||v,renderer:l}}}),Q=()=>{J(t=>({b75bd1b4:t.backgroundColor}))},Y=I.setup;I.setup=Y?(t,e)=>(Q(),Y(t,e)):Q;const wt=I,bt={class:"waterfall-card"};function Et(t,e,r,n,o,s){return w(),b("div",{ref:"waterfallWrapper",class:"waterfall-list",style:et({height:`${t.wrapperHeight}px`})},[(w(!0),b(q,null,$(t.list,(i,a)=>(w(),b("div",{key:t.getKey(i,a),class:"waterfall-item"},[O("div",bt,[tt(t.$slots,"item",{item:i,index:a,url:t.getRenderURL(i)},void 0,!0)])]))),128))],4)}var Lt=D(wt,[["render",Et],["__scopeId","data-v-6a0e9c4c"]]);const pt=N({props:{url:{type:String,default:""},title:{type:String,default:""},alt:{type:String,default:""}},setup(t,e){const r=F("imgLoaded"),n=F("lazy"),o=m(null);rt(()=>{s()}),nt(()=>{i()});function s(){!o.value||n.mount(o.value,t.url,u=>{r(),u?e.emit("success",t.url):e.emit("error",t.url)})}function i(){!o.value||n.unmount(o.value)}function a(){e.emit("load",t.url)}return{lazyRef:o,imageLoad:a}}}),zt={class:"lazy__box"},Ot={class:"lazy__resource"},Rt=["title","alt"];function It(t,e,r,n,o,s){return w(),b("div",zt,[O("div",Ot,[O("img",{ref:"lazyRef",class:"lazy__img",title:t.title,alt:t.alt,onLoad:e[0]||(e[0]=(...i)=>t.imageLoad&&t.imageLoad(...i))},null,40,Rt)])])}var xt=D(pt,[["render",It],["__scopeId","data-v-640f8d40"]]);function St(t=6){return Number(Math.random().toString().substr(3,t)+Date.now()).toString(36)}const Nt=["#409EFF","#67C23A","#E6A23C","#F56C6C","#909399"];function Ft(t,e){return Math.floor(Math.random()*(e-t+1))+t}function Dt(){return Nt[Ft(0,4)]}const _t="https://www.getphotoblanket.com",Pt=({page:t=1,pageSize:e=20})=>{const r=`${_t}/products.json?page=${t}&limit=${e}`;return fetch(r).then(n=>n.json()).then(n=>n.products).then(n=>n.map(o=>({id:St(),star:!1,price:o.variants[0].price,src:{original:Math.random()>.1?o.images[0].src:"https://www.example.com/non-existent-image.jpg"},backgroundColor:Dt(),name:o.title})))};export{xt as L,Lt as W,Ct as e,Pt as g,Mt as l}; diff --git a/docs/assets/api.ddc1e152.js b/docs/assets/api.ddc1e152.js new file mode 100644 index 0000000..73e7bad --- /dev/null +++ b/docs/assets/api.ddc1e152.js @@ -0,0 +1 @@ +import{l as g,B as V,s as z,g as D,C as R,D as X,E as J,G as q,o as E,c as p,F as $,z as tt,a as I,H as et,I as rt,J as F,m as nt,L as ot}from"./vendor.705dcf8c.js";import{_}from"./index.5c4ccb44.js";var Ct="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABNBJREFUaEPtmV1oXEUUx//n3g1JRGqL9k1RsFq/6IMgSky8c2YTQyONiojWYumTQrWKSNH6oO1TS1EQFcTiQwsaK4qIbVdod+/M3Y0IteJDwVr1oVYFEfFFwUY2c2TCbrhZNptNduvuQgf2Ze85M+c359w5Z84l9PigHrcflwCqHrTWsoiUmLn8f3q1bR4wxggRlZxz00EQlCowf19smLYAxHF8NxFNA/gUgAKwGsApD5GC+eNiwLQL4GUi2gNgDIA31ENEKZhzIvK5h5mZmZkeHx//uV0wbQEwxpQADDPzgvny+fyNYRhO1MB42w9674RhWIqi6IdWYFoGMMbcBuA0ER1RSk3GcbyViB4HcBTAMWb+0RtYKpXWlMvlSSKaFBFdCTP/yIrIRxWY08uFaQfAswAeAPAaMx81xhwmojVpQ0TkSxH5QGt9tvp/kiQTzrlJAOsroeYfnXPOHQrD8JhS6qtmYFoGaGaRRjKFQuF6IhononsB+N9gSv4ggENKqYSIpN48cwCFQmF3EARPt2rMcvWZ+ao4ju/TWh+r6hpjRkVkYwXIh+d8qvEw/f39Hw4NDf1T/TMN8AqA/HKNWKk8EWmlVFjZvG0iUiSiIjO/W52zWCyuLZfLm4hoE4DxlHfmQi2bze6uBbih+tKt1LBm9Ky17wN4NAXgN29uiMi/HsS/2FrrA+n5isXi7bOzsx5mdyaTWT8yMvJ9XQC/K80YshIZv2uNAOrM+bWIHKjCWGuPi8g9zDzgZesC+LJgJcYtpeOc27MCAD/taWbeYIy5i4gKzjnvnW29BLCLmfcZY54H8GoQBONRFB3vGYByuXzt2NjYeWPMJwAeTGf8rg8hIvpTKXVlHMe3AogBnNFa+1prbnQ9gIi8rbXeHsfxE0T0DhE9qZSaP526HgDACDNPW2sPicjWvr6+VcPDw3/1jAd8vJ84ceKKTCbjj1NordelT7tu98BRZt5krd0sIlNEtFcp9VLPAIjIFq31lDHmLQBPBUGwIYqiBSV3xz1gjPFlRN3MXz0ujTHf+LKbmS+rTZZdC0BEJ5VSdxYKBR0EQYGIppRSW3oGAEA1++4F8KK/ySmljvQMQDX7Wmt9ZeqP0rqXr24NoZ+Y+TpjzDoiOuvvCszM9YrFbgV4nZmfi+N4JxHtJ6JnlFJv9hLAXPY1xuQAbASwlpnrNsY67oHKlXL+RgbgAjMP5nK5/oGBgd+DIPhNKeU7F3VHxwFq80Cl/fKYMeYRAIdFZL/W+oWeAQDwMDN/7PtLADzEHcx8qmcAUtn3FxFZrbW+vNFVteMhFMexj+/7faKqxP9okiRDzrkvALzHzL5NuejoOEDasiRJJqMo+sxau19EdgZB8FAURf4auTyARgrteJZuq9SbzxhzBsBNi2XfJcvpdhjZaI5GAEmSXOOcO09EsVIqu5QtHe/M1Rpord0hIm8A2MHM/h7QcHQjQMF/P3DOXZ3NZn/teoBKJr4AYLpSPviu4HfMfPNSxvvnCzzgnNvejFKrMmEYDi/S3LWVjx37mHlXM+vUhlAzOm2RISLnu9N+slwut2pwcHCCiCZExH+5mchmsyebWWgOwBgz3+lqRqldMszsd3zByOfzt4yOjn7b7Bod/8TUrKGLyV0CaHUHW9X/D9N93V6azvezAAAAAElFTkSuQmCC",Lt="data:image/png;base64,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";const it=({breakpoints:t,wrapperWidth:e,gutter:r,hasAroundGutter:n,initWidth:o})=>{const s=Object.keys(t).map(l=>Number(l)).sort((l,d)=>l-d);let i=e,a=!1;for(const l of s)if(e<=l){i=l,a=!0;break}if(!a)return o;const u=t[i].rowPerView;return n?(e-r)/u-r:(e-(u-1)*r)/u};function st(t){const e=g(0),r=g(null);V(r,i=>{const a=i[0],{width:u}=a.contentRect;e.value=u});const n=z(()=>it({wrapperWidth:e.value,breakpoints:t.breakpoints,gutter:t.gutter,hasAroundGutter:t.hasAroundGutter,initWidth:t.width})),o=z(()=>{const i=t.hasAroundGutter?-t.gutter:t.gutter;return Math.floor((e.value+i)/(n.value+t.gutter))}),s=z(()=>{if(t.align==="left")return 0;if(t.align==="center"){const i=t.hasAroundGutter?t.gutter:-t.gutter,a=o.value*(n.value+t.gutter)+i;return(e.value-a)/2}else{const i=t.hasAroundGutter?t.gutter:-t.gutter,a=o.value*(n.value+t.gutter)+i;return e.value-a}});return{waterfallWrapper:r,wrapperWidth:e,colWidth:n,cols:o,offsetX:s}}function j(t,e){return new RegExp(`(^|\\s)${e}(\\s|$)`).test(t.className)}function B(t,e){if(j(t,e))return;const r=t.className.split(/\s+/);r.push(e),t.className=r.join(" ")}const at=document.createElement("div").style,O=(()=>{const t={standard:"transform",webkit:"webkitTransform",Moz:"MozTransform",O:"OTransform",ms:"msTransform"};for(const e in t){const r=t[e];if(at[r]!==void 0)return e}return!1})();function y(t){return O===!1?!1:O==="standard"?t:O+t.charAt(0).toUpperCase()+t.substr(1)}const M=y("transform"),C=y("animation-duration"),L=y("animation-delay"),x=y("transition"),P=y("animation-fill-mode");function ut(t,e,r,n,o){const s=g([]),i=g(0),a=c=>{const f=t.hasAroundGutter?c+1:c;return t.gutter*f+e.value*c+n.value},u=()=>{s.value=new Array(r.value).fill(t.hasAroundGutter?t.gutter:0)},l=lt(t);return{wrapperHeight:i,layoutHandle:async()=>new Promise(c=>{u();const f=[];if(o&&o.value&&o.value.childNodes.forEach(A=>{A.className==="waterfall-item"&&f.push(A)}),f.length===0)return!1;for(let A=0;A{const k=t.posDuration/1e3;x&&(b[x]=`transform ${k}s`)})}i.value=Math.max.apply(null,s.value),setTimeout(()=>{c(!0)},t.posDuration)})}}function lt(t){return(e,r)=>{const n=e.firstChild;if(n&&!j(n,t.animationPrefix)){const o=`${t.animationDuration/1e3}s`,s=`${t.animationDelay/1e3}s`,i=n.style;B(n,t.animationPrefix),B(n,t.animationEffect),C&&(i[C]=o),L&&(i[L]=s),P&&(i[P]="both"),r&&setTimeout(()=>{r()},t.animationDuration+t.animationDelay)}}}const ct=typeof window!="undefined"&&window!==null,T=At(),ft=Object.prototype.propertyIsEnumerable,G=Object.getOwnPropertySymbols;function dt(t,...e){return e.map(n=>n.replace(/\[(\w+)\]/g,".$1").split(".").reduce((o,s)=>o&&o[s],t))}function At(){return ct&&"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype?("isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get(){return this.intersectionRatio>0}}),!0):!1}function v(t){return typeof t=="function"||toString.call(t)==="[object Object]"}function mt(t){return typeof t=="object"?t===null:typeof t!="function"}function gt(t){return t!=="__proto__"&&t!=="constructor"&&t!=="prototype"}function ht(t,...e){if(!v(t))throw new TypeError("expected the first argument to be an object");if(e.length===0||typeof Symbol!="function"||typeof G!="function")return t;for(const r of e){const n=G(r);for(const o of n)ft.call(r,o)&&(t[o]=r[o])}return t}function H(t,...e){let r=0;for(mt(t)&&(t=e[r++]),t||(t={});r{const o=new Image;o.onload=()=>{r(o)},o.onerror=()=>{n(new Error("Image load error"))},e&&(o.crossOrigin="Anonymous"),o.src=t})}var h;(function(t){t.LOADING="loading",t.LOADED="loaded",t.ERROR="error"})(h||(h={}));const yt={rootMargin:"0px",threshold:0},Q="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",vt="";class wt{constructor(e=!0,r,n=!0){this.lazyActive=!0,this.crossOrigin=!0,this.options={loading:Q,error:vt,observerOptions:yt,log:!0,ratioCalculator:(o,s)=>s/o},this._images=new WeakMap,this.lazyActive=e,this.crossOrigin=n,this.config(r)}config(e={}){H(this.options,e),e.ratioCalculator&&(this.options.ratioCalculator=e.ratioCalculator)}mount(e,r,n){const{src:o,loading:s,error:i}=this._valueFormatter(r);e.setAttribute("lazy",h.LOADING),e.setAttribute("src",s||Q),this.lazyActive?(T||(this._setImageSrc(e,o,n,i),this._log(()=>{throw new Error("Not support IntersectionObserver!")})),this._initIntersectionObserver(e,o,n,i)):this._setImageSrc(e,o,n,i)}resize(e,r){const n=e.getAttribute("lazy"),o=e.getAttribute("src");n&&n===h.LOADED&&o&&K(o,this.crossOrigin).then(s=>{const{width:i,height:a}=s,u=e.width/i*a;e.height=u;const l=e.style;l.height=`${u}px`,r()})}unmount(e){const r=this._realObserver(e);r&&r.unobserve(e),this._images.delete(e)}_setImageSrc(e,r,n,o){!r||e.getAttribute("src")===r||K(r,this.crossOrigin).then(i=>{var c,f;const{width:a,height:u}=i,l=((f=(c=this.options).ratioCalculator)==null?void 0:f.call(c,a,u))||u/a,d=e.parentNode.parentNode;d.style.paddingBottom=`${l*100}%`,e.setAttribute("lazy",h.LOADED),e.removeAttribute("src"),e.setAttribute("src",r),n(!0)}).catch(()=>{const i=this._realObserver(e);i&&i.disconnect(),o&&(e.setAttribute("lazy",h.ERROR),e.setAttribute("src",o),n(!1)),this._log(()=>{throw new Error(`Image failed to load!And failed src was: ${r} `)})})}_isOpenLazy(){return T&&this.lazyActive}_initIntersectionObserver(e,r,n,o){const s=this.options.observerOptions;this._images.set(e,new IntersectionObserver(a=>{Array.prototype.forEach.call(a,u=>{if(u.isIntersecting){const l=this._realObserver(e);l&&l.unobserve(u.target),this._setImageSrc(e,r,n,o)}})},s));const i=this._realObserver(e);i&&i.observe(e)}_valueFormatter(e){let r=e,n=this.options.loading,o=this.options.error;return v(e)&&(r=e.src,n=e.loading||this.options.loading,o=e.error||this.options.error),{src:r,loading:n,error:o}}_log(e){this.options.log&&e()}_realObserver(e){return this._images.get(e)}}const S=D({props:{list:{type:Array,default:()=>[]},rowKey:{type:String,default:"id"},imgSelector:{type:String,default:"src"},width:{type:Number,default:200},breakpoints:{type:Object,default:()=>({1200:{rowPerView:3},800:{rowPerView:2},500:{rowPerView:1}})},gutter:{type:Number,default:10},hasAroundGutter:{type:Boolean,default:!0},posDuration:{type:Number,default:300},animationPrefix:{type:String,default:"animate__animated"},animationEffect:{type:String,default:"fadeIn"},animationDuration:{type:Number,default:1e3},animationDelay:{type:Number,default:300},backgroundColor:{type:String,default:"#fff"},lazyload:{type:Boolean,default:!0},loadProps:{type:Object,default:()=>{}},crossOrigin:{type:Boolean,default:!0},delay:{type:Number,default:300},align:{type:String,default:"center"}},setup(t,e){const r=new wt(t.lazyload,t.loadProps,t.crossOrigin);R("lazy",r);const{waterfallWrapper:n,wrapperWidth:o,colWidth:s,cols:i,offsetX:a}=st(t),{wrapperHeight:u,layoutHandle:l}=ut(t,s,i,a,n),d=X(()=>{l().then(()=>{e.emit("afterRender")})},t.delay);J(()=>[o,s,t.list],()=>{o.value>0&&d()},{deep:!0});const c=g(0);return R("sizeChangeTime",c),R("imgLoaded",d),{waterfallWrapper:n,wrapperHeight:u,getRenderURL:m=>dt(m,t.imgSelector)[0],getKey:(m,w)=>m[t.rowKey]||w,renderer:d}}}),Y=()=>{q(t=>({"84adae44":t.backgroundColor}))},U=S.setup;S.setup=U?(t,e)=>(Y(),U(t,e)):Y;const bt=S,Et={class:"waterfall-card"};function pt(t,e,r,n,o,s){return E(),p("div",{ref:"waterfallWrapper",class:"waterfall-list",style:rt({height:`${t.wrapperHeight}px`})},[(E(!0),p($,null,tt(t.list,(i,a)=>(E(),p("div",{key:t.getKey(i,a),class:"waterfall-item"},[I("div",Et,[et(t.$slots,"item",{item:i,index:a,url:t.getRenderURL(i)},void 0,!0)])]))),128))],4)}var xt=_(bt,[["render",pt],["__scopeId","data-v-6d3e5303"]]);const zt=D({props:{url:{type:String,default:""},title:{type:String,default:""},alt:{type:String,default:""}},setup(t,e){const r=F("imgLoaded"),n=F("lazy"),o=g(null);nt(()=>{s()}),ot(()=>{i()});function s(){!o.value||n.mount(o.value,t.url,u=>{r(),u?e.emit("success",t.url):e.emit("error",t.url)})}function i(){!o.value||n.unmount(o.value)}function a(){e.emit("load",t.url)}return{lazyRef:o,imageLoad:a}}}),Rt={class:"lazy__box"},It={class:"lazy__resource"},Ot=["title","alt"];function St(t,e,r,n,o,s){return E(),p("div",Rt,[I("div",It,[I("img",{ref:"lazyRef",class:"lazy__img",title:t.title,alt:t.alt,onLoad:e[0]||(e[0]=(...i)=>t.imageLoad&&t.imageLoad(...i))},null,40,Ot)])])}var Pt=_(zt,[["render",St],["__scopeId","data-v-640f8d40"]]);function Nt(t=6){return Number(Math.random().toString().substr(3,t)+Date.now()).toString(36)}const Dt=["#409EFF","#67C23A","#E6A23C","#F56C6C","#909399"];function Ft(t,e){return Math.floor(Math.random()*(e-t+1))+t}function _t(){return Dt[Ft(0,4)]}const jt="https://www.getphotoblanket.com",Tt=({page:t=1,pageSize:e=20})=>{const r=`${jt}/products.json?page=${t}&limit=${e}`;return fetch(r).then(n=>n.json()).then(n=>n.products).then(n=>n.map(o=>({id:Nt(),star:!1,price:o.variants[0].price,src:{original:Math.random()>.1?o.images[0].src:"https://www.example.com/non-existent-image.jpg"},backgroundColor:_t(),name:o.title})))};export{Pt as L,xt as W,Lt as e,Tt as g,Ct as l}; diff --git a/docs/assets/index.dd4211c2.js b/docs/assets/index.5c4ccb44.js similarity index 68% rename from docs/assets/index.dd4211c2.js rename to docs/assets/index.5c4ccb44.js index 2191919..d53f3b5 100644 --- a/docs/assets/index.dd4211c2.js +++ b/docs/assets/index.5c4ccb44.js @@ -1 +1 @@ -import{r as _,o as c,c as g,a as y,b as i,w as l,d as u,e as P,K as L,f,g as k,h as x,i as E,j as b,k as A}from"./vendor.89609b2d.js";const O=function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const n of r.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&t(n)}).observe(document,{childList:!0,subtree:!0});function o(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerpolicy&&(r.referrerPolicy=e.referrerpolicy),e.crossorigin==="use-credentials"?r.credentials="include":e.crossorigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function t(e){if(e.ep)return;e.ep=!0;const r=o(e);fetch(e.href,r)}};O();var w=(a,s)=>{for(const[o,t]of s)a[o]=t;return a};const B={},C={class:"page-nav"},N=f(" \u57FA\u7840API\u5C55\u793A "),$=f(" \u6570\u636E\u5206\u9875\u5C55\u793A ");function I(a,s){const o=_("router-link"),t=_("router-view");return c(),g("div",null,[y("nav",C,[i(o,{to:"/page-a"},{default:l(()=>[N]),_:1}),i(o,{to:"/page-b"},{default:l(()=>[$]),_:1})]),i(t,null,{default:l(({Component:e})=>[(c(),u(L,null,[(c(),u(P(e)))],1024))]),_:1})])}var V=w(B,[["render",I],["__scopeId","data-v-9ecc2122"]]);const j=k({setup(a){return(s,o)=>(c(),u(V))}}),R="modulepreload",p={},W="./",m=function(s,o){return!o||o.length===0?s():Promise.all(o.map(t=>{if(t=`${W}${t}`,t in p)return;p[t]=!0;const e=t.endsWith(".css"),r=e?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${t}"]${r}`))return;const n=document.createElement("link");if(n.rel=e?"stylesheet":R,e||(n.as="script",n.crossOrigin=""),n.href=t,document.head.appendChild(n),e)return new Promise((h,v)=>{n.addEventListener("load",h),n.addEventListener("error",v)})})).then(()=>s())},D=x({history:E(),routes:[{path:"/",redirect:"/page-a"},{path:"/page-a",name:"PageA",component:()=>m(()=>import("./PageA.950c057e.js"),["assets/PageA.950c057e.js","assets/PageA.52cb6fcd.css","assets/api.ac58b069.js","assets/api.e93543f3.css","assets/vendor.89609b2d.js"])},{path:"/page-b",name:"PageB",component:()=>m(()=>import("./PageB.97751dea.js"),["assets/PageB.97751dea.js","assets/PageB.d0650836.css","assets/api.ac58b069.js","assets/api.e93543f3.css","assets/vendor.89609b2d.js"])}]});const d=b(j);d.use(A);d.use(D);d.mount("#app");export{w as _}; +import{r as _,o as c,c as g,a as y,b as i,w as l,d as u,e as P,K as b,f,g as L,h as k,i as x,j as E,k as A}from"./vendor.705dcf8c.js";const O=function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver(e=>{for(const r of e)if(r.type==="childList")for(const n of r.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&t(n)}).observe(document,{childList:!0,subtree:!0});function o(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerpolicy&&(r.referrerPolicy=e.referrerpolicy),e.crossorigin==="use-credentials"?r.credentials="include":e.crossorigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function t(e){if(e.ep)return;e.ep=!0;const r=o(e);fetch(e.href,r)}};O();var w=(a,s)=>{for(const[o,t]of s)a[o]=t;return a};const B={},C={class:"page-nav"},N=f(" \u57FA\u7840API\u5C55\u793A "),$=f(" \u6570\u636E\u5206\u9875\u5C55\u793A ");function I(a,s){const o=_("router-link"),t=_("router-view");return c(),g("div",null,[y("nav",C,[i(o,{to:"/page-a"},{default:l(()=>[N]),_:1}),i(o,{to:"/page-b"},{default:l(()=>[$]),_:1})]),i(t,null,{default:l(({Component:e})=>[(c(),u(b,null,[(c(),u(P(e)))],1024))]),_:1})])}var V=w(B,[["render",I],["__scopeId","data-v-9ecc2122"]]);const j=L({setup(a){return(s,o)=>(c(),u(V))}}),R="modulepreload",p={},W="./",m=function(s,o){return!o||o.length===0?s():Promise.all(o.map(t=>{if(t=`${W}${t}`,t in p)return;p[t]=!0;const e=t.endsWith(".css"),r=e?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${t}"]${r}`))return;const n=document.createElement("link");if(n.rel=e?"stylesheet":R,e||(n.as="script",n.crossOrigin=""),n.href=t,document.head.appendChild(n),e)return new Promise((h,v)=>{n.addEventListener("load",h),n.addEventListener("error",v)})})).then(()=>s())},D=k({history:x(),routes:[{path:"/",redirect:"/page-a"},{path:"/page-a",name:"PageA",component:()=>m(()=>import("./PageA.0d2cb5ba.js"),["assets/PageA.0d2cb5ba.js","assets/PageA.52cb6fcd.css","assets/api.ddc1e152.js","assets/api.2c6172ca.css","assets/vendor.705dcf8c.js"])},{path:"/page-b",name:"PageB",component:()=>m(()=>import("./PageB.1e6a7ebb.js"),["assets/PageB.1e6a7ebb.js","assets/PageB.d0650836.css","assets/api.ddc1e152.js","assets/api.2c6172ca.css","assets/vendor.705dcf8c.js"])}]});const d=E(j);d.use(A);d.use(D);d.mount("#app");export{w as _}; diff --git a/docs/assets/vendor.89609b2d.js b/docs/assets/vendor.705dcf8c.js similarity index 99% rename from docs/assets/vendor.89609b2d.js rename to docs/assets/vendor.705dcf8c.js index ecb8769..65cf6f5 100644 --- a/docs/assets/vendor.89609b2d.js +++ b/docs/assets/vendor.705dcf8c.js @@ -54,4 +54,4 @@ var F0=Object.defineProperty,V0=Object.defineProperties;var _0=Object.getOwnProp * vue-router v4.2.5 * (c) 2023 Eduardo San Martin Morote * @license MIT - */const Ea=typeof window!="undefined";function kW(e){return e.__esModule||e[Symbol.toStringTag]==="Module"}const St=Object.assign;function Hd(e,t){const n={};for(const o in t){const l=t[o];n[o]=Qn(l)?l.map(e):e(l)}return n}const Rr=()=>{},Qn=Array.isArray,EW=/\/$/,TW=e=>e.replace(EW,"");function Kd(e,t,n="/"){let o,l={},a="",r="";const s=t.indexOf("#");let i=t.indexOf("?");return s=0&&(i=-1),i>-1&&(o=t.slice(0,i),a=t.slice(i+1,s>-1?s:t.length),l=e(a)),s>-1&&(o=o||t.slice(0,s),r=t.slice(s,t.length)),o=AW(o!=null?o:t,n),{fullPath:o+(a&&"?")+a+r,path:o,query:l,hash:r}}function MW(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function c0(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function NW(e,t,n){const o=t.matched.length-1,l=n.matched.length-1;return o>-1&&o===l&&Ta(t.matched[o],n.matched[l])&&d0(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Ta(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function d0(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!OW(e[n],t[n]))return!1;return!0}function OW(e,t){return Qn(e)?f0(e,t):Qn(t)?f0(t,e):e===t}function f0(e,t){return Qn(t)?e.length===t.length&&e.every((n,o)=>n===t[o]):e.length===1&&e[0]===t}function AW(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),o=e.split("/"),l=o[o.length-1];(l===".."||l===".")&&o.push("");let a=n.length-1,r,s;for(r=0;r1&&a--;else break;return n.slice(0,a).join("/")+"/"+o.slice(r-(r===o.length?1:0)).join("/")}var Lr;(function(e){e.pop="pop",e.push="push"})(Lr||(Lr={}));var Br;(function(e){e.back="back",e.forward="forward",e.unknown=""})(Br||(Br={}));function PW(e){if(!e)if(Ea){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),TW(e)}const IW=/^[^#]+#/;function DW(e,t){return e.replace(IW,"#")+t}function RW(e,t){const n=document.documentElement.getBoundingClientRect(),o=e.getBoundingClientRect();return{behavior:t.behavior,left:o.left-n.left-(t.left||0),top:o.top-n.top-(t.top||0)}}const Di=()=>({left:window.pageXOffset,top:window.pageYOffset});function LW(e){let t;if("el"in e){const n=e.el,o=typeof n=="string"&&n.startsWith("#"),l=typeof n=="string"?o?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!l)return;t=RW(l,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.pageXOffset,t.top!=null?t.top:window.pageYOffset)}function p0(e,t){return(history.state?history.state.position-t:-1)+e}const jd=new Map;function BW(e,t){jd.set(e,t)}function FW(e){const t=jd.get(e);return jd.delete(e),t}let VW=()=>location.protocol+"//"+location.host;function h0(e,t){const{pathname:n,search:o,hash:l}=t,a=e.indexOf("#");if(a>-1){let s=l.includes(e.slice(a))?e.slice(a).length:1,i=l.slice(s);return i[0]!=="/"&&(i="/"+i),c0(i,"")}return c0(n,e)+o+l}function _W(e,t,n,o){let l=[],a=[],r=null;const s=({state:d})=>{const p=h0(e,location),h=n.value,m=t.value;let v=0;if(d){if(n.value=p,t.value=d,r&&r===h){r=null;return}v=m?d.position-m.position:0}else o(p);l.forEach(g=>{g(n.value,h,{delta:v,type:Lr.pop,direction:v?v>0?Br.forward:Br.back:Br.unknown})})};function i(){r=n.value}function u(d){l.push(d);const p=()=>{const h=l.indexOf(d);h>-1&&l.splice(h,1)};return a.push(p),p}function c(){const{history:d}=window;!d.state||d.replaceState(St({},d.state,{scroll:Di()}),"")}function f(){for(const d of a)d();a=[],window.removeEventListener("popstate",s),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",s),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:i,listen:u,destroy:f}}function v0(e,t,n,o=!1,l=!1){return{back:e,current:t,forward:n,replaced:o,position:window.history.length,scroll:l?Di():null}}function zW(e){const{history:t,location:n}=window,o={value:h0(e,n)},l={value:t.state};l.value||a(o.value,{back:null,current:o.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(i,u,c){const f=e.indexOf("#"),d=f>-1?(n.host&&document.querySelector("base")?e:e.slice(f))+i:VW()+e+i;try{t[c?"replaceState":"pushState"](u,"",d),l.value=u}catch(p){console.error(p),n[c?"replace":"assign"](d)}}function r(i,u){const c=St({},t.state,v0(l.value.back,i,l.value.forward,!0),u,{position:l.value.position});a(i,c,!0),o.value=i}function s(i,u){const c=St({},l.value,t.state,{forward:i,scroll:Di()});a(c.current,c,!0);const f=St({},v0(o.value,i,null),{position:c.position+1},u);a(i,f,!1),o.value=i}return{location:o,state:l,push:s,replace:r}}function HW(e){e=PW(e);const t=zW(e),n=_W(e,t.state,t.location,t.replace);function o(a,r=!0){r||n.pauseListeners(),history.go(a)}const l=St({location:"",base:e,go:o,createHref:DW.bind(null,e)},t,n);return Object.defineProperty(l,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(l,"state",{enumerable:!0,get:()=>t.state.value}),l}function PU(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),HW(e)}function KW(e){return typeof e=="string"||e&&typeof e=="object"}function m0(e){return typeof e=="string"||typeof e=="symbol"}const qo={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},g0=Symbol("");var y0;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(y0||(y0={}));function Ma(e,t){return St(new Error,{type:e,[g0]:!0},t)}function Mo(e,t){return e instanceof Error&&g0 in e&&(t==null||!!(e.type&t))}const b0="[^/]+?",jW={sensitive:!1,strict:!1,start:!0,end:!0},WW=/[.+*?^${}()[\]/\\]/g;function UW(e,t){const n=St({},jW,t),o=[];let l=n.start?"^":"";const a=[];for(const u of e){const c=u.length?[]:[90];n.strict&&!u.length&&(l+="/");for(let f=0;ft.length?t.length===1&&t[0]===40+40?1:-1:0}function qW(e,t){let n=0;const o=e.score,l=t.score;for(;n0&&t[t.length-1]<0}const GW={type:0,value:""},XW=/[a-zA-Z0-9_]/;function ZW(e){if(!e)return[[]];if(e==="/")return[[GW]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(p){throw new Error(`ERR (${n})/"${u}": ${p}`)}let n=0,o=n;const l=[];let a;function r(){a&&l.push(a),a=[]}let s=0,i,u="",c="";function f(){!u||(n===0?a.push({type:0,value:u}):n===1||n===2||n===3?(a.length>1&&(i==="*"||i==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),a.push({type:1,value:u,regexp:c,repeatable:i==="*"||i==="+",optional:i==="*"||i==="?"})):t("Invalid state to consume buffer"),u="")}function d(){u+=i}for(;s{r(y)}:Rr}function r(c){if(m0(c)){const f=o.get(c);f&&(o.delete(c),n.splice(n.indexOf(f),1),f.children.forEach(r),f.alias.forEach(r))}else{const f=n.indexOf(c);f>-1&&(n.splice(f,1),c.record.name&&o.delete(c.record.name),c.children.forEach(r),c.alias.forEach(r))}}function s(){return n}function i(c){let f=0;for(;f=0&&(c.record.path!==n[f].record.path||!k0(c,n[f]));)f++;n.splice(f,0,c),c.record.name&&!$0(c)&&o.set(c.record.name,c)}function u(c,f){let d,p={},h,m;if("name"in c&&c.name){if(d=o.get(c.name),!d)throw Ma(1,{location:c});m=d.record.name,p=St(C0(f.params,d.keys.filter(y=>!y.optional).map(y=>y.name)),c.params&&C0(c.params,d.keys.map(y=>y.name))),h=d.stringify(p)}else if("path"in c)h=c.path,d=n.find(y=>y.re.test(h)),d&&(p=d.parse(h),m=d.record.name);else{if(d=f.name?o.get(f.name):n.find(y=>y.re.test(f.path)),!d)throw Ma(1,{location:c,currentLocation:f});m=d.record.name,p=St({},f.params,c.params),h=d.stringify(p)}const v=[];let g=d;for(;g;)v.unshift(g.record),g=g.parent;return{name:m,path:h,params:p,matched:v,meta:tU(v)}}return e.forEach(c=>a(c)),{addRoute:a,resolve:u,removeRoute:r,getRoutes:s,getRecordMatcher:l}}function C0(e,t){const n={};for(const o of t)o in e&&(n[o]=e[o]);return n}function xW(e){return{path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:void 0,beforeEnter:e.beforeEnter,props:eU(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}}}function eU(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const o in e.components)t[o]=typeof n=="object"?n[o]:n;return t}function $0(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function tU(e){return e.reduce((t,n)=>St(t,n.meta),{})}function S0(e,t){const n={};for(const o in e)n[o]=o in t?t[o]:e[o];return n}function k0(e,t){return t.children.some(n=>n===e||k0(e,n))}const E0=/#/g,nU=/&/g,oU=/\//g,lU=/=/g,aU=/\?/g,T0=/\+/g,rU=/%5B/g,sU=/%5D/g,M0=/%5E/g,iU=/%60/g,N0=/%7B/g,uU=/%7C/g,O0=/%7D/g,cU=/%20/g;function Wd(e){return encodeURI(""+e).replace(uU,"|").replace(rU,"[").replace(sU,"]")}function dU(e){return Wd(e).replace(N0,"{").replace(O0,"}").replace(M0,"^")}function Ud(e){return Wd(e).replace(T0,"%2B").replace(cU,"+").replace(E0,"%23").replace(nU,"%26").replace(iU,"`").replace(N0,"{").replace(O0,"}").replace(M0,"^")}function fU(e){return Ud(e).replace(lU,"%3D")}function pU(e){return Wd(e).replace(E0,"%23").replace(aU,"%3F")}function hU(e){return e==null?"":pU(e).replace(oU,"%2F")}function Ri(e){try{return decodeURIComponent(""+e)}catch{}return""+e}function vU(e){const t={};if(e===""||e==="?")return t;const o=(e[0]==="?"?e.slice(1):e).split("&");for(let l=0;la&&Ud(a)):[o&&Ud(o)]).forEach(a=>{a!==void 0&&(t+=(t.length?"&":"")+n,a!=null&&(t+="="+a))})}return t}function mU(e){const t={};for(const n in e){const o=e[n];o!==void 0&&(t[n]=Qn(o)?o.map(l=>l==null?null:""+l):o==null?o:""+o)}return t}const gU=Symbol(""),P0=Symbol(""),Yd=Symbol(""),I0=Symbol(""),qd=Symbol("");function Fr(){let e=[];function t(o){return e.push(o),()=>{const l=e.indexOf(o);l>-1&&e.splice(l,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Go(e,t,n,o,l){const a=o&&(o.enterCallbacks[l]=o.enterCallbacks[l]||[]);return()=>new Promise((r,s)=>{const i=f=>{f===!1?s(Ma(4,{from:n,to:t})):f instanceof Error?s(f):KW(f)?s(Ma(2,{from:t,to:f})):(a&&o.enterCallbacks[l]===a&&typeof f=="function"&&a.push(f),r())},u=e.call(o&&o.instances[l],t,n,i);let c=Promise.resolve(u);e.length<3&&(c=c.then(i)),c.catch(f=>s(f))})}function Gd(e,t,n,o){const l=[];for(const a of e)for(const r in a.components){let s=a.components[r];if(!(t!=="beforeRouteEnter"&&!a.instances[r]))if(yU(s)){const u=(s.__vccOpts||s)[t];u&&l.push(Go(u,n,o,a,r))}else{let i=s();l.push(()=>i.then(u=>{if(!u)return Promise.reject(new Error(`Couldn't resolve component "${r}" at "${a.path}"`));const c=kW(u)?u.default:u;a.components[r]=c;const d=(c.__vccOpts||c)[t];return d&&Go(d,n,o,a,r)()}))}}return l}function yU(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function D0(e){const t=Ae(Yd),n=Ae(I0),o=S(()=>t.resolve(E(e.to))),l=S(()=>{const{matched:i}=o.value,{length:u}=i,c=i[u-1],f=n.matched;if(!c||!f.length)return-1;const d=f.findIndex(Ta.bind(null,c));if(d>-1)return d;const p=R0(i[u-2]);return u>1&&R0(c)===p&&f[f.length-1].path!==p?f.findIndex(Ta.bind(null,i[u-2])):d}),a=S(()=>l.value>-1&&$U(n.params,o.value.params)),r=S(()=>l.value>-1&&l.value===n.matched.length-1&&d0(n.params,o.value.params));function s(i={}){return CU(i)?t[E(e.replace)?"replace":"push"](E(e.to)).catch(Rr):Promise.resolve()}return{route:o,href:S(()=>o.value.href),isActive:a,isExactActive:r,navigate:s}}const bU=ee({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:D0,setup(e,{slots:t}){const n=$t(D0(e)),{options:o}=Ae(Yd),l=S(()=>({[L0(e.activeClass,o.linkActiveClass,"router-link-active")]:n.isActive,[L0(e.exactActiveClass,o.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&t.default(n);return e.custom?a:ke("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:l.value},a)}}}),wU=bU;function CU(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function $U(e,t){for(const n in t){const o=t[n],l=e[n];if(typeof o=="string"){if(o!==l)return!1}else if(!Qn(l)||l.length!==o.length||o.some((a,r)=>a!==l[r]))return!1}return!0}function R0(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const L0=(e,t,n)=>e!=null?e:t!=null?t:n,SU=ee({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const o=Ae(qd),l=S(()=>e.route||o.value),a=Ae(P0,0),r=S(()=>{let u=E(a);const{matched:c}=l.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),s=S(()=>l.value.matched[r.value]);nt(P0,S(()=>r.value+1)),nt(gU,s),nt(qd,l);const i=N();return ve(()=>[i.value,s.value,e.name],([u,c,f],[d,p,h])=>{c&&(c.instances[f]=u,p&&p!==c&&u&&u===d&&(c.leaveGuards.size||(c.leaveGuards=p.leaveGuards),c.updateGuards.size||(c.updateGuards=p.updateGuards))),u&&c&&(!p||!Ta(c,p)||!d)&&(c.enterCallbacks[f]||[]).forEach(m=>m(u))},{flush:"post"}),()=>{const u=l.value,c=e.name,f=s.value,d=f&&f.components[c];if(!d)return B0(n.default,{Component:d,route:u});const p=f.props[c],h=p?p===!0?u.params:typeof p=="function"?p(u):p:null,v=ke(d,St({},h,t,{onVnodeUnmounted:g=>{g.component.isUnmounted&&(f.instances[c]=null)},ref:i}));return B0(n.default,{Component:v,route:u})||v}}});function B0(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const kU=SU;function IU(e){const t=QW(e.routes,e),n=e.parseQuery||vU,o=e.stringifyQuery||A0,l=e.history,a=Fr(),r=Fr(),s=Fr(),i=Ht(qo);let u=qo;Ea&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=Hd.bind(null,W=>""+W),f=Hd.bind(null,hU),d=Hd.bind(null,Ri);function p(W,le){let pe,$e;return m0(W)?(pe=t.getRecordMatcher(W),$e=le):$e=W,t.addRoute($e,pe)}function h(W){const le=t.getRecordMatcher(W);le&&t.removeRoute(le)}function m(){return t.getRoutes().map(W=>W.record)}function v(W){return!!t.getRecordMatcher(W)}function g(W,le){if(le=St({},le||i.value),typeof W=="string"){const Y=Kd(n,W,le.path),re=t.resolve({path:Y.path},le),be=l.createHref(Y.fullPath);return St(Y,re,{params:d(re.params),hash:Ri(Y.hash),redirectedFrom:void 0,href:be})}let pe;if("path"in W)pe=St({},W,{path:Kd(n,W.path,le.path).path});else{const Y=St({},W.params);for(const re in Y)Y[re]==null&&delete Y[re];pe=St({},W,{params:f(Y)}),le.params=f(le.params)}const $e=t.resolve(pe,le),Le=W.hash||"";$e.params=c(d($e.params));const Be=MW(o,St({},W,{hash:dU(Le),path:$e.path})),K=l.createHref(Be);return St({fullPath:Be,hash:Le,query:o===A0?mU(W.query):W.query||{}},$e,{redirectedFrom:void 0,href:K})}function y(W){return typeof W=="string"?Kd(n,W,i.value.path):St({},W)}function C(W,le){if(u!==W)return Ma(8,{from:le,to:W})}function $(W){return M(W)}function b(W){return $(St(y(W),{replace:!0}))}function k(W){const le=W.matched[W.matched.length-1];if(le&&le.redirect){const{redirect:pe}=le;let $e=typeof pe=="function"?pe(W):pe;return typeof $e=="string"&&($e=$e.includes("?")||$e.includes("#")?$e=y($e):{path:$e},$e.params={}),St({query:W.query,hash:W.hash,params:"path"in $e?{}:W.params},$e)}}function M(W,le){const pe=u=g(W),$e=i.value,Le=W.state,Be=W.force,K=W.replace===!0,Y=k(pe);if(Y)return M(St(y(Y),{state:typeof Y=="object"?St({},Le,Y.state):Le,force:Be,replace:K}),le||pe);const re=pe;re.redirectedFrom=le;let be;return!Be&&NW(o,$e,pe)&&(be=Ma(16,{to:re,from:$e}),he($e,$e,!0,!1)),(be?Promise.resolve(be):P(re,$e)).catch(fe=>Mo(fe)?Mo(fe,2)?fe:U(fe):B(fe,re,$e)).then(fe=>{if(fe){if(Mo(fe,2))return M(St({replace:K},y(fe.to),{state:typeof fe.to=="object"?St({},Le,fe.to.state):Le,force:Be}),le||re)}else fe=I(re,$e,!0,K,Le);return F(re,$e,fe),fe})}function D(W,le){const pe=C(W,le);return pe?Promise.reject(pe):Promise.resolve()}function V(W){const le=se.values().next().value;return le&&typeof le.runWithContext=="function"?le.runWithContext(W):W()}function P(W,le){let pe;const[$e,Le,Be]=EU(W,le);pe=Gd($e.reverse(),"beforeRouteLeave",W,le);for(const Y of $e)Y.leaveGuards.forEach(re=>{pe.push(Go(re,W,le))});const K=D.bind(null,W,le);return pe.push(K),ie(pe).then(()=>{pe=[];for(const Y of a.list())pe.push(Go(Y,W,le));return pe.push(K),ie(pe)}).then(()=>{pe=Gd(Le,"beforeRouteUpdate",W,le);for(const Y of Le)Y.updateGuards.forEach(re=>{pe.push(Go(re,W,le))});return pe.push(K),ie(pe)}).then(()=>{pe=[];for(const Y of Be)if(Y.beforeEnter)if(Qn(Y.beforeEnter))for(const re of Y.beforeEnter)pe.push(Go(re,W,le));else pe.push(Go(Y.beforeEnter,W,le));return pe.push(K),ie(pe)}).then(()=>(W.matched.forEach(Y=>Y.enterCallbacks={}),pe=Gd(Be,"beforeRouteEnter",W,le),pe.push(K),ie(pe))).then(()=>{pe=[];for(const Y of r.list())pe.push(Go(Y,W,le));return pe.push(K),ie(pe)}).catch(Y=>Mo(Y,8)?Y:Promise.reject(Y))}function F(W,le,pe){s.list().forEach($e=>V(()=>$e(W,le,pe)))}function I(W,le,pe,$e,Le){const Be=C(W,le);if(Be)return Be;const K=le===qo,Y=Ea?history.state:{};pe&&($e||K?l.replace(W.fullPath,St({scroll:K&&Y&&Y.scroll},Le)):l.push(W.fullPath,Le)),i.value=W,he(W,le,pe,K),U()}let R;function j(){R||(R=l.listen((W,le,pe)=>{if(!ge.listening)return;const $e=g(W),Le=k($e);if(Le){M(St(Le,{replace:!0}),$e).catch(Rr);return}u=$e;const Be=i.value;Ea&&BW(p0(Be.fullPath,pe.delta),Di()),P($e,Be).catch(K=>Mo(K,4|8)?K:Mo(K,2)?(M(K.to,$e).then(Y=>{Mo(Y,4|16)&&!pe.delta&&pe.type===Lr.pop&&l.go(-1,!1)}).catch(Rr),Promise.reject()):(pe.delta&&l.go(-pe.delta,!1),B(K,$e,Be))).then(K=>{K=K||I($e,Be,!1),K&&(pe.delta&&!Mo(K,8)?l.go(-pe.delta,!1):pe.type===Lr.pop&&Mo(K,4|16)&&l.go(-1,!1)),F($e,Be,K)}).catch(Rr)}))}let _=Fr(),H=Fr(),O;function B(W,le,pe){U(W);const $e=H.list();return $e.length?$e.forEach(Le=>Le(W,le,pe)):console.error(W),Promise.reject(W)}function G(){return O&&i.value!==qo?Promise.resolve():new Promise((W,le)=>{_.add([W,le])})}function U(W){return O||(O=!W,j(),_.list().forEach(([le,pe])=>W?pe(W):le()),_.reset()),W}function he(W,le,pe,$e){const{scrollBehavior:Le}=e;if(!Ea||!Le)return Promise.resolve();const Be=!pe&&FW(p0(W.fullPath,0))||($e||!pe)&&history.state&&history.state.scroll||null;return _e().then(()=>Le(W,le,Be)).then(K=>K&&LW(K)).catch(K=>B(K,W,le))}const de=W=>l.go(W);let we;const se=new Set,ge={currentRoute:i,listening:!0,addRoute:p,removeRoute:h,hasRoute:v,getRoutes:m,resolve:g,options:e,push:$,replace:b,go:de,back:()=>de(-1),forward:()=>de(1),beforeEach:a.add,beforeResolve:r.add,afterEach:s.add,onError:H.add,isReady:G,install(W){const le=this;W.component("RouterLink",wU),W.component("RouterView",kU),W.config.globalProperties.$router=le,Object.defineProperty(W.config.globalProperties,"$route",{enumerable:!0,get:()=>E(i)}),Ea&&!we&&i.value===qo&&(we=!0,$(l.location).catch(Le=>{}));const pe={};for(const Le in qo)Object.defineProperty(pe,Le,{get:()=>i.value[Le],enumerable:!0});W.provide(Yd,le),W.provide(I0,Tf(pe)),W.provide(qd,i);const $e=W.unmount;se.add(W),W.unmount=function(){se.delete(W),se.size<1&&(u=qo,R&&R(),R=null,i.value=qo,we=!1,O=!1),$e()}}};function ie(W){return W.reduce((le,pe)=>le.then(()=>V(pe)),Promise.resolve())}return ge}function EU(e,t){const n=[],o=[],l=[],a=Math.max(t.matched.length,e.matched.length);for(let r=0;rTa(u,s))?o.push(s):n.push(s));const i=e.matched[r];i&&(t.matched.find(u=>Ta(u,i))||l.push(i))}return[n,o,l]}export{OU as A,ve as B,NU as C,ce as D,De as E,Re as F,Ae as G,zl as H,T as I,MU as K,L as a,X as b,A as c,Q as d,ct as e,st as f,ee as g,IU as h,PU as i,mC as j,AU as k,N as l,Ze as m,Ke as n,w as o,S as p,Bt as q,ne as r,$t as s,me as t,E as u,at as v,q as w,Z as x,ar as y,nt as z}; + */const Ea=typeof window!="undefined";function kW(e){return e.__esModule||e[Symbol.toStringTag]==="Module"}const St=Object.assign;function Hd(e,t){const n={};for(const o in t){const l=t[o];n[o]=Qn(l)?l.map(e):e(l)}return n}const Rr=()=>{},Qn=Array.isArray,EW=/\/$/,TW=e=>e.replace(EW,"");function Kd(e,t,n="/"){let o,l={},a="",r="";const s=t.indexOf("#");let i=t.indexOf("?");return s=0&&(i=-1),i>-1&&(o=t.slice(0,i),a=t.slice(i+1,s>-1?s:t.length),l=e(a)),s>-1&&(o=o||t.slice(0,s),r=t.slice(s,t.length)),o=AW(o!=null?o:t,n),{fullPath:o+(a&&"?")+a+r,path:o,query:l,hash:r}}function MW(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function c0(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function NW(e,t,n){const o=t.matched.length-1,l=n.matched.length-1;return o>-1&&o===l&&Ta(t.matched[o],n.matched[l])&&d0(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Ta(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function d0(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!OW(e[n],t[n]))return!1;return!0}function OW(e,t){return Qn(e)?f0(e,t):Qn(t)?f0(t,e):e===t}function f0(e,t){return Qn(t)?e.length===t.length&&e.every((n,o)=>n===t[o]):e.length===1&&e[0]===t}function AW(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),o=e.split("/"),l=o[o.length-1];(l===".."||l===".")&&o.push("");let a=n.length-1,r,s;for(r=0;r1&&a--;else break;return n.slice(0,a).join("/")+"/"+o.slice(r-(r===o.length?1:0)).join("/")}var Lr;(function(e){e.pop="pop",e.push="push"})(Lr||(Lr={}));var Br;(function(e){e.back="back",e.forward="forward",e.unknown=""})(Br||(Br={}));function PW(e){if(!e)if(Ea){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),TW(e)}const IW=/^[^#]+#/;function DW(e,t){return e.replace(IW,"#")+t}function RW(e,t){const n=document.documentElement.getBoundingClientRect(),o=e.getBoundingClientRect();return{behavior:t.behavior,left:o.left-n.left-(t.left||0),top:o.top-n.top-(t.top||0)}}const Di=()=>({left:window.pageXOffset,top:window.pageYOffset});function LW(e){let t;if("el"in e){const n=e.el,o=typeof n=="string"&&n.startsWith("#"),l=typeof n=="string"?o?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!l)return;t=RW(l,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.pageXOffset,t.top!=null?t.top:window.pageYOffset)}function p0(e,t){return(history.state?history.state.position-t:-1)+e}const jd=new Map;function BW(e,t){jd.set(e,t)}function FW(e){const t=jd.get(e);return jd.delete(e),t}let VW=()=>location.protocol+"//"+location.host;function h0(e,t){const{pathname:n,search:o,hash:l}=t,a=e.indexOf("#");if(a>-1){let s=l.includes(e.slice(a))?e.slice(a).length:1,i=l.slice(s);return i[0]!=="/"&&(i="/"+i),c0(i,"")}return c0(n,e)+o+l}function _W(e,t,n,o){let l=[],a=[],r=null;const s=({state:d})=>{const p=h0(e,location),h=n.value,m=t.value;let v=0;if(d){if(n.value=p,t.value=d,r&&r===h){r=null;return}v=m?d.position-m.position:0}else o(p);l.forEach(g=>{g(n.value,h,{delta:v,type:Lr.pop,direction:v?v>0?Br.forward:Br.back:Br.unknown})})};function i(){r=n.value}function u(d){l.push(d);const p=()=>{const h=l.indexOf(d);h>-1&&l.splice(h,1)};return a.push(p),p}function c(){const{history:d}=window;!d.state||d.replaceState(St({},d.state,{scroll:Di()}),"")}function f(){for(const d of a)d();a=[],window.removeEventListener("popstate",s),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",s),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:i,listen:u,destroy:f}}function v0(e,t,n,o=!1,l=!1){return{back:e,current:t,forward:n,replaced:o,position:window.history.length,scroll:l?Di():null}}function zW(e){const{history:t,location:n}=window,o={value:h0(e,n)},l={value:t.state};l.value||a(o.value,{back:null,current:o.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function a(i,u,c){const f=e.indexOf("#"),d=f>-1?(n.host&&document.querySelector("base")?e:e.slice(f))+i:VW()+e+i;try{t[c?"replaceState":"pushState"](u,"",d),l.value=u}catch(p){console.error(p),n[c?"replace":"assign"](d)}}function r(i,u){const c=St({},t.state,v0(l.value.back,i,l.value.forward,!0),u,{position:l.value.position});a(i,c,!0),o.value=i}function s(i,u){const c=St({},l.value,t.state,{forward:i,scroll:Di()});a(c.current,c,!0);const f=St({},v0(o.value,i,null),{position:c.position+1},u);a(i,f,!1),o.value=i}return{location:o,state:l,push:s,replace:r}}function HW(e){e=PW(e);const t=zW(e),n=_W(e,t.state,t.location,t.replace);function o(a,r=!0){r||n.pauseListeners(),history.go(a)}const l=St({location:"",base:e,go:o,createHref:DW.bind(null,e)},t,n);return Object.defineProperty(l,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(l,"state",{enumerable:!0,get:()=>t.state.value}),l}function PU(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),HW(e)}function KW(e){return typeof e=="string"||e&&typeof e=="object"}function m0(e){return typeof e=="string"||typeof e=="symbol"}const qo={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},g0=Symbol("");var y0;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(y0||(y0={}));function Ma(e,t){return St(new Error,{type:e,[g0]:!0},t)}function Mo(e,t){return e instanceof Error&&g0 in e&&(t==null||!!(e.type&t))}const b0="[^/]+?",jW={sensitive:!1,strict:!1,start:!0,end:!0},WW=/[.+*?^${}()[\]/\\]/g;function UW(e,t){const n=St({},jW,t),o=[];let l=n.start?"^":"";const a=[];for(const u of e){const c=u.length?[]:[90];n.strict&&!u.length&&(l+="/");for(let f=0;ft.length?t.length===1&&t[0]===40+40?1:-1:0}function qW(e,t){let n=0;const o=e.score,l=t.score;for(;n0&&t[t.length-1]<0}const GW={type:0,value:""},XW=/[a-zA-Z0-9_]/;function ZW(e){if(!e)return[[]];if(e==="/")return[[GW]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(p){throw new Error(`ERR (${n})/"${u}": ${p}`)}let n=0,o=n;const l=[];let a;function r(){a&&l.push(a),a=[]}let s=0,i,u="",c="";function f(){!u||(n===0?a.push({type:0,value:u}):n===1||n===2||n===3?(a.length>1&&(i==="*"||i==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),a.push({type:1,value:u,regexp:c,repeatable:i==="*"||i==="+",optional:i==="*"||i==="?"})):t("Invalid state to consume buffer"),u="")}function d(){u+=i}for(;s{r(y)}:Rr}function r(c){if(m0(c)){const f=o.get(c);f&&(o.delete(c),n.splice(n.indexOf(f),1),f.children.forEach(r),f.alias.forEach(r))}else{const f=n.indexOf(c);f>-1&&(n.splice(f,1),c.record.name&&o.delete(c.record.name),c.children.forEach(r),c.alias.forEach(r))}}function s(){return n}function i(c){let f=0;for(;f=0&&(c.record.path!==n[f].record.path||!k0(c,n[f]));)f++;n.splice(f,0,c),c.record.name&&!$0(c)&&o.set(c.record.name,c)}function u(c,f){let d,p={},h,m;if("name"in c&&c.name){if(d=o.get(c.name),!d)throw Ma(1,{location:c});m=d.record.name,p=St(C0(f.params,d.keys.filter(y=>!y.optional).map(y=>y.name)),c.params&&C0(c.params,d.keys.map(y=>y.name))),h=d.stringify(p)}else if("path"in c)h=c.path,d=n.find(y=>y.re.test(h)),d&&(p=d.parse(h),m=d.record.name);else{if(d=f.name?o.get(f.name):n.find(y=>y.re.test(f.path)),!d)throw Ma(1,{location:c,currentLocation:f});m=d.record.name,p=St({},f.params,c.params),h=d.stringify(p)}const v=[];let g=d;for(;g;)v.unshift(g.record),g=g.parent;return{name:m,path:h,params:p,matched:v,meta:tU(v)}}return e.forEach(c=>a(c)),{addRoute:a,resolve:u,removeRoute:r,getRoutes:s,getRecordMatcher:l}}function C0(e,t){const n={};for(const o of t)o in e&&(n[o]=e[o]);return n}function xW(e){return{path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:void 0,beforeEnter:e.beforeEnter,props:eU(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}}}function eU(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const o in e.components)t[o]=typeof n=="object"?n[o]:n;return t}function $0(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function tU(e){return e.reduce((t,n)=>St(t,n.meta),{})}function S0(e,t){const n={};for(const o in e)n[o]=o in t?t[o]:e[o];return n}function k0(e,t){return t.children.some(n=>n===e||k0(e,n))}const E0=/#/g,nU=/&/g,oU=/\//g,lU=/=/g,aU=/\?/g,T0=/\+/g,rU=/%5B/g,sU=/%5D/g,M0=/%5E/g,iU=/%60/g,N0=/%7B/g,uU=/%7C/g,O0=/%7D/g,cU=/%20/g;function Wd(e){return encodeURI(""+e).replace(uU,"|").replace(rU,"[").replace(sU,"]")}function dU(e){return Wd(e).replace(N0,"{").replace(O0,"}").replace(M0,"^")}function Ud(e){return Wd(e).replace(T0,"%2B").replace(cU,"+").replace(E0,"%23").replace(nU,"%26").replace(iU,"`").replace(N0,"{").replace(O0,"}").replace(M0,"^")}function fU(e){return Ud(e).replace(lU,"%3D")}function pU(e){return Wd(e).replace(E0,"%23").replace(aU,"%3F")}function hU(e){return e==null?"":pU(e).replace(oU,"%2F")}function Ri(e){try{return decodeURIComponent(""+e)}catch{}return""+e}function vU(e){const t={};if(e===""||e==="?")return t;const o=(e[0]==="?"?e.slice(1):e).split("&");for(let l=0;la&&Ud(a)):[o&&Ud(o)]).forEach(a=>{a!==void 0&&(t+=(t.length?"&":"")+n,a!=null&&(t+="="+a))})}return t}function mU(e){const t={};for(const n in e){const o=e[n];o!==void 0&&(t[n]=Qn(o)?o.map(l=>l==null?null:""+l):o==null?o:""+o)}return t}const gU=Symbol(""),P0=Symbol(""),Yd=Symbol(""),I0=Symbol(""),qd=Symbol("");function Fr(){let e=[];function t(o){return e.push(o),()=>{const l=e.indexOf(o);l>-1&&e.splice(l,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Go(e,t,n,o,l){const a=o&&(o.enterCallbacks[l]=o.enterCallbacks[l]||[]);return()=>new Promise((r,s)=>{const i=f=>{f===!1?s(Ma(4,{from:n,to:t})):f instanceof Error?s(f):KW(f)?s(Ma(2,{from:t,to:f})):(a&&o.enterCallbacks[l]===a&&typeof f=="function"&&a.push(f),r())},u=e.call(o&&o.instances[l],t,n,i);let c=Promise.resolve(u);e.length<3&&(c=c.then(i)),c.catch(f=>s(f))})}function Gd(e,t,n,o){const l=[];for(const a of e)for(const r in a.components){let s=a.components[r];if(!(t!=="beforeRouteEnter"&&!a.instances[r]))if(yU(s)){const u=(s.__vccOpts||s)[t];u&&l.push(Go(u,n,o,a,r))}else{let i=s();l.push(()=>i.then(u=>{if(!u)return Promise.reject(new Error(`Couldn't resolve component "${r}" at "${a.path}"`));const c=kW(u)?u.default:u;a.components[r]=c;const d=(c.__vccOpts||c)[t];return d&&Go(d,n,o,a,r)()}))}}return l}function yU(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function D0(e){const t=Ae(Yd),n=Ae(I0),o=S(()=>t.resolve(E(e.to))),l=S(()=>{const{matched:i}=o.value,{length:u}=i,c=i[u-1],f=n.matched;if(!c||!f.length)return-1;const d=f.findIndex(Ta.bind(null,c));if(d>-1)return d;const p=R0(i[u-2]);return u>1&&R0(c)===p&&f[f.length-1].path!==p?f.findIndex(Ta.bind(null,i[u-2])):d}),a=S(()=>l.value>-1&&$U(n.params,o.value.params)),r=S(()=>l.value>-1&&l.value===n.matched.length-1&&d0(n.params,o.value.params));function s(i={}){return CU(i)?t[E(e.replace)?"replace":"push"](E(e.to)).catch(Rr):Promise.resolve()}return{route:o,href:S(()=>o.value.href),isActive:a,isExactActive:r,navigate:s}}const bU=ee({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:D0,setup(e,{slots:t}){const n=$t(D0(e)),{options:o}=Ae(Yd),l=S(()=>({[L0(e.activeClass,o.linkActiveClass,"router-link-active")]:n.isActive,[L0(e.exactActiveClass,o.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const a=t.default&&t.default(n);return e.custom?a:ke("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:l.value},a)}}}),wU=bU;function CU(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function $U(e,t){for(const n in t){const o=t[n],l=e[n];if(typeof o=="string"){if(o!==l)return!1}else if(!Qn(l)||l.length!==o.length||o.some((a,r)=>a!==l[r]))return!1}return!0}function R0(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const L0=(e,t,n)=>e!=null?e:t!=null?t:n,SU=ee({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const o=Ae(qd),l=S(()=>e.route||o.value),a=Ae(P0,0),r=S(()=>{let u=E(a);const{matched:c}=l.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),s=S(()=>l.value.matched[r.value]);nt(P0,S(()=>r.value+1)),nt(gU,s),nt(qd,l);const i=N();return ve(()=>[i.value,s.value,e.name],([u,c,f],[d,p,h])=>{c&&(c.instances[f]=u,p&&p!==c&&u&&u===d&&(c.leaveGuards.size||(c.leaveGuards=p.leaveGuards),c.updateGuards.size||(c.updateGuards=p.updateGuards))),u&&c&&(!p||!Ta(c,p)||!d)&&(c.enterCallbacks[f]||[]).forEach(m=>m(u))},{flush:"post"}),()=>{const u=l.value,c=e.name,f=s.value,d=f&&f.components[c];if(!d)return B0(n.default,{Component:d,route:u});const p=f.props[c],h=p?p===!0?u.params:typeof p=="function"?p(u):p:null,v=ke(d,St({},h,t,{onVnodeUnmounted:g=>{g.component.isUnmounted&&(f.instances[c]=null)},ref:i}));return B0(n.default,{Component:v,route:u})||v}}});function B0(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const kU=SU;function IU(e){const t=QW(e.routes,e),n=e.parseQuery||vU,o=e.stringifyQuery||A0,l=e.history,a=Fr(),r=Fr(),s=Fr(),i=Ht(qo);let u=qo;Ea&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=Hd.bind(null,W=>""+W),f=Hd.bind(null,hU),d=Hd.bind(null,Ri);function p(W,le){let pe,$e;return m0(W)?(pe=t.getRecordMatcher(W),$e=le):$e=W,t.addRoute($e,pe)}function h(W){const le=t.getRecordMatcher(W);le&&t.removeRoute(le)}function m(){return t.getRoutes().map(W=>W.record)}function v(W){return!!t.getRecordMatcher(W)}function g(W,le){if(le=St({},le||i.value),typeof W=="string"){const Y=Kd(n,W,le.path),re=t.resolve({path:Y.path},le),be=l.createHref(Y.fullPath);return St(Y,re,{params:d(re.params),hash:Ri(Y.hash),redirectedFrom:void 0,href:be})}let pe;if("path"in W)pe=St({},W,{path:Kd(n,W.path,le.path).path});else{const Y=St({},W.params);for(const re in Y)Y[re]==null&&delete Y[re];pe=St({},W,{params:f(Y)}),le.params=f(le.params)}const $e=t.resolve(pe,le),Le=W.hash||"";$e.params=c(d($e.params));const Be=MW(o,St({},W,{hash:dU(Le),path:$e.path})),K=l.createHref(Be);return St({fullPath:Be,hash:Le,query:o===A0?mU(W.query):W.query||{}},$e,{redirectedFrom:void 0,href:K})}function y(W){return typeof W=="string"?Kd(n,W,i.value.path):St({},W)}function C(W,le){if(u!==W)return Ma(8,{from:le,to:W})}function $(W){return M(W)}function b(W){return $(St(y(W),{replace:!0}))}function k(W){const le=W.matched[W.matched.length-1];if(le&&le.redirect){const{redirect:pe}=le;let $e=typeof pe=="function"?pe(W):pe;return typeof $e=="string"&&($e=$e.includes("?")||$e.includes("#")?$e=y($e):{path:$e},$e.params={}),St({query:W.query,hash:W.hash,params:"path"in $e?{}:W.params},$e)}}function M(W,le){const pe=u=g(W),$e=i.value,Le=W.state,Be=W.force,K=W.replace===!0,Y=k(pe);if(Y)return M(St(y(Y),{state:typeof Y=="object"?St({},Le,Y.state):Le,force:Be,replace:K}),le||pe);const re=pe;re.redirectedFrom=le;let be;return!Be&&NW(o,$e,pe)&&(be=Ma(16,{to:re,from:$e}),he($e,$e,!0,!1)),(be?Promise.resolve(be):P(re,$e)).catch(fe=>Mo(fe)?Mo(fe,2)?fe:U(fe):B(fe,re,$e)).then(fe=>{if(fe){if(Mo(fe,2))return M(St({replace:K},y(fe.to),{state:typeof fe.to=="object"?St({},Le,fe.to.state):Le,force:Be}),le||re)}else fe=I(re,$e,!0,K,Le);return F(re,$e,fe),fe})}function D(W,le){const pe=C(W,le);return pe?Promise.reject(pe):Promise.resolve()}function V(W){const le=se.values().next().value;return le&&typeof le.runWithContext=="function"?le.runWithContext(W):W()}function P(W,le){let pe;const[$e,Le,Be]=EU(W,le);pe=Gd($e.reverse(),"beforeRouteLeave",W,le);for(const Y of $e)Y.leaveGuards.forEach(re=>{pe.push(Go(re,W,le))});const K=D.bind(null,W,le);return pe.push(K),ie(pe).then(()=>{pe=[];for(const Y of a.list())pe.push(Go(Y,W,le));return pe.push(K),ie(pe)}).then(()=>{pe=Gd(Le,"beforeRouteUpdate",W,le);for(const Y of Le)Y.updateGuards.forEach(re=>{pe.push(Go(re,W,le))});return pe.push(K),ie(pe)}).then(()=>{pe=[];for(const Y of Be)if(Y.beforeEnter)if(Qn(Y.beforeEnter))for(const re of Y.beforeEnter)pe.push(Go(re,W,le));else pe.push(Go(Y.beforeEnter,W,le));return pe.push(K),ie(pe)}).then(()=>(W.matched.forEach(Y=>Y.enterCallbacks={}),pe=Gd(Be,"beforeRouteEnter",W,le),pe.push(K),ie(pe))).then(()=>{pe=[];for(const Y of r.list())pe.push(Go(Y,W,le));return pe.push(K),ie(pe)}).catch(Y=>Mo(Y,8)?Y:Promise.reject(Y))}function F(W,le,pe){s.list().forEach($e=>V(()=>$e(W,le,pe)))}function I(W,le,pe,$e,Le){const Be=C(W,le);if(Be)return Be;const K=le===qo,Y=Ea?history.state:{};pe&&($e||K?l.replace(W.fullPath,St({scroll:K&&Y&&Y.scroll},Le)):l.push(W.fullPath,Le)),i.value=W,he(W,le,pe,K),U()}let R;function j(){R||(R=l.listen((W,le,pe)=>{if(!ge.listening)return;const $e=g(W),Le=k($e);if(Le){M(St(Le,{replace:!0}),$e).catch(Rr);return}u=$e;const Be=i.value;Ea&&BW(p0(Be.fullPath,pe.delta),Di()),P($e,Be).catch(K=>Mo(K,4|8)?K:Mo(K,2)?(M(K.to,$e).then(Y=>{Mo(Y,4|16)&&!pe.delta&&pe.type===Lr.pop&&l.go(-1,!1)}).catch(Rr),Promise.reject()):(pe.delta&&l.go(-pe.delta,!1),B(K,$e,Be))).then(K=>{K=K||I($e,Be,!1),K&&(pe.delta&&!Mo(K,8)?l.go(-pe.delta,!1):pe.type===Lr.pop&&Mo(K,4|16)&&l.go(-1,!1)),F($e,Be,K)}).catch(Rr)}))}let _=Fr(),H=Fr(),O;function B(W,le,pe){U(W);const $e=H.list();return $e.length?$e.forEach(Le=>Le(W,le,pe)):console.error(W),Promise.reject(W)}function G(){return O&&i.value!==qo?Promise.resolve():new Promise((W,le)=>{_.add([W,le])})}function U(W){return O||(O=!W,j(),_.list().forEach(([le,pe])=>W?pe(W):le()),_.reset()),W}function he(W,le,pe,$e){const{scrollBehavior:Le}=e;if(!Ea||!Le)return Promise.resolve();const Be=!pe&&FW(p0(W.fullPath,0))||($e||!pe)&&history.state&&history.state.scroll||null;return _e().then(()=>Le(W,le,Be)).then(K=>K&&LW(K)).catch(K=>B(K,W,le))}const de=W=>l.go(W);let we;const se=new Set,ge={currentRoute:i,listening:!0,addRoute:p,removeRoute:h,hasRoute:v,getRoutes:m,resolve:g,options:e,push:$,replace:b,go:de,back:()=>de(-1),forward:()=>de(1),beforeEach:a.add,beforeResolve:r.add,afterEach:s.add,onError:H.add,isReady:G,install(W){const le=this;W.component("RouterLink",wU),W.component("RouterView",kU),W.config.globalProperties.$router=le,Object.defineProperty(W.config.globalProperties,"$route",{enumerable:!0,get:()=>E(i)}),Ea&&!we&&i.value===qo&&(we=!0,$(l.location).catch(Le=>{}));const pe={};for(const Le in qo)Object.defineProperty(pe,Le,{get:()=>i.value[Le],enumerable:!0});W.provide(Yd,le),W.provide(I0,Tf(pe)),W.provide(qd,i);const $e=W.unmount;se.add(W),W.unmount=function(){se.delete(W),se.size<1&&(u=qo,R&&R(),R=null,i.value=qo,we=!1,O=!1),$e()}}};function ie(W){return W.reduce((le,pe)=>le.then(()=>V(pe)),Promise.resolve())}return ge}function EU(e,t){const n=[],o=[],l=[],a=Math.max(t.matched.length,e.matched.length);for(let r=0;rTa(u,s))?o.push(s):n.push(s));const i=e.matched[r];i&&(t.matched.find(u=>Ta(u,i))||l.push(i))}return[n,o,l]}export{Z as A,ar as B,nt as C,OU as D,ve as E,Re as F,NU as G,ce as H,De as I,Ae as J,MU as K,zl as L,T as M,L as a,X as b,A as c,Q as d,ct as e,st as f,ee as g,IU as h,PU as i,mC as j,AU as k,N as l,Ze as m,gn as n,w as o,Ue as p,Ke as q,ne as r,S as s,me as t,E as u,dt as v,q as w,Bt as x,$t as y,at as z}; diff --git a/docs/index.html b/docs/index.html index 3a195ec..429bca2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -11,8 +11,8 @@ Vue3瀑布流 - - + +