diff --git a/content.html b/content.html index 04556786..b9cedf7a 100644 --- a/content.html +++ b/content.html @@ -64,6 +64,45 @@
+

You need to enable JavaScript to run this app.

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

You need to enable JavaScript to run this app.

The embargo has just lifted to confirm that AmpereOne is diff --git a/kiss-translator-ios-safari.user.js b/kiss-translator-ios-safari.user.js index 124bc310..6b502879 100644 --- a/kiss-translator-ios-safari.user.js +++ b/kiss-translator-ios-safari.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name KISS Translator // @namespace https://github.com/fishjar/kiss-translator -// @version 1.7.15 +// @version 1.7.16 // @description A simple bilingual translation extension & Greasemonkey script (一个简约的双语对照翻译扩展 & 油猴脚本) // @author Gabe // @homepageURL https://github.com/fishjar/kiss-translator @@ -19479,11 +19479,11 @@ function CssBaseline(inProps) { false ? 0 : void 0; /* harmony default export */ var CssBaseline_CssBaseline = (CssBaseline); ;// CONCATENATED MODULE: ./src/config/rules.js -var DEFAULT_SELECTOR=":is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)";var GLOBAL_KEY="*";var REMAIN_KEY="-";var SHADOW_KEY=">>>";var DEFAULT_RULE={pattern:"",selector:"",translator:GLOBAL_KEY,fromLang:GLOBAL_KEY,toLang:GLOBAL_KEY,textStyle:GLOBAL_KEY,transOpen:GLOBAL_KEY,bgColor:"",textDiyStyle:""};var DEFAULT_DIY_STYLE="color: #666;\nbackground: linear-gradient(\n 45deg,\n LightGreen 20%,\n LightPink 20% 40%,\n LightSalmon 40% 60%,\n LightSeaGreen 60% 80%,\n LightSkyBlue 80%\n);\n&:hover {\n color: #333;\n};";var DEFAULT_OW_RULE={translator:REMAIN_KEY,fromLang:REMAIN_KEY,toLang:REMAIN_KEY,textStyle:REMAIN_KEY,transOpen:REMAIN_KEY,bgColor:"",textDiyStyle:DEFAULT_DIY_STYLE};var RULES_MAP={"www.google.com/search":"h3, .IsZvec, .VwiC3b","news.google.com":"[role=\"link\"], .DY5T1d, .ifw3f, ".concat(DEFAULT_SELECTOR),"www.foxnews.com":"h1, h2, .title, .sidebar [data-type=\"Title\"], .article-content ".concat(DEFAULT_SELECTOR,"; [data-spotim-module=\"conversation\"]>div >>> [data-spot-im-class=\"message-text\"] p, [data-spot-im-class=\"message-text\"]"),"bearblog.dev, www.theverge.com, www.tampermonkey.net/documentation.php":"".concat(DEFAULT_SELECTOR),"themessenger.com":".leading-tight, .leading-tighter, .my-2 p, .font-body p, article ".concat(DEFAULT_SELECTOR),"www.telegraph.co.uk, go.dev/doc/":"article ".concat(DEFAULT_SELECTOR),"www.theguardian.com":".show-underline, .dcr-hup5wm div, .dcr-7vl6y8 div, .dcr-12evv1c, figcaption, article ".concat(DEFAULT_SELECTOR,", [data-cy=\"mostviewed-footer\"] h4"),"www.semafor.com":"".concat(DEFAULT_SELECTOR,", .styles_intro__IYj__, [class*=\"styles_description\"]"),"www.noemamag.com":".splash__title, .single-card__title, .single-card__type, .single-card__topic, .highlighted-content__title, .single-card__author, article ".concat(DEFAULT_SELECTOR,", .quote__text, .wp-caption-text div"),"restofworld.org":"".concat(DEFAULT_SELECTOR,", .recirc-story__headline, .recirc-story__dek"),"www.axios.com":".h7, ".concat(DEFAULT_SELECTOR),"www.newyorker.com":".summary-item__hed, .summary-item__dek, .summary-collection-grid__dek, .dqtvfu, .rubric__link, .caption, article ".concat(DEFAULT_SELECTOR,", .HEhan ").concat(DEFAULT_SELECTOR,", .ContributorBioBio-fBolsO"),"time.com":"h1, h3, .summary, .video-title, #article-body ".concat(DEFAULT_SELECTOR,", .image-wrap-container .credit.body-caption, .media-heading"),"www.dw.com":".ts-teaser-title a, .news-title a, .title a, .teaser-description a, .hbudab h3, .hbudab p, figcaption ,article ".concat(DEFAULT_SELECTOR),"www.bbc.com":"h1, h2, .media__link, .media__summary, article ".concat(DEFAULT_SELECTOR,", .ssrcss-y7krbn-Stack, .ssrcss-17zglt8-PromoHeadline, .ssrcss-18cjaf3-Headline, .gs-c-promo-heading__title, .gs-c-promo-summary, .media__content h3, .article__intro"),"www.chinadaily.com.cn":"h1, .tMain [shape=\"rect\"], .cMain [shape=\"rect\"], .photo_art [shape=\"rect\"], .mai_r [shape=\"rect\"], .lisBox li, #Content ".concat(DEFAULT_SELECTOR),"www.facebook.com":"[role=\"main\"] [dir=\"auto\"]","www.reddit.com":"[slot=\"title\"], [slot=\"text-body\"] ".concat(DEFAULT_SELECTOR,", #-post-rtjson-content p"),"www.quora.com":".qu-wordBreak--break-word","edition.cnn.com":".container__title, .container__headline, .headline__text, .image__caption, [data-type=\"Title\"], .article__content ".concat(DEFAULT_SELECTOR),"www.reuters.com":"#main-content [data-testid=\"Heading\"], #main-content [data-testid=\"Body\"], .article-body__content__17Yit ".concat(DEFAULT_SELECTOR),"www.bloomberg.com":"[data-component=\"headline\"], [data-component=\"related-item-headline\"], [data-component=\"title\"], article ".concat(DEFAULT_SELECTOR),"deno.land, docs.github.com":"main ".concat(DEFAULT_SELECTOR),"doc.rust-lang.org":".content ".concat(DEFAULT_SELECTOR),"www.indiehackers.com":"h1, h3, .content ".concat(DEFAULT_SELECTOR,", .feed-item__title-link"),"platform.openai.com/docs":".docs-body ".concat(DEFAULT_SELECTOR),"en.wikipedia.org":"h1, .mw-parser-output ".concat(DEFAULT_SELECTOR),"stackoverflow.com":"h1, .s-prose p, .comment-body .comment-copy","www.npmjs.com/package, developer.chrome.com/docs, medium.com, developers.cloudflare.com, react.dev, create-react-app.dev, pytorch.org":"article ".concat(DEFAULT_SELECTOR),"news.ycombinator.com":".title, .commtext","github.com":".markdown-body ".concat(DEFAULT_SELECTOR,", .repo-description p, .Layout-sidebar .f4, .container-lg .py-4 .f5, .container-lg .my-4 .f5, .Box-row .pr-4, .Box-row article .mt-1, [itemprop=\"description\"], .markdown-title, bdi, .ws-pre-wrap, .status-meta, span.status-meta, .col-10.color-fg-muted, .TimelineItem-body, .pinned-item-list-item-content .color-fg-muted, .markdown-body td, .markdown-body th"),"twitter.com":"[data-testid=\"tweetText\"]","m.youtube.com":".slim-video-information-title .yt-core-attributed-string, .media-item-headline .yt-core-attributed-string, .comment-text .yt-core-attributed-string, .typography-body-2b .yt-core-attributed-string, #ytp-caption-window-container .ytp-caption-segment","www.youtube.com":"h1, #video-title, #content-text, #title, yt-attributed-string>span>span, #ytp-caption-window-container .ytp-caption-segment","bard.google.com":".query-content ".concat(DEFAULT_SELECTOR,", message-content ").concat(DEFAULT_SELECTOR),"www.bing.com":".b_algoSlug, .rwrl_padref; .cib-serp-main >>> .ac-textBlock ".concat(DEFAULT_SELECTOR,", .text-message-content div"),"www.phoronix.com":"article ".concat(DEFAULT_SELECTOR),"wx2.qq.com":".js_message_plain","app.slack.com/client/":".p-rich_text_section, .c-message_attachment__text, .p-rich_text_list li","discord.com/channels/":"div[id^=message-content]","t.me/s/":".js-message_text ".concat(DEFAULT_SELECTOR),"web.telegram.org/k/":".message, .bot-commands-list-element-description, .reply-markup-button-text","web.telegram.org/a/":".message, .text-content, .bot-commands-list-element-description, .reply-markup-button-text","chromereleases.googleblog.com":".title, .publishdate, p, i, .header-desc, .header-title, .text","www.instagram.com/":"h1, article span[dir=auto] > span[dir=auto], ._ab1y","www.instagram.com/p/,www.instagram.com/reels/":"h1, div[class='x9f619 xjbqb8w x78zum5 x168nmei x13lgxp2 x5pf9jr xo71vjh x1uhb9sk x1plvlek xryxfnj x1c4vz4f x2lah0s xdt5ytf xqjyukv x1cy8zhl x1oa3qoh x1nhvcw1'] > span[class='x1lliihq x1plvlek xryxfnj x1n2onr6 x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs x1s928wv xhkezso x1gmr53x x1cpjm7i x1fgarty x1943h6x x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj'], span[class='x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs xt0psk2 x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj']","mail.google.com":"".concat(DEFAULT_SELECTOR,", h2[data-thread-perm-id], span[data-thread-id], div[data-message-id] div[class=''], .messageBody, #views"),"web.whatsapp.com":".copyable-text > span","chat.openai.com":"div[data-message-author-role] > div ".concat(DEFAULT_SELECTOR),"forum.ru-board.com":".tit, .dats, span.post ".concat(DEFAULT_SELECTOR),"education.github.com":"".concat(DEFAULT_SELECTOR,", a, summary, span.Button-content"),"blogs.windows.com":"".concat(DEFAULT_SELECTOR,", .c-uhf-nav-link, figcaption"),"developer.apple.com/documentation/":"#main ".concat(DEFAULT_SELECTOR,", #main .abstract .content, #main .abstract.content, #main .link span")};var rules_BUILTIN_RULES=Object.entries(RULES_MAP).sort(function(a,b){return a[0].localeCompare(b[0]);}).map(function(_ref){var _ref2=(0,slicedToArray/* default */.Z)(_ref,2),pattern=_ref2[0],selector=_ref2[1];return _objectSpread2(_objectSpread2({},DEFAULT_RULE),{},{pattern:pattern,selector:selector});}); +var DEFAULT_SELECTOR=":is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)";var DEFAULT_KEEP_SELECTOR="code, img, svg";var GLOBAL_KEY="*";var REMAIN_KEY="-";var SHADOW_KEY=">>>";var DEFAULT_RULE={pattern:"",selector:"",keepSelector:"",translator:GLOBAL_KEY,fromLang:GLOBAL_KEY,toLang:GLOBAL_KEY,textStyle:GLOBAL_KEY,transOpen:GLOBAL_KEY,bgColor:"",textDiyStyle:""};var DEFAULT_DIY_STYLE="color: #666;\nbackground: linear-gradient(\n 45deg,\n LightGreen 20%,\n LightPink 20% 40%,\n LightSalmon 40% 60%,\n LightSeaGreen 60% 80%,\n LightSkyBlue 80%\n);\n&:hover {\n color: #333;\n};";var DEFAULT_OW_RULE={translator:REMAIN_KEY,fromLang:REMAIN_KEY,toLang:REMAIN_KEY,textStyle:REMAIN_KEY,transOpen:REMAIN_KEY,bgColor:"",textDiyStyle:DEFAULT_DIY_STYLE};var RULES_MAP={"www.google.com/search":["h3, .IsZvec, .VwiC3b"],"news.google.com":["[role=\"link\"], .DY5T1d, .ifw3f, ".concat(DEFAULT_SELECTOR)],"www.foxnews.com":["h1, h2, .title, .sidebar [data-type=\"Title\"], .article-content ".concat(DEFAULT_SELECTOR,"; [data-spotim-module=\"conversation\"]>div >>> [data-spot-im-class=\"message-text\"] p, [data-spot-im-class=\"message-text\"]")],"bearblog.dev, www.theverge.com, www.tampermonkey.net/documentation.php":["".concat(DEFAULT_SELECTOR)],"themessenger.com":[".leading-tight, .leading-tighter, .my-2 p, .font-body p, article ".concat(DEFAULT_SELECTOR)],"www.telegraph.co.uk, go.dev/doc/":["article ".concat(DEFAULT_SELECTOR)],"www.theguardian.com":[".show-underline, .dcr-hup5wm div, .dcr-7vl6y8 div, .dcr-12evv1c, figcaption, article ".concat(DEFAULT_SELECTOR,", [data-cy=\"mostviewed-footer\"] h4")],"www.semafor.com":["".concat(DEFAULT_SELECTOR,", .styles_intro__IYj__, [class*=\"styles_description\"]")],"www.noemamag.com":[".splash__title, .single-card__title, .single-card__type, .single-card__topic, .highlighted-content__title, .single-card__author, article ".concat(DEFAULT_SELECTOR,", .quote__text, .wp-caption-text div")],"restofworld.org":["".concat(DEFAULT_SELECTOR,", .recirc-story__headline, .recirc-story__dek")],"www.axios.com":[".h7, ".concat(DEFAULT_SELECTOR)],"www.newyorker.com":[".summary-item__hed, .summary-item__dek, .summary-collection-grid__dek, .dqtvfu, .rubric__link, .caption, article ".concat(DEFAULT_SELECTOR,", .HEhan ").concat(DEFAULT_SELECTOR,", .ContributorBioBio-fBolsO, .BaseText-ewhhUZ")],"time.com":["h1, h3, .summary, .video-title, #article-body ".concat(DEFAULT_SELECTOR,", .image-wrap-container .credit.body-caption, .media-heading")],"www.dw.com":[".ts-teaser-title a, .news-title a, .title a, .teaser-description a, .hbudab h3, .hbudab p, figcaption ,article ".concat(DEFAULT_SELECTOR)],"www.bbc.com":["h1, h2, .media__link, .media__summary, article ".concat(DEFAULT_SELECTOR,", .ssrcss-y7krbn-Stack, .ssrcss-17zglt8-PromoHeadline, .ssrcss-18cjaf3-Headline, .gs-c-promo-heading__title, .gs-c-promo-summary, .media__content h3, .article__intro, .lx-c-summary-points>li")],"www.chinadaily.com.cn":["h1, .tMain [shape=\"rect\"], .cMain [shape=\"rect\"], .photo_art [shape=\"rect\"], .mai_r [shape=\"rect\"], .lisBox li, #Content ".concat(DEFAULT_SELECTOR)],"www.facebook.com":["[role=\"main\"] [dir=\"auto\"]"],"www.reddit.com":["div:is(.tbIApBd2DM_drfZQJjIum, ._1zPvgKHteTOub9dKkvrOl4,.ULWj94BYSOqoJDetxgcnU),a:is([class^=\"_334yl59\"],[class^=\"_2GrMpxD\"]),h1,h2,h3,h4,h5,h6,p,button"],"www.quora.com":[".qu-wordBreak--break-word"],"edition.cnn.com":[".container__title, .container__headline, .headline__text, .image__caption, [data-type=\"Title\"], .article__content ".concat(DEFAULT_SELECTOR)],"www.reuters.com":["#main-content [data-testid=\"Heading\"], #main-content [data-testid=\"Body\"], .article-body__content__17Yit ".concat(DEFAULT_SELECTOR)],"www.bloomberg.com":["[data-component=\"headline\"], [data-component=\"related-item-headline\"], [data-component=\"title\"], article ".concat(DEFAULT_SELECTOR)],"deno.land, docs.github.com":["main ".concat(DEFAULT_SELECTOR),"code, img, svg"],"doc.rust-lang.org":[".content ".concat(DEFAULT_SELECTOR),"code, img, svg"],"www.indiehackers.com":["h1, h3, .content ".concat(DEFAULT_SELECTOR,", .feed-item__title-link")],"platform.openai.com/docs":[".docs-body ".concat(DEFAULT_SELECTOR),"code, img, svg"],"en.wikipedia.org":["h1, .mw-parser-output ".concat(DEFAULT_SELECTOR),".mwe-math-element"],"stackoverflow.com":["h1, .s-prose p, .comment-body .comment-copy","code, img, svg"],"www.npmjs.com/package, developer.chrome.com/docs, medium.com, developers.cloudflare.com, react.dev, create-react-app.dev, pytorch.org":["article ".concat(DEFAULT_SELECTOR)],"news.ycombinator.com":[".title, .commtext"],"github.com":[".markdown-body ".concat(DEFAULT_SELECTOR,", .repo-description p, .Layout-sidebar .f4, .container-lg .py-4 .f5, .container-lg .my-4 .f5, .Box-row .pr-4, .Box-row article .mt-1, [itemprop=\"description\"], .markdown-title, bdi, .ws-pre-wrap, .status-meta, span.status-meta, .col-10.color-fg-muted, .TimelineItem-body, .pinned-item-list-item-content .color-fg-muted, .markdown-body td, .markdown-body th"),"code, img, svg"],"twitter.com":["[data-testid=\"tweetText\"], [data-testid=\"birdwatch-pivot\"]>div.css-1rynq56","img, a, .r-18u37iz, .css-175oi2r"],"m.youtube.com":[".slim-video-information-title .yt-core-attributed-string, .media-item-headline .yt-core-attributed-string, .comment-text .yt-core-attributed-string, .typography-body-2b .yt-core-attributed-string, #ytp-caption-window-container .ytp-caption-segment"],"www.youtube.com":["h1, #video-title, #content-text, #title, yt-attributed-string>span>span, #ytp-caption-window-container .ytp-caption-segment"],"bard.google.com":[".query-content ".concat(DEFAULT_SELECTOR,", message-content ").concat(DEFAULT_SELECTOR)],"www.bing.com":[".b_algoSlug, .rwrl_padref; .cib-serp-main >>> .ac-textBlock ".concat(DEFAULT_SELECTOR,", .text-message-content div")],"www.phoronix.com":["article ".concat(DEFAULT_SELECTOR)],"wx2.qq.com":[".js_message_plain"],"app.slack.com/client/":[".p-rich_text_section, .c-message_attachment__text, .p-rich_text_list li"],"discord.com/channels/":["li[id^=chat-messages] div[id^=message-content], div[class^=headerText], div[class^=name_], section[aria-label='Search Results'] div[id^=message-content]"],"t.me/s/":[".js-message_text ".concat(DEFAULT_SELECTOR)],"web.telegram.org/k/":[".message, .bot-commands-list-element-description, .reply-markup-button-text"],"web.telegram.org/a/":[".message, .text-content, .bot-commands-list-element-description, .reply-markup-button-text"],"chromereleases.googleblog.com":[".title, .publishdate, p, i, .header-desc, .header-title, .text"],"www.instagram.com/":["h1, article span[dir=auto] > span[dir=auto], ._ab1y"],"www.instagram.com/p/,www.instagram.com/reels/":["h1, div[class='x9f619 xjbqb8w x78zum5 x168nmei x13lgxp2 x5pf9jr xo71vjh x1uhb9sk x1plvlek xryxfnj x1c4vz4f x2lah0s xdt5ytf xqjyukv x1cy8zhl x1oa3qoh x1nhvcw1'] > span[class='x1lliihq x1plvlek xryxfnj x1n2onr6 x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs x1s928wv xhkezso x1gmr53x x1cpjm7i x1fgarty x1943h6x x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj'], span[class='x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs xt0psk2 x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj']"],"mail.google.com":["".concat(DEFAULT_SELECTOR,", h2[data-thread-perm-id], span[data-thread-id], div[data-message-id] div[class=''], .messageBody, #views")],"web.whatsapp.com":[".copyable-text > span"],"chat.openai.com":["div[data-message-author-role] > div ".concat(DEFAULT_SELECTOR)],"forum.ru-board.com":[".tit, .dats, span.post, .lgf ".concat(DEFAULT_SELECTOR)],"education.github.com":["".concat(DEFAULT_SELECTOR,", a, summary, span.Button-content")],"blogs.windows.com":["".concat(DEFAULT_SELECTOR,", .c-uhf-nav-link, figcaption")],"developer.apple.com/documentation/":["#main ".concat(DEFAULT_SELECTOR,", #main .abstract .content, #main .abstract.content, #main .link span"),"code, img, svg"],"greasyfork.org":["h2, .script-link, .script-description, #additional-info ".concat(DEFAULT_SELECTOR)],"www.fmkorea.com":["#container ".concat(DEFAULT_SELECTOR)],"forum.arduino.cc":[".top-row>.title, .featured-topic>.title, .link-top-line>.title, .category-description, .topic-excerpt, .fancy-title, .cooked ".concat(DEFAULT_SELECTOR)],"docs.arduino.cc":["[class^=\"tutorial-module--left\"] ".concat(DEFAULT_SELECTOR)],"www.historydefined.net":[".wp-element-caption, ".concat(DEFAULT_SELECTOR)]};var rules_BUILTIN_RULES=Object.entries(RULES_MAP).sort(function(a,b){return a[0].localeCompare(b[0]);}).map(function(_ref){var _ref2=(0,slicedToArray/* default */.Z)(_ref,2),pattern=_ref2[0],_ref2$=(0,slicedToArray/* default */.Z)(_ref2[1],2),selector=_ref2$[0],_ref2$$=_ref2$[1],keepSelector=_ref2$$===void 0?"":_ref2$$;return _objectSpread2(_objectSpread2({},DEFAULT_RULE),{},{pattern:pattern,selector:selector,keepSelector:keepSelector});}); ;// CONCATENATED MODULE: ./src/config/app.js var APP_NAME="KISS Translator".trim().split(/\s+/).join("-");var APP_LCNAME=APP_NAME.toLowerCase(); ;// CONCATENATED MODULE: ./src/config/i18n.js -var UI_LANGS=(/* unused pure expression or super */ null && ([["en","English"],["zh","中文"]]));var customApiLangs="[\"en\", \"English - English\"],\n[\"zh-CN\", \"Simplified Chinese - \u7B80\u4F53\u4E2D\u6587\"],\n[\"zh-TW\", \"Traditional Chinese - \u7E41\u9AD4\u4E2D\u6587\"],\n[\"ar\", \"Arabic - \u0627\u0644\u0639\u0631\u0628\u064A\u0629\"],\n[\"bg\", \"Bulgarian - \u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438\"],\n[\"ca\", \"Catalan - Catal\xE0\"],\n[\"hr\", \"Croatian - Hrvatski\"],\n[\"cs\", \"Czech - \u010Ce\u0161tina\"],\n[\"da\", \"Danish - Dansk\"],\n[\"nl\", \"Dutch - Nederlands\"],\n[\"fi\", \"Finnish - Suomi\"],\n[\"fr\", \"French - Fran\xE7ais\"],\n[\"de\", \"German - Deutsch\"],\n[\"el\", \"Greek - \u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC\"],\n[\"hi\", \"Hindi - \u0939\u093F\u0928\u094D\u0926\u0940\"],\n[\"hu\", \"Hungarian - Magyar\"],\n[\"id\", \"Indonesian - Indonesia\"],\n[\"it\", \"Italian - Italiano\"],\n[\"ja\", \"Japanese - \u65E5\u672C\u8A9E\"],\n[\"ko\", \"Korean - \uD55C\uAD6D\uC5B4\"],\n[\"ms\", \"Malay - Melayu\"],\n[\"mt\", \"Maltese - Malti\"],\n[\"nb\", \"Norwegian - Norsk Bokm\xE5l\"],\n[\"pl\", \"Polish - Polski\"],\n[\"pt\", \"Portuguese - Portugu\xEAs\"],\n[\"ro\", \"Romanian - Rom\xE2n\u0103\"],\n[\"ru\", \"Russian - \u0420\u0443\u0441\u0441\u043A\u0438\u0439\"],\n[\"sk\", \"Slovak - Sloven\u010Dina\"],\n[\"sl\", \"Slovenian - Sloven\u0161\u010Dina\"],\n[\"es\", \"Spanish - Espa\xF1ol\"],\n[\"sv\", \"Swedish - Svenska\"],\n[\"ta\", \"Tamil - \u0BA4\u0BAE\u0BBF\u0BB4\u0BCD\"],\n[\"te\", \"Telugu - \u0C24\u0C46\u0C32\u0C41\u0C17\u0C41\"],\n[\"th\", \"Thai - \u0E44\u0E17\u0E22\"],\n[\"tr\", \"Turkish - T\xFCrk\xE7e\"],\n[\"uk\", \"Ukrainian - \u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430\"],\n[\"vi\", \"Vietnamese - Ti\u1EBFng Vi\u1EC7t\"],\n";var customApiHelpZH="/// \u81EA\u5B9A\u4E49\u7FFB\u8BD1\u6E90\u63A5\u53E3\u8BF4\u660E\n\n// \u8BF7\u6C42\uFF08Request\uFF09\u6570\u636E\u5C06\u6309\u4E0B\u9762\u89C4\u8303\u53D1\u9001\n{\n url: {{YOUR_URL}},\n method: \"POST\",\n headers: {\n \"Content-type\": \"application/json\",\n \"Authorization\": \"Bearer {{YOUR_KEY}}\",\n },\n body: {\n text: \"\", // \u9700\u8981\u7FFB\u8BD1\u7684\u6587\u5B57\n from: \"\", // \u6E90\u8BED\u8A00\uFF0C\u53EF\u80FD\u4E3A\u7A7A\uFF0C\u8868\u793A\u9700\u8981\u63A5\u53E3\u81EA\u52A8\u8BC6\u522B\u8BED\u8A00\n to: \"\", // \u76EE\u6807\u8BED\u8A00\n }\n}\n\n// \u8FD4\u56DE\uFF08Response\uFF09\u6570\u636E\u9700\u7B26\u5408\u4E0B\u9762\u7684JSON\u89C4\u8303\n{\n text: \"\", // \u7FFB\u8BD1\u540E\u7684\u6587\u5B57\n from: \"\", // \u8BC6\u522B\u7684\u6E90\u8BED\u8A00\n to: \"\", // \u76EE\u6807\u8BED\u8A00\uFF08\u53EF\u9009\uFF09\n}\n\n// \u652F\u6301\u7684\u8BED\u8A00\u4EE3\u7801\u5982\u4E0B\n".concat(customApiLangs,"\n");var customApiHelpEN="/// Custom translation source interface description\n\n// Request data will be sent according to the following specifications\n{\n url: {{YOUR_URL}},\n method: \"POST\",\n headers: {\n \"Content-type\": \"application/json\",\n \"Authorization\": \"Bearer {{YOUR_KEY}}\",\n },\n body: {\n text: \"\", // text to be translated\n from: \"\", // Source language, may be empty\n to: \"\", // Target language\n }\n}\n\n// The returned data must conform to the following JSON specification\n{\n text: \"\", // translated text\n from: \"\", // Recognized source language\n to: \"\", // Target language (optional)\n}\n\n// The supported language codes are as follows\n".concat(customApiLangs,"\n");var I18N={app_name:{zh:"\u7B80\u7EA6\u7FFB\u8BD1",en:"KISS Translator"},translate:{zh:"\u7FFB\u8BD1",en:"Translate"},custom_api_help:{zh:customApiHelpZH,en:customApiHelpEN},translate_alt:{zh:"\u7FFB\u8BD1 (Alt+Q)",en:"Translate (Alt+Q)"},basic_setting:{zh:"\u57FA\u672C\u8BBE\u7F6E",en:"Basic Setting"},rules_setting:{zh:"\u89C4\u5219\u8BBE\u7F6E",en:"Rules Setting"},apis_setting:{zh:"\u63A5\u53E3\u8BBE\u7F6E",en:"Apis Setting"},sync_setting:{zh:"\u540C\u6B65\u8BBE\u7F6E",en:"Sync Setting"},patch_setting:{zh:"\u8865\u4E01\u8BBE\u7F6E",en:"Patch Setting"},patch_setting_help:{zh:"\u9488\u5BF9\u4E00\u4E9B\u7279\u6B8A\u7F51\u7AD9\u7684\u4FEE\u6B63\u811A\u672C\uFF0C\u4EE5\u4FBF\u7FFB\u8BD1\u8F6F\u4EF6\u5F97\u5230\u66F4\u597D\u7684\u5C55\u793A\u6548\u679C\u3002",en:"Corrected scripts for some special websites so that the translation software can get better display results."},inject_webfix:{zh:"\u6CE8\u5165\u4FEE\u590D\u8865\u4E01",en:"Inject Webfix"},about:{zh:"\u5173\u4E8E",en:"About"},about_md:{zh:"README.md",en:"README.en.md"},about_md_local:{zh:"\u8BF7 [\u70B9\u51FB\u8FD9\u91CC](".concat("https://github.com/fishjar/kiss-translator",") \u67E5\u770B\u8BE6\u60C5\u3002"),en:"Please [click here](".concat("https://github.com/fishjar/kiss-translator",") for details.")},ui_lang:{zh:"\u754C\u9762\u8BED\u8A00",en:"Interface Language"},fetch_limit:{zh:"\u6700\u5927\u8BF7\u6C42\u6570\u91CF (1-100)",en:"Maximum Number Of Request (1-100)"},fetch_interval:{zh:"\u8BF7\u6C42\u95F4\u9694\u65F6\u95F4 (0-5000ms)",en:"Request Interval (0-5000ms)"},min_translate_length:{zh:"\u6700\u5C0F\u7FFB\u8BD1\u957F\u5EA6 (1-100)",en:"Min Translate Length (1-100)"},max_translate_length:{zh:"\u6700\u5927\u7FFB\u8BD1\u957F\u5EA6 (100-10000)",en:"Max Translate Length (100-10000)"},num_of_newline_characters:{zh:"\u6362\u884C\u5B57\u7B26\u6570 (1-1000)",en:"Number of Newline Characters (1-1000)"},translate_service:{zh:"\u7FFB\u8BD1\u670D\u52A1",en:"Translate Service"},mouseover_translation:{zh:"\u9F20\u6807\u60AC\u505C\u7FFB\u8BD1",en:"Mouseover translation"},mk_disable:{zh:"\u7981\u7528",en:"Disable"},mk_mouseover:{zh:"\u9F20\u6807\u60AC\u505C",en:"Mouseover"},mk_ctrlKey:{zh:"Control + \u9F20\u6807\u60AC\u505C",en:"Control + Mouseover"},mk_shiftKey:{zh:"Shift + \u9F20\u6807\u60AC\u505C",en:"Shift + Mouseover"},mk_altKey:{zh:"Alt + \u9F20\u6807\u60AC\u505C",en:"Alt + Mouseover"},from_lang:{zh:"\u539F\u6587\u8BED\u8A00",en:"Source Language"},to_lang:{zh:"\u76EE\u6807\u8BED\u8A00",en:"Target Language"},to_lang2:{zh:"\u7B2C\u4E8C\u76EE\u6807\u8BED\u8A00",en:"Target Language 2"},to_lang2_helper:{zh:"\u8BBE\u5B9A\u540E\uFF0C\u4E0E\u76EE\u6807\u8BED\u8A00\u4EA7\u751F\u4E92\u8BD1\u6548\u679C\uFF0C\u4F46\u4F9D\u8D56\u8FDC\u7A0B\u8BED\u8A00\u8BC6\u522B\u3002",en:"After setting, it will produce mutual translation effect with the target language, but it relies on remote language recognition."},text_style:{zh:"\u6587\u5B57\u6837\u5F0F",en:"Text Style"},text_style_alt:{zh:"\u6587\u5B57\u6837\u5F0F (Alt+C)",en:"Text Style (Alt+C)"},bg_color:{zh:"\u6837\u5F0F\u989C\u8272",en:"Style Color"},remain_unchanged:{zh:"\u4FDD\u7559\u4E0D\u53D8",en:"Remain Unchanged"},google_api:{zh:"\u8C37\u6B4C\u7FFB\u8BD1\u63A5\u53E3",en:"Google Translate API"},default_selector:{zh:"\u9ED8\u8BA4\u9009\u62E9\u5668",en:"Default selector"},selector_rules:{zh:"\u9009\u62E9\u5668\u89C4\u5219",en:"Selector Rules"},save:{zh:"\u4FDD\u5B58",en:"Save"},edit:{zh:"\u7F16\u8F91",en:"Edit"},cancel:{zh:"\u53D6\u6D88",en:"Cancel"},delete:{zh:"\u5220\u9664",en:"Delete"},reset:{zh:"\u91CD\u7F6E",en:"Reset"},add:{zh:"\u6DFB\u52A0",en:"Add"},inject_rules:{zh:"\u6CE8\u5165\u8BA2\u9605\u89C4\u5219",en:"Inject Subscribe Rules"},personal_rules:{zh:"\u4E2A\u4EBA\u89C4\u5219",en:"Rules"},subscribe_rules:{zh:"\u8BA2\u9605\u89C4\u5219",en:"Subscribe"},overwrite_subscribe_rules:{zh:"\u8986\u5199\u8BA2\u9605\u89C4\u5219",en:"Overwrite"},subscribe_url:{zh:"\u8BA2\u9605\u5730\u5740",en:"Subscribe URL"},rules_warn_1:{zh:"1\u3001\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u4E00\u76F4\u751F\u6548\uFF0C\u9009\u62E9\u201C\u6CE8\u5165\u8BA2\u9605\u89C4\u5219\u201D\u540E\uFF0C\u201C\u8BA2\u9605\u89C4\u5219\u201D\u624D\u4F1A\u751F\u6548\u3002",en:"1. The \"Personal Rules\" are always in effect. After selecting \"Inject Subscription Rules\", the \"Subscription Rules\" will take effect."},rules_warn_2:{zh:"2\u3001\u201C\u8BA2\u9605\u89C4\u5219\u201D\u7684\u6CE8\u5165\u4F4D\u7F6E\u662F\u5012\u6570\u7B2C\u4E8C\u7684\u4F4D\u7F6E\uFF0C\u56E0\u6B64\u9664\u5168\u5C40\u89C4\u5219(*)\u5916\uFF0C\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u4F18\u5148\u7EA7\u6BD4\u201C\u8BA2\u9605\u89C4\u5219\u201D\u9AD8\uFF0C\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u586B\u5199\u540C\u6837\u7684\u7F51\u5740\u4F1A\u8986\u76D6\u201D\u8BA2\u9605\u89C4\u5219\u201C\u7684\u6761\u76EE\u3002",en:"2. The injection position of \"Subscription Rules\" is the penultimate position. Therefore, except for the global rules (*), the priority of \"Personal Rules\" is higher than that of \"Subscription Rules\". Filling in the same url in \"Personal Rules\" will overwrite \"Subscription Rules\" entry."},sync_warn:{zh:"\u5982\u679C\u670D\u52A1\u5668\u5B58\u5728\u5176\u4ED6\u5BA2\u6237\u7AEF\u540C\u6B65\u7684\u6570\u636E\uFF0C\u7B2C\u4E00\u6B21\u540C\u6B65\u5C06\u76F4\u63A5\u8986\u76D6\u672C\u5730\u914D\u7F6E\uFF0C\u540E\u9762\u5219\u6839\u636E\u4FEE\u6539\u65F6\u95F4\uFF0C\u65B0\u7684\u8986\u76D6\u65E7\u7684\u3002",en:"If the server has data synchronized by other clients, the first synchronization will directly overwrite the local configuration, and later, according to the modification time, the new one will overwrite the old one."},about_sync_api:{zh:"\u67E5\u770B\u5173\u4E8E\u6570\u636E\u540C\u6B65\u63A5\u53E3\u90E8\u7F72",en:"View About Data Synchronization Interface Deployment"},about_api_proxy:{zh:"\u67E5\u770B\u81EA\u5EFA\u4E00\u4E2A\u7FFB\u8BD1\u63A5\u53E3\u4EE3\u7406",en:"Check out the self-built translation interface proxy"},style_none:{zh:"\u65E0",en:"None"},under_line:{zh:"\u4E0B\u5212\u76F4\u7EBF",en:"Underline"},dot_line:{zh:"\u4E0B\u5212\u70B9\u72B6\u7EBF",en:"Dotted Underline"},dash_line:{zh:"\u4E0B\u5212\u865A\u7EBF",en:"Dashed Underline"},wavy_line:{zh:"\u4E0B\u5212\u6CE2\u6D6A\u7EBF",en:"Wavy Underline"},fuzzy:{zh:"\u6A21\u7CCA",en:"Fuzzy"},highlight:{zh:"\u9AD8\u4EAE",en:"Highlight"},blockquote:{zh:"\u5F15\u7528",en:"Blockquote"},diy_style:{zh:"\u81EA\u5B9A\u4E49\u6837\u5F0F",en:"Custom Style"},diy_style_helper:{zh:"\u9075\u5FAA\u201CCSS\u201D\u7684\u8BED\u6CD5",en:"Follow the syntax of \"CSS\""},setting:{zh:"\u8BBE\u7F6E (Alt+O)",en:"Setting (Alt+O)"},pattern:{zh:"\u5339\u914D\u7F51\u5740",en:"URL pattern"},pattern_helper:{zh:"1\u3001\u652F\u6301\u661F\u53F7(*)\u901A\u914D\u7B26\u30022\u3001\u591A\u4E2AURL\u7528\u82F1\u6587\u9017\u53F7\u201C,\u201D\u5206\u9694\u3002",en:"1. The asterisk (*) wildcard is supported. 2. Multiple URLs separated by English commas \",\"."},selector_helper:{zh:"1\u3001\u9075\u5FAACSS\u9009\u62E9\u5668\u8BED\u6CD5\u30022\u3001\u7559\u7A7A\u8868\u793A\u91C7\u7528\u5168\u5C40\u8BBE\u7F6E\u30023\u3001\u591A\u4E2ACSS\u9009\u62E9\u5668\u4E4B\u95F4\u7528\u201C;\u201D\u9694\u5F00\u30024\u3001\u201Cshadow root\u201D\u9009\u62E9\u5668\u548C\u5185\u90E8\u9009\u62E9\u5668\u7528\u201C>>>\u201D\u9694\u5F00\u3002",en:"1. Follow CSS selector syntax. 2. Leave blank to adopt the global setting. 3. Separate multiple CSS selectors with \";\". 4. The \"shadow root\" selector and the internal selector are separated by \">>>\"."},translate_switch:{zh:"\u5F00\u542F\u7FFB\u8BD1",en:"Translate Switch"},default_enabled:{zh:"\u9ED8\u8BA4\u5F00\u542F",en:"Enabled"},default_disabled:{zh:"\u9ED8\u8BA4\u5173\u95ED",en:"Disabled"},selector:{zh:"\u9009\u62E9\u5668",en:"Selector"},root_selector:{zh:"\u6839\u9009\u62E9\u5668",en:"Root Selector"},fixer_function:{zh:"\u4FEE\u590D\u51FD\u6570",en:"Fixer Function"},import:{zh:"\u5BFC\u5165",en:"Import"},export:{zh:"\u5BFC\u51FA",en:"Export"},error_cant_be_blank:{zh:"\u4E0D\u80FD\u4E3A\u7A7A",en:"Can not be blank"},error_duplicate_values:{zh:"\u5B58\u5728\u91CD\u590D\u7684\u503C",en:"There are duplicate values"},error_wrong_file_type:{zh:"\u9519\u8BEF\u7684\u6587\u4EF6\u7C7B\u578B",en:"Wrong file type"},error_fetch_url:{zh:"\u8BF7\u68C0\u67E5url\u5730\u5740\u662F\u5426\u6B63\u786E\u6216\u7A0D\u540E\u518D\u8BD5\u3002",en:"Please check if the url address is correct or try again later."},deepl_api:{zh:"DeepL \u63A5\u53E3",en:"DeepL API"},deepl_key:{zh:"DeepL \u5BC6\u94A5",en:"DeepL Key"},openai_api:{zh:"OpenAI \u63A5\u53E3",en:"OpenAI API"},openai_key:{zh:"OpenAI \u5BC6\u94A5",en:"OpenAI Key"},openai_model:{zh:"OpenAI \u6A21\u578B",en:"OpenAI Model"},openai_prompt:{zh:"OpenAI \u63D0\u793A\u8BCD",en:"OpenAI Prompt"},if_clear_cache:{zh:"\u662F\u5426\u6E05\u9664\u7F13\u5B58",en:"Whether clear cache"},clear_cache_never:{zh:"\u4E0D\u6E05\u9664\u7F13\u5B58",en:"Never clear cache"},clear_cache_restart:{zh:"\u91CD\u542F\u6D4F\u89C8\u5668\u65F6\u6E05\u9664\u7F13\u5B58",en:"Clear cache when restarting browser"},data_sync_type:{zh:"\u6570\u636E\u540C\u6B65\u65B9\u5F0F",en:"Data Sync Type"},data_sync_url:{zh:"\u6570\u636E\u540C\u6B65\u63A5\u53E3",en:"Data Sync API"},data_sync_user:{zh:"\u6570\u636E\u540C\u6B65\u8D26\u6237",en:"Data Sync User"},data_sync_key:{zh:"\u6570\u636E\u540C\u6B65\u5BC6\u94A5",en:"Data Sync Key"},sync_now:{zh:"\u7ACB\u5373\u540C\u6B65",en:"Sync Now"},sync_success:{zh:"\u540C\u6B65\u6210\u529F\uFF01",en:"Sync Success"},sync_failed:{zh:"\u540C\u6B65\u5931\u8D25\uFF01",en:"Sync Error"},error_got_some_wrong:{zh:"\u62B1\u6B49\uFF0C\u51FA\u9519\u4E86\uFF01",en:"Sorry, something went wrong!"},error_sync_setting:{zh:"\u60A8\u7684\u540C\u6B65\u7C7B\u578B\u5FC5\u987B\u4E3A\u201CKISS-Worker\u201D\uFF0C\u4E14\u9700\u586B\u5199\u5B8C\u6574",en:"Your sync type must be \"KISS-Worker\" and must be filled in completely"},click_test:{zh:"\u70B9\u51FB\u6D4B\u8BD5",en:"Click Test"},test_success:{zh:"\u6D4B\u8BD5\u6210\u529F",en:"Test success"},test_failed:{zh:"\u6D4B\u8BD5\u5931\u8D25",en:"Test failed"},clear_all_cache_now:{zh:"\u7ACB\u5373\u6E05\u9664\u5168\u90E8\u7F13\u5B58",en:"Clear all cache now"},clear_cache:{zh:"\u6E05\u9664\u7F13\u5B58",en:"Clear Cache"},clear_success:{zh:"\u6E05\u9664\u6210\u529F",en:"Clear success"},clear_failed:{zh:"\u6E05\u9664\u5931\u8D25",en:"Clear failed"},share:{zh:"\u5206\u4EAB",en:"Share"},clear_all:{zh:"\u6E05\u7A7A",en:"Clear All"},help:{zh:"\u6C42\u52A9",en:"Help"},restore_default:{zh:"\u6062\u590D\u9ED8\u8BA4",en:"Restore Default"},shortcuts_setting:{zh:"\u5FEB\u6377\u952E\u8BBE\u7F6E",en:"Shortcuts Setting"},toggle_translate_shortcut:{zh:"\"\u5F00\u542F\u7FFB\u8BD1\"\u5FEB\u6377\u952E",en:"\"Toggle Translate\" Shortcut"},toggle_style_shortcut:{zh:"\"\u5207\u6362\u6837\u5F0F\"\u5FEB\u6377\u952E",en:"\"Toggle Style\" Shortcut"},toggle_popup_shortcut:{zh:"\"\u6253\u5F00\u5F39\u7A97\"\u5FEB\u6377\u952E",en:"\"Open Popup\" Shortcut"},open_setting_shortcut:{zh:"\"\u6253\u5F00\u8BBE\u7F6E\"\u5FEB\u6377\u952E",en:"\"Open Setting\" Shortcut"},hide_fab_button:{zh:"\u9690\u85CF\u60AC\u6D6E\u6309\u94AE",en:"Hide Fab Button"},hide_tran_button:{zh:"\u9690\u85CF\u7FFB\u8BD1\u6309\u94AE",en:"Hide Translate Button"},show:{zh:"\u663E\u793A",en:"Show"},hide:{zh:"\u9690\u85CF",en:"Hide"},save_rule:{zh:"\u4FDD\u5B58\u89C4\u5219",en:"Save Rule"},global_rule:{zh:"\u5168\u5C40\u89C4\u5219",en:"Global Rule"},input_translate:{zh:"\u8F93\u5165\u6846\u7FFB\u8BD1",en:"Input Box Translation"},use_input_box_translation:{zh:"\u542F\u7528\u8F93\u5165\u6846\u7FFB\u8BD1",en:"Input Box Translation"},input_selector:{zh:"\u8F93\u5165\u6846\u9009\u62E9\u5668",en:"Input Selector"},input_selector_helper:{zh:"\u7528\u4E8E\u8F93\u5165\u6846\u7FFB\u8BD1\u3002",en:"Used for input box translation."},trigger_trans_shortcut:{zh:"\u89E6\u53D1\u7FFB\u8BD1\u5FEB\u6377\u952E",en:"Trigger Translation Shortcut Keys"},trigger_trans_shortcut_help:{zh:"\u9ED8\u8BA4\u4E3A\u5355\u51FB\u201CAltLeft+KeyI\u201D",en:"Default is \"AltLeft+KeyI\""},shortcut_press_count:{zh:"\u5FEB\u6377\u952E\u8FDE\u51FB\u6B21\u6570",en:"Shortcut Press Number"},combo_timeout:{zh:"\u8FDE\u51FB\u8D85\u65F6\u65F6\u95F4 (10-1000ms)",en:"Combo Timeout (10-1000ms)"},input_trans_start_sign:{zh:"\u7FFB\u8BD1\u8D77\u59CB\u6807\u8BC6",en:"Translation Start Sign"},input_trans_start_sign_help:{zh:"\u6807\u8BC6\u540E\u9762\u53EF\u4EE5\u52A0\u76EE\u6807\u8BED\u8A00\u4EE3\u7801\uFF0C\u5982\uFF1A \u201C/en \u4F60\u597D\u201D\u3001\u201C/zh hello\u201D",en:"The target language code can be added after the sign, such as: \"/en \u4F60\u597D\", \"/zh hello\""},detect_lang_remote:{zh:"\u8FDC\u7A0B\u8BED\u8A00\u68C0\u6D4B",en:"Remote language detection"},detect_lang_remote_help:{zh:"\u542F\u7528\u540E\u68C0\u6D4B\u51C6\u786E\u5EA6\u589E\u52A0\uFF0C\u4F46\u4F1A\u964D\u4F4E\u7FFB\u8BD1\u901F\u5EA6\uFF0C\u8BF7\u914C\u60C5\u5F00\u542F",en:"After enabling, the detection accuracy will increase, but it will reduce the translation speed. Please enable it as appropriate."},disable:{zh:"\u7981\u7528",en:"Disable"},enable:{zh:"\u542F\u7528",en:"Enable"},selection_translate:{zh:"\u5212\u8BCD\u7FFB\u8BD1",en:"Selection Translate"},toggle_selection_translate:{zh:"\u542F\u7528\u5212\u8BCD\u7FFB\u8BD1",en:"Use Selection Translate"},trigger_tranbox_shortcut:{zh:"\u663E\u793A\u7FFB\u8BD1\u6846/\u7FFB\u8BD1\u9009\u4E2D\u6587\u5B57\u5FEB\u6377\u952E",en:"Open Translate Popup/Translate Selected Shortcut"},tranbtn_offset_x:{zh:"\u7FFB\u8BD1\u6309\u94AE\u504F\u79FBX\uFF080-100\uFF09",en:"Translate Button Offset X (0-100)"},tranbtn_offset_y:{zh:"\u7FFB\u8BD1\u6309\u94AE\u504F\u79FBY\uFF080-100\uFF09",en:"Translate Button Offset Y (0-100)"},translated_text:{zh:"\u8BD1\u6587",en:"Translated Text"},original_text:{zh:"\u539F\u6587",en:"Original Text"},favorite_words:{zh:"\u6536\u85CF\u8BCD\u6C47",en:"Favorite Words"},touch_setting:{zh:"\u89E6\u5C4F\u8BBE\u7F6E",en:"Touch Setting"},touch_translate_shortcut:{zh:"\u89E6\u5C4F\u7FFB\u8BD1\u5FEB\u6377\u65B9\u5F0F",en:"Touch Translate Shortcut"},touch_tap_0:{zh:"\u7981\u7528",en:"Disable"},touch_tap_2:{zh:"\u53CC\u6307\u8F7B\u89E6",en:"Two finger tap"},touch_tap_3:{zh:"\u4E09\u6307\u8F7B\u89E6",en:"Three finger tap"},touch_tap_4:{zh:"\u56DB\u6307\u8F7B\u89E6",en:"Four finger tap"},translate_blacklist:{zh:"\u7981\u7528\u7FFB\u8BD1\u540D\u5355",en:"Translate Blacklist"},disable_langs:{zh:"\u4E0D\u7FFB\u8BD1\u7684\u8BED\u8A00",en:"Disable Languages"},disable_langs_helper:{zh:"\u6B64\u529F\u80FD\u4F9D\u8D56\u51C6\u786E\u7684\u8BED\u8A00\u68C0\u6D4B\uFF0C\u5EFA\u8BAE\u542F\u7528\u8FDC\u7A0B\u8BED\u8A00\u68C0\u6D4B\u3002",en:"This feature relies on accurate language detection. It is recommended to enable remote language detection."},add_context_menus:{zh:"\u6DFB\u52A0\u53F3\u952E\u83DC\u5355",en:"Add Context Menus"}}; +var UI_LANGS=(/* unused pure expression or super */ null && ([["en","English"],["zh","中文"]]));var customApiLangs="[\"en\", \"English - English\"],\n[\"zh-CN\", \"Simplified Chinese - \u7B80\u4F53\u4E2D\u6587\"],\n[\"zh-TW\", \"Traditional Chinese - \u7E41\u9AD4\u4E2D\u6587\"],\n[\"ar\", \"Arabic - \u0627\u0644\u0639\u0631\u0628\u064A\u0629\"],\n[\"bg\", \"Bulgarian - \u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438\"],\n[\"ca\", \"Catalan - Catal\xE0\"],\n[\"hr\", \"Croatian - Hrvatski\"],\n[\"cs\", \"Czech - \u010Ce\u0161tina\"],\n[\"da\", \"Danish - Dansk\"],\n[\"nl\", \"Dutch - Nederlands\"],\n[\"fi\", \"Finnish - Suomi\"],\n[\"fr\", \"French - Fran\xE7ais\"],\n[\"de\", \"German - Deutsch\"],\n[\"el\", \"Greek - \u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC\"],\n[\"hi\", \"Hindi - \u0939\u093F\u0928\u094D\u0926\u0940\"],\n[\"hu\", \"Hungarian - Magyar\"],\n[\"id\", \"Indonesian - Indonesia\"],\n[\"it\", \"Italian - Italiano\"],\n[\"ja\", \"Japanese - \u65E5\u672C\u8A9E\"],\n[\"ko\", \"Korean - \uD55C\uAD6D\uC5B4\"],\n[\"ms\", \"Malay - Melayu\"],\n[\"mt\", \"Maltese - Malti\"],\n[\"nb\", \"Norwegian - Norsk Bokm\xE5l\"],\n[\"pl\", \"Polish - Polski\"],\n[\"pt\", \"Portuguese - Portugu\xEAs\"],\n[\"ro\", \"Romanian - Rom\xE2n\u0103\"],\n[\"ru\", \"Russian - \u0420\u0443\u0441\u0441\u043A\u0438\u0439\"],\n[\"sk\", \"Slovak - Sloven\u010Dina\"],\n[\"sl\", \"Slovenian - Sloven\u0161\u010Dina\"],\n[\"es\", \"Spanish - Espa\xF1ol\"],\n[\"sv\", \"Swedish - Svenska\"],\n[\"ta\", \"Tamil - \u0BA4\u0BAE\u0BBF\u0BB4\u0BCD\"],\n[\"te\", \"Telugu - \u0C24\u0C46\u0C32\u0C41\u0C17\u0C41\"],\n[\"th\", \"Thai - \u0E44\u0E17\u0E22\"],\n[\"tr\", \"Turkish - T\xFCrk\xE7e\"],\n[\"uk\", \"Ukrainian - \u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430\"],\n[\"vi\", \"Vietnamese - Ti\u1EBFng Vi\u1EC7t\"],\n";var customApiHelpZH="/// \u81EA\u5B9A\u4E49\u7FFB\u8BD1\u6E90\u63A5\u53E3\u8BF4\u660E\n\n// \u8BF7\u6C42\uFF08Request\uFF09\u6570\u636E\u5C06\u6309\u4E0B\u9762\u89C4\u8303\u53D1\u9001\n{\n url: {{YOUR_URL}},\n method: \"POST\",\n headers: {\n \"Content-type\": \"application/json\",\n \"Authorization\": \"Bearer {{YOUR_KEY}}\",\n },\n body: {\n text: \"\", // \u9700\u8981\u7FFB\u8BD1\u7684\u6587\u5B57\n from: \"\", // \u6E90\u8BED\u8A00\uFF0C\u53EF\u80FD\u4E3A\u7A7A\uFF0C\u8868\u793A\u9700\u8981\u63A5\u53E3\u81EA\u52A8\u8BC6\u522B\u8BED\u8A00\n to: \"\", // \u76EE\u6807\u8BED\u8A00\n }\n}\n\n// \u8FD4\u56DE\uFF08Response\uFF09\u6570\u636E\u9700\u7B26\u5408\u4E0B\u9762\u7684JSON\u89C4\u8303\n{\n text: \"\", // \u7FFB\u8BD1\u540E\u7684\u6587\u5B57\n from: \"\", // \u8BC6\u522B\u7684\u6E90\u8BED\u8A00\n to: \"\", // \u76EE\u6807\u8BED\u8A00\uFF08\u53EF\u9009\uFF09\n}\n\n// \u652F\u6301\u7684\u8BED\u8A00\u4EE3\u7801\u5982\u4E0B\n".concat(customApiLangs,"\n");var customApiHelpEN="/// Custom translation source interface description\n\n// Request data will be sent according to the following specifications\n{\n url: {{YOUR_URL}},\n method: \"POST\",\n headers: {\n \"Content-type\": \"application/json\",\n \"Authorization\": \"Bearer {{YOUR_KEY}}\",\n },\n body: {\n text: \"\", // text to be translated\n from: \"\", // Source language, may be empty\n to: \"\", // Target language\n }\n}\n\n// The returned data must conform to the following JSON specification\n{\n text: \"\", // translated text\n from: \"\", // Recognized source language\n to: \"\", // Target language (optional)\n}\n\n// The supported language codes are as follows\n".concat(customApiLangs,"\n");var I18N={app_name:{zh:"\u7B80\u7EA6\u7FFB\u8BD1",en:"KISS Translator"},translate:{zh:"\u7FFB\u8BD1",en:"Translate"},custom_api_help:{zh:customApiHelpZH,en:customApiHelpEN},translate_alt:{zh:"\u7FFB\u8BD1 (Alt+Q)",en:"Translate (Alt+Q)"},basic_setting:{zh:"\u57FA\u672C\u8BBE\u7F6E",en:"Basic Setting"},rules_setting:{zh:"\u89C4\u5219\u8BBE\u7F6E",en:"Rules Setting"},apis_setting:{zh:"\u63A5\u53E3\u8BBE\u7F6E",en:"Apis Setting"},sync_setting:{zh:"\u540C\u6B65\u8BBE\u7F6E",en:"Sync Setting"},patch_setting:{zh:"\u8865\u4E01\u8BBE\u7F6E",en:"Patch Setting"},patch_setting_help:{zh:"\u9488\u5BF9\u4E00\u4E9B\u7279\u6B8A\u7F51\u7AD9\u7684\u4FEE\u6B63\u811A\u672C\uFF0C\u4EE5\u4FBF\u7FFB\u8BD1\u8F6F\u4EF6\u5F97\u5230\u66F4\u597D\u7684\u5C55\u793A\u6548\u679C\u3002",en:"Corrected scripts for some special websites so that the translation software can get better display results."},inject_webfix:{zh:"\u6CE8\u5165\u4FEE\u590D\u8865\u4E01",en:"Inject Webfix"},about:{zh:"\u5173\u4E8E",en:"About"},about_md:{zh:"README.md",en:"README.en.md"},about_md_local:{zh:"\u8BF7 [\u70B9\u51FB\u8FD9\u91CC](".concat("https://github.com/fishjar/kiss-translator",") \u67E5\u770B\u8BE6\u60C5\u3002"),en:"Please [click here](".concat("https://github.com/fishjar/kiss-translator",") for details.")},ui_lang:{zh:"\u754C\u9762\u8BED\u8A00",en:"Interface Language"},fetch_limit:{zh:"\u6700\u5927\u8BF7\u6C42\u6570\u91CF (1-100)",en:"Maximum Number Of Request (1-100)"},fetch_interval:{zh:"\u8BF7\u6C42\u95F4\u9694\u65F6\u95F4 (0-5000ms)",en:"Request Interval (0-5000ms)"},min_translate_length:{zh:"\u6700\u5C0F\u7FFB\u8BD1\u957F\u5EA6 (1-100)",en:"Min Translate Length (1-100)"},max_translate_length:{zh:"\u6700\u5927\u7FFB\u8BD1\u957F\u5EA6 (100-10000)",en:"Max Translate Length (100-10000)"},num_of_newline_characters:{zh:"\u6362\u884C\u5B57\u7B26\u6570 (1-1000)",en:"Number of Newline Characters (1-1000)"},translate_service:{zh:"\u7FFB\u8BD1\u670D\u52A1",en:"Translate Service"},mouseover_translation:{zh:"\u9F20\u6807\u60AC\u505C\u7FFB\u8BD1",en:"Mouseover translation"},mk_disable:{zh:"\u7981\u7528",en:"Disable"},mk_mouseover:{zh:"\u9F20\u6807\u60AC\u505C",en:"Mouseover"},mk_ctrlKey:{zh:"Control + \u9F20\u6807\u60AC\u505C",en:"Control + Mouseover"},mk_shiftKey:{zh:"Shift + \u9F20\u6807\u60AC\u505C",en:"Shift + Mouseover"},mk_altKey:{zh:"Alt + \u9F20\u6807\u60AC\u505C",en:"Alt + Mouseover"},from_lang:{zh:"\u539F\u6587\u8BED\u8A00",en:"Source Language"},to_lang:{zh:"\u76EE\u6807\u8BED\u8A00",en:"Target Language"},to_lang2:{zh:"\u7B2C\u4E8C\u76EE\u6807\u8BED\u8A00",en:"Target Language 2"},to_lang2_helper:{zh:"\u8BBE\u5B9A\u540E\uFF0C\u4E0E\u76EE\u6807\u8BED\u8A00\u4EA7\u751F\u4E92\u8BD1\u6548\u679C\uFF0C\u4F46\u4F9D\u8D56\u8FDC\u7A0B\u8BED\u8A00\u8BC6\u522B\u3002",en:"After setting, it will produce mutual translation effect with the target language, but it relies on remote language recognition."},text_style:{zh:"\u6587\u5B57\u6837\u5F0F",en:"Text Style"},text_style_alt:{zh:"\u6587\u5B57\u6837\u5F0F (Alt+C)",en:"Text Style (Alt+C)"},bg_color:{zh:"\u6837\u5F0F\u989C\u8272",en:"Style Color"},remain_unchanged:{zh:"\u4FDD\u7559\u4E0D\u53D8",en:"Remain Unchanged"},google_api:{zh:"\u8C37\u6B4C\u7FFB\u8BD1\u63A5\u53E3",en:"Google Translate API"},default_selector:{zh:"\u9ED8\u8BA4\u9009\u62E9\u5668",en:"Default selector"},selector_rules:{zh:"\u9009\u62E9\u5668\u89C4\u5219",en:"Selector Rules"},save:{zh:"\u4FDD\u5B58",en:"Save"},edit:{zh:"\u7F16\u8F91",en:"Edit"},cancel:{zh:"\u53D6\u6D88",en:"Cancel"},delete:{zh:"\u5220\u9664",en:"Delete"},reset:{zh:"\u91CD\u7F6E",en:"Reset"},add:{zh:"\u6DFB\u52A0",en:"Add"},inject_rules:{zh:"\u6CE8\u5165\u8BA2\u9605\u89C4\u5219",en:"Inject Subscribe Rules"},personal_rules:{zh:"\u4E2A\u4EBA\u89C4\u5219",en:"Rules"},subscribe_rules:{zh:"\u8BA2\u9605\u89C4\u5219",en:"Subscribe"},overwrite_subscribe_rules:{zh:"\u8986\u5199\u8BA2\u9605\u89C4\u5219",en:"Overwrite"},subscribe_url:{zh:"\u8BA2\u9605\u5730\u5740",en:"Subscribe URL"},rules_warn_1:{zh:"1\u3001\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u4E00\u76F4\u751F\u6548\uFF0C\u9009\u62E9\u201C\u6CE8\u5165\u8BA2\u9605\u89C4\u5219\u201D\u540E\uFF0C\u201C\u8BA2\u9605\u89C4\u5219\u201D\u624D\u4F1A\u751F\u6548\u3002",en:"1. The \"Personal Rules\" are always in effect. After selecting \"Inject Subscription Rules\", the \"Subscription Rules\" will take effect."},rules_warn_2:{zh:"2\u3001\u201C\u8BA2\u9605\u89C4\u5219\u201D\u7684\u6CE8\u5165\u4F4D\u7F6E\u662F\u5012\u6570\u7B2C\u4E8C\u7684\u4F4D\u7F6E\uFF0C\u56E0\u6B64\u9664\u5168\u5C40\u89C4\u5219(*)\u5916\uFF0C\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u4F18\u5148\u7EA7\u6BD4\u201C\u8BA2\u9605\u89C4\u5219\u201D\u9AD8\uFF0C\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u586B\u5199\u540C\u6837\u7684\u7F51\u5740\u4F1A\u8986\u76D6\u201D\u8BA2\u9605\u89C4\u5219\u201C\u7684\u6761\u76EE\u3002",en:"2. The injection position of \"Subscription Rules\" is the penultimate position. Therefore, except for the global rules (*), the priority of \"Personal Rules\" is higher than that of \"Subscription Rules\". Filling in the same url in \"Personal Rules\" will overwrite \"Subscription Rules\" entry."},sync_warn:{zh:"\u5982\u679C\u670D\u52A1\u5668\u5B58\u5728\u5176\u4ED6\u5BA2\u6237\u7AEF\u540C\u6B65\u7684\u6570\u636E\uFF0C\u7B2C\u4E00\u6B21\u540C\u6B65\u5C06\u76F4\u63A5\u8986\u76D6\u672C\u5730\u914D\u7F6E\uFF0C\u540E\u9762\u5219\u6839\u636E\u4FEE\u6539\u65F6\u95F4\uFF0C\u65B0\u7684\u8986\u76D6\u65E7\u7684\u3002",en:"If the server has data synchronized by other clients, the first synchronization will directly overwrite the local configuration, and later, according to the modification time, the new one will overwrite the old one."},about_sync_api:{zh:"\u67E5\u770B\u5173\u4E8E\u6570\u636E\u540C\u6B65\u63A5\u53E3\u90E8\u7F72",en:"View About Data Synchronization Interface Deployment"},about_api_proxy:{zh:"\u67E5\u770B\u81EA\u5EFA\u4E00\u4E2A\u7FFB\u8BD1\u63A5\u53E3\u4EE3\u7406",en:"Check out the self-built translation interface proxy"},style_none:{zh:"\u65E0",en:"None"},under_line:{zh:"\u4E0B\u5212\u76F4\u7EBF",en:"Underline"},dot_line:{zh:"\u4E0B\u5212\u70B9\u72B6\u7EBF",en:"Dotted Underline"},dash_line:{zh:"\u4E0B\u5212\u865A\u7EBF",en:"Dashed Underline"},wavy_line:{zh:"\u4E0B\u5212\u6CE2\u6D6A\u7EBF",en:"Wavy Underline"},fuzzy:{zh:"\u6A21\u7CCA",en:"Fuzzy"},highlight:{zh:"\u9AD8\u4EAE",en:"Highlight"},blockquote:{zh:"\u5F15\u7528",en:"Blockquote"},diy_style:{zh:"\u81EA\u5B9A\u4E49\u6837\u5F0F",en:"Custom Style"},diy_style_helper:{zh:"\u9075\u5FAA\u201CCSS\u201D\u7684\u8BED\u6CD5",en:"Follow the syntax of \"CSS\""},setting:{zh:"\u8BBE\u7F6E",en:"Setting"},pattern:{zh:"\u5339\u914D\u7F51\u5740",en:"URL pattern"},pattern_helper:{zh:"1\u3001\u652F\u6301\u661F\u53F7(*)\u901A\u914D\u7B26\u30022\u3001\u591A\u4E2AURL\u7528\u82F1\u6587\u9017\u53F7\u201C,\u201D\u5206\u9694\u3002",en:"1. The asterisk (*) wildcard is supported. 2. Multiple URLs separated by English commas \",\"."},selector_helper:{zh:"1\u3001\u9075\u5FAACSS\u9009\u62E9\u5668\u8BED\u6CD5\u30022\u3001\u7559\u7A7A\u8868\u793A\u91C7\u7528\u5168\u5C40\u8BBE\u7F6E\u30023\u3001\u591A\u4E2ACSS\u9009\u62E9\u5668\u4E4B\u95F4\u7528\u201C;\u201D\u9694\u5F00\u30024\u3001\u201Cshadow root\u201D\u9009\u62E9\u5668\u548C\u5185\u90E8\u9009\u62E9\u5668\u7528\u201C>>>\u201D\u9694\u5F00\u3002",en:"1. Follow CSS selector syntax. 2. Leave blank to adopt the global setting. 3. Separate multiple CSS selectors with \";\". 4. The \"shadow root\" selector and the internal selector are separated by \">>>\"."},translate_switch:{zh:"\u5F00\u542F\u7FFB\u8BD1",en:"Translate Switch"},default_enabled:{zh:"\u9ED8\u8BA4\u5F00\u542F",en:"Enabled"},default_disabled:{zh:"\u9ED8\u8BA4\u5173\u95ED",en:"Disabled"},selector:{zh:"\u9009\u62E9\u5668",en:"Selector"},keep_selector:{zh:"\u4FDD\u7559\u5143\u7D20\u9009\u62E9\u5668",en:"Keep unchanged selector"},keep_selector_helper:{zh:"1\u3001\u9075\u5FAACSS\u9009\u62E9\u5668\u8BED\u6CD5\u30022\u3001\u7559\u7A7A\u8868\u793A\u91C7\u7528\u5168\u5C40\u8BBE\u7F6E\u3002",en:"1. Follow CSS selector syntax. 2. Leave blank to adopt the global setting."},root_selector:{zh:"\u6839\u9009\u62E9\u5668",en:"Root Selector"},fixer_function:{zh:"\u4FEE\u590D\u51FD\u6570",en:"Fixer Function"},import:{zh:"\u5BFC\u5165",en:"Import"},export:{zh:"\u5BFC\u51FA",en:"Export"},error_cant_be_blank:{zh:"\u4E0D\u80FD\u4E3A\u7A7A",en:"Can not be blank"},error_duplicate_values:{zh:"\u5B58\u5728\u91CD\u590D\u7684\u503C",en:"There are duplicate values"},error_wrong_file_type:{zh:"\u9519\u8BEF\u7684\u6587\u4EF6\u7C7B\u578B",en:"Wrong file type"},error_fetch_url:{zh:"\u8BF7\u68C0\u67E5url\u5730\u5740\u662F\u5426\u6B63\u786E\u6216\u7A0D\u540E\u518D\u8BD5\u3002",en:"Please check if the url address is correct or try again later."},deepl_api:{zh:"DeepL \u63A5\u53E3",en:"DeepL API"},deepl_key:{zh:"DeepL \u5BC6\u94A5",en:"DeepL Key"},openai_api:{zh:"OpenAI \u63A5\u53E3",en:"OpenAI API"},openai_key:{zh:"OpenAI \u5BC6\u94A5",en:"OpenAI Key"},openai_model:{zh:"OpenAI \u6A21\u578B",en:"OpenAI Model"},openai_prompt:{zh:"OpenAI \u63D0\u793A\u8BCD",en:"OpenAI Prompt"},if_clear_cache:{zh:"\u662F\u5426\u6E05\u9664\u7F13\u5B58",en:"Whether clear cache"},clear_cache_never:{zh:"\u4E0D\u6E05\u9664\u7F13\u5B58",en:"Never clear cache"},clear_cache_restart:{zh:"\u91CD\u542F\u6D4F\u89C8\u5668\u65F6\u6E05\u9664\u7F13\u5B58",en:"Clear cache when restarting browser"},data_sync_type:{zh:"\u6570\u636E\u540C\u6B65\u65B9\u5F0F",en:"Data Sync Type"},data_sync_url:{zh:"\u6570\u636E\u540C\u6B65\u63A5\u53E3",en:"Data Sync API"},data_sync_user:{zh:"\u6570\u636E\u540C\u6B65\u8D26\u6237",en:"Data Sync User"},data_sync_key:{zh:"\u6570\u636E\u540C\u6B65\u5BC6\u94A5",en:"Data Sync Key"},sync_now:{zh:"\u7ACB\u5373\u540C\u6B65",en:"Sync Now"},sync_success:{zh:"\u540C\u6B65\u6210\u529F\uFF01",en:"Sync Success"},sync_failed:{zh:"\u540C\u6B65\u5931\u8D25\uFF01",en:"Sync Error"},error_got_some_wrong:{zh:"\u62B1\u6B49\uFF0C\u51FA\u9519\u4E86\uFF01",en:"Sorry, something went wrong!"},error_sync_setting:{zh:"\u60A8\u7684\u540C\u6B65\u7C7B\u578B\u5FC5\u987B\u4E3A\u201CKISS-Worker\u201D\uFF0C\u4E14\u9700\u586B\u5199\u5B8C\u6574",en:"Your sync type must be \"KISS-Worker\" and must be filled in completely"},click_test:{zh:"\u70B9\u51FB\u6D4B\u8BD5",en:"Click Test"},test_success:{zh:"\u6D4B\u8BD5\u6210\u529F",en:"Test success"},test_failed:{zh:"\u6D4B\u8BD5\u5931\u8D25",en:"Test failed"},clear_all_cache_now:{zh:"\u7ACB\u5373\u6E05\u9664\u5168\u90E8\u7F13\u5B58",en:"Clear all cache now"},clear_cache:{zh:"\u6E05\u9664\u7F13\u5B58",en:"Clear Cache"},clear_success:{zh:"\u6E05\u9664\u6210\u529F",en:"Clear success"},clear_failed:{zh:"\u6E05\u9664\u5931\u8D25",en:"Clear failed"},share:{zh:"\u5206\u4EAB",en:"Share"},clear_all:{zh:"\u6E05\u7A7A",en:"Clear All"},help:{zh:"\u6C42\u52A9",en:"Help"},restore_default:{zh:"\u6062\u590D\u9ED8\u8BA4",en:"Restore Default"},shortcuts_setting:{zh:"\u5FEB\u6377\u952E\u8BBE\u7F6E",en:"Shortcuts Setting"},toggle_translate_shortcut:{zh:"\"\u5F00\u542F\u7FFB\u8BD1\"\u5FEB\u6377\u952E",en:"\"Toggle Translate\" Shortcut"},toggle_style_shortcut:{zh:"\"\u5207\u6362\u6837\u5F0F\"\u5FEB\u6377\u952E",en:"\"Toggle Style\" Shortcut"},toggle_popup_shortcut:{zh:"\"\u6253\u5F00\u5F39\u7A97\"\u5FEB\u6377\u952E",en:"\"Open Popup\" Shortcut"},open_setting_shortcut:{zh:"\"\u6253\u5F00\u8BBE\u7F6E\"\u5FEB\u6377\u952E",en:"\"Open Setting\" Shortcut"},hide_fab_button:{zh:"\u9690\u85CF\u60AC\u6D6E\u6309\u94AE",en:"Hide Fab Button"},hide_tran_button:{zh:"\u9690\u85CF\u7FFB\u8BD1\u6309\u94AE",en:"Hide Translate Button"},show:{zh:"\u663E\u793A",en:"Show"},hide:{zh:"\u9690\u85CF",en:"Hide"},save_rule:{zh:"\u4FDD\u5B58\u89C4\u5219",en:"Save Rule"},global_rule:{zh:"\u5168\u5C40\u89C4\u5219",en:"Global Rule"},input_translate:{zh:"\u8F93\u5165\u6846\u7FFB\u8BD1",en:"Input Box Translation"},use_input_box_translation:{zh:"\u542F\u7528\u8F93\u5165\u6846\u7FFB\u8BD1",en:"Input Box Translation"},input_selector:{zh:"\u8F93\u5165\u6846\u9009\u62E9\u5668",en:"Input Selector"},input_selector_helper:{zh:"\u7528\u4E8E\u8F93\u5165\u6846\u7FFB\u8BD1\u3002",en:"Used for input box translation."},trigger_trans_shortcut:{zh:"\u89E6\u53D1\u7FFB\u8BD1\u5FEB\u6377\u952E",en:"Trigger Translation Shortcut Keys"},trigger_trans_shortcut_help:{zh:"\u9ED8\u8BA4\u4E3A\u5355\u51FB\u201CAltLeft+KeyI\u201D",en:"Default is \"AltLeft+KeyI\""},shortcut_press_count:{zh:"\u5FEB\u6377\u952E\u8FDE\u51FB\u6B21\u6570",en:"Shortcut Press Number"},combo_timeout:{zh:"\u8FDE\u51FB\u8D85\u65F6\u65F6\u95F4 (10-1000ms)",en:"Combo Timeout (10-1000ms)"},input_trans_start_sign:{zh:"\u7FFB\u8BD1\u8D77\u59CB\u6807\u8BC6",en:"Translation Start Sign"},input_trans_start_sign_help:{zh:"\u6807\u8BC6\u540E\u9762\u53EF\u4EE5\u52A0\u76EE\u6807\u8BED\u8A00\u4EE3\u7801\uFF0C\u5982\uFF1A \u201C/en \u4F60\u597D\u201D\u3001\u201C/zh hello\u201D",en:"The target language code can be added after the sign, such as: \"/en \u4F60\u597D\", \"/zh hello\""},detect_lang_remote:{zh:"\u8FDC\u7A0B\u8BED\u8A00\u68C0\u6D4B",en:"Remote language detection"},detect_lang_remote_help:{zh:"\u542F\u7528\u540E\u68C0\u6D4B\u51C6\u786E\u5EA6\u589E\u52A0\uFF0C\u4F46\u4F1A\u964D\u4F4E\u7FFB\u8BD1\u901F\u5EA6\uFF0C\u8BF7\u914C\u60C5\u5F00\u542F",en:"After enabling, the detection accuracy will increase, but it will reduce the translation speed. Please enable it as appropriate."},disable:{zh:"\u7981\u7528",en:"Disable"},enable:{zh:"\u542F\u7528",en:"Enable"},selection_translate:{zh:"\u5212\u8BCD\u7FFB\u8BD1",en:"Selection Translate"},toggle_selection_translate:{zh:"\u542F\u7528\u5212\u8BCD\u7FFB\u8BD1",en:"Use Selection Translate"},trigger_tranbox_shortcut:{zh:"\u663E\u793A\u7FFB\u8BD1\u6846/\u7FFB\u8BD1\u9009\u4E2D\u6587\u5B57\u5FEB\u6377\u952E",en:"Open Translate Popup/Translate Selected Shortcut"},tranbtn_offset_x:{zh:"\u7FFB\u8BD1\u6309\u94AE\u504F\u79FBX\uFF080-100\uFF09",en:"Translate Button Offset X (0-100)"},tranbtn_offset_y:{zh:"\u7FFB\u8BD1\u6309\u94AE\u504F\u79FBY\uFF080-100\uFF09",en:"Translate Button Offset Y (0-100)"},translated_text:{zh:"\u8BD1\u6587",en:"Translated Text"},original_text:{zh:"\u539F\u6587",en:"Original Text"},favorite_words:{zh:"\u6536\u85CF\u8BCD\u6C47",en:"Favorite Words"},touch_setting:{zh:"\u89E6\u5C4F\u8BBE\u7F6E",en:"Touch Setting"},touch_translate_shortcut:{zh:"\u89E6\u5C4F\u7FFB\u8BD1\u5FEB\u6377\u65B9\u5F0F",en:"Touch Translate Shortcut"},touch_tap_0:{zh:"\u7981\u7528",en:"Disable"},touch_tap_2:{zh:"\u53CC\u6307\u8F7B\u89E6",en:"Two finger tap"},touch_tap_3:{zh:"\u4E09\u6307\u8F7B\u89E6",en:"Three finger tap"},touch_tap_4:{zh:"\u56DB\u6307\u8F7B\u89E6",en:"Four finger tap"},translate_blacklist:{zh:"\u7981\u7528\u7FFB\u8BD1\u540D\u5355",en:"Translate Blacklist"},disable_langs:{zh:"\u4E0D\u7FFB\u8BD1\u7684\u8BED\u8A00",en:"Disable Languages"},disable_langs_helper:{zh:"\u6B64\u529F\u80FD\u4F9D\u8D56\u51C6\u786E\u7684\u8BED\u8A00\u68C0\u6D4B\uFF0C\u5EFA\u8BAE\u542F\u7528\u8FDC\u7A0B\u8BED\u8A00\u68C0\u6D4B\u3002",en:"This feature relies on accurate language detection. It is recommended to enable remote language detection."},add_context_menus:{zh:"\u6DFB\u52A0\u53F3\u952E\u83DC\u5355",en:"Add Context Menus"},mulkeys_help:{zh:"\u652F\u6301\u82F1\u6587\u9017\u53F7\u9694\u5F00\u591A\u4E2AKEY\u8F6E\u5BFB\u8C03\u7528\u3002",en:"Supports multiple KEY round calling calls separated by English commas."}}; ;// CONCATENATED MODULE: ./src/config/index.js var _OPT_LANGS_SPECIAL,_DEFAULT_TRANS_APIS,_DEFAULT_SHORTCUTS;var STOKEY_MSAUTH="".concat(APP_NAME,"_msauth");var STOKEY_BDAUTH="".concat(APP_NAME,"_bdauth");var config_STOKEY_SETTING="".concat(APP_NAME,"_setting");var config_STOKEY_RULES="".concat(APP_NAME,"_rules");var config_STOKEY_WFRULES="".concat(APP_NAME,"_webfix_rules");var STOKEY_WORDS="".concat(APP_NAME,"_words");var config_STOKEY_SYNC="".concat(APP_NAME,"_sync");var config_STOKEY_FAB="".concat(APP_NAME,"_fab");var config_STOKEY_RULESCACHE_PREFIX="".concat(APP_NAME,"_rulescache_");var STOKEY_WEBFIXCACHE_PREFIX="".concat(APP_NAME,"_webfixcache_");var CMD_TOGGLE_TRANSLATE="toggleTranslate";var CMD_TOGGLE_STYLE="toggleStyle";var CMD_OPEN_OPTIONS="openOptions";var CMD_OPEN_TRANBOX="openTranbox";var CLIENT_WEB="web";var CLIENT_CHROME="chrome";var CLIENT_EDGE="edge";var CLIENT_FIREFOX="firefox";var CLIENT_USERSCRIPT="userscript";var CLIENT_EXTS=[CLIENT_CHROME,CLIENT_EDGE,CLIENT_FIREFOX];var KV_RULES_KEY="kiss-rules.json";var config_KV_WFRULES_KEY="kiss-webfix.json";var KV_WORDS_KEY="kiss-words.json";var config_KV_RULES_SHARE_KEY="kiss-rules-share.json";var KV_SETTING_KEY="kiss-setting.json";var KV_SALT_SYNC="KISS-Translator-SYNC";var config_KV_SALT_SHARE="KISS-Translator-SHARE";var CACHE_NAME="".concat(APP_NAME,"_cache");var MSG_FETCH="fetch";var MSG_FETCH_LIMIT="fetch_limit";var MSG_FETCH_CLEAR="fetch_clear";var MSG_OPEN_OPTIONS="open_options";var MSG_SAVE_RULE="save_rule";var MSG_TRANS_TOGGLE="trans_toggle";var MSG_TRANS_TOGGLE_STYLE="trans_toggle_style";var MSG_OPEN_TRANBOX="open_tranbox";var MSG_TRANS_GETRULE="trans_getrule";var MSG_TRANS_PUTRULE="trans_putrule";var MSG_TRANS_CURRULE="trans_currule";var MSG_CONTEXT_MENUS="context_menus";var THEME_LIGHT="light";var THEME_DARK="dark";var URL_KISS_WORKER="https://github.com/fishjar/kiss-worker";var URL_KISS_PROXY="https://github.com/fishjar/kiss-proxy";var URL_KISS_RULES="https://github.com/fishjar/kiss-rules";var URL_KISS_RULES_NEW_ISSUE="https://github.com/fishjar/kiss-rules/issues/new";var config_URL_RAW_PREFIX="https://raw.githubusercontent.com/fishjar/kiss-translator/master";var URL_CACHE_TRAN="https://".concat(APP_LCNAME,"/translate");var URL_MICROSOFT_TRAN="https://api-edge.cognitive.microsofttranslator.com/translate";var URL_MICROSOFT_AUTH="https://edge.microsoft.com/translate/auth";var URL_BAIDU_LANGDETECT="https://fanyi.baidu.com/langdetect";var URL_BAIDU_WEB="https://fanyi.baidu.com/";var URL_BAIDU_TRAN="https://fanyi.baidu.com/v2transapi";var URL_DEEPLFREE_TRAN="https://www2.deepl.com/jsonrpc";var config_URL_TENCENT_TRANSMART="https://transmart.qq.com/api/imt";var OPT_TRANS_GOOGLE="Google";var OPT_TRANS_MICROSOFT="Microsoft";var OPT_TRANS_DEEPL="DeepL";var OPT_TRANS_DEEPLX="DeepLX";var OPT_TRANS_DEEPLFREE="DeepLFree";var OPT_TRANS_BAIDU="Baidu";var OPT_TRANS_TENCENT="Tencent";var OPT_TRANS_OPENAI="OpenAI";var OPT_TRANS_GEMINI="Gemini";var OPT_TRANS_CLOUDFLAREAI="CloudflareAI";var OPT_TRANS_CUSTOMIZE="Custom";var OPT_TRANS_ALL=[OPT_TRANS_GOOGLE,OPT_TRANS_MICROSOFT,OPT_TRANS_DEEPL,OPT_TRANS_DEEPLFREE,OPT_TRANS_DEEPLX,OPT_TRANS_BAIDU,OPT_TRANS_TENCENT,OPT_TRANS_OPENAI,OPT_TRANS_GEMINI,OPT_TRANS_CLOUDFLAREAI,OPT_TRANS_CUSTOMIZE];var OPT_LANGS_TO=[["en","English - English"],["zh-CN","Simplified Chinese - 简体中文"],["zh-TW","Traditional Chinese - 繁體中文"],["ar","Arabic - العربية"],["bg","Bulgarian - Български"],["ca","Catalan - Català"],["hr","Croatian - Hrvatski"],["cs","Czech - Čeština"],["da","Danish - Dansk"],["nl","Dutch - Nederlands"],["fi","Finnish - Suomi"],["fr","French - Français"],["de","German - Deutsch"],["el","Greek - Ελληνικά"],["hi","Hindi - हिन्दी"],["hu","Hungarian - Magyar"],["id","Indonesian - Indonesia"],["it","Italian - Italiano"],["ja","Japanese - 日本語"],["ko","Korean - 한국어"],["ms","Malay - Melayu"],["mt","Maltese - Malti"],["nb","Norwegian - Norsk Bokmål"],["pl","Polish - Polski"],["pt","Portuguese - Português"],["ro","Romanian - Română"],["ru","Russian - Русский"],["sk","Slovak - Slovenčina"],["sl","Slovenian - Slovenščina"],["es","Spanish - Español"],["sv","Swedish - Svenska"],["ta","Tamil - தமிழ்"],["te","Telugu - తెలుగు"],["th","Thai - ไทย"],["tr","Turkish - Türkçe"],["uk","Ukrainian - Українська"],["vi","Vietnamese - Tiếng Việt"]];var OPT_LANGS_FROM=[["auto","Auto-detect"]].concat(OPT_LANGS_TO);var OPT_LANGS_SPECIAL=(_OPT_LANGS_SPECIAL={},(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_GOOGLE,new Map(OPT_LANGS_FROM.map(function(_ref){var _ref2=(0,slicedToArray/* default */.Z)(_ref,1),key=_ref2[0];return[key,key];}))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_MICROSOFT,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref3){var _ref4=(0,slicedToArray/* default */.Z)(_ref3,1),key=_ref4[0];return[key,key];})),[["auto",""],["zh-CN","zh-Hans"],["zh-TW","zh-Hant"]]))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_DEEPL,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref5){var _ref6=(0,slicedToArray/* default */.Z)(_ref5,1),key=_ref6[0];return[key,key.toUpperCase()];})),[["auto",""],["zh-CN","ZH"],["zh-TW","ZH"]]))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_DEEPLFREE,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref7){var _ref8=(0,slicedToArray/* default */.Z)(_ref7,1),key=_ref8[0];return[key,key.toUpperCase()];})),[["auto","auto"],["zh-CN","ZH"],["zh-TW","ZH"]]))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_DEEPLX,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref9){var _ref10=(0,slicedToArray/* default */.Z)(_ref9,1),key=_ref10[0];return[key,key.toUpperCase()];})),[["auto",""],["zh-CN","ZH"],["zh-TW","ZH"]]))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_BAIDU,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref11){var _ref12=(0,slicedToArray/* default */.Z)(_ref11,1),key=_ref12[0];return[key,key];})),[["zh-CN","zh"],["zh-TW","cht"],["ar","ara"],["bg","bul"],["ca","cat"],["hr","hrv"],["da","dan"],["fi","fin"],["fr","fra"],["hi","mai"],["ja","jp"],["ko","kor"],["ms","may"],["mt","mlt"],["nb","nor"],["ro","rom"],["ru","ru"],["sl","slo"],["es","spa"],["sv","swe"],["ta","tam"],["te","tel"],["uk","ukr"],["vi","vie"]]))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_TENCENT,new Map([["auto","auto"],["zh-CN","zh"],["zh-TW","zh"],["en","en"],["ar","ar"],["de","de"],["ru","ru"],["fr","fr"],["fi","fil"],["ko","ko"],["ms","ms"],["pt","pt"],["ja","ja"],["th","th"],["tr","tr"],["es","es"],["it","it"],["hi","hi"],["id","id"],["vi","vi"]])),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_OPENAI,new Map(OPT_LANGS_FROM.map(function(_ref13){var _ref14=(0,slicedToArray/* default */.Z)(_ref13,2),key=_ref14[0],val=_ref14[1];return[key,val.split(" - ")[0]];}))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_GEMINI,new Map(OPT_LANGS_FROM.map(function(_ref15){var _ref16=(0,slicedToArray/* default */.Z)(_ref15,2),key=_ref16[0],val=_ref16[1];return[key,val.split(" - ")[0]];}))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_CLOUDFLAREAI,new Map([["auto",""],["zh-CN","chinese"],["zh-TW","chinese"],["en","english"],["ar","arabic"],["de","german"],["ru","russian"],["fr","french"],["pt","portuguese"],["ja","japanese"],["es","spanish"],["hi","hindi"]])),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_CUSTOMIZE,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref17){var _ref18=(0,slicedToArray/* default */.Z)(_ref17,1),key=_ref18[0];return[key,key];})),[["auto",""]]))),_OPT_LANGS_SPECIAL);var OPT_LANGS_LIST=OPT_LANGS_TO.map(function(_ref19){var _ref20=(0,slicedToArray/* default */.Z)(_ref19,1),lang=_ref20[0];return lang;});var OPT_LANGS_BAIDU=new Map(Array.from(OPT_LANGS_SPECIAL[OPT_TRANS_BAIDU].entries()).map(function(_ref21){var _ref22=(0,slicedToArray/* default */.Z)(_ref21,2),k=_ref22[0],v=_ref22[1];return[v,k];}));var config_OPT_LANGS_TENCENT=new Map(Array.from(OPT_LANGS_SPECIAL[OPT_TRANS_TENCENT].entries()).map(function(_ref23){var _ref24=(0,slicedToArray/* default */.Z)(_ref23,2),k=_ref24[0],v=_ref24[1];return[v,k];}));config_OPT_LANGS_TENCENT.set("zh","zh-CN");var OPT_STYLE_NONE="style_none";// 无 var OPT_STYLE_LINE="under_line";// 下划线 @@ -19501,7 +19501,7 @@ var PROMPT_PLACE_TO="{{to}}";// 占位符 var PROMPT_PLACE_TEXT="{{text}}";// 占位符 var DEFAULT_COLOR="#209CEE";// 默认高亮背景色/线条颜色 // 全局规则 -var GLOBLA_RULE={pattern:"*",selector:DEFAULT_SELECTOR,translator:OPT_TRANS_MICROSOFT,fromLang:"auto",toLang:"zh-CN",textStyle:OPT_STYLE_DASHLINE,transOpen:"false",bgColor:"",textDiyStyle:""};// 输入框翻译 +var GLOBLA_RULE={pattern:"*",selector:DEFAULT_SELECTOR,keepSelector:DEFAULT_KEEP_SELECTOR,translator:OPT_TRANS_MICROSOFT,fromLang:"auto",toLang:"zh-CN",textStyle:OPT_STYLE_DASHLINE,transOpen:"false",bgColor:"",textDiyStyle:""};// 输入框翻译 var OPT_INPUT_TRANS_SIGNS=["/","//","\\","\\\\",">",">>"];var DEFAULT_INPUT_SHORTCUT=["AltLeft","KeyI"];var DEFAULT_INPUT_RULE={transOpen:true,translator:OPT_TRANS_MICROSOFT,fromLang:"auto",toLang:"en",triggerShortcut:DEFAULT_INPUT_SHORTCUT,triggerCount:1,triggerTime:200,transSign:OPT_INPUT_TRANS_SIGNS[0]};// 划词翻译 var DEFAULT_TRANBOX_SHORTCUT=["AltLeft","KeyS"];var DEFAULT_TRANBOX_SETTING={transOpen:true,translator:OPT_TRANS_MICROSOFT,fromLang:"auto",toLang:"zh-CN",toLang2:"en",tranboxShortcut:DEFAULT_TRANBOX_SHORTCUT,btnOffsetX:10,btnOffsetY:10,hideTranBtn:false};// 订阅列表 var DEFAULT_SUBRULES_LIST=[{url:"https://fishjar.github.io/kiss-rules/kiss-rules.json",selected:false},{url:"https://fishjar.github.io/kiss-rules/kiss-rules-on.json",selected:true},{url:"https://fishjar.github.io/kiss-rules/kiss-rules-off.json",selected:false}];// 翻译接口 @@ -20288,7 +20288,8 @@ var id=1e4*Math.round(1e4*Math.random());var genDeeplFree=function genDeeplFree( */var _bdAuth=function _bdAuth(){var store;return/*#__PURE__*/asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(){var now;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:now=Date.now();// 查询内存缓存 if(!(store&&store.exp>now)){_context2.next=3;break;}return _context2.abrupt("return",store);case 3:_context2.next=5;return getBdauth();case 5:store=_context2.sent;if(!(store&&store.exp>now)){_context2.next=8;break;}return _context2.abrupt("return",store);case 8:_context2.next=10;return getToken();case 10:store=_context2.sent;_context2.next=13;return setBdauth(store);case 13:return _context2.abrupt("return",store);case 14:case"end":return _context2.stop();}},_callee2);}));};var bdAuth=_bdAuth();var genBaidu=/*#__PURE__*/function(){var _ref4=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee3(_ref3){var text,from,to,_yield$bdAuth,token,gtk,sign,data,input,init;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:text=_ref3.text,from=_ref3.from,to=_ref3.to;_context3.next=3;return bdAuth();case 3:_yield$bdAuth=_context3.sent;token=_yield$bdAuth.token;gtk=_yield$bdAuth.gtk;sign=getSign(text,gtk);data={from:from,to:to,query:text,simple_means_flag:3,sign:sign,token:token,domain:"common",ts:Date.now()};input="".concat(URL_BAIDU_TRAN,"?from=").concat(from,"&to=").concat(to);init={headers:{"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},method:"POST",body:query_string.stringify(data)};return _context3.abrupt("return",[input,init]);case 11:case"end":return _context3.stop();}},_callee3);}));return function genBaidu(_x){return _ref4.apply(this,arguments);};}(); ;// CONCATENATED MODULE: ./src/libs/req.js -/** +var keyMap=new Map();// 轮询key +var keyPick=function keyPick(translator){var _keyMap$get;var key=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";var keys=key.split(",").map(function(item){return item.trim();}).filter(Boolean);if(keys.length===0){return"";}var preIndex=(_keyMap$get=keyMap.get(translator))!==null&&_keyMap$get!==void 0?_keyMap$get:-1;var curIndex=(preIndex+1)%keys.length;keyMap.set(translator,curIndex);return keys[curIndex];};/** * 构造缓存 request * @param {*} request * @returns @@ -20300,7 +20301,7 @@ parts:[{text:prompt}]}]};var input="".concat(url,"/").concat(model,":generateCon * 构造翻译接口 request * @param {*} * @returns - */var newTransReq=function newTransReq(_ref12,apiSetting){var translator=_ref12.translator,text=_ref12.text,from=_ref12.from,to=_ref12.to;var args=_objectSpread2({text:text,from:from,to:to},apiSetting);switch(translator){case OPT_TRANS_GOOGLE:return genGoogle(args);case OPT_TRANS_MICROSOFT:return genMicrosoft(args);case OPT_TRANS_DEEPL:return genDeepl(args);case OPT_TRANS_DEEPLFREE:return genDeeplFree(args);case OPT_TRANS_DEEPLX:return genDeeplX(args);case OPT_TRANS_BAIDU:return genBaidu(args);case OPT_TRANS_TENCENT:return genTencent(args);case OPT_TRANS_OPENAI:return genOpenAI(args);case OPT_TRANS_GEMINI:return genGemini(args);case OPT_TRANS_CLOUDFLAREAI:return genCloudflareAI(args);case OPT_TRANS_CUSTOMIZE:return genCustom(args);default:throw new Error("[trans] translator: ".concat(translator," not support"));}}; + */var newTransReq=function newTransReq(_ref12,apiSetting){var translator=_ref12.translator,text=_ref12.text,from=_ref12.from,to=_ref12.to;var args=_objectSpread2({text:text,from:from,to:to},apiSetting);switch(translator){case OPT_TRANS_DEEPL:case OPT_TRANS_OPENAI:case OPT_TRANS_GEMINI:case OPT_TRANS_CLOUDFLAREAI:args.key=keyPick(translator,args.key);break;default:}switch(translator){case OPT_TRANS_GOOGLE:return genGoogle(args);case OPT_TRANS_MICROSOFT:return genMicrosoft(args);case OPT_TRANS_DEEPL:return genDeepl(args);case OPT_TRANS_DEEPLFREE:return genDeeplFree(args);case OPT_TRANS_DEEPLX:return genDeeplX(args);case OPT_TRANS_BAIDU:return genBaidu(args);case OPT_TRANS_TENCENT:return genTencent(args);case OPT_TRANS_OPENAI:return genOpenAI(args);case OPT_TRANS_GEMINI:return genGemini(args);case OPT_TRANS_CLOUDFLAREAI:return genCloudflareAI(args);case OPT_TRANS_CUSTOMIZE:return genCustom(args);default:throw new Error("[trans] translator: ".concat(translator," not support"));}}; ;// CONCATENATED MODULE: ./src/libs/fetch.js var fetch_excluded=["response","responseHeaders","status","statusText"],_excluded2=["useCache","usePool","transOpts","apiSetting"];/** * 油猴脚本的请求封装 @@ -23266,7 +23267,7 @@ var web_n = {}; return t.length === e && "." !== t && ".." !== t; }; }, - te = "object" === ("undefined" == typeof process ? "undefined" : Nt(process)) && process ? "object" === Nt(({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.15","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"})) && ({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.15","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"}) && ({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.15","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"}).__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix"; + te = "object" === ("undefined" == typeof process ? "undefined" : Nt(process)) && process ? "object" === Nt(({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.16","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"})) && ({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.16","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"}) && ({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.16","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"}).__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix"; It.sep = "win32" === te ? "\\" : "/"; var ee = Symbol("globstar **"); It.GLOBSTAR = ee; @@ -33348,7 +33349,7 @@ var DarkMode = __webpack_require__(2675); ;// CONCATENATED MODULE: ./src/views/Options/DarkModeButton.js function DarkModeButton(){var _useDarkMode=useDarkMode(),darkMode=_useDarkMode.darkMode,toggleDarkMode=_useDarkMode.toggleDarkMode;return/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{onClick:toggleDarkMode,color:"inherit",children:darkMode?/*#__PURE__*/(0,jsx_runtime.jsx)(LightMode/* default */.Z,{}):/*#__PURE__*/(0,jsx_runtime.jsx)(DarkMode/* default */.Z,{})});} ;// CONCATENATED MODULE: ./src/views/Popup/Header.js -function Header(_ref){var setShowPopup=_ref.setShowPopup;var handleHomepage=function handleHomepage(){window.open("https://github.com/fishjar/kiss-translator","_blank");};return/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",justifyContent:"flex-start",alignItems:"center",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{onClick:handleHomepage,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Home/* default */.Z,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Typography_Typography,{component:"div",sx:{userSelect:"none",WebkitUserSelect:"none",fontWeight:"bold"},children:"".concat("KISS Translator"," v").concat("1.7.15")})]}),setShowPopup?/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{onClick:function onClick(){setShowPopup(false);},children:/*#__PURE__*/(0,jsx_runtime.jsx)(Close/* default */.Z,{})}):/*#__PURE__*/(0,jsx_runtime.jsx)(DarkModeButton,{})]});} +function Header(_ref){var setShowPopup=_ref.setShowPopup;var handleHomepage=function handleHomepage(){window.open("https://github.com/fishjar/kiss-translator","_blank");};return/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",justifyContent:"flex-start",alignItems:"center",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{onClick:handleHomepage,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Home/* default */.Z,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Typography_Typography,{component:"div",sx:{userSelect:"none",WebkitUserSelect:"none",fontWeight:"bold"},children:"".concat("KISS Translator"," v").concat("1.7.16")})]}),setShowPopup?/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{onClick:function onClick(){setShowPopup(false);},children:/*#__PURE__*/(0,jsx_runtime.jsx)(Close/* default */.Z,{})}):/*#__PURE__*/(0,jsx_runtime.jsx)(DarkModeButton,{})]});} ;// CONCATENATED MODULE: ./src/libs/iframe.js var isIframe=window.self!==window.top;var sendIframeMsg=function sendIframeMsg(action,args){document.querySelectorAll("iframe").forEach(function(iframe){iframe.contentWindow.postMessage({action:action,args:args},"*");});};var sendParentMsg=function sendParentMsg(action,args){window.parent.postMessage({action:action,args:args},"*");}; ;// CONCATENATED MODULE: ./src/libs/webfix.js @@ -33391,8 +33392,11 @@ var _fixerMap;/** * @param {*} url * @returns */var loadOrFetchWebfix=/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(url){var sites;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=3;return getWebfix(url);case 3:sites=_context2.sent;if(!(sites!==null&&sites!==void 0&&sites.length)){_context2.next=6;break;}return _context2.abrupt("return",sites);case 6:return _context2.abrupt("return",syncWebfix(url));case 9:_context2.prev=9;_context2.t0=_context2["catch"](0);console.log("[load webfix]",_context2.t0.message);return _context2.abrupt("return",DEFAULT_SITES);case 13:case"end":return _context2.stop();}},_callee2,null,[[0,9]]);}));return function loadOrFetchWebfix(_x2){return _ref2.apply(this,arguments);};}();/** - * 匹配站点 - */function runWebfix(_x3){return _runWebfix.apply(this,arguments);}function _runWebfix(){_runWebfix=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee3(_ref3){var injectWebfix,href,userSites,subSites,sites,i,site;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:injectWebfix=_ref3.injectWebfix;_context3.prev=1;if(injectWebfix){_context3.next=4;break;}return _context3.abrupt("return");case 4:href=document.location.href;_context3.next=7;return storage_getWebfixRulesWithDefault();case 7:userSites=_context3.sent;_context3.next=10;return loadOrFetchWebfix("https://fishjar.github.io/kiss-rules/kiss-webfix.json");case 10:subSites=_context3.sent;sites=[].concat((0,toConsumableArray/* default */.Z)(userSites),(0,toConsumableArray/* default */.Z)(subSites));i=0;case 13:if(!(iinterval)){_context4.next=15;break;}_context4.next=11;re * @param {*} rules * @param {string} href * @returns - */var matchRule=/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(href,_ref){var _rule$selector;var _ref$injectRules,injectRules,_ref$subrulesList,subrulesList,_ref$owSubrule,owSubrule,rules,selectedSub,mixRule,subRules,rule,globalRule,_rule$bgColor,_rule$textDiyStyle;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_ref$injectRules=_ref.injectRules,injectRules=_ref$injectRules===void 0?true:_ref$injectRules,_ref$subrulesList=_ref.subrulesList,subrulesList=_ref$subrulesList===void 0?DEFAULT_SUBRULES_LIST:_ref$subrulesList,_ref$owSubrule=_ref.owSubrule,owSubrule=_ref$owSubrule===void 0?DEFAULT_OW_RULE:_ref$owSubrule;_context.next=3;return getRulesWithDefault();case 3:rules=_context.sent;if(!injectRules){_context.next=20;break;}_context.prev=5;selectedSub=subrulesList.find(function(item){return item.selected;});if(!(selectedSub!==null&&selectedSub!==void 0&&selectedSub.url)){_context.next=15;break;}mixRule={};Object.entries(owSubrule).filter(function(_ref3){var _ref4=(0,slicedToArray/* default */.Z)(_ref3,2),key=_ref4[0],val=_ref4[1];if(owSubrule.textStyle===REMAIN_KEY&&(key==="bgColor"||key==="textDiyStyle")){return false;}return val!==REMAIN_KEY;}).forEach(function(_ref5){var _ref6=(0,slicedToArray/* default */.Z)(_ref5,2),key=_ref6[0],val=_ref6[1];mixRule[key]=val;});_context.next=12;return loadOrFetchSubRules(selectedSub.url);case 12:subRules=_context.sent;subRules=subRules.map(function(item){return _objectSpread2(_objectSpread2({},item),mixRule);});rules.splice.apply(rules,[-1,0].concat((0,toConsumableArray/* default */.Z)(subRules)));case 15:_context.next=20;break;case 17:_context.prev=17;_context.t0=_context["catch"](5);console.log("[load injectRules]",_context.t0);case 20:rule=rules.find(function(r){return r.pattern.split(",").some(function(p){return isMatch(href,p.trim());});});globalRule=rules.find(function(r){return r.pattern===GLOBAL_KEY;})||GLOBLA_RULE;if(rule){_context.next=24;break;}return _context.abrupt("return",globalRule);case 24:rule.selector=((_rule$selector=rule.selector)===null||_rule$selector===void 0?void 0:_rule$selector.trim())||globalRule.selector;if(rule.textStyle===GLOBAL_KEY){rule.textStyle=globalRule.textStyle;rule.bgColor=globalRule.bgColor;rule.textDiyStyle=globalRule.textDiyStyle;}else{rule.bgColor=((_rule$bgColor=rule.bgColor)===null||_rule$bgColor===void 0?void 0:_rule$bgColor.trim())||globalRule.bgColor;rule.textDiyStyle=((_rule$textDiyStyle=rule.textDiyStyle)===null||_rule$textDiyStyle===void 0?void 0:_rule$textDiyStyle.trim())||globalRule.textDiyStyle;}["translator","fromLang","toLang","transOpen"].forEach(function(key){if(rule[key]===GLOBAL_KEY){rule[key]=globalRule[key];}});return _context.abrupt("return",rule);case 28:case"end":return _context.stop();}},_callee,null,[[5,17]]);}));return function matchRule(_x,_x2){return _ref2.apply(this,arguments);};}();/** + */var matchRule=/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(href,_ref){var _rule$selector,_rule$keepSelector;var _ref$injectRules,injectRules,_ref$subrulesList,subrulesList,_ref$owSubrule,owSubrule,rules,selectedSub,mixRule,subRules,rule,globalRule,_rule$bgColor,_rule$textDiyStyle;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_ref$injectRules=_ref.injectRules,injectRules=_ref$injectRules===void 0?true:_ref$injectRules,_ref$subrulesList=_ref.subrulesList,subrulesList=_ref$subrulesList===void 0?DEFAULT_SUBRULES_LIST:_ref$subrulesList,_ref$owSubrule=_ref.owSubrule,owSubrule=_ref$owSubrule===void 0?DEFAULT_OW_RULE:_ref$owSubrule;_context.next=3;return getRulesWithDefault();case 3:rules=_context.sent;if(!injectRules){_context.next=20;break;}_context.prev=5;selectedSub=subrulesList.find(function(item){return item.selected;});if(!(selectedSub!==null&&selectedSub!==void 0&&selectedSub.url)){_context.next=15;break;}mixRule={};Object.entries(owSubrule).filter(function(_ref3){var _ref4=(0,slicedToArray/* default */.Z)(_ref3,2),key=_ref4[0],val=_ref4[1];if(owSubrule.textStyle===REMAIN_KEY&&(key==="bgColor"||key==="textDiyStyle")){return false;}return val!==REMAIN_KEY;}).forEach(function(_ref5){var _ref6=(0,slicedToArray/* default */.Z)(_ref5,2),key=_ref6[0],val=_ref6[1];mixRule[key]=val;});_context.next=12;return loadOrFetchSubRules(selectedSub.url);case 12:subRules=_context.sent;subRules=subRules.map(function(item){return _objectSpread2(_objectSpread2({},item),mixRule);});rules.splice.apply(rules,[-1,0].concat((0,toConsumableArray/* default */.Z)(subRules)));case 15:_context.next=20;break;case 17:_context.prev=17;_context.t0=_context["catch"](5);console.log("[load injectRules]",_context.t0);case 20:rule=rules.find(function(r){return r.pattern.split(",").some(function(p){return isMatch(href,p.trim());});});globalRule=rules.find(function(r){return r.pattern===GLOBAL_KEY;})||GLOBLA_RULE;if(rule){_context.next=24;break;}return _context.abrupt("return",globalRule);case 24:rule.selector=((_rule$selector=rule.selector)===null||_rule$selector===void 0?void 0:_rule$selector.trim())||globalRule.selector;rule.keepSelector=((_rule$keepSelector=rule.keepSelector)===null||_rule$keepSelector===void 0?void 0:_rule$keepSelector.trim())||globalRule.keepSelector;if(rule.textStyle===GLOBAL_KEY){rule.textStyle=globalRule.textStyle;rule.bgColor=globalRule.bgColor;rule.textDiyStyle=globalRule.textDiyStyle;}else{rule.bgColor=((_rule$bgColor=rule.bgColor)===null||_rule$bgColor===void 0?void 0:_rule$bgColor.trim())||globalRule.bgColor;rule.textDiyStyle=((_rule$textDiyStyle=rule.textDiyStyle)===null||_rule$textDiyStyle===void 0?void 0:_rule$textDiyStyle.trim())||globalRule.textDiyStyle;}["translator","fromLang","toLang","transOpen"].forEach(function(key){if(rule[key]===GLOBAL_KEY){rule[key]=globalRule[key];}});return _context.abrupt("return",rule);case 29:case"end":return _context.stop();}},_callee,null,[[5,17]]);}));return function matchRule(_x,_x2){return _ref2.apply(this,arguments);};}();/** * 检查过滤rules * @param {*} rules * @returns - */var checkRules=function checkRules(rules){if(type(rules)==="string"){rules=JSON.parse(rules);}if(type(rules)!=="array"){throw new Error("data error");}var fromLangs=OPT_LANGS_FROM.map(function(item){return item[0];});var toLangs=OPT_LANGS_TO.map(function(item){return item[0];});var patternSet=new Set();rules=rules.filter(function(rule){return type(rule)==="object";}).filter(function(_ref7){var pattern=_ref7.pattern;if(type(pattern)!=="string"||patternSet.has(pattern.trim())){return false;}patternSet.add(pattern.trim());return true;}).map(function(_ref8){var pattern=_ref8.pattern,selector=_ref8.selector,translator=_ref8.translator,fromLang=_ref8.fromLang,toLang=_ref8.toLang,textStyle=_ref8.textStyle,transOpen=_ref8.transOpen,bgColor=_ref8.bgColor,textDiyStyle=_ref8.textDiyStyle;return{pattern:pattern.trim(),selector:type(selector)==="string"?selector:"",bgColor:type(bgColor)==="string"?bgColor:"",textDiyStyle:type(textDiyStyle)==="string"?textDiyStyle:"",translator:matchValue([GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(OPT_TRANS_ALL)),translator),fromLang:matchValue([GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(fromLangs)),fromLang),toLang:matchValue([GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(toLangs)),toLang),textStyle:matchValue([GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(OPT_STYLE_ALL)),textStyle),transOpen:matchValue([GLOBAL_KEY,"true","false"],transOpen)};});return rules;};/** + */var checkRules=function checkRules(rules){if(type(rules)==="string"){rules=JSON.parse(rules);}if(type(rules)!=="array"){throw new Error("data error");}var fromLangs=OPT_LANGS_FROM.map(function(item){return item[0];});var toLangs=OPT_LANGS_TO.map(function(item){return item[0];});var patternSet=new Set();rules=rules.filter(function(rule){return type(rule)==="object";}).filter(function(_ref7){var pattern=_ref7.pattern;if(type(pattern)!=="string"||patternSet.has(pattern.trim())){return false;}patternSet.add(pattern.trim());return true;}).map(function(_ref8){var pattern=_ref8.pattern,selector=_ref8.selector,keepSelector=_ref8.keepSelector,translator=_ref8.translator,fromLang=_ref8.fromLang,toLang=_ref8.toLang,textStyle=_ref8.textStyle,transOpen=_ref8.transOpen,bgColor=_ref8.bgColor,textDiyStyle=_ref8.textDiyStyle;return{pattern:pattern.trim(),selector:type(selector)==="string"?selector:"",keepSelector:type(keepSelector)==="string"?keepSelector:"",bgColor:type(bgColor)==="string"?bgColor:"",textDiyStyle:type(textDiyStyle)==="string"?textDiyStyle:"",translator:matchValue([GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(OPT_TRANS_ALL)),translator),fromLang:matchValue([GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(fromLangs)),fromLang),toLang:matchValue([GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(toLangs)),toLang),textStyle:matchValue([GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(OPT_STYLE_ALL)),textStyle),transOpen:matchValue([GLOBAL_KEY,"true","false"],transOpen)};});return rules;};/** * 保存或更新rule * @param {*} newRule */var saveRule=/*#__PURE__*/function(){var _ref9=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(newRule){var rules,rule;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return getRulesWithDefault();case 2:rules=_context2.sent;rule=rules.find(function(item){return isMatch(newRule.pattern,item.pattern);});if(rule&&rule.pattern!==GLOBAL_KEY){Object.assign(rule,_objectSpread2(_objectSpread2({},newRule),{},{pattern:rule.pattern}));}else{rules.unshift(newRule);}_context2.next=7;return setRules(rules);case 7:trySyncRules();case 8:case"end":return _context2.stop();}},_callee2);}));return function saveRule(_x3){return _ref9.apply(this,arguments);};}(); @@ -33438,7 +33442,7 @@ if(!(now-subRulesSyncAt>interval)){_context4.next=15;break;}_context4.next=11;re * @returns */var tryDetectLang=/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(q){var useRemote,lang,_browser$i18n,_res$languages,_res$languages$,res,_args2=arguments;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:useRemote=_args2.length>1&&_args2[1]!==undefined?_args2[1]:false;lang="";if(!useRemote){_context2.next=12;break;}_context2.prev=3;_context2.next=6;return apiBaiduLangdetect(q);case 6:lang=_context2.sent;_context2.next=12;break;case 9:_context2.prev=9;_context2.t0=_context2["catch"](3);console.log("[detect lang remote]",_context2.t0.message);case 12:if(lang){_context2.next=23;break;}_context2.prev=13;_context2.next=16;return browser===null||browser===void 0?void 0:(_browser$i18n=browser.i18n)===null||_browser$i18n===void 0?void 0:_browser$i18n.detectLanguage(q);case 16:res=_context2.sent;lang=res===null||res===void 0?void 0:(_res$languages=res.languages)===null||_res$languages===void 0?void 0:(_res$languages$=_res$languages[0])===null||_res$languages$===void 0?void 0:_res$languages$.language;_context2.next=23;break;case 20:_context2.prev=20;_context2.t1=_context2["catch"](13);console.log("[detect lang local]",_context2.t1.message);case 23:return _context2.abrupt("return",lang);case 24:case"end":return _context2.stop();}},_callee2,null,[[3,9],[13,20]]);}));return function tryDetectLang(_x){return _ref2.apply(this,arguments);};}(); ;// CONCATENATED MODULE: ./src/views/Popup/index.js -function Popup(_ref){var setShowPopup=_ref.setShowPopup,tran=_ref.translator;var i18n=useI18n();var _useState=(0,react.useState)(tran===null||tran===void 0?void 0:tran.rule),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),rule=_useState2[0],setRule=_useState2[1];var handleOpenSetting=function handleOpenSetting(){if(!tran){browser===null||browser===void 0?void 0:browser.runtime.openOptionsPage();}else if(isExt){sendBgMsg(MSG_OPEN_OPTIONS);}else{window.open("https://fishjar.github.io/kiss-translator/options.html","_blank");}setShowPopup&&setShowPopup(false);};var handleTransToggle=/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(e){return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.prev=0;setRule(_objectSpread2(_objectSpread2({},rule),{},{transOpen:e.target.checked?"true":"false"}));if(tran){_context.next=7;break;}_context.next=5;return sendTabMsg(MSG_TRANS_TOGGLE);case 5:_context.next=9;break;case 7:tran.toggle();sendIframeMsg(MSG_TRANS_TOGGLE);case 9:_context.next=14;break;case 11:_context.prev=11;_context.t0=_context["catch"](0);console.log("[toggle trans]",_context.t0);case 14:case"end":return _context.stop();}},_callee,null,[[0,11]]);}));return function handleTransToggle(_x){return _ref2.apply(this,arguments);};}();var handleChange=/*#__PURE__*/function(){var _ref3=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(e){var _e$target,name,value;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_e$target=e.target,name=_e$target.name,value=_e$target.value;setRule(function(pre){return _objectSpread2(_objectSpread2({},pre),{},(0,defineProperty/* default */.Z)({},name,value));});if(tran){_context2.next=8;break;}_context2.next=6;return sendTabMsg(MSG_TRANS_PUTRULE,(0,defineProperty/* default */.Z)({},name,value));case 6:_context2.next=10;break;case 8:tran.updateRule((0,defineProperty/* default */.Z)({},name,value));sendIframeMsg(MSG_TRANS_PUTRULE,(0,defineProperty/* default */.Z)({},name,value));case 10:_context2.next=15;break;case 12:_context2.prev=12;_context2.t0=_context2["catch"](0);console.log("[update rule]",_context2.t0);case 15:case"end":return _context2.stop();}},_callee2,null,[[0,12]]);}));return function handleChange(_x2){return _ref3.apply(this,arguments);};}();var handleClearCache=function handleClearCache(){tryClearCaches();};var handleSaveRule=/*#__PURE__*/function(){var _ref4=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee3(){var href,tab,newRule;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.prev=0;href=window.location.href;if(tran){_context3.next=7;break;}_context3.next=5;return getTabInfo();case 5:tab=_context3.sent;href=tab.url;case 7:newRule=_objectSpread2(_objectSpread2({},rule),{},{pattern:href});if(isExt&&tran){sendBgMsg(MSG_SAVE_RULE,newRule);}else{saveRule(newRule);}_context3.next=14;break;case 11:_context3.prev=11;_context3.t0=_context3["catch"](0);console.log("[save rule]",_context3.t0);case 14:case"end":return _context3.stop();}},_callee3,null,[[0,11]]);}));return function handleSaveRule(){return _ref4.apply(this,arguments);};}();(0,react.useEffect)(function(){if(tran){return;}asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee4(){var res;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:_context4.prev=0;_context4.next=3;return sendTabMsg(MSG_TRANS_GETRULE);case 3:res=_context4.sent;if(!res.error){setRule(res.data);}_context4.next=10;break;case 7:_context4.prev=7;_context4.t0=_context4["catch"](0);console.log("[query rule]",_context4.t0);case 10:case"end":return _context4.stop();}},_callee4,null,[[0,7]]);}))();},[tran]);if(!rule){return/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{minWidth:300,children:[!tran&&/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Header,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(Stack_Stack,{sx:{p:2},spacing:3,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:handleOpenSetting,children:i18n("setting")})})]});}var transOpen=rule.transOpen,translator=rule.translator,fromLang=rule.fromLang,toLang=rule.toLang,textStyle=rule.textStyle,bgColor=rule.bgColor;return/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{minWidth:300,children:[!tran&&/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Header,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{sx:{p:2},spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(FormControlLabel_FormControlLabel,{control:/*#__PURE__*/(0,jsx_runtime.jsx)(Switch_Switch,{checked:transOpen==="true",onChange:handleTransToggle}),label:i18n("translate_alt")}),!isExt&&/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:handleClearCache,children:i18n("clear_cache")})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},size:"small",value:translator,name:"translator",label:i18n("translate_service"),onChange:handleChange,children:OPT_TRANS_ALL.map(function(item){return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:item,children:item},item);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},size:"small",value:fromLang,name:"fromLang",label:i18n("from_lang"),onChange:handleChange,children:OPT_LANGS_FROM.map(function(_ref6){var _ref7=(0,slicedToArray/* default */.Z)(_ref6,2),lang=_ref7[0],name=_ref7[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},size:"small",value:toLang,name:"toLang",label:i18n("to_lang"),onChange:handleChange,children:OPT_LANGS_TO.map(function(_ref8){var _ref9=(0,slicedToArray/* default */.Z)(_ref8,2),lang=_ref9[0],name=_ref9[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},size:"small",value:textStyle,name:"textStyle",label:i18n("text_style_alt"),onChange:handleChange,children:OPT_STYLE_ALL.map(function(item){return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:item,children:i18n(item)},item);})}),OPT_STYLE_USE_COLOR.includes(textStyle)&&/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",name:"bgColor",value:bgColor,label:i18n("bg_color"),onChange:handleChange}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:handleSaveRule,children:i18n("save_rule")}),/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:handleOpenSetting,children:i18n("setting")})]})]})]});} +function Popup(_ref){var setShowPopup=_ref.setShowPopup,tran=_ref.translator;var i18n=useI18n();var _useState=(0,react.useState)(tran===null||tran===void 0?void 0:tran.rule),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),rule=_useState2[0],setRule=_useState2[1];var handleOpenSetting=function handleOpenSetting(){if(!tran){browser===null||browser===void 0?void 0:browser.runtime.openOptionsPage();}else if(isExt){sendBgMsg(MSG_OPEN_OPTIONS);}else{window.open("https://fishjar.github.io/kiss-translator/options.html","_blank");}setShowPopup&&setShowPopup(false);};var handleTransToggle=/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(e){return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.prev=0;setRule(_objectSpread2(_objectSpread2({},rule),{},{transOpen:e.target.checked?"true":"false"}));if(tran){_context.next=7;break;}_context.next=5;return sendTabMsg(MSG_TRANS_TOGGLE);case 5:_context.next=9;break;case 7:tran.toggle();sendIframeMsg(MSG_TRANS_TOGGLE);case 9:_context.next=14;break;case 11:_context.prev=11;_context.t0=_context["catch"](0);console.log("[toggle trans]",_context.t0);case 14:case"end":return _context.stop();}},_callee,null,[[0,11]]);}));return function handleTransToggle(_x){return _ref2.apply(this,arguments);};}();var handleChange=/*#__PURE__*/function(){var _ref3=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(e){var _e$target,name,value;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_e$target=e.target,name=_e$target.name,value=_e$target.value;setRule(function(pre){return _objectSpread2(_objectSpread2({},pre),{},(0,defineProperty/* default */.Z)({},name,value));});if(tran){_context2.next=8;break;}_context2.next=6;return sendTabMsg(MSG_TRANS_PUTRULE,(0,defineProperty/* default */.Z)({},name,value));case 6:_context2.next=10;break;case 8:tran.updateRule((0,defineProperty/* default */.Z)({},name,value));sendIframeMsg(MSG_TRANS_PUTRULE,(0,defineProperty/* default */.Z)({},name,value));case 10:_context2.next=15;break;case 12:_context2.prev=12;_context2.t0=_context2["catch"](0);console.log("[update rule]",_context2.t0);case 15:case"end":return _context2.stop();}},_callee2,null,[[0,12]]);}));return function handleChange(_x2){return _ref3.apply(this,arguments);};}();var handleClearCache=function handleClearCache(){tryClearCaches();};var handleSaveRule=/*#__PURE__*/function(){var _ref4=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee3(){var href,tab,newRule;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.prev=0;href=window.location.href;if(tran){_context3.next=7;break;}_context3.next=5;return getTabInfo();case 5:tab=_context3.sent;href=tab.url;case 7:newRule=_objectSpread2(_objectSpread2({},rule),{},{pattern:href});if(isExt&&tran){sendBgMsg(MSG_SAVE_RULE,newRule);}else{saveRule(newRule);}_context3.next=14;break;case 11:_context3.prev=11;_context3.t0=_context3["catch"](0);console.log("[save rule]",_context3.t0);case 14:case"end":return _context3.stop();}},_callee3,null,[[0,11]]);}));return function handleSaveRule(){return _ref4.apply(this,arguments);};}();(0,react.useEffect)(function(){if(tran){return;}asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee4(){var res;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:_context4.prev=0;_context4.next=3;return sendTabMsg(MSG_TRANS_GETRULE);case 3:res=_context4.sent;if(!res.error){setRule(res.data);}_context4.next=10;break;case 7:_context4.prev=7;_context4.t0=_context4["catch"](0);console.log("[query rule]",_context4.t0);case 10:case"end":return _context4.stop();}},_callee4,null,[[0,7]]);}))();},[tran]);if(!rule){return/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{minWidth:300,children:[!tran&&/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Header,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(Stack_Stack,{sx:{p:2},spacing:3,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:handleOpenSetting,children:i18n("setting")})})]});}var transOpen=rule.transOpen,translator=rule.translator,fromLang=rule.fromLang,toLang=rule.toLang,textStyle=rule.textStyle;return/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{minWidth:300,children:[!tran&&/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Header,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{sx:{p:2},spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Stack_Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:2,children:/*#__PURE__*/(0,jsx_runtime.jsx)(FormControlLabel_FormControlLabel,{control:/*#__PURE__*/(0,jsx_runtime.jsx)(Switch_Switch,{checked:transOpen==="true",onChange:handleTransToggle}),label:i18n("translate_alt")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},size:"small",value:translator,name:"translator",label:i18n("translate_service"),onChange:handleChange,children:OPT_TRANS_ALL.map(function(item){return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:item,children:item},item);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},size:"small",value:fromLang,name:"fromLang",label:i18n("from_lang"),onChange:handleChange,children:OPT_LANGS_FROM.map(function(_ref6){var _ref7=(0,slicedToArray/* default */.Z)(_ref6,2),lang=_ref7[0],name=_ref7[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},size:"small",value:toLang,name:"toLang",label:i18n("to_lang"),onChange:handleChange,children:OPT_LANGS_TO.map(function(_ref8){var _ref9=(0,slicedToArray/* default */.Z)(_ref8,2),lang=_ref9[0],name=_ref9[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},size:"small",value:textStyle,name:"textStyle",label:i18n("text_style_alt"),onChange:handleChange,children:OPT_STYLE_ALL.map(function(item){return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:item,children:i18n(item)},item);})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:handleSaveRule,children:i18n("save_rule")}),!isExt&&/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:handleClearCache,children:i18n("clear_cache")}),/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:handleOpenSetting,children:i18n("setting")})]})]})]});} ;// CONCATENATED MODULE: ./src/libs/shortcut.js /** * 键盘快捷键监听 @@ -33446,7 +33450,7 @@ function Popup(_ref){var setShowPopup=_ref.setShowPopup,tran=_ref.translator;var * @param {*} target * @param {*} timeout * @returns - */var shortcutListener=function shortcutListener(fn){var target=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document;var timeout=arguments.length>2&&arguments[2]!==undefined?arguments[2]:3000;var allkeys=new Set();var curkeys=new Set();var timer=null;var handleKeydown=function handleKeydown(e){timer&&clearTimeout(timer);timer=setTimeout(function(){allkeys.clear();curkeys.clear();clearTimeout(timer);timer=null;},timeout);if(e.code){allkeys.add(e.code);curkeys.add(e.code);fn((0,toConsumableArray/* default */.Z)(curkeys),(0,toConsumableArray/* default */.Z)(allkeys));}};var handleKeyup=function handleKeyup(e){curkeys.delete(e.code);if(curkeys.size===0){fn((0,toConsumableArray/* default */.Z)(curkeys),(0,toConsumableArray/* default */.Z)(allkeys));allkeys.clear();}};target.addEventListener("keydown",handleKeydown);target.addEventListener("keyup",handleKeyup);return function(){if(timer){clearTimeout(timer);timer=null;}target.removeEventListener("keydown",handleKeydown);target.removeEventListener("keyup",handleKeyup);};};/** + */var shortcutListener=function shortcutListener(fn){var target=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document;var timeout=arguments.length>2&&arguments[2]!==undefined?arguments[2]:3000;var allkeys=new Set();var curkeys=new Set();var timer=null;var handleKeydown=function handleKeydown(e){timer&&clearTimeout(timer);timer=setTimeout(function(){allkeys.clear();curkeys.clear();clearTimeout(timer);timer=null;},timeout);if(e.code){allkeys.add(e.code);curkeys.add(e.code);fn((0,toConsumableArray/* default */.Z)(curkeys),(0,toConsumableArray/* default */.Z)(allkeys));}};var handleKeyup=function handleKeyup(e){curkeys.delete(e.code);if(curkeys.size===0){fn((0,toConsumableArray/* default */.Z)(curkeys),(0,toConsumableArray/* default */.Z)(allkeys));allkeys.clear();}};target.addEventListener("keydown",handleKeydown,true);target.addEventListener("keyup",handleKeyup,true);return function(){if(timer){clearTimeout(timer);timer=null;}target.removeEventListener("keydown",handleKeydown);target.removeEventListener("keyup",handleKeyup);};};/** * 注册键盘快捷键 * @param {*} targetKeys * @param {*} fn @@ -33464,7 +33468,7 @@ function Popup(_ref){var setShowPopup=_ref.setShowPopup,tran=_ref.translator;var ;// CONCATENATED MODULE: ./src/views/Action/index.js function Action(_ref){var _fab$x,_fab$y;var translator=_ref.translator,fab=_ref.fab;var fabWidth=40;var _useState=(0,react.useState)(false),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),showPopup=_useState2[0],setShowPopup=_useState2[1];var _useState3=(0,react.useState)({w:window.innerWidth,h:window.innerHeight}),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),windowSize=_useState4[0],setWindowSize=_useState4[1];var _useState5=(0,react.useState)(false),_useState6=(0,slicedToArray/* default */.Z)(_useState5,2),moved=_useState6[0],setMoved=_useState6[1];var handleWindowResize=(0,react.useMemo)(function(){return debounce(function(){setWindowSize({w:window.innerWidth,h:window.innerHeight});});},[]);var handleWindowClick=function handleWindowClick(e){setShowPopup(false);};var handleStart=(0,react.useCallback)(function(){setMoved(false);},[]);var handleMove=(0,react.useCallback)(function(){setMoved(true);},[]);(0,react.useEffect)(function(){if(!isGm){return;}// 注册快捷键 var shortcuts=translator.setting.shortcuts||DEFAULT_SHORTCUTS;var clearShortcuts=[shortcutRegister(shortcuts[OPT_SHORTCUT_TRANSLATE],function(){translator.toggle();sendIframeMsg(MSG_TRANS_TOGGLE);setShowPopup(false);}),shortcutRegister(shortcuts[OPT_SHORTCUT_STYLE],function(){translator.toggleStyle();sendIframeMsg(MSG_TRANS_TOGGLE_STYLE);setShowPopup(false);}),shortcutRegister(shortcuts[OPT_SHORTCUT_POPUP],function(){setShowPopup(function(pre){return!pre;});}),shortcutRegister(shortcuts[OPT_SHORTCUT_SETTING],function(){window.open("https://fishjar.github.io/kiss-translator/options.html","_blank");})];return function(){clearShortcuts.forEach(function(fn){fn();});};},[translator]);(0,react.useEffect)(function(){if(!isGm){return;}// 注册菜单 -try{var menuCommandIds=[];var _translator$setting$c=translator.setting.contextMenus,contextMenus=_translator$setting$c===void 0?true:_translator$setting$c;contextMenus&&menuCommandIds.push(GM.registerMenuCommand("Toggle Translate (Alt+q)",function(event){translator.toggle();sendIframeMsg(MSG_TRANS_TOGGLE);setShowPopup(false);},"Q"),GM.registerMenuCommand("Toggle Style (Alt+c)",function(event){translator.toggleStyle();sendIframeMsg(MSG_TRANS_TOGGLE_STYLE);setShowPopup(false);},"C"),GM.registerMenuCommand("Open Menu (Alt+k)",function(event){setShowPopup(function(pre){return!pre;});},"K"),GM.registerMenuCommand("Open Setting (Alt+o)",function(event){window.open("https://fishjar.github.io/kiss-translator/options.html","_blank");},"O"));return function(){menuCommandIds.forEach(function(id){GM.unregisterMenuCommand(id);});};}catch(err){console.log("[registerMenuCommand]",err);}},[translator]);(0,react.useEffect)(function(){window.addEventListener("resize",handleWindowResize);return function(){window.removeEventListener("resize",handleWindowResize);};},[handleWindowResize]);(0,react.useEffect)(function(){window.addEventListener("click",handleWindowClick);return function(){window.removeEventListener("click",handleWindowClick);};},[]);var popProps=(0,react.useMemo)(function(){var width=Math.min(windowSize.w,300);var height=Math.min(windowSize.h,442);var left=(windowSize.w-width)/2;var top=(windowSize.h-height)/2;return{windowSize:windowSize,width:width,height:height,left:left,top:top};},[windowSize]);var fabProps={windowSize:windowSize,width:fabWidth,height:fabWidth,left:(_fab$x=fab.x)!==null&&_fab$x!==void 0?_fab$x:-fabWidth,top:(_fab$y=fab.y)!==null&&_fab$y!==void 0?_fab$y:windowSize.h/2};return/*#__PURE__*/(0,jsx_runtime.jsx)(SettingProvider,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Theme,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Draggable,_objectSpread2(_objectSpread2({},popProps),{},{show:showPopup,onStart:handleStart,onMove:handleMove,usePaper:true,handler:/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{style:{cursor:"move"},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Header,{setShowPopup:setShowPopup}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{})]}),children:showPopup&&/*#__PURE__*/(0,jsx_runtime.jsx)(Popup,{setShowPopup:setShowPopup,translator:translator})}),"pop"),/*#__PURE__*/(0,jsx_runtime.jsx)(Draggable,_objectSpread2(_objectSpread2({snapEdge:true},fabProps),{},{show:fab.isHide?false:!showPopup,onStart:handleStart,onMove:handleMove,handler:/*#__PURE__*/(0,jsx_runtime.jsx)(Fab_Fab,{size:"small",color:"primary",onClick:function onClick(e){if(!moved){setShowPopup(function(pre){return!pre;});}},children:/*#__PURE__*/(0,jsx_runtime.jsx)(Translate/* default */.Z,{sx:{width:24,height:24}})})}),"fab")]})});} +try{var menuCommandIds=[];var _translator$setting$c=translator.setting.contextMenus,contextMenus=_translator$setting$c===void 0?true:_translator$setting$c;contextMenus&&menuCommandIds.push(GM.registerMenuCommand("Toggle Translate (Alt+Q)",function(event){translator.toggle();sendIframeMsg(MSG_TRANS_TOGGLE);setShowPopup(false);},"Q"),GM.registerMenuCommand("Toggle Style (Alt+C)",function(event){translator.toggleStyle();sendIframeMsg(MSG_TRANS_TOGGLE_STYLE);setShowPopup(false);},"C"),GM.registerMenuCommand("Open Menu (Alt+K)",function(event){setShowPopup(function(pre){return!pre;});},"K"),GM.registerMenuCommand("Open Setting",function(event){window.open("https://fishjar.github.io/kiss-translator/options.html","_blank");},"O"));return function(){menuCommandIds.forEach(function(id){GM.unregisterMenuCommand(id);});};}catch(err){console.log("[registerMenuCommand]",err);}},[translator]);(0,react.useEffect)(function(){window.addEventListener("resize",handleWindowResize);return function(){window.removeEventListener("resize",handleWindowResize);};},[handleWindowResize]);(0,react.useEffect)(function(){window.addEventListener("click",handleWindowClick);return function(){window.removeEventListener("click",handleWindowClick);};},[]);var popProps=(0,react.useMemo)(function(){var width=Math.min(windowSize.w,300);var height=Math.min(windowSize.h,442);var left=(windowSize.w-width)/2;var top=(windowSize.h-height)/2;return{windowSize:windowSize,width:width,height:height,left:left,top:top};},[windowSize]);var fabProps={windowSize:windowSize,width:fabWidth,height:fabWidth,left:(_fab$x=fab.x)!==null&&_fab$x!==void 0?_fab$x:-fabWidth,top:(_fab$y=fab.y)!==null&&_fab$y!==void 0?_fab$y:windowSize.h/2};return/*#__PURE__*/(0,jsx_runtime.jsx)(SettingProvider,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Theme,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Draggable,_objectSpread2(_objectSpread2({},popProps),{},{show:showPopup,onStart:handleStart,onMove:handleMove,usePaper:true,handler:/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{style:{cursor:"move"},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Header,{setShowPopup:setShowPopup}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{})]}),children:showPopup&&/*#__PURE__*/(0,jsx_runtime.jsx)(Popup,{setShowPopup:setShowPopup,translator:translator})}),"pop"),/*#__PURE__*/(0,jsx_runtime.jsx)(Draggable,_objectSpread2(_objectSpread2({snapEdge:true},fabProps),{},{show:fab.isHide?false:!showPopup,onStart:handleStart,onMove:handleMove,handler:/*#__PURE__*/(0,jsx_runtime.jsx)(Fab_Fab,{size:"small",color:"primary",onClick:function onClick(e){if(!moved){setShowPopup(function(pre){return!pre;});}},children:/*#__PURE__*/(0,jsx_runtime.jsx)(Translate/* default */.Z,{sx:{width:24,height:24}})})}),"fab")]})});} ;// CONCATENATED MODULE: ./src/libs/svg.js var loadingSvg="\n\n \n \n \n \n \n \n \n \n \n\n"; ;// CONCATENATED MODULE: ./src/views/Content/LoadingIcon.js @@ -33486,11 +33490,11 @@ return/*#__PURE__*/(0,jsx_runtime.jsx)(LineSpan,{$lineStyle:"wavy",$lineColor:bg return/*#__PURE__*/(0,jsx_runtime.jsx)(FuzzySpan,{children:children});case OPT_STYLE_HIGHLIGHT:// 高亮 return/*#__PURE__*/(0,jsx_runtime.jsx)(HighlightSpan,{$bgColor:bgColor||DEFAULT_COLOR,children:children});case OPT_STYLE_BLOCKQUOTE:// 引用 return/*#__PURE__*/(0,jsx_runtime.jsx)(BlockquoteSpan,{$lineColor:bgColor||DEFAULT_COLOR,children:children});case OPT_STYLE_DIY:// 自定义 -return/*#__PURE__*/(0,jsx_runtime.jsx)(DiySpan,{$diyStyle:textDiyStyle,children:children});default:return/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:children});}}function Content(_ref2){var q=_ref2.q,translator=_ref2.translator;var _useState=(0,react.useState)(translator.rule),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),rule=_useState2[0],setRule=_useState2[1];var _useTranslate=useTranslate(q,rule,translator.setting),text=_useTranslate.text,sameLang=_useTranslate.sameLang,loading=_useTranslate.loading;var textStyle=rule.textStyle,_rule$bgColor=rule.bgColor,bgColor=_rule$bgColor===void 0?"":_rule$bgColor,_rule$textDiyStyle=rule.textDiyStyle,textDiyStyle=_rule$textDiyStyle===void 0?"":_rule$textDiyStyle;var _translator$setting$n=translator.setting.newlineLength,newlineLength=_translator$setting$n===void 0?TRANS_NEWLINE_LENGTH:_translator$setting$n;var handleKissEvent=function handleKissEvent(e){var _e$detail=e.detail,action=_e$detail.action,args=_e$detail.args;switch(action){case MSG_TRANS_CURRULE:setRule(args);break;default:}};(0,react.useEffect)(function(){window.addEventListener(translator.eventName,handleKissEvent);return function(){window.removeEventListener(translator.eventName,handleKissEvent);};},[translator.eventName]);if(loading){return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[q.length>=newlineLength?/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}):" ",/*#__PURE__*/(0,jsx_runtime.jsx)(LoadingIcon,{})]});}if(text&&!sameLang){return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[q.length>=newlineLength?/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}):" ",/*#__PURE__*/(0,jsx_runtime.jsx)(StyledSpan,{textStyle:textStyle,textDiyStyle:textDiyStyle,bgColor:bgColor,children:text})]});}} +return/*#__PURE__*/(0,jsx_runtime.jsx)(DiySpan,{$diyStyle:textDiyStyle,children:children});default:return/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:children});}}function Content(_ref2){var q=_ref2.q,keeps=_ref2.keeps,translator=_ref2.translator;var _useState=(0,react.useState)(translator.rule),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),rule=_useState2[0],setRule=_useState2[1];var _useTranslate=useTranslate(q,rule,translator.setting),text=_useTranslate.text,sameLang=_useTranslate.sameLang,loading=_useTranslate.loading;var textStyle=rule.textStyle,_rule$bgColor=rule.bgColor,bgColor=_rule$bgColor===void 0?"":_rule$bgColor,_rule$textDiyStyle=rule.textDiyStyle,textDiyStyle=_rule$textDiyStyle===void 0?"":_rule$textDiyStyle;var _translator$setting$n=translator.setting.newlineLength,newlineLength=_translator$setting$n===void 0?TRANS_NEWLINE_LENGTH:_translator$setting$n;var handleKissEvent=function handleKissEvent(e){var _e$detail=e.detail,action=_e$detail.action,args=_e$detail.args;switch(action){case MSG_TRANS_CURRULE:setRule(args);break;default:}};(0,react.useEffect)(function(){window.addEventListener(translator.eventName,handleKissEvent);return function(){window.removeEventListener(translator.eventName,handleKissEvent);};},[translator.eventName]);if(loading){return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[q.length>=newlineLength?/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}):" ",/*#__PURE__*/(0,jsx_runtime.jsx)(LoadingIcon,{})]});}if(!text||sameLang){return;}return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[q.length>=newlineLength?/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}):" ",/*#__PURE__*/(0,jsx_runtime.jsx)(StyledSpan,{textStyle:textStyle,textDiyStyle:textDiyStyle,bgColor:bgColor,children:keeps.length>0?/*#__PURE__*/(0,jsx_runtime.jsx)("span",{dangerouslySetInnerHTML:{__html:text.replace(/#(\d+)#/g,function(_,p){return keeps[parseInt(p)];})}}):text})]});} ;// CONCATENATED MODULE: ./src/libs/translator.js /** * 翻译类 - */var Translator=/*#__PURE__*/function(){function Translator(rule,setting){var _this2=this;_classCallCheck(this,Translator);this._rule={};this._setting={};this._rootNodes=new Set();this._tranNodes=new Map();this._skipNodeNames=[APP_LCNAME,"style","svg","img","audio","video","textarea","input","button","select","option","head","script","iframe"];this._eventName=utils_genEventName();this._mouseoverNode=null;// 显示 + */var Translator=/*#__PURE__*/function(){function Translator(rule,setting,fixerSetting){var _this2=this;_classCallCheck(this,Translator);this._rule={};this._setting={};this._fixerSetting=null;this._rootNodes=new Set();this._tranNodes=new Map();this._skipNodeNames=[APP_LCNAME,"style","svg","img","audio","video","textarea","input","button","select","option","head","script","iframe"];this._eventName=utils_genEventName();this._mouseoverNode=null;// 显示 this._interseObserver=new IntersectionObserver(function(intersections){intersections.forEach(function(intersection){if(intersection.isIntersecting){_this2._render(intersection.target);_this2._interseObserver.unobserve(intersection.target);}});},{threshold:0.1});// 变化 this._mutaObserver=new MutationObserver(function(mutations){mutations.forEach(function(mutation){if(!_this2._skipNodeNames.includes(mutation.target.localName)&&mutation.addedNodes.length>0){var nodes=Array.from(mutation.addedNodes).filter(function(node){if(_this2._skipNodeNames.includes(node.localName)||node.id===APP_LCNAME){return false;}return true;});if(nodes.length>0){// const rootNode = mutation.target.getRootNode(); // todo @@ -33509,7 +33513,8 @@ _this2._rootNodes.add(rootNode);_this2._rule.selector.split(";").map(function(it // } // } // ); -_this2._queryShadowNodes(inSelector,outNode.shadowRoot);}});}}else{_this2._queryFilter(selector,rootNode).forEach(function(item){if(!_this2._tranNodes.has(item)){_this2._tranNodes.set(item,"");}});}});};this._register=function(){if(_this2._rule.fromLang===_this2._rule.toLang){return;}// 搜索节点 +_this2._queryShadowNodes(inSelector,outNode.shadowRoot);}});}}else{_this2._queryFilter(selector,rootNode).forEach(function(item){if(!_this2._tranNodes.has(item)){_this2._tranNodes.set(item,"");}});}});};this._register=function(){if(_this2._rule.fromLang===_this2._rule.toLang){return;}// webfix +if(_this2._fixerSetting){runFixer(_this2._fixerSetting);}// 搜索节点 _this2._queryNodes();_this2._rootNodes.forEach(function(node){// 监听节点变化; _this2._mutaObserver.observe(node,{childList:true,subtree:true// characterData: true, });});if(!_this2._setting.mouseKey||_this2._setting.mouseKey===OPT_MOUSEKEY_DISABLE){// 监听节点显示 @@ -33527,21 +33532,23 @@ window.removeEventListener("keydown",_this2._handleKeydown);_this2._tranNodes.fo node.removeEventListener("mouseenter",_this2._handleMouseover);node.removeEventListener("mouseleave",_this2._handleMouseout);// 移除已插入元素 (_node$querySelector2=node.querySelector(APP_LCNAME))===null||_node$querySelector2===void 0?void 0:_node$querySelector2.remove();});}// 清空节点集合 _this2._rootNodes.clear();_this2._tranNodes.clear();// 清空任务池 -clearFetchPool();};this._reTranslate=debounce(function(){if(_this2._rule.transOpen==="true"){_this2._register();}},500);this._render=function(el){var _this2$_setting$minLe,_this2$_setting$maxLe;var traEl=el.querySelector(APP_LCNAME);// 已翻译 +clearFetchPool();};this._reTranslate=debounce(function(){if(_this2._rule.transOpen==="true"){_this2._register();}},500);this._invalidLength=function(q){var _this2$_setting$minLe,_this2$_setting$maxLe;return!q||q.length<((_this2$_setting$minLe=_this2._setting.minLength)!==null&&_this2$_setting$minLe!==void 0?_this2$_setting$minLe:TRANS_MIN_LENGTH)||q.length>((_this2$_setting$maxLe=_this2._setting.maxLength)!==null&&_this2$_setting$maxLe!==void 0?_this2$_setting$maxLe:TRANS_MAX_LENGTH);};this._render=function(el){var traEl=el.querySelector(APP_LCNAME);// 已翻译 if(traEl){var preText=_this2._tranNodes.get(el);var curText=el.innerText.trim();// const traText = traEl.innerText.trim(); // todo // 1. traText when loading // 2. replace startsWith if(curText.startsWith(preText)){return;}traEl.remove();}var q=el.innerText.trim();_this2._tranNodes.set(el,q);// 太长或太短 -if(!q||q.length<((_this2$_setting$minLe=_this2._setting.minLength)!==null&&_this2$_setting$minLe!==void 0?_this2$_setting$minLe:TRANS_MIN_LENGTH)||q.length>((_this2$_setting$maxLe=_this2._setting.maxLength)!==null&&_this2$_setting$maxLe!==void 0?_this2$_setting$maxLe:TRANS_MAX_LENGTH)){return;}// console.log("---> ", q); -traEl=document.createElement(APP_LCNAME);traEl.style.visibility="visible";el.appendChild(traEl);el.style.cssText+="-webkit-line-clamp: unset; max-height: none; height: auto;";if(el.parentElement){el.parentElement.style.cssText+="-webkit-line-clamp: unset; max-height: none; height: auto;";}var root=(0,client.createRoot)(traEl);root.render(/*#__PURE__*/(0,jsx_runtime.jsx)(Content,{q:q,translator:_this2}));};var fetchInterval=setting.fetchInterval,fetchLimit=setting.fetchLimit;updateFetchPool(fetchInterval,fetchLimit);this._overrideAttachShadow();this._setting=setting;this._rule=rule;if(rule.transOpen==="true"){this._register();}}_createClass(Translator,[{key:"setting",get:function get(){return this._setting;}},{key:"eventName",get:function get(){return this._eventName;}},{key:"rule",get:function get(){// console.log("get rule", this._rule); +if(_this2._invalidLength(q)){return;}// console.log("---> ", q); +var keepSelector=_this2._rule.keepSelector||"";var keeps=[];if(keepSelector.trim()){var text="";el.childNodes.forEach(function(child){if(child.nodeType===1&&child.matches(keepSelector)){if(child.nodeName==="IMG"){child.style.cssText+="width: ".concat(child.width,"px;");child.style.cssText+="height: ".concat(child.height,"px;");}text+="#".concat(keeps.length,"#");keeps.push(child.outerHTML);}else{text+=child.textContent;}});// 太长或太短 +if(_this2._invalidLength(text.replace(/#(\d+)#/g,"").trim())){return;}if(keeps.length>0){q=text;}}// console.log("---> ", q); +traEl=document.createElement(APP_LCNAME);traEl.style.visibility="visible";el.appendChild(traEl);el.style.cssText+="-webkit-line-clamp: unset; max-height: none; height: auto;";if(el.parentElement){el.parentElement.style.cssText+="-webkit-line-clamp: unset; max-height: none; height: auto;";}var root=(0,client.createRoot)(traEl);root.render(/*#__PURE__*/(0,jsx_runtime.jsx)(Content,{q:q,keeps:keeps,translator:_this2}));};var fetchInterval=setting.fetchInterval,fetchLimit=setting.fetchLimit;updateFetchPool(fetchInterval,fetchLimit);this._overrideAttachShadow();this._setting=setting;this._rule=rule;this._fixerSetting=fixerSetting;if(rule.transOpen==="true"){this._register();}}_createClass(Translator,[{key:"setting",get:function get(){return this._setting;}},{key:"eventName",get:function get(){return this._eventName;}},{key:"rule",get:function get(){// console.log("get rule", this._rule); return this._rule;},set:function set(rule){// console.log("set rule", rule); this._rule=rule;// 广播消息 var eventName=this._eventName;window.dispatchEvent(new CustomEvent(eventName,{detail:{action:MSG_TRANS_CURRULE,args:rule}}));}}]);return Translator;}(); ;// CONCATENATED MODULE: ./src/views/Selection/TranBtn.js -function TranBtn(_ref){var onClick=_ref.onClick,position=_ref.position,tranboxSetting=_ref.tranboxSetting;return/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{cursor:"pointer",position:"absolute",left:position.x+tranboxSetting.btnOffsetX,top:position.y+tranboxSetting.btnOffsetY,zIndex:2147483647},onClick:onClick,onMouseUp:function onMouseUp(e){e.stopPropagation();},children:/*#__PURE__*/(0,jsx_runtime.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 32 32",version:"1.1",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M0 0 C10.56 0 21.12 0 32 0 C32 10.56 32 21.12 32 32 C21.44 32 10.88 32 0 32 C0 21.44 0 10.88 0 0 Z ",fill:"#209CEE",transform:"translate(0,0)"}),/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M0 0 C0.66 0 1.32 0 2 0 C2 2.97 2 5.94 2 9 C2.969375 8.2575 3.93875 7.515 4.9375 6.75 C5.48277344 6.33234375 6.02804688 5.9146875 6.58984375 5.484375 C8.39053593 3.83283924 8.39053593 3.83283924 9 0 C13.95 0 18.9 0 24 0 C24 0.99 24 1.98 24 3 C22.68 3 21.36 3 20 3 C20 9.27 20 15.54 20 22 C19.01 22 18.02 22 17 22 C17 15.73 17 9.46 17 3 C15.35 3 13.7 3 12 3 C11.731875 3.598125 11.46375 4.19625 11.1875 4.8125 C10.01506533 6.97224808 8.80630718 8.35790256 7 10 C8.01790655 12.27071461 8.77442829 13.80784632 10.6875 15.4375 C11.120625 15.953125 11.55375 16.46875 12 17 C11.6875 19.6875 11.6875 19.6875 11 22 C10.34 22 9.68 22 9 22 C8.773125 21.236875 8.54625 20.47375 8.3125 19.6875 C6.73268318 16.45263699 5.16717283 15.58358642 2 14 C2 16.64 2 19.28 2 22 C1.34 22 0.68 22 0 22 C0 14.74 0 7.48 0 0 Z ",fill:"#E9F5FD",transform:"translate(4,5)"})]})});} +function TranBtn(_ref){var onClick=_ref.onClick,position=_ref.position,tranboxSetting=_ref.tranboxSetting;var left=position.x+tranboxSetting.btnOffsetX;var top=position.y+tranboxSetting.btnOffsetY;var touchProps=isMobile?{onTouchEnd:onClick}:{onMouseUp:onClick};return/*#__PURE__*/(0,jsx_runtime.jsx)("div",_objectSpread2(_objectSpread2({style:{cursor:"pointer",position:"absolute",left:left,top:top,zIndex:2147483647}},touchProps),{},{children:/*#__PURE__*/(0,jsx_runtime.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 32 32",version:"1.1",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M0 0 C10.56 0 21.12 0 32 0 C32 10.56 32 21.12 32 32 C21.44 32 10.88 32 0 32 C0 21.44 0 10.88 0 0 Z ",fill:"#209CEE",transform:"translate(0,0)"}),/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M0 0 C0.66 0 1.32 0 2 0 C2 2.97 2 5.94 2 9 C2.969375 8.2575 3.93875 7.515 4.9375 6.75 C5.48277344 6.33234375 6.02804688 5.9146875 6.58984375 5.484375 C8.39053593 3.83283924 8.39053593 3.83283924 9 0 C13.95 0 18.9 0 24 0 C24 0.99 24 1.98 24 3 C22.68 3 21.36 3 20 3 C20 9.27 20 15.54 20 22 C19.01 22 18.02 22 17 22 C17 15.73 17 9.46 17 3 C15.35 3 13.7 3 12 3 C11.731875 3.598125 11.46375 4.19625 11.1875 4.8125 C10.01506533 6.97224808 8.80630718 8.35790256 7 10 C8.01790655 12.27071461 8.77442829 13.80784632 10.6875 15.4375 C11.120625 15.953125 11.55375 16.46875 12 17 C11.6875 19.6875 11.6875 19.6875 11 22 C10.34 22 9.68 22 9 22 C8.773125 21.236875 8.54625 20.47375 8.3125 19.6875 C6.73268318 16.45263699 5.16717283 15.58358642 2 14 C2 16.64 2 19.28 2 22 C1.34 22 0.68 22 0 22 C0 14.74 0 7.48 0 0 Z ",fill:"#E9F5FD",transform:"translate(4,5)"})]})}));} ;// CONCATENATED MODULE: ./src/views/Selection/DraggableResizable.js -var DraggableResizable_excluded=["direction","size","setSize","position","setPosition","children","minSize","maxSize"];function Pointer(_ref){var direction=_ref.direction,size=_ref.size,setSize=_ref.setSize,position=_ref.position,setPosition=_ref.setPosition,children=_ref.children,minSize=_ref.minSize,maxSize=_ref.maxSize,props=_objectWithoutProperties(_ref,DraggableResizable_excluded);var _useState=(0,react.useState)(null),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),origin=_useState2[0],setOrigin=_useState2[1];function handlePointerDown(e){e.target.setPointerCapture(e.pointerId);setOrigin({x:position.x,y:position.y,w:size.w,h:size.h,clientX:e.clientX,clientY:e.clientY});}function handlePointerMove(e){if(origin){var dx=e.clientX-origin.clientX;var dy=e.clientY-origin.clientY;var x=position.x;var y=position.y;var w=size.w;var h=size.h;switch(direction){case"Header":x=origin.x+dx;y=origin.y+dy;break;case"TopLeft":x=origin.x+dx;y=origin.y+dy;w=origin.w-dx;h=origin.h-dy;break;case"Top":y=origin.y+dy;h=origin.h-dy;break;case"TopRight":y=origin.y+dy;w=origin.w+dx;h=origin.h-dy;break;case"Left":x=origin.x+dx;w=origin.w-dx;break;case"Right":w=origin.w+dx;break;case"BottomLeft":x=origin.x+dx;w=origin.w-dx;h=origin.h+dy;break;case"Bottom":h=origin.h+dy;break;case"BottomRight":w=origin.w+dx;h=origin.h+dy;break;default:}if(wmaxSize.w){w=maxSize.w;x=position.x;}if(hmaxSize.h){h=maxSize.h;y=position.y;}setPosition({x:x,y:y});setSize({w:w,h:h});}}function handlePointerUp(e){setOrigin(null);}return/*#__PURE__*/(0,jsx_runtime.jsx)("div",_objectSpread2(_objectSpread2({},props),{},{onPointerDown:handlePointerDown,onPointerMove:handlePointerMove,onPointerUp:handlePointerUp,children:children}));}function DraggableResizable(_ref2){var header=_ref2.header,children=_ref2.children,_ref2$defaultPosition=_ref2.defaultPosition,defaultPosition=_ref2$defaultPosition===void 0?{x:0,y:0}:_ref2$defaultPosition,_ref2$defaultSize=_ref2.defaultSize,defaultSize=_ref2$defaultSize===void 0?{w:600,h:400}:_ref2$defaultSize,_ref2$minSize=_ref2.minSize,minSize=_ref2$minSize===void 0?{w:300,h:200}:_ref2$minSize,_ref2$maxSize=_ref2.maxSize,maxSize=_ref2$maxSize===void 0?{w:1200,h:1200}:_ref2$maxSize,onChangeSize=_ref2.onChangeSize,onChangePosition=_ref2.onChangePosition;var lineWidth=4;var _useState3=(0,react.useState)(defaultPosition),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),position=_useState4[0],setPosition=_useState4[1];var _useState5=(0,react.useState)(defaultSize),_useState6=(0,slicedToArray/* default */.Z)(_useState5,2),size=_useState6[0],setSize=_useState6[1];var opts={size:size,setSize:setSize,position:position,setPosition:setPosition,minSize:minSize,maxSize:maxSize};(0,react.useEffect)(function(){onChangeSize&&onChangeSize(size);},[size,onChangeSize]);(0,react.useEffect)(function(){onChangePosition&&onChangePosition(position);},[position,onChangePosition]);return/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{style:{position:"fixed",left:position.x,top:position.y,display:"grid",gridTemplateColumns:"".concat(lineWidth*2,"px auto ").concat(lineWidth*2,"px"),gridTemplateRows:"".concat(lineWidth*2,"px auto ").concat(lineWidth*2,"px"),zIndex:2147483647},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"TopLeft",style:{transform:"translate(".concat(lineWidth,"px, ").concat(lineWidth,"px)"),cursor:"nw-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"Top",style:{margin:"0 ".concat(lineWidth,"px"),transform:"translate(0px, ".concat(lineWidth,"px)"),cursor:"row-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"TopRight",style:{transform:"translate(-".concat(lineWidth,"px, ").concat(lineWidth,"px)"),cursor:"ne-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"Left",style:{margin:"".concat(lineWidth,"px 0"),transform:"translate(".concat(lineWidth,"px, 0px)"),cursor:"col-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsxs)(Paper_Paper,{elevation:4,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2(_objectSpread2({direction:"Header",style:{cursor:"move"}},opts),{},{children:header})),/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{width:size.w,height:size.h,overflow:"hidden auto"},children:children})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"Right",style:{margin:"".concat(lineWidth,"px 0"),transform:"translate(-".concat(lineWidth,"px, 0px)"),cursor:"col-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"BottomLeft",style:{transform:"translate(".concat(lineWidth,"px, -").concat(lineWidth,"px)"),cursor:"ne-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"Bottom",style:{margin:"0 ".concat(lineWidth,"px"),transform:"translate(0px, -".concat(lineWidth,"px)"),cursor:"row-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"BottomRight",style:{transform:"translate(-".concat(lineWidth,"px, -").concat(lineWidth,"px)"),cursor:"nw-resize"}},opts))]});} +var DraggableResizable_excluded=["direction","size","setSize","position","setPosition","children","minSize","maxSize"];function Pointer(_ref){var direction=_ref.direction,size=_ref.size,setSize=_ref.setSize,position=_ref.position,setPosition=_ref.setPosition,children=_ref.children,minSize=_ref.minSize,maxSize=_ref.maxSize,props=_objectWithoutProperties(_ref,DraggableResizable_excluded);var _useState=(0,react.useState)(null),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),origin=_useState2[0],setOrigin=_useState2[1];function handlePointerDown(e){!isMobile&&e.target.setPointerCapture(e.pointerId);var _ref2=isMobile?e.targetTouches[0]:e,clientX=_ref2.clientX,clientY=_ref2.clientY;setOrigin({x:position.x,y:position.y,w:size.w,h:size.h,clientX:clientX,clientY:clientY});}function handlePointerMove(e){var _ref3=isMobile?e.targetTouches[0]:e,clientX=_ref3.clientX,clientY=_ref3.clientY;if(origin){var dx=clientX-origin.clientX;var dy=clientY-origin.clientY;var x=position.x;var y=position.y;var w=size.w;var h=size.h;switch(direction){case"Header":x=origin.x+dx;y=origin.y+dy;break;case"TopLeft":x=origin.x+dx;y=origin.y+dy;w=origin.w-dx;h=origin.h-dy;break;case"Top":y=origin.y+dy;h=origin.h-dy;break;case"TopRight":y=origin.y+dy;w=origin.w+dx;h=origin.h-dy;break;case"Left":x=origin.x+dx;w=origin.w-dx;break;case"Right":w=origin.w+dx;break;case"BottomLeft":x=origin.x+dx;w=origin.w-dx;h=origin.h+dy;break;case"Bottom":h=origin.h+dy;break;case"BottomRight":w=origin.w+dx;h=origin.h+dy;break;default:}if(wmaxSize.w){w=maxSize.w;x=position.x;}if(hmaxSize.h){h=maxSize.h;y=position.y;}setPosition({x:x,y:y});setSize({w:w,h:h});}}function handlePointerUp(e){e.stopPropagation();setOrigin(null);}var touchProps=isMobile?{onTouchStart:handlePointerDown,onTouchMove:handlePointerMove,onTouchEnd:handlePointerUp}:{onPointerDown:handlePointerDown,onPointerMove:handlePointerMove,onPointerUp:handlePointerUp};return/*#__PURE__*/(0,jsx_runtime.jsx)("div",_objectSpread2(_objectSpread2(_objectSpread2({},props),touchProps),{},{children:children}));}function DraggableResizable(_ref4){var header=_ref4.header,children=_ref4.children,_ref4$defaultPosition=_ref4.defaultPosition,defaultPosition=_ref4$defaultPosition===void 0?{x:0,y:0}:_ref4$defaultPosition,_ref4$defaultSize=_ref4.defaultSize,defaultSize=_ref4$defaultSize===void 0?{w:600,h:400}:_ref4$defaultSize,_ref4$minSize=_ref4.minSize,minSize=_ref4$minSize===void 0?{w:300,h:200}:_ref4$minSize,_ref4$maxSize=_ref4.maxSize,maxSize=_ref4$maxSize===void 0?{w:1200,h:1200}:_ref4$maxSize,onChangeSize=_ref4.onChangeSize,onChangePosition=_ref4.onChangePosition;var lineWidth=4;var _useState3=(0,react.useState)(defaultPosition),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),position=_useState4[0],setPosition=_useState4[1];var _useState5=(0,react.useState)(defaultSize),_useState6=(0,slicedToArray/* default */.Z)(_useState5,2),size=_useState6[0],setSize=_useState6[1];var opts={size:size,setSize:setSize,position:position,setPosition:setPosition,minSize:minSize,maxSize:maxSize};(0,react.useEffect)(function(){onChangeSize&&onChangeSize(size);},[size,onChangeSize]);(0,react.useEffect)(function(){onChangePosition&&onChangePosition(position);},[position,onChangePosition]);return/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{style:{touchAction:"none",position:"fixed",left:position.x,top:position.y,display:"grid",gridTemplateColumns:"".concat(lineWidth*2,"px auto ").concat(lineWidth*2,"px"),gridTemplateRows:"".concat(lineWidth*2,"px auto ").concat(lineWidth*2,"px"),zIndex:2147483647},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"TopLeft",style:{transform:"translate(".concat(lineWidth,"px, ").concat(lineWidth,"px)"),cursor:"nw-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"Top",style:{margin:"0 ".concat(lineWidth,"px"),transform:"translate(0px, ".concat(lineWidth,"px)"),cursor:"row-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"TopRight",style:{transform:"translate(-".concat(lineWidth,"px, ").concat(lineWidth,"px)"),cursor:"ne-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"Left",style:{margin:"".concat(lineWidth,"px 0"),transform:"translate(".concat(lineWidth,"px, 0px)"),cursor:"col-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsxs)(Paper_Paper,{elevation:4,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2(_objectSpread2({direction:"Header",style:{cursor:"move"}},opts),{},{children:header})),/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{width:size.w,height:size.h,overflow:"hidden auto"},children:children})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"Right",style:{margin:"".concat(lineWidth,"px 0"),transform:"translate(-".concat(lineWidth,"px, 0px)"),cursor:"col-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"BottomLeft",style:{transform:"translate(".concat(lineWidth,"px, -").concat(lineWidth,"px)"),cursor:"ne-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"Bottom",style:{margin:"0 ".concat(lineWidth,"px"),transform:"translate(0px, -".concat(lineWidth,"px)"),cursor:"row-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"BottomRight",style:{transform:"translate(-".concat(lineWidth,"px, -").concat(lineWidth,"px)"),cursor:"nw-resize"}},opts))]});} ;// CONCATENATED MODULE: ./node_modules/.pnpm/@mui+material@5.14.10_@emotion+react@11.11.1_@emotion+styled@11.11.0_@types+react@18.2.22_react-dom@18.2.0_react@18.2.0/node_modules/@mui/material/Grid/GridContext.js 'use client'; @@ -34859,8 +34866,10 @@ if(!(isValidWord(text)&&toLang.startsWith("zh"))){_context.next=27;break;}if(!(f ;// CONCATENATED MODULE: ./src/views/Selection/TranBox.js function TranForm(_ref){var text=_ref.text,setText=_ref.setText,tranboxSetting=_ref.tranboxSetting,transApis=_ref.transApis;var i18n=useI18n();var _useState=(0,react.useState)(false),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),editMode=_useState2[0],setEditMode=_useState2[1];var _useState3=(0,react.useState)(""),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),editText=_useState4[0],setEditText=_useState4[1];var _useState5=(0,react.useState)(tranboxSetting.translator),_useState6=(0,slicedToArray/* default */.Z)(_useState5,2),translator=_useState6[0],setTranslator=_useState6[1];var _useState7=(0,react.useState)(tranboxSetting.fromLang),_useState8=(0,slicedToArray/* default */.Z)(_useState7,2),fromLang=_useState8[0],setFromLang=_useState8[1];var _useState9=(0,react.useState)(tranboxSetting.toLang),_useState10=(0,slicedToArray/* default */.Z)(_useState9,2),toLang=_useState10[0],setToLang=_useState10[1];var _useState11=(0,react.useState)(tranboxSetting.toLang2),_useState12=(0,slicedToArray/* default */.Z)(_useState11,2),toLang2=_useState12[0],setToLang2=_useState12[1];var inputRef=(0,react.useRef)(null);return/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{sx:{p:2},spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Grid_Grid,{container:true,spacing:2,columns:12,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:4,sm:4,md:4,lg:4,children:/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},fullWidth:true,size:"small",name:"fromLang",value:fromLang,label:i18n("from_lang"),onChange:function onChange(e){setFromLang(e.target.value);},children:OPT_LANGS_FROM.map(function(_ref2){var _ref3=(0,slicedToArray/* default */.Z)(_ref2,2),lang=_ref3[0],name=_ref3[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:4,sm:4,md:4,lg:4,children:/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},fullWidth:true,size:"small",name:"toLang",value:toLang,label:i18n("to_lang"),onChange:function onChange(e){setToLang(e.target.value);},children:OPT_LANGS_TO.map(function(_ref4){var _ref5=(0,slicedToArray/* default */.Z)(_ref4,2),lang=_ref5[0],name=_ref5[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:4,sm:4,md:4,lg:4,children:/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},fullWidth:true,size:"small",value:translator,name:"translator",label:i18n("translate_service"),onChange:function onChange(e){setTranslator(e.target.value);},children:OPT_TRANS_ALL.map(function(item){return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:item,children:item},item);})})})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:i18n("original_text"),inputRef:inputRef,fullWidth:true,multiline:true,value:editMode?editText:text,disabled:!editMode,onChange:function onChange(e){setEditText(e.target.value);},onClick:function onClick(){setEditMode(true);setEditText(text);var timer=setTimeout(function(){var _inputRef$current;clearTimeout(timer);(_inputRef$current=inputRef.current)===null||_inputRef$current===void 0?void 0:_inputRef$current.focus();},100);},onBlur:function onBlur(){setEditMode(false);setText(editText.trim());},InputProps:{endAdornment:/*#__PURE__*/(0,jsx_runtime.jsx)(Stack_Stack,{direction:"row",sx:{position:"absolute",right:0,top:0},children:editMode?/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{size:"small",onClick:function onClick(e){e.stopPropagation();},children:/*#__PURE__*/(0,jsx_runtime.jsx)(Done/* default */.Z,{fontSize:"inherit"})}):/*#__PURE__*/(0,jsx_runtime.jsx)(CopyBtn,{text:text})})}})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TranCont,{text:text,translator:translator,fromLang:fromLang,toLang:toLang,toLang2:toLang2,setToLang:setToLang,setToLang2:setToLang2,transApis:transApis})]});}function TranBox(_ref6){var text=_ref6.text,setText=_ref6.setText,setShowBox=_ref6.setShowBox,tranboxSetting=_ref6.tranboxSetting,transApis=_ref6.transApis,boxSize=_ref6.boxSize,setBoxSize=_ref6.setBoxSize,boxPosition=_ref6.boxPosition,setBoxPosition=_ref6.setBoxPosition;return/*#__PURE__*/(0,jsx_runtime.jsx)(SettingProvider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Theme,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(DraggableResizable,{defaultPosition:boxPosition,defaultSize:boxSize,header:/*#__PURE__*/(0,jsx_runtime.jsx)(Header,{setShowPopup:setShowBox}),onChangeSize:setBoxSize,onChangePosition:setBoxPosition,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(TranForm,{text:text,setText:setText,tranboxSetting:tranboxSetting,transApis:transApis})]})})});} ;// CONCATENATED MODULE: ./src/views/Selection/index.js -function Slection(_ref){var contextMenus=_ref.contextMenus,tranboxSetting=_ref.tranboxSetting,transApis=_ref.transApis;var _useState=(0,react.useState)(false),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),showBox=_useState2[0],setShowBox=_useState2[1];var _useState3=(0,react.useState)(false),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),showBtn=_useState4[0],setShowBtn=_useState4[1];var _useState5=(0,react.useState)(""),_useState6=(0,slicedToArray/* default */.Z)(_useState5,2),selectedText=_useState6[0],setSelText=_useState6[1];var _useState7=(0,react.useState)(""),_useState8=(0,slicedToArray/* default */.Z)(_useState7,2),text=_useState8[0],setText=_useState8[1];var _useState9=(0,react.useState)({x:0,y:0}),_useState10=(0,slicedToArray/* default */.Z)(_useState9,2),position=_useState10[0],setPosition=_useState10[1];var _useState11=(0,react.useState)({w:600,h:400}),_useState12=(0,slicedToArray/* default */.Z)(_useState11,2),boxSize=_useState12[0],setBoxSize=_useState12[1];var _useState13=(0,react.useState)({x:(window.innerWidth-600)/2,y:(window.innerHeight-400)/2}),_useState14=(0,slicedToArray/* default */.Z)(_useState13,2),boxPosition=_useState14[0],setBoxPosition=_useState14[1];var handleClick=function handleClick(e){e.stopPropagation();setShowBtn(false);setText(selectedText);setShowBox(true);};var handleTranbox=(0,react.useCallback)(function(){var _window$getSelection,_window$getSelection$;setShowBtn(false);var selectedText=((_window$getSelection=window.getSelection())===null||_window$getSelection===void 0?void 0:(_window$getSelection$=_window$getSelection.toString())===null||_window$getSelection$===void 0?void 0:_window$getSelection$.trim())||"";if(!selectedText){setShowBox(function(pre){return!pre;});return;}setSelText(selectedText);setText(selectedText);setShowBox(true);},[]);(0,react.useEffect)(function(){function handleMouseup(_x){return _handleMouseup.apply(this,arguments);}function _handleMouseup(){_handleMouseup=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(e){var _window$getSelection2,_window$getSelection3;var selectedText;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=2;return sleep(10);case 2:selectedText=((_window$getSelection2=window.getSelection())===null||_window$getSelection2===void 0?void 0:(_window$getSelection3=_window$getSelection2.toString())===null||_window$getSelection3===void 0?void 0:_window$getSelection3.trim())||"";setSelText(selectedText);if(selectedText){_context.next=7;break;}setShowBtn(false);return _context.abrupt("return");case 7:!tranboxSetting.hideTranBtn&&setShowBtn(true);// setPosition({ x: e.clientX, y: e.clientY }); -setPosition({x:e.pageX,y:e.pageY});case 9:case"end":return _context.stop();}},_callee);}));return _handleMouseup.apply(this,arguments);}window.addEventListener("mouseup",handleMouseup);return function(){window.removeEventListener("mouseup",handleMouseup);};},[tranboxSetting.hideTranBtn]);(0,react.useEffect)(function(){var clearShortcut=shortcutRegister(tranboxSetting.tranboxShortcut||DEFAULT_TRANBOX_SHORTCUT,handleTranbox);return function(){clearShortcut();};},[tranboxSetting.tranboxShortcut,handleTranbox]);(0,react.useEffect)(function(){window.addEventListener(MSG_OPEN_TRANBOX,handleTranbox);return function(){window.removeEventListener(MSG_OPEN_TRANBOX,handleTranbox);};},[handleTranbox]);(0,react.useEffect)(function(){if(!isGm){return;}// 注册菜单 +function Slection(_ref){var contextMenus=_ref.contextMenus,tranboxSetting=_ref.tranboxSetting,transApis=_ref.transApis;var boxWidth=limitNumber(window.innerWidth,300,600);var boxHeight=limitNumber(window.innerHeight,200,400);var _useState=(0,react.useState)(false),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),showBox=_useState2[0],setShowBox=_useState2[1];var _useState3=(0,react.useState)(false),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),showBtn=_useState4[0],setShowBtn=_useState4[1];var _useState5=(0,react.useState)(""),_useState6=(0,slicedToArray/* default */.Z)(_useState5,2),selectedText=_useState6[0],setSelText=_useState6[1];var _useState7=(0,react.useState)(""),_useState8=(0,slicedToArray/* default */.Z)(_useState7,2),text=_useState8[0],setText=_useState8[1];var _useState9=(0,react.useState)({x:0,y:0}),_useState10=(0,slicedToArray/* default */.Z)(_useState9,2),position=_useState10[0],setPosition=_useState10[1];var _useState11=(0,react.useState)({w:boxWidth,h:boxHeight}),_useState12=(0,slicedToArray/* default */.Z)(_useState11,2),boxSize=_useState12[0],setBoxSize=_useState12[1];var _useState13=(0,react.useState)({x:(window.innerWidth-boxWidth)/2,y:(window.innerHeight-boxHeight)/2}),_useState14=(0,slicedToArray/* default */.Z)(_useState13,2),boxPosition=_useState14[0],setBoxPosition=_useState14[1];var handleClick=function handleClick(e){e.stopPropagation();setShowBtn(false);setText(selectedText);setShowBox(true);};var handleTranbox=(0,react.useCallback)(function(){var _window$getSelection,_window$getSelection$;setShowBtn(false);var selectedText=((_window$getSelection=window.getSelection())===null||_window$getSelection===void 0?void 0:(_window$getSelection$=_window$getSelection.toString())===null||_window$getSelection$===void 0?void 0:_window$getSelection$.trim())||"";if(!selectedText){setShowBox(function(pre){return!pre;});return;}setSelText(selectedText);setText(selectedText);setShowBox(true);},[]);(0,react.useEffect)(function(){function handleMouseup(_x){return _handleMouseup.apply(this,arguments);}// todo: mobile support +function _handleMouseup(){_handleMouseup=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(e){var _window$getSelection2,_window$getSelection3;var selectedText,_ref2,pageX,pageY;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:e.stopPropagation();_context.next=3;return sleep(10);case 3:selectedText=((_window$getSelection2=window.getSelection())===null||_window$getSelection2===void 0?void 0:(_window$getSelection3=_window$getSelection2.toString())===null||_window$getSelection3===void 0?void 0:_window$getSelection3.trim())||"";setSelText(selectedText);if(selectedText){_context.next=8;break;}setShowBtn(false);return _context.abrupt("return");case 8:_ref2=isMobile?e.changedTouches[0]:e,pageX=_ref2.pageX,pageY=_ref2.pageY;!tranboxSetting.hideTranBtn&&setShowBtn(true);// setPosition({ x: e.clientX, y: e.clientY }); +setPosition({x:pageX,y:pageY});case 11:case"end":return _context.stop();}},_callee);}));return _handleMouseup.apply(this,arguments);}window.addEventListener("mouseup",handleMouseup);// window.addEventListener(isMobile ? "touchend" : "mouseup", handleMouseup); +return function(){window.removeEventListener(isMobile?"touchend":"mouseup",handleMouseup);};},[tranboxSetting.hideTranBtn]);(0,react.useEffect)(function(){if(isExt){return;}var clearShortcut=shortcutRegister(tranboxSetting.tranboxShortcut||DEFAULT_TRANBOX_SHORTCUT,handleTranbox);return function(){clearShortcut();};},[tranboxSetting.tranboxShortcut,handleTranbox]);(0,react.useEffect)(function(){window.addEventListener(MSG_OPEN_TRANBOX,handleTranbox);return function(){window.removeEventListener(MSG_OPEN_TRANBOX,handleTranbox);};},[handleTranbox]);(0,react.useEffect)(function(){if(!isGm){return;}// 注册菜单 try{var menuCommandIds=[];contextMenus&&menuCommandIds.push(GM.registerMenuCommand("Translate Selected Text (Alt+S)",function(event){handleTranbox();},"S"));return function(){menuCommandIds.forEach(function(id){GM.unregisterMenuCommand(id);});};}catch(err){console.log("[registerMenuCommand]",err);}},[handleTranbox,contextMenus]);return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[showBox&&/*#__PURE__*/(0,jsx_runtime.jsx)(TranBox,{text:text,setText:setText,boxSize:boxSize,setBoxSize:setBoxSize,boxPosition:boxPosition,setBoxPosition:setBoxPosition,tranboxSetting:tranboxSetting,transApis:transApis,setShowBox:setShowBox}),showBtn&&/*#__PURE__*/(0,jsx_runtime.jsx)(TranBtn,{position:position,tranboxSetting:tranboxSetting,onClick:handleClick})]});} ;// CONCATENATED MODULE: ./src/libs/touch.js function touchTapListener(fn,touchsLength){var handleTouchend=function handleTouchend(e){if(e.touches.length===touchsLength){fn();}};document.addEventListener("touchstart",handleTouchend);return function(){document.removeEventListener("touchstart",handleTouchend);};} @@ -34868,7 +34877,7 @@ function touchTapListener(fn,touchsLength){var handleTouchend=function handleTou var MSG_GM_xmlHttpRequest="xmlHttpRequest";var MSG_GM_setValue="setValue";var MSG_GM_getValue="getValue";var MSG_GM_deleteValue="deleteValue";var MSG_GM_info="info";/** * 注入页面的脚本,请求并接受GM接口信息 * @param {*} param0 - */var injectScript=function injectScript(ping){window.APP_INFO={name:"KISS Translator",version:"1.7.15",eventName:ping};};/** + */var injectScript=function injectScript(ping){window.APP_INFO={name:"KISS Translator",version:"1.7.16",eventName:ping};};/** * 适配GM脚本 */var adaptScript=function adaptScript(ping){var promiseGM=function promiseGM(action,args){var timeout=arguments.length>2&&arguments[2]!==undefined?arguments[2]:5000;return new Promise(function(resolve,reject){var pong=genEventName();var handleEvent=function handleEvent(e){window.removeEventListener(pong,handleEvent);var _e$detail=e.detail,data=_e$detail.data,error=_e$detail.error;if(error){reject(new Error(error));}else{resolve(data);}};window.addEventListener(pong,handleEvent);window.dispatchEvent(new CustomEvent(ping,{detail:{action:action,args:args,pong:pong}}));setTimeout(function(){window.removeEventListener(pong,handleEvent);reject(new Error("timeout"));},timeout);});};window.KISS_GM={fetch:function fetch(input,init){return promiseGM(MSG_GM_xmlHttpRequest,{input:input,init:init});},setValue:function setValue(key,val){return promiseGM(MSG_GM_setValue,{key:key,val:val});},getValue:function getValue(key){return promiseGM(MSG_GM_getValue,{key:key});},deleteValue:function deleteValue(key){return promiseGM(MSG_GM_deleteValue,{key:key});},getInfo:function(){var _getInfo=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(window.GM_info){_context.next=4;break;}_context.next=3;return promiseGM(MSG_GM_info);case 3:window.GM_info=_context.sent;case 4:return _context.abrupt("return",window.GM_info);case 5:case"end":return _context.stop();}},_callee);}));function getInfo(){return _getInfo.apply(this,arguments);}return getInfo;}()};};/** * 监听并回应页面对GM接口的请求 @@ -34890,7 +34899,7 @@ loadingId="kiss-"+utils_genEventName();_context.prev=13;addLoading(node,loadingI ;// CONCATENATED MODULE: ./src/common.js /** * 油猴脚本设置页面 - */function runSettingPage(){var _GM,_GM$info,_GM$info$script,_GM$info$script$grant;if((_GM=GM)!==null&&_GM!==void 0&&(_GM$info=_GM.info)!==null&&_GM$info!==void 0&&(_GM$info$script=_GM$info.script)!==null&&_GM$info$script!==void 0&&(_GM$info$script$grant=_GM$info$script.grant)!==null&&_GM$info$script$grant!==void 0&&_GM$info$script$grant.includes("unsafeWindow")){unsafeWindow.GM=GM;unsafeWindow.APP_INFO={name:"KISS Translator",version:"1.7.15"};}else{var ping=utils_genEventName();window.addEventListener(ping,handlePing);// window.eval(`(${injectScript})("${ping}")`); // eslint-disable-line + */function runSettingPage(){var _GM,_GM$info,_GM$info$script,_GM$info$script$grant;if((_GM=GM)!==null&&_GM!==void 0&&(_GM$info=_GM.info)!==null&&_GM$info!==void 0&&(_GM$info$script=_GM$info.script)!==null&&_GM$info$script!==void 0&&(_GM$info$script$grant=_GM$info$script.grant)!==null&&_GM$info$script$grant!==void 0&&_GM$info$script$grant.includes("unsafeWindow")){unsafeWindow.GM=GM;unsafeWindow.APP_INFO={name:"KISS Translator",version:"1.7.16"};}else{var ping=utils_genEventName();window.addEventListener(ping,handlePing);// window.eval(`(${injectScript})("${ping}")`); // eslint-disable-line var script=document.createElement("script");script.textContent="(".concat(injectScript,")(\"").concat(ping,"\")");document.head.append(script);}}/** * 插件监听后端事件 * @param {*} translator @@ -34905,7 +34914,7 @@ var script=document.createElement("script");script.textContent="(".concat(inject * 划词翻译 * @param {*} param0 * @returns - */function _showFab(){_showFab=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(translator){var fab,$action,shadowContainer,emotionRoot,shadowRootElement,cache;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return getFabWithDefault();case 2:fab=_context2.sent;if(!fab.isHide){_context2.next=5;break;}return _context2.abrupt("return");case 5:$action=document.createElement("div");$action.setAttribute("id",APP_LCNAME);document.body.parentElement.appendChild($action);shadowContainer=$action.attachShadow({mode:"closed"});emotionRoot=document.createElement("style");shadowRootElement=document.createElement("div");shadowContainer.appendChild(emotionRoot);shadowContainer.appendChild(shadowRootElement);cache=(0,emotion_cache_browser_esm/* default */.Z)({key:APP_LCNAME,prepend:true,container:emotionRoot});client.createRoot(shadowRootElement).render(/*#__PURE__*/(0,jsx_runtime.jsx)(react.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(emotion_element_c39617d8_browser_esm.C,{value:cache,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Action,{translator:translator,fab:fab})})}));case 15:case"end":return _context2.stop();}},_callee2);}));return _showFab.apply(this,arguments);}function showTransbox(_ref4){var _ref4$contextMenus=_ref4.contextMenus,contextMenus=_ref4$contextMenus===void 0?true:_ref4$contextMenus,_ref4$tranboxSetting=_ref4.tranboxSetting,tranboxSetting=_ref4$tranboxSetting===void 0?DEFAULT_TRANBOX_SETTING:_ref4$tranboxSetting,transApis=_ref4.transApis;if(!(tranboxSetting!==null&&tranboxSetting!==void 0&&tranboxSetting.transOpen)){return;}var $tranbox=document.createElement("div");$tranbox.setAttribute("id","kiss-transbox");document.body.parentElement.appendChild($tranbox);var shadowContainer=$tranbox.attachShadow({mode:"closed"});var emotionRoot=document.createElement("style");var shadowRootElement=document.createElement("div");shadowContainer.appendChild(emotionRoot);shadowContainer.appendChild(shadowRootElement);var cache=(0,emotion_cache_browser_esm/* default */.Z)({key:"kiss-transbox",prepend:true,container:emotionRoot});client.createRoot(shadowRootElement).render(/*#__PURE__*/(0,jsx_runtime.jsx)(react.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(emotion_element_c39617d8_browser_esm.C,{value:cache,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Slection,{contextMenus:contextMenus,tranboxSetting:tranboxSetting,transApis:transApis})})}));}/** + */function _showFab(){_showFab=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(translator){var fab,$action,shadowContainer,emotionRoot,shadowRootElement,cache;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return getFabWithDefault();case 2:fab=_context2.sent;$action=document.createElement("div");$action.setAttribute("id",APP_LCNAME);document.body.parentElement.appendChild($action);shadowContainer=$action.attachShadow({mode:"closed"});emotionRoot=document.createElement("style");shadowRootElement=document.createElement("div");shadowContainer.appendChild(emotionRoot);shadowContainer.appendChild(shadowRootElement);cache=(0,emotion_cache_browser_esm/* default */.Z)({key:APP_LCNAME,prepend:true,container:emotionRoot});client.createRoot(shadowRootElement).render(/*#__PURE__*/(0,jsx_runtime.jsx)(react.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(emotion_element_c39617d8_browser_esm.C,{value:cache,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Action,{translator:translator,fab:fab})})}));case 13:case"end":return _context2.stop();}},_callee2);}));return _showFab.apply(this,arguments);}function showTransbox(_ref4){var _ref4$contextMenus=_ref4.contextMenus,contextMenus=_ref4$contextMenus===void 0?true:_ref4$contextMenus,_ref4$tranboxSetting=_ref4.tranboxSetting,tranboxSetting=_ref4$tranboxSetting===void 0?DEFAULT_TRANBOX_SETTING:_ref4$tranboxSetting,transApis=_ref4.transApis;if(!(tranboxSetting!==null&&tranboxSetting!==void 0&&tranboxSetting.transOpen)){return;}var $tranbox=document.createElement("div");$tranbox.setAttribute("id","kiss-transbox");document.body.parentElement.appendChild($tranbox);var shadowContainer=$tranbox.attachShadow({mode:"closed"});var emotionRoot=document.createElement("style");var shadowRootElement=document.createElement("div");shadowContainer.appendChild(emotionRoot);shadowContainer.appendChild(shadowRootElement);var cache=(0,emotion_cache_browser_esm/* default */.Z)({key:"kiss-transbox",prepend:true,container:emotionRoot});client.createRoot(shadowRootElement).render(/*#__PURE__*/(0,jsx_runtime.jsx)(react.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(emotion_element_c39617d8_browser_esm.C,{value:cache,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Slection,{contextMenus:contextMenus,tranboxSetting:tranboxSetting,transApis:transApis})})}));}/** * 监听来自iframe页面消息 * @param {*} rule */function windowListener(rule){window.addEventListener("message",function(e){var _ref5=e.data||{},action=_ref5.action;switch(action){case MSG_TRANS_GETRULE:sendIframeMsg(MSG_TRANS_PUTRULE,rule);break;default:}});}/** @@ -34917,14 +34926,14 @@ var script=document.createElement("script");script.textContent="(".concat(inject * @returns */function touchOperation(translator){var _translator$setting$t=translator.setting.touchTranslate,touchTranslate=_translator$setting$t===void 0?2:_translator$setting$t;if(touchTranslate===0){return;}var handleTap=debounce(function(){translator.toggle();sendIframeMsg(MSG_TRANS_TOGGLE);});touchTapListener(handleTap,touchTranslate);}/** * 入口函数 - */function common_run(){return _run.apply(this,arguments);}function _run(){_run=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee3(){var isUserscript,href,setting,rule,translator,_args3=arguments;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:isUserscript=_args3.length>0&&_args3[0]!==undefined?_args3[0]:false;_context3.prev=1;href=document.location.href;// 设置页面 -if(!(isUserscript&&(href.includes("http://localhost:3000/options.html")||href.includes("https://fishjar.github.io/kiss-translator/options.html")||href.includes("https://kiss-translator.rayjar.com/options")))){_context3.next=6;break;}runSettingPage();return _context3.abrupt("return");case 6:_context3.next=8;return getSettingWithDefault();case 8:setting=_context3.sent;if(!isInBlacklist(href,setting)){_context3.next=11;break;}return _context3.abrupt("return");case 11:if(!isIframe){_context3.next=14;break;}runIframe(setting);return _context3.abrupt("return");case 14:_context3.next=16;return runWebfix(setting);case 16:_context3.next=18;return matchRule(href,setting);case 18:rule=_context3.sent;translator=new Translator(rule,setting);// 监听消息 + */function common_run(){return _run.apply(this,arguments);}function _run(){_run=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee3(){var isUserscript,href,setting,fixerSetting,rule,translator,_args3=arguments;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:isUserscript=_args3.length>0&&_args3[0]!==undefined?_args3[0]:false;_context3.prev=1;href=document.location.href;// 设置页面 +if(!(isUserscript&&(href.includes("http://localhost:3000/options.html")||href.includes("https://fishjar.github.io/kiss-translator/options.html")||href.includes("https://kiss-translator.rayjar.com/options")))){_context3.next=6;break;}runSettingPage();return _context3.abrupt("return");case 6:_context3.next=8;return getSettingWithDefault();case 8:setting=_context3.sent;if(!isInBlacklist(href,setting)){_context3.next=11;break;}return _context3.abrupt("return");case 11:if(!isIframe){_context3.next=14;break;}runIframe(setting);return _context3.abrupt("return");case 14:_context3.next=16;return matchFixer(href,setting);case 16:fixerSetting=_context3.sent;_context3.next=19;return matchRule(href,setting);case 19:rule=_context3.sent;translator=new Translator(rule,setting,fixerSetting);// 监听消息 windowListener(rule);!isUserscript&&runtimeListener(translator);// 输入框翻译 inputTranslate(setting);// 划词翻译 showTransbox(setting);// 浮球按钮 -_context3.next=26;return showFab(translator);case 26:// 触屏操作 +_context3.next=27;return showFab(translator);case 27:// 触屏操作 touchOperation(translator);// 同步订阅规则 -_context3.t0=isUserscript;if(!_context3.t0){_context3.next=31;break;}_context3.next=31;return trySyncAllSubRules(setting);case 31:_context3.next=37;break;case 33:_context3.prev=33;_context3.t1=_context3["catch"](1);console.error("[KISS-Translator]",_context3.t1);showErr(_context3.t1.message);case 37:case"end":return _context3.stop();}},_callee3,null,[[1,33]]);}));return _run.apply(this,arguments);} +_context3.t0=isUserscript;if(!_context3.t0){_context3.next=32;break;}_context3.next=32;return trySyncAllSubRules(setting);case 32:_context3.next=38;break;case 34:_context3.prev=34;_context3.t1=_context3["catch"](1);console.error("[KISS-Translator]",_context3.t1);showErr(_context3.t1.message);case 38:case"end":return _context3.stop();}},_callee3,null,[[1,34]]);}));return _run.apply(this,arguments);} ;// CONCATENATED MODULE: ./src/userscript.js common_run(true); }(); diff --git a/kiss-translator-rules.json b/kiss-translator-rules.json index 24d088d8..aee3d521 100644 --- a/kiss-translator-rules.json +++ b/kiss-translator-rules.json @@ -2,6 +2,7 @@ { "pattern": "app.slack.com/client/", "selector": ".p-rich_text_section, .c-message_attachment__text, .p-rich_text_list li", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -13,6 +14,7 @@ { "pattern": "bard.google.com", "selector": ".query-content :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), message-content :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -24,6 +26,7 @@ { "pattern": "bearblog.dev, www.theverge.com, www.tampermonkey.net/documentation.php", "selector": ":is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -35,6 +38,7 @@ { "pattern": "blogs.windows.com", "selector": ":is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), .c-uhf-nav-link, figcaption", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -46,6 +50,7 @@ { "pattern": "chat.openai.com", "selector": "div[data-message-author-role] > div :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -57,6 +62,7 @@ { "pattern": "chromereleases.googleblog.com", "selector": ".title, .publishdate, p, i, .header-desc, .header-title, .text", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -68,6 +74,7 @@ { "pattern": "deno.land, docs.github.com", "selector": "main :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "code, img, svg", "translator": "*", "fromLang": "*", "toLang": "*", @@ -79,6 +86,7 @@ { "pattern": "developer.apple.com/documentation/", "selector": "#main :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), #main .abstract .content, #main .abstract.content, #main .link span", + "keepSelector": "code, img, svg", "translator": "*", "fromLang": "*", "toLang": "*", @@ -89,7 +97,8 @@ }, { "pattern": "discord.com/channels/", - "selector": "div[id^=message-content]", + "selector": "li[id^=chat-messages] div[id^=message-content], div[class^=headerText], div[class^=name_], section[aria-label='Search Results'] div[id^=message-content]", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -101,6 +110,19 @@ { "pattern": "doc.rust-lang.org", "selector": ".content :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "code, img, svg", + "translator": "*", + "fromLang": "*", + "toLang": "*", + "textStyle": "*", + "transOpen": "*", + "bgColor": "", + "textDiyStyle": "" + }, + { + "pattern": "docs.arduino.cc", + "selector": "[class^=\"tutorial-module--left\"] :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -112,6 +134,7 @@ { "pattern": "edition.cnn.com", "selector": ".container__title, .container__headline, .headline__text, .image__caption, [data-type=\"Title\"], .article__content :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -123,6 +146,7 @@ { "pattern": "education.github.com", "selector": ":is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), a, summary, span.Button-content", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -134,6 +158,19 @@ { "pattern": "en.wikipedia.org", "selector": "h1, .mw-parser-output :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": ".mwe-math-element", + "translator": "*", + "fromLang": "*", + "toLang": "*", + "textStyle": "*", + "transOpen": "*", + "bgColor": "", + "textDiyStyle": "" + }, + { + "pattern": "forum.arduino.cc", + "selector": ".top-row>.title, .featured-topic>.title, .link-top-line>.title, .category-description, .topic-excerpt, .fancy-title, .cooked :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -144,7 +181,8 @@ }, { "pattern": "forum.ru-board.com", - "selector": ".tit, .dats, span.post :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "selector": ".tit, .dats, span.post, .lgf :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -156,6 +194,19 @@ { "pattern": "github.com", "selector": ".markdown-body :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), .repo-description p, .Layout-sidebar .f4, .container-lg .py-4 .f5, .container-lg .my-4 .f5, .Box-row .pr-4, .Box-row article .mt-1, [itemprop=\"description\"], .markdown-title, bdi, .ws-pre-wrap, .status-meta, span.status-meta, .col-10.color-fg-muted, .TimelineItem-body, .pinned-item-list-item-content .color-fg-muted, .markdown-body td, .markdown-body th", + "keepSelector": "code, img, svg", + "translator": "*", + "fromLang": "*", + "toLang": "*", + "textStyle": "*", + "transOpen": "*", + "bgColor": "", + "textDiyStyle": "" + }, + { + "pattern": "greasyfork.org", + "selector": "h2, .script-link, .script-description, #additional-info :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -167,6 +218,7 @@ { "pattern": "m.youtube.com", "selector": ".slim-video-information-title .yt-core-attributed-string, .media-item-headline .yt-core-attributed-string, .comment-text .yt-core-attributed-string, .typography-body-2b .yt-core-attributed-string, #ytp-caption-window-container .ytp-caption-segment", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -178,6 +230,7 @@ { "pattern": "mail.google.com", "selector": ":is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), h2[data-thread-perm-id], span[data-thread-id], div[data-message-id] div[class=''], .messageBody, #views", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -189,6 +242,7 @@ { "pattern": "news.google.com", "selector": "[role=\"link\"], .DY5T1d, .ifw3f, :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -200,6 +254,7 @@ { "pattern": "news.ycombinator.com", "selector": ".title, .commtext", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -211,6 +266,7 @@ { "pattern": "platform.openai.com/docs", "selector": ".docs-body :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "code, img, svg", "translator": "*", "fromLang": "*", "toLang": "*", @@ -222,6 +278,7 @@ { "pattern": "restofworld.org", "selector": ":is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), .recirc-story__headline, .recirc-story__dek", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -233,6 +290,7 @@ { "pattern": "stackoverflow.com", "selector": "h1, .s-prose p, .comment-body .comment-copy", + "keepSelector": "code, img, svg", "translator": "*", "fromLang": "*", "toLang": "*", @@ -244,6 +302,7 @@ { "pattern": "t.me/s/", "selector": ".js-message_text :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -255,6 +314,7 @@ { "pattern": "themessenger.com", "selector": ".leading-tight, .leading-tighter, .my-2 p, .font-body p, article :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -266,6 +326,7 @@ { "pattern": "time.com", "selector": "h1, h3, .summary, .video-title, #article-body :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), .image-wrap-container .credit.body-caption, .media-heading", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -276,7 +337,8 @@ }, { "pattern": "twitter.com", - "selector": "[data-testid=\"tweetText\"]", + "selector": "[data-testid=\"tweetText\"], [data-testid=\"birdwatch-pivot\"]>div.css-1rynq56", + "keepSelector": "img, a, .r-18u37iz, .css-175oi2r", "translator": "*", "fromLang": "*", "toLang": "*", @@ -288,6 +350,7 @@ { "pattern": "web.telegram.org/a/", "selector": ".message, .text-content, .bot-commands-list-element-description, .reply-markup-button-text", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -299,6 +362,7 @@ { "pattern": "web.telegram.org/k/", "selector": ".message, .bot-commands-list-element-description, .reply-markup-button-text", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -310,6 +374,7 @@ { "pattern": "web.whatsapp.com", "selector": ".copyable-text > span", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -321,6 +386,7 @@ { "pattern": "www.axios.com", "selector": ".h7, :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -331,7 +397,8 @@ }, { "pattern": "www.bbc.com", - "selector": "h1, h2, .media__link, .media__summary, article :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), .ssrcss-y7krbn-Stack, .ssrcss-17zglt8-PromoHeadline, .ssrcss-18cjaf3-Headline, .gs-c-promo-heading__title, .gs-c-promo-summary, .media__content h3, .article__intro", + "selector": "h1, h2, .media__link, .media__summary, article :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), .ssrcss-y7krbn-Stack, .ssrcss-17zglt8-PromoHeadline, .ssrcss-18cjaf3-Headline, .gs-c-promo-heading__title, .gs-c-promo-summary, .media__content h3, .article__intro, .lx-c-summary-points>li", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -343,6 +410,7 @@ { "pattern": "www.bing.com", "selector": ".b_algoSlug, .rwrl_padref; .cib-serp-main >>> .ac-textBlock :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), .text-message-content div", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -354,6 +422,7 @@ { "pattern": "www.bloomberg.com", "selector": "[data-component=\"headline\"], [data-component=\"related-item-headline\"], [data-component=\"title\"], article :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -365,6 +434,7 @@ { "pattern": "www.chinadaily.com.cn", "selector": "h1, .tMain [shape=\"rect\"], .cMain [shape=\"rect\"], .photo_art [shape=\"rect\"], .mai_r [shape=\"rect\"], .lisBox li, #Content :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -376,6 +446,7 @@ { "pattern": "www.dw.com", "selector": ".ts-teaser-title a, .news-title a, .title a, .teaser-description a, .hbudab h3, .hbudab p, figcaption ,article :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -387,6 +458,19 @@ { "pattern": "www.facebook.com", "selector": "[role=\"main\"] [dir=\"auto\"]", + "keepSelector": "", + "translator": "*", + "fromLang": "*", + "toLang": "*", + "textStyle": "*", + "transOpen": "*", + "bgColor": "", + "textDiyStyle": "" + }, + { + "pattern": "www.fmkorea.com", + "selector": "#container :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -398,6 +482,7 @@ { "pattern": "www.foxnews.com", "selector": "h1, h2, .title, .sidebar [data-type=\"Title\"], .article-content :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote); [data-spotim-module=\"conversation\"]>div >>> [data-spot-im-class=\"message-text\"] p, [data-spot-im-class=\"message-text\"]", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -409,6 +494,19 @@ { "pattern": "www.google.com/search", "selector": "h3, .IsZvec, .VwiC3b", + "keepSelector": "", + "translator": "*", + "fromLang": "*", + "toLang": "*", + "textStyle": "*", + "transOpen": "*", + "bgColor": "", + "textDiyStyle": "" + }, + { + "pattern": "www.historydefined.net", + "selector": ".wp-element-caption, :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -420,6 +518,7 @@ { "pattern": "www.indiehackers.com", "selector": "h1, h3, .content :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), .feed-item__title-link", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -431,6 +530,7 @@ { "pattern": "www.instagram.com/", "selector": "h1, article span[dir=auto] > span[dir=auto], ._ab1y", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -442,6 +542,7 @@ { "pattern": "www.instagram.com/p/,www.instagram.com/reels/", "selector": "h1, div[class='x9f619 xjbqb8w x78zum5 x168nmei x13lgxp2 x5pf9jr xo71vjh x1uhb9sk x1plvlek xryxfnj x1c4vz4f x2lah0s xdt5ytf xqjyukv x1cy8zhl x1oa3qoh x1nhvcw1'] > span[class='x1lliihq x1plvlek xryxfnj x1n2onr6 x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs x1s928wv xhkezso x1gmr53x x1cpjm7i x1fgarty x1943h6x x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj'], span[class='x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs xt0psk2 x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj']", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -452,7 +553,8 @@ }, { "pattern": "www.newyorker.com", - "selector": ".summary-item__hed, .summary-item__dek, .summary-collection-grid__dek, .dqtvfu, .rubric__link, .caption, article :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), .HEhan :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), .ContributorBioBio-fBolsO", + "selector": ".summary-item__hed, .summary-item__dek, .summary-collection-grid__dek, .dqtvfu, .rubric__link, .caption, article :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), .HEhan :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), .ContributorBioBio-fBolsO, .BaseText-ewhhUZ", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -464,6 +566,7 @@ { "pattern": "www.noemamag.com", "selector": ".splash__title, .single-card__title, .single-card__type, .single-card__topic, .highlighted-content__title, .single-card__author, article :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), .quote__text, .wp-caption-text div", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -475,6 +578,7 @@ { "pattern": "www.npmjs.com/package, developer.chrome.com/docs, medium.com, developers.cloudflare.com, react.dev, create-react-app.dev, pytorch.org", "selector": "article :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -486,6 +590,7 @@ { "pattern": "www.phoronix.com", "selector": "article :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -497,6 +602,7 @@ { "pattern": "www.quora.com", "selector": ".qu-wordBreak--break-word", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -507,7 +613,8 @@ }, { "pattern": "www.reddit.com", - "selector": "[slot=\"title\"], [slot=\"text-body\"] :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), #-post-rtjson-content p", + "selector": "div:is(.tbIApBd2DM_drfZQJjIum, ._1zPvgKHteTOub9dKkvrOl4,.ULWj94BYSOqoJDetxgcnU),a:is([class^=\"_334yl59\"],[class^=\"_2GrMpxD\"]),h1,h2,h3,h4,h5,h6,p,button", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -519,6 +626,7 @@ { "pattern": "www.reuters.com", "selector": "#main-content [data-testid=\"Heading\"], #main-content [data-testid=\"Body\"], .article-body__content__17Yit :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -530,6 +638,7 @@ { "pattern": "www.semafor.com", "selector": ":is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), .styles_intro__IYj__, [class*=\"styles_description\"]", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -541,6 +650,7 @@ { "pattern": "www.telegraph.co.uk, go.dev/doc/", "selector": "article :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -552,6 +662,7 @@ { "pattern": "www.theguardian.com", "selector": ".show-underline, .dcr-hup5wm div, .dcr-7vl6y8 div, .dcr-12evv1c, figcaption, article :is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote), [data-cy=\"mostviewed-footer\"] h4", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -563,6 +674,7 @@ { "pattern": "www.youtube.com", "selector": "h1, #video-title, #content-text, #title, yt-attributed-string>span>span, #ytp-caption-window-container .ytp-caption-segment", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", @@ -574,6 +686,7 @@ { "pattern": "wx2.qq.com", "selector": ".js_message_plain", + "keepSelector": "", "translator": "*", "fromLang": "*", "toLang": "*", diff --git a/kiss-translator.user.js b/kiss-translator.user.js index 2c51406f..2717169b 100644 --- a/kiss-translator.user.js +++ b/kiss-translator.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name KISS Translator // @namespace https://github.com/fishjar/kiss-translator -// @version 1.7.15 +// @version 1.7.16 // @description A simple bilingual translation extension & Greasemonkey script (一个简约的双语对照翻译扩展 & 油猴脚本) // @author Gabe // @homepageURL https://github.com/fishjar/kiss-translator @@ -19479,11 +19479,11 @@ function CssBaseline(inProps) { false ? 0 : void 0; /* harmony default export */ var CssBaseline_CssBaseline = (CssBaseline); ;// CONCATENATED MODULE: ./src/config/rules.js -var DEFAULT_SELECTOR=":is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)";var GLOBAL_KEY="*";var REMAIN_KEY="-";var SHADOW_KEY=">>>";var DEFAULT_RULE={pattern:"",selector:"",translator:GLOBAL_KEY,fromLang:GLOBAL_KEY,toLang:GLOBAL_KEY,textStyle:GLOBAL_KEY,transOpen:GLOBAL_KEY,bgColor:"",textDiyStyle:""};var DEFAULT_DIY_STYLE="color: #666;\nbackground: linear-gradient(\n 45deg,\n LightGreen 20%,\n LightPink 20% 40%,\n LightSalmon 40% 60%,\n LightSeaGreen 60% 80%,\n LightSkyBlue 80%\n);\n&:hover {\n color: #333;\n};";var DEFAULT_OW_RULE={translator:REMAIN_KEY,fromLang:REMAIN_KEY,toLang:REMAIN_KEY,textStyle:REMAIN_KEY,transOpen:REMAIN_KEY,bgColor:"",textDiyStyle:DEFAULT_DIY_STYLE};var RULES_MAP={"www.google.com/search":"h3, .IsZvec, .VwiC3b","news.google.com":"[role=\"link\"], .DY5T1d, .ifw3f, ".concat(DEFAULT_SELECTOR),"www.foxnews.com":"h1, h2, .title, .sidebar [data-type=\"Title\"], .article-content ".concat(DEFAULT_SELECTOR,"; [data-spotim-module=\"conversation\"]>div >>> [data-spot-im-class=\"message-text\"] p, [data-spot-im-class=\"message-text\"]"),"bearblog.dev, www.theverge.com, www.tampermonkey.net/documentation.php":"".concat(DEFAULT_SELECTOR),"themessenger.com":".leading-tight, .leading-tighter, .my-2 p, .font-body p, article ".concat(DEFAULT_SELECTOR),"www.telegraph.co.uk, go.dev/doc/":"article ".concat(DEFAULT_SELECTOR),"www.theguardian.com":".show-underline, .dcr-hup5wm div, .dcr-7vl6y8 div, .dcr-12evv1c, figcaption, article ".concat(DEFAULT_SELECTOR,", [data-cy=\"mostviewed-footer\"] h4"),"www.semafor.com":"".concat(DEFAULT_SELECTOR,", .styles_intro__IYj__, [class*=\"styles_description\"]"),"www.noemamag.com":".splash__title, .single-card__title, .single-card__type, .single-card__topic, .highlighted-content__title, .single-card__author, article ".concat(DEFAULT_SELECTOR,", .quote__text, .wp-caption-text div"),"restofworld.org":"".concat(DEFAULT_SELECTOR,", .recirc-story__headline, .recirc-story__dek"),"www.axios.com":".h7, ".concat(DEFAULT_SELECTOR),"www.newyorker.com":".summary-item__hed, .summary-item__dek, .summary-collection-grid__dek, .dqtvfu, .rubric__link, .caption, article ".concat(DEFAULT_SELECTOR,", .HEhan ").concat(DEFAULT_SELECTOR,", .ContributorBioBio-fBolsO"),"time.com":"h1, h3, .summary, .video-title, #article-body ".concat(DEFAULT_SELECTOR,", .image-wrap-container .credit.body-caption, .media-heading"),"www.dw.com":".ts-teaser-title a, .news-title a, .title a, .teaser-description a, .hbudab h3, .hbudab p, figcaption ,article ".concat(DEFAULT_SELECTOR),"www.bbc.com":"h1, h2, .media__link, .media__summary, article ".concat(DEFAULT_SELECTOR,", .ssrcss-y7krbn-Stack, .ssrcss-17zglt8-PromoHeadline, .ssrcss-18cjaf3-Headline, .gs-c-promo-heading__title, .gs-c-promo-summary, .media__content h3, .article__intro"),"www.chinadaily.com.cn":"h1, .tMain [shape=\"rect\"], .cMain [shape=\"rect\"], .photo_art [shape=\"rect\"], .mai_r [shape=\"rect\"], .lisBox li, #Content ".concat(DEFAULT_SELECTOR),"www.facebook.com":"[role=\"main\"] [dir=\"auto\"]","www.reddit.com":"[slot=\"title\"], [slot=\"text-body\"] ".concat(DEFAULT_SELECTOR,", #-post-rtjson-content p"),"www.quora.com":".qu-wordBreak--break-word","edition.cnn.com":".container__title, .container__headline, .headline__text, .image__caption, [data-type=\"Title\"], .article__content ".concat(DEFAULT_SELECTOR),"www.reuters.com":"#main-content [data-testid=\"Heading\"], #main-content [data-testid=\"Body\"], .article-body__content__17Yit ".concat(DEFAULT_SELECTOR),"www.bloomberg.com":"[data-component=\"headline\"], [data-component=\"related-item-headline\"], [data-component=\"title\"], article ".concat(DEFAULT_SELECTOR),"deno.land, docs.github.com":"main ".concat(DEFAULT_SELECTOR),"doc.rust-lang.org":".content ".concat(DEFAULT_SELECTOR),"www.indiehackers.com":"h1, h3, .content ".concat(DEFAULT_SELECTOR,", .feed-item__title-link"),"platform.openai.com/docs":".docs-body ".concat(DEFAULT_SELECTOR),"en.wikipedia.org":"h1, .mw-parser-output ".concat(DEFAULT_SELECTOR),"stackoverflow.com":"h1, .s-prose p, .comment-body .comment-copy","www.npmjs.com/package, developer.chrome.com/docs, medium.com, developers.cloudflare.com, react.dev, create-react-app.dev, pytorch.org":"article ".concat(DEFAULT_SELECTOR),"news.ycombinator.com":".title, .commtext","github.com":".markdown-body ".concat(DEFAULT_SELECTOR,", .repo-description p, .Layout-sidebar .f4, .container-lg .py-4 .f5, .container-lg .my-4 .f5, .Box-row .pr-4, .Box-row article .mt-1, [itemprop=\"description\"], .markdown-title, bdi, .ws-pre-wrap, .status-meta, span.status-meta, .col-10.color-fg-muted, .TimelineItem-body, .pinned-item-list-item-content .color-fg-muted, .markdown-body td, .markdown-body th"),"twitter.com":"[data-testid=\"tweetText\"]","m.youtube.com":".slim-video-information-title .yt-core-attributed-string, .media-item-headline .yt-core-attributed-string, .comment-text .yt-core-attributed-string, .typography-body-2b .yt-core-attributed-string, #ytp-caption-window-container .ytp-caption-segment","www.youtube.com":"h1, #video-title, #content-text, #title, yt-attributed-string>span>span, #ytp-caption-window-container .ytp-caption-segment","bard.google.com":".query-content ".concat(DEFAULT_SELECTOR,", message-content ").concat(DEFAULT_SELECTOR),"www.bing.com":".b_algoSlug, .rwrl_padref; .cib-serp-main >>> .ac-textBlock ".concat(DEFAULT_SELECTOR,", .text-message-content div"),"www.phoronix.com":"article ".concat(DEFAULT_SELECTOR),"wx2.qq.com":".js_message_plain","app.slack.com/client/":".p-rich_text_section, .c-message_attachment__text, .p-rich_text_list li","discord.com/channels/":"div[id^=message-content]","t.me/s/":".js-message_text ".concat(DEFAULT_SELECTOR),"web.telegram.org/k/":".message, .bot-commands-list-element-description, .reply-markup-button-text","web.telegram.org/a/":".message, .text-content, .bot-commands-list-element-description, .reply-markup-button-text","chromereleases.googleblog.com":".title, .publishdate, p, i, .header-desc, .header-title, .text","www.instagram.com/":"h1, article span[dir=auto] > span[dir=auto], ._ab1y","www.instagram.com/p/,www.instagram.com/reels/":"h1, div[class='x9f619 xjbqb8w x78zum5 x168nmei x13lgxp2 x5pf9jr xo71vjh x1uhb9sk x1plvlek xryxfnj x1c4vz4f x2lah0s xdt5ytf xqjyukv x1cy8zhl x1oa3qoh x1nhvcw1'] > span[class='x1lliihq x1plvlek xryxfnj x1n2onr6 x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs x1s928wv xhkezso x1gmr53x x1cpjm7i x1fgarty x1943h6x x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj'], span[class='x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs xt0psk2 x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj']","mail.google.com":"".concat(DEFAULT_SELECTOR,", h2[data-thread-perm-id], span[data-thread-id], div[data-message-id] div[class=''], .messageBody, #views"),"web.whatsapp.com":".copyable-text > span","chat.openai.com":"div[data-message-author-role] > div ".concat(DEFAULT_SELECTOR),"forum.ru-board.com":".tit, .dats, span.post ".concat(DEFAULT_SELECTOR),"education.github.com":"".concat(DEFAULT_SELECTOR,", a, summary, span.Button-content"),"blogs.windows.com":"".concat(DEFAULT_SELECTOR,", .c-uhf-nav-link, figcaption"),"developer.apple.com/documentation/":"#main ".concat(DEFAULT_SELECTOR,", #main .abstract .content, #main .abstract.content, #main .link span")};var rules_BUILTIN_RULES=Object.entries(RULES_MAP).sort(function(a,b){return a[0].localeCompare(b[0]);}).map(function(_ref){var _ref2=(0,slicedToArray/* default */.Z)(_ref,2),pattern=_ref2[0],selector=_ref2[1];return _objectSpread2(_objectSpread2({},DEFAULT_RULE),{},{pattern:pattern,selector:selector});}); +var DEFAULT_SELECTOR=":is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)";var DEFAULT_KEEP_SELECTOR="code, img, svg";var GLOBAL_KEY="*";var REMAIN_KEY="-";var SHADOW_KEY=">>>";var DEFAULT_RULE={pattern:"",selector:"",keepSelector:"",translator:GLOBAL_KEY,fromLang:GLOBAL_KEY,toLang:GLOBAL_KEY,textStyle:GLOBAL_KEY,transOpen:GLOBAL_KEY,bgColor:"",textDiyStyle:""};var DEFAULT_DIY_STYLE="color: #666;\nbackground: linear-gradient(\n 45deg,\n LightGreen 20%,\n LightPink 20% 40%,\n LightSalmon 40% 60%,\n LightSeaGreen 60% 80%,\n LightSkyBlue 80%\n);\n&:hover {\n color: #333;\n};";var DEFAULT_OW_RULE={translator:REMAIN_KEY,fromLang:REMAIN_KEY,toLang:REMAIN_KEY,textStyle:REMAIN_KEY,transOpen:REMAIN_KEY,bgColor:"",textDiyStyle:DEFAULT_DIY_STYLE};var RULES_MAP={"www.google.com/search":["h3, .IsZvec, .VwiC3b"],"news.google.com":["[role=\"link\"], .DY5T1d, .ifw3f, ".concat(DEFAULT_SELECTOR)],"www.foxnews.com":["h1, h2, .title, .sidebar [data-type=\"Title\"], .article-content ".concat(DEFAULT_SELECTOR,"; [data-spotim-module=\"conversation\"]>div >>> [data-spot-im-class=\"message-text\"] p, [data-spot-im-class=\"message-text\"]")],"bearblog.dev, www.theverge.com, www.tampermonkey.net/documentation.php":["".concat(DEFAULT_SELECTOR)],"themessenger.com":[".leading-tight, .leading-tighter, .my-2 p, .font-body p, article ".concat(DEFAULT_SELECTOR)],"www.telegraph.co.uk, go.dev/doc/":["article ".concat(DEFAULT_SELECTOR)],"www.theguardian.com":[".show-underline, .dcr-hup5wm div, .dcr-7vl6y8 div, .dcr-12evv1c, figcaption, article ".concat(DEFAULT_SELECTOR,", [data-cy=\"mostviewed-footer\"] h4")],"www.semafor.com":["".concat(DEFAULT_SELECTOR,", .styles_intro__IYj__, [class*=\"styles_description\"]")],"www.noemamag.com":[".splash__title, .single-card__title, .single-card__type, .single-card__topic, .highlighted-content__title, .single-card__author, article ".concat(DEFAULT_SELECTOR,", .quote__text, .wp-caption-text div")],"restofworld.org":["".concat(DEFAULT_SELECTOR,", .recirc-story__headline, .recirc-story__dek")],"www.axios.com":[".h7, ".concat(DEFAULT_SELECTOR)],"www.newyorker.com":[".summary-item__hed, .summary-item__dek, .summary-collection-grid__dek, .dqtvfu, .rubric__link, .caption, article ".concat(DEFAULT_SELECTOR,", .HEhan ").concat(DEFAULT_SELECTOR,", .ContributorBioBio-fBolsO, .BaseText-ewhhUZ")],"time.com":["h1, h3, .summary, .video-title, #article-body ".concat(DEFAULT_SELECTOR,", .image-wrap-container .credit.body-caption, .media-heading")],"www.dw.com":[".ts-teaser-title a, .news-title a, .title a, .teaser-description a, .hbudab h3, .hbudab p, figcaption ,article ".concat(DEFAULT_SELECTOR)],"www.bbc.com":["h1, h2, .media__link, .media__summary, article ".concat(DEFAULT_SELECTOR,", .ssrcss-y7krbn-Stack, .ssrcss-17zglt8-PromoHeadline, .ssrcss-18cjaf3-Headline, .gs-c-promo-heading__title, .gs-c-promo-summary, .media__content h3, .article__intro, .lx-c-summary-points>li")],"www.chinadaily.com.cn":["h1, .tMain [shape=\"rect\"], .cMain [shape=\"rect\"], .photo_art [shape=\"rect\"], .mai_r [shape=\"rect\"], .lisBox li, #Content ".concat(DEFAULT_SELECTOR)],"www.facebook.com":["[role=\"main\"] [dir=\"auto\"]"],"www.reddit.com":["div:is(.tbIApBd2DM_drfZQJjIum, ._1zPvgKHteTOub9dKkvrOl4,.ULWj94BYSOqoJDetxgcnU),a:is([class^=\"_334yl59\"],[class^=\"_2GrMpxD\"]),h1,h2,h3,h4,h5,h6,p,button"],"www.quora.com":[".qu-wordBreak--break-word"],"edition.cnn.com":[".container__title, .container__headline, .headline__text, .image__caption, [data-type=\"Title\"], .article__content ".concat(DEFAULT_SELECTOR)],"www.reuters.com":["#main-content [data-testid=\"Heading\"], #main-content [data-testid=\"Body\"], .article-body__content__17Yit ".concat(DEFAULT_SELECTOR)],"www.bloomberg.com":["[data-component=\"headline\"], [data-component=\"related-item-headline\"], [data-component=\"title\"], article ".concat(DEFAULT_SELECTOR)],"deno.land, docs.github.com":["main ".concat(DEFAULT_SELECTOR),"code, img, svg"],"doc.rust-lang.org":[".content ".concat(DEFAULT_SELECTOR),"code, img, svg"],"www.indiehackers.com":["h1, h3, .content ".concat(DEFAULT_SELECTOR,", .feed-item__title-link")],"platform.openai.com/docs":[".docs-body ".concat(DEFAULT_SELECTOR),"code, img, svg"],"en.wikipedia.org":["h1, .mw-parser-output ".concat(DEFAULT_SELECTOR),".mwe-math-element"],"stackoverflow.com":["h1, .s-prose p, .comment-body .comment-copy","code, img, svg"],"www.npmjs.com/package, developer.chrome.com/docs, medium.com, developers.cloudflare.com, react.dev, create-react-app.dev, pytorch.org":["article ".concat(DEFAULT_SELECTOR)],"news.ycombinator.com":[".title, .commtext"],"github.com":[".markdown-body ".concat(DEFAULT_SELECTOR,", .repo-description p, .Layout-sidebar .f4, .container-lg .py-4 .f5, .container-lg .my-4 .f5, .Box-row .pr-4, .Box-row article .mt-1, [itemprop=\"description\"], .markdown-title, bdi, .ws-pre-wrap, .status-meta, span.status-meta, .col-10.color-fg-muted, .TimelineItem-body, .pinned-item-list-item-content .color-fg-muted, .markdown-body td, .markdown-body th"),"code, img, svg"],"twitter.com":["[data-testid=\"tweetText\"], [data-testid=\"birdwatch-pivot\"]>div.css-1rynq56","img, a, .r-18u37iz, .css-175oi2r"],"m.youtube.com":[".slim-video-information-title .yt-core-attributed-string, .media-item-headline .yt-core-attributed-string, .comment-text .yt-core-attributed-string, .typography-body-2b .yt-core-attributed-string, #ytp-caption-window-container .ytp-caption-segment"],"www.youtube.com":["h1, #video-title, #content-text, #title, yt-attributed-string>span>span, #ytp-caption-window-container .ytp-caption-segment"],"bard.google.com":[".query-content ".concat(DEFAULT_SELECTOR,", message-content ").concat(DEFAULT_SELECTOR)],"www.bing.com":[".b_algoSlug, .rwrl_padref; .cib-serp-main >>> .ac-textBlock ".concat(DEFAULT_SELECTOR,", .text-message-content div")],"www.phoronix.com":["article ".concat(DEFAULT_SELECTOR)],"wx2.qq.com":[".js_message_plain"],"app.slack.com/client/":[".p-rich_text_section, .c-message_attachment__text, .p-rich_text_list li"],"discord.com/channels/":["li[id^=chat-messages] div[id^=message-content], div[class^=headerText], div[class^=name_], section[aria-label='Search Results'] div[id^=message-content]"],"t.me/s/":[".js-message_text ".concat(DEFAULT_SELECTOR)],"web.telegram.org/k/":[".message, .bot-commands-list-element-description, .reply-markup-button-text"],"web.telegram.org/a/":[".message, .text-content, .bot-commands-list-element-description, .reply-markup-button-text"],"chromereleases.googleblog.com":[".title, .publishdate, p, i, .header-desc, .header-title, .text"],"www.instagram.com/":["h1, article span[dir=auto] > span[dir=auto], ._ab1y"],"www.instagram.com/p/,www.instagram.com/reels/":["h1, div[class='x9f619 xjbqb8w x78zum5 x168nmei x13lgxp2 x5pf9jr xo71vjh x1uhb9sk x1plvlek xryxfnj x1c4vz4f x2lah0s xdt5ytf xqjyukv x1cy8zhl x1oa3qoh x1nhvcw1'] > span[class='x1lliihq x1plvlek xryxfnj x1n2onr6 x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs x1s928wv xhkezso x1gmr53x x1cpjm7i x1fgarty x1943h6x x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj'], span[class='x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs xt0psk2 x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj']"],"mail.google.com":["".concat(DEFAULT_SELECTOR,", h2[data-thread-perm-id], span[data-thread-id], div[data-message-id] div[class=''], .messageBody, #views")],"web.whatsapp.com":[".copyable-text > span"],"chat.openai.com":["div[data-message-author-role] > div ".concat(DEFAULT_SELECTOR)],"forum.ru-board.com":[".tit, .dats, span.post, .lgf ".concat(DEFAULT_SELECTOR)],"education.github.com":["".concat(DEFAULT_SELECTOR,", a, summary, span.Button-content")],"blogs.windows.com":["".concat(DEFAULT_SELECTOR,", .c-uhf-nav-link, figcaption")],"developer.apple.com/documentation/":["#main ".concat(DEFAULT_SELECTOR,", #main .abstract .content, #main .abstract.content, #main .link span"),"code, img, svg"],"greasyfork.org":["h2, .script-link, .script-description, #additional-info ".concat(DEFAULT_SELECTOR)],"www.fmkorea.com":["#container ".concat(DEFAULT_SELECTOR)],"forum.arduino.cc":[".top-row>.title, .featured-topic>.title, .link-top-line>.title, .category-description, .topic-excerpt, .fancy-title, .cooked ".concat(DEFAULT_SELECTOR)],"docs.arduino.cc":["[class^=\"tutorial-module--left\"] ".concat(DEFAULT_SELECTOR)],"www.historydefined.net":[".wp-element-caption, ".concat(DEFAULT_SELECTOR)]};var rules_BUILTIN_RULES=Object.entries(RULES_MAP).sort(function(a,b){return a[0].localeCompare(b[0]);}).map(function(_ref){var _ref2=(0,slicedToArray/* default */.Z)(_ref,2),pattern=_ref2[0],_ref2$=(0,slicedToArray/* default */.Z)(_ref2[1],2),selector=_ref2$[0],_ref2$$=_ref2$[1],keepSelector=_ref2$$===void 0?"":_ref2$$;return _objectSpread2(_objectSpread2({},DEFAULT_RULE),{},{pattern:pattern,selector:selector,keepSelector:keepSelector});}); ;// CONCATENATED MODULE: ./src/config/app.js var APP_NAME="KISS Translator".trim().split(/\s+/).join("-");var APP_LCNAME=APP_NAME.toLowerCase(); ;// CONCATENATED MODULE: ./src/config/i18n.js -var UI_LANGS=(/* unused pure expression or super */ null && ([["en","English"],["zh","中文"]]));var customApiLangs="[\"en\", \"English - English\"],\n[\"zh-CN\", \"Simplified Chinese - \u7B80\u4F53\u4E2D\u6587\"],\n[\"zh-TW\", \"Traditional Chinese - \u7E41\u9AD4\u4E2D\u6587\"],\n[\"ar\", \"Arabic - \u0627\u0644\u0639\u0631\u0628\u064A\u0629\"],\n[\"bg\", \"Bulgarian - \u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438\"],\n[\"ca\", \"Catalan - Catal\xE0\"],\n[\"hr\", \"Croatian - Hrvatski\"],\n[\"cs\", \"Czech - \u010Ce\u0161tina\"],\n[\"da\", \"Danish - Dansk\"],\n[\"nl\", \"Dutch - Nederlands\"],\n[\"fi\", \"Finnish - Suomi\"],\n[\"fr\", \"French - Fran\xE7ais\"],\n[\"de\", \"German - Deutsch\"],\n[\"el\", \"Greek - \u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC\"],\n[\"hi\", \"Hindi - \u0939\u093F\u0928\u094D\u0926\u0940\"],\n[\"hu\", \"Hungarian - Magyar\"],\n[\"id\", \"Indonesian - Indonesia\"],\n[\"it\", \"Italian - Italiano\"],\n[\"ja\", \"Japanese - \u65E5\u672C\u8A9E\"],\n[\"ko\", \"Korean - \uD55C\uAD6D\uC5B4\"],\n[\"ms\", \"Malay - Melayu\"],\n[\"mt\", \"Maltese - Malti\"],\n[\"nb\", \"Norwegian - Norsk Bokm\xE5l\"],\n[\"pl\", \"Polish - Polski\"],\n[\"pt\", \"Portuguese - Portugu\xEAs\"],\n[\"ro\", \"Romanian - Rom\xE2n\u0103\"],\n[\"ru\", \"Russian - \u0420\u0443\u0441\u0441\u043A\u0438\u0439\"],\n[\"sk\", \"Slovak - Sloven\u010Dina\"],\n[\"sl\", \"Slovenian - Sloven\u0161\u010Dina\"],\n[\"es\", \"Spanish - Espa\xF1ol\"],\n[\"sv\", \"Swedish - Svenska\"],\n[\"ta\", \"Tamil - \u0BA4\u0BAE\u0BBF\u0BB4\u0BCD\"],\n[\"te\", \"Telugu - \u0C24\u0C46\u0C32\u0C41\u0C17\u0C41\"],\n[\"th\", \"Thai - \u0E44\u0E17\u0E22\"],\n[\"tr\", \"Turkish - T\xFCrk\xE7e\"],\n[\"uk\", \"Ukrainian - \u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430\"],\n[\"vi\", \"Vietnamese - Ti\u1EBFng Vi\u1EC7t\"],\n";var customApiHelpZH="/// \u81EA\u5B9A\u4E49\u7FFB\u8BD1\u6E90\u63A5\u53E3\u8BF4\u660E\n\n// \u8BF7\u6C42\uFF08Request\uFF09\u6570\u636E\u5C06\u6309\u4E0B\u9762\u89C4\u8303\u53D1\u9001\n{\n url: {{YOUR_URL}},\n method: \"POST\",\n headers: {\n \"Content-type\": \"application/json\",\n \"Authorization\": \"Bearer {{YOUR_KEY}}\",\n },\n body: {\n text: \"\", // \u9700\u8981\u7FFB\u8BD1\u7684\u6587\u5B57\n from: \"\", // \u6E90\u8BED\u8A00\uFF0C\u53EF\u80FD\u4E3A\u7A7A\uFF0C\u8868\u793A\u9700\u8981\u63A5\u53E3\u81EA\u52A8\u8BC6\u522B\u8BED\u8A00\n to: \"\", // \u76EE\u6807\u8BED\u8A00\n }\n}\n\n// \u8FD4\u56DE\uFF08Response\uFF09\u6570\u636E\u9700\u7B26\u5408\u4E0B\u9762\u7684JSON\u89C4\u8303\n{\n text: \"\", // \u7FFB\u8BD1\u540E\u7684\u6587\u5B57\n from: \"\", // \u8BC6\u522B\u7684\u6E90\u8BED\u8A00\n to: \"\", // \u76EE\u6807\u8BED\u8A00\uFF08\u53EF\u9009\uFF09\n}\n\n// \u652F\u6301\u7684\u8BED\u8A00\u4EE3\u7801\u5982\u4E0B\n".concat(customApiLangs,"\n");var customApiHelpEN="/// Custom translation source interface description\n\n// Request data will be sent according to the following specifications\n{\n url: {{YOUR_URL}},\n method: \"POST\",\n headers: {\n \"Content-type\": \"application/json\",\n \"Authorization\": \"Bearer {{YOUR_KEY}}\",\n },\n body: {\n text: \"\", // text to be translated\n from: \"\", // Source language, may be empty\n to: \"\", // Target language\n }\n}\n\n// The returned data must conform to the following JSON specification\n{\n text: \"\", // translated text\n from: \"\", // Recognized source language\n to: \"\", // Target language (optional)\n}\n\n// The supported language codes are as follows\n".concat(customApiLangs,"\n");var I18N={app_name:{zh:"\u7B80\u7EA6\u7FFB\u8BD1",en:"KISS Translator"},translate:{zh:"\u7FFB\u8BD1",en:"Translate"},custom_api_help:{zh:customApiHelpZH,en:customApiHelpEN},translate_alt:{zh:"\u7FFB\u8BD1 (Alt+Q)",en:"Translate (Alt+Q)"},basic_setting:{zh:"\u57FA\u672C\u8BBE\u7F6E",en:"Basic Setting"},rules_setting:{zh:"\u89C4\u5219\u8BBE\u7F6E",en:"Rules Setting"},apis_setting:{zh:"\u63A5\u53E3\u8BBE\u7F6E",en:"Apis Setting"},sync_setting:{zh:"\u540C\u6B65\u8BBE\u7F6E",en:"Sync Setting"},patch_setting:{zh:"\u8865\u4E01\u8BBE\u7F6E",en:"Patch Setting"},patch_setting_help:{zh:"\u9488\u5BF9\u4E00\u4E9B\u7279\u6B8A\u7F51\u7AD9\u7684\u4FEE\u6B63\u811A\u672C\uFF0C\u4EE5\u4FBF\u7FFB\u8BD1\u8F6F\u4EF6\u5F97\u5230\u66F4\u597D\u7684\u5C55\u793A\u6548\u679C\u3002",en:"Corrected scripts for some special websites so that the translation software can get better display results."},inject_webfix:{zh:"\u6CE8\u5165\u4FEE\u590D\u8865\u4E01",en:"Inject Webfix"},about:{zh:"\u5173\u4E8E",en:"About"},about_md:{zh:"README.md",en:"README.en.md"},about_md_local:{zh:"\u8BF7 [\u70B9\u51FB\u8FD9\u91CC](".concat("https://github.com/fishjar/kiss-translator",") \u67E5\u770B\u8BE6\u60C5\u3002"),en:"Please [click here](".concat("https://github.com/fishjar/kiss-translator",") for details.")},ui_lang:{zh:"\u754C\u9762\u8BED\u8A00",en:"Interface Language"},fetch_limit:{zh:"\u6700\u5927\u8BF7\u6C42\u6570\u91CF (1-100)",en:"Maximum Number Of Request (1-100)"},fetch_interval:{zh:"\u8BF7\u6C42\u95F4\u9694\u65F6\u95F4 (0-5000ms)",en:"Request Interval (0-5000ms)"},min_translate_length:{zh:"\u6700\u5C0F\u7FFB\u8BD1\u957F\u5EA6 (1-100)",en:"Min Translate Length (1-100)"},max_translate_length:{zh:"\u6700\u5927\u7FFB\u8BD1\u957F\u5EA6 (100-10000)",en:"Max Translate Length (100-10000)"},num_of_newline_characters:{zh:"\u6362\u884C\u5B57\u7B26\u6570 (1-1000)",en:"Number of Newline Characters (1-1000)"},translate_service:{zh:"\u7FFB\u8BD1\u670D\u52A1",en:"Translate Service"},mouseover_translation:{zh:"\u9F20\u6807\u60AC\u505C\u7FFB\u8BD1",en:"Mouseover translation"},mk_disable:{zh:"\u7981\u7528",en:"Disable"},mk_mouseover:{zh:"\u9F20\u6807\u60AC\u505C",en:"Mouseover"},mk_ctrlKey:{zh:"Control + \u9F20\u6807\u60AC\u505C",en:"Control + Mouseover"},mk_shiftKey:{zh:"Shift + \u9F20\u6807\u60AC\u505C",en:"Shift + Mouseover"},mk_altKey:{zh:"Alt + \u9F20\u6807\u60AC\u505C",en:"Alt + Mouseover"},from_lang:{zh:"\u539F\u6587\u8BED\u8A00",en:"Source Language"},to_lang:{zh:"\u76EE\u6807\u8BED\u8A00",en:"Target Language"},to_lang2:{zh:"\u7B2C\u4E8C\u76EE\u6807\u8BED\u8A00",en:"Target Language 2"},to_lang2_helper:{zh:"\u8BBE\u5B9A\u540E\uFF0C\u4E0E\u76EE\u6807\u8BED\u8A00\u4EA7\u751F\u4E92\u8BD1\u6548\u679C\uFF0C\u4F46\u4F9D\u8D56\u8FDC\u7A0B\u8BED\u8A00\u8BC6\u522B\u3002",en:"After setting, it will produce mutual translation effect with the target language, but it relies on remote language recognition."},text_style:{zh:"\u6587\u5B57\u6837\u5F0F",en:"Text Style"},text_style_alt:{zh:"\u6587\u5B57\u6837\u5F0F (Alt+C)",en:"Text Style (Alt+C)"},bg_color:{zh:"\u6837\u5F0F\u989C\u8272",en:"Style Color"},remain_unchanged:{zh:"\u4FDD\u7559\u4E0D\u53D8",en:"Remain Unchanged"},google_api:{zh:"\u8C37\u6B4C\u7FFB\u8BD1\u63A5\u53E3",en:"Google Translate API"},default_selector:{zh:"\u9ED8\u8BA4\u9009\u62E9\u5668",en:"Default selector"},selector_rules:{zh:"\u9009\u62E9\u5668\u89C4\u5219",en:"Selector Rules"},save:{zh:"\u4FDD\u5B58",en:"Save"},edit:{zh:"\u7F16\u8F91",en:"Edit"},cancel:{zh:"\u53D6\u6D88",en:"Cancel"},delete:{zh:"\u5220\u9664",en:"Delete"},reset:{zh:"\u91CD\u7F6E",en:"Reset"},add:{zh:"\u6DFB\u52A0",en:"Add"},inject_rules:{zh:"\u6CE8\u5165\u8BA2\u9605\u89C4\u5219",en:"Inject Subscribe Rules"},personal_rules:{zh:"\u4E2A\u4EBA\u89C4\u5219",en:"Rules"},subscribe_rules:{zh:"\u8BA2\u9605\u89C4\u5219",en:"Subscribe"},overwrite_subscribe_rules:{zh:"\u8986\u5199\u8BA2\u9605\u89C4\u5219",en:"Overwrite"},subscribe_url:{zh:"\u8BA2\u9605\u5730\u5740",en:"Subscribe URL"},rules_warn_1:{zh:"1\u3001\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u4E00\u76F4\u751F\u6548\uFF0C\u9009\u62E9\u201C\u6CE8\u5165\u8BA2\u9605\u89C4\u5219\u201D\u540E\uFF0C\u201C\u8BA2\u9605\u89C4\u5219\u201D\u624D\u4F1A\u751F\u6548\u3002",en:"1. The \"Personal Rules\" are always in effect. After selecting \"Inject Subscription Rules\", the \"Subscription Rules\" will take effect."},rules_warn_2:{zh:"2\u3001\u201C\u8BA2\u9605\u89C4\u5219\u201D\u7684\u6CE8\u5165\u4F4D\u7F6E\u662F\u5012\u6570\u7B2C\u4E8C\u7684\u4F4D\u7F6E\uFF0C\u56E0\u6B64\u9664\u5168\u5C40\u89C4\u5219(*)\u5916\uFF0C\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u4F18\u5148\u7EA7\u6BD4\u201C\u8BA2\u9605\u89C4\u5219\u201D\u9AD8\uFF0C\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u586B\u5199\u540C\u6837\u7684\u7F51\u5740\u4F1A\u8986\u76D6\u201D\u8BA2\u9605\u89C4\u5219\u201C\u7684\u6761\u76EE\u3002",en:"2. The injection position of \"Subscription Rules\" is the penultimate position. Therefore, except for the global rules (*), the priority of \"Personal Rules\" is higher than that of \"Subscription Rules\". Filling in the same url in \"Personal Rules\" will overwrite \"Subscription Rules\" entry."},sync_warn:{zh:"\u5982\u679C\u670D\u52A1\u5668\u5B58\u5728\u5176\u4ED6\u5BA2\u6237\u7AEF\u540C\u6B65\u7684\u6570\u636E\uFF0C\u7B2C\u4E00\u6B21\u540C\u6B65\u5C06\u76F4\u63A5\u8986\u76D6\u672C\u5730\u914D\u7F6E\uFF0C\u540E\u9762\u5219\u6839\u636E\u4FEE\u6539\u65F6\u95F4\uFF0C\u65B0\u7684\u8986\u76D6\u65E7\u7684\u3002",en:"If the server has data synchronized by other clients, the first synchronization will directly overwrite the local configuration, and later, according to the modification time, the new one will overwrite the old one."},about_sync_api:{zh:"\u67E5\u770B\u5173\u4E8E\u6570\u636E\u540C\u6B65\u63A5\u53E3\u90E8\u7F72",en:"View About Data Synchronization Interface Deployment"},about_api_proxy:{zh:"\u67E5\u770B\u81EA\u5EFA\u4E00\u4E2A\u7FFB\u8BD1\u63A5\u53E3\u4EE3\u7406",en:"Check out the self-built translation interface proxy"},style_none:{zh:"\u65E0",en:"None"},under_line:{zh:"\u4E0B\u5212\u76F4\u7EBF",en:"Underline"},dot_line:{zh:"\u4E0B\u5212\u70B9\u72B6\u7EBF",en:"Dotted Underline"},dash_line:{zh:"\u4E0B\u5212\u865A\u7EBF",en:"Dashed Underline"},wavy_line:{zh:"\u4E0B\u5212\u6CE2\u6D6A\u7EBF",en:"Wavy Underline"},fuzzy:{zh:"\u6A21\u7CCA",en:"Fuzzy"},highlight:{zh:"\u9AD8\u4EAE",en:"Highlight"},blockquote:{zh:"\u5F15\u7528",en:"Blockquote"},diy_style:{zh:"\u81EA\u5B9A\u4E49\u6837\u5F0F",en:"Custom Style"},diy_style_helper:{zh:"\u9075\u5FAA\u201CCSS\u201D\u7684\u8BED\u6CD5",en:"Follow the syntax of \"CSS\""},setting:{zh:"\u8BBE\u7F6E (Alt+O)",en:"Setting (Alt+O)"},pattern:{zh:"\u5339\u914D\u7F51\u5740",en:"URL pattern"},pattern_helper:{zh:"1\u3001\u652F\u6301\u661F\u53F7(*)\u901A\u914D\u7B26\u30022\u3001\u591A\u4E2AURL\u7528\u82F1\u6587\u9017\u53F7\u201C,\u201D\u5206\u9694\u3002",en:"1. The asterisk (*) wildcard is supported. 2. Multiple URLs separated by English commas \",\"."},selector_helper:{zh:"1\u3001\u9075\u5FAACSS\u9009\u62E9\u5668\u8BED\u6CD5\u30022\u3001\u7559\u7A7A\u8868\u793A\u91C7\u7528\u5168\u5C40\u8BBE\u7F6E\u30023\u3001\u591A\u4E2ACSS\u9009\u62E9\u5668\u4E4B\u95F4\u7528\u201C;\u201D\u9694\u5F00\u30024\u3001\u201Cshadow root\u201D\u9009\u62E9\u5668\u548C\u5185\u90E8\u9009\u62E9\u5668\u7528\u201C>>>\u201D\u9694\u5F00\u3002",en:"1. Follow CSS selector syntax. 2. Leave blank to adopt the global setting. 3. Separate multiple CSS selectors with \";\". 4. The \"shadow root\" selector and the internal selector are separated by \">>>\"."},translate_switch:{zh:"\u5F00\u542F\u7FFB\u8BD1",en:"Translate Switch"},default_enabled:{zh:"\u9ED8\u8BA4\u5F00\u542F",en:"Enabled"},default_disabled:{zh:"\u9ED8\u8BA4\u5173\u95ED",en:"Disabled"},selector:{zh:"\u9009\u62E9\u5668",en:"Selector"},root_selector:{zh:"\u6839\u9009\u62E9\u5668",en:"Root Selector"},fixer_function:{zh:"\u4FEE\u590D\u51FD\u6570",en:"Fixer Function"},import:{zh:"\u5BFC\u5165",en:"Import"},export:{zh:"\u5BFC\u51FA",en:"Export"},error_cant_be_blank:{zh:"\u4E0D\u80FD\u4E3A\u7A7A",en:"Can not be blank"},error_duplicate_values:{zh:"\u5B58\u5728\u91CD\u590D\u7684\u503C",en:"There are duplicate values"},error_wrong_file_type:{zh:"\u9519\u8BEF\u7684\u6587\u4EF6\u7C7B\u578B",en:"Wrong file type"},error_fetch_url:{zh:"\u8BF7\u68C0\u67E5url\u5730\u5740\u662F\u5426\u6B63\u786E\u6216\u7A0D\u540E\u518D\u8BD5\u3002",en:"Please check if the url address is correct or try again later."},deepl_api:{zh:"DeepL \u63A5\u53E3",en:"DeepL API"},deepl_key:{zh:"DeepL \u5BC6\u94A5",en:"DeepL Key"},openai_api:{zh:"OpenAI \u63A5\u53E3",en:"OpenAI API"},openai_key:{zh:"OpenAI \u5BC6\u94A5",en:"OpenAI Key"},openai_model:{zh:"OpenAI \u6A21\u578B",en:"OpenAI Model"},openai_prompt:{zh:"OpenAI \u63D0\u793A\u8BCD",en:"OpenAI Prompt"},if_clear_cache:{zh:"\u662F\u5426\u6E05\u9664\u7F13\u5B58",en:"Whether clear cache"},clear_cache_never:{zh:"\u4E0D\u6E05\u9664\u7F13\u5B58",en:"Never clear cache"},clear_cache_restart:{zh:"\u91CD\u542F\u6D4F\u89C8\u5668\u65F6\u6E05\u9664\u7F13\u5B58",en:"Clear cache when restarting browser"},data_sync_type:{zh:"\u6570\u636E\u540C\u6B65\u65B9\u5F0F",en:"Data Sync Type"},data_sync_url:{zh:"\u6570\u636E\u540C\u6B65\u63A5\u53E3",en:"Data Sync API"},data_sync_user:{zh:"\u6570\u636E\u540C\u6B65\u8D26\u6237",en:"Data Sync User"},data_sync_key:{zh:"\u6570\u636E\u540C\u6B65\u5BC6\u94A5",en:"Data Sync Key"},sync_now:{zh:"\u7ACB\u5373\u540C\u6B65",en:"Sync Now"},sync_success:{zh:"\u540C\u6B65\u6210\u529F\uFF01",en:"Sync Success"},sync_failed:{zh:"\u540C\u6B65\u5931\u8D25\uFF01",en:"Sync Error"},error_got_some_wrong:{zh:"\u62B1\u6B49\uFF0C\u51FA\u9519\u4E86\uFF01",en:"Sorry, something went wrong!"},error_sync_setting:{zh:"\u60A8\u7684\u540C\u6B65\u7C7B\u578B\u5FC5\u987B\u4E3A\u201CKISS-Worker\u201D\uFF0C\u4E14\u9700\u586B\u5199\u5B8C\u6574",en:"Your sync type must be \"KISS-Worker\" and must be filled in completely"},click_test:{zh:"\u70B9\u51FB\u6D4B\u8BD5",en:"Click Test"},test_success:{zh:"\u6D4B\u8BD5\u6210\u529F",en:"Test success"},test_failed:{zh:"\u6D4B\u8BD5\u5931\u8D25",en:"Test failed"},clear_all_cache_now:{zh:"\u7ACB\u5373\u6E05\u9664\u5168\u90E8\u7F13\u5B58",en:"Clear all cache now"},clear_cache:{zh:"\u6E05\u9664\u7F13\u5B58",en:"Clear Cache"},clear_success:{zh:"\u6E05\u9664\u6210\u529F",en:"Clear success"},clear_failed:{zh:"\u6E05\u9664\u5931\u8D25",en:"Clear failed"},share:{zh:"\u5206\u4EAB",en:"Share"},clear_all:{zh:"\u6E05\u7A7A",en:"Clear All"},help:{zh:"\u6C42\u52A9",en:"Help"},restore_default:{zh:"\u6062\u590D\u9ED8\u8BA4",en:"Restore Default"},shortcuts_setting:{zh:"\u5FEB\u6377\u952E\u8BBE\u7F6E",en:"Shortcuts Setting"},toggle_translate_shortcut:{zh:"\"\u5F00\u542F\u7FFB\u8BD1\"\u5FEB\u6377\u952E",en:"\"Toggle Translate\" Shortcut"},toggle_style_shortcut:{zh:"\"\u5207\u6362\u6837\u5F0F\"\u5FEB\u6377\u952E",en:"\"Toggle Style\" Shortcut"},toggle_popup_shortcut:{zh:"\"\u6253\u5F00\u5F39\u7A97\"\u5FEB\u6377\u952E",en:"\"Open Popup\" Shortcut"},open_setting_shortcut:{zh:"\"\u6253\u5F00\u8BBE\u7F6E\"\u5FEB\u6377\u952E",en:"\"Open Setting\" Shortcut"},hide_fab_button:{zh:"\u9690\u85CF\u60AC\u6D6E\u6309\u94AE",en:"Hide Fab Button"},hide_tran_button:{zh:"\u9690\u85CF\u7FFB\u8BD1\u6309\u94AE",en:"Hide Translate Button"},show:{zh:"\u663E\u793A",en:"Show"},hide:{zh:"\u9690\u85CF",en:"Hide"},save_rule:{zh:"\u4FDD\u5B58\u89C4\u5219",en:"Save Rule"},global_rule:{zh:"\u5168\u5C40\u89C4\u5219",en:"Global Rule"},input_translate:{zh:"\u8F93\u5165\u6846\u7FFB\u8BD1",en:"Input Box Translation"},use_input_box_translation:{zh:"\u542F\u7528\u8F93\u5165\u6846\u7FFB\u8BD1",en:"Input Box Translation"},input_selector:{zh:"\u8F93\u5165\u6846\u9009\u62E9\u5668",en:"Input Selector"},input_selector_helper:{zh:"\u7528\u4E8E\u8F93\u5165\u6846\u7FFB\u8BD1\u3002",en:"Used for input box translation."},trigger_trans_shortcut:{zh:"\u89E6\u53D1\u7FFB\u8BD1\u5FEB\u6377\u952E",en:"Trigger Translation Shortcut Keys"},trigger_trans_shortcut_help:{zh:"\u9ED8\u8BA4\u4E3A\u5355\u51FB\u201CAltLeft+KeyI\u201D",en:"Default is \"AltLeft+KeyI\""},shortcut_press_count:{zh:"\u5FEB\u6377\u952E\u8FDE\u51FB\u6B21\u6570",en:"Shortcut Press Number"},combo_timeout:{zh:"\u8FDE\u51FB\u8D85\u65F6\u65F6\u95F4 (10-1000ms)",en:"Combo Timeout (10-1000ms)"},input_trans_start_sign:{zh:"\u7FFB\u8BD1\u8D77\u59CB\u6807\u8BC6",en:"Translation Start Sign"},input_trans_start_sign_help:{zh:"\u6807\u8BC6\u540E\u9762\u53EF\u4EE5\u52A0\u76EE\u6807\u8BED\u8A00\u4EE3\u7801\uFF0C\u5982\uFF1A \u201C/en \u4F60\u597D\u201D\u3001\u201C/zh hello\u201D",en:"The target language code can be added after the sign, such as: \"/en \u4F60\u597D\", \"/zh hello\""},detect_lang_remote:{zh:"\u8FDC\u7A0B\u8BED\u8A00\u68C0\u6D4B",en:"Remote language detection"},detect_lang_remote_help:{zh:"\u542F\u7528\u540E\u68C0\u6D4B\u51C6\u786E\u5EA6\u589E\u52A0\uFF0C\u4F46\u4F1A\u964D\u4F4E\u7FFB\u8BD1\u901F\u5EA6\uFF0C\u8BF7\u914C\u60C5\u5F00\u542F",en:"After enabling, the detection accuracy will increase, but it will reduce the translation speed. Please enable it as appropriate."},disable:{zh:"\u7981\u7528",en:"Disable"},enable:{zh:"\u542F\u7528",en:"Enable"},selection_translate:{zh:"\u5212\u8BCD\u7FFB\u8BD1",en:"Selection Translate"},toggle_selection_translate:{zh:"\u542F\u7528\u5212\u8BCD\u7FFB\u8BD1",en:"Use Selection Translate"},trigger_tranbox_shortcut:{zh:"\u663E\u793A\u7FFB\u8BD1\u6846/\u7FFB\u8BD1\u9009\u4E2D\u6587\u5B57\u5FEB\u6377\u952E",en:"Open Translate Popup/Translate Selected Shortcut"},tranbtn_offset_x:{zh:"\u7FFB\u8BD1\u6309\u94AE\u504F\u79FBX\uFF080-100\uFF09",en:"Translate Button Offset X (0-100)"},tranbtn_offset_y:{zh:"\u7FFB\u8BD1\u6309\u94AE\u504F\u79FBY\uFF080-100\uFF09",en:"Translate Button Offset Y (0-100)"},translated_text:{zh:"\u8BD1\u6587",en:"Translated Text"},original_text:{zh:"\u539F\u6587",en:"Original Text"},favorite_words:{zh:"\u6536\u85CF\u8BCD\u6C47",en:"Favorite Words"},touch_setting:{zh:"\u89E6\u5C4F\u8BBE\u7F6E",en:"Touch Setting"},touch_translate_shortcut:{zh:"\u89E6\u5C4F\u7FFB\u8BD1\u5FEB\u6377\u65B9\u5F0F",en:"Touch Translate Shortcut"},touch_tap_0:{zh:"\u7981\u7528",en:"Disable"},touch_tap_2:{zh:"\u53CC\u6307\u8F7B\u89E6",en:"Two finger tap"},touch_tap_3:{zh:"\u4E09\u6307\u8F7B\u89E6",en:"Three finger tap"},touch_tap_4:{zh:"\u56DB\u6307\u8F7B\u89E6",en:"Four finger tap"},translate_blacklist:{zh:"\u7981\u7528\u7FFB\u8BD1\u540D\u5355",en:"Translate Blacklist"},disable_langs:{zh:"\u4E0D\u7FFB\u8BD1\u7684\u8BED\u8A00",en:"Disable Languages"},disable_langs_helper:{zh:"\u6B64\u529F\u80FD\u4F9D\u8D56\u51C6\u786E\u7684\u8BED\u8A00\u68C0\u6D4B\uFF0C\u5EFA\u8BAE\u542F\u7528\u8FDC\u7A0B\u8BED\u8A00\u68C0\u6D4B\u3002",en:"This feature relies on accurate language detection. It is recommended to enable remote language detection."},add_context_menus:{zh:"\u6DFB\u52A0\u53F3\u952E\u83DC\u5355",en:"Add Context Menus"}}; +var UI_LANGS=(/* unused pure expression or super */ null && ([["en","English"],["zh","中文"]]));var customApiLangs="[\"en\", \"English - English\"],\n[\"zh-CN\", \"Simplified Chinese - \u7B80\u4F53\u4E2D\u6587\"],\n[\"zh-TW\", \"Traditional Chinese - \u7E41\u9AD4\u4E2D\u6587\"],\n[\"ar\", \"Arabic - \u0627\u0644\u0639\u0631\u0628\u064A\u0629\"],\n[\"bg\", \"Bulgarian - \u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438\"],\n[\"ca\", \"Catalan - Catal\xE0\"],\n[\"hr\", \"Croatian - Hrvatski\"],\n[\"cs\", \"Czech - \u010Ce\u0161tina\"],\n[\"da\", \"Danish - Dansk\"],\n[\"nl\", \"Dutch - Nederlands\"],\n[\"fi\", \"Finnish - Suomi\"],\n[\"fr\", \"French - Fran\xE7ais\"],\n[\"de\", \"German - Deutsch\"],\n[\"el\", \"Greek - \u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC\"],\n[\"hi\", \"Hindi - \u0939\u093F\u0928\u094D\u0926\u0940\"],\n[\"hu\", \"Hungarian - Magyar\"],\n[\"id\", \"Indonesian - Indonesia\"],\n[\"it\", \"Italian - Italiano\"],\n[\"ja\", \"Japanese - \u65E5\u672C\u8A9E\"],\n[\"ko\", \"Korean - \uD55C\uAD6D\uC5B4\"],\n[\"ms\", \"Malay - Melayu\"],\n[\"mt\", \"Maltese - Malti\"],\n[\"nb\", \"Norwegian - Norsk Bokm\xE5l\"],\n[\"pl\", \"Polish - Polski\"],\n[\"pt\", \"Portuguese - Portugu\xEAs\"],\n[\"ro\", \"Romanian - Rom\xE2n\u0103\"],\n[\"ru\", \"Russian - \u0420\u0443\u0441\u0441\u043A\u0438\u0439\"],\n[\"sk\", \"Slovak - Sloven\u010Dina\"],\n[\"sl\", \"Slovenian - Sloven\u0161\u010Dina\"],\n[\"es\", \"Spanish - Espa\xF1ol\"],\n[\"sv\", \"Swedish - Svenska\"],\n[\"ta\", \"Tamil - \u0BA4\u0BAE\u0BBF\u0BB4\u0BCD\"],\n[\"te\", \"Telugu - \u0C24\u0C46\u0C32\u0C41\u0C17\u0C41\"],\n[\"th\", \"Thai - \u0E44\u0E17\u0E22\"],\n[\"tr\", \"Turkish - T\xFCrk\xE7e\"],\n[\"uk\", \"Ukrainian - \u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430\"],\n[\"vi\", \"Vietnamese - Ti\u1EBFng Vi\u1EC7t\"],\n";var customApiHelpZH="/// \u81EA\u5B9A\u4E49\u7FFB\u8BD1\u6E90\u63A5\u53E3\u8BF4\u660E\n\n// \u8BF7\u6C42\uFF08Request\uFF09\u6570\u636E\u5C06\u6309\u4E0B\u9762\u89C4\u8303\u53D1\u9001\n{\n url: {{YOUR_URL}},\n method: \"POST\",\n headers: {\n \"Content-type\": \"application/json\",\n \"Authorization\": \"Bearer {{YOUR_KEY}}\",\n },\n body: {\n text: \"\", // \u9700\u8981\u7FFB\u8BD1\u7684\u6587\u5B57\n from: \"\", // \u6E90\u8BED\u8A00\uFF0C\u53EF\u80FD\u4E3A\u7A7A\uFF0C\u8868\u793A\u9700\u8981\u63A5\u53E3\u81EA\u52A8\u8BC6\u522B\u8BED\u8A00\n to: \"\", // \u76EE\u6807\u8BED\u8A00\n }\n}\n\n// \u8FD4\u56DE\uFF08Response\uFF09\u6570\u636E\u9700\u7B26\u5408\u4E0B\u9762\u7684JSON\u89C4\u8303\n{\n text: \"\", // \u7FFB\u8BD1\u540E\u7684\u6587\u5B57\n from: \"\", // \u8BC6\u522B\u7684\u6E90\u8BED\u8A00\n to: \"\", // \u76EE\u6807\u8BED\u8A00\uFF08\u53EF\u9009\uFF09\n}\n\n// \u652F\u6301\u7684\u8BED\u8A00\u4EE3\u7801\u5982\u4E0B\n".concat(customApiLangs,"\n");var customApiHelpEN="/// Custom translation source interface description\n\n// Request data will be sent according to the following specifications\n{\n url: {{YOUR_URL}},\n method: \"POST\",\n headers: {\n \"Content-type\": \"application/json\",\n \"Authorization\": \"Bearer {{YOUR_KEY}}\",\n },\n body: {\n text: \"\", // text to be translated\n from: \"\", // Source language, may be empty\n to: \"\", // Target language\n }\n}\n\n// The returned data must conform to the following JSON specification\n{\n text: \"\", // translated text\n from: \"\", // Recognized source language\n to: \"\", // Target language (optional)\n}\n\n// The supported language codes are as follows\n".concat(customApiLangs,"\n");var I18N={app_name:{zh:"\u7B80\u7EA6\u7FFB\u8BD1",en:"KISS Translator"},translate:{zh:"\u7FFB\u8BD1",en:"Translate"},custom_api_help:{zh:customApiHelpZH,en:customApiHelpEN},translate_alt:{zh:"\u7FFB\u8BD1 (Alt+Q)",en:"Translate (Alt+Q)"},basic_setting:{zh:"\u57FA\u672C\u8BBE\u7F6E",en:"Basic Setting"},rules_setting:{zh:"\u89C4\u5219\u8BBE\u7F6E",en:"Rules Setting"},apis_setting:{zh:"\u63A5\u53E3\u8BBE\u7F6E",en:"Apis Setting"},sync_setting:{zh:"\u540C\u6B65\u8BBE\u7F6E",en:"Sync Setting"},patch_setting:{zh:"\u8865\u4E01\u8BBE\u7F6E",en:"Patch Setting"},patch_setting_help:{zh:"\u9488\u5BF9\u4E00\u4E9B\u7279\u6B8A\u7F51\u7AD9\u7684\u4FEE\u6B63\u811A\u672C\uFF0C\u4EE5\u4FBF\u7FFB\u8BD1\u8F6F\u4EF6\u5F97\u5230\u66F4\u597D\u7684\u5C55\u793A\u6548\u679C\u3002",en:"Corrected scripts for some special websites so that the translation software can get better display results."},inject_webfix:{zh:"\u6CE8\u5165\u4FEE\u590D\u8865\u4E01",en:"Inject Webfix"},about:{zh:"\u5173\u4E8E",en:"About"},about_md:{zh:"README.md",en:"README.en.md"},about_md_local:{zh:"\u8BF7 [\u70B9\u51FB\u8FD9\u91CC](".concat("https://github.com/fishjar/kiss-translator",") \u67E5\u770B\u8BE6\u60C5\u3002"),en:"Please [click here](".concat("https://github.com/fishjar/kiss-translator",") for details.")},ui_lang:{zh:"\u754C\u9762\u8BED\u8A00",en:"Interface Language"},fetch_limit:{zh:"\u6700\u5927\u8BF7\u6C42\u6570\u91CF (1-100)",en:"Maximum Number Of Request (1-100)"},fetch_interval:{zh:"\u8BF7\u6C42\u95F4\u9694\u65F6\u95F4 (0-5000ms)",en:"Request Interval (0-5000ms)"},min_translate_length:{zh:"\u6700\u5C0F\u7FFB\u8BD1\u957F\u5EA6 (1-100)",en:"Min Translate Length (1-100)"},max_translate_length:{zh:"\u6700\u5927\u7FFB\u8BD1\u957F\u5EA6 (100-10000)",en:"Max Translate Length (100-10000)"},num_of_newline_characters:{zh:"\u6362\u884C\u5B57\u7B26\u6570 (1-1000)",en:"Number of Newline Characters (1-1000)"},translate_service:{zh:"\u7FFB\u8BD1\u670D\u52A1",en:"Translate Service"},mouseover_translation:{zh:"\u9F20\u6807\u60AC\u505C\u7FFB\u8BD1",en:"Mouseover translation"},mk_disable:{zh:"\u7981\u7528",en:"Disable"},mk_mouseover:{zh:"\u9F20\u6807\u60AC\u505C",en:"Mouseover"},mk_ctrlKey:{zh:"Control + \u9F20\u6807\u60AC\u505C",en:"Control + Mouseover"},mk_shiftKey:{zh:"Shift + \u9F20\u6807\u60AC\u505C",en:"Shift + Mouseover"},mk_altKey:{zh:"Alt + \u9F20\u6807\u60AC\u505C",en:"Alt + Mouseover"},from_lang:{zh:"\u539F\u6587\u8BED\u8A00",en:"Source Language"},to_lang:{zh:"\u76EE\u6807\u8BED\u8A00",en:"Target Language"},to_lang2:{zh:"\u7B2C\u4E8C\u76EE\u6807\u8BED\u8A00",en:"Target Language 2"},to_lang2_helper:{zh:"\u8BBE\u5B9A\u540E\uFF0C\u4E0E\u76EE\u6807\u8BED\u8A00\u4EA7\u751F\u4E92\u8BD1\u6548\u679C\uFF0C\u4F46\u4F9D\u8D56\u8FDC\u7A0B\u8BED\u8A00\u8BC6\u522B\u3002",en:"After setting, it will produce mutual translation effect with the target language, but it relies on remote language recognition."},text_style:{zh:"\u6587\u5B57\u6837\u5F0F",en:"Text Style"},text_style_alt:{zh:"\u6587\u5B57\u6837\u5F0F (Alt+C)",en:"Text Style (Alt+C)"},bg_color:{zh:"\u6837\u5F0F\u989C\u8272",en:"Style Color"},remain_unchanged:{zh:"\u4FDD\u7559\u4E0D\u53D8",en:"Remain Unchanged"},google_api:{zh:"\u8C37\u6B4C\u7FFB\u8BD1\u63A5\u53E3",en:"Google Translate API"},default_selector:{zh:"\u9ED8\u8BA4\u9009\u62E9\u5668",en:"Default selector"},selector_rules:{zh:"\u9009\u62E9\u5668\u89C4\u5219",en:"Selector Rules"},save:{zh:"\u4FDD\u5B58",en:"Save"},edit:{zh:"\u7F16\u8F91",en:"Edit"},cancel:{zh:"\u53D6\u6D88",en:"Cancel"},delete:{zh:"\u5220\u9664",en:"Delete"},reset:{zh:"\u91CD\u7F6E",en:"Reset"},add:{zh:"\u6DFB\u52A0",en:"Add"},inject_rules:{zh:"\u6CE8\u5165\u8BA2\u9605\u89C4\u5219",en:"Inject Subscribe Rules"},personal_rules:{zh:"\u4E2A\u4EBA\u89C4\u5219",en:"Rules"},subscribe_rules:{zh:"\u8BA2\u9605\u89C4\u5219",en:"Subscribe"},overwrite_subscribe_rules:{zh:"\u8986\u5199\u8BA2\u9605\u89C4\u5219",en:"Overwrite"},subscribe_url:{zh:"\u8BA2\u9605\u5730\u5740",en:"Subscribe URL"},rules_warn_1:{zh:"1\u3001\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u4E00\u76F4\u751F\u6548\uFF0C\u9009\u62E9\u201C\u6CE8\u5165\u8BA2\u9605\u89C4\u5219\u201D\u540E\uFF0C\u201C\u8BA2\u9605\u89C4\u5219\u201D\u624D\u4F1A\u751F\u6548\u3002",en:"1. The \"Personal Rules\" are always in effect. After selecting \"Inject Subscription Rules\", the \"Subscription Rules\" will take effect."},rules_warn_2:{zh:"2\u3001\u201C\u8BA2\u9605\u89C4\u5219\u201D\u7684\u6CE8\u5165\u4F4D\u7F6E\u662F\u5012\u6570\u7B2C\u4E8C\u7684\u4F4D\u7F6E\uFF0C\u56E0\u6B64\u9664\u5168\u5C40\u89C4\u5219(*)\u5916\uFF0C\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u4F18\u5148\u7EA7\u6BD4\u201C\u8BA2\u9605\u89C4\u5219\u201D\u9AD8\uFF0C\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u586B\u5199\u540C\u6837\u7684\u7F51\u5740\u4F1A\u8986\u76D6\u201D\u8BA2\u9605\u89C4\u5219\u201C\u7684\u6761\u76EE\u3002",en:"2. The injection position of \"Subscription Rules\" is the penultimate position. Therefore, except for the global rules (*), the priority of \"Personal Rules\" is higher than that of \"Subscription Rules\". Filling in the same url in \"Personal Rules\" will overwrite \"Subscription Rules\" entry."},sync_warn:{zh:"\u5982\u679C\u670D\u52A1\u5668\u5B58\u5728\u5176\u4ED6\u5BA2\u6237\u7AEF\u540C\u6B65\u7684\u6570\u636E\uFF0C\u7B2C\u4E00\u6B21\u540C\u6B65\u5C06\u76F4\u63A5\u8986\u76D6\u672C\u5730\u914D\u7F6E\uFF0C\u540E\u9762\u5219\u6839\u636E\u4FEE\u6539\u65F6\u95F4\uFF0C\u65B0\u7684\u8986\u76D6\u65E7\u7684\u3002",en:"If the server has data synchronized by other clients, the first synchronization will directly overwrite the local configuration, and later, according to the modification time, the new one will overwrite the old one."},about_sync_api:{zh:"\u67E5\u770B\u5173\u4E8E\u6570\u636E\u540C\u6B65\u63A5\u53E3\u90E8\u7F72",en:"View About Data Synchronization Interface Deployment"},about_api_proxy:{zh:"\u67E5\u770B\u81EA\u5EFA\u4E00\u4E2A\u7FFB\u8BD1\u63A5\u53E3\u4EE3\u7406",en:"Check out the self-built translation interface proxy"},style_none:{zh:"\u65E0",en:"None"},under_line:{zh:"\u4E0B\u5212\u76F4\u7EBF",en:"Underline"},dot_line:{zh:"\u4E0B\u5212\u70B9\u72B6\u7EBF",en:"Dotted Underline"},dash_line:{zh:"\u4E0B\u5212\u865A\u7EBF",en:"Dashed Underline"},wavy_line:{zh:"\u4E0B\u5212\u6CE2\u6D6A\u7EBF",en:"Wavy Underline"},fuzzy:{zh:"\u6A21\u7CCA",en:"Fuzzy"},highlight:{zh:"\u9AD8\u4EAE",en:"Highlight"},blockquote:{zh:"\u5F15\u7528",en:"Blockquote"},diy_style:{zh:"\u81EA\u5B9A\u4E49\u6837\u5F0F",en:"Custom Style"},diy_style_helper:{zh:"\u9075\u5FAA\u201CCSS\u201D\u7684\u8BED\u6CD5",en:"Follow the syntax of \"CSS\""},setting:{zh:"\u8BBE\u7F6E",en:"Setting"},pattern:{zh:"\u5339\u914D\u7F51\u5740",en:"URL pattern"},pattern_helper:{zh:"1\u3001\u652F\u6301\u661F\u53F7(*)\u901A\u914D\u7B26\u30022\u3001\u591A\u4E2AURL\u7528\u82F1\u6587\u9017\u53F7\u201C,\u201D\u5206\u9694\u3002",en:"1. The asterisk (*) wildcard is supported. 2. Multiple URLs separated by English commas \",\"."},selector_helper:{zh:"1\u3001\u9075\u5FAACSS\u9009\u62E9\u5668\u8BED\u6CD5\u30022\u3001\u7559\u7A7A\u8868\u793A\u91C7\u7528\u5168\u5C40\u8BBE\u7F6E\u30023\u3001\u591A\u4E2ACSS\u9009\u62E9\u5668\u4E4B\u95F4\u7528\u201C;\u201D\u9694\u5F00\u30024\u3001\u201Cshadow root\u201D\u9009\u62E9\u5668\u548C\u5185\u90E8\u9009\u62E9\u5668\u7528\u201C>>>\u201D\u9694\u5F00\u3002",en:"1. Follow CSS selector syntax. 2. Leave blank to adopt the global setting. 3. Separate multiple CSS selectors with \";\". 4. The \"shadow root\" selector and the internal selector are separated by \">>>\"."},translate_switch:{zh:"\u5F00\u542F\u7FFB\u8BD1",en:"Translate Switch"},default_enabled:{zh:"\u9ED8\u8BA4\u5F00\u542F",en:"Enabled"},default_disabled:{zh:"\u9ED8\u8BA4\u5173\u95ED",en:"Disabled"},selector:{zh:"\u9009\u62E9\u5668",en:"Selector"},keep_selector:{zh:"\u4FDD\u7559\u5143\u7D20\u9009\u62E9\u5668",en:"Keep unchanged selector"},keep_selector_helper:{zh:"1\u3001\u9075\u5FAACSS\u9009\u62E9\u5668\u8BED\u6CD5\u30022\u3001\u7559\u7A7A\u8868\u793A\u91C7\u7528\u5168\u5C40\u8BBE\u7F6E\u3002",en:"1. Follow CSS selector syntax. 2. Leave blank to adopt the global setting."},root_selector:{zh:"\u6839\u9009\u62E9\u5668",en:"Root Selector"},fixer_function:{zh:"\u4FEE\u590D\u51FD\u6570",en:"Fixer Function"},import:{zh:"\u5BFC\u5165",en:"Import"},export:{zh:"\u5BFC\u51FA",en:"Export"},error_cant_be_blank:{zh:"\u4E0D\u80FD\u4E3A\u7A7A",en:"Can not be blank"},error_duplicate_values:{zh:"\u5B58\u5728\u91CD\u590D\u7684\u503C",en:"There are duplicate values"},error_wrong_file_type:{zh:"\u9519\u8BEF\u7684\u6587\u4EF6\u7C7B\u578B",en:"Wrong file type"},error_fetch_url:{zh:"\u8BF7\u68C0\u67E5url\u5730\u5740\u662F\u5426\u6B63\u786E\u6216\u7A0D\u540E\u518D\u8BD5\u3002",en:"Please check if the url address is correct or try again later."},deepl_api:{zh:"DeepL \u63A5\u53E3",en:"DeepL API"},deepl_key:{zh:"DeepL \u5BC6\u94A5",en:"DeepL Key"},openai_api:{zh:"OpenAI \u63A5\u53E3",en:"OpenAI API"},openai_key:{zh:"OpenAI \u5BC6\u94A5",en:"OpenAI Key"},openai_model:{zh:"OpenAI \u6A21\u578B",en:"OpenAI Model"},openai_prompt:{zh:"OpenAI \u63D0\u793A\u8BCD",en:"OpenAI Prompt"},if_clear_cache:{zh:"\u662F\u5426\u6E05\u9664\u7F13\u5B58",en:"Whether clear cache"},clear_cache_never:{zh:"\u4E0D\u6E05\u9664\u7F13\u5B58",en:"Never clear cache"},clear_cache_restart:{zh:"\u91CD\u542F\u6D4F\u89C8\u5668\u65F6\u6E05\u9664\u7F13\u5B58",en:"Clear cache when restarting browser"},data_sync_type:{zh:"\u6570\u636E\u540C\u6B65\u65B9\u5F0F",en:"Data Sync Type"},data_sync_url:{zh:"\u6570\u636E\u540C\u6B65\u63A5\u53E3",en:"Data Sync API"},data_sync_user:{zh:"\u6570\u636E\u540C\u6B65\u8D26\u6237",en:"Data Sync User"},data_sync_key:{zh:"\u6570\u636E\u540C\u6B65\u5BC6\u94A5",en:"Data Sync Key"},sync_now:{zh:"\u7ACB\u5373\u540C\u6B65",en:"Sync Now"},sync_success:{zh:"\u540C\u6B65\u6210\u529F\uFF01",en:"Sync Success"},sync_failed:{zh:"\u540C\u6B65\u5931\u8D25\uFF01",en:"Sync Error"},error_got_some_wrong:{zh:"\u62B1\u6B49\uFF0C\u51FA\u9519\u4E86\uFF01",en:"Sorry, something went wrong!"},error_sync_setting:{zh:"\u60A8\u7684\u540C\u6B65\u7C7B\u578B\u5FC5\u987B\u4E3A\u201CKISS-Worker\u201D\uFF0C\u4E14\u9700\u586B\u5199\u5B8C\u6574",en:"Your sync type must be \"KISS-Worker\" and must be filled in completely"},click_test:{zh:"\u70B9\u51FB\u6D4B\u8BD5",en:"Click Test"},test_success:{zh:"\u6D4B\u8BD5\u6210\u529F",en:"Test success"},test_failed:{zh:"\u6D4B\u8BD5\u5931\u8D25",en:"Test failed"},clear_all_cache_now:{zh:"\u7ACB\u5373\u6E05\u9664\u5168\u90E8\u7F13\u5B58",en:"Clear all cache now"},clear_cache:{zh:"\u6E05\u9664\u7F13\u5B58",en:"Clear Cache"},clear_success:{zh:"\u6E05\u9664\u6210\u529F",en:"Clear success"},clear_failed:{zh:"\u6E05\u9664\u5931\u8D25",en:"Clear failed"},share:{zh:"\u5206\u4EAB",en:"Share"},clear_all:{zh:"\u6E05\u7A7A",en:"Clear All"},help:{zh:"\u6C42\u52A9",en:"Help"},restore_default:{zh:"\u6062\u590D\u9ED8\u8BA4",en:"Restore Default"},shortcuts_setting:{zh:"\u5FEB\u6377\u952E\u8BBE\u7F6E",en:"Shortcuts Setting"},toggle_translate_shortcut:{zh:"\"\u5F00\u542F\u7FFB\u8BD1\"\u5FEB\u6377\u952E",en:"\"Toggle Translate\" Shortcut"},toggle_style_shortcut:{zh:"\"\u5207\u6362\u6837\u5F0F\"\u5FEB\u6377\u952E",en:"\"Toggle Style\" Shortcut"},toggle_popup_shortcut:{zh:"\"\u6253\u5F00\u5F39\u7A97\"\u5FEB\u6377\u952E",en:"\"Open Popup\" Shortcut"},open_setting_shortcut:{zh:"\"\u6253\u5F00\u8BBE\u7F6E\"\u5FEB\u6377\u952E",en:"\"Open Setting\" Shortcut"},hide_fab_button:{zh:"\u9690\u85CF\u60AC\u6D6E\u6309\u94AE",en:"Hide Fab Button"},hide_tran_button:{zh:"\u9690\u85CF\u7FFB\u8BD1\u6309\u94AE",en:"Hide Translate Button"},show:{zh:"\u663E\u793A",en:"Show"},hide:{zh:"\u9690\u85CF",en:"Hide"},save_rule:{zh:"\u4FDD\u5B58\u89C4\u5219",en:"Save Rule"},global_rule:{zh:"\u5168\u5C40\u89C4\u5219",en:"Global Rule"},input_translate:{zh:"\u8F93\u5165\u6846\u7FFB\u8BD1",en:"Input Box Translation"},use_input_box_translation:{zh:"\u542F\u7528\u8F93\u5165\u6846\u7FFB\u8BD1",en:"Input Box Translation"},input_selector:{zh:"\u8F93\u5165\u6846\u9009\u62E9\u5668",en:"Input Selector"},input_selector_helper:{zh:"\u7528\u4E8E\u8F93\u5165\u6846\u7FFB\u8BD1\u3002",en:"Used for input box translation."},trigger_trans_shortcut:{zh:"\u89E6\u53D1\u7FFB\u8BD1\u5FEB\u6377\u952E",en:"Trigger Translation Shortcut Keys"},trigger_trans_shortcut_help:{zh:"\u9ED8\u8BA4\u4E3A\u5355\u51FB\u201CAltLeft+KeyI\u201D",en:"Default is \"AltLeft+KeyI\""},shortcut_press_count:{zh:"\u5FEB\u6377\u952E\u8FDE\u51FB\u6B21\u6570",en:"Shortcut Press Number"},combo_timeout:{zh:"\u8FDE\u51FB\u8D85\u65F6\u65F6\u95F4 (10-1000ms)",en:"Combo Timeout (10-1000ms)"},input_trans_start_sign:{zh:"\u7FFB\u8BD1\u8D77\u59CB\u6807\u8BC6",en:"Translation Start Sign"},input_trans_start_sign_help:{zh:"\u6807\u8BC6\u540E\u9762\u53EF\u4EE5\u52A0\u76EE\u6807\u8BED\u8A00\u4EE3\u7801\uFF0C\u5982\uFF1A \u201C/en \u4F60\u597D\u201D\u3001\u201C/zh hello\u201D",en:"The target language code can be added after the sign, such as: \"/en \u4F60\u597D\", \"/zh hello\""},detect_lang_remote:{zh:"\u8FDC\u7A0B\u8BED\u8A00\u68C0\u6D4B",en:"Remote language detection"},detect_lang_remote_help:{zh:"\u542F\u7528\u540E\u68C0\u6D4B\u51C6\u786E\u5EA6\u589E\u52A0\uFF0C\u4F46\u4F1A\u964D\u4F4E\u7FFB\u8BD1\u901F\u5EA6\uFF0C\u8BF7\u914C\u60C5\u5F00\u542F",en:"After enabling, the detection accuracy will increase, but it will reduce the translation speed. Please enable it as appropriate."},disable:{zh:"\u7981\u7528",en:"Disable"},enable:{zh:"\u542F\u7528",en:"Enable"},selection_translate:{zh:"\u5212\u8BCD\u7FFB\u8BD1",en:"Selection Translate"},toggle_selection_translate:{zh:"\u542F\u7528\u5212\u8BCD\u7FFB\u8BD1",en:"Use Selection Translate"},trigger_tranbox_shortcut:{zh:"\u663E\u793A\u7FFB\u8BD1\u6846/\u7FFB\u8BD1\u9009\u4E2D\u6587\u5B57\u5FEB\u6377\u952E",en:"Open Translate Popup/Translate Selected Shortcut"},tranbtn_offset_x:{zh:"\u7FFB\u8BD1\u6309\u94AE\u504F\u79FBX\uFF080-100\uFF09",en:"Translate Button Offset X (0-100)"},tranbtn_offset_y:{zh:"\u7FFB\u8BD1\u6309\u94AE\u504F\u79FBY\uFF080-100\uFF09",en:"Translate Button Offset Y (0-100)"},translated_text:{zh:"\u8BD1\u6587",en:"Translated Text"},original_text:{zh:"\u539F\u6587",en:"Original Text"},favorite_words:{zh:"\u6536\u85CF\u8BCD\u6C47",en:"Favorite Words"},touch_setting:{zh:"\u89E6\u5C4F\u8BBE\u7F6E",en:"Touch Setting"},touch_translate_shortcut:{zh:"\u89E6\u5C4F\u7FFB\u8BD1\u5FEB\u6377\u65B9\u5F0F",en:"Touch Translate Shortcut"},touch_tap_0:{zh:"\u7981\u7528",en:"Disable"},touch_tap_2:{zh:"\u53CC\u6307\u8F7B\u89E6",en:"Two finger tap"},touch_tap_3:{zh:"\u4E09\u6307\u8F7B\u89E6",en:"Three finger tap"},touch_tap_4:{zh:"\u56DB\u6307\u8F7B\u89E6",en:"Four finger tap"},translate_blacklist:{zh:"\u7981\u7528\u7FFB\u8BD1\u540D\u5355",en:"Translate Blacklist"},disable_langs:{zh:"\u4E0D\u7FFB\u8BD1\u7684\u8BED\u8A00",en:"Disable Languages"},disable_langs_helper:{zh:"\u6B64\u529F\u80FD\u4F9D\u8D56\u51C6\u786E\u7684\u8BED\u8A00\u68C0\u6D4B\uFF0C\u5EFA\u8BAE\u542F\u7528\u8FDC\u7A0B\u8BED\u8A00\u68C0\u6D4B\u3002",en:"This feature relies on accurate language detection. It is recommended to enable remote language detection."},add_context_menus:{zh:"\u6DFB\u52A0\u53F3\u952E\u83DC\u5355",en:"Add Context Menus"},mulkeys_help:{zh:"\u652F\u6301\u82F1\u6587\u9017\u53F7\u9694\u5F00\u591A\u4E2AKEY\u8F6E\u5BFB\u8C03\u7528\u3002",en:"Supports multiple KEY round calling calls separated by English commas."}}; ;// CONCATENATED MODULE: ./src/config/index.js var _OPT_LANGS_SPECIAL,_DEFAULT_TRANS_APIS,_DEFAULT_SHORTCUTS;var STOKEY_MSAUTH="".concat(APP_NAME,"_msauth");var STOKEY_BDAUTH="".concat(APP_NAME,"_bdauth");var config_STOKEY_SETTING="".concat(APP_NAME,"_setting");var config_STOKEY_RULES="".concat(APP_NAME,"_rules");var config_STOKEY_WFRULES="".concat(APP_NAME,"_webfix_rules");var STOKEY_WORDS="".concat(APP_NAME,"_words");var config_STOKEY_SYNC="".concat(APP_NAME,"_sync");var config_STOKEY_FAB="".concat(APP_NAME,"_fab");var config_STOKEY_RULESCACHE_PREFIX="".concat(APP_NAME,"_rulescache_");var STOKEY_WEBFIXCACHE_PREFIX="".concat(APP_NAME,"_webfixcache_");var CMD_TOGGLE_TRANSLATE="toggleTranslate";var CMD_TOGGLE_STYLE="toggleStyle";var CMD_OPEN_OPTIONS="openOptions";var CMD_OPEN_TRANBOX="openTranbox";var CLIENT_WEB="web";var CLIENT_CHROME="chrome";var CLIENT_EDGE="edge";var CLIENT_FIREFOX="firefox";var CLIENT_USERSCRIPT="userscript";var CLIENT_EXTS=[CLIENT_CHROME,CLIENT_EDGE,CLIENT_FIREFOX];var KV_RULES_KEY="kiss-rules.json";var config_KV_WFRULES_KEY="kiss-webfix.json";var KV_WORDS_KEY="kiss-words.json";var config_KV_RULES_SHARE_KEY="kiss-rules-share.json";var KV_SETTING_KEY="kiss-setting.json";var KV_SALT_SYNC="KISS-Translator-SYNC";var config_KV_SALT_SHARE="KISS-Translator-SHARE";var CACHE_NAME="".concat(APP_NAME,"_cache");var MSG_FETCH="fetch";var MSG_FETCH_LIMIT="fetch_limit";var MSG_FETCH_CLEAR="fetch_clear";var MSG_OPEN_OPTIONS="open_options";var MSG_SAVE_RULE="save_rule";var MSG_TRANS_TOGGLE="trans_toggle";var MSG_TRANS_TOGGLE_STYLE="trans_toggle_style";var MSG_OPEN_TRANBOX="open_tranbox";var MSG_TRANS_GETRULE="trans_getrule";var MSG_TRANS_PUTRULE="trans_putrule";var MSG_TRANS_CURRULE="trans_currule";var MSG_CONTEXT_MENUS="context_menus";var THEME_LIGHT="light";var THEME_DARK="dark";var URL_KISS_WORKER="https://github.com/fishjar/kiss-worker";var URL_KISS_PROXY="https://github.com/fishjar/kiss-proxy";var URL_KISS_RULES="https://github.com/fishjar/kiss-rules";var URL_KISS_RULES_NEW_ISSUE="https://github.com/fishjar/kiss-rules/issues/new";var config_URL_RAW_PREFIX="https://raw.githubusercontent.com/fishjar/kiss-translator/master";var URL_CACHE_TRAN="https://".concat(APP_LCNAME,"/translate");var URL_MICROSOFT_TRAN="https://api-edge.cognitive.microsofttranslator.com/translate";var URL_MICROSOFT_AUTH="https://edge.microsoft.com/translate/auth";var URL_BAIDU_LANGDETECT="https://fanyi.baidu.com/langdetect";var URL_BAIDU_WEB="https://fanyi.baidu.com/";var URL_BAIDU_TRAN="https://fanyi.baidu.com/v2transapi";var URL_DEEPLFREE_TRAN="https://www2.deepl.com/jsonrpc";var config_URL_TENCENT_TRANSMART="https://transmart.qq.com/api/imt";var OPT_TRANS_GOOGLE="Google";var OPT_TRANS_MICROSOFT="Microsoft";var OPT_TRANS_DEEPL="DeepL";var OPT_TRANS_DEEPLX="DeepLX";var OPT_TRANS_DEEPLFREE="DeepLFree";var OPT_TRANS_BAIDU="Baidu";var OPT_TRANS_TENCENT="Tencent";var OPT_TRANS_OPENAI="OpenAI";var OPT_TRANS_GEMINI="Gemini";var OPT_TRANS_CLOUDFLAREAI="CloudflareAI";var OPT_TRANS_CUSTOMIZE="Custom";var OPT_TRANS_ALL=[OPT_TRANS_GOOGLE,OPT_TRANS_MICROSOFT,OPT_TRANS_DEEPL,OPT_TRANS_DEEPLFREE,OPT_TRANS_DEEPLX,OPT_TRANS_BAIDU,OPT_TRANS_TENCENT,OPT_TRANS_OPENAI,OPT_TRANS_GEMINI,OPT_TRANS_CLOUDFLAREAI,OPT_TRANS_CUSTOMIZE];var OPT_LANGS_TO=[["en","English - English"],["zh-CN","Simplified Chinese - 简体中文"],["zh-TW","Traditional Chinese - 繁體中文"],["ar","Arabic - العربية"],["bg","Bulgarian - Български"],["ca","Catalan - Català"],["hr","Croatian - Hrvatski"],["cs","Czech - Čeština"],["da","Danish - Dansk"],["nl","Dutch - Nederlands"],["fi","Finnish - Suomi"],["fr","French - Français"],["de","German - Deutsch"],["el","Greek - Ελληνικά"],["hi","Hindi - हिन्दी"],["hu","Hungarian - Magyar"],["id","Indonesian - Indonesia"],["it","Italian - Italiano"],["ja","Japanese - 日本語"],["ko","Korean - 한국어"],["ms","Malay - Melayu"],["mt","Maltese - Malti"],["nb","Norwegian - Norsk Bokmål"],["pl","Polish - Polski"],["pt","Portuguese - Português"],["ro","Romanian - Română"],["ru","Russian - Русский"],["sk","Slovak - Slovenčina"],["sl","Slovenian - Slovenščina"],["es","Spanish - Español"],["sv","Swedish - Svenska"],["ta","Tamil - தமிழ்"],["te","Telugu - తెలుగు"],["th","Thai - ไทย"],["tr","Turkish - Türkçe"],["uk","Ukrainian - Українська"],["vi","Vietnamese - Tiếng Việt"]];var OPT_LANGS_FROM=[["auto","Auto-detect"]].concat(OPT_LANGS_TO);var OPT_LANGS_SPECIAL=(_OPT_LANGS_SPECIAL={},(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_GOOGLE,new Map(OPT_LANGS_FROM.map(function(_ref){var _ref2=(0,slicedToArray/* default */.Z)(_ref,1),key=_ref2[0];return[key,key];}))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_MICROSOFT,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref3){var _ref4=(0,slicedToArray/* default */.Z)(_ref3,1),key=_ref4[0];return[key,key];})),[["auto",""],["zh-CN","zh-Hans"],["zh-TW","zh-Hant"]]))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_DEEPL,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref5){var _ref6=(0,slicedToArray/* default */.Z)(_ref5,1),key=_ref6[0];return[key,key.toUpperCase()];})),[["auto",""],["zh-CN","ZH"],["zh-TW","ZH"]]))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_DEEPLFREE,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref7){var _ref8=(0,slicedToArray/* default */.Z)(_ref7,1),key=_ref8[0];return[key,key.toUpperCase()];})),[["auto","auto"],["zh-CN","ZH"],["zh-TW","ZH"]]))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_DEEPLX,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref9){var _ref10=(0,slicedToArray/* default */.Z)(_ref9,1),key=_ref10[0];return[key,key.toUpperCase()];})),[["auto",""],["zh-CN","ZH"],["zh-TW","ZH"]]))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_BAIDU,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref11){var _ref12=(0,slicedToArray/* default */.Z)(_ref11,1),key=_ref12[0];return[key,key];})),[["zh-CN","zh"],["zh-TW","cht"],["ar","ara"],["bg","bul"],["ca","cat"],["hr","hrv"],["da","dan"],["fi","fin"],["fr","fra"],["hi","mai"],["ja","jp"],["ko","kor"],["ms","may"],["mt","mlt"],["nb","nor"],["ro","rom"],["ru","ru"],["sl","slo"],["es","spa"],["sv","swe"],["ta","tam"],["te","tel"],["uk","ukr"],["vi","vie"]]))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_TENCENT,new Map([["auto","auto"],["zh-CN","zh"],["zh-TW","zh"],["en","en"],["ar","ar"],["de","de"],["ru","ru"],["fr","fr"],["fi","fil"],["ko","ko"],["ms","ms"],["pt","pt"],["ja","ja"],["th","th"],["tr","tr"],["es","es"],["it","it"],["hi","hi"],["id","id"],["vi","vi"]])),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_OPENAI,new Map(OPT_LANGS_FROM.map(function(_ref13){var _ref14=(0,slicedToArray/* default */.Z)(_ref13,2),key=_ref14[0],val=_ref14[1];return[key,val.split(" - ")[0]];}))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_GEMINI,new Map(OPT_LANGS_FROM.map(function(_ref15){var _ref16=(0,slicedToArray/* default */.Z)(_ref15,2),key=_ref16[0],val=_ref16[1];return[key,val.split(" - ")[0]];}))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_CLOUDFLAREAI,new Map([["auto",""],["zh-CN","chinese"],["zh-TW","chinese"],["en","english"],["ar","arabic"],["de","german"],["ru","russian"],["fr","french"],["pt","portuguese"],["ja","japanese"],["es","spanish"],["hi","hindi"]])),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_CUSTOMIZE,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref17){var _ref18=(0,slicedToArray/* default */.Z)(_ref17,1),key=_ref18[0];return[key,key];})),[["auto",""]]))),_OPT_LANGS_SPECIAL);var OPT_LANGS_LIST=OPT_LANGS_TO.map(function(_ref19){var _ref20=(0,slicedToArray/* default */.Z)(_ref19,1),lang=_ref20[0];return lang;});var OPT_LANGS_BAIDU=new Map(Array.from(OPT_LANGS_SPECIAL[OPT_TRANS_BAIDU].entries()).map(function(_ref21){var _ref22=(0,slicedToArray/* default */.Z)(_ref21,2),k=_ref22[0],v=_ref22[1];return[v,k];}));var config_OPT_LANGS_TENCENT=new Map(Array.from(OPT_LANGS_SPECIAL[OPT_TRANS_TENCENT].entries()).map(function(_ref23){var _ref24=(0,slicedToArray/* default */.Z)(_ref23,2),k=_ref24[0],v=_ref24[1];return[v,k];}));config_OPT_LANGS_TENCENT.set("zh","zh-CN");var OPT_STYLE_NONE="style_none";// 无 var OPT_STYLE_LINE="under_line";// 下划线 @@ -19501,7 +19501,7 @@ var PROMPT_PLACE_TO="{{to}}";// 占位符 var PROMPT_PLACE_TEXT="{{text}}";// 占位符 var DEFAULT_COLOR="#209CEE";// 默认高亮背景色/线条颜色 // 全局规则 -var GLOBLA_RULE={pattern:"*",selector:DEFAULT_SELECTOR,translator:OPT_TRANS_MICROSOFT,fromLang:"auto",toLang:"zh-CN",textStyle:OPT_STYLE_DASHLINE,transOpen:"false",bgColor:"",textDiyStyle:""};// 输入框翻译 +var GLOBLA_RULE={pattern:"*",selector:DEFAULT_SELECTOR,keepSelector:DEFAULT_KEEP_SELECTOR,translator:OPT_TRANS_MICROSOFT,fromLang:"auto",toLang:"zh-CN",textStyle:OPT_STYLE_DASHLINE,transOpen:"false",bgColor:"",textDiyStyle:""};// 输入框翻译 var OPT_INPUT_TRANS_SIGNS=["/","//","\\","\\\\",">",">>"];var DEFAULT_INPUT_SHORTCUT=["AltLeft","KeyI"];var DEFAULT_INPUT_RULE={transOpen:true,translator:OPT_TRANS_MICROSOFT,fromLang:"auto",toLang:"en",triggerShortcut:DEFAULT_INPUT_SHORTCUT,triggerCount:1,triggerTime:200,transSign:OPT_INPUT_TRANS_SIGNS[0]};// 划词翻译 var DEFAULT_TRANBOX_SHORTCUT=["AltLeft","KeyS"];var DEFAULT_TRANBOX_SETTING={transOpen:true,translator:OPT_TRANS_MICROSOFT,fromLang:"auto",toLang:"zh-CN",toLang2:"en",tranboxShortcut:DEFAULT_TRANBOX_SHORTCUT,btnOffsetX:10,btnOffsetY:10,hideTranBtn:false};// 订阅列表 var DEFAULT_SUBRULES_LIST=[{url:"https://fishjar.github.io/kiss-rules/kiss-rules.json",selected:false},{url:"https://fishjar.github.io/kiss-rules/kiss-rules-on.json",selected:true},{url:"https://fishjar.github.io/kiss-rules/kiss-rules-off.json",selected:false}];// 翻译接口 @@ -20288,7 +20288,8 @@ var id=1e4*Math.round(1e4*Math.random());var genDeeplFree=function genDeeplFree( */var _bdAuth=function _bdAuth(){var store;return/*#__PURE__*/asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(){var now;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:now=Date.now();// 查询内存缓存 if(!(store&&store.exp>now)){_context2.next=3;break;}return _context2.abrupt("return",store);case 3:_context2.next=5;return getBdauth();case 5:store=_context2.sent;if(!(store&&store.exp>now)){_context2.next=8;break;}return _context2.abrupt("return",store);case 8:_context2.next=10;return getToken();case 10:store=_context2.sent;_context2.next=13;return setBdauth(store);case 13:return _context2.abrupt("return",store);case 14:case"end":return _context2.stop();}},_callee2);}));};var bdAuth=_bdAuth();var genBaidu=/*#__PURE__*/function(){var _ref4=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee3(_ref3){var text,from,to,_yield$bdAuth,token,gtk,sign,data,input,init;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:text=_ref3.text,from=_ref3.from,to=_ref3.to;_context3.next=3;return bdAuth();case 3:_yield$bdAuth=_context3.sent;token=_yield$bdAuth.token;gtk=_yield$bdAuth.gtk;sign=getSign(text,gtk);data={from:from,to:to,query:text,simple_means_flag:3,sign:sign,token:token,domain:"common",ts:Date.now()};input="".concat(URL_BAIDU_TRAN,"?from=").concat(from,"&to=").concat(to);init={headers:{"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},method:"POST",body:query_string.stringify(data)};return _context3.abrupt("return",[input,init]);case 11:case"end":return _context3.stop();}},_callee3);}));return function genBaidu(_x){return _ref4.apply(this,arguments);};}(); ;// CONCATENATED MODULE: ./src/libs/req.js -/** +var keyMap=new Map();// 轮询key +var keyPick=function keyPick(translator){var _keyMap$get;var key=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";var keys=key.split(",").map(function(item){return item.trim();}).filter(Boolean);if(keys.length===0){return"";}var preIndex=(_keyMap$get=keyMap.get(translator))!==null&&_keyMap$get!==void 0?_keyMap$get:-1;var curIndex=(preIndex+1)%keys.length;keyMap.set(translator,curIndex);return keys[curIndex];};/** * 构造缓存 request * @param {*} request * @returns @@ -20300,7 +20301,7 @@ parts:[{text:prompt}]}]};var input="".concat(url,"/").concat(model,":generateCon * 构造翻译接口 request * @param {*} * @returns - */var newTransReq=function newTransReq(_ref12,apiSetting){var translator=_ref12.translator,text=_ref12.text,from=_ref12.from,to=_ref12.to;var args=_objectSpread2({text:text,from:from,to:to},apiSetting);switch(translator){case OPT_TRANS_GOOGLE:return genGoogle(args);case OPT_TRANS_MICROSOFT:return genMicrosoft(args);case OPT_TRANS_DEEPL:return genDeepl(args);case OPT_TRANS_DEEPLFREE:return genDeeplFree(args);case OPT_TRANS_DEEPLX:return genDeeplX(args);case OPT_TRANS_BAIDU:return genBaidu(args);case OPT_TRANS_TENCENT:return genTencent(args);case OPT_TRANS_OPENAI:return genOpenAI(args);case OPT_TRANS_GEMINI:return genGemini(args);case OPT_TRANS_CLOUDFLAREAI:return genCloudflareAI(args);case OPT_TRANS_CUSTOMIZE:return genCustom(args);default:throw new Error("[trans] translator: ".concat(translator," not support"));}}; + */var newTransReq=function newTransReq(_ref12,apiSetting){var translator=_ref12.translator,text=_ref12.text,from=_ref12.from,to=_ref12.to;var args=_objectSpread2({text:text,from:from,to:to},apiSetting);switch(translator){case OPT_TRANS_DEEPL:case OPT_TRANS_OPENAI:case OPT_TRANS_GEMINI:case OPT_TRANS_CLOUDFLAREAI:args.key=keyPick(translator,args.key);break;default:}switch(translator){case OPT_TRANS_GOOGLE:return genGoogle(args);case OPT_TRANS_MICROSOFT:return genMicrosoft(args);case OPT_TRANS_DEEPL:return genDeepl(args);case OPT_TRANS_DEEPLFREE:return genDeeplFree(args);case OPT_TRANS_DEEPLX:return genDeeplX(args);case OPT_TRANS_BAIDU:return genBaidu(args);case OPT_TRANS_TENCENT:return genTencent(args);case OPT_TRANS_OPENAI:return genOpenAI(args);case OPT_TRANS_GEMINI:return genGemini(args);case OPT_TRANS_CLOUDFLAREAI:return genCloudflareAI(args);case OPT_TRANS_CUSTOMIZE:return genCustom(args);default:throw new Error("[trans] translator: ".concat(translator," not support"));}}; ;// CONCATENATED MODULE: ./src/libs/fetch.js var fetch_excluded=["response","responseHeaders","status","statusText"],_excluded2=["useCache","usePool","transOpts","apiSetting"];/** * 油猴脚本的请求封装 @@ -23266,7 +23267,7 @@ var web_n = {}; return t.length === e && "." !== t && ".." !== t; }; }, - te = "object" === ("undefined" == typeof process ? "undefined" : Nt(process)) && process ? "object" === Nt(({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.15","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"})) && ({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.15","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"}) && ({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.15","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"}).__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix"; + te = "object" === ("undefined" == typeof process ? "undefined" : Nt(process)) && process ? "object" === Nt(({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.16","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"})) && ({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.16","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"}) && ({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.16","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"}).__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix"; It.sep = "win32" === te ? "\\" : "/"; var ee = Symbol("globstar **"); It.GLOBSTAR = ee; @@ -33348,7 +33349,7 @@ var DarkMode = __webpack_require__(2675); ;// CONCATENATED MODULE: ./src/views/Options/DarkModeButton.js function DarkModeButton(){var _useDarkMode=useDarkMode(),darkMode=_useDarkMode.darkMode,toggleDarkMode=_useDarkMode.toggleDarkMode;return/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{onClick:toggleDarkMode,color:"inherit",children:darkMode?/*#__PURE__*/(0,jsx_runtime.jsx)(LightMode/* default */.Z,{}):/*#__PURE__*/(0,jsx_runtime.jsx)(DarkMode/* default */.Z,{})});} ;// CONCATENATED MODULE: ./src/views/Popup/Header.js -function Header(_ref){var setShowPopup=_ref.setShowPopup;var handleHomepage=function handleHomepage(){window.open("https://github.com/fishjar/kiss-translator","_blank");};return/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",justifyContent:"flex-start",alignItems:"center",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{onClick:handleHomepage,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Home/* default */.Z,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Typography_Typography,{component:"div",sx:{userSelect:"none",WebkitUserSelect:"none",fontWeight:"bold"},children:"".concat("KISS Translator"," v").concat("1.7.15")})]}),setShowPopup?/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{onClick:function onClick(){setShowPopup(false);},children:/*#__PURE__*/(0,jsx_runtime.jsx)(Close/* default */.Z,{})}):/*#__PURE__*/(0,jsx_runtime.jsx)(DarkModeButton,{})]});} +function Header(_ref){var setShowPopup=_ref.setShowPopup;var handleHomepage=function handleHomepage(){window.open("https://github.com/fishjar/kiss-translator","_blank");};return/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",justifyContent:"flex-start",alignItems:"center",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{onClick:handleHomepage,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Home/* default */.Z,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Typography_Typography,{component:"div",sx:{userSelect:"none",WebkitUserSelect:"none",fontWeight:"bold"},children:"".concat("KISS Translator"," v").concat("1.7.16")})]}),setShowPopup?/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{onClick:function onClick(){setShowPopup(false);},children:/*#__PURE__*/(0,jsx_runtime.jsx)(Close/* default */.Z,{})}):/*#__PURE__*/(0,jsx_runtime.jsx)(DarkModeButton,{})]});} ;// CONCATENATED MODULE: ./src/libs/iframe.js var isIframe=window.self!==window.top;var sendIframeMsg=function sendIframeMsg(action,args){document.querySelectorAll("iframe").forEach(function(iframe){iframe.contentWindow.postMessage({action:action,args:args},"*");});};var sendParentMsg=function sendParentMsg(action,args){window.parent.postMessage({action:action,args:args},"*");}; ;// CONCATENATED MODULE: ./src/libs/webfix.js @@ -33391,8 +33392,11 @@ var _fixerMap;/** * @param {*} url * @returns */var loadOrFetchWebfix=/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(url){var sites;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=3;return getWebfix(url);case 3:sites=_context2.sent;if(!(sites!==null&&sites!==void 0&&sites.length)){_context2.next=6;break;}return _context2.abrupt("return",sites);case 6:return _context2.abrupt("return",syncWebfix(url));case 9:_context2.prev=9;_context2.t0=_context2["catch"](0);console.log("[load webfix]",_context2.t0.message);return _context2.abrupt("return",DEFAULT_SITES);case 13:case"end":return _context2.stop();}},_callee2,null,[[0,9]]);}));return function loadOrFetchWebfix(_x2){return _ref2.apply(this,arguments);};}();/** - * 匹配站点 - */function runWebfix(_x3){return _runWebfix.apply(this,arguments);}function _runWebfix(){_runWebfix=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee3(_ref3){var injectWebfix,href,userSites,subSites,sites,i,site;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:injectWebfix=_ref3.injectWebfix;_context3.prev=1;if(injectWebfix){_context3.next=4;break;}return _context3.abrupt("return");case 4:href=document.location.href;_context3.next=7;return storage_getWebfixRulesWithDefault();case 7:userSites=_context3.sent;_context3.next=10;return loadOrFetchWebfix("https://fishjar.github.io/kiss-rules/kiss-webfix.json");case 10:subSites=_context3.sent;sites=[].concat((0,toConsumableArray/* default */.Z)(userSites),(0,toConsumableArray/* default */.Z)(subSites));i=0;case 13:if(!(iinterval)){_context4.next=15;break;}_context4.next=11;re * @param {*} rules * @param {string} href * @returns - */var matchRule=/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(href,_ref){var _rule$selector;var _ref$injectRules,injectRules,_ref$subrulesList,subrulesList,_ref$owSubrule,owSubrule,rules,selectedSub,mixRule,subRules,rule,globalRule,_rule$bgColor,_rule$textDiyStyle;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_ref$injectRules=_ref.injectRules,injectRules=_ref$injectRules===void 0?true:_ref$injectRules,_ref$subrulesList=_ref.subrulesList,subrulesList=_ref$subrulesList===void 0?DEFAULT_SUBRULES_LIST:_ref$subrulesList,_ref$owSubrule=_ref.owSubrule,owSubrule=_ref$owSubrule===void 0?DEFAULT_OW_RULE:_ref$owSubrule;_context.next=3;return getRulesWithDefault();case 3:rules=_context.sent;if(!injectRules){_context.next=20;break;}_context.prev=5;selectedSub=subrulesList.find(function(item){return item.selected;});if(!(selectedSub!==null&&selectedSub!==void 0&&selectedSub.url)){_context.next=15;break;}mixRule={};Object.entries(owSubrule).filter(function(_ref3){var _ref4=(0,slicedToArray/* default */.Z)(_ref3,2),key=_ref4[0],val=_ref4[1];if(owSubrule.textStyle===REMAIN_KEY&&(key==="bgColor"||key==="textDiyStyle")){return false;}return val!==REMAIN_KEY;}).forEach(function(_ref5){var _ref6=(0,slicedToArray/* default */.Z)(_ref5,2),key=_ref6[0],val=_ref6[1];mixRule[key]=val;});_context.next=12;return loadOrFetchSubRules(selectedSub.url);case 12:subRules=_context.sent;subRules=subRules.map(function(item){return _objectSpread2(_objectSpread2({},item),mixRule);});rules.splice.apply(rules,[-1,0].concat((0,toConsumableArray/* default */.Z)(subRules)));case 15:_context.next=20;break;case 17:_context.prev=17;_context.t0=_context["catch"](5);console.log("[load injectRules]",_context.t0);case 20:rule=rules.find(function(r){return r.pattern.split(",").some(function(p){return isMatch(href,p.trim());});});globalRule=rules.find(function(r){return r.pattern===GLOBAL_KEY;})||GLOBLA_RULE;if(rule){_context.next=24;break;}return _context.abrupt("return",globalRule);case 24:rule.selector=((_rule$selector=rule.selector)===null||_rule$selector===void 0?void 0:_rule$selector.trim())||globalRule.selector;if(rule.textStyle===GLOBAL_KEY){rule.textStyle=globalRule.textStyle;rule.bgColor=globalRule.bgColor;rule.textDiyStyle=globalRule.textDiyStyle;}else{rule.bgColor=((_rule$bgColor=rule.bgColor)===null||_rule$bgColor===void 0?void 0:_rule$bgColor.trim())||globalRule.bgColor;rule.textDiyStyle=((_rule$textDiyStyle=rule.textDiyStyle)===null||_rule$textDiyStyle===void 0?void 0:_rule$textDiyStyle.trim())||globalRule.textDiyStyle;}["translator","fromLang","toLang","transOpen"].forEach(function(key){if(rule[key]===GLOBAL_KEY){rule[key]=globalRule[key];}});return _context.abrupt("return",rule);case 28:case"end":return _context.stop();}},_callee,null,[[5,17]]);}));return function matchRule(_x,_x2){return _ref2.apply(this,arguments);};}();/** + */var matchRule=/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(href,_ref){var _rule$selector,_rule$keepSelector;var _ref$injectRules,injectRules,_ref$subrulesList,subrulesList,_ref$owSubrule,owSubrule,rules,selectedSub,mixRule,subRules,rule,globalRule,_rule$bgColor,_rule$textDiyStyle;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_ref$injectRules=_ref.injectRules,injectRules=_ref$injectRules===void 0?true:_ref$injectRules,_ref$subrulesList=_ref.subrulesList,subrulesList=_ref$subrulesList===void 0?DEFAULT_SUBRULES_LIST:_ref$subrulesList,_ref$owSubrule=_ref.owSubrule,owSubrule=_ref$owSubrule===void 0?DEFAULT_OW_RULE:_ref$owSubrule;_context.next=3;return getRulesWithDefault();case 3:rules=_context.sent;if(!injectRules){_context.next=20;break;}_context.prev=5;selectedSub=subrulesList.find(function(item){return item.selected;});if(!(selectedSub!==null&&selectedSub!==void 0&&selectedSub.url)){_context.next=15;break;}mixRule={};Object.entries(owSubrule).filter(function(_ref3){var _ref4=(0,slicedToArray/* default */.Z)(_ref3,2),key=_ref4[0],val=_ref4[1];if(owSubrule.textStyle===REMAIN_KEY&&(key==="bgColor"||key==="textDiyStyle")){return false;}return val!==REMAIN_KEY;}).forEach(function(_ref5){var _ref6=(0,slicedToArray/* default */.Z)(_ref5,2),key=_ref6[0],val=_ref6[1];mixRule[key]=val;});_context.next=12;return loadOrFetchSubRules(selectedSub.url);case 12:subRules=_context.sent;subRules=subRules.map(function(item){return _objectSpread2(_objectSpread2({},item),mixRule);});rules.splice.apply(rules,[-1,0].concat((0,toConsumableArray/* default */.Z)(subRules)));case 15:_context.next=20;break;case 17:_context.prev=17;_context.t0=_context["catch"](5);console.log("[load injectRules]",_context.t0);case 20:rule=rules.find(function(r){return r.pattern.split(",").some(function(p){return isMatch(href,p.trim());});});globalRule=rules.find(function(r){return r.pattern===GLOBAL_KEY;})||GLOBLA_RULE;if(rule){_context.next=24;break;}return _context.abrupt("return",globalRule);case 24:rule.selector=((_rule$selector=rule.selector)===null||_rule$selector===void 0?void 0:_rule$selector.trim())||globalRule.selector;rule.keepSelector=((_rule$keepSelector=rule.keepSelector)===null||_rule$keepSelector===void 0?void 0:_rule$keepSelector.trim())||globalRule.keepSelector;if(rule.textStyle===GLOBAL_KEY){rule.textStyle=globalRule.textStyle;rule.bgColor=globalRule.bgColor;rule.textDiyStyle=globalRule.textDiyStyle;}else{rule.bgColor=((_rule$bgColor=rule.bgColor)===null||_rule$bgColor===void 0?void 0:_rule$bgColor.trim())||globalRule.bgColor;rule.textDiyStyle=((_rule$textDiyStyle=rule.textDiyStyle)===null||_rule$textDiyStyle===void 0?void 0:_rule$textDiyStyle.trim())||globalRule.textDiyStyle;}["translator","fromLang","toLang","transOpen"].forEach(function(key){if(rule[key]===GLOBAL_KEY){rule[key]=globalRule[key];}});return _context.abrupt("return",rule);case 29:case"end":return _context.stop();}},_callee,null,[[5,17]]);}));return function matchRule(_x,_x2){return _ref2.apply(this,arguments);};}();/** * 检查过滤rules * @param {*} rules * @returns - */var checkRules=function checkRules(rules){if(type(rules)==="string"){rules=JSON.parse(rules);}if(type(rules)!=="array"){throw new Error("data error");}var fromLangs=OPT_LANGS_FROM.map(function(item){return item[0];});var toLangs=OPT_LANGS_TO.map(function(item){return item[0];});var patternSet=new Set();rules=rules.filter(function(rule){return type(rule)==="object";}).filter(function(_ref7){var pattern=_ref7.pattern;if(type(pattern)!=="string"||patternSet.has(pattern.trim())){return false;}patternSet.add(pattern.trim());return true;}).map(function(_ref8){var pattern=_ref8.pattern,selector=_ref8.selector,translator=_ref8.translator,fromLang=_ref8.fromLang,toLang=_ref8.toLang,textStyle=_ref8.textStyle,transOpen=_ref8.transOpen,bgColor=_ref8.bgColor,textDiyStyle=_ref8.textDiyStyle;return{pattern:pattern.trim(),selector:type(selector)==="string"?selector:"",bgColor:type(bgColor)==="string"?bgColor:"",textDiyStyle:type(textDiyStyle)==="string"?textDiyStyle:"",translator:matchValue([GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(OPT_TRANS_ALL)),translator),fromLang:matchValue([GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(fromLangs)),fromLang),toLang:matchValue([GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(toLangs)),toLang),textStyle:matchValue([GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(OPT_STYLE_ALL)),textStyle),transOpen:matchValue([GLOBAL_KEY,"true","false"],transOpen)};});return rules;};/** + */var checkRules=function checkRules(rules){if(type(rules)==="string"){rules=JSON.parse(rules);}if(type(rules)!=="array"){throw new Error("data error");}var fromLangs=OPT_LANGS_FROM.map(function(item){return item[0];});var toLangs=OPT_LANGS_TO.map(function(item){return item[0];});var patternSet=new Set();rules=rules.filter(function(rule){return type(rule)==="object";}).filter(function(_ref7){var pattern=_ref7.pattern;if(type(pattern)!=="string"||patternSet.has(pattern.trim())){return false;}patternSet.add(pattern.trim());return true;}).map(function(_ref8){var pattern=_ref8.pattern,selector=_ref8.selector,keepSelector=_ref8.keepSelector,translator=_ref8.translator,fromLang=_ref8.fromLang,toLang=_ref8.toLang,textStyle=_ref8.textStyle,transOpen=_ref8.transOpen,bgColor=_ref8.bgColor,textDiyStyle=_ref8.textDiyStyle;return{pattern:pattern.trim(),selector:type(selector)==="string"?selector:"",keepSelector:type(keepSelector)==="string"?keepSelector:"",bgColor:type(bgColor)==="string"?bgColor:"",textDiyStyle:type(textDiyStyle)==="string"?textDiyStyle:"",translator:matchValue([GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(OPT_TRANS_ALL)),translator),fromLang:matchValue([GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(fromLangs)),fromLang),toLang:matchValue([GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(toLangs)),toLang),textStyle:matchValue([GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(OPT_STYLE_ALL)),textStyle),transOpen:matchValue([GLOBAL_KEY,"true","false"],transOpen)};});return rules;};/** * 保存或更新rule * @param {*} newRule */var saveRule=/*#__PURE__*/function(){var _ref9=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(newRule){var rules,rule;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return getRulesWithDefault();case 2:rules=_context2.sent;rule=rules.find(function(item){return isMatch(newRule.pattern,item.pattern);});if(rule&&rule.pattern!==GLOBAL_KEY){Object.assign(rule,_objectSpread2(_objectSpread2({},newRule),{},{pattern:rule.pattern}));}else{rules.unshift(newRule);}_context2.next=7;return setRules(rules);case 7:trySyncRules();case 8:case"end":return _context2.stop();}},_callee2);}));return function saveRule(_x3){return _ref9.apply(this,arguments);};}(); @@ -33438,7 +33442,7 @@ if(!(now-subRulesSyncAt>interval)){_context4.next=15;break;}_context4.next=11;re * @returns */var tryDetectLang=/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(q){var useRemote,lang,_browser$i18n,_res$languages,_res$languages$,res,_args2=arguments;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:useRemote=_args2.length>1&&_args2[1]!==undefined?_args2[1]:false;lang="";if(!useRemote){_context2.next=12;break;}_context2.prev=3;_context2.next=6;return apiBaiduLangdetect(q);case 6:lang=_context2.sent;_context2.next=12;break;case 9:_context2.prev=9;_context2.t0=_context2["catch"](3);console.log("[detect lang remote]",_context2.t0.message);case 12:if(lang){_context2.next=23;break;}_context2.prev=13;_context2.next=16;return browser===null||browser===void 0?void 0:(_browser$i18n=browser.i18n)===null||_browser$i18n===void 0?void 0:_browser$i18n.detectLanguage(q);case 16:res=_context2.sent;lang=res===null||res===void 0?void 0:(_res$languages=res.languages)===null||_res$languages===void 0?void 0:(_res$languages$=_res$languages[0])===null||_res$languages$===void 0?void 0:_res$languages$.language;_context2.next=23;break;case 20:_context2.prev=20;_context2.t1=_context2["catch"](13);console.log("[detect lang local]",_context2.t1.message);case 23:return _context2.abrupt("return",lang);case 24:case"end":return _context2.stop();}},_callee2,null,[[3,9],[13,20]]);}));return function tryDetectLang(_x){return _ref2.apply(this,arguments);};}(); ;// CONCATENATED MODULE: ./src/views/Popup/index.js -function Popup(_ref){var setShowPopup=_ref.setShowPopup,tran=_ref.translator;var i18n=useI18n();var _useState=(0,react.useState)(tran===null||tran===void 0?void 0:tran.rule),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),rule=_useState2[0],setRule=_useState2[1];var handleOpenSetting=function handleOpenSetting(){if(!tran){browser===null||browser===void 0?void 0:browser.runtime.openOptionsPage();}else if(isExt){sendBgMsg(MSG_OPEN_OPTIONS);}else{window.open("https://fishjar.github.io/kiss-translator/options.html","_blank");}setShowPopup&&setShowPopup(false);};var handleTransToggle=/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(e){return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.prev=0;setRule(_objectSpread2(_objectSpread2({},rule),{},{transOpen:e.target.checked?"true":"false"}));if(tran){_context.next=7;break;}_context.next=5;return sendTabMsg(MSG_TRANS_TOGGLE);case 5:_context.next=9;break;case 7:tran.toggle();sendIframeMsg(MSG_TRANS_TOGGLE);case 9:_context.next=14;break;case 11:_context.prev=11;_context.t0=_context["catch"](0);console.log("[toggle trans]",_context.t0);case 14:case"end":return _context.stop();}},_callee,null,[[0,11]]);}));return function handleTransToggle(_x){return _ref2.apply(this,arguments);};}();var handleChange=/*#__PURE__*/function(){var _ref3=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(e){var _e$target,name,value;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_e$target=e.target,name=_e$target.name,value=_e$target.value;setRule(function(pre){return _objectSpread2(_objectSpread2({},pre),{},(0,defineProperty/* default */.Z)({},name,value));});if(tran){_context2.next=8;break;}_context2.next=6;return sendTabMsg(MSG_TRANS_PUTRULE,(0,defineProperty/* default */.Z)({},name,value));case 6:_context2.next=10;break;case 8:tran.updateRule((0,defineProperty/* default */.Z)({},name,value));sendIframeMsg(MSG_TRANS_PUTRULE,(0,defineProperty/* default */.Z)({},name,value));case 10:_context2.next=15;break;case 12:_context2.prev=12;_context2.t0=_context2["catch"](0);console.log("[update rule]",_context2.t0);case 15:case"end":return _context2.stop();}},_callee2,null,[[0,12]]);}));return function handleChange(_x2){return _ref3.apply(this,arguments);};}();var handleClearCache=function handleClearCache(){tryClearCaches();};var handleSaveRule=/*#__PURE__*/function(){var _ref4=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee3(){var href,tab,newRule;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.prev=0;href=window.location.href;if(tran){_context3.next=7;break;}_context3.next=5;return getTabInfo();case 5:tab=_context3.sent;href=tab.url;case 7:newRule=_objectSpread2(_objectSpread2({},rule),{},{pattern:href});if(isExt&&tran){sendBgMsg(MSG_SAVE_RULE,newRule);}else{saveRule(newRule);}_context3.next=14;break;case 11:_context3.prev=11;_context3.t0=_context3["catch"](0);console.log("[save rule]",_context3.t0);case 14:case"end":return _context3.stop();}},_callee3,null,[[0,11]]);}));return function handleSaveRule(){return _ref4.apply(this,arguments);};}();(0,react.useEffect)(function(){if(tran){return;}asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee4(){var res;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:_context4.prev=0;_context4.next=3;return sendTabMsg(MSG_TRANS_GETRULE);case 3:res=_context4.sent;if(!res.error){setRule(res.data);}_context4.next=10;break;case 7:_context4.prev=7;_context4.t0=_context4["catch"](0);console.log("[query rule]",_context4.t0);case 10:case"end":return _context4.stop();}},_callee4,null,[[0,7]]);}))();},[tran]);if(!rule){return/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{minWidth:300,children:[!tran&&/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Header,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(Stack_Stack,{sx:{p:2},spacing:3,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:handleOpenSetting,children:i18n("setting")})})]});}var transOpen=rule.transOpen,translator=rule.translator,fromLang=rule.fromLang,toLang=rule.toLang,textStyle=rule.textStyle,bgColor=rule.bgColor;return/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{minWidth:300,children:[!tran&&/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Header,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{sx:{p:2},spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(FormControlLabel_FormControlLabel,{control:/*#__PURE__*/(0,jsx_runtime.jsx)(Switch_Switch,{checked:transOpen==="true",onChange:handleTransToggle}),label:i18n("translate_alt")}),!isExt&&/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:handleClearCache,children:i18n("clear_cache")})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},size:"small",value:translator,name:"translator",label:i18n("translate_service"),onChange:handleChange,children:OPT_TRANS_ALL.map(function(item){return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:item,children:item},item);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},size:"small",value:fromLang,name:"fromLang",label:i18n("from_lang"),onChange:handleChange,children:OPT_LANGS_FROM.map(function(_ref6){var _ref7=(0,slicedToArray/* default */.Z)(_ref6,2),lang=_ref7[0],name=_ref7[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},size:"small",value:toLang,name:"toLang",label:i18n("to_lang"),onChange:handleChange,children:OPT_LANGS_TO.map(function(_ref8){var _ref9=(0,slicedToArray/* default */.Z)(_ref8,2),lang=_ref9[0],name=_ref9[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},size:"small",value:textStyle,name:"textStyle",label:i18n("text_style_alt"),onChange:handleChange,children:OPT_STYLE_ALL.map(function(item){return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:item,children:i18n(item)},item);})}),OPT_STYLE_USE_COLOR.includes(textStyle)&&/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",name:"bgColor",value:bgColor,label:i18n("bg_color"),onChange:handleChange}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:handleSaveRule,children:i18n("save_rule")}),/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:handleOpenSetting,children:i18n("setting")})]})]})]});} +function Popup(_ref){var setShowPopup=_ref.setShowPopup,tran=_ref.translator;var i18n=useI18n();var _useState=(0,react.useState)(tran===null||tran===void 0?void 0:tran.rule),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),rule=_useState2[0],setRule=_useState2[1];var handleOpenSetting=function handleOpenSetting(){if(!tran){browser===null||browser===void 0?void 0:browser.runtime.openOptionsPage();}else if(isExt){sendBgMsg(MSG_OPEN_OPTIONS);}else{window.open("https://fishjar.github.io/kiss-translator/options.html","_blank");}setShowPopup&&setShowPopup(false);};var handleTransToggle=/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(e){return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.prev=0;setRule(_objectSpread2(_objectSpread2({},rule),{},{transOpen:e.target.checked?"true":"false"}));if(tran){_context.next=7;break;}_context.next=5;return sendTabMsg(MSG_TRANS_TOGGLE);case 5:_context.next=9;break;case 7:tran.toggle();sendIframeMsg(MSG_TRANS_TOGGLE);case 9:_context.next=14;break;case 11:_context.prev=11;_context.t0=_context["catch"](0);console.log("[toggle trans]",_context.t0);case 14:case"end":return _context.stop();}},_callee,null,[[0,11]]);}));return function handleTransToggle(_x){return _ref2.apply(this,arguments);};}();var handleChange=/*#__PURE__*/function(){var _ref3=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(e){var _e$target,name,value;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_e$target=e.target,name=_e$target.name,value=_e$target.value;setRule(function(pre){return _objectSpread2(_objectSpread2({},pre),{},(0,defineProperty/* default */.Z)({},name,value));});if(tran){_context2.next=8;break;}_context2.next=6;return sendTabMsg(MSG_TRANS_PUTRULE,(0,defineProperty/* default */.Z)({},name,value));case 6:_context2.next=10;break;case 8:tran.updateRule((0,defineProperty/* default */.Z)({},name,value));sendIframeMsg(MSG_TRANS_PUTRULE,(0,defineProperty/* default */.Z)({},name,value));case 10:_context2.next=15;break;case 12:_context2.prev=12;_context2.t0=_context2["catch"](0);console.log("[update rule]",_context2.t0);case 15:case"end":return _context2.stop();}},_callee2,null,[[0,12]]);}));return function handleChange(_x2){return _ref3.apply(this,arguments);};}();var handleClearCache=function handleClearCache(){tryClearCaches();};var handleSaveRule=/*#__PURE__*/function(){var _ref4=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee3(){var href,tab,newRule;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.prev=0;href=window.location.href;if(tran){_context3.next=7;break;}_context3.next=5;return getTabInfo();case 5:tab=_context3.sent;href=tab.url;case 7:newRule=_objectSpread2(_objectSpread2({},rule),{},{pattern:href});if(isExt&&tran){sendBgMsg(MSG_SAVE_RULE,newRule);}else{saveRule(newRule);}_context3.next=14;break;case 11:_context3.prev=11;_context3.t0=_context3["catch"](0);console.log("[save rule]",_context3.t0);case 14:case"end":return _context3.stop();}},_callee3,null,[[0,11]]);}));return function handleSaveRule(){return _ref4.apply(this,arguments);};}();(0,react.useEffect)(function(){if(tran){return;}asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee4(){var res;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:_context4.prev=0;_context4.next=3;return sendTabMsg(MSG_TRANS_GETRULE);case 3:res=_context4.sent;if(!res.error){setRule(res.data);}_context4.next=10;break;case 7:_context4.prev=7;_context4.t0=_context4["catch"](0);console.log("[query rule]",_context4.t0);case 10:case"end":return _context4.stop();}},_callee4,null,[[0,7]]);}))();},[tran]);if(!rule){return/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{minWidth:300,children:[!tran&&/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Header,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(Stack_Stack,{sx:{p:2},spacing:3,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:handleOpenSetting,children:i18n("setting")})})]});}var transOpen=rule.transOpen,translator=rule.translator,fromLang=rule.fromLang,toLang=rule.toLang,textStyle=rule.textStyle;return/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{minWidth:300,children:[!tran&&/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Header,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{sx:{p:2},spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Stack_Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:2,children:/*#__PURE__*/(0,jsx_runtime.jsx)(FormControlLabel_FormControlLabel,{control:/*#__PURE__*/(0,jsx_runtime.jsx)(Switch_Switch,{checked:transOpen==="true",onChange:handleTransToggle}),label:i18n("translate_alt")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},size:"small",value:translator,name:"translator",label:i18n("translate_service"),onChange:handleChange,children:OPT_TRANS_ALL.map(function(item){return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:item,children:item},item);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},size:"small",value:fromLang,name:"fromLang",label:i18n("from_lang"),onChange:handleChange,children:OPT_LANGS_FROM.map(function(_ref6){var _ref7=(0,slicedToArray/* default */.Z)(_ref6,2),lang=_ref7[0],name=_ref7[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},size:"small",value:toLang,name:"toLang",label:i18n("to_lang"),onChange:handleChange,children:OPT_LANGS_TO.map(function(_ref8){var _ref9=(0,slicedToArray/* default */.Z)(_ref8,2),lang=_ref9[0],name=_ref9[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},size:"small",value:textStyle,name:"textStyle",label:i18n("text_style_alt"),onChange:handleChange,children:OPT_STYLE_ALL.map(function(item){return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:item,children:i18n(item)},item);})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:handleSaveRule,children:i18n("save_rule")}),!isExt&&/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:handleClearCache,children:i18n("clear_cache")}),/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:handleOpenSetting,children:i18n("setting")})]})]})]});} ;// CONCATENATED MODULE: ./src/libs/shortcut.js /** * 键盘快捷键监听 @@ -33446,7 +33450,7 @@ function Popup(_ref){var setShowPopup=_ref.setShowPopup,tran=_ref.translator;var * @param {*} target * @param {*} timeout * @returns - */var shortcutListener=function shortcutListener(fn){var target=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document;var timeout=arguments.length>2&&arguments[2]!==undefined?arguments[2]:3000;var allkeys=new Set();var curkeys=new Set();var timer=null;var handleKeydown=function handleKeydown(e){timer&&clearTimeout(timer);timer=setTimeout(function(){allkeys.clear();curkeys.clear();clearTimeout(timer);timer=null;},timeout);if(e.code){allkeys.add(e.code);curkeys.add(e.code);fn((0,toConsumableArray/* default */.Z)(curkeys),(0,toConsumableArray/* default */.Z)(allkeys));}};var handleKeyup=function handleKeyup(e){curkeys.delete(e.code);if(curkeys.size===0){fn((0,toConsumableArray/* default */.Z)(curkeys),(0,toConsumableArray/* default */.Z)(allkeys));allkeys.clear();}};target.addEventListener("keydown",handleKeydown);target.addEventListener("keyup",handleKeyup);return function(){if(timer){clearTimeout(timer);timer=null;}target.removeEventListener("keydown",handleKeydown);target.removeEventListener("keyup",handleKeyup);};};/** + */var shortcutListener=function shortcutListener(fn){var target=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document;var timeout=arguments.length>2&&arguments[2]!==undefined?arguments[2]:3000;var allkeys=new Set();var curkeys=new Set();var timer=null;var handleKeydown=function handleKeydown(e){timer&&clearTimeout(timer);timer=setTimeout(function(){allkeys.clear();curkeys.clear();clearTimeout(timer);timer=null;},timeout);if(e.code){allkeys.add(e.code);curkeys.add(e.code);fn((0,toConsumableArray/* default */.Z)(curkeys),(0,toConsumableArray/* default */.Z)(allkeys));}};var handleKeyup=function handleKeyup(e){curkeys.delete(e.code);if(curkeys.size===0){fn((0,toConsumableArray/* default */.Z)(curkeys),(0,toConsumableArray/* default */.Z)(allkeys));allkeys.clear();}};target.addEventListener("keydown",handleKeydown,true);target.addEventListener("keyup",handleKeyup,true);return function(){if(timer){clearTimeout(timer);timer=null;}target.removeEventListener("keydown",handleKeydown);target.removeEventListener("keyup",handleKeyup);};};/** * 注册键盘快捷键 * @param {*} targetKeys * @param {*} fn @@ -33464,7 +33468,7 @@ function Popup(_ref){var setShowPopup=_ref.setShowPopup,tran=_ref.translator;var ;// CONCATENATED MODULE: ./src/views/Action/index.js function Action(_ref){var _fab$x,_fab$y;var translator=_ref.translator,fab=_ref.fab;var fabWidth=40;var _useState=(0,react.useState)(false),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),showPopup=_useState2[0],setShowPopup=_useState2[1];var _useState3=(0,react.useState)({w:window.innerWidth,h:window.innerHeight}),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),windowSize=_useState4[0],setWindowSize=_useState4[1];var _useState5=(0,react.useState)(false),_useState6=(0,slicedToArray/* default */.Z)(_useState5,2),moved=_useState6[0],setMoved=_useState6[1];var handleWindowResize=(0,react.useMemo)(function(){return debounce(function(){setWindowSize({w:window.innerWidth,h:window.innerHeight});});},[]);var handleWindowClick=function handleWindowClick(e){setShowPopup(false);};var handleStart=(0,react.useCallback)(function(){setMoved(false);},[]);var handleMove=(0,react.useCallback)(function(){setMoved(true);},[]);(0,react.useEffect)(function(){if(!isGm){return;}// 注册快捷键 var shortcuts=translator.setting.shortcuts||DEFAULT_SHORTCUTS;var clearShortcuts=[shortcutRegister(shortcuts[OPT_SHORTCUT_TRANSLATE],function(){translator.toggle();sendIframeMsg(MSG_TRANS_TOGGLE);setShowPopup(false);}),shortcutRegister(shortcuts[OPT_SHORTCUT_STYLE],function(){translator.toggleStyle();sendIframeMsg(MSG_TRANS_TOGGLE_STYLE);setShowPopup(false);}),shortcutRegister(shortcuts[OPT_SHORTCUT_POPUP],function(){setShowPopup(function(pre){return!pre;});}),shortcutRegister(shortcuts[OPT_SHORTCUT_SETTING],function(){window.open("https://fishjar.github.io/kiss-translator/options.html","_blank");})];return function(){clearShortcuts.forEach(function(fn){fn();});};},[translator]);(0,react.useEffect)(function(){if(!isGm){return;}// 注册菜单 -try{var menuCommandIds=[];var _translator$setting$c=translator.setting.contextMenus,contextMenus=_translator$setting$c===void 0?true:_translator$setting$c;contextMenus&&menuCommandIds.push(GM.registerMenuCommand("Toggle Translate (Alt+q)",function(event){translator.toggle();sendIframeMsg(MSG_TRANS_TOGGLE);setShowPopup(false);},"Q"),GM.registerMenuCommand("Toggle Style (Alt+c)",function(event){translator.toggleStyle();sendIframeMsg(MSG_TRANS_TOGGLE_STYLE);setShowPopup(false);},"C"),GM.registerMenuCommand("Open Menu (Alt+k)",function(event){setShowPopup(function(pre){return!pre;});},"K"),GM.registerMenuCommand("Open Setting (Alt+o)",function(event){window.open("https://fishjar.github.io/kiss-translator/options.html","_blank");},"O"));return function(){menuCommandIds.forEach(function(id){GM.unregisterMenuCommand(id);});};}catch(err){console.log("[registerMenuCommand]",err);}},[translator]);(0,react.useEffect)(function(){window.addEventListener("resize",handleWindowResize);return function(){window.removeEventListener("resize",handleWindowResize);};},[handleWindowResize]);(0,react.useEffect)(function(){window.addEventListener("click",handleWindowClick);return function(){window.removeEventListener("click",handleWindowClick);};},[]);var popProps=(0,react.useMemo)(function(){var width=Math.min(windowSize.w,300);var height=Math.min(windowSize.h,442);var left=(windowSize.w-width)/2;var top=(windowSize.h-height)/2;return{windowSize:windowSize,width:width,height:height,left:left,top:top};},[windowSize]);var fabProps={windowSize:windowSize,width:fabWidth,height:fabWidth,left:(_fab$x=fab.x)!==null&&_fab$x!==void 0?_fab$x:-fabWidth,top:(_fab$y=fab.y)!==null&&_fab$y!==void 0?_fab$y:windowSize.h/2};return/*#__PURE__*/(0,jsx_runtime.jsx)(SettingProvider,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Theme,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Draggable,_objectSpread2(_objectSpread2({},popProps),{},{show:showPopup,onStart:handleStart,onMove:handleMove,usePaper:true,handler:/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{style:{cursor:"move"},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Header,{setShowPopup:setShowPopup}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{})]}),children:showPopup&&/*#__PURE__*/(0,jsx_runtime.jsx)(Popup,{setShowPopup:setShowPopup,translator:translator})}),"pop"),/*#__PURE__*/(0,jsx_runtime.jsx)(Draggable,_objectSpread2(_objectSpread2({snapEdge:true},fabProps),{},{show:fab.isHide?false:!showPopup,onStart:handleStart,onMove:handleMove,handler:/*#__PURE__*/(0,jsx_runtime.jsx)(Fab_Fab,{size:"small",color:"primary",onClick:function onClick(e){if(!moved){setShowPopup(function(pre){return!pre;});}},children:/*#__PURE__*/(0,jsx_runtime.jsx)(Translate/* default */.Z,{sx:{width:24,height:24}})})}),"fab")]})});} +try{var menuCommandIds=[];var _translator$setting$c=translator.setting.contextMenus,contextMenus=_translator$setting$c===void 0?true:_translator$setting$c;contextMenus&&menuCommandIds.push(GM.registerMenuCommand("Toggle Translate (Alt+Q)",function(event){translator.toggle();sendIframeMsg(MSG_TRANS_TOGGLE);setShowPopup(false);},"Q"),GM.registerMenuCommand("Toggle Style (Alt+C)",function(event){translator.toggleStyle();sendIframeMsg(MSG_TRANS_TOGGLE_STYLE);setShowPopup(false);},"C"),GM.registerMenuCommand("Open Menu (Alt+K)",function(event){setShowPopup(function(pre){return!pre;});},"K"),GM.registerMenuCommand("Open Setting",function(event){window.open("https://fishjar.github.io/kiss-translator/options.html","_blank");},"O"));return function(){menuCommandIds.forEach(function(id){GM.unregisterMenuCommand(id);});};}catch(err){console.log("[registerMenuCommand]",err);}},[translator]);(0,react.useEffect)(function(){window.addEventListener("resize",handleWindowResize);return function(){window.removeEventListener("resize",handleWindowResize);};},[handleWindowResize]);(0,react.useEffect)(function(){window.addEventListener("click",handleWindowClick);return function(){window.removeEventListener("click",handleWindowClick);};},[]);var popProps=(0,react.useMemo)(function(){var width=Math.min(windowSize.w,300);var height=Math.min(windowSize.h,442);var left=(windowSize.w-width)/2;var top=(windowSize.h-height)/2;return{windowSize:windowSize,width:width,height:height,left:left,top:top};},[windowSize]);var fabProps={windowSize:windowSize,width:fabWidth,height:fabWidth,left:(_fab$x=fab.x)!==null&&_fab$x!==void 0?_fab$x:-fabWidth,top:(_fab$y=fab.y)!==null&&_fab$y!==void 0?_fab$y:windowSize.h/2};return/*#__PURE__*/(0,jsx_runtime.jsx)(SettingProvider,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Theme,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Draggable,_objectSpread2(_objectSpread2({},popProps),{},{show:showPopup,onStart:handleStart,onMove:handleMove,usePaper:true,handler:/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{style:{cursor:"move"},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Header,{setShowPopup:setShowPopup}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{})]}),children:showPopup&&/*#__PURE__*/(0,jsx_runtime.jsx)(Popup,{setShowPopup:setShowPopup,translator:translator})}),"pop"),/*#__PURE__*/(0,jsx_runtime.jsx)(Draggable,_objectSpread2(_objectSpread2({snapEdge:true},fabProps),{},{show:fab.isHide?false:!showPopup,onStart:handleStart,onMove:handleMove,handler:/*#__PURE__*/(0,jsx_runtime.jsx)(Fab_Fab,{size:"small",color:"primary",onClick:function onClick(e){if(!moved){setShowPopup(function(pre){return!pre;});}},children:/*#__PURE__*/(0,jsx_runtime.jsx)(Translate/* default */.Z,{sx:{width:24,height:24}})})}),"fab")]})});} ;// CONCATENATED MODULE: ./src/libs/svg.js var loadingSvg="\n\n \n \n \n \n \n \n \n \n \n\n"; ;// CONCATENATED MODULE: ./src/views/Content/LoadingIcon.js @@ -33486,11 +33490,11 @@ return/*#__PURE__*/(0,jsx_runtime.jsx)(LineSpan,{$lineStyle:"wavy",$lineColor:bg return/*#__PURE__*/(0,jsx_runtime.jsx)(FuzzySpan,{children:children});case OPT_STYLE_HIGHLIGHT:// 高亮 return/*#__PURE__*/(0,jsx_runtime.jsx)(HighlightSpan,{$bgColor:bgColor||DEFAULT_COLOR,children:children});case OPT_STYLE_BLOCKQUOTE:// 引用 return/*#__PURE__*/(0,jsx_runtime.jsx)(BlockquoteSpan,{$lineColor:bgColor||DEFAULT_COLOR,children:children});case OPT_STYLE_DIY:// 自定义 -return/*#__PURE__*/(0,jsx_runtime.jsx)(DiySpan,{$diyStyle:textDiyStyle,children:children});default:return/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:children});}}function Content(_ref2){var q=_ref2.q,translator=_ref2.translator;var _useState=(0,react.useState)(translator.rule),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),rule=_useState2[0],setRule=_useState2[1];var _useTranslate=useTranslate(q,rule,translator.setting),text=_useTranslate.text,sameLang=_useTranslate.sameLang,loading=_useTranslate.loading;var textStyle=rule.textStyle,_rule$bgColor=rule.bgColor,bgColor=_rule$bgColor===void 0?"":_rule$bgColor,_rule$textDiyStyle=rule.textDiyStyle,textDiyStyle=_rule$textDiyStyle===void 0?"":_rule$textDiyStyle;var _translator$setting$n=translator.setting.newlineLength,newlineLength=_translator$setting$n===void 0?TRANS_NEWLINE_LENGTH:_translator$setting$n;var handleKissEvent=function handleKissEvent(e){var _e$detail=e.detail,action=_e$detail.action,args=_e$detail.args;switch(action){case MSG_TRANS_CURRULE:setRule(args);break;default:}};(0,react.useEffect)(function(){window.addEventListener(translator.eventName,handleKissEvent);return function(){window.removeEventListener(translator.eventName,handleKissEvent);};},[translator.eventName]);if(loading){return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[q.length>=newlineLength?/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}):" ",/*#__PURE__*/(0,jsx_runtime.jsx)(LoadingIcon,{})]});}if(text&&!sameLang){return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[q.length>=newlineLength?/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}):" ",/*#__PURE__*/(0,jsx_runtime.jsx)(StyledSpan,{textStyle:textStyle,textDiyStyle:textDiyStyle,bgColor:bgColor,children:text})]});}} +return/*#__PURE__*/(0,jsx_runtime.jsx)(DiySpan,{$diyStyle:textDiyStyle,children:children});default:return/*#__PURE__*/(0,jsx_runtime.jsx)("span",{children:children});}}function Content(_ref2){var q=_ref2.q,keeps=_ref2.keeps,translator=_ref2.translator;var _useState=(0,react.useState)(translator.rule),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),rule=_useState2[0],setRule=_useState2[1];var _useTranslate=useTranslate(q,rule,translator.setting),text=_useTranslate.text,sameLang=_useTranslate.sameLang,loading=_useTranslate.loading;var textStyle=rule.textStyle,_rule$bgColor=rule.bgColor,bgColor=_rule$bgColor===void 0?"":_rule$bgColor,_rule$textDiyStyle=rule.textDiyStyle,textDiyStyle=_rule$textDiyStyle===void 0?"":_rule$textDiyStyle;var _translator$setting$n=translator.setting.newlineLength,newlineLength=_translator$setting$n===void 0?TRANS_NEWLINE_LENGTH:_translator$setting$n;var handleKissEvent=function handleKissEvent(e){var _e$detail=e.detail,action=_e$detail.action,args=_e$detail.args;switch(action){case MSG_TRANS_CURRULE:setRule(args);break;default:}};(0,react.useEffect)(function(){window.addEventListener(translator.eventName,handleKissEvent);return function(){window.removeEventListener(translator.eventName,handleKissEvent);};},[translator.eventName]);if(loading){return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[q.length>=newlineLength?/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}):" ",/*#__PURE__*/(0,jsx_runtime.jsx)(LoadingIcon,{})]});}if(!text||sameLang){return;}return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[q.length>=newlineLength?/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}):" ",/*#__PURE__*/(0,jsx_runtime.jsx)(StyledSpan,{textStyle:textStyle,textDiyStyle:textDiyStyle,bgColor:bgColor,children:keeps.length>0?/*#__PURE__*/(0,jsx_runtime.jsx)("span",{dangerouslySetInnerHTML:{__html:text.replace(/#(\d+)#/g,function(_,p){return keeps[parseInt(p)];})}}):text})]});} ;// CONCATENATED MODULE: ./src/libs/translator.js /** * 翻译类 - */var Translator=/*#__PURE__*/function(){function Translator(rule,setting){var _this2=this;_classCallCheck(this,Translator);this._rule={};this._setting={};this._rootNodes=new Set();this._tranNodes=new Map();this._skipNodeNames=[APP_LCNAME,"style","svg","img","audio","video","textarea","input","button","select","option","head","script","iframe"];this._eventName=utils_genEventName();this._mouseoverNode=null;// 显示 + */var Translator=/*#__PURE__*/function(){function Translator(rule,setting,fixerSetting){var _this2=this;_classCallCheck(this,Translator);this._rule={};this._setting={};this._fixerSetting=null;this._rootNodes=new Set();this._tranNodes=new Map();this._skipNodeNames=[APP_LCNAME,"style","svg","img","audio","video","textarea","input","button","select","option","head","script","iframe"];this._eventName=utils_genEventName();this._mouseoverNode=null;// 显示 this._interseObserver=new IntersectionObserver(function(intersections){intersections.forEach(function(intersection){if(intersection.isIntersecting){_this2._render(intersection.target);_this2._interseObserver.unobserve(intersection.target);}});},{threshold:0.1});// 变化 this._mutaObserver=new MutationObserver(function(mutations){mutations.forEach(function(mutation){if(!_this2._skipNodeNames.includes(mutation.target.localName)&&mutation.addedNodes.length>0){var nodes=Array.from(mutation.addedNodes).filter(function(node){if(_this2._skipNodeNames.includes(node.localName)||node.id===APP_LCNAME){return false;}return true;});if(nodes.length>0){// const rootNode = mutation.target.getRootNode(); // todo @@ -33509,7 +33513,8 @@ _this2._rootNodes.add(rootNode);_this2._rule.selector.split(";").map(function(it // } // } // ); -_this2._queryShadowNodes(inSelector,outNode.shadowRoot);}});}}else{_this2._queryFilter(selector,rootNode).forEach(function(item){if(!_this2._tranNodes.has(item)){_this2._tranNodes.set(item,"");}});}});};this._register=function(){if(_this2._rule.fromLang===_this2._rule.toLang){return;}// 搜索节点 +_this2._queryShadowNodes(inSelector,outNode.shadowRoot);}});}}else{_this2._queryFilter(selector,rootNode).forEach(function(item){if(!_this2._tranNodes.has(item)){_this2._tranNodes.set(item,"");}});}});};this._register=function(){if(_this2._rule.fromLang===_this2._rule.toLang){return;}// webfix +if(_this2._fixerSetting){runFixer(_this2._fixerSetting);}// 搜索节点 _this2._queryNodes();_this2._rootNodes.forEach(function(node){// 监听节点变化; _this2._mutaObserver.observe(node,{childList:true,subtree:true// characterData: true, });});if(!_this2._setting.mouseKey||_this2._setting.mouseKey===OPT_MOUSEKEY_DISABLE){// 监听节点显示 @@ -33527,21 +33532,23 @@ window.removeEventListener("keydown",_this2._handleKeydown);_this2._tranNodes.fo node.removeEventListener("mouseenter",_this2._handleMouseover);node.removeEventListener("mouseleave",_this2._handleMouseout);// 移除已插入元素 (_node$querySelector2=node.querySelector(APP_LCNAME))===null||_node$querySelector2===void 0?void 0:_node$querySelector2.remove();});}// 清空节点集合 _this2._rootNodes.clear();_this2._tranNodes.clear();// 清空任务池 -clearFetchPool();};this._reTranslate=debounce(function(){if(_this2._rule.transOpen==="true"){_this2._register();}},500);this._render=function(el){var _this2$_setting$minLe,_this2$_setting$maxLe;var traEl=el.querySelector(APP_LCNAME);// 已翻译 +clearFetchPool();};this._reTranslate=debounce(function(){if(_this2._rule.transOpen==="true"){_this2._register();}},500);this._invalidLength=function(q){var _this2$_setting$minLe,_this2$_setting$maxLe;return!q||q.length<((_this2$_setting$minLe=_this2._setting.minLength)!==null&&_this2$_setting$minLe!==void 0?_this2$_setting$minLe:TRANS_MIN_LENGTH)||q.length>((_this2$_setting$maxLe=_this2._setting.maxLength)!==null&&_this2$_setting$maxLe!==void 0?_this2$_setting$maxLe:TRANS_MAX_LENGTH);};this._render=function(el){var traEl=el.querySelector(APP_LCNAME);// 已翻译 if(traEl){var preText=_this2._tranNodes.get(el);var curText=el.innerText.trim();// const traText = traEl.innerText.trim(); // todo // 1. traText when loading // 2. replace startsWith if(curText.startsWith(preText)){return;}traEl.remove();}var q=el.innerText.trim();_this2._tranNodes.set(el,q);// 太长或太短 -if(!q||q.length<((_this2$_setting$minLe=_this2._setting.minLength)!==null&&_this2$_setting$minLe!==void 0?_this2$_setting$minLe:TRANS_MIN_LENGTH)||q.length>((_this2$_setting$maxLe=_this2._setting.maxLength)!==null&&_this2$_setting$maxLe!==void 0?_this2$_setting$maxLe:TRANS_MAX_LENGTH)){return;}// console.log("---> ", q); -traEl=document.createElement(APP_LCNAME);traEl.style.visibility="visible";el.appendChild(traEl);el.style.cssText+="-webkit-line-clamp: unset; max-height: none; height: auto;";if(el.parentElement){el.parentElement.style.cssText+="-webkit-line-clamp: unset; max-height: none; height: auto;";}var root=(0,client.createRoot)(traEl);root.render(/*#__PURE__*/(0,jsx_runtime.jsx)(Content,{q:q,translator:_this2}));};var fetchInterval=setting.fetchInterval,fetchLimit=setting.fetchLimit;updateFetchPool(fetchInterval,fetchLimit);this._overrideAttachShadow();this._setting=setting;this._rule=rule;if(rule.transOpen==="true"){this._register();}}_createClass(Translator,[{key:"setting",get:function get(){return this._setting;}},{key:"eventName",get:function get(){return this._eventName;}},{key:"rule",get:function get(){// console.log("get rule", this._rule); +if(_this2._invalidLength(q)){return;}// console.log("---> ", q); +var keepSelector=_this2._rule.keepSelector||"";var keeps=[];if(keepSelector.trim()){var text="";el.childNodes.forEach(function(child){if(child.nodeType===1&&child.matches(keepSelector)){if(child.nodeName==="IMG"){child.style.cssText+="width: ".concat(child.width,"px;");child.style.cssText+="height: ".concat(child.height,"px;");}text+="#".concat(keeps.length,"#");keeps.push(child.outerHTML);}else{text+=child.textContent;}});// 太长或太短 +if(_this2._invalidLength(text.replace(/#(\d+)#/g,"").trim())){return;}if(keeps.length>0){q=text;}}// console.log("---> ", q); +traEl=document.createElement(APP_LCNAME);traEl.style.visibility="visible";el.appendChild(traEl);el.style.cssText+="-webkit-line-clamp: unset; max-height: none; height: auto;";if(el.parentElement){el.parentElement.style.cssText+="-webkit-line-clamp: unset; max-height: none; height: auto;";}var root=(0,client.createRoot)(traEl);root.render(/*#__PURE__*/(0,jsx_runtime.jsx)(Content,{q:q,keeps:keeps,translator:_this2}));};var fetchInterval=setting.fetchInterval,fetchLimit=setting.fetchLimit;updateFetchPool(fetchInterval,fetchLimit);this._overrideAttachShadow();this._setting=setting;this._rule=rule;this._fixerSetting=fixerSetting;if(rule.transOpen==="true"){this._register();}}_createClass(Translator,[{key:"setting",get:function get(){return this._setting;}},{key:"eventName",get:function get(){return this._eventName;}},{key:"rule",get:function get(){// console.log("get rule", this._rule); return this._rule;},set:function set(rule){// console.log("set rule", rule); this._rule=rule;// 广播消息 var eventName=this._eventName;window.dispatchEvent(new CustomEvent(eventName,{detail:{action:MSG_TRANS_CURRULE,args:rule}}));}}]);return Translator;}(); ;// CONCATENATED MODULE: ./src/views/Selection/TranBtn.js -function TranBtn(_ref){var onClick=_ref.onClick,position=_ref.position,tranboxSetting=_ref.tranboxSetting;return/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{cursor:"pointer",position:"absolute",left:position.x+tranboxSetting.btnOffsetX,top:position.y+tranboxSetting.btnOffsetY,zIndex:2147483647},onClick:onClick,onMouseUp:function onMouseUp(e){e.stopPropagation();},children:/*#__PURE__*/(0,jsx_runtime.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 32 32",version:"1.1",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M0 0 C10.56 0 21.12 0 32 0 C32 10.56 32 21.12 32 32 C21.44 32 10.88 32 0 32 C0 21.44 0 10.88 0 0 Z ",fill:"#209CEE",transform:"translate(0,0)"}),/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M0 0 C0.66 0 1.32 0 2 0 C2 2.97 2 5.94 2 9 C2.969375 8.2575 3.93875 7.515 4.9375 6.75 C5.48277344 6.33234375 6.02804688 5.9146875 6.58984375 5.484375 C8.39053593 3.83283924 8.39053593 3.83283924 9 0 C13.95 0 18.9 0 24 0 C24 0.99 24 1.98 24 3 C22.68 3 21.36 3 20 3 C20 9.27 20 15.54 20 22 C19.01 22 18.02 22 17 22 C17 15.73 17 9.46 17 3 C15.35 3 13.7 3 12 3 C11.731875 3.598125 11.46375 4.19625 11.1875 4.8125 C10.01506533 6.97224808 8.80630718 8.35790256 7 10 C8.01790655 12.27071461 8.77442829 13.80784632 10.6875 15.4375 C11.120625 15.953125 11.55375 16.46875 12 17 C11.6875 19.6875 11.6875 19.6875 11 22 C10.34 22 9.68 22 9 22 C8.773125 21.236875 8.54625 20.47375 8.3125 19.6875 C6.73268318 16.45263699 5.16717283 15.58358642 2 14 C2 16.64 2 19.28 2 22 C1.34 22 0.68 22 0 22 C0 14.74 0 7.48 0 0 Z ",fill:"#E9F5FD",transform:"translate(4,5)"})]})});} +function TranBtn(_ref){var onClick=_ref.onClick,position=_ref.position,tranboxSetting=_ref.tranboxSetting;var left=position.x+tranboxSetting.btnOffsetX;var top=position.y+tranboxSetting.btnOffsetY;var touchProps=isMobile?{onTouchEnd:onClick}:{onMouseUp:onClick};return/*#__PURE__*/(0,jsx_runtime.jsx)("div",_objectSpread2(_objectSpread2({style:{cursor:"pointer",position:"absolute",left:left,top:top,zIndex:2147483647}},touchProps),{},{children:/*#__PURE__*/(0,jsx_runtime.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 32 32",version:"1.1",children:[/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M0 0 C10.56 0 21.12 0 32 0 C32 10.56 32 21.12 32 32 C21.44 32 10.88 32 0 32 C0 21.44 0 10.88 0 0 Z ",fill:"#209CEE",transform:"translate(0,0)"}),/*#__PURE__*/(0,jsx_runtime.jsx)("path",{d:"M0 0 C0.66 0 1.32 0 2 0 C2 2.97 2 5.94 2 9 C2.969375 8.2575 3.93875 7.515 4.9375 6.75 C5.48277344 6.33234375 6.02804688 5.9146875 6.58984375 5.484375 C8.39053593 3.83283924 8.39053593 3.83283924 9 0 C13.95 0 18.9 0 24 0 C24 0.99 24 1.98 24 3 C22.68 3 21.36 3 20 3 C20 9.27 20 15.54 20 22 C19.01 22 18.02 22 17 22 C17 15.73 17 9.46 17 3 C15.35 3 13.7 3 12 3 C11.731875 3.598125 11.46375 4.19625 11.1875 4.8125 C10.01506533 6.97224808 8.80630718 8.35790256 7 10 C8.01790655 12.27071461 8.77442829 13.80784632 10.6875 15.4375 C11.120625 15.953125 11.55375 16.46875 12 17 C11.6875 19.6875 11.6875 19.6875 11 22 C10.34 22 9.68 22 9 22 C8.773125 21.236875 8.54625 20.47375 8.3125 19.6875 C6.73268318 16.45263699 5.16717283 15.58358642 2 14 C2 16.64 2 19.28 2 22 C1.34 22 0.68 22 0 22 C0 14.74 0 7.48 0 0 Z ",fill:"#E9F5FD",transform:"translate(4,5)"})]})}));} ;// CONCATENATED MODULE: ./src/views/Selection/DraggableResizable.js -var DraggableResizable_excluded=["direction","size","setSize","position","setPosition","children","minSize","maxSize"];function Pointer(_ref){var direction=_ref.direction,size=_ref.size,setSize=_ref.setSize,position=_ref.position,setPosition=_ref.setPosition,children=_ref.children,minSize=_ref.minSize,maxSize=_ref.maxSize,props=_objectWithoutProperties(_ref,DraggableResizable_excluded);var _useState=(0,react.useState)(null),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),origin=_useState2[0],setOrigin=_useState2[1];function handlePointerDown(e){e.target.setPointerCapture(e.pointerId);setOrigin({x:position.x,y:position.y,w:size.w,h:size.h,clientX:e.clientX,clientY:e.clientY});}function handlePointerMove(e){if(origin){var dx=e.clientX-origin.clientX;var dy=e.clientY-origin.clientY;var x=position.x;var y=position.y;var w=size.w;var h=size.h;switch(direction){case"Header":x=origin.x+dx;y=origin.y+dy;break;case"TopLeft":x=origin.x+dx;y=origin.y+dy;w=origin.w-dx;h=origin.h-dy;break;case"Top":y=origin.y+dy;h=origin.h-dy;break;case"TopRight":y=origin.y+dy;w=origin.w+dx;h=origin.h-dy;break;case"Left":x=origin.x+dx;w=origin.w-dx;break;case"Right":w=origin.w+dx;break;case"BottomLeft":x=origin.x+dx;w=origin.w-dx;h=origin.h+dy;break;case"Bottom":h=origin.h+dy;break;case"BottomRight":w=origin.w+dx;h=origin.h+dy;break;default:}if(wmaxSize.w){w=maxSize.w;x=position.x;}if(hmaxSize.h){h=maxSize.h;y=position.y;}setPosition({x:x,y:y});setSize({w:w,h:h});}}function handlePointerUp(e){setOrigin(null);}return/*#__PURE__*/(0,jsx_runtime.jsx)("div",_objectSpread2(_objectSpread2({},props),{},{onPointerDown:handlePointerDown,onPointerMove:handlePointerMove,onPointerUp:handlePointerUp,children:children}));}function DraggableResizable(_ref2){var header=_ref2.header,children=_ref2.children,_ref2$defaultPosition=_ref2.defaultPosition,defaultPosition=_ref2$defaultPosition===void 0?{x:0,y:0}:_ref2$defaultPosition,_ref2$defaultSize=_ref2.defaultSize,defaultSize=_ref2$defaultSize===void 0?{w:600,h:400}:_ref2$defaultSize,_ref2$minSize=_ref2.minSize,minSize=_ref2$minSize===void 0?{w:300,h:200}:_ref2$minSize,_ref2$maxSize=_ref2.maxSize,maxSize=_ref2$maxSize===void 0?{w:1200,h:1200}:_ref2$maxSize,onChangeSize=_ref2.onChangeSize,onChangePosition=_ref2.onChangePosition;var lineWidth=4;var _useState3=(0,react.useState)(defaultPosition),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),position=_useState4[0],setPosition=_useState4[1];var _useState5=(0,react.useState)(defaultSize),_useState6=(0,slicedToArray/* default */.Z)(_useState5,2),size=_useState6[0],setSize=_useState6[1];var opts={size:size,setSize:setSize,position:position,setPosition:setPosition,minSize:minSize,maxSize:maxSize};(0,react.useEffect)(function(){onChangeSize&&onChangeSize(size);},[size,onChangeSize]);(0,react.useEffect)(function(){onChangePosition&&onChangePosition(position);},[position,onChangePosition]);return/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{style:{position:"fixed",left:position.x,top:position.y,display:"grid",gridTemplateColumns:"".concat(lineWidth*2,"px auto ").concat(lineWidth*2,"px"),gridTemplateRows:"".concat(lineWidth*2,"px auto ").concat(lineWidth*2,"px"),zIndex:2147483647},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"TopLeft",style:{transform:"translate(".concat(lineWidth,"px, ").concat(lineWidth,"px)"),cursor:"nw-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"Top",style:{margin:"0 ".concat(lineWidth,"px"),transform:"translate(0px, ".concat(lineWidth,"px)"),cursor:"row-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"TopRight",style:{transform:"translate(-".concat(lineWidth,"px, ").concat(lineWidth,"px)"),cursor:"ne-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"Left",style:{margin:"".concat(lineWidth,"px 0"),transform:"translate(".concat(lineWidth,"px, 0px)"),cursor:"col-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsxs)(Paper_Paper,{elevation:4,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2(_objectSpread2({direction:"Header",style:{cursor:"move"}},opts),{},{children:header})),/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{width:size.w,height:size.h,overflow:"hidden auto"},children:children})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"Right",style:{margin:"".concat(lineWidth,"px 0"),transform:"translate(-".concat(lineWidth,"px, 0px)"),cursor:"col-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"BottomLeft",style:{transform:"translate(".concat(lineWidth,"px, -").concat(lineWidth,"px)"),cursor:"ne-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"Bottom",style:{margin:"0 ".concat(lineWidth,"px"),transform:"translate(0px, -".concat(lineWidth,"px)"),cursor:"row-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"BottomRight",style:{transform:"translate(-".concat(lineWidth,"px, -").concat(lineWidth,"px)"),cursor:"nw-resize"}},opts))]});} +var DraggableResizable_excluded=["direction","size","setSize","position","setPosition","children","minSize","maxSize"];function Pointer(_ref){var direction=_ref.direction,size=_ref.size,setSize=_ref.setSize,position=_ref.position,setPosition=_ref.setPosition,children=_ref.children,minSize=_ref.minSize,maxSize=_ref.maxSize,props=_objectWithoutProperties(_ref,DraggableResizable_excluded);var _useState=(0,react.useState)(null),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),origin=_useState2[0],setOrigin=_useState2[1];function handlePointerDown(e){!isMobile&&e.target.setPointerCapture(e.pointerId);var _ref2=isMobile?e.targetTouches[0]:e,clientX=_ref2.clientX,clientY=_ref2.clientY;setOrigin({x:position.x,y:position.y,w:size.w,h:size.h,clientX:clientX,clientY:clientY});}function handlePointerMove(e){var _ref3=isMobile?e.targetTouches[0]:e,clientX=_ref3.clientX,clientY=_ref3.clientY;if(origin){var dx=clientX-origin.clientX;var dy=clientY-origin.clientY;var x=position.x;var y=position.y;var w=size.w;var h=size.h;switch(direction){case"Header":x=origin.x+dx;y=origin.y+dy;break;case"TopLeft":x=origin.x+dx;y=origin.y+dy;w=origin.w-dx;h=origin.h-dy;break;case"Top":y=origin.y+dy;h=origin.h-dy;break;case"TopRight":y=origin.y+dy;w=origin.w+dx;h=origin.h-dy;break;case"Left":x=origin.x+dx;w=origin.w-dx;break;case"Right":w=origin.w+dx;break;case"BottomLeft":x=origin.x+dx;w=origin.w-dx;h=origin.h+dy;break;case"Bottom":h=origin.h+dy;break;case"BottomRight":w=origin.w+dx;h=origin.h+dy;break;default:}if(wmaxSize.w){w=maxSize.w;x=position.x;}if(hmaxSize.h){h=maxSize.h;y=position.y;}setPosition({x:x,y:y});setSize({w:w,h:h});}}function handlePointerUp(e){e.stopPropagation();setOrigin(null);}var touchProps=isMobile?{onTouchStart:handlePointerDown,onTouchMove:handlePointerMove,onTouchEnd:handlePointerUp}:{onPointerDown:handlePointerDown,onPointerMove:handlePointerMove,onPointerUp:handlePointerUp};return/*#__PURE__*/(0,jsx_runtime.jsx)("div",_objectSpread2(_objectSpread2(_objectSpread2({},props),touchProps),{},{children:children}));}function DraggableResizable(_ref4){var header=_ref4.header,children=_ref4.children,_ref4$defaultPosition=_ref4.defaultPosition,defaultPosition=_ref4$defaultPosition===void 0?{x:0,y:0}:_ref4$defaultPosition,_ref4$defaultSize=_ref4.defaultSize,defaultSize=_ref4$defaultSize===void 0?{w:600,h:400}:_ref4$defaultSize,_ref4$minSize=_ref4.minSize,minSize=_ref4$minSize===void 0?{w:300,h:200}:_ref4$minSize,_ref4$maxSize=_ref4.maxSize,maxSize=_ref4$maxSize===void 0?{w:1200,h:1200}:_ref4$maxSize,onChangeSize=_ref4.onChangeSize,onChangePosition=_ref4.onChangePosition;var lineWidth=4;var _useState3=(0,react.useState)(defaultPosition),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),position=_useState4[0],setPosition=_useState4[1];var _useState5=(0,react.useState)(defaultSize),_useState6=(0,slicedToArray/* default */.Z)(_useState5,2),size=_useState6[0],setSize=_useState6[1];var opts={size:size,setSize:setSize,position:position,setPosition:setPosition,minSize:minSize,maxSize:maxSize};(0,react.useEffect)(function(){onChangeSize&&onChangeSize(size);},[size,onChangeSize]);(0,react.useEffect)(function(){onChangePosition&&onChangePosition(position);},[position,onChangePosition]);return/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{style:{touchAction:"none",position:"fixed",left:position.x,top:position.y,display:"grid",gridTemplateColumns:"".concat(lineWidth*2,"px auto ").concat(lineWidth*2,"px"),gridTemplateRows:"".concat(lineWidth*2,"px auto ").concat(lineWidth*2,"px"),zIndex:2147483647},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"TopLeft",style:{transform:"translate(".concat(lineWidth,"px, ").concat(lineWidth,"px)"),cursor:"nw-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"Top",style:{margin:"0 ".concat(lineWidth,"px"),transform:"translate(0px, ".concat(lineWidth,"px)"),cursor:"row-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"TopRight",style:{transform:"translate(-".concat(lineWidth,"px, ").concat(lineWidth,"px)"),cursor:"ne-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"Left",style:{margin:"".concat(lineWidth,"px 0"),transform:"translate(".concat(lineWidth,"px, 0px)"),cursor:"col-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsxs)(Paper_Paper,{elevation:4,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2(_objectSpread2({direction:"Header",style:{cursor:"move"}},opts),{},{children:header})),/*#__PURE__*/(0,jsx_runtime.jsx)("div",{style:{width:size.w,height:size.h,overflow:"hidden auto"},children:children})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"Right",style:{margin:"".concat(lineWidth,"px 0"),transform:"translate(-".concat(lineWidth,"px, 0px)"),cursor:"col-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"BottomLeft",style:{transform:"translate(".concat(lineWidth,"px, -").concat(lineWidth,"px)"),cursor:"ne-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"Bottom",style:{margin:"0 ".concat(lineWidth,"px"),transform:"translate(0px, -".concat(lineWidth,"px)"),cursor:"row-resize"}},opts)),/*#__PURE__*/(0,jsx_runtime.jsx)(Pointer,_objectSpread2({direction:"BottomRight",style:{transform:"translate(-".concat(lineWidth,"px, -").concat(lineWidth,"px)"),cursor:"nw-resize"}},opts))]});} ;// CONCATENATED MODULE: ./node_modules/.pnpm/@mui+material@5.14.10_@emotion+react@11.11.1_@emotion+styled@11.11.0_@types+react@18.2.22_react-dom@18.2.0_react@18.2.0/node_modules/@mui/material/Grid/GridContext.js 'use client'; @@ -34859,8 +34866,10 @@ if(!(isValidWord(text)&&toLang.startsWith("zh"))){_context.next=27;break;}if(!(f ;// CONCATENATED MODULE: ./src/views/Selection/TranBox.js function TranForm(_ref){var text=_ref.text,setText=_ref.setText,tranboxSetting=_ref.tranboxSetting,transApis=_ref.transApis;var i18n=useI18n();var _useState=(0,react.useState)(false),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),editMode=_useState2[0],setEditMode=_useState2[1];var _useState3=(0,react.useState)(""),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),editText=_useState4[0],setEditText=_useState4[1];var _useState5=(0,react.useState)(tranboxSetting.translator),_useState6=(0,slicedToArray/* default */.Z)(_useState5,2),translator=_useState6[0],setTranslator=_useState6[1];var _useState7=(0,react.useState)(tranboxSetting.fromLang),_useState8=(0,slicedToArray/* default */.Z)(_useState7,2),fromLang=_useState8[0],setFromLang=_useState8[1];var _useState9=(0,react.useState)(tranboxSetting.toLang),_useState10=(0,slicedToArray/* default */.Z)(_useState9,2),toLang=_useState10[0],setToLang=_useState10[1];var _useState11=(0,react.useState)(tranboxSetting.toLang2),_useState12=(0,slicedToArray/* default */.Z)(_useState11,2),toLang2=_useState12[0],setToLang2=_useState12[1];var inputRef=(0,react.useRef)(null);return/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{sx:{p:2},spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Grid_Grid,{container:true,spacing:2,columns:12,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:4,sm:4,md:4,lg:4,children:/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},fullWidth:true,size:"small",name:"fromLang",value:fromLang,label:i18n("from_lang"),onChange:function onChange(e){setFromLang(e.target.value);},children:OPT_LANGS_FROM.map(function(_ref2){var _ref3=(0,slicedToArray/* default */.Z)(_ref2,2),lang=_ref3[0],name=_ref3[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:4,sm:4,md:4,lg:4,children:/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},fullWidth:true,size:"small",name:"toLang",value:toLang,label:i18n("to_lang"),onChange:function onChange(e){setToLang(e.target.value);},children:OPT_LANGS_TO.map(function(_ref4){var _ref5=(0,slicedToArray/* default */.Z)(_ref4,2),lang=_ref5[0],name=_ref5[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:4,sm:4,md:4,lg:4,children:/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,SelectProps:{MenuProps:{disablePortal:true}},fullWidth:true,size:"small",value:translator,name:"translator",label:i18n("translate_service"),onChange:function onChange(e){setTranslator(e.target.value);},children:OPT_TRANS_ALL.map(function(item){return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:item,children:item},item);})})})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:i18n("original_text"),inputRef:inputRef,fullWidth:true,multiline:true,value:editMode?editText:text,disabled:!editMode,onChange:function onChange(e){setEditText(e.target.value);},onClick:function onClick(){setEditMode(true);setEditText(text);var timer=setTimeout(function(){var _inputRef$current;clearTimeout(timer);(_inputRef$current=inputRef.current)===null||_inputRef$current===void 0?void 0:_inputRef$current.focus();},100);},onBlur:function onBlur(){setEditMode(false);setText(editText.trim());},InputProps:{endAdornment:/*#__PURE__*/(0,jsx_runtime.jsx)(Stack_Stack,{direction:"row",sx:{position:"absolute",right:0,top:0},children:editMode?/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{size:"small",onClick:function onClick(e){e.stopPropagation();},children:/*#__PURE__*/(0,jsx_runtime.jsx)(Done/* default */.Z,{fontSize:"inherit"})}):/*#__PURE__*/(0,jsx_runtime.jsx)(CopyBtn,{text:text})})}})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TranCont,{text:text,translator:translator,fromLang:fromLang,toLang:toLang,toLang2:toLang2,setToLang:setToLang,setToLang2:setToLang2,transApis:transApis})]});}function TranBox(_ref6){var text=_ref6.text,setText=_ref6.setText,setShowBox=_ref6.setShowBox,tranboxSetting=_ref6.tranboxSetting,transApis=_ref6.transApis,boxSize=_ref6.boxSize,setBoxSize=_ref6.setBoxSize,boxPosition=_ref6.boxPosition,setBoxPosition=_ref6.setBoxPosition;return/*#__PURE__*/(0,jsx_runtime.jsx)(SettingProvider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Theme,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(DraggableResizable,{defaultPosition:boxPosition,defaultSize:boxSize,header:/*#__PURE__*/(0,jsx_runtime.jsx)(Header,{setShowPopup:setShowBox}),onChangeSize:setBoxSize,onChangePosition:setBoxPosition,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(TranForm,{text:text,setText:setText,tranboxSetting:tranboxSetting,transApis:transApis})]})})});} ;// CONCATENATED MODULE: ./src/views/Selection/index.js -function Slection(_ref){var contextMenus=_ref.contextMenus,tranboxSetting=_ref.tranboxSetting,transApis=_ref.transApis;var _useState=(0,react.useState)(false),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),showBox=_useState2[0],setShowBox=_useState2[1];var _useState3=(0,react.useState)(false),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),showBtn=_useState4[0],setShowBtn=_useState4[1];var _useState5=(0,react.useState)(""),_useState6=(0,slicedToArray/* default */.Z)(_useState5,2),selectedText=_useState6[0],setSelText=_useState6[1];var _useState7=(0,react.useState)(""),_useState8=(0,slicedToArray/* default */.Z)(_useState7,2),text=_useState8[0],setText=_useState8[1];var _useState9=(0,react.useState)({x:0,y:0}),_useState10=(0,slicedToArray/* default */.Z)(_useState9,2),position=_useState10[0],setPosition=_useState10[1];var _useState11=(0,react.useState)({w:600,h:400}),_useState12=(0,slicedToArray/* default */.Z)(_useState11,2),boxSize=_useState12[0],setBoxSize=_useState12[1];var _useState13=(0,react.useState)({x:(window.innerWidth-600)/2,y:(window.innerHeight-400)/2}),_useState14=(0,slicedToArray/* default */.Z)(_useState13,2),boxPosition=_useState14[0],setBoxPosition=_useState14[1];var handleClick=function handleClick(e){e.stopPropagation();setShowBtn(false);setText(selectedText);setShowBox(true);};var handleTranbox=(0,react.useCallback)(function(){var _window$getSelection,_window$getSelection$;setShowBtn(false);var selectedText=((_window$getSelection=window.getSelection())===null||_window$getSelection===void 0?void 0:(_window$getSelection$=_window$getSelection.toString())===null||_window$getSelection$===void 0?void 0:_window$getSelection$.trim())||"";if(!selectedText){setShowBox(function(pre){return!pre;});return;}setSelText(selectedText);setText(selectedText);setShowBox(true);},[]);(0,react.useEffect)(function(){function handleMouseup(_x){return _handleMouseup.apply(this,arguments);}function _handleMouseup(){_handleMouseup=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(e){var _window$getSelection2,_window$getSelection3;var selectedText;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=2;return sleep(10);case 2:selectedText=((_window$getSelection2=window.getSelection())===null||_window$getSelection2===void 0?void 0:(_window$getSelection3=_window$getSelection2.toString())===null||_window$getSelection3===void 0?void 0:_window$getSelection3.trim())||"";setSelText(selectedText);if(selectedText){_context.next=7;break;}setShowBtn(false);return _context.abrupt("return");case 7:!tranboxSetting.hideTranBtn&&setShowBtn(true);// setPosition({ x: e.clientX, y: e.clientY }); -setPosition({x:e.pageX,y:e.pageY});case 9:case"end":return _context.stop();}},_callee);}));return _handleMouseup.apply(this,arguments);}window.addEventListener("mouseup",handleMouseup);return function(){window.removeEventListener("mouseup",handleMouseup);};},[tranboxSetting.hideTranBtn]);(0,react.useEffect)(function(){var clearShortcut=shortcutRegister(tranboxSetting.tranboxShortcut||DEFAULT_TRANBOX_SHORTCUT,handleTranbox);return function(){clearShortcut();};},[tranboxSetting.tranboxShortcut,handleTranbox]);(0,react.useEffect)(function(){window.addEventListener(MSG_OPEN_TRANBOX,handleTranbox);return function(){window.removeEventListener(MSG_OPEN_TRANBOX,handleTranbox);};},[handleTranbox]);(0,react.useEffect)(function(){if(!isGm){return;}// 注册菜单 +function Slection(_ref){var contextMenus=_ref.contextMenus,tranboxSetting=_ref.tranboxSetting,transApis=_ref.transApis;var boxWidth=limitNumber(window.innerWidth,300,600);var boxHeight=limitNumber(window.innerHeight,200,400);var _useState=(0,react.useState)(false),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),showBox=_useState2[0],setShowBox=_useState2[1];var _useState3=(0,react.useState)(false),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),showBtn=_useState4[0],setShowBtn=_useState4[1];var _useState5=(0,react.useState)(""),_useState6=(0,slicedToArray/* default */.Z)(_useState5,2),selectedText=_useState6[0],setSelText=_useState6[1];var _useState7=(0,react.useState)(""),_useState8=(0,slicedToArray/* default */.Z)(_useState7,2),text=_useState8[0],setText=_useState8[1];var _useState9=(0,react.useState)({x:0,y:0}),_useState10=(0,slicedToArray/* default */.Z)(_useState9,2),position=_useState10[0],setPosition=_useState10[1];var _useState11=(0,react.useState)({w:boxWidth,h:boxHeight}),_useState12=(0,slicedToArray/* default */.Z)(_useState11,2),boxSize=_useState12[0],setBoxSize=_useState12[1];var _useState13=(0,react.useState)({x:(window.innerWidth-boxWidth)/2,y:(window.innerHeight-boxHeight)/2}),_useState14=(0,slicedToArray/* default */.Z)(_useState13,2),boxPosition=_useState14[0],setBoxPosition=_useState14[1];var handleClick=function handleClick(e){e.stopPropagation();setShowBtn(false);setText(selectedText);setShowBox(true);};var handleTranbox=(0,react.useCallback)(function(){var _window$getSelection,_window$getSelection$;setShowBtn(false);var selectedText=((_window$getSelection=window.getSelection())===null||_window$getSelection===void 0?void 0:(_window$getSelection$=_window$getSelection.toString())===null||_window$getSelection$===void 0?void 0:_window$getSelection$.trim())||"";if(!selectedText){setShowBox(function(pre){return!pre;});return;}setSelText(selectedText);setText(selectedText);setShowBox(true);},[]);(0,react.useEffect)(function(){function handleMouseup(_x){return _handleMouseup.apply(this,arguments);}// todo: mobile support +function _handleMouseup(){_handleMouseup=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(e){var _window$getSelection2,_window$getSelection3;var selectedText,_ref2,pageX,pageY;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:e.stopPropagation();_context.next=3;return sleep(10);case 3:selectedText=((_window$getSelection2=window.getSelection())===null||_window$getSelection2===void 0?void 0:(_window$getSelection3=_window$getSelection2.toString())===null||_window$getSelection3===void 0?void 0:_window$getSelection3.trim())||"";setSelText(selectedText);if(selectedText){_context.next=8;break;}setShowBtn(false);return _context.abrupt("return");case 8:_ref2=isMobile?e.changedTouches[0]:e,pageX=_ref2.pageX,pageY=_ref2.pageY;!tranboxSetting.hideTranBtn&&setShowBtn(true);// setPosition({ x: e.clientX, y: e.clientY }); +setPosition({x:pageX,y:pageY});case 11:case"end":return _context.stop();}},_callee);}));return _handleMouseup.apply(this,arguments);}window.addEventListener("mouseup",handleMouseup);// window.addEventListener(isMobile ? "touchend" : "mouseup", handleMouseup); +return function(){window.removeEventListener(isMobile?"touchend":"mouseup",handleMouseup);};},[tranboxSetting.hideTranBtn]);(0,react.useEffect)(function(){if(isExt){return;}var clearShortcut=shortcutRegister(tranboxSetting.tranboxShortcut||DEFAULT_TRANBOX_SHORTCUT,handleTranbox);return function(){clearShortcut();};},[tranboxSetting.tranboxShortcut,handleTranbox]);(0,react.useEffect)(function(){window.addEventListener(MSG_OPEN_TRANBOX,handleTranbox);return function(){window.removeEventListener(MSG_OPEN_TRANBOX,handleTranbox);};},[handleTranbox]);(0,react.useEffect)(function(){if(!isGm){return;}// 注册菜单 try{var menuCommandIds=[];contextMenus&&menuCommandIds.push(GM.registerMenuCommand("Translate Selected Text (Alt+S)",function(event){handleTranbox();},"S"));return function(){menuCommandIds.forEach(function(id){GM.unregisterMenuCommand(id);});};}catch(err){console.log("[registerMenuCommand]",err);}},[handleTranbox,contextMenus]);return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[showBox&&/*#__PURE__*/(0,jsx_runtime.jsx)(TranBox,{text:text,setText:setText,boxSize:boxSize,setBoxSize:setBoxSize,boxPosition:boxPosition,setBoxPosition:setBoxPosition,tranboxSetting:tranboxSetting,transApis:transApis,setShowBox:setShowBox}),showBtn&&/*#__PURE__*/(0,jsx_runtime.jsx)(TranBtn,{position:position,tranboxSetting:tranboxSetting,onClick:handleClick})]});} ;// CONCATENATED MODULE: ./src/libs/touch.js function touchTapListener(fn,touchsLength){var handleTouchend=function handleTouchend(e){if(e.touches.length===touchsLength){fn();}};document.addEventListener("touchstart",handleTouchend);return function(){document.removeEventListener("touchstart",handleTouchend);};} @@ -34868,7 +34877,7 @@ function touchTapListener(fn,touchsLength){var handleTouchend=function handleTou var MSG_GM_xmlHttpRequest="xmlHttpRequest";var MSG_GM_setValue="setValue";var MSG_GM_getValue="getValue";var MSG_GM_deleteValue="deleteValue";var MSG_GM_info="info";/** * 注入页面的脚本,请求并接受GM接口信息 * @param {*} param0 - */var injectScript=function injectScript(ping){window.APP_INFO={name:"KISS Translator",version:"1.7.15",eventName:ping};};/** + */var injectScript=function injectScript(ping){window.APP_INFO={name:"KISS Translator",version:"1.7.16",eventName:ping};};/** * 适配GM脚本 */var adaptScript=function adaptScript(ping){var promiseGM=function promiseGM(action,args){var timeout=arguments.length>2&&arguments[2]!==undefined?arguments[2]:5000;return new Promise(function(resolve,reject){var pong=genEventName();var handleEvent=function handleEvent(e){window.removeEventListener(pong,handleEvent);var _e$detail=e.detail,data=_e$detail.data,error=_e$detail.error;if(error){reject(new Error(error));}else{resolve(data);}};window.addEventListener(pong,handleEvent);window.dispatchEvent(new CustomEvent(ping,{detail:{action:action,args:args,pong:pong}}));setTimeout(function(){window.removeEventListener(pong,handleEvent);reject(new Error("timeout"));},timeout);});};window.KISS_GM={fetch:function fetch(input,init){return promiseGM(MSG_GM_xmlHttpRequest,{input:input,init:init});},setValue:function setValue(key,val){return promiseGM(MSG_GM_setValue,{key:key,val:val});},getValue:function getValue(key){return promiseGM(MSG_GM_getValue,{key:key});},deleteValue:function deleteValue(key){return promiseGM(MSG_GM_deleteValue,{key:key});},getInfo:function(){var _getInfo=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(window.GM_info){_context.next=4;break;}_context.next=3;return promiseGM(MSG_GM_info);case 3:window.GM_info=_context.sent;case 4:return _context.abrupt("return",window.GM_info);case 5:case"end":return _context.stop();}},_callee);}));function getInfo(){return _getInfo.apply(this,arguments);}return getInfo;}()};};/** * 监听并回应页面对GM接口的请求 @@ -34890,7 +34899,7 @@ loadingId="kiss-"+utils_genEventName();_context.prev=13;addLoading(node,loadingI ;// CONCATENATED MODULE: ./src/common.js /** * 油猴脚本设置页面 - */function runSettingPage(){var _GM,_GM$info,_GM$info$script,_GM$info$script$grant;if((_GM=GM)!==null&&_GM!==void 0&&(_GM$info=_GM.info)!==null&&_GM$info!==void 0&&(_GM$info$script=_GM$info.script)!==null&&_GM$info$script!==void 0&&(_GM$info$script$grant=_GM$info$script.grant)!==null&&_GM$info$script$grant!==void 0&&_GM$info$script$grant.includes("unsafeWindow")){unsafeWindow.GM=GM;unsafeWindow.APP_INFO={name:"KISS Translator",version:"1.7.15"};}else{var ping=utils_genEventName();window.addEventListener(ping,handlePing);// window.eval(`(${injectScript})("${ping}")`); // eslint-disable-line + */function runSettingPage(){var _GM,_GM$info,_GM$info$script,_GM$info$script$grant;if((_GM=GM)!==null&&_GM!==void 0&&(_GM$info=_GM.info)!==null&&_GM$info!==void 0&&(_GM$info$script=_GM$info.script)!==null&&_GM$info$script!==void 0&&(_GM$info$script$grant=_GM$info$script.grant)!==null&&_GM$info$script$grant!==void 0&&_GM$info$script$grant.includes("unsafeWindow")){unsafeWindow.GM=GM;unsafeWindow.APP_INFO={name:"KISS Translator",version:"1.7.16"};}else{var ping=utils_genEventName();window.addEventListener(ping,handlePing);// window.eval(`(${injectScript})("${ping}")`); // eslint-disable-line var script=document.createElement("script");script.textContent="(".concat(injectScript,")(\"").concat(ping,"\")");document.head.append(script);}}/** * 插件监听后端事件 * @param {*} translator @@ -34905,7 +34914,7 @@ var script=document.createElement("script");script.textContent="(".concat(inject * 划词翻译 * @param {*} param0 * @returns - */function _showFab(){_showFab=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(translator){var fab,$action,shadowContainer,emotionRoot,shadowRootElement,cache;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return getFabWithDefault();case 2:fab=_context2.sent;if(!fab.isHide){_context2.next=5;break;}return _context2.abrupt("return");case 5:$action=document.createElement("div");$action.setAttribute("id",APP_LCNAME);document.body.parentElement.appendChild($action);shadowContainer=$action.attachShadow({mode:"closed"});emotionRoot=document.createElement("style");shadowRootElement=document.createElement("div");shadowContainer.appendChild(emotionRoot);shadowContainer.appendChild(shadowRootElement);cache=(0,emotion_cache_browser_esm/* default */.Z)({key:APP_LCNAME,prepend:true,container:emotionRoot});client.createRoot(shadowRootElement).render(/*#__PURE__*/(0,jsx_runtime.jsx)(react.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(emotion_element_c39617d8_browser_esm.C,{value:cache,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Action,{translator:translator,fab:fab})})}));case 15:case"end":return _context2.stop();}},_callee2);}));return _showFab.apply(this,arguments);}function showTransbox(_ref4){var _ref4$contextMenus=_ref4.contextMenus,contextMenus=_ref4$contextMenus===void 0?true:_ref4$contextMenus,_ref4$tranboxSetting=_ref4.tranboxSetting,tranboxSetting=_ref4$tranboxSetting===void 0?DEFAULT_TRANBOX_SETTING:_ref4$tranboxSetting,transApis=_ref4.transApis;if(!(tranboxSetting!==null&&tranboxSetting!==void 0&&tranboxSetting.transOpen)){return;}var $tranbox=document.createElement("div");$tranbox.setAttribute("id","kiss-transbox");document.body.parentElement.appendChild($tranbox);var shadowContainer=$tranbox.attachShadow({mode:"closed"});var emotionRoot=document.createElement("style");var shadowRootElement=document.createElement("div");shadowContainer.appendChild(emotionRoot);shadowContainer.appendChild(shadowRootElement);var cache=(0,emotion_cache_browser_esm/* default */.Z)({key:"kiss-transbox",prepend:true,container:emotionRoot});client.createRoot(shadowRootElement).render(/*#__PURE__*/(0,jsx_runtime.jsx)(react.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(emotion_element_c39617d8_browser_esm.C,{value:cache,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Slection,{contextMenus:contextMenus,tranboxSetting:tranboxSetting,transApis:transApis})})}));}/** + */function _showFab(){_showFab=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(translator){var fab,$action,shadowContainer,emotionRoot,shadowRootElement,cache;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return getFabWithDefault();case 2:fab=_context2.sent;$action=document.createElement("div");$action.setAttribute("id",APP_LCNAME);document.body.parentElement.appendChild($action);shadowContainer=$action.attachShadow({mode:"closed"});emotionRoot=document.createElement("style");shadowRootElement=document.createElement("div");shadowContainer.appendChild(emotionRoot);shadowContainer.appendChild(shadowRootElement);cache=(0,emotion_cache_browser_esm/* default */.Z)({key:APP_LCNAME,prepend:true,container:emotionRoot});client.createRoot(shadowRootElement).render(/*#__PURE__*/(0,jsx_runtime.jsx)(react.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(emotion_element_c39617d8_browser_esm.C,{value:cache,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Action,{translator:translator,fab:fab})})}));case 13:case"end":return _context2.stop();}},_callee2);}));return _showFab.apply(this,arguments);}function showTransbox(_ref4){var _ref4$contextMenus=_ref4.contextMenus,contextMenus=_ref4$contextMenus===void 0?true:_ref4$contextMenus,_ref4$tranboxSetting=_ref4.tranboxSetting,tranboxSetting=_ref4$tranboxSetting===void 0?DEFAULT_TRANBOX_SETTING:_ref4$tranboxSetting,transApis=_ref4.transApis;if(!(tranboxSetting!==null&&tranboxSetting!==void 0&&tranboxSetting.transOpen)){return;}var $tranbox=document.createElement("div");$tranbox.setAttribute("id","kiss-transbox");document.body.parentElement.appendChild($tranbox);var shadowContainer=$tranbox.attachShadow({mode:"closed"});var emotionRoot=document.createElement("style");var shadowRootElement=document.createElement("div");shadowContainer.appendChild(emotionRoot);shadowContainer.appendChild(shadowRootElement);var cache=(0,emotion_cache_browser_esm/* default */.Z)({key:"kiss-transbox",prepend:true,container:emotionRoot});client.createRoot(shadowRootElement).render(/*#__PURE__*/(0,jsx_runtime.jsx)(react.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(emotion_element_c39617d8_browser_esm.C,{value:cache,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Slection,{contextMenus:contextMenus,tranboxSetting:tranboxSetting,transApis:transApis})})}));}/** * 监听来自iframe页面消息 * @param {*} rule */function windowListener(rule){window.addEventListener("message",function(e){var _ref5=e.data||{},action=_ref5.action;switch(action){case MSG_TRANS_GETRULE:sendIframeMsg(MSG_TRANS_PUTRULE,rule);break;default:}});}/** @@ -34917,14 +34926,14 @@ var script=document.createElement("script");script.textContent="(".concat(inject * @returns */function touchOperation(translator){var _translator$setting$t=translator.setting.touchTranslate,touchTranslate=_translator$setting$t===void 0?2:_translator$setting$t;if(touchTranslate===0){return;}var handleTap=debounce(function(){translator.toggle();sendIframeMsg(MSG_TRANS_TOGGLE);});touchTapListener(handleTap,touchTranslate);}/** * 入口函数 - */function common_run(){return _run.apply(this,arguments);}function _run(){_run=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee3(){var isUserscript,href,setting,rule,translator,_args3=arguments;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:isUserscript=_args3.length>0&&_args3[0]!==undefined?_args3[0]:false;_context3.prev=1;href=document.location.href;// 设置页面 -if(!(isUserscript&&(href.includes("http://localhost:3000/options.html")||href.includes("https://fishjar.github.io/kiss-translator/options.html")||href.includes("https://kiss-translator.rayjar.com/options")))){_context3.next=6;break;}runSettingPage();return _context3.abrupt("return");case 6:_context3.next=8;return getSettingWithDefault();case 8:setting=_context3.sent;if(!isInBlacklist(href,setting)){_context3.next=11;break;}return _context3.abrupt("return");case 11:if(!isIframe){_context3.next=14;break;}runIframe(setting);return _context3.abrupt("return");case 14:_context3.next=16;return runWebfix(setting);case 16:_context3.next=18;return matchRule(href,setting);case 18:rule=_context3.sent;translator=new Translator(rule,setting);// 监听消息 + */function common_run(){return _run.apply(this,arguments);}function _run(){_run=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee3(){var isUserscript,href,setting,fixerSetting,rule,translator,_args3=arguments;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:isUserscript=_args3.length>0&&_args3[0]!==undefined?_args3[0]:false;_context3.prev=1;href=document.location.href;// 设置页面 +if(!(isUserscript&&(href.includes("http://localhost:3000/options.html")||href.includes("https://fishjar.github.io/kiss-translator/options.html")||href.includes("https://kiss-translator.rayjar.com/options")))){_context3.next=6;break;}runSettingPage();return _context3.abrupt("return");case 6:_context3.next=8;return getSettingWithDefault();case 8:setting=_context3.sent;if(!isInBlacklist(href,setting)){_context3.next=11;break;}return _context3.abrupt("return");case 11:if(!isIframe){_context3.next=14;break;}runIframe(setting);return _context3.abrupt("return");case 14:_context3.next=16;return matchFixer(href,setting);case 16:fixerSetting=_context3.sent;_context3.next=19;return matchRule(href,setting);case 19:rule=_context3.sent;translator=new Translator(rule,setting,fixerSetting);// 监听消息 windowListener(rule);!isUserscript&&runtimeListener(translator);// 输入框翻译 inputTranslate(setting);// 划词翻译 showTransbox(setting);// 浮球按钮 -_context3.next=26;return showFab(translator);case 26:// 触屏操作 +_context3.next=27;return showFab(translator);case 27:// 触屏操作 touchOperation(translator);// 同步订阅规则 -_context3.t0=isUserscript;if(!_context3.t0){_context3.next=31;break;}_context3.next=31;return trySyncAllSubRules(setting);case 31:_context3.next=37;break;case 33:_context3.prev=33;_context3.t1=_context3["catch"](1);console.error("[KISS-Translator]",_context3.t1);showErr(_context3.t1.message);case 37:case"end":return _context3.stop();}},_callee3,null,[[1,33]]);}));return _run.apply(this,arguments);} +_context3.t0=isUserscript;if(!_context3.t0){_context3.next=32;break;}_context3.next=32;return trySyncAllSubRules(setting);case 32:_context3.next=38;break;case 34:_context3.prev=34;_context3.t1=_context3["catch"](1);console.error("[KISS-Translator]",_context3.t1);showErr(_context3.t1.message);case 38:case"end":return _context3.stop();}},_callee3,null,[[1,34]]);}));return _run.apply(this,arguments);} ;// CONCATENATED MODULE: ./src/userscript.js common_run(true); }(); diff --git a/main.js b/main.js index 023c9212..a401ea8e 100644 --- a/main.js +++ b/main.js @@ -34220,11 +34220,11 @@ function _asyncToGenerator(fn) { * @returns */var useFetch=function useFetch(url){var _useState=(0,react.useState)(null),_useState2=_slicedToArray(_useState,2),data=_useState2[0],setData=_useState2[1];var _useState3=(0,react.useState)(false),_useState4=_slicedToArray(_useState3,2),loading=_useState4[0],setLoading=_useState4[1];var _useState5=(0,react.useState)(null),_useState6=_slicedToArray(_useState5,2),error=_useState6[0],setError=_useState6[1];(0,react.useEffect)(function(){if(!url){return;}_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var _res$headers$get,res,_data;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:setLoading(true);_context.prev=1;_context.next=4;return fetch(url);case 4:res=_context.sent;if(res.ok){_context.next=7;break;}throw new Error("[".concat(res.status,"] ").concat(res.statusText));case 7:if(!((_res$headers$get=res.headers.get("Content-Type"))!==null&&_res$headers$get!==void 0&&_res$headers$get.includes("json"))){_context.next=13;break;}_context.next=10;return res.json();case 10:_data=_context.sent;_context.next=16;break;case 13:_context.next=15;return res.text();case 15:_data=_context.sent;case 16:setData(_data);_context.next=22;break;case 19:_context.prev=19;_context.t0=_context["catch"](1);setError(_context.t0);case 22:_context.prev=22;setLoading(false);return _context.finish(22);case 25:case"end":return _context.stop();}},_callee,null,[[1,19,22,25]]);}))();},[url]);return[data,loading,error];}; ;// CONCATENATED MODULE: ./src/config/rules.js -var DEFAULT_SELECTOR=":is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)";var GLOBAL_KEY="*";var REMAIN_KEY="-";var SHADOW_KEY=">>>";var DEFAULT_RULE={pattern:"",selector:"",translator:GLOBAL_KEY,fromLang:GLOBAL_KEY,toLang:GLOBAL_KEY,textStyle:GLOBAL_KEY,transOpen:GLOBAL_KEY,bgColor:"",textDiyStyle:""};var DEFAULT_DIY_STYLE="color: #666;\nbackground: linear-gradient(\n 45deg,\n LightGreen 20%,\n LightPink 20% 40%,\n LightSalmon 40% 60%,\n LightSeaGreen 60% 80%,\n LightSkyBlue 80%\n);\n&:hover {\n color: #333;\n};";var DEFAULT_OW_RULE={translator:REMAIN_KEY,fromLang:REMAIN_KEY,toLang:REMAIN_KEY,textStyle:REMAIN_KEY,transOpen:REMAIN_KEY,bgColor:"",textDiyStyle:DEFAULT_DIY_STYLE};var RULES_MAP={"www.google.com/search":"h3, .IsZvec, .VwiC3b","news.google.com":"[role=\"link\"], .DY5T1d, .ifw3f, ".concat(DEFAULT_SELECTOR),"www.foxnews.com":"h1, h2, .title, .sidebar [data-type=\"Title\"], .article-content ".concat(DEFAULT_SELECTOR,"; [data-spotim-module=\"conversation\"]>div >>> [data-spot-im-class=\"message-text\"] p, [data-spot-im-class=\"message-text\"]"),"bearblog.dev, www.theverge.com, www.tampermonkey.net/documentation.php":"".concat(DEFAULT_SELECTOR),"themessenger.com":".leading-tight, .leading-tighter, .my-2 p, .font-body p, article ".concat(DEFAULT_SELECTOR),"www.telegraph.co.uk, go.dev/doc/":"article ".concat(DEFAULT_SELECTOR),"www.theguardian.com":".show-underline, .dcr-hup5wm div, .dcr-7vl6y8 div, .dcr-12evv1c, figcaption, article ".concat(DEFAULT_SELECTOR,", [data-cy=\"mostviewed-footer\"] h4"),"www.semafor.com":"".concat(DEFAULT_SELECTOR,", .styles_intro__IYj__, [class*=\"styles_description\"]"),"www.noemamag.com":".splash__title, .single-card__title, .single-card__type, .single-card__topic, .highlighted-content__title, .single-card__author, article ".concat(DEFAULT_SELECTOR,", .quote__text, .wp-caption-text div"),"restofworld.org":"".concat(DEFAULT_SELECTOR,", .recirc-story__headline, .recirc-story__dek"),"www.axios.com":".h7, ".concat(DEFAULT_SELECTOR),"www.newyorker.com":".summary-item__hed, .summary-item__dek, .summary-collection-grid__dek, .dqtvfu, .rubric__link, .caption, article ".concat(DEFAULT_SELECTOR,", .HEhan ").concat(DEFAULT_SELECTOR,", .ContributorBioBio-fBolsO"),"time.com":"h1, h3, .summary, .video-title, #article-body ".concat(DEFAULT_SELECTOR,", .image-wrap-container .credit.body-caption, .media-heading"),"www.dw.com":".ts-teaser-title a, .news-title a, .title a, .teaser-description a, .hbudab h3, .hbudab p, figcaption ,article ".concat(DEFAULT_SELECTOR),"www.bbc.com":"h1, h2, .media__link, .media__summary, article ".concat(DEFAULT_SELECTOR,", .ssrcss-y7krbn-Stack, .ssrcss-17zglt8-PromoHeadline, .ssrcss-18cjaf3-Headline, .gs-c-promo-heading__title, .gs-c-promo-summary, .media__content h3, .article__intro"),"www.chinadaily.com.cn":"h1, .tMain [shape=\"rect\"], .cMain [shape=\"rect\"], .photo_art [shape=\"rect\"], .mai_r [shape=\"rect\"], .lisBox li, #Content ".concat(DEFAULT_SELECTOR),"www.facebook.com":"[role=\"main\"] [dir=\"auto\"]","www.reddit.com":"[slot=\"title\"], [slot=\"text-body\"] ".concat(DEFAULT_SELECTOR,", #-post-rtjson-content p"),"www.quora.com":".qu-wordBreak--break-word","edition.cnn.com":".container__title, .container__headline, .headline__text, .image__caption, [data-type=\"Title\"], .article__content ".concat(DEFAULT_SELECTOR),"www.reuters.com":"#main-content [data-testid=\"Heading\"], #main-content [data-testid=\"Body\"], .article-body__content__17Yit ".concat(DEFAULT_SELECTOR),"www.bloomberg.com":"[data-component=\"headline\"], [data-component=\"related-item-headline\"], [data-component=\"title\"], article ".concat(DEFAULT_SELECTOR),"deno.land, docs.github.com":"main ".concat(DEFAULT_SELECTOR),"doc.rust-lang.org":".content ".concat(DEFAULT_SELECTOR),"www.indiehackers.com":"h1, h3, .content ".concat(DEFAULT_SELECTOR,", .feed-item__title-link"),"platform.openai.com/docs":".docs-body ".concat(DEFAULT_SELECTOR),"en.wikipedia.org":"h1, .mw-parser-output ".concat(DEFAULT_SELECTOR),"stackoverflow.com":"h1, .s-prose p, .comment-body .comment-copy","www.npmjs.com/package, developer.chrome.com/docs, medium.com, developers.cloudflare.com, react.dev, create-react-app.dev, pytorch.org":"article ".concat(DEFAULT_SELECTOR),"news.ycombinator.com":".title, .commtext","github.com":".markdown-body ".concat(DEFAULT_SELECTOR,", .repo-description p, .Layout-sidebar .f4, .container-lg .py-4 .f5, .container-lg .my-4 .f5, .Box-row .pr-4, .Box-row article .mt-1, [itemprop=\"description\"], .markdown-title, bdi, .ws-pre-wrap, .status-meta, span.status-meta, .col-10.color-fg-muted, .TimelineItem-body, .pinned-item-list-item-content .color-fg-muted, .markdown-body td, .markdown-body th"),"twitter.com":"[data-testid=\"tweetText\"]","m.youtube.com":".slim-video-information-title .yt-core-attributed-string, .media-item-headline .yt-core-attributed-string, .comment-text .yt-core-attributed-string, .typography-body-2b .yt-core-attributed-string, #ytp-caption-window-container .ytp-caption-segment","www.youtube.com":"h1, #video-title, #content-text, #title, yt-attributed-string>span>span, #ytp-caption-window-container .ytp-caption-segment","bard.google.com":".query-content ".concat(DEFAULT_SELECTOR,", message-content ").concat(DEFAULT_SELECTOR),"www.bing.com":".b_algoSlug, .rwrl_padref; .cib-serp-main >>> .ac-textBlock ".concat(DEFAULT_SELECTOR,", .text-message-content div"),"www.phoronix.com":"article ".concat(DEFAULT_SELECTOR),"wx2.qq.com":".js_message_plain","app.slack.com/client/":".p-rich_text_section, .c-message_attachment__text, .p-rich_text_list li","discord.com/channels/":"div[id^=message-content]","t.me/s/":".js-message_text ".concat(DEFAULT_SELECTOR),"web.telegram.org/k/":".message, .bot-commands-list-element-description, .reply-markup-button-text","web.telegram.org/a/":".message, .text-content, .bot-commands-list-element-description, .reply-markup-button-text","chromereleases.googleblog.com":".title, .publishdate, p, i, .header-desc, .header-title, .text","www.instagram.com/":"h1, article span[dir=auto] > span[dir=auto], ._ab1y","www.instagram.com/p/,www.instagram.com/reels/":"h1, div[class='x9f619 xjbqb8w x78zum5 x168nmei x13lgxp2 x5pf9jr xo71vjh x1uhb9sk x1plvlek xryxfnj x1c4vz4f x2lah0s xdt5ytf xqjyukv x1cy8zhl x1oa3qoh x1nhvcw1'] > span[class='x1lliihq x1plvlek xryxfnj x1n2onr6 x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs x1s928wv xhkezso x1gmr53x x1cpjm7i x1fgarty x1943h6x x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj'], span[class='x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs xt0psk2 x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj']","mail.google.com":"".concat(DEFAULT_SELECTOR,", h2[data-thread-perm-id], span[data-thread-id], div[data-message-id] div[class=''], .messageBody, #views"),"web.whatsapp.com":".copyable-text > span","chat.openai.com":"div[data-message-author-role] > div ".concat(DEFAULT_SELECTOR),"forum.ru-board.com":".tit, .dats, span.post ".concat(DEFAULT_SELECTOR),"education.github.com":"".concat(DEFAULT_SELECTOR,", a, summary, span.Button-content"),"blogs.windows.com":"".concat(DEFAULT_SELECTOR,", .c-uhf-nav-link, figcaption"),"developer.apple.com/documentation/":"#main ".concat(DEFAULT_SELECTOR,", #main .abstract .content, #main .abstract.content, #main .link span")};var BUILTIN_RULES=Object.entries(RULES_MAP).sort(function(a,b){return a[0].localeCompare(b[0]);}).map(function(_ref){var _ref2=_slicedToArray(_ref,2),pattern=_ref2[0],selector=_ref2[1];return _objectSpread2(_objectSpread2({},DEFAULT_RULE),{},{pattern:pattern,selector:selector});}); +var DEFAULT_SELECTOR=":is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)";var DEFAULT_KEEP_SELECTOR="code, img, svg";var GLOBAL_KEY="*";var REMAIN_KEY="-";var SHADOW_KEY=">>>";var DEFAULT_RULE={pattern:"",selector:"",keepSelector:"",translator:GLOBAL_KEY,fromLang:GLOBAL_KEY,toLang:GLOBAL_KEY,textStyle:GLOBAL_KEY,transOpen:GLOBAL_KEY,bgColor:"",textDiyStyle:""};var DEFAULT_DIY_STYLE="color: #666;\nbackground: linear-gradient(\n 45deg,\n LightGreen 20%,\n LightPink 20% 40%,\n LightSalmon 40% 60%,\n LightSeaGreen 60% 80%,\n LightSkyBlue 80%\n);\n&:hover {\n color: #333;\n};";var DEFAULT_OW_RULE={translator:REMAIN_KEY,fromLang:REMAIN_KEY,toLang:REMAIN_KEY,textStyle:REMAIN_KEY,transOpen:REMAIN_KEY,bgColor:"",textDiyStyle:DEFAULT_DIY_STYLE};var RULES_MAP={"www.google.com/search":["h3, .IsZvec, .VwiC3b"],"news.google.com":["[role=\"link\"], .DY5T1d, .ifw3f, ".concat(DEFAULT_SELECTOR)],"www.foxnews.com":["h1, h2, .title, .sidebar [data-type=\"Title\"], .article-content ".concat(DEFAULT_SELECTOR,"; [data-spotim-module=\"conversation\"]>div >>> [data-spot-im-class=\"message-text\"] p, [data-spot-im-class=\"message-text\"]")],"bearblog.dev, www.theverge.com, www.tampermonkey.net/documentation.php":["".concat(DEFAULT_SELECTOR)],"themessenger.com":[".leading-tight, .leading-tighter, .my-2 p, .font-body p, article ".concat(DEFAULT_SELECTOR)],"www.telegraph.co.uk, go.dev/doc/":["article ".concat(DEFAULT_SELECTOR)],"www.theguardian.com":[".show-underline, .dcr-hup5wm div, .dcr-7vl6y8 div, .dcr-12evv1c, figcaption, article ".concat(DEFAULT_SELECTOR,", [data-cy=\"mostviewed-footer\"] h4")],"www.semafor.com":["".concat(DEFAULT_SELECTOR,", .styles_intro__IYj__, [class*=\"styles_description\"]")],"www.noemamag.com":[".splash__title, .single-card__title, .single-card__type, .single-card__topic, .highlighted-content__title, .single-card__author, article ".concat(DEFAULT_SELECTOR,", .quote__text, .wp-caption-text div")],"restofworld.org":["".concat(DEFAULT_SELECTOR,", .recirc-story__headline, .recirc-story__dek")],"www.axios.com":[".h7, ".concat(DEFAULT_SELECTOR)],"www.newyorker.com":[".summary-item__hed, .summary-item__dek, .summary-collection-grid__dek, .dqtvfu, .rubric__link, .caption, article ".concat(DEFAULT_SELECTOR,", .HEhan ").concat(DEFAULT_SELECTOR,", .ContributorBioBio-fBolsO, .BaseText-ewhhUZ")],"time.com":["h1, h3, .summary, .video-title, #article-body ".concat(DEFAULT_SELECTOR,", .image-wrap-container .credit.body-caption, .media-heading")],"www.dw.com":[".ts-teaser-title a, .news-title a, .title a, .teaser-description a, .hbudab h3, .hbudab p, figcaption ,article ".concat(DEFAULT_SELECTOR)],"www.bbc.com":["h1, h2, .media__link, .media__summary, article ".concat(DEFAULT_SELECTOR,", .ssrcss-y7krbn-Stack, .ssrcss-17zglt8-PromoHeadline, .ssrcss-18cjaf3-Headline, .gs-c-promo-heading__title, .gs-c-promo-summary, .media__content h3, .article__intro, .lx-c-summary-points>li")],"www.chinadaily.com.cn":["h1, .tMain [shape=\"rect\"], .cMain [shape=\"rect\"], .photo_art [shape=\"rect\"], .mai_r [shape=\"rect\"], .lisBox li, #Content ".concat(DEFAULT_SELECTOR)],"www.facebook.com":["[role=\"main\"] [dir=\"auto\"]"],"www.reddit.com":["div:is(.tbIApBd2DM_drfZQJjIum, ._1zPvgKHteTOub9dKkvrOl4,.ULWj94BYSOqoJDetxgcnU),a:is([class^=\"_334yl59\"],[class^=\"_2GrMpxD\"]),h1,h2,h3,h4,h5,h6,p,button"],"www.quora.com":[".qu-wordBreak--break-word"],"edition.cnn.com":[".container__title, .container__headline, .headline__text, .image__caption, [data-type=\"Title\"], .article__content ".concat(DEFAULT_SELECTOR)],"www.reuters.com":["#main-content [data-testid=\"Heading\"], #main-content [data-testid=\"Body\"], .article-body__content__17Yit ".concat(DEFAULT_SELECTOR)],"www.bloomberg.com":["[data-component=\"headline\"], [data-component=\"related-item-headline\"], [data-component=\"title\"], article ".concat(DEFAULT_SELECTOR)],"deno.land, docs.github.com":["main ".concat(DEFAULT_SELECTOR),"code, img, svg"],"doc.rust-lang.org":[".content ".concat(DEFAULT_SELECTOR),"code, img, svg"],"www.indiehackers.com":["h1, h3, .content ".concat(DEFAULT_SELECTOR,", .feed-item__title-link")],"platform.openai.com/docs":[".docs-body ".concat(DEFAULT_SELECTOR),"code, img, svg"],"en.wikipedia.org":["h1, .mw-parser-output ".concat(DEFAULT_SELECTOR),".mwe-math-element"],"stackoverflow.com":["h1, .s-prose p, .comment-body .comment-copy","code, img, svg"],"www.npmjs.com/package, developer.chrome.com/docs, medium.com, developers.cloudflare.com, react.dev, create-react-app.dev, pytorch.org":["article ".concat(DEFAULT_SELECTOR)],"news.ycombinator.com":[".title, .commtext"],"github.com":[".markdown-body ".concat(DEFAULT_SELECTOR,", .repo-description p, .Layout-sidebar .f4, .container-lg .py-4 .f5, .container-lg .my-4 .f5, .Box-row .pr-4, .Box-row article .mt-1, [itemprop=\"description\"], .markdown-title, bdi, .ws-pre-wrap, .status-meta, span.status-meta, .col-10.color-fg-muted, .TimelineItem-body, .pinned-item-list-item-content .color-fg-muted, .markdown-body td, .markdown-body th"),"code, img, svg"],"twitter.com":["[data-testid=\"tweetText\"], [data-testid=\"birdwatch-pivot\"]>div.css-1rynq56","img, a, .r-18u37iz, .css-175oi2r"],"m.youtube.com":[".slim-video-information-title .yt-core-attributed-string, .media-item-headline .yt-core-attributed-string, .comment-text .yt-core-attributed-string, .typography-body-2b .yt-core-attributed-string, #ytp-caption-window-container .ytp-caption-segment"],"www.youtube.com":["h1, #video-title, #content-text, #title, yt-attributed-string>span>span, #ytp-caption-window-container .ytp-caption-segment"],"bard.google.com":[".query-content ".concat(DEFAULT_SELECTOR,", message-content ").concat(DEFAULT_SELECTOR)],"www.bing.com":[".b_algoSlug, .rwrl_padref; .cib-serp-main >>> .ac-textBlock ".concat(DEFAULT_SELECTOR,", .text-message-content div")],"www.phoronix.com":["article ".concat(DEFAULT_SELECTOR)],"wx2.qq.com":[".js_message_plain"],"app.slack.com/client/":[".p-rich_text_section, .c-message_attachment__text, .p-rich_text_list li"],"discord.com/channels/":["li[id^=chat-messages] div[id^=message-content], div[class^=headerText], div[class^=name_], section[aria-label='Search Results'] div[id^=message-content]"],"t.me/s/":[".js-message_text ".concat(DEFAULT_SELECTOR)],"web.telegram.org/k/":[".message, .bot-commands-list-element-description, .reply-markup-button-text"],"web.telegram.org/a/":[".message, .text-content, .bot-commands-list-element-description, .reply-markup-button-text"],"chromereleases.googleblog.com":[".title, .publishdate, p, i, .header-desc, .header-title, .text"],"www.instagram.com/":["h1, article span[dir=auto] > span[dir=auto], ._ab1y"],"www.instagram.com/p/,www.instagram.com/reels/":["h1, div[class='x9f619 xjbqb8w x78zum5 x168nmei x13lgxp2 x5pf9jr xo71vjh x1uhb9sk x1plvlek xryxfnj x1c4vz4f x2lah0s xdt5ytf xqjyukv x1cy8zhl x1oa3qoh x1nhvcw1'] > span[class='x1lliihq x1plvlek xryxfnj x1n2onr6 x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs x1s928wv xhkezso x1gmr53x x1cpjm7i x1fgarty x1943h6x x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj'], span[class='x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs xt0psk2 x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj']"],"mail.google.com":["".concat(DEFAULT_SELECTOR,", h2[data-thread-perm-id], span[data-thread-id], div[data-message-id] div[class=''], .messageBody, #views")],"web.whatsapp.com":[".copyable-text > span"],"chat.openai.com":["div[data-message-author-role] > div ".concat(DEFAULT_SELECTOR)],"forum.ru-board.com":[".tit, .dats, span.post, .lgf ".concat(DEFAULT_SELECTOR)],"education.github.com":["".concat(DEFAULT_SELECTOR,", a, summary, span.Button-content")],"blogs.windows.com":["".concat(DEFAULT_SELECTOR,", .c-uhf-nav-link, figcaption")],"developer.apple.com/documentation/":["#main ".concat(DEFAULT_SELECTOR,", #main .abstract .content, #main .abstract.content, #main .link span"),"code, img, svg"],"greasyfork.org":["h2, .script-link, .script-description, #additional-info ".concat(DEFAULT_SELECTOR)],"www.fmkorea.com":["#container ".concat(DEFAULT_SELECTOR)],"forum.arduino.cc":[".top-row>.title, .featured-topic>.title, .link-top-line>.title, .category-description, .topic-excerpt, .fancy-title, .cooked ".concat(DEFAULT_SELECTOR)],"docs.arduino.cc":["[class^=\"tutorial-module--left\"] ".concat(DEFAULT_SELECTOR)],"www.historydefined.net":[".wp-element-caption, ".concat(DEFAULT_SELECTOR)]};var BUILTIN_RULES=Object.entries(RULES_MAP).sort(function(a,b){return a[0].localeCompare(b[0]);}).map(function(_ref){var _ref2=_slicedToArray(_ref,2),pattern=_ref2[0],_ref2$=_slicedToArray(_ref2[1],2),selector=_ref2$[0],_ref2$$=_ref2$[1],keepSelector=_ref2$$===void 0?"":_ref2$$;return _objectSpread2(_objectSpread2({},DEFAULT_RULE),{},{pattern:pattern,selector:selector,keepSelector:keepSelector});}); ;// CONCATENATED MODULE: ./src/config/app.js var APP_NAME="KISS Translator".trim().split(/\s+/).join("-");var APP_LCNAME=APP_NAME.toLowerCase(); ;// CONCATENATED MODULE: ./src/config/i18n.js -var UI_LANGS=(/* unused pure expression or super */ null && ([["en","English"],["zh","中文"]]));var customApiLangs="[\"en\", \"English - English\"],\n[\"zh-CN\", \"Simplified Chinese - \u7B80\u4F53\u4E2D\u6587\"],\n[\"zh-TW\", \"Traditional Chinese - \u7E41\u9AD4\u4E2D\u6587\"],\n[\"ar\", \"Arabic - \u0627\u0644\u0639\u0631\u0628\u064A\u0629\"],\n[\"bg\", \"Bulgarian - \u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438\"],\n[\"ca\", \"Catalan - Catal\xE0\"],\n[\"hr\", \"Croatian - Hrvatski\"],\n[\"cs\", \"Czech - \u010Ce\u0161tina\"],\n[\"da\", \"Danish - Dansk\"],\n[\"nl\", \"Dutch - Nederlands\"],\n[\"fi\", \"Finnish - Suomi\"],\n[\"fr\", \"French - Fran\xE7ais\"],\n[\"de\", \"German - Deutsch\"],\n[\"el\", \"Greek - \u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC\"],\n[\"hi\", \"Hindi - \u0939\u093F\u0928\u094D\u0926\u0940\"],\n[\"hu\", \"Hungarian - Magyar\"],\n[\"id\", \"Indonesian - Indonesia\"],\n[\"it\", \"Italian - Italiano\"],\n[\"ja\", \"Japanese - \u65E5\u672C\u8A9E\"],\n[\"ko\", \"Korean - \uD55C\uAD6D\uC5B4\"],\n[\"ms\", \"Malay - Melayu\"],\n[\"mt\", \"Maltese - Malti\"],\n[\"nb\", \"Norwegian - Norsk Bokm\xE5l\"],\n[\"pl\", \"Polish - Polski\"],\n[\"pt\", \"Portuguese - Portugu\xEAs\"],\n[\"ro\", \"Romanian - Rom\xE2n\u0103\"],\n[\"ru\", \"Russian - \u0420\u0443\u0441\u0441\u043A\u0438\u0439\"],\n[\"sk\", \"Slovak - Sloven\u010Dina\"],\n[\"sl\", \"Slovenian - Sloven\u0161\u010Dina\"],\n[\"es\", \"Spanish - Espa\xF1ol\"],\n[\"sv\", \"Swedish - Svenska\"],\n[\"ta\", \"Tamil - \u0BA4\u0BAE\u0BBF\u0BB4\u0BCD\"],\n[\"te\", \"Telugu - \u0C24\u0C46\u0C32\u0C41\u0C17\u0C41\"],\n[\"th\", \"Thai - \u0E44\u0E17\u0E22\"],\n[\"tr\", \"Turkish - T\xFCrk\xE7e\"],\n[\"uk\", \"Ukrainian - \u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430\"],\n[\"vi\", \"Vietnamese - Ti\u1EBFng Vi\u1EC7t\"],\n";var customApiHelpZH="/// \u81EA\u5B9A\u4E49\u7FFB\u8BD1\u6E90\u63A5\u53E3\u8BF4\u660E\n\n// \u8BF7\u6C42\uFF08Request\uFF09\u6570\u636E\u5C06\u6309\u4E0B\u9762\u89C4\u8303\u53D1\u9001\n{\n url: {{YOUR_URL}},\n method: \"POST\",\n headers: {\n \"Content-type\": \"application/json\",\n \"Authorization\": \"Bearer {{YOUR_KEY}}\",\n },\n body: {\n text: \"\", // \u9700\u8981\u7FFB\u8BD1\u7684\u6587\u5B57\n from: \"\", // \u6E90\u8BED\u8A00\uFF0C\u53EF\u80FD\u4E3A\u7A7A\uFF0C\u8868\u793A\u9700\u8981\u63A5\u53E3\u81EA\u52A8\u8BC6\u522B\u8BED\u8A00\n to: \"\", // \u76EE\u6807\u8BED\u8A00\n }\n}\n\n// \u8FD4\u56DE\uFF08Response\uFF09\u6570\u636E\u9700\u7B26\u5408\u4E0B\u9762\u7684JSON\u89C4\u8303\n{\n text: \"\", // \u7FFB\u8BD1\u540E\u7684\u6587\u5B57\n from: \"\", // \u8BC6\u522B\u7684\u6E90\u8BED\u8A00\n to: \"\", // \u76EE\u6807\u8BED\u8A00\uFF08\u53EF\u9009\uFF09\n}\n\n// \u652F\u6301\u7684\u8BED\u8A00\u4EE3\u7801\u5982\u4E0B\n".concat(customApiLangs,"\n");var customApiHelpEN="/// Custom translation source interface description\n\n// Request data will be sent according to the following specifications\n{\n url: {{YOUR_URL}},\n method: \"POST\",\n headers: {\n \"Content-type\": \"application/json\",\n \"Authorization\": \"Bearer {{YOUR_KEY}}\",\n },\n body: {\n text: \"\", // text to be translated\n from: \"\", // Source language, may be empty\n to: \"\", // Target language\n }\n}\n\n// The returned data must conform to the following JSON specification\n{\n text: \"\", // translated text\n from: \"\", // Recognized source language\n to: \"\", // Target language (optional)\n}\n\n// The supported language codes are as follows\n".concat(customApiLangs,"\n");var I18N={app_name:{zh:"\u7B80\u7EA6\u7FFB\u8BD1",en:"KISS Translator"},translate:{zh:"\u7FFB\u8BD1",en:"Translate"},custom_api_help:{zh:customApiHelpZH,en:customApiHelpEN},translate_alt:{zh:"\u7FFB\u8BD1 (Alt+Q)",en:"Translate (Alt+Q)"},basic_setting:{zh:"\u57FA\u672C\u8BBE\u7F6E",en:"Basic Setting"},rules_setting:{zh:"\u89C4\u5219\u8BBE\u7F6E",en:"Rules Setting"},apis_setting:{zh:"\u63A5\u53E3\u8BBE\u7F6E",en:"Apis Setting"},sync_setting:{zh:"\u540C\u6B65\u8BBE\u7F6E",en:"Sync Setting"},patch_setting:{zh:"\u8865\u4E01\u8BBE\u7F6E",en:"Patch Setting"},patch_setting_help:{zh:"\u9488\u5BF9\u4E00\u4E9B\u7279\u6B8A\u7F51\u7AD9\u7684\u4FEE\u6B63\u811A\u672C\uFF0C\u4EE5\u4FBF\u7FFB\u8BD1\u8F6F\u4EF6\u5F97\u5230\u66F4\u597D\u7684\u5C55\u793A\u6548\u679C\u3002",en:"Corrected scripts for some special websites so that the translation software can get better display results."},inject_webfix:{zh:"\u6CE8\u5165\u4FEE\u590D\u8865\u4E01",en:"Inject Webfix"},about:{zh:"\u5173\u4E8E",en:"About"},about_md:{zh:"README.md",en:"README.en.md"},about_md_local:{zh:"\u8BF7 [\u70B9\u51FB\u8FD9\u91CC](".concat("https://github.com/fishjar/kiss-translator",") \u67E5\u770B\u8BE6\u60C5\u3002"),en:"Please [click here](".concat("https://github.com/fishjar/kiss-translator",") for details.")},ui_lang:{zh:"\u754C\u9762\u8BED\u8A00",en:"Interface Language"},fetch_limit:{zh:"\u6700\u5927\u8BF7\u6C42\u6570\u91CF (1-100)",en:"Maximum Number Of Request (1-100)"},fetch_interval:{zh:"\u8BF7\u6C42\u95F4\u9694\u65F6\u95F4 (0-5000ms)",en:"Request Interval (0-5000ms)"},min_translate_length:{zh:"\u6700\u5C0F\u7FFB\u8BD1\u957F\u5EA6 (1-100)",en:"Min Translate Length (1-100)"},max_translate_length:{zh:"\u6700\u5927\u7FFB\u8BD1\u957F\u5EA6 (100-10000)",en:"Max Translate Length (100-10000)"},num_of_newline_characters:{zh:"\u6362\u884C\u5B57\u7B26\u6570 (1-1000)",en:"Number of Newline Characters (1-1000)"},translate_service:{zh:"\u7FFB\u8BD1\u670D\u52A1",en:"Translate Service"},mouseover_translation:{zh:"\u9F20\u6807\u60AC\u505C\u7FFB\u8BD1",en:"Mouseover translation"},mk_disable:{zh:"\u7981\u7528",en:"Disable"},mk_mouseover:{zh:"\u9F20\u6807\u60AC\u505C",en:"Mouseover"},mk_ctrlKey:{zh:"Control + \u9F20\u6807\u60AC\u505C",en:"Control + Mouseover"},mk_shiftKey:{zh:"Shift + \u9F20\u6807\u60AC\u505C",en:"Shift + Mouseover"},mk_altKey:{zh:"Alt + \u9F20\u6807\u60AC\u505C",en:"Alt + Mouseover"},from_lang:{zh:"\u539F\u6587\u8BED\u8A00",en:"Source Language"},to_lang:{zh:"\u76EE\u6807\u8BED\u8A00",en:"Target Language"},to_lang2:{zh:"\u7B2C\u4E8C\u76EE\u6807\u8BED\u8A00",en:"Target Language 2"},to_lang2_helper:{zh:"\u8BBE\u5B9A\u540E\uFF0C\u4E0E\u76EE\u6807\u8BED\u8A00\u4EA7\u751F\u4E92\u8BD1\u6548\u679C\uFF0C\u4F46\u4F9D\u8D56\u8FDC\u7A0B\u8BED\u8A00\u8BC6\u522B\u3002",en:"After setting, it will produce mutual translation effect with the target language, but it relies on remote language recognition."},text_style:{zh:"\u6587\u5B57\u6837\u5F0F",en:"Text Style"},text_style_alt:{zh:"\u6587\u5B57\u6837\u5F0F (Alt+C)",en:"Text Style (Alt+C)"},bg_color:{zh:"\u6837\u5F0F\u989C\u8272",en:"Style Color"},remain_unchanged:{zh:"\u4FDD\u7559\u4E0D\u53D8",en:"Remain Unchanged"},google_api:{zh:"\u8C37\u6B4C\u7FFB\u8BD1\u63A5\u53E3",en:"Google Translate API"},default_selector:{zh:"\u9ED8\u8BA4\u9009\u62E9\u5668",en:"Default selector"},selector_rules:{zh:"\u9009\u62E9\u5668\u89C4\u5219",en:"Selector Rules"},save:{zh:"\u4FDD\u5B58",en:"Save"},edit:{zh:"\u7F16\u8F91",en:"Edit"},cancel:{zh:"\u53D6\u6D88",en:"Cancel"},delete:{zh:"\u5220\u9664",en:"Delete"},reset:{zh:"\u91CD\u7F6E",en:"Reset"},add:{zh:"\u6DFB\u52A0",en:"Add"},inject_rules:{zh:"\u6CE8\u5165\u8BA2\u9605\u89C4\u5219",en:"Inject Subscribe Rules"},personal_rules:{zh:"\u4E2A\u4EBA\u89C4\u5219",en:"Rules"},subscribe_rules:{zh:"\u8BA2\u9605\u89C4\u5219",en:"Subscribe"},overwrite_subscribe_rules:{zh:"\u8986\u5199\u8BA2\u9605\u89C4\u5219",en:"Overwrite"},subscribe_url:{zh:"\u8BA2\u9605\u5730\u5740",en:"Subscribe URL"},rules_warn_1:{zh:"1\u3001\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u4E00\u76F4\u751F\u6548\uFF0C\u9009\u62E9\u201C\u6CE8\u5165\u8BA2\u9605\u89C4\u5219\u201D\u540E\uFF0C\u201C\u8BA2\u9605\u89C4\u5219\u201D\u624D\u4F1A\u751F\u6548\u3002",en:"1. The \"Personal Rules\" are always in effect. After selecting \"Inject Subscription Rules\", the \"Subscription Rules\" will take effect."},rules_warn_2:{zh:"2\u3001\u201C\u8BA2\u9605\u89C4\u5219\u201D\u7684\u6CE8\u5165\u4F4D\u7F6E\u662F\u5012\u6570\u7B2C\u4E8C\u7684\u4F4D\u7F6E\uFF0C\u56E0\u6B64\u9664\u5168\u5C40\u89C4\u5219(*)\u5916\uFF0C\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u4F18\u5148\u7EA7\u6BD4\u201C\u8BA2\u9605\u89C4\u5219\u201D\u9AD8\uFF0C\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u586B\u5199\u540C\u6837\u7684\u7F51\u5740\u4F1A\u8986\u76D6\u201D\u8BA2\u9605\u89C4\u5219\u201C\u7684\u6761\u76EE\u3002",en:"2. The injection position of \"Subscription Rules\" is the penultimate position. Therefore, except for the global rules (*), the priority of \"Personal Rules\" is higher than that of \"Subscription Rules\". Filling in the same url in \"Personal Rules\" will overwrite \"Subscription Rules\" entry."},sync_warn:{zh:"\u5982\u679C\u670D\u52A1\u5668\u5B58\u5728\u5176\u4ED6\u5BA2\u6237\u7AEF\u540C\u6B65\u7684\u6570\u636E\uFF0C\u7B2C\u4E00\u6B21\u540C\u6B65\u5C06\u76F4\u63A5\u8986\u76D6\u672C\u5730\u914D\u7F6E\uFF0C\u540E\u9762\u5219\u6839\u636E\u4FEE\u6539\u65F6\u95F4\uFF0C\u65B0\u7684\u8986\u76D6\u65E7\u7684\u3002",en:"If the server has data synchronized by other clients, the first synchronization will directly overwrite the local configuration, and later, according to the modification time, the new one will overwrite the old one."},about_sync_api:{zh:"\u67E5\u770B\u5173\u4E8E\u6570\u636E\u540C\u6B65\u63A5\u53E3\u90E8\u7F72",en:"View About Data Synchronization Interface Deployment"},about_api_proxy:{zh:"\u67E5\u770B\u81EA\u5EFA\u4E00\u4E2A\u7FFB\u8BD1\u63A5\u53E3\u4EE3\u7406",en:"Check out the self-built translation interface proxy"},style_none:{zh:"\u65E0",en:"None"},under_line:{zh:"\u4E0B\u5212\u76F4\u7EBF",en:"Underline"},dot_line:{zh:"\u4E0B\u5212\u70B9\u72B6\u7EBF",en:"Dotted Underline"},dash_line:{zh:"\u4E0B\u5212\u865A\u7EBF",en:"Dashed Underline"},wavy_line:{zh:"\u4E0B\u5212\u6CE2\u6D6A\u7EBF",en:"Wavy Underline"},fuzzy:{zh:"\u6A21\u7CCA",en:"Fuzzy"},highlight:{zh:"\u9AD8\u4EAE",en:"Highlight"},blockquote:{zh:"\u5F15\u7528",en:"Blockquote"},diy_style:{zh:"\u81EA\u5B9A\u4E49\u6837\u5F0F",en:"Custom Style"},diy_style_helper:{zh:"\u9075\u5FAA\u201CCSS\u201D\u7684\u8BED\u6CD5",en:"Follow the syntax of \"CSS\""},setting:{zh:"\u8BBE\u7F6E (Alt+O)",en:"Setting (Alt+O)"},pattern:{zh:"\u5339\u914D\u7F51\u5740",en:"URL pattern"},pattern_helper:{zh:"1\u3001\u652F\u6301\u661F\u53F7(*)\u901A\u914D\u7B26\u30022\u3001\u591A\u4E2AURL\u7528\u82F1\u6587\u9017\u53F7\u201C,\u201D\u5206\u9694\u3002",en:"1. The asterisk (*) wildcard is supported. 2. Multiple URLs separated by English commas \",\"."},selector_helper:{zh:"1\u3001\u9075\u5FAACSS\u9009\u62E9\u5668\u8BED\u6CD5\u30022\u3001\u7559\u7A7A\u8868\u793A\u91C7\u7528\u5168\u5C40\u8BBE\u7F6E\u30023\u3001\u591A\u4E2ACSS\u9009\u62E9\u5668\u4E4B\u95F4\u7528\u201C;\u201D\u9694\u5F00\u30024\u3001\u201Cshadow root\u201D\u9009\u62E9\u5668\u548C\u5185\u90E8\u9009\u62E9\u5668\u7528\u201C>>>\u201D\u9694\u5F00\u3002",en:"1. Follow CSS selector syntax. 2. Leave blank to adopt the global setting. 3. Separate multiple CSS selectors with \";\". 4. The \"shadow root\" selector and the internal selector are separated by \">>>\"."},translate_switch:{zh:"\u5F00\u542F\u7FFB\u8BD1",en:"Translate Switch"},default_enabled:{zh:"\u9ED8\u8BA4\u5F00\u542F",en:"Enabled"},default_disabled:{zh:"\u9ED8\u8BA4\u5173\u95ED",en:"Disabled"},selector:{zh:"\u9009\u62E9\u5668",en:"Selector"},root_selector:{zh:"\u6839\u9009\u62E9\u5668",en:"Root Selector"},fixer_function:{zh:"\u4FEE\u590D\u51FD\u6570",en:"Fixer Function"},import:{zh:"\u5BFC\u5165",en:"Import"},export:{zh:"\u5BFC\u51FA",en:"Export"},error_cant_be_blank:{zh:"\u4E0D\u80FD\u4E3A\u7A7A",en:"Can not be blank"},error_duplicate_values:{zh:"\u5B58\u5728\u91CD\u590D\u7684\u503C",en:"There are duplicate values"},error_wrong_file_type:{zh:"\u9519\u8BEF\u7684\u6587\u4EF6\u7C7B\u578B",en:"Wrong file type"},error_fetch_url:{zh:"\u8BF7\u68C0\u67E5url\u5730\u5740\u662F\u5426\u6B63\u786E\u6216\u7A0D\u540E\u518D\u8BD5\u3002",en:"Please check if the url address is correct or try again later."},deepl_api:{zh:"DeepL \u63A5\u53E3",en:"DeepL API"},deepl_key:{zh:"DeepL \u5BC6\u94A5",en:"DeepL Key"},openai_api:{zh:"OpenAI \u63A5\u53E3",en:"OpenAI API"},openai_key:{zh:"OpenAI \u5BC6\u94A5",en:"OpenAI Key"},openai_model:{zh:"OpenAI \u6A21\u578B",en:"OpenAI Model"},openai_prompt:{zh:"OpenAI \u63D0\u793A\u8BCD",en:"OpenAI Prompt"},if_clear_cache:{zh:"\u662F\u5426\u6E05\u9664\u7F13\u5B58",en:"Whether clear cache"},clear_cache_never:{zh:"\u4E0D\u6E05\u9664\u7F13\u5B58",en:"Never clear cache"},clear_cache_restart:{zh:"\u91CD\u542F\u6D4F\u89C8\u5668\u65F6\u6E05\u9664\u7F13\u5B58",en:"Clear cache when restarting browser"},data_sync_type:{zh:"\u6570\u636E\u540C\u6B65\u65B9\u5F0F",en:"Data Sync Type"},data_sync_url:{zh:"\u6570\u636E\u540C\u6B65\u63A5\u53E3",en:"Data Sync API"},data_sync_user:{zh:"\u6570\u636E\u540C\u6B65\u8D26\u6237",en:"Data Sync User"},data_sync_key:{zh:"\u6570\u636E\u540C\u6B65\u5BC6\u94A5",en:"Data Sync Key"},sync_now:{zh:"\u7ACB\u5373\u540C\u6B65",en:"Sync Now"},sync_success:{zh:"\u540C\u6B65\u6210\u529F\uFF01",en:"Sync Success"},sync_failed:{zh:"\u540C\u6B65\u5931\u8D25\uFF01",en:"Sync Error"},error_got_some_wrong:{zh:"\u62B1\u6B49\uFF0C\u51FA\u9519\u4E86\uFF01",en:"Sorry, something went wrong!"},error_sync_setting:{zh:"\u60A8\u7684\u540C\u6B65\u7C7B\u578B\u5FC5\u987B\u4E3A\u201CKISS-Worker\u201D\uFF0C\u4E14\u9700\u586B\u5199\u5B8C\u6574",en:"Your sync type must be \"KISS-Worker\" and must be filled in completely"},click_test:{zh:"\u70B9\u51FB\u6D4B\u8BD5",en:"Click Test"},test_success:{zh:"\u6D4B\u8BD5\u6210\u529F",en:"Test success"},test_failed:{zh:"\u6D4B\u8BD5\u5931\u8D25",en:"Test failed"},clear_all_cache_now:{zh:"\u7ACB\u5373\u6E05\u9664\u5168\u90E8\u7F13\u5B58",en:"Clear all cache now"},clear_cache:{zh:"\u6E05\u9664\u7F13\u5B58",en:"Clear Cache"},clear_success:{zh:"\u6E05\u9664\u6210\u529F",en:"Clear success"},clear_failed:{zh:"\u6E05\u9664\u5931\u8D25",en:"Clear failed"},share:{zh:"\u5206\u4EAB",en:"Share"},clear_all:{zh:"\u6E05\u7A7A",en:"Clear All"},help:{zh:"\u6C42\u52A9",en:"Help"},restore_default:{zh:"\u6062\u590D\u9ED8\u8BA4",en:"Restore Default"},shortcuts_setting:{zh:"\u5FEB\u6377\u952E\u8BBE\u7F6E",en:"Shortcuts Setting"},toggle_translate_shortcut:{zh:"\"\u5F00\u542F\u7FFB\u8BD1\"\u5FEB\u6377\u952E",en:"\"Toggle Translate\" Shortcut"},toggle_style_shortcut:{zh:"\"\u5207\u6362\u6837\u5F0F\"\u5FEB\u6377\u952E",en:"\"Toggle Style\" Shortcut"},toggle_popup_shortcut:{zh:"\"\u6253\u5F00\u5F39\u7A97\"\u5FEB\u6377\u952E",en:"\"Open Popup\" Shortcut"},open_setting_shortcut:{zh:"\"\u6253\u5F00\u8BBE\u7F6E\"\u5FEB\u6377\u952E",en:"\"Open Setting\" Shortcut"},hide_fab_button:{zh:"\u9690\u85CF\u60AC\u6D6E\u6309\u94AE",en:"Hide Fab Button"},hide_tran_button:{zh:"\u9690\u85CF\u7FFB\u8BD1\u6309\u94AE",en:"Hide Translate Button"},show:{zh:"\u663E\u793A",en:"Show"},hide:{zh:"\u9690\u85CF",en:"Hide"},save_rule:{zh:"\u4FDD\u5B58\u89C4\u5219",en:"Save Rule"},global_rule:{zh:"\u5168\u5C40\u89C4\u5219",en:"Global Rule"},input_translate:{zh:"\u8F93\u5165\u6846\u7FFB\u8BD1",en:"Input Box Translation"},use_input_box_translation:{zh:"\u542F\u7528\u8F93\u5165\u6846\u7FFB\u8BD1",en:"Input Box Translation"},input_selector:{zh:"\u8F93\u5165\u6846\u9009\u62E9\u5668",en:"Input Selector"},input_selector_helper:{zh:"\u7528\u4E8E\u8F93\u5165\u6846\u7FFB\u8BD1\u3002",en:"Used for input box translation."},trigger_trans_shortcut:{zh:"\u89E6\u53D1\u7FFB\u8BD1\u5FEB\u6377\u952E",en:"Trigger Translation Shortcut Keys"},trigger_trans_shortcut_help:{zh:"\u9ED8\u8BA4\u4E3A\u5355\u51FB\u201CAltLeft+KeyI\u201D",en:"Default is \"AltLeft+KeyI\""},shortcut_press_count:{zh:"\u5FEB\u6377\u952E\u8FDE\u51FB\u6B21\u6570",en:"Shortcut Press Number"},combo_timeout:{zh:"\u8FDE\u51FB\u8D85\u65F6\u65F6\u95F4 (10-1000ms)",en:"Combo Timeout (10-1000ms)"},input_trans_start_sign:{zh:"\u7FFB\u8BD1\u8D77\u59CB\u6807\u8BC6",en:"Translation Start Sign"},input_trans_start_sign_help:{zh:"\u6807\u8BC6\u540E\u9762\u53EF\u4EE5\u52A0\u76EE\u6807\u8BED\u8A00\u4EE3\u7801\uFF0C\u5982\uFF1A \u201C/en \u4F60\u597D\u201D\u3001\u201C/zh hello\u201D",en:"The target language code can be added after the sign, such as: \"/en \u4F60\u597D\", \"/zh hello\""},detect_lang_remote:{zh:"\u8FDC\u7A0B\u8BED\u8A00\u68C0\u6D4B",en:"Remote language detection"},detect_lang_remote_help:{zh:"\u542F\u7528\u540E\u68C0\u6D4B\u51C6\u786E\u5EA6\u589E\u52A0\uFF0C\u4F46\u4F1A\u964D\u4F4E\u7FFB\u8BD1\u901F\u5EA6\uFF0C\u8BF7\u914C\u60C5\u5F00\u542F",en:"After enabling, the detection accuracy will increase, but it will reduce the translation speed. Please enable it as appropriate."},disable:{zh:"\u7981\u7528",en:"Disable"},enable:{zh:"\u542F\u7528",en:"Enable"},selection_translate:{zh:"\u5212\u8BCD\u7FFB\u8BD1",en:"Selection Translate"},toggle_selection_translate:{zh:"\u542F\u7528\u5212\u8BCD\u7FFB\u8BD1",en:"Use Selection Translate"},trigger_tranbox_shortcut:{zh:"\u663E\u793A\u7FFB\u8BD1\u6846/\u7FFB\u8BD1\u9009\u4E2D\u6587\u5B57\u5FEB\u6377\u952E",en:"Open Translate Popup/Translate Selected Shortcut"},tranbtn_offset_x:{zh:"\u7FFB\u8BD1\u6309\u94AE\u504F\u79FBX\uFF080-100\uFF09",en:"Translate Button Offset X (0-100)"},tranbtn_offset_y:{zh:"\u7FFB\u8BD1\u6309\u94AE\u504F\u79FBY\uFF080-100\uFF09",en:"Translate Button Offset Y (0-100)"},translated_text:{zh:"\u8BD1\u6587",en:"Translated Text"},original_text:{zh:"\u539F\u6587",en:"Original Text"},favorite_words:{zh:"\u6536\u85CF\u8BCD\u6C47",en:"Favorite Words"},touch_setting:{zh:"\u89E6\u5C4F\u8BBE\u7F6E",en:"Touch Setting"},touch_translate_shortcut:{zh:"\u89E6\u5C4F\u7FFB\u8BD1\u5FEB\u6377\u65B9\u5F0F",en:"Touch Translate Shortcut"},touch_tap_0:{zh:"\u7981\u7528",en:"Disable"},touch_tap_2:{zh:"\u53CC\u6307\u8F7B\u89E6",en:"Two finger tap"},touch_tap_3:{zh:"\u4E09\u6307\u8F7B\u89E6",en:"Three finger tap"},touch_tap_4:{zh:"\u56DB\u6307\u8F7B\u89E6",en:"Four finger tap"},translate_blacklist:{zh:"\u7981\u7528\u7FFB\u8BD1\u540D\u5355",en:"Translate Blacklist"},disable_langs:{zh:"\u4E0D\u7FFB\u8BD1\u7684\u8BED\u8A00",en:"Disable Languages"},disable_langs_helper:{zh:"\u6B64\u529F\u80FD\u4F9D\u8D56\u51C6\u786E\u7684\u8BED\u8A00\u68C0\u6D4B\uFF0C\u5EFA\u8BAE\u542F\u7528\u8FDC\u7A0B\u8BED\u8A00\u68C0\u6D4B\u3002",en:"This feature relies on accurate language detection. It is recommended to enable remote language detection."},add_context_menus:{zh:"\u6DFB\u52A0\u53F3\u952E\u83DC\u5355",en:"Add Context Menus"}}; +var UI_LANGS=(/* unused pure expression or super */ null && ([["en","English"],["zh","中文"]]));var customApiLangs="[\"en\", \"English - English\"],\n[\"zh-CN\", \"Simplified Chinese - \u7B80\u4F53\u4E2D\u6587\"],\n[\"zh-TW\", \"Traditional Chinese - \u7E41\u9AD4\u4E2D\u6587\"],\n[\"ar\", \"Arabic - \u0627\u0644\u0639\u0631\u0628\u064A\u0629\"],\n[\"bg\", \"Bulgarian - \u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438\"],\n[\"ca\", \"Catalan - Catal\xE0\"],\n[\"hr\", \"Croatian - Hrvatski\"],\n[\"cs\", \"Czech - \u010Ce\u0161tina\"],\n[\"da\", \"Danish - Dansk\"],\n[\"nl\", \"Dutch - Nederlands\"],\n[\"fi\", \"Finnish - Suomi\"],\n[\"fr\", \"French - Fran\xE7ais\"],\n[\"de\", \"German - Deutsch\"],\n[\"el\", \"Greek - \u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC\"],\n[\"hi\", \"Hindi - \u0939\u093F\u0928\u094D\u0926\u0940\"],\n[\"hu\", \"Hungarian - Magyar\"],\n[\"id\", \"Indonesian - Indonesia\"],\n[\"it\", \"Italian - Italiano\"],\n[\"ja\", \"Japanese - \u65E5\u672C\u8A9E\"],\n[\"ko\", \"Korean - \uD55C\uAD6D\uC5B4\"],\n[\"ms\", \"Malay - Melayu\"],\n[\"mt\", \"Maltese - Malti\"],\n[\"nb\", \"Norwegian - Norsk Bokm\xE5l\"],\n[\"pl\", \"Polish - Polski\"],\n[\"pt\", \"Portuguese - Portugu\xEAs\"],\n[\"ro\", \"Romanian - Rom\xE2n\u0103\"],\n[\"ru\", \"Russian - \u0420\u0443\u0441\u0441\u043A\u0438\u0439\"],\n[\"sk\", \"Slovak - Sloven\u010Dina\"],\n[\"sl\", \"Slovenian - Sloven\u0161\u010Dina\"],\n[\"es\", \"Spanish - Espa\xF1ol\"],\n[\"sv\", \"Swedish - Svenska\"],\n[\"ta\", \"Tamil - \u0BA4\u0BAE\u0BBF\u0BB4\u0BCD\"],\n[\"te\", \"Telugu - \u0C24\u0C46\u0C32\u0C41\u0C17\u0C41\"],\n[\"th\", \"Thai - \u0E44\u0E17\u0E22\"],\n[\"tr\", \"Turkish - T\xFCrk\xE7e\"],\n[\"uk\", \"Ukrainian - \u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430\"],\n[\"vi\", \"Vietnamese - Ti\u1EBFng Vi\u1EC7t\"],\n";var customApiHelpZH="/// \u81EA\u5B9A\u4E49\u7FFB\u8BD1\u6E90\u63A5\u53E3\u8BF4\u660E\n\n// \u8BF7\u6C42\uFF08Request\uFF09\u6570\u636E\u5C06\u6309\u4E0B\u9762\u89C4\u8303\u53D1\u9001\n{\n url: {{YOUR_URL}},\n method: \"POST\",\n headers: {\n \"Content-type\": \"application/json\",\n \"Authorization\": \"Bearer {{YOUR_KEY}}\",\n },\n body: {\n text: \"\", // \u9700\u8981\u7FFB\u8BD1\u7684\u6587\u5B57\n from: \"\", // \u6E90\u8BED\u8A00\uFF0C\u53EF\u80FD\u4E3A\u7A7A\uFF0C\u8868\u793A\u9700\u8981\u63A5\u53E3\u81EA\u52A8\u8BC6\u522B\u8BED\u8A00\n to: \"\", // \u76EE\u6807\u8BED\u8A00\n }\n}\n\n// \u8FD4\u56DE\uFF08Response\uFF09\u6570\u636E\u9700\u7B26\u5408\u4E0B\u9762\u7684JSON\u89C4\u8303\n{\n text: \"\", // \u7FFB\u8BD1\u540E\u7684\u6587\u5B57\n from: \"\", // \u8BC6\u522B\u7684\u6E90\u8BED\u8A00\n to: \"\", // \u76EE\u6807\u8BED\u8A00\uFF08\u53EF\u9009\uFF09\n}\n\n// \u652F\u6301\u7684\u8BED\u8A00\u4EE3\u7801\u5982\u4E0B\n".concat(customApiLangs,"\n");var customApiHelpEN="/// Custom translation source interface description\n\n// Request data will be sent according to the following specifications\n{\n url: {{YOUR_URL}},\n method: \"POST\",\n headers: {\n \"Content-type\": \"application/json\",\n \"Authorization\": \"Bearer {{YOUR_KEY}}\",\n },\n body: {\n text: \"\", // text to be translated\n from: \"\", // Source language, may be empty\n to: \"\", // Target language\n }\n}\n\n// The returned data must conform to the following JSON specification\n{\n text: \"\", // translated text\n from: \"\", // Recognized source language\n to: \"\", // Target language (optional)\n}\n\n// The supported language codes are as follows\n".concat(customApiLangs,"\n");var I18N={app_name:{zh:"\u7B80\u7EA6\u7FFB\u8BD1",en:"KISS Translator"},translate:{zh:"\u7FFB\u8BD1",en:"Translate"},custom_api_help:{zh:customApiHelpZH,en:customApiHelpEN},translate_alt:{zh:"\u7FFB\u8BD1 (Alt+Q)",en:"Translate (Alt+Q)"},basic_setting:{zh:"\u57FA\u672C\u8BBE\u7F6E",en:"Basic Setting"},rules_setting:{zh:"\u89C4\u5219\u8BBE\u7F6E",en:"Rules Setting"},apis_setting:{zh:"\u63A5\u53E3\u8BBE\u7F6E",en:"Apis Setting"},sync_setting:{zh:"\u540C\u6B65\u8BBE\u7F6E",en:"Sync Setting"},patch_setting:{zh:"\u8865\u4E01\u8BBE\u7F6E",en:"Patch Setting"},patch_setting_help:{zh:"\u9488\u5BF9\u4E00\u4E9B\u7279\u6B8A\u7F51\u7AD9\u7684\u4FEE\u6B63\u811A\u672C\uFF0C\u4EE5\u4FBF\u7FFB\u8BD1\u8F6F\u4EF6\u5F97\u5230\u66F4\u597D\u7684\u5C55\u793A\u6548\u679C\u3002",en:"Corrected scripts for some special websites so that the translation software can get better display results."},inject_webfix:{zh:"\u6CE8\u5165\u4FEE\u590D\u8865\u4E01",en:"Inject Webfix"},about:{zh:"\u5173\u4E8E",en:"About"},about_md:{zh:"README.md",en:"README.en.md"},about_md_local:{zh:"\u8BF7 [\u70B9\u51FB\u8FD9\u91CC](".concat("https://github.com/fishjar/kiss-translator",") \u67E5\u770B\u8BE6\u60C5\u3002"),en:"Please [click here](".concat("https://github.com/fishjar/kiss-translator",") for details.")},ui_lang:{zh:"\u754C\u9762\u8BED\u8A00",en:"Interface Language"},fetch_limit:{zh:"\u6700\u5927\u8BF7\u6C42\u6570\u91CF (1-100)",en:"Maximum Number Of Request (1-100)"},fetch_interval:{zh:"\u8BF7\u6C42\u95F4\u9694\u65F6\u95F4 (0-5000ms)",en:"Request Interval (0-5000ms)"},min_translate_length:{zh:"\u6700\u5C0F\u7FFB\u8BD1\u957F\u5EA6 (1-100)",en:"Min Translate Length (1-100)"},max_translate_length:{zh:"\u6700\u5927\u7FFB\u8BD1\u957F\u5EA6 (100-10000)",en:"Max Translate Length (100-10000)"},num_of_newline_characters:{zh:"\u6362\u884C\u5B57\u7B26\u6570 (1-1000)",en:"Number of Newline Characters (1-1000)"},translate_service:{zh:"\u7FFB\u8BD1\u670D\u52A1",en:"Translate Service"},mouseover_translation:{zh:"\u9F20\u6807\u60AC\u505C\u7FFB\u8BD1",en:"Mouseover translation"},mk_disable:{zh:"\u7981\u7528",en:"Disable"},mk_mouseover:{zh:"\u9F20\u6807\u60AC\u505C",en:"Mouseover"},mk_ctrlKey:{zh:"Control + \u9F20\u6807\u60AC\u505C",en:"Control + Mouseover"},mk_shiftKey:{zh:"Shift + \u9F20\u6807\u60AC\u505C",en:"Shift + Mouseover"},mk_altKey:{zh:"Alt + \u9F20\u6807\u60AC\u505C",en:"Alt + Mouseover"},from_lang:{zh:"\u539F\u6587\u8BED\u8A00",en:"Source Language"},to_lang:{zh:"\u76EE\u6807\u8BED\u8A00",en:"Target Language"},to_lang2:{zh:"\u7B2C\u4E8C\u76EE\u6807\u8BED\u8A00",en:"Target Language 2"},to_lang2_helper:{zh:"\u8BBE\u5B9A\u540E\uFF0C\u4E0E\u76EE\u6807\u8BED\u8A00\u4EA7\u751F\u4E92\u8BD1\u6548\u679C\uFF0C\u4F46\u4F9D\u8D56\u8FDC\u7A0B\u8BED\u8A00\u8BC6\u522B\u3002",en:"After setting, it will produce mutual translation effect with the target language, but it relies on remote language recognition."},text_style:{zh:"\u6587\u5B57\u6837\u5F0F",en:"Text Style"},text_style_alt:{zh:"\u6587\u5B57\u6837\u5F0F (Alt+C)",en:"Text Style (Alt+C)"},bg_color:{zh:"\u6837\u5F0F\u989C\u8272",en:"Style Color"},remain_unchanged:{zh:"\u4FDD\u7559\u4E0D\u53D8",en:"Remain Unchanged"},google_api:{zh:"\u8C37\u6B4C\u7FFB\u8BD1\u63A5\u53E3",en:"Google Translate API"},default_selector:{zh:"\u9ED8\u8BA4\u9009\u62E9\u5668",en:"Default selector"},selector_rules:{zh:"\u9009\u62E9\u5668\u89C4\u5219",en:"Selector Rules"},save:{zh:"\u4FDD\u5B58",en:"Save"},edit:{zh:"\u7F16\u8F91",en:"Edit"},cancel:{zh:"\u53D6\u6D88",en:"Cancel"},delete:{zh:"\u5220\u9664",en:"Delete"},reset:{zh:"\u91CD\u7F6E",en:"Reset"},add:{zh:"\u6DFB\u52A0",en:"Add"},inject_rules:{zh:"\u6CE8\u5165\u8BA2\u9605\u89C4\u5219",en:"Inject Subscribe Rules"},personal_rules:{zh:"\u4E2A\u4EBA\u89C4\u5219",en:"Rules"},subscribe_rules:{zh:"\u8BA2\u9605\u89C4\u5219",en:"Subscribe"},overwrite_subscribe_rules:{zh:"\u8986\u5199\u8BA2\u9605\u89C4\u5219",en:"Overwrite"},subscribe_url:{zh:"\u8BA2\u9605\u5730\u5740",en:"Subscribe URL"},rules_warn_1:{zh:"1\u3001\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u4E00\u76F4\u751F\u6548\uFF0C\u9009\u62E9\u201C\u6CE8\u5165\u8BA2\u9605\u89C4\u5219\u201D\u540E\uFF0C\u201C\u8BA2\u9605\u89C4\u5219\u201D\u624D\u4F1A\u751F\u6548\u3002",en:"1. The \"Personal Rules\" are always in effect. After selecting \"Inject Subscription Rules\", the \"Subscription Rules\" will take effect."},rules_warn_2:{zh:"2\u3001\u201C\u8BA2\u9605\u89C4\u5219\u201D\u7684\u6CE8\u5165\u4F4D\u7F6E\u662F\u5012\u6570\u7B2C\u4E8C\u7684\u4F4D\u7F6E\uFF0C\u56E0\u6B64\u9664\u5168\u5C40\u89C4\u5219(*)\u5916\uFF0C\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u4F18\u5148\u7EA7\u6BD4\u201C\u8BA2\u9605\u89C4\u5219\u201D\u9AD8\uFF0C\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u586B\u5199\u540C\u6837\u7684\u7F51\u5740\u4F1A\u8986\u76D6\u201D\u8BA2\u9605\u89C4\u5219\u201C\u7684\u6761\u76EE\u3002",en:"2. The injection position of \"Subscription Rules\" is the penultimate position. Therefore, except for the global rules (*), the priority of \"Personal Rules\" is higher than that of \"Subscription Rules\". Filling in the same url in \"Personal Rules\" will overwrite \"Subscription Rules\" entry."},sync_warn:{zh:"\u5982\u679C\u670D\u52A1\u5668\u5B58\u5728\u5176\u4ED6\u5BA2\u6237\u7AEF\u540C\u6B65\u7684\u6570\u636E\uFF0C\u7B2C\u4E00\u6B21\u540C\u6B65\u5C06\u76F4\u63A5\u8986\u76D6\u672C\u5730\u914D\u7F6E\uFF0C\u540E\u9762\u5219\u6839\u636E\u4FEE\u6539\u65F6\u95F4\uFF0C\u65B0\u7684\u8986\u76D6\u65E7\u7684\u3002",en:"If the server has data synchronized by other clients, the first synchronization will directly overwrite the local configuration, and later, according to the modification time, the new one will overwrite the old one."},about_sync_api:{zh:"\u67E5\u770B\u5173\u4E8E\u6570\u636E\u540C\u6B65\u63A5\u53E3\u90E8\u7F72",en:"View About Data Synchronization Interface Deployment"},about_api_proxy:{zh:"\u67E5\u770B\u81EA\u5EFA\u4E00\u4E2A\u7FFB\u8BD1\u63A5\u53E3\u4EE3\u7406",en:"Check out the self-built translation interface proxy"},style_none:{zh:"\u65E0",en:"None"},under_line:{zh:"\u4E0B\u5212\u76F4\u7EBF",en:"Underline"},dot_line:{zh:"\u4E0B\u5212\u70B9\u72B6\u7EBF",en:"Dotted Underline"},dash_line:{zh:"\u4E0B\u5212\u865A\u7EBF",en:"Dashed Underline"},wavy_line:{zh:"\u4E0B\u5212\u6CE2\u6D6A\u7EBF",en:"Wavy Underline"},fuzzy:{zh:"\u6A21\u7CCA",en:"Fuzzy"},highlight:{zh:"\u9AD8\u4EAE",en:"Highlight"},blockquote:{zh:"\u5F15\u7528",en:"Blockquote"},diy_style:{zh:"\u81EA\u5B9A\u4E49\u6837\u5F0F",en:"Custom Style"},diy_style_helper:{zh:"\u9075\u5FAA\u201CCSS\u201D\u7684\u8BED\u6CD5",en:"Follow the syntax of \"CSS\""},setting:{zh:"\u8BBE\u7F6E",en:"Setting"},pattern:{zh:"\u5339\u914D\u7F51\u5740",en:"URL pattern"},pattern_helper:{zh:"1\u3001\u652F\u6301\u661F\u53F7(*)\u901A\u914D\u7B26\u30022\u3001\u591A\u4E2AURL\u7528\u82F1\u6587\u9017\u53F7\u201C,\u201D\u5206\u9694\u3002",en:"1. The asterisk (*) wildcard is supported. 2. Multiple URLs separated by English commas \",\"."},selector_helper:{zh:"1\u3001\u9075\u5FAACSS\u9009\u62E9\u5668\u8BED\u6CD5\u30022\u3001\u7559\u7A7A\u8868\u793A\u91C7\u7528\u5168\u5C40\u8BBE\u7F6E\u30023\u3001\u591A\u4E2ACSS\u9009\u62E9\u5668\u4E4B\u95F4\u7528\u201C;\u201D\u9694\u5F00\u30024\u3001\u201Cshadow root\u201D\u9009\u62E9\u5668\u548C\u5185\u90E8\u9009\u62E9\u5668\u7528\u201C>>>\u201D\u9694\u5F00\u3002",en:"1. Follow CSS selector syntax. 2. Leave blank to adopt the global setting. 3. Separate multiple CSS selectors with \";\". 4. The \"shadow root\" selector and the internal selector are separated by \">>>\"."},translate_switch:{zh:"\u5F00\u542F\u7FFB\u8BD1",en:"Translate Switch"},default_enabled:{zh:"\u9ED8\u8BA4\u5F00\u542F",en:"Enabled"},default_disabled:{zh:"\u9ED8\u8BA4\u5173\u95ED",en:"Disabled"},selector:{zh:"\u9009\u62E9\u5668",en:"Selector"},keep_selector:{zh:"\u4FDD\u7559\u5143\u7D20\u9009\u62E9\u5668",en:"Keep unchanged selector"},keep_selector_helper:{zh:"1\u3001\u9075\u5FAACSS\u9009\u62E9\u5668\u8BED\u6CD5\u30022\u3001\u7559\u7A7A\u8868\u793A\u91C7\u7528\u5168\u5C40\u8BBE\u7F6E\u3002",en:"1. Follow CSS selector syntax. 2. Leave blank to adopt the global setting."},root_selector:{zh:"\u6839\u9009\u62E9\u5668",en:"Root Selector"},fixer_function:{zh:"\u4FEE\u590D\u51FD\u6570",en:"Fixer Function"},import:{zh:"\u5BFC\u5165",en:"Import"},export:{zh:"\u5BFC\u51FA",en:"Export"},error_cant_be_blank:{zh:"\u4E0D\u80FD\u4E3A\u7A7A",en:"Can not be blank"},error_duplicate_values:{zh:"\u5B58\u5728\u91CD\u590D\u7684\u503C",en:"There are duplicate values"},error_wrong_file_type:{zh:"\u9519\u8BEF\u7684\u6587\u4EF6\u7C7B\u578B",en:"Wrong file type"},error_fetch_url:{zh:"\u8BF7\u68C0\u67E5url\u5730\u5740\u662F\u5426\u6B63\u786E\u6216\u7A0D\u540E\u518D\u8BD5\u3002",en:"Please check if the url address is correct or try again later."},deepl_api:{zh:"DeepL \u63A5\u53E3",en:"DeepL API"},deepl_key:{zh:"DeepL \u5BC6\u94A5",en:"DeepL Key"},openai_api:{zh:"OpenAI \u63A5\u53E3",en:"OpenAI API"},openai_key:{zh:"OpenAI \u5BC6\u94A5",en:"OpenAI Key"},openai_model:{zh:"OpenAI \u6A21\u578B",en:"OpenAI Model"},openai_prompt:{zh:"OpenAI \u63D0\u793A\u8BCD",en:"OpenAI Prompt"},if_clear_cache:{zh:"\u662F\u5426\u6E05\u9664\u7F13\u5B58",en:"Whether clear cache"},clear_cache_never:{zh:"\u4E0D\u6E05\u9664\u7F13\u5B58",en:"Never clear cache"},clear_cache_restart:{zh:"\u91CD\u542F\u6D4F\u89C8\u5668\u65F6\u6E05\u9664\u7F13\u5B58",en:"Clear cache when restarting browser"},data_sync_type:{zh:"\u6570\u636E\u540C\u6B65\u65B9\u5F0F",en:"Data Sync Type"},data_sync_url:{zh:"\u6570\u636E\u540C\u6B65\u63A5\u53E3",en:"Data Sync API"},data_sync_user:{zh:"\u6570\u636E\u540C\u6B65\u8D26\u6237",en:"Data Sync User"},data_sync_key:{zh:"\u6570\u636E\u540C\u6B65\u5BC6\u94A5",en:"Data Sync Key"},sync_now:{zh:"\u7ACB\u5373\u540C\u6B65",en:"Sync Now"},sync_success:{zh:"\u540C\u6B65\u6210\u529F\uFF01",en:"Sync Success"},sync_failed:{zh:"\u540C\u6B65\u5931\u8D25\uFF01",en:"Sync Error"},error_got_some_wrong:{zh:"\u62B1\u6B49\uFF0C\u51FA\u9519\u4E86\uFF01",en:"Sorry, something went wrong!"},error_sync_setting:{zh:"\u60A8\u7684\u540C\u6B65\u7C7B\u578B\u5FC5\u987B\u4E3A\u201CKISS-Worker\u201D\uFF0C\u4E14\u9700\u586B\u5199\u5B8C\u6574",en:"Your sync type must be \"KISS-Worker\" and must be filled in completely"},click_test:{zh:"\u70B9\u51FB\u6D4B\u8BD5",en:"Click Test"},test_success:{zh:"\u6D4B\u8BD5\u6210\u529F",en:"Test success"},test_failed:{zh:"\u6D4B\u8BD5\u5931\u8D25",en:"Test failed"},clear_all_cache_now:{zh:"\u7ACB\u5373\u6E05\u9664\u5168\u90E8\u7F13\u5B58",en:"Clear all cache now"},clear_cache:{zh:"\u6E05\u9664\u7F13\u5B58",en:"Clear Cache"},clear_success:{zh:"\u6E05\u9664\u6210\u529F",en:"Clear success"},clear_failed:{zh:"\u6E05\u9664\u5931\u8D25",en:"Clear failed"},share:{zh:"\u5206\u4EAB",en:"Share"},clear_all:{zh:"\u6E05\u7A7A",en:"Clear All"},help:{zh:"\u6C42\u52A9",en:"Help"},restore_default:{zh:"\u6062\u590D\u9ED8\u8BA4",en:"Restore Default"},shortcuts_setting:{zh:"\u5FEB\u6377\u952E\u8BBE\u7F6E",en:"Shortcuts Setting"},toggle_translate_shortcut:{zh:"\"\u5F00\u542F\u7FFB\u8BD1\"\u5FEB\u6377\u952E",en:"\"Toggle Translate\" Shortcut"},toggle_style_shortcut:{zh:"\"\u5207\u6362\u6837\u5F0F\"\u5FEB\u6377\u952E",en:"\"Toggle Style\" Shortcut"},toggle_popup_shortcut:{zh:"\"\u6253\u5F00\u5F39\u7A97\"\u5FEB\u6377\u952E",en:"\"Open Popup\" Shortcut"},open_setting_shortcut:{zh:"\"\u6253\u5F00\u8BBE\u7F6E\"\u5FEB\u6377\u952E",en:"\"Open Setting\" Shortcut"},hide_fab_button:{zh:"\u9690\u85CF\u60AC\u6D6E\u6309\u94AE",en:"Hide Fab Button"},hide_tran_button:{zh:"\u9690\u85CF\u7FFB\u8BD1\u6309\u94AE",en:"Hide Translate Button"},show:{zh:"\u663E\u793A",en:"Show"},hide:{zh:"\u9690\u85CF",en:"Hide"},save_rule:{zh:"\u4FDD\u5B58\u89C4\u5219",en:"Save Rule"},global_rule:{zh:"\u5168\u5C40\u89C4\u5219",en:"Global Rule"},input_translate:{zh:"\u8F93\u5165\u6846\u7FFB\u8BD1",en:"Input Box Translation"},use_input_box_translation:{zh:"\u542F\u7528\u8F93\u5165\u6846\u7FFB\u8BD1",en:"Input Box Translation"},input_selector:{zh:"\u8F93\u5165\u6846\u9009\u62E9\u5668",en:"Input Selector"},input_selector_helper:{zh:"\u7528\u4E8E\u8F93\u5165\u6846\u7FFB\u8BD1\u3002",en:"Used for input box translation."},trigger_trans_shortcut:{zh:"\u89E6\u53D1\u7FFB\u8BD1\u5FEB\u6377\u952E",en:"Trigger Translation Shortcut Keys"},trigger_trans_shortcut_help:{zh:"\u9ED8\u8BA4\u4E3A\u5355\u51FB\u201CAltLeft+KeyI\u201D",en:"Default is \"AltLeft+KeyI\""},shortcut_press_count:{zh:"\u5FEB\u6377\u952E\u8FDE\u51FB\u6B21\u6570",en:"Shortcut Press Number"},combo_timeout:{zh:"\u8FDE\u51FB\u8D85\u65F6\u65F6\u95F4 (10-1000ms)",en:"Combo Timeout (10-1000ms)"},input_trans_start_sign:{zh:"\u7FFB\u8BD1\u8D77\u59CB\u6807\u8BC6",en:"Translation Start Sign"},input_trans_start_sign_help:{zh:"\u6807\u8BC6\u540E\u9762\u53EF\u4EE5\u52A0\u76EE\u6807\u8BED\u8A00\u4EE3\u7801\uFF0C\u5982\uFF1A \u201C/en \u4F60\u597D\u201D\u3001\u201C/zh hello\u201D",en:"The target language code can be added after the sign, such as: \"/en \u4F60\u597D\", \"/zh hello\""},detect_lang_remote:{zh:"\u8FDC\u7A0B\u8BED\u8A00\u68C0\u6D4B",en:"Remote language detection"},detect_lang_remote_help:{zh:"\u542F\u7528\u540E\u68C0\u6D4B\u51C6\u786E\u5EA6\u589E\u52A0\uFF0C\u4F46\u4F1A\u964D\u4F4E\u7FFB\u8BD1\u901F\u5EA6\uFF0C\u8BF7\u914C\u60C5\u5F00\u542F",en:"After enabling, the detection accuracy will increase, but it will reduce the translation speed. Please enable it as appropriate."},disable:{zh:"\u7981\u7528",en:"Disable"},enable:{zh:"\u542F\u7528",en:"Enable"},selection_translate:{zh:"\u5212\u8BCD\u7FFB\u8BD1",en:"Selection Translate"},toggle_selection_translate:{zh:"\u542F\u7528\u5212\u8BCD\u7FFB\u8BD1",en:"Use Selection Translate"},trigger_tranbox_shortcut:{zh:"\u663E\u793A\u7FFB\u8BD1\u6846/\u7FFB\u8BD1\u9009\u4E2D\u6587\u5B57\u5FEB\u6377\u952E",en:"Open Translate Popup/Translate Selected Shortcut"},tranbtn_offset_x:{zh:"\u7FFB\u8BD1\u6309\u94AE\u504F\u79FBX\uFF080-100\uFF09",en:"Translate Button Offset X (0-100)"},tranbtn_offset_y:{zh:"\u7FFB\u8BD1\u6309\u94AE\u504F\u79FBY\uFF080-100\uFF09",en:"Translate Button Offset Y (0-100)"},translated_text:{zh:"\u8BD1\u6587",en:"Translated Text"},original_text:{zh:"\u539F\u6587",en:"Original Text"},favorite_words:{zh:"\u6536\u85CF\u8BCD\u6C47",en:"Favorite Words"},touch_setting:{zh:"\u89E6\u5C4F\u8BBE\u7F6E",en:"Touch Setting"},touch_translate_shortcut:{zh:"\u89E6\u5C4F\u7FFB\u8BD1\u5FEB\u6377\u65B9\u5F0F",en:"Touch Translate Shortcut"},touch_tap_0:{zh:"\u7981\u7528",en:"Disable"},touch_tap_2:{zh:"\u53CC\u6307\u8F7B\u89E6",en:"Two finger tap"},touch_tap_3:{zh:"\u4E09\u6307\u8F7B\u89E6",en:"Three finger tap"},touch_tap_4:{zh:"\u56DB\u6307\u8F7B\u89E6",en:"Four finger tap"},translate_blacklist:{zh:"\u7981\u7528\u7FFB\u8BD1\u540D\u5355",en:"Translate Blacklist"},disable_langs:{zh:"\u4E0D\u7FFB\u8BD1\u7684\u8BED\u8A00",en:"Disable Languages"},disable_langs_helper:{zh:"\u6B64\u529F\u80FD\u4F9D\u8D56\u51C6\u786E\u7684\u8BED\u8A00\u68C0\u6D4B\uFF0C\u5EFA\u8BAE\u542F\u7528\u8FDC\u7A0B\u8BED\u8A00\u68C0\u6D4B\u3002",en:"This feature relies on accurate language detection. It is recommended to enable remote language detection."},add_context_menus:{zh:"\u6DFB\u52A0\u53F3\u952E\u83DC\u5355",en:"Add Context Menus"},mulkeys_help:{zh:"\u652F\u6301\u82F1\u6587\u9017\u53F7\u9694\u5F00\u591A\u4E2AKEY\u8F6E\u5BFB\u8C03\u7528\u3002",en:"Supports multiple KEY round calling calls separated by English commas."}}; ;// CONCATENATED MODULE: ./src/config/index.js var _OPT_LANGS_SPECIAL,_DEFAULT_TRANS_APIS,_DEFAULT_SHORTCUTS;var STOKEY_MSAUTH="".concat(APP_NAME,"_msauth");var STOKEY_BDAUTH="".concat(APP_NAME,"_bdauth");var STOKEY_SETTING="".concat(APP_NAME,"_setting");var STOKEY_RULES="".concat(APP_NAME,"_rules");var STOKEY_WFRULES="".concat(APP_NAME,"_webfix_rules");var STOKEY_WORDS="".concat(APP_NAME,"_words");var STOKEY_SYNC="".concat(APP_NAME,"_sync");var STOKEY_FAB="".concat(APP_NAME,"_fab");var STOKEY_RULESCACHE_PREFIX="".concat(APP_NAME,"_rulescache_");var STOKEY_WEBFIXCACHE_PREFIX="".concat(APP_NAME,"_webfixcache_");var CMD_TOGGLE_TRANSLATE="toggleTranslate";var CMD_TOGGLE_STYLE="toggleStyle";var CMD_OPEN_OPTIONS="openOptions";var CMD_OPEN_TRANBOX="openTranbox";var CLIENT_WEB="web";var CLIENT_CHROME="chrome";var CLIENT_EDGE="edge";var CLIENT_FIREFOX="firefox";var CLIENT_USERSCRIPT="userscript";var CLIENT_EXTS=[CLIENT_CHROME,CLIENT_EDGE,CLIENT_FIREFOX];var KV_RULES_KEY="kiss-rules.json";var KV_WFRULES_KEY="kiss-webfix.json";var KV_WORDS_KEY="kiss-words.json";var KV_RULES_SHARE_KEY="kiss-rules-share.json";var KV_SETTING_KEY="kiss-setting.json";var KV_SALT_SYNC="KISS-Translator-SYNC";var KV_SALT_SHARE="KISS-Translator-SHARE";var CACHE_NAME="".concat(APP_NAME,"_cache");var MSG_FETCH="fetch";var MSG_FETCH_LIMIT="fetch_limit";var MSG_FETCH_CLEAR="fetch_clear";var MSG_OPEN_OPTIONS="open_options";var MSG_SAVE_RULE="save_rule";var MSG_TRANS_TOGGLE="trans_toggle";var MSG_TRANS_TOGGLE_STYLE="trans_toggle_style";var MSG_OPEN_TRANBOX="open_tranbox";var MSG_TRANS_GETRULE="trans_getrule";var MSG_TRANS_PUTRULE="trans_putrule";var MSG_TRANS_CURRULE="trans_currule";var MSG_CONTEXT_MENUS="context_menus";var THEME_LIGHT="light";var THEME_DARK="dark";var URL_KISS_WORKER="https://github.com/fishjar/kiss-worker";var URL_KISS_PROXY="https://github.com/fishjar/kiss-proxy";var URL_KISS_RULES="https://github.com/fishjar/kiss-rules";var URL_KISS_RULES_NEW_ISSUE="https://github.com/fishjar/kiss-rules/issues/new";var URL_RAW_PREFIX="https://raw.githubusercontent.com/fishjar/kiss-translator/master";var URL_CACHE_TRAN="https://".concat(APP_LCNAME,"/translate");var URL_MICROSOFT_TRAN="https://api-edge.cognitive.microsofttranslator.com/translate";var URL_MICROSOFT_AUTH="https://edge.microsoft.com/translate/auth";var URL_BAIDU_LANGDETECT="https://fanyi.baidu.com/langdetect";var URL_BAIDU_WEB="https://fanyi.baidu.com/";var URL_BAIDU_TRAN="https://fanyi.baidu.com/v2transapi";var URL_DEEPLFREE_TRAN="https://www2.deepl.com/jsonrpc";var URL_TENCENT_TRANSMART="https://transmart.qq.com/api/imt";var OPT_TRANS_GOOGLE="Google";var OPT_TRANS_MICROSOFT="Microsoft";var OPT_TRANS_DEEPL="DeepL";var OPT_TRANS_DEEPLX="DeepLX";var OPT_TRANS_DEEPLFREE="DeepLFree";var OPT_TRANS_BAIDU="Baidu";var OPT_TRANS_TENCENT="Tencent";var OPT_TRANS_OPENAI="OpenAI";var OPT_TRANS_GEMINI="Gemini";var OPT_TRANS_CLOUDFLAREAI="CloudflareAI";var OPT_TRANS_CUSTOMIZE="Custom";var OPT_TRANS_ALL=[OPT_TRANS_GOOGLE,OPT_TRANS_MICROSOFT,OPT_TRANS_DEEPL,OPT_TRANS_DEEPLFREE,OPT_TRANS_DEEPLX,OPT_TRANS_BAIDU,OPT_TRANS_TENCENT,OPT_TRANS_OPENAI,OPT_TRANS_GEMINI,OPT_TRANS_CLOUDFLAREAI,OPT_TRANS_CUSTOMIZE];var OPT_LANGS_TO=[["en","English - English"],["zh-CN","Simplified Chinese - 简体中文"],["zh-TW","Traditional Chinese - 繁體中文"],["ar","Arabic - العربية"],["bg","Bulgarian - Български"],["ca","Catalan - Català"],["hr","Croatian - Hrvatski"],["cs","Czech - Čeština"],["da","Danish - Dansk"],["nl","Dutch - Nederlands"],["fi","Finnish - Suomi"],["fr","French - Français"],["de","German - Deutsch"],["el","Greek - Ελληνικά"],["hi","Hindi - हिन्दी"],["hu","Hungarian - Magyar"],["id","Indonesian - Indonesia"],["it","Italian - Italiano"],["ja","Japanese - 日本語"],["ko","Korean - 한국어"],["ms","Malay - Melayu"],["mt","Maltese - Malti"],["nb","Norwegian - Norsk Bokmål"],["pl","Polish - Polski"],["pt","Portuguese - Português"],["ro","Romanian - Română"],["ru","Russian - Русский"],["sk","Slovak - Slovenčina"],["sl","Slovenian - Slovenščina"],["es","Spanish - Español"],["sv","Swedish - Svenska"],["ta","Tamil - தமிழ்"],["te","Telugu - తెలుగు"],["th","Thai - ไทย"],["tr","Turkish - Türkçe"],["uk","Ukrainian - Українська"],["vi","Vietnamese - Tiếng Việt"]];var OPT_LANGS_FROM=[["auto","Auto-detect"]].concat(OPT_LANGS_TO);var OPT_LANGS_SPECIAL=(_OPT_LANGS_SPECIAL={},_defineProperty(_OPT_LANGS_SPECIAL,OPT_TRANS_GOOGLE,new Map(OPT_LANGS_FROM.map(function(_ref){var _ref2=_slicedToArray(_ref,1),key=_ref2[0];return[key,key];}))),_defineProperty(_OPT_LANGS_SPECIAL,OPT_TRANS_MICROSOFT,new Map([].concat(toConsumableArray_toConsumableArray(OPT_LANGS_FROM.map(function(_ref3){var _ref4=_slicedToArray(_ref3,1),key=_ref4[0];return[key,key];})),[["auto",""],["zh-CN","zh-Hans"],["zh-TW","zh-Hant"]]))),_defineProperty(_OPT_LANGS_SPECIAL,OPT_TRANS_DEEPL,new Map([].concat(toConsumableArray_toConsumableArray(OPT_LANGS_FROM.map(function(_ref5){var _ref6=_slicedToArray(_ref5,1),key=_ref6[0];return[key,key.toUpperCase()];})),[["auto",""],["zh-CN","ZH"],["zh-TW","ZH"]]))),_defineProperty(_OPT_LANGS_SPECIAL,OPT_TRANS_DEEPLFREE,new Map([].concat(toConsumableArray_toConsumableArray(OPT_LANGS_FROM.map(function(_ref7){var _ref8=_slicedToArray(_ref7,1),key=_ref8[0];return[key,key.toUpperCase()];})),[["auto","auto"],["zh-CN","ZH"],["zh-TW","ZH"]]))),_defineProperty(_OPT_LANGS_SPECIAL,OPT_TRANS_DEEPLX,new Map([].concat(toConsumableArray_toConsumableArray(OPT_LANGS_FROM.map(function(_ref9){var _ref10=_slicedToArray(_ref9,1),key=_ref10[0];return[key,key.toUpperCase()];})),[["auto",""],["zh-CN","ZH"],["zh-TW","ZH"]]))),_defineProperty(_OPT_LANGS_SPECIAL,OPT_TRANS_BAIDU,new Map([].concat(toConsumableArray_toConsumableArray(OPT_LANGS_FROM.map(function(_ref11){var _ref12=_slicedToArray(_ref11,1),key=_ref12[0];return[key,key];})),[["zh-CN","zh"],["zh-TW","cht"],["ar","ara"],["bg","bul"],["ca","cat"],["hr","hrv"],["da","dan"],["fi","fin"],["fr","fra"],["hi","mai"],["ja","jp"],["ko","kor"],["ms","may"],["mt","mlt"],["nb","nor"],["ro","rom"],["ru","ru"],["sl","slo"],["es","spa"],["sv","swe"],["ta","tam"],["te","tel"],["uk","ukr"],["vi","vie"]]))),_defineProperty(_OPT_LANGS_SPECIAL,OPT_TRANS_TENCENT,new Map([["auto","auto"],["zh-CN","zh"],["zh-TW","zh"],["en","en"],["ar","ar"],["de","de"],["ru","ru"],["fr","fr"],["fi","fil"],["ko","ko"],["ms","ms"],["pt","pt"],["ja","ja"],["th","th"],["tr","tr"],["es","es"],["it","it"],["hi","hi"],["id","id"],["vi","vi"]])),_defineProperty(_OPT_LANGS_SPECIAL,OPT_TRANS_OPENAI,new Map(OPT_LANGS_FROM.map(function(_ref13){var _ref14=_slicedToArray(_ref13,2),key=_ref14[0],val=_ref14[1];return[key,val.split(" - ")[0]];}))),_defineProperty(_OPT_LANGS_SPECIAL,OPT_TRANS_GEMINI,new Map(OPT_LANGS_FROM.map(function(_ref15){var _ref16=_slicedToArray(_ref15,2),key=_ref16[0],val=_ref16[1];return[key,val.split(" - ")[0]];}))),_defineProperty(_OPT_LANGS_SPECIAL,OPT_TRANS_CLOUDFLAREAI,new Map([["auto",""],["zh-CN","chinese"],["zh-TW","chinese"],["en","english"],["ar","arabic"],["de","german"],["ru","russian"],["fr","french"],["pt","portuguese"],["ja","japanese"],["es","spanish"],["hi","hindi"]])),_defineProperty(_OPT_LANGS_SPECIAL,OPT_TRANS_CUSTOMIZE,new Map([].concat(toConsumableArray_toConsumableArray(OPT_LANGS_FROM.map(function(_ref17){var _ref18=_slicedToArray(_ref17,1),key=_ref18[0];return[key,key];})),[["auto",""]]))),_OPT_LANGS_SPECIAL);var OPT_LANGS_LIST=OPT_LANGS_TO.map(function(_ref19){var _ref20=_slicedToArray(_ref19,1),lang=_ref20[0];return lang;});var OPT_LANGS_BAIDU=new Map(Array.from(OPT_LANGS_SPECIAL[OPT_TRANS_BAIDU].entries()).map(function(_ref21){var _ref22=_slicedToArray(_ref21,2),k=_ref22[0],v=_ref22[1];return[v,k];}));var OPT_LANGS_TENCENT=new Map(Array.from(OPT_LANGS_SPECIAL[OPT_TRANS_TENCENT].entries()).map(function(_ref23){var _ref24=_slicedToArray(_ref23,2),k=_ref24[0],v=_ref24[1];return[v,k];}));OPT_LANGS_TENCENT.set("zh","zh-CN");var OPT_STYLE_NONE="style_none";// 无 var OPT_STYLE_LINE="under_line";// 下划线 @@ -34242,7 +34242,7 @@ var PROMPT_PLACE_TO="{{to}}";// 占位符 var PROMPT_PLACE_TEXT="{{text}}";// 占位符 var DEFAULT_COLOR="#209CEE";// 默认高亮背景色/线条颜色 // 全局规则 -var GLOBLA_RULE={pattern:"*",selector:DEFAULT_SELECTOR,translator:OPT_TRANS_MICROSOFT,fromLang:"auto",toLang:"zh-CN",textStyle:OPT_STYLE_DASHLINE,transOpen:"false",bgColor:"",textDiyStyle:""};// 输入框翻译 +var GLOBLA_RULE={pattern:"*",selector:DEFAULT_SELECTOR,keepSelector:DEFAULT_KEEP_SELECTOR,translator:OPT_TRANS_MICROSOFT,fromLang:"auto",toLang:"zh-CN",textStyle:OPT_STYLE_DASHLINE,transOpen:"false",bgColor:"",textDiyStyle:""};// 输入框翻译 var OPT_INPUT_TRANS_SIGNS=["/","//","\\","\\\\",">",">>"];var DEFAULT_INPUT_SHORTCUT=["AltLeft","KeyI"];var DEFAULT_INPUT_RULE={transOpen:true,translator:OPT_TRANS_MICROSOFT,fromLang:"auto",toLang:"en",triggerShortcut:DEFAULT_INPUT_SHORTCUT,triggerCount:1,triggerTime:200,transSign:OPT_INPUT_TRANS_SIGNS[0]};// 划词翻译 var DEFAULT_TRANBOX_SHORTCUT=["AltLeft","KeyS"];var DEFAULT_TRANBOX_SETTING={transOpen:true,translator:OPT_TRANS_MICROSOFT,fromLang:"auto",toLang:"zh-CN",toLang2:"en",tranboxShortcut:DEFAULT_TRANBOX_SHORTCUT,btnOffsetX:10,btnOffsetY:10,hideTranBtn:false};// 订阅列表 var DEFAULT_SUBRULES_LIST=[{url:"https://fishjar.github.io/kiss-rules/kiss-rules.json",selected:false},{url:"https://fishjar.github.io/kiss-rules/kiss-rules-on.json",selected:true},{url:"https://fishjar.github.io/kiss-rules/kiss-rules-off.json",selected:false}];// 翻译接口 @@ -34279,7 +34279,7 @@ subRulesSyncAt:0,// 订阅规则同步时间 dataCaches:{}// 缓存同步时间 }; ;// CONCATENATED MODULE: ./src/index.js -function App(){var _I18N$about_md;var _useState=(0,react.useState)("zh"),_useState2=_slicedToArray(_useState,2),lang=_useState2[0],setLang=_useState2[1];var _useFetch=useFetch("".concat(URL_RAW_PREFIX,"/").concat(I18N===null||I18N===void 0?void 0:(_I18N$about_md=I18N["about_md"])===null||_I18N$about_md===void 0?void 0:_I18N$about_md[lang])),_useFetch2=_slicedToArray(_useFetch,3),data=_useFetch2[0],loading=_useFetch2[1],error=_useFetch2[2];return/*#__PURE__*/(0,jsx_runtime.jsxs)(Paper_Paper,{sx:{padding:2,margin:2},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Stack_Stack,{spacing:2,direction:"row",justifyContent:"flex-end",children:/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:function onClick(){setLang(function(pre){return pre==="zh"?"en":"zh";});},children:lang==="zh"?"ENGLISH":"中文"})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Link_Link,{href:"https://github.com/fishjar/kiss-translator",children:"KISS Translator v".concat("1.7.15")})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Link_Link,{href:"https://fishjar.github.io/kiss-translator/kiss-translator.user.js",children:"Install/Update Userscript for Tampermonkey/Violentmonkey"}),/*#__PURE__*/(0,jsx_runtime.jsx)(Link_Link,{href:"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js",children:"Install/Update Userscript for iOS Safari"}),/*#__PURE__*/(0,jsx_runtime.jsx)(Link_Link,{href:"https://fishjar.github.io/kiss-translator/options.html",children:"Open Options Page"})]}),loading?/*#__PURE__*/(0,jsx_runtime.jsx)("center",{children:/*#__PURE__*/(0,jsx_runtime.jsx)(CircularProgress_CircularProgress,{})}):/*#__PURE__*/(0,jsx_runtime.jsx)(ReactMarkdown,{children:error?error.message:data})]});}var src_root=client.createRoot(document.getElementById("root"));src_root.render(/*#__PURE__*/(0,jsx_runtime.jsx)(react.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(App,{})})); +function App(){var _I18N$about_md;var _useState=(0,react.useState)("zh"),_useState2=_slicedToArray(_useState,2),lang=_useState2[0],setLang=_useState2[1];var _useFetch=useFetch("".concat(URL_RAW_PREFIX,"/").concat(I18N===null||I18N===void 0?void 0:(_I18N$about_md=I18N["about_md"])===null||_I18N$about_md===void 0?void 0:_I18N$about_md[lang])),_useFetch2=_slicedToArray(_useFetch,3),data=_useFetch2[0],loading=_useFetch2[1],error=_useFetch2[2];return/*#__PURE__*/(0,jsx_runtime.jsxs)(Paper_Paper,{sx:{padding:2,margin:2},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Stack_Stack,{spacing:2,direction:"row",justifyContent:"flex-end",children:/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:function onClick(){setLang(function(pre){return pre==="zh"?"en":"zh";});},children:lang==="zh"?"ENGLISH":"中文"})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Link_Link,{href:"https://github.com/fishjar/kiss-translator",children:"KISS Translator v".concat("1.7.16")})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Link_Link,{href:"https://fishjar.github.io/kiss-translator/kiss-translator.user.js",children:"Install/Update Userscript for Tampermonkey/Violentmonkey"}),/*#__PURE__*/(0,jsx_runtime.jsx)(Link_Link,{href:"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js",children:"Install/Update Userscript for iOS Safari"}),/*#__PURE__*/(0,jsx_runtime.jsx)(Link_Link,{href:"https://fishjar.github.io/kiss-translator/options.html",children:"Open Options Page"})]}),loading?/*#__PURE__*/(0,jsx_runtime.jsx)("center",{children:/*#__PURE__*/(0,jsx_runtime.jsx)(CircularProgress_CircularProgress,{})}):/*#__PURE__*/(0,jsx_runtime.jsx)(ReactMarkdown,{children:error?error.message:data})]});}var src_root=client.createRoot(document.getElementById("root"));src_root.render(/*#__PURE__*/(0,jsx_runtime.jsx)(react.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(App,{})})); }(); /******/ })() ; \ No newline at end of file diff --git a/manifest.firefox.json b/manifest.firefox.json index 5db31d86..46acffbf 100644 --- a/manifest.firefox.json +++ b/manifest.firefox.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "__MSG_app_name__", "description": "__MSG_app_description__", - "version": "1.7.15", + "version": "1.7.16", "default_locale": "en", "author": "Gabe", "homepage_url": "https://github.com/fishjar/kiss-translator", @@ -28,6 +28,12 @@ }, "description": "__MSG_toggle_translate__" }, + "openTranbox": { + "suggested_key": { + "default": "Alt+S" + }, + "description": "__MSG_open_tranbox__" + }, "toggleStyle": { "suggested_key": { "default": "Alt+C" @@ -35,9 +41,6 @@ "description": "__MSG_toggle_style__" }, "openOptions": { - "suggested_key": { - "default": "Alt+O" - }, "description": "__MSG_open_options__" } }, diff --git a/manifest.json b/manifest.json index cac9d156..9aa72775 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 3, "name": "__MSG_app_name__", "description": "__MSG_app_description__", - "version": "1.7.15", + "version": "1.7.16", "default_locale": "en", "author": "Gabe", "homepage_url": "https://github.com/fishjar/kiss-translator", @@ -29,6 +29,12 @@ }, "description": "__MSG_toggle_translate__" }, + "openTranbox": { + "suggested_key": { + "default": "Alt+S" + }, + "description": "__MSG_open_tranbox__" + }, "toggleStyle": { "suggested_key": { "default": "Alt+C" @@ -36,9 +42,6 @@ "description": "__MSG_toggle_style__" }, "openOptions": { - "suggested_key": { - "default": "Alt+O" - }, "description": "__MSG_open_options__" } }, diff --git a/options.js b/options.js index 8e69dee9..5b4172d7 100644 --- a/options.js +++ b/options.js @@ -43381,11 +43381,11 @@ ReactMarkdown.propTypes = { components: prop_types.object }; ;// CONCATENATED MODULE: ./src/config/rules.js -var DEFAULT_SELECTOR=":is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)";var rules_GLOBAL_KEY="*";var rules_REMAIN_KEY="-";var SHADOW_KEY=">>>";var DEFAULT_RULE={pattern:"",selector:"",translator:rules_GLOBAL_KEY,fromLang:rules_GLOBAL_KEY,toLang:rules_GLOBAL_KEY,textStyle:rules_GLOBAL_KEY,transOpen:rules_GLOBAL_KEY,bgColor:"",textDiyStyle:""};var DEFAULT_DIY_STYLE="color: #666;\nbackground: linear-gradient(\n 45deg,\n LightGreen 20%,\n LightPink 20% 40%,\n LightSalmon 40% 60%,\n LightSeaGreen 60% 80%,\n LightSkyBlue 80%\n);\n&:hover {\n color: #333;\n};";var rules_DEFAULT_OW_RULE={translator:rules_REMAIN_KEY,fromLang:rules_REMAIN_KEY,toLang:rules_REMAIN_KEY,textStyle:rules_REMAIN_KEY,transOpen:rules_REMAIN_KEY,bgColor:"",textDiyStyle:DEFAULT_DIY_STYLE};var RULES_MAP={"www.google.com/search":"h3, .IsZvec, .VwiC3b","news.google.com":"[role=\"link\"], .DY5T1d, .ifw3f, ".concat(DEFAULT_SELECTOR),"www.foxnews.com":"h1, h2, .title, .sidebar [data-type=\"Title\"], .article-content ".concat(DEFAULT_SELECTOR,"; [data-spotim-module=\"conversation\"]>div >>> [data-spot-im-class=\"message-text\"] p, [data-spot-im-class=\"message-text\"]"),"bearblog.dev, www.theverge.com, www.tampermonkey.net/documentation.php":"".concat(DEFAULT_SELECTOR),"themessenger.com":".leading-tight, .leading-tighter, .my-2 p, .font-body p, article ".concat(DEFAULT_SELECTOR),"www.telegraph.co.uk, go.dev/doc/":"article ".concat(DEFAULT_SELECTOR),"www.theguardian.com":".show-underline, .dcr-hup5wm div, .dcr-7vl6y8 div, .dcr-12evv1c, figcaption, article ".concat(DEFAULT_SELECTOR,", [data-cy=\"mostviewed-footer\"] h4"),"www.semafor.com":"".concat(DEFAULT_SELECTOR,", .styles_intro__IYj__, [class*=\"styles_description\"]"),"www.noemamag.com":".splash__title, .single-card__title, .single-card__type, .single-card__topic, .highlighted-content__title, .single-card__author, article ".concat(DEFAULT_SELECTOR,", .quote__text, .wp-caption-text div"),"restofworld.org":"".concat(DEFAULT_SELECTOR,", .recirc-story__headline, .recirc-story__dek"),"www.axios.com":".h7, ".concat(DEFAULT_SELECTOR),"www.newyorker.com":".summary-item__hed, .summary-item__dek, .summary-collection-grid__dek, .dqtvfu, .rubric__link, .caption, article ".concat(DEFAULT_SELECTOR,", .HEhan ").concat(DEFAULT_SELECTOR,", .ContributorBioBio-fBolsO"),"time.com":"h1, h3, .summary, .video-title, #article-body ".concat(DEFAULT_SELECTOR,", .image-wrap-container .credit.body-caption, .media-heading"),"www.dw.com":".ts-teaser-title a, .news-title a, .title a, .teaser-description a, .hbudab h3, .hbudab p, figcaption ,article ".concat(DEFAULT_SELECTOR),"www.bbc.com":"h1, h2, .media__link, .media__summary, article ".concat(DEFAULT_SELECTOR,", .ssrcss-y7krbn-Stack, .ssrcss-17zglt8-PromoHeadline, .ssrcss-18cjaf3-Headline, .gs-c-promo-heading__title, .gs-c-promo-summary, .media__content h3, .article__intro"),"www.chinadaily.com.cn":"h1, .tMain [shape=\"rect\"], .cMain [shape=\"rect\"], .photo_art [shape=\"rect\"], .mai_r [shape=\"rect\"], .lisBox li, #Content ".concat(DEFAULT_SELECTOR),"www.facebook.com":"[role=\"main\"] [dir=\"auto\"]","www.reddit.com":"[slot=\"title\"], [slot=\"text-body\"] ".concat(DEFAULT_SELECTOR,", #-post-rtjson-content p"),"www.quora.com":".qu-wordBreak--break-word","edition.cnn.com":".container__title, .container__headline, .headline__text, .image__caption, [data-type=\"Title\"], .article__content ".concat(DEFAULT_SELECTOR),"www.reuters.com":"#main-content [data-testid=\"Heading\"], #main-content [data-testid=\"Body\"], .article-body__content__17Yit ".concat(DEFAULT_SELECTOR),"www.bloomberg.com":"[data-component=\"headline\"], [data-component=\"related-item-headline\"], [data-component=\"title\"], article ".concat(DEFAULT_SELECTOR),"deno.land, docs.github.com":"main ".concat(DEFAULT_SELECTOR),"doc.rust-lang.org":".content ".concat(DEFAULT_SELECTOR),"www.indiehackers.com":"h1, h3, .content ".concat(DEFAULT_SELECTOR,", .feed-item__title-link"),"platform.openai.com/docs":".docs-body ".concat(DEFAULT_SELECTOR),"en.wikipedia.org":"h1, .mw-parser-output ".concat(DEFAULT_SELECTOR),"stackoverflow.com":"h1, .s-prose p, .comment-body .comment-copy","www.npmjs.com/package, developer.chrome.com/docs, medium.com, developers.cloudflare.com, react.dev, create-react-app.dev, pytorch.org":"article ".concat(DEFAULT_SELECTOR),"news.ycombinator.com":".title, .commtext","github.com":".markdown-body ".concat(DEFAULT_SELECTOR,", .repo-description p, .Layout-sidebar .f4, .container-lg .py-4 .f5, .container-lg .my-4 .f5, .Box-row .pr-4, .Box-row article .mt-1, [itemprop=\"description\"], .markdown-title, bdi, .ws-pre-wrap, .status-meta, span.status-meta, .col-10.color-fg-muted, .TimelineItem-body, .pinned-item-list-item-content .color-fg-muted, .markdown-body td, .markdown-body th"),"twitter.com":"[data-testid=\"tweetText\"]","m.youtube.com":".slim-video-information-title .yt-core-attributed-string, .media-item-headline .yt-core-attributed-string, .comment-text .yt-core-attributed-string, .typography-body-2b .yt-core-attributed-string, #ytp-caption-window-container .ytp-caption-segment","www.youtube.com":"h1, #video-title, #content-text, #title, yt-attributed-string>span>span, #ytp-caption-window-container .ytp-caption-segment","bard.google.com":".query-content ".concat(DEFAULT_SELECTOR,", message-content ").concat(DEFAULT_SELECTOR),"www.bing.com":".b_algoSlug, .rwrl_padref; .cib-serp-main >>> .ac-textBlock ".concat(DEFAULT_SELECTOR,", .text-message-content div"),"www.phoronix.com":"article ".concat(DEFAULT_SELECTOR),"wx2.qq.com":".js_message_plain","app.slack.com/client/":".p-rich_text_section, .c-message_attachment__text, .p-rich_text_list li","discord.com/channels/":"div[id^=message-content]","t.me/s/":".js-message_text ".concat(DEFAULT_SELECTOR),"web.telegram.org/k/":".message, .bot-commands-list-element-description, .reply-markup-button-text","web.telegram.org/a/":".message, .text-content, .bot-commands-list-element-description, .reply-markup-button-text","chromereleases.googleblog.com":".title, .publishdate, p, i, .header-desc, .header-title, .text","www.instagram.com/":"h1, article span[dir=auto] > span[dir=auto], ._ab1y","www.instagram.com/p/,www.instagram.com/reels/":"h1, div[class='x9f619 xjbqb8w x78zum5 x168nmei x13lgxp2 x5pf9jr xo71vjh x1uhb9sk x1plvlek xryxfnj x1c4vz4f x2lah0s xdt5ytf xqjyukv x1cy8zhl x1oa3qoh x1nhvcw1'] > span[class='x1lliihq x1plvlek xryxfnj x1n2onr6 x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs x1s928wv xhkezso x1gmr53x x1cpjm7i x1fgarty x1943h6x x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj'], span[class='x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs xt0psk2 x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj']","mail.google.com":"".concat(DEFAULT_SELECTOR,", h2[data-thread-perm-id], span[data-thread-id], div[data-message-id] div[class=''], .messageBody, #views"),"web.whatsapp.com":".copyable-text > span","chat.openai.com":"div[data-message-author-role] > div ".concat(DEFAULT_SELECTOR),"forum.ru-board.com":".tit, .dats, span.post ".concat(DEFAULT_SELECTOR),"education.github.com":"".concat(DEFAULT_SELECTOR,", a, summary, span.Button-content"),"blogs.windows.com":"".concat(DEFAULT_SELECTOR,", .c-uhf-nav-link, figcaption"),"developer.apple.com/documentation/":"#main ".concat(DEFAULT_SELECTOR,", #main .abstract .content, #main .abstract.content, #main .link span")};var rules_BUILTIN_RULES=Object.entries(RULES_MAP).sort(function(a,b){return a[0].localeCompare(b[0]);}).map(function(_ref){var _ref2=(0,slicedToArray/* default */.Z)(_ref,2),pattern=_ref2[0],selector=_ref2[1];return _objectSpread2(_objectSpread2({},DEFAULT_RULE),{},{pattern:pattern,selector:selector});}); +var DEFAULT_SELECTOR=":is(li, p, h1, h2, h3, h4, h5, h6, dd, blockquote)";var DEFAULT_KEEP_SELECTOR="code, img, svg";var rules_GLOBAL_KEY="*";var rules_REMAIN_KEY="-";var SHADOW_KEY=">>>";var DEFAULT_RULE={pattern:"",selector:"",keepSelector:"",translator:rules_GLOBAL_KEY,fromLang:rules_GLOBAL_KEY,toLang:rules_GLOBAL_KEY,textStyle:rules_GLOBAL_KEY,transOpen:rules_GLOBAL_KEY,bgColor:"",textDiyStyle:""};var DEFAULT_DIY_STYLE="color: #666;\nbackground: linear-gradient(\n 45deg,\n LightGreen 20%,\n LightPink 20% 40%,\n LightSalmon 40% 60%,\n LightSeaGreen 60% 80%,\n LightSkyBlue 80%\n);\n&:hover {\n color: #333;\n};";var rules_DEFAULT_OW_RULE={translator:rules_REMAIN_KEY,fromLang:rules_REMAIN_KEY,toLang:rules_REMAIN_KEY,textStyle:rules_REMAIN_KEY,transOpen:rules_REMAIN_KEY,bgColor:"",textDiyStyle:DEFAULT_DIY_STYLE};var RULES_MAP={"www.google.com/search":["h3, .IsZvec, .VwiC3b"],"news.google.com":["[role=\"link\"], .DY5T1d, .ifw3f, ".concat(DEFAULT_SELECTOR)],"www.foxnews.com":["h1, h2, .title, .sidebar [data-type=\"Title\"], .article-content ".concat(DEFAULT_SELECTOR,"; [data-spotim-module=\"conversation\"]>div >>> [data-spot-im-class=\"message-text\"] p, [data-spot-im-class=\"message-text\"]")],"bearblog.dev, www.theverge.com, www.tampermonkey.net/documentation.php":["".concat(DEFAULT_SELECTOR)],"themessenger.com":[".leading-tight, .leading-tighter, .my-2 p, .font-body p, article ".concat(DEFAULT_SELECTOR)],"www.telegraph.co.uk, go.dev/doc/":["article ".concat(DEFAULT_SELECTOR)],"www.theguardian.com":[".show-underline, .dcr-hup5wm div, .dcr-7vl6y8 div, .dcr-12evv1c, figcaption, article ".concat(DEFAULT_SELECTOR,", [data-cy=\"mostviewed-footer\"] h4")],"www.semafor.com":["".concat(DEFAULT_SELECTOR,", .styles_intro__IYj__, [class*=\"styles_description\"]")],"www.noemamag.com":[".splash__title, .single-card__title, .single-card__type, .single-card__topic, .highlighted-content__title, .single-card__author, article ".concat(DEFAULT_SELECTOR,", .quote__text, .wp-caption-text div")],"restofworld.org":["".concat(DEFAULT_SELECTOR,", .recirc-story__headline, .recirc-story__dek")],"www.axios.com":[".h7, ".concat(DEFAULT_SELECTOR)],"www.newyorker.com":[".summary-item__hed, .summary-item__dek, .summary-collection-grid__dek, .dqtvfu, .rubric__link, .caption, article ".concat(DEFAULT_SELECTOR,", .HEhan ").concat(DEFAULT_SELECTOR,", .ContributorBioBio-fBolsO, .BaseText-ewhhUZ")],"time.com":["h1, h3, .summary, .video-title, #article-body ".concat(DEFAULT_SELECTOR,", .image-wrap-container .credit.body-caption, .media-heading")],"www.dw.com":[".ts-teaser-title a, .news-title a, .title a, .teaser-description a, .hbudab h3, .hbudab p, figcaption ,article ".concat(DEFAULT_SELECTOR)],"www.bbc.com":["h1, h2, .media__link, .media__summary, article ".concat(DEFAULT_SELECTOR,", .ssrcss-y7krbn-Stack, .ssrcss-17zglt8-PromoHeadline, .ssrcss-18cjaf3-Headline, .gs-c-promo-heading__title, .gs-c-promo-summary, .media__content h3, .article__intro, .lx-c-summary-points>li")],"www.chinadaily.com.cn":["h1, .tMain [shape=\"rect\"], .cMain [shape=\"rect\"], .photo_art [shape=\"rect\"], .mai_r [shape=\"rect\"], .lisBox li, #Content ".concat(DEFAULT_SELECTOR)],"www.facebook.com":["[role=\"main\"] [dir=\"auto\"]"],"www.reddit.com":["div:is(.tbIApBd2DM_drfZQJjIum, ._1zPvgKHteTOub9dKkvrOl4,.ULWj94BYSOqoJDetxgcnU),a:is([class^=\"_334yl59\"],[class^=\"_2GrMpxD\"]),h1,h2,h3,h4,h5,h6,p,button"],"www.quora.com":[".qu-wordBreak--break-word"],"edition.cnn.com":[".container__title, .container__headline, .headline__text, .image__caption, [data-type=\"Title\"], .article__content ".concat(DEFAULT_SELECTOR)],"www.reuters.com":["#main-content [data-testid=\"Heading\"], #main-content [data-testid=\"Body\"], .article-body__content__17Yit ".concat(DEFAULT_SELECTOR)],"www.bloomberg.com":["[data-component=\"headline\"], [data-component=\"related-item-headline\"], [data-component=\"title\"], article ".concat(DEFAULT_SELECTOR)],"deno.land, docs.github.com":["main ".concat(DEFAULT_SELECTOR),"code, img, svg"],"doc.rust-lang.org":[".content ".concat(DEFAULT_SELECTOR),"code, img, svg"],"www.indiehackers.com":["h1, h3, .content ".concat(DEFAULT_SELECTOR,", .feed-item__title-link")],"platform.openai.com/docs":[".docs-body ".concat(DEFAULT_SELECTOR),"code, img, svg"],"en.wikipedia.org":["h1, .mw-parser-output ".concat(DEFAULT_SELECTOR),".mwe-math-element"],"stackoverflow.com":["h1, .s-prose p, .comment-body .comment-copy","code, img, svg"],"www.npmjs.com/package, developer.chrome.com/docs, medium.com, developers.cloudflare.com, react.dev, create-react-app.dev, pytorch.org":["article ".concat(DEFAULT_SELECTOR)],"news.ycombinator.com":[".title, .commtext"],"github.com":[".markdown-body ".concat(DEFAULT_SELECTOR,", .repo-description p, .Layout-sidebar .f4, .container-lg .py-4 .f5, .container-lg .my-4 .f5, .Box-row .pr-4, .Box-row article .mt-1, [itemprop=\"description\"], .markdown-title, bdi, .ws-pre-wrap, .status-meta, span.status-meta, .col-10.color-fg-muted, .TimelineItem-body, .pinned-item-list-item-content .color-fg-muted, .markdown-body td, .markdown-body th"),"code, img, svg"],"twitter.com":["[data-testid=\"tweetText\"], [data-testid=\"birdwatch-pivot\"]>div.css-1rynq56","img, a, .r-18u37iz, .css-175oi2r"],"m.youtube.com":[".slim-video-information-title .yt-core-attributed-string, .media-item-headline .yt-core-attributed-string, .comment-text .yt-core-attributed-string, .typography-body-2b .yt-core-attributed-string, #ytp-caption-window-container .ytp-caption-segment"],"www.youtube.com":["h1, #video-title, #content-text, #title, yt-attributed-string>span>span, #ytp-caption-window-container .ytp-caption-segment"],"bard.google.com":[".query-content ".concat(DEFAULT_SELECTOR,", message-content ").concat(DEFAULT_SELECTOR)],"www.bing.com":[".b_algoSlug, .rwrl_padref; .cib-serp-main >>> .ac-textBlock ".concat(DEFAULT_SELECTOR,", .text-message-content div")],"www.phoronix.com":["article ".concat(DEFAULT_SELECTOR)],"wx2.qq.com":[".js_message_plain"],"app.slack.com/client/":[".p-rich_text_section, .c-message_attachment__text, .p-rich_text_list li"],"discord.com/channels/":["li[id^=chat-messages] div[id^=message-content], div[class^=headerText], div[class^=name_], section[aria-label='Search Results'] div[id^=message-content]"],"t.me/s/":[".js-message_text ".concat(DEFAULT_SELECTOR)],"web.telegram.org/k/":[".message, .bot-commands-list-element-description, .reply-markup-button-text"],"web.telegram.org/a/":[".message, .text-content, .bot-commands-list-element-description, .reply-markup-button-text"],"chromereleases.googleblog.com":[".title, .publishdate, p, i, .header-desc, .header-title, .text"],"www.instagram.com/":["h1, article span[dir=auto] > span[dir=auto], ._ab1y"],"www.instagram.com/p/,www.instagram.com/reels/":["h1, div[class='x9f619 xjbqb8w x78zum5 x168nmei x13lgxp2 x5pf9jr xo71vjh x1uhb9sk x1plvlek xryxfnj x1c4vz4f x2lah0s xdt5ytf xqjyukv x1cy8zhl x1oa3qoh x1nhvcw1'] > span[class='x1lliihq x1plvlek xryxfnj x1n2onr6 x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs x1s928wv xhkezso x1gmr53x x1cpjm7i x1fgarty x1943h6x x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj'], span[class='x193iq5w xeuugli x1fj9vlw x13faqbe x1vvkbs xt0psk2 x1i0vuye xvs91rp xo1l8bm x5n08af x10wh9bi x1wdrske x8viiok x18hxmgj']"],"mail.google.com":["".concat(DEFAULT_SELECTOR,", h2[data-thread-perm-id], span[data-thread-id], div[data-message-id] div[class=''], .messageBody, #views")],"web.whatsapp.com":[".copyable-text > span"],"chat.openai.com":["div[data-message-author-role] > div ".concat(DEFAULT_SELECTOR)],"forum.ru-board.com":[".tit, .dats, span.post, .lgf ".concat(DEFAULT_SELECTOR)],"education.github.com":["".concat(DEFAULT_SELECTOR,", a, summary, span.Button-content")],"blogs.windows.com":["".concat(DEFAULT_SELECTOR,", .c-uhf-nav-link, figcaption")],"developer.apple.com/documentation/":["#main ".concat(DEFAULT_SELECTOR,", #main .abstract .content, #main .abstract.content, #main .link span"),"code, img, svg"],"greasyfork.org":["h2, .script-link, .script-description, #additional-info ".concat(DEFAULT_SELECTOR)],"www.fmkorea.com":["#container ".concat(DEFAULT_SELECTOR)],"forum.arduino.cc":[".top-row>.title, .featured-topic>.title, .link-top-line>.title, .category-description, .topic-excerpt, .fancy-title, .cooked ".concat(DEFAULT_SELECTOR)],"docs.arduino.cc":["[class^=\"tutorial-module--left\"] ".concat(DEFAULT_SELECTOR)],"www.historydefined.net":[".wp-element-caption, ".concat(DEFAULT_SELECTOR)]};var rules_BUILTIN_RULES=Object.entries(RULES_MAP).sort(function(a,b){return a[0].localeCompare(b[0]);}).map(function(_ref){var _ref2=(0,slicedToArray/* default */.Z)(_ref,2),pattern=_ref2[0],_ref2$=(0,slicedToArray/* default */.Z)(_ref2[1],2),selector=_ref2$[0],_ref2$$=_ref2$[1],keepSelector=_ref2$$===void 0?"":_ref2$$;return _objectSpread2(_objectSpread2({},DEFAULT_RULE),{},{pattern:pattern,selector:selector,keepSelector:keepSelector});}); ;// CONCATENATED MODULE: ./src/config/app.js var APP_NAME="KISS Translator".trim().split(/\s+/).join("-");var APP_LCNAME=APP_NAME.toLowerCase(); ;// CONCATENATED MODULE: ./src/config/i18n.js -var UI_LANGS=[["en","English"],["zh","中文"]];var customApiLangs="[\"en\", \"English - English\"],\n[\"zh-CN\", \"Simplified Chinese - \u7B80\u4F53\u4E2D\u6587\"],\n[\"zh-TW\", \"Traditional Chinese - \u7E41\u9AD4\u4E2D\u6587\"],\n[\"ar\", \"Arabic - \u0627\u0644\u0639\u0631\u0628\u064A\u0629\"],\n[\"bg\", \"Bulgarian - \u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438\"],\n[\"ca\", \"Catalan - Catal\xE0\"],\n[\"hr\", \"Croatian - Hrvatski\"],\n[\"cs\", \"Czech - \u010Ce\u0161tina\"],\n[\"da\", \"Danish - Dansk\"],\n[\"nl\", \"Dutch - Nederlands\"],\n[\"fi\", \"Finnish - Suomi\"],\n[\"fr\", \"French - Fran\xE7ais\"],\n[\"de\", \"German - Deutsch\"],\n[\"el\", \"Greek - \u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC\"],\n[\"hi\", \"Hindi - \u0939\u093F\u0928\u094D\u0926\u0940\"],\n[\"hu\", \"Hungarian - Magyar\"],\n[\"id\", \"Indonesian - Indonesia\"],\n[\"it\", \"Italian - Italiano\"],\n[\"ja\", \"Japanese - \u65E5\u672C\u8A9E\"],\n[\"ko\", \"Korean - \uD55C\uAD6D\uC5B4\"],\n[\"ms\", \"Malay - Melayu\"],\n[\"mt\", \"Maltese - Malti\"],\n[\"nb\", \"Norwegian - Norsk Bokm\xE5l\"],\n[\"pl\", \"Polish - Polski\"],\n[\"pt\", \"Portuguese - Portugu\xEAs\"],\n[\"ro\", \"Romanian - Rom\xE2n\u0103\"],\n[\"ru\", \"Russian - \u0420\u0443\u0441\u0441\u043A\u0438\u0439\"],\n[\"sk\", \"Slovak - Sloven\u010Dina\"],\n[\"sl\", \"Slovenian - Sloven\u0161\u010Dina\"],\n[\"es\", \"Spanish - Espa\xF1ol\"],\n[\"sv\", \"Swedish - Svenska\"],\n[\"ta\", \"Tamil - \u0BA4\u0BAE\u0BBF\u0BB4\u0BCD\"],\n[\"te\", \"Telugu - \u0C24\u0C46\u0C32\u0C41\u0C17\u0C41\"],\n[\"th\", \"Thai - \u0E44\u0E17\u0E22\"],\n[\"tr\", \"Turkish - T\xFCrk\xE7e\"],\n[\"uk\", \"Ukrainian - \u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430\"],\n[\"vi\", \"Vietnamese - Ti\u1EBFng Vi\u1EC7t\"],\n";var customApiHelpZH="/// \u81EA\u5B9A\u4E49\u7FFB\u8BD1\u6E90\u63A5\u53E3\u8BF4\u660E\n\n// \u8BF7\u6C42\uFF08Request\uFF09\u6570\u636E\u5C06\u6309\u4E0B\u9762\u89C4\u8303\u53D1\u9001\n{\n url: {{YOUR_URL}},\n method: \"POST\",\n headers: {\n \"Content-type\": \"application/json\",\n \"Authorization\": \"Bearer {{YOUR_KEY}}\",\n },\n body: {\n text: \"\", // \u9700\u8981\u7FFB\u8BD1\u7684\u6587\u5B57\n from: \"\", // \u6E90\u8BED\u8A00\uFF0C\u53EF\u80FD\u4E3A\u7A7A\uFF0C\u8868\u793A\u9700\u8981\u63A5\u53E3\u81EA\u52A8\u8BC6\u522B\u8BED\u8A00\n to: \"\", // \u76EE\u6807\u8BED\u8A00\n }\n}\n\n// \u8FD4\u56DE\uFF08Response\uFF09\u6570\u636E\u9700\u7B26\u5408\u4E0B\u9762\u7684JSON\u89C4\u8303\n{\n text: \"\", // \u7FFB\u8BD1\u540E\u7684\u6587\u5B57\n from: \"\", // \u8BC6\u522B\u7684\u6E90\u8BED\u8A00\n to: \"\", // \u76EE\u6807\u8BED\u8A00\uFF08\u53EF\u9009\uFF09\n}\n\n// \u652F\u6301\u7684\u8BED\u8A00\u4EE3\u7801\u5982\u4E0B\n".concat(customApiLangs,"\n");var customApiHelpEN="/// Custom translation source interface description\n\n// Request data will be sent according to the following specifications\n{\n url: {{YOUR_URL}},\n method: \"POST\",\n headers: {\n \"Content-type\": \"application/json\",\n \"Authorization\": \"Bearer {{YOUR_KEY}}\",\n },\n body: {\n text: \"\", // text to be translated\n from: \"\", // Source language, may be empty\n to: \"\", // Target language\n }\n}\n\n// The returned data must conform to the following JSON specification\n{\n text: \"\", // translated text\n from: \"\", // Recognized source language\n to: \"\", // Target language (optional)\n}\n\n// The supported language codes are as follows\n".concat(customApiLangs,"\n");var I18N={app_name:{zh:"\u7B80\u7EA6\u7FFB\u8BD1",en:"KISS Translator"},translate:{zh:"\u7FFB\u8BD1",en:"Translate"},custom_api_help:{zh:customApiHelpZH,en:customApiHelpEN},translate_alt:{zh:"\u7FFB\u8BD1 (Alt+Q)",en:"Translate (Alt+Q)"},basic_setting:{zh:"\u57FA\u672C\u8BBE\u7F6E",en:"Basic Setting"},rules_setting:{zh:"\u89C4\u5219\u8BBE\u7F6E",en:"Rules Setting"},apis_setting:{zh:"\u63A5\u53E3\u8BBE\u7F6E",en:"Apis Setting"},sync_setting:{zh:"\u540C\u6B65\u8BBE\u7F6E",en:"Sync Setting"},patch_setting:{zh:"\u8865\u4E01\u8BBE\u7F6E",en:"Patch Setting"},patch_setting_help:{zh:"\u9488\u5BF9\u4E00\u4E9B\u7279\u6B8A\u7F51\u7AD9\u7684\u4FEE\u6B63\u811A\u672C\uFF0C\u4EE5\u4FBF\u7FFB\u8BD1\u8F6F\u4EF6\u5F97\u5230\u66F4\u597D\u7684\u5C55\u793A\u6548\u679C\u3002",en:"Corrected scripts for some special websites so that the translation software can get better display results."},inject_webfix:{zh:"\u6CE8\u5165\u4FEE\u590D\u8865\u4E01",en:"Inject Webfix"},about:{zh:"\u5173\u4E8E",en:"About"},about_md:{zh:"README.md",en:"README.en.md"},about_md_local:{zh:"\u8BF7 [\u70B9\u51FB\u8FD9\u91CC](".concat("https://github.com/fishjar/kiss-translator",") \u67E5\u770B\u8BE6\u60C5\u3002"),en:"Please [click here](".concat("https://github.com/fishjar/kiss-translator",") for details.")},ui_lang:{zh:"\u754C\u9762\u8BED\u8A00",en:"Interface Language"},fetch_limit:{zh:"\u6700\u5927\u8BF7\u6C42\u6570\u91CF (1-100)",en:"Maximum Number Of Request (1-100)"},fetch_interval:{zh:"\u8BF7\u6C42\u95F4\u9694\u65F6\u95F4 (0-5000ms)",en:"Request Interval (0-5000ms)"},min_translate_length:{zh:"\u6700\u5C0F\u7FFB\u8BD1\u957F\u5EA6 (1-100)",en:"Min Translate Length (1-100)"},max_translate_length:{zh:"\u6700\u5927\u7FFB\u8BD1\u957F\u5EA6 (100-10000)",en:"Max Translate Length (100-10000)"},num_of_newline_characters:{zh:"\u6362\u884C\u5B57\u7B26\u6570 (1-1000)",en:"Number of Newline Characters (1-1000)"},translate_service:{zh:"\u7FFB\u8BD1\u670D\u52A1",en:"Translate Service"},mouseover_translation:{zh:"\u9F20\u6807\u60AC\u505C\u7FFB\u8BD1",en:"Mouseover translation"},mk_disable:{zh:"\u7981\u7528",en:"Disable"},mk_mouseover:{zh:"\u9F20\u6807\u60AC\u505C",en:"Mouseover"},mk_ctrlKey:{zh:"Control + \u9F20\u6807\u60AC\u505C",en:"Control + Mouseover"},mk_shiftKey:{zh:"Shift + \u9F20\u6807\u60AC\u505C",en:"Shift + Mouseover"},mk_altKey:{zh:"Alt + \u9F20\u6807\u60AC\u505C",en:"Alt + Mouseover"},from_lang:{zh:"\u539F\u6587\u8BED\u8A00",en:"Source Language"},to_lang:{zh:"\u76EE\u6807\u8BED\u8A00",en:"Target Language"},to_lang2:{zh:"\u7B2C\u4E8C\u76EE\u6807\u8BED\u8A00",en:"Target Language 2"},to_lang2_helper:{zh:"\u8BBE\u5B9A\u540E\uFF0C\u4E0E\u76EE\u6807\u8BED\u8A00\u4EA7\u751F\u4E92\u8BD1\u6548\u679C\uFF0C\u4F46\u4F9D\u8D56\u8FDC\u7A0B\u8BED\u8A00\u8BC6\u522B\u3002",en:"After setting, it will produce mutual translation effect with the target language, but it relies on remote language recognition."},text_style:{zh:"\u6587\u5B57\u6837\u5F0F",en:"Text Style"},text_style_alt:{zh:"\u6587\u5B57\u6837\u5F0F (Alt+C)",en:"Text Style (Alt+C)"},bg_color:{zh:"\u6837\u5F0F\u989C\u8272",en:"Style Color"},remain_unchanged:{zh:"\u4FDD\u7559\u4E0D\u53D8",en:"Remain Unchanged"},google_api:{zh:"\u8C37\u6B4C\u7FFB\u8BD1\u63A5\u53E3",en:"Google Translate API"},default_selector:{zh:"\u9ED8\u8BA4\u9009\u62E9\u5668",en:"Default selector"},selector_rules:{zh:"\u9009\u62E9\u5668\u89C4\u5219",en:"Selector Rules"},save:{zh:"\u4FDD\u5B58",en:"Save"},edit:{zh:"\u7F16\u8F91",en:"Edit"},cancel:{zh:"\u53D6\u6D88",en:"Cancel"},delete:{zh:"\u5220\u9664",en:"Delete"},reset:{zh:"\u91CD\u7F6E",en:"Reset"},add:{zh:"\u6DFB\u52A0",en:"Add"},inject_rules:{zh:"\u6CE8\u5165\u8BA2\u9605\u89C4\u5219",en:"Inject Subscribe Rules"},personal_rules:{zh:"\u4E2A\u4EBA\u89C4\u5219",en:"Rules"},subscribe_rules:{zh:"\u8BA2\u9605\u89C4\u5219",en:"Subscribe"},overwrite_subscribe_rules:{zh:"\u8986\u5199\u8BA2\u9605\u89C4\u5219",en:"Overwrite"},subscribe_url:{zh:"\u8BA2\u9605\u5730\u5740",en:"Subscribe URL"},rules_warn_1:{zh:"1\u3001\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u4E00\u76F4\u751F\u6548\uFF0C\u9009\u62E9\u201C\u6CE8\u5165\u8BA2\u9605\u89C4\u5219\u201D\u540E\uFF0C\u201C\u8BA2\u9605\u89C4\u5219\u201D\u624D\u4F1A\u751F\u6548\u3002",en:"1. The \"Personal Rules\" are always in effect. After selecting \"Inject Subscription Rules\", the \"Subscription Rules\" will take effect."},rules_warn_2:{zh:"2\u3001\u201C\u8BA2\u9605\u89C4\u5219\u201D\u7684\u6CE8\u5165\u4F4D\u7F6E\u662F\u5012\u6570\u7B2C\u4E8C\u7684\u4F4D\u7F6E\uFF0C\u56E0\u6B64\u9664\u5168\u5C40\u89C4\u5219(*)\u5916\uFF0C\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u4F18\u5148\u7EA7\u6BD4\u201C\u8BA2\u9605\u89C4\u5219\u201D\u9AD8\uFF0C\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u586B\u5199\u540C\u6837\u7684\u7F51\u5740\u4F1A\u8986\u76D6\u201D\u8BA2\u9605\u89C4\u5219\u201C\u7684\u6761\u76EE\u3002",en:"2. The injection position of \"Subscription Rules\" is the penultimate position. Therefore, except for the global rules (*), the priority of \"Personal Rules\" is higher than that of \"Subscription Rules\". Filling in the same url in \"Personal Rules\" will overwrite \"Subscription Rules\" entry."},sync_warn:{zh:"\u5982\u679C\u670D\u52A1\u5668\u5B58\u5728\u5176\u4ED6\u5BA2\u6237\u7AEF\u540C\u6B65\u7684\u6570\u636E\uFF0C\u7B2C\u4E00\u6B21\u540C\u6B65\u5C06\u76F4\u63A5\u8986\u76D6\u672C\u5730\u914D\u7F6E\uFF0C\u540E\u9762\u5219\u6839\u636E\u4FEE\u6539\u65F6\u95F4\uFF0C\u65B0\u7684\u8986\u76D6\u65E7\u7684\u3002",en:"If the server has data synchronized by other clients, the first synchronization will directly overwrite the local configuration, and later, according to the modification time, the new one will overwrite the old one."},about_sync_api:{zh:"\u67E5\u770B\u5173\u4E8E\u6570\u636E\u540C\u6B65\u63A5\u53E3\u90E8\u7F72",en:"View About Data Synchronization Interface Deployment"},about_api_proxy:{zh:"\u67E5\u770B\u81EA\u5EFA\u4E00\u4E2A\u7FFB\u8BD1\u63A5\u53E3\u4EE3\u7406",en:"Check out the self-built translation interface proxy"},style_none:{zh:"\u65E0",en:"None"},under_line:{zh:"\u4E0B\u5212\u76F4\u7EBF",en:"Underline"},dot_line:{zh:"\u4E0B\u5212\u70B9\u72B6\u7EBF",en:"Dotted Underline"},dash_line:{zh:"\u4E0B\u5212\u865A\u7EBF",en:"Dashed Underline"},wavy_line:{zh:"\u4E0B\u5212\u6CE2\u6D6A\u7EBF",en:"Wavy Underline"},fuzzy:{zh:"\u6A21\u7CCA",en:"Fuzzy"},highlight:{zh:"\u9AD8\u4EAE",en:"Highlight"},blockquote:{zh:"\u5F15\u7528",en:"Blockquote"},diy_style:{zh:"\u81EA\u5B9A\u4E49\u6837\u5F0F",en:"Custom Style"},diy_style_helper:{zh:"\u9075\u5FAA\u201CCSS\u201D\u7684\u8BED\u6CD5",en:"Follow the syntax of \"CSS\""},setting:{zh:"\u8BBE\u7F6E (Alt+O)",en:"Setting (Alt+O)"},pattern:{zh:"\u5339\u914D\u7F51\u5740",en:"URL pattern"},pattern_helper:{zh:"1\u3001\u652F\u6301\u661F\u53F7(*)\u901A\u914D\u7B26\u30022\u3001\u591A\u4E2AURL\u7528\u82F1\u6587\u9017\u53F7\u201C,\u201D\u5206\u9694\u3002",en:"1. The asterisk (*) wildcard is supported. 2. Multiple URLs separated by English commas \",\"."},selector_helper:{zh:"1\u3001\u9075\u5FAACSS\u9009\u62E9\u5668\u8BED\u6CD5\u30022\u3001\u7559\u7A7A\u8868\u793A\u91C7\u7528\u5168\u5C40\u8BBE\u7F6E\u30023\u3001\u591A\u4E2ACSS\u9009\u62E9\u5668\u4E4B\u95F4\u7528\u201C;\u201D\u9694\u5F00\u30024\u3001\u201Cshadow root\u201D\u9009\u62E9\u5668\u548C\u5185\u90E8\u9009\u62E9\u5668\u7528\u201C>>>\u201D\u9694\u5F00\u3002",en:"1. Follow CSS selector syntax. 2. Leave blank to adopt the global setting. 3. Separate multiple CSS selectors with \";\". 4. The \"shadow root\" selector and the internal selector are separated by \">>>\"."},translate_switch:{zh:"\u5F00\u542F\u7FFB\u8BD1",en:"Translate Switch"},default_enabled:{zh:"\u9ED8\u8BA4\u5F00\u542F",en:"Enabled"},default_disabled:{zh:"\u9ED8\u8BA4\u5173\u95ED",en:"Disabled"},selector:{zh:"\u9009\u62E9\u5668",en:"Selector"},root_selector:{zh:"\u6839\u9009\u62E9\u5668",en:"Root Selector"},fixer_function:{zh:"\u4FEE\u590D\u51FD\u6570",en:"Fixer Function"},import:{zh:"\u5BFC\u5165",en:"Import"},export:{zh:"\u5BFC\u51FA",en:"Export"},error_cant_be_blank:{zh:"\u4E0D\u80FD\u4E3A\u7A7A",en:"Can not be blank"},error_duplicate_values:{zh:"\u5B58\u5728\u91CD\u590D\u7684\u503C",en:"There are duplicate values"},error_wrong_file_type:{zh:"\u9519\u8BEF\u7684\u6587\u4EF6\u7C7B\u578B",en:"Wrong file type"},error_fetch_url:{zh:"\u8BF7\u68C0\u67E5url\u5730\u5740\u662F\u5426\u6B63\u786E\u6216\u7A0D\u540E\u518D\u8BD5\u3002",en:"Please check if the url address is correct or try again later."},deepl_api:{zh:"DeepL \u63A5\u53E3",en:"DeepL API"},deepl_key:{zh:"DeepL \u5BC6\u94A5",en:"DeepL Key"},openai_api:{zh:"OpenAI \u63A5\u53E3",en:"OpenAI API"},openai_key:{zh:"OpenAI \u5BC6\u94A5",en:"OpenAI Key"},openai_model:{zh:"OpenAI \u6A21\u578B",en:"OpenAI Model"},openai_prompt:{zh:"OpenAI \u63D0\u793A\u8BCD",en:"OpenAI Prompt"},if_clear_cache:{zh:"\u662F\u5426\u6E05\u9664\u7F13\u5B58",en:"Whether clear cache"},clear_cache_never:{zh:"\u4E0D\u6E05\u9664\u7F13\u5B58",en:"Never clear cache"},clear_cache_restart:{zh:"\u91CD\u542F\u6D4F\u89C8\u5668\u65F6\u6E05\u9664\u7F13\u5B58",en:"Clear cache when restarting browser"},data_sync_type:{zh:"\u6570\u636E\u540C\u6B65\u65B9\u5F0F",en:"Data Sync Type"},data_sync_url:{zh:"\u6570\u636E\u540C\u6B65\u63A5\u53E3",en:"Data Sync API"},data_sync_user:{zh:"\u6570\u636E\u540C\u6B65\u8D26\u6237",en:"Data Sync User"},data_sync_key:{zh:"\u6570\u636E\u540C\u6B65\u5BC6\u94A5",en:"Data Sync Key"},sync_now:{zh:"\u7ACB\u5373\u540C\u6B65",en:"Sync Now"},sync_success:{zh:"\u540C\u6B65\u6210\u529F\uFF01",en:"Sync Success"},sync_failed:{zh:"\u540C\u6B65\u5931\u8D25\uFF01",en:"Sync Error"},error_got_some_wrong:{zh:"\u62B1\u6B49\uFF0C\u51FA\u9519\u4E86\uFF01",en:"Sorry, something went wrong!"},error_sync_setting:{zh:"\u60A8\u7684\u540C\u6B65\u7C7B\u578B\u5FC5\u987B\u4E3A\u201CKISS-Worker\u201D\uFF0C\u4E14\u9700\u586B\u5199\u5B8C\u6574",en:"Your sync type must be \"KISS-Worker\" and must be filled in completely"},click_test:{zh:"\u70B9\u51FB\u6D4B\u8BD5",en:"Click Test"},test_success:{zh:"\u6D4B\u8BD5\u6210\u529F",en:"Test success"},test_failed:{zh:"\u6D4B\u8BD5\u5931\u8D25",en:"Test failed"},clear_all_cache_now:{zh:"\u7ACB\u5373\u6E05\u9664\u5168\u90E8\u7F13\u5B58",en:"Clear all cache now"},clear_cache:{zh:"\u6E05\u9664\u7F13\u5B58",en:"Clear Cache"},clear_success:{zh:"\u6E05\u9664\u6210\u529F",en:"Clear success"},clear_failed:{zh:"\u6E05\u9664\u5931\u8D25",en:"Clear failed"},share:{zh:"\u5206\u4EAB",en:"Share"},clear_all:{zh:"\u6E05\u7A7A",en:"Clear All"},help:{zh:"\u6C42\u52A9",en:"Help"},restore_default:{zh:"\u6062\u590D\u9ED8\u8BA4",en:"Restore Default"},shortcuts_setting:{zh:"\u5FEB\u6377\u952E\u8BBE\u7F6E",en:"Shortcuts Setting"},toggle_translate_shortcut:{zh:"\"\u5F00\u542F\u7FFB\u8BD1\"\u5FEB\u6377\u952E",en:"\"Toggle Translate\" Shortcut"},toggle_style_shortcut:{zh:"\"\u5207\u6362\u6837\u5F0F\"\u5FEB\u6377\u952E",en:"\"Toggle Style\" Shortcut"},toggle_popup_shortcut:{zh:"\"\u6253\u5F00\u5F39\u7A97\"\u5FEB\u6377\u952E",en:"\"Open Popup\" Shortcut"},open_setting_shortcut:{zh:"\"\u6253\u5F00\u8BBE\u7F6E\"\u5FEB\u6377\u952E",en:"\"Open Setting\" Shortcut"},hide_fab_button:{zh:"\u9690\u85CF\u60AC\u6D6E\u6309\u94AE",en:"Hide Fab Button"},hide_tran_button:{zh:"\u9690\u85CF\u7FFB\u8BD1\u6309\u94AE",en:"Hide Translate Button"},show:{zh:"\u663E\u793A",en:"Show"},hide:{zh:"\u9690\u85CF",en:"Hide"},save_rule:{zh:"\u4FDD\u5B58\u89C4\u5219",en:"Save Rule"},global_rule:{zh:"\u5168\u5C40\u89C4\u5219",en:"Global Rule"},input_translate:{zh:"\u8F93\u5165\u6846\u7FFB\u8BD1",en:"Input Box Translation"},use_input_box_translation:{zh:"\u542F\u7528\u8F93\u5165\u6846\u7FFB\u8BD1",en:"Input Box Translation"},input_selector:{zh:"\u8F93\u5165\u6846\u9009\u62E9\u5668",en:"Input Selector"},input_selector_helper:{zh:"\u7528\u4E8E\u8F93\u5165\u6846\u7FFB\u8BD1\u3002",en:"Used for input box translation."},trigger_trans_shortcut:{zh:"\u89E6\u53D1\u7FFB\u8BD1\u5FEB\u6377\u952E",en:"Trigger Translation Shortcut Keys"},trigger_trans_shortcut_help:{zh:"\u9ED8\u8BA4\u4E3A\u5355\u51FB\u201CAltLeft+KeyI\u201D",en:"Default is \"AltLeft+KeyI\""},shortcut_press_count:{zh:"\u5FEB\u6377\u952E\u8FDE\u51FB\u6B21\u6570",en:"Shortcut Press Number"},combo_timeout:{zh:"\u8FDE\u51FB\u8D85\u65F6\u65F6\u95F4 (10-1000ms)",en:"Combo Timeout (10-1000ms)"},input_trans_start_sign:{zh:"\u7FFB\u8BD1\u8D77\u59CB\u6807\u8BC6",en:"Translation Start Sign"},input_trans_start_sign_help:{zh:"\u6807\u8BC6\u540E\u9762\u53EF\u4EE5\u52A0\u76EE\u6807\u8BED\u8A00\u4EE3\u7801\uFF0C\u5982\uFF1A \u201C/en \u4F60\u597D\u201D\u3001\u201C/zh hello\u201D",en:"The target language code can be added after the sign, such as: \"/en \u4F60\u597D\", \"/zh hello\""},detect_lang_remote:{zh:"\u8FDC\u7A0B\u8BED\u8A00\u68C0\u6D4B",en:"Remote language detection"},detect_lang_remote_help:{zh:"\u542F\u7528\u540E\u68C0\u6D4B\u51C6\u786E\u5EA6\u589E\u52A0\uFF0C\u4F46\u4F1A\u964D\u4F4E\u7FFB\u8BD1\u901F\u5EA6\uFF0C\u8BF7\u914C\u60C5\u5F00\u542F",en:"After enabling, the detection accuracy will increase, but it will reduce the translation speed. Please enable it as appropriate."},disable:{zh:"\u7981\u7528",en:"Disable"},enable:{zh:"\u542F\u7528",en:"Enable"},selection_translate:{zh:"\u5212\u8BCD\u7FFB\u8BD1",en:"Selection Translate"},toggle_selection_translate:{zh:"\u542F\u7528\u5212\u8BCD\u7FFB\u8BD1",en:"Use Selection Translate"},trigger_tranbox_shortcut:{zh:"\u663E\u793A\u7FFB\u8BD1\u6846/\u7FFB\u8BD1\u9009\u4E2D\u6587\u5B57\u5FEB\u6377\u952E",en:"Open Translate Popup/Translate Selected Shortcut"},tranbtn_offset_x:{zh:"\u7FFB\u8BD1\u6309\u94AE\u504F\u79FBX\uFF080-100\uFF09",en:"Translate Button Offset X (0-100)"},tranbtn_offset_y:{zh:"\u7FFB\u8BD1\u6309\u94AE\u504F\u79FBY\uFF080-100\uFF09",en:"Translate Button Offset Y (0-100)"},translated_text:{zh:"\u8BD1\u6587",en:"Translated Text"},original_text:{zh:"\u539F\u6587",en:"Original Text"},favorite_words:{zh:"\u6536\u85CF\u8BCD\u6C47",en:"Favorite Words"},touch_setting:{zh:"\u89E6\u5C4F\u8BBE\u7F6E",en:"Touch Setting"},touch_translate_shortcut:{zh:"\u89E6\u5C4F\u7FFB\u8BD1\u5FEB\u6377\u65B9\u5F0F",en:"Touch Translate Shortcut"},touch_tap_0:{zh:"\u7981\u7528",en:"Disable"},touch_tap_2:{zh:"\u53CC\u6307\u8F7B\u89E6",en:"Two finger tap"},touch_tap_3:{zh:"\u4E09\u6307\u8F7B\u89E6",en:"Three finger tap"},touch_tap_4:{zh:"\u56DB\u6307\u8F7B\u89E6",en:"Four finger tap"},translate_blacklist:{zh:"\u7981\u7528\u7FFB\u8BD1\u540D\u5355",en:"Translate Blacklist"},disable_langs:{zh:"\u4E0D\u7FFB\u8BD1\u7684\u8BED\u8A00",en:"Disable Languages"},disable_langs_helper:{zh:"\u6B64\u529F\u80FD\u4F9D\u8D56\u51C6\u786E\u7684\u8BED\u8A00\u68C0\u6D4B\uFF0C\u5EFA\u8BAE\u542F\u7528\u8FDC\u7A0B\u8BED\u8A00\u68C0\u6D4B\u3002",en:"This feature relies on accurate language detection. It is recommended to enable remote language detection."},add_context_menus:{zh:"\u6DFB\u52A0\u53F3\u952E\u83DC\u5355",en:"Add Context Menus"}}; +var UI_LANGS=[["en","English"],["zh","中文"]];var customApiLangs="[\"en\", \"English - English\"],\n[\"zh-CN\", \"Simplified Chinese - \u7B80\u4F53\u4E2D\u6587\"],\n[\"zh-TW\", \"Traditional Chinese - \u7E41\u9AD4\u4E2D\u6587\"],\n[\"ar\", \"Arabic - \u0627\u0644\u0639\u0631\u0628\u064A\u0629\"],\n[\"bg\", \"Bulgarian - \u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438\"],\n[\"ca\", \"Catalan - Catal\xE0\"],\n[\"hr\", \"Croatian - Hrvatski\"],\n[\"cs\", \"Czech - \u010Ce\u0161tina\"],\n[\"da\", \"Danish - Dansk\"],\n[\"nl\", \"Dutch - Nederlands\"],\n[\"fi\", \"Finnish - Suomi\"],\n[\"fr\", \"French - Fran\xE7ais\"],\n[\"de\", \"German - Deutsch\"],\n[\"el\", \"Greek - \u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC\"],\n[\"hi\", \"Hindi - \u0939\u093F\u0928\u094D\u0926\u0940\"],\n[\"hu\", \"Hungarian - Magyar\"],\n[\"id\", \"Indonesian - Indonesia\"],\n[\"it\", \"Italian - Italiano\"],\n[\"ja\", \"Japanese - \u65E5\u672C\u8A9E\"],\n[\"ko\", \"Korean - \uD55C\uAD6D\uC5B4\"],\n[\"ms\", \"Malay - Melayu\"],\n[\"mt\", \"Maltese - Malti\"],\n[\"nb\", \"Norwegian - Norsk Bokm\xE5l\"],\n[\"pl\", \"Polish - Polski\"],\n[\"pt\", \"Portuguese - Portugu\xEAs\"],\n[\"ro\", \"Romanian - Rom\xE2n\u0103\"],\n[\"ru\", \"Russian - \u0420\u0443\u0441\u0441\u043A\u0438\u0439\"],\n[\"sk\", \"Slovak - Sloven\u010Dina\"],\n[\"sl\", \"Slovenian - Sloven\u0161\u010Dina\"],\n[\"es\", \"Spanish - Espa\xF1ol\"],\n[\"sv\", \"Swedish - Svenska\"],\n[\"ta\", \"Tamil - \u0BA4\u0BAE\u0BBF\u0BB4\u0BCD\"],\n[\"te\", \"Telugu - \u0C24\u0C46\u0C32\u0C41\u0C17\u0C41\"],\n[\"th\", \"Thai - \u0E44\u0E17\u0E22\"],\n[\"tr\", \"Turkish - T\xFCrk\xE7e\"],\n[\"uk\", \"Ukrainian - \u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430\"],\n[\"vi\", \"Vietnamese - Ti\u1EBFng Vi\u1EC7t\"],\n";var customApiHelpZH="/// \u81EA\u5B9A\u4E49\u7FFB\u8BD1\u6E90\u63A5\u53E3\u8BF4\u660E\n\n// \u8BF7\u6C42\uFF08Request\uFF09\u6570\u636E\u5C06\u6309\u4E0B\u9762\u89C4\u8303\u53D1\u9001\n{\n url: {{YOUR_URL}},\n method: \"POST\",\n headers: {\n \"Content-type\": \"application/json\",\n \"Authorization\": \"Bearer {{YOUR_KEY}}\",\n },\n body: {\n text: \"\", // \u9700\u8981\u7FFB\u8BD1\u7684\u6587\u5B57\n from: \"\", // \u6E90\u8BED\u8A00\uFF0C\u53EF\u80FD\u4E3A\u7A7A\uFF0C\u8868\u793A\u9700\u8981\u63A5\u53E3\u81EA\u52A8\u8BC6\u522B\u8BED\u8A00\n to: \"\", // \u76EE\u6807\u8BED\u8A00\n }\n}\n\n// \u8FD4\u56DE\uFF08Response\uFF09\u6570\u636E\u9700\u7B26\u5408\u4E0B\u9762\u7684JSON\u89C4\u8303\n{\n text: \"\", // \u7FFB\u8BD1\u540E\u7684\u6587\u5B57\n from: \"\", // \u8BC6\u522B\u7684\u6E90\u8BED\u8A00\n to: \"\", // \u76EE\u6807\u8BED\u8A00\uFF08\u53EF\u9009\uFF09\n}\n\n// \u652F\u6301\u7684\u8BED\u8A00\u4EE3\u7801\u5982\u4E0B\n".concat(customApiLangs,"\n");var customApiHelpEN="/// Custom translation source interface description\n\n// Request data will be sent according to the following specifications\n{\n url: {{YOUR_URL}},\n method: \"POST\",\n headers: {\n \"Content-type\": \"application/json\",\n \"Authorization\": \"Bearer {{YOUR_KEY}}\",\n },\n body: {\n text: \"\", // text to be translated\n from: \"\", // Source language, may be empty\n to: \"\", // Target language\n }\n}\n\n// The returned data must conform to the following JSON specification\n{\n text: \"\", // translated text\n from: \"\", // Recognized source language\n to: \"\", // Target language (optional)\n}\n\n// The supported language codes are as follows\n".concat(customApiLangs,"\n");var I18N={app_name:{zh:"\u7B80\u7EA6\u7FFB\u8BD1",en:"KISS Translator"},translate:{zh:"\u7FFB\u8BD1",en:"Translate"},custom_api_help:{zh:customApiHelpZH,en:customApiHelpEN},translate_alt:{zh:"\u7FFB\u8BD1 (Alt+Q)",en:"Translate (Alt+Q)"},basic_setting:{zh:"\u57FA\u672C\u8BBE\u7F6E",en:"Basic Setting"},rules_setting:{zh:"\u89C4\u5219\u8BBE\u7F6E",en:"Rules Setting"},apis_setting:{zh:"\u63A5\u53E3\u8BBE\u7F6E",en:"Apis Setting"},sync_setting:{zh:"\u540C\u6B65\u8BBE\u7F6E",en:"Sync Setting"},patch_setting:{zh:"\u8865\u4E01\u8BBE\u7F6E",en:"Patch Setting"},patch_setting_help:{zh:"\u9488\u5BF9\u4E00\u4E9B\u7279\u6B8A\u7F51\u7AD9\u7684\u4FEE\u6B63\u811A\u672C\uFF0C\u4EE5\u4FBF\u7FFB\u8BD1\u8F6F\u4EF6\u5F97\u5230\u66F4\u597D\u7684\u5C55\u793A\u6548\u679C\u3002",en:"Corrected scripts for some special websites so that the translation software can get better display results."},inject_webfix:{zh:"\u6CE8\u5165\u4FEE\u590D\u8865\u4E01",en:"Inject Webfix"},about:{zh:"\u5173\u4E8E",en:"About"},about_md:{zh:"README.md",en:"README.en.md"},about_md_local:{zh:"\u8BF7 [\u70B9\u51FB\u8FD9\u91CC](".concat("https://github.com/fishjar/kiss-translator",") \u67E5\u770B\u8BE6\u60C5\u3002"),en:"Please [click here](".concat("https://github.com/fishjar/kiss-translator",") for details.")},ui_lang:{zh:"\u754C\u9762\u8BED\u8A00",en:"Interface Language"},fetch_limit:{zh:"\u6700\u5927\u8BF7\u6C42\u6570\u91CF (1-100)",en:"Maximum Number Of Request (1-100)"},fetch_interval:{zh:"\u8BF7\u6C42\u95F4\u9694\u65F6\u95F4 (0-5000ms)",en:"Request Interval (0-5000ms)"},min_translate_length:{zh:"\u6700\u5C0F\u7FFB\u8BD1\u957F\u5EA6 (1-100)",en:"Min Translate Length (1-100)"},max_translate_length:{zh:"\u6700\u5927\u7FFB\u8BD1\u957F\u5EA6 (100-10000)",en:"Max Translate Length (100-10000)"},num_of_newline_characters:{zh:"\u6362\u884C\u5B57\u7B26\u6570 (1-1000)",en:"Number of Newline Characters (1-1000)"},translate_service:{zh:"\u7FFB\u8BD1\u670D\u52A1",en:"Translate Service"},mouseover_translation:{zh:"\u9F20\u6807\u60AC\u505C\u7FFB\u8BD1",en:"Mouseover translation"},mk_disable:{zh:"\u7981\u7528",en:"Disable"},mk_mouseover:{zh:"\u9F20\u6807\u60AC\u505C",en:"Mouseover"},mk_ctrlKey:{zh:"Control + \u9F20\u6807\u60AC\u505C",en:"Control + Mouseover"},mk_shiftKey:{zh:"Shift + \u9F20\u6807\u60AC\u505C",en:"Shift + Mouseover"},mk_altKey:{zh:"Alt + \u9F20\u6807\u60AC\u505C",en:"Alt + Mouseover"},from_lang:{zh:"\u539F\u6587\u8BED\u8A00",en:"Source Language"},to_lang:{zh:"\u76EE\u6807\u8BED\u8A00",en:"Target Language"},to_lang2:{zh:"\u7B2C\u4E8C\u76EE\u6807\u8BED\u8A00",en:"Target Language 2"},to_lang2_helper:{zh:"\u8BBE\u5B9A\u540E\uFF0C\u4E0E\u76EE\u6807\u8BED\u8A00\u4EA7\u751F\u4E92\u8BD1\u6548\u679C\uFF0C\u4F46\u4F9D\u8D56\u8FDC\u7A0B\u8BED\u8A00\u8BC6\u522B\u3002",en:"After setting, it will produce mutual translation effect with the target language, but it relies on remote language recognition."},text_style:{zh:"\u6587\u5B57\u6837\u5F0F",en:"Text Style"},text_style_alt:{zh:"\u6587\u5B57\u6837\u5F0F (Alt+C)",en:"Text Style (Alt+C)"},bg_color:{zh:"\u6837\u5F0F\u989C\u8272",en:"Style Color"},remain_unchanged:{zh:"\u4FDD\u7559\u4E0D\u53D8",en:"Remain Unchanged"},google_api:{zh:"\u8C37\u6B4C\u7FFB\u8BD1\u63A5\u53E3",en:"Google Translate API"},default_selector:{zh:"\u9ED8\u8BA4\u9009\u62E9\u5668",en:"Default selector"},selector_rules:{zh:"\u9009\u62E9\u5668\u89C4\u5219",en:"Selector Rules"},save:{zh:"\u4FDD\u5B58",en:"Save"},edit:{zh:"\u7F16\u8F91",en:"Edit"},cancel:{zh:"\u53D6\u6D88",en:"Cancel"},delete:{zh:"\u5220\u9664",en:"Delete"},reset:{zh:"\u91CD\u7F6E",en:"Reset"},add:{zh:"\u6DFB\u52A0",en:"Add"},inject_rules:{zh:"\u6CE8\u5165\u8BA2\u9605\u89C4\u5219",en:"Inject Subscribe Rules"},personal_rules:{zh:"\u4E2A\u4EBA\u89C4\u5219",en:"Rules"},subscribe_rules:{zh:"\u8BA2\u9605\u89C4\u5219",en:"Subscribe"},overwrite_subscribe_rules:{zh:"\u8986\u5199\u8BA2\u9605\u89C4\u5219",en:"Overwrite"},subscribe_url:{zh:"\u8BA2\u9605\u5730\u5740",en:"Subscribe URL"},rules_warn_1:{zh:"1\u3001\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u4E00\u76F4\u751F\u6548\uFF0C\u9009\u62E9\u201C\u6CE8\u5165\u8BA2\u9605\u89C4\u5219\u201D\u540E\uFF0C\u201C\u8BA2\u9605\u89C4\u5219\u201D\u624D\u4F1A\u751F\u6548\u3002",en:"1. The \"Personal Rules\" are always in effect. After selecting \"Inject Subscription Rules\", the \"Subscription Rules\" will take effect."},rules_warn_2:{zh:"2\u3001\u201C\u8BA2\u9605\u89C4\u5219\u201D\u7684\u6CE8\u5165\u4F4D\u7F6E\u662F\u5012\u6570\u7B2C\u4E8C\u7684\u4F4D\u7F6E\uFF0C\u56E0\u6B64\u9664\u5168\u5C40\u89C4\u5219(*)\u5916\uFF0C\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u4F18\u5148\u7EA7\u6BD4\u201C\u8BA2\u9605\u89C4\u5219\u201D\u9AD8\uFF0C\u201C\u4E2A\u4EBA\u89C4\u5219\u201D\u586B\u5199\u540C\u6837\u7684\u7F51\u5740\u4F1A\u8986\u76D6\u201D\u8BA2\u9605\u89C4\u5219\u201C\u7684\u6761\u76EE\u3002",en:"2. The injection position of \"Subscription Rules\" is the penultimate position. Therefore, except for the global rules (*), the priority of \"Personal Rules\" is higher than that of \"Subscription Rules\". Filling in the same url in \"Personal Rules\" will overwrite \"Subscription Rules\" entry."},sync_warn:{zh:"\u5982\u679C\u670D\u52A1\u5668\u5B58\u5728\u5176\u4ED6\u5BA2\u6237\u7AEF\u540C\u6B65\u7684\u6570\u636E\uFF0C\u7B2C\u4E00\u6B21\u540C\u6B65\u5C06\u76F4\u63A5\u8986\u76D6\u672C\u5730\u914D\u7F6E\uFF0C\u540E\u9762\u5219\u6839\u636E\u4FEE\u6539\u65F6\u95F4\uFF0C\u65B0\u7684\u8986\u76D6\u65E7\u7684\u3002",en:"If the server has data synchronized by other clients, the first synchronization will directly overwrite the local configuration, and later, according to the modification time, the new one will overwrite the old one."},about_sync_api:{zh:"\u67E5\u770B\u5173\u4E8E\u6570\u636E\u540C\u6B65\u63A5\u53E3\u90E8\u7F72",en:"View About Data Synchronization Interface Deployment"},about_api_proxy:{zh:"\u67E5\u770B\u81EA\u5EFA\u4E00\u4E2A\u7FFB\u8BD1\u63A5\u53E3\u4EE3\u7406",en:"Check out the self-built translation interface proxy"},style_none:{zh:"\u65E0",en:"None"},under_line:{zh:"\u4E0B\u5212\u76F4\u7EBF",en:"Underline"},dot_line:{zh:"\u4E0B\u5212\u70B9\u72B6\u7EBF",en:"Dotted Underline"},dash_line:{zh:"\u4E0B\u5212\u865A\u7EBF",en:"Dashed Underline"},wavy_line:{zh:"\u4E0B\u5212\u6CE2\u6D6A\u7EBF",en:"Wavy Underline"},fuzzy:{zh:"\u6A21\u7CCA",en:"Fuzzy"},highlight:{zh:"\u9AD8\u4EAE",en:"Highlight"},blockquote:{zh:"\u5F15\u7528",en:"Blockquote"},diy_style:{zh:"\u81EA\u5B9A\u4E49\u6837\u5F0F",en:"Custom Style"},diy_style_helper:{zh:"\u9075\u5FAA\u201CCSS\u201D\u7684\u8BED\u6CD5",en:"Follow the syntax of \"CSS\""},setting:{zh:"\u8BBE\u7F6E",en:"Setting"},pattern:{zh:"\u5339\u914D\u7F51\u5740",en:"URL pattern"},pattern_helper:{zh:"1\u3001\u652F\u6301\u661F\u53F7(*)\u901A\u914D\u7B26\u30022\u3001\u591A\u4E2AURL\u7528\u82F1\u6587\u9017\u53F7\u201C,\u201D\u5206\u9694\u3002",en:"1. The asterisk (*) wildcard is supported. 2. Multiple URLs separated by English commas \",\"."},selector_helper:{zh:"1\u3001\u9075\u5FAACSS\u9009\u62E9\u5668\u8BED\u6CD5\u30022\u3001\u7559\u7A7A\u8868\u793A\u91C7\u7528\u5168\u5C40\u8BBE\u7F6E\u30023\u3001\u591A\u4E2ACSS\u9009\u62E9\u5668\u4E4B\u95F4\u7528\u201C;\u201D\u9694\u5F00\u30024\u3001\u201Cshadow root\u201D\u9009\u62E9\u5668\u548C\u5185\u90E8\u9009\u62E9\u5668\u7528\u201C>>>\u201D\u9694\u5F00\u3002",en:"1. Follow CSS selector syntax. 2. Leave blank to adopt the global setting. 3. Separate multiple CSS selectors with \";\". 4. The \"shadow root\" selector and the internal selector are separated by \">>>\"."},translate_switch:{zh:"\u5F00\u542F\u7FFB\u8BD1",en:"Translate Switch"},default_enabled:{zh:"\u9ED8\u8BA4\u5F00\u542F",en:"Enabled"},default_disabled:{zh:"\u9ED8\u8BA4\u5173\u95ED",en:"Disabled"},selector:{zh:"\u9009\u62E9\u5668",en:"Selector"},keep_selector:{zh:"\u4FDD\u7559\u5143\u7D20\u9009\u62E9\u5668",en:"Keep unchanged selector"},keep_selector_helper:{zh:"1\u3001\u9075\u5FAACSS\u9009\u62E9\u5668\u8BED\u6CD5\u30022\u3001\u7559\u7A7A\u8868\u793A\u91C7\u7528\u5168\u5C40\u8BBE\u7F6E\u3002",en:"1. Follow CSS selector syntax. 2. Leave blank to adopt the global setting."},root_selector:{zh:"\u6839\u9009\u62E9\u5668",en:"Root Selector"},fixer_function:{zh:"\u4FEE\u590D\u51FD\u6570",en:"Fixer Function"},import:{zh:"\u5BFC\u5165",en:"Import"},export:{zh:"\u5BFC\u51FA",en:"Export"},error_cant_be_blank:{zh:"\u4E0D\u80FD\u4E3A\u7A7A",en:"Can not be blank"},error_duplicate_values:{zh:"\u5B58\u5728\u91CD\u590D\u7684\u503C",en:"There are duplicate values"},error_wrong_file_type:{zh:"\u9519\u8BEF\u7684\u6587\u4EF6\u7C7B\u578B",en:"Wrong file type"},error_fetch_url:{zh:"\u8BF7\u68C0\u67E5url\u5730\u5740\u662F\u5426\u6B63\u786E\u6216\u7A0D\u540E\u518D\u8BD5\u3002",en:"Please check if the url address is correct or try again later."},deepl_api:{zh:"DeepL \u63A5\u53E3",en:"DeepL API"},deepl_key:{zh:"DeepL \u5BC6\u94A5",en:"DeepL Key"},openai_api:{zh:"OpenAI \u63A5\u53E3",en:"OpenAI API"},openai_key:{zh:"OpenAI \u5BC6\u94A5",en:"OpenAI Key"},openai_model:{zh:"OpenAI \u6A21\u578B",en:"OpenAI Model"},openai_prompt:{zh:"OpenAI \u63D0\u793A\u8BCD",en:"OpenAI Prompt"},if_clear_cache:{zh:"\u662F\u5426\u6E05\u9664\u7F13\u5B58",en:"Whether clear cache"},clear_cache_never:{zh:"\u4E0D\u6E05\u9664\u7F13\u5B58",en:"Never clear cache"},clear_cache_restart:{zh:"\u91CD\u542F\u6D4F\u89C8\u5668\u65F6\u6E05\u9664\u7F13\u5B58",en:"Clear cache when restarting browser"},data_sync_type:{zh:"\u6570\u636E\u540C\u6B65\u65B9\u5F0F",en:"Data Sync Type"},data_sync_url:{zh:"\u6570\u636E\u540C\u6B65\u63A5\u53E3",en:"Data Sync API"},data_sync_user:{zh:"\u6570\u636E\u540C\u6B65\u8D26\u6237",en:"Data Sync User"},data_sync_key:{zh:"\u6570\u636E\u540C\u6B65\u5BC6\u94A5",en:"Data Sync Key"},sync_now:{zh:"\u7ACB\u5373\u540C\u6B65",en:"Sync Now"},sync_success:{zh:"\u540C\u6B65\u6210\u529F\uFF01",en:"Sync Success"},sync_failed:{zh:"\u540C\u6B65\u5931\u8D25\uFF01",en:"Sync Error"},error_got_some_wrong:{zh:"\u62B1\u6B49\uFF0C\u51FA\u9519\u4E86\uFF01",en:"Sorry, something went wrong!"},error_sync_setting:{zh:"\u60A8\u7684\u540C\u6B65\u7C7B\u578B\u5FC5\u987B\u4E3A\u201CKISS-Worker\u201D\uFF0C\u4E14\u9700\u586B\u5199\u5B8C\u6574",en:"Your sync type must be \"KISS-Worker\" and must be filled in completely"},click_test:{zh:"\u70B9\u51FB\u6D4B\u8BD5",en:"Click Test"},test_success:{zh:"\u6D4B\u8BD5\u6210\u529F",en:"Test success"},test_failed:{zh:"\u6D4B\u8BD5\u5931\u8D25",en:"Test failed"},clear_all_cache_now:{zh:"\u7ACB\u5373\u6E05\u9664\u5168\u90E8\u7F13\u5B58",en:"Clear all cache now"},clear_cache:{zh:"\u6E05\u9664\u7F13\u5B58",en:"Clear Cache"},clear_success:{zh:"\u6E05\u9664\u6210\u529F",en:"Clear success"},clear_failed:{zh:"\u6E05\u9664\u5931\u8D25",en:"Clear failed"},share:{zh:"\u5206\u4EAB",en:"Share"},clear_all:{zh:"\u6E05\u7A7A",en:"Clear All"},help:{zh:"\u6C42\u52A9",en:"Help"},restore_default:{zh:"\u6062\u590D\u9ED8\u8BA4",en:"Restore Default"},shortcuts_setting:{zh:"\u5FEB\u6377\u952E\u8BBE\u7F6E",en:"Shortcuts Setting"},toggle_translate_shortcut:{zh:"\"\u5F00\u542F\u7FFB\u8BD1\"\u5FEB\u6377\u952E",en:"\"Toggle Translate\" Shortcut"},toggle_style_shortcut:{zh:"\"\u5207\u6362\u6837\u5F0F\"\u5FEB\u6377\u952E",en:"\"Toggle Style\" Shortcut"},toggle_popup_shortcut:{zh:"\"\u6253\u5F00\u5F39\u7A97\"\u5FEB\u6377\u952E",en:"\"Open Popup\" Shortcut"},open_setting_shortcut:{zh:"\"\u6253\u5F00\u8BBE\u7F6E\"\u5FEB\u6377\u952E",en:"\"Open Setting\" Shortcut"},hide_fab_button:{zh:"\u9690\u85CF\u60AC\u6D6E\u6309\u94AE",en:"Hide Fab Button"},hide_tran_button:{zh:"\u9690\u85CF\u7FFB\u8BD1\u6309\u94AE",en:"Hide Translate Button"},show:{zh:"\u663E\u793A",en:"Show"},hide:{zh:"\u9690\u85CF",en:"Hide"},save_rule:{zh:"\u4FDD\u5B58\u89C4\u5219",en:"Save Rule"},global_rule:{zh:"\u5168\u5C40\u89C4\u5219",en:"Global Rule"},input_translate:{zh:"\u8F93\u5165\u6846\u7FFB\u8BD1",en:"Input Box Translation"},use_input_box_translation:{zh:"\u542F\u7528\u8F93\u5165\u6846\u7FFB\u8BD1",en:"Input Box Translation"},input_selector:{zh:"\u8F93\u5165\u6846\u9009\u62E9\u5668",en:"Input Selector"},input_selector_helper:{zh:"\u7528\u4E8E\u8F93\u5165\u6846\u7FFB\u8BD1\u3002",en:"Used for input box translation."},trigger_trans_shortcut:{zh:"\u89E6\u53D1\u7FFB\u8BD1\u5FEB\u6377\u952E",en:"Trigger Translation Shortcut Keys"},trigger_trans_shortcut_help:{zh:"\u9ED8\u8BA4\u4E3A\u5355\u51FB\u201CAltLeft+KeyI\u201D",en:"Default is \"AltLeft+KeyI\""},shortcut_press_count:{zh:"\u5FEB\u6377\u952E\u8FDE\u51FB\u6B21\u6570",en:"Shortcut Press Number"},combo_timeout:{zh:"\u8FDE\u51FB\u8D85\u65F6\u65F6\u95F4 (10-1000ms)",en:"Combo Timeout (10-1000ms)"},input_trans_start_sign:{zh:"\u7FFB\u8BD1\u8D77\u59CB\u6807\u8BC6",en:"Translation Start Sign"},input_trans_start_sign_help:{zh:"\u6807\u8BC6\u540E\u9762\u53EF\u4EE5\u52A0\u76EE\u6807\u8BED\u8A00\u4EE3\u7801\uFF0C\u5982\uFF1A \u201C/en \u4F60\u597D\u201D\u3001\u201C/zh hello\u201D",en:"The target language code can be added after the sign, such as: \"/en \u4F60\u597D\", \"/zh hello\""},detect_lang_remote:{zh:"\u8FDC\u7A0B\u8BED\u8A00\u68C0\u6D4B",en:"Remote language detection"},detect_lang_remote_help:{zh:"\u542F\u7528\u540E\u68C0\u6D4B\u51C6\u786E\u5EA6\u589E\u52A0\uFF0C\u4F46\u4F1A\u964D\u4F4E\u7FFB\u8BD1\u901F\u5EA6\uFF0C\u8BF7\u914C\u60C5\u5F00\u542F",en:"After enabling, the detection accuracy will increase, but it will reduce the translation speed. Please enable it as appropriate."},disable:{zh:"\u7981\u7528",en:"Disable"},enable:{zh:"\u542F\u7528",en:"Enable"},selection_translate:{zh:"\u5212\u8BCD\u7FFB\u8BD1",en:"Selection Translate"},toggle_selection_translate:{zh:"\u542F\u7528\u5212\u8BCD\u7FFB\u8BD1",en:"Use Selection Translate"},trigger_tranbox_shortcut:{zh:"\u663E\u793A\u7FFB\u8BD1\u6846/\u7FFB\u8BD1\u9009\u4E2D\u6587\u5B57\u5FEB\u6377\u952E",en:"Open Translate Popup/Translate Selected Shortcut"},tranbtn_offset_x:{zh:"\u7FFB\u8BD1\u6309\u94AE\u504F\u79FBX\uFF080-100\uFF09",en:"Translate Button Offset X (0-100)"},tranbtn_offset_y:{zh:"\u7FFB\u8BD1\u6309\u94AE\u504F\u79FBY\uFF080-100\uFF09",en:"Translate Button Offset Y (0-100)"},translated_text:{zh:"\u8BD1\u6587",en:"Translated Text"},original_text:{zh:"\u539F\u6587",en:"Original Text"},favorite_words:{zh:"\u6536\u85CF\u8BCD\u6C47",en:"Favorite Words"},touch_setting:{zh:"\u89E6\u5C4F\u8BBE\u7F6E",en:"Touch Setting"},touch_translate_shortcut:{zh:"\u89E6\u5C4F\u7FFB\u8BD1\u5FEB\u6377\u65B9\u5F0F",en:"Touch Translate Shortcut"},touch_tap_0:{zh:"\u7981\u7528",en:"Disable"},touch_tap_2:{zh:"\u53CC\u6307\u8F7B\u89E6",en:"Two finger tap"},touch_tap_3:{zh:"\u4E09\u6307\u8F7B\u89E6",en:"Three finger tap"},touch_tap_4:{zh:"\u56DB\u6307\u8F7B\u89E6",en:"Four finger tap"},translate_blacklist:{zh:"\u7981\u7528\u7FFB\u8BD1\u540D\u5355",en:"Translate Blacklist"},disable_langs:{zh:"\u4E0D\u7FFB\u8BD1\u7684\u8BED\u8A00",en:"Disable Languages"},disable_langs_helper:{zh:"\u6B64\u529F\u80FD\u4F9D\u8D56\u51C6\u786E\u7684\u8BED\u8A00\u68C0\u6D4B\uFF0C\u5EFA\u8BAE\u542F\u7528\u8FDC\u7A0B\u8BED\u8A00\u68C0\u6D4B\u3002",en:"This feature relies on accurate language detection. It is recommended to enable remote language detection."},add_context_menus:{zh:"\u6DFB\u52A0\u53F3\u952E\u83DC\u5355",en:"Add Context Menus"},mulkeys_help:{zh:"\u652F\u6301\u82F1\u6587\u9017\u53F7\u9694\u5F00\u591A\u4E2AKEY\u8F6E\u5BFB\u8C03\u7528\u3002",en:"Supports multiple KEY round calling calls separated by English commas."}}; ;// CONCATENATED MODULE: ./src/config/index.js var _OPT_LANGS_SPECIAL,_DEFAULT_TRANS_APIS,_DEFAULT_SHORTCUTS;var STOKEY_MSAUTH="".concat(APP_NAME,"_msauth");var STOKEY_BDAUTH="".concat(APP_NAME,"_bdauth");var config_STOKEY_SETTING="".concat(APP_NAME,"_setting");var config_STOKEY_RULES="".concat(APP_NAME,"_rules");var STOKEY_WFRULES="".concat(APP_NAME,"_webfix_rules");var STOKEY_WORDS="".concat(APP_NAME,"_words");var config_STOKEY_SYNC="".concat(APP_NAME,"_sync");var config_STOKEY_FAB="".concat(APP_NAME,"_fab");var config_STOKEY_RULESCACHE_PREFIX="".concat(APP_NAME,"_rulescache_");var STOKEY_WEBFIXCACHE_PREFIX="".concat(APP_NAME,"_webfixcache_");var CMD_TOGGLE_TRANSLATE="toggleTranslate";var CMD_TOGGLE_STYLE="toggleStyle";var CMD_OPEN_OPTIONS="openOptions";var CMD_OPEN_TRANBOX="openTranbox";var CLIENT_WEB="web";var CLIENT_CHROME="chrome";var CLIENT_EDGE="edge";var CLIENT_FIREFOX="firefox";var CLIENT_USERSCRIPT="userscript";var CLIENT_EXTS=[CLIENT_CHROME,CLIENT_EDGE,CLIENT_FIREFOX];var KV_RULES_KEY="kiss-rules.json";var KV_WFRULES_KEY="kiss-webfix.json";var KV_WORDS_KEY="kiss-words.json";var KV_RULES_SHARE_KEY="kiss-rules-share.json";var KV_SETTING_KEY="kiss-setting.json";var KV_SALT_SYNC="KISS-Translator-SYNC";var KV_SALT_SHARE="KISS-Translator-SHARE";var CACHE_NAME="".concat(APP_NAME,"_cache");var MSG_FETCH="fetch";var config_MSG_FETCH_LIMIT="fetch_limit";var config_MSG_FETCH_CLEAR="fetch_clear";var MSG_OPEN_OPTIONS="open_options";var MSG_SAVE_RULE="save_rule";var MSG_TRANS_TOGGLE="trans_toggle";var MSG_TRANS_TOGGLE_STYLE="trans_toggle_style";var MSG_OPEN_TRANBOX="open_tranbox";var MSG_TRANS_GETRULE="trans_getrule";var MSG_TRANS_PUTRULE="trans_putrule";var MSG_TRANS_CURRULE="trans_currule";var MSG_CONTEXT_MENUS="context_menus";var THEME_LIGHT="light";var THEME_DARK="dark";var URL_KISS_WORKER="https://github.com/fishjar/kiss-worker";var URL_KISS_PROXY="https://github.com/fishjar/kiss-proxy";var URL_KISS_RULES="https://github.com/fishjar/kiss-rules";var URL_KISS_RULES_NEW_ISSUE="https://github.com/fishjar/kiss-rules/issues/new";var URL_RAW_PREFIX="https://raw.githubusercontent.com/fishjar/kiss-translator/master";var URL_CACHE_TRAN="https://".concat(APP_LCNAME,"/translate");var URL_MICROSOFT_TRAN="https://api-edge.cognitive.microsofttranslator.com/translate";var URL_MICROSOFT_AUTH="https://edge.microsoft.com/translate/auth";var config_URL_BAIDU_LANGDETECT="https://fanyi.baidu.com/langdetect";var URL_BAIDU_WEB="https://fanyi.baidu.com/";var URL_BAIDU_TRAN="https://fanyi.baidu.com/v2transapi";var URL_DEEPLFREE_TRAN="https://www2.deepl.com/jsonrpc";var config_URL_TENCENT_TRANSMART="https://transmart.qq.com/api/imt";var OPT_TRANS_GOOGLE="Google";var OPT_TRANS_MICROSOFT="Microsoft";var OPT_TRANS_DEEPL="DeepL";var OPT_TRANS_DEEPLX="DeepLX";var OPT_TRANS_DEEPLFREE="DeepLFree";var OPT_TRANS_BAIDU="Baidu";var OPT_TRANS_TENCENT="Tencent";var OPT_TRANS_OPENAI="OpenAI";var OPT_TRANS_GEMINI="Gemini";var OPT_TRANS_CLOUDFLAREAI="CloudflareAI";var OPT_TRANS_CUSTOMIZE="Custom";var OPT_TRANS_ALL=[OPT_TRANS_GOOGLE,OPT_TRANS_MICROSOFT,OPT_TRANS_DEEPL,OPT_TRANS_DEEPLFREE,OPT_TRANS_DEEPLX,OPT_TRANS_BAIDU,OPT_TRANS_TENCENT,OPT_TRANS_OPENAI,OPT_TRANS_GEMINI,OPT_TRANS_CLOUDFLAREAI,OPT_TRANS_CUSTOMIZE];var OPT_LANGS_TO=[["en","English - English"],["zh-CN","Simplified Chinese - 简体中文"],["zh-TW","Traditional Chinese - 繁體中文"],["ar","Arabic - العربية"],["bg","Bulgarian - Български"],["ca","Catalan - Català"],["hr","Croatian - Hrvatski"],["cs","Czech - Čeština"],["da","Danish - Dansk"],["nl","Dutch - Nederlands"],["fi","Finnish - Suomi"],["fr","French - Français"],["de","German - Deutsch"],["el","Greek - Ελληνικά"],["hi","Hindi - हिन्दी"],["hu","Hungarian - Magyar"],["id","Indonesian - Indonesia"],["it","Italian - Italiano"],["ja","Japanese - 日本語"],["ko","Korean - 한국어"],["ms","Malay - Melayu"],["mt","Maltese - Malti"],["nb","Norwegian - Norsk Bokmål"],["pl","Polish - Polski"],["pt","Portuguese - Português"],["ro","Romanian - Română"],["ru","Russian - Русский"],["sk","Slovak - Slovenčina"],["sl","Slovenian - Slovenščina"],["es","Spanish - Español"],["sv","Swedish - Svenska"],["ta","Tamil - தமிழ்"],["te","Telugu - తెలుగు"],["th","Thai - ไทย"],["tr","Turkish - Türkçe"],["uk","Ukrainian - Українська"],["vi","Vietnamese - Tiếng Việt"]];var OPT_LANGS_FROM=[["auto","Auto-detect"]].concat(OPT_LANGS_TO);var OPT_LANGS_SPECIAL=(_OPT_LANGS_SPECIAL={},(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_GOOGLE,new Map(OPT_LANGS_FROM.map(function(_ref){var _ref2=(0,slicedToArray/* default */.Z)(_ref,1),key=_ref2[0];return[key,key];}))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_MICROSOFT,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref3){var _ref4=(0,slicedToArray/* default */.Z)(_ref3,1),key=_ref4[0];return[key,key];})),[["auto",""],["zh-CN","zh-Hans"],["zh-TW","zh-Hant"]]))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_DEEPL,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref5){var _ref6=(0,slicedToArray/* default */.Z)(_ref5,1),key=_ref6[0];return[key,key.toUpperCase()];})),[["auto",""],["zh-CN","ZH"],["zh-TW","ZH"]]))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_DEEPLFREE,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref7){var _ref8=(0,slicedToArray/* default */.Z)(_ref7,1),key=_ref8[0];return[key,key.toUpperCase()];})),[["auto","auto"],["zh-CN","ZH"],["zh-TW","ZH"]]))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_DEEPLX,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref9){var _ref10=(0,slicedToArray/* default */.Z)(_ref9,1),key=_ref10[0];return[key,key.toUpperCase()];})),[["auto",""],["zh-CN","ZH"],["zh-TW","ZH"]]))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_BAIDU,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref11){var _ref12=(0,slicedToArray/* default */.Z)(_ref11,1),key=_ref12[0];return[key,key];})),[["zh-CN","zh"],["zh-TW","cht"],["ar","ara"],["bg","bul"],["ca","cat"],["hr","hrv"],["da","dan"],["fi","fin"],["fr","fra"],["hi","mai"],["ja","jp"],["ko","kor"],["ms","may"],["mt","mlt"],["nb","nor"],["ro","rom"],["ru","ru"],["sl","slo"],["es","spa"],["sv","swe"],["ta","tam"],["te","tel"],["uk","ukr"],["vi","vie"]]))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_TENCENT,new Map([["auto","auto"],["zh-CN","zh"],["zh-TW","zh"],["en","en"],["ar","ar"],["de","de"],["ru","ru"],["fr","fr"],["fi","fil"],["ko","ko"],["ms","ms"],["pt","pt"],["ja","ja"],["th","th"],["tr","tr"],["es","es"],["it","it"],["hi","hi"],["id","id"],["vi","vi"]])),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_OPENAI,new Map(OPT_LANGS_FROM.map(function(_ref13){var _ref14=(0,slicedToArray/* default */.Z)(_ref13,2),key=_ref14[0],val=_ref14[1];return[key,val.split(" - ")[0]];}))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_GEMINI,new Map(OPT_LANGS_FROM.map(function(_ref15){var _ref16=(0,slicedToArray/* default */.Z)(_ref15,2),key=_ref16[0],val=_ref16[1];return[key,val.split(" - ")[0]];}))),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_CLOUDFLAREAI,new Map([["auto",""],["zh-CN","chinese"],["zh-TW","chinese"],["en","english"],["ar","arabic"],["de","german"],["ru","russian"],["fr","french"],["pt","portuguese"],["ja","japanese"],["es","spanish"],["hi","hindi"]])),(0,defineProperty/* default */.Z)(_OPT_LANGS_SPECIAL,OPT_TRANS_CUSTOMIZE,new Map([].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_FROM.map(function(_ref17){var _ref18=(0,slicedToArray/* default */.Z)(_ref17,1),key=_ref18[0];return[key,key];})),[["auto",""]]))),_OPT_LANGS_SPECIAL);var OPT_LANGS_LIST=OPT_LANGS_TO.map(function(_ref19){var _ref20=(0,slicedToArray/* default */.Z)(_ref19,1),lang=_ref20[0];return lang;});var config_OPT_LANGS_BAIDU=new Map(Array.from(OPT_LANGS_SPECIAL[OPT_TRANS_BAIDU].entries()).map(function(_ref21){var _ref22=(0,slicedToArray/* default */.Z)(_ref21,2),k=_ref22[0],v=_ref22[1];return[v,k];}));var config_OPT_LANGS_TENCENT=new Map(Array.from(OPT_LANGS_SPECIAL[OPT_TRANS_TENCENT].entries()).map(function(_ref23){var _ref24=(0,slicedToArray/* default */.Z)(_ref23,2),k=_ref24[0],v=_ref24[1];return[v,k];}));config_OPT_LANGS_TENCENT.set("zh","zh-CN");var OPT_STYLE_NONE="style_none";// 无 var OPT_STYLE_LINE="under_line";// 下划线 @@ -43403,7 +43403,7 @@ var PROMPT_PLACE_TO="{{to}}";// 占位符 var PROMPT_PLACE_TEXT="{{text}}";// 占位符 var DEFAULT_COLOR="#209CEE";// 默认高亮背景色/线条颜色 // 全局规则 -var config_GLOBLA_RULE={pattern:"*",selector:DEFAULT_SELECTOR,translator:OPT_TRANS_MICROSOFT,fromLang:"auto",toLang:"zh-CN",textStyle:OPT_STYLE_DASHLINE,transOpen:"false",bgColor:"",textDiyStyle:""};// 输入框翻译 +var config_GLOBLA_RULE={pattern:"*",selector:DEFAULT_SELECTOR,keepSelector:DEFAULT_KEEP_SELECTOR,translator:OPT_TRANS_MICROSOFT,fromLang:"auto",toLang:"zh-CN",textStyle:OPT_STYLE_DASHLINE,transOpen:"false",bgColor:"",textDiyStyle:""};// 输入框翻译 var OPT_INPUT_TRANS_SIGNS=["/","//","\\","\\\\",">",">>"];var DEFAULT_INPUT_SHORTCUT=["AltLeft","KeyI"];var DEFAULT_INPUT_RULE={transOpen:true,translator:OPT_TRANS_MICROSOFT,fromLang:"auto",toLang:"en",triggerShortcut:DEFAULT_INPUT_SHORTCUT,triggerCount:1,triggerTime:200,transSign:OPT_INPUT_TRANS_SIGNS[0]};// 划词翻译 var DEFAULT_TRANBOX_SHORTCUT=["AltLeft","KeyS"];var DEFAULT_TRANBOX_SETTING={transOpen:true,translator:OPT_TRANS_MICROSOFT,fromLang:"auto",toLang:"zh-CN",toLang2:"en",tranboxShortcut:DEFAULT_TRANBOX_SHORTCUT,btnOffsetX:10,btnOffsetY:10,hideTranBtn:false};// 订阅列表 var config_DEFAULT_SUBRULES_LIST=[{url:"https://fishjar.github.io/kiss-rules/kiss-rules.json",selected:false},{url:"https://fishjar.github.io/kiss-rules/kiss-rules-on.json",selected:true},{url:"https://fishjar.github.io/kiss-rules/kiss-rules-off.json",selected:false}];// 翻译接口 @@ -44135,7 +44135,8 @@ var id=1e4*Math.round(1e4*Math.random());var genDeeplFree=function genDeeplFree( */var _bdAuth=function _bdAuth(){var store;return/*#__PURE__*/asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(){var now;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:now=Date.now();// 查询内存缓存 if(!(store&&store.exp>now)){_context2.next=3;break;}return _context2.abrupt("return",store);case 3:_context2.next=5;return getBdauth();case 5:store=_context2.sent;if(!(store&&store.exp>now)){_context2.next=8;break;}return _context2.abrupt("return",store);case 8:_context2.next=10;return getToken();case 10:store=_context2.sent;_context2.next=13;return setBdauth(store);case 13:return _context2.abrupt("return",store);case 14:case"end":return _context2.stop();}},_callee2);}));};var bdAuth=_bdAuth();var genBaidu=/*#__PURE__*/function(){var _ref4=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee3(_ref3){var text,from,to,_yield$bdAuth,token,gtk,sign,data,input,init;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:text=_ref3.text,from=_ref3.from,to=_ref3.to;_context3.next=3;return bdAuth();case 3:_yield$bdAuth=_context3.sent;token=_yield$bdAuth.token;gtk=_yield$bdAuth.gtk;sign=getSign(text,gtk);data={from:from,to:to,query:text,simple_means_flag:3,sign:sign,token:token,domain:"common",ts:Date.now()};input="".concat(URL_BAIDU_TRAN,"?from=").concat(from,"&to=").concat(to);init={headers:{"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},method:"POST",body:query_string.stringify(data)};return _context3.abrupt("return",[input,init]);case 11:case"end":return _context3.stop();}},_callee3);}));return function genBaidu(_x){return _ref4.apply(this,arguments);};}(); ;// CONCATENATED MODULE: ./src/libs/req.js -/** +var keyMap=new Map();// 轮询key +var keyPick=function keyPick(translator){var _keyMap$get;var key=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";var keys=key.split(",").map(function(item){return item.trim();}).filter(Boolean);if(keys.length===0){return"";}var preIndex=(_keyMap$get=keyMap.get(translator))!==null&&_keyMap$get!==void 0?_keyMap$get:-1;var curIndex=(preIndex+1)%keys.length;keyMap.set(translator,curIndex);return keys[curIndex];};/** * 构造缓存 request * @param {*} request * @returns @@ -44147,7 +44148,7 @@ parts:[{text:prompt}]}]};var input="".concat(url,"/").concat(model,":generateCon * 构造翻译接口 request * @param {*} * @returns - */var newTransReq=function newTransReq(_ref12,apiSetting){var translator=_ref12.translator,text=_ref12.text,from=_ref12.from,to=_ref12.to;var args=_objectSpread2({text:text,from:from,to:to},apiSetting);switch(translator){case OPT_TRANS_GOOGLE:return genGoogle(args);case OPT_TRANS_MICROSOFT:return genMicrosoft(args);case OPT_TRANS_DEEPL:return genDeepl(args);case OPT_TRANS_DEEPLFREE:return genDeeplFree(args);case OPT_TRANS_DEEPLX:return genDeeplX(args);case OPT_TRANS_BAIDU:return genBaidu(args);case OPT_TRANS_TENCENT:return genTencent(args);case OPT_TRANS_OPENAI:return genOpenAI(args);case OPT_TRANS_GEMINI:return genGemini(args);case OPT_TRANS_CLOUDFLAREAI:return genCloudflareAI(args);case OPT_TRANS_CUSTOMIZE:return genCustom(args);default:throw new Error("[trans] translator: ".concat(translator," not support"));}}; + */var newTransReq=function newTransReq(_ref12,apiSetting){var translator=_ref12.translator,text=_ref12.text,from=_ref12.from,to=_ref12.to;var args=_objectSpread2({text:text,from:from,to:to},apiSetting);switch(translator){case OPT_TRANS_DEEPL:case OPT_TRANS_OPENAI:case OPT_TRANS_GEMINI:case OPT_TRANS_CLOUDFLAREAI:args.key=keyPick(translator,args.key);break;default:}switch(translator){case OPT_TRANS_GOOGLE:return genGoogle(args);case OPT_TRANS_MICROSOFT:return genMicrosoft(args);case OPT_TRANS_DEEPL:return genDeepl(args);case OPT_TRANS_DEEPLFREE:return genDeeplFree(args);case OPT_TRANS_DEEPLX:return genDeeplX(args);case OPT_TRANS_BAIDU:return genBaidu(args);case OPT_TRANS_TENCENT:return genTencent(args);case OPT_TRANS_OPENAI:return genOpenAI(args);case OPT_TRANS_GEMINI:return genGemini(args);case OPT_TRANS_CLOUDFLAREAI:return genCloudflareAI(args);case OPT_TRANS_CUSTOMIZE:return genCustom(args);default:throw new Error("[trans] translator: ".concat(translator," not support"));}}; ;// CONCATENATED MODULE: ./src/libs/fetch.js var fetch_excluded=["response","responseHeaders","status","statusText"],fetch_excluded2=["useCache","usePool","transOpts","apiSetting"];/** * 油猴脚本的请求封装 @@ -47113,7 +47114,7 @@ var web_n = {}; return t.length === e && "." !== t && ".." !== t; }; }, - te = "object" === ("undefined" == typeof process ? "undefined" : Nt(process)) && process ? "object" === Nt(({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.15","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"})) && ({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.15","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"}) && ({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.15","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"}).__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix"; + te = "object" === ("undefined" == typeof process ? "undefined" : Nt(process)) && process ? "object" === Nt(({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.16","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"})) && ({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.16","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"}) && ({"NODE_ENV":"production","PUBLIC_URL":"","WDS_SOCKET_HOST":undefined,"WDS_SOCKET_PATH":undefined,"WDS_SOCKET_PORT":undefined,"FAST_REFRESH":true,"REACT_APP_CLIENT":"userscript","REACT_APP_NAME":"KISS Translator","REACT_APP_NAME_CN":"简约翻译","REACT_APP_VERSION":"1.7.16","REACT_APP_HOMEPAGE":"https://github.com/fishjar/kiss-translator","REACT_APP_OPTIONSPAGE":"https://fishjar.github.io/kiss-translator/options.html","REACT_APP_OPTIONSPAGE2":"https://kiss-translator.rayjar.com/options","REACT_APP_OPTIONSPAGE_DEV":"http://localhost:3000/options.html","REACT_APP_LOGOURL":"https://fishjar.github.io/kiss-translator/images/logo192.png","REACT_APP_LOGOURL2":"https://kiss-translator.rayjar.com/images/logo192.png","REACT_APP_RULESURL":"https://fishjar.github.io/kiss-rules/kiss-rules.json","REACT_APP_RULESURL_ON":"https://fishjar.github.io/kiss-rules/kiss-rules-on.json","REACT_APP_RULESURL_OFF":"https://fishjar.github.io/kiss-rules/kiss-rules-off.json","REACT_APP_WEBFIXURL":"https://fishjar.github.io/kiss-rules/kiss-webfix.json","REACT_APP_VERSIONFILE":"https://fishjar.github.io/kiss-translator/version.txt","REACT_APP_VERSIONFILE2":"https://kiss-translator.rayjar.com/version.txt","REACT_APP_USERSCRIPT_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator.user.js","REACT_APP_USERSCRIPT_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL":"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js","REACT_APP_USERSCRIPT_IOS_DOWNLOADURL2":"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js"}).__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix"; It.sep = "win32" === te ? "\\" : "/"; var ee = Symbol("globstar **"); It.GLOBSTAR = ee; @@ -58096,8 +58097,11 @@ var _fixerMap;/** * @param {*} url * @returns */var loadOrFetchWebfix=/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(url){var sites;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=3;return getWebfix(url);case 3:sites=_context2.sent;if(!(sites!==null&&sites!==void 0&&sites.length)){_context2.next=6;break;}return _context2.abrupt("return",sites);case 6:return _context2.abrupt("return",webfix_syncWebfix(url));case 9:_context2.prev=9;_context2.t0=_context2["catch"](0);console.log("[load webfix]",_context2.t0.message);return _context2.abrupt("return",DEFAULT_SITES);case 13:case"end":return _context2.stop();}},_callee2,null,[[0,9]]);}));return function loadOrFetchWebfix(_x2){return _ref2.apply(this,arguments);};}();/** - * 匹配站点 - */function runWebfix(_x3){return _runWebfix.apply(this,arguments);}function _runWebfix(){_runWebfix=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref3){var injectWebfix,href,userSites,subSites,sites,i,site;return _regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:injectWebfix=_ref3.injectWebfix;_context3.prev=1;if(injectWebfix){_context3.next=4;break;}return _context3.abrupt("return");case 4:href=document.location.href;_context3.next=7;return getWebfixRulesWithDefault();case 7:userSites=_context3.sent;_context3.next=10;return loadOrFetchWebfix("https://fishjar.github.io/kiss-rules/kiss-webfix.json");case 10:subSites=_context3.sent;sites=[].concat(_toConsumableArray(userSites),_toConsumableArray(subSites));i=0;case 13:if(!(iinterval)){_context4.next=15;break;}_context4.next=11;re * @param {*} rules * @param {string} href * @returns - */var matchRule=/*#__PURE__*/(/* unused pure expression or super */ null && (function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(href,_ref){var _rule$selector;var _ref$injectRules,injectRules,_ref$subrulesList,subrulesList,_ref$owSubrule,owSubrule,rules,selectedSub,mixRule,subRules,rule,globalRule,_rule$bgColor,_rule$textDiyStyle;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_ref$injectRules=_ref.injectRules,injectRules=_ref$injectRules===void 0?true:_ref$injectRules,_ref$subrulesList=_ref.subrulesList,subrulesList=_ref$subrulesList===void 0?DEFAULT_SUBRULES_LIST:_ref$subrulesList,_ref$owSubrule=_ref.owSubrule,owSubrule=_ref$owSubrule===void 0?DEFAULT_OW_RULE:_ref$owSubrule;_context.next=3;return getRulesWithDefault();case 3:rules=_context.sent;if(!injectRules){_context.next=20;break;}_context.prev=5;selectedSub=subrulesList.find(function(item){return item.selected;});if(!(selectedSub!==null&&selectedSub!==void 0&&selectedSub.url)){_context.next=15;break;}mixRule={};Object.entries(owSubrule).filter(function(_ref3){var _ref4=_slicedToArray(_ref3,2),key=_ref4[0],val=_ref4[1];if(owSubrule.textStyle===REMAIN_KEY&&(key==="bgColor"||key==="textDiyStyle")){return false;}return val!==REMAIN_KEY;}).forEach(function(_ref5){var _ref6=_slicedToArray(_ref5,2),key=_ref6[0],val=_ref6[1];mixRule[key]=val;});_context.next=12;return loadOrFetchSubRules(selectedSub.url);case 12:subRules=_context.sent;subRules=subRules.map(function(item){return _objectSpread(_objectSpread({},item),mixRule);});rules.splice.apply(rules,[-1,0].concat(_toConsumableArray(subRules)));case 15:_context.next=20;break;case 17:_context.prev=17;_context.t0=_context["catch"](5);console.log("[load injectRules]",_context.t0);case 20:rule=rules.find(function(r){return r.pattern.split(",").some(function(p){return isMatch(href,p.trim());});});globalRule=rules.find(function(r){return r.pattern===GLOBAL_KEY;})||GLOBLA_RULE;if(rule){_context.next=24;break;}return _context.abrupt("return",globalRule);case 24:rule.selector=((_rule$selector=rule.selector)===null||_rule$selector===void 0?void 0:_rule$selector.trim())||globalRule.selector;if(rule.textStyle===GLOBAL_KEY){rule.textStyle=globalRule.textStyle;rule.bgColor=globalRule.bgColor;rule.textDiyStyle=globalRule.textDiyStyle;}else{rule.bgColor=((_rule$bgColor=rule.bgColor)===null||_rule$bgColor===void 0?void 0:_rule$bgColor.trim())||globalRule.bgColor;rule.textDiyStyle=((_rule$textDiyStyle=rule.textDiyStyle)===null||_rule$textDiyStyle===void 0?void 0:_rule$textDiyStyle.trim())||globalRule.textDiyStyle;}["translator","fromLang","toLang","transOpen"].forEach(function(key){if(rule[key]===GLOBAL_KEY){rule[key]=globalRule[key];}});return _context.abrupt("return",rule);case 28:case"end":return _context.stop();}},_callee,null,[[5,17]]);}));return function matchRule(_x,_x2){return _ref2.apply(this,arguments);};}()));/** + */var matchRule=/*#__PURE__*/(/* unused pure expression or super */ null && (function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(href,_ref){var _rule$selector,_rule$keepSelector;var _ref$injectRules,injectRules,_ref$subrulesList,subrulesList,_ref$owSubrule,owSubrule,rules,selectedSub,mixRule,subRules,rule,globalRule,_rule$bgColor,_rule$textDiyStyle;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_ref$injectRules=_ref.injectRules,injectRules=_ref$injectRules===void 0?true:_ref$injectRules,_ref$subrulesList=_ref.subrulesList,subrulesList=_ref$subrulesList===void 0?DEFAULT_SUBRULES_LIST:_ref$subrulesList,_ref$owSubrule=_ref.owSubrule,owSubrule=_ref$owSubrule===void 0?DEFAULT_OW_RULE:_ref$owSubrule;_context.next=3;return getRulesWithDefault();case 3:rules=_context.sent;if(!injectRules){_context.next=20;break;}_context.prev=5;selectedSub=subrulesList.find(function(item){return item.selected;});if(!(selectedSub!==null&&selectedSub!==void 0&&selectedSub.url)){_context.next=15;break;}mixRule={};Object.entries(owSubrule).filter(function(_ref3){var _ref4=_slicedToArray(_ref3,2),key=_ref4[0],val=_ref4[1];if(owSubrule.textStyle===REMAIN_KEY&&(key==="bgColor"||key==="textDiyStyle")){return false;}return val!==REMAIN_KEY;}).forEach(function(_ref5){var _ref6=_slicedToArray(_ref5,2),key=_ref6[0],val=_ref6[1];mixRule[key]=val;});_context.next=12;return loadOrFetchSubRules(selectedSub.url);case 12:subRules=_context.sent;subRules=subRules.map(function(item){return _objectSpread(_objectSpread({},item),mixRule);});rules.splice.apply(rules,[-1,0].concat(_toConsumableArray(subRules)));case 15:_context.next=20;break;case 17:_context.prev=17;_context.t0=_context["catch"](5);console.log("[load injectRules]",_context.t0);case 20:rule=rules.find(function(r){return r.pattern.split(",").some(function(p){return isMatch(href,p.trim());});});globalRule=rules.find(function(r){return r.pattern===GLOBAL_KEY;})||GLOBLA_RULE;if(rule){_context.next=24;break;}return _context.abrupt("return",globalRule);case 24:rule.selector=((_rule$selector=rule.selector)===null||_rule$selector===void 0?void 0:_rule$selector.trim())||globalRule.selector;rule.keepSelector=((_rule$keepSelector=rule.keepSelector)===null||_rule$keepSelector===void 0?void 0:_rule$keepSelector.trim())||globalRule.keepSelector;if(rule.textStyle===GLOBAL_KEY){rule.textStyle=globalRule.textStyle;rule.bgColor=globalRule.bgColor;rule.textDiyStyle=globalRule.textDiyStyle;}else{rule.bgColor=((_rule$bgColor=rule.bgColor)===null||_rule$bgColor===void 0?void 0:_rule$bgColor.trim())||globalRule.bgColor;rule.textDiyStyle=((_rule$textDiyStyle=rule.textDiyStyle)===null||_rule$textDiyStyle===void 0?void 0:_rule$textDiyStyle.trim())||globalRule.textDiyStyle;}["translator","fromLang","toLang","transOpen"].forEach(function(key){if(rule[key]===GLOBAL_KEY){rule[key]=globalRule[key];}});return _context.abrupt("return",rule);case 29:case"end":return _context.stop();}},_callee,null,[[5,17]]);}));return function matchRule(_x,_x2){return _ref2.apply(this,arguments);};}()));/** * 检查过滤rules * @param {*} rules * @returns - */var checkRules=function checkRules(rules){if(type(rules)==="string"){rules=JSON.parse(rules);}if(type(rules)!=="array"){throw new Error("data error");}var fromLangs=OPT_LANGS_FROM.map(function(item){return item[0];});var toLangs=OPT_LANGS_TO.map(function(item){return item[0];});var patternSet=new Set();rules=rules.filter(function(rule){return type(rule)==="object";}).filter(function(_ref7){var pattern=_ref7.pattern;if(type(pattern)!=="string"||patternSet.has(pattern.trim())){return false;}patternSet.add(pattern.trim());return true;}).map(function(_ref8){var pattern=_ref8.pattern,selector=_ref8.selector,translator=_ref8.translator,fromLang=_ref8.fromLang,toLang=_ref8.toLang,textStyle=_ref8.textStyle,transOpen=_ref8.transOpen,bgColor=_ref8.bgColor,textDiyStyle=_ref8.textDiyStyle;return{pattern:pattern.trim(),selector:type(selector)==="string"?selector:"",bgColor:type(bgColor)==="string"?bgColor:"",textDiyStyle:type(textDiyStyle)==="string"?textDiyStyle:"",translator:matchValue([rules_GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(OPT_TRANS_ALL)),translator),fromLang:matchValue([rules_GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(fromLangs)),fromLang),toLang:matchValue([rules_GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(toLangs)),toLang),textStyle:matchValue([rules_GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(OPT_STYLE_ALL)),textStyle),transOpen:matchValue([rules_GLOBAL_KEY,"true","false"],transOpen)};});return rules;};/** + */var checkRules=function checkRules(rules){if(type(rules)==="string"){rules=JSON.parse(rules);}if(type(rules)!=="array"){throw new Error("data error");}var fromLangs=OPT_LANGS_FROM.map(function(item){return item[0];});var toLangs=OPT_LANGS_TO.map(function(item){return item[0];});var patternSet=new Set();rules=rules.filter(function(rule){return type(rule)==="object";}).filter(function(_ref7){var pattern=_ref7.pattern;if(type(pattern)!=="string"||patternSet.has(pattern.trim())){return false;}patternSet.add(pattern.trim());return true;}).map(function(_ref8){var pattern=_ref8.pattern,selector=_ref8.selector,keepSelector=_ref8.keepSelector,translator=_ref8.translator,fromLang=_ref8.fromLang,toLang=_ref8.toLang,textStyle=_ref8.textStyle,transOpen=_ref8.transOpen,bgColor=_ref8.bgColor,textDiyStyle=_ref8.textDiyStyle;return{pattern:pattern.trim(),selector:type(selector)==="string"?selector:"",keepSelector:type(keepSelector)==="string"?keepSelector:"",bgColor:type(bgColor)==="string"?bgColor:"",textDiyStyle:type(textDiyStyle)==="string"?textDiyStyle:"",translator:matchValue([rules_GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(OPT_TRANS_ALL)),translator),fromLang:matchValue([rules_GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(fromLangs)),fromLang),toLang:matchValue([rules_GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(toLangs)),toLang),textStyle:matchValue([rules_GLOBAL_KEY].concat((0,toConsumableArray/* default */.Z)(OPT_STYLE_ALL)),textStyle),transOpen:matchValue([rules_GLOBAL_KEY,"true","false"],transOpen)};});return rules;};/** * 保存或更新rule * @param {*} newRule */var saveRule=/*#__PURE__*/(/* unused pure expression or super */ null && (function(){var _ref9=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(newRule){var rules,rule;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return getRulesWithDefault();case 2:rules=_context2.sent;rule=rules.find(function(item){return isMatch(newRule.pattern,item.pattern);});if(rule&&rule.pattern!==GLOBAL_KEY){Object.assign(rule,_objectSpread(_objectSpread({},newRule),{},{pattern:rule.pattern}));}else{rules.unshift(newRule);}_context2.next=7;return setRules(rules);case 7:trySyncRules();case 8:case"end":return _context2.stop();}},_callee2);}));return function saveRule(_x3){return _ref9.apply(this,arguments);};}())); @@ -61587,9 +61591,9 @@ var FileUpload = __webpack_require__(4498); ;// CONCATENATED MODULE: ./src/views/Options/UploadButton.js function UploadButton(_ref){var handleImport=_ref.handleImport,text=_ref.text,_ref$fileType=_ref.fileType,fileType=_ref$fileType===void 0?"json":_ref$fileType,_ref$fileExts=_ref.fileExts,fileExts=_ref$fileExts===void 0?[".json"]:_ref$fileExts;var i18n=useI18n();var inputRef=(0,react.useRef)(null);var handleClick=function handleClick(){if(inputRef.current){inputRef.current.click();inputRef.current.value=null;}};var onChange=function onChange(e){var file=e.target.files[0];if(!file){return;}if(!file.type.includes(fileType)){alert(i18n("error_wrong_file_type"));return;}var reader=new FileReader();reader.onload=/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(e){return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:handleImport(e.target.result);case 1:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref2.apply(this,arguments);};}();reader.readAsText(file);};return/*#__PURE__*/(0,jsx_runtime.jsxs)(Button_Button,{size:"small",variant:"outlined",onClick:handleClick,startIcon:/*#__PURE__*/(0,jsx_runtime.jsx)(FileUpload/* default */.Z,{}),children:[text,/*#__PURE__*/(0,jsx_runtime.jsx)("input",{type:"file",accept:fileExts.join(", "),ref:inputRef,onChange:onChange,hidden:true})]});} ;// CONCATENATED MODULE: ./src/views/Options/Rules.js -function RuleFields(_ref){var rule=_ref.rule,rules=_ref.rules,setShow=_ref.setShow,setKeyword=_ref.setKeyword;var initFormValues=rule||_objectSpread2(_objectSpread2({},DEFAULT_RULE),{},{transOpen:"true"});var editMode=!!rule;var i18n=useI18n();var _useState=(0,react.useState)(editMode),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),disabled=_useState2[0],setDisabled=_useState2[1];var _useState3=(0,react.useState)({}),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),errors=_useState4[0],setErrors=_useState4[1];var _useState5=(0,react.useState)(initFormValues),_useState6=(0,slicedToArray/* default */.Z)(_useState5,2),formValues=_useState6[0],setFormValues=_useState6[1];var pattern=formValues.pattern,selector=formValues.selector,translator=formValues.translator,fromLang=formValues.fromLang,toLang=formValues.toLang,textStyle=formValues.textStyle,transOpen=formValues.transOpen,bgColor=formValues.bgColor,textDiyStyle=formValues.textDiyStyle;var hasSamePattern=function hasSamePattern(str){var _iterator=createForOfIteratorHelper_createForOfIteratorHelper(rules.list),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var item=_step.value;if(item.pattern===str&&(rule===null||rule===void 0?void 0:rule.pattern)!==str){return true;}}}catch(err){_iterator.e(err);}finally{_iterator.f();}return false;};var handleFocus=function handleFocus(e){e.preventDefault();var name=e.target.name;setErrors(function(pre){return _objectSpread2(_objectSpread2({},pre),{},(0,defineProperty/* default */.Z)({},name,""));});};var handlePatternChange=(0,react.useMemo)(function(){return debounce(/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(patterns){return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:setKeyword(patterns.trim());case 1:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref2.apply(this,arguments);};}(),500);},[setKeyword]);var handleChange=function handleChange(e){e.preventDefault();var _e$target=e.target,name=_e$target.name,value=_e$target.value;setFormValues(function(pre){return _objectSpread2(_objectSpread2({},pre),{},(0,defineProperty/* default */.Z)({},name,value));});if(name==="pattern"&&!editMode){handlePatternChange(value);}};var handleCancel=function handleCancel(e){e.preventDefault();if(editMode){setDisabled(true);}else{setShow(false);}setErrors({});setFormValues(initFormValues);};var handleSubmit=function handleSubmit(e){e.preventDefault();var errors={};if(!pattern.trim()){errors.pattern=i18n("error_cant_be_blank");}if(hasSamePattern(pattern)){errors.pattern=i18n("error_duplicate_values");}if(pattern==="*"&&!errors.pattern&&!selector.trim()){errors.selector=i18n("error_cant_be_blank");}if(Object.keys(errors).length>0){setErrors(errors);return;}if(editMode){// 编辑 +function RuleFields(_ref){var rule=_ref.rule,rules=_ref.rules,setShow=_ref.setShow,setKeyword=_ref.setKeyword;var initFormValues=rule||_objectSpread2(_objectSpread2({},DEFAULT_RULE),{},{transOpen:"true"});var editMode=!!rule;var i18n=useI18n();var _useState=(0,react.useState)(editMode),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),disabled=_useState2[0],setDisabled=_useState2[1];var _useState3=(0,react.useState)({}),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),errors=_useState4[0],setErrors=_useState4[1];var _useState5=(0,react.useState)(initFormValues),_useState6=(0,slicedToArray/* default */.Z)(_useState5,2),formValues=_useState6[0],setFormValues=_useState6[1];var pattern=formValues.pattern,selector=formValues.selector,_formValues$keepSelec=formValues.keepSelector,keepSelector=_formValues$keepSelec===void 0?"":_formValues$keepSelec,translator=formValues.translator,fromLang=formValues.fromLang,toLang=formValues.toLang,textStyle=formValues.textStyle,transOpen=formValues.transOpen,bgColor=formValues.bgColor,textDiyStyle=formValues.textDiyStyle;var hasSamePattern=function hasSamePattern(str){var _iterator=createForOfIteratorHelper_createForOfIteratorHelper(rules.list),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var item=_step.value;if(item.pattern===str&&(rule===null||rule===void 0?void 0:rule.pattern)!==str){return true;}}}catch(err){_iterator.e(err);}finally{_iterator.f();}return false;};var handleFocus=function handleFocus(e){e.preventDefault();var name=e.target.name;setErrors(function(pre){return _objectSpread2(_objectSpread2({},pre),{},(0,defineProperty/* default */.Z)({},name,""));});};var handlePatternChange=(0,react.useMemo)(function(){return debounce(/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(patterns){return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:setKeyword(patterns.trim());case 1:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref2.apply(this,arguments);};}(),500);},[setKeyword]);var handleChange=function handleChange(e){e.preventDefault();var _e$target=e.target,name=_e$target.name,value=_e$target.value;setFormValues(function(pre){return _objectSpread2(_objectSpread2({},pre),{},(0,defineProperty/* default */.Z)({},name,value));});if(name==="pattern"&&!editMode){handlePatternChange(value);}};var handleCancel=function handleCancel(e){e.preventDefault();if(editMode){setDisabled(true);}else{setShow(false);}setErrors({});setFormValues(initFormValues);};var handleSubmit=function handleSubmit(e){e.preventDefault();var errors={};if(!pattern.trim()){errors.pattern=i18n("error_cant_be_blank");}if(hasSamePattern(pattern)){errors.pattern=i18n("error_duplicate_values");}if(pattern==="*"&&!errors.pattern&&!selector.trim()){errors.selector=i18n("error_cant_be_blank");}if(Object.keys(errors).length>0){setErrors(errors);return;}if(editMode){// 编辑 setDisabled(true);rules.put(rule.pattern,formValues);}else{// 添加 -rules.add(formValues);setShow(false);setFormValues(initFormValues);}};var GlobalItem=(rule===null||rule===void 0?void 0:rule.pattern)!=="*"&&/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:rules_GLOBAL_KEY,children:rules_GLOBAL_KEY},rules_GLOBAL_KEY);return/*#__PURE__*/(0,jsx_runtime.jsx)("form",{onSubmit:handleSubmit,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:i18n("pattern"),error:!!errors.pattern,helperText:errors.pattern||i18n("pattern_helper"),name:"pattern",value:pattern,disabled:(rule===null||rule===void 0?void 0:rule.pattern)==="*"||disabled,onChange:handleChange,onFocus:handleFocus,multiline:true}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:i18n("selector"),error:!!errors.selector,helperText:errors.selector||i18n("selector_helper"),name:"selector",value:selector,disabled:disabled,onChange:handleChange,onFocus:handleFocus,multiline:true}),/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Grid_Grid,{container:true,spacing:2,columns:12,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:12,sm:6,md:3,lg:2,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(TextField_TextField,{select:true,size:"small",fullWidth:true,name:"transOpen",value:transOpen,label:i18n("translate_switch"),disabled:disabled,onChange:handleChange,children:[GlobalItem,/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:"true",children:i18n("default_enabled")}),/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:"false",children:i18n("default_disabled")})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:12,sm:6,md:3,lg:2,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(TextField_TextField,{select:true,size:"small",fullWidth:true,name:"translator",value:translator,label:i18n("translate_service"),disabled:disabled,onChange:handleChange,children:[GlobalItem,OPT_TRANS_ALL.map(function(item){return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:item,children:item},item);})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:12,sm:6,md:3,lg:2,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(TextField_TextField,{select:true,size:"small",fullWidth:true,name:"fromLang",value:fromLang,label:i18n("from_lang"),disabled:disabled,onChange:handleChange,children:[GlobalItem,OPT_LANGS_FROM.map(function(_ref3){var _ref4=(0,slicedToArray/* default */.Z)(_ref3,2),lang=_ref4[0],name=_ref4[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:12,sm:6,md:3,lg:2,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(TextField_TextField,{select:true,size:"small",fullWidth:true,name:"toLang",value:toLang,label:i18n("to_lang"),disabled:disabled,onChange:handleChange,children:[GlobalItem,OPT_LANGS_TO.map(function(_ref5){var _ref6=(0,slicedToArray/* default */.Z)(_ref5,2),lang=_ref6[0],name=_ref6[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:12,sm:6,md:3,lg:2,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(TextField_TextField,{select:true,size:"small",fullWidth:true,name:"textStyle",value:textStyle,label:i18n("text_style"),disabled:disabled,onChange:handleChange,children:[GlobalItem,OPT_STYLE_ALL.map(function(item){return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:item,children:i18n(item)},item);})]})}),OPT_STYLE_USE_COLOR.includes(textStyle)&&/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:12,sm:6,md:3,lg:2,children:/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",fullWidth:true,name:"bgColor",value:bgColor,label:i18n("bg_color"),disabled:disabled,onChange:handleChange})})]})}),textStyle===OPT_STYLE_DIY&&/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:i18n("diy_style"),helperText:i18n("diy_style_helper"),name:"textDiyStyle",value:textDiyStyle,disabled:disabled,onChange:handleChange,multiline:true}),rules&&(editMode?/*#__PURE__*/ // 编辑 +rules.add(formValues);setShow(false);setFormValues(initFormValues);}};var GlobalItem=(rule===null||rule===void 0?void 0:rule.pattern)!=="*"&&/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:rules_GLOBAL_KEY,children:rules_GLOBAL_KEY},rules_GLOBAL_KEY);return/*#__PURE__*/(0,jsx_runtime.jsx)("form",{onSubmit:handleSubmit,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:i18n("pattern"),error:!!errors.pattern,helperText:errors.pattern||i18n("pattern_helper"),name:"pattern",value:pattern,disabled:(rule===null||rule===void 0?void 0:rule.pattern)==="*"||disabled,onChange:handleChange,onFocus:handleFocus,multiline:true}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:i18n("selector"),error:!!errors.selector,helperText:errors.selector||i18n("selector_helper"),name:"selector",value:selector,disabled:disabled,onChange:handleChange,onFocus:handleFocus,multiline:true}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:i18n("keep_selector"),helperText:i18n("keep_selector_helper"),name:"keepSelector",value:keepSelector,disabled:disabled,onChange:handleChange,multiline:true}),/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Grid_Grid,{container:true,spacing:2,columns:12,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:12,sm:6,md:3,lg:2,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(TextField_TextField,{select:true,size:"small",fullWidth:true,name:"transOpen",value:transOpen,label:i18n("translate_switch"),disabled:disabled,onChange:handleChange,children:[GlobalItem,/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:"true",children:i18n("default_enabled")}),/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:"false",children:i18n("default_disabled")})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:12,sm:6,md:3,lg:2,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(TextField_TextField,{select:true,size:"small",fullWidth:true,name:"translator",value:translator,label:i18n("translate_service"),disabled:disabled,onChange:handleChange,children:[GlobalItem,OPT_TRANS_ALL.map(function(item){return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:item,children:item},item);})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:12,sm:6,md:3,lg:2,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(TextField_TextField,{select:true,size:"small",fullWidth:true,name:"fromLang",value:fromLang,label:i18n("from_lang"),disabled:disabled,onChange:handleChange,children:[GlobalItem,OPT_LANGS_FROM.map(function(_ref3){var _ref4=(0,slicedToArray/* default */.Z)(_ref3,2),lang=_ref4[0],name=_ref4[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:12,sm:6,md:3,lg:2,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(TextField_TextField,{select:true,size:"small",fullWidth:true,name:"toLang",value:toLang,label:i18n("to_lang"),disabled:disabled,onChange:handleChange,children:[GlobalItem,OPT_LANGS_TO.map(function(_ref5){var _ref6=(0,slicedToArray/* default */.Z)(_ref5,2),lang=_ref6[0],name=_ref6[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:12,sm:6,md:3,lg:2,children:/*#__PURE__*/(0,jsx_runtime.jsxs)(TextField_TextField,{select:true,size:"small",fullWidth:true,name:"textStyle",value:textStyle,label:i18n("text_style"),disabled:disabled,onChange:handleChange,children:[GlobalItem,OPT_STYLE_ALL.map(function(item){return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:item,children:i18n(item)},item);})]})}),OPT_STYLE_USE_COLOR.includes(textStyle)&&/*#__PURE__*/(0,jsx_runtime.jsx)(Grid_Grid,{item:true,xs:12,sm:6,md:3,lg:2,children:/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",fullWidth:true,name:"bgColor",value:bgColor,label:i18n("bg_color"),disabled:disabled,onChange:handleChange})})]})}),textStyle===OPT_STYLE_DIY&&/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:i18n("diy_style"),helperText:i18n("diy_style_helper"),name:"textDiyStyle",value:textDiyStyle,disabled:disabled,onChange:handleChange,multiline:true}),rules&&(editMode?/*#__PURE__*/ // 编辑 (0,jsx_runtime.jsx)(Stack_Stack,{direction:"row",spacing:2,children:disabled?/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{size:"small",variant:"contained",onClick:function onClick(e){e.preventDefault();setDisabled(false);},children:i18n("edit")}),(rule===null||rule===void 0?void 0:rule.pattern)!=="*"&&/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{size:"small",variant:"outlined",onClick:function onClick(e){e.preventDefault();rules.del(rule.pattern);},children:i18n("delete")})]}):/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{size:"small",variant:"contained",type:"submit",children:i18n("save")}),/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{size:"small",variant:"outlined",onClick:handleCancel,children:i18n("cancel")})]})}):/*#__PURE__*/ // 添加 (0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{size:"small",variant:"contained",type:"submit",children:i18n("save")}),/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{size:"small",variant:"outlined",onClick:handleCancel,children:i18n("cancel")})]}))]})});}function RuleAccordion(_ref7){var rule=_ref7.rule,rules=_ref7.rules;var i18n=useI18n();var _useState7=(0,react.useState)(false),_useState8=(0,slicedToArray/* default */.Z)(_useState7,2),expanded=_useState8[0],setExpanded=_useState8[1];var handleChange=function handleChange(e){setExpanded(function(pre){return!pre;});};return/*#__PURE__*/(0,jsx_runtime.jsxs)(Accordion_Accordion,{expanded:expanded,onChange:handleChange,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(AccordionSummary_AccordionSummary,{expandIcon:/*#__PURE__*/(0,jsx_runtime.jsx)(ExpandMore/* default */.Z,{}),children:/*#__PURE__*/(0,jsx_runtime.jsx)(Typography_Typography,{sx:{opacity:rules?1:0.5,overflowWrap:"anywhere"},children:rule.pattern===rules_GLOBAL_KEY?"[".concat(i18n("global_rule"),"] ").concat(rule.pattern):rule.pattern})}),/*#__PURE__*/(0,jsx_runtime.jsx)(AccordionDetails_AccordionDetails,{children:expanded&&/*#__PURE__*/(0,jsx_runtime.jsx)(RuleFields,{rule:rule,rules:rules})})]});}function ShareButton(_ref8){var rules=_ref8.rules,injectRules=_ref8.injectRules,selectedUrl=_ref8.selectedUrl;var alert=useAlert();var i18n=useI18n();var handleClick=/*#__PURE__*/function(){var _ref9=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(){var _yield$getSyncWithDef,syncType,syncUrl,syncKey,shareRules,subRules,url;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=3;return storage_getSyncWithDefault();case 3:_yield$getSyncWithDef=_context2.sent;syncType=_yield$getSyncWithDef.syncType;syncUrl=_yield$getSyncWithDef.syncUrl;syncKey=_yield$getSyncWithDef.syncKey;if(!(syncType!==OPT_SYNCTYPE_WORKER||!syncUrl||!syncKey)){_context2.next=10;break;}alert.warning(i18n("error_sync_setting"));return _context2.abrupt("return");case 10:shareRules=(0,toConsumableArray/* default */.Z)(rules.list);if(!injectRules){_context2.next=16;break;}_context2.next=14;return subRules_loadOrFetchSubRules(selectedUrl);case 14:subRules=_context2.sent;shareRules.splice.apply(shareRules,[-1,0].concat((0,toConsumableArray/* default */.Z)(subRules)));case 16:_context2.next=18;return syncShareRules({rules:shareRules,syncUrl:syncUrl,syncKey:syncKey});case 18:url=_context2.sent;window.open(url,"_blank");_context2.next=26;break;case 22:_context2.prev=22;_context2.t0=_context2["catch"](0);alert.warning(i18n("error_got_some_wrong"));console.log("[share rules]",_context2.t0);case 26:case"end":return _context2.stop();}},_callee2,null,[[0,22]]);}));return function handleClick(){return _ref9.apply(this,arguments);};}();return/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{size:"small",variant:"outlined",onClick:handleClick,startIcon:/*#__PURE__*/(0,jsx_runtime.jsx)(Share/* default */.Z,{}),children:i18n("share")});}function UserRules(_ref10){var subRules=_ref10.subRules;var i18n=useI18n();var rules=useRules();var _useState9=(0,react.useState)(false),_useState10=(0,slicedToArray/* default */.Z)(_useState9,2),showAdd=_useState10[0],setShowAdd=_useState10[1];var _useSetting=useSetting(),setting=_useSetting.setting,updateSetting=_useSetting.updateSetting;var _useState11=(0,react.useState)(""),_useState12=(0,slicedToArray/* default */.Z)(_useState11,2),keyword=_useState12[0],setKeyword=_useState12[1];var injectRules=!!(setting!==null&&setting!==void 0&&setting.injectRules);var selectedUrl=subRules.selectedUrl,selectedRules=subRules.selectedRules;var handleImport=/*#__PURE__*/function(){var _ref11=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee3(data){return regeneratorRuntime_regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.prev=0;_context3.next=3;return rules.merge(JSON.parse(data));case 3:_context3.next=8;break;case 5:_context3.prev=5;_context3.t0=_context3["catch"](0);console.log("[import rules]",_context3.t0);case 8:case"end":return _context3.stop();}},_callee3,null,[[0,5]]);}));return function handleImport(_x2){return _ref11.apply(this,arguments);};}();var handleInject=function handleInject(){updateSetting({injectRules:!injectRules});};(0,react.useEffect)(function(){if(!showAdd){setKeyword("");}},[showAdd]);if(!rules.list){return;}return/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:3,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",alignItems:"center",spacing:2,useFlexGap:true,flexWrap:"wrap",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{size:"small",variant:"contained",disabled:showAdd,onClick:function onClick(e){e.preventDefault();setShowAdd(true);},children:i18n("add")}),/*#__PURE__*/(0,jsx_runtime.jsx)(UploadButton,{text:i18n("import"),handleImport:handleImport}),/*#__PURE__*/(0,jsx_runtime.jsx)(DownloadButton,{data:JSON.stringify((0,toConsumableArray/* default */.Z)(rules.list).reverse(),null,2),text:i18n("export"),fileName:"kiss-rules_".concat(Date.now(),".json")}),/*#__PURE__*/(0,jsx_runtime.jsx)(ShareButton,{rules:rules,injectRules:injectRules,selectedUrl:selectedUrl}),/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{size:"small",variant:"outlined",onClick:function onClick(){rules.clear();},startIcon:/*#__PURE__*/(0,jsx_runtime.jsx)(ClearAll/* default */.Z,{}),children:i18n("clear_all")}),/*#__PURE__*/(0,jsx_runtime.jsx)(HelpButton,{url:URL_KISS_RULES_NEW_ISSUE}),/*#__PURE__*/(0,jsx_runtime.jsx)(FormControlLabel_FormControlLabel,{control:/*#__PURE__*/(0,jsx_runtime.jsx)(Switch_Switch,{size:"small",checked:injectRules,onChange:handleInject}),label:i18n("inject_rules")})]}),showAdd&&/*#__PURE__*/(0,jsx_runtime.jsx)(RuleFields,{rules:rules,setShow:setShowAdd,setKeyword:setKeyword}),/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{children:rules.list.filter(function(rule){return rule.pattern.includes(keyword)||keyword.includes(rule.pattern);}).map(function(rule){return/*#__PURE__*/(0,jsx_runtime.jsx)(RuleAccordion,{rule:rule,rules:rules},rule.pattern);})}),injectRules&&/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{children:selectedRules.filter(function(rule){return rule.pattern.includes(keyword)||keyword.includes(rule.pattern);}).map(function(rule){return/*#__PURE__*/(0,jsx_runtime.jsx)(RuleAccordion,{rule:rule},rule.pattern);})})]});}function SubRulesItem(_ref12){var index=_ref12.index,url=_ref12.url,syncAt=_ref12.syncAt,selectedUrl=_ref12.selectedUrl,delSub=_ref12.delSub,setSelectedRules=_ref12.setSelectedRules,updateDataCache=_ref12.updateDataCache,deleteDataCache=_ref12.deleteDataCache;var _useState13=(0,react.useState)(false),_useState14=(0,slicedToArray/* default */.Z)(_useState13,2),loading=_useState14[0],setLoading=_useState14[1];var handleDel=/*#__PURE__*/function(){var _ref13=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee4(){return regeneratorRuntime_regeneratorRuntime().wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:_context4.prev=0;_context4.next=3;return delSub(url);case 3:_context4.next=5;return delSubRules(url);case 5:_context4.next=7;return deleteDataCache(url);case 7:_context4.next=12;break;case 9:_context4.prev=9;_context4.t0=_context4["catch"](0);console.log("[del subrules]",_context4.t0);case 12:case"end":return _context4.stop();}},_callee4,null,[[0,9]]);}));return function handleDel(){return _ref13.apply(this,arguments);};}();var handleSync=/*#__PURE__*/function(){var _ref14=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee5(){var rules;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee5$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:_context5.prev=0;setLoading(true);_context5.next=4;return syncSubRules(url);case 4:rules=_context5.sent;if(rules.length>0&&url===selectedUrl){setSelectedRules(rules);}_context5.next=8;return updateDataCache(url);case 8:_context5.next=13;break;case 10:_context5.prev=10;_context5.t0=_context5["catch"](0);console.log("[sync sub rules]",_context5.t0);case 13:_context5.prev=13;setLoading(false);return _context5.finish(13);case 16:case"end":return _context5.stop();}},_callee5,null,[[0,10,13,16]]);}));return function handleSync(){return _ref14.apply(this,arguments);};}();return/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",alignItems:"center",spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(FormControlLabel_FormControlLabel,{value:url,control:/*#__PURE__*/(0,jsx_runtime.jsx)(Radio_Radio,{}),sx:{overflowWrap:"anywhere"},label:url}),syncAt&&/*#__PURE__*/(0,jsx_runtime.jsxs)("span",{style:{marginLeft:"0.5em",opacity:0.5},children:["[",new Date(syncAt).toLocaleString(),"]"]}),loading?/*#__PURE__*/(0,jsx_runtime.jsx)(CircularProgress_CircularProgress,{size:16}):/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{size:"small",onClick:handleSync,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Sync/* default */.Z,{fontSize:"small"})}),index!==0&&selectedUrl!==url&&/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{size:"small",onClick:handleDel,children:/*#__PURE__*/(0,jsx_runtime.jsx)(Delete/* default */.Z,{fontSize:"small"})})]});}function SubRulesEdit(_ref15){var subList=_ref15.subList,addSub=_ref15.addSub,updateDataCache=_ref15.updateDataCache;var i18n=useI18n();var _useState15=(0,react.useState)(""),_useState16=(0,slicedToArray/* default */.Z)(_useState15,2),inputText=_useState16[0],setInputText=_useState16[1];var _useState17=(0,react.useState)(""),_useState18=(0,slicedToArray/* default */.Z)(_useState17,2),inputError=_useState18[0],setInputError=_useState18[1];var _useState19=(0,react.useState)(false),_useState20=(0,slicedToArray/* default */.Z)(_useState19,2),showInput=_useState20[0],setShowInput=_useState20[1];var _useState21=(0,react.useState)(false),_useState22=(0,slicedToArray/* default */.Z)(_useState21,2),loading=_useState22[0],setLoading=_useState22[1];var handleCancel=function handleCancel(e){e.preventDefault();setShowInput(false);setInputText("");setInputError("");};var handleSave=/*#__PURE__*/function(){var _ref16=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee6(e){var url,rules;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee6$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:e.preventDefault();url=inputText.trim();if(url){_context6.next=5;break;}setInputError(i18n("error_cant_be_blank"));return _context6.abrupt("return");case 5:if(!subList.find(function(item){return item.url===url;})){_context6.next=8;break;}setInputError(i18n("error_duplicate_values"));return _context6.abrupt("return");case 8:_context6.prev=8;setLoading(true);_context6.next=12;return syncSubRules(url);case 12:rules=_context6.sent;if(!(rules.length===0)){_context6.next=15;break;}throw new Error("empty rules");case 15:_context6.next=17;return addSub(url);case 17:_context6.next=19;return updateDataCache(url);case 19:setShowInput(false);setInputText("");_context6.next=27;break;case 23:_context6.prev=23;_context6.t0=_context6["catch"](8);console.log("[fetch rules]",_context6.t0);setInputError(i18n("error_fetch_url"));case 27:_context6.prev=27;setLoading(false);return _context6.finish(27);case 30:case"end":return _context6.stop();}},_callee6,null,[[8,23,27,30]]);}));return function handleSave(_x3){return _ref16.apply(this,arguments);};}();var handleInput=function handleInput(e){e.preventDefault();setInputText(e.target.value);};var handleFocus=function handleFocus(e){e.preventDefault();setInputError("");};return/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",alignItems:"center",spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{size:"small",variant:"contained",disabled:showInput,onClick:function onClick(e){e.preventDefault();setShowInput(true);},children:i18n("add")}),/*#__PURE__*/(0,jsx_runtime.jsx)(HelpButton,{url:URL_KISS_RULES_NEW_ISSUE})]}),showInput&&/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",value:inputText,error:!!inputError,helperText:inputError,onChange:handleInput,onFocus:handleFocus,label:i18n("subscribe_url")}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",alignItems:"center",spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{size:"small",variant:"contained",onClick:handleSave,disabled:loading,children:i18n("save")}),/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{size:"small",variant:"outlined",onClick:handleCancel,children:i18n("cancel")})]})]})]});}function SubRules(_ref17){var subRules=_ref17.subRules;var subList=subRules.subList,selectSub=subRules.selectSub,addSub=subRules.addSub,delSub=subRules.delSub,selectedUrl=subRules.selectedUrl,selectedRules=subRules.selectedRules,setSelectedRules=subRules.setSelectedRules,loading=subRules.loading;var _useSyncCaches=useSyncCaches(),dataCaches=_useSyncCaches.dataCaches,updateDataCache=_useSyncCaches.updateDataCache,deleteDataCache=_useSyncCaches.deleteDataCache,reloadSync=_useSyncCaches.reloadSync;var handleSelect=function handleSelect(e){var url=e.target.value;selectSub(url);};(0,react.useEffect)(function(){reloadSync();},[selectedRules,reloadSync]);return/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:3,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(SubRulesEdit,{subList:subList,addSub:addSub,updateDataCache:updateDataCache}),/*#__PURE__*/(0,jsx_runtime.jsx)(RadioGroup_RadioGroup,{value:selectedUrl,onChange:handleSelect,children:subList.map(function(item,index){return/*#__PURE__*/(0,jsx_runtime.jsx)(SubRulesItem,{url:item.url,syncAt:dataCaches[item.url],index:index,selectedUrl:selectedUrl,delSub:delSub,setSelectedRules:setSelectedRules,updateDataCache:updateDataCache,deleteDataCache:deleteDataCache},item.url);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{children:loading?/*#__PURE__*/(0,jsx_runtime.jsx)("center",{children:/*#__PURE__*/(0,jsx_runtime.jsx)(CircularProgress_CircularProgress,{})}):selectedRules.map(function(rule){return/*#__PURE__*/(0,jsx_runtime.jsx)(RuleAccordion,{rule:rule},rule.pattern);})})]});}function Rules(){var i18n=useI18n();var _useState23=(0,react.useState)(0),_useState24=(0,slicedToArray/* default */.Z)(_useState23,2),activeTab=_useState24[0],setActiveTab=_useState24[1];var subRules=useSubRules();var handleTabChange=function handleTabChange(e,newValue){setActiveTab(newValue);};return/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:3,children:[/*#__PURE__*/(0,jsx_runtime.jsxs)(Alert_Alert,{severity:"info",children:[i18n("rules_warn_1"),/*#__PURE__*/(0,jsx_runtime.jsx)("br",{}),i18n("rules_warn_2")]}),/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{sx:{borderBottom:1,borderColor:"divider"},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Tabs_Tabs,{value:activeTab,onChange:handleTabChange,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Tab_Tab,{label:i18n("personal_rules")}),/*#__PURE__*/(0,jsx_runtime.jsx)(Tab_Tab,{label:i18n("subscribe_rules")}),/*#__PURE__*/(0,jsx_runtime.jsx)(Tab_Tab,{label:i18n("overwrite_subscribe_rules")})]})}),/*#__PURE__*/(0,jsx_runtime.jsx)("div",{hidden:activeTab!==0,children:activeTab===0&&/*#__PURE__*/(0,jsx_runtime.jsx)(UserRules,{subRules:subRules})}),/*#__PURE__*/(0,jsx_runtime.jsx)("div",{hidden:activeTab!==1,children:activeTab===1&&/*#__PURE__*/(0,jsx_runtime.jsx)(SubRules,{subRules:subRules})}),/*#__PURE__*/(0,jsx_runtime.jsx)("div",{hidden:activeTab!==2,children:activeTab===2&&/*#__PURE__*/(0,jsx_runtime.jsx)(OwSubRule,{})})]})});} ;// CONCATENATED MODULE: ./node_modules/.pnpm/@mui+material@5.14.10_@emotion+react@11.11.1_@emotion+styled@11.11.0_@types+react@18.2.22_react-dom@18.2.0_react@18.2.0/node_modules/@mui/material/Link/linkClasses.js @@ -61797,7 +61801,7 @@ var Edit = __webpack_require__(6485); * @param {*} target * @param {*} timeout * @returns - */var shortcutListener=function shortcutListener(fn){var target=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document;var timeout=arguments.length>2&&arguments[2]!==undefined?arguments[2]:3000;var allkeys=new Set();var curkeys=new Set();var timer=null;var handleKeydown=function handleKeydown(e){timer&&clearTimeout(timer);timer=setTimeout(function(){allkeys.clear();curkeys.clear();clearTimeout(timer);timer=null;},timeout);if(e.code){allkeys.add(e.code);curkeys.add(e.code);fn((0,toConsumableArray/* default */.Z)(curkeys),(0,toConsumableArray/* default */.Z)(allkeys));}};var handleKeyup=function handleKeyup(e){curkeys.delete(e.code);if(curkeys.size===0){fn((0,toConsumableArray/* default */.Z)(curkeys),(0,toConsumableArray/* default */.Z)(allkeys));allkeys.clear();}};target.addEventListener("keydown",handleKeydown);target.addEventListener("keyup",handleKeyup);return function(){if(timer){clearTimeout(timer);timer=null;}target.removeEventListener("keydown",handleKeydown);target.removeEventListener("keyup",handleKeyup);};};/** + */var shortcutListener=function shortcutListener(fn){var target=arguments.length>1&&arguments[1]!==undefined?arguments[1]:document;var timeout=arguments.length>2&&arguments[2]!==undefined?arguments[2]:3000;var allkeys=new Set();var curkeys=new Set();var timer=null;var handleKeydown=function handleKeydown(e){timer&&clearTimeout(timer);timer=setTimeout(function(){allkeys.clear();curkeys.clear();clearTimeout(timer);timer=null;},timeout);if(e.code){allkeys.add(e.code);curkeys.add(e.code);fn((0,toConsumableArray/* default */.Z)(curkeys),(0,toConsumableArray/* default */.Z)(allkeys));}};var handleKeyup=function handleKeyup(e){curkeys.delete(e.code);if(curkeys.size===0){fn((0,toConsumableArray/* default */.Z)(curkeys),(0,toConsumableArray/* default */.Z)(allkeys));allkeys.clear();}};target.addEventListener("keydown",handleKeydown,true);target.addEventListener("keyup",handleKeyup,true);return function(){if(timer){clearTimeout(timer);timer=null;}target.removeEventListener("keydown",handleKeydown);target.removeEventListener("keyup",handleKeyup);};};/** * 注册键盘快捷键 * @param {*} targetKeys * @param {*} fn @@ -63147,7 +63151,7 @@ var DarkMode = __webpack_require__(2675); ;// CONCATENATED MODULE: ./src/views/Options/DarkModeButton.js function DarkModeButton(){var _useDarkMode=useDarkMode(),darkMode=_useDarkMode.darkMode,toggleDarkMode=_useDarkMode.toggleDarkMode;return/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{onClick:toggleDarkMode,color:"inherit",children:darkMode?/*#__PURE__*/(0,jsx_runtime.jsx)(LightMode/* default */.Z,{}):/*#__PURE__*/(0,jsx_runtime.jsx)(DarkMode/* default */.Z,{})});} ;// CONCATENATED MODULE: ./src/views/Options/Header.js -function Header(props){var i18n=useI18n();var onDrawerToggle=props.onDrawerToggle;return/*#__PURE__*/(0,jsx_runtime.jsx)(AppBar_AppBar,{color:"primary",position:"sticky",sx:{zIndex:1300},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Toolbar_Toolbar,{variant:"dense",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{sx:{display:{sm:"none",xs:"block"}},children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{color:"inherit","aria-label":"open drawer",onClick:onDrawerToggle,edge:"start",children:/*#__PURE__*/(0,jsx_runtime.jsx)(icons_material_Menu/* default */.Z,{})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Typography_Typography,{component:"div",sx:{flexGrow:1,fontWeight:"bold"},children:/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{underline:"none",color:"inherit",href:"https://github.com/fishjar/kiss-translator",target:"_blank",children:"".concat(i18n("app_name")," v").concat("1.7.15")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(DarkModeButton,{})]})});}/* harmony default export */ var Options_Header = (Header); +function Header(props){var i18n=useI18n();var onDrawerToggle=props.onDrawerToggle;return/*#__PURE__*/(0,jsx_runtime.jsx)(AppBar_AppBar,{color:"primary",position:"sticky",sx:{zIndex:1300},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Toolbar_Toolbar,{variant:"dense",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{sx:{display:{sm:"none",xs:"block"}},children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{color:"inherit","aria-label":"open drawer",onClick:onDrawerToggle,edge:"start",children:/*#__PURE__*/(0,jsx_runtime.jsx)(icons_material_Menu/* default */.Z,{})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Typography_Typography,{component:"div",sx:{flexGrow:1,fontWeight:"bold"},children:/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{underline:"none",color:"inherit",href:"https://github.com/fishjar/kiss-translator",target:"_blank",children:"".concat(i18n("app_name")," v").concat("1.7.16")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(DarkModeButton,{})]})});}/* harmony default export */ var Options_Header = (Header); ;// CONCATENATED MODULE: ./src/views/Options/Layout.js function Layout(){var navWidth=256;var location=dist_useLocation();var theme=useTheme_useTheme();var _useState=(0,react.useState)(false),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),open=_useState2[0],setOpen=_useState2[1];var isSm=useMediaQuery(theme.breakpoints.up("sm"));var handleDrawerToggle=function handleDrawerToggle(){setOpen(!open);};(0,react.useEffect)(function(){setOpen(false);},[location]);return/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(CssBaseline_CssBaseline,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(Options_Header,{onDrawerToggle:handleDrawerToggle}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{sx:{display:"flex"},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{component:"nav",sx:{width:{sm:navWidth},flexShrink:{sm:0}},children:/*#__PURE__*/(0,jsx_runtime.jsx)(Navigator,{PaperProps:{style:{width:navWidth}},variant:isSm?"permanent":"temporary",open:isSm?true:open,onClose:handleDrawerToggle})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{component:"main",sx:{flex:1,p:2},children:/*#__PURE__*/(0,jsx_runtime.jsx)(Outlet,{})})]})]});} ;// CONCATENATED MODULE: ./src/views/Options/SyncSetting.js @@ -63501,7 +63505,7 @@ Divider.muiSkipListHighlight = true; var MSG_GM_xmlHttpRequest="xmlHttpRequest";var MSG_GM_setValue="setValue";var MSG_GM_getValue="getValue";var MSG_GM_deleteValue="deleteValue";var MSG_GM_info="info";/** * 注入页面的脚本,请求并接受GM接口信息 * @param {*} param0 - */var injectScript=function injectScript(ping){window.APP_INFO={name:"KISS Translator",version:"1.7.15",eventName:ping};};/** + */var injectScript=function injectScript(ping){window.APP_INFO={name:"KISS Translator",version:"1.7.16",eventName:ping};};/** * 适配GM脚本 */var adaptScript=function adaptScript(ping){var promiseGM=function promiseGM(action,args){var timeout=arguments.length>2&&arguments[2]!==undefined?arguments[2]:5000;return new Promise(function(resolve,reject){var pong=genEventName();var handleEvent=function handleEvent(e){window.removeEventListener(pong,handleEvent);var _e$detail=e.detail,data=_e$detail.data,error=_e$detail.error;if(error){reject(new Error(error));}else{resolve(data);}};window.addEventListener(pong,handleEvent);window.dispatchEvent(new CustomEvent(ping,{detail:{action:action,args:args,pong:pong}}));setTimeout(function(){window.removeEventListener(pong,handleEvent);reject(new Error("timeout"));},timeout);});};window.KISS_GM={fetch:function fetch(input,init){return promiseGM(MSG_GM_xmlHttpRequest,{input:input,init:init});},setValue:function setValue(key,val){return promiseGM(MSG_GM_setValue,{key:key,val:val});},getValue:function getValue(key){return promiseGM(MSG_GM_getValue,{key:key});},deleteValue:function deleteValue(key){return promiseGM(MSG_GM_deleteValue,{key:key});},getInfo:function(){var _getInfo=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(){return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(window.GM_info){_context.next=4;break;}_context.next=3;return promiseGM(MSG_GM_info);case 3:window.GM_info=_context.sent;case 4:return _context.abrupt("return",window.GM_info);case 5:case"end":return _context.stop();}},_callee);}));function getInfo(){return _getInfo.apply(this,arguments);}return getInfo;}()};};/** * 监听并回应页面对GM接口的请求 @@ -63511,7 +63515,7 @@ var MSG_GM_xmlHttpRequest="xmlHttpRequest";var MSG_GM_setValue="setValue";var MS function useApi(translator){var _useSetting=useSetting(),setting=_useSetting.setting,updateSetting=_useSetting.updateSetting;var transApis=(setting===null||setting===void 0?void 0:setting.transApis)||DEFAULT_TRANS_APIS;var updateApi=(0,react.useCallback)(/*#__PURE__*/function(){var _ref=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(obj){var api;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:api=transApis[translator]||{};Object.assign(transApis,(0,defineProperty/* default */.Z)({},translator,_objectSpread2(_objectSpread2({},api),obj)));_context.next=4;return updateSetting({transApis:transApis});case 4:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}(),[translator,transApis,updateSetting]);var resetApi=(0,react.useCallback)(/*#__PURE__*/asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(){return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:Object.assign(transApis,(0,defineProperty/* default */.Z)({},translator,DEFAULT_TRANS_APIS[translator]));_context2.next=3;return updateSetting({transApis:transApis});case 3:case"end":return _context2.stop();}},_callee2);})),[translator,transApis,updateSetting]);return{api:transApis[translator]||{},updateApi:updateApi,resetApi:resetApi};} ;// CONCATENATED MODULE: ./src/views/Options/Apis.js function TestButton(_ref){var translator=_ref.translator,api=_ref.api;var i18n=useI18n();var alert=useAlert();var _useState=(0,react.useState)(false),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),loading=_useState2[0],setLoading=_useState2[1];var handleApiTest=/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(){var _yield$apiTranslate,_yield$apiTranslate2,text;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.prev=0;setLoading(true);_context.next=4;return apiTranslate({translator:translator,text:"hello world",fromLang:"en",toLang:"zh-CN",apiSetting:api,useCache:false});case 4:_yield$apiTranslate=_context.sent;_yield$apiTranslate2=(0,slicedToArray/* default */.Z)(_yield$apiTranslate,1);text=_yield$apiTranslate2[0];if(text){_context.next=9;break;}throw new Error("empty reault");case 9:alert.success(i18n("test_success"));_context.next=15;break;case 12:_context.prev=12;_context.t0=_context["catch"](0);// alert.error(`${i18n("test_failed")}: ${err.message}`); -alert.error(/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)("div",{children:"".concat(i18n("test_failed"),": ").concat(_context.t0.message)}),/*#__PURE__*/(0,jsx_runtime.jsx)("pre",{style:{maxWidth:400,overflow:"auto"},children:JSON.stringify(_context.t0.cause||{},null,2)})]}));case 15:_context.prev=15;setLoading(false);return _context.finish(15);case 18:case"end":return _context.stop();}},_callee,null,[[0,12,15,18]]);}));return function handleApiTest(){return _ref2.apply(this,arguments);};}();if(loading){return/*#__PURE__*/(0,jsx_runtime.jsx)(CircularProgress_CircularProgress,{size:16});}return/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{size:"small",variant:"contained",onClick:handleApiTest,children:i18n("click_test")});}function ApiFields(_ref3){var translator=_ref3.translator;var i18n=useI18n();var _useApi=useApi(translator),api=_useApi.api,updateApi=_useApi.updateApi,resetApi=_useApi.resetApi;var _api$url=api.url,url=_api$url===void 0?"":_api$url,_api$key=api.key,key=_api$key===void 0?"":_api$key,_api$model=api.model,model=_api$model===void 0?"":_api$model,_api$prompt=api.prompt,prompt=_api$prompt===void 0?"":_api$prompt;var handleChange=function handleChange(e){var _e$target=e.target,name=_e$target.name,value=_e$target.value;updateApi((0,defineProperty/* default */.Z)({},name,value));};var buildinTranslators=[OPT_TRANS_MICROSOFT,OPT_TRANS_DEEPLFREE,OPT_TRANS_BAIDU,OPT_TRANS_TENCENT];return/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:3,children:[!buildinTranslators.includes(translator)&&/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:"URL",name:"url",value:url,onChange:handleChange}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:"KEY",name:"key",value:key,onChange:handleChange})]}),(translator===OPT_TRANS_OPENAI||translator===OPT_TRANS_GEMINI)&&/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:"MODEL",name:"model",value:model,onChange:handleChange}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:"PROMPT",name:"prompt",value:prompt,onChange:handleChange,multiline:true})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(TestButton,{translator:translator,api:api}),!buildinTranslators.includes(translator)&&/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{size:"small",variant:"outlined",onClick:function onClick(){resetApi();},children:i18n("restore_default")})]}),translator===OPT_TRANS_CUSTOMIZE&&/*#__PURE__*/(0,jsx_runtime.jsx)("pre",{children:i18n("custom_api_help")})]});}function ApiAccordion(_ref4){var translator=_ref4.translator;var _useState3=(0,react.useState)(false),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),expanded=_useState4[0],setExpanded=_useState4[1];var handleChange=function handleChange(e){setExpanded(function(pre){return!pre;});};return/*#__PURE__*/(0,jsx_runtime.jsxs)(Accordion_Accordion,{expanded:expanded,onChange:handleChange,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(AccordionSummary_AccordionSummary,{expandIcon:/*#__PURE__*/(0,jsx_runtime.jsx)(ExpandMore/* default */.Z,{}),children:/*#__PURE__*/(0,jsx_runtime.jsx)(Typography_Typography,{children:translator})}),/*#__PURE__*/(0,jsx_runtime.jsx)(AccordionDetails_AccordionDetails,{children:expanded&&/*#__PURE__*/(0,jsx_runtime.jsx)(ApiFields,{translator:translator})})]});}function Apis(){var i18n=useI18n();return/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:3,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Alert_Alert,{severity:"info",children:/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:URL_KISS_PROXY,target:"_blank",children:i18n("about_api_proxy")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{children:OPT_TRANS_ALL.map(function(translator){return/*#__PURE__*/(0,jsx_runtime.jsx)(ApiAccordion,{translator:translator},translator);})})]})});} +alert.error(/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)("div",{children:"".concat(i18n("test_failed"),": ").concat(_context.t0.message)}),/*#__PURE__*/(0,jsx_runtime.jsx)("pre",{style:{maxWidth:400,overflow:"auto"},children:JSON.stringify(_context.t0.cause||{},null,2)})]}));case 15:_context.prev=15;setLoading(false);return _context.finish(15);case 18:case"end":return _context.stop();}},_callee,null,[[0,12,15,18]]);}));return function handleApiTest(){return _ref2.apply(this,arguments);};}();if(loading){return/*#__PURE__*/(0,jsx_runtime.jsx)(CircularProgress_CircularProgress,{size:16});}return/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{size:"small",variant:"contained",onClick:handleApiTest,children:i18n("click_test")});}function ApiFields(_ref3){var translator=_ref3.translator;var i18n=useI18n();var _useApi=useApi(translator),api=_useApi.api,updateApi=_useApi.updateApi,resetApi=_useApi.resetApi;var _api$url=api.url,url=_api$url===void 0?"":_api$url,_api$key=api.key,key=_api$key===void 0?"":_api$key,_api$model=api.model,model=_api$model===void 0?"":_api$model,_api$prompt=api.prompt,prompt=_api$prompt===void 0?"":_api$prompt;var handleChange=function handleChange(e){var _e$target=e.target,name=_e$target.name,value=_e$target.value;updateApi((0,defineProperty/* default */.Z)({},name,value));};var buildinTranslators=[OPT_TRANS_MICROSOFT,OPT_TRANS_DEEPLFREE,OPT_TRANS_BAIDU,OPT_TRANS_TENCENT];var mulkeysTranslators=[OPT_TRANS_DEEPL,OPT_TRANS_OPENAI,OPT_TRANS_GEMINI,OPT_TRANS_CLOUDFLAREAI];return/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:3,children:[!buildinTranslators.includes(translator)&&/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:"URL",name:"url",value:url,onChange:handleChange}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:"KEY",name:"key",value:key,onChange:handleChange,multiline:mulkeysTranslators.includes(translator),helperText:mulkeysTranslators.includes(translator)?i18n("mulkeys_help"):""})]}),(translator===OPT_TRANS_OPENAI||translator===OPT_TRANS_GEMINI)&&/*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:"MODEL",name:"model",value:model,onChange:handleChange}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:"PROMPT",name:"prompt",value:prompt,onChange:handleChange,multiline:true})]}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{direction:"row",spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(TestButton,{translator:translator,api:api}),!buildinTranslators.includes(translator)&&/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{size:"small",variant:"outlined",onClick:function onClick(){resetApi();},children:i18n("restore_default")})]}),translator===OPT_TRANS_CUSTOMIZE&&/*#__PURE__*/(0,jsx_runtime.jsx)("pre",{children:i18n("custom_api_help")})]});}function ApiAccordion(_ref4){var translator=_ref4.translator;var _useState3=(0,react.useState)(false),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),expanded=_useState4[0],setExpanded=_useState4[1];var handleChange=function handleChange(e){setExpanded(function(pre){return!pre;});};return/*#__PURE__*/(0,jsx_runtime.jsxs)(Accordion_Accordion,{expanded:expanded,onChange:handleChange,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(AccordionSummary_AccordionSummary,{expandIcon:/*#__PURE__*/(0,jsx_runtime.jsx)(ExpandMore/* default */.Z,{}),children:/*#__PURE__*/(0,jsx_runtime.jsx)(Typography_Typography,{children:translator})}),/*#__PURE__*/(0,jsx_runtime.jsx)(AccordionDetails_AccordionDetails,{children:expanded&&/*#__PURE__*/(0,jsx_runtime.jsx)(ApiFields,{translator:translator})})]});}function Apis(){var i18n=useI18n();return/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:3,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Alert_Alert,{severity:"info",children:/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:URL_KISS_PROXY,target:"_blank",children:i18n("about_api_proxy")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{children:OPT_TRANS_ALL.map(function(translator){return/*#__PURE__*/(0,jsx_runtime.jsx)(ApiAccordion,{translator:translator},translator);})})]})});} ;// CONCATENATED MODULE: ./src/hooks/WebfixRules.js var DEFAULT_WFRULES=[];/** * 修复规则 hook @@ -63530,7 +63534,7 @@ function InputSetting(){var i18n=useI18n();var _useInputRule=useInputRule(),inpu ;// CONCATENATED MODULE: ./src/hooks/Tranbox.js function useTranbox(){var _useSetting=useSetting(),setting=_useSetting.setting,updateSetting=_useSetting.updateSetting;var tranboxSetting=(setting===null||setting===void 0?void 0:setting.tranboxSetting)||DEFAULT_TRANBOX_SETTING;var updateTranbox=(0,react.useCallback)(/*#__PURE__*/function(){var _ref=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(obj){return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:Object.assign(tranboxSetting,obj);_context.next=3;return updateSetting({tranboxSetting:tranboxSetting});case 3:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}(),[tranboxSetting,updateSetting]);return{tranboxSetting:tranboxSetting,updateTranbox:updateTranbox};} ;// CONCATENATED MODULE: ./src/views/Options/Tranbox.js -function Tranbox(){var i18n=useI18n();var _useTranbox=useTranbox(),tranboxSetting=_useTranbox.tranboxSetting,updateTranbox=_useTranbox.updateTranbox;var handleChange=function handleChange(e){e.preventDefault();var _e$target=e.target,name=_e$target.name,value=_e$target.value;switch(name){case"btnOffsetX":value=limitNumber(value,0,100);break;case"btnOffsetY":value=limitNumber(value,0,100);break;default:}updateTranbox((0,defineProperty/* default */.Z)({},name,value));};var handleShortcutInput=(0,react.useCallback)(function(val){updateTranbox({tranboxShortcut:val});},[updateTranbox]);var transOpen=tranboxSetting.transOpen,translator=tranboxSetting.translator,fromLang=tranboxSetting.fromLang,toLang=tranboxSetting.toLang,_tranboxSetting$toLan=tranboxSetting.toLang2,toLang2=_tranboxSetting$toLan===void 0?"en":_tranboxSetting$toLan,tranboxShortcut=tranboxSetting.tranboxShortcut,btnOffsetX=tranboxSetting.btnOffsetX,btnOffsetY=tranboxSetting.btnOffsetY,_tranboxSetting$hideT=tranboxSetting.hideTranBtn,hideTranBtn=_tranboxSetting$hideT===void 0?false:_tranboxSetting$hideT;return/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:3,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(FormControlLabel_FormControlLabel,{control:/*#__PURE__*/(0,jsx_runtime.jsx)(Switch_Switch,{size:"small",name:"transOpen",checked:transOpen,onChange:function onChange(){updateTranbox({transOpen:!transOpen});}}),label:i18n("toggle_selection_translate")}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,size:"small",name:"translator",value:translator,label:i18n("translate_service"),onChange:handleChange,children:OPT_TRANS_ALL.map(function(item){return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:item,children:item},item);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,size:"small",name:"fromLang",value:fromLang,label:i18n("from_lang"),onChange:handleChange,children:OPT_LANGS_FROM.map(function(_ref){var _ref2=(0,slicedToArray/* default */.Z)(_ref,2),lang=_ref2[0],name=_ref2[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,size:"small",name:"toLang",value:toLang,label:i18n("to_lang"),onChange:handleChange,children:OPT_LANGS_TO.map(function(_ref3){var _ref4=(0,slicedToArray/* default */.Z)(_ref3,2),lang=_ref4[0],name=_ref4[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,size:"small",name:"toLang2",value:toLang2,label:i18n("to_lang2"),helperText:i18n("to_lang2_helper"),onChange:handleChange,children:[["none","None"]].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_TO)).map(function(_ref5){var _ref6=(0,slicedToArray/* default */.Z)(_ref5,2),lang=_ref6[0],name=_ref6[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:i18n("tranbtn_offset_x"),type:"number",name:"btnOffsetX",defaultValue:btnOffsetX,onChange:handleChange}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:i18n("tranbtn_offset_y"),type:"number",name:"btnOffsetY",defaultValue:btnOffsetY,onChange:handleChange}),/*#__PURE__*/(0,jsx_runtime.jsxs)(TextField_TextField,{select:true,size:"small",name:"hideTranBtn",value:hideTranBtn,label:i18n("hide_tran_button"),onChange:handleChange,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:false,children:i18n("show")}),/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:true,children:i18n("hide")})]}),/*#__PURE__*/(0,jsx_runtime.jsx)(ShortcutInput,{value:tranboxShortcut,onChange:handleShortcutInput,label:i18n("trigger_tranbox_shortcut")})]})});} +function Tranbox(){var i18n=useI18n();var _useTranbox=useTranbox(),tranboxSetting=_useTranbox.tranboxSetting,updateTranbox=_useTranbox.updateTranbox;var handleChange=function handleChange(e){e.preventDefault();var _e$target=e.target,name=_e$target.name,value=_e$target.value;switch(name){case"btnOffsetX":value=limitNumber(value,0,100);break;case"btnOffsetY":value=limitNumber(value,0,100);break;default:}updateTranbox((0,defineProperty/* default */.Z)({},name,value));};var handleShortcutInput=(0,react.useCallback)(function(val){updateTranbox({tranboxShortcut:val});},[updateTranbox]);var transOpen=tranboxSetting.transOpen,translator=tranboxSetting.translator,fromLang=tranboxSetting.fromLang,toLang=tranboxSetting.toLang,_tranboxSetting$toLan=tranboxSetting.toLang2,toLang2=_tranboxSetting$toLan===void 0?"en":_tranboxSetting$toLan,tranboxShortcut=tranboxSetting.tranboxShortcut,btnOffsetX=tranboxSetting.btnOffsetX,btnOffsetY=tranboxSetting.btnOffsetY,_tranboxSetting$hideT=tranboxSetting.hideTranBtn,hideTranBtn=_tranboxSetting$hideT===void 0?false:_tranboxSetting$hideT;return/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:3,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(FormControlLabel_FormControlLabel,{control:/*#__PURE__*/(0,jsx_runtime.jsx)(Switch_Switch,{size:"small",name:"transOpen",checked:transOpen,onChange:function onChange(){updateTranbox({transOpen:!transOpen});}}),label:i18n("toggle_selection_translate")}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,size:"small",name:"translator",value:translator,label:i18n("translate_service"),onChange:handleChange,children:OPT_TRANS_ALL.map(function(item){return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:item,children:item},item);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,size:"small",name:"fromLang",value:fromLang,label:i18n("from_lang"),onChange:handleChange,children:OPT_LANGS_FROM.map(function(_ref){var _ref2=(0,slicedToArray/* default */.Z)(_ref,2),lang=_ref2[0],name=_ref2[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,size:"small",name:"toLang",value:toLang,label:i18n("to_lang"),onChange:handleChange,children:OPT_LANGS_TO.map(function(_ref3){var _ref4=(0,slicedToArray/* default */.Z)(_ref3,2),lang=_ref4[0],name=_ref4[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{select:true,size:"small",name:"toLang2",value:toLang2,label:i18n("to_lang2"),helperText:i18n("to_lang2_helper"),onChange:handleChange,children:[["none","None"]].concat((0,toConsumableArray/* default */.Z)(OPT_LANGS_TO)).map(function(_ref5){var _ref6=(0,slicedToArray/* default */.Z)(_ref5,2),lang=_ref6[0],name=_ref6[1];return/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:lang,children:name},lang);})}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:i18n("tranbtn_offset_x"),type:"number",name:"btnOffsetX",defaultValue:btnOffsetX,onChange:handleChange}),/*#__PURE__*/(0,jsx_runtime.jsx)(TextField_TextField,{size:"small",label:i18n("tranbtn_offset_y"),type:"number",name:"btnOffsetY",defaultValue:btnOffsetY,onChange:handleChange}),/*#__PURE__*/(0,jsx_runtime.jsxs)(TextField_TextField,{select:true,size:"small",name:"hideTranBtn",value:hideTranBtn,label:i18n("hide_tran_button"),onChange:handleChange,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:false,children:i18n("show")}),/*#__PURE__*/(0,jsx_runtime.jsx)(MenuItem_MenuItem,{value:true,children:i18n("hide")})]}),!client_isExt&&/*#__PURE__*/(0,jsx_runtime.jsx)(ShortcutInput,{value:tranboxShortcut,onChange:handleShortcutInput,label:i18n("trigger_tranbox_shortcut")})]})});} ;// CONCATENATED MODULE: ./src/hooks/FavWords.js function useFavWords(){var _useState=(0,react.useState)(false),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),loading=_useState2[0],setLoading=_useState2[1];var _useState3=(0,react.useState)({}),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),favWords=_useState4[0],setFavWords=_useState4[1];var _useSyncMeta=useSyncMeta(),updateSyncMeta=_useSyncMeta.updateSyncMeta;var toggleFav=(0,react.useCallback)(/*#__PURE__*/function(){var _ref=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(word){var favs;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:favs=_objectSpread2({},favWords);if(favs[word]){delete favs[word];}else{favs[word]={createdAt:Date.now()};}_context.next=4;return setWords(favs);case 4:_context.next=6;return updateSyncMeta(KV_WORDS_KEY);case 6:_context.next=8;return trySyncWords();case 8:setFavWords(favs);case 9:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}(),[updateSyncMeta,favWords]);var mergeWords=(0,react.useCallback)(/*#__PURE__*/function(){var _ref2=asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee2(newWords){var favs;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:favs=_objectSpread2({},favWords);newWords.forEach(function(word){if(!favs[word]){favs[word]={createdAt:Date.now()};}});_context2.next=4;return setWords(favs);case 4:_context2.next=6;return updateSyncMeta(KV_WORDS_KEY);case 6:_context2.next=8;return trySyncWords();case 8:setFavWords(favs);case 9:case"end":return _context2.stop();}},_callee2);}));return function(_x2){return _ref2.apply(this,arguments);};}(),[updateSyncMeta,favWords]);var clearWords=(0,react.useCallback)(/*#__PURE__*/asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee3(){return regeneratorRuntime_regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.next=2;return setWords({});case 2:_context3.next=4;return updateSyncMeta(KV_WORDS_KEY);case 4:_context3.next=6;return trySyncWords();case 6:setFavWords({});case 7:case"end":return _context3.stop();}},_callee3);})),[updateSyncMeta]);(0,react.useEffect)(function(){asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee4(){var _favWords;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:_context4.prev=0;setLoading(true);_context4.next=4;return trySyncWords();case 4:_context4.next=6;return getWordsWithDefault();case 6:_favWords=_context4.sent;setFavWords(_favWords);_context4.next=13;break;case 10:_context4.prev=10;_context4.t0=_context4["catch"](0);console.log("[query fav]",_context4.t0);case 13:_context4.prev=13;setLoading(false);return _context4.finish(13);case 16:case"end":return _context4.stop();}},_callee4,null,[[0,10,13,16]]);}))();},[]);return{loading:loading,favWords:favWords,toggleFav:toggleFav,mergeWords:mergeWords,clearWords:clearWords};} ;// CONCATENATED MODULE: ./node_modules/.pnpm/@mui+material@5.14.10_@emotion+react@11.11.1_@emotion+styled@11.11.0_@types+react@18.2.22_react-dom@18.2.0_react@18.2.0/node_modules/@mui/material/internal/svg-icons/Cancel.js @@ -63916,9 +63920,9 @@ function DictField(_ref){var word=_ref.word;var _useState=(0,react.useState)(nul ;// CONCATENATED MODULE: ./src/views/Options/index.js function Options(){var _useState=(0,react.useState)(""),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),error=_useState2[0],setError=_useState2[1];var _useState3=(0,react.useState)(false),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),ready=_useState4[0],setReady=_useState4[1];(0,react.useEffect)(function(){asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(){var i,_window,_window$APP_INFO,_window$APP_INFO2,version,eventName;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(!isGm){_context.next=21;break;}// 等待GM注入 i=0;case 2:if(!(((_window=window)===null||_window===void 0?void 0:(_window$APP_INFO=_window.APP_INFO)===null||_window$APP_INFO===void 0?void 0:_window$APP_INFO.name)==="KISS Translator")){_context.next=12;break;}_window$APP_INFO2=window.APP_INFO,version=_window$APP_INFO2.version,eventName=_window$APP_INFO2.eventName;// 检查版本是否一致 -if(!(version!=="1.7.15")){_context.next=7;break;}setError("The version of the local script(v".concat(version,") is not the latest version(v").concat("1.7.15","). \u672C\u5730\u811A\u672C\u4E4B\u7248\u672C(v").concat(version,")\u975E\u6700\u65B0\u7248(v").concat("1.7.15",")\u3002"));return _context.abrupt("break",19);case 7:if(eventName){// 注入GM接口 +if(!(version!=="1.7.16")){_context.next=7;break;}setError("The version of the local script(v".concat(version,") is not the latest version(v").concat("1.7.16","). \u672C\u5730\u811A\u672C\u4E4B\u7248\u672C(v").concat(version,")\u975E\u6700\u65B0\u7248(v").concat("1.7.16",")\u3002"));return _context.abrupt("break",19);case 7:if(eventName){// 注入GM接口 adaptScript(eventName);}// 同步数据 -_context.next=10;return trySyncSettingAndRules();case 10:setReady(true);return _context.abrupt("break",19);case 12:if(!(++i>8)){_context.next=15;break;}setError("Time out. Please confirm whether to install or enable KISS Translator GreaseMonkey script? 连接超时,请检查是否安装或启用简约翻译油猴脚本。");return _context.abrupt("break",19);case 15:_context.next=17;return sleep(1000);case 17:_context.next=2;break;case 19:_context.next=24;break;case 21:_context.next=23;return trySyncSettingAndRules();case 23:setReady(true);case 24:case"end":return _context.stop();}},_callee);}))();},[]);if(error){return/*#__PURE__*/(0,jsx_runtime.jsxs)("center",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://github.com/fishjar/kiss-translator",children:"KISS Translator v".concat("1.7.15")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Alert_Alert,{severity:"error",children:error}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://fishjar.github.io/kiss-translator/kiss-translator.user.js",children:"Install/Update Userscript for Tampermonkey/Violentmonkey"}),/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js",children:"Install/Update Userscript for iOS Safari"})]})]});}if(!ready){return/*#__PURE__*/(0,jsx_runtime.jsxs)("center",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://github.com/fishjar/kiss-translator",children:"KISS Translator v".concat("1.7.15")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(CircularProgress_CircularProgress,{})]});}return/*#__PURE__*/(0,jsx_runtime.jsx)(SettingProvider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Theme,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(AlertProvider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(HashRouter,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Routes,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Route,{path:"/",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Layout,{}),children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{index:true,element:/*#__PURE__*/(0,jsx_runtime.jsx)(Settings,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"rules",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Rules,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"input",element:/*#__PURE__*/(0,jsx_runtime.jsx)(InputSetting,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"tranbox",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Tranbox,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"apis",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Apis,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"sync",element:/*#__PURE__*/(0,jsx_runtime.jsx)(SyncSetting,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"webfix",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Webfix,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"words",element:/*#__PURE__*/(0,jsx_runtime.jsx)(FavWords,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"about",element:/*#__PURE__*/(0,jsx_runtime.jsx)(About,{})})]})})})})})});} +_context.next=10;return trySyncSettingAndRules();case 10:setReady(true);return _context.abrupt("break",19);case 12:if(!(++i>8)){_context.next=15;break;}setError("Time out. Please confirm whether to install or enable KISS Translator GreaseMonkey script? 连接超时,请检查是否安装或启用简约翻译油猴脚本。");return _context.abrupt("break",19);case 15:_context.next=17;return sleep(1000);case 17:_context.next=2;break;case 19:_context.next=24;break;case 21:_context.next=23;return trySyncSettingAndRules();case 23:setReady(true);case 24:case"end":return _context.stop();}},_callee);}))();},[]);if(error){return/*#__PURE__*/(0,jsx_runtime.jsxs)("center",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://github.com/fishjar/kiss-translator",children:"KISS Translator v".concat("1.7.16")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Alert_Alert,{severity:"error",children:error}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://fishjar.github.io/kiss-translator/kiss-translator.user.js",children:"Install/Update Userscript for Tampermonkey/Violentmonkey"}),/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js",children:"Install/Update Userscript for iOS Safari"})]})]});}if(!ready){return/*#__PURE__*/(0,jsx_runtime.jsxs)("center",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://github.com/fishjar/kiss-translator",children:"KISS Translator v".concat("1.7.16")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(CircularProgress_CircularProgress,{})]});}return/*#__PURE__*/(0,jsx_runtime.jsx)(SettingProvider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Theme,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(AlertProvider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(HashRouter,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Routes,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Route,{path:"/",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Layout,{}),children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{index:true,element:/*#__PURE__*/(0,jsx_runtime.jsx)(Settings,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"rules",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Rules,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"input",element:/*#__PURE__*/(0,jsx_runtime.jsx)(InputSetting,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"tranbox",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Tranbox,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"apis",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Apis,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"sync",element:/*#__PURE__*/(0,jsx_runtime.jsx)(SyncSetting,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"webfix",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Webfix,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"words",element:/*#__PURE__*/(0,jsx_runtime.jsx)(FavWords,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"about",element:/*#__PURE__*/(0,jsx_runtime.jsx)(About,{})})]})})})})})});} ;// CONCATENATED MODULE: ./src/options.js var options_root=client.createRoot(document.getElementById("root"));options_root.render(/*#__PURE__*/(0,jsx_runtime.jsx)(react.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Options,{})})); }(); diff --git a/version.txt b/version.txt index 0683f2ae..33e7e629 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.7.15 \ No newline at end of file +1.7.16 \ No newline at end of file