diff --git a/.github/workflows/bump-version.yaml b/.github/workflows/bump-version.yaml index 4db902b..7bbc02c 100644 --- a/.github/workflows/bump-version.yaml +++ b/.github/workflows/bump-version.yaml @@ -23,7 +23,7 @@ jobs: - name: Setup node uses: actions/setup-node@v3 with: - node-version: "16" + node-version: "18" - name: Bump version run: | @@ -52,4 +52,4 @@ jobs: git config user.email "actions@github.com" git add package.json dist/ git commit -m "Bump version to ${{ steps.get_version.outputs.version }}" - git push origin HEAD:v2 \ No newline at end of file + git push origin HEAD:v2 diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..a9d0873 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18.19.0 diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/.prettierrc @@ -0,0 +1 @@ +{} diff --git a/README.md b/README.md index 22d71e8..8c898c7 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,20 @@ Tarka Chat UI is a plug and play javascript library to integrate a chat assistant to your website in one line - ## Usage 1. Incude the following script (hosted in CDN) in your html - ``` - - ``` +``` + +``` +Include highcharts library to generate charts by highcharts + +``` + + +``` 2. Initialise the global `TarkaChat` component with options in any script tag @@ -22,6 +27,7 @@ TarkaChat.init({ themeColor: "#F0DAFB", selectorId: "chatbot", expand: true, + enableUpload: true, preChatRenderer: function (onClose) { // Return a DOM Node that can be attached to the chatbot UI // Use the onClose callback to close the pre-chat screen @@ -43,20 +49,92 @@ where, - [Optional] **title** is the title of the chatbot window - [Optional] **botName** will be displayed below each bot message - [Optional] **expand** opens the chat window in expanded mode on init when set to true, otherwise opens in collapse mode. Defaults to false. +- [Optional] **enableUpload** will show the option to upload a file when set to true. False by default - **greeting** will be the first message displayed on the chatbot when opened for the first time - **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", + } + ``` + + - _HighCharts config type:_ + + ``` + { + "type": "highchart-config", + "high_chart_config": { highcharts_config_obj } + } + ``` + + - _Table type:_ + + ``` + { + "type": "table", + "table_data": { "header":[],"rows":[{}] } + } + ``` + + 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 Demo is deployed from the application code in `demo/` folder. Link: https://tarkalabs.github.io/tarka-chat/demo/ +## Dev notes + +If you wanted to run this code in your local for development purposes, Run the following command from project root folder `yarn dev` and open `dev/index.html` in your browser to see the chat window. Your local changes will be hot reloaded + ## Old versions -* v1.1 : https://d1fmfone96g0x2.cloudfront.net/tarka-chat-1.1.umd.js -* v1.0 : https://d1fmfone96g0x2.cloudfront.net/tarka-chat-1.1.umd.js +- v1.1 : https://d1fmfone96g0x2.cloudfront.net/tarka-chat-1.1.umd.js +- v1.0 : https://d1fmfone96g0x2.cloudfront.net/tarka-chat-1.1.umd.js Check [release notes](RELEASE.md) for details diff --git a/RELEASE.md b/RELEASE.md deleted file mode 100644 index 69c6576..0000000 --- a/RELEASE.md +++ /dev/null @@ -1,5 +0,0 @@ -# v1.1 -- Fixed the issue #18 where the chat window does not render correctly in mobile view - -# v1.0 -Initial version diff --git a/demo/index.html b/demo/index.html index 96f126c..2527c18 100644 --- a/demo/index.html +++ b/demo/index.html @@ -12,8 +12,10 @@ } + + - +
diff --git a/dev/index.html b/dev/index.html index 929500a..5bbdade 100644 --- a/dev/index.html +++ b/dev/index.html @@ -3,6 +3,8 @@ + + TarkaChat DevMode diff --git a/dev/init.js b/dev/init.js index ca962d0..2385546 100644 --- a/dev/init.js +++ b/dev/init.js @@ -1,5 +1,20 @@ import TarkaChat from "../src/main.js"; -import "./style.css" +import "./style.css"; + +const UPLOAD_TYPES = ["image/png", "image/jpeg"]; + +function generateImageThumbnail(file) { + return new Promise((resolve) => { + const reader = new FileReader(); + reader.onload = function (e) { + const thumbnail = document.createElement("img"); + thumbnail.src = e.target.result; + thumbnail.alt = file.name; + resolve(thumbnail); + }; + reader.readAsDataURL(file); + }); +} function getPreChatScreen(onClose) { const title = document.createElement("h3"); @@ -16,11 +31,73 @@ function getPreChatScreen(onClose) { return container; } -async function sendMessage(message) { +async function sendMessage(message, optionalFiles) { + console.log(optionalFiles); // Do API calls - await new Promise((resolve) => setTimeout(resolve, 3000)); - // after getting response - return Promise.resolve("Recieved: " + message); + await new Promise((resolve) => setTimeout(resolve, 1000)); + + // after getting response use any one of the following to simulate different types of responses + let textResponse = + "This is a **markdown** __enabled__ text response \n * First \n * Second"; + let textObjResponse = { type: "text", message: "hi tehreee" }; + let fileObjResponse = { + type: "file", + name: "tarka trends", + link: "https://tarkalabs.com", + }; + let imageObjResponse = { + type: "image", + name: "tarka logo", + link: "https://tarkalabs.com/assets/img/teamg2.94f91078.jpg", + }; + let tableObjResponse = { + type: "table", + table_data: { + header: ["col1", "col2"], + rows: [ + { col1: "a", col2: 1 }, + { col1: "b", col2: 2 }, + ], + }, + }; + let blankTableObjResponse = { + type: "table", + table_data: { + header: ["col1", "col2"], + rows: [], + }, + }; + let highchartsResponse = { + type: "highchart-config", + high_chart_config: { + chart: { + type: "pie", + }, + title: { + text: "Browsers market share", + }, + series: [ + { + name: "Brands", + data: [ + { + name: "Chrome", + y: 70, + }, + { + name: "Firefox", + y: 20, + }, + { + name: "Others", + y: 10, + }, + ], + }, + ], + }, + }; + return Promise.resolve(textResponse); } const chat = TarkaChat.init({ @@ -29,9 +106,11 @@ const chat = TarkaChat.init({ greeting: "Hello. How can I assist you today?", themeColor: "#F0DAFB", selectorId: "tarkachatbot", + uploadTypes: UPLOAD_TYPES, + generateUploadPreview: generateImageThumbnail, preChatRenderer: getPreChatScreen, submitHandler: sendMessage, expand: true, }); -// chat.toggle(), chat.isOpen() \ No newline at end of file +// chat.toggle(), chat.isOpen() diff --git a/dist/tarka-chat.es.js b/dist/tarka-chat.es.js index bffa7ce..a5253e7 100644 --- a/dist/tarka-chat.es.js +++ b/dist/tarka-chat.es.js @@ -1,4 +1,16 @@ -(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 .high-chart-container{width:110%;height:300px;position:relative;border:1px solid var(--primary-primary-subtle, #f0dafb);border-radius:15px;margin:4px 0}#tarka-chat .t-container .body .message-container .message .high-chart-container .highcharts-button-box{fill:var(--primary-primary-subtle, #f0dafb)!important}#tarka-chat .t-container .body .message-container .message .table-container{width:110%;position:relative;border:1px solid var(--primary-primary-subtle, #f0dafb);border-radius:15px;overflow-x:auto}#tarka-chat .t-container .body .message-container .message .table-container table{border-collapse:collapse;border-radius:5px;min-width:100%}#tarka-chat .t-container .body .message-container .message .table-container th,#tarka-chat .t-container .body .message-container .message .table-container td{white-space:nowrap;padding:5px;border-right:1px solid var(--primary-primary-subtle, #f0dafb);border-bottom:1px solid var(--primary-primary-subtle, #f0dafb)}#tarka-chat .t-container .body .message-container .message .table-container th:last-child,#tarka-chat .t-container .body .message-container .message .table-container td:last-child{border-right:0px solid var(--primary-primary-subtle, #f0dafb)}#tarka-chat .t-container .body .message-container .message .image-container{position:relative;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%;border-radius:inherit;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 .upload-btn{width:48px;height:48px;border:none;background:transparent;display:flex;align-items:center;justify-content:center}#tarka-chat .t-container .footer .input-container .upload-btn path{fill:var(--primary-primary, #9500b3)}#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 .t-container .upload-preview-container{display:none;flex:0 0 auto;overflow-x:auto;white-space:nowrap;gap:10px;padding:15px 10px 25px}#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)}#tarka-chat .upload-preview-item{flex:0 0 auto;width:60px;height:80px;position:relative;border:1px solid #444444;border-radius:5px;overflow:hidden}#tarka-chat .upload-preview-item img{display:block;height:100%;width:100%;object-fit:cover}@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)}})(); +var Ce = Object.defineProperty; +var Se = (e, t, r) => t in e ? Ce(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r; +var X = (e, t, r) => (Se(e, typeof t != "symbol" ? t + "" : t, r), r), Pe = (e, t, r) => { + if (!t.has(e)) + throw TypeError("Cannot " + r); +}; +var be = (e, t, r) => { + if (t.has(e)) + throw TypeError("Cannot add the same private member more than once"); + t instanceof WeakSet ? t.add(e) : t.set(e, r); +}; +var ye = (e, t, r) => (Pe(e, t, "access private method"), r); const style = "", layout = `
@@ -11,6 +23,13 @@ const style = "", layout = `
+
+
+
-`;var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var lottie$1={exports:{}};(function(module,exports){typeof navigator<"u"&&function(t,e){module.exports=e()}(commonjsGlobal,function(){var svgNS="http://www.w3.org/2000/svg",locationHref="",_useWebWorker=!1,initialDefaultFrame=-999999,setWebWorker=function(e){_useWebWorker=!!e},getWebWorker=function(){return _useWebWorker},setLocationHref=function(e){locationHref=e},getLocationHref=function(){return locationHref};function createTag(t){return document.createElement(t)}function extendPrototype(t,e){var r,i=t.length,s;for(r=0;r1?r[1]=1:r[1]<=0&&(r[1]=0),HSVtoRGB(r[0],r[1],r[2])}function addBrightnessToRGB(t,e){var r=RGBtoHSV(t[0]*255,t[1]*255,t[2]*255);return r[2]+=e,r[2]>1?r[2]=1:r[2]<0&&(r[2]=0),HSVtoRGB(r[0],r[1],r[2])}function addHueToRGB(t,e){var r=RGBtoHSV(t[0]*255,t[1]*255,t[2]*255);return r[0]+=e/360,r[0]>1?r[0]-=1:r[0]<0&&(r[0]+=1),HSVtoRGB(r[0],r[1],r[2])}var rgbToHex=function(){var t=[],e,r;for(e=0;e<256;e+=1)r=e.toString(16),t[e]=r.length===1?"0"+r:r;return function(i,s,a){return i<0&&(i=0),s<0&&(s=0),a<0&&(a=0),"#"+t[i]+t[s]+t[a]}}(),setSubframeEnabled=function(e){subframeEnabled=!!e},getSubframeEnabled=function(){return subframeEnabled},setExpressionsPlugin=function(e){expressionsPlugin=e},getExpressionsPlugin=function(){return expressionsPlugin},setExpressionInterfaces=function(e){expressionsInterfaces=e},getExpressionInterfaces=function(){return expressionsInterfaces},setDefaultCurveSegments=function(e){defaultCurveSegments=e},getDefaultCurveSegments=function(){return defaultCurveSegments},setIdPrefix=function(e){idPrefix$1=e};function createNS(t){return document.createElementNS(svgNS,t)}function _typeof$5(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$5=function(r){return typeof r}:_typeof$5=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_typeof$5(t)}var dataManager=function(){var t=1,e=[],r,i,s={onmessage:function(){},postMessage:function(S){r({data:S})}},a={postMessage:function(S){s.onmessage({data:S})}};function n(c){if(window.Worker&&window.Blob&&getWebWorker()){var S=new Blob(["var _workerSelf = self; self.onmessage = ",c.toString()],{type:"text/javascript"}),x=URL.createObjectURL(S);return new Worker(x)}return r=c,s}function l(){i||(i=n(function(S){function x(){function A(R,_){var T,b,P=R.length,V,I,G,q;for(b=0;b=0;_-=1)if(R[_].ty==="sh")if(R[_].ks.k.i)C(R[_].ks.k);else for(P=R[_].ks.k.length,b=0;bT[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=0;P-=1)if(b[P].ty==="sh")if(b[P].ks.k.i)b[P].ks.k.c=b[P].closed;else for(G=b[P].ks.k.length,I=0;I500)&&(this._imageLoaded(),clearInterval(f)),d+=1}).bind(this),50)}function a(u){var d=i(u,this.assetsPath,this.path),f=createNS("image");isSafari?this.testImageLoaded(f):f.addEventListener("load",this._imageLoaded,!1),f.addEventListener("error",(function(){y.img=t,this._imageLoaded()}).bind(this),!1),f.setAttributeNS("http://www.w3.org/1999/xlink","href",d),this._elementHelper.append?this._elementHelper.append(f):this._elementHelper.appendChild(f);var y={img:f,assetData:u};return y}function n(u){var d=i(u,this.assetsPath,this.path),f=createTag("img");f.crossOrigin="anonymous",f.addEventListener("load",this._imageLoaded,!1),f.addEventListener("error",(function(){y.img=t,this._imageLoaded()}).bind(this),!1),f.src=d;var y={img:f,assetData:u};return y}function l(u){var d={assetData:u},f=i(u,this.assetsPath,this.path);return dataManager.loadData(f,(function(y){d.img=y,this._footageLoaded()}).bind(this),(function(){d.img={},this._footageLoaded()}).bind(this)),d}function o(u,d){this.imagesLoadedCb=d;var f,y=u.length;for(f=0;fthis.animationData.op&&(this.animationData.op=t.op,this.totalFrames=Math.floor(t.op-this.animationData.ip));var e=this.animationData.layers,r,i=e.length,s=t.layers,a,n=s.length;for(a=0;athis.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")},AnimationItem.prototype.renderFrame=function(){if(!(this.isLoaded===!1||!this.renderer))try{this.expressionsPlugin&&this.expressionsPlugin.resetFrame(),this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(t){this.triggerRenderFrameError(t)}},AnimationItem.prototype.play=function(t){t&&this.name!==t||this.isPaused===!0&&(this.isPaused=!1,this.trigger("_play"),this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},AnimationItem.prototype.pause=function(t){t&&this.name!==t||this.isPaused===!1&&(this.isPaused=!0,this.trigger("_pause"),this._idle=!0,this.trigger("_idle"),this.audioController.pause())},AnimationItem.prototype.togglePause=function(t){t&&this.name!==t||(this.isPaused===!0?this.play():this.pause())},AnimationItem.prototype.stop=function(t){t&&this.name!==t||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},AnimationItem.prototype.getMarkerData=function(t){for(var e,r=0;r=this.totalFrames-1&&this.frameModifier>0?!this.loop||this.playCount===this.loop?this.checkSegments(e>this.totalFrames?e%this.totalFrames:0)||(r=!0,e=this.totalFrames-1):e>=this.totalFrames?(this.playCount+=1,this.checkSegments(e%this.totalFrames)||(this.setCurrentRawFrameValue(e%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(e):e<0?this.checkSegments(e%this.totalFrames)||(this.loop&&!(this.playCount--<=0&&this.loop!==!0)?(this.setCurrentRawFrameValue(this.totalFrames+e%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0):(r=!0,e=0)):this.setCurrentRawFrameValue(e),r&&(this.setCurrentRawFrameValue(e),this.pause(),this.trigger("complete"))}},AnimationItem.prototype.adjustSegment=function(t,e){this.playCount=0,t[1]0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=t[0]-t[1],this.timeCompleted=this.totalFrames,this.firstFrame=t[1],this.setCurrentRawFrameValue(this.totalFrames-.001-e)):t[1]>t[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=t[1]-t[0],this.timeCompleted=this.totalFrames,this.firstFrame=t[0],this.setCurrentRawFrameValue(.001+e)),this.trigger("segmentStart")},AnimationItem.prototype.setSegment=function(t,e){var r=-1;this.isPaused&&(this.currentRawFrame+this.firstFramee&&(r=e-t)),this.firstFrame=t,this.totalFrames=e-t,this.timeCompleted=this.totalFrames,r!==-1&&this.goToAndStop(r,!0)},AnimationItem.prototype.playSegments=function(t,e){if(e&&(this.segments.length=0),_typeof$4(t[0])==="object"){var r,i=t.length;for(r=0;r=0;T-=1)e[T].animation.destroy(_)}function F(_,T,b){var P=[].concat([].slice.call(document.getElementsByClassName("lottie")),[].slice.call(document.getElementsByClassName("bodymovin"))),V,I=P.length;for(V=0;V0?y=F:f=F;while(Math.abs(M)>a&&++L=s?A(f,D,y,C):B===0?D:m(f,M,M+o,y,C)}},t}(),pooling=function(){function t(e){return e.concat(createSizedArray(e.length))}return{double:t}}(),poolFactory=function(){return function(t,e,r){var i=0,s=t,a=createSizedArray(s),n={newElement:l,release:o};function l(){var p;return i?(i-=1,p=a[i]):p=e(),p}function o(p){i===s&&(a=pooling.double(a),s*=2),r&&r(p),a[i]=p,i+=1}return n}}(),bezierLengthPool=function(){function t(){return{addedLength:0,percents:createTypedArray("float32",getDefaultCurveSegments()),lengths:createTypedArray("float32",getDefaultCurveSegments())}}return poolFactory(8,t)}(),segmentsLengthPool=function(){function t(){return{lengths:[],totalLength:0}}function e(r){var i,s=r.lengths.length;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=p.t-r){o.h&&(o=p),s=0;break}if(p.t-r>t){s=a;break}a=u||t=u?y.points.length-1:0;for(c=y.points[C].point.length,E=0;E=F&&k=u)i[0]=f[0],i[1]=f[1],i[2]=f[2];else if(t<=d)i[0]=o.s[0],i[1]=o.s[1],i[2]=o.s[2];else{var z=createQuaternion(o.s),R=createQuaternion(f),_=(t-d)/(u-d);quaternionToEuler(i,slerp(z,R,_))}else for(a=0;a=u?S=1:t1e-6?(c=Math.acos(S),x=Math.sin(c),m=Math.sin((1-r)*c)/x,A=Math.sin(r*c)/x):(m=1-r,A=r),i[0]=m*s+A*o,i[1]=m*a+A*p,i[2]=m*n+A*g,i[3]=m*l+A*E,i}function quaternionToEuler(t,e){var r=e[0],i=e[1],s=e[2],a=e[3],n=Math.atan2(2*i*a-2*r*s,1-2*i*i-2*s*s),l=Math.asin(2*r*i+2*s*a),o=Math.atan2(2*r*a-2*i*s,1-2*r*r-2*s*s);t[0]=n/degToRads,t[1]=l/degToRads,t[2]=o/degToRads}function createQuaternion(t){var e=t[0]*degToRads,r=t[1]*degToRads,i=t[2]*degToRads,s=Math.cos(e/2),a=Math.cos(r/2),n=Math.cos(i/2),l=Math.sin(e/2),o=Math.sin(r/2),p=Math.sin(i/2),g=s*a*n-l*o*p,E=l*o*n+s*a*p,c=l*a*n+s*o*p,S=s*o*n-l*a*p;return[E,c,S,g]}function getValueAtCurrentTime(){var t=this.comp.renderedFrame-this.offsetTime,e=this.keyframes[0].t-this.offsetTime,r=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(t===this._caching.lastFrame||this._caching.lastFrame!==initFrame&&(this._caching.lastFrame>=r&&t>=r||this._caching.lastFrame=t&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var i=this.interpolateValue(t,this._caching);this.pv=i}return this._caching.lastFrame=t,this.pv}function setVValue(t){var e;if(this.propType==="unidimensional")e=t*this.mult,mathAbs(this.v-e)>1e-5&&(this.v=e,this._mdf=!0);else for(var r=0,i=this.v.length;r1e-5&&(this.v[r]=e,this._mdf=!0),r+=1}function processEffectsSequence(){if(!(this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)){if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=this._isFirstFrame;var t,e=this.effectsSequence.length,r=this.kf?this.pv:this.data.k;for(t=0;t=this._maxLength&&this.doubleArrayLength(),r){case"v":a=this.v;break;case"i":a=this.i;break;case"o":a=this.o;break;default:a=[];break}(!a[i]||a[i]&&!s)&&(a[i]=pointPool.newElement()),a[i][0]=t,a[i][1]=e},ShapePath.prototype.setTripleAt=function(t,e,r,i,s,a,n,l){this.setXYAt(t,e,"v",n,l),this.setXYAt(r,i,"o",n,l),this.setXYAt(s,a,"i",n,l)},ShapePath.prototype.reverse=function(){var t=new ShapePath;t.setPathData(this.c,this._length);var e=this.v,r=this.o,i=this.i,s=0;this.c&&(t.setTripleAt(e[0][0],e[0][1],i[0][0],i[0][1],r[0][0],r[0][1],0,!1),s=1);var a=this._length-1,n=this._length,l;for(l=s;l=z[z.length-1].t-this.offsetTime)C=z[z.length-1].s?z[z.length-1].s[0]:z[z.length-2].e[0],M=!0;else{for(var R=y,_=z.length-1,T=!0,b,P,V;T&&(b=z[R],P=z[R+1],!(P.t-this.offsetTime>u));)R<_-1?R+=1:T=!1;if(V=this.keyframesMetadata[R]||{},M=b.h===1,y=R,!M){if(u>=P.t-this.offsetTime)B=1;else if(uf&&u>f)||(this._caching.lastIndex=y1?r[1]=1:r[1]<=0&&(r[1]=0),HSVtoRGB(r[0],r[1],r[2])}function addBrightnessToRGB(e,t){var r=RGBtoHSV(e[0]*255,e[1]*255,e[2]*255);return r[2]+=t,r[2]>1?r[2]=1:r[2]<0&&(r[2]=0),HSVtoRGB(r[0],r[1],r[2])}function addHueToRGB(e,t){var r=RGBtoHSV(e[0]*255,e[1]*255,e[2]*255);return r[0]+=t/360,r[0]>1?r[0]-=1:r[0]<0&&(r[0]+=1),HSVtoRGB(r[0],r[1],r[2])}var rgbToHex=function(){var e=[],t,r;for(t=0;t<256;t+=1)r=t.toString(16),e[t]=r.length===1?"0"+r:r;return function(i,s,n){return i<0&&(i=0),s<0&&(s=0),n<0&&(n=0),"#"+e[i]+e[s]+e[n]}}(),setSubframeEnabled=function(t){subframeEnabled=!!t},getSubframeEnabled=function(){return subframeEnabled},setExpressionsPlugin=function(t){expressionsPlugin=t},getExpressionsPlugin=function(){return expressionsPlugin},setExpressionInterfaces=function(t){expressionsInterfaces=t},getExpressionInterfaces=function(){return expressionsInterfaces},setDefaultCurveSegments=function(t){defaultCurveSegments=t},getDefaultCurveSegments=function(){return defaultCurveSegments},setIdPrefix=function(t){idPrefix$1=t};function createNS(e){return document.createElementNS(svgNS,e)}function _typeof$5(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$5=function(r){return typeof r}:_typeof$5=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_typeof$5(e)}var dataManager=function(){var e=1,t=[],r,i,s={onmessage:function(){},postMessage:function(x){r({data:x})}},n={postMessage:function(x){s.onmessage({data:x})}};function a(f){if(window.Worker&&window.Blob&&getWebWorker()){var x=new Blob(["var _workerSelf = self; self.onmessage = ",f.toString()],{type:"text/javascript"}),A=URL.createObjectURL(x);return new Worker(A)}return r=f,s}function l(){i||(i=a(function(x){function A(){function E(L,P){var _,b,C=L.length,B,F,z,q;for(b=0;b=0;P-=1)if(L[P].ty==="sh")if(L[P].ks.k.i)S(L[P].ks.k);else for(C=L[P].ks.k.length,b=0;b_[0]?!0:_[0]>L[0]?!1:L[1]>_[1]?!0:_[1]>L[1]?!1:L[2]>_[2]?!0:_[2]>L[2]?!1:null}var M=function(){var L=[4,4,14];function P(b){var C=b.t.d;b.t.d={k:[{s:C,t:0}]}}function _(b){var C,B=b.length;for(C=0;C=0;C-=1)if(b[C].ty==="sh")if(b[C].ks.k.i)b[C].ks.k.c=b[C].closed;else for(z=b[C].ks.k.length,F=0;F500)&&(this._imageLoaded(),clearInterval(u)),g+=1}).bind(this),50)}function n(d){var g=i(d,this.assetsPath,this.path),u=createNS("image");isSafari?this.testImageLoaded(u):u.addEventListener("load",this._imageLoaded,!1),u.addEventListener("error",(function(){y.img=e,this._imageLoaded()}).bind(this),!1),u.setAttributeNS("http://www.w3.org/1999/xlink","href",g),this._elementHelper.append?this._elementHelper.append(u):this._elementHelper.appendChild(u);var y={img:u,assetData:d};return y}function a(d){var g=i(d,this.assetsPath,this.path),u=createTag("img");u.crossOrigin="anonymous",u.addEventListener("load",this._imageLoaded,!1),u.addEventListener("error",(function(){y.img=e,this._imageLoaded()}).bind(this),!1),u.src=g;var y={img:u,assetData:d};return y}function l(d){var g={assetData:d},u=i(d,this.assetsPath,this.path);return dataManager.loadData(u,(function(y){g.img=y,this._footageLoaded()}).bind(this),(function(){g.img={},this._footageLoaded()}).bind(this)),g}function o(d,g){this.imagesLoadedCb=g;var u,y=d.length;for(u=0;uthis.animationData.op&&(this.animationData.op=e.op,this.totalFrames=Math.floor(e.op-this.animationData.ip));var t=this.animationData.layers,r,i=t.length,s=e.layers,n,a=s.length;for(n=0;nthis.timeCompleted&&(this.currentFrame=this.timeCompleted),this.trigger("enterFrame"),this.renderFrame(),this.trigger("drawnFrame")},AnimationItem.prototype.renderFrame=function(){if(!(this.isLoaded===!1||!this.renderer))try{this.expressionsPlugin&&this.expressionsPlugin.resetFrame(),this.renderer.renderFrame(this.currentFrame+this.firstFrame)}catch(e){this.triggerRenderFrameError(e)}},AnimationItem.prototype.play=function(e){e&&this.name!==e||this.isPaused===!0&&(this.isPaused=!1,this.trigger("_play"),this.audioController.resume(),this._idle&&(this._idle=!1,this.trigger("_active")))},AnimationItem.prototype.pause=function(e){e&&this.name!==e||this.isPaused===!1&&(this.isPaused=!0,this.trigger("_pause"),this._idle=!0,this.trigger("_idle"),this.audioController.pause())},AnimationItem.prototype.togglePause=function(e){e&&this.name!==e||(this.isPaused===!0?this.play():this.pause())},AnimationItem.prototype.stop=function(e){e&&this.name!==e||(this.pause(),this.playCount=0,this._completedLoop=!1,this.setCurrentRawFrameValue(0))},AnimationItem.prototype.getMarkerData=function(e){for(var t,r=0;r=this.totalFrames-1&&this.frameModifier>0?!this.loop||this.playCount===this.loop?this.checkSegments(t>this.totalFrames?t%this.totalFrames:0)||(r=!0,t=this.totalFrames-1):t>=this.totalFrames?(this.playCount+=1,this.checkSegments(t%this.totalFrames)||(this.setCurrentRawFrameValue(t%this.totalFrames),this._completedLoop=!0,this.trigger("loopComplete"))):this.setCurrentRawFrameValue(t):t<0?this.checkSegments(t%this.totalFrames)||(this.loop&&!(this.playCount--<=0&&this.loop!==!0)?(this.setCurrentRawFrameValue(this.totalFrames+t%this.totalFrames),this._completedLoop?this.trigger("loopComplete"):this._completedLoop=!0):(r=!0,t=0)):this.setCurrentRawFrameValue(t),r&&(this.setCurrentRawFrameValue(t),this.pause(),this.trigger("complete"))}},AnimationItem.prototype.adjustSegment=function(e,t){this.playCount=0,e[1]0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(-1)),this.totalFrames=e[0]-e[1],this.timeCompleted=this.totalFrames,this.firstFrame=e[1],this.setCurrentRawFrameValue(this.totalFrames-.001-t)):e[1]>e[0]&&(this.frameModifier<0&&(this.playSpeed<0?this.setSpeed(-this.playSpeed):this.setDirection(1)),this.totalFrames=e[1]-e[0],this.timeCompleted=this.totalFrames,this.firstFrame=e[0],this.setCurrentRawFrameValue(.001+t)),this.trigger("segmentStart")},AnimationItem.prototype.setSegment=function(e,t){var r=-1;this.isPaused&&(this.currentRawFrame+this.firstFramet&&(r=t-e)),this.firstFrame=e,this.totalFrames=t-e,this.timeCompleted=this.totalFrames,r!==-1&&this.goToAndStop(r,!0)},AnimationItem.prototype.playSegments=function(e,t){if(t&&(this.segments.length=0),_typeof$4(e[0])==="object"){var r,i=e.length;for(r=0;r=0;_-=1)t[_].animation.destroy(P)}function I(P,_,b){var C=[].concat([].slice.call(document.getElementsByClassName("lottie")),[].slice.call(document.getElementsByClassName("bodymovin"))),B,F=C.length;for(B=0;B0?y=I:u=I;while(Math.abs(M)>n&&++R=s?E(u,D,y,S):V===0?D:m(u,M,M+o,y,S)}},e}(),pooling=function(){function e(t){return t.concat(createSizedArray(t.length))}return{double:e}}(),poolFactory=function(){return function(e,t,r){var i=0,s=e,n=createSizedArray(s),a={newElement:l,release:o};function l(){var p;return i?(i-=1,p=n[i]):p=t(),p}function o(p){i===s&&(n=pooling.double(n),s*=2),r&&r(p),n[i]=p,i+=1}return a}}(),bezierLengthPool=function(){function e(){return{addedLength:0,percents:createTypedArray("float32",getDefaultCurveSegments()),lengths:createTypedArray("float32",getDefaultCurveSegments())}}return poolFactory(8,e)}(),segmentsLengthPool=function(){function e(){return{lengths:[],totalLength:0}}function t(r){var i,s=r.lengths.length;for(i=0;i-.001&&g<.001}function r(f,x,A,m,E,d,g,u,y){if(A===0&&d===0&&y===0)return t(f,x,m,E,g,u);var S=e.sqrt(e.pow(m-f,2)+e.pow(E-x,2)+e.pow(d-A,2)),T=e.sqrt(e.pow(g-f,2)+e.pow(u-x,2)+e.pow(y-A,2)),M=e.sqrt(e.pow(g-m,2)+e.pow(u-E,2)+e.pow(y-d,2)),I;return S>T?S>M?I=S-T-M:I=M-T-S:M>T?I=M-T-S:I=T-S-M,I>-1e-4&&I<1e-4}var i=function(){return function(f,x,A,m){var E=getDefaultCurveSegments(),d,g,u,y,S,T=0,M,I=[],R=[],H=bezierLengthPool.newElement();for(u=A.length,d=0;dg?-1:1,S=!0;S;)if(m[d]<=g&&m[d+1]>g?(u=(g-m[d])/(m[d+1]-m[d]),S=!1):d+=y,d<0||d>=E-1){if(d===E-1)return A[d];S=!1}return A[d]+(A[d+1]-A[d])*u}function p(f,x,A,m,E,d){var g=o(E,d),u=1-g,y=e.round((u*u*u*f[0]+(g*u*u+u*g*u+u*u*g)*A[0]+(g*g*u+u*g*g+g*u*g)*m[0]+g*g*g*x[0])*1e3)/1e3,S=e.round((u*u*u*f[1]+(g*u*u+u*g*u+u*u*g)*A[1]+(g*g*u+u*g*g+g*u*g)*m[1]+g*g*g*x[1])*1e3)/1e3;return[y,S]}var c=createTypedArray("float32",8);function k(f,x,A,m,E,d,g){E<0?E=0:E>1&&(E=1);var u=o(E,g);d=d>1?1:d;var y=o(d,g),S,T=f.length,M=1-u,I=1-y,R=M*M*M,H=u*M*M*3,D=u*u*M*3,V=u*u*u,O=M*M*I,G=u*M*I+M*u*I+M*M*y,L=u*u*I+M*u*y+u*M*y,P=u*u*y,_=M*I*I,b=u*I*I+M*y*I+M*I*y,C=u*y*I+M*y*y+u*I*y,B=u*y*y,F=I*I*I,z=y*I*I+I*y*I+I*I*y,q=y*y*I+I*y*y+y*I*y,j=y*y*y;for(S=0;S=p.t-r){o.h&&(o=p),s=0;break}if(p.t-r>e){s=n;break}n=d||e=d?y.points.length-1:0;for(f=y.points[S].point.length,k=0;k=I&&T=d)i[0]=u[0],i[1]=u[1],i[2]=u[2];else if(e<=g)i[0]=o.s[0],i[1]=o.s[1],i[2]=o.s[2];else{var G=createQuaternion(o.s),L=createQuaternion(u),P=(e-g)/(d-g);quaternionToEuler(i,slerp(G,L,P))}else for(n=0;n=d?x=1:e1e-6?(f=Math.acos(x),A=Math.sin(f),m=Math.sin((1-r)*f)/A,E=Math.sin(r*f)/A):(m=1-r,E=r),i[0]=m*s+E*o,i[1]=m*n+E*p,i[2]=m*a+E*c,i[3]=m*l+E*k,i}function quaternionToEuler(e,t){var r=t[0],i=t[1],s=t[2],n=t[3],a=Math.atan2(2*i*n-2*r*s,1-2*i*i-2*s*s),l=Math.asin(2*r*i+2*s*n),o=Math.atan2(2*r*n-2*i*s,1-2*r*r-2*s*s);e[0]=a/degToRads,e[1]=l/degToRads,e[2]=o/degToRads}function createQuaternion(e){var t=e[0]*degToRads,r=e[1]*degToRads,i=e[2]*degToRads,s=Math.cos(t/2),n=Math.cos(r/2),a=Math.cos(i/2),l=Math.sin(t/2),o=Math.sin(r/2),p=Math.sin(i/2),c=s*n*a-l*o*p,k=l*o*a+s*n*p,f=l*n*a+s*o*p,x=s*o*a-l*n*p;return[k,f,x,c]}function getValueAtCurrentTime(){var e=this.comp.renderedFrame-this.offsetTime,t=this.keyframes[0].t-this.offsetTime,r=this.keyframes[this.keyframes.length-1].t-this.offsetTime;if(!(e===this._caching.lastFrame||this._caching.lastFrame!==initFrame&&(this._caching.lastFrame>=r&&e>=r||this._caching.lastFrame=e&&(this._caching._lastKeyframeIndex=-1,this._caching.lastIndex=0);var i=this.interpolateValue(e,this._caching);this.pv=i}return this._caching.lastFrame=e,this.pv}function setVValue(e){var t;if(this.propType==="unidimensional")t=e*this.mult,mathAbs(this.v-t)>1e-5&&(this.v=t,this._mdf=!0);else for(var r=0,i=this.v.length;r1e-5&&(this.v[r]=t,this._mdf=!0),r+=1}function processEffectsSequence(){if(!(this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)){if(this.lock){this.setVValue(this.pv);return}this.lock=!0,this._mdf=this._isFirstFrame;var e,t=this.effectsSequence.length,r=this.kf?this.pv:this.data.k;for(e=0;e=this._maxLength&&this.doubleArrayLength(),r){case"v":n=this.v;break;case"i":n=this.i;break;case"o":n=this.o;break;default:n=[];break}(!n[i]||n[i]&&!s)&&(n[i]=pointPool.newElement()),n[i][0]=e,n[i][1]=t},ShapePath.prototype.setTripleAt=function(e,t,r,i,s,n,a,l){this.setXYAt(e,t,"v",a,l),this.setXYAt(r,i,"o",a,l),this.setXYAt(s,n,"i",a,l)},ShapePath.prototype.reverse=function(){var e=new ShapePath;e.setPathData(this.c,this._length);var t=this.v,r=this.o,i=this.i,s=0;this.c&&(e.setTripleAt(t[0][0],t[0][1],i[0][0],i[0][1],r[0][0],r[0][1],0,!1),s=1);var n=this._length-1,a=this._length,l;for(l=s;l=G[G.length-1].t-this.offsetTime)S=G[G.length-1].s?G[G.length-1].s[0]:G[G.length-2].e[0],M=!0;else{for(var L=y,P=G.length-1,_=!0,b,C,B;_&&(b=G[L],C=G[L+1],!(C.t-this.offsetTime>d));)L=C.t-this.offsetTime)V=1;else if(du&&d>u)||(this._caching.lastIndex=y0||b>-1e-6&&b<0?i(b*P)/P:b}function T(){var b=this.props,P=_(b[0]),V=_(b[1]),I=_(b[4]),G=_(b[5]),q=_(b[12]),j=_(b[13]);return"matrix("+P+","+V+","+I+","+G+","+q+","+j+")"}return function(){this.reset=s,this.rotate=a,this.rotateX=n,this.rotateY=l,this.rotateZ=o,this.skew=g,this.skewFromAxis=E,this.shear=p,this.scale=c,this.setTransform=S,this.translate=x,this.transform=m,this.multiply=A,this.applyToPoint=C,this.applyToX=k,this.applyToY=M,this.applyToZ=F,this.applyToPointArray=O,this.applyToTriplePoints=B,this.applyToPointStringified=z,this.toCSS=R,this.to2dCSS=T,this.clone=f,this.cloneFromProps=y,this.equals=d,this.inversePoints=D,this.inversePoint=N,this.getInverseMatrix=L,this._t=this.transform,this.isIdentity=u,this._identity=!0,this._identityCalculated=!1,this.props=createTypedArray("float32",16),this.reset()}}();function _typeof$3(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$3=function(r){return typeof r}:_typeof$3=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_typeof$3(t)}var lottie={};function setLocation(t){setLocationHref(t)}function searchAnimations(){animationManager.searchAnimations()}function setSubframeRendering(t){setSubframeEnabled(t)}function setPrefix(t){setIdPrefix(t)}function loadAnimation(t){return animationManager.loadAnimation(t)}function setQuality(t){if(typeof t=="string")switch(t){case"high":setDefaultCurveSegments(200);break;default:case"medium":setDefaultCurveSegments(50);break;case"low":setDefaultCurveSegments(10);break}else!isNaN(t)&&t>1&&setDefaultCurveSegments(t)}function inBrowser(){return typeof navigator<"u"}function installPlugin(t,e){t==="expressions"&&setExpressionsPlugin(e)}function getFactory(t){switch(t){case"propertyFactory":return PropertyFactory;case"shapePropertyFactory":return ShapePropertyFactory;case"matrix":return Matrix;default:return null}}lottie.play=animationManager.play,lottie.pause=animationManager.pause,lottie.setLocationHref=setLocation,lottie.togglePause=animationManager.togglePause,lottie.setSpeed=animationManager.setSpeed,lottie.setDirection=animationManager.setDirection,lottie.stop=animationManager.stop,lottie.searchAnimations=searchAnimations,lottie.registerAnimation=animationManager.registerAnimation,lottie.loadAnimation=loadAnimation,lottie.setSubframeRendering=setSubframeRendering,lottie.resize=animationManager.resize,lottie.goToAndStop=animationManager.goToAndStop,lottie.destroy=animationManager.destroy,lottie.setQuality=setQuality,lottie.inBrowser=inBrowser,lottie.installPlugin=installPlugin,lottie.freeze=animationManager.freeze,lottie.unfreeze=animationManager.unfreeze,lottie.setVolume=animationManager.setVolume,lottie.mute=animationManager.mute,lottie.unmute=animationManager.unmute,lottie.getRegisteredAnimations=animationManager.getRegisteredAnimations,lottie.useWebWorker=setWebWorker,lottie.setIDPrefix=setPrefix,lottie.__getFactory=getFactory,lottie.version="5.12.2";function checkReady(){document.readyState==="complete"&&(clearInterval(readyStateCheckInterval),searchAnimations())}function getQueryVariable(t){for(var e=queryString.split("&"),r=0;r=1?a.push({s:t-1,e:e-1}):(a.push({s:t,e:1}),a.push({s:0,e:e-1}));var n=[],l,o=a.length,p;for(l=0;li+r)){var g,E;p.s*s<=i?g=0:g=(p.s*s-i)/r,p.e*s>=i+r?E=1:E=(p.e*s-i)/r,n.push([g,E])}return n.length||n.push([0,0]),n},TrimModifier.prototype.releasePathsData=function(t){var e,r=t.length;for(e=0;e1?e=1+i:this.s.v<0?e=0+i:e=this.s.v+i,this.e.v>1?r=1+i:this.e.v<0?r=0+i:r=this.e.v+i,e>r){var s=e;e=r,r=s}e=Math.round(e*1e4)*1e-4,r=Math.round(r*1e4)*1e-4,this.sValue=e,this.eValue=r}else e=this.sValue,r=this.eValue;var a,n,l=this.shapes.length,o,p,g,E,c,S=0;if(r===e)for(n=0;n=0;n-=1)if(m=this.shapes[n],m.shape._mdf){for(A=m.localShapeCollection,A.releaseShapes(),this.m===2&&l>1?(y=this.calculateShapeEdges(e,r,m.totalShapeLength,f,S),f+=m.totalShapeLength):y=[[u,d]],p=y.length,o=0;o=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=this.p.keyframes[this.p.keyframes.length-1].t?(g=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/p,0),E=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/p,0)):(g=this.p.pv,E=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/p,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){g=[],E=[];var c=this.px,S=this.py;c._caching.lastFrame+c.offsetTime<=c.keyframes[0].t?(g[0]=c.getValueAtTime((c.keyframes[0].t+.01)/p,0),g[1]=S.getValueAtTime((S.keyframes[0].t+.01)/p,0),E[0]=c.getValueAtTime(c.keyframes[0].t/p,0),E[1]=S.getValueAtTime(S.keyframes[0].t/p,0)):c._caching.lastFrame+c.offsetTime>=c.keyframes[c.keyframes.length-1].t?(g[0]=c.getValueAtTime(c.keyframes[c.keyframes.length-1].t/p,0),g[1]=S.getValueAtTime(S.keyframes[S.keyframes.length-1].t/p,0),E[0]=c.getValueAtTime((c.keyframes[c.keyframes.length-1].t-.01)/p,0),E[1]=S.getValueAtTime((S.keyframes[S.keyframes.length-1].t-.01)/p,0)):(g=[c.pv,S.pv],E[0]=c.getValueAtTime((c._caching.lastFrame+c.offsetTime-.01)/p,c.offsetTime),E[1]=S.getValueAtTime((S._caching.lastFrame+S.offsetTime-.01)/p,S.offsetTime))}else E=t,g=E;this.v.rotate(-Math.atan2(g[1]-E[1],g[0]-E[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}}function i(){if(this.appliedTransformations=0,this.pre.reset(),!this.a.effectsSequence.length)this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1;else return;if(!this.s.effectsSequence.length)this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2;else return;if(this.sk)if(!this.sk.effectsSequence.length&&!this.sa.effectsSequence.length)this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3;else return;this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):!this.rz.effectsSequence.length&&!this.ry.effectsSequence.length&&!this.rx.effectsSequence.length&&!this.or.effectsSequence.length&&(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}function s(){}function a(o){this._addDynamicProperty(o),this.elem.addDynamicProperty(o),this._isDirty=!0}function n(o,p,g){if(this.elem=o,this.frameId=-1,this.propType="transform",this.data=p,this.v=new Matrix,this.pre=new Matrix,this.appliedTransformations=0,this.initDynamicPropertyContainer(g||o),p.p&&p.p.s?(this.px=PropertyFactory.getProp(o,p.p.x,0,0,this),this.py=PropertyFactory.getProp(o,p.p.y,0,0,this),p.p.z&&(this.pz=PropertyFactory.getProp(o,p.p.z,0,0,this))):this.p=PropertyFactory.getProp(o,p.p||{k:[0,0,0]},1,0,this),p.rx){if(this.rx=PropertyFactory.getProp(o,p.rx,0,degToRads,this),this.ry=PropertyFactory.getProp(o,p.ry,0,degToRads,this),this.rz=PropertyFactory.getProp(o,p.rz,0,degToRads,this),p.or.k[0].ti){var E,c=p.or.k.length;for(E=0;E0;)r-=1,this._elements.unshift(e[r]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},RepeaterModifier.prototype.resetElements=function(t){var e,r=t.length;for(e=0;e0?Math.floor(c):Math.ceil(c),m=this.pMatrix.props,A=this.rMatrix.props,u=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var d=0;if(c>0){for(;dx;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),d-=1;S&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-S,!0),d-=S)}i=this.data.m===1?0:this._currentCopies-1,s=this.data.m===1?1:-1,a=this._currentCopies;for(var f,y;a;){if(e=this.elemsData[i].it,r=e[e.length-1].transform.mProps.v.props,y=r.length,e[e.length-1].transform.mProps._mdf=!0,e[e.length-1].transform.op._mdf=!0,e[e.length-1].transform.op.v=this._currentCopies===1?this.so.v:this.so.v+(this.eo.v-this.so.v)*(i/(this._currentCopies-1)),d!==0){for((i!==0&&s===1||i!==this._currentCopies-1&&s===-1)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(A[0],A[1],A[2],A[3],A[4],A[5],A[6],A[7],A[8],A[9],A[10],A[11],A[12],A[13],A[14],A[15]),this.matrix.transform(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7],u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15]),this.matrix.transform(m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],m[8],m[9],m[10],m[11],m[12],m[13],m[14],m[15]),f=0;f0&&i<1?[e]:[]:[e-i,e+i].filter(function(s){return s>0&&s<1})},PolynomialBezier.prototype.split=function(t){if(t<=0)return[singlePoint(this.points[0]),this];if(t>=1)return[this,singlePoint(this.points[this.points.length-1])];var e=lerpPoint(this.points[0],this.points[1],t),r=lerpPoint(this.points[1],this.points[2],t),i=lerpPoint(this.points[2],this.points[3],t),s=lerpPoint(e,r,t),a=lerpPoint(r,i,t),n=lerpPoint(s,a,t);return[new PolynomialBezier(this.points[0],e,s,n,!0),new PolynomialBezier(n,a,i,this.points[3],!0)]};function extrema(t,e){var r=t.points[0][e],i=t.points[t.points.length-1][e];if(r>i){var s=i;i=r,r=s}for(var a=quadRoots(3*t.a[e],2*t.b[e],t.c[e]),n=0;n0&&a[n]<1){var l=t.point(a[n])[e];li&&(i=l)}return{min:r,max:i}}PolynomialBezier.prototype.bounds=function(){return{x:extrema(this,0),y:extrema(this,1)}},PolynomialBezier.prototype.boundingBox=function(){var t=this.bounds();return{left:t.x.min,right:t.x.max,top:t.y.min,bottom:t.y.max,width:t.x.max-t.x.min,height:t.y.max-t.y.min,cx:(t.x.max+t.x.min)/2,cy:(t.y.max+t.y.min)/2}};function intersectData(t,e,r){var i=t.boundingBox();return{cx:i.cx,cy:i.cy,width:i.width,height:i.height,bez:t,t:(e+r)/2,t1:e,t2:r}}function splitData(t){var e=t.bez.split(.5);return[intersectData(e[0],t.t1,t.t),intersectData(e[1],t.t,t.t2)]}function boxIntersect(t,e){return Math.abs(t.cx-e.cx)*2=a||t.width<=i&&t.height<=i&&e.width<=i&&e.height<=i){s.push([t.t,e.t]);return}var n=splitData(t),l=splitData(e);intersectsImpl(n[0],l[0],r+1,i,s,a),intersectsImpl(n[0],l[1],r+1,i,s,a),intersectsImpl(n[1],l[0],r+1,i,s,a),intersectsImpl(n[1],l[1],r+1,i,s,a)}}PolynomialBezier.prototype.intersections=function(t,e,r){e===void 0&&(e=2),r===void 0&&(r=7);var i=[];return intersectsImpl(intersectData(this,0,1),intersectData(t,0,1),0,e,i,r),i},PolynomialBezier.shapeSegment=function(t,e){var r=(e+1)%t.length();return new PolynomialBezier(t.v[e],t.o[e],t.i[r],t.v[r],!0)},PolynomialBezier.shapeSegmentInverted=function(t,e){var r=(e+1)%t.length();return new PolynomialBezier(t.v[r],t.i[r],t.o[e],t.v[e],!0)};function crossProduct(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function lineIntersection(t,e,r,i){var s=[t[0],t[1],1],a=[e[0],e[1],1],n=[r[0],r[1],1],l=[i[0],i[1],1],o=crossProduct(crossProduct(s,a),crossProduct(n,l));return floatZero(o[2])?null:[o[0]/o[2],o[1]/o[2]]}function polarOffset(t,e,r){return[t[0]+Math.cos(e)*r,t[1]-Math.sin(e)*r]}function pointDistance(t,e){return Math.hypot(t[0]-e[0],t[1]-e[1])}function pointEqual(t,e){return floatEqual(t[0],e[0])&&floatEqual(t[1],e[1])}function ZigZagModifier(){}extendPrototype([ShapeModifier],ZigZagModifier),ZigZagModifier.prototype.initModifierProperties=function(t,e){this.getValue=this.processKeys,this.amplitude=PropertyFactory.getProp(t,e.s,0,null,this),this.frequency=PropertyFactory.getProp(t,e.r,0,null,this),this.pointsType=PropertyFactory.getProp(t,e.pt,0,null,this),this._isAnimated=this.amplitude.effectsSequence.length!==0||this.frequency.effectsSequence.length!==0||this.pointsType.effectsSequence.length!==0};function setPoint(t,e,r,i,s,a,n){var l=r-Math.PI/2,o=r+Math.PI/2,p=e[0]+Math.cos(r)*i*s,g=e[1]-Math.sin(r)*i*s;t.setTripleAt(p,g,p+Math.cos(l)*a,g-Math.sin(l)*a,p+Math.cos(o)*n,g-Math.sin(o)*n,t.length())}function getPerpendicularVector(t,e){var r=[e[0]-t[0],e[1]-t[1]],i=-Math.PI*.5,s=[Math.cos(i)*r[0]-Math.sin(i)*r[1],Math.sin(i)*r[0]+Math.cos(i)*r[1]];return s}function getProjectingAngle(t,e){var r=e===0?t.length()-1:e-1,i=(e+1)%t.length(),s=t.v[r],a=t.v[i],n=getPerpendicularVector(s,a);return Math.atan2(0,1)-Math.atan2(n[1],n[0])}function zigZagCorner(t,e,r,i,s,a,n){var l=getProjectingAngle(e,r),o=e.v[r%e._length],p=e.v[r===0?e._length-1:r-1],g=e.v[(r+1)%e._length],E=a===2?Math.sqrt(Math.pow(o[0]-p[0],2)+Math.pow(o[1]-p[1],2)):0,c=a===2?Math.sqrt(Math.pow(o[0]-g[0],2)+Math.pow(o[1]-g[1],2)):0;setPoint(t,e.v[r%e._length],l,n,i,c/((s+1)*2),E/((s+1)*2))}function zigZagSegment(t,e,r,i,s,a){for(var n=0;n1&&e.length>1&&(s=getIntersection(t[0],e[e.length-1]),s)?[[t[0].split(s[0])[0]],[e[e.length-1].split(s[1])[1]]]:[r,i]}function pruneIntersections(t){for(var e,r=1;r1&&(e=pruneSegmentIntersection(t[t.length-1],t[0]),t[t.length-1]=e[0],t[0]=e[1]),t}function offsetSegmentSplit(t,e){var r=t.inflectionPoints(),i,s,a,n;if(r.length===0)return[offsetSegment(t,e)];if(r.length===1||floatEqual(r[1],1))return a=t.split(r[0]),i=a[0],s=a[1],[offsetSegment(i,e),offsetSegment(s,e)];a=t.split(r[0]),i=a[0];var l=(r[1]-r[0])/(1-r[0]);return a=a[1].split(l),n=a[0],s=a[1],[offsetSegment(i,e),offsetSegment(n,e),offsetSegment(s,e)]}function OffsetPathModifier(){}extendPrototype([ShapeModifier],OffsetPathModifier),OffsetPathModifier.prototype.initModifierProperties=function(t,e){this.getValue=this.processKeys,this.amount=PropertyFactory.getProp(t,e.a,0,null,this),this.miterLimit=PropertyFactory.getProp(t,e.ml,0,null,this),this.lineJoin=e.lj,this._isAnimated=this.amount.effectsSequence.length!==0},OffsetPathModifier.prototype.processPath=function(t,e,r,i){var s=shapePool.newElement();s.c=t.c;var a=t.length();t.c||(a-=1);var n,l,o,p=[];for(n=0;n=0;n-=1)o=PolynomialBezier.shapeSegmentInverted(t,n),p.push(offsetSegmentSplit(o,e));p=pruneIntersections(p);var g=null,E=null;for(n=0;n0&&(G=!1),G){var W=createTag("style");W.setAttribute("f-forigin",b[P].fOrigin),W.setAttribute("f-origin",b[P].origin),W.setAttribute("f-family",b[P].fFamily),W.type="text/css",W.innerText="@font-face {font-family: "+b[P].fFamily+"; font-style: normal; src: url('"+b[P].fPath+"');}",T.appendChild(W)}}else if(b[P].fOrigin==="g"||b[P].origin===1){for(q=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),j=0;j=55296&&b<=56319){var P=_.charCodeAt(1);P>=56320&&P<=57343&&(T=(b-55296)*1024+P-56320+65536)}return T}function k(_,T){var b=_.toString(16)+T.toString(16);return E.indexOf(b)!==-1}function M(_){return _===o}function F(_){return _===l}function L(_){var T=C(_);return T>=p&&T<=g}function N(_){return L(_.substr(0,2))&&L(_.substr(2,2))}function D(_){return r.indexOf(_)!==-1}function B(_,T){var b=C(_.substr(T,2));if(b!==i)return!1;var P=0;for(T+=2;P<5;){if(b=C(_.substr(T,2)),bn)return!1;P+=1,T+=2}return C(_.substr(T,2))===s}function O(){this.isLoaded=!0}var z=function(){this.fonts=[],this.chars=null,this.typekitLoaded=0,this.isLoaded=!1,this._warned=!1,this.initTime=Date.now(),this.setIsLoadedBinded=this.setIsLoaded.bind(this),this.checkLoadedFontsBinded=this.checkLoadedFonts.bind(this)};z.isModifier=k,z.isZeroWidthJoiner=M,z.isFlagEmoji=N,z.isRegionalCode=L,z.isCombinedCharacter=D,z.isRegionalFlag=B,z.isVariationSelector=F,z.BLACK_FLAG_CODE_POINT=i;var R={addChars:u,addFonts:A,getCharData:d,getFontByName:y,measureText:f,checkLoadedFonts:x,setIsLoaded:O};return z.prototype=R,z}();function SlotManager(t){this.animationData=t}SlotManager.prototype.getProp=function(t){return this.animationData.slots&&this.animationData.slots[t.sid]?Object.assign(t,this.animationData.slots[t.sid].p):t};function slotFactory(t){return new SlotManager(t)}function RenderableElement(){}RenderableElement.prototype={initRenderable:function(){this.isInRange=!1,this.hidden=!1,this.isTransparent=!1,this.renderableComponents=[]},addRenderableComponent:function(e){this.renderableComponents.indexOf(e)===-1&&this.renderableComponents.push(e)},removeRenderableComponent:function(e){this.renderableComponents.indexOf(e)!==-1&&this.renderableComponents.splice(this.renderableComponents.indexOf(e),1)},prepareRenderableFrame:function(e){this.checkLayerLimits(e)},checkTransparency:function(){this.finalTransform.mProp.o.v<=0?!this.isTransparent&&this.globalData.renderConfig.hideOnTransparent&&(this.isTransparent=!0,this.hide()):this.isTransparent&&(this.isTransparent=!1,this.show())},checkLayerLimits:function(e){this.data.ip-this.data.st<=e&&this.data.op-this.data.st>e?this.isInRange!==!0&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):this.isInRange!==!1&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var e,r=this.renderableComponents.length;for(e=0;e.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},AudioElement.prototype.show=function(){},AudioElement.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},AudioElement.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},AudioElement.prototype.resume=function(){this._canPlay=!0},AudioElement.prototype.setRate=function(t){this.audio.rate(t)},AudioElement.prototype.volume=function(t){this._volumeMultiplier=t,this._previousVolume=t*this._volume,this.audio.volume(this._previousVolume)},AudioElement.prototype.getBaseElement=function(){return null},AudioElement.prototype.destroy=function(){},AudioElement.prototype.sourceRectAtTime=function(){},AudioElement.prototype.initExpressions=function(){};function BaseRenderer(){}BaseRenderer.prototype.checkLayers=function(t){var e,r=this.layers.length,i;for(this.completeLayers=!0,e=r-1;e>=0;e-=1)this.elements[e]||(i=this.layers[e],i.ip-i.st<=t-this.layers[e].st&&i.op-i.st>t-this.layers[e].st&&this.buildItem(e)),this.completeLayers=this.elements[e]?this.completeLayers:!1;this.checkPendingElements()},BaseRenderer.prototype.createItem=function(t){switch(t.ty){case 2:return this.createImage(t);case 0:return this.createComp(t);case 1:return this.createSolid(t);case 3:return this.createNull(t);case 4:return this.createShape(t);case 5:return this.createText(t);case 6:return this.createAudio(t);case 13:return this.createCamera(t);case 15:return this.createFootage(t);default:return this.createNull(t)}},BaseRenderer.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},BaseRenderer.prototype.createAudio=function(t){return new AudioElement(t,this.globalData,this)},BaseRenderer.prototype.createFootage=function(t){return new FootageElement(t,this.globalData,this)},BaseRenderer.prototype.buildAllItems=function(){var t,e=this.layers.length;for(t=0;t0&&(this.maskElement.setAttribute("id",c),this.element.maskedElement.setAttribute(d,"url("+getLocationHref()+"#"+c+")"),i.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}MaskElement.prototype.getMaskProperty=function(t){return this.viewData[t].prop},MaskElement.prototype.renderFrame=function(t){var e=this.element.finalTransform.mat,r,i=this.masksProperties.length;for(r=0;r1&&(i+=" C"+e.o[s-1][0]+","+e.o[s-1][1]+" "+e.i[0][0]+","+e.i[0][1]+" "+e.v[0][0]+","+e.v[0][1]),r.lastPath!==i){var n="";r.elem&&(e.c&&(n=t.inv?this.solidPath+i:i),r.elem.setAttribute("d",n)),r.lastPath=i}},MaskElement.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var filtersFactory=function(){var t={};t.createFilter=e,t.createAlphaToLuminanceFilter=r;function e(i,s){var a=createNS("filter");return a.setAttribute("id",i),s!==!0&&(a.setAttribute("filterUnits","objectBoundingBox"),a.setAttribute("x","0%"),a.setAttribute("y","0%"),a.setAttribute("width","100%"),a.setAttribute("height","100%")),a}function r(){var i=createNS("feColorMatrix");return i.setAttribute("type","matrix"),i.setAttribute("color-interpolation-filters","sRGB"),i.setAttribute("values","0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1"),i}return t}(),featureSupport=function(){var t={maskType:!0,svgLumaHidden:!0,offscreenCanvas:typeof OffscreenCanvas<"u"};return(/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(t.maskType=!1),/firefox/i.test(navigator.userAgent)&&(t.svgLumaHidden=!1),t}(),registeredEffects$1={},idPrefix="filter_result_";function SVGEffects(t){var e,r="SourceGraphic",i=t.data.ef?t.data.ef.length:0,s=createElementID(),a=filtersFactory.createFilter(s,!0),n=0;this.filters=[];var l;for(e=0;e=0&&(i=this.shapeModifiers[e].processShapes(this._isFirstFrame),!i);e-=1);}},searchProcessedElement:function(e){for(var r=this.processedElements,i=0,s=r.length;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;t0;)u=c.transformers[L].mProps._mdf||u,F-=1,L-=1;if(u)for(F=C-c.styles[f].lvl,L=c.transformers.length-1;F>0;)M.multiply(c.transformers[L].mProps.v),F-=1,L-=1}else M=t;if(k=c.sh.paths,m=k._length,u){for(A="",x=0;x=1?O=.99:O<=-1&&(O=-.99);var z=D*O,R=Math.cos(B+c.a.v)*z+A[0],_=Math.sin(B+c.a.v)*z+A[1];x.setAttribute("fx",R),x.setAttribute("fy",_),m&&!c.g._collapsable&&(c.of.setAttribute("fx",R),c.of.setAttribute("fy",_))}}}function g(E,c,S){var x=c.style,m=c.d;m&&(m._mdf||S)&&m.dashStr&&(x.pElem.setAttribute("stroke-dasharray",m.dashStr),x.pElem.setAttribute("stroke-dashoffset",m.dashoffset[0])),c.c&&(c.c._mdf||S)&&x.pElem.setAttribute("stroke","rgb("+bmFloor(c.c.v[0])+","+bmFloor(c.c.v[1])+","+bmFloor(c.c.v[2])+")"),(c.o._mdf||S)&&x.pElem.setAttribute("stroke-opacity",c.o.v),(c.w._mdf||S)&&(x.pElem.setAttribute("stroke-width",c.w.v),x.msElem&&x.msElem.setAttribute("stroke-width",c.w.v))}return r}();function SVGShapeElement(t,e,r){this.shapes=[],this.shapesData=t.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(t,e,r),this.prevViewData=[]}extendPrototype([BaseElement,TransformElement,SVGBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableDOMElement],SVGShapeElement),SVGShapeElement.prototype.initSecondaryElement=function(){},SVGShapeElement.prototype.identityMatrix=new Matrix,SVGShapeElement.prototype.buildExpressionInterface=function(){},SVGShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},SVGShapeElement.prototype.filterUniqueShapes=function(){var t,e=this.shapes.length,r,i,s=this.stylesList.length,a,n=[],l=!1;for(i=0;i1&&l&&this.setShapesAsAnimated(n)}},SVGShapeElement.prototype.setShapesAsAnimated=function(t){var e,r=t.length;for(e=0;e=0;o-=1){if(A=this.searchProcessedElement(t[o]),A?e[o]=r[A-1]:t[o]._render=n,t[o].ty==="fl"||t[o].ty==="st"||t[o].ty==="gf"||t[o].ty==="gs"||t[o].ty==="no")A?e[o].style.closed=!1:e[o]=this.createStyleElement(t[o],s),t[o]._render&&e[o].style.pElem.parentNode!==i&&i.appendChild(e[o].style.pElem),c.push(e[o].style);else if(t[o].ty==="gr"){if(!A)e[o]=this.createGroupElement(t[o]);else for(E=e[o].it.length,g=0;g1,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,a=t||this.data.d.k[this.keysIndex].s;for(i=0;ie);)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&&Nm?x:m,x=-2*k,o="",n=!0,c+=1):o=R,e.chars?(f=e.getCharData(R,d.fStyle,e.getFontByName(t.f).fFamily),y=n?0:f.w*t.finalSize/100):y=e.measureText(o,t.f,t.finalSize),R===" "?z+=y+k:(x+=y+k+z,z=0),i.push({l:y,an:y,add:g,n,anIndexes:[],val:o,line:c,animatorJustifyOffset:0}),p==2){if(g+=y,o===""||o===" "||s===a-1){for((o===""||o===" ")&&(g-=y);E<=s;)i[E].an=g,i[E].ind=l,i[E].extra=y,E+=1;l+=1,g=0}}else if(p==3){if(g+=y,o===""||s===a-1){for(o===""&&(g-=y);E<=s;)i[E].an=g,i[E].ind=l,i[E].extra=y,E+=1;g=0,l+=1}}else i[l].ind=l,i[l].extra=0,l+=1;if(t.l=i,m=x>m?x:m,S.push(x),t.sz)t.boxWidth=t.sz[0],t.justifyOffset=0;else switch(t.boxWidth=m,t.j){case 1:t.justifyOffset=-t.boxWidth;break;case 2:t.justifyOffset=-t.boxWidth/2;break;default:t.justifyOffset=0}t.lineWidths=S;var _=r.a,T,b;u=_.length;var P,V,I=[];for(A=0;A0?l=this.ne.v/100:o=-this.ne.v/100,this.xe.v>0?p=1-this.xe.v/100:g=1+this.xe.v/100;var E=BezierFactory.getBezierEasing(l,o,p,g).get,c=0,S=this.finalS,x=this.finalE,m=this.data.sh;if(m===2)x===S?c=n>=x?1:0:c=t(0,e(.5/(x-S)+(n-S)/(x-S),1)),c=E(c);else if(m===3)x===S?c=n>=x?0:1:c=1-t(0,e(.5/(x-S)+(n-S)/(x-S),1)),c=E(c);else if(m===4)x===S?c=0:(c=t(0,e(.5/(x-S)+(n-S)/(x-S),1)),c<.5?c*=2:c=1-2*(c-.5)),c=E(c);else if(m===5){if(x===S)c=0;else{var A=x-S;n=e(t(0,n+.5-S),x-S);var u=-A/2+n,d=A/2;c=Math.sqrt(1-u*u/(d*d))}c=E(c)}else m===6?(x===S?c=0:(n=e(t(0,n+.5-S),x-S),c=(1+Math.cos(Math.PI+Math.PI*2*n/(x-S)))/2),c=E(c)):(n>=r(S)&&(n-S<0?c=t(0,e(e(x,1)-(S-n),1)):c=t(0,e(x-n,1))),c=E(c));if(this.sm.v!==100){var f=this.sm.v*.01;f===0&&(f=1e-8);var y=.5-f*.5;c1&&(c=1))}return c*this.a.v},getValue:function(n){this.iterateDynamicProperties(),this._mdf=n||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,n&&this.data.r===2&&(this.e.v=this._currentTextLength);var l=this.data.r===2?1:100/this.data.totalChars,o=this.o.v/l,p=this.s.v/l+o,g=this.e.v/l+o;if(p>g){var E=p;p=g,g=E}this.finalS=p,this.finalE=g}},extendPrototype([DynamicPropertyContainer],i);function s(a,n,l){return new i(a,n)}return{getTextSelectorProp:s}}();function TextAnimatorDataProperty(t,e,r){var i={propType:!1},s=PropertyFactory.getProp,a=e.a;this.a={r:a.r?s(t,a.r,0,degToRads,r):i,rx:a.rx?s(t,a.rx,0,degToRads,r):i,ry:a.ry?s(t,a.ry,0,degToRads,r):i,sk:a.sk?s(t,a.sk,0,degToRads,r):i,sa:a.sa?s(t,a.sa,0,degToRads,r):i,s:a.s?s(t,a.s,1,.01,r):i,a:a.a?s(t,a.a,1,0,r):i,o:a.o?s(t,a.o,0,.01,r):i,p:a.p?s(t,a.p,1,0,r):i,sw:a.sw?s(t,a.sw,0,0,r):i,sc:a.sc?s(t,a.sc,1,0,r):i,fc:a.fc?s(t,a.fc,1,0,r):i,fh:a.fh?s(t,a.fh,0,0,r):i,fs:a.fs?s(t,a.fs,0,.01,r):i,fb:a.fb?s(t,a.fb,0,.01,r):i,t:a.t?s(t,a.t,0,0,r):i},this.s=TextSelectorProp.getTextSelectorProp(t,e.s,r),this.s.t=e.s.t}function TextAnimatorProperty(t,e,r){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=t,this._renderType=e,this._elem=r,this._animatorsData=createSizedArray(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(r)}TextAnimatorProperty.prototype.searchProperties=function(){var t,e=this._textData.a.length,r,i=PropertyFactory.getProp;for(t=0;t=x+et||!C?(L=(x+et-A)/m.partialLength,j=y.point[0]+(m.point[0]-y.point[0])*L,W=y.point[1]+(m.point[1]-y.point[1])*L,a.translate(-r[0]*c[g].an*.005,-(r[1]*z)*.01),u=!1):C&&(A+=m.partialLength,d+=1,d>=C.length&&(d=0,f+=1,k[f]?C=k[f].points:D.v.c?(d=0,f=0,C=k[f].points):(A-=m.partialLength,C=null)),C&&(y=m,m=C[d],M=m.partialLength));q=c[g].an/2-c[g].add,a.translate(-q,0,0)}else q=c[g].an/2-c[g].add,a.translate(-q,0,0),a.translate(-r[0]*c[g].an*.005,-r[1]*z*.01,0);for(b=0;bt?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=0;e-=1)(this.completeLayers||this.elements[e])&&this.elements[e].prepareFrame(t-this.layers[e].st);if(this.globalData._mdf)for(e=0;e=0;r-=1)(this.completeLayers||this.elements[r])&&(this.elements[r].prepareFrame(this.renderedFrame-this.layers[r].st),this.elements[r]._mdf&&(this._mdf=!0))}},ICompElement.prototype.renderInnerContent=function(){var t,e=this.layers.length;for(t=0;t=0;i-=1)e.finalTransform.multiply(e.transforms[i].transform.mProps.v);e._mdf=a},processSequences:function(e){var r,i=this.sequenceList.length;for(r=0;r=1){this.buffers=[];var e=this.globalData.canvasContext,r=assetLoader.createCanvas(e.canvas.width,e.canvas.height);this.buffers.push(r);var i=assetLoader.createCanvas(e.canvas.width,e.canvas.height);this.buffers.push(i),this.data.tt>=3&&!document._isProxy&&assetLoader.loadLumaCanvas()}this.canvasContext=this.globalData.canvasContext,this.transformCanvas=this.globalData.transformCanvas,this.renderableEffectsManager=new CVEffects(this),this.searchEffectTransforms()},createContent:function(){},setBlendMode:function(){var e=this.globalData;if(e.blendMode!==this.data.bm){e.blendMode=this.data.bm;var r=getBlendMode(this.data.bm);e.canvasContext.globalCompositeOperation=r}},createRenderableComponents:function(){this.maskManager=new CVMaskElement(this.data,this),this.transformEffects=this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT)},hideElement:function(){!this.hidden&&(!this.isInRange||this.isTransparent)&&(this.hidden=!0)},showElement:function(){this.isInRange&&!this.isTransparent&&(this.hidden=!1,this._isFirstFrame=!0,this.maskManager._isFirstFrame=!0)},clearCanvas:function(e){e.clearRect(this.transformCanvas.tx,this.transformCanvas.ty,this.transformCanvas.w*this.transformCanvas.sx,this.transformCanvas.h*this.transformCanvas.sy)},prepareLayer:function(){if(this.data.tt>=1){var e=this.buffers[0],r=e.getContext("2d");this.clearCanvas(r),r.drawImage(this.canvasContext.canvas,0,0),this.currentTransform=this.canvasContext.getTransform(),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform)}},exitLayer:function(){if(this.data.tt>=1){var e=this.buffers[1],r=e.getContext("2d");this.clearCanvas(r),r.drawImage(this.canvasContext.canvas,0,0),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform);var i=this.comp.getElementById("tp"in this.data?this.data.tp:this.data.ind-1);if(i.renderFrame(!0),this.canvasContext.setTransform(1,0,0,1,0,0),this.data.tt>=3&&!document._isProxy){var s=assetLoader.getLumaCanvas(this.canvasContext.canvas),a=s.getContext("2d");a.drawImage(this.canvasContext.canvas,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.drawImage(s,0,0)}this.canvasContext.globalCompositeOperation=operationsMap[this.data.tt],this.canvasContext.drawImage(e,0,0),this.canvasContext.globalCompositeOperation="destination-over",this.canvasContext.drawImage(this.buffers[0],0,0),this.canvasContext.setTransform(this.currentTransform),this.canvasContext.globalCompositeOperation="source-over"}},renderFrame:function(e){if(!(this.hidden||this.data.hd)&&!(this.data.td===1&&!e)){this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.setBlendMode();var r=this.data.ty===0;this.prepareLayer(),this.globalData.renderer.save(r),this.globalData.renderer.ctxTransform(this.finalTransform.localMat.props),this.globalData.renderer.ctxOpacity(this.finalTransform.localOpacity),this.renderInnerContent(),this.globalData.renderer.restore(r),this.exitLayer(),this.maskManager.hasMasks&&this.globalData.renderer.restore(!0),this._isFirstFrame&&(this._isFirstFrame=!1)}},destroy:function(){this.canvasContext=null,this.data=null,this.globalData=null,this.maskManager.destroy()},mHelper:new Matrix},CVBaseElement.prototype.hide=CVBaseElement.prototype.hideElement,CVBaseElement.prototype.show=CVBaseElement.prototype.showElement;function CVShapeData(t,e,r,i){this.styledShapes=[],this.tr=[0,0,0,0,0,0];var s=4;e.ty==="rc"?s=5:e.ty==="el"?s=6:e.ty==="sr"&&(s=7),this.sh=ShapePropertyFactory.getShapeProp(t,e,s,t);var a,n=r.length,l;for(a=0;a=0;a-=1){if(E=this.searchProcessedElement(t[a]),E?e[a]=r[E-1]:t[a]._shouldRender=i,t[a].ty==="fl"||t[a].ty==="st"||t[a].ty==="gf"||t[a].ty==="gs")E?e[a].style.closed=!1:e[a]=this.createStyleElement(t[a],x),p.push(e[a].style);else if(t[a].ty==="gr"){if(!E)e[a]=this.createGroupElement(t[a]);else for(o=e[a].it.length,l=0;l=0;s-=1)e[s].ty==="tr"?(n=r[s].transform,this.renderShapeTransform(t,n)):e[s].ty==="sh"||e[s].ty==="el"||e[s].ty==="rc"||e[s].ty==="sr"?this.renderPath(e[s],r[s]):e[s].ty==="fl"?this.renderFill(e[s],r[s],n):e[s].ty==="st"?this.renderStroke(e[s],r[s],n):e[s].ty==="gf"||e[s].ty==="gs"?this.renderGradientFill(e[s],r[s],n):e[s].ty==="gr"?this.renderShape(n,e[s].it,r[s].it):e[s].ty;i&&this.drawLayer()},CVShapeElement.prototype.renderStyledShape=function(t,e){if(this._isFirstFrame||e._mdf||t.transforms._mdf){var r=t.trNodes,i=e.paths,s,a,n,l=i._length;r.length=0;var o=t.transforms.finalTransform;for(n=0;n=1?g=.99:g<=-1&&(g=-.99);var E=o*g,c=Math.cos(p+e.a.v)*E+n[0],S=Math.sin(p+e.a.v)*E+n[1];s=a.createRadialGradient(c,S,0,n[0],n[1],o)}var x,m=t.g.p,A=e.g.c,u=1;for(x=0;xa&&o==="xMidYMid slice"||ss&&l==="meet"||as&&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;t=0;e-=1)(this.completeLayers||this.elements[e])&&this.elements[e].renderFrame()},CVCompElement.prototype.destroy=function(){var t,e=this.layers.length;for(t=e-1;t>=0;t-=1)this.elements[t]&&this.elements[t].destroy();this.layers=null,this.elements=null},CVCompElement.prototype.createComp=function(t){return new CVCompElement(t,this.globalData,this)};function CanvasRenderer(t,e){this.animationItem=t,this.renderConfig={clearCanvas:e&&e.clearCanvas!==void 0?e.clearCanvas:!0,context:e&&e.context||null,progressiveLoad:e&&e.progressiveLoad||!1,preserveAspectRatio:e&&e.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:e&&e.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:e&&e.contentVisibility||"visible",className:e&&e.className||"",id:e&&e.id||"",runExpressions:!e||e.runExpressions===void 0||e.runExpressions},this.renderConfig.dpr=e&&e.dpr||1,this.animationItem.wrapper&&(this.renderConfig.dpr=e&&e.dpr||window.devicePixelRatio||1),this.renderedFrame=-1,this.globalData={frameNum:-1,_mdf:!1,renderConfig:this.renderConfig,currentGlobalAlpha:-1},this.contextData=new CVContextData,this.elements=[],this.pendingElements=[],this.transformMat=new Matrix,this.completeLayers=!1,this.rendererType="canvas",this.renderConfig.clearCanvas&&(this.ctxTransform=this.contextData.transform.bind(this.contextData),this.ctxOpacity=this.contextData.opacity.bind(this.contextData),this.ctxFillStyle=this.contextData.fillStyle.bind(this.contextData),this.ctxStrokeStyle=this.contextData.strokeStyle.bind(this.contextData),this.ctxLineWidth=this.contextData.lineWidth.bind(this.contextData),this.ctxLineCap=this.contextData.lineCap.bind(this.contextData),this.ctxLineJoin=this.contextData.lineJoin.bind(this.contextData),this.ctxMiterLimit=this.contextData.miterLimit.bind(this.contextData),this.ctxFill=this.contextData.fill.bind(this.contextData),this.ctxFillRect=this.contextData.fillRect.bind(this.contextData),this.ctxStroke=this.contextData.stroke.bind(this.contextData),this.save=this.contextData.save.bind(this.contextData))}extendPrototype([CanvasRendererBase],CanvasRenderer),CanvasRenderer.prototype.createComp=function(t){return new CVCompElement(t,this.globalData,this)};function HBaseElement(){}HBaseElement.prototype={checkBlendMode:function(){},initRendererElement:function(){this.baseElement=createTag(this.data.tg||"div"),this.data.hasMask?(this.svgElement=createNS("svg"),this.layerElement=createNS("g"),this.maskedElement=this.layerElement,this.svgElement.appendChild(this.layerElement),this.baseElement.appendChild(this.svgElement)):this.layerElement=this.baseElement,styleDiv(this.baseElement)},createContainerElements:function(){this.renderableEffectsManager=new CVEffects(this),this.transformedElement=this.baseElement,this.maskedElement=this.layerElement,this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.bm!==0&&this.setBlendMode()},renderElement:function(){var e=this.transformedElement?this.transformedElement.style:{};if(this.finalTransform._matMdf){var r=this.finalTransform.mat.toCSS();e.transform=r,e.webkitTransform=r}this.finalTransform._opMdf&&(e.opacity=this.finalTransform.mProp.o.v)},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},destroy:function(){this.layerElement=null,this.transformedElement=null,this.matteElement&&(this.matteElement=null),this.maskManager&&(this.maskManager.destroy(),this.maskManager=null)},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData)},addEffects:function(){},setMatte:function(){}},HBaseElement.prototype.getBaseElement=SVGBaseElement.prototype.getBaseElement,HBaseElement.prototype.destroyBaseElement=HBaseElement.prototype.destroy,HBaseElement.prototype.buildElementParenting=BaseRenderer.prototype.buildElementParenting;function HSolidElement(t,e,r){this.initElement(t,e,r)}extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],HSolidElement),HSolidElement.prototype.createContent=function(){var t;this.data.hasMask?(t=createNS("rect"),t.setAttribute("width",this.data.sw),t.setAttribute("height",this.data.sh),t.setAttribute("fill",this.data.sc),this.svgElement.setAttribute("width",this.data.sw),this.svgElement.setAttribute("height",this.data.sh)):(t=createTag("div"),t.style.width=this.data.sw+"px",t.style.height=this.data.sh+"px",t.style.backgroundColor=this.data.sc),this.layerElement.appendChild(t)};function HShapeElement(t,e,r){this.shapes=[],this.shapesData=t.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.shapesContainer=createNS("g"),this.initElement(t,e,r),this.prevViewData=[],this.currentBBox={x:999999,y:-999999,h:0,w:0}}extendPrototype([BaseElement,TransformElement,HSolidElement,SVGShapeElement,HBaseElement,HierarchyElement,FrameElement,RenderableElement],HShapeElement),HShapeElement.prototype._renderShapeFrame=HShapeElement.prototype.renderInnerContent,HShapeElement.prototype.createContent=function(){var t;if(this.baseElement.style.fontSize=0,this.data.hasMask)this.layerElement.appendChild(this.shapesContainer),t=this.svgElement;else{t=createNS("svg");var e=this.comp.data?this.comp.data:this.globalData.compSize;t.setAttribute("width",e.w),t.setAttribute("height",e.h),t.appendChild(this.shapesContainer),this.layerElement.appendChild(t)}this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.shapesContainer,0,[],!0),this.filterUniqueShapes(),this.shapeCont=t},HShapeElement.prototype.getTransformedPoint=function(t,e){var r,i=t.length;for(r=0;r0&&o<1&&s[c].push(this.calculateF(o,t,e,r,i,c))):(p=n*n-4*l*a,p>=0&&(g=(-n+bmSqrt(p))/(2*a),g>0&&g<1&&s[c].push(this.calculateF(g,t,e,r,i,c)),E=(-n-bmSqrt(p))/(2*a),E>0&&E<1&&s[c].push(this.calculateF(E,t,e,r,i,c)))));this.shapeBoundingBox.left=bmMin.apply(null,s[0]),this.shapeBoundingBox.top=bmMin.apply(null,s[1]),this.shapeBoundingBox.right=bmMax.apply(null,s[0]),this.shapeBoundingBox.bottom=bmMax.apply(null,s[1])},HShapeElement.prototype.calculateF=function(t,e,r,i,s,a){return bmPow(1-t,3)*e[a]+3*bmPow(1-t,2)*t*r[a]+3*(1-t)*bmPow(t,2)*i[a]+bmPow(t,3)*s[a]},HShapeElement.prototype.calculateBoundingBox=function(t,e){var r,i=t.length;for(r=0;rr&&(r=s)}r*=t.mult}else r=t.v*t.mult;e.x-=r,e.xMax+=r,e.y-=r,e.yMax+=r},HShapeElement.prototype.currentBoxContains=function(t){return this.currentBBox.x<=t.x&&this.currentBBox.y<=t.y&&this.currentBBox.width+this.currentBBox.x>=t.x+t.width&&this.currentBBox.height+this.currentBBox.y>=t.y+t.height},HShapeElement.prototype.renderInnerContent=function(){if(this._renderShapeFrame(),!this.hidden&&(this._isFirstFrame||this._mdf)){var t=this.tempBoundingBox,e=999999;if(t.x=e,t.xMax=-e,t.y=e,t.yMax=-e,this.calculateBoundingBox(this.itemsData,t),t.width=t.xMax=0;e-=1){var i=this.hierarchy[e].finalTransform.mProp;this.mat.translate(-i.p.v[0],-i.p.v[1],i.p.v[2]),this.mat.rotateX(-i.or.v[0]).rotateY(-i.or.v[1]).rotateZ(i.or.v[2]),this.mat.rotateX(-i.rx.v).rotateY(-i.ry.v).rotateZ(i.rz.v),this.mat.scale(1/i.s.v[0],1/i.s.v[1],1/i.s.v[2]),this.mat.translate(i.a.v[0],i.a.v[1],i.a.v[2])}if(this.p?this.mat.translate(-this.p.v[0],-this.p.v[1],this.p.v[2]):this.mat.translate(-this.px.v,-this.py.v,this.pz.v),this.a){var s;this.p?s=[this.p.v[0]-this.a.v[0],this.p.v[1]-this.a.v[1],this.p.v[2]-this.a.v[2]]:s=[this.px.v-this.a.v[0],this.py.v-this.a.v[1],this.pz.v-this.a.v[2]];var a=Math.sqrt(Math.pow(s[0],2)+Math.pow(s[1],2)+Math.pow(s[2],2)),n=[s[0]/a,s[1]/a,s[2]/a],l=Math.sqrt(n[2]*n[2]+n[0]*n[0]),o=Math.atan2(n[1],l),p=Math.atan2(n[0],-n[2]);this.mat.rotateY(p).rotateX(-o)}this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v),this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]),this.mat.translate(this.globalData.compSize.w/2,this.globalData.compSize.h/2,0),this.mat.translate(0,0,this.pe.v);var g=!this._prevMat.equals(this.mat);if((g||this.pe._mdf)&&this.comp.threeDElements){r=this.comp.threeDElements.length;var E,c,S;for(e=0;e=t)return this.threeDElements[e].perspectiveElem;e+=1}return null},HybridRendererBase.prototype.createThreeDContainer=function(t,e){var r=createTag("div"),i,s;styleDiv(r);var a=createTag("div");if(styleDiv(a),e==="3d"){i=r.style,i.width=this.globalData.compSize.w+"px",i.height=this.globalData.compSize.h+"px";var n="50% 50%";i.webkitTransformOrigin=n,i.mozTransformOrigin=n,i.transformOrigin=n,s=a.style;var l="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)";s.transform=l,s.webkitTransform=l}r.appendChild(a);var o={container:a,perspectiveElem:r,startPos:t,endPos:t,type:e};return this.threeDElements.push(o),o},HybridRendererBase.prototype.build3dContainers=function(){var t,e=this.layers.length,r,i="";for(t=0;t=0;t-=1)this.resizerElem.appendChild(this.threeDElements[t].perspectiveElem)},HybridRendererBase.prototype.addTo3dContainer=function(t,e){for(var r=0,i=this.threeDElements.length;rr?(s=t/this.globalData.compSize.w,a=t/this.globalData.compSize.w,n=0,l=(e-this.globalData.compSize.h*(t/this.globalData.compSize.w))/2):(s=e/this.globalData.compSize.h,a=e/this.globalData.compSize.h,n=(t-this.globalData.compSize.w*(e/this.globalData.compSize.h))/2,l=0);var o=this.resizerElem.style;o.webkitTransform="matrix3d("+s+",0,0,0,0,"+a+",0,0,0,0,1,0,"+n+","+l+",0,1)",o.transform=o.webkitTransform},HybridRendererBase.prototype.renderFrame=SVGRenderer.prototype.renderFrame,HybridRendererBase.prototype.hide=function(){this.resizerElem.style.display="none"},HybridRendererBase.prototype.show=function(){this.resizerElem.style.display="block"},HybridRendererBase.prototype.initItems=function(){if(this.buildAllItems(),this.camera)this.camera.setup();else{var t=this.globalData.compSize.w,e=this.globalData.compSize.h,r,i=this.threeDElements.length;for(r=0;r=p;)D/=2,B/=2,O>>>=1;return(D+O)/B};return L.int32=function(){return F.g(4)|0},L.quick=function(){return F.g(4)/4294967296},L.double=L,A(d(F.S),t),(y.pass||C||function(N,D,B,O){return O&&(O.S&&x(O,F),N.state=function(){return x(F,{})}),B?(e[n]=N,D):N})(L,M,"global"in y?y.global:this==e,y.state)}e["seed"+n]=c;function S(f){var y,C=f.length,k=this,M=0,F=k.i=k.j=0,L=k.S=[];for(C||(f=[C++]);Mr){var i=r;r=e,e=i}return Math.min(Math.max(t,e),r)}function radiansToDegrees(t){return t/degToRads}var radians_to_degrees=radiansToDegrees;function degreesToRadians(t){return t*degToRads}var degrees_to_radians=radiansToDegrees,helperLengthArray=[0,0,0,0,0,0];function length(t,e){if(typeof t=="number"||t instanceof Number)return e=e||0,Math.abs(t-e);e||(e=helperLengthArray);var r,i=Math.min(t.length,e.length),s=0;for(r=0;r.5?p/(2-s-a):p/(s+a),s){case e:n=(r-i)/p+(r1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function hslToRgb(t){var e=t[0],r=t[1],i=t[2],s,a,n;if(r===0)s=i,n=i,a=i;else{var l=i<.5?i*(1+r):i+r-i*r,o=2*i-l;s=hue2rgb(o,l,e+1/3),a=hue2rgb(o,l,e),n=hue2rgb(o,l,e-1/3)}return[s,a,n,t[3]]}function linear(t,e,r,i,s){if((i===void 0||s===void 0)&&(i=e,s=r,e=0,r=1),r=r)return s;var n=r===e?0:(t-e)/(r-e);if(!i.length)return i+(s-i)*n;var l,o=i.length,p=createTypedArray("float32",o);for(l=0;l1){for(s=0;s1?e=1:e<0&&(e=0);var n=t(e);if($bm_isInstanceOfArray(s)){var l,o=s.length,p=createTypedArray("float32",o);for(l=0;ldata.k[e].t&&tdata.k[e+1].t-t?(i=e+2,s=data.k[e+1].t):(i=e+1,s=data.k[e].t);break}i===-1&&(i=e+1,s=data.k[e].t)}var a={};return a.index=i,a.time=s/elem.comp.globalData.frameRate,a}function key(t){var e,r,i;if(!data.k.length||typeof data.k[0]=="number")throw new Error("The property has no keyframe at index "+t);t-=1,e={time:data.k[t].t/elem.comp.globalData.frameRate,value:[]};var s=Object.prototype.hasOwnProperty.call(data.k[t],"s")?data.k[t].s:data.k[t-1].e;for(i=s.length,r=0;rA.length-1)&&(S=A.length-1),f=A[A.length-1-S].t,d=u-f);var y,C,k;if(c==="pingpong"){var M=Math.floor((m-f)/d);if(M%2!==0)return this.getValueAtTime((d-(m-f)%d+f)/this.comp.globalData.frameRate,0)}else if(c==="offset"){var F=this.getValueAtTime(f/this.comp.globalData.frameRate,0),L=this.getValueAtTime(u/this.comp.globalData.frameRate,0),N=this.getValueAtTime(((m-f)%d+f)/this.comp.globalData.frameRate,0),D=Math.floor((m-f)/d);if(this.pv.length){for(k=new Array(F.length),C=k.length,y=0;y=u)return this.pv;var d,f;x?(S?d=Math.abs(this.elem.comp.globalData.frameRate*S):d=Math.max(0,this.elem.data.op-u),f=u+d):((!S||S>A.length-1)&&(S=A.length-1),f=A[S].t,d=f-u);var y,C,k;if(c==="pingpong"){var M=Math.floor((u-m)/d);if(M%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),L=this.getValueAtTime(f/this.comp.globalData.frameRate,0),N=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),C=k.length,y=0;y1?(A-m)/(S-1):1,d=0,f=0,y;this.pv.length?y=createTypedArray("float32",this.pv.length):y=0;for(var C;dd){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=p?E=x<0?i:s:E=i+S*Math.pow((l-t)/x,1/r),g[c]=E,c+=1,a+=256/(n-1);return g.join(" ")},SVGProLevelsFilter.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){var e,r=this.filterManager.effectElements;this.feFuncRComposed&&(t||r[3].p._mdf||r[4].p._mdf||r[5].p._mdf||r[6].p._mdf||r[7].p._mdf)&&(e=this.getTableValue(r[3].p.v,r[4].p.v,r[5].p.v,r[6].p.v,r[7].p.v),this.feFuncRComposed.setAttribute("tableValues",e),this.feFuncGComposed.setAttribute("tableValues",e),this.feFuncBComposed.setAttribute("tableValues",e)),this.feFuncR&&(t||r[10].p._mdf||r[11].p._mdf||r[12].p._mdf||r[13].p._mdf||r[14].p._mdf)&&(e=this.getTableValue(r[10].p.v,r[11].p.v,r[12].p.v,r[13].p.v,r[14].p.v),this.feFuncR.setAttribute("tableValues",e)),this.feFuncG&&(t||r[17].p._mdf||r[18].p._mdf||r[19].p._mdf||r[20].p._mdf||r[21].p._mdf)&&(e=this.getTableValue(r[17].p.v,r[18].p.v,r[19].p.v,r[20].p.v,r[21].p.v),this.feFuncG.setAttribute("tableValues",e)),this.feFuncB&&(t||r[24].p._mdf||r[25].p._mdf||r[26].p._mdf||r[27].p._mdf||r[28].p._mdf)&&(e=this.getTableValue(r[24].p.v,r[25].p.v,r[26].p.v,r[27].p.v,r[28].p.v),this.feFuncB.setAttribute("tableValues",e)),this.feFuncA&&(t||r[31].p._mdf||r[32].p._mdf||r[33].p._mdf||r[34].p._mdf||r[35].p._mdf)&&(e=this.getTableValue(r[31].p.v,r[32].p.v,r[33].p.v,r[34].p.v,r[35].p.v),this.feFuncA.setAttribute("tableValues",e))}};function SVGDropShadowEffect(t,e,r,i,s){var a=e.container.globalData.renderConfig.filterSize,n=e.data.fs||a;t.setAttribute("x",n.x||a.x),t.setAttribute("y",n.y||a.y),t.setAttribute("width",n.width||a.width),t.setAttribute("height",n.height||a.height),this.filterManager=e;var l=createNS("feGaussianBlur");l.setAttribute("in","SourceAlpha"),l.setAttribute("result",i+"_drop_shadow_1"),l.setAttribute("stdDeviation","0"),this.feGaussianBlur=l,t.appendChild(l);var o=createNS("feOffset");o.setAttribute("dx","25"),o.setAttribute("dy","0"),o.setAttribute("in",i+"_drop_shadow_1"),o.setAttribute("result",i+"_drop_shadow_2"),this.feOffset=o,t.appendChild(o);var p=createNS("feFlood");p.setAttribute("flood-color","#00ff00"),p.setAttribute("flood-opacity","1"),p.setAttribute("result",i+"_drop_shadow_3"),this.feFlood=p,t.appendChild(p);var g=createNS("feComposite");g.setAttribute("in",i+"_drop_shadow_3"),g.setAttribute("in2",i+"_drop_shadow_2"),g.setAttribute("operator","in"),g.setAttribute("result",i+"_drop_shadow_4"),t.appendChild(g);var E=this.createMergeNode(i,[i+"_drop_shadow_4",s]);t.appendChild(E)}extendPrototype([SVGComposableEffect],SVGDropShadowEffect),SVGDropShadowEffect.prototype.renderFrame=function(t){if(t||this.filterManager._mdf){if((t||this.filterManager.effectElements[4].p._mdf)&&this.feGaussianBlur.setAttribute("stdDeviation",this.filterManager.effectElements[4].p.v/4),t||this.filterManager.effectElements[0].p._mdf){var e=this.filterManager.effectElements[0].p.v;this.feFlood.setAttribute("flood-color",rgbToHex(Math.round(e[0]*255),Math.round(e[1]*255),Math.round(e[2]*255)))}if((t||this.filterManager.effectElements[1].p._mdf)&&this.feFlood.setAttribute("flood-opacity",this.filterManager.effectElements[1].p.v/255),t||this.filterManager.effectElements[2].p._mdf||this.filterManager.effectElements[3].p._mdf){var r=this.filterManager.effectElements[3].p.v,i=(this.filterManager.effectElements[2].p.v-90)*degToRads,s=r*Math.cos(i),a=r*Math.sin(i);this.feOffset.setAttribute("dx",s),this.feOffset.setAttribute("dy",a)}}};var _svgMatteSymbols=[];function SVGMatte3Effect(t,e,r){this.initialized=!1,this.filterManager=e,this.filterElem=t,this.elem=r,r.matteElement=createNS("g"),r.matteElement.appendChild(r.layerElement),r.matteElement.appendChild(r.transformedElement),r.baseElement=r.matteElement}SVGMatte3Effect.prototype.findSymbol=function(t){for(var e=0,r=_svgMatteSymbols.length;e1)&&(t=1),t}function convertToPercentage(t){return Number(t)<=1?`${Number(t)*100}%`:t}function pad2(t){return t.length===1?"0"+t:String(t)}function rgbToRgb(t,e,r){return{r:bound01(t,255)*255,g:bound01(e,255)*255,b:bound01(r,255)*255}}function rgbToHsl(t,e,r){t=bound01(t,255),e=bound01(e,255),r=bound01(r,255);const i=Math.max(t,e,r),s=Math.min(t,e,r);let a=0,n=0;const l=(i+s)/2;if(i===s)n=0,a=0;else{const o=i-s;switch(n=l>.5?o/(2-i-s):o/(i+s),i){case t:a=(e-r)/o+(e1&&(r-=1),r<1/6?t+(e-t)*(6*r):r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function hslToRgb(t,e,r){let i,s,a;if(t=bound01(t,360),e=bound01(e,100),r=bound01(r,100),e===0)s=r,a=r,i=r;else{const n=r<.5?r*(1+e):r+e-r*e,l=2*r-n;i=hue2rgb(l,n,t+1/3),s=hue2rgb(l,n,t),a=hue2rgb(l,n,t-1/3)}return{r:i*255,g:s*255,b:a*255}}function rgbToHsv(t,e,r){t=bound01(t,255),e=bound01(e,255),r=bound01(r,255);const i=Math.max(t,e,r),s=Math.min(t,e,r);let a=0;const n=i,l=i-s,o=i===0?0:l/i;if(i===s)a=0;else{switch(i){case t:a=(e-r)/l+(e>16,g:(t&65280)>>8,b:t&255}}const names={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function inputToRGB(t){let e={r:0,g:0,b:0},r=1,i=null,s=null,a=null,n=!1,l=!1;return typeof t=="string"&&(t=stringInputToObject(t)),typeof t=="object"&&(isValidCSSUnit(t.r)&&isValidCSSUnit(t.g)&&isValidCSSUnit(t.b)?(e=rgbToRgb(t.r,t.g,t.b),n=!0,l=String(t.r).substr(-1)==="%"?"prgb":"rgb"):isValidCSSUnit(t.h)&&isValidCSSUnit(t.s)&&isValidCSSUnit(t.v)?(i=convertToPercentage(t.s),s=convertToPercentage(t.v),e=hsvToRgb(t.h,i,s),n=!0,l="hsv"):isValidCSSUnit(t.h)&&isValidCSSUnit(t.s)&&isValidCSSUnit(t.l)&&(i=convertToPercentage(t.s),a=convertToPercentage(t.l),e=hslToRgb(t.h,i,a),n=!0,l="hsl"),Object.prototype.hasOwnProperty.call(t,"a")&&(r=t.a)),r=boundAlpha(r),{ok:n,format:t.format||l,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:r}}const CSS_INTEGER="[-\\+]?\\d+%?",CSS_NUMBER="[-\\+]?\\d*\\.\\d+%?",CSS_UNIT="(?:"+CSS_NUMBER+")|(?:"+CSS_INTEGER+")",PERMISSIVE_MATCH3="[\\s|\\(]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")\\s*\\)?",PERMISSIVE_MATCH4="[\\s|\\(]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")\\s*\\)?",matchers={CSS_UNIT:new RegExp(CSS_UNIT),rgb:new RegExp("rgb"+PERMISSIVE_MATCH3),rgba:new RegExp("rgba"+PERMISSIVE_MATCH4),hsl:new RegExp("hsl"+PERMISSIVE_MATCH3),hsla:new RegExp("hsla"+PERMISSIVE_MATCH4),hsv:new RegExp("hsv"+PERMISSIVE_MATCH3),hsva:new RegExp("hsva"+PERMISSIVE_MATCH4),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function stringInputToObject(t){if(t=t.trim().toLowerCase(),t.length===0)return!1;let e=!1;if(names[t])t=names[t],e=!0;else if(t==="transparent")return{r:0,g:0,b:0,a:0,format:"name"};let r=matchers.rgb.exec(t);return r?{r:r[1],g:r[2],b:r[3]}:(r=matchers.rgba.exec(t),r?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=matchers.hsl.exec(t),r?{h:r[1],s:r[2],l:r[3]}:(r=matchers.hsla.exec(t),r?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=matchers.hsv.exec(t),r?{h:r[1],s:r[2],v:r[3]}:(r=matchers.hsva.exec(t),r?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=matchers.hex8.exec(t),r?{r:parseIntFromHex(r[1]),g:parseIntFromHex(r[2]),b:parseIntFromHex(r[3]),a:convertHexToDecimal(r[4]),format:e?"name":"hex8"}:(r=matchers.hex6.exec(t),r?{r:parseIntFromHex(r[1]),g:parseIntFromHex(r[2]),b:parseIntFromHex(r[3]),format:e?"name":"hex"}:(r=matchers.hex4.exec(t),r?{r:parseIntFromHex(r[1]+r[1]),g:parseIntFromHex(r[2]+r[2]),b:parseIntFromHex(r[3]+r[3]),a:convertHexToDecimal(r[4]+r[4]),format:e?"name":"hex8"}:(r=matchers.hex3.exec(t),r?{r:parseIntFromHex(r[1]+r[1]),g:parseIntFromHex(r[2]+r[2]),b:parseIntFromHex(r[3]+r[3]),format:e?"name":"hex"}:!1)))))))))}function isValidCSSUnit(t){return!!matchers.CSS_UNIT.exec(String(t))}class TinyColor{constructor(e="",r={}){if(e instanceof TinyColor)return e;typeof e=="number"&&(e=numberInputToObject(e)),this.originalInput=e;const i=inputToRGB(e);this.originalInput=e,this.r=i.r,this.g=i.g,this.b=i.b,this.a=i.a,this.roundA=Math.round(100*this.a)/100,this.format=r.format??i.format,this.gradientType=r.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=i.ok}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}getBrightness(){const e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3}getLuminance(){const e=this.toRgb();let r,i,s;const a=e.r/255,n=e.g/255,l=e.b/255;return a<=.03928?r=a/12.92:r=Math.pow((a+.055)/1.055,2.4),n<=.03928?i=n/12.92:i=Math.pow((n+.055)/1.055,2.4),l<=.03928?s=l/12.92:s=Math.pow((l+.055)/1.055,2.4),.2126*r+.7152*i+.0722*s}getAlpha(){return this.a}setAlpha(e){return this.a=boundAlpha(e),this.roundA=Math.round(100*this.a)/100,this}isMonochrome(){const{s:e}=this.toHsl();return e===0}toHsv(){const e=rgbToHsv(this.r,this.g,this.b);return{h:e.h*360,s:e.s,v:e.v,a:this.a}}toHsvString(){const e=rgbToHsv(this.r,this.g,this.b),r=Math.round(e.h*360),i=Math.round(e.s*100),s=Math.round(e.v*100);return this.a===1?`hsv(${r}, ${i}%, ${s}%)`:`hsva(${r}, ${i}%, ${s}%, ${this.roundA})`}toHsl(){const e=rgbToHsl(this.r,this.g,this.b);return{h:e.h*360,s:e.s,l:e.l,a:this.a}}toHslString(){const e=rgbToHsl(this.r,this.g,this.b),r=Math.round(e.h*360),i=Math.round(e.s*100),s=Math.round(e.l*100);return this.a===1?`hsl(${r}, ${i}%, ${s}%)`:`hsla(${r}, ${i}%, ${s}%, ${this.roundA})`}toHex(e=!1){return rgbToHex(this.r,this.g,this.b,e)}toHexString(e=!1){return"#"+this.toHex(e)}toHex8(e=!1){return rgbaToHex(this.r,this.g,this.b,this.a,e)}toHex8String(e=!1){return"#"+this.toHex8(e)}toHexShortString(e=!1){return this.a===1?this.toHexString(e):this.toHex8String(e)}toRgb(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}}toRgbString(){const e=Math.round(this.r),r=Math.round(this.g),i=Math.round(this.b);return this.a===1?`rgb(${e}, ${r}, ${i})`:`rgba(${e}, ${r}, ${i}, ${this.roundA})`}toPercentageRgb(){const e=r=>`${Math.round(bound01(r,255)*100)}%`;return{r:e(this.r),g:e(this.g),b:e(this.b),a:this.a}}toPercentageRgbString(){const e=r=>Math.round(bound01(r,255)*100);return this.a===1?`rgb(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%)`:`rgba(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%, ${this.roundA})`}toName(){if(this.a===0)return"transparent";if(this.a<1)return!1;const e="#"+rgbToHex(this.r,this.g,this.b,!1);for(const[r,i]of Object.entries(names))if(e===i)return r;return!1}toString(e){const r=!!e;e=e??this.format;let i=!1;const s=this.a<1&&this.a>=0;return!r&&s&&(e.startsWith("hex")||e==="name")?e==="name"&&this.a===0?this.toName():this.toRgbString():(e==="rgb"&&(i=this.toRgbString()),e==="prgb"&&(i=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(i=this.toHexString()),e==="hex3"&&(i=this.toHexString(!0)),e==="hex4"&&(i=this.toHex8String(!0)),e==="hex8"&&(i=this.toHex8String()),e==="name"&&(i=this.toName()),e==="hsl"&&(i=this.toHslString()),e==="hsv"&&(i=this.toHsvString()),i||this.toHexString())}toNumber(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)}clone(){return new TinyColor(this.toString())}lighten(e=10){const r=this.toHsl();return r.l+=e/100,r.l=clamp01(r.l),new TinyColor(r)}brighten(e=10){const r=this.toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(e/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(e/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(e/100)))),new TinyColor(r)}darken(e=10){const r=this.toHsl();return r.l-=e/100,r.l=clamp01(r.l),new TinyColor(r)}tint(e=10){return this.mix("white",e)}shade(e=10){return this.mix("black",e)}desaturate(e=10){const r=this.toHsl();return r.s-=e/100,r.s=clamp01(r.s),new TinyColor(r)}saturate(e=10){const r=this.toHsl();return r.s+=e/100,r.s=clamp01(r.s),new TinyColor(r)}greyscale(){return this.desaturate(100)}spin(e){const r=this.toHsl(),i=(r.h+e)%360;return r.h=i<0?360+i:i,new TinyColor(r)}mix(e,r=50){const i=this.toRgb(),s=new TinyColor(e).toRgb(),a=r/100,n={r:(s.r-i.r)*a+i.r,g:(s.g-i.g)*a+i.g,b:(s.b-i.b)*a+i.b,a:(s.a-i.a)*a+i.a};return new TinyColor(n)}analogous(e=6,r=30){const i=this.toHsl(),s=360/r,a=[this];for(i.h=(i.h-(s*e>>1)+720)%360;--e;)i.h=(i.h+s)%360,a.push(new TinyColor(i));return a}complement(){const e=this.toHsl();return e.h=(e.h+180)%360,new TinyColor(e)}monochromatic(e=6){const r=this.toHsv(),{h:i}=r,{s}=r;let{v:a}=r;const n=[],l=1/e;for(;e--;)n.push(new TinyColor({h:i,s,v:a})),a=(a+l)%1;return n}splitcomplement(){const e=this.toHsl(),{h:r}=e;return[this,new TinyColor({h:(r+72)%360,s:e.s,l:e.l}),new TinyColor({h:(r+216)%360,s:e.s,l:e.l})]}onBackground(e){const r=this.toRgb(),i=new TinyColor(e).toRgb(),s=r.a+i.a*(1-r.a);return new TinyColor({r:(r.r*r.a+i.r*i.a*(1-r.a))/s,g:(r.g*r.a+i.g*i.a*(1-r.a))/s,b:(r.b*r.a+i.b*i.a*(1-r.a))/s,a:s})}triad(){return this.polyad(3)}tetrad(){return this.polyad(4)}polyad(e){const r=this.toHsl(),{h:i}=r,s=[this],a=360/e;for(let n=1;n{this.isProcessing=s;const a=document.querySelector("#tarka-chat .input-container");a.style.display=s?"none":"flex";const n=document.querySelector("#tarka-chat .chat-loader");n.style.display=s?"block":"none"},i=async()=>{const s=document.querySelector("#tarka-chat .chat-input"),a=s.value;if(!this.isProcessing&&a.length>0){r(!0),s.value="",this.insertMessage(a,!1);const n=await t(a);this.insertMessage(n,!0),r(!1),s.focus()}};if(e){e.innerHTML=layout,this.setupLaucher(),loadLottie(document.querySelector("#tarka-chat .logo")),document.querySelector("#tarka-chat .title").textContent=this.title,this.insertMessage(this.greeting,!0);const s=document.querySelector("#tarka-chat .send-btn"),a=document.querySelector("#tarka-chat .chat-input");s.addEventListener("click",i),a.addEventListener("keyup",async function(n){n.keyCode===13&&await i()})}else console.error(`Element with ID "${this.selectorId}" not found.`)},setupLaucher:function(){document.querySelector("#tarka-chat .launcher").addEventListener("click",()=>this.toggle());const e=document.querySelector("#tarka-chat .closed");loadLottie(e)},insertMessage(t="",e=!1){const r=document.querySelector("#tarka-chat .message-container"),i=document.createElement("div");i.className="message "+(e?"incoming":"outgoing"),i.innerHTML=`
${t}
-
${e?this.botName:"You"}
- `,r.appendChild(i),r.lastElementChild.scrollIntoView()},setCssVars:function(t="#F0DAFB"){const e=new TinyColor(t).toHsl(),r={primary:e.h,primaryOffset:e.h-10,primaryOffsetHover:e.h+10},i=document.querySelector(":root");i.style.setProperty("--primary-background",`hsla(${r.primaryOffset}, 80%, 99%, 1)`),i.style.setProperty("--primary-primary",`hsla(${r.primary}, 100%, 35%, 1)`),i.style.setProperty("--primary-primary-subtle",`hsla(${r.primaryOffset}, 80%, 92%, 1)`),i.style.setProperty("--primary-primary-subtle-hover",`hsla(${r.primaryOffsetHover}, 80%, 89%, 1)`),i.style.setProperty("--primary-primary-alt",`hsla(${r.primary}, 38%, 21%, 1)`),i.style.setProperty("--primary-primary-alt-subtle",`hsla(${r.primaryOffset}, 23%, 91%, 1)`),i.style.setProperty("--gradient-background",`linear-gradient(0deg, hsla(${r.primary}, 100%, 35%, 0.05) 0%, hsla(${r.primary}, 0%, 0%, 0) 100%)`),i.style.setProperty("--gradient-gradient-fade",`linear-gradient(-0deg, hsla(${r.primaryOffset}, 80%, 99%, 0) 0%, hsla(${r.primaryOffset}, 80%, 99%, 1) 50%)`)},renderPreChat:function(t){const e=document.querySelector("#tarka-chat > .t-container > .body"),r=document.querySelector("#tarka-chat > .t-container > .scroll-fade"),i=document.querySelector("#tarka-chat > .t-container > .body > .message-container"),s=document.querySelector("#tarka-chat > .t-container > .footer");r.style.display="none",i.style.display="none",s.style.display="none";const n=t(()=>{var l;(l=e.querySelector(".tc-injected-prechat"))==null||l.remove(),r.style.display="block",i.style.display="flex",s.style.display="flex"});n.className+=" tc-injected-prechat",e.appendChild(n)}};return main}); + */var Matrix=function(){var e=Math.cos,t=Math.sin,r=Math.tan,i=Math.round;function s(){return this.props[0]=1,this.props[1]=0,this.props[2]=0,this.props[3]=0,this.props[4]=0,this.props[5]=1,this.props[6]=0,this.props[7]=0,this.props[8]=0,this.props[9]=0,this.props[10]=1,this.props[11]=0,this.props[12]=0,this.props[13]=0,this.props[14]=0,this.props[15]=1,this}function n(b){if(b===0)return this;var C=e(b),B=t(b);return this._t(C,-B,0,0,B,C,0,0,0,0,1,0,0,0,0,1)}function a(b){if(b===0)return this;var C=e(b),B=t(b);return this._t(1,0,0,0,0,C,-B,0,0,B,C,0,0,0,0,1)}function l(b){if(b===0)return this;var C=e(b),B=t(b);return this._t(C,0,B,0,0,1,0,0,-B,0,C,0,0,0,0,1)}function o(b){if(b===0)return this;var C=e(b),B=t(b);return this._t(C,-B,0,0,B,C,0,0,0,0,1,0,0,0,0,1)}function p(b,C){return this._t(1,C,b,1,0,0)}function c(b,C){return this.shear(r(b),r(C))}function k(b,C){var B=e(C),F=t(C);return this._t(B,F,0,0,-F,B,0,0,0,0,1,0,0,0,0,1)._t(1,0,0,0,r(b),1,0,0,0,0,1,0,0,0,0,1)._t(B,-F,0,0,F,B,0,0,0,0,1,0,0,0,0,1)}function f(b,C,B){return!B&&B!==0&&(B=1),b===1&&C===1&&B===1?this:this._t(b,0,0,0,0,C,0,0,0,0,B,0,0,0,0,1)}function x(b,C,B,F,z,q,j,$,W,Z,ee,ae,te,U,ie,Q){return this.props[0]=b,this.props[1]=C,this.props[2]=B,this.props[3]=F,this.props[4]=z,this.props[5]=q,this.props[6]=j,this.props[7]=$,this.props[8]=W,this.props[9]=Z,this.props[10]=ee,this.props[11]=ae,this.props[12]=te,this.props[13]=U,this.props[14]=ie,this.props[15]=Q,this}function A(b,C,B){return B=B||0,b!==0||C!==0||B!==0?this._t(1,0,0,0,0,1,0,0,0,0,1,0,b,C,B,1):this}function m(b,C,B,F,z,q,j,$,W,Z,ee,ae,te,U,ie,Q){var N=this.props;if(b===1&&C===0&&B===0&&F===0&&z===0&&q===1&&j===0&&$===0&&W===0&&Z===0&&ee===1&&ae===0)return N[12]=N[12]*b+N[15]*te,N[13]=N[13]*q+N[15]*U,N[14]=N[14]*ee+N[15]*ie,N[15]*=Q,this._identityCalculated=!1,this;var le=N[0],ce=N[1],he=N[2],oe=N[3],fe=N[4],pe=N[5],re=N[6],ue=N[7],de=N[8],se=N[9],me=N[10],ne=N[11],ge=N[12],ve=N[13],ye=N[14],Ae=N[15];return N[0]=le*b+ce*z+he*W+oe*te,N[1]=le*C+ce*q+he*Z+oe*U,N[2]=le*B+ce*j+he*ee+oe*ie,N[3]=le*F+ce*$+he*ae+oe*Q,N[4]=fe*b+pe*z+re*W+ue*te,N[5]=fe*C+pe*q+re*Z+ue*U,N[6]=fe*B+pe*j+re*ee+ue*ie,N[7]=fe*F+pe*$+re*ae+ue*Q,N[8]=de*b+se*z+me*W+ne*te,N[9]=de*C+se*q+me*Z+ne*U,N[10]=de*B+se*j+me*ee+ne*ie,N[11]=de*F+se*$+me*ae+ne*Q,N[12]=ge*b+ve*z+ye*W+Ae*te,N[13]=ge*C+ve*q+ye*Z+Ae*U,N[14]=ge*B+ve*j+ye*ee+Ae*ie,N[15]=ge*F+ve*$+ye*ae+Ae*Q,this._identityCalculated=!1,this}function E(b){var C=b.props;return this.transform(C[0],C[1],C[2],C[3],C[4],C[5],C[6],C[7],C[8],C[9],C[10],C[11],C[12],C[13],C[14],C[15])}function d(){return this._identityCalculated||(this._identity=!(this.props[0]!==1||this.props[1]!==0||this.props[2]!==0||this.props[3]!==0||this.props[4]!==0||this.props[5]!==1||this.props[6]!==0||this.props[7]!==0||this.props[8]!==0||this.props[9]!==0||this.props[10]!==1||this.props[11]!==0||this.props[12]!==0||this.props[13]!==0||this.props[14]!==0||this.props[15]!==1),this._identityCalculated=!0),this._identity}function g(b){for(var C=0;C<16;){if(b.props[C]!==this.props[C])return!1;C+=1}return!0}function u(b){var C;for(C=0;C<16;C+=1)b.props[C]=this.props[C];return b}function y(b){var C;for(C=0;C<16;C+=1)this.props[C]=b[C]}function S(b,C,B){return{x:b*this.props[0]+C*this.props[4]+B*this.props[8]+this.props[12],y:b*this.props[1]+C*this.props[5]+B*this.props[9]+this.props[13],z:b*this.props[2]+C*this.props[6]+B*this.props[10]+this.props[14]}}function T(b,C,B){return b*this.props[0]+C*this.props[4]+B*this.props[8]+this.props[12]}function M(b,C,B){return b*this.props[1]+C*this.props[5]+B*this.props[9]+this.props[13]}function I(b,C,B){return b*this.props[2]+C*this.props[6]+B*this.props[10]+this.props[14]}function R(){var b=this.props[0]*this.props[5]-this.props[1]*this.props[4],C=this.props[5]/b,B=-this.props[1]/b,F=-this.props[4]/b,z=this.props[0]/b,q=(this.props[4]*this.props[13]-this.props[5]*this.props[12])/b,j=-(this.props[0]*this.props[13]-this.props[1]*this.props[12])/b,$=new Matrix;return $.props[0]=C,$.props[1]=B,$.props[4]=F,$.props[5]=z,$.props[12]=q,$.props[13]=j,$}function H(b){var C=this.getInverseMatrix();return C.applyToPointArray(b[0],b[1],b[2]||0)}function D(b){var C,B=b.length,F=[];for(C=0;C0||b>-1e-6&&b<0?i(b*C)/C:b}function _(){var b=this.props,C=P(b[0]),B=P(b[1]),F=P(b[4]),z=P(b[5]),q=P(b[12]),j=P(b[13]);return"matrix("+C+","+B+","+F+","+z+","+q+","+j+")"}return function(){this.reset=s,this.rotate=n,this.rotateX=a,this.rotateY=l,this.rotateZ=o,this.skew=c,this.skewFromAxis=k,this.shear=p,this.scale=f,this.setTransform=x,this.translate=A,this.transform=m,this.multiply=E,this.applyToPoint=S,this.applyToX=T,this.applyToY=M,this.applyToZ=I,this.applyToPointArray=O,this.applyToTriplePoints=V,this.applyToPointStringified=G,this.toCSS=L,this.to2dCSS=_,this.clone=u,this.cloneFromProps=y,this.equals=g,this.inversePoints=D,this.inversePoint=H,this.getInverseMatrix=R,this._t=this.transform,this.isIdentity=d,this._identity=!0,this._identityCalculated=!1,this.props=createTypedArray("float32",16),this.reset()}}();function _typeof$3(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_typeof$3=function(r){return typeof r}:_typeof$3=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_typeof$3(e)}var lottie={};function setLocation(e){setLocationHref(e)}function searchAnimations(){animationManager.searchAnimations()}function setSubframeRendering(e){setSubframeEnabled(e)}function setPrefix(e){setIdPrefix(e)}function loadAnimation(e){return animationManager.loadAnimation(e)}function setQuality(e){if(typeof e=="string")switch(e){case"high":setDefaultCurveSegments(200);break;default:case"medium":setDefaultCurveSegments(50);break;case"low":setDefaultCurveSegments(10);break}else!isNaN(e)&&e>1&&setDefaultCurveSegments(e)}function inBrowser(){return typeof navigator<"u"}function installPlugin(e,t){e==="expressions"&&setExpressionsPlugin(t)}function getFactory(e){switch(e){case"propertyFactory":return PropertyFactory;case"shapePropertyFactory":return ShapePropertyFactory;case"matrix":return Matrix;default:return null}}lottie.play=animationManager.play,lottie.pause=animationManager.pause,lottie.setLocationHref=setLocation,lottie.togglePause=animationManager.togglePause,lottie.setSpeed=animationManager.setSpeed,lottie.setDirection=animationManager.setDirection,lottie.stop=animationManager.stop,lottie.searchAnimations=searchAnimations,lottie.registerAnimation=animationManager.registerAnimation,lottie.loadAnimation=loadAnimation,lottie.setSubframeRendering=setSubframeRendering,lottie.resize=animationManager.resize,lottie.goToAndStop=animationManager.goToAndStop,lottie.destroy=animationManager.destroy,lottie.setQuality=setQuality,lottie.inBrowser=inBrowser,lottie.installPlugin=installPlugin,lottie.freeze=animationManager.freeze,lottie.unfreeze=animationManager.unfreeze,lottie.setVolume=animationManager.setVolume,lottie.mute=animationManager.mute,lottie.unmute=animationManager.unmute,lottie.getRegisteredAnimations=animationManager.getRegisteredAnimations,lottie.useWebWorker=setWebWorker,lottie.setIDPrefix=setPrefix,lottie.__getFactory=getFactory,lottie.version="5.12.2";function checkReady(){document.readyState==="complete"&&(clearInterval(readyStateCheckInterval),searchAnimations())}function getQueryVariable(e){for(var t=queryString.split("&"),r=0;r=1?n.push({s:e-1,e:t-1}):(n.push({s:e,e:1}),n.push({s:0,e:t-1}));var a=[],l,o=n.length,p;for(l=0;li+r)){var c,k;p.s*s<=i?c=0:c=(p.s*s-i)/r,p.e*s>=i+r?k=1:k=(p.e*s-i)/r,a.push([c,k])}return a.length||a.push([0,0]),a},TrimModifier.prototype.releasePathsData=function(e){var t,r=e.length;for(t=0;t1?t=1+i:this.s.v<0?t=0+i:t=this.s.v+i,this.e.v>1?r=1+i:this.e.v<0?r=0+i:r=this.e.v+i,t>r){var s=t;t=r,r=s}t=Math.round(t*1e4)*1e-4,r=Math.round(r*1e4)*1e-4,this.sValue=t,this.eValue=r}else t=this.sValue,r=this.eValue;var n,a,l=this.shapes.length,o,p,c,k,f,x=0;if(r===t)for(a=0;a=0;a-=1)if(m=this.shapes[a],m.shape._mdf){for(E=m.localShapeCollection,E.releaseShapes(),this.m===2&&l>1?(y=this.calculateShapeEdges(t,r,m.totalShapeLength,u,x),u+=m.totalShapeLength):y=[[d,g]],p=y.length,o=0;o=1?A.push({s:m.totalShapeLength*(d-1),e:m.totalShapeLength*(g-1)}):(A.push({s:m.totalShapeLength*d,e:m.totalShapeLength}),A.push({s:0,e:m.totalShapeLength*(g-1)}));var S=this.addShapes(m,A[0]);if(A[0].s!==A[0].e){if(A.length>1){var T=m.shape.paths.shapes[m.shape.paths._length-1];if(T.c){var M=S.pop();this.addPaths(S,E),S=this.addShapes(m,A[1],M)}else this.addPaths(S,E),S=this.addShapes(m,A[1])}this.addPaths(S,E)}}m.shape.paths=E}}},TrimModifier.prototype.addPaths=function(e,t){var r,i=e.length;for(r=0;rt.e){r.c=!1;break}else t.s<=p&&t.e>=p+c.addedLength?(this.addSegment(s[n].v[l-1],s[n].o[l-1],s[n].i[l],s[n].v[l],r,k,E),E=!1):(x=bez.getNewSegment(s[n].v[l-1],s[n].v[l],s[n].o[l-1],s[n].i[l],(t.s-p)/c.addedLength,(t.e-p)/c.addedLength,f[l-1]),this.addSegmentFromArray(x,r,k,E),E=!1,r.c=!1),p+=c.addedLength,k+=1;if(s[n].c&&f.length){if(c=f[l-1],p<=t.e){var d=f[l-1].addedLength;t.s<=p&&t.e>=p+d?(this.addSegment(s[n].v[l-1],s[n].o[l-1],s[n].i[0],s[n].v[0],r,k,E),E=!1):(x=bez.getNewSegment(s[n].v[l-1],s[n].v[0],s[n].o[l-1],s[n].i[0],(t.s-p)/d,(t.e-p)/d,f[l-1]),this.addSegmentFromArray(x,r,k,E),E=!1,r.c=!1)}else r.c=!1;p+=c.addedLength,k+=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>t.e)break;n=this.p.keyframes[this.p.keyframes.length-1].t?(c=this.p.getValueAtTime(this.p.keyframes[this.p.keyframes.length-1].t/p,0),k=this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length-1].t-.05)/p,0)):(c=this.p.pv,k=this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime-.01)/p,this.p.offsetTime));else if(this.px&&this.px.keyframes&&this.py.keyframes&&this.px.getValueAtTime&&this.py.getValueAtTime){c=[],k=[];var f=this.px,x=this.py;f._caching.lastFrame+f.offsetTime<=f.keyframes[0].t?(c[0]=f.getValueAtTime((f.keyframes[0].t+.01)/p,0),c[1]=x.getValueAtTime((x.keyframes[0].t+.01)/p,0),k[0]=f.getValueAtTime(f.keyframes[0].t/p,0),k[1]=x.getValueAtTime(x.keyframes[0].t/p,0)):f._caching.lastFrame+f.offsetTime>=f.keyframes[f.keyframes.length-1].t?(c[0]=f.getValueAtTime(f.keyframes[f.keyframes.length-1].t/p,0),c[1]=x.getValueAtTime(x.keyframes[x.keyframes.length-1].t/p,0),k[0]=f.getValueAtTime((f.keyframes[f.keyframes.length-1].t-.01)/p,0),k[1]=x.getValueAtTime((x.keyframes[x.keyframes.length-1].t-.01)/p,0)):(c=[f.pv,x.pv],k[0]=f.getValueAtTime((f._caching.lastFrame+f.offsetTime-.01)/p,f.offsetTime),k[1]=x.getValueAtTime((x._caching.lastFrame+x.offsetTime-.01)/p,x.offsetTime))}else k=e,c=k;this.v.rotate(-Math.atan2(c[1]-k[1],c[0]-k[0]))}this.data.p&&this.data.p.s?this.data.p.z?this.v.translate(this.px.v,this.py.v,-this.pz.v):this.v.translate(this.px.v,this.py.v,0):this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2])}this.frameId=this.elem.globalData.frameId}}function i(){if(this.appliedTransformations=0,this.pre.reset(),!this.a.effectsSequence.length)this.pre.translate(-this.a.v[0],-this.a.v[1],this.a.v[2]),this.appliedTransformations=1;else return;if(!this.s.effectsSequence.length)this.pre.scale(this.s.v[0],this.s.v[1],this.s.v[2]),this.appliedTransformations=2;else return;if(this.sk)if(!this.sk.effectsSequence.length&&!this.sa.effectsSequence.length)this.pre.skewFromAxis(-this.sk.v,this.sa.v),this.appliedTransformations=3;else return;this.r?this.r.effectsSequence.length||(this.pre.rotate(-this.r.v),this.appliedTransformations=4):!this.rz.effectsSequence.length&&!this.ry.effectsSequence.length&&!this.rx.effectsSequence.length&&!this.or.effectsSequence.length&&(this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]),this.appliedTransformations=4)}function s(){}function n(o){this._addDynamicProperty(o),this.elem.addDynamicProperty(o),this._isDirty=!0}function a(o,p,c){if(this.elem=o,this.frameId=-1,this.propType="transform",this.data=p,this.v=new Matrix,this.pre=new Matrix,this.appliedTransformations=0,this.initDynamicPropertyContainer(c||o),p.p&&p.p.s?(this.px=PropertyFactory.getProp(o,p.p.x,0,0,this),this.py=PropertyFactory.getProp(o,p.p.y,0,0,this),p.p.z&&(this.pz=PropertyFactory.getProp(o,p.p.z,0,0,this))):this.p=PropertyFactory.getProp(o,p.p||{k:[0,0,0]},1,0,this),p.rx){if(this.rx=PropertyFactory.getProp(o,p.rx,0,degToRads,this),this.ry=PropertyFactory.getProp(o,p.ry,0,degToRads,this),this.rz=PropertyFactory.getProp(o,p.rz,0,degToRads,this),p.or.k[0].ti){var k,f=p.or.k.length;for(k=0;k0;)r-=1,this._elements.unshift(t[r]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},RepeaterModifier.prototype.resetElements=function(e){var t,r=e.length;for(t=0;t0?Math.floor(f):Math.ceil(f),m=this.pMatrix.props,E=this.rMatrix.props,d=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var g=0;if(f>0){for(;gA;)this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!0),g-=1;x&&(this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,-x,!0),g-=x)}i=this.data.m===1?0:this._currentCopies-1,s=this.data.m===1?1:-1,n=this._currentCopies;for(var u,y;n;){if(t=this.elemsData[i].it,r=t[t.length-1].transform.mProps.v.props,y=r.length,t[t.length-1].transform.mProps._mdf=!0,t[t.length-1].transform.op._mdf=!0,t[t.length-1].transform.op.v=this._currentCopies===1?this.so.v:this.so.v+(this.eo.v-this.so.v)*(i/(this._currentCopies-1)),g!==0){for((i!==0&&s===1||i!==this._currentCopies-1&&s===-1)&&this.applyTransforms(this.pMatrix,this.rMatrix,this.sMatrix,this.tr,1,!1),this.matrix.transform(E[0],E[1],E[2],E[3],E[4],E[5],E[6],E[7],E[8],E[9],E[10],E[11],E[12],E[13],E[14],E[15]),this.matrix.transform(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],d[9],d[10],d[11],d[12],d[13],d[14],d[15]),this.matrix.transform(m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],m[8],m[9],m[10],m[11],m[12],m[13],m[14],m[15]),u=0;u0&&i<1?[t]:[]:[t-i,t+i].filter(function(s){return s>0&&s<1})},PolynomialBezier.prototype.split=function(e){if(e<=0)return[singlePoint(this.points[0]),this];if(e>=1)return[this,singlePoint(this.points[this.points.length-1])];var t=lerpPoint(this.points[0],this.points[1],e),r=lerpPoint(this.points[1],this.points[2],e),i=lerpPoint(this.points[2],this.points[3],e),s=lerpPoint(t,r,e),n=lerpPoint(r,i,e),a=lerpPoint(s,n,e);return[new PolynomialBezier(this.points[0],t,s,a,!0),new PolynomialBezier(a,n,i,this.points[3],!0)]};function extrema(e,t){var r=e.points[0][t],i=e.points[e.points.length-1][t];if(r>i){var s=i;i=r,r=s}for(var n=quadRoots(3*e.a[t],2*e.b[t],e.c[t]),a=0;a0&&n[a]<1){var l=e.point(n[a])[t];li&&(i=l)}return{min:r,max:i}}PolynomialBezier.prototype.bounds=function(){return{x:extrema(this,0),y:extrema(this,1)}},PolynomialBezier.prototype.boundingBox=function(){var e=this.bounds();return{left:e.x.min,right:e.x.max,top:e.y.min,bottom:e.y.max,width:e.x.max-e.x.min,height:e.y.max-e.y.min,cx:(e.x.max+e.x.min)/2,cy:(e.y.max+e.y.min)/2}};function intersectData(e,t,r){var i=e.boundingBox();return{cx:i.cx,cy:i.cy,width:i.width,height:i.height,bez:e,t:(t+r)/2,t1:t,t2:r}}function splitData(e){var t=e.bez.split(.5);return[intersectData(t[0],e.t1,e.t),intersectData(t[1],e.t,e.t2)]}function boxIntersect(e,t){return Math.abs(e.cx-t.cx)*2=n||e.width<=i&&e.height<=i&&t.width<=i&&t.height<=i){s.push([e.t,t.t]);return}var a=splitData(e),l=splitData(t);intersectsImpl(a[0],l[0],r+1,i,s,n),intersectsImpl(a[0],l[1],r+1,i,s,n),intersectsImpl(a[1],l[0],r+1,i,s,n),intersectsImpl(a[1],l[1],r+1,i,s,n)}}PolynomialBezier.prototype.intersections=function(e,t,r){t===void 0&&(t=2),r===void 0&&(r=7);var i=[];return intersectsImpl(intersectData(this,0,1),intersectData(e,0,1),0,t,i,r),i},PolynomialBezier.shapeSegment=function(e,t){var r=(t+1)%e.length();return new PolynomialBezier(e.v[t],e.o[t],e.i[r],e.v[r],!0)},PolynomialBezier.shapeSegmentInverted=function(e,t){var r=(t+1)%e.length();return new PolynomialBezier(e.v[r],e.i[r],e.o[t],e.v[t],!0)};function crossProduct(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function lineIntersection(e,t,r,i){var s=[e[0],e[1],1],n=[t[0],t[1],1],a=[r[0],r[1],1],l=[i[0],i[1],1],o=crossProduct(crossProduct(s,n),crossProduct(a,l));return floatZero(o[2])?null:[o[0]/o[2],o[1]/o[2]]}function polarOffset(e,t,r){return[e[0]+Math.cos(t)*r,e[1]-Math.sin(t)*r]}function pointDistance(e,t){return Math.hypot(e[0]-t[0],e[1]-t[1])}function pointEqual(e,t){return floatEqual(e[0],t[0])&&floatEqual(e[1],t[1])}function ZigZagModifier(){}extendPrototype([ShapeModifier],ZigZagModifier),ZigZagModifier.prototype.initModifierProperties=function(e,t){this.getValue=this.processKeys,this.amplitude=PropertyFactory.getProp(e,t.s,0,null,this),this.frequency=PropertyFactory.getProp(e,t.r,0,null,this),this.pointsType=PropertyFactory.getProp(e,t.pt,0,null,this),this._isAnimated=this.amplitude.effectsSequence.length!==0||this.frequency.effectsSequence.length!==0||this.pointsType.effectsSequence.length!==0};function setPoint(e,t,r,i,s,n,a){var l=r-Math.PI/2,o=r+Math.PI/2,p=t[0]+Math.cos(r)*i*s,c=t[1]-Math.sin(r)*i*s;e.setTripleAt(p,c,p+Math.cos(l)*n,c-Math.sin(l)*n,p+Math.cos(o)*a,c-Math.sin(o)*a,e.length())}function getPerpendicularVector(e,t){var r=[t[0]-e[0],t[1]-e[1]],i=-Math.PI*.5,s=[Math.cos(i)*r[0]-Math.sin(i)*r[1],Math.sin(i)*r[0]+Math.cos(i)*r[1]];return s}function getProjectingAngle(e,t){var r=t===0?e.length()-1:t-1,i=(t+1)%e.length(),s=e.v[r],n=e.v[i],a=getPerpendicularVector(s,n);return Math.atan2(0,1)-Math.atan2(a[1],a[0])}function zigZagCorner(e,t,r,i,s,n,a){var l=getProjectingAngle(t,r),o=t.v[r%t._length],p=t.v[r===0?t._length-1:r-1],c=t.v[(r+1)%t._length],k=n===2?Math.sqrt(Math.pow(o[0]-p[0],2)+Math.pow(o[1]-p[1],2)):0,f=n===2?Math.sqrt(Math.pow(o[0]-c[0],2)+Math.pow(o[1]-c[1],2)):0;setPoint(e,t.v[r%t._length],l,a,i,f/((s+1)*2),k/((s+1)*2))}function zigZagSegment(e,t,r,i,s,n){for(var a=0;a1&&t.length>1&&(s=getIntersection(e[0],t[t.length-1]),s)?[[e[0].split(s[0])[0]],[t[t.length-1].split(s[1])[1]]]:[r,i]}function pruneIntersections(e){for(var t,r=1;r1&&(t=pruneSegmentIntersection(e[e.length-1],e[0]),e[e.length-1]=t[0],e[0]=t[1]),e}function offsetSegmentSplit(e,t){var r=e.inflectionPoints(),i,s,n,a;if(r.length===0)return[offsetSegment(e,t)];if(r.length===1||floatEqual(r[1],1))return n=e.split(r[0]),i=n[0],s=n[1],[offsetSegment(i,t),offsetSegment(s,t)];n=e.split(r[0]),i=n[0];var l=(r[1]-r[0])/(1-r[0]);return n=n[1].split(l),a=n[0],s=n[1],[offsetSegment(i,t),offsetSegment(a,t),offsetSegment(s,t)]}function OffsetPathModifier(){}extendPrototype([ShapeModifier],OffsetPathModifier),OffsetPathModifier.prototype.initModifierProperties=function(e,t){this.getValue=this.processKeys,this.amount=PropertyFactory.getProp(e,t.a,0,null,this),this.miterLimit=PropertyFactory.getProp(e,t.ml,0,null,this),this.lineJoin=t.lj,this._isAnimated=this.amount.effectsSequence.length!==0},OffsetPathModifier.prototype.processPath=function(e,t,r,i){var s=shapePool.newElement();s.c=e.c;var n=e.length();e.c||(n-=1);var a,l,o,p=[];for(a=0;a=0;a-=1)o=PolynomialBezier.shapeSegmentInverted(e,a),p.push(offsetSegmentSplit(o,t));p=pruneIntersections(p);var c=null,k=null;for(a=0;a0&&(z=!1),z){var $=createTag("style");$.setAttribute("f-forigin",b[C].fOrigin),$.setAttribute("f-origin",b[C].origin),$.setAttribute("f-family",b[C].fFamily),$.type="text/css",$.innerText="@font-face {font-family: "+b[C].fFamily+"; font-style: normal; src: url('"+b[C].fPath+"');}",_.appendChild($)}}else if(b[C].fOrigin==="g"||b[C].origin===1){for(q=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),j=0;j=55296&&b<=56319){var C=P.charCodeAt(1);C>=56320&&C<=57343&&(_=(b-55296)*1024+C-56320+65536)}return _}function T(P,_){var b=P.toString(16)+_.toString(16);return k.indexOf(b)!==-1}function M(P){return P===o}function I(P){return P===l}function R(P){var _=S(P);return _>=p&&_<=c}function H(P){return R(P.substr(0,2))&&R(P.substr(2,2))}function D(P){return r.indexOf(P)!==-1}function V(P,_){var b=S(P.substr(_,2));if(b!==i)return!1;var C=0;for(_+=2;C<5;){if(b=S(P.substr(_,2)),ba)return!1;C+=1,_+=2}return S(P.substr(_,2))===s}function O(){this.isLoaded=!0}var G=function(){this.fonts=[],this.chars=null,this.typekitLoaded=0,this.isLoaded=!1,this._warned=!1,this.initTime=Date.now(),this.setIsLoadedBinded=this.setIsLoaded.bind(this),this.checkLoadedFontsBinded=this.checkLoadedFonts.bind(this)};G.isModifier=T,G.isZeroWidthJoiner=M,G.isFlagEmoji=H,G.isRegionalCode=R,G.isCombinedCharacter=D,G.isRegionalFlag=V,G.isVariationSelector=I,G.BLACK_FLAG_CODE_POINT=i;var L={addChars:d,addFonts:E,getCharData:g,getFontByName:y,measureText:u,checkLoadedFonts:A,setIsLoaded:O};return G.prototype=L,G}();function SlotManager(e){this.animationData=e}SlotManager.prototype.getProp=function(e){return this.animationData.slots&&this.animationData.slots[e.sid]?Object.assign(e,this.animationData.slots[e.sid].p):e};function slotFactory(e){return new SlotManager(e)}function RenderableElement(){}RenderableElement.prototype={initRenderable:function(){this.isInRange=!1,this.hidden=!1,this.isTransparent=!1,this.renderableComponents=[]},addRenderableComponent:function(t){this.renderableComponents.indexOf(t)===-1&&this.renderableComponents.push(t)},removeRenderableComponent:function(t){this.renderableComponents.indexOf(t)!==-1&&this.renderableComponents.splice(this.renderableComponents.indexOf(t),1)},prepareRenderableFrame:function(t){this.checkLayerLimits(t)},checkTransparency:function(){this.finalTransform.mProp.o.v<=0?!this.isTransparent&&this.globalData.renderConfig.hideOnTransparent&&(this.isTransparent=!0,this.hide()):this.isTransparent&&(this.isTransparent=!1,this.show())},checkLayerLimits:function(t){this.data.ip-this.data.st<=t&&this.data.op-this.data.st>t?this.isInRange!==!0&&(this.globalData._mdf=!0,this._mdf=!0,this.isInRange=!0,this.show()):this.isInRange!==!1&&(this.globalData._mdf=!0,this.isInRange=!1,this.hide())},renderRenderable:function(){var t,r=this.renderableComponents.length;for(t=0;t.1)&&this.audio.seek(this._currentTime/this.globalData.frameRate):(this.audio.play(),this.audio.seek(this._currentTime/this.globalData.frameRate),this._isPlaying=!0))},AudioElement.prototype.show=function(){},AudioElement.prototype.hide=function(){this.audio.pause(),this._isPlaying=!1},AudioElement.prototype.pause=function(){this.audio.pause(),this._isPlaying=!1,this._canPlay=!1},AudioElement.prototype.resume=function(){this._canPlay=!0},AudioElement.prototype.setRate=function(e){this.audio.rate(e)},AudioElement.prototype.volume=function(e){this._volumeMultiplier=e,this._previousVolume=e*this._volume,this.audio.volume(this._previousVolume)},AudioElement.prototype.getBaseElement=function(){return null},AudioElement.prototype.destroy=function(){},AudioElement.prototype.sourceRectAtTime=function(){},AudioElement.prototype.initExpressions=function(){};function BaseRenderer(){}BaseRenderer.prototype.checkLayers=function(e){var t,r=this.layers.length,i;for(this.completeLayers=!0,t=r-1;t>=0;t-=1)this.elements[t]||(i=this.layers[t],i.ip-i.st<=e-this.layers[t].st&&i.op-i.st>e-this.layers[t].st&&this.buildItem(t)),this.completeLayers=this.elements[t]?this.completeLayers:!1;this.checkPendingElements()},BaseRenderer.prototype.createItem=function(e){switch(e.ty){case 2:return this.createImage(e);case 0:return this.createComp(e);case 1:return this.createSolid(e);case 3:return this.createNull(e);case 4:return this.createShape(e);case 5:return this.createText(e);case 6:return this.createAudio(e);case 13:return this.createCamera(e);case 15:return this.createFootage(e);default:return this.createNull(e)}},BaseRenderer.prototype.createCamera=function(){throw new Error("You're using a 3d camera. Try the html renderer.")},BaseRenderer.prototype.createAudio=function(e){return new AudioElement(e,this.globalData,this)},BaseRenderer.prototype.createFootage=function(e){return new FootageElement(e,this.globalData,this)},BaseRenderer.prototype.buildAllItems=function(){var e,t=this.layers.length;for(e=0;e0&&(this.maskElement.setAttribute("id",f),this.element.maskedElement.setAttribute(g,"url("+getLocationHref()+"#"+f+")"),i.appendChild(this.maskElement)),this.viewData.length&&this.element.addRenderableComponent(this)}MaskElement.prototype.getMaskProperty=function(e){return this.viewData[e].prop},MaskElement.prototype.renderFrame=function(e){var t=this.element.finalTransform.mat,r,i=this.masksProperties.length;for(r=0;r1&&(i+=" C"+t.o[s-1][0]+","+t.o[s-1][1]+" "+t.i[0][0]+","+t.i[0][1]+" "+t.v[0][0]+","+t.v[0][1]),r.lastPath!==i){var a="";r.elem&&(t.c&&(a=e.inv?this.solidPath+i:i),r.elem.setAttribute("d",a)),r.lastPath=i}},MaskElement.prototype.destroy=function(){this.element=null,this.globalData=null,this.maskElement=null,this.data=null,this.masksProperties=null};var filtersFactory=function(){var e={};e.createFilter=t,e.createAlphaToLuminanceFilter=r;function t(i,s){var n=createNS("filter");return n.setAttribute("id",i),s!==!0&&(n.setAttribute("filterUnits","objectBoundingBox"),n.setAttribute("x","0%"),n.setAttribute("y","0%"),n.setAttribute("width","100%"),n.setAttribute("height","100%")),n}function r(){var i=createNS("feColorMatrix");return i.setAttribute("type","matrix"),i.setAttribute("color-interpolation-filters","sRGB"),i.setAttribute("values","0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1"),i}return e}(),featureSupport=function(){var e={maskType:!0,svgLumaHidden:!0,offscreenCanvas:typeof OffscreenCanvas<"u"};return(/MSIE 10/i.test(navigator.userAgent)||/MSIE 9/i.test(navigator.userAgent)||/rv:11.0/i.test(navigator.userAgent)||/Edge\/\d./i.test(navigator.userAgent))&&(e.maskType=!1),/firefox/i.test(navigator.userAgent)&&(e.svgLumaHidden=!1),e}(),registeredEffects$1={},idPrefix="filter_result_";function SVGEffects(e){var t,r="SourceGraphic",i=e.data.ef?e.data.ef.length:0,s=createElementID(),n=filtersFactory.createFilter(s,!0),a=0;this.filters=[];var l;for(t=0;t=0&&(i=this.shapeModifiers[t].processShapes(this._isFirstFrame),!i);t-=1);}},searchProcessedElement:function(t){for(var r=this.processedElements,i=0,s=r.length;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 e=0,t=this.data.k.k.length;e0;)d=f.transformers[R].mProps._mdf||d,I-=1,R-=1;if(d)for(I=S-f.styles[u].lvl,R=f.transformers.length-1;I>0;)M.multiply(f.transformers[R].mProps.v),I-=1,R-=1}else M=e;if(T=f.sh.paths,m=T._length,d){for(E="",A=0;A=1?O=.99:O<=-1&&(O=-.99);var G=D*O,L=Math.cos(V+f.a.v)*G+E[0],P=Math.sin(V+f.a.v)*G+E[1];A.setAttribute("fx",L),A.setAttribute("fy",P),m&&!f.g._collapsable&&(f.of.setAttribute("fx",L),f.of.setAttribute("fy",P))}}}function c(k,f,x){var A=f.style,m=f.d;m&&(m._mdf||x)&&m.dashStr&&(A.pElem.setAttribute("stroke-dasharray",m.dashStr),A.pElem.setAttribute("stroke-dashoffset",m.dashoffset[0])),f.c&&(f.c._mdf||x)&&A.pElem.setAttribute("stroke","rgb("+bmFloor(f.c.v[0])+","+bmFloor(f.c.v[1])+","+bmFloor(f.c.v[2])+")"),(f.o._mdf||x)&&A.pElem.setAttribute("stroke-opacity",f.o.v),(f.w._mdf||x)&&(A.pElem.setAttribute("stroke-width",f.w.v),A.msElem&&A.msElem.setAttribute("stroke-width",f.w.v))}return r}();function SVGShapeElement(e,t,r){this.shapes=[],this.shapesData=e.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.initElement(e,t,r),this.prevViewData=[]}extendPrototype([BaseElement,TransformElement,SVGBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableDOMElement],SVGShapeElement),SVGShapeElement.prototype.initSecondaryElement=function(){},SVGShapeElement.prototype.identityMatrix=new Matrix,SVGShapeElement.prototype.buildExpressionInterface=function(){},SVGShapeElement.prototype.createContent=function(){this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement,0,[],!0),this.filterUniqueShapes()},SVGShapeElement.prototype.filterUniqueShapes=function(){var e,t=this.shapes.length,r,i,s=this.stylesList.length,n,a=[],l=!1;for(i=0;i1&&l&&this.setShapesAsAnimated(a)}},SVGShapeElement.prototype.setShapesAsAnimated=function(e){var t,r=e.length;for(t=0;t=0;o-=1){if(E=this.searchProcessedElement(e[o]),E?t[o]=r[E-1]:e[o]._render=a,e[o].ty==="fl"||e[o].ty==="st"||e[o].ty==="gf"||e[o].ty==="gs"||e[o].ty==="no")E?t[o].style.closed=!1:t[o]=this.createStyleElement(e[o],s),e[o]._render&&t[o].style.pElem.parentNode!==i&&i.appendChild(t[o].style.pElem),f.push(t[o].style);else if(e[o].ty==="gr"){if(!E)t[o]=this.createGroupElement(e[o]);else for(k=t[o].it.length,c=0;c1,this.kf&&this.addEffect(this.getKeyframeValue.bind(this)),this.kf},TextProperty.prototype.addEffect=function(e){this.effectsSequence.push(e),this.elem.addDynamicProperty(this)},TextProperty.prototype.getValue=function(e){if(!((this.elem.globalData.frameId===this.frameId||!this.effectsSequence.length)&&!e)){this.currentData.t=this.data.d.k[this.keysIndex].s.t;var t=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=e||this.data.d.k[this.keysIndex].s;for(i=0;it);)r+=1;return this.keysIndex!==r&&(this.keysIndex=r),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(e){for(var t=[],r=0,i=e.length,s,n,a=!1,l=!1,o="";r=55296&&s<=56319?FontManager.isRegionalFlag(e,r)?o=e.substr(r,14):(n=e.charCodeAt(r+1),n>=56320&&n<=57343&&(FontManager.isModifier(s,n)?(o=e.substr(r,2),a=!0):FontManager.isFlagEmoji(e.substr(r,4))?o=e.substr(r,4):o=e.substr(r,2))):s>56319?(n=e.charCodeAt(r+1),FontManager.isVariationSelector(s)&&(a=!0)):FontManager.isZeroWidthJoiner(s)&&(a=!0,l=!0),a?(t[t.length-1]+=o,a=!1):t.push(o),r+=o.length;return t},TextProperty.prototype.completeTextData=function(e){e.__complete=!0;var t=this.elem.globalData.fontManager,r=this.data,i=[],s,n,a,l=0,o,p=r.m.g,c=0,k=0,f=0,x=[],A=0,m=0,E,d,g=t.getFontByName(e.f),u,y=0,S=getFontProperties(g);e.fWeight=S.weight,e.fStyle=S.style,e.finalSize=e.s,e.finalText=this.buildFinalText(e.t),n=e.finalText.length,e.finalLineHeight=e.lh;var T=e.tr/1e3*e.finalSize,M;if(e.sz)for(var I=!0,R=e.sz[0],H=e.sz[1],D,V;I;){V=this.buildFinalText(e.t),D=0,A=0,n=V.length,T=e.tr/1e3*e.finalSize;var O=-1;for(s=0;sR&&V[s]!==" "?(O===-1?n+=1:s=O,D+=e.finalLineHeight||e.finalSize*1.2,V.splice(s,O===s?1:0,"\r"),O=-1,A=0):(A+=y,A+=T);D+=g.ascent*e.finalSize/100,this.canResize&&e.finalSize>this.minimumFontSize&&Hm?A:m,A=-2*T,o="",a=!0,f+=1):o=L,t.chars?(u=t.getCharData(L,g.fStyle,t.getFontByName(e.f).fFamily),y=a?0:u.w*e.finalSize/100):y=t.measureText(o,e.f,e.finalSize),L===" "?G+=y+T:(A+=y+T+G,G=0),i.push({l:y,an:y,add:c,n:a,anIndexes:[],val:o,line:f,animatorJustifyOffset:0}),p==2){if(c+=y,o===""||o===" "||s===n-1){for((o===""||o===" ")&&(c-=y);k<=s;)i[k].an=c,i[k].ind=l,i[k].extra=y,k+=1;l+=1,c=0}}else if(p==3){if(c+=y,o===""||s===n-1){for(o===""&&(c-=y);k<=s;)i[k].an=c,i[k].ind=l,i[k].extra=y,k+=1;c=0,l+=1}}else i[l].ind=l,i[l].extra=0,l+=1;if(e.l=i,m=A>m?A:m,x.push(A),e.sz)e.boxWidth=e.sz[0],e.justifyOffset=0;else switch(e.boxWidth=m,e.j){case 1:e.justifyOffset=-e.boxWidth;break;case 2:e.justifyOffset=-e.boxWidth/2;break;default:e.justifyOffset=0}e.lineWidths=x;var P=r.a,_,b;d=P.length;var C,B,F=[];for(E=0;E0?l=this.ne.v/100:o=-this.ne.v/100,this.xe.v>0?p=1-this.xe.v/100:c=1+this.xe.v/100;var k=BezierFactory.getBezierEasing(l,o,p,c).get,f=0,x=this.finalS,A=this.finalE,m=this.data.sh;if(m===2)A===x?f=a>=A?1:0:f=e(0,t(.5/(A-x)+(a-x)/(A-x),1)),f=k(f);else if(m===3)A===x?f=a>=A?0:1:f=1-e(0,t(.5/(A-x)+(a-x)/(A-x),1)),f=k(f);else if(m===4)A===x?f=0:(f=e(0,t(.5/(A-x)+(a-x)/(A-x),1)),f<.5?f*=2:f=1-2*(f-.5)),f=k(f);else if(m===5){if(A===x)f=0;else{var E=A-x;a=t(e(0,a+.5-x),A-x);var d=-E/2+a,g=E/2;f=Math.sqrt(1-d*d/(g*g))}f=k(f)}else m===6?(A===x?f=0:(a=t(e(0,a+.5-x),A-x),f=(1+Math.cos(Math.PI+Math.PI*2*a/(A-x)))/2),f=k(f)):(a>=r(x)&&(a-x<0?f=e(0,t(t(A,1)-(x-a),1)):f=e(0,t(A-a,1))),f=k(f));if(this.sm.v!==100){var u=this.sm.v*.01;u===0&&(u=1e-8);var y=.5-u*.5;f1&&(f=1))}return f*this.a.v},getValue:function(a){this.iterateDynamicProperties(),this._mdf=a||this._mdf,this._currentTextLength=this.elem.textProperty.currentData.l.length||0,a&&this.data.r===2&&(this.e.v=this._currentTextLength);var l=this.data.r===2?1:100/this.data.totalChars,o=this.o.v/l,p=this.s.v/l+o,c=this.e.v/l+o;if(p>c){var k=p;p=c,c=k}this.finalS=p,this.finalE=c}},extendPrototype([DynamicPropertyContainer],i);function s(n,a,l){return new i(n,a)}return{getTextSelectorProp:s}}();function TextAnimatorDataProperty(e,t,r){var i={propType:!1},s=PropertyFactory.getProp,n=t.a;this.a={r:n.r?s(e,n.r,0,degToRads,r):i,rx:n.rx?s(e,n.rx,0,degToRads,r):i,ry:n.ry?s(e,n.ry,0,degToRads,r):i,sk:n.sk?s(e,n.sk,0,degToRads,r):i,sa:n.sa?s(e,n.sa,0,degToRads,r):i,s:n.s?s(e,n.s,1,.01,r):i,a:n.a?s(e,n.a,1,0,r):i,o:n.o?s(e,n.o,0,.01,r):i,p:n.p?s(e,n.p,1,0,r):i,sw:n.sw?s(e,n.sw,0,0,r):i,sc:n.sc?s(e,n.sc,1,0,r):i,fc:n.fc?s(e,n.fc,1,0,r):i,fh:n.fh?s(e,n.fh,0,0,r):i,fs:n.fs?s(e,n.fs,0,.01,r):i,fb:n.fb?s(e,n.fb,0,.01,r):i,t:n.t?s(e,n.t,0,0,r):i},this.s=TextSelectorProp.getTextSelectorProp(e,t.s,r),this.s.t=t.s.t}function TextAnimatorProperty(e,t,r){this._isFirstFrame=!0,this._hasMaskedPath=!1,this._frameId=-1,this._textData=e,this._renderType=t,this._elem=r,this._animatorsData=createSizedArray(this._textData.a.length),this._pathData={},this._moreOptions={alignment:{}},this.renderedLetters=[],this.lettersChangedFlag=!1,this.initDynamicPropertyContainer(r)}TextAnimatorProperty.prototype.searchProperties=function(){var e,t=this._textData.a.length,r,i=PropertyFactory.getProp;for(e=0;e=A+ne||!S?(R=(A+ne-E)/m.partialLength,j=y.point[0]+(m.point[0]-y.point[0])*R,$=y.point[1]+(m.point[1]-y.point[1])*R,n.translate(-r[0]*f[c].an*.005,-(r[1]*G)*.01),d=!1):S&&(E+=m.partialLength,g+=1,g>=S.length&&(g=0,u+=1,T[u]?S=T[u].points:D.v.c?(g=0,u=0,S=T[u].points):(E-=m.partialLength,S=null)),S&&(y=m,m=S[g],M=m.partialLength));q=f[c].an/2-f[c].add,n.translate(-q,0,0)}else q=f[c].an/2-f[c].add,n.translate(-q,0,0),n.translate(-r[0]*f[c].an*.005,-r[1]*G*.01,0);for(b=0;be?this.textSpans[e].span:createNS(l?"g":"text"),u<=e){if(o.setAttribute("stroke-linecap","butt"),o.setAttribute("stroke-linejoin","round"),o.setAttribute("stroke-miterlimit","4"),this.textSpans[e].span=o,l){var S=createNS("g");o.appendChild(S),this.textSpans[e].childSpan=S}this.textSpans[e].span=o,this.layerElement.appendChild(o)}o.style.display="inherit"}if(p.reset(),k&&(a[e].n&&(f=-m,x+=r.yOffset,x+=A?1:0,A=!1),this.applyTextPropertiesToMatrix(r,p,a[e].line,f,x),f+=a[e].l||0,f+=m),l){y=this.globalData.fontManager.getCharData(r.finalText[e],i.fStyle,this.globalData.fontManager.getFontByName(r.f).fFamily);var T;if(y.t===1)T=new SVGCompElement(y.data,this.globalData,this);else{var M=emptyShapeData;y.data&&y.data.shapes&&(M=this.buildShapeData(y.data,r.finalSize)),T=new SVGShapeElement(M,this.globalData,this)}if(this.textSpans[e].glyph){var I=this.textSpans[e].glyph;this.textSpans[e].childSpan.removeChild(I.layerElement),I.destroy()}this.textSpans[e].glyph=T,T._debug=!0,T.prepareFrame(0),T.renderFrame(),this.textSpans[e].childSpan.appendChild(T.layerElement),y.t===1&&this.textSpans[e].childSpan.setAttribute("transform","scale("+r.finalSize/100+","+r.finalSize/100+")")}else k&&o.setAttribute("transform","translate("+p.props[12]+","+p.props[13]+")"),o.textContent=a[e].val,o.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve")}k&&o&&o.setAttribute("d",c)}for(;e=0;t-=1)(this.completeLayers||this.elements[t])&&this.elements[t].prepareFrame(e-this.layers[t].st);if(this.globalData._mdf)for(t=0;t=0;r-=1)(this.completeLayers||this.elements[r])&&(this.elements[r].prepareFrame(this.renderedFrame-this.layers[r].st),this.elements[r]._mdf&&(this._mdf=!0))}},ICompElement.prototype.renderInnerContent=function(){var e,t=this.layers.length;for(e=0;e=0;i-=1)t.finalTransform.multiply(t.transforms[i].transform.mProps.v);t._mdf=n},processSequences:function(t){var r,i=this.sequenceList.length;for(r=0;r=1){this.buffers=[];var t=this.globalData.canvasContext,r=assetLoader.createCanvas(t.canvas.width,t.canvas.height);this.buffers.push(r);var i=assetLoader.createCanvas(t.canvas.width,t.canvas.height);this.buffers.push(i),this.data.tt>=3&&!document._isProxy&&assetLoader.loadLumaCanvas()}this.canvasContext=this.globalData.canvasContext,this.transformCanvas=this.globalData.transformCanvas,this.renderableEffectsManager=new CVEffects(this),this.searchEffectTransforms()},createContent:function(){},setBlendMode:function(){var t=this.globalData;if(t.blendMode!==this.data.bm){t.blendMode=this.data.bm;var r=getBlendMode(this.data.bm);t.canvasContext.globalCompositeOperation=r}},createRenderableComponents:function(){this.maskManager=new CVMaskElement(this.data,this),this.transformEffects=this.renderableEffectsManager.getEffects(effectTypes.TRANSFORM_EFFECT)},hideElement:function(){!this.hidden&&(!this.isInRange||this.isTransparent)&&(this.hidden=!0)},showElement:function(){this.isInRange&&!this.isTransparent&&(this.hidden=!1,this._isFirstFrame=!0,this.maskManager._isFirstFrame=!0)},clearCanvas:function(t){t.clearRect(this.transformCanvas.tx,this.transformCanvas.ty,this.transformCanvas.w*this.transformCanvas.sx,this.transformCanvas.h*this.transformCanvas.sy)},prepareLayer:function(){if(this.data.tt>=1){var t=this.buffers[0],r=t.getContext("2d");this.clearCanvas(r),r.drawImage(this.canvasContext.canvas,0,0),this.currentTransform=this.canvasContext.getTransform(),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform)}},exitLayer:function(){if(this.data.tt>=1){var t=this.buffers[1],r=t.getContext("2d");this.clearCanvas(r),r.drawImage(this.canvasContext.canvas,0,0),this.canvasContext.setTransform(1,0,0,1,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.setTransform(this.currentTransform);var i=this.comp.getElementById("tp"in this.data?this.data.tp:this.data.ind-1);if(i.renderFrame(!0),this.canvasContext.setTransform(1,0,0,1,0,0),this.data.tt>=3&&!document._isProxy){var s=assetLoader.getLumaCanvas(this.canvasContext.canvas),n=s.getContext("2d");n.drawImage(this.canvasContext.canvas,0,0),this.clearCanvas(this.canvasContext),this.canvasContext.drawImage(s,0,0)}this.canvasContext.globalCompositeOperation=operationsMap[this.data.tt],this.canvasContext.drawImage(t,0,0),this.canvasContext.globalCompositeOperation="destination-over",this.canvasContext.drawImage(this.buffers[0],0,0),this.canvasContext.setTransform(this.currentTransform),this.canvasContext.globalCompositeOperation="source-over"}},renderFrame:function(t){if(!(this.hidden||this.data.hd)&&!(this.data.td===1&&!t)){this.renderTransform(),this.renderRenderable(),this.renderLocalTransform(),this.setBlendMode();var r=this.data.ty===0;this.prepareLayer(),this.globalData.renderer.save(r),this.globalData.renderer.ctxTransform(this.finalTransform.localMat.props),this.globalData.renderer.ctxOpacity(this.finalTransform.localOpacity),this.renderInnerContent(),this.globalData.renderer.restore(r),this.exitLayer(),this.maskManager.hasMasks&&this.globalData.renderer.restore(!0),this._isFirstFrame&&(this._isFirstFrame=!1)}},destroy:function(){this.canvasContext=null,this.data=null,this.globalData=null,this.maskManager.destroy()},mHelper:new Matrix},CVBaseElement.prototype.hide=CVBaseElement.prototype.hideElement,CVBaseElement.prototype.show=CVBaseElement.prototype.showElement;function CVShapeData(e,t,r,i){this.styledShapes=[],this.tr=[0,0,0,0,0,0];var s=4;t.ty==="rc"?s=5:t.ty==="el"?s=6:t.ty==="sr"&&(s=7),this.sh=ShapePropertyFactory.getShapeProp(e,t,s,e);var n,a=r.length,l;for(n=0;n=0;n-=1){if(k=this.searchProcessedElement(e[n]),k?t[n]=r[k-1]:e[n]._shouldRender=i,e[n].ty==="fl"||e[n].ty==="st"||e[n].ty==="gf"||e[n].ty==="gs")k?t[n].style.closed=!1:t[n]=this.createStyleElement(e[n],A),p.push(t[n].style);else if(e[n].ty==="gr"){if(!k)t[n]=this.createGroupElement(e[n]);else for(o=t[n].it.length,l=0;l=0;s-=1)t[s].ty==="tr"?(a=r[s].transform,this.renderShapeTransform(e,a)):t[s].ty==="sh"||t[s].ty==="el"||t[s].ty==="rc"||t[s].ty==="sr"?this.renderPath(t[s],r[s]):t[s].ty==="fl"?this.renderFill(t[s],r[s],a):t[s].ty==="st"?this.renderStroke(t[s],r[s],a):t[s].ty==="gf"||t[s].ty==="gs"?this.renderGradientFill(t[s],r[s],a):t[s].ty==="gr"?this.renderShape(a,t[s].it,r[s].it):t[s].ty;i&&this.drawLayer()},CVShapeElement.prototype.renderStyledShape=function(e,t){if(this._isFirstFrame||t._mdf||e.transforms._mdf){var r=e.trNodes,i=t.paths,s,n,a,l=i._length;r.length=0;var o=e.transforms.finalTransform;for(a=0;a=1?c=.99:c<=-1&&(c=-.99);var k=o*c,f=Math.cos(p+t.a.v)*k+a[0],x=Math.sin(p+t.a.v)*k+a[1];s=n.createRadialGradient(f,x,0,a[0],a[1],o)}var A,m=e.g.p,E=t.g.c,d=1;for(A=0;An&&o==="xMidYMid slice"||ss&&l==="meet"||ns&&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,c==="YMid"&&(n>s&&l==="meet"||ns&&l==="meet"||n=0;e-=1)this.elements[e]&&this.elements[e].destroy&&this.elements[e].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},CanvasRendererBase.prototype.renderFrame=function(e,t){if(!(this.renderedFrame===e&&this.renderConfig.clearCanvas===!0&&!t||this.destroyed||e===-1)){this.renderedFrame=e,this.globalData.frameNum=e-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||t,this.globalData.projectInterface.currentFrame=e;var r,i=this.layers.length;for(this.completeLayers||this.checkLayers(e),r=i-1;r>=0;r-=1)(this.completeLayers||this.elements[r])&&this.elements[r].prepareFrame(e-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(e){var t=this.elements;if(!(t[e]||this.layers[e].ty===99)){var r=this.createItem(this.layers[e],this,this.globalData);t[e]=r,r.initExpressions()}},CanvasRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){var e=this.pendingElements.pop();e.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 e,t=15;for(e=0;e=0;t-=1)(this.completeLayers||this.elements[t])&&this.elements[t].renderFrame()},CVCompElement.prototype.destroy=function(){var e,t=this.layers.length;for(e=t-1;e>=0;e-=1)this.elements[e]&&this.elements[e].destroy();this.layers=null,this.elements=null},CVCompElement.prototype.createComp=function(e){return new CVCompElement(e,this.globalData,this)};function CanvasRenderer(e,t){this.animationItem=e,this.renderConfig={clearCanvas:t&&t.clearCanvas!==void 0?t.clearCanvas:!0,context:t&&t.context||null,progressiveLoad:t&&t.progressiveLoad||!1,preserveAspectRatio:t&&t.preserveAspectRatio||"xMidYMid meet",imagePreserveAspectRatio:t&&t.imagePreserveAspectRatio||"xMidYMid slice",contentVisibility:t&&t.contentVisibility||"visible",className:t&&t.className||"",id:t&&t.id||"",runExpressions:!t||t.runExpressions===void 0||t.runExpressions},this.renderConfig.dpr=t&&t.dpr||1,this.animationItem.wrapper&&(this.renderConfig.dpr=t&&t.dpr||window.devicePixelRatio||1),this.renderedFrame=-1,this.globalData={frameNum:-1,_mdf:!1,renderConfig:this.renderConfig,currentGlobalAlpha:-1},this.contextData=new CVContextData,this.elements=[],this.pendingElements=[],this.transformMat=new Matrix,this.completeLayers=!1,this.rendererType="canvas",this.renderConfig.clearCanvas&&(this.ctxTransform=this.contextData.transform.bind(this.contextData),this.ctxOpacity=this.contextData.opacity.bind(this.contextData),this.ctxFillStyle=this.contextData.fillStyle.bind(this.contextData),this.ctxStrokeStyle=this.contextData.strokeStyle.bind(this.contextData),this.ctxLineWidth=this.contextData.lineWidth.bind(this.contextData),this.ctxLineCap=this.contextData.lineCap.bind(this.contextData),this.ctxLineJoin=this.contextData.lineJoin.bind(this.contextData),this.ctxMiterLimit=this.contextData.miterLimit.bind(this.contextData),this.ctxFill=this.contextData.fill.bind(this.contextData),this.ctxFillRect=this.contextData.fillRect.bind(this.contextData),this.ctxStroke=this.contextData.stroke.bind(this.contextData),this.save=this.contextData.save.bind(this.contextData))}extendPrototype([CanvasRendererBase],CanvasRenderer),CanvasRenderer.prototype.createComp=function(e){return new CVCompElement(e,this.globalData,this)};function HBaseElement(){}HBaseElement.prototype={checkBlendMode:function(){},initRendererElement:function(){this.baseElement=createTag(this.data.tg||"div"),this.data.hasMask?(this.svgElement=createNS("svg"),this.layerElement=createNS("g"),this.maskedElement=this.layerElement,this.svgElement.appendChild(this.layerElement),this.baseElement.appendChild(this.svgElement)):this.layerElement=this.baseElement,styleDiv(this.baseElement)},createContainerElements:function(){this.renderableEffectsManager=new CVEffects(this),this.transformedElement=this.baseElement,this.maskedElement=this.layerElement,this.data.ln&&this.layerElement.setAttribute("id",this.data.ln),this.data.cl&&this.layerElement.setAttribute("class",this.data.cl),this.data.bm!==0&&this.setBlendMode()},renderElement:function(){var t=this.transformedElement?this.transformedElement.style:{};if(this.finalTransform._matMdf){var r=this.finalTransform.mat.toCSS();t.transform=r,t.webkitTransform=r}this.finalTransform._opMdf&&(t.opacity=this.finalTransform.mProp.o.v)},renderFrame:function(){this.data.hd||this.hidden||(this.renderTransform(),this.renderRenderable(),this.renderElement(),this.renderInnerContent(),this._isFirstFrame&&(this._isFirstFrame=!1))},destroy:function(){this.layerElement=null,this.transformedElement=null,this.matteElement&&(this.matteElement=null),this.maskManager&&(this.maskManager.destroy(),this.maskManager=null)},createRenderableComponents:function(){this.maskManager=new MaskElement(this.data,this,this.globalData)},addEffects:function(){},setMatte:function(){}},HBaseElement.prototype.getBaseElement=SVGBaseElement.prototype.getBaseElement,HBaseElement.prototype.destroyBaseElement=HBaseElement.prototype.destroy,HBaseElement.prototype.buildElementParenting=BaseRenderer.prototype.buildElementParenting;function HSolidElement(e,t,r){this.initElement(e,t,r)}extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement],HSolidElement),HSolidElement.prototype.createContent=function(){var e;this.data.hasMask?(e=createNS("rect"),e.setAttribute("width",this.data.sw),e.setAttribute("height",this.data.sh),e.setAttribute("fill",this.data.sc),this.svgElement.setAttribute("width",this.data.sw),this.svgElement.setAttribute("height",this.data.sh)):(e=createTag("div"),e.style.width=this.data.sw+"px",e.style.height=this.data.sh+"px",e.style.backgroundColor=this.data.sc),this.layerElement.appendChild(e)};function HShapeElement(e,t,r){this.shapes=[],this.shapesData=e.shapes,this.stylesList=[],this.shapeModifiers=[],this.itemsData=[],this.processedElements=[],this.animatedContents=[],this.shapesContainer=createNS("g"),this.initElement(e,t,r),this.prevViewData=[],this.currentBBox={x:999999,y:-999999,h:0,w:0}}extendPrototype([BaseElement,TransformElement,HSolidElement,SVGShapeElement,HBaseElement,HierarchyElement,FrameElement,RenderableElement],HShapeElement),HShapeElement.prototype._renderShapeFrame=HShapeElement.prototype.renderInnerContent,HShapeElement.prototype.createContent=function(){var e;if(this.baseElement.style.fontSize=0,this.data.hasMask)this.layerElement.appendChild(this.shapesContainer),e=this.svgElement;else{e=createNS("svg");var t=this.comp.data?this.comp.data:this.globalData.compSize;e.setAttribute("width",t.w),e.setAttribute("height",t.h),e.appendChild(this.shapesContainer),this.layerElement.appendChild(e)}this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.shapesContainer,0,[],!0),this.filterUniqueShapes(),this.shapeCont=e},HShapeElement.prototype.getTransformedPoint=function(e,t){var r,i=e.length;for(r=0;r0&&o<1&&s[f].push(this.calculateF(o,e,t,r,i,f))):(p=a*a-4*l*n,p>=0&&(c=(-a+bmSqrt(p))/(2*n),c>0&&c<1&&s[f].push(this.calculateF(c,e,t,r,i,f)),k=(-a-bmSqrt(p))/(2*n),k>0&&k<1&&s[f].push(this.calculateF(k,e,t,r,i,f)))));this.shapeBoundingBox.left=bmMin.apply(null,s[0]),this.shapeBoundingBox.top=bmMin.apply(null,s[1]),this.shapeBoundingBox.right=bmMax.apply(null,s[0]),this.shapeBoundingBox.bottom=bmMax.apply(null,s[1])},HShapeElement.prototype.calculateF=function(e,t,r,i,s,n){return bmPow(1-e,3)*t[n]+3*bmPow(1-e,2)*e*r[n]+3*(1-e)*bmPow(e,2)*i[n]+bmPow(e,3)*s[n]},HShapeElement.prototype.calculateBoundingBox=function(e,t){var r,i=e.length;for(r=0;rr&&(r=s)}r*=e.mult}else r=e.v*e.mult;t.x-=r,t.xMax+=r,t.y-=r,t.yMax+=r},HShapeElement.prototype.currentBoxContains=function(e){return this.currentBBox.x<=e.x&&this.currentBBox.y<=e.y&&this.currentBBox.width+this.currentBBox.x>=e.x+e.width&&this.currentBBox.height+this.currentBBox.y>=e.y+e.height},HShapeElement.prototype.renderInnerContent=function(){if(this._renderShapeFrame(),!this.hidden&&(this._isFirstFrame||this._mdf)){var e=this.tempBoundingBox,t=999999;if(e.x=t,e.xMax=-t,e.y=t,e.yMax=-t,this.calculateBoundingBox(this.itemsData,e),e.width=e.xMax=0;t-=1){var i=this.hierarchy[t].finalTransform.mProp;this.mat.translate(-i.p.v[0],-i.p.v[1],i.p.v[2]),this.mat.rotateX(-i.or.v[0]).rotateY(-i.or.v[1]).rotateZ(i.or.v[2]),this.mat.rotateX(-i.rx.v).rotateY(-i.ry.v).rotateZ(i.rz.v),this.mat.scale(1/i.s.v[0],1/i.s.v[1],1/i.s.v[2]),this.mat.translate(i.a.v[0],i.a.v[1],i.a.v[2])}if(this.p?this.mat.translate(-this.p.v[0],-this.p.v[1],this.p.v[2]):this.mat.translate(-this.px.v,-this.py.v,this.pz.v),this.a){var s;this.p?s=[this.p.v[0]-this.a.v[0],this.p.v[1]-this.a.v[1],this.p.v[2]-this.a.v[2]]:s=[this.px.v-this.a.v[0],this.py.v-this.a.v[1],this.pz.v-this.a.v[2]];var n=Math.sqrt(Math.pow(s[0],2)+Math.pow(s[1],2)+Math.pow(s[2],2)),a=[s[0]/n,s[1]/n,s[2]/n],l=Math.sqrt(a[2]*a[2]+a[0]*a[0]),o=Math.atan2(a[1],l),p=Math.atan2(a[0],-a[2]);this.mat.rotateY(p).rotateX(-o)}this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v),this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]),this.mat.translate(this.globalData.compSize.w/2,this.globalData.compSize.h/2,0),this.mat.translate(0,0,this.pe.v);var c=!this._prevMat.equals(this.mat);if((c||this.pe._mdf)&&this.comp.threeDElements){r=this.comp.threeDElements.length;var k,f,x;for(t=0;t=e)return this.threeDElements[t].perspectiveElem;t+=1}return null},HybridRendererBase.prototype.createThreeDContainer=function(e,t){var r=createTag("div"),i,s;styleDiv(r);var n=createTag("div");if(styleDiv(n),t==="3d"){i=r.style,i.width=this.globalData.compSize.w+"px",i.height=this.globalData.compSize.h+"px";var a="50% 50%";i.webkitTransformOrigin=a,i.mozTransformOrigin=a,i.transformOrigin=a,s=n.style;var l="matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)";s.transform=l,s.webkitTransform=l}r.appendChild(n);var o={container:n,perspectiveElem:r,startPos:e,endPos:e,type:t};return this.threeDElements.push(o),o},HybridRendererBase.prototype.build3dContainers=function(){var e,t=this.layers.length,r,i="";for(e=0;e=0;e-=1)this.resizerElem.appendChild(this.threeDElements[e].perspectiveElem)},HybridRendererBase.prototype.addTo3dContainer=function(e,t){for(var r=0,i=this.threeDElements.length;rr?(s=e/this.globalData.compSize.w,n=e/this.globalData.compSize.w,a=0,l=(t-this.globalData.compSize.h*(e/this.globalData.compSize.w))/2):(s=t/this.globalData.compSize.h,n=t/this.globalData.compSize.h,a=(e-this.globalData.compSize.w*(t/this.globalData.compSize.h))/2,l=0);var o=this.resizerElem.style;o.webkitTransform="matrix3d("+s+",0,0,0,0,"+n+",0,0,0,0,1,0,"+a+","+l+",0,1)",o.transform=o.webkitTransform},HybridRendererBase.prototype.renderFrame=SVGRenderer.prototype.renderFrame,HybridRendererBase.prototype.hide=function(){this.resizerElem.style.display="none"},HybridRendererBase.prototype.show=function(){this.resizerElem.style.display="block"},HybridRendererBase.prototype.initItems=function(){if(this.buildAllItems(),this.camera)this.camera.setup();else{var e=this.globalData.compSize.w,t=this.globalData.compSize.h,r,i=this.threeDElements.length;for(r=0;r=p;)D/=2,V/=2,O>>>=1;return(D+O)/V};return R.int32=function(){return I.g(4)|0},R.quick=function(){return I.g(4)/4294967296},R.double=R,E(g(I.S),e),(y.pass||S||function(H,D,V,O){return O&&(O.S&&A(O,I),H.state=function(){return A(I,{})}),V?(t[a]=H,D):H})(R,M,"global"in y?y.global:this==t,y.state)}t["seed"+a]=f;function x(u){var y,S=u.length,T=this,M=0,I=T.i=T.j=0,R=T.S=[];for(S||(u=[S++]);Mr){var i=r;r=t,t=i}return Math.min(Math.max(e,t),r)}function radiansToDegrees(e){return e/degToRads}var radians_to_degrees=radiansToDegrees;function degreesToRadians(e){return e*degToRads}var degrees_to_radians=radiansToDegrees,helperLengthArray=[0,0,0,0,0,0];function length(e,t){if(typeof e=="number"||e instanceof Number)return t=t||0,Math.abs(e-t);t||(t=helperLengthArray);var r,i=Math.min(e.length,t.length),s=0;for(r=0;r.5?p/(2-s-n):p/(s+n),s){case t:a=(r-i)/p+(r1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function hslToRgb(e){var t=e[0],r=e[1],i=e[2],s,n,a;if(r===0)s=i,a=i,n=i;else{var l=i<.5?i*(1+r):i+r-i*r,o=2*i-l;s=hue2rgb(o,l,t+1/3),n=hue2rgb(o,l,t),a=hue2rgb(o,l,t-1/3)}return[s,n,a,e[3]]}function linear(e,t,r,i,s){if((i===void 0||s===void 0)&&(i=t,s=r,t=0,r=1),r=r)return s;var a=r===t?0:(e-t)/(r-t);if(!i.length)return i+(s-i)*a;var l,o=i.length,p=createTypedArray("float32",o);for(l=0;l1){for(s=0;s1?t=1:t<0&&(t=0);var a=e(t);if($bm_isInstanceOfArray(s)){var l,o=s.length,p=createTypedArray("float32",o);for(l=0;ldata.k[t].t&&edata.k[t+1].t-e?(i=t+2,s=data.k[t+1].t):(i=t+1,s=data.k[t].t);break}i===-1&&(i=t+1,s=data.k[t].t)}var n={};return n.index=i,n.time=s/elem.comp.globalData.frameRate,n}function key(e){var t,r,i;if(!data.k.length||typeof data.k[0]=="number")throw new Error("The property has no keyframe at index "+e);e-=1,t={time:data.k[e].t/elem.comp.globalData.frameRate,value:[]};var s=Object.prototype.hasOwnProperty.call(data.k[e],"s")?data.k[e].s:data.k[e-1].e;for(i=s.length,r=0;rE.length-1)&&(x=E.length-1),u=E[E.length-1-x].t,g=d-u);var y,S,T;if(f==="pingpong"){var M=Math.floor((m-u)/g);if(M%2!==0)return this.getValueAtTime((g-(m-u)%g+u)/this.comp.globalData.frameRate,0)}else if(f==="offset"){var I=this.getValueAtTime(u/this.comp.globalData.frameRate,0),R=this.getValueAtTime(d/this.comp.globalData.frameRate,0),H=this.getValueAtTime(((m-u)%g+u)/this.comp.globalData.frameRate,0),D=Math.floor((m-u)/g);if(this.pv.length){for(T=new Array(I.length),S=T.length,y=0;y=d)return this.pv;var g,u;A?(x?g=Math.abs(this.elem.comp.globalData.frameRate*x):g=Math.max(0,this.elem.data.op-d),u=d+g):((!x||x>E.length-1)&&(x=E.length-1),u=E[x].t,g=u-d);var y,S,T;if(f==="pingpong"){var M=Math.floor((d-m)/g);if(M%2===0)return this.getValueAtTime(((d-m)%g+d)/this.comp.globalData.frameRate,0)}else if(f==="offset"){var I=this.getValueAtTime(d/this.comp.globalData.frameRate,0),R=this.getValueAtTime(u/this.comp.globalData.frameRate,0),H=this.getValueAtTime((g-(d-m)%g+d)/this.comp.globalData.frameRate,0),D=Math.floor((d-m)/g)+1;if(this.pv.length){for(T=new Array(I.length),S=T.length,y=0;y1?(E-m)/(x-1):1,g=0,u=0,y;this.pv.length?y=createTypedArray("float32",this.pv.length):y=0;for(var S;gg){var M=u,I=m.c&&u===y-1?0:u+1,R=(g-S)/d[u].addedLength;T=bez.getPointInSegment(m.v[M],m.v[I],m.o[M],m.i[I],R,d[u]);break}else S+=d[u].addedLength;u+=1}return T||(T=m.c?[m.v[0][0],m.v[0][1]]:[m.v[m._length-1][0],m.v[m._length-1][1]]),T},vectorOnPath:function(x,A,m){x==1?x=this.v.c:x==0&&(x=.999);var E=this.pointOnPath(x,A),d=this.pointOnPath(x+.001,A),g=d[0]-E[0],u=d[1]-E[1],y=Math.sqrt(Math.pow(g,2)+Math.pow(u,2));if(y===0)return[0,0];var S=m==="tangent"?[g/y,u/y]:[-u/y,g/y];return S},tangentOnPath:function(x,A){return this.vectorOnPath(x,A,"tangent")},normalOnPath:function(x,A){return this.vectorOnPath(x,A,"normal")},setGroupProperty:expressionHelpers.setGroupProperty,getValueAtTime:expressionHelpers.getStaticValueAtTime},extendPrototype([c],o),extendPrototype([c],p),p.prototype.getValueAtTime=l,p.prototype.initiateExpression=ExpressionManager.initiateExpression;var k=ShapePropertyFactory.getShapeProp;ShapePropertyFactory.getShapeProp=function(f,x,A,m,E){var d=k(f,x,A,m,E);return d.propertyIndex=x.ix,d.lock=!1,A===3?expressionHelpers.searchExpressions(f,x.pt,d):A===4&&expressionHelpers.searchExpressions(f,x.ks,d),d.k&&f.addDynamicProperty(d),d}}function initialize$1(){addPropertyDecorator()}function addDecorator(){function e(){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(t,r){var i=this.calculateExpression(r);if(t.t!==i){var s={};return this.copyData(s,t),s.t=i.toString(),s.__complete=!1,s}return t},TextProperty.prototype.searchProperty=function(){var t=this.searchKeyframes(),r=this.searchExpressions();return this.kf=t||r,this.kf},TextProperty.prototype.searchExpressions=e}function initialize(){addDecorator()}function SVGComposableEffect(){}SVGComposableEffect.prototype={createMergeNode:function e(t,r){var i=createNS("feMerge");i.setAttribute("result",t);var s,n;for(n=0;n=p?k=A<0?i:s:k=i+x*Math.pow((l-e)/A,1/r),c[f]=k,f+=1,n+=256/(a-1);return c.join(" ")},SVGProLevelsFilter.prototype.renderFrame=function(e){if(e||this.filterManager._mdf){var t,r=this.filterManager.effectElements;this.feFuncRComposed&&(e||r[3].p._mdf||r[4].p._mdf||r[5].p._mdf||r[6].p._mdf||r[7].p._mdf)&&(t=this.getTableValue(r[3].p.v,r[4].p.v,r[5].p.v,r[6].p.v,r[7].p.v),this.feFuncRComposed.setAttribute("tableValues",t),this.feFuncGComposed.setAttribute("tableValues",t),this.feFuncBComposed.setAttribute("tableValues",t)),this.feFuncR&&(e||r[10].p._mdf||r[11].p._mdf||r[12].p._mdf||r[13].p._mdf||r[14].p._mdf)&&(t=this.getTableValue(r[10].p.v,r[11].p.v,r[12].p.v,r[13].p.v,r[14].p.v),this.feFuncR.setAttribute("tableValues",t)),this.feFuncG&&(e||r[17].p._mdf||r[18].p._mdf||r[19].p._mdf||r[20].p._mdf||r[21].p._mdf)&&(t=this.getTableValue(r[17].p.v,r[18].p.v,r[19].p.v,r[20].p.v,r[21].p.v),this.feFuncG.setAttribute("tableValues",t)),this.feFuncB&&(e||r[24].p._mdf||r[25].p._mdf||r[26].p._mdf||r[27].p._mdf||r[28].p._mdf)&&(t=this.getTableValue(r[24].p.v,r[25].p.v,r[26].p.v,r[27].p.v,r[28].p.v),this.feFuncB.setAttribute("tableValues",t)),this.feFuncA&&(e||r[31].p._mdf||r[32].p._mdf||r[33].p._mdf||r[34].p._mdf||r[35].p._mdf)&&(t=this.getTableValue(r[31].p.v,r[32].p.v,r[33].p.v,r[34].p.v,r[35].p.v),this.feFuncA.setAttribute("tableValues",t))}};function SVGDropShadowEffect(e,t,r,i,s){var n=t.container.globalData.renderConfig.filterSize,a=t.data.fs||n;e.setAttribute("x",a.x||n.x),e.setAttribute("y",a.y||n.y),e.setAttribute("width",a.width||n.width),e.setAttribute("height",a.height||n.height),this.filterManager=t;var l=createNS("feGaussianBlur");l.setAttribute("in","SourceAlpha"),l.setAttribute("result",i+"_drop_shadow_1"),l.setAttribute("stdDeviation","0"),this.feGaussianBlur=l,e.appendChild(l);var o=createNS("feOffset");o.setAttribute("dx","25"),o.setAttribute("dy","0"),o.setAttribute("in",i+"_drop_shadow_1"),o.setAttribute("result",i+"_drop_shadow_2"),this.feOffset=o,e.appendChild(o);var p=createNS("feFlood");p.setAttribute("flood-color","#00ff00"),p.setAttribute("flood-opacity","1"),p.setAttribute("result",i+"_drop_shadow_3"),this.feFlood=p,e.appendChild(p);var c=createNS("feComposite");c.setAttribute("in",i+"_drop_shadow_3"),c.setAttribute("in2",i+"_drop_shadow_2"),c.setAttribute("operator","in"),c.setAttribute("result",i+"_drop_shadow_4"),e.appendChild(c);var k=this.createMergeNode(i,[i+"_drop_shadow_4",s]);e.appendChild(k)}extendPrototype([SVGComposableEffect],SVGDropShadowEffect),SVGDropShadowEffect.prototype.renderFrame=function(e){if(e||this.filterManager._mdf){if((e||this.filterManager.effectElements[4].p._mdf)&&this.feGaussianBlur.setAttribute("stdDeviation",this.filterManager.effectElements[4].p.v/4),e||this.filterManager.effectElements[0].p._mdf){var t=this.filterManager.effectElements[0].p.v;this.feFlood.setAttribute("flood-color",rgbToHex(Math.round(t[0]*255),Math.round(t[1]*255),Math.round(t[2]*255)))}if((e||this.filterManager.effectElements[1].p._mdf)&&this.feFlood.setAttribute("flood-opacity",this.filterManager.effectElements[1].p.v/255),e||this.filterManager.effectElements[2].p._mdf||this.filterManager.effectElements[3].p._mdf){var r=this.filterManager.effectElements[3].p.v,i=(this.filterManager.effectElements[2].p.v-90)*degToRads,s=r*Math.cos(i),n=r*Math.sin(i);this.feOffset.setAttribute("dx",s),this.feOffset.setAttribute("dy",n)}}};var _svgMatteSymbols=[];function SVGMatte3Effect(e,t,r){this.initialized=!1,this.filterManager=t,this.filterElem=e,this.elem=r,r.matteElement=createNS("g"),r.matteElement.appendChild(r.layerElement),r.matteElement.appendChild(r.transformedElement),r.baseElement=r.matteElement}SVGMatte3Effect.prototype.findSymbol=function(e){for(var t=0,r=_svgMatteSymbols.length;t .t-container > .body"),r=document.querySelector("#tarka-chat > .t-container > .scroll-fade"),i=document.querySelector("#tarka-chat > .t-container > .body > .message-container"),s=document.querySelector("#tarka-chat > .t-container > .footer");r.style.display="none",i.style.display="none",s.style.display="none";const a=e(()=>{var l;(l=t.querySelector(".tc-injected-prechat"))==null||l.remove(),r.style.display="block",i.style.display="flex",s.style.display="flex"});a.className+=" tc-injected-prechat",t.appendChild(a)}function bound01(e,t){isOnePointZero(e)&&(e="100%");const r=isPercentage(e);return e=t===360?e:Math.min(t,Math.max(0,parseFloat(e))),r&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:(t===360?e=(e<0?e%t+t:e%t)/parseFloat(String(t)):e=e%t/parseFloat(String(t)),e)}function clamp01(e){return Math.min(1,Math.max(0,e))}function isOnePointZero(e){return typeof e=="string"&&e.indexOf(".")!==-1&&parseFloat(e)===1}function isPercentage(e){return typeof e=="string"&&e.indexOf("%")!==-1}function boundAlpha(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function convertToPercentage(e){return Number(e)<=1?`${Number(e)*100}%`:e}function pad2(e){return e.length===1?"0"+e:String(e)}function rgbToRgb(e,t,r){return{r:bound01(e,255)*255,g:bound01(t,255)*255,b:bound01(r,255)*255}}function rgbToHsl(e,t,r){e=bound01(e,255),t=bound01(t,255),r=bound01(r,255);const i=Math.max(e,t,r),s=Math.min(e,t,r);let n=0,a=0;const l=(i+s)/2;if(i===s)a=0,n=0;else{const o=i-s;switch(a=l>.5?o/(2-i-s):o/(i+s),i){case e:n=(t-r)/o+(t1&&(r-=1),r<1/6?e+(t-e)*(6*r):r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function hslToRgb(e,t,r){let i,s,n;if(e=bound01(e,360),t=bound01(t,100),r=bound01(r,100),t===0)s=r,n=r,i=r;else{const a=r<.5?r*(1+t):r+t-r*t,l=2*r-a;i=hue2rgb(l,a,e+1/3),s=hue2rgb(l,a,e),n=hue2rgb(l,a,e-1/3)}return{r:i*255,g:s*255,b:n*255}}function rgbToHsv(e,t,r){e=bound01(e,255),t=bound01(t,255),r=bound01(r,255);const i=Math.max(e,t,r),s=Math.min(e,t,r);let n=0;const a=i,l=i-s,o=i===0?0:l/i;if(i===s)n=0;else{switch(i){case e:n=(t-r)/l+(t>16,g:(e&65280)>>8,b:e&255}}const names={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function inputToRGB(e){let t={r:0,g:0,b:0},r=1,i=null,s=null,n=null,a=!1,l=!1;return typeof e=="string"&&(e=stringInputToObject(e)),typeof e=="object"&&(isValidCSSUnit(e.r)&&isValidCSSUnit(e.g)&&isValidCSSUnit(e.b)?(t=rgbToRgb(e.r,e.g,e.b),a=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):isValidCSSUnit(e.h)&&isValidCSSUnit(e.s)&&isValidCSSUnit(e.v)?(i=convertToPercentage(e.s),s=convertToPercentage(e.v),t=hsvToRgb(e.h,i,s),a=!0,l="hsv"):isValidCSSUnit(e.h)&&isValidCSSUnit(e.s)&&isValidCSSUnit(e.l)&&(i=convertToPercentage(e.s),n=convertToPercentage(e.l),t=hslToRgb(e.h,i,n),a=!0,l="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(r=e.a)),r=boundAlpha(r),{ok:a,format:e.format||l,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:r}}const CSS_INTEGER="[-\\+]?\\d+%?",CSS_NUMBER="[-\\+]?\\d*\\.\\d+%?",CSS_UNIT="(?:"+CSS_NUMBER+")|(?:"+CSS_INTEGER+")",PERMISSIVE_MATCH3="[\\s|\\(]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")\\s*\\)?",PERMISSIVE_MATCH4="[\\s|\\(]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")\\s*\\)?",matchers={CSS_UNIT:new RegExp(CSS_UNIT),rgb:new RegExp("rgb"+PERMISSIVE_MATCH3),rgba:new RegExp("rgba"+PERMISSIVE_MATCH4),hsl:new RegExp("hsl"+PERMISSIVE_MATCH3),hsla:new RegExp("hsla"+PERMISSIVE_MATCH4),hsv:new RegExp("hsv"+PERMISSIVE_MATCH3),hsva:new RegExp("hsva"+PERMISSIVE_MATCH4),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function stringInputToObject(e){if(e=e.trim().toLowerCase(),e.length===0)return!1;let t=!1;if(names[e])e=names[e],t=!0;else if(e==="transparent")return{r:0,g:0,b:0,a:0,format:"name"};let r=matchers.rgb.exec(e);return r?{r:r[1],g:r[2],b:r[3]}:(r=matchers.rgba.exec(e),r?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=matchers.hsl.exec(e),r?{h:r[1],s:r[2],l:r[3]}:(r=matchers.hsla.exec(e),r?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=matchers.hsv.exec(e),r?{h:r[1],s:r[2],v:r[3]}:(r=matchers.hsva.exec(e),r?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=matchers.hex8.exec(e),r?{r:parseIntFromHex(r[1]),g:parseIntFromHex(r[2]),b:parseIntFromHex(r[3]),a:convertHexToDecimal(r[4]),format:t?"name":"hex8"}:(r=matchers.hex6.exec(e),r?{r:parseIntFromHex(r[1]),g:parseIntFromHex(r[2]),b:parseIntFromHex(r[3]),format:t?"name":"hex"}:(r=matchers.hex4.exec(e),r?{r:parseIntFromHex(r[1]+r[1]),g:parseIntFromHex(r[2]+r[2]),b:parseIntFromHex(r[3]+r[3]),a:convertHexToDecimal(r[4]+r[4]),format:t?"name":"hex8"}:(r=matchers.hex3.exec(e),r?{r:parseIntFromHex(r[1]+r[1]),g:parseIntFromHex(r[2]+r[2]),b:parseIntFromHex(r[3]+r[3]),format:t?"name":"hex"}:!1)))))))))}function isValidCSSUnit(e){return!!matchers.CSS_UNIT.exec(String(e))}class TinyColor{constructor(t="",r={}){if(t instanceof TinyColor)return t;typeof t=="number"&&(t=numberInputToObject(t)),this.originalInput=t;const i=inputToRGB(t);this.originalInput=t,this.r=i.r,this.g=i.g,this.b=i.b,this.a=i.a,this.roundA=Math.round(100*this.a)/100,this.format=r.format??i.format,this.gradientType=r.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=i.ok}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}getBrightness(){const t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3}getLuminance(){const t=this.toRgb();let r,i,s;const n=t.r/255,a=t.g/255,l=t.b/255;return n<=.03928?r=n/12.92:r=Math.pow((n+.055)/1.055,2.4),a<=.03928?i=a/12.92:i=Math.pow((a+.055)/1.055,2.4),l<=.03928?s=l/12.92:s=Math.pow((l+.055)/1.055,2.4),.2126*r+.7152*i+.0722*s}getAlpha(){return this.a}setAlpha(t){return this.a=boundAlpha(t),this.roundA=Math.round(100*this.a)/100,this}isMonochrome(){const{s:t}=this.toHsl();return t===0}toHsv(){const t=rgbToHsv(this.r,this.g,this.b);return{h:t.h*360,s:t.s,v:t.v,a:this.a}}toHsvString(){const t=rgbToHsv(this.r,this.g,this.b),r=Math.round(t.h*360),i=Math.round(t.s*100),s=Math.round(t.v*100);return this.a===1?`hsv(${r}, ${i}%, ${s}%)`:`hsva(${r}, ${i}%, ${s}%, ${this.roundA})`}toHsl(){const t=rgbToHsl(this.r,this.g,this.b);return{h:t.h*360,s:t.s,l:t.l,a:this.a}}toHslString(){const t=rgbToHsl(this.r,this.g,this.b),r=Math.round(t.h*360),i=Math.round(t.s*100),s=Math.round(t.l*100);return this.a===1?`hsl(${r}, ${i}%, ${s}%)`:`hsla(${r}, ${i}%, ${s}%, ${this.roundA})`}toHex(t=!1){return rgbToHex(this.r,this.g,this.b,t)}toHexString(t=!1){return"#"+this.toHex(t)}toHex8(t=!1){return rgbaToHex(this.r,this.g,this.b,this.a,t)}toHex8String(t=!1){return"#"+this.toHex8(t)}toHexShortString(t=!1){return this.a===1?this.toHexString(t):this.toHex8String(t)}toRgb(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}}toRgbString(){const t=Math.round(this.r),r=Math.round(this.g),i=Math.round(this.b);return this.a===1?`rgb(${t}, ${r}, ${i})`:`rgba(${t}, ${r}, ${i}, ${this.roundA})`}toPercentageRgb(){const t=r=>`${Math.round(bound01(r,255)*100)}%`;return{r:t(this.r),g:t(this.g),b:t(this.b),a:this.a}}toPercentageRgbString(){const t=r=>Math.round(bound01(r,255)*100);return this.a===1?`rgb(${t(this.r)}%, ${t(this.g)}%, ${t(this.b)}%)`:`rgba(${t(this.r)}%, ${t(this.g)}%, ${t(this.b)}%, ${this.roundA})`}toName(){if(this.a===0)return"transparent";if(this.a<1)return!1;const t="#"+rgbToHex(this.r,this.g,this.b,!1);for(const[r,i]of Object.entries(names))if(t===i)return r;return!1}toString(t){const r=!!t;t=t??this.format;let i=!1;const s=this.a<1&&this.a>=0;return!r&&s&&(t.startsWith("hex")||t==="name")?t==="name"&&this.a===0?this.toName():this.toRgbString():(t==="rgb"&&(i=this.toRgbString()),t==="prgb"&&(i=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(i=this.toHexString()),t==="hex3"&&(i=this.toHexString(!0)),t==="hex4"&&(i=this.toHex8String(!0)),t==="hex8"&&(i=this.toHex8String()),t==="name"&&(i=this.toName()),t==="hsl"&&(i=this.toHslString()),t==="hsv"&&(i=this.toHsvString()),i||this.toHexString())}toNumber(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)}clone(){return new TinyColor(this.toString())}lighten(t=10){const r=this.toHsl();return r.l+=t/100,r.l=clamp01(r.l),new TinyColor(r)}brighten(t=10){const r=this.toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(t/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(t/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(t/100)))),new TinyColor(r)}darken(t=10){const r=this.toHsl();return r.l-=t/100,r.l=clamp01(r.l),new TinyColor(r)}tint(t=10){return this.mix("white",t)}shade(t=10){return this.mix("black",t)}desaturate(t=10){const r=this.toHsl();return r.s-=t/100,r.s=clamp01(r.s),new TinyColor(r)}saturate(t=10){const r=this.toHsl();return r.s+=t/100,r.s=clamp01(r.s),new TinyColor(r)}greyscale(){return this.desaturate(100)}spin(t){const r=this.toHsl(),i=(r.h+t)%360;return r.h=i<0?360+i:i,new TinyColor(r)}mix(t,r=50){const i=this.toRgb(),s=new TinyColor(t).toRgb(),n=r/100,a={r:(s.r-i.r)*n+i.r,g:(s.g-i.g)*n+i.g,b:(s.b-i.b)*n+i.b,a:(s.a-i.a)*n+i.a};return new TinyColor(a)}analogous(t=6,r=30){const i=this.toHsl(),s=360/r,n=[this];for(i.h=(i.h-(s*t>>1)+720)%360;--t;)i.h=(i.h+s)%360,n.push(new TinyColor(i));return n}complement(){const t=this.toHsl();return t.h=(t.h+180)%360,new TinyColor(t)}monochromatic(t=6){const r=this.toHsv(),{h:i}=r,{s}=r;let{v:n}=r;const a=[],l=1/t;for(;t--;)a.push(new TinyColor({h:i,s,v:n})),n=(n+l)%1;return a}splitcomplement(){const t=this.toHsl(),{h:r}=t;return[this,new TinyColor({h:(r+72)%360,s:t.s,l:t.l}),new TinyColor({h:(r+216)%360,s:t.s,l:t.l})]}onBackground(t){const r=this.toRgb(),i=new TinyColor(t).toRgb(),s=r.a+i.a*(1-r.a);return new TinyColor({r:(r.r*r.a+i.r*i.a*(1-r.a))/s,g:(r.g*r.a+i.g*i.a*(1-r.a))/s,b:(r.b*r.a+i.b*i.a*(1-r.a))/s,a:s})}triad(){return this.polyad(3)}tetrad(){return this.polyad(4)}polyad(t){const r=this.toHsl(),{h:i}=r,s=[this],n=360/t;for(let a=1;a"']/,escapeReplace=new RegExp(escapeTest.source,"g"),escapeTestNoEncode=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode=new RegExp(escapeTestNoEncode.source,"g"),escapeReplacements={"&":"&","<":"<",">":">",'"':""","'":"'"},getEscapeReplacement=e=>escapeReplacements[e];function escape$1(e,t){if(t){if(escapeTest.test(e))return e.replace(escapeReplace,getEscapeReplacement)}else if(escapeTestNoEncode.test(e))return e.replace(escapeReplaceNoEncode,getEscapeReplacement);return e}const unescapeTest=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function unescape(e){return e.replace(unescapeTest,(t,r)=>(r=r.toLowerCase(),r==="colon"?":":r.charAt(0)==="#"?r.charAt(1)==="x"?String.fromCharCode(parseInt(r.substring(2),16)):String.fromCharCode(+r.substring(1)):""))}const caret=/(^|[^\[])\^/g;function edit(e,t){let r=typeof e=="string"?e:e.source;t=t||"";const i={replace:(s,n)=>{let a=typeof n=="string"?n:n.source;return a=a.replace(caret,"$1"),r=r.replace(s,a),i},getRegex:()=>new RegExp(r,t)};return i}function cleanUrl(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch{return null}return e}const noopTest={exec:()=>null};function splitCells(e,t){const r=e.replace(/\|/g,(n,a,l)=>{let o=!1,p=a;for(;--p>=0&&l[p]==="\\";)o=!o;return o?"|":" |"}),i=r.split(/ \|/);let s=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),t)if(i.length>t)i.splice(t);else for(;i.length{const n=s.match(/^\s+/);if(n===null)return s;const[a]=n;return a.length>=i.length?s.slice(i.length):s}).join(` +`)}class _Tokenizer{constructor(t){X(this,"options");X(this,"rules");X(this,"lexer");this.options=t||_defaults}space(t){const r=this.rules.block.newline.exec(t);if(r&&r[0].length>0)return{type:"space",raw:r[0]}}code(t){const r=this.rules.block.code.exec(t);if(r){const i=r[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:r[0],codeBlockStyle:"indented",text:this.options.pedantic?i:rtrim(i,` +`)}}}fences(t){const r=this.rules.block.fences.exec(t);if(r){const i=r[0],s=indentCodeCompensation(i,r[3]||"");return{type:"code",raw:i,lang:r[2]?r[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):r[2],text:s}}}heading(t){const r=this.rules.block.heading.exec(t);if(r){let i=r[2].trim();if(/#$/.test(i)){const s=rtrim(i,"#");(this.options.pedantic||!s||/ $/.test(s))&&(i=s.trim())}return{type:"heading",raw:r[0],depth:r[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(t){const r=this.rules.block.hr.exec(t);if(r)return{type:"hr",raw:r[0]}}blockquote(t){const r=this.rules.block.blockquote.exec(t);if(r){const i=rtrim(r[0].replace(/^ *>[ \t]?/gm,""),` +`),s=this.lexer.state.top;this.lexer.state.top=!0;const n=this.lexer.blockTokens(i);return this.lexer.state.top=s,{type:"blockquote",raw:r[0],tokens:n,text:i}}}list(t){let r=this.rules.block.list.exec(t);if(r){let i=r[1].trim();const s=i.length>1,n={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");const a=new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`);let l="",o="",p=!1;for(;t;){let c=!1;if(!(r=a.exec(t))||this.rules.block.hr.test(t))break;l=r[0],t=t.substring(l.length);let k=r[2].split(` +`,1)[0].replace(/^\t+/,d=>" ".repeat(3*d.length)),f=t.split(` +`,1)[0],x=0;this.options.pedantic?(x=2,o=k.trimStart()):(x=r[2].search(/[^ ]/),x=x>4?1:x,o=k.slice(x),x+=r[1].length);let A=!1;if(!k&&/^ *$/.test(f)&&(l+=f+` +`,t=t.substring(f.length+1),c=!0),!c){const d=new RegExp(`^ {0,${Math.min(3,x-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),g=new RegExp(`^ {0,${Math.min(3,x-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),u=new RegExp(`^ {0,${Math.min(3,x-1)}}(?:\`\`\`|~~~)`),y=new RegExp(`^ {0,${Math.min(3,x-1)}}#`);for(;t;){const S=t.split(` +`,1)[0];if(f=S,this.options.pedantic&&(f=f.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),u.test(f)||y.test(f)||d.test(f)||g.test(t))break;if(f.search(/[^ ]/)>=x||!f.trim())o+=` +`+f.slice(x);else{if(A||k.search(/[^ ]/)>=4||u.test(k)||y.test(k)||g.test(k))break;o+=` +`+f}!A&&!f.trim()&&(A=!0),l+=S+` +`,t=t.substring(S.length+1),k=f.slice(x)}}n.loose||(p?n.loose=!0:/\n *\n *$/.test(l)&&(p=!0));let m=null,E;this.options.gfm&&(m=/^\[[ xX]\] /.exec(o),m&&(E=m[0]!=="[ ] ",o=o.replace(/^\[[ xX]\] +/,""))),n.items.push({type:"list_item",raw:l,task:!!m,checked:E,loose:!1,text:o,tokens:[]}),n.raw+=l}n.items[n.items.length-1].raw=l.trimEnd(),n.items[n.items.length-1].text=o.trimEnd(),n.raw=n.raw.trimEnd();for(let c=0;cx.type==="space"),f=k.length>0&&k.some(x=>/\n.*\n/.test(x.raw));n.loose=f}if(n.loose)for(let c=0;c$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=r[3]?r[3].substring(1,r[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):r[3];return{type:"def",tag:i,raw:r[0],href:s,title:n}}}table(t){const r=this.rules.block.table.exec(t);if(!r||!/[:|]/.test(r[2]))return;const i=splitCells(r[1]),s=r[2].replace(/^\||\| *$/g,"").split("|"),n=r[3]&&r[3].trim()?r[3].replace(/\n[ \t]*$/,"").split(` +`):[],a={type:"table",raw:r[0],header:[],align:[],rows:[]};if(i.length===s.length){for(const l of s)/^ *-+: *$/.test(l)?a.align.push("right"):/^ *:-+: *$/.test(l)?a.align.push("center"):/^ *:-+ *$/.test(l)?a.align.push("left"):a.align.push(null);for(const l of i)a.header.push({text:l,tokens:this.lexer.inline(l)});for(const l of n)a.rows.push(splitCells(l,a.header.length).map(o=>({text:o,tokens:this.lexer.inline(o)})));return a}}lheading(t){const r=this.rules.block.lheading.exec(t);if(r)return{type:"heading",raw:r[0],depth:r[2].charAt(0)==="="?1:2,text:r[1],tokens:this.lexer.inline(r[1])}}paragraph(t){const r=this.rules.block.paragraph.exec(t);if(r){const i=r[1].charAt(r[1].length-1)===` +`?r[1].slice(0,-1):r[1];return{type:"paragraph",raw:r[0],text:i,tokens:this.lexer.inline(i)}}}text(t){const r=this.rules.block.text.exec(t);if(r)return{type:"text",raw:r[0],text:r[0],tokens:this.lexer.inline(r[0])}}escape(t){const r=this.rules.inline.escape.exec(t);if(r)return{type:"escape",raw:r[0],text:escape$1(r[1])}}tag(t){const r=this.rules.inline.tag.exec(t);if(r)return!this.lexer.state.inLink&&/^/i.test(r[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(r[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(r[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:r[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:r[0]}}link(t){const r=this.rules.inline.link.exec(t);if(r){const i=r[2].trim();if(!this.options.pedantic&&/^$/.test(i))return;const a=rtrim(i.slice(0,-1),"\\");if((i.length-a.length)%2===0)return}else{const a=findClosingBracket(r[2],"()");if(a>-1){const o=(r[0].indexOf("!")===0?5:4)+r[1].length+a;r[2]=r[2].substring(0,a),r[0]=r[0].substring(0,o).trim(),r[3]=""}}let s=r[2],n="";if(this.options.pedantic){const a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(s);a&&(s=a[1],n=a[3])}else n=r[3]?r[3].slice(1,-1):"";return s=s.trim(),/^$/.test(i)?s=s.slice(1):s=s.slice(1,-1)),outputLink(r,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},r[0],this.lexer)}}reflink(t,r){let i;if((i=this.rules.inline.reflink.exec(t))||(i=this.rules.inline.nolink.exec(t))){const s=(i[2]||i[1]).replace(/\s+/g," "),n=r[s.toLowerCase()];if(!n){const a=i[0].charAt(0);return{type:"text",raw:a,text:a}}return outputLink(i,n,i[0],this.lexer)}}emStrong(t,r,i=""){let s=this.rules.inline.emStrongLDelim.exec(t);if(!s||s[3]&&i.match(/[\p{L}\p{N}]/u))return;if(!(s[1]||s[2]||"")||!i||this.rules.inline.punctuation.exec(i)){const a=[...s[0]].length-1;let l,o,p=a,c=0;const k=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(k.lastIndex=0,r=r.slice(-1*t.length+a);(s=k.exec(r))!=null;){if(l=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!l)continue;if(o=[...l].length,s[3]||s[4]){p+=o;continue}else if((s[5]||s[6])&&a%3&&!((a+o)%3)){c+=o;continue}if(p-=o,p>0)continue;o=Math.min(o,o+p+c);const f=[...s[0]][0].length,x=t.slice(0,a+s.index+f+o);if(Math.min(a,o)%2){const m=x.slice(1,-1);return{type:"em",raw:x,text:m,tokens:this.lexer.inlineTokens(m)}}const A=x.slice(2,-2);return{type:"strong",raw:x,text:A,tokens:this.lexer.inlineTokens(A)}}}}codespan(t){const r=this.rules.inline.code.exec(t);if(r){let i=r[2].replace(/\n/g," ");const s=/[^ ]/.test(i),n=/^ /.test(i)&&/ $/.test(i);return s&&n&&(i=i.substring(1,i.length-1)),i=escape$1(i,!0),{type:"codespan",raw:r[0],text:i}}}br(t){const r=this.rules.inline.br.exec(t);if(r)return{type:"br",raw:r[0]}}del(t){const r=this.rules.inline.del.exec(t);if(r)return{type:"del",raw:r[0],text:r[2],tokens:this.lexer.inlineTokens(r[2])}}autolink(t){const r=this.rules.inline.autolink.exec(t);if(r){let i,s;return r[2]==="@"?(i=escape$1(r[1]),s="mailto:"+i):(i=escape$1(r[1]),s=i),{type:"link",raw:r[0],text:i,href:s,tokens:[{type:"text",raw:i,text:i}]}}}url(t){var i;let r;if(r=this.rules.inline.url.exec(t)){let s,n;if(r[2]==="@")s=escape$1(r[0]),n="mailto:"+s;else{let a;do a=r[0],r[0]=((i=this.rules.inline._backpedal.exec(r[0]))==null?void 0:i[0])??"";while(a!==r[0]);s=escape$1(r[0]),r[1]==="www."?n="http://"+r[0]:n=r[0]}return{type:"link",raw:r[0],text:s,href:n,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(t){const r=this.rules.inline.text.exec(t);if(r){let i;return this.lexer.state.inRawBlock?i=r[0]:i=escape$1(r[0]),{type:"text",raw:r[0],text:i}}}}const newline=/^(?: *(?:\n|$))+/,blockCode=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bullet=/(?:[*+-]|\d{1,9}[.)])/,lheading=edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,bullet).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),_paragraph=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,blockText=/^[^\n]+/,_blockLabel=/(?!\s*\])(?:\\.|[^\[\]\\])+/,def=edit(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",_blockLabel).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),list=edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,bullet).getRegex(),_tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",_comment=/|$))/,html=edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",_comment).replace("tag",_tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),paragraph=edit(_paragraph).replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex(),blockquote=edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",paragraph).getRegex(),blockNormal={blockquote,code:blockCode,def,fences,heading,hr,html,lheading,list,newline,paragraph,table:noopTest,text:blockText},gfmTable=edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex(),blockGfm={...blockNormal,table:gfmTable,paragraph:edit(_paragraph).replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",gfmTable).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex()},blockPedantic={...blockNormal,html:edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",_comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:noopTest,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:edit(_paragraph).replace("hr",hr).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",lheading).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},escape=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,inlineCode=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br=/^( {2,}|\\)\n(?!\s*$)/,inlineText=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\]*?>/g,emStrongLDelim=edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,_punctuation).getRegex(),emStrongRDelimAst=edit("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,_punctuation).getRegex(),emStrongRDelimUnd=edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,_punctuation).getRegex(),anyPunctuation=edit(/\\([punct])/,"gu").replace(/punct/g,_punctuation).getRegex(),autolink=edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),_inlineComment=edit(_comment).replace("(?:-->|$)","-->").getRegex(),tag=edit("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",_inlineComment).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),_inlineLabel=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,link=edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",_inlineLabel).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),reflink=edit(/^!?\[(label)\]\[(ref)\]/).replace("label",_inlineLabel).replace("ref",_blockLabel).getRegex(),nolink=edit(/^!?\[(ref)\](?:\[\])?/).replace("ref",_blockLabel).getRegex(),reflinkSearch=edit("reflink|nolink(?!\\()","g").replace("reflink",reflink).replace("nolink",nolink).getRegex(),inlineNormal={_backpedal:noopTest,anyPunctuation,autolink,blockSkip,br,code:inlineCode,del:noopTest,emStrongLDelim,emStrongRDelimAst,emStrongRDelimUnd,escape,link,nolink,punctuation,reflink,reflinkSearch,tag,text:inlineText,url:noopTest},inlinePedantic={...inlineNormal,link:edit(/^!?\[(label)\]\((.*?)\)/).replace("label",_inlineLabel).getRegex(),reflink:edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",_inlineLabel).getRegex()},inlineGfm={...inlineNormal,escape:edit(escape).replace("])","~|])").getRegex(),url:edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\o+" ".repeat(p.length));let i,s,n,a;for(;t;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(l=>(i=l.call({lexer:this},t,r))?(t=t.substring(i.raw.length),r.push(i),!0):!1))){if(i=this.tokenizer.space(t)){t=t.substring(i.raw.length),i.raw.length===1&&r.length>0?r[r.length-1].raw+=` +`:r.push(i);continue}if(i=this.tokenizer.code(t)){t=t.substring(i.raw.length),s=r[r.length-1],s&&(s.type==="paragraph"||s.type==="text")?(s.raw+=` +`+i.raw,s.text+=` +`+i.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text):r.push(i);continue}if(i=this.tokenizer.fences(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.heading(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.hr(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.blockquote(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.list(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.html(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.def(t)){t=t.substring(i.raw.length),s=r[r.length-1],s&&(s.type==="paragraph"||s.type==="text")?(s.raw+=` +`+i.raw,s.text+=` +`+i.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title});continue}if(i=this.tokenizer.table(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.lheading(t)){t=t.substring(i.raw.length),r.push(i);continue}if(n=t,this.options.extensions&&this.options.extensions.startBlock){let l=1/0;const o=t.slice(1);let p;this.options.extensions.startBlock.forEach(c=>{p=c.call({lexer:this},o),typeof p=="number"&&p>=0&&(l=Math.min(l,p))}),l<1/0&&l>=0&&(n=t.substring(0,l+1))}if(this.state.top&&(i=this.tokenizer.paragraph(n))){s=r[r.length-1],a&&s.type==="paragraph"?(s.raw+=` +`+i.raw,s.text+=` +`+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):r.push(i),a=n.length!==t.length,t=t.substring(i.raw.length);continue}if(i=this.tokenizer.text(t)){t=t.substring(i.raw.length),s=r[r.length-1],s&&s.type==="text"?(s.raw+=` +`+i.raw,s.text+=` +`+i.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):r.push(i);continue}if(t){const l="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(l);break}else throw new Error(l)}}return this.state.top=!0,r}inline(t,r=[]){return this.inlineQueue.push({src:t,tokens:r}),r}inlineTokens(t,r=[]){let i,s,n,a=t,l,o,p;if(this.tokens.links){const c=Object.keys(this.tokens.links);if(c.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)c.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,l.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;t;)if(o||(p=""),o=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(c=>(i=c.call({lexer:this},t,r))?(t=t.substring(i.raw.length),r.push(i),!0):!1))){if(i=this.tokenizer.escape(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.tag(t)){t=t.substring(i.raw.length),s=r[r.length-1],s&&i.type==="text"&&s.type==="text"?(s.raw+=i.raw,s.text+=i.text):r.push(i);continue}if(i=this.tokenizer.link(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(i.raw.length),s=r[r.length-1],s&&i.type==="text"&&s.type==="text"?(s.raw+=i.raw,s.text+=i.text):r.push(i);continue}if(i=this.tokenizer.emStrong(t,a,p)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.codespan(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.br(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.del(t)){t=t.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.autolink(t)){t=t.substring(i.raw.length),r.push(i);continue}if(!this.state.inLink&&(i=this.tokenizer.url(t))){t=t.substring(i.raw.length),r.push(i);continue}if(n=t,this.options.extensions&&this.options.extensions.startInline){let c=1/0;const k=t.slice(1);let f;this.options.extensions.startInline.forEach(x=>{f=x.call({lexer:this},k),typeof f=="number"&&f>=0&&(c=Math.min(c,f))}),c<1/0&&c>=0&&(n=t.substring(0,c+1))}if(i=this.tokenizer.inlineText(n)){t=t.substring(i.raw.length),i.raw.slice(-1)!=="_"&&(p=i.raw.slice(-1)),o=!0,s=r[r.length-1],s&&s.type==="text"?(s.raw+=i.raw,s.text+=i.text):r.push(i);continue}if(t){const c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return r}}class _Renderer{constructor(t){X(this,"options");this.options=t||_defaults}code(t,r,i){var n;const s=(n=(r||"").match(/^\S*/))==null?void 0:n[0];return t=t.replace(/\n$/,"")+` +`,s?'
'+(i?t:escape$1(t,!0))+`
+`:"
"+(i?t:escape$1(t,!0))+`
+`}blockquote(t){return`
+${t}
+`}html(t,r){return t}heading(t,r,i){return`${t} +`}hr(){return`
+`}list(t,r,i){const s=r?"ol":"ul",n=r&&i!==1?' start="'+i+'"':"";return"<"+s+n+`> +`+t+" +`}listitem(t,r,i){return`
  • ${t}
  • +`}checkbox(t){return"'}paragraph(t){return`

    ${t}

    +`}table(t,r){return r&&(r=`${r}`),` + +`+t+` +`+r+`
    +`}tablerow(t){return` +${t} +`}tablecell(t,r){const i=r.header?"th":"td";return(r.align?`<${i} align="${r.align}">`:`<${i}>`)+t+` +`}strong(t){return`${t}`}em(t){return`${t}`}codespan(t){return`${t}`}br(){return"
    "}del(t){return`${t}`}link(t,r,i){const s=cleanUrl(t);if(s===null)return i;t=s;let n='
    ",n}image(t,r,i){const s=cleanUrl(t);if(s===null)return i;t=s;let n=`${i}0&&f.tokens[0].type==="paragraph"?(f.tokens[0].text=E+" "+f.tokens[0].text,f.tokens[0].tokens&&f.tokens[0].tokens.length>0&&f.tokens[0].tokens[0].type==="text"&&(f.tokens[0].tokens[0].text=E+" "+f.tokens[0].tokens[0].text)):f.tokens.unshift({type:"text",text:E+" "}):m+=E+" "}m+=this.parse(f.tokens,p),c+=this.renderer.listitem(m,A,!!x)}i+=this.renderer.list(c,l,o);continue}case"html":{const a=n;i+=this.renderer.html(a.text,a.block);continue}case"paragraph":{const a=n;i+=this.renderer.paragraph(this.parseInline(a.tokens));continue}case"text":{let a=n,l=a.tokens?this.parseInline(a.tokens):a.text;for(;s+1{const p=l[o].flat(1/0);i=i.concat(this.walkTokens(p,r))}):l.tokens&&(i=i.concat(this.walkTokens(l.tokens,r)))}}return i}use(...t){const r=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(i=>{const s={...i};if(s.async=this.defaults.async||s.async||!1,i.extensions&&(i.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){const a=r.renderers[n.name];a?r.renderers[n.name]=function(...l){let o=n.renderer.apply(this,l);return o===!1&&(o=a.apply(this,l)),o}:r.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const a=r[n.level];a?a.unshift(n.tokenizer):r[n.level]=[n.tokenizer],n.start&&(n.level==="block"?r.startBlock?r.startBlock.push(n.start):r.startBlock=[n.start]:n.level==="inline"&&(r.startInline?r.startInline.push(n.start):r.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(r.childTokens[n.name]=n.childTokens)}),s.extensions=r),i.renderer){const n=this.defaults.renderer||new _Renderer(this.defaults);for(const a in i.renderer){if(!(a in n))throw new Error(`renderer '${a}' does not exist`);if(a==="options")continue;const l=a,o=i.renderer[l],p=n[l];n[l]=(...c)=>{let k=o.apply(n,c);return k===!1&&(k=p.apply(n,c)),k||""}}s.renderer=n}if(i.tokenizer){const n=this.defaults.tokenizer||new _Tokenizer(this.defaults);for(const a in i.tokenizer){if(!(a in n))throw new Error(`tokenizer '${a}' does not exist`);if(["options","rules","lexer"].includes(a))continue;const l=a,o=i.tokenizer[l],p=n[l];n[l]=(...c)=>{let k=o.apply(n,c);return k===!1&&(k=p.apply(n,c)),k}}s.tokenizer=n}if(i.hooks){const n=this.defaults.hooks||new _Hooks;for(const a in i.hooks){if(!(a in n))throw new Error(`hook '${a}' does not exist`);if(a==="options")continue;const l=a,o=i.hooks[l],p=n[l];_Hooks.passThroughHooks.has(a)?n[l]=c=>{if(this.defaults.async)return Promise.resolve(o.call(n,c)).then(f=>p.call(n,f));const k=o.call(n,c);return p.call(n,k)}:n[l]=(...c)=>{let k=o.apply(n,c);return k===!1&&(k=p.apply(n,c)),k}}s.hooks=n}if(i.walkTokens){const n=this.defaults.walkTokens,a=i.walkTokens;s.walkTokens=function(l){let o=[];return o.push(a.call(this,l)),n&&(o=o.concat(n.call(this,l))),o}}this.defaults={...this.defaults,...s}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,r){return _Lexer.lex(t,r??this.defaults)}parser(t,r){return _Parser.parse(t,r??this.defaults)}}Y=new WeakSet,ke=function(t,r){return(i,s)=>{const n={...s},a={...this.defaults,...n};this.defaults.async===!0&&n.async===!1&&(a.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),a.async=!0);const l=be(this,K,Ce).call(this,!!a.silent,!!a.async);if(typeof i>"u"||i===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof i!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(i)+", string expected"));if(a.hooks&&(a.hooks.options=a),a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(i):i).then(o=>t(o,a)).then(o=>a.hooks?a.hooks.processAllTokens(o):o).then(o=>a.walkTokens?Promise.all(this.walkTokens(o,a.walkTokens)).then(()=>o):o).then(o=>r(o,a)).then(o=>a.hooks?a.hooks.postprocess(o):o).catch(l);try{a.hooks&&(i=a.hooks.preprocess(i));let o=t(i,a);a.hooks&&(o=a.hooks.processAllTokens(o)),a.walkTokens&&this.walkTokens(o,a.walkTokens);let p=r(o,a);return a.hooks&&(p=a.hooks.postprocess(p)),p}catch(o){return l(o)}}},K=new WeakSet,Ce=function(t,r){return i=>{if(i.message+=` +Please report this to https://github.com/markedjs/marked.`,t){const s="

    An error occurred:

    "+escape$1(i.message+"",!0)+"
    ";return r?Promise.resolve(s):s}if(r)return Promise.reject(i);throw i}};const markedInstance=new Marked;function marked(e,t){return markedInstance.parse(e,t)}marked.options=marked.setOptions=function(e){return markedInstance.setOptions(e),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.getDefaults=_getDefaults,marked.defaults=_defaults,marked.use=function(...e){return markedInstance.use(...e),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.walkTokens=function(e,t){return markedInstance.walkTokens(e,t)},marked.parseInline=markedInstance.parseInline,marked.Parser=_Parser,marked.parser=_Parser.parse,marked.Renderer=_Renderer,marked.TextRenderer=_TextRenderer,marked.Lexer=_Lexer,marked.lexer=_Lexer.lex,marked.Tokenizer=_Tokenizer,marked.Hooks=_Hooks,marked.parse=marked,marked.options,marked.setOptions,marked.use,marked.walkTokens,marked.parseInline,_Parser.parse,_Lexer.lex;function setThemeColors(e="#F0DAFB"){const t=new TinyColor(e).toHsl(),r={primary:t.h,primaryOffset:t.h-10,primaryOffsetHover:t.h+10},i=document.querySelector(":root");i.style.setProperty("--primary-background",`hsla(${r.primaryOffset}, 80%, 99%, 1)`),i.style.setProperty("--primary-primary",`hsla(${r.primary}, 100%, 35%, 1)`),i.style.setProperty("--primary-primary-subtle",`hsla(${r.primaryOffset}, 80%, 92%, 1)`),i.style.setProperty("--primary-primary-subtle-hover",`hsla(${r.primaryOffsetHover}, 80%, 89%, 1)`),i.style.setProperty("--primary-primary-alt",`hsla(${r.primary}, 38%, 21%, 1)`),i.style.setProperty("--primary-primary-alt-subtle",`hsla(${r.primaryOffset}, 23%, 91%, 1)`),i.style.setProperty("--gradient-background",`linear-gradient(0deg, hsla(${r.primary}, 100%, 35%, 0.05) 0%, hsla(${r.primary}, 0%, 0%, 0) 100%)`),i.style.setProperty("--gradient-gradient-fade",`linear-gradient(-0deg, hsla(${r.primaryOffset}, 80%, 99%, 0) 0%, hsla(${r.primaryOffset}, 80%, 99%, 1) 50%)`)}function createNode(e,t=null){const r=document.createElement("div");return r.className=e,t!==null&&(r.innerHTML=t),r}function createTextNode(e){let t=marked.parse(e);return createNode("message-content",t)}function createFileAttachmentNode(e,t){const r=` +
    `;return createNode("attachment",r)}function createImageNode(e,t){const r=` + ${e} + + Download Button + + `;return createNode("image-container",r)}function createTableNode(e,t){let r=createNode("table-container");if(t.length>1){(!e||!Array.isArray(e)||e.length==0)&&(e=Object.keys(t[0]));const i=document.createElement("table"),s=document.createElement("tr");e.forEach(n=>{const a=document.createElement("th"),l=document.createTextNode(n);a.appendChild(l),s.appendChild(a)}),i.appendChild(s),t.forEach(n=>{const a=document.createElement("tr");e.forEach(l=>{let o=n[l];const p=document.createElement("td"),c=document.createTextNode(o);p.appendChild(c),a.appendChild(p)}),i.appendChild(a)}),r.appendChild(i)}else{const i=document.createElement("h5");i.innerHTML="Table has no rows",r.appendChild(i)}return r}function highchartsPresent(){return typeof Highcharts<"u"}function configHighcharts(){highchartsPresent()&&Highcharts.setOptions({credits:{enabled:!1},title:{style:{fontSize:"12px",fontWeight:"normal"}},plotOptions:{series:{dataLabels:{style:{fontSize:"10px",fontWeight:"normal"}}}}})}function createHighchartsNode(e){if(highchartsPresent()){let t=createNode("high-chart-container");return Highcharts.chart(t,e),t}else return createTextNode("Highcharts is not loaded to render charts. Please check if its script tag is included in the page.")}const INITIAL_STATE=!1;configHighcharts();function loadLottie(e){return lottie.loadAnimation({container:e,renderer:"svg",loop:!0,autoplay:!0,animationData})}const main={selectorId:"",title:"",botName:"",greeting:"",init:function(e={}){return this.selectorId=e.selectorId,this.title=e.title,this.botName=e.botName,this.greeting=e.greeting,this.enableUpload=e.enableUpload??!1,this.uploadTypes=e.uploadTypes,this.generateUploadPreview=e.generateUploadPreview,setThemeColors(e.themeColor),this.render(e.submitHandler),e.preChatRenderer&&renderPreChat(e.preChatRenderer),this.toggle(e.expand||INITIAL_STATE),{toggle:this.toggle,isOpen:this.isOpen}},isOpen:function(){return document.querySelector("#tarka-chat .t-container").style.display==="flex"},toggle:function(e=void 0){const t=document.querySelector("#tarka-chat .t-container"),r=document.querySelector("#tarka-chat .closed"),i=document.querySelector("#tarka-chat .opened");e===!0||e===void 0&&!this.isOpen()?(t.style.display="flex",i.style.display="block",r.style.display="none"):(t.style.display="none",i.style.display="none",r.style.display="block")},render:function(e){const t=document.getElementById(this.selectorId);if(!t){console.error(`Element with ID "${this.selectorId}" not found.`);return}const r=async c=>{const k=this.createNode("upload-preview-item"),f=await this.generateUploadPreview(c);return k.appendChild(f),k},i=async c=>{const k=document.querySelector("#tarka-chat .t-container > .upload-preview-container");k.innerHTML="";const f=c.target.files,x=new DataTransfer;for(const A of f){if(this.uploadTypes&&!this.uploadTypes.includes(A.type))continue;const m=await r(A);m&&(k.appendChild(m),x.items.add(A))}x.files.length>0?k.style.display="flex":k.style.display="none",c.target.files=x.files},s=c=>{this.isProcessing=c;const k=document.querySelector("#tarka-chat .input-container");k.style.display=c?"none":"flex";const f=document.querySelector("#tarka-chat .t-container > .upload-preview-container");c&&(f.style.display="none");const x=document.querySelector("#tarka-chat .chat-loader");x.style.display=c?"block":"none"},n=async()=>{const c=document.querySelector("#tarka-chat .chat-input"),k=c.value;if(this.isProcessing||k.length===0)return;s(!0);const f=document.querySelector("#tarka-chat .upload-input"),x=[];if(this.enableUpload&&f.files.length>0){const E={type:"thumbnails",nodes:[]};for(const d of f.files){x.push(d);const g=await this.generateUploadPreview(d);E.nodes.push(g)}this.insertMessage([k,E],!1)}else this.insertMessage(k,!1);const A=await e(k,x);this.insertMessage(A,!0),s(!1);const m=document.querySelector("#tarka-chat .t-container > .upload-preview-container");m&&(m.style.display="none"),c.value="",f.value="",c.focus()};t.innerHTML=layout,this.setupLaucher(),loadLottie(document.querySelector("#tarka-chat .logo")),document.querySelector("#tarka-chat .title").textContent=this.title,this.insertMessage(this.greeting,!0);const a=document.querySelector("#tarka-chat .upload-btn"),l=document.querySelector("#tarka-chat .upload-input"),o=document.querySelector("#tarka-chat .send-btn"),p=document.querySelector("#tarka-chat .chat-input");this.enableUpload&&(a.style.display="block",a.disabled=!1,a.addEventListener("click",()=>l==null?void 0:l.click()),l.addEventListener("change",i)),o.addEventListener("click",n),p.addEventListener("keyup",async function(c){c.keyCode===13&&await n()})},setupLaucher:function(){document.querySelector("#tarka-chat .launcher").addEventListener("click",()=>this.toggle());const t=document.querySelector("#tarka-chat .closed");loadLottie(t)},createNode(e,t=null){const r=document.createElement("div");return r.className=e,t!==null&&(r.innerHTML=t),r},validateFieldPresent(e,t){if(!(e in t))throw new Error(`'${e}' is mandatory in ${JSON.stringify(t)}`)},createNodeByType(e){switch(typeof e=="string"&&(e={type:"text",message:e}),this.validateFieldPresent("type",e),e.type){case"text":return createTextNode(e.message);case"file":return this.validateFieldPresent("link",e),this.validateFieldPresent("name",e),createFileAttachmentNode(e.name,e.link);case"image":return this.validateFieldPresent("link",e),createImageNode(e.name,e.link);case"table":return this.validateFieldPresent("table_data",e),createTableNode(e.table_data.header,e.table_data.rows);case"highchart-config":return this.validateFieldPresent("high_chart_config",e),createHighchartsNode(e.high_chart_config);case"thumbnails":this.validateFieldPresent("nodes",e);const t=this.createNode("upload-preview-container");return t.style.display="flex",e.nodes.forEach(r=>{const i=this.createNode("upload-preview-item");i.appendChild(r),t.appendChild(i)}),t;default:throw new Error(`Invalid type: ${type}`)}},insertMessage(e="",t=!1){const r=document.querySelector("#tarka-chat .message-container"),i=this.createNode("wrapper");Array.isArray(e)?e.forEach(n=>{i.appendChild(this.createNodeByType(content))}):(typeof e=="string"||typeof e=="object")&&i.appendChild(this.createNodeByType(e)),i.appendChild(this.createNode("message-meta",t?this.botName:"You"));const s=this.createNode(`message ${t?"incoming":"outgoing"}`);s.appendChild(i),r.appendChild(s),r.lastElementChild.scrollIntoView()}};return main}); diff --git a/package.json b/package.json index 0366203..0be5b8d 100644 --- a/package.json +++ b/package.json @@ -1,20 +1,26 @@ { "name": "tarka-chat", "private": true, - "version": "0.0.1", + "version": "2.4.0", "type": "module", + "repository": { + "type": "git", + "url": "https://github.com/tarkalabs/tarka-chat" + }, "scripts": { "dev": "vite", "build": "vite build", "preview": "vite preview" }, "devDependencies": { + "prettier": "3.2.5", + "sass": "^1.68.0", "vite": "^4.4.5", - "vite-plugin-css-injected-by-js": "^3.3.0", - "sass": "^1.68.0" + "vite-plugin-css-injected-by-js": "^3.3.0" }, "dependencies": { "@ctrl/tinycolor": "^4.0.2", - "lottie-web": "^5.12.2" + "lottie-web": "^5.12.2", + "marked": "^12.0.1" } } diff --git a/src/highcharts.js b/src/highcharts.js new file mode 100644 index 0000000..8602937 --- /dev/null +++ b/src/highcharts.js @@ -0,0 +1,43 @@ +import { createNode, createTextNode } from "./utils"; + +export function highchartsPresent() { + return typeof Highcharts != "undefined"; +} + +export function configHighcharts() { + if (highchartsPresent()) { + Highcharts.setOptions({ + credits: { + enabled: false, + }, + title: { + style: { + fontSize: "12px", + fontWeight: "normal", + }, + }, + plotOptions: { + series: { + dataLabels: { + style: { + fontSize: "10px", + fontWeight: "normal", + }, + }, + }, + }, + }); + } +} + +export function createHighchartsNode(config) { + if (highchartsPresent()) { + let ele = createNode("high-chart-container"); + Highcharts.chart(ele, config); + return ele; + } else { + return createTextNode( + "Highcharts is not loaded to render charts. Please check if its script tag is included in the page.", + ); + } +} diff --git a/src/images/attachment.png b/src/images/attachment.png new file mode 100644 index 0000000..a6bf603 Binary files /dev/null and b/src/images/attachment.png differ diff --git a/src/images/download.png b/src/images/download.png new file mode 100644 index 0000000..a8a8403 Binary files /dev/null and b/src/images/download.png differ diff --git a/src/layout.html b/src/layout.html index 34b6714..a186d79 100644 --- a/src/layout.html +++ b/src/layout.html @@ -10,6 +10,13 @@