├── README.md ├── bascevir.gif ├── bascevir.js ├── contextMenus.js ├── icons ├── 128.png ├── 256.png ├── 512.png ├── 64.png └── 750.png ├── manifest.json └── svg.min.js /README.md: -------------------------------------------------------------------------------- 1 | ![](icons/128.png) 2 | 3 | ### açıklama 4 | 5 | _bascevir_, seçilen kelime/cümle için çeviri yapan bir eklentidir. Yabancı bir dilde okuma yaparken anlamadığınız bir cümle veya kelimeyi CTRL tuşuna basarak seçerseniz kelimenin _google translate_ çevirisini küçük bir baloncukta gösterecektir. 6 | 7 | 8 | ### örnek kullanım 9 | 10 | ![](bascevir.gif) 11 | 12 | ### kullanım tavsiyeleri 13 | 14 | Bir çok site üzerinde sağlıklı çalışıyor fakat en ideal kullanım için [Pocket](https://getpocket.com) üzerinde kullanılmasını tavsiye ediyorum. 15 | 16 | > Dil öğrenenler için: eklentiyi çeviri aracı olarak değil yazının bağlamından kopmamak için yardımcı bir araç olarak kullanın. Bir çok kelime için çeviri karşılığı doğru olmayabilir. Kelime öğrenmek için mutlaka sözlükten anlamına bakınız. 17 | 18 | 19 | ### uyarı 20 | 21 | Bu eklenti herhangi bir anahtar gerektirmeyen _google translate single api_ kullanmaktadır. Kurulum için herhangi bir tanımlama yapmanız gerekmez. Kullanım esnasında arka arkaya sık çeviri yapmamalısınız, aksi halde _google_ tarafından bu api için bir kaç saatliğine engellenebilirsiniz. 22 | 23 | 24 | 25 | ### eklenti bağlantıları 26 | 27 | [bascevir – 🦊 Firefox](https://addons.mozilla.org/en-US/firefox/addon/bascevir/) 28 | 29 | ### yapılacaklar 30 | 31 | - [ ] Dil seçenekleri 32 | 33 | ### katkı için 34 | 35 | Karşılaştığınız bir hatayı [issue açarak](https://github.com/selmansamet/bascevir/issues/new) bildirebilirsiniz 💃 36 | -------------------------------------------------------------------------------- /bascevir.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sametcodes/bascevir/ee4410e793c942cf84bf2cd0bc40fa8aed002349/bascevir.gif -------------------------------------------------------------------------------- /bascevir.js: -------------------------------------------------------------------------------- 1 | const linkCreator = { 2 | cambridge: (sl, tl, word) => `https://dictionary.cambridge.org/dictionary/${sl}-${tl}/${word}`, 3 | tureng: (sl, tl, word) => `https://tureng.com/en/${tl}-${sl}/${word}` 4 | } 5 | 6 | const getWord = (sl, tl, q) => { 7 | q = q.replace(/(\.|\?|,)/g, ""); 8 | return fetch(`https://translate.googleapis.com/translate_a/single?client=gtx&sl=${sl}&tl=${tl}&dt=t&q=${encodeURI(q)}`) 9 | .then(res => res.ok ? res.json() : res.text()); 10 | } 11 | 12 | const createPopup = (id, word, text, x, y, clientWidth) => { 13 | let offsetX = 350 - x; 14 | let r = x > (clientWidth / 2) ? 1 : -1; 15 | if (r === 1) { 16 | offsetX = clientWidth - offsetX; 17 | } 18 | 19 | const popup = document.createElement("div"); 20 | popup.setAttribute("id", id); 21 | popup.setAttribute("style",` 22 | top:${y}px; 23 | left:${y}px; 24 | width:0px; 25 | height:0px; 26 | position:absolute; 27 | z-index:5; 28 | user-select:none;`); 29 | 30 | const box = document.createElement("div"); 31 | box.setAttribute("class", "box"); 32 | box.setAttribute("style",` 33 | display:inline; 34 | max-width:300px; 35 | width:max-content; 36 | position:absolute; 37 | margin-top:-5px; 38 | z-index:0;`); 39 | 40 | const link = document.createElement("a"); 41 | link.href = `https://translate.google.com/#view=home&op=translate&sl=en&tl=tr&text=${word}`; 42 | link.target = "_blank"; 43 | link.style.outline = "0"; 44 | 45 | const content = document.createElement("span"); 46 | content.innerText = text; 47 | content.setAttribute("class", "onetap-content"); 48 | content.setAttribute("style",` 49 | border-radius: 5px 0px 0px 5px; 50 | padding: 10px 20px; 51 | background-color: #333; 52 | font-size: 18px; 53 | font-family: Open Sans; 54 | color: #fff; 55 | display: inline-block;`); 56 | 57 | link.appendChild(content); 58 | 59 | const removeButton = document.createElement("div"); 60 | removeButton.onclick = _ => 61 | removeHighlight(document.querySelectorAll(`span.${id}`)); 62 | removeButton.className = "highlight-remove-button"; 63 | removeButton.setAttribute("style",` 64 | position: absolute; 65 | height: 50%; 66 | width: 20px; 67 | top: 0; 68 | right: -20px; 69 | text-align: center; 70 | color: #fff; 71 | background-color: rgb(216, 76, 76); 72 | border-radius: 0px 5px 0px 0px; 73 | font-size: 14px;`); 74 | 75 | const infoButton = document.createElement("div"); 76 | infoButton.onclick = _ => goDictionary(id, word); 77 | infoButton.className = "highlight-info-button"; 78 | infoButton.setAttribute("style",` 79 | position: absolute; 80 | height: 50%; 81 | width: 20px; 82 | top: 50%; 83 | right: -20px; 84 | text-align: center; 85 | color: #fff; 86 | background-color: rgb(0, 108, 255); 87 | border-radius: 0px 0px 5px 0px; 88 | font-size: 14px;`); 89 | 90 | box.appendChild(link) 91 | box.appendChild(removeButton) 92 | box.appendChild(infoButton) 93 | 94 | popup.appendChild(box); 95 | document.body.appendChild(popup); 96 | 97 | box.style.left = (offsetX - (Number(r === -1) * box.clientWidth)) + "px"; 98 | 99 | var draw = SVG().addTo(`#${id}`).size(offsetX, 16) 100 | draw.node.style.overflow = "visible"; 101 | var line = draw.polyline([0, 0, 10 * r, 10, offsetX, 10]); 102 | line.stroke({ color: '#ccc', width: 3 }).fill("none"); 103 | } 104 | 105 | const injectHighlight = (selection, id) => { 106 | let {anchorOffset: start, focusOffset: end} = selection; 107 | if(start > end){ 108 | [start, end] = [end, start] 109 | } 110 | 111 | let parentElement = selection.anchorNode.parentElement; 112 | 113 | const highlight = Array.from(selection.anchorNode.textContent).map((_, key) => { 114 | if(key === start){ 115 | return `${_}` 116 | } 117 | if(key === end){ 118 | return `${_.trim("")} ` 119 | } 120 | return _; 121 | }).filter(Boolean).join(""); 122 | 123 | parentElement.innerHTML = parentElement.innerHTML.replace(selection.anchorNode.textContent, highlight); 124 | 125 | let {top, left, width, height} = document.querySelector(`span.${id}`).getBoundingClientRect(); 126 | if((left + window.pageXOffset + width) < document.body.clientWidth/2){ 127 | width = 0; 128 | } 129 | 130 | const willRemoveHighlights = Array.from(document.querySelectorAll("span.onetap-highlight")) 131 | .filter(el => el.getBoundingClientRect().top === top) 132 | .filter(el => el.classList[0] !== id); 133 | 134 | removeHighlight(willRemoveHighlights); 135 | 136 | return { x: left + window.pageXOffset + width, y: top + window.pageYOffset + height - 5, } 137 | } 138 | 139 | const removeHighlight = (nodes) => { 140 | for(let el of nodes){ 141 | let parentElement = el.parentElement 142 | el.outerHTML = el.innerText; 143 | parentElement = parentElement.innerHTML.replace(/\n/gm, "") 144 | let div = document.querySelector(`div#${el.classList[0]}`); 145 | if(div){ div.remove() } 146 | } 147 | } 148 | 149 | const goDictionary = (id, word, sourcelang="english", targetlang="turkish") => { 150 | browser.storage.sync.get('activeDictId').then(value => { 151 | const activeDict = value.activeDictId; 152 | if(activeDict && activeDict in linkCreator){ 153 | const link = linkCreator[activeDict](sourcelang, targetlang, word) 154 | window.open(link, '_blank').focus(); 155 | return; 156 | } 157 | }) 158 | } 159 | 160 | 161 | document.addEventListener("click", event => { 162 | if(!event.ctrlKey) { 163 | browser.storage.sync.get('permanentBoxesValue') 164 | .then(({permanentBoxesValue}) => { 165 | const exclude_classnames = ["onetap-content", "highlight-info-button"]; 166 | if(!permanentBoxesValue && !Array.from(event.target.classList).some(_class => exclude_classnames.includes(_class))){ 167 | removeHighlight(document.querySelectorAll('span.onetap-highlight')) 168 | } 169 | }) 170 | return 171 | } 172 | 173 | const selection = window.getSelection(); 174 | const word = selection.toString(); 175 | if(!word){ return }; 176 | 177 | const id = "h" + Math.random().toString(36).substring(7); 178 | const {x, y} = injectHighlight(selection, id) 179 | getWord("en", "tr", word).then(([[[meaning]]]) => { 180 | createPopup(id, word, meaning, x, y, document.body.clientWidth) 181 | }).catch(console.log) 182 | }); 183 | -------------------------------------------------------------------------------- /contextMenus.js: -------------------------------------------------------------------------------- 1 | const dicts = [{ 2 | id: "cambridge", 3 | title: "Cambridge Dictionary", 4 | }, { 5 | id: "tureng", 6 | title: "Tureng" 7 | }]; 8 | 9 | function onCreated() { 10 | if (browser.runtime.lastError) { 11 | console.log(`Error: ${browser.runtime.lastError}`); 12 | } else { 13 | console.log("Item created successfully"); 14 | } 15 | }; 16 | 17 | browser.contextMenus.onClicked.addListener((info, tab) => { 18 | if(dicts.map(dict => dict.id).includes(info.menuItemId)){ 19 | browser.storage.sync.set({ 20 | activeDictId: info.menuItemId 21 | }) 22 | } 23 | if(info.menuItemId === "permanentBoxes"){ 24 | browser.storage.sync.set({ 25 | permanentBoxesValue: info.checked 26 | }) 27 | } 28 | }) 29 | 30 | browser.storage.sync.get(['activeDictId', 'permanentBoxesValue']).then(values => { 31 | let { activeDictId, permanentBoxesValue } = values; 32 | if(!activeDictId || !dicts.map(dict => dict.id).includes(activeDictId)){ 33 | activeDictId = dicts[0].id; 34 | browser.storage.sync.set({ activeDictId: dicts[0].id }) 35 | } 36 | if(permanentBoxesValue === null){ 37 | permanentBoxes = true; 38 | browser.storage.sync.set({ permanentBoxesValue: true }) 39 | } 40 | 41 | for(var dict of dicts){ 42 | browser.contextMenus.create({ 43 | id: dict.id, 44 | type: "radio", 45 | title: dict.title, 46 | contexts: ["all"], 47 | checked: dict.id === activeDictId 48 | }, onCreated); 49 | } 50 | browser.contextMenus.create({ 51 | id: "separator-1", 52 | type: "separator", 53 | contexts: ["all"] 54 | }, onCreated); 55 | 56 | browser.contextMenus.create({ 57 | id: "permanentBoxes", 58 | type: "checkbox", 59 | title: "Çeviriler sayfa üzerinde kalsın", 60 | contexts: ["all"], 61 | checked: permanentBoxesValue 62 | }, onCreated); 63 | }) 64 | -------------------------------------------------------------------------------- /icons/128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sametcodes/bascevir/ee4410e793c942cf84bf2cd0bc40fa8aed002349/icons/128.png -------------------------------------------------------------------------------- /icons/256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sametcodes/bascevir/ee4410e793c942cf84bf2cd0bc40fa8aed002349/icons/256.png -------------------------------------------------------------------------------- /icons/512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sametcodes/bascevir/ee4410e793c942cf84bf2cd0bc40fa8aed002349/icons/512.png -------------------------------------------------------------------------------- /icons/64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sametcodes/bascevir/ee4410e793c942cf84bf2cd0bc40fa8aed002349/icons/64.png -------------------------------------------------------------------------------- /icons/750.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sametcodes/bascevir/ee4410e793c942cf84bf2cd0bc40fa8aed002349/icons/750.png -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "bascevir", 4 | "version": "1.4", 5 | "description": "Get the meaning of words that you don't know when reading. It will help you stay on the page.", 6 | "icons": { 7 | "64": "icons/64.png", 8 | "128": "icons/128.png", 9 | "256": "icons/256.png", 10 | "512": "icons/512.png" 11 | }, 12 | "background": { 13 | "scripts": ["contextMenus.js"] 14 | }, 15 | "content_scripts": [ 16 | { 17 | "matches": [""], 18 | "js": ["bascevir.js", "svg.min.js"] 19 | } 20 | ], 21 | "permissions": [ 22 | "webRequest", 23 | "", 24 | "storage", 25 | "activeTab", 26 | "contextMenus" 27 | ], 28 | "applications": { 29 | "gecko": { 30 | "id": "{27931dcf-51ad-4fc4-9824-654e97b4d464}" 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /svg.min.js: -------------------------------------------------------------------------------- 1 | /*! @svgdotjs/svg.js v3.0.13 MIT*/; 2 | var SVG=function(){"use strict";function t(t,e){return t(e={exports:{}},e.exports),e.exports}var m=t(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),y=t(function(t){var e=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=e)}),g=function(t){return"object"==typeof t?null!==t:"function"==typeof t},p=function(t){if(!g(t))throw TypeError(t+" is not an object!");return t},w=function(t){try{return!!t()}catch(t){return!0}},o=!w(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),e=m.document,n=g(e)&&g(e.createElement),r=function(t){return n?e.createElement(t):{}},i=!o&&!w(function(){return 7!=Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a}),l=function(t,e){if(!g(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!g(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!g(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!g(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},s=Object.defineProperty,a={f:o?Object.defineProperty:function(t,e,n){if(p(t),e=l(e,!0),p(n),i)try{return s(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},k=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},x=o?function(t,e,n){return a.f(t,e,k(1,n))}:function(t,e,n){return t[e]=n,t},u={}.hasOwnProperty,h=function(t,e){return u.call(t,e)},c=0,f=Math.random(),v=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++c+f).toString(36))},O=t(function(t){var s=v("src"),e="toString",n=Function[e],o=(""+n).split(e);y.inspectSource=function(t){return n.call(t)},(t.exports=function(t,e,n,r){var i="function"==typeof n;i&&(h(n,"name")||x(n,"name",e)),t[e]!==n&&(i&&(h(n,s)||x(n,s,t[e]?""+t[e]:o.join(String(e)))),t===m?t[e]=n:r?t[e]?t[e]=n:x(t,e,n):(delete t[e],x(t,e,n)))})(Function.prototype,e,function(){return"function"==typeof this&&this[s]||n.call(this)})}),d=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t},_=function(r,i,t){if(d(r),void 0===i)return r;switch(t){case 1:return function(t){return r.call(i,t)};case 2:return function(t,e){return r.call(i,t,e)};case 3:return function(t,e,n){return r.call(i,t,e,n)}}return function(){return r.apply(i,arguments)}},b="prototype",S=function(t,e,n){var r,i,s,o,u=t&S.F,a=t&S.G,h=t&S.S,l=t&S.P,c=t&S.B,f=a?m:h?m[e]||(m[e]={}):(m[e]||{})[b],v=a?y:y[e]||(y[e]={}),d=v[b]||(v[b]={});for(r in a&&(n=e),n)s=((i=!u&&f&&void 0!==f[r])?f:n)[r],o=c&&i?_(s,m):l&&"function"==typeof s?_(Function.call,s):s,f&&O(f,r,s,t&S.U),v[r]!=s&&x(v,r,o),l&&d[r]!=s&&(d[r]=s)};m.core=y,S.F=1,S.G=2,S.S=4,S.P=8,S.B=16,S.W=32,S.U=64,S.R=128;var M=S,E={}.toString,T=function(t){return E.call(t).slice(8,-1)},j=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==T(t)?t.split(""):Object(t)},C=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},N=function(t){return j(C(t))},P=Math.ceil,I=Math.floor,L=function(t){return isNaN(t=+t)?0:(0i;)h(r,n=e[i++])&&(~H(s,n)||s.push(n));return s},W="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),Q=Object.keys||function(t){return U(t,W)},$={f:Object.getOwnPropertySymbols},J={f:{}.propertyIsEnumerable},Z=function(t){return Object(C(t))},K=Object.assign,tt=!K||w(function(){var A={},e={},t=Symbol(),n="abcdefghijklmnopqrst";return A[t]=7,n.split("").forEach(function(t){e[t]=t}),7!=K({},A)[t]||Object.keys(K({},e)).join("")!=n})?function(t,e){for(var n=Z(t),r=arguments.length,i=1,s=$.f,o=J.f;idocument.F=Object<\/script>"),t.close(),gt=t.F;n--;)delete gt[mt][W[n]];return gt()},wt=Object.create||function(t,e){var n;return null!==t?(pt[mt]=p(t),n=new pt,pt[mt]=null,n[yt]=t):n=gt(),void 0===e?n:ft(n,e)},_t=a.f,bt=ot("toStringTag"),kt=function(t,e,n){t&&!h(t=n?t:t.prototype,bt)&&_t(t,bt,{configurable:!0,value:e})},xt={};x(xt,ot("iterator"),function(){return this});var Ot=V("IE_PROTO"),St=Object.prototype,Mt=Object.getPrototypeOf||function(t){return t=Z(t),h(t,Ot)?t[Ot]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?St:null},At=ot("iterator"),Et=!([].keys&&"next"in[].keys()),Tt="values",jt=function(){return this},Ct=function(t,e,n,r,i,s,o){var u,a,h;a=e,h=r,(u=n).prototype=wt(xt,{next:k(1,h)}),kt(u,a+" Iterator");var l,c,f,v=function(t){if(!Et&&t in m)return m[t];switch(t){case"keys":case Tt:return function(){return new n(this,t)}}return function(){return new n(this,t)}},d=e+" Iterator",y=i==Tt,p=!1,m=t.prototype,g=m[At]||m["@@iterator"]||i&&m[i],w=g||v(i),_=i?y?v("entries"):w:void 0,b="Array"==e&&m.entries||g;if(b&&(f=Mt(b.call(new t)))!==Object.prototype&&f.next&&(kt(f,d,!0),"function"!=typeof f[At]&&x(f,At,jt)),y&&g&&g.name!==Tt&&(p=!0,w=function(){return g.call(this)}),(Et||p||!m[At])&&x(m,At,w),ct[e]=w,ct[d]=jt,i)if(l={values:y?w:v(Tt),keys:s?w:v("keys"),entries:_},o)for(c in l)c in m||O(m,c,l[c]);else M(M.P+M.F*(Et||p),e,l);return l},Nt=Ct(Array,"Array",function(t,e){this._t=N(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,lt(1)):lt(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])},"values");ct.Arguments=ct.Array,ht("keys"),ht("values"),ht("entries");var Pt,It=(Pt=!0,function(t,e){var n,r,i=String(C(t)),s=L(e),o=i.length;return s<0||o<=s?Pt?"":void 0:(n=i.charCodeAt(s))<55296||56319=e.length?{value:void 0,done:!0}:(t=It(e,n),this._i+=t.length,{value:t,done:!1})});var Lt=function(t,e,n){for(var r in e)O(t,r,e[r],n);return t},Ft=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t},Rt=function(e,t,n,r){try{return r?t(p(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&p(i.call(e)),t}},Dt=ot("iterator"),zt=Array.prototype,qt=ot("toStringTag"),Yt="Arguments"==T(function(){return arguments}()),Xt=ot("iterator"),Gt=y.getIteratorMethod=function(t){if(null!=t)return t[Xt]||t["@@iterator"]||ct[(e=t,void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(n=Object(e),qt))?r:Yt?T(n):"Object"==(i=T(n))&&"function"==typeof n.callee?"Arguments":i)];var e,n,r,i},Vt=t(function(t){var v={},d={},e=t.exports=function(t,e,n,r,i){var s,o,u,a,h,l=i?function(){return t}:Gt(t),c=_(n,r,e?2:1),f=0;if("function"!=typeof l)throw TypeError(t+" is not iterable!");if(void 0===(h=l)||ct.Array!==h&&zt[Dt]!==h){for(u=l.call(t);!(o=u.next()).done;)if((a=Rt(u,c,o.value,e))===v||a===d)return a}else for(s=R(t.length);fo;)s.call(t,r=i[o++])&&e.push(r);return e}(e=N(e)),i=0,s=r.length;ii;)h(Te,e=n[i++])||e==Se||e==me||r.push(e);return r},Ge=function(t){for(var e,n=t===Ce,r=_e(n?je:N(t)),i=[],s=0;r.length>s;)!h(Te,e=r[s++])||n&&!h(Ce,e)||i.push(Te[e]);return i};Ne||(O((be=function(){if(this instanceof be)throw TypeError("Symbol is not a constructor!");var e=v(0He;)ot(Ve[He++]);for(var Be=Q(ot.store),Ue=0;Be.length>Ue;)he(Be[Ue++]);M(M.S+M.F*!Ne,"Symbol",{for:function(t){return h(Ee,t+="")?Ee[t]:Ee[t]=be(t)},keyFor:function(t){if(!Re(t))throw TypeError(t+" is not a symbol!");for(var e in Ee)if(Ee[e]===t)return e},useSetter:function(){Ie=!0},useSimple:function(){Ie=!1}}),M(M.S+M.F*!Ne,"Object",{create:function(t,e){return void 0===e?wt(t):ze(wt(t),e)},defineProperty:De,defineProperties:ze,getOwnPropertyDescriptor:Ye,getOwnPropertyNames:Xe,getOwnPropertySymbols:Ge}),ke&&M(M.S+M.F*(!Ne||w(function(){var t=be();return"[null]"!=xe([t])||"{}"!=xe({a:t})||"{}"!=xe(Object(t))})),"JSON",{stringify:function(t){for(var e,n,r=[t],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=e=r[1],(g(e)||void 0!==t)&&!Re(t))return le(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!Re(e))return e}),r[1]=e,xe.apply(ke,r)}}),be[Oe][Me]||x(be[Oe],Me,be[Oe].valueOf),kt(be,"Symbol"),kt(Math,"Math",!0),kt(m.JSON,"JSON",!0);for(var We=ot("iterator"),Qe=ot("toStringTag"),$e=ct.Array,Je={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},Ze=Q(Je),Ke=0;Ke>>0,f=new RegExp(t.source,h+"g");for(g||(r=new RegExp("^"+f.source+"$(?!\\s)",h));(i=f.exec(n))&&!(l<(s=i.index+i[0][p])&&(a.push(n.slice(l,i.index)),!g&&1=c));)f[m]===i.index&&f[m]++;return l===n[p]?!o&&f.test("")||a.push(""):a.push(n.slice(l)),a[p]>c?a.slice(0,c):a}}else"0"[t](void 0,0)[p]&&(o=function(t,e){return void 0===t&&0===e?[]:d.call(this,t,e)});return[function(t,e){var n=i(this),r=null==t?void 0:t[s];return void 0!==r?r.call(t,n,e):o.call(String(n),t,e)},o]});var Un=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,Wn=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Qn=/rgb\((\d+),(\d+),(\d+)\)/,$n=/(#[a-z0-9\-_]+)/i,Jn=/\)\s*,?\s*/,Zn=/\s/g,Kn=/^#[a-f0-9]{3,6}$/i,tr=/^rgb\(/,er=/^(\s+)?$/,nr=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,rr=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,ir=/[\s,]+/,sr=/([^e])-/gi,or=/[MLHVCSQTAZ]/gi,ur=/[MLHVCSQTAZ]/i,ar=/((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi,hr=/\./g,lr={numberAndUnit:Un,hex:Wn,rgb:Qn,reference:$n,transforms:Jn,whitespace:Zn,isHex:Kn,isRgb:tr,isCss:/[^:]+:[^;]+;?/,isBlank:er,isNumber:nr,isPercent:/^-?[\d.]+%$/,isImage:rr,delimiter:ir,hyphen:sr,pathLetters:or,isPathLetter:ur,numbersWithDots:ar,dots:hr};an("Dom",{classes:function(){var t=this.attr("class");return null==t?[]:t.trim().split(ir)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){var e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(e){return this.hasClass(e)&&this.attr("class",this.classes().filter(function(t){return t!==e}).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)}}),an("Dom",{css:function(t,e){var n={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter(function(t){return!!t.length}).forEach(function(t){var e=t.split(/\s*:\s*/);n[e[0]]=e[1]}),n;if(arguments.length<2){if(Array.isArray(t)){var r=!0,i=!1,s=void 0;try{for(var o,u=t[Symbol.iterator]();!(r=(o=u.next()).done);r=!0){var a=wn(o.value);n[a]=this.node.style[a]}}catch(t){i=!0,s=t}finally{try{r||null==u.return||u.return()}finally{if(i)throw s}}return n}if("string"==typeof t)return this.node.style[wn(t)];if("object"===st(t))for(var h in t)this.node.style[wn(h)]=null==t[h]||er.test(t[h])?"":t[h]}return 2===arguments.length&&(this.node.style[wn(t)]=null==e||er.test(e)?"":e),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),an("Dom",{data:function(e,t,n){if("object"===st(e))for(t in e)this.data(t,e[t]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+e))}catch(t){return this.attr("data-"+e)}else this.attr("data-"+e,null===t?null:!0===n||"string"==typeof t||"number"==typeof t?t:JSON.stringify(t));return this}}),an("Dom",{remember:function(t,e){if("object"===st(t))for(var n in t)this.remember(n,t[n]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=e}return this},forget:function(){if(0===arguments.length)this._memory={};else for(var t=arguments.length-1;0<=t;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory=this._memory||{}}});var cr=0,fr={};function vr(t){var e=t.getEventHolder();return e===jn.window&&(e=fr),e.events||(e.events={}),e.events}function dr(t){return t.getEventTarget()}function yr(t,e,r,n,i){var s=r.bind(n||t),o=Fn(t),u=vr(o),a=dr(o);e=Array.isArray(e)?e:e.split(ir),r._svgjsListenerId||(r._svgjsListenerId=++cr),e.forEach(function(t){var e=t.split(".")[0],n=t.split(".")[1]||"*";u[e]=u[e]||{},u[e][n]=u[e][n]||{},u[e][n][r._svgjsListenerId]=s,a.addEventListener(e,s,i||!1)})}function pr(t,e,o,u){var a=Fn(t),h=vr(a),l=dr(a);("function"!=typeof o||(o=o._svgjsListenerId))&&(e=Array.isArray(e)?e:(e||"").split(ir)).forEach(function(t){var e,n,r,i=t&&t.split(".")[0],s=t&&t.split(".")[1];if(o)h[i]&&h[i][s||"*"]&&(l.removeEventListener(i,h[i][s||"*"][o],u||!1),delete h[i][s||"*"][o]);else if(i&&s){if(h[i]&&h[i][s]){for(n in h[i][s])pr(l,[i,s].join("."),n);delete h[i][s]}}else if(s)for(t in h)for(e in h[t])s===e&&pr(l,[t,s].join("."));else if(i){if(h[i]){for(e in h[i])pr(l,[i,e].join("."));delete h[i]}}else{for(t in h)pr(l,t);(r=a.getEventHolder()).events&&(r.events={})}})}function mr(t,e,n){var r=dr(t);return e instanceof jn.window.Event||(e=new jn.window.CustomEvent(e,{detail:n,cancelable:!0})),r.dispatchEvent(e),e}function gr(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,i=!1,s=void 0;try{for(var o,u=t[Symbol.iterator]();!(r=(o=u.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(t){i=!0,s=t}finally{try{r||null==u.return||u.return()}finally{if(i)throw s}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function wr(t,e){for(var n=0;nv?Math.pow(l,3):(l-f)/7.787),e=1*(Math.pow(h,3)>v?Math.pow(h,3):(h-f)/7.787),n=1.08883*(Math.pow(c,3)>v?Math.pow(c,3):(c-f)/7.787)}var d=3.2406*t+-1.5372*e+-.4986*n,y=-.9689*t+1.8758*e+.0415*n,p=.0557*t+-.204*e+1.057*n,m=Math.pow,g=.0031308;return new j(255*(gsi;si++)h(Zr,ri=ii[si])&&!h(Jr,ri)&&Wr(Jr,ri,Ur(Zr,ri));(Jr.prototype=Kr).constructor=Jr,O(m,$r,Jr)}var oi=function(){function t(){Cn(this,t),this.init.apply(this,arguments)}return _r(t,[{key:"init",value:function(t,e){var n,r=0,i=0;return n=Array.isArray(t)?{x:t[0],y:t[1]}:"object"===st(t)?{x:t.x,y:t.y}:{x:t,y:e},this.x=null==n.x?r:n.x,this.y=null==n.y?i:n.y,this}},{key:"clone",value:function(){return new t(this)}},{key:"transform",value:function(t){return this.clone().transformO(t)}},{key:"transformO",value:function(t){ai.isMatrixLike(t)||(t=new ai(t));var e=this.x,n=this.y;return this.x=t.a*e+t.c*n+t.e,this.y=t.b*e+t.d*n+t.f,this}},{key:"toArray",value:function(){return[this.x,this.y]}}]),t}();function ui(t,e,n){return Math.abs(e-t)<(n||1e-6)}var ai=function(){function h(){Cn(this,h),this.init.apply(this,arguments)}return _r(h,[{key:"init",value:function(t){var e=h.fromArray([1,0,0,1,0,0]);return t=t instanceof Element?t.matrixify():"string"==typeof t?h.fromArray(t.split(ir).map(parseFloat)):Array.isArray(t)?h.fromArray(t):"object"===st(t)&&h.isMatrixLike(t)?t:"object"===st(t)?(new h).transform(t):6===arguments.length?h.fromArray([].slice.call(arguments)):e,this.a=null!=t.a?t.a:e.a,this.b=null!=t.b?t.b:e.b,this.c=null!=t.c?t.c:e.c,this.d=null!=t.d?t.d:e.d,this.e=null!=t.e?t.e:e.e,this.f=null!=t.f?t.f:e.f,this}},{key:"clone",value:function(){return new h(this)}},{key:"transform",value:function(t){if(h.isMatrixLike(t))return new h(t).multiplyO(this);var e=h.formatTransforms(t),n=new oi(e.ox,e.oy).transform(this),r=n.x,i=n.y,s=(new h).translateO(e.rx,e.ry).lmultiplyO(this).translateO(-r,-i).scaleO(e.scaleX,e.scaleY).skewO(e.skewX,e.skewY).shearO(e.shear).rotateO(e.theta).translateO(r,i);if(isFinite(e.px)||isFinite(e.py)){var o=new oi(r,i).transform(s),u=e.px?e.px-o.x:0,a=e.py?e.py-o.y:0;s.translateO(u,a)}return s.translateO(e.tx,e.ty),s}},{key:"compose",value:function(t){t.origin&&(t.originX=t.origin[0],t.originY=t.origin[1]);var e=t.originX||0,n=t.originY||0,r=t.scaleX||1,i=t.scaleY||1,s=t.shear||0,o=t.rotate||0,u=t.translateX||0,a=t.translateY||0;return(new h).translateO(-e,-n).scaleO(r,i).shearO(s).rotateO(o).translateO(u,a).lmultiplyO(this).translateO(e,n)}},{key:"decompose",value:function(){var t=0",delay:0},_i={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","text-anchor":"start"},bi={noop:gi,timeline:wi,attrs:_i},ki=vi("SVGArray",Array,function(t){this.init(t)});Hn(ki,{init:function(t){return"number"==typeof t||(this.length=0,this.push.apply(this,oe(this.parse(t)))),this},toArray:function(){return Array.prototype.concat.apply([],this)},toString:function(){return this.join(" ")},valueOf:function(){var t=[];return t.push.apply(t,oe(this)),t},parse:function(){var t=0n.x&&e>n.y&&t":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(e,n,r,i){return function(t){return t<0?0=e.time?e.run():ys.timeouts.push(e),e!==n););for(var r=null,i=ys.frames.last();r!==i&&(r=ys.frames.shift());)r.run(t);for(var s=null;s=ys.immediates.shift();)s();ys.nextDraw=ys.timeouts.first()||ys.frames.first()?jn.window.requestAnimationFrame(ys._draw):null}},ps=function(t){var e=t.start,n=t.runner.duration();return{start:e,duration:n,end:e+n,runner:t.runner}},ms=function(){var t=jn.window;return(t.performance||t.Date).now()},gs=function(t){function n(){var t,e=0=r;this._lastTime=this._time,i&&this.fire("start",this);var o=this._isDeclarative;if(this.done=!o&&!s&&this._time>=r,this._reseted=!1,n||o){this._initialise(n),this.transforms=new ai;var u=this._run(o?t:e);this.fire("step",this)}return this.done=this.done||u&&o,s&&this.fire("finished",this),this}},{key:"reset",value:function(){return this._reseted||(this.time(0),this._reseted=!0),this}},{key:"finish",value:function(){return this.step(1/0)}},{key:"reverse",value:function(t){return this._reverse=null==t?!this._reverse:t,this}},{key:"ease",value:function(t){return this._stepper=new Qi(t),this}},{key:"active",value:function(t){return null==t?this.enabled:(this.enabled=t,this)}},{key:"_rememberMorpher",value:function(t,e){if(this._history[t]={morpher:e,caller:this._queue[this._queue.length-1]},this._isDeclarative){var n=this.timeline();n&&n.play()}}},{key:"_tryRetarget",value:function(t,e,n){if(this._history[t]){if(!this._history[t].caller.initialised){var r=this._queue.indexOf(this._history[t].caller);return this._queue.splice(r,1),!1}this._history[t].caller.retarget?this._history[t].caller.retarget(e,n):this._history[t].morpher.to(e),this._history[t].caller.finished=!1;var i=this.timeline();return i&&i.play(),!0}return!1}},{key:"_initialise",value:function(t){if(t||this._isDeclarative)for(var e=0,n=this._queue.length;e