1
0
mirror of https://github.com/ZeroCatDev/Classworks.git synced 2025-12-08 13:49:37 +00:00
Classworks/assets/filter-vRzwYE3O.js

2 lines
17 KiB
JavaScript

import{u as He,V as Se,m as ze}from"./VTextField-CRGlWeo2.js";import{g as pe,p as Q,bT as Ae,a2 as Y,c as be,i as T,F as Z,E as j,h as Me,aH as $e,X as N,be as ge,W as J,a1 as B,b8 as Ne,by as Re,bz as de,c6 as _e,a3 as De,a4 as Le,bW as Ue,u as je,aw as ue,bx as We,ah as Xe,bP as Ye,d as A,ar as oe,n as Qe,e as se,f as Ge,U as Oe,b0 as Je,c4 as Pe,Y as Ze,$ as Ie,a0 as ye,ae as ve,v as xe,a6 as qe,a7 as Ce,c8 as et,K as tt,a8 as lt,L as nt,a9 as at,aa as rt,t as ot,ab as ut,a_ as st,ac as it,c9 as ct,ad as Te,af as Fe,ca as ft,aq as dt,aB as te}from"./index-BGO49u23.js";import{V as vt}from"./VMenu-k_T4gQxa.js";import{V as mt}from"./VCheckboxBtn-UrbdoVf_.js";import{V as ht}from"./VChip-CoymHe2a.js";const gt=Q({renderless:Boolean,...Me()},"VVirtualScrollItem"),yt=pe()({name:"VVirtualScrollItem",inheritAttrs:!1,props:gt(),emits:{"update:height":e=>!0},setup(e,n){let{attrs:t,emit:o,slots:a}=n;const{resizeRef:d,contentRect:f}=Ae(void 0,"border");Y(()=>{var r;return(r=f.value)==null?void 0:r.height},r=>{r!=null&&o("update:height",r)}),be(()=>{var r,s;return e.renderless?T(Z,null,[(r=a.default)==null?void 0:r.call(a,{itemRef:d})]):T("div",j({ref:d,class:["v-virtual-scroll__item",e.class],style:e.style},t),[(s=a.default)==null?void 0:s.call(a)])})}}),pt=-1,bt=1,me=100,Vt=Q({itemHeight:{type:[Number,String],default:null},itemKey:{type:[String,Array,Function],default:null},height:[Number,String]},"virtual");function wt(e,n){const t=$e(),o=N(0);ge(()=>{o.value=parseFloat(e.itemHeight||0)});const a=N(0),d=N(Math.ceil((parseInt(e.height)||t.height.value)/(o.value||16))||1),f=N(0),r=N(0),s=J(),y=J();let u=0;const{resizeRef:M,contentRect:I}=Ae();ge(()=>{M.value=s.value});const p=B(()=>{var i;return s.value===document.documentElement?t.height.value:((i=I.value)==null?void 0:i.height)||parseInt(e.height)||0}),b=B(()=>!!(s.value&&y.value&&p.value&&o.value));let h=Array.from({length:n.value.length}),g=Array.from({length:n.value.length});const w=N(0);let P=-1;function R(i){return h[i]||o.value}const O=Ne(()=>{const i=performance.now();g[0]=0;const m=n.value.length;for(let C=1;C<=m;C++)g[C]=(g[C-1]||0)+R(C-1);w.value=Math.max(w.value,performance.now()-i)},w),k=Y(b,i=>{i&&(k(),u=y.value.offsetTop,O.immediate(),H(),~P&&De(()=>{Le&&window.requestAnimationFrame(()=>{re(P),P=-1})}))});Re(()=>{O.clear()});function ie(i,m){const C=h[i],l=o.value;o.value=l?Math.min(o.value,m):m,(C!==m||l!==o.value)&&(h[i]=m,O())}function E(i){i=de(i,0,n.value.length);const m=Math.floor(i),C=i%1,l=m+1,c=g[m]||0,V=g[l]||c;return c+(V-c)*C}function le(i){return kt(g,i)}let W=0,X=0,K=0;Y(p,(i,m)=>{m&&(H(),i<m&&requestAnimationFrame(()=>{X=0,H()}))});let q=-1;function ce(){if(!s.value||!y.value)return;const i=s.value.scrollTop,m=performance.now();m-K>500?(X=Math.sign(i-W),u=y.value.offsetTop):X=i-W,W=i,K=m,window.clearTimeout(q),q=window.setTimeout(ne,500),H()}function ne(){!s.value||!y.value||(X=0,K=0,window.clearTimeout(q),H())}let ae=-1;function H(){cancelAnimationFrame(ae),ae=requestAnimationFrame(G)}function G(){if(!s.value||!p.value||!o.value)return;const i=W-u,m=Math.sign(X),C=Math.max(0,i-me),l=de(le(C),0,n.value.length),c=i+p.value+me,V=de(le(c)+1,l+1,n.value.length);if((m!==pt||l<a.value)&&(m!==bt||V>d.value)){const U=E(a.value)-E(l),z=E(V)-E(d.value);Math.max(U,z)>me?(a.value=l,d.value=V):(l<=0&&(a.value=l),V>=n.value.length&&(d.value=V))}f.value=E(a.value),r.value=E(n.value.length)-E(d.value)}function re(i){const m=E(i);!s.value||i&&!m?P=i:s.value.scrollTop=m}const fe=B(()=>n.value.slice(a.value,d.value).map((i,m)=>{const C=m+a.value;return{raw:i,index:C,key:_e(i,e.itemKey,C)}}));return Y(n,()=>{h=Array.from({length:n.value.length}),g=Array.from({length:n.value.length}),O.immediate(),H()},{deep:1}),{calculateVisibleItems:H,containerRef:s,markerRef:y,computedItems:fe,paddingTop:f,paddingBottom:r,scrollToIndex:re,handleScroll:ce,handleScrollend:ne,handleItemResize:ie}}function kt(e,n){let t=e.length-1,o=0,a=0,d=null,f=-1;if(e[t]<n)return t;for(;o<=t;)if(a=o+t>>1,d=e[a],d>n)t=a-1;else if(d<n)f=a,o=a+1;else return d===n?a:o;return f}const St=Q({items:{type:Array,default:()=>[]},renderless:Boolean,...Vt(),...Me(),...Ge()},"VVirtualScroll"),Pt=pe()({name:"VVirtualScroll",props:St(),setup(e,n){let{slots:t}=n;const o=Ue("VVirtualScroll"),{dimensionStyles:a}=je(e),{calculateVisibleItems:d,containerRef:f,markerRef:r,handleScroll:s,handleScrollend:y,handleItemResize:u,scrollToIndex:M,paddingTop:I,paddingBottom:p,computedItems:b}=wt(e,ue(()=>e.items));return We(()=>e.renderless,()=>{function h(){var P,R;const w=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1)?"addEventListener":"removeEventListener";f.value===document.documentElement?(document[w]("scroll",s,{passive:!0}),document[w]("scrollend",y)):((P=f.value)==null||P[w]("scroll",s,{passive:!0}),(R=f.value)==null||R[w]("scrollend",y))}Xe(()=>{f.value=Ye(o.vnode.el,!0),h(!0)}),Re(h)}),be(()=>{const h=b.value.map(g=>A(yt,{key:g.key,renderless:e.renderless,"onUpdate:height":w=>u(g.index,w)},{default:w=>{var P;return(P=t.default)==null?void 0:P.call(t,{item:g.raw,index:g.index,...w})}}));return e.renderless?T(Z,null,[T("div",{ref:r,class:"v-virtual-scroll__spacer",style:{paddingTop:oe(I.value)}},null),h,T("div",{class:"v-virtual-scroll__spacer",style:{paddingBottom:oe(p.value)}},null)]):T("div",{ref:f,class:se(["v-virtual-scroll",e.class]),onScrollPassive:s,onScrollend:y,style:Qe([a.value,e.style])},[T("div",{ref:r,class:"v-virtual-scroll__container",style:{paddingTop:oe(I.value),paddingBottom:oe(p.value)}},[h])])}),{calculateVisibleItems:d,scrollToIndex:M}}});function It(e,n){const t=N(!1);let o;function a(r){cancelAnimationFrame(o),t.value=!0,o=requestAnimationFrame(()=>{o=requestAnimationFrame(()=>{t.value=!1})})}async function d(){await new Promise(r=>requestAnimationFrame(r)),await new Promise(r=>requestAnimationFrame(r)),await new Promise(r=>requestAnimationFrame(r)),await new Promise(r=>{if(t.value){const s=Y(t,()=>{s(),r()})}else r()})}async function f(r){var u,M;if(r.key==="Tab"&&((u=n.value)==null||u.focus()),!["PageDown","PageUp","Home","End"].includes(r.key))return;const s=(M=e.value)==null?void 0:M.$el;if(!s)return;(r.key==="Home"||r.key==="End")&&s.scrollTo({top:r.key==="Home"?0:s.scrollHeight,behavior:"smooth"}),await d();const y=s.querySelectorAll(":scope > :not(.v-virtual-scroll__spacer)");if(r.key==="PageDown"||r.key==="Home"){const I=s.getBoundingClientRect().top;for(const p of y)if(p.getBoundingClientRect().top>=I){p.focus();break}}else{const I=s.getBoundingClientRect().bottom;for(const p of[...y].reverse())if(p.getBoundingClientRect().bottom<=I){p.focus();break}}}return{onScrollPassive:a,onKeydown:f}}const xt=Q({closeText:{type:String,default:"$vuetify.close"},openText:{type:String,default:"$vuetify.open"}},"autocomplete");function Ct(e,n){const{t}=Oe(),o=Je(),a=B(()=>`menu-${o}`),d=ue(()=>Pe(n)),f=ue(()=>a.value),r=ue(()=>t(Pe(n)?e.closeText:e.openText));return{menuId:a,ariaExpanded:d,ariaControls:f,ariaLabel:r}}const Tt=Q({chips:Boolean,closableChips:Boolean,eager:Boolean,hideNoData:Boolean,hideSelected:Boolean,listProps:{type:Object},menu:Boolean,menuIcon:{type:dt,default:"$dropdown"},menuProps:{type:Object},multiple:Boolean,noDataText:{type:String,default:"$vuetify.noDataText"},openOnClear:Boolean,itemColor:String,noAutoScroll:Boolean,...xt(),...ft({itemChildren:!1})},"Select"),Ft=Q({...Tt(),...it(ze({modelValue:null,role:"combobox"}),["validationValue","dirty","appendInnerIcon"]),...st({transition:{component:ct}})},"VSelect"),Bt=pe()({name:"VSelect",props:Ft(),emits:{"update:focused":e=>!0,"update:modelValue":e=>!0,"update:menu":e=>!0},setup(e,n){let{slots:t}=n;const{t:o}=Oe(),a=J(),d=J(),f=J(),{items:r,transformIn:s,transformOut:y}=Ze(e),u=Ie(e,"modelValue",[],l=>s(l===null?[null]:ye(l)),l=>{const c=y(l);return e.multiple?c:c[0]??null}),M=B(()=>typeof e.counterValue=="function"?e.counterValue(u.value):typeof e.counterValue=="number"?e.counterValue:u.value.length),I=He(e),p=B(()=>u.value.map(l=>l.value)),b=N(!1);let h="",g=-1,w;const P=B(()=>e.hideSelected?r.value.filter(l=>!u.value.some(c=>(e.valueComparator||ve)(c,l))):r.value),R=B(()=>e.hideNoData&&!P.value.length||I.isReadonly.value||I.isDisabled.value),O=Ie(e,"menu"),k=B({get:()=>O.value,set:l=>{var c;O.value&&!l&&((c=d.value)!=null&&c.ΨopenChildren.size)||l&&R.value||(O.value=l)}}),{menuId:ie,ariaExpanded:E,ariaControls:le,ariaLabel:W}=Ct(e,k),X=B(()=>{var l;return{...e.menuProps,activatorProps:{...((l=e.menuProps)==null?void 0:l.activatorProps)||{},"aria-haspopup":"listbox"}}}),K=J(),q=It(K,a);function ce(l){e.openOnClear&&(k.value=!0)}function ne(){R.value||(k.value=!k.value)}function ae(l){Te(l)&&H(l)}function H(l){var S,L,F;if(!l.key||I.isReadonly.value)return;["Enter"," ","ArrowDown","ArrowUp","Home","End"].includes(l.key)&&l.preventDefault(),["Enter","ArrowDown"," "].includes(l.key)&&(k.value=!0),["Escape","Tab"].includes(l.key)&&(k.value=!1),l.key==="Home"?(S=K.value)==null||S.focus("first"):l.key==="End"&&((L=K.value)==null||L.focus("last"));const c=1e3;if(!Te(l))return;const V=performance.now();V-w>c&&(h="",g=-1),h+=l.key.toLowerCase(),w=V;const U=P.value;function z(){let x=v();return x||h.at(-1)===h.at(-2)&&(h=h.slice(0,-1),x=v(),x)||(g=-1,x=v(),x)?x:(h=l.key.toLowerCase(),v())}function v(){for(let x=g+1;x<U.length;x++){const ee=U[x];if(ee.title.toLowerCase().startsWith(h))return[ee,x]}}const _=z();if(!_)return;const[D,$]=_;g=$,(F=K.value)==null||F.focus($),e.multiple||(u.value=[D])}function G(l){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(!l.props.disabled)if(e.multiple){const V=u.value.findIndex(z=>(e.valueComparator||ve)(z.value,l.value)),U=c??!~V;if(~V){const z=U?[...u.value,l]:[...u.value];z.splice(V,1),u.value=z}else U&&(u.value=[...u.value,l])}else{const V=c!==!1;u.value=V?[l]:[],De(()=>{k.value=!1})}}function re(l){var c;(c=K.value)!=null&&c.$el.contains(l.relatedTarget)||(k.value=!1)}function fe(){var l;e.eager&&((l=f.value)==null||l.calculateVisibleItems())}function i(){var l;b.value&&((l=a.value)==null||l.focus())}function m(l){b.value=!0}function C(l){if(l==null)u.value=[];else if(Fe(a.value,":autofill")||Fe(a.value,":-webkit-autofill")){const c=r.value.find(V=>V.title===l);c&&G(c)}else a.value&&(a.value.value="")}return Y(k,()=>{if(!e.hideSelected&&k.value&&u.value.length){const l=P.value.findIndex(c=>u.value.some(V=>(e.valueComparator||ve)(V.value,c.value)));Le&&!e.noAutoScroll&&window.requestAnimationFrame(()=>{var c;l>=0&&((c=f.value)==null||c.scrollToIndex(l))})}}),Y(r,(l,c)=>{k.value||b.value&&e.hideNoData&&!c.length&&l.length&&(k.value=!0)}),be(()=>{const l=!!(e.chips||t.chip),c=!!(!e.hideNoData||P.value.length||t["prepend-item"]||t["append-item"]||t["no-data"]),V=u.value.length>0,U=Se.filterProps(e),z=V||!b.value&&e.label&&!e.persistentPlaceholder?void 0:e.placeholder;return A(Se,j({ref:a},U,{modelValue:u.value.map(v=>v.props.value).join(", "),"onUpdate:modelValue":C,focused:b.value,"onUpdate:focused":v=>b.value=v,validationValue:u.externalValue,counterValue:M.value,dirty:V,class:["v-select",{"v-select--active-menu":k.value,"v-select--chips":!!e.chips,[`v-select--${e.multiple?"multiple":"single"}`]:!0,"v-select--selected":u.value.length,"v-select--selection-slot":!!t.selection},e.class],style:e.style,inputmode:"none",placeholder:z,"onClick:clear":ce,"onMousedown:control":ne,onBlur:re,onKeydown:H,"aria-expanded":E.value,"aria-controls":le.value,"aria-label":W.value,title:W.value}),{...t,default:()=>T(Z,null,[A(vt,j({id:ie.value,ref:d,modelValue:k.value,"onUpdate:modelValue":v=>k.value=v,activator:"parent",contentClass:"v-select__content",disabled:R.value,eager:e.eager,maxHeight:310,openOnClick:!1,closeOnContentClick:!1,transition:e.transition,onAfterEnter:fe,onAfterLeave:i},X.value),{default:()=>[c&&A(qe,j({ref:K,selected:p.value,selectStrategy:e.multiple?"independent":"single-independent",onMousedown:v=>v.preventDefault(),onKeydown:ae,onFocusin:m,tabindex:"-1",selectable:!0,"aria-live":"polite","aria-label":`${e.label}-list`,color:e.itemColor??e.color},q,e.listProps),{default:()=>{var v,_,D;return[(v=t["prepend-item"])==null?void 0:v.call(t),!P.value.length&&!e.hideNoData&&(((_=t["no-data"])==null?void 0:_.call(t))??A(Ce,{key:"no-data",title:o(e.noDataText)},null)),A(Pt,{ref:f,renderless:!0,items:P.value,itemKey:"value"},{default:$=>{var Ve,we,ke;let{item:S,index:L,itemRef:F}=$;const x=et(S.props),ee=j(S.props,{ref:F,key:S.value,onClick:()=>G(S,null)});return S.type==="divider"?((Ve=t.divider)==null?void 0:Ve.call(t,{props:S.raw,index:L}))??A(tt,j(S.props,{key:`divider-${L}`}),null):S.type==="subheader"?((we=t.subheader)==null?void 0:we.call(t,{props:S.raw,index:L}))??A(lt,j(S.props,{key:`subheader-${L}`}),null):((ke=t.item)==null?void 0:ke.call(t,{item:S,index:L,props:ee}))??A(Ce,j(ee,{role:"option"}),{prepend:Be=>{let{isSelected:Ee}=Be;return T(Z,null,[e.multiple&&!e.hideSelected?A(mt,{key:S.value,modelValue:Ee,ripple:!1,tabindex:"-1",onClick:Ke=>Ke.preventDefault()},null):void 0,x.prependAvatar&&A(nt,{image:x.prependAvatar},null),x.prependIcon&&A(xe,{icon:x.prependIcon},null)])}})}}),(D=t["append-item"])==null?void 0:D.call(t)]}})]}),u.value.map((v,_)=>{function D(F){F.stopPropagation(),F.preventDefault(),G(v,!1)}const $={"onClick:close":D,onKeydown(F){F.key!=="Enter"&&F.key!==" "||(F.preventDefault(),F.stopPropagation(),D(F))},onMousedown(F){F.preventDefault(),F.stopPropagation()},modelValue:!0,"onUpdate:modelValue":void 0},S=l?!!t.chip:!!t.selection,L=S?at(l?t.chip({item:v,index:_,props:$}):t.selection({item:v,index:_})):void 0;if(!(S&&!L))return T("div",{key:v.value,class:"v-select__selection"},[l?t.chip?A(rt,{key:"chip-defaults",defaults:{VChip:{closable:e.closableChips,size:"small",text:v.title}}},{default:()=>[L]}):A(ht,j({key:"chip",closable:e.closableChips,size:"small",text:v.title,disabled:v.props.disabled},$),null):L??T("span",{class:"v-select__selection-text"},[v.title,e.multiple&&_<u.value.length-1&&T("span",{class:"v-select__selection-comma"},[ot(",")])])])})]),"append-inner":function(){var $,S;for(var v=arguments.length,_=new Array(v),D=0;D<v;D++)_[D]=arguments[D];return T(Z,null,[($=t["append-inner"])==null?void 0:$.call(t,..._),e.menuIcon?A(xe,{class:"v-select__menu-icon",color:(S=a.value)==null?void 0:S.fieldIconColor,icon:e.menuIcon},null):void 0])}})}),ut({isFocused:b,menu:k,select:G},a)}}),At=(e,n,t)=>{if(e==null||n==null)return-1;if(!n.length)return 0;e=e.toString().toLocaleLowerCase(),n=n.toString().toLocaleLowerCase();const o=[];let a=e.indexOf(n);for(;~a;)o.push([a,a+n.length]),a=e.indexOf(n,a+n.length);return o.length?o:-1};function he(e,n){if(!(e==null||typeof e=="boolean"||e===-1))return typeof e=="number"?[[e,e+n.length]]:Array.isArray(e[0])?e:[e]}const Et=Q({customFilter:Function,customKeyFilter:Object,filterKeys:[Array,String],filterMode:{type:String,default:"intersection"},noFilter:Boolean},"filter");function Mt(e,n,t){var s;const o=[],a=(t==null?void 0:t.default)??At,d=t!=null&&t.filterKeys?ye(t.filterKeys):!1,f=Object.keys((t==null?void 0:t.customKeyFilter)??{}).length;if(!(e!=null&&e.length))return o;let r=null;e:for(let y=0;y<e.length;y++){const[u,M=u]=ye(e[y]),I={},p={};let b=-1;if((n||f>0)&&!(t!=null&&t.noFilter)){let h=!1;if(typeof u=="object"){if(u.type==="divider"||u.type==="subheader"){(r==null?void 0:r.type)==="divider"&&u.type==="subheader"&&o.push(r),r={index:y,matches:{},type:u.type};continue}const P=d||Object.keys(M);h=P.length===f;for(const R of P){const O=_e(M,R),k=(s=t==null?void 0:t.customKeyFilter)==null?void 0:s[R];if(b=k?k(O,n,u):a(O,n,u),b!==-1&&b!==!1)k?I[R]=he(b,n):p[R]=he(b,n);else if((t==null?void 0:t.filterMode)==="every")continue e}}else b=a(u,n,u),b!==-1&&b!==!1&&(p.title=he(b,n));const g=Object.keys(p).length,w=Object.keys(I).length;if(!g&&!w||(t==null?void 0:t.filterMode)==="union"&&w!==f&&!g||(t==null?void 0:t.filterMode)==="intersection"&&(w!==f||!g&&f>0&&!h))continue}r&&(o.push(r),r=null),o.push({index:y,matches:{...p,...I}})}return o}function Kt(e,n,t,o){const a=N([]),d=N(new Map),f=B(()=>o!=null&&o.transform?te(n).map(s=>[s,o.transform(s)]):te(n));ge(()=>{const s=typeof t=="function"?t():te(t),y=typeof s!="string"&&typeof s!="number"?"":String(s),u=Mt(f.value,y,{customKeyFilter:{...e.customKeyFilter,...te(o==null?void 0:o.customKeyFilter)},default:e.customFilter,filterKeys:e.filterKeys,filterMode:e.filterMode,noFilter:e.noFilter}),M=te(n),I=[],p=new Map;u.forEach(b=>{let{index:h,matches:g}=b;const w=M[h];I.push(w),p.set(w.value,g)}),a.value=I,d.value=p});function r(s){return d.value.get(s.value)}return{filteredItems:a,filteredMatches:d,getMatches:r}}function Ht(e,n,t){return t==null||!t.length?n:t.map((o,a)=>{const d=a===0?0:t[a-1][1],f=[T("span",{class:se(`${e}__unmask`)},[n.slice(d,o[0])]),T("span",{class:se(`${e}__mask`)},[n.slice(o[0],o[1])])];return a===t.length-1&&f.push(T("span",{class:se(`${e}__unmask`)},[n.slice(o[1])])),T(Z,null,[f])})}export{Pt as V,Ct as a,It as b,Et as c,Bt as d,Ht as h,Tt as m,Kt as u};