vue-pure-admin/dist/static/js/index-6PG6DbLL.js
2024-01-24 15:59:56 +08:00

2 lines
11 KiB
JavaScript

var Ee=Object.defineProperty,Ce=Object.defineProperties;var _e=Object.getOwnPropertyDescriptors;var te=Object.getOwnPropertySymbols;var Ie=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable;var re=(e,t,n)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q=(e,t)=>{for(var n in t||(t={}))Ie.call(t,n)&&re(e,n,t[n]);if(te)for(var n of te(t))Pe.call(t,n)&&re(e,n,t[n]);return e},ne=(e,t)=>Ce(e,_e(t));var g=(e,t,n)=>new Promise((a,s)=>{var o=f=>{try{d(n.next(f))}catch(y){s(y)}},c=f=>{try{d(n.throw(f))}catch(y){s(y)}},d=f=>f.done?a(f.value):Promise.resolve(f.value).then(o,c);d((n=n.apply(e,t)).next())});import{d as Ne,D as Ae}from"./index-GuFRd4Ob.js";const ue=e=>Array.isArray(e),de=e=>ue(e)?e:[e];let De=function(e){let t=function(m){return de(m).forEach(T=>{var L;return h.set(Symbol((L=T.char)==null?void 0:L.innerText),s(Q({},T)))}),this},n=()=>f().filter(m=>m.typeable),a=function(m,T){let L=[...h.keys()];h.set(L[m],s(T))},s=m=>(m.shouldPauseCursor=function(){return!!(this.typeable||this.cursorable||this.deletable)},m),o=function(){h.forEach(m=>delete m.done)},c=function(){h=new Map,t(e)},d=()=>h,f=()=>Array.from(h.values()),y=m=>h.delete(m),_=(m=!1)=>m?f():f().filter(T=>!T.done),I=(m,T=!1)=>T?h.delete(m):h.get(m).done=!0,h=new Map;return t(e),{add:t,set:a,wipe:c,reset:o,destroy:y,done:I,getItems:_,getQueue:d,getTypeable:n}};const fe=e=>Array.from(e),X=e=>document.createTextNode(e);let G=e=>([...e.childNodes].forEach(t=>{if(t.nodeValue){[...t.nodeValue].forEach(n=>{t.parentNode.insertBefore(X(n),t)}),t.remove();return}G(t)}),e);const ce=e=>{let t=document.implementation.createHTMLDocument();return t.body.innerHTML=e,G(t.body)},ye="data-typeit-id",D="ti-cursor",Le="END",ve={started:!1,completed:!1,frozen:!1,destroyed:!1},k={breakLines:!0,cursor:{autoPause:!0,autoPauseDelay:500,animation:{frames:[0,0,1].map(e=>({opacity:e})),options:{iterations:1/0,easing:"steps(2, start)",fill:"forwards"}}},cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,html:!0,lifeLike:!0,loop:!1,loopDelay:750,nextStringDelay:750,speed:100,startDelay:250,startDelete:!1,strings:[],waitUntilVisible:!1,beforeString:()=>{},afterString:()=>{},beforeStep:()=>{},afterStep:()=>{},afterComplete:()=>{}},xe=`[${ye}]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}`;function me(e,t=!1,n=!1){let a=e.querySelector(`.${D}`),s=document.createTreeWalker(e,NodeFilter.SHOW_ALL,{acceptNode:d=>{var f,y;if(a&&n){if((f=d.classList)!=null&&f.contains(D))return NodeFilter.FILTER_ACCEPT;if(a.contains(d))return NodeFilter.FILTER_REJECT}return(y=d.classList)!=null&&y.contains(D)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),o,c=[];for(;o=s.nextNode();)o.originalParent||(o.originalParent=o.parentNode),c.push(o);return t?c.reverse():c}function ke(e){return me(ce(e))}function Me(e,t=!0){return t?ke(e):fe(e).map(X)}const q=e=>document.createElement(e),pe=(e,t="")=>{let n=q("style");n.id=t,n.appendChild(X(e)),document.head.appendChild(n)},le=e=>(ue(e)||(e=[e/2,e/2]),e),ae=(e,t)=>Math.abs(Math.random()*(e+t-(e-t))+(e-t));let se=e=>e/2;function Re(e){let{speed:t,deleteSpeed:n,lifeLike:a}=e;return n=n!==null?n:t/3,a?[ae(t,se(t)),ae(n,se(n))]:[t,n]}const $e=e=>(e.forEach(clearTimeout),[]),Fe=()=>Math.random().toString().substring(2,9),K=e=>"value"in e;let He=e=>K(e)?fe(e.value):me(e,!0).filter(t=>!(t.childNodes.length>0));const Qe=(e,t)=>{new IntersectionObserver((a,s)=>{a.forEach(o=>{o.isIntersecting&&(t(),s.unobserve(e))})},{threshold:1}).observe(e)};let x=e=>typeof e=="function"?e():e;const he=e=>Number.isInteger(e);let O=(e,t=document,n=!1)=>t[`querySelector${n?"All":""}`](e),Be=e=>/body/i.test(e==null?void 0:e.tagName),qe=(e,t)=>{if(K(e)){e.value=`${e.value}${t.textContent}`;return}t.innerHTML="";let n=Be(t.originalParent)?e:t.originalParent||e;n.insertBefore(t,O("."+D,n)||null)},Ue=(e,t,n)=>Math.min(Math.max(t+e,0),n.length);const M=(e,t)=>Object.assign({},e,t),ze=(e,t)=>{if(!e)return;let n=e.parentNode;(n.childNodes.length>1||n.isSameNode(t)?e:n).remove()},Ve=(e,t,n)=>{let a=t[n-1],s=O(`.${D}`,e);e=(a==null?void 0:a.parentNode)||e,e.insertBefore(s,a||null)};function We(e){return typeof e=="string"?O(e):e}const je=e=>/<(.+)>(.*?)<\/(.+)>/.test(e.outerHTML);let Je=(e,t,n)=>new Promise(a=>{let s=()=>g(void 0,null,function*(){yield e(),a()});n.push(setTimeout(s,t||0))}),Xe={"font-family":"","font-weight":"","font-size":"","font-style":"","line-height":"",color:"",transform:"translateX(-.125em)"},Ge=(e,t)=>{let a=`${`[${ye}='${e}']`} .${D}`,s=getComputedStyle(t),o=Object.entries(Xe).reduce((c,[d,f])=>`${c} ${d}: var(--ti-cursor-${d}, ${f||s[d]});`,"");pe(`${a} { display: inline-block; width: 0; ${o} }`,e)};const B=(e,t)=>new Array(t).fill(e),ie=({queueItems:e,selector:t,cursorPosition:n,to:a})=>{if(he(t))return t*-1;let s=new RegExp(Le,"i").test(a),o=t?[...e].reverse().findIndex(({char:d})=>{let f=d.parentElement,y=f.matches(t);return s&&y?!0:y&&f.firstChild.isSameNode(d)}):-1;o<0&&(o=s?0:e.length-1);let c=s?0:1;return o-n+c};let U=e=>new Promise(t=>{requestAnimationFrame(()=>g(void 0,null,function*(){t(yield e())}))}),be=e=>e==null?void 0:e.getAnimations().find(t=>t.id===e.dataset.tiAnimationId),ge=({cursor:e,frames:t,options:n})=>{let a=e.animate(t,n);return a.pause(),a.id=e.dataset.tiAnimationId,U(()=>{U(()=>{a.play()})}),a},Ke=({cursor:e,options:t,cursorOptions:n})=>{if(!e||!n)return;let a=be(e),s;a&&(t.delay=a.effect.getComputedTiming().delay,s=a.currentTime,a.cancel());let o=ge({cursor:e,frames:n.animation.frames,options:t});return s&&(o.currentTime=s),o},oe=e=>{var t;return(t=e.func)==null?void 0:t.call(null)},Oe=o=>g(void 0,[o],function*({index:e,queueItems:t,wait:n,cursor:a,cursorOptions:s}){let c=t[e][1],d=[],f=e,y=c,_=()=>y&&!y.delay,I=c.shouldPauseCursor()&&s.autoPause;for(;_();)d.push(y),_()&&f++,y=t[f]?t[f][1]:null;if(d.length)return yield U(()=>g(void 0,null,function*(){for(let T of d)yield oe(T)})),f-1;let h=be(a),m;return h&&(m=ne(Q({},h.effect.getComputedTiming()),{delay:I?s.autoPauseDelay:0})),yield n(()=>g(void 0,null,function*(){h&&I&&h.cancel(),yield U(()=>{oe(c)})}),c.delay),yield Ke({cursor:a,options:m,cursorOptions:s}),e}),Ye=e=>{var t,n,a;if(typeof e=="object"){let s={},{frames:o,options:c}=k.cursor.animation;return s.animation=e.animation||{},s.animation.frames=((t=e.animation)==null?void 0:t.frames)||o,s.animation.options=M(c,((n=e.animation)==null?void 0:n.options)||{}),s.autoPause=(a=e.autoPause)!=null?a:k.cursor.autoPause,s.autoPauseDelay=e.autoPauseDelay||k.cursor.autoPauseDelay,s}return e===!0?k.cursor:e};const Ze=function(e,t={}){var ee;let n=(r,l,u=!1)=>g(this,null,function*(){E.frozen&&(yield new Promise(p=>{this.unfreeze=()=>{E.frozen=!1,p()}})),u||(yield i.beforeStep(this)),yield Je(r,l,V),u||(yield i.afterStep(this))}),a=(r,l)=>Oe({index:r,queueItems:l,wait:n,cursor:A,cursorOptions:i.cursor}),s=r=>ze(r,b),o=()=>K(b),c=(r=0)=>Re(i)[r],d=()=>He(b),f=(r={})=>{let l=r.delay;l&&S.add({delay:l})},y=(r,l)=>(S.add(r),f(l),this),_=()=>H!=null?H:v,I=(r={})=>[{func:()=>$(r)},{func:()=>$(i)}],h=r=>{let l=i.nextStringDelay;S.add([{delay:l[0]},...r,{delay:l[1]}])},m=()=>{if(o())return;let r=q("span");return r.className=D,Z?(r.innerHTML=ce(i.cursorChar).innerHTML,r):(r.style.visibility="hidden",r)},T=()=>g(this,null,function*(){if(!o()&&A&&b.appendChild(A),Z){Ge(W,b),A.dataset.tiAnimationId=W;let{animation:r}=i.cursor,{frames:l,options:u}=r;ge({frames:l,cursor:A,options:Q({duration:i.cursorSpeed},u)})}}),L=()=>{let r=i.strings.filter(l=>!!l);r.forEach((l,u)=>{if(this.type(l),u+1===r.length)return;let p=i.breakLines?[{func:()=>z(q("BR")),typeable:!0}]:B({func:F,delay:c(1)},S.getTypeable().length);h(p)})},Te=r=>g(this,null,function*(){let l=_();l&&(yield Y({value:l}));let u=d().map(p=>[Symbol(),{func:F,delay:c(1),deletable:!0,shouldPauseCursor:()=>!0}]);for(let p=0;p<u.length;p++)yield a(p,u);S.reset(),S.set(0,{delay:r})}),Se=r=>{let l=b.innerHTML;return l?(b.innerHTML="",i.startDelete?(b.innerHTML=l,G(b),h(B({func:F,delay:c(1),deletable:!0},d().length)),r):l.replace(/<!--(.+?)-->/g,"").trim().split(/<br(?:\s*?)(?:\/)?>/).concat(r)):r},R=(r=!0)=>g(this,null,function*(){E.started=!0;let l=u=>{S.done(u,!r)};try{let u=[...S.getQueue()];for(let w=0;w<u.length;w++){let[P,C]=u[w];if(!C.done){if(!C.deletable||C.deletable&&d().length){let N=yield a(w,u);Array(N-w).fill(w+1).map((j,J)=>j+J).forEach(j=>{let[J]=u[j];l(J)}),w=N}l(P)}}if(!r)return this;if(E.completed=!0,yield i.afterComplete(this),!i.loop)throw"";let p=i.loopDelay;n(()=>g(this,null,function*(){yield Te(p[0]),R()}),p[1])}catch(u){}return this}),Y=r=>g(this,null,function*(){v=Ue(r,v,d()),Ve(b,d(),v)}),z=r=>qe(b,r),$=r=>g(this,null,function*(){return i=M(i,r)}),we=()=>g(this,null,function*(){if(o()){b.value="";return}d().forEach(s)}),F=()=>{let r=d();r.length&&(o()?b.value=b.value.slice(0,-1):s(r[v]))};this.break=function(r){return y({func:()=>z(q("BR")),typeable:!0},r)},this.delete=function(r=null,l={}){r=x(r);let u=I(l),p=r,{instant:w,to:P}=l,C=S.getTypeable(),N=p===null?C.length:he(p)?p:ie({queueItems:C,selector:p,cursorPosition:_(),to:P});return y([u[0],...B({func:F,delay:w?0:c(1),deletable:!0},N),u[1]],l)},this.empty=function(r={}){return y({func:we},r)},this.exec=function(r,l={}){let u=I(l);return y([u[0],{func:()=>r(this)},u[1]],l)},this.move=function(r,l={}){r=x(r);let u=I(l),{instant:p,to:w}=l,P=ie({queueItems:S.getTypeable(),selector:r===null?"":r,to:w,cursorPosition:_()}),C=P<0?-1:1;return H=_()+P,y([u[0],...B({func:()=>Y(C),delay:p?0:c(),cursorable:!0},Math.abs(P)),u[1]],l)},this.options=function(r,l={}){return r=x(r),$(r),y({},l)},this.pause=function(r,l={}){return y({delay:x(r)},l)},this.type=function(r,l={}){r=x(r);let{instant:u}=l,p=I(l),P=Me(r,i.html).map(N=>({func:()=>z(N),char:N,delay:u||je(N)?0:c(),typeable:N.nodeType===Node.TEXT_NODE})),C=[p[0],{func:()=>g(this,null,function*(){return yield i.beforeString(r,this)})},...P,{func:()=>g(this,null,function*(){return yield i.afterString(r,this)})},p[1]];return y(C,l)},this.is=function(r){return E[r]},this.destroy=function(r=!0){V=$e(V),x(r)&&A&&s(A),E.destroyed=!0},this.freeze=function(){E.frozen=!0},this.unfreeze=()=>{},this.reset=function(r){!this.is("destroyed")&&this.destroy(),r?(S.wipe(),r(this)):S.reset(),v=0;for(let l in E)E[l]=!1;return b[o()?"value":"innerHTML"]="",this},this.go=function(){return E.started?this:(T(),i.waitUntilVisible?(Qe(b,R.bind(this)),this):(R(),this))},this.flush=function(r=()=>{}){return T(),R(!1).then(r),this},this.getQueue=()=>S,this.getOptions=()=>i,this.updateOptions=r=>$(r),this.getElement=()=>b;let b=We(e),V=[],v=0,H=null,E=M({},ve);t.cursor=Ye((ee=t.cursor)!=null?ee:k.cursor);let i=M(k,t);i=M(i,{html:!o()&&i.html,nextStringDelay:le(i.nextStringDelay),loopDelay:le(i.loopDelay)});let W=Fe(),S=De([{delay:i.startDelay}]);b.dataset.typeitId=W,pe(xe);let Z=!!i.cursor&&!o(),A=m();i.strings=Se(de(i.strings)),i.strings.length&&L()},rt=Ne({name:"TypeIt",props:{speed:{type:Number,default:200},values:{type:Array,defalut:[]},className:{type:String,default:"type-it"},cursor:{type:Boolean,default:!0}},render(){return Ae("span",{class:this.className},{default:()=>[]})},mounted(){new Ze(`.${this.className}`,{strings:this.values,speed:this.speed,cursor:this.cursor}).go()}});export{rt as T};