淘宝、天猫、京东、唯品会优惠券小助手
// ==UserScript==
// @name 淘宝、天猫、京东、唯品会优惠券小助手
// @namespace https://api.jasonzk.com
// @version v1.0.0
// @description 最新简洁好用的淘宝、天猫、京东、唯品会优惠券小助手,查找隐藏优惠券,提供历史比价、手机扫码下单
// @author JasonZK
// @license MIT
// @require https://cdn.bootcdn.net/ajax/libs/crypto-js/4.0.0/crypto-js.min.js
// @match *://*.taobao.com/*
// @match *://*.tmall.com/*
// @match *://*.tmall.hk/*
// @match *://*.detail.tmall.com/*
// @match *://*.liangxinyao.com/*
// @match *://*.jd.com/*
// @match *://*.jd.hk/*
// @match *://*.yiyaojd.com/*
// @match *://*.vip.com/*
// @match *://*.vipglobal.hk/*
// @exclude *://login.taobao.com/*
// @exclude *://uland.taobao.com/*
// @exclude *://login.tmall.com/*
// @exclude *://pages.tmall.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/yCmMPKtMZL9LzKwrjd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RjFit754QeYvQhdcb0tduSqFsNwdySQLB1ISjIzFqEk1NlVPtyMgbiKM7JUQCQQQimqV3BULl3lXRQJFCi9gVmJkAPKDZTem10QXoixaGFzbkHpY8xChJxWZ1f5nRhNRmgkEgihDCgvWPGe9iNXJzGe9EQCySu/2o3uxWxDKIPqUzS6LxFHzkcCZRdEbmd2IaRROYHQp9SO3FpMqSdmFt4mr/bMJoTcos6u8gcwqW4hKcWDBwyZ+k4mEUIuVP/Xiz/Q3lWeiKMkIoF6F4WymTUImbDeNjQyUOqqMK9LMq9PfuldzBKEDFSsq3xheCNGFmM33c4R8oLau8rHIqV9HAkk3b6YDAh5SLaII790lY9FAuUOLb2eq4+Ql9fb1HqSrCt529AiK1Xx7ENcbYT8tN4mEUeBcJ3HDG0fkUAI+fmVtKOrfKjFC93Orxky+v1cVYRQVq83w3kGRxxV9A5GbuQqIoQuUk5+5D71xLPIEDOrVkebHueqIYSurM6Io3pXRwKpblxcLIRQ0rJ1lT/lEjM7F3tFHhK9lquDEEpZefnh69ojjnQa2uzs4Og7uBoIIceUk1/2iDKXdRk2s+1EAiGE0qfOiKNDaTWzQPg4kUAIoYxJjlwp03lT6sMcNrTW3ED4LSKBEEJaJOcq28+T9nQzQcyxJC8QvZlRRQhplzxZqfOW/6qMaX43Cnilt8Li3EDoh30Lon0YRYSQKyXdy9Ur5MOqT+n3cwpDv88tiBTF0jLUa6VaK/uDmJj0VeBIE0qH/hfGd9mrkNPGNgAAAABJRU5ErkJggg==
// @antifeature referral-link
// @grant unsafeWindow
// ==/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);
return value;
};
(function(CryptoJS2) {
"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-1wow8bn{position:fixed;top:0;left:0;right:0;width:100%;display:flex;margin-top:1rem;justify-content:center;flex-direction:column;z-index:1000}.container.svelte-g10q8u.svelte-g10q8u{margin:10px 0;font-family:"Microsoft YaHei";font-size:16px}.container.svelte-g10q8u .coupon-box.svelte-g10q8u{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-g10q8u .coupon-box .title.svelte-g10q8u{font-size:30px;font-weight:bold;margin-bottom:20px;line-height:1.1}.container.svelte-g10q8u .coupon-box .coupon.svelte-g10q8u{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-g10q8u .coupon-box .coupon .left.svelte-g10q8u{display:flex;align-items:center;font-weight:bold}.container.svelte-g10q8u .coupon-box .coupon .left .symbol.svelte-g10q8u{color:#5e391d;font-size:20px;align-self:flex-end}.container.svelte-g10q8u .coupon-box .coupon .left .price.svelte-g10q8u{color:#ab6f41;font-size:50px;margin-right:4px;line-height:0.9}.container.svelte-g10q8u .coupon-box .coupon .left .unit.svelte-g10q8u{color:#785539;font-size:14px;align-self:flex-start}.container.svelte-g10q8u .coupon-box .coupon .middle.svelte-g10q8u{width:2px;height:60px;background-color:#aa896f;margin:0 10px}.container.svelte-g10q8u .coupon-box .coupon .right.svelte-g10q8u{display:flex;flex-direction:column;align-items:baseline}.container.svelte-g10q8u .coupon-box .coupon .right .desc.svelte-g10q8u{color:#372312;line-height:1;margin-bottom:6px}.container.svelte-g10q8u .coupon-box .coupon .right .time.svelte-g10q8u{line-height:1;margin-bottom:6px}.container.svelte-g10q8u .coupon-box .coupon .right .remain.svelte-g10q8u{line-height:1}.container.svelte-g10q8u .coupon-box .price-container.svelte-g10q8u{display:flex;flex-direction:column;gap:6px;margin:12px 0;align-self:flex-start}.container.svelte-g10q8u .coupon-box .price-container .high-price.svelte-g10q8u{color:rgb(225, 12, 12)}.container.svelte-g10q8u .coupon-box .price-container .low-price.svelte-g10q8u{color:rgb(5, 133, 5)}.container.svelte-g10q8u .coupon-box .qrcode.svelte-g10q8u{margin-top:20px;display:flex;justify-content:space-between;align-items:center;font-size:16px}.container.svelte-g10q8u .coupon-box .action.svelte-g10q8u{margin-top:20px}.container.svelte-g10q8u .coupon-box .action button.svelte-g10q8u:first-child{margin-right:10px}.container.svelte-g10q8u button.svelte-g10q8u{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-g10q8u button.svelte-g10q8u:hover,.container.svelte-g10q8u button.svelte-g10q8u:focus{border-color:#a26233;box-shadow:0 0 8px rgba(0, 0, 0, 0.2)}.container.svelte-g10q8u button.svelte-g10q8u:active{box-shadow:0 0 4px rgba(0, 0, 0, 0.2);transform:scale(0.98);border-color:#8c4f26}';
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 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 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 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 custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {
return new CustomEvent(type, { detail, bubbles, cancelable });
}
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 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;
};
}
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() {
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().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";
return UrlType2;
})(UrlType || {});
var Platform = /* @__PURE__ */ ((Platform2) => {
Platform2[Platform2["Taobao"] = 1] = "Taobao";
Platform2[Platform2["JD"] = 2] = "JD";
Platform2[Platform2["Vip"] = 3] = "Vip";
return Platform2;
})(Platform || {});
function createPlatform() {
const { subscribe: subscribe2, set, update: update2 } = writable(null);
return {
subscribe: subscribe2,
updatePlatform: (data) => update2(() => data)
};
}
const platform = createPlatform();
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));
};
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 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 "使用手机京东APP扫码";
case Platform.Vip:
return "使用手机唯品会APP扫码";
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 checkCanRedirect(platform2, coupon2, url) {
const search = window.location.search;
if (coupon2.shortUrl != null && coupon2.shortUrl != "" && coupon2.shortUrl != url) {
if (coupon2.couponInfo == null || coupon2.couponInfo == "") {
switch (platform2) {
case Platform.Taobao:
return search.indexOf("mm_117425171_2324550020_111391250310") == -1;
case Platform.JD:
return search.indexOf("2015895618") == -1;
case Platform.Vip:
return search.indexOf("dtk_1873303") == -1 && window.location.pathname.indexOf("detail-") > -1;
default:
return false;
}
}
return false;
}
return false;
}
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$7(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$6($$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$6, create_fragment$7, safe_not_equal, { width: 0 });
}
}
function create_fragment$6(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$5($$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$5, create_fragment$6, safe_not_equal, { width: 0 });
}
}
function create_fragment$5(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$4($$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$4, create_fragment$5, safe_not_equal, { width: 0 });
}
}
function create_fragment$4(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$3($$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$3, create_fragment$4, 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$1(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$1(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$2(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$3(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$1, create_if_block_2$1, 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$2(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$2(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$2($$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$2, create_fragment$3, safe_not_equal, { type: 0, dismissible: 1 });
}
}
function get_each_context(ctx, list, i) {
const child_ctx = ctx.slice();
child_ctx[2] = list[i];
return child_ctx;
}
function create_if_block$1(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(ctx, each_value, i);
let key = get_key(child_ctx);
each_1_lookup.set(key, each_blocks[i] = create_each_block(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-1wow8bn");
},
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, null, get_each_context);
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(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(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] },
$$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$2(ctx) {
let if_block_anchor;
let current;
let if_block = (
/*$toasts*/
ctx[0] && 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]) {
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$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 $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$1, create_fragment$2, safe_not_equal, {});
}
}
function create_if_block(ctx) {
let div1;
let div0;
let t0_value = (
/*$coupon*/
ctx[0].couponInfo != null && /*$coupon*/
ctx[0].couponInfo != "" ? "优惠满减券" : "暂无优惠券"
);
let t0;
let t1;
let t2;
let t3;
let t4;
let if_block0 = (
/*$coupon*/
ctx[0].couponInfo != null && /*$coupon*/
ctx[0].couponInfo != "" && create_if_block_4(ctx)
);
let if_block1 = (
/*$coupon*/
ctx[0].maxPrice != null && /*$coupon*/
ctx[0].maxPrice != "" && create_if_block_3(ctx)
);
let if_block2 = (
/*$coupon*/
ctx[0].qrcode != null && /*$coupon*/
ctx[0].qrcode.length > 0 && create_if_block_2(ctx)
);
let if_block3 = (
/*$coupon*/
ctx[0].couponInfo != null && /*$coupon*/
ctx[0].couponInfo != "" && create_if_block_1(ctx)
);
return {
c() {
div1 = element("div");
div0 = element("div");
t0 = text(t0_value);
t1 = space();
if (if_block0)
if_block0.c();
t2 = space();
if (if_block1)
if_block1.c();
t3 = space();
if (if_block2)
if_block2.c();
t4 = space();
if (if_block3)
if_block3.c();
attr(div0, "class", "title svelte-g10q8u");
attr(div1, "class", "coupon-box svelte-g10q8u");
},
m(target, anchor) {
insert(target, div1, anchor);
append(div1, div0);
append(div0, t0);
append(div1, t1);
if (if_block0)
if_block0.m(div1, null);
append(div1, t2);
if (if_block1)
if_block1.m(div1, null);
append(div1, t3);
if (if_block2)
if_block2.m(div1, null);
append(div1, t4);
if (if_block3)
if_block3.m(div1, null);
},
p(ctx2, dirty) {
if (dirty & /*$coupon*/
1 && t0_value !== (t0_value = /*$coupon*/
ctx2[0].couponInfo != null && /*$coupon*/
ctx2[0].couponInfo != "" ? "优惠满减券" : "暂无优惠券"))
set_data(t0, t0_value);
if (
/*$coupon*/
ctx2[0].couponInfo != null && /*$coupon*/
ctx2[0].couponInfo != ""
) {
if (if_block0) {
if_block0.p(ctx2, dirty);
} else {
if_block0 = create_if_block_4(ctx2);
if_block0.c();
if_block0.m(div1, t2);
}
} else if (if_block0) {
if_block0.d(1);
if_block0 = null;
}
if (
/*$coupon*/
ctx2[0].maxPrice != null && /*$coupon*/
ctx2[0].maxPrice != ""
) {
if (if_block1) {
if_block1.p(ctx2, dirty);
} else {
if_block1 = create_if_block_3(ctx2);
if_block1.c();
if_block1.m(div1, t3);
}
} else if (if_block1) {
if_block1.d(1);
if_block1 = null;
}
if (
/*$coupon*/
ctx2[0].qrcode != null && /*$coupon*/
ctx2[0].qrcode.length > 0
) {
if (if_block2) {
if_block2.p(ctx2, dirty);
} else {
if_block2 = create_if_block_2(ctx2);
if_block2.c();
if_block2.m(div1, t4);
}
} else if (if_block2) {
if_block2.d(1);
if_block2 = null;
}
if (
/*$coupon*/
ctx2[0].couponInfo != null && /*$coupon*/
ctx2[0].couponInfo != ""
) {
if (if_block3) {
if_block3.p(ctx2, dirty);
} else {
if_block3 = create_if_block_1(ctx2);
if_block3.c();
if_block3.m(div1, null);
}
} else if (if_block3) {
if_block3.d(1);
if_block3 = null;
}
},
d(detaching) {
if (detaching) {
detach(div1);
}
if (if_block0)
if_block0.d();
if (if_block1)
if_block1.d();
if (if_block2)
if_block2.d();
if (if_block3)
if_block3.d();
}
};
}
function create_if_block_4(ctx) {
let div5;
let div0;
let span0;
let t1;
let span1;
let t2_value = getPrice(
/*$coupon*/
ctx[0].couponInfo
) + "";
let t2;
let t3;
let span2;
let t5;
let div1;
let t6;
let div4;
let div2;
let t7_value = (
/*$coupon*/
ctx[0].couponInfo + ""
);
let t7;
let t8;
let div3;
let t9;
let t10_value = (
/*$coupon*/
ctx[0].couponEndTime + ""
);
let t10;
let t11;
let mounted2;
let dispose;
let if_block = (
/*$coupon*/
ctx[0].remainCount != null && /*$coupon*/
ctx[0].remainCount != "" && create_if_block_5(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-g10q8u");
attr(span1, "class", "price svelte-g10q8u");
attr(span2, "class", "unit svelte-g10q8u");
attr(div0, "class", "left svelte-g10q8u");
attr(div1, "class", "middle svelte-g10q8u");
attr(div2, "class", "desc svelte-g10q8u");
attr(div3, "class", "time svelte-g10q8u");
attr(div4, "class", "right svelte-g10q8u");
attr(div5, "class", "coupon svelte-g10q8u");
},
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[3]
);
mounted2 = true;
}
},
p(ctx2, dirty) {
if (dirty & /*$coupon*/
1 && t2_value !== (t2_value = getPrice(
/*$coupon*/
ctx2[0].couponInfo
) + ""))
set_data(t2, t2_value);
if (dirty & /*$coupon*/
1 && t7_value !== (t7_value = /*$coupon*/
ctx2[0].couponInfo + ""))
set_data(t7, t7_value);
if (dirty & /*$coupon*/
1 && t10_value !== (t10_value = /*$coupon*/
ctx2[0].couponEndTime + ""))
set_data(t10, t10_value);
if (
/*$coupon*/
ctx2[0].remainCount != null && /*$coupon*/
ctx2[0].remainCount != ""
) {
if (if_block) {
if_block.p(ctx2, dirty);
} else {
if_block = create_if_block_5(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_5(ctx) {
let div;
let t0;
let t1_value = (
/*$coupon*/
ctx[0].remainCount + ""
);
let t1;
return {
c() {
div = element("div");
t0 = text("剩余:");
t1 = text(t1_value);
attr(div, "class", "remain svelte-g10q8u");
},
m(target, anchor) {
insert(target, div, anchor);
append(div, t0);
append(div, t1);
},
p(ctx2, dirty) {
if (dirty & /*$coupon*/
1 && t1_value !== (t1_value = /*$coupon*/
ctx2[0].remainCount + ""))
set_data(t1, t1_value);
},
d(detaching) {
if (detaching) {
detach(div);
}
}
};
}
function create_if_block_3(ctx) {
let div2;
let div0;
let t0;
let t1_value = (
/*$coupon*/
ctx[0].maxPrice + ""
);
let t1;
let t2;
let t3_value = (
/*$coupon*/
ctx[0].maxDate + ""
);
let t3;
let t4;
let t5;
let div1;
let t6;
let t7_value = (
/*$coupon*/
ctx[0].minPrice + ""
);
let t7;
let t8;
let t9_value = (
/*$coupon*/
ctx[0].minDate + ""
);
let t9;
let t10;
return {
c() {
div2 = element("div");
div0 = element("div");
t0 = text("历史最高价:");
t1 = text(t1_value);
t2 = text("(");
t3 = text(t3_value);
t4 = text(")");
t5 = space();
div1 = element("div");
t6 = text("历史最低价:");
t7 = text(t7_value);
t8 = text("(");
t9 = text(t9_value);
t10 = text(")");
attr(div0, "class", "high-price svelte-g10q8u");
attr(div1, "class", "low-price svelte-g10q8u");
attr(div2, "class", "price-container svelte-g10q8u");
},
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 & /*$coupon*/
1 && t1_value !== (t1_value = /*$coupon*/
ctx2[0].maxPrice + ""))
set_data(t1, t1_value);
if (dirty & /*$coupon*/
1 && t3_value !== (t3_value = /*$coupon*/
ctx2[0].maxDate + ""))
set_data(t3, t3_value);
if (dirty & /*$coupon*/
1 && t7_value !== (t7_value = /*$coupon*/
ctx2[0].minPrice + ""))
set_data(t7, t7_value);
if (dirty & /*$coupon*/
1 && t9_value !== (t9_value = /*$coupon*/
ctx2[0].minDate + ""))
set_data(t9, t9_value);
},
d(detaching) {
if (detaching) {
detach(div2);
}
}
};
}
function create_if_block_2(ctx) {
let div;
let span;
let t0_value = getScanText(
/*$platform*/
ctx[1]
) + "";
let t0;
let t1_value = (
/*$coupon*/
ctx[0].couponInfo != null && /*$coupon*/
ctx[0].couponInfo != "" ? "领取" : "下单"
);
let t1;
let t2;
let t3;
let img;
let img_src_value;
return {
c() {
div = element("div");
span = element("span");
t0 = text(t0_value);
t1 = text(t1_value);
t2 = text(":");
t3 = space();
img = element("img");
attr(img, "width", "100px");
attr(img, "height", "100px");
attr(img, "alt", "qrcode");
if (!src_url_equal(img.src, img_src_value = /*$coupon*/
ctx[0].qrcode))
attr(img, "src", img_src_value);
attr(div, "class", "qrcode svelte-g10q8u");
},
m(target, anchor) {
insert(target, div, anchor);
append(div, span);
append(span, t0);
append(span, t1);
append(span, t2);
append(div, t3);
append(div, img);
},
p(ctx2, dirty) {
if (dirty & /*$platform*/
2 && t0_value !== (t0_value = getScanText(
/*$platform*/
ctx2[1]
) + ""))
set_data(t0, t0_value);
if (dirty & /*$coupon*/
1 && t1_value !== (t1_value = /*$coupon*/
ctx2[0].couponInfo != null && /*$coupon*/
ctx2[0].couponInfo != "" ? "领取" : "下单"))
set_data(t1, t1_value);
if (dirty & /*$coupon*/
1 && !src_url_equal(img.src, img_src_value = /*$coupon*/
ctx2[0].qrcode)) {
attr(img, "src", img_src_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-g10q8u");
attr(button1, "class", "svelte-g10q8u");
attr(div, "class", "action svelte-g10q8u");
},
m(target, anchor) {
insert(target, div, anchor);
append(div, button0);
append(div, t1);
append(div, button1);
if (!mounted2) {
dispose = [
listen(
button0,
"click",
/*handleCopy*/
ctx[2]
),
listen(
button1,
"click",
/*handleGo*/
ctx[3]
)
];
mounted2 = true;
}
},
p: noop,
d(detaching) {
if (detaching) {
detach(div);
}
mounted2 = false;
run_all(dispose);
}
};
}
function create_fragment$1(ctx) {
let div;
let toasts2;
let t;
let current;
toasts2 = new Toasts({});
let if_block = (
/*$coupon*/
ctx[0] != null && create_if_block(ctx)
);
return {
c() {
div = element("div");
create_component(toasts2.$$.fragment);
t = space();
if (if_block)
if_block.c();
attr(div, "class", "container svelte-g10q8u");
},
m(target, anchor) {
insert(target, div, anchor);
mount_component(toasts2, div, null);
append(div, t);
if (if_block)
if_block.m(div, null);
current = true;
},
p(ctx2, [dirty]) {
if (
/*$coupon*/
ctx2[0] != null
) {
if (if_block) {
if_block.p(ctx2, dirty);
} else {
if_block = create_if_block(ctx2);
if_block.c();
if_block.m(div, null);
}
} else if (if_block) {
if_block.d(1);
if_block = null;
}
},
i(local) {
if (current)
return;
transition_in(toasts2.$$.fragment, local);
current = true;
},
o(local) {
transition_out(toasts2.$$.fragment, local);
current = false;
},
d(detaching) {
if (detaching) {
detach(div);
}
destroy_component(toasts2);
if (if_block)
if_block.d();
}
};
}
function instance($$self, $$props, $$invalidate) {
let $coupon;
let $platform;
component_subscribe($$self, coupon, ($$value) => $$invalidate(0, $coupon = $$value));
component_subscribe($$self, platform, ($$value) => $$invalidate(1, $platform = $$value));
function handleCopy() {
if ($coupon == null) {
return;
}
const text2 = getCopyText($coupon);
navigator.clipboard.writeText(text2).then(() => {
addToast({
type: "success",
message: getToastMsg($platform),
dismissible: true,
timeout: 5e3
});
}).catch((error) => {
console.error("Failed to copy text:", error);
});
}
function handleGo() {
if (($coupon == null ? void 0 : $coupon.shortUrl) != null && ($coupon == null ? void 0 : $coupon.shortUrl) != "") {
window.location.replace($coupon == null ? void 0 : $coupon.shortUrl);
}
}
return [$coupon, $platform, handleCopy, handleGo];
}
class Coupon extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment$1, safe_not_equal, {});
}
}
const baseUrl = "https://api.jasonzk.com";
const getTaobaoCouponUrl = `${baseUrl}/taobao/coupon`;
const getJdCouponUrl = `${baseUrl}/jd/coupon`;
const getVipCouponUrl = `${baseUrl}/vip/coupon`;
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 = CryptoJS2.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 = CryptoJS2.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("");
}
async function get(url, data) {
const params = new URLSearchParams(data ?? {});
url = url + "?" + params.toString();
const { token, keyMap } = getToken();
return await fetch(url, {
headers: {
authorization: token,
authhash: keyMap
}
});
}
function create_fragment(ctx) {
let main;
let t;
let coupon2;
let current;
let if_block = false;
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, {});
}
}
function createScript(src) {
const script = document.createElement("script");
script.src = src;
script.setAttribute("type", "text/javascript");
document.getElementsByTagName("head").item(0).appendChild(script);
}
async function createTarget(target) {
const div = document.createElement("div");
return new Promise((resolve) => {
let timer = 0;
function addSibling() {
const t = document.querySelector(target);
if (t) {
t.after(div);
clearTimeout(timer);
resolve(div);
} else {
timer = setTimeout(addSibling, 300);
}
}
timer = setTimeout(addSibling, 300);
});
}
async function mountedTaobao() {
const { id } = getUrlParams();
if (id == null || id == "") {
return;
}
platform.updatePlatform(Platform.Taobao);
const res = await get(getTaobaoCouponUrl, {
goodsId: id,
url: location.href
});
const json = await res.json();
if (checkCanRedirect(Platform.Taobao, json.data, location.href)) {
window.location.replace(json.data.shortUrl);
return;
}
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 = window.location.origin + window.location.pathname;
platform.updatePlatform(Platform.JD);
const res = await get(getJdCouponUrl, {
url
});
const json = await res.json();
if (checkCanRedirect(Platform.JD, json.data, url)) {
window.location.replace(json.data.shortUrl);
return;
}
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 = window.location.origin + window.location.pathname;
platform.updatePlatform(Platform.Vip);
const res = await get(getVipCouponUrl, {
url
});
const json = await res.json();
if (checkCanRedirect(Platform.Vip, json.data, url)) {
window.location.replace(json.data.shortUrl);
return;
}
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() {
const url = window.location.host;
if (url.indexOf(UrlType.Taobao) != -1 || url.indexOf(UrlType.Tmall) != -1 || url.indexOf(UrlType.YYTmall) != -1) {
mountedTaobao();
} else if (url.indexOf(UrlType.JD) != -1) {
mountedJd();
} else if (url.indexOf(UrlType.Vip) != -1) {
mountedVip();
}
{
createScript(
"https://cdn.bootcdn.net/ajax/libs/crypto-js/4.0.0/crypto-js.min.js"
);
}
}
mounted();
})(CryptoJS);
})();