// ==UserScript==
// @name 💰 轻松省钱!超简洁好用的购物优惠券小助手,自动显示淘宝(taobao.com)、天猫(tmall.com)、聚划算、京东(jd.com)等平台优惠券与历史价格,支持手机扫码下单!最新技术实现。🛍️
// @name:zh 💰 轻松省钱!超简洁好用的购物优惠券小助手,自动显示淘宝(taobao.com)、天猫(tmall.com)、聚划算、京东(jd.com)等平台优惠券与历史价格,支持手机扫码下单!最新技术实现。🛍️
// @name:zh-TW 💰 輕鬆省錢!超簡潔好用的購物優惠券小助手,自動顯示淘寶(taobao.com)、天貓(tmall.com)、聚划算、京東(jd.com)等平台優惠券與歷史價格,支持手機掃碼下單!最新技術實現。🛍️
// @namespace https://api.jasonzk.com
// @homepage https://coupon.jasonzk.com
// @version 2.2.1
// @description 🚀 最新简洁好用的购物优惠券小助手!自动显示淘宝(taobao.com)、天猫(tmall.com)、天猫超市、天猫国际(tmall.hk)、聚划算、京东(jd.com)、京东国际(jd.hk)、京东图书、京东电子书、京东工业品、京东大药房(yiyaojd.com)等平台的隐藏优惠券与历史价格。支持手机扫码下单,方便快捷。告别虚假降价,以最优惠的价格,快乐购物,心情美满!🎉 持续维护中,让您省时省力,享受购物的乐趣!
// @description:zh 🚀 最新简洁好用的购物优惠券小助手!自动显示淘宝(taobao.com)、天猫(tmall.com)、天猫超市、天猫国际(tmall.hk)、聚划算、京东(jd.com)、京东国际(jd.hk)、京东图书、京东电子书、京东工业品、京东大药房(yiyaojd.com)等平台的隐藏优惠券与历史价格。支持手机扫码下单,方便快捷。告别虚假降价,以最优惠的价格,快乐购物,心情美满!🎉 持续维护中,让您省时省力,享受购物的乐趣!
// @description:zh-TW 🚀 最新簡潔好用的購物優惠券小助手!自動顯示淘寶(taobao.com)、天貓(tmall.com)、天貓超市、天貓國際(tmall.hk)、聚划算、京東(jd.com)、京東國際(jd.hk)、京東圖書、京東電子書、京東工業品、京東大藥房(yiyaojd.com)等平台的隱藏優惠券與歷史價格。支持手機掃碼下單,方便快捷。告別虛假降價,以最優惠的價格,快樂購物,心情美滿!🎉 持續維護中,讓您省時省力,享受購物的樂趣!
// @author JasonZK
// @license None
// @noframes
// @require https://cdn.jsdelivr.net/npm/crypto-js@4.0.0/crypto-js.min.js
// @require https://cdn.jsdelivr.net/npm/easyqrcodejs@4.6.1/dist/easy.qrcode.min.js
// @match *://*.taobao.com/*
// @match *://*.tmall.com/*
// @match *://*.tmall.hk/*
// @match *://*.detail.tmall.com/*
// @match *://*.liangxinyao.com/*
// @match *://*.jasonzk.com/*
// @match *://*.jd.com/*
// @match *://*.jd.hk/*
// @match *://*.yiyaojd.com/*
// @match *://*.jkcsjd.com/*
// @match *://*.vip.com/*
// @match *://*.vipglobal.hk/*
// @exclude *://login.taobao.com/*
// @exclude *://uland.taobao.com/*
// @exclude *://login.tmall.com/*
// @exclude *://pages.tmall.com/*
// @exclude *://trade.jd.com/*
// @exclude *://wq.jd.com/*
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATUAAAFfCAYAAAAvcFs4AAAABmJLR0QA/wD/AP+gvaeTAAAmiUlEQVR42u2dCXhcV3n31ZaWpUAhdazFjmMSxwlZyEYgZAFCoCGE5PsohHx80GDKQxpIy5o2LE3rhLUsCXGskcaKI1u2ZkbjVZb3TZb3fbflRZJtebcly5J3W/Ltecca6Y68jUZ35txz7+//PL8HCLE1c+65f917znv+b1YWQg7rmiGj358TCH0qtzDy45yCyB9zA+G3cgrD0ZyC8HD1z/+k/vuL2QWhz/R/vfgDjBZCyJXqFRyVm10Q/r5ioTKv8worCc7nBMJLxfzy8sPXMYoIIe3KHVp6fW5B+A1lUKeSNLLL0SZPc3nB0C2MKkIo4+r7VvQaZURvKs720My60iqvq72LQtmMMkIo/Rpc+Y7cQOQ5ZT6HHDazRALh4+o/Bw8YMvWdDDpCKC2SxX1lNOvSamYXsz0nEHma0UcIOaZr86MD2ncvLY3Mzg6OvoOrgRBK/cmspORv5RXQgU0ApziXXRgOqs2EXlwdhFDysqy/yCmMPKtMZL9LzKwrjdmF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Fit754QeYvQhdcb0tduSqFsNwdySQLB1ISjIzFqEk1NlVPtyMgbiKM7JUQCQQQimqV3BULl3lXRQJFCi9gVmJkAPKDZTem10QXoixaGFzbkHpY8xChJxWZ1f5nRhNRmgkEgihDCgvWPGe9iNXJzGe9EQCySu/2o3uxWxDKIPqUzS6LxFHzkcCZRdEbmd2IaRROYHQp9SO3FpMqSdmFt4mr/bMJoTcos6u8gcwqW4hKcWDBwyZ+k4mEUIuVP/Xiz/Q3lWeiKMkIoF6F4WymTUImbDeNjQyUOqqMK9LMq9PfuldzBKEDFSsq3xheCNGFmM33c4R8oLau8rHIqV9HAkk3b6YDAh5SLaII790lY9FAuUOLb2eq4+Ql9fb1HqSrCt529AiK1Xx7ENcbYT8tN4mEUeBcJ3HDG0fkUAI+fmVtKOrfKjFC93Orxky+v1cVYRQVq83w3kGRxxV9A5GbuQqIoQuUk5+5D71xLPIEDOrVkebHueqIYSurM6Io3pXRwKpblxcLIRQ0rJ1lT/lEjM7F3tFHhK9lquDEEpZefnh69ojjnQa2uzs4Og7uBoIIceUk1/2iDKXdRk2s+1EAiGE0qfOiKNDaTWzQPg4kUAIoYxJjlwp03lT6sMcNrTW3ED4LSKBEEJaJOcq28+T9nQzQcyxJC8QvZlRRQhplzxZqfOW/6qMaX43Cnilt8Li3EDoh30Lon0YRYSQKyXdy9Ur5MOqT+n3cwpDv88tiBTF0jLUa6VaK/uDmJj0VeBIE0qH/hfGd9mrkNPGNgAAAABJRU5ErkJggg==
// @antifeature referral-link
// @grant unsafeWindow
// @grant window.focus
// @grant window.close
// @grant GM_openInTab
// @grant GM_info
// @grant GM_setClipboard
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// @grant GM_notification
// @grant GM_registerMenuCommand
// @grant GM.openInTab
// @grant GM.info
// @grant GM.getValue
// @grant GM.setValue
// @grant GM.deleteValue
// @grant GM.registerMenuCommand
// @grant GM.notification
// @grant GM.setClipboard
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
(function(CryptoJS$1, EasyQRCode) {
"use strict";
var __vite_style__ = document.createElement("style");
__vite_style__.textContent = 'article.svelte-3f7cpw{color:white;padding:0.75rem 1.5rem;border-radius:0.2rem;display:flex;align-items:center;margin:0 auto 0.5rem auto;width:20rem}.error.svelte-3f7cpw{background:IndianRed}.success.svelte-3f7cpw{background-color:#ff583c}.info.svelte-3f7cpw{background:SkyBlue}.text.svelte-3f7cpw{margin-left:1rem}.close.svelte-3f7cpw{cursor:pointer}button.svelte-3f7cpw{color:white;background:transparent;border:0 none;padding:0;margin:0 0 0 auto;line-height:1;font-size:1rem}section.svelte-1qk4i5d{position:fixed;top:0;left:0;right:0;width:100%;display:flex;margin-top:1rem;justify-content:center;flex-direction:column;z-index:100000000}.price-container.svelte-1cy8qli.svelte-1cy8qli{display:flex;flex-direction:column;gap:6px;margin:12px 0;align-self:flex-start}.price-container.svelte-1cy8qli .high-price.svelte-1cy8qli{color:rgb(225, 12, 12)}.price-container.svelte-1cy8qli .low-price.svelte-1cy8qli{color:rgb(5, 133, 5)}.modal-overlay.svelte-ofl3r0{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background-color:rgba(0, 0, 0, 0.7)}.modal-content.svelte-ofl3r0{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:white;padding:16px;border-radius:8px}.close-button.svelte-ofl3r0{position:absolute;right:8px;top:8px;font-size:24px;color:#4a4a4a;background:none;border:none;cursor:pointer}.close-button.svelte-ofl3r0:hover{color:#1a1a1a}.content-slot.svelte-ofl3r0{margin-top:28px}.clickable.svelte-1remv7x{cursor:pointer}.clickable.svelte-1remv7x:hover{opacity:0.8}.activity-img.svelte-1remv7x{width:98%}.activity-container.svelte-wh6wcg.svelte-wh6wcg{cursor:pointer;width:100%}.activity-container.svelte-wh6wcg .activity-img.svelte-wh6wcg{width:98%}.activity-container.svelte-wh6wcg .activity-content.svelte-wh6wcg{margin-top:8px;width:100%}.activity-container.svelte-wh6wcg .activity-header.svelte-wh6wcg{display:flex;justify-content:space-between;gap:12px;align-items:center}.activity-container.svelte-wh6wcg .activity-title.svelte-wh6wcg{margin-bottom:6px;font-weight:bold}.activity-container.svelte-wh6wcg .activity-desc.svelte-wh6wcg{margin:8px 0;font-size:12px}.activity-container.svelte-wh6wcg .activity-date.svelte-wh6wcg{font-size:12px}.activity-container.svelte-hd8iy{display:flex;flex-direction:column;width:100%;align-items:center}.activity-title.svelte-hd8iy{margin-bottom:12px;text-align:center}.activity-desc.svelte-hd8iy{margin-bottom:20px;text-align:center;font-size:12px;color:#888}.activity-list.svelte-hd8iy{width:80%;margin:0 auto}.activity-item.svelte-hd8iy{margin:8px 0}.item-link.svelte-hd8iy{color:blue;cursor:pointer}.item-link.clickable.svelte-hd8iy:hover{text-decoration:underline}.copy-link.svelte-hd8iy{margin-left:-3px;cursor:pointer;color:blue}.copy-link.svelte-hd8iy:hover{text-decoration:underline}.activity-grid.svelte-tumn8m{display:grid;grid-template-columns:repeat(3, 1fr);gap:1.25rem;padding:1rem}.activity-item.svelte-tumn8m{display:flex;flex-direction:column;align-items:center;justify-content:center;border-radius:0.375rem;padding:8px;box-shadow:0px 2px 5px rgba(0, 0, 0, 0.1);cursor:pointer}.activity-item.svelte-tumn8m:hover{box-shadow:0px 4px 10px rgba(0, 0, 0, 0.2)}.activity-title.svelte-1xq8gez{cursor:pointer;color:#f56565;text-decoration:underline;font-size:14px}.modal-content.svelte-1xq8gez{display:flex;flex-direction:column;align-items:center;gap:1rem}.tab-header.svelte-1xq8gez{margin-bottom:1rem;display:flex;gap:1rem}.tab-button.svelte-1xq8gez{cursor:pointer;border-radius:0.25rem;background-color:#4f91c8;padding:0.5rem 1rem;font-size:0.875rem;font-weight:600;box-shadow:0px 2px 5px rgba(0, 0, 0, 0.2);transition:background-color 0.3s ease;color:white;border:none}.tab-button.svelte-1xq8gez:hover{background-color:#1467b4}.tab-button.selected.svelte-1xq8gez{background-color:#0b498b;color:#ffffff}.tab-content.svelte-1xq8gez{overflow:auto}.container.svelte-ykcexl.svelte-ykcexl{margin:10px 0;font-family:"Microsoft YaHei";font-size:16px}.container.svelte-ykcexl .coupon-box.svelte-ykcexl{display:inline-flex;flex-direction:column;align-items:center;background-color:#dfd5ca;box-shadow:0 0 2px 1px #dfd5ca;border-radius:10px;color:#b27e52;padding:12px 16px}.container.svelte-ykcexl .coupon-box .title.svelte-ykcexl{font-size:30px;font-weight:bold;margin-bottom:20px;line-height:1.1}.container.svelte-ykcexl .coupon-box .coupon.svelte-ykcexl{display:flex;align-items:center;justify-content:center;padding:10px 20px;background-image:linear-gradient(to right, #e8ceb6, #d19568);box-shadow:0 0 2px 1px #e8ceb6;border-radius:8px;cursor:pointer}.container.svelte-ykcexl .coupon-box .coupon .left.svelte-ykcexl{display:flex;align-items:center;font-weight:bold;word-break:normal}.container.svelte-ykcexl .coupon-box .coupon .left .symbol.svelte-ykcexl{color:#5e391d;font-size:20px;align-self:flex-end}.container.svelte-ykcexl .coupon-box .coupon .left .price.svelte-ykcexl{color:#ab6f41;font-size:50px;margin-right:4px;line-height:0.9}.container.svelte-ykcexl .coupon-box .coupon .left .unit.svelte-ykcexl{color:#785539;font-size:14px;align-self:flex-start}.container.svelte-ykcexl .coupon-box .coupon .middle.svelte-ykcexl{width:2px;height:60px;background-color:#aa896f;margin:0 10px}.container.svelte-ykcexl .coupon-box .coupon .right.svelte-ykcexl{display:flex;flex-direction:column;align-items:baseline}.container.svelte-ykcexl .coupon-box .coupon .right .desc.svelte-ykcexl{color:#372312;line-height:1;margin-bottom:6px}.container.svelte-ykcexl .coupon-box .coupon .right .time.svelte-ykcexl{line-height:1;margin-bottom:6px}.container.svelte-ykcexl .coupon-box .coupon .right .remain.svelte-ykcexl{line-height:1}.container.svelte-ykcexl .coupon-box .qrcodezk.svelte-ykcexl{margin-top:20px;display:flex;justify-content:space-between;align-items:center;font-size:16px}.container.svelte-ykcexl .coupon-box .action.svelte-ykcexl{margin-top:20px}.container.svelte-ykcexl .coupon-box .action button.svelte-ykcexl:first-child{margin-right:10px}.container.svelte-ykcexl button.svelte-ykcexl{border-radius:8px;border:0px solid transparent;padding:0.6em 1.2em;font-size:16px;font-weight:bold;font-family:inherit;background-image:linear-gradient(to right, #cf9a5d, #a26233);color:#fff;cursor:pointer;transition:border-color 0.25s}.container.svelte-ykcexl button.svelte-ykcexl:hover,.container.svelte-ykcexl button.svelte-ykcexl:focus{border-color:#a26233;box-shadow:0 0 8px rgba(0, 0, 0, 0.2)}.container.svelte-ykcexl button.svelte-ykcexl:active{box-shadow:0 0 4px rgba(0, 0, 0, 0.2);transform:scale(0.98);border-color:#8c4f26}';
waitForDOMReady().then(() => {
document.head.appendChild(__vite_style__);
});
function noop() {
}
const identity = (x) => x;
function assign(tar, src) {
for (const k in src) tar[k] = src[k];
return (
/** @type {T & S} */
tar
);
}
function run(fn) {
return fn();
}
function blank_object() {
return /* @__PURE__ */ Object.create(null);
}
function run_all(fns) {
fns.forEach(run);
}
function is_function(thing) {
return typeof thing === "function";
}
function safe_not_equal(a, b) {
return a != a ? b == b : a !== b || a && typeof a === "object" || typeof a === "function";
}
let src_url_equal_anchor;
function src_url_equal(element_src, url) {
if (element_src === url) return true;
if (!src_url_equal_anchor) {
src_url_equal_anchor = document.createElement("a");
}
src_url_equal_anchor.href = url;
return element_src === src_url_equal_anchor.href;
}
function is_empty(obj) {
return Object.keys(obj).length === 0;
}
function subscribe(store, ...callbacks) {
if (store == null) {
for (const callback of callbacks) {
callback(void 0);
}
return noop;
}
const unsub = store.subscribe(...callbacks);
return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
}
function get_store_value(store) {
let value;
subscribe(store, (_) => value = _)();
return value;
}
function component_subscribe(component, store, callback) {
component.$.on_destroy.push(subscribe(store, callback));
}
function create_slot(definition, ctx, $scope, fn) {
if (definition) {
const slot_ctx = get_slot_context(definition, ctx, $scope, fn);
return definition[0](slot_ctx);
}
}
function get_slot_context(definition, ctx, $scope, fn) {
return definition[1] && fn ? assign($scope.ctx.slice(), definition[1](fn(ctx))) : $scope.ctx;
}
function get_slot_changes(definition, $scope, dirty, fn) {
if (definition[2] && fn) {
const lets = definition[2](fn(dirty));
if ($scope.dirty === void 0) {
return lets;
}
if (typeof lets === "object") {
const merged = [];
const len = Math.max($scope.dirty.length, lets.length);
for (let i = 0; i < len; i += 1) {
merged[i] = $scope.dirty[i] | lets[i];
}
return merged;
}
return $scope.dirty | lets;
}
return $scope.dirty;
}
function update_slot_base(slot, slot_definition, ctx, $scope, slot_changes, get_slot_context_fn) {
if (slot_changes) {
const slot_context = get_slot_context(slot_definition, ctx, $scope, get_slot_context_fn);
slot.p(slot_context, slot_changes);
}
}
function get_all_dirty_from_scope($scope) {
if ($scope.ctx.length > 32) {
const dirty = [];
const length = $scope.ctx.length / 32;
for (let i = 0; i < length; i++) {
dirty[i] = -1;
}
return dirty;
}
return -1;
}
function null_to_empty(value) {
return value == null ? "" : value;
}
const is_client = typeof window !== "undefined";
let now = is_client ? () => window.performance.now() : () => Date.now();
let raf = is_client ? (cb) => requestAnimationFrame(cb) : noop;
const tasks = /* @__PURE__ */ new Set();
function run_tasks(now2) {
tasks.forEach((task) => {
if (!task.c(now2)) {
tasks.delete(task);
task.f();
}
});
if (tasks.size !== 0) raf(run_tasks);
}
function loop(callback) {
let task;
if (tasks.size === 0) raf(run_tasks);
return {
promise: new Promise((fulfill) => {
tasks.add(task = { c: callback, f: fulfill });
}),
abort() {
tasks.delete(task);
}
};
}
function append(target, node) {
target.appendChild(node);
}
function get_root_for_style(node) {
if (!node) return document;
const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
if (root && /** @type {ShadowRoot} */
root.host) {
return (
/** @type {ShadowRoot} */
root
);
}
return node.ownerDocument;
}
function append_empty_stylesheet(node) {
const style_element = element("style");
style_element.textContent = "/* empty */";
append_stylesheet(get_root_for_style(node), style_element);
return style_element.sheet;
}
function append_stylesheet(node, style) {
append(
/** @type {Document} */
node.head || node,
style
);
return style.sheet;
}
function insert(target, node, anchor) {
target.insertBefore(node, anchor || null);
}
function detach(node) {
if (node.parentNode) {
node.parentNode.removeChild(node);
}
}
function destroy_each(iterations, detaching) {
for (let i = 0; i < iterations.length; i += 1) {
if (iterations[i]) iterations[i].d(detaching);
}
}
function element(name) {
return document.createElement(name);
}
function svg_element(name) {
return document.createElementNS("http://www.w3.org/2000/svg", name);
}
function text(data) {
return document.createTextNode(data);
}
function space() {
return text(" ");
}
function empty() {
return text("");
}
function listen(node, event, handler, options) {
node.addEventListener(event, handler, options);
return () => node.removeEventListener(event, handler, options);
}
function stop_propagation(fn) {
return function(event) {
event.stopPropagation();
return fn.call(this, event);
};
}
function attr(node, attribute, value) {
if (value == null) node.removeAttribute(attribute);
else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value);
}
function children(element2) {
return Array.from(element2.childNodes);
}
function set_data(text2, data) {
data = "" + data;
if (text2.data === data) return;
text2.data = /** @type {string} */
data;
}
function set_style(node, key, value, important) {
if (value == null) {
node.style.removeProperty(key);
} else {
node.style.setProperty(key, value, "");
}
}
function toggle_class(element2, name, toggle) {
element2.classList.toggle(name, !!toggle);
}
function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {
return new CustomEvent(type, { detail, bubbles, cancelable });
}
function construct_svelte_component(component, props) {
return new component(props);
}
const managed_styles = /* @__PURE__ */ new Map();
let active = 0;
function hash(str) {
let hash2 = 5381;
let i = str.length;
while (i--) hash2 = (hash2 << 5) - hash2 ^ str.charCodeAt(i);
return hash2 >>> 0;
}
function create_style_information(doc, node) {
const info = { stylesheet: append_empty_stylesheet(node), rules: {} };
managed_styles.set(doc, info);
return info;
}
function create_rule(node, a, b, duration, delay, ease, fn, uid = 0) {
const step = 16.666 / duration;
let keyframes = "{\n";
for (let p = 0; p <= 1; p += step) {
const t = a + (b - a) * ease(p);
keyframes += p * 100 + `%{${fn(t, 1 - t)}}
`;
}
const rule = keyframes + `100% {${fn(b, 1 - b)}}
}`;
const name = `__svelte_${hash(rule)}_${uid}`;
const doc = get_root_for_style(node);
const { stylesheet, rules } = managed_styles.get(doc) || create_style_information(doc, node);
if (!rules[name]) {
rules[name] = true;
stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length);
}
const animation = node.style.animation || "";
node.style.animation = `${animation ? `${animation}, ` : ""}${name} ${duration}ms linear ${delay}ms 1 both`;
active += 1;
return name;
}
function delete_rule(node, name) {
const previous = (node.style.animation || "").split(", ");
const next = previous.filter(
name ? (anim) => anim.indexOf(name) < 0 : (anim) => anim.indexOf("__svelte") === -1
// remove all Svelte animations
);
const deleted = previous.length - next.length;
if (deleted) {
node.style.animation = next.join(", ");
active -= deleted;
if (!active) clear_rules();
}
}
function clear_rules() {
raf(() => {
if (active) return;
managed_styles.forEach((info) => {
const { ownerNode } = info.stylesheet;
if (ownerNode) detach(ownerNode);
});
managed_styles.clear();
});
}
let current_component;
function set_current_component(component) {
current_component = component;
}
function get_current_component() {
if (!current_component) throw new Error("Function called outside component initialization");
return current_component;
}
function onMount(fn) {
get_current_component().$.on_mount.push(fn);
}
function createEventDispatcher() {
const component = get_current_component();
return (type, detail, { cancelable = false } = {}) => {
const callbacks = component.$.callbacks[type];
if (callbacks) {
const event = custom_event(
/** @type {string} */
type,
detail,
{ cancelable }
);
callbacks.slice().forEach((fn) => {
fn.call(component, event);
});
return !event.defaultPrevented;
}
return true;
};
}
function bubble(component, event) {
const callbacks = component.$.callbacks[event.type];
if (callbacks) {
callbacks.slice().forEach((fn) => fn.call(this, event));
}
}
const dirty_components = [];
const binding_callbacks = [];
let render_callbacks = [];
const flush_callbacks = [];
const resolved_promise = /* @__PURE__ */ Promise.resolve();
let update_scheduled = false;
function schedule_update() {
if (!update_scheduled) {
update_scheduled = true;
resolved_promise.then(flush);
}
}
function add_render_callback(fn) {
render_callbacks.push(fn);
}
const seen_callbacks = /* @__PURE__ */ new Set();
let flushidx = 0;
function flush() {
if (flushidx !== 0) {
return;
}
const saved_component = current_component;
do {
try {
while (flushidx < dirty_components.length) {
const component = dirty_components[flushidx];
flushidx++;
set_current_component(component);
update(component.$);
}
} catch (e) {
dirty_components.length = 0;
flushidx = 0;
throw e;
}
set_current_component(null);
dirty_components.length = 0;
flushidx = 0;
while (binding_callbacks.length) binding_callbacks.pop()();
for (let i = 0; i < render_callbacks.length; i += 1) {
const callback = render_callbacks[i];
if (!seen_callbacks.has(callback)) {
seen_callbacks.add(callback);
callback();
}
}
render_callbacks.length = 0;
} while (dirty_components.length);
while (flush_callbacks.length) {
flush_callbacks.pop()();
}
update_scheduled = false;
seen_callbacks.clear();
set_current_component(saved_component);
}
function update($) {
if ($.fragment !== null) {
$.update();
run_all($.before_update);
const dirty = $.dirty;
$.dirty = [-1];
$.fragment && $.fragment.p($.ctx, dirty);
$.after_update.forEach(add_render_callback);
}
}
function flush_render_callbacks(fns) {
const filtered = [];
const targets = [];
render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c));
targets.forEach((c) => c());
render_callbacks = filtered;
}
let promise;
function wait$1() {
if (!promise) {
promise = Promise.resolve();
promise.then(() => {
promise = null;
});
}
return promise;
}
function dispatch(node, direction, kind) {
node.dispatchEvent(custom_event(`${direction ? "intro" : "outro"}${kind}`));
}
const outroing = /* @__PURE__ */ new Set();
let outros;
function group_outros() {
outros = {
r: 0,
c: [],
p: outros
// parent group
};
}
function check_outros() {
if (!outros.r) {
run_all(outros.c);
}
outros = outros.p;
}
function transition_in(block, local) {
if (block && block.i) {
outroing.delete(block);
block.i(local);
}
}
function transition_out(block, local, detach2, callback) {
if (block && block.o) {
if (outroing.has(block)) return;
outroing.add(block);
outros.c.push(() => {
outroing.delete(block);
if (callback) {
if (detach2) block.d(1);
callback();
}
});
block.o(local);
} else if (callback) {
callback();
}
}
const null_transition = { duration: 0 };
function create_bidirectional_transition(node, fn, params, intro) {
const options = { direction: "both" };
let config = fn(node, params, options);
let t = intro ? 0 : 1;
let running_program = null;
let pending_program = null;
let animation_name = null;
let original_inert_value;
function clear_animation() {
if (animation_name) delete_rule(node, animation_name);
}
function init2(program, duration) {
const d = (
/** @type {Program['d']} */
program.b - t
);
duration *= Math.abs(d);
return {
a: t,
b: program.b,
d,
duration,
start: program.start,
end: program.start + duration,
group: program.group
};
}
function go(b) {
const {
delay = 0,
duration = 300,
easing = identity,
tick = noop,
css
} = config || null_transition;
const program = {
start: now() + delay,
b
};
if (!b) {
program.group = outros;
outros.r += 1;
}
if ("inert" in node) {
if (b) {
if (original_inert_value !== void 0) {
node.inert = original_inert_value;
}
} else {
original_inert_value = /** @type {HTMLElement} */
node.inert;
node.inert = true;
}
}
if (running_program || pending_program) {
pending_program = program;
} else {
if (css) {
clear_animation();
animation_name = create_rule(node, t, b, duration, delay, easing, css);
}
if (b) tick(0, 1);
running_program = init2(program, duration);
add_render_callback(() => dispatch(node, b, "start"));
loop((now2) => {
if (pending_program && now2 > pending_program.start) {
running_program = init2(pending_program, duration);
pending_program = null;
dispatch(node, running_program.b, "start");
if (css) {
clear_animation();
animation_name = create_rule(
node,
t,
running_program.b,
running_program.duration,
0,
easing,
config.css
);
}
}
if (running_program) {
if (now2 >= running_program.end) {
tick(t = running_program.b, 1 - t);
dispatch(node, running_program.b, "end");
if (!pending_program) {
if (running_program.b) {
clear_animation();
} else {
if (!--running_program.group.r) run_all(running_program.group.c);
}
}
running_program = null;
} else if (now2 >= running_program.start) {
const p = now2 - running_program.start;
t = running_program.a + running_program.d * easing(p / running_program.duration);
tick(t, 1 - t);
}
}
return !!(running_program || pending_program);
});
}
}
return {
run(b) {
if (is_function(config)) {
wait$1().then(() => {
const opts = { direction: b ? "in" : "out" };
config = config(opts);
go(b);
});
} else {
go(b);
}
},
end() {
clear_animation();
running_program = pending_program = null;
}
};
}
function ensure_array_like(array_like_or_iterator) {
return (array_like_or_iterator == null ? void 0 : array_like_or_iterator.length) !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
}
function outro_and_destroy_block(block, lookup) {
transition_out(block, 1, 1, () => {
lookup.delete(block.key);
});
}
function update_keyed_each(old_blocks, dirty, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block2, next, get_context) {
let o = old_blocks.length;
let n = list.length;
let i = o;
const old_indexes = {};
while (i--) old_indexes[old_blocks[i].key] = i;
const new_blocks = [];
const new_lookup = /* @__PURE__ */ new Map();
const deltas = /* @__PURE__ */ new Map();
const updates = [];
i = n;
while (i--) {
const child_ctx = get_context(ctx, list, i);
const key = get_key(child_ctx);
let block = lookup.get(key);
if (!block) {
block = create_each_block2(key, child_ctx);
block.c();
} else {
updates.push(() => block.p(child_ctx, dirty));
}
new_lookup.set(key, new_blocks[i] = block);
if (key in old_indexes) deltas.set(key, Math.abs(i - old_indexes[key]));
}
const will_move = /* @__PURE__ */ new Set();
const did_move = /* @__PURE__ */ new Set();
function insert2(block) {
transition_in(block, 1);
block.m(node, next);
lookup.set(block.key, block);
next = block.first;
n--;
}
while (o && n) {
const new_block = new_blocks[n - 1];
const old_block = old_blocks[o - 1];
const new_key = new_block.key;
const old_key = old_block.key;
if (new_block === old_block) {
next = new_block.first;
o--;
n--;
} else if (!new_lookup.has(old_key)) {
destroy(old_block, lookup);
o--;
} else if (!lookup.has(new_key) || will_move.has(new_key)) {
insert2(new_block);
} else if (did_move.has(old_key)) {
o--;
} else if (deltas.get(new_key) > deltas.get(old_key)) {
did_move.add(new_key);
insert2(new_block);
} else {
will_move.add(old_key);
o--;
}
}
while (o--) {
const old_block = old_blocks[o];
if (!new_lookup.has(old_block.key)) destroy(old_block, lookup);
}
while (n) insert2(new_blocks[n - 1]);
run_all(updates);
return new_blocks;
}
function create_component(block) {
block && block.c();
}
function mount_component(component, target, anchor) {
const { fragment, after_update } = component.$;
fragment && fragment.m(target, anchor);
add_render_callback(() => {
const new_on_destroy = component.$.on_mount.map(run).filter(is_function);
if (component.$.on_destroy) {
component.$.on_destroy.push(...new_on_destroy);
} else {
run_all(new_on_destroy);
}
component.$.on_mount = [];
});
after_update.forEach(add_render_callback);
}
function destroy_component(component, detaching) {
const $ = component.$;
if ($.fragment !== null) {
flush_render_callbacks($.after_update);
run_all($.on_destroy);
$.fragment && $.fragment.d(detaching);
$.on_destroy = $.fragment = null;
$.ctx = [];
}
}
function make_dirty(component, i) {
if (component.$.dirty[0] === -1) {
dirty_components.push(component);
schedule_update();
component.$.dirty.fill(0);
}
component.$.dirty[i / 31 | 0] |= 1 << i % 31;
}
function init(component, options, instance2, create_fragment2, not_equal, props, append_styles = null, dirty = [-1]) {
const parent_component = current_component;
set_current_component(component);
const $ = component.$ = {
fragment: null,
ctx: [],
// state
props,
update: noop,
not_equal,
bound: blank_object(),
// lifecycle
on_mount: [],
on_destroy: [],
on_disconnect: [],
before_update: [],
after_update: [],
context: new Map(options.context || (parent_component ? parent_component.$.context : [])),
// everything else
callbacks: blank_object(),
dirty,
skip_bound: false,
root: options.target || parent_component.$.root
};
append_styles && append_styles($.root);
let ready = false;
$.ctx = instance2 ? instance2(component, options.props || {}, (i, ret, ...rest) => {
const value = rest.length ? rest[0] : ret;
if ($.ctx && not_equal($.ctx[i], $.ctx[i] = value)) {
if (!$.skip_bound && $.bound[i]) $.bound[i](value);
if (ready) make_dirty(component, i);
}
return ret;
}) : [];
$.update();
ready = true;
run_all($.before_update);
$.fragment = create_fragment2 ? create_fragment2($.ctx) : false;
if (options.target) {
if (options.hydrate) {
const nodes = children(options.target);
$.fragment && $.fragment.l(nodes);
nodes.forEach(detach);
} else {
$.fragment && $.fragment.c();
}
if (options.intro) transition_in(component.$.fragment);
mount_component(component, options.target, options.anchor);
flush();
}
set_current_component(parent_component);
}
class SvelteComponent {
constructor() {
/**
* ### PRIVATE API
*
* Do not use, may change at any time
*
* @type {any}
*/
__publicField(this, "$");
/**
* ### PRIVATE API
*
* Do not use, may change at any time
*
* @type {any}
*/
__publicField(this, "$set");
}
/** @returns {void} */
$destroy() {
destroy_component(this, 1);
this.$destroy = noop;
}
/**
* @template {Extract<keyof Events, string>} K
* @param {K} type
* @param {((e: Events[K]) => void) | null | undefined} callback
* @returns {() => void}
*/
$on(type, callback) {
if (!is_function(callback)) {
return noop;
}
const callbacks = this.$.callbacks[type] || (this.$.callbacks[type] = []);
callbacks.push(callback);
return () => {
const index = callbacks.indexOf(callback);
if (index !== -1) callbacks.splice(index, 1);
};
}
/**
* @param {Partial<Props>} props
* @returns {void}
*/
$set(props) {
if (this.$set && !is_empty(props)) {
this.$.skip_bound = true;
this.$set(props);
this.$.skip_bound = false;
}
}
}
const PUBLIC_VERSION = "4";
if (typeof window !== "undefined")
(window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(PUBLIC_VERSION);
const subscriber_queue = [];
function writable(value, start = noop) {
let stop;
const subscribers = /* @__PURE__ */ new Set();
function set(new_value) {
if (safe_not_equal(value, new_value)) {
value = new_value;
if (stop) {
const run_queue = !subscriber_queue.length;
for (const subscriber of subscribers) {
subscriber[1]();
subscriber_queue.push(subscriber, value);
}
if (run_queue) {
for (let i = 0; i < subscriber_queue.length; i += 2) {
subscriber_queue[i][0](subscriber_queue[i + 1]);
}
subscriber_queue.length = 0;
}
}
}
}
function update2(fn) {
set(fn(value));
}
function subscribe2(run2, invalidate = noop) {
const subscriber = [run2, invalidate];
subscribers.add(subscriber);
if (subscribers.size === 1) {
stop = start(set, update2) || noop;
}
run2(value);
return () => {
subscribers.delete(subscriber);
if (subscribers.size === 0 && stop) {
stop();
stop = null;
}
};
}
return { set, update: update2, subscribe: subscribe2 };
}
function createCoupon() {
const { subscribe: subscribe2, set, update: update2 } = writable(null);
return {
subscribe: subscribe2,
updateCoupon: (data) => update2(() => data)
};
}
const coupon = createCoupon();
var UrlType = /* @__PURE__ */ ((UrlType2) => {
UrlType2["Tmall"] = "tmall";
UrlType2["YYTmall"] = "liangxinyao";
UrlType2["Taobao"] = "taobao";
UrlType2["JD"] = "jd";
UrlType2["Vip"] = "vip";
UrlType2["ZK"] = "jasonzk";
UrlType2["DEV"] = "localhost";
return UrlType2;
})(UrlType || {});
var Platform = /* @__PURE__ */ ((Platform2) => {
Platform2[Platform2["Taobao"] = 1] = "Taobao";
Platform2[Platform2["JD"] = 2] = "JD";
Platform2[Platform2["Pdd"] = 3] = "Pdd";
Platform2[Platform2["Vip"] = 4] = "Vip";
Platform2[Platform2["None"] = 5] = "None";
Platform2[Platform2["Dev"] = 6] = "Dev";
Platform2[Platform2["ZK"] = 7] = "ZK";
return Platform2;
})(Platform || {});
var PluginType = /* @__PURE__ */ ((PluginType2) => {
PluginType2["Coupon"] = "1";
PluginType2["Compare"] = "2";
PluginType2["Promotion"] = "3";
PluginType2["No_Promotion"] = "4";
PluginType2["Tool"] = "5";
return PluginType2;
})(PluginType || {});
const PluginName = "1";
var GM_KEY = /* @__PURE__ */ ((GM_KEY2) => {
GM_KEY2["JD_HAS_COUPON_URL"] = "73haz73_jd_coupon_url";
GM_KEY2["JD_USER_NAME"] = "jd_user_name";
GM_KEY2["JD_GOODS_LIST"] = "jd_goods_list";
GM_KEY2["JD_GOODS_LIST2"] = "jd_goods_list2";
GM_KEY2["JD_GOODS_LIST3"] = "jd_goods_list3";
GM_KEY2["Tmall_USER_NAME"] = "tmall_user_name";
GM_KEY2["Tmall_GOODS_LIST"] = "tmall_goods_list";
GM_KEY2["VIP_USER_NAME"] = "vip_user_name";
GM_KEY2["VIP_GOODS_LIST"] = "vip_goods_list";
GM_KEY2["UUID"] = "jae2u5xruuid";
GM_KEY2["VERSION_CHECK_TIME"] = "version_check_time";
GM_KEY2["VERSION_UPDATE_TIME"] = "version_update_time";
GM_KEY2["VERSION_IS_FORCE"] = "version_force_update";
return GM_KEY2;
})(GM_KEY || {});
var COOKIE_KEY = /* @__PURE__ */ ((COOKIE_KEY2) => {
COOKIE_KEY2["JD_USER_NAME"] = "unick";
COOKIE_KEY2["Tmall_USER_NAME"] = "tracknick";
COOKIE_KEY2["VIP_USER_NAME"] = "VipRNAME";
return COOKIE_KEY2;
})(COOKIE_KEY || {});
var ActivityType = /* @__PURE__ */ ((ActivityType2) => {
ActivityType2["TEXT"] = "text";
ActivityType2["IMG"] = "img";
ActivityType2["IMAGETEXT"] = "imgtext";
return ActivityType2;
})(ActivityType || {});
const HOST = {
JD: {
HOME: "www.jd.com",
GLOBAL: "global.jd.com",
HK_HOME: "www.jd.hk",
YIYAO_HOME: "www.yiyaojd.com",
BOOK_HOME: "book.jd.com",
E_BOOK_HOME: "e.jd.com",
MRO_HOME: "mro.jd.com",
// 五金
IC_HOME: "ic.jd.com",
// 元器件
H5_HOME: "m.jd.com",
// 手机端
SEARCH: "search.jd.com",
LIST: "list.jd.com",
// https://list.jd.com/list.html?cat=6728,12402
DETAIL: "https://item.jd.com",
IC_DETAIL: "https://ic-item.jd.com",
I_DETAIL: "https://i-item.jd.com",
YIYAO_DETAIL: "https://item.yiyaojd.com",
GLOBAL_DETAIL: "https://npcitem.jd.hk",
HEALTH_DETAIL: "https://item.jkcsjd.com",
E_BOOK_DETAIL: "https://e.jd.com",
H5_DETAIL: "https://item.m.jd.com/product"
},
TMALL: {
HOME: "www.tmall.com",
TB_HOME: "www.taobao.com",
DETAIL: "detail.tmall.com/item",
TB_DETAIL: "item.taobao.com/item",
CHAOSHI_DETAIL: "chaoshi.detail.tmall.com/item",
GLOBAL_DETAIL: "detail.tmall.hk/item",
GLOBAL_HK_DETAIL: "detail.tmall.hk/hk/item"
},
VIP: {
DETAIL: "detail.vip.com/detail",
GLOABL_DETAIL: "www.vipglobal.hk/detail",
H5_DETAIL: "m.vip.com/product"
}
};
function createPlatform() {
const { subscribe: subscribe2, set, update: update2 } = writable(null);
return {
subscribe: subscribe2,
updatePlatform: (data) => update2(() => data)
};
}
const platform = createPlatform();
function getPlatform() {
return get_store_value(platform);
}
const toasts = writable([]);
const addToast = (toast) => {
const id = Math.floor(Math.random() * 1e4);
const defaults = {
id,
type: "info",
dismissible: true,
timeout: 3e3
};
toasts.update((all) => [{ ...defaults, ...toast }, ...all]);
if (toast.timeout) setTimeout(() => dismissToast(id), toast.timeout);
};
const dismissToast = (id) => {
toasts.update((all) => all.filter((t) => t.id !== id));
};
const isAsyncAPIAvailable = (fn) => typeof GM !== "undefined" && typeof GM[fn] === "function";
const isSyncAPIAvailable = (fn) => typeof window[fn] === "function";
async function getGMValue(key, initialValue) {
if (isAsyncAPIAvailable("getValue")) {
return await GM.getValue(key, initialValue);
} else if (isSyncAPIAvailable("GM_getValue")) {
return GM_getValue(key, initialValue);
} else {
console.warn("GM_getValue or GM.getValue is not available.");
return initialValue;
}
}
async function setGMValue(key, value) {
if (isAsyncAPIAvailable("setValue")) {
await GM.setValue(key, value);
} else if (isSyncAPIAvailable("GM_setValue")) {
GM_setValue(key, value);
} else {
console.warn("GM_setValue or GM.setValue is not available.");
}
}
async function deleteGMValue(key) {
if (isAsyncAPIAvailable("deleteValue")) {
await GM.deleteValue(key);
} else if (isSyncAPIAvailable("GM_deleteValue")) {
GM_deleteValue(key);
} else {
console.warn("GM_deleteValue or GM.deleteValue is not available.");
}
}
async function openNewTab(url, active2 = true) {
if (isSyncAPIAvailable("GM_openInTab")) {
GM_openInTab(url, { active: active2 });
} else {
const a = document.createElement("a");
a.href = url;
a.target = "_blank";
a.rel = "noreferrer";
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}
}
async function setClipboard(text2, callback) {
if (isAsyncAPIAvailable("setClipboard")) {
await GM.setClipboard(text2, "text");
callback == null ? void 0 : callback();
} else if (isSyncAPIAvailable("GM_setClipboard")) {
GM_setClipboard(text2, "text", callback);
} else {
console.warn("GM_setClipboard or GM.setClipboard is not available.");
}
}
async function openWindow(url) {
await openNewTab(url);
}
async function copy(text2, callback) {
const flag = !!window.GM_setClipboard;
if (flag) {
await setClipboard(text2, callback);
} else {
navigator.clipboard.writeText(text2).then(callback).catch((error) => {
console.error("Failed to copy text:", error);
});
}
}
const words = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"-",
","
];
function shuffleWords() {
return words.sort(() => Math.random() - 0.5);
}
function getToken() {
const words2 = shuffleWords();
const index0 = getIndex(words2, "all", true);
const index1 = getIndex(words2, "iance", true);
const random = Math.floor(Math.random() * 2);
const splits = [getIndex(words2, ","), getIndex(words2, "-")];
const now2 = Date.now();
const split = random == 0 ? "," : "-";
const data = [
split,
index0,
splits[random] + split,
index1,
splits[random] + split,
now2
];
const key = "jason";
const token = CryptoJS$1.AES.encrypt(data.join(""), key).toString();
const keyMap = getKeyMap(words2, now2, split, key);
return {
token,
keyMap
};
}
function getKeyMap(words2, now2, split, key) {
const data = [split, words2, now2];
const keyMap = CryptoJS$1.AES.encrypt(JSON.stringify(data), key).toString();
return keyMap;
}
function getIndex(words2, keyword, needSplit = false) {
const index = [];
for (let i = 0; i < keyword.length; i++) {
index.push(words2.indexOf(keyword[i]).toString());
if (needSplit) {
index.push("@");
}
}
return index.join("");
}
function getCkValue(key) {
const cookies = document.cookie.split("; ");
for (let cookie of cookies) {
const [k, v] = cookie.split("=");
if (k === key) return decodeURIComponent(v);
}
return null;
}
function getEncryptUUID(platform2) {
switch (platform2) {
case Platform.JD:
return getJDUUID();
}
}
function getJDUUID() {
const nick = getCkValue(COOKIE_KEY.JD_USER_NAME);
const c = encrypt(`${nick}`);
return c;
}
function generateUUID() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (char) => {
const random = Math.random() * 16 | 0;
const value = char === "x" ? random : random & 3 | 8;
return value.toString(16);
});
}
async function initUUID() {
const uuid = await getUUID();
if (!uuid) {
const id = generateUUID();
await setGMValue(GM_KEY.UUID, id);
localStorage.setItem(GM_KEY.UUID, id);
}
}
async function getUUID() {
const u1 = await getGMValue(GM_KEY.UUID);
const u2 = localStorage.getItem(GM_KEY.UUID);
if (!u1 && u2) {
await setGMValue(GM_KEY.UUID, u2);
}
if (u1 && (!u2 || u1 != u2)) {
localStorage.setItem(GM_KEY.UUID, u1);
}
return u1 ?? u2;
}
function getScriptEnv() {
let scriptManager = "Unknown";
if (typeof GM_info !== "undefined" && GM_info.scriptHandler) {
scriptManager = GM_info.scriptHandler;
} else if (typeof GM !== "undefined" && GM.info && GM.info.scriptHandler) {
scriptManager = GM.info.scriptHandler;
}
return scriptManager;
}
function getScriptVersion() {
if (typeof GM_info !== "undefined" && GM_info.script.version) {
return GM_info.script.version;
} else if (typeof GM !== "undefined" && GM.info && GM.info.script.version) {
return GM.info.script.version;
}
return "Unknown";
}
async function fetchWithOptionalTimeout(url, options = {}, timeout) {
if (!timeout) {
return fetch(url, options);
}
const controller = new AbortController();
const signal = controller.signal;
const timeoutId = setTimeout(() => controller.abort(), timeout);
try {
const res = await fetch(url, { ...options, signal });
clearTimeout(timeoutId);
return res;
} catch (error) {
clearTimeout(timeoutId);
if (error.name === "AbortError") {
throw new Error("Fetch request timed out");
}
throw error;
}
}
async function get(url, data, timeout) {
const params = new URLSearchParams(data ?? {});
url = url + "?" + params.toString();
const { token, keyMap } = getToken();
const plgid = await getUUID() ?? "";
const pf = getPlatform();
const headers = {
authorization: token,
authhash: keyMap,
plgn: PluginName,
plgv: getScriptVersion(),
plgEnv: getScriptEnv(),
plgzid: getEncryptUUID(pf) ?? "",
plgid: plgid ?? ""
};
const res = await fetchWithOptionalTimeout(url, { headers }, timeout);
const json = await res.json();
return json;
}
async function post(url, data, timeout) {
const { token, keyMap } = getToken();
const plgid = await getUUID() ?? "";
const pf = getPlatform();
const headers = {
authorization: token,
authhash: keyMap,
plgn: PluginName,
plgv: getScriptVersion(),
plgEnv: getScriptEnv(),
plgzid: getEncryptUUID(pf) ?? "",
plgid: plgid ?? "",
"Content-Type": "application/json"
};
const res = await fetchWithOptionalTimeout(
url,
{
method: "POST",
headers,
body: JSON.stringify(data)
},
timeout
);
const json = await res.json();
return json;
}
const baseUrl = "https://api2.jasonzk.com";
const transformLink = "transform/link";
const lvt = "vw/lvt";
const getTaobaoCouponUrl = `${baseUrl}/taobao/coupon`;
const getJdCouponUrl = `${baseUrl}/jd/coupon`;
const getVipCouponUrl = `${baseUrl}/vip/couponV2`;
const getHisPrice = `${baseUrl}/tools/goods-his`;
const getTransformLink$1 = `${baseUrl}/${transformLink}`;
const getActivitySets = `${baseUrl}/activity/sets2`;
const vwC = `${baseUrl}/vw/c`;
const vwB = `${baseUrl}/vw/b`;
const vwLvt = `${baseUrl}/${lvt}`;
const checkVersion = `${baseUrl}/version/check`;
const API = {
getTaobaoCouponUrl,
getJdCouponUrl,
getVipCouponUrl,
getTransformLink: getTransformLink$1,
getHisPrice,
getActivitySets,
vwC,
vwB,
vwLvt,
checkVersion
};
function getOriginalUrl(platform2) {
switch (platform2) {
case Platform.JD:
return location.origin + location.pathname;
case Platform.Taobao:
return location.href;
case Platform.Vip:
return location.origin + location.pathname;
}
return location.href;
}
function getPrice(couponInfo) {
let price = couponInfo.split("减")[1];
price = price.split("元")[0];
return price;
}
function getScanText(platform2) {
switch (platform2) {
case Platform.Taobao:
return "使用天猫/淘宝APP扫码";
case Platform.JD:
return "使用微信扫码";
case Platform.Vip:
return "使用微信扫码";
default:
return "";
}
}
function getToastMsg(platform2) {
switch (platform2) {
case Platform.Taobao:
return "拷贝成功,可粘贴到微信后,手机复制到淘宝/天猫APP打开~";
case Platform.JD:
return "拷贝成功,可粘贴到微信后,手机复制到京东APP打开~";
case Platform.Vip:
return "拷贝成功,可粘贴到微信后,手机复制到唯品会APP打开~";
default:
return "";
}
}
function getCopyText(coupon2) {
if (coupon2.couponInfo != null && coupon2.couponInfo != "") {
let s = `发现了一件好物,快来看看吧~~${coupon2 == null ? void 0 : coupon2.couponInfo}`;
if (coupon2.longTpwd != null && coupon2.longTpwd != "") {
s += `,${coupon2 == null ? void 0 : coupon2.longTpwd}`;
} else if (coupon2.shortUrl != null && coupon2.shortUrl != "") {
s += `,${coupon2 == null ? void 0 : coupon2.shortUrl}`;
}
return s;
} else if (coupon2.shortUrl != null && coupon2.shortUrl != "") {
return `发现了一件好物,快来看看吧~~${coupon2 == null ? void 0 : coupon2.shortUrl}`;
}
return "";
}
function isMobile() {
return /Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
}
function getPlatformName(platform2) {
switch (platform2) {
case Platform.Taobao:
return "淘宝";
case Platform.JD:
return "京东";
case Platform.Vip:
return "唯品会";
default:
return "";
}
}
function encrypt(content) {
return CryptoJS.AES.encrypt(content, "ck").toString();
}
function getPlatformLogo(platform2) {
switch (platform2) {
case Platform.Taobao:
return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAABE0lEQVRIS2P8r6XF9uLGjcp/DAwxjAwMCv8ZGFgYqAgYGRj+/GdgeMDEwLBEQkOjnfEpC0sDw79/9VS0A6dRTAwMDYxPmZhuMzAwqNDDQgYGhjuMz5iYflM7GHE5HhS8IB/+p5PvwNYMDgsFly5lYLWwwOpxJhERBkZ2drDc/58/Gf69eYNV3e8TJxjeR0djyGH1ofDevQzsDg4UhfTPAwcY3jo7D1ILecrKGFjU1bH6kN3dnYFZUhIs9/f5c4afO3diVffn5k2GL11dxPkQX1giBzeuYMOnn+RUOmohoaQ9GqQYITSaaEYTzWi2wEgDyDUJrhoBb+E9EI0o+jYTnzMx1f9jYGgglH+oIQ9uCNO7qQ8Aj+XKFcR3kJwAAAAASUVORK5CYII=";
case Platform.JD:
return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAAAnCAYAAABHeLXLAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAS6ADAAQA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0VAUGAigIqbLhmqyMMK1y3ifIEhWShQ0exZDCRGNz+L5q/box1A0ToylwHh8HKqgHdna8xuvDeKA/AJLVyN2Qg1abs9V+XGdhkC5RGkOKwv70PvTEXFJdXxiAuLMFku5w0cg9bgIS1ZBaQTyGjnjL6IdAox5pDd9Oz5O27yTvex1/8BBs0yMEQKlYRIUawlQuabMEWvn31XUjnAB2irbGgHkT9XbQ4AhxSi7UJ1T0giz21lmPNVGzb3W0Sl3vWJonp8EEpvA1g9QEuBgYT9b3M1ZuCEEel2pGQS7QGu8EuTysPXTWLNVuSuIfMsH/5PQQnYpePSTzKjKX0zABWEWodG+WLDQ27x2i2GDb7JcYo/09XdwlHAAAAAElFTkSuQmCC";
}
return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAABE0lEQVRIS2P8r6XF9uLGjcp/DAwxjAwMCv8ZGFgYqAgYGRj+/GdgeMDEwLBEQkOjnfEpC0sDw79/9VS0A6dRTAwMDYxPmZhuMzAwqNDDQgYGhjuMz5iYflM7GHE5HhS8IB/+p5PvwNYMDgsFly5lYLWwwOpxJhERBkZ2drDc/58/Gf69eYNV3e8TJxjeR0djyGH1ofDevQzsDg4UhfTPAwcY3jo7D1ILecrKGFjU1bH6kN3dnYFZUhIs9/f5c4afO3diVffn5k2GL11dxPkQX1giBzeuYMOnn+RUOmohoaQ9GqQYITSaaEYTzWi2wEgDyDUJrhoBb+E9EI0o+jYTnzMx1f9jYGgglH+oIQ9uCNO7qQ8Aj+XKFcR3kJwAAAAASUVORK5CYII=";
}
function getLogoWidth(platform2, rate = 1) {
switch (platform2) {
case Platform.Taobao:
return 15 * rate;
case Platform.JD:
return 20 * rate;
case Platform.Vip:
return 15 * rate;
case Platform.Pdd:
return 30 * rate;
default:
return 20 * rate;
}
}
function checkIsOpenedActivity(activity, platform2) {
const { key, jdLink, tbLink } = activity;
const keyValue = localStorage.getItem(key);
if (!keyValue) {
localStorage.setItem(key, key);
switch (platform2) {
case Platform.JD:
if (jdLink && jdLink != "") {
openWindow(jdLink);
}
return;
case Platform.Taobao:
if (tbLink && tbLink != "") {
openWindow(tbLink);
}
return;
}
}
}
function clearLocalStorage(key) {
localStorage.removeItem(key);
}
function clearSessionStorage(key) {
sessionStorage.removeItem(key);
}
function savePlugin() {
const key = "tampermonkey_plugin_je82j46";
function updateTimestamp() {
const plugins = JSON.parse(sessionStorage.getItem(key)) ?? [];
const currentTime = Date.now();
const updatedPlugins = plugins.filter(
(plugin) => plugin.name !== PluginName
);
updatedPlugins.push({ name: PluginName, timestamp: currentTime });
sessionStorage.setItem(key, JSON.stringify(updatedPlugins));
setTimeout(updateTimestamp, 3e3);
}
updateTimestamp();
}
function existPlugin(pluginName, timeout = 3e3) {
const key = "tampermonkey_plugin_je82j46";
const plugins = JSON.parse(sessionStorage.getItem(key)) ?? [];
const plugin = plugins.find(
(plugin2) => plugin2.name === pluginName
);
if (!plugin) return false;
return Date.now() - plugin.timestamp <= timeout;
}
function canExec() {
const currentPlugin = PluginName;
switch (currentPlugin) {
case PluginType.Compare:
return true;
case PluginType.Tool:
return !existPlugin(PluginType.Compare);
case PluginType.Coupon:
return !existPlugin(PluginType.Compare) && !existPlugin(PluginType.Tool);
case PluginType.Promotion:
return !existPlugin(PluginType.Compare) && !existPlugin(PluginType.Coupon) && !existPlugin(PluginType.Tool);
}
return true;
}
function isProduction() {
return true;
}
async function fetchTransformLink(params) {
const {
platform: platform2,
url = getOriginalUrl(platform2),
dl = true,
timeout
} = params;
const json = await get(
API.getTransformLink,
{
platform: platform2,
url,
pt: PluginName,
dl: dl ? 1 : 0
},
timeout
);
return json;
}
async function getTitle(p) {
const pat = p ?? ensurePlatform();
let title = "";
switch (pat) {
case Platform.Taobao:
title = await getTbTitle();
break;
case Platform.JD:
title = await getJdTitle();
break;
case Platform.Vip:
title = await getVipTitle();
break;
}
return {
platform: pat,
title
};
}
function getTbTitle() {
return new Promise((resolve) => {
var _a;
const title = (_a = document.querySelector("h1")) == null ? void 0 : _a.textContent;
if (title) {
resolve(title);
} else {
const observer = new MutationObserver(() => {
var _a2;
const title2 = (_a2 = document.querySelector("h1")) == null ? void 0 : _a2.textContent;
if (title2) {
observer.disconnect();
resolve(title2);
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
}
});
}
async function getJdTitle() {
return new Promise(async (resolve) => {
var _a;
const title = (_a = document.querySelector(".sku-name")) == null ? void 0 : _a.textContent;
if (title) {
const rt = title.replace(/\s+/g, "");
resolve(rt);
} else {
const observer = new MutationObserver(() => {
var _a2;
const title2 = (_a2 = document.querySelector(".sku-name")) == null ? void 0 : _a2.textContent;
if (title2) {
observer.disconnect();
const rt = title2.replace(/\s+/g, "");
resolve(rt);
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
}
});
}
async function getVipTitle() {
const isH5 = isMobile();
const className = isH5 ? ".name_title_ll" : ".pib-title-detail";
return new Promise((resolve) => {
var _a;
const title = (_a = document.querySelector(className)) == null ? void 0 : _a.textContent;
if (title && title != "商家店铺") {
resolve(title.replace("商家店铺", ""));
} else {
const observer = new MutationObserver(() => {
var _a2;
const title2 = (_a2 = document.querySelector(className)) == null ? void 0 : _a2.textContent;
if (title2 && title2 != "商家店铺") {
observer.disconnect();
resolve(title2.replace("商家店铺", ""));
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
}
});
}
function ensurePlatform() {
const url = window.location.host;
let p = Platform.None;
if (url.indexOf(UrlType.Taobao) != -1 || url.indexOf(UrlType.Tmall) != -1 || url.indexOf(UrlType.YYTmall) != -1) {
platform.updatePlatform(Platform.Taobao);
p = Platform.Taobao;
} else if (url.indexOf(UrlType.JD) != -1) {
platform.updatePlatform(Platform.JD);
p = Platform.JD;
} else if (url.indexOf(UrlType.Vip) != -1) {
platform.updatePlatform(Platform.Vip);
p = Platform.Vip;
} else if (url.indexOf(UrlType.DEV) != -1) {
platform.updatePlatform(Platform.Dev);
p = Platform.Dev;
} else if (url.indexOf(UrlType.ZK) != -1) {
platform.updatePlatform(Platform.ZK);
p = Platform.ZK;
} else {
platform.updatePlatform(Platform.None);
}
return p;
}
async function wait(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
async function waitForTs(timestamp, timeout = 1050) {
const now2 = Date.now();
if (now2 - timestamp < timeout) {
await wait(timeout - (now2 - timestamp));
}
}
function fade(node, { delay = 0, duration = 400, easing = identity } = {}) {
const o = +getComputedStyle(node).opacity;
return {
delay,
duration,
easing,
css: (t) => `opacity: ${t * o}`
};
}
function create_fragment$g(ctx) {
let svg;
let path;
return {
c() {
svg = svg_element("svg");
path = svg_element("path");
attr(path, "fill", "currentColor");
attr(path, "d", "M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 464c-118.664 0-216-96.055-216-216 0-118.663 96.055-216 216-216 118.664 0 216 96.055 216 216 0 118.663-96.055 216-216 216zm141.63-274.961L217.15 376.071c-4.705 4.667-12.303 4.637-16.97-.068l-85.878-86.572c-4.667-4.705-4.637-12.303.068-16.97l8.52-8.451c4.705-4.667 12.303-4.637 16.97.068l68.976 69.533 163.441-162.13c4.705-4.667 12.303-4.637 16.97.068l8.451 8.52c4.668 4.705 4.637 12.303-.068 16.97z");
attr(
svg,
"width",
/*width*/
ctx[0]
);
set_style(svg, "text-align", "center");
set_style(svg, "display", "inline-block");
attr(svg, "aria-hidden", "true");
attr(svg, "focusable", "false");
attr(svg, "role", "img");
attr(svg, "xmlns", "http://www.w3.org/2000/svg");
attr(svg, "viewBox", "0 0 512 512");
},
m(target, anchor) {
insert(target, svg, anchor);
append(svg, path);
},
p(ctx2, [dirty]) {
if (dirty & /*width*/
1) {
attr(
svg,
"width",
/*width*/
ctx2[0]
);
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(svg);
}
}
};
}
function instance$f($self, $props, $invalidate) {
let { width = "1em" } = $props;
$self.$set = ($props2) => {
if ("width" in $props2) $invalidate(0, width = $props2.width);
};
return [width];
}
class SuccessIcon extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$f, create_fragment$g, safe_not_equal, { width: 0 });
}
}
function create_fragment$f(ctx) {
let svg;
let path;
return {
c() {
svg = svg_element("svg");
path = svg_element("path");
attr(path, "fill", "currentColor");
attr(path, "d", "M256 40c118.621 0 216 96.075 216 216 0 119.291-96.61 216-216 216-119.244 0-216-96.562-216-216 0-119.203 96.602-216 216-216m0-32C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm-11.49 120h22.979c6.823 0 12.274 5.682 11.99 12.5l-7 168c-.268 6.428-5.556 11.5-11.99 11.5h-8.979c-6.433 0-11.722-5.073-11.99-11.5l-7-168c-.283-6.818 5.167-12.5 11.99-12.5zM256 340c-15.464 0-28 12.536-28 28s12.536 28 28 28 28-12.536 28-28-12.536-28-28-28z");
attr(path, "class", "");
attr(
svg,
"width",
/*width*/
ctx[0]
);
set_style(svg, "text-align", "center");
set_style(svg, "display", "inline-block");
attr(svg, "aria-hidden", "true");
attr(svg, "focusable", "false");
attr(svg, "role", "img");
attr(svg, "xmlns", "http://www.w3.org/2000/svg");
attr(svg, "viewBox", "0 0 512 512");
},
m(target, anchor) {
insert(target, svg, anchor);
append(svg, path);
},
p(ctx2, [dirty]) {
if (dirty & /*width*/
1) {
attr(
svg,
"width",
/*width*/
ctx2[0]
);
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(svg);
}
}
};
}
function instance$e($self, $props, $invalidate) {
let { width = "1em" } = $props;
$self.$set = ($props2) => {
if ("width" in $props2) $invalidate(0, width = $props2.width);
};
return [width];
}
class ErrorIcon extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$e, create_fragment$f, safe_not_equal, { width: 0 });
}
}
function create_fragment$e(ctx) {
let svg;
let path;
return {
c() {
svg = svg_element("svg");
path = svg_element("path");
attr(path, "fill", "currentColor");
attr(path, "d", "M256 40c118.621 0 216 96.075 216 216 0 119.291-96.61 216-216 216-119.244 0-216-96.562-216-216 0-119.203 96.602-216 216-216m0-32C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm-36 344h12V232h-12c-6.627 0-12-5.373-12-12v-8c0-6.627 5.373-12 12-12h48c6.627 0 12 5.373 12 12v140h12c6.627 0 12 5.373 12 12v8c0 6.627-5.373 12-12 12h-72c-6.627 0-12-5.373-12-12v-8c0-6.627 5.373-12 12-12zm36-240c-17.673 0-32 14.327-32 32s14.327 32 32 32 32-14.327 32-32-14.327-32-32-32z");
attr(
svg,
"width",
/*width*/
ctx[0]
);
set_style(svg, "text-align", "center");
set_style(svg, "display", "inline-block");
attr(svg, "aria-hidden", "true");
attr(svg, "focusable", "false");
attr(svg, "role", "img");
attr(svg, "xmlns", "http://www.w3.org/2000/svg");
attr(svg, "viewBox", "0 0 512 512");
},
m(target, anchor) {
insert(target, svg, anchor);
append(svg, path);
},
p(ctx2, [dirty]) {
if (dirty & /*width*/
1) {
attr(
svg,
"width",
/*width*/
ctx2[0]
);
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(svg);
}
}
};
}
function instance$d($self, $props, $invalidate) {
let { width = "1em" } = $props;
$self.$set = ($props2) => {
if ("width" in $props2) $invalidate(0, width = $props2.width);
};
return [width];
}
class InfoIcon extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$d, create_fragment$e, safe_not_equal, { width: 0 });
}
}
function create_fragment$d(ctx) {
let svg;
let path;
return {
c() {
svg = svg_element("svg");
path = svg_element("path");
attr(path, "fill", "currentColor");
attr(path, "d", "M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z");
attr(
svg,
"width",
/*width*/
ctx[0]
);
set_style(svg, "text-align", "center");
set_style(svg, "display", "inline-block");
attr(svg, "aria-hidden", "true");
attr(svg, "focusable", "false");
attr(svg, "role", "img");
attr(svg, "xmlns", "http://www.w3.org/2000/svg");
attr(svg, "viewBox", "0 0 352 512");
},
m(target, anchor) {
insert(target, svg, anchor);
append(svg, path);
},
p(ctx2, [dirty]) {
if (dirty & /*width*/
1) {
attr(
svg,
"width",
/*width*/
ctx2[0]
);
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(svg);
}
}
};
}
function instance$c($self, $props, $invalidate) {
let { width = "1em" } = $props;
$self.$set = ($props2) => {
if ("width" in $props2) $invalidate(0, width = $props2.width);
};
return [width];
}
class CloseIcon extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$c, create_fragment$d, safe_not_equal, { width: 0 });
}
}
function create_else_block(ctx) {
let infoicon;
let current;
infoicon = new InfoIcon({ props: { width: "1.1em" } });
return {
c() {
create_component(infoicon.$.fragment);
},
m(target, anchor) {
mount_component(infoicon, target, anchor);
current = true;
},
i(local) {
if (current) return;
transition_in(infoicon.$.fragment, local);
current = true;
},
o(local) {
transition_out(infoicon.$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(infoicon, detaching);
}
};
}
function create_if_block_2$2(ctx) {
let erroricon;
let current;
erroricon = new ErrorIcon({ props: { width: "1.1em" } });
return {
c() {
create_component(erroricon.$.fragment);
},
m(target, anchor) {
mount_component(erroricon, target, anchor);
current = true;
},
i(local) {
if (current) return;
transition_in(erroricon.$.fragment, local);
current = true;
},
o(local) {
transition_out(erroricon.$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(erroricon, detaching);
}
};
}
function create_if_block_1$3(ctx) {
let successicon;
let current;
successicon = new SuccessIcon({ props: { width: "1.1em" } });
return {
c() {
create_component(successicon.$.fragment);
},
m(target, anchor) {
mount_component(successicon, target, anchor);
current = true;
},
i(local) {
if (current) return;
transition_in(successicon.$.fragment, local);
current = true;
},
o(local) {
transition_out(successicon.$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(successicon, detaching);
}
};
}
function create_if_block$9(ctx) {
let button;
let closeicon;
let current;
let mounted2;
let dispose;
closeicon = new CloseIcon({ props: { width: "0.8em" } });
return {
c() {
button = element("button");
create_component(closeicon.$.fragment);
attr(button, "class", "close svelte-3f7cpw");
},
m(target, anchor) {
insert(target, button, anchor);
mount_component(closeicon, button, null);
current = true;
if (!mounted2) {
dispose = listen(
button,
"click",
/*click_handler*/
ctx[5]
);
mounted2 = true;
}
},
p: noop,
i(local) {
if (current) return;
transition_in(closeicon.$.fragment, local);
current = true;
},
o(local) {
transition_out(closeicon.$.fragment, local);
current = false;
},
d(detaching) {
if (detaching) {
detach(button);
}
destroy_component(closeicon);
mounted2 = false;
dispose();
}
};
}
function create_fragment$c(ctx) {
let article;
let current_block_type_index;
let if_block0;
let t0;
let div;
let t1;
let article_class_value;
let article_transition;
let current;
const if_block_creators = [create_if_block_1$3, create_if_block_2$2, create_else_block];
const if_blocks = [];
function select_block_type(ctx2, dirty) {
if (
/*type*/
ctx2[0] === "success"
) return 0;
if (
/*type*/
ctx2[0] === "error"
) return 1;
return 2;
}
current_block_type_index = select_block_type(ctx);
if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
const default_slot_template = (
/*#slots*/
ctx[4].default
);
const default_slot = create_slot(
default_slot_template,
ctx,
/*$scope*/
ctx[3],
null
);
let if_block1 = (
/*dismissible*/
ctx[1] && create_if_block$9(ctx)
);
return {
c() {
article = element("article");
if_block0.c();
t0 = space();
div = element("div");
if (default_slot) default_slot.c();
t1 = space();
if (if_block1) if_block1.c();
attr(div, "class", "text svelte-3f7cpw");
attr(article, "class", article_class_value = null_to_empty(
/*type*/
ctx[0]
) + " svelte-3f7cpw");
attr(article, "role", "alert");
},
m(target, anchor) {
insert(target, article, anchor);
if_blocks[current_block_type_index].m(article, null);
append(article, t0);
append(article, div);
if (default_slot) {
default_slot.m(div, null);
}
append(article, t1);
if (if_block1) if_block1.m(article, null);
current = true;
},
p(ctx2, [dirty]) {
let previous_block_index = current_block_type_index;
current_block_type_index = select_block_type(ctx2);
if (current_block_type_index !== previous_block_index) {
group_outros();
transition_out(if_blocks[previous_block_index], 1, 1, () => {
if_blocks[previous_block_index] = null;
});
check_outros();
if_block0 = if_blocks[current_block_type_index];
if (!if_block0) {
if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2);
if_block0.c();
}
transition_in(if_block0, 1);
if_block0.m(article, t0);
}
if (default_slot) {
if (default_slot.p && (!current || dirty & /*$scope*/
8)) {
update_slot_base(
default_slot,
default_slot_template,
ctx2,
/*$scope*/
ctx2[3],
!current ? get_all_dirty_from_scope(
/*$scope*/
ctx2[3]
) : get_slot_changes(
default_slot_template,
/*$scope*/
ctx2[3],
dirty,
null
),
null
);
}
}
if (
/*dismissible*/
ctx2[1]
) {
if (if_block1) {
if_block1.p(ctx2, dirty);
if (dirty & /*dismissible*/
2) {
transition_in(if_block1, 1);
}
} else {
if_block1 = create_if_block$9(ctx2);
if_block1.c();
transition_in(if_block1, 1);
if_block1.m(article, null);
}
} else if (if_block1) {
group_outros();
transition_out(if_block1, 1, 1, () => {
if_block1 = null;
});
check_outros();
}
if (!current || dirty & /*type*/
1 && article_class_value !== (article_class_value = null_to_empty(
/*type*/
ctx2[0]
) + " svelte-3f7cpw")) {
attr(article, "class", article_class_value);
}
},
i(local) {
if (current) return;
transition_in(if_block0);
transition_in(default_slot, local);
transition_in(if_block1);
if (local) {
add_render_callback(() => {
if (!current) return;
if (!article_transition) article_transition = create_bidirectional_transition(article, fade, {}, true);
article_transition.run(1);
});
}
current = true;
},
o(local) {
transition_out(if_block0);
transition_out(default_slot, local);
transition_out(if_block1);
if (local) {
if (!article_transition) article_transition = create_bidirectional_transition(article, fade, {}, false);
article_transition.run(0);
}
current = false;
},
d(detaching) {
if (detaching) {
detach(article);
}
if_blocks[current_block_type_index].d();
if (default_slot) default_slot.d(detaching);
if (if_block1) if_block1.d();
if (detaching && article_transition) article_transition.end();
}
};
}
function instance$b($self, $props, $invalidate) {
let { $slots: slots = {}, $scope } = $props;
const dispatch2 = createEventDispatcher();
let { type = "error" } = $props;
let { dismissible = true } = $props;
const click_handler = () => dispatch2("dismiss");
$self.$set = ($props2) => {
if ("type" in $props2) $invalidate(0, type = $props2.type);
if ("dismissible" in $props2) $invalidate(1, dismissible = $props2.dismissible);
if ("$scope" in $props2) $invalidate(3, $scope = $props2.$scope);
};
return [type, dismissible, dispatch2, $scope, slots, click_handler];
}
class Toast extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$b, create_fragment$c, safe_not_equal, { type: 0, dismissible: 1 });
}
}
function get_each_context$3(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[2] = list[i];
return child_ctx;
}
function create_if_block$8(ctx) {
let section;
let each_blocks = [];
let each_1_lookup = /* @__PURE__ */ new Map();
let current;
let each_value = ensure_array_like(
/*$toasts*/
ctx[0]
);
const get_key = (ctx2) => (
/*toast*/
ctx2[2].id
);
for (let i = 0; i < each_value.length; i += 1) {
let child_ctx = get_each_context$3(ctx, each_value, i);
let key = get_key(child_ctx);
each_1_lookup.set(key, each_blocks[i] = create_each_block$3(key, child_ctx));
}
return {
c() {
section = element("section");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr(section, "class", "svelte-1qk4i5d");
},
m(target, anchor) {
insert(target, section, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
if (each_blocks[i]) {
each_blocks[i].m(section, null);
}
}
current = true;
},
p(ctx2, dirty) {
if (dirty & /*$toasts*/
1) {
each_value = ensure_array_like(
/*$toasts*/
ctx2[0]
);
group_outros();
each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx2, each_value, each_1_lookup, section, outro_and_destroy_block, create_each_block$3, null, get_each_context$3);
check_outros();
}
},
i(local) {
if (current) return;
for (let i = 0; i < each_value.length; i += 1) {
transition_in(each_blocks[i]);
}
current = true;
},
o(local) {
for (let i = 0; i < each_blocks.length; i += 1) {
transition_out(each_blocks[i]);
}
current = false;
},
d(detaching) {
if (detaching) {
detach(section);
}
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].d();
}
}
};
}
function create_default_slot$3(ctx) {
let t_value = (
/*toast*/
ctx[2].message + ""
);
let t;
return {
c() {
t = text(t_value);
},
m(target, anchor) {
insert(target, t, anchor);
},
p(ctx2, dirty) {
if (dirty & /*$toasts*/
1 && t_value !== (t_value = /*toast*/
ctx2[2].message + "")) set_data(t, t_value);
},
d(detaching) {
if (detaching) {
detach(t);
}
}
};
}
function create_each_block$3(key_1, ctx) {
let first;
let toast_1;
let current;
function dismiss_handler() {
return (
/*dismiss_handler*/
ctx[1](
/*toast*/
ctx[2]
)
);
}
toast_1 = new Toast({
props: {
type: (
/*toast*/
ctx[2].type
),
dismissible: (
/*toast*/
ctx[2].dismissible
),
$slots: { default: [create_default_slot$3] },
$scope: { ctx }
}
});
toast_1.$on("dismiss", dismiss_handler);
return {
key: key_1,
first: null,
c() {
first = empty();
create_component(toast_1.$.fragment);
this.first = first;
},
m(target, anchor) {
insert(target, first, anchor);
mount_component(toast_1, target, anchor);
current = true;
},
p(new_ctx, dirty) {
ctx = new_ctx;
const toast_1_changes = {};
if (dirty & /*$toasts*/
1) toast_1_changes.type = /*toast*/
ctx[2].type;
if (dirty & /*$toasts*/
1) toast_1_changes.dismissible = /*toast*/
ctx[2].dismissible;
if (dirty & /*$scope, $toasts*/
33) {
toast_1_changes.$scope = { dirty, ctx };
}
toast_1.$set(toast_1_changes);
},
i(local) {
if (current) return;
transition_in(toast_1.$.fragment, local);
current = true;
},
o(local) {
transition_out(toast_1.$.fragment, local);
current = false;
},
d(detaching) {
if (detaching) {
detach(first);
}
destroy_component(toast_1, detaching);
}
};
}
function create_fragment$b(ctx) {
let if_block_anchor;
let current;
let if_block = (
/*$toasts*/
ctx[0] && create_if_block$8(ctx)
);
return {
c() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
insert(target, if_block_anchor, anchor);
current = true;
},
p(ctx2, [dirty]) {
if (
/*$toasts*/
ctx2[0]
) {
if (if_block) {
if_block.p(ctx2, dirty);
if (dirty & /*$toasts*/
1) {
transition_in(if_block, 1);
}
} else {
if_block = create_if_block$8(ctx2);
if_block.c();
transition_in(if_block, 1);
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
group_outros();
transition_out(if_block, 1, 1, () => {
if_block = null;
});
check_outros();
}
},
i(local) {
if (current) return;
transition_in(if_block);
current = true;
},
o(local) {
transition_out(if_block);
current = false;
},
d(detaching) {
if (detaching) {
detach(if_block_anchor);
}
if (if_block) if_block.d(detaching);
}
};
}
function instance$a($self, $props, $invalidate) {
let $toasts;
component_subscribe($self, toasts, ($value) => $invalidate(0, $toasts = $value));
const dismiss_handler = (toast) => dismissToast(toast.id);
return [$toasts, dismiss_handler];
}
class Toasts extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$a, create_fragment$b, safe_not_equal, {});
}
}
function create_if_block$7(ctx) {
let div2;
let div0;
let t0;
let t1;
let t2;
let t3;
let t4;
let t5;
let div1;
let t6;
let t7;
let t8;
let t9;
let t10;
return {
c() {
div2 = element("div");
div0 = element("div");
t0 = text("历史最高价:");
t1 = text(
/*max*/
ctx[0]
);
t2 = text("(");
t3 = text(
/*max_date*/
ctx[3]
);
t4 = text(")");
t5 = space();
div1 = element("div");
t6 = text("历史最低价:");
t7 = text(
/*min*/
ctx[1]
);
t8 = text("(");
t9 = text(
/*min_date*/
ctx[2]
);
t10 = text(")");
attr(div0, "class", "high-price svelte-1cy8qli");
attr(div1, "class", "low-price svelte-1cy8qli");
attr(div2, "class", "price-container svelte-1cy8qli");
},
m(target, anchor) {
insert(target, div2, anchor);
append(div2, div0);
append(div0, t0);
append(div0, t1);
append(div0, t2);
append(div0, t3);
append(div0, t4);
append(div2, t5);
append(div2, div1);
append(div1, t6);
append(div1, t7);
append(div1, t8);
append(div1, t9);
append(div1, t10);
},
p(ctx2, dirty) {
if (dirty & /*max*/
1) set_data(
t1,
/*max*/
ctx2[0]
);
if (dirty & /*max_date*/
8) set_data(
t3,
/*max_date*/
ctx2[3]
);
if (dirty & /*min*/
2) set_data(
t7,
/*min*/
ctx2[1]
);
if (dirty & /*min_date*/
4) set_data(
t9,
/*min_date*/
ctx2[2]
);
},
d(detaching) {
if (detaching) {
detach(div2);
}
}
};
}
function create_fragment$a(ctx) {
let if_block_anchor;
let if_block = (
/*max*/
ctx[0] && /*max*/
ctx[0] != 0 && create_if_block$7(ctx)
);
return {
c() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
insert(target, if_block_anchor, anchor);
},
p(ctx2, [dirty]) {
if (
/*max*/
ctx2[0] && /*max*/
ctx2[0] != 0
) {
if (if_block) {
if_block.p(ctx2, dirty);
} else {
if_block = create_if_block$7(ctx2);
if_block.c();
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(if_block_anchor);
}
if (if_block) if_block.d(detaching);
}
};
}
function instance$9($self, $props, $invalidate) {
let { url = location.href } = $props;
let max = 0;
let min = 0;
let min_date = "";
let max_date = "";
let history = [];
async function getHis(url2) {
if (!url2 || url2 === "") return;
const json = await get(API.getHisPrice, { url: url2 });
if (json && json.data) {
$invalidate(0, max = json.data.max);
$invalidate(1, min = json.data.min);
history = json.data.his;
const maxItem = history.find((item) => item.price == max);
const minItem = history.find((item) => item.price == min);
$invalidate(3, max_date = maxItem ? maxItem.updatetime : "");
$invalidate(2, min_date = minItem ? minItem.updatetime : "");
}
}
onMount(() => {
getHis(url);
});
$self.$set = ($props2) => {
if ("url" in $props2) $invalidate(4, url = $props2.url);
};
return [max, min, min_date, max_date, url];
}
class HisPrice extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$9, create_fragment$a, safe_not_equal, { url: 4 });
}
}
function create_fragment$9(ctx) {
let div1;
let div0;
return {
c() {
div1 = element("div");
div0 = element("div");
set_style(div1, "padding", "6px");
set_style(div1, "background-color", "white");
},
m(target, anchor) {
insert(target, div1, anchor);
append(div1, div0);
ctx[6](div0);
},
p: noop,
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(div1);
}
ctx[6](null);
}
};
}
function instance$8($self, $props, $invalidate) {
let { url = "" } = $props;
let { width = 70 } = $props;
let { height = 70 } = $props;
let { logo = "" } = $props;
let { logoWidth = 20 } = $props;
let qrCodeContainer;
onMount(() => {
generateQRCode();
});
function generateQRCode() {
if (!qrCodeContainer) return;
$invalidate(0, qrCodeContainer.innerHTML = "", qrCodeContainer);
new EasyQRCode(
qrCodeContainer,
{
text: url,
width,
height,
logo,
logoWidth,
logoBackgroundTransparent: true
}
);
}
function div0_binding($value) {
binding_callbacks[$value ? "unshift" : "push"](() => {
qrCodeContainer = $value;
$invalidate(0, qrCodeContainer);
});
}
$self.$set = ($props2) => {
if ("url" in $props2) $invalidate(1, url = $props2.url);
if ("width" in $props2) $invalidate(2, width = $props2.width);
if ("height" in $props2) $invalidate(3, height = $props2.height);
if ("logo" in $props2) $invalidate(4, logo = $props2.logo);
if ("logoWidth" in $props2) $invalidate(5, logoWidth = $props2.logoWidth);
};
$self.$.update = () => {
if ($self.$.dirty & /*url, width, height, logo, logoWidth*/
62) {
if (url || width || height || logo || logoWidth) {
generateQRCode();
}
}
};
return [qrCodeContainer, url, width, height, logo, logoWidth, div0_binding];
}
class QrCode extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$8, create_fragment$9, safe_not_equal, {
url: 1,
width: 2,
height: 3,
logo: 4,
logoWidth: 5
});
}
}
function create_fragment$8(ctx) {
let div;
let current;
const default_slot_template = (
/*#slots*/
ctx[2].default
);
const default_slot = create_slot(
default_slot_template,
ctx,
/*$scope*/
ctx[1],
null
);
return {
c() {
div = element("div");
if (default_slot) default_slot.c();
},
m(target, anchor) {
insert(target, div, anchor);
if (default_slot) {
default_slot.m(div, null);
}
ctx[3](div);
current = true;
},
p(ctx2, [dirty]) {
if (default_slot) {
if (default_slot.p && (!current || dirty & /*$scope*/
2)) {
update_slot_base(
default_slot,
default_slot_template,
ctx2,
/*$scope*/
ctx2[1],
!current ? get_all_dirty_from_scope(
/*$scope*/
ctx2[1]
) : get_slot_changes(
default_slot_template,
/*$scope*/
ctx2[1],
dirty,
null
),
null
);
}
}
},
i(local) {
if (current) return;
transition_in(default_slot, local);
current = true;
},
o(local) {
transition_out(default_slot, local);
current = false;
},
d(detaching) {
if (detaching) {
detach(div);
}
if (default_slot) default_slot.d(detaching);
ctx[3](null);
}
};
}
function instance$7($self, $props, $invalidate) {
let { $slots: slots = {}, $scope } = $props;
let ref;
function div_binding($value) {
binding_callbacks[$value ? "unshift" : "push"](() => {
ref = $value;
$invalidate(0, ref);
});
}
$self.$set = ($props2) => {
if ("$scope" in $props2) $invalidate(1, $scope = $props2.$scope);
};
$self.$.update = () => {
if ($self.$.dirty & /*ref*/
1) {
ref && document.body.appendChild(ref);
}
};
return [ref, $scope, slots, div_binding];
}
class Portal extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$7, create_fragment$8, safe_not_equal, {});
}
}
function create_if_block$6(ctx) {
let portal;
let current;
portal = new Portal({
props: {
$slots: { default: [create_default_slot$2] },
$scope: { ctx }
}
});
return {
c() {
create_component(portal.$.fragment);
},
m(target, anchor) {
mount_component(portal, target, anchor);
current = true;
},
p(ctx2, dirty) {
const portal_changes = {};
if (dirty & /*$scope, title*/
34) {
portal_changes.$scope = { dirty, ctx: ctx2 };
}
portal.$set(portal_changes);
},
i(local) {
if (current) return;
transition_in(portal.$.fragment, local);
current = true;
},
o(local) {
transition_out(portal.$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(portal, detaching);
}
};
}
function create_default_slot$2(ctx) {
let div3;
let div2;
let div0;
let p;
let t0;
let t1;
let button;
let t3;
let div1;
let current;
let mounted2;
let dispose;
const default_slot_template = (
/*#slots*/
ctx[3].default
);
const default_slot = create_slot(
default_slot_template,
ctx,
/*$scope*/
ctx[5],
null
);
return {
c() {
div3 = element("div");
div2 = element("div");
div0 = element("div");
p = element("p");
t0 = text(
/*title*/
ctx[1]
);
t1 = space();
button = element("button");
button.textContent = "×";
t3 = space();
div1 = element("div");
if (default_slot) default_slot.c();
set_style(p, "margin-top", "-3px");
attr(button, "class", "close-button svelte-ofl3r0");
attr(div1, "class", "content-slot svelte-ofl3r0");
attr(div2, "class", "modal-content svelte-ofl3r0");
set_style(div2, "max-width", "90%");
attr(div3, "class", "modal-overlay svelte-ofl3r0");
set_style(div3, "z-index", "99999999");
},
m(target, anchor) {
insert(target, div3, anchor);
append(div3, div2);
append(div2, div0);
append(div0, p);
append(p, t0);
append(div0, t1);
append(div0, button);
append(div2, t3);
append(div2, div1);
if (default_slot) {
default_slot.m(div1, null);
}
current = true;
if (!mounted2) {
dispose = [
listen(
button,
"click",
/*closeModal*/
ctx[2]
),
listen(div2, "click", stop_propagation(
/*click_handler*/
ctx[4]
)),
listen(
div3,
"click",
/*closeModal*/
ctx[2]
)
];
mounted2 = true;
}
},
p(ctx2, dirty) {
if (!current || dirty & /*title*/
2) set_data(
t0,
/*title*/
ctx2[1]
);
if (default_slot) {
if (default_slot.p && (!current || dirty & /*$scope*/
32)) {
update_slot_base(
default_slot,
default_slot_template,
ctx2,
/*$scope*/
ctx2[5],
!current ? get_all_dirty_from_scope(
/*$scope*/
ctx2[5]
) : get_slot_changes(
default_slot_template,
/*$scope*/
ctx2[5],
dirty,
null
),
null
);
}
}
},
i(local) {
if (current) return;
transition_in(default_slot, local);
current = true;
},
o(local) {
transition_out(default_slot, local);
current = false;
},
d(detaching) {
if (detaching) {
detach(div3);
}
if (default_slot) default_slot.d(detaching);
mounted2 = false;
run_all(dispose);
}
};
}
function create_fragment$7(ctx) {
let if_block_anchor;
let current;
let if_block = (
/*show*/
ctx[0] && create_if_block$6(ctx)
);
return {
c() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
insert(target, if_block_anchor, anchor);
current = true;
},
p(ctx2, [dirty]) {
if (
/*show*/
ctx2[0]
) {
if (if_block) {
if_block.p(ctx2, dirty);
if (dirty & /*show*/
1) {
transition_in(if_block, 1);
}
} else {
if_block = create_if_block$6(ctx2);
if_block.c();
transition_in(if_block, 1);
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
group_outros();
transition_out(if_block, 1, 1, () => {
if_block = null;
});
check_outros();
}
},
i(local) {
if (current) return;
transition_in(if_block);
current = true;
},
o(local) {
transition_out(if_block);
current = false;
},
d(detaching) {
if (detaching) {
detach(if_block_anchor);
}
if (if_block) if_block.d(detaching);
}
};
}
function instance$6($self, $props, $invalidate) {
let { $slots: slots = {}, $scope } = $props;
let { show = false } = $props;
let { title = "微信扫码购买" } = $props;
const dispatch2 = createEventDispatcher();
function closeModal() {
dispatch2("close");
}
function click_handler(event) {
bubble.call(this, $self, event);
}
$self.$set = ($props2) => {
if ("show" in $props2) $invalidate(0, show = $props2.show);
if ("title" in $props2) $invalidate(1, title = $props2.title);
if ("$scope" in $props2) $invalidate(5, $scope = $props2.$scope);
};
return [show, title, closeModal, slots, click_handler, $scope];
}
class Modal extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$6, create_fragment$7, safe_not_equal, { show: 0, title: 1 });
}
}
function create_if_block$5(ctx) {
let div;
let img;
let img_src_value;
let img_title_value;
let img_alt_value;
return {
c() {
div = element("div");
img = element("img");
if (!src_url_equal(img.src, img_src_value = /*activityItem*/
ctx[0].img)) attr(img, "src", img_src_value);
attr(img, "title", img_title_value = /*activityItem*/
ctx[0].title);
attr(img, "alt", img_alt_value = /*activityItem*/
ctx[0].title);
attr(img, "class", "activity-img svelte-1remv7x");
attr(div, "class", "svelte-1remv7x");
toggle_class(
div,
"clickable",
/*activityItem*/
ctx[0].url && /*activityItem*/
ctx[0].url != ""
);
},
m(target, anchor) {
insert(target, div, anchor);
append(div, img);
},
p(ctx2, dirty) {
if (dirty & /*activityItem*/
1 && !src_url_equal(img.src, img_src_value = /*activityItem*/
ctx2[0].img)) {
attr(img, "src", img_src_value);
}
if (dirty & /*activityItem*/
1 && img_title_value !== (img_title_value = /*activityItem*/
ctx2[0].title)) {
attr(img, "title", img_title_value);
}
if (dirty & /*activityItem*/
1 && img_alt_value !== (img_alt_value = /*activityItem*/
ctx2[0].title)) {
attr(img, "alt", img_alt_value);
}
if (dirty & /*activityItem*/
1) {
toggle_class(
div,
"clickable",
/*activityItem*/
ctx2[0].url && /*activityItem*/
ctx2[0].url != ""
);
}
},
d(detaching) {
if (detaching) {
detach(div);
}
}
};
}
function create_fragment$6(ctx) {
let if_block_anchor;
let if_block = (
/*activityItem*/
ctx[0] && create_if_block$5(ctx)
);
return {
c() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
insert(target, if_block_anchor, anchor);
},
p(ctx2, [dirty]) {
if (
/*activityItem*/
ctx2[0]
) {
if (if_block) {
if_block.p(ctx2, dirty);
} else {
if_block = create_if_block$5(ctx2);
if_block.c();
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(if_block_anchor);
}
if (if_block) if_block.d(detaching);
}
};
}
function instance$5($self, $props, $invalidate) {
let { activityItem = null } = $props;
const platform2 = null;
$self.$set = ($props2) => {
if ("activityItem" in $props2) $invalidate(0, activityItem = $props2.activityItem);
};
return [activityItem, platform2];
}
class ActivityImg extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$5, create_fragment$6, safe_not_equal, { activityItem: 0, platform: 1 });
}
get platform() {
return this.$.ctx[1];
}
}
function create_if_block$4(ctx) {
let div3;
let img;
let img_src_value;
let img_title_value;
let img_alt_value;
let t0;
let div2;
let div1;
let div0;
let h4;
let t1_value = (
/*activityItem*/
ctx[0].title + ""
);
let t1;
let t2;
let t3;
let t4;
let current;
let if_block0 = (
/*activityItem*/
ctx[0].desc && /*activityItem*/
ctx[0].desc != "" && create_if_block_3$1(ctx)
);
let if_block1 = (
/*activityItem*/
ctx[0].activity_date && /*activityItem*/
ctx[0].activity_date != "" && create_if_block_2$1(ctx)
);
let if_block2 = (
/*activityItem*/
ctx[0].short_url && /*activityItem*/
ctx[0].short_url != "" && create_if_block_1$2(ctx)
);
return {
c() {
div3 = element("div");
img = element("img");
t0 = space();
div2 = element("div");
div1 = element("div");
div0 = element("div");
h4 = element("h4");
t1 = text(t1_value);
t2 = space();
if (if_block0) if_block0.c();
t3 = space();
if (if_block1) if_block1.c();
t4 = space();
if (if_block2) if_block2.c();
if (!src_url_equal(img.src, img_src_value = /*activityItem*/
ctx[0].img)) attr(img, "src", img_src_value);
attr(img, "title", img_title_value = /*activityItem*/
ctx[0].title);
attr(img, "alt", img_alt_value = /*activityItem*/
ctx[0].title);
attr(img, "class", "activity-img svelte-wh6wcg");
attr(h4, "class", "activity-title svelte-wh6wcg");
attr(div1, "class", "activity-header svelte-wh6wcg");
attr(div2, "class", "activity-content svelte-wh6wcg");
attr(div3, "class", "activity-container svelte-wh6wcg");
},
m(target, anchor) {
insert(target, div3, anchor);
append(div3, img);
append(div3, t0);
append(div3, div2);
append(div2, div1);
append(div1, div0);
append(div0, h4);
append(h4, t1);
append(div0, t2);
if (if_block0) if_block0.m(div0, null);
append(div0, t3);
if (if_block1) if_block1.m(div0, null);
append(div1, t4);
if (if_block2) if_block2.m(div1, null);
current = true;
},
p(ctx2, dirty) {
if (!current || dirty & /*activityItem*/
1 && !src_url_equal(img.src, img_src_value = /*activityItem*/
ctx2[0].img)) {
attr(img, "src", img_src_value);
}
if (!current || dirty & /*activityItem*/
1 && img_title_value !== (img_title_value = /*activityItem*/
ctx2[0].title)) {
attr(img, "title", img_title_value);
}
if (!current || dirty & /*activityItem*/
1 && img_alt_value !== (img_alt_value = /*activityItem*/
ctx2[0].title)) {
attr(img, "alt", img_alt_value);
}
if ((!current || dirty & /*activityItem*/
1) && t1_value !== (t1_value = /*activityItem*/
ctx2[0].title + "")) set_data(t1, t1_value);
if (
/*activityItem*/
ctx2[0].desc && /*activityItem*/
ctx2[0].desc != ""
) {
if (if_block0) {
if_block0.p(ctx2, dirty);
} else {
if_block0 = create_if_block_3$1(ctx2);
if_block0.c();
if_block0.m(div0, t3);
}
} else if (if_block0) {
if_block0.d(1);
if_block0 = null;
}
if (
/*activityItem*/
ctx2[0].activity_date && /*activityItem*/
ctx2[0].activity_date != ""
) {
if (if_block1) {
if_block1.p(ctx2, dirty);
} else {
if_block1 = create_if_block_2$1(ctx2);
if_block1.c();
if_block1.m(div0, null);
}
} else if (if_block1) {
if_block1.d(1);
if_block1 = null;
}
if (
/*activityItem*/
ctx2[0].short_url && /*activityItem*/
ctx2[0].short_url != ""
) {
if (if_block2) {
if_block2.p(ctx2, dirty);
if (dirty & /*activityItem*/
1) {
transition_in(if_block2, 1);
}
} else {
if_block2 = create_if_block_1$2(ctx2);
if_block2.c();
transition_in(if_block2, 1);
if_block2.m(div1, null);
}
} else if (if_block2) {
group_outros();
transition_out(if_block2, 1, 1, () => {
if_block2 = null;
});
check_outros();
}
},
i(local) {
if (current) return;
transition_in(if_block2);
current = true;
},
o(local) {
transition_out(if_block2);
current = false;
},
d(detaching) {
if (detaching) {
detach(div3);
}
if (if_block0) if_block0.d();
if (if_block1) if_block1.d();
if (if_block2) if_block2.d();
}
};
}
function create_if_block_3$1(ctx) {
let p;
let t_value = (
/*activityItem*/
ctx[0].desc + ""
);
let t;
return {
c() {
p = element("p");
t = text(t_value);
attr(p, "class", "activity-desc svelte-wh6wcg");
},
m(target, anchor) {
insert(target, p, anchor);
append(p, t);
},
p(ctx2, dirty) {
if (dirty & /*activityItem*/
1 && t_value !== (t_value = /*activityItem*/
ctx2[0].desc + "")) set_data(t, t_value);
},
d(detaching) {
if (detaching) {
detach(p);
}
}
};
}
function create_if_block_2$1(ctx) {
let p;
let t_value = (
/*activityItem*/
ctx[0].activity_date + ""
);
let t;
return {
c() {
p = element("p");
t = text(t_value);
attr(p, "class", "activity-date svelte-wh6wcg");
},
m(target, anchor) {
insert(target, p, anchor);
append(p, t);
},
p(ctx2, dirty) {
if (dirty & /*activityItem*/
1 && t_value !== (t_value = /*activityItem*/
ctx2[0].activity_date + "")) set_data(t, t_value);
},
d(detaching) {
if (detaching) {
detach(p);
}
}
};
}
function create_if_block_1$2(ctx) {
let qrcode;
let current;
qrcode = new QrCode({
props: {
url: (
/*activityItem*/
ctx[0].short_url
),
width: 100,
height: 100,
logo: getPlatformLogo(
/*platform*/
ctx[1]
),
logoWidth: getLogoWidth(
/*platform*/
ctx[1]
)
}
});
return {
c() {
create_component(qrcode.$.fragment);
},
m(target, anchor) {
mount_component(qrcode, target, anchor);
current = true;
},
p(ctx2, dirty) {
const qrcode_changes = {};
if (dirty & /*activityItem*/
1) qrcode_changes.url = /*activityItem*/
ctx2[0].short_url;
if (dirty & /*platform*/
2) qrcode_changes.logo = getPlatformLogo(
/*platform*/
ctx2[1]
);
if (dirty & /*platform*/
2) qrcode_changes.logoWidth = getLogoWidth(
/*platform*/
ctx2[1]
);
qrcode.$set(qrcode_changes);
},
i(local) {
if (current) return;
transition_in(qrcode.$.fragment, local);
current = true;
},
o(local) {
transition_out(qrcode.$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(qrcode, detaching);
}
};
}
function create_fragment$5(ctx) {
let if_block_anchor;
let current;
let if_block = (
/*activityItem*/
ctx[0] && create_if_block$4(ctx)
);
return {
c() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
insert(target, if_block_anchor, anchor);
current = true;
},
p(ctx2, [dirty]) {
if (
/*activityItem*/
ctx2[0]
) {
if (if_block) {
if_block.p(ctx2, dirty);
if (dirty & /*activityItem*/
1) {
transition_in(if_block, 1);
}
} else {
if_block = create_if_block$4(ctx2);
if_block.c();
transition_in(if_block, 1);
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
group_outros();
transition_out(if_block, 1, 1, () => {
if_block = null;
});
check_outros();
}
},
i(local) {
if (current) return;
transition_in(if_block);
current = true;
},
o(local) {
transition_out(if_block);
current = false;
},
d(detaching) {
if (detaching) {
detach(if_block_anchor);
}
if (if_block) if_block.d(detaching);
}
};
}
function instance$4($self, $props, $invalidate) {
let { activityItem = null } = $props;
let { platform: platform2 } = $props;
$self.$set = ($props2) => {
if ("activityItem" in $props2) $invalidate(0, activityItem = $props2.activityItem);
if ("platform" in $props2) $invalidate(1, platform2 = $props2.platform);
};
return [activityItem, platform2];
}
class ActivityImgText extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$4, create_fragment$5, safe_not_equal, { activityItem: 0, platform: 1 });
}
}
function get_each_context$2(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[4] = list[i];
return child_ctx;
}
function create_if_block$3(ctx) {
var _a;
let div1;
let h3;
let t0_value = (
/*activityItem*/
ctx[0].title + ""
);
let t0;
let t1;
let p;
let t2_value = (
/*activityItem*/
(ctx[0].desc ?? "使用说明:点击复制,复制口令后打开对应平台app搜索即可") + ""
);
let t2;
let t3;
let div0;
let each_value = ensure_array_like(
/*activityItem*/
(_a = ctx[0]) == null ? void 0 : _a.list
);
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block$2(get_each_context$2(ctx, each_value, i));
}
return {
c() {
div1 = element("div");
h3 = element("h3");
t0 = text(t0_value);
t1 = space();
p = element("p");
t2 = text(t2_value);
t3 = space();
div0 = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr(h3, "class", "activity-title svelte-hd8iy");
attr(p, "class", "activity-desc svelte-hd8iy");
attr(div0, "class", "activity-list svelte-hd8iy");
attr(div1, "class", "activity-container svelte-hd8iy");
},
m(target, anchor) {
insert(target, div1, anchor);
append(div1, h3);
append(h3, t0);
append(div1, t1);
append(div1, p);
append(p, t2);
append(div1, t3);
append(div1, div0);
for (let i = 0; i < each_blocks.length; i += 1) {
if (each_blocks[i]) {
each_blocks[i].m(div0, null);
}
}
},
p(ctx2, dirty) {
var _a2;
if (dirty & /*activityItem*/
1 && t0_value !== (t0_value = /*activityItem*/
ctx2[0].title + "")) set_data(t0, t0_value);
if (dirty & /*activityItem*/
1 && t2_value !== (t2_value = /*activityItem*/
(ctx2[0].desc ?? "使用说明:点击复制,复制口令后打开对应平台app搜索即可") + "")) set_data(t2, t2_value);
if (dirty & /*handleCopy, activityItem, handleGo*/
7) {
each_value = ensure_array_like(
/*activityItem*/
(_a2 = ctx2[0]) == null ? void 0 : _a2.list
);
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context$2(ctx2, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
} else {
each_blocks[i] = create_each_block$2(child_ctx);
each_blocks[i].c();
each_blocks[i].m(div0, null);
}
}
for (; i < each_blocks.length; i += 1) {
each_blocks[i].d(1);
}
each_blocks.length = each_value.length;
}
},
d(detaching) {
if (detaching) {
detach(div1);
}
destroy_each(each_blocks, detaching);
}
};
}
function create_each_block$2(ctx) {
let p;
let span0;
let t0_value = (
/*item*/
ctx[4] + ""
);
let t0;
let t1;
let span1;
let t3;
let mounted2;
let dispose;
return {
c() {
p = element("p");
span0 = element("span");
t0 = text(t0_value);
t1 = space();
span1 = element("span");
span1.textContent = "(复制)";
t3 = space();
attr(span0, "class", "svelte-hd8iy");
toggle_class(
span0,
"item-link",
/*item*/
ctx[4].startsWith("https")
);
toggle_class(
span0,
"clickable",
/*item*/
ctx[4].startsWith("https")
);
attr(span1, "class", "copy-link svelte-hd8iy");
attr(p, "class", "activity-item svelte-hd8iy");
},
m(target, anchor) {
insert(target, p, anchor);
append(p, span0);
append(span0, t0);
append(p, t1);
append(p, span1);
append(p, t3);
if (!mounted2) {
dispose = [
listen(span0, "click", function() {
if (is_function(
/*handleGo*/
ctx[1](
/*item*/
ctx[4]
)
)) ctx[1](
/*item*/
ctx[4]
).apply(this, arguments);
}),
listen(span1, "click", function() {
if (is_function(
/*handleCopy*/
ctx[2](
/*item*/
ctx[4]
)
)) ctx[2](
/*item*/
ctx[4]
).apply(this, arguments);
})
];
mounted2 = true;
}
},
p(new_ctx, dirty) {
ctx = new_ctx;
if (dirty & /*activityItem*/
1 && t0_value !== (t0_value = /*item*/
ctx[4] + "")) set_data(t0, t0_value);
if (dirty & /*activityItem*/
1) {
toggle_class(
span0,
"item-link",
/*item*/
ctx[4].startsWith("https")
);
}
if (dirty & /*activityItem*/
1) {
toggle_class(
span0,
"clickable",
/*item*/
ctx[4].startsWith("https")
);
}
},
d(detaching) {
if (detaching) {
detach(p);
}
mounted2 = false;
run_all(dispose);
}
};
}
function create_fragment$4(ctx) {
let if_block_anchor;
let if_block = (
/*activityItem*/
ctx[0] && /*activityItem*/
ctx[0].list && /*activityItem*/
ctx[0].list.length > 0 && create_if_block$3(ctx)
);
return {
c() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
insert(target, if_block_anchor, anchor);
},
p(ctx2, [dirty]) {
if (
/*activityItem*/
ctx2[0] && /*activityItem*/
ctx2[0].list && /*activityItem*/
ctx2[0].list.length > 0
) {
if (if_block) {
if_block.p(ctx2, dirty);
} else {
if_block = create_if_block$3(ctx2);
if_block.c();
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
},
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(if_block_anchor);
}
if (if_block) if_block.d(detaching);
}
};
}
function instance$3($self, $props, $invalidate) {
let { activityItem = null } = $props;
const platform2 = null;
function handleGo(url) {
return () => {
if (url.startsWith("https")) {
openWindow(url);
}
};
}
function handleCopy(text2) {
return () => {
copy(text2, () => {
window.alert("复制成功,温馨提示:粘贴到微信,手机打开领取更方便哦~");
});
};
}
$self.$set = ($props2) => {
if ("activityItem" in $props2) $invalidate(0, activityItem = $props2.activityItem);
};
return [activityItem, handleGo, handleCopy, platform2];
}
class ActivityText extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$3, create_fragment$4, safe_not_equal, { activityItem: 0, platform: 3 });
}
get platform() {
return this.$.ctx[3];
}
}
function get_each_context$1(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[4] = list[i];
return child_ctx;
}
function create_if_block$2(ctx) {
let div;
let switch_instance;
let t;
let current;
let mounted2;
let dispose;
var switch_value = (
/*getComponent*/
ctx[2](
/*item*/
ctx[4].type
)
);
function switch_props(ctx2, dirty) {
return {
props: {
activityItem: (
/*item*/
ctx2[4]
),
platform: (
/*platform*/
ctx2[1]
)
}
};
}
if (switch_value) {
switch_instance = construct_svelte_component(switch_value, switch_props(ctx));
}
return {
c() {
div = element("div");
if (switch_instance) create_component(switch_instance.$.fragment);
t = space();
attr(div, "class", "activity-item svelte-tumn8m");
},
m(target, anchor) {
insert(target, div, anchor);
if (switch_instance) mount_component(switch_instance, div, null);
append(div, t);
current = true;
if (!mounted2) {
dispose = listen(div, "click", function() {
if (is_function(
/*handleGo*/
ctx[3](
/*item*/
ctx[4]
)
)) ctx[3](
/*item*/
ctx[4]
).apply(this, arguments);
});
mounted2 = true;
}
},
p(new_ctx, dirty) {
ctx = new_ctx;
if (dirty & /*data*/
1 && switch_value !== (switch_value = /*getComponent*/
ctx[2](
/*item*/
ctx[4].type
))) {
if (switch_instance) {
group_outros();
const old_component = switch_instance;
transition_out(old_component.$.fragment, 1, 0, () => {
destroy_component(old_component, 1);
});
check_outros();
}
if (switch_value) {
switch_instance = construct_svelte_component(switch_value, switch_props(ctx));
create_component(switch_instance.$.fragment);
transition_in(switch_instance.$.fragment, 1);
mount_component(switch_instance, div, t);
} else {
switch_instance = null;
}
} else if (switch_value) {
const switch_instance_changes = {};
if (dirty & /*data*/
1) switch_instance_changes.activityItem = /*item*/
ctx[4];
if (dirty & /*platform*/
2) switch_instance_changes.platform = /*platform*/
ctx[1];
switch_instance.$set(switch_instance_changes);
}
},
i(local) {
if (current) return;
if (switch_instance) transition_in(switch_instance.$.fragment, local);
current = true;
},
o(local) {
if (switch_instance) transition_out(switch_instance.$.fragment, local);
current = false;
},
d(detaching) {
if (detaching) {
detach(div);
}
if (switch_instance) destroy_component(switch_instance);
mounted2 = false;
dispose();
}
};
}
function create_each_block$1(ctx) {
let show_if = (
/*getComponent*/
ctx[2](
/*item*/
ctx[4].type
)
);
let if_block_anchor;
let current;
let if_block = show_if && create_if_block$2(ctx);
return {
c() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
insert(target, if_block_anchor, anchor);
current = true;
},
p(ctx2, dirty) {
if (dirty & /*data*/
1) show_if = /*getComponent*/
ctx2[2](
/*item*/
ctx2[4].type
);
if (show_if) {
if (if_block) {
if_block.p(ctx2, dirty);
if (dirty & /*data*/
1) {
transition_in(if_block, 1);
}
} else {
if_block = create_if_block$2(ctx2);
if_block.c();
transition_in(if_block, 1);
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
group_outros();
transition_out(if_block, 1, 1, () => {
if_block = null;
});
check_outros();
}
},
i(local) {
if (current) return;
transition_in(if_block);
current = true;
},
o(local) {
transition_out(if_block);
current = false;
},
d(detaching) {
if (detaching) {
detach(if_block_anchor);
}
if (if_block) if_block.d(detaching);
}
};
}
function create_fragment$3(ctx) {
let div;
let current;
let each_value = ensure_array_like(
/*data*/
ctx[0]
);
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i));
}
const out = (i) => transition_out(each_blocks[i], 1, 1, () => {
each_blocks[i] = null;
});
return {
c() {
div = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr(div, "class", "activity-grid svelte-tumn8m");
},
m(target, anchor) {
insert(target, div, anchor);
for (let i = 0; i < each_blocks.length; i += 1) {
if (each_blocks[i]) {
each_blocks[i].m(div, null);
}
}
current = true;
},
p(ctx2, [dirty]) {
if (dirty & /*handleGo, data, getComponent, platform*/
15) {
each_value = ensure_array_like(
/*data*/
ctx2[0]
);
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context$1(ctx2, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block$1(child_ctx);
each_blocks[i].c();
transition_in(each_blocks[i], 1);
each_blocks[i].m(div, null);
}
}
group_outros();
for (i = each_value.length; i < each_blocks.length; i += 1) {
out(i);
}
check_outros();
}
},
i(local) {
if (current) return;
for (let i = 0; i < each_value.length; i += 1) {
transition_in(each_blocks[i]);
}
current = true;
},
o(local) {
each_blocks = each_blocks.filter(Boolean);
for (let i = 0; i < each_blocks.length; i += 1) {
transition_out(each_blocks[i]);
}
current = false;
},
d(detaching) {
if (detaching) {
detach(div);
}
destroy_each(each_blocks, detaching);
}
};
}
function instance$2($self, $props, $invalidate) {
let { data = [] } = $props;
let { platform: platform2 } = $props;
function getComponent(type) {
switch (type) {
case ActivityType.IMG:
return ActivityImg;
case ActivityType.IMAGETEXT:
return ActivityImgText;
case ActivityType.TEXT:
return ActivityText;
default:
return null;
}
}
function handleGo(item) {
return () => {
if (!item || !item.url || item.url === "") {
return;
}
openWindow(item.url);
};
}
$self.$set = ($props2) => {
if ("data" in $props2) $invalidate(0, data = $props2.data);
if ("platform" in $props2) $invalidate(1, platform2 = $props2.platform);
};
return [data, platform2, getComponent, handleGo];
}
class TabContainer extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$2, create_fragment$3, safe_not_equal, { data: 0, platform: 1 });
}
}
function get_each_context(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[10] = list[i].data;
child_ctx[11] = list[i].platform;
child_ctx[13] = i;
return child_ctx;
}
function get_each_context_1(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[14] = list[i].name;
child_ctx[16] = i;
return child_ctx;
}
function create_if_block$1(ctx) {
let div;
let span;
let t0;
let t1_value = (
/*activityList*/
ctx[1].title + ""
);
let t1;
let t2_value = (
/*activityList*/
ctx[1].hot ? "🔥" : ""
);
let t2;
let t3;
let t4;
let modal;
let current;
let mounted2;
let dispose;
modal = new Modal({
props: {
show: (
/*showModal*/
ctx[0]
),
title: (
/*activityList*/
ctx[1].title
),
$slots: { default: [create_default_slot$1] },
$scope: { ctx }
}
});
modal.$on(
"close",
/*closeModal*/
ctx[4]
);
return {
c() {
div = element("div");
span = element("span");
t0 = text("(");
t1 = text(t1_value);
t2 = text(t2_value);
t3 = text(")");
t4 = space();
create_component(modal.$.fragment);
attr(span, "class", "activity-title svelte-1xq8gez");
set_style(div, "display", "inline-block");
},
m(target, anchor) {
insert(target, div, anchor);
append(div, span);
append(span, t0);
append(span, t1);
append(span, t2);
append(span, t3);
append(div, t4);
mount_component(modal, div, null);
current = true;
if (!mounted2) {
dispose = listen(
span,
"click",
/*openModal*/
ctx[3]
);
mounted2 = true;
}
},
p(ctx2, dirty) {
if ((!current || dirty & /*activityList*/
2) && t1_value !== (t1_value = /*activityList*/
ctx2[1].title + "")) set_data(t1, t1_value);
if ((!current || dirty & /*activityList*/
2) && t2_value !== (t2_value = /*activityList*/
ctx2[1].hot ? "🔥" : "")) set_data(t2, t2_value);
const modal_changes = {};
if (dirty & /*showModal*/
1) modal_changes.show = /*showModal*/
ctx2[0];
if (dirty & /*activityList*/
2) modal_changes.title = /*activityList*/
ctx2[1].title;
if (dirty & /*$scope, activityList, $activeTab*/
131078) {
modal_changes.$scope = { dirty, ctx: ctx2 };
}
modal.$set(modal_changes);
},
i(local) {
if (current) return;
transition_in(modal.$.fragment, local);
current = true;
},
o(local) {
transition_out(modal.$.fragment, local);
current = false;
},
d(detaching) {
if (detaching) {
detach(div);
}
destroy_component(modal);
mounted2 = false;
dispose();
}
};
}
function create_each_block_1(ctx) {
let button;
let t0_value = (
/*name*/
ctx[14] + ""
);
let t0;
let t1;
let mounted2;
let dispose;
function click_handler() {
return (
/*click_handler*/
ctx[7](
/*index*/
ctx[16]
)
);
}
return {
c() {
button = element("button");
t0 = text(t0_value);
t1 = space();
attr(button, "class", "tab-button svelte-1xq8gez");
toggle_class(
button,
"selected",
/*$activeTab*/
ctx[2] === /*index*/
ctx[16]
);
},
m(target, anchor) {
insert(target, button, anchor);
append(button, t0);
append(button, t1);
if (!mounted2) {
dispose = listen(button, "click", click_handler);
mounted2 = true;
}
},
p(new_ctx, dirty) {
ctx = new_ctx;
if (dirty & /*activityList*/
2 && t0_value !== (t0_value = /*name*/
ctx[14] + "")) set_data(t0, t0_value);
if (dirty & /*$activeTab*/
4) {
toggle_class(
button,
"selected",
/*$activeTab*/
ctx[2] === /*index*/
ctx[16]
);
}
},
d(detaching) {
if (detaching) {
detach(button);
}
mounted2 = false;
dispose();
}
};
}
function create_if_block_1$1(ctx) {
let tabcontainer;
let current;
tabcontainer = new TabContainer({
props: {
data: (
/*data*/
ctx[10]
),
platform: (
/*platform*/
ctx[11]
)
}
});
return {
c() {
create_component(tabcontainer.$.fragment);
},
m(target, anchor) {
mount_component(tabcontainer, target, anchor);
current = true;
},
p(ctx2, dirty) {
const tabcontainer_changes = {};
if (dirty & /*activityList*/
2) tabcontainer_changes.data = /*data*/
ctx2[10];
if (dirty & /*activityList*/
2) tabcontainer_changes.platform = /*platform*/
ctx2[11];
tabcontainer.$set(tabcontainer_changes);
},
i(local) {
if (current) return;
transition_in(tabcontainer.$.fragment, local);
current = true;
},
o(local) {
transition_out(tabcontainer.$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(tabcontainer, detaching);
}
};
}
function create_each_block(ctx) {
let if_block_anchor;
let current;
let if_block = (
/*$activeTab*/
ctx[2] === /*tabIndex*/
ctx[13] && create_if_block_1$1(ctx)
);
return {
c() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
insert(target, if_block_anchor, anchor);
current = true;
},
p(ctx2, dirty) {
if (
/*$activeTab*/
ctx2[2] === /*tabIndex*/
ctx2[13]
) {
if (if_block) {
if_block.p(ctx2, dirty);
if (dirty & /*$activeTab*/
4) {
transition_in(if_block, 1);
}
} else {
if_block = create_if_block_1$1(ctx2);
if_block.c();
transition_in(if_block, 1);
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
group_outros();
transition_out(if_block, 1, 1, () => {
if_block = null;
});
check_outros();
}
},
i(local) {
if (current) return;
transition_in(if_block);
current = true;
},
o(local) {
transition_out(if_block);
current = false;
},
d(detaching) {
if (detaching) {
detach(if_block_anchor);
}
if (if_block) if_block.d(detaching);
}
};
}
function create_default_slot$1(ctx) {
let div2;
let div0;
let t;
let div1;
let current;
let each_value_1 = ensure_array_like(
/*activityList*/
ctx[1].tabs
);
let each_blocks_1 = [];
for (let i = 0; i < each_value_1.length; i += 1) {
each_blocks_1[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
}
let each_value = ensure_array_like(
/*activityList*/
ctx[1].tabs
);
let each_blocks = [];
for (let i = 0; i < each_value.length; i += 1) {
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
}
const out = (i) => transition_out(each_blocks[i], 1, 1, () => {
each_blocks[i] = null;
});
return {
c() {
div2 = element("div");
div0 = element("div");
for (let i = 0; i < each_blocks_1.length; i += 1) {
each_blocks_1[i].c();
}
t = space();
div1 = element("div");
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
attr(div0, "class", "tab-header svelte-1xq8gez");
attr(div1, "class", "tab-content svelte-1xq8gez");
set_style(div1, "max-height", "450px");
attr(div2, "class", "modal-content svelte-1xq8gez");
},
m(target, anchor) {
insert(target, div2, anchor);
append(div2, div0);
for (let i = 0; i < each_blocks_1.length; i += 1) {
if (each_blocks_1[i]) {
each_blocks_1[i].m(div0, null);
}
}
append(div2, t);
append(div2, div1);
for (let i = 0; i < each_blocks.length; i += 1) {
if (each_blocks[i]) {
each_blocks[i].m(div1, null);
}
}
current = true;
},
p(ctx2, dirty) {
if (dirty & /*$activeTab, switchTab, activityList*/
70) {
each_value_1 = ensure_array_like(
/*activityList*/
ctx2[1].tabs
);
let i;
for (i = 0; i < each_value_1.length; i += 1) {
const child_ctx = get_each_context_1(ctx2, each_value_1, i);
if (each_blocks_1[i]) {
each_blocks_1[i].p(child_ctx, dirty);
} else {
each_blocks_1[i] = create_each_block_1(child_ctx);
each_blocks_1[i].c();
each_blocks_1[i].m(div0, null);
}
}
for (; i < each_blocks_1.length; i += 1) {
each_blocks_1[i].d(1);
}
each_blocks_1.length = each_value_1.length;
}
if (dirty & /*activityList, $activeTab*/
6) {
each_value = ensure_array_like(
/*activityList*/
ctx2[1].tabs
);
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context(ctx2, each_value, i);
if (each_blocks[i]) {
each_blocks[i].p(child_ctx, dirty);
transition_in(each_blocks[i], 1);
} else {
each_blocks[i] = create_each_block(child_ctx);
each_blocks[i].c();
transition_in(each_blocks[i], 1);
each_blocks[i].m(div1, null);
}
}
group_outros();
for (i = each_value.length; i < each_blocks.length; i += 1) {
out(i);
}
check_outros();
}
},
i(local) {
if (current) return;
for (let i = 0; i < each_value.length; i += 1) {
transition_in(each_blocks[i]);
}
current = true;
},
o(local) {
each_blocks = each_blocks.filter(Boolean);
for (let i = 0; i < each_blocks.length; i += 1) {
transition_out(each_blocks[i]);
}
current = false;
},
d(detaching) {
if (detaching) {
detach(div2);
}
destroy_each(each_blocks_1, detaching);
destroy_each(each_blocks, detaching);
}
};
}
function create_fragment$2(ctx) {
var _a;
let if_block_anchor;
let current;
let if_block = (
/*activityList*/
ctx[1] && /*activityList*/
((_a = ctx[1]) == null ? void 0 : _a.show) && create_if_block$1(ctx)
);
return {
c() {
if (if_block) if_block.c();
if_block_anchor = empty();
},
m(target, anchor) {
if (if_block) if_block.m(target, anchor);
insert(target, if_block_anchor, anchor);
current = true;
},
p(ctx2, [dirty]) {
var _a2;
if (
/*activityList*/
ctx2[1] && /*activityList*/
((_a2 = ctx2[1]) == null ? void 0 : _a2.show)
) {
if (if_block) {
if_block.p(ctx2, dirty);
if (dirty & /*activityList*/
2) {
transition_in(if_block, 1);
}
} else {
if_block = create_if_block$1(ctx2);
if_block.c();
transition_in(if_block, 1);
if_block.m(if_block_anchor.parentNode, if_block_anchor);
}
} else if (if_block) {
group_outros();
transition_out(if_block, 1, 1, () => {
if_block = null;
});
check_outros();
}
},
i(local) {
if (current) return;
transition_in(if_block);
current = true;
},
o(local) {
transition_out(if_block);
current = false;
},
d(detaching) {
if (detaching) {
detach(if_block_anchor);
}
if (if_block) if_block.d(detaching);
}
};
}
function instance$1($self, $props, $invalidate) {
let $platform;
let $activeTab;
component_subscribe($self, platform, ($value) => $invalidate(8, $platform = $value));
let showModal = false;
let activityList = null;
function openModal() {
$invalidate(0, showModal = true);
}
function closeModal() {
$invalidate(0, showModal = false);
}
let activeTab = writable(0);
component_subscribe($self, activeTab, (value) => $invalidate(2, $activeTab = value));
function switchTab(index) {
activeTab.set(index);
}
async function fetchActivity() {
const json = await get(API.getActivitySets, {});
const { data } = json;
if (data) {
$invalidate(1, activityList = data);
checkIsOpenedActivity(data, $platform);
}
}
onMount(() => {
fetchActivity();
});
const click_handler = (index) => switchTab(index);
return [
showModal,
activityList,
$activeTab,
openModal,
closeModal,
activeTab,
switchTab,
click_handler
];
}
class Container extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance$1, create_fragment$2, safe_not_equal, {});
}
}
function create_if_block(ctx) {
let div3;
let div0;
let t0_value = (
/*$coupon*/
ctx[2].couponInfo != null && /*$coupon*/
ctx[2].couponInfo != "" ? "优惠满减券" : "暂无优惠券"
);
let t0;
let t1;
let activitycontainer;
let t2;
let t3;
let hisprice;
let t4;
let div2;
let span;
let t5_value = getScanText(
/*$platform*/
ctx[3]
) + "";
let t5;
let t6_value = (
/*$coupon*/
ctx[2].couponInfo != null && /*$coupon*/
ctx[2].couponInfo != "" ? "领取" : "下单"
);
let t6;
let t7;
let t8;
let div1;
let qrcode;
let t9;
let current;
let mounted2;
let dispose;
activitycontainer = new Container({});
let if_block0 = (
/*$coupon*/
ctx[2].couponInfo != null && /*$coupon*/
ctx[2].couponInfo != "" && create_if_block_2(ctx)
);
hisprice = new HisPrice({});
qrcode = new QrCode({
props: {
url: (
/*$coupon*/
ctx[2].shortUrl
),
logo: getPlatformLogo(
/*$platform*/
ctx[3]
),
logoWidth: getLogoWidth(
/*$platform*/
ctx[3]
)
}
});
let if_block1 = (
/*$coupon*/
ctx[2].couponInfo != null && /*$coupon*/
ctx[2].couponInfo != "" && create_if_block_1(ctx)
);
return {
c() {
div3 = element("div");
div0 = element("div");
t0 = text(t0_value);
t1 = space();
create_component(activitycontainer.$.fragment);
t2 = space();
if (if_block0) if_block0.c();
t3 = space();
create_component(hisprice.$.fragment);
t4 = space();
div2 = element("div");
span = element("span");
t5 = text(t5_value);
t6 = text(t6_value);
t7 = text(":");
t8 = space();
div1 = element("div");
create_component(qrcode.$.fragment);
t9 = space();
if (if_block1) if_block1.c();
attr(div0, "class", "title svelte-ykcexl");
attr(div1, "title", "官方二维码,点击可放大");
set_style(div1, "cursor", "pointer");
attr(div2, "class", "qrcodezk svelte-ykcexl");
attr(div3, "class", "coupon-box svelte-ykcexl");
},
m(target, anchor) {
insert(target, div3, anchor);
append(div3, div0);
append(div0, t0);
append(div0, t1);
mount_component(activitycontainer, div0, null);
append(div3, t2);
if (if_block0) if_block0.m(div3, null);
append(div3, t3);
mount_component(hisprice, div3, null);
append(div3, t4);
append(div3, div2);
append(div2, span);
append(span, t5);
append(span, t6);
append(span, t7);
append(div2, t8);
append(div2, div1);
mount_component(qrcode, div1, null);
append(div3, t9);
if (if_block1) if_block1.m(div3, null);
current = true;
if (!mounted2) {
dispose = listen(
div1,
"click",
/*handleShowQrCode*/
ctx[4]()
);
mounted2 = true;
}
},
p(ctx2, dirty) {
if ((!current || dirty & /*$coupon*/
4) && t0_value !== (t0_value = /*$coupon*/
ctx2[2].couponInfo != null && /*$coupon*/
ctx2[2].couponInfo != "" ? "优惠满减券" : "暂无优惠券")) set_data(t0, t0_value);
if (
/*$coupon*/
ctx2[2].couponInfo != null && /*$coupon*/
ctx2[2].couponInfo != ""
) {
if (if_block0) {
if_block0.p(ctx2, dirty);
} else {
if_block0 = create_if_block_2(ctx2);
if_block0.c();
if_block0.m(div3, t3);
}
} else if (if_block0) {
if_block0.d(1);
if_block0 = null;
}
if ((!current || dirty & /*$platform*/
8) && t5_value !== (t5_value = getScanText(
/*$platform*/
ctx2[3]
) + "")) set_data(t5, t5_value);
if ((!current || dirty & /*$coupon*/
4) && t6_value !== (t6_value = /*$coupon*/
ctx2[2].couponInfo != null && /*$coupon*/
ctx2[2].couponInfo != "" ? "领取" : "下单")) set_data(t6, t6_value);
const qrcode_changes = {};
if (dirty & /*$coupon*/
4) qrcode_changes.url = /*$coupon*/
ctx2[2].shortUrl;
if (dirty & /*$platform*/
8) qrcode_changes.logo = getPlatformLogo(
/*$platform*/
ctx2[3]
);
if (dirty & /*$platform*/
8) qrcode_changes.logoWidth = getLogoWidth(
/*$platform*/
ctx2[3]
);
qrcode.$set(qrcode_changes);
if (
/*$coupon*/
ctx2[2].couponInfo != null && /*$coupon*/
ctx2[2].couponInfo != ""
) {
if (if_block1) {
if_block1.p(ctx2, dirty);
} else {
if_block1 = create_if_block_1(ctx2);
if_block1.c();
if_block1.m(div3, null);
}
} else if (if_block1) {
if_block1.d(1);
if_block1 = null;
}
},
i(local) {
if (current) return;
transition_in(activitycontainer.$.fragment, local);
transition_in(hisprice.$.fragment, local);
transition_in(qrcode.$.fragment, local);
current = true;
},
o(local) {
transition_out(activitycontainer.$.fragment, local);
transition_out(hisprice.$.fragment, local);
transition_out(qrcode.$.fragment, local);
current = false;
},
d(detaching) {
if (detaching) {
detach(div3);
}
destroy_component(activitycontainer);
if (if_block0) if_block0.d();
destroy_component(hisprice);
destroy_component(qrcode);
if (if_block1) if_block1.d();
mounted2 = false;
dispose();
}
};
}
function create_if_block_2(ctx) {
let div5;
let div0;
let span0;
let t1;
let span1;
let t2_value = (
/*$coupon*/
(ctx[2].price ?? getPrice(
/*$coupon*/
ctx[2].couponInfo
)) + ""
);
let t2;
let t3;
let span2;
let t5;
let div1;
let t6;
let div4;
let div2;
let t7_value = (
/*$coupon*/
ctx[2].couponInfo + ""
);
let t7;
let t8;
let div3;
let t9;
let t10_value = (
/*$coupon*/
ctx[2].couponEndTime + ""
);
let t10;
let t11;
let mounted2;
let dispose;
let if_block = (
/*$coupon*/
ctx[2].remainCount != null && /*$coupon*/
ctx[2].remainCount != "" && create_if_block_3(ctx)
);
return {
c() {
div5 = element("div");
div0 = element("div");
span0 = element("span");
span0.textContent = "¥";
t1 = space();
span1 = element("span");
t2 = text(t2_value);
t3 = space();
span2 = element("span");
span2.textContent = "元";
t5 = space();
div1 = element("div");
t6 = space();
div4 = element("div");
div2 = element("div");
t7 = text(t7_value);
t8 = space();
div3 = element("div");
t9 = text("有效期至:");
t10 = text(t10_value);
t11 = space();
if (if_block) if_block.c();
attr(span0, "class", "symbol svelte-ykcexl");
attr(span1, "class", "price svelte-ykcexl");
attr(span2, "class", "unit svelte-ykcexl");
attr(div0, "class", "left svelte-ykcexl");
attr(div1, "class", "middle svelte-ykcexl");
attr(div2, "class", "desc svelte-ykcexl");
attr(div3, "class", "time svelte-ykcexl");
attr(div4, "class", "right svelte-ykcexl");
attr(div5, "class", "coupon svelte-ykcexl");
},
m(target, anchor) {
insert(target, div5, anchor);
append(div5, div0);
append(div0, span0);
append(div0, t1);
append(div0, span1);
append(span1, t2);
append(div0, t3);
append(div0, span2);
append(div5, t5);
append(div5, div1);
append(div5, t6);
append(div5, div4);
append(div4, div2);
append(div2, t7);
append(div4, t8);
append(div4, div3);
append(div3, t9);
append(div3, t10);
append(div4, t11);
if (if_block) if_block.m(div4, null);
if (!mounted2) {
dispose = listen(
div5,
"click",
/*handleGo*/
ctx[6]
);
mounted2 = true;
}
},
p(ctx2, dirty) {
if (dirty & /*$coupon*/
4 && t2_value !== (t2_value = /*$coupon*/
(ctx2[2].price ?? getPrice(
/*$coupon*/
ctx2[2].couponInfo
)) + "")) set_data(t2, t2_value);
if (dirty & /*$coupon*/
4 && t7_value !== (t7_value = /*$coupon*/
ctx2[2].couponInfo + "")) set_data(t7, t7_value);
if (dirty & /*$coupon*/
4 && t10_value !== (t10_value = /*$coupon*/
ctx2[2].couponEndTime + "")) set_data(t10, t10_value);
if (
/*$coupon*/
ctx2[2].remainCount != null && /*$coupon*/
ctx2[2].remainCount != ""
) {
if (if_block) {
if_block.p(ctx2, dirty);
} else {
if_block = create_if_block_3(ctx2);
if_block.c();
if_block.m(div4, null);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
},
d(detaching) {
if (detaching) {
detach(div5);
}
if (if_block) if_block.d();
mounted2 = false;
dispose();
}
};
}
function create_if_block_3(ctx) {
let div;
let t0;
let t1_value = (
/*$coupon*/
ctx[2].remainCount + ""
);
let t1;
return {
c() {
div = element("div");
t0 = text("剩余:");
t1 = text(t1_value);
attr(div, "class", "remain svelte-ykcexl");
},
m(target, anchor) {
insert(target, div, anchor);
append(div, t0);
append(div, t1);
},
p(ctx2, dirty) {
if (dirty & /*$coupon*/
4 && t1_value !== (t1_value = /*$coupon*/
ctx2[2].remainCount + "")) set_data(t1, t1_value);
},
d(detaching) {
if (detaching) {
detach(div);
}
}
};
}
function create_if_block_1(ctx) {
let div;
let button0;
let t1;
let button1;
let mounted2;
let dispose;
return {
c() {
div = element("div");
button0 = element("button");
button0.textContent = "分享好友";
t1 = space();
button1 = element("button");
button1.textContent = "立即领取";
attr(button0, "class", "svelte-ykcexl");
attr(button1, "class", "svelte-ykcexl");
attr(div, "class", "action svelte-ykcexl");
},
m(target, anchor) {
insert(target, div, anchor);
append(div, button0);
append(div, t1);
append(div, button1);
if (!mounted2) {
dispose = [
listen(
button0,
"click",
/*handleCopy*/
ctx[5]
),
listen(
button1,
"click",
/*handleGo*/
ctx[6]
)
];
mounted2 = true;
}
},
p: noop,
d(detaching) {
if (detaching) {
detach(div);
}
mounted2 = false;
run_all(dispose);
}
};
}
function create_default_slot(ctx) {
var _a;
let qrcode;
let current;
qrcode = new QrCode({
props: {
url: (
/*$coupon*/
(_a = ctx[2]) == null ? void 0 : _a.shortUrl
),
width: 250,
height: 250,
logo: getPlatformLogo(
/*$platform*/
ctx[3]
),
logoWidth: getLogoWidth(
/*$platform*/
ctx[3],
2
)
}
});
return {
c() {
create_component(qrcode.$.fragment);
},
m(target, anchor) {
mount_component(qrcode, target, anchor);
current = true;
},
p(ctx2, dirty) {
var _a2;
const qrcode_changes = {};
if (dirty & /*$coupon*/
4) qrcode_changes.url = /*$coupon*/
(_a2 = ctx2[2]) == null ? void 0 : _a2.shortUrl;
if (dirty & /*$platform*/
8) qrcode_changes.logo = getPlatformLogo(
/*$platform*/
ctx2[3]
);
if (dirty & /*$platform*/
8) qrcode_changes.logoWidth = getLogoWidth(
/*$platform*/
ctx2[3],
2
);
qrcode.$set(qrcode_changes);
},
i(local) {
if (current) return;
transition_in(qrcode.$.fragment, local);
current = true;
},
o(local) {
transition_out(qrcode.$.fragment, local);
current = false;
},
d(detaching) {
destroy_component(qrcode, detaching);
}
};
}
function create_fragment$1(ctx) {
let div;
let toasts2;
let t0;
let t1;
let modal;
let current;
toasts2 = new Toasts({});
let if_block = (
/*$coupon*/
ctx[2] != null && create_if_block(ctx)
);
modal = new Modal({
props: {
show: (
/*showModal*/
ctx[0]
),
title: (
/*modalTitle*/
ctx[1]
),
$slots: { default: [create_default_slot] },
$scope: { ctx }
}
});
modal.$on(
"close",
/*close_handler*/
ctx[7]
);
return {
c() {
div = element("div");
create_component(toasts2.$.fragment);
t0 = space();
if (if_block) if_block.c();
t1 = space();
create_component(modal.$.fragment);
attr(div, "class", "container svelte-ykcexl");
},
m(target, anchor) {
insert(target, div, anchor);
mount_component(toasts2, div, null);
append(div, t0);
if (if_block) if_block.m(div, null);
append(div, t1);
mount_component(modal, div, null);
current = true;
},
p(ctx2, [dirty]) {
if (
/*$coupon*/
ctx2[2] != null
) {
if (if_block) {
if_block.p(ctx2, dirty);
if (dirty & /*$coupon*/
4) {
transition_in(if_block, 1);
}
} else {
if_block = create_if_block(ctx2);
if_block.c();
transition_in(if_block, 1);
if_block.m(div, t1);
}
} else if (if_block) {
group_outros();
transition_out(if_block, 1, 1, () => {
if_block = null;
});
check_outros();
}
const modal_changes = {};
if (dirty & /*showModal*/
1) modal_changes.show = /*showModal*/
ctx2[0];
if (dirty & /*modalTitle*/
2) modal_changes.title = /*modalTitle*/
ctx2[1];
if (dirty & /*$scope, $coupon, $platform*/
268) {
modal_changes.$scope = { dirty, ctx: ctx2 };
}
modal.$set(modal_changes);
},
i(local) {
if (current) return;
transition_in(toasts2.$.fragment, local);
transition_in(if_block);
transition_in(modal.$.fragment, local);
current = true;
},
o(local) {
transition_out(toasts2.$.fragment, local);
transition_out(if_block);
transition_out(modal.$.fragment, local);
current = false;
},
d(detaching) {
if (detaching) {
detach(div);
}
destroy_component(toasts2);
if (if_block) if_block.d();
destroy_component(modal);
}
};
}
function instance($self, $props, $invalidate) {
let $coupon;
let $platform;
component_subscribe($self, coupon, ($value) => $invalidate(2, $coupon = $value));
component_subscribe($self, platform, ($value) => $invalidate(3, $platform = $value));
let showModal = false;
let modalTitle = "";
function handleShowQrCode() {
return () => {
if ($platform == Platform.Taobao) {
$invalidate(1, modalTitle = "天猫/淘宝APP扫码购买");
} else {
$invalidate(1, modalTitle = `微信扫码,${getPlatformName($platform)}官网购买`);
}
$invalidate(0, showModal = true);
};
}
function handleCopy() {
if ($coupon == null) {
return;
}
const text2 = getCopyText($coupon);
copy(text2, () => {
addToast({
type: "success",
message: getToastMsg($platform),
dismissible: true,
timeout: 5e3
});
});
}
function handleGo() {
if (Platform.Vip == $platform) {
document.querySelector(".J-getCouponBtn").click();
return;
}
if (($coupon == null ? void 0 : $coupon.shortUrl) != null && ($coupon == null ? void 0 : $coupon.shortUrl) != "") {
openWindow($coupon.shortUrl);
window.close();
}
}
const close_handler = () => $invalidate(0, showModal = false);
return [
showModal,
modalTitle,
$coupon,
$platform,
handleShowQrCode,
handleCopy,
handleGo,
close_handler
];
}
class Coupon extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment$1, safe_not_equal, {});
}
}
function getUrlParams(url) {
let queryString = window.location.search;
const params = new URLSearchParams(queryString);
const queryParams = {};
for (const [key, value] of params.entries()) {
queryParams[key] = value;
}
return queryParams;
}
function create_fragment(ctx) {
let main;
let show_if = !isProduction();
let t;
let coupon2;
let current;
let if_block = show_if;
coupon2 = new Coupon({});
return {
c() {
main = element("main");
t = space();
create_component(coupon2.$.fragment);
},
m(target, anchor) {
insert(target, main, anchor);
append(main, t);
mount_component(coupon2, main, null);
current = true;
},
p: noop,
i(local) {
if (current) return;
transition_in(if_block);
transition_in(coupon2.$.fragment, local);
current = true;
},
o(local) {
transition_out(if_block);
transition_out(coupon2.$.fragment, local);
current = false;
},
d(detaching) {
if (detaching) {
detach(main);
}
destroy_component(coupon2);
}
};
}
class App extends SvelteComponent {
constructor(options) {
super();
init(this, options, null, create_fragment, safe_not_equal, {});
}
}
const originalXHR = XMLHttpRequest.prototype.open;
const originalSend = XMLHttpRequest.prototype.send;
const originalSetRequestHeader = XMLHttpRequest.prototype.setRequestHeader;
const blockedRequests$1 = [];
function interceptXHR(shouldBlockRequest2) {
XMLHttpRequest.prototype.open = function(method, url, ...args) {
const u = url.toString();
if (shouldBlockRequest2(u)) {
const interceptedHeaders = {};
const blockedRequest = {
method,
url: u,
type: "xhr",
headers: interceptedHeaders
};
const originalSetHeader = this.setRequestHeader;
this.setRequestHeader = function(key, value) {
interceptedHeaders[key] = value;
originalSetHeader.call(this, key, value);
};
this.send;
this.send = function(body) {
blockedRequest.body = body;
blockedRequest.credentials = this.withCredentials ? "include" : "same-origin";
return new Promise((resolve, reject) => {
blockedRequest.resolve = resolve;
blockedRequest.reject = reject;
blockedRequests$1.push(blockedRequest);
});
};
originalXHR.call(this, method, url, ...args);
} else {
originalXHR.call(this, method, url, ...args);
}
};
}
function restoreXHRRequests() {
XMLHttpRequest.prototype.open = originalXHR;
XMLHttpRequest.prototype.send = originalSend;
XMLHttpRequest.prototype.setRequestHeader = originalSetRequestHeader;
blockedRequests$1.forEach(
({ method, url, headers, body, credentials, resolve, reject }) => {
const xhr = new XMLHttpRequest();
xhr.open(method, url);
if (credentials === "include") {
xhr.withCredentials = true;
}
if (headers) {
Object.entries(headers).forEach(([key, value]) => {
xhr.setRequestHeader(key, value);
});
}
xhr.onload = () => {
if (xhr.status >= 200 && xhr.status < 300) {
resolve == null ? void 0 : resolve(xhr.responseText);
} else {
reject == null ? void 0 : reject(
new Error(
`Request failed with status ${xhr.status}: ${xhr.statusText}`
)
);
}
};
xhr.onerror = () => reject == null ? void 0 : reject(new Error(`Network error: ${xhr.statusText}`));
xhr.ontimeout = () => reject == null ? void 0 : reject(new Error(`Request timed out`));
xhr.send(body);
}
);
blockedRequests$1.length = 0;
}
const originalFetch = window.fetch;
let canBlock = true;
const blockedRequests = [];
function interceptFetch(shouldBlockRequest2) {
try {
window.fetch = function(input, init2) {
const url = typeof input === "string" ? input : input.toString();
const options = typeof input === "string" ? init2 : input;
if (shouldBlockRequest2(url)) {
return new Promise((resolve, reject) => {
blockedRequests.push({
method: (options == null ? void 0 : options.method) || "GET",
url,
options,
credentials: (options == null ? void 0 : options.credentials) || "same-origin",
resolve,
reject,
type: "fetch"
});
});
}
return originalFetch(input, init2);
};
} catch (error) {
canBlock = false;
console.error("Error intercepting fetch:", error);
}
}
function restoreFetchRequests() {
if (canBlock) {
window.fetch = originalFetch;
blockedRequests.forEach(
({ method, url, options, credentials, resolve, reject }) => {
const fetchOptions = {
...options,
credentials
// 设置 `credentials` 恢复 Cookie
};
originalFetch(url, fetchOptions).then(resolve).catch(reject);
}
);
blockedRequests.length = 0;
}
}
let whiteList = [];
let shouldBlockRequest;
function initRequestManager(config) {
shouldBlockRequest = (url) => {
const isWhiteListed = whiteList.some(
(allowedUrl) => url.includes(allowedUrl)
);
if (isWhiteListed) {
return false;
}
if (config == null ? void 0 : config.urls) {
return config.urls.some((allowedUrl) => url.includes(allowedUrl));
}
if (config == null ? void 0 : config.matchUrlPattern) {
return config.matchUrlPattern.test(url);
}
return true;
};
interceptXHR(shouldBlockRequest);
interceptFetch(shouldBlockRequest);
}
function restoreRequests() {
restoreXHRRequests();
restoreFetchRequests();
}
function addToWhiteList(url) {
whiteList.push(url);
}
function initJDBlock() {
const href = location.href;
if (href.includes(HOST.JD.HOME)) {
initRequestManager({
matchUrlPattern: /blackhole\.m\.jd\.com\/bypass/
});
}
if (href.includes(HOST.JD.DETAIL) || href.includes(HOST.JD.YIYAO_DETAIL) || href.includes(HOST.JD.GLOBAL_DETAIL) || href.includes(HOST.JD.IC_DETAIL) || href.includes(HOST.JD.I_DETAIL)) {
initRequestManager();
addToWhiteList(transformLink);
addToWhiteList(lvt);
addToWhiteList("functionId=pc_detailpage_wareBusiness");
}
}
async function initBlock() {
initJDBlock();
}
async function waitForElement(selector) {
return new Promise((resolve) => {
const existingElement = document.querySelector(selector);
if (existingElement) {
return resolve(existingElement);
}
const observer = new MutationObserver(() => {
const targetElement = document.querySelector(selector);
if (targetElement) {
resolve(targetElement);
observer.disconnect();
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
});
}
async function waitForDOMReady() {
return new Promise((resolve) => {
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", resolve);
} else {
resolve(0);
}
});
}
function isGoodsDetailPage(url) {
if (!url) return false;
if (url.includes(HOST.JD.DETAIL) || url.includes(HOST.JD.YIYAO_DETAIL) || url.includes(HOST.JD.GLOBAL_DETAIL) || url.includes(HOST.JD.IC_DETAIL) || url.includes(HOST.JD.I_DETAIL) || url.includes(HOST.JD.HEALTH_DETAIL))
return true;
return false;
}
let transformLinks = {};
function addTransformLink(url, data) {
transformLinks[url] = data;
}
function getTransformLink(url) {
return (transformLinks == null ? void 0 : transformLinks[url]) ?? null;
}
function initJDGoodsClick(event) {
const host = location.host;
switch (host) {
case "www.jd.com":
initHomeGoodsClick(event);
break;
case "item.jd.com":
case "npcitem.jd.hk":
case "item.yiyaojd.com":
case "i-item.jd.com":
case "ic-item.jd.com":
initOpenComment(event);
case "search.jd.com":
initSearchGoodsClick(event);
break;
}
}
async function initHomeGoodsClick(event) {
var _a, _b;
const target = event.target;
const link = target == null ? void 0 : target.closest("a.more2_lk");
if (link) {
event.preventDefault();
let url = link.getAttribute("href");
target.style.cursor = "wait";
if (!url.includes("https")) {
url = "https:" + url;
}
const tl = getTransformLink(url);
if ((tl == null ? void 0 : tl.url) && (tl == null ? void 0 : tl.url) != "") {
await waitForTs((tl == null ? void 0 : tl.ts) ?? Date.now() - 2e4);
openWindow(tl == null ? void 0 : tl.url);
post(API.vwLvt, {
url,
short_url: tl == null ? void 0 : tl.url,
platform: Platform.JD,
ts: (tl == null ? void 0 : tl.ts) ?? 0,
now: Date.now(),
src: "home-c"
});
} else {
try {
const json = await fetchTransformLink({
platform: Platform.JD,
url,
timeout: 3e3
});
if (json && json.data) {
const ts = json.data.ts ?? Date.now() - 2e4;
addTransformLink(url, {
...json.data,
ts
});
await waitForTs(ts);
}
post(API.vwLvt, {
url,
short_url: ((_a = json == null ? void 0 : json.data) == null ? void 0 : _a.url) ?? null,
platform: Platform.JD,
ts: (tl == null ? void 0 : tl.ts) ?? 0,
now: Date.now(),
src: "home-f"
});
openWindow(((_b = json == null ? void 0 : json.data) == null ? void 0 : _b.url) ?? url);
} catch (e) {
post(API.vwLvt, {
url,
short_url: null,
platform: Platform.JD,
ts: (tl == null ? void 0 : tl.ts) ?? 0,
now: Date.now(),
src: "home-f"
});
openWindow(url);
}
}
}
target.style.cursor = "pointer";
}
async function initSearchGoodsClick(event) {
var _a, _b;
const target = event.target;
const link = target == null ? void 0 : target.closest("a");
if (link) {
let url = link.getAttribute("href");
if (!url.includes("https")) {
url = "https:" + url;
}
if (!isGoodsDetailPage(url)) {
return;
}
event.preventDefault();
target.style.cursor = "wait";
const tl = getTransformLink(url);
if ((tl == null ? void 0 : tl.url) && (tl == null ? void 0 : tl.url) != "") {
await waitForTs((tl == null ? void 0 : tl.ts) ?? Date.now() - 2e4);
openWindow(tl == null ? void 0 : tl.url);
post(API.vwLvt, {
url,
short_url: tl == null ? void 0 : tl.url,
platform: Platform.JD,
ts: (tl == null ? void 0 : tl.ts) ?? 0,
now: Date.now(),
src: "search-c"
});
} else {
try {
const json = await fetchTransformLink({
platform: Platform.JD,
url,
timeout: 3e3
});
if (json && json.data) {
const ts = json.data.ts ?? Date.now() - 2e4;
addTransformLink(url, {
...json.data,
ts
});
await waitForTs(ts);
}
post(API.vwLvt, {
url,
short_url: ((_a = json == null ? void 0 : json.data) == null ? void 0 : _a.url) ?? null,
platform: Platform.JD,
ts: (tl == null ? void 0 : tl.ts) ?? 0,
now: Date.now(),
src: "search-f"
});
openWindow(((_b = json == null ? void 0 : json.data) == null ? void 0 : _b.url) ?? url);
} catch (e) {
post(API.vwLvt, {
url,
short_url: null,
platform: Platform.JD,
ts: (tl == null ? void 0 : tl.ts) ?? 0,
now: Date.now(),
src: "search-f"
});
openWindow(url);
}
}
}
target.style.cursor = "pointer";
}
async function initOpenComment(event) {
const target = event.target;
const el = target == null ? void 0 : target.closest("#comment-count");
if (el) {
const node = document.querySelector(
"[data-anchor='#comment']"
);
node == null ? void 0 : node.scrollIntoView({
behavior: "smooth",
block: "start"
});
await waitForElement("#comm-curr-sku");
await wait(300);
const currentComment = document.querySelector("#comm-curr-sku");
if (!(currentComment == null ? void 0 : currentComment.checked)) {
currentComment == null ? void 0 : currentComment.click();
}
}
}
function initZKBuyClick(event) {
const target = event.target;
let url = target.getAttribute("href");
if (url) {
event.preventDefault();
openWindow(url);
}
}
function initEvent(platform2) {
document.body.addEventListener("click", function(event) {
switch (platform2) {
case Platform.JD:
initJDGoodsClick(event);
break;
case Platform.ZK:
initZKBuyClick(event);
break;
}
});
}
class TaskQueue {
// 任务队列
constructor(maxConcurrency) {
__publicField(this, "maxConcurrency");
// 最大并发数
__publicField(this, "activeCount", 0);
// 当前正在执行的任务数
__publicField(this, "taskQueue", []);
this.maxConcurrency = maxConcurrency;
}
// 添加任务
add(task) {
this.taskQueue.push(task);
this.runTask();
}
// 运行任务
async runTask() {
if (this.activeCount >= this.maxConcurrency || this.taskQueue.length === 0) {
return;
}
this.activeCount++;
const task = this.taskQueue.shift();
if (task) {
try {
await task();
} catch (error) {
console.error("Task execution error:", error);
} finally {
this.activeCount--;
this.runTask();
}
}
}
}
async function initJDPrefetch() {
const host = location.host;
const homeSelector = ".more2_list .more2_item_good a";
const searchSelector = "#J_goodsList .p-img a";
switch (host) {
case "www.jd.com":
await waitForElement(homeSelector);
initPrefetch$1(homeSelector);
break;
case "search.jd.com":
await waitForElement(searchSelector);
initPrefetch$1(searchSelector);
break;
}
}
function initPrefetch$1(selector) {
const itemsSet = /* @__PURE__ */ new Set();
const taskQueue = new TaskQueue(20);
async function processLinks() {
const items = document.querySelectorAll(selector);
items.forEach((item) => {
const task = async () => {
let link = item.getAttribute("href") ?? "";
if (!link.includes("https")) {
link = "https:" + link;
}
if (!itemsSet.has(link)) {
itemsSet.add(link);
const json = await fetchTransformLink({
platform: Platform.JD,
url: link,
dl: false
});
if (json && json.data) {
const ts = json.data.ts ?? Date.now() - 2e4;
addTransformLink(link, {
...json.data,
ts
});
}
}
};
taskQueue.add(task);
});
}
processLinks();
let throttleTimeout = null;
window.addEventListener("scroll", () => {
if (throttleTimeout) return;
throttleTimeout = setTimeout(() => {
throttleTimeout = null;
processLinks();
}, 500);
});
}
async function initPrefetch() {
await wait(1100);
initJDPrefetch();
}
async function initJDRedirect() {
const flag = checkCanRedirect$2();
if (flag) {
const json = await fetchTransformLink({
platform: Platform.JD
});
if (json && json.data && json.data.url) {
if (!window.GM_openInTab) {
window.location.replace(json.data.url);
} else {
const ts = json.data.ts ?? Date.now() - 2e4;
await waitForTs(ts);
post(API.vwLvt, {
url: getOriginalUrl(Platform.JD),
short_url: json.data.url,
href: location.href,
platform: Platform.JD,
ts: ts ?? 0,
now: Date.now(),
src: "detail-f"
});
await wait(100);
await openWindow(json.data.url);
window.close();
}
} else {
restoreRequests();
}
} else {
restoreRequests();
}
}
function checkCanRedirect$2() {
const href = window.location.href;
return !(href.includes("2015895618") || href.includes("2035344819") || href.includes("2035856307"));
}
async function initTMallRedirect() {
const flag = checkCanRedirect$1();
if (flag) {
const json = await fetchTransformLink({
platform: Platform.Taobao
});
if (json && json.data && json.data.url) {
if (!window.GM_openInTab) {
window.location.replace(json.data.url);
} else {
await openWindow(json.data.url);
window.close();
}
}
}
}
function checkCanRedirect$1() {
const href = window.location.href;
return href.indexOf("mm_117425171_2324550020_111391250310") == -1 && href.indexOf("mm_117425171_21428696_71990812") == -1 && href.indexOf("mm_117425171_33696257_277458675") == -1;
}
async function initVIPRedirect() {
const flag = checkCanRedirect();
if (flag) {
const json = await fetchTransformLink({
platform: Platform.Vip
});
if (json && json.data && json.data.url) {
if (!window.GM_openInTab) {
window.location.replace(json.data.url);
} else {
await openWindow(json.data.url);
window.close();
}
}
}
}
function checkCanRedirect() {
const href = window.location.href;
return href.indexOf("a1bea5af456e316c7745ed3ca2a379e6") == -1 && href.indexOf("f938d6787b301f8cd8d258aa477437a3") == -1 && href.indexOf("41c6df95c56c4de075bf27fffb06af9f") == -1 && (window.location.pathname.indexOf("detail-") > -1 || window.location.hostname.indexOf("m.vip.com") > -1);
}
async function initRedirect() {
const href = location.href;
if (href.includes(HOST.JD.DETAIL) || href.includes(HOST.JD.I_DETAIL) || href.includes(HOST.JD.YIYAO_DETAIL) || href.includes(HOST.JD.GLOBAL_DETAIL) || href.includes(HOST.JD.IC_DETAIL)) {
await initJDRedirect();
} else if (href.includes(HOST.TMALL.DETAIL) || href.includes(HOST.TMALL.TB_DETAIL) || href.includes(HOST.TMALL.CHAOSHI_DETAIL) || href.includes(HOST.TMALL.GLOBAL_DETAIL) || href.includes(HOST.TMALL.GLOBAL_HK_DETAIL)) {
initTMallRedirect();
} else if (href.includes(HOST.VIP.DETAIL) || href.includes(HOST.VIP.GLOABL_DETAIL) || href.includes(HOST.VIP.H5_DETAIL)) {
initVIPRedirect();
}
}
function clear() {
clearLocalStorage("73haz73_unique_url");
clearLocalStorage("tampermonkey_plugin_je82j45");
clearSessionStorage("tampermonkey_plugin_je82j45");
deleteGMValue(GM_KEY.JD_GOODS_LIST);
deleteGMValue(GM_KEY.JD_GOODS_LIST2);
deleteGMValue(GM_KEY.JD_GOODS_LIST3);
deleteGMValue(GM_KEY.JD_HAS_COUPON_URL);
}
async function createTarget(target) {
const div = document.createElement("div");
return new Promise((resolve) => {
let timer = 0;
function addSibling() {
let t = null;
for (const item of target) {
t = document.querySelector(item);
if (t) {
break;
}
}
if (t) {
t.after(div);
clearTimeout(timer);
resolve(div);
} else {
timer = setTimeout(addSibling, 100);
}
}
timer = setTimeout(addSibling, 100);
});
}
function daysToMs(days) {
return days * 24 * 60 * 60 * 1e3;
}
async function checkAndUpdate() {
const now2 = Date.now();
const t = await getGMValue(GM_KEY.VERSION_CHECK_TIME, "0") ?? "0";
const isForce = (await getGMValue(GM_KEY.VERSION_IS_FORCE, "0") ?? "0") == "1";
const lastCheckTime = parseInt(t, 10);
if (now2 - lastCheckTime < daysToMs(0.02) && !isForce) return;
try {
const res = await get(API.checkVersion);
await setGMValue(GM_KEY.VERSION_CHECK_TIME, now2 + "");
if (!res || !res.data) {
await setGMValue(GM_KEY.VERSION_IS_FORCE, "0");
return;
}
const { force, url } = res.data;
if (force) {
await setGMValue(GM_KEY.VERSION_IS_FORCE, "1");
openWindow(url);
} else {
await setGMValue(GM_KEY.VERSION_IS_FORCE, "0");
const t2 = await getGMValue(GM_KEY.VERSION_UPDATE_TIME, "0") ?? "0";
const lastUpdateTime = parseInt(t2, 10);
if (now2 - lastUpdateTime >= daysToMs(10)) {
openWindow(url);
await setGMValue(GM_KEY.VERSION_UPDATE_TIME, now2 + "");
}
}
} catch (error) {
}
}
async function mountedTaobao() {
const { id } = getUrlParams();
if (id == null || id == "") {
return;
}
const { title } = await getTitle(Platform.Taobao);
const json = await get(API.getTaobaoCouponUrl, {
goodsId: id,
url: location.href,
title
});
if (json.data != null) {
coupon.updateCoupon(json.data);
const target = await createTarget(
json.data.selector ?? [".Price--root--1CrVGjc"]
);
new App({
target
});
}
}
async function mountedJd() {
const url = getOriginalUrl(Platform.JD);
const json = await get(API.getJdCouponUrl, {
url
});
if (json.data != null) {
coupon.updateCoupon(json.data);
const target = await createTarget(json.data.selector ?? [".summary-first"]);
new App({
target
});
}
}
async function mountedVip() {
const url = getOriginalUrl(Platform.Vip);
if (isMobile()) {
return;
}
const json = await get(API.getVipCouponUrl, {
url
});
if (json.data != null) {
coupon.updateCoupon(json.data);
const target = await createTarget(
json.data.selector ?? ["#J-pi-price-box"]
);
new App({
target
});
}
}
async function mounted() {
savePlugin();
await initUUID();
const platform2 = ensurePlatform();
const execFlag = canExec();
if (execFlag) {
initBlock();
await initRedirect();
}
clear();
await waitForDOMReady();
if (execFlag) {
initPrefetch();
initEvent(platform2);
}
switch (platform2) {
case Platform.Taobao:
mountedTaobao();
break;
case Platform.JD:
mountedJd();
break;
case Platform.Vip:
mountedVip();
break;
}
{
checkAndUpdate();
}
}
mounted();
})(CryptoJS, QRCode);
})();