@ape.swap/bonds-sdk 2.0.4-testseed.34 → 2.0.4-testseed.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +776 -4
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -4,7 +4,6 @@ import { useWaitForTransactionReceipt, useChainId, useAccount, useSwitchChain, u
|
|
|
4
4
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import { ConnectButton as ConnectButton$1 } from '@rainbow-me/rainbowkit';
|
|
7
|
-
import domtoimage from 'dom-to-image';
|
|
8
7
|
|
|
9
8
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
10
9
|
|
|
@@ -6295,7 +6294,7 @@ const Text$1 = /*#__PURE__*/React__default.forwardRef(function Text(props, ref)
|
|
|
6295
6294
|
* Image style variants can be defined in the theme.images object.
|
|
6296
6295
|
* @see https://theme-ui.com/components/image/
|
|
6297
6296
|
*/
|
|
6298
|
-
const Image = /*#__PURE__*/React__default.forwardRef(function Image(props, ref) {
|
|
6297
|
+
const Image$1 = /*#__PURE__*/React__default.forwardRef(function Image(props, ref) {
|
|
6299
6298
|
const __outerCss = props.__css;
|
|
6300
6299
|
return jsx$2(Box$1, {
|
|
6301
6300
|
ref: ref,
|
|
@@ -72278,7 +72277,7 @@ const TokenSelectorPanel = ({ typedValue, setTypedValue, selectedToken, chainId,
|
|
|
72278
72277
|
: v.currentTarget.value.slice(0, v.currentTarget.value.length - 1);
|
|
72279
72278
|
} }) }), jsxs(Flex$1, { className: "input-container token", onClick: () => (enableZap ? onTokenSelectorModal() : null), sx: { cursor: enableZap ? 'pointer' : 'default' }, children: [jsxs(Flex$1, { children: [jsx$2(Flex$1, { className: "input-container bondicon", children: lodashExports.isArray(splited) ? (jsx$2(TokenImage, { symbol: splited[0], symbol2: splited[1], size: 28, chain: chainId })) : (jsx$2(TokenImage, { symbol: getSymbol(selectedToken, chainId), size: 28, chain: chainId })) }), jsx$2(Flex$1, { className: "title-container tokenname", children: getSymbol(selectedToken, chainId) })] }), enableZap && (jsx$2(Flex$1, { sx: { mr: '8px' }, children: jsx$2(Svg, { icon: "caret" }) }))] })] }), tokenBalance && (jsxs(Flex$1, { className: "input-container balancerow", children: [jsx$2(Flex$1, { children: selectedTokenPrice && typedValue
|
|
72280
72279
|
? `$${formatUSDNumber((selectedTokenPrice * parseFloat(typedValue)).toFixed(2))}`
|
|
72281
|
-
: '' }), jsxs(Flex$1, { children: [jsxs(Flex$1, { className: "balancerow text", children: ["Balance: ", tokenBalanceString] }), jsxs(Flex$1, { className: "balancerow max", children: [tokenBalance !== '0' && handleValueBtn && modalVariant !== 'alt' && (jsx$2(Fragment$1, { children: jsx$2(Button, { className: "max-button", onClick: () => { var _a; return handleValueBtn((_a = new BigNumber$1(tokenBalance !== null && tokenBalance !== void 0 ? tokenBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, children: "Max" }) })), tokenBalance !== '0' && handleValueBtn && modalVariant === 'alt' && (jsxs(
|
|
72280
|
+
: '' }), jsxs(Flex$1, { children: [jsxs(Flex$1, { className: "balancerow text", children: ["Balance: ", tokenBalanceString] }), jsxs(Flex$1, { className: "balancerow max", children: [tokenBalance !== '0' && handleValueBtn && modalVariant !== 'alt' && (jsx$2(Fragment$1, { children: jsx$2(Button, { className: "max-button", onClick: () => { var _a; return handleValueBtn((_a = new BigNumber$1(tokenBalance !== null && tokenBalance !== void 0 ? tokenBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, children: "Max" }) })), tokenBalance !== '0' && handleValueBtn && modalVariant === 'alt' && (jsxs(Flex$1, { children: [jsx$2(Button, { className: "max-button", onClick: () => handleValueBtn((parseFloat(tokenBalance) / 4).toString()), children: "25%" }), jsx$2(Button, { className: "max-button", onClick: () => handleValueBtn((parseFloat(tokenBalance) / 2).toString()), children: "50%" }), jsx$2(Button, { className: "max-button", onClick: () => handleValueBtn((parseFloat(tokenBalance) * 0.75).toString()), children: "75%" }), jsx$2(Button, { className: "max-button", onClick: () => { var _a; return handleValueBtn((_a = new BigNumber$1(tokenBalance !== null && tokenBalance !== void 0 ? tokenBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, children: "Max" })] }))] })] })] }))] }));
|
|
72282
72281
|
};
|
|
72283
72282
|
|
|
72284
72283
|
var NetworkNames;
|
|
@@ -73903,7 +73902,7 @@ const RecommendationCards$1 = () => {
|
|
|
73903
73902
|
color: 'grey',
|
|
73904
73903
|
fontSize: ['11px'],
|
|
73905
73904
|
fontWeight: 500,
|
|
73906
|
-
}, children: "BONDS MARKETS:" }), jsx$2(RecommendationSelector, { options: options, activeOption: activeOption, setActiveOption: setActiveOption })] }), jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex'] }, children: jsx$2(Image, { width: 190, height: 20, alt: "poweredBy", src: "/images/bills/powered.png", sx: {
|
|
73905
|
+
}, children: "BONDS MARKETS:" }), jsx$2(RecommendationSelector, { options: options, activeOption: activeOption, setActiveOption: setActiveOption })] }), jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex'] }, children: jsx$2(Image$1, { width: 190, height: 20, alt: "poweredBy", src: "/images/bills/powered.png", sx: {
|
|
73907
73906
|
width: '190px',
|
|
73908
73907
|
height: '20px',
|
|
73909
73908
|
cursor: 'pointer',
|
|
@@ -90600,6 +90599,779 @@ const ProjectViewWithProviders = (props) => {
|
|
|
90600
90599
|
return (jsx$2(Providers, { children: jsx$2(ProjectView, Object.assign({}, props)) }));
|
|
90601
90600
|
};
|
|
90602
90601
|
|
|
90602
|
+
var domToImage = {exports: {}};
|
|
90603
|
+
|
|
90604
|
+
(function (module) {
|
|
90605
|
+
(function (global) {
|
|
90606
|
+
|
|
90607
|
+
var util = newUtil();
|
|
90608
|
+
var inliner = newInliner();
|
|
90609
|
+
var fontFaces = newFontFaces();
|
|
90610
|
+
var images = newImages();
|
|
90611
|
+
|
|
90612
|
+
// Default impl options
|
|
90613
|
+
var defaultOptions = {
|
|
90614
|
+
// Default is to fail on error, no placeholder
|
|
90615
|
+
imagePlaceholder: undefined,
|
|
90616
|
+
// Default cache bust is false, it will use the cache
|
|
90617
|
+
cacheBust: false
|
|
90618
|
+
};
|
|
90619
|
+
|
|
90620
|
+
var domtoimage = {
|
|
90621
|
+
toSvg: toSvg,
|
|
90622
|
+
toPng: toPng,
|
|
90623
|
+
toJpeg: toJpeg,
|
|
90624
|
+
toBlob: toBlob,
|
|
90625
|
+
toPixelData: toPixelData,
|
|
90626
|
+
impl: {
|
|
90627
|
+
fontFaces: fontFaces,
|
|
90628
|
+
images: images,
|
|
90629
|
+
util: util,
|
|
90630
|
+
inliner: inliner,
|
|
90631
|
+
options: {}
|
|
90632
|
+
}
|
|
90633
|
+
};
|
|
90634
|
+
|
|
90635
|
+
module.exports = domtoimage;
|
|
90636
|
+
|
|
90637
|
+
|
|
90638
|
+
/**
|
|
90639
|
+
* @param {Node} node - The DOM Node object to render
|
|
90640
|
+
* @param {Object} options - Rendering options
|
|
90641
|
+
* @param {Function} options.filter - Should return true if passed node should be included in the output
|
|
90642
|
+
* (excluding node means excluding it's children as well). Not called on the root node.
|
|
90643
|
+
* @param {String} options.bgcolor - color for the background, any valid CSS color value.
|
|
90644
|
+
* @param {Number} options.width - width to be applied to node before rendering.
|
|
90645
|
+
* @param {Number} options.height - height to be applied to node before rendering.
|
|
90646
|
+
* @param {Object} options.style - an object whose properties to be copied to node's style before rendering.
|
|
90647
|
+
* @param {Number} options.quality - a Number between 0 and 1 indicating image quality (applicable to JPEG only),
|
|
90648
|
+
defaults to 1.0.
|
|
90649
|
+
* @param {String} options.imagePlaceholder - dataURL to use as a placeholder for failed images, default behaviour is to fail fast on images we can't fetch
|
|
90650
|
+
* @param {Boolean} options.cacheBust - set to true to cache bust by appending the time to the request url
|
|
90651
|
+
* @return {Promise} - A promise that is fulfilled with a SVG image data URL
|
|
90652
|
+
* */
|
|
90653
|
+
function toSvg(node, options) {
|
|
90654
|
+
options = options || {};
|
|
90655
|
+
copyOptions(options);
|
|
90656
|
+
return Promise.resolve(node)
|
|
90657
|
+
.then(function (node) {
|
|
90658
|
+
return cloneNode(node, options.filter, true);
|
|
90659
|
+
})
|
|
90660
|
+
.then(embedFonts)
|
|
90661
|
+
.then(inlineImages)
|
|
90662
|
+
.then(applyOptions)
|
|
90663
|
+
.then(function (clone) {
|
|
90664
|
+
return makeSvgDataUri(clone,
|
|
90665
|
+
options.width || util.width(node),
|
|
90666
|
+
options.height || util.height(node)
|
|
90667
|
+
);
|
|
90668
|
+
});
|
|
90669
|
+
|
|
90670
|
+
function applyOptions(clone) {
|
|
90671
|
+
if (options.bgcolor) clone.style.backgroundColor = options.bgcolor;
|
|
90672
|
+
|
|
90673
|
+
if (options.width) clone.style.width = options.width + 'px';
|
|
90674
|
+
if (options.height) clone.style.height = options.height + 'px';
|
|
90675
|
+
|
|
90676
|
+
if (options.style)
|
|
90677
|
+
Object.keys(options.style).forEach(function (property) {
|
|
90678
|
+
clone.style[property] = options.style[property];
|
|
90679
|
+
});
|
|
90680
|
+
|
|
90681
|
+
return clone;
|
|
90682
|
+
}
|
|
90683
|
+
}
|
|
90684
|
+
|
|
90685
|
+
/**
|
|
90686
|
+
* @param {Node} node - The DOM Node object to render
|
|
90687
|
+
* @param {Object} options - Rendering options, @see {@link toSvg}
|
|
90688
|
+
* @return {Promise} - A promise that is fulfilled with a Uint8Array containing RGBA pixel data.
|
|
90689
|
+
* */
|
|
90690
|
+
function toPixelData(node, options) {
|
|
90691
|
+
return draw(node, options || {})
|
|
90692
|
+
.then(function (canvas) {
|
|
90693
|
+
return canvas.getContext('2d').getImageData(
|
|
90694
|
+
0,
|
|
90695
|
+
0,
|
|
90696
|
+
util.width(node),
|
|
90697
|
+
util.height(node)
|
|
90698
|
+
).data;
|
|
90699
|
+
});
|
|
90700
|
+
}
|
|
90701
|
+
|
|
90702
|
+
/**
|
|
90703
|
+
* @param {Node} node - The DOM Node object to render
|
|
90704
|
+
* @param {Object} options - Rendering options, @see {@link toSvg}
|
|
90705
|
+
* @return {Promise} - A promise that is fulfilled with a PNG image data URL
|
|
90706
|
+
* */
|
|
90707
|
+
function toPng(node, options) {
|
|
90708
|
+
return draw(node, options || {})
|
|
90709
|
+
.then(function (canvas) {
|
|
90710
|
+
return canvas.toDataURL();
|
|
90711
|
+
});
|
|
90712
|
+
}
|
|
90713
|
+
|
|
90714
|
+
/**
|
|
90715
|
+
* @param {Node} node - The DOM Node object to render
|
|
90716
|
+
* @param {Object} options - Rendering options, @see {@link toSvg}
|
|
90717
|
+
* @return {Promise} - A promise that is fulfilled with a JPEG image data URL
|
|
90718
|
+
* */
|
|
90719
|
+
function toJpeg(node, options) {
|
|
90720
|
+
options = options || {};
|
|
90721
|
+
return draw(node, options)
|
|
90722
|
+
.then(function (canvas) {
|
|
90723
|
+
return canvas.toDataURL('image/jpeg', options.quality || 1.0);
|
|
90724
|
+
});
|
|
90725
|
+
}
|
|
90726
|
+
|
|
90727
|
+
/**
|
|
90728
|
+
* @param {Node} node - The DOM Node object to render
|
|
90729
|
+
* @param {Object} options - Rendering options, @see {@link toSvg}
|
|
90730
|
+
* @return {Promise} - A promise that is fulfilled with a PNG image blob
|
|
90731
|
+
* */
|
|
90732
|
+
function toBlob(node, options) {
|
|
90733
|
+
return draw(node, options || {})
|
|
90734
|
+
.then(util.canvasToBlob);
|
|
90735
|
+
}
|
|
90736
|
+
|
|
90737
|
+
function copyOptions(options) {
|
|
90738
|
+
// Copy options to impl options for use in impl
|
|
90739
|
+
if(typeof(options.imagePlaceholder) === 'undefined') {
|
|
90740
|
+
domtoimage.impl.options.imagePlaceholder = defaultOptions.imagePlaceholder;
|
|
90741
|
+
} else {
|
|
90742
|
+
domtoimage.impl.options.imagePlaceholder = options.imagePlaceholder;
|
|
90743
|
+
}
|
|
90744
|
+
|
|
90745
|
+
if(typeof(options.cacheBust) === 'undefined') {
|
|
90746
|
+
domtoimage.impl.options.cacheBust = defaultOptions.cacheBust;
|
|
90747
|
+
} else {
|
|
90748
|
+
domtoimage.impl.options.cacheBust = options.cacheBust;
|
|
90749
|
+
}
|
|
90750
|
+
}
|
|
90751
|
+
|
|
90752
|
+
function draw(domNode, options) {
|
|
90753
|
+
return toSvg(domNode, options)
|
|
90754
|
+
.then(util.makeImage)
|
|
90755
|
+
.then(util.delay(100))
|
|
90756
|
+
.then(function (image) {
|
|
90757
|
+
var canvas = newCanvas(domNode);
|
|
90758
|
+
canvas.getContext('2d').drawImage(image, 0, 0);
|
|
90759
|
+
return canvas;
|
|
90760
|
+
});
|
|
90761
|
+
|
|
90762
|
+
function newCanvas(domNode) {
|
|
90763
|
+
var canvas = document.createElement('canvas');
|
|
90764
|
+
canvas.width = options.width || util.width(domNode);
|
|
90765
|
+
canvas.height = options.height || util.height(domNode);
|
|
90766
|
+
|
|
90767
|
+
if (options.bgcolor) {
|
|
90768
|
+
var ctx = canvas.getContext('2d');
|
|
90769
|
+
ctx.fillStyle = options.bgcolor;
|
|
90770
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
90771
|
+
}
|
|
90772
|
+
|
|
90773
|
+
return canvas;
|
|
90774
|
+
}
|
|
90775
|
+
}
|
|
90776
|
+
|
|
90777
|
+
function cloneNode(node, filter, root) {
|
|
90778
|
+
if (!root && filter && !filter(node)) return Promise.resolve();
|
|
90779
|
+
|
|
90780
|
+
return Promise.resolve(node)
|
|
90781
|
+
.then(makeNodeCopy)
|
|
90782
|
+
.then(function (clone) {
|
|
90783
|
+
return cloneChildren(node, clone, filter);
|
|
90784
|
+
})
|
|
90785
|
+
.then(function (clone) {
|
|
90786
|
+
return processClone(node, clone);
|
|
90787
|
+
});
|
|
90788
|
+
|
|
90789
|
+
function makeNodeCopy(node) {
|
|
90790
|
+
if (node instanceof HTMLCanvasElement) return util.makeImage(node.toDataURL());
|
|
90791
|
+
return node.cloneNode(false);
|
|
90792
|
+
}
|
|
90793
|
+
|
|
90794
|
+
function cloneChildren(original, clone, filter) {
|
|
90795
|
+
var children = original.childNodes;
|
|
90796
|
+
if (children.length === 0) return Promise.resolve(clone);
|
|
90797
|
+
|
|
90798
|
+
return cloneChildrenInOrder(clone, util.asArray(children), filter)
|
|
90799
|
+
.then(function () {
|
|
90800
|
+
return clone;
|
|
90801
|
+
});
|
|
90802
|
+
|
|
90803
|
+
function cloneChildrenInOrder(parent, children, filter) {
|
|
90804
|
+
var done = Promise.resolve();
|
|
90805
|
+
children.forEach(function (child) {
|
|
90806
|
+
done = done
|
|
90807
|
+
.then(function () {
|
|
90808
|
+
return cloneNode(child, filter);
|
|
90809
|
+
})
|
|
90810
|
+
.then(function (childClone) {
|
|
90811
|
+
if (childClone) parent.appendChild(childClone);
|
|
90812
|
+
});
|
|
90813
|
+
});
|
|
90814
|
+
return done;
|
|
90815
|
+
}
|
|
90816
|
+
}
|
|
90817
|
+
|
|
90818
|
+
function processClone(original, clone) {
|
|
90819
|
+
if (!(clone instanceof Element)) return clone;
|
|
90820
|
+
|
|
90821
|
+
return Promise.resolve()
|
|
90822
|
+
.then(cloneStyle)
|
|
90823
|
+
.then(clonePseudoElements)
|
|
90824
|
+
.then(copyUserInput)
|
|
90825
|
+
.then(fixSvg)
|
|
90826
|
+
.then(function () {
|
|
90827
|
+
return clone;
|
|
90828
|
+
});
|
|
90829
|
+
|
|
90830
|
+
function cloneStyle() {
|
|
90831
|
+
copyStyle(window.getComputedStyle(original), clone.style);
|
|
90832
|
+
|
|
90833
|
+
function copyStyle(source, target) {
|
|
90834
|
+
if (source.cssText) target.cssText = source.cssText;
|
|
90835
|
+
else copyProperties(source, target);
|
|
90836
|
+
|
|
90837
|
+
function copyProperties(source, target) {
|
|
90838
|
+
util.asArray(source).forEach(function (name) {
|
|
90839
|
+
target.setProperty(
|
|
90840
|
+
name,
|
|
90841
|
+
source.getPropertyValue(name),
|
|
90842
|
+
source.getPropertyPriority(name)
|
|
90843
|
+
);
|
|
90844
|
+
});
|
|
90845
|
+
}
|
|
90846
|
+
}
|
|
90847
|
+
}
|
|
90848
|
+
|
|
90849
|
+
function clonePseudoElements() {
|
|
90850
|
+
[':before', ':after'].forEach(function (element) {
|
|
90851
|
+
clonePseudoElement(element);
|
|
90852
|
+
});
|
|
90853
|
+
|
|
90854
|
+
function clonePseudoElement(element) {
|
|
90855
|
+
var style = window.getComputedStyle(original, element);
|
|
90856
|
+
var content = style.getPropertyValue('content');
|
|
90857
|
+
|
|
90858
|
+
if (content === '' || content === 'none') return;
|
|
90859
|
+
|
|
90860
|
+
var className = util.uid();
|
|
90861
|
+
clone.className = clone.className + ' ' + className;
|
|
90862
|
+
var styleElement = document.createElement('style');
|
|
90863
|
+
styleElement.appendChild(formatPseudoElementStyle(className, element, style));
|
|
90864
|
+
clone.appendChild(styleElement);
|
|
90865
|
+
|
|
90866
|
+
function formatPseudoElementStyle(className, element, style) {
|
|
90867
|
+
var selector = '.' + className + ':' + element;
|
|
90868
|
+
var cssText = style.cssText ? formatCssText(style) : formatCssProperties(style);
|
|
90869
|
+
return document.createTextNode(selector + '{' + cssText + '}');
|
|
90870
|
+
|
|
90871
|
+
function formatCssText(style) {
|
|
90872
|
+
var content = style.getPropertyValue('content');
|
|
90873
|
+
return style.cssText + ' content: ' + content + ';';
|
|
90874
|
+
}
|
|
90875
|
+
|
|
90876
|
+
function formatCssProperties(style) {
|
|
90877
|
+
|
|
90878
|
+
return util.asArray(style)
|
|
90879
|
+
.map(formatProperty)
|
|
90880
|
+
.join('; ') + ';';
|
|
90881
|
+
|
|
90882
|
+
function formatProperty(name) {
|
|
90883
|
+
return name + ': ' +
|
|
90884
|
+
style.getPropertyValue(name) +
|
|
90885
|
+
(style.getPropertyPriority(name) ? ' !important' : '');
|
|
90886
|
+
}
|
|
90887
|
+
}
|
|
90888
|
+
}
|
|
90889
|
+
}
|
|
90890
|
+
}
|
|
90891
|
+
|
|
90892
|
+
function copyUserInput() {
|
|
90893
|
+
if (original instanceof HTMLTextAreaElement) clone.innerHTML = original.value;
|
|
90894
|
+
if (original instanceof HTMLInputElement) clone.setAttribute("value", original.value);
|
|
90895
|
+
}
|
|
90896
|
+
|
|
90897
|
+
function fixSvg() {
|
|
90898
|
+
if (!(clone instanceof SVGElement)) return;
|
|
90899
|
+
clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
90900
|
+
|
|
90901
|
+
if (!(clone instanceof SVGRectElement)) return;
|
|
90902
|
+
['width', 'height'].forEach(function (attribute) {
|
|
90903
|
+
var value = clone.getAttribute(attribute);
|
|
90904
|
+
if (!value) return;
|
|
90905
|
+
|
|
90906
|
+
clone.style.setProperty(attribute, value);
|
|
90907
|
+
});
|
|
90908
|
+
}
|
|
90909
|
+
}
|
|
90910
|
+
}
|
|
90911
|
+
|
|
90912
|
+
function embedFonts(node) {
|
|
90913
|
+
return fontFaces.resolveAll()
|
|
90914
|
+
.then(function (cssText) {
|
|
90915
|
+
var styleNode = document.createElement('style');
|
|
90916
|
+
node.appendChild(styleNode);
|
|
90917
|
+
styleNode.appendChild(document.createTextNode(cssText));
|
|
90918
|
+
return node;
|
|
90919
|
+
});
|
|
90920
|
+
}
|
|
90921
|
+
|
|
90922
|
+
function inlineImages(node) {
|
|
90923
|
+
return images.inlineAll(node)
|
|
90924
|
+
.then(function () {
|
|
90925
|
+
return node;
|
|
90926
|
+
});
|
|
90927
|
+
}
|
|
90928
|
+
|
|
90929
|
+
function makeSvgDataUri(node, width, height) {
|
|
90930
|
+
return Promise.resolve(node)
|
|
90931
|
+
.then(function (node) {
|
|
90932
|
+
node.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
|
|
90933
|
+
return new XMLSerializer().serializeToString(node);
|
|
90934
|
+
})
|
|
90935
|
+
.then(util.escapeXhtml)
|
|
90936
|
+
.then(function (xhtml) {
|
|
90937
|
+
return '<foreignObject x="0" y="0" width="100%" height="100%">' + xhtml + '</foreignObject>';
|
|
90938
|
+
})
|
|
90939
|
+
.then(function (foreignObject) {
|
|
90940
|
+
return '<svg xmlns="http://www.w3.org/2000/svg" width="' + width + '" height="' + height + '">' +
|
|
90941
|
+
foreignObject + '</svg>';
|
|
90942
|
+
})
|
|
90943
|
+
.then(function (svg) {
|
|
90944
|
+
return 'data:image/svg+xml;charset=utf-8,' + svg;
|
|
90945
|
+
});
|
|
90946
|
+
}
|
|
90947
|
+
|
|
90948
|
+
function newUtil() {
|
|
90949
|
+
return {
|
|
90950
|
+
escape: escape,
|
|
90951
|
+
parseExtension: parseExtension,
|
|
90952
|
+
mimeType: mimeType,
|
|
90953
|
+
dataAsUrl: dataAsUrl,
|
|
90954
|
+
isDataUrl: isDataUrl,
|
|
90955
|
+
canvasToBlob: canvasToBlob,
|
|
90956
|
+
resolveUrl: resolveUrl,
|
|
90957
|
+
getAndEncode: getAndEncode,
|
|
90958
|
+
uid: uid(),
|
|
90959
|
+
delay: delay,
|
|
90960
|
+
asArray: asArray,
|
|
90961
|
+
escapeXhtml: escapeXhtml,
|
|
90962
|
+
makeImage: makeImage,
|
|
90963
|
+
width: width,
|
|
90964
|
+
height: height
|
|
90965
|
+
};
|
|
90966
|
+
|
|
90967
|
+
function mimes() {
|
|
90968
|
+
/*
|
|
90969
|
+
* Only WOFF and EOT mime types for fonts are 'real'
|
|
90970
|
+
* see http://www.iana.org/assignments/media-types/media-types.xhtml
|
|
90971
|
+
*/
|
|
90972
|
+
var WOFF = 'application/font-woff';
|
|
90973
|
+
var JPEG = 'image/jpeg';
|
|
90974
|
+
|
|
90975
|
+
return {
|
|
90976
|
+
'woff': WOFF,
|
|
90977
|
+
'woff2': WOFF,
|
|
90978
|
+
'ttf': 'application/font-truetype',
|
|
90979
|
+
'eot': 'application/vnd.ms-fontobject',
|
|
90980
|
+
'png': 'image/png',
|
|
90981
|
+
'jpg': JPEG,
|
|
90982
|
+
'jpeg': JPEG,
|
|
90983
|
+
'gif': 'image/gif',
|
|
90984
|
+
'tiff': 'image/tiff',
|
|
90985
|
+
'svg': 'image/svg+xml'
|
|
90986
|
+
};
|
|
90987
|
+
}
|
|
90988
|
+
|
|
90989
|
+
function parseExtension(url) {
|
|
90990
|
+
var match = /\.([^\.\/]*?)$/g.exec(url);
|
|
90991
|
+
if (match) return match[1];
|
|
90992
|
+
else return '';
|
|
90993
|
+
}
|
|
90994
|
+
|
|
90995
|
+
function mimeType(url) {
|
|
90996
|
+
var extension = parseExtension(url).toLowerCase();
|
|
90997
|
+
return mimes()[extension] || '';
|
|
90998
|
+
}
|
|
90999
|
+
|
|
91000
|
+
function isDataUrl(url) {
|
|
91001
|
+
return url.search(/^(data:)/) !== -1;
|
|
91002
|
+
}
|
|
91003
|
+
|
|
91004
|
+
function toBlob(canvas) {
|
|
91005
|
+
return new Promise(function (resolve) {
|
|
91006
|
+
var binaryString = window.atob(canvas.toDataURL().split(',')[1]);
|
|
91007
|
+
var length = binaryString.length;
|
|
91008
|
+
var binaryArray = new Uint8Array(length);
|
|
91009
|
+
|
|
91010
|
+
for (var i = 0; i < length; i++)
|
|
91011
|
+
binaryArray[i] = binaryString.charCodeAt(i);
|
|
91012
|
+
|
|
91013
|
+
resolve(new Blob([binaryArray], {
|
|
91014
|
+
type: 'image/png'
|
|
91015
|
+
}));
|
|
91016
|
+
});
|
|
91017
|
+
}
|
|
91018
|
+
|
|
91019
|
+
function canvasToBlob(canvas) {
|
|
91020
|
+
if (canvas.toBlob)
|
|
91021
|
+
return new Promise(function (resolve) {
|
|
91022
|
+
canvas.toBlob(resolve);
|
|
91023
|
+
});
|
|
91024
|
+
|
|
91025
|
+
return toBlob(canvas);
|
|
91026
|
+
}
|
|
91027
|
+
|
|
91028
|
+
function resolveUrl(url, baseUrl) {
|
|
91029
|
+
var doc = document.implementation.createHTMLDocument();
|
|
91030
|
+
var base = doc.createElement('base');
|
|
91031
|
+
doc.head.appendChild(base);
|
|
91032
|
+
var a = doc.createElement('a');
|
|
91033
|
+
doc.body.appendChild(a);
|
|
91034
|
+
base.href = baseUrl;
|
|
91035
|
+
a.href = url;
|
|
91036
|
+
return a.href;
|
|
91037
|
+
}
|
|
91038
|
+
|
|
91039
|
+
function uid() {
|
|
91040
|
+
var index = 0;
|
|
91041
|
+
|
|
91042
|
+
return function () {
|
|
91043
|
+
return 'u' + fourRandomChars() + index++;
|
|
91044
|
+
|
|
91045
|
+
function fourRandomChars() {
|
|
91046
|
+
/* see http://stackoverflow.com/a/6248722/2519373 */
|
|
91047
|
+
return ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4);
|
|
91048
|
+
}
|
|
91049
|
+
};
|
|
91050
|
+
}
|
|
91051
|
+
|
|
91052
|
+
function makeImage(uri) {
|
|
91053
|
+
return new Promise(function (resolve, reject) {
|
|
91054
|
+
var image = new Image();
|
|
91055
|
+
image.onload = function () {
|
|
91056
|
+
resolve(image);
|
|
91057
|
+
};
|
|
91058
|
+
image.onerror = reject;
|
|
91059
|
+
image.src = uri;
|
|
91060
|
+
});
|
|
91061
|
+
}
|
|
91062
|
+
|
|
91063
|
+
function getAndEncode(url) {
|
|
91064
|
+
var TIMEOUT = 30000;
|
|
91065
|
+
if(domtoimage.impl.options.cacheBust) {
|
|
91066
|
+
// Cache bypass so we dont have CORS issues with cached images
|
|
91067
|
+
// Source: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache
|
|
91068
|
+
url += ((/\?/).test(url) ? "&" : "?") + (new Date()).getTime();
|
|
91069
|
+
}
|
|
91070
|
+
|
|
91071
|
+
return new Promise(function (resolve) {
|
|
91072
|
+
var request = new XMLHttpRequest();
|
|
91073
|
+
|
|
91074
|
+
request.onreadystatechange = done;
|
|
91075
|
+
request.ontimeout = timeout;
|
|
91076
|
+
request.responseType = 'blob';
|
|
91077
|
+
request.timeout = TIMEOUT;
|
|
91078
|
+
request.open('GET', url, true);
|
|
91079
|
+
request.send();
|
|
91080
|
+
|
|
91081
|
+
var placeholder;
|
|
91082
|
+
if(domtoimage.impl.options.imagePlaceholder) {
|
|
91083
|
+
var split = domtoimage.impl.options.imagePlaceholder.split(/,/);
|
|
91084
|
+
if(split && split[1]) {
|
|
91085
|
+
placeholder = split[1];
|
|
91086
|
+
}
|
|
91087
|
+
}
|
|
91088
|
+
|
|
91089
|
+
function done() {
|
|
91090
|
+
if (request.readyState !== 4) return;
|
|
91091
|
+
|
|
91092
|
+
if (request.status !== 200) {
|
|
91093
|
+
if(placeholder) {
|
|
91094
|
+
resolve(placeholder);
|
|
91095
|
+
} else {
|
|
91096
|
+
fail('cannot fetch resource: ' + url + ', status: ' + request.status);
|
|
91097
|
+
}
|
|
91098
|
+
|
|
91099
|
+
return;
|
|
91100
|
+
}
|
|
91101
|
+
|
|
91102
|
+
var encoder = new FileReader();
|
|
91103
|
+
encoder.onloadend = function () {
|
|
91104
|
+
var content = encoder.result.split(/,/)[1];
|
|
91105
|
+
resolve(content);
|
|
91106
|
+
};
|
|
91107
|
+
encoder.readAsDataURL(request.response);
|
|
91108
|
+
}
|
|
91109
|
+
|
|
91110
|
+
function timeout() {
|
|
91111
|
+
if(placeholder) {
|
|
91112
|
+
resolve(placeholder);
|
|
91113
|
+
} else {
|
|
91114
|
+
fail('timeout of ' + TIMEOUT + 'ms occured while fetching resource: ' + url);
|
|
91115
|
+
}
|
|
91116
|
+
}
|
|
91117
|
+
|
|
91118
|
+
function fail(message) {
|
|
91119
|
+
console.error(message);
|
|
91120
|
+
resolve('');
|
|
91121
|
+
}
|
|
91122
|
+
});
|
|
91123
|
+
}
|
|
91124
|
+
|
|
91125
|
+
function dataAsUrl(content, type) {
|
|
91126
|
+
return 'data:' + type + ';base64,' + content;
|
|
91127
|
+
}
|
|
91128
|
+
|
|
91129
|
+
function escape(string) {
|
|
91130
|
+
return string.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1');
|
|
91131
|
+
}
|
|
91132
|
+
|
|
91133
|
+
function delay(ms) {
|
|
91134
|
+
return function (arg) {
|
|
91135
|
+
return new Promise(function (resolve) {
|
|
91136
|
+
setTimeout(function () {
|
|
91137
|
+
resolve(arg);
|
|
91138
|
+
}, ms);
|
|
91139
|
+
});
|
|
91140
|
+
};
|
|
91141
|
+
}
|
|
91142
|
+
|
|
91143
|
+
function asArray(arrayLike) {
|
|
91144
|
+
var array = [];
|
|
91145
|
+
var length = arrayLike.length;
|
|
91146
|
+
for (var i = 0; i < length; i++) array.push(arrayLike[i]);
|
|
91147
|
+
return array;
|
|
91148
|
+
}
|
|
91149
|
+
|
|
91150
|
+
function escapeXhtml(string) {
|
|
91151
|
+
return string.replace(/#/g, '%23').replace(/\n/g, '%0A');
|
|
91152
|
+
}
|
|
91153
|
+
|
|
91154
|
+
function width(node) {
|
|
91155
|
+
var leftBorder = px(node, 'border-left-width');
|
|
91156
|
+
var rightBorder = px(node, 'border-right-width');
|
|
91157
|
+
return node.scrollWidth + leftBorder + rightBorder;
|
|
91158
|
+
}
|
|
91159
|
+
|
|
91160
|
+
function height(node) {
|
|
91161
|
+
var topBorder = px(node, 'border-top-width');
|
|
91162
|
+
var bottomBorder = px(node, 'border-bottom-width');
|
|
91163
|
+
return node.scrollHeight + topBorder + bottomBorder;
|
|
91164
|
+
}
|
|
91165
|
+
|
|
91166
|
+
function px(node, styleProperty) {
|
|
91167
|
+
var value = window.getComputedStyle(node).getPropertyValue(styleProperty);
|
|
91168
|
+
return parseFloat(value.replace('px', ''));
|
|
91169
|
+
}
|
|
91170
|
+
}
|
|
91171
|
+
|
|
91172
|
+
function newInliner() {
|
|
91173
|
+
var URL_REGEX = /url\(['"]?([^'"]+?)['"]?\)/g;
|
|
91174
|
+
|
|
91175
|
+
return {
|
|
91176
|
+
inlineAll: inlineAll,
|
|
91177
|
+
shouldProcess: shouldProcess,
|
|
91178
|
+
impl: {
|
|
91179
|
+
readUrls: readUrls,
|
|
91180
|
+
inline: inline
|
|
91181
|
+
}
|
|
91182
|
+
};
|
|
91183
|
+
|
|
91184
|
+
function shouldProcess(string) {
|
|
91185
|
+
return string.search(URL_REGEX) !== -1;
|
|
91186
|
+
}
|
|
91187
|
+
|
|
91188
|
+
function readUrls(string) {
|
|
91189
|
+
var result = [];
|
|
91190
|
+
var match;
|
|
91191
|
+
while ((match = URL_REGEX.exec(string)) !== null) {
|
|
91192
|
+
result.push(match[1]);
|
|
91193
|
+
}
|
|
91194
|
+
return result.filter(function (url) {
|
|
91195
|
+
return !util.isDataUrl(url);
|
|
91196
|
+
});
|
|
91197
|
+
}
|
|
91198
|
+
|
|
91199
|
+
function inline(string, url, baseUrl, get) {
|
|
91200
|
+
return Promise.resolve(url)
|
|
91201
|
+
.then(function (url) {
|
|
91202
|
+
return baseUrl ? util.resolveUrl(url, baseUrl) : url;
|
|
91203
|
+
})
|
|
91204
|
+
.then(get || util.getAndEncode)
|
|
91205
|
+
.then(function (data) {
|
|
91206
|
+
return util.dataAsUrl(data, util.mimeType(url));
|
|
91207
|
+
})
|
|
91208
|
+
.then(function (dataUrl) {
|
|
91209
|
+
return string.replace(urlAsRegex(url), '$1' + dataUrl + '$3');
|
|
91210
|
+
});
|
|
91211
|
+
|
|
91212
|
+
function urlAsRegex(url) {
|
|
91213
|
+
return new RegExp('(url\\([\'"]?)(' + util.escape(url) + ')([\'"]?\\))', 'g');
|
|
91214
|
+
}
|
|
91215
|
+
}
|
|
91216
|
+
|
|
91217
|
+
function inlineAll(string, baseUrl, get) {
|
|
91218
|
+
if (nothingToInline()) return Promise.resolve(string);
|
|
91219
|
+
|
|
91220
|
+
return Promise.resolve(string)
|
|
91221
|
+
.then(readUrls)
|
|
91222
|
+
.then(function (urls) {
|
|
91223
|
+
var done = Promise.resolve(string);
|
|
91224
|
+
urls.forEach(function (url) {
|
|
91225
|
+
done = done.then(function (string) {
|
|
91226
|
+
return inline(string, url, baseUrl, get);
|
|
91227
|
+
});
|
|
91228
|
+
});
|
|
91229
|
+
return done;
|
|
91230
|
+
});
|
|
91231
|
+
|
|
91232
|
+
function nothingToInline() {
|
|
91233
|
+
return !shouldProcess(string);
|
|
91234
|
+
}
|
|
91235
|
+
}
|
|
91236
|
+
}
|
|
91237
|
+
|
|
91238
|
+
function newFontFaces() {
|
|
91239
|
+
return {
|
|
91240
|
+
resolveAll: resolveAll,
|
|
91241
|
+
impl: {
|
|
91242
|
+
readAll: readAll
|
|
91243
|
+
}
|
|
91244
|
+
};
|
|
91245
|
+
|
|
91246
|
+
function resolveAll() {
|
|
91247
|
+
return readAll()
|
|
91248
|
+
.then(function (webFonts) {
|
|
91249
|
+
return Promise.all(
|
|
91250
|
+
webFonts.map(function (webFont) {
|
|
91251
|
+
return webFont.resolve();
|
|
91252
|
+
})
|
|
91253
|
+
);
|
|
91254
|
+
})
|
|
91255
|
+
.then(function (cssStrings) {
|
|
91256
|
+
return cssStrings.join('\n');
|
|
91257
|
+
});
|
|
91258
|
+
}
|
|
91259
|
+
|
|
91260
|
+
function readAll() {
|
|
91261
|
+
return Promise.resolve(util.asArray(document.styleSheets))
|
|
91262
|
+
.then(getCssRules)
|
|
91263
|
+
.then(selectWebFontRules)
|
|
91264
|
+
.then(function (rules) {
|
|
91265
|
+
return rules.map(newWebFont);
|
|
91266
|
+
});
|
|
91267
|
+
|
|
91268
|
+
function selectWebFontRules(cssRules) {
|
|
91269
|
+
return cssRules
|
|
91270
|
+
.filter(function (rule) {
|
|
91271
|
+
return rule.type === CSSRule.FONT_FACE_RULE;
|
|
91272
|
+
})
|
|
91273
|
+
.filter(function (rule) {
|
|
91274
|
+
return inliner.shouldProcess(rule.style.getPropertyValue('src'));
|
|
91275
|
+
});
|
|
91276
|
+
}
|
|
91277
|
+
|
|
91278
|
+
function getCssRules(styleSheets) {
|
|
91279
|
+
var cssRules = [];
|
|
91280
|
+
styleSheets.forEach(function (sheet) {
|
|
91281
|
+
try {
|
|
91282
|
+
util.asArray(sheet.cssRules || []).forEach(cssRules.push.bind(cssRules));
|
|
91283
|
+
} catch (e) {
|
|
91284
|
+
console.log('Error while reading CSS rules from ' + sheet.href, e.toString());
|
|
91285
|
+
}
|
|
91286
|
+
});
|
|
91287
|
+
return cssRules;
|
|
91288
|
+
}
|
|
91289
|
+
|
|
91290
|
+
function newWebFont(webFontRule) {
|
|
91291
|
+
return {
|
|
91292
|
+
resolve: function resolve() {
|
|
91293
|
+
var baseUrl = (webFontRule.parentStyleSheet || {}).href;
|
|
91294
|
+
return inliner.inlineAll(webFontRule.cssText, baseUrl);
|
|
91295
|
+
},
|
|
91296
|
+
src: function () {
|
|
91297
|
+
return webFontRule.style.getPropertyValue('src');
|
|
91298
|
+
}
|
|
91299
|
+
};
|
|
91300
|
+
}
|
|
91301
|
+
}
|
|
91302
|
+
}
|
|
91303
|
+
|
|
91304
|
+
function newImages() {
|
|
91305
|
+
return {
|
|
91306
|
+
inlineAll: inlineAll,
|
|
91307
|
+
impl: {
|
|
91308
|
+
newImage: newImage
|
|
91309
|
+
}
|
|
91310
|
+
};
|
|
91311
|
+
|
|
91312
|
+
function newImage(element) {
|
|
91313
|
+
return {
|
|
91314
|
+
inline: inline
|
|
91315
|
+
};
|
|
91316
|
+
|
|
91317
|
+
function inline(get) {
|
|
91318
|
+
if (util.isDataUrl(element.src)) return Promise.resolve();
|
|
91319
|
+
|
|
91320
|
+
return Promise.resolve(element.src)
|
|
91321
|
+
.then(get || util.getAndEncode)
|
|
91322
|
+
.then(function (data) {
|
|
91323
|
+
return util.dataAsUrl(data, util.mimeType(element.src));
|
|
91324
|
+
})
|
|
91325
|
+
.then(function (dataUrl) {
|
|
91326
|
+
return new Promise(function (resolve, reject) {
|
|
91327
|
+
element.onload = resolve;
|
|
91328
|
+
element.onerror = reject;
|
|
91329
|
+
element.src = dataUrl;
|
|
91330
|
+
});
|
|
91331
|
+
});
|
|
91332
|
+
}
|
|
91333
|
+
}
|
|
91334
|
+
|
|
91335
|
+
function inlineAll(node) {
|
|
91336
|
+
if (!(node instanceof Element)) return Promise.resolve(node);
|
|
91337
|
+
|
|
91338
|
+
return inlineBackground(node)
|
|
91339
|
+
.then(function () {
|
|
91340
|
+
if (node instanceof HTMLImageElement)
|
|
91341
|
+
return newImage(node).inline();
|
|
91342
|
+
else
|
|
91343
|
+
return Promise.all(
|
|
91344
|
+
util.asArray(node.childNodes).map(function (child) {
|
|
91345
|
+
return inlineAll(child);
|
|
91346
|
+
})
|
|
91347
|
+
);
|
|
91348
|
+
});
|
|
91349
|
+
|
|
91350
|
+
function inlineBackground(node) {
|
|
91351
|
+
var background = node.style.getPropertyValue('background');
|
|
91352
|
+
|
|
91353
|
+
if (!background) return Promise.resolve(node);
|
|
91354
|
+
|
|
91355
|
+
return inliner.inlineAll(background)
|
|
91356
|
+
.then(function (inlined) {
|
|
91357
|
+
node.style.setProperty(
|
|
91358
|
+
'background',
|
|
91359
|
+
inlined,
|
|
91360
|
+
node.style.getPropertyPriority('background')
|
|
91361
|
+
);
|
|
91362
|
+
})
|
|
91363
|
+
.then(function () {
|
|
91364
|
+
return node;
|
|
91365
|
+
});
|
|
91366
|
+
}
|
|
91367
|
+
}
|
|
91368
|
+
}
|
|
91369
|
+
})();
|
|
91370
|
+
} (domToImage));
|
|
91371
|
+
|
|
91372
|
+
var domToImageExports = domToImage.exports;
|
|
91373
|
+
var domtoimage = /*@__PURE__*/getDefaultExportFromCjs(domToImageExports);
|
|
91374
|
+
|
|
90603
91375
|
function getTemplateHTML(data) {
|
|
90604
91376
|
var _a, _b, _c;
|
|
90605
91377
|
const isProfit = data.data.payout * +data.data.payoutTokenPrice - data.data.dollarValue > 0;
|
package/dist/styles.css
CHANGED