// ==UserScript==
// @name all-search 全搜v1.2.1,一个搜索引擎快捷跳转菜单, 支持图形界面自定义
// @version 1.2.1
// @description 2022年6月1日更新 竖向横向布局随意切换,支持图形界面自定义设置分类和添加链接,个人配置自动保存到谷歌插件。
// @author endday
// @license GPL-2.0
// @update 2022/6/1
// @homepageURL https://github.com/endday/all-search
// @noframes
// @require https://unpkg.com/vue@3.2.33/dist/vue.global.prod.js
// @run-at document-start
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_addStyle
// @grant GM_getResourceText
// @include /\/\/www\.google\.com(.hk)?\/search/
// @include /\/\/www\.baidu\.com\/$/
// @include /\/\/www\.baidu\.com\/s\?/
// @include /\/\/www\.baidu\.com\/baidu\?/
// @include /\/\/[^.]*\.bing\.com\/search/
// @include /\/\/duckduckgo\.com\/*/
// @include /\/\/search\.yahoo\.com\/search/
// @include /\/\/tw\.search\.yahoo\.com\/search/
// @include /\/\/searx\.me\/\?q/
// @include /\/\/www\.sogou\.com\/(?:web|s)/
// @include /\/\/yandex\.com\/search/
// @include /\/\/google\.infinitynewtab\.com\/\?q/
// @include /\/\/www\.dogedoge\.com\/results\?q/
// @include /\/\/baike\.baidu\.com\/item/
// @include /\/\/baike\.baidu\.com\/search/
// @include /\/\/wenku\.baidu\.com\/search/
// @include /\/\/zhidao\.baidu\.com\/search/
// @include /\/\/\D{2,5}\.wikipedia\.org\/wiki/
// @include /\/\/www\.zhihu\.com\/search\?/
// @include /\/\/www\.so\.com\/s/
// @include /\/\/so\.baike\.com\/doc/
// @include /\/\/www\.baike\.com\/wiki/
// @include /\/\/www\.docin\.com\/search\.do/
// @include /\/\/zhihu\.sogou\.com\/zhihu/
// @include /\/\/weixin\.sogou\.com\/weixin\?/
// @include /\/\/www\.quora\.com\/search\?/
// @include /\/\/stackoverflow\.com\/search\?/
// @include /\/\/search\.bilibili\.com\/all/
// @include /\/\/www\.acfun\.cn\/search/
// @include /\/\/www\.youtube\.com\/results/
// @include /\/\/www\.youtube\.com\/watch/
// @include /\/\/www\.nicovideo\.jp\/search\//
// @include /\/\/so\.iqiyi\.com\/so\/q/
// @include /\/\/v\.qq\.com\/x\/search/
// @include /\/\/music\.baidu\.com\/search/
// @include /\/\/so\.1ting\.com\/all\.do/
// @include /\/\/www\.xiami\.com\/search/
// @include /\/\/s\.music\.qq\.com/
// @include /\/\/music\.163\.com\/.*?#\/search/
// @include /\/\/image\.baidu\.com\/search/
// @include /\/\/\w{2,10}\.google(?:\.\D{1,3}){1,2}\/[^?]+\?.*&tbm=isch/
// @include /\/\/.*\.bing\.com\/images\/search/
// @include /\/\/www\.flickr\.com\/search\//
// @include /^http:\/\/www\.pixiv\.net\/search\.php/
// @include /\/\/huaban\.com\/search\/\?/
// @include /\/\/www\.pinterest\.com\/search\//
// @include /\/\/thepiratebay\.org\/search/
// @include /\/\/share\.dmhy\.org\/topics\/list\?keyword=/
// @include /\/\/www\.ed2000\.com\/filelist\.asp/
// @include /\/\/www\.zimuzu\.tv\/search\//
// @include /\/\/so\.cqp\.cc\/search/
// @include /\/\/subhd\.com\/search/
// @include /\/\/translate\.google(?:\.\D{1,4}){1,2}/
// @include /\/\/fanyi\.baidu\.com/
// @include /\/\/.*\.bing\.com\/dict\/search\?q=/
// @include /\/\/dict\.youdao\.com\/search/
// @include /\/\/dict\.youdao\.com\/w/
// @include /\/\/dict\.cn\/./
// @include /\/\/s\.taobao\.com\/search/
// @include /\/\/list\.tmall\.com\/search_product\.htm.*from=chaoshi/
// @include /\/\/list\.tmall\.com\/search_product\.htm/
// @include /\/\/search\.jd\.com\/search/
// @include /\/\/search\.suning\.com/
// @include /\/\/search\.yhd\.com\/c0-0\/k/
// @include /\/\/search\.smzdm\.com\/\?/
// @include /\/\/s\.weibo\.com\/weibo\?q=/
// @include /\/\/tieba\.baidu\.com\/f\/search/
// @include /\/\/(movie|music|book)\.douban\.com\/subject_search?/
// @include /\/\/www\.douban\.com\/search/
// @include /\/\/xueshu\.baidu\.com\/(?:s|baidu)/
// @include /\/\/scholar\.google(?:\.\D{1,3}){1,2}\/scholar\?/
// @include /^http:\/\/search\.cnki\.net\/search\.aspx/
// @include /^http:\/\/epub\.cnki\.net\/kns\/brief\/default_result\.aspx/
// @include /\/\/s\.g\.wanfangdata\.com\.cn\/Paper\.aspx/
// @include /^http:\/\/.*?ebscohost\.com\/.*?results/
// @include /^http:\/\/link\.springer\.com\/search\?query=/
// @include /.*?jstor.org\/action\/doAdvancedSearch/
// @include /.*?runoob\.com\//
// @include /\/\/github\.com\/search/
// @include /\/\/developer\.mozilla\.org\/.{2,5}\/search/
// @include /\/\/google\.infinitynewtab\.com\/\?q/
// @include /\/\/www\.startpage\.com\/sp\/search/
// @include /\/\/so\.toutiao\.com\/search/
// @include /\/\/endday\.github\.io/
// @include /\/\/endday\.gitee\.io/
// @include /\/\/localhost/
// @namespace https://github.com/endday
// @downloadURL none
// ==/UserScript==
/* eslint-disable */
(function() {
"use strict";
var name = "all-search";
var version$1 = "1.2.1";
var description = "竖向横向布局随意切换,支持图形界面自定义设置分类和添加链接,个人配置自动保存到谷歌插件。";
var author = "endday";
var homepage = "https://github.com/endday/all-search";
var license = "GPL-2.0";
var repository = {
type: "git",
url: "git@github.com:endday/all-search.git"
};
var scripts = {
serve: "vue-cli-service serve --fix",
tmServe: "vue-cli-service serve --fix --tm",
build: "vue-cli-service build",
lint: "vue-cli-service lint",
tmBuild: "rollup -c",
viteDev: "vite build --mode dev",
viteBuild: "vite build --mode prod"
};
var dependencies = {
"@popperjs/core": "^2.9.2",
axios: "^0.21.1",
"core-js": "^3.9.1",
"element-plus": "^2.2.0",
"resize-observer-polyfill": "^1.5.1",
vue: "^3.2.36",
"vue-draggable-next": "^2.0.1",
"vue-router": "^4.0.5",
"vue3-popper": "^0.2.3"
};
var devDependencies = {
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-json": "^4.0.3",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-replace": "^4.0.0",
"@vitejs/plugin-vue": "^2.3.3",
"@vue/cli-plugin-babel": "^5.0.0",
"@vue/cli-plugin-eslint": "^5.0.0",
"@vue/cli-service": "^5.0.0",
"@vue/compiler-sfc": "^3.0.7",
autoprefixer: "^10.4.7",
"babel-eslint": "^10.1.0",
"babel-plugin-import": "^1.13.3",
eslint: "^7.32.0",
"eslint-plugin-vue": "^7.7.0",
postcss: "^8.4.13",
rollup: "^2.72.1",
"rollup-plugin-delete": "^1.2.0",
"rollup-plugin-styles": "^4.0.0",
"rollup-plugin-terser": "^5.2.0",
sass: "^1.32.8",
"sass-loader": "^10.1.1",
vite: "^2.6.7",
"rollup-plugin-external-globals": "^0.6.1"
};
var pkg = {
name: name,
version: version$1,
description: description,
author: author,
homepage: homepage,
license: license,
repository: repository,
scripts: scripts,
dependencies: dependencies,
devDependencies: devDependencies
};
Vue.reactive({
tmVersion: ""
});
const version = pkg.version;
function getQueryString(name, url) {
url = url || window.location.href;
const r = new RegExp("(\\?|#|&)" + name + "=([^]*)(&|#|$)");
const m = url.match(r);
return decodeURIComponent(!m ? "" : m[2]);
}
function getKeyword() {
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])");
if (el) {
if (el.nodeName === "INPUT" || el.localName === "textarea") {
return el.value;
} else {
return el.textContent;
}
}
return "";
}
function checkBody() {
let time = 0;
return new Promise((resolve, reject) => {
if (document && document.body) {
resolve();
} else {
const id = setInterval((function() {
time += 1;
if (document && document.body) {
clearInterval(id);
resolve();
}
if (time === 50) {
clearInterval(id);
reject(new Error("timeOut"));
}
}), 200);
}
});
}
function getName(name) {
if (name) {
return `__allSearch__${name}`;
}
return null;
}
let getSession = function(name) {
const formatName = getName(name);
let item;
if (window.GM_getValue) {
item = window.GM_getValue(formatName);
} else {
item = window.localStorage.getItem(formatName);
}
if (item) {
try {
return JSON.parse(item);
} catch (e) {
return item;
}
}
return null;
};
let setSession = function(name, value) {
const formatName = getName(name);
if (window.GM_setValue) {
window.GM_setValue(formatName, value);
} else {
const item = JSON.stringify(value);
if (item) {
window.localStorage.setItem(formatName, item);
}
}
};
function addLink(url, name) {
if (!url) {
return;
}
if (name) {
const list = document.styleSheets;
for (let i = 0; i < list.length; i++) {
if (list[i].ownerNode.className === name) {
return;
}
}
}
const link = document.createElement("link");
link.href = url;
link.rel = "stylesheet";
link.type = "text/css";
link.crossorigin = "anonymous";
const head = document.getElementsByTagName("head")[0];
head.appendChild(link);
}
function addStyleResource(name, link) {
let styleContent;
if (window.GM_getResourceText) {
styleContent = window.GM_getResourceText(name);
}
if (styleContent) {
addStyleContent(styleContent, name);
} else {
addLink(link, name);
}
}
function RAFInterval(callback, period, runNow) {
const needCount = period / 1e3 * 60;
let times = 0;
if (runNow === true) {
const shouldFinish = callback();
if (shouldFinish) {
return;
}
}
function step() {
if (times < needCount) {
times++;
requestAnimationFrame(step);
} else {
const shouldFinish = callback() || false;
if (!shouldFinish) {
times = 0;
requestAnimationFrame(step);
}
}
}
requestAnimationFrame(step);
}
function removeNode(cssSelectorOrFunction) {
try {
if (typeof cssSelectorOrFunction === "string") {
let removeNodes = document.querySelectorAll(cssSelectorOrFunction);
for (let i = 0; i < removeNodes.length; i++) {
removeNodes[i].remove();
}
} else if (typeof cssSelectorOrFunction === "function") {
cssSelectorOrFunction();
} else {
console.log("未知命令:" + cssSelectorOrFunction);
}
} catch (e) {
console.log(e);
}
}
function addStyleContent(css, className, addToTarget, isReload = false) {
RAFInterval((function() {
let addTo = document.querySelector(addToTarget);
if (typeof addToTarget === "undefined") {
addTo = document.body || document.head || document.documentElement || document;
}
if (typeof addToTarget === "undefined" || typeof addToTarget !== "undefined" && document.querySelector(addToTarget) !== null) {
if (isReload) {
removeNode("." + className);
} else if (!isReload && document.querySelector("." + className) !== null) {
return true;
}
let cssNode = document.createElement("style");
if (className) {
cssNode.className = className;
}
cssNode.setAttribute("type", "text/css");
cssNode.innerHTML = css;
try {
addTo.appendChild(cssNode);
} catch (e) {
console.log(e.message);
}
return true;
}
}), 20, true);
}
function getAsRoot() {
return document.getElementById("all-search");
}
function createAsRoot() {
let el = document.createElement("div");
el.id = "all-search";
return el;
}
const scriptLoaded = getName("script-loaded");
const pageLoaded = getName("page-loaded");
function passTmMethods() {
const emit = function() {
document.dispatchEvent(new CustomEvent(scriptLoaded, {
detail: {
version: version,
getSession: getSession,
setSession: setSession
}
}));
};
document.addEventListener(pageLoaded, emit);
emit();
}
const isMobile = function() {
return /Android|webOS|iPhone|iPod|BlackBerry|iphone os|ipad/.test(navigator.userAgent.toLowerCase());
};
function withHookBefore(originalFn, hookFn) {
return function() {
if (hookFn.apply(this, arguments) === false) {
return;
}
return originalFn.apply(this, arguments);
};
}
function withHookAfter(originalFn, hookFn) {
return function() {
const output = originalFn.apply(this, arguments);
hookFn.apply(this, arguments);
return output;
};
}
const initBodyClass = (mode, currentSite) => {
const body = document.body;
body.classList.remove("body-vertical", "body-horizontal");
if (!currentSite.invisible) {
if (mode) {
const newValue = `body-${mode}`;
body.classList.add(newValue);
}
}
};
const addCustomStyle = (mode, currentSite) => {
removeNode(".as-custom-style");
if (currentSite.invisible) {
return;
}
if (currentSite.style) {
let styleContent = "";
if (currentSite.style[1] && mode === "horizontal") {
styleContent = currentSite.style[1];
} else if (currentSite.style[2] && mode === "vertical") {
styleContent = currentSite.style[2];
}
if (styleContent) {
addStyleContent(styleContent, "as-custom-style");
}
}
};
const protectStyle = function() {
if (Node.prototype.__as_hooks__) {
return;
}
Node.prototype.removeChild = withHookBefore(Node.prototype.removeChild, e => {
if (e && e.tagName === "STYLE") {
return !(e.classList.contains("as-icon") || e.classList.contains("as-style") || e.classList.contains("elPopover") || e.classList.contains("elScrollbar"));
}
return true;
});
Node.prototype.__as_hooks__ = true;
};
const initStyle$1 = function() {
addStyleResource("elPopover", "https://unpkg.com/element-plus@2.2.2/theme-chalk/el-popover.css");
addStyleResource("elScrollbar", `https://unpkg.com/element-plus@2.2.2/theme-chalk/el-scrollbar.css`);
};
const addStyleForCurrentSite = function(mode, site) {
const modeVal = Vue.unref(mode);
addCustomStyle(modeVal, site);
initBodyClass(modeVal, site);
};
const height = 30;
const width = 100;
const list$2 = [ {
url: /\/\/www\.google\.com(.hk)?\/search/,
style: {
1: `.srp #searchform:not(.minidiv){top: ${height + 20}px !important;}#searchform.minidiv{top: ${height}px !important;}`
}
}, {
url: /\/\/www\.baidu\.com\/$/,
invisible: true
}, {
url: /\/\/www\.baidu\.com\/s\?/,
style: {
1: `.fix-head { top: ${height}px !important; }`,
2: `.fix-head #u { right: ${width}px; }`
}
}, {
url: /\/\/www\.baidu\.com\/baidu\?/,
style: {
1: `.fix-head { top: ${height}px !important; }`,
2: `.fix-head #u { right: ${width}px; }`
}
}, {
url: /\/\/[^.]*\.bing\.com\/search/
}, {
url: /\/\/duckduckgo\.com\/*/
}, {
url: /\/\/search\.yahoo\.com\/search/
}, {
url: /\/\/tw\.search\.yahoo\.com\/search/
}, {
url: /\/\/searx\.me\/\?q/
}, {
url: /\/\/www\.sogou\.com\/(?:web|s)/,
keyword() {
return document.getElementById("upquery").value;
}
}, {
url: /\/\/yandex\.com\/search/
}, {
url: /\/\/google\.infinitynewtab\.com\/\?q/
}, {
url: /\/\/www\.dogedoge\.com\/results\?q/,
style: {
1: `#header_wrapper{top: ${height}px!important;}`,
2: `#header_wrapper{right: ${width}px!important;}`
}
}, {
url: /\/\/baike\.baidu\.com\/item/
}, {
url: /\/\/baike\.baidu\.com\/search/
}, {
url: /\/\/wenku\.baidu\.com\/search/
}, {
url: /\/\/zhidao\.baidu\.com\/search/
}, {
url: /\/\/\D{2,5}\.wikipedia\.org\/wiki/
}, {
url: /\/\/www\.zhihu\.com\/search\?/,
style: {
1: `.AppHeader.is-fixed {top: ${height}px!important;}`
}
}, {
url: /\/\/www\.so\.com\/s/,
style: {
2: `.body-vertical #header { z-index: 2000!important; }`
}
}, {
url: /\/\/so\.baike\.com\/doc/
}, {
url: /\/\/www\.baike\.com\/wiki/
}, {
url: /\/\/www\.docin\.com\/search\.do/
}, {
url: /\/\/zhihu\.sogou\.com\/zhihu/,
keyword() {
return document.getElementById("upquery").value;
},
style: {
1: `.header { top:${height}px }`
}
}, {
url: /\/\/weixin\.sogou\.com\/weixin\?/,
style: {
2: `.headsearch#scroll-header { left:unset; }`
}
}, {
url: /\/\/www\.quora\.com\/search\?/
}, {
url: /\/\/stackoverflow\.com\/search\?/,
style: {
1: `.top-bar._fixed { top: ${height}px }`,
2: `.top-bar._fixed { right: ${width}px }`
}
}, {
url: /\/\/search\.bilibili\.com\/all/,
keyword() {
return document.getElementById("search-keyword").value;
},
style: {
1: `.fixed-top {top: ${height}px;}`
}
}, {
url: /\/\/www\.acfun\.cn\/search/,
keyword() {
return document.getElementById("search-text--standalone").value;
},
style: {
1: `#header {top: ${height}px;}`
}
}, {
url: /\/\/www\.youtube\.com\/results/,
style: {
1: `#masthead-container.ytd-app {top:${height}px !important;}\n html:not(.style-scope) {--ytd-toolbar-height:${height + 56}px !important;}\n ytd-mini-guide-renderer.ytd-app {padding-top: ${height}px;}`,
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);}`
}
}, {
url: /\/\/www\.youtube\.com\/watch/,
invisible: true
}, {
url: /\/\/www\.nicovideo\.jp\/search\//
}, {
url: /\/\/so\.iqiyi\.com\/so\/q/
}, {
url: /\/\/v\.qq\.com\/x\/search/,
style: {
1: `.site_head {top: ${height}px;}`
}
}, {
url: /\/\/music\.baidu\.com\/search/
}, {
url: /\/\/so\.1ting\.com\/all\.do/
}, {
url: /\/\/www\.xiami\.com\/search/
}, {
url: /\/\/s\.music\.qq\.com/
}, {
url: /\/\/music\.163\.com\/.*?#\/search/
}, {
url: /\/\/image\.baidu\.com\/search/,
style: {
1: `#search .s_search { top: ${height}px; }`
}
}, {
url: /\/\/\w{2,10}\.google(?:\.\D{1,3}){1,2}\/[^?]+\?.*&tbm=isch/
}, {
url: /\/\/.*\.bing\.com\/images\/search/,
style: {
1: `#miniheader {padding-top: ${height}px;}`
}
}, {
url: /\/\/www\.flickr\.com\/search\//
}, {
url: /^http:\/\/www\.pixiv\.net\/search\.php/
}, {
url: /\/\/huaban\.com\/search\/\?/,
style: {
1: `#header { top: ${height}px; }`
}
}, {
url: /\/\/www\.pinterest\.com\/search\//
}, {
url: /\/\/thepiratebay\.org\/search/
}, {
url: /\/\/share\.dmhy\.org\/topics\/list\?keyword=/
}, {
url: /\/\/www\.ed2000\.com\/filelist\.asp/
}, {
url: /\/\/www\.zimuzu\.tv\/search\//
}, {
url: /\/\/so\.cqp\.cc\/search/
}, {
url: /\/\/subhd\.com\/search/
}, {
url: /\/\/translate\.google(?:\.\D{1,4}){1,2}/,
keyword() {
return getQueryString("text") || getQueryString("q");
}
}, {
url: /\/\/fanyi\.baidu\.com/,
keyword() {
return document.getElementById("baidu_translate_input").value;
}
}, {
url: /\/\/.*\.bing\.com\/dict\/search\?q=/
}, {
url: /\/\/dict\.youdao\.com\/search/
}, {
url: /\/\/dict\.youdao\.com\/w/
}, {
url: /\/\/dict\.cn\/./
}, {
url: /\/\/s\.taobao\.com\/search/,
style: {
1: `.m-header-fixed .header-inner { top: ${height}px !important;}`
}
}, {
url: /\/\/list\.tmall\.com\/search_product\.htm.*from=chaoshi/
}, {
url: /\/\/list\.tmall\.com\/search_product\.htm/
}, {
url: /\/\/search\.jd\.com\/search/
}, {
url: /\/\/search\.suning\.com/
}, {
url: /\/\/search\.yhd\.com\/c0-0\/k/
}, {
url: /\/\/search\.smzdm\.com\/\?/
}, {
url: /\/\/s\.weibo\.com\/weibo\?q=/,
style: {
1: `.WB_global_nav { top: ${height}px !important;}`
}
}, {
url: /\/\/tieba\.baidu\.com\/f\/search/
}, {
url: /\/\/(movie|music|book)\.douban\.com\/subject_search?/
}, {
url: /\/\/www\.douban\.com\/search/
}, {
url: /\/\/xueshu\.baidu\.com\/(?:s|baidu)/,
style: {
1: `#head_wr.gj #head.gj, #left_menu_content { top: ${height}px !important;}`,
2: `#left_menu_content { left: ${width}px !important;}`
}
}, {
url: /\/\/scholar\.google(?:\.\D{1,3}){1,2}\/scholar\?/
}, {
url: /^http:\/\/search\.cnki\.net\/search\.aspx/
}, {
url: /^http:\/\/epub\.cnki\.net\/kns\/brief\/default_result\.aspx/
}, {
url: /\/\/s\.g\.wanfangdata\.com\.cn\/Paper\.aspx/
}, {
url: /^http:\/\/.*?ebscohost\.com\/.*?results/
}, {
url: /^http:\/\/link\.springer\.com\/search\?query=/
}, {
url: /.*?jstor.org\/action\/doAdvancedSearch/
}, {
url: /.*?runoob\.com\//
}, {
url: /\/\/github\.com\/search/
}, {
url: /\/\/developer\.mozilla\.org\/.{2,5}\/search/
}, {
url: /\/\/google\.infinitynewtab\.com\/\?q/
}, {
url: /\/\/www\.startpage\.com\/sp\/search/,
style: {
1: `.layout-web__header {top: ${height}px !important;}`
}
}, {
url: /\/\/so\.toutiao\.com\/search/,
style: {}
}, {
url: /\/\/endday\.github\.io/,
invisible: true
}, {
url: /\/\/endday\.gitee\.io/,
invisible: true
}, {
url: /\/\/localhost/
} ];
const siteInfo = function() {
const target = list$2.find(item => item.url.test(window.location.href.toLowerCase()));
if (target) {
return {
url: target.url,
invisible: !!target.invisible,
disabled: !!target.disabled,
style: target.style,
keyword: target.keyword
};
}
return {
url: "",
invisible: true,
disabled: true,
style: {},
keyword: null
};
};
const routerChange = cb => {
history.pushState = withHookAfter(history.pushState, cb);
history.replaceState = withHookAfter(history.replaceState, cb);
window.addEventListener("yt-navigate-finish", cb);
};
function isFullScreen() {
return document.fullscreen || document.webkitIsFullScreen || document.mozFullScreen || document.msFullscreenElement;
}
function onFullScreenChange(handler) {
const handleResize = function() {
if (!isFullScreen()) {
handler();
}
};
document.addEventListener("fullscreenchange", handler);
document.addEventListener("webkitfullscreenchange", handler);
document.addEventListener("mozfullscreenchange", handler);
document.addEventListener("MSFullscreenChange", handler);
document.addEventListener("resize", handleResize);
return () => {
document.removeEventListener("fullscreenchange", handler);
document.removeEventListener("webkitfullscreenchange", handler);
document.removeEventListener("mozfullscreenchange", handler);
document.removeEventListener("MSFullscreenChange", handler);
document.removeEventListener("resize", handleResize);
};
}
function debounce$1(fn, delay = 500) {
let timeout = null;
return function() {
clearTimeout(timeout);
timeout = setTimeout(() => {
fn.apply(this, arguments);
}, delay);
};
}
const session$1 = getSession("mode");
const getMode = val => {
if (val !== "vertical" && val !== "horizontal") {
return "horizontal";
}
return val;
};
const mode = Vue.ref(getMode(session$1));
const initStyle = () => {};
onFullScreenChange(() => {
initStyle(mode.value);
});
Vue.watch(mode, value => {
const formatVal = getMode(value);
setSession("mode", formatVal);
});
const resizeHandle = debounce$1(() => initStyle(mode.value));
function useMode() {
Vue.onMounted(() => {
window.addEventListener("resize", resizeHandle, false);
});
Vue.onUnmounted(() => {
window.removeEventListener("resize", resizeHandle, false);
});
return {
mode: mode
};
}
function useUa() {
return {
isMobile: Vue.ref(isMobile())
};
}
class Raf {
constructor() {
this.init();
}
init() {
this._timerIdMap = {
timeout: {},
interval: {}
};
}
run(type = "interval", handler, interval = 16.7) {
const now = Date.now;
let stime = now();
let etime = stime;
const timerSymbol = Symbol("timerSymbol");
const loop = () => {
this.setIdMap(timerSymbol, type, loop);
etime = now();
if (etime - stime >= interval) {
if (type === "interval") {
stime = now();
etime = stime;
}
handler();
type === "timeout" && this.clearTimeout(timerSymbol);
}
};
this.setIdMap(timerSymbol, type, loop);
return timerSymbol;
}
setIdMap(timerSymbol, type, loop) {
this._timerIdMap[type][timerSymbol] = requestAnimationFrame(loop);
}
setTimeout(handler, timeout) {
return this.run("timeout", handler, timeout);
}
clearTimeout(timer) {
cancelAnimationFrame(this._timerIdMap.timeout[timer]);
}
setInterval(handler, timeout) {
return this.run("interval", handler, timeout);
}
clearInterval(timer) {
cancelAnimationFrame(this._timerIdMap.interval[timer]);
}
}
var raf = new Raf;
let id = null;
let styles = "";
function injectStyle(cssContent) {
styles += cssContent;
const styleNode = document.querySelector("#as-style-common");
if (styleNode) {
styleNode.styleSheet.cssText += styles;
styles = "";
} else if (!id) {
id = raf.setTimeout(() => {
const cssNode = document.createElement("style");
cssNode.setAttribute("type", "text/css");
cssNode.classList.add("as-style");
cssNode.id = "as-style-common";
cssNode.appendChild(document.createTextNode(styles));
styles = "";
const container = document.body || document.head || document.documentElement || document;
container.appendChild(cssNode);
id = null;
}, 0);
}
}
var css$c = "@media screen and (max-width: 768px) {\n .as-title-vertical {\n display: none;\n }\n}\n.as-title-horizontal {\n min-width: 100px;\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.as-title .as-title-inner {\n padding: 0;\n font-size: 18px;\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}";
injectStyle(css$c);
var _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};
const _sfc_main$d = {
name: "logo",
props: {
mode: {
type: String,
default: "horizontal",
validator: val => [ "horizontal", "vertical" ].indexOf(val) > -1
}
},
setup() {
const {isMobile: isMobile} = useUa();
return {
isMobile: isMobile
};
}
};
const _hoisted_1$8 = Vue.createElementVNode("p", {
class: "as-title-inner"
}, " All Search ", -1);
const _hoisted_2$6 = [ _hoisted_1$8 ];
function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
return !$setup.isMobile ? (Vue.openBlock(), Vue.createElementBlock("a", {
key: 0,
class: Vue.normalizeClass([ "as-title", `as-title-${$props.mode}` ]),
href: "https://github.com/endday/all-search",
target: "_blank"
}, _hoisted_2$6, 2)) : Vue.createCommentVNode("v-if", true);
}
var logo = _export_sfc(_sfc_main$d, [ [ "render", _sfc_render$d ], [ "__file", "E:\\myProject\\all-search\\src\\components\\logo.vue" ] ]);
var MapShim = function() {
if (typeof Map !== "undefined") {
return Map;
}
function getIndex(arr, key) {
var result = -1;
arr.some((function(entry, index) {
if (entry[0] === key) {
result = index;
return true;
}
return false;
}));
return result;
}
return function() {
function class_1() {
this.__entries__ = [];
}
Object.defineProperty(class_1.prototype, "size", {
get: function() {
return this.__entries__.length;
},
enumerable: true,
configurable: true
});
class_1.prototype.get = function(key) {
var index = getIndex(this.__entries__, key);
var entry = this.__entries__[index];
return entry && entry[1];
};
class_1.prototype.set = function(key, value) {
var index = getIndex(this.__entries__, key);
if (~index) {
this.__entries__[index][1] = value;
} else {
this.__entries__.push([ key, value ]);
}
};
class_1.prototype.delete = function(key) {
var entries = this.__entries__;
var index = getIndex(entries, key);
if (~index) {
entries.splice(index, 1);
}
};
class_1.prototype.has = function(key) {
return !!~getIndex(this.__entries__, key);
};
class_1.prototype.clear = function() {
this.__entries__.splice(0);
};
class_1.prototype.forEach = function(callback, ctx) {
if (ctx === void 0) {
ctx = null;
}
for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) {
var entry = _a[_i];
callback.call(ctx, entry[1], entry[0]);
}
};
return class_1;
}();
}();
var isBrowser = typeof window !== "undefined" && typeof document !== "undefined" && window.document === document;
var global$1 = function() {
if (typeof global !== "undefined" && global.Math === Math) {
return global;
}
if (typeof self !== "undefined" && self.Math === Math) {
return self;
}
if (typeof window !== "undefined" && window.Math === Math) {
return window;
}
return Function("return this")();
}();
var requestAnimationFrame$1 = function() {
if (typeof requestAnimationFrame === "function") {
return requestAnimationFrame.bind(global$1);
}
return function(callback) {
return setTimeout((function() {
return callback(Date.now());
}), 1e3 / 60);
};
}();
var trailingTimeout = 2;
function throttle(callback, delay) {
var leadingCall = false, trailingCall = false, lastCallTime = 0;
function resolvePending() {
if (leadingCall) {
leadingCall = false;
callback();
}
if (trailingCall) {
proxy();
}
}
function timeoutCallback() {
requestAnimationFrame$1(resolvePending);
}
function proxy() {
var timeStamp = Date.now();
if (leadingCall) {
if (timeStamp - lastCallTime < trailingTimeout) {
return;
}
trailingCall = true;
} else {
leadingCall = true;
trailingCall = false;
setTimeout(timeoutCallback, delay);
}
lastCallTime = timeStamp;
}
return proxy;
}
var REFRESH_DELAY = 20;
var transitionKeys = [ "top", "right", "bottom", "left", "width", "height", "size", "weight" ];
var mutationObserverSupported = typeof MutationObserver !== "undefined";
var ResizeObserverController = function() {
function ResizeObserverController() {
this.connected_ = false;
this.mutationEventsAdded_ = false;
this.mutationsObserver_ = null;
this.observers_ = [];
this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);
}
ResizeObserverController.prototype.addObserver = function(observer) {
if (!~this.observers_.indexOf(observer)) {
this.observers_.push(observer);
}
if (!this.connected_) {
this.connect_();
}
};
ResizeObserverController.prototype.removeObserver = function(observer) {
var observers = this.observers_;
var index = observers.indexOf(observer);
if (~index) {
observers.splice(index, 1);
}
if (!observers.length && this.connected_) {
this.disconnect_();
}
};
ResizeObserverController.prototype.refresh = function() {
var changesDetected = this.updateObservers_();
if (changesDetected) {
this.refresh();
}
};
ResizeObserverController.prototype.updateObservers_ = function() {
var activeObservers = this.observers_.filter((function(observer) {
return observer.gatherActive(), observer.hasActive();
}));
activeObservers.forEach((function(observer) {
return observer.broadcastActive();
}));
return activeObservers.length > 0;
};
ResizeObserverController.prototype.connect_ = function() {
if (!isBrowser || this.connected_) {
return;
}
document.addEventListener("transitionend", this.onTransitionEnd_);
window.addEventListener("resize", this.refresh);
if (mutationObserverSupported) {
this.mutationsObserver_ = new MutationObserver(this.refresh);
this.mutationsObserver_.observe(document, {
attributes: true,
childList: true,
characterData: true,
subtree: true
});
} else {
document.addEventListener("DOMSubtreeModified", this.refresh);
this.mutationEventsAdded_ = true;
}
this.connected_ = true;
};
ResizeObserverController.prototype.disconnect_ = function() {
if (!isBrowser || !this.connected_) {
return;
}
document.removeEventListener("transitionend", this.onTransitionEnd_);
window.removeEventListener("resize", this.refresh);
if (this.mutationsObserver_) {
this.mutationsObserver_.disconnect();
}
if (this.mutationEventsAdded_) {
document.removeEventListener("DOMSubtreeModified", this.refresh);
}
this.mutationsObserver_ = null;
this.mutationEventsAdded_ = false;
this.connected_ = false;
};
ResizeObserverController.prototype.onTransitionEnd_ = function(_a) {
var _b = _a.propertyName, propertyName = _b === void 0 ? "" : _b;
var isReflowProperty = transitionKeys.some((function(key) {
return !!~propertyName.indexOf(key);
}));
if (isReflowProperty) {
this.refresh();
}
};
ResizeObserverController.getInstance = function() {
if (!this.instance_) {
this.instance_ = new ResizeObserverController;
}
return this.instance_;
};
ResizeObserverController.instance_ = null;
return ResizeObserverController;
}();
var defineConfigurable = function(target, props) {
for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {
var key = _a[_i];
Object.defineProperty(target, key, {
value: props[key],
enumerable: false,
writable: false,
configurable: true
});
}
return target;
};
var getWindowOf = function(target) {
var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
return ownerGlobal || global$1;
};
var emptyRect = createRectInit(0, 0, 0, 0);
function toFloat(value) {
return parseFloat(value) || 0;
}
function getBordersSize(styles) {
var positions = [];
for (var _i = 1; _i < arguments.length; _i++) {
positions[_i - 1] = arguments[_i];
}
return positions.reduce((function(size, position) {
var value = styles["border-" + position + "-width"];
return size + toFloat(value);
}), 0);
}
function getPaddings(styles) {
var positions = [ "top", "right", "bottom", "left" ];
var paddings = {};
for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
var position = positions_1[_i];
var value = styles["padding-" + position];
paddings[position] = toFloat(value);
}
return paddings;
}
function getSVGContentRect(target) {
var bbox = target.getBBox();
return createRectInit(0, 0, bbox.width, bbox.height);
}
function getHTMLElementContentRect(target) {
var clientWidth = target.clientWidth, clientHeight = target.clientHeight;
if (!clientWidth && !clientHeight) {
return emptyRect;
}
var styles = getWindowOf(target).getComputedStyle(target);
var paddings = getPaddings(styles);
var horizPad = paddings.left + paddings.right;
var vertPad = paddings.top + paddings.bottom;
var width = toFloat(styles.width), height = toFloat(styles.height);
if (styles.boxSizing === "border-box") {
if (Math.round(width + horizPad) !== clientWidth) {
width -= getBordersSize(styles, "left", "right") + horizPad;
}
if (Math.round(height + vertPad) !== clientHeight) {
height -= getBordersSize(styles, "top", "bottom") + vertPad;
}
}
if (!isDocumentElement(target)) {
var vertScrollbar = Math.round(width + horizPad) - clientWidth;
var horizScrollbar = Math.round(height + vertPad) - clientHeight;
if (Math.abs(vertScrollbar) !== 1) {
width -= vertScrollbar;
}
if (Math.abs(horizScrollbar) !== 1) {
height -= horizScrollbar;
}
}
return createRectInit(paddings.left, paddings.top, width, height);
}
var isSVGGraphicsElement = function() {
if (typeof SVGGraphicsElement !== "undefined") {
return function(target) {
return target instanceof getWindowOf(target).SVGGraphicsElement;
};
}
return function(target) {
return target instanceof getWindowOf(target).SVGElement && typeof target.getBBox === "function";
};
}();
function isDocumentElement(target) {
return target === getWindowOf(target).document.documentElement;
}
function getContentRect(target) {
if (!isBrowser) {
return emptyRect;
}
if (isSVGGraphicsElement(target)) {
return getSVGContentRect(target);
}
return getHTMLElementContentRect(target);
}
function createReadOnlyRect(_a) {
var x = _a.x, y = _a.y, width = _a.width, height = _a.height;
var Constr = typeof DOMRectReadOnly !== "undefined" ? DOMRectReadOnly : Object;
var rect = Object.create(Constr.prototype);
defineConfigurable(rect, {
x: x,
y: y,
width: width,
height: height,
top: y,
right: x + width,
bottom: height + y,
left: x
});
return rect;
}
function createRectInit(x, y, width, height) {
return {
x: x,
y: y,
width: width,
height: height
};
}
var ResizeObservation = function() {
function ResizeObservation(target) {
this.broadcastWidth = 0;
this.broadcastHeight = 0;
this.contentRect_ = createRectInit(0, 0, 0, 0);
this.target = target;
}
ResizeObservation.prototype.isActive = function() {
var rect = getContentRect(this.target);
this.contentRect_ = rect;
return rect.width !== this.broadcastWidth || rect.height !== this.broadcastHeight;
};
ResizeObservation.prototype.broadcastRect = function() {
var rect = this.contentRect_;
this.broadcastWidth = rect.width;
this.broadcastHeight = rect.height;
return rect;
};
return ResizeObservation;
}();
var ResizeObserverEntry = function() {
function ResizeObserverEntry(target, rectInit) {
var contentRect = createReadOnlyRect(rectInit);
defineConfigurable(this, {
target: target,
contentRect: contentRect
});
}
return ResizeObserverEntry;
}();
var ResizeObserverSPI = function() {
function ResizeObserverSPI(callback, controller, callbackCtx) {
this.activeObservations_ = [];
this.observations_ = new MapShim;
if (typeof callback !== "function") {
throw new TypeError("The callback provided as parameter 1 is not a function.");
}
this.callback_ = callback;
this.controller_ = controller;
this.callbackCtx_ = callbackCtx;
}
ResizeObserverSPI.prototype.observe = function(target) {
if (!arguments.length) {
throw new TypeError("1 argument required, but only 0 present.");
}
if (typeof Element === "undefined" || !(Element instanceof Object)) {
return;
}
if (!(target instanceof getWindowOf(target).Element)) {
throw new TypeError('parameter 1 is not of type "Element".');
}
var observations = this.observations_;
if (observations.has(target)) {
return;
}
observations.set(target, new ResizeObservation(target));
this.controller_.addObserver(this);
this.controller_.refresh();
};
ResizeObserverSPI.prototype.unobserve = function(target) {
if (!arguments.length) {
throw new TypeError("1 argument required, but only 0 present.");
}
if (typeof Element === "undefined" || !(Element instanceof Object)) {
return;
}
if (!(target instanceof getWindowOf(target).Element)) {
throw new TypeError('parameter 1 is not of type "Element".');
}
var observations = this.observations_;
if (!observations.has(target)) {
return;
}
observations.delete(target);
if (!observations.size) {
this.controller_.removeObserver(this);
}
};
ResizeObserverSPI.prototype.disconnect = function() {
this.clearActive();
this.observations_.clear();
this.controller_.removeObserver(this);
};
ResizeObserverSPI.prototype.gatherActive = function() {
var _this = this;
this.clearActive();
this.observations_.forEach((function(observation) {
if (observation.isActive()) {
_this.activeObservations_.push(observation);
}
}));
};
ResizeObserverSPI.prototype.broadcastActive = function() {
if (!this.hasActive()) {
return;
}
var ctx = this.callbackCtx_;
var entries = this.activeObservations_.map((function(observation) {
return new ResizeObserverEntry(observation.target, observation.broadcastRect());
}));
this.callback_.call(ctx, entries, ctx);
this.clearActive();
};
ResizeObserverSPI.prototype.clearActive = function() {
this.activeObservations_.splice(0);
};
ResizeObserverSPI.prototype.hasActive = function() {
return this.activeObservations_.length > 0;
};
return ResizeObserverSPI;
}();
var observers = typeof WeakMap !== "undefined" ? new WeakMap : new MapShim;
var ResizeObserver = function() {
function ResizeObserver(callback) {
if (!(this instanceof ResizeObserver)) {
throw new TypeError("Cannot call a class as a function.");
}
if (!arguments.length) {
throw new TypeError("1 argument required, but only 0 present.");
}
var controller = ResizeObserverController.getInstance();
var observer = new ResizeObserverSPI(callback, controller, this);
observers.set(this, observer);
}
return ResizeObserver;
}();
[ "observe", "unobserve", "disconnect" ].forEach((function(method) {
ResizeObserver.prototype[method] = function() {
var _a;
return (_a = observers.get(this))[method].apply(_a, arguments);
};
}));
var index$1 = function() {
if (typeof global$1.ResizeObserver !== "undefined") {
return global$1.ResizeObserver;
}
return ResizeObserver;
}();
const isArray = Array.isArray;
const isString = val => typeof val === "string";
const toObject = arr => {
let obj = {};
arr.map(item => {
obj[item.key] = item.value;
});
return obj;
};
const SCOPE = "MElScrollbar";
const isNumber = val => typeof obj === "number" && !isNaN(val);
const debugWarn = (...args) => {
console.error(...args);
};
const resizeHandler = entries => {
for (const entry of entries) {
const listeners = entry.target.__resizeListeners__ || [];
if (listeners.length) {
listeners.forEach(fn => {
fn();
});
}
}
};
const addResizeListener = (element, fn) => {
if (!element.__resizeListeners__) {
element.__resizeListeners__ = [];
element.__ro__ = new index$1(resizeHandler);
element.__ro__.observe(element);
}
element.__resizeListeners__.push(fn);
};
const removeResizeListener = (element, fn) => {
if (!element || !element.__resizeListeners__) return;
element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
if (!element.__resizeListeners__.length) {
element.__ro__.disconnect();
}
};
const addUnit = value => {
if (isString(value)) {
return value;
} else if (isNumber(value)) {
return value + "px";
}
debugWarn(SCOPE, "属性 value 必须是 string 或 number 类型");
return "";
};
const on = (element, event, handler, useCapture = false) => {
if (element && event && handler) {
element.addEventListener(event, handler, useCapture);
}
};
const off = (element, event, handler, useCapture = false) => {
if (element && event && handler) {
element.removeEventListener(event, handler, useCapture);
}
};
const BAR_MAP = {
vertical: {
offset: "offsetHeight",
scroll: "scrollTop",
scrollSize: "scrollHeight",
size: "height",
key: "vertical",
axis: "Y",
client: "clientY",
direction: "top"
},
horizontal: {
offset: "offsetWidth",
scroll: "scrollLeft",
scrollSize: "scrollWidth",
size: "width",
key: "horizontal",
axis: "X",
client: "clientX",
direction: "left"
}
};
const renderThumbStyle = ({move: move, size: size, bar: bar}) => {
const style = {};
const translate = `translate${bar.axis}(${move}%)`;
style[bar.size] = size;
style.transform = translate;
style.msTransform = translate;
style.webkitTransform = translate;
return style;
};
const _sfc_main$c = Vue.defineComponent({
props: {
vertical: Boolean,
size: {
type: String,
default: ""
},
move: {
type: Number,
default: 0
},
ratio: {
type: Number,
default: 0
},
always: Boolean
},
setup(props) {
const visible = Vue.ref(false);
const barStore = Vue.reactive({});
let cursorDown = false;
let cursorLeave = false;
const thumb = Vue.ref(null);
const instance = Vue.ref(null);
let onselectstartStore = null;
const {proxy: proxy} = Vue.getCurrentInstance();
const scrollbar = proxy.$parent;
const bar = Vue.computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
const offsetRatio = Vue.computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrap[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
const thumbStyle = Vue.computed(() => renderThumbStyle({
size: props.size,
move: props.move,
bar: bar.value
}));
const mouseMoveDocumentHandler = e => {
if (cursorDown === false) return;
const prevPage = barStore[bar.value.axis];
if (!prevPage) return;
const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
scrollbar.wrap[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrap[bar.value.scrollSize] / 100;
};
const mouseUpDocumentHandler = () => {
cursorDown = false;
barStore[bar.value.axis] = 0;
off(document, "mousemove", mouseMoveDocumentHandler);
off(document, "mouseup", mouseUpDocumentHandler);
document.onselectstart = onselectstartStore;
if (cursorLeave) {
visible.value = false;
}
};
const startDrag = e => {
e.stopImmediatePropagation();
cursorDown = true;
on(document, "mousemove", mouseMoveDocumentHandler);
on(document, "mouseup", mouseUpDocumentHandler);
onselectstartStore = document.onselectstart;
document.onselectstart = () => false;
};
const clickThumbHandler = e => {
e.stopPropagation();
if (e.ctrlKey || [ 1, 2 ].includes(e.button)) {
return;
}
window.getSelection().removeAllRanges();
startDrag(e);
barStore[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
};
const clickTrackHandler = e => {
const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
const thumbHalf = thumb[bar.value.offset] / 2;
const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance[bar.value.offset];
scrollbar.wrap[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrap[bar.value.scrollSize] / 100;
};
const mouseMoveScrollbarHandler = () => {
cursorLeave = false;
visible.value = !!props.size;
};
const mouseLeaveScrollbarHandler = () => {
cursorLeave = true;
visible.value = cursorDown;
};
Vue.onMounted(() => {
Vue.nextTick(() => {
on(scrollbar.scrollbar, "mousemove", mouseMoveScrollbarHandler);
on(scrollbar.scrollbar, "mouseleave", mouseLeaveScrollbarHandler);
});
});
Vue.onBeforeUnmount(() => {
off(document, "mouseup", this.mouseUpDocumentHandler);
off(scrollbar.scrollbar, "mousemove", this.mouseMoveScrollbarHandler);
off(scrollbar.scrollbar, "mouseleave", this.mouseLeaveScrollbarHandler);
});
return {
clickThumbHandler: clickThumbHandler,
clickTrackHandler: clickTrackHandler,
thumbStyle: thumbStyle,
bar: bar,
visible: visible,
instance: instance,
thumb: thumb
};
}
});
function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
return Vue.openBlock(), Vue.createBlock(Vue.Transition, {
name: "as-scrollbar-fade",
persisted: ""
}, {
default: Vue.withCtx(() => [ Vue.withDirectives(Vue.createElementVNode("div", {
ref: "instance",
class: Vue.normalizeClass([ "as-scrollbar__bar", "is-" + _ctx.bar.key ]),
onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.clickTrackHandler && _ctx.clickTrackHandler(...args))
}, [ Vue.createElementVNode("div", {
ref: "thumb",
class: "as-scrollbar__thumb",
style: Vue.normalizeStyle(_ctx.thumbStyle),
onMousedown: _cache[0] || (_cache[0] = (...args) => _ctx.clickThumbHandler && _ctx.clickThumbHandler(...args))
}, null, 36) ], 34), [ [ Vue.vShow, _ctx.always || _ctx.visible ] ]) ]),
_: 1
});
}
var Bar = _export_sfc(_sfc_main$c, [ [ "render", _sfc_render$c ], [ "__file", "E:\\myProject\\all-search\\src\\components\\scrollbar\\src\\bar.vue" ] ]);
const _sfc_main$b = Vue.defineComponent({
components: {
Bar: Bar
},
props: {
height: {
type: [ String, Number ],
default: ""
},
maxHeight: {
type: [ String, Number ],
default: ""
},
native: {
type: Boolean,
default: false
},
wrapStyle: {
type: [ String, Array ],
default: ""
},
wrapClass: {
type: [ String, Array ],
default: ""
},
viewClass: {
type: [ String, Array ],
default: ""
},
viewStyle: {
type: [ String, Array ],
default: ""
},
noresize: Boolean,
tag: {
type: String,
default: "div"
},
always: {
type: Boolean,
default: false
},
minSize: {
type: Number,
default: 20
}
},
emits: [ "scroll" ],
setup(props, {emit: emit}) {
const sizeWidth = Vue.ref("0");
const sizeHeight = Vue.ref("0");
const moveX = Vue.ref(0);
const moveY = Vue.ref(0);
const scrollbar = Vue.ref(null);
const wrap = Vue.ref(null);
const resize = Vue.ref(null);
const ratioY = Vue.ref(1);
const ratioX = Vue.ref(1);
const SCOPE = "AScrollbar";
const GAP = 4;
const renderWrapStyle = Vue.computed(() => {
let style = props.wrapStyle;
if (isArray(style)) {
style = toObject(style);
style.height = addUnit(props.height);
style.maxHeight = addUnit(props.maxHeight);
} else if (isString(style)) {
style += addUnit(props.height) ? `height: ${addUnit(props.height)};` : "";
style += addUnit(props.maxHeight) ? `max-height: ${addUnit(props.maxHeight)};` : "";
}
return style;
});
const update = () => {
if (!wrap.value) return;
const offsetHeight = wrap.value.offsetHeight - GAP;
const offsetWidth = wrap.value.offsetWidth - GAP;
const originalHeight = offsetHeight ** 2 / wrap.value.scrollHeight;
const originalWidth = offsetWidth ** 2 / wrap.value.scrollWidth;
const height = Math.max(originalHeight, props.minSize);
const width = Math.max(originalWidth, props.minSize);
ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
sizeHeight.value = height + GAP < offsetHeight ? height + "px" : "";
sizeWidth.value = width + GAP < offsetWidth ? width + "px" : "";
};
const handleScroll = () => {
if (wrap.value) {
const offsetHeight = wrap.value.offsetHeight - GAP;
const offsetWidth = wrap.value.offsetWidth - GAP;
moveY.value = wrap.value.scrollTop * 100 / offsetHeight * ratioY.value;
moveX.value = wrap.value.scrollLeft * 100 / offsetWidth * ratioX.value;
emit("scroll", {
scrollTop: wrap.value.scrollTop,
scrollLeft: wrap.value.scrollLeft
});
}
};
const setScrollTop = value => {
if (!isNumber(value)) {
debugWarn(SCOPE, "value must be a number");
return;
}
wrap.value.scrollTop = value;
};
const setScrollLeft = value => {
if (!isNumber(value)) {
debugWarn(SCOPE, "value must be a number");
return;
}
wrap.value.scrollLeft = value;
};
Vue.onMounted(() => {
if (!props.native) {
Vue.nextTick(update);
}
if (!props.noresize) {
addResizeListener(resize.value, update);
addEventListener("resize", update);
}
});
Vue.onBeforeUnmount(() => {
if (!props.noresize) {
removeResizeListener(resize.value, update);
removeEventListener("resize", this.update);
}
});
Vue.onUpdated(() => update());
return {
scrollbar: scrollbar,
wrap: wrap,
resize: resize,
moveX: moveX,
moveY: moveY,
ratioX: ratioX,
ratioY: ratioY,
sizeWidth: sizeWidth,
sizeHeight: sizeHeight,
update: update,
handleScroll: handleScroll,
scrollTo: scrollTo,
setScrollTop: setScrollTop,
setScrollLeft: setScrollLeft,
renderWrapStyle: renderWrapStyle
};
}
});
const _hoisted_1$7 = {
ref: "scrollbar",
class: "as-scrollbar"
};
function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
const _component_bar = Vue.resolveComponent("bar");
return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1$7, [ Vue.createElementVNode("div", {
ref: "wrap",
class: Vue.normalizeClass([ _ctx.wrapClass, "as-scrollbar__wrap", _ctx.native ? "" : "as-scrollbar__wrap--hidden-default" ]),
style: Vue.normalizeStyle(_ctx.renderWrapStyle),
onScroll: _cache[0] || (_cache[0] = (...args) => _ctx.handleScroll && _ctx.handleScroll(...args))
}, [ (Vue.openBlock(), Vue.createBlock(Vue.resolveDynamicComponent(_ctx.tag), {
ref: "resize",
class: Vue.normalizeClass([ "as-scrollbar__view", _ctx.viewClass ]),
style: Vue.normalizeStyle(_ctx.viewStyle)
}, {
default: Vue.withCtx(() => [ Vue.renderSlot(_ctx.$slots, "default") ]),
_: 3
}, 8, [ "class", "style" ])) ], 38), !_ctx.native ? (Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, {
key: 0
}, [ Vue.createVNode(_component_bar, {
move: _ctx.moveX,
ratio: _ctx.ratioX,
size: _ctx.sizeWidth,
always: _ctx.always
}, null, 8, [ "move", "ratio", "size", "always" ]), Vue.createVNode(_component_bar, {
move: _ctx.moveY,
ratio: _ctx.ratioY,
size: _ctx.sizeHeight,
vertical: "",
always: _ctx.always
}, null, 8, [ "move", "ratio", "size", "always" ]) ], 64)) : Vue.createCommentVNode("v-if", true) ], 512);
}
var scrollbar = _export_sfc(_sfc_main$b, [ [ "render", _sfc_render$b ], [ "__file", "E:\\myProject\\all-search\\src\\components\\scrollbar\\src\\scrollbar.vue" ] ]);
var css$b = ":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}\r\n";
injectStyle(css$b);
let el = document.createElement("a");
const replaceUrl = function(val) {
const lowerCaseVal = val.toLowerCase();
const list = [ "http://", "https://", "ftp://", "files://" ];
for (let i = 0; i < list.length; i++) {
if (lowerCaseVal.indexOf(list[i]) === 0) {
return val.replace(/.*\/\//, "//");
}
}
return val;
};
function parseUrl(url) {
let val = url;
if (val.indexOf("//") < 0) {
val = `//${val}`;
} else if (val.indexOf("//") > -1) {
val = replaceUrl(val);
} else {
return el;
}
el.href = val;
return {
href: el.href,
origin: el.origin,
protocol: el.protocol,
host: el.host,
hostname: el.hostname,
port: el.port,
pathname: el.pathname,
search: el.search,
hash: el.hash
};
}
var search = [ {
nameZh: "百度",
url: "https://www.baidu.com/s?wd=%s&ie=utf-8"
}, {
nameZh: "谷歌",
url: "https://www.google.com/search?q=%s&ie=utf-8&oe=utf-8"
}, {
nameZh: "必应",
url: "https://cn.bing.com/search?q=%s"
}, {
nameZh: "DDG",
url: "https://duckduckgo.com/?q=%s"
}, {
nameZh: "头条搜索",
url: "https://so.toutiao.com/search?dvpf=pc&keyword=%s"
}, {
nameZh: "360",
url: "https://www.so.com/s?ie=utf-8&q=%s"
}, {
nameZh: "雅虎",
url: "https://search.yahoo.com/search;?p=%s"
}, {
nameZh: "搜狗",
url: "https://www.sogou.com/web?query=%s"
}, {
nameZh: "Yandex",
url: "https://yandex.com/search/?text=%s"
}, {
nameZh: "startpage",
url: "https://www.startpage.com/sp/search?query=%s",
icon: "https://www.startpage.com/sp/cdn/favicons/favicon-16x16--default.png"
} ];
var translate = [ {
nameZh: "百度翻译",
url: "http://fanyi.baidu.com/#auto/zh/%s"
}, {
nameZh: "DeepL",
url: "https://www.deepl.com/translator#zh/en/%s",
icon: "https://www.deepl.com/img/favicon/favicon_96.png"
}, {
nameZh: "谷歌翻译",
url: "https://translate.google.com/?q=%s"
}, {
nameZh: "有道词典",
url: "http://dict.youdao.com/search?q=%s",
icon: "https://shared.ydstatic.com/images/favicon.ico"
}, {
nameZh: "必应翻译",
url: "http://cn.bing.com/dict/search?q=%s"
} ];
var developer = [ {
nameZh: "MDN",
url: "https://developer.mozilla.org/zh-CN/search?q=%s"
}, {
nameZh: "stackoverflow",
url: "https://stackoverflow.com/search?q=%s"
}, {
nameZh: "掘金",
url: "https://juejin.im/search?query=%s&type=all"
}, {
nameZh: "Can I Use",
url: "http://caniuse.com/#search=%s",
icon: "https://caniuse.com/img/favicon-128.png"
}, {
nameZh: "GitHub",
url: "https://github.com/search?utf8=✓&q=%s"
}, {
nameZh: "w3c",
url: "http://www.runoob.com/?s=%s"
}, {
nameZh: "GreasyFork",
url: "https://greasyfork.org/zh-CN/scripts?q=%s&utf8=✓",
icon: "https://greasyfork.org/packs/media/images/blacklogo96-b2384000fca45aa17e45eb417cbcbb59.png"
} ];
var video = [ {
nameZh: "bilibili",
url: "http://search.bilibili.com/all?keyword=%s"
}, {
nameZh: "腾讯视频",
url: "https://v.qq.com/x/search/?q=%s"
}, {
nameZh: "爱奇艺",
url: "http://so.iqiyi.com/so/q_%s",
icon: "https://www.iqiyi.com/favicon.ico"
}, {
nameZh: "youtube",
url: "https://www.youtube.com/results?search_query=%s"
}, {
nameZh: "优酷",
url: "http://www.soku.com/search_video/q_%s",
icon: "https://img.alicdn.com/tfs/TB1WeJ9Xrj1gK0jSZFuXXcrHpXa-195-195.png"
}, {
nameZh: "AcFun",
url: "https://www.acfun.cn/search?keyword=%s"
}, {
nameZh: "搜狐",
url: "http://so.tv.sohu.com/mts?wd=%s"
}, {
nameZh: "niconico",
url: "http://www.nicovideo.jp/search/%s"
} ];
var music = [ {
nameZh: "网易音乐",
url: "http://music.163.com/#/search/m/?s=%s",
icon: "https://s1.music.126.net/style/favicon.ico"
}, {
nameZh: "一听",
url: "http://so.1ting.com/all.do?q=%s"
}, {
nameZh: "QQ音乐",
url: "https://y.qq.com/portal/search.html#page=1&searchid=1&remoteplace=txt.yqq.top&t=song&w=%s"
}, {
nameZh: "百度音乐",
url: "http://music.baidu.com/search?ie=utf-8&oe=utf-8&key=%s"
}, {
nameZh: "酷我音乐",
url: "http://sou.kuwo.cn/ws/NSearch?type=all&key=%s"
}, {
nameZh: "酷狗",
url: "http://search.5sing.kugou.com/?keyword=%s"
} ];
var news = [ {
nameZh: "谷歌中文",
url: "https://news.google.com/search?q=%s&hl=zh-CN&gl=CN&ceid=CN:zh-Hans",
icon: "https://www.google.com/favicon.ico"
}, {
nameZh: "百度新闻",
url: "http://news.baidu.com/ns?word=%s&tn=news&from=news&cl=2&rn=20&ct=1",
icon: "https://www.baidu.com/favicon.ico"
}, {
nameZh: "网易-百度",
url: "https://www.baidu.com/s?wd=%s%20site%3Anews.163.com"
}, {
nameZh: "腾讯新闻",
url: "https://www.sogou.com/sogou?site=news.qq.com&query=%s"
}, {
nameZh: "凤凰新闻",
url: "https://so.ifeng.com/?q=%s&c=1"
}, {
nameZh: "CNN",
url: "https://edition.cnn.com/search/?q=%s"
}, {
nameZh: "BBC",
url: "https://www.bbc.co.uk/search?q=%s"
}, {
nameZh: "今日头条",
url: "https://www.toutiao.com/search/?keyword=%s"
} ];
var social = [ {
nameZh: "知乎",
url: "https://www.zhihu.com/search?q=%s&type=content"
}, {
nameZh: "推特",
url: "https://twitter.com/search/%s"
}, {
nameZh: "豆瓣",
url: "https://www.douban.com/search?source=suggest&q=%s"
}, {
nameZh: "百度贴吧",
url: "https://tieba.baidu.com/f?kw=%s&ie=utf-8"
}, {
nameZh: "新浪微博",
url: "https://s.weibo.com/weibo?q=%s"
}, {
nameZh: "脸书",
url: "https://www.facebook.com/search/results.php?q=%s"
}, {
nameZh: "微信搜索",
url: "http://weixin.sogou.com/weixin?ie=utf8&type=2&query=%s"
} ];
var knowledge = [ {
nameZh: "维基",
url: "http://zh.wikipedia.org/wiki/%s"
}, {
nameZh: "百度百科",
url: "http://baike.baidu.com/search/word?pic=1&sug=1&word=%s"
}, {
nameZh: "百度文库",
url: "http://wenku.baidu.com/search?word=%s&ie=utf-8"
}, {
nameZh: "豆丁文档",
url: "http://www.docin.com/search.do?searchcat=2&searchType_banner=p&nkey=%s"
}, {
nameZh: "爱问知识",
url: "http://iask.sina.com.cn/search?searchWord=%s"
}, {
nameZh: "萌娘百科",
url: "https://zh.moegirl.org/%s",
icon: "https://zh.moegirl.org.cn/favicon.ico"
}, {
nameZh: "果壳",
url: "http://www.guokr.com/search/all/?wd=%s"
}, {
nameZh: "Quora",
url: "https://www.quora.com/search?q=%s"
} ];
var image = [ {
nameZh: "谷歌图片",
url: "https://www.google.com/search?q=%s&tbm=isch"
}, {
nameZh: "百度图片",
url: "http://image.baidu.com/search/index?tn=baiduimage&ie=utf-8&word=%s"
}, {
nameZh: "必应图片",
url: "https://www.bing.com/images/search?q=%s"
}, {
nameZh: "搜狗图片",
url: "https://pic.sogou.com/pics?query=%s"
}, {
nameZh: "pixiv",
url: "http://www.pixiv.net/search.php?word=%s"
}, {
nameZh: "flickr",
url: "http://www.flickr.com/search/?q=%s"
}, {
nameZh: "花瓣",
url: "http://huaban.com/search/?q=%s"
}, {
nameZh: "Pinterest",
url: "https://www.pinterest.com/search/pins/?q=%s&rs=typed&term_meta"
}, {
nameZh: "yandex",
url: "https://yandex.com/images/search?text=%s"
}, {
nameZh: "pixabay",
url: "https://pixabay.com/images/search/%s/",
icon: "https://pixabay.com/favicon-32x32.png"
}, {
nameZh: "unsplash",
url: "https://unsplash.com/s/photos/%s"
} ];
var shopping = [ {
nameZh: "淘宝",
url: "http://s.taobao.com/search?q=%s",
icon: "https://www.taobao.com/favicon.ico"
}, {
nameZh: "京东",
url: "http://search.jd.com/search?keyword=%s&enc=utf-8",
icon: "https://www.jd.com/favicon.ico"
}, {
nameZh: "苏宁",
url: "https://search.suning.com/%s/"
}, {
nameZh: "亚马逊",
url: "http://www.amazon.cn/s/ref=nb_sb_noss?field-keywords=%s",
icon: "https://www.amazon.cn/favicon.ico"
}, {
nameZh: "天猫",
url: "http://list.tmall.com/search_product.htm?q=%s"
}, {
nameZh: "值得买",
url: "http://search.smzdm.com/?c=home&s=%s"
}, {
nameZh: "当当网",
url: "http://search.dangdang.com/?key=%s"
}, {
nameZh: "1688",
url: "https://s.1688.com/selloffer/offer_search.htm?keywords=%s"
} ];
var disk = [ {
nameZh: "百度网盘",
url: "https://pan.baidu.com/disk/home?#/search?key=%s"
}, {
nameZh: "大力盘",
url: "https://www.dalipan.com/search?keyword=%s"
}, {
nameZh: "大圣盘",
url: "https://www.dashengpan.com/search?keyword=%s"
}, {
nameZh: "罗马盘",
url: "https://www.luomapan.com/search?keyword=%s"
}, {
nameZh: "小白盘",
url: "https://www.xiaobaipan.com/list-%s.html?from=1"
}, {
nameZh: "56网盘",
url: "https://www.56wangpan.com/search/kw%s"
} ];
const list$1 = [ {
nameZh: "搜索",
name: "search",
list: search
}, {
nameZh: "翻译",
name: "translate",
list: translate
}, {
nameZh: "视频",
name: "video",
list: video
}, {
nameZh: "购物",
name: "shopping",
list: shopping
}, {
nameZh: "音乐",
name: "music",
list: music
}, {
nameZh: "开发",
name: "developer",
list: developer
}, {
nameZh: "新闻",
name: "news",
list: news
}, {
nameZh: "社交",
name: "social",
list: social
}, {
nameZh: "百科",
name: "knowledge",
list: knowledge
}, {
nameZh: "图片",
name: "image",
list: image
}, {
nameZh: "网盘",
name: "disk",
list: disk
}, {
nameZh: "常用",
name: "personal",
list: []
} ].map(item => ({
...item,
list: item.list.map(child => {
const {hostname: hostname} = parseUrl(child.url);
return {
...child,
id: `${item.name}-${hostname}`,
data: {
visible: true
}
};
}),
data: {
visible: true
}
}));
function mergeSites(a, b) {
const oldSites = JSON.parse(JSON.stringify(a));
let newSites = JSON.parse(JSON.stringify(b.filter(item => item.name !== "personal")));
newSites.forEach(newCate => {
const oldCate = oldSites.find(oldCate => oldCate.name === newCate.name);
if (oldCate) {
newCate.list.forEach(newSite => {
const i = oldCate.list.findIndex(oldSite => oldSite.id === newSite.id);
if (i > -1) {
Object.keys(newSite).forEach(key => {
if (key !== "data") {
oldCate.list[i][key] = newSite[key];
}
});
newSite.isAdd = true;
}
});
newCate.list = newCate.list.filter(item => !item.isAdd);
if (newCate.list.length) {
oldCate.list = oldCate.list.concat(newCate.list);
}
newCate.isAdd = true;
}
});
newSites = newSites.filter(item => !item.isAdd);
if (newSites.length) {
oldSites.push(...newSites);
}
return oldSites;
}
function initSites(type) {
let sitesData = list$1;
const localSites = getSession("sites");
const sitesVersion = getSession("sites-version");
if (localSites) {
sitesData = localSites;
if (localSites && sitesVersion && (sitesVersion !== version || type !== "tm")) {
sitesData = mergeSites(localSites, list$1);
setSession("sites", sitesData);
setSession("sites-version", version);
}
}
if (type === "tm") {
sitesData = sitesData.filter(item => item.list && item.list.length > 0 && item.data && item.data.visible).map(item => ({
...item,
show: false
}));
}
return sitesData;
}
var top = "top";
var bottom = "bottom";
var right = "right";
var left = "left";
var auto = "auto";
var basePlacements = [ top, bottom, right, left ];
var start = "start";
var end = "end";
var clippingParents = "clippingParents";
var viewport = "viewport";
var popper$1 = "popper";
var reference = "reference";
var variationPlacements = basePlacements.reduce((function(acc, placement) {
return acc.concat([ placement + "-" + start, placement + "-" + end ]);
}), []);
var placements = [].concat(basePlacements, [ auto ]).reduce((function(acc, placement) {
return acc.concat([ placement, placement + "-" + start, placement + "-" + end ]);
}), []);
var beforeRead = "beforeRead";
var read = "read";
var afterRead = "afterRead";
var beforeMain = "beforeMain";
var main = "main";
var afterMain = "afterMain";
var beforeWrite = "beforeWrite";
var write = "write";
var afterWrite = "afterWrite";
var modifierPhases = [ beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite ];
function getNodeName(element) {
return element ? (element.nodeName || "").toLowerCase() : null;
}
function getWindow(node) {
if (node == null) {
return window;
}
if (node.toString() !== "[object Window]") {
var ownerDocument = node.ownerDocument;
return ownerDocument ? ownerDocument.defaultView || window : window;
}
return node;
}
function isElement(node) {
var OwnElement = getWindow(node).Element;
return node instanceof OwnElement || node instanceof Element;
}
function isHTMLElement(node) {
var OwnElement = getWindow(node).HTMLElement;
return node instanceof OwnElement || node instanceof HTMLElement;
}
function isShadowRoot(node) {
if (typeof ShadowRoot === "undefined") {
return false;
}
var OwnElement = getWindow(node).ShadowRoot;
return node instanceof OwnElement || node instanceof ShadowRoot;
}
function applyStyles(_ref) {
var state = _ref.state;
Object.keys(state.elements).forEach((function(name) {
var style = state.styles[name] || {};
var attributes = state.attributes[name] || {};
var element = state.elements[name];
if (!isHTMLElement(element) || !getNodeName(element)) {
return;
}
Object.assign(element.style, style);
Object.keys(attributes).forEach((function(name) {
var value = attributes[name];
if (value === false) {
element.removeAttribute(name);
} else {
element.setAttribute(name, value === true ? "" : value);
}
}));
}));
}
function effect$2(_ref2) {
var state = _ref2.state;
var initialStyles = {
popper: {
position: state.options.strategy,
left: "0",
top: "0",
margin: "0"
},
arrow: {
position: "absolute"
},
reference: {}
};
Object.assign(state.elements.popper.style, initialStyles.popper);
state.styles = initialStyles;
if (state.elements.arrow) {
Object.assign(state.elements.arrow.style, initialStyles.arrow);
}
return function() {
Object.keys(state.elements).forEach((function(name) {
var element = state.elements[name];
var attributes = state.attributes[name] || {};
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
var style = styleProperties.reduce((function(style, property) {
style[property] = "";
return style;
}), {});
if (!isHTMLElement(element) || !getNodeName(element)) {
return;
}
Object.assign(element.style, style);
Object.keys(attributes).forEach((function(attribute) {
element.removeAttribute(attribute);
}));
}));
};
}
var applyStyles$1 = {
name: "applyStyles",
enabled: true,
phase: "write",
fn: applyStyles,
effect: effect$2,
requires: [ "computeStyles" ]
};
function getBasePlacement(placement) {
return placement.split("-")[0];
}
var max = Math.max;
var min = Math.min;
var round = Math.round;
function getBoundingClientRect(element, includeScale) {
if (includeScale === void 0) {
includeScale = false;
}
var rect = element.getBoundingClientRect();
var scaleX = 1;
var scaleY = 1;
if (isHTMLElement(element) && includeScale) {
var offsetHeight = element.offsetHeight;
var offsetWidth = element.offsetWidth;
if (offsetWidth > 0) {
scaleX = round(rect.width) / offsetWidth || 1;
}
if (offsetHeight > 0) {
scaleY = round(rect.height) / offsetHeight || 1;
}
}
return {
width: rect.width / scaleX,
height: rect.height / scaleY,
top: rect.top / scaleY,
right: rect.right / scaleX,
bottom: rect.bottom / scaleY,
left: rect.left / scaleX,
x: rect.left / scaleX,
y: rect.top / scaleY
};
}
function getLayoutRect(element) {
var clientRect = getBoundingClientRect(element);
var width = element.offsetWidth;
var height = element.offsetHeight;
if (Math.abs(clientRect.width - width) <= 1) {
width = clientRect.width;
}
if (Math.abs(clientRect.height - height) <= 1) {
height = clientRect.height;
}
return {
x: element.offsetLeft,
y: element.offsetTop,
width: width,
height: height
};
}
function contains(parent, child) {
var rootNode = child.getRootNode && child.getRootNode();
if (parent.contains(child)) {
return true;
} else if (rootNode && isShadowRoot(rootNode)) {
var next = child;
do {
if (next && parent.isSameNode(next)) {
return true;
}
next = next.parentNode || next.host;
} while (next);
}
return false;
}
function getComputedStyle$1(element) {
return getWindow(element).getComputedStyle(element);
}
function isTableElement(element) {
return [ "table", "td", "th" ].indexOf(getNodeName(element)) >= 0;
}
function getDocumentElement(element) {
return ((isElement(element) ? element.ownerDocument : element.document) || window.document).documentElement;
}
function getParentNode(element) {
if (getNodeName(element) === "html") {
return element;
}
return element.assignedSlot || element.parentNode || (isShadowRoot(element) ? element.host : null) || getDocumentElement(element);
}
function getTrueOffsetParent(element) {
if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
return null;
}
return element.offsetParent;
}
function getContainingBlock(element) {
var isFirefox = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1;
var isIE = navigator.userAgent.indexOf("Trident") !== -1;
if (isIE && isHTMLElement(element)) {
var elementCss = getComputedStyle$1(element);
if (elementCss.position === "fixed") {
return null;
}
}
var currentNode = getParentNode(element);
if (isShadowRoot(currentNode)) {
currentNode = currentNode.host;
}
while (isHTMLElement(currentNode) && [ "html", "body" ].indexOf(getNodeName(currentNode)) < 0) {
var css = getComputedStyle$1(currentNode);
if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || [ "transform", "perspective" ].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
return currentNode;
} else {
currentNode = currentNode.parentNode;
}
}
return null;
}
function getOffsetParent(element) {
var window = getWindow(element);
var offsetParent = getTrueOffsetParent(element);
while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === "static") {
offsetParent = getTrueOffsetParent(offsetParent);
}
if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle$1(offsetParent).position === "static")) {
return window;
}
return offsetParent || getContainingBlock(element) || window;
}
function getMainAxisFromPlacement(placement) {
return [ "top", "bottom" ].indexOf(placement) >= 0 ? "x" : "y";
}
function within(min$1, value, max$1) {
return max(min$1, min(value, max$1));
}
function withinMaxClamp(min, value, max) {
var v = within(min, value, max);
return v > max ? max : v;
}
function getFreshSideObject() {
return {
top: 0,
right: 0,
bottom: 0,
left: 0
};
}
function mergePaddingObject(paddingObject) {
return Object.assign({}, getFreshSideObject(), paddingObject);
}
function expandToHashMap(value, keys) {
return keys.reduce((function(hashMap, key) {
hashMap[key] = value;
return hashMap;
}), {});
}
var toPaddingObject = function toPaddingObject(padding, state) {
padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
placement: state.placement
})) : padding;
return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
};
function arrow(_ref) {
var _state$modifiersData$;
var state = _ref.state, name = _ref.name, options = _ref.options;
var arrowElement = state.elements.arrow;
var popperOffsets = state.modifiersData.popperOffsets;
var basePlacement = getBasePlacement(state.placement);
var axis = getMainAxisFromPlacement(basePlacement);
var isVertical = [ left, right ].indexOf(basePlacement) >= 0;
var len = isVertical ? "height" : "width";
if (!arrowElement || !popperOffsets) {
return;
}
var paddingObject = toPaddingObject(options.padding, state);
var arrowRect = getLayoutRect(arrowElement);
var minProp = axis === "y" ? top : left;
var maxProp = axis === "y" ? bottom : right;
var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
var startDiff = popperOffsets[axis] - state.rects.reference[axis];
var arrowOffsetParent = getOffsetParent(arrowElement);
var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
var centerToReference = endDiff / 2 - startDiff / 2;
var min = paddingObject[minProp];
var max = clientSize - arrowRect[len] - paddingObject[maxProp];
var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
var offset = within(min, center, max);
var axisProp = axis;
state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset,
_state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
}
function effect$1(_ref2) {
var state = _ref2.state, options = _ref2.options;
var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
if (arrowElement == null) {
return;
}
if (typeof arrowElement === "string") {
arrowElement = state.elements.popper.querySelector(arrowElement);
if (!arrowElement) {
return;
}
}
if (!contains(state.elements.popper, arrowElement)) {
return;
}
state.elements.arrow = arrowElement;
}
var arrow$1 = {
name: "arrow",
enabled: true,
phase: "main",
fn: arrow,
effect: effect$1,
requires: [ "popperOffsets" ],
requiresIfExists: [ "preventOverflow" ]
};
function getVariation(placement) {
return placement.split("-")[1];
}
var unsetSides = {
top: "auto",
right: "auto",
bottom: "auto",
left: "auto"
};
function roundOffsetsByDPR(_ref) {
var x = _ref.x, y = _ref.y;
var win = window;
var dpr = win.devicePixelRatio || 1;
return {
x: round(x * dpr) / dpr || 0,
y: round(y * dpr) / dpr || 0
};
}
function mapToStyles(_ref2) {
var _Object$assign2;
var popper = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
var _offsets$x = offsets.x, x = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
x: x,
y: y
}) : {
x: x,
y: y
};
x = _ref3.x;
y = _ref3.y;
var hasX = offsets.hasOwnProperty("x");
var hasY = offsets.hasOwnProperty("y");
var sideX = left;
var sideY = top;
var win = window;
if (adaptive) {
var offsetParent = getOffsetParent(popper);
var heightProp = "clientHeight";
var widthProp = "clientWidth";
if (offsetParent === getWindow(popper)) {
offsetParent = getDocumentElement(popper);
if (getComputedStyle$1(offsetParent).position !== "static" && position === "absolute") {
heightProp = "scrollHeight";
widthProp = "scrollWidth";
}
}
offsetParent = offsetParent;
if (placement === top || (placement === left || placement === right) && variation === end) {
sideY = bottom;
var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
y -= offsetY - popperRect.height;
y *= gpuAcceleration ? 1 : -1;
}
if (placement === left || (placement === top || placement === bottom) && variation === end) {
sideX = right;
var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
x -= offsetX - popperRect.width;
x *= gpuAcceleration ? 1 : -1;
}
}
var commonStyles = Object.assign({
position: position
}, adaptive && unsetSides);
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
x: x,
y: y
}) : {
x: x,
y: y
};
x = _ref4.x;
y = _ref4.y;
if (gpuAcceleration) {
var _Object$assign;
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "",
_Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)",
_Object$assign));
}
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "",
_Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
}
function computeStyles(_ref5) {
var state = _ref5.state, options = _ref5.options;
var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
var commonStyles = {
placement: getBasePlacement(state.placement),
variation: getVariation(state.placement),
popper: state.elements.popper,
popperRect: state.rects.popper,
gpuAcceleration: gpuAcceleration,
isFixed: state.options.strategy === "fixed"
};
if (state.modifiersData.popperOffsets != null) {
state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
offsets: state.modifiersData.popperOffsets,
position: state.options.strategy,
adaptive: adaptive,
roundOffsets: roundOffsets
})));
}
if (state.modifiersData.arrow != null) {
state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
offsets: state.modifiersData.arrow,
position: "absolute",
adaptive: false,
roundOffsets: roundOffsets
})));
}
state.attributes.popper = Object.assign({}, state.attributes.popper, {
"data-popper-placement": state.placement
});
}
var computeStyles$1 = {
name: "computeStyles",
enabled: true,
phase: "beforeWrite",
fn: computeStyles,
data: {}
};
var passive = {
passive: true
};
function effect(_ref) {
var state = _ref.state, instance = _ref.instance, options = _ref.options;
var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
var window = getWindow(state.elements.popper);
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
if (scroll) {
scrollParents.forEach((function(scrollParent) {
scrollParent.addEventListener("scroll", instance.update, passive);
}));
}
if (resize) {
window.addEventListener("resize", instance.update, passive);
}
return function() {
if (scroll) {
scrollParents.forEach((function(scrollParent) {
scrollParent.removeEventListener("scroll", instance.update, passive);
}));
}
if (resize) {
window.removeEventListener("resize", instance.update, passive);
}
};
}
var eventListeners = {
name: "eventListeners",
enabled: true,
phase: "write",
fn: function fn() {},
effect: effect,
data: {}
};
var hash$1 = {
left: "right",
right: "left",
bottom: "top",
top: "bottom"
};
function getOppositePlacement(placement) {
return placement.replace(/left|right|bottom|top/g, (function(matched) {
return hash$1[matched];
}));
}
var hash = {
start: "end",
end: "start"
};
function getOppositeVariationPlacement(placement) {
return placement.replace(/start|end/g, (function(matched) {
return hash[matched];
}));
}
function getWindowScroll(node) {
var win = getWindow(node);
var scrollLeft = win.pageXOffset;
var scrollTop = win.pageYOffset;
return {
scrollLeft: scrollLeft,
scrollTop: scrollTop
};
}
function getWindowScrollBarX(element) {
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
}
function getViewportRect(element) {
var win = getWindow(element);
var html = getDocumentElement(element);
var visualViewport = win.visualViewport;
var width = html.clientWidth;
var height = html.clientHeight;
var x = 0;
var y = 0;
if (visualViewport) {
width = visualViewport.width;
height = visualViewport.height;
if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
x = visualViewport.offsetLeft;
y = visualViewport.offsetTop;
}
}
return {
width: width,
height: height,
x: x + getWindowScrollBarX(element),
y: y
};
}
function getDocumentRect(element) {
var _element$ownerDocumen;
var html = getDocumentElement(element);
var winScroll = getWindowScroll(element);
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
var y = -winScroll.scrollTop;
if (getComputedStyle$1(body || html).direction === "rtl") {
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
}
return {
width: width,
height: height,
x: x,
y: y
};
}
function isScrollParent(element) {
var _getComputedStyle = getComputedStyle$1(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
}
function getScrollParent(node) {
if ([ "html", "body", "#document" ].indexOf(getNodeName(node)) >= 0) {
return node.ownerDocument.body;
}
if (isHTMLElement(node) && isScrollParent(node)) {
return node;
}
return getScrollParent(getParentNode(node));
}
function listScrollParents(element, list) {
var _element$ownerDocumen;
if (list === void 0) {
list = [];
}
var scrollParent = getScrollParent(element);
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
var win = getWindow(scrollParent);
var target = isBody ? [ win ].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
var updatedList = list.concat(target);
return isBody ? updatedList : updatedList.concat(listScrollParents(getParentNode(target)));
}
function rectToClientRect(rect) {
return Object.assign({}, rect, {
left: rect.x,
top: rect.y,
right: rect.x + rect.width,
bottom: rect.y + rect.height
});
}
function getInnerBoundingClientRect(element) {
var rect = getBoundingClientRect(element);
rect.top = rect.top + element.clientTop;
rect.left = rect.left + element.clientLeft;
rect.bottom = rect.top + element.clientHeight;
rect.right = rect.left + element.clientWidth;
rect.width = element.clientWidth;
rect.height = element.clientHeight;
rect.x = rect.left;
rect.y = rect.top;
return rect;
}
function getClientRectFromMixedType(element, clippingParent) {
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
}
function getClippingParents(element) {
var clippingParents = listScrollParents(getParentNode(element));
var canEscapeClipping = [ "absolute", "fixed" ].indexOf(getComputedStyle$1(element).position) >= 0;
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
if (!isElement(clipperElement)) {
return [];
}
return clippingParents.filter((function(clippingParent) {
return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
}));
}
function getClippingRect(element, boundary, rootBoundary) {
var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
var clippingParents = [].concat(mainClippingParents, [ rootBoundary ]);
var firstClippingParent = clippingParents[0];
var clippingRect = clippingParents.reduce((function(accRect, clippingParent) {
var rect = getClientRectFromMixedType(element, clippingParent);
accRect.top = max(rect.top, accRect.top);
accRect.right = min(rect.right, accRect.right);
accRect.bottom = min(rect.bottom, accRect.bottom);
accRect.left = max(rect.left, accRect.left);
return accRect;
}), getClientRectFromMixedType(element, firstClippingParent));
clippingRect.width = clippingRect.right - clippingRect.left;
clippingRect.height = clippingRect.bottom - clippingRect.top;
clippingRect.x = clippingRect.left;
clippingRect.y = clippingRect.top;
return clippingRect;
}
function computeOffsets(_ref) {
var reference = _ref.reference, element = _ref.element, placement = _ref.placement;
var basePlacement = placement ? getBasePlacement(placement) : null;
var variation = placement ? getVariation(placement) : null;
var commonX = reference.x + reference.width / 2 - element.width / 2;
var commonY = reference.y + reference.height / 2 - element.height / 2;
var offsets;
switch (basePlacement) {
case top:
offsets = {
x: commonX,
y: reference.y - element.height
};
break;
case bottom:
offsets = {
x: commonX,
y: reference.y + reference.height
};
break;
case right:
offsets = {
x: reference.x + reference.width,
y: commonY
};
break;
case left:
offsets = {
x: reference.x - element.width,
y: commonY
};
break;
default:
offsets = {
x: reference.x,
y: reference.y
};
}
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
if (mainAxis != null) {
var len = mainAxis === "y" ? "height" : "width";
switch (variation) {
case start:
offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
break;
case end:
offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
break;
}
}
return offsets;
}
function detectOverflow(state, options) {
if (options === void 0) {
options = {};
}
var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper$1 : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
var altContext = elementContext === popper$1 ? reference : popper$1;
var popperRect = state.rects.popper;
var element = state.elements[altBoundary ? altContext : elementContext];
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
var referenceClientRect = getBoundingClientRect(state.elements.reference);
var popperOffsets = computeOffsets({
reference: referenceClientRect,
element: popperRect,
strategy: "absolute",
placement: placement
});
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
var elementClientRect = elementContext === popper$1 ? popperClientRect : referenceClientRect;
var overflowOffsets = {
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
};
var offsetData = state.modifiersData.offset;
if (elementContext === popper$1 && offsetData) {
var offset = offsetData[placement];
Object.keys(overflowOffsets).forEach((function(key) {
var multiply = [ right, bottom ].indexOf(key) >= 0 ? 1 : -1;
var axis = [ top, bottom ].indexOf(key) >= 0 ? "y" : "x";
overflowOffsets[key] += offset[axis] * multiply;
}));
}
return overflowOffsets;
}
function computeAutoPlacement(state, options) {
if (options === void 0) {
options = {};
}
var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
var variation = getVariation(placement);
var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter((function(placement) {
return getVariation(placement) === variation;
})) : basePlacements;
var allowedPlacements = placements$1.filter((function(placement) {
return allowedAutoPlacements.indexOf(placement) >= 0;
}));
if (allowedPlacements.length === 0) {
allowedPlacements = placements$1;
}
var overflows = allowedPlacements.reduce((function(acc, placement) {
acc[placement] = detectOverflow(state, {
placement: placement,
boundary: boundary,
rootBoundary: rootBoundary,
padding: padding
})[getBasePlacement(placement)];
return acc;
}), {});
return Object.keys(overflows).sort((function(a, b) {
return overflows[a] - overflows[b];
}));
}
function getExpandedFallbackPlacements(placement) {
if (getBasePlacement(placement) === auto) {
return [];
}
var oppositePlacement = getOppositePlacement(placement);
return [ getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement) ];
}
function flip(_ref) {
var state = _ref.state, options = _ref.options, name = _ref.name;
if (state.modifiersData[name]._skip) {
return;
}
var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements;
var preferredPlacement = state.options.placement;
var basePlacement = getBasePlacement(preferredPlacement);
var isBasePlacement = basePlacement === preferredPlacement;
var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [ getOppositePlacement(preferredPlacement) ] : getExpandedFallbackPlacements(preferredPlacement));
var placements = [ preferredPlacement ].concat(fallbackPlacements).reduce((function(acc, placement) {
return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
placement: placement,
boundary: boundary,
rootBoundary: rootBoundary,
padding: padding,
flipVariations: flipVariations,
allowedAutoPlacements: allowedAutoPlacements
}) : placement);
}), []);
var referenceRect = state.rects.reference;
var popperRect = state.rects.popper;
var checksMap = new Map;
var makeFallbackChecks = true;
var firstFittingPlacement = placements[0];
for (var i = 0; i < placements.length; i++) {
var placement = placements[i];
var _basePlacement = getBasePlacement(placement);
var isStartVariation = getVariation(placement) === start;
var isVertical = [ top, bottom ].indexOf(_basePlacement) >= 0;
var len = isVertical ? "width" : "height";
var overflow = detectOverflow(state, {
placement: placement,
boundary: boundary,
rootBoundary: rootBoundary,
altBoundary: altBoundary,
padding: padding
});
var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
if (referenceRect[len] > popperRect[len]) {
mainVariationSide = getOppositePlacement(mainVariationSide);
}
var altVariationSide = getOppositePlacement(mainVariationSide);
var checks = [];
if (checkMainAxis) {
checks.push(overflow[_basePlacement] <= 0);
}
if (checkAltAxis) {
checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
}
if (checks.every((function(check) {
return check;
}))) {
firstFittingPlacement = placement;
makeFallbackChecks = false;
break;
}
checksMap.set(placement, checks);
}
if (makeFallbackChecks) {
var numberOfChecks = flipVariations ? 3 : 1;
var _loop = function _loop(_i) {
var fittingPlacement = placements.find((function(placement) {
var checks = checksMap.get(placement);
if (checks) {
return checks.slice(0, _i).every((function(check) {
return check;
}));
}
}));
if (fittingPlacement) {
firstFittingPlacement = fittingPlacement;
return "break";
}
};
for (var _i = numberOfChecks; _i > 0; _i--) {
var _ret = _loop(_i);
if (_ret === "break") break;
}
}
if (state.placement !== firstFittingPlacement) {
state.modifiersData[name]._skip = true;
state.placement = firstFittingPlacement;
state.reset = true;
}
}
var flip$1 = {
name: "flip",
enabled: true,
phase: "main",
fn: flip,
requiresIfExists: [ "offset" ],
data: {
_skip: false
}
};
function getSideOffsets(overflow, rect, preventedOffsets) {
if (preventedOffsets === void 0) {
preventedOffsets = {
x: 0,
y: 0
};
}
return {
top: overflow.top - rect.height - preventedOffsets.y,
right: overflow.right - rect.width + preventedOffsets.x,
bottom: overflow.bottom - rect.height + preventedOffsets.y,
left: overflow.left - rect.width - preventedOffsets.x
};
}
function isAnySideFullyClipped(overflow) {
return [ top, right, bottom, left ].some((function(side) {
return overflow[side] >= 0;
}));
}
function hide(_ref) {
var state = _ref.state, name = _ref.name;
var referenceRect = state.rects.reference;
var popperRect = state.rects.popper;
var preventedOffsets = state.modifiersData.preventOverflow;
var referenceOverflow = detectOverflow(state, {
elementContext: "reference"
});
var popperAltOverflow = detectOverflow(state, {
altBoundary: true
});
var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
state.modifiersData[name] = {
referenceClippingOffsets: referenceClippingOffsets,
popperEscapeOffsets: popperEscapeOffsets,
isReferenceHidden: isReferenceHidden,
hasPopperEscaped: hasPopperEscaped
};
state.attributes.popper = Object.assign({}, state.attributes.popper, {
"data-popper-reference-hidden": isReferenceHidden,
"data-popper-escaped": hasPopperEscaped
});
}
var hide$1 = {
name: "hide",
enabled: true,
phase: "main",
requiresIfExists: [ "preventOverflow" ],
fn: hide
};
function distanceAndSkiddingToXY(placement, rects, offset) {
var basePlacement = getBasePlacement(placement);
var invertDistance = [ left, top ].indexOf(basePlacement) >= 0 ? -1 : 1;
var _ref = typeof offset === "function" ? offset(Object.assign({}, rects, {
placement: placement
})) : offset, skidding = _ref[0], distance = _ref[1];
skidding = skidding || 0;
distance = (distance || 0) * invertDistance;
return [ left, right ].indexOf(basePlacement) >= 0 ? {
x: distance,
y: skidding
} : {
x: skidding,
y: distance
};
}
function offset(_ref2) {
var state = _ref2.state, options = _ref2.options, name = _ref2.name;
var _options$offset = options.offset, offset = _options$offset === void 0 ? [ 0, 0 ] : _options$offset;
var data = placements.reduce((function(acc, placement) {
acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
return acc;
}), {});
var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
if (state.modifiersData.popperOffsets != null) {
state.modifiersData.popperOffsets.x += x;
state.modifiersData.popperOffsets.y += y;
}
state.modifiersData[name] = data;
}
var offset$1 = {
name: "offset",
enabled: true,
phase: "main",
requires: [ "popperOffsets" ],
fn: offset
};
function popperOffsets(_ref) {
var state = _ref.state, name = _ref.name;
state.modifiersData[name] = computeOffsets({
reference: state.rects.reference,
element: state.rects.popper,
strategy: "absolute",
placement: state.placement
});
}
var popperOffsets$1 = {
name: "popperOffsets",
enabled: true,
phase: "read",
fn: popperOffsets,
data: {}
};
function getAltAxis(axis) {
return axis === "x" ? "y" : "x";
}
function preventOverflow(_ref) {
var state = _ref.state, options = _ref.options, name = _ref.name;
var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
var overflow = detectOverflow(state, {
boundary: boundary,
rootBoundary: rootBoundary,
padding: padding,
altBoundary: altBoundary
});
var basePlacement = getBasePlacement(state.placement);
var variation = getVariation(state.placement);
var isBasePlacement = !variation;
var mainAxis = getMainAxisFromPlacement(basePlacement);
var altAxis = getAltAxis(mainAxis);
var popperOffsets = state.modifiersData.popperOffsets;
var referenceRect = state.rects.reference;
var popperRect = state.rects.popper;
var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
placement: state.placement
})) : tetherOffset;
var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
mainAxis: tetherOffsetValue,
altAxis: tetherOffsetValue
} : Object.assign({
mainAxis: 0,
altAxis: 0
}, tetherOffsetValue);
var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
var data = {
x: 0,
y: 0
};
if (!popperOffsets) {
return;
}
if (checkMainAxis) {
var _offsetModifierState$;
var mainSide = mainAxis === "y" ? top : left;
var altSide = mainAxis === "y" ? bottom : right;
var len = mainAxis === "y" ? "height" : "width";
var offset = popperOffsets[mainAxis];
var min$1 = offset + overflow[mainSide];
var max$1 = offset - overflow[altSide];
var additive = tether ? -popperRect[len] / 2 : 0;
var minLen = variation === start ? referenceRect[len] : popperRect[len];
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
var arrowElement = state.elements.arrow;
var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
width: 0,
height: 0
};
var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
var arrowPaddingMin = arrowPaddingObject[mainSide];
var arrowPaddingMax = arrowPaddingObject[altSide];
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
var tetherMax = offset + maxOffset - offsetModifierValue;
var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
popperOffsets[mainAxis] = preventedOffset;
data[mainAxis] = preventedOffset - offset;
}
if (checkAltAxis) {
var _offsetModifierState$2;
var _mainSide = mainAxis === "x" ? top : left;
var _altSide = mainAxis === "x" ? bottom : right;
var _offset = popperOffsets[altAxis];
var _len = altAxis === "y" ? "height" : "width";
var _min = _offset + overflow[_mainSide];
var _max = _offset - overflow[_altSide];
var isOriginSide = [ top, left ].indexOf(basePlacement) !== -1;
var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
popperOffsets[altAxis] = _preventedOffset;
data[altAxis] = _preventedOffset - _offset;
}
state.modifiersData[name] = data;
}
var preventOverflow$1 = {
name: "preventOverflow",
enabled: true,
phase: "main",
fn: preventOverflow,
requiresIfExists: [ "offset" ]
};
function getHTMLElementScroll(element) {
return {
scrollLeft: element.scrollLeft,
scrollTop: element.scrollTop
};
}
function getNodeScroll(node) {
if (node === getWindow(node) || !isHTMLElement(node)) {
return getWindowScroll(node);
} else {
return getHTMLElementScroll(node);
}
}
function isElementScaled(element) {
var rect = element.getBoundingClientRect();
var scaleX = round(rect.width) / element.offsetWidth || 1;
var scaleY = round(rect.height) / element.offsetHeight || 1;
return scaleX !== 1 || scaleY !== 1;
}
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
if (isFixed === void 0) {
isFixed = false;
}
var isOffsetParentAnElement = isHTMLElement(offsetParent);
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
var documentElement = getDocumentElement(offsetParent);
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
var scroll = {
scrollLeft: 0,
scrollTop: 0
};
var offsets = {
x: 0,
y: 0
};
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
if (getNodeName(offsetParent) !== "body" || isScrollParent(documentElement)) {
scroll = getNodeScroll(offsetParent);
}
if (isHTMLElement(offsetParent)) {
offsets = getBoundingClientRect(offsetParent, true);
offsets.x += offsetParent.clientLeft;
offsets.y += offsetParent.clientTop;
} else if (documentElement) {
offsets.x = getWindowScrollBarX(documentElement);
}
}
return {
x: rect.left + scroll.scrollLeft - offsets.x,
y: rect.top + scroll.scrollTop - offsets.y,
width: rect.width,
height: rect.height
};
}
function order(modifiers) {
var map = new Map;
var visited = new Set;
var result = [];
modifiers.forEach((function(modifier) {
map.set(modifier.name, modifier);
}));
function sort(modifier) {
visited.add(modifier.name);
var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
requires.forEach((function(dep) {
if (!visited.has(dep)) {
var depModifier = map.get(dep);
if (depModifier) {
sort(depModifier);
}
}
}));
result.push(modifier);
}
modifiers.forEach((function(modifier) {
if (!visited.has(modifier.name)) {
sort(modifier);
}
}));
return result;
}
function orderModifiers(modifiers) {
var orderedModifiers = order(modifiers);
return modifierPhases.reduce((function(acc, phase) {
return acc.concat(orderedModifiers.filter((function(modifier) {
return modifier.phase === phase;
})));
}), []);
}
function debounce(fn) {
var pending;
return function() {
if (!pending) {
pending = new Promise((function(resolve) {
Promise.resolve().then((function() {
pending = undefined;
resolve(fn());
}));
}));
}
return pending;
};
}
function mergeByName(modifiers) {
var merged = modifiers.reduce((function(merged, current) {
var existing = merged[current.name];
merged[current.name] = existing ? Object.assign({}, existing, current, {
options: Object.assign({}, existing.options, current.options),
data: Object.assign({}, existing.data, current.data)
}) : current;
return merged;
}), {});
return Object.keys(merged).map((function(key) {
return merged[key];
}));
}
var DEFAULT_OPTIONS = {
placement: "bottom",
modifiers: [],
strategy: "absolute"
};
function areValidElements() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return !args.some((function(element) {
return !(element && typeof element.getBoundingClientRect === "function");
}));
}
function popperGenerator(generatorOptions) {
if (generatorOptions === void 0) {
generatorOptions = {};
}
var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
return function createPopper(reference, popper, options) {
if (options === void 0) {
options = defaultOptions;
}
var state = {
placement: "bottom",
orderedModifiers: [],
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
modifiersData: {},
elements: {
reference: reference,
popper: popper
},
attributes: {},
styles: {}
};
var effectCleanupFns = [];
var isDestroyed = false;
var instance = {
state: state,
setOptions: function setOptions(setOptionsAction) {
var options = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
cleanupModifierEffects();
state.options = Object.assign({}, defaultOptions, state.options, options);
state.scrollParents = {
reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
popper: listScrollParents(popper)
};
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers)));
state.orderedModifiers = orderedModifiers.filter((function(m) {
return m.enabled;
}));
runModifierEffects();
return instance.update();
},
forceUpdate: function forceUpdate() {
if (isDestroyed) {
return;
}
var _state$elements = state.elements, reference = _state$elements.reference, popper = _state$elements.popper;
if (!areValidElements(reference, popper)) {
return;
}
state.rects = {
reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === "fixed"),
popper: getLayoutRect(popper)
};
state.reset = false;
state.placement = state.options.placement;
state.orderedModifiers.forEach((function(modifier) {
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
}));
for (var index = 0; index < state.orderedModifiers.length; index++) {
if (state.reset === true) {
state.reset = false;
index = -1;
continue;
}
var _state$orderedModifie = state.orderedModifiers[index], fn = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
if (typeof fn === "function") {
state = fn({
state: state,
options: _options,
name: name,
instance: instance
}) || state;
}
}
},
update: debounce((function() {
return new Promise((function(resolve) {
instance.forceUpdate();
resolve(state);
}));
})),
destroy: function destroy() {
cleanupModifierEffects();
isDestroyed = true;
}
};
if (!areValidElements(reference, popper)) {
return instance;
}
instance.setOptions(options).then((function(state) {
if (!isDestroyed && options.onFirstUpdate) {
options.onFirstUpdate(state);
}
}));
function runModifierEffects() {
state.orderedModifiers.forEach((function(_ref3) {
var name = _ref3.name, _ref3$options = _ref3.options, options = _ref3$options === void 0 ? {} : _ref3$options, effect = _ref3.effect;
if (typeof effect === "function") {
var cleanupFn = effect({
state: state,
name: name,
instance: instance,
options: options
});
var noopFn = function noopFn() {};
effectCleanupFns.push(cleanupFn || noopFn);
}
}));
}
function cleanupModifierEffects() {
effectCleanupFns.forEach((function(fn) {
return fn();
}));
effectCleanupFns = [];
}
return instance;
};
}
var defaultModifiers = [ eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1 ];
var createPopper = popperGenerator({
defaultModifiers: defaultModifiers
});
function useTimeout() {
let timeoutHandle;
const registerTimeout = (fn, delay) => {
cancelTimeout();
timeoutHandle = window.setTimeout(fn, delay);
};
const cancelTimeout = () => window.clearTimeout(timeoutHandle);
return {
registerTimeout: registerTimeout,
cancelTimeout: cancelTimeout
};
}
var css$a = '@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: 999;\n}\n\n.arrow,\n.arrow::before {\n width: 0;\n height: 0;\n border-style: solid;\n}\n\n.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.popover-content[data-popper-placement^=bottom] .arrow {\n top: -10px;\n border-width: 0 8px 10px 8px;\n border-color: transparent transparent var(--border-color) transparent;\n margin-left: -8px;\n}\n.popover-content[data-popper-placement^=bottom] .arrow::before {\n top: 1px;\n left: -7px;\n border-width: 0 7px 9px 7px;\n border-color: transparent transparent var(--background-color) transparent;\n}\n\n.popover-content[data-popper-placement^=top] .arrow {\n bottom: -10px;\n border-width: 10px 8px 0 8px;\n border-color: var(--border-color) transparent transparent transparent;\n margin-left: -8px;\n}\n.popover-content[data-popper-placement^=top] .arrow::before {\n bottom: 1px;\n left: -7px;\n border-width: 9px 7px 0 7px;\n border-color: var(--background-color) transparent transparent transparent;\n}\n\n.popover-content[data-popper-placement^=left] .arrow {\n right: -10px;\n margin-top: -8px;\n border-width: 8px 0 8px 10px;\n border-color: transparent transparent transparent var(--border-color);\n}\n.popover-content[data-popper-placement^=left] .arrow::before {\n right: 1px;\n top: -7px;\n border-width: 7px 0 7px 9px;\n border-color: transparent transparent transparent var(--background-color);\n}\n\n.popover-content[data-popper-placement^=right] .arrow {\n left: -10px;\n margin-top: -8px;\n border-width: 8px 10px 8px 0;\n border-color: transparent var(--border-color) transparent transparent;\n}\n.popover-content[data-popper-placement^=right] .arrow::before {\n left: 1px;\n top: -7px;\n border-width: 7px 9px 7px 0;\n border-color: transparent var(--background-color) transparent transparent;\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}';
injectStyle(css$a);
const _sfc_main$a = Vue.defineComponent({
props: {
placement: {
type: String,
default: "auto"
},
strategy: {
type: String,
default: "absolute"
},
popperClass: {
type: String,
default: ""
}
},
setup(props) {
const isVisible = Vue.ref(false);
const popover = Vue.ref(null);
const popperInstance = Vue.ref(null);
const {registerTimeout: registerTimeout, cancelTimeout: cancelTimeout} = useTimeout();
function createPopover(target) {
if (popperInstance.value) {
return;
}
popperInstance.value = createPopper(target, popover.value, {
strategy: props.strategy,
placement: props.placement,
modifiers: [ {
name: "arrow",
options: {
padding: 24
}
}, {
name: "offset",
options: {
offset: [ 0, 10 ]
}
} ]
});
}
function destroyPopover() {
if (popperInstance.value) {
popperInstance.value.destroy();
popperInstance.value = null;
}
}
function show(target) {
isVisible.value = true;
createPopover(target);
cancelTimeout();
}
function hide() {
registerTimeout(() => {
isVisible.value = false;
destroyPopover();
}, 200);
}
return {
isVisible: isVisible,
popover: popover,
popperInstance: popperInstance,
show: show,
hide: hide
};
}
});
const _hoisted_1$6 = [ "data-show", "data-initialized" ];
const _hoisted_2$5 = Vue.createElementVNode("div", {
class: "arrow",
"data-popper-arrow": ""
}, null, -1);
function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
return Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, null, [ Vue.renderSlot(_ctx.$slots, "trigger", Vue.normalizeProps(Vue.guardReactiveProps({
show: _ctx.show,
hide: _ctx.hide
}))), Vue.createVNode(Vue.Transition, {
name: "slide-fade"
}, {
default: Vue.withCtx(() => [ (Vue.openBlock(), Vue.createBlock(Vue.Teleport, {
to: "body"
}, [ Vue.createElementVNode("div", {
class: Vue.normalizeClass([ _ctx.popperClass, "popover-content" ]),
ref: "popover",
"data-show": _ctx.isVisible,
"data-initialized": _ctx.popperInstance !== null,
onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.show && _ctx.show(...args)),
onMouseleave: _cache[1] || (_cache[1] = (...args) => _ctx.hide && _ctx.hide(...args))
}, [ _hoisted_2$5, Vue.renderSlot(_ctx.$slots, "default") ], 42, _hoisted_1$6) ])) ]),
_: 3
}) ], 64);
}
var popper = _export_sfc(_sfc_main$a, [ [ "render", _sfc_render$a ], [ "__file", "E:\\myProject\\all-search\\src\\components\\popper.vue" ] ]);
var css$9 = ".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: 1.25px 8px 0 0;\n}";
injectStyle(css$9);
const _sfc_main$9 = {
name: "icon",
props: {
name: {
type: String,
default: ""
}
}
};
const _hoisted_1$5 = {
class: "as-icon as-menu-item-icon",
"aria-hidden": "true"
};
const _hoisted_2$4 = [ "xlink:href" ];
function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
return Vue.openBlock(), Vue.createElementBlock("svg", _hoisted_1$5, [ Vue.createElementVNode("use", {
"xlink:href": `#icon-${$props.name}`
}, null, 8, _hoisted_2$4) ]);
}
var icon = _export_sfc(_sfc_main$9, [ [ "render", _sfc_render$9 ], [ "__file", "E:\\myProject\\all-search\\src\\components\\icon.vue" ] ]);
var css$8 = '.as-menu-item.horizontal {\n position: relative;\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.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\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\n.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 padding: 0 16px;\n margin: 0;\n white-space: nowrap;\n cursor: pointer;\n font-size: 14px;\n display: flex;\n align-items: center;\n}\n.as-menu-item:hover {\n border-color: var(--as-primary-color);\n}\n.as-menu-item:hover .as-menu-item-icon, .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}\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 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.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}\n.as-subMenu .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-subMenu .as-url-icon img {\n width: 100%;\n height: 100%;\n border: none;\n vertical-align: top;\n}\n.as-subMenu .as-url-icon img.error {\n display: inline-block;\n transform: scale(1);\n content: "";\n color: transparent;\n}\n.as-subMenu .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-subMenu .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}';
injectStyle(css$8);
const _sfc_main$8 = {
name: "menuItem",
components: {
popper: popper,
icon: icon
},
props: {
item: {
type: Object
},
mode: {
type: String,
default: "horizontal"
}
},
setup(props) {
const {isMobile: isMobile} = useUa();
const currentSite = siteInfo();
const classList = Vue.computed(() => props.mode === "horizontal" ? "horizontal" : "vertical");
const placement = Vue.computed(() => props.mode === "horizontal" ? "bottom-start" : "right-start");
const formatItem = Vue.computed(() => {
const keyword = defaultKeyword();
return {
...props.item,
list: props.item.list.map(item => ({
...item,
url: item.url.replace("%s", keyword)
}))
};
});
function getFavicon(item) {
if (item.icon) {
return item.icon;
}
const obj = parseUrl(item.url);
return `${obj.origin}/favicon.ico`;
}
const handleMenuShow = (value, item) => {
item.show = value;
};
const defaultKeyword = () => {
let keyword = getKeyword();
if (currentSite && currentSite.keyword) {
keyword = currentSite.keyword();
}
return encodeURIComponent(keyword);
};
const handleClick = (item, isOpen, disabled) => {
const disVal = Vue.unref(disabled);
if (disVal) {
return;
}
const keyword = defaultKeyword();
if (isOpen) {
window.open(item.url.replace("%s", keyword));
} else {
window.location.href = item.url.replace("%s", keyword);
}
};
return {
placement: placement,
classList: classList,
getFavicon: getFavicon,
handleMenuShow: handleMenuShow,
handleClick: handleClick,
isMobile: isMobile,
formatItem: formatItem
};
}
};
const _hoisted_1$4 = [ "href", "onMouseenter", "onMouseleave" ];
const _hoisted_2$3 = [ "textContent" ];
const _hoisted_3$3 = {
key: 1,
class: "as-menu-item"
};
const _hoisted_4$2 = [ "textContent" ];
const _hoisted_5 = {
class: "as-subMenu"
};
const _hoisted_6 = [ "href" ];
const _hoisted_7 = {
class: "as-url-icon"
};
const _hoisted_8 = [ "src" ];
const _hoisted_9 = [ "textContent" ];
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
const _component_icon = Vue.resolveComponent("icon");
const _component_popper = Vue.resolveComponent("popper");
return Vue.openBlock(), Vue.createBlock(_component_popper, {
placement: $setup.placement,
"popper-class": "as-subMenu-container"
}, {
trigger: Vue.withCtx(({show: show, hide: hide}) => [ !$setup.isMobile ? (Vue.openBlock(),
Vue.createElementBlock("a", {
key: 0,
class: Vue.normalizeClass([ "as-menu-item no-underline", $setup.classList ]),
href: $setup.formatItem.list[0].url,
onMouseenter: $event => show($event.target),
onMouseleave: hide
}, [ Vue.createVNode(_component_icon, {
name: $props.item.name
}, null, 8, [ "name" ]), Vue.createElementVNode("span", {
class: "as-menu-item-title",
textContent: Vue.toDisplayString($props.item.nameZh)
}, null, 8, _hoisted_2$3) ], 42, _hoisted_1$4)) : (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_3$3, [ Vue.createVNode(_component_icon, {
name: $props.item.name
}, null, 8, [ "name" ]), Vue.createElementVNode("span", {
class: "as-menu-item-title",
textContent: Vue.toDisplayString($props.item.nameZh)
}, null, 8, _hoisted_4$2) ])) ]),
default: Vue.withCtx(() => [ Vue.createElementVNode("ul", _hoisted_5, [ (Vue.openBlock(true),
Vue.createElementBlock(Vue.Fragment, null, Vue.renderList($setup.formatItem.list, (child, i) => Vue.withDirectives((Vue.openBlock(),
Vue.createElementBlock("li", {
key: `${$props.item.name}_${i}`
}, [ Vue.createElementVNode("a", {
href: child.url
}, [ Vue.createElementVNode("div", _hoisted_7, [ Vue.createElementVNode("img", {
src: $setup.getFavicon(child),
onerror: "this.classList.add('error')"
}, null, 8, _hoisted_8) ]), Vue.createElementVNode("p", {
class: "as-subMenu-text",
textContent: Vue.toDisplayString(child.nameZh)
}, null, 8, _hoisted_9) ], 8, _hoisted_6) ])), [ [ Vue.vShow, child.data.visible ] ])), 128)) ]) ]),
_: 1
}, 8, [ "placement" ]);
}
var menuItem = _export_sfc(_sfc_main$8, [ [ "render", _sfc_render$8 ], [ "__file", "E:\\myProject\\all-search\\src\\components\\menuItem.vue" ] ]);
const session = getSession("align");
const list = new Map([ [ "flex-start", "开始" ], [ "center", "居中" ], [ "flex-end", "末尾" ] ]);
const formatVal = val => {
const has = list.has(val);
if (has) {
return val;
}
return "flex-start";
};
const align = Vue.ref(formatVal(session));
const alignList = Vue.reactive(list);
Vue.watch(align, value => {
setSession("align", formatVal(value));
});
function useAlign() {
return {
alignList: alignList,
align: align
};
}
var css$7 = ".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.drop-enter-active, .drop-leave-active {\n transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);\n}\n\n.drop-enter, .drop-leave-to {\n opacity: 0;\n transform: scaleY(0.0001);\n}\n\n.fade-enter-active, .fade-leave-active {\n transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);\n}\n\n.fade-enter, .fade-leave-to {\n opacity: 0;\n}\n\n.el-scrollbar__bar {\n display: none;\n}";
injectStyle(css$7);
const _sfc_main$7 = {
name: "as-menu",
components: {
scrollbar: scrollbar,
menuItem: menuItem
},
props: {
mode: {
type: String,
default: "horizontal",
validator: val => [ "horizontal", "vertical" ].indexOf(val) > -1
}
},
setup(props) {
const sites = Vue.reactive(initSites("tm"));
const {align: align} = useAlign();
const data = Vue.reactive({
showTimeout: 50,
hideTimeout: 200
});
const transition = Vue.computed(() => props.mode === "horizontal" ? "drop" : "fade");
const menuClass = Vue.computed(() => ({
"as-horizontal-menu": props.mode === "horizontal",
"as-vertical-menu": props.mode === "vertical"
}));
return {
sites: sites,
data: data,
align: align,
transition: transition,
menuClass: menuClass
};
}
};
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
const _component_menu_item = Vue.resolveComponent("menu-item");
const _component_scrollbar = Vue.resolveComponent("scrollbar");
return Vue.openBlock(), Vue.createBlock(_component_scrollbar, {
class: "as-menu-container",
noresize: ""
}, {
default: Vue.withCtx(() => [ Vue.createElementVNode("ul", {
class: Vue.normalizeClass([ "as-menu", $setup.menuClass ]),
style: Vue.normalizeStyle({
justifyContent: $setup.align
})
}, [ (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList($setup.sites, item => (Vue.openBlock(),
Vue.createBlock(_component_menu_item, {
key: item.name,
item: item,
mode: $props.mode
}, null, 8, [ "item", "mode" ]))), 128)) ], 6) ]),
_: 1
});
}
var asMenu = _export_sfc(_sfc_main$7, [ [ "render", _sfc_render$7 ], [ "__file", "E:\\myProject\\all-search\\src\\components\\menu.vue" ] ]);
const primaryColor = Vue.ref("");
const bgColor = Vue.ref("");
const primaryTextColor = Vue.ref("");
Vue.watch(primaryColor, value => {
setCssValue("primary-color", value);
setSession("primary-color", value);
});
Vue.watch(bgColor, value => {
setCssValue("bg-color", value);
setSession("bg-color", value);
});
Vue.watch(primaryTextColor, value => {
setCssValue("primary-text-color", value);
setSession("primary-text-color", value);
});
const getCssValue = name => {
const el = document.getElementById("all-search");
return getComputedStyle(el).getPropertyValue(`--as-${name}`).trim();
};
const setCssValue = (name, value) => {
const el = document.getElementById("all-search");
el.style.setProperty(`--as-${name}`, value);
document.body.style.setProperty(`--as-${name}`, value);
};
const map = {
"primary-color": primaryColor,
"bg-color": bgColor,
"primary-text-color": primaryTextColor
};
const initColor = name => {
const colorDefault = getCssValue(name);
const session = getSession(name) || colorDefault;
const colorVal = map[name];
colorVal.value = session;
};
function useColor() {
Vue.onMounted(() => {
initColor("primary-color");
initColor("bg-color");
initColor("primary-text-color");
});
return {
primaryColor: primaryColor,
bgColor: bgColor,
primaryTextColor: primaryTextColor
};
}
var css$6 = ".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}";
injectStyle(css$6);
const _sfc_main$6 = {
name: "overlay",
setup(props, {emit: emit}) {
let mouseDownTarget = false;
let mouseUpTarget = false;
const onMaskClick = e => {
if (mouseDownTarget && mouseUpTarget) {
emit("click", e);
}
mouseDownTarget = mouseUpTarget = false;
};
const onMouseDown = e => {
mouseDownTarget = e.target === e.currentTarget;
};
const onMouseUp = e => {
mouseUpTarget = e.target === e.currentTarget;
};
return {
onMouseDown: onMouseDown,
onMouseUp: onMouseUp,
onMaskClick: onMaskClick
};
}
};
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
return Vue.openBlock(), Vue.createElementBlock("div", {
class: "as-overlay",
onMousedown: _cache[0] || (_cache[0] = (...args) => $setup.onMouseDown && $setup.onMouseDown(...args)),
onMouseup: _cache[1] || (_cache[1] = (...args) => $setup.onMouseUp && $setup.onMouseUp(...args)),
onClick: _cache[2] || (_cache[2] = (...args) => $setup.onMaskClick && $setup.onMaskClick(...args))
}, [ Vue.renderSlot(_ctx.$slots, "default") ], 32);
}
var overlay = _export_sfc(_sfc_main$6, [ [ "render", _sfc_render$6 ], [ "__file", "E:\\myProject\\all-search\\src\\components\\overlay.vue" ] ]);
var css$5 = '/* 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}';
injectStyle(css$5);
const _sfc_main$5 = {
name: "as-radio",
props: {
modelValue: {
type: [ String, Number ]
},
label: {
type: [ String, Number ],
default: ""
}
},
setup(props, ctx) {
const model = Vue.computed({
get() {
return props.modelValue;
},
set(value) {
ctx.emit("update:modelValue", value);
}
});
return {
model: model
};
}
};
const _hoisted_1$3 = {
class: "as-radio as-radio-animate"
};
const _hoisted_2$2 = [ "value" ];
const _hoisted_3$2 = Vue.createElementVNode("i", {
class: "as-radio-icon"
}, null, -1);
const _hoisted_4$1 = {
class: "as-radio-label"
};
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
return Vue.openBlock(), Vue.createElementBlock("label", _hoisted_1$3, [ Vue.withDirectives(Vue.createElementVNode("input", {
type: "radio",
value: $props.label,
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => $setup.model = $event)
}, null, 8, _hoisted_2$2), [ [ Vue.vModelRadio, $setup.model ] ]), _hoisted_3$2, Vue.createElementVNode("span", _hoisted_4$1, [ Vue.renderSlot(_ctx.$slots, "default") ]) ]);
}
var radio = _export_sfc(_sfc_main$5, [ [ "render", _sfc_render$5 ], [ "__file", "E:\\myProject\\all-search\\src\\components\\radio.vue" ] ]);
var css$4 = ".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 height: 40px;\n line-height: 40px;\n position: relative;\n font-size: 14px;\n}";
injectStyle(css$4);
const _sfc_main$4 = {
name: "form-item",
props: {
labelWidth: {
type: [ String, Number ],
default: 60
},
label: {
type: [ String, Number ],
default: ""
}
},
setup(props) {
const labelStyle = Vue.computed(() => ({
width: `${props.labelWidth}px`
}));
const contentStyle = Vue.computed(() => ({
marginLeft: `${props.labelWidth}px`
}));
return {
labelStyle: labelStyle,
contentStyle: contentStyle
};
}
};
const _hoisted_1$2 = [ "textContent" ];
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
return Vue.openBlock(), Vue.createElementBlock("div", null, [ Vue.createElementVNode("label", {
class: "as-label",
style: Vue.normalizeStyle($setup.labelStyle),
textContent: Vue.toDisplayString($props.label)
}, null, 12, _hoisted_1$2), Vue.createElementVNode("div", {
class: "as-content",
style: Vue.normalizeStyle($setup.contentStyle)
}, [ Vue.renderSlot(_ctx.$slots, "default") ], 4) ]);
}
var formItem = _export_sfc(_sfc_main$4, [ [ "render", _sfc_render$4 ], [ "__file", "E:\\myProject\\all-search\\src\\components\\form-item.vue" ] ]);
var css$3 = ".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}";
injectStyle(css$3);
const _sfc_main$3 = {
name: "xButton",
props: {
type: {
type: String,
default: "primary"
}
}
};
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
return Vue.openBlock(), Vue.createElementBlock("button", {
class: Vue.normalizeClass([ "as-button", `as-button__${$props.type}` ])
}, [ Vue.renderSlot(_ctx.$slots, "default") ], 2);
}
var asButton = _export_sfc(_sfc_main$3, [ [ "render", _sfc_render$3 ], [ "__file", "E:\\myProject\\all-search\\src\\components\\button.vue" ] ]);
var css$2 = '@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}';
injectStyle(css$2);
const _sfc_main$2 = {
name: "color",
components: {
asButton: asButton
},
props: {
modelValue: {
type: [ String, Number ]
},
defaultValue: {
type: [ String, Number ]
}
},
setup(props, ctx) {
const model = Vue.computed({
get() {
return props.modelValue;
},
set(value) {
ctx.emit("update:modelValue", value);
}
});
const reset = () => {
model.value = props.defaultValue;
};
return {
model: model,
reset: reset
};
}
};
const _hoisted_1$1 = {
class: "as-color-set"
};
const _hoisted_2$1 = {
class: "as-color-label"
};
const _hoisted_3$1 = Vue.createTextVNode(" 重置 ");
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
const _component_asButton = Vue.resolveComponent("asButton");
return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1$1, [ Vue.createElementVNode("label", _hoisted_2$1, [ Vue.withDirectives(Vue.createElementVNode("input", {
class: "input—color",
type: "color",
"onUpdate:modelValue": _cache[0] || (_cache[0] = $event => $setup.model = $event)
}, null, 512), [ [ Vue.vModelText, $setup.model ] ]) ]), Vue.createVNode(_component_asButton, {
class: "reset-btn",
type: "text",
onClick: $setup.reset
}, {
default: Vue.withCtx(() => [ _hoisted_3$1 ]),
_: 1
}, 8, [ "onClick" ]) ]);
}
var color = _export_sfc(_sfc_main$2, [ [ "render", _sfc_render$2 ], [ "__file", "E:\\myProject\\all-search\\src\\components\\color.vue" ] ]);
var css$1 = ".as-setting {\n line-height: 30px;\n padding: 0 16px;\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}\n.as-setting:hover {\n color: var(--as-primary-color);\n background-color: rgba(0, 0, 0, 0.025);\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}";
injectStyle(css$1);
const _sfc_main$1 = {
name: "side-bar",
components: {
overlay: overlay,
asRadio: radio,
formItem: formItem,
color: color
},
setup() {
const visible = Vue.ref(false);
const open = () => {
visible.value = true;
};
const onMaskClick = () => {
visible.value = false;
};
const {mode: mode} = useMode();
const {alignList: alignList, align: align} = useAlign();
const {primaryColor: primaryColor, bgColor: bgColor, primaryTextColor: primaryTextColor} = useColor();
const changeMode = e => {
mode.value = e.target.value;
};
const changeAlign = e => {
align.value = e.target.value;
};
return {
mode: mode,
visible: visible,
open: open,
onMaskClick: onMaskClick,
changeMode: changeMode,
alignList: alignList,
align: align,
changeAlign: changeAlign,
primaryColor: primaryColor,
bgColor: bgColor,
primaryTextColor: primaryTextColor
};
}
};
const _hoisted_1 = Vue.createElementVNode("header", {
class: "header"
}, " 设置 ", -1);
const _hoisted_2 = Vue.createTextVNode("横向 ");
const _hoisted_3 = Vue.createTextVNode("竖向 ");
const _hoisted_4 = Vue.createElementVNode("footer", null, [ Vue.createElementVNode("a", {
class: "link",
title: "all-search",
href: "https://endday.github.io/all-search/",
target: "_blank"
}, " 设置页 "), Vue.createElementVNode("a", {
class: "link",
title: "github",
href: "https://github.com/endday/all-search",
target: "_blank"
}, " GitHub地址 ") ], -1);
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
const _component_as_radio = Vue.resolveComponent("as-radio");
const _component_form_item = Vue.resolveComponent("form-item");
const _component_color = Vue.resolveComponent("color");
const _component_overlay = Vue.resolveComponent("overlay");
return Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, null, [ Vue.createElementVNode("div", {
class: "as-setting",
onClick: _cache[0] || (_cache[0] = (...args) => $setup.open && $setup.open(...args))
}, " 设置 "), (Vue.openBlock(), Vue.createBlock(Vue.Teleport, {
to: "#all-search"
}, [ Vue.createVNode(Vue.Transition, {
name: "overlay",
appear: "",
persisted: ""
}, {
default: Vue.withCtx(() => [ Vue.withDirectives(Vue.createVNode(_component_overlay, {
onClick: $setup.onMaskClick
}, {
default: Vue.withCtx(() => [ Vue.createVNode(Vue.Transition, {
name: "drawer",
appear: "",
persisted: ""
}, {
default: Vue.withCtx(() => [ Vue.withDirectives(Vue.createElementVNode("div", {
"aria-modal": "true",
role: "dialog",
class: "as-side-bar",
onClick: _cache[7] || (_cache[7] = Vue.withModifiers(() => {}, [ "stop" ]))
}, [ _hoisted_1, Vue.createElementVNode("section", null, [ Vue.createVNode(_component_form_item, {
label: "方向"
}, {
default: Vue.withCtx(() => [ Vue.createVNode(_component_as_radio, {
label: "horizontal",
modelValue: $setup.mode,
"onUpdate:modelValue": _cache[1] || (_cache[1] = $event => $setup.mode = $event),
onChange: $setup.changeMode
}, {
default: Vue.withCtx(() => [ _hoisted_2 ]),
_: 1
}, 8, [ "modelValue", "onChange" ]), Vue.createVNode(_component_as_radio, {
label: "vertical",
modelValue: $setup.mode,
"onUpdate:modelValue": _cache[2] || (_cache[2] = $event => $setup.mode = $event),
onChange: $setup.changeMode
}, {
default: Vue.withCtx(() => [ _hoisted_3 ]),
_: 1
}, 8, [ "modelValue", "onChange" ]) ]),
_: 1
}), Vue.createVNode(_component_form_item, {
label: "对齐"
}, {
default: Vue.withCtx(() => [ (Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList($setup.alignList, ([key, value]) => (Vue.openBlock(),
Vue.createBlock(_component_as_radio, {
key: key,
label: key,
modelValue: $setup.align,
"onUpdate:modelValue": _cache[3] || (_cache[3] = $event => $setup.align = $event),
onChange: $setup.changeAlign
}, {
default: Vue.withCtx(() => [ Vue.createTextVNode(Vue.toDisplayString(value), 1) ]),
_: 2
}, 1032, [ "label", "modelValue", "onChange" ]))), 128)) ]),
_: 1
}), Vue.createVNode(_component_form_item, {
label: "主题色"
}, {
default: Vue.withCtx(() => [ Vue.createVNode(_component_color, {
"default-value": "#1890ff",
modelValue: $setup.primaryColor,
"onUpdate:modelValue": _cache[4] || (_cache[4] = $event => $setup.primaryColor = $event)
}, null, 8, [ "modelValue" ]) ]),
_: 1
}), Vue.createVNode(_component_form_item, {
label: "背景色"
}, {
default: Vue.withCtx(() => [ Vue.createVNode(_component_color, {
"default-value": "#ffffff",
modelValue: $setup.bgColor,
"onUpdate:modelValue": _cache[5] || (_cache[5] = $event => $setup.bgColor = $event)
}, null, 8, [ "modelValue" ]) ]),
_: 1
}), Vue.createVNode(_component_form_item, {
label: "文字色"
}, {
default: Vue.withCtx(() => [ Vue.createVNode(_component_color, {
"default-value": "#606266",
modelValue: $setup.primaryTextColor,
"onUpdate:modelValue": _cache[6] || (_cache[6] = $event => $setup.primaryTextColor = $event)
}, null, 8, [ "modelValue" ]) ]),
_: 1
}) ]), _hoisted_4 ], 512), [ [ Vue.vShow, $setup.visible ] ]) ]),
_: 1
}) ]),
_: 1
}, 8, [ "onClick" ]), [ [ Vue.vShow, $setup.visible ] ]) ]),
_: 1
}) ])) ], 64);
}
var sideBar = _export_sfc(_sfc_main$1, [ [ "render", _sfc_render$1 ], [ "__file", "E:\\myProject\\all-search\\src\\components\\side-bar.vue" ] ]);
var css = '.body-horizontal {\n margin-top: 30px !important;\n}\n\n.body-vertical {\n margin-left: 100px !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}\n\n.as-horizontal.show {\n transform: translateY(0);\n}\n\n.as-vertical {\n height: 100%;\n width: 100px;\n top: 0;\n left: 0;\n border-right: 1px var(--as-border-color) solid;\n flex-direction: column;\n}\n\n.as-container {\n position: fixed;\n display: flex;\n background-color: var(--as-bg-color);\n z-index: 999990;\n}';
injectStyle(css);
const _sfc_main = {
name: "all-search",
components: {
logo: logo,
asMenu: asMenu,
sideBar: sideBar
},
setup() {
const show = Vue.ref(false);
const {mode: mode} = useMode();
let site = Vue.reactive({
url: "",
invisible: false,
disabled: false,
style: {},
keyword: null
});
const classList = Vue.computed(() => ({
[`as-${mode.value}`]: true
}));
initStyle$1();
updateSite();
Vue.watch(mode, newMode => {
addStyleForCurrentSite(newMode, site);
}, {
immediate: true
});
function updateSite() {
const curSite = siteInfo();
site.url = curSite.url;
site.invisible = curSite.invisible;
site.disabled = curSite.disabled;
site.style = curSite.style;
site.keyword = curSite.keyword;
}
routerChange(() => {
updateSite();
addStyleForCurrentSite(mode, site);
});
return {
site: site,
mode: mode,
classList: classList,
show: show
};
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_logo = Vue.resolveComponent("logo");
const _component_as_menu = Vue.resolveComponent("as-menu");
const _component_side_bar = Vue.resolveComponent("side-bar");
return Vue.openBlock(), Vue.createElementBlock(Vue.Fragment, null, [ Vue.withDirectives(Vue.createElementVNode("div", {
class: Vue.normalizeClass([ "as-container", $setup.classList ])
}, [ Vue.createVNode(_component_logo, {
mode: $setup.mode
}, null, 8, [ "mode" ]), Vue.createVNode(_component_as_menu, {
mode: $setup.mode
}, null, 8, [ "mode" ]), Vue.createVNode(_component_side_bar) ], 2), [ [ Vue.vShow, !$setup.site.invisible ] ]), Vue.createCommentVNode(' ') ], 2112);
}
var index = _export_sfc(_sfc_main, [ [ "render", _sfc_render ], [ "__file", "E:\\myProject\\all-search\\src\\as-script\\index.vue" ] ]);
!function(e) {
var t, a, l, o, h, i, n = '', v = (v = document.getElementsByTagName("script"))[v.length - 1].getAttribute("data-injectcss");
if (v && !e.__iconfont__svg__cssinject__) {
e.__iconfont__svg__cssinject__ = !0;
try {
document.write("");
} catch (e) {
console && console.log(e);
}
}
function m() {
h || (h = !0, l());
}
t = function() {
var e, t, a;
(a = document.createElement("div")).innerHTML = n, n = null, (t = a.getElementsByTagName("svg")[0]) && (t.setAttribute("aria-hidden", "true"),
t.style.position = "absolute", t.style.width = 0, t.style.height = 0, t.style.overflow = "hidden",
e = t, (a = document.body).firstChild ? (t = a.firstChild).parentNode.insertBefore(e, t) : a.appendChild(e));
}, document.addEventListener ? ~[ "complete", "loaded", "interactive" ].indexOf(document.readyState) ? setTimeout(t, 0) : (a = function() {
document.removeEventListener("DOMContentLoaded", a, !1), t();
}, document.addEventListener("DOMContentLoaded", a, !1)) : document.attachEvent && (l = t,
o = e.document, h = !1, (i = function() {
try {
o.documentElement.doScroll("left");
} catch (e) {
return void setTimeout(i, 50);
}
m();
})(), o.onreadystatechange = function() {
"complete" == o.readyState && (o.onreadystatechange = null, m());
});
}(window);
const app = Vue.createApp(index);
console.log(`all-search running 全搜运行中(${"production"})`);
function init() {
const el = getAsRoot();
if (!el) {
const el = createAsRoot();
const mountEL = document.body.parentElement.insertBefore(el, document.body);
app.mount(mountEL);
passTmMethods();
}
}
protectStyle();
checkBody().then(() => {
init();
}).catch(err => {
console.error(err);
});
})();