\n *\n * Copyright (c) 2015, Jon Schlinkert.\n * Licensed under the MIT License.\n */\n\nvar assignSymbols = function assignSymbols(receiver, objects) {\n if (receiver === null || typeof receiver === 'undefined') {\n throw new TypeError('expected first argument to be an object.');\n }\n\n if (typeof objects === 'undefined' || typeof Symbol === 'undefined') {\n return receiver;\n }\n\n if (typeof Object.getOwnPropertySymbols !== 'function') {\n return receiver;\n }\n\n var isEnumerable = Object.prototype.propertyIsEnumerable;\n var target = Object(receiver);\n var len = arguments.length,\n i = 0;\n\n while (++i < len) {\n var provider = Object(arguments[i]);\n var names = Object.getOwnPropertySymbols(provider);\n\n for (var j = 0; j < names.length; j++) {\n var key = names[j];\n\n if (isEnumerable.call(provider, key)) {\n target[key] = provider[key];\n }\n }\n }\n return target;\n};\n\nvar toString = Object.prototype.toString;\n\n/**\n * Get the native `typeof` a value.\n *\n * @param {*} `val`\n * @return {*} Native javascript type\n */\n\nvar kindOf = function kindOf(val) {\n var type = typeof val === 'undefined' ? 'undefined' : _typeof(val);\n\n // primitivies\n if (type === 'undefined') {\n return 'undefined';\n }\n if (val === null) {\n return 'null';\n }\n if (val === true || val === false || val instanceof Boolean) {\n return 'boolean';\n }\n if (type === 'string' || val instanceof String) {\n return 'string';\n }\n if (type === 'number' || val instanceof Number) {\n return 'number';\n }\n\n // functions\n if (type === 'function' || val instanceof Function) {\n if (typeof val.constructor.name !== 'undefined' && val.constructor.name.slice(0, 9) === 'Generator') {\n return 'generatorfunction';\n }\n return 'function';\n }\n\n // array\n if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {\n return 'array';\n }\n\n // check for instances of RegExp and Date before calling `toString`\n if (val instanceof RegExp) {\n return 'regexp';\n }\n if (val instanceof Date) {\n return 'date';\n }\n\n // other objects\n type = toString.call(val);\n\n if (type === '[object RegExp]') {\n return 'regexp';\n }\n if (type === '[object Date]') {\n return 'date';\n }\n if (type === '[object Arguments]') {\n return 'arguments';\n }\n if (type === '[object Error]') {\n return 'error';\n }\n if (type === '[object Promise]') {\n return 'promise';\n }\n\n // buffer\n if (isBuffer(val)) {\n return 'buffer';\n }\n\n // es6: Map, WeakMap, Set, WeakSet\n if (type === '[object Set]') {\n return 'set';\n }\n if (type === '[object WeakSet]') {\n return 'weakset';\n }\n if (type === '[object Map]') {\n return 'map';\n }\n if (type === '[object WeakMap]') {\n return 'weakmap';\n }\n if (type === '[object Symbol]') {\n return 'symbol';\n }\n\n if (type === '[object Map Iterator]') {\n return 'mapiterator';\n }\n if (type === '[object Set Iterator]') {\n return 'setiterator';\n }\n if (type === '[object String Iterator]') {\n return 'stringiterator';\n }\n if (type === '[object Array Iterator]') {\n return 'arrayiterator';\n }\n\n // typed arrays\n if (type === '[object Int8Array]') {\n return 'int8array';\n }\n if (type === '[object Uint8Array]') {\n return 'uint8array';\n }\n if (type === '[object Uint8ClampedArray]') {\n return 'uint8clampedarray';\n }\n if (type === '[object Int16Array]') {\n return 'int16array';\n }\n if (type === '[object Uint16Array]') {\n return 'uint16array';\n }\n if (type === '[object Int32Array]') {\n return 'int32array';\n }\n if (type === '[object Uint32Array]') {\n return 'uint32array';\n }\n if (type === '[object Float32Array]') {\n return 'float32array';\n }\n if (type === '[object Float64Array]') {\n return 'float64array';\n }\n\n // must be a plain object\n return 'object';\n};\n\n/**\n * If you need to support Safari 5-7 (8-10 yr-old browser),\n * take a look at https://github.com/feross/is-buffer\n */\n\nfunction isBuffer(val) {\n return val.constructor && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);\n}\n\nfunction assign(target /*, objects*/) {\n target = target || {};\n var len = arguments.length,\n i = 0;\n if (len === 1) {\n return target;\n }\n while (++i < len) {\n var val = arguments[i];\n if (isPrimitive(target)) {\n target = val;\n }\n if (isObject$1(val)) {\n extend(target, val);\n }\n }\n return target;\n}\n\n/**\n * Shallow extend\n */\n\nfunction extend(target, obj) {\n assignSymbols(target, obj);\n\n for (var key in obj) {\n if (key !== '__proto__' && hasOwn(obj, key)) {\n var val = obj[key];\n if (isObject$1(val)) {\n if (kindOf(target[key]) === 'undefined' && kindOf(val) === 'function') {\n target[key] = val;\n }\n target[key] = assign(target[key] || {}, val);\n } else {\n target[key] = val;\n }\n }\n }\n return target;\n}\n\n/**\n * Returns true if the object is a plain object or a function.\n */\n\nfunction isObject$1(obj) {\n return kindOf(obj) === 'object' || kindOf(obj) === 'function';\n}\n\n/**\n * Returns true if the given `key` is an own property of `obj`.\n */\n\nfunction hasOwn(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\n/**\n * Expose `assign`\n */\n\nvar assignDeep = assign;\n\nvar inBrowser = typeof window !== 'undefined';\nvar hasIntersectionObserver = checkIntersectionObserver();\n\nfunction checkIntersectionObserver() {\n if (inBrowser && 'IntersectionObserver' in window && 'IntersectionObserverEntry' in window && 'intersectionRatio' in window.IntersectionObserverEntry.prototype) {\n // Minimal polyfill for Edge 15's lack of `isIntersecting`\n // See: https://github.com/w3c/IntersectionObserver/issues/211\n if (!('isIntersecting' in window.IntersectionObserverEntry.prototype)) {\n Object.defineProperty(window.IntersectionObserverEntry.prototype, 'isIntersecting', {\n get: function get$$1() {\n return this.intersectionRatio > 0;\n }\n });\n }\n return true;\n }\n return false;\n}\n\nvar modeType = {\n event: 'event',\n observer: 'observer'\n\n // CustomEvent polyfill\n};var CustomEvent = function () {\n if (!inBrowser) return;\n if (typeof window.CustomEvent === 'function') return window.CustomEvent;\n function CustomEvent(event, params) {\n params = params || { bubbles: false, cancelable: false, detail: undefined };\n var evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n }\n CustomEvent.prototype = window.Event.prototype;\n return CustomEvent;\n}();\n\nfunction remove(arr, item) {\n if (!arr.length) return;\n var index = arr.indexOf(item);\n if (index > -1) return arr.splice(index, 1);\n}\n\nfunction some(arr, fn) {\n var has = false;\n for (var i = 0, len = arr.length; i < len; i++) {\n if (fn(arr[i])) {\n has = true;\n break;\n }\n }\n return has;\n}\n\nfunction getBestSelectionFromSrcset(el, scale) {\n if (el.tagName !== 'IMG' || !el.getAttribute('data-srcset')) return;\n\n var options = el.getAttribute('data-srcset');\n var result = [];\n var container = el.parentNode;\n var containerWidth = container.offsetWidth * scale;\n\n var spaceIndex = void 0;\n var tmpSrc = void 0;\n var tmpWidth = void 0;\n\n options = options.trim().split(',');\n\n options.map(function (item) {\n item = item.trim();\n spaceIndex = item.lastIndexOf(' ');\n if (spaceIndex === -1) {\n tmpSrc = item;\n tmpWidth = 999998;\n } else {\n tmpSrc = item.substr(0, spaceIndex);\n tmpWidth = parseInt(item.substr(spaceIndex + 1, item.length - spaceIndex - 2), 10);\n }\n result.push([tmpWidth, tmpSrc]);\n });\n\n result.sort(function (a, b) {\n if (a[0] < b[0]) {\n return 1;\n }\n if (a[0] > b[0]) {\n return -1;\n }\n if (a[0] === b[0]) {\n if (b[1].indexOf('.webp', b[1].length - 5) !== -1) {\n return 1;\n }\n if (a[1].indexOf('.webp', a[1].length - 5) !== -1) {\n return -1;\n }\n }\n return 0;\n });\n var bestSelectedSrc = '';\n var tmpOption = void 0;\n\n for (var i = 0; i < result.length; i++) {\n tmpOption = result[i];\n bestSelectedSrc = tmpOption[1];\n var next = result[i + 1];\n if (next && next[0] < containerWidth) {\n bestSelectedSrc = tmpOption[1];\n break;\n } else if (!next) {\n bestSelectedSrc = tmpOption[1];\n break;\n }\n }\n\n return bestSelectedSrc;\n}\n\nfunction find(arr, fn) {\n var item = void 0;\n for (var i = 0, len = arr.length; i < len; i++) {\n if (fn(arr[i])) {\n item = arr[i];\n break;\n }\n }\n return item;\n}\n\nvar getDPR = function getDPR() {\n var scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;\n return inBrowser ? window.devicePixelRatio || scale : scale;\n};\n\nfunction supportWebp() {\n if (!inBrowser) return false;\n\n var support = true;\n var d = document;\n\n try {\n var el = d.createElement('object');\n el.type = 'image/webp';\n el.style.visibility = 'hidden';\n el.innerHTML = '!';\n d.body.appendChild(el);\n support = !el.offsetWidth;\n d.body.removeChild(el);\n } catch (err) {\n support = false;\n }\n\n return support;\n}\n\nfunction throttle(action, delay) {\n var timeout = null;\n var lastRun = 0;\n return function () {\n if (timeout) {\n return;\n }\n var elapsed = Date.now() - lastRun;\n var context = this;\n var args = arguments;\n var runCallback = function runCallback() {\n lastRun = Date.now();\n timeout = false;\n action.apply(context, args);\n };\n if (elapsed >= delay) {\n runCallback();\n } else {\n timeout = setTimeout(runCallback, delay);\n }\n };\n}\n\nfunction testSupportsPassive() {\n if (!inBrowser) return;\n var support = false;\n try {\n var opts = Object.defineProperty({}, 'passive', {\n get: function get$$1() {\n support = true;\n }\n });\n window.addEventListener('test', null, opts);\n } catch (e) {}\n return support;\n}\n\nvar supportsPassive = testSupportsPassive();\n\nvar _ = {\n on: function on(el, type, func) {\n var capture = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n\n if (supportsPassive) {\n el.addEventListener(type, func, {\n capture: capture,\n passive: true\n });\n } else {\n el.addEventListener(type, func, capture);\n }\n },\n off: function off(el, type, func) {\n var capture = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n\n el.removeEventListener(type, func, capture);\n }\n};\n\nvar loadImageAsync = function loadImageAsync(item, resolve, reject) {\n var image = new Image();\n if (!item || !item.src) {\n var err = new Error('image src is required');\n return reject(err);\n }\n\n image.src = item.src;\n\n image.onload = function () {\n resolve({\n naturalHeight: image.naturalHeight,\n naturalWidth: image.naturalWidth,\n src: image.src\n });\n };\n\n image.onerror = function (e) {\n reject(e);\n };\n};\n\nvar style = function style(el, prop) {\n return typeof getComputedStyle !== 'undefined' ? getComputedStyle(el, null).getPropertyValue(prop) : el.style[prop];\n};\n\nvar overflow = function overflow(el) {\n return style(el, 'overflow') + style(el, 'overflow-y') + style(el, 'overflow-x');\n};\n\nvar scrollParent = function scrollParent(el) {\n if (!inBrowser) return;\n if (!(el instanceof HTMLElement)) {\n return window;\n }\n\n var parent = el;\n\n while (parent) {\n if (parent === document.body || parent === document.documentElement) {\n break;\n }\n\n if (!parent.parentNode) {\n break;\n }\n\n if (/(scroll|auto)/.test(overflow(parent))) {\n return parent;\n }\n\n parent = parent.parentNode;\n }\n\n return window;\n};\n\nfunction isObject(obj) {\n return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object';\n}\n\nfunction ObjectKeys(obj) {\n if (!(obj instanceof Object)) return [];\n if (Object.keys) {\n return Object.keys(obj);\n } else {\n var keys = [];\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n keys.push(key);\n }\n }\n return keys;\n }\n}\n\nfunction ArrayFrom(arrLike) {\n var len = arrLike.length;\n var list = [];\n for (var i = 0; i < len; i++) {\n list.push(arrLike[i]);\n }\n return list;\n}\n\nfunction noop() {}\n\nvar ImageCache = function () {\n function ImageCache(_ref) {\n var max = _ref.max;\n classCallCheck(this, ImageCache);\n\n this.options = {\n max: max || 100\n };\n this._caches = [];\n }\n\n createClass(ImageCache, [{\n key: 'has',\n value: function has(key) {\n return this._caches.indexOf(key) > -1;\n }\n }, {\n key: 'add',\n value: function add(key) {\n if (this.has(key)) return;\n this._caches.push(key);\n if (this._caches.length > this.options.max) {\n this.free();\n }\n }\n }, {\n key: 'free',\n value: function free() {\n this._caches.shift();\n }\n }]);\n return ImageCache;\n}();\n\n// el: {\n// state,\n// src,\n// error,\n// loading\n// }\n\nvar ReactiveListener = function () {\n function ReactiveListener(_ref) {\n var el = _ref.el,\n src = _ref.src,\n error = _ref.error,\n loading = _ref.loading,\n bindType = _ref.bindType,\n $parent = _ref.$parent,\n options = _ref.options,\n elRenderer = _ref.elRenderer,\n imageCache = _ref.imageCache;\n classCallCheck(this, ReactiveListener);\n\n this.el = el;\n this.src = src;\n this.error = error;\n this.loading = loading;\n this.bindType = bindType;\n this.attempt = 0;\n\n this.naturalHeight = 0;\n this.naturalWidth = 0;\n\n this.options = options;\n\n this.rect = null;\n\n this.$parent = $parent;\n this.elRenderer = elRenderer;\n this._imageCache = imageCache;\n this.performanceData = {\n init: Date.now(),\n loadStart: 0,\n loadEnd: 0\n };\n\n this.filter();\n this.initState();\n this.render('loading', false);\n }\n\n /*\n * init listener state\n * @return\n */\n\n\n createClass(ReactiveListener, [{\n key: 'initState',\n value: function initState() {\n if ('dataset' in this.el) {\n this.el.dataset.src = this.src;\n } else {\n this.el.setAttribute('data-src', this.src);\n }\n\n this.state = {\n loading: false,\n error: false,\n loaded: false,\n rendered: false\n };\n }\n\n /*\n * record performance\n * @return\n */\n\n }, {\n key: 'record',\n value: function record(event) {\n this.performanceData[event] = Date.now();\n }\n\n /*\n * update image listener data\n * @param {String} image uri\n * @param {String} loading image uri\n * @param {String} error image uri\n * @return\n */\n\n }, {\n key: 'update',\n value: function update(_ref2) {\n var src = _ref2.src,\n loading = _ref2.loading,\n error = _ref2.error;\n\n var oldSrc = this.src;\n this.src = src;\n this.loading = loading;\n this.error = error;\n this.filter();\n if (oldSrc !== this.src) {\n this.attempt = 0;\n this.initState();\n }\n }\n\n /*\n * get el node rect\n * @return\n */\n\n }, {\n key: 'getRect',\n value: function getRect() {\n this.rect = this.el.getBoundingClientRect();\n }\n\n /*\n * check el is in view\n * @return {Boolean} el is in view\n */\n\n }, {\n key: 'checkInView',\n value: function checkInView() {\n this.getRect();\n return this.rect.top < window.innerHeight * this.options.preLoad && this.rect.bottom > this.options.preLoadTop && this.rect.left < window.innerWidth * this.options.preLoad && this.rect.right > 0;\n }\n\n /*\n * listener filter\n */\n\n }, {\n key: 'filter',\n value: function filter() {\n var _this = this;\n\n ObjectKeys(this.options.filter).map(function (key) {\n _this.options.filter[key](_this, _this.options);\n });\n }\n\n /*\n * render loading first\n * @params cb:Function\n * @return\n */\n\n }, {\n key: 'renderLoading',\n value: function renderLoading(cb) {\n var _this2 = this;\n\n this.state.loading = true;\n loadImageAsync({\n src: this.loading\n }, function (data) {\n _this2.render('loading', false);\n _this2.state.loading = false;\n cb();\n }, function () {\n // handler `loading image` load failed\n cb();\n _this2.state.loading = false;\n if (!_this2.options.silent) console.warn('VueLazyload log: load failed with loading image(' + _this2.loading + ')');\n });\n }\n\n /*\n * try load image and render it\n * @return\n */\n\n }, {\n key: 'load',\n value: function load() {\n var _this3 = this;\n\n var onFinish = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : noop;\n\n if (this.attempt > this.options.attempt - 1 && this.state.error) {\n if (!this.options.silent) console.log('VueLazyload log: ' + this.src + ' tried too more than ' + this.options.attempt + ' times');\n onFinish();\n return;\n }\n if (this.state.rendered && this.state.loaded) return;\n if (this._imageCache.has(this.src)) {\n this.state.loaded = true;\n this.render('loaded', true);\n this.state.rendered = true;\n return onFinish();\n }\n\n this.renderLoading(function () {\n _this3.attempt++;\n\n _this3.options.adapter['beforeLoad'] && _this3.options.adapter['beforeLoad'](_this3, _this3.options);\n _this3.record('loadStart');\n\n loadImageAsync({\n src: _this3.src\n }, function (data) {\n _this3.naturalHeight = data.naturalHeight;\n _this3.naturalWidth = data.naturalWidth;\n _this3.state.loaded = true;\n _this3.state.error = false;\n _this3.record('loadEnd');\n _this3.render('loaded', false);\n _this3.state.rendered = true;\n _this3._imageCache.add(_this3.src);\n onFinish();\n }, function (err) {\n !_this3.options.silent && console.error(err);\n _this3.state.error = true;\n _this3.state.loaded = false;\n _this3.render('error', false);\n });\n });\n }\n\n /*\n * render image\n * @param {String} state to render // ['loading', 'src', 'error']\n * @param {String} is form cache\n * @return\n */\n\n }, {\n key: 'render',\n value: function render(state, cache) {\n this.elRenderer(this, state, cache);\n }\n\n /*\n * output performance data\n * @return {Object} performance data\n */\n\n }, {\n key: 'performance',\n value: function performance() {\n var state = 'loading';\n var time = 0;\n\n if (this.state.loaded) {\n state = 'loaded';\n time = (this.performanceData.loadEnd - this.performanceData.loadStart) / 1000;\n }\n\n if (this.state.error) state = 'error';\n\n return {\n src: this.src,\n state: state,\n time: time\n };\n }\n\n /*\n * $destroy\n * @return\n */\n\n }, {\n key: '$destroy',\n value: function $destroy() {\n this.el = null;\n this.src = null;\n this.error = null;\n this.loading = null;\n this.bindType = null;\n this.attempt = 0;\n }\n }]);\n return ReactiveListener;\n}();\n\nvar DEFAULT_URL = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';\nvar DEFAULT_EVENTS = ['scroll', 'wheel', 'mousewheel', 'resize', 'animationend', 'transitionend', 'touchmove'];\nvar DEFAULT_OBSERVER_OPTIONS = {\n rootMargin: '0px',\n threshold: 0\n};\n\nvar Lazy = function (Vue) {\n return function () {\n function Lazy(_ref) {\n var preLoad = _ref.preLoad,\n error = _ref.error,\n throttleWait = _ref.throttleWait,\n preLoadTop = _ref.preLoadTop,\n dispatchEvent = _ref.dispatchEvent,\n loading = _ref.loading,\n attempt = _ref.attempt,\n _ref$silent = _ref.silent,\n silent = _ref$silent === undefined ? true : _ref$silent,\n scale = _ref.scale,\n listenEvents = _ref.listenEvents,\n hasbind = _ref.hasbind,\n filter = _ref.filter,\n adapter = _ref.adapter,\n observer = _ref.observer,\n observerOptions = _ref.observerOptions;\n classCallCheck(this, Lazy);\n\n this.version = '1.3.3';\n this.mode = modeType.event;\n this.ListenerQueue = [];\n this.TargetIndex = 0;\n this.TargetQueue = [];\n this.options = {\n silent: silent,\n dispatchEvent: !!dispatchEvent,\n throttleWait: throttleWait || 200,\n preLoad: preLoad || 1.3,\n preLoadTop: preLoadTop || 0,\n error: error || DEFAULT_URL,\n loading: loading || DEFAULT_URL,\n attempt: attempt || 3,\n scale: scale || getDPR(scale),\n ListenEvents: listenEvents || DEFAULT_EVENTS,\n hasbind: false,\n supportWebp: supportWebp(),\n filter: filter || {},\n adapter: adapter || {},\n observer: !!observer,\n observerOptions: observerOptions || DEFAULT_OBSERVER_OPTIONS\n };\n this._initEvent();\n this._imageCache = new ImageCache({ max: 200 });\n this.lazyLoadHandler = throttle(this._lazyLoadHandler.bind(this), this.options.throttleWait);\n\n this.setMode(this.options.observer ? modeType.observer : modeType.event);\n }\n\n /**\n * update config\n * @param {Object} config params\n * @return\n */\n\n\n createClass(Lazy, [{\n key: 'config',\n value: function config() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n assignDeep(this.options, options);\n }\n\n /**\n * output listener's load performance\n * @return {Array}\n */\n\n }, {\n key: 'performance',\n value: function performance() {\n var list = [];\n\n this.ListenerQueue.map(function (item) {\n list.push(item.performance());\n });\n\n return list;\n }\n\n /*\n * add lazy component to queue\n * @param {Vue} vm lazy component instance\n * @return\n */\n\n }, {\n key: 'addLazyBox',\n value: function addLazyBox(vm) {\n this.ListenerQueue.push(vm);\n if (inBrowser) {\n this._addListenerTarget(window);\n this._observer && this._observer.observe(vm.el);\n if (vm.$el && vm.$el.parentNode) {\n this._addListenerTarget(vm.$el.parentNode);\n }\n }\n }\n\n /*\n * add image listener to queue\n * @param {DOM} el\n * @param {object} binding vue directive binding\n * @param {vnode} vnode vue directive vnode\n * @return\n */\n\n }, {\n key: 'add',\n value: function add(el, binding, vnode) {\n var _this = this;\n\n if (some(this.ListenerQueue, function (item) {\n return item.el === el;\n })) {\n this.update(el, binding);\n return Vue.nextTick(this.lazyLoadHandler);\n }\n\n var _valueFormatter2 = this._valueFormatter(binding.value),\n src = _valueFormatter2.src,\n loading = _valueFormatter2.loading,\n error = _valueFormatter2.error;\n\n Vue.nextTick(function () {\n src = getBestSelectionFromSrcset(el, _this.options.scale) || src;\n _this._observer && _this._observer.observe(el);\n\n var container = Object.keys(binding.modifiers)[0];\n var $parent = void 0;\n\n if (container) {\n $parent = vnode.context.$refs[container];\n // if there is container passed in, try ref first, then fallback to getElementById to support the original usage\n $parent = $parent ? $parent.$el || $parent : document.getElementById(container);\n }\n\n if (!$parent) {\n $parent = scrollParent(el);\n }\n\n var newListener = new ReactiveListener({\n bindType: binding.arg,\n $parent: $parent,\n el: el,\n loading: loading,\n error: error,\n src: src,\n elRenderer: _this._elRenderer.bind(_this),\n options: _this.options,\n imageCache: _this._imageCache\n });\n\n _this.ListenerQueue.push(newListener);\n\n if (inBrowser) {\n _this._addListenerTarget(window);\n _this._addListenerTarget($parent);\n }\n\n _this.lazyLoadHandler();\n Vue.nextTick(function () {\n return _this.lazyLoadHandler();\n });\n });\n }\n\n /**\n * update image src\n * @param {DOM} el\n * @param {object} vue directive binding\n * @return\n */\n\n }, {\n key: 'update',\n value: function update(el, binding, vnode) {\n var _this2 = this;\n\n var _valueFormatter3 = this._valueFormatter(binding.value),\n src = _valueFormatter3.src,\n loading = _valueFormatter3.loading,\n error = _valueFormatter3.error;\n\n src = getBestSelectionFromSrcset(el, this.options.scale) || src;\n\n var exist = find(this.ListenerQueue, function (item) {\n return item.el === el;\n });\n if (!exist) {\n this.add(el, binding, vnode);\n } else {\n exist.update({\n src: src,\n loading: loading,\n error: error\n });\n }\n if (this._observer) {\n this._observer.unobserve(el);\n this._observer.observe(el);\n }\n this.lazyLoadHandler();\n Vue.nextTick(function () {\n return _this2.lazyLoadHandler();\n });\n }\n\n /**\n * remove listener form list\n * @param {DOM} el\n * @return\n */\n\n }, {\n key: 'remove',\n value: function remove$$1(el) {\n if (!el) return;\n this._observer && this._observer.unobserve(el);\n var existItem = find(this.ListenerQueue, function (item) {\n return item.el === el;\n });\n if (existItem) {\n this._removeListenerTarget(existItem.$parent);\n this._removeListenerTarget(window);\n remove(this.ListenerQueue, existItem);\n existItem.$destroy();\n }\n }\n\n /*\n * remove lazy components form list\n * @param {Vue} vm Vue instance\n * @return\n */\n\n }, {\n key: 'removeComponent',\n value: function removeComponent(vm) {\n if (!vm) return;\n remove(this.ListenerQueue, vm);\n this._observer && this._observer.unobserve(vm.el);\n if (vm.$parent && vm.$el.parentNode) {\n this._removeListenerTarget(vm.$el.parentNode);\n }\n this._removeListenerTarget(window);\n }\n }, {\n key: 'setMode',\n value: function setMode(mode) {\n var _this3 = this;\n\n if (!hasIntersectionObserver && mode === modeType.observer) {\n mode = modeType.event;\n }\n\n this.mode = mode; // event or observer\n\n if (mode === modeType.event) {\n if (this._observer) {\n this.ListenerQueue.forEach(function (listener) {\n _this3._observer.unobserve(listener.el);\n });\n this._observer = null;\n }\n\n this.TargetQueue.forEach(function (target) {\n _this3._initListen(target.el, true);\n });\n } else {\n this.TargetQueue.forEach(function (target) {\n _this3._initListen(target.el, false);\n });\n this._initIntersectionObserver();\n }\n }\n\n /*\n *** Private functions ***\n */\n\n /*\n * add listener target\n * @param {DOM} el listener target\n * @return\n */\n\n }, {\n key: '_addListenerTarget',\n value: function _addListenerTarget(el) {\n if (!el) return;\n var target = find(this.TargetQueue, function (target) {\n return target.el === el;\n });\n if (!target) {\n target = {\n el: el,\n id: ++this.TargetIndex,\n childrenCount: 1,\n listened: true\n };\n this.mode === modeType.event && this._initListen(target.el, true);\n this.TargetQueue.push(target);\n } else {\n target.childrenCount++;\n }\n return this.TargetIndex;\n }\n\n /*\n * remove listener target or reduce target childrenCount\n * @param {DOM} el or window\n * @return\n */\n\n }, {\n key: '_removeListenerTarget',\n value: function _removeListenerTarget(el) {\n var _this4 = this;\n\n this.TargetQueue.forEach(function (target, index) {\n if (target.el === el) {\n target.childrenCount--;\n if (!target.childrenCount) {\n _this4._initListen(target.el, false);\n _this4.TargetQueue.splice(index, 1);\n target = null;\n }\n }\n });\n }\n\n /*\n * add or remove eventlistener\n * @param {DOM} el DOM or Window\n * @param {boolean} start flag\n * @return\n */\n\n }, {\n key: '_initListen',\n value: function _initListen(el, start) {\n var _this5 = this;\n\n this.options.ListenEvents.forEach(function (evt) {\n return _[start ? 'on' : 'off'](el, evt, _this5.lazyLoadHandler);\n });\n }\n }, {\n key: '_initEvent',\n value: function _initEvent() {\n var _this6 = this;\n\n this.Event = {\n listeners: {\n loading: [],\n loaded: [],\n error: []\n }\n };\n\n this.$on = function (event, func) {\n if (!_this6.Event.listeners[event]) _this6.Event.listeners[event] = [];\n _this6.Event.listeners[event].push(func);\n };\n\n this.$once = function (event, func) {\n var vm = _this6;\n function on() {\n vm.$off(event, on);\n func.apply(vm, arguments);\n }\n _this6.$on(event, on);\n };\n\n this.$off = function (event, func) {\n if (!func) {\n if (!_this6.Event.listeners[event]) return;\n _this6.Event.listeners[event].length = 0;\n return;\n }\n remove(_this6.Event.listeners[event], func);\n };\n\n this.$emit = function (event, context, inCache) {\n if (!_this6.Event.listeners[event]) return;\n _this6.Event.listeners[event].forEach(function (func) {\n return func(context, inCache);\n });\n };\n }\n\n /**\n * find nodes which in viewport and trigger load\n * @return\n */\n\n }, {\n key: '_lazyLoadHandler',\n value: function _lazyLoadHandler() {\n var _this7 = this;\n\n var freeList = [];\n this.ListenerQueue.forEach(function (listener, index) {\n if (!listener.el || !listener.el.parentNode) {\n freeList.push(listener);\n }\n var catIn = listener.checkInView();\n if (!catIn) return;\n listener.load();\n });\n freeList.forEach(function (item) {\n remove(_this7.ListenerQueue, item);\n item.$destroy();\n });\n }\n /**\n * init IntersectionObserver\n * set mode to observer\n * @return\n */\n\n }, {\n key: '_initIntersectionObserver',\n value: function _initIntersectionObserver() {\n var _this8 = this;\n\n if (!hasIntersectionObserver) return;\n this._observer = new IntersectionObserver(this._observerHandler.bind(this), this.options.observerOptions);\n if (this.ListenerQueue.length) {\n this.ListenerQueue.forEach(function (listener) {\n _this8._observer.observe(listener.el);\n });\n }\n }\n\n /**\n * init IntersectionObserver\n * @return\n */\n\n }, {\n key: '_observerHandler',\n value: function _observerHandler(entries, observer) {\n var _this9 = this;\n\n entries.forEach(function (entry) {\n if (entry.isIntersecting) {\n _this9.ListenerQueue.forEach(function (listener) {\n if (listener.el === entry.target) {\n if (listener.state.loaded) return _this9._observer.unobserve(listener.el);\n listener.load();\n }\n });\n }\n });\n }\n\n /**\n * set element attribute with image'url and state\n * @param {object} lazyload listener object\n * @param {string} state will be rendered\n * @param {bool} inCache is rendered from cache\n * @return\n */\n\n }, {\n key: '_elRenderer',\n value: function _elRenderer(listener, state, cache) {\n if (!listener.el) return;\n var el = listener.el,\n bindType = listener.bindType;\n\n\n var src = void 0;\n switch (state) {\n case 'loading':\n src = listener.loading;\n break;\n case 'error':\n src = listener.error;\n break;\n default:\n src = listener.src;\n break;\n }\n\n if (bindType) {\n el.style[bindType] = 'url(\"' + src + '\")';\n } else if (el.getAttribute('src') !== src) {\n el.setAttribute('src', src);\n }\n\n el.setAttribute('lazy', state);\n\n this.$emit(state, listener, cache);\n this.options.adapter[state] && this.options.adapter[state](listener, this.options);\n\n if (this.options.dispatchEvent) {\n var event = new CustomEvent(state, {\n detail: listener\n });\n el.dispatchEvent(event);\n }\n }\n\n /**\n * generate loading loaded error image url\n * @param {string} image's src\n * @return {object} image's loading, loaded, error url\n */\n\n }, {\n key: '_valueFormatter',\n value: function _valueFormatter(value) {\n var src = value;\n var loading = this.options.loading;\n var error = this.options.error;\n\n // value is object\n if (isObject(value)) {\n if (!value.src && !this.options.silent) console.error('Vue Lazyload warning: miss src with ' + value);\n src = value.src;\n loading = value.loading || this.options.loading;\n error = value.error || this.options.error;\n }\n return {\n src: src,\n loading: loading,\n error: error\n };\n }\n }]);\n return Lazy;\n }();\n};\n\nvar LazyComponent = (function (lazy) {\n return {\n props: {\n tag: {\n type: String,\n default: 'div'\n }\n },\n render: function render(h) {\n if (this.show === false) {\n return h(this.tag);\n }\n return h(this.tag, null, this.$slots.default);\n },\n data: function data() {\n return {\n el: null,\n state: {\n loaded: false\n },\n rect: {},\n show: false\n };\n },\n mounted: function mounted() {\n this.el = this.$el;\n lazy.addLazyBox(this);\n lazy.lazyLoadHandler();\n },\n beforeDestroy: function beforeDestroy() {\n lazy.removeComponent(this);\n },\n\n methods: {\n getRect: function getRect() {\n this.rect = this.$el.getBoundingClientRect();\n },\n checkInView: function checkInView() {\n this.getRect();\n return inBrowser && this.rect.top < window.innerHeight * lazy.options.preLoad && this.rect.bottom > 0 && this.rect.left < window.innerWidth * lazy.options.preLoad && this.rect.right > 0;\n },\n load: function load() {\n this.show = true;\n this.state.loaded = true;\n this.$emit('show', this);\n },\n destroy: function destroy() {\n return this.$destroy;\n }\n }\n };\n});\n\nvar LazyContainerMananger = function () {\n function LazyContainerMananger(_ref) {\n var lazy = _ref.lazy;\n classCallCheck(this, LazyContainerMananger);\n\n this.lazy = lazy;\n lazy.lazyContainerMananger = this;\n this._queue = [];\n }\n\n createClass(LazyContainerMananger, [{\n key: 'bind',\n value: function bind(el, binding, vnode) {\n var container = new LazyContainer$1({ el: el, binding: binding, vnode: vnode, lazy: this.lazy });\n this._queue.push(container);\n }\n }, {\n key: 'update',\n value: function update(el, binding, vnode) {\n var container = find(this._queue, function (item) {\n return item.el === el;\n });\n if (!container) return;\n container.update({ el: el, binding: binding, vnode: vnode });\n }\n }, {\n key: 'unbind',\n value: function unbind(el, binding, vnode) {\n var container = find(this._queue, function (item) {\n return item.el === el;\n });\n if (!container) return;\n container.clear();\n remove(this._queue, container);\n }\n }]);\n return LazyContainerMananger;\n}();\n\nvar defaultOptions = {\n selector: 'img'\n};\n\nvar LazyContainer$1 = function () {\n function LazyContainer(_ref2) {\n var el = _ref2.el,\n binding = _ref2.binding,\n vnode = _ref2.vnode,\n lazy = _ref2.lazy;\n classCallCheck(this, LazyContainer);\n\n this.el = null;\n this.vnode = vnode;\n this.binding = binding;\n this.options = {};\n this.lazy = lazy;\n\n this._queue = [];\n this.update({ el: el, binding: binding });\n }\n\n createClass(LazyContainer, [{\n key: 'update',\n value: function update(_ref3) {\n var _this = this;\n\n var el = _ref3.el,\n binding = _ref3.binding;\n\n this.el = el;\n this.options = assignDeep({}, defaultOptions, binding.value);\n\n var imgs = this.getImgs();\n imgs.forEach(function (el) {\n _this.lazy.add(el, assignDeep({}, _this.binding, {\n value: {\n src: 'dataset' in el ? el.dataset.src : el.getAttribute('data-src'),\n error: ('dataset' in el ? el.dataset.error : el.getAttribute('data-error')) || _this.options.error,\n loading: ('dataset' in el ? el.dataset.loading : el.getAttribute('data-loading')) || _this.options.loading\n }\n }), _this.vnode);\n });\n }\n }, {\n key: 'getImgs',\n value: function getImgs() {\n return ArrayFrom(this.el.querySelectorAll(this.options.selector));\n }\n }, {\n key: 'clear',\n value: function clear() {\n var _this2 = this;\n\n var imgs = this.getImgs();\n imgs.forEach(function (el) {\n return _this2.lazy.remove(el);\n });\n\n this.vnode = null;\n this.binding = null;\n this.lazy = null;\n }\n }]);\n return LazyContainer;\n}();\n\nvar LazyImage = (function (lazyManager) {\n return {\n props: {\n src: [String, Object],\n tag: {\n type: String,\n default: 'img'\n }\n },\n render: function render(h) {\n return h(this.tag, {\n attrs: {\n src: this.renderSrc\n }\n }, this.$slots.default);\n },\n data: function data() {\n return {\n el: null,\n options: {\n src: '',\n error: '',\n loading: '',\n attempt: lazyManager.options.attempt\n },\n state: {\n loaded: false,\n error: false,\n attempt: 0\n },\n rect: {},\n renderSrc: ''\n };\n },\n\n watch: {\n src: function src() {\n this.init();\n lazyManager.addLazyBox(this);\n lazyManager.lazyLoadHandler();\n }\n },\n created: function created() {\n this.init();\n this.renderSrc = this.options.loading;\n },\n mounted: function mounted() {\n this.el = this.$el;\n lazyManager.addLazyBox(this);\n lazyManager.lazyLoadHandler();\n },\n beforeDestroy: function beforeDestroy() {\n lazyManager.removeComponent(this);\n },\n\n methods: {\n init: function init() {\n var _lazyManager$_valueFo = lazyManager._valueFormatter(this.src),\n src = _lazyManager$_valueFo.src,\n loading = _lazyManager$_valueFo.loading,\n error = _lazyManager$_valueFo.error;\n\n this.state.loaded = false;\n this.options.src = src;\n this.options.error = error;\n this.options.loading = loading;\n this.renderSrc = this.options.loading;\n },\n getRect: function getRect() {\n this.rect = this.$el.getBoundingClientRect();\n },\n checkInView: function checkInView() {\n this.getRect();\n return inBrowser && this.rect.top < window.innerHeight * lazyManager.options.preLoad && this.rect.bottom > 0 && this.rect.left < window.innerWidth * lazyManager.options.preLoad && this.rect.right > 0;\n },\n load: function load() {\n var _this = this;\n\n var onFinish = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : noop;\n\n if (this.state.attempt > this.options.attempt - 1 && this.state.error) {\n if (!lazyManager.options.silent) console.log('VueLazyload log: ' + this.options.src + ' tried too more than ' + this.options.attempt + ' times');\n onFinish();\n return;\n }\n var src = this.options.src;\n loadImageAsync({ src: src }, function (_ref) {\n var src = _ref.src;\n\n _this.renderSrc = src;\n _this.state.loaded = true;\n }, function (e) {\n _this.state.attempt++;\n _this.renderSrc = _this.options.error;\n _this.state.error = true;\n });\n }\n }\n };\n});\n\nvar index = {\n /*\n * install function\n * @param {Vue} Vue\n * @param {object} options lazyload options\n */\n install: function install(Vue) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var LazyClass = Lazy(Vue);\n var lazy = new LazyClass(options);\n var lazyContainer = new LazyContainerMananger({ lazy: lazy });\n\n var isVue2 = Vue.version.split('.')[0] === '2';\n\n Vue.prototype.$Lazyload = lazy;\n\n if (options.lazyComponent) {\n Vue.component('lazy-component', LazyComponent(lazy));\n }\n\n if (options.lazyImage) {\n Vue.component('lazy-image', LazyImage(lazy));\n }\n\n if (isVue2) {\n Vue.directive('lazy', {\n bind: lazy.add.bind(lazy),\n update: lazy.update.bind(lazy),\n componentUpdated: lazy.lazyLoadHandler.bind(lazy),\n unbind: lazy.remove.bind(lazy)\n });\n Vue.directive('lazy-container', {\n bind: lazyContainer.bind.bind(lazyContainer),\n componentUpdated: lazyContainer.update.bind(lazyContainer),\n unbind: lazyContainer.unbind.bind(lazyContainer)\n });\n } else {\n Vue.directive('lazy', {\n bind: lazy.lazyLoadHandler.bind(lazy),\n update: function update(newValue, oldValue) {\n assignDeep(this.vm.$refs, this.vm.$els);\n lazy.add(this.el, {\n modifiers: this.modifiers || {},\n arg: this.arg,\n value: newValue,\n oldValue: oldValue\n }, {\n context: this.vm\n });\n },\n unbind: function unbind() {\n lazy.remove(this.el);\n }\n });\n\n Vue.directive('lazy-container', {\n update: function update(newValue, oldValue) {\n lazyContainer.update(this.el, {\n modifiers: this.modifiers || {},\n arg: this.arg,\n value: newValue,\n oldValue: oldValue\n }, {\n context: this.vm\n });\n },\n unbind: function unbind() {\n lazyContainer.unbind(this.el);\n }\n });\n }\n }\n};\n\nexport default index;\n","function _iterableToArrayLimit(r, l) {\n var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (null != t) {\n var e,\n n,\n i,\n u,\n a = [],\n f = !0,\n o = !1;\n try {\n if (i = (t = t.call(r)).next, 0 === l) {\n if (Object(t) !== t) return;\n f = !1;\n } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);\n } catch (r) {\n o = !0, n = r;\n } finally {\n try {\n if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return;\n } finally {\n if (o) throw n;\n }\n }\n return a;\n }\n}\nmodule.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var arrayLikeToArray = require(\"./arrayLikeToArray.js\");\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\nmodule.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","/*\n 将 html 解析为适用于小程序 rich-text 的 DOM 结构\n github地址:https://github.com/jin-yufeng/Parser\n 文档地址:https://jin-yufeng.github.io/Parser\n author:JinYufeng\n*/\nconst CssHandler = require(\"./CssHandler.js\");\nconst config = require(\"./config.js\");\nvar emoji; // 需要使用 emoji 补丁包时将此行改为 const emoji = require(\"./emoji.js\");\n\nfunction isBlankChar(c) {\n\treturn c == ' ' || c == '\\u00A0' || c == '\\t' || c == '\\r' || c == '\\n' || c == '\\f';\n};\nclass MpHtmlParser {\n\tconstructor(data, options = {}, cb) {\n\t\tthis.cb = cb;\n\t\tthis.CssHandler = new CssHandler(options.tagStyle);\n\t\tthis.data = data;\n\t\tthis.DOM = [];\n\n\n\n\t\tthis._attrName = '';\n\t\tthis._attrValue = '';\n\t\tthis._attrs = {};\n\t\tthis._domain = options.domain;\n\t\tthis._protocol = options.domain ? (options.domain.includes(\"://\") ? this._domain.split(\"://\")[0] : \"http\") :\n\t\t\tundefined;\n\t\tthis._i = 0;\n\t\tthis._sectionStart = 0;\n\t\tthis._state = this.Text;\n\t\tthis._STACK = [];\n\t\tthis._tagName = '';\n\t\tthis._audioNum = 0;\n\t\tthis._imgNum = 0;\n\t\tthis._videoNum = 0;\n\t\tthis._useAnchor = options.useAnchor;\n\t\tthis._whiteSpace = false;\n\t};\n\tparse() {\n\t\tif (this.CssHandler) this.data = this.CssHandler.getStyle(this.data);\n\t\tif (emoji) this.data = emoji.parseEmoji(this.data);\n\t\t// 高亮处理\n\t\tif (config.highlight)\n\t\t\tthis.data = this.data.replace(/<[pP][rR][eE]([\\s\\S]*?)>([\\s\\S]*?)<\\/[pP][rR][eE][\\s\\S]*?>/g, function() {\n\t\t\t\treturn \"' + config.highlight(arguments[2], \"') + \"
\";\n\t\t\t})\n\t\tfor (var len = this.data.length; this._i < len; this._i++)\n\t\t\tthis._state(this.data[this._i]);\n\t\tif (this._state == this.Text) this.setText();\n\t\twhile (this._STACK.length)\n\t\t\tthis.popNode(this._STACK.pop());\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\tif (this.DOM.length) this.DOM[0].PoweredBy = \"Parser\";\n\t\t// console.log(this.DOM)\n\t\tif (this.cb)\n\t\t\tthis.cb(this.DOM)\n\t\telse return this.DOM;\n\t};\n\t// 设置属性\n\tsetAttr() {\n\t\tif (config.trustAttrs[this._attrName])\n\t\t\tthis._attrs[this._attrName] = (this._attrValue ? this._attrValue : (this._attrName == \"src\" ? \"\" : \"true\"));\n\t\tthis._attrValue = '';\n\t\twhile (isBlankChar(this.data[this._i])) this._i++;\n\t\tif (this.checkClose()) this.setNode();\n\t\telse this._state = this.AttrName;\n\t};\n\t// 设置文本节点\n\tsetText() {\n\t\tvar text = this.getSelection();\n\t\tif (text) {\n\t\t\tif (!this._whiteSpace) {\n\t\t\t\t// 移除空白符\n\t\t\t\tvar flag = false,\n\t\t\t\t\thas = false,\n\t\t\t\t\tpos;\n\t\t\t\tfor (var i = 0; i < text.length; i++) {\n\t\t\t\t\tif (isBlankChar(text[i])) {\n\t\t\t\t\t\tif (!flag) {\n\t\t\t\t\t\t\tpos = i;\n\t\t\t\t\t\t\tflag = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\thas = true;\n\t\t\t\t\t\tif (flag) {\n\t\t\t\t\t\t\tif (i - pos > 1) text = text.substring(0, pos) + ' ' + text.substring(i);\n\t\t\t\t\t\t\ti = pos;\n\t\t\t\t\t\t\tflag = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (flag) text = text.substring(0, pos) + ' ';\n\t\t\t\tif (!text || !has) return;\n\t\t\t}\n\t\t\t// 检查实体\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\tvar i = text.indexOf('&'),\n\t\t\t\tj, decode;\n\t\t\twhile (i != -1 && i < text.length) {\n\t\t\t\tj = text.indexOf(';', i);\n\t\t\t\tif (j - i >= 2 && j - i <= 7) {\n\t\t\t\t\tvar entity = text.substring(i + 1, j);\n\n\t\t\t\t\tif (!entity.includes(\"sp\") && !entity.includes(\"lt\") && !entity.includes(\"gt\")) {\n\t\t\t\t\t\tdecode = true\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\n\n\n\t\t\t\t}\n\t\t\t\ti = text.indexOf('&', i + 1);\n\t\t\t}\n\t\t\tvar slibings = this._STACK.length ? this._STACK[this._STACK.length - 1].children : this.DOM;\n\t\t\tif (slibings.length && slibings[slibings.length - 1].type == \"text\") {\n\t\t\t\tslibings[slibings.length - 1].text += text;\n\t\t\t\tif (decode) slibings[slibings.length - 1].decode = true;\n\t\t\t} else\n\t\t\t\tslibings.push({\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\ttext,\n\t\t\t\t\tdecode\n\t\t\t\t})\n\t\t}\n\t};\n\t// 设置元素节点\n\tsetNode() {\n\t\tvar slibings = this._STACK.length ? this._STACK[this._STACK.length - 1].children : this.DOM;\n\t\tvar node = {\n\t\t\tname: this._tagName.toLowerCase(),\n\t\t\tattrs: this._attrs\n\t\t}\n\t\tconfig.LabelAttrsHandler(node, this);\n\t\tthis._attrs = {};\n\t\tif (this.data[this._i] == '>') {\n\t\t\tif (!config.selfClosingTags[this._tagName]) {\n\t\t\t\tif (config.ignoreTags[node.name]) {\n\t\t\t\t\tvar j = this._i;\n\t\t\t\t\t// 处理要被移除的标签\n\t\t\t\t\twhile (this._i < this.data.length) {\n\t\t\t\t\t\tthis._i = this.data.indexOf(\"\", this._i);\n\t\t\t\t\t\tif (this._i == -1) return this._i = this.data.length;\n\t\t\t\t\t\tthis._i += 2;\n\t\t\t\t\t\tthis._sectionStart = this._i;\n\t\t\t\t\t\twhile (!isBlankChar(this.data[this._i]) && this.data[this._i] != '>' && this.data[this._i] != '/') this._i++;\n\t\t\t\t\t\tif (this.data.substring(this._sectionStart, this._i).toLowerCase() == node.name) {\n\t\t\t\t\t\t\tthis._i = this.data.indexOf('>', this._i);\n\t\t\t\t\t\t\tif (this._i == -1) this._i = this.data.length;\n\t\t\t\t\t\t\telse this._sectionStart = this._i + 1;\n\t\t\t\t\t\t\tthis._state = this.Text;\n\t\t\t\t\t\t\t// 处理svg \n\t\t\t\t\t\t\tif (node.name == \"svg\") {\n\t\t\t\t\t\t\t\tvar src = this.data.substring(j, this._i + 1);\n\t\t\t\t\t\t\t\tif (!node.attrs.xmlns) src = \" xmlns=\\\"http://www.w3.org/2000/svg\\\"\" + src;\n\t\t\t\t\t\t\t\tthis._i = j;\n\t\t\t\t\t\t\t\twhile (this.data[j] != '<') j--;\n\t\t\t\t\t\t\t\tsrc = this.data.substring(j, this._i) + src;\n\t\t\t\t\t\t\t\tthis._i = this._sectionStart - 1;\n\t\t\t\t\t\t\t\tnode.name = \"img\";\n\t\t\t\t\t\t\t\tnode.attrs = {\n\t\t\t\t\t\t\t\t\tsrc: \"data:image/svg+xml;utf8,\" + src.replace(/#/g, \"%23\"),\n\t\t\t\t\t\t\t\t\tignore: \"true\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tslibings.push(node);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t} else this._STACK.push(node);\n\t\t\t\tnode.children = [];\n\t\t\t}\n\t\t} else this._i++;\n\t\tthis._sectionStart = this._i + 1;\n\t\tthis._state = this.Text;\n\t\tif (!config.ignoreTags[node.name]) {\n\t\t\t// 检查空白符是否有效\n\t\t\tif (node.name == \"pre\" || (node.attrs.style && node.attrs.style.toLowerCase().includes(\"white-space\") && node.attrs\n\t\t\t\t\t.style.toLowerCase().includes(\"pre\"))) {\n\t\t\t\tthis._whiteSpace = true;\n\t\t\t\tnode.pre = true;\n\t\t\t}\n\t\t\tslibings.push(node);\n\t\t}\n\t};\n\t// 标签出栈处理\n\tpopNode(node) {\n\t\t// 替换一些标签名\n\t\tif (config.blockTags[node.name]) node.name = 'div';\n\t\telse if (!config.trustTags[node.name]) node.name = 'span';\n\t\t// 空白符处理\n\t\tif (node.pre) {\n\t\t\tthis._whiteSpace = false;\n\t\t\tnode.pre = undefined;\n\t\t\tfor (var i = 0; i < this._STACK.length; i++)\n\t\t\t\tif (this._STACK[i].pre)\n\t\t\t\t\tthis._whiteSpace = true;\n\t\t}\n\t\t// 处理表格的边框\n\t\tif (node.name == 'table') {\n\t\t\tif (node.attrs.border)\n\t\t\t\tnode.attrs.style = \"border:\" + node.attrs.border + \"px solid gray;\" + (node.attrs.style || '');\n\t\t\tif (node.attrs.hasOwnProperty(\"cellspacing\"))\n\t\t\t\tnode.attrs.style = \"border-spacing:\" + node.attrs.cellspacing + \"px;\" + (node.attrs.style || '');\n\n\t\t\tfunction setBorder(elem) {\n\t\t\t\tif (elem.name == 'th' || elem.name == 'td') {\n\t\t\t\t\tif (node.attrs.border)\n\t\t\t\t\t\telem.attrs.style = \"border:\" + node.attrs.border + \"px solid gray;\" + (elem.attrs.style || '');\n\t\t\t\t\tif (node.attrs.hasOwnProperty(\"cellpadding\"))\n\t\t\t\t\t\telem.attrs.style = \"padding:\" + node.attrs.cellpadding + \"px;\" + (elem.attrs.style || '');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (elem.type == 'text') return;\n\t\t\t\tfor (var i = 0; i < elem.children.length; i++)\n\t\t\t\t\tsetBorder(elem.children[i]);\n\t\t\t}\n\t\t\tif (node.attrs.border || node.attrs.hasOwnProperty(\"cellpadding\"))\n\t\t\t\tfor (var i = 0; i < node.children.length; i++)\n\t\t\t\t\tsetBorder(node.children[i]);\n\t\t}\n\t\t// 合并一些不必要的层,减小节点深度\n\t\tif (node.children.length == 1 && node.name == \"div\" && node.children[0].name == \"div\") {\n\t\t\tvar child = node.children[0];\n\t\t\tnode.attrs.style = node.attrs.style || '';\n\t\t\tchild.attrs.style = child.attrs.style || '';\n\t\t\tif (node.attrs.style.includes(\"padding\") && (node.attrs.style.includes(\"margin\") || child.attrs.style.includes(\n\t\t\t\t\t\"margin\")) && node.attrs.style.includes(\"display\") && child.attrs.style.includes(\"display\") && !(node.attrs.id &&\n\t\t\t\t\tnode.attrs.id) && !(node.attrs.class && child.attrs.class)) {\n\t\t\t\tif (child.attrs.style.includes(\"padding\"))\n\t\t\t\t\tchild.attrs.style = \"box-sizing:border-box;\" + child.attrs.style;\n\t\t\t\tnode.attrs.style = node.attrs.style + \";\" + child.attrs.style;\n\t\t\t\tnode.attrs.id = (child.attrs.id || '') + (node.attrs.id || '');\n\t\t\t\tnode.attrs.class = (child.attrs.class || '') + (node.attrs.class || '');\n\t\t\t\tnode.children = child.children;\n\t\t\t}\n\t\t}\n\t\t// 多层样式处理\n\t\tif (this.CssHandler.pop)\n\t\t\tthis.CssHandler.pop(node);\n\t};\n\t// 工具函数\n\tcheckClose() {\n\t\tif (this.data[this._i] == '>' || (this.data[this._i] == '/' && this.data[this._i + 1] == '>'))\n\t\t\treturn true;\n\t\treturn false;\n\t};\n\tgetSelection(trim) {\n\t\tvar str = (this._sectionStart == this._i ? '' : this.data.substring(this._sectionStart, this._i));\n\t\twhile (trim && isBlankChar(this.data[++this._i]));\n\t\tif (trim) this._i--;\n\t\tthis._sectionStart = this._i + 1;\n\t\treturn str;\n\t};\n\t// 状态机\n\tText(c) {\n\t\tif (c == '<') {\n\t\t\tvar next = this.data[this._i + 1];\n\t\t\tif ((next >= 'a' && next <= 'z') || (next >= 'A' && next <= 'Z')) {\n\t\t\t\tthis.setText();\n\t\t\t\tthis._state = this.TagName;\n\t\t\t} else if (next == '/') {\n\t\t\t\tthis.setText();\n\t\t\t\tthis._i++;\n\t\t\t\tnext = this.data[this._i + 1];\n\t\t\t\tif ((next >= 'a' && next <= 'z') || (next >= 'A' && next <= 'Z')) {\n\t\t\t\t\tthis._sectionStart = this._i + 1;\n\t\t\t\t\tthis._state = this.EndTag;\n\t\t\t\t} else\n\t\t\t\t\tthis._state = this.Comment;\n\t\t\t} else if (next == '!') {\n\t\t\t\tthis.setText();\n\t\t\t\tthis._state = this.Comment;\n\t\t\t}\n\t\t}\n\t};\n\tComment() {\n\t\tif (this.data.substring(this._i + 1, this._i + 3) == \"--\" || this.data.substring(this._i + 1, this._i + 7) ==\n\t\t\t\"[CDATA[\") {\n\t\t\tthis._i = this.data.indexOf(\"-->\", this._i + 1);\n\t\t\tif (this._i == -1) return this._i = this.data.length;\n\t\t\telse this._i = this._i + 2;\n\t\t} else {\n\t\t\tthis._i = this.data.indexOf(\">\", this._i + 1);\n\t\t\tif (this._i == -1) return this._i = this.data.length;\n\t\t}\n\t\tthis._sectionStart = this._i + 1;\n\t\tthis._state = this.Text;\n\t};\n\tTagName(c) {\n\t\tif (isBlankChar(c)) {\n\t\t\tthis._tagName = this.getSelection(true);\n\t\t\tif (this.checkClose()) this.setNode();\n\t\t\telse this._state = this.AttrName;\n\t\t} else if (this.checkClose()) {\n\t\t\tthis._tagName = this.getSelection();\n\t\t\tthis.setNode();\n\t\t}\n\t};\n\tAttrName(c) {\n\t\tif (isBlankChar(c)) {\n\t\t\tthis._attrName = this.getSelection(true).toLowerCase();\n\t\t\tif (this.data[this._i] == '=') {\n\t\t\t\twhile (isBlankChar(this.data[++this._i]));\n\t\t\t\tthis._sectionStart = this._i;\n\t\t\t\tthis._i--;\n\t\t\t\tthis._state = this.AttrValue;\n\t\t\t} else this.setAttr();\n\t\t} else if (c == '=') {\n\t\t\tthis._attrName = this.getSelection().toLowerCase();\n\t\t\twhile (isBlankChar(this.data[++this._i]));\n\t\t\tthis._sectionStart = this._i;\n\t\t\tthis._i--;\n\t\t\tthis._state = this.AttrValue;\n\t\t} else if (this.checkClose()) {\n\t\t\tthis._attrName = this.getSelection().toLowerCase();\n\t\t\tthis.setAttr();\n\t\t}\n\t};\n\tAttrValue(c) {\n\t\tif (c == '\"' || c == \"'\") {\n\t\t\tthis._sectionStart++;\n\t\t\tif ((this._i = this.data.indexOf(c, this._i + 1)) == -1) return this._i = this.data.length;\n\t\t} else\n\t\t\tfor (; !isBlankChar(this.data[this._i] && this.data[this._i] != '/' && this.data[this._i] != '>'); this._i++);\n\t\tthis._attrValue = this.getSelection();\n\t\twhile (this._attrValue.includes(\""\")) this._attrValue = this._attrValue.replace(\""\", '');\n\t\tthis.setAttr();\n\t};\n\tEndTag(c) {\n\t\tif (isBlankChar(c) || c == '>' || c == '/') {\n\t\t\tvar name = this.getSelection().toLowerCase();\n\t\t\tvar flag = false;\n\t\t\tfor (var i = this._STACK.length - 1; i >= 0; i--)\n\t\t\t\tif (this._STACK[i].name == name) {\n\t\t\t\t\tflag = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\tif (flag) {\n\t\t\t\tvar node;\n\t\t\t\twhile (flag) {\n\t\t\t\t\tnode = this._STACK.pop();\n\t\t\t\t\tif (node.name == name) flag = false;\n\t\t\t\t\tthis.popNode(node);\n\t\t\t\t}\n\t\t\t} else if (name == 'p' || name == \"br\") {\n\t\t\t\tvar slibings = this._STACK.length ? this._STACK[this._STACK.length - 1].children : this.DOM;\n\t\t\t\tvar node = {\n\t\t\t\t\tname\n\t\t\t\t}\n\t\t\t\tslibings.push(node);\n\t\t\t}\n\t\t\tthis._i = this.data.indexOf('>', this._i);\n\t\t\tif (this._i == -1) this._i = this.data.length;\n\t\t\telse this._state = this.Text;\n\t\t}\n\t};\n};\nmodule.exports = {\n\tparseHtml: (data, options) => new Promise((resolve) => new MpHtmlParser(data, options, resolve).parse()),\n\tparseHtmlSync: (data, options) => new MpHtmlParser(data, options).parse()\n};\n","/*\n 解析和匹配 Css 的选择器\n github地址:https://github.com/jin-yufeng/Parser\n 文档地址:https://jin-yufeng.github.io/Parser\n author:JinYufeng\n*/\nconst userAgentStyles = require(\"./config.js\").userAgentStyles;\nclass CssHandler {\n\tconstructor(tagStyle = {}) {\n\t\tthis.styles = Object.assign({}, tagStyle);\n\t};\n\tgetStyle(data) {\n\t\tvar style = '';\n\t\tdata = data.replace(/<[sS][tT][yY][lL][eE][\\s\\S]*?>([\\s\\S]*?)<\\/[sS][tT][yY][lL][eE][\\s\\S]*?>/g, function() {\n\t\t\tstyle += arguments[1];\n\t\t\treturn '';\n\t\t})\n\t\tthis.styles = new CssParser(style, this.styles).parse();\n\t\treturn data;\n\t};\n\tparseCss(css) {\n\t\treturn new CssParser(css, {}, true).parse();\n\t};\n\tmatch(name, attrs) {\n\t\tvar tmp, matched = ((tmp = this.styles[name]) ? (tmp + ';') : '');\n\t\tif (attrs.class) {\n\t\t\tvar classes = attrs.class.split(' ');\n\t\t\tfor (var i = 0; i < classes.length; i++)\n\t\t\t\tif (tmp = this.styles['.' + classes[i]])\n\t\t\t\t\tmatched += (tmp + ';');\n\t\t}\n\t\tif (tmp = this.styles['#' + attrs.id])\n\t\t\tmatched += tmp;\n\t\treturn matched;\n\t};\n}\nmodule.exports = CssHandler;\n\nfunction isBlankChar(c) {\n\treturn c == ' ' || c == '\\u00A0' || c == '\\t' || c == '\\r' || c == '\\n' || c == '\\f';\n};\nclass CssParser {\n\tconstructor(data, tagStyle, api) {\n\t\tthis.data = data;\n\t\tthis.res = tagStyle;\n\t\tif (!api)\n\t\t\tfor (var item in userAgentStyles) {\n\t\t\t\tif (tagStyle[item]) tagStyle[item] = userAgentStyles[item] + ';' + tagStyle[item];\n\t\t\t\telse tagStyle[item] = userAgentStyles[item];\n\t\t\t}\n\t\tthis._floor = 0;\n\t\tthis._i = 0;\n\t\tthis._list = [];\n\t\tthis._comma = false;\n\t\tthis._sectionStart = 0;\n\t\tthis._state = this.Space;\n\t};\n\tparse() {\n\t\tfor (; this._i < this.data.length; this._i++)\n\t\t\tthis._state(this.data[this._i]);\n\t\treturn this.res;\n\t};\n\t// 状态机\n\tSpace(c) {\n\t\tif (c == '.' || c == '#' || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {\n\t\t\tthis._sectionStart = this._i;\n\t\t\tthis._state = this.StyleName;\n\t\t} else if (c == '/' && this.data[this._i + 1] == '*')\n\t\t\tthis.Comment();\n\t\telse if (!isBlankChar(c) && c != ';')\n\t\t\tthis._state = this.Ignore;\n\t};\n\tComment() {\n\t\tthis._i = this.data.indexOf(\"*/\", this._i);\n\t\tif (this._i == -1) this._i = this.data.length;\n\t\tthis._i++;\n\t\tthis._state = this.Space;\n\t};\n\tIgnore(c) {\n\t\tif (c == '{') this._floor++;\n\t\telse if (c == '}' && --this._floor <= 0) {\n\t\t\tthis._list = [];\n\t\t\tthis._state = this.Space;\n\t\t}\n\t};\n\tStyleName(c) {\n\t\tif (isBlankChar(c)) {\n\t\t\tthis._list.push(this.data.substring(this._sectionStart, this._i));\n\t\t\tthis._state = this.NameSpace;\n\t\t} else if (c == '{') {\n\t\t\tthis._list.push(this.data.substring(this._sectionStart, this._i));\n\t\t\tthis._floor = 1;\n\t\t\tthis._sectionStart = this._i + 1;\n\t\t\tthis.Content();\n\t\t} else if (c == ',') {\n\t\t\tthis._list.push(this.data.substring(this._sectionStart, this._i));\n\t\t\tthis._sectionStart = this._i + 1;\n\t\t\tthis._comma = true;\n\t\t} else if (!(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z') && !(c >= '0' && c <= '9') && c != '.' && c != '#' &&\n\t\t\tc != '-' && c != '_')\n\t\t\tthis._state = this.Ignore;\n\t};\n\tNameSpace(c) {\n\t\tif (c == '{') {\n\t\t\tthis._floor = 1;\n\t\t\tthis._sectionStart = this._i + 1;\n\t\t\tthis.Content();\n\t\t} else if (c == ',') {\n\t\t\tthis._comma = true;\n\t\t\tthis._sectionStart = this._i + 1;\n\t\t\tthis._state = this.StyleName;\n\t\t} else if (!isBlankChar(c)) {\n\t\t\tif (this._comma) {\n\t\t\t\tthis._state = this.StyleName;\n\t\t\t\tthis._sectionStart = this._i;\n\t\t\t\tthis._i--;\n\t\t\t\tthis._comma = false;\n\t\t\t} else this._state = this.Ignore;\n\t\t}\n\t};\n\tContent() {\n\t\tthis._i = this.data.indexOf('}', this._i);\n\t\tif (this._i == -1) this._i = this.data.length;\n\t\t// 去除空白符\n\t\tvar flag = false,\n\t\t\tpos, content = this.data.substring(this._sectionStart, this._i);\n\t\tfor (var i = 0; i < content.length; i++) {\n\t\t\tif (isBlankChar(content[i])) {\n\t\t\t\tif (!flag) {\n\t\t\t\t\tpos = i;\n\t\t\t\t\tflag = true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (flag) {\n\t\t\t\t\tif (pos == 0) content = content.substring(i);\n\t\t\t\t\telse if (i - pos > 1) content = content.substring(0, pos) + (content[pos - 1] == ';' ? (pos--, '') : ' ') +\n\t\t\t\t\t\tcontent.substring(i);\n\t\t\t\t\ti = pos;\n\t\t\t\t\tflag = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (flag) content = content.substring(0, pos);\n\t\tfor (var i = 0; i < this._list.length; i++)\n\t\t\tthis.res[this._list[i]] = (this.res[this._list[i]] || '') + content;\n\t\tthis._list = [];\n\t\tthis._state = this.Space;\n\t}\n}\n","// <<<<<<< HEAD\n/* 配置文件 */\n// =======\n/* 配置文件 xxx*/\n// >>>>>>> 53c74b30a29ef2e569158438db4f5df4b7480643\nfunction makeMap(str) {\n\tvar map = Object.create(null),\n\t\tlist = str.split(',');\n\tfor (var item of list)\n\t\tmap[item] = true;\n\treturn map;\n}\n// 信任的属性列表,不在列表中的属性将被移除 \nconst trustAttrs = makeMap(\n\t\"align,alt,app-id,appId,\"\n\n\n\n\n\t+\n\t\"author,autoplay,border,cellpadding,cellspacing,class,color,colspan,controls,data-src,dir,face,height,href,id,ignore,loop,muted,name,path,poster,rowspan,size,span,src,start,style,type,lbType,lbtype,\"\n\n\t+\n\t\"unit-id,unitId,\"\n\n\t+\n\t\"width,xmlns\"\n);\n// 信任的标签,将保持标签名不变 \nconst trustTags = makeMap(\n\t\"a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,u,ul,video,iframe\"\n);\n// 块级标签,将被转为 div\nconst blockTags = makeMap(\"address,article,aside,body,center,cite,footer,header,html,nav,pre,section\");\n// 被移除的标签(其中 svg 系列标签会被转为图片) \nconst ignoreTags = makeMap(\n\t\"area,base,basefont,canvas,circle,command,ellipse,embed,frame,head,input,isindex,keygen,line,link,map,meta,param,path,polygon,rect,script,source,svg,textarea,track,use,wbr,\"\n);\n// 只能用 rich-text 显示的标签(其中图片不能预览、不能显示视频、音频等) \nconst richOnlyTags = makeMap(\n\t\"a,ad,audio,colgroup,fieldset,legend,li,ol,sub,sup,table,tbody,td,tfoot,th,thead,tr,ul,video,iframe,\");\n// 自闭合标签\nconst selfClosingTags = makeMap(\n\t\"area,base,basefont,br,col,circle,ellipse,embed,frame,hr,img,input,isindex,keygen,line,link,meta,param,path,polygon,rect,source,track,use,wbr,\"\n);\n// 默认的标签样式\nvar userAgentStyles = {\n\ta: \"color:#366092;word-break:break-all;padding:1.5px 0 1.5px 0\",\n\taddress: \"font-style:italic\",\n\tblockquote: \"background-color:#f6f6f6;border-left:3px solid #dbdbdb;color:#6c6c6c;padding:5px 0 5px 10px\",\n\tcenter: \"text-align:center\",\n\tcite: \"font-style:italic\",\n\tcode: \"padding:0 1px 0 1px;margin-left:2px;margin-right:2px;background-color:#f8f8f8;border-radius:3px\",\n\tdd: \"margin-left:40px\",\n\timg: \"max-width:100%\",\n\tmark: \"background-color:yellow\",\n\tpre: \"font-family:monospace;white-space:pre;overflow:scroll\",\n\ts: \"text-decoration:line-through\",\n\tu: \"text-decoration:underline\"\n};\n\nconst SDKVersion = uni.getSystemInfoSync().SDKVersion;\n\nfunction versionHigherThan(version = '') {\n\tvar v1 = SDKVersion.split('.'),\n\t\tv2 = version.split('.');\n\twhile (v1.length != v2.length)\n\t\tv1.length < v2.length ? v1.push('0') : v2.push('0');\n\tfor (var i = 0; i < v1.length; i++) {\n\t\tif (v1[i] == v2[i]) continue;\n\t\tif (parseInt(v1[i]) > parseInt(v2[i])) return true;\n\t\treturn false;\n\t}\n\treturn true;\n};\n\n\n// 版本兼容\nif (versionHigherThan(\"2.7.1\")) {\n\ttrustTags.bdi = true;\n\ttrustTags.bdo = true;\n\ttrustTags.caption = true;\n\ttrustTags.rt = true;\n\ttrustTags.ruby = true;\n\tignoreTags.rp = true;\n\ttrustTags.big = true;\n\ttrustTags.small = true;\n\ttrustTags.pre = true;\n\ttrustTags.iframe = true;\n\trichOnlyTags.bdi = true;\n\trichOnlyTags.bdo = true;\n\trichOnlyTags.caption = true;\n\trichOnlyTags.rt = true;\n\trichOnlyTags.ruby = true;\n\trichOnlyTags.pre = true;\n\tblockTags.pre = undefined;\n} else {\n\tblockTags.caption = true;\n\tuserAgentStyles.big = \"display:inline;font-size:1.2em\";\n\tuserAgentStyles.small = \"display:inline;font-size:0.8em\";\n}\n\nfunction bubbling(Parser) {\n\tfor (var i = Parser._STACK.length - 1; i >= 0; i--) {\n\t\tif (!richOnlyTags[Parser._STACK[i].name])\n\t\t\tParser._STACK[i].c = 1;\n\t\telse return false;\n\t}\n\treturn true;\n}\nmodule.exports = {\n\t// 高亮处理函数\n\thighlight: null,\n\t// 处理标签的属性,需要通过组件递归方式显示的标签需要调用 bubbling(Parser)\n\tLabelAttrsHandler(node, Parser) {\n\t\tnode.attrs.style = Parser.CssHandler.match(node.name, node.attrs, node) + (node.attrs.style || '');\n\t\tswitch (node.name) {\n\t\t\tcase \"ul\":\n\t\t\tcase \"ol\":\n\t\t\tcase \"li\":\n\t\t\tcase \"dd\":\n\t\t\tcase \"dl\":\n\t\t\tcase \"dt\":\n\t\t\tcase \"div\":\n\t\t\tcase \"span\":\n\t\t\tcase \"em\":\n\t\t\tcase 'p':\n\t\t\t\tlet default_p_style = \"max-width: 100% !important;display:block;\"\n\t\t\t\tif (node.attrs.style) {\n\t\t\t\t\tnode.attrs.style = node.attrs.style.includes('width:') ? default_p_style : node.attrs.style + default_p_style\n\t\t\t\t}\n\t\t\t\tif (node.attrs.align) {\n\t\t\t\t\tnode.attrs.style = \"text-align:\" + node.attrs.align + ';' + node.attrs.style;\n\t\t\t\t\tnode.attrs.align = undefined;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"img\":\n\t\t\t\tif (node.attrs.height) {\n\t\t\t\t\tnode.attrs.height = 'auto'\n\t\t\t\t}\n\t\t\t\tlet default_style = \"max-width: 100% !important;display:block;\"\n\t\t\t\tif (node.attrs.style) {\n\t\t\t\t\tnode.attrs.style = node.attrs.style.includes('height:') ? default_style : node.attrs.style + default_style\n\t\t\t\t}\n\t\t\t\tif (node.attrs[\"data-src\"]) {\n\t\t\t\t\tnode.attrs.src = node.attrs.src || node.attrs[\"data-src\"];\n\t\t\t\t\tnode.attrs[\"data-src\"] = undefined;\n\t\t\t\t}\n\n\n\n\t\t\t\tif (node.attrs.src) {\n\t\t\t\t\tif (!node.attrs.ignore) {\n\t\t\t\t\t\tif (bubbling(Parser)) node.attrs.i = (Parser._imgNum++).toString();\n\t\t\t\t\t\telse node.attrs.ignore = \"true\";\n\t\t\t\t\t}\n\t\t\t\t\tif (Parser._domain && node.attrs.src[0] == '/') {\n\t\t\t\t\t\tif (node.attrs.src[1] == '/') node.attrs.src = Parser._protocol + \":\" + node.attrs.src;\n\t\t\t\t\t\telse node.attrs.src = Parser._domain + node.attrs.src;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'a':\n\t\t\tcase \"ad\":\n\t\t\t\tbubbling(Parser);\n\t\t\t\tbreak;\n\t\t\tcase \"font\":\n\t\t\t\tif (node.attrs.color) {\n\t\t\t\t\tnode.attrs.style = \"color:\" + node.attrs.color + ';' + node.attrs.style;\n\t\t\t\t\tnode.attrs.color = undefined;\n\t\t\t\t}\n\t\t\t\tif (node.attrs.face) {\n\t\t\t\t\tnode.attrs.style = \"font-family:\" + node.attrs.face + ';' + node.attrs.style;\n\t\t\t\t\tnode.attrs.face = undefined;\n\t\t\t\t}\n\t\t\t\tif (node.attrs.size) {\n\t\t\t\t\tvar size = parseInt(node.attrs.size);\n\t\t\t\t\tif (size < 1) size = 1;\n\t\t\t\t\telse if (size > 7) size = 7;\n\t\t\t\t\tvar map = [\"xx-small\", \"x-small\", \"small\", \"medium\", \"large\", \"x-large\", \"xx-large\"];\n\t\t\t\t\tnode.attrs.style = \"font-size:\" + map[size - 1] + ';' + node.attrs.style;\n\t\t\t\t\tnode.attrs.size = undefined;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'iframe':\n\t\t\tcase \"video\":\n\t\t\tcase \"audio\":\n\t\t\t\tnode.attrs.loop = node.attrs.hasOwnProperty('loop') || false;\n\t\t\t\tnode.attrs.controls = node.attrs.hasOwnProperty(\n\t\t\t\t\t'controls') || true;\n\t\t\t\tnode.attrs.autoplay = node.attrs.hasOwnProperty('autoplay') || false;\n\t\t\t\tif (node.attrs.id) Parser['_' + node.name + \"Num\"]++;\n\t\t\t\telse node.attrs.id = (node.name + (++Parser['_' + node.name + \"Num\"]));\n\t\t\t\tif (node.name == \"video\") {\n\t\t\t\t\tnode.attrs.style = node.attrs.style || '';\n\t\t\t\t\tif (node.attrs.width) {\n\t\t\t\t\t\tnode.attrs.style = \"width:\" + parseFloat(node.attrs.width) + (node.attrs.height.includes('%') ? '%' : \"px\") +\n\t\t\t\t\t\t\t';' + node.attrs.style;\n\t\t\t\t\t\tnode.attrs.width = undefined;\n\t\t\t\t\t}\n\t\t\t\t\tif (node.attrs.height) {\n\t\t\t\t\t\tnode.attrs.style = \"height:\" + parseFloat(node.attrs.height) + (node.attrs.height.includes('%') ? '%' : \"px\") +\n\t\t\t\t\t\t\t';' + node.attrs.style;\n\t\t\t\t\t\tnode.attrs.height = undefined;\n\t\t\t\t\t}\n\t\t\t\t\tif (Parser._videoNum > 3) node.lazyLoad = true;\n\t\t\t\t}\n\t\t\t\t// 新增iframe【create_by_xx】 \n\t\t\t\tif (node.name == 'iframe') {\n\t\t\t\t\t// console.log(node.attrs, \"====iframe attrs\");\n\t\t\t\t}\n\t\t\t\tnode.attrs.source = [];\n\t\t\t\tif (node.attrs.src) node.attrs.source.push(node.attrs.src);\n\t\t\t\tif (!node.attrs.controls && !node.attrs.autoplay)\n\t\t\t\t\tconsole.warn(\"存在没有controls属性的 \" + node.name + \" 标签,可能导致无法播放\", node);\n\t\t\t\tbubbling(Parser);\n\t\t\t\tbreak;\n\t\t\tcase \"source\":\n\t\t\t\tvar parent = Parser._STACK[Parser._STACK.length - 1];\n\t\t\t\tif (parent && (parent.name == \"video\" || parent.name == \"audio\")) {\n\t\t\t\t\tparent.attrs.source.push(node.attrs.src);\n\t\t\t\t\tif (!parent.attrs.src) parent.attrs.src = node.attrs.src;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t\tif (Parser._domain && node.attrs.style.includes(\"url\"))\n\t\t\tnode.attrs.style = node.attrs.style.replace(/url\\s*\\(['\"\\s]*(\\S*?)['\"\\s]*\\)/, function() {\n\t\t\t\tvar src = arguments[1];\n\t\t\t\tif (src && src[0] == '/') {\n\t\t\t\t\tif (src[1] == '/') return \"url(\" + Parser._protocol + ':' + src + ')';\n\t\t\t\t\telse return \"url(\" + Parser._domain + src + ')';\n\t\t\t\t} else return arguments[0];\n\t\t\t})\n\t\tif (!node.attrs.style) node.attrs.style = undefined;\n\t\tif (Parser._useAnchor && node.attrs.id) bubbling(Parser);\n\t},\n\ttrustAttrs,\n\ttrustTags,\n\tblockTags,\n\tignoreTags,\n\tselfClosingTags,\n\tuserAgentStyles,\n\n\tversionHigherThan,\n\n\tmakeMap\n}\n","function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n return arr2;\n}\nmodule.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","const styles = (v ='') => v.split(';').filter(v => v && !/^[\\n\\s]+$/.test(v)).map(v => {\n\t\t\t\t\t\tconst key = v.slice(0, v.indexOf(':'))\n\t\t\t\t\t\tconst value = v.slice(v.indexOf(':')+1)\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t[key\n\t\t\t\t\t\t\t\t.replace(/-([a-z])/g, function() { return arguments[1].toUpperCase()})\n\t\t\t\t\t\t\t\t.replace(/\\s+/g, '')\n\t\t\t\t\t\t\t]: value.replace(/^\\s+/, '').replace(/\\s+$/, '') || ''\n\t\t\t\t\t\t}\n\t\t\t\t\t})\nexport function parent(parent) {\n\treturn {\n\t\tprovide() {\n\t\t\treturn {\n\t\t\t\t[parent]: this\n\t\t\t}\n\t\t},\n\t\tdata() {\n\t\t\treturn {\n\t\t\t\tel: {\n\t\t\t\t\tcss: {},\n\t\t\t\t\tviews: []\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t\twatch: {\n\t\t\tcss: { \n\t\t\t\thandler(v) {\n\t\t\t\t\tif(this.canvasId) {\n\t\t\t\t\t\tthis.el.css = (typeof v == 'object' ? v : v && Object.assign(...styles(v))) || {}\n\t\t\t\t\t\tthis.canvasWidth = this.el.css && this.el.css.width || this.canvasWidth\n\t\t\t\t\t\tthis.canvasHeight = this.el.css && this.el.css.height || this.canvasHeight\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\timmediate: true\n\t\t\t}\n\t\t}\n\t}\n}\nexport function children(parent, options = {}) {\n\tconst indexKey = options.indexKey || 'index'\n\treturn {\n\t\tinject: {\n\t\t\t[parent]: {\n\t\t\t\tdefault: null\n\t\t\t}\n\t\t},\n\t\twatch: {\n\t\t\tel: {\n\t\t\t\thandler(v, o) {\n\t\t\t\t\tif(JSON.stringify(v) != JSON.stringify(o))\n\t\t\t\t\t\tthis.bindRelation()\n\t\t\t\t},\n\t\t\t\tdeep: true,\n\t\t\t\timmediate: true\n\t\t\t},\n\t\t\tsrc: {\n\t\t\t\thandler(v, o) {\n\t\t\t\t\tif(v != o)\n\t\t\t\t\t\tthis.bindRelation()\n\t\t\t\t},\n\t\t\t\timmediate: true\n\t\t\t},\n\t\t\ttext: {\n\t\t\t\thandler(v, o) {\n\t\t\t\t\tif(v != o) this.bindRelation()\n\t\t\t\t},\n\t\t\t\timmediate: true\n\t\t\t},\n\t\t\tcss: {\n\t\t\t\thandler(v, o) {\n\t\t\t\t\tif(v != o)\n\t\t\t\t\t\tthis.el.css = (typeof v == 'object' ? v : v && Object.assign(...styles(v))) || {}\n\t\t\t\t},\n\t\t\t\timmediate: true\n\t\t\t},\n\t\t\treplace: {\n\t\t\t\thandler(v, o) {\n\t\t\t\t\tif(JSON.stringify(v) != JSON.stringify(o))\n\t\t\t\t\t\tthis.bindRelation()\n\t\t\t\t},\n\t\t\t\tdeep: true,\n\t\t\t\timmediate: true\n\t\t\t}\n\t\t},\n\t\tcreated() {\n\t\t\tif(!this._uid) {\n\t\t\t\tthis._uid = this._.uid\n\t\t\t}\n\t\t\tObject.defineProperty(this, 'parent', {\n\t\t\t\tget: () => this[parent] || [],\n\t\t\t})\n\t\t\tObject.defineProperty(this, 'index', {\n\t\t\t\tget: () => {\n\t\t\t\t\tthis.bindRelation();\n\t\t\t\t\tconst {parent: {el: {views=[]}={}}={}} = this\n\t\t\t\t\treturn views.indexOf(this.el)\n\t\t\t\t},\n\t\t\t});\n\t\t\tthis.el.type = this.type\n\t\t\t\n\t\t\tthis.bindRelation()\n\t\t},\n\n\n\n\n\n\n\t\tbeforeDestroy() {\n\t\t\tthis.removeEl()\n\t\t},\n\n\t\tmethods: {\n\t\t\tremoveEl() {\n\t\t\t\tif (this.parent) {\n\t\t\t\t\tthis.parent.el.views = this.parent.el.views.filter(\n\t\t\t\t\t\t(item) => item._uid !== this._uid\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\tbindRelation() {\n\t\t\t\tif(!this.el._uid) {\n\t\t\t\t\tthis.el._uid = this._uid \n\t\t\t\t}\n\t\t\t\tif(['text','qrcode'].includes(this.type)) {\n\t\t\t\t\tthis.el.text = this.$slots && this.$slots.default && this.$slots.default[0].text || `${this.text || ''}`.replace(/\\\\n/g, '\\n')\n\t\t\t\t}\n\t\t\t\tif(this.type == 'image') {\n\t\t\t\t\tthis.el.src = this.src\n\t\t\t\t}\n\t\t\t\tif (!this.parent) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet views = this.parent.el.views || [];\n\t\t\t\tif(views.indexOf(this.el) !== -1) {\n\t\t\t\t\tthis.parent.el.views = views.map(v => v._uid == this._uid ? this.el : v)\n\t\t\t\t} else {\n\t\t\t\t\tthis.parent.el.views = [...views, this.el];\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tmounted() {\n\t\t\t// this.bindRelation()\n\t\t},\n\t}\n}","export default {\r\n\tprops: {\r\n\t\tboard: Object,\r\n\t\tpathType: String, // 'base64'、'url'\r\n\t\tfileType: {\r\n\t\t\ttype: String,\r\n\t\t\tdefault: 'png'\r\n\t\t},\r\n\t\tquality: {\r\n\t\t\ttype: Number,\r\n\t\t\tdefault: 1\r\n\t\t},\r\n\t\tcss: [String, Object],\r\n\t\t// styles: [String, Object],\r\n\t\twidth: [Number, String],\r\n\t\theight: [Number, String],\r\n\t\tpixelRatio: Number,\r\n\t\tcustomStyle: String,\r\n\t\tisCanvasToTempFilePath: Boolean,\r\n\t\t// useCanvasToTempFilePath: Boolean,\r\n\t\tsleep: {\r\n\t\t\ttype: Number,\r\n\t\t\tdefault: 1000 / 30\r\n\t\t},\r\n\t\tbeforeDelay: {\r\n\t\t\ttype: Number,\r\n\t\t\tdefault: 100\r\n\t\t},\r\n\t\tafterDelay: {\r\n\t\t\ttype: Number,\r\n\t\t\tdefault: 100\r\n\t\t},\r\n\r\n\t\ttype: {\r\n\t\t\ttype: String,\r\n\t\t\tdefault: '2d'\r\n\t\t},\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\t}\r\n}","export const networkReg = /^(http|\\/\\/)/;\nexport const isBase64 = (path) => /^data:image\\/(\\w+);base64/.test(path);\nexport function sleep(delay) {\n\treturn new Promise(resolve => setTimeout(resolve, delay))\n}\nconst isDev = ['devtools'].includes(uni.getSystemInfoSync().platform)\n// 缓存图片\nlet cache = {}\nexport function isNumber(value) {\n\treturn /^-?\\d+(\\.\\d+)?$/.test(value);\n}\nexport function toPx(value, baseSize, isDecimal = false) {\n\t// 如果是数字\n\tif (typeof value === 'number') {\n\t\treturn value\n\t}\n\t// 如果是字符串数字\n\tif (isNumber(value)) {\n\t\treturn value * 1\n\t}\n\t// 如果有单位\n\tif (typeof value === 'string') {\n\t\tconst reg = /^-?([0-9]+)?([.]{1}[0-9]+){0,1}(em|rpx|px|%)$/g\n\t\tconst results = reg.exec(value);\n\t\tif (!value || !results) {\n\t\t\treturn 0;\n\t\t}\n\t\tconst unit = results[3];\n\t\tvalue = parseFloat(value);\n\t\tlet res = 0;\n\t\tif (unit === 'rpx') {\n\t\t\tres = uni.upx2px(value);\n\t\t} else if (unit === 'px') {\n\t\t\tres = value * 1;\n\t\t} else if (unit === '%') {\n\t\t\tres = value * toPx(baseSize) / 100;\n\t\t} else if (unit === 'em') {\n\t\t\tres = value * toPx(baseSize || 14);\n\t\t}\n\t\treturn isDecimal ? res.toFixed(2) * 1 : Math.round(res);\n\t}\n\treturn 0\n}\n\n// 计算版本\nexport function compareVersion(v1, v2) {\n\tv1 = v1.split('.')\n\tv2 = v2.split('.')\n\tconst len = Math.max(v1.length, v2.length)\n\twhile (v1.length < len) {\n\t\tv1.push('0')\n\t}\n\twhile (v2.length < len) {\n\t\tv2.push('0')\n\t}\n\tfor (let i = 0; i < len; i++) {\n\t\tconst num1 = parseInt(v1[i], 10)\n\t\tconst num2 = parseInt(v2[i], 10)\n\n\t\tif (num1 > num2) {\n\t\t\treturn 1\n\t\t} else if (num1 < num2) {\n\t\t\treturn -1\n\t\t}\n\t}\n\treturn 0\n}\n\nexport const prefix = () => {\n\n\n\n\n\treturn wx\n\n\n\n\n\n\n\n\n\n\n\n\n\n}\n\n\n\nconst base64ToArrayBuffer = (data) => {\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\treturn uni.base64ToArrayBuffer(data)\n\n}\n\n\n/**\n * base64转路径\n * @param {Object} base64\n */\nexport function base64ToPath(base64) {\n\tconst [, format] = /^data:image\\/(\\w+);base64,/.exec(base64) || [];\n\n\treturn new Promise((resolve, reject) => {\n\n\t\tconst fs = uni.getFileSystemManager()\n\t\t//自定义文件名\n\t\tif (!format) {\n\t\t\treject(new Error('ERROR_BASE64SRC_PARSE'))\n\t\t}\n\t\tconst time = new Date().getTime();\n\t\tlet pre = prefix()\n\t\tconst filePath = `${pre.env.USER_DATA_PATH}/${time}.${format}`\n\t\t//let buffer = base64ToArrayBuffer(bodyData)\n\t\tfs.writeFile({\n\t\t\tfilePath,\n\t\t\tdata: base64.split(',')[1], //base64.replace(/^data:\\S+\\/\\S+;base64,/, ''),\n\t\t\tencoding: 'base64',\n\t\t\t// data: buffer,\n\t\t\t// encoding: 'binary',\n\t\t\tsuccess() {\n\t\t\t\tresolve(filePath)\n\t\t\t},\n\t\t\tfail(err) {\n\t\t\t\treject(err)\n\t\t\t}\n\t\t})\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t})\n}\n\n/**\n * 路径转base64\n * @param {Object} string\n */\nexport function pathToBase64(path) {\n\tif (/^data:/.test(path)) return path\n\treturn new Promise((resolve, reject) => {\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\tif (uni.canIUse('getFileSystemManager')) {\n\t\t\tuni.getFileSystemManager().readFile({\n\t\t\t\tfilePath: path,\n\t\t\t\tencoding: 'base64',\n\t\t\t\tsuccess: (res) => {\n\t\t\t\t\tresolve('data:image/png;base64,' + res.data)\n\t\t\t\t},\n\t\t\t\tfail: (error) => {\n\t\t\t\t\treject(error)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t})\n}\n\n\n\nexport function getImageInfo(path, useCORS) {\n\treturn new Promise(async (resolve, reject) => {\n\t\tlet src = path\n\t\tif (cache[path] && cache[path].errMsg) {\n\t\t\tresolve(cache[path])\n\t\t} else {\n\t\t\ttry {\n\t\t\t\t// if (!isBase64 && PLATFORM == UNI_PLATFORM.PLUS && !/^\\/?(static|_doc)\\//.test(src)) {\n\t\t\t\t// \tsrc = await downloadFile(path) as string\n\t\t\t\t// } else \n\n\t\t\t\tif (isBase64(path)) {\n\t\t\t\t\tsrc = await base64ToPath(path)\n\t\t\t\t}\n\n\n\n\n\n\n\t\t\t\t\n\t\t\t} catch (error) {\n\t\t\t\treject({\n\t\t\t\t\t...error,\n\t\t\t\t\tsrc\n\t\t\t\t})\n\t\t\t}\n\t\t\tuni.getImageInfo({\n\t\t\t\tsrc,\n\t\t\t\tsuccess: (image) => {\n\t\t\t\t\tconst localReg = /^\\.|^\\/(?=[^\\/])/;\n\n\t\t\t\t\timage.path = localReg.test(src) ? `/${image.path}` : image.path;\n\n\n\n\n\t\t\t\t\tif (isDev) {\n\t\t\t\t\t\tresolve(image)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcache[path] = image\n\t\t\t\t\t\tresolve(cache[path])\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tfail(err) {\n\t\t\t\t\treject({\n\t\t\t\t\t\terr,\n\t\t\t\t\t\tpath\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t})\n}\n\nexport function downloadFile(url) {\n\tif (!url) return Promise.reject({\n\t\terr: 'no url'\n\t})\n\treturn new Promise((resolve, reject) => {\n\t\tif (cache[url]) {\n\t\t\treturn reject()\n\t\t}\n\t\tcache[url] = 1\n\t\tuni.downloadFile({\n\t\t\turl,\n\t\t\tsuccess(res) {\n\t\t\t\tresolve(res)\n\t\t\t},\n\t\t\tfail(err) {\n\t\t\t\treject(err)\n\t\t\t}\n\t\t})\n\t})\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","var t=function(){return t=Object.assign||function(t){for(var e,i=1,n=arguments.length;i0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]=360&&(s-=360);s<0&&(s+=360);if(0===(s=Math.round(s)))return{x0:Math.round(e/2)+n,y0:i+r,x1:Math.round(e/2)+n,y1:r};if(180===s)return{x0:Math.round(e/2)+n,y0:r,x1:Math.round(e/2)+n,y1:i+r};if(90===s)return{x0:n,y0:Math.round(i/2)+r,x1:e+n,y1:Math.round(i/2)+r};if(270===s)return{x0:e+n,y0:Math.round(i/2)+r,x1:n,y1:Math.round(i/2)+r};var a=Math.round(180*Math.asin(e/Math.sqrt(Math.pow(e,2)+Math.pow(i,2)))/Math.PI);if(s===a)return{x0:n,y0:i+r,x1:e+n,y1:r};if(s===180-a)return{x0:n,y0:r,x1:e+n,y1:i+r};if(s===180+a)return{x0:e+n,y0:r,x1:n,y1:i+r};if(s===360-a)return{x0:e+n,y0:i+r,x1:n,y1:r};var h=0,d=0,c=0,l=0;if(s180-a&&s<180||s>180&&s<180+a||s>360-a){var f=s*Math.PI/180,u=s360-a?i/2:-i/2,p=Math.tan(f)*u,g=s180-a&&s<180?e/2-p:-e/2-p;h=-(c=p+(v=Math.pow(Math.sin(f),2)*g)),d=-(l=u+v/Math.tan(f))}if(s>a&&s<90||s>90&&s<90+a||s>180+a&&s<270||s>270&&s<360-a){var v;f=(90-s)*Math.PI/180,p=s>a&&s<90||s>90&&s<90+a?e/2:-e/2,u=Math.tan(f)*p,g=s>a&&s<90||s>270&&s<360-a?i/2-u:-i/2-u;h=-(c=p+(v=Math.pow(Math.sin(f),2)*g)/Math.tan(f)),d=-(l=u+v)}return h=Math.round(h+e/2)+n,d=Math.round(i/2-d)+r,c=Math.round(c+e/2)+n,l=Math.round(i/2-l)+r,{x0:h,y0:d,x1:c,y1:l}}(r,t,e,i,n),a=s.x0,h=s.y0,d=s.x1,c=s.y1,l=o.createLinearGradient(a,h,d,c),f=r.match(/linear-gradient\\((.+)\\)/)[1],u=F(f.substring(f.indexOf(\",\")+1)),p=0;pt.length)&&(e=t.length);for(var i=0,n=new Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}function Y(t){return\"number\"==typeof t}function $(t){return\"auto\"===t||null===t}function D(t){return/%$/.test(t)}var X,_=0,N=function(){function t(){j(this,\"elements\",[]),j(this,\"afterElements\",[]),j(this,\"beforeElements\",[]),j(this,\"ids\",[]),j(this,\"width\",0),j(this,\"height\",0),j(this,\"top\",0),j(this,\"left\",0),j(this,\"pre\",null),j(this,\"offsetX\",0),j(this,\"offsetY\",0),_++,this.id=_}var e=t.prototype;return e.fixedBind=function(t,e){void 0===e&&(e=0),this.container=e?t.parent:t.root,this.container.fixedLine=this,this.fixedAdd(t)},e.fixedAdd=function(t){this.elements.push(t);var e=t.computedStyle.zIndex;(void 0===e?0:e)>=0?this.afterElements.push(t):this.beforeElements.push(t),this.refreshLayout()},e.bind=function(t){this.container=t.parent,this.container.line=null,this.container.lines?(this.container.lines.push(this),this.pre=this.getPreLine(),this.top=this.pre.top+this.pre.height,this.left=this.container.contentSize.left):(this.top=this.container.contentSize.top,this.left=this.container.contentSize.left,this.container.lines=[this]),this.isInline=t.isInline(),this.container.line=this,this.outerWidth=t.parent&&t.parent.contentSize.width?t.parent.contentSize.width:1/0,this.add(t)},e.getPreLine=function(){return this.container.lines[this.container.lines.length-2]},e.canIEnter=function(t){return!((100*t.offsetSize.width+100*this.width)/100>this.outerWidth)||(this.closeLine(),!1)},e.closeLine=function(){delete this.container.line},e.add=function(t){this.ids.push(t.id),this.elements.push(t),this.refreshWidthHeight(t)},e.refreshWidthHeight=function(t){t.offsetSize.height>this.height&&(this.height=t.offsetSize.height),this.width+=t.offsetSize.width||0,(this.container.lineMaxWidth||0)this[this.key.height]&&(this[this.key.height]=t.offsetSize[this.key.height]),this[this.key.width]+=t.offsetSize[this.key.width],(this.container.lineMaxWidth||0)1?0:\"flex-end\"===t.style.alignSelf?this.container.contentSize[this.key.contentHeight]-t.contentSize[this.key.height]:\"center\"===t.style.alignSelf?(this.container.contentSize[this.key.contentHeight]-t.contentSize[this.key.height])/2:0},n}(N),q=y,J=v,Q=g,Z=b,K=x,et=m,it=S,nt=z,rt=B,ot=0,st={left:null,top:null,width:null,height:null},at=function(){function t(t,e,i,n){var r=this;j(this,\"id\",ot++),j(this,\"style\",{left:null,top:null,width:null,height:null}),j(this,\"computedStyle\",{}),j(this,\"originStyle\",{}),j(this,\"children\",{}),j(this,\"layoutBox\",C({},st)),j(this,\"contentSize\",C({},st)),j(this,\"clientSize\",C({},st)),j(this,\"borderSize\",C({},st)),j(this,\"offsetSize\",C({},st)),this.ctx=n,this.root=i,e&&(this.parent=e),this.name=t.name||t.type,this.attributes=this.getAttributes(t);var o=this.getComputedStyle(t,null==e?void 0:e.computedStyle);this.isAbsolute=o.position==nt,this.isFixed=o.position==rt,this.originStyle=o,Object.keys(o).forEach((function(t){Object.defineProperty(r.style,t,{configurable:!0,enumerable:!0,get:function(){return o[t]},set:function(e){o[t]=e}})}));var s={contentSize:C({},this.contentSize),clientSize:C({},this.clientSize),borderSize:C({},this.borderSize),offsetSize:C({},this.offsetSize)};Object.keys(s).forEach((function(t){Object.keys(r[t]).forEach((function(e){Object.defineProperty(r[t],e,{configurable:!0,enumerable:!0,get:function(){return s[t][e]},set:function(i){s[t][e]=i}})}))})),this.computedStyle=this.style}var e=t.prototype;return e.add=function(t){t.parent=this,this.children[t.id]=t},e.getChildren=function(){var t=this;return Object.keys(this.children).map((function(e){return t.children[e]}))},e.getLineRect=function(t,e){var i={width:0,height:0},n=e?e.lines:this.parent&&this.parent.lines;return n&&n.find((function(e){return e.ids.includes(t)}))||i},e.getComputedStyle=function(t,e){var i=[\"color\",\"fontSize\",\"lineHeight\",\"verticalAlign\",\"fontWeight\",\"textAlign\"],n=t.css,r=void 0===n?{}:n,o=t.type,s=void 0===o?Q:o,a=C({},M);if([J,q,Z].includes(s)&&!r.display&&(a.display=et),e)for(var h=0;h=0&&l<0,Y=d>=0&&u<0;return i==s[0]&&(this[i].left=t.left+a+v+C+(U?2*-l:0),this[i].top=t.top+d+b+P+(Y?2*-u:0),this[i].width=t.width+(this[i].widthAdd?0:E),this[i].height=t.height+(this[i].heightAdd?0:H),this[i].widthAdd=E,this[i].heightAdd=H),i==s[1]&&(this[i].left=t.left+a+C+(U<0?-l:0),this[i].top=t.top+d+P+(Y?-u:0),this[i].width=t.width+v+m,this[i].height=t.height+b+S),i==s[2]&&(this[i].left=t.left+a+C/2+(U<0?-l:0),this[i].top=t.top+d+P/2+(Y?-u:0),this[i].width=t.width+v+m+C/2+A/2,this[i].height=t.height+b+S+O/2+P/2),i==s[3]&&(this[i].left=t.left+(U<0?-l:0),this[i].top=t.top+(Y?-u:0),this[i].width=t.width+v+m+C+A+a+l,this[i].height=t.height+b+S+O+P+u+d),this[i]},e.layoutBoxUpdate=function(t,e,i,n){var r=this;if(void 0===i&&(i=-1),\"border-box\"==e.boxSizing){var o=e||{},a=o.border,h=(a=void 0===a?{}:a).borderWidth,d=void 0===h?0:h,c=o.borderTop,l=(c=void 0===c?{}:c).borderTopWidth,f=void 0===l?d:l,u=o.borderBottom,p=(u=void 0===u?{}:u).borderBottomWidth,g=void 0===p?d:p,v=o.borderRight,y=(v=void 0===v?{}:v).borderRightWidth,b=void 0===y?d:y,x=o.borderLeft,m=(x=void 0===x?{}:x).borderLeftWidth,w=void 0===m?d:m,S=o.padding,z=(S=void 0===S?{}:S).paddingTop,B=void 0===z?0:z,M=S.paddingRight,I=void 0===M?0:M,k=S.paddingBottom,P=void 0===k?0:k,W=S.paddingLeft,R=void 0===W?0:W;i||(t.width-=R+I+b+w),1!==i||n||(t.height-=B+P+f+g)}this.layoutBox&&(s.forEach((function(i){return r.layoutBox[i]=r.getOffsetSize(t,e,i)})),this.layoutBox=Object.assign({},this.layoutBox,this.layoutBox.borderSize))},e.getBoxPosition2=function(){var t=this.computedStyle,e=this.fixedLine,i=this.lines,n=t.left,r=void 0===n?0:n,o=t.top,s=void 0===o?0:o,a=t.padding||{},h=a.paddingBottom,d=void 0===h?0:h,c=a.paddingRight,l=void 0===c?0:c,f=C({},this.contentSize,{left:r,top:s}),u=this.contentSize.top-this.offsetSize.top,p=this.contentSize.left-this.offsetSize.left;if(this.root.fixedLine&&!this.root.isDone){this.root.isDone=!0;for(var g,v=U(this.root.fixedLine.elements);!(g=v()).done;){var y=g.value;y.setPosition(y,this.root.offsetSize),y.getBoxPosition2()}}if(e)for(var b,x=U(e.elements);!(b=x()).done;){var m=b.value;m.setPosition(m,f),m.style.left+=r+p+l,m.style.top+=s+u+d,m.getBoxPosition2()}if(i)for(var w,S=U(i);!(w=S()).done;){w.value.layout(f.top+u,f.left+p)}return this.layoutBoxUpdate(f,t),this.layoutBox},e.getBoxState=function(t,e){return this.isBlock(t)||this.isBlock(e)},e.isBlock=function(t){return void 0===t&&(t=this),t&&t.style.display==K},e.isFlex=function(t){return void 0===t&&(t=this),t&&t.style.display==it},e.isInFlow=function(){return!(this.isAbsolute||this.isFixed)},e.inFlexBox=function(t){return void 0===t&&(t=this),!!t.isInFlow()&&(!!t.parent&&(!(!t.parent||t.parent.style.display!==it)||void 0))},e.isInline=function(t){return void 0===t&&(t=this),t&&t.style.display==et},e.contrastSize=function(t,e,i){var n=t;return i&&(n=Math.min(n,i)),e&&(n=Math.max(n,e)),n},e.measureText=function(t,e){var i=this.ctx.measureText(t),n=i.width,r=i.actualBoundingBoxAscent,o=i.actualBoundingBoxDescent;return{ascent:r,descent:o,width:n,fontHeight:r+o||.7*e+1}},e.getBoxWidthHeight=function(){var t,e=this,i=this.name,n=this.computedStyle,r=this.attributes,o=this.parent,s=void 0===o?{}:o,a=this.ctx,h=this.getChildren(),d=n.left,c=void 0===d?0:d,l=n.top,f=void 0===l?0:l,u=n.bottom,p=n.right,g=n.width,v=void 0===g?0:g,y=n.minWidth,b=n.maxWidth,x=n.minHeight,m=n.maxHeight,w=n.height,S=void 0===w?0:w,z=n.fontSize,B=void 0===z?14:z,M=n.fontWeight,I=n.fontFamily,k=n.fontStyle,P=n.position,W=n.lineClamp,R=n.lineHeight,L=n.padding,T=void 0===L?{}:L,A=n.margin,F=void 0===A?{}:A,j=n.border,C=(j=void 0===j?{}:j).borderWidth,E=void 0===C?0:C,H=n.borderRight,U=(H=void 0===H?{}:H).borderRightWidth,Y=void 0===U?E:U,$=n.borderLeft,X=($=void 0===$?{}:$).borderLeftWidth,_=void 0===X?E:X,V=s.contentSize&&s.contentSize.width,Z=s.contentSize&&s.contentSize.height;if(D(v)&&V&&(v=O(v,V)),D(v)&&!V&&(v=null),D(S)&&Z&&(S=O(S,Z)),D(S)&&!Z&&(S=null),D(y)&&V&&(y=O(y,V)),D(b)&&V&&(b=O(b,V)),D(x)&&Z&&(x=O(x,Z)),D(m)&&Z&&(m=O(m,Z)),n.padding&&null!=(t=s.contentSize)&&t.width)for(var K in n.padding)Object.hasOwnProperty.call(n.padding,K)&&(n.padding[K]=O(n.padding[K],V));var tt=T.paddingRight,et=void 0===tt?0:tt,it=T.paddingLeft,rt=void 0===it?0:it;if(n.margin&&[n.margin.marginLeft,n.margin.marginRight].includes(\"auto\"))if(v){var ot=V&&V-v-et-rt-_-Y||0;n.margin.marginLeft==n.margin.marginRight?n.margin.marginLeft=n.margin.marginRight=ot/2:\"auto\"==n.margin.marginLeft?n.margin.marginLeft=ot:n.margin.marginRight=ot}else n.margin.marginLeft=n.margin.marginRight=0;var st=F.marginRight,at=void 0===st?0:st,ht=F.marginLeft,dt={width:v,height:S,left:0,top:0},ct=rt+et+_+Y+(void 0===ht?0:ht)+at;if(i==J&&!this.attributes.widths){var lt=r.text||\"\";a.save(),a.setFonts({fontFamily:I,fontSize:B,fontWeight:M,fontStyle:k});var ft=new Map;lt.split(\"\\n\").map((function(t){var i=t.split(\"\").map((function(t){var i=ft.get(t);if(i)return i;var n=e.measureText(t,B).width;return ft.set(t,n),n})),n=e.measureText(t,B),r=n.fontHeight,o=n.ascent,s=n.descent;e.attributes.fontHeight=r,e.attributes.ascent=o,e.attributes.descent=s,e.attributes.widths||(e.attributes.widths=[]),e.attributes.widths.push({widths:i,total:i.reduce((function(t,e){return t+e}),0)})})),a.restore()}if(i==q&&null==v){var ut=r.width,pt=r.height;dt.width=this.contrastSize(Math.round(ut*S/pt)||0,y,b),this.layoutBoxUpdate(dt,n,0)}if(i==J&&null==v){var gt=this.attributes.widths,vt=Math.max.apply(Math,gt.map((function(t){return t.total})));if(s&&V>0&&(vt>V||this.isBlock(this))&&!this.isAbsolute&&!this.isFixed)vt=V-ct;dt.width=this.contrastSize(vt,y,b),this.layoutBoxUpdate(dt,n,0)}if(i==J&&!this.attributes.lines){var yt=this.attributes.widths.length;this.attributes.widths.forEach((function(t){return t.widths.reduce((function(t,e,i){return t+e>dt.width?(yt++,e):t+e}),0)})),yt=W&&yt>W?W:yt,this.attributes.lines=yt}if(i==q&&null==S){var bt=r.width,xt=r.height;dt.height=this.contrastSize(O(dt.width*xt/bt)||0,x,m),this.layoutBoxUpdate(dt,n,1)}i==J&&null==S&&(R=O(R,B),dt.height=this.contrastSize(O(this.attributes.lines*R),x,m),this.layoutBoxUpdate(dt,n,1,!0)),s&&s.children&&V&&([Q,J].includes(i)&&this.isFlex()||i==Q&&this.isBlock(this)&&!this.isInFlow())&&(dt.width=this.contrastSize(V-ct,y,b),this.layoutBoxUpdate(dt,n)),v&&!D(v)&&(dt.width=this.contrastSize(v,y,b),this.layoutBoxUpdate(dt,n,0)),S&&!D(S)&&(dt.height=this.contrastSize(dt.height,x,m),this.layoutBoxUpdate(dt,n,1));var mt=0;if(h.length){var wt=null;h.forEach((function(t,i){t.getBoxWidthHeight();var r=h[i+1];if(r&&r.isInFlow()&&(t.next=r),t.isInFlow()&&!t.inFlexBox()){var o=e.getBoxState(wt,t);e.line&&e.line.canIEnter(t)&&!o?e.line.add(t):(new N).bind(t),wt=t}else t.inFlexBox()?e.line&&(e.line.canIEnter(t)||\"nowrap\"==n.flexWrap)?e.line.add(t):(new G).bind(t):t.isFixed?e.root.fixedLine?e.root.fixedLine.fixedAdd(t):(new N).fixedBind(t):e.fixedLine?e.fixedLine.fixedAdd(t):(new N).fixedBind(t,1)})),this.lines&&(mt=this.lines.reduce((function(t,e){return t+e.height}),0))}var St=0,zt=0;if(!v&&(this.isAbsolute||this.isFixed)&&V){var Bt=P==nt?V:this.root.width,Mt=Bt-(D(c)?O(c,Bt):c)-(D(p)?O(p,Bt):p);St=n.left?Mt:this.lineMaxWidth}if(!S&&(null!=f?f:this.isAbsolute||this.isFixed&&Z)){var It=P==nt?Z:this.root.height,kt=It-(D(f)?O(f,It):f)-(D(u)?O(u,It):u);zt=n.top?kt:0}if(v&&!D(v)||dt.width||(dt.width=St||this.contrastSize((this.isBlock(this)&&!this.isInFlow()?V||s.lineMaxWidth:this.lineMaxWidth)||this.lineMaxWidth,y,b),this.layoutBoxUpdate(dt,n,0)),S||!mt&&!zt||(dt.height=zt||this.contrastSize(mt,x,m),this.layoutBoxUpdate(dt,n)),n.borderRadius&&this.borderSize&&this.borderSize.width)for(var K in n.borderRadius)Object.hasOwnProperty.call(n.borderRadius,K)&&(n.borderRadius[K]=O(n.borderRadius[K],this.borderSize.width));return this.layoutBox},e.layout=function(){return this.getBoxWidthHeight(),this.root.offsetSize=this.offsetSize,this.getBoxPosition2(),this.offsetSize},t}(),ht=function(){var t,e,i,n,r,o,s=[0,11,15,19,23,27,31,16,18,20,22,24,26,28,20,22,24,24,26,28,28,22,24,24,26,26,28,28,24,24,26,26,26,28,28,24,26,26,26,28,28],a=[3220,1468,2713,1235,3062,1890,2119,1549,2344,2936,1117,2583,1330,2470,1667,2249,2028,3780,481,4011,142,3098,831,3445,592,2517,1776,2234,1951,2827,1070,2660,1345,3177],h=[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],d=[1,0,19,7,1,0,16,10,1,0,13,13,1,0,9,17,1,0,34,10,1,0,28,16,1,0,22,22,1,0,16,28,1,0,55,15,1,0,44,26,2,0,17,18,2,0,13,22,1,0,80,20,2,0,32,18,2,0,24,26,4,0,9,16,1,0,108,26,2,0,43,24,2,2,15,18,2,2,11,22,2,0,68,18,4,0,27,16,4,0,19,24,4,0,15,28,2,0,78,20,4,0,31,18,2,4,14,18,4,1,13,26,2,0,97,24,2,2,38,22,4,2,18,22,4,2,14,26,2,0,116,30,3,2,36,22,4,4,16,20,4,4,12,24,2,2,68,18,4,1,43,26,6,2,19,24,6,2,15,28,4,0,81,20,1,4,50,30,4,4,22,28,3,8,12,24,2,2,92,24,6,2,36,22,4,6,20,26,7,4,14,28,4,0,107,26,8,1,37,22,8,4,20,24,12,4,11,22,3,1,115,30,4,5,40,24,11,5,16,20,11,5,12,24,5,1,87,22,5,5,41,24,5,7,24,30,11,7,12,24,5,1,98,24,7,3,45,28,15,2,19,24,3,13,15,30,1,5,107,28,10,1,46,28,1,15,22,28,2,17,14,28,5,1,120,30,9,4,43,26,17,1,22,28,2,19,14,28,3,4,113,28,3,11,44,26,17,4,21,26,9,16,13,26,3,5,107,28,3,13,41,26,15,5,24,30,15,10,15,28,4,4,116,28,17,0,42,26,17,6,22,28,19,6,16,30,2,7,111,28,17,0,46,28,7,16,24,30,34,0,13,24,4,5,121,30,4,14,47,28,11,14,24,30,16,14,15,30,6,4,117,30,6,14,45,28,11,16,24,30,30,2,16,30,8,4,106,26,8,13,47,28,7,22,24,30,22,13,15,30,10,2,114,28,19,4,46,28,28,6,22,28,33,4,16,30,8,4,122,30,22,3,45,28,8,26,23,30,12,28,15,30,3,10,117,30,3,23,45,28,4,31,24,30,11,31,15,30,7,7,116,30,21,7,45,28,1,37,23,30,19,26,15,30,5,10,115,30,19,10,47,28,15,25,24,30,23,25,15,30,13,3,115,30,2,29,46,28,42,1,24,30,23,28,15,30,17,0,115,30,10,23,46,28,10,35,24,30,19,35,15,30,17,1,115,30,14,21,46,28,29,19,24,30,11,46,15,30,13,6,115,30,14,23,46,28,44,7,24,30,59,1,16,30,12,7,121,30,12,26,47,28,39,14,24,30,22,41,15,30,6,14,121,30,6,34,47,28,46,10,24,30,2,64,15,30,17,4,122,30,29,14,46,28,49,10,24,30,24,46,15,30,4,18,122,30,13,32,46,28,48,14,24,30,42,32,15,30,20,4,117,30,40,7,47,28,43,22,24,30,10,67,15,30,19,6,118,30,18,31,47,28,34,34,24,30,20,61,15,30],c=[255,0,1,25,2,50,26,198,3,223,51,238,27,104,199,75,4,100,224,14,52,141,239,129,28,193,105,248,200,8,76,113,5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154,9,120,77,228,114,166,6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87,7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175],l=[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,0],f=[],u=[],p=[],g=[],v=[],y=2;function b(t,e){var i;t>e&&(i=t,t=e,e=i),i=e,i*=e,i+=e,i>>=1,g[i+=t]=1}function x(t,i){var n;for(p[t+e*i]=1,n=-2;n<2;n++)p[t+n+e*(i-2)]=1,p[t-2+e*(i+n+1)]=1,p[t+2+e*(i+n)]=1,p[t+n+1+e*(i+2)]=1;for(n=0;n<2;n++)b(t-1,i+n),b(t+1,i-n),b(t-n,i-1),b(t+n,i+1)}function m(t){for(;t>=255;)t=((t-=255)>>8)+(255&t);return t}var w=[];function S(t,e,i,n){var r,o,s;for(r=0;re&&(i=t,t=e,e=i),i=e,i+=e*e,i>>=1,g[i+=t]}function B(t){var i,n,r,o;switch(t){case 0:for(n=0;n>1&1,i=0;i=5&&(i+=3+v[e]-5);for(e=3;et||3*v[e-3]>=4*v[e]||3*v[e+3]>=4*v[e])&&(i+=40);return i}function I(){var t,i,n,r,o,s=0,a=0;for(i=0;ie*e;)h-=e*e,d++;for(s+=10*d,t=0;t1)for(W=s[t],k=e-7;;){for(M=e-7;M>W-3&&(x(M,k),!(M6)for(W=a[t-7],P=17,M=0;M<6;M++)for(k=0;k<3;k++,P--)1&(P>11?t>>P-12:W>>P)?(p[5-M+e*(2-k+e-11)]=1,p[2-k+e-11+e*(5-M)]=1):(b(5-M,2-k+e-11),b(2-k+e-11,5-M));for(k=0;k=(M=r*(i+n)+n)-2&&(R=M-2,t>9&&R--),O=R,t>9){for(f[O+2]=0,f[O+3]=0;O--;)W=f[O],f[O+3]|=255&W<<4,f[O+2]=W>>4;f[2]|=255&R<<4,f[1]=R>>4,f[0]=64|R>>12}else{for(f[O+1]=0,f[O+2]=0;O--;)W=f[O],f[O+2]|=255&W<<4,f[O+1]=W>>4;f[1]|=255&R<<4,f[0]=64|R>>4}for(O=R+3-(t<10);O0;L--)w[L]=w[L]?w[L-1]^l[m(c[w[L]]+O)]:w[L-1];w[0]=l[m(c[w[0]]+O)]}for(O=0;O<=o;O++)w[O]=c[w[O]];for(P=M,k=0,O=0;O>=1)1&k&&(p[e-1-P+8*e]=1,P<6?p[8+e*P]=1:p[8+e*(P+1)]=1);for(P=0;P<7;P++,k>>=1)1&k&&(p[8+e*(e-7+P)]=1,P?p[6-P+8*e]=1:p[7+8*e]=1);return p}(v)},utf16to8:function(t){var e,i,n,r;for(e=\"\",n=t.length,i=0;i=1&&r<=127?e+=t.charAt(i):r>2047?(e+=String.fromCharCode(224|r>>12&15),e+=String.fromCharCode(128|r>>6&63),e+=String.fromCharCode(128|r>>0&63)):(e+=String.fromCharCode(192|r>>6&31),e+=String.fromCharCode(128|r>>0&63));return e},draw:function(t,i,n,r,o){i.drawView(n,r);var s=i.ctx,a=n.contentSize,h=a.width,d=a.height,c=a.left,l=a.top;r.borderRadius,r.backgroundColor;var f=r.color,u=void 0===f?\"#000000\":f;r.border,n.contentSize.left,n.borderSize.left,n.contentSize.top,n.borderSize.top;if(y=o||y,s){s.save(),i.setOpacity(r),i.setTransform(n,r);var p=Math.min(h,d);t=this.utf16to8(t);var g=this.getFrame(t),v=p/e;s.setFillStyle(u);for(var b=0;b=s||\"cover\"==n&&o=s)&&(a=e.width/i.width);var h=i.width*a,d=i.height*a,c=r||[],l=c[0],f=c[1],u=/^\\d+px|rpx$/.test(l)?O(l,e.width):(e.width-h)*(L(l)?O(l,1):{left:0,center:.5,right:1}[l||\"center\"]),p=/^\\d+px|rpx$/.test(f)?O(f,e.height):(e.height-d)*(L(f)?O(f,1):{top:0,center:.5,bottom:1}[f||\"center\"]),g=function(t,e){return[(t-u)/a,(e-p)/a]},v=g(0,0),y=v[0],b=v[1],x=g(e.width,e.height),m=x[0],w=x[1];return{sx:Math.max(y,0),sy:Math.max(b,0),sw:Math.min(m-y,i.width),sh:Math.min(w-b,i.height),dx:Math.max(u,0),dy:Math.max(p,0),dw:Math.min(h,e.width),dh:Math.min(d,e.height)}}({objectFit:u,objectPosition:v},n.contentSize,t),r=i.sx,s=i.sy,a=i.sh,h=i.sw,d=i.dx,c=i.dy,l=i.dh,f=i.dw;k==o.MP_BAIDU?e.drawImage(t.src,d+w,c+S,f,l,r,s,h,a):e.drawImage(t.src,r,s,h,a,d+w,c+S,f,l)}else e.drawImage(t.src,w,S,x,m)},I=function(){e.restore(),W.drawView(n,r,!1,!0,!1),h(1)},P=function(t){M(t),I()},P(t),[2]}))}))}))];case 1:return h.sent(),[2]}}))}))},n.prototype.drawText=function(t,e,i,n){var r=this.ctx,o=e.borderSize,s=e.contentSize,a=e.left,h=e.top,d=s.width,c=s.height,l=s.left-o.left,f=s.top-o.top,u=i.color,p=void 0===u?\"#000000\":u,g=i.lineHeight,v=void 0===g?\"1.4em\":g,y=i.fontSize,b=void 0===y?14:y,x=i.fontWeight,m=i.fontFamily,w=i.fontStyle,S=i.textAlign,z=void 0===S?\"left\":S,B=i.verticalAlign,M=void 0===B?pt:B,I=i.backgroundColor,k=i.lineClamp,P=i.backgroundClip,W=i.textShadow,R=i.textDecoration;if(this.drawView(e,i,P!=ct),v=O(v,b),t){switch(r.save(),this.setShadow({boxShadow:W}),a+=l,h+=f,r.setFonts({fontFamily:m,fontSize:b,fontWeight:x,fontStyle:w}),r.setTextBaseline(pt),r.setTextAlign(z),P?this.setBackground(I,d,c,a,h):r.setFillStyle(p),z){case vt:break;case yt:a+=.5*d;break;case bt:a+=d}var L=n.lines*v,T=Math.ceil((c-L)/2);switch(T<0&&(T=0),M){case ut:break;case pt:h+=T;break;case gt:h+=2*T}var A=n.fontHeight,F=n.descent,j=(v-A)/2,C=function(t){var e=r.measureText(t),i=e.actualBoundingBoxDescent,n=void 0===i?0:i,o=e.actualBoundingBoxAscent,s=void 0===o?0:o,a=n+s||.7*b+1;return M==ut?{fix:s,height:a,lineY:v-a}:M==pt?{fix:v/2+n/4,height:a,lineY:(v-a)/2}:M==gt?{fix:v-n,height:a,lineY:0}:{fix:0,height:0,lineY:0}},E=function(t,e,i){var o=t;switch(z){case vt:o+=i;break;case yt:o=(t-=i/2)+i;break;case bt:o=t,t-=i}if(R){r.setLineWidth(b/13),r.beginPath();var s=.1*n.fontHeight;/\\bunderline\\b/.test(R)&&(F||(e+=j/2),r.moveTo(t,e+s),r.lineTo(o,e+s)),/\\boverline\\b/.test(R)&&(F||(e-=j/2),r.moveTo(t,e-n.fontHeight-s),r.lineTo(o,e-n.fontHeight-s)),/\\bline-through\\b/.test(R)&&(r.moveTo(t,e-.5*n.fontHeight),r.lineTo(o,e-.5*n.fontHeight)),r.closePath(),r.setStrokeStyle(p),r.stroke()}};if(!n.widths||1==n.widths.length&&n.widths[0].total<=s.width){var H=C(t),U=H.fix,Y=H.lineY;return r.fillText(t,a,h+U),E(a,(h+=v)-Y,n&&n.widths&&n.widths[0].total||n.text),r.restore(),void this.setBorder(e,i)}for(var $=t.split(\"\"),D=h,X=a,_=\"\",N=0,V=0;V<=$.length;V++){var G=$[V]||\"\",q=\"\\n\"===G,J=\"\"==G,Q=_+(G=q?\"\":G),Z=r.measureText(Q).width;if(N>=k)break;if(X=a,Z>s.width||q||J){if(N++,_=J&&Z<=s.width?Q:_,N===k&&Z>d){for(;r.measureText(\"\".concat(_,\"...\")).width>s.width&&!(_.length<=1);)_=_.substring(0,_.length-1);_+=\"...\"}var K=C(_);U=K.fix,Y=K.lineY;if(r.fillText(_,X,h+U),E(X,(h+=v)-Y,Z),_=G,h>D+c)break}else _=Q}r.restore()}},n.prototype.source=function(t){var n;return e(this,void 0,void 0,(function(){var e,r,o,s=this;return i(this,(function(i){switch(i.label){case 0:if(this.node=null,e=+new Date,\"{}\"==JSON.stringify(t))return[2];if(!t.type)for(r in t.type=ft,t.css=t.css||{},t)[\"views\",\"children\",\"type\",\"css\"].includes(r)||(t.css[r]=t[r],delete t[r]);return(null===(n=t.css)||void 0===n?void 0:n.width)||t.css||(t.css={}),[4,this.create(t)];case 1:return o=i.sent(),this.size=(null==o?void 0:o.layout())||{},this.node=o,this.onEffectFinished().then((function(t){return s.lifecycle(\"onEffectSuccess\",t)})).catch((function(t){return s.lifecycle(\"onEffectFail\",t)})),console.log(\"布局用时:\"+(+new Date-e)+\"ms\"),[2,this.size]}}))}))},n.prototype.getImageInfo=function(t){return this.imageBus[t]||(this.imageBus[t]=this.createImage(t,this.useCORS)),this.imageBus[t]},n.prototype.create=function(n,r){var o,s;return e(this,void 0,void 0,(function(){var e,a,h,d,c,l,f,u,p,g,v,y,b,x,m,S,z;return i(this,(function(i){switch(i.label){case 0:if(e=n.type==dt,a=[ct,lt].includes(n.type),h=n.css||{},d=h.backgroundImage,c=h.display,e&&!n.src&&!n.url||a&&!n.text)return[2];if(c==w)return[2];if(a&&(n.text=String(n.text)),!(e||n.type==ft&&d))return[3,4];l=e?n.src:\"\",f=/url\\((.+)\\)/,d&&(null===(o=f.exec(d))||void 0===o?void 0:o[1])&&(l=(null===(s=f.exec(d))||void 0===s?void 0:s[1])||\"\"),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.getImageInfo(l)];case 2:return u=i.sent(),p=u.width,g=u.height,!(v=u.path)&&e?[2]:(v&&(n.attributes=Object.assign(n.attributes||{},{width:p,height:g,path:v,src:v,naturalSrc:l})),[3,4]);case 3:return y=i.sent(),n.type!=ft?[2]:(this.lifecycle(\"onEffectFail\",t(t({},y),{src:l})),[3,4]);case 4:if(this.count+=1,b=new at(n,r,this.root,this.ctx),!(x=n.views||n.children))return[3,8];m=0,i.label=5;case 5:return m\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t{{ptitle}}\r\n\t\t\t\r\n\t\t\t\t{{item.text}}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\t{{item.text}}\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\r\n\t\r\n