From 9d4f34e71046b5b4f5e74792fbf9437390ac9795 Mon Sep 17 00:00:00 2001 From: Akshay Mayekar <20793816+akshaymayekar@users.noreply.github.com> Date: Fri, 2 Feb 2024 20:18:00 +0530 Subject: [PATCH 01/36] Attachment view and download UI (#21) * Added text and attachment types to chat * Added image type to chat * Added checks for type and link fields in all types * Added message type information to readme * Fixed styling for download button * Updated build files * Bumped up version to 2.0.1 --- README.md | 50 + dist/tarka-chat.es.js | 3820 +++++++++++++++++++------------------ dist/tarka-chat.umd.js | 24 +- package.json | 2 +- src/images/attachment.png | Bin 0 -> 7573 bytes src/images/download.png | Bin 0 -> 280 bytes src/main.js | 96 +- src/style.scss | 80 +- 8 files changed, 2166 insertions(+), 1906 deletions(-) create mode 100644 src/images/attachment.png create mode 100644 src/images/download.png diff --git a/README.md b/README.md index dbb6ddc..017be11 100644 --- a/README.md +++ b/README.md @@ -43,5 +43,55 @@ where, - **themeColor** will set the color scheme of the chat window - **selectorId** the DOM element selector (id) inside which the bot will be rendered - **submitHandler** this function will be called whenever a user types a message in the bot and submits + Returned response from submitHandler should be one the below types: + + 1. _String_ + 2. One of the below objects: + + - _Text type:_ + + ``` + { + "type": "text", + "message": "MESSAGE" + } + ``` + + - _File type:_ + + ``` + { + "type": "file", + "link": "LINK_TO_FILE", + "name": "FILE_NAME", + } + ``` + + - _Image type:_ + + ``` + { + "type": "image", + "link": "LINK_TO_IMAGE", + "name": "IMAGE_NAME", + } + ``` + + 3. _Array containing one/multiple of above mentioned types:_ + E.g. + + ``` + [ + { + "type": "text", + "message": "MESSAGE" + }, + { + "type": "file", + "link": "LINK_TO_FILE", + "name": "FILE_NAME", + } + ] + ``` Demo : https://tarkalabs.github.io/tarka-chat/demo/ diff --git a/dist/tarka-chat.es.js b/dist/tarka-chat.es.js index bffa7ce..f93e48b 100644 --- a/dist/tarka-chat.es.js +++ b/dist/tarka-chat.es.js @@ -1,4 +1,4 @@ -(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('@import"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap";#tarka-chat{position:fixed;bottom:2rem;right:3rem;display:flex;flex-direction:column;align-items:flex-end;max-height:700px;z-index:1000}#tarka-chat .t-container{font-family:Inter;width:400px;border:1.5px solid var(--primary-primary-alt-subtle);border-radius:32px 32px 8px;box-shadow:-28px 48px 42px #00000008;flex-direction:column;overflow:hidden;display:none;position:relative;background:#ffffff}#tarka-chat .t-container .scroll-fade{position:absolute;width:100%;height:140px;background:var(--gradient-gradient-fade)}#tarka-chat .t-container .header{display:flex;padding:24px;justify-content:space-between;align-items:center}#tarka-chat .t-container .header .title{overflow:hidden;color:var(--primary-primary-alt);text-overflow:ellipsis;opacity:.6;font-size:18px;font-style:normal;font-weight:600;line-height:24px;letter-spacing:-.18px}#tarka-chat .t-container .header .logo{width:32px;height:32px}#tarka-chat .t-container .body{background:var(--gradient-background);padding:0 24px;min-height:200px;overflow-y:auto}#tarka-chat .t-container .body .message-container{min-height:100%;display:flex;flex-direction:column;justify-content:flex-end}#tarka-chat .t-container .body .message-container .message:first-of-type{margin-top:32px}#tarka-chat .t-container .body .message-container .message{max-width:90%}#tarka-chat .t-container .body .message-container .message .wrapper{padding-bottom:24px}#tarka-chat .t-container .body .message-container .message .message-content{font-size:16px;font-weight:500;line-height:24px;letter-spacing:-.18px;overflow-wrap:break-word}#tarka-chat .t-container .body .message-container .message .message-meta{color:var(--primary-primary-alt);font-size:12px;font-weight:400;line-height:14px;letter-spacing:.12px}#tarka-chat .t-container .body .message-container .incoming{color:var(--primary-primary-alt)}#tarka-chat .t-container .body .message-container .outgoing{margin-left:auto;color:var(--primary-primary)}#tarka-chat .t-container .footer{display:flex;justify-content:center}#tarka-chat .t-container .footer .input-container{display:flex;padding:8px 8px 8px 24px;align-items:center;width:100%}#tarka-chat .t-container .footer .input-container .chat-input{color:var(--primary-primary-alt);opacity:.7;font-size:16px;font-weight:500;line-height:20px;flex:1;border:none}#tarka-chat .t-container .footer .input-container .chat-input:focus{outline:none}#tarka-chat .t-container .footer .input-container .send-btn{width:48px;height:48px;border:none;background:transparent;display:flex;align-items:center;justify-content:center}#tarka-chat .t-container .footer .input-container .send-btn path{fill:var(--primary-primary, #9500b3)}#tarka-chat .t-container .footer .chat-loader{display:none;padding:8px}#tarka-chat .t-container .footer .chat-loader:after{content:" ";display:block;width:24px;height:24px;margin:8px;border-radius:50%;border:4px solid #9500b3;border-color:#9500b3 transparent #9500b3 transparent;animation:chat-loader 1.2s linear infinite}@keyframes chat-loader{0%{transform:rotate(0)}to{transform:rotate(360deg)}}#tarka-chat .launcher{flex:none;display:flex;width:48px;height:48px;align-items:center;justify-content:center;border:none;border-radius:20px 10px 20px 20px;background:var(--primary-primary-subtle, #f0dafb);margin-top:8px}#tarka-chat .launcher .opened{display:none}#tarka-chat .tc-logo-face path{fill:var(--primary-primary-subtle, #f0dafb)}@media only screen and (max-width: 700px){#tarka-chat{bottom:10px;right:10px}#tarka-chat .t-container{width:calc(100vw - 20px)}}')),document.head.appendChild(t)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})(); +(function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode('@import"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap";#tarka-chat{position:fixed;bottom:2rem;right:3rem;display:flex;flex-direction:column;align-items:flex-end;max-height:700px;z-index:1000}#tarka-chat .t-container{font-family:Inter;width:400px;border:1.5px solid var(--primary-primary-alt-subtle);border-radius:32px 32px 8px;box-shadow:-28px 48px 42px #00000008;flex-direction:column;overflow:hidden;display:none;position:relative;background:#ffffff}#tarka-chat .t-container .scroll-fade{position:absolute;width:100%;height:140px;background:var(--gradient-gradient-fade)}#tarka-chat .t-container .header{display:flex;padding:24px;justify-content:space-between;align-items:center}#tarka-chat .t-container .header .title{overflow:hidden;color:var(--primary-primary-alt);text-overflow:ellipsis;opacity:.6;font-size:18px;font-style:normal;font-weight:600;line-height:24px;letter-spacing:-.18px}#tarka-chat .t-container .header .logo{width:32px;height:32px}#tarka-chat .t-container .body{background:var(--gradient-background);padding:0 24px;min-height:200px;overflow-y:auto}#tarka-chat .t-container .body .message-container{min-height:100%;display:flex;flex-direction:column;justify-content:flex-end}#tarka-chat .t-container .body .message-container .message:first-of-type{margin-top:32px}#tarka-chat .t-container .body .message-container .message{max-width:90%}#tarka-chat .t-container .body .message-container .message .wrapper{display:flex;flex-direction:column;flex-grow:1;padding:8px;border-radius:8px}#tarka-chat .t-container .body .message-container .message .message-content{font-size:16px;font-weight:500;line-height:24px;letter-spacing:-.18px;overflow-wrap:break-word;margin:4px 0}#tarka-chat .t-container .body .message-container .message .attachment{display:flex;align-items:center;margin:4px 0}#tarka-chat .t-container .body .message-container .message .attachment .attachment-info{display:flex;border:1px solid var(--primary-primary-subtle, #f0dafb);padding:8px;border-radius:8px}#tarka-chat .t-container .body .message-container .message .attachment .attachment-info .attachment-file-name{font-size:14px;font-weight:700;padding:0 15px 0 5px;align-self:center;color:#333}#tarka-chat .t-container .body .message-container .message .attachment .attachment-info .attachment-download-btn{border:1px solid var(--primary-primary-subtle, #f0dafb);border-radius:4px;padding:8px 12px;background:var(--primary-primary-subtle, #f0dafb);cursor:pointer}#tarka-chat .t-container .body .message-container .message .attachment .attachment-info .attachment-download-btn img{width:16px;height:16px}#tarka-chat .t-container .body .message-container .message .image-container{position:relative;width:300px;height:300px;border:1px solid var(--primary-primary-subtle, #f0dafb);border-radius:15px;margin:4px 0}#tarka-chat .t-container .body .message-container .message .image-container img{width:100%;height:auto;display:block}#tarka-chat .t-container .body .message-container .message .overlay{position:absolute;top:0;right:0;display:flex;align-items:center;margin:8px;border:1px solid var(--primary-primary-subtle, #f0dafb);border-radius:4px;padding:10px 12px;background:var(--primary-primary-subtle, #f0dafb);cursor:pointer;opacity:.6}#tarka-chat .t-container .body .message-container .message .overlay img{width:16px;height:16px}#tarka-chat .t-container .body .message-container .message .overlay:hover{opacity:1}#tarka-chat .t-container .body .message-container .message .message-meta{margin:4px 0;color:var(--primary-primary-alt);font-size:12px;font-weight:400;line-height:14px;letter-spacing:.12px}#tarka-chat .t-container .body .message-container .incoming{color:var(--primary-primary-alt)}#tarka-chat .t-container .body .message-container .outgoing{margin-left:auto;color:var(--primary-primary)}#tarka-chat .t-container .footer{display:flex;justify-content:center}#tarka-chat .t-container .footer .input-container{display:flex;padding:8px 8px 8px 24px;align-items:center;width:100%}#tarka-chat .t-container .footer .input-container .chat-input{color:var(--primary-primary-alt);opacity:.7;font-size:16px;font-weight:500;line-height:20px;flex:1;border:none}#tarka-chat .t-container .footer .input-container .chat-input:focus{outline:none}#tarka-chat .t-container .footer .input-container .send-btn{width:48px;height:48px;border:none;background:transparent;display:flex;align-items:center;justify-content:center}#tarka-chat .t-container .footer .input-container .send-btn path{fill:var(--primary-primary, #9500b3)}#tarka-chat .t-container .footer .chat-loader{display:none;padding:8px}#tarka-chat .t-container .footer .chat-loader:after{content:" ";display:block;width:24px;height:24px;margin:8px;border-radius:50%;border:4px solid #9500b3;border-color:#9500b3 transparent #9500b3 transparent;animation:chat-loader 1.2s linear infinite}@keyframes chat-loader{0%{transform:rotate(0)}to{transform:rotate(360deg)}}#tarka-chat .launcher{flex:none;display:flex;width:48px;height:48px;align-items:center;justify-content:center;border:none;border-radius:20px 10px 20px 20px;background:var(--primary-primary-subtle, #f0dafb);margin-top:8px}#tarka-chat .launcher .opened{display:none}#tarka-chat .tc-logo-face path{fill:var(--primary-primary-subtle, #f0dafb)}@media only screen and (max-width: 700px){#tarka-chat{bottom:10px;right:10px}#tarka-chat .t-container{width:calc(100vw - 20px)}}')),document.head.appendChild(a)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})(); const style = "", layout = `
=0;_-=1)if(R[_].ty==="sh")if(R[_].ks.k.i)C(R[_].ks.k);else for(P=R[_].ks.k.length,b=0;b
T[0]?!0:T[0]>R[0]?!1:R[1]>T[1]?!0:T[1]>R[1]?!1:R[2]>T[2]?!0:T[2]>R[2]?!1:null}var M=function(){var R=[4,4,14];function _(b){var P=b.t.d;b.t.d={k:[{s:P,t:0}]}}function T(b){var P,V=b.length;for(P=0;P =1?x.push({s:m.totalShapeLength*(u-1),e:m.totalShapeLength*(d-1)}):(x.push({s:m.totalShapeLength*u,e:m.totalShapeLength}),x.push({s:0,e:m.totalShapeLength*(d-1)}));var C=this.addShapes(m,x[0]);if(x[0].s!==x[0].e){if(x.length>1){var k=m.shape.paths.shapes[m.shape.paths._length-1];if(k.c){var M=C.pop();this.addPaths(C,A),C=this.addShapes(m,x[1],M)}else this.addPaths(C,A),C=this.addShapes(m,x[1])}this.addPaths(C,A)}}m.shape.paths=A}}},TrimModifier.prototype.addPaths=function(t,e){var r,i=t.length;for(r=0;re.e){r.c=!1;break}else e.s<=p&&e.e>=p+g.addedLength?(this.addSegment(s[a].v[l-1],s[a].o[l-1],s[a].i[l],s[a].v[l],r,E,A),A=!1):(S=bez.getNewSegment(s[a].v[l-1],s[a].v[l],s[a].o[l-1],s[a].i[l],(e.s-p)/g.addedLength,(e.e-p)/g.addedLength,c[l-1]),this.addSegmentFromArray(S,r,E,A),A=!1,r.c=!1),p+=g.addedLength,E+=1;if(s[a].c&&c.length){if(g=c[l-1],p<=e.e){var u=c[l-1].addedLength;e.s<=p&&e.e>=p+u?(this.addSegment(s[a].v[l-1],s[a].o[l-1],s[a].i[0],s[a].v[0],r,E,A),A=!1):(S=bez.getNewSegment(s[a].v[l-1],s[a].v[0],s[a].o[l-1],s[a].i[0],(e.s-p)/u,(e.e-p)/u,c[l-1]),this.addSegmentFromArray(S,r,E,A),A=!1,r.c=!1)}else r.c=!1;p+=g.addedLength,E+=1}if(r._length&&(r.setXYAt(r.v[m][0],r.v[m][1],"i",m),r.setXYAt(r.v[r._length-1][0],r.v[r._length-1][1],"o",r._length-1)),p>e.e)break;a t?this.textSpans[t].span:createNS(l?"g":"text"),f<=t){if(o.setAttribute("stroke-linecap","butt"),o.setAttribute("stroke-linejoin","round"),o.setAttribute("stroke-miterlimit","4"),this.textSpans[t].span=o,l){var C=createNS("g");o.appendChild(C),this.textSpans[t].childSpan=C}this.textSpans[t].span=o,this.layerElement.appendChild(o)}o.style.display="inherit"}if(p.reset(),E&&(n[t].n&&(c=-m,S+=r.yOffset,S+=x?1:0,x=!1),this.applyTextPropertiesToMatrix(r,p,n[t].line,c,S),c+=n[t].l||0,c+=m),l){y=this.globalData.fontManager.getCharData(r.finalText[t],i.fStyle,this.globalData.fontManager.getFontByName(r.f).fFamily);var k;if(y.t===1)k=new SVGCompElement(y.data,this.globalData,this);else{var M=emptyShapeData;y.data&&y.data.shapes&&(M=this.buildShapeData(y.data,r.finalSize)),k=new SVGShapeElement(M,this.globalData,this)}if(this.textSpans[t].glyph){var F=this.textSpans[t].glyph;this.textSpans[t].childSpan.removeChild(F.layerElement),F.destroy()}this.textSpans[t].glyph=k,k._debug=!0,k.prepareFrame(0),k.renderFrame(),this.textSpans[t].childSpan.appendChild(k.layerElement),y.t===1&&this.textSpans[t].childSpan.setAttribute("transform","scale("+r.finalSize/100+","+r.finalSize/100+")")}else E&&o.setAttribute("transform","translate("+p.props[12]+","+p.props[13]+")"),o.textContent=n[t].val,o.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve")}E&&o&&o.setAttribute("d",g)}for(;t =1?b.push({s:m.totalShapeLength*(u-1),e:m.totalShapeLength*(d-1)}):(b.push({s:m.totalShapeLength*u,e:m.totalShapeLength}),b.push({s:0,e:m.totalShapeLength*(d-1)}));var S=this.addShapes(m,b[0]);if(b[0].s!==b[0].e){if(b.length>1){var k=m.shape.paths.shapes[m.shape.paths._length-1];if(k.c){var _=S.pop();this.addPaths(S,M),S=this.addShapes(m,b[1],_)}else this.addPaths(S,M),S=this.addShapes(m,b[1])}this.addPaths(S,M)}}m.shape.paths=M}}},TrimModifier.prototype.addPaths=function(t,e){var r,i=t.length;for(r=0;re.e){r.c=!1;break}else e.s<=p&&e.e>=p+g.addedLength?(this.addSegment(s[n].v[l-1],s[n].o[l-1],s[n].i[l],s[n].v[l],r,P,M),M=!1):(x=bez.getNewSegment(s[n].v[l-1],s[n].v[l],s[n].o[l-1],s[n].i[l],(e.s-p)/g.addedLength,(e.e-p)/g.addedLength,c[l-1]),this.addSegmentFromArray(x,r,P,M),M=!1,r.c=!1),p+=g.addedLength,P+=1;if(s[n].c&&c.length){if(g=c[l-1],p<=e.e){var u=c[l-1].addedLength;e.s<=p&&e.e>=p+u?(this.addSegment(s[n].v[l-1],s[n].o[l-1],s[n].i[0],s[n].v[0],r,P,M),M=!1):(x=bez.getNewSegment(s[n].v[l-1],s[n].v[0],s[n].o[l-1],s[n].i[0],(e.s-p)/u,(e.e-p)/u,c[l-1]),this.addSegmentFromArray(x,r,P,M),M=!1,r.c=!1)}else r.c=!1;p+=g.addedLength,P+=1}if(r._length&&(r.setXYAt(r.v[m][0],r.v[m][1],"i",m),r.setXYAt(r.v[r._length-1][0],r.v[r._length-1][1],"o",r._length-1)),p>e.e)break;n 1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},TextProperty.prototype.addEffect=function(t){this.effectsSequence.push(t),this.elem.addDynamicProperty(this)},TextProperty.prototype.getValue=function(t){if(!((this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)&&!t)){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var e=this.currentData,r=this.keysIndex;if(this.lock){this.setCurrentData(this.currentData);return}this.lock=!0,this._mdf=!1;var i,s=this.effectsSequence.length,n=t||this.data.d.k[this.keysIndex].s;for(i=0;i-.001&&d<.001}function r(c,S,x,m,A,u,d,f,y){if(x===0&&u===0&&y===0)return e(c,S,m,A,d,f);var C=t.sqrt(t.pow(m-c,2)+t.pow(A-S,2)+t.pow(u-x,2)),k=t.sqrt(t.pow(d-c,2)+t.pow(f-S,2)+t.pow(y-x,2)),M=t.sqrt(t.pow(d-m,2)+t.pow(f-A,2)+t.pow(y-u,2)),F;return C>k?C>M?F=C-k-M:F=M-k-C:M>k?F=M-k-C:F=k-C-M,F>-1e-4&&F<1e-4}var i=function(){return function(c,S,x,m){var A=getDefaultCurveSegments(),u,d,f,y,C,k=0,M,F=[],L=[],N=bezierLengthPool.newElement();for(f=x.length,u=0;ud?-1:1,C=!0;C;)if(m[u]<=d&&m[u+1]>d?(f=(d-m[u])/(m[u+1]-m[u]),C=!1):u+=y,u<0||u>=A-1){if(u===A-1)return x[u];C=!1}return x[u]+(x[u+1]-x[u])*f}function p(c,S,x,m,A,u){var d=o(A,u),f=1-d,y=t.round((f*f*f*c[0]+(d*f*f+f*d*f+f*f*d)*x[0]+(d*d*f+f*d*d+d*f*d)*m[0]+d*d*d*S[0])*1e3)/1e3,C=t.round((f*f*f*c[1]+(d*f*f+f*d*f+f*f*d)*x[1]+(d*d*f+f*d*d+d*f*d)*m[1]+d*d*d*S[1])*1e3)/1e3;return[y,C]}var g=createTypedArray("float32",8);function E(c,S,x,m,A,u,d){A<0?A=0:A>1&&(A=1);var f=o(A,d);u=u>1?1:u;var y=o(u,d),C,k=c.length,M=1-f,F=1-y,L=M*M*M,N=f*M*M*3,D=f*f*M*3,B=f*f*f,O=M*M*F,z=f*M*F+M*f*F+M*M*y,R=f*f*F+M*f*y+f*M*y,_=f*f*y,T=M*F*F,b=f*F*F+M*y*F+M*F*y,P=f*y*F+M*y*y+f*F*y,V=f*y*y,I=F*F*F,G=y*F*F+F*y*F+F*F*y,q=y*y*F+F*y*y+y*F*y,j=y*y*y;for(C=0;C-.001&&d<.001}function r(c,x,b,m,M,u,d,f,y){if(b===0&&u===0&&y===0)return e(c,x,m,M,d,f);var S=t.sqrt(t.pow(m-c,2)+t.pow(M-x,2)+t.pow(u-b,2)),k=t.sqrt(t.pow(d-c,2)+t.pow(f-x,2)+t.pow(y-b,2)),_=t.sqrt(t.pow(d-m,2)+t.pow(f-M,2)+t.pow(y-u,2)),F;return S>k?S>_?F=S-k-_:F=_-k-S:_>k?F=_-k-S:F=k-S-_,F>-1e-4&&F<1e-4}var i=function(){return function(c,x,b,m){var M=getDefaultCurveSegments(),u,d,f,y,S,k=0,_,F=[],B=[],H=bezierLengthPool.newElement();for(f=b.length,u=0;u.01)return!1;r+=1}return!0},GradientProperty.prototype.checkCollapsable=function(){if(this.o.length/2!==this.c.length/4)return!1;if(this.data.k.k[0].s)for(var t=0,e=this.data.k.k.length;t1&&l&&this.setShapesAsAnimated(n)}},SVGShapeElement.prototype.setShapesAsAnimated=function(t){var e,r=t.length;for(e=0;ee);)r+=1;return this.keysIndex!==r&&(this.keysIndex=r),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(t){for(var e=[],r=0,i=t.length,s,a,n=!1,l=!1,o="";r=55296&&s<=56319?FontManager.isRegionalFlag(t,r)?o=t.substr(r,14):(a=t.charCodeAt(r+1),a>=56320&&a<=57343&&(FontManager.isModifier(s,a)?(o=t.substr(r,2),n=!0):FontManager.isFlagEmoji(t.substr(r,4))?o=t.substr(r,4):o=t.substr(r,2))):s>56319?(a=t.charCodeAt(r+1),FontManager.isVariationSelector(s)&&(n=!0)):FontManager.isZeroWidthJoiner(s)&&(n=!0,l=!0),n?(e[e.length-1]+=o,n=!1):e.push(o),r+=o.length;return e},TextProperty.prototype.completeTextData=function(t){t.__complete=!0;var e=this.elem.globalData.fontManager,r=this.data,i=[],s,a,n,l=0,o,p=r.m.g,g=0,E=0,c=0,S=[],x=0,m=0,A,u,d=e.getFontByName(t.f),f,y=0,C=getFontProperties(d);t.fWeight=C.weight,t.fStyle=C.style,t.finalSize=t.s,t.finalText=this.buildFinalText(t.t),a=t.finalText.length,t.finalLineHeight=t.lh;var k=t.tr/1e3*t.finalSize,M;if(t.sz)for(var F=!0,L=t.sz[0],N=t.sz[1],D,B;F;){B=this.buildFinalText(t.t),D=0,x=0,a=B.length,k=t.tr/1e3*t.finalSize;var O=-1;for(s=0;sL&&B[s]!==" "?(O===-1?a+=1:s=O,D+=t.finalLineHeight||t.finalSize*1.2,B.splice(s,O===s?1:0,"\r"),O=-1,x=0):(x+=y,x+=k);D+=d.ascent*t.finalSize/100,this.canResize&&t.finalSize>this.minimumFontSize&&Ns&&l==="slice")?this.transformCanvas.tx=(r-this.transformCanvas.w*(i/this.transformCanvas.h))/2*this.renderConfig.dpr:p==="xMax"&&(as&&l==="slice")?this.transformCanvas.tx=(r-this.transformCanvas.w*(i/this.transformCanvas.h))*this.renderConfig.dpr:this.transformCanvas.tx=0,g==="YMid"&&(a>s&&l==="meet"||as&&l==="meet"||a=0;t-=1)this.elements[t]&&this.elements[t].destroy&&this.elements[t].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},CanvasRendererBase.prototype.renderFrame=function(t,e){if(!(this.renderedFrame===t&&this.renderConfig.clearCanvas===!0&&!e||this.destroyed||t===-1)){this.renderedFrame=t,this.globalData.frameNum=t-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||e,this.globalData.projectInterface.currentFrame=t;var r,i=this.layers.length;for(this.completeLayers||this.checkLayers(t),r=i-1;r>=0;r-=1)(this.completeLayers||this.elements[r])&&this.elements[r].prepareFrame(t-this.layers[r].st);if(this.globalData._mdf){for(this.renderConfig.clearCanvas===!0?this.canvasContext.clearRect(0,0,this.transformCanvas.w,this.transformCanvas.h):this.save(),r=i-1;r>=0;r-=1)(this.completeLayers||this.elements[r])&&this.elements[r].renderFrame();this.renderConfig.clearCanvas!==!0&&this.restore()}}},CanvasRendererBase.prototype.buildItem=function(t){var e=this.elements;if(!(e[t]||this.layers[t].ty===99)){var r=this.createItem(this.layers[t],this,this.globalData);e[t]=r,r.initExpressions()}},CanvasRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var t=this.pendingElements.pop();t.checkParenting()}},CanvasRendererBase.prototype.hide=function(){this.animationItem.container.style.display="none"},CanvasRendererBase.prototype.show=function(){this.animationItem.container.style.display="block"};function CanvasContext(){this.opacity=-1,this.transform=createTypedArray("float32",16),this.fillStyle="",this.strokeStyle="",this.lineWidth="",this.lineCap="",this.lineJoin="",this.miterLimit="",this.id=Math.random()}function CVContextData(){this.stack=[],this.cArrPos=0,this.cTr=new Matrix;var t,e=15;for(t=0;td){var M=f,F=m.c&&f===y-1?0:f+1,L=(d-C)/u[f].addedLength;k=bez.getPointInSegment(m.v[M],m.v[F],m.o[M],m.i[F],L,u[f]);break}else C+=u[f].addedLength;f+=1}return k||(k=m.c?[m.v[0][0],m.v[0][1]]:[m.v[m._length-1][0],m.v[m._length-1][1]]),k},vectorOnPath:function(S,x,m){S==1?S=this.v.c:S==0&&(S=.999);var A=this.pointOnPath(S,x),u=this.pointOnPath(S+.001,x),d=u[0]-A[0],f=u[1]-A[1],y=Math.sqrt(Math.pow(d,2)+Math.pow(f,2));if(y===0)return[0,0];var C=m==="tangent"?[d/y,f/y]:[-f/y,d/y];return C},tangentOnPath:function(S,x){return this.vectorOnPath(S,x,"tangent")},normalOnPath:function(S,x){return this.vectorOnPath(S,x,"normal")},setGroupProperty:expressionHelpers.setGroupProperty,getValueAtTime:expressionHelpers.getStaticValueAtTime},extendPrototype([g],o),extendPrototype([g],p),p.prototype.getValueAtTime=l,p.prototype.initiateExpression=ExpressionManager.initiateExpression;var E=ShapePropertyFactory.getShapeProp;ShapePropertyFactory.getShapeProp=function(c,S,x,m,A){var u=E(c,S,x,m,A);return u.propertyIndex=S.ix,u.lock=!1,x===3?expressionHelpers.searchExpressions(c,S.pt,u):x===4&&expressionHelpers.searchExpressions(c,S.ks,u),u.k&&c.addDynamicProperty(u),u}}function initialize$1(){addPropertyDecorator()}function addDecorator(){function t(){return this.data.d.x?(this.calculateExpression=ExpressionManager.initiateExpression.bind(this)(this.elem,this.data.d,this),this.addEffect(this.getExpressionValue.bind(this)),!0):null}TextProperty.prototype.getExpressionValue=function(e,r){var i=this.calculateExpression(r);if(e.t!==i){var s={};return this.copyData(s,e),s.t=i.toString(),s.__complete=!1,s}return e},TextProperty.prototype.searchProperty=function(){var e=this.searchKeyframes(),r=this.searchExpressions();return this.kf=e||r,this.kf},TextProperty.prototype.searchExpressions=t}function initialize(){addDecorator()}function SVGComposableEffect(){}SVGComposableEffect.prototype={createMergeNode:function t(e,r){var i=createNS("feMerge");i.setAttribute("result",e);var s,a;for(a=0;a.01)return!1;r+=1}return!0},GradientProperty.prototype.checkCollapsable=function(){if(this.o.length/2!==this.c.length/4)return!1;if(this.data.k.k[0].s)for(var t=0,e=this.data.k.k.length;t1&&l&&this.setShapesAsAnimated(a)}},SVGShapeElement.prototype.setShapesAsAnimated=function(t){var e,r=t.length;for(e=0;ee);)r+=1;return this.keysIndex!==r&&(this.keysIndex=r),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(t){for(var e=[],r=0,i=t.length,s,n,a=!1,l=!1,o="";r=55296&&s<=56319?FontManager.isRegionalFlag(t,r)?o=t.substr(r,14):(n=t.charCodeAt(r+1),n>=56320&&n<=57343&&(FontManager.isModifier(s,n)?(o=t.substr(r,2),a=!0):FontManager.isFlagEmoji(t.substr(r,4))?o=t.substr(r,4):o=t.substr(r,2))):s>56319?(n=t.charCodeAt(r+1),FontManager.isVariationSelector(s)&&(a=!0)):FontManager.isZeroWidthJoiner(s)&&(a=!0,l=!0),a?(e[e.length-1]+=o,a=!1):e.push(o),r+=o.length;return e},TextProperty.prototype.completeTextData=function(t){t.__complete=!0;var e=this.elem.globalData.fontManager,r=this.data,i=[],s,n,a,l=0,o,p=r.m.g,g=0,P=0,c=0,x=[],b=0,m=0,M,u,d=e.getFontByName(t.f),f,y=0,S=getFontProperties(d);t.fWeight=S.weight,t.fStyle=S.style,t.finalSize=t.s,t.finalText=this.buildFinalText(t.t),n=t.finalText.length,t.finalLineHeight=t.lh;var k=t.tr/1e3*t.finalSize,_;if(t.sz)for(var F=!0,B=t.sz[0],H=t.sz[1],D,R;F;){R=this.buildFinalText(t.t),D=0,b=0,n=R.length,k=t.tr/1e3*t.finalSize;var G=-1;for(s=0;ss&&l==="slice")?this.transformCanvas.tx=(r-this.transformCanvas.w*(i/this.transformCanvas.h))/2*this.renderConfig.dpr:p==="xMax"&&(ns&&l==="slice")?this.transformCanvas.tx=(r-this.transformCanvas.w*(i/this.transformCanvas.h))*this.renderConfig.dpr:this.transformCanvas.tx=0,g==="YMid"&&(n>s&&l==="meet"||ns&&l==="meet"||n=0;t-=1)this.elements[t]&&this.elements[t].destroy&&this.elements[t].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},CanvasRendererBase.prototype.renderFrame=function(t,e){if(!(this.renderedFrame===t&&this.renderConfig.clearCanvas===!0&&!e||this.destroyed||t===-1)){this.renderedFrame=t,this.globalData.frameNum=t-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||e,this.globalData.projectInterface.currentFrame=t;var r,i=this.layers.length;for(this.completeLayers||this.checkLayers(t),r=i-1;r>=0;r-=1)(this.completeLayers||this.elements[r])&&this.elements[r].prepareFrame(t-this.layers[r].st);if(this.globalData._mdf){for(this.renderConfig.clearCanvas===!0?this.canvasContext.clearRect(0,0,this.transformCanvas.w,this.transformCanvas.h):this.save(),r=i-1;r>=0;r-=1)(this.completeLayers||this.elements[r])&&this.elements[r].renderFrame();this.renderConfig.clearCanvas!==!0&&this.restore()}}},CanvasRendererBase.prototype.buildItem=function(t){var e=this.elements;if(!(e[t]||this.layers[t].ty===99)){var r=this.createItem(this.layers[t],this,this.globalData);e[t]=r,r.initExpressions()}},CanvasRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var t=this.pendingElements.pop();t.checkParenting()}},CanvasRendererBase.prototype.hide=function(){this.animationItem.container.style.display="none"},CanvasRendererBase.prototype.show=function(){this.animationItem.container.style.display="block"};function CanvasContext(){this.opacity=-1,this.transform=createTypedArray("float32",16),this.fillStyle="",this.strokeStyle="",this.lineWidth="",this.lineCap="",this.lineJoin="",this.miterLimit="",this.id=Math.random()}function CVContextData(){this.stack=[],this.cArrPos=0,this.cTr=new Matrix;var t,e=15;for(t=0;t=u)return this.pv;var d,f;b?(x?d=Math.abs(this.elem.comp.globalData.frameRate*x):d=Math.max(0,this.elem.data.op-u),f=u+d):((!x||x>M.length-1)&&(x=M.length-1),f=M[x].t,d=f-u);var y,S,k;if(c==="pingpong"){var _=Math.floor((u-m)/d);if(_%2===0)return this.getValueAtTime(((u-m)%d+u)/this.comp.globalData.frameRate,0)}else if(c==="offset"){var F=this.getValueAtTime(u/this.comp.globalData.frameRate,0),B=this.getValueAtTime(f/this.comp.globalData.frameRate,0),H=this.getValueAtTime((d-(u-m)%d+u)/this.comp.globalData.frameRate,0),D=Math.floor((u-m)/d)+1;if(this.pv.length){for(k=new Array(F.length),S=k.length,y=0;y1?(M-m)/(x-1):1,d=0,f=0,y;this.pv.length?y=createTypedArray("float32",this.pv.length):y=0;for(var S;d
=1?b.push({s:m.totalShapeLength*(u-1),e:m.totalShapeLength*(d-1)}):(b.push({s:m.totalShapeLength*u,e:m.totalShapeLength}),b.push({s:0,e:m.totalShapeLength*(d-1)}));var S=this.addShapes(m,b[0]);if(b[0].s!==b[0].e){if(b.length>1){var k=m.shape.paths.shapes[m.shape.paths._length-1];if(k.c){var _=S.pop();this.addPaths(S,M),S=this.addShapes(m,b[1],_)}else this.addPaths(S,M),S=this.addShapes(m,b[1])}this.addPaths(S,M)}}m.shape.paths=M}}},TrimModifier.prototype.addPaths=function(t,e){var r,i=t.length;for(r=0;re.e){r.c=!1;break}else e.s<=p&&e.e>=p+g.addedLength?(this.addSegment(s[n].v[l-1],s[n].o[l-1],s[n].i[l],s[n].v[l],r,P,M),M=!1):(x=bez.getNewSegment(s[n].v[l-1],s[n].v[l],s[n].o[l-1],s[n].i[l],(e.s-p)/g.addedLength,(e.e-p)/g.addedLength,c[l-1]),this.addSegmentFromArray(x,r,P,M),M=!1,r.c=!1),p+=g.addedLength,P+=1;if(s[n].c&&c.length){if(g=c[l-1],p<=e.e){var u=c[l-1].addedLength;e.s<=p&&e.e>=p+u?(this.addSegment(s[n].v[l-1],s[n].o[l-1],s[n].i[0],s[n].v[0],r,P,M),M=!1):(x=bez.getNewSegment(s[n].v[l-1],s[n].v[0],s[n].o[l-1],s[n].i[0],(e.s-p)/u,(e.e-p)/u,c[l-1]),this.addSegmentFromArray(x,r,P,M),M=!1,r.c=!1)}else r.c=!1;p+=g.addedLength,P+=1}if(r._length&&(r.setXYAt(r.v[m][0],r.v[m][1],"i",m),r.setXYAt(r.v[r._length-1][0],r.v[r._length-1][1],"o",r._length-1)),p>e.e)break;n 1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},TextProperty.prototype.addEffect=function(t){this.effectsSequence.push(t),this.elem.addDynamicProperty(this)},TextProperty.prototype.getValue=function(t){if(!((this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)&&!t)){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var e=this.currentData,r=this.keysIndex;if(this.lock){this.setCurrentData(this.currentData);return}this.lock=!0,this._mdf=!1;var i,s=this.effectsSequence.length,n=t||this.data.d.k[this.keysIndex].s;for(i=0;i =1?b.push({s:m.totalShapeLength*(u-1),e:m.totalShapeLength*(d-1)}):(b.push({s:m.totalShapeLength*u,e:m.totalShapeLength}),b.push({s:0,e:m.totalShapeLength*(d-1)}));var S=this.addShapes(m,b[0]);if(b[0].s!==b[0].e){if(b.length>1){var k=m.shape.paths.shapes[m.shape.paths._length-1];if(k.c){var _=S.pop();this.addPaths(S,M),S=this.addShapes(m,b[1],_)}else this.addPaths(S,M),S=this.addShapes(m,b[1])}this.addPaths(S,M)}}m.shape.paths=M}}},TrimModifier.prototype.addPaths=function(t,e){var r,i=t.length;for(r=0;re.e){r.c=!1;break}else e.s<=p&&e.e>=p+g.addedLength?(this.addSegment(s[n].v[l-1],s[n].o[l-1],s[n].i[l],s[n].v[l],r,P,M),M=!1):(x=bez.getNewSegment(s[n].v[l-1],s[n].v[l],s[n].o[l-1],s[n].i[l],(e.s-p)/g.addedLength,(e.e-p)/g.addedLength,c[l-1]),this.addSegmentFromArray(x,r,P,M),M=!1,r.c=!1),p+=g.addedLength,P+=1;if(s[n].c&&c.length){if(g=c[l-1],p<=e.e){var u=c[l-1].addedLength;e.s<=p&&e.e>=p+u?(this.addSegment(s[n].v[l-1],s[n].o[l-1],s[n].i[0],s[n].v[0],r,P,M),M=!1):(x=bez.getNewSegment(s[n].v[l-1],s[n].v[0],s[n].o[l-1],s[n].i[0],(e.s-p)/u,(e.e-p)/u,c[l-1]),this.addSegmentFromArray(x,r,P,M),M=!1,r.c=!1)}else r.c=!1;p+=g.addedLength,P+=1}if(r._length&&(r.setXYAt(r.v[m][0],r.v[m][1],"i",m),r.setXYAt(r.v[r._length-1][0],r.v[r._length-1][1],"o",r._length-1)),p>e.e)break;n 1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},TextProperty.prototype.addEffect=function(t){this.effectsSequence.push(t),this.elem.addDynamicProperty(this)},TextProperty.prototype.getValue=function(t){if(!((this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)&&!t)){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var e=this.currentData,r=this.keysIndex;if(this.lock){this.setCurrentData(this.currentData);return}this.lock=!0,this._mdf=!1;var i,s=this.effectsSequence.length,n=t||this.data.d.k[this.keysIndex].s;for(i=0;i.01)return!1;r+=1}return!0},GradientProperty.prototype.checkCollapsable=function(){if(this.o.length/2!==this.c.length/4)return!1;if(this.data.k.k[0].s)for(var t=0,e=this.data.k.k.length;t1&&l&&this.setShapesAsAnimated(a)}},SVGShapeElement.prototype.setShapesAsAnimated=function(t){var e,r=t.length;for(e=0;ee);)r+=1;return this.keysIndex!==r&&(this.keysIndex=r),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(t){for(var e=[],r=0,i=t.length,s,n,a=!1,l=!1,o="";r=55296&&s<=56319?FontManager.isRegionalFlag(t,r)?o=t.substr(r,14):(n=t.charCodeAt(r+1),n>=56320&&n<=57343&&(FontManager.isModifier(s,n)?(o=t.substr(r,2),a=!0):FontManager.isFlagEmoji(t.substr(r,4))?o=t.substr(r,4):o=t.substr(r,2))):s>56319?(n=t.charCodeAt(r+1),FontManager.isVariationSelector(s)&&(a=!0)):FontManager.isZeroWidthJoiner(s)&&(a=!0,l=!0),a?(e[e.length-1]+=o,a=!1):e.push(o),r+=o.length;return e},TextProperty.prototype.completeTextData=function(t){t.__complete=!0;var e=this.elem.globalData.fontManager,r=this.data,i=[],s,n,a,l=0,o,p=r.m.g,g=0,P=0,c=0,x=[],b=0,m=0,M,u,d=e.getFontByName(t.f),f,y=0,S=getFontProperties(d);t.fWeight=S.weight,t.fStyle=S.style,t.finalSize=t.s,t.finalText=this.buildFinalText(t.t),n=t.finalText.length,t.finalLineHeight=t.lh;var k=t.tr/1e3*t.finalSize,_;if(t.sz)for(var F=!0,B=t.sz[0],H=t.sz[1],D,R;F;){R=this.buildFinalText(t.t),D=0,b=0,n=R.length,k=t.tr/1e3*t.finalSize;var G=-1;for(s=0;ss&&l==="slice")?this.transformCanvas.tx=(r-this.transformCanvas.w*(i/this.transformCanvas.h))/2*this.renderConfig.dpr:p==="xMax"&&(ns&&l==="slice")?this.transformCanvas.tx=(r-this.transformCanvas.w*(i/this.transformCanvas.h))*this.renderConfig.dpr:this.transformCanvas.tx=0,g==="YMid"&&(n>s&&l==="meet"||ns&&l==="meet"||n=0;t-=1)this.elements[t]&&this.elements[t].destroy&&this.elements[t].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},CanvasRendererBase.prototype.renderFrame=function(t,e){if(!(this.renderedFrame===t&&this.renderConfig.clearCanvas===!0&&!e||this.destroyed||t===-1)){this.renderedFrame=t,this.globalData.frameNum=t-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||e,this.globalData.projectInterface.currentFrame=t;var r,i=this.layers.length;for(this.completeLayers||this.checkLayers(t),r=i-1;r>=0;r-=1)(this.completeLayers||this.elements[r])&&this.elements[r].prepareFrame(t-this.layers[r].st);if(this.globalData._mdf){for(this.renderConfig.clearCanvas===!0?this.canvasContext.clearRect(0,0,this.transformCanvas.w,this.transformCanvas.h):this.save(),r=i-1;r>=0;r-=1)(this.completeLayers||this.elements[r])&&this.elements[r].renderFrame();this.renderConfig.clearCanvas!==!0&&this.restore()}}},CanvasRendererBase.prototype.buildItem=function(t){var e=this.elements;if(!(e[t]||this.layers[t].ty===99)){var r=this.createItem(this.layers[t],this,this.globalData);e[t]=r,r.initExpressions()}},CanvasRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var t=this.pendingElements.pop();t.checkParenting()}},CanvasRendererBase.prototype.hide=function(){this.animationItem.container.style.display="none"},CanvasRendererBase.prototype.show=function(){this.animationItem.container.style.display="block"};function CanvasContext(){this.opacity=-1,this.transform=createTypedArray("float32",16),this.fillStyle="",this.strokeStyle="",this.lineWidth="",this.lineCap="",this.lineJoin="",this.miterLimit="",this.id=Math.random()}function CVContextData(){this.stack=[],this.cArrPos=0,this.cTr=new Matrix;var t,e=15;for(t=0;t=u)return this.pv;var d,f;b?(x?d=Math.abs(this.elem.comp.globalData.frameRate*x):d=Math.max(0,this.elem.data.op-u),f=u+d):((!x||x>M.length-1)&&(x=M.length-1),f=M[x].t,d=f-u);var y,S,k;if(c==="pingpong"){var _=Math.floor((u-m)/d);if(_%2===0)return this.getValueAtTime(((u-m)%d+u)/this.comp.globalData.frameRate,0)}else if(c==="offset"){var F=this.getValueAtTime(u/this.comp.globalData.frameRate,0),B=this.getValueAtTime(f/this.comp.globalData.frameRate,0),H=this.getValueAtTime((d-(u-m)%d+u)/this.comp.globalData.frameRate,0),D=Math.floor((u-m)/d)+1;if(this.pv.length){for(k=new Array(F.length),S=k.length,y=0;y1?(M-m)/(x-1):1,d=0,f=0,y;this.pv.length?y=createTypedArray("float32",this.pv.length):y=0;for(var S;d.01)return!1;r+=1}return!0},GradientProperty.prototype.checkCollapsable=function(){if(this.o.length/2!==this.c.length/4)return!1;if(this.data.k.k[0].s)for(var t=0,e=this.data.k.k.length;t1&&l&&this.setShapesAsAnimated(a)}},SVGShapeElement.prototype.setShapesAsAnimated=function(t){var e,r=t.length;for(e=0;ee);)r+=1;return this.keysIndex!==r&&(this.keysIndex=r),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(t){for(var e=[],r=0,i=t.length,s,n,a=!1,l=!1,o="";r=55296&&s<=56319?FontManager.isRegionalFlag(t,r)?o=t.substr(r,14):(n=t.charCodeAt(r+1),n>=56320&&n<=57343&&(FontManager.isModifier(s,n)?(o=t.substr(r,2),a=!0):FontManager.isFlagEmoji(t.substr(r,4))?o=t.substr(r,4):o=t.substr(r,2))):s>56319?(n=t.charCodeAt(r+1),FontManager.isVariationSelector(s)&&(a=!0)):FontManager.isZeroWidthJoiner(s)&&(a=!0,l=!0),a?(e[e.length-1]+=o,a=!1):e.push(o),r+=o.length;return e},TextProperty.prototype.completeTextData=function(t){t.__complete=!0;var e=this.elem.globalData.fontManager,r=this.data,i=[],s,n,a,l=0,o,p=r.m.g,g=0,P=0,c=0,x=[],b=0,m=0,M,u,d=e.getFontByName(t.f),f,y=0,S=getFontProperties(d);t.fWeight=S.weight,t.fStyle=S.style,t.finalSize=t.s,t.finalText=this.buildFinalText(t.t),n=t.finalText.length,t.finalLineHeight=t.lh;var k=t.tr/1e3*t.finalSize,_;if(t.sz)for(var F=!0,B=t.sz[0],H=t.sz[1],D,R;F;){R=this.buildFinalText(t.t),D=0,b=0,n=R.length,k=t.tr/1e3*t.finalSize;var G=-1;for(s=0;ss&&l==="slice")?this.transformCanvas.tx=(r-this.transformCanvas.w*(i/this.transformCanvas.h))/2*this.renderConfig.dpr:p==="xMax"&&(ns&&l==="slice")?this.transformCanvas.tx=(r-this.transformCanvas.w*(i/this.transformCanvas.h))*this.renderConfig.dpr:this.transformCanvas.tx=0,g==="YMid"&&(n>s&&l==="meet"||ns&&l==="meet"||n=0;t-=1)this.elements[t]&&this.elements[t].destroy&&this.elements[t].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},CanvasRendererBase.prototype.renderFrame=function(t,e){if(!(this.renderedFrame===t&&this.renderConfig.clearCanvas===!0&&!e||this.destroyed||t===-1)){this.renderedFrame=t,this.globalData.frameNum=t-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||e,this.globalData.projectInterface.currentFrame=t;var r,i=this.layers.length;for(this.completeLayers||this.checkLayers(t),r=i-1;r>=0;r-=1)(this.completeLayers||this.elements[r])&&this.elements[r].prepareFrame(t-this.layers[r].st);if(this.globalData._mdf){for(this.renderConfig.clearCanvas===!0?this.canvasContext.clearRect(0,0,this.transformCanvas.w,this.transformCanvas.h):this.save(),r=i-1;r>=0;r-=1)(this.completeLayers||this.elements[r])&&this.elements[r].renderFrame();this.renderConfig.clearCanvas!==!0&&this.restore()}}},CanvasRendererBase.prototype.buildItem=function(t){var e=this.elements;if(!(e[t]||this.layers[t].ty===99)){var r=this.createItem(this.layers[t],this,this.globalData);e[t]=r,r.initExpressions()}},CanvasRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var t=this.pendingElements.pop();t.checkParenting()}},CanvasRendererBase.prototype.hide=function(){this.animationItem.container.style.display="none"},CanvasRendererBase.prototype.show=function(){this.animationItem.container.style.display="block"};function CanvasContext(){this.opacity=-1,this.transform=createTypedArray("float32",16),this.fillStyle="",this.strokeStyle="",this.lineWidth="",this.lineCap="",this.lineJoin="",this.miterLimit="",this.id=Math.random()}function CVContextData(){this.stack=[],this.cArrPos=0,this.cTr=new Matrix;var t,e=15;for(t=0;t=u)return this.pv;var d,f;b?(x?d=Math.abs(this.elem.comp.globalData.frameRate*x):d=Math.max(0,this.elem.data.op-u),f=u+d):((!x||x>M.length-1)&&(x=M.length-1),f=M[x].t,d=f-u);var y,S,k;if(c==="pingpong"){var _=Math.floor((u-m)/d);if(_%2===0)return this.getValueAtTime(((u-m)%d+u)/this.comp.globalData.frameRate,0)}else if(c==="offset"){var F=this.getValueAtTime(u/this.comp.globalData.frameRate,0),B=this.getValueAtTime(f/this.comp.globalData.frameRate,0),H=this.getValueAtTime((d-(u-m)%d+u)/this.comp.globalData.frameRate,0),D=Math.floor((u-m)/d)+1;if(this.pv.length){for(k=new Array(F.length),S=k.length,y=0;y1?(M-m)/(x-1):1,d=0,f=0,y;this.pv.length?y=createTypedArray("float32",this.pv.length):y=0;for(var S;d