all-search 全搜,搜索引擎快捷跳转,支持任意网站展示

2022-11-27更新 搜索辅助增强,任意跳转,无需代码适配,支持任意网站展示

目前为 2022-11-27 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name all-search 全搜,搜索引擎快捷跳转,支持任意网站展示
  3. // @version 1.3.14
  4. // @description 2022-11-27更新 搜索辅助增强,任意跳转,无需代码适配,支持任意网站展示
  5. // @author endday
  6. // @license GPL-3.0-only
  7. // @homepageURL https://github.com/endday/all-search
  8. // @supportURL
  9. // @noframes
  10. // @include *
  11. // @require https://unpkg.com/vue@3.2.33/dist/vue.global.prod.js
  12. // @require https://unpkg.com/@popperjs/core@2.11.6/dist/umd/popper-lite.min.js
  13. // @run-at document-body
  14. // @grant GM_getValue
  15. // @grant GM_setValue
  16. // @grant GM_addStyle
  17. // @grant GM_getResourceText
  18.  
  19. // @namespace https://github.com/endday
  20. // ==/UserScript==
  21.  
  22. (function() {
  23. "use strict";
  24. var name$1 = "all-search";
  25. var version$1 = "1.3.14";
  26. var keywords = [ "searchEngineJump", "tool", "tamperMonkey", "web", "javascript", "vue3" ];
  27. var description = "A top fixed menu that allows you to jump between various search engines, build based on Vue, and use rollup.";
  28. var author = "endday";
  29. var homepage = "https://github.com/endday/all-search";
  30. var license = "GPL-3.0-only";
  31. var repository = {
  32. type: "git",
  33. url: "git@github.com:endday/all-search.git"
  34. };
  35. var scripts = {
  36. serve: "vue-cli-service serve --fix",
  37. tmServe: "vue-cli-service serve --fix --tm",
  38. build: "vue-cli-service build",
  39. lint: "vue-cli-service lint",
  40. pretmBuild: "npm run lint",
  41. tmDev: "cross-env NODE_ENV=development rollup -c -w",
  42. tmBuild: "cross-env NODE_ENV=production rollup -c",
  43. prepare: "husky install"
  44. };
  45. var dependencies = {
  46. "@element-plus/icons-vue": "^2.0.4",
  47. "@popperjs/core": "^2.9.2",
  48. axios: "^0.21.1",
  49. "core-js": "^3.9.1",
  50. "element-plus": "^2.2.22",
  51. jsoneditor: "^9.9.0",
  52. "resize-observer-polyfill": "^1.5.1",
  53. vue: "^3.2.36",
  54. "vue-draggable-next": "^2.0.1",
  55. "vue-router": "^4.0.5"
  56. };
  57. var devDependencies = {
  58. "@commitlint/cli": "^17.1.2",
  59. "@commitlint/config-conventional": "^17.1.0",
  60. "@rollup/plugin-babel": "^5.3.1",
  61. "@rollup/plugin-commonjs": "^22.0.0",
  62. "@rollup/plugin-json": "^4.0.3",
  63. "@rollup/plugin-node-resolve": "^13.3.0",
  64. "@rollup/plugin-replace": "^4.0.0",
  65. "@vitejs/plugin-vue": "^2.3.3",
  66. "@vue/cli-plugin-babel": "^5.0.0",
  67. "@vue/cli-plugin-eslint": "^5.0.0",
  68. "@vue/cli-service": "^5.0.0",
  69. "@vue/compiler-sfc": "^3.0.7",
  70. autoprefixer: "^10.4.7",
  71. "babel-eslint": "^10.1.0",
  72. "babel-plugin-import": "^1.13.3",
  73. "cross-env": "^7.0.3",
  74. eslint: "^7.32.0",
  75. "eslint-plugin-vue": "^7.7.0",
  76. husky: "^8.0.1",
  77. postcss: "^8.4.13",
  78. rollup: "^2.72.1",
  79. "rollup-plugin-delete": "^1.2.0",
  80. "rollup-plugin-external-globals": "^0.6.1",
  81. "rollup-plugin-styles": "^4.0.0",
  82. "rollup-plugin-terser": "^5.2.0",
  83. sass: "^1.32.8",
  84. "sass-loader": "^10.1.1",
  85. vite: "^2.6.7"
  86. };
  87. var pkg = {
  88. name: name$1,
  89. version: version$1,
  90. keywords: keywords,
  91. description: description,
  92. author: author,
  93. homepage: homepage,
  94. license: license,
  95. repository: repository,
  96. scripts: scripts,
  97. dependencies: dependencies,
  98. devDependencies: devDependencies
  99. };
  100. Vue.reactive({
  101. tmVersion: ""
  102. });
  103. const version = pkg.version;
  104. function getQueryString(name, url) {
  105. url = url || window.location.href;
  106. const r = new RegExp("(\\?|#|&)" + name + "=([^&#]*)(&|#|$)");
  107. const m = url.match(r);
  108. return decodeURIComponent(!m ? "" : m[2]);
  109. }
  110. function getName(name) {
  111. if (name) {
  112. return `__allSearch__${name}`;
  113. }
  114. return null;
  115. }
  116. function isJson(str) {
  117. if (typeof str !== "string") {
  118. return false;
  119. }
  120. const char = str.charAt(0);
  121. if (char !== "[" && char !== "{") {
  122. return false;
  123. }
  124. try {
  125. return typeof JSON.parse(str) === "object";
  126. } catch (e) {
  127. return false;
  128. }
  129. }
  130. let getSession = function(name) {
  131. const formatName = getName(name);
  132. let item;
  133. if (window.GM_getValue) {
  134. item = window.GM_getValue(formatName);
  135. } else {
  136. item = window.localStorage.getItem(formatName);
  137. }
  138. if (item) {
  139. if (isJson(item)) {
  140. try {
  141. return JSON.parse(item);
  142. } catch (e) {
  143. return item;
  144. }
  145. } else {
  146. return item;
  147. }
  148. }
  149. return null;
  150. };
  151. let setSession = function(name, value) {
  152. const formatName = getName(name);
  153. if (window.GM_setValue) {
  154. window.GM_setValue(formatName, value);
  155. } else {
  156. const item = JSON.stringify(value);
  157. if (item) {
  158. window.localStorage.setItem(formatName, item);
  159. }
  160. }
  161. };
  162. function getAsRoot() {
  163. return document.getElementById("all-search");
  164. }
  165. function createAsRoot() {
  166. const el = document.createElement("div");
  167. el.id = "all-search";
  168. return el;
  169. }
  170. const scriptLoaded = getName("script-loaded");
  171. const pageLoaded = getName("page-loaded");
  172. function passTmMethods() {
  173. const emit = function() {
  174. document.dispatchEvent(new CustomEvent(scriptLoaded, {
  175. detail: {
  176. version: version,
  177. getSession: getSession,
  178. setSession: setSession
  179. }
  180. }));
  181. };
  182. document.addEventListener(pageLoaded, emit);
  183. emit();
  184. }
  185. const isMobile = function() {
  186. return /mobile|android|webos|iphone|ipod|blackberry|iphone os|ipad/i.test(navigator.userAgent);
  187. };
  188. function delAsDataSet(item) {
  189. if (item.dataset) {
  190. delete item.dataset.asMarginTop;
  191. delete item.dataset.asTransform;
  192. delete item.dataset.asBorderTop;
  193. }
  194. }
  195. function getParent(el) {
  196. let current = el;
  197. while (current.offsetParent) {
  198. if (current.offsetParent.tagName === "BODY") {
  199. return current;
  200. } else {
  201. current = current.offsetParent;
  202. }
  203. }
  204. const style = window.getComputedStyle(current);
  205. if (style.position !== "fixed") {
  206. delAsDataSet(current);
  207. return null;
  208. }
  209. return current;
  210. }
  211. function getRealFixedNode(item) {
  212. if (!item || !isElement(item)) {
  213. return null;
  214. }
  215. const style = window.getComputedStyle(item);
  216. const position = style.getPropertyValue("position");
  217. const display = style.getPropertyValue("display");
  218. if (display === "none") {
  219. return null;
  220. } else if (position === "fixed") {
  221. return item;
  222. } else if (position === "absolute") {
  223. return getParent(item);
  224. } else {
  225. return null;
  226. }
  227. }
  228. function isElement(obj) {
  229. return obj && obj instanceof Element && obj.nodeType === 1 && obj.tagName !== undefined;
  230. }
  231. function changeStyle(item) {
  232. if (!item || !isElement(item)) {
  233. return;
  234. }
  235. const style = window.getComputedStyle(item);
  236. const styleMap = item.computedStyleMap && item.computedStyleMap();
  237. const top = styleMap ? styleMap.get("top").value : null;
  238. if (top === "auto") {
  239. return;
  240. } else if (style.top === "0px") {
  241. item.style.top = "0px";
  242. }
  243. if (item.dataset.asMarginTop || item.dataset.asTransform || item.dataset.asBorderTop) {
  244. return;
  245. }
  246. const marginTop = style.marginTop;
  247. const transform = style.transform;
  248. const transition = style.transition;
  249. if (marginTop === "0px" && !transition.includes("margin")) {
  250. item.dataset.asHasSet = "asMarginTop";
  251. item.dataset.asMarginTop = "1";
  252. } else if (transform === "none") {
  253. item.dataset.asHasSet = "asTransform";
  254. item.dataset.asTransform = "1";
  255. } else {
  256. item.dataset.asHasSet = "asBorderTop";
  257. item.dataset.asBorderTop = "1";
  258. }
  259. }
  260. let isSelfChange = false;
  261. function getFixedNodeList(list, deep = false) {
  262. const weakSet = new WeakSet;
  263. const newList = [];
  264. const nodes = list.filter(item => item).map(item => {
  265. delAsDataSet(item);
  266. if (deep) {
  267. const nodes = Array.from(item.querySelectorAll("*"));
  268. nodes.map(item => {
  269. delAsDataSet(item);
  270. return getRealFixedNode(item);
  271. }).filter(item => item).forEach(item => {
  272. if (!weakSet.has(item)) {
  273. newList.push(item);
  274. weakSet.add(item);
  275. }
  276. });
  277. }
  278. return getRealFixedNode(item);
  279. }).filter(item => item);
  280. nodes.forEach(item => {
  281. if (!weakSet.has(item)) {
  282. newList.push(item);
  283. weakSet.add(item);
  284. }
  285. });
  286. return newList;
  287. }
  288. function fixedDomPosition() {
  289. const nodes = Array.from(document.body.querySelectorAll("*")).filter(item => item.tagName !== "STYLE");
  290. getFixedNodeList(nodes).forEach(item => {
  291. changeStyle(item);
  292. });
  293. }
  294. function mutationObserver() {
  295. const targetNode = document.body;
  296. const config = {
  297. attributes: true,
  298. childList: true,
  299. subtree: true,
  300. attributeFilter: [ "style", "class" ]
  301. };
  302. const callback = function(mutationsList) {
  303. if (isSelfChange) {
  304. isSelfChange = false;
  305. } else {
  306. isSelfChange = true;
  307. const root = getAsRoot();
  308. const filterNodes = mutationsList.filter(mutation => mutation.type === "attributes" && [ "style", "class", "id" ].includes(mutation.attributeName) || mutation.type === "childList" && mutation.addedNodes.length && ![ "BODY", "STYLE" ].includes(mutation.target.tagName) && !root.contains(mutation.target)).map(mutation => mutation.target);
  309. getFixedNodeList(filterNodes, true).forEach(item => {
  310. changeStyle(item);
  311. });
  312. }
  313. };
  314. const observer = new MutationObserver(callback);
  315. observer.observe(targetNode, config);
  316. }
  317. function initSpecialStyle() {
  318. fixedDomPosition();
  319. mutationObserver();
  320. }
  321. function withHookBefore(originalFn, hookFn) {
  322. return function() {
  323. if (hookFn.apply(this, arguments) === false) {
  324. return;
  325. }
  326. return originalFn.apply(this, arguments);
  327. };
  328. }
  329. function withHookAfter(originalFn, hookFn) {
  330. return function() {
  331. const output = originalFn.apply(this, arguments);
  332. hookFn.apply(this, arguments);
  333. return output;
  334. };
  335. }
  336. const protectStyle = function() {
  337. if (Node.prototype.__as_hooks__) {
  338. return;
  339. }
  340. Node.prototype.removeChild = withHookBefore(Node.prototype.removeChild, e => {
  341. if (e && e.tagName === "STYLE") {
  342. return !(e.classList.contains("as-icon") || e.classList.contains("as-style") || e.classList.contains("elPopover") || e.classList.contains("elScrollbar"));
  343. }
  344. return true;
  345. });
  346. Node.prototype.__as_hooks__ = true;
  347. };
  348. const changeBodyStyle = function(modeRef, remove = true) {
  349. const mode = Vue.unref(modeRef);
  350. const el = getAsRoot();
  351. el.classList.remove("body-vertical", "body-horizontal");
  352. if (!remove) {
  353. el.classList.add(`body-${mode}`);
  354. }
  355. };
  356. var search = [ {
  357. nameZh: "百度",
  358. url: "https://www.baidu.com/s?wd=%s&ie=utf-8"
  359. }, {
  360. nameZh: "谷歌",
  361. url: "https://www.google.com/search?q=%s&ie=utf-8&oe=utf-8"
  362. }, {
  363. nameZh: "必应",
  364. url: "https://cn.bing.com/search?q=%s"
  365. }, {
  366. nameZh: "DDG",
  367. url: "https://duckduckgo.com/?q=%s"
  368. }, {
  369. nameZh: "头条搜索",
  370. url: "https://so.toutiao.com/search?dvpf=pc&keyword=%s"
  371. }, {
  372. nameZh: "360",
  373. url: "https://www.so.com/s?ie=utf-8&q=%s"
  374. }, {
  375. nameZh: "搜狗",
  376. url: "https://www.sogou.com/web?query=%s"
  377. }, {
  378. nameZh: "Yandex",
  379. url: "https://yandex.com/search/?text=%s"
  380. } ];
  381. var translate = [ {
  382. nameZh: "百度翻译",
  383. url: "http://fanyi.baidu.com/#auto/zh/%s"
  384. }, {
  385. nameZh: "DeepL",
  386. url: "https://www.deepl.com/translator#zh/en/%s",
  387. icon: "https://www.deepl.com/img/favicon/favicon_96.png"
  388. }, {
  389. nameZh: "谷歌翻译",
  390. url: "https://translate.google.com/?q=%s"
  391. }, {
  392. nameZh: "有道词典",
  393. url: "http://dict.youdao.com/search?q=%s",
  394. icon: "https://shared.ydstatic.com/images/favicon.ico"
  395. }, {
  396. nameZh: "必应翻译",
  397. url: "http://cn.bing.com/dict/search?q=%s"
  398. } ];
  399. var developer = [ {
  400. nameZh: "开发者搜索",
  401. url: "https://kaifa.baidu.com/searchPage?wd=%s&module=SEARCH"
  402. }, {
  403. nameZh: "MDN",
  404. url: "https://developer.mozilla.org/zh-CN/search?q=%s"
  405. }, {
  406. nameZh: "stackoverflow",
  407. url: "https://stackoverflow.com/search?q=%s"
  408. }, {
  409. nameZh: "掘金",
  410. url: "https://juejin.cn/search?query=%s"
  411. }, {
  412. nameZh: "Can I Use",
  413. url: "http://caniuse.com/#search=%s",
  414. icon: "https://caniuse.com/img/favicon-128.png"
  415. }, {
  416. nameZh: "GitHub",
  417. url: "https://github.com/search?utf8=✓&q=%s"
  418. }, {
  419. nameZh: "w3c",
  420. url: "http://www.runoob.com/?s=%s"
  421. }, {
  422. nameZh: "GreasyFork",
  423. url: "https://gf.qytechs.cn/zh-CN/scripts?q=%s&utf8=✓",
  424. icon: "https://gf.qytechs.cn/packs/media/images/blacklogo96-b2384000fca45aa17e45eb417cbcbb59.png"
  425. } ];
  426. var video = [ {
  427. nameZh: "bilibili",
  428. url: "http://search.bilibili.com/all?keyword=%s"
  429. }, {
  430. nameZh: "腾讯视频",
  431. url: "https://v.qq.com/x/search/?q=%s"
  432. }, {
  433. nameZh: "爱奇艺",
  434. url: "http://so.iqiyi.com/so/q_%s",
  435. icon: "https://www.iqiyi.com/favicon.ico"
  436. }, {
  437. nameZh: "youtube",
  438. url: "https://www.youtube.com/results?search_query=%s"
  439. }, {
  440. nameZh: "优酷",
  441. url: "http://www.soku.com/search_video/q_%s",
  442. icon: "https://img.alicdn.com/tfs/TB1WeJ9Xrj1gK0jSZFuXXcrHpXa-195-195.png"
  443. }, {
  444. nameZh: "AcFun",
  445. url: "https://www.acfun.cn/search?keyword=%s"
  446. }, {
  447. nameZh: "搜狐",
  448. url: "http://so.tv.sohu.com/mts?wd=%s"
  449. }, {
  450. nameZh: "niconico",
  451. url: "http://www.nicovideo.jp/search/%s"
  452. } ];
  453. var music = [ {
  454. nameZh: "网易音乐",
  455. url: "http://music.163.com/#/search/m/?s=%s",
  456. icon: "https://s1.music.126.net/style/favicon.ico"
  457. }, {
  458. nameZh: "一听",
  459. url: "http://so.1ting.com/all.do?q=%s"
  460. }, {
  461. nameZh: "QQ音乐",
  462. url: "https://y.qq.com/portal/search.html#page=1&searchid=1&remoteplace=txt.yqq.top&t=song&w=%s"
  463. }, {
  464. nameZh: "百度音乐",
  465. url: "http://music.baidu.com/search?ie=utf-8&oe=utf-8&key=%s"
  466. }, {
  467. nameZh: "酷我音乐",
  468. url: "http://sou.kuwo.cn/ws/NSearch?type=all&key=%s"
  469. }, {
  470. nameZh: "酷狗",
  471. url: "http://search.5sing.kugou.com/?keyword=%s"
  472. } ];
  473. var news = [ {
  474. nameZh: "谷歌中文",
  475. url: "https://news.google.com/search?q=%s&hl=zh-CN&gl=CN&ceid=CN:zh-Hans",
  476. icon: "https://www.google.com/favicon.ico"
  477. }, {
  478. nameZh: "百度新闻",
  479. url: "http://news.baidu.com/ns?word=%s&tn=news&from=news&cl=2&rn=20&ct=1",
  480. icon: "https://www.baidu.com/favicon.ico"
  481. }, {
  482. nameZh: "网易-百度",
  483. url: "https://www.baidu.com/s?wd=%s%20site%3Anews.163.com"
  484. }, {
  485. nameZh: "腾讯新闻",
  486. url: "https://www.sogou.com/sogou?site=news.qq.com&query=%s"
  487. }, {
  488. nameZh: "凤凰新闻",
  489. url: "https://so.ifeng.com/?q=%s&c=1"
  490. }, {
  491. nameZh: "CNN",
  492. url: "https://edition.cnn.com/search/?q=%s"
  493. }, {
  494. nameZh: "BBC",
  495. url: "https://www.bbc.co.uk/search?q=%s"
  496. }, {
  497. nameZh: "今日头条",
  498. url: "https://www.toutiao.com/search/?keyword=%s"
  499. } ];
  500. var social = [ {
  501. nameZh: "知乎",
  502. url: "https://www.zhihu.com/search?q=%s&type=content"
  503. }, {
  504. nameZh: "推特",
  505. url: "https://twitter.com/search/%s"
  506. }, {
  507. nameZh: "豆瓣",
  508. url: "https://www.douban.com/search?source=suggest&q=%s"
  509. }, {
  510. nameZh: "百度贴吧",
  511. url: "https://tieba.baidu.com/f?kw=%s&ie=utf-8"
  512. }, {
  513. nameZh: "新浪微博",
  514. url: "https://s.weibo.com/weibo?q=%s"
  515. }, {
  516. nameZh: "脸书",
  517. url: "https://www.facebook.com/search/results.php?q=%s"
  518. }, {
  519. nameZh: "微信搜索",
  520. url: "http://weixin.sogou.com/weixin?ie=utf8&type=2&query=%s"
  521. } ];
  522. var knowledge = [ {
  523. nameZh: "维基",
  524. url: "http://zh.wikipedia.org/wiki/%s"
  525. }, {
  526. nameZh: "百度百科",
  527. url: "http://baike.baidu.com/search/word?pic=1&sug=1&word=%s"
  528. }, {
  529. nameZh: "百度文库",
  530. url: "http://wenku.baidu.com/search?word=%s&ie=utf-8"
  531. }, {
  532. nameZh: "豆丁文档",
  533. url: "http://www.docin.com/search.do?searchcat=2&searchType_banner=p&nkey=%s"
  534. }, {
  535. nameZh: "爱问知识",
  536. url: "http://iask.sina.com.cn/search?searchWord=%s"
  537. }, {
  538. nameZh: "萌娘百科",
  539. url: "https://zh.moegirl.org.cn/index.php?search=%s",
  540. icon: "https://zh.moegirl.org.cn/favicon.ico"
  541. }, {
  542. nameZh: "果壳",
  543. url: "http://www.guokr.com/search/all/?wd=%s"
  544. }, {
  545. nameZh: "Quora",
  546. url: "https://www.quora.com/search?q=%s"
  547. } ];
  548. var image = [ {
  549. nameZh: "谷歌图片",
  550. url: "https://www.google.com/search?q=%s&tbm=isch"
  551. }, {
  552. nameZh: "百度图片",
  553. url: "http://image.baidu.com/search/index?tn=baiduimage&ie=utf-8&word=%s"
  554. }, {
  555. nameZh: "必应图片",
  556. url: "https://www.bing.com/images/search?q=%s"
  557. }, {
  558. nameZh: "搜狗图片",
  559. url: "https://pic.sogou.com/pics?query=%s"
  560. }, {
  561. nameZh: "pixiv",
  562. url: "http://www.pixiv.net/search.php?word=%s"
  563. }, {
  564. nameZh: "flickr",
  565. url: "http://www.flickr.com/search/?q=%s"
  566. }, {
  567. nameZh: "花瓣",
  568. url: "http://huaban.com/search/?q=%s"
  569. }, {
  570. nameZh: "Pinterest",
  571. url: "https://www.pinterest.com/search/pins/?q=%s&rs=typed&term_meta"
  572. }, {
  573. nameZh: "yandex",
  574. url: "https://yandex.com/images/search?text=%s"
  575. }, {
  576. nameZh: "pixabay",
  577. url: "https://pixabay.com/images/search/%s/",
  578. icon: "https://pixabay.com/favicon-32x32.png"
  579. }, {
  580. nameZh: "unsplash",
  581. url: "https://unsplash.com/s/photos/%s"
  582. } ];
  583. var shopping = [ {
  584. nameZh: "淘宝",
  585. url: "http://s.taobao.com/search?q=%s",
  586. icon: "https://www.taobao.com/favicon.ico"
  587. }, {
  588. nameZh: "京东",
  589. url: "http://search.jd.com/search?keyword=%s&enc=utf-8",
  590. icon: "https://www.jd.com/favicon.ico"
  591. }, {
  592. nameZh: "苏宁",
  593. url: "https://search.suning.com/%s/"
  594. }, {
  595. nameZh: "亚马逊",
  596. url: "http://www.amazon.cn/s/ref=nb_sb_noss?field-keywords=%s",
  597. icon: "https://www.amazon.cn/favicon.ico"
  598. }, {
  599. nameZh: "天猫",
  600. url: "http://list.tmall.com/search_product.htm?q=%s"
  601. }, {
  602. nameZh: "值得买",
  603. url: "http://search.smzdm.com/?c=home&s=%s"
  604. }, {
  605. nameZh: "当当网",
  606. url: "http://search.dangdang.com/?key=%s"
  607. }, {
  608. nameZh: "1688",
  609. url: "https://s.1688.com/selloffer/offer_search.htm?keywords=%s"
  610. } ];
  611. var disk = [ {
  612. nameZh: "百度网盘",
  613. url: "https://pan.baidu.com/disk/home?#/search?key=%s"
  614. }, {
  615. nameZh: "大力盘",
  616. url: "https://www.dalipan.com/search?keyword=%s"
  617. }, {
  618. nameZh: "大圣盘",
  619. url: "https://www.dashengpan.com/search?keyword=%s"
  620. }, {
  621. nameZh: "罗马盘",
  622. url: "https://www.luomapan.com/search?keyword=%s"
  623. }, {
  624. nameZh: "小白盘",
  625. url: "https://www.xiaobaipan.com/list-%s.html?from=1"
  626. }, {
  627. nameZh: "56网盘",
  628. url: "https://www.56wangpan.com/search/kw%s"
  629. } ];
  630. const list$2 = [ {
  631. nameZh: "搜索",
  632. name: "search",
  633. list: search
  634. }, {
  635. nameZh: "翻译",
  636. name: "translate",
  637. list: translate
  638. }, {
  639. nameZh: "视频",
  640. name: "video",
  641. list: video
  642. }, {
  643. nameZh: "购物",
  644. name: "shopping",
  645. list: shopping
  646. }, {
  647. nameZh: "音乐",
  648. name: "music",
  649. list: music
  650. }, {
  651. nameZh: "开发",
  652. name: "developer",
  653. list: developer
  654. }, {
  655. nameZh: "新闻",
  656. name: "news",
  657. list: news
  658. }, {
  659. nameZh: "社交",
  660. name: "social",
  661. list: social
  662. }, {
  663. nameZh: "百科",
  664. name: "knowledge",
  665. list: knowledge
  666. }, {
  667. nameZh: "图片",
  668. name: "image",
  669. list: image
  670. }, {
  671. nameZh: "网盘",
  672. name: "disk",
  673. list: disk
  674. }, {
  675. nameZh: "常用",
  676. name: "personal",
  677. list: []
  678. } ].map(item => ({
  679. ...item,
  680. data: {
  681. visible: true
  682. },
  683. list: item.list.map(child => ({
  684. ...child,
  685. data: {
  686. visible: true
  687. }
  688. }))
  689. }));
  690. function initSites(type) {
  691. let sitesData = list$2;
  692. const localSites = getSession("sites");
  693. if (localSites) {
  694. sitesData = localSites;
  695. }
  696. if (type === "tm") {
  697. sitesData = sitesData.filter(item => Array.isArray(item.list) && item.list.length > 0 && item.data && item.data.visible).map(item => ({
  698. ...item,
  699. show: false
  700. }));
  701. }
  702. return sitesData;
  703. }
  704. const width = 100;
  705. const list$1 = [ {
  706. url: /\/\/www\.google\.com(.hk)?\/search/
  707. }, {
  708. url: /\/\/www\.baidu\.com\/(s|baidu)\?/
  709. }, {
  710. url: /\/\/[^.]*\.bing\.com\/search/
  711. }, {
  712. url: /\/\/duckduckgo\.com\/*/
  713. }, {
  714. url: /\/\/searx\.me\/\?q/
  715. }, {
  716. url: /\/\/www\.sogou\.com\/(?:web|s)/,
  717. selectors: "#upquery"
  718. }, {
  719. url: /\/\/yandex\.com\/search/
  720. }, {
  721. url: /\/\/google\.infinitynewtab\.com\/\?q/
  722. }, {
  723. url: /\/\/baike\.baidu\.com\/item/
  724. }, {
  725. url: /\/\/baike\.baidu\.com\/search/
  726. }, {
  727. url: /\/\/wenku\.baidu\.com\/search/
  728. }, {
  729. url: /\/\/zhidao\.baidu\.com\/search/
  730. }, {
  731. url: /\/\/\D{2,5}\.wikipedia\.org\/wiki/
  732. }, {
  733. url: /\/\/www\.zhihu\.com\/search\?/
  734. }, {
  735. url: /\/\/www\.so\.com\/s/
  736. }, {
  737. url: /\/\/so\.baike\.com\/doc/
  738. }, {
  739. url: /\/\/www\.baike\.com\/wiki/
  740. }, {
  741. url: /\/\/www\.docin\.com\/search\.do/
  742. }, {
  743. url: /\/\/zhihu\.sogou\.com\/zhihu/,
  744. selectors: "#upquery"
  745. }, {
  746. url: /\/\/weixin\.sogou\.com\/weixin\?/,
  747. style: {
  748. 2: `.headsearch#scroll-header { left:unset; }`
  749. }
  750. }, {
  751. url: /\/\/www\.quora\.com\/search\?/
  752. }, {
  753. url: /\/\/stackoverflow\.com\/search\?/,
  754. style: {
  755. 2: `.top-bar._fixed { right: ${width}px }`
  756. }
  757. }, {
  758. url: /\/\/search\.bilibili\.com\/all/,
  759. selectors: ".search-input-el"
  760. }, {
  761. url: /\/\/www\.acfun\.cn\/search/,
  762. selectors: ".search-text--standalone"
  763. }, {
  764. url: /\/\/www\.youtube\.com\/results/,
  765. style: {
  766. 2: `ytd-app {margin-left:${width}px !important;}ytd-mini-guide-renderer.ytd-app, app-drawer{left:${width}px !important;}#masthead-container.ytd-app {width: calc(100% - 100px);}`
  767. }
  768. }, {
  769. url: /\/\/www\.nicovideo\.jp\/search\//
  770. }, {
  771. url: /\/\/so\.iqiyi\.com\/so\/q/
  772. }, {
  773. url: /\/\/v\.qq\.com\/x\/search/
  774. }, {
  775. url: /\/\/music\.baidu\.com\/search/
  776. }, {
  777. url: /\/\/so\.1ting\.com\/all\.do/
  778. }, {
  779. url: /\/\/s\.music\.qq\.com/
  780. }, {
  781. url: /\/\/music\.163\.com\/.*?#\/search/
  782. }, {
  783. url: /\/\/image\.baidu\.com\/search/
  784. }, {
  785. url: /\/\/\w{2,10}\.google(?:\.\D{1,3}){1,2}\/[^?]+\?.*&tbm=isch/
  786. }, {
  787. url: /\/\/.*\.bing\.com\/images\/search/
  788. }, {
  789. url: /\/\/www\.flickr\.com\/search\//
  790. }, {
  791. url: /^http:\/\/www\.pixiv\.net\/search\.php/
  792. }, {
  793. url: /\/\/huaban\.com\/search\?/
  794. }, {
  795. url: /\/\/www\.pinterest\.com\/search\//
  796. }, {
  797. url: /\/\/thepiratebay\.org\/search/
  798. }, {
  799. url: /\/\/subhd\.tv\/search/
  800. }, {
  801. url: /\/\/translate\.google(?:\.\D{1,4}){1,2}/
  802. }, {
  803. url: /\/\/fanyi\.baidu\.com/
  804. }, {
  805. url: /\/\/.*\.bing\.com\/dict\/search\?q=/
  806. }, {
  807. url: /\/\/dict\.youdao\.com\/search/
  808. }, {
  809. url: /\/\/dict\.youdao\.com\/w/
  810. }, {
  811. url: /\/\/dict\.cn\/./
  812. }, {
  813. url: /\/\/s\.taobao\.com\/search/
  814. }, {
  815. url: /\/\/list\.tmall\.com\/search_product\.htm.*from=chaoshi/
  816. }, {
  817. url: /\/\/list\.tmall\.com\/search_product\.htm/
  818. }, {
  819. url: /\/\/search\.jd\.com\/search/
  820. }, {
  821. url: /\/\/search\.suning\.com/
  822. }, {
  823. url: /\/\/search\.smzdm\.com\/\?/
  824. }, {
  825. url: /\/\/s\.weibo\.com\/weibo\?q=/
  826. }, {
  827. url: /\/\/tieba\.baidu\.com\/f\/search/
  828. }, {
  829. url: /\/\/(movie|music|book)\.douban\.com\/subject_search?/
  830. }, {
  831. url: /\/\/www\.douban\.com\/search/
  832. }, {
  833. url: /\/\/xueshu\.baidu\.com\/(?:s|baidu)/,
  834. style: {
  835. 2: `#left_menu_content { left: ${width}px !important;}`
  836. }
  837. }, {
  838. url: /\/\/scholar\.google(?:\.\D{1,3}){1,2}\/scholar\?/
  839. }, {
  840. url: /\/\/github\.com\/search/
  841. }, {
  842. url: /\/\/www\.startpage\.com\/sp\/search/
  843. }, {
  844. url: /\/\/endday\.github\.io/,
  845. invisible: true
  846. }, {
  847. url: /\/\/endday\.gitee\.io/,
  848. invisible: true
  849. } ];
  850. const routerChange = cb => {
  851. history.pushState = withHookAfter(history.pushState, cb);
  852. history.replaceState = withHookAfter(history.replaceState, cb);
  853. window.addEventListener("popstate", cb);
  854. window.addEventListener("yt-navigate-finish", cb);
  855. window.addEventListener("hashchange", cb);
  856. };
  857. let site = Vue.reactive(getSite());
  858. function getMenuItem() {
  859. let targetItem = null;
  860. let urlObj = null;
  861. const curItem = new URL(window.location.href);
  862. initSites("tm").some(category => {
  863. category.list.find(item => {
  864. const menuItem = new URL(item.url);
  865. if (menuItem.hostname === curItem.hostname && menuItem.pathname === curItem.pathname) {
  866. targetItem = item;
  867. urlObj = menuItem;
  868. }
  869. });
  870. });
  871. if (urlObj) {
  872. for (const key of urlObj.searchParams.keys()) {
  873. if (!curItem.searchParams.has(key)) {
  874. targetItem = null;
  875. }
  876. }
  877. }
  878. return targetItem;
  879. }
  880. function getSite() {
  881. const target = list$1.find(item => item.url.test(window.location.href.toLowerCase()));
  882. const menuItem = getMenuItem();
  883. if (target) {
  884. return {
  885. url: target.url,
  886. invisible: !!target.invisible,
  887. disabled: !!target.disabled,
  888. style: target.style,
  889. selectors: target.selectors,
  890. query: target.query
  891. };
  892. } else if (menuItem) {
  893. return {
  894. url: menuItem.url,
  895. invisible: false,
  896. disabled: false,
  897. style: menuItem.style,
  898. selectors: menuItem.selectors,
  899. query: menuItem.query
  900. };
  901. }
  902. return {
  903. url: "",
  904. invisible: true,
  905. disabled: true,
  906. style: {},
  907. selectors: null,
  908. query: null
  909. };
  910. }
  911. routerChange(() => {
  912. const newSite = getSite();
  913. Object.keys(site).forEach(key => {
  914. site[key] = newSite[key] || "";
  915. });
  916. });
  917. const isFullScreenRef = Vue.ref(false);
  918. function isFullScreen() {
  919. return document.fullscreen || document.webkitIsFullScreen || document.mozFullScreen || document.msFullscreenElement;
  920. }
  921. function onFullScreenChange(handler) {
  922. const handleResize = function() {
  923. if (!isFullScreen()) {
  924. handler();
  925. }
  926. };
  927. document.addEventListener("fullscreenchange", handler);
  928. document.addEventListener("webkitfullscreenchange", handler);
  929. document.addEventListener("mozfullscreenchange", handler);
  930. document.addEventListener("MSFullscreenChange", handler);
  931. document.addEventListener("resize", handleResize);
  932. return () => {
  933. document.removeEventListener("fullscreenchange", handler);
  934. document.removeEventListener("webkitfullscreenchange", handler);
  935. document.removeEventListener("mozfullscreenchange", handler);
  936. document.removeEventListener("MSFullscreenChange", handler);
  937. document.removeEventListener("resize", handleResize);
  938. };
  939. }
  940. function useFullScreen() {
  941. const removeListener = onFullScreenChange(() => {
  942. isFullScreenRef.value = isFullScreen();
  943. });
  944. Vue.onUnmounted(() => {
  945. removeListener();
  946. });
  947. return {
  948. isFullScreen: isFullScreenRef
  949. };
  950. }
  951. const session$3 = getSession("mode");
  952. const getMode = val => {
  953. if (![ "vertical", "horizontal" ].includes(val)) {
  954. return "horizontal";
  955. }
  956. return val;
  957. };
  958. const modeRef = Vue.ref(getMode(session$3));
  959. const mode = Vue.computed({
  960. get: () => modeRef.value,
  961. set: val => {
  962. modeRef.value = val;
  963. setSession("mode", getMode(val));
  964. }
  965. });
  966. function useMode() {
  967. return {
  968. mode: mode
  969. };
  970. }
  971. const options = new Map([ [ false, "关闭" ], [ "top", "向上" ], [ "bottom", "向下" ], [ "all", "滚动" ] ]);
  972. const defaultOpt = {
  973. show: true,
  974. scrollHide: false
  975. };
  976. const session$2 = getSession("switchShow") || defaultOpt;
  977. const getOpts = val => options.has(val) ? val : false;
  978. const getOpt = val => Object.assign({}, defaultOpt, {
  979. show: Boolean(val.show),
  980. scrollHide: getOpts(val.scrollHide)
  981. });
  982. let data = Vue.reactive(getOpt(session$2));
  983. const show = Vue.computed({
  984. get: () => data.show,
  985. set: val => {
  986. data.show = val;
  987. setSession("switchShow", data);
  988. }
  989. });
  990. const scrollHide = Vue.computed({
  991. get: () => data.scrollHide,
  992. set: val => {
  993. data.scrollHide = val;
  994. setSession("switchShow", data);
  995. }
  996. });
  997. function useSwitchShow() {
  998. return {
  999. show: show,
  1000. scrollHide: scrollHide,
  1001. options: options
  1002. };
  1003. }
  1004. class Raf {
  1005. constructor() {
  1006. this.init();
  1007. }
  1008. init() {
  1009. this._timerIdMap = {
  1010. timeout: {},
  1011. interval: {}
  1012. };
  1013. }
  1014. run(type = "interval", handler, interval = 16.7) {
  1015. const now = Date.now;
  1016. let stime = now();
  1017. let etime = stime;
  1018. const timerSymbol = Symbol("timerSymbol");
  1019. const loop = () => {
  1020. this.setIdMap(timerSymbol, type, loop);
  1021. etime = now();
  1022. if (etime - stime >= interval) {
  1023. if (type === "interval") {
  1024. stime = now();
  1025. etime = stime;
  1026. }
  1027. handler();
  1028. type === "timeout" && this.clearTimeout(timerSymbol);
  1029. }
  1030. };
  1031. this.setIdMap(timerSymbol, type, loop);
  1032. return timerSymbol;
  1033. }
  1034. setIdMap(timerSymbol, type, loop) {
  1035. this._timerIdMap[type][timerSymbol] = requestAnimationFrame(loop);
  1036. }
  1037. setTimeout(handler, timeout) {
  1038. return this.run("timeout", handler, timeout);
  1039. }
  1040. clearTimeout(timer) {
  1041. cancelAnimationFrame(this._timerIdMap.timeout[timer]);
  1042. }
  1043. setInterval(handler, timeout) {
  1044. return this.run("interval", handler, timeout);
  1045. }
  1046. clearInterval(timer) {
  1047. cancelAnimationFrame(this._timerIdMap.interval[timer]);
  1048. }
  1049. }
  1050. var raf = new Raf;
  1051. let id = null;
  1052. let styles = "";
  1053. function injectStyle(cssContent) {
  1054. styles += cssContent;
  1055. const styleNode = document.querySelector("#as-style-common");
  1056. if (styleNode) {
  1057. styleNode.styleSheet.cssText += styles;
  1058. styles = "";
  1059. } else if (!id) {
  1060. id = raf.setTimeout(() => {
  1061. const cssNode = document.createElement("style");
  1062. cssNode.setAttribute("type", "text/css");
  1063. cssNode.classList.add("as-style");
  1064. cssNode.id = "as-style-common";
  1065. cssNode.appendChild(document.createTextNode(styles));
  1066. styles = "";
  1067. const asRoot = document.getElementById("all-search");
  1068. const container = asRoot || document.body || document.head || document.documentElement || document;
  1069. container.appendChild(cssNode);
  1070. id = null;
  1071. }, 0);
  1072. }
  1073. }
  1074. var css$f = ".row {\n display: flex;\n}\n\n.column {\n display: flex;\n flex-direction: column;\n}\n\n.col {\n flex: 1;\n}\n\n.row.items-center, .column.items-center {\n align-items: center;\n}\n\n.row.items-end, .column.items-end {\n align-items: flex-end;\n}\n\n.row.items-stretch, .column.items-stretch {\n align-items: stretch;\n}\n\n.row.justify-center, .column.justify-center {\n justify-content: center;\n}\n\n.row.justify-end, .column.justify-end {\n justify-content: flex-end;\n}\n\n.row.justify-between, .column.justify-between {\n justify-content: space-between;\n}\n\n.row.flex-wrap {\n flex-wrap: wrap;\n}\n\n.row.content-center {\n align-content: center;\n}\n\n.row.content-end {\n align-content: end;\n}\n\n@media screen and (max-width: 750px) {\n .as-title-horizontal {\n display: none;\n }\n}\n.as-title-horizontal {\n min-width: 90px;\n margin: 0 10px;\n}\n\n.as-title-vertical {\n width: 100%;\n}\n\n.as-title {\n text-decoration: none !important;\n padding: 0;\n margin: 0;\n color: var(--as-primary-color);\n}\n\n.as-title-inner {\n padding: 0;\n font-size: 17px;\n height: 30px;\n line-height: 30px;\n font-weight: 600;\n color: var(--as-primary-color);\n margin: 0 auto;\n text-align: center;\n cursor: pointer;\n}";
  1075. injectStyle(css$f);
  1076. var _export_sfc = (sfc, props) => {
  1077. const target = sfc.__vccOpts || sfc;
  1078. for (const [key, val] of props) {
  1079. target[key] = val;
  1080. }
  1081. return target;
  1082. };
  1083. const _sfc_main$g = {
  1084. name: "logo",
  1085. props: {
  1086. mode: {
  1087. type: String,
  1088. default: "horizontal",
  1089. validator: val => [ "horizontal", "vertical" ].indexOf(val) > -1
  1090. }
  1091. },
  1092. setup() {
  1093. return {
  1094. isMobile: isMobile()
  1095. };
  1096. }
  1097. };
  1098. const _hoisted_1$a = Vue.createElementVNode("p", {
  1099. class: "as-title-inner"
  1100. }, " All Search ", -1);
  1101. const _hoisted_2$7 = [ _hoisted_1$a ];
  1102. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  1103. return !$setup.isMobile ? (Vue.openBlock(), Vue.createElementBlock("a", {
  1104. key: 0,
  1105. class: Vue.normalizeClass([ "as-title", `as-title-${$props.mode}` ]),
  1106. href: "https://github.com/endday/all-search",
  1107. target: "_blank"
  1108. }, _hoisted_2$7, 2)) : Vue.createCommentVNode("", true);
  1109. }
  1110. var logo = _export_sfc(_sfc_main$g, [ [ "render", _sfc_render$g ] ]);
  1111. var MapShim = function() {
  1112. if (typeof Map !== "undefined") {
  1113. return Map;
  1114. }
  1115. function getIndex(arr, key) {
  1116. var result = -1;
  1117. arr.some((function(entry, index) {
  1118. if (entry[0] === key) {
  1119. result = index;
  1120. return true;
  1121. }
  1122. return false;
  1123. }));
  1124. return result;
  1125. }
  1126. return function() {
  1127. function class_1() {
  1128. this.__entries__ = [];
  1129. }
  1130. Object.defineProperty(class_1.prototype, "size", {
  1131. get: function() {
  1132. return this.__entries__.length;
  1133. },
  1134. enumerable: true,
  1135. configurable: true
  1136. });
  1137. class_1.prototype.get = function(key) {
  1138. var index = getIndex(this.__entries__, key);
  1139. var entry = this.__entries__[index];
  1140. return entry && entry[1];
  1141. };
  1142. class_1.prototype.set = function(key, value) {
  1143. var index = getIndex(this.__entries__, key);
  1144. if (~index) {
  1145. this.__entries__[index][1] = value;
  1146. } else {
  1147. this.__entries__.push([ key, value ]);
  1148. }
  1149. };
  1150. class_1.prototype.delete = function(key) {
  1151. var entries = this.__entries__;
  1152. var index = getIndex(entries, key);
  1153. if (~index) {
  1154. entries.splice(index, 1);
  1155. }
  1156. };
  1157. class_1.prototype.has = function(key) {
  1158. return !!~getIndex(this.__entries__, key);
  1159. };
  1160. class_1.prototype.clear = function() {
  1161. this.__entries__.splice(0);
  1162. };
  1163. class_1.prototype.forEach = function(callback, ctx) {
  1164. if (ctx === void 0) {
  1165. ctx = null;
  1166. }
  1167. for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) {
  1168. var entry = _a[_i];
  1169. callback.call(ctx, entry[1], entry[0]);
  1170. }
  1171. };
  1172. return class_1;
  1173. }();
  1174. }();
  1175. var isBrowser = typeof window !== "undefined" && typeof document !== "undefined" && window.document === document;
  1176. var global$1 = function() {
  1177. if (typeof global !== "undefined" && global.Math === Math) {
  1178. return global;
  1179. }
  1180. if (typeof self !== "undefined" && self.Math === Math) {
  1181. return self;
  1182. }
  1183. if (typeof window !== "undefined" && window.Math === Math) {
  1184. return window;
  1185. }
  1186. return Function("return this")();
  1187. }();
  1188. var requestAnimationFrame$1 = function() {
  1189. if (typeof requestAnimationFrame === "function") {
  1190. return requestAnimationFrame.bind(global$1);
  1191. }
  1192. return function(callback) {
  1193. return setTimeout((function() {
  1194. return callback(Date.now());
  1195. }), 1e3 / 60);
  1196. };
  1197. }();
  1198. var trailingTimeout = 2;
  1199. function throttle$1(callback, delay) {
  1200. var leadingCall = false, trailingCall = false, lastCallTime = 0;
  1201. function resolvePending() {
  1202. if (leadingCall) {
  1203. leadingCall = false;
  1204. callback();
  1205. }
  1206. if (trailingCall) {
  1207. proxy();
  1208. }
  1209. }
  1210. function timeoutCallback() {
  1211. requestAnimationFrame$1(resolvePending);
  1212. }
  1213. function proxy() {
  1214. var timeStamp = Date.now();
  1215. if (leadingCall) {
  1216. if (timeStamp - lastCallTime < trailingTimeout) {
  1217. return;
  1218. }
  1219. trailingCall = true;
  1220. } else {
  1221. leadingCall = true;
  1222. trailingCall = false;
  1223. setTimeout(timeoutCallback, delay);
  1224. }
  1225. lastCallTime = timeStamp;
  1226. }
  1227. return proxy;
  1228. }
  1229. var REFRESH_DELAY = 20;
  1230. var transitionKeys = [ "top", "right", "bottom", "left", "width", "height", "size", "weight" ];
  1231. var mutationObserverSupported = typeof MutationObserver !== "undefined";
  1232. var ResizeObserverController = function() {
  1233. function ResizeObserverController() {
  1234. this.connected_ = false;
  1235. this.mutationEventsAdded_ = false;
  1236. this.mutationsObserver_ = null;
  1237. this.observers_ = [];
  1238. this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
  1239. this.refresh = throttle$1(this.refresh.bind(this), REFRESH_DELAY);
  1240. }
  1241. ResizeObserverController.prototype.addObserver = function(observer) {
  1242. if (!~this.observers_.indexOf(observer)) {
  1243. this.observers_.push(observer);
  1244. }
  1245. if (!this.connected_) {
  1246. this.connect_();
  1247. }
  1248. };
  1249. ResizeObserverController.prototype.removeObserver = function(observer) {
  1250. var observers = this.observers_;
  1251. var index = observers.indexOf(observer);
  1252. if (~index) {
  1253. observers.splice(index, 1);
  1254. }
  1255. if (!observers.length && this.connected_) {
  1256. this.disconnect_();
  1257. }
  1258. };
  1259. ResizeObserverController.prototype.refresh = function() {
  1260. var changesDetected = this.updateObservers_();
  1261. if (changesDetected) {
  1262. this.refresh();
  1263. }
  1264. };
  1265. ResizeObserverController.prototype.updateObservers_ = function() {
  1266. var activeObservers = this.observers_.filter((function(observer) {
  1267. return observer.gatherActive(), observer.hasActive();
  1268. }));
  1269. activeObservers.forEach((function(observer) {
  1270. return observer.broadcastActive();
  1271. }));
  1272. return activeObservers.length > 0;
  1273. };
  1274. ResizeObserverController.prototype.connect_ = function() {
  1275. if (!isBrowser || this.connected_) {
  1276. return;
  1277. }
  1278. document.addEventListener("transitionend", this.onTransitionEnd_);
  1279. window.addEventListener("resize", this.refresh);
  1280. if (mutationObserverSupported) {
  1281. this.mutationsObserver_ = new MutationObserver(this.refresh);
  1282. this.mutationsObserver_.observe(document, {
  1283. attributes: true,
  1284. childList: true,
  1285. characterData: true,
  1286. subtree: true
  1287. });
  1288. } else {
  1289. document.addEventListener("DOMSubtreeModified", this.refresh);
  1290. this.mutationEventsAdded_ = true;
  1291. }
  1292. this.connected_ = true;
  1293. };
  1294. ResizeObserverController.prototype.disconnect_ = function() {
  1295. if (!isBrowser || !this.connected_) {
  1296. return;
  1297. }
  1298. document.removeEventListener("transitionend", this.onTransitionEnd_);
  1299. window.removeEventListener("resize", this.refresh);
  1300. if (this.mutationsObserver_) {
  1301. this.mutationsObserver_.disconnect();
  1302. }
  1303. if (this.mutationEventsAdded_) {
  1304. document.removeEventListener("DOMSubtreeModified", this.refresh);
  1305. }
  1306. this.mutationsObserver_ = null;
  1307. this.mutationEventsAdded_ = false;
  1308. this.connected_ = false;
  1309. };
  1310. ResizeObserverController.prototype.onTransitionEnd_ = function(_a) {
  1311. var _b = _a.propertyName, propertyName = _b === void 0 ? "" : _b;
  1312. var isReflowProperty = transitionKeys.some((function(key) {
  1313. return !!~propertyName.indexOf(key);
  1314. }));
  1315. if (isReflowProperty) {
  1316. this.refresh();
  1317. }
  1318. };
  1319. ResizeObserverController.getInstance = function() {
  1320. if (!this.instance_) {
  1321. this.instance_ = new ResizeObserverController;
  1322. }
  1323. return this.instance_;
  1324. };
  1325. ResizeObserverController.instance_ = null;
  1326. return ResizeObserverController;
  1327. }();
  1328. var defineConfigurable = function(target, props) {
  1329. for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {
  1330. var key = _a[_i];
  1331. Object.defineProperty(target, key, {
  1332. value: props[key],
  1333. enumerable: false,
  1334. writable: false,
  1335. configurable: true
  1336. });
  1337. }
  1338. return target;
  1339. };
  1340. var getWindowOf = function(target) {
  1341. var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
  1342. return ownerGlobal || global$1;
  1343. };
  1344. var emptyRect = createRectInit(0, 0, 0, 0);
  1345. function toFloat(value) {
  1346. return parseFloat(value) || 0;
  1347. }
  1348. function getBordersSize(styles) {
  1349. var positions = [];
  1350. for (var _i = 1; _i < arguments.length; _i++) {
  1351. positions[_i - 1] = arguments[_i];
  1352. }
  1353. return positions.reduce((function(size, position) {
  1354. var value = styles["border-" + position + "-width"];
  1355. return size + toFloat(value);
  1356. }), 0);
  1357. }
  1358. function getPaddings(styles) {
  1359. var positions = [ "top", "right", "bottom", "left" ];
  1360. var paddings = {};
  1361. for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
  1362. var position = positions_1[_i];
  1363. var value = styles["padding-" + position];
  1364. paddings[position] = toFloat(value);
  1365. }
  1366. return paddings;
  1367. }
  1368. function getSVGContentRect(target) {
  1369. var bbox = target.getBBox();
  1370. return createRectInit(0, 0, bbox.width, bbox.height);
  1371. }
  1372. function getHTMLElementContentRect(target) {
  1373. var clientWidth = target.clientWidth, clientHeight = target.clientHeight;
  1374. if (!clientWidth && !clientHeight) {
  1375. return emptyRect;
  1376. }
  1377. var styles = getWindowOf(target).getComputedStyle(target);
  1378. var paddings = getPaddings(styles);
  1379. var horizPad = paddings.left + paddings.right;
  1380. var vertPad = paddings.top + paddings.bottom;
  1381. var width = toFloat(styles.width), height = toFloat(styles.height);
  1382. if (styles.boxSizing === "border-box") {
  1383. if (Math.round(width + horizPad) !== clientWidth) {
  1384. width -= getBordersSize(styles, "left", "right") + horizPad;
  1385. }
  1386. if (Math.round(height + vertPad) !== clientHeight) {
  1387. height -= getBordersSize(styles, "top", "bottom") + vertPad;
  1388. }
  1389. }
  1390. if (!isDocumentElement(target)) {
  1391. var vertScrollbar = Math.round(width + horizPad) - clientWidth;
  1392. var horizScrollbar = Math.round(height + vertPad) - clientHeight;
  1393. if (Math.abs(vertScrollbar) !== 1) {
  1394. width -= vertScrollbar;
  1395. }
  1396. if (Math.abs(horizScrollbar) !== 1) {
  1397. height -= horizScrollbar;
  1398. }
  1399. }
  1400. return createRectInit(paddings.left, paddings.top, width, height);
  1401. }
  1402. var isSVGGraphicsElement = function() {
  1403. if (typeof SVGGraphicsElement !== "undefined") {
  1404. return function(target) {
  1405. return target instanceof getWindowOf(target).SVGGraphicsElement;
  1406. };
  1407. }
  1408. return function(target) {
  1409. return target instanceof getWindowOf(target).SVGElement && typeof target.getBBox === "function";
  1410. };
  1411. }();
  1412. function isDocumentElement(target) {
  1413. return target === getWindowOf(target).document.documentElement;
  1414. }
  1415. function getContentRect(target) {
  1416. if (!isBrowser) {
  1417. return emptyRect;
  1418. }
  1419. if (isSVGGraphicsElement(target)) {
  1420. return getSVGContentRect(target);
  1421. }
  1422. return getHTMLElementContentRect(target);
  1423. }
  1424. function createReadOnlyRect(_a) {
  1425. var x = _a.x, y = _a.y, width = _a.width, height = _a.height;
  1426. var Constr = typeof DOMRectReadOnly !== "undefined" ? DOMRectReadOnly : Object;
  1427. var rect = Object.create(Constr.prototype);
  1428. defineConfigurable(rect, {
  1429. x: x,
  1430. y: y,
  1431. width: width,
  1432. height: height,
  1433. top: y,
  1434. right: x + width,
  1435. bottom: height + y,
  1436. left: x
  1437. });
  1438. return rect;
  1439. }
  1440. function createRectInit(x, y, width, height) {
  1441. return {
  1442. x: x,
  1443. y: y,
  1444. width: width,
  1445. height: height
  1446. };
  1447. }
  1448. var ResizeObservation = function() {
  1449. function ResizeObservation(target) {
  1450. this.broadcastWidth = 0;
  1451. this.broadcastHeight = 0;
  1452. this.contentRect_ = createRectInit(0, 0, 0, 0);
  1453. this.target = target;
  1454. }
  1455. ResizeObservation.prototype.isActive = function() {
  1456. var rect = getContentRect(this.target);
  1457. this.contentRect_ = rect;
  1458. return rect.width !== this.broadcastWidth || rect.height !== this.broadcastHeight;
  1459. };
  1460. ResizeObservation.prototype.broadcastRect = function() {
  1461. var rect = this.contentRect_;
  1462. this.broadcastWidth = rect.width;
  1463. this.broadcastHeight = rect.height;
  1464. return rect;
  1465. };
  1466. return ResizeObservation;
  1467. }();
  1468. var ResizeObserverEntry = function() {
  1469. function ResizeObserverEntry(target, rectInit) {
  1470. var contentRect = createReadOnlyRect(rectInit);
  1471. defineConfigurable(this, {
  1472. target: target,
  1473. contentRect: contentRect
  1474. });
  1475. }
  1476. return ResizeObserverEntry;
  1477. }();
  1478. var ResizeObserverSPI = function() {
  1479. function ResizeObserverSPI(callback, controller, callbackCtx) {
  1480. this.activeObservations_ = [];
  1481. this.observations_ = new MapShim;
  1482. if (typeof callback !== "function") {
  1483. throw new TypeError("The callback provided as parameter 1 is not a function.");
  1484. }
  1485. this.callback_ = callback;
  1486. this.controller_ = controller;
  1487. this.callbackCtx_ = callbackCtx;
  1488. }
  1489. ResizeObserverSPI.prototype.observe = function(target) {
  1490. if (!arguments.length) {
  1491. throw new TypeError("1 argument required, but only 0 present.");
  1492. }
  1493. if (typeof Element === "undefined" || !(Element instanceof Object)) {
  1494. return;
  1495. }
  1496. if (!(target instanceof getWindowOf(target).Element)) {
  1497. throw new TypeError('parameter 1 is not of type "Element".');
  1498. }
  1499. var observations = this.observations_;
  1500. if (observations.has(target)) {
  1501. return;
  1502. }
  1503. observations.set(target, new ResizeObservation(target));
  1504. this.controller_.addObserver(this);
  1505. this.controller_.refresh();
  1506. };
  1507. ResizeObserverSPI.prototype.unobserve = function(target) {
  1508. if (!arguments.length) {
  1509. throw new TypeError("1 argument required, but only 0 present.");
  1510. }
  1511. if (typeof Element === "undefined" || !(Element instanceof Object)) {
  1512. return;
  1513. }
  1514. if (!(target instanceof getWindowOf(target).Element)) {
  1515. throw new TypeError('parameter 1 is not of type "Element".');
  1516. }
  1517. var observations = this.observations_;
  1518. if (!observations.has(target)) {
  1519. return;
  1520. }
  1521. observations.delete(target);
  1522. if (!observations.size) {
  1523. this.controller_.removeObserver(this);
  1524. }
  1525. };
  1526. ResizeObserverSPI.prototype.disconnect = function() {
  1527. this.clearActive();
  1528. this.observations_.clear();
  1529. this.controller_.removeObserver(this);
  1530. };
  1531. ResizeObserverSPI.prototype.gatherActive = function() {
  1532. var _this = this;
  1533. this.clearActive();
  1534. this.observations_.forEach((function(observation) {
  1535. if (observation.isActive()) {
  1536. _this.activeObservations_.push(observation);
  1537. }
  1538. }));
  1539. };
  1540. ResizeObserverSPI.prototype.broadcastActive = function() {
  1541. if (!this.hasActive()) {
  1542. return;
  1543. }
  1544. var ctx = this.callbackCtx_;
  1545. var entries = this.activeObservations_.map((function(observation) {
  1546. return new ResizeObserverEntry(observation.target, observation.broadcastRect());
  1547. }));
  1548. this.callback_.call(ctx, entries, ctx);
  1549. this.clearActive();
  1550. };
  1551. ResizeObserverSPI.prototype.clearActive = function() {
  1552. this.activeObservations_.splice(0);
  1553. };
  1554. ResizeObserverSPI.prototype.hasActive = function() {
  1555. return this.activeObservations_.length > 0;
  1556. };
  1557. return ResizeObserverSPI;
  1558. }();
  1559. var observers = typeof WeakMap !== "undefined" ? new WeakMap : new MapShim;
  1560. var ResizeObserver = function() {
  1561. function ResizeObserver(callback) {
  1562. if (!(this instanceof ResizeObserver)) {
  1563. throw new TypeError("Cannot call a class as a function.");
  1564. }
  1565. if (!arguments.length) {
  1566. throw new TypeError("1 argument required, but only 0 present.");
  1567. }
  1568. var controller = ResizeObserverController.getInstance();
  1569. var observer = new ResizeObserverSPI(callback, controller, this);
  1570. observers.set(this, observer);
  1571. }
  1572. return ResizeObserver;
  1573. }();
  1574. [ "observe", "unobserve", "disconnect" ].forEach((function(method) {
  1575. ResizeObserver.prototype[method] = function() {
  1576. var _a;
  1577. return (_a = observers.get(this))[method].apply(_a, arguments);
  1578. };
  1579. }));
  1580. var index$1 = function() {
  1581. if (typeof global$1.ResizeObserver !== "undefined") {
  1582. return global$1.ResizeObserver;
  1583. }
  1584. return ResizeObserver;
  1585. }();
  1586. const isArray = Array.isArray;
  1587. const isString = val => typeof val === "string";
  1588. const toObject = arr => {
  1589. let obj = {};
  1590. arr.map(item => {
  1591. obj[item.key] = item.value;
  1592. });
  1593. return obj;
  1594. };
  1595. const SCOPE = "MElScrollbar";
  1596. const isNumber = val => typeof val === "number" && !isNaN(val);
  1597. const debugWarn = (...args) => {
  1598. console.error(...args);
  1599. };
  1600. const resizeHandler = entries => {
  1601. for (const entry of entries) {
  1602. const listeners = entry.target.__resizeListeners__ || [];
  1603. if (listeners.length) {
  1604. listeners.forEach(fn => {
  1605. fn();
  1606. });
  1607. }
  1608. }
  1609. };
  1610. const addResizeListener = (element, fn) => {
  1611. if (!element.__resizeListeners__) {
  1612. element.__resizeListeners__ = [];
  1613. element.__ro__ = new index$1(resizeHandler);
  1614. element.__ro__.observe(element);
  1615. }
  1616. element.__resizeListeners__.push(fn);
  1617. };
  1618. const removeResizeListener = (element, fn) => {
  1619. if (!element || !element.__resizeListeners__) return;
  1620. element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
  1621. if (!element.__resizeListeners__.length) {
  1622. element.__ro__.disconnect();
  1623. }
  1624. };
  1625. const addUnit = value => {
  1626. if (isString(value)) {
  1627. return value;
  1628. } else if (isNumber(value)) {
  1629. return value + "px";
  1630. }
  1631. debugWarn(SCOPE, "属性 value 必须是 string 或 number 类型");
  1632. return "";
  1633. };
  1634. const on = (element, event, handler, useCapture = false) => {
  1635. if (element && event && handler) {
  1636. element.addEventListener(event, handler, useCapture);
  1637. }
  1638. };
  1639. const off = (element, event, handler, useCapture = false) => {
  1640. if (element && event && handler) {
  1641. element.removeEventListener(event, handler, useCapture);
  1642. }
  1643. };
  1644. const BAR_MAP = {
  1645. vertical: {
  1646. offset: "offsetHeight",
  1647. scroll: "scrollTop",
  1648. scrollSize: "scrollHeight",
  1649. size: "height",
  1650. key: "vertical",
  1651. axis: "Y",
  1652. client: "clientY",
  1653. direction: "top"
  1654. },
  1655. horizontal: {
  1656. offset: "offsetWidth",
  1657. scroll: "scrollLeft",
  1658. scrollSize: "scrollWidth",
  1659. size: "width",
  1660. key: "horizontal",
  1661. axis: "X",
  1662. client: "clientX",
  1663. direction: "left"
  1664. }
  1665. };
  1666. const renderThumbStyle = ({move: move, size: size, bar: bar}) => {
  1667. const style = {};
  1668. const translate = `translate${bar.axis}(${move}%)`;
  1669. style[bar.size] = size;
  1670. style.transform = translate;
  1671. style.msTransform = translate;
  1672. style.webkitTransform = translate;
  1673. return style;
  1674. };
  1675. const _sfc_main$f = Vue.defineComponent({
  1676. props: {
  1677. vertical: Boolean,
  1678. size: {
  1679. type: String,
  1680. default: ""
  1681. },
  1682. move: {
  1683. type: Number,
  1684. default: 0
  1685. },
  1686. ratio: {
  1687. type: Number,
  1688. default: 0
  1689. },
  1690. always: Boolean
  1691. },
  1692. setup(props) {
  1693. const visible = Vue.ref(false);
  1694. const barStore = Vue.reactive({});
  1695. let cursorDown = false;
  1696. let cursorLeave = false;
  1697. const thumb = Vue.ref(null);
  1698. const instance = Vue.ref(null);
  1699. let onselectstartStore = null;
  1700. const {proxy: proxy} = Vue.getCurrentInstance();
  1701. const scrollbar = proxy.$parent;
  1702. const bar = Vue.computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  1703. const offsetRatio = Vue.computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrap[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  1704. const thumbStyle = Vue.computed(() => renderThumbStyle({
  1705. size: props.size,
  1706. move: props.move,
  1707. bar: bar.value
  1708. }));
  1709. const mouseMoveDocumentHandler = e => {
  1710. if (cursorDown === false) return;
  1711. const prevPage = barStore[bar.value.axis];
  1712. if (!prevPage) return;
  1713. const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  1714. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  1715. const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  1716. scrollbar.wrap[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrap[bar.value.scrollSize] / 100;
  1717. };
  1718. const mouseUpDocumentHandler = () => {
  1719. cursorDown = false;
  1720. barStore[bar.value.axis] = 0;
  1721. off(document, "mousemove", mouseMoveDocumentHandler);
  1722. off(document, "mouseup", mouseUpDocumentHandler);
  1723. document.onselectstart = onselectstartStore;
  1724. if (cursorLeave) {
  1725. visible.value = false;
  1726. }
  1727. };
  1728. const startDrag = e => {
  1729. e.stopImmediatePropagation();
  1730. cursorDown = true;
  1731. on(document, "mousemove", mouseMoveDocumentHandler);
  1732. on(document, "mouseup", mouseUpDocumentHandler);
  1733. onselectstartStore = document.onselectstart;
  1734. document.onselectstart = () => false;
  1735. };
  1736. const clickThumbHandler = e => {
  1737. e.stopPropagation();
  1738. if (e.ctrlKey || [ 1, 2 ].includes(e.button)) {
  1739. return;
  1740. }
  1741. window.getSelection().removeAllRanges();
  1742. startDrag(e);
  1743. barStore[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
  1744. };
  1745. const clickTrackHandler = e => {
  1746. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  1747. const thumbHalf = thumb[bar.value.offset] / 2;
  1748. const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance[bar.value.offset];
  1749. scrollbar.wrap[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrap[bar.value.scrollSize] / 100;
  1750. };
  1751. const mouseMoveScrollbarHandler = () => {
  1752. cursorLeave = false;
  1753. visible.value = !!props.size;
  1754. };
  1755. const mouseLeaveScrollbarHandler = () => {
  1756. cursorLeave = true;
  1757. visible.value = cursorDown;
  1758. };
  1759. Vue.onMounted(() => {
  1760. Vue.nextTick(() => {
  1761. on(scrollbar.scrollbar, "mousemove", mouseMoveScrollbarHandler);
  1762. on(scrollbar.scrollbar, "mouseleave", mouseLeaveScrollbarHandler);
  1763. });
  1764. });
  1765. Vue.onBeforeUnmount(() => {
  1766. off(document, "mouseup", this.mouseUpDocumentHandler);
  1767. off(scrollbar.scrollbar, "mousemove", this.mouseMoveScrollbarHandler);
  1768. off(scrollbar.scrollbar, "mouseleave", this.mouseLeaveScrollbarHandler);
  1769. });
  1770. return {
  1771. clickThumbHandler: clickThumbHandler,
  1772. clickTrackHandler: clickTrackHandler,
  1773. thumbStyle: thumbStyle,
  1774. bar: bar,
  1775. visible: visible,
  1776. instance: instance,
  1777. thumb: thumb
  1778. };
  1779. }
  1780. });
  1781. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  1782. return Vue.openBlock(), Vue.createBlock(Vue.Transition, {
  1783. name: "as-scrollbar-fade"
  1784. }, {
  1785. default: Vue.withCtx(() => [ Vue.withDirectives(Vue.createElementVNode("div", {
  1786. ref: "instance",
  1787. class: Vue.normalizeClass([ "as-scrollbar__bar", "is-" + _ctx.bar.key ]),
  1788. onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.clickTrackHandler && _ctx.clickTrackHandler(...args))
  1789. }, [ Vue.createElementVNode("div", {
  1790. ref: "thumb",
  1791. class: "as-scrollbar__thumb",
  1792. style: Vue.normalizeStyle(_ctx.thumbStyle),
  1793. onMousedown: _cache[0] || (_cache[0] = (...args) => _ctx.clickThumbHandler && _ctx.clickThumbHandler(...args))
  1794. }, null, 36) ], 34), [ [ Vue.vShow, _ctx.always || _ctx.visible ] ]) ]),
  1795. _: 1
  1796. });
  1797. }
  1798. var Bar = _export_sfc(_sfc_main$f, [ [ "render", _sfc_render$f ] ]);
  1799. const _sfc_main$e = Vue.defineComponent({
  1800. components: {
  1801. Bar: Bar
  1802. },
  1803. props: {
  1804. height: {
  1805. type: [ String, Number ],
  1806. default: ""
  1807. },
  1808. maxHeight: {
  1809. type: [ String, Number ],
  1810. default: ""
  1811. },
  1812. native: {
  1813. type: Boolean,
  1814. default: false
  1815. },
  1816. wrapStyle: {
  1817. type: [ String, Array ],
  1818. default: ""
  1819. },
  1820. wrapClass: {
  1821. type: [ String, Array ],
  1822. default: ""
  1823. },
  1824. viewClass: {
  1825. type: [ String, Array ],
  1826. default: ""
  1827. },
  1828. viewStyle: {
  1829. type: [ String, Array ],
  1830. default: ""
  1831. },
  1832. noresize: Boolean,
  1833. tag: {
  1834. type: String,
  1835. default: "div"
  1836. },
  1837. always: {
  1838. type: Boolean,
  1839. default: false
  1840. },
  1841. minSize: {
  1842. type: Number,
  1843. default: 20
  1844. }
  1845. },
  1846. emits: [ "scroll" ],
  1847. setup(props, {emit: emit}) {
  1848. const sizeWidth = Vue.ref("0");
  1849. const sizeHeight = Vue.ref("0");
  1850. const moveX = Vue.ref(0);
  1851. const moveY = Vue.ref(0);
  1852. const scrollbar = Vue.ref(null);
  1853. const wrap = Vue.ref(null);
  1854. const resize = Vue.ref(null);
  1855. const ratioY = Vue.ref(1);
  1856. const ratioX = Vue.ref(1);
  1857. const SCOPE = "AScrollbar";
  1858. const GAP = 4;
  1859. const renderWrapStyle = Vue.computed(() => {
  1860. let style = props.wrapStyle;
  1861. if (isArray(style)) {
  1862. style = toObject(style);
  1863. style.height = addUnit(props.height);
  1864. style.maxHeight = addUnit(props.maxHeight);
  1865. } else if (isString(style)) {
  1866. style += addUnit(props.height) ? `height: ${addUnit(props.height)};` : "";
  1867. style += addUnit(props.maxHeight) ? `max-height: ${addUnit(props.maxHeight)};` : "";
  1868. }
  1869. return style;
  1870. });
  1871. const update = () => {
  1872. if (!wrap.value) return;
  1873. const offsetHeight = wrap.value.offsetHeight - GAP;
  1874. const offsetWidth = wrap.value.offsetWidth - GAP;
  1875. const originalHeight = offsetHeight ** 2 / wrap.value.scrollHeight;
  1876. const originalWidth = offsetWidth ** 2 / wrap.value.scrollWidth;
  1877. const height = Math.max(originalHeight, props.minSize);
  1878. const width = Math.max(originalWidth, props.minSize);
  1879. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  1880. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  1881. sizeHeight.value = height + GAP < offsetHeight ? height + "px" : "";
  1882. sizeWidth.value = width + GAP < offsetWidth ? width + "px" : "";
  1883. };
  1884. const handleScroll = () => {
  1885. if (wrap.value) {
  1886. const offsetHeight = wrap.value.offsetHeight - GAP;
  1887. const offsetWidth = wrap.value.offsetWidth - GAP;
  1888. moveY.value = wrap.value.scrollTop * 100 / offsetHeight * ratioY.value;
  1889. moveX.value = wrap.value.scrollLeft * 100 / offsetWidth * ratioX.value;
  1890. emit("scroll", {
  1891. scrollTop: wrap.value.scrollTop,
  1892. scrollLeft: wrap.value.scrollLeft
  1893. });
  1894. }
  1895. };
  1896. const setScrollTop = value => {
  1897. if (!isNumber(value)) {
  1898. debugWarn(SCOPE, "value must be a number");
  1899. return;
  1900. }
  1901. wrap.value.scrollTop = value;
  1902. };
  1903. const setScrollLeft = value => {
  1904. if (!isNumber(value)) {
  1905. debugWarn(SCOPE, "value must be a number");
  1906. return;
  1907. }
  1908. wrap.value.scrollLeft = value;
  1909. };
  1910. Vue.onMounted(() => {
  1911. if (!props.native) {
  1912. Vue.nextTick(update);
  1913. }
  1914. if (!props.noresize) {
  1915. addResizeListener(resize.value, update);
  1916. addEventListener("resize", update);
  1917. }
  1918. });
  1919. Vue.onBeforeUnmount(() => {
  1920. if (!props.noresize) {
  1921. removeResizeListener(resize.value, update);
  1922. removeEventListener("resize", this.update);
  1923. }
  1924. });
  1925. Vue.onUpdated(() => update());
  1926. return {
  1927. scrollbar: scrollbar,
  1928. wrap: wrap,
  1929. resize: resize,
  1930. moveX: moveX,
  1931. moveY: moveY,
  1932. ratioX: ratioX,
  1933. ratioY: ratioY,
  1934. sizeWidth: sizeWidth,
  1935. sizeHeight: sizeHeight,
  1936. update: update,
  1937. handleScroll: handleScroll,
  1938. scrollTo: scrollTo,
  1939. setScrollTop: setScrollTop,
  1940. setScrollLeft: setScrollLeft,
  1941. renderWrapStyle: renderWrapStyle
  1942. };
  1943. }
  1944. });
  1945. const _hoisted_1$9 = {
  1946. ref: "scrollbar",
  1947. class: "as-scrollbar"
  1948. };
  1949. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  1950. const _component_bar = Vue.resolveComponent("bar");
  1951. return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1$9, [ Vue.createElementVNode("div", {
  1952. ref: "wrap",
  1953. class: Vue.normalizeClass([ _ctx.wrapClass, "as-scrollbar__wrap", _ctx.native ? "" : "as-scrollbar__wrap--hidden-default" ]),
  1954. style: Vue.normalizeStyle(_ctx.renderWrapStyle),
  1955. onScroll: _cache[0] || (_cache[0] = (...args) => _ctx.handleScroll && _ctx.handleScroll(...args))
  1956. }, [ (Vue.openBlock(), Vue.createBlock(Vue.resolveDynamicComponent(_ctx.tag), {
  1957. ref: "resize",
  1958. class: Vue.normalizeClass([ "as-scrollbar__view", _ctx.viewClass ]),
  1959. style: Vue.normalizeStyle(_ctx.viewStyle)
  1960. }, {
  1961. default: Vue.withCtx(() => [ Vue.renderSlot(_ctx.$slots, "default") ]),
  1962. _: 3
  1963. }, 8, [ "class", "style" ])) ], 38), !_ctx.native ? (Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, {
  1964. key: 0
  1965. }, [ Vue.createVNode(_component_bar, {
  1966. move: _ctx.moveX,
  1967. ratio: _ctx.ratioX,
  1968. size: _ctx.sizeWidth,
  1969. always: _ctx.always
  1970. }, null, 8, [ "move", "ratio", "size", "always" ]), Vue.createVNode(_component_bar, {
  1971. move: _ctx.moveY,
  1972. ratio: _ctx.ratioY,
  1973. size: _ctx.sizeHeight,
  1974. vertical: "",
  1975. always: _ctx.always
  1976. }, null, 8, [ "move", "ratio", "size", "always" ]) ], 64)) : Vue.createCommentVNode("", true) ], 512);
  1977. }
  1978. var scrollbar = _export_sfc(_sfc_main$e, [ [ "render", _sfc_render$e ] ]);
  1979. var css$e = ":root{--as-text-color-secondary:#909399}.as-scrollbar{--as-scrollbar-opacity:.3;--as-scrollbar-background-color:var(--as-text-color-secondary);--as-scrollbar-hover-opacity:.5;--as-scrollbar-hover-background-color:var(--as-text-color-secondary);overflow:hidden;position:relative;height:100%}.as-scrollbar__wrap{overflow:auto;height:100%}.as-scrollbar__wrap--hidden-default{scrollbar-width:none}.as-scrollbar__wrap--hidden-default::-webkit-scrollbar{display:none}.as-scrollbar__thumb{position:relative;display:block;width:0;height:0;cursor:pointer;border-radius:inherit;background-color:var(--as-scrollbar-background-color, var(--as-text-color-secondary));transition:var(--as-transition-duration) background-color;opacity:var(--as-scrollbar-opacity, .3)}.as-scrollbar__thumb:hover{background-color:var(--as-scrollbar-hover-background-color, var(--as-text-color-secondary));opacity:var(--as-scrollbar-hover-opacity, .5)}.as-scrollbar__bar{position:absolute;right:2px;bottom:2px;z-index:1;border-radius:4px}.as-scrollbar__bar.is-vertical{width:6px;top:2px}.as-scrollbar__bar.is-vertical>div{width:100%}.as-scrollbar__bar.is-horizontal{height:6px;left:2px}.as-scrollbar__bar.is-horizontal>div{height:100%}.as-scrollbar-fade-enter-active{transition:opacity .34s ease-out}.as-scrollbar-fade-leave-active{transition:opacity .12s ease-out}.as-scrollbar-fade-enter-from,.as-scrollbar-fade-leave-active{opacity:0}\n";
  1980. injectStyle(css$e);
  1981. function useTimeout() {
  1982. let timeoutHandle;
  1983. const registerTimeout = (fn, delay) => {
  1984. cancelTimeout();
  1985. timeoutHandle = window.setTimeout(fn, delay);
  1986. };
  1987. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  1988. return {
  1989. registerTimeout: registerTimeout,
  1990. cancelTimeout: cancelTimeout
  1991. };
  1992. }
  1993. function onClickOutside(target, handler, options) {
  1994. const {ignore: ignore, capture: capture = true} = options;
  1995. if (!window) return;
  1996. const shouldListen = Vue.ref(true);
  1997. let fallback;
  1998. const listener = event => {
  1999. window.clearTimeout(fallback);
  2000. const el = target;
  2001. const composedPath = event.composedPath();
  2002. if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value) return;
  2003. if (ignore && ignore.length > 0) {
  2004. if (ignore.some(target => {
  2005. const el = target;
  2006. return el && (event.target === el || composedPath.includes(el));
  2007. })) return;
  2008. }
  2009. handler(event);
  2010. };
  2011. window.addEventListener("click", listener, {
  2012. passive: true,
  2013. capture: capture
  2014. });
  2015. window.addEventListener("pointerdown", listener, {
  2016. passive: true
  2017. });
  2018. return () => {
  2019. window.removeEventListener("click", listener);
  2020. window.removeEventListener("pointerdown", listener);
  2021. };
  2022. }
  2023. var css$d = '@charset "UTF-8";\n.popover-content {\n --background-color: white;\n --border-color: lightgray;\n display: none;\n pointer-events: none;\n opacity: 0;\n z-index: 99999;\n position: relative;\n}\n.popover-content .arrow,\n.popover-content .arrow::before {\n width: 0;\n height: 0;\n border-style: solid;\n}\n.popover-content .arrow::before {\n content: "";\n position: absolute;\n}\n\n.popover-content[data-show=true] {\n opacity: 1;\n pointer-events: initial;\n}\n\n.popover-content[data-initialized=true] {\n display: block;\n}\n\n/* 可以为进入和离开动画设置不同的持续时间和动画函数 */\n.slide-fade-enter-active {\n transition: all 0.3s ease-out;\n}\n\n.slide-fade-leave-active {\n transition: all 0.8s cubic-bezier(1, 0.5, 0.8, 1);\n}\n\n.slide-fade-enter-from,\n.slide-fade-leave-to {\n transform: translateX(20px);\n opacity: 0;\n}';
  2024. injectStyle(css$d);
  2025. const _sfc_main$d = {
  2026. props: {
  2027. placement: {
  2028. type: String,
  2029. default: "auto"
  2030. },
  2031. strategy: {
  2032. type: String,
  2033. default: "fixed"
  2034. },
  2035. popperClass: {
  2036. type: String,
  2037. default: ""
  2038. }
  2039. },
  2040. setup(props) {
  2041. const visible = Vue.ref(false);
  2042. const loaded = Vue.ref(false);
  2043. const trigger = Vue.ref(null);
  2044. const popover = Vue.ref(null);
  2045. const popperInstance = Vue.ref(null);
  2046. const {registerTimeout: registerTimeout, cancelTimeout: cancelTimeout} = useTimeout();
  2047. function createPopover(target) {
  2048. if (popperInstance.value) {
  2049. visible.value = true;
  2050. return;
  2051. }
  2052. popperInstance.value = Popper.createPopper(target, popover.value, {
  2053. strategy: props.strategy,
  2054. placement: props.placement
  2055. });
  2056. }
  2057. function destroyPopover() {
  2058. if (popperInstance.value) {
  2059. popperInstance.value.destroy();
  2060. popperInstance.value = null;
  2061. }
  2062. }
  2063. let stopFn;
  2064. function handleClickOutside(target) {
  2065. if (!stopFn) {
  2066. stopFn = onClickOutside(target, hide, {
  2067. ignore: [ popover.value ]
  2068. });
  2069. }
  2070. }
  2071. Vue.onUnmounted(() => {
  2072. stopFn();
  2073. });
  2074. function show(target) {
  2075. loaded.value = true;
  2076. visible.value = true;
  2077. createPopover(target);
  2078. cancelTimeout();
  2079. handleClickOutside(target);
  2080. }
  2081. function hide() {
  2082. registerTimeout(() => {
  2083. visible.value = false;
  2084. destroyPopover();
  2085. }, 100);
  2086. }
  2087. return {
  2088. visible: visible,
  2089. loaded: loaded,
  2090. trigger: trigger,
  2091. popover: popover,
  2092. popperInstance: popperInstance,
  2093. show: show,
  2094. hide: hide
  2095. };
  2096. }
  2097. };
  2098. const _hoisted_1$8 = [ "data-show", "data-initialized" ];
  2099. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  2100. return Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, null, [ Vue.renderSlot(_ctx.$slots, "trigger", Vue.mergeProps({
  2101. ref: "trigger"
  2102. }, {
  2103. show: $setup.show,
  2104. hide: $setup.hide
  2105. })), Vue.createVNode(Vue.Transition, {
  2106. name: "slide-fade"
  2107. }, {
  2108. default: Vue.withCtx(() => [ (Vue.openBlock(), Vue.createBlock(Vue.Teleport, {
  2109. to: "#all-search"
  2110. }, [ Vue.withDirectives(Vue.createElementVNode("div", {
  2111. class: Vue.normalizeClass([ $props.popperClass, "popover-content" ]),
  2112. ref: "popover",
  2113. "data-show": $setup.visible,
  2114. "data-initialized": $setup.popperInstance !== null,
  2115. style: {
  2116. display: "none"
  2117. },
  2118. onMouseenter: _cache[0] || (_cache[0] = (...args) => $setup.show && $setup.show(...args)),
  2119. onMouseleave: _cache[1] || (_cache[1] = (...args) => $setup.hide && $setup.hide(...args))
  2120. }, [ $setup.loaded ? Vue.renderSlot(_ctx.$slots, "default", {
  2121. key: 0
  2122. }) : Vue.createCommentVNode("", true) ], 42, _hoisted_1$8), [ [ Vue.vShow, $setup.visible ] ]) ])) ]),
  2123. _: 3
  2124. }) ], 64);
  2125. }
  2126. var popper = _export_sfc(_sfc_main$d, [ [ "render", _sfc_render$d ] ]);
  2127. function findInNodeList(list) {
  2128. return [].find.call(list, item => isVisible(item));
  2129. }
  2130. function isVisible(element) {
  2131. const style = getComputedStyle(element);
  2132. return !!element.getClientRects().length && style.visibility !== "hidden" && style.width !== 0 && style.height !== 0 && style.opacity !== 0;
  2133. }
  2134. function getSearchDom() {
  2135. const el = document.querySelector("input[type=search],input[type=text][autocomplete=off],input[autocomplete=off]:not([type])") || document.querySelector("input[type=text][name][value],input[name][value]:not([type])");
  2136. if (el) {
  2137. return el;
  2138. }
  2139. const autofocusOrSearch = document.querySelector("input[autofocus],input[type=search]");
  2140. if (autofocusOrSearch && isVisible(autofocusOrSearch)) {
  2141. return autofocusOrSearch;
  2142. }
  2143. const idOrClassContainSearch = document.querySelectorAll("input[id*=search],input[class*=search]");
  2144. if (idOrClassContainSearch.length) {
  2145. const element = findInNodeList(idOrClassContainSearch);
  2146. if (element) {
  2147. return element;
  2148. }
  2149. }
  2150. const placeholderContainSearch = document.querySelectorAll("input[placeholder*=search],input[placeholder*=搜索]");
  2151. if (placeholderContainSearch.length) {
  2152. const element = findInNodeList(placeholderContainSearch);
  2153. if (element) {
  2154. return element;
  2155. }
  2156. }
  2157. const textInputTypes = [ "hidden", "button", "checkbox", "color", "file", "image", "radio", "range", "reset", "submit" ];
  2158. const selector = textInputTypes.map(t => `[type=${t}]`).join(",");
  2159. const firstInput = document.querySelector(`input:not(${selector}),textarea`);
  2160. if (firstInput && isVisible(firstInput)) {
  2161. return firstInput;
  2162. }
  2163. const inputSearch = document.getElementsByTagName("input");
  2164. const sameKeywordInput = [].find.call(inputSearch, item => {
  2165. if (item.value && decodeURI(window.location.pathname + window.location.search).includes(item.value)) {
  2166. return item;
  2167. }
  2168. });
  2169. if (sameKeywordInput) {
  2170. return sameKeywordInput;
  2171. }
  2172. }
  2173. function getKeyword() {
  2174. const el = getSearchDom();
  2175. if (el) {
  2176. if ([ "INPUT", "TEXTAREA" ].includes(el.nodeName)) {
  2177. return el.value;
  2178. } else {
  2179. return el.textContent;
  2180. }
  2181. }
  2182. console.log("没有找到搜索关键字");
  2183. }
  2184. var css$c = ".as-icon {\n font-size: 20px;\n width: 1em;\n height: 1em;\n vertical-align: -0.15em;\n fill: currentColor;\n overflow: hidden;\n margin: 0.25px 4px 0 0;\n}";
  2185. injectStyle(css$c);
  2186. const _sfc_main$c = {
  2187. name: "icon",
  2188. props: {
  2189. name: {
  2190. type: String,
  2191. default: ""
  2192. }
  2193. }
  2194. };
  2195. const _hoisted_1$7 = {
  2196. class: "as-icon as-menu-item-icon",
  2197. "aria-hidden": "true"
  2198. };
  2199. const _hoisted_2$6 = [ "xlink:href" ];
  2200. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  2201. return Vue.openBlock(), Vue.createElementBlock("svg", _hoisted_1$7, [ Vue.createElementVNode("use", {
  2202. "xlink:href": `#icon-${$props.name}`
  2203. }, null, 8, _hoisted_2$6) ]);
  2204. }
  2205. var icon = _export_sfc(_sfc_main$c, [ [ "render", _sfc_render$c ] ]);
  2206. let el$1 = document.createElement("a");
  2207. const replaceUrl = function(val) {
  2208. const lowerCaseVal = val.toLowerCase();
  2209. const list = [ "http://", "https://", "ftp://", "files://" ];
  2210. for (let i = 0; i < list.length; i++) {
  2211. if (lowerCaseVal.indexOf(list[i]) === 0) {
  2212. return val.replace(/.*\/\//, "//");
  2213. }
  2214. }
  2215. return val;
  2216. };
  2217. function parseUrl(url) {
  2218. let val = url;
  2219. if (val.indexOf("//") < 0) {
  2220. val = `//${val}`;
  2221. } else if (val.indexOf("//") > -1) {
  2222. val = replaceUrl(val);
  2223. } else {
  2224. return el$1;
  2225. }
  2226. el$1.href = val;
  2227. return {
  2228. href: el$1.href,
  2229. origin: el$1.origin,
  2230. protocol: el$1.protocol,
  2231. host: el$1.host,
  2232. hostname: el$1.hostname,
  2233. port: el$1.port,
  2234. pathname: el$1.pathname,
  2235. search: el$1.search,
  2236. hash: el$1.hash
  2237. };
  2238. }
  2239. const name = "favicon";
  2240. const session$1 = getSession(name);
  2241. const getValue = val => val || 1;
  2242. const valRef = Vue.ref(getValue(session$1));
  2243. const favicon$1 = Vue.computed({
  2244. get: () => valRef.value,
  2245. set: val => {
  2246. valRef.value = val;
  2247. setSession(name, getValue(val));
  2248. }
  2249. });
  2250. function useFavicon() {
  2251. return {
  2252. favicon: favicon$1
  2253. };
  2254. }
  2255. var css$b = '.as-url-icon {\n width: 16px;\n height: 16px;\n margin-right: 10px;\n border: none;\n position: relative;\n font-size: 0;\n}\n.as-url-icon img {\n width: 100%;\n height: 100%;\n border: none;\n vertical-align: top;\n}\n.as-url-icon img.error {\n display: inline-block;\n transform: scale(1);\n content: "";\n color: transparent;\n}\n.as-url-icon img.error::before {\n content: "";\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background: #f5f5f5 no-repeat center/50% 50%;\n}\n.as-url-icon img.error::after {\n content: attr(alt);\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n line-height: 2;\n background-color: rgba(0, 0, 0, 0.5);\n color: white;\n font-size: 12px;\n text-align: center;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}';
  2256. injectStyle(css$b);
  2257. const iconCache = Vue.reactive(getSession("iconCache") || {});
  2258. const _sfc_main$b = {
  2259. name: "favicon",
  2260. props: {
  2261. url: {
  2262. type: String,
  2263. default: ""
  2264. },
  2265. icon: {
  2266. type: String,
  2267. default: ""
  2268. }
  2269. },
  2270. setup(props) {
  2271. const isError = Vue.ref(false);
  2272. const {hostname: hostname, origin: origin} = parseUrl(props.url);
  2273. const img = Vue.computed(() => {
  2274. if (isError.value) {
  2275. return `${origin}/favicon.ico`;
  2276. } else if (iconCache[hostname]) {
  2277. return iconCache[hostname];
  2278. } else {
  2279. return `https://favicon.yandex.net/favicon/v2/${encodeURI(hostname)}?size=32`;
  2280. }
  2281. });
  2282. const {favicon: favicon} = useFavicon();
  2283. function getBase64Image(image) {
  2284. let canvas = document.createElement("canvas");
  2285. canvas.width = image.width;
  2286. canvas.height = image.height;
  2287. let context = canvas.getContext("2d");
  2288. context.drawImage(image, 0, 0, image.width, image.height);
  2289. return canvas.toDataURL("image/png", 1);
  2290. }
  2291. function handleLoad(e) {
  2292. if (!isError.value && !img.value.startsWith("data:image")) {
  2293. const base64 = getBase64Image(e.target);
  2294. if (base64) {
  2295. iconCache[hostname] = base64;
  2296. setSession("iconCache", iconCache);
  2297. }
  2298. }
  2299. }
  2300. function handleError() {
  2301. isError.value = true;
  2302. }
  2303. return {
  2304. img: img,
  2305. favicon: favicon,
  2306. handleLoad: handleLoad,
  2307. handleError: handleError,
  2308. isError: isError
  2309. };
  2310. }
  2311. };
  2312. const _hoisted_1$6 = {
  2313. key: 0,
  2314. class: "as-url-icon"
  2315. };
  2316. const _hoisted_2$5 = [ "src" ];
  2317. function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
  2318. return $setup.favicon === 1 ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1$6, [ Vue.createElementVNode("img", {
  2319. class: Vue.normalizeClass({
  2320. error: $setup.isError
  2321. }),
  2322. src: $setup.img,
  2323. crossOrigin: "",
  2324. onError: _cache[0] || (_cache[0] = (...args) => $setup.handleError && $setup.handleError(...args)),
  2325. onLoad: _cache[1] || (_cache[1] = (...args) => $setup.handleLoad && $setup.handleLoad(...args))
  2326. }, null, 42, _hoisted_2$5) ])) : Vue.createCommentVNode("", true);
  2327. }
  2328. var favicon = _export_sfc(_sfc_main$b, [ [ "render", _sfc_render$b ] ]);
  2329. const onTap = (target, callback) => {
  2330. let tapStartTime = 0;
  2331. let tapEndTime = 0;
  2332. const tapTime = 200;
  2333. let tapStartClientX = 0;
  2334. let tapStartClientY = 0;
  2335. let tapEndClientX = 0;
  2336. let tapEndClientY = 0;
  2337. const tapLimit = 15;
  2338. let cancelClick = false;
  2339. let hasListener = false;
  2340. function handleTouchStart(event) {
  2341. tapStartTime = event.timeStamp;
  2342. const touch = event.changedTouches[0];
  2343. tapStartClientX = touch.clientX;
  2344. tapStartClientY = touch.clientY;
  2345. cancelClick = false;
  2346. }
  2347. function handleTouchMove(event) {
  2348. const touch = event.changedTouches[0];
  2349. tapEndClientX = touch.clientX;
  2350. tapEndClientY = touch.clientY;
  2351. if (Math.abs(tapEndClientX - tapStartClientX) > tapLimit || Math.abs(tapEndClientY - tapStartClientY) > tapLimit) {
  2352. cancelClick = true;
  2353. }
  2354. }
  2355. function handleTouchEnd(event) {
  2356. tapEndTime = event.timeStamp;
  2357. if (!cancelClick && tapEndTime - tapStartTime <= tapTime) {
  2358. callback(event);
  2359. }
  2360. }
  2361. Vue.watch(target, el => {
  2362. if (el && !hasListener) {
  2363. el.addEventListener("touchstart", handleTouchStart);
  2364. el.addEventListener("touchmove", handleTouchMove);
  2365. el.addEventListener("touchend", handleTouchEnd);
  2366. hasListener = true;
  2367. }
  2368. });
  2369. Vue.onUnmounted(() => {
  2370. const el = Vue.unref(target);
  2371. if (el) {
  2372. el.removeEventListener("touchstart", handleTouchStart);
  2373. el.removeEventListener("touchmove", handleTouchMove);
  2374. el.removeEventListener("touchend", handleTouchEnd);
  2375. }
  2376. });
  2377. };
  2378. var css$a = '.row {\n display: flex;\n}\n\n.column {\n display: flex;\n flex-direction: column;\n}\n\n.col {\n flex: 1;\n}\n\n.row.items-center, .column.items-center {\n align-items: center;\n}\n\n.row.items-end, .column.items-end {\n align-items: flex-end;\n}\n\n.row.items-stretch, .column.items-stretch {\n align-items: stretch;\n}\n\n.row.justify-center, .column.justify-center {\n justify-content: center;\n}\n\n.row.justify-end, .column.justify-end {\n justify-content: flex-end;\n}\n\n.row.justify-between, .column.justify-between {\n justify-content: space-between;\n}\n\n.row.flex-wrap {\n flex-wrap: wrap;\n}\n\n.row.content-center {\n align-content: center;\n}\n\n.row.content-end {\n align-content: end;\n}\n\n.as-menu-item.horizontal {\n position: relative;\n padding: 0 16px;\n}\n.as-menu-item.horizontal::after {\n content: "";\n transform: scaleX(0);\n opacity: 0;\n transition: transform 0.15s cubic-bezier(0.645, 0.045, 0.355, 1), opacity 0.15s cubic-bezier(0.645, 0.045, 0.355, 1);\n position: absolute;\n right: 0;\n left: 0;\n bottom: 0;\n border-bottom: 2px solid var(--as-primary-color);\n}\n.as-menu-item.horizontal:hover::after {\n transform: scaleX(1);\n opacity: 1;\n}\n\n@media screen and (max-width: 750px) {\n .as-menu-item.horizontal {\n padding: 0 10px;\n }\n}\n.as-menu-item.vertical {\n margin: 5px 0;\n position: relative;\n}\n.as-menu-item.vertical::after {\n content: "";\n transform: scaleY(0);\n opacity: 0;\n transition: transform 0.15s cubic-bezier(0.645, 0.045, 0.355, 1), opacity 0.15s cubic-bezier(0.645, 0.045, 0.355, 1);\n position: absolute;\n top: 0;\n bottom: 0;\n right: 0;\n border-right: 2.5px solid var(--as-primary-color);\n}\n.as-menu-item.vertical:hover::after {\n transform: scaleY(1);\n opacity: 1;\n}\n.as-menu-item.vertical .as-menu-item-title {\n margin-right: 6px;\n}\n\n.as-menu-item.no-underline {\n text-decoration: none;\n}\n\n.as-menu-item:visited {\n color: var(--as-primary-text-color);\n}\n\na.as-menu-item {\n height: 30px;\n line-height: 30px;\n list-style: none;\n position: relative;\n color: var(--as-primary-text-color);\n transition: color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), border-color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), background 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);\n box-sizing: border-box;\n margin: 0;\n white-space: nowrap;\n cursor: pointer;\n font-size: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\na.as-menu-item:hover {\n border-color: var(--as-primary-color);\n}\na.as-menu-item:hover .as-menu-item-icon, a.as-menu-item:hover .as-menu-item-title {\n color: var(--as-primary-color);\n}\n\n.as-menu-item-icon {\n color: var(--as-primary-text-color);\n}\n\n.as-subMenu-container {\n background: #fff;\n border: 1px solid #e4e7ed;\n box-shadow: 0 0 12px rgba(0, 0, 0, 0.12);\n border-radius: 4px;\n}\n\n.as-subMenu {\n list-style: none;\n padding: 0;\n min-width: 90px;\n box-sizing: border-box;\n margin: 4px 0;\n}\n.as-subMenu li {\n overflow: hidden;\n box-sizing: border-box;\n}\n.as-subMenu li a {\n display: flex;\n align-items: center;\n height: 34px;\n padding: 0 16px;\n text-decoration: none;\n}\n.as-subMenu li:hover {\n background-color: var(--as-secondary-background-color);\n color: var(--as-primary-color);\n}\n.as-subMenu .as-subMenu-text {\n flex: 1;\n font-size: 14px;\n text-overflow: ellipsis;\n color: var(--as-primary-text-color);\n white-space: nowrap;\n margin: 0;\n line-height: 34px;\n font-weight: normal;\n text-align: left;\n}';
  2379. injectStyle(css$a);
  2380. const _sfc_main$a = {
  2381. name: "menuItem",
  2382. components: {
  2383. popper: popper,
  2384. icon: icon,
  2385. favicon: favicon
  2386. },
  2387. props: {
  2388. item: {
  2389. type: Object
  2390. },
  2391. mode: {
  2392. type: String,
  2393. default: "horizontal"
  2394. }
  2395. },
  2396. setup(props) {
  2397. let isTap = false;
  2398. const categoryRef = Vue.ref(null);
  2399. const currentSite = site;
  2400. const classList = Vue.computed(() => props.mode === "horizontal" ? "horizontal" : "vertical");
  2401. const placement = Vue.computed(() => props.mode === "horizontal" ? "bottom-start" : "right-start");
  2402. const handleMenuShow = (value, item) => {
  2403. item.show = value;
  2404. };
  2405. const defaultKeyword = () => {
  2406. let keyword = getKeyword();
  2407. const selectors = currentSite.selectors;
  2408. const query = currentSite.query;
  2409. if (keyword === undefined) {
  2410. if (selectors) {
  2411. const el = document.querySelector(selectors);
  2412. keyword = el ? el.value : "";
  2413. } else if (query) {
  2414. query.some(name => {
  2415. const word = getQueryString(name);
  2416. keyword = word;
  2417. return !!word;
  2418. });
  2419. }
  2420. }
  2421. return keyword;
  2422. };
  2423. const handleCateClick = (cate, newWin) => {
  2424. if (isTap) {
  2425. return;
  2426. }
  2427. const urlItem = cate.list.filter(item => item.data.visible).find(item => item.url.indexOf(window.location.hostname) === -1);
  2428. handleClick(urlItem, newWin);
  2429. };
  2430. const handleClick = (item, newWin) => {
  2431. const keyword = defaultKeyword();
  2432. if (newWin) {
  2433. window.open(item.url.replace("%s", keyword));
  2434. } else {
  2435. window.location.href = item.url.replace("%s", keyword);
  2436. }
  2437. };
  2438. onTap(categoryRef, () => {
  2439. isTap = true;
  2440. });
  2441. return {
  2442. placement: placement,
  2443. classList: classList,
  2444. handleMenuShow: handleMenuShow,
  2445. handleClick: handleClick,
  2446. handleCateClick: handleCateClick,
  2447. categoryRef: categoryRef
  2448. };
  2449. }
  2450. };
  2451. const _hoisted_1$5 = [ "onMouseenter", "onMouseleave" ];
  2452. const _hoisted_2$4 = [ "textContent" ];
  2453. const _hoisted_3$3 = {
  2454. class: "as-subMenu"
  2455. };
  2456. const _hoisted_4$2 = [ "onClick", "onMouseup" ];
  2457. const _hoisted_5$1 = [ "textContent" ];
  2458. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  2459. const _component_icon = Vue.resolveComponent("icon");
  2460. const _component_favicon = Vue.resolveComponent("favicon");
  2461. const _component_popper = Vue.resolveComponent("popper");
  2462. return Vue.openBlock(), Vue.createBlock(_component_popper, {
  2463. placement: $setup.placement,
  2464. "popper-class": "as-subMenu-container"
  2465. }, {
  2466. trigger: Vue.withCtx(({show: show, hide: hide}) => [ Vue.createElementVNode("a", {
  2467. class: Vue.normalizeClass([ "as-menu-item no-underline", $setup.classList ]),
  2468. ref: "categoryRef",
  2469. onMouseenter: $event => show($event.target),
  2470. onMouseleave: hide,
  2471. href: "javascript:void 0",
  2472. onClick: [ _cache[0] || (_cache[0] = Vue.withModifiers($event => $setup.handleCateClick($props.item, false), [ "exact" ])), _cache[1] || (_cache[1] = Vue.withModifiers($event => $setup.handleCateClick($props.item, true), [ "ctrl", "exact" ])) ],
  2473. onMouseup: _cache[2] || (_cache[2] = Vue.withModifiers($event => $setup.handleCateClick($props.item, true), [ "middle", "exact" ]))
  2474. }, [ Vue.createVNode(_component_icon, {
  2475. name: $props.item.name
  2476. }, null, 8, [ "name" ]), Vue.createElementVNode("span", {
  2477. class: "as-menu-item-title",
  2478. textContent: Vue.toDisplayString($props.item.nameZh)
  2479. }, null, 8, _hoisted_2$4) ], 42, _hoisted_1$5) ]),
  2480. default: Vue.withCtx(() => [ Vue.createElementVNode("ul", _hoisted_3$3, [ (Vue.openBlock(true),
  2481. Vue.createElementBlock(Vue.Fragment, null, Vue.renderList($props.item.list, (child, i) => Vue.withDirectives((Vue.openBlock(),
  2482. Vue.createElementBlock("li", {
  2483. key: `${$props.item.name}_${i}`
  2484. }, [ Vue.createElementVNode("a", {
  2485. href: "javascript:void 0",
  2486. onClick: [ Vue.withModifiers($event => $setup.handleClick(child), [ "exact" ]), Vue.withModifiers($event => $setup.handleClick(child, true), [ "ctrl", "exact" ]) ],
  2487. onMouseup: Vue.withModifiers($event => $setup.handleClick(child, true), [ "middle", "exact" ])
  2488. }, [ Vue.createVNode(_component_favicon, {
  2489. url: child.url,
  2490. icon: child.icon
  2491. }, null, 8, [ "url", "icon" ]), Vue.createElementVNode("p", {
  2492. class: "as-subMenu-text",
  2493. textContent: Vue.toDisplayString(child.nameZh)
  2494. }, null, 8, _hoisted_5$1) ], 40, _hoisted_4$2) ])), [ [ Vue.vShow, child.data.visible ] ])), 128)) ]) ]),
  2495. _: 1
  2496. }, 8, [ "placement" ]);
  2497. }
  2498. var menuItem = _export_sfc(_sfc_main$a, [ [ "render", _sfc_render$a ] ]);
  2499. const NAME = "align";
  2500. const session = getSession(NAME);
  2501. const list = new Map([ [ "flex-start", "开始" ], [ "center", "居中" ], [ "flex-end", "末尾" ] ]);
  2502. const getVal = val => {
  2503. if (list.has(val)) {
  2504. return val;
  2505. }
  2506. return "flex-start";
  2507. };
  2508. const alignRef = Vue.ref(getVal(session));
  2509. const alignList = Vue.reactive(list);
  2510. const align = Vue.computed({
  2511. get: () => alignRef.value,
  2512. set: val => {
  2513. alignRef.value = val;
  2514. setSession(NAME, getVal(val));
  2515. }
  2516. });
  2517. function useAlign() {
  2518. return {
  2519. alignList: alignList,
  2520. align: align
  2521. };
  2522. }
  2523. var css$9 = ".row {\n display: flex;\n}\n\n.column {\n display: flex;\n flex-direction: column;\n}\n\n.col {\n flex: 1;\n}\n\n.row.items-center, .column.items-center {\n align-items: center;\n}\n\n.row.items-end, .column.items-end {\n align-items: flex-end;\n}\n\n.row.items-stretch, .column.items-stretch {\n align-items: stretch;\n}\n\n.row.justify-center, .column.justify-center {\n justify-content: center;\n}\n\n.row.justify-end, .column.justify-end {\n justify-content: flex-end;\n}\n\n.row.justify-between, .column.justify-between {\n justify-content: space-between;\n}\n\n.row.flex-wrap {\n flex-wrap: wrap;\n}\n\n.row.content-center {\n align-content: center;\n}\n\n.row.content-end {\n align-content: end;\n}\n\n.as-menu-container {\n flex: 1;\n}\n\n.as-menu {\n padding: 0;\n margin: 0;\n white-space: nowrap;\n border: 0;\n box-shadow: none;\n background-color: var(--as-bg-color);\n display: flex;\n}\n\n.as-horizontal-menu {\n flex-direction: row;\n}\n\n.as-vertical-menu {\n flex-direction: column;\n}\n\n.el-scrollbar__bar {\n display: none;\n}";
  2524. injectStyle(css$9);
  2525. const _sfc_main$9 = {
  2526. name: "as-menu",
  2527. components: {
  2528. scrollbar: scrollbar,
  2529. menuItem: menuItem
  2530. },
  2531. props: {
  2532. mode: {
  2533. type: String,
  2534. default: "horizontal",
  2535. validator: val => [ "horizontal", "vertical" ].indexOf(val) > -1
  2536. }
  2537. },
  2538. setup(props) {
  2539. const sites = Vue.reactive(initSites("tm"));
  2540. const {align: align} = useAlign();
  2541. const data = Vue.reactive({
  2542. showTimeout: 50,
  2543. hideTimeout: 200
  2544. });
  2545. const menuClass = Vue.computed(() => ({
  2546. "as-horizontal-menu": props.mode === "horizontal",
  2547. "as-vertical-menu": props.mode === "vertical"
  2548. }));
  2549. return {
  2550. sites: sites,
  2551. data: data,
  2552. align: align,
  2553. menuClass: menuClass
  2554. };
  2555. }
  2556. };
  2557. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  2558. const _component_menu_item = Vue.resolveComponent("menu-item");
  2559. const _component_scrollbar = Vue.resolveComponent("scrollbar");
  2560. return Vue.openBlock(), Vue.createBlock(_component_scrollbar, {
  2561. class: "as-menu-container",
  2562. noresize: ""
  2563. }, {
  2564. default: Vue.withCtx(() => [ Vue.createElementVNode("ul", {
  2565. class: Vue.normalizeClass([ "as-menu", $setup.menuClass ]),
  2566. style: Vue.normalizeStyle({
  2567. justifyContent: $setup.align
  2568. })
  2569. }, [ (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList($setup.sites, item => (Vue.openBlock(),
  2570. Vue.createBlock(_component_menu_item, {
  2571. key: item.name,
  2572. item: item,
  2573. mode: $props.mode
  2574. }, null, 8, [ "item", "mode" ]))), 128)) ], 6) ]),
  2575. _: 1
  2576. });
  2577. }
  2578. var asMenu = _export_sfc(_sfc_main$9, [ [ "render", _sfc_render$9 ] ]);
  2579. const primaryColor = Vue.ref("");
  2580. const bgColor = Vue.ref("");
  2581. const primaryTextColor = Vue.ref("");
  2582. Vue.watch(primaryColor, value => {
  2583. setCssValue("primary-color", value);
  2584. setSession("primary-color", value);
  2585. });
  2586. Vue.watch(bgColor, value => {
  2587. setCssValue("bg-color", value);
  2588. setSession("bg-color", value);
  2589. });
  2590. Vue.watch(primaryTextColor, value => {
  2591. setCssValue("primary-text-color", value);
  2592. setSession("primary-text-color", value);
  2593. });
  2594. const getCssValue = name => {
  2595. const el = document.getElementById("all-search");
  2596. return getComputedStyle(el).getPropertyValue(`--as-${name}`).trim();
  2597. };
  2598. const setCssValue = (name, value) => {
  2599. const el = document.getElementById("all-search");
  2600. el.style.setProperty(`--as-${name}`, value);
  2601. };
  2602. const map = {
  2603. "primary-color": primaryColor,
  2604. "bg-color": bgColor,
  2605. "primary-text-color": primaryTextColor
  2606. };
  2607. const initColor = (name, defaultValue) => {
  2608. const colorDefault = getCssValue(name) || defaultValue;
  2609. const session = getSession(name) || colorDefault;
  2610. const colorVal = map[name];
  2611. colorVal.value = session;
  2612. };
  2613. function useColor() {
  2614. Vue.onMounted(() => {
  2615. initColor("primary-color", "#1890ff");
  2616. initColor("bg-color", "#ffffff");
  2617. initColor("primary-text-color", "#606266");
  2618. });
  2619. return {
  2620. primaryColor: primaryColor,
  2621. bgColor: bgColor,
  2622. primaryTextColor: primaryTextColor
  2623. };
  2624. }
  2625. var css$8 = ".row {\n display: flex;\n}\n\n.column {\n display: flex;\n flex-direction: column;\n}\n\n.col {\n flex: 1;\n}\n\n.row.items-center, .column.items-center {\n align-items: center;\n}\n\n.row.items-end, .column.items-end {\n align-items: flex-end;\n}\n\n.row.items-stretch, .column.items-stretch {\n align-items: stretch;\n}\n\n.row.justify-center, .column.justify-center {\n justify-content: center;\n}\n\n.row.justify-end, .column.justify-end {\n justify-content: flex-end;\n}\n\n.row.justify-between, .column.justify-between {\n justify-content: space-between;\n}\n\n.row.flex-wrap {\n flex-wrap: wrap;\n}\n\n.row.content-center {\n align-content: center;\n}\n\n.row.content-end {\n align-content: end;\n}\n\n.as-overlay {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 999991;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n overflow: auto;\n}";
  2626. injectStyle(css$8);
  2627. const _sfc_main$8 = {
  2628. name: "overlay",
  2629. setup(props, {emit: emit}) {
  2630. let mouseDownTarget = false;
  2631. let mouseUpTarget = false;
  2632. const onMaskClick = e => {
  2633. if (mouseDownTarget && mouseUpTarget) {
  2634. emit("click", e);
  2635. }
  2636. mouseDownTarget = mouseUpTarget = false;
  2637. };
  2638. const onMouseDown = e => {
  2639. mouseDownTarget = e.target === e.currentTarget;
  2640. };
  2641. const onMouseUp = e => {
  2642. mouseUpTarget = e.target === e.currentTarget;
  2643. };
  2644. return {
  2645. onMouseDown: onMouseDown,
  2646. onMouseUp: onMouseUp,
  2647. onMaskClick: onMaskClick
  2648. };
  2649. }
  2650. };
  2651. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  2652. return Vue.openBlock(), Vue.createElementBlock("div", {
  2653. class: "as-overlay",
  2654. onMousedown: _cache[0] || (_cache[0] = (...args) => $setup.onMouseDown && $setup.onMouseDown(...args)),
  2655. onMouseup: _cache[1] || (_cache[1] = (...args) => $setup.onMouseUp && $setup.onMouseUp(...args)),
  2656. onClick: _cache[2] || (_cache[2] = (...args) => $setup.onMaskClick && $setup.onMaskClick(...args))
  2657. }, [ Vue.renderSlot(_ctx.$slots, "default") ], 32);
  2658. }
  2659. var overlay = _export_sfc(_sfc_main$8, [ [ "render", _sfc_render$8 ] ]);
  2660. var css$7 = '/* radio */\nlabel.as-radio {\n color: var(--as-primary-text-color);\n font-weight: 500;\n line-height: 1;\n position: relative;\n cursor: pointer;\n display: inline-block;\n white-space: nowrap;\n outline: none;\n font-size: 14px;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\nlabel.as-radio + label.as-radio {\n margin-left: 14px;\n}\nlabel.as-radio input {\n position: absolute;\n opacity: 0;\n visibility: hidden;\n}\nlabel.as-radio .as-radio-icon {\n display: inline-block;\n position: relative;\n width: 12px;\n height: 12px;\n background: var(--as-bg-color);\n border: 1px solid #979797;\n border-radius: 50%;\n vertical-align: -2px;\n}\nlabel.as-radio input:checked + .as-radio-icon:after {\n position: absolute;\n content: "";\n width: 6px;\n height: 6px;\n background-color: var(--as-bg-color);\n border-radius: 50%;\n top: 3px;\n left: 3px;\n}\nlabel.as-radio input:checked + .as-radio-icon {\n background: var(--as-primary-color);\n border: 1px solid var(--as-primary-color);\n}\nlabel.as-radio input:disabled + .as-radio-icon {\n background-color: #e8e8e8;\n border: solid 1px #979797;\n}\nlabel.as-radio input:disabled:checked + .as-radio-icon:after {\n background-color: #c1c1c1;\n}\nlabel.as-radio.as-radio-animate .as-radio-icon {\n transition: background-color ease-out 0.3s;\n}\nlabel.as-radio .as-radio-label {\n margin-left: 6px;\n font-size: 14px;\n}';
  2661. injectStyle(css$7);
  2662. const _sfc_main$7 = {
  2663. name: "as-radio",
  2664. props: {
  2665. modelValue: {
  2666. type: [ String, Number ]
  2667. },
  2668. label: {
  2669. type: [ String, Number ],
  2670. default: ""
  2671. }
  2672. },
  2673. setup(props, ctx) {
  2674. const model = Vue.computed({
  2675. get() {
  2676. return props.modelValue;
  2677. },
  2678. set(value) {
  2679. ctx.emit("update:modelValue", value);
  2680. }
  2681. });
  2682. return {
  2683. model: model
  2684. };
  2685. }
  2686. };
  2687. const _hoisted_1$4 = {
  2688. class: "as-radio as-radio-animate"
  2689. };
  2690. const _hoisted_2$3 = [ "value" ];
  2691. const _hoisted_3$2 = Vue.createElementVNode("i", {
  2692. class: "as-radio-icon"
  2693. }, null, -1);
  2694. const _hoisted_4$1 = {
  2695. class: "as-radio-label"
  2696. };
  2697. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  2698. return Vue.openBlock(), Vue.createElementBlock("label", _hoisted_1$4, [ Vue.withDirectives(Vue.createElementVNode("input", {
  2699. type: "radio",
  2700. value: $props.label,
  2701. "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => $setup.model = $event)
  2702. }, null, 8, _hoisted_2$3), [ [ Vue.vModelRadio, $setup.model ] ]), _hoisted_3$2, Vue.createElementVNode("span", _hoisted_4$1, [ Vue.renderSlot(_ctx.$slots, "default") ]) ]);
  2703. }
  2704. var radio = _export_sfc(_sfc_main$7, [ [ "render", _sfc_render$7 ] ]);
  2705. var css$6 = ".as-label {\n vertical-align: middle;\n float: left;\n font-size: 14px;\n color: var(--as-primary-text-color);\n line-height: 40px;\n padding: 0 12px 0 0;\n box-sizing: border-box;\n}\n\n.as-content {\n line-height: 40px;\n position: relative;\n font-size: 14px;\n}";
  2706. injectStyle(css$6);
  2707. const _sfc_main$6 = {
  2708. name: "form-item",
  2709. props: {
  2710. labelWidth: {
  2711. type: [ String, Number ],
  2712. default: 80
  2713. },
  2714. label: {
  2715. type: [ String, Number ],
  2716. default: ""
  2717. }
  2718. },
  2719. setup(props) {
  2720. const labelStyle = Vue.computed(() => ({
  2721. width: `${props.labelWidth}px`
  2722. }));
  2723. const contentStyle = Vue.computed(() => ({
  2724. marginLeft: `${props.labelWidth}px`
  2725. }));
  2726. return {
  2727. labelStyle: labelStyle,
  2728. contentStyle: contentStyle
  2729. };
  2730. }
  2731. };
  2732. const _hoisted_1$3 = [ "textContent" ];
  2733. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  2734. return Vue.openBlock(), Vue.createElementBlock("div", null, [ Vue.createElementVNode("label", {
  2735. class: "as-label",
  2736. style: Vue.normalizeStyle($setup.labelStyle),
  2737. textContent: Vue.toDisplayString($props.label)
  2738. }, null, 12, _hoisted_1$3), Vue.createElementVNode("div", {
  2739. class: "as-content",
  2740. style: Vue.normalizeStyle($setup.contentStyle)
  2741. }, [ Vue.renderSlot(_ctx.$slots, "default") ], 4) ]);
  2742. }
  2743. var formItem = _export_sfc(_sfc_main$6, [ [ "render", _sfc_render$6 ] ]);
  2744. var css$5 = ".as-button {\n display: inline-block;\n line-height: 1;\n white-space: nowrap;\n cursor: pointer;\n background: #fff;\n border: 1px solid #dcdfe6;\n color: var(--as-primary-text-color);\n text-align: center;\n box-sizing: border-box;\n outline: none;\n margin: 0;\n transition: 0.1s;\n font-weight: 500;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n padding: 12px 20px;\n font-size: 14px;\n border-radius: 4px;\n}\n\n.as-button.as-button__text {\n border-color: transparent;\n color: var(--as-primary-color);\n background: transparent;\n padding-left: 0;\n padding-right: 0;\n}\n\n.as-button.as-button__primary {\n color: #fff;\n background-color: var(--as-primary-color);\n border-color: var(--as-primary-color);\n}";
  2745. injectStyle(css$5);
  2746. const _sfc_main$5 = {
  2747. name: "xButton",
  2748. props: {
  2749. type: {
  2750. type: String,
  2751. default: "primary"
  2752. }
  2753. }
  2754. };
  2755. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  2756. return Vue.openBlock(), Vue.createElementBlock("button", {
  2757. class: Vue.normalizeClass([ "as-button", `as-button__${$props.type}` ])
  2758. }, [ Vue.renderSlot(_ctx.$slots, "default") ], 2);
  2759. }
  2760. var button = _export_sfc(_sfc_main$5, [ [ "render", _sfc_render$5 ] ]);
  2761. var css$4 = '@charset "UTF-8";\n.as-color-set .as-color-label {\n line-height: 1;\n position: relative;\n cursor: pointer;\n display: inline-block;\n white-space: nowrap;\n outline: none;\n vertical-align: middle;\n}\n.as-color-set .input—color {\n width: 30px;\n height: 30px;\n padding: 4px;\n border: 1px solid #e6e6e6;\n border-radius: 4px;\n background-color: var(--as-secondary-background-color);\n box-sizing: border-box;\n}\n.as-color-set .input—color::-webkit-color-swatch {\n border: 0;\n}\n.as-color-set .input—color::-webkit-color-swatch-wrapper {\n padding: 0;\n}\n.as-color-set .reset-btn {\n margin-left: 20px;\n}';
  2762. injectStyle(css$4);
  2763. const _sfc_main$4 = {
  2764. name: "color",
  2765. components: {
  2766. asButton: button
  2767. },
  2768. props: {
  2769. modelValue: {
  2770. type: [ String, Number ]
  2771. },
  2772. defaultValue: {
  2773. type: [ String, Number ]
  2774. }
  2775. },
  2776. setup(props, ctx) {
  2777. const model = Vue.computed({
  2778. get() {
  2779. return props.modelValue;
  2780. },
  2781. set(value) {
  2782. ctx.emit("update:modelValue", value);
  2783. }
  2784. });
  2785. const reset = () => {
  2786. model.value = props.defaultValue;
  2787. };
  2788. return {
  2789. model: model,
  2790. reset: reset
  2791. };
  2792. }
  2793. };
  2794. const _hoisted_1$2 = {
  2795. class: "as-color-set"
  2796. };
  2797. const _hoisted_2$2 = {
  2798. class: "as-color-label"
  2799. };
  2800. const _hoisted_3$1 = Vue.createTextVNode(" 重置 ");
  2801. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  2802. const _component_asButton = Vue.resolveComponent("asButton");
  2803. return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1$2, [ Vue.createElementVNode("label", _hoisted_2$2, [ Vue.withDirectives(Vue.createElementVNode("input", {
  2804. class: "input—color",
  2805. type: "color",
  2806. "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => $setup.model = $event)
  2807. }, null, 512), [ [ Vue.vModelText, $setup.model ] ]) ]), Vue.createVNode(_component_asButton, {
  2808. class: "reset-btn",
  2809. type: "text",
  2810. onClick: $setup.reset
  2811. }, {
  2812. default: Vue.withCtx(() => [ _hoisted_3$1 ]),
  2813. _: 1
  2814. }, 8, [ "onClick" ]) ]);
  2815. }
  2816. var color = _export_sfc(_sfc_main$4, [ [ "render", _sfc_render$4 ] ]);
  2817. var css$3 = ".row {\n display: flex;\n}\n\n.column {\n display: flex;\n flex-direction: column;\n}\n\n.col {\n flex: 1;\n}\n\n.row.items-center, .column.items-center {\n align-items: center;\n}\n\n.row.items-end, .column.items-end {\n align-items: flex-end;\n}\n\n.row.items-stretch, .column.items-stretch {\n align-items: stretch;\n}\n\n.row.justify-center, .column.justify-center {\n justify-content: center;\n}\n\n.row.justify-end, .column.justify-end {\n justify-content: flex-end;\n}\n\n.row.justify-between, .column.justify-between {\n justify-content: space-between;\n}\n\n.row.flex-wrap {\n flex-wrap: wrap;\n}\n\n.row.content-center {\n align-content: center;\n}\n\n.row.content-end {\n align-content: end;\n}\n\n.as-setting {\n position: relative;\n}\n.as-setting.horizontal {\n box-shadow: -4px 0 10px 0 rgba(0, 0, 0, 0.12);\n display: flex;\n}\n\n.as-setting-btn {\n line-height: 30px;\n padding: 0 14px;\n position: relative;\n margin: 0;\n white-space: nowrap;\n cursor: pointer;\n font-size: 14px;\n color: var(--as-primary-text-color);\n text-align: center;\n}\n.as-setting-btn:hover {\n color: var(--as-primary-color);\n background-color: rgba(0, 0, 0, 0.04);\n}\n\n.as-side-bar {\n width: 20vw;\n min-width: 300px;\n right: 0;\n height: 100%;\n top: 0;\n bottom: 0;\n position: absolute;\n box-sizing: border-box;\n background-color: var(--as-bg-color);\n display: flex;\n flex-direction: column;\n box-shadow: 0 8px 10px -5px rgba(0, 0, 0, 0.2), 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12);\n overflow: hidden;\n}\n.as-side-bar > header {\n font-size: 16px;\n align-items: center;\n color: var(--as-primary-text-color);\n display: flex;\n margin-bottom: 32px;\n padding: 20px 24px 0;\n}\n.as-side-bar > section {\n padding: 10px 24px;\n height: 100%;\n flex: 1;\n}\n.as-side-bar > footer {\n padding: 10px 24px 30px;\n}\n.as-side-bar > footer .link {\n font-size: 14px;\n text-decoration: none;\n}\n.as-side-bar > footer .link:visited {\n color: var(--as-primary-text-color);\n}\n.as-side-bar > footer .link + .link {\n margin-left: 20px;\n}\n\n.overlay-enter-active, .overlay-leave-active {\n transition: opacity 0.3s;\n}\n\n.overlay-enter-from, .overlay-leave-to {\n opacity: 0;\n}\n\n.overlay-enter-active .as-side-bar {\n animation: rtl-drawer-animation 0.3s linear reverse;\n}\n\n.overlay-leave-active .as-side-bar {\n -webkit-animation: rtl-drawer-animation 0.3s linear;\n animation: rtl-drawer-animation 0.3s linear;\n}\n\n@-webkit-keyframes rtl-drawer-animation {\n 0% {\n transform: translate(0);\n }\n to {\n transform: translate(100%);\n }\n}\n\n@keyframes rtl-drawer-animation {\n 0% {\n transform: translate(0);\n }\n to {\n transform: translate(100%);\n }\n}";
  2818. injectStyle(css$3);
  2819. const _sfc_main$3 = {
  2820. name: "side-bar",
  2821. components: {
  2822. overlay: overlay,
  2823. asRadio: radio,
  2824. formItem: formItem,
  2825. color: color,
  2826. asButton: button
  2827. },
  2828. setup() {
  2829. const visible = Vue.ref(false);
  2830. const open = () => {
  2831. visible.value = true;
  2832. };
  2833. const onMaskClick = () => {
  2834. visible.value = false;
  2835. };
  2836. const {mode: mode} = useMode();
  2837. const {alignList: alignList, align: align} = useAlign();
  2838. const {primaryColor: primaryColor, bgColor: bgColor, primaryTextColor: primaryTextColor} = useColor();
  2839. const {show: show, options: options, scrollHide: scrollHide} = useSwitchShow();
  2840. const {favicon: favicon} = useFavicon();
  2841. const clearIconCache = function() {
  2842. if (window.confirm("确认要清除图标的缓存吗")) {
  2843. setSession("iconCache", {});
  2844. }
  2845. };
  2846. return {
  2847. mode: mode,
  2848. visible: visible,
  2849. open: open,
  2850. onMaskClick: onMaskClick,
  2851. alignList: alignList,
  2852. align: align,
  2853. favicon: favicon,
  2854. primaryColor: primaryColor,
  2855. bgColor: bgColor,
  2856. primaryTextColor: primaryTextColor,
  2857. show: show,
  2858. options: options,
  2859. scrollHide: scrollHide,
  2860. clearIconCache: clearIconCache
  2861. };
  2862. }
  2863. };
  2864. const _hoisted_1$1 = Vue.createElementVNode("header", {
  2865. class: "header"
  2866. }, " 设置 ", -1);
  2867. const _hoisted_2$1 = Vue.createTextVNode("横向 ");
  2868. const _hoisted_3 = Vue.createTextVNode("竖向 ");
  2869. const _hoisted_4 = Vue.createTextVNode("显示 ");
  2870. const _hoisted_5 = Vue.createTextVNode("隐藏 ");
  2871. const _hoisted_6 = Vue.createTextVNode(" 清除 ");
  2872. const _hoisted_7 = Vue.createElementVNode("footer", null, [ Vue.createElementVNode("a", {
  2873. class: "link",
  2874. title: "all-search",
  2875. href: "https://endday.github.io/all-search/",
  2876. target: "_blank"
  2877. }, " 设置页 "), Vue.createElementVNode("a", {
  2878. class: "link",
  2879. title: "github",
  2880. href: "https://github.com/endday/all-search/issues",
  2881. target: "_blank"
  2882. }, " 意见反馈 ") ], -1);
  2883. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  2884. const _component_as_radio = Vue.resolveComponent("as-radio");
  2885. const _component_form_item = Vue.resolveComponent("form-item");
  2886. const _component_color = Vue.resolveComponent("color");
  2887. const _component_as_button = Vue.resolveComponent("as-button");
  2888. const _component_overlay = Vue.resolveComponent("overlay");
  2889. return Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, null, [ Vue.createElementVNode("div", {
  2890. class: Vue.normalizeClass([ "as-setting", $setup.mode ])
  2891. }, [ Vue.createElementVNode("div", {
  2892. class: "as-setting-btn",
  2893. onClick: _cache[0] || (_cache[0] = $event => $setup.show = false)
  2894. }, " 收起 "), Vue.createElementVNode("div", {
  2895. class: "as-setting-btn",
  2896. onClick: _cache[1] || (_cache[1] = (...args) => $setup.open && $setup.open(...args))
  2897. }, " 设置 ") ], 2), (Vue.openBlock(), Vue.createBlock(Vue.Teleport, {
  2898. to: "#all-search"
  2899. }, [ Vue.createVNode(Vue.Transition, {
  2900. name: "overlay",
  2901. appear: ""
  2902. }, {
  2903. default: Vue.withCtx(() => [ Vue.withDirectives(Vue.createVNode(_component_overlay, {
  2904. onClick: $setup.onMaskClick
  2905. }, {
  2906. default: Vue.withCtx(() => [ Vue.createVNode(Vue.Transition, {
  2907. name: "drawer",
  2908. appear: ""
  2909. }, {
  2910. default: Vue.withCtx(() => [ Vue.withDirectives(Vue.createElementVNode("div", {
  2911. "aria-modal": "true",
  2912. role: "dialog",
  2913. class: "as-side-bar",
  2914. onClick: _cache[11] || (_cache[11] = Vue.withModifiers(() => {}, [ "stop" ]))
  2915. }, [ _hoisted_1$1, Vue.createElementVNode("section", null, [ Vue.createVNode(_component_form_item, {
  2916. label: "方向"
  2917. }, {
  2918. default: Vue.withCtx(() => [ Vue.createVNode(_component_as_radio, {
  2919. label: "horizontal",
  2920. modelValue: $setup.mode,
  2921. "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => $setup.mode = $event)
  2922. }, {
  2923. default: Vue.withCtx(() => [ _hoisted_2$1 ]),
  2924. _: 1
  2925. }, 8, [ "modelValue" ]), Vue.createVNode(_component_as_radio, {
  2926. label: "vertical",
  2927. modelValue: $setup.mode,
  2928. "onUpdate:modelValue": _cache[3] || (_cache[3] = $event => $setup.mode = $event)
  2929. }, {
  2930. default: Vue.withCtx(() => [ _hoisted_3 ]),
  2931. _: 1
  2932. }, 8, [ "modelValue" ]) ]),
  2933. _: 1
  2934. }), Vue.createVNode(_component_form_item, {
  2935. label: "对齐"
  2936. }, {
  2937. default: Vue.withCtx(() => [ (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList($setup.alignList, ([key, value]) => (Vue.openBlock(),
  2938. Vue.createBlock(_component_as_radio, {
  2939. key: key,
  2940. label: key,
  2941. modelValue: $setup.align,
  2942. "onUpdate:modelValue": _cache[4] || (_cache[4] = $event => $setup.align = $event)
  2943. }, {
  2944. default: Vue.withCtx(() => [ Vue.createTextVNode(Vue.toDisplayString(value), 1) ]),
  2945. _: 2
  2946. }, 1032, [ "label", "modelValue" ]))), 128)) ]),
  2947. _: 1
  2948. }), Vue.createVNode(_component_form_item, {
  2949. label: "滚动隐藏"
  2950. }, {
  2951. default: Vue.withCtx(() => [ (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList($setup.options, ([key, value]) => (Vue.openBlock(),
  2952. Vue.createBlock(_component_as_radio, {
  2953. key: key,
  2954. label: key,
  2955. modelValue: $setup.scrollHide,
  2956. "onUpdate:modelValue": _cache[5] || (_cache[5] = $event => $setup.scrollHide = $event)
  2957. }, {
  2958. default: Vue.withCtx(() => [ Vue.createTextVNode(Vue.toDisplayString(value), 1) ]),
  2959. _: 2
  2960. }, 1032, [ "label", "modelValue" ]))), 128)) ]),
  2961. _: 1
  2962. }), Vue.createVNode(_component_form_item, {
  2963. label: "图标"
  2964. }, {
  2965. default: Vue.withCtx(() => [ Vue.createVNode(_component_as_radio, {
  2966. label: 1,
  2967. modelValue: $setup.favicon,
  2968. "onUpdate:modelValue": _cache[6] || (_cache[6] = $event => $setup.favicon = $event)
  2969. }, {
  2970. default: Vue.withCtx(() => [ _hoisted_4 ]),
  2971. _: 1
  2972. }, 8, [ "modelValue" ]), Vue.createVNode(_component_as_radio, {
  2973. label: 2,
  2974. modelValue: $setup.favicon,
  2975. "onUpdate:modelValue": _cache[7] || (_cache[7] = $event => $setup.favicon = $event)
  2976. }, {
  2977. default: Vue.withCtx(() => [ _hoisted_5 ]),
  2978. _: 1
  2979. }, 8, [ "modelValue" ]) ]),
  2980. _: 1
  2981. }), Vue.createVNode(_component_form_item, {
  2982. label: "主题色"
  2983. }, {
  2984. default: Vue.withCtx(() => [ Vue.createVNode(_component_color, {
  2985. "default-value": "#1890ff",
  2986. modelValue: $setup.primaryColor,
  2987. "onUpdate:modelValue": _cache[8] || (_cache[8] = $event => $setup.primaryColor = $event)
  2988. }, null, 8, [ "modelValue" ]) ]),
  2989. _: 1
  2990. }), Vue.createVNode(_component_form_item, {
  2991. label: "背景色"
  2992. }, {
  2993. default: Vue.withCtx(() => [ Vue.createVNode(_component_color, {
  2994. "default-value": "#ffffff",
  2995. modelValue: $setup.bgColor,
  2996. "onUpdate:modelValue": _cache[9] || (_cache[9] = $event => $setup.bgColor = $event)
  2997. }, null, 8, [ "modelValue" ]) ]),
  2998. _: 1
  2999. }), Vue.createVNode(_component_form_item, {
  3000. label: "文字色"
  3001. }, {
  3002. default: Vue.withCtx(() => [ Vue.createVNode(_component_color, {
  3003. "default-value": "#606266",
  3004. modelValue: $setup.primaryTextColor,
  3005. "onUpdate:modelValue": _cache[10] || (_cache[10] = $event => $setup.primaryTextColor = $event)
  3006. }, null, 8, [ "modelValue" ]) ]),
  3007. _: 1
  3008. }), Vue.createVNode(_component_form_item, {
  3009. label: "图标缓存"
  3010. }, {
  3011. default: Vue.withCtx(() => [ Vue.createVNode(_component_as_button, {
  3012. type: "text",
  3013. onClick: $setup.clearIconCache
  3014. }, {
  3015. default: Vue.withCtx(() => [ _hoisted_6 ]),
  3016. _: 1
  3017. }, 8, [ "onClick" ]) ]),
  3018. _: 1
  3019. }) ]), _hoisted_7 ], 512), [ [ Vue.vShow, $setup.visible ] ]) ]),
  3020. _: 1
  3021. }) ]),
  3022. _: 1
  3023. }, 8, [ "onClick" ]), [ [ Vue.vShow, $setup.visible ] ]) ]),
  3024. _: 1
  3025. }) ])) ], 64);
  3026. }
  3027. var sideBar = _export_sfc(_sfc_main$3, [ [ "render", _sfc_render$3 ] ]);
  3028. function throttle(fn, delay) {
  3029. let canRun = true;
  3030. return function() {
  3031. if (!canRun) return;
  3032. canRun = false;
  3033. setTimeout(() => {
  3034. fn.apply(this, arguments);
  3035. canRun = true;
  3036. }, delay);
  3037. };
  3038. }
  3039. const y = Vue.ref(0);
  3040. const direction = Vue.ref(0);
  3041. function useScroll() {
  3042. const scrollHandler = throttle((function(e) {
  3043. const eventTarget = e.target === document ? e.target.documentElement : e.target;
  3044. const scrollTop = eventTarget.scrollTop;
  3045. if (scrollTop < y.value) {
  3046. direction.value = "top";
  3047. } else if (scrollTop > y.value) {
  3048. direction.value = "bottom";
  3049. } else {
  3050. direction.value = "mid";
  3051. }
  3052. y.value = scrollTop;
  3053. }), 50);
  3054. if (window) {
  3055. window.addEventListener("scroll", scrollHandler);
  3056. }
  3057. return {
  3058. y: y,
  3059. direction: direction
  3060. };
  3061. }
  3062. var css$2 = "\n.as-hover-btn[data-v-ad24c1fe] {\n position: fixed;\n z-index: 99999;\n font-weight: 600;\n font-size: 17px;\n color: var(--as-primary-color);\n background: #fff;\n box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);\n border: 1px var(--as-border-color) solid;\n opacity: 0.6;\n cursor: pointer;\n}\n.as-hover-btn-horizontal[data-v-ad24c1fe] {\n top: 0;\n left: 50%;\n transform: translateY(0) translateX(-50%);\n padding: 0 16px;\n height: 28px;\n line-height: 28px;\n}\n.as-hover-btn-vertical[data-v-ad24c1fe] {\n left: 0;\n top: 50%;\n transform: translateY(-200%) translateX(0) rotate(90deg);\n transform-origin: 0 100%;\n padding: 0 16px;\n height: 28px;\n line-height: 28px;\n}\n.hover-btn.as-hide[data-v-ad24c1fe] {\n transition: transform 0.2s;\n transform: translateY(-100%) translateX(-50%);\n}\n";
  3063. injectStyle(css$2);
  3064. const _sfc_main$2 = {
  3065. name: "hover-btn",
  3066. setup() {
  3067. let {show: show, scrollHide: scrollHide} = useSwitchShow();
  3068. const isMobileVal = isMobile();
  3069. const handleMouseEnter = () => {
  3070. if (!isMobileVal) {
  3071. show.value = true;
  3072. }
  3073. };
  3074. const handleClick = () => {
  3075. if (isMobileVal) {
  3076. show.value = true;
  3077. }
  3078. };
  3079. const {direction: direction} = useScroll();
  3080. Vue.watch(direction, value => {
  3081. if (show.value && scrollHide.value && (value === scrollHide.value || scrollHide.value === "all")) {
  3082. show.value = false;
  3083. }
  3084. });
  3085. const {mode: mode} = useMode();
  3086. const className = Vue.computed(() => ({
  3087. "as-hide": !show.value,
  3088. [`as-hover-btn-${mode.value}`]: true
  3089. }));
  3090. return {
  3091. handleMouseEnter: handleMouseEnter,
  3092. handleClick: handleClick,
  3093. className: className
  3094. };
  3095. }
  3096. };
  3097. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  3098. return Vue.openBlock(), Vue.createElementBlock("div", {
  3099. class: Vue.normalizeClass([ "as-hover-btn", $setup.className ]),
  3100. onMouseenter: _cache[0] || (_cache[0] = (...args) => $setup.handleMouseEnter && $setup.handleMouseEnter(...args)),
  3101. onClick: _cache[1] || (_cache[1] = (...args) => $setup.handleClick && $setup.handleClick(...args))
  3102. }, " All Search ", 34);
  3103. }
  3104. var hoverBtn = _export_sfc(_sfc_main$2, [ [ "render", _sfc_render$2 ], [ "__scopeId", "data-v-ad24c1fe" ] ]);
  3105. var css$1 = "\n.svgfont[data-v-4f20014d] {\n display: inline-block;\n width: 1em;\n height: 1em;\n fill: currentColor;\n vertical-align: -0.1em;\n font-size: 16px;\n}\n";
  3106. injectStyle(css$1);
  3107. const _sfc_main$1 = {
  3108. name: "svg"
  3109. };
  3110. const _hoisted_1 = {
  3111. style: {
  3112. display: "none"
  3113. }
  3114. };
  3115. const _hoisted_2 = Vue.createStaticVNode('<symbol id="icon-disk" viewBox="0 0 1024 1024" data-v-4f20014d><path d="M722.858667 234.666667a64 64 0 0 1 56.533333 33.984L874.666667 448v256a64 64 0 0 1-64 64H213.333333a64 64 0 0 1-64-64V448l95.274667-179.349333A64 64 0 0 1 301.141333 234.666667h421.717334zM810.666667 501.333333H213.333333V704h597.333334v-202.666667zM618.666667 576v64H384v-64h234.666667z m128 0v64h-64v-64h64z m-23.808-277.333333H301.141333l-73.685333 138.666666h569.066667L722.858667 298.666667z" data-v-4f20014d></path></symbol><symbol id="icon-personal" viewBox="0 0 1024 1024" data-v-4f20014d><path d="M490.261333 173.44a49.066667 49.066667 0 0 1 64.064 19.178667l1.664 3.093333 87.850667 177.813333 196.352 28.501334a49.066667 49.066667 0 0 1 29.717333 81.066666l-2.538666 2.645334L725.333333 624l33.536 195.349333a49.066667 49.066667 0 0 1-68.010666 53.269334l-3.157334-1.514667L512 778.858667l-175.701333 92.266666a49.066667 49.066667 0 0 1-71.637334-48.426666l0.469334-3.328L298.666667 624.021333 156.629333 485.76a49.066667 49.066667 0 0 1 23.893334-83.114667l3.285333-0.597333 196.352-28.501333 87.850667-177.813334a49.066667 49.066667 0 0 1 22.250666-22.272z m-67.626666 258.581333l-199.658667 28.992 144.469333 140.650667-34.133333 198.741333L512 706.56l178.688 93.845333-34.133333-198.741333 144.469333-140.650667-199.658667-28.992L512 251.157333l-89.386667 180.864z" data-v-4f20014d></path></symbol><symbol id="icon-shopping" viewBox="0 0 1024 1024" data-v-4f20014d><path d="M330.667 768a53.333 53.333 0 1 1 0 106.667 53.333 53.333 0 0 1 0-106.667z m384 0a53.333 53.333 0 1 1 0 106.667 53.333 53.333 0 0 1 0-106.667zM94.763 160h54.741a96 96 0 0 1 92.907 71.787l1.024 4.394 13.205 62.486h0.213L299.733 504l32.491 157.333h402.219l61.653-298.666H313.813l-13.376-64h495.68a64 64 0 0 1 62.678 76.949L797.14 674.283a64 64 0 0 1-62.698 51.05H332.224a64 64 0 0 1-62.677-51.05L208.96 380.864l-0.405 0.085-27.734-131.562a32 32 0 0 0-28.309-25.238l-2.987-0.149H94.741v-64h54.742z" data-v-4f20014d></path></symbol><symbol id="icon-developer" viewBox="0 0 1024 1024" data-v-4f20014d><path d="M541.141333 268.864l61.717334 16.938667-132.394667 482.474666-61.717333-16.938666 132.394666-482.474667zM329.002667 298.666667l44.885333 45.610666-175.36 172.586667 175.04 167.573333-44.266667 46.229334L106.666667 517.504 329.002667 298.666667z m355.882666 0l222.336 218.837333L684.586667 730.666667l-44.266667-46.229334 175.018667-167.573333L640 344.277333 684.885333 298.666667z" data-v-4f20014d></path></symbol><symbol id="icon-image" viewBox="0 0 1024 1024" data-v-4f20014d><path d="M817.365333 213.333333a64 64 0 0 1 64 64v469.333334a64 64 0 0 1-64 64h-597.333333a64 64 0 0 1-64-64V277.333333a64 64 0 0 1 64-64h597.333333z m0 64h-597.333333v469.333334h597.333333V277.333333zM746.666667 371.114667v63.957333c-100.608-1.450667-163.306667 30.293333-193.493334 94.229333l-2.304 5.12-2.858666 6.357334c-44.010667 95.146667-129.088 142.464-249.322667 140.842666v-64c96.234667 1.6 157.930667-32.384 190.933333-103.04l2.538667-5.632 2.624-5.845333c41.664-89.664 127.488-133.333333 251.882667-131.989333z m-397.696-17.237334a42.666667 42.666667 0 1 1 0 85.333334 42.666667 42.666667 0 0 1 0-85.333334z" data-v-4f20014d></path></symbol><symbol id="icon-social" viewBox="0 0 1024 1024" data-v-4f20014d><path d="M617.216 170.666667c114.24 0 206.869333 92.608 206.869333 206.869333 0 72.533333-37.333333 136.32-93.802666 173.269333l168.746666 196.885334A64 64 0 0 1 850.432 853.333333l-101.888 0.021334c11.221333-19.413333 14.293333-42.496 8.746667-64L850.432 789.333333 634.24 537.109333l60.992-39.872a142.869333 142.869333 0 0 0-75.584-262.549333 251.264 251.264 0 0 0-55.424-57.173333A206.976 206.976 0 0 1 617.216 170.666667z m-61.162667 412.757333l140.8 164.266667A64 64 0 0 1 648.213333 853.333333H181.824a64 64 0 0 1-48.597333-105.642666l140.8-164.266667c18.026667 12.373333 37.76 22.442667 58.773333 29.781333L181.824 789.333333h466.410667l-150.997334-176.128c21.034667-7.338667 40.768-17.386667 58.816-29.781333zM415.04 170.666667c114.24 0 206.869333 92.608 206.869333 206.869333 0 114.24-92.629333 206.869333-206.869333 206.869333-114.261333 0-206.869333-92.629333-206.869333-206.869333C208.170667 263.274667 300.778667 170.666667 415.04 170.666667z m0 64a142.869333 142.869333 0 1 0 0 285.738666 142.869333 142.869333 0 0 0 0-285.738666z" data-v-4f20014d></path></symbol><symbol id="icon-news" viewBox="0 0 1024 1024" data-v-4f20014d><path d="M640 170.666667a64 64 0 0 1 64 64v490.666666h-64V234.666667H213.333333v554.666666h597.333334V362.666667h-64v-64h64a64 64 0 0 1 64 64v426.666666a64 64 0 0 1-64 64H213.333333a64 64 0 0 1-64-64V234.666667a64 64 0 0 1 64-64h426.666667z m-192 320v64h-170.666667v-64h170.666667z m128-128v64H277.333333v-64h298.666667z" data-v-4f20014d></path></symbol><symbol id="icon-knowledge" viewBox="0 0 1024 1024" data-v-4f20014d><path d="M168.106667 621.44l120.746666 57.962667 223.274667 108.138666 215.317333-104.32 128.768-61.674666a64 64 0 0 1-29.952 84.970666l-286.229333 138.624a64 64 0 0 1-55.808 0L197.994667 706.517333A64 64 0 0 1 168.106667 621.44z m687.829333-133.930667a64 64 0 0 1-29.674667 85.546667L540.010667 711.68a64 64 0 0 1-55.808 0L197.994667 573.056A64 64 0 0 1 166.826667 490.88l317.013333 149.525333 28.288 13.696 286.229333-138.624-0.149333-0.064 57.728-27.882666zM540.032 185.792l286.208 138.602667a64 64 0 0 1 0 115.2l-286.208 138.624a64 64 0 0 1-55.808 0L197.994667 439.594667a64 64 0 0 1 0-115.2L484.224 185.813333a64 64 0 0 1 55.808 0z m-27.904 57.6l-286.229333 138.602667 286.229333 138.624 286.229333-138.624-286.229333-138.602667z" data-v-4f20014d></path></symbol><symbol id="icon-music" viewBox="0 0 1024 1024" data-v-4f20014d><path d="M515.562667 232.91733299c159.061333 0 288 128.938667 288 288v22.250667A85.354667 85.354667 0 0 1 874.666667 627.30666699v93.994666a85.333333 85.333333 0 0 1-85.333334 85.333334h-116.138666V541.97333299h66.346666v-21.056c0-121.685333-97.002667-220.693333-217.92-223.914666l-6.058666-0.085334h-7.125334c-123.712 0-224 100.288-224 224v21.056h66.368v264.661334H234.666667a85.333333 85.333333 0 0 1-85.333334-85.333334v-93.994666a85.354667 85.354667 0 0 1 71.104-84.138667v-22.250667c0-159.061333 128.938667-288 288-288z m27.52 313.813334v256h-62.165334v-256h62.165334z m103.616 42.666666v192H584.533333v-192h62.165334z m-207.232 0v192h-62.165334v-192H439.466667z m-152.661334 16.576H234.666667a21.333333 21.333333 0 0 0-21.333334 21.333334v93.994666a21.333333 21.333333 0 0 0 21.333334 21.333334h52.138666v-136.661334z m502.528 0h-52.138666v136.661334H789.333333a21.333333 21.333333 0 0 0 21.333334-21.333334v-93.994666a21.333333 21.333333 0 0 0-21.333334-21.333334z" data-v-4f20014d></path></symbol><symbol id="icon-translate" viewBox="0 0 1024 1024" data-v-4f20014d><path d="M874.666667 192.00000033v64h-42.666667v426.666666c0 35.349333-30.72 64-68.565333 64h-149.354667l113.749333 128h-85.632l-113.770666-128h-11.562667l-113.749333 128h-85.610667l113.728-128h-170.666667C222.72 746.66666633 192 718.01600033 192 682.66666633V256.00000033H149.333333V192.00000033h725.333334z m-106.666667 64H256v426.666666h512V256.00000033zM405.333333 490.66666633v64h-64v-64h64z m277.333334 0v64H448v-64h234.666667z m0-106.666666v64H448v-64h234.666667z m-277.333334 0v64h-64v-64h64z" data-v-4f20014d></path></symbol><symbol id="icon-video" viewBox="0 0 1024 1024" data-v-4f20014d><path d="M658.069333 234.66666667a64 64 0 0 1 64 64l-0.021333 33.664 49.28-38.4A64 64 0 0 1 874.666667 344.44799967v338.368a64 64 0 0 1-103.338667 50.474667l-49.28-38.4v26.496a64 64 0 0 1-64 64H213.333333a64 64 0 0 1-64-64V298.66666667a64 64 0 0 1 64-64h444.736z m0 64H213.333333v422.698667h444.736l-0.128-157.589334L810.666667 682.79466667V344.42666667l-152.704 118.933333 0.106666-164.693333zM384 375.97866667a42.666667 42.666667 0 0 1 22.741333 6.570667l133.866667 84.330666a42.666667 42.666667 0 0 1 0.32 72l-133.866667 86.016A42.666667 42.666667 0 0 1 341.333333 588.99199967v-170.346666a42.666667 42.666667 0 0 1 42.666667-42.666667z m21.333333 81.322667v92.629333l72.789334-46.762667L405.333333 457.30133367z" data-v-4f20014d></path></symbol><symbol id="icon-search" viewBox="0 0 1024 1024" data-v-4f20014d><path d="M469.333 192c153.174 0 277.334 124.16 277.334 277.333 0 68.054-24.534 130.411-65.216 178.688L846.336 818.24l-48.341 49.877L630.4 695.125a276.053 276.053 0 0 1-161.067 51.542C316.16 746.667 192 622.507 192 469.333S316.16 192 469.333 192z m0 64C351.51 256 256 351.51 256 469.333s95.51 213.334 213.333 213.334 213.334-95.51 213.334-213.334S587.157 256 469.333 256z" data-v-4f20014d></path></symbol>', 12);
  3116. const _hoisted_14 = [ _hoisted_2 ];
  3117. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  3118. return Vue.openBlock(), Vue.createElementBlock("svg", _hoisted_1, _hoisted_14);
  3119. }
  3120. var iconfont = _export_sfc(_sfc_main$1, [ [ "render", _sfc_render$1 ], [ "__scopeId", "data-v-4f20014d" ] ]);
  3121. var css = '.row {\n display: flex;\n}\n\n.column {\n display: flex;\n flex-direction: column;\n}\n\n.col {\n flex: 1;\n}\n\n.row.items-center, .column.items-center {\n align-items: center;\n}\n\n.row.items-end, .column.items-end {\n align-items: flex-end;\n}\n\n.row.items-stretch, .column.items-stretch {\n align-items: stretch;\n}\n\n.row.justify-center, .column.justify-center {\n justify-content: center;\n}\n\n.row.justify-end, .column.justify-end {\n justify-content: flex-end;\n}\n\n.row.justify-between, .column.justify-between {\n justify-content: space-between;\n}\n\n.row.flex-wrap {\n flex-wrap: wrap;\n}\n\n.row.content-center {\n align-content: center;\n}\n\n.row.content-end {\n align-content: end;\n}\n\n.body-horizontal + body {\n margin-top: 30px !important;\n}\n.body-horizontal + body [data-as-margin-top] {\n margin-top: 30px !important;\n}\n.body-horizontal + body [data-as-transform] {\n transform: translateY(30px);\n}\n.body-horizontal + body [data-as-border-top] {\n border-top: rgba(0, 0, 0, 0) 30px solid;\n box-sizing: content-box;\n}\n.body-horizontal + body [data-as-has-set] {\n transition-duration: 0s;\n}\n\n.body-vertical + body {\n margin-left: 90px !important;\n}\n\nbody, #all-search {\n --as-horizontal-height: $height;\n --as-primary-color: #1890ff;\n --as-bg-color: #ffffff;\n --as-primary-text-color: #606266;\n --as-secondary-background-color: #f5f7fa;\n --as-border-color: #e8e8e8;\n}\n\n#all-search {\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";\n}\n\n/*@media (prefers-color-scheme: dark) {\n #all-search {\n --as-primary-color: #3d9be9;\n --as-bg-color: #212121;\n --as-primary-text-color: #e0e0e0;\n --as-secondary-background-color: #444;\n --as-border-color: #212121;\n }\n}*/\n.as-horizontal {\n height: 30px;\n width: 100%;\n top: 0;\n border-bottom: 1px var(--as-border-color) solid;\n flex-direction: row;\n transition: transform 0.1s;\n}\n.as-horizontal.as-hide {\n transform: translateY(-100%);\n}\n.as-horizontal.as-show {\n transform: translateY(0);\n}\n\n.as-vertical {\n height: 100%;\n width: 90px;\n top: 0;\n left: 0;\n border-right: 1px var(--as-border-color) solid;\n flex-direction: column;\n transition: transform 0.1s;\n}\n.as-vertical.as-hide {\n transform: translateX(-100%);\n}\n.as-vertical.as-show {\n transform: translateX(0);\n}\n\n.as-container {\n opacity: 1 !important;\n position: fixed;\n display: flex;\n background-color: var(--as-bg-color);\n z-index: 999990;\n}';
  3122. injectStyle(css);
  3123. const _sfc_main = {
  3124. name: "all-search",
  3125. components: {
  3126. logo: logo,
  3127. asMenu: asMenu,
  3128. sideBar: sideBar,
  3129. hoverBtn: hoverBtn,
  3130. iconfont: iconfont
  3131. },
  3132. setup() {
  3133. const {isFullScreen: isFullScreen} = useFullScreen();
  3134. const {mode: mode} = useMode();
  3135. const {show: show} = useSwitchShow();
  3136. const classList = Vue.computed(() => [ `as-${mode.value}`, show.value ? "as-show" : "as-hide" ]);
  3137. const visible = Vue.computed(() => !site.invisible && !Vue.unref(isFullScreen));
  3138. Vue.watch([ mode, () => site, show ], ([newMode, site, newShow]) => {
  3139. const remove = site.invisible || site.disabled || !newShow;
  3140. changeBodyStyle(newMode, remove);
  3141. }, {
  3142. immediate: true,
  3143. deep: true
  3144. });
  3145. let isInit = false;
  3146. function init(site) {
  3147. if (isInit || site.disabled) {
  3148. return;
  3149. }
  3150. protectStyle();
  3151. initSpecialStyle();
  3152. isInit = true;
  3153. }
  3154. Vue.watch(site, newSite => {
  3155. init(newSite);
  3156. }, {
  3157. immediate: true
  3158. });
  3159. return {
  3160. disabled: site.disabled,
  3161. mode: mode,
  3162. classList: classList,
  3163. visible: visible
  3164. };
  3165. }
  3166. };
  3167. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  3168. const _component_logo = Vue.resolveComponent("logo");
  3169. const _component_as_menu = Vue.resolveComponent("as-menu");
  3170. const _component_side_bar = Vue.resolveComponent("side-bar");
  3171. const _component_hoverBtn = Vue.resolveComponent("hoverBtn");
  3172. const _component_iconfont = Vue.resolveComponent("iconfont");
  3173. return !$setup.disabled ? (Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, {
  3174. key: 0
  3175. }, [ Vue.withDirectives(Vue.createElementVNode("div", {
  3176. style: {
  3177. opacity: "0"
  3178. },
  3179. class: Vue.normalizeClass([ "as-container", $setup.classList ])
  3180. }, [ Vue.createVNode(_component_logo, {
  3181. mode: $setup.mode
  3182. }, null, 8, [ "mode" ]), Vue.createVNode(_component_as_menu, {
  3183. mode: $setup.mode
  3184. }, null, 8, [ "mode" ]), Vue.createVNode(_component_side_bar) ], 2), [ [ Vue.vShow, $setup.visible ] ]), Vue.withDirectives(Vue.createVNode(_component_hoverBtn, null, null, 512), [ [ Vue.vShow, $setup.visible ] ]), Vue.createVNode(_component_iconfont) ], 64)) : Vue.createCommentVNode("", true);
  3185. }
  3186. var index = _export_sfc(_sfc_main, [ [ "render", _sfc_render ] ]);
  3187. passTmMethods();
  3188. const el = getAsRoot();
  3189. if (!el) {
  3190. const app = Vue.createApp(index);
  3191. const el = createAsRoot();
  3192. const mountEL = document.documentElement.insertBefore(el, document.body);
  3193. app.mount(mountEL);
  3194. }
  3195. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址